@plasius/ai-game 0.1.3 → 0.1.6

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/dist/index.d.cts CHANGED
@@ -1,3 +1,81 @@
1
+ declare const AI_GAME_POINTS_STORE_FEATURE_FLAG_ID = "isekai.player-system.points-store.enabled";
2
+ declare const AI_GAME_POINTS_LEDGER_IDS: readonly ["pp", "esp", "tis", "dis"];
3
+ type AiGamePointsLedgerId = (typeof AI_GAME_POINTS_LEDGER_IDS)[number];
4
+ declare const AI_GAME_PLAYER_EVOLUTION_STAGES: readonly ["proto-social", "social-lock"];
5
+ type AiGamePlayerEvolutionStage = (typeof AI_GAME_PLAYER_EVOLUTION_STAGES)[number];
6
+ declare const AI_GAME_POINTS_AUTHORITY_BANDS: readonly ["self", "frontier", "civic", "divine"];
7
+ type AiGamePointsAuthorityBand = (typeof AI_GAME_POINTS_AUTHORITY_BANDS)[number];
8
+ declare const AI_GAME_POINTS_AUTHORITY_SYSTEMS: readonly ["player-system", "exploration-system", "territorial-influence-system", "divine-influence-system"];
9
+ type AiGamePointsAuthoritySystem = (typeof AI_GAME_POINTS_AUTHORITY_SYSTEMS)[number];
10
+ interface AiGamePointsAuthorityBoundary {
11
+ readonly ledgerId: AiGamePointsLedgerId;
12
+ readonly authorityBand: AiGamePointsAuthorityBand;
13
+ readonly authoritySystem: AiGamePointsAuthoritySystem;
14
+ readonly requiresWorldAuthority: boolean;
15
+ readonly combatSafeOnly: boolean;
16
+ }
17
+ interface AiGamePointsLedgerSnapshot {
18
+ readonly ledgerId: AiGamePointsLedgerId;
19
+ readonly balance: number;
20
+ readonly earnedTotal: number;
21
+ readonly spentTotal: number;
22
+ readonly committedTotal: number;
23
+ readonly asOfEpochMs?: number;
24
+ }
25
+ interface AiGamePointsSpendAction {
26
+ readonly actionId: string;
27
+ readonly title: string;
28
+ readonly cost: number;
29
+ readonly prerequisiteCodes: readonly string[];
30
+ readonly consequenceCodes: readonly string[];
31
+ }
32
+ interface AiGamePointsSpendPolicy {
33
+ readonly policyId: string;
34
+ readonly ledgerId: AiGamePointsLedgerId;
35
+ readonly authorityBoundary: AiGamePointsAuthorityBoundary;
36
+ readonly actions: readonly AiGamePointsSpendAction[];
37
+ }
38
+ interface AiGameProtoSocialDevolutionPolicy {
39
+ readonly actionId: "return-to-slime";
40
+ readonly ledgerId: "pp";
41
+ readonly cost: number;
42
+ readonly requiredEvolutionStage: "proto-social";
43
+ readonly closesAtEvolutionStage: "social-lock";
44
+ readonly singleUse: true;
45
+ readonly authorityBoundary: AiGamePointsAuthorityBoundary;
46
+ readonly prerequisiteCodes: readonly string[];
47
+ readonly consequenceCodes: readonly string[];
48
+ }
49
+ interface ResolveAiGameProtoSocialDevolutionEligibilityInput {
50
+ readonly evolutionStage: AiGamePlayerEvolutionStage;
51
+ readonly currentBalance: number;
52
+ readonly alreadyUsed: boolean;
53
+ }
54
+ interface AiGameProtoSocialDevolutionEligibilityResult {
55
+ readonly available: boolean;
56
+ readonly reasonCodes: readonly string[];
57
+ readonly policy: AiGameProtoSocialDevolutionPolicy;
58
+ }
59
+ interface AiGameProtoSocialDevolutionExecution {
60
+ readonly actionId: "return-to-slime";
61
+ readonly ledgerId: "pp";
62
+ readonly cost: number;
63
+ readonly authorityBoundary: AiGamePointsAuthorityBoundary;
64
+ readonly previousEvolutionStage: "proto-social";
65
+ readonly resultingEvolutionStage: "proto-social";
66
+ readonly consequenceCodes: readonly string[];
67
+ }
68
+ declare function isAiGamePointsLedgerId(value: string): value is AiGamePointsLedgerId;
69
+ declare function isAiGamePlayerEvolutionStage(value: string): value is AiGamePlayerEvolutionStage;
70
+ declare function resolveAiGamePointsAuthorityBoundary(ledgerId: AiGamePointsLedgerId): AiGamePointsAuthorityBoundary;
71
+ declare function createAiGamePointsLedgerSnapshot(input: AiGamePointsLedgerSnapshot): AiGamePointsLedgerSnapshot;
72
+ declare function getDefaultAiGamePointsSpendPolicies(): readonly AiGamePointsSpendPolicy[];
73
+ declare function getAiGameProtoSocialDevolutionPolicy(): AiGameProtoSocialDevolutionPolicy;
74
+ /**
75
+ * Evaluate whether the one-time PP devolution action is still allowed.
76
+ */
77
+ declare function evaluateAiGameProtoSocialDevolutionEligibility(input: ResolveAiGameProtoSocialDevolutionEligibilityInput): AiGameProtoSocialDevolutionEligibilityResult;
78
+
1
79
  type Version = string;
