@nexart/codemode-sdk 1.8.1 → 1.8.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.
Files changed (137) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/LICENSE.md +5 -5
  3. package/README.md +72 -11
  4. package/dist/sdk/codemode/core-index.d.ts +6 -4
  5. package/dist/sdk/codemode/core-index.d.ts.map +1 -1
  6. package/dist/sdk/codemode/core-index.js +6 -4
  7. package/dist/{entry → sdk/codemode/entry}/browser.d.ts +5 -2
  8. package/dist/sdk/codemode/entry/browser.d.ts.map +1 -0
  9. package/dist/{entry → sdk/codemode/entry}/browser.js +10 -4
  10. package/dist/{entry → sdk/codemode/entry}/node.d.ts +2 -1
  11. package/dist/sdk/codemode/entry/node.d.ts.map +1 -0
  12. package/dist/{entry → sdk/codemode/entry}/node.js +2 -1
  13. package/dist/{runtime.d.ts → sdk/codemode/runtime.d.ts} +2 -2
  14. package/dist/sdk/codemode/runtime.d.ts.map +1 -0
  15. package/dist/{runtime.js → sdk/codemode/runtime.js} +3 -2
  16. package/dist/sdk/codemode/static-engine.d.ts.map +1 -1
  17. package/dist/sdk/codemode/static-engine.js +24 -11
  18. package/dist/sdk/codemode/version.d.ts +18 -0
  19. package/dist/sdk/codemode/version.d.ts.map +1 -0
  20. package/dist/sdk/codemode/version.js +17 -0
  21. package/examples/agent-quickstart.ts +159 -0
  22. package/examples/preflight-test.ts +1 -1
  23. package/package.json +2 -1
  24. package/dist/builder-manifest.d.ts +0 -79
  25. package/dist/builder-manifest.d.ts.map +0 -1
  26. package/dist/builder-manifest.js +0 -97
  27. package/dist/core-index.d.ts +0 -21
  28. package/dist/core-index.d.ts.map +0 -1
  29. package/dist/core-index.js +0 -26
  30. package/dist/engine.d.ts +0 -24
  31. package/dist/engine.d.ts.map +0 -1
  32. package/dist/engine.js +0 -67
  33. package/dist/entry/browser.d.ts.map +0 -1
  34. package/dist/entry/node.d.ts.map +0 -1
  35. package/dist/execute.d.ts +0 -46
  36. package/dist/execute.d.ts.map +0 -1
  37. package/dist/execute.js +0 -283
  38. package/dist/execution-sandbox.d.ts +0 -107
  39. package/dist/execution-sandbox.d.ts.map +0 -1
  40. package/dist/execution-sandbox.js +0 -207
  41. package/dist/index.d.ts +0 -31
  42. package/dist/index.d.ts.map +0 -1
  43. package/dist/index.js +0 -63
  44. package/dist/loop-engine.d.ts +0 -22
  45. package/dist/loop-engine.d.ts.map +0 -1
  46. package/dist/loop-engine.js +0 -229
  47. package/dist/noise-bridge.d.ts +0 -44
  48. package/dist/noise-bridge.d.ts.map +0 -1
  49. package/dist/noise-bridge.js +0 -68
  50. package/dist/noise-engine.d.ts +0 -74
  51. package/dist/noise-engine.d.ts.map +0 -1
  52. package/dist/noise-engine.js +0 -132
  53. package/dist/noise-sketches/fractalNoise.d.ts +0 -11
  54. package/dist/noise-sketches/fractalNoise.d.ts.map +0 -1
  55. package/dist/noise-sketches/fractalNoise.js +0 -121
  56. package/dist/noise-sketches/index.d.ts +0 -21
  57. package/dist/noise-sketches/index.d.ts.map +0 -1
  58. package/dist/noise-sketches/index.js +0 -28
  59. package/dist/p5-runtime.d.ts +0 -75
  60. package/dist/p5-runtime.d.ts.map +0 -1
  61. package/dist/p5-runtime.js +0 -1031
  62. package/dist/runtime.d.ts.map +0 -1
  63. package/dist/sdk/codemode/index.d.ts +0 -31
  64. package/dist/sdk/codemode/index.d.ts.map +0 -1
  65. package/dist/sdk/codemode/index.js +0 -63
  66. package/dist/sdk/codemode/noise-bridge.d.ts +0 -44
  67. package/dist/sdk/codemode/noise-bridge.d.ts.map +0 -1
  68. package/dist/sdk/codemode/noise-bridge.js +0 -68
  69. package/dist/sdk/codemode/noise-engine.d.ts +0 -74
  70. package/dist/sdk/codemode/noise-engine.d.ts.map +0 -1
  71. package/dist/sdk/codemode/noise-engine.js +0 -132
  72. package/dist/sdk/codemode/noise-sketches/fractalNoise.d.ts +0 -11
  73. package/dist/sdk/codemode/noise-sketches/fractalNoise.d.ts.map +0 -1
  74. package/dist/sdk/codemode/noise-sketches/fractalNoise.js +0 -121
  75. package/dist/sdk/codemode/noise-sketches/index.d.ts +0 -21
  76. package/dist/sdk/codemode/noise-sketches/index.d.ts.map +0 -1
  77. package/dist/sdk/codemode/noise-sketches/index.js +0 -28
  78. package/dist/shared/noiseSnapshot.d.ts +0 -59
  79. package/dist/shared/noiseSnapshot.d.ts.map +0 -1
  80. package/dist/shared/noiseSnapshot.js +0 -72
  81. package/dist/sound-bridge.d.ts +0 -89
  82. package/dist/sound-bridge.d.ts.map +0 -1
  83. package/dist/sound-bridge.js +0 -128
  84. package/dist/soundart-engine.d.ts +0 -87
  85. package/dist/soundart-engine.d.ts.map +0 -1
  86. package/dist/soundart-engine.js +0 -173
  87. package/dist/soundart-sketches/chladniBloom.d.ts +0 -3
  88. package/dist/soundart-sketches/chladniBloom.d.ts.map +0 -1
  89. package/dist/soundart-sketches/chladniBloom.js +0 -53
  90. package/dist/soundart-sketches/dualVortex.d.ts +0 -3
  91. package/dist/soundart-sketches/dualVortex.d.ts.map +0 -1
  92. package/dist/soundart-sketches/dualVortex.js +0 -67
  93. package/dist/soundart-sketches/geometryIllusion.d.ts +0 -3
  94. package/dist/soundart-sketches/geometryIllusion.d.ts.map +0 -1
  95. package/dist/soundart-sketches/geometryIllusion.js +0 -89
  96. package/dist/soundart-sketches/index.d.ts +0 -39
  97. package/dist/soundart-sketches/index.d.ts.map +0 -1
  98. package/dist/soundart-sketches/index.js +0 -72
  99. package/dist/soundart-sketches/isoflow.d.ts +0 -3
  100. package/dist/soundart-sketches/isoflow.d.ts.map +0 -1
  101. package/dist/soundart-sketches/isoflow.js +0 -60
  102. package/dist/soundart-sketches/loomWeave.d.ts +0 -3
  103. package/dist/soundart-sketches/loomWeave.d.ts.map +0 -1
  104. package/dist/soundart-sketches/loomWeave.js +0 -59
  105. package/dist/soundart-sketches/noiseTerraces.d.ts +0 -3
  106. package/dist/soundart-sketches/noiseTerraces.d.ts.map +0 -1
  107. package/dist/soundart-sketches/noiseTerraces.js +0 -53
  108. package/dist/soundart-sketches/orb.d.ts +0 -3
  109. package/dist/soundart-sketches/orb.d.ts.map +0 -1
  110. package/dist/soundart-sketches/orb.js +0 -50
  111. package/dist/soundart-sketches/pixelGlyphs.d.ts +0 -3
  112. package/dist/soundart-sketches/pixelGlyphs.d.ts.map +0 -1
  113. package/dist/soundart-sketches/pixelGlyphs.js +0 -72
  114. package/dist/soundart-sketches/prismFlowFields.d.ts +0 -3
  115. package/dist/soundart-sketches/prismFlowFields.d.ts.map +0 -1
  116. package/dist/soundart-sketches/prismFlowFields.js +0 -51
  117. package/dist/soundart-sketches/radialBurst.d.ts +0 -3
  118. package/dist/soundart-sketches/radialBurst.d.ts.map +0 -1
  119. package/dist/soundart-sketches/radialBurst.js +0 -60
  120. package/dist/soundart-sketches/resonantSoundBodies.d.ts +0 -3
  121. package/dist/soundart-sketches/resonantSoundBodies.d.ts.map +0 -1
  122. package/dist/soundart-sketches/resonantSoundBodies.js +0 -89
  123. package/dist/soundart-sketches/rings.d.ts +0 -11
  124. package/dist/soundart-sketches/rings.d.ts.map +0 -1
  125. package/dist/soundart-sketches/rings.js +0 -89
  126. package/dist/soundart-sketches/squares.d.ts +0 -3
  127. package/dist/soundart-sketches/squares.d.ts.map +0 -1
  128. package/dist/soundart-sketches/squares.js +0 -52
  129. package/dist/soundart-sketches/waveStripes.d.ts +0 -3
  130. package/dist/soundart-sketches/waveStripes.d.ts.map +0 -1
  131. package/dist/soundart-sketches/waveStripes.js +0 -44
  132. package/dist/static-engine.d.ts +0 -20
  133. package/dist/static-engine.d.ts.map +0 -1
  134. package/dist/static-engine.js +0 -157
  135. package/dist/types.d.ts +0 -191
  136. package/dist/types.d.ts.map +0 -1
  137. package/dist/types.js +0 -32
