@buley/neural 2.0.3 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buley/neural",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "A Transparent, Local-First, WebGPU-Accelerated Neural Graph Database.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/engine/gpu.ts CHANGED
@@ -112,7 +112,7 @@ export class GPUEngine {
112
112
  }
113
113
 
114
114
  // Upload Input
115
- this.device.queue.writeBuffer(this.inputBuffer, 0, inputs as unknown as BufferSource);
115
+ this.device.queue.writeBuffer(this.inputBuffer, 0, inputs as BufferSource);
116
116
 
117
117
  // Encode Command
118
118
  const commandEncoder = this.device.createCommandEncoder();
@@ -213,7 +213,7 @@ export class GPUEngine {
213
213
  // Let's assume prepareTrainingBuffers was called ONCE before loop.
214
214
  // We just need to update TARGETS buffer!
215
215
  if (this.targetBuffer) {
216
- this.device?.queue.writeBuffer(this.targetBuffer, 0, targets as unknown as BufferSource);
216
+ this.device?.queue.writeBuffer(this.targetBuffer, 0, targets as BufferSource);
217
217
  }
218
218
 
219
219
  // Run Training Shaders
@@ -229,7 +229,7 @@ export class GPUEngine {
229
229
  }
230
230
 
231
231
  if (deltas && deltas.length > 0) {
232
- this.device.queue.writeBuffer(this.deltaBuffer, 0, deltas as unknown as BufferSource);
232
+ this.device.queue.writeBuffer(this.deltaBuffer, 0, deltas as BufferSource);
233
233
  }
234
234
 
235
235
  const commandEncoder = this.device.createCommandEncoder();
@@ -258,7 +258,7 @@ export class GPUEngine {
258
258
 
259
259
  // We only write what we are given, usually just the first N inputs (Microphone bins)
260
260
  // If data is smaller than buffer, we use queue.writeBuffer which handles partial writes
261
- this.device.queue.writeBuffer(this.inputBuffer, 0, data as unknown as BufferSource);
261
+ this.device.queue.writeBuffer(this.inputBuffer, 0, data as BufferSource);
262
262
 
263
263
  // Trigger a tick? Or let the outer loop do it?
264
264
  // Let's just update the buffer. The UI loop calls runTick() or similar.
package/src/index.ts CHANGED
@@ -3,6 +3,9 @@ import { initializeSchema } from "./db/schema";
3
3
  import { NeuronRepository, SynapseRepository } from "./db/repository";
4
4
  import { GPUEngine } from "./engine/gpu";
5
5
  import { Translator } from "./engine/translator";
6
+ import { Neuron, Synapse } from "./types";
7
+
8
+ export type { Neuron, Synapse } from "./types";
6
9
 
7
10
  export class NeuralEngine {
8
11
  gpu: GPUEngine;
@@ -18,8 +21,8 @@ export class NeuralEngine {
18
21
  }
19
22
 
20
23
  // Cache
21
- private neurons: any[] = [];
22
- private synapses: any[] = [];
24
+ private neurons: Neuron[] = [];
25
+ private synapses: Synapse[] = [];
23
26
 
24
27
  async init() {
25
28
  console.log("Neural 2.0 Engine Initializing...");
@@ -146,7 +149,7 @@ export class NeuralEngine {
146
149
  };
147
150
  }
148
151
 
149
- async importGraph(data: any) {
152
+ async importGraph(data: { neurons: Neuron[], synapses: Synapse[] }) {
150
153
  if (!data.neurons || !data.synapses) throw new Error("Invalid graph data");
151
154
 
152
155
  console.log("Importing graph...");
package/src/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export interface Neuron {
2
2
  id: string;
3
- type: 'input' | 'hidden' | 'output';
3
+ type: 'input' | 'hidden' | 'output' | 'cloud';
4
4
  bias: number;
5
5
  activation: string;
6
6
  }