@vibgrate/haile 2026.902.2 → 2026.903.2
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 -1
- package/dist/engine/haile.wasm +0 -0
- package/dist/index.d.ts +37 -1
- package/dist/index.js +9 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ import { createHaileProvider } from "@vibgrate/haile";
|
|
|
24
24
|
const kernel = createHaileProvider();
|
|
25
25
|
// null when dist/engine/haile.wasm is missing — never a dummy provider.
|
|
26
26
|
kernel?.version();
|
|
27
|
-
// "haile-fast/0.
|
|
27
|
+
// "haile-fast/0.3.0" (or the version string the wasm exports)
|
|
28
28
|
kernel?.classify({
|
|
29
29
|
name: "CreateUser",
|
|
30
30
|
path: "src/controllers/UsersController.cs",
|
package/dist/engine/haile.wasm
CHANGED
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,34 @@ interface HaileClassifyInput {
|
|
|
5
5
|
path: string;
|
|
6
6
|
symbolKind?: string;
|
|
7
7
|
fileKind?: string;
|
|
8
|
+
/** Callee names; qualified (`ProductRepository.save`) when the graph knows them. */
|
|
8
9
|
calls?: readonly string[];
|
|
10
|
+
/** Parameter types (a thin host may append the return type last). */
|
|
9
11
|
types?: readonly string[];
|
|
10
12
|
idents?: readonly string[];
|
|
11
13
|
profile?: HaileProfile;
|
|
14
|
+
/** `Class.method` — the enclosing class names the role and the domain noun. */
|
|
15
|
+
qualifiedName?: string;
|
|
16
|
+
/** Leading doc-comment / docstring summary, as extracted by vg. */
|
|
17
|
+
doc?: string;
|
|
18
|
+
/** Raw signature incl. decorators / annotations / attributes. */
|
|
19
|
+
signature?: string;
|
|
20
|
+
/** Parameter names, in order. */
|
|
21
|
+
params?: readonly string[];
|
|
22
|
+
/** Return type as written. */
|
|
23
|
+
returnType?: string;
|
|
24
|
+
/** File paths of resolved callees (layer cues for the caller's purposes). */
|
|
25
|
+
calleePaths?: readonly string[];
|
|
26
|
+
/** Module specifiers imported by the callable's file. */
|
|
27
|
+
imports?: readonly string[];
|
|
28
|
+
/** Catalog AST role for the file, if the host has one. */
|
|
29
|
+
astRole?: string;
|
|
30
|
+
/**
|
|
31
|
+
* What the body executes (vg-graph `node.effects`): bounded counts such as
|
|
32
|
+
* `sqlWrite`, `http`, `respond`, `render`, `calls`, `branches`, plus
|
|
33
|
+
* `apis`. The kernel scores purposes from these ahead of names.
|
|
34
|
+
*/
|
|
35
|
+
effects?: Readonly<Record<string, number | readonly string[]>>;
|
|
12
36
|
}
|
|
13
37
|
interface HaileClassification {
|
|
14
38
|
primary: string;
|
|
@@ -41,7 +65,7 @@ interface HaileProvider {
|
|
|
41
65
|
declare const HAILE_MAGIC = "vg.haile.v1";
|
|
42
66
|
declare const HAILE_TAXONOMY = "haile.taxonomy.v1";
|
|
43
67
|
declare const HAILE_IR = "haile.ir.v1";
|
|
44
|
-
declare const HAILE_ENGINE_VERSION = "haile-fast/0.
|
|
68
|
+
declare const HAILE_ENGINE_VERSION = "haile-fast/0.3.0";
|
|
45
69
|
declare const DEFAULT_PROFILE: HaileProfile;
|
|
46
70
|
declare const DEFAULT_SYMBOL_CAP = 8000;
|
|
47
71
|
|
|
@@ -77,6 +101,10 @@ interface GraphNodeLike {
|
|
|
77
101
|
file: string;
|
|
78
102
|
lang?: string;
|
|
79
103
|
signature?: string;
|
|
104
|
+
/** Short leading doc-comment / docstring summary (vg-graph ≥ 1.1). */
|
|
105
|
+
doc?: string;
|
|
106
|
+
/** Body effect profile (vg-graph ≥ 1.1, additive). */
|
|
107
|
+
effects?: Record<string, number | string[]>;
|
|
80
108
|
}
|
|
81
109
|
interface GraphEdgeLike {
|
|
82
110
|
kind: string;
|
|
@@ -99,6 +127,14 @@ interface HaileCallable {
|
|
|
99
127
|
return_type?: string;
|
|
100
128
|
file_layer?: string;
|
|
101
129
|
ast_role?: string;
|
|
130
|
+
/** Leading doc summary, capped. */
|
|
131
|
+
doc?: string;
|
|
132
|
+
/** Distinct file paths of resolved callees, in edge order. */
|
|
133
|
+
callee_paths: string[];
|
|
134
|
+
/** Module specifiers the callable's file imports, in edge order. */
|
|
135
|
+
imports: string[];
|
|
136
|
+
/** Body effect profile, passed through untouched. */
|
|
137
|
+
effects?: Record<string, number | string[]>;
|
|
102
138
|
}
|
|
103
139
|
declare function isCallableKind(kind: string): boolean;
|
|
104
140
|
declare function symbolKindOf(kind: string): string;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{pathToFileURL as
|
|
1
|
+
import{pathToFileURL as X}from"node:url";import*as y from"node:fs";import*as b from"node:path";var v="vg.haile.v1",w="haile.taxonomy.v1",H="haile.ir.v1",g="haile-fast/0.3.0",x="balanced",A=8e3,k=new Set(["function","method","route","test","component","job"]);var R=240,K=400,T=16,G=32,W=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 N(n){return k.has(n)}function C(n){switch(n){case"method":return"method";case"route":return"route";case"test":return"test";case"job":return"job";case"component":return"handler";default:return"function"}}function M(n,t=""){let i=t?n.indexOf(`${t}(`):-1;if(i<0&&(n.startsWith("@")||n.startsWith("[")))return[];let s=i>=0?i+t.length:n.indexOf("("),f=n.lastIndexOf(")");if(s<0||f<=s)return[];let r=n.slice(s+1,f).trim();return!r||r==="void"?[]:r.split(",").map(e=>e.trim()).filter(Boolean).slice(0,16).map(e=>{let o=e.replace(/\b(const|mut|ref|public|private|protected|readonly|final)\b/g,"").trim();if(o.includes(":")){let[a,d]=o.split(":").map(p=>p.trim());return{name:a||"arg",type_name:d||void 0}}let c=o.split(/\s+/);return c.length>=2?{name:c[c.length-1],type_name:c[0]}:{name:o}})}function U(n,t){let i=n.lastIndexOf("->");if(i>=0)return n.slice(i+2).replace(/[{;].*$/,"").trim()||void 0;let s=n.lastIndexOf(":"),f=n.lastIndexOf(")");if(s>f&&f>=0)return n.slice(s+1).replace(/[{;].*$/,"").replace(/\s*=>.*$/,"").trim()||void 0;let r=t?n.indexOf(`${t}(`):-1;if(r>0){let e=n.slice(0,r).trim(),o=0,c=0;for(let d=e.length-1;d>=0;d--){let p=e[d];if(p===">"||p==="]"||p===")")o++;else if(p==="<"||p==="["||p==="(")o--;else if(/\s/.test(p)&&o===0){c=d+1;break}}let a=e.slice(c).trim();if(a&&!a.startsWith("@")&&!a.startsWith("[")&&!W.has(a)&&a!=="void"&&!a.endsWith(")")&&!a.endsWith("]"))return a}}function q(n,t,i,s){let f=[],r=[],e=new Set,o=new Set;for(let c of t){if(c.src!==n||c.kind!=="call"&&c.kind!=="references")continue;let a=i.get(c.dst);if(!a)continue;let d=a.qualifiedName||a.name;if(!(!d||e.has(d))&&(e.add(d),f.push(d),a.file&&a.file!==s&&!o.has(a.file)&&r.length<T&&(o.add(a.file),r.push(a.file)),f.length>=24))break}return{calls:f,calleePaths:r}}function D(n,t,i){let s=new Map;for(let r of n)(r.kind==="file"||r.kind==="module")&&s.set(r.id,r.file);let f=new Map;for(let r of t){if(r.kind!=="import")continue;let e=s.get(r.src);if(!e)continue;let o=i.get(r.dst),c=o?.qualifiedName||o?.name;if(!c)continue;let a=f.get(e);a||(a=[],f.set(e,a)),a.length<G&&!a.includes(c)&&a.push(c)}return f}function I(n){let t=n.nodes??[],i=n.edges??[],s=new Map;for(let e of t)s.set(e.id,e);let f=D(t,i,s),r=[];for(let e of t){if(!N(e.kind))continue;let o=(e.signature??"").slice(0,K),{calls:c,calleePaths:a}=q(e.id,i,s,e.file),d=typeof e.doc=="string"?e.doc.trim().slice(0,R):"";r.push({node_id:e.id,file_path:e.file,name:e.name,qualified_name:e.qualifiedName||e.name,symbol_kind:C(e.kind),language:e.lang??"",signature:o,calls:c,parameters:M(o,e.name),return_type:U(o,e.name),...d?{doc:d}:{},callee_paths:a,imports:f.get(e.file)??[],...e.effects&&typeof e.effects=="object"?{effects:e.effects}:{}})}return r.sort((e,o)=>e.node_id<o.node_id?-1:e.node_id>o.node_id?1:0),r}import*as _ from"node:fs";import{fileURLToPath as F}from"node:url";var u;function j(){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(n=>F(n))}function B(n){try{let t=new WebAssembly.Module(n),s=new WebAssembly.Instance(t,{}).exports;if(typeof s.vg_alloc!="function"||typeof s.vg_free!="function"||typeof s.vg_version!="function"||typeof s.vg_classify!="function"||!s.memory)return null;let f=e=>{let o=new TextEncoder().encode(e),c=s.vg_alloc(o.length);return new Uint8Array(s.memory.buffer,c,o.length).set(o),{ptr:c,len:o.length}},r=e=>{if(!e)return"";let o=new DataView(s.memory.buffer,e,4).getUint32(0,!0),c=new TextDecoder().decode(new Uint8Array(s.memory.buffer,e+4,o));return s.vg_free(e,4+o),c};return{version:()=>{try{return r(s.vg_version())||g}catch{return g}},classifyJson:e=>{let o=JSON.stringify({name:e.name??"",path:e.path??"",symbolKind:e.symbolKind??"function",fileKind:e.fileKind??"source",calls:e.calls??[],types:e.types??[],idents:e.idents??[],profile:e.profile??"balanced",qualifiedName:e.qualifiedName??"",doc:e.doc??"",signature:e.signature??"",params:e.params??[],returnType:e.returnType??"",calleePaths:e.calleePaths??[],imports:e.imports??[],astRole:e.astRole??"",effects:e.effects??{}}),{ptr:c,len:a}=f(o);try{return r(s.vg_classify(c,a))}finally{s.vg_free(c,a)}}}}catch{return null}}function E(){if(u!==void 0)return u;u=null;try{let n=j().find(t=>_.existsSync(t));return n&&(u=B(_.readFileSync(n))),u}catch{return u=null,u}}function $(){u=void 0}function S(n){return Array.isArray(n)?n.filter(t=>typeof t=="string"):[]}function J(n){if(!n)return null;try{let t=JSON.parse(n);if(!t||typeof t!="object")return null;let i=t.role&&typeof t.role=="object"?t.role:t,s=typeof i.primary=="string"?i.primary:"";if(!s)return null;let f=t.intent&&typeof t.intent=="object"?t.intent:{};return{primary:s,confidence:typeof i.confidence=="number"?i.confidence:0,band:typeof i.band=="string"?i.band:"abstain",alternatives:Array.isArray(i.alternatives)?i.alternatives.filter(r=>typeof r?.role=="string").map(r=>({role:r.role,confidence:typeof r.confidence=="number"?r.confidence:0})):[],purposes:Array.isArray(t.purposes)?t.purposes.filter(r=>typeof r?.purpose=="string").map(r=>({purpose:r.purpose,confidence:typeof r.confidence=="number"?r.confidence:0})):[],intent:{text:typeof f.text=="string"?f.text:"",verbs:S(f.verbs),objects:S(f.objects)},evidence:Array.isArray(t.evidence)?t.evidence.filter(r=>typeof r?.kind=="string"&&typeof r?.signal=="string").map(r=>({kind:r.kind,signal:r.signal,weight:typeof r.weight=="number"?r.weight:0})):[]}}catch{return null}}function L(n){let t=n===void 0?E():n;return t?{version:()=>t.version(),classify:i=>{try{return J(t.classifyJson(i))}catch{return null}}}:null}var V=new Set(["strict","balanced","exploratory"]);function O(n,t){let i=n.indexOf(t);if(!(i<0||i+1>=n.length))return n[i+1]}function Y(){return new Promise((n,t)=>{let i=[];process.stdin.on("data",s=>i.push(Buffer.from(s))),process.stdin.on("end",()=>n(Buffer.concat(i).toString("utf8"))),process.stdin.on("error",t)})}async function P(n=process.argv.slice(2),t={}){if(n[0]!=="sidecar")return process.stderr.write(`usage: node index.js sidecar --stdin --out <file> --profile <strict|balanced|exploratory>
|
|
2
2
|
`),1;if(!n.includes("--stdin"))return process.stderr.write(`sidecar requires --stdin
|
|
3
|
-
`),1;let
|
|
4
|
-
`),1;let
|
|
5
|
-
`),1;let
|
|
6
|
-
`),1;let
|
|
7
|
-
`),1;
|
|
8
|
-
`),1}let
|
|
9
|
-
`),
|
|
10
|
-
`),1}return 0}function
|
|
3
|
+
`),1;let i=O(n,"--out");if(!i)return process.stderr.write(`sidecar requires --out <file>
|
|
4
|
+
`),1;let s=O(n,"--profile")??x;if(!V.has(s))return process.stderr.write(`invalid --profile ${s}
|
|
5
|
+
`),1;let f=s,r=t.provider===void 0?L():t.provider;if(!r)return process.stderr.write(`architecture kernel wasm missing \u2014 refusing to classify
|
|
6
|
+
`),1;let e;try{let l=(await(t.readInput??Y)()).trim();if(!l)return process.stderr.write(`sidecar stdin was empty
|
|
7
|
+
`),1;e=JSON.parse(l)}catch{return process.stderr.write(`sidecar stdin was not valid JSON
|
|
8
|
+
`),1}let o=I({nodes:Array.isArray(e.nodes)?e.nodes:[],edges:Array.isArray(e.edges)?e.edges:[]}),c=r.version()||g,a=[],d=!1;for(let l of o){if(a.length>=8e3){d=!0;break}let m=r.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:f,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}:{}});m&&a.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:m.primary,alternatives:m.alternatives,confidence:m.confidence,band:m.band},purposes:m.purposes,intent:m.intent,evidence:m.evidence})}let p={magic:v,taxonomy:w,ir:H,corpus_hash:e.provenance?.corpusHash??"",engine_version:c,profile:f,symbols:a,...d?{symbols_capped:!0}:{}};try{y.mkdirSync(b.dirname(b.resolve(i)),{recursive:!0});let l=`${i}.${process.pid}.tmp`;y.writeFileSync(l,`${JSON.stringify(p)}
|
|
9
|
+
`),y.renameSync(l,i)}catch{return process.stderr.write(`sidecar failed to write ${i}
|
|
10
|
+
`),1}return 0}function z(){let n=process.argv[1];if(!n)return!1;try{return import.meta.url===X(n).href}catch{return!1}}z()&&P().then(n=>{process.exit(n)});export{x as DEFAULT_PROFILE,A as DEFAULT_SYMBOL_CAP,g as HAILE_ENGINE_VERSION,H as HAILE_IR,v as HAILE_MAGIC,w as HAILE_TAXONOMY,I as adaptGraph,L as createHaileProvider,N as isCallableKind,E as loadWasmHaileKernel,$ as resetWasmHaileKernelCache,P as runSidecarCli,C as symbolKindOf};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibgrate/haile",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.903.2",
|
|
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",
|