package/CHANGELOG.md CHANGED
@@ -4,6 +4,52 @@ All notable changes to @nexart/codemode-sdk will be documented in this file.
4
4
 
5
5
  ---
6
6
 
7
+ ## [1.8.2] — 2026-01-24
8
+
9
+ ### Changed — AI Agent Adoption Friction Reduction
10
+
11
+ **Non-Breaking, Documentation-Only Release**
12
+
13
+ This release addresses external review feedback (Grok/Lovable/Replit) about AI agent adoption friction. No runtime, API, or behavior changes. Protocol remains v1.2.0.
14
+
15
+ #### Agent Quickstart Example Added
16
+ - **New `examples/agent-quickstart.ts`** — Copy-paste ready reference for AI agents
17
+ - Uses ONLY `createRuntime()` (modern, agent-first API)
18
+ - No canvas, no p5, browser-safe
19
+ - Demonstrates: seed → runtime → deterministic ops → digest → verification
20
+ - Shows strict mode enforcement and error handling
21
+
22
+ #### Documentation Clarified — Entrypoint Selection
23
+ - **"Which API should I use?"** section added to README
24
+ - Decision table: `createRuntime()` vs `executeCodeMode()`
25
+ - Clear guidance: `createRuntime()` = DEFAULT, `executeCodeMode()` = legacy/node-only
26
+ - **"For AI coding agents"** section expanded with:
27
+ - Quick rules: always `createRuntime()`, never `Math.random()`, always `strict: true`
28
+ - Link to `examples/agent-quickstart.ts`
29
+ - Detailed strict mode explanation (why it exists, scoping, restoration)
30
+
31
+ #### Version Consistency Pass
32
+ - **New `version.ts`** — Single source of truth for SDK_VERSION, PROTOCOL_VERSION, PROTOCOL_PHASE
33
+ - All programmatic exports (runtime.ts, core-index.ts, entry/browser.ts) now import from version.ts
34
+ - Eliminates version drift between package.json, runtime exports, and documentation
35
+ - All documentation updated to reference version 1.8.2
36
+ - README, CHANGELOG, package.json all synchronized
37
+
38
+ #### Package Updates
39
+ - **Version**: 1.8.2
40
+ - **New script**: `npm run example:agent` — Run agent quickstart example
41
+
42
+ ### Unchanged
43
+
44
+ - No changes to runtime behavior
45
+ - No changes to APIs or exports
46
+ - No changes to protocol version (remains v1.2.0)
47
+ - No changes to determinism guarantees
48
+ - No changes to strict mode enforcement
49
+ - Full backward compatibility with v1.8.1
50
+
51
+ ---
52
+
7
53
  ## [1.8.1] — 2026-01-24
