@plasius/ai-game 0.1.6 → 0.1.8
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 +22 -9
- package/README.md +17 -23
- package/dist/index.cjs +357 -197
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +122 -81
- package/dist/index.d.ts +122 -81
- package/dist/index.js +339 -185
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31,209 +31,46 @@ __export(index_exports, {
|
|
|
31
31
|
AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID: () => AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
|
|
32
32
|
AI_GAME_PACKAGE: () => AI_GAME_PACKAGE,
|
|
33
33
|
AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID: () => AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
|
|
34
|
-
|
|
35
|
-
AI_GAME_POINTS_AUTHORITY_BANDS: () => AI_GAME_POINTS_AUTHORITY_BANDS,
|
|
36
|
-
AI_GAME_POINTS_AUTHORITY_SYSTEMS: () => AI_GAME_POINTS_AUTHORITY_SYSTEMS,
|
|
37
|
-
AI_GAME_POINTS_LEDGER_IDS: () => AI_GAME_POINTS_LEDGER_IDS,
|
|
38
|
-
AI_GAME_POINTS_STORE_FEATURE_FLAG_ID: () => AI_GAME_POINTS_STORE_FEATURE_FLAG_ID,
|
|
34
|
+
AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID: () => AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID,
|
|
39
35
|
AI_GAME_TASK_AUTHORITY_BOUNDARIES: () => AI_GAME_TASK_AUTHORITY_BOUNDARIES,
|
|
40
36
|
AI_GAME_TASK_DECISIONS: () => AI_GAME_TASK_DECISIONS,
|
|
41
37
|
AI_GAME_TASK_KINDS: () => AI_GAME_TASK_KINDS,
|
|
42
38
|
AI_GAME_TASK_RESULTS: () => AI_GAME_TASK_RESULTS,
|
|
43
39
|
AI_GAME_TASK_RISK_CLASSES: () => AI_GAME_TASK_RISK_CLASSES,
|
|
44
40
|
AI_GAME_TTS_CACHE_POLICIES: () => AI_GAME_TTS_CACHE_POLICIES,
|
|
41
|
+
QUIET_MEASURE_AXES: () => QUIET_MEASURE_AXES,
|
|
42
|
+
QUIET_MEASURE_CONFIDENCE_BANDS: () => QUIET_MEASURE_CONFIDENCE_BANDS,
|
|
43
|
+
QUIET_MEASURE_DERIVED_READS: () => QUIET_MEASURE_DERIVED_READS,
|
|
44
|
+
QUIET_MEASURE_EVIDENCE_CLASSES: () => QUIET_MEASURE_EVIDENCE_CLASSES,
|
|
45
|
+
QUIET_MEASURE_JUDGMENT_DISCLOSURES: () => QUIET_MEASURE_JUDGMENT_DISCLOSURES,
|
|
46
|
+
QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE: () => QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE,
|
|
47
|
+
QUIET_MEASURE_JUDGMENT_REQUESTERS: () => QUIET_MEASURE_JUDGMENT_REQUESTERS,
|
|
48
|
+
QUIET_MEASURE_MISSION_PROBE_MODES: () => QUIET_MEASURE_MISSION_PROBE_MODES,
|
|
49
|
+
QUIET_MEASURE_MISSION_RESOLUTION_SHAPES: () => QUIET_MEASURE_MISSION_RESOLUTION_SHAPES,
|
|
50
|
+
QUIET_MEASURE_PERSPECTIVES: () => QUIET_MEASURE_PERSPECTIVES,
|
|
51
|
+
QUIET_MEASURE_SIGNAL_BANDS: () => QUIET_MEASURE_SIGNAL_BANDS,
|
|
45
52
|
aiGameFeatureFlags: () => aiGameFeatureFlags,
|
|
46
53
|
classifyAiGameTask: () => classifyAiGameTask,
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
createQuietMeasureJudgmentEligibility: () => createQuietMeasureJudgmentEligibility,
|
|
55
|
+
createQuietMeasureJudgmentResponse: () => createQuietMeasureJudgmentResponse,
|
|
49
56
|
gameEventFeatureFlags: () => gameEventFeatureFlags,
|
|
50
|
-
getAiGameProtoSocialDevolutionPolicy: () => getAiGameProtoSocialDevolutionPolicy,
|
|
51
|
-
getDefaultAiGamePointsSpendPolicies: () => getDefaultAiGamePointsSpendPolicies,
|
|
52
|
-
isAiGamePlayerEvolutionStage: () => isAiGamePlayerEvolutionStage,
|
|
53
|
-
isAiGamePointsLedgerId: () => isAiGamePointsLedgerId,
|
|
54
57
|
isCandidateWorldEvent: () => isCandidateWorldEvent,
|
|
55
58
|
isCanonicalWorldEvent: () => isCanonicalWorldEvent,
|
|
56
59
|
isGossipTopicActive: () => isGossipTopicActive,
|
|
57
60
|
isGossipTopicCorrected: () => isGossipTopicCorrected,
|
|
58
61
|
isIncidentResolved: () => isIncidentResolved,
|
|
62
|
+
isQuietMeasureAxis: () => isQuietMeasureAxis,
|
|
63
|
+
isQuietMeasureMissionProbeMode: () => isQuietMeasureMissionProbeMode,
|
|
64
|
+
isQuietMeasureMissionResolutionShape: () => isQuietMeasureMissionResolutionShape,
|
|
65
|
+
listQuietMeasureMissingEvidence: () => listQuietMeasureMissingEvidence,
|
|
59
66
|
normalizeIncidentImpactVector: () => normalizeIncidentImpactVector,
|
|
60
67
|
packageDescriptor: () => packageDescriptor,
|
|
61
68
|
projectTopicForAudience: () => projectTopicForAudience,
|
|
62
69
|
resolveAiGamePlayerAddressText: () => resolveAiGamePlayerAddressText,
|
|
63
|
-
resolveAiGamePointsAuthorityBoundary: () => resolveAiGamePointsAuthorityBoundary,
|
|
64
70
|
resolveAiGameTaskBatch: () => resolveAiGameTaskBatch
|
|
65
71
|
});
|
|
66
72
|
module.exports = __toCommonJS(index_exports);
|
|
67
73
|
|
|
68
|
-
// src/points-store.ts
|
|
69
|
-
var AI_GAME_POINTS_STORE_FEATURE_FLAG_ID = "isekai.player-system.points-store.enabled";
|
|
70
|
-
var AI_GAME_POINTS_LEDGER_IDS = ["pp", "esp", "tis", "dis"];
|
|
71
|
-
var AI_GAME_PLAYER_EVOLUTION_STAGES = ["proto-social", "social-lock"];
|
|
72
|
-
var AI_GAME_POINTS_AUTHORITY_BANDS = [
|
|
73
|
-
"self",
|
|
74
|
-
"frontier",
|
|
75
|
-
"civic",
|
|
76
|
-
"divine"
|
|
77
|
-
];
|
|
78
|
-
var AI_GAME_POINTS_AUTHORITY_SYSTEMS = [
|
|
79
|
-
"player-system",
|
|
80
|
-
"exploration-system",
|
|
81
|
-
"territorial-influence-system",
|
|
82
|
-
"divine-influence-system"
|
|
83
|
-
];
|
|
84
|
-
var AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER = Object.freeze({
|
|
85
|
-
pp: Object.freeze({
|
|
86
|
-
ledgerId: "pp",
|
|
87
|
-
authorityBand: "self",
|
|
88
|
-
authoritySystem: "player-system",
|
|
89
|
-
requiresWorldAuthority: false,
|
|
90
|
-
combatSafeOnly: false
|
|
91
|
-
}),
|
|
92
|
-
esp: Object.freeze({
|
|
93
|
-
ledgerId: "esp",
|
|
94
|
-
authorityBand: "frontier",
|
|
95
|
-
authoritySystem: "exploration-system",
|
|
96
|
-
requiresWorldAuthority: false,
|
|
97
|
-
combatSafeOnly: true
|
|
98
|
-
}),
|
|
99
|
-
tis: Object.freeze({
|
|
100
|
-
ledgerId: "tis",
|
|
101
|
-
authorityBand: "civic",
|
|
102
|
-
authoritySystem: "territorial-influence-system",
|
|
103
|
-
requiresWorldAuthority: true,
|
|
104
|
-
combatSafeOnly: false
|
|
105
|
-
}),
|
|
106
|
-
dis: Object.freeze({
|
|
107
|
-
ledgerId: "dis",
|
|
108
|
-
authorityBand: "divine",
|
|
109
|
-
authoritySystem: "divine-influence-system",
|
|
110
|
-
requiresWorldAuthority: true,
|
|
111
|
-
combatSafeOnly: false
|
|
112
|
-
})
|
|
113
|
-
});
|
|
114
|
-
var AI_GAME_DEFAULT_POINTS_SPEND_POLICIES = Object.freeze([
|
|
115
|
-
Object.freeze({
|
|
116
|
-
policyId: "pp-personal-respec",
|
|
117
|
-
ledgerId: "pp",
|
|
118
|
-
authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.pp,
|
|
119
|
-
actions: Object.freeze([
|
|
120
|
-
Object.freeze({
|
|
121
|
-
actionId: "return-to-slime",
|
|
122
|
-
title: "Return to slime",
|
|
123
|
-
cost: 12,
|
|
124
|
-
prerequisiteCodes: Object.freeze(["proto-social-window-open", "single-use-remaining"]),
|
|
125
|
-
consequenceCodes: Object.freeze(["reset-social-form", "consume-pp-balance"])
|
|
126
|
-
})
|
|
127
|
-
])
|
|
128
|
-
}),
|
|
129
|
-
Object.freeze({
|
|
130
|
-
policyId: "esp-exploration-routing",
|
|
131
|
-
ledgerId: "esp",
|
|
132
|
-
authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.esp,
|
|
133
|
-
actions: Object.freeze([
|
|
134
|
-
Object.freeze({
|
|
135
|
-
actionId: "fast-travel-upgrade",
|
|
136
|
-
title: "Unlock frontier fast travel",
|
|
137
|
-
cost: 8,
|
|
138
|
-
prerequisiteCodes: Object.freeze(["frontier-route-discovered", "out-of-combat-only"]),
|
|
139
|
-
consequenceCodes: Object.freeze(["reduce-route-friction"])
|
|
140
|
-
})
|
|
141
|
-
])
|
|
142
|
-
}),
|
|
143
|
-
Object.freeze({
|
|
144
|
-
policyId: "tis-civic-investment",
|
|
145
|
-
ledgerId: "tis",
|
|
146
|
-
authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.tis,
|
|
147
|
-
actions: Object.freeze([
|
|
148
|
-
Object.freeze({
|
|
149
|
-
actionId: "district-favor",
|
|
150
|
-
title: "Commit district influence favor",
|
|
151
|
-
cost: 5,
|
|
152
|
-
prerequisiteCodes: Object.freeze(["civic-authority-approval"]),
|
|
153
|
-
consequenceCodes: Object.freeze(["alter-territorial-standing"])
|
|
154
|
-
})
|
|
155
|
-
])
|
|
156
|
-
}),
|
|
157
|
-
Object.freeze({
|
|
158
|
-
policyId: "dis-divine-covenant",
|
|
159
|
-
ledgerId: "dis",
|
|
160
|
-
authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.dis,
|
|
161
|
-
actions: Object.freeze([
|
|
162
|
-
Object.freeze({
|
|
163
|
-
actionId: "divine-oath",
|
|
164
|
-
title: "Bind a divine covenant",
|
|
165
|
-
cost: 3,
|
|
166
|
-
prerequisiteCodes: Object.freeze(["divine-clearance-granted"]),
|
|
167
|
-
consequenceCodes: Object.freeze(["alter-divine-standing"])
|
|
168
|
-
})
|
|
169
|
-
])
|
|
170
|
-
})
|
|
171
|
-
]);
|
|
172
|
-
var AI_GAME_PROTO_SOCIAL_DEVOLUTION_POLICY = Object.freeze({
|
|
173
|
-
actionId: "return-to-slime",
|
|
174
|
-
ledgerId: "pp",
|
|
175
|
-
cost: 12,
|
|
176
|
-
requiredEvolutionStage: "proto-social",
|
|
177
|
-
closesAtEvolutionStage: "social-lock",
|
|
178
|
-
singleUse: true,
|
|
179
|
-
authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.pp,
|
|
180
|
-
prerequisiteCodes: Object.freeze(["proto-social-window-open", "single-use-remaining"]),
|
|
181
|
-
consequenceCodes: Object.freeze(["reset-social-form", "consume-pp-balance"])
|
|
182
|
-
});
|
|
183
|
-
function normalizeNonNegativeInteger(value) {
|
|
184
|
-
if (!Number.isFinite(value)) {
|
|
185
|
-
return 0;
|
|
186
|
-
}
|
|
187
|
-
return Math.max(0, Math.trunc(value));
|
|
188
|
-
}
|
|
189
|
-
function isAiGamePointsLedgerId(value) {
|
|
190
|
-
return AI_GAME_POINTS_LEDGER_IDS.includes(value);
|
|
191
|
-
}
|
|
192
|
-
function isAiGamePlayerEvolutionStage(value) {
|
|
193
|
-
return AI_GAME_PLAYER_EVOLUTION_STAGES.includes(value);
|
|
194
|
-
}
|
|
195
|
-
function resolveAiGamePointsAuthorityBoundary(ledgerId) {
|
|
196
|
-
return AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER[ledgerId];
|
|
197
|
-
}
|
|
198
|
-
function createAiGamePointsLedgerSnapshot(input) {
|
|
199
|
-
return Object.freeze({
|
|
200
|
-
ledgerId: input.ledgerId,
|
|
201
|
-
balance: normalizeNonNegativeInteger(input.balance),
|
|
202
|
-
earnedTotal: normalizeNonNegativeInteger(input.earnedTotal),
|
|
203
|
-
spentTotal: normalizeNonNegativeInteger(input.spentTotal),
|
|
204
|
-
committedTotal: normalizeNonNegativeInteger(input.committedTotal),
|
|
205
|
-
asOfEpochMs: input.asOfEpochMs
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
function getDefaultAiGamePointsSpendPolicies() {
|
|
209
|
-
return AI_GAME_DEFAULT_POINTS_SPEND_POLICIES;
|
|
210
|
-
}
|
|
211
|
-
function getAiGameProtoSocialDevolutionPolicy() {
|
|
212
|
-
return AI_GAME_PROTO_SOCIAL_DEVOLUTION_POLICY;
|
|
213
|
-
}
|
|
214
|
-
function evaluateAiGameProtoSocialDevolutionEligibility(input) {
|
|
215
|
-
const reasonCodes = [];
|
|
216
|
-
const policy = AI_GAME_PROTO_SOCIAL_DEVOLUTION_POLICY;
|
|
217
|
-
const currentBalance = normalizeNonNegativeInteger(input.currentBalance);
|
|
218
|
-
if (input.evolutionStage !== policy.requiredEvolutionStage) {
|
|
219
|
-
reasonCodes.push("devolution-window-closed");
|
|
220
|
-
}
|
|
221
|
-
if (input.alreadyUsed) {
|
|
222
|
-
reasonCodes.push("devolution-already-used");
|
|
223
|
-
}
|
|
224
|
-
if (currentBalance < policy.cost) {
|
|
225
|
-
reasonCodes.push("insufficient-pp-balance");
|
|
226
|
-
}
|
|
227
|
-
if (reasonCodes.length === 0) {
|
|
228
|
-
reasonCodes.push("devolution-allowed");
|
|
229
|
-
}
|
|
230
|
-
return Object.freeze({
|
|
231
|
-
available: reasonCodes.length === 1 && reasonCodes[0] === "devolution-allowed",
|
|
232
|
-
reasonCodes: Object.freeze(reasonCodes),
|
|
233
|
-
policy
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
|
|
237
74
|
// src/world-events.ts
|
|
238
75
|
function isCanonicalWorldEvent(event) {
|
|
239
76
|
return event.recordType === "canonical";
|
|
@@ -325,6 +162,325 @@ function projectTopicForAudience(topic, projection, nowEpochMs = Date.now()) {
|
|
|
325
162
|
};
|
|
326
163
|
}
|
|
327
164
|
|
|
165
|
+
// src/quiet-measure.ts
|
|
166
|
+
var AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID = "isekai.player-system.quiet-measure.enabled";
|
|
167
|
+
var QUIET_MEASURE_AXES = [
|
|
168
|
+
"selflessness",
|
|
169
|
+
"give",
|
|
170
|
+
"mercy",
|
|
171
|
+
"duty",
|
|
172
|
+
"principle",
|
|
173
|
+
"courtesy"
|
|
174
|
+
];
|
|
175
|
+
var QUIET_MEASURE_CONFIDENCE_BANDS = ["low", "medium", "high"];
|
|
176
|
+
var QUIET_MEASURE_SIGNAL_BANDS = [
|
|
177
|
+
"suppressed",
|
|
178
|
+
"latent",
|
|
179
|
+
"present",
|
|
180
|
+
"dominant"
|
|
181
|
+
];
|
|
182
|
+
var QUIET_MEASURE_PERSPECTIVES = [
|
|
183
|
+
"system-truth",
|
|
184
|
+
"observed-reputation"
|
|
185
|
+
];
|
|
186
|
+
var QUIET_MEASURE_EVIDENCE_CLASSES = [
|
|
187
|
+
"declared-intent",
|
|
188
|
+
"costly-choice",
|
|
189
|
+
"private-conduct",
|
|
190
|
+
"repair-after-harm",
|
|
191
|
+
"weak-party-treatment",
|
|
192
|
+
"observed-pattern",
|
|
193
|
+
"social-mask"
|
|
194
|
+
];
|
|
195
|
+
var QUIET_MEASURE_DERIVED_READS = [
|
|
196
|
+
"nature",
|
|
197
|
+
"mask",
|
|
198
|
+
"veil-gap",
|
|
199
|
+
"restitution"
|
|
200
|
+
];
|
|
201
|
+
var QUIET_MEASURE_MISSION_PROBE_MODES = [
|
|
202
|
+
"clarify",
|
|
203
|
+
"tempt",
|
|
204
|
+
"reinforce"
|
|
205
|
+
];
|
|
206
|
+
var QUIET_MEASURE_MISSION_RESOLUTION_SHAPES = [
|
|
207
|
+
"restorative",
|
|
208
|
+
"dominant",
|
|
209
|
+
"detached",
|
|
210
|
+
"performative"
|
|
211
|
+
];
|
|
212
|
+
var QUIET_MEASURE_JUDGMENT_DISCLOSURES = [
|
|
213
|
+
"title-and-verdict-only"
|
|
214
|
+
];
|
|
215
|
+
var QUIET_MEASURE_JUDGMENT_REQUESTERS = [
|
|
216
|
+
"player",
|
|
217
|
+
"system",
|
|
218
|
+
"operator"
|
|
219
|
+
];
|
|
220
|
+
var QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [
|
|
221
|
+
"repeated-meaningful-evidence",
|
|
222
|
+
"private-or-low-witness-evidence",
|
|
223
|
+
"costly-pressure-event"
|
|
224
|
+
];
|
|
225
|
+
function isMember(value, members) {
|
|
226
|
+
return members.includes(value);
|
|
227
|
+
}
|
|
228
|
+
function assertRecord(value, label) {
|
|
229
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
230
|
+
throw new TypeError(`${label} must be an object.`);
|
|
231
|
+
}
|
|
232
|
+
return value;
|
|
233
|
+
}
|
|
234
|
+
function normalizeNonEmptyString(value, label) {
|
|
235
|
+
if (typeof value !== "string") {
|
|
236
|
+
throw new TypeError(`${label} must be a non-empty string.`);
|
|
237
|
+
}
|
|
238
|
+
const normalized = value.trim();
|
|
239
|
+
if (normalized.length === 0) {
|
|
240
|
+
throw new TypeError(`${label} must be a non-empty string.`);
|
|
241
|
+
}
|
|
242
|
+
return normalized;
|
|
243
|
+
}
|
|
244
|
+
function normalizeBoolean(value, label) {
|
|
245
|
+
if (typeof value !== "boolean") {
|
|
246
|
+
throw new TypeError(`${label} must be a boolean.`);
|
|
247
|
+
}
|
|
248
|
+
return value;
|
|
249
|
+
}
|
|
250
|
+
function normalizeOptionalBoolean(value, fallback, label) {
|
|
251
|
+
if (value === void 0) {
|
|
252
|
+
return fallback;
|
|
253
|
+
}
|
|
254
|
+
return normalizeBoolean(value, label);
|
|
255
|
+
}
|
|
256
|
+
function normalizeTimestamp(value, label) {
|
|
257
|
+
const normalized = normalizeNonEmptyString(value, label);
|
|
258
|
+
const parsed = Date.parse(normalized);
|
|
259
|
+
if (Number.isNaN(parsed)) {
|
|
260
|
+
throw new TypeError(`${label} must be a valid ISO-8601 timestamp.`);
|
|
261
|
+
}
|
|
262
|
+
return normalized;
|
|
263
|
+
}
|
|
264
|
+
function normalizeMember(value, members, label) {
|
|
265
|
+
const normalized = normalizeNonEmptyString(value, label);
|
|
266
|
+
if (!isMember(normalized, members)) {
|
|
267
|
+
throw new TypeError(`${label} must be one of: ${members.join(", ")}.`);
|
|
268
|
+
}
|
|
269
|
+
return normalized;
|
|
270
|
+
}
|
|
271
|
+
function normalizeReasonCodes(value, label) {
|
|
272
|
+
if (value === void 0) {
|
|
273
|
+
return Object.freeze([]);
|
|
274
|
+
}
|
|
275
|
+
if (!Array.isArray(value)) {
|
|
276
|
+
throw new TypeError(`${label} must be an array of strings.`);
|
|
277
|
+
}
|
|
278
|
+
for (const [index, entry] of value.entries()) {
|
|
279
|
+
if (typeof entry !== "string") {
|
|
280
|
+
throw new TypeError(`${label}[${index}] must be a string.`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const normalized = value.map((entry) => entry.trim());
|
|
284
|
+
if (normalized.some((entry) => entry.length === 0)) {
|
|
285
|
+
throw new TypeError(`${label} must not contain blank strings.`);
|
|
286
|
+
}
|
|
287
|
+
return Object.freeze(Array.from(new Set(normalized)));
|
|
288
|
+
}
|
|
289
|
+
function normalizeJudgmentRequest(input) {
|
|
290
|
+
const request = assertRecord(input, "Quiet Measure judgment request");
|
|
291
|
+
return Object.freeze({
|
|
292
|
+
subjectId: normalizeNonEmptyString(
|
|
293
|
+
request.subjectId,
|
|
294
|
+
"Quiet Measure judgment request subjectId"
|
|
295
|
+
),
|
|
296
|
+
requestedAtUtc: normalizeTimestamp(
|
|
297
|
+
request.requestedAtUtc,
|
|
298
|
+
"Quiet Measure judgment request requestedAtUtc"
|
|
299
|
+
),
|
|
300
|
+
requestedBy: normalizeMember(
|
|
301
|
+
request.requestedBy,
|
|
302
|
+
QUIET_MEASURE_JUDGMENT_REQUESTERS,
|
|
303
|
+
"Quiet Measure judgment request requestedBy"
|
|
304
|
+
),
|
|
305
|
+
disclosure: normalizeMember(
|
|
306
|
+
request.disclosure,
|
|
307
|
+
QUIET_MEASURE_JUDGMENT_DISCLOSURES,
|
|
308
|
+
"Quiet Measure judgment request disclosure"
|
|
309
|
+
)
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function normalizeJudgmentEligibility(input) {
|
|
313
|
+
const eligibility = assertRecord(input, "Quiet Measure judgment eligibility");
|
|
314
|
+
const repeatedMeaningfulEvidence = normalizeBoolean(
|
|
315
|
+
eligibility.repeatedMeaningfulEvidence,
|
|
316
|
+
"Quiet Measure judgment eligibility repeatedMeaningfulEvidence"
|
|
317
|
+
);
|
|
318
|
+
const includesPrivateOrLowWitnessEvidence = normalizeBoolean(
|
|
319
|
+
eligibility.includesPrivateOrLowWitnessEvidence,
|
|
320
|
+
"Quiet Measure judgment eligibility includesPrivateOrLowWitnessEvidence"
|
|
321
|
+
);
|
|
322
|
+
const includesCostlyPressureEvent = normalizeBoolean(
|
|
323
|
+
eligibility.includesCostlyPressureEvent,
|
|
324
|
+
"Quiet Measure judgment eligibility includesCostlyPressureEvent"
|
|
325
|
+
);
|
|
326
|
+
return Object.freeze({
|
|
327
|
+
eligible: repeatedMeaningfulEvidence && includesPrivateOrLowWitnessEvidence && includesCostlyPressureEvent,
|
|
328
|
+
repeatedMeaningfulEvidence,
|
|
329
|
+
includesPrivateOrLowWitnessEvidence,
|
|
330
|
+
includesCostlyPressureEvent,
|
|
331
|
+
reasonCodes: normalizeReasonCodes(
|
|
332
|
+
eligibility.reasonCodes,
|
|
333
|
+
"Quiet Measure eligibility reasonCodes"
|
|
334
|
+
)
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
function normalizeTitleDescriptor(input) {
|
|
338
|
+
const title = assertRecord(input, "Quiet Measure title");
|
|
339
|
+
return Object.freeze({
|
|
340
|
+
titleId: normalizeNonEmptyString(title.titleId, "Quiet Measure title titleId"),
|
|
341
|
+
title: normalizeNonEmptyString(title.title, "Quiet Measure title title"),
|
|
342
|
+
verdictLabel: normalizeNonEmptyString(
|
|
343
|
+
title.verdictLabel,
|
|
344
|
+
"Quiet Measure title verdictLabel"
|
|
345
|
+
),
|
|
346
|
+
perspective: normalizeMember(
|
|
347
|
+
title.perspective,
|
|
348
|
+
QUIET_MEASURE_PERSPECTIVES,
|
|
349
|
+
"Quiet Measure title perspective"
|
|
350
|
+
),
|
|
351
|
+
disclosure: normalizeMember(
|
|
352
|
+
title.disclosure,
|
|
353
|
+
QUIET_MEASURE_JUDGMENT_DISCLOSURES,
|
|
354
|
+
"Quiet Measure title disclosure"
|
|
355
|
+
),
|
|
356
|
+
reasonCodes: normalizeReasonCodes(title.reasonCodes, "Quiet Measure title reasonCodes")
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function normalizeDerivedReadSummary(input, index) {
|
|
360
|
+
const prefix = `Quiet Measure dominantReads[${index}]`;
|
|
361
|
+
const dominantRead = assertRecord(input, prefix);
|
|
362
|
+
return Object.freeze({
|
|
363
|
+
read: normalizeMember(
|
|
364
|
+
dominantRead.read,
|
|
365
|
+
QUIET_MEASURE_DERIVED_READS,
|
|
366
|
+
`${prefix} read`
|
|
367
|
+
),
|
|
368
|
+
perspective: normalizeMember(
|
|
369
|
+
dominantRead.perspective,
|
|
370
|
+
QUIET_MEASURE_PERSPECTIVES,
|
|
371
|
+
`${prefix} perspective`
|
|
372
|
+
),
|
|
373
|
+
signalBand: normalizeMember(
|
|
374
|
+
dominantRead.signalBand,
|
|
375
|
+
QUIET_MEASURE_SIGNAL_BANDS,
|
|
376
|
+
`${prefix} signalBand`
|
|
377
|
+
),
|
|
378
|
+
confidenceBand: normalizeMember(
|
|
379
|
+
dominantRead.confidenceBand,
|
|
380
|
+
QUIET_MEASURE_CONFIDENCE_BANDS,
|
|
381
|
+
`${prefix} confidenceBand`
|
|
382
|
+
),
|
|
383
|
+
reasonCodes: normalizeReasonCodes(
|
|
384
|
+
dominantRead.reasonCodes,
|
|
385
|
+
`${prefix} reasonCodes`
|
|
386
|
+
)
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
function normalizeDominantReads(value) {
|
|
390
|
+
if (value === void 0) {
|
|
391
|
+
return Object.freeze([]);
|
|
392
|
+
}
|
|
393
|
+
if (!Array.isArray(value)) {
|
|
394
|
+
throw new TypeError("Quiet Measure dominantReads must be an array.");
|
|
395
|
+
}
|
|
396
|
+
return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));
|
|
397
|
+
}
|
|
398
|
+
function isQuietMeasureAxis(value) {
|
|
399
|
+
return isMember(value, QUIET_MEASURE_AXES);
|
|
400
|
+
}
|
|
401
|
+
function isQuietMeasureMissionProbeMode(value) {
|
|
402
|
+
return isMember(value, QUIET_MEASURE_MISSION_PROBE_MODES);
|
|
403
|
+
}
|
|
404
|
+
function isQuietMeasureMissionResolutionShape(value) {
|
|
405
|
+
return isMember(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
|
|
406
|
+
}
|
|
407
|
+
function createQuietMeasureJudgmentEligibility(input = {}) {
|
|
408
|
+
const repeatedMeaningfulEvidence = normalizeOptionalBoolean(
|
|
409
|
+
input.repeatedMeaningfulEvidence,
|
|
410
|
+
false,
|
|
411
|
+
"Quiet Measure eligibility repeatedMeaningfulEvidence"
|
|
412
|
+
);
|
|
413
|
+
const includesPrivateOrLowWitnessEvidence = normalizeOptionalBoolean(
|
|
414
|
+
input.includesPrivateOrLowWitnessEvidence,
|
|
415
|
+
false,
|
|
416
|
+
"Quiet Measure eligibility includesPrivateOrLowWitnessEvidence"
|
|
417
|
+
);
|
|
418
|
+
const includesCostlyPressureEvent = normalizeOptionalBoolean(
|
|
419
|
+
input.includesCostlyPressureEvent,
|
|
420
|
+
false,
|
|
421
|
+
"Quiet Measure eligibility includesCostlyPressureEvent"
|
|
422
|
+
);
|
|
423
|
+
return Object.freeze({
|
|
424
|
+
eligible: repeatedMeaningfulEvidence && includesPrivateOrLowWitnessEvidence && includesCostlyPressureEvent,
|
|
425
|
+
repeatedMeaningfulEvidence,
|
|
426
|
+
includesPrivateOrLowWitnessEvidence,
|
|
427
|
+
includesCostlyPressureEvent,
|
|
428
|
+
reasonCodes: normalizeReasonCodes(input.reasonCodes, "Quiet Measure eligibility reasonCodes")
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
function listQuietMeasureMissingEvidence(eligibility) {
|
|
432
|
+
const normalizedEligibility = normalizeJudgmentEligibility(eligibility);
|
|
433
|
+
const missing = [];
|
|
434
|
+
if (!normalizedEligibility.repeatedMeaningfulEvidence) {
|
|
435
|
+
missing.push("repeated-meaningful-evidence");
|
|
436
|
+
}
|
|
437
|
+
if (!normalizedEligibility.includesPrivateOrLowWitnessEvidence) {
|
|
438
|
+
missing.push("private-or-low-witness-evidence");
|
|
439
|
+
}
|
|
440
|
+
if (!normalizedEligibility.includesCostlyPressureEvent) {
|
|
441
|
+
missing.push("costly-pressure-event");
|
|
442
|
+
}
|
|
443
|
+
return Object.freeze(missing);
|
|
444
|
+
}
|
|
445
|
+
function createQuietMeasureJudgmentResponse(input) {
|
|
446
|
+
const request = normalizeJudgmentRequest(input.request);
|
|
447
|
+
const eligibility = normalizeJudgmentEligibility(input.eligibility);
|
|
448
|
+
const missingEvidence = listQuietMeasureMissingEvidence(eligibility);
|
|
449
|
+
const reasonCodes = normalizeReasonCodes(
|
|
450
|
+
input.reasonCodes,
|
|
451
|
+
"Quiet Measure judgment response reasonCodes"
|
|
452
|
+
);
|
|
453
|
+
const hasRequiredEvidence = missingEvidence.length === 0;
|
|
454
|
+
if (!hasRequiredEvidence) {
|
|
455
|
+
return Object.freeze({
|
|
456
|
+
kind: "insufficient-evidence",
|
|
457
|
+
request,
|
|
458
|
+
eligibility: Object.freeze({
|
|
459
|
+
...eligibility,
|
|
460
|
+
eligible: false
|
|
461
|
+
}),
|
|
462
|
+
missingEvidence,
|
|
463
|
+
reasonCodes
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
if (!input.title) {
|
|
467
|
+
throw new TypeError(
|
|
468
|
+
"Quiet Measure verdict responses require a title descriptor when eligibility is met."
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
return Object.freeze({
|
|
472
|
+
kind: "verdict",
|
|
473
|
+
request,
|
|
474
|
+
eligibility: Object.freeze({
|
|
475
|
+
...eligibility,
|
|
476
|
+
eligible: true
|
|
477
|
+
}),
|
|
478
|
+
title: normalizeTitleDescriptor(input.title),
|
|
479
|
+
dominantReads: normalizeDominantReads(input.dominantReads),
|
|
480
|
+
reasonCodes
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
|
|
328
484
|
// src/index.ts
|
|
329
485
|
var AI_GAME_PACKAGE = "@plasius/ai-game";
|
|
330
486
|
var AI_GAME_ENV_PREFIX = "AI_GAME";
|
|
@@ -732,8 +888,7 @@ var aiGameFeatureFlags = Object.freeze({
|
|
|
732
888
|
incident: AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
|
|
733
889
|
gossipTopics: AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID,
|
|
734
890
|
gossipPerspective: AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
|
|
735
|
-
gossipLifecycle: AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID
|
|
736
|
-
pointsStore: AI_GAME_POINTS_STORE_FEATURE_FLAG_ID
|
|
891
|
+
gossipLifecycle: AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID
|
|
737
892
|
});
|
|
738
893
|
var gameEventFeatureFlags = Object.freeze([
|
|
739
894
|
aiGameFeatureFlags.contract,
|
|
@@ -741,8 +896,7 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
741
896
|
aiGameFeatureFlags.incident,
|
|
742
897
|
aiGameFeatureFlags.gossipTopics,
|
|
743
898
|
aiGameFeatureFlags.gossipPerspective,
|
|
744
|
-
aiGameFeatureFlags.gossipLifecycle
|
|
745
|
-
aiGameFeatureFlags.pointsStore
|
|
899
|
+
aiGameFeatureFlags.gossipLifecycle
|
|
746
900
|
]);
|
|
747
901
|
// Annotate the CommonJS export names for ESM import in node:
|
|
748
902
|
0 && (module.exports = {
|
|
@@ -757,36 +911,42 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
757
911
|
AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
|
|
758
912
|
AI_GAME_PACKAGE,
|
|
759
913
|
AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
|
|
760
|
-
|
|
761
|
-
AI_GAME_POINTS_AUTHORITY_BANDS,
|
|
762
|
-
AI_GAME_POINTS_AUTHORITY_SYSTEMS,
|
|
763
|
-
AI_GAME_POINTS_LEDGER_IDS,
|
|
764
|
-
AI_GAME_POINTS_STORE_FEATURE_FLAG_ID,
|
|
914
|
+
AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID,
|
|
765
915
|
AI_GAME_TASK_AUTHORITY_BOUNDARIES,
|
|
766
916
|
AI_GAME_TASK_DECISIONS,
|
|
767
917
|
AI_GAME_TASK_KINDS,
|
|
768
918
|
AI_GAME_TASK_RESULTS,
|
|
769
919
|
AI_GAME_TASK_RISK_CLASSES,
|
|
770
920
|
AI_GAME_TTS_CACHE_POLICIES,
|
|
921
|
+
QUIET_MEASURE_AXES,
|
|
922
|
+
QUIET_MEASURE_CONFIDENCE_BANDS,
|
|
923
|
+
QUIET_MEASURE_DERIVED_READS,
|
|
924
|
+
QUIET_MEASURE_EVIDENCE_CLASSES,
|
|
925
|
+
QUIET_MEASURE_JUDGMENT_DISCLOSURES,
|
|
926
|
+
QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE,
|
|
927
|
+
QUIET_MEASURE_JUDGMENT_REQUESTERS,
|
|
928
|
+
QUIET_MEASURE_MISSION_PROBE_MODES,
|
|
929
|
+
QUIET_MEASURE_MISSION_RESOLUTION_SHAPES,
|
|
930
|
+
QUIET_MEASURE_PERSPECTIVES,
|
|
931
|
+
QUIET_MEASURE_SIGNAL_BANDS,
|
|
771
932
|
aiGameFeatureFlags,
|
|
772
933
|
classifyAiGameTask,
|
|
773
|
-
|
|
774
|
-
|
|
934
|
+
createQuietMeasureJudgmentEligibility,
|
|
935
|
+
createQuietMeasureJudgmentResponse,
|
|
775
936
|
gameEventFeatureFlags,
|
|
776
|
-
getAiGameProtoSocialDevolutionPolicy,
|
|
777
|
-
getDefaultAiGamePointsSpendPolicies,
|
|
778
|
-
isAiGamePlayerEvolutionStage,
|
|
779
|
-
isAiGamePointsLedgerId,
|
|
780
937
|
isCandidateWorldEvent,
|
|
781
938
|
isCanonicalWorldEvent,
|
|
782
939
|
isGossipTopicActive,
|
|
783
940
|
isGossipTopicCorrected,
|
|
784
941
|
isIncidentResolved,
|
|
942
|
+
isQuietMeasureAxis,
|
|
943
|
+
isQuietMeasureMissionProbeMode,
|
|
944
|
+
isQuietMeasureMissionResolutionShape,
|
|
945
|
+
listQuietMeasureMissingEvidence,
|
|
785
946
|
normalizeIncidentImpactVector,
|
|
786
947
|
packageDescriptor,
|
|
787
948
|
projectTopicForAudience,
|
|
788
949
|
resolveAiGamePlayerAddressText,
|
|
789
|
-
resolveAiGamePointsAuthorityBoundary,
|
|
790
950
|
resolveAiGameTaskBatch
|
|
791
951
|
});
|
|
792
952
|
//# sourceMappingURL=index.cjs.map
|