@plasius/ai-game 0.6.2 → 0.6.4

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.cjs CHANGED
@@ -21,6 +21,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AI_GAME_ACTOR_ROLES: () => AI_GAME_ACTOR_ROLES,
24
+ AI_GAME_APPRENTICESHIP_CONTRACT_VERSION: () => AI_GAME_APPRENTICESHIP_CONTRACT_VERSION,
25
+ AI_GAME_APPRENTICESHIP_FEATURE_FLAG_ID: () => AI_GAME_APPRENTICESHIP_FEATURE_FLAG_ID,
26
+ AI_GAME_APPRENTICESHIP_GUIDANCE_OWNER: () => AI_GAME_APPRENTICESHIP_GUIDANCE_OWNER,
27
+ AI_GAME_APPRENTICESHIP_HANDOFF_COMMITMENT: () => AI_GAME_APPRENTICESHIP_HANDOFF_COMMITMENT,
28
+ AI_GAME_APPRENTICESHIP_HANDOFF_INTENTS: () => AI_GAME_APPRENTICESHIP_HANDOFF_INTENTS,
29
+ AI_GAME_APPRENTICESHIP_HANDOFF_KINDS: () => AI_GAME_APPRENTICESHIP_HANDOFF_KINDS,
30
+ AI_GAME_APPRENTICESHIP_HANDOFF_TARGETS: () => AI_GAME_APPRENTICESHIP_HANDOFF_TARGETS,
31
+ AI_GAME_APPRENTICESHIP_READINESS_STATES: () => AI_GAME_APPRENTICESHIP_READINESS_STATES,
32
+ AI_GAME_APPRENTICESHIP_SPONSORSHIP_STATUSES: () => AI_GAME_APPRENTICESHIP_SPONSORSHIP_STATUSES,
33
+ AI_GAME_APPRENTICESHIP_SUPERVISION_MODES: () => AI_GAME_APPRENTICESHIP_SUPERVISION_MODES,
24
34
  AI_GAME_ENV_PREFIX: () => AI_GAME_ENV_PREFIX,
25
35
  AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID: () => AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID,
26
36
  AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID: () => AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID,