8
54
 
9
55
  ### Changed — Documentation & Licensing Clarity
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  NexArt Code Mode SDK — License
2
2
 
3
- Version: 1.6.0
3
+ See package.json for current version
4
4
  Status: DRAFT — Enforcement Not Active
5
5
 
6
6
 
@@ -20,10 +20,10 @@ Future Commercial Licensing (Not Active)
20
20
  NexArt intends to introduce a separate commercial license for specific categories of usage in a future release.
21
21
 
22
22
  Planned commercial usage categories may include (non-exhaustive):
23
- Minting NFTs for sale
24
- Revenue-generating applications
25
- Products or services that charge fees
26
- Enterprise or business deployments
23
+ Minting NFTs for sale
24
+ Revenue-generating applications
25
+ Products or services that charge fees
26
+ Enterprise or business deployments
27
27
 
28
28
  Enforcement is NOT active.
29
29
 
package/README.md CHANGED
@@ -1,11 +1,38 @@
1
1
  # @nexart/codemode-sdk
2
2
 
3
- **Version: 1.8.1 (Protocol v1.2.0)**
3
+ **Version: 1.8.2 (Protocol v1.2.0)**
4
4
 
5
5
  A deterministic execution runtime for reproducible, verifiable computation.
6
6
 
7
7
  ---
8
8
 
