@validation-os/core 0.5.0 → 0.6.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/chunk-22WJF5EZ.js +572 -0
- package/dist/chunk-22WJF5EZ.js.map +1 -0
- package/dist/{chunk-W7VU5JOU.js → chunk-43RQBE2E.js} +1 -12
- package/dist/{chunk-W7VU5JOU.js.map → chunk-43RQBE2E.js.map} +1 -1
- package/dist/derivation/index.d.ts +2 -2
- package/dist/derivation/index.js +33 -5
- package/dist/index-BlXH_thK.d.ts +577 -0
- package/dist/index.d.ts +6 -31
- package/dist/index.js +22 -26
- package/dist/index.js.map +1 -1
- package/dist/{provider-hW8Hxf-n.d.ts → provider-DGr5Xq5U.d.ts} +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +1 -1
- package/dist/{types-B3eI7ASx.d.ts → types-BAyl0w2E.d.ts} +66 -32
- package/package.json +1 -1
- package/dist/chunk-4Q2B2QT3.js +0 -279
- package/dist/chunk-4Q2B2QT3.js.map +0 -1
- package/dist/index-CieW13mJ.d.ts +0 -234
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/derivation/index.ts","../src/derivation/round.ts","../src/types.ts","../src/derivation/rung.ts","../src/derivation/strength.ts","../src/derivation/source-quality.ts","../src/derivation/confidence.ts","../src/derivation/attribution.ts","../src/derivation/progress.ts","../src/derivation/trajectory.ts","../src/derivation/impact.ts","../src/derivation/risk.ts"],"sourcesContent":["/**\n * The shared derivation module — pure functions, no I/O.\n *\n * The same module the dashboard, the API (derive-on-write), and Claude Code\n * audits all call, so every writer computes the four derived numbers\n * identically. Ported from `doshi-validation-os/migration/remodel.mjs` and\n * kept in lock-step with `skills/_shared/ontology.yaml`.\n */\nexport { round2 } from \"./round.js\";\nexport {\n RUNG_ANCHOR,\n GOAL_RUNG_ANCHOR,\n isGoalRung,\n} from \"./rung.js\";\nexport { sign, isConcluded, readingStrength } from \"./strength.js\";\nexport type { StrengthInput } from \"./strength.js\";\nexport { sourceQuality } from \"./source-quality.js\";\nexport { confidence, scoreAndDedupe, W0 } from \"./confidence.js\";\nexport type { ConfidenceReadingInput, Scored } from \"./confidence.js\";\nexport { confidenceAttribution } from \"./attribution.js\";\nexport type {\n Attribution,\n AttributionReadingInput,\n Mover,\n MoverKind,\n} from \"./attribution.js\";\nexport { experimentProgress } from \"./progress.js\";\nexport type { BarLineInput, Progress } from \"./progress.js\";\nexport { confidenceTrajectory } from \"./trajectory.js\";\nexport type { TrajectoryPoint } from \"./trajectory.js\";\nexport { derivedImpacts } from \"./impact.js\";\nexport type { ImpactAssumptionInput } from \"./impact.js\";\nexport { risk } from \"./risk.js\";\n","/**\n * Round to 2 decimals, matching the migration's `+(n).toFixed(2)`.\n * Derived values are stored/displayed rounded; full precision is only used\n * transiently inside a single computation.\n */\nexport function round2(n: number): number {\n return Number(n.toFixed(2));\n}\n","/**\n * Shared registry types — the field vocabulary the whole system speaks.\n *\n * These mirror `skills/_shared/registry-schema.md` and `ontology.yaml` (the\n * single source of truth). Field *meaning* lives there; this file is the\n * checkable TypeScript shape the packages import.\n */\n\n/** The six registers plus the `people` reference collection. */\nexport const REGISTERS = [\n \"assumptions\",\n \"experiments\",\n \"readings\",\n \"goals\",\n \"decisions\",\n \"glossary\",\n] as const;\nexport type Register = (typeof REGISTERS)[number];\n\n/** `people` is a reference collection, not one of the six registers. */\nexport type Collection = Register | \"people\";\n\n/** Every stored record carries an id, a version, and timestamps. */\nexport interface BaseRecord {\n id: string;\n /** Optimistic-concurrency token; bumped on every write. */\n version: number;\n createdAt: string;\n updatedAt: string;\n}\n\n// ── Vocabularies (canonical select-option lists) ────────────────────────────\n\nexport type AssumptionStatus = \"Draft\" | \"Live\" | \"Invalidated\";\nexport type ExperimentStatus = \"Running\" | \"Closed\";\nexport type GoalStatus = \"Draft\" | \"Active\" | \"Closed\";\nexport type DecisionStatus =\n | \"Active\"\n | \"Provisional\"\n | \"Superseded\"\n | \"Reversed\";\nexport type GlossaryStatus = \"Active\" | \"Provisional\" | \"Superseded\";\n\nexport type Result = \"Validated\" | \"Invalidated\" | \"Inconclusive\";\nexport type MagnitudeBand = \"Low\" | \"Typical\" | \"High\";\nexport type Feasibility = \"High\" | \"Medium\" | \"Low\";\n\n/** The 8-rung activity-and-strength ladder (order = strength, weakest first). */\nexport const TESTING_RUNGS = [\n \"Opinion\",\n \"Pitch-deck reaction\",\n \"Anecdotal\",\n \"Desk research\",\n \"Survey at scale\",\n \"Prototype usage\",\n] as const;\nexport const GOAL_RUNG_VALUES = [\"Signed intent\", \"Paying users\"] as const;\nexport type TestingRung = (typeof TESTING_RUNGS)[number];\nexport type GoalRung = (typeof GOAL_RUNG_VALUES)[number];\nexport type Rung = TestingRung | GoalRung;\n\n/** Representativeness and Credibility are each picked from these. */\nexport type SourceQualityPick = 1.0 | 0.7 | 0.5;\n\n// ── Records ─────────────────────────────────────────────────────────────────\n\n/** The four derived numbers stored on an assumption (never hand-typed). */\nexport interface AssumptionDerived {\n derivedImpact: number;\n risk: number;\n confidence: number;\n}\n\nexport interface AssumptionRecord extends BaseRecord {\n Title: string;\n Description: string;\n Lens: string | null;\n Theme: string[];\n /** The hand-scored seed (0–100), the only hand-scored number here. */\n Impact: number | null;\n Status: AssumptionStatus;\n Owner: string[];\n Gaps: string[];\n moot: boolean;\n /**\n * Presence-gap fields — long-form prose promoted from body sections to\n * first-class fields (OPS-1273). Their PRESENCE is a structural, blocking\n * check (see `presence.ts`): non-empty is required to move Status to `Live`\n * (the presence half of the Draft→Live gaps invariant, OPS-1251). May be\n * empty (\"\") while `Draft`.\n */\n \"5 Whys\": string;\n \"Metric for truth\": string;\n \"Scoring justification\": string;\n dependsOnIds: string[];\n enablesIds: string[];\n contradictsIds: string[];\n readingIds: string[];\n derived: AssumptionDerived;\n}\n\nexport interface ReadingRecord extends BaseRecord {\n Title: string;\n /** First-class link to the artifact — the independence-dedupe key. */\n Source: string | null;\n assumptionId: string;\n experimentId: string | null;\n goalId: string | null;\n Rung: Rung;\n Representativeness: SourceQualityPick;\n Credibility: SourceQualityPick;\n /** For Goal-rung readings: the magnitude band from the absolute outcome. */\n magnitudeBand?: MagnitudeBand;\n Result: Result;\n Date: string | null;\n Owner: string[];\n derived: { sourceQuality: number; strength: number };\n}\n\n/**\n * A pre-registered bar line — the per-belief pass/fail test on an experiment,\n * stored as an embedded array on the experiment (no identity of its own; see\n * `connectors/nosql-schema.md`). `barVerdict` is set once at closure and is a\n * report only — never folded into Confidence.\n */\nexport interface BarLine {\n assumptionId: string;\n rightIf: string;\n wrongIf?: string | null;\n plannedRung: Rung;\n barVerdict?: Result | null;\n}\n\nexport interface ExperimentRecord extends BaseRecord {\n Title: string;\n Instrument: string | null;\n Feasibility: Feasibility | null;\n Status: ExperimentStatus;\n closureReason: \"Completed\" | \"Early-stop\" | \"Kill\" | null;\n Owner: string[];\n Date: string | null;\n /** The embedded pre-registered bar lines; drives progress-to-conclusion. */\n barLines: BarLine[];\n /** Convenience projection: the assumptions the bar lines test. */\n barLineAssumptionIds: string[];\n}\n\nexport interface GoalRecord extends BaseRecord {\n Title: string;\n Status: GoalStatus;\n Outcome: \"Achieved\" | \"Missed\" | \"Dropped\" | null;\n Owner: string[];\n Date: string | null;\n basedOnIds: string[];\n}\n\nexport interface DecisionRecord extends BaseRecord {\n Title: string;\n Status: DecisionStatus;\n Owner: string[];\n basedOnIds: string[];\n resolvesIds: string[];\n}\n\nexport interface GlossaryRecord extends BaseRecord {\n Title: string;\n Status: GlossaryStatus;\n}\n\n/** A record of any register — the DataProvider's currency. */\nexport type AnyRecord = BaseRecord & Record<string, unknown>;\n\n// ── Relations (both-ends links) ─────────────────────────────────────────────\n\n/** A pointer to one record. */\nexport interface RecordRef {\n register: Collection;\n id: string;\n}\n\n/** The relations the dashboard can set (each writes both ends). */\nexport type Relation =\n | \"assumption-reading\"\n | \"assumption-depends-on\"\n | \"assumption-contradicts\"\n | \"reading-experiment\"\n | \"reading-goal\"\n | \"decision-based-on\"\n | \"decision-resolves\"\n | \"goal-based-on\";\n","/**\n * The evidence ladder anchors that feed Strength.\n *\n * Source of truth: `skills/_shared/ontology.yaml` → `vocabularies.rung`.\n * Testing rungs carry a single anchor; Goal rungs carry a magnitude band\n * (Low/Typical/High) picked from the absolute outcome.\n */\nimport type { GoalRung, MagnitudeBand, Rung, TestingRung } from \"../types.js\";\nimport { GOAL_RUNG_VALUES } from \"../types.js\";\n\nexport const RUNG_ANCHOR: Record<TestingRung, number> = {\n Opinion: 3,\n \"Pitch-deck reaction\": 6,\n Anecdotal: 10,\n \"Desk research\": 15,\n \"Survey at scale\": 25,\n \"Prototype usage\": 30,\n};\n\nexport const GOAL_RUNG_ANCHOR: Record<GoalRung, Record<MagnitudeBand, number>> =\n {\n \"Signed intent\": { Low: 55, Typical: 68, High: 80 },\n \"Paying users\": { Low: 75, Typical: 88, High: 99 },\n };\n\nconst GOAL_RUNG_SET = new Set<Rung>(GOAL_RUNG_VALUES);\n\nexport function isGoalRung(rung: Rung): rung is GoalRung {\n return GOAL_RUNG_SET.has(rung);\n}\n","/**\n * Strength — the signed reading value `s` the Confidence average reads.\n *\n * Formula (`ontology.yaml` → `derivations.strength`):\n * rung anchor (Goal rungs: × magnitude band) × sign(Result)\n * — Validated positive, Invalidated negative; 0 unless Validated/Invalidated.\n */\nimport type { MagnitudeBand, Result, Rung } from \"../types.js\";\nimport { GOAL_RUNG_ANCHOR, RUNG_ANCHOR, isGoalRung } from \"./rung.js\";\n\nexport function sign(result: Result): -1 | 0 | 1 {\n if (result === \"Validated\") return 1;\n if (result === \"Invalidated\") return -1;\n return 0;\n}\n\n/** A reading counts toward Confidence only once concluded either way; an\n * Inconclusive reading carries no signal. The single definition the whole\n * derivation module (and its record→input mappers) share. */\nexport function isConcluded(result: Result): boolean {\n return result === \"Validated\" || result === \"Invalidated\";\n}\n\nexport interface StrengthInput {\n rung: Rung;\n result: Result;\n /** Only read for Goal rungs; defaults to \"Typical\" when absent. */\n magnitudeBand?: MagnitudeBand;\n}\n\nexport function readingStrength(input: StrengthInput): number {\n const s = sign(input.result);\n if (s === 0) return 0; // Inconclusive contributes nothing.\n if (isGoalRung(input.rung)) {\n const band = input.magnitudeBand ?? \"Typical\";\n return GOAL_RUNG_ANCHOR[input.rung][band] * s;\n }\n return (RUNG_ANCHOR[input.rung] ?? 0) * s;\n}\n","/**\n * Source quality — Representativeness × Credibility.\n *\n * Scales a Reading's *weight* in the Confidence average, within its rung.\n * We keep the raw product as the weight (matching the migration's\n * `remodel.mjs`); the five display anchors {0.25, 0.35, 0.5, 0.7, 1.0} are a\n * storage/display concern, not the weight used in the average.\n */\nimport { round2 } from \"./round.js\";\n\nexport function sourceQuality(\n representativeness: number,\n credibility: number,\n): number {\n return round2(representativeness * credibility);\n}\n","/**\n * Confidence — signed −100…100, 0 = no evidence.\n *\n * Formula (`ontology.yaml` → `derivations.confidence`):\n * (w0·0 + Σ wi·si) / (w0 + Σ wi), w0 = 100,\n * wi = |si| × Source quality, si = the reading's signed Strength.\n *\n * Only concluded Validated/Invalidated readings enter. Readings sharing a\n * Source against one belief dedupe to the strongest (largest |si|, most\n * recent on ties). Goal-rung readings never dedupe (each closed goal is its\n * own unit). No corroboration bump.\n */\nimport type { MagnitudeBand, Result, Rung } from \"../types.js\";\nimport { round2 } from \"./round.js\";\nimport { isGoalRung } from \"./rung.js\";\nimport { sourceQuality } from \"./source-quality.js\";\nimport { isConcluded, readingStrength } from \"./strength.js\";\n\n/** The neutral prior weight — a hard floor per the guardrails. */\nexport const W0 = 100;\n\nexport interface ConfidenceReadingInput {\n id: string;\n /** The independence-dedupe key. Null falls back to the reading's own id. */\n source: string | null;\n rung: Rung;\n result: Result;\n representativeness: number;\n credibility: number;\n /** ISO date; used only as the dedupe tie-break (most recent wins). */\n date?: string | null;\n magnitudeBand?: MagnitudeBand;\n}\n\nexport interface Scored {\n input: ConfidenceReadingInput;\n strength: number;\n sq: number;\n /** The reading's weight in the average: |strength| × Source quality. */\n weight: number;\n}\n\n/**\n * Score every concluded reading and resolve the Source dedupe — the shared\n * front half of the Confidence average. `confidence()` reduces the winners to\n * a number; `confidenceAttribution()` reuses the same winners so the movers it\n * reports always decompose the very number the drawer shows. Goal rungs never\n * dedupe (each closed goal is its own unit).\n */\nexport function scoreAndDedupe(readings: ConfidenceReadingInput[]): Scored[] {\n const scored: Scored[] = readings\n .filter((r) => isConcluded(r.result))\n .map((r) => {\n const strength = readingStrength(r);\n const sq = sourceQuality(r.representativeness, r.credibility);\n return { input: r, strength, sq, weight: Math.abs(strength) * sq };\n })\n .filter((x) => x.strength !== 0);\n\n const best = new Map<string, Scored>();\n for (const x of scored) {\n if (isGoalRung(x.input.rung)) {\n best.set(x.input.id, x);\n continue;\n }\n const key = x.input.source || x.input.id;\n const cur = best.get(key);\n const better =\n !cur ||\n Math.abs(x.strength) > Math.abs(cur.strength) ||\n (Math.abs(x.strength) === Math.abs(cur.strength) &&\n (x.input.date || \"\") > (cur.input.date || \"\"));\n if (better) best.set(key, x);\n }\n return [...best.values()];\n}\n\nexport function confidence(readings: ConfidenceReadingInput[]): number {\n const winners = scoreAndDedupe(readings);\n let num = 0;\n let den = W0;\n for (const x of winners) {\n num += x.weight * x.strength;\n den += x.weight;\n }\n return den > 0 ? round2(num / den) : 0;\n}\n","/**\n * Confidence attribution — the \"what's moving the number\" half of the\n * understanding layer (OPS-1276). Decomposes an assumption's Confidence into\n * the experiments (and goals / direct readings) contributing to it, ranked by\n * how hard each pushes the number up or down.\n *\n * A winner's contribution is its signed share of the average:\n * cᵢ = (weightᵢ · strengthᵢ) / den, den = w0 + Σ weight\n * so Σ contributions = Σ(wᵢ·sᵢ)/den = Confidence (the w0·0 prior term is 0).\n * The reveal therefore literally adds up to the hero number. Contributions are\n * grouped by the reading's experiment (goal-rung readings and experiment-less\n * readings fall into their own buckets), then ranked by |contribution|.\n */\nimport { W0, scoreAndDedupe, type ConfidenceReadingInput } from \"./confidence.js\";\nimport { round2 } from \"./round.js\";\n\nexport interface AttributionReadingInput extends ConfidenceReadingInput {\n /** The experiment that produced the reading, if any. */\n experimentId?: string | null;\n /** The goal the reading concluded, for goal-rung readings. */\n goalId?: string | null;\n}\n\n/** What a mover is anchored to — an experiment, a goal, or nothing. */\nexport type MoverKind = \"experiment\" | \"goal\" | \"direct\";\n\nexport interface Mover {\n /** Stable grouping key: the experiment/goal id, or \"direct\". */\n key: string;\n kind: MoverKind;\n /** The experiment id when `kind === \"experiment\"`, else null. */\n experimentId: string | null;\n /** The goal id when `kind === \"goal\"`, else null. */\n goalId: string | null;\n /** Signed push on Confidence; the whole set sums to `confidence`. */\n contribution: number;\n /** |contribution| — the rank key and the \"how hard\" magnitude. */\n magnitude: number;\n /** How many (deduped) readings back this mover. */\n readingCount: number;\n /** The winning readings' ids, for drill-through. */\n readingIds: string[];\n}\n\nexport interface Attribution {\n /** The same Confidence the derived box shows (from the same winners). */\n confidence: number;\n /** Movers ranked by |contribution|, strongest first. */\n movers: Mover[];\n}\n\nfunction bucketOf(r: AttributionReadingInput): {\n key: string;\n kind: MoverKind;\n experimentId: string | null;\n goalId: string | null;\n} {\n if (r.experimentId) {\n return {\n key: r.experimentId,\n kind: \"experiment\",\n experimentId: r.experimentId,\n goalId: null,\n };\n }\n if (r.goalId) {\n return {\n key: `goal:${r.goalId}`,\n kind: \"goal\",\n experimentId: null,\n goalId: r.goalId,\n };\n }\n return { key: \"direct\", kind: \"direct\", experimentId: null, goalId: null };\n}\n\nexport function confidenceAttribution(\n readings: AttributionReadingInput[],\n): Attribution {\n const winners = scoreAndDedupe(readings);\n const den = winners.reduce((acc, x) => acc + x.weight, W0);\n\n const byKey = new Map<string, Mover>();\n let num = 0;\n for (const x of winners) {\n num += x.weight * x.strength;\n const b = bucketOf(x.input as AttributionReadingInput);\n const contribution = (x.weight * x.strength) / den;\n const cur = byKey.get(b.key);\n if (cur) {\n cur.contribution += contribution;\n cur.readingCount += 1;\n cur.readingIds.push(x.input.id);\n } else {\n byKey.set(b.key, {\n key: b.key,\n kind: b.kind,\n experimentId: b.experimentId,\n goalId: b.goalId,\n contribution,\n magnitude: 0, // finalised below\n readingCount: 1,\n readingIds: [x.input.id],\n });\n }\n }\n\n const movers = [...byKey.values()].map((m) => ({\n ...m,\n contribution: round2(m.contribution),\n magnitude: round2(Math.abs(m.contribution)),\n }));\n movers.sort((a, b) => b.magnitude - a.magnitude);\n\n return {\n confidence: den > 0 ? round2(num / den) : 0,\n movers,\n };\n}\n","/**\n * Progress-to-conclusion — how close a running experiment is to concluding\n * (OPS-1276). An experiment concludes when every pre-registered bar line has\n * been given a Bar verdict; progress is the count of settled bars against the\n * total. Bar verdict is a report, never a Confidence input (nosql-schema.md),\n * so reading it here is exactly its intended use.\n */\nexport interface BarLineInput {\n /** null/\"\" until the bar is judged at closure. */\n barVerdict?: string | null;\n}\n\nexport interface Progress {\n /** Pre-registered bar lines on the experiment. */\n total: number;\n /** Bars that have a verdict. */\n settled: number;\n /** Bars still awaiting a verdict. */\n toGo: number;\n /** True once every bar is settled (and there is at least one). */\n concluded: boolean;\n}\n\nexport function experimentProgress(bars: BarLineInput[]): Progress {\n const total = bars.length;\n const settled = bars.filter(\n (b) => typeof b.barVerdict === \"string\" && b.barVerdict.trim() !== \"\",\n ).length;\n return {\n total,\n settled,\n toGo: total - settled,\n concluded: total > 0 && settled === total,\n };\n}\n","/**\n * Confidence over time — the story of how the number got where it is\n * (OPS-1276). At each date a concluded reading was dated, we recompute\n * Confidence over every concluded reading up to and including that date, using\n * the very same `confidence()` the derived box uses (so the last point equals\n * the hero number). Undated concluded readings have no place on the timeline\n * but still bear on the belief, so they are treated as always-present — folded\n * into every point — which keeps the final point equal to today's Confidence.\n */\nimport { confidence, type ConfidenceReadingInput } from \"./confidence.js\";\nimport { isConcluded } from \"./strength.js\";\n\nexport interface TrajectoryPoint {\n /** ISO date at which Confidence took this value. */\n date: string;\n confidence: number;\n}\n\nexport function confidenceTrajectory(\n readings: ConfidenceReadingInput[],\n): TrajectoryPoint[] {\n const concluded = readings.filter((r) => isConcluded(r.result));\n const undated = concluded.filter((r) => !r.date);\n const dated = concluded.filter((r) => r.date);\n if (dated.length === 0) return [];\n\n const dates = [...new Set(dated.map((r) => r.date as string))].sort();\n return dates.map((date) => ({\n date,\n // Everything dated on/before this point, plus the always-present undated.\n confidence: confidence([\n ...undated,\n ...dated.filter((r) => (r.date as string) <= date),\n ]),\n }));\n}\n","/**\n * Derived Impact — propagates dependents' pull into a belief's seed.\n *\n * Formula (`ontology.yaml` → `derivations.derived_impact`):\n * seed + (100 − seed) × S / (S + 100), where\n * S = Σ Derived Impact of assumptions whose `Depends on` names this row\n * + 100 per standing (Provisional/Active) decision naming it via\n * `Based on assumption`.\n * Goals never contribute. Moot rows pin to 0 and contribute nothing.\n *\n * One reverse-topological pass (dependents first) with memoization and a\n * cycle guard, matching `doshi-validation-os/migration/remodel.mjs`.\n */\nimport { round2 } from \"./round.js\";\n\nexport interface ImpactAssumptionInput {\n id: string;\n /** The hand-scored seed (0–100); null treated as 0. */\n impact: number | null;\n moot?: boolean;\n /** Ids this assumption depends on. */\n dependsOnIds: string[];\n}\n\n/**\n * @param assumptions the full register (never a filtered slice — a filter\n * silently drops dependents from the propagation).\n * @param basedOnCounts id → number of standing decisions with a `Based on`\n * link to that assumption. Each contributes +100 to S.\n */\nexport function derivedImpacts(\n assumptions: ImpactAssumptionInput[],\n basedOnCounts: Record<string, number> = {},\n): Map<string, number> {\n const byId = new Map(assumptions.map((a) => [a.id, a]));\n\n // dependents(X) = assumptions whose dependsOnIds includes X.\n const dependents = new Map<string, string[]>();\n for (const a of assumptions) dependents.set(a.id, []);\n for (const a of assumptions) {\n for (const dep of a.dependsOnIds) dependents.get(dep)?.push(a.id);\n }\n\n const memo = new Map<string, number>();\n const compute = (id: string, seen: Set<string>): number => {\n const cached = memo.get(id);\n if (cached !== undefined) return cached;\n if (seen.has(id)) return 0; // cycle guard\n seen.add(id);\n const a = byId.get(id);\n if (!a) return 0;\n if (a.moot) {\n memo.set(id, 0);\n return 0;\n }\n const seed = a.impact ?? 0;\n let S = 0;\n for (const depId of dependents.get(id) ?? []) {\n const d = byId.get(depId);\n if (d && !d.moot) S += compute(depId, seen);\n }\n S += 100 * (basedOnCounts[id] ?? 0);\n const value = seed + (100 - seed) * (S / (S + 100));\n const rounded = round2(value);\n memo.set(id, rounded);\n return rounded;\n };\n\n const out = new Map<string, number>();\n for (const a of assumptions) out.set(a.id, compute(a.id, new Set()));\n return out;\n}\n","/**\n * Risk — the belief's live standing.\n *\n * Formula (`ontology.yaml` → `derivations.risk`):\n * Derived Impact × (1 − max(0, Confidence) / 100)\n * Ranges 0 to Derived Impact. Negative confidence does not raise Risk above\n * Derived Impact (the max(0, …) clamp).\n */\nimport { round2 } from \"./round.js\";\n\nexport function risk(derivedImpact: number, confidence: number): number {\n return round2(derivedImpact * (1 - Math.max(0, confidence) / 100));\n}\n"],"mappings":";;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,SAAS,OAAO,GAAmB;AACxC,SAAO,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC5B;;;ACEO,IAAM,YAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAgCO,IAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,IAAM,mBAAmB,CAAC,iBAAiB,cAAc;;;AC9CzD,IAAM,cAA2C;AAAA,EACtD,SAAS;AAAA,EACT,uBAAuB;AAAA,EACvB,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,mBAAmB;AACrB;AAEO,IAAM,mBACX;AAAA,EACE,iBAAiB,EAAE,KAAK,IAAI,SAAS,IAAI,MAAM,GAAG;AAAA,EAClD,gBAAgB,EAAE,KAAK,IAA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AACxB,UAAI,KAAK,CAAC,EAAE,KAAM,MAAK,QAAQ,OAAO,IAAI;AAAA,IAC5C;AACA,SAAK,OAAO,cAAc,EAAE,KAAK;AACjC,UAAM,QAAQ,QAAQ,MAAM,SAAS,KAAK,IAAI;AAC9C,UAAM,UAAU,OAAO,KAAK;AAC5B,SAAK,IAAI,IAAI,OAAO;AACpB,WAAO;AAAA,EACT;AAEA,QAAM,MAAM,oBAAI,IAAoB;AACpC,aAAW,KAAK,YAAa,KAAI,IAAI,EAAE,IAAI,QAAQ,EAAE,IAAI,oBAAI,IAAI,CAAC,CAAC;AACnE,SAAO;AACT;;;AC7DO,SAAS,KAAK,eAAuBA,aAA4B;AACtE,SAAO,OAAO,iBAAiB,IAAI,KAAK,IAAI,GAAGA,WAAU,IAAI,IAAI;AACnE;","names":["confidence"]}
|
package/dist/index-CieW13mJ.d.ts
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { k as GoalRung, M as MagnitudeBand, r as TestingRung, q as Rung, p as Result } from './types-B3eI7ASx.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Round to 2 decimals, matching the migration's `+(n).toFixed(2)`.
|
|
5
|
-
* Derived values are stored/displayed rounded; full precision is only used
|
|
6
|
-
* transiently inside a single computation.
|
|
7
|
-
*/
|
|
8
|
-
declare function round2(n: number): number;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The evidence ladder anchors that feed Strength.
|
|
12
|
-
*
|
|
13
|
-
* Source of truth: `skills/_shared/ontology.yaml` → `vocabularies.rung`.
|
|
14
|
-
* Testing rungs carry a single anchor; Goal rungs carry a magnitude band
|
|
15
|
-
* (Low/Typical/High) picked from the absolute outcome.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
declare const RUNG_ANCHOR: Record<TestingRung, number>;
|
|
19
|
-
declare const GOAL_RUNG_ANCHOR: Record<GoalRung, Record<MagnitudeBand, number>>;
|
|
20
|
-
declare function isGoalRung(rung: Rung): rung is GoalRung;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Strength — the signed reading value `s` the Confidence average reads.
|
|
24
|
-
*
|
|
25
|
-
* Formula (`ontology.yaml` → `derivations.strength`):
|
|
26
|
-
* rung anchor (Goal rungs: × magnitude band) × sign(Result)
|
|
27
|
-
* — Validated positive, Invalidated negative; 0 unless Validated/Invalidated.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
declare function sign(result: Result): -1 | 0 | 1;
|
|
31
|
-
/** A reading counts toward Confidence only once concluded either way; an
|
|
32
|
-
* Inconclusive reading carries no signal. The single definition the whole
|
|
33
|
-
* derivation module (and its record→input mappers) share. */
|
|
34
|
-
declare function isConcluded(result: Result): boolean;
|
|
35
|
-
interface StrengthInput {
|
|
36
|
-
rung: Rung;
|
|
37
|
-
result: Result;
|
|
38
|
-
/** Only read for Goal rungs; defaults to "Typical" when absent. */
|
|
39
|
-
magnitudeBand?: MagnitudeBand;
|
|
40
|
-
}
|
|
41
|
-
declare function readingStrength(input: StrengthInput): number;
|
|
42
|
-
|
|
43
|
-
declare function sourceQuality(representativeness: number, credibility: number): number;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Confidence — signed −100…100, 0 = no evidence.
|
|
47
|
-
*
|
|
48
|
-
* Formula (`ontology.yaml` → `derivations.confidence`):
|
|
49
|
-
* (w0·0 + Σ wi·si) / (w0 + Σ wi), w0 = 100,
|
|
50
|
-
* wi = |si| × Source quality, si = the reading's signed Strength.
|
|
51
|
-
*
|
|
52
|
-
* Only concluded Validated/Invalidated readings enter. Readings sharing a
|
|
53
|
-
* Source against one belief dedupe to the strongest (largest |si|, most
|
|
54
|
-
* recent on ties). Goal-rung readings never dedupe (each closed goal is its
|
|
55
|
-
* own unit). No corroboration bump.
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
/** The neutral prior weight — a hard floor per the guardrails. */
|
|
59
|
-
declare const W0 = 100;
|
|
60
|
-
interface ConfidenceReadingInput {
|
|
61
|
-
id: string;
|
|
62
|
-
/** The independence-dedupe key. Null falls back to the reading's own id. */
|
|
63
|
-
source: string | null;
|
|
64
|
-
rung: Rung;
|
|
65
|
-
result: Result;
|
|
66
|
-
representativeness: number;
|
|
67
|
-
credibility: number;
|
|
68
|
-
/** ISO date; used only as the dedupe tie-break (most recent wins). */
|
|
69
|
-
date?: string | null;
|
|
70
|
-
magnitudeBand?: MagnitudeBand;
|
|
71
|
-
}
|
|
72
|
-
interface Scored {
|
|
73
|
-
input: ConfidenceReadingInput;
|
|
74
|
-
strength: number;
|
|
75
|
-
sq: number;
|
|
76
|
-
/** The reading's weight in the average: |strength| × Source quality. */
|
|
77
|
-
weight: number;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Score every concluded reading and resolve the Source dedupe — the shared
|
|
81
|
-
* front half of the Confidence average. `confidence()` reduces the winners to
|
|
82
|
-
* a number; `confidenceAttribution()` reuses the same winners so the movers it
|
|
83
|
-
* reports always decompose the very number the drawer shows. Goal rungs never
|
|
84
|
-
* dedupe (each closed goal is its own unit).
|
|
85
|
-
*/
|
|
86
|
-
declare function scoreAndDedupe(readings: ConfidenceReadingInput[]): Scored[];
|
|
87
|
-
declare function confidence(readings: ConfidenceReadingInput[]): number;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Confidence attribution — the "what's moving the number" half of the
|
|
91
|
-
* understanding layer (OPS-1276). Decomposes an assumption's Confidence into
|
|
92
|
-
* the experiments (and goals / direct readings) contributing to it, ranked by
|
|
93
|
-
* how hard each pushes the number up or down.
|
|
94
|
-
*
|
|
95
|
-
* A winner's contribution is its signed share of the average:
|
|
96
|
-
* cᵢ = (weightᵢ · strengthᵢ) / den, den = w0 + Σ weight
|
|
97
|
-
* so Σ contributions = Σ(wᵢ·sᵢ)/den = Confidence (the w0·0 prior term is 0).
|
|
98
|
-
* The reveal therefore literally adds up to the hero number. Contributions are
|
|
99
|
-
* grouped by the reading's experiment (goal-rung readings and experiment-less
|
|
100
|
-
* readings fall into their own buckets), then ranked by |contribution|.
|
|
101
|
-
*/
|
|
102
|
-
|
|
103
|
-
interface AttributionReadingInput extends ConfidenceReadingInput {
|
|
104
|
-
/** The experiment that produced the reading, if any. */
|
|
105
|
-
experimentId?: string | null;
|
|
106
|
-
/** The goal the reading concluded, for goal-rung readings. */
|
|
107
|
-
goalId?: string | null;
|
|
108
|
-
}
|
|
109
|
-
/** What a mover is anchored to — an experiment, a goal, or nothing. */
|
|
110
|
-
type MoverKind = "experiment" | "goal" | "direct";
|
|
111
|
-
interface Mover {
|
|
112
|
-
/** Stable grouping key: the experiment/goal id, or "direct". */
|
|
113
|
-
key: string;
|
|
114
|
-
kind: MoverKind;
|
|
115
|
-
/** The experiment id when `kind === "experiment"`, else null. */
|
|
116
|
-
experimentId: string | null;
|
|
117
|
-
/** The goal id when `kind === "goal"`, else null. */
|
|
118
|
-
goalId: string | null;
|
|
119
|
-
/** Signed push on Confidence; the whole set sums to `confidence`. */
|
|
120
|
-
contribution: number;
|
|
121
|
-
/** |contribution| — the rank key and the "how hard" magnitude. */
|
|
122
|
-
magnitude: number;
|
|
123
|
-
/** How many (deduped) readings back this mover. */
|
|
124
|
-
readingCount: number;
|
|
125
|
-
/** The winning readings' ids, for drill-through. */
|
|
126
|
-
readingIds: string[];
|
|
127
|
-
}
|
|
128
|
-
interface Attribution {
|
|
129
|
-
/** The same Confidence the derived box shows (from the same winners). */
|
|
130
|
-
confidence: number;
|
|
131
|
-
/** Movers ranked by |contribution|, strongest first. */
|
|
132
|
-
movers: Mover[];
|
|
133
|
-
}
|
|
134
|
-
declare function confidenceAttribution(readings: AttributionReadingInput[]): Attribution;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Progress-to-conclusion — how close a running experiment is to concluding
|
|
138
|
-
* (OPS-1276). An experiment concludes when every pre-registered bar line has
|
|
139
|
-
* been given a Bar verdict; progress is the count of settled bars against the
|
|
140
|
-
* total. Bar verdict is a report, never a Confidence input (nosql-schema.md),
|
|
141
|
-
* so reading it here is exactly its intended use.
|
|
142
|
-
*/
|
|
143
|
-
interface BarLineInput {
|
|
144
|
-
/** null/"" until the bar is judged at closure. */
|
|
145
|
-
barVerdict?: string | null;
|
|
146
|
-
}
|
|
147
|
-
interface Progress {
|
|
148
|
-
/** Pre-registered bar lines on the experiment. */
|
|
149
|
-
total: number;
|
|
150
|
-
/** Bars that have a verdict. */
|
|
151
|
-
settled: number;
|
|
152
|
-
/** Bars still awaiting a verdict. */
|
|
153
|
-
toGo: number;
|
|
154
|
-
/** True once every bar is settled (and there is at least one). */
|
|
155
|
-
concluded: boolean;
|
|
156
|
-
}
|
|
157
|
-
declare function experimentProgress(bars: BarLineInput[]): Progress;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Confidence over time — the story of how the number got where it is
|
|
161
|
-
* (OPS-1276). At each date a concluded reading was dated, we recompute
|
|
162
|
-
* Confidence over every concluded reading up to and including that date, using
|
|
163
|
-
* the very same `confidence()` the derived box uses (so the last point equals
|
|
164
|
-
* the hero number). Undated concluded readings have no place on the timeline
|
|
165
|
-
* but still bear on the belief, so they are treated as always-present — folded
|
|
166
|
-
* into every point — which keeps the final point equal to today's Confidence.
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
interface TrajectoryPoint {
|
|
170
|
-
/** ISO date at which Confidence took this value. */
|
|
171
|
-
date: string;
|
|
172
|
-
confidence: number;
|
|
173
|
-
}
|
|
174
|
-
declare function confidenceTrajectory(readings: ConfidenceReadingInput[]): TrajectoryPoint[];
|
|
175
|
-
|
|
176
|
-
interface ImpactAssumptionInput {
|
|
177
|
-
id: string;
|
|
178
|
-
/** The hand-scored seed (0–100); null treated as 0. */
|
|
179
|
-
impact: number | null;
|
|
180
|
-
moot?: boolean;
|
|
181
|
-
/** Ids this assumption depends on. */
|
|
182
|
-
dependsOnIds: string[];
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* @param assumptions the full register (never a filtered slice — a filter
|
|
186
|
-
* silently drops dependents from the propagation).
|
|
187
|
-
* @param basedOnCounts id → number of standing decisions with a `Based on`
|
|
188
|
-
* link to that assumption. Each contributes +100 to S.
|
|
189
|
-
*/
|
|
190
|
-
declare function derivedImpacts(assumptions: ImpactAssumptionInput[], basedOnCounts?: Record<string, number>): Map<string, number>;
|
|
191
|
-
|
|
192
|
-
declare function risk(derivedImpact: number, confidence: number): number;
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* The shared derivation module — pure functions, no I/O.
|
|
196
|
-
*
|
|
197
|
-
* The same module the dashboard, the API (derive-on-write), and Claude Code
|
|
198
|
-
* audits all call, so every writer computes the four derived numbers
|
|
199
|
-
* identically. Ported from `doshi-validation-os/migration/remodel.mjs` and
|
|
200
|
-
* kept in lock-step with `skills/_shared/ontology.yaml`.
|
|
201
|
-
*/
|
|
202
|
-
|
|
203
|
-
type index_Attribution = Attribution;
|
|
204
|
-
type index_AttributionReadingInput = AttributionReadingInput;
|
|
205
|
-
type index_BarLineInput = BarLineInput;
|
|
206
|
-
type index_ConfidenceReadingInput = ConfidenceReadingInput;
|
|
207
|
-
declare const index_GOAL_RUNG_ANCHOR: typeof GOAL_RUNG_ANCHOR;
|
|
208
|
-
type index_ImpactAssumptionInput = ImpactAssumptionInput;
|
|
209
|
-
type index_Mover = Mover;
|
|
210
|
-
type index_MoverKind = MoverKind;
|
|
211
|
-
type index_Progress = Progress;
|
|
212
|
-
declare const index_RUNG_ANCHOR: typeof RUNG_ANCHOR;
|
|
213
|
-
type index_Scored = Scored;
|
|
214
|
-
type index_StrengthInput = StrengthInput;
|
|
215
|
-
type index_TrajectoryPoint = TrajectoryPoint;
|
|
216
|
-
declare const index_W0: typeof W0;
|
|
217
|
-
declare const index_confidence: typeof confidence;
|
|
218
|
-
declare const index_confidenceAttribution: typeof confidenceAttribution;
|
|
219
|
-
declare const index_confidenceTrajectory: typeof confidenceTrajectory;
|
|
220
|
-
declare const index_derivedImpacts: typeof derivedImpacts;
|
|
221
|
-
declare const index_experimentProgress: typeof experimentProgress;
|
|
222
|
-
declare const index_isConcluded: typeof isConcluded;
|
|
223
|
-
declare const index_isGoalRung: typeof isGoalRung;
|
|
224
|
-
declare const index_readingStrength: typeof readingStrength;
|
|
225
|
-
declare const index_risk: typeof risk;
|
|
226
|
-
declare const index_round2: typeof round2;
|
|
227
|
-
declare const index_scoreAndDedupe: typeof scoreAndDedupe;
|
|
228
|
-
declare const index_sign: typeof sign;
|
|
229
|
-
declare const index_sourceQuality: typeof sourceQuality;
|
|
230
|
-
declare namespace index {
|
|
231
|
-
export { type index_Attribution as Attribution, type index_AttributionReadingInput as AttributionReadingInput, type index_BarLineInput as BarLineInput, type index_ConfidenceReadingInput as ConfidenceReadingInput, index_GOAL_RUNG_ANCHOR as GOAL_RUNG_ANCHOR, type index_ImpactAssumptionInput as ImpactAssumptionInput, type index_Mover as Mover, type index_MoverKind as MoverKind, type index_Progress as Progress, index_RUNG_ANCHOR as RUNG_ANCHOR, type index_Scored as Scored, type index_StrengthInput as StrengthInput, type index_TrajectoryPoint as TrajectoryPoint, index_W0 as W0, index_confidence as confidence, index_confidenceAttribution as confidenceAttribution, index_confidenceTrajectory as confidenceTrajectory, index_derivedImpacts as derivedImpacts, index_experimentProgress as experimentProgress, index_isConcluded as isConcluded, index_isGoalRung as isGoalRung, index_readingStrength as readingStrength, index_risk as risk, index_round2 as round2, index_scoreAndDedupe as scoreAndDedupe, index_sign as sign, index_sourceQuality as sourceQuality };
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export { type AttributionReadingInput as A, type BarLineInput as B, type ConfidenceReadingInput as C, GOAL_RUNG_ANCHOR as G, type ImpactAssumptionInput as I, type Mover as M, type Progress as P, RUNG_ANCHOR as R, type Scored as S, type TrajectoryPoint as T, W0 as W, type Attribution as a, type MoverKind as b, type StrengthInput as c, confidence as d, confidenceAttribution as e, confidenceTrajectory as f, derivedImpacts as g, experimentProgress as h, index as i, isConcluded as j, isGoalRung as k, risk as l, round2 as m, scoreAndDedupe as n, sign as o, readingStrength as r, sourceQuality as s };
|