@plasius/ai-game 0.6.1 → 0.6.2
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 +16 -0
- package/README.md +24 -0
- package/dist/index.cjs +302 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -1
- package/dist/index.d.ts +109 -1
- package/dist/index.js +284 -5
- package/dist/index.js.map +1 -1
- package/docs/adrs/adr-0017-tutorial-contract-boundary.md +65 -0
- package/docs/adrs/index.md +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,21 @@ 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.2] - 2026-07-11
|
|
21
|
+
|
|
22
|
+
- **Added**
|
|
23
|
+
- Added versioned tutorial-step, progression-state, prerequisite-marker, contextual-trigger, and replay metadata contracts under `isekai.player-system.tutorial.enabled`.
|
|
24
|
+
- Added immutable tutorial-track factories with stage, combat-safety, collection-bound, and reference validation.
|
|
25
|
+
|
|
26
|
+
- **Changed**
|
|
27
|
+
- (placeholder)
|
|
28
|
+
|
|
29
|
+
- **Fixed**
|
|
30
|
+
- (placeholder)
|
|
31
|
+
|
|
32
|
+
- **Security**
|
|
33
|
+
- (placeholder)
|
|
34
|
+
|
|
20
35
|
## [0.6.1] - 2026-07-11
|
|
21
36
|
|
|
22
37
|
- **Added**
|
|
@@ -246,3 +261,4 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
|
|
|
246
261
|
[0.5.0]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.5.0
|
|
247
262
|
[0.6.0]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.6.0
|
|
248
263
|
[0.6.1]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.6.1
|
|
264
|
+
[0.6.2]: https://github.com/Plasius-LTD/ai-game/releases/tag/v0.6.2
|
package/README.md
CHANGED
|
@@ -150,6 +150,29 @@ The growth-direction vocabulary is validated through the published
|
|
|
150
150
|
`@plasius/training` authority package. MCC feasibility, spell grammar, risk
|
|
151
151
|
validation, and state mutation remain outside `@plasius/ai-game`.
|
|
152
152
|
|
|
153
|
+
## Tutorial contracts
|
|
154
|
+
|
|
155
|
+
Tutorial contracts provide dormant, contextual Player System coaching under
|
|
156
|
+
`isekai.player-system.tutorial.enabled`:
|
|
157
|
+
|
|
158
|
+
- `AiGameTutorialStep` describes a per-action capability, canonical evolution
|
|
159
|
+
stage, trigger kinds, prerequisite markers, replayability, and combat-safe
|
|
160
|
+
presentation.
|
|
161
|
+
- `AiGameTutorialProgressionState` records active, dormant, completed, and
|
|
162
|
+
declined state together with completed steps, refusal count, replay count,
|
|
163
|
+
and trigger/replay timestamps.
|
|
164
|
+
- `AiGameTutorialPrerequisite` defines bounded markers for school access,
|
|
165
|
+
apprenticeship, academy admission, guild standing, divine progression, and
|
|
166
|
+
spellcraft readiness without becoming the authority for those systems.
|
|
167
|
+
- `AiGameTutorialTrigger` supports awakening, first-action, explicit-request,
|
|
168
|
+
and progression-gated resurfacing.
|
|
169
|
+
- `createAiGameTutorialTrack()` validates all step, prerequisite, trigger, and
|
|
170
|
+
progression references and freezes the complete transport payload.
|
|
171
|
+
|
|
172
|
+
Tutorial tracks are foregrounded for first contact, dormant by default after
|
|
173
|
+
onboarding, replayable after unlock, and reduced to safe cues during active
|
|
174
|
+
combat unless the player explicitly enters a safe tutorial scenario.
|
|
175
|
+
|
|
153
176
|
## Quiet Measure contracts
|
|
154
177
|
|
|
155
178
|
The Quiet Measure surface is intentionally structured as a hidden-runtime contract, not a turnkey morality meter.
|
|
@@ -221,6 +244,7 @@ npm run pack:check
|
|
|
221
244
|
- `isekai.player-system.core.enabled`
|
|
222
245
|
- `isekai.player-system.guidance-nfr.enabled`
|
|
223
246
|
- `isekai.player-system.mcc-guidance.enabled`
|
|
247
|
+
- `isekai.player-system.tutorial.enabled`
|
|
224
248
|
- `isekai.player-system.identity.enabled`
|
|
225
249
|
- `isekai.player-system.logs.enabled`
|
|
226
250
|
- `isekai.training.institutions.enabled`
|
package/dist/index.cjs
CHANGED
|
@@ -120,6 +120,15 @@ __export(index_exports, {
|
|
|
120
120
|
AI_GAME_TRAINING_TECHNIQUE_MASTERY_STATES: () => import_training.TRAINING_TECHNIQUE_MASTERY_STATES,
|
|
121
121
|
AI_GAME_TRAINING_TRUST_MARKER_SOURCES: () => import_training.TRAINING_TRUST_MARKER_SOURCES,
|
|
122
122
|
AI_GAME_TTS_CACHE_POLICIES: () => AI_GAME_TTS_CACHE_POLICIES,
|
|
123
|
+
AI_GAME_TUTORIAL_COMPLETION_STATES: () => AI_GAME_TUTORIAL_COMPLETION_STATES,
|
|
124
|
+
AI_GAME_TUTORIAL_CONTRACT_VERSION: () => AI_GAME_TUTORIAL_CONTRACT_VERSION,
|
|
125
|
+
AI_GAME_TUTORIAL_FEATURE_FLAG_ID: () => AI_GAME_TUTORIAL_FEATURE_FLAG_ID,
|
|
126
|
+
AI_GAME_TUTORIAL_MAX_PREREQUISITES: () => AI_GAME_TUTORIAL_MAX_PREREQUISITES,
|
|
127
|
+
AI_GAME_TUTORIAL_MAX_STEPS: () => AI_GAME_TUTORIAL_MAX_STEPS,
|
|
128
|
+
AI_GAME_TUTORIAL_MAX_TRIGGERS: () => AI_GAME_TUTORIAL_MAX_TRIGGERS,
|
|
129
|
+
AI_GAME_TUTORIAL_PREREQUISITE_KINDS: () => AI_GAME_TUTORIAL_PREREQUISITE_KINDS,
|
|
130
|
+
AI_GAME_TUTORIAL_STAGES: () => AI_GAME_TUTORIAL_STAGES,
|
|
131
|
+
AI_GAME_TUTORIAL_TRIGGER_KINDS: () => AI_GAME_TUTORIAL_TRIGGER_KINDS,
|
|
123
132
|
QUIET_MEASURE_AXES: () => QUIET_MEASURE_AXES,
|
|
124
133
|
QUIET_MEASURE_CONFIDENCE_BANDS: () => QUIET_MEASURE_CONFIDENCE_BANDS,
|
|
125
134
|
QUIET_MEASURE_DERIVED_READS: () => QUIET_MEASURE_DERIVED_READS,
|
|
@@ -175,6 +184,11 @@ __export(index_exports, {
|
|
|
175
184
|
createAiGameTrainingStateSnapshot: () => createAiGameTrainingStateSnapshot,
|
|
176
185
|
createAiGameTrainingTrackSelection: () => import_training.createTrainingTrackSelection,
|
|
177
186
|
createAiGameTrainingTrustMarker: () => createAiGameTrainingTrustMarker,
|
|
187
|
+
createAiGameTutorialPrerequisite: () => createAiGameTutorialPrerequisite,
|
|
188
|
+
createAiGameTutorialProgressionState: () => createAiGameTutorialProgressionState,
|
|
189
|
+
createAiGameTutorialStep: () => createAiGameTutorialStep,
|
|
190
|
+
createAiGameTutorialTrack: () => createAiGameTutorialTrack,
|
|
191
|
+
createAiGameTutorialTrigger: () => createAiGameTutorialTrigger,
|
|
178
192
|
createQuietMeasureJudgmentEligibility: () => createQuietMeasureJudgmentEligibility,
|
|
179
193
|
createQuietMeasureJudgmentResponse: () => createQuietMeasureJudgmentResponse,
|
|
180
194
|
gameEventFeatureFlags: () => gameEventFeatureFlags,
|
|
@@ -236,6 +250,10 @@ __export(index_exports, {
|
|
|
236
250
|
isAiGameTrainingStageGate: () => isAiGameTrainingStageGate,
|
|
237
251
|
isAiGameTrainingTechniqueMasteryState: () => import_training.isTrainingTechniqueMasteryState,
|
|
238
252
|
isAiGameTrainingTrustMarkerSource: () => import_training.isTrainingTrustMarkerSource,
|
|
253
|
+
isAiGameTutorialCompletionState: () => isAiGameTutorialCompletionState,
|
|
254
|
+
isAiGameTutorialPrerequisiteKind: () => isAiGameTutorialPrerequisiteKind,
|
|
255
|
+
isAiGameTutorialStage: () => isAiGameTutorialStage,
|
|
256
|
+
isAiGameTutorialTriggerKind: () => isAiGameTutorialTriggerKind,
|
|
239
257
|
isCandidateWorldEvent: () => isCandidateWorldEvent,
|
|
240
258
|
isCanonicalWorldEvent: () => isCanonicalWorldEvent,
|
|
241
259
|
isGossipTopicActive: () => isGossipTopicActive,
|
|
@@ -2034,6 +2052,267 @@ function createAiGameMccGuidanceSnapshot(input) {
|
|
|
2034
2052
|
});
|
|
2035
2053
|
}
|
|
2036
2054
|
|
|
2055
|
+
// src/tutorial.ts
|
|
2056
|
+
var AI_GAME_TUTORIAL_FEATURE_FLAG_ID = "isekai.player-system.tutorial.enabled";
|
|
2057
|
+
var AI_GAME_TUTORIAL_CONTRACT_VERSION = "1.0";
|
|
2058
|
+
var AI_GAME_TUTORIAL_STAGES = [
|
|
2059
|
+
"stage-1",
|
|
2060
|
+
"stage-2",
|
|
2061
|
+
"stage-3",
|
|
2062
|
+
"stage-4",
|
|
2063
|
+
"stage-5"
|
|
2064
|
+
];
|
|
2065
|
+
var AI_GAME_TUTORIAL_TRIGGER_KINDS = [
|
|
2066
|
+
"awakening",
|
|
2067
|
+
"first-action",
|
|
2068
|
+
"explicit-request",
|
|
2069
|
+
"progression-gated"
|
|
2070
|
+
];
|
|
2071
|
+
var AI_GAME_TUTORIAL_PREREQUISITE_KINDS = [
|
|
2072
|
+
"school-access",
|
|
2073
|
+
"apprenticeship",
|
|
2074
|
+
"academy-admission",
|
|
2075
|
+
"guild-standing",
|
|
2076
|
+
"divine-progression",
|
|
2077
|
+
"spellcraft-readiness"
|
|
2078
|
+
];
|
|
2079
|
+
var AI_GAME_TUTORIAL_COMPLETION_STATES = [
|
|
2080
|
+
"not-started",
|
|
2081
|
+
"active",
|
|
2082
|
+
"dormant",
|
|
2083
|
+
"completed",
|
|
2084
|
+
"declined"
|
|
2085
|
+
];
|
|
2086
|
+
var AI_GAME_TUTORIAL_MAX_STEPS = 20;
|
|
2087
|
+
var AI_GAME_TUTORIAL_MAX_PREREQUISITES = 12;
|
|
2088
|
+
var AI_GAME_TUTORIAL_MAX_TRIGGERS = 8;
|
|
2089
|
+
function freezeReadonlyArray7(items) {
|
|
2090
|
+
return Object.freeze([...items]);
|
|
2091
|
+
}
|
|
2092
|
+
function createStringArray4(values, label) {
|
|
2093
|
+
const normalized = values ?? [];
|
|
2094
|
+
normalized.forEach((value) => assertNonEmptyString7(value, `${label} entry`));
|
|
2095
|
+
return freezeReadonlyArray7(normalized);
|
|
2096
|
+
}
|
|
2097
|
+
function assertNonEmptyString7(value, label) {
|
|
2098
|
+
if (value.trim().length === 0) {
|
|
2099
|
+
throw new Error(`${label} must be a non-empty string`);
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
function assertContractVersion6(value) {
|
|
2103
|
+
if (value !== AI_GAME_TUTORIAL_CONTRACT_VERSION) {
|
|
2104
|
+
throw new Error(`contractVersion must be ${AI_GAME_TUTORIAL_CONTRACT_VERSION}`);
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
function assertPositiveInteger2(value, label) {
|
|
2108
|
+
if (!Number.isInteger(value) || value <= 0) {
|
|
2109
|
+
throw new Error(`${label} must be a positive integer`);
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
function assertNonNegativeInteger3(value, label) {
|
|
2113
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
2114
|
+
throw new Error(`${label} must be a non-negative integer`);
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
function assertIsoTimestampOrNull(value, label) {
|
|
2118
|
+
if (value !== null && Number.isNaN(Date.parse(value))) {
|
|
2119
|
+
throw new Error(`${label} must be an ISO-8601 timestamp`);
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
function isMember6(value, members) {
|
|
2123
|
+
return members.includes(value);
|
|
2124
|
+
}
|
|
2125
|
+
function assertUniqueIds2(values, label) {
|
|
2126
|
+
if (new Set(values).size !== values.length) {
|
|
2127
|
+
throw new Error(`${label} must have unique IDs`);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
function isAiGameTutorialStage(value) {
|
|
2131
|
+
return isMember6(value, AI_GAME_TUTORIAL_STAGES);
|
|
2132
|
+
}
|
|
2133
|
+
function isAiGameTutorialTriggerKind(value) {
|
|
2134
|
+
return isMember6(value, AI_GAME_TUTORIAL_TRIGGER_KINDS);
|
|
2135
|
+
}
|
|
2136
|
+
function isAiGameTutorialPrerequisiteKind(value) {
|
|
2137
|
+
return isMember6(value, AI_GAME_TUTORIAL_PREREQUISITE_KINDS);
|
|
2138
|
+
}
|
|
2139
|
+
function isAiGameTutorialCompletionState(value) {
|
|
2140
|
+
return isMember6(value, AI_GAME_TUTORIAL_COMPLETION_STATES);
|
|
2141
|
+
}
|
|
2142
|
+
function createAiGameTutorialPrerequisite(input) {
|
|
2143
|
+
assertNonEmptyString7(input.markerId, "markerId");
|
|
2144
|
+
assertContractVersion6(input.contractVersion ?? AI_GAME_TUTORIAL_CONTRACT_VERSION);
|
|
2145
|
+
if (!isAiGameTutorialPrerequisiteKind(input.kind)) {
|
|
2146
|
+
throw new Error("kind must be a supported tutorial prerequisite kind");
|
|
2147
|
+
}
|
|
2148
|
+
assertNonEmptyString7(input.label, "label");
|
|
2149
|
+
return Object.freeze({
|
|
2150
|
+
contractVersion: input.contractVersion ?? AI_GAME_TUTORIAL_CONTRACT_VERSION,
|
|
2151
|
+
featureFlagId: AI_GAME_TUTORIAL_FEATURE_FLAG_ID,
|
|
2152
|
+
markerId: input.markerId,
|
|
2153
|
+
kind: input.kind,
|
|
2154
|
+
label: input.label,
|
|
2155
|
+
satisfied: input.satisfied,
|
|
2156
|
+
reasonCodes: createStringArray4(input.reasonCodes, "reasonCodes")
|
|
2157
|
+
});
|
|
2158
|
+
}
|
|
2159
|
+
function createAiGameTutorialTrigger(input) {
|
|
2160
|
+
assertNonEmptyString7(input.triggerId, "triggerId");
|
|
2161
|
+
assertContractVersion6(input.contractVersion ?? AI_GAME_TUTORIAL_CONTRACT_VERSION);
|
|
2162
|
+
if (!isAiGameTutorialTriggerKind(input.kind)) {
|
|
2163
|
+
throw new Error("kind must be a supported tutorial trigger kind");
|
|
2164
|
+
}
|
|
2165
|
+
assertNonEmptyString7(input.capabilityCode, "capabilityCode");
|
|
2166
|
+
return Object.freeze({
|
|
2167
|
+
contractVersion: input.contractVersion ?? AI_GAME_TUTORIAL_CONTRACT_VERSION,
|
|
2168
|
+
featureFlagId: AI_GAME_TUTORIAL_FEATURE_FLAG_ID,
|
|
2169
|
+
triggerId: input.triggerId,
|
|
2170
|
+
kind: input.kind,
|
|
2171
|
+
capabilityCode: input.capabilityCode,
|
|
2172
|
+
firstUseOnly: input.firstUseOnly,
|
|
2173
|
+
safeInCombat: input.safeInCombat,
|
|
2174
|
+
reasonCodes: createStringArray4(input.reasonCodes, "reasonCodes")
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
function createAiGameTutorialStep(input) {
|
|
2178
|
+
assertNonEmptyString7(input.stepId, "stepId");
|
|
2179
|
+
assertNonEmptyString7(input.trackId, "trackId");
|
|
2180
|
+
assertContractVersion6(input.contractVersion ?? AI_GAME_TUTORIAL_CONTRACT_VERSION);
|
|
2181
|
+
if (!isAiGameTutorialStage(input.stage)) {
|
|
2182
|
+
throw new Error("stage must be a supported tutorial stage");
|
|
2183
|
+
}
|
|
2184
|
+
assertPositiveInteger2(input.sequence, "sequence");
|
|
2185
|
+
assertNonEmptyString7(input.title, "title");
|
|
2186
|
+
assertNonEmptyString7(input.summary, "summary");
|
|
2187
|
+
assertNonEmptyString7(input.capabilityCode, "capabilityCode");
|
|
2188
|
+
if (input.triggerKinds.length === 0) {
|
|
2189
|
+
throw new Error("triggerKinds must contain at least one trigger kind");
|
|
2190
|
+
}
|
|
2191
|
+
input.triggerKinds.forEach((kind) => {
|
|
2192
|
+
if (!isAiGameTutorialTriggerKind(kind)) {
|
|
2193
|
+
throw new Error("triggerKinds must use supported tutorial trigger kinds");
|
|
2194
|
+
}
|
|
2195
|
+
});
|
|
2196
|
+
return Object.freeze({
|
|
2197
|
+
contractVersion: input.contractVersion ?? AI_GAME_TUTORIAL_CONTRACT_VERSION,
|
|
2198
|
+
featureFlagId: AI_GAME_TUTORIAL_FEATURE_FLAG_ID,
|
|
2199
|
+
stepId: input.stepId,
|
|
2200
|
+
trackId: input.trackId,
|
|
2201
|
+
stage: input.stage,
|
|
2202
|
+
sequence: input.sequence,
|
|
2203
|
+
title: input.title,
|
|
2204
|
+
summary: input.summary,
|
|
2205
|
+
capabilityCode: input.capabilityCode,
|
|
2206
|
+
triggerKinds: freezeReadonlyArray7(input.triggerKinds),
|
|
2207
|
+
prerequisiteIds: createStringArray4(input.prerequisiteIds, "prerequisiteIds"),
|
|
2208
|
+
safeInCombat: input.safeInCombat,
|
|
2209
|
+
replayable: input.replayable,
|
|
2210
|
+
reasonCodes: createStringArray4(input.reasonCodes, "reasonCodes")
|
|
2211
|
+
});
|
|
2212
|
+
}
|
|
2213
|
+
function createAiGameTutorialProgressionState(input) {
|
|
2214
|
+
assertNonEmptyString7(input.trackId, "trackId");
|
|
2215
|
+
assertContractVersion6(input.contractVersion ?? AI_GAME_TUTORIAL_CONTRACT_VERSION);
|
|
2216
|
+
if (!isAiGameTutorialCompletionState(input.status)) {
|
|
2217
|
+
throw new Error("status must be a supported tutorial completion state");
|
|
2218
|
+
}
|
|
2219
|
+
if (input.currentStepId !== null) {
|
|
2220
|
+
assertNonEmptyString7(input.currentStepId, "currentStepId");
|
|
2221
|
+
}
|
|
2222
|
+
const completedStepIds = createStringArray4(input.completedStepIds, "completedStepIds");
|
|
2223
|
+
assertUniqueIds2(completedStepIds, "completedStepIds");
|
|
2224
|
+
assertNonNegativeInteger3(input.refusalCount, "refusalCount");
|
|
2225
|
+
assertNonNegativeInteger3(input.replayCount, "replayCount");
|
|
2226
|
+
assertIsoTimestampOrNull(input.lastTriggeredAtIso, "lastTriggeredAtIso");
|
|
2227
|
+
assertIsoTimestampOrNull(input.lastReplayedAtIso, "lastReplayedAtIso");
|
|
2228
|
+
if (input.status === "completed" && input.currentStepId !== null) {
|
|
2229
|
+
throw new Error("completed tutorials cannot have a currentStepId");
|
|
2230
|
+
}
|
|
2231
|
+
return Object.freeze({
|
|
2232
|
+
contractVersion: input.contractVersion ?? AI_GAME_TUTORIAL_CONTRACT_VERSION,
|
|
2233
|
+
featureFlagId: AI_GAME_TUTORIAL_FEATURE_FLAG_ID,
|
|
2234
|
+
trackId: input.trackId,
|
|
2235
|
+
status: input.status,
|
|
2236
|
+
currentStepId: input.currentStepId,
|
|
2237
|
+
completedStepIds,
|
|
2238
|
+
refusalCount: input.refusalCount,
|
|
2239
|
+
replayCount: input.replayCount,
|
|
2240
|
+
replayable: input.replayable,
|
|
2241
|
+
lastTriggeredAtIso: input.lastTriggeredAtIso,
|
|
2242
|
+
lastReplayedAtIso: input.lastReplayedAtIso,
|
|
2243
|
+
reasonCodes: createStringArray4(input.reasonCodes, "reasonCodes")
|
|
2244
|
+
});
|
|
2245
|
+
}
|
|
2246
|
+
function createAiGameTutorialTrack(input) {
|
|
2247
|
+
assertNonEmptyString7(input.trackId, "trackId");
|
|
2248
|
+
assertContractVersion6(input.contractVersion ?? AI_GAME_TUTORIAL_CONTRACT_VERSION);
|
|
2249
|
+
assertNonEmptyString7(input.title, "title");
|
|
2250
|
+
assertNonEmptyString7(input.summary, "summary");
|
|
2251
|
+
if (input.steps.length === 0 || input.steps.length > AI_GAME_TUTORIAL_MAX_STEPS) {
|
|
2252
|
+
throw new Error(
|
|
2253
|
+
`steps must contain between 1 and ${AI_GAME_TUTORIAL_MAX_STEPS} steps`
|
|
2254
|
+
);
|
|
2255
|
+
}
|
|
2256
|
+
if (input.prerequisites.length > AI_GAME_TUTORIAL_MAX_PREREQUISITES) {
|
|
2257
|
+
throw new Error(
|
|
2258
|
+
`prerequisites cannot contain more than ${AI_GAME_TUTORIAL_MAX_PREREQUISITES} markers`
|
|
2259
|
+
);
|
|
2260
|
+
}
|
|
2261
|
+
if (input.triggers.length === 0 || input.triggers.length > AI_GAME_TUTORIAL_MAX_TRIGGERS) {
|
|
2262
|
+
throw new Error(
|
|
2263
|
+
`triggers must contain between 1 and ${AI_GAME_TUTORIAL_MAX_TRIGGERS} triggers`
|
|
2264
|
+
);
|
|
2265
|
+
}
|
|
2266
|
+
const steps = freezeReadonlyArray7(
|
|
2267
|
+
input.steps.map((step) => createAiGameTutorialStep(step))
|
|
2268
|
+
);
|
|
2269
|
+
const prerequisites = freezeReadonlyArray7(
|
|
2270
|
+
input.prerequisites.map((marker) => createAiGameTutorialPrerequisite(marker))
|
|
2271
|
+
);
|
|
2272
|
+
const triggers = freezeReadonlyArray7(
|
|
2273
|
+
input.triggers.map((trigger) => createAiGameTutorialTrigger(trigger))
|
|
2274
|
+
);
|
|
2275
|
+
const progression = createAiGameTutorialProgressionState(input.progression);
|
|
2276
|
+
assertUniqueIds2(steps.map((step) => step.stepId), "steps");
|
|
2277
|
+
assertUniqueIds2(prerequisites.map((marker) => marker.markerId), "prerequisites");
|
|
2278
|
+
assertUniqueIds2(triggers.map((trigger) => trigger.triggerId), "triggers");
|
|
2279
|
+
if (progression.trackId !== input.trackId) {
|
|
2280
|
+
throw new Error("progression trackId must match the tutorial track");
|
|
2281
|
+
}
|
|
2282
|
+
const stepIds = new Set(steps.map((step) => step.stepId));
|
|
2283
|
+
const prerequisiteIds = new Set(prerequisites.map((marker) => marker.markerId));
|
|
2284
|
+
const triggerKinds = new Set(triggers.map((trigger) => trigger.kind));
|
|
2285
|
+
if (progression.currentStepId !== null && !stepIds.has(progression.currentStepId)) {
|
|
2286
|
+
throw new Error("currentStepId must reference a supplied tutorial step");
|
|
2287
|
+
}
|
|
2288
|
+
if (progression.completedStepIds.some((stepId) => !stepIds.has(stepId))) {
|
|
2289
|
+
throw new Error("completedStepIds must reference supplied tutorial steps");
|
|
2290
|
+
}
|
|
2291
|
+
steps.forEach((step) => {
|
|
2292
|
+
if (step.trackId !== input.trackId) {
|
|
2293
|
+
throw new Error("step trackId must match the tutorial track");
|
|
2294
|
+
}
|
|
2295
|
+
if (step.prerequisiteIds.some((markerId) => !prerequisiteIds.has(markerId))) {
|
|
2296
|
+
throw new Error("prerequisiteIds must reference supplied prerequisites");
|
|
2297
|
+
}
|
|
2298
|
+
if (step.triggerKinds.some((kind) => !triggerKinds.has(kind))) {
|
|
2299
|
+
throw new Error("triggerKinds must reference supplied triggers");
|
|
2300
|
+
}
|
|
2301
|
+
});
|
|
2302
|
+
return Object.freeze({
|
|
2303
|
+
contractVersion: input.contractVersion ?? AI_GAME_TUTORIAL_CONTRACT_VERSION,
|
|
2304
|
+
featureFlagId: AI_GAME_TUTORIAL_FEATURE_FLAG_ID,
|
|
2305
|
+
trackId: input.trackId,
|
|
2306
|
+
title: input.title,
|
|
2307
|
+
summary: input.summary,
|
|
2308
|
+
steps,
|
|
2309
|
+
prerequisites,
|
|
2310
|
+
triggers,
|
|
2311
|
+
progression,
|
|
2312
|
+
reasonCodes: createStringArray4(input.reasonCodes, "reasonCodes")
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2037
2316
|
// src/world-events.ts
|
|
2038
2317
|
function isCanonicalWorldEvent(event) {
|
|
2039
2318
|
return event.recordType === "canonical";
|
|
@@ -2185,7 +2464,7 @@ var QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [
|
|
|
2185
2464
|
"private-or-low-witness-evidence",
|
|
2186
2465
|
"costly-pressure-event"
|
|
2187
2466
|
];
|
|
2188
|
-
function
|
|
2467
|
+
function isMember7(value, members) {
|
|
2189
2468
|
return members.includes(value);
|
|
2190
2469
|
}
|
|
2191
2470
|
function assertRecord(value, label) {
|
|
@@ -2226,7 +2505,7 @@ function normalizeTimestamp(value, label) {
|
|
|
2226
2505
|
}
|
|
2227
2506
|
function normalizeMember(value, members, label) {
|
|
2228
2507
|
const normalized = normalizeNonEmptyString(value, label);
|
|
2229
|
-
if (!
|
|
2508
|
+
if (!isMember7(normalized, members)) {
|
|
2230
2509
|
throw new TypeError(`${label} must be one of: ${members.join(", ")}.`);
|
|
2231
2510
|
}
|
|
2232
2511
|
return normalized;
|
|
@@ -2359,13 +2638,13 @@ function normalizeDominantReads(value) {
|
|
|
2359
2638
|
return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));
|
|
2360
2639
|
}
|
|
2361
2640
|
function isQuietMeasureAxis(value) {
|
|
2362
|
-
return
|
|
2641
|
+
return isMember7(value, QUIET_MEASURE_AXES);
|
|
2363
2642
|
}
|
|
2364
2643
|
function isQuietMeasureMissionProbeMode(value) {
|
|
2365
|
-
return
|
|
2644
|
+
return isMember7(value, QUIET_MEASURE_MISSION_PROBE_MODES);
|
|
2366
2645
|
}
|
|
2367
2646
|
function isQuietMeasureMissionResolutionShape(value) {
|
|
2368
|
-
return
|
|
2647
|
+
return isMember7(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
|
|
2369
2648
|
}
|
|
2370
2649
|
function createQuietMeasureJudgmentEligibility(input = {}) {
|
|
2371
2650
|
const repeatedMeaningfulEvidence = normalizeOptionalBoolean(
|
|
@@ -2963,6 +3242,15 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
2963
3242
|
AI_GAME_TRAINING_TECHNIQUE_MASTERY_STATES,
|
|
2964
3243
|
AI_GAME_TRAINING_TRUST_MARKER_SOURCES,
|
|
2965
3244
|
AI_GAME_TTS_CACHE_POLICIES,
|
|
3245
|
+
AI_GAME_TUTORIAL_COMPLETION_STATES,
|
|
3246
|
+
AI_GAME_TUTORIAL_CONTRACT_VERSION,
|
|
3247
|
+
AI_GAME_TUTORIAL_FEATURE_FLAG_ID,
|
|
3248
|
+
AI_GAME_TUTORIAL_MAX_PREREQUISITES,
|
|
3249
|
+
AI_GAME_TUTORIAL_MAX_STEPS,
|
|
3250
|
+
AI_GAME_TUTORIAL_MAX_TRIGGERS,
|
|
3251
|
+
AI_GAME_TUTORIAL_PREREQUISITE_KINDS,
|
|
3252
|
+
AI_GAME_TUTORIAL_STAGES,
|
|
3253
|
+
AI_GAME_TUTORIAL_TRIGGER_KINDS,
|
|
2966
3254
|
QUIET_MEASURE_AXES,
|
|
2967
3255
|
QUIET_MEASURE_CONFIDENCE_BANDS,
|
|
2968
3256
|
QUIET_MEASURE_DERIVED_READS,
|
|
@@ -3018,6 +3306,11 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
3018
3306
|
createAiGameTrainingStateSnapshot,
|
|
3019
3307
|
createAiGameTrainingTrackSelection,
|
|
3020
3308
|
createAiGameTrainingTrustMarker,
|
|
3309
|
+
createAiGameTutorialPrerequisite,
|
|
3310
|
+
createAiGameTutorialProgressionState,
|
|
3311
|
+
createAiGameTutorialStep,
|
|
3312
|
+
createAiGameTutorialTrack,
|
|
3313
|
+
createAiGameTutorialTrigger,
|
|
3021
3314
|
createQuietMeasureJudgmentEligibility,
|
|
3022
3315
|
createQuietMeasureJudgmentResponse,
|
|
3023
3316
|
gameEventFeatureFlags,
|
|
@@ -3079,6 +3372,10 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
3079
3372
|
isAiGameTrainingStageGate,
|
|
3080
3373
|
isAiGameTrainingTechniqueMasteryState,
|
|
3081
3374
|
isAiGameTrainingTrustMarkerSource,
|
|
3375
|
+
isAiGameTutorialCompletionState,
|
|
3376
|
+
isAiGameTutorialPrerequisiteKind,
|
|
3377
|
+
isAiGameTutorialStage,
|
|
3378
|
+
isAiGameTutorialTriggerKind,
|
|
3082
3379
|
isCandidateWorldEvent,
|
|
3083
3380
|
isCanonicalWorldEvent,
|
|
3084
3381
|
isGossipTopicActive,
|