9
+ ## Which API Should I Use?
10
+
11
+ **Decision table for choosing the right entrypoint:**
12
+
13
+ | Your Goal | Use This | Import Path |
14
+ |-----------|----------|-------------|
15
+ | Deterministic random/noise in any environment | **`createRuntime()`** ✅ DEFAULT | `@nexart/codemode-sdk` |
16
+ | AI agent integration | **`createRuntime()`** ✅ DEFAULT | `@nexart/codemode-sdk` |
17
+ | Browser/React/Vite app | **`createRuntime()`** ✅ DEFAULT | `@nexart/codemode-sdk` |
18
+ | Server-side image rendering | `executeCodeMode()` | `@nexart/codemode-sdk/node` |
19
+ | Full p5.js-style canvas execution | `executeCodeMode()` | `@nexart/codemode-sdk/node` |
20
+
21
+ **`createRuntime()`** is the **default and recommended** API:
22
+ - ✅ Works in browser and Node.js
23
+ - ✅ No canvas dependency
24
+ - ✅ Agent-first design
25
+ - ✅ Strict mode enforcement
26
+ - ✅ Lightweight
27
+
28
+ **`executeCodeMode()`** is the **legacy / Node-only** API:
29
+ - Requires Node.js with `canvas` package
30
+ - Full p5.js-style execution environment
31
+ - Returns rendered PNG/MP4
32
+ - Use only when you need actual image/video output
33
+
34
+ ---
35
+
9
36
  ## What This SDK Does
10
37
 
11
38
  This SDK provides a **deterministic runtime layer** for executing code that must produce identical output given identical inputs — across environments, over time, and under verification.
@@ -42,7 +69,16 @@ For most applications, seeded randomness is unnecessary complexity.
42
69
 
43
70
  ## For AI Coding Agents (Replit / Lovable / Claude Code)
44
71
 
45
- **Use `createRuntime({ seed, strict: true })` for deterministic execution.**
72
+ **Always start with `createRuntime()` it is the default and recommended API.**
73
+
74
+ ### Quick Rules for AI Agents
75
+
76
+ 1. **Always use `createRuntime()`** — NOT `executeCodeMode()`
77
+ 2. **Never use `Math.random()` or `Date.now()`** — use `runtime.random()` instead
78
+ 3. **Always use `strict: true`** — unless you explicitly know why you aren't
79
+ 4. **See `examples/agent-quickstart.ts`** — copy-paste ready reference
80
+
81
+ ### Minimal Example
46
82
 
47
83
  ```typescript
48
84
  import { createRuntime } from "@nexart/codemode-sdk";
@@ -50,23 +86,47 @@ import { createRuntime } from "@nexart/codemode-sdk";
50
86
  const runtime = createRuntime({
51
87
  seed: "my-artwork-42",
52
88
  vars: [50, 75, 25],
53
- strict: true, // Throws on Math.random, Date.now, etc.
89
+ strict: true, // ALWAYS use strict: true — throws on non-deterministic APIs
54
90
  mode: "static"
55
91
  });
56
92
 
57
- // Deterministic APIs
93
+ // Deterministic APIs (use these, not Math.random!)
58
94
  const value = runtime.random(); // [0, 1)
59
95
  const intVal = runtime.randomInt(0, 10); // integer in range
60
- const n = runtime.noise(x, y); // Perlin noise
96
+ const n = runtime.noise(0.5, 0.5); // Perlin noise
97
+
98
+ // Execute with strict enforcement
99
+ const result = runtime.run(() => {
100
+ // Your deterministic code here
101
+ return runtime.random() * 100;
102
+ });
61
103
 
62
104
  // Verification
63
- console.log(runtime.digest()); // Stable hash
64
- console.log(runtime.getState()); // Canonical state snapshot
105
+ console.log(runtime.digest()); // Stable hash for verification
106
+ console.log(runtime.getState()); // Canonical state snapshot for replay
107
+ ```
108
+
109
+ ### Strict Mode Explained
110
+
111
+ Strict mode protects determinism by intercepting non-deterministic APIs during `runtime.run()`:
112
+
113
+ ```typescript
114
+ runtime.run(() => {
115
+ Math.random(); // Throws: NEXART_STRICT: Non-deterministic API used: Math.random. Use runtime.random() instead.
116
+ Date.now(); // Throws: NEXART_STRICT: Non-deterministic API used: Date.now. Pass time as an input or use deterministic counters.
117
+ });
65
118
  ```
66
119
 
67
- **Strict mode throws actionable errors:**
68
- - `NEXART_STRICT: Non-deterministic API used: Math.random. Use runtime.random() instead.`
69
- - `NEXART_STRICT: Non-deterministic API used: Date.now. Pass time as an input or use deterministic counters.`
120
+ **Why strict mode exists:**
121
+ - Determinism is the core guarantee same inputs must always produce same outputs
122
+ - AI agents often default to `Math.random()` before reading documentation
123
+ - Strict mode catches these mistakes immediately with actionable error messages
124
+ - Interception is **scoped to `runtime.run()`** — it does NOT globally mutate your application
125
+ - Globals are restored after execution
126
+
127
+ **When to use `strict: false`:**
128
+ - Almost never. Only if you're intentionally mixing deterministic and non-deterministic code.
129
+ - If you're not sure, use `strict: true`.
70
130
 
