@vibgrate/haile 2026.930.1 → 2026.1003.1
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/engine/haile.wasm +0 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +11 -11
- package/package.json +1 -1
package/dist/engine/haile.wasm
CHANGED
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -126,6 +126,34 @@ interface HaileProvider {
|
|
|
126
126
|
* Present only on kernels that export `vg_eval_facts`.
|
|
127
127
|
*/
|
|
128
128
|
evalFacts?(document: unknown): unknown | null;
|
|
129
|
+
/**
|
|
130
|
+
* Diagrams for a review document (`vg review doc`): the primary call path,
|
|
131
|
+
* flows of changed functions, and signature changes, as `vg.review.doc.v1`
|
|
132
|
+
* blocks. Input is the trimmed `vg.review.diagrams-input.v1` payload (head
|
|
133
|
+
* and optional base code map, changed files with hunks, map-root prefix).
|
|
134
|
+
* Returns `{ blocks, contract, notes }`, or `null` when the kernel abstained.
|
|
135
|
+
* The host validates every pin before showing anything. Present only on
|
|
136
|
+
* kernels that export `vg_review_diagrams`.
|
|
137
|
+
*/
|
|
138
|
+
reviewDiagrams?(input: unknown): {
|
|
139
|
+
blocks: unknown[];
|
|
140
|
+
contract: unknown[];
|
|
141
|
+
notes: string[];
|
|
142
|
+
fold?: {
|
|
143
|
+
path: string;
|
|
144
|
+
text: string;
|
|
145
|
+
}[];
|
|
146
|
+
} | null;
|
|
147
|
+
/**
|
|
148
|
+
* Diff groups for `vg review groups` and the review document: every changed
|
|
149
|
+
* file with host facts and git signals in, `{ groups }` in reading order
|
|
150
|
+
* out. The host checks the result is a partition of the change. `null` when
|
|
151
|
+
* the kernel abstained. Present only on kernels that export
|
|
152
|
+
* `vg_review_groups`.
|
|
153
|
+
*/
|
|
154
|
+
reviewGroups?(input: unknown): {
|
|
155
|
+
groups: unknown[];
|
|
156
|
+
} | null;
|
|
129
157
|
}
|
|
130
158
|
/** Wire constants for graph.arch.json. Frozen with the public CLI (engine/haile/types.ts). */
|
|
131
159
|
declare const HAILE_MAGIC = "vg.arch.v1";
|
|
@@ -150,6 +178,10 @@ interface WasmHaileKernel {
|
|
|
150
178
|
* built the document; it crosses as-is. Empty string = the kernel abstained.
|
|
151
179
|
*/
|
|
152
180
|
evalFactsJson?(document: unknown): string;
|
|
181
|
+
/** Review-document diagrams (crate/src/review.rs). Empty string = abstained. */
|
|
182
|
+
reviewDiagramsJson?(input: unknown): string;
|
|
183
|
+
/** Diff groups (crate/src/review_groups.rs). Empty string = abstained. */
|
|
184
|
+
reviewGroupsJson?(input: unknown): string;
|
|
153
185
|
/**
|
|
154
186
|
* Decision Engine bindings (Stage 0, docs/DECISION-ENGINE-WASM-SPEC.md).
|
|
155
187
|
* Structurally separate from every method above — see
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{pathToFileURL as ge}from"node:url";import*as
|
|
2
|
-
`),1;if(!
|
|
3
|
-
`),1;let o=
|
|
4
|
-
`),1;let
|
|
5
|
-
`),1;let
|
|
6
|
-
`),1;let s=
|
|
7
|
-
`),1;let t;try{let
|
|
8
|
-
`),1;t=JSON.parse(
|
|
9
|
-
`),1}let
|
|
10
|
-
`),
|
|
11
|
-
`),1}return 0}var B=["task_complexity","failure_related","repair_action","completion_confidence","finding_attention","architecture_fallback"],
|
|
1
|
+
import{pathToFileURL as ge}from"node:url";import*as h from"node:fs";import*as A from"node:path";var k=["hexagonal-v1","layered-v1","vertical-v1"],I="hexagonal-v1",P="vg.arch.v1",D="vg.arch.taxonomy.v1",E="vg.arch.ir.v1",v="haile-fast/2026.903.5",N="balanced",O=8e3,K=new Set(["function","method","route","test","component","job","class","interface"]);var M=240,V=400,$=16,Y=32,X=new Set(["public","private","protected","internal","static","async","override","virtual","abstract","final","def","fn","function","func","sub","pub","export","const","let","var","new","sealed","extern","unsafe","readonly","partial","default","synchronized","native","inline","constexpr","friend","explicit","operator","suspend","open","lateinit","get","set"]);function F(r){return K.has(r)}function G(r){switch(r){case"method":return"method";case"route":return"route";case"test":return"test";case"job":return"job";case"component":return"handler";case"class":return"type";case"interface":return"interface";default:return"function"}}function z(r,e=""){let o=e?r.indexOf(`${e}(`):-1;if(o<0&&(r.startsWith("@")||r.startsWith("[")))return[];let n=o>=0?o+e.length:r.indexOf("("),a=r.lastIndexOf(")");if(n<0||a<=n)return[];let i=r.slice(n+1,a).trim();return!i||i==="void"?[]:i.split(",").map(s=>s.trim()).filter(Boolean).slice(0,16).map(s=>{let l=s.replace(/\b(const|mut|ref|public|private|protected|readonly|final)\b/g,"").trim();if(l.includes(":")){let[c,d]=l.split(":").map(f=>f.trim());return{name:c||"arg",type_name:d||void 0}}let t=l.split(/\s+/);return t.length>=2?{name:t[t.length-1],type_name:t[0]}:{name:l}})}function Q(r,e){let o=r.lastIndexOf("->");if(o>=0)return r.slice(o+2).replace(/[{;].*$/,"").trim()||void 0;let n=r.lastIndexOf(":"),a=r.lastIndexOf(")");if(n>a&&a>=0)return r.slice(n+1).replace(/[{;].*$/,"").replace(/\s*=>.*$/,"").trim()||void 0;let i=e?r.indexOf(`${e}(`):-1;if(i>0){let s=r.slice(0,i).trim(),l=0,t=0;for(let d=s.length-1;d>=0;d--){let f=s[d];if(f===">"||f==="]"||f===")")l++;else if(f==="<"||f==="["||f==="(")l--;else if(/\s/.test(f)&&l===0){t=d+1;break}}let c=s.slice(t).trim();if(c&&!c.startsWith("@")&&!c.startsWith("[")&&!X.has(c)&&c!=="void"&&!c.endsWith(")")&&!c.endsWith("]"))return c}}function Z(r,e,o,n){let a=[],i=[],s=new Set,l=new Set;for(let t of e){if(t.src!==r||t.kind!=="call"&&t.kind!=="references")continue;let c=o.get(t.dst);if(!c)continue;let d=c.qualifiedName||c.name;if(!(!d||s.has(d))&&(s.add(d),a.push(d),c.file&&c.file!==n&&!l.has(c.file)&&i.length<$&&(l.add(c.file),i.push(c.file)),a.length>=24))break}return{calls:a,calleePaths:i}}function ee(r,e,o){let n=new Map;for(let i of r)(i.kind==="file"||i.kind==="module")&&n.set(i.id,i.file);let a=new Map;for(let i of e){if(i.kind!=="import")continue;let s=n.get(i.src);if(!s)continue;let l=o.get(i.dst),t=l?.qualifiedName||l?.name;if(!t)continue;let c=a.get(s);c||(c=[],a.set(s,c)),c.length<Y&&!c.includes(t)&&c.push(t)}return a}function S(r){let e=r.nodes??[],o=r.edges??[],n=new Map;for(let s of e)n.set(s.id,s);let a=ee(e,o,n),i=[];for(let s of e){if(!F(s.kind))continue;let l=typeof s.decorators=="string"?s.decorators.trim():"",t=`${l?`${l} `:""}${s.signature??""}`.slice(0,V),{calls:c,calleePaths:d}=Z(s.id,o,n,s.file),f=typeof s.doc=="string"?s.doc.trim().slice(0,M):"";i.push({node_id:s.id,file_path:s.file,name:s.name,qualified_name:s.qualifiedName||s.name,symbol_kind:G(s.kind),language:s.lang??"",signature:t,calls:c,parameters:z(t,s.name),return_type:Q(t,s.name),...f?{doc:f}:{},callee_paths:d,imports:a.get(s.file)??[],...s.effects&&typeof s.effects=="object"?{effects:s.effects}:{},...Array.isArray(s.duties)?{duties:s.duties.slice(0,48)}:{}})}return i.sort((s,l)=>s.node_id<l.node_id?-1:s.node_id>l.node_id?1:0),i}import*as T from"node:fs";import*as m from"node:path";import{fileURLToPath as se}from"node:url";import*as x from"node:fs";import{fileURLToPath as ne}from"node:url";var g;function re(){return[new URL("./engine/haile.wasm",import.meta.url),new URL("../engine/haile.wasm",import.meta.url),new URL("../crate/target/wasm32-unknown-unknown/release/vibgrate_haile_kernel.wasm",import.meta.url)].map(r=>ne(r))}function ie(r){try{let e=new WebAssembly.Module(r),n=new WebAssembly.Instance(e,{}).exports;if(typeof n.vg_alloc!="function"||typeof n.vg_free!="function"||typeof n.vg_version!="function"||typeof n.vg_classify!="function"||!n.memory)return null;let a=t=>{let c=new TextEncoder().encode(t),d=n.vg_alloc(c.length);return new Uint8Array(n.memory.buffer,d,c.length).set(c),{ptr:d,len:c.length}},i=t=>{if(!t)return"";let c=new DataView(n.memory.buffer,t,4).getUint32(0,!0),d=new TextDecoder().decode(new Uint8Array(n.memory.buffer,t+4,c));return n.vg_free(t,4+c),d},s=(t,c)=>{let{ptr:d,len:f}=a(c);try{return i(t(d,f))}finally{n.vg_free(d,f)}},l={version:()=>{try{return i(n.vg_version())||v}catch{return v}},classifyJson:t=>{let c=JSON.stringify({name:t.name??"",path:t.path??"",symbolKind:t.symbolKind??"function",fileKind:t.fileKind??"source",calls:t.calls??[],types:t.types??[],idents:t.idents??[],profile:t.profile??"balanced",policy:t.policy??"hexagonal-v1",qualifiedName:t.qualifiedName??"",doc:t.doc??"",signature:t.signature??"",params:t.params??[],returnType:t.returnType??"",calleePaths:t.calleePaths??[],imports:t.imports??[],astRole:t.astRole??"",effects:t.effects??{},duties:t.duties??[]});return s(n.vg_classify,c)}};if(typeof n.vg_overview=="function"&&(l.overviewJson=(t,c)=>s(n.vg_overview,JSON.stringify({graph:t,sidecar:c??null}))),typeof n.vg_slice=="function"&&(l.sliceJson=(t,c,d)=>s(n.vg_slice,JSON.stringify({graph:t,sidecar:c??null,spec:d??{}}))),typeof n.vg_arch_page=="function"&&(l.archPage=t=>s(n.vg_arch_page,JSON.stringify({host:t.host??"browser",nonce:t.nonce??"",theme:t.theme??""}))),typeof n.vg_eval_facts=="function"&&(l.evalFactsJson=t=>s(n.vg_eval_facts,JSON.stringify(t))),typeof n.vg_review_diagrams=="function"&&(l.reviewDiagramsJson=t=>s(n.vg_review_diagrams,JSON.stringify(t))),typeof n.vg_review_groups=="function"&&(l.reviewGroupsJson=t=>s(n.vg_review_groups,JSON.stringify(t))),typeof n.vg_decision_version=="function"&&typeof n.vg_decide=="function"&&typeof n.vg_decide_batch=="function"&&typeof n.vg_decision_catalog=="function"){let t=n.vg_decide,c=n.vg_decide_batch,d=n.vg_decision_catalog,f=n.vg_decision_version;l.decision={version:()=>f(),decideJson:y=>s(t,y),decideBatchJson:y=>s(c,y),catalogJson:()=>i(d())}}return l}catch{return null}}function _(){if(g!==void 0)return g;g=null;try{let r=re().find(e=>x.existsSync(e));return r&&(g=ie(x.readFileSync(r))),g}catch{return g=null,g}}function te(){g=void 0}function C(r){return Array.isArray(r)?r.filter(e=>typeof e=="string"):[]}function w(r){if(!r)return null;try{return JSON.parse(r)}catch{return null}}function oe(r){if(!r)return null;try{let e=JSON.parse(r);if(!e||typeof e!="object")return null;let o=e.role&&typeof e.role=="object"?e.role:e,n=typeof o.primary=="string"?o.primary:"";if(!n)return null;let a=e.intent&&typeof e.intent=="object"?e.intent:{};return{primary:n,confidence:typeof o.confidence=="number"?o.confidence:0,band:typeof o.band=="string"?o.band:"abstain",alternatives:Array.isArray(o.alternatives)?o.alternatives.filter(i=>typeof i?.role=="string").map(i=>({role:i.role,confidence:typeof i.confidence=="number"?i.confidence:0})):[],purposes:Array.isArray(e.purposes)?e.purposes.filter(i=>typeof i?.purpose=="string").map(i=>({purpose:i.purpose,confidence:typeof i.confidence=="number"?i.confidence:0})):[],intent:{text:typeof a.text=="string"?a.text:"",verbs:C(a.verbs),objects:C(a.objects)},findings:Array.isArray(e.findings)?e.findings.filter(i=>typeof i?.rule=="string"&&typeof i?.message=="string").map(i=>({rule:i.rule,severity:typeof i.severity=="string"?i.severity:"warn",message:i.message,...typeof i.line=="number"&&Number.isFinite(i.line)&&i.line>0?{line:Math.floor(i.line)}:{}})).slice(0,8):[],evidence:Array.isArray(e.evidence)?e.evidence.filter(i=>typeof i?.kind=="string"&&typeof i?.signal=="string").map(i=>({kind:i.kind,signal:i.signal,weight:typeof i.weight=="number"?i.weight:0})):[]}}catch{return null}}function L(r){let e=r===void 0?_():r;if(!e)return null;let o={version:()=>e.version(),classify:n=>{try{return oe(e.classifyJson(n))}catch{return null}}};return e.overviewJson&&(o.projectOverview=(n,a)=>{try{return w(e.overviewJson(n,a))}catch{return null}}),e.sliceJson&&(o.projectSlice=(n,a,i)=>{try{return w(e.sliceJson(n,a,i))}catch{return null}}),e.archPage&&(o.renderArchPage=n=>{try{let a=e.archPage({host:n.host,theme:n.theme,nonce:n.nonce});return typeof a=="string"?a:""}catch{return""}}),e.evalFactsJson&&(o.evalFacts=n=>{try{return w(e.evalFactsJson(n))}catch{return null}}),e.reviewDiagramsJson&&(o.reviewDiagrams=n=>{try{let a=w(e.reviewDiagramsJson(n));return!a||!Array.isArray(a.blocks)?null:{blocks:a.blocks,contract:Array.isArray(a.contract)?a.contract:[],notes:C(a.notes),fold:Array.isArray(a.fold)?a.fold.filter(i=>!!i&&typeof i.path=="string"&&typeof i.text=="string"):[]}}catch{return null}}),e.reviewGroupsJson&&(o.reviewGroups=n=>{try{let a=w(e.reviewGroupsJson(n));return a&&Array.isArray(a.groups)?{groups:a.groups}:null}catch{return null}}),o.archUiAssets=()=>{try{let n=m.dirname(se(import.meta.url)),a=[m.join(n,"arch-ui"),m.join(n,"..","dist","arch-ui"),m.join(n,"..","arch-ui")];for(let i of a)if(T.existsSync(m.join(i,"map.js")))return i;return null}catch{return null}},o}var ae=new Set(["strict","balanced","exploratory"]),ce=new Set(k);function R(r,e){let o=r.indexOf(e);if(!(o<0||o+1>=r.length))return r[o+1]}function le(){return new Promise((r,e)=>{let o=[];process.stdin.on("data",n=>o.push(Buffer.from(n))),process.stdin.on("end",()=>r(Buffer.concat(o).toString("utf8"))),process.stdin.on("error",e)})}async function J(r=process.argv.slice(2),e={}){if(r[0]!=="sidecar")return process.stderr.write(`usage: node index.js sidecar --stdin --out <file> --profile <strict|balanced|exploratory> [--policy <hexagonal-v1|layered-v1|vertical-v1>]
|
|
2
|
+
`),1;if(!r.includes("--stdin"))return process.stderr.write(`sidecar requires --stdin
|
|
3
|
+
`),1;let o=R(r,"--out");if(!o)return process.stderr.write(`sidecar requires --out <file>
|
|
4
|
+
`),1;let n=R(r,"--profile")??N;if(!ae.has(n))return process.stderr.write(`invalid --profile ${n}
|
|
5
|
+
`),1;let a=n,i=R(r,"--policy")??I;if(!ce.has(i))return process.stderr.write(`invalid --policy ${i} (one of ${k.join(", ")})
|
|
6
|
+
`),1;let s=i,l=e.provider===void 0?L():e.provider;if(!l)return process.stderr.write(`architecture kernel wasm missing \u2014 refusing to classify
|
|
7
|
+
`),1;let t;try{let u=(await(e.readInput??le)()).trim();if(!u)return process.stderr.write(`sidecar stdin was empty
|
|
8
|
+
`),1;t=JSON.parse(u)}catch{return process.stderr.write(`sidecar stdin was not valid JSON
|
|
9
|
+
`),1}let c=S({nodes:Array.isArray(t.nodes)?t.nodes:[],edges:Array.isArray(t.edges)?t.edges:[]}),d=l.version()||v,f=[],y=!1;for(let u of c){if(f.length>=8e3){y=!0;break}let p=l.classify({name:u.name,path:u.file_path,symbolKind:u.symbol_kind,fileKind:"source",calls:u.calls,types:[...u.parameters.map(b=>b.type_name).filter(b=>!!b),...u.return_type?[u.return_type]:[]],idents:[u.name,...u.calls].slice(0,24),profile:a,policy:s,qualifiedName:u.qualified_name,doc:u.doc??"",signature:u.signature,params:u.parameters.map(b=>b.name),returnType:u.return_type??"",calleePaths:u.callee_paths,imports:u.imports,...u.ast_role?{astRole:u.ast_role}:{},...u.effects?{effects:u.effects}:{},...u.duties?{duties:u.duties}:{}});p&&f.push({node_id:u.node_id,file_path:u.file_path,name:u.name,qualified_name:u.qualified_name,symbol_kind:u.symbol_kind,role:{primary:p.primary,alternatives:p.alternatives,confidence:p.confidence,band:p.band},purposes:p.purposes,intent:p.intent,evidence:p.evidence,...p.findings.length?{findings:p.findings}:{}})}let U={magic:P,taxonomy:D,ir:E,corpus_hash:t.provenance?.corpusHash??"",engine_version:d,profile:a,policy:s,symbols:f,...y?{symbols_capped:!0}:{}};try{h.mkdirSync(A.dirname(A.resolve(o)),{recursive:!0});let u=`${o}.${process.pid}.tmp`;h.writeFileSync(u,`${JSON.stringify(U)}
|
|
10
|
+
`),h.renameSync(u,o)}catch{return process.stderr.write(`sidecar failed to write ${o}
|
|
11
|
+
`),1}return 0}var B=["task_complexity","failure_related","repair_action","completion_confidence","finding_attention","architecture_fallback"],ue="vg-decision-wasm@0.1.0",de=1,H={schema:"vg.decision.catalog.v1",decisions:[...B]};function j(r){return typeof r=="string"&&B.includes(r)}function fe(r){return r==="high"||r==="medium"||r==="low"||r==="abstain"}function q(r,e){return Array.isArray(r)?r.filter(o=>typeof o=="string").slice(0,e):[]}function W(r){if(!r)return null;try{let e=JSON.parse(r);if(!e||typeof e!="object"||e.schema!=="vg.decision.result.v1"||e.source!=="decision"||!j(e.decision)||e.primitive!=="binary"&&e.primitive!=="choice"&&e.primitive!=="score"||typeof e.engineVersion!="string"||typeof e.packVersion!="string"||typeof e.confidence!="number"||!Number.isFinite(e.confidence)||!fe(e.band)||typeof e.abstain!="boolean"||typeof e.calibrationId!="string")return null;let o={schema:"vg.decision.result.v1",engineVersion:e.engineVersion,packVersion:e.packVersion,decision:e.decision,primitive:e.primitive,confidence:e.confidence,band:e.band,abstain:e.abstain,reasonCodes:q(e.reasonCodes,16),evidenceRefs:q(e.evidenceRefs,32),calibrationId:e.calibrationId,source:"decision"};return typeof e.selected=="string"&&(o.selected=e.selected),Array.isArray(e.probabilities)&&(o.probabilities=e.probabilities.filter(n=>typeof n?.id=="string"&&typeof n?.probability=="number"&&Number.isFinite(n.probability)).slice(0,32).map(n=>({id:n.id,probability:n.probability}))),typeof e.score=="number"&&Number.isFinite(e.score)&&(o.score=e.score),o}catch{return null}}function pe(r){try{let e=JSON.parse(r);if(!e||e.schema!=="vg.decision.catalog.v1"||!Array.isArray(e.decisions))return H;let o=e.decisions.filter(j);return o.length>0?{schema:"vg.decision.catalog.v1",decisions:o}:H}catch{return H}}function Ne(r){let e=r===void 0?_():r;if(!e||!e.decision)return null;let o=e.decision,n;try{n=o.version()}catch{return null}return n!==de?null:{version:()=>ue,decide:a=>{try{return W(o.decideJson(JSON.stringify(a)))}catch{return null}},decideBatch:a=>{try{let i=JSON.parse(o.decideBatchJson(JSON.stringify(a)));return Array.isArray(i)?i.map(s=>W(typeof s=="string"?s:JSON.stringify(s))).filter(s=>s!==null):[]}catch{return[]}},catalog:()=>{try{return pe(o.catalogJson())}catch{return H}}}}function me(){let r=process.argv[1];if(!r)return!1;try{return import.meta.url===ge(r).href}catch{return!1}}me()&&J().then(r=>{process.exit(r)});export{B as DECISIONS,ue as DECISION_ENGINE_VERSION,de as DECISION_ENGINE_VERSION_CODE,I as DEFAULT_POLICY,N as DEFAULT_PROFILE,O as DEFAULT_SYMBOL_CAP,v as HAILE_ENGINE_VERSION,E as HAILE_IR,P as HAILE_MAGIC,D as HAILE_TAXONOMY,k as POLICIES,S as adaptGraph,Ne as createDecisionProvider,L as createHaileProvider,F as isCallableKind,_ as loadWasmHaileKernel,te as resetWasmHaileKernelCache,J as runSidecarCli,G as symbolKindOf};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibgrate/haile",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.1003.1",
|
|
4
4
|
"description": "Vibgrate HAILE architecture kernel: deterministic callable classification (role, purposes, intent, band) over a vg-graph. Proprietary distribution — compiled WASM engine plus a minified loader; the taxonomy is not included.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|