@vibgrate/haile 2026.911.2 → 2026.916.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/arch-ui/map.js +48 -14
- package/dist/engine/haile.wasm +0 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +8 -8
- package/package.json +5 -3
package/dist/engine/haile.wasm
CHANGED
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -116,6 +116,16 @@ interface HaileProvider {
|
|
|
116
116
|
assetBase?: string;
|
|
117
117
|
}): string;
|
|
118
118
|
archUiAssets?(): string | null;
|
|
119
|
+
/**
|
|
120
|
+
* Evaluate the security packs a `vg.facts.v1` document requests and return
|
|
121
|
+
* the `vg.security.v1` result (findings with content-addressed ids and a
|
|
122
|
+
* taxonomy stamp). Contract: `docs/facts.md` in this package — input
|
|
123
|
+
* schema, rejection rules, output shape, id construction, the rules of
|
|
124
|
+
* `iac-cis-v1`. `null` when the kernel abstained (malformed document,
|
|
125
|
+
* wrong `schema`, unknown top-level key) or the result did not parse.
|
|
126
|
+
* Present only on kernels that export `vg_eval_facts`.
|
|
127
|
+
*/
|
|
128
|
+
evalFacts?(document: unknown): unknown | null;
|
|
119
129
|
}
|
|
120
130
|
/** Wire constants for graph.arch.json. Frozen with the public CLI (engine/haile/types.ts). */
|
|
121
131
|
declare const HAILE_MAGIC = "vg.arch.v1";
|
|
@@ -135,6 +145,11 @@ interface WasmHaileKernel {
|
|
|
135
145
|
theme?: string;
|
|
136
146
|
nonce?: string;
|
|
137
147
|
}): string;
|
|
148
|
+
/**
|
|
149
|
+
* Security packs over a `vg.facts.v1` document (docs/facts.md). The host
|
|
150
|
+
* built the document; it crosses as-is. Empty string = the kernel abstained.
|
|
151
|
+
*/
|
|
152
|
+
evalFactsJson?(document: unknown): string;
|
|
138
153
|
}
|
|
139
154
|
/** Load the wasm engine if the artifact exists; null otherwise. Memoized. */
|
|
140
155
|
declare function loadWasmHaileKernel(): WasmHaileKernel | null;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{pathToFileURL as se}from"node:url";import*as h from"node:fs";import*as w from"node:path";var b=["hexagonal-v1","layered-v1","vertical-v1"],H="hexagonal-v1",x="vg.arch.v1",A="vg.arch.taxonomy.v1",P="vg.arch.ir.v1",y="haile-fast/2026.903.5",
|
|
2
|
-
`),1;if(!
|
|
3
|
-
`),1;let a=
|
|
4
|
-
`),1;let
|
|
5
|
-
`),1;let l=
|
|
6
|
-
`),1;let s=e,f=i.provider===void 0?
|
|
1
|
+
import{pathToFileURL as se}from"node:url";import*as h from"node:fs";import*as w from"node:path";var b=["hexagonal-v1","layered-v1","vertical-v1"],H="hexagonal-v1",x="vg.arch.v1",A="vg.arch.taxonomy.v1",P="vg.arch.ir.v1",y="haile-fast/2026.903.5",k="balanced",I=8e3,K=new Set(["function","method","route","test","component","job","class","interface"]);var U=240,W=400,D=16,M=32,q=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 T(t){return K.has(t)}function F(t){switch(t){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 $(t,i=""){let a=i?t.indexOf(`${i}(`):-1;if(a<0&&(t.startsWith("@")||t.startsWith("[")))return[];let r=a>=0?a+i.length:t.indexOf("("),l=t.lastIndexOf(")");if(r<0||l<=r)return[];let e=t.slice(r+1,l).trim();return!e||e==="void"?[]:e.split(",").map(s=>s.trim()).filter(Boolean).slice(0,16).map(s=>{let f=s.replace(/\b(const|mut|ref|public|private|protected|readonly|final)\b/g,"").trim();if(f.includes(":")){let[o,d]=f.split(":").map(u=>u.trim());return{name:o||"arg",type_name:d||void 0}}let n=f.split(/\s+/);return n.length>=2?{name:n[n.length-1],type_name:n[0]}:{name:f}})}function B(t,i){let a=t.lastIndexOf("->");if(a>=0)return t.slice(a+2).replace(/[{;].*$/,"").trim()||void 0;let r=t.lastIndexOf(":"),l=t.lastIndexOf(")");if(r>l&&l>=0)return t.slice(r+1).replace(/[{;].*$/,"").replace(/\s*=>.*$/,"").trim()||void 0;let e=i?t.indexOf(`${i}(`):-1;if(e>0){let s=t.slice(0,e).trim(),f=0,n=0;for(let d=s.length-1;d>=0;d--){let u=s[d];if(u===">"||u==="]"||u===")")f++;else if(u==="<"||u==="["||u==="(")f--;else if(/\s/.test(u)&&f===0){n=d+1;break}}let o=s.slice(n).trim();if(o&&!o.startsWith("@")&&!o.startsWith("[")&&!q.has(o)&&o!=="void"&&!o.endsWith(")")&&!o.endsWith("]"))return o}}function Y(t,i,a,r){let l=[],e=[],s=new Set,f=new Set;for(let n of i){if(n.src!==t||n.kind!=="call"&&n.kind!=="references")continue;let o=a.get(n.dst);if(!o)continue;let d=o.qualifiedName||o.name;if(!(!d||s.has(d))&&(s.add(d),l.push(d),o.file&&o.file!==r&&!f.has(o.file)&&e.length<D&&(f.add(o.file),e.push(o.file)),l.length>=24))break}return{calls:l,calleePaths:e}}function V(t,i,a){let r=new Map;for(let e of t)(e.kind==="file"||e.kind==="module")&&r.set(e.id,e.file);let l=new Map;for(let e of i){if(e.kind!=="import")continue;let s=r.get(e.src);if(!s)continue;let f=a.get(e.dst),n=f?.qualifiedName||f?.name;if(!n)continue;let o=l.get(s);o||(o=[],l.set(s,o)),o.length<M&&!o.includes(n)&&o.push(n)}return l}function L(t){let i=t.nodes??[],a=t.edges??[],r=new Map;for(let s of i)r.set(s.id,s);let l=V(i,a,r),e=[];for(let s of i){if(!T(s.kind))continue;let f=typeof s.decorators=="string"?s.decorators.trim():"",n=`${f?`${f} `:""}${s.signature??""}`.slice(0,W),{calls:o,calleePaths:d}=Y(s.id,a,r,s.file),u=typeof s.doc=="string"?s.doc.trim().slice(0,U):"";e.push({node_id:s.id,file_path:s.file,name:s.name,qualified_name:s.qualifiedName||s.name,symbol_kind:F(s.kind),language:s.lang??"",signature:n,calls:o,parameters:$(n,s.name),return_type:B(n,s.name),...u?{doc:u}:{},callee_paths:d,imports:l.get(s.file)??[],...s.effects&&typeof s.effects=="object"?{effects:s.effects}:{},...Array.isArray(s.duties)?{duties:s.duties.slice(0,48)}:{}})}return e.sort((s,f)=>s.node_id<f.node_id?-1:s.node_id>f.node_id?1:0),e}import*as j from"node:fs";import*as m from"node:path";import{fileURLToPath as ee}from"node:url";import*as _ from"node:fs";import{fileURLToPath as X}from"node:url";var g;function z(){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(t=>X(t))}function Q(t){try{let i=new WebAssembly.Module(t),r=new WebAssembly.Instance(i,{}).exports;if(typeof r.vg_alloc!="function"||typeof r.vg_free!="function"||typeof r.vg_version!="function"||typeof r.vg_classify!="function"||!r.memory)return null;let l=n=>{let o=new TextEncoder().encode(n),d=r.vg_alloc(o.length);return new Uint8Array(r.memory.buffer,d,o.length).set(o),{ptr:d,len:o.length}},e=n=>{if(!n)return"";let o=new DataView(r.memory.buffer,n,4).getUint32(0,!0),d=new TextDecoder().decode(new Uint8Array(r.memory.buffer,n+4,o));return r.vg_free(n,4+o),d},s=(n,o)=>{let{ptr:d,len:u}=l(o);try{return e(n(d,u))}finally{r.vg_free(d,u)}},f={version:()=>{try{return e(r.vg_version())||y}catch{return y}},classifyJson:n=>{let o=JSON.stringify({name:n.name??"",path:n.path??"",symbolKind:n.symbolKind??"function",fileKind:n.fileKind??"source",calls:n.calls??[],types:n.types??[],idents:n.idents??[],profile:n.profile??"balanced",policy:n.policy??"hexagonal-v1",qualifiedName:n.qualifiedName??"",doc:n.doc??"",signature:n.signature??"",params:n.params??[],returnType:n.returnType??"",calleePaths:n.calleePaths??[],imports:n.imports??[],astRole:n.astRole??"",effects:n.effects??{},duties:n.duties??[]});return s(r.vg_classify,o)}};return typeof r.vg_overview=="function"&&(f.overviewJson=(n,o)=>s(r.vg_overview,JSON.stringify({graph:n,sidecar:o??null}))),typeof r.vg_slice=="function"&&(f.sliceJson=(n,o,d)=>s(r.vg_slice,JSON.stringify({graph:n,sidecar:o??null,spec:d??{}}))),typeof r.vg_arch_page=="function"&&(f.archPage=n=>s(r.vg_arch_page,JSON.stringify({host:n.host??"browser",nonce:n.nonce??"",theme:n.theme??""}))),typeof r.vg_eval_facts=="function"&&(f.evalFactsJson=n=>s(r.vg_eval_facts,JSON.stringify(n))),f}catch{return null}}function E(){if(g!==void 0)return g;g=null;try{let t=z().find(i=>_.existsSync(i));return t&&(g=Q(_.readFileSync(t))),g}catch{return g=null,g}}function Z(){g=void 0}function J(t){return Array.isArray(t)?t.filter(i=>typeof i=="string"):[]}function S(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function ne(t){if(!t)return null;try{let i=JSON.parse(t);if(!i||typeof i!="object")return null;let a=i.role&&typeof i.role=="object"?i.role:i,r=typeof a.primary=="string"?a.primary:"";if(!r)return null;let l=i.intent&&typeof i.intent=="object"?i.intent:{};return{primary:r,confidence:typeof a.confidence=="number"?a.confidence:0,band:typeof a.band=="string"?a.band:"abstain",alternatives:Array.isArray(a.alternatives)?a.alternatives.filter(e=>typeof e?.role=="string").map(e=>({role:e.role,confidence:typeof e.confidence=="number"?e.confidence:0})):[],purposes:Array.isArray(i.purposes)?i.purposes.filter(e=>typeof e?.purpose=="string").map(e=>({purpose:e.purpose,confidence:typeof e.confidence=="number"?e.confidence:0})):[],intent:{text:typeof l.text=="string"?l.text:"",verbs:J(l.verbs),objects:J(l.objects)},findings:Array.isArray(i.findings)?i.findings.filter(e=>typeof e?.rule=="string"&&typeof e?.message=="string").map(e=>({rule:e.rule,severity:typeof e.severity=="string"?e.severity:"warn",message:e.message,...typeof e.line=="number"&&Number.isFinite(e.line)&&e.line>0?{line:Math.floor(e.line)}:{}})).slice(0,8):[],evidence:Array.isArray(i.evidence)?i.evidence.filter(e=>typeof e?.kind=="string"&&typeof e?.signal=="string").map(e=>({kind:e.kind,signal:e.signal,weight:typeof e.weight=="number"?e.weight:0})):[]}}catch{return null}}function O(t){let i=t===void 0?E():t;if(!i)return null;let a={version:()=>i.version(),classify:r=>{try{return ne(i.classifyJson(r))}catch{return null}}};return i.overviewJson&&(a.projectOverview=(r,l)=>{try{return S(i.overviewJson(r,l))}catch{return null}}),i.sliceJson&&(a.projectSlice=(r,l,e)=>{try{return S(i.sliceJson(r,l,e))}catch{return null}}),i.archPage&&(a.renderArchPage=r=>{try{let l=i.archPage({host:r.host,theme:r.theme,nonce:r.nonce});return typeof l=="string"?l:""}catch{return""}}),i.evalFactsJson&&(a.evalFacts=r=>{try{return S(i.evalFactsJson(r))}catch{return null}}),a.archUiAssets=()=>{try{let r=m.dirname(ee(import.meta.url)),l=[m.join(r,"arch-ui"),m.join(r,"..","dist","arch-ui"),m.join(r,"..","arch-ui")];for(let e of l)if(j.existsSync(m.join(e,"map.js")))return e;return null}catch{return null}},a}var re=new Set(["strict","balanced","exploratory"]),te=new Set(b);function N(t,i){let a=t.indexOf(i);if(!(a<0||a+1>=t.length))return t[a+1]}function ie(){return new Promise((t,i)=>{let a=[];process.stdin.on("data",r=>a.push(Buffer.from(r))),process.stdin.on("end",()=>t(Buffer.concat(a).toString("utf8"))),process.stdin.on("error",i)})}async function C(t=process.argv.slice(2),i={}){if(t[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(!t.includes("--stdin"))return process.stderr.write(`sidecar requires --stdin
|
|
3
|
+
`),1;let a=N(t,"--out");if(!a)return process.stderr.write(`sidecar requires --out <file>
|
|
4
|
+
`),1;let r=N(t,"--profile")??k;if(!re.has(r))return process.stderr.write(`invalid --profile ${r}
|
|
5
|
+
`),1;let l=r,e=N(t,"--policy")??H;if(!te.has(e))return process.stderr.write(`invalid --policy ${e} (one of ${b.join(", ")})
|
|
6
|
+
`),1;let s=e,f=i.provider===void 0?O():i.provider;if(!f)return process.stderr.write(`architecture kernel wasm missing \u2014 refusing to classify
|
|
7
7
|
`),1;let n;try{let c=(await(i.readInput??ie)()).trim();if(!c)return process.stderr.write(`sidecar stdin was empty
|
|
8
8
|
`),1;n=JSON.parse(c)}catch{return process.stderr.write(`sidecar stdin was not valid JSON
|
|
9
|
-
`),1}let o=L({nodes:Array.isArray(n.nodes)?n.nodes:[],edges:Array.isArray(n.edges)?n.edges:[]}),d=f.version()||y,u=[],
|
|
9
|
+
`),1}let o=L({nodes:Array.isArray(n.nodes)?n.nodes:[],edges:Array.isArray(n.edges)?n.edges:[]}),d=f.version()||y,u=[],R=!1;for(let c of o){if(u.length>=8e3){R=!0;break}let p=f.classify({name:c.name,path:c.file_path,symbolKind:c.symbol_kind,fileKind:"source",calls:c.calls,types:[...c.parameters.map(v=>v.type_name).filter(v=>!!v),...c.return_type?[c.return_type]:[]],idents:[c.name,...c.calls].slice(0,24),profile:l,policy:s,qualifiedName:c.qualified_name,doc:c.doc??"",signature:c.signature,params:c.parameters.map(v=>v.name),returnType:c.return_type??"",calleePaths:c.callee_paths,imports:c.imports,...c.ast_role?{astRole:c.ast_role}:{},...c.effects?{effects:c.effects}:{},...c.duties?{duties:c.duties}:{}});p&&u.push({node_id:c.node_id,file_path:c.file_path,name:c.name,qualified_name:c.qualified_name,symbol_kind:c.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 G={magic:x,taxonomy:A,ir:P,corpus_hash:n.provenance?.corpusHash??"",engine_version:d,profile:l,policy:s,symbols:u,...R?{symbols_capped:!0}:{}};try{h.mkdirSync(w.dirname(w.resolve(a)),{recursive:!0});let c=`${a}.${process.pid}.tmp`;h.writeFileSync(c,`${JSON.stringify(G)}
|
|
10
10
|
`),h.renameSync(c,a)}catch{return process.stderr.write(`sidecar failed to write ${a}
|
|
11
|
-
`),1}return 0}function oe(){let
|
|
11
|
+
`),1}return 0}function oe(){let t=process.argv[1];if(!t)return!1;try{return import.meta.url===se(t).href}catch{return!1}}oe()&&C().then(t=>{process.exit(t)});export{H as DEFAULT_POLICY,k as DEFAULT_PROFILE,I as DEFAULT_SYMBOL_CAP,y as HAILE_ENGINE_VERSION,P as HAILE_IR,x as HAILE_MAGIC,A as HAILE_TAXONOMY,b as POLICIES,L as adaptGraph,O as createHaileProvider,T as isCallableKind,E as loadWasmHaileKernel,Z as resetWasmHaileKernelCache,C as runSidecarCli,F as symbolKindOf};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibgrate/haile",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.916.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",
|
|
@@ -20,16 +20,18 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "node build.mjs",
|
|
22
22
|
"typecheck": "tsc --noEmit -p ./",
|
|
23
|
-
"test": "vitest run"
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"gen:logos": "node scripts/gen-logos.mjs"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
|
-
"@types/node": "^26.
|
|
27
|
+
"@types/node": "^26.5.1",
|
|
27
28
|
"@types/react": "^18.3.0",
|
|
28
29
|
"@types/react-dom": "^18.3.0",
|
|
29
30
|
"@xyflow/react": "^12.11.6",
|
|
30
31
|
"esbuild": "^0.28.2",
|
|
31
32
|
"react": "^19.3.0",
|
|
32
33
|
"react-dom": "^19.3.0",
|
|
34
|
+
"simple-icons": "^16.31.0",
|
|
33
35
|
"tsup": "^8.0.0",
|
|
34
36
|
"typescript": "^5.4.0",
|
|
35
37
|
"vitest": "^5.0.0"
|