71
131
  ---
72
132
 
@@ -176,7 +236,7 @@ These are examples — the SDK is designed for any system requiring deterministi
176
236
  |----------|-------|
177
237
  | Protocol Version | v1.2.0 |
178
238
  | Status | **STABLE** |
179
- | SDK Version | 1.8.1 |
239
+ | SDK Version | 1.8.2 |
180
240
 
181
241
  **Core protocol surface is frozen. Breaking changes require v2.0.0.**
182
242
 
@@ -377,6 +437,7 @@ The following are rejected with `[Code Mode Protocol Error]`:
377
437
  ## Examples
378
438
 
379
439
  ```bash
440
+ npm run example:agent # Agent quickstart (RECOMMENDED for AI agents)
380
441
  npm run example:basic # Basic usage
381
442
  npm run example:verify # Determinism verification
382
443
  ```
@@ -1,12 +1,13 @@
1
1
  /**
2
- * @nexart/codemode-sdk v1.4.0 — Core Exports
2
+ * @nexart/codemode-sdk — Core Exports
3
+ * See version.ts for SDK version (single source of truth)
3
4
  *
4
5
  * Canonical execution engine for NexArt Code Mode.
5
6
  * This is the single source of truth for Code Mode semantics.
6
7
  *
7
- * Protocol: v1.2.0 (Phase 3)
8
8
  * Enforcement: HARD
9
9
  */
10
+ import { PROTOCOL_VERSION, PROTOCOL_PHASE } from './version';
10
11
  export { executeCodeMode, validateCodeModeSource, } from './execute';
11
12
  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
13
  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';
@@ -14,8 +15,9 @@ export { runStaticMode, } from './static-engine';
14
15
  export { runLoopMode, cancelLoopMode, } from './loop-engine';
15
16
  export { createEngine, } from './engine';
16
17
  /**
17
- * SDK Identity
18
+ * SDK Identity — imported from version.ts (single source of truth)
18
19
  */
19
- export declare const SDK_VERSION = "1.1.1";
20
+ export declare const SDK_VERSION = "1.8.2";
20
21
  export declare const SDK_NAME = "@nexart/codemode-sdk";
22
+ export { PROTOCOL_VERSION, PROTOCOL_PHASE };
21
23
  //# sourceMappingURL=core-index.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"core-index.d.ts","sourceRoot":"","sources":["../../../core-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAA+B,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG1F,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,UAAe,CAAC;AACxC,eAAO,MAAM,QAAQ,yBAAyB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,CAAC"}
@@ -1,12 +1,13 @@
1
1
  /**
2
- * @nexart/codemode-sdk v1.4.0 — Core Exports
2
+ * @nexart/codemode-sdk — Core Exports
3
+ * See version.ts for SDK version (single source of truth)
3
4
  *
4
5
  * Canonical execution engine for NexArt Code Mode.
5
6
  * This is the single source of truth for Code Mode semantics.
6
7
  *
7
- * Protocol: v1.2.0 (Phase 3)
8
8
  * Enforcement: HARD
9
9
  */
10
+ import { SDK_VERSION as _SDK_VERSION, PROTOCOL_VERSION, PROTOCOL_PHASE } from './version';
10
11
  // Core execution
11
12
  export { executeCodeMode, validateCodeModeSource, } from './execute';
12
13
  // Protocol types
@@ -20,7 +21,8 @@ export { runLoopMode, cancelLoopMode, } from './loop-engine';
20
21
  // Engine utilities
21
22
  export { createEngine, } from './engine';
22
23
  /**
23
- * SDK Identity
24
+ * SDK Identity — imported from version.ts (single source of truth)
24
25
  */
25
- export const SDK_VERSION = '1.1.1';
26
+ export const SDK_VERSION = _SDK_VERSION;
26
27
  export const SDK_NAME = '@nexart/codemode-sdk';
28
+ export { PROTOCOL_VERSION, PROTOCOL_PHASE };
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @nexart/codemode-sdk/browser — Browser-Safe Entry Point
3
+ * See ../version.ts for SDK version (single source of truth)
3
4
  *
4
5
  * ╔══════════════════════════════════════════════════════════════════════════╗
5
- * ║ BROWSER-SAFE SDK ENTRY POINT (v1.8.0)
6
+ * ║ BROWSER-SAFE SDK ENTRY POINT
6
7
  * ║ ║
7
8
  * ║ This entrypoint exports ONLY browser-safe modules. ║