@@ -29,6 +39,12 @@ __export(index_exports, {
29
39
  AI_GAME_GOSSIP_EXPORT_AUDIENCES: () => AI_GAME_GOSSIP_EXPORT_AUDIENCES,
30
40
  AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID: () => AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID,
31
41
  AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID: () => AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID,
42
+ AI_GAME_GUILD_QUESTS_CONTRACT_VERSION: () => AI_GAME_GUILD_QUESTS_CONTRACT_VERSION,
43
+ AI_GAME_GUILD_QUESTS_FEATURE_FLAG_ID: () => AI_GAME_GUILD_QUESTS_FEATURE_FLAG_ID,
44
+ AI_GAME_GUILD_QUEST_OBJECTIVE_STATUSES: () => AI_GAME_GUILD_QUEST_OBJECTIVE_STATUSES,
45
+ AI_GAME_GUILD_QUEST_REWARD_KINDS: () => AI_GAME_GUILD_QUEST_REWARD_KINDS,
46
+ AI_GAME_GUILD_QUEST_STATUSES: () => AI_GAME_GUILD_QUEST_STATUSES,
47
+ AI_GAME_GUILD_QUEST_SYSTEM_RECOMMENDATIONS: () => AI_GAME_GUILD_QUEST_SYSTEM_RECOMMENDATIONS,
32
48
  AI_GAME_IDENTITY_CONTRACT_VERSION: () => AI_GAME_IDENTITY_CONTRACT_VERSION,
33
49
  AI_GAME_IDENTITY_DISCLOSURE_POLICY: () => AI_GAME_IDENTITY_DISCLOSURE_POLICY,
34
50
  AI_GAME_IDENTITY_FEATURE_FLAG_ID: () => AI_GAME_IDENTITY_FEATURE_FLAG_ID,
@@ -141,12 +157,23 @@ __export(index_exports, {
141
157
  QUIET_MEASURE_PERSPECTIVES: () => QUIET_MEASURE_PERSPECTIVES,
142
158
  QUIET_MEASURE_SIGNAL_BANDS: () => QUIET_MEASURE_SIGNAL_BANDS,
143
159
  aiGameFeatureFlags: () => aiGameFeatureFlags,
160
+ assertAiGameGuildQuestsContractVersion: () => assertAiGameGuildQuestsContractVersion,
144
161
  assertAiGameIdentityProjectionContractVersion: () => assertAiGameIdentityProjectionContractVersion,
145
162
  assertAiGameMissionContractVersion: () => assertAiGameMissionContractVersion,
146
163
  assertAiGameObservedEventLogContractVersion: () => assertAiGameObservedEventLogContractVersion,
147
164
  classifyAiGameTask: () => classifyAiGameTask,
148
165
  createAiGameAcademicTrainingSnapshot: () => createAiGameAcademicTrainingSnapshot,
166
+ createAiGameApprenticeshipHandoff: () => createAiGameApprenticeshipHandoff,
167
+ createAiGameApprenticeshipReadiness: () => createAiGameApprenticeshipReadiness,
168
+ createAiGameApprenticeshipSponsorship: () => createAiGameApprenticeshipSponsorship,
169
+ createAiGameApprenticeshipSupervision: () => createAiGameApprenticeshipSupervision,
149
170
  createAiGameGossipExport: () => createAiGameGossipExport,
171
+ createAiGameGuildQuest: () => createAiGameGuildQuest,
172
+ createAiGameGuildQuestFailure: () => createAiGameGuildQuestFailure,
173
+ createAiGameGuildQuestObjectiveProgress: () => createAiGameGuildQuestObjectiveProgress,
174
+ createAiGameGuildQuestProgress: () => createAiGameGuildQuestProgress,
175
+ createAiGameGuildQuestRewardPreview: () => createAiGameGuildQuestRewardPreview,
176
+ createAiGameGuildQuestSyncPayload: () => createAiGameGuildQuestSyncPayload,
150
177
  createAiGameIdentityProjectionContract: () => createAiGameIdentityProjectionContract,
151
178
  createAiGameIdentitySelfProjection: () => createAiGameIdentitySelfProjection,
152
179
  createAiGameIdentityTargetProjection: () => createAiGameIdentityTargetProjection,
@@ -195,7 +222,12 @@ __export(index_exports, {
195
222
  getAiGamePlayerSystemFocusModeContract: () => getAiGamePlayerSystemFocusModeContract,
196
223
  getAiGamePlayerSystemGuidanceFallbackContract: () => getAiGamePlayerSystemGuidanceFallbackContract,
197
224
  getAiGamePlayerSystemModuleContract: () => getAiGamePlayerSystemModuleContract,
225
+ isAiGameApprenticeshipReadinessState: () => isAiGameApprenticeshipReadinessState,
198
226
  isAiGameGossipExportAudience: () => isAiGameGossipExportAudience,
227
+ isAiGameGuildQuestObjectiveStatus: () => isAiGameGuildQuestObjectiveStatus,
228
+ isAiGameGuildQuestRewardKind: () => isAiGameGuildQuestRewardKind,
229
+ isAiGameGuildQuestStatus: () => isAiGameGuildQuestStatus,
230
+ isAiGameGuildQuestSystemRecommendation: () => isAiGameGuildQuestSystemRecommendation,
199
231
  isAiGameIdentityKnowledgeState: () => isAiGameIdentityKnowledgeState,
200
232
  isAiGameIdentityProjectionRead: () => isAiGameIdentityProjectionRead,
201
233
  isAiGameIdentityTargetCategory: () => isAiGameIdentityTargetCategory,
@@ -2313,6 +2345,554 @@ function createAiGameTutorialTrack(input) {
2313
2345
  });
2314
2346
  }
2315
2347
 
2348
+ // src/apprenticeship-handoffs.ts
2349
+ var AI_GAME_APPRENTICESHIP_FEATURE_FLAG_ID = "isekai.training.apprenticeship.enabled";
2350
+ var AI_GAME_APPRENTICESHIP_CONTRACT_VERSION = "1.0";
2351
+ var AI_GAME_APPRENTICESHIP_SPONSORSHIP_STATUSES = [
2352
+ "proposed",
2353
+ "active",
2354
+ "suspended",
2355
+ "completed",
2356
+ "revoked"
2357
+ ];
2358
+ var AI_GAME_APPRENTICESHIP_SUPERVISION_MODES = [
2359
+ "direct",
2360
+ "delegated",
2361
+ "milestone"
2362
+ ];
2363
+ var AI_GAME_APPRENTICESHIP_READINESS_STATES = [
2364
+ "ready",
2365
+ "needs-prerequisites",
2366
+ "institution-gated",
2367
+ "supervision-required",
2368
+ "blocked"
2369
+ ];
2370
+ var AI_GAME_APPRENTICESHIP_HANDOFF_TARGETS = [
2371
+ "spellcraft-system",
2372
+ "item-crafting-system",
2373
+ "dungeon-crafting-system"
2374
+ ];
2375
+ var AI_GAME_APPRENTICESHIP_HANDOFF_KINDS = [
2376
+ "spellcraft",
2377
+ "item-crafting",
2378
+ "dungeon-crafting"
2379
+ ];
2380
+ var AI_GAME_APPRENTICESHIP_HANDOFF_INTENTS = [
2381
+ "learn",
2382
+ "practice",
2383
+ "refine",
2384
+ "commission"
2385
+ ];
2386
+ var AI_GAME_APPRENTICESHIP_HANDOFF_COMMITMENT = "request-only";
2387
+ var AI_GAME_APPRENTICESHIP_GUIDANCE_OWNER = "player-system";
2388
+ function freezeReadonlyArray8(items) {
2389
+ return Object.freeze([...items]);
2390
+ }
2391
+ function assertNonEmptyString8(value, label) {
2392
+ if (value.trim().length === 0) {
2393
+ throw new Error(`${label} must be a non-empty string`);
2394
+ }
2395
+ }
2396
+ function assertIsoTimestamp4(value, label) {
2397
+ assertNonEmptyString8(value, label);
2398
+ if (Number.isNaN(Date.parse(value))) {
2399
+ throw new Error(`${label} must be an ISO-8601 timestamp`);
2400
+ }
2401
+ }
2402
+ function assertIsoTimestampOrNull2(value, label) {
2403
+ if (value !== null) {
2404
+ assertIsoTimestamp4(value, label);
2405
+ }
2406
+ }
2407
+ function assertContractVersion7(value) {
2408
+ if (value !== AI_GAME_APPRENTICESHIP_CONTRACT_VERSION) {
2409
+ throw new Error(
2410
+ `contractVersion must be ${AI_GAME_APPRENTICESHIP_CONTRACT_VERSION}`
2411
+ );
2412
+ }
2413
+ }
2414
+ function assertMember(value, values, label) {
2415
+ if (!values.includes(value)) {
2416
+ throw new Error(`${label} must be a supported apprenticeship value`);
2417
+ }
2418
+ }
2419
+ function createStringArray5(values, label) {
2420
+ values.forEach((value) => assertNonEmptyString8(value, `${label} entry`));
2421
+ return freezeReadonlyArray8(values);
2422
+ }
2423
+ function assertHandoffBase(input) {
2424
+ assertNonEmptyString8(input.handoffId, "handoffId");
2425
+ assertNonEmptyString8(input.requestId, "requestId");
2426
+ assertNonEmptyString8(input.apprenticeshipId, "apprenticeshipId");
2427
+ assertNonEmptyString8(input.sponsorshipId, "sponsorshipId");
2428
+ assertNonEmptyString8(input.supervisionId, "supervisionId");
2429
+ assertNonEmptyString8(input.readinessId, "readinessId");
2430
+ if (input.readinessState !== "ready") {
2431
+ throw new Error("readinessState must be ready for an apprenticeship handoff");
2432
+ }
2433
+ assertNonEmptyString8(input.apprenticeSubjectId, "apprenticeSubjectId");
2434
+ assertNonEmptyString8(input.disciplineCode, "disciplineCode");
2435
+ assertMember(
2436
+ input.intent,
2437
+ AI_GAME_APPRENTICESHIP_HANDOFF_INTENTS,
2438
+ "intent"
2439
+ );
2440
+ assertIsoTimestamp4(input.requestedAtIso, "requestedAtIso");
2441
+ }
2442
+ function isAiGameApprenticeshipReadinessState(value) {
2443
+ return AI_GAME_APPRENTICESHIP_READINESS_STATES.includes(value);
2444
+ }
2445
+ function createAiGameApprenticeshipSponsorship(input) {
2446
+ assertContractVersion7(input.contractVersion ?? AI_GAME_APPRENTICESHIP_CONTRACT_VERSION);
2447
+ assertNonEmptyString8(input.sponsorshipId, "sponsorshipId");
2448
+ assertNonEmptyString8(input.apprenticeSubjectId, "apprenticeSubjectId");
2449
+ assertNonEmptyString8(input.sponsorSubjectId, "sponsorSubjectId");
2450
+ assertNonEmptyString8(input.institutionId, "institutionId");
2451
+ assertNonEmptyString8(input.disciplineCode, "disciplineCode");
2452
+ assertMember(
2453
+ input.status,
2454
+ AI_GAME_APPRENTICESHIP_SPONSORSHIP_STATUSES,
2455
+ "status"
2456
+ );
2457
+ assertIsoTimestamp4(input.issuedAtIso, "issuedAtIso");
2458
+ assertIsoTimestampOrNull2(input.expiresAtIso, "expiresAtIso");
2459
+ return Object.freeze({
2460
+ contractVersion: input.contractVersion ?? AI_GAME_APPRENTICESHIP_CONTRACT_VERSION,
2461
+ featureFlagId: AI_GAME_APPRENTICESHIP_FEATURE_FLAG_ID,
2462
+ sponsorshipId: input.sponsorshipId,
2463
+ apprenticeSubjectId: input.apprenticeSubjectId,
2464
+ sponsorSubjectId: input.sponsorSubjectId,
2465
+ institutionId: input.institutionId,
2466
+ disciplineCode: input.disciplineCode,
2467
+ status: input.status,
2468
+ issuedAtIso: input.issuedAtIso,
2469
+ expiresAtIso: input.expiresAtIso,
2470
+ scopeCodes: createStringArray5(input.scopeCodes, "scopeCodes"),
2471
+ reasonCodes: createStringArray5(input.reasonCodes, "reasonCodes")
2472
+ });
2473
+ }
2474
+ function createAiGameApprenticeshipSupervision(input) {
2475
+ assertContractVersion7(input.contractVersion ?? AI_GAME_APPRENTICESHIP_CONTRACT_VERSION);
2476
+ assertNonEmptyString8(input.supervisionId, "supervisionId");
2477
+ assertNonEmptyString8(input.sponsorshipId, "sponsorshipId");
2478
+ assertNonEmptyString8(input.supervisorSubjectId, "supervisorSubjectId");
2479
+ assertMember(input.mode, AI_GAME_APPRENTICESHIP_SUPERVISION_MODES, "mode");
2480
+ assertIsoTimestamp4(input.startedAtIso, "startedAtIso");
2481
+ assertIsoTimestampOrNull2(input.endsAtIso, "endsAtIso");
2482
+ return Object.freeze({
2483
+ contractVersion: input.contractVersion ?? AI_GAME_APPRENTICESHIP_CONTRACT_VERSION,
2484
+ featureFlagId: AI_GAME_APPRENTICESHIP_FEATURE_FLAG_ID,
2485
+ supervisionId: input.supervisionId,
2486
+ sponsorshipId: input.sponsorshipId,
2487
+ supervisorSubjectId: input.supervisorSubjectId,
2488
+ mode: input.mode,
2489
+ checkpointCodes: createStringArray5(input.checkpointCodes, "checkpointCodes"),
2490
+ startedAtIso: input.startedAtIso,
2491
+ endsAtIso: input.endsAtIso,
2492
+ reasonCodes: createStringArray5(input.reasonCodes, "reasonCodes")
2493
+ });
2494
+ }
2495
+ function createAiGameApprenticeshipReadiness(input) {
2496
+ assertContractVersion7(input.contractVersion ?? AI_GAME_APPRENTICESHIP_CONTRACT_VERSION);
2497
+ assertNonEmptyString8(input.readinessId, "readinessId");
2498
+ assertNonEmptyString8(input.sponsorshipId, "sponsorshipId");
2499
+ assertNonEmptyString8(input.disciplineCode, "disciplineCode");
2500
+ assertMember(input.state, AI_GAME_APPRENTICESHIP_READINESS_STATES, "state");
2501
+ if (!(0, import_training.isTrainingTrustLevel)(input.requiredTrustLevel)) {
2502
+ throw new Error("requiredTrustLevel must be a supported training trust level");
2503
+ }
2504
+ if (!(0, import_training.isMccExpressionTrack)(input.requiredTrack)) {
2505
+ throw new Error("requiredTrack must be a supported MCC expression track");
2506
+ }
2507
+ assertIsoTimestamp4(input.evaluatedAtIso, "evaluatedAtIso");
2508
+ if (input.state === "ready" && input.unmetPrerequisiteCodes.length > 0) {
2509
+ throw new Error("ready apprenticeship state cannot have unmet prerequisites");
2510
+ }
2511
+ return Object.freeze({
2512
+ contractVersion: input.contractVersion ?? AI_GAME_APPRENTICESHIP_CONTRACT_VERSION,
2513
+ featureFlagId: AI_GAME_APPRENTICESHIP_FEATURE_FLAG_ID,
2514
+ readinessId: input.readinessId,
2515
+ sponsorshipId: input.sponsorshipId,
2516
+ disciplineCode: input.disciplineCode,
2517
+ state: input.state,
2518
+ requiredTrustLevel: input.requiredTrustLevel,
2519
+ requiredTrack: input.requiredTrack,
2520
+ supervisionRequired: input.supervisionRequired,
2521
+ unmetPrerequisiteCodes: createStringArray5(
2522
+ input.unmetPrerequisiteCodes,
2523
+ "unmetPrerequisiteCodes"
2524
+ ),
2525
+ evaluatedAtIso: input.evaluatedAtIso,
2526
+ reasonCodes: createStringArray5(input.reasonCodes, "reasonCodes")
2527
+ });
2528
+ }
2529
+ function createAiGameApprenticeshipHandoff(input) {
2530
+ assertContractVersion7(input.contractVersion ?? AI_GAME_APPRENTICESHIP_CONTRACT_VERSION);
2531
+ assertHandoffBase(input);
2532
+ assertMember(input.kind, AI_GAME_APPRENTICESHIP_HANDOFF_KINDS, "kind");
2533
+ if (input.kind === "spellcraft") {
2534
+ if (!(0, import_training.isMccExpressionTrack)(input.requestedTrack)) {
2535
+ throw new Error("requestedTrack must be a supported MCC expression track");
2536
+ }
2537
+ if (input.recommendationId !== null && input.recommendationId !== void 0) {
2538
+ assertNonEmptyString8(input.recommendationId, "recommendationId");
2539
+ }
2540
+ }
2541
+ if (input.kind === "item-crafting" && input.recipeFamilyCode !== null && input.recipeFamilyCode !== void 0) {
2542
+ assertNonEmptyString8(input.recipeFamilyCode, "recipeFamilyCode");
2543
+ }
2544
+ if (input.kind === "dungeon-crafting") {
2545
+ if (input.blueprintFamilyCode !== null && input.blueprintFamilyCode !== void 0) {
2546
+ assertNonEmptyString8(input.blueprintFamilyCode, "blueprintFamilyCode");
2547
+ }
2548
+ if (input.sealingObjectiveCode !== null && input.sealingObjectiveCode !== void 0) {
2549
+ assertNonEmptyString8(input.sealingObjectiveCode, "sealingObjectiveCode");
2550
+ }
2551
+ }
2552
+ const base = {
2553
+ contractVersion: input.contractVersion ?? AI_GAME_APPRENTICESHIP_CONTRACT_VERSION,
2554
+ featureFlagId: AI_GAME_APPRENTICESHIP_FEATURE_FLAG_ID,
2555
+ handoffId: input.handoffId,
2556
+ requestId: input.requestId,
2557
+ apprenticeshipId: input.apprenticeshipId,
2558
+ sponsorshipId: input.sponsorshipId,
2559
+ supervisionId: input.supervisionId,
2560
+ readinessId: input.readinessId,
2561
+ readinessState: input.readinessState,
2562
+ apprenticeSubjectId: input.apprenticeSubjectId,
2563
+ disciplineCode: input.disciplineCode,
2564
+ intent: input.intent,
2565
+ requestedAtIso: input.requestedAtIso,
2566
+ commitment: AI_GAME_APPRENTICESHIP_HANDOFF_COMMITMENT,
2567
+ guidanceOwner: AI_GAME_APPRENTICESHIP_GUIDANCE_OWNER,
2568
+ reasonCodes: createStringArray5(input.reasonCodes, "reasonCodes")
2569
+ };
2570
+ if (input.kind === "spellcraft") {
2571
+ return Object.freeze({
2572
+ ...base,
2573
+ kind: input.kind,
2574
+ targetSystem: "spellcraft-system",
2575
+ recommendationId: input.recommendationId ?? null,
2576
+ requestedTrack: input.requestedTrack
2577
+ });
2578
+ }
2579
+ if (input.kind === "item-crafting") {
2580
+ return Object.freeze({
2581
+ ...base,
2582
+ kind: input.kind,
2583
+ targetSystem: "item-crafting-system",
2584
+ recipeFamilyCode: input.recipeFamilyCode ?? null
2585
+ });
2586
+ }
2587
+ return Object.freeze({
2588
+ ...base,
2589
+ kind: input.kind,
2590
+ targetSystem: "dungeon-crafting-system",
2591
+ blueprintFamilyCode: input.blueprintFamilyCode ?? null,
2592
+ sealingObjectiveCode: input.sealingObjectiveCode ?? null
2593
+ });
2594
+ }
2595
+
2596
+ // src/guild-quests.ts
2597
+ var AI_GAME_GUILD_QUESTS_FEATURE_FLAG_ID = "isekai.player-system.guild-quests.enabled";
2598
+ var AI_GAME_GUILD_QUESTS_CONTRACT_VERSION = "1.0";
2599
+ var AI_GAME_GUILD_QUEST_STATUSES = [
2600
+ "offered",
2601
+ "accepted",
2602
+ "active",
2603
+ "completed",
2604
+ "failed",
2605
+ "abandoned",
2606
+ "expired"
2607
+ ];
2608
+ var AI_GAME_GUILD_QUEST_OBJECTIVE_STATUSES = [
2609
+ "pending",
2610
+ "active",
2611
+ "completed",
2612
+ "failed"
2613
+ ];
2614
+ var AI_GAME_GUILD_QUEST_REWARD_KINDS = [
2615
+ "currency",
2616
+ "item",
2617
+ "recipe",
2618
+ "reputation",
2619
+ "access"
2620
+ ];
2621
+ var AI_GAME_GUILD_QUEST_SYSTEM_RECOMMENDATIONS = [
2622
+ "recommended",
2623
+ "optional",
2624
+ "not-recommended",
2625
+ "blocked"
2626
+ ];
2627
+ function freezeReadonlyArray9(items) {
2628
+ return Object.freeze([...items]);
2629
+ }
2630
+ function isMember7(value, members) {
2631
+ return members.includes(value);
2632
+ }
2633
+ function assertNonEmptyString9(value, label) {
2634
+ if (value.trim().length === 0) {
2635
+ throw new Error(`${label} must be a non-empty string`);
2636
+ }
2637
+ }
2638
+ function assertIsoTimestamp5(value, label) {
2639
+ assertNonEmptyString9(value, label);
2640
+ if (Number.isNaN(Date.parse(value))) {
2641
+ throw new Error(`${label} must be an ISO-8601 timestamp`);
2642
+ }
2643
+ }
2644
+ function assertPositiveInteger3(value, label) {
2645
+ if (!Number.isInteger(value) || value <= 0) {
2646
+ throw new Error(`${label} must be a positive integer`);
2647
+ }
2648
+ }
2649
+ function assertNonNegativeInteger4(value, label) {
2650
+ if (!Number.isInteger(value) || value < 0) {
2651
+ throw new Error(`${label} must be a non-negative integer`);
2652
+ }
2653
+ }
2654
+ function assertContractVersion8(value) {
2655
+ if (value !== AI_GAME_GUILD_QUESTS_CONTRACT_VERSION) {
2656
+ throw new Error(
2657
+ `contractVersion must be ${AI_GAME_GUILD_QUESTS_CONTRACT_VERSION}`
2658
+ );
2659
+ }
2660
+ }
2661
+ function createStringArray6(values, label, requireAtLeastOne = false) {
2662
+ const result = freezeReadonlyArray9(values ?? []);
2663
+ result.forEach((value) => assertNonEmptyString9(value, `${label} entry`));
2664
+ if (requireAtLeastOne && result.length === 0) {
2665
+ throw new Error(`${label} must contain at least one value`);
2666
+ }
2667
+ return result;
2668
+ }
2669
+ function isAiGameGuildQuestStatus(value) {
2670
+ return isMember7(value, AI_GAME_GUILD_QUEST_STATUSES);
2671
+ }
2672
+ function isAiGameGuildQuestObjectiveStatus(value) {
2673
+ return isMember7(value, AI_GAME_GUILD_QUEST_OBJECTIVE_STATUSES);
2674
+ }
2675
+ function isAiGameGuildQuestRewardKind(value) {
2676
+ return isMember7(value, AI_GAME_GUILD_QUEST_REWARD_KINDS);
2677
+ }
2678
+ function isAiGameGuildQuestSystemRecommendation(value) {
2679
+ return isMember7(value, AI_GAME_GUILD_QUEST_SYSTEM_RECOMMENDATIONS);
2680
+ }
2681
+ function createAiGameGuildQuestObjectiveProgress(input) {
2682
+ assertNonEmptyString9(input.objectiveId, "objectiveId");
2683
+ assertNonEmptyString9(input.objectiveCode, "objectiveCode");
2684
+ assertNonEmptyString9(input.label, "label");
2685
+ assertIsoTimestamp5(input.updatedAtIso, "updatedAtIso");
2686
+ assertPositiveInteger3(input.targetCount, "targetCount");
2687
+ const currentCount = input.currentCount ?? 0;
2688
+ assertNonNegativeInteger4(currentCount, "currentCount");
2689
+ if (currentCount > input.targetCount) {
2690
+ throw new Error("currentCount must be less than or equal to targetCount");
2691
+ }
2692
+ if (!isAiGameGuildQuestObjectiveStatus(input.status)) {
2693
+ throw new Error("status must be a supported guild-quest objective status");
2694
+ }
2695
+ return Object.freeze({
2696
+ objectiveId: input.objectiveId,
2697
+ objectiveCode: input.objectiveCode,
2698
+ label: input.label,
2699
+ status: input.status,
2700
+ targetCount: input.targetCount,
2701
+ currentCount,
2702
+ updatedAtIso: input.updatedAtIso,
2703
+ reasonCodes: createStringArray6(input.reasonCodes, "reasonCodes")
2704
+ });
2705
+ }
2706
+ function createAiGameGuildQuestProgress(input) {
2707
+ assertIsoTimestamp5(input.updatedAtIso, "updatedAtIso");
2708
+ if (!isAiGameGuildQuestStatus(input.status)) {
2709
+ throw new Error("status must be a supported guild-quest status");
2710
+ }
2711
+ if (input.objectives.length === 0) {
2712
+ throw new Error("objectives must contain at least one objective");
2713
+ }
2714
+ const objectives = input.objectives.map(
2715
+ (objective) => createAiGameGuildQuestObjectiveProgress(objective)
2716
+ );
2717
+ const objectiveIds = /* @__PURE__ */ new Set();
2718
+ for (const objective of objectives) {
2719
+ if (objectiveIds.has(objective.objectiveId)) {
2720
+ throw new Error("objectiveIds must be unique within a quest");
2721
+ }
2722
+ objectiveIds.add(objective.objectiveId);
2723
+ }
2724
+ return Object.freeze({
2725
+ status: input.status,
2726
+ objectives: freezeReadonlyArray9(objectives),
2727
+ updatedAtIso: input.updatedAtIso
2728
+ });
2729
+ }
2730
+ function createAiGameGuildQuestFailure(input) {
2731
+ assertNonEmptyString9(input.failureId, "failureId");
2732
+ assertNonEmptyString9(input.code, "code");
2733
+ assertNonEmptyString9(input.summary, "summary");
2734
+ assertIsoTimestamp5(input.failedAtIso, "failedAtIso");
2735
+ return Object.freeze({
2736
+ failureId: input.failureId,
2737
+ code: input.code,
2738
+ summary: input.summary,
2739
+ failedAtIso: input.failedAtIso,
2740
+ retryable: input.retryable,
2741
+ consequenceReasonCodes: createStringArray6(
2742
+ input.consequenceReasonCodes,
2743
+ "consequenceReasonCodes"
2744
+ )
2745
+ });
2746
+ }
2747
+ function createAiGameGuildQuestRewardPreview(input) {
2748
+ assertNonEmptyString9(input.previewId, "previewId");
2749
+ const entries = input.entries.map((entry) => {
2750
+ assertNonEmptyString9(entry.rewardId, "rewardId");
2751
+ assertNonEmptyString9(entry.label, "label");
2752
+ assertPositiveInteger3(entry.quantity, "quantity");
2753
+ if (!isAiGameGuildQuestRewardKind(entry.kind)) {
2754
+ throw new Error("kind must be a supported guild-quest reward kind");
2755
+ }
2756
+ return Object.freeze({
2757
+ rewardId: entry.rewardId,
2758
+ kind: entry.kind,
2759
+ label: entry.label,
2760
+ quantity: entry.quantity
2761
+ });
2762
+ });
2763
+ const rewardIds = /* @__PURE__ */ new Set();
2764
+ for (const entry of entries) {
2765
+ if (rewardIds.has(entry.rewardId)) {
2766
+ throw new Error("rewardIds must be unique within a reward preview");
2767
+ }
2768
+ rewardIds.add(entry.rewardId);
2769
+ }
2770
+ const expiresAtIso = input.expiresAtIso ?? null;
2771
+ if (expiresAtIso !== null) {
2772
+ assertIsoTimestamp5(expiresAtIso, "expiresAtIso");
2773
+ }
2774
+ return Object.freeze({
2775
+ previewId: input.previewId,
2776
+ authority: "guild",
2777
+ previewOnly: true,
2778
+ entries: freezeReadonlyArray9(entries),
2779
+ claimRequirementCodes: createStringArray6(
2780
+ input.claimRequirementCodes,
2781
+ "claimRequirementCodes",
2782
+ true
2783
+ ),
2784
+ expiresAtIso
2785
+ });
2786
+ }
2787
+ function createAiGameGuildQuest(input) {
2788
+ assertNonEmptyString9(input.questId, "questId");
2789
+ assertContractVersion8(
2790
+ input.contractVersion ?? AI_GAME_GUILD_QUESTS_CONTRACT_VERSION
2791
+ );
2792
+ assertNonEmptyString9(input.guildTruth.guildId, "guildId");
2793
+ assertNonEmptyString9(input.guildTruth.guildContractId, "guildContractId");
2794
+ assertNonEmptyString9(input.guildTruth.title, "title");
2795
+ assertNonEmptyString9(input.guildTruth.summary, "summary");
2796
+ assertPositiveInteger3(input.guildTruth.authorityRevision, "authorityRevision");
2797
+ if (!isAiGameGuildQuestStatus(input.guildTruth.status)) {
2798
+ throw new Error("status must be a supported guild-quest status");
2799
+ }
2800
+ const progress = createAiGameGuildQuestProgress(input.guildTruth.progress);
2801
+ if (progress.status !== input.guildTruth.status) {
2802
+ throw new Error("progress.status must match guildTruth.status");
2803
+ }
2804
+ const failure = input.guildTruth.failure ? createAiGameGuildQuestFailure(input.guildTruth.failure) : null;
2805
+ if (input.guildTruth.status === "failed" && failure === null) {
2806
+ throw new Error("failed guild quests must include failure details");
2807
+ }
2808
+ if (input.guildTruth.status !== "failed" && failure !== null) {
2809
+ throw new Error("failure details are only valid for failed guild quests");
2810
+ }
2811
+ const annotations = input.systemAnnotations ?? {};
2812
+ const recommendation = annotations.recommendation ?? "optional";
2813
+ if (!isAiGameGuildQuestSystemRecommendation(recommendation)) {
2814
+ throw new Error("recommendation must be a supported System annotation");
2815
+ }
2816
+ return Object.freeze({
2817
+ contractVersion: input.contractVersion ?? AI_GAME_GUILD_QUESTS_CONTRACT_VERSION,
2818
+ featureFlagId: AI_GAME_GUILD_QUESTS_FEATURE_FLAG_ID,
2819
+ questId: input.questId,
2820
+ guildTruth: Object.freeze({
2821
+ guildId: input.guildTruth.guildId,
2822
+ guildContractId: input.guildTruth.guildContractId,
2823
+ title: input.guildTruth.title,
2824
+ summary: input.guildTruth.summary,
2825
+ status: input.guildTruth.status,
2826
+ authorityRevision: input.guildTruth.authorityRevision,
2827
+ progress,
2828
+ failure,
2829
+ rewardPreview: createAiGameGuildQuestRewardPreview(
2830
+ input.guildTruth.rewardPreview
2831
+ )
2832
+ }),
2833
+ systemAnnotations: Object.freeze({
2834
+ recommendation,
2835
+ synergyCodes: createStringArray6(
2836
+ annotations.synergyCodes,
2837
+ "synergyCodes"
2838
+ ),
2839
+ linkedMissionIds: createStringArray6(
2840
+ annotations.linkedMissionIds,
2841
+ "linkedMissionIds"
2842
+ ),
2843
+ reasonCodes: createStringArray6(annotations.reasonCodes, "reasonCodes")
2844
+ })
2845
+ });
2846
+ }
2847
+ function createAiGameGuildQuestSyncPayload(input) {
2848
+ assertNonEmptyString9(input.guildId, "guildId");
2849
+ assertPositiveInteger3(input.authorityRevision, "authorityRevision");
2850
+ assertIsoTimestamp5(input.syncedAtIso, "syncedAtIso");
2851
+ assertContractVersion8(
2852
+ input.contractVersion ?? AI_GAME_GUILD_QUESTS_CONTRACT_VERSION
2853
+ );
2854
+ const quests = (input.quests ?? []).map(
2855
+ (quest) => createAiGameGuildQuest(quest)
2856
+ );
2857
+ const questIds = /* @__PURE__ */ new Set();
2858
+ for (const quest of quests) {
2859
+ if (questIds.has(quest.questId)) {
2860
+ throw new Error("questIds must be unique within a sync payload");
2861
+ }
2862
+ if (quest.guildTruth.guildId !== input.guildId) {
2863
+ throw new Error("all quests in a sync payload must belong to guildId");
2864
+ }
2865
+ questIds.add(quest.questId);
2866
+ }
2867
+ const removedQuestIds = createStringArray6(
2868
+ input.removedQuestIds,
2869
+ "removedQuestIds"
2870
+ );
2871
+ if (new Set(removedQuestIds).size !== removedQuestIds.length) {
2872
+ throw new Error("removedQuestIds must be unique within a sync payload");
2873
+ }
2874
+ if (quests.length === 0 && removedQuestIds.length === 0) {
2875
+ throw new Error("sync payload must contain quests or removedQuestIds");
2876
+ }
2877
+ for (const removedQuestId of removedQuestIds) {
2878
+ if (questIds.has(removedQuestId)) {
2879
+ throw new Error("removedQuestIds cannot overlap quests");
2880
+ }
2881
+ }
2882
+ return Object.freeze({
2883
+ contractVersion: input.contractVersion ?? AI_GAME_GUILD_QUESTS_CONTRACT_VERSION,
2884
+ featureFlagId: AI_GAME_GUILD_QUESTS_FEATURE_FLAG_ID,
2885
+ guildId: input.guildId,
2886
+ authorityRevision: input.authorityRevision,
2887
+ syncedAtIso: input.syncedAtIso,
2888
+ quests: freezeReadonlyArray9(quests),
2889
+ removedQuestIds
2890
+ });
2891
+ }
2892
+ function assertAiGameGuildQuestsContractVersion(value) {
2893
+ assertContractVersion8(value);
2894
+ }
2895
+
2316
2896
  // src/world-events.ts
2317
2897
  function isCanonicalWorldEvent(event) {
2318
2898
  return event.recordType === "canonical";
@@ -2464,7 +3044,7 @@ var QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [
2464
3044
  "private-or-low-witness-evidence",
2465
3045
  "costly-pressure-event"
2466
3046
  ];
2467
- function isMember7(value, members) {
3047
+ function isMember8(value, members) {
2468
3048
  return members.includes(value);
2469
3049
  }
2470
3050
  function assertRecord(value, label) {
@@ -2505,7 +3085,7 @@ function normalizeTimestamp(value, label) {
2505
3085
  }
2506
3086
  function normalizeMember(value, members, label) {
2507
3087
  const normalized = normalizeNonEmptyString(value, label);
2508
- if (!isMember7(normalized, members)) {
3088
+ if (!isMember8(normalized, members)) {
2509
3089
  throw new TypeError(`${label} must be one of: ${members.join(", ")}.`);
2510
3090
  }
2511
3091
  return normalized;
@@ -2638,13 +3218,13 @@ function normalizeDominantReads(value) {
2638
3218
  return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));
2639
3219
  }
2640
3220
  function isQuietMeasureAxis(value) {
2641
- return isMember7(value, QUIET_MEASURE_AXES);
3221
+ return isMember8(value, QUIET_MEASURE_AXES);
2642
3222
  }
2643
3223
  function isQuietMeasureMissionProbeMode(value) {
2644
- return isMember7(value, QUIET_MEASURE_MISSION_PROBE_MODES);
3224
+ return isMember8(value, QUIET_MEASURE_MISSION_PROBE_MODES);
2645
3225
  }
2646
3226
  function isQuietMeasureMissionResolutionShape(value) {
2647
- return isMember7(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
3227
+ return isMember8(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
2648
3228
  }
2649
3229
  function createQuietMeasureJudgmentEligibility(input = {}) {
2650
3230
  const repeatedMeaningfulEvidence = normalizeOptionalBoolean(
@@ -3143,6 +3723,16 @@ var gameEventFeatureFlags = Object.freeze([
3143
3723
  // Annotate the CommonJS export names for ESM import in node:
3144
3724
  0 && (module.exports = {
3145
3725
  AI_GAME_ACTOR_ROLES,
3726
+ AI_GAME_APPRENTICESHIP_CONTRACT_VERSION,
3727
+ AI_GAME_APPRENTICESHIP_FEATURE_FLAG_ID,
3728
+ AI_GAME_APPRENTICESHIP_GUIDANCE_OWNER,
3729
+ AI_GAME_APPRENTICESHIP_HANDOFF_COMMITMENT,
3730
+ AI_GAME_APPRENTICESHIP_HANDOFF_INTENTS,
3731
+ AI_GAME_APPRENTICESHIP_HANDOFF_KINDS,
3732
+ AI_GAME_APPRENTICESHIP_HANDOFF_TARGETS,
3733
+ AI_GAME_APPRENTICESHIP_READINESS_STATES,
3734
+ AI_GAME_APPRENTICESHIP_SPONSORSHIP_STATUSES,
3735
+ AI_GAME_APPRENTICESHIP_SUPERVISION_MODES,
3146
3736
  AI_GAME_ENV_PREFIX,
3147
3737
  AI_GAME_EVENT_CONTRACTS_FEATURE_FLAG_ID,
3148
3738
  AI_GAME_EVENT_INGESTION_FEATURE_FLAG_ID,
@@ -3151,6 +3741,12 @@ var gameEventFeatureFlags = Object.freeze([
3151
3741
  AI_GAME_GOSSIP_EXPORT_AUDIENCES,
3152
3742
  AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID,
3153
3743
  AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID,
3744
+ AI_GAME_GUILD_QUESTS_CONTRACT_VERSION,
3745
+ AI_GAME_GUILD_QUESTS_FEATURE_FLAG_ID,
3746
+ AI_GAME_GUILD_QUEST_OBJECTIVE_STATUSES,
3747
+ AI_GAME_GUILD_QUEST_REWARD_KINDS,
3748
+ AI_GAME_GUILD_QUEST_STATUSES,
3749
+ AI_GAME_GUILD_QUEST_SYSTEM_RECOMMENDATIONS,
3154
3750
  AI_GAME_IDENTITY_CONTRACT_VERSION,
3155
3751
  AI_GAME_IDENTITY_DISCLOSURE_POLICY,
3156
3752
  AI_GAME_IDENTITY_FEATURE_FLAG_ID,
@@ -3263,12 +3859,23 @@ var gameEventFeatureFlags = Object.freeze([
3263
3859
  QUIET_MEASURE_PERSPECTIVES,
3264
3860
  QUIET_MEASURE_SIGNAL_BANDS,
3265
3861
  aiGameFeatureFlags,
3862
+ assertAiGameGuildQuestsContractVersion,
3266
3863
  assertAiGameIdentityProjectionContractVersion,
3267
3864
  assertAiGameMissionContractVersion,
3268
3865
  assertAiGameObservedEventLogContractVersion,
3269
3866
  classifyAiGameTask,
3270
3867
  createAiGameAcademicTrainingSnapshot,
3868
+ createAiGameApprenticeshipHandoff,
3869
+ createAiGameApprenticeshipReadiness,
3870
+ createAiGameApprenticeshipSponsorship,
3871
+ createAiGameApprenticeshipSupervision,
3271
3872
  createAiGameGossipExport,
3873
+ createAiGameGuildQuest,
3874
+ createAiGameGuildQuestFailure,
3875
+ createAiGameGuildQuestObjectiveProgress,
3876
+ createAiGameGuildQuestProgress,
3877
+ createAiGameGuildQuestRewardPreview,
3878
+ createAiGameGuildQuestSyncPayload,
3272
3879
  createAiGameIdentityProjectionContract,
3273
3880
  createAiGameIdentitySelfProjection,
3274
3881
  createAiGameIdentityTargetProjection,
@@ -3317,7 +3924,12 @@ var gameEventFeatureFlags = Object.freeze([
3317
3924
  getAiGamePlayerSystemFocusModeContract,
3318
3925
  getAiGamePlayerSystemGuidanceFallbackContract,
3319
3926
  getAiGamePlayerSystemModuleContract,
3927
+ isAiGameApprenticeshipReadinessState,
3320
3928
  isAiGameGossipExportAudience,
3929
+ isAiGameGuildQuestObjectiveStatus,
3930
+ isAiGameGuildQuestRewardKind,
3931
+ isAiGameGuildQuestStatus,
3932
+ isAiGameGuildQuestSystemRecommendation,
3321
3933
  isAiGameIdentityKnowledgeState,
3322
3934
  isAiGameIdentityProjectionRead,
3323
3935
  isAiGameIdentityTargetCategory,