2
80
  type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
3
81
  readonly [key: string]: JsonValue;
@@ -396,7 +474,8 @@ declare const aiGameFeatureFlags: Readonly<{
396
474
  gossipTopics: "ai.game.npc-gossip.topics.enabled";
397
475
  gossipPerspective: "ai.game.npc-gossip.perspective.enabled";
398
476
  gossipLifecycle: "ai.game.npc-gossip.lifecycle.enabled";
477
+ pointsStore: "isekai.player-system.points-store.enabled";
399
478
  }>;
400
- declare const gameEventFeatureFlags: readonly ("ai.game.event-recorder.contracts.enabled" | "ai.game.event-recorder.ingestion.enabled" | "ai.game.event-recorder.impact.enabled" | "ai.game.npc-gossip.topics.enabled" | "ai.game.npc-gossip.perspective.enabled" | "ai.game.npc-gossip.lifecycle.enabled")[];
479
+ declare const gameEventFeatureFlags: readonly ("ai.game.event-recorder.contracts.enabled" | "ai.game.event-recorder.ingestion.enabled" | "ai.game.event-recorder.impact.enabled" | "ai.game.npc-gossip.topics.enabled" | "ai.game.npc-gossip.perspective.enabled" | "ai.game.npc-gossip.lifecycle.enabled" | "isekai.player-system.points-store.enabled")[];
401
480
 