8
9
  * ║ It does NOT include static-engine or any Node.js dependencies. ║
@@ -25,7 +26,9 @@ export { createEngine, } from '../engine';
25
26
  export { registerBuilderManifest, } from '../builder-manifest';
26
27
  export { createRuntime, NexArtRuntime, RUNTIME_VERSION, } from '../runtime';
27
28
  export type { RuntimeOptions, RuntimeState, NexArtRuntime as NexArtRuntimeType, } from '../runtime';
28
- export declare const SDK_VERSION = "1.8.0";
29
+ export { renderSoundArtViaCodeMode, canRenderViaCodeMode, getCodeModeAvailableStyles, } from '../soundart-engine';
30
+ export type { TweakParams, SoundArtEngineConfig, SoundArtRenderOptions, SoundArtRenderResult, SoundArtMetadata, SoundSnapshot, SoundFeatures, SoundArtSketchName, } from '../soundart-engine';
31
+ export declare const SDK_VERSION = "1.8.2";
29
32
  export declare const SDK_NAME = "@nexart/codemode-sdk";
30
33
  export declare const SDK_ENTRY = "browser";
31
34
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../entry/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,YAAY,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,cAAc,GACf,MAAM,UAAU,CAAC;AAKlB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,OAAO,EACP,OAAO,EACP,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,SAAS,EACT,eAAe,GAChB,MAAM,eAAe,CAAC;AAKvB,OAAO,EACL,WAAW,EACX,cAAc,GACf,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EACL,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAKpB,OAAO,EACL,YAAY,GACb,MAAM,WAAW,CAAC;AAKnB,OAAO,EACL,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,cAAc,EACd,YAAY,EACZ,aAAa,IAAI,iBAAiB,GACnC,MAAM,YAAY,CAAC;AAKpB,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAK5B,eAAO,MAAM,WAAW,UAAe,CAAC;AACxC,eAAO,MAAM,QAAQ,yBAAyB,CAAC;AAC/C,eAAO,MAAM,SAAS,YAAY,CAAC;AAEnC;;;;;;;;;;;GAWG"}
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @nexart/codemode-sdk/browser — Browser-Safe Entry Point
3
+ * See ../version.ts for SDK version (single source of truth)
3
4
  *
4
5
  * ╔══════════════════════════════════════════════════════════════════════════╗
5
- * ║ BROWSER-SAFE SDK ENTRY POINT (v1.8.0)
6
+ * ║ BROWSER-SAFE SDK ENTRY POINT
6
7
  * ║ ║
7
8
  * ║ This entrypoint exports ONLY browser-safe modules. ║
8
9
  * ║ It does NOT include static-engine or any Node.js dependencies. ║
@@ -14,6 +15,7 @@
14
15
  * ║ AI AGENTS: Start with createRuntime({ seed, strict: true }) ║
15
16
  * ╚══════════════════════════════════════════════════════════════════════════╝
16
17
  */
18
+ import { SDK_VERSION as _SDK_VERSION } from '../version';
17
19
  export { PROTOCOL_IDENTITY, DEFAULT_VARS, DEFAULT_CONFIG, } from '../types';
18
20
  // ═══════════════════════════════════════════════════════════════════════════
19
21
  // EXECUTION SANDBOX — Browser-safe (no Node dependencies)
@@ -40,13 +42,17 @@ export { createEngine, } from '../engine';
40
42
  // ═══════════════════════════════════════════════════════════════════════════
41
43
  export { registerBuilderManifest, } from '../builder-manifest';
42
44
  // ═══════════════════════════════════════════════════════════════════════════
43
- // AGENT-FIRST RUNTIME — v1.8.0 (Browser-safe, no Node dependencies)
45
+ // AGENT-FIRST RUNTIME — Browser-safe, no Node dependencies
44
46
  // ═══════════════════════════════════════════════════════════════════════════
45
47
  export { createRuntime, NexArtRuntime, RUNTIME_VERSION, } from '../runtime';
46
48
  // ═══════════════════════════════════════════════════════════════════════════
47
- // SDK IDENTITY
49
+ // SOUNDART ENGINE — Browser-safe (canvas-based rendering)
48
50
  // ═══════════════════════════════════════════════════════════════════════════
49
- export const SDK_VERSION = '1.8.0';
51
+ export { renderSoundArtViaCodeMode, canRenderViaCodeMode, getCodeModeAvailableStyles, } from '../soundart-engine';
52
+ // ═══════════════════════════════════════════════════════════════════════════
53
+ // SDK IDENTITY — imported from version.ts (single source of truth)
54
+ // ═══════════════════════════════════════════════════════════════════════════
55
+ export const SDK_VERSION = _SDK_VERSION;
50
56
  export const SDK_NAME = '@nexart/codemode-sdk';
