@adhd/dispatch-base-spec 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/index.js +3 -5
- package/index.mjs +460 -669
- package/lib/types.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 0.1.4 (2026-09-26)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **dispatch-base-spec:** add 'fs.edit' OperationAction ([74096864](https://github.com/PseudoSky/adhd/commit/74096864))
|
|
6
|
+
- **vite-plugins:** absorb perf/test-resolve-fix — test-time @adhd/* source resolution ([3e344506](https://github.com/PseudoSky/adhd/commit/3e344506))
|
|
7
|
+
|
|
8
|
+
### 🩹 Fixes
|
|
9
|
+
|
|
10
|
+
- **vite:** restore import.meta.url in CJS output under vite 8 ([7916e639](https://github.com/PseudoSky/adhd/commit/7916e639))
|
|
11
|
+
- **nx:** finish the ESLint v9 flat-config migration and unblock the gate ([53f4ff3e](https://github.com/PseudoSky/adhd/commit/53f4ff3e))
|
|
12
|
+
|
|
13
|
+
### ❤️ Thank You
|
|
14
|
+
|
|
15
|
+
- pseudosky
|
|
16
|
+
|
|
1
17
|
## 0.1.3 (2026-09-24)
|
|
2
18
|
|
|
3
19
|
This was a version bump only for dispatch-base-spec to align it with other projects, there were no code changes.
|
package/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=new Set(["create","modify-signature","modify-body","add-export","remove-export","rename"]),x={function:new Set(["add-param","remove-param","rename-param","retype-param","change-param-optional","reorder-params","change-return"]),interface:new Set(["add-field","remove-field","rename-field","retype-field","change-field-optional","add-generic","remove-generic","constrain-generic","add-extends","remove-extends"]),type:new Set(["add-field","remove-field","retype-field"]),class:new Set(["add-field","remove-field","rename-field","retype-field","change-field-optional","add-param","add-generic","remove-generic","constrain-generic","add-extends","remove-extends"]),enum:new Set(["add-field","remove-field","rename-field"]),const:new Set(["add-var","remove-var","rename-var","change-default"]),config:new Set(["set-key","remove-key","rename-key","add-entry","remove-entry","update-entry","bump-version","update-checksum"]),env:new Set(["set-key","remove-key","rename-key"]),schema:new Set(["add-table","remove-table","add-column","remove-column","rename-column","retype-column","change-nullable","add-index","remove-index"]),manifest:new Set(["add-entry","remove-entry","bump-version"]),doc:new Set(["add-section","remove-section","rename-section","update-section"]),"structured-output":new Set([]),script:new Set(["add-param","remove-param","rename-param","retype-param","change-param-optional","reorder-params","change-return","add-field","remove-field","rename-field","retype-field","change-field-optional","add-generic","remove-generic","constrain-generic","add-extends","remove-extends","set-key","remove-key","rename-key","add-array-item","remove-array-item","add-var","remove-var","rename-var","change-default","add-section","remove-section","rename-section","update-section","add-table","remove-table","add-column","remove-column","rename-column","retype-column","change-nullable","add-index","remove-index","add-entry","remove-entry","update-entry","bump-version","update-checksum","add-export"])};function j(t,e){const r=x[t];return r?r.has(e):!1}const T=new Set(["pending","pending-surfaced","in_progress","complete","failed","skipped"]),q=new Set(["pending","in_progress","complete","failed","skipped"]),E=new Set(["automated","tool-call","generative"]),L=new Set(["anthropic","openai","deepseek","google","local","claudecli","teammate"]),N=new Set(["function","interface","type","class","enum","const","script","config","env","schema","manifest","doc","structured-output"]);function h(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function l(t){return typeof t=="string"}function n(t,e,r){return{path:t,message:e,value:r}}function R(t){var c,d;const e=Object.keys(t),r=new Map,a=new Map;for(const s of e)r.set(s,0),a.set(s,[]);for(const s of e)for(const i of((c=t[s])==null?void 0:c.depends_on)??[])t[i]&&((d=a.get(i))==null||d.push(s),r.set(s,(r.get(s)??0)+1));const p=e.filter(s=>(r.get(s)??0)===0),m=new Set;for(;p.length>0;){const s=p.shift();if(s!==void 0){m.add(s);for(const i of a.get(s)??[]){const u=(r.get(i)??1)-1;r.set(i,u),u===0&&p.push(i)}}}return m.size!==e.length?e.filter(s=>!m.has(s)).map(s=>({slug:s})):null}function V(t,e){for(const r of t){if(!h(r))continue;const a=l(r.id)?r.id:"?",p=r.provider;(!l(p)||!L.has(p))&&e.push(n(`dispatch_log[${a}].provider`,"invalid provider",p));const m=r.turns;if(!Array.isArray(m)){e.push(n(`dispatch_log[${a}].turns`,"must be an array",m));continue}for(let c=0;c<m.length;c++){const d=m[c],s=`dispatch_log[${a}].turns[${c}]`;if(!h(d)){e.push(n(s,"must be an object",d));continue}(typeof d.turn!="number"||!Number.isInteger(d.turn)||d.turn<1)&&e.push(n(`${s}.turn`,"must be a positive integer",d.turn)),typeof d.input_tokens!="number"&&e.push(n(`${s}.input_tokens`,"must be a number",d.input_tokens)),typeof d.output_tokens!="number"&&e.push(n(`${s}.output_tokens`,"must be a number",d.output_tokens)),l(d.t)||e.push(n(`${s}.t`,"must be a string",d.t));const i=d.model_calls;i!=null&&typeof i!="number"&&e.push(n(`${s}.model_calls`,"must be a number or null if present",i))}}}function O(t){const e=[];if(!h(t))return{valid:!1,errors:[n("","root must be an object")]};for(const m of["description","problem","approach","executor"]){const c=t[m];(!l(c)||c.trim()==="")&&e.push(n(m,"required string field missing/empty",c))}typeof t.schema_version!="number"&&e.push(n("schema_version","must be a number",t.schema_version));const r=t.plan_kind;r!=="brownfield"&&r!=="greenfield"&&e.push(n("plan_kind",'must be "brownfield" or "greenfield"',r)),Array.isArray(t.phases)?t.phases.length===0&&e.push(n("phases","must have at least one entry")):e.push(n("phases","must be an array",t.phases));const a=t.terminal;!l(a)&&!Array.isArray(a)&&e.push(n("terminal","must be a string or array",a)),Array.isArray(t.dispatch_log)?V(t.dispatch_log,e):e.push(n("dispatch_log","must be an array",t.dispatch_log)),h(t.optimization)||e.push(n("optimization","must be an object",t.optimization)),h(t.providers)||e.push(n("providers","must be an object",t.providers)),h(t.effort_max_tokens)||e.push(n("effort_max_tokens","must be an object",t.effort_max_tokens));const p=t.milestones;if(!h(p))e.push(n("milestones","must be an object",p));else{const m=Object.keys(p);m.length===0&&e.push(n("milestones","must have at least one entry"));const c=new Set(m);for(const u of m){const o=p[u];if(!h(o)){e.push(n(`milestones.${u}`,"must be an object",o));continue}if((!l(o.description)||o.description.trim()==="")&&e.push(n(`milestones.${u}.description`,"required string",o.description)),!Array.isArray(o.depends_on))e.push(n(`milestones.${u}.depends_on`,"must be an array",o.depends_on));else for(const _ of o.depends_on)l(_)?c.has(_)||e.push(n(`milestones.${u}.depends_on`,`unknown milestone "${_}"`)):e.push(n(`milestones.${u}.depends_on[]`,"must be a string",_));const b=o.phase;(!l(b)||b.trim()==="")&&e.push(n(`milestones.${u}.phase`,"required string",b)),(!l(o.authored_by)||o.authored_by.trim()==="")&&e.push(n(`milestones.${u}.authored_by`,"required string",o.authored_by));const f=o.model;f!=null&&!["Haiku","Sonnet","Opus"].includes(f)&&e.push(n(`milestones.${u}.model`,"invalid model tier",f));const y=o.effort;y!=null&&!["low","medium","high","xhigh","max"].includes(y)&&e.push(n(`milestones.${u}.effort`,"invalid effort tier",y)),o.two_stage!==void 0&&typeof o.two_stage!="boolean"&&e.push(n(`milestones.${u}.two_stage`,"must be a boolean",o.two_stage)),Array.isArray(o.read_only)||e.push(n(`milestones.${u}.read_only`,"must be an array",o.read_only))}const d=R(p);if(d)for(const{slug:u}of d)e.push(n(`milestones.${u}`,"dependency cycle detected"));if(l(a)&&!c.has(a))e.push(n("terminal",`unknown milestone "${a}"`));else if(Array.isArray(a))for(const u of a)c.has(u)||e.push(n("terminal[]",`unknown milestone "${u}"`));const s=t.operations,i=new Set;if(!Array.isArray(s)&&!h(s))e.push(n("operations","must be an array or object",s));else{const u=Array.isArray(s)?s:Object.values(s);for(const o of u){if(!h(o)){e.push(n("operations[]","must be an object",o));continue}const b=o.id;if(!l(b)){e.push(n("operations[?]","missing/invalid id",b));continue}const f=b;i.add(f);const y=o.milestone;l(y)?c.has(y)||e.push(n(`operations[${f}].milestone`,`unknown milestone "${y}"`)):e.push(n(`operations[${f}].milestone`,"required string",y));const _=o.type;l(_)&&!E.has(_)&&e.push(n(`operations[${f}].type`,"invalid type",_));const v=o.shape;if(h(v)){const g=v.kind;g!=null&&l(g)&&!N.has(g)&&e.push(n(`operations[${f}].shape.kind`,"invalid shape kind",g));const $=v.ops;if(Array.isArray($)&&l(g))for(let w=0;w<$.length;w++){const k=$[w];if(!h(k))continue;const A=k.op;l(A)&&!j(g,A)&&e.push(n(`operations[${f}].shape.ops[${w}]`,`op "${A}" not valid for kind "${g}"`))}}Array.isArray(o.depends_on)||e.push(n(`operations[${f}].depends_on`,"must be an array",o.depends_on))}for(const o of u){if(!h(o))continue;const b=o.id;if(!l(b))continue;const f=o.depends_on;if(Array.isArray(f))for(const y of f)l(y)&&!i.has(y)&&e.push(n(`operations[${b}].depends_on`,`unknown operation "${y}"`))}}}return{valid:e.length===0,errors:e}}function I(t){const e=[];if(!h(t))return{valid:!1,errors:[n("","root must be an object")]};for(const a of["snapshot_at","description"])l(t[a])||e.push(n(a,"required string field missing",t[a]));l(t.plan)||e.push(n("plan","required string",t.plan));const r=t.milestones;if(!h(r))e.push(n("milestones","must be an object",r));else{const a=Object.keys(r),p=new Set(a);for(const s of a){const i=r[s];if(!h(i)){e.push(n(`milestones.${s}`,"must be an object",i));continue}const u=i.eligible,o=i.pending;u===!0&&o!==null&&o!==void 0&&e.push(n(`milestones.${s}`,"D-07 violation: eligible=true but pending not null")),typeof u!="boolean"&&e.push(n(`milestones.${s}.eligible`,"must be boolean",u));const b=i.status;(!l(b)||!T.has(b))&&e.push(n(`milestones.${s}.status`,"invalid status",b)),u===!0&&b==="complete"&&e.push(n(`milestones.${s}`,"D-07 violation: eligible=true but status is complete"));const f=i.wave;(typeof f!="number"||!Number.isInteger(f)||f<0)&&e.push(n(`milestones.${s}.wave`,"must be non-negative integer",f));const y=i.ki_estimate;y!=null&&typeof y!="number"&&e.push(n(`milestones.${s}.ki_estimate`,"must be number|null",y));for(const _ of["tokens_estimated","tokens_actual"]){const v=i[_];v!=null&&typeof v!="number"&&e.push(n(`milestones.${s}.${_}`,"must be number|null",v))}Array.isArray(i.artifacts)||e.push(n(`milestones.${s}.artifacts`,"must be an array",i.artifacts)),typeof i.si_bytes!="number"&&e.push(n(`milestones.${s}.si_bytes`,"must be a number",i.si_bytes))}const m=t.operations;if(!Array.isArray(m))e.push(n("operations","must be an array",m));else for(const s of m){if(!h(s))continue;const i=l(s.id)?s.id:"?",u=s.milestone;l(u)&&!p.has(u)&&e.push(n(`operations[${i}].milestone`,`unknown milestone "${u}"`));const o=s.status;(!l(o)||!q.has(o))&&e.push(n(`operations[${i}].status`,"invalid operation status",o)),Array.isArray(s.dispatch_ids)||e.push(n(`operations[${i}].dispatch_ids`,"must be an array",s.dispatch_ids)),typeof s.attempt_count!="number"&&e.push(n(`operations[${i}].attempt_count`,"must be a number",s.attempt_count)),Array.isArray(s.blast_radius)||e.push(n(`operations[${i}].blast_radius`,"must be an array",s.blast_radius))}const c=t.open_questions;if(!Array.isArray(c))e.push(n("open_questions","must be an array",c));else for(const s of c){if(!h(s))continue;const i=s.blocking;(!l(i)||!p.has(i))&&e.push(n("open_questions",`unknown blocking milestone "${i}"`)),typeof s.surfaced!="boolean"&&e.push(n(`open_questions[${s.id}]`,"surfaced must be boolean",s.surfaced)),typeof s.answered!="boolean"&&e.push(n(`open_questions[${s.id}]`,"answered must be boolean",s.answered))}const d=t.dispatch_units;if(d!==void 0)if(!Array.isArray(d))e.push(n("dispatch_units","must be an array if present",d));else for(const s of d){if(!h(s))continue;const i=s.fits_context_window;typeof i!="boolean"&&e.push(n(`dispatch_units[${s.id}]`,"fits_context_window must be boolean",i));const u=s.milestones;if(Array.isArray(u))for(const o of u)l(o)&&!p.has(o)&&e.push(n(`dispatch_units[${s.id}].milestones`,`unknown milestone "${o}"`))}h(t.pairwise_overlap)||e.push(n("pairwise_overlap","must be an object",t.pairwise_overlap))}return{valid:e.length===0,errors:e}}function P(t){const e=O(t);if(!e.valid)throw new Error(`DagJson validation failed:
|
|
2
|
-
|
|
3
|
-
`)}`)}
|
|
4
|
-
${e.errors.map(r=>` ${r.path}: ${r.message}`).join(`
|
|
5
|
-
`)}`)}const S=[{from:2,to:3,apply:t=>{!t.milestones&&t.nodes&&(t.milestones=t.nodes,delete t.nodes);const e=t.operations;e&&typeof e=="object"&&!Array.isArray(e)&&(t.operations=Object.values(e))}},{from:3,to:4,apply:t=>{(!t.providers||Object.keys(t.providers).length===0)&&(t.providers={Haiku:{type:"claudecli",model_id:"claude-haiku-4-5",env_secret:null,base_url:null,timeout_ms:6e4,retry_config:{retries:3,min_timeout:1e3,max_timeout:3e4,factor:2}},Sonnet:{type:"claudecli",model_id:"claude-sonnet-4-5",env_secret:null,base_url:null,timeout_ms:12e4,retry_config:{retries:3,min_timeout:1e3,max_timeout:3e4,factor:2}},Opus:{type:"claudecli",model_id:"claude-opus-4-5",env_secret:null,base_url:null,timeout_ms:3e5,retry_config:{retries:3,min_timeout:1e3,max_timeout:3e4,factor:2}}}),(!t.effort_max_tokens||Object.keys(t.effort_max_tokens).length===0)&&(t.effort_max_tokens={low:1024,medium:4096,high:8192,xhigh:16384,max:32768}),t.optimization||(t.optimization={sentinel_fanout:{enabled:!0,write_multiplier:1.25,read_multiplier:.1,hit_probability:.9},b_per_tier:{Haiku:8e3,Sonnet:15e3,Opus:27e3},context_window_per_tier:{Haiku:16e3,Sonnet:16e3,Opus:32e3},context_window_override:null,b_override:null});let e=[];Array.isArray(t.operations)?e=t.operations:t.operations&&typeof t.operations=="object"&&(e=Object.values(t.operations));for(const r of e)if(typeof r=="object"&&r!==null){const a=r;a.type===void 0&&(a.type="generative"),a.criteria===void 0&&(a.criteria=[]),a.tool===void 0&&(a.tool=null),a.args===void 0&&(a.args=null)}}}];function z(t,e,r){if(t===e)return;let a=t;for(const p of[...S].sort((m,c)=>m.from-c.from))if(p.from===a&&(p.apply(r),a=p.to,a===e)){r.schema_version=e;return}throw new Error(`migrateDag: no path from v${t} to v${e}. Available: [${S.map(p=>`v${p.from}→v${p.to}`).join(", ")}]`)}exports.VALID_OPS_BY_KIND=x;exports.WRITE_CLASS_ACTIONS=D;exports.assertValidDagJson=P;exports.assertValidSnapshot=K;exports.isValidOpForKind=j;exports.migrateDag=z;exports.validateDagJson=O;exports.validateSnapshot=I;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=new Set([`create`,`modify-signature`,`modify-body`,`add-export`,`remove-export`,`rename`]),t={function:new Set([`add-param`,`remove-param`,`rename-param`,`retype-param`,`change-param-optional`,`reorder-params`,`change-return`]),interface:new Set([`add-field`,`remove-field`,`rename-field`,`retype-field`,`change-field-optional`,`add-generic`,`remove-generic`,`constrain-generic`,`add-extends`,`remove-extends`]),type:new Set([`add-field`,`remove-field`,`retype-field`]),class:new Set([`add-field`,`remove-field`,`rename-field`,`retype-field`,`change-field-optional`,`add-param`,`add-generic`,`remove-generic`,`constrain-generic`,`add-extends`,`remove-extends`]),enum:new Set([`add-field`,`remove-field`,`rename-field`]),const:new Set([`add-var`,`remove-var`,`rename-var`,`change-default`]),config:new Set([`set-key`,`remove-key`,`rename-key`,`add-entry`,`remove-entry`,`update-entry`,`bump-version`,`update-checksum`]),env:new Set([`set-key`,`remove-key`,`rename-key`]),schema:new Set([`add-table`,`remove-table`,`add-column`,`remove-column`,`rename-column`,`retype-column`,`change-nullable`,`add-index`,`remove-index`]),manifest:new Set([`add-entry`,`remove-entry`,`bump-version`]),doc:new Set([`add-section`,`remove-section`,`rename-section`,`update-section`]),"structured-output":new Set([]),script:new Set(`add-param.remove-param.rename-param.retype-param.change-param-optional.reorder-params.change-return.add-field.remove-field.rename-field.retype-field.change-field-optional.add-generic.remove-generic.constrain-generic.add-extends.remove-extends.set-key.remove-key.rename-key.add-array-item.remove-array-item.add-var.remove-var.rename-var.change-default.add-section.remove-section.rename-section.update-section.add-table.remove-table.add-column.remove-column.rename-column.retype-column.change-nullable.add-index.remove-index.add-entry.remove-entry.update-entry.bump-version.update-checksum.add-export`.split(`.`))};function n(e,n){let r=t[e];return r?r.has(n):!1}var r=new Set([`pending`,`pending-surfaced`,`in_progress`,`complete`,`failed`,`skipped`]),i=new Set([`pending`,`in_progress`,`complete`,`failed`,`skipped`]),a=new Set([`automated`,`tool-call`,`generative`]),o=new Set([`anthropic`,`openai`,`deepseek`,`google`,`local`,`claudecli`,`teammate`]),s=new Set([`function`,`interface`,`type`,`class`,`enum`,`const`,`script`,`config`,`env`,`schema`,`manifest`,`doc`,`structured-output`]);function c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function l(e){return typeof e==`string`}function u(e,t,n){return{path:e,message:t,value:n}}function d(e){let t=Object.keys(e),n=new Map,r=new Map;for(let e of t)n.set(e,0),r.set(e,[]);for(let i of t)for(let t of e[i]?.depends_on??[])e[t]&&(r.get(t)?.push(i),n.set(i,(n.get(i)??0)+1));let i=t.filter(e=>(n.get(e)??0)===0),a=new Set;for(;i.length>0;){let e=i.shift();if(e!==void 0){a.add(e);for(let t of r.get(e)??[]){let e=(n.get(t)??1)-1;n.set(t,e),e===0&&i.push(t)}}}return a.size===t.length?null:t.filter(e=>!a.has(e)).map(e=>({slug:e}))}function f(e,t){for(let n of e){if(!c(n))continue;let e=l(n.id)?n.id:`?`,r=n.provider;(!l(r)||!o.has(r))&&t.push(u(`dispatch_log[${e}].provider`,`invalid provider`,r));let i=n.turns;if(!Array.isArray(i)){t.push(u(`dispatch_log[${e}].turns`,`must be an array`,i));continue}for(let n=0;n<i.length;n++){let r=i[n],a=`dispatch_log[${e}].turns[${n}]`;if(!c(r)){t.push(u(a,`must be an object`,r));continue}(typeof r.turn!=`number`||!Number.isInteger(r.turn)||r.turn<1)&&t.push(u(`${a}.turn`,`must be a positive integer`,r.turn)),typeof r.input_tokens!=`number`&&t.push(u(`${a}.input_tokens`,`must be a number`,r.input_tokens)),typeof r.output_tokens!=`number`&&t.push(u(`${a}.output_tokens`,`must be a number`,r.output_tokens)),l(r.t)||t.push(u(`${a}.t`,`must be a string`,r.t));let o=r.model_calls;o!=null&&typeof o!=`number`&&t.push(u(`${a}.model_calls`,`must be a number or null if present`,o))}}}function p(e){let t=[];if(!c(e))return{valid:!1,errors:[u(``,`root must be an object`)]};for(let n of[`description`,`problem`,`approach`,`executor`]){let r=e[n];(!l(r)||r.trim()===``)&&t.push(u(n,`required string field missing/empty`,r))}typeof e.schema_version!=`number`&&t.push(u(`schema_version`,`must be a number`,e.schema_version));let r=e.plan_kind;r!==`brownfield`&&r!==`greenfield`&&t.push(u(`plan_kind`,`must be "brownfield" or "greenfield"`,r)),Array.isArray(e.phases)?e.phases.length===0&&t.push(u(`phases`,`must have at least one entry`)):t.push(u(`phases`,`must be an array`,e.phases));let i=e.terminal;!l(i)&&!Array.isArray(i)&&t.push(u(`terminal`,`must be a string or array`,i)),Array.isArray(e.dispatch_log)?f(e.dispatch_log,t):t.push(u(`dispatch_log`,`must be an array`,e.dispatch_log)),c(e.optimization)||t.push(u(`optimization`,`must be an object`,e.optimization)),c(e.providers)||t.push(u(`providers`,`must be an object`,e.providers)),c(e.effort_max_tokens)||t.push(u(`effort_max_tokens`,`must be an object`,e.effort_max_tokens));let o=e.milestones;if(!c(o))t.push(u(`milestones`,`must be an object`,o));else{let r=Object.keys(o);r.length===0&&t.push(u(`milestones`,`must have at least one entry`));let f=new Set(r);for(let e of r){let n=o[e];if(!c(n)){t.push(u(`milestones.${e}`,`must be an object`,n));continue}if((!l(n.description)||n.description.trim()===``)&&t.push(u(`milestones.${e}.description`,`required string`,n.description)),!Array.isArray(n.depends_on))t.push(u(`milestones.${e}.depends_on`,`must be an array`,n.depends_on));else for(let r of n.depends_on)l(r)?f.has(r)||t.push(u(`milestones.${e}.depends_on`,`unknown milestone "${r}"`)):t.push(u(`milestones.${e}.depends_on[]`,`must be a string`,r));let r=n.phase;(!l(r)||r.trim()===``)&&t.push(u(`milestones.${e}.phase`,`required string`,r)),(!l(n.authored_by)||n.authored_by.trim()===``)&&t.push(u(`milestones.${e}.authored_by`,`required string`,n.authored_by));let i=n.model;i!=null&&![`Haiku`,`Sonnet`,`Opus`].includes(i)&&t.push(u(`milestones.${e}.model`,`invalid model tier`,i));let a=n.effort;a!=null&&![`low`,`medium`,`high`,`xhigh`,`max`].includes(a)&&t.push(u(`milestones.${e}.effort`,`invalid effort tier`,a)),n.two_stage!==void 0&&typeof n.two_stage!=`boolean`&&t.push(u(`milestones.${e}.two_stage`,`must be a boolean`,n.two_stage)),Array.isArray(n.read_only)||t.push(u(`milestones.${e}.read_only`,`must be an array`,n.read_only))}let p=d(o);if(p)for(let{slug:e}of p)t.push(u(`milestones.${e}`,`dependency cycle detected`));if(l(i)&&!f.has(i))t.push(u(`terminal`,`unknown milestone "${i}"`));else if(Array.isArray(i))for(let e of i)f.has(e)||t.push(u(`terminal[]`,`unknown milestone "${e}"`));let m=e.operations,h=new Set;if(!Array.isArray(m)&&!c(m))t.push(u(`operations`,`must be an array or object`,m));else{let e=Array.isArray(m)?m:Object.values(m);for(let r of e){if(!c(r)){t.push(u(`operations[]`,`must be an object`,r));continue}let e=r.id;if(!l(e)){t.push(u(`operations[?]`,`missing/invalid id`,e));continue}let i=e;h.add(i);let o=r.milestone;l(o)?f.has(o)||t.push(u(`operations[${i}].milestone`,`unknown milestone "${o}"`)):t.push(u(`operations[${i}].milestone`,`required string`,o));let d=r.type;l(d)&&!a.has(d)&&t.push(u(`operations[${i}].type`,`invalid type`,d));let p=r.shape;if(c(p)){let e=p.kind;e!=null&&l(e)&&!s.has(e)&&t.push(u(`operations[${i}].shape.kind`,`invalid shape kind`,e));let r=p.ops;if(Array.isArray(r)&&l(e))for(let a=0;a<r.length;a++){let o=r[a];if(!c(o))continue;let s=o.op;l(s)&&!n(e,s)&&t.push(u(`operations[${i}].shape.ops[${a}]`,`op "${s}" not valid for kind "${e}"`))}}Array.isArray(r.depends_on)||t.push(u(`operations[${i}].depends_on`,`must be an array`,r.depends_on))}for(let n of e){if(!c(n))continue;let e=n.id;if(!l(e))continue;let r=n.depends_on;if(Array.isArray(r))for(let n of r)l(n)&&!h.has(n)&&t.push(u(`operations[${e}].depends_on`,`unknown operation "${n}"`))}}}return{valid:t.length===0,errors:t}}function m(e){let t=[];if(!c(e))return{valid:!1,errors:[u(``,`root must be an object`)]};for(let n of[`snapshot_at`,`description`])l(e[n])||t.push(u(n,`required string field missing`,e[n]));l(e.plan)||t.push(u(`plan`,`required string`,e.plan));let n=e.milestones;if(!c(n))t.push(u(`milestones`,`must be an object`,n));else{let a=Object.keys(n),o=new Set(a);for(let e of a){let i=n[e];if(!c(i)){t.push(u(`milestones.${e}`,`must be an object`,i));continue}let a=i.eligible,o=i.pending;a===!0&&o!=null&&t.push(u(`milestones.${e}`,`D-07 violation: eligible=true but pending not null`)),typeof a!=`boolean`&&t.push(u(`milestones.${e}.eligible`,`must be boolean`,a));let s=i.status;(!l(s)||!r.has(s))&&t.push(u(`milestones.${e}.status`,`invalid status`,s)),a===!0&&s===`complete`&&t.push(u(`milestones.${e}`,`D-07 violation: eligible=true but status is complete`));let d=i.wave;(typeof d!=`number`||!Number.isInteger(d)||d<0)&&t.push(u(`milestones.${e}.wave`,`must be non-negative integer`,d));let f=i.ki_estimate;f!=null&&typeof f!=`number`&&t.push(u(`milestones.${e}.ki_estimate`,`must be number|null`,f));for(let n of[`tokens_estimated`,`tokens_actual`]){let r=i[n];r!=null&&typeof r!=`number`&&t.push(u(`milestones.${e}.${n}`,`must be number|null`,r))}Array.isArray(i.artifacts)||t.push(u(`milestones.${e}.artifacts`,`must be an array`,i.artifacts)),typeof i.si_bytes!=`number`&&t.push(u(`milestones.${e}.si_bytes`,`must be a number`,i.si_bytes))}let s=e.operations;if(!Array.isArray(s))t.push(u(`operations`,`must be an array`,s));else for(let e of s){if(!c(e))continue;let n=l(e.id)?e.id:`?`,r=e.milestone;l(r)&&!o.has(r)&&t.push(u(`operations[${n}].milestone`,`unknown milestone "${r}"`));let a=e.status;(!l(a)||!i.has(a))&&t.push(u(`operations[${n}].status`,`invalid operation status`,a)),Array.isArray(e.dispatch_ids)||t.push(u(`operations[${n}].dispatch_ids`,`must be an array`,e.dispatch_ids)),typeof e.attempt_count!=`number`&&t.push(u(`operations[${n}].attempt_count`,`must be a number`,e.attempt_count)),Array.isArray(e.blast_radius)||t.push(u(`operations[${n}].blast_radius`,`must be an array`,e.blast_radius))}let d=e.open_questions;if(!Array.isArray(d))t.push(u(`open_questions`,`must be an array`,d));else for(let e of d){if(!c(e))continue;let n=e.blocking;(!l(n)||!o.has(n))&&t.push(u(`open_questions`,`unknown blocking milestone "${n}"`)),typeof e.surfaced!=`boolean`&&t.push(u(`open_questions[${e.id}]`,`surfaced must be boolean`,e.surfaced)),typeof e.answered!=`boolean`&&t.push(u(`open_questions[${e.id}]`,`answered must be boolean`,e.answered))}let f=e.dispatch_units;if(f!==void 0){if(!Array.isArray(f))t.push(u(`dispatch_units`,`must be an array if present`,f));else for(let e of f){if(!c(e))continue;let n=e.fits_context_window;typeof n!=`boolean`&&t.push(u(`dispatch_units[${e.id}]`,`fits_context_window must be boolean`,n));let r=e.milestones;if(Array.isArray(r))for(let n of r)l(n)&&!o.has(n)&&t.push(u(`dispatch_units[${e.id}].milestones`,`unknown milestone "${n}"`))}}c(e.pairwise_overlap)||t.push(u(`pairwise_overlap`,`must be an object`,e.pairwise_overlap))}return{valid:t.length===0,errors:t}}function h(e){let t=p(e);if(!t.valid)throw Error(`DagJson validation failed:\n${t.errors.map(e=>` ${e.path}: ${e.message}`).join(`
|
|
2
|
+
`)}`)}function g(e){let t=m(e);if(!t.valid)throw Error(`Snapshot validation failed:\n${t.errors.map(e=>` ${e.path}: ${e.message}`).join(`
|
|
3
|
+
`)}`)}var _=[{from:2,to:3,apply:e=>{!e.milestones&&e.nodes&&(e.milestones=e.nodes,delete e.nodes);let t=e.operations;t&&typeof t==`object`&&!Array.isArray(t)&&(e.operations=Object.values(t))}},{from:3,to:4,apply:e=>{(!e.providers||Object.keys(e.providers).length===0)&&(e.providers={Haiku:{type:`claudecli`,model_id:`claude-haiku-4-5`,env_secret:null,base_url:null,timeout_ms:6e4,retry_config:{retries:3,min_timeout:1e3,max_timeout:3e4,factor:2}},Sonnet:{type:`claudecli`,model_id:`claude-sonnet-4-5`,env_secret:null,base_url:null,timeout_ms:12e4,retry_config:{retries:3,min_timeout:1e3,max_timeout:3e4,factor:2}},Opus:{type:`claudecli`,model_id:`claude-opus-4-5`,env_secret:null,base_url:null,timeout_ms:3e5,retry_config:{retries:3,min_timeout:1e3,max_timeout:3e4,factor:2}}}),(!e.effort_max_tokens||Object.keys(e.effort_max_tokens).length===0)&&(e.effort_max_tokens={low:1024,medium:4096,high:8192,xhigh:16384,max:32768}),e.optimization||={sentinel_fanout:{enabled:!0,write_multiplier:1.25,read_multiplier:.1,hit_probability:.9},b_per_tier:{Haiku:8e3,Sonnet:15e3,Opus:27e3},context_window_per_tier:{Haiku:16e3,Sonnet:16e3,Opus:32e3},context_window_override:null,b_override:null};let t=[];Array.isArray(e.operations)?t=e.operations:e.operations&&typeof e.operations==`object`&&(t=Object.values(e.operations));for(let e of t)if(typeof e==`object`&&e){let t=e;t.type===void 0&&(t.type=`generative`),t.criteria===void 0&&(t.criteria=[]),t.tool===void 0&&(t.tool=null),t.args===void 0&&(t.args=null)}}}];function v(e,t,n){if(e===t)return;let r=e;for(let e of[..._].sort((e,t)=>e.from-t.from))if(e.from===r&&(e.apply(n),r=e.to,r===t)){n.schema_version=t;return}throw Error(`migrateDag: no path from v${e} to v${t}. Available: [${_.map(e=>`v${e.from}→v${e.to}`).join(`, `)}]`)}exports.VALID_OPS_BY_KIND=t,exports.WRITE_CLASS_ACTIONS=e,exports.assertValidDagJson=h,exports.assertValidSnapshot=g,exports.isValidOpForKind=n,exports.migrateDag=v,exports.validateDagJson=p,exports.validateSnapshot=m;
|
package/index.mjs
CHANGED
|
@@ -1,682 +1,473 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"set-key",
|
|
100
|
-
"remove-key",
|
|
101
|
-
"rename-key",
|
|
102
|
-
"add-array-item",
|
|
103
|
-
"remove-array-item",
|
|
104
|
-
"add-var",
|
|
105
|
-
"remove-var",
|
|
106
|
-
"rename-var",
|
|
107
|
-
"change-default",
|
|
108
|
-
"add-section",
|
|
109
|
-
"remove-section",
|
|
110
|
-
"rename-section",
|
|
111
|
-
"update-section",
|
|
112
|
-
"add-table",
|
|
113
|
-
"remove-table",
|
|
114
|
-
"add-column",
|
|
115
|
-
"remove-column",
|
|
116
|
-
"rename-column",
|
|
117
|
-
"retype-column",
|
|
118
|
-
"change-nullable",
|
|
119
|
-
"add-index",
|
|
120
|
-
"remove-index",
|
|
121
|
-
"add-entry",
|
|
122
|
-
"remove-entry",
|
|
123
|
-
"update-entry",
|
|
124
|
-
"bump-version",
|
|
125
|
-
"update-checksum",
|
|
126
|
-
"add-export"
|
|
127
|
-
])
|
|
1
|
+
//#region src/lib/types.ts
|
|
2
|
+
var e = /* @__PURE__ */ new Set([
|
|
3
|
+
"create",
|
|
4
|
+
"modify-signature",
|
|
5
|
+
"modify-body",
|
|
6
|
+
"add-export",
|
|
7
|
+
"remove-export",
|
|
8
|
+
"rename"
|
|
9
|
+
]), t = {
|
|
10
|
+
function: /* @__PURE__ */ new Set([
|
|
11
|
+
"add-param",
|
|
12
|
+
"remove-param",
|
|
13
|
+
"rename-param",
|
|
14
|
+
"retype-param",
|
|
15
|
+
"change-param-optional",
|
|
16
|
+
"reorder-params",
|
|
17
|
+
"change-return"
|
|
18
|
+
]),
|
|
19
|
+
interface: /* @__PURE__ */ new Set([
|
|
20
|
+
"add-field",
|
|
21
|
+
"remove-field",
|
|
22
|
+
"rename-field",
|
|
23
|
+
"retype-field",
|
|
24
|
+
"change-field-optional",
|
|
25
|
+
"add-generic",
|
|
26
|
+
"remove-generic",
|
|
27
|
+
"constrain-generic",
|
|
28
|
+
"add-extends",
|
|
29
|
+
"remove-extends"
|
|
30
|
+
]),
|
|
31
|
+
type: /* @__PURE__ */ new Set([
|
|
32
|
+
"add-field",
|
|
33
|
+
"remove-field",
|
|
34
|
+
"retype-field"
|
|
35
|
+
]),
|
|
36
|
+
class: /* @__PURE__ */ new Set([
|
|
37
|
+
"add-field",
|
|
38
|
+
"remove-field",
|
|
39
|
+
"rename-field",
|
|
40
|
+
"retype-field",
|
|
41
|
+
"change-field-optional",
|
|
42
|
+
"add-param",
|
|
43
|
+
"add-generic",
|
|
44
|
+
"remove-generic",
|
|
45
|
+
"constrain-generic",
|
|
46
|
+
"add-extends",
|
|
47
|
+
"remove-extends"
|
|
48
|
+
]),
|
|
49
|
+
enum: /* @__PURE__ */ new Set([
|
|
50
|
+
"add-field",
|
|
51
|
+
"remove-field",
|
|
52
|
+
"rename-field"
|
|
53
|
+
]),
|
|
54
|
+
const: /* @__PURE__ */ new Set([
|
|
55
|
+
"add-var",
|
|
56
|
+
"remove-var",
|
|
57
|
+
"rename-var",
|
|
58
|
+
"change-default"
|
|
59
|
+
]),
|
|
60
|
+
config: /* @__PURE__ */ new Set([
|
|
61
|
+
"set-key",
|
|
62
|
+
"remove-key",
|
|
63
|
+
"rename-key",
|
|
64
|
+
"add-entry",
|
|
65
|
+
"remove-entry",
|
|
66
|
+
"update-entry",
|
|
67
|
+
"bump-version",
|
|
68
|
+
"update-checksum"
|
|
69
|
+
]),
|
|
70
|
+
env: /* @__PURE__ */ new Set([
|
|
71
|
+
"set-key",
|
|
72
|
+
"remove-key",
|
|
73
|
+
"rename-key"
|
|
74
|
+
]),
|
|
75
|
+
schema: /* @__PURE__ */ new Set([
|
|
76
|
+
"add-table",
|
|
77
|
+
"remove-table",
|
|
78
|
+
"add-column",
|
|
79
|
+
"remove-column",
|
|
80
|
+
"rename-column",
|
|
81
|
+
"retype-column",
|
|
82
|
+
"change-nullable",
|
|
83
|
+
"add-index",
|
|
84
|
+
"remove-index"
|
|
85
|
+
]),
|
|
86
|
+
manifest: /* @__PURE__ */ new Set([
|
|
87
|
+
"add-entry",
|
|
88
|
+
"remove-entry",
|
|
89
|
+
"bump-version"
|
|
90
|
+
]),
|
|
91
|
+
doc: /* @__PURE__ */ new Set([
|
|
92
|
+
"add-section",
|
|
93
|
+
"remove-section",
|
|
94
|
+
"rename-section",
|
|
95
|
+
"update-section"
|
|
96
|
+
]),
|
|
97
|
+
"structured-output": /* @__PURE__ */ new Set([]),
|
|
98
|
+
script: /* @__PURE__ */ new Set(/* @__PURE__ */ "add-param.remove-param.rename-param.retype-param.change-param-optional.reorder-params.change-return.add-field.remove-field.rename-field.retype-field.change-field-optional.add-generic.remove-generic.constrain-generic.add-extends.remove-extends.set-key.remove-key.rename-key.add-array-item.remove-array-item.add-var.remove-var.rename-var.change-default.add-section.remove-section.rename-section.update-section.add-table.remove-table.add-column.remove-column.rename-column.retype-column.change-nullable.add-index.remove-index.add-entry.remove-entry.update-entry.bump-version.update-checksum.add-export".split("."))
|
|
128
99
|
};
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
|
|
100
|
+
function n(e, n) {
|
|
101
|
+
let r = t[e];
|
|
102
|
+
return r ? r.has(n) : !1;
|
|
132
103
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/lib/validate.ts
|
|
106
|
+
var r = /* @__PURE__ */ new Set([
|
|
107
|
+
"pending",
|
|
108
|
+
"pending-surfaced",
|
|
109
|
+
"in_progress",
|
|
110
|
+
"complete",
|
|
111
|
+
"failed",
|
|
112
|
+
"skipped"
|
|
113
|
+
]), i = /* @__PURE__ */ new Set([
|
|
114
|
+
"pending",
|
|
115
|
+
"in_progress",
|
|
116
|
+
"complete",
|
|
117
|
+
"failed",
|
|
118
|
+
"skipped"
|
|
119
|
+
]), a = /* @__PURE__ */ new Set([
|
|
120
|
+
"automated",
|
|
121
|
+
"tool-call",
|
|
122
|
+
"generative"
|
|
123
|
+
]), o = /* @__PURE__ */ new Set([
|
|
124
|
+
"anthropic",
|
|
125
|
+
"openai",
|
|
126
|
+
"deepseek",
|
|
127
|
+
"google",
|
|
128
|
+
"local",
|
|
129
|
+
"claudecli",
|
|
130
|
+
"teammate"
|
|
131
|
+
]), s = /* @__PURE__ */ new Set([
|
|
132
|
+
"function",
|
|
133
|
+
"interface",
|
|
134
|
+
"type",
|
|
135
|
+
"class",
|
|
136
|
+
"enum",
|
|
137
|
+
"const",
|
|
138
|
+
"script",
|
|
139
|
+
"config",
|
|
140
|
+
"env",
|
|
141
|
+
"schema",
|
|
142
|
+
"manifest",
|
|
143
|
+
"doc",
|
|
144
|
+
"structured-output"
|
|
168
145
|
]);
|
|
169
|
-
function
|
|
170
|
-
|
|
146
|
+
function c(e) {
|
|
147
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
171
148
|
}
|
|
172
|
-
function l(
|
|
173
|
-
|
|
149
|
+
function l(e) {
|
|
150
|
+
return typeof e == "string";
|
|
174
151
|
}
|
|
175
|
-
function
|
|
176
|
-
|
|
152
|
+
function u(e, t, n) {
|
|
153
|
+
return {
|
|
154
|
+
path: e,
|
|
155
|
+
message: t,
|
|
156
|
+
value: n
|
|
157
|
+
};
|
|
177
158
|
}
|
|
178
|
-
function
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return m.size !== e.length ? e.filter((o) => !m.has(o)).map((o) => ({ slug: o })) : null;
|
|
159
|
+
function d(e) {
|
|
160
|
+
let t = Object.keys(e), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
161
|
+
for (let e of t) n.set(e, 0), r.set(e, []);
|
|
162
|
+
for (let i of t) for (let t of e[i]?.depends_on ?? []) e[t] && (r.get(t)?.push(i), n.set(i, (n.get(i) ?? 0) + 1));
|
|
163
|
+
let i = t.filter((e) => (n.get(e) ?? 0) === 0), a = /* @__PURE__ */ new Set();
|
|
164
|
+
for (; i.length > 0;) {
|
|
165
|
+
let e = i.shift();
|
|
166
|
+
if (e !== void 0) {
|
|
167
|
+
a.add(e);
|
|
168
|
+
for (let t of r.get(e) ?? []) {
|
|
169
|
+
let e = (n.get(t) ?? 1) - 1;
|
|
170
|
+
n.set(t, e), e === 0 && i.push(t);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return a.size === t.length ? null : t.filter((e) => !a.has(e)).map((e) => ({ slug: e }));
|
|
198
175
|
}
|
|
199
|
-
function
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
), typeof c.output_tokens != "number" && e.push(
|
|
221
|
-
n(`${o}.output_tokens`, "must be a number", c.output_tokens)
|
|
222
|
-
), l(c.t) || e.push(n(`${o}.t`, "must be a string", c.t));
|
|
223
|
-
const i = c.model_calls;
|
|
224
|
-
i != null && typeof i != "number" && e.push(
|
|
225
|
-
n(
|
|
226
|
-
`${o}.model_calls`,
|
|
227
|
-
"must be a number or null if present",
|
|
228
|
-
i
|
|
229
|
-
)
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
176
|
+
function f(e, t) {
|
|
177
|
+
for (let n of e) {
|
|
178
|
+
if (!c(n)) continue;
|
|
179
|
+
let e = l(n.id) ? n.id : "?", r = n.provider;
|
|
180
|
+
(!l(r) || !o.has(r)) && t.push(u(`dispatch_log[${e}].provider`, "invalid provider", r));
|
|
181
|
+
let i = n.turns;
|
|
182
|
+
if (!Array.isArray(i)) {
|
|
183
|
+
t.push(u(`dispatch_log[${e}].turns`, "must be an array", i));
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
for (let n = 0; n < i.length; n++) {
|
|
187
|
+
let r = i[n], a = `dispatch_log[${e}].turns[${n}]`;
|
|
188
|
+
if (!c(r)) {
|
|
189
|
+
t.push(u(a, "must be an object", r));
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
(typeof r.turn != "number" || !Number.isInteger(r.turn) || r.turn < 1) && t.push(u(`${a}.turn`, "must be a positive integer", r.turn)), typeof r.input_tokens != "number" && t.push(u(`${a}.input_tokens`, "must be a number", r.input_tokens)), typeof r.output_tokens != "number" && t.push(u(`${a}.output_tokens`, "must be a number", r.output_tokens)), l(r.t) || t.push(u(`${a}.t`, "must be a string", r.t));
|
|
193
|
+
let o = r.model_calls;
|
|
194
|
+
o != null && typeof o != "number" && t.push(u(`${a}.model_calls`, "must be a number or null if present", o));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
233
197
|
}
|
|
234
|
-
function
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if (!l(b)) {
|
|
337
|
-
e.push(n("operations[?]", "missing/invalid id", b));
|
|
338
|
-
continue;
|
|
339
|
-
}
|
|
340
|
-
const f = b;
|
|
341
|
-
i.add(f);
|
|
342
|
-
const y = s.milestone;
|
|
343
|
-
l(y) ? d.has(y) || e.push(
|
|
344
|
-
n(`operations[${f}].milestone`, `unknown milestone "${y}"`)
|
|
345
|
-
) : e.push(
|
|
346
|
-
n(`operations[${f}].milestone`, "required string", y)
|
|
347
|
-
);
|
|
348
|
-
const _ = s.type;
|
|
349
|
-
l(_) && !D.has(_) && e.push(n(`operations[${f}].type`, "invalid type", _));
|
|
350
|
-
const v = s.shape;
|
|
351
|
-
if (h(v)) {
|
|
352
|
-
const g = v.kind;
|
|
353
|
-
g != null && l(g) && !E.has(g) && e.push(
|
|
354
|
-
n(`operations[${f}].shape.kind`, "invalid shape kind", g)
|
|
355
|
-
);
|
|
356
|
-
const $ = v.ops;
|
|
357
|
-
if (Array.isArray($) && l(g))
|
|
358
|
-
for (let w = 0; w < $.length; w++) {
|
|
359
|
-
const A = $[w];
|
|
360
|
-
if (!h(A))
|
|
361
|
-
continue;
|
|
362
|
-
const k = A.op;
|
|
363
|
-
l(k) && !j(g, k) && e.push(
|
|
364
|
-
n(
|
|
365
|
-
`operations[${f}].shape.ops[${w}]`,
|
|
366
|
-
`op "${k}" not valid for kind "${g}"`
|
|
367
|
-
)
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
Array.isArray(s.depends_on) || e.push(
|
|
372
|
-
n(
|
|
373
|
-
`operations[${f}].depends_on`,
|
|
374
|
-
"must be an array",
|
|
375
|
-
s.depends_on
|
|
376
|
-
)
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
for (const s of u) {
|
|
380
|
-
if (!h(s))
|
|
381
|
-
continue;
|
|
382
|
-
const b = s.id;
|
|
383
|
-
if (!l(b))
|
|
384
|
-
continue;
|
|
385
|
-
const f = s.depends_on;
|
|
386
|
-
if (Array.isArray(f))
|
|
387
|
-
for (const y of f)
|
|
388
|
-
l(y) && !i.has(y) && e.push(
|
|
389
|
-
n(
|
|
390
|
-
`operations[${b}].depends_on`,
|
|
391
|
-
`unknown operation "${y}"`
|
|
392
|
-
)
|
|
393
|
-
);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
return { valid: e.length === 0, errors: e };
|
|
198
|
+
function p(e) {
|
|
199
|
+
let t = [];
|
|
200
|
+
if (!c(e)) return {
|
|
201
|
+
valid: !1,
|
|
202
|
+
errors: [u("", "root must be an object")]
|
|
203
|
+
};
|
|
204
|
+
for (let n of [
|
|
205
|
+
"description",
|
|
206
|
+
"problem",
|
|
207
|
+
"approach",
|
|
208
|
+
"executor"
|
|
209
|
+
]) {
|
|
210
|
+
let r = e[n];
|
|
211
|
+
(!l(r) || r.trim() === "") && t.push(u(n, "required string field missing/empty", r));
|
|
212
|
+
}
|
|
213
|
+
typeof e.schema_version != "number" && t.push(u("schema_version", "must be a number", e.schema_version));
|
|
214
|
+
let r = e.plan_kind;
|
|
215
|
+
r !== "brownfield" && r !== "greenfield" && t.push(u("plan_kind", "must be \"brownfield\" or \"greenfield\"", r)), Array.isArray(e.phases) ? e.phases.length === 0 && t.push(u("phases", "must have at least one entry")) : t.push(u("phases", "must be an array", e.phases));
|
|
216
|
+
let i = e.terminal;
|
|
217
|
+
!l(i) && !Array.isArray(i) && t.push(u("terminal", "must be a string or array", i)), Array.isArray(e.dispatch_log) ? f(e.dispatch_log, t) : t.push(u("dispatch_log", "must be an array", e.dispatch_log)), c(e.optimization) || t.push(u("optimization", "must be an object", e.optimization)), c(e.providers) || t.push(u("providers", "must be an object", e.providers)), c(e.effort_max_tokens) || t.push(u("effort_max_tokens", "must be an object", e.effort_max_tokens));
|
|
218
|
+
let o = e.milestones;
|
|
219
|
+
if (!c(o)) t.push(u("milestones", "must be an object", o));
|
|
220
|
+
else {
|
|
221
|
+
let r = Object.keys(o);
|
|
222
|
+
r.length === 0 && t.push(u("milestones", "must have at least one entry"));
|
|
223
|
+
let f = new Set(r);
|
|
224
|
+
for (let e of r) {
|
|
225
|
+
let n = o[e];
|
|
226
|
+
if (!c(n)) {
|
|
227
|
+
t.push(u(`milestones.${e}`, "must be an object", n));
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if ((!l(n.description) || n.description.trim() === "") && t.push(u(`milestones.${e}.description`, "required string", n.description)), !Array.isArray(n.depends_on)) t.push(u(`milestones.${e}.depends_on`, "must be an array", n.depends_on));
|
|
231
|
+
else for (let r of n.depends_on) l(r) ? f.has(r) || t.push(u(`milestones.${e}.depends_on`, `unknown milestone "${r}"`)) : t.push(u(`milestones.${e}.depends_on[]`, "must be a string", r));
|
|
232
|
+
let r = n.phase;
|
|
233
|
+
(!l(r) || r.trim() === "") && t.push(u(`milestones.${e}.phase`, "required string", r)), (!l(n.authored_by) || n.authored_by.trim() === "") && t.push(u(`milestones.${e}.authored_by`, "required string", n.authored_by));
|
|
234
|
+
let i = n.model;
|
|
235
|
+
i != null && ![
|
|
236
|
+
"Haiku",
|
|
237
|
+
"Sonnet",
|
|
238
|
+
"Opus"
|
|
239
|
+
].includes(i) && t.push(u(`milestones.${e}.model`, "invalid model tier", i));
|
|
240
|
+
let a = n.effort;
|
|
241
|
+
a != null && ![
|
|
242
|
+
"low",
|
|
243
|
+
"medium",
|
|
244
|
+
"high",
|
|
245
|
+
"xhigh",
|
|
246
|
+
"max"
|
|
247
|
+
].includes(a) && t.push(u(`milestones.${e}.effort`, "invalid effort tier", a)), n.two_stage !== void 0 && typeof n.two_stage != "boolean" && t.push(u(`milestones.${e}.two_stage`, "must be a boolean", n.two_stage)), Array.isArray(n.read_only) || t.push(u(`milestones.${e}.read_only`, "must be an array", n.read_only));
|
|
248
|
+
}
|
|
249
|
+
let p = d(o);
|
|
250
|
+
if (p) for (let { slug: e } of p) t.push(u(`milestones.${e}`, "dependency cycle detected"));
|
|
251
|
+
if (l(i) && !f.has(i)) t.push(u("terminal", `unknown milestone "${i}"`));
|
|
252
|
+
else if (Array.isArray(i)) for (let e of i) f.has(e) || t.push(u("terminal[]", `unknown milestone "${e}"`));
|
|
253
|
+
let m = e.operations, h = /* @__PURE__ */ new Set();
|
|
254
|
+
if (!Array.isArray(m) && !c(m)) t.push(u("operations", "must be an array or object", m));
|
|
255
|
+
else {
|
|
256
|
+
let e = Array.isArray(m) ? m : Object.values(m);
|
|
257
|
+
for (let r of e) {
|
|
258
|
+
if (!c(r)) {
|
|
259
|
+
t.push(u("operations[]", "must be an object", r));
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
let e = r.id;
|
|
263
|
+
if (!l(e)) {
|
|
264
|
+
t.push(u("operations[?]", "missing/invalid id", e));
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
let i = e;
|
|
268
|
+
h.add(i);
|
|
269
|
+
let o = r.milestone;
|
|
270
|
+
l(o) ? f.has(o) || t.push(u(`operations[${i}].milestone`, `unknown milestone "${o}"`)) : t.push(u(`operations[${i}].milestone`, "required string", o));
|
|
271
|
+
let d = r.type;
|
|
272
|
+
l(d) && !a.has(d) && t.push(u(`operations[${i}].type`, "invalid type", d));
|
|
273
|
+
let p = r.shape;
|
|
274
|
+
if (c(p)) {
|
|
275
|
+
let e = p.kind;
|
|
276
|
+
e != null && l(e) && !s.has(e) && t.push(u(`operations[${i}].shape.kind`, "invalid shape kind", e));
|
|
277
|
+
let r = p.ops;
|
|
278
|
+
if (Array.isArray(r) && l(e)) for (let a = 0; a < r.length; a++) {
|
|
279
|
+
let o = r[a];
|
|
280
|
+
if (!c(o)) continue;
|
|
281
|
+
let s = o.op;
|
|
282
|
+
l(s) && !n(e, s) && t.push(u(`operations[${i}].shape.ops[${a}]`, `op "${s}" not valid for kind "${e}"`));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
Array.isArray(r.depends_on) || t.push(u(`operations[${i}].depends_on`, "must be an array", r.depends_on));
|
|
286
|
+
}
|
|
287
|
+
for (let n of e) {
|
|
288
|
+
if (!c(n)) continue;
|
|
289
|
+
let e = n.id;
|
|
290
|
+
if (!l(e)) continue;
|
|
291
|
+
let r = n.depends_on;
|
|
292
|
+
if (Array.isArray(r)) for (let n of r) l(n) && !h.has(n) && t.push(u(`operations[${e}].depends_on`, `unknown operation "${n}"`));
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
valid: t.length === 0,
|
|
298
|
+
errors: t
|
|
299
|
+
};
|
|
398
300
|
}
|
|
399
|
-
function
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
n(
|
|
465
|
-
`operations[${i}].milestone`,
|
|
466
|
-
`unknown milestone "${u}"`
|
|
467
|
-
)
|
|
468
|
-
);
|
|
469
|
-
const s = o.status;
|
|
470
|
-
(!l(s) || !I.has(s)) && e.push(
|
|
471
|
-
n(
|
|
472
|
-
`operations[${i}].status`,
|
|
473
|
-
"invalid operation status",
|
|
474
|
-
s
|
|
475
|
-
)
|
|
476
|
-
), Array.isArray(o.dispatch_ids) || e.push(
|
|
477
|
-
n(
|
|
478
|
-
`operations[${i}].dispatch_ids`,
|
|
479
|
-
"must be an array",
|
|
480
|
-
o.dispatch_ids
|
|
481
|
-
)
|
|
482
|
-
), typeof o.attempt_count != "number" && e.push(
|
|
483
|
-
n(
|
|
484
|
-
`operations[${i}].attempt_count`,
|
|
485
|
-
"must be a number",
|
|
486
|
-
o.attempt_count
|
|
487
|
-
)
|
|
488
|
-
), Array.isArray(o.blast_radius) || e.push(
|
|
489
|
-
n(
|
|
490
|
-
`operations[${i}].blast_radius`,
|
|
491
|
-
"must be an array",
|
|
492
|
-
o.blast_radius
|
|
493
|
-
)
|
|
494
|
-
);
|
|
495
|
-
}
|
|
496
|
-
const d = t.open_questions;
|
|
497
|
-
if (!Array.isArray(d))
|
|
498
|
-
e.push(n("open_questions", "must be an array", d));
|
|
499
|
-
else
|
|
500
|
-
for (const o of d) {
|
|
501
|
-
if (!h(o))
|
|
502
|
-
continue;
|
|
503
|
-
const i = o.blocking;
|
|
504
|
-
(!l(i) || !p.has(i)) && e.push(
|
|
505
|
-
n("open_questions", `unknown blocking milestone "${i}"`)
|
|
506
|
-
), typeof o.surfaced != "boolean" && e.push(
|
|
507
|
-
n(
|
|
508
|
-
`open_questions[${o.id}]`,
|
|
509
|
-
"surfaced must be boolean",
|
|
510
|
-
o.surfaced
|
|
511
|
-
)
|
|
512
|
-
), typeof o.answered != "boolean" && e.push(
|
|
513
|
-
n(
|
|
514
|
-
`open_questions[${o.id}]`,
|
|
515
|
-
"answered must be boolean",
|
|
516
|
-
o.answered
|
|
517
|
-
)
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
const c = t.dispatch_units;
|
|
521
|
-
if (c !== void 0)
|
|
522
|
-
if (!Array.isArray(c))
|
|
523
|
-
e.push(
|
|
524
|
-
n("dispatch_units", "must be an array if present", c)
|
|
525
|
-
);
|
|
526
|
-
else
|
|
527
|
-
for (const o of c) {
|
|
528
|
-
if (!h(o))
|
|
529
|
-
continue;
|
|
530
|
-
const i = o.fits_context_window;
|
|
531
|
-
typeof i != "boolean" && e.push(
|
|
532
|
-
n(
|
|
533
|
-
`dispatch_units[${o.id}]`,
|
|
534
|
-
"fits_context_window must be boolean",
|
|
535
|
-
i
|
|
536
|
-
)
|
|
537
|
-
);
|
|
538
|
-
const u = o.milestones;
|
|
539
|
-
if (Array.isArray(u))
|
|
540
|
-
for (const s of u)
|
|
541
|
-
l(s) && !p.has(s) && e.push(
|
|
542
|
-
n(
|
|
543
|
-
`dispatch_units[${o.id}].milestones`,
|
|
544
|
-
`unknown milestone "${s}"`
|
|
545
|
-
)
|
|
546
|
-
);
|
|
547
|
-
}
|
|
548
|
-
h(t.pairwise_overlap) || e.push(
|
|
549
|
-
n(
|
|
550
|
-
"pairwise_overlap",
|
|
551
|
-
"must be an object",
|
|
552
|
-
t.pairwise_overlap
|
|
553
|
-
)
|
|
554
|
-
);
|
|
555
|
-
}
|
|
556
|
-
return { valid: e.length === 0, errors: e };
|
|
301
|
+
function m(e) {
|
|
302
|
+
let t = [];
|
|
303
|
+
if (!c(e)) return {
|
|
304
|
+
valid: !1,
|
|
305
|
+
errors: [u("", "root must be an object")]
|
|
306
|
+
};
|
|
307
|
+
for (let n of ["snapshot_at", "description"]) l(e[n]) || t.push(u(n, "required string field missing", e[n]));
|
|
308
|
+
l(e.plan) || t.push(u("plan", "required string", e.plan));
|
|
309
|
+
let n = e.milestones;
|
|
310
|
+
if (!c(n)) t.push(u("milestones", "must be an object", n));
|
|
311
|
+
else {
|
|
312
|
+
let a = Object.keys(n), o = new Set(a);
|
|
313
|
+
for (let e of a) {
|
|
314
|
+
let i = n[e];
|
|
315
|
+
if (!c(i)) {
|
|
316
|
+
t.push(u(`milestones.${e}`, "must be an object", i));
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
let a = i.eligible, o = i.pending;
|
|
320
|
+
a === !0 && o != null && t.push(u(`milestones.${e}`, "D-07 violation: eligible=true but pending not null")), typeof a != "boolean" && t.push(u(`milestones.${e}.eligible`, "must be boolean", a));
|
|
321
|
+
let s = i.status;
|
|
322
|
+
(!l(s) || !r.has(s)) && t.push(u(`milestones.${e}.status`, "invalid status", s)), a === !0 && s === "complete" && t.push(u(`milestones.${e}`, "D-07 violation: eligible=true but status is complete"));
|
|
323
|
+
let d = i.wave;
|
|
324
|
+
(typeof d != "number" || !Number.isInteger(d) || d < 0) && t.push(u(`milestones.${e}.wave`, "must be non-negative integer", d));
|
|
325
|
+
let f = i.ki_estimate;
|
|
326
|
+
f != null && typeof f != "number" && t.push(u(`milestones.${e}.ki_estimate`, "must be number|null", f));
|
|
327
|
+
for (let n of ["tokens_estimated", "tokens_actual"]) {
|
|
328
|
+
let r = i[n];
|
|
329
|
+
r != null && typeof r != "number" && t.push(u(`milestones.${e}.${n}`, "must be number|null", r));
|
|
330
|
+
}
|
|
331
|
+
Array.isArray(i.artifacts) || t.push(u(`milestones.${e}.artifacts`, "must be an array", i.artifacts)), typeof i.si_bytes != "number" && t.push(u(`milestones.${e}.si_bytes`, "must be a number", i.si_bytes));
|
|
332
|
+
}
|
|
333
|
+
let s = e.operations;
|
|
334
|
+
if (!Array.isArray(s)) t.push(u("operations", "must be an array", s));
|
|
335
|
+
else for (let e of s) {
|
|
336
|
+
if (!c(e)) continue;
|
|
337
|
+
let n = l(e.id) ? e.id : "?", r = e.milestone;
|
|
338
|
+
l(r) && !o.has(r) && t.push(u(`operations[${n}].milestone`, `unknown milestone "${r}"`));
|
|
339
|
+
let a = e.status;
|
|
340
|
+
(!l(a) || !i.has(a)) && t.push(u(`operations[${n}].status`, "invalid operation status", a)), Array.isArray(e.dispatch_ids) || t.push(u(`operations[${n}].dispatch_ids`, "must be an array", e.dispatch_ids)), typeof e.attempt_count != "number" && t.push(u(`operations[${n}].attempt_count`, "must be a number", e.attempt_count)), Array.isArray(e.blast_radius) || t.push(u(`operations[${n}].blast_radius`, "must be an array", e.blast_radius));
|
|
341
|
+
}
|
|
342
|
+
let d = e.open_questions;
|
|
343
|
+
if (!Array.isArray(d)) t.push(u("open_questions", "must be an array", d));
|
|
344
|
+
else for (let e of d) {
|
|
345
|
+
if (!c(e)) continue;
|
|
346
|
+
let n = e.blocking;
|
|
347
|
+
(!l(n) || !o.has(n)) && t.push(u("open_questions", `unknown blocking milestone "${n}"`)), typeof e.surfaced != "boolean" && t.push(u(`open_questions[${e.id}]`, "surfaced must be boolean", e.surfaced)), typeof e.answered != "boolean" && t.push(u(`open_questions[${e.id}]`, "answered must be boolean", e.answered));
|
|
348
|
+
}
|
|
349
|
+
let f = e.dispatch_units;
|
|
350
|
+
if (f !== void 0) {
|
|
351
|
+
if (!Array.isArray(f)) t.push(u("dispatch_units", "must be an array if present", f));
|
|
352
|
+
else for (let e of f) {
|
|
353
|
+
if (!c(e)) continue;
|
|
354
|
+
let n = e.fits_context_window;
|
|
355
|
+
typeof n != "boolean" && t.push(u(`dispatch_units[${e.id}]`, "fits_context_window must be boolean", n));
|
|
356
|
+
let r = e.milestones;
|
|
357
|
+
if (Array.isArray(r)) for (let n of r) l(n) && !o.has(n) && t.push(u(`dispatch_units[${e.id}].milestones`, `unknown milestone "${n}"`));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
c(e.pairwise_overlap) || t.push(u("pairwise_overlap", "must be an object", e.pairwise_overlap));
|
|
361
|
+
}
|
|
362
|
+
return {
|
|
363
|
+
valid: t.length === 0,
|
|
364
|
+
errors: t
|
|
365
|
+
};
|
|
557
366
|
}
|
|
558
|
-
function
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
throw new Error(
|
|
562
|
-
`DagJson validation failed:
|
|
563
|
-
${e.errors.map((r) => ` ${r.path}: ${r.message}`).join(`
|
|
564
|
-
`)}`
|
|
565
|
-
);
|
|
367
|
+
function h(e) {
|
|
368
|
+
let t = p(e);
|
|
369
|
+
if (!t.valid) throw Error(`DagJson validation failed:\n${t.errors.map((e) => ` ${e.path}: ${e.message}`).join("\n")}`);
|
|
566
370
|
}
|
|
567
|
-
function
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
throw new Error(
|
|
571
|
-
`Snapshot validation failed:
|
|
572
|
-
${e.errors.map((r) => ` ${r.path}: ${r.message}`).join(`
|
|
573
|
-
`)}`
|
|
574
|
-
);
|
|
371
|
+
function g(e) {
|
|
372
|
+
let t = m(e);
|
|
373
|
+
if (!t.valid) throw Error(`Snapshot validation failed:\n${t.errors.map((e) => ` ${e.path}: ${e.message}`).join("\n")}`);
|
|
575
374
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/lib/migrate.ts
|
|
377
|
+
var _ = [{
|
|
378
|
+
from: 2,
|
|
379
|
+
to: 3,
|
|
380
|
+
apply: (e) => {
|
|
381
|
+
!e.milestones && e.nodes && (e.milestones = e.nodes, delete e.nodes);
|
|
382
|
+
let t = e.operations;
|
|
383
|
+
t && typeof t == "object" && !Array.isArray(t) && (e.operations = Object.values(t));
|
|
384
|
+
}
|
|
385
|
+
}, {
|
|
386
|
+
from: 3,
|
|
387
|
+
to: 4,
|
|
388
|
+
apply: (e) => {
|
|
389
|
+
(!e.providers || Object.keys(e.providers).length === 0) && (e.providers = {
|
|
390
|
+
Haiku: {
|
|
391
|
+
type: "claudecli",
|
|
392
|
+
model_id: "claude-haiku-4-5",
|
|
393
|
+
env_secret: null,
|
|
394
|
+
base_url: null,
|
|
395
|
+
timeout_ms: 6e4,
|
|
396
|
+
retry_config: {
|
|
397
|
+
retries: 3,
|
|
398
|
+
min_timeout: 1e3,
|
|
399
|
+
max_timeout: 3e4,
|
|
400
|
+
factor: 2
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
Sonnet: {
|
|
404
|
+
type: "claudecli",
|
|
405
|
+
model_id: "claude-sonnet-4-5",
|
|
406
|
+
env_secret: null,
|
|
407
|
+
base_url: null,
|
|
408
|
+
timeout_ms: 12e4,
|
|
409
|
+
retry_config: {
|
|
410
|
+
retries: 3,
|
|
411
|
+
min_timeout: 1e3,
|
|
412
|
+
max_timeout: 3e4,
|
|
413
|
+
factor: 2
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
Opus: {
|
|
417
|
+
type: "claudecli",
|
|
418
|
+
model_id: "claude-opus-4-5",
|
|
419
|
+
env_secret: null,
|
|
420
|
+
base_url: null,
|
|
421
|
+
timeout_ms: 3e5,
|
|
422
|
+
retry_config: {
|
|
423
|
+
retries: 3,
|
|
424
|
+
min_timeout: 1e3,
|
|
425
|
+
max_timeout: 3e4,
|
|
426
|
+
factor: 2
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}), (!e.effort_max_tokens || Object.keys(e.effort_max_tokens).length === 0) && (e.effort_max_tokens = {
|
|
430
|
+
low: 1024,
|
|
431
|
+
medium: 4096,
|
|
432
|
+
high: 8192,
|
|
433
|
+
xhigh: 16384,
|
|
434
|
+
max: 32768
|
|
435
|
+
}), e.optimization ||= {
|
|
436
|
+
sentinel_fanout: {
|
|
437
|
+
enabled: !0,
|
|
438
|
+
write_multiplier: 1.25,
|
|
439
|
+
read_multiplier: .1,
|
|
440
|
+
hit_probability: .9
|
|
441
|
+
},
|
|
442
|
+
b_per_tier: {
|
|
443
|
+
Haiku: 8e3,
|
|
444
|
+
Sonnet: 15e3,
|
|
445
|
+
Opus: 27e3
|
|
446
|
+
},
|
|
447
|
+
context_window_per_tier: {
|
|
448
|
+
Haiku: 16e3,
|
|
449
|
+
Sonnet: 16e3,
|
|
450
|
+
Opus: 32e3
|
|
451
|
+
},
|
|
452
|
+
context_window_override: null,
|
|
453
|
+
b_override: null
|
|
454
|
+
};
|
|
455
|
+
let t = [];
|
|
456
|
+
Array.isArray(e.operations) ? t = e.operations : e.operations && typeof e.operations == "object" && (t = Object.values(e.operations));
|
|
457
|
+
for (let e of t) if (typeof e == "object" && e) {
|
|
458
|
+
let t = e;
|
|
459
|
+
t.type === void 0 && (t.type = "generative"), t.criteria === void 0 && (t.criteria = []), t.tool === void 0 && (t.tool = null), t.args === void 0 && (t.args = null);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}];
|
|
463
|
+
function v(e, t, n) {
|
|
464
|
+
if (e === t) return;
|
|
465
|
+
let r = e;
|
|
466
|
+
for (let e of [..._].sort((e, t) => e.from - t.from)) if (e.from === r && (e.apply(n), r = e.to, r === t)) {
|
|
467
|
+
n.schema_version = t;
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
throw Error(`migrateDag: no path from v${e} to v${t}. Available: [${_.map((e) => `v${e.from}→v${e.to}`).join(", ")}]`);
|
|
672
471
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
z as WRITE_CLASS_ACTIONS,
|
|
676
|
-
P as assertValidDagJson,
|
|
677
|
-
H as assertValidSnapshot,
|
|
678
|
-
j as isValidOpForKind,
|
|
679
|
-
K as migrateDag,
|
|
680
|
-
L as validateDagJson,
|
|
681
|
-
N as validateSnapshot
|
|
682
|
-
};
|
|
472
|
+
//#endregion
|
|
473
|
+
export { t as VALID_OPS_BY_KIND, e as WRITE_CLASS_ACTIONS, h as assertValidDagJson, g as assertValidSnapshot, n as isValidOpForKind, v as migrateDag, p as validateDagJson, m as validateSnapshot };
|
package/lib/types.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
/** D-03 + D-18 — which executor the orchestrator routes this operation to. */
|
|
11
11
|
export type OperationType = 'automated' | 'tool-call' | 'generative';
|
|
12
|
-
export type OperationAction = 'create' | 'delete' | 'move' | 'rename' | 'modify-signature' | 'modify-body' | 'add-export' | 'remove-export' | 'guard' | 'exec' | 'dag.inject' | 'dag.wait' | 'dag.add-milestone' | 'dag.set-field' | 'dag.clear-pending' | 'dag.append-dispatch-log' | 'fs.move' | 'fs.delete' | 'fs.scaffold';
|
|
12
|
+
export type OperationAction = 'create' | 'delete' | 'move' | 'rename' | 'modify-signature' | 'modify-body' | 'add-export' | 'remove-export' | 'guard' | 'exec' | 'dag.inject' | 'dag.wait' | 'dag.add-milestone' | 'dag.set-field' | 'dag.clear-pending' | 'dag.append-dispatch-log' | 'fs.move' | 'fs.delete' | 'fs.scaffold' | 'fs.edit';
|
|
13
13
|
export declare const WRITE_CLASS_ACTIONS: ReadonlySet<OperationAction>;
|
|
14
14
|
export type CodeKind = 'function' | 'interface' | 'type' | 'class' | 'enum' | 'const' | 'script';
|
|
15
15
|
export type ConfigKind = 'config' | 'env' | 'schema' | 'manifest';
|