402
- export { AI_GAME_ACTOR_ROLES, AI_GAME_ENV_PREFIX, AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID, AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID, AI_GAME_FEATURE_FLAGS, AI_GAME_FEATURE_FLAG_ID, AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID, AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID, AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID, AI_GAME_PACKAGE, AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID, AI_GAME_TASK_AUTHORITY_BOUNDARIES, AI_GAME_TASK_DECISIONS, AI_GAME_TASK_KINDS, AI_GAME_TASK_RESULTS, AI_GAME_TASK_RISK_CLASSES, AI_GAME_TTS_CACHE_POLICIES, type AiGameActorRole, type AiGameAuthorityBoundary, type AiGameFeatureFlagKey, type AiGameFeatureFlagSnapshot, type AiGamePolicyAuditBase, type AiGameTaskDecision, type AiGameTaskDecisionResult, type AiGameTaskKind, type AiGameTaskRequest, type AiGameTaskResolution, type AiGameTaskResult, type AiGameTaskRiskClass, type AiGameTtsCachePolicy, type AiPackageDescriptor, type DungeonClearedPayload, type DungeonCreatedPayload, type EventSourceLink, type FamineStartedPayload, type GameEventActor, type GameEventActorKind, type GameEventCausation, type GameEventCommitReceipt, type GameEventLocation, type GameEventParticipant, type GameEventParticipantRole, type GameEventRecordType, type GameEventSeverity, type GameEventSubmissionChannel, type GameEventSubmissionReceipt, type GameEventValidationIssue, type GameEventValidationResult, type GameEventVisibilityClass, type GameWorldEvent, type GameWorldEventCandidate, type GameWorldEventCanonical, type GameWorldEventEnvelope, type GameWorldEventPayload, type GameWorldEventPayloadBase, type GameWorldEventType, type GossipAudienceSegment, type GossipConfidence, type GossipLifecyclePort, type GossipPerspectiveProjection, type GossipProjectionMode, type GossipSalience, type GossipSpeechHint, type GossipTopic, type GossipTopicEnvelope, type GossipTopicPayload, type GossipTopicStatus, type JsonValue, type KnowledgeSource, type MonsterKilledPayload, type MonsterSpawnedPayload, type PerspectiveRule, type ProjectedGossipEnvelope, type ProjectionCheckpointStore, type ProjectionProjectorCheckpoint, type ResolveAiGamePlayerAddressInput, type ResolveAiGamePlayerAddressResult, type ResolveAiGameTaskInput, type SurplusUpdatedPayload, type SystemCheckpointPayload, type Version, type WarDeclaredPayload, type WarResolvedPayload, type WitnessChannel, type WorldEventIngestionPort, type WorldEventProjectorPort, type WorldIncidentImpactKey, type WorldIncidentImpactVector, type WorldIncidentLifecycle, type WorldIncidentRegistry, type WorldIncidentResolution, type WorldIncidentScope, type WorldIncidentThread, aiGameFeatureFlags, classifyAiGameTask, gameEventFeatureFlags, isCandidateWorldEvent, isCanonicalWorldEvent, isGossipTopicActive, isGossipTopicCorrected, isIncidentResolved, normalizeIncidentImpactVector, packageDescriptor, projectTopicForAudience, resolveAiGamePlayerAddressText, resolveAiGameTaskBatch };
481
+ export { AI_GAME_ACTOR_ROLES, AI_GAME_ENV_PREFIX, AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID, AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID, AI_GAME_FEATURE_FLAGS, AI_GAME_FEATURE_FLAG_ID, AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID, AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID, AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID, AI_GAME_PACKAGE, AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID, AI_GAME_PLAYER_EVOLUTION_STAGES, AI_GAME_POINTS_AUTHORITY_BANDS, AI_GAME_POINTS_AUTHORITY_SYSTEMS, AI_GAME_POINTS_LEDGER_IDS, AI_GAME_POINTS_STORE_FEATURE_FLAG_ID, AI_GAME_TASK_AUTHORITY_BOUNDARIES, AI_GAME_TASK_DECISIONS, AI_GAME_TASK_KINDS, AI_GAME_TASK_RESULTS, AI_GAME_TASK_RISK_CLASSES, AI_GAME_TTS_CACHE_POLICIES, type AiGameActorRole, type AiGameAuthorityBoundary, type AiGameFeatureFlagKey, type AiGameFeatureFlagSnapshot, type AiGamePlayerEvolutionStage, type AiGamePointsAuthorityBand, type AiGamePointsAuthorityBoundary, type AiGamePointsAuthoritySystem, type AiGamePointsLedgerId, type AiGamePointsLedgerSnapshot, type AiGamePointsSpendAction, type AiGamePointsSpendPolicy, type AiGamePolicyAuditBase, type AiGameProtoSocialDevolutionEligibilityResult, type AiGameProtoSocialDevolutionExecution, type AiGameProtoSocialDevolutionPolicy, type AiGameTaskDecision, type AiGameTaskDecisionResult, type AiGameTaskKind, type AiGameTaskRequest, type AiGameTaskResolution, type AiGameTaskResult, type AiGameTaskRiskClass, type AiGameTtsCachePolicy, type AiPackageDescriptor, type DungeonClearedPayload, type DungeonCreatedPayload, type EventSourceLink, type FamineStartedPayload, type GameEventActor, type GameEventActorKind, type GameEventCausation, type GameEventCommitReceipt, type GameEventLocation, type GameEventParticipant, type GameEventParticipantRole, type GameEventRecordType, type GameEventSeverity, type GameEventSubmissionChannel, type GameEventSubmissionReceipt, type GameEventValidationIssue, type GameEventValidationResult, type GameEventVisibilityClass, type GameWorldEvent, type GameWorldEventCandidate, type GameWorldEventCanonical, type GameWorldEventEnvelope, type GameWorldEventPayload, type GameWorldEventPayloadBase, type GameWorldEventType, type GossipAudienceSegment, type GossipConfidence, type GossipLifecyclePort, type GossipPerspectiveProjection, type GossipProjectionMode, type GossipSalience, type GossipSpeechHint, type GossipTopic, type GossipTopicEnvelope, type GossipTopicPayload, type GossipTopicStatus, type JsonValue, type KnowledgeSource, type MonsterKilledPayload, type MonsterSpawnedPayload, type PerspectiveRule, type ProjectedGossipEnvelope, type ProjectionCheckpointStore, type ProjectionProjectorCheckpoint, type ResolveAiGamePlayerAddressInput, type ResolveAiGamePlayerAddressResult, type ResolveAiGameProtoSocialDevolutionEligibilityInput, type ResolveAiGameTaskInput, type SurplusUpdatedPayload, type SystemCheckpointPayload, type Version, type WarDeclaredPayload, type WarResolvedPayload, type WitnessChannel, type WorldEventIngestionPort, type WorldEventProjectorPort, type WorldIncidentImpactKey, type WorldIncidentImpactVector, type WorldIncidentLifecycle, type WorldIncidentRegistry, type WorldIncidentResolution, type WorldIncidentScope, type WorldIncidentThread, aiGameFeatureFlags, classifyAiGameTask, createAiGamePointsLedgerSnapshot, evaluateAiGameProtoSocialDevolutionEligibility, gameEventFeatureFlags, getAiGameProtoSocialDevolutionPolicy, getDefaultAiGamePointsSpendPolicies, isAiGamePlayerEvolutionStage, isAiGamePointsLedgerId, isCandidateWorldEvent, isCanonicalWorldEvent, isGossipTopicActive, isGossipTopicCorrected, isIncidentResolved, normalizeIncidentImpactVector, packageDescriptor, projectTopicForAudience, resolveAiGamePlayerAddressText, resolveAiGamePointsAuthorityBoundary, resolveAiGameTaskBatch };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,81 @@
1
+ declare const AI_GAME_POINTS_STORE_FEATURE_FLAG_ID = "isekai.player-system.points-store.enabled";
2
+ declare const AI_GAME_POINTS_LEDGER_IDS: readonly ["pp", "esp", "tis", "dis"];
3
+ type AiGamePointsLedgerId = (typeof AI_GAME_POINTS_LEDGER_IDS)[number];
4
+ declare const AI_GAME_PLAYER_EVOLUTION_STAGES: readonly ["proto-social", "social-lock"];
5
+ type AiGamePlayerEvolutionStage = (typeof AI_GAME_PLAYER_EVOLUTION_STAGES)[number];
6
+ declare const AI_GAME_POINTS_AUTHORITY_BANDS: readonly ["self", "frontier", "civic", "divine"];
7
+ type AiGamePointsAuthorityBand = (typeof AI_GAME_POINTS_AUTHORITY_BANDS)[number];
8
+ declare const AI_GAME_POINTS_AUTHORITY_SYSTEMS: readonly ["player-system", "exploration-system", "territorial-influence-system", "divine-influence-system"];
9
+ type AiGamePointsAuthoritySystem = (typeof AI_GAME_POINTS_AUTHORITY_SYSTEMS)[number];
10
+ interface AiGamePointsAuthorityBoundary {
11
+ readonly ledgerId: AiGamePointsLedgerId;
12
+ readonly authorityBand: AiGamePointsAuthorityBand;
13
+ readonly authoritySystem: AiGamePointsAuthoritySystem;
14
+ readonly requiresWorldAuthority: boolean;
15
+ readonly combatSafeOnly: boolean;
16
+ }
17
+ interface AiGamePointsLedgerSnapshot {
18
+ readonly ledgerId: AiGamePointsLedgerId;
19
+ readonly balance: number;
20
+ readonly earnedTotal: number;
21
+ readonly spentTotal: number;
22
+ readonly committedTotal: number;
23
+ readonly asOfEpochMs?: number;
24
+ }
25
+ interface AiGamePointsSpendAction {
26
+ readonly actionId: string;
27
+ readonly title: string;
28
+ readonly cost: number;
29
+ readonly prerequisiteCodes: readonly string[];
30
+ readonly consequenceCodes: readonly string[];
31
+ }
32
+ interface AiGamePointsSpendPolicy {
33
+ readonly policyId: string;
34
+ readonly ledgerId: AiGamePointsLedgerId;
35
+ readonly authorityBoundary: AiGamePointsAuthorityBoundary;
36
+ readonly actions: readonly AiGamePointsSpendAction[];
37
+ }
38
+ interface AiGameProtoSocialDevolutionPolicy {
39
+ readonly actionId: "return-to-slime";
40
+ readonly ledgerId: "pp";
41
+ readonly cost: number;
42
+ readonly requiredEvolutionStage: "proto-social";
43
+ readonly closesAtEvolutionStage: "social-lock";
44
+ readonly singleUse: true;
45
+ readonly authorityBoundary: AiGamePointsAuthorityBoundary;
46
+ readonly prerequisiteCodes: readonly string[];
47
+ readonly consequenceCodes: readonly string[];
48
+ }
49
+ interface ResolveAiGameProtoSocialDevolutionEligibilityInput {
50
+ readonly evolutionStage: AiGamePlayerEvolutionStage;
51
+ readonly currentBalance: number;
52
+ readonly alreadyUsed: boolean;
53
+ }
54
+ interface AiGameProtoSocialDevolutionEligibilityResult {
55
+ readonly available: boolean;
56
+ readonly reasonCodes: readonly string[];
57
+ readonly policy: AiGameProtoSocialDevolutionPolicy;
58
+ }
59
+ interface AiGameProtoSocialDevolutionExecution {
60
+ readonly actionId: "return-to-slime";
61
+ readonly ledgerId: "pp";
62
+ readonly cost: number;
63
+ readonly authorityBoundary: AiGamePointsAuthorityBoundary;
64
+ readonly previousEvolutionStage: "proto-social";
65
+ readonly resultingEvolutionStage: "proto-social";
66
+ readonly consequenceCodes: readonly string[];
67
+ }
68
+ declare function isAiGamePointsLedgerId(value: string): value is AiGamePointsLedgerId;
69
+ declare function isAiGamePlayerEvolutionStage(value: string): value is AiGamePlayerEvolutionStage;
70
+ declare function resolveAiGamePointsAuthorityBoundary(ledgerId: AiGamePointsLedgerId): AiGamePointsAuthorityBoundary;
71
+ declare function createAiGamePointsLedgerSnapshot(input: AiGamePointsLedgerSnapshot): AiGamePointsLedgerSnapshot;
72
+ declare function getDefaultAiGamePointsSpendPolicies(): readonly AiGamePointsSpendPolicy[];
73
+ declare function getAiGameProtoSocialDevolutionPolicy(): AiGameProtoSocialDevolutionPolicy;
74
+ /**
75
+ * Evaluate whether the one-time PP devolution action is still allowed.
76
+ */
77
+ declare function evaluateAiGameProtoSocialDevolutionEligibility(input: ResolveAiGameProtoSocialDevolutionEligibilityInput): AiGameProtoSocialDevolutionEligibilityResult;
78
+
1
79
  type Version = string;
