@vibgrate/haile 2026.910.1 → 2026.910.3
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/README.md +1 -0
- package/dist/engine/haile.wasm +0 -0
- package/dist/index.d.ts +25 -1
- package/dist/index.js +10 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ kernel?.classify({
|
|
|
32
32
|
profile: "balanced",
|
|
33
33
|
});
|
|
34
34
|
// { primary, confidence, band, alternatives, purposes, intent, evidence }
|
|
35
|
+
// Overview, slice, and the map page are kernel WASM exports (not TypeScript).
|
|
35
36
|
```
|
|
36
37
|
|
|
37
38
|
The host CLI auto-provisions this module (silently, on every run; declinable)
|
package/dist/engine/haile.wasm
CHANGED
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -97,6 +97,22 @@ interface HaileClassification {
|
|
|
97
97
|
interface HaileProvider {
|
|
98
98
|
version(): string;
|
|
99
99
|
classify(input: HaileClassifyInput): HaileClassification | null;
|
|
100
|
+
projectOverview?(graph: unknown, sidecar: unknown): unknown;
|
|
101
|
+
projectSlice?(graph: unknown, sidecar: unknown, spec: {
|
|
102
|
+
packageId: string;
|
|
103
|
+
view: "job" | "calls" | "missing" | "problems";
|
|
104
|
+
focus?: string;
|
|
105
|
+
cap?: number;
|
|
106
|
+
architecture?: boolean;
|
|
107
|
+
tests?: boolean;
|
|
108
|
+
}): unknown;
|
|
109
|
+
renderArchPage?(opts: {
|
|
110
|
+
host: "browser" | "vscode";
|
|
111
|
+
theme?: "dark" | "light" | "hc";
|
|
112
|
+
nonce?: string;
|
|
113
|
+
assetBase?: string;
|
|
114
|
+
}): string;
|
|
115
|
+
archUiAssets?(): string | null;
|
|
100
116
|
}
|
|
101
117
|
/** Wire constants for graph.arch.json. Frozen with the public CLI (engine/haile/types.ts). */
|
|
102
118
|
declare const HAILE_MAGIC = "vg.arch.v1";
|
|
@@ -109,6 +125,13 @@ declare const DEFAULT_SYMBOL_CAP = 8000;
|
|
|
109
125
|
interface WasmHaileKernel {
|
|
110
126
|
version(): string;
|
|
111
127
|
classifyJson(input: HaileClassifyInput): string;
|
|
128
|
+
overviewJson?(graph: unknown, sidecar: unknown): string;
|
|
129
|
+
sliceJson?(graph: unknown, sidecar: unknown, spec: unknown): string;
|
|
130
|
+
archPage?(opts: {
|
|
131
|
+
host: "browser" | "vscode";
|
|
132
|
+
theme?: string;
|
|
133
|
+
nonce?: string;
|
|
134
|
+
}): string;
|
|
112
135
|
}
|
|
113
136
|
/** Load the wasm engine if the artifact exists; null otherwise. Memoized. */
|
|
114
137
|
declare function loadWasmHaileKernel(): WasmHaileKernel | null;
|
|
@@ -119,7 +142,8 @@ declare function resetWasmHaileKernelCache(): void;
|
|
|
119
142
|
* Factory consumed by the public CLI seam (loadHaileProvider).
|
|
120
143
|
*
|
|
121
144
|
* Returns null when the wasm engine is missing — never a dummy provider,
|
|
122
|
-
* never a TypeScript lexicon.
|
|
145
|
+
* never a TypeScript lexicon. Overview, slice, and the map page are kernel
|
|
146
|
+
* exports; this file only parses JSON at the trust boundary.
|
|
123
147
|
*/
|
|
124
148
|
|
|
125
149
|
declare function createHaileProvider(kernel?: WasmHaileKernel | null): HaileProvider | null;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{pathToFileURL as
|
|
1
|
+
import{pathToFileURL as re}from"node:url";import*as y from"node:fs";import*as _ from"node:path";var v=["hexagonal-v1","layered-v1"],w="hexagonal-v1",H="vg.arch.v1",x="vg.arch.taxonomy.v1",A="vg.arch.ir.v1",m="haile-fast/2026.903.5",P="balanced",I=8e3,C=new Set(["function","method","route","test","component","job"]);var W=240,F=400,D=16,M=32,U=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 R(r){return C.has(r)}function K(r){switch(r){case"method":return"method";case"route":return"route";case"test":return"test";case"job":return"job";case"component":return"handler";default:return"function"}}function j(r,t=""){let a=t?r.indexOf(`${t}(`):-1;if(a<0&&(r.startsWith("@")||r.startsWith("[")))return[];let i=a>=0?a+t.length:r.indexOf("("),c=r.lastIndexOf(")");if(i<0||c<=i)return[];let e=r.slice(i+1,c).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 q(r,t){let a=r.lastIndexOf("->");if(a>=0)return r.slice(a+2).replace(/[{;].*$/,"").trim()||void 0;let i=r.lastIndexOf(":"),c=r.lastIndexOf(")");if(i>c&&c>=0)return r.slice(i+1).replace(/[{;].*$/,"").replace(/\s*=>.*$/,"").trim()||void 0;let e=t?r.indexOf(`${t}(`):-1;if(e>0){let s=r.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("[")&&!U.has(o)&&o!=="void"&&!o.endsWith(")")&&!o.endsWith("]"))return o}}function $(r,t,a,i){let c=[],e=[],s=new Set,f=new Set;for(let n of t){if(n.src!==r||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),c.push(d),o.file&&o.file!==i&&!f.has(o.file)&&e.length<D&&(f.add(o.file),e.push(o.file)),c.length>=24))break}return{calls:c,calleePaths:e}}function B(r,t,a){let i=new Map;for(let e of r)(e.kind==="file"||e.kind==="module")&&i.set(e.id,e.file);let c=new Map;for(let e of t){if(e.kind!=="import")continue;let s=i.get(e.src);if(!s)continue;let f=a.get(e.dst),n=f?.qualifiedName||f?.name;if(!n)continue;let o=c.get(s);o||(o=[],c.set(s,o)),o.length<M&&!o.includes(n)&&o.push(n)}return c}function k(r){let t=r.nodes??[],a=r.edges??[],i=new Map;for(let s of t)i.set(s.id,s);let c=B(t,a,i),e=[];for(let s of t){if(!R(s.kind))continue;let f=typeof s.decorators=="string"?s.decorators.trim():"",n=`${f?`${f} `:""}${s.signature??""}`.slice(0,F),{calls:o,calleePaths:d}=$(s.id,a,i,s.file),u=typeof s.doc=="string"?s.doc.trim().slice(0,W):"";e.push({node_id:s.id,file_path:s.file,name:s.name,qualified_name:s.qualifiedName||s.name,symbol_kind:K(s.kind),language:s.lang??"",signature:n,calls:o,parameters:j(n,s.name),return_type:q(n,s.name),...u?{doc:u}:{},callee_paths:d,imports:c.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 b from"node:fs";import{fileURLToPath as Y}from"node:url";var g;function V(){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=>Y(r))}function X(r){try{let t=new WebAssembly.Module(r),i=new WebAssembly.Instance(t,{}).exports;if(typeof i.vg_alloc!="function"||typeof i.vg_free!="function"||typeof i.vg_version!="function"||typeof i.vg_classify!="function"||!i.memory)return null;let c=n=>{let o=new TextEncoder().encode(n),d=i.vg_alloc(o.length);return new Uint8Array(i.memory.buffer,d,o.length).set(o),{ptr:d,len:o.length}},e=n=>{if(!n)return"";let o=new DataView(i.memory.buffer,n,4).getUint32(0,!0),d=new TextDecoder().decode(new Uint8Array(i.memory.buffer,n+4,o));return i.vg_free(n,4+o),d},s=(n,o)=>{let{ptr:d,len:u}=c(o);try{return e(n(d,u))}finally{i.vg_free(d,u)}},f={version:()=>{try{return e(i.vg_version())||m}catch{return m}},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(i.vg_classify,o)}};return typeof i.vg_overview=="function"&&(f.overviewJson=(n,o)=>s(i.vg_overview,JSON.stringify({graph:n,sidecar:o??null}))),typeof i.vg_slice=="function"&&(f.sliceJson=(n,o,d)=>s(i.vg_slice,JSON.stringify({graph:n,sidecar:o??null,spec:d??{}}))),typeof i.vg_arch_page=="function"&&(f.archPage=n=>s(i.vg_arch_page,JSON.stringify({host:n.host??"browser",nonce:n.nonce??"",theme:n.theme??""}))),f}catch{return null}}function L(){if(g!==void 0)return g;g=null;try{let r=V().find(t=>b.existsSync(t));return r&&(g=X(b.readFileSync(r))),g}catch{return g=null,g}}function z(){g=void 0}function T(r){return Array.isArray(r)?r.filter(t=>typeof t=="string"):[]}function G(r){if(!r)return null;try{return JSON.parse(r)}catch{return null}}function Q(r){if(!r)return null;try{let t=JSON.parse(r);if(!t||typeof t!="object")return null;let a=t.role&&typeof t.role=="object"?t.role:t,i=typeof a.primary=="string"?a.primary:"";if(!i)return null;let c=t.intent&&typeof t.intent=="object"?t.intent:{};return{primary:i,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(t.purposes)?t.purposes.filter(e=>typeof e?.purpose=="string").map(e=>({purpose:e.purpose,confidence:typeof e.confidence=="number"?e.confidence:0})):[],intent:{text:typeof c.text=="string"?c.text:"",verbs:T(c.verbs),objects:T(c.objects)},findings:Array.isArray(t.findings)?t.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(t.evidence)?t.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 E(r){let t=r===void 0?L():r;if(!t)return null;let a={version:()=>t.version(),classify:i=>{try{return Q(t.classifyJson(i))}catch{return null}}};return t.overviewJson&&(a.projectOverview=(i,c)=>{try{return G(t.overviewJson(i,c))}catch{return null}}),t.sliceJson&&(a.projectSlice=(i,c,e)=>{try{return G(t.sliceJson(i,c,e))}catch{return null}}),t.archPage&&(a.renderArchPage=i=>{try{let c=t.archPage({host:i.host,theme:i.theme,nonce:i.nonce});return typeof c=="string"?c:""}catch{return""}}),a}var Z=new Set(["strict","balanced","exploratory"]),ee=new Set(v);function S(r,t){let a=r.indexOf(t);if(!(a<0||a+1>=r.length))return r[a+1]}function ne(){return new Promise((r,t)=>{let a=[];process.stdin.on("data",i=>a.push(Buffer.from(i))),process.stdin.on("end",()=>r(Buffer.concat(a).toString("utf8"))),process.stdin.on("error",t)})}async function O(r=process.argv.slice(2),t={}){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>]
|
|
2
2
|
`),1;if(!r.includes("--stdin"))return process.stderr.write(`sidecar requires --stdin
|
|
3
|
-
`),1;let
|
|
4
|
-
`),1;let
|
|
5
|
-
`),1;let
|
|
6
|
-
`),1;let e
|
|
7
|
-
`),1;let
|
|
8
|
-
`),1;
|
|
9
|
-
`),1}let
|
|
10
|
-
`),y.renameSync(
|
|
11
|
-
`),1}return 0}function
|
|
3
|
+
`),1;let a=S(r,"--out");if(!a)return process.stderr.write(`sidecar requires --out <file>
|
|
4
|
+
`),1;let i=S(r,"--profile")??P;if(!Z.has(i))return process.stderr.write(`invalid --profile ${i}
|
|
5
|
+
`),1;let c=i,e=S(r,"--policy")??w;if(!ee.has(e))return process.stderr.write(`invalid --policy ${e} (one of ${v.join(", ")})
|
|
6
|
+
`),1;let s=e,f=t.provider===void 0?E():t.provider;if(!f)return process.stderr.write(`architecture kernel wasm missing \u2014 refusing to classify
|
|
7
|
+
`),1;let n;try{let l=(await(t.readInput??ne)()).trim();if(!l)return process.stderr.write(`sidecar stdin was empty
|
|
8
|
+
`),1;n=JSON.parse(l)}catch{return process.stderr.write(`sidecar stdin was not valid JSON
|
|
9
|
+
`),1}let o=k({nodes:Array.isArray(n.nodes)?n.nodes:[],edges:Array.isArray(n.edges)?n.edges:[]}),d=f.version()||m,u=[],N=!1;for(let l of o){if(u.length>=8e3){N=!0;break}let p=f.classify({name:l.name,path:l.file_path,symbolKind:l.symbol_kind,fileKind:"source",calls:l.calls,types:[...l.parameters.map(h=>h.type_name).filter(h=>!!h),...l.return_type?[l.return_type]:[]],idents:[l.name,...l.calls].slice(0,24),profile:c,policy:s,qualifiedName:l.qualified_name,doc:l.doc??"",signature:l.signature,params:l.parameters.map(h=>h.name),returnType:l.return_type??"",calleePaths:l.callee_paths,imports:l.imports,...l.ast_role?{astRole:l.ast_role}:{},...l.effects?{effects:l.effects}:{},...l.duties?{duties:l.duties}:{}});p&&u.push({node_id:l.node_id,file_path:l.file_path,name:l.name,qualified_name:l.qualified_name,symbol_kind:l.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 J={magic:H,taxonomy:x,ir:A,corpus_hash:n.provenance?.corpusHash??"",engine_version:d,profile:c,policy:s,symbols:u,...N?{symbols_capped:!0}:{}};try{y.mkdirSync(_.dirname(_.resolve(a)),{recursive:!0});let l=`${a}.${process.pid}.tmp`;y.writeFileSync(l,`${JSON.stringify(J)}
|
|
10
|
+
`),y.renameSync(l,a)}catch{return process.stderr.write(`sidecar failed to write ${a}
|
|
11
|
+
`),1}return 0}function te(){let r=process.argv[1];if(!r)return!1;try{return import.meta.url===re(r).href}catch{return!1}}te()&&O().then(r=>{process.exit(r)});export{w as DEFAULT_POLICY,P as DEFAULT_PROFILE,I as DEFAULT_SYMBOL_CAP,m as HAILE_ENGINE_VERSION,A as HAILE_IR,H as HAILE_MAGIC,x as HAILE_TAXONOMY,v as POLICIES,k as adaptGraph,E as createHaileProvider,R as isCallableKind,L as loadWasmHaileKernel,z as resetWasmHaileKernelCache,O as runSidecarCli,K as symbolKindOf};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibgrate/haile",
|
|
3
|
-
"version": "2026.910.
|
|
3
|
+
"version": "2026.910.3",
|
|
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",
|