51
57
  export const SDK_ENTRY = 'browser';
52
58
  /**
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @nexart/codemode-sdk/node — Node.js Entry Point
3
+ * See ../version.ts for SDK version (single source of truth)
3
4
  *
4
5
  * ╔══════════════════════════════════════════════════════════════════════════╗
5
- * ║ NODE.JS SDK ENTRY POINT (v1.8.0)
6
+ * ║ NODE.JS SDK ENTRY POINT
6
7
  * ║ ║
7
8
  * ║ This entrypoint exports Node.js-specific modules that require: ║
8
9
  * ║ - canvas package (node-canvas) ║
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../entry/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,cAAc,WAAW,CAAC;AAK1B,OAAO,EACL,aAAa,GACd,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,eAAe,GAChB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAClD,eAAO,MAAM,SAAS,SAAS,CAAC"}
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @nexart/codemode-sdk/node — Node.js Entry Point
3
+ * See ../version.ts for SDK version (single source of truth)
3
4
  *
4
5
  * ╔══════════════════════════════════════════════════════════════════════════╗
5
- * ║ NODE.JS SDK ENTRY POINT (v1.8.0)
6
+ * ║ NODE.JS SDK ENTRY POINT
6
7
  * ║ ║
7
8
  * ║ This entrypoint exports Node.js-specific modules that require: ║
8
9
  * ║ - canvas package (node-canvas) ║
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * NexArt Code Mode SDK - Agent-First Runtime Authority Layer
3
- * Version: 1.8.0 (Protocol v1.2.0)
3
+ * See version.ts for SDK version (single source of truth)
4
4
  *
5
5
  * ╔══════════════════════════════════════════════════════════════════════════╗
6
6
  * ║ AGENT-FIRST RUNTIME — DETERMINISTIC EXECUTION AUTHORITY ║
@@ -18,7 +18,7 @@
18
18
  * ║ BROWSER-SAFE: No Node.js dependencies. Works in Vite/Next/React. ║
19
19
  * ╚══════════════════════════════════════════════════════════════════════════╝
20
20
  */