2
80
  type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
3
81
  readonly [key: string]: JsonValue;
@@ -396,7 +474,8 @@ declare const aiGameFeatureFlags: Readonly<{
396
474
  gossipTopics: "ai.game.npc-gossip.topics.enabled";
397
475
  gossipPerspective: "ai.game.npc-gossip.perspective.enabled";
398
476
  gossipLifecycle: "ai.game.npc-gossip.lifecycle.enabled";
477
+ pointsStore: "isekai.player-system.points-store.enabled";
399
478
  }>;
400
- declare const gameEventFeatureFlags: readonly ("ai.game.event-recorder.contracts.enabled" | "ai.game.event-recorder.ingestion.enabled" | "ai.game.event-recorder.impact.enabled" | "ai.game.npc-gossip.topics.enabled" | "ai.game.npc-gossip.perspective.enabled" | "ai.game.npc-gossip.lifecycle.enabled")[];
479
+ declare const gameEventFeatureFlags: readonly ("ai.game.event-recorder.contracts.enabled" | "ai.game.event-recorder.ingestion.enabled" | "ai.game.event-recorder.impact.enabled" | "ai.game.npc-gossip.topics.enabled" | "ai.game.npc-gossip.perspective.enabled" | "ai.game.npc-gossip.lifecycle.enabled" | "isekai.player-system.points-store.enabled")[];
401
480
 
