arkaik 0.11.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skill/scripts/validate-bundle.js +4 -4
- package/dist/index.js +1048 -99
- package/dist/io.js +878 -8
- package/package.json +1 -1
- package/src/io.ts +1 -0
package/dist/io.js
CHANGED
|
@@ -3045,13 +3045,13 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
3045
3045
|
}
|
|
3046
3046
|
return propValues;
|
|
3047
3047
|
});
|
|
3048
|
-
const
|
|
3048
|
+
const isObject4 = isObject;
|
|
3049
3049
|
const catchall = def.catchall;
|
|
3050
3050
|
let value;
|
|
3051
3051
|
inst._zod.parse = (payload, ctx) => {
|
|
3052
3052
|
value ?? (value = _normalized.value);
|
|
3053
3053
|
const input = payload.value;
|
|
3054
|
-
if (!
|
|
3054
|
+
if (!isObject4(input)) {
|
|
3055
3055
|
payload.issues.push({
|
|
3056
3056
|
expected: "object",
|
|
3057
3057
|
code: "invalid_type",
|
|
@@ -3178,7 +3178,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3178
3178
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
3179
3179
|
};
|
|
3180
3180
|
let fastpass;
|
|
3181
|
-
const
|
|
3181
|
+
const isObject4 = isObject;
|
|
3182
3182
|
const jit = !globalConfig.jitless;
|
|
3183
3183
|
const allowsEval2 = allowsEval;
|
|
3184
3184
|
const fastEnabled = jit && allowsEval2.value;
|
|
@@ -3187,7 +3187,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
3187
3187
|
inst._zod.parse = (payload, ctx) => {
|
|
3188
3188
|
value ?? (value = _normalized.value);
|
|
3189
3189
|
const input = payload.value;
|
|
3190
|
-
if (!
|
|
3190
|
+
if (!isObject4(input)) {
|
|
3191
3191
|
payload.issues.push({
|
|
3192
3192
|
expected: "object",
|
|
3193
3193
|
code: "invalid_type",
|
|
@@ -14611,6 +14611,38 @@ var VALUE_IDS = [
|
|
|
14611
14611
|
// social-impact (1)
|
|
14612
14612
|
"self-transcendence"
|
|
14613
14613
|
];
|
|
14614
|
+
var VALUE_TIERS = {
|
|
14615
|
+
"saves-time": "functional",
|
|
14616
|
+
simplifies: "functional",
|
|
14617
|
+
"makes-money": "functional",
|
|
14618
|
+
"reduces-risk": "functional",
|
|
14619
|
+
organizes: "functional",
|
|
14620
|
+
integrates: "functional",
|
|
14621
|
+
connects: "functional",
|
|
14622
|
+
"reduces-effort": "functional",
|
|
14623
|
+
"avoids-hassles": "functional",
|
|
14624
|
+
"reduces-cost": "functional",
|
|
14625
|
+
quality: "functional",
|
|
14626
|
+
variety: "functional",
|
|
14627
|
+
"sensory-appeal": "functional",
|
|
14628
|
+
informs: "functional",
|
|
14629
|
+
"reduces-anxiety": "emotional",
|
|
14630
|
+
"rewards-me": "emotional",
|
|
14631
|
+
nostalgia: "emotional",
|
|
14632
|
+
"design-aesthetics": "emotional",
|
|
14633
|
+
"badge-value": "emotional",
|
|
14634
|
+
wellness: "emotional",
|
|
14635
|
+
"therapeutic-value": "emotional",
|
|
14636
|
+
"fun-entertainment": "emotional",
|
|
14637
|
+
attractiveness: "emotional",
|
|
14638
|
+
"provides-access": "emotional",
|
|
14639
|
+
"provides-hope": "life-changing",
|
|
14640
|
+
"self-actualization": "life-changing",
|
|
14641
|
+
motivation: "life-changing",
|
|
14642
|
+
heirloom: "life-changing",
|
|
14643
|
+
"affiliation-belonging": "life-changing",
|
|
14644
|
+
"self-transcendence": "social-impact"
|
|
14645
|
+
};
|
|
14614
14646
|
|
|
14615
14647
|
// ../schema/src/legacy-status.ts
|
|
14616
14648
|
var LEGACY_STATUS_IDS = ["prioritized", "blocked"];
|
|
@@ -15121,6 +15153,84 @@ function missingProvenanceNodeIds(snapshotNodeIds, events) {
|
|
|
15121
15153
|
return missing;
|
|
15122
15154
|
}
|
|
15123
15155
|
|
|
15156
|
+
// ../schema/src/weighing-schemas.ts
|
|
15157
|
+
var documented = (schema) => external_exports.union([schema, external_exports.unknown()]);
|
|
15158
|
+
var leaf = (description) => external_exports.unknown().optional().meta({ description });
|
|
15159
|
+
var WeighingConfidenceSchema = external_exports.unknown().meta({ description: "0 guess \xB7 1 inferred \xB7 2 evidenced \xB7 3 verified." });
|
|
15160
|
+
var WeighingScorerSchema = external_exports.object({
|
|
15161
|
+
kind: leaf("Who judged: human, agent or rule. A human's level beats an agent's, which beats a rule's. Any value parses; the validator warns on another kind."),
|
|
15162
|
+
id: leaf("A person's handle, an agent's name, or a seeding rule's id."),
|
|
15163
|
+
model: leaf("The model behind an agent, when it says."),
|
|
15164
|
+
on_behalf_of: leaf("Whom the scorer acts for: a user id, a handle or a display name, never an email. Stamped by the writer where identity is known.")
|
|
15165
|
+
}).catchall(external_exports.unknown()).meta({ id: "WeighingScorer", description: "Provenance of one assessment." });
|
|
15166
|
+
var WeighingScaleSchema = external_exports.object({
|
|
15167
|
+
min: leaf("The lowest level, e.g. -3."),
|
|
15168
|
+
max: leaf("The highest level, e.g. 3."),
|
|
15169
|
+
anchors: leaf("Every level described in words, keyed by the level as a string.")
|
|
15170
|
+
}).catchall(external_exports.unknown()).meta({ id: "WeighingScale", description: "A criteria set's scale: its bounds and every level's anchor." });
|
|
15171
|
+
var WeighingGroupSchema = external_exports.object({ id: leaf("The group's id."), title: leaf("The group's title.") }).catchall(external_exports.unknown()).meta({ id: "WeighingGroup", description: "A grouping of criteria \u2014 the tiers, for the value set." });
|
|
15172
|
+
var WeighingCriterionSchema = external_exports.object({
|
|
15173
|
+
id: leaf("Stable identifier. Never redefined \u2014 retired via superseded_by."),
|
|
15174
|
+
group: leaf("A group id \u2014 for the value set, the tier."),
|
|
15175
|
+
name: leaf("A short name."),
|
|
15176
|
+
question: leaf("The question a scorer answers."),
|
|
15177
|
+
definition: leaf("What the criterion means."),
|
|
15178
|
+
anchors: leaf("This criterion's own wording of each level \u2014 on a positioning, in the product's words."),
|
|
15179
|
+
weight: leaf("On a positioning: how much the product stands on it, a number above 0. Absent means 1."),
|
|
15180
|
+
superseded_by: leaf("The id of the criterion that replaces this one.")
|
|
15181
|
+
}).catchall(external_exports.unknown()).meta({ id: "WeighingCriterion", description: "One question on a scale where every level is described." });
|
|
15182
|
+
var WeighingCriteriaSetSchema = external_exports.object({
|
|
15183
|
+
id: leaf("The set's id."),
|
|
15184
|
+
version: leaf("Semver. Levels are comparable only within a major."),
|
|
15185
|
+
title: leaf("A human title."),
|
|
15186
|
+
subject: leaf("What the set judges: acceptance today."),
|
|
15187
|
+
scale: documented(WeighingScaleSchema).optional().meta({ description: "The scale. A positioning may leave it out and use its ruler's." }),
|
|
15188
|
+
groups: documented(external_exports.array(documented(WeighingGroupSchema))).optional(),
|
|
15189
|
+
criteria: documented(external_exports.array(documented(WeighingCriterionSchema))).optional(),
|
|
15190
|
+
role: leaf("positioning marks the set a project writes about itself."),
|
|
15191
|
+
status: leaf("Absent or active is active; anything else is a draft, which feeds no roll-up."),
|
|
15192
|
+
extends: leaf("A positioning's ruler, e.g. value-contribution@2.")
|
|
15193
|
+
}).catchall(external_exports.unknown()).meta({ id: "WeighingCriteriaSet", description: "A versioned list of criteria for one kind of subject. The 30 elements of value are one; a positioning is another." });
|
|
15194
|
+
var WeighingMatrixSchema = external_exports.object({
|
|
15195
|
+
id: leaf("The matrix's id."),
|
|
15196
|
+
title: leaf("A human title."),
|
|
15197
|
+
set: leaf("The set's id and major, e.g. value-contribution@2."),
|
|
15198
|
+
subjects: documented(
|
|
15199
|
+
external_exports.object({ kind: leaf("query or list."), species: leaf("For a query: the species judged."), items: leaf("For a list: the subjects.") }).catchall(external_exports.unknown())
|
|
15200
|
+
).optional().meta({ description: "What the matrix judges: { kind: query, species } or { kind: list, items }." }),
|
|
15201
|
+
positioning: leaf("The id of the positioning set that re-weights this matrix."),
|
|
15202
|
+
context: leaf("The node the matrix is about, as { node_id }."),
|
|
15203
|
+
status: leaf("Absent or active is active; anything else is a draft.")
|
|
15204
|
+
}).catchall(external_exports.unknown()).meta({ id: "WeighingMatrix", description: "A criteria set applied to a list of subjects." });
|
|
15205
|
+
var WeighingAssessmentBasisSchema = external_exports.object({
|
|
15206
|
+
fingerprint: leaf("A hash of the subject's judged fields."),
|
|
15207
|
+
commit: leaf("The commit the scorer was looking at."),
|
|
15208
|
+
set_version: leaf("The full version of the set the level was read against.")
|
|
15209
|
+
}).catchall(external_exports.unknown());
|
|
15210
|
+
var WeighingAssessmentSchema = external_exports.object({
|
|
15211
|
+
matrix: leaf("The matrix's id. A row without it cannot be addressed: readers skip it and the validator warns."),
|
|
15212
|
+
subject: leaf("A node id for the value matrix."),
|
|
15213
|
+
criterion: leaf("A criterion id."),
|
|
15214
|
+
level: leaf("A whole number on the set's scale. 0 means unrelated. No half points \u2014 but any value parses; the validator warns on one off the scale."),
|
|
15215
|
+
scorer: documented(WeighingScorerSchema).optional().meta({ description: "Who judged. Required in practice: without it a human, an agent and a rule are indistinguishable, so the validator warns." }),
|
|
15216
|
+
confidence: leaf("0 guess \xB7 1 inferred \xB7 2 evidenced \xB7 3 verified."),
|
|
15217
|
+
evidence: leaf("Markdown."),
|
|
15218
|
+
refs: leaf("Ids cited: nodes, journal events, findings."),
|
|
15219
|
+
basis: documented(WeighingAssessmentBasisSchema).optional().meta({ description: "What the scorer was looking at, so a re-read can tell the score went stale." }),
|
|
15220
|
+
run: leaf("The audit or plan the score belongs to."),
|
|
15221
|
+
p_serves: leaf("Optional: a probabilistic scorer's certainty (0 to 1) that the subject serves the element. Certainty, not size. Any value parses; the validator warns on one outside 0..1."),
|
|
15222
|
+
p_costs: leaf("Optional: the same for costs, asked independently, so both can be high."),
|
|
15223
|
+
ts: leaf("ISO 8601.")
|
|
15224
|
+
}).catchall(external_exports.unknown()).meta({ id: "WeighingAssessment", description: "One (matrix \xD7 subject \xD7 criterion) judgement \u2014 latest per scorer kind wins; history lives in the journal." });
|
|
15225
|
+
var WeighingSectionSchema = external_exports.object({
|
|
15226
|
+
sets: external_exports.array(documented(WeighingCriteriaSetSchema)).optional(),
|
|
15227
|
+
matrices: external_exports.array(documented(WeighingMatrixSchema)).optional(),
|
|
15228
|
+
assessments: external_exports.array(documented(WeighingAssessmentSchema)).optional()
|
|
15229
|
+
}).catchall(external_exports.unknown()).meta({
|
|
15230
|
+
id: "WeighingSection",
|
|
15231
|
+
description: "The project's weighing state (docs/rfcs/weighing.md) \u2014 its own criteria sets (a positioning), matrices and assessments. The built-in value set is library content, not stored; served, cost and kept share are derived, never stored. Each list may be absent; a reader treats it as empty."
|
|
15232
|
+
});
|
|
15233
|
+
|
|
15124
15234
|
// ../schema/src/journal-events.ts
|
|
15125
15235
|
var envelope = {
|
|
15126
15236
|
id: external_exports.string().meta({ description: "ULID \u2014 sortable, collision-free without coordination." }),
|
|
@@ -15311,6 +15421,23 @@ var QualitySignalTrippedEventSchema = external_exports.object({
|
|
|
15311
15421
|
commit: external_exports.string().optional(),
|
|
15312
15422
|
detail: external_exports.string().optional()
|
|
15313
15423
|
}).catchall(external_exports.unknown());
|
|
15424
|
+
var WeighingAssessmentRecordedEventSchema = external_exports.object({
|
|
15425
|
+
...envelope,
|
|
15426
|
+
type: external_exports.literal("weighing.assessment.recorded"),
|
|
15427
|
+
matrix: external_exports.string(),
|
|
15428
|
+
subject: external_exports.string(),
|
|
15429
|
+
criterion: external_exports.string(),
|
|
15430
|
+
level: external_exports.number().int(),
|
|
15431
|
+
scorer: WeighingScorerSchema,
|
|
15432
|
+
confidence: WeighingConfidenceSchema,
|
|
15433
|
+
evidence: external_exports.string().optional(),
|
|
15434
|
+
refs: external_exports.array(external_exports.string()).optional(),
|
|
15435
|
+
basis: WeighingAssessmentBasisSchema.optional(),
|
|
15436
|
+
run: external_exports.string().optional(),
|
|
15437
|
+
p_serves: external_exports.number().min(0).max(1).optional(),
|
|
15438
|
+
p_costs: external_exports.number().min(0).max(1).optional()
|
|
15439
|
+
}).catchall(external_exports.unknown());
|
|
15440
|
+
var WeighingSetSavedEventSchema = external_exports.object({ ...envelope, type: external_exports.literal("weighing.set.saved"), set: WeighingCriteriaSetSchema }).catchall(external_exports.unknown());
|
|
15314
15441
|
var JOURNAL_EVENT_SCHEMAS = {
|
|
15315
15442
|
"node.created": NodeCreatedEventSchema,
|
|
15316
15443
|
"node.updated": NodeUpdatedEventSchema,
|
|
@@ -15334,7 +15461,9 @@ var JOURNAL_EVENT_SCHEMAS = {
|
|
|
15334
15461
|
"quality.finding.opened": QualityFindingOpenedEventSchema,
|
|
15335
15462
|
"quality.finding.resolved": QualityFindingResolvedEventSchema,
|
|
15336
15463
|
"quality.finding.accepted": QualityFindingAcceptedEventSchema,
|
|
15337
|
-
"quality.signal.tripped": QualitySignalTrippedEventSchema
|
|
15464
|
+
"quality.signal.tripped": QualitySignalTrippedEventSchema,
|
|
15465
|
+
"weighing.assessment.recorded": WeighingAssessmentRecordedEventSchema,
|
|
15466
|
+
"weighing.set.saved": WeighingSetSavedEventSchema
|
|
15338
15467
|
};
|
|
15339
15468
|
var KnownJournalEventSchema = external_exports.union([
|
|
15340
15469
|
NodeCreatedEventSchema,
|
|
@@ -15359,7 +15488,9 @@ var KnownJournalEventSchema = external_exports.union([
|
|
|
15359
15488
|
QualityFindingOpenedEventSchema,
|
|
15360
15489
|
QualityFindingResolvedEventSchema,
|
|
15361
15490
|
QualityFindingAcceptedEventSchema,
|
|
15362
|
-
QualitySignalTrippedEventSchema
|
|
15491
|
+
QualitySignalTrippedEventSchema,
|
|
15492
|
+
WeighingAssessmentRecordedEventSchema,
|
|
15493
|
+
WeighingSetSavedEventSchema
|
|
15363
15494
|
]);
|
|
15364
15495
|
|
|
15365
15496
|
// ../schema/src/quality.ts
|
|
@@ -15777,6 +15908,9 @@ var ProjectBundleSchema = external_exports.object({
|
|
|
15777
15908
|
}),
|
|
15778
15909
|
quality: QualitySectionSchema.optional().meta({
|
|
15779
15910
|
description: "Optional Kritik quality state (docs/rfcs/kritik.md \xA7 4.1) \u2014 the pinned pack version, the project's surface profile, its assessments and findings. Additive: a bundle without it is not an error, and the comparative matrix is derived from it (deriveQualityMatrix), never stored."
|
|
15911
|
+
}),
|
|
15912
|
+
weighing: WeighingSectionSchema.optional().meta({
|
|
15913
|
+
description: "Optional weighing state (docs/rfcs/weighing.md) \u2014 the project's own criteria sets (a positioning), matrices and assessments, each assessment carrying its scorer, confidence and basis. Additive: a bundle without it is not an error, and every weight, served and cost figure is derived from it, never stored."
|
|
15780
15914
|
})
|
|
15781
15915
|
}).catchall(external_exports.unknown()).meta({
|
|
15782
15916
|
id: "ProjectBundle",
|
|
@@ -15810,6 +15944,673 @@ function isBuiltInMapId(id) {
|
|
|
15810
15944
|
return BUILT_IN_MAP_IDS.includes(id);
|
|
15811
15945
|
}
|
|
15812
15946
|
|
|
15947
|
+
// ../schema/src/weighing-ladders.ts
|
|
15948
|
+
var LADDERS = {
|
|
15949
|
+
"saves-time": {
|
|
15950
|
+
"-3": "Takes hours out of the person's life.",
|
|
15951
|
+
"-2": "Costs the person time on tasks they do regularly in this domain.",
|
|
15952
|
+
"-1": "Costs the person a little time on one task inside the product.",
|
|
15953
|
+
"1": "Saves a little time on one task inside the product.",
|
|
15954
|
+
"2": "Saves time on tasks the person does regularly in this domain.",
|
|
15955
|
+
"3": "Gives the person back hours of their life, the way online banking replaced trips to the bank."
|
|
15956
|
+
},
|
|
15957
|
+
simplifies: {
|
|
15958
|
+
"-3": "Makes a part of the person's life confusing or hard to manage.",
|
|
15959
|
+
"-2": "Makes a whole task in this domain clearly more complicated.",
|
|
15960
|
+
"-1": "Adds a step or a choice inside the product.",
|
|
15961
|
+
"1": "Removes a step or a choice inside the product.",
|
|
15962
|
+
"2": "Makes a whole task in this domain clearly simpler.",
|
|
15963
|
+
"3": "Makes a complicated part of the person's life simple, the way a single search box replaced browsing directories."
|
|
15964
|
+
},
|
|
15965
|
+
"makes-money": {
|
|
15966
|
+
"-3": "Costs the person a meaningful part of their income.",
|
|
15967
|
+
"-2": "Cuts a regular way the person earns in this domain.",
|
|
15968
|
+
"-1": "Makes earning slightly harder or costs the person a little income.",
|
|
15969
|
+
"1": "Helps the person earn a little, or makes earning slightly easier.",
|
|
15970
|
+
"2": "Gives the person a regular way to earn in this domain.",
|
|
15971
|
+
"3": "Provides a meaningful part of the person's income."
|
|
15972
|
+
},
|
|
15973
|
+
"reduces-risk": {
|
|
15974
|
+
"-3": "Exposes the person to a major loss in their life.",
|
|
15975
|
+
"-2": "Exposes the person to a serious loss or error in this domain.",
|
|
15976
|
+
"-1": "Exposes the person to a small mistake or loss inside the product.",
|
|
15977
|
+
"1": "Guards against a small mistake or loss inside the product.",
|
|
15978
|
+
"2": "Protects against a serious loss or error in this domain.",
|
|
15979
|
+
"3": "Protects against a major loss in the person's life, the way insurance or a full backup does."
|
|
15980
|
+
},
|
|
15981
|
+
organizes: {
|
|
15982
|
+
"-3": "Brings disorder to a large part of the person's life.",
|
|
15983
|
+
"-2": "Makes things in this domain hard to keep in order or to find.",
|
|
15984
|
+
"-1": "Leaves a few things in disorder inside the product.",
|
|
15985
|
+
"1": "Keeps a few things in order inside the product.",
|
|
15986
|
+
"2": "Keeps everything in this domain in order and easy to find.",
|
|
15987
|
+
"3": "Brings order to a large part of the person's life, the way a calendar does."
|
|
15988
|
+
},
|
|
15989
|
+
integrates: {
|
|
15990
|
+
"-3": "Pulls separate parts of the person's life further apart.",
|
|
15991
|
+
"-2": "Splits apart the several tools the person uses in this domain.",
|
|
15992
|
+
"-1": "Cuts the product off from one other tool the person uses.",
|
|
15993
|
+
"1": "Connects the product to one other tool the person uses.",
|
|
15994
|
+
"2": "Ties together the several tools the person uses in this domain.",
|
|
15995
|
+
"3": "Makes separate parts of the person's life work together as one."
|
|
15996
|
+
},
|
|
15997
|
+
connects: {
|
|
15998
|
+
"-3": "Separates the person from the people who matter most in their life.",
|
|
15999
|
+
"-2": "Makes it harder to build or keep relationships in this domain.",
|
|
16000
|
+
"-1": "Gets in the way of reaching someone through the product.",
|
|
16001
|
+
"1": "Lets the person reach someone through the product.",
|
|
16002
|
+
"2": "Helps the person build and keep relationships in this domain.",
|
|
16003
|
+
"3": "Brings the person together with the people who matter most in their life."
|
|
16004
|
+
},
|
|
16005
|
+
"reduces-effort": {
|
|
16006
|
+
"-3": "Puts a heavy burden of work on the person's life.",
|
|
16007
|
+
"-2": "Adds repetitive work to a task the person does regularly in this domain.",
|
|
16008
|
+
"-1": "Adds a little effort to one task inside the product.",
|
|
16009
|
+
"1": "Saves a little effort on one task inside the product.",
|
|
16010
|
+
"2": "Takes the repetitive work out of a task the person does regularly in this domain.",
|
|
16011
|
+
"3": "Lifts a heavy burden of work off the person's life."
|
|
16012
|
+
},
|
|
16013
|
+
"avoids-hassles": {
|
|
16014
|
+
"-3": "Brings a whole kind of annoyance into the person's life.",
|
|
16015
|
+
"-2": "Adds an annoyance that keeps coming back in this domain.",
|
|
16016
|
+
"-1": "Adds a small annoyance inside the product.",
|
|
16017
|
+
"1": "Avoids a small annoyance inside the product.",
|
|
16018
|
+
"2": "Avoids an annoyance that keeps coming back in this domain.",
|
|
16019
|
+
"3": "Takes a whole kind of annoyance out of the person's life, the way a GPS ended getting lost."
|
|
16020
|
+
},
|
|
16021
|
+
"reduces-cost": {
|
|
16022
|
+
"-3": "Costs the person a significant amount of money over their life.",
|
|
16023
|
+
"-2": "Costs the person money regularly in this domain.",
|
|
16024
|
+
"-1": "Costs the person a little money on one purchase.",
|
|
16025
|
+
"1": "Saves the person a little money on one purchase.",
|
|
16026
|
+
"2": "Saves the person money regularly in this domain.",
|
|
16027
|
+
"3": "Saves the person a significant amount of money over their life."
|
|
16028
|
+
},
|
|
16029
|
+
quality: {
|
|
16030
|
+
"-3": "Craft so poor the person would call it the worst they have used.",
|
|
16031
|
+
"-2": "The product does its job in this domain clearly worse than the usual alternatives.",
|
|
16032
|
+
"-1": "Something inside the product works noticeably badly.",
|
|
16033
|
+
"1": "Something inside the product works noticeably well.",
|
|
16034
|
+
"2": "The product does its job in this domain clearly better than the usual alternatives.",
|
|
16035
|
+
"3": "Craft so good the person would call it the best they have used."
|
|
16036
|
+
},
|
|
16037
|
+
variety: {
|
|
16038
|
+
"-3": "Closes off a breadth of choice the person had elsewhere.",
|
|
16039
|
+
"-2": "Narrows the choice in this domain.",
|
|
16040
|
+
"-1": "Removes a few meaningful options inside the product.",
|
|
16041
|
+
"1": "Offers a few meaningful options inside the product.",
|
|
16042
|
+
"2": "Offers a wide and meaningful choice in this domain.",
|
|
16043
|
+
"3": "Opens a breadth of choice the person could not get anywhere else."
|
|
16044
|
+
},
|
|
16045
|
+
"sensory-appeal": {
|
|
16046
|
+
"-3": "A sensory experience the person avoids.",
|
|
16047
|
+
"-2": "The product looks, sounds or feels bad and the person dislikes using it.",
|
|
16048
|
+
"-1": "An unpleasant detail the person notices in the moment.",
|
|
16049
|
+
"1": "A pleasant detail the person notices in the moment.",
|
|
16050
|
+
"2": "The product looks, sounds or feels good and the person enjoys using it.",
|
|
16051
|
+
"3": "A sensory experience the person seeks out for its own sake."
|
|
16052
|
+
},
|
|
16053
|
+
informs: {
|
|
16054
|
+
"-3": "Misleads the person deeply about the service area or domain.",
|
|
16055
|
+
"-2": "Confuses the person about the service area or domain.",
|
|
16056
|
+
"-1": "Hides from the person something about the service that they want to know.",
|
|
16057
|
+
"1": "Informs the person about the service.",
|
|
16058
|
+
"2": "Informs the person about the service area or domain.",
|
|
16059
|
+
"3": "Informs the person deeply and efficiently about the service area or domain."
|
|
16060
|
+
},
|
|
16061
|
+
"reduces-anxiety": {
|
|
16062
|
+
"-3": "Gives the person a lasting worry in their life.",
|
|
16063
|
+
"-2": "Stirs up a worry the person has in this domain.",
|
|
16064
|
+
"-1": "Adds a small worry inside the product.",
|
|
16065
|
+
"1": "Removes a small worry inside the product.",
|
|
16066
|
+
"2": "Calms a worry the person has in this domain.",
|
|
16067
|
+
"3": "Takes a lasting worry out of the person's life."
|
|
16068
|
+
},
|
|
16069
|
+
"rewards-me": {
|
|
16070
|
+
"-3": "Takes away rewards the person values as much as the product itself.",
|
|
16071
|
+
"-2": "Takes away perks the person regularly values.",
|
|
16072
|
+
"-1": "Takes away a small perk the person had.",
|
|
16073
|
+
"1": "Gives the person a small perk for engaging.",
|
|
16074
|
+
"2": "Gives the person regular perks they value.",
|
|
16075
|
+
"3": "Gives the person rewards they value as much as the product itself."
|
|
16076
|
+
},
|
|
16077
|
+
nostalgia: {
|
|
16078
|
+
"-3": "Destroys a cherished memory for good.",
|
|
16079
|
+
"-2": "Loses or overwrites a good memory of the past.",
|
|
16080
|
+
"-1": "Puts a pleasant memory at slight risk.",
|
|
16081
|
+
"1": "Faintly recalls a pleasant memory of the past.",
|
|
16082
|
+
"2": "Clearly brings back a good memory of the past.",
|
|
16083
|
+
"3": "Brings back a cherished past in a vivid and deeply felt way."
|
|
16084
|
+
},
|
|
16085
|
+
"design-aesthetics": {
|
|
16086
|
+
"-3": "Ugliness the person would be embarrassed to show to others.",
|
|
16087
|
+
"-2": "A design the person finds ugly.",
|
|
16088
|
+
"-1": "A displeasing design detail.",
|
|
16089
|
+
"1": "A pleasing design detail.",
|
|
16090
|
+
"2": "A design the person finds beautiful.",
|
|
16091
|
+
"3": "Beauty the person would show to others and that shapes how they feel about it."
|
|
16092
|
+
},
|
|
16093
|
+
"badge-value": {
|
|
16094
|
+
"-3": "Signals something the person does not want the people who matter to them to see.",
|
|
16095
|
+
"-2": "Clearly signals a low identity or status in a community.",
|
|
16096
|
+
"-1": "Gives a mild negative signal about the person to others.",
|
|
16097
|
+
"1": "Gives a mild signal about the person to others.",
|
|
16098
|
+
"2": "Clearly signals the person's identity or status in a community.",
|
|
16099
|
+
"3": "Signals who the person is to the people who matter to them."
|
|
16100
|
+
},
|
|
16101
|
+
wellness: {
|
|
16102
|
+
"-3": "Lastingly harms the person's physical or mental well-being.",
|
|
16103
|
+
"-2": "Noticeably worsens how the person feels over time.",
|
|
16104
|
+
"-1": "Slightly worsens how the person feels, in the moment.",
|
|
16105
|
+
"1": "Slightly improves how the person feels, in the moment.",
|
|
16106
|
+
"2": "Noticeably improves how the person feels over time.",
|
|
16107
|
+
"3": "Lastingly improves the person's physical or mental well-being."
|
|
16108
|
+
},
|
|
16109
|
+
"therapeutic-value": {
|
|
16110
|
+
"-3": "Deepens something that hurts the person.",
|
|
16111
|
+
"-2": "Makes a difficult feeling harder for the person to work through.",
|
|
16112
|
+
"-1": "Reopens a small emotional sore.",
|
|
16113
|
+
"1": "Gives a small moment of emotional relief.",
|
|
16114
|
+
"2": "Helps the person work through a difficult feeling.",
|
|
16115
|
+
"3": "Supports real healing of something that hurts the person."
|
|
16116
|
+
},
|
|
16117
|
+
"fun-entertainment": {
|
|
16118
|
+
"-3": "So joyless that the person avoids it and warns others.",
|
|
16119
|
+
"-2": "Boring or tedious to use.",
|
|
16120
|
+
"-1": "A dull moment.",
|
|
16121
|
+
"1": "A light moment of enjoyment.",
|
|
16122
|
+
"2": "Genuinely enjoyable to use.",
|
|
16123
|
+
"3": "Delight the person would seek out and tell others about."
|
|
16124
|
+
},
|
|
16125
|
+
attractiveness: {
|
|
16126
|
+
"-3": "Changes how unattractive the person feels in general.",
|
|
16127
|
+
"-2": "Clearly makes the person feel less attractive.",
|
|
16128
|
+
"-1": "Makes the person feel slightly worse about how they look.",
|
|
16129
|
+
"1": "Makes the person feel slightly better about how they look.",
|
|
16130
|
+
"2": "Clearly makes the person feel more attractive.",
|
|
16131
|
+
"3": "Changes how attractive the person feels in general."
|
|
16132
|
+
},
|
|
16133
|
+
"provides-access": {
|
|
16134
|
+
"-3": "Shuts the person out of something that matters in their life.",
|
|
16135
|
+
"-2": "Cuts the person off from a service or from people in this domain that they could otherwise reach.",
|
|
16136
|
+
"-1": "Puts a feature inside the product behind a barrier or closes it off.",
|
|
16137
|
+
"1": "Opens a feature inside the product.",
|
|
16138
|
+
"2": "Gives access to a service or to people in this domain that the person could not easily reach.",
|
|
16139
|
+
"3": "Gives access to something that matters in the person's life and that they could not get otherwise."
|
|
16140
|
+
},
|
|
16141
|
+
"provides-hope": {
|
|
16142
|
+
"-3": "Leaves the person believing their life cannot get better.",
|
|
16143
|
+
"-2": "Gives the person a reason to doubt that things in this domain can improve.",
|
|
16144
|
+
"-1": "Plants a small doubt.",
|
|
16145
|
+
"1": "Gives a small reason for optimism.",
|
|
16146
|
+
"2": "Gives a real reason to believe things in this domain can improve.",
|
|
16147
|
+
"3": "Gives a lasting belief that the person's life can get better."
|
|
16148
|
+
},
|
|
16149
|
+
"self-actualization": {
|
|
16150
|
+
"-3": "Pushes the person away from who they want to be.",
|
|
16151
|
+
"-2": "Clear drift away from who the person wants to be.",
|
|
16152
|
+
"-1": "A small step away from who the person wants to be.",
|
|
16153
|
+
"1": "A small step toward who the person wants to be.",
|
|
16154
|
+
"2": "Clear progress toward who the person wants to be.",
|
|
16155
|
+
"3": "Helps the person become who they want to be."
|
|
16156
|
+
},
|
|
16157
|
+
motivation: {
|
|
16158
|
+
"-3": "Drains the person's drive toward goals that matter in their life.",
|
|
16159
|
+
"-2": "Saps the person's energy toward a goal in this domain.",
|
|
16160
|
+
"-1": "A small drag on the person's drive.",
|
|
16161
|
+
"1": "A small nudge to act.",
|
|
16162
|
+
"2": "Energizes the person toward a goal in this domain.",
|
|
16163
|
+
"3": "Sustains the person's drive toward goals that matter in their life."
|
|
16164
|
+
},
|
|
16165
|
+
heirloom: {
|
|
16166
|
+
"-3": "Loses something meaningful that was meant to be passed on across time.",
|
|
16167
|
+
"-2": "Lets something meaningful be lost within years.",
|
|
16168
|
+
"-1": "Puts something worth keeping at slight risk.",
|
|
16169
|
+
"1": "Keeps something worth keeping for a while.",
|
|
16170
|
+
"2": "Preserves something meaningful for years.",
|
|
16171
|
+
"3": "Holds something meaningful enough to be passed on to others across time."
|
|
16172
|
+
},
|
|
16173
|
+
"affiliation-belonging": {
|
|
16174
|
+
"-3": "Cuts the person off from a group that matters deeply to who they are.",
|
|
16175
|
+
"-2": "Leaves the person out of a group in this domain.",
|
|
16176
|
+
"-1": "A feeling of being slightly left out of something small.",
|
|
16177
|
+
"1": "A feeling of being part of something small.",
|
|
16178
|
+
"2": "Makes the person part of a group in this domain.",
|
|
16179
|
+
"3": "Makes the person part of a group that matters deeply to who they are."
|
|
16180
|
+
},
|
|
16181
|
+
"self-transcendence": {
|
|
16182
|
+
"-3": "Works against something larger than the person themselves.",
|
|
16183
|
+
"-2": "Harms others in a meaningful way.",
|
|
16184
|
+
"-1": "Does a small harm to others.",
|
|
16185
|
+
"1": "Does a small good for others.",
|
|
16186
|
+
"2": "Helps others in a meaningful way.",
|
|
16187
|
+
"3": "Contributes to something larger than the person themselves."
|
|
16188
|
+
}
|
|
16189
|
+
};
|
|
16190
|
+
var VALUE_REACH_LADDERS = Object.freeze(
|
|
16191
|
+
Object.fromEntries(Object.entries(LADDERS).map(([id, ladder]) => [id, Object.freeze(ladder)]))
|
|
16192
|
+
);
|
|
16193
|
+
|
|
16194
|
+
// ../schema/src/weighing.ts
|
|
16195
|
+
var SCORER_KINDS = ["human", "agent", "rule"];
|
|
16196
|
+
var STORED_SCORER_KINDS = ["human", "agent"];
|
|
16197
|
+
function scorerRank(kind) {
|
|
16198
|
+
const index = SCORER_KINDS.indexOf(kind);
|
|
16199
|
+
return index === -1 ? 0 : SCORER_KINDS.length - index;
|
|
16200
|
+
}
|
|
16201
|
+
var WEIGHING_PROBABILITY_FIELDS = ["p_serves", "p_costs"];
|
|
16202
|
+
function isWeighingProbability(value) {
|
|
16203
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
|
|
16204
|
+
}
|
|
16205
|
+
var WEIGHING_ASSESSMENT_RECORDED = "weighing.assessment.recorded";
|
|
16206
|
+
var WEIGHING_SET_SAVED = "weighing.set.saved";
|
|
16207
|
+
function cellKey(matrix, subject, criterion) {
|
|
16208
|
+
return `${matrix}\0${subject}\0${criterion}`;
|
|
16209
|
+
}
|
|
16210
|
+
function assessmentKey(a) {
|
|
16211
|
+
const kind = typeof a?.scorer?.kind === "string" ? a.scorer.kind : "";
|
|
16212
|
+
return `${cellKey(String(a?.matrix), String(a?.subject), String(a?.criterion))}\0${kind}`;
|
|
16213
|
+
}
|
|
16214
|
+
var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16215
|
+
function isWeighingAssessmentShape(row) {
|
|
16216
|
+
return isRecord2(row) && typeof row.matrix === "string" && typeof row.subject === "string" && typeof row.criterion === "string";
|
|
16217
|
+
}
|
|
16218
|
+
function splitSetRef(ref) {
|
|
16219
|
+
const at = ref.lastIndexOf("@");
|
|
16220
|
+
if (at === -1) return { id: ref, major: void 0 };
|
|
16221
|
+
return { id: ref.slice(0, at), major: ref.slice(at + 1) };
|
|
16222
|
+
}
|
|
16223
|
+
function majorOf(version2) {
|
|
16224
|
+
const match = /^(\d+)(?:\.|$)/.exec(version2);
|
|
16225
|
+
return match ? match[1] : void 0;
|
|
16226
|
+
}
|
|
16227
|
+
function sortWeighingAssessments(assessments) {
|
|
16228
|
+
return [...assessments].sort((a, b) => {
|
|
16229
|
+
const text = (x) => typeof x === "string" ? x : "\uFFFF";
|
|
16230
|
+
const by = (x, y) => text(x) < text(y) ? -1 : text(x) > text(y) ? 1 : 0;
|
|
16231
|
+
return by(a?.matrix, b?.matrix) || by(a?.subject, b?.subject) || by(a?.criterion, b?.criterion) || scorerRank(b?.scorer?.kind) - scorerRank(a?.scorer?.kind);
|
|
16232
|
+
});
|
|
16233
|
+
}
|
|
16234
|
+
|
|
16235
|
+
// ../schema/src/weighing-library.ts
|
|
16236
|
+
function deepFreeze(value) {
|
|
16237
|
+
if (typeof value === "object" && value !== null && !Object.isFrozen(value)) {
|
|
16238
|
+
Object.freeze(value);
|
|
16239
|
+
for (const child of Object.values(value)) deepFreeze(child);
|
|
16240
|
+
}
|
|
16241
|
+
return value;
|
|
16242
|
+
}
|
|
16243
|
+
var VALUE_SET_ID = "value-contribution";
|
|
16244
|
+
var VALUE_SET_VERSION = "2.0.0";
|
|
16245
|
+
var VALUE_SET_V1_VERSION = "1.0.0";
|
|
16246
|
+
var VALUE_MATRIX_ID = "value";
|
|
16247
|
+
var POSITIONING_SET_ID = "positioning";
|
|
16248
|
+
var VALUE_SCALE_ANCHORS = {
|
|
16249
|
+
"3": "Life-wide. It gives the person this well beyond the product and its domain, in their life.",
|
|
16250
|
+
"2": "Across the domain. The person gets this in the whole area the product belongs to, not only inside it.",
|
|
16251
|
+
"1": "Within the product. A real contribution, felt while using it.",
|
|
16252
|
+
"0": "Unrelated: weighed and found to have nothing to do with it. (No row means nobody has weighed it yet.)",
|
|
16253
|
+
"-1": "Within the product. A small cost, felt while using it.",
|
|
16254
|
+
"-2": "Across the domain. The person notices the loss of this in the whole area the product belongs to.",
|
|
16255
|
+
"-3": "Life-wide. It leaves the person with the opposite of this in their life."
|
|
16256
|
+
};
|
|
16257
|
+
var VALUE_SCALE_V1_ANCHORS = {
|
|
16258
|
+
"3": "Core. The promise exists for this; take it away and the value goes.",
|
|
16259
|
+
"2": "Supports clearly. The user would notice it missing.",
|
|
16260
|
+
"1": "Touches. A side effect of the promise, not its purpose.",
|
|
16261
|
+
"0": "Unrelated: weighed and found to have nothing to do with it. (No row means nobody has weighed it yet.)",
|
|
16262
|
+
"-1": "Small friction. It costs this value a little.",
|
|
16263
|
+
"-2": "Works against it. The user notices the cost.",
|
|
16264
|
+
"-3": "Costs it at its core. The user feels the opposite."
|
|
16265
|
+
};
|
|
16266
|
+
var TIER_TITLES = {
|
|
16267
|
+
functional: "Functional",
|
|
16268
|
+
emotional: "Emotional",
|
|
16269
|
+
"life-changing": "Life-changing",
|
|
16270
|
+
"social-impact": "Social impact"
|
|
16271
|
+
};
|
|
16272
|
+
var VALUE_TEXT = {
|
|
16273
|
+
"saves-time": { name: "Saves time", definition: "Completes the user's task in less time." },
|
|
16274
|
+
simplifies: { name: "Simplifies", definition: "Reduces steps, choices, or cognitive load." },
|
|
16275
|
+
"makes-money": { name: "Makes money", definition: "Helps the user earn." },
|
|
16276
|
+
"reduces-risk": { name: "Reduces risk", definition: "Protects against loss, error, or uncertainty." },
|
|
16277
|
+
organizes: { name: "Organizes", definition: "Brings order to the user's things or life." },
|
|
16278
|
+
integrates: { name: "Integrates", definition: "Ties different tools or parts of life together." },
|
|
16279
|
+
connects: { name: "Connects", definition: "Brings the user together with other people." },
|
|
16280
|
+
"reduces-effort": { name: "Reduces effort", definition: "Same outcome, less work." },
|
|
16281
|
+
"avoids-hassles": { name: "Avoids hassles", definition: "Prevents friction and annoyance before it happens." },
|
|
16282
|
+
"reduces-cost": { name: "Reduces cost", definition: "Saves the user money." },
|
|
16283
|
+
quality: { name: "Quality", definition: "Superior craft or performance the user can feel." },
|
|
16284
|
+
variety: { name: "Variety", definition: "Meaningful choice and breadth." },
|
|
16285
|
+
"sensory-appeal": { name: "Sensory appeal", definition: "Looks, sounds, or feels good in the moment." },
|
|
16286
|
+
informs: { name: "Informs", definition: "Tells the user something they want to know." },
|
|
16287
|
+
"reduces-anxiety": { name: "Reduces anxiety", definition: "Calms; makes the user feel safe." },
|
|
16288
|
+
"rewards-me": { name: "Rewards me", definition: "Tangible perks for engagement." },
|
|
16289
|
+
nostalgia: { name: "Nostalgia", definition: "Positive memory of the past." },
|
|
16290
|
+
"design-aesthetics": { name: "Design / aesthetics", definition: "Beauty as an experienced value, beyond function." },
|
|
16291
|
+
"badge-value": { name: "Badge value", definition: "Signals identity or status to others." },
|
|
16292
|
+
wellness: { name: "Wellness", definition: "Improves physical or mental well-being." },
|
|
16293
|
+
"therapeutic-value": { name: "Therapeutic value", definition: "Actively supports emotional processing or healing." },
|
|
16294
|
+
"fun-entertainment": { name: "Fun / entertainment", definition: "Enjoyable, playful, delightful." },
|
|
16295
|
+
attractiveness: { name: "Attractiveness", definition: "Makes the user feel attractive." },
|
|
16296
|
+
"provides-access": { name: "Provides access", definition: "Grants entry to something otherwise out of reach." },
|
|
16297
|
+
"provides-hope": { name: "Provides hope", definition: "Reason to believe things can improve." },
|
|
16298
|
+
"self-actualization": { name: "Self-actualization", definition: "Helps the user become who they want to be." },
|
|
16299
|
+
motivation: { name: "Motivation", definition: "Energizes the user toward their goals." },
|
|
16300
|
+
heirloom: { name: "Heirloom", definition: "Something worth passing on across time." },
|
|
16301
|
+
"affiliation-belonging": { name: "Affiliation & belonging", definition: "Makes the user part of a group that matters." },
|
|
16302
|
+
"self-transcendence": { name: "Self-transcendence", definition: "Helps beyond the user themselves." }
|
|
16303
|
+
};
|
|
16304
|
+
var VALUE_SCALE = { min: -3, max: 3, anchors: { ...VALUE_SCALE_ANCHORS } };
|
|
16305
|
+
var GROUPS = Object.keys(TIER_TITLES).map((id) => ({ id, title: TIER_TITLES[id] }));
|
|
16306
|
+
function reachQuestion(id) {
|
|
16307
|
+
if (id === "informs") {
|
|
16308
|
+
return "Is what this promise mainly gives the person information, rather than an ability, a shortcut, a protection or a feeling? Or does it keep them from knowing something? And how far into their life does it reach?";
|
|
16309
|
+
}
|
|
16310
|
+
return `Does this promise serve, or cost, "${VALUE_TEXT[id].name}" for the person? And how far into their life does it reach: within the product, across its domain, or life-wide?`;
|
|
16311
|
+
}
|
|
16312
|
+
var VALUE_CONTRIBUTION_SET = deepFreeze({
|
|
16313
|
+
id: VALUE_SET_ID,
|
|
16314
|
+
version: VALUE_SET_VERSION,
|
|
16315
|
+
title: "Elements of value",
|
|
16316
|
+
subject: "acceptance",
|
|
16317
|
+
scale: VALUE_SCALE,
|
|
16318
|
+
groups: GROUPS,
|
|
16319
|
+
criteria: VALUE_IDS.map((id) => ({
|
|
16320
|
+
id,
|
|
16321
|
+
group: VALUE_TIERS[id],
|
|
16322
|
+
name: VALUE_TEXT[id].name,
|
|
16323
|
+
question: reachQuestion(id),
|
|
16324
|
+
definition: VALUE_TEXT[id].definition,
|
|
16325
|
+
anchors: { ...VALUE_REACH_LADDERS[id] }
|
|
16326
|
+
}))
|
|
16327
|
+
});
|
|
16328
|
+
var VALUE_CONTRIBUTION_SET_V1 = deepFreeze({
|
|
16329
|
+
id: VALUE_SET_ID,
|
|
16330
|
+
version: VALUE_SET_V1_VERSION,
|
|
16331
|
+
title: "Elements of value",
|
|
16332
|
+
subject: "acceptance",
|
|
16333
|
+
scale: { min: -3, max: 3, anchors: { ...VALUE_SCALE_V1_ANCHORS } },
|
|
16334
|
+
groups: GROUPS,
|
|
16335
|
+
criteria: VALUE_IDS.map((id) => ({
|
|
16336
|
+
id,
|
|
16337
|
+
group: VALUE_TIERS[id],
|
|
16338
|
+
name: VALUE_TEXT[id].name,
|
|
16339
|
+
question: `Does this promise serve, or cost, "${VALUE_TEXT[id].name}"?`,
|
|
16340
|
+
definition: VALUE_TEXT[id].definition
|
|
16341
|
+
}))
|
|
16342
|
+
});
|
|
16343
|
+
var VALUE_MATRIX = deepFreeze({
|
|
16344
|
+
id: VALUE_MATRIX_ID,
|
|
16345
|
+
title: "Value",
|
|
16346
|
+
set: `${VALUE_SET_ID}@2`,
|
|
16347
|
+
subjects: { kind: "query", species: "acceptance" },
|
|
16348
|
+
positioning: POSITIONING_SET_ID,
|
|
16349
|
+
status: "active"
|
|
16350
|
+
});
|
|
16351
|
+
var BUILT_IN_SETS = [VALUE_CONTRIBUTION_SET, VALUE_CONTRIBUTION_SET_V1];
|
|
16352
|
+
var BUILT_IN_MATRICES = [VALUE_MATRIX];
|
|
16353
|
+
var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16354
|
+
function cleaned(set2) {
|
|
16355
|
+
const usable = set2.criteria.filter((criterion) => isObject2(criterion) && typeof criterion.id === "string");
|
|
16356
|
+
return usable.length === set2.criteria.length ? set2 : { ...set2, criteria: usable };
|
|
16357
|
+
}
|
|
16358
|
+
function isWeighingSetShape(set2) {
|
|
16359
|
+
return isObject2(set2) && typeof set2.id === "string" && typeof set2.version === "string" && Array.isArray(set2.criteria) && (isObject2(set2.scale) || set2.role === "positioning");
|
|
16360
|
+
}
|
|
16361
|
+
function isWeighingMatrixShape(matrix) {
|
|
16362
|
+
if (!isObject2(matrix) || typeof matrix.id !== "string" || typeof matrix.set !== "string" || !isObject2(matrix.subjects)) return false;
|
|
16363
|
+
const { kind, species, items } = matrix.subjects;
|
|
16364
|
+
return kind === "query" && typeof species === "string" || kind === "list" && Array.isArray(items);
|
|
16365
|
+
}
|
|
16366
|
+
function isUsableScale(scale) {
|
|
16367
|
+
return isObject2(scale) && typeof scale.min === "number" && typeof scale.max === "number" && isObject2(scale.anchors);
|
|
16368
|
+
}
|
|
16369
|
+
function weighingScaleOf(set2, resolved) {
|
|
16370
|
+
if (isUsableScale(set2.scale)) return set2.scale;
|
|
16371
|
+
const ruler = typeof set2.extends === "string" && resolved !== void 0 ? setOfRef(resolved, set2.extends) : void 0;
|
|
16372
|
+
return ruler !== void 0 && isUsableScale(ruler.scale) ? ruler.scale : VALUE_SCALE;
|
|
16373
|
+
}
|
|
16374
|
+
function resolveWeighing(section) {
|
|
16375
|
+
const sets = [...BUILT_IN_SETS];
|
|
16376
|
+
const matrices = [...BUILT_IN_MATRICES];
|
|
16377
|
+
const skipped = [];
|
|
16378
|
+
const idOf = (entry) => isObject2(entry) ? { ...typeof entry.id === "string" ? { id: entry.id } : {}, ...typeof entry.role === "string" ? { role: entry.role } : {} } : {};
|
|
16379
|
+
(Array.isArray(section?.sets) ? section.sets : []).forEach((set2, index) => {
|
|
16380
|
+
if (isWeighingSetShape(set2) && !sets.some((s) => s.id === set2.id)) sets.push(cleaned(set2));
|
|
16381
|
+
else skipped.push({ kind: "set", ...idOf(set2), index });
|
|
16382
|
+
});
|
|
16383
|
+
(Array.isArray(section?.matrices) ? section.matrices : []).forEach((matrix, index) => {
|
|
16384
|
+
if (isWeighingMatrixShape(matrix) && !matrices.some((m) => m.id === matrix.id)) matrices.push(matrix);
|
|
16385
|
+
else skipped.push({ kind: "matrix", ...idOf(matrix), index });
|
|
16386
|
+
});
|
|
16387
|
+
return { sets, matrices, skipped };
|
|
16388
|
+
}
|
|
16389
|
+
function setOfRef(resolved, ref) {
|
|
16390
|
+
const { id, major } = splitSetRef(ref);
|
|
16391
|
+
return resolved.sets.find((candidate) => candidate.id === id && (major === void 0 || majorOf(candidate.version) === major));
|
|
16392
|
+
}
|
|
16393
|
+
function isOlderMajorRef(resolved, ref) {
|
|
16394
|
+
const { id, major } = splitSetRef(ref);
|
|
16395
|
+
const current = resolved.sets.find((candidate) => candidate.id === id);
|
|
16396
|
+
if (current === void 0 || major === void 0) return false;
|
|
16397
|
+
const now = Number(majorOf(current.version));
|
|
16398
|
+
return Number.isFinite(now) && Number(major) < now;
|
|
16399
|
+
}
|
|
16400
|
+
|
|
16401
|
+
// ../schema/src/weighing-validate.ts
|
|
16402
|
+
var isObject3 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16403
|
+
function validateWeighingSection(section, nodeSpecies, journal) {
|
|
16404
|
+
const out = [];
|
|
16405
|
+
const warn = (path, rule, message) => out.push({ path, rule, message });
|
|
16406
|
+
if (section !== void 0 && section !== null && !isObject3(section)) {
|
|
16407
|
+
warn("weighing", "weighing-section-shape", "The weighing section is not an object \u2014 it is ignored");
|
|
16408
|
+
}
|
|
16409
|
+
if (isObject3(section)) {
|
|
16410
|
+
for (const list of ["sets", "matrices", "assessments"]) {
|
|
16411
|
+
if (section[list] !== void 0 && !Array.isArray(section[list])) {
|
|
16412
|
+
warn(`weighing.${list}`, "weighing-section-shape", `weighing.${list} is not an array \u2014 it is ignored`);
|
|
16413
|
+
}
|
|
16414
|
+
}
|
|
16415
|
+
const sets = Array.isArray(section.sets) ? section.sets : [];
|
|
16416
|
+
const matrices = Array.isArray(section.matrices) ? section.matrices : [];
|
|
16417
|
+
const assessments = Array.isArray(section.assessments) ? section.assessments : [];
|
|
16418
|
+
const resolved = resolveWeighing(section);
|
|
16419
|
+
const resolveRef2 = (ref, path, who, unknownRule) => {
|
|
16420
|
+
const set2 = setOfRef(resolved, ref);
|
|
16421
|
+
if (set2 !== void 0) return set2;
|
|
16422
|
+
const named = resolved.sets.find((candidate) => candidate.id === splitSetRef(ref).id);
|
|
16423
|
+
if (named !== void 0) {
|
|
16424
|
+
warn(path, "weighing-set-ref-major", `${who} names ${ref}, but "${named.id}" is at ${named.version} \u2014 levels are comparable only within a major, so the ref resolves to nothing`);
|
|
16425
|
+
} else {
|
|
16426
|
+
warn(path, unknownRule, `${who} names set "${ref}", which is neither built in nor in this section`);
|
|
16427
|
+
}
|
|
16428
|
+
return void 0;
|
|
16429
|
+
};
|
|
16430
|
+
const positioningIds = new Set(
|
|
16431
|
+
resolved.matrices.map((matrix) => matrix.positioning).filter((id) => typeof id === "string")
|
|
16432
|
+
);
|
|
16433
|
+
const checkStatus = (path, who, entry) => {
|
|
16434
|
+
if (entry.status !== void 0 && entry.status !== "draft" && entry.status !== "active") {
|
|
16435
|
+
warn(`${path}.status`, "weighing-set-status", `${who}: status ${JSON.stringify(entry.status)} is not "draft" or "active" \u2014 it is read as a draft, which feeds no roll-up`);
|
|
16436
|
+
}
|
|
16437
|
+
};
|
|
16438
|
+
const isLevelMap = (value) => isObject3(value) && Object.values(value).every((anchor) => typeof anchor === "string");
|
|
16439
|
+
const seenSets = /* @__PURE__ */ new Set();
|
|
16440
|
+
sets.forEach((entry, index) => {
|
|
16441
|
+
const path = `weighing.sets[${index}]`;
|
|
16442
|
+
if (!isObject3(entry)) {
|
|
16443
|
+
warn(path, "weighing-set-shape", "A set is not an object \u2014 it is ignored");
|
|
16444
|
+
return;
|
|
16445
|
+
}
|
|
16446
|
+
const who = `Set "${String(entry.id)}"`;
|
|
16447
|
+
const wellFormed = isWeighingSetShape(entry);
|
|
16448
|
+
if (!wellFormed) {
|
|
16449
|
+
warn(path, "weighing-set-shape", `${who} needs a string id and version, a criteria array and a scale object (a positioning may leave the scale out) \u2014 it is ignored`);
|
|
16450
|
+
}
|
|
16451
|
+
if (typeof entry.id === "string") {
|
|
16452
|
+
if (BUILT_IN_SETS.some((set2) => set2.id === entry.id)) {
|
|
16453
|
+
warn(`${path}.id`, "weighing-pinned-set-redefined", `${who} is built in and pinned by version \u2014 the project's copy is ignored`);
|
|
16454
|
+
} else if (wellFormed) {
|
|
16455
|
+
if (seenSets.has(entry.id)) warn(`${path}.id`, "weighing-duplicate-set", `Duplicate set id "${entry.id}" \u2014 the first well-formed one wins, this one is ignored`);
|
|
16456
|
+
seenSets.add(entry.id);
|
|
16457
|
+
}
|
|
16458
|
+
}
|
|
16459
|
+
checkStatus(path, who, entry);
|
|
16460
|
+
if (isObject3(entry.scale)) {
|
|
16461
|
+
const scale = entry.scale;
|
|
16462
|
+
if (typeof scale.min !== "number" || typeof scale.max !== "number" || !isLevelMap(scale.anchors)) {
|
|
16463
|
+
warn(`${path}.scale`, "weighing-scale-shape", `${who}: a scale needs a numeric min and max and an anchors object of strings`);
|
|
16464
|
+
}
|
|
16465
|
+
}
|
|
16466
|
+
if (Array.isArray(entry.criteria)) {
|
|
16467
|
+
entry.criteria.forEach((criterion, at) => {
|
|
16468
|
+
const cpath = `${path}.criteria[${at}]`;
|
|
16469
|
+
if (!isObject3(criterion) || typeof criterion.id !== "string" || criterion.anchors !== void 0 && !isLevelMap(criterion.anchors)) {
|
|
16470
|
+
warn(cpath, "weighing-criterion-shape", `${who}: criterion ${at} needs a string id, and its anchors (if any) must be an object of strings`);
|
|
16471
|
+
}
|
|
16472
|
+
});
|
|
16473
|
+
}
|
|
16474
|
+
if (entry.role === "positioning" && !(typeof entry.id === "string" && positioningIds.has(entry.id))) {
|
|
16475
|
+
warn(`${path}.id`, "weighing-positioning-id", `A positioning set must have the id "${POSITIONING_SET_ID}" (the one a matrix points at) \u2014 "${String(entry.id)}" would never be applied`);
|
|
16476
|
+
} else if (entry.role !== "positioning" && entry.id === POSITIONING_SET_ID) {
|
|
16477
|
+
warn(`${path}.role`, "weighing-positioning-id", `Set "${POSITIONING_SET_ID}" is where a matrix looks for its positioning, but its role is ${JSON.stringify(entry.role)}, not "positioning" \u2014 it would never be applied`);
|
|
16478
|
+
}
|
|
16479
|
+
if (entry.role === "positioning") {
|
|
16480
|
+
const ruler = typeof entry.extends === "string" ? resolveRef2(entry.extends, `${path}.extends`, `Positioning "${String(entry.id)}"`, "weighing-positioning-unknown-ruler") : void 0;
|
|
16481
|
+
if (typeof entry.extends !== "string") {
|
|
16482
|
+
warn(`${path}.extends`, "weighing-positioning-unknown-ruler", `Positioning "${String(entry.id)}" does not say which set it re-weights \u2014 set extends to e.g. value-contribution@2`);
|
|
16483
|
+
} else if (ruler !== void 0 && ruler.role === "positioning") {
|
|
16484
|
+
warn(`${path}.extends`, "weighing-positioning-unknown-ruler", `Positioning "${String(entry.id)}" extends "${entry.extends}", which is itself a positioning \u2014 it must extend a criteria set such as value-contribution@2`);
|
|
16485
|
+
} else if (ruler !== void 0 && isOlderMajorRef(resolved, entry.extends)) {
|
|
16486
|
+
warn(`${path}.extends`, "weighing-positioning-old-ruler", `Positioning "${String(entry.id)}" extends ${entry.extends}, an older ruler \u2014 its weights still apply, but read its level descriptions against ${ruler.id}'s current major and save it again`);
|
|
16487
|
+
}
|
|
16488
|
+
const known = new Set(ruler !== void 0 && ruler.role !== "positioning" ? ruler.criteria.map((criterion) => criterion?.id) : []);
|
|
16489
|
+
(Array.isArray(entry.criteria) ? entry.criteria : []).forEach((criterion, at) => {
|
|
16490
|
+
if (!isObject3(criterion)) return;
|
|
16491
|
+
const cpath = `${path}.criteria[${at}]`;
|
|
16492
|
+
if (known.size > 0 && typeof criterion.id === "string" && !known.has(criterion.id)) {
|
|
16493
|
+
warn(`${cpath}.id`, "weighing-positioning-unknown-element", `Positioning names "${criterion.id}", which is not in ${String(entry.extends)}`);
|
|
16494
|
+
}
|
|
16495
|
+
if (criterion.weight !== void 0 && (typeof criterion.weight !== "number" || !(criterion.weight > 0))) {
|
|
16496
|
+
warn(`${cpath}.weight`, "weighing-positioning-weight", `Positioning weight for "${String(criterion.id)}" must be a number above 0 \u2014 leave the element out to leave it unpositioned`);
|
|
16497
|
+
}
|
|
16498
|
+
});
|
|
16499
|
+
}
|
|
16500
|
+
});
|
|
16501
|
+
const seenMatrices = /* @__PURE__ */ new Set();
|
|
16502
|
+
matrices.forEach((entry, index) => {
|
|
16503
|
+
const path = `weighing.matrices[${index}]`;
|
|
16504
|
+
if (!isObject3(entry)) {
|
|
16505
|
+
warn(path, "weighing-matrix-shape", "A matrix is not an object \u2014 it is ignored");
|
|
16506
|
+
return;
|
|
16507
|
+
}
|
|
16508
|
+
const who = `Matrix "${String(entry.id)}"`;
|
|
16509
|
+
const wellFormed = isWeighingMatrixShape(entry);
|
|
16510
|
+
if (!wellFormed) {
|
|
16511
|
+
warn(path, "weighing-matrix-shape", `${who} needs a string id, a set ref and a subjects object of kind query or list \u2014 it is ignored`);
|
|
16512
|
+
}
|
|
16513
|
+
if (typeof entry.id === "string") {
|
|
16514
|
+
if (BUILT_IN_MATRICES.some((matrix) => matrix.id === entry.id)) {
|
|
16515
|
+
warn(`${path}.id`, "weighing-pinned-matrix-redefined", `${who} is built in \u2014 the project's copy is ignored`);
|
|
16516
|
+
} else if (wellFormed) {
|
|
16517
|
+
if (seenMatrices.has(entry.id)) warn(`${path}.id`, "weighing-duplicate-matrix", `Duplicate matrix id "${entry.id}" \u2014 the first well-formed one wins, this one is ignored`);
|
|
16518
|
+
seenMatrices.add(entry.id);
|
|
16519
|
+
}
|
|
16520
|
+
}
|
|
16521
|
+
checkStatus(path, who, entry);
|
|
16522
|
+
if (wellFormed && resolveRef2(entry.set, `${path}.set`, who, "weighing-unknown-set") !== void 0 && isOlderMajorRef(resolved, entry.set)) {
|
|
16523
|
+
warn(`${path}.set`, "weighing-matrix-old-ruler", `${who} reads ${entry.set}, an older ruler \u2014 its levels still read, but nothing new can be scored on it; point it at the current major`);
|
|
16524
|
+
}
|
|
16525
|
+
});
|
|
16526
|
+
const seenCells = /* @__PURE__ */ new Set();
|
|
16527
|
+
assessments.forEach((entry, index) => {
|
|
16528
|
+
const path = `weighing.assessments[${index}]`;
|
|
16529
|
+
const label = `Assessment ${index}`;
|
|
16530
|
+
if (!isWeighingAssessmentShape(entry)) {
|
|
16531
|
+
warn(path, "weighing-assessment-shape", `${label}: not an object with a string matrix, subject and criterion \u2014 it cannot be addressed, so every reader skips it`);
|
|
16532
|
+
return;
|
|
16533
|
+
}
|
|
16534
|
+
if (typeof entry.ts !== "string" || Number.isNaN(Date.parse(entry.ts))) {
|
|
16535
|
+
warn(`${path}.ts`, "weighing-assessment-ts", `${label}: ts must be an ISO 8601 string \u2014 without it "latest wins" cannot order this row`);
|
|
16536
|
+
}
|
|
16537
|
+
const matrix = resolved.matrices.find((candidate) => candidate.id === entry.matrix);
|
|
16538
|
+
if (matrix === void 0) {
|
|
16539
|
+
warn(`${path}.matrix`, "weighing-unknown-matrix", `${label}: matrix "${entry.matrix}" is not defined`);
|
|
16540
|
+
}
|
|
16541
|
+
const set2 = matrix === void 0 ? void 0 : setOfRef(resolved, matrix.set);
|
|
16542
|
+
const criterion = set2?.criteria.find((candidate) => candidate?.id === entry.criterion);
|
|
16543
|
+
if (set2 !== void 0 && criterion === void 0) {
|
|
16544
|
+
warn(`${path}.criterion`, "weighing-unknown-criterion", `${label}: criterion "${entry.criterion}" is not in set "${set2.id}"`);
|
|
16545
|
+
}
|
|
16546
|
+
if (criterion !== void 0 && typeof criterion.superseded_by === "string" && criterion.superseded_by !== "") {
|
|
16547
|
+
warn(`${path}.criterion`, "weighing-retired-criterion", `${label}: criterion "${criterion.id}" is retired \u2014 superseded by "${criterion.superseded_by}"`);
|
|
16548
|
+
}
|
|
16549
|
+
const scale = set2 === void 0 ? void 0 : weighingScaleOf(set2, resolved);
|
|
16550
|
+
const min = typeof scale?.min === "number" ? scale.min : -3;
|
|
16551
|
+
const max = typeof scale?.max === "number" ? scale.max : 3;
|
|
16552
|
+
if (typeof entry.level !== "number" || !Number.isInteger(entry.level) || entry.level < min || entry.level > max) {
|
|
16553
|
+
warn(`${path}.level`, "weighing-level-range", `${label}: level must be an integer ${min}..${max} (a blank cell is the absence of the row; 0 means weighed and unrelated)`);
|
|
16554
|
+
}
|
|
16555
|
+
if (![0, 1, 2, 3].includes(entry.confidence)) {
|
|
16556
|
+
warn(`${path}.confidence`, "weighing-confidence-range", `${label}: confidence must be 0, 1, 2 or 3`);
|
|
16557
|
+
}
|
|
16558
|
+
const scorer = isObject3(entry.scorer) ? entry.scorer : void 0;
|
|
16559
|
+
if (scorer === void 0 || typeof scorer.kind !== "string" || typeof scorer.id !== "string" || scorer.id === "") {
|
|
16560
|
+
warn(`${path}.scorer`, "weighing-scorer-missing", `${label}: no scorer with a string kind and id \u2014 human, agent and rule levels become indistinguishable, and the row can win no cell`);
|
|
16561
|
+
} else if (!SCORER_KINDS.includes(scorer.kind)) {
|
|
16562
|
+
warn(`${path}.scorer.kind`, "weighing-scorer-kind", `${label}: scorer kind "${scorer.kind}" is not one of ${SCORER_KINDS.join(", ")} \u2014 it ranks below every other scorer`);
|
|
16563
|
+
} else if (!STORED_SCORER_KINDS.includes(scorer.kind)) {
|
|
16564
|
+
warn(`${path}.scorer.kind`, "weighing-rule-stored", `${label}: scorer kind "${scorer.kind}" is never stored \u2014 a seeding rule is computed on read`);
|
|
16565
|
+
}
|
|
16566
|
+
if (matrix?.subjects.kind === "query") {
|
|
16567
|
+
const species = nodeSpecies.get(entry.subject);
|
|
16568
|
+
if (species === void 0) {
|
|
16569
|
+
warn(`${path}.subject`, "weighing-unknown-subject", `${label}: subject "${entry.subject}" is not a node in this bundle`);
|
|
16570
|
+
} else if (species !== matrix.subjects.species) {
|
|
16571
|
+
warn(`${path}.subject`, "weighing-subject-species", `${label}: subject "${entry.subject}" is a ${species}, and matrix "${matrix.id}" judges ${String(matrix.subjects.species)} nodes`);
|
|
16572
|
+
}
|
|
16573
|
+
}
|
|
16574
|
+
if (entry.evidence !== void 0 && typeof entry.evidence !== "string") {
|
|
16575
|
+
warn(`${path}.evidence`, "weighing-evidence-type", `${label}: evidence must be a markdown string`);
|
|
16576
|
+
} else if ((entry.confidence === 2 || entry.confidence === 3) && (entry.evidence === void 0 || entry.evidence.trim() === "")) {
|
|
16577
|
+
warn(`${path}.evidence`, "weighing-no-evidence", `${label}: confidence ${String(entry.confidence)} claims evidence and cites none`);
|
|
16578
|
+
}
|
|
16579
|
+
for (const field of WEIGHING_PROBABILITY_FIELDS) {
|
|
16580
|
+
if (entry[field] !== void 0 && !isWeighingProbability(entry[field])) {
|
|
16581
|
+
warn(`${path}.${field}`, "weighing-probability-shape", `${label}: ${field} must be a number from 0 to 1 \u2014 it is ignored`);
|
|
16582
|
+
}
|
|
16583
|
+
}
|
|
16584
|
+
if (entry.refs !== void 0 && !(Array.isArray(entry.refs) && entry.refs.every((ref) => typeof ref === "string"))) {
|
|
16585
|
+
warn(`${path}.refs`, "weighing-refs-type", `${label}: refs must be an array of id strings`);
|
|
16586
|
+
}
|
|
16587
|
+
if (entry.basis !== void 0 && !(isObject3(entry.basis) && ["fingerprint", "commit", "set_version"].every((key) => entry.basis[key] === void 0 || typeof entry.basis[key] === "string"))) {
|
|
16588
|
+
warn(`${path}.basis`, "weighing-basis-shape", `${label}: basis must be an object whose fingerprint, commit and set_version are strings`);
|
|
16589
|
+
}
|
|
16590
|
+
if (scorer !== void 0 && typeof scorer.kind === "string") {
|
|
16591
|
+
const key = assessmentKey(entry);
|
|
16592
|
+
if (seenCells.has(key)) {
|
|
16593
|
+
warn(path, "weighing-duplicate-assessment", `${label}: a second ${scorer.kind} score for the same cell \u2014 the section stores latest-per-scorer-kind, so this cell is ambiguous`);
|
|
16594
|
+
}
|
|
16595
|
+
seenCells.add(key);
|
|
16596
|
+
}
|
|
16597
|
+
const setVersion = isObject3(entry.basis) && typeof entry.basis.set_version === "string" ? entry.basis.set_version : void 0;
|
|
16598
|
+
if (set2 !== void 0 && setVersion !== void 0 && majorOf(setVersion) !== majorOf(set2.version)) {
|
|
16599
|
+
warn(`${path}.basis.set_version`, "weighing-set-major", `${label}: scored against ${set2.id} ${setVersion}, and the set is now ${set2.version} \u2014 levels are comparable only within a major`);
|
|
16600
|
+
}
|
|
16601
|
+
});
|
|
16602
|
+
}
|
|
16603
|
+
journal.forEach((entry, index) => {
|
|
16604
|
+
if (!isObject3(entry)) return;
|
|
16605
|
+
const type = typeof entry.type === "string" ? entry.type : "";
|
|
16606
|
+
if (type !== WEIGHING_ASSESSMENT_RECORDED && type !== WEIGHING_SET_SAVED) return;
|
|
16607
|
+
if (typeof entry.actor !== "string" || entry.actor.trim() === "") {
|
|
16608
|
+
warn(`journal[${index}].actor`, "weighing-event-no-actor", `Journal event ${index}: ${type} has no actor \u2014 human, agent and CI scores become indistinguishable`);
|
|
16609
|
+
}
|
|
16610
|
+
});
|
|
16611
|
+
return out;
|
|
16612
|
+
}
|
|
16613
|
+
|
|
15813
16614
|
// ../schema/src/validate.ts
|
|
15814
16615
|
var VALID_STAGES = ["beta", "monitoring", "deprecated"];
|
|
15815
16616
|
var VALID_VIEW_CARD_VARIANTS = ["compact", "large"];
|
|
@@ -16660,6 +17461,13 @@ function validateBundle(input) {
|
|
|
16660
17461
|
}
|
|
16661
17462
|
});
|
|
16662
17463
|
}
|
|
17464
|
+
const weighing = bundle.weighing;
|
|
17465
|
+
const embeddedJournal = Array.isArray(bundle.journal) ? bundle.journal : [];
|
|
17466
|
+
const weighingSpecies = /* @__PURE__ */ new Map();
|
|
17467
|
+
for (const [id, node] of nodeMap) weighingSpecies.set(id, String(node.species));
|
|
17468
|
+
for (const finding of validateWeighingSection(weighing, weighingSpecies, embeddedJournal)) {
|
|
17469
|
+
warn(finding.path, finding.rule, finding.message);
|
|
17470
|
+
}
|
|
16663
17471
|
for (const finding of crossCheckJournal(bundle)) findings.push(finding);
|
|
16664
17472
|
return result();
|
|
16665
17473
|
}
|
|
@@ -16720,6 +17528,10 @@ function makeEvent(type, payload = {}, options = {}) {
|
|
|
16720
17528
|
return schema.parse(event);
|
|
16721
17529
|
}
|
|
16722
17530
|
|
|
17531
|
+
// ../schema/src/weighing-derive.ts
|
|
17532
|
+
var SEED_SCORER_ID = "seed-claimed";
|
|
17533
|
+
var SEED_SCORER = Object.freeze({ kind: "rule", id: SEED_SCORER_ID });
|
|
17534
|
+
|
|
16723
17535
|
// src/lib/bundle-io.ts
|
|
16724
17536
|
function readBundle(filePath) {
|
|
16725
17537
|
if (!existsSync(filePath)) throw new Error(`File not found: ${filePath}`);
|
|
@@ -16888,8 +17700,65 @@ function resolveQualityRoot(options) {
|
|
|
16888
17700
|
return options.fallback;
|
|
16889
17701
|
}
|
|
16890
17702
|
|
|
17703
|
+
// ../schema/src/cli/weighing-files.ts
|
|
17704
|
+
import { existsSync as existsSync5, readdirSync as readdirSync2 } from "node:fs";
|
|
17705
|
+
import { join as join4 } from "node:path";
|
|
17706
|
+
var WEIGHING_DIR = "docs/weighing";
|
|
17707
|
+
var WEIGHING_SETS_DIR = "sets";
|
|
17708
|
+
var WEIGHING_ASSESSMENTS_DIR = "assessments";
|
|
17709
|
+
var weighingDir = (root) => join4(root, WEIGHING_DIR);
|
|
17710
|
+
function jsonFilesIn(dir) {
|
|
17711
|
+
if (!existsSync5(dir)) return [];
|
|
17712
|
+
return readdirSync2(dir).filter((name) => name.endsWith(".json")).sort().map((name) => join4(dir, name));
|
|
17713
|
+
}
|
|
17714
|
+
function assessmentsOfFile(file2) {
|
|
17715
|
+
const parsed = readJson(file2);
|
|
17716
|
+
const assessments = typeof parsed === "object" && parsed !== null ? parsed.assessments : void 0;
|
|
17717
|
+
if (!Array.isArray(assessments)) throw new Error(`${file2}: expected { "matrix": \u2026, "assessments": [] }`);
|
|
17718
|
+
return assessments;
|
|
17719
|
+
}
|
|
17720
|
+
function loadWeighingSets(root) {
|
|
17721
|
+
return jsonFilesIn(join4(weighingDir(root), WEIGHING_SETS_DIR)).map((file2) => {
|
|
17722
|
+
const parsed = readJson(file2);
|
|
17723
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw new Error(`${file2}: expected a criteria set object`);
|
|
17724
|
+
return parsed;
|
|
17725
|
+
});
|
|
17726
|
+
}
|
|
17727
|
+
function loadWeighingAssessments(root) {
|
|
17728
|
+
return jsonFilesIn(join4(weighingDir(root), WEIGHING_ASSESSMENTS_DIR)).flatMap(assessmentsOfFile);
|
|
17729
|
+
}
|
|
17730
|
+
function loadWeighingSection(root) {
|
|
17731
|
+
const sets = loadWeighingSets(root);
|
|
17732
|
+
const assessments = loadWeighingAssessments(root);
|
|
17733
|
+
if (sets.length === 0 && assessments.length === 0) return void 0;
|
|
17734
|
+
return { sets, matrices: [], assessments: sortWeighingAssessments(assessments) };
|
|
17735
|
+
}
|
|
17736
|
+
|
|
17737
|
+
// src/lib/weighing-io.ts
|
|
17738
|
+
function isSection(value) {
|
|
17739
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17740
|
+
}
|
|
17741
|
+
function foldWeighingSection(bundle, root) {
|
|
17742
|
+
const section = loadWeighingSection(root);
|
|
17743
|
+
if (section === void 0) {
|
|
17744
|
+
const carriedSection = isSection(bundle.weighing);
|
|
17745
|
+
return {
|
|
17746
|
+
folded: false,
|
|
17747
|
+
carriedSection,
|
|
17748
|
+
notice: carriedSection ? `Weighing: none to fold \u2014 no files under ${weighingDir(root)}
|
|
17749
|
+
Kept the weighing section this bundle already carried \u2014 nothing replaced it.` : `Weighing: none to fold \u2014 no files under ${weighingDir(root)}`
|
|
17750
|
+
};
|
|
17751
|
+
}
|
|
17752
|
+
bundle.weighing = section;
|
|
17753
|
+
return {
|
|
17754
|
+
folded: true,
|
|
17755
|
+
carriedSection: false,
|
|
17756
|
+
notice: `Weighing: folded ${section.assessments?.length ?? 0} assessment(s), ${section.sets?.length ?? 0} set(s) from ${weighingDir(root)}`
|
|
17757
|
+
};
|
|
17758
|
+
}
|
|
17759
|
+
|
|
16891
17760
|
// src/lib/bundle-validate.ts
|
|
16892
|
-
import { existsSync as
|
|
17761
|
+
import { existsSync as existsSync6, readFileSync as readFileSync4 } from "node:fs";
|
|
16893
17762
|
import { basename as basename2 } from "node:path";
|
|
16894
17763
|
function validateBundleAt(filePath) {
|
|
16895
17764
|
const bundle = readBundle(filePath);
|
|
@@ -16904,7 +17773,7 @@ function validateBundleAt(filePath) {
|
|
|
16904
17773
|
if (loose.journal === void 0) {
|
|
16905
17774
|
const sidecarPath = journalPathFor(filePath);
|
|
16906
17775
|
const folded = [];
|
|
16907
|
-
if (
|
|
17776
|
+
if (existsSync6(sidecarPath)) {
|
|
16908
17777
|
const { events, findings } = parseJournalLines(readFileSync4(sidecarPath, "utf8"));
|
|
16909
17778
|
sidecarFindings = findings;
|
|
16910
17779
|
sidecarLoaded = true;
|
|
@@ -16953,6 +17822,7 @@ export {
|
|
|
16953
17822
|
archivePathsFor,
|
|
16954
17823
|
compactSlice,
|
|
16955
17824
|
ensureJournalBaseline,
|
|
17825
|
+
foldWeighingSection,
|
|
16956
17826
|
journalLineErrorLines,
|
|
16957
17827
|
journalPathFor,
|
|
16958
17828
|
loadJournalEvents,
|