21
- export declare const RUNTIME_VERSION = "1.8.0";
21
+ export declare const RUNTIME_VERSION = "1.8.2";
22
22
  export interface RuntimeOptions {
23
23
  seed: string | number;
24
24
  vars?: number[];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,eAAO,MAAM,eAAe,UAAc,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,IAAI,MAAM,CAAC;IACjB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5C,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9C,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjD,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IACvB,MAAM,IAAI,MAAM,CAAC;IACjB,QAAQ,IAAI,YAAY,CAAC;IACzB,OAAO,IAAI,MAAM,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAqGD,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,aAAa,CAuHpE;AAED,eAAO,MAAM,aAAa;;;CAGzB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * NexArt Code Mode SDK - Agent-First Runtime Authority Layer
3
- * Version: 1.8.0 (Protocol v1.2.0)
3
+ * See version.ts for SDK version (single source of truth)
4
4
  *
5
5
  * ╔══════════════════════════════════════════════════════════════════════════╗
6
6
  * ║ AGENT-FIRST RUNTIME — DETERMINISTIC EXECUTION AUTHORITY ║
@@ -18,7 +18,8 @@
18
18
  * ║ BROWSER-SAFE: No Node.js dependencies. Works in Vite/Next/React. ║
19
19
  * ╚══════════════════════════════════════════════════════════════════════════╝
20
20
  */
21
- export const RUNTIME_VERSION = '1.8.0';
21
+ import { SDK_VERSION } from './version';
22
+ export const RUNTIME_VERSION = SDK_VERSION;
22
23
  function hashSeed(seed) {
23
24
  if (typeof seed === 'number') {
24
25
  return Math.floor(seed) >>> 0;
@@ -1 +1 @@
1
- {"version":3,"file":"static-engine.d.ts","sourceRoot":"","sources":["../../../static-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAgB,MAAM,SAAS,CAAC;AAoCtE,wBAAsB,aAAa,CACjC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC,CA6Hf"}
1
+ {"version":3,"file":"static-engine.d.ts","sourceRoot":"","sources":["../../../static-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAgB,MAAM,SAAS,CAAC;AAkDtE,wBAAsB,aAAa,CACjC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC,CA6Hf"}
@@ -15,17 +15,32 @@
15
15
  * When returnImageData is true, returns raw ImageData for determinism hashing.
16
16
  * Works in both browser (HTMLCanvasElement) and Node (canvas package) environments.
17
17
  */
18
- import { createRequire } from 'module';
19
18
  import { DEFAULT_CONFIG } from './types';
20
19
  import { createP5Runtime, injectTimeVariables, injectProtocolVariables } from './p5-runtime';
21
20
  import { FORBIDDEN_APIS, createSafeMath } from './execution-sandbox';
22
- const require = createRequire(import.meta.url);
21
+ let nodeCanvasModule = null;
22
+ async function getNodeCanvas() {
23
+ if (nodeCanvasModule)
24
+ return nodeCanvasModule;
25
+ if (typeof window === 'undefined') {
26
+ try {
27
+ const { createRequire } = await import('module');
28
+ const require = createRequire(import.meta.url);
29
+ nodeCanvasModule = require('canvas');
30
+ return nodeCanvasModule;
31
+ }
32
+ catch {
33
+ return null;
34
+ }
35
+ }
36
+ return null;
37
+ }
23
38
  /**
24
39
  * Create a runtime canvas that works in both browser and Node environments.
25
40
  * Browser: uses HTMLCanvasElement
26
41
  * Node/Headless: uses `canvas` npm package
27
42
  */
28
- function createRuntimeCanvas(width, height) {
43
+ async function createRuntimeCanvas(width, height) {
29
44
  // Browser environment
30
45
  if (typeof document !== 'undefined' && typeof document.createElement === 'function') {
31
46
  const canvas = document.createElement('canvas');
@@ -34,14 +49,12 @@ function createRuntimeCanvas(width, height) {
34
49
  return canvas;
35
50
  }
36
51
  // Node / headless environment (oracle, CI)
37
- try {
38
- const { createCanvas } = require('canvas');
39
- return createCanvas(width, height);
40
- }
41
- catch (err) {
42
- throw new Error('[Code Mode Protocol Error] Headless canvas unavailable. ' +
43
- 'Install `canvas` for oracle execution.');
52
+ const nodeCanvas = await getNodeCanvas();
53
+ if (nodeCanvas && nodeCanvas.createCanvas) {
54
+ return nodeCanvas.createCanvas(width, height);
44
55
  }
56
+ throw new Error('[Code Mode Protocol Error] Headless canvas unavailable. ' +
57
+ 'Install `canvas` for oracle execution.');
45
58
  }
46
59
  export async function runStaticMode(config, options) {
47
60
  const { code, seed, vars, onPreview, onProgress, onComplete, onError, returnImageData } = options;
@@ -54,7 +67,7 @@ export async function runStaticMode(config, options) {
54
67
  message: 'Initializing canvas...',
55
68
  });
56
69
  // Create runtime canvas (browser or Node)
57
- const canvas = createRuntimeCanvas(width, height);
70
+ const canvas = await createRuntimeCanvas(width, height);
58
71
  // Create p5 runtime with optional seed for determinism
59
72
  const p = createP5Runtime(canvas, width, height, { seed });
60
73
  // Inject time variables (static = frame 0, t = 0, totalFrames = 1)
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @nexart/codemode-sdk — Single Source of Truth for Version Constants
3
+ *
4
+ * All version exports across the SDK MUST import from this module.
5
+ * This prevents version drift between package.json, runtime exports, and documentation.
6
+ *
7
+ * To update: Change values here and run `npm run build`.
8
+ * See package.json for the canonical npm version.
9
+ */
10
+ /** SDK version - must match package.json version */
11
+ export declare const SDK_VERSION = "1.8.2";
12
+ /** Protocol version - defines runtime semantics and determinism guarantees */
13
+ export declare const PROTOCOL_VERSION = "1.2.0";
14
+ /** Protocol phase - phase 3 = stable, production-ready */
15
+ export declare const PROTOCOL_PHASE = 3;
16
+ /** Combined version string for display */
17
+ export declare const VERSION_STRING = "v1.8.2 (Protocol v1.2.0)";
18
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../version.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oDAAoD;AACpD,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,0DAA0D;AAC1D,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,0CAA0C;AAC1C,eAAO,MAAM,cAAc,6BAAoD,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @nexart/codemode-sdk — Single Source of Truth for Version Constants
3
+ *
4
+ * All version exports across the SDK MUST import from this module.
5
+ * This prevents version drift between package.json, runtime exports, and documentation.
6
+ *
7
+ * To update: Change values here and run `npm run build`.
8
+ * See package.json for the canonical npm version.
9
+ */
10
+ /** SDK version - must match package.json version */
11
+ export const SDK_VERSION = '1.8.2';
12
+ /** Protocol version - defines runtime semantics and determinism guarantees */
13
+ export const PROTOCOL_VERSION = '1.2.0';
14
+ /** Protocol phase - phase 3 = stable, production-ready */
15
+ export const PROTOCOL_PHASE = 3;
16
+ /** Combined version string for display */
17
+ export const VERSION_STRING = `v${SDK_VERSION} (Protocol v${PROTOCOL_VERSION})`;