402
- export { AI_GAME_ACTOR_ROLES, AI_GAME_ENV_PREFIX, AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID, AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID, AI_GAME_FEATURE_FLAGS, AI_GAME_FEATURE_FLAG_ID, AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID, AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID, AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID, AI_GAME_PACKAGE, AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID, AI_GAME_TASK_AUTHORITY_BOUNDARIES, AI_GAME_TASK_DECISIONS, AI_GAME_TASK_KINDS, AI_GAME_TASK_RESULTS, AI_GAME_TASK_RISK_CLASSES, AI_GAME_TTS_CACHE_POLICIES, type AiGameActorRole, type AiGameAuthorityBoundary, type AiGameFeatureFlagKey, type AiGameFeatureFlagSnapshot, type AiGamePolicyAuditBase, type AiGameTaskDecision, type AiGameTaskDecisionResult, type AiGameTaskKind, type AiGameTaskRequest, type AiGameTaskResolution, type AiGameTaskResult, type AiGameTaskRiskClass, type AiGameTtsCachePolicy, type AiPackageDescriptor, type DungeonClearedPayload, type DungeonCreatedPayload, type EventSourceLink, type FamineStartedPayload, type GameEventActor, type GameEventActorKind, type GameEventCausation, type GameEventCommitReceipt, type GameEventLocation, type GameEventParticipant, type GameEventParticipantRole, type GameEventRecordType, type GameEventSeverity, type GameEventSubmissionChannel, type GameEventSubmissionReceipt, type GameEventValidationIssue, type GameEventValidationResult, type GameEventVisibilityClass, type GameWorldEvent, type GameWorldEventCandidate, type GameWorldEventCanonical, type GameWorldEventEnvelope, type GameWorldEventPayload, type GameWorldEventPayloadBase, type GameWorldEventType, type GossipAudienceSegment, type GossipConfidence, type GossipLifecyclePort, type GossipPerspectiveProjection, type GossipProjectionMode, type GossipSalience, type GossipSpeechHint, type GossipTopic, type GossipTopicEnvelope, type GossipTopicPayload, type GossipTopicStatus, type JsonValue, type KnowledgeSource, type MonsterKilledPayload, type MonsterSpawnedPayload, type PerspectiveRule, type ProjectedGossipEnvelope, type ProjectionCheckpointStore, type ProjectionProjectorCheckpoint, type ResolveAiGamePlayerAddressInput, type ResolveAiGamePlayerAddressResult, type ResolveAiGameTaskInput, type SurplusUpdatedPayload, type SystemCheckpointPayload, type Version, type WarDeclaredPayload, type WarResolvedPayload, type WitnessChannel, type WorldEventIngestionPort, type WorldEventProjectorPort, type WorldIncidentImpactKey, type WorldIncidentImpactVector, type WorldIncidentLifecycle, type WorldIncidentRegistry, type WorldIncidentResolution, type WorldIncidentScope, type WorldIncidentThread, aiGameFeatureFlags, classifyAiGameTask, gameEventFeatureFlags, isCandidateWorldEvent, isCanonicalWorldEvent, isGossipTopicActive, isGossipTopicCorrected, isIncidentResolved, normalizeIncidentImpactVector, packageDescriptor, projectTopicForAudience, resolveAiGamePlayerAddressText, resolveAiGameTaskBatch };
481
+ export { AI_GAME_ACTOR_ROLES, AI_GAME_ENV_PREFIX, AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID, AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID, AI_GAME_FEATURE_FLAGS, AI_GAME_FEATURE_FLAG_ID, AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID, AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID, AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID, AI_GAME_PACKAGE, AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID, AI_GAME_PLAYER_EVOLUTION_STAGES, AI_GAME_POINTS_AUTHORITY_BANDS, AI_GAME_POINTS_AUTHORITY_SYSTEMS, AI_GAME_POINTS_LEDGER_IDS, AI_GAME_POINTS_STORE_FEATURE_FLAG_ID, AI_GAME_TASK_AUTHORITY_BOUNDARIES, AI_GAME_TASK_DECISIONS, AI_GAME_TASK_KINDS, AI_GAME_TASK_RESULTS, AI_GAME_TASK_RISK_CLASSES, AI_GAME_TTS_CACHE_POLICIES, type AiGameActorRole, type AiGameAuthorityBoundary, type AiGameFeatureFlagKey, type AiGameFeatureFlagSnapshot, type AiGamePlayerEvolutionStage, type AiGamePointsAuthorityBand, type AiGamePointsAuthorityBoundary, type AiGamePointsAuthoritySystem, type AiGamePointsLedgerId, type AiGamePointsLedgerSnapshot, type AiGamePointsSpendAction, type AiGamePointsSpendPolicy, type AiGamePolicyAuditBase, type AiGameProtoSocialDevolutionEligibilityResult, type AiGameProtoSocialDevolutionExecution, type AiGameProtoSocialDevolutionPolicy, type AiGameTaskDecision, type AiGameTaskDecisionResult, type AiGameTaskKind, type AiGameTaskRequest, type AiGameTaskResolution, type AiGameTaskResult, type AiGameTaskRiskClass, type AiGameTtsCachePolicy, type AiPackageDescriptor, type DungeonClearedPayload, type DungeonCreatedPayload, type EventSourceLink, type FamineStartedPayload, type GameEventActor, type GameEventActorKind, type GameEventCausation, type GameEventCommitReceipt, type GameEventLocation, type GameEventParticipant, type GameEventParticipantRole, type GameEventRecordType, type GameEventSeverity, type GameEventSubmissionChannel, type GameEventSubmissionReceipt, type GameEventValidationIssue, type GameEventValidationResult, type GameEventVisibilityClass, type GameWorldEvent, type GameWorldEventCandidate, type GameWorldEventCanonical, type GameWorldEventEnvelope, type GameWorldEventPayload, type GameWorldEventPayloadBase, type GameWorldEventType, type GossipAudienceSegment, type GossipConfidence, type GossipLifecyclePort, type GossipPerspectiveProjection, type GossipProjectionMode, type GossipSalience, type GossipSpeechHint, type GossipTopic, type GossipTopicEnvelope, type GossipTopicPayload, type GossipTopicStatus, type JsonValue, type KnowledgeSource, type MonsterKilledPayload, type MonsterSpawnedPayload, type PerspectiveRule, type ProjectedGossipEnvelope, type ProjectionCheckpointStore, type ProjectionProjectorCheckpoint, type ResolveAiGamePlayerAddressInput, type ResolveAiGamePlayerAddressResult, type ResolveAiGameProtoSocialDevolutionEligibilityInput, type ResolveAiGameTaskInput, type SurplusUpdatedPayload, type SystemCheckpointPayload, type Version, type WarDeclaredPayload, type WarResolvedPayload, type WitnessChannel, type WorldEventIngestionPort, type WorldEventProjectorPort, type WorldIncidentImpactKey, type WorldIncidentImpactVector, type WorldIncidentLifecycle, type WorldIncidentRegistry, type WorldIncidentResolution, type WorldIncidentScope, type WorldIncidentThread, aiGameFeatureFlags, classifyAiGameTask, createAiGamePointsLedgerSnapshot, evaluateAiGameProtoSocialDevolutionEligibility, gameEventFeatureFlags, getAiGameProtoSocialDevolutionPolicy, getDefaultAiGamePointsSpendPolicies, isAiGamePlayerEvolutionStage, isAiGamePointsLedgerId, isCandidateWorldEvent, isCanonicalWorldEvent, isGossipTopicActive, isGossipTopicCorrected, isIncidentResolved, normalizeIncidentImpactVector, packageDescriptor, projectTopicForAudience, resolveAiGamePlayerAddressText, resolveAiGamePointsAuthorityBoundary, resolveAiGameTaskBatch };
package/dist/index.js CHANGED
@@ -1,3 +1,172 @@
1
+ // src/points-store.ts
2
+ var AI_GAME_POINTS_STORE_FEATURE_FLAG_ID = "isekai.player-system.points-store.enabled";
3
+ var AI_GAME_POINTS_LEDGER_IDS = ["pp", "esp", "tis", "dis"];
4
+ var AI_GAME_PLAYER_EVOLUTION_STAGES = ["proto-social", "social-lock"];
5
+ var AI_GAME_POINTS_AUTHORITY_BANDS = [
6
+ "self",
7
+ "frontier",
8
+ "civic",
9
+ "divine"
10
+ ];
11
+ var AI_GAME_POINTS_AUTHORITY_SYSTEMS = [
12
+ "player-system",
13
+ "exploration-system",
14
+ "territorial-influence-system",
15
+ "divine-influence-system"
16
+ ];
17
+ var AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER = Object.freeze({
18
+ pp: Object.freeze({
19
+ ledgerId: "pp",
20
+ authorityBand: "self",
21
+ authoritySystem: "player-system",
22
+ requiresWorldAuthority: false,
23
+ combatSafeOnly: false
24
+ }),
25
+ esp: Object.freeze({
26
+ ledgerId: "esp",
27
+ authorityBand: "frontier",
28
+ authoritySystem: "exploration-system",
29
+ requiresWorldAuthority: false,
30
+ combatSafeOnly: true
31
+ }),
32
+ tis: Object.freeze({
33
+ ledgerId: "tis",
34
+ authorityBand: "civic",
35
+ authoritySystem: "territorial-influence-system",
36
+ requiresWorldAuthority: true,
37
+ combatSafeOnly: false
38
+ }),
39
+ dis: Object.freeze({
40
+ ledgerId: "dis",
41
+ authorityBand: "divine",
42
+ authoritySystem: "divine-influence-system",
43
+ requiresWorldAuthority: true,
44
+ combatSafeOnly: false
45
+ })
46
+ });
47
+ var AI_GAME_DEFAULT_POINTS_SPEND_POLICIES = Object.freeze([
48
+ Object.freeze({
49
+ policyId: "pp-personal-respec",
50
+ ledgerId: "pp",
51
+ authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.pp,
52
+ actions: Object.freeze([
53
+ Object.freeze({
54
+ actionId: "return-to-slime",
55
+ title: "Return to slime",
56
+ cost: 12,
57
+ prerequisiteCodes: Object.freeze(["proto-social-window-open", "single-use-remaining"]),
58
+ consequenceCodes: Object.freeze(["reset-social-form", "consume-pp-balance"])
59
+ })
60
+ ])
61
+ }),
62
+ Object.freeze({
63
+ policyId: "esp-exploration-routing",
64
+ ledgerId: "esp",
65
+ authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.esp,
66
+ actions: Object.freeze([
67
+ Object.freeze({
68
+ actionId: "fast-travel-upgrade",
69
+ title: "Unlock frontier fast travel",
70
+ cost: 8,
71
+ prerequisiteCodes: Object.freeze(["frontier-route-discovered", "out-of-combat-only"]),
72
+ consequenceCodes: Object.freeze(["reduce-route-friction"])
73
+ })
74
+ ])
75
+ }),
76
+ Object.freeze({
77
+ policyId: "tis-civic-investment",
78
+ ledgerId: "tis",
79
+ authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.tis,
80
+ actions: Object.freeze([
81
+ Object.freeze({
82
+ actionId: "district-favor",
83
+ title: "Commit district influence favor",
84
+ cost: 5,
85
+ prerequisiteCodes: Object.freeze(["civic-authority-approval"]),
86
+ consequenceCodes: Object.freeze(["alter-territorial-standing"])
87
+ })
88
+ ])
89
+ }),
90
+ Object.freeze({
91
+ policyId: "dis-divine-covenant",
92
+ ledgerId: "dis",
93
+ authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.dis,
94
+ actions: Object.freeze([
95
+ Object.freeze({
96
+ actionId: "divine-oath",
97
+ title: "Bind a divine covenant",
98
+ cost: 3,
99
+ prerequisiteCodes: Object.freeze(["divine-clearance-granted"]),
100
+ consequenceCodes: Object.freeze(["alter-divine-standing"])
101
+ })
102
+ ])
103
+ })
104
+ ]);
105
+ var AI_GAME_PROTO_SOCIAL_DEVOLUTION_POLICY = Object.freeze({
106
+ actionId: "return-to-slime",
107
+ ledgerId: "pp",
108
+ cost: 12,
109
+ requiredEvolutionStage: "proto-social",
110
+ closesAtEvolutionStage: "social-lock",
111
+ singleUse: true,
112
+ authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.pp,
113
+ prerequisiteCodes: Object.freeze(["proto-social-window-open", "single-use-remaining"]),
114
+ consequenceCodes: Object.freeze(["reset-social-form", "consume-pp-balance"])
115
+ });
116
+ function normalizeNonNegativeInteger(value) {
117
+ if (!Number.isFinite(value)) {
118
+ return 0;
119
+ }
120
+ return Math.max(0, Math.trunc(value));
121
+ }
122
+ function isAiGamePointsLedgerId(value) {
123
+ return AI_GAME_POINTS_LEDGER_IDS.includes(value);
124
+ }
125
+ function isAiGamePlayerEvolutionStage(value) {
126
+ return AI_GAME_PLAYER_EVOLUTION_STAGES.includes(value);
127
+ }
128
+ function resolveAiGamePointsAuthorityBoundary(ledgerId) {
129
+ return AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER[ledgerId];
130
+ }
131
+ function createAiGamePointsLedgerSnapshot(input) {
132
+ return Object.freeze({
133
+ ledgerId: input.ledgerId,
134
+ balance: normalizeNonNegativeInteger(input.balance),
135
+ earnedTotal: normalizeNonNegativeInteger(input.earnedTotal),
136
+ spentTotal: normalizeNonNegativeInteger(input.spentTotal),
137
+ committedTotal: normalizeNonNegativeInteger(input.committedTotal),
138
+ asOfEpochMs: input.asOfEpochMs
139
+ });
140
+ }
141
+ function getDefaultAiGamePointsSpendPolicies() {
142
+ return AI_GAME_DEFAULT_POINTS_SPEND_POLICIES;
143
+ }
144
+ function getAiGameProtoSocialDevolutionPolicy() {
145
+ return AI_GAME_PROTO_SOCIAL_DEVOLUTION_POLICY;
146
+ }
147
+ function evaluateAiGameProtoSocialDevolutionEligibility(input) {
148
+ const reasonCodes = [];
149
+ const policy = AI_GAME_PROTO_SOCIAL_DEVOLUTION_POLICY;
150
+ const currentBalance = normalizeNonNegativeInteger(input.currentBalance);
151
+ if (input.evolutionStage !== policy.requiredEvolutionStage) {
152
+ reasonCodes.push("devolution-window-closed");
153
+ }
154
+ if (input.alreadyUsed) {
155
+ reasonCodes.push("devolution-already-used");
156
+ }
157
+ if (currentBalance < policy.cost) {
158
+ reasonCodes.push("insufficient-pp-balance");
159
+ }
160
+ if (reasonCodes.length === 0) {
161
+ reasonCodes.push("devolution-allowed");
162
+ }
163
+ return Object.freeze({
164
+ available: reasonCodes.length === 1 && reasonCodes[0] === "devolution-allowed",
165
+ reasonCodes: Object.freeze(reasonCodes),
166
+ policy
167
+ });
168
+ }
169
+
1
170
  // src/world-events.ts
