arkaik 0.12.0 → 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 +317 -15
- package/dist/io.js +316 -14
- package/package.json +1 -1
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Usage: node validate-bundle.js <path-to-bundle.json>
|
|
12
12
|
*/
|
|
13
|
-
"use strict";var H=require("node:fs"),te=require("node:path");var de=["flow","view","data-model","api-endpoint","acceptance","decision"],ne=["idea","discovery","backlog","development","releasing","live","archived"],ie=["web","ios","android"],me=["composes","calls","displays","queries","covers","supersedes","generates","impacts"],Me={composes:[["flow","view"],["flow","flow"],["view","flow"],["view","view"]],calls:[["view","api-endpoint"],["flow","api-endpoint"],["api-endpoint","api-endpoint"],["api-endpoint","view"]],displays:[["view","data-model"]],queries:[["api-endpoint","data-model"]],covers:[["acceptance","view"],["acceptance","flow"]],supersedes:[["decision","decision"]],generates:[["decision","acceptance"]],impacts:[["decision","flow"],["decision","view"],["decision","data-model"],["decision","api-endpoint"]]};var ce=["saves-time","simplifies","makes-money","reduces-risk","organizes","integrates","connects","reduces-effort","avoids-hassles","reduces-cost","quality","variety","sensory-appeal","informs","reduces-anxiety","rewards-me","nostalgia","design-aesthetics","badge-value","wellness","therapeutic-value","fun-entertainment","attractiveness","provides-access","provides-hope","self-actualization","motivation","heirloom","affiliation-belonging","self-transcendence"],Pe={"saves-time":"functional",simplifies:"functional","makes-money":"functional","reduces-risk":"functional",organizes:"functional",integrates:"functional",connects:"functional","reduces-effort":"functional","avoids-hassles":"functional","reduces-cost":"functional",quality:"functional",variety:"functional","sensory-appeal":"functional",informs:"functional","reduces-anxiety":"emotional","rewards-me":"emotional",nostalgia:"emotional","design-aesthetics":"emotional","badge-value":"emotional",wellness:"emotional","therapeutic-value":"emotional","fun-entertainment":"emotional",attractiveness:"emotional","provides-access":"emotional","provides-hope":"life-changing","self-actualization":"life-changing",motivation:"life-changing",heirloom:"life-changing","affiliation-belonging":"life-changing","self-transcendence":"social-impact"};var Ne={flow:"F-",view:"V-","data-model":"DM-","api-endpoint":"API-",acceptance:"AC-",decision:"DEC-"};var ut=["proposed","approved","enacted","rejected","deprecated","superseded"];function De(e){switch(e){case"proposed":return"discovery";case"approved":return"backlog";case"enacted":return"live";case"rejected":case"deprecated":case"superseded":return"archived"}}function Te(e){let d=e.metadata?.decision_status;return ut.includes(d)?d:"proposed"}var ye={prioritized:"backlog",blocked:"development"};function he(e){return ne.includes(e)?e:ye[e]}var Pt={...ye},Nt={backlog:"idea",...ye};function Oe(e){let d=new Map;for(let t of e){if(t.type!=="screenshot.recorded"&&t.type!=="screenshot.removed"||typeof t.node_id!="string"||typeof t.platform!="string")continue;let r=d.get(t.node_id);r||(r=new Map,d.set(t.node_id,r)),r.set(t.platform,t.type==="screenshot.removed"?null:t)}return d}function Fe(e){let d=t=>typeof t=="string"?t:"";return[...e].sort((t,r)=>{let u=d(t.ts),y=d(r.ts);if(u<y)return-1;if(u>y)return 1;let S=d(t.id),x=d(r.id);return S<x?-1:S>x?1:0})}function we(e){let d=[],t=[];return e.split(/\r?\n/).forEach((u,y)=>{let S=y+1;if(u.trim()==="")return;let x;try{x=JSON.parse(u)}catch(G){t.push({line:S,rule:"journal-line-parse",message:`Line ${S}: not valid JSON \u2014 ${G.message}`,severity:"error"});return}if(typeof x!="object"||x===null||Array.isArray(x)){t.push({line:S,rule:"journal-line-shape",message:`Line ${S}: each journal line must be a single JSON event object.`,severity:"error"});return}let M=x,I=[];if(typeof M.id!="string"&&I.push("id"),typeof M.ts!="string"&&I.push("ts"),typeof M.type!="string"&&I.push("type"),I.length>0){t.push({line:S,rule:"journal-line-shape",message:`Line ${S}: event is missing required envelope field(s): ${I.join(", ")}.`,severity:"error"});return}d.push(M)}),{events:d,findings:t}}var ft={"node.updated":["node_id"],"node.status_changed":["node_id"],"decision.status_changed":["node_id"],"node.deleted":["node_id"],"edge.added":["source_id","target_id"],"ref.added":["node_id"],"ref.removed":["node_id"],"ref.status_changed":["node_id"],"screenshot.recorded":["node_id"],"screenshot.removed":["node_id"],"idea.proposed":["node_id"],"request.filed":["node_id"]};function Le(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pt(e,d){return e===d?!0:typeof d!="string"?!1:e==="backlog"&&d==="idea"?!0:(he(e)??e)===(he(d)??d)}function Ce(e){let d=[],t=e.journal;if(t===void 0)return d;if(!Array.isArray(t))return d.push({path:"journal",rule:"journal-shape",message:"journal must be an array of events when present.",severity:"error"}),d;if(t.length===0)return d;let r=i=>typeof i=="string"?i:void 0,u=Array.isArray(e.nodes)?e.nodes:[],y=Array.isArray(e.edges)?e.edges:[],S=new Map,x=new Map;for(let i of u){let c=r(i?.id);if(c!==void 0){S.set(c,i.status);let _=i.metadata,h=_&&typeof _=="object"&&!Array.isArray(_)?_.decision_status:void 0;x.set(c,h??"proposed")}}let M=new Set;for(let i of y){let c=r(i?.id);c!==void 0&&M.add(c)}let I=[];t.forEach((i,c)=>{let _=`journal[${c}]`;if(typeof i!="object"||i===null||Array.isArray(i)){d.push({path:_,rule:"journal-event-shape",message:`journal[${c}]: each event must be a JSON object.`,severity:"error"});return}let h=i,$=[];if(r(h.id)===void 0&&$.push("id"),r(h.ts)===void 0&&$.push("ts"),r(h.type)===void 0&&$.push("type"),$.length>0){d.push({path:_,rule:"journal-event-envelope",message:`journal[${c}]: event is missing required envelope field(s): ${$.join(", ")}.`,severity:"error"});return}I.push({ev:h,index:c})});let G=new Set(S.keys()),R=new Set(M),C=new Set;for(let{ev:i}of I)if(i.type==="node.created"){let c=r(i.node_id);c&&G.add(c)}else if(i.type==="edge.added"){let c=r(i.edge_id);c&&R.add(c)}else if(i.type==="journal.baseline"&&Array.isArray(i.node_ids))for(let c of i.node_ids){let _=r(c);_&&(C.add(_),G.add(_))}let W=Fe(I.map(i=>i.ev)),q=new Set,K=new Map,s=new Map;for(let i of W)if(i.type==="node.created"){let c=r(i.node_id);c&&q.add(c)}else if(i.type==="node.status_changed"){let c=r(i.node_id);if(c&&i.platform===void 0){let _=r(i.to);_!==void 0&&K.set(c,_)}}else if(i.type==="decision.status_changed"){let c=r(i.node_id);if(c){let _=r(i.to);_!==void 0&&s.set(c,_)}}for(let{ev:i,index:c}of I){let _=ft[i.type];if(_)for(let h of _){let $=r(i[h]);$!==void 0&&!G.has($)&&d.push({path:`journal[${c}].${h}`,rule:"journal-dangling-node-ref",message:`journal[${c}] (${i.type}): references node "${$}" that never existed in the snapshot or journal.`,severity:"error"})}if(i.type==="deliverable.shipped"&&Array.isArray(i.node_ids)&&i.node_ids.forEach((h,$)=>{let E=r(h);E!==void 0&&!G.has(E)&&d.push({path:`journal[${c}].node_ids[${$}]`,rule:"journal-dangling-node-ref",message:`journal[${c}] (${i.type}): references node "${E}" that never existed in the snapshot or journal.`,severity:"error"})}),i.type==="edge.removed"){let h=r(i.edge_id);h!==void 0&&!R.has(h)&&d.push({path:`journal[${c}].edge_id`,rule:"journal-dangling-edge-ref",message:`journal[${c}] (edge.removed): references edge "${h}" that never existed in the snapshot or journal.`,severity:"error"})}}for(let[i,c]of S){!q.has(i)&&!C.has(i)&&d.push({path:"journal",rule:"journal-missing-node-created",message:`Node "${i}" is present in the snapshot but has no node.created event in the journal.`,severity:"error"});let _=K.get(i);_!==void 0&&!pt(_,c)&&d.push({path:"journal",rule:"journal-status-mismatch",message:`Node "${i}": journal's last node.status_changed.to "${_}" disagrees with snapshot status "${String(c)}".`,severity:"error"})}for(let[i,c]of s){if(!x.has(i))continue;let _=x.get(i)??"proposed";c!==_&&d.push({path:"journal",rule:"journal-decision-status-mismatch",message:`Node "${i}": journal's last decision.status_changed.to "${c}" disagrees with snapshot decision_status "${String(_)}".`,severity:"error"})}let D=Oe(W);return u.forEach((i,c)=>{let _=r(i?.id);if(_===void 0)return;let h=Le(i.metadata)?i.metadata:{},$=Le(h.platformScreenshots)?h.platformScreenshots:{},E=D.get(_),Y=new Set([...Object.keys($),...E?E.keys():[]]);for(let U of Y){let T=E?.get(U);if(T===void 0)continue;let Q=typeof $[U]=="string"?$[U]:void 0,j,X;if(T===null)X=Q===void 0,j="it was removed";else if(T.form==="data")X=Q!==void 0,j="a data URI was recorded";else{let Z=r(T.url);X=Q===Z,j=Z===void 0?"an unknown value was recorded":`"${Z}" was recorded`}X||d.push({path:`nodes[${c}].metadata.platformScreenshots.${U}`,rule:"screenshot-untracked",message:`Node "${_}": platformScreenshots.${U} is ${Q===void 0?"empty":`"${Q}"`} but the journal's last screenshot event says ${j} \u2014 write screenshots through record_screenshot, not update_node.`,severity:"warning"})}}),d}var We=["flow","view","acceptance"];function Je(e){let d=e?.metadata?.products;if(!Array.isArray(d))return[];let t=new Set,r=[];for(let u of d){if(typeof u!="object"||u===null||Array.isArray(u))continue;let y=u;typeof y.id!="string"||y.id.trim()===""||t.has(y.id)||(t.add(y.id),r.push(y))}return r}var Ve=["rings","bars"],Ge=["chips","rows"],qe=["status","species"];var gt=["journey","system","screens"];function Ue(e){return gt.includes(e)}var le="cross-surface";var _e=["human","agent","rule"],Ke=["human","agent"];var Be="weighing.assessment.recorded",Qe="weighing.set.saved";function mt(e,d,t){return`${e}\0${d}\0${t}`}function ze(e){let d=typeof e?.scorer?.kind=="string"?e.scorer.kind:"";return`${mt(String(e?.matrix),String(e?.subject),String(e?.criterion))}\0${d}`}var yt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function He(e){return yt(e)&&typeof e.matrix=="string"&&typeof e.subject=="string"&&typeof e.criterion=="string"}function ue(e){let d=e.lastIndexOf("@");return d===-1?{id:e,major:void 0}:{id:e.slice(0,d),major:e.slice(d+1)}}function se(e){let d=/^(\d+)(?:\.|$)/.exec(e);return d?d[1]:void 0}function ve(e){if(typeof e=="object"&&e!==null&&!Object.isFrozen(e)){Object.freeze(e);for(let d of Object.values(e))ve(d)}return e}var Ze="value-contribution",ht="1.0.0",wt="value",re="positioning",_t={3:"Core. The promise exists for this; take it away and the value goes.",2:"Supports clearly. The user would notice it missing.",1:"Touches. A side effect of the promise, not its purpose.",0:"Unrelated: weighed and found to have nothing to do with it. (No row means nobody has weighed it yet.)","-1":"Small friction. It costs this value a little.","-2":"Works against it. The user notices the cost.","-3":"Costs it at its core. The user feels the opposite."},Ye={functional:"Functional",emotional:"Emotional","life-changing":"Life-changing","social-impact":"Social impact"},Se={"saves-time":{name:"Saves time",definition:"Completes the user's task in less time."},simplifies:{name:"Simplifies",definition:"Reduces steps, choices, or cognitive load."},"makes-money":{name:"Makes money",definition:"Helps the user earn."},"reduces-risk":{name:"Reduces risk",definition:"Protects against loss, error, or uncertainty."},organizes:{name:"Organizes",definition:"Brings order to the user's things or life."},integrates:{name:"Integrates",definition:"Ties different tools or parts of life together."},connects:{name:"Connects",definition:"Brings the user together with other people."},"reduces-effort":{name:"Reduces effort",definition:"Same outcome, less work."},"avoids-hassles":{name:"Avoids hassles",definition:"Prevents friction and annoyance before it happens."},"reduces-cost":{name:"Reduces cost",definition:"Saves the user money."},quality:{name:"Quality",definition:"Superior craft or performance the user can feel."},variety:{name:"Variety",definition:"Meaningful choice and breadth."},"sensory-appeal":{name:"Sensory appeal",definition:"Looks, sounds, or feels good in the moment."},informs:{name:"Informs",definition:"Tells the user something they want to know."},"reduces-anxiety":{name:"Reduces anxiety",definition:"Calms; makes the user feel safe."},"rewards-me":{name:"Rewards me",definition:"Tangible perks for engagement."},nostalgia:{name:"Nostalgia",definition:"Positive memory of the past."},"design-aesthetics":{name:"Design / aesthetics",definition:"Beauty as an experienced value, beyond function."},"badge-value":{name:"Badge value",definition:"Signals identity or status to others."},wellness:{name:"Wellness",definition:"Improves physical or mental well-being."},"therapeutic-value":{name:"Therapeutic value",definition:"Actively supports emotional processing or healing."},"fun-entertainment":{name:"Fun / entertainment",definition:"Enjoyable, playful, delightful."},attractiveness:{name:"Attractiveness",definition:"Makes the user feel attractive."},"provides-access":{name:"Provides access",definition:"Grants entry to something otherwise out of reach."},"provides-hope":{name:"Provides hope",definition:"Reason to believe things can improve."},"self-actualization":{name:"Self-actualization",definition:"Helps the user become who they want to be."},motivation:{name:"Motivation",definition:"Energizes the user toward their goals."},heirloom:{name:"Heirloom",definition:"Something worth passing on across time."},"affiliation-belonging":{name:"Affiliation & belonging",definition:"Makes the user part of a group that matters."},"self-transcendence":{name:"Self-transcendence",definition:"Helps beyond the user themselves."}},et={min:-3,max:3,anchors:{..._t}},St=ve({id:Ze,version:ht,title:"Elements of value",subject:"acceptance",scale:et,groups:Object.keys(Ye).map(e=>({id:e,title:Ye[e]})),criteria:ce.map(e=>({id:e,group:Pe[e],name:Se[e].name,question:`Does this promise serve, or cost, "${Se[e].name}"?`,definition:Se[e].definition}))}),vt=ve({id:wt,title:"Value",set:`${Ze}@1`,subjects:{kind:"query",species:"acceptance"},positioning:re,status:"active"}),be=[St],$e=[vt],ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function bt(e){let d=e.criteria.filter(t=>ee(t)&&typeof t.id=="string");return d.length===e.criteria.length?e:{...e,criteria:d}}function ke(e){return ee(e)&&typeof e.id=="string"&&typeof e.version=="string"&&Array.isArray(e.criteria)&&(ee(e.scale)||e.role==="positioning")}function xe(e){if(!ee(e)||typeof e.id!="string"||typeof e.set!="string"||!ee(e.subjects))return!1;let{kind:d,species:t,items:r}=e.subjects;return d==="query"&&typeof t=="string"||d==="list"&&Array.isArray(r)}function Xe(e){return ee(e)&&typeof e.min=="number"&&typeof e.max=="number"&&ee(e.anchors)}function tt(e,d){if(Xe(e.scale))return e.scale;let t=typeof e.extends=="string"&&d!==void 0?fe(d,e.extends):void 0;return t!==void 0&&Xe(t.scale)?t.scale:et}function nt(e){let d=[...be],t=[...$e],r=[],u=y=>ee(y)?{...typeof y.id=="string"?{id:y.id}:{},...typeof y.role=="string"?{role:y.role}:{}}:{};return(Array.isArray(e?.sets)?e.sets:[]).forEach((y,S)=>{ke(y)&&!d.some(x=>x.id===y.id)?d.push(bt(y)):r.push({kind:"set",...u(y),index:S})}),(Array.isArray(e?.matrices)?e.matrices:[]).forEach((y,S)=>{xe(y)&&!t.some(x=>x.id===y.id)?t.push(y):r.push({kind:"matrix",...u(y),index:S})}),{sets:d,matrices:t,skipped:r}}function fe(e,d){let{id:t,major:r}=ue(d),u=e.sets.find(y=>y.id===t);if(u!==void 0)return r===void 0||se(u.version)===r?u:void 0}var z=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function it(e,d,t){let r=[],u=(y,S,x)=>r.push({path:y,rule:S,message:x});if(e!=null&&!z(e)&&u("weighing","weighing-section-shape","The weighing section is not an object \u2014 it is ignored"),z(e)){for(let s of["sets","matrices","assessments"])e[s]!==void 0&&!Array.isArray(e[s])&&u(`weighing.${s}`,"weighing-section-shape",`weighing.${s} is not an array \u2014 it is ignored`);let y=Array.isArray(e.sets)?e.sets:[],S=Array.isArray(e.matrices)?e.matrices:[],x=Array.isArray(e.assessments)?e.assessments:[],M=nt(e),I=(s,D,i,c)=>{let _=fe(M,s);if(_!==void 0)return _;let h=M.sets.find($=>$.id===ue(s).id);h!==void 0?u(D,"weighing-set-ref-major",`${i} names ${s}, but "${h.id}" is at ${h.version} \u2014 levels are comparable only within a major, so the ref resolves to nothing`):u(D,c,`${i} names set "${s}", which is neither built in nor in this section`)},G=new Set(M.matrices.map(s=>s.positioning).filter(s=>typeof s=="string")),R=(s,D,i)=>{i.status!==void 0&&i.status!=="draft"&&i.status!=="active"&&u(`${s}.status`,"weighing-set-status",`${D}: status ${JSON.stringify(i.status)} is not "draft" or "active" \u2014 it is read as a draft, which feeds no roll-up`)},C=s=>z(s)&&Object.values(s).every(D=>typeof D=="string"),W=new Set;y.forEach((s,D)=>{let i=`weighing.sets[${D}]`;if(!z(s)){u(i,"weighing-set-shape","A set is not an object \u2014 it is ignored");return}let c=`Set "${String(s.id)}"`,_=ke(s);if(_||u(i,"weighing-set-shape",`${c} needs a string id and version, a criteria array and a scale object (a positioning may leave the scale out) \u2014 it is ignored`),typeof s.id=="string"&&(be.some(h=>h.id===s.id)?u(`${i}.id`,"weighing-pinned-set-redefined",`${c} is built in and pinned by version \u2014 the project's copy is ignored`):_&&(W.has(s.id)&&u(`${i}.id`,"weighing-duplicate-set",`Duplicate set id "${s.id}" \u2014 the first well-formed one wins, this one is ignored`),W.add(s.id))),R(i,c,s),z(s.scale)){let h=s.scale;(typeof h.min!="number"||typeof h.max!="number"||!C(h.anchors))&&u(`${i}.scale`,"weighing-scale-shape",`${c}: a scale needs a numeric min and max and an anchors object of strings`)}if(Array.isArray(s.criteria)&&s.criteria.forEach((h,$)=>{let E=`${i}.criteria[${$}]`;(!z(h)||typeof h.id!="string"||h.anchors!==void 0&&!C(h.anchors))&&u(E,"weighing-criterion-shape",`${c}: criterion ${$} needs a string id, and its anchors (if any) must be an object of strings`)}),s.role==="positioning"&&!(typeof s.id=="string"&&G.has(s.id))?u(`${i}.id`,"weighing-positioning-id",`A positioning set must have the id "${re}" (the one a matrix points at) \u2014 "${String(s.id)}" would never be applied`):s.role!=="positioning"&&s.id===re&&u(`${i}.role`,"weighing-positioning-id",`Set "${re}" is where a matrix looks for its positioning, but its role is ${JSON.stringify(s.role)}, not "positioning" \u2014 it would never be applied`),s.role==="positioning"){let h=typeof s.extends=="string"?I(s.extends,`${i}.extends`,`Positioning "${String(s.id)}"`,"weighing-positioning-unknown-ruler"):void 0;typeof s.extends!="string"?u(`${i}.extends`,"weighing-positioning-unknown-ruler",`Positioning "${String(s.id)}" does not say which set it re-weights \u2014 set extends to e.g. value-contribution@1`):h!==void 0&&h.role==="positioning"&&u(`${i}.extends`,"weighing-positioning-unknown-ruler",`Positioning "${String(s.id)}" extends "${s.extends}", which is itself a positioning \u2014 it must extend a criteria set such as value-contribution@1`);let $=new Set(h!==void 0&&h.role!=="positioning"?h.criteria.map(E=>E?.id):[]);(Array.isArray(s.criteria)?s.criteria:[]).forEach((E,Y)=>{if(!z(E))return;let U=`${i}.criteria[${Y}]`;$.size>0&&typeof E.id=="string"&&!$.has(E.id)&&u(`${U}.id`,"weighing-positioning-unknown-element",`Positioning names "${E.id}", which is not in ${String(s.extends)}`),E.weight!==void 0&&(typeof E.weight!="number"||!(E.weight>0))&&u(`${U}.weight`,"weighing-positioning-weight",`Positioning weight for "${String(E.id)}" must be a number above 0 \u2014 leave the element out to leave it unpositioned`)})}});let q=new Set;S.forEach((s,D)=>{let i=`weighing.matrices[${D}]`;if(!z(s)){u(i,"weighing-matrix-shape","A matrix is not an object \u2014 it is ignored");return}let c=`Matrix "${String(s.id)}"`,_=xe(s);_||u(i,"weighing-matrix-shape",`${c} needs a string id, a set ref and a subjects object of kind query or list \u2014 it is ignored`),typeof s.id=="string"&&($e.some(h=>h.id===s.id)?u(`${i}.id`,"weighing-pinned-matrix-redefined",`${c} is built in \u2014 the project's copy is ignored`):_&&(q.has(s.id)&&u(`${i}.id`,"weighing-duplicate-matrix",`Duplicate matrix id "${s.id}" \u2014 the first well-formed one wins, this one is ignored`),q.add(s.id))),R(i,c,s),_&&I(s.set,`${i}.set`,c,"weighing-unknown-set")});let K=new Set;x.forEach((s,D)=>{let i=`weighing.assessments[${D}]`,c=`Assessment ${D}`;if(!He(s)){u(i,"weighing-assessment-shape",`${c}: not an object with a string matrix, subject and criterion \u2014 it cannot be addressed, so every reader skips it`);return}(typeof s.ts!="string"||Number.isNaN(Date.parse(s.ts)))&&u(`${i}.ts`,"weighing-assessment-ts",`${c}: ts must be an ISO 8601 string \u2014 without it "latest wins" cannot order this row`);let _=M.matrices.find(j=>j.id===s.matrix);_===void 0&&u(`${i}.matrix`,"weighing-unknown-matrix",`${c}: matrix "${s.matrix}" is not defined`);let h=_===void 0?void 0:fe(M,_.set),$=h?.criteria.find(j=>j?.id===s.criterion);h!==void 0&&$===void 0&&u(`${i}.criterion`,"weighing-unknown-criterion",`${c}: criterion "${s.criterion}" is not in set "${h.id}"`),$!==void 0&&typeof $.superseded_by=="string"&&$.superseded_by!==""&&u(`${i}.criterion`,"weighing-retired-criterion",`${c}: criterion "${$.id}" is retired \u2014 superseded by "${$.superseded_by}"`);let E=h===void 0?void 0:tt(h,M),Y=typeof E?.min=="number"?E.min:-3,U=typeof E?.max=="number"?E.max:3;(typeof s.level!="number"||!Number.isInteger(s.level)||s.level<Y||s.level>U)&&u(`${i}.level`,"weighing-level-range",`${c}: level must be an integer ${Y}..${U} (a blank cell is the absence of the row; 0 means weighed and unrelated)`),[0,1,2,3].includes(s.confidence)||u(`${i}.confidence`,"weighing-confidence-range",`${c}: confidence must be 0, 1, 2 or 3`);let T=z(s.scorer)?s.scorer:void 0;if(T===void 0||typeof T.kind!="string"||typeof T.id!="string"||T.id===""?u(`${i}.scorer`,"weighing-scorer-missing",`${c}: no scorer with a string kind and id \u2014 human, agent and rule levels become indistinguishable, and the row can win no cell`):_e.includes(T.kind)?Ke.includes(T.kind)||u(`${i}.scorer.kind`,"weighing-rule-stored",`${c}: scorer kind "${T.kind}" is never stored \u2014 a seeding rule is computed on read`):u(`${i}.scorer.kind`,"weighing-scorer-kind",`${c}: scorer kind "${T.kind}" is not one of ${_e.join(", ")} \u2014 it ranks below every other scorer`),_?.subjects.kind==="query"){let j=d.get(s.subject);j===void 0?u(`${i}.subject`,"weighing-unknown-subject",`${c}: subject "${s.subject}" is not a node in this bundle`):j!==_.subjects.species&&u(`${i}.subject`,"weighing-subject-species",`${c}: subject "${s.subject}" is a ${j}, and matrix "${_.id}" judges ${String(_.subjects.species)} nodes`)}if(s.evidence!==void 0&&typeof s.evidence!="string"?u(`${i}.evidence`,"weighing-evidence-type",`${c}: evidence must be a markdown string`):(s.confidence===2||s.confidence===3)&&(s.evidence===void 0||s.evidence.trim()==="")&&u(`${i}.evidence`,"weighing-no-evidence",`${c}: confidence ${String(s.confidence)} claims evidence and cites none`),s.refs!==void 0&&!(Array.isArray(s.refs)&&s.refs.every(j=>typeof j=="string"))&&u(`${i}.refs`,"weighing-refs-type",`${c}: refs must be an array of id strings`),s.basis!==void 0&&!(z(s.basis)&&["fingerprint","commit","set_version"].every(j=>s.basis[j]===void 0||typeof s.basis[j]=="string"))&&u(`${i}.basis`,"weighing-basis-shape",`${c}: basis must be an object whose fingerprint, commit and set_version are strings`),T!==void 0&&typeof T.kind=="string"){let j=ze(s);K.has(j)&&u(i,"weighing-duplicate-assessment",`${c}: a second ${T.kind} score for the same cell \u2014 the section stores latest-per-scorer-kind, so this cell is ambiguous`),K.add(j)}let Q=z(s.basis)&&typeof s.basis.set_version=="string"?s.basis.set_version:void 0;h!==void 0&&Q!==void 0&&se(Q)!==se(h.version)&&u(`${i}.basis.set_version`,"weighing-set-major",`${c}: scored against ${h.id} ${Q}, and the set is now ${h.version} \u2014 levels are comparable only within a major`)})}return t.forEach((y,S)=>{if(!z(y))return;let x=typeof y.type=="string"?y.type:"";x!==Be&&x!==Qe||(typeof y.actor!="string"||y.actor.trim()==="")&&u(`journal[${S}].actor`,"weighing-event-no-actor",`Journal event ${S}: ${x} has no actor \u2014 human, agent and CI scores become indistinguishable`)}),r}var $t=["beta","monitoring","deprecated"],st=["compact","large"],rt=2*1024*1024;function kt(e){let d=e.indexOf(",");if(d===-1)return 0;let t=e.slice(d+1),r=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.floor(t.length*3/4)-r}function ot(e){return typeof e=="string"&&!Number.isNaN(Date.parse(e))}function at(e){let d=[],t=(n,l,o)=>d.push({path:n,rule:l,message:o,severity:"error"}),r=(n,l,o)=>d.push({path:n,rule:l,message:o,severity:"warning"}),u=()=>{let n=d.filter(o=>o.severity==="error"),l=d.filter(o=>o.severity==="warning");return{valid:n.length===0,findings:d,errors:n,warnings:l}};if(typeof e!="object"||e===null||Array.isArray(e))return t("","bundle-shape","Bundle must be an object with project, nodes, and edges."),u();let y=e,S=y.project,x=y.nodes,M=y.edges;if(!S||!x||!M)return t("","bundle-shape","Missing top-level keys (project, nodes, edges)."),u();if(!Array.isArray(x))return t("nodes","bundle-shape","nodes must be an array."),u();if(!Array.isArray(M))return t("edges","bundle-shape","edges must be an array."),u();let I=x,G=M,R=new Map,C=new Set;S.id||t("project.id","project-id-required","project.id is missing"),(typeof S.title!="string"||!S.title.trim())&&t("project.title","title-non-empty","project.title is missing or empty"),S.created_at||t("project.created_at","timestamp-required","project.created_at is missing"),S.updated_at||t("project.updated_at","timestamp-required","project.updated_at is missing"),S.created_at&&!ot(S.created_at)&&r("project.created_at","iso-timestamp","project.created_at is not a valid ISO 8601 timestamp"),S.updated_at&&!ot(S.updated_at)&&r("project.updated_at","iso-timestamp","project.updated_at is not a valid ISO 8601 timestamp");let W=S.metadata;W&&W.view_card_variant!==void 0&&!st.includes(W.view_card_variant)&&t("project.metadata.view_card_variant","view-card-variant",`project.metadata.view_card_variant must be one of ${st.join(", ")} (import rejects other values)`),I.forEach((n,l)=>{let o=`nodes[${l}]`,a=n.id;C.has(a)&&t(`${o}.id`,"duplicate-node-id",`Duplicate node ID: ${a}`),C.add(a),R.set(a,n),(typeof n.title!="string"||!n.title.trim())&&t(`${o}.title`,"title-non-empty",`Node ${a}: title is missing or empty`);let p=n.species,f=Ne[p];f&&!(typeof a=="string"&&a.startsWith(f))&&t(`${o}.id`,"species-prefix",`Node ${a}: species "${p}" should have prefix "${f}"`),de.includes(p)||t(`${o}.species`,"valid-species",`Node ${a}: invalid species "${p}"`),n.project_id!==S.id&&t(`${o}.project_id`,"project-id-match",`Node ${a}: project_id "${n.project_id}" does not match project.id "${S.id}"`),ne.includes(n.status)||t(`${o}.status`,"valid-status",`Node ${a}: invalid status "${n.status}"`);let m=n.platforms;if(!m||m.length===0)p!=="decision"&&t(`${o}.platforms`,"platforms-non-empty",`Node ${a}: platforms array is empty or missing`);else for(let g of m)ie.includes(g)||t(`${o}.platforms`,"valid-platform",`Node ${a}: invalid platform "${g}"`);let w=n.metadata||{};w.stage!==void 0&&!$t.includes(w.stage)&&t(`${o}.metadata.stage`,"valid-stage",`Node ${a}: invalid metadata.stage "${w.stage}"`);let A=w.platformNotes;if(A)for(let g of Object.keys(A))ie.includes(g)||t(`${o}.metadata.platformNotes`,"valid-platform",`Node ${a}: platformNotes has invalid platform "${g}"`);let P=w.platformStatuses;if(P)for(let[g,v]of Object.entries(P))ie.includes(g)?Array.isArray(m)&&!m.includes(g)&&r(`${o}.metadata.platformStatuses`,"platform-statuses-subset",`Node ${a}: platformStatuses covers platform "${g}" not in node.platforms`):t(`${o}.metadata.platformStatuses`,"valid-platform",`Node ${a}: platformStatuses has invalid platform "${g}"`),ne.includes(v)||t(`${o}.metadata.platformStatuses`,"valid-status",`Node ${a}: platformStatuses has invalid status "${v}" for platform "${g}"`);let O=w.platformScreenshots;if(O){for(let[g,v]of Object.entries(O))if(typeof v=="string"&&v.startsWith("data:")){let L=kt(v);L>rt&&r(`${o}.metadata.platformScreenshots`,"screenshot-data-uri-size",`Node ${a}: platformScreenshots.${g} is a ${(L/(1024*1024)).toFixed(1)}MB data URI, above the ${rt/(1024*1024)}MB guidance (docs/spec/bundle-format.md \xA7 Asset Values) \u2014 consider a relative path or hosted URL instead`)}}let F=w.gherkin,B=w.values;if(p==="acceptance"?((typeof F!="string"||!F.trim())&&r(`${o}.metadata.gherkin`,"acceptance-gherkin-missing",`Acceptance ${a}: metadata.gherkin is missing or empty (one Given/When/Then scenario expected)`),(!Array.isArray(B)||B.length===0)&&r(`${o}.metadata.values`,"acceptance-values-missing",`Acceptance ${a}: metadata.values is missing or empty (assign 1-3 value elements)`)):(F!==void 0&&r(`${o}.metadata.gherkin`,"gherkin-species",`Node ${a}: metadata.gherkin is only meaningful on acceptance nodes`),B!==void 0&&r(`${o}.metadata.values`,"values-species",`Node ${a}: metadata.values is only meaningful on acceptance nodes`)),Array.isArray(B))for(let g of B)ce.includes(g)||t(`${o}.metadata.values`,"valid-value",`Node ${a}: invalid value element "${g}"`);let b=w.refs;if(Array.isArray(b)){let g=new Set;b.forEach((v,L)=>{let N=v??{},J=`${o}.metadata.refs[${L}]`,V=N.id;typeof V!="string"||!V.trim()?t(`${J}.id`,"ref-id-required",`Node ${a}: ref is missing an id`):g.has(V)?t(`${J}.id`,"duplicate-ref-id",`Node ${a}: duplicate ref id "${V}"`):g.add(V),(typeof N.url!="string"||!N.url.trim())&&t(`${J}.url`,"ref-url-required",`Node ${a}: ref "${V}" is missing a url`),N.status_mapped!==void 0&&!ne.includes(N.status_mapped)&&t(`${J}.status_mapped`,"valid-status",`Node ${a}: ref "${V}" has invalid status_mapped "${N.status_mapped}"`)})}if(w.decision_status!==void 0&&p!=="decision"&&r(`${o}.metadata.decision_status`,"decision-status-wrong-species",`decision_status is meaningful on decision nodes only; "${a}" is a ${p}.`),p==="decision"){let g=Te({metadata:n.metadata}),v=De(g);n.status!==v&&r(`${o}.status`,"decision-lifecycle-mismatch",`Decision "${a}" is ${g}, whose lifecycle status should be "${v}", but status is "${n.status}" (spec \xA72).`)}if(p==="flow"){let g=w.playlist;!n.metadata||!g||!g.entries?t(`${o}.metadata.playlist`,"flow-playlist-required",`Flow ${a}: missing metadata.playlist.entries`):g.entries.length===0&&r(`${o}.metadata.playlist`,"flow-playlist-empty",`Flow ${a}: playlist is empty`)}});let q=S.root_node_id;q&&!C.has(q)&&t("project.root_node_id","root-node-exists",`project.root_node_id "${q}" does not reference an existing node`);let K=(n,l,o)=>{if(typeof n!="object"||n===null||Array.isArray(n))return;let a=n,p=[["flow_platforms",Ve],["view_platforms",Ge],["minimap_color",qe]];for(let[f,m]of p){let w=a[f];w!==void 0&&(typeof w!="string"||!m.includes(w))&&r(`${l}.${f}`,"map-unknown-display",`${o} sets ${f} to "${String(w)}"; expected one of ${m.join(", ")} (renderers fall back to the default)`)}a.images!==void 0&&typeof a.images!="boolean"&&r(`${l}.images`,"map-unknown-display",`${o} sets images to a non-boolean value (renderers fall back to the default)`)},s=W?.map_display;if(typeof s=="object"&&s!==null&&!Array.isArray(s))for(let[n,l]of Object.entries(s))K(l,`project.metadata.map_display.${n}`,`Map "${n}"`);let D=W?.maps;if(Array.isArray(D)){let n=new Set;D.forEach((l,o)=>{if(typeof l!="object"||l===null||Array.isArray(l))return;let a=l,p=`project.metadata.maps[${o}]`,f=typeof a.id=="string"?a.id:void 0;f!==void 0&&(n.has(f)&&r(`${p}.id`,"map-duplicate-id",`Duplicate map id "${f}"`),n.add(f),Ue(f)&&r(`${p}.id`,"map-shadows-built-in",`Map id "${f}" shadows a built-in map and will be ignored`));let m=a.root_node_id;typeof m=="string"&&!C.has(m)&&r(`${p}.root_node_id`,"map-unknown-root",`Map "${f??o}" anchors on "${m}" which does not reference an existing node`),Array.isArray(a.species)&&a.species.forEach((w,A)=>{typeof w=="string"&&!de.includes(w)&&r(`${p}.species[${A}]`,"map-unknown-species",`Map "${f??o}" filters on unknown species "${w}"`)}),Array.isArray(a.edge_types)&&a.edge_types.forEach((w,A)=>{typeof w=="string"&&!me.includes(w)&&r(`${p}.edge_types[${A}]`,"map-unknown-edge-type",`Map "${f??o}" filters on unknown edge type "${w}"`)}),K(a.display,`${p}.display`,`Map "${f??o}"`)})}let i=W?.products,c=new Set;if(Array.isArray(i)){let n=new Set;i.forEach((l,o)=>{if(typeof l!="object"||l===null||Array.isArray(l))return;let a=l,p=`project.metadata.products[${o}]`,f=typeof a.id=="string"?a.id:void 0;f!==void 0&&(n.has(f)?r(`${p}.id`,"product-duplicate-id",`Duplicate product id "${f}" \u2014 the first wins`):(n.add(f),f.trim()!==""&&c.add(f)),/^[a-z0-9]+(-[a-z0-9]+)*$/.test(f)||r(`${p}.id`,"product-invalid-id",`Product id "${f}" is not kebab-case`))})}let _=c.size>0,h=new Map;for(let n of G){if(n.edge_type!=="covers")continue;let l=typeof n.source_id=="string"?n.source_id:void 0,o=typeof n.target_id=="string"?n.target_id:void 0;if(l===void 0||o===void 0)continue;let a=h.get(l)??[];a.push(o),h.set(l,a)}let $=new Map;if(_)for(let n of Je({metadata:W}))$.set(n.id,new Set(Array.isArray(n.platforms)?n.platforms:[]));let E=new Map,Y=new Map;if(I.forEach((n,l)=>{let o=typeof n.id=="string"?n.id:`#${l}`,a=n.species,p=`nodes[${l}]`;Y.set(o,l);let f=n.metadata??{},m=typeof f.product=="string"?f.product:void 0,w=a!==void 0&&We.includes(a);if(m!==void 0&&!w){let O=de.includes(a)?`${a} membership is derived from consumers and must not be stored`:"metadata.product is only meaningful on flow, view, and acceptance nodes";r(`${p}.metadata.product`,"product-membership-wrong-species",`Node ${o}: ${O}`);return}if(!w)return;if(m===void 0){if(!_)return;a==="acceptance"?h.has(o)||r(`${p}.metadata.product`,"acceptance-product-unassigned",`Acceptance ${o} covers nothing and names no product \u2014 it will show only under "All products"`):r(`${p}.metadata.product`,"unassigned-membership",`Node ${o}: no product membership \u2014 it will show only under "All products"`);return}if(E.set(o,m),!c.has(m)){r(`${p}.metadata.product`,"product-unknown-reference",`Node ${o}: product "${m}" is not declared on the project`);return}let A=$.get(m),P=Array.isArray(n.platforms)?n.platforms:[];if(A)for(let O of P)typeof O=="string"&&!A.has(O)&&r(`${p}.platforms`,"product-platform-not-in-menu",`Node ${o}: platform "${O}" is not in product "${m}"'s menu`)}),_)for(let[n,l]of h){let o=Y.get(n);if(o===void 0)continue;let a=new Set(l.map(p=>E.get(p)).filter(p=>!!p));a.size>1&&r(`nodes[${o}].metadata.product`,"acceptance-covers-span-products",`Acceptance ${n} covers anchors in ${[...a].sort().join(" and ")} \u2014 statuses may conflate products`)}let U=new Set,T=new Set,Q=new Set;G.forEach((n,l)=>{let o=`edges[${l}]`,a=n.id,p=n.source_id,f=n.target_id,m=n.edge_type;U.has(a)&&t(`${o}.id`,"duplicate-edge-id",`Duplicate edge ID: ${a}`),U.add(a);let w=`e-${p}-${f}`;a!==w&&r(`${o}.id`,"edge-id-convention",`Edge ${a}: id does not match convention "${w}" (stale after a rename?)`);let A=`${p}->${f}:${m}`;T.has(A)&&r(`${o}`,"duplicate-edge-relationship",`Duplicate edge relationship: ${A}`),T.add(A),n.project_id!==S.id&&t(`${o}.project_id`,"project-id-match",`Edge ${a}: project_id does not match project.id`),C.has(p)||t(`${o}.source_id`,"dangling-edge",`Edge ${a}: source_id "${p}" not found in nodes`),C.has(f)||t(`${o}.target_id`,"dangling-edge",`Edge ${a}: target_id "${f}" not found in nodes`),me.includes(m)||t(`${o}.edge_type`,"valid-edge-type",`Edge ${a}: invalid edge_type "${m}"`);let P=R.get(p),O=R.get(f),F=Me[m];P&&O&&F&&(F.some(([b,k])=>b===P.species&&k===O.species)||t(`${o}.edge_type`,"edge-semantics",`Edge ${a}: "${m}" not valid from ${P.species} to ${O.species}`)),m==="composes"&&Q.add(`${p}->${f}`)});let j=["view","flow","condition","junction"],X=(n,l,o,a=0)=>{if(!(a>50)){if(!Array.isArray(n)){t(o,"playlist-entry-shape",`Flow ${l}: ${o} must be an array of playlist entries`);return}n.forEach((p,f)=>{let m=`${o}[${f}]`;if(typeof p!="object"||p===null||Array.isArray(p)){t(m,"playlist-entry-shape",`Flow ${l}: ${m} must be a playlist entry object`);return}let w=p,A=w.type;if(typeof A!="string"||!j.includes(A)){t(`${m}.type`,"playlist-entry-shape",`Flow ${l}: ${m}.type must be one of ${j.join(", ")} (got ${JSON.stringify(A)})`);return}if(A==="view")typeof w.view_id!="string"&&t(`${m}.view_id`,"playlist-entry-shape",`Flow ${l}: ${m} is a view entry with no view_id string`);else if(A==="flow")typeof w.flow_id!="string"&&t(`${m}.flow_id`,"playlist-entry-shape",`Flow ${l}: ${m} is a flow entry with no flow_id string`);else if(A==="condition"){typeof w.label!="string"&&t(`${m}.label`,"playlist-entry-shape",`Flow ${l}: ${m} is a condition with no label string`);for(let P of["if_true","if_false"])Array.isArray(w[P])?X(w[P],l,`${m}.${P}`,a+1):t(`${m}.${P}`,"playlist-entry-shape",`Flow ${l}: ${m}.${P} must be an array of playlist entries (both branches are required, use [] for an empty one)`)}else{if(typeof w.label!="string"&&t(`${m}.label`,"playlist-entry-shape",`Flow ${l}: ${m} is a junction with no label string`),!Array.isArray(w.cases)){t(`${m}.cases`,"playlist-entry-shape",`Flow ${l}: ${m}.cases must be an array of junction cases`);return}w.cases.forEach((P,O)=>{let F=`${m}.cases[${O}]`;if(typeof P!="object"||P===null||Array.isArray(P)){t(F,"playlist-entry-shape",`Flow ${l}: ${F} must be a junction case object`);return}let B=P;typeof B.label!="string"&&t(`${F}.label`,"playlist-entry-shape",`Flow ${l}: ${F} has no label string`),Array.isArray(B.entries)?X(B.entries,l,`${F}.entries`,a+1):t(`${F}.entries`,"playlist-entry-shape",`Flow ${l}: ${F}.entries must be an array of playlist entries \u2014 a junction case holds its own entries, not a bare view_id/flow_id`)})}})}};I.forEach((n,l)=>{let o=n.metadata;n.species==="flow"&&o?.playlist?.entries&&X(o.playlist.entries,n.id,`nodes[${l}].metadata.playlist.entries`)});let Z=(n,l,o,a=0)=>{if(a>50)return t(o,"playlist-depth",`Flow ${l}: playlist nesting too deep (possible cycle)`),[];let p=[];if(!Array.isArray(n))return p;for(let f of n)if(!(typeof f!="object"||f===null)){if(f.type==="view")C.has(f.view_id)||t(o,"playlist-ref-exists",`Flow ${l}: playlist references non-existent view "${f.view_id}"`),p.push(f.view_id);else if(f.type==="flow")C.has(f.flow_id)||t(o,"playlist-ref-exists",`Flow ${l}: playlist references non-existent flow "${f.flow_id}"`),f.flow_id===l&&t(o,"playlist-self-cycle",`Flow ${l}: playlist contains itself (direct cycle)`),p.push(f.flow_id);else if(f.type==="condition")f.if_true&&p.push(...Z(f.if_true,l,o,a+1)),f.if_false&&p.push(...Z(f.if_false,l,o,a+1));else if(f.type==="junction"&&f.cases)for(let m of f.cases)p.push(...Z(m.entries||[],l,o,a+1))}return p};I.forEach((n,l)=>{let o=n.metadata;if(n.species==="flow"&&o?.playlist?.entries){let a=`nodes[${l}].metadata.playlist`,p=n.id,f=Z(o.playlist.entries,p,a);for(let m of f)Q.has(`${p}->${m}`)||t(a,"playlist-composes-coherence",`Flow ${p}: playlist references "${m}" but no composes edge exists`)}});let pe=new Map,Ee=new Map;I.forEach((n,l)=>{let o=n.metadata;if(n.species==="flow"&&o?.playlist?.entries){let a=n.id,p=[],f=m=>{if(Array.isArray(m)){for(let w of m)if(!(typeof w!="object"||w===null)&&(w.type==="flow"&&p.push(w.flow_id),w.type==="condition"&&(w.if_true&&f(w.if_true),w.if_false&&f(w.if_false)),w.type==="junction"&&w.cases))for(let A of w.cases)f(A.entries||[])}};f(o.playlist.entries),pe.set(a,p),Ee.set(a,`nodes[${l}].metadata.playlist`)}});let Ae=new Set,ge=new Set,Ie=n=>{if(ge.has(n))return!0;if(Ae.has(n))return!1;Ae.add(n),ge.add(n);for(let l of pe.get(n)||[])if(Ie(l))return t(Ee.get(n)??"","flow-cycle",`Cycle detected: flow "${n}" -> "${l}"`),!0;return ge.delete(n),!1};for(let n of pe.keys())Ie(n);let ae=y.quality;if(typeof ae=="object"&&ae!==null&&!Array.isArray(ae)){let n=ae,l=Array.isArray(n.assessments)?n.assessments:[],o=Array.isArray(n.findings)?n.findings:[],a=typeof n.profile=="object"&&n.profile!==null?n.profile:void 0,p=new Set;Array.isArray(a?.surfaces)&&a.surfaces.forEach((b,k)=>{if(typeof b!="object"||b===null||Array.isArray(b))return;let g=b,v=typeof g.id=="string"?g.id:void 0;v===void 0||v.trim()===""||(p.has(v)&&r(`quality.profile.surfaces[${k}].id`,"quality-duplicate-surface",`Duplicate surface id "${v}" \u2014 the first wins`),p.add(v))}),p.size===0&&(l.length>0||o.length>0)&&r("quality.profile.surfaces","quality-no-surfaces","Quality data is stored but the profile declares no surfaces \u2014 the matrix falls back to the surfaces the assessments name");let f=typeof n.library=="object"&&n.library!==null?n.library:void 0,m=new Set,w=new Map;if(Array.isArray(f?.criteria))for(let b of f.criteria){if(typeof b!="object"||b===null)continue;let k=b;typeof k.id=="string"&&(m.add(k.id),typeof k.superseded_by=="string"&&k.superseded_by!==""&&w.set(k.id,k.superseded_by))}else(l.length>0||o.length>0)&&r("quality.library","quality-library-missing","No criteria pack is embedded \u2014 criterion ids cannot be resolved to domains or weights; the matrix uses a synthesized library");(typeof n.framework_version!="string"||n.framework_version==="")&&r("quality.framework_version","quality-framework-version-missing","Quality section has no framework_version \u2014 scores are not comparable across audits without one");let A=(b,k,g)=>{let v=typeof b.criterion_id=="string"?b.criterion_id:void 0;v!==void 0&&m.size>0&&!m.has(v)&&r(`${k}.criterion_id`,"quality-unknown-criterion",`${g}: criterion "${v}" is not in the pinned library`);let L=v!==void 0?w.get(v):void 0;L!==void 0&&r(`${k}.criterion_id`,"quality-retired-criterion",`${g}: criterion "${v}" is retired \u2014 superseded by "${L}"`);let N=typeof b.surface=="string"?b.surface:void 0;N!==void 0&&N!==le&&p.size>0&&!p.has(N)&&r(`${k}.surface`,"quality-unknown-surface",`${g}: surface "${N}" is not declared in the profile`)},P=new Set;l.forEach((b,k)=>{if(typeof b!="object"||b===null||Array.isArray(b))return;let g=b,v=`quality.assessments[${k}]`,L=`Assessment ${k}`;A(g,v,L);let N=g.level;(typeof N!="number"||!Number.isInteger(N)||N<0||N>4)&&r(`${v}.level`,"quality-level-range",`${L}: level must be an integer 0-4 (N/A is the absence of the row, not a level)`),g.surface===le&&r(`${v}.surface`,"quality-cross-surface-assessment",`${L}: "${le}" is a findings-only lens \u2014 it carries no matrix column, so this score would render nowhere`),(typeof g.evidence!="string"||g.evidence.trim()==="")&&r(`${v}.evidence`,"quality-assessment-no-evidence",`${L}: scored with no evidence \u2014 a score without a citation is an opinion, not an assessment`);let J=typeof g.criterion_id=="string"?g.criterion_id:void 0,V=typeof g.surface=="string"?g.surface:void 0;if(J!==void 0&&V!==void 0){let je=`${J}\0${V}`;P.has(je)&&r(`${v}`,"quality-duplicate-assessment",`${L}: a second score for (${J} x ${V}) \u2014 the section stores latest-per-cell, so this cell is ambiguous`),P.add(je)}});let O=new Set;o.forEach((b,k)=>{if(typeof b!="object"||b===null||Array.isArray(b))return;let g=b,v=`quality.findings[${k}]`,L=`Finding ${k}`;A(g,v,L);let N=typeof g.id=="string"?g.id:void 0;N!==void 0&&(O.has(N)&&r(`${v}.id`,"quality-duplicate-finding-id",`Duplicate finding id "${N}"`),O.add(N));for(let J of["impact","likelihood"]){let V=g[J];(typeof V!="number"||!Number.isInteger(V)||V<1||V>5)&&r(`${v}.${J}`,"quality-risk-range",`${L}: ${J} must be an integer 1-5 \u2014 severity is derived from impact x likelihood`)}for(let J of["severity","priority"])J in g&&r(`${v}.${J}`,"quality-derived-field-stored",`${L}: ${J} is derived from impact, likelihood and cost \u2014 storing it lets it drift from the numbers behind it`);g.status==="accepted-risk"&&(typeof g.detail!="string"||g.detail.trim()==="")&&r(`${v}.detail`,"quality-accepted-risk-no-note",`${L}: accepted-risk with no note \u2014 an accepted risk is a decision and reads like one`)});let F=new Set,B=Array.isArray(y.journal)?y.journal:[];B.forEach(b=>{if(typeof b!="object"||b===null)return;let k=b;k.type==="quality.finding.opened"&&typeof k.finding_id=="string"&&F.add(k.finding_id)}),B.forEach((b,k)=>{if(typeof b!="object"||b===null)return;let g=b,v=typeof g.type=="string"?g.type:"";v.startsWith("quality.")&&((typeof g.actor!="string"||g.actor.trim()==="")&&r(`journal[${k}].actor`,"quality-event-no-actor",`Journal event ${k}: ${v} has no actor \u2014 human, agent and CI scores become indistinguishable`),v==="quality.finding.resolved"&&typeof g.finding_id=="string"&&!F.has(g.finding_id)&&!O.has(g.finding_id)&&r(`journal[${k}].finding_id`,"quality-resolved-never-opened",`Journal event ${k}: resolves finding "${g.finding_id}", which no quality.finding.opened event or stored finding ever declared`),v==="quality.finding.accepted"&&typeof g.finding_id=="string"&&!F.has(g.finding_id)&&!O.has(g.finding_id)&&r(`journal[${k}].finding_id`,"quality-accepted-never-opened",`Journal event ${k}: accepts finding "${g.finding_id}", which no quality.finding.opened event or stored finding ever declared`))})}let ct=y.weighing,lt=Array.isArray(y.journal)?y.journal:[],Re=new Map;for(let[n,l]of R)Re.set(n,String(l.species));for(let n of it(ct,Re,lt))r(n.path,n.rule,n.message);for(let n of Ce(y))d.push(n);return u()}var dt="journal.jsonl",xt="journal";function Et(e){let d=(0,te.join)(e,xt);return(0,H.existsSync)(d)?(0,H.readdirSync)(d).filter(t=>t.startsWith("archive-")&&t.endsWith(".jsonl")).sort().map(t=>(0,te.join)(d,t)):[]}function oe(e,d){return e.filter(t=>t?.species===d).length}function At(){let e=process.argv[2];e||(console.error("Usage: node validate-bundle.js <path-to-bundle.json>"),process.exit(1)),(0,H.existsSync)(e)||(console.error(`File not found: ${e}`),process.exit(1));let d;try{d=JSON.parse((0,H.readFileSync)(e,"utf8"))}catch(R){console.error(`FATAL: Cannot parse JSON \u2014 ${R.message}`),process.exit(1)}let t=d;(typeof t!="object"||t===null||!t.project||!t.nodes||!t.edges)&&(console.error("FATAL: Missing top-level keys (project, nodes, edges)."),process.exit(1));let r=[],u=!1,y=[];if(t.journal===void 0){let R=(0,te.dirname)(e),C=(0,te.join)(R,dt),W=[];if((0,H.existsSync)(C)){let{events:q,findings:K}=we((0,H.readFileSync)(C,"utf8"));for(let s of K)r.push(s.message);u=!0,W.push(...q)}for(let q of Et(R)){let K=(0,te.basename)(q),{events:s,findings:D}=we((0,H.readFileSync)(q,"utf8"));for(let i of D)r.push(`${K} \u2014 ${i.message}`);y.push(K),W.push(...s)}(u||y.length>0)&&(t.journal=W)}let S=Array.isArray(t.nodes)?t.nodes:[],x=Array.isArray(t.edges)?t.edges:[],M=Array.isArray(t.journal)?t.journal:[],I=at(d);if(console.log(`
|
|
13
|
+
"use strict";var z=require("node:fs"),te=require("node:path");var ue=["flow","view","data-model","api-endpoint","acceptance","decision"],ne=["idea","discovery","backlog","development","releasing","live","archived"],re=["web","ios","android"],ye=["composes","calls","displays","queries","covers","supersedes","generates","impacts"],Te={composes:[["flow","view"],["flow","flow"],["view","flow"],["view","view"]],calls:[["view","api-endpoint"],["flow","api-endpoint"],["api-endpoint","api-endpoint"],["api-endpoint","view"]],displays:[["view","data-model"]],queries:[["api-endpoint","data-model"]],covers:[["acceptance","view"],["acceptance","flow"]],supersedes:[["decision","decision"]],generates:[["decision","acceptance"]],impacts:[["decision","flow"],["decision","view"],["decision","data-model"],["decision","api-endpoint"]]};var oe=["saves-time","simplifies","makes-money","reduces-risk","organizes","integrates","connects","reduces-effort","avoids-hassles","reduces-cost","quality","variety","sensory-appeal","informs","reduces-anxiety","rewards-me","nostalgia","design-aesthetics","badge-value","wellness","therapeutic-value","fun-entertainment","attractiveness","provides-access","provides-hope","self-actualization","motivation","heirloom","affiliation-belonging","self-transcendence"],we={"saves-time":"functional",simplifies:"functional","makes-money":"functional","reduces-risk":"functional",organizes:"functional",integrates:"functional",connects:"functional","reduces-effort":"functional","avoids-hassles":"functional","reduces-cost":"functional",quality:"functional",variety:"functional","sensory-appeal":"functional",informs:"functional","reduces-anxiety":"emotional","rewards-me":"emotional",nostalgia:"emotional","design-aesthetics":"emotional","badge-value":"emotional",wellness:"emotional","therapeutic-value":"emotional","fun-entertainment":"emotional",attractiveness:"emotional","provides-access":"emotional","provides-hope":"life-changing","self-actualization":"life-changing",motivation:"life-changing",heirloom:"life-changing","affiliation-belonging":"life-changing","self-transcendence":"social-impact"};var De={flow:"F-",view:"V-","data-model":"DM-","api-endpoint":"API-",acceptance:"AC-",decision:"DEC-"};var ht=["proposed","approved","enacted","rejected","deprecated","superseded"];function Oe(e){switch(e){case"proposed":return"discovery";case"approved":return"backlog";case"enacted":return"live";case"rejected":case"deprecated":case"superseded":return"archived"}}function Ce(e){let o=e.metadata?.decision_status;return ht.includes(o)?o:"proposed"}var ve={prioritized:"backlog",blocked:"development"};function be(e){return ne.includes(e)?e:ve[e]}var Vt={...ve},Ut={backlog:"idea",...ve};function Le(e){let o=new Map;for(let t of e){if(t.type!=="screenshot.recorded"&&t.type!=="screenshot.removed"||typeof t.node_id!="string"||typeof t.platform!="string")continue;let r=o.get(t.node_id);r||(r=new Map,o.set(t.node_id,r)),r.set(t.platform,t.type==="screenshot.removed"?null:t)}return o}function Fe(e){let o=t=>typeof t=="string"?t:"";return[...e].sort((t,r)=>{let l=o(t.ts),m=o(r.ts);if(l<m)return-1;if(l>m)return 1;let b=o(t.id),E=o(r.id);return b<E?-1:b>E?1:0})}function Se(e){let o=[],t=[];return e.split(/\r?\n/).forEach((l,m)=>{let b=m+1;if(l.trim()==="")return;let E;try{E=JSON.parse(l)}catch(U){t.push({line:b,rule:"journal-line-parse",message:`Line ${b}: not valid JSON \u2014 ${U.message}`,severity:"error"});return}if(typeof E!="object"||E===null||Array.isArray(E)){t.push({line:b,rule:"journal-line-shape",message:`Line ${b}: each journal line must be a single JSON event object.`,severity:"error"});return}let R=E,j=[];if(typeof R.id!="string"&&j.push("id"),typeof R.ts!="string"&&j.push("ts"),typeof R.type!="string"&&j.push("type"),j.length>0){t.push({line:b,rule:"journal-line-shape",message:`Line ${b}: event is missing required envelope field(s): ${j.join(", ")}.`,severity:"error"});return}o.push(R)}),{events:o,findings:t}}var yt={"node.updated":["node_id"],"node.status_changed":["node_id"],"decision.status_changed":["node_id"],"node.deleted":["node_id"],"edge.added":["source_id","target_id"],"ref.added":["node_id"],"ref.removed":["node_id"],"ref.status_changed":["node_id"],"screenshot.recorded":["node_id"],"screenshot.removed":["node_id"],"idea.proposed":["node_id"],"request.filed":["node_id"]};function We(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function wt(e,o){return e===o?!0:typeof o!="string"?!1:e==="backlog"&&o==="idea"?!0:(be(e)??e)===(be(o)??o)}function Ge(e){let o=[],t=e.journal;if(t===void 0)return o;if(!Array.isArray(t))return o.push({path:"journal",rule:"journal-shape",message:"journal must be an array of events when present.",severity:"error"}),o;if(t.length===0)return o;let r=i=>typeof i=="string"?i:void 0,l=Array.isArray(e.nodes)?e.nodes:[],m=Array.isArray(e.edges)?e.edges:[],b=new Map,E=new Map;for(let i of l){let c=r(i?.id);if(c!==void 0){b.set(c,i.status);let v=i.metadata,h=v&&typeof v=="object"&&!Array.isArray(v)?v.decision_status:void 0;E.set(c,h??"proposed")}}let R=new Set;for(let i of m){let c=r(i?.id);c!==void 0&&R.add(c)}let j=[];t.forEach((i,c)=>{let v=`journal[${c}]`;if(typeof i!="object"||i===null||Array.isArray(i)){o.push({path:v,rule:"journal-event-shape",message:`journal[${c}]: each event must be a JSON object.`,severity:"error"});return}let h=i,$=[];if(r(h.id)===void 0&&$.push("id"),r(h.ts)===void 0&&$.push("ts"),r(h.type)===void 0&&$.push("type"),$.length>0){o.push({path:v,rule:"journal-event-envelope",message:`journal[${c}]: event is missing required envelope field(s): ${$.join(", ")}.`,severity:"error"});return}j.push({ev:h,index:c})});let U=new Set(b.keys()),M=new Set(R),F=new Set;for(let{ev:i}of j)if(i.type==="node.created"){let c=r(i.node_id);c&&U.add(c)}else if(i.type==="edge.added"){let c=r(i.edge_id);c&&M.add(c)}else if(i.type==="journal.baseline"&&Array.isArray(i.node_ids))for(let c of i.node_ids){let v=r(c);v&&(F.add(v),U.add(v))}let W=Fe(j.map(i=>i.ev)),J=new Set,B=new Map,n=new Map;for(let i of W)if(i.type==="node.created"){let c=r(i.node_id);c&&J.add(c)}else if(i.type==="node.status_changed"){let c=r(i.node_id);if(c&&i.platform===void 0){let v=r(i.to);v!==void 0&&B.set(c,v)}}else if(i.type==="decision.status_changed"){let c=r(i.node_id);if(c){let v=r(i.to);v!==void 0&&n.set(c,v)}}for(let{ev:i,index:c}of j){let v=yt[i.type];if(v)for(let h of v){let $=r(i[h]);$!==void 0&&!U.has($)&&o.push({path:`journal[${c}].${h}`,rule:"journal-dangling-node-ref",message:`journal[${c}] (${i.type}): references node "${$}" that never existed in the snapshot or journal.`,severity:"error"})}if(i.type==="deliverable.shipped"&&Array.isArray(i.node_ids)&&i.node_ids.forEach((h,$)=>{let x=r(h);x!==void 0&&!U.has(x)&&o.push({path:`journal[${c}].node_ids[${$}]`,rule:"journal-dangling-node-ref",message:`journal[${c}] (${i.type}): references node "${x}" that never existed in the snapshot or journal.`,severity:"error"})}),i.type==="edge.removed"){let h=r(i.edge_id);h!==void 0&&!M.has(h)&&o.push({path:`journal[${c}].edge_id`,rule:"journal-dangling-edge-ref",message:`journal[${c}] (edge.removed): references edge "${h}" that never existed in the snapshot or journal.`,severity:"error"})}}for(let[i,c]of b){!J.has(i)&&!F.has(i)&&o.push({path:"journal",rule:"journal-missing-node-created",message:`Node "${i}" is present in the snapshot but has no node.created event in the journal.`,severity:"error"});let v=B.get(i);v!==void 0&&!wt(v,c)&&o.push({path:"journal",rule:"journal-status-mismatch",message:`Node "${i}": journal's last node.status_changed.to "${v}" disagrees with snapshot status "${String(c)}".`,severity:"error"})}for(let[i,c]of n){if(!E.has(i))continue;let v=E.get(i)??"proposed";c!==v&&o.push({path:"journal",rule:"journal-decision-status-mismatch",message:`Node "${i}": journal's last decision.status_changed.to "${c}" disagrees with snapshot decision_status "${String(v)}".`,severity:"error"})}let T=Le(W);return l.forEach((i,c)=>{let v=r(i?.id);if(v===void 0)return;let h=We(i.metadata)?i.metadata:{},$=We(h.platformScreenshots)?h.platformScreenshots:{},x=T.get(v),Y=new Set([...Object.keys($),...x?x.keys():[]]);for(let q of Y){let D=x?.get(q);if(D===void 0)continue;let Q=typeof $[q]=="string"?$[q]:void 0,A,X;if(D===null)X=Q===void 0,A="it was removed";else if(D.form==="data")X=Q!==void 0,A="a data URI was recorded";else{let Z=r(D.url);X=Q===Z,A=Z===void 0?"an unknown value was recorded":`"${Z}" was recorded`}X||o.push({path:`nodes[${c}].metadata.platformScreenshots.${q}`,rule:"screenshot-untracked",message:`Node "${v}": platformScreenshots.${q} is ${Q===void 0?"empty":`"${Q}"`} but the journal's last screenshot event says ${A} \u2014 write screenshots through record_screenshot, not update_node.`,severity:"warning"})}}),o}var Ve=["flow","view","acceptance"];function Ue(e){let o=e?.metadata?.products;if(!Array.isArray(o))return[];let t=new Set,r=[];for(let l of o){if(typeof l!="object"||l===null||Array.isArray(l))continue;let m=l;typeof m.id!="string"||m.id.trim()===""||t.has(m.id)||(t.add(m.id),r.push(m))}return r}var Je=["rings","bars"],qe=["chips","rows"],Be=["status","species"];var vt=["journey","system","screens"];function Ke(e){return vt.includes(e)}var pe="cross-surface";var bt={"saves-time":{"-3":"Takes hours out of the person's life.","-2":"Costs the person time on tasks they do regularly in this domain.","-1":"Costs the person a little time on one task inside the product.",1:"Saves a little time on one task inside the product.",2:"Saves time on tasks the person does regularly in this domain.",3:"Gives the person back hours of their life, the way online banking replaced trips to the bank."},simplifies:{"-3":"Makes a part of the person's life confusing or hard to manage.","-2":"Makes a whole task in this domain clearly more complicated.","-1":"Adds a step or a choice inside the product.",1:"Removes a step or a choice inside the product.",2:"Makes a whole task in this domain clearly simpler.",3:"Makes a complicated part of the person's life simple, the way a single search box replaced browsing directories."},"makes-money":{"-3":"Costs the person a meaningful part of their income.","-2":"Cuts a regular way the person earns in this domain.","-1":"Makes earning slightly harder or costs the person a little income.",1:"Helps the person earn a little, or makes earning slightly easier.",2:"Gives the person a regular way to earn in this domain.",3:"Provides a meaningful part of the person's income."},"reduces-risk":{"-3":"Exposes the person to a major loss in their life.","-2":"Exposes the person to a serious loss or error in this domain.","-1":"Exposes the person to a small mistake or loss inside the product.",1:"Guards against a small mistake or loss inside the product.",2:"Protects against a serious loss or error in this domain.",3:"Protects against a major loss in the person's life, the way insurance or a full backup does."},organizes:{"-3":"Brings disorder to a large part of the person's life.","-2":"Makes things in this domain hard to keep in order or to find.","-1":"Leaves a few things in disorder inside the product.",1:"Keeps a few things in order inside the product.",2:"Keeps everything in this domain in order and easy to find.",3:"Brings order to a large part of the person's life, the way a calendar does."},integrates:{"-3":"Pulls separate parts of the person's life further apart.","-2":"Splits apart the several tools the person uses in this domain.","-1":"Cuts the product off from one other tool the person uses.",1:"Connects the product to one other tool the person uses.",2:"Ties together the several tools the person uses in this domain.",3:"Makes separate parts of the person's life work together as one."},connects:{"-3":"Separates the person from the people who matter most in their life.","-2":"Makes it harder to build or keep relationships in this domain.","-1":"Gets in the way of reaching someone through the product.",1:"Lets the person reach someone through the product.",2:"Helps the person build and keep relationships in this domain.",3:"Brings the person together with the people who matter most in their life."},"reduces-effort":{"-3":"Puts a heavy burden of work on the person's life.","-2":"Adds repetitive work to a task the person does regularly in this domain.","-1":"Adds a little effort to one task inside the product.",1:"Saves a little effort on one task inside the product.",2:"Takes the repetitive work out of a task the person does regularly in this domain.",3:"Lifts a heavy burden of work off the person's life."},"avoids-hassles":{"-3":"Brings a whole kind of annoyance into the person's life.","-2":"Adds an annoyance that keeps coming back in this domain.","-1":"Adds a small annoyance inside the product.",1:"Avoids a small annoyance inside the product.",2:"Avoids an annoyance that keeps coming back in this domain.",3:"Takes a whole kind of annoyance out of the person's life, the way a GPS ended getting lost."},"reduces-cost":{"-3":"Costs the person a significant amount of money over their life.","-2":"Costs the person money regularly in this domain.","-1":"Costs the person a little money on one purchase.",1:"Saves the person a little money on one purchase.",2:"Saves the person money regularly in this domain.",3:"Saves the person a significant amount of money over their life."},quality:{"-3":"Craft so poor the person would call it the worst they have used.","-2":"The product does its job in this domain clearly worse than the usual alternatives.","-1":"Something inside the product works noticeably badly.",1:"Something inside the product works noticeably well.",2:"The product does its job in this domain clearly better than the usual alternatives.",3:"Craft so good the person would call it the best they have used."},variety:{"-3":"Closes off a breadth of choice the person had elsewhere.","-2":"Narrows the choice in this domain.","-1":"Removes a few meaningful options inside the product.",1:"Offers a few meaningful options inside the product.",2:"Offers a wide and meaningful choice in this domain.",3:"Opens a breadth of choice the person could not get anywhere else."},"sensory-appeal":{"-3":"A sensory experience the person avoids.","-2":"The product looks, sounds or feels bad and the person dislikes using it.","-1":"An unpleasant detail the person notices in the moment.",1:"A pleasant detail the person notices in the moment.",2:"The product looks, sounds or feels good and the person enjoys using it.",3:"A sensory experience the person seeks out for its own sake."},informs:{"-3":"Misleads the person deeply about the service area or domain.","-2":"Confuses the person about the service area or domain.","-1":"Hides from the person something about the service that they want to know.",1:"Informs the person about the service.",2:"Informs the person about the service area or domain.",3:"Informs the person deeply and efficiently about the service area or domain."},"reduces-anxiety":{"-3":"Gives the person a lasting worry in their life.","-2":"Stirs up a worry the person has in this domain.","-1":"Adds a small worry inside the product.",1:"Removes a small worry inside the product.",2:"Calms a worry the person has in this domain.",3:"Takes a lasting worry out of the person's life."},"rewards-me":{"-3":"Takes away rewards the person values as much as the product itself.","-2":"Takes away perks the person regularly values.","-1":"Takes away a small perk the person had.",1:"Gives the person a small perk for engaging.",2:"Gives the person regular perks they value.",3:"Gives the person rewards they value as much as the product itself."},nostalgia:{"-3":"Destroys a cherished memory for good.","-2":"Loses or overwrites a good memory of the past.","-1":"Puts a pleasant memory at slight risk.",1:"Faintly recalls a pleasant memory of the past.",2:"Clearly brings back a good memory of the past.",3:"Brings back a cherished past in a vivid and deeply felt way."},"design-aesthetics":{"-3":"Ugliness the person would be embarrassed to show to others.","-2":"A design the person finds ugly.","-1":"A displeasing design detail.",1:"A pleasing design detail.",2:"A design the person finds beautiful.",3:"Beauty the person would show to others and that shapes how they feel about it."},"badge-value":{"-3":"Signals something the person does not want the people who matter to them to see.","-2":"Clearly signals a low identity or status in a community.","-1":"Gives a mild negative signal about the person to others.",1:"Gives a mild signal about the person to others.",2:"Clearly signals the person's identity or status in a community.",3:"Signals who the person is to the people who matter to them."},wellness:{"-3":"Lastingly harms the person's physical or mental well-being.","-2":"Noticeably worsens how the person feels over time.","-1":"Slightly worsens how the person feels, in the moment.",1:"Slightly improves how the person feels, in the moment.",2:"Noticeably improves how the person feels over time.",3:"Lastingly improves the person's physical or mental well-being."},"therapeutic-value":{"-3":"Deepens something that hurts the person.","-2":"Makes a difficult feeling harder for the person to work through.","-1":"Reopens a small emotional sore.",1:"Gives a small moment of emotional relief.",2:"Helps the person work through a difficult feeling.",3:"Supports real healing of something that hurts the person."},"fun-entertainment":{"-3":"So joyless that the person avoids it and warns others.","-2":"Boring or tedious to use.","-1":"A dull moment.",1:"A light moment of enjoyment.",2:"Genuinely enjoyable to use.",3:"Delight the person would seek out and tell others about."},attractiveness:{"-3":"Changes how unattractive the person feels in general.","-2":"Clearly makes the person feel less attractive.","-1":"Makes the person feel slightly worse about how they look.",1:"Makes the person feel slightly better about how they look.",2:"Clearly makes the person feel more attractive.",3:"Changes how attractive the person feels in general."},"provides-access":{"-3":"Shuts the person out of something that matters in their life.","-2":"Cuts the person off from a service or from people in this domain that they could otherwise reach.","-1":"Puts a feature inside the product behind a barrier or closes it off.",1:"Opens a feature inside the product.",2:"Gives access to a service or to people in this domain that the person could not easily reach.",3:"Gives access to something that matters in the person's life and that they could not get otherwise."},"provides-hope":{"-3":"Leaves the person believing their life cannot get better.","-2":"Gives the person a reason to doubt that things in this domain can improve.","-1":"Plants a small doubt.",1:"Gives a small reason for optimism.",2:"Gives a real reason to believe things in this domain can improve.",3:"Gives a lasting belief that the person's life can get better."},"self-actualization":{"-3":"Pushes the person away from who they want to be.","-2":"Clear drift away from who the person wants to be.","-1":"A small step away from who the person wants to be.",1:"A small step toward who the person wants to be.",2:"Clear progress toward who the person wants to be.",3:"Helps the person become who they want to be."},motivation:{"-3":"Drains the person's drive toward goals that matter in their life.","-2":"Saps the person's energy toward a goal in this domain.","-1":"A small drag on the person's drive.",1:"A small nudge to act.",2:"Energizes the person toward a goal in this domain.",3:"Sustains the person's drive toward goals that matter in their life."},heirloom:{"-3":"Loses something meaningful that was meant to be passed on across time.","-2":"Lets something meaningful be lost within years.","-1":"Puts something worth keeping at slight risk.",1:"Keeps something worth keeping for a while.",2:"Preserves something meaningful for years.",3:"Holds something meaningful enough to be passed on to others across time."},"affiliation-belonging":{"-3":"Cuts the person off from a group that matters deeply to who they are.","-2":"Leaves the person out of a group in this domain.","-1":"A feeling of being slightly left out of something small.",1:"A feeling of being part of something small.",2:"Makes the person part of a group in this domain.",3:"Makes the person part of a group that matters deeply to who they are."},"self-transcendence":{"-3":"Works against something larger than the person themselves.","-2":"Harms others in a meaningful way.","-1":"Does a small harm to others.",1:"Does a small good for others.",2:"Helps others in a meaningful way.",3:"Contributes to something larger than the person themselves."}},Qe=Object.freeze(Object.fromEntries(Object.entries(bt).map(([e,o])=>[e,Object.freeze(o)])));var _e=["human","agent","rule"],He=["human","agent"];var ze=["p_serves","p_costs"];function Ye(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}var Xe="weighing.assessment.recorded",Ze="weighing.set.saved";function St(e,o,t){return`${e}\0${o}\0${t}`}function et(e){let o=typeof e?.scorer?.kind=="string"?e.scorer.kind:"";return`${St(String(e?.matrix),String(e?.subject),String(e?.criterion))}\0${o}`}var _t=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function tt(e){return _t(e)&&typeof e.matrix=="string"&&typeof e.subject=="string"&&typeof e.criterion=="string"}function ae(e){let o=e.lastIndexOf("@");return o===-1?{id:e,major:void 0}:{id:e.slice(0,o),major:e.slice(o+1)}}function ie(e){let o=/^(\d+)(?:\.|$)/.exec(e);return o?o[1]:void 0}function fe(e){if(typeof e=="object"&&e!==null&&!Object.isFrozen(e)){Object.freeze(e);for(let o of Object.values(e))fe(o)}return e}var $e="value-contribution",$t="2.0.0",kt="1.0.0",Et="value",de="positioning",xt={3:"Life-wide. It gives the person this well beyond the product and its domain, in their life.",2:"Across the domain. The person gets this in the whole area the product belongs to, not only inside it.",1:"Within the product. A real contribution, felt while using it.",0:"Unrelated: weighed and found to have nothing to do with it. (No row means nobody has weighed it yet.)","-1":"Within the product. A small cost, felt while using it.","-2":"Across the domain. The person notices the loss of this in the whole area the product belongs to.","-3":"Life-wide. It leaves the person with the opposite of this in their life."},At={3:"Core. The promise exists for this; take it away and the value goes.",2:"Supports clearly. The user would notice it missing.",1:"Touches. A side effect of the promise, not its purpose.",0:"Unrelated: weighed and found to have nothing to do with it. (No row means nobody has weighed it yet.)","-1":"Small friction. It costs this value a little.","-2":"Works against it. The user notices the cost.","-3":"Costs it at its core. The user feels the opposite."},nt={functional:"Functional",emotional:"Emotional","life-changing":"Life-changing","social-impact":"Social impact"},se={"saves-time":{name:"Saves time",definition:"Completes the user's task in less time."},simplifies:{name:"Simplifies",definition:"Reduces steps, choices, or cognitive load."},"makes-money":{name:"Makes money",definition:"Helps the user earn."},"reduces-risk":{name:"Reduces risk",definition:"Protects against loss, error, or uncertainty."},organizes:{name:"Organizes",definition:"Brings order to the user's things or life."},integrates:{name:"Integrates",definition:"Ties different tools or parts of life together."},connects:{name:"Connects",definition:"Brings the user together with other people."},"reduces-effort":{name:"Reduces effort",definition:"Same outcome, less work."},"avoids-hassles":{name:"Avoids hassles",definition:"Prevents friction and annoyance before it happens."},"reduces-cost":{name:"Reduces cost",definition:"Saves the user money."},quality:{name:"Quality",definition:"Superior craft or performance the user can feel."},variety:{name:"Variety",definition:"Meaningful choice and breadth."},"sensory-appeal":{name:"Sensory appeal",definition:"Looks, sounds, or feels good in the moment."},informs:{name:"Informs",definition:"Tells the user something they want to know."},"reduces-anxiety":{name:"Reduces anxiety",definition:"Calms; makes the user feel safe."},"rewards-me":{name:"Rewards me",definition:"Tangible perks for engagement."},nostalgia:{name:"Nostalgia",definition:"Positive memory of the past."},"design-aesthetics":{name:"Design / aesthetics",definition:"Beauty as an experienced value, beyond function."},"badge-value":{name:"Badge value",definition:"Signals identity or status to others."},wellness:{name:"Wellness",definition:"Improves physical or mental well-being."},"therapeutic-value":{name:"Therapeutic value",definition:"Actively supports emotional processing or healing."},"fun-entertainment":{name:"Fun / entertainment",definition:"Enjoyable, playful, delightful."},attractiveness:{name:"Attractiveness",definition:"Makes the user feel attractive."},"provides-access":{name:"Provides access",definition:"Grants entry to something otherwise out of reach."},"provides-hope":{name:"Provides hope",definition:"Reason to believe things can improve."},"self-actualization":{name:"Self-actualization",definition:"Helps the user become who they want to be."},motivation:{name:"Motivation",definition:"Energizes the user toward their goals."},heirloom:{name:"Heirloom",definition:"Something worth passing on across time."},"affiliation-belonging":{name:"Affiliation & belonging",definition:"Makes the user part of a group that matters."},"self-transcendence":{name:"Self-transcendence",definition:"Helps beyond the user themselves."}},st={min:-3,max:3,anchors:{...xt}},rt=Object.keys(nt).map(e=>({id:e,title:nt[e]}));function It(e){return e==="informs"?"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?":`Does this promise serve, or cost, "${se[e].name}" for the person? And how far into their life does it reach: within the product, across its domain, or life-wide?`}var Rt=fe({id:$e,version:$t,title:"Elements of value",subject:"acceptance",scale:st,groups:rt,criteria:oe.map(e=>({id:e,group:we[e],name:se[e].name,question:It(e),definition:se[e].definition,anchors:{...Qe[e]}}))}),jt=fe({id:$e,version:kt,title:"Elements of value",subject:"acceptance",scale:{min:-3,max:3,anchors:{...At}},groups:rt,criteria:oe.map(e=>({id:e,group:we[e],name:se[e].name,question:`Does this promise serve, or cost, "${se[e].name}"?`,definition:se[e].definition}))}),Mt=fe({id:Et,title:"Value",set:`${$e}@2`,subjects:{kind:"query",species:"acceptance"},positioning:de,status:"active"}),ke=[Rt,jt],Ee=[Mt],ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Pt(e){let o=e.criteria.filter(t=>ee(t)&&typeof t.id=="string");return o.length===e.criteria.length?e:{...e,criteria:o}}function xe(e){return ee(e)&&typeof e.id=="string"&&typeof e.version=="string"&&Array.isArray(e.criteria)&&(ee(e.scale)||e.role==="positioning")}function Ae(e){if(!ee(e)||typeof e.id!="string"||typeof e.set!="string"||!ee(e.subjects))return!1;let{kind:o,species:t,items:r}=e.subjects;return o==="query"&&typeof t=="string"||o==="list"&&Array.isArray(r)}function it(e){return ee(e)&&typeof e.min=="number"&&typeof e.max=="number"&&ee(e.anchors)}function ot(e,o){if(it(e.scale))return e.scale;let t=typeof e.extends=="string"&&o!==void 0?ge(o,e.extends):void 0;return t!==void 0&&it(t.scale)?t.scale:st}function at(e){let o=[...ke],t=[...Ee],r=[],l=m=>ee(m)?{...typeof m.id=="string"?{id:m.id}:{},...typeof m.role=="string"?{role:m.role}:{}}:{};return(Array.isArray(e?.sets)?e.sets:[]).forEach((m,b)=>{xe(m)&&!o.some(E=>E.id===m.id)?o.push(Pt(m)):r.push({kind:"set",...l(m),index:b})}),(Array.isArray(e?.matrices)?e.matrices:[]).forEach((m,b)=>{Ae(m)&&!t.some(E=>E.id===m.id)?t.push(m):r.push({kind:"matrix",...l(m),index:b})}),{sets:o,matrices:t,skipped:r}}function ge(e,o){let{id:t,major:r}=ae(o);return e.sets.find(l=>l.id===t&&(r===void 0||ie(l.version)===r))}function Ie(e,o){let{id:t,major:r}=ae(o),l=e.sets.find(b=>b.id===t);if(l===void 0||r===void 0)return!1;let m=Number(ie(l.version));return Number.isFinite(m)&&Number(r)<m}var H=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function dt(e,o,t){let r=[],l=(m,b,E)=>r.push({path:m,rule:b,message:E});if(e!=null&&!H(e)&&l("weighing","weighing-section-shape","The weighing section is not an object \u2014 it is ignored"),H(e)){for(let n of["sets","matrices","assessments"])e[n]!==void 0&&!Array.isArray(e[n])&&l(`weighing.${n}`,"weighing-section-shape",`weighing.${n} is not an array \u2014 it is ignored`);let m=Array.isArray(e.sets)?e.sets:[],b=Array.isArray(e.matrices)?e.matrices:[],E=Array.isArray(e.assessments)?e.assessments:[],R=at(e),j=(n,T,i,c)=>{let v=ge(R,n);if(v!==void 0)return v;let h=R.sets.find($=>$.id===ae(n).id);h!==void 0?l(T,"weighing-set-ref-major",`${i} names ${n}, but "${h.id}" is at ${h.version} \u2014 levels are comparable only within a major, so the ref resolves to nothing`):l(T,c,`${i} names set "${n}", which is neither built in nor in this section`)},U=new Set(R.matrices.map(n=>n.positioning).filter(n=>typeof n=="string")),M=(n,T,i)=>{i.status!==void 0&&i.status!=="draft"&&i.status!=="active"&&l(`${n}.status`,"weighing-set-status",`${T}: status ${JSON.stringify(i.status)} is not "draft" or "active" \u2014 it is read as a draft, which feeds no roll-up`)},F=n=>H(n)&&Object.values(n).every(T=>typeof T=="string"),W=new Set;m.forEach((n,T)=>{let i=`weighing.sets[${T}]`;if(!H(n)){l(i,"weighing-set-shape","A set is not an object \u2014 it is ignored");return}let c=`Set "${String(n.id)}"`,v=xe(n);if(v||l(i,"weighing-set-shape",`${c} needs a string id and version, a criteria array and a scale object (a positioning may leave the scale out) \u2014 it is ignored`),typeof n.id=="string"&&(ke.some(h=>h.id===n.id)?l(`${i}.id`,"weighing-pinned-set-redefined",`${c} is built in and pinned by version \u2014 the project's copy is ignored`):v&&(W.has(n.id)&&l(`${i}.id`,"weighing-duplicate-set",`Duplicate set id "${n.id}" \u2014 the first well-formed one wins, this one is ignored`),W.add(n.id))),M(i,c,n),H(n.scale)){let h=n.scale;(typeof h.min!="number"||typeof h.max!="number"||!F(h.anchors))&&l(`${i}.scale`,"weighing-scale-shape",`${c}: a scale needs a numeric min and max and an anchors object of strings`)}if(Array.isArray(n.criteria)&&n.criteria.forEach((h,$)=>{let x=`${i}.criteria[${$}]`;(!H(h)||typeof h.id!="string"||h.anchors!==void 0&&!F(h.anchors))&&l(x,"weighing-criterion-shape",`${c}: criterion ${$} needs a string id, and its anchors (if any) must be an object of strings`)}),n.role==="positioning"&&!(typeof n.id=="string"&&U.has(n.id))?l(`${i}.id`,"weighing-positioning-id",`A positioning set must have the id "${de}" (the one a matrix points at) \u2014 "${String(n.id)}" would never be applied`):n.role!=="positioning"&&n.id===de&&l(`${i}.role`,"weighing-positioning-id",`Set "${de}" is where a matrix looks for its positioning, but its role is ${JSON.stringify(n.role)}, not "positioning" \u2014 it would never be applied`),n.role==="positioning"){let h=typeof n.extends=="string"?j(n.extends,`${i}.extends`,`Positioning "${String(n.id)}"`,"weighing-positioning-unknown-ruler"):void 0;typeof n.extends!="string"?l(`${i}.extends`,"weighing-positioning-unknown-ruler",`Positioning "${String(n.id)}" does not say which set it re-weights \u2014 set extends to e.g. value-contribution@2`):h!==void 0&&h.role==="positioning"?l(`${i}.extends`,"weighing-positioning-unknown-ruler",`Positioning "${String(n.id)}" extends "${n.extends}", which is itself a positioning \u2014 it must extend a criteria set such as value-contribution@2`):h!==void 0&&Ie(R,n.extends)&&l(`${i}.extends`,"weighing-positioning-old-ruler",`Positioning "${String(n.id)}" extends ${n.extends}, an older ruler \u2014 its weights still apply, but read its level descriptions against ${h.id}'s current major and save it again`);let $=new Set(h!==void 0&&h.role!=="positioning"?h.criteria.map(x=>x?.id):[]);(Array.isArray(n.criteria)?n.criteria:[]).forEach((x,Y)=>{if(!H(x))return;let q=`${i}.criteria[${Y}]`;$.size>0&&typeof x.id=="string"&&!$.has(x.id)&&l(`${q}.id`,"weighing-positioning-unknown-element",`Positioning names "${x.id}", which is not in ${String(n.extends)}`),x.weight!==void 0&&(typeof x.weight!="number"||!(x.weight>0))&&l(`${q}.weight`,"weighing-positioning-weight",`Positioning weight for "${String(x.id)}" must be a number above 0 \u2014 leave the element out to leave it unpositioned`)})}});let J=new Set;b.forEach((n,T)=>{let i=`weighing.matrices[${T}]`;if(!H(n)){l(i,"weighing-matrix-shape","A matrix is not an object \u2014 it is ignored");return}let c=`Matrix "${String(n.id)}"`,v=Ae(n);v||l(i,"weighing-matrix-shape",`${c} needs a string id, a set ref and a subjects object of kind query or list \u2014 it is ignored`),typeof n.id=="string"&&(Ee.some(h=>h.id===n.id)?l(`${i}.id`,"weighing-pinned-matrix-redefined",`${c} is built in \u2014 the project's copy is ignored`):v&&(J.has(n.id)&&l(`${i}.id`,"weighing-duplicate-matrix",`Duplicate matrix id "${n.id}" \u2014 the first well-formed one wins, this one is ignored`),J.add(n.id))),M(i,c,n),v&&j(n.set,`${i}.set`,c,"weighing-unknown-set")!==void 0&&Ie(R,n.set)&&l(`${i}.set`,"weighing-matrix-old-ruler",`${c} reads ${n.set}, an older ruler \u2014 its levels still read, but nothing new can be scored on it; point it at the current major`)});let B=new Set;E.forEach((n,T)=>{let i=`weighing.assessments[${T}]`,c=`Assessment ${T}`;if(!tt(n)){l(i,"weighing-assessment-shape",`${c}: not an object with a string matrix, subject and criterion \u2014 it cannot be addressed, so every reader skips it`);return}(typeof n.ts!="string"||Number.isNaN(Date.parse(n.ts)))&&l(`${i}.ts`,"weighing-assessment-ts",`${c}: ts must be an ISO 8601 string \u2014 without it "latest wins" cannot order this row`);let v=R.matrices.find(A=>A.id===n.matrix);v===void 0&&l(`${i}.matrix`,"weighing-unknown-matrix",`${c}: matrix "${n.matrix}" is not defined`);let h=v===void 0?void 0:ge(R,v.set),$=h?.criteria.find(A=>A?.id===n.criterion);h!==void 0&&$===void 0&&l(`${i}.criterion`,"weighing-unknown-criterion",`${c}: criterion "${n.criterion}" is not in set "${h.id}"`),$!==void 0&&typeof $.superseded_by=="string"&&$.superseded_by!==""&&l(`${i}.criterion`,"weighing-retired-criterion",`${c}: criterion "${$.id}" is retired \u2014 superseded by "${$.superseded_by}"`);let x=h===void 0?void 0:ot(h,R),Y=typeof x?.min=="number"?x.min:-3,q=typeof x?.max=="number"?x.max:3;(typeof n.level!="number"||!Number.isInteger(n.level)||n.level<Y||n.level>q)&&l(`${i}.level`,"weighing-level-range",`${c}: level must be an integer ${Y}..${q} (a blank cell is the absence of the row; 0 means weighed and unrelated)`),[0,1,2,3].includes(n.confidence)||l(`${i}.confidence`,"weighing-confidence-range",`${c}: confidence must be 0, 1, 2 or 3`);let D=H(n.scorer)?n.scorer:void 0;if(D===void 0||typeof D.kind!="string"||typeof D.id!="string"||D.id===""?l(`${i}.scorer`,"weighing-scorer-missing",`${c}: no scorer with a string kind and id \u2014 human, agent and rule levels become indistinguishable, and the row can win no cell`):_e.includes(D.kind)?He.includes(D.kind)||l(`${i}.scorer.kind`,"weighing-rule-stored",`${c}: scorer kind "${D.kind}" is never stored \u2014 a seeding rule is computed on read`):l(`${i}.scorer.kind`,"weighing-scorer-kind",`${c}: scorer kind "${D.kind}" is not one of ${_e.join(", ")} \u2014 it ranks below every other scorer`),v?.subjects.kind==="query"){let A=o.get(n.subject);A===void 0?l(`${i}.subject`,"weighing-unknown-subject",`${c}: subject "${n.subject}" is not a node in this bundle`):A!==v.subjects.species&&l(`${i}.subject`,"weighing-subject-species",`${c}: subject "${n.subject}" is a ${A}, and matrix "${v.id}" judges ${String(v.subjects.species)} nodes`)}n.evidence!==void 0&&typeof n.evidence!="string"?l(`${i}.evidence`,"weighing-evidence-type",`${c}: evidence must be a markdown string`):(n.confidence===2||n.confidence===3)&&(n.evidence===void 0||n.evidence.trim()==="")&&l(`${i}.evidence`,"weighing-no-evidence",`${c}: confidence ${String(n.confidence)} claims evidence and cites none`);for(let A of ze)n[A]!==void 0&&!Ye(n[A])&&l(`${i}.${A}`,"weighing-probability-shape",`${c}: ${A} must be a number from 0 to 1 \u2014 it is ignored`);if(n.refs!==void 0&&!(Array.isArray(n.refs)&&n.refs.every(A=>typeof A=="string"))&&l(`${i}.refs`,"weighing-refs-type",`${c}: refs must be an array of id strings`),n.basis!==void 0&&!(H(n.basis)&&["fingerprint","commit","set_version"].every(A=>n.basis[A]===void 0||typeof n.basis[A]=="string"))&&l(`${i}.basis`,"weighing-basis-shape",`${c}: basis must be an object whose fingerprint, commit and set_version are strings`),D!==void 0&&typeof D.kind=="string"){let A=et(n);B.has(A)&&l(i,"weighing-duplicate-assessment",`${c}: a second ${D.kind} score for the same cell \u2014 the section stores latest-per-scorer-kind, so this cell is ambiguous`),B.add(A)}let Q=H(n.basis)&&typeof n.basis.set_version=="string"?n.basis.set_version:void 0;h!==void 0&&Q!==void 0&&ie(Q)!==ie(h.version)&&l(`${i}.basis.set_version`,"weighing-set-major",`${c}: scored against ${h.id} ${Q}, and the set is now ${h.version} \u2014 levels are comparable only within a major`)})}return t.forEach((m,b)=>{if(!H(m))return;let E=typeof m.type=="string"?m.type:"";E!==Xe&&E!==Ze||(typeof m.actor!="string"||m.actor.trim()==="")&&l(`journal[${b}].actor`,"weighing-event-no-actor",`Journal event ${b}: ${E} has no actor \u2014 human, agent and CI scores become indistinguishable`)}),r}var Nt=["beta","monitoring","deprecated"],ct=["compact","large"],lt=2*1024*1024;function Tt(e){let o=e.indexOf(",");if(o===-1)return 0;let t=e.slice(o+1),r=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.floor(t.length*3/4)-r}function ut(e){return typeof e=="string"&&!Number.isNaN(Date.parse(e))}function pt(e){let o=[],t=(s,u,a)=>o.push({path:s,rule:u,message:a,severity:"error"}),r=(s,u,a)=>o.push({path:s,rule:u,message:a,severity:"warning"}),l=()=>{let s=o.filter(a=>a.severity==="error"),u=o.filter(a=>a.severity==="warning");return{valid:s.length===0,findings:o,errors:s,warnings:u}};if(typeof e!="object"||e===null||Array.isArray(e))return t("","bundle-shape","Bundle must be an object with project, nodes, and edges."),l();let m=e,b=m.project,E=m.nodes,R=m.edges;if(!b||!E||!R)return t("","bundle-shape","Missing top-level keys (project, nodes, edges)."),l();if(!Array.isArray(E))return t("nodes","bundle-shape","nodes must be an array."),l();if(!Array.isArray(R))return t("edges","bundle-shape","edges must be an array."),l();let j=E,U=R,M=new Map,F=new Set;b.id||t("project.id","project-id-required","project.id is missing"),(typeof b.title!="string"||!b.title.trim())&&t("project.title","title-non-empty","project.title is missing or empty"),b.created_at||t("project.created_at","timestamp-required","project.created_at is missing"),b.updated_at||t("project.updated_at","timestamp-required","project.updated_at is missing"),b.created_at&&!ut(b.created_at)&&r("project.created_at","iso-timestamp","project.created_at is not a valid ISO 8601 timestamp"),b.updated_at&&!ut(b.updated_at)&&r("project.updated_at","iso-timestamp","project.updated_at is not a valid ISO 8601 timestamp");let W=b.metadata;W&&W.view_card_variant!==void 0&&!ct.includes(W.view_card_variant)&&t("project.metadata.view_card_variant","view-card-variant",`project.metadata.view_card_variant must be one of ${ct.join(", ")} (import rejects other values)`),j.forEach((s,u)=>{let a=`nodes[${u}]`,d=s.id;F.has(d)&&t(`${a}.id`,"duplicate-node-id",`Duplicate node ID: ${d}`),F.add(d),M.set(d,s),(typeof s.title!="string"||!s.title.trim())&&t(`${a}.title`,"title-non-empty",`Node ${d}: title is missing or empty`);let f=s.species,p=De[f];p&&!(typeof d=="string"&&d.startsWith(p))&&t(`${a}.id`,"species-prefix",`Node ${d}: species "${f}" should have prefix "${p}"`),ue.includes(f)||t(`${a}.species`,"valid-species",`Node ${d}: invalid species "${f}"`),s.project_id!==b.id&&t(`${a}.project_id`,"project-id-match",`Node ${d}: project_id "${s.project_id}" does not match project.id "${b.id}"`),ne.includes(s.status)||t(`${a}.status`,"valid-status",`Node ${d}: invalid status "${s.status}"`);let y=s.platforms;if(!y||y.length===0)f!=="decision"&&t(`${a}.platforms`,"platforms-non-empty",`Node ${d}: platforms array is empty or missing`);else for(let g of y)re.includes(g)||t(`${a}.platforms`,"valid-platform",`Node ${d}: invalid platform "${g}"`);let w=s.metadata||{};w.stage!==void 0&&!Nt.includes(w.stage)&&t(`${a}.metadata.stage`,"valid-stage",`Node ${d}: invalid metadata.stage "${w.stage}"`);let I=w.platformNotes;if(I)for(let g of Object.keys(I))re.includes(g)||t(`${a}.metadata.platformNotes`,"valid-platform",`Node ${d}: platformNotes has invalid platform "${g}"`);let P=w.platformStatuses;if(P)for(let[g,S]of Object.entries(P))re.includes(g)?Array.isArray(y)&&!y.includes(g)&&r(`${a}.metadata.platformStatuses`,"platform-statuses-subset",`Node ${d}: platformStatuses covers platform "${g}" not in node.platforms`):t(`${a}.metadata.platformStatuses`,"valid-platform",`Node ${d}: platformStatuses has invalid platform "${g}"`),ne.includes(S)||t(`${a}.metadata.platformStatuses`,"valid-status",`Node ${d}: platformStatuses has invalid status "${S}" for platform "${g}"`);let O=w.platformScreenshots;if(O){for(let[g,S]of Object.entries(O))if(typeof S=="string"&&S.startsWith("data:")){let L=Tt(S);L>lt&&r(`${a}.metadata.platformScreenshots`,"screenshot-data-uri-size",`Node ${d}: platformScreenshots.${g} is a ${(L/(1024*1024)).toFixed(1)}MB data URI, above the ${lt/(1024*1024)}MB guidance (docs/spec/bundle-format.md \xA7 Asset Values) \u2014 consider a relative path or hosted URL instead`)}}let C=w.gherkin,K=w.values;if(f==="acceptance"?((typeof C!="string"||!C.trim())&&r(`${a}.metadata.gherkin`,"acceptance-gherkin-missing",`Acceptance ${d}: metadata.gherkin is missing or empty (one Given/When/Then scenario expected)`),(!Array.isArray(K)||K.length===0)&&r(`${a}.metadata.values`,"acceptance-values-missing",`Acceptance ${d}: metadata.values is missing or empty (assign 1-3 value elements)`)):(C!==void 0&&r(`${a}.metadata.gherkin`,"gherkin-species",`Node ${d}: metadata.gherkin is only meaningful on acceptance nodes`),K!==void 0&&r(`${a}.metadata.values`,"values-species",`Node ${d}: metadata.values is only meaningful on acceptance nodes`)),Array.isArray(K))for(let g of K)oe.includes(g)||t(`${a}.metadata.values`,"valid-value",`Node ${d}: invalid value element "${g}"`);let _=w.refs;if(Array.isArray(_)){let g=new Set;_.forEach((S,L)=>{let N=S??{},G=`${a}.metadata.refs[${L}]`,V=N.id;typeof V!="string"||!V.trim()?t(`${G}.id`,"ref-id-required",`Node ${d}: ref is missing an id`):g.has(V)?t(`${G}.id`,"duplicate-ref-id",`Node ${d}: duplicate ref id "${V}"`):g.add(V),(typeof N.url!="string"||!N.url.trim())&&t(`${G}.url`,"ref-url-required",`Node ${d}: ref "${V}" is missing a url`),N.status_mapped!==void 0&&!ne.includes(N.status_mapped)&&t(`${G}.status_mapped`,"valid-status",`Node ${d}: ref "${V}" has invalid status_mapped "${N.status_mapped}"`)})}if(w.decision_status!==void 0&&f!=="decision"&&r(`${a}.metadata.decision_status`,"decision-status-wrong-species",`decision_status is meaningful on decision nodes only; "${d}" is a ${f}.`),f==="decision"){let g=Ce({metadata:s.metadata}),S=Oe(g);s.status!==S&&r(`${a}.status`,"decision-lifecycle-mismatch",`Decision "${d}" is ${g}, whose lifecycle status should be "${S}", but status is "${s.status}" (spec \xA72).`)}if(f==="flow"){let g=w.playlist;!s.metadata||!g||!g.entries?t(`${a}.metadata.playlist`,"flow-playlist-required",`Flow ${d}: missing metadata.playlist.entries`):g.entries.length===0&&r(`${a}.metadata.playlist`,"flow-playlist-empty",`Flow ${d}: playlist is empty`)}});let J=b.root_node_id;J&&!F.has(J)&&t("project.root_node_id","root-node-exists",`project.root_node_id "${J}" does not reference an existing node`);let B=(s,u,a)=>{if(typeof s!="object"||s===null||Array.isArray(s))return;let d=s,f=[["flow_platforms",Je],["view_platforms",qe],["minimap_color",Be]];for(let[p,y]of f){let w=d[p];w!==void 0&&(typeof w!="string"||!y.includes(w))&&r(`${u}.${p}`,"map-unknown-display",`${a} sets ${p} to "${String(w)}"; expected one of ${y.join(", ")} (renderers fall back to the default)`)}d.images!==void 0&&typeof d.images!="boolean"&&r(`${u}.images`,"map-unknown-display",`${a} sets images to a non-boolean value (renderers fall back to the default)`)},n=W?.map_display;if(typeof n=="object"&&n!==null&&!Array.isArray(n))for(let[s,u]of Object.entries(n))B(u,`project.metadata.map_display.${s}`,`Map "${s}"`);let T=W?.maps;if(Array.isArray(T)){let s=new Set;T.forEach((u,a)=>{if(typeof u!="object"||u===null||Array.isArray(u))return;let d=u,f=`project.metadata.maps[${a}]`,p=typeof d.id=="string"?d.id:void 0;p!==void 0&&(s.has(p)&&r(`${f}.id`,"map-duplicate-id",`Duplicate map id "${p}"`),s.add(p),Ke(p)&&r(`${f}.id`,"map-shadows-built-in",`Map id "${p}" shadows a built-in map and will be ignored`));let y=d.root_node_id;typeof y=="string"&&!F.has(y)&&r(`${f}.root_node_id`,"map-unknown-root",`Map "${p??a}" anchors on "${y}" which does not reference an existing node`),Array.isArray(d.species)&&d.species.forEach((w,I)=>{typeof w=="string"&&!ue.includes(w)&&r(`${f}.species[${I}]`,"map-unknown-species",`Map "${p??a}" filters on unknown species "${w}"`)}),Array.isArray(d.edge_types)&&d.edge_types.forEach((w,I)=>{typeof w=="string"&&!ye.includes(w)&&r(`${f}.edge_types[${I}]`,"map-unknown-edge-type",`Map "${p??a}" filters on unknown edge type "${w}"`)}),B(d.display,`${f}.display`,`Map "${p??a}"`)})}let i=W?.products,c=new Set;if(Array.isArray(i)){let s=new Set;i.forEach((u,a)=>{if(typeof u!="object"||u===null||Array.isArray(u))return;let d=u,f=`project.metadata.products[${a}]`,p=typeof d.id=="string"?d.id:void 0;p!==void 0&&(s.has(p)?r(`${f}.id`,"product-duplicate-id",`Duplicate product id "${p}" \u2014 the first wins`):(s.add(p),p.trim()!==""&&c.add(p)),/^[a-z0-9]+(-[a-z0-9]+)*$/.test(p)||r(`${f}.id`,"product-invalid-id",`Product id "${p}" is not kebab-case`))})}let v=c.size>0,h=new Map;for(let s of U){if(s.edge_type!=="covers")continue;let u=typeof s.source_id=="string"?s.source_id:void 0,a=typeof s.target_id=="string"?s.target_id:void 0;if(u===void 0||a===void 0)continue;let d=h.get(u)??[];d.push(a),h.set(u,d)}let $=new Map;if(v)for(let s of Ue({metadata:W}))$.set(s.id,new Set(Array.isArray(s.platforms)?s.platforms:[]));let x=new Map,Y=new Map;if(j.forEach((s,u)=>{let a=typeof s.id=="string"?s.id:`#${u}`,d=s.species,f=`nodes[${u}]`;Y.set(a,u);let p=s.metadata??{},y=typeof p.product=="string"?p.product:void 0,w=d!==void 0&&Ve.includes(d);if(y!==void 0&&!w){let O=ue.includes(d)?`${d} membership is derived from consumers and must not be stored`:"metadata.product is only meaningful on flow, view, and acceptance nodes";r(`${f}.metadata.product`,"product-membership-wrong-species",`Node ${a}: ${O}`);return}if(!w)return;if(y===void 0){if(!v)return;d==="acceptance"?h.has(a)||r(`${f}.metadata.product`,"acceptance-product-unassigned",`Acceptance ${a} covers nothing and names no product \u2014 it will show only under "All products"`):r(`${f}.metadata.product`,"unassigned-membership",`Node ${a}: no product membership \u2014 it will show only under "All products"`);return}if(x.set(a,y),!c.has(y)){r(`${f}.metadata.product`,"product-unknown-reference",`Node ${a}: product "${y}" is not declared on the project`);return}let I=$.get(y),P=Array.isArray(s.platforms)?s.platforms:[];if(I)for(let O of P)typeof O=="string"&&!I.has(O)&&r(`${f}.platforms`,"product-platform-not-in-menu",`Node ${a}: platform "${O}" is not in product "${y}"'s menu`)}),v)for(let[s,u]of h){let a=Y.get(s);if(a===void 0)continue;let d=new Set(u.map(f=>x.get(f)).filter(f=>!!f));d.size>1&&r(`nodes[${a}].metadata.product`,"acceptance-covers-span-products",`Acceptance ${s} covers anchors in ${[...d].sort().join(" and ")} \u2014 statuses may conflate products`)}let q=new Set,D=new Set,Q=new Set;U.forEach((s,u)=>{let a=`edges[${u}]`,d=s.id,f=s.source_id,p=s.target_id,y=s.edge_type;q.has(d)&&t(`${a}.id`,"duplicate-edge-id",`Duplicate edge ID: ${d}`),q.add(d);let w=`e-${f}-${p}`;d!==w&&r(`${a}.id`,"edge-id-convention",`Edge ${d}: id does not match convention "${w}" (stale after a rename?)`);let I=`${f}->${p}:${y}`;D.has(I)&&r(`${a}`,"duplicate-edge-relationship",`Duplicate edge relationship: ${I}`),D.add(I),s.project_id!==b.id&&t(`${a}.project_id`,"project-id-match",`Edge ${d}: project_id does not match project.id`),F.has(f)||t(`${a}.source_id`,"dangling-edge",`Edge ${d}: source_id "${f}" not found in nodes`),F.has(p)||t(`${a}.target_id`,"dangling-edge",`Edge ${d}: target_id "${p}" not found in nodes`),ye.includes(y)||t(`${a}.edge_type`,"valid-edge-type",`Edge ${d}: invalid edge_type "${y}"`);let P=M.get(f),O=M.get(p),C=Te[y];P&&O&&C&&(C.some(([_,k])=>_===P.species&&k===O.species)||t(`${a}.edge_type`,"edge-semantics",`Edge ${d}: "${y}" not valid from ${P.species} to ${O.species}`)),y==="composes"&&Q.add(`${f}->${p}`)});let A=["view","flow","condition","junction"],X=(s,u,a,d=0)=>{if(!(d>50)){if(!Array.isArray(s)){t(a,"playlist-entry-shape",`Flow ${u}: ${a} must be an array of playlist entries`);return}s.forEach((f,p)=>{let y=`${a}[${p}]`;if(typeof f!="object"||f===null||Array.isArray(f)){t(y,"playlist-entry-shape",`Flow ${u}: ${y} must be a playlist entry object`);return}let w=f,I=w.type;if(typeof I!="string"||!A.includes(I)){t(`${y}.type`,"playlist-entry-shape",`Flow ${u}: ${y}.type must be one of ${A.join(", ")} (got ${JSON.stringify(I)})`);return}if(I==="view")typeof w.view_id!="string"&&t(`${y}.view_id`,"playlist-entry-shape",`Flow ${u}: ${y} is a view entry with no view_id string`);else if(I==="flow")typeof w.flow_id!="string"&&t(`${y}.flow_id`,"playlist-entry-shape",`Flow ${u}: ${y} is a flow entry with no flow_id string`);else if(I==="condition"){typeof w.label!="string"&&t(`${y}.label`,"playlist-entry-shape",`Flow ${u}: ${y} is a condition with no label string`);for(let P of["if_true","if_false"])Array.isArray(w[P])?X(w[P],u,`${y}.${P}`,d+1):t(`${y}.${P}`,"playlist-entry-shape",`Flow ${u}: ${y}.${P} must be an array of playlist entries (both branches are required, use [] for an empty one)`)}else{if(typeof w.label!="string"&&t(`${y}.label`,"playlist-entry-shape",`Flow ${u}: ${y} is a junction with no label string`),!Array.isArray(w.cases)){t(`${y}.cases`,"playlist-entry-shape",`Flow ${u}: ${y}.cases must be an array of junction cases`);return}w.cases.forEach((P,O)=>{let C=`${y}.cases[${O}]`;if(typeof P!="object"||P===null||Array.isArray(P)){t(C,"playlist-entry-shape",`Flow ${u}: ${C} must be a junction case object`);return}let K=P;typeof K.label!="string"&&t(`${C}.label`,"playlist-entry-shape",`Flow ${u}: ${C} has no label string`),Array.isArray(K.entries)?X(K.entries,u,`${C}.entries`,d+1):t(`${C}.entries`,"playlist-entry-shape",`Flow ${u}: ${C}.entries must be an array of playlist entries \u2014 a junction case holds its own entries, not a bare view_id/flow_id`)})}})}};j.forEach((s,u)=>{let a=s.metadata;s.species==="flow"&&a?.playlist?.entries&&X(a.playlist.entries,s.id,`nodes[${u}].metadata.playlist.entries`)});let Z=(s,u,a,d=0)=>{if(d>50)return t(a,"playlist-depth",`Flow ${u}: playlist nesting too deep (possible cycle)`),[];let f=[];if(!Array.isArray(s))return f;for(let p of s)if(!(typeof p!="object"||p===null)){if(p.type==="view")F.has(p.view_id)||t(a,"playlist-ref-exists",`Flow ${u}: playlist references non-existent view "${p.view_id}"`),f.push(p.view_id);else if(p.type==="flow")F.has(p.flow_id)||t(a,"playlist-ref-exists",`Flow ${u}: playlist references non-existent flow "${p.flow_id}"`),p.flow_id===u&&t(a,"playlist-self-cycle",`Flow ${u}: playlist contains itself (direct cycle)`),f.push(p.flow_id);else if(p.type==="condition")p.if_true&&f.push(...Z(p.if_true,u,a,d+1)),p.if_false&&f.push(...Z(p.if_false,u,a,d+1));else if(p.type==="junction"&&p.cases)for(let y of p.cases)f.push(...Z(y.entries||[],u,a,d+1))}return f};j.forEach((s,u)=>{let a=s.metadata;if(s.species==="flow"&&a?.playlist?.entries){let d=`nodes[${u}].metadata.playlist`,f=s.id,p=Z(a.playlist.entries,f,d);for(let y of p)Q.has(`${f}->${y}`)||t(d,"playlist-composes-coherence",`Flow ${f}: playlist references "${y}" but no composes edge exists`)}});let me=new Map,Re=new Map;j.forEach((s,u)=>{let a=s.metadata;if(s.species==="flow"&&a?.playlist?.entries){let d=s.id,f=[],p=y=>{if(Array.isArray(y)){for(let w of y)if(!(typeof w!="object"||w===null)&&(w.type==="flow"&&f.push(w.flow_id),w.type==="condition"&&(w.if_true&&p(w.if_true),w.if_false&&p(w.if_false)),w.type==="junction"&&w.cases))for(let I of w.cases)p(I.entries||[])}};p(a.playlist.entries),me.set(d,f),Re.set(d,`nodes[${u}].metadata.playlist`)}});let je=new Set,he=new Set,Me=s=>{if(he.has(s))return!0;if(je.has(s))return!1;je.add(s),he.add(s);for(let u of me.get(s)||[])if(Me(u))return t(Re.get(s)??"","flow-cycle",`Cycle detected: flow "${s}" -> "${u}"`),!0;return he.delete(s),!1};for(let s of me.keys())Me(s);let le=m.quality;if(typeof le=="object"&&le!==null&&!Array.isArray(le)){let s=le,u=Array.isArray(s.assessments)?s.assessments:[],a=Array.isArray(s.findings)?s.findings:[],d=typeof s.profile=="object"&&s.profile!==null?s.profile:void 0,f=new Set;Array.isArray(d?.surfaces)&&d.surfaces.forEach((_,k)=>{if(typeof _!="object"||_===null||Array.isArray(_))return;let g=_,S=typeof g.id=="string"?g.id:void 0;S===void 0||S.trim()===""||(f.has(S)&&r(`quality.profile.surfaces[${k}].id`,"quality-duplicate-surface",`Duplicate surface id "${S}" \u2014 the first wins`),f.add(S))}),f.size===0&&(u.length>0||a.length>0)&&r("quality.profile.surfaces","quality-no-surfaces","Quality data is stored but the profile declares no surfaces \u2014 the matrix falls back to the surfaces the assessments name");let p=typeof s.library=="object"&&s.library!==null?s.library:void 0,y=new Set,w=new Map;if(Array.isArray(p?.criteria))for(let _ of p.criteria){if(typeof _!="object"||_===null)continue;let k=_;typeof k.id=="string"&&(y.add(k.id),typeof k.superseded_by=="string"&&k.superseded_by!==""&&w.set(k.id,k.superseded_by))}else(u.length>0||a.length>0)&&r("quality.library","quality-library-missing","No criteria pack is embedded \u2014 criterion ids cannot be resolved to domains or weights; the matrix uses a synthesized library");(typeof s.framework_version!="string"||s.framework_version==="")&&r("quality.framework_version","quality-framework-version-missing","Quality section has no framework_version \u2014 scores are not comparable across audits without one");let I=(_,k,g)=>{let S=typeof _.criterion_id=="string"?_.criterion_id:void 0;S!==void 0&&y.size>0&&!y.has(S)&&r(`${k}.criterion_id`,"quality-unknown-criterion",`${g}: criterion "${S}" is not in the pinned library`);let L=S!==void 0?w.get(S):void 0;L!==void 0&&r(`${k}.criterion_id`,"quality-retired-criterion",`${g}: criterion "${S}" is retired \u2014 superseded by "${L}"`);let N=typeof _.surface=="string"?_.surface:void 0;N!==void 0&&N!==pe&&f.size>0&&!f.has(N)&&r(`${k}.surface`,"quality-unknown-surface",`${g}: surface "${N}" is not declared in the profile`)},P=new Set;u.forEach((_,k)=>{if(typeof _!="object"||_===null||Array.isArray(_))return;let g=_,S=`quality.assessments[${k}]`,L=`Assessment ${k}`;I(g,S,L);let N=g.level;(typeof N!="number"||!Number.isInteger(N)||N<0||N>4)&&r(`${S}.level`,"quality-level-range",`${L}: level must be an integer 0-4 (N/A is the absence of the row, not a level)`),g.surface===pe&&r(`${S}.surface`,"quality-cross-surface-assessment",`${L}: "${pe}" is a findings-only lens \u2014 it carries no matrix column, so this score would render nowhere`),(typeof g.evidence!="string"||g.evidence.trim()==="")&&r(`${S}.evidence`,"quality-assessment-no-evidence",`${L}: scored with no evidence \u2014 a score without a citation is an opinion, not an assessment`);let G=typeof g.criterion_id=="string"?g.criterion_id:void 0,V=typeof g.surface=="string"?g.surface:void 0;if(G!==void 0&&V!==void 0){let Ne=`${G}\0${V}`;P.has(Ne)&&r(`${S}`,"quality-duplicate-assessment",`${L}: a second score for (${G} x ${V}) \u2014 the section stores latest-per-cell, so this cell is ambiguous`),P.add(Ne)}});let O=new Set;a.forEach((_,k)=>{if(typeof _!="object"||_===null||Array.isArray(_))return;let g=_,S=`quality.findings[${k}]`,L=`Finding ${k}`;I(g,S,L);let N=typeof g.id=="string"?g.id:void 0;N!==void 0&&(O.has(N)&&r(`${S}.id`,"quality-duplicate-finding-id",`Duplicate finding id "${N}"`),O.add(N));for(let G of["impact","likelihood"]){let V=g[G];(typeof V!="number"||!Number.isInteger(V)||V<1||V>5)&&r(`${S}.${G}`,"quality-risk-range",`${L}: ${G} must be an integer 1-5 \u2014 severity is derived from impact x likelihood`)}for(let G of["severity","priority"])G in g&&r(`${S}.${G}`,"quality-derived-field-stored",`${L}: ${G} is derived from impact, likelihood and cost \u2014 storing it lets it drift from the numbers behind it`);g.status==="accepted-risk"&&(typeof g.detail!="string"||g.detail.trim()==="")&&r(`${S}.detail`,"quality-accepted-risk-no-note",`${L}: accepted-risk with no note \u2014 an accepted risk is a decision and reads like one`)});let C=new Set,K=Array.isArray(m.journal)?m.journal:[];K.forEach(_=>{if(typeof _!="object"||_===null)return;let k=_;k.type==="quality.finding.opened"&&typeof k.finding_id=="string"&&C.add(k.finding_id)}),K.forEach((_,k)=>{if(typeof _!="object"||_===null)return;let g=_,S=typeof g.type=="string"?g.type:"";S.startsWith("quality.")&&((typeof g.actor!="string"||g.actor.trim()==="")&&r(`journal[${k}].actor`,"quality-event-no-actor",`Journal event ${k}: ${S} has no actor \u2014 human, agent and CI scores become indistinguishable`),S==="quality.finding.resolved"&&typeof g.finding_id=="string"&&!C.has(g.finding_id)&&!O.has(g.finding_id)&&r(`journal[${k}].finding_id`,"quality-resolved-never-opened",`Journal event ${k}: resolves finding "${g.finding_id}", which no quality.finding.opened event or stored finding ever declared`),S==="quality.finding.accepted"&&typeof g.finding_id=="string"&&!C.has(g.finding_id)&&!O.has(g.finding_id)&&r(`journal[${k}].finding_id`,"quality-accepted-never-opened",`Journal event ${k}: accepts finding "${g.finding_id}", which no quality.finding.opened event or stored finding ever declared`))})}let gt=m.weighing,mt=Array.isArray(m.journal)?m.journal:[],Pe=new Map;for(let[s,u]of M)Pe.set(s,String(u.species));for(let s of dt(gt,Pe,mt))r(s.path,s.rule,s.message);for(let s of Ge(m))o.push(s);return l()}var ft="journal.jsonl",Dt="journal";function Ot(e){let o=(0,te.join)(e,Dt);return(0,z.existsSync)(o)?(0,z.readdirSync)(o).filter(t=>t.startsWith("archive-")&&t.endsWith(".jsonl")).sort().map(t=>(0,te.join)(o,t)):[]}function ce(e,o){return e.filter(t=>t?.species===o).length}function Ct(){let e=process.argv[2];e||(console.error("Usage: node validate-bundle.js <path-to-bundle.json>"),process.exit(1)),(0,z.existsSync)(e)||(console.error(`File not found: ${e}`),process.exit(1));let o;try{o=JSON.parse((0,z.readFileSync)(e,"utf8"))}catch(M){console.error(`FATAL: Cannot parse JSON \u2014 ${M.message}`),process.exit(1)}let t=o;(typeof t!="object"||t===null||!t.project||!t.nodes||!t.edges)&&(console.error("FATAL: Missing top-level keys (project, nodes, edges)."),process.exit(1));let r=[],l=!1,m=[];if(t.journal===void 0){let M=(0,te.dirname)(e),F=(0,te.join)(M,ft),W=[];if((0,z.existsSync)(F)){let{events:J,findings:B}=Se((0,z.readFileSync)(F,"utf8"));for(let n of B)r.push(n.message);l=!0,W.push(...J)}for(let J of Ot(M)){let B=(0,te.basename)(J),{events:n,findings:T}=Se((0,z.readFileSync)(J,"utf8"));for(let i of T)r.push(`${B} \u2014 ${i.message}`);m.push(B),W.push(...n)}(l||m.length>0)&&(t.journal=W)}let b=Array.isArray(t.nodes)?t.nodes:[],E=Array.isArray(t.edges)?t.edges:[],R=Array.isArray(t.journal)?t.journal:[],j=pt(o);if(console.log(`
|
|
14
14
|
Arkaik Bundle Validation`),console.log(` =======================
|
|
15
|
-
`),console.log(` Nodes: ${
|
|
16
|
-
`),process.exit(0)),console.log(` Errors: ${
|
|
15
|
+
`),console.log(` Nodes: ${b.length} (${ce(b,"view")} views, ${ce(b,"flow")} flows, ${ce(b,"data-model")} data-models, ${ce(b,"api-endpoint")} api-endpoints, ${ce(b,"acceptance")} acceptances)`),console.log(` Edges: ${E.length}`),l||m.length>0){let M=[...l?[`${ft} sidecar`]:[],...m.length>0?[`${m.length} archive(s)`]:[]].join(" + ");console.log(` Journal: ${R.length} event(s) from ${M}`)}else R.length>0&&console.log(` Journal: ${R.length} embedded event(s)`);console.log(""),j.warnings.length>0&&(console.log(` Warnings: ${j.warnings.length}`),j.warnings.forEach(M=>console.log(` WARN: ${M.message}`)),console.log(""));let U=[...r,...j.errors.map(M=>M.message)];U.length===0&&(console.log(` Result: VALID
|
|
16
|
+
`),process.exit(0)),console.log(` Errors: ${U.length}`),U.forEach(M=>console.log(` ERROR: ${M}`)),console.log(`
|
|
17
17
|
Result: INVALID
|
|
18
|
-
`),process.exit(1)}
|
|
18
|
+
`),process.exit(1)}Ct();
|
package/dist/index.js
CHANGED
|
@@ -15275,12 +15275,12 @@ var WeighingCriteriaSetSchema = external_exports.object({
|
|
|
15275
15275
|
criteria: documented(external_exports.array(documented(WeighingCriterionSchema))).optional(),
|
|
15276
15276
|
role: leaf("positioning marks the set a project writes about itself."),
|
|
15277
15277
|
status: leaf("Absent or active is active; anything else is a draft, which feeds no roll-up."),
|
|
15278
|
-
extends: leaf("A positioning's ruler, e.g. value-contribution@
|
|
15278
|
+
extends: leaf("A positioning's ruler, e.g. value-contribution@2.")
|
|
15279
15279
|
}).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." });
|
|
15280
15280
|
var WeighingMatrixSchema = external_exports.object({
|
|
15281
15281
|
id: leaf("The matrix's id."),
|
|
15282
15282
|
title: leaf("A human title."),
|
|
15283
|
-
set: leaf("The set's id and major, e.g. value-contribution@
|
|
15283
|
+
set: leaf("The set's id and major, e.g. value-contribution@2."),
|
|
15284
15284
|
subjects: documented(
|
|
15285
15285
|
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())
|
|
15286
15286
|
).optional().meta({ description: "What the matrix judges: { kind: query, species } or { kind: list, items }." }),
|
|
@@ -15304,6 +15304,8 @@ var WeighingAssessmentSchema = external_exports.object({
|
|
|
15304
15304
|
refs: leaf("Ids cited: nodes, journal events, findings."),
|
|
15305
15305
|
basis: documented(WeighingAssessmentBasisSchema).optional().meta({ description: "What the scorer was looking at, so a re-read can tell the score went stale." }),
|
|
15306
15306
|
run: leaf("The audit or plan the score belongs to."),
|
|
15307
|
+
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."),
|
|
15308
|
+
p_costs: leaf("Optional: the same for costs, asked independently, so both can be high."),
|
|
15307
15309
|
ts: leaf("ISO 8601.")
|
|
15308
15310
|
}).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." });
|
|
15309
15311
|
var WeighingSectionSchema = external_exports.object({
|
|
@@ -15517,7 +15519,9 @@ var WeighingAssessmentRecordedEventSchema = external_exports.object({
|
|
|
15517
15519
|
evidence: external_exports.string().optional(),
|
|
15518
15520
|
refs: external_exports.array(external_exports.string()).optional(),
|
|
15519
15521
|
basis: WeighingAssessmentBasisSchema.optional(),
|
|
15520
|
-
run: external_exports.string().optional()
|
|
15522
|
+
run: external_exports.string().optional(),
|
|
15523
|
+
p_serves: external_exports.number().min(0).max(1).optional(),
|
|
15524
|
+
p_costs: external_exports.number().min(0).max(1).optional()
|
|
15521
15525
|
}).catchall(external_exports.unknown());
|
|
15522
15526
|
var WeighingSetSavedEventSchema = external_exports.object({ ...envelope, type: external_exports.literal("weighing.set.saved"), set: WeighingCriteriaSetSchema }).catchall(external_exports.unknown());
|
|
15523
15527
|
var JOURNAL_EVENT_SCHEMAS = {
|
|
@@ -16832,6 +16836,253 @@ function isBuiltInMapId(id) {
|
|
|
16832
16836
|
return BUILT_IN_MAP_IDS.includes(id);
|
|
16833
16837
|
}
|
|
16834
16838
|
|
|
16839
|
+
// ../schema/src/weighing-ladders.ts
|
|
16840
|
+
var LADDERS = {
|
|
16841
|
+
"saves-time": {
|
|
16842
|
+
"-3": "Takes hours out of the person's life.",
|
|
16843
|
+
"-2": "Costs the person time on tasks they do regularly in this domain.",
|
|
16844
|
+
"-1": "Costs the person a little time on one task inside the product.",
|
|
16845
|
+
"1": "Saves a little time on one task inside the product.",
|
|
16846
|
+
"2": "Saves time on tasks the person does regularly in this domain.",
|
|
16847
|
+
"3": "Gives the person back hours of their life, the way online banking replaced trips to the bank."
|
|
16848
|
+
},
|
|
16849
|
+
simplifies: {
|
|
16850
|
+
"-3": "Makes a part of the person's life confusing or hard to manage.",
|
|
16851
|
+
"-2": "Makes a whole task in this domain clearly more complicated.",
|
|
16852
|
+
"-1": "Adds a step or a choice inside the product.",
|
|
16853
|
+
"1": "Removes a step or a choice inside the product.",
|
|
16854
|
+
"2": "Makes a whole task in this domain clearly simpler.",
|
|
16855
|
+
"3": "Makes a complicated part of the person's life simple, the way a single search box replaced browsing directories."
|
|
16856
|
+
},
|
|
16857
|
+
"makes-money": {
|
|
16858
|
+
"-3": "Costs the person a meaningful part of their income.",
|
|
16859
|
+
"-2": "Cuts a regular way the person earns in this domain.",
|
|
16860
|
+
"-1": "Makes earning slightly harder or costs the person a little income.",
|
|
16861
|
+
"1": "Helps the person earn a little, or makes earning slightly easier.",
|
|
16862
|
+
"2": "Gives the person a regular way to earn in this domain.",
|
|
16863
|
+
"3": "Provides a meaningful part of the person's income."
|
|
16864
|
+
},
|
|
16865
|
+
"reduces-risk": {
|
|
16866
|
+
"-3": "Exposes the person to a major loss in their life.",
|
|
16867
|
+
"-2": "Exposes the person to a serious loss or error in this domain.",
|
|
16868
|
+
"-1": "Exposes the person to a small mistake or loss inside the product.",
|
|
16869
|
+
"1": "Guards against a small mistake or loss inside the product.",
|
|
16870
|
+
"2": "Protects against a serious loss or error in this domain.",
|
|
16871
|
+
"3": "Protects against a major loss in the person's life, the way insurance or a full backup does."
|
|
16872
|
+
},
|
|
16873
|
+
organizes: {
|
|
16874
|
+
"-3": "Brings disorder to a large part of the person's life.",
|
|
16875
|
+
"-2": "Makes things in this domain hard to keep in order or to find.",
|
|
16876
|
+
"-1": "Leaves a few things in disorder inside the product.",
|
|
16877
|
+
"1": "Keeps a few things in order inside the product.",
|
|
16878
|
+
"2": "Keeps everything in this domain in order and easy to find.",
|
|
16879
|
+
"3": "Brings order to a large part of the person's life, the way a calendar does."
|
|
16880
|
+
},
|
|
16881
|
+
integrates: {
|
|
16882
|
+
"-3": "Pulls separate parts of the person's life further apart.",
|
|
16883
|
+
"-2": "Splits apart the several tools the person uses in this domain.",
|
|
16884
|
+
"-1": "Cuts the product off from one other tool the person uses.",
|
|
16885
|
+
"1": "Connects the product to one other tool the person uses.",
|
|
16886
|
+
"2": "Ties together the several tools the person uses in this domain.",
|
|
16887
|
+
"3": "Makes separate parts of the person's life work together as one."
|
|
16888
|
+
},
|
|
16889
|
+
connects: {
|
|
16890
|
+
"-3": "Separates the person from the people who matter most in their life.",
|
|
16891
|
+
"-2": "Makes it harder to build or keep relationships in this domain.",
|
|
16892
|
+
"-1": "Gets in the way of reaching someone through the product.",
|
|
16893
|
+
"1": "Lets the person reach someone through the product.",
|
|
16894
|
+
"2": "Helps the person build and keep relationships in this domain.",
|
|
16895
|
+
"3": "Brings the person together with the people who matter most in their life."
|
|
16896
|
+
},
|
|
16897
|
+
"reduces-effort": {
|
|
16898
|
+
"-3": "Puts a heavy burden of work on the person's life.",
|
|
16899
|
+
"-2": "Adds repetitive work to a task the person does regularly in this domain.",
|
|
16900
|
+
"-1": "Adds a little effort to one task inside the product.",
|
|
16901
|
+
"1": "Saves a little effort on one task inside the product.",
|
|
16902
|
+
"2": "Takes the repetitive work out of a task the person does regularly in this domain.",
|
|
16903
|
+
"3": "Lifts a heavy burden of work off the person's life."
|
|
16904
|
+
},
|
|
16905
|
+
"avoids-hassles": {
|
|
16906
|
+
"-3": "Brings a whole kind of annoyance into the person's life.",
|
|
16907
|
+
"-2": "Adds an annoyance that keeps coming back in this domain.",
|
|
16908
|
+
"-1": "Adds a small annoyance inside the product.",
|
|
16909
|
+
"1": "Avoids a small annoyance inside the product.",
|
|
16910
|
+
"2": "Avoids an annoyance that keeps coming back in this domain.",
|
|
16911
|
+
"3": "Takes a whole kind of annoyance out of the person's life, the way a GPS ended getting lost."
|
|
16912
|
+
},
|
|
16913
|
+
"reduces-cost": {
|
|
16914
|
+
"-3": "Costs the person a significant amount of money over their life.",
|
|
16915
|
+
"-2": "Costs the person money regularly in this domain.",
|
|
16916
|
+
"-1": "Costs the person a little money on one purchase.",
|
|
16917
|
+
"1": "Saves the person a little money on one purchase.",
|
|
16918
|
+
"2": "Saves the person money regularly in this domain.",
|
|
16919
|
+
"3": "Saves the person a significant amount of money over their life."
|
|
16920
|
+
},
|
|
16921
|
+
quality: {
|
|
16922
|
+
"-3": "Craft so poor the person would call it the worst they have used.",
|
|
16923
|
+
"-2": "The product does its job in this domain clearly worse than the usual alternatives.",
|
|
16924
|
+
"-1": "Something inside the product works noticeably badly.",
|
|
16925
|
+
"1": "Something inside the product works noticeably well.",
|
|
16926
|
+
"2": "The product does its job in this domain clearly better than the usual alternatives.",
|
|
16927
|
+
"3": "Craft so good the person would call it the best they have used."
|
|
16928
|
+
},
|
|
16929
|
+
variety: {
|
|
16930
|
+
"-3": "Closes off a breadth of choice the person had elsewhere.",
|
|
16931
|
+
"-2": "Narrows the choice in this domain.",
|
|
16932
|
+
"-1": "Removes a few meaningful options inside the product.",
|
|
16933
|
+
"1": "Offers a few meaningful options inside the product.",
|
|
16934
|
+
"2": "Offers a wide and meaningful choice in this domain.",
|
|
16935
|
+
"3": "Opens a breadth of choice the person could not get anywhere else."
|
|
16936
|
+
},
|
|
16937
|
+
"sensory-appeal": {
|
|
16938
|
+
"-3": "A sensory experience the person avoids.",
|
|
16939
|
+
"-2": "The product looks, sounds or feels bad and the person dislikes using it.",
|
|
16940
|
+
"-1": "An unpleasant detail the person notices in the moment.",
|
|
16941
|
+
"1": "A pleasant detail the person notices in the moment.",
|
|
16942
|
+
"2": "The product looks, sounds or feels good and the person enjoys using it.",
|
|
16943
|
+
"3": "A sensory experience the person seeks out for its own sake."
|
|
16944
|
+
},
|
|
16945
|
+
informs: {
|
|
16946
|
+
"-3": "Misleads the person deeply about the service area or domain.",
|
|
16947
|
+
"-2": "Confuses the person about the service area or domain.",
|
|
16948
|
+
"-1": "Hides from the person something about the service that they want to know.",
|
|
16949
|
+
"1": "Informs the person about the service.",
|
|
16950
|
+
"2": "Informs the person about the service area or domain.",
|
|
16951
|
+
"3": "Informs the person deeply and efficiently about the service area or domain."
|
|
16952
|
+
},
|
|
16953
|
+
"reduces-anxiety": {
|
|
16954
|
+
"-3": "Gives the person a lasting worry in their life.",
|
|
16955
|
+
"-2": "Stirs up a worry the person has in this domain.",
|
|
16956
|
+
"-1": "Adds a small worry inside the product.",
|
|
16957
|
+
"1": "Removes a small worry inside the product.",
|
|
16958
|
+
"2": "Calms a worry the person has in this domain.",
|
|
16959
|
+
"3": "Takes a lasting worry out of the person's life."
|
|
16960
|
+
},
|
|
16961
|
+
"rewards-me": {
|
|
16962
|
+
"-3": "Takes away rewards the person values as much as the product itself.",
|
|
16963
|
+
"-2": "Takes away perks the person regularly values.",
|
|
16964
|
+
"-1": "Takes away a small perk the person had.",
|
|
16965
|
+
"1": "Gives the person a small perk for engaging.",
|
|
16966
|
+
"2": "Gives the person regular perks they value.",
|
|
16967
|
+
"3": "Gives the person rewards they value as much as the product itself."
|
|
16968
|
+
},
|
|
16969
|
+
nostalgia: {
|
|
16970
|
+
"-3": "Destroys a cherished memory for good.",
|
|
16971
|
+
"-2": "Loses or overwrites a good memory of the past.",
|
|
16972
|
+
"-1": "Puts a pleasant memory at slight risk.",
|
|
16973
|
+
"1": "Faintly recalls a pleasant memory of the past.",
|
|
16974
|
+
"2": "Clearly brings back a good memory of the past.",
|
|
16975
|
+
"3": "Brings back a cherished past in a vivid and deeply felt way."
|
|
16976
|
+
},
|
|
16977
|
+
"design-aesthetics": {
|
|
16978
|
+
"-3": "Ugliness the person would be embarrassed to show to others.",
|
|
16979
|
+
"-2": "A design the person finds ugly.",
|
|
16980
|
+
"-1": "A displeasing design detail.",
|
|
16981
|
+
"1": "A pleasing design detail.",
|
|
16982
|
+
"2": "A design the person finds beautiful.",
|
|
16983
|
+
"3": "Beauty the person would show to others and that shapes how they feel about it."
|
|
16984
|
+
},
|
|
16985
|
+
"badge-value": {
|
|
16986
|
+
"-3": "Signals something the person does not want the people who matter to them to see.",
|
|
16987
|
+
"-2": "Clearly signals a low identity or status in a community.",
|
|
16988
|
+
"-1": "Gives a mild negative signal about the person to others.",
|
|
16989
|
+
"1": "Gives a mild signal about the person to others.",
|
|
16990
|
+
"2": "Clearly signals the person's identity or status in a community.",
|
|
16991
|
+
"3": "Signals who the person is to the people who matter to them."
|
|
16992
|
+
},
|
|
16993
|
+
wellness: {
|
|
16994
|
+
"-3": "Lastingly harms the person's physical or mental well-being.",
|
|
16995
|
+
"-2": "Noticeably worsens how the person feels over time.",
|
|
16996
|
+
"-1": "Slightly worsens how the person feels, in the moment.",
|
|
16997
|
+
"1": "Slightly improves how the person feels, in the moment.",
|
|
16998
|
+
"2": "Noticeably improves how the person feels over time.",
|
|
16999
|
+
"3": "Lastingly improves the person's physical or mental well-being."
|
|
17000
|
+
},
|
|
17001
|
+
"therapeutic-value": {
|
|
17002
|
+
"-3": "Deepens something that hurts the person.",
|
|
17003
|
+
"-2": "Makes a difficult feeling harder for the person to work through.",
|
|
17004
|
+
"-1": "Reopens a small emotional sore.",
|
|
17005
|
+
"1": "Gives a small moment of emotional relief.",
|
|
17006
|
+
"2": "Helps the person work through a difficult feeling.",
|
|
17007
|
+
"3": "Supports real healing of something that hurts the person."
|
|
17008
|
+
},
|
|
17009
|
+
"fun-entertainment": {
|
|
17010
|
+
"-3": "So joyless that the person avoids it and warns others.",
|
|
17011
|
+
"-2": "Boring or tedious to use.",
|
|
17012
|
+
"-1": "A dull moment.",
|
|
17013
|
+
"1": "A light moment of enjoyment.",
|
|
17014
|
+
"2": "Genuinely enjoyable to use.",
|
|
17015
|
+
"3": "Delight the person would seek out and tell others about."
|
|
17016
|
+
},
|
|
17017
|
+
attractiveness: {
|
|
17018
|
+
"-3": "Changes how unattractive the person feels in general.",
|
|
17019
|
+
"-2": "Clearly makes the person feel less attractive.",
|
|
17020
|
+
"-1": "Makes the person feel slightly worse about how they look.",
|
|
17021
|
+
"1": "Makes the person feel slightly better about how they look.",
|
|
17022
|
+
"2": "Clearly makes the person feel more attractive.",
|
|
17023
|
+
"3": "Changes how attractive the person feels in general."
|
|
17024
|
+
},
|
|
17025
|
+
"provides-access": {
|
|
17026
|
+
"-3": "Shuts the person out of something that matters in their life.",
|
|
17027
|
+
"-2": "Cuts the person off from a service or from people in this domain that they could otherwise reach.",
|
|
17028
|
+
"-1": "Puts a feature inside the product behind a barrier or closes it off.",
|
|
17029
|
+
"1": "Opens a feature inside the product.",
|
|
17030
|
+
"2": "Gives access to a service or to people in this domain that the person could not easily reach.",
|
|
17031
|
+
"3": "Gives access to something that matters in the person's life and that they could not get otherwise."
|
|
17032
|
+
},
|
|
17033
|
+
"provides-hope": {
|
|
17034
|
+
"-3": "Leaves the person believing their life cannot get better.",
|
|
17035
|
+
"-2": "Gives the person a reason to doubt that things in this domain can improve.",
|
|
17036
|
+
"-1": "Plants a small doubt.",
|
|
17037
|
+
"1": "Gives a small reason for optimism.",
|
|
17038
|
+
"2": "Gives a real reason to believe things in this domain can improve.",
|
|
17039
|
+
"3": "Gives a lasting belief that the person's life can get better."
|
|
17040
|
+
},
|
|
17041
|
+
"self-actualization": {
|
|
17042
|
+
"-3": "Pushes the person away from who they want to be.",
|
|
17043
|
+
"-2": "Clear drift away from who the person wants to be.",
|
|
17044
|
+
"-1": "A small step away from who the person wants to be.",
|
|
17045
|
+
"1": "A small step toward who the person wants to be.",
|
|
17046
|
+
"2": "Clear progress toward who the person wants to be.",
|
|
17047
|
+
"3": "Helps the person become who they want to be."
|
|
17048
|
+
},
|
|
17049
|
+
motivation: {
|
|
17050
|
+
"-3": "Drains the person's drive toward goals that matter in their life.",
|
|
17051
|
+
"-2": "Saps the person's energy toward a goal in this domain.",
|
|
17052
|
+
"-1": "A small drag on the person's drive.",
|
|
17053
|
+
"1": "A small nudge to act.",
|
|
17054
|
+
"2": "Energizes the person toward a goal in this domain.",
|
|
17055
|
+
"3": "Sustains the person's drive toward goals that matter in their life."
|
|
17056
|
+
},
|
|
17057
|
+
heirloom: {
|
|
17058
|
+
"-3": "Loses something meaningful that was meant to be passed on across time.",
|
|
17059
|
+
"-2": "Lets something meaningful be lost within years.",
|
|
17060
|
+
"-1": "Puts something worth keeping at slight risk.",
|
|
17061
|
+
"1": "Keeps something worth keeping for a while.",
|
|
17062
|
+
"2": "Preserves something meaningful for years.",
|
|
17063
|
+
"3": "Holds something meaningful enough to be passed on to others across time."
|
|
17064
|
+
},
|
|
17065
|
+
"affiliation-belonging": {
|
|
17066
|
+
"-3": "Cuts the person off from a group that matters deeply to who they are.",
|
|
17067
|
+
"-2": "Leaves the person out of a group in this domain.",
|
|
17068
|
+
"-1": "A feeling of being slightly left out of something small.",
|
|
17069
|
+
"1": "A feeling of being part of something small.",
|
|
17070
|
+
"2": "Makes the person part of a group in this domain.",
|
|
17071
|
+
"3": "Makes the person part of a group that matters deeply to who they are."
|
|
17072
|
+
},
|
|
17073
|
+
"self-transcendence": {
|
|
17074
|
+
"-3": "Works against something larger than the person themselves.",
|
|
17075
|
+
"-2": "Harms others in a meaningful way.",
|
|
17076
|
+
"-1": "Does a small harm to others.",
|
|
17077
|
+
"1": "Does a small good for others.",
|
|
17078
|
+
"2": "Helps others in a meaningful way.",
|
|
17079
|
+
"3": "Contributes to something larger than the person themselves."
|
|
17080
|
+
}
|
|
17081
|
+
};
|
|
17082
|
+
var VALUE_REACH_LADDERS = Object.freeze(
|
|
17083
|
+
Object.fromEntries(Object.entries(LADDERS).map(([id, ladder]) => [id, Object.freeze(ladder)]))
|
|
17084
|
+
);
|
|
17085
|
+
|
|
16835
17086
|
// ../schema/src/weighing.ts
|
|
16836
17087
|
var SCORER_KINDS = ["human", "agent", "rule"];
|
|
16837
17088
|
var STORED_SCORER_KINDS = ["human", "agent"];
|
|
@@ -16839,6 +17090,10 @@ function scorerRank(kind) {
|
|
|
16839
17090
|
const index = SCORER_KINDS.indexOf(kind);
|
|
16840
17091
|
return index === -1 ? 0 : SCORER_KINDS.length - index;
|
|
16841
17092
|
}
|
|
17093
|
+
var WEIGHING_PROBABILITY_FIELDS = ["p_serves", "p_costs"];
|
|
17094
|
+
function isWeighingProbability(value) {
|
|
17095
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
|
|
17096
|
+
}
|
|
16842
17097
|
var WEIGHING_ASSESSMENT_RECORDED = "weighing.assessment.recorded";
|
|
16843
17098
|
var WEIGHING_SET_SAVED = "weighing.set.saved";
|
|
16844
17099
|
function cellKey(matrix, subject, criterion) {
|
|
@@ -16878,10 +17133,20 @@ function deepFreeze(value) {
|
|
|
16878
17133
|
return value;
|
|
16879
17134
|
}
|
|
16880
17135
|
var VALUE_SET_ID = "value-contribution";
|
|
16881
|
-
var VALUE_SET_VERSION = "
|
|
17136
|
+
var VALUE_SET_VERSION = "2.0.0";
|
|
17137
|
+
var VALUE_SET_V1_VERSION = "1.0.0";
|
|
16882
17138
|
var VALUE_MATRIX_ID = "value";
|
|
16883
17139
|
var POSITIONING_SET_ID = "positioning";
|
|
16884
17140
|
var VALUE_SCALE_ANCHORS = {
|
|
17141
|
+
"3": "Life-wide. It gives the person this well beyond the product and its domain, in their life.",
|
|
17142
|
+
"2": "Across the domain. The person gets this in the whole area the product belongs to, not only inside it.",
|
|
17143
|
+
"1": "Within the product. A real contribution, felt while using it.",
|
|
17144
|
+
"0": "Unrelated: weighed and found to have nothing to do with it. (No row means nobody has weighed it yet.)",
|
|
17145
|
+
"-1": "Within the product. A small cost, felt while using it.",
|
|
17146
|
+
"-2": "Across the domain. The person notices the loss of this in the whole area the product belongs to.",
|
|
17147
|
+
"-3": "Life-wide. It leaves the person with the opposite of this in their life."
|
|
17148
|
+
};
|
|
17149
|
+
var VALUE_SCALE_V1_ANCHORS = {
|
|
16885
17150
|
"3": "Core. The promise exists for this; take it away and the value goes.",
|
|
16886
17151
|
"2": "Supports clearly. The user would notice it missing.",
|
|
16887
17152
|
"1": "Touches. A side effect of the promise, not its purpose.",
|
|
@@ -16929,13 +17194,36 @@ var VALUE_TEXT = {
|
|
|
16929
17194
|
"self-transcendence": { name: "Self-transcendence", definition: "Helps beyond the user themselves." }
|
|
16930
17195
|
};
|
|
16931
17196
|
var VALUE_SCALE = { min: -3, max: 3, anchors: { ...VALUE_SCALE_ANCHORS } };
|
|
17197
|
+
var GROUPS = Object.keys(TIER_TITLES).map((id) => ({ id, title: TIER_TITLES[id] }));
|
|
17198
|
+
function reachQuestion(id) {
|
|
17199
|
+
if (id === "informs") {
|
|
17200
|
+
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?";
|
|
17201
|
+
}
|
|
17202
|
+
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?`;
|
|
17203
|
+
}
|
|
16932
17204
|
var VALUE_CONTRIBUTION_SET = deepFreeze({
|
|
16933
17205
|
id: VALUE_SET_ID,
|
|
16934
17206
|
version: VALUE_SET_VERSION,
|
|
16935
17207
|
title: "Elements of value",
|
|
16936
17208
|
subject: "acceptance",
|
|
16937
17209
|
scale: VALUE_SCALE,
|
|
16938
|
-
groups:
|
|
17210
|
+
groups: GROUPS,
|
|
17211
|
+
criteria: VALUE_IDS.map((id) => ({
|
|
17212
|
+
id,
|
|
17213
|
+
group: VALUE_TIERS[id],
|
|
17214
|
+
name: VALUE_TEXT[id].name,
|
|
17215
|
+
question: reachQuestion(id),
|
|
17216
|
+
definition: VALUE_TEXT[id].definition,
|
|
17217
|
+
anchors: { ...VALUE_REACH_LADDERS[id] }
|
|
17218
|
+
}))
|
|
17219
|
+
});
|
|
17220
|
+
var VALUE_CONTRIBUTION_SET_V1 = deepFreeze({
|
|
17221
|
+
id: VALUE_SET_ID,
|
|
17222
|
+
version: VALUE_SET_V1_VERSION,
|
|
17223
|
+
title: "Elements of value",
|
|
17224
|
+
subject: "acceptance",
|
|
17225
|
+
scale: { min: -3, max: 3, anchors: { ...VALUE_SCALE_V1_ANCHORS } },
|
|
17226
|
+
groups: GROUPS,
|
|
16939
17227
|
criteria: VALUE_IDS.map((id) => ({
|
|
16940
17228
|
id,
|
|
16941
17229
|
group: VALUE_TIERS[id],
|
|
@@ -16947,12 +17235,12 @@ var VALUE_CONTRIBUTION_SET = deepFreeze({
|
|
|
16947
17235
|
var VALUE_MATRIX = deepFreeze({
|
|
16948
17236
|
id: VALUE_MATRIX_ID,
|
|
16949
17237
|
title: "Value",
|
|
16950
|
-
set: `${VALUE_SET_ID}@
|
|
17238
|
+
set: `${VALUE_SET_ID}@2`,
|
|
16951
17239
|
subjects: { kind: "query", species: "acceptance" },
|
|
16952
17240
|
positioning: POSITIONING_SET_ID,
|
|
16953
17241
|
status: "active"
|
|
16954
17242
|
});
|
|
16955
|
-
var BUILT_IN_SETS = [VALUE_CONTRIBUTION_SET];
|
|
17243
|
+
var BUILT_IN_SETS = [VALUE_CONTRIBUTION_SET, VALUE_CONTRIBUTION_SET_V1];
|
|
16956
17244
|
var BUILT_IN_MATRICES = [VALUE_MATRIX];
|
|
16957
17245
|
var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16958
17246
|
function cleaned(set2) {
|
|
@@ -16992,9 +17280,14 @@ function resolveWeighing(section) {
|
|
|
16992
17280
|
}
|
|
16993
17281
|
function setOfRef(resolved, ref) {
|
|
16994
17282
|
const { id, major } = splitSetRef(ref);
|
|
16995
|
-
|
|
16996
|
-
|
|
16997
|
-
|
|
17283
|
+
return resolved.sets.find((candidate) => candidate.id === id && (major === void 0 || majorOf(candidate.version) === major));
|
|
17284
|
+
}
|
|
17285
|
+
function isOlderMajorRef(resolved, ref) {
|
|
17286
|
+
const { id, major } = splitSetRef(ref);
|
|
17287
|
+
const current = resolved.sets.find((candidate) => candidate.id === id);
|
|
17288
|
+
if (current === void 0 || major === void 0) return false;
|
|
17289
|
+
const now = Number(majorOf(current.version));
|
|
17290
|
+
return Number.isFinite(now) && Number(major) < now;
|
|
16998
17291
|
}
|
|
16999
17292
|
|
|
17000
17293
|
// ../schema/src/weighing-validate.ts
|
|
@@ -17078,9 +17371,11 @@ function validateWeighingSection(section, nodeSpecies, journal) {
|
|
|
17078
17371
|
if (entry.role === "positioning") {
|
|
17079
17372
|
const ruler = typeof entry.extends === "string" ? resolveRef2(entry.extends, `${path6}.extends`, `Positioning "${String(entry.id)}"`, "weighing-positioning-unknown-ruler") : void 0;
|
|
17080
17373
|
if (typeof entry.extends !== "string") {
|
|
17081
|
-
warn(`${path6}.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@
|
|
17374
|
+
warn(`${path6}.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`);
|
|
17082
17375
|
} else if (ruler !== void 0 && ruler.role === "positioning") {
|
|
17083
|
-
warn(`${path6}.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@
|
|
17376
|
+
warn(`${path6}.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`);
|
|
17377
|
+
} else if (ruler !== void 0 && isOlderMajorRef(resolved, entry.extends)) {
|
|
17378
|
+
warn(`${path6}.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`);
|
|
17084
17379
|
}
|
|
17085
17380
|
const known = new Set(ruler !== void 0 && ruler.role !== "positioning" ? ruler.criteria.map((criterion) => criterion?.id) : []);
|
|
17086
17381
|
(Array.isArray(entry.criteria) ? entry.criteria : []).forEach((criterion, at2) => {
|
|
@@ -17116,7 +17411,9 @@ function validateWeighingSection(section, nodeSpecies, journal) {
|
|
|
17116
17411
|
}
|
|
17117
17412
|
}
|
|
17118
17413
|
checkStatus(path6, who, entry);
|
|
17119
|
-
if (wellFormed
|
|
17414
|
+
if (wellFormed && resolveRef2(entry.set, `${path6}.set`, who, "weighing-unknown-set") !== void 0 && isOlderMajorRef(resolved, entry.set)) {
|
|
17415
|
+
warn(`${path6}.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`);
|
|
17416
|
+
}
|
|
17120
17417
|
});
|
|
17121
17418
|
const seenCells = /* @__PURE__ */ new Set();
|
|
17122
17419
|
assessments.forEach((entry, index) => {
|
|
@@ -17171,6 +17468,11 @@ function validateWeighingSection(section, nodeSpecies, journal) {
|
|
|
17171
17468
|
} else if ((entry.confidence === 2 || entry.confidence === 3) && (entry.evidence === void 0 || entry.evidence.trim() === "")) {
|
|
17172
17469
|
warn(`${path6}.evidence`, "weighing-no-evidence", `${label}: confidence ${String(entry.confidence)} claims evidence and cites none`);
|
|
17173
17470
|
}
|
|
17471
|
+
for (const field of WEIGHING_PROBABILITY_FIELDS) {
|
|
17472
|
+
if (entry[field] !== void 0 && !isWeighingProbability(entry[field])) {
|
|
17473
|
+
warn(`${path6}.${field}`, "weighing-probability-shape", `${label}: ${field} must be a number from 0 to 1 \u2014 it is ignored`);
|
|
17474
|
+
}
|
|
17475
|
+
}
|
|
17174
17476
|
if (entry.refs !== void 0 && !(Array.isArray(entry.refs) && entry.refs.every((ref) => typeof ref === "string"))) {
|
|
17175
17477
|
warn(`${path6}.refs`, "weighing-refs-type", `${label}: refs must be an array of id strings`);
|
|
17176
17478
|
}
|
|
@@ -19591,7 +19893,7 @@ function burndownSummary(burndown, openNow) {
|
|
|
19591
19893
|
}
|
|
19592
19894
|
|
|
19593
19895
|
// ../schema/src/weighing-derive.ts
|
|
19594
|
-
var SEED_SCORER_ID = "seed-
|
|
19896
|
+
var SEED_SCORER_ID = "seed-claimed";
|
|
19595
19897
|
var SEED_SCORER = Object.freeze({ kind: "rule", id: SEED_SCORER_ID });
|
|
19596
19898
|
|
|
19597
19899
|
// src/commands/init.ts
|
|
@@ -26634,7 +26936,7 @@ Options:
|
|
|
26634
26936
|
-v, --version Print the version.
|
|
26635
26937
|
|
|
26636
26938
|
Run "arkaik <command> --help" for command-specific help.`;
|
|
26637
|
-
var VERSION = "0.
|
|
26939
|
+
var VERSION = "0.13.0";
|
|
26638
26940
|
function main(argv) {
|
|
26639
26941
|
const [command, ...rest] = argv;
|
|
26640
26942
|
if (command === void 0 || command === "--help" || command === "-h" || command === "help") {
|
package/dist/io.js
CHANGED
|
@@ -15189,12 +15189,12 @@ var WeighingCriteriaSetSchema = external_exports.object({
|
|
|
15189
15189
|
criteria: documented(external_exports.array(documented(WeighingCriterionSchema))).optional(),
|
|
15190
15190
|
role: leaf("positioning marks the set a project writes about itself."),
|
|
15191
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@
|
|
15192
|
+
extends: leaf("A positioning's ruler, e.g. value-contribution@2.")
|
|
15193
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
15194
|
var WeighingMatrixSchema = external_exports.object({
|
|
15195
15195
|
id: leaf("The matrix's id."),
|
|
15196
15196
|
title: leaf("A human title."),
|
|
15197
|
-
set: leaf("The set's id and major, e.g. value-contribution@
|
|
15197
|
+
set: leaf("The set's id and major, e.g. value-contribution@2."),
|
|
15198
15198
|
subjects: documented(
|
|
15199
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
15200
|
).optional().meta({ description: "What the matrix judges: { kind: query, species } or { kind: list, items }." }),
|
|
@@ -15218,6 +15218,8 @@ var WeighingAssessmentSchema = external_exports.object({
|
|
|
15218
15218
|
refs: leaf("Ids cited: nodes, journal events, findings."),
|
|
15219
15219
|
basis: documented(WeighingAssessmentBasisSchema).optional().meta({ description: "What the scorer was looking at, so a re-read can tell the score went stale." }),
|
|
15220
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."),
|
|
15221
15223
|
ts: leaf("ISO 8601.")
|
|
15222
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." });
|
|
15223
15225
|
var WeighingSectionSchema = external_exports.object({
|
|
@@ -15431,7 +15433,9 @@ var WeighingAssessmentRecordedEventSchema = external_exports.object({
|
|
|
15431
15433
|
evidence: external_exports.string().optional(),
|
|
15432
15434
|
refs: external_exports.array(external_exports.string()).optional(),
|
|
15433
15435
|
basis: WeighingAssessmentBasisSchema.optional(),
|
|
15434
|
-
run: external_exports.string().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()
|
|
15435
15439
|
}).catchall(external_exports.unknown());
|
|
15436
15440
|
var WeighingSetSavedEventSchema = external_exports.object({ ...envelope, type: external_exports.literal("weighing.set.saved"), set: WeighingCriteriaSetSchema }).catchall(external_exports.unknown());
|
|
15437
15441
|
var JOURNAL_EVENT_SCHEMAS = {
|
|
@@ -15940,6 +15944,253 @@ function isBuiltInMapId(id) {
|
|
|
15940
15944
|
return BUILT_IN_MAP_IDS.includes(id);
|
|
15941
15945
|
}
|
|
15942
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
|
+
|
|
15943
16194
|
// ../schema/src/weighing.ts
|
|
15944
16195
|
var SCORER_KINDS = ["human", "agent", "rule"];
|
|
15945
16196
|
var STORED_SCORER_KINDS = ["human", "agent"];
|
|
@@ -15947,6 +16198,10 @@ function scorerRank(kind) {
|
|
|
15947
16198
|
const index = SCORER_KINDS.indexOf(kind);
|
|
15948
16199
|
return index === -1 ? 0 : SCORER_KINDS.length - index;
|
|
15949
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
|
+
}
|
|
15950
16205
|
var WEIGHING_ASSESSMENT_RECORDED = "weighing.assessment.recorded";
|
|
15951
16206
|
var WEIGHING_SET_SAVED = "weighing.set.saved";
|
|
15952
16207
|
function cellKey(matrix, subject, criterion) {
|
|
@@ -15986,10 +16241,20 @@ function deepFreeze(value) {
|
|
|
15986
16241
|
return value;
|
|
15987
16242
|
}
|
|
15988
16243
|
var VALUE_SET_ID = "value-contribution";
|
|
15989
|
-
var VALUE_SET_VERSION = "
|
|
16244
|
+
var VALUE_SET_VERSION = "2.0.0";
|
|
16245
|
+
var VALUE_SET_V1_VERSION = "1.0.0";
|
|
15990
16246
|
var VALUE_MATRIX_ID = "value";
|
|
15991
16247
|
var POSITIONING_SET_ID = "positioning";
|
|
15992
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 = {
|
|
15993
16258
|
"3": "Core. The promise exists for this; take it away and the value goes.",
|
|
15994
16259
|
"2": "Supports clearly. The user would notice it missing.",
|
|
15995
16260
|
"1": "Touches. A side effect of the promise, not its purpose.",
|
|
@@ -16037,13 +16302,36 @@ var VALUE_TEXT = {
|
|
|
16037
16302
|
"self-transcendence": { name: "Self-transcendence", definition: "Helps beyond the user themselves." }
|
|
16038
16303
|
};
|
|
16039
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
|
+
}
|
|
16040
16312
|
var VALUE_CONTRIBUTION_SET = deepFreeze({
|
|
16041
16313
|
id: VALUE_SET_ID,
|
|
16042
16314
|
version: VALUE_SET_VERSION,
|
|
16043
16315
|
title: "Elements of value",
|
|
16044
16316
|
subject: "acceptance",
|
|
16045
16317
|
scale: VALUE_SCALE,
|
|
16046
|
-
groups:
|
|
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,
|
|
16047
16335
|
criteria: VALUE_IDS.map((id) => ({
|
|
16048
16336
|
id,
|
|
16049
16337
|
group: VALUE_TIERS[id],
|
|
@@ -16055,12 +16343,12 @@ var VALUE_CONTRIBUTION_SET = deepFreeze({
|
|
|
16055
16343
|
var VALUE_MATRIX = deepFreeze({
|
|
16056
16344
|
id: VALUE_MATRIX_ID,
|
|
16057
16345
|
title: "Value",
|
|
16058
|
-
set: `${VALUE_SET_ID}@
|
|
16346
|
+
set: `${VALUE_SET_ID}@2`,
|
|
16059
16347
|
subjects: { kind: "query", species: "acceptance" },
|
|
16060
16348
|
positioning: POSITIONING_SET_ID,
|
|
16061
16349
|
status: "active"
|
|
16062
16350
|
});
|
|
16063
|
-
var BUILT_IN_SETS = [VALUE_CONTRIBUTION_SET];
|
|
16351
|
+
var BUILT_IN_SETS = [VALUE_CONTRIBUTION_SET, VALUE_CONTRIBUTION_SET_V1];
|
|
16064
16352
|
var BUILT_IN_MATRICES = [VALUE_MATRIX];
|
|
16065
16353
|
var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16066
16354
|
function cleaned(set2) {
|
|
@@ -16100,9 +16388,14 @@ function resolveWeighing(section) {
|
|
|
16100
16388
|
}
|
|
16101
16389
|
function setOfRef(resolved, ref) {
|
|
16102
16390
|
const { id, major } = splitSetRef(ref);
|
|
16103
|
-
|
|
16104
|
-
|
|
16105
|
-
|
|
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;
|
|
16106
16399
|
}
|
|
16107
16400
|
|
|
16108
16401
|
// ../schema/src/weighing-validate.ts
|
|
@@ -16186,9 +16479,11 @@ function validateWeighingSection(section, nodeSpecies, journal) {
|
|
|
16186
16479
|
if (entry.role === "positioning") {
|
|
16187
16480
|
const ruler = typeof entry.extends === "string" ? resolveRef2(entry.extends, `${path}.extends`, `Positioning "${String(entry.id)}"`, "weighing-positioning-unknown-ruler") : void 0;
|
|
16188
16481
|
if (typeof entry.extends !== "string") {
|
|
16189
|
-
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@
|
|
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`);
|
|
16190
16483
|
} else if (ruler !== void 0 && ruler.role === "positioning") {
|
|
16191
|
-
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@
|
|
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`);
|
|
16192
16487
|
}
|
|
16193
16488
|
const known = new Set(ruler !== void 0 && ruler.role !== "positioning" ? ruler.criteria.map((criterion) => criterion?.id) : []);
|
|
16194
16489
|
(Array.isArray(entry.criteria) ? entry.criteria : []).forEach((criterion, at) => {
|
|
@@ -16224,7 +16519,9 @@ function validateWeighingSection(section, nodeSpecies, journal) {
|
|
|
16224
16519
|
}
|
|
16225
16520
|
}
|
|
16226
16521
|
checkStatus(path, who, entry);
|
|
16227
|
-
if (wellFormed
|
|
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
|
+
}
|
|
16228
16525
|
});
|
|
16229
16526
|
const seenCells = /* @__PURE__ */ new Set();
|
|
16230
16527
|
assessments.forEach((entry, index) => {
|
|
@@ -16279,6 +16576,11 @@ function validateWeighingSection(section, nodeSpecies, journal) {
|
|
|
16279
16576
|
} else if ((entry.confidence === 2 || entry.confidence === 3) && (entry.evidence === void 0 || entry.evidence.trim() === "")) {
|
|
16280
16577
|
warn(`${path}.evidence`, "weighing-no-evidence", `${label}: confidence ${String(entry.confidence)} claims evidence and cites none`);
|
|
16281
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
|
+
}
|
|
16282
16584
|
if (entry.refs !== void 0 && !(Array.isArray(entry.refs) && entry.refs.every((ref) => typeof ref === "string"))) {
|
|
16283
16585
|
warn(`${path}.refs`, "weighing-refs-type", `${label}: refs must be an array of id strings`);
|
|
16284
16586
|
}
|
|
@@ -17227,7 +17529,7 @@ function makeEvent(type, payload = {}, options = {}) {
|
|
|
17227
17529
|
}
|
|
17228
17530
|
|
|
17229
17531
|
// ../schema/src/weighing-derive.ts
|
|
17230
|
-
var SEED_SCORER_ID = "seed-
|
|
17532
|
+
var SEED_SCORER_ID = "seed-claimed";
|
|
17231
17533
|
var SEED_SCORER = Object.freeze({ kind: "rule", id: SEED_SCORER_ID });
|
|
17232
17534
|
|
|
17233
17535
|
// src/lib/bundle-io.ts
|
package/package.json
CHANGED