@nexart/codemode-sdk 1.5.0 → 1.6.0
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 +326 -0
- package/CODE_MODE_PROTOCOL.md +471 -0
- package/LICENSE.md +62 -0
- package/README.md +296 -58
- package/builder.manifest.schema.json +62 -0
- 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 +283 -0
- package/dist/execution-sandbox.d.ts +107 -0
- package/dist/execution-sandbox.d.ts.map +1 -0
- package/dist/execution-sandbox.js +207 -0
- package/dist/index.d.ts +24 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -16
- package/dist/loop-engine.d.ts +3 -0
- package/dist/loop-engine.d.ts.map +1 -1
- package/dist/loop-engine.js +17 -7
- 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/p5-runtime.d.ts +3 -1
- package/dist/p5-runtime.d.ts.map +1 -1
- package/dist/p5-runtime.js +2 -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/static-engine.d.ts +7 -0
- package/dist/static-engine.d.ts.map +1 -1
- package/dist/static-engine.js +69 -14
- package/dist/types.d.ts +67 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +26 -15
package/README.md
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
# NexArt Code Mode Runtime SDK
|
|
2
2
|
|
|
3
|
-
**Version: 1.
|
|
3
|
+
**Version: 1.6.0 (Protocol v1.2.0)**
|
|
4
4
|
|
|
5
5
|
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
6
|
-
║ @nexart/codemode-sdk — Canonical
|
|
6
|
+
║ @nexart/codemode-sdk — Canonical Execution Surface ║
|
|
7
7
|
║ ║
|
|
8
|
-
║ This SDK
|
|
9
|
-
║ All implementations (NexArt, ByX, external) MUST use this SDK. ║
|
|
8
|
+
║ This SDK IS the protocol. All implementations MUST use this SDK. ║
|
|
10
9
|
║ ║
|
|
11
10
|
║ Protocol: nexart ║
|
|
12
11
|
║ Engine: codemode ║
|
|
13
|
-
║ SDK Version: 1.
|
|
12
|
+
║ SDK Version: 1.6.0 ║
|
|
14
13
|
║ Protocol Version: 1.2.0 ║
|
|
15
14
|
║ Phase: 3 ║
|
|
16
15
|
║ Enforcement: HARD ║
|
|
@@ -18,6 +17,15 @@
|
|
|
18
17
|
|
|
19
18
|
---
|
|
20
19
|
|
|
20
|
+
## Commercial Licensing
|
|
21
|
+
|
|
22
|
+
> **Commercial usage of NexArt Protocol requires a license.**
|
|
23
|
+
> **Enforcement is not active yet.**
|
|
24
|
+
|
|
25
|
+
The SDK is currently provided under the MIT License for all usage. A future version may introduce commercial licensing requirements. See [LICENSE.md](./LICENSE.md) for details.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
21
29
|
## PROTOCOL LOCK — v1.x
|
|
22
30
|
|
|
23
31
|
| Property | Value |
|
|
@@ -54,15 +62,86 @@ The answer is: "Whatever @nexart/codemode-sdk does — that is the protocol."
|
|
|
54
62
|
|
|
55
63
|
---
|
|
56
64
|
|
|
57
|
-
## What's New in v1.
|
|
65
|
+
## What's New in v1.6.0
|
|
66
|
+
|
|
67
|
+
**Licensing & Builder Identity Scaffolding (Metadata Only)**
|
|
68
|
+
|
|
69
|
+
This is a non-breaking, metadata-only release. No changes to execution or determinism.
|
|
70
|
+
|
|
71
|
+
### Licensing (Informational Only)
|
|
72
|
+
- Added `LICENSE.md` with draft commercial licensing terms
|
|
73
|
+
- Enforcement is NOT active — all usage currently permitted under MIT
|
|
74
|
+
|
|
75
|
+
### Builder Manifest Schema
|
|
76
|
+
- Added `builder.manifest.schema.json` for optional builder attribution
|
|
77
|
+
- Fields: `builder_id`, `project_name`, `contact`, `website`, `intended_use`
|
|
78
|
+
- This file is **optional**, **not validated**, and **not loaded at runtime**
|
|
79
|
+
|
|
80
|
+
### Documentation
|
|
81
|
+
- SDK positioned as "canonical execution surface"
|
|
82
|
+
- Explicit determinism guarantees documented
|
|
83
|
+
- Real product references (ByX, Frontierra)
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Determinism Guarantees
|
|
88
|
+
|
|
89
|
+
**The NexArt Code Mode SDK guarantees deterministic output.**
|
|
90
|
+
|
|
91
|
+
Given identical inputs:
|
|
92
|
+
- Same `source` code
|
|
93
|
+
- Same `seed`
|
|
94
|
+
- Same `vars` array
|
|
95
|
+
- Same `width` and `height`
|
|
96
|
+
- Same `mode`
|
|
97
|
+
|
|
98
|
+
The SDK will produce **byte-for-byte identical output** across all executions.
|
|
99
|
+
|
|
100
|
+
### What Breaks Determinism
|
|
101
|
+
|
|
102
|
+
The following actions will break determinism and are **blocked** by the SDK:
|
|
103
|
+
|
|
104
|
+
| Pattern | Reason | Enforcement |
|
|
105
|
+
|---------|--------|-------------|
|
|
106
|
+
| `Math.random()` | Unseeded randomness | BLOCKED |
|
|
107
|
+
| `Date.now()` | Time-based entropy | BLOCKED |
|
|
108
|
+
| `new Date()` | Time-based entropy | BLOCKED |
|
|
109
|
+
| `performance.now()` | Timing entropy | BLOCKED |
|
|
110
|
+
| `crypto.getRandomValues()` | Crypto randomness | BLOCKED |
|
|
111
|
+
| `fetch()` | External IO | BLOCKED |
|
|
112
|
+
| External imports | Uncontrolled code | BLOCKED |
|
|
113
|
+
|
|
114
|
+
Use `random()` (seeded) and `noise()` (seeded) for all randomness needs.
|
|
115
|
+
|
|
116
|
+
### Oracle Verification
|
|
117
|
+
|
|
118
|
+
Before any release, run the determinism check:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx tsx scripts/check-determinism.ts
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This compares output against a known oracle hash. If the hash changes without a protocol version bump, the release is invalid.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Products Using This SDK
|
|
129
|
+
|
|
130
|
+
- **NexArt**: Primary generative art platform
|
|
131
|
+
- **ByX**: Curated collection system
|
|
132
|
+
- **Frontierra**: External builder integration
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## v1.5.1
|
|
137
|
+
|
|
138
|
+
**Builder Manifest — Passive Attribution (Write-Only)**
|
|
58
139
|
|
|
59
|
-
|
|
140
|
+
- `registerBuilderManifest(manifest?)` — Declare builder identity for future attribution
|
|
60
141
|
|
|
61
|
-
|
|
62
|
-
- **Restored seeded Perlin noise** for `noise()`, `noiseSeed()`
|
|
63
|
-
- Full sync between SDK source and npm package
|
|
142
|
+
The Builder Manifest is a declaration of intent, not a capability. Write-only, optional, non-enforced.
|
|
64
143
|
|
|
65
|
-
|
|
144
|
+
---
|
|
66
145
|
|
|
67
146
|
## v1.4.0 (Protocol v1.2.0)
|
|
68
147
|
|
|
@@ -129,7 +208,8 @@ The SDK enforces the **NexArt Code Mode Protocol v1.2.0** for reproducible, mint
|
|
|
129
208
|
## Installation
|
|
130
209
|
|
|
131
210
|
```bash
|
|
132
|
-
|
|
211
|
+
# Copy the sdk/codemode folder to your project
|
|
212
|
+
cp -r sdk/codemode your-project/lib/codemode
|
|
133
213
|
```
|
|
134
214
|
|
|
135
215
|
---
|
|
@@ -191,8 +271,8 @@ interface ExecuteCodeModeResult {
|
|
|
191
271
|
metadata: {
|
|
192
272
|
protocol: 'nexart';
|
|
193
273
|
engine: 'codemode';
|
|
194
|
-
protocolVersion: '1.
|
|
195
|
-
phase:
|
|
274
|
+
protocolVersion: '1.0.0';
|
|
275
|
+
phase: 1;
|
|
196
276
|
deterministic: true;
|
|
197
277
|
seed: number;
|
|
198
278
|
vars: number[];
|
|
@@ -206,11 +286,67 @@ interface ExecuteCodeModeResult {
|
|
|
206
286
|
|
|
207
287
|
---
|
|
208
288
|
|
|
209
|
-
##
|
|
289
|
+
## Legacy API
|
|
290
|
+
|
|
291
|
+
> ⚠️ **Note**: The `createEngine()` API is still supported but new implementations should use `executeCodeMode()`.
|
|
292
|
+
|
|
293
|
+
### `createEngine(config: EngineConfig): Engine`
|
|
294
|
+
|
|
295
|
+
Create a rendering engine instance.
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
import { createEngine } from './codemode';
|
|
299
|
+
|
|
300
|
+
const engine = createEngine({
|
|
301
|
+
mode: 'static', // 'static' | 'loop'
|
|
302
|
+
width: 1950, // Optional, default: 1950
|
|
303
|
+
height: 2400, // Optional, default: 2400
|
|
304
|
+
duration: 2, // Loop mode only, 1-4 seconds
|
|
305
|
+
fps: 30, // Loop mode only, default: 30
|
|
306
|
+
});
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### `engine.run(options: RunOptions): Promise<void>`
|
|
310
|
+
|
|
311
|
+
Execute code and produce output.
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
await engine.run({
|
|
315
|
+
code: `
|
|
316
|
+
function setup() {
|
|
317
|
+
background(255);
|
|
318
|
+
fill(0);
|
|
319
|
+
// Use VAR for external control
|
|
320
|
+
let size = map(VAR[0], 0, 100, 50, 200);
|
|
321
|
+
ellipse(width/2, height/2, size);
|
|
322
|
+
}
|
|
323
|
+
`,
|
|
324
|
+
seed: 12345, // Optional: seed for deterministic randomness
|
|
325
|
+
vars: [50, 75, 0, 0, 0, 0, 0, 0, 0, 0], // Optional: VAR[0..9] values (0-100)
|
|
326
|
+
onPreview: (canvas) => {
|
|
327
|
+
// Optional: called with canvas after first frame
|
|
328
|
+
},
|
|
329
|
+
onProgress: (info) => {
|
|
330
|
+
// Optional: progress updates
|
|
331
|
+
console.log(info.message, info.percent + '%');
|
|
332
|
+
},
|
|
333
|
+
onComplete: (result) => {
|
|
334
|
+
// Required: called with final result
|
|
335
|
+
console.log(result.type); // 'image' | 'video'
|
|
336
|
+
console.log(result.blob); // Blob
|
|
337
|
+
},
|
|
338
|
+
onError: (error) => {
|
|
339
|
+
// Optional: called on error
|
|
340
|
+
console.error(error);
|
|
341
|
+
},
|
|
342
|
+
});
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Protocol Variables (VAR[0..9]) — Protocol v1.0.0
|
|
210
346
|
|
|
211
347
|
Protocol variables are first-class inputs that control artwork parameters.
|
|
212
348
|
|
|
213
|
-
**VAR Specification:**
|
|
349
|
+
**VAR Specification (SDK v1.0.2):**
|
|
214
350
|
|
|
215
351
|
| Property | Value | Enforcement |
|
|
216
352
|
|----------|-------|-------------|
|
|
@@ -224,7 +360,20 @@ Protocol variables are first-class inputs that control artwork parameters.
|
|
|
224
360
|
| Default | All zeros | If not provided |
|
|
225
361
|
|
|
226
362
|
```typescript
|
|
227
|
-
//
|
|
363
|
+
// Pass values when running (0-10 elements)
|
|
364
|
+
await engine.run({
|
|
365
|
+
code: myCode,
|
|
366
|
+
vars: [80, 50, 25], // VAR[0]=80, VAR[1]=50, VAR[2]=25, VAR[3..9]=0
|
|
367
|
+
onComplete: (result) => { /* ... */ },
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
// Or omit entirely (all zeros)
|
|
371
|
+
await engine.run({
|
|
372
|
+
code: myCode,
|
|
373
|
+
onComplete: (result) => { /* ... */ },
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
// Access in sketch code
|
|
228
377
|
function setup() {
|
|
229
378
|
let density = map(VAR[0], 0, 100, 10, 200);
|
|
230
379
|
let speed = map(VAR[1], 0, 100, 0.5, 5);
|
|
@@ -240,6 +389,14 @@ function setup() {
|
|
|
240
389
|
- Values MUST be in range 0-100 (throws if out of range)
|
|
241
390
|
- Same code + same seed + same VARs = identical output
|
|
242
391
|
|
|
392
|
+
### `engine.stop(): void`
|
|
393
|
+
|
|
394
|
+
Cancel a running render (Loop mode only).
|
|
395
|
+
|
|
396
|
+
### `engine.getConfig(): EngineConfig`
|
|
397
|
+
|
|
398
|
+
Get the resolved engine configuration.
|
|
399
|
+
|
|
243
400
|
---
|
|
244
401
|
|
|
245
402
|
## Execution Rules
|
|
@@ -267,7 +424,6 @@ function setup() {
|
|
|
267
424
|
| `t` | float | Normalized time [0.0, 1.0) |
|
|
268
425
|
| `time` | float | Elapsed seconds |
|
|
269
426
|
| `tGlobal` | float | Alias for `t` |
|
|
270
|
-
| `totalFrames` | int | Total frames in loop (v1.4.0+) |
|
|
271
427
|
|
|
272
428
|
---
|
|
273
429
|
|
|
@@ -296,6 +452,76 @@ Additionally in Loop Mode:
|
|
|
296
452
|
|
|
297
453
|
---
|
|
298
454
|
|
|
455
|
+
## Example: Static Mode
|
|
456
|
+
|
|
457
|
+
```typescript
|
|
458
|
+
import { createEngine } from './codemode';
|
|
459
|
+
|
|
460
|
+
const engine = createEngine({ mode: 'static' });
|
|
461
|
+
|
|
462
|
+
await engine.run({
|
|
463
|
+
code: `
|
|
464
|
+
function setup() {
|
|
465
|
+
background(30);
|
|
466
|
+
noStroke();
|
|
467
|
+
for (let i = 0; i < 100; i++) {
|
|
468
|
+
fill(random(255), random(255), random(255));
|
|
469
|
+
ellipse(random(width), random(height), 50);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
`,
|
|
473
|
+
onComplete: (result) => {
|
|
474
|
+
// result.type === 'image'
|
|
475
|
+
// result.blob is a PNG Blob
|
|
476
|
+
const url = URL.createObjectURL(result.blob);
|
|
477
|
+
document.body.innerHTML = `<img src="${url}" />`;
|
|
478
|
+
},
|
|
479
|
+
});
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
## Example: Loop Mode
|
|
485
|
+
|
|
486
|
+
```typescript
|
|
487
|
+
import { createEngine } from './codemode';
|
|
488
|
+
|
|
489
|
+
const engine = createEngine({
|
|
490
|
+
mode: 'loop',
|
|
491
|
+
duration: 2, // 2 second loop
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
await engine.run({
|
|
495
|
+
code: `
|
|
496
|
+
function setup() {
|
|
497
|
+
// Called once
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function draw() {
|
|
501
|
+
background(30);
|
|
502
|
+
|
|
503
|
+
// t goes from 0 to 1 over the loop duration
|
|
504
|
+
let x = width/2 + cos(t * TWO_PI) * 200;
|
|
505
|
+
let y = height/2 + sin(t * TWO_PI) * 200;
|
|
506
|
+
|
|
507
|
+
fill(255);
|
|
508
|
+
ellipse(x, y, 80);
|
|
509
|
+
}
|
|
510
|
+
`,
|
|
511
|
+
onProgress: (info) => {
|
|
512
|
+
console.log(info.message);
|
|
513
|
+
},
|
|
514
|
+
onComplete: (result) => {
|
|
515
|
+
// result.type === 'video'
|
|
516
|
+
// result.blob is an MP4 Blob
|
|
517
|
+
const url = URL.createObjectURL(result.blob);
|
|
518
|
+
document.body.innerHTML = `<video src="${url}" autoplay loop />`;
|
|
519
|
+
},
|
|
520
|
+
});
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
299
525
|
## Supported Functions
|
|
300
526
|
|
|
301
527
|
The SDK includes a comprehensive p5.js-like runtime with 130+ functions:
|
|
@@ -360,21 +586,41 @@ All of the following are accepted by `fill()`, `stroke()`, `background()`:
|
|
|
360
586
|
|
|
361
587
|
---
|
|
362
588
|
|
|
363
|
-
##
|
|
589
|
+
## Video Encoding
|
|
364
590
|
|
|
365
|
-
|
|
591
|
+
Loop Mode requires server-side video encoding. The SDK calls:
|
|
366
592
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
593
|
+
```
|
|
594
|
+
POST /api/encode-loop
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
Ensure your server has this endpoint available (NexArt provides this).
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
## Files
|
|
602
|
+
|
|
603
|
+
```
|
|
604
|
+
sdk/codemode/
|
|
605
|
+
├── index.ts # Main export
|
|
606
|
+
├── execute.ts # executeCodeMode canonical entry point
|
|
607
|
+
├── engine.ts # createEngine entry point (legacy)
|
|
608
|
+
├── types.ts # TypeScript types
|
|
609
|
+
├── static-engine.ts # Static mode implementation
|
|
610
|
+
├── loop-engine.ts # Loop mode implementation
|
|
611
|
+
├── p5-runtime.ts # p5.js-like runtime
|
|
612
|
+
├── builder-manifest.ts # Builder manifest (write-only)
|
|
613
|
+
├── CHANGELOG.md # Version history
|
|
614
|
+
└── README.md # This file
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
---
|
|
618
|
+
|
|
619
|
+
## License
|
|
620
|
+
|
|
621
|
+
MIT License
|
|
622
|
+
|
|
623
|
+
Copyright (c) 2024-2026 NexArt
|
|
378
624
|
|
|
379
625
|
---
|
|
380
626
|
|
|
@@ -397,7 +643,7 @@ const result = await executeCodeMode({
|
|
|
397
643
|
width: 1950,
|
|
398
644
|
height: 2400,
|
|
399
645
|
seed: 12345,
|
|
400
|
-
vars: [50, 75, 25, 0, 0, 0, 0, 0, 0, 0],
|
|
646
|
+
vars: [50, 75, 25, 0, 0, 0, 0, 0, 0, 0], // Exactly 10 values
|
|
401
647
|
mode: 'static'
|
|
402
648
|
});
|
|
403
649
|
|
|
@@ -423,35 +669,27 @@ try {
|
|
|
423
669
|
|
|
424
670
|
---
|
|
425
671
|
|
|
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
|
-
---
|
|
672
|
+
## Frozen Execution Guarantees — v1.0.0
|
|
437
673
|
|
|
438
|
-
|
|
674
|
+
The following guarantees are LOCKED and will not change in v1.x:
|
|
439
675
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
676
|
+
| Guarantee | Description |
|
|
677
|
+
|-----------|-------------|
|
|
678
|
+
| Determinism | Same code + same seed + same VARs = identical output |
|
|
679
|
+
| Static Mode | `setup()` only, single PNG output |
|
|
680
|
+
| Loop Mode | Frame-authoritative, `draw()` per frame, MP4 output |
|
|
681
|
+
| Time Semantics | `t` ∈ [0,1), `frameCount` ∈ [0,totalFrames), `time` in seconds |
|
|
682
|
+
| Random | Seeded Mulberry32 PRNG via `random()` |
|
|
683
|
+
| Noise | Seeded Perlin noise via `noise()` |
|
|
684
|
+
| Canvas | Pre-initialized, no `createCanvas()` |
|
|
685
|
+
| VAR | Exactly 10 read-only protocol variables |
|
|
686
|
+
| Forbidden Patterns | 13 patterns rejected (see above) |
|
|
450
687
|
|
|
451
688
|
---
|
|
452
689
|
|
|
453
|
-
##
|
|
454
|
-
|
|
455
|
-
MIT License
|
|
690
|
+
## Future Work (Phase 4+)
|
|
456
691
|
|
|
457
|
-
|
|
692
|
+
- External asset loading (controlled)
|
|
693
|
+
- WebGL/3D rendering support
|
|
694
|
+
- GIF output option
|
|
695
|
+
- GSL v1 SDK (protocol layer) — separate package
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://nexart.art/schemas/builder.manifest.json",
|
|
4
|
+
"title": "NexArt Builder Manifest",
|
|
5
|
+
"description": "Optional metadata file for builder attribution. NOT validated, NOT required, NOT enforced.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"protocol": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"const": "nexart",
|
|
11
|
+
"description": "Protocol identifier (must be 'nexart')"
|
|
12
|
+
},
|
|
13
|
+
"manifest_version": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Version of this manifest schema",
|
|
16
|
+
"default": "1.0"
|
|
17
|
+
},
|
|
18
|
+
"builder_id": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Unique identifier for the builder (self-assigned)"
|
|
21
|
+
},
|
|
22
|
+
"project_name": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Name of the project or application"
|
|
25
|
+
},
|
|
26
|
+
"description": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "Brief description of the project"
|
|
29
|
+
},
|
|
30
|
+
"contact": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "Contact email or handle"
|
|
33
|
+
},
|
|
34
|
+
"website": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"format": "uri",
|
|
37
|
+
"description": "Project website URL"
|
|
38
|
+
},
|
|
39
|
+
"intended_use": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"enum": ["art", "game", "research", "commercial", "education", "other"],
|
|
42
|
+
"description": "Primary intended use case"
|
|
43
|
+
},
|
|
44
|
+
"sdk_version": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Version of @nexart/codemode-sdk being used"
|
|
47
|
+
},
|
|
48
|
+
"features": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"description": "Optional feature flags",
|
|
51
|
+
"additionalProperties": {
|
|
52
|
+
"type": "boolean"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"metadata": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"description": "Arbitrary additional metadata",
|
|
58
|
+
"additionalProperties": true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"additionalProperties": true
|
|
62
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NexArt Code Mode SDK - Builder Manifest
|
|
3
|
+
* Version: 1.6.0 (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"}
|