2
171
  function isCanonicalWorldEvent(event) {
3
172
  return event.recordType === "canonical";
@@ -496,7 +665,8 @@ var aiGameFeatureFlags = Object.freeze({
496
665
  incident: AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
497
666
  gossipTopics: AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID,
498
667
  gossipPerspective: AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
499
- gossipLifecycle: AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID
668
+ gossipLifecycle: AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID,
669
+ pointsStore: AI_GAME_POINTS_STORE_FEATURE_FLAG_ID
500
670
  });
501
671
  var gameEventFeatureFlags = Object.freeze([
502
672
  aiGameFeatureFlags.contract,
@@ -504,7 +674,8 @@ var gameEventFeatureFlags = Object.freeze([
504
674
  aiGameFeatureFlags.incident,
505
675
  aiGameFeatureFlags.gossipTopics,
506
676
  aiGameFeatureFlags.gossipPerspective,
507
- aiGameFeatureFlags.gossipLifecycle
677
+ aiGameFeatureFlags.gossipLifecycle,
678
+ aiGameFeatureFlags.pointsStore
508
679
  ]);
509
680
  export {
510
681
  AI_GAME_ACTOR_ROLES,
@@ -518,6 +689,11 @@ export {
518
689
  AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
519
690
  AI_GAME_PACKAGE,
520
691
  AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
692
+ AI_GAME_PLAYER_EVOLUTION_STAGES,
693
+ AI_GAME_POINTS_AUTHORITY_BANDS,
694
+ AI_GAME_POINTS_AUTHORITY_SYSTEMS,
695
+ AI_GAME_POINTS_LEDGER_IDS,
696
+ AI_GAME_POINTS_STORE_FEATURE_FLAG_ID,
521
697
  AI_GAME_TASK_AUTHORITY_BOUNDARIES,
522
698
  AI_GAME_TASK_DECISIONS,
523
699
  AI_GAME_TASK_KINDS,
@@ -526,7 +702,13 @@ export {
526
702
  AI_GAME_TTS_CACHE_POLICIES,
527
703
  aiGameFeatureFlags,
528
704
  classifyAiGameTask,
705
+ createAiGamePointsLedgerSnapshot,
706
+ evaluateAiGameProtoSocialDevolutionEligibility,
529
707
  gameEventFeatureFlags,
708
+ getAiGameProtoSocialDevolutionPolicy,
709
+ getDefaultAiGamePointsSpendPolicies,
710
+ isAiGamePlayerEvolutionStage,
711
+ isAiGamePointsLedgerId,
530
712
  isCandidateWorldEvent,
531
713
  isCanonicalWorldEvent,
532
714
  isGossipTopicActive,
@@ -536,6 +718,7 @@ export {
536
718
  packageDescriptor,
537
719
  projectTopicForAudience,
538
720
  resolveAiGamePlayerAddressText,
721
+ resolveAiGamePointsAuthorityBoundary,
539
722
  resolveAiGameTaskBatch
540
723
  };
541
724
  //# sourceMappingURL=index.js.map