@metaharness/kernel 0.1.1 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaharness/kernel",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Cross-platform kernel for the agent-harness-generator — wasm primary, NAPI-RS native fallback",
5
5
  "homepage": "https://github.com/ruvnet/agent-harness-generator",
6
6
  "repository": {
@@ -41,7 +41,7 @@
41
41
  "build": "tsc",
42
42
  "test": "vitest run",
43
43
  "lint": "tsc --noEmit",
44
- "build:wasm": "RUSTFLAGS= wasm-pack build ../../crates/kernel-wasm --target nodejs --release --out-dir pkg && node -e \"const f=require('fs');const j=require('./pkg/package.json');j.type='commonjs';f.writeFileSync('./pkg/package.json',JSON.stringify(j,null,2)+'\\n')\""
44
+ "build:wasm": "RUSTFLAGS= wasm-pack build ../../crates/kernel-wasm --target nodejs --release --out-dir ../../packages/kernel-js/pkg && rm -f pkg/.gitignore && node -e \"const f=require('fs');const j=require('./pkg/package.json');j.type='commonjs';f.writeFileSync('./pkg/package.json',JSON.stringify(j,null,2)+'\\n')\""
45
45
  },
46
46
  "keywords": [
47
47
  "agent-harness",
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "ruflo-kernel-wasm",
3
+ "collaborators": [
4
+ "rUv <ruv@ruv.net>"
5
+ ],
6
+ "description": "WebAssembly bindings for ruflo-kernel",
7
+ "version": "0.1.0",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/ruvnet/agent-harness-generator"
12
+ },
13
+ "files": [
14
+ "ruflo_kernel_wasm_bg.wasm",
15
+ "ruflo_kernel_wasm.js",
16
+ "ruflo_kernel_wasm.d.ts"
17
+ ],
18
+ "main": "ruflo_kernel_wasm.js",
19
+ "types": "ruflo_kernel_wasm.d.ts",
20
+ "type": "commonjs"
21
+ }
@@ -0,0 +1,17 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Return kernel build metadata as a JS object.
6
+ */
7
+ export function kernelInfo(): any;
8
+
9
+ /**
10
+ * Validate an MCP server spec (returns `null` on success, error string otherwise).
11
+ */
12
+ export function mcpValidate(spec_json: string): any;
13
+
14
+ /**
15
+ * Returns the package version.
16
+ */
17
+ export function version(): string;
@@ -0,0 +1,218 @@
1
+ /* @ts-self-types="./ruflo_kernel_wasm.d.ts" */
2
+
3
+ /**
4
+ * Return kernel build metadata as a JS object.
5
+ * @returns {any}
6
+ */
7
+ function kernelInfo() {
8
+ try {
9
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
10
+ wasm.kernelInfo(retptr);
11
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
13
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
14
+ if (r2) {
15
+ throw takeObject(r1);
16
+ }
17
+ return takeObject(r0);
18
+ } finally {
19
+ wasm.__wbindgen_add_to_stack_pointer(16);
20
+ }
21
+ }
22
+ exports.kernelInfo = kernelInfo;
23
+
24
+ /**
25
+ * Validate an MCP server spec (returns `null` on success, error string otherwise).
26
+ * @param {string} spec_json
27
+ * @returns {any}
28
+ */
29
+ function mcpValidate(spec_json) {
30
+ try {
31
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
32
+ const ptr0 = passStringToWasm0(spec_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
33
+ const len0 = WASM_VECTOR_LEN;
34
+ wasm.mcpValidate(retptr, ptr0, len0);
35
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
36
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
37
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
38
+ if (r2) {
39
+ throw takeObject(r1);
40
+ }
41
+ return takeObject(r0);
42
+ } finally {
43
+ wasm.__wbindgen_add_to_stack_pointer(16);
44
+ }
45
+ }
46
+ exports.mcpValidate = mcpValidate;
47
+
48
+ /**
49
+ * Returns the package version.
50
+ * @returns {string}
51
+ */
52
+ function version() {
53
+ let deferred1_0;
54
+ let deferred1_1;
55
+ try {
56
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
57
+ wasm.version(retptr);
58
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
59
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
60
+ deferred1_0 = r0;
61
+ deferred1_1 = r1;
62
+ return getStringFromWasm0(r0, r1);
63
+ } finally {
64
+ wasm.__wbindgen_add_to_stack_pointer(16);
65
+ wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
66
+ }
67
+ }
68
+ exports.version = version;
69
+ function __wbg_get_imports() {
70
+ const import0 = {
71
+ __proto__: null,
72
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
73
+ const ret = String(getObject(arg1));
74
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
75
+ const len1 = WASM_VECTOR_LEN;
76
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
77
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
78
+ },
79
+ __wbg___wbindgen_throw_ea4887a5f8f9a9db: function(arg0, arg1) {
80
+ throw new Error(getStringFromWasm0(arg0, arg1));
81
+ },
82
+ __wbg_new_2e117a478906f062: function() {
83
+ const ret = new Object();
84
+ return addHeapObject(ret);
85
+ },
86
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
87
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
88
+ },
89
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
90
+ // Cast intrinsic for `Ref(String) -> Externref`.
91
+ const ret = getStringFromWasm0(arg0, arg1);
92
+ return addHeapObject(ret);
93
+ },
94
+ __wbindgen_object_clone_ref: function(arg0) {
95
+ const ret = getObject(arg0);
96
+ return addHeapObject(ret);
97
+ },
98
+ __wbindgen_object_drop_ref: function(arg0) {
99
+ takeObject(arg0);
100
+ },
101
+ };
102
+ return {
103
+ __proto__: null,
104
+ "./ruflo_kernel_wasm_bg.js": import0,
105
+ };
106
+ }
107
+
108
+ function addHeapObject(obj) {
109
+ if (heap_next === heap.length) heap.push(heap.length + 1);
110
+ const idx = heap_next;
111
+ heap_next = heap[idx];
112
+
113
+ heap[idx] = obj;
114
+ return idx;
115
+ }
116
+
117
+ function dropObject(idx) {
118
+ if (idx < 1028) return;
119
+ heap[idx] = heap_next;
120
+ heap_next = idx;
121
+ }
122
+
123
+ let cachedDataViewMemory0 = null;
124
+ function getDataViewMemory0() {
125
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
126
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
127
+ }
128
+ return cachedDataViewMemory0;
129
+ }
130
+
131
+ function getStringFromWasm0(ptr, len) {
132
+ return decodeText(ptr >>> 0, len);
133
+ }
134
+
135
+ let cachedUint8ArrayMemory0 = null;
136
+ function getUint8ArrayMemory0() {
137
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
138
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
139
+ }
140
+ return cachedUint8ArrayMemory0;
141
+ }
142
+
143
+ function getObject(idx) { return heap[idx]; }
144
+
145
+ let heap = new Array(1024).fill(undefined);
146
+ heap.push(undefined, null, true, false);
147
+
148
+ let heap_next = heap.length;
149
+
150
+ function passStringToWasm0(arg, malloc, realloc) {
151
+ if (realloc === undefined) {
152
+ const buf = cachedTextEncoder.encode(arg);
153
+ const ptr = malloc(buf.length, 1) >>> 0;
154
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
155
+ WASM_VECTOR_LEN = buf.length;
156
+ return ptr;
157
+ }
158
+
159
+ let len = arg.length;
160
+ let ptr = malloc(len, 1) >>> 0;
161
+
162
+ const mem = getUint8ArrayMemory0();
163
+
164
+ let offset = 0;
165
+
166
+ for (; offset < len; offset++) {
167
+ const code = arg.charCodeAt(offset);
168
+ if (code > 0x7F) break;
169
+ mem[ptr + offset] = code;
170
+ }
171
+ if (offset !== len) {
172
+ if (offset !== 0) {
173
+ arg = arg.slice(offset);
174
+ }
175
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
176
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
177
+ const ret = cachedTextEncoder.encodeInto(arg, view);
178
+
179
+ offset += ret.written;
180
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
181
+ }
182
+
183
+ WASM_VECTOR_LEN = offset;
184
+ return ptr;
185
+ }
186
+
187
+ function takeObject(idx) {
188
+ const ret = getObject(idx);
189
+ dropObject(idx);
190
+ return ret;
191
+ }
192
+
193
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
194
+ cachedTextDecoder.decode();
195
+ function decodeText(ptr, len) {
196
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
197
+ }
198
+
199
+ const cachedTextEncoder = new TextEncoder();
200
+
201
+ if (!('encodeInto' in cachedTextEncoder)) {
202
+ cachedTextEncoder.encodeInto = function (arg, view) {
203
+ const buf = cachedTextEncoder.encode(arg);
204
+ view.set(buf);
205
+ return {
206
+ read: arg.length,
207
+ written: buf.length
208
+ };
209
+ };
210
+ }
211
+
212
+ let WASM_VECTOR_LEN = 0;
213
+
214
+ const wasmPath = `${__dirname}/ruflo_kernel_wasm_bg.wasm`;
215
+ const wasmBytes = require('fs').readFileSync(wasmPath);
216
+ const wasmModule = new WebAssembly.Module(wasmBytes);
217
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
218
+ let wasm = wasmInstance.exports;
Binary file
@@ -0,0 +1,10 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const kernelInfo: (a: number) => void;
5
+ export const mcpValidate: (a: number, b: number, c: number) => void;
6
+ export const version: (a: number) => void;
7
+ export const __wbindgen_export: (a: number, b: number) => number;
8
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
9
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;
10
+ export const __wbindgen_export3: (a: number, b: number, c: number) => void;