@plasius/ai-game 0.6.3 → 0.6.5
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 +33 -0
- package/README.md +22 -0
- package/dist/index.cjs +339 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +160 -1
- package/dist/index.d.ts +160 -1
- package/dist/index.js +322 -5
- package/dist/index.js.map +1 -1
- package/docs/adrs/adr-0019-guild-quest-synchronization-and-authority-boundary.md +49 -0
- package/docs/adrs/index.md +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,37 @@ 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.6.5] - 2026-07-12
|
|
21
|
+
|
|
22
|
+
- **Added**
|
|
23
|
+
- (placeholder)
|
|
24
|
+
|
|
25
|
+
- **Changed**
|
|
26
|
+
- (placeholder)
|
|
27
|
+
|
|
28
|
+
- **Fixed**
|
|
29
|
+
- (placeholder)
|
|
30
|
+
|
|
31
|
+
- **Security**
|
|
32
|
+
- (placeholder)
|
|
33
|
+
|
|
34
|
+
## [0.6.4] - 2026-07-12
|
|
35
|
+
|
|
36
|
+
- **Added**
|
|
37
|
+
- Added versioned guild-quest contract and synchronization payloads under
|
|
38
|
+
`isekai.player-system.guild-quests.enabled`, including guild-owned
|
|
39
|
+
progress, failure, preview-only reward, and advisory System annotation
|
|
40
|
+
boundaries.
|
|
41
|
+
|
|
42
|
+
- **Changed**
|
|
43
|
+
- (placeholder)
|
|
44
|
+
|
|
45
|
+
- **Fixed**
|
|
46
|
+
- Reject duplicate removed quest identifiers in guild-quest synchronization tombstones.
|
|
47
|
+
|
|
48
|
+
- **Security**
|
|
49
|
+
- (placeholder)
|
|
50
|
+
|
|
20
51
|
## [0.6.3] - 2026-07-11
|
|
21
52
|
|
|
22
53
|
- **Added**
|
|
@@ -278,3 +309,5 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
|
|
|
278
309
|
[0.6.1]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.6.1
|
|
279
310
|
[0.6.2]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.6.2
|
|
280
311
|
[0.6.3]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.6.3
|
|
312
|
+
[0.6.4]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.6.4
|
|
313
|
+
[0.6.5]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.6.5
|
package/README.md
CHANGED
|
@@ -172,6 +172,27 @@ Tutorial contracts provide dormant, contextual Player System coaching under
|
|
|
172
172
|
Tutorial tracks are foregrounded for first contact, dormant by default after
|
|
173
173
|
onboarding, replayable after unlock, and reduced to safe cues during active
|
|
174
174
|
combat unless the player explicitly enters a safe tutorial scenario.
|
|
175
|
+
## Guild-quest synchronization contracts
|
|
176
|
+
|
|
177
|
+
Guild quests are externally authored by guild authorities and synchronized
|
|
178
|
+
into the Player System under `isekai.player-system.guild-quests.enabled`.
|
|
179
|
+
|
|
180
|
+
- `AiGameGuildQuestContract.guildTruth` owns the guild contract identity,
|
|
181
|
+
status, objective progress, failure details, authority revision, and
|
|
182
|
+
preview-only reward data.
|
|
183
|
+
- `AiGameGuildQuestContract.systemAnnotations` is advisory only. It contains
|
|
184
|
+
recommendation, synergy, linked-mission, and reason-code metadata without
|
|
185
|
+
guild authority fields or reward grants.
|
|
186
|
+
- `AiGameGuildQuestSyncPayload` carries revisioned quest upserts and explicit
|
|
187
|
+
tombstones so consumers can remove quests without treating a partial sync as
|
|
188
|
+
an authoritative empty set.
|
|
189
|
+
- Reward previews are not grants. The guild remains the authority for claim
|
|
190
|
+
eligibility, rewards, rank gates, consequences, and final resolution.
|
|
191
|
+
|
|
192
|
+
Use `createAiGameGuildQuest()` and
|
|
193
|
+
`createAiGameGuildQuestSyncPayload()` at package boundaries. The factories
|
|
194
|
+
validate progress bounds, failure-state requirements, unique identifiers,
|
|
195
|
+
guild ownership, and sync revision metadata, and return frozen payloads.
|
|
175
196
|
|
|
176
197
|
## Quiet Measure contracts
|
|
177
198
|
|
|
@@ -269,6 +290,7 @@ for the boundary and rollback rules.
|
|
|
269
290
|
- `isekai.player-system.tutorial.enabled`
|
|
270
291
|
- `isekai.player-system.identity.enabled`
|
|
271
292
|
- `isekai.player-system.logs.enabled`
|
|
293
|
+
- `isekai.player-system.guild-quests.enabled`
|
|
272
294
|
- `isekai.training.institutions.enabled`
|
|
273
295
|
- `isekai.training.academies.enabled`
|
|
274
296
|
- `isekai.training.martial.enabled`
|
package/dist/index.cjs
CHANGED
|
@@ -39,6 +39,12 @@ __export(index_exports, {
|
|
|
39
39
|
AI_GAME_GOSSIP_EXPORT_AUDIENCES: () => AI_GAME_GOSSIP_EXPORT_AUDIENCES,
|
|
40
40
|
AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID: () => AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID,
|
|
41
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,
|
|
42
48
|
AI_GAME_IDENTITY_CONTRACT_VERSION: () => AI_GAME_IDENTITY_CONTRACT_VERSION,
|
|
43
49
|
AI_GAME_IDENTITY_DISCLOSURE_POLICY: () => AI_GAME_IDENTITY_DISCLOSURE_POLICY,
|
|
44
50
|
AI_GAME_IDENTITY_FEATURE_FLAG_ID: () => AI_GAME_IDENTITY_FEATURE_FLAG_ID,
|
|
@@ -151,6 +157,7 @@ __export(index_exports, {
|
|
|
151
157
|
QUIET_MEASURE_PERSPECTIVES: () => QUIET_MEASURE_PERSPECTIVES,
|
|
152
158
|
QUIET_MEASURE_SIGNAL_BANDS: () => QUIET_MEASURE_SIGNAL_BANDS,
|
|
153
159
|
aiGameFeatureFlags: () => aiGameFeatureFlags,
|
|
160
|
+
assertAiGameGuildQuestsContractVersion: () => assertAiGameGuildQuestsContractVersion,
|
|
154
161
|
assertAiGameIdentityProjectionContractVersion: () => assertAiGameIdentityProjectionContractVersion,
|
|
155
162
|
assertAiGameMissionContractVersion: () => assertAiGameMissionContractVersion,
|
|
156
163
|
assertAiGameObservedEventLogContractVersion: () => assertAiGameObservedEventLogContractVersion,
|
|
@@ -161,6 +168,12 @@ __export(index_exports, {
|
|
|
161
168
|
createAiGameApprenticeshipSponsorship: () => createAiGameApprenticeshipSponsorship,
|
|
162
169
|
createAiGameApprenticeshipSupervision: () => createAiGameApprenticeshipSupervision,
|
|
163
170
|
createAiGameGossipExport: () => createAiGameGossipExport,
|
|
171
|
+
createAiGameGuildQuest: () => createAiGameGuildQuest,
|
|
172
|
+
createAiGameGuildQuestFailure: () => createAiGameGuildQuestFailure,
|
|
173
|
+
createAiGameGuildQuestObjectiveProgress: () => createAiGameGuildQuestObjectiveProgress,
|
|
174
|
+
createAiGameGuildQuestProgress: () => createAiGameGuildQuestProgress,
|
|
175
|
+
createAiGameGuildQuestRewardPreview: () => createAiGameGuildQuestRewardPreview,
|
|
176
|
+
createAiGameGuildQuestSyncPayload: () => createAiGameGuildQuestSyncPayload,
|
|
164
177
|
createAiGameIdentityProjectionContract: () => createAiGameIdentityProjectionContract,
|
|
165
178
|
createAiGameIdentitySelfProjection: () => createAiGameIdentitySelfProjection,
|
|
166
179
|
createAiGameIdentityTargetProjection: () => createAiGameIdentityTargetProjection,
|
|
@@ -211,6 +224,10 @@ __export(index_exports, {
|
|
|
211
224
|
getAiGamePlayerSystemModuleContract: () => getAiGamePlayerSystemModuleContract,
|
|
212
225
|
isAiGameApprenticeshipReadinessState: () => isAiGameApprenticeshipReadinessState,
|
|
213
226
|
isAiGameGossipExportAudience: () => isAiGameGossipExportAudience,
|
|
227
|
+
isAiGameGuildQuestObjectiveStatus: () => isAiGameGuildQuestObjectiveStatus,
|
|
228
|
+
isAiGameGuildQuestRewardKind: () => isAiGameGuildQuestRewardKind,
|
|
229
|
+
isAiGameGuildQuestStatus: () => isAiGameGuildQuestStatus,
|
|
230
|
+
isAiGameGuildQuestSystemRecommendation: () => isAiGameGuildQuestSystemRecommendation,
|
|
214
231
|
isAiGameIdentityKnowledgeState: () => isAiGameIdentityKnowledgeState,
|
|
215
232
|
isAiGameIdentityProjectionRead: () => isAiGameIdentityProjectionRead,
|
|
216
233
|
isAiGameIdentityTargetCategory: () => isAiGameIdentityTargetCategory,
|
|
@@ -2576,6 +2593,306 @@ function createAiGameApprenticeshipHandoff(input) {
|
|
|
2576
2593
|
});
|
|
2577
2594
|
}
|
|
2578
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
|
+
|
|
2579
2896
|
// src/world-events.ts
|
|
2580
2897
|
function isCanonicalWorldEvent(event) {
|
|
2581
2898
|
return event.recordType === "canonical";
|
|
@@ -2727,7 +3044,7 @@ var QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [
|
|
|
2727
3044
|
"private-or-low-witness-evidence",
|
|
2728
3045
|
"costly-pressure-event"
|
|
2729
3046
|
];
|
|
2730
|
-
function
|
|
3047
|
+
function isMember8(value, members) {
|
|
2731
3048
|
return members.includes(value);
|
|
2732
3049
|
}
|
|
2733
3050
|
function assertRecord(value, label) {
|
|
@@ -2768,7 +3085,7 @@ function normalizeTimestamp(value, label) {
|
|
|
2768
3085
|
}
|
|
2769
3086
|
function normalizeMember(value, members, label) {
|
|
2770
3087
|
const normalized = normalizeNonEmptyString(value, label);
|
|
2771
|
-
if (!
|
|
3088
|
+
if (!isMember8(normalized, members)) {
|
|
2772
3089
|
throw new TypeError(`${label} must be one of: ${members.join(", ")}.`);
|
|
2773
3090
|
}
|
|
2774
3091
|
return normalized;
|
|
@@ -2901,13 +3218,13 @@ function normalizeDominantReads(value) {
|
|
|
2901
3218
|
return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));
|
|
2902
3219
|
}
|
|
2903
3220
|
function isQuietMeasureAxis(value) {
|
|
2904
|
-
return
|
|
3221
|
+
return isMember8(value, QUIET_MEASURE_AXES);
|
|
2905
3222
|
}
|
|
2906
3223
|
function isQuietMeasureMissionProbeMode(value) {
|
|
2907
|
-
return
|
|
3224
|
+
return isMember8(value, QUIET_MEASURE_MISSION_PROBE_MODES);
|
|
2908
3225
|
}
|
|
2909
3226
|
function isQuietMeasureMissionResolutionShape(value) {
|
|
2910
|
-
return
|
|
3227
|
+
return isMember8(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
|
|
2911
3228
|
}
|
|
2912
3229
|
function createQuietMeasureJudgmentEligibility(input = {}) {
|
|
2913
3230
|
const repeatedMeaningfulEvidence = normalizeOptionalBoolean(
|
|
@@ -3424,6 +3741,12 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
3424
3741
|
AI_GAME_GOSSIP_EXPORT_AUDIENCES,
|
|
3425
3742
|
AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID,
|
|
3426
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,
|
|
3427
3750
|
AI_GAME_IDENTITY_CONTRACT_VERSION,
|
|
3428
3751
|
AI_GAME_IDENTITY_DISCLOSURE_POLICY,
|
|
3429
3752
|
AI_GAME_IDENTITY_FEATURE_FLAG_ID,
|
|
@@ -3536,6 +3859,7 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
3536
3859
|
QUIET_MEASURE_PERSPECTIVES,
|
|
3537
3860
|
QUIET_MEASURE_SIGNAL_BANDS,
|
|
3538
3861
|
aiGameFeatureFlags,
|
|
3862
|
+
assertAiGameGuildQuestsContractVersion,
|
|
3539
3863
|
assertAiGameIdentityProjectionContractVersion,
|
|
3540
3864
|
assertAiGameMissionContractVersion,
|
|
3541
3865
|
assertAiGameObservedEventLogContractVersion,
|
|
@@ -3546,6 +3870,12 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
3546
3870
|
createAiGameApprenticeshipSponsorship,
|
|
3547
3871
|
createAiGameApprenticeshipSupervision,
|
|
3548
3872
|
createAiGameGossipExport,
|
|
3873
|
+
createAiGameGuildQuest,
|
|
3874
|
+
createAiGameGuildQuestFailure,
|
|
3875
|
+
createAiGameGuildQuestObjectiveProgress,
|
|
3876
|
+
createAiGameGuildQuestProgress,
|
|
3877
|
+
createAiGameGuildQuestRewardPreview,
|
|
3878
|
+
createAiGameGuildQuestSyncPayload,
|
|
3549
3879
|
createAiGameIdentityProjectionContract,
|
|
3550
3880
|
createAiGameIdentitySelfProjection,
|
|
3551
3881
|
createAiGameIdentityTargetProjection,
|
|
@@ -3596,6 +3926,10 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
3596
3926
|
getAiGamePlayerSystemModuleContract,
|
|
3597
3927
|
isAiGameApprenticeshipReadinessState,
|
|
3598
3928
|
isAiGameGossipExportAudience,
|
|
3929
|
+
isAiGameGuildQuestObjectiveStatus,
|
|
3930
|
+
isAiGameGuildQuestRewardKind,
|
|
3931
|
+
isAiGameGuildQuestStatus,
|
|
3932
|
+
isAiGameGuildQuestSystemRecommendation,
|
|
3599
3933
|
isAiGameIdentityKnowledgeState,
|
|
3600
3934
|
isAiGameIdentityProjectionRead,
|
|
3601
3935
|
isAiGameIdentityTargetCategory,
|