@nexart/codemode-sdk 1.5.0 → 1.5.1
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 +289 -0
- package/CODE_MODE_PROTOCOL.md +471 -0
- package/README.md +232 -55
- package/dist/builder-manifest.d.ts +79 -0
- package/dist/builder-manifest.d.ts.map +1 -0
- package/dist/builder-manifest.js +97 -0
- package/dist/core-index.d.ts +21 -0
- package/dist/core-index.d.ts.map +1 -0
- package/dist/core-index.js +26 -0
- package/dist/engine.d.ts +17 -39
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +52 -253
- package/dist/execute.d.ts +46 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/execute.js +282 -0
- package/dist/index.d.ts +24 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -16
- package/dist/noise-bridge.d.ts +44 -0
- package/dist/noise-bridge.d.ts.map +1 -0
- package/dist/noise-bridge.js +68 -0
- package/dist/noise-engine.d.ts +74 -0
- package/dist/noise-engine.d.ts.map +1 -0
- package/dist/noise-engine.js +132 -0
- package/dist/noise-sketches/fractalNoise.d.ts +11 -0
- package/dist/noise-sketches/fractalNoise.d.ts.map +1 -0
- package/dist/noise-sketches/fractalNoise.js +121 -0
- package/dist/noise-sketches/index.d.ts +21 -0
- package/dist/noise-sketches/index.d.ts.map +1 -0
- package/dist/noise-sketches/index.js +28 -0
- package/dist/sound-bridge.d.ts +89 -0
- package/dist/sound-bridge.d.ts.map +1 -0
- package/dist/sound-bridge.js +128 -0
- package/dist/soundart-engine.d.ts +87 -0
- package/dist/soundart-engine.d.ts.map +1 -0
- package/dist/soundart-engine.js +173 -0
- package/dist/soundart-sketches/chladniBloom.d.ts +3 -0
- package/dist/soundart-sketches/chladniBloom.d.ts.map +1 -0
- package/dist/soundart-sketches/chladniBloom.js +53 -0
- package/dist/soundart-sketches/dualVortex.d.ts +3 -0
- package/dist/soundart-sketches/dualVortex.d.ts.map +1 -0
- package/dist/soundart-sketches/dualVortex.js +67 -0
- package/dist/soundart-sketches/geometryIllusion.d.ts +3 -0
- package/dist/soundart-sketches/geometryIllusion.d.ts.map +1 -0
- package/dist/soundart-sketches/geometryIllusion.js +89 -0
- package/dist/soundart-sketches/index.d.ts +39 -0
- package/dist/soundart-sketches/index.d.ts.map +1 -0
- package/dist/soundart-sketches/index.js +72 -0
- package/dist/soundart-sketches/isoflow.d.ts +3 -0
- package/dist/soundart-sketches/isoflow.d.ts.map +1 -0
- package/dist/soundart-sketches/isoflow.js +60 -0
- package/dist/soundart-sketches/loomWeave.d.ts +3 -0
- package/dist/soundart-sketches/loomWeave.d.ts.map +1 -0
- package/dist/soundart-sketches/loomWeave.js +59 -0
- package/dist/soundart-sketches/noiseTerraces.d.ts +3 -0
- package/dist/soundart-sketches/noiseTerraces.d.ts.map +1 -0
- package/dist/soundart-sketches/noiseTerraces.js +53 -0
- package/dist/soundart-sketches/orb.d.ts +3 -0
- package/dist/soundart-sketches/orb.d.ts.map +1 -0
- package/dist/soundart-sketches/orb.js +50 -0
- package/dist/soundart-sketches/pixelGlyphs.d.ts +3 -0
- package/dist/soundart-sketches/pixelGlyphs.d.ts.map +1 -0
- package/dist/soundart-sketches/pixelGlyphs.js +72 -0
- package/dist/soundart-sketches/prismFlowFields.d.ts +3 -0
- package/dist/soundart-sketches/prismFlowFields.d.ts.map +1 -0
- package/dist/soundart-sketches/prismFlowFields.js +51 -0
- package/dist/soundart-sketches/radialBurst.d.ts +3 -0
- package/dist/soundart-sketches/radialBurst.d.ts.map +1 -0
- package/dist/soundart-sketches/radialBurst.js +60 -0
- package/dist/soundart-sketches/resonantSoundBodies.d.ts +3 -0
- package/dist/soundart-sketches/resonantSoundBodies.d.ts.map +1 -0
- package/dist/soundart-sketches/resonantSoundBodies.js +89 -0
- package/dist/soundart-sketches/rings.d.ts +11 -0
- package/dist/soundart-sketches/rings.d.ts.map +1 -0
- package/dist/soundart-sketches/rings.js +89 -0
- package/dist/soundart-sketches/squares.d.ts +3 -0
- package/dist/soundart-sketches/squares.d.ts.map +1 -0
- package/dist/soundart-sketches/squares.js +52 -0
- package/dist/soundart-sketches/waveStripes.d.ts +3 -0
- package/dist/soundart-sketches/waveStripes.d.ts.map +1 -0
- package/dist/soundart-sketches/waveStripes.js +44 -0
- package/dist/types.d.ts +41 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +24 -15
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# NexArt Code Mode Runtime SDK
|
|
2
2
|
|
|
3
|
-
**Version: 1.5.
|
|
3
|
+
**Version: 1.5.1 (Protocol v1.2.0)**
|
|
4
4
|
|
|
5
5
|
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
6
6
|
║ @nexart/codemode-sdk — Canonical Code Mode Authority ║
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
║ ║
|
|
11
11
|
║ Protocol: nexart ║
|
|
12
12
|
║ Engine: codemode ║
|
|
13
|
-
║ SDK Version: 1.5.
|
|
13
|
+
║ SDK Version: 1.5.1 ║
|
|
14
14
|
║ Protocol Version: 1.2.0 ║
|
|
15
15
|
║ Phase: 3 ║
|
|
16
16
|
║ Enforcement: HARD ║
|
|
@@ -54,15 +54,33 @@ The answer is: "Whatever @nexart/codemode-sdk does — that is the protocol."
|
|
|
54
54
|
|
|
55
55
|
---
|
|
56
56
|
|
|
57
|
-
## What's New in v1.5.
|
|
57
|
+
## What's New in v1.5.1
|
|
58
58
|
|
|
59
|
-
**
|
|
59
|
+
**Builder Manifest — Passive Attribution (Write-Only)**
|
|
60
60
|
|
|
61
|
-
-
|
|
62
|
-
- **Restored seeded Perlin noise** for `noise()`, `noiseSeed()`
|
|
63
|
-
- Full sync between SDK source and npm package
|
|
61
|
+
- `registerBuilderManifest(manifest?)` — Declare builder identity for future attribution
|
|
64
62
|
|
|
65
|
-
The
|
|
63
|
+
**The Builder Manifest is a declaration of intent, not a capability.**
|
|
64
|
+
|
|
65
|
+
The SDK does not expose any API to read or inspect manifests. This is:
|
|
66
|
+
- **Declarative** — Write-only, no read API exposed
|
|
67
|
+
- **Optional** — No errors if missing or invalid
|
|
68
|
+
- **Non-enforced** — No validation logic
|
|
69
|
+
- **Non-rewarding** — No incentives, no tracking
|
|
70
|
+
|
|
71
|
+
There is NO SDK API to read manifests, NO validation, NO attribution logic, and NO tracking. Execution behavior is identical with or without a manifest registered.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { registerBuilderManifest } from '@nexart/codemode-sdk';
|
|
75
|
+
|
|
76
|
+
registerBuilderManifest({
|
|
77
|
+
protocol: 'nexart',
|
|
78
|
+
manifestVersion: '0.1',
|
|
79
|
+
app: { name: 'My App', url: 'https://myapp.com' }
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
66
84
|
|
|
67
85
|
## v1.4.0 (Protocol v1.2.0)
|
|
68
86
|
|
|
@@ -129,7 +147,8 @@ The SDK enforces the **NexArt Code Mode Protocol v1.2.0** for reproducible, mint
|
|
|
129
147
|
## Installation
|
|
130
148
|
|
|
131
149
|
```bash
|
|
132
|
-
|
|
150
|
+
# Copy the sdk/codemode folder to your project
|
|
151
|
+
cp -r sdk/codemode your-project/lib/codemode
|
|
133
152
|
```
|
|
134
153
|
|
|
135
154
|
---
|
|
@@ -191,8 +210,8 @@ interface ExecuteCodeModeResult {
|
|
|
191
210
|
metadata: {
|
|
192
211
|
protocol: 'nexart';
|
|
193
212
|
engine: 'codemode';
|
|
194
|
-
protocolVersion: '1.
|
|
195
|
-
phase:
|
|
213
|
+
protocolVersion: '1.0.0';
|
|
214
|
+
phase: 1;
|
|
196
215
|
deterministic: true;
|
|
197
216
|
seed: number;
|
|
198
217
|
vars: number[];
|
|
@@ -206,11 +225,67 @@ interface ExecuteCodeModeResult {
|
|
|
206
225
|
|
|
207
226
|
---
|
|
208
227
|
|
|
209
|
-
##
|
|
228
|
+
## Legacy API
|
|
229
|
+
|
|
230
|
+
> ⚠️ **Note**: The `createEngine()` API is still supported but new implementations should use `executeCodeMode()`.
|
|
231
|
+
|
|
232
|
+
### `createEngine(config: EngineConfig): Engine`
|
|
233
|
+
|
|
234
|
+
Create a rendering engine instance.
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
import { createEngine } from './codemode';
|
|
238
|
+
|
|
239
|
+
const engine = createEngine({
|
|
240
|
+
mode: 'static', // 'static' | 'loop'
|
|
241
|
+
width: 1950, // Optional, default: 1950
|
|
242
|
+
height: 2400, // Optional, default: 2400
|
|
243
|
+
duration: 2, // Loop mode only, 1-4 seconds
|
|
244
|
+
fps: 30, // Loop mode only, default: 30
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### `engine.run(options: RunOptions): Promise<void>`
|
|
249
|
+
|
|
250
|
+
Execute code and produce output.
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
await engine.run({
|
|
254
|
+
code: `
|
|
255
|
+
function setup() {
|
|
256
|
+
background(255);
|
|
257
|
+
fill(0);
|
|
258
|
+
// Use VAR for external control
|
|
259
|
+
let size = map(VAR[0], 0, 100, 50, 200);
|
|
260
|
+
ellipse(width/2, height/2, size);
|
|
261
|
+
}
|
|
262
|
+
`,
|
|
263
|
+
seed: 12345, // Optional: seed for deterministic randomness
|
|
264
|
+
vars: [50, 75, 0, 0, 0, 0, 0, 0, 0, 0], // Optional: VAR[0..9] values (0-100)
|
|
265
|
+
onPreview: (canvas) => {
|
|
266
|
+
// Optional: called with canvas after first frame
|
|
267
|
+
},
|
|
268
|
+
onProgress: (info) => {
|
|
269
|
+
// Optional: progress updates
|
|
270
|
+
console.log(info.message, info.percent + '%');
|
|
271
|
+
},
|
|
272
|
+
onComplete: (result) => {
|
|
273
|
+
// Required: called with final result
|
|
274
|
+
console.log(result.type); // 'image' | 'video'
|
|
275
|
+
console.log(result.blob); // Blob
|
|
276
|
+
},
|
|
277
|
+
onError: (error) => {
|
|
278
|
+
// Optional: called on error
|
|
279
|
+
console.error(error);
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Protocol Variables (VAR[0..9]) — Protocol v1.0.0
|
|
210
285
|
|
|
211
286
|
Protocol variables are first-class inputs that control artwork parameters.
|
|
212
287
|
|
|
213
|
-
**VAR Specification:**
|
|
288
|
+
**VAR Specification (SDK v1.0.2):**
|
|
214
289
|
|
|
215
290
|
| Property | Value | Enforcement |
|
|
216
291
|
|----------|-------|-------------|
|
|
@@ -224,7 +299,20 @@ Protocol variables are first-class inputs that control artwork parameters.
|
|
|
224
299
|
| Default | All zeros | If not provided |
|
|
225
300
|
|
|
226
301
|
```typescript
|
|
227
|
-
//
|
|
302
|
+
// Pass values when running (0-10 elements)
|
|
303
|
+
await engine.run({
|
|
304
|
+
code: myCode,
|
|
305
|
+
vars: [80, 50, 25], // VAR[0]=80, VAR[1]=50, VAR[2]=25, VAR[3..9]=0
|
|
306
|
+
onComplete: (result) => { /* ... */ },
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// Or omit entirely (all zeros)
|
|
310
|
+
await engine.run({
|
|
311
|
+
code: myCode,
|
|
312
|
+
onComplete: (result) => { /* ... */ },
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// Access in sketch code
|
|
228
316
|
function setup() {
|
|
229
317
|
let density = map(VAR[0], 0, 100, 10, 200);
|
|
230
318
|
let speed = map(VAR[1], 0, 100, 0.5, 5);
|
|
@@ -240,6 +328,14 @@ function setup() {
|
|
|
240
328
|
- Values MUST be in range 0-100 (throws if out of range)
|
|
241
329
|
- Same code + same seed + same VARs = identical output
|
|
242
330
|
|
|
331
|
+
### `engine.stop(): void`
|
|
332
|
+
|
|
333
|
+
Cancel a running render (Loop mode only).
|
|
334
|
+
|
|
335
|
+
### `engine.getConfig(): EngineConfig`
|
|
336
|
+
|
|
337
|
+
Get the resolved engine configuration.
|
|
338
|
+
|
|
243
339
|
---
|
|
244
340
|
|
|
245
341
|
## Execution Rules
|
|
@@ -267,7 +363,6 @@ function setup() {
|
|
|
267
363
|
| `t` | float | Normalized time [0.0, 1.0) |
|
|
268
364
|
| `time` | float | Elapsed seconds |
|
|
269
365
|
| `tGlobal` | float | Alias for `t` |
|
|
270
|
-
| `totalFrames` | int | Total frames in loop (v1.4.0+) |
|
|
271
366
|
|
|
272
367
|
---
|
|
273
368
|
|
|
@@ -296,6 +391,76 @@ Additionally in Loop Mode:
|
|
|
296
391
|
|
|
297
392
|
---
|
|
298
393
|
|
|
394
|
+
## Example: Static Mode
|
|
395
|
+
|
|
396
|
+
```typescript
|
|
397
|
+
import { createEngine } from './codemode';
|
|
398
|
+
|
|
399
|
+
const engine = createEngine({ mode: 'static' });
|
|
400
|
+
|
|
401
|
+
await engine.run({
|
|
402
|
+
code: `
|
|
403
|
+
function setup() {
|
|
404
|
+
background(30);
|
|
405
|
+
noStroke();
|
|
406
|
+
for (let i = 0; i < 100; i++) {
|
|
407
|
+
fill(random(255), random(255), random(255));
|
|
408
|
+
ellipse(random(width), random(height), 50);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
`,
|
|
412
|
+
onComplete: (result) => {
|
|
413
|
+
// result.type === 'image'
|
|
414
|
+
// result.blob is a PNG Blob
|
|
415
|
+
const url = URL.createObjectURL(result.blob);
|
|
416
|
+
document.body.innerHTML = `<img src="${url}" />`;
|
|
417
|
+
},
|
|
418
|
+
});
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Example: Loop Mode
|
|
424
|
+
|
|
425
|
+
```typescript
|
|
426
|
+
import { createEngine } from './codemode';
|
|
427
|
+
|
|
428
|
+
const engine = createEngine({
|
|
429
|
+
mode: 'loop',
|
|
430
|
+
duration: 2, // 2 second loop
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
await engine.run({
|
|
434
|
+
code: `
|
|
435
|
+
function setup() {
|
|
436
|
+
// Called once
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function draw() {
|
|
440
|
+
background(30);
|
|
441
|
+
|
|
442
|
+
// t goes from 0 to 1 over the loop duration
|
|
443
|
+
let x = width/2 + cos(t * TWO_PI) * 200;
|
|
444
|
+
let y = height/2 + sin(t * TWO_PI) * 200;
|
|
445
|
+
|
|
446
|
+
fill(255);
|
|
447
|
+
ellipse(x, y, 80);
|
|
448
|
+
}
|
|
449
|
+
`,
|
|
450
|
+
onProgress: (info) => {
|
|
451
|
+
console.log(info.message);
|
|
452
|
+
},
|
|
453
|
+
onComplete: (result) => {
|
|
454
|
+
// result.type === 'video'
|
|
455
|
+
// result.blob is an MP4 Blob
|
|
456
|
+
const url = URL.createObjectURL(result.blob);
|
|
457
|
+
document.body.innerHTML = `<video src="${url}" autoplay loop />`;
|
|
458
|
+
},
|
|
459
|
+
});
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
299
464
|
## Supported Functions
|
|
300
465
|
|
|
301
466
|
The SDK includes a comprehensive p5.js-like runtime with 130+ functions:
|
|
@@ -360,21 +525,41 @@ All of the following are accepted by `fill()`, `stroke()`, `background()`:
|
|
|
360
525
|
|
|
361
526
|
---
|
|
362
527
|
|
|
363
|
-
##
|
|
528
|
+
## Video Encoding
|
|
364
529
|
|
|
365
|
-
|
|
530
|
+
Loop Mode requires server-side video encoding. The SDK calls:
|
|
366
531
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
532
|
+
```
|
|
533
|
+
POST /api/encode-loop
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
Ensure your server has this endpoint available (NexArt provides this).
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
## Files
|
|
541
|
+
|
|
542
|
+
```
|
|
543
|
+
sdk/codemode/
|
|
544
|
+
├── index.ts # Main export
|
|
545
|
+
├── execute.ts # executeCodeMode canonical entry point
|
|
546
|
+
├── engine.ts # createEngine entry point (legacy)
|
|
547
|
+
├── types.ts # TypeScript types
|
|
548
|
+
├── static-engine.ts # Static mode implementation
|
|
549
|
+
├── loop-engine.ts # Loop mode implementation
|
|
550
|
+
├── p5-runtime.ts # p5.js-like runtime
|
|
551
|
+
├── builder-manifest.ts # Builder manifest (write-only)
|
|
552
|
+
├── CHANGELOG.md # Version history
|
|
553
|
+
└── README.md # This file
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## License
|
|
559
|
+
|
|
560
|
+
MIT License
|
|
561
|
+
|
|
562
|
+
Copyright (c) 2024-2026 NexArt
|
|
378
563
|
|
|
379
564
|
---
|
|
380
565
|
|
|
@@ -397,7 +582,7 @@ const result = await executeCodeMode({
|
|
|
397
582
|
width: 1950,
|
|
398
583
|
height: 2400,
|
|
399
584
|
seed: 12345,
|
|
400
|
-
vars: [50, 75, 25, 0, 0, 0, 0, 0, 0, 0],
|
|
585
|
+
vars: [50, 75, 25, 0, 0, 0, 0, 0, 0, 0], // Exactly 10 values
|
|
401
586
|
mode: 'static'
|
|
402
587
|
});
|
|
403
588
|
|
|
@@ -423,35 +608,27 @@ try {
|
|
|
423
608
|
|
|
424
609
|
---
|
|
425
610
|
|
|
426
|
-
##
|
|
427
|
-
|
|
428
|
-
Loop Mode requires server-side video encoding. The SDK calls:
|
|
429
|
-
|
|
430
|
-
```
|
|
431
|
-
POST /api/encode-loop
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
Ensure your server has this endpoint available (NexArt provides this).
|
|
435
|
-
|
|
436
|
-
---
|
|
611
|
+
## Frozen Execution Guarantees — v1.0.0
|
|
437
612
|
|
|
438
|
-
|
|
613
|
+
The following guarantees are LOCKED and will not change in v1.x:
|
|
439
614
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
615
|
+
| Guarantee | Description |
|
|
616
|
+
|-----------|-------------|
|
|
617
|
+
| Determinism | Same code + same seed + same VARs = identical output |
|
|
618
|
+
| Static Mode | `setup()` only, single PNG output |
|
|
619
|
+
| Loop Mode | Frame-authoritative, `draw()` per frame, MP4 output |
|
|
620
|
+
| Time Semantics | `t` ∈ [0,1), `frameCount` ∈ [0,totalFrames), `time` in seconds |
|
|
621
|
+
| Random | Seeded Mulberry32 PRNG via `random()` |
|
|
622
|
+
| Noise | Seeded Perlin noise via `noise()` |
|
|
623
|
+
| Canvas | Pre-initialized, no `createCanvas()` |
|
|
624
|
+
| VAR | Exactly 10 read-only protocol variables |
|
|
625
|
+
| Forbidden Patterns | 13 patterns rejected (see above) |
|
|
450
626
|
|
|
451
627
|
---
|
|
452
628
|
|
|
453
|
-
##
|
|
454
|
-
|
|
455
|
-
MIT License
|
|
629
|
+
## Future Work (Phase 4+)
|
|
456
630
|
|
|
457
|
-
|
|
631
|
+
- External asset loading (controlled)
|
|
632
|
+
- WebGL/3D rendering support
|
|
633
|
+
- GIF output option
|
|
634
|
+
- GSL v1 SDK (protocol layer) — separate package
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NexArt Code Mode SDK - Builder Manifest
|
|
3
|
+
* Version: 1.5.1 (Protocol v1.2.0)
|
|
4
|
+
*
|
|
5
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
6
|
+
* ║ BUILDER MANIFEST — PASSIVE ATTRIBUTION (WRITE-ONLY) ║
|
|
7
|
+
* ║ ║
|
|
8
|
+
* ║ The Builder Manifest is a declaration of intent, not a capability. ║
|
|
9
|
+
* ║ The SDK does not expose any API to read or inspect manifests. ║
|
|
10
|
+
* ║ ║
|
|
11
|
+
* ║ This is: ║
|
|
12
|
+
* ║ - Declarative (write-only, no read API exposed) ║
|
|
13
|
+
* ║ - Optional (no errors if missing or invalid) ║
|
|
14
|
+
* ║ - Non-enforced (no validation logic) ║
|
|
15
|
+
* ║ - Non-rewarding (no incentives, no tracking) ║
|
|
16
|
+
* ║ ║
|
|
17
|
+
* ║ There is: ║
|
|
18
|
+
* ║ - No SDK API to read manifests ║
|
|
19
|
+
* ║ - No validation ║
|
|
20
|
+
* ║ - No attribution logic ║
|
|
21
|
+
* ║ - No tracking, analytics, or network calls ║
|
|
22
|
+
* ║ ║
|
|
23
|
+
* ║ Execution behavior is identical with or without a manifest. ║
|
|
24
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
25
|
+
*/
|
|
26
|
+
import type { NexArtBuilderManifest } from './types';
|
|
27
|
+
/**
|
|
28
|
+
* Register a builder manifest for attribution.
|
|
29
|
+
*
|
|
30
|
+
* This is optional and does not affect execution behavior.
|
|
31
|
+
* The manifest is stored in-memory only and is not:
|
|
32
|
+
* - Serialized to disk
|
|
33
|
+
* - Sent over the network
|
|
34
|
+
* - Logged to console
|
|
35
|
+
* - Used for validation or enforcement
|
|
36
|
+
*
|
|
37
|
+
* @param manifest - Optional builder manifest. Pass undefined to clear.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { registerBuilderManifest } from "@nexart/codemode-sdk";
|
|
42
|
+
*
|
|
43
|
+
* registerBuilderManifest({
|
|
44
|
+
* protocol: "nexart",
|
|
45
|
+
* manifestVersion: "0.1",
|
|
46
|
+
* app: { name: "My App", url: "https://myapp.com" }
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function registerBuilderManifest(manifest?: NexArtBuilderManifest): void;
|
|
51
|
+
/**
|
|
52
|
+
* Get the currently registered builder manifest.
|
|
53
|
+
*
|
|
54
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
55
|
+
* ║ INTERNAL FUNCTION — NOT EXPORTED TO SDK CONSUMERS ║
|
|
56
|
+
* ║ ║
|
|
57
|
+
* ║ This function exists only for internal SDK execution context. ║
|
|
58
|
+
* ║ It is NOT part of the public API and must NOT be exported from index. ║
|
|
59
|
+
* ║ Runtime code and sketch code cannot access this function. ║
|
|
60
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
61
|
+
*
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export declare function getBuilderManifest(): NexArtBuilderManifest | null;
|
|
65
|
+
/**
|
|
66
|
+
* Clear the registered builder manifest.
|
|
67
|
+
*
|
|
68
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
69
|
+
* ║ INTERNAL FUNCTION — NOT EXPORTED TO SDK CONSUMERS ║
|
|
70
|
+
* ║ ║
|
|
71
|
+
* ║ This function exists only for internal SDK execution context. ║
|
|
72
|
+
* ║ It is NOT part of the public API and must NOT be exported from index. ║
|
|
73
|
+
* ║ Runtime code and sketch code cannot access this function. ║
|
|
74
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
75
|
+
*
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
export declare function clearBuilderManifest(): void;
|
|
79
|
+
//# sourceMappingURL=builder-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder-manifest.d.ts","sourceRoot":"","sources":["../builder-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAiB9E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,IAAI,qBAAqB,GAAG,IAAI,CAEjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NexArt Code Mode SDK - Builder Manifest
|
|
3
|
+
* Version: 1.5.1 (Protocol v1.2.0)
|
|
4
|
+
*
|
|
5
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
6
|
+
* ║ BUILDER MANIFEST — PASSIVE ATTRIBUTION (WRITE-ONLY) ║
|
|
7
|
+
* ║ ║
|
|
8
|
+
* ║ The Builder Manifest is a declaration of intent, not a capability. ║
|
|
9
|
+
* ║ The SDK does not expose any API to read or inspect manifests. ║
|
|
10
|
+
* ║ ║
|
|
11
|
+
* ║ This is: ║
|
|
12
|
+
* ║ - Declarative (write-only, no read API exposed) ║
|
|
13
|
+
* ║ - Optional (no errors if missing or invalid) ║
|
|
14
|
+
* ║ - Non-enforced (no validation logic) ║
|
|
15
|
+
* ║ - Non-rewarding (no incentives, no tracking) ║
|
|
16
|
+
* ║ ║
|
|
17
|
+
* ║ There is: ║
|
|
18
|
+
* ║ - No SDK API to read manifests ║
|
|
19
|
+
* ║ - No validation ║
|
|
20
|
+
* ║ - No attribution logic ║
|
|
21
|
+
* ║ - No tracking, analytics, or network calls ║
|
|
22
|
+
* ║ ║
|
|
23
|
+
* ║ Execution behavior is identical with or without a manifest. ║
|
|
24
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
25
|
+
*/
|
|
26
|
+
/** Internal storage - not accessible to SDK consumers */
|
|
27
|
+
let currentManifest = null;
|
|
28
|
+
/**
|
|
29
|
+
* Register a builder manifest for attribution.
|
|
30
|
+
*
|
|
31
|
+
* This is optional and does not affect execution behavior.
|
|
32
|
+
* The manifest is stored in-memory only and is not:
|
|
33
|
+
* - Serialized to disk
|
|
34
|
+
* - Sent over the network
|
|
35
|
+
* - Logged to console
|
|
36
|
+
* - Used for validation or enforcement
|
|
37
|
+
*
|
|
38
|
+
* @param manifest - Optional builder manifest. Pass undefined to clear.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { registerBuilderManifest } from "@nexart/codemode-sdk";
|
|
43
|
+
*
|
|
44
|
+
* registerBuilderManifest({
|
|
45
|
+
* protocol: "nexart",
|
|
46
|
+
* manifestVersion: "0.1",
|
|
47
|
+
* app: { name: "My App", url: "https://myapp.com" }
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export function registerBuilderManifest(manifest) {
|
|
52
|
+
if (!manifest) {
|
|
53
|
+
currentManifest = null;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (manifest.protocol !== 'nexart') {
|
|
57
|
+
currentManifest = null;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (typeof manifest.manifestVersion !== 'string') {
|
|
61
|
+
currentManifest = null;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
currentManifest = manifest;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the currently registered builder manifest.
|
|
68
|
+
*
|
|
69
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
70
|
+
* ║ INTERNAL FUNCTION — NOT EXPORTED TO SDK CONSUMERS ║
|
|
71
|
+
* ║ ║
|
|
72
|
+
* ║ This function exists only for internal SDK execution context. ║
|
|
73
|
+
* ║ It is NOT part of the public API and must NOT be exported from index. ║
|
|
74
|
+
* ║ Runtime code and sketch code cannot access this function. ║
|
|
75
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
76
|
+
*
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
export function getBuilderManifest() {
|
|
80
|
+
return currentManifest;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Clear the registered builder manifest.
|
|
84
|
+
*
|
|
85
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
86
|
+
* ║ INTERNAL FUNCTION — NOT EXPORTED TO SDK CONSUMERS ║
|
|
87
|
+
* ║ ║
|
|
88
|
+
* ║ This function exists only for internal SDK execution context. ║
|
|
89
|
+
* ║ It is NOT part of the public API and must NOT be exported from index. ║
|
|
90
|
+
* ║ Runtime code and sketch code cannot access this function. ║
|
|
91
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
export function clearBuilderManifest() {
|
|
96
|
+
currentManifest = null;
|
|
97
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nexart/codemode-sdk v1.4.0 — Core Exports
|
|
3
|
+
*
|
|
4
|
+
* Canonical execution engine for NexArt Code Mode.
|
|
5
|
+
* This is the single source of truth for Code Mode semantics.
|
|
6
|
+
*
|
|
7
|
+
* Protocol: v1.2.0 (Phase 3)
|
|
8
|
+
* Enforcement: HARD
|
|
9
|
+
*/
|
|
10
|
+
export { executeCodeMode, validateCodeModeSource, } from './execute';
|
|
11
|
+
export { type RenderMode, type TimeVariables, type ProtocolMetadata, type EngineConfig, type RenderResult, type RunOptions, type ProgressInfo, type Engine, type ExecuteCodeModeInput, type ExecuteCodeModeResult, PROTOCOL_IDENTITY, DEFAULT_VARS, DEFAULT_CONFIG, } from './types';
|
|
12
|
+
export { createP5Runtime, injectTimeVariables, createProtocolVAR, VAR_COUNT, VAR_MIN, VAR_MAX, CODE_MODE_PROTOCOL_VERSION, CODE_MODE_PROTOCOL_PHASE, CODE_MODE_ENFORCEMENT, type P5Runtime, type P5RuntimeConfig, } from './p5-runtime';
|
|
13
|
+
export { runStaticMode, } from './static-engine';
|
|
14
|
+
export { runLoopMode, cancelLoopMode, } from './loop-engine';
|
|
15
|
+
export { createEngine, } from './engine';
|
|
16
|
+
/**
|
|
17
|
+
* SDK Identity
|
|
18
|
+
*/
|
|
19
|
+
export declare const SDK_VERSION = "1.1.1";
|
|
20
|
+
export declare const SDK_NAME = "@nexart/codemode-sdk";
|
|
21
|
+
//# sourceMappingURL=core-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-index.d.ts","sourceRoot":"","sources":["../core-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,OAAO,EACP,OAAO,EACP,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,WAAW,EACX,cAAc,GACf,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,GACb,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,eAAO,MAAM,WAAW,UAAU,CAAC;AACnC,eAAO,MAAM,QAAQ,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nexart/codemode-sdk v1.4.0 — Core Exports
|
|
3
|
+
*
|
|
4
|
+
* Canonical execution engine for NexArt Code Mode.
|
|
5
|
+
* This is the single source of truth for Code Mode semantics.
|
|
6
|
+
*
|
|
7
|
+
* Protocol: v1.2.0 (Phase 3)
|
|
8
|
+
* Enforcement: HARD
|
|
9
|
+
*/
|
|
10
|
+
// Core execution
|
|
11
|
+
export { executeCodeMode, validateCodeModeSource, } from './execute';
|
|
12
|
+
// Protocol types
|
|
13
|
+
export { PROTOCOL_IDENTITY, DEFAULT_VARS, DEFAULT_CONFIG, } from './types';
|
|
14
|
+
// Runtime
|
|
15
|
+
export { createP5Runtime, injectTimeVariables, createProtocolVAR, VAR_COUNT, VAR_MIN, VAR_MAX, CODE_MODE_PROTOCOL_VERSION, CODE_MODE_PROTOCOL_PHASE, CODE_MODE_ENFORCEMENT, } from './p5-runtime';
|
|
16
|
+
// Static engine
|
|
17
|
+
export { runStaticMode, } from './static-engine';
|
|
18
|
+
// Loop engine
|
|
19
|
+
export { runLoopMode, cancelLoopMode, } from './loop-engine';
|
|
20
|
+
// Engine utilities
|
|
21
|
+
export { createEngine, } from './engine';
|
|
22
|
+
/**
|
|
23
|
+
* SDK Identity
|
|
24
|
+
*/
|
|
25
|
+
export const SDK_VERSION = '1.1.1';
|
|
26
|
+
export const SDK_NAME = '@nexart/codemode-sdk';
|