@vibgrate/haile 2026.903.2 → 2026.903.4
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 +46 -3
- package/dist/index.js +11 -10
- 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/
|
|
27
|
+
// "haile-fast/2026.903.3" (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
|
@@ -11,6 +11,8 @@ interface HaileClassifyInput {
|
|
|
11
11
|
types?: readonly string[];
|
|
12
12
|
idents?: readonly string[];
|
|
13
13
|
profile?: HaileProfile;
|
|
14
|
+
/** Boundary policy pack for the findings (kernel ≥ 2026.903.4; older kernels ignore it). */
|
|
15
|
+
policy?: HailePolicy;
|
|
14
16
|
/** `Class.method` — the enclosing class names the role and the domain noun. */
|
|
15
17
|
qualifiedName?: string;
|
|
16
18
|
/** Leading doc-comment / docstring summary, as extracted by vg. */
|
|
@@ -28,12 +30,46 @@ interface HaileClassifyInput {
|
|
|
28
30
|
/** Catalog AST role for the file, if the host has one. */
|
|
29
31
|
astRole?: string;
|
|
30
32
|
/**
|
|
31
|
-
* What the body
|
|
33
|
+
* What the body's code calls, scanned not run (vg-graph `node.effects`): bounded counts such as
|
|
32
34
|
* `sqlWrite`, `http`, `respond`, `render`, `calls`, `branches`, plus
|
|
33
35
|
* `apis`. The kernel scores purposes from these ahead of names.
|
|
34
36
|
*/
|
|
35
37
|
effects?: Readonly<Record<string, number | readonly string[]>>;
|
|
38
|
+
/**
|
|
39
|
+
* Ordered duty IR (vg-graph `node.duties`): `{ k, o?, via?, g?, live, hop?, line }`
|
|
40
|
+
* rows the extractor reconstructed from the syntax tree. The kernel scores
|
|
41
|
+
* purposes from these first, renders the intent from them, and evaluates
|
|
42
|
+
* the boundary policy over them.
|
|
43
|
+
*/
|
|
44
|
+
duties?: readonly HaileDutyInput[];
|
|
45
|
+
}
|
|
46
|
+
interface HaileDutyInput {
|
|
47
|
+
k: string;
|
|
48
|
+
o?: string;
|
|
49
|
+
via?: string;
|
|
50
|
+
t?: string;
|
|
51
|
+
g?: string;
|
|
52
|
+
live: boolean;
|
|
53
|
+
hop?: number;
|
|
54
|
+
line?: number;
|
|
36
55
|
}
|
|
56
|
+
/** A boundary finding from the kernel's policy pack (additive). */
|
|
57
|
+
interface HaileFinding {
|
|
58
|
+
rule: string;
|
|
59
|
+
severity: string;
|
|
60
|
+
message: string;
|
|
61
|
+
/** 1-based line of the symbol's own offending call; 0 / absent when only inherited. */
|
|
62
|
+
line?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Boundary policy packs. `hexagonal-v1`: ports-and-adapters — the application
|
|
66
|
+
* layer owns its ports, the domain stays pure, handlers only delegate.
|
|
67
|
+
* `layered-v1`: controller → service → repository — the service layer owns
|
|
68
|
+
* the ORM, and a controller must not read or write the store itself.
|
|
69
|
+
*/
|
|
70
|
+
type HailePolicy = "hexagonal-v1" | "layered-v1";
|
|
71
|
+
declare const POLICIES: readonly HailePolicy[];
|
|
72
|
+
declare const DEFAULT_POLICY: HailePolicy;
|
|
37
73
|
interface HaileClassification {
|
|
38
74
|
primary: string;
|
|
39
75
|
confidence: number;
|
|
@@ -56,6 +92,7 @@ interface HaileClassification {
|
|
|
56
92
|
signal: string;
|
|
57
93
|
weight: number;
|
|
58
94
|
}[];
|
|
95
|
+
findings: HaileFinding[];
|
|
59
96
|
}
|
|
60
97
|
interface HaileProvider {
|
|
61
98
|
version(): string;
|
|
@@ -65,7 +102,7 @@ interface HaileProvider {
|
|
|
65
102
|
declare const HAILE_MAGIC = "vg.haile.v1";
|
|
66
103
|
declare const HAILE_TAXONOMY = "haile.taxonomy.v1";
|
|
67
104
|
declare const HAILE_IR = "haile.ir.v1";
|
|
68
|
-
declare const HAILE_ENGINE_VERSION = "haile-fast/
|
|
105
|
+
declare const HAILE_ENGINE_VERSION = "haile-fast/2026.903.4";
|
|
69
106
|
declare const DEFAULT_PROFILE: HaileProfile;
|
|
70
107
|
declare const DEFAULT_SYMBOL_CAP = 8000;
|
|
71
108
|
|
|
@@ -101,10 +138,14 @@ interface GraphNodeLike {
|
|
|
101
138
|
file: string;
|
|
102
139
|
lang?: string;
|
|
103
140
|
signature?: string;
|
|
141
|
+
/** Decorators above a Python `def` (vg-graph ≥ 1.1, additive): `@router.post("/login")`. */
|
|
142
|
+
decorators?: string;
|
|
104
143
|
/** Short leading doc-comment / docstring summary (vg-graph ≥ 1.1). */
|
|
105
144
|
doc?: string;
|
|
106
145
|
/** Body effect profile (vg-graph ≥ 1.1, additive). */
|
|
107
146
|
effects?: Record<string, number | string[]>;
|
|
147
|
+
/** Ordered duty IR (vg-graph ≥ 1.1, additive). */
|
|
148
|
+
duties?: unknown[];
|
|
108
149
|
}
|
|
109
150
|
interface GraphEdgeLike {
|
|
110
151
|
kind: string;
|
|
@@ -135,6 +176,8 @@ interface HaileCallable {
|
|
|
135
176
|
imports: string[];
|
|
136
177
|
/** Body effect profile, passed through untouched. */
|
|
137
178
|
effects?: Record<string, number | string[]>;
|
|
179
|
+
/** Duty IR rows, passed through untouched (the kernel validates them). */
|
|
180
|
+
duties?: unknown[];
|
|
138
181
|
}
|
|
139
182
|
declare function isCallableKind(kind: string): boolean;
|
|
140
183
|
declare function symbolKindOf(kind: string): string;
|
|
@@ -151,4 +194,4 @@ interface SidecarDeps {
|
|
|
151
194
|
}
|
|
152
195
|
declare function runSidecarCli(argv?: string[], deps?: SidecarDeps): Promise<number>;
|
|
153
196
|
|
|
154
|
-
export { DEFAULT_PROFILE, DEFAULT_SYMBOL_CAP, HAILE_ENGINE_VERSION, HAILE_IR, HAILE_MAGIC, HAILE_TAXONOMY, type HaileClassification, type HaileClassifyInput, type HaileProfile, type HaileProvider, type SidecarDeps, adaptGraph, createHaileProvider, isCallableKind, loadWasmHaileKernel, resetWasmHaileKernelCache, runSidecarCli, symbolKindOf };
|
|
197
|
+
export { DEFAULT_POLICY, DEFAULT_PROFILE, DEFAULT_SYMBOL_CAP, HAILE_ENGINE_VERSION, HAILE_IR, HAILE_MAGIC, HAILE_TAXONOMY, type HaileClassification, type HaileClassifyInput, type HailePolicy, type HaileProfile, type HaileProvider, POLICIES, type SidecarDeps, adaptGraph, createHaileProvider, isCallableKind, loadWasmHaileKernel, resetWasmHaileKernelCache, runSidecarCli, symbolKindOf };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import{pathToFileURL as
|
|
2
|
-
`),1;if(!
|
|
3
|
-
`),1;let i=
|
|
4
|
-
`),1;let s=
|
|
5
|
-
`),1;let f=s,
|
|
6
|
-
`),1;let e
|
|
7
|
-
`),1;
|
|
8
|
-
`),1
|
|
9
|
-
`),
|
|
10
|
-
`),
|
|
1
|
+
import{pathToFileURL as ne}from"node:url";import*as y from"node:fs";import*as v from"node:path";var b=["hexagonal-v1","layered-v1"],H="hexagonal-v1",x="vg.haile.v1",w="haile.taxonomy.v1",A="haile.ir.v1",g="haile-fast/2026.903.4",I="balanced",P=8e3,O=new Set(["function","method","route","test","component","job"]);var F=240,W=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 O.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 q(r,t=""){let i=t?r.indexOf(`${t}(`):-1;if(i<0&&(r.startsWith("@")||r.startsWith("[")))return[];let s=i>=0?i+t.length:r.indexOf("("),f=r.lastIndexOf(")");if(s<0||f<=s)return[];let n=r.slice(s+1,f).trim();return!n||n==="void"?[]:n.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[l,p]=o.split(":").map(d=>d.trim());return{name:l||"arg",type_name:p||void 0}}let a=o.split(/\s+/);return a.length>=2?{name:a[a.length-1],type_name:a[0]}:{name:o}})}function $(r,t){let i=r.lastIndexOf("->");if(i>=0)return r.slice(i+2).replace(/[{;].*$/,"").trim()||void 0;let s=r.lastIndexOf(":"),f=r.lastIndexOf(")");if(s>f&&f>=0)return r.slice(s+1).replace(/[{;].*$/,"").replace(/\s*=>.*$/,"").trim()||void 0;let n=t?r.indexOf(`${t}(`):-1;if(n>0){let e=r.slice(0,n).trim(),o=0,a=0;for(let p=e.length-1;p>=0;p--){let d=e[p];if(d===">"||d==="]"||d===")")o++;else if(d==="<"||d==="["||d==="(")o--;else if(/\s/.test(d)&&o===0){a=p+1;break}}let l=e.slice(a).trim();if(l&&!l.startsWith("@")&&!l.startsWith("[")&&!U.has(l)&&l!=="void"&&!l.endsWith(")")&&!l.endsWith("]"))return l}}function j(r,t,i,s){let f=[],n=[],e=new Set,o=new Set;for(let a of t){if(a.src!==r||a.kind!=="call"&&a.kind!=="references")continue;let l=i.get(a.dst);if(!l)continue;let p=l.qualifiedName||l.name;if(!(!p||e.has(p))&&(e.add(p),f.push(p),l.file&&l.file!==s&&!o.has(l.file)&&n.length<D&&(o.add(l.file),n.push(l.file)),f.length>=24))break}return{calls:f,calleePaths:n}}function B(r,t,i){let s=new Map;for(let n of r)(n.kind==="file"||n.kind==="module")&&s.set(n.id,n.file);let f=new Map;for(let n of t){if(n.kind!=="import")continue;let e=s.get(n.src);if(!e)continue;let o=i.get(n.dst),a=o?.qualifiedName||o?.name;if(!a)continue;let l=f.get(e);l||(l=[],f.set(e,l)),l.length<M&&!l.includes(a)&&l.push(a)}return f}function L(r){let t=r.nodes??[],i=r.edges??[],s=new Map;for(let e of t)s.set(e.id,e);let f=B(t,i,s),n=[];for(let e of t){if(!R(e.kind))continue;let o=typeof e.decorators=="string"?e.decorators.trim():"",a=`${o?`${o} `:""}${e.signature??""}`.slice(0,W),{calls:l,calleePaths:p}=j(e.id,i,s,e.file),d=typeof e.doc=="string"?e.doc.trim().slice(0,F):"";n.push({node_id:e.id,file_path:e.file,name:e.name,qualified_name:e.qualifiedName||e.name,symbol_kind:K(e.kind),language:e.lang??"",signature:a,calls:l,parameters:q(a,e.name),return_type:$(a,e.name),...d?{doc:d}:{},callee_paths:p,imports:f.get(e.file)??[],...e.effects&&typeof e.effects=="object"?{effects:e.effects}:{},...Array.isArray(e.duties)?{duties:e.duties.slice(0,48)}:{}})}return n.sort((e,o)=>e.node_id<o.node_id?-1:e.node_id>o.node_id?1:0),n}import*as _ from"node:fs";import{fileURLToPath as Y}from"node:url";var m;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(r=>Y(r))}function V(r){try{let t=new WebAssembly.Module(r),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),a=s.vg_alloc(o.length);return new Uint8Array(s.memory.buffer,a,o.length).set(o),{ptr:a,len:o.length}},n=e=>{if(!e)return"";let o=new DataView(s.memory.buffer,e,4).getUint32(0,!0),a=new TextDecoder().decode(new Uint8Array(s.memory.buffer,e+4,o));return s.vg_free(e,4+o),a};return{version:()=>{try{return n(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",policy:e.policy??"hexagonal-v1",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??{},duties:e.duties??[]}),{ptr:a,len:l}=f(o);try{return n(s.vg_classify(a,l))}finally{s.vg_free(a,l)}}}}catch{return null}}function E(){if(m!==void 0)return m;m=null;try{let r=J().find(t=>_.existsSync(t));return r&&(m=V(_.readFileSync(r))),m}catch{return m=null,m}}function X(){m=void 0}function T(r){return Array.isArray(r)?r.filter(t=>typeof t=="string"):[]}function z(r){if(!r)return null;try{let t=JSON.parse(r);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(n=>typeof n?.role=="string").map(n=>({role:n.role,confidence:typeof n.confidence=="number"?n.confidence:0})):[],purposes:Array.isArray(t.purposes)?t.purposes.filter(n=>typeof n?.purpose=="string").map(n=>({purpose:n.purpose,confidence:typeof n.confidence=="number"?n.confidence:0})):[],intent:{text:typeof f.text=="string"?f.text:"",verbs:T(f.verbs),objects:T(f.objects)},findings:Array.isArray(t.findings)?t.findings.filter(n=>typeof n?.rule=="string"&&typeof n?.message=="string").map(n=>({rule:n.rule,severity:typeof n.severity=="string"?n.severity:"warn",message:n.message,...typeof n.line=="number"&&Number.isFinite(n.line)&&n.line>0?{line:Math.floor(n.line)}:{}})).slice(0,8):[],evidence:Array.isArray(t.evidence)?t.evidence.filter(n=>typeof n?.kind=="string"&&typeof n?.signal=="string").map(n=>({kind:n.kind,signal:n.signal,weight:typeof n.weight=="number"?n.weight:0})):[]}}catch{return null}}function k(r){let t=r===void 0?E():r;return t?{version:()=>t.version(),classify:i=>{try{return z(t.classifyJson(i))}catch{return null}}}:null}var Q=new Set(["strict","balanced","exploratory"]),Z=new Set(b);function C(r,t){let i=r.indexOf(t);if(!(i<0||i+1>=r.length))return r[i+1]}function ee(){return new Promise((r,t)=>{let i=[];process.stdin.on("data",s=>i.push(Buffer.from(s))),process.stdin.on("end",()=>r(Buffer.concat(i).toString("utf8"))),process.stdin.on("error",t)})}async function S(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
|
+
`),1;if(!r.includes("--stdin"))return process.stderr.write(`sidecar requires --stdin
|
|
3
|
+
`),1;let i=C(r,"--out");if(!i)return process.stderr.write(`sidecar requires --out <file>
|
|
4
|
+
`),1;let s=C(r,"--profile")??I;if(!Q.has(s))return process.stderr.write(`invalid --profile ${s}
|
|
5
|
+
`),1;let f=s,n=C(r,"--policy")??H;if(!Z.has(n))return process.stderr.write(`invalid --policy ${n} (one of ${b.join(", ")})
|
|
6
|
+
`),1;let e=n,o=t.provider===void 0?k():t.provider;if(!o)return process.stderr.write(`architecture kernel wasm missing \u2014 refusing to classify
|
|
7
|
+
`),1;let a;try{let c=(await(t.readInput??ee)()).trim();if(!c)return process.stderr.write(`sidecar stdin was empty
|
|
8
|
+
`),1;a=JSON.parse(c)}catch{return process.stderr.write(`sidecar stdin was not valid JSON
|
|
9
|
+
`),1}let l=L({nodes:Array.isArray(a.nodes)?a.nodes:[],edges:Array.isArray(a.edges)?a.edges:[]}),p=o.version()||g,d=[],N=!1;for(let c of l){if(d.length>=8e3){N=!0;break}let u=o.classify({name:c.name,path:c.file_path,symbolKind:c.symbol_kind,fileKind:"source",calls:c.calls,types:[...c.parameters.map(h=>h.type_name).filter(h=>!!h),...c.return_type?[c.return_type]:[]],idents:[c.name,...c.calls].slice(0,24),profile:f,policy:e,qualifiedName:c.qualified_name,doc:c.doc??"",signature:c.signature,params:c.parameters.map(h=>h.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}:{}});u&&d.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:u.primary,alternatives:u.alternatives,confidence:u.confidence,band:u.band},purposes:u.purposes,intent:u.intent,evidence:u.evidence,...u.findings.length?{findings:u.findings}:{}})}let G={magic:x,taxonomy:w,ir:A,corpus_hash:a.provenance?.corpusHash??"",engine_version:p,profile:f,policy:e,symbols:d,...N?{symbols_capped:!0}:{}};try{y.mkdirSync(v.dirname(v.resolve(i)),{recursive:!0});let c=`${i}.${process.pid}.tmp`;y.writeFileSync(c,`${JSON.stringify(G)}
|
|
10
|
+
`),y.renameSync(c,i)}catch{return process.stderr.write(`sidecar failed to write ${i}
|
|
11
|
+
`),1}return 0}function re(){let r=process.argv[1];if(!r)return!1;try{return import.meta.url===ne(r).href}catch{return!1}}re()&&S().then(r=>{process.exit(r)});export{H as DEFAULT_POLICY,I as DEFAULT_PROFILE,P as DEFAULT_SYMBOL_CAP,g as HAILE_ENGINE_VERSION,A as HAILE_IR,x as HAILE_MAGIC,w as HAILE_TAXONOMY,b as POLICIES,L as adaptGraph,k as createHaileProvider,R as isCallableKind,E as loadWasmHaileKernel,X as resetWasmHaileKernelCache,S as runSidecarCli,K as symbolKindOf};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibgrate/haile",
|
|
3
|
-
"version": "2026.903.
|
|
3
|
+
"version": "2026.903.4",
|
|
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",
|