@plasius/ai-game 0.1.6 → 0.1.7
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 +6 -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.js
CHANGED
|
@@ -1,172 +1,3 @@
|
|
|
1
|
-
// src/points-store.ts
|
|
2
|
-
var AI_GAME_POINTS_STORE_FEATURE_FLAG_ID = "isekai.player-system.points-store.enabled";
|
|
3
|
-
var AI_GAME_POINTS_LEDGER_IDS = ["pp", "esp", "tis", "dis"];
|
|
4
|
-
var AI_GAME_PLAYER_EVOLUTION_STAGES = ["proto-social", "social-lock"];
|
|
5
|
-
var AI_GAME_POINTS_AUTHORITY_BANDS = [
|
|
6
|
-
"self",
|
|
7
|
-
"frontier",
|
|
8
|
-
"civic",
|
|
9
|
-
"divine"
|
|
10
|
-
];
|
|
11
|
-
var AI_GAME_POINTS_AUTHORITY_SYSTEMS = [
|
|
12
|
-
"player-system",
|
|
13
|
-
"exploration-system",
|
|
14
|
-
"territorial-influence-system",
|
|
15
|
-
"divine-influence-system"
|
|
16
|
-
];
|
|
17
|
-
var AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER = Object.freeze({
|
|
18
|
-
pp: Object.freeze({
|
|
19
|
-
ledgerId: "pp",
|
|
20
|
-
authorityBand: "self",
|
|
21
|
-
authoritySystem: "player-system",
|
|
22
|
-
requiresWorldAuthority: false,
|
|
23
|
-
combatSafeOnly: false
|
|
24
|
-
}),
|
|
25
|
-
esp: Object.freeze({
|
|
26
|
-
ledgerId: "esp",
|
|
27
|
-
authorityBand: "frontier",
|
|
28
|
-
authoritySystem: "exploration-system",
|
|
29
|
-
requiresWorldAuthority: false,
|
|
30
|
-
combatSafeOnly: true
|
|
31
|
-
}),
|
|
32
|
-
tis: Object.freeze({
|
|
33
|
-
ledgerId: "tis",
|
|
34
|
-
authorityBand: "civic",
|
|
35
|
-
authoritySystem: "territorial-influence-system",
|
|
36
|
-
requiresWorldAuthority: true,
|
|
37
|
-
combatSafeOnly: false
|
|
38
|
-
}),
|
|
39
|
-
dis: Object.freeze({
|
|
40
|
-
ledgerId: "dis",
|
|
41
|
-
authorityBand: "divine",
|
|
42
|
-
authoritySystem: "divine-influence-system",
|
|
43
|
-
requiresWorldAuthority: true,
|
|
44
|
-
combatSafeOnly: false
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
var AI_GAME_DEFAULT_POINTS_SPEND_POLICIES = Object.freeze([
|
|
48
|
-
Object.freeze({
|
|
49
|
-
policyId: "pp-personal-respec",
|
|
50
|
-
ledgerId: "pp",
|
|
51
|
-
authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.pp,
|
|
52
|
-
actions: Object.freeze([
|
|
53
|
-
Object.freeze({
|
|
54
|
-
actionId: "return-to-slime",
|
|
55
|
-
title: "Return to slime",
|
|
56
|
-
cost: 12,
|
|
57
|
-
prerequisiteCodes: Object.freeze(["proto-social-window-open", "single-use-remaining"]),
|
|
58
|
-
consequenceCodes: Object.freeze(["reset-social-form", "consume-pp-balance"])
|
|
59
|
-
})
|
|
60
|
-
])
|
|
61
|
-
}),
|
|
62
|
-
Object.freeze({
|
|
63
|
-
policyId: "esp-exploration-routing",
|
|
64
|
-
ledgerId: "esp",
|
|
65
|
-
authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.esp,
|
|
66
|
-
actions: Object.freeze([
|
|
67
|
-
Object.freeze({
|
|
68
|
-
actionId: "fast-travel-upgrade",
|
|
69
|
-
title: "Unlock frontier fast travel",
|
|
70
|
-
cost: 8,
|
|
71
|
-
prerequisiteCodes: Object.freeze(["frontier-route-discovered", "out-of-combat-only"]),
|
|
72
|
-
consequenceCodes: Object.freeze(["reduce-route-friction"])
|
|
73
|
-
})
|
|
74
|
-
])
|
|
75
|
-
}),
|
|
76
|
-
Object.freeze({
|
|
77
|
-
policyId: "tis-civic-investment",
|
|
78
|
-
ledgerId: "tis",
|
|
79
|
-
authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.tis,
|
|
80
|
-
actions: Object.freeze([
|
|
81
|
-
Object.freeze({
|
|
82
|
-
actionId: "district-favor",
|
|
83
|
-
title: "Commit district influence favor",
|
|
84
|
-
cost: 5,
|
|
85
|
-
prerequisiteCodes: Object.freeze(["civic-authority-approval"]),
|
|
86
|
-
consequenceCodes: Object.freeze(["alter-territorial-standing"])
|
|
87
|
-
})
|
|
88
|
-
])
|
|
89
|
-
}),
|
|
90
|
-
Object.freeze({
|
|
91
|
-
policyId: "dis-divine-covenant",
|
|
92
|
-
ledgerId: "dis",
|
|
93
|
-
authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.dis,
|
|
94
|
-
actions: Object.freeze([
|
|
95
|
-
Object.freeze({
|
|
96
|
-
actionId: "divine-oath",
|
|
97
|
-
title: "Bind a divine covenant",
|
|
98
|
-
cost: 3,
|
|
99
|
-
prerequisiteCodes: Object.freeze(["divine-clearance-granted"]),
|
|
100
|
-
consequenceCodes: Object.freeze(["alter-divine-standing"])
|
|
101
|
-
})
|
|
102
|
-
])
|
|
103
|
-
})
|
|
104
|
-
]);
|
|
105
|
-
var AI_GAME_PROTO_SOCIAL_DEVOLUTION_POLICY = Object.freeze({
|
|
106
|
-
actionId: "return-to-slime",
|
|
107
|
-
ledgerId: "pp",
|
|
108
|
-
cost: 12,
|
|
109
|
-
requiredEvolutionStage: "proto-social",
|
|
110
|
-
closesAtEvolutionStage: "social-lock",
|
|
111
|
-
singleUse: true,
|
|
112
|
-
authorityBoundary: AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER.pp,
|
|
113
|
-
prerequisiteCodes: Object.freeze(["proto-social-window-open", "single-use-remaining"]),
|
|
114
|
-
consequenceCodes: Object.freeze(["reset-social-form", "consume-pp-balance"])
|
|
115
|
-
});
|
|
116
|
-
function normalizeNonNegativeInteger(value) {
|
|
117
|
-
if (!Number.isFinite(value)) {
|
|
118
|
-
return 0;
|
|
119
|
-
}
|
|
120
|
-
return Math.max(0, Math.trunc(value));
|
|
121
|
-
}
|
|
122
|
-
function isAiGamePointsLedgerId(value) {
|
|
123
|
-
return AI_GAME_POINTS_LEDGER_IDS.includes(value);
|
|
124
|
-
}
|
|
125
|
-
function isAiGamePlayerEvolutionStage(value) {
|
|
126
|
-
return AI_GAME_PLAYER_EVOLUTION_STAGES.includes(value);
|
|
127
|
-
}
|
|
128
|
-
function resolveAiGamePointsAuthorityBoundary(ledgerId) {
|
|
129
|
-
return AI_GAME_POINTS_AUTHORITY_BOUNDARY_BY_LEDGER[ledgerId];
|
|
130
|
-
}
|
|
131
|
-
function createAiGamePointsLedgerSnapshot(input) {
|
|
132
|
-
return Object.freeze({
|
|
133
|
-
ledgerId: input.ledgerId,
|
|
134
|
-
balance: normalizeNonNegativeInteger(input.balance),
|
|
135
|
-
earnedTotal: normalizeNonNegativeInteger(input.earnedTotal),
|
|
136
|
-
spentTotal: normalizeNonNegativeInteger(input.spentTotal),
|
|
137
|
-
committedTotal: normalizeNonNegativeInteger(input.committedTotal),
|
|
138
|
-
asOfEpochMs: input.asOfEpochMs
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
function getDefaultAiGamePointsSpendPolicies() {
|
|
142
|
-
return AI_GAME_DEFAULT_POINTS_SPEND_POLICIES;
|
|
143
|
-
}
|
|
144
|
-
function getAiGameProtoSocialDevolutionPolicy() {
|
|
145
|
-
return AI_GAME_PROTO_SOCIAL_DEVOLUTION_POLICY;
|
|
146
|
-
}
|
|
147
|
-
function evaluateAiGameProtoSocialDevolutionEligibility(input) {
|
|
148
|
-
const reasonCodes = [];
|
|
149
|
-
const policy = AI_GAME_PROTO_SOCIAL_DEVOLUTION_POLICY;
|
|
150
|
-
const currentBalance = normalizeNonNegativeInteger(input.currentBalance);
|
|
151
|
-
if (input.evolutionStage !== policy.requiredEvolutionStage) {
|
|
152
|
-
reasonCodes.push("devolution-window-closed");
|
|
153
|
-
}
|
|
154
|
-
if (input.alreadyUsed) {
|
|
155
|
-
reasonCodes.push("devolution-already-used");
|
|
156
|
-
}
|
|
157
|
-
if (currentBalance < policy.cost) {
|
|
158
|
-
reasonCodes.push("insufficient-pp-balance");
|
|
159
|
-
}
|
|
160
|
-
if (reasonCodes.length === 0) {
|
|
161
|
-
reasonCodes.push("devolution-allowed");
|
|
162
|
-
}
|
|
163
|
-
return Object.freeze({
|
|
164
|
-
available: reasonCodes.length === 1 && reasonCodes[0] === "devolution-allowed",
|
|
165
|
-
reasonCodes: Object.freeze(reasonCodes),
|
|
166
|
-
policy
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
1
|
// src/world-events.ts
|
|
171
2
|
function isCanonicalWorldEvent(event) {
|
|
172
3
|
return event.recordType === "canonical";
|
|
@@ -258,6 +89,325 @@ function projectTopicForAudience(topic, projection, nowEpochMs = Date.now()) {
|
|
|
258
89
|
};
|
|
259
90
|
}
|
|
260
91
|
|
|
92
|
+
// src/quiet-measure.ts
|
|
93
|
+
var AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID = "isekai.player-system.quiet-measure.enabled";
|
|
94
|
+
var QUIET_MEASURE_AXES = [
|
|
95
|
+
"selflessness",
|
|
96
|
+
"give",
|
|
97
|
+
"mercy",
|
|
98
|
+
"duty",
|
|
99
|
+
"principle",
|
|
100
|
+
"courtesy"
|
|
101
|
+
];
|
|
102
|
+
var QUIET_MEASURE_CONFIDENCE_BANDS = ["low", "medium", "high"];
|
|
103
|
+
var QUIET_MEASURE_SIGNAL_BANDS = [
|
|
104
|
+
"suppressed",
|
|
105
|
+
"latent",
|
|
106
|
+
"present",
|
|
107
|
+
"dominant"
|
|
108
|
+
];
|
|
109
|
+
var QUIET_MEASURE_PERSPECTIVES = [
|
|
110
|
+
"system-truth",
|
|
111
|
+
"observed-reputation"
|
|
112
|
+
];
|
|
113
|
+
var QUIET_MEASURE_EVIDENCE_CLASSES = [
|
|
114
|
+
"declared-intent",
|
|
115
|
+
"costly-choice",
|
|
116
|
+
"private-conduct",
|
|
117
|
+
"repair-after-harm",
|
|
118
|
+
"weak-party-treatment",
|
|
119
|
+
"observed-pattern",
|
|
120
|
+
"social-mask"
|
|
121
|
+
];
|
|
122
|
+
var QUIET_MEASURE_DERIVED_READS = [
|
|
123
|
+
"nature",
|
|
124
|
+
"mask",
|
|
125
|
+
"veil-gap",
|
|
126
|
+
"restitution"
|
|
127
|
+
];
|
|
128
|
+
var QUIET_MEASURE_MISSION_PROBE_MODES = [
|
|
129
|
+
"clarify",
|
|
130
|
+
"tempt",
|
|
131
|
+
"reinforce"
|
|
132
|
+
];
|
|
133
|
+
var QUIET_MEASURE_MISSION_RESOLUTION_SHAPES = [
|
|
134
|
+
"restorative",
|
|
135
|
+
"dominant",
|
|
136
|
+
"detached",
|
|
137
|
+
"performative"
|
|
138
|
+
];
|
|
139
|
+
var QUIET_MEASURE_JUDGMENT_DISCLOSURES = [
|
|
140
|
+
"title-and-verdict-only"
|
|
141
|
+
];
|
|
142
|
+
var QUIET_MEASURE_JUDGMENT_REQUESTERS = [
|
|
143
|
+
"player",
|
|
144
|
+
"system",
|
|
145
|
+
"operator"
|
|
146
|
+
];
|
|
147
|
+
var QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE = [
|
|
148
|
+
"repeated-meaningful-evidence",
|
|
149
|
+
"private-or-low-witness-evidence",
|
|
150
|
+
"costly-pressure-event"
|
|
151
|
+
];
|
|
152
|
+
function isMember(value, members) {
|
|
153
|
+
return members.includes(value);
|
|
154
|
+
}
|
|
155
|
+
function assertRecord(value, label) {
|
|
156
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
157
|
+
throw new TypeError(`${label} must be an object.`);
|
|
158
|
+
}
|
|
159
|
+
return value;
|
|
160
|
+
}
|
|
161
|
+
function normalizeNonEmptyString(value, label) {
|
|
162
|
+
if (typeof value !== "string") {
|
|
163
|
+
throw new TypeError(`${label} must be a non-empty string.`);
|
|
164
|
+
}
|
|
165
|
+
const normalized = value.trim();
|
|
166
|
+
if (normalized.length === 0) {
|
|
167
|
+
throw new TypeError(`${label} must be a non-empty string.`);
|
|
168
|
+
}
|
|
169
|
+
return normalized;
|
|
170
|
+
}
|
|
171
|
+
function normalizeBoolean(value, label) {
|
|
172
|
+
if (typeof value !== "boolean") {
|
|
173
|
+
throw new TypeError(`${label} must be a boolean.`);
|
|
174
|
+
}
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
177
|
+
function normalizeOptionalBoolean(value, fallback, label) {
|
|
178
|
+
if (value === void 0) {
|
|
179
|
+
return fallback;
|
|
180
|
+
}
|
|
181
|
+
return normalizeBoolean(value, label);
|
|
182
|
+
}
|
|
183
|
+
function normalizeTimestamp(value, label) {
|
|
184
|
+
const normalized = normalizeNonEmptyString(value, label);
|
|
185
|
+
const parsed = Date.parse(normalized);
|
|
186
|
+
if (Number.isNaN(parsed)) {
|
|
187
|
+
throw new TypeError(`${label} must be a valid ISO-8601 timestamp.`);
|
|
188
|
+
}
|
|
189
|
+
return normalized;
|
|
190
|
+
}
|
|
191
|
+
function normalizeMember(value, members, label) {
|
|
192
|
+
const normalized = normalizeNonEmptyString(value, label);
|
|
193
|
+
if (!isMember(normalized, members)) {
|
|
194
|
+
throw new TypeError(`${label} must be one of: ${members.join(", ")}.`);
|
|
195
|
+
}
|
|
196
|
+
return normalized;
|
|
197
|
+
}
|
|
198
|
+
function normalizeReasonCodes(value, label) {
|
|
199
|
+
if (value === void 0) {
|
|
200
|
+
return Object.freeze([]);
|
|
201
|
+
}
|
|
202
|
+
if (!Array.isArray(value)) {
|
|
203
|
+
throw new TypeError(`${label} must be an array of strings.`);
|
|
204
|
+
}
|
|
205
|
+
for (const [index, entry] of value.entries()) {
|
|
206
|
+
if (typeof entry !== "string") {
|
|
207
|
+
throw new TypeError(`${label}[${index}] must be a string.`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const normalized = value.map((entry) => entry.trim());
|
|
211
|
+
if (normalized.some((entry) => entry.length === 0)) {
|
|
212
|
+
throw new TypeError(`${label} must not contain blank strings.`);
|
|
213
|
+
}
|
|
214
|
+
return Object.freeze(Array.from(new Set(normalized)));
|
|
215
|
+
}
|
|
216
|
+
function normalizeJudgmentRequest(input) {
|
|
217
|
+
const request = assertRecord(input, "Quiet Measure judgment request");
|
|
218
|
+
return Object.freeze({
|
|
219
|
+
subjectId: normalizeNonEmptyString(
|
|
220
|
+
request.subjectId,
|
|
221
|
+
"Quiet Measure judgment request subjectId"
|
|
222
|
+
),
|
|
223
|
+
requestedAtUtc: normalizeTimestamp(
|
|
224
|
+
request.requestedAtUtc,
|
|
225
|
+
"Quiet Measure judgment request requestedAtUtc"
|
|
226
|
+
),
|
|
227
|
+
requestedBy: normalizeMember(
|
|
228
|
+
request.requestedBy,
|
|
229
|
+
QUIET_MEASURE_JUDGMENT_REQUESTERS,
|
|
230
|
+
"Quiet Measure judgment request requestedBy"
|
|
231
|
+
),
|
|
232
|
+
disclosure: normalizeMember(
|
|
233
|
+
request.disclosure,
|
|
234
|
+
QUIET_MEASURE_JUDGMENT_DISCLOSURES,
|
|
235
|
+
"Quiet Measure judgment request disclosure"
|
|
236
|
+
)
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function normalizeJudgmentEligibility(input) {
|
|
240
|
+
const eligibility = assertRecord(input, "Quiet Measure judgment eligibility");
|
|
241
|
+
const repeatedMeaningfulEvidence = normalizeBoolean(
|
|
242
|
+
eligibility.repeatedMeaningfulEvidence,
|
|
243
|
+
"Quiet Measure judgment eligibility repeatedMeaningfulEvidence"
|
|
244
|
+
);
|
|
245
|
+
const includesPrivateOrLowWitnessEvidence = normalizeBoolean(
|
|
246
|
+
eligibility.includesPrivateOrLowWitnessEvidence,
|
|
247
|
+
"Quiet Measure judgment eligibility includesPrivateOrLowWitnessEvidence"
|
|
248
|
+
);
|
|
249
|
+
const includesCostlyPressureEvent = normalizeBoolean(
|
|
250
|
+
eligibility.includesCostlyPressureEvent,
|
|
251
|
+
"Quiet Measure judgment eligibility includesCostlyPressureEvent"
|
|
252
|
+
);
|
|
253
|
+
return Object.freeze({
|
|
254
|
+
eligible: repeatedMeaningfulEvidence && includesPrivateOrLowWitnessEvidence && includesCostlyPressureEvent,
|
|
255
|
+
repeatedMeaningfulEvidence,
|
|
256
|
+
includesPrivateOrLowWitnessEvidence,
|
|
257
|
+
includesCostlyPressureEvent,
|
|
258
|
+
reasonCodes: normalizeReasonCodes(
|
|
259
|
+
eligibility.reasonCodes,
|
|
260
|
+
"Quiet Measure eligibility reasonCodes"
|
|
261
|
+
)
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function normalizeTitleDescriptor(input) {
|
|
265
|
+
const title = assertRecord(input, "Quiet Measure title");
|
|
266
|
+
return Object.freeze({
|
|
267
|
+
titleId: normalizeNonEmptyString(title.titleId, "Quiet Measure title titleId"),
|
|
268
|
+
title: normalizeNonEmptyString(title.title, "Quiet Measure title title"),
|
|
269
|
+
verdictLabel: normalizeNonEmptyString(
|
|
270
|
+
title.verdictLabel,
|
|
271
|
+
"Quiet Measure title verdictLabel"
|
|
272
|
+
),
|
|
273
|
+
perspective: normalizeMember(
|
|
274
|
+
title.perspective,
|
|
275
|
+
QUIET_MEASURE_PERSPECTIVES,
|
|
276
|
+
"Quiet Measure title perspective"
|
|
277
|
+
),
|
|
278
|
+
disclosure: normalizeMember(
|
|
279
|
+
title.disclosure,
|
|
280
|
+
QUIET_MEASURE_JUDGMENT_DISCLOSURES,
|
|
281
|
+
"Quiet Measure title disclosure"
|
|
282
|
+
),
|
|
283
|
+
reasonCodes: normalizeReasonCodes(title.reasonCodes, "Quiet Measure title reasonCodes")
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function normalizeDerivedReadSummary(input, index) {
|
|
287
|
+
const prefix = `Quiet Measure dominantReads[${index}]`;
|
|
288
|
+
const dominantRead = assertRecord(input, prefix);
|
|
289
|
+
return Object.freeze({
|
|
290
|
+
read: normalizeMember(
|
|
291
|
+
dominantRead.read,
|
|
292
|
+
QUIET_MEASURE_DERIVED_READS,
|
|
293
|
+
`${prefix} read`
|
|
294
|
+
),
|
|
295
|
+
perspective: normalizeMember(
|
|
296
|
+
dominantRead.perspective,
|
|
297
|
+
QUIET_MEASURE_PERSPECTIVES,
|
|
298
|
+
`${prefix} perspective`
|
|
299
|
+
),
|
|
300
|
+
signalBand: normalizeMember(
|
|
301
|
+
dominantRead.signalBand,
|
|
302
|
+
QUIET_MEASURE_SIGNAL_BANDS,
|
|
303
|
+
`${prefix} signalBand`
|
|
304
|
+
),
|
|
305
|
+
confidenceBand: normalizeMember(
|
|
306
|
+
dominantRead.confidenceBand,
|
|
307
|
+
QUIET_MEASURE_CONFIDENCE_BANDS,
|
|
308
|
+
`${prefix} confidenceBand`
|
|
309
|
+
),
|
|
310
|
+
reasonCodes: normalizeReasonCodes(
|
|
311
|
+
dominantRead.reasonCodes,
|
|
312
|
+
`${prefix} reasonCodes`
|
|
313
|
+
)
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function normalizeDominantReads(value) {
|
|
317
|
+
if (value === void 0) {
|
|
318
|
+
return Object.freeze([]);
|
|
319
|
+
}
|
|
320
|
+
if (!Array.isArray(value)) {
|
|
321
|
+
throw new TypeError("Quiet Measure dominantReads must be an array.");
|
|
322
|
+
}
|
|
323
|
+
return Object.freeze(value.map((entry, index) => normalizeDerivedReadSummary(entry, index)));
|
|
324
|
+
}
|
|
325
|
+
function isQuietMeasureAxis(value) {
|
|
326
|
+
return isMember(value, QUIET_MEASURE_AXES);
|
|
327
|
+
}
|
|
328
|
+
function isQuietMeasureMissionProbeMode(value) {
|
|
329
|
+
return isMember(value, QUIET_MEASURE_MISSION_PROBE_MODES);
|
|
330
|
+
}
|
|
331
|
+
function isQuietMeasureMissionResolutionShape(value) {
|
|
332
|
+
return isMember(value, QUIET_MEASURE_MISSION_RESOLUTION_SHAPES);
|
|
333
|
+
}
|
|
334
|
+
function createQuietMeasureJudgmentEligibility(input = {}) {
|
|
335
|
+
const repeatedMeaningfulEvidence = normalizeOptionalBoolean(
|
|
336
|
+
input.repeatedMeaningfulEvidence,
|
|
337
|
+
false,
|
|
338
|
+
"Quiet Measure eligibility repeatedMeaningfulEvidence"
|
|
339
|
+
);
|
|
340
|
+
const includesPrivateOrLowWitnessEvidence = normalizeOptionalBoolean(
|
|
341
|
+
input.includesPrivateOrLowWitnessEvidence,
|
|
342
|
+
false,
|
|
343
|
+
"Quiet Measure eligibility includesPrivateOrLowWitnessEvidence"
|
|
344
|
+
);
|
|
345
|
+
const includesCostlyPressureEvent = normalizeOptionalBoolean(
|
|
346
|
+
input.includesCostlyPressureEvent,
|
|
347
|
+
false,
|
|
348
|
+
"Quiet Measure eligibility includesCostlyPressureEvent"
|
|
349
|
+
);
|
|
350
|
+
return Object.freeze({
|
|
351
|
+
eligible: repeatedMeaningfulEvidence && includesPrivateOrLowWitnessEvidence && includesCostlyPressureEvent,
|
|
352
|
+
repeatedMeaningfulEvidence,
|
|
353
|
+
includesPrivateOrLowWitnessEvidence,
|
|
354
|
+
includesCostlyPressureEvent,
|
|
355
|
+
reasonCodes: normalizeReasonCodes(input.reasonCodes, "Quiet Measure eligibility reasonCodes")
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
function listQuietMeasureMissingEvidence(eligibility) {
|
|
359
|
+
const normalizedEligibility = normalizeJudgmentEligibility(eligibility);
|
|
360
|
+
const missing = [];
|
|
361
|
+
if (!normalizedEligibility.repeatedMeaningfulEvidence) {
|
|
362
|
+
missing.push("repeated-meaningful-evidence");
|
|
363
|
+
}
|
|
364
|
+
if (!normalizedEligibility.includesPrivateOrLowWitnessEvidence) {
|
|
365
|
+
missing.push("private-or-low-witness-evidence");
|
|
366
|
+
}
|
|
367
|
+
if (!normalizedEligibility.includesCostlyPressureEvent) {
|
|
368
|
+
missing.push("costly-pressure-event");
|
|
369
|
+
}
|
|
370
|
+
return Object.freeze(missing);
|
|
371
|
+
}
|
|
372
|
+
function createQuietMeasureJudgmentResponse(input) {
|
|
373
|
+
const request = normalizeJudgmentRequest(input.request);
|
|
374
|
+
const eligibility = normalizeJudgmentEligibility(input.eligibility);
|
|
375
|
+
const missingEvidence = listQuietMeasureMissingEvidence(eligibility);
|
|
376
|
+
const reasonCodes = normalizeReasonCodes(
|
|
377
|
+
input.reasonCodes,
|
|
378
|
+
"Quiet Measure judgment response reasonCodes"
|
|
379
|
+
);
|
|
380
|
+
const hasRequiredEvidence = missingEvidence.length === 0;
|
|
381
|
+
if (!hasRequiredEvidence) {
|
|
382
|
+
return Object.freeze({
|
|
383
|
+
kind: "insufficient-evidence",
|
|
384
|
+
request,
|
|
385
|
+
eligibility: Object.freeze({
|
|
386
|
+
...eligibility,
|
|
387
|
+
eligible: false
|
|
388
|
+
}),
|
|
389
|
+
missingEvidence,
|
|
390
|
+
reasonCodes
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
if (!input.title) {
|
|
394
|
+
throw new TypeError(
|
|
395
|
+
"Quiet Measure verdict responses require a title descriptor when eligibility is met."
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
return Object.freeze({
|
|
399
|
+
kind: "verdict",
|
|
400
|
+
request,
|
|
401
|
+
eligibility: Object.freeze({
|
|
402
|
+
...eligibility,
|
|
403
|
+
eligible: true
|
|
404
|
+
}),
|
|
405
|
+
title: normalizeTitleDescriptor(input.title),
|
|
406
|
+
dominantReads: normalizeDominantReads(input.dominantReads),
|
|
407
|
+
reasonCodes
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
|
|
261
411
|
// src/index.ts
|
|
262
412
|
var AI_GAME_PACKAGE = "@plasius/ai-game";
|
|
263
413
|
var AI_GAME_ENV_PREFIX = "AI_GAME";
|
|
@@ -665,8 +815,7 @@ var aiGameFeatureFlags = Object.freeze({
|
|
|
665
815
|
incident: AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
|
|
666
816
|
gossipTopics: AI_GAME_GOSSIP_TOPICS_FEATURE_FLAG_ID,
|
|
667
817
|
gossipPerspective: AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
|
|
668
|
-
gossipLifecycle: AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID
|
|
669
|
-
pointsStore: AI_GAME_POINTS_STORE_FEATURE_FLAG_ID
|
|
818
|
+
gossipLifecycle: AI_GAME_GOSSIP_LIFECYCLE_FEATURE_FLAG_ID
|
|
670
819
|
});
|
|
671
820
|
var gameEventFeatureFlags = Object.freeze([
|
|
672
821
|
aiGameFeatureFlags.contract,
|
|
@@ -674,8 +823,7 @@ var gameEventFeatureFlags = Object.freeze([
|
|
|
674
823
|
aiGameFeatureFlags.incident,
|
|
675
824
|
aiGameFeatureFlags.gossipTopics,
|
|
676
825
|
aiGameFeatureFlags.gossipPerspective,
|
|
677
|
-
aiGameFeatureFlags.gossipLifecycle
|
|
678
|
-
aiGameFeatureFlags.pointsStore
|
|
826
|
+
aiGameFeatureFlags.gossipLifecycle
|
|
679
827
|
]);
|
|
680
828
|
export {
|
|
681
829
|
AI_GAME_ACTOR_ROLES,
|
|
@@ -689,36 +837,42 @@ export {
|
|
|
689
837
|
AI_GAME_INCIDENT_IMPACT_FEATURE_FLAG_ID,
|
|
690
838
|
AI_GAME_PACKAGE,
|
|
691
839
|
AI_GAME_PERSPECTIVE_FEATURE_FLAG_ID,
|
|
692
|
-
|
|
693
|
-
AI_GAME_POINTS_AUTHORITY_BANDS,
|
|
694
|
-
AI_GAME_POINTS_AUTHORITY_SYSTEMS,
|
|
695
|
-
AI_GAME_POINTS_LEDGER_IDS,
|
|
696
|
-
AI_GAME_POINTS_STORE_FEATURE_FLAG_ID,
|
|
840
|
+
AI_GAME_QUIET_MEASURE_FEATURE_FLAG_ID,
|
|
697
841
|
AI_GAME_TASK_AUTHORITY_BOUNDARIES,
|
|
698
842
|
AI_GAME_TASK_DECISIONS,
|
|
699
843
|
AI_GAME_TASK_KINDS,
|
|
700
844
|
AI_GAME_TASK_RESULTS,
|
|
701
845
|
AI_GAME_TASK_RISK_CLASSES,
|
|
702
846
|
AI_GAME_TTS_CACHE_POLICIES,
|
|
847
|
+
QUIET_MEASURE_AXES,
|
|
848
|
+
QUIET_MEASURE_CONFIDENCE_BANDS,
|
|
849
|
+
QUIET_MEASURE_DERIVED_READS,
|
|
850
|
+
QUIET_MEASURE_EVIDENCE_CLASSES,
|
|
851
|
+
QUIET_MEASURE_JUDGMENT_DISCLOSURES,
|
|
852
|
+
QUIET_MEASURE_JUDGMENT_MISSING_EVIDENCE,
|
|
853
|
+
QUIET_MEASURE_JUDGMENT_REQUESTERS,
|
|
854
|
+
QUIET_MEASURE_MISSION_PROBE_MODES,
|
|
855
|
+
QUIET_MEASURE_MISSION_RESOLUTION_SHAPES,
|
|
856
|
+
QUIET_MEASURE_PERSPECTIVES,
|
|
857
|
+
QUIET_MEASURE_SIGNAL_BANDS,
|
|
703
858
|
aiGameFeatureFlags,
|
|
704
859
|
classifyAiGameTask,
|
|
705
|
-
|
|
706
|
-
|
|
860
|
+
createQuietMeasureJudgmentEligibility,
|
|
861
|
+
createQuietMeasureJudgmentResponse,
|
|
707
862
|
gameEventFeatureFlags,
|
|
708
|
-
getAiGameProtoSocialDevolutionPolicy,
|
|
709
|
-
getDefaultAiGamePointsSpendPolicies,
|
|
710
|
-
isAiGamePlayerEvolutionStage,
|
|
711
|
-
isAiGamePointsLedgerId,
|
|
712
863
|
isCandidateWorldEvent,
|
|
713
864
|
isCanonicalWorldEvent,
|
|
714
865
|
isGossipTopicActive,
|
|
715
866
|
isGossipTopicCorrected,
|
|
716
867
|
isIncidentResolved,
|
|
868
|
+
isQuietMeasureAxis,
|
|
869
|
+
isQuietMeasureMissionProbeMode,
|
|
870
|
+
isQuietMeasureMissionResolutionShape,
|
|
871
|
+
listQuietMeasureMissingEvidence,
|
|
717
872
|
normalizeIncidentImpactVector,
|
|
718
873
|
packageDescriptor,
|
|
719
874
|
projectTopicForAudience,
|
|
720
875
|
resolveAiGamePlayerAddressText,
|
|
721
|
-
resolveAiGamePointsAuthorityBoundary,
|
|
722
876
|
resolveAiGameTaskBatch
|
|
723
877
|
};
|
|
724
878
|
//# sourceMappingURL=index.js.map
|