@poolzin/pool-bot 2026.1.37 → 2026.1.39
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/CHANGELOG.md +9 -98
- package/dist/agents/tools/memory-tool.js +1 -2
- package/dist/agents/workspace.js +1 -5
- package/dist/build-info.json +3 -3
- package/dist/channels/plugins/agent-tools/whatsapp-login.js +1 -17
- package/dist/commands/doctor-state-integrity.js +2 -14
- package/dist/config/types.js +0 -1
- package/dist/config/zod-schema.js +0 -6
- package/dist/discord/monitor/message-handler.process.js +6 -4
- package/dist/gateway/client.js +0 -14
- package/dist/gateway/server.impl.js +0 -4
- package/dist/memory/index.js +0 -5
- package/dist/memory/manager.js +2 -25
- package/dist/slack/monitor/message-handler/prepare.js +10 -4
- package/dist/slack/monitor/slash.js +10 -4
- package/extensions/memory-core/package.json +0 -3
- package/package.json +3 -2
- package/skills/webgpu-threejs-tsl/REFERENCE.md +0 -283
- package/skills/webgpu-threejs-tsl/SKILL.md +0 -91
- package/skills/webgpu-threejs-tsl/docs/compute-shaders.md +0 -404
- package/skills/webgpu-threejs-tsl/docs/core-concepts.md +0 -453
- package/skills/webgpu-threejs-tsl/docs/materials.md +0 -353
- package/skills/webgpu-threejs-tsl/docs/post-processing.md +0 -434
- package/skills/webgpu-threejs-tsl/docs/wgsl-integration.md +0 -324
- package/skills/webgpu-threejs-tsl/examples/basic-setup.js +0 -87
- package/skills/webgpu-threejs-tsl/examples/custom-material.js +0 -170
- package/skills/webgpu-threejs-tsl/examples/earth-shader.js +0 -292
- package/skills/webgpu-threejs-tsl/examples/particle-system.js +0 -259
- package/skills/webgpu-threejs-tsl/examples/post-processing.js +0 -199
- package/skills/webgpu-threejs-tsl/templates/compute-shader.js +0 -305
- package/skills/webgpu-threejs-tsl/templates/webgpu-project.js +0 -276
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
# TSL Compute Shaders
|
|
2
|
-
|
|
3
|
-
Compute shaders run on the GPU for parallel processing of data. TSL makes them accessible through JavaScript.
|
|
4
|
-
|
|
5
|
-
## Basic Setup
|
|
6
|
-
|
|
7
|
-
```javascript
|
|
8
|
-
import * as THREE from 'three/webgpu';
|
|
9
|
-
import { Fn, instancedArray, instanceIndex, vec3 } from 'three/tsl';
|
|
10
|
-
|
|
11
|
-
// Create storage buffer
|
|
12
|
-
const count = 100000;
|
|
13
|
-
const positions = instancedArray(count, 'vec3');
|
|
14
|
-
|
|
15
|
-
// Create compute shader
|
|
16
|
-
const computeShader = Fn(() => {
|
|
17
|
-
const position = positions.element(instanceIndex);
|
|
18
|
-
position.x.addAssign(0.01);
|
|
19
|
-
})().compute(count);
|
|
20
|
-
|
|
21
|
-
// Execute
|
|
22
|
-
renderer.compute(computeShader);
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Storage Buffers
|
|
26
|
-
|
|
27
|
-
### Instanced Arrays
|
|
28
|
-
|
|
29
|
-
```javascript
|
|
30
|
-
import { instancedArray } from 'three/tsl';
|
|
31
|
-
|
|
32
|
-
// Create typed storage buffers
|
|
33
|
-
const positions = instancedArray(count, 'vec3');
|
|
34
|
-
const velocities = instancedArray(count, 'vec3');
|
|
35
|
-
const colors = instancedArray(count, 'vec4');
|
|
36
|
-
const indices = instancedArray(count, 'uint');
|
|
37
|
-
const values = instancedArray(count, 'float');
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Accessing Elements
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
const computeShader = Fn(() => {
|
|
44
|
-
// Get element at current index
|
|
45
|
-
const position = positions.element(instanceIndex);
|
|
46
|
-
const velocity = velocities.element(instanceIndex);
|
|
47
|
-
|
|
48
|
-
// Read values
|
|
49
|
-
const x = position.x;
|
|
50
|
-
const speed = velocity.length();
|
|
51
|
-
|
|
52
|
-
// Write values
|
|
53
|
-
position.assign(vec3(0, 0, 0));
|
|
54
|
-
position.x.assign(1.0);
|
|
55
|
-
position.addAssign(velocity);
|
|
56
|
-
})().compute(count);
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Accessing Other Elements
|
|
60
|
-
|
|
61
|
-
```javascript
|
|
62
|
-
const computeShader = Fn(() => {
|
|
63
|
-
const myIndex = instanceIndex;
|
|
64
|
-
const neighborIndex = myIndex.add(1).mod(count);
|
|
65
|
-
|
|
66
|
-
const myPos = positions.element(myIndex);
|
|
67
|
-
const neighborPos = positions.element(neighborIndex);
|
|
68
|
-
|
|
69
|
-
// Calculate distance to neighbor
|
|
70
|
-
const dist = myPos.distance(neighborPos);
|
|
71
|
-
})().compute(count);
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Compute Shader Patterns
|
|
75
|
-
|
|
76
|
-
### Initialize Particles
|
|
77
|
-
|
|
78
|
-
```javascript
|
|
79
|
-
const computeInit = Fn(() => {
|
|
80
|
-
const position = positions.element(instanceIndex);
|
|
81
|
-
const velocity = velocities.element(instanceIndex);
|
|
82
|
-
|
|
83
|
-
// Random positions using hash
|
|
84
|
-
position.x.assign(hash(instanceIndex).mul(10).sub(5));
|
|
85
|
-
position.y.assign(hash(instanceIndex.add(1)).mul(10).sub(5));
|
|
86
|
-
position.z.assign(hash(instanceIndex.add(2)).mul(10).sub(5));
|
|
87
|
-
|
|
88
|
-
// Zero velocity
|
|
89
|
-
velocity.assign(vec3(0));
|
|
90
|
-
})().compute(count);
|
|
91
|
-
|
|
92
|
-
// Run once at startup
|
|
93
|
-
await renderer.computeAsync(computeInit);
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### Physics Update
|
|
97
|
-
|
|
98
|
-
```javascript
|
|
99
|
-
const gravity = uniform(-9.8);
|
|
100
|
-
const deltaTimeUniform = uniform(0);
|
|
101
|
-
const groundY = uniform(0);
|
|
102
|
-
|
|
103
|
-
const computeUpdate = Fn(() => {
|
|
104
|
-
const position = positions.element(instanceIndex);
|
|
105
|
-
const velocity = velocities.element(instanceIndex);
|
|
106
|
-
const dt = deltaTimeUniform;
|
|
107
|
-
|
|
108
|
-
// Apply gravity
|
|
109
|
-
velocity.y.addAssign(gravity.mul(dt));
|
|
110
|
-
|
|
111
|
-
// Update position
|
|
112
|
-
position.addAssign(velocity.mul(dt));
|
|
113
|
-
|
|
114
|
-
// Ground collision
|
|
115
|
-
If(position.y.lessThan(groundY), () => {
|
|
116
|
-
position.y.assign(groundY);
|
|
117
|
-
velocity.y.assign(velocity.y.negate().mul(0.8)); // Bounce
|
|
118
|
-
velocity.xz.mulAssign(0.95); // Friction
|
|
119
|
-
});
|
|
120
|
-
})().compute(count);
|
|
121
|
-
|
|
122
|
-
// In animation loop
|
|
123
|
-
function animate() {
|
|
124
|
-
deltaTimeUniform.value = clock.getDelta();
|
|
125
|
-
renderer.compute(computeUpdate);
|
|
126
|
-
renderer.render(scene, camera);
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Attraction to Point
|
|
131
|
-
|
|
132
|
-
```javascript
|
|
133
|
-
const attractorPos = uniform(new THREE.Vector3(0, 0, 0));
|
|
134
|
-
const attractorStrength = uniform(1.0);
|
|
135
|
-
|
|
136
|
-
const computeAttract = Fn(() => {
|
|
137
|
-
const position = positions.element(instanceIndex);
|
|
138
|
-
const velocity = velocities.element(instanceIndex);
|
|
139
|
-
|
|
140
|
-
// Direction to attractor
|
|
141
|
-
const toAttractor = attractorPos.sub(position);
|
|
142
|
-
const distance = toAttractor.length();
|
|
143
|
-
const direction = toAttractor.normalize();
|
|
144
|
-
|
|
145
|
-
// Apply force (inverse square falloff)
|
|
146
|
-
const force = direction.mul(attractorStrength).div(distance.mul(distance).add(0.1));
|
|
147
|
-
velocity.addAssign(force.mul(deltaTimeUniform));
|
|
148
|
-
})().compute(count);
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Neighbor Interaction (Boids-like)
|
|
152
|
-
|
|
153
|
-
```javascript
|
|
154
|
-
const computeBoids = Fn(() => {
|
|
155
|
-
const myPos = positions.element(instanceIndex);
|
|
156
|
-
const myVel = velocities.element(instanceIndex);
|
|
157
|
-
|
|
158
|
-
const separation = vec3(0).toVar();
|
|
159
|
-
const alignment = vec3(0).toVar();
|
|
160
|
-
const cohesion = vec3(0).toVar();
|
|
161
|
-
const neighborCount = int(0).toVar();
|
|
162
|
-
|
|
163
|
-
// Check nearby particles
|
|
164
|
-
Loop(count, ({ i }) => {
|
|
165
|
-
If(i.notEqual(instanceIndex), () => {
|
|
166
|
-
const otherPos = positions.element(i);
|
|
167
|
-
const otherVel = velocities.element(i);
|
|
168
|
-
const dist = myPos.distance(otherPos);
|
|
169
|
-
|
|
170
|
-
If(dist.lessThan(2.0), () => {
|
|
171
|
-
// Separation
|
|
172
|
-
const diff = myPos.sub(otherPos).normalize().div(dist);
|
|
173
|
-
separation.addAssign(diff);
|
|
174
|
-
|
|
175
|
-
// Alignment
|
|
176
|
-
alignment.addAssign(otherVel);
|
|
177
|
-
|
|
178
|
-
// Cohesion
|
|
179
|
-
cohesion.addAssign(otherPos);
|
|
180
|
-
|
|
181
|
-
neighborCount.addAssign(1);
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
If(neighborCount.greaterThan(0), () => {
|
|
187
|
-
const n = neighborCount.toFloat();
|
|
188
|
-
alignment.divAssign(n);
|
|
189
|
-
cohesion.divAssign(n);
|
|
190
|
-
cohesion.assign(cohesion.sub(myPos));
|
|
191
|
-
|
|
192
|
-
myVel.addAssign(separation.mul(0.05));
|
|
193
|
-
myVel.addAssign(alignment.sub(myVel).mul(0.05));
|
|
194
|
-
myVel.addAssign(cohesion.mul(0.05));
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
// Limit speed
|
|
198
|
-
const speed = myVel.length();
|
|
199
|
-
If(speed.greaterThan(2.0), () => {
|
|
200
|
-
myVel.assign(myVel.normalize().mul(2.0));
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
myPos.addAssign(myVel.mul(deltaTimeUniform));
|
|
204
|
-
})().compute(count);
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
## Workgroups and Synchronization
|
|
208
|
-
|
|
209
|
-
### Workgroup Size
|
|
210
|
-
|
|
211
|
-
```javascript
|
|
212
|
-
// Default workgroup size is typically 64 or 256
|
|
213
|
-
const computeShader = Fn(() => {
|
|
214
|
-
// shader code
|
|
215
|
-
})().compute(count, { workgroupSize: 64 });
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### Barriers
|
|
219
|
-
|
|
220
|
-
```javascript
|
|
221
|
-
import { workgroupBarrier, storageBarrier, textureBarrier } from 'three/tsl';
|
|
222
|
-
|
|
223
|
-
const computeShader = Fn(() => {
|
|
224
|
-
// Write data
|
|
225
|
-
sharedData.element(localIndex).assign(value);
|
|
226
|
-
|
|
227
|
-
// Ensure all workgroup threads reach this point
|
|
228
|
-
workgroupBarrier();
|
|
229
|
-
|
|
230
|
-
// Now safe to read data written by other threads
|
|
231
|
-
const neighborValue = sharedData.element(localIndex.add(1));
|
|
232
|
-
})().compute(count);
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## Atomic Operations
|
|
236
|
-
|
|
237
|
-
For thread-safe read-modify-write operations:
|
|
238
|
-
|
|
239
|
-
```javascript
|
|
240
|
-
import { atomicAdd, atomicSub, atomicMax, atomicMin, atomicAnd, atomicOr, atomicXor } from 'three/tsl';
|
|
241
|
-
|
|
242
|
-
const counter = instancedArray(1, 'uint');
|
|
243
|
-
|
|
244
|
-
const computeShader = Fn(() => {
|
|
245
|
-
// Atomically increment counter
|
|
246
|
-
atomicAdd(counter.element(0), 1);
|
|
247
|
-
|
|
248
|
-
// Atomic max
|
|
249
|
-
atomicMax(maxValue.element(0), localValue);
|
|
250
|
-
})().compute(count);
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Using Compute Results in Materials
|
|
254
|
-
|
|
255
|
-
### Instanced Mesh with Computed Positions
|
|
256
|
-
|
|
257
|
-
```javascript
|
|
258
|
-
// Create instanced mesh
|
|
259
|
-
const geometry = new THREE.SphereGeometry(0.1, 16, 16);
|
|
260
|
-
const material = new THREE.MeshStandardNodeMaterial();
|
|
261
|
-
|
|
262
|
-
// Use computed positions
|
|
263
|
-
material.positionNode = positions.element(instanceIndex);
|
|
264
|
-
|
|
265
|
-
// Optionally use computed colors
|
|
266
|
-
material.colorNode = colors.element(instanceIndex);
|
|
267
|
-
|
|
268
|
-
const mesh = new THREE.InstancedMesh(geometry, material, count);
|
|
269
|
-
scene.add(mesh);
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### Points with Computed Positions
|
|
273
|
-
|
|
274
|
-
```javascript
|
|
275
|
-
const geometry = new THREE.BufferGeometry();
|
|
276
|
-
geometry.setAttribute('position', new THREE.Float32BufferAttribute(new Float32Array(count * 3), 3));
|
|
277
|
-
|
|
278
|
-
const material = new THREE.PointsNodeMaterial();
|
|
279
|
-
material.positionNode = positions.element(instanceIndex);
|
|
280
|
-
material.colorNode = colors.element(instanceIndex);
|
|
281
|
-
material.sizeNode = float(5.0);
|
|
282
|
-
|
|
283
|
-
const points = new THREE.Points(geometry, material);
|
|
284
|
-
scene.add(points);
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
## Execution Methods
|
|
288
|
-
|
|
289
|
-
```javascript
|
|
290
|
-
// Synchronous compute (blocks until complete)
|
|
291
|
-
renderer.compute(computeShader);
|
|
292
|
-
|
|
293
|
-
// Asynchronous compute (returns promise)
|
|
294
|
-
await renderer.computeAsync(computeShader);
|
|
295
|
-
|
|
296
|
-
// Multiple computes
|
|
297
|
-
renderer.compute(computeInit);
|
|
298
|
-
renderer.compute(computePhysics);
|
|
299
|
-
renderer.compute(computeCollisions);
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
## Reading Back Data (GPU to CPU)
|
|
303
|
-
|
|
304
|
-
```javascript
|
|
305
|
-
// Create buffer for readback
|
|
306
|
-
const readBuffer = new Float32Array(count * 3);
|
|
307
|
-
|
|
308
|
-
// Read data back from GPU
|
|
309
|
-
await renderer.readRenderTargetPixelsAsync(
|
|
310
|
-
computeTexture,
|
|
311
|
-
0, 0, width, height,
|
|
312
|
-
readBuffer
|
|
313
|
-
);
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
## Complete Example: Particle System
|
|
317
|
-
|
|
318
|
-
```javascript
|
|
319
|
-
import * as THREE from 'three/webgpu';
|
|
320
|
-
import {
|
|
321
|
-
Fn, If, instancedArray, instanceIndex, uniform,
|
|
322
|
-
vec3, float, hash, time
|
|
323
|
-
} from 'three/tsl';
|
|
324
|
-
|
|
325
|
-
// Setup
|
|
326
|
-
const count = 50000;
|
|
327
|
-
const positions = instancedArray(count, 'vec3');
|
|
328
|
-
const velocities = instancedArray(count, 'vec3');
|
|
329
|
-
const lifetimes = instancedArray(count, 'float');
|
|
330
|
-
|
|
331
|
-
// Uniforms
|
|
332
|
-
const emitterPos = uniform(new THREE.Vector3(0, 0, 0));
|
|
333
|
-
const gravity = uniform(-2.0);
|
|
334
|
-
const dt = uniform(0);
|
|
335
|
-
|
|
336
|
-
// Initialize
|
|
337
|
-
const computeInit = Fn(() => {
|
|
338
|
-
const pos = positions.element(instanceIndex);
|
|
339
|
-
const vel = velocities.element(instanceIndex);
|
|
340
|
-
const life = lifetimes.element(instanceIndex);
|
|
341
|
-
|
|
342
|
-
pos.assign(emitterPos);
|
|
343
|
-
|
|
344
|
-
// Random velocity in cone
|
|
345
|
-
const angle = hash(instanceIndex).mul(Math.PI * 2);
|
|
346
|
-
const speed = hash(instanceIndex.add(1)).mul(2).add(1);
|
|
347
|
-
vel.x.assign(angle.cos().mul(speed).mul(0.3));
|
|
348
|
-
vel.y.assign(speed);
|
|
349
|
-
vel.z.assign(angle.sin().mul(speed).mul(0.3));
|
|
350
|
-
|
|
351
|
-
// Random lifetime
|
|
352
|
-
life.assign(hash(instanceIndex.add(2)).mul(2).add(1));
|
|
353
|
-
})().compute(count);
|
|
354
|
-
|
|
355
|
-
// Update
|
|
356
|
-
const computeUpdate = Fn(() => {
|
|
357
|
-
const pos = positions.element(instanceIndex);
|
|
358
|
-
const vel = velocities.element(instanceIndex);
|
|
359
|
-
const life = lifetimes.element(instanceIndex);
|
|
360
|
-
|
|
361
|
-
// Apply gravity
|
|
362
|
-
vel.y.addAssign(gravity.mul(dt));
|
|
363
|
-
|
|
364
|
-
// Update position
|
|
365
|
-
pos.addAssign(vel.mul(dt));
|
|
366
|
-
|
|
367
|
-
// Decrease lifetime
|
|
368
|
-
life.subAssign(dt);
|
|
369
|
-
|
|
370
|
-
// Respawn dead particles
|
|
371
|
-
If(life.lessThan(0), () => {
|
|
372
|
-
pos.assign(emitterPos);
|
|
373
|
-
const angle = hash(instanceIndex.add(time.mul(1000))).mul(Math.PI * 2);
|
|
374
|
-
const speed = hash(instanceIndex.add(time.mul(1000)).add(1)).mul(2).add(1);
|
|
375
|
-
vel.x.assign(angle.cos().mul(speed).mul(0.3));
|
|
376
|
-
vel.y.assign(speed);
|
|
377
|
-
vel.z.assign(angle.sin().mul(speed).mul(0.3));
|
|
378
|
-
life.assign(hash(instanceIndex.add(time.mul(1000)).add(2)).mul(2).add(1));
|
|
379
|
-
});
|
|
380
|
-
})().compute(count);
|
|
381
|
-
|
|
382
|
-
// Material
|
|
383
|
-
const material = new THREE.PointsNodeMaterial();
|
|
384
|
-
material.positionNode = positions.element(instanceIndex);
|
|
385
|
-
material.sizeNode = float(3.0);
|
|
386
|
-
material.colorNode = vec3(1, 0.5, 0.2);
|
|
387
|
-
|
|
388
|
-
// Geometry (dummy positions)
|
|
389
|
-
const geometry = new THREE.BufferGeometry();
|
|
390
|
-
geometry.setAttribute('position', new THREE.Float32BufferAttribute(new Float32Array(count * 3), 3));
|
|
391
|
-
|
|
392
|
-
const points = new THREE.Points(geometry, material);
|
|
393
|
-
scene.add(points);
|
|
394
|
-
|
|
395
|
-
// Init
|
|
396
|
-
await renderer.computeAsync(computeInit);
|
|
397
|
-
|
|
398
|
-
// Animation loop
|
|
399
|
-
function animate() {
|
|
400
|
-
dt.value = Math.min(clock.getDelta(), 0.1);
|
|
401
|
-
renderer.compute(computeUpdate);
|
|
402
|
-
renderer.render(scene, camera);
|
|
403
|
-
}
|
|
404
|
-
```
|