@nexart/codemode-sdk 1.5.1 → 1.7.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.
Files changed (134) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/LICENSE.md +62 -0
  3. package/README.md +172 -25
  4. package/builder.manifest.schema.json +62 -0
  5. package/dist/builder-manifest.d.ts +1 -1
  6. package/dist/builder-manifest.js +1 -1
  7. package/dist/core-index.d.ts +1 -1
  8. package/dist/core-index.js +1 -1
  9. package/dist/entry/browser.d.ts +37 -0
  10. package/dist/entry/browser.d.ts.map +1 -0
  11. package/dist/entry/browser.js +55 -0
  12. package/dist/entry/node.d.ts +21 -0
  13. package/dist/entry/node.d.ts.map +1 -0
  14. package/dist/entry/node.js +32 -0
  15. package/dist/execute.d.ts.map +1 -1
  16. package/dist/execute.js +4 -3
  17. package/dist/execution-sandbox.d.ts +107 -0
  18. package/dist/execution-sandbox.d.ts.map +1 -0
  19. package/dist/execution-sandbox.js +207 -0
  20. package/dist/index.d.ts +14 -33
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +41 -33
  23. package/dist/loop-engine.d.ts +3 -0
  24. package/dist/loop-engine.d.ts.map +1 -1
  25. package/dist/loop-engine.js +17 -7
  26. package/dist/p5-runtime.d.ts +3 -1
  27. package/dist/p5-runtime.d.ts.map +1 -1
  28. package/dist/p5-runtime.js +2 -0
  29. package/dist/sdk/codemode/builder-manifest.d.ts +79 -0
  30. package/dist/sdk/codemode/builder-manifest.d.ts.map +1 -0
  31. package/dist/sdk/codemode/builder-manifest.js +97 -0
  32. package/dist/sdk/codemode/core-index.d.ts +21 -0
  33. package/dist/sdk/codemode/core-index.d.ts.map +1 -0
  34. package/dist/sdk/codemode/core-index.js +26 -0
  35. package/dist/sdk/codemode/engine.d.ts +24 -0
  36. package/dist/sdk/codemode/engine.d.ts.map +1 -0
  37. package/dist/sdk/codemode/engine.js +67 -0
  38. package/dist/sdk/codemode/execute.d.ts +46 -0
  39. package/dist/sdk/codemode/execute.d.ts.map +1 -0
  40. package/dist/sdk/codemode/execute.js +283 -0
  41. package/dist/sdk/codemode/execution-sandbox.d.ts +107 -0
  42. package/dist/sdk/codemode/execution-sandbox.d.ts.map +1 -0
  43. package/dist/sdk/codemode/execution-sandbox.js +207 -0
  44. package/dist/sdk/codemode/index.d.ts +31 -0
  45. package/dist/sdk/codemode/index.d.ts.map +1 -0
  46. package/dist/sdk/codemode/index.js +63 -0
  47. package/dist/sdk/codemode/loop-engine.d.ts +22 -0
  48. package/dist/sdk/codemode/loop-engine.d.ts.map +1 -0
  49. package/dist/sdk/codemode/loop-engine.js +229 -0
  50. package/dist/sdk/codemode/noise-bridge.d.ts +44 -0
  51. package/dist/sdk/codemode/noise-bridge.d.ts.map +1 -0
  52. package/dist/sdk/codemode/noise-bridge.js +68 -0
  53. package/dist/sdk/codemode/noise-engine.d.ts +74 -0
  54. package/dist/sdk/codemode/noise-engine.d.ts.map +1 -0
  55. package/dist/sdk/codemode/noise-engine.js +132 -0
  56. package/dist/sdk/codemode/noise-sketches/fractalNoise.d.ts +11 -0
  57. package/dist/sdk/codemode/noise-sketches/fractalNoise.d.ts.map +1 -0
  58. package/dist/sdk/codemode/noise-sketches/fractalNoise.js +121 -0
  59. package/dist/sdk/codemode/noise-sketches/index.d.ts +21 -0
  60. package/dist/sdk/codemode/noise-sketches/index.d.ts.map +1 -0
  61. package/dist/sdk/codemode/noise-sketches/index.js +28 -0
  62. package/dist/sdk/codemode/p5-runtime.d.ts +75 -0
  63. package/dist/sdk/codemode/p5-runtime.d.ts.map +1 -0
  64. package/dist/sdk/codemode/p5-runtime.js +1031 -0
  65. package/dist/sdk/codemode/sound-bridge.d.ts +89 -0
  66. package/dist/sdk/codemode/sound-bridge.d.ts.map +1 -0
  67. package/dist/sdk/codemode/sound-bridge.js +128 -0
  68. package/dist/sdk/codemode/soundart-engine.d.ts +87 -0
  69. package/dist/sdk/codemode/soundart-engine.d.ts.map +1 -0
  70. package/dist/sdk/codemode/soundart-engine.js +173 -0
  71. package/dist/sdk/codemode/soundart-sketches/chladniBloom.d.ts +3 -0
  72. package/dist/sdk/codemode/soundart-sketches/chladniBloom.d.ts.map +1 -0
  73. package/dist/sdk/codemode/soundart-sketches/chladniBloom.js +53 -0
  74. package/dist/sdk/codemode/soundart-sketches/dualVortex.d.ts +3 -0
  75. package/dist/sdk/codemode/soundart-sketches/dualVortex.d.ts.map +1 -0
  76. package/dist/sdk/codemode/soundart-sketches/dualVortex.js +67 -0
  77. package/dist/sdk/codemode/soundart-sketches/geometryIllusion.d.ts +3 -0
  78. package/dist/sdk/codemode/soundart-sketches/geometryIllusion.d.ts.map +1 -0
  79. package/dist/sdk/codemode/soundart-sketches/geometryIllusion.js +89 -0
  80. package/dist/sdk/codemode/soundart-sketches/index.d.ts +39 -0
  81. package/dist/sdk/codemode/soundart-sketches/index.d.ts.map +1 -0
  82. package/dist/sdk/codemode/soundart-sketches/index.js +72 -0
  83. package/dist/sdk/codemode/soundart-sketches/isoflow.d.ts +3 -0
  84. package/dist/sdk/codemode/soundart-sketches/isoflow.d.ts.map +1 -0
  85. package/dist/sdk/codemode/soundart-sketches/isoflow.js +60 -0
  86. package/dist/sdk/codemode/soundart-sketches/loomWeave.d.ts +3 -0
  87. package/dist/sdk/codemode/soundart-sketches/loomWeave.d.ts.map +1 -0
  88. package/dist/sdk/codemode/soundart-sketches/loomWeave.js +59 -0
  89. package/dist/sdk/codemode/soundart-sketches/noiseTerraces.d.ts +3 -0
  90. package/dist/sdk/codemode/soundart-sketches/noiseTerraces.d.ts.map +1 -0
  91. package/dist/sdk/codemode/soundart-sketches/noiseTerraces.js +53 -0
  92. package/dist/sdk/codemode/soundart-sketches/orb.d.ts +3 -0
  93. package/dist/sdk/codemode/soundart-sketches/orb.d.ts.map +1 -0
  94. package/dist/sdk/codemode/soundart-sketches/orb.js +50 -0
  95. package/dist/sdk/codemode/soundart-sketches/pixelGlyphs.d.ts +3 -0
  96. package/dist/sdk/codemode/soundart-sketches/pixelGlyphs.d.ts.map +1 -0
  97. package/dist/sdk/codemode/soundart-sketches/pixelGlyphs.js +72 -0
  98. package/dist/sdk/codemode/soundart-sketches/prismFlowFields.d.ts +3 -0
  99. package/dist/sdk/codemode/soundart-sketches/prismFlowFields.d.ts.map +1 -0
  100. package/dist/sdk/codemode/soundart-sketches/prismFlowFields.js +51 -0
  101. package/dist/sdk/codemode/soundart-sketches/radialBurst.d.ts +3 -0
  102. package/dist/sdk/codemode/soundart-sketches/radialBurst.d.ts.map +1 -0
  103. package/dist/sdk/codemode/soundart-sketches/radialBurst.js +60 -0
  104. package/dist/sdk/codemode/soundart-sketches/resonantSoundBodies.d.ts +3 -0
  105. package/dist/sdk/codemode/soundart-sketches/resonantSoundBodies.d.ts.map +1 -0
  106. package/dist/sdk/codemode/soundart-sketches/resonantSoundBodies.js +89 -0
  107. package/dist/sdk/codemode/soundart-sketches/rings.d.ts +11 -0
  108. package/dist/sdk/codemode/soundart-sketches/rings.d.ts.map +1 -0
  109. package/dist/sdk/codemode/soundart-sketches/rings.js +89 -0
  110. package/dist/sdk/codemode/soundart-sketches/squares.d.ts +3 -0
  111. package/dist/sdk/codemode/soundart-sketches/squares.d.ts.map +1 -0
  112. package/dist/sdk/codemode/soundart-sketches/squares.js +52 -0
  113. package/dist/sdk/codemode/soundart-sketches/waveStripes.d.ts +3 -0
  114. package/dist/sdk/codemode/soundart-sketches/waveStripes.d.ts.map +1 -0
  115. package/dist/sdk/codemode/soundart-sketches/waveStripes.js +44 -0
  116. package/dist/sdk/codemode/static-engine.d.ts +20 -0
  117. package/dist/sdk/codemode/static-engine.d.ts.map +1 -0
  118. package/dist/sdk/codemode/static-engine.js +144 -0
  119. package/dist/sdk/codemode/types.d.ts +191 -0
  120. package/dist/sdk/codemode/types.d.ts.map +1 -0
  121. package/dist/sdk/codemode/types.js +32 -0
  122. package/dist/shared/noiseSnapshot.d.ts +59 -0
  123. package/dist/shared/noiseSnapshot.d.ts.map +1 -0
  124. package/dist/shared/noiseSnapshot.js +72 -0
  125. package/dist/shared/soundSnapshot.d.ts +94 -0
  126. package/dist/shared/soundSnapshot.d.ts.map +1 -0
  127. package/dist/shared/soundSnapshot.js +128 -0
  128. package/dist/static-engine.d.ts +7 -0
  129. package/dist/static-engine.d.ts.map +1 -1
  130. package/dist/static-engine.js +82 -14
  131. package/dist/types.d.ts +28 -6
  132. package/dist/types.d.ts.map +1 -1
  133. package/dist/types.js +1 -1
  134. package/package.json +31 -5
package/CHANGELOG.md CHANGED
@@ -4,6 +4,84 @@ All notable changes to @nexart/codemode-sdk will be documented in this file.
4
4
 
5
5
  ---
6
6
 
7
+ ## [1.7.0] — 2026-01-21
8
+
9
+ ### Added — Browser-Safe Entrypoint + Conditional Exports
10
+
11
+ **Packaging/Exports Update — No Breaking Changes**
12
+
13
+ This release makes the SDK reliably usable in browser environments (Vite/React) without any Node.js dependency leakage.
14
+
15
+ #### New Entry Points
16
+ - **`@nexart/codemode-sdk/browser`** — Browser-safe modules only
17
+ - All types, P5 runtime, loop engine, execution sandbox, validation, builder manifest
18
+ - Does NOT include static-engine or executeCodeMode (which require Node.js canvas)
19
+ - **`@nexart/codemode-sdk/node`** — Full SDK for Node.js
20
+ - Everything from browser entry plus static-engine and executeCodeMode
21
+ - Requires `canvas` package for static rendering
22
+
23
+ #### Package.json Conditional Exports
24
+ - Default import (`.`) uses conditional exports:
25
+ - Browser bundlers (Vite, webpack) → browser entry
26
+ - Node.js → node entry
27
+ - Explicit subpaths for direct control: `./browser` and `./node`
28
+
29
+ #### Why This Matters
30
+ - AI agents and bundlers will no longer accidentally import Node.js modules
31
+ - Vite/React apps can safely import without "createRequire is not defined" errors
32
+ - Server-side code gets full functionality including static image rendering
33
+
34
+ #### Files Added
35
+ - `entry/browser.ts` — Browser-safe entry point
36
+ - `entry/node.ts` — Node.js entry point (re-exports browser + adds static-engine)
37
+
38
+ ### Unchanged
39
+
40
+ - No changes to protocol behavior or determinism
41
+ - No changes to protocol version (remains v1.2.0)
42
+ - No changes to API surface (all functions work the same)
43
+ - Full backward compatibility with v1.6.x
44
+ - Existing sketches run unchanged
45
+
46
+ ---
47
+
48
+ ## [1.6.0] — 2026-01-12
49
+
50
+ ### Added — Licensing & Builder Identity Scaffolding
51
+
52
+ **Non-Breaking, Metadata-Only Release**
53
+
54
+ This release introduces scaffolding for future licensing and builder identity features. All additions are informational only — no behavior changes, no enforcement, no runtime validation.
55
+
56
+ #### Licensing (Informational Only)
57
+ - **LICENSE.md**: Draft commercial licensing terms with enforcement NOT active
58
+ - README section: "Commercial usage of NexArt Protocol requires a license. Enforcement is not active yet."
59
+
60
+ #### Builder Manifest Schema (Optional)
61
+ - **builder.manifest.schema.json**: JSON schema for optional builder attribution
62
+ - Fields: `builder_id`, `project_name`, `contact`, `website`, `intended_use`
63
+ - NOT validated, NOT loaded at runtime, NOT required
64
+
65
+ #### Documentation
66
+ - Positioned SDK as "canonical execution surface"
67
+ - Explained determinism guarantees explicitly
68
+ - Referenced real products (ByX, Frontierra)
69
+
70
+ ### Unchanged
71
+
72
+ - No changes to execution or determinism
73
+ - No changes to protocol version (remains v1.2.0)
74
+ - No runtime validation or enforcement
75
+ - No new required files or dependencies
76
+ - Full backward compatibility with v1.5.x
77
+ - Existing sketches run unchanged
78
+
79
+ ### Verification
80
+
81
+ Run `npx tsx scripts/check-determinism.ts` — must pass before release.
82
+
83
+ ---
84
+
7
85
  ## [1.5.1] — 2026-01-05
8
86
 
9
87
  ### Added
package/LICENSE.md ADDED
@@ -0,0 +1,62 @@
1
+ NexArt Code Mode SDK — License
2
+
3
+ Version: 1.6.0
4
+ Status: DRAFT — Enforcement Not Active
5
+
6
+
7
+
8
+ License Status
9
+
10
+ The NexArt Code Mode SDK is currently released under the MIT License.
11
+
12
+ At this time, all usage — including commercial usage — is permitted under the MIT License.
13
+
14
+ This document also serves as advance notice of a future commercial licensing model that may apply to certain uses of the NexArt Protocol.
15
+
16
+
17
+
18
+ Future Commercial Licensing (Not Active)
19
+
20
+ NexArt intends to introduce a separate commercial license for specific categories of usage in a future release.
21
+
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
27
+
28
+ Enforcement is NOT active.
29
+
30
+ No license keys, validation, usage tracking, or commercial restrictions are currently implemented.
31
+
32
+ Until enforcement is introduced in a future version, all usage remains governed solely by the MIT License below.
33
+
34
+
35
+
36
+ MIT License
37
+
38
+ Copyright (c) 2024–2026 NexArt
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining a copy
41
+ of this software and associated documentation files (the “Software”), to deal
42
+ in the Software without restriction, including without limitation the rights
43
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44
+ copies of the Software, and to permit persons to whom the Software is
45
+ furnished to do so, subject to the following conditions:
46
+
47
+ The above copyright notice and this permission notice shall be included in all
48
+ copies or substantial portions of the Software.
49
+
50
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
56
+ SOFTWARE.
57
+
58
+
59
+
60
+ Contact
61
+
62
+ For future commercial licensing inquiries: arrotu@artnames.io
package/README.md CHANGED
@@ -1,16 +1,15 @@
1
1
  # NexArt Code Mode Runtime SDK
2
2
 
3
- **Version: 1.5.1 (Protocol v1.2.0)**
3
+ **Version: 1.7.0 (Protocol v1.2.0)**
4
4
 
5
5
  ╔══════════════════════════════════════════════════════════════════════════════╗
6
- ║ @nexart/codemode-sdk — Canonical Code Mode Authority
6
+ ║ @nexart/codemode-sdk — Canonical Execution Surface
7
7
  ║ ║
8
- ║ This SDK defines the official Code Mode execution surface.
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.5.1
12
+ ║ SDK Version: 1.7.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,32 +62,111 @@ The answer is: "Whatever @nexart/codemode-sdk does — that is the protocol."
54
62
 
55
63
  ---
56
64
 
57
- ## What's New in v1.5.1
65
+ ## What's New in v1.7.0
58
66
 
59
- **Builder Manifest Passive Attribution (Write-Only)**
67
+ **Browser-Safe Entrypoint + Conditional Exports**
60
68
 
61
- - `registerBuilderManifest(manifest?)` Declare builder identity for future attribution
69
+ This release makes the SDK reliably usable in browser environments (Vite/React) without any Node.js dependency leakage.
62
70
 
63
- **The Builder Manifest is a declaration of intent, not a capability.**
71
+ ### New Entry Points
72
+ - `@nexart/codemode-sdk/browser` — Browser-safe modules only (no Node.js dependencies)
73
+ - `@nexart/codemode-sdk/node` — Full SDK including static-engine (requires `canvas` package)
64
74
 
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
75
+ ### Package.json Conditional Exports
76
+ - Default import (`.`) now uses conditional exports: browser gets browser entry, Node gets Node entry
77
+ - Explicit subpaths: `./browser` and `./node` for direct control
70
78
 
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.
79
+ ### Why This Matters
80
+ - AI agents and bundlers will no longer accidentally import Node.js modules in browser builds
81
+ - Vite/React apps can safely import the SDK without "createRequire is not defined" errors
82
+ - Server-side code gets full functionality including static image rendering
72
83
 
73
- ```typescript
74
- import { registerBuilderManifest } from '@nexart/codemode-sdk';
84
+ ### No Breaking Changes
85
+ - Protocol behavior and determinism unchanged
86
+ - API surface unchanged
87
+ - Existing Node.js code continues to work
75
88
 
76
- registerBuilderManifest({
77
- protocol: 'nexart',
78
- manifestVersion: '0.1',
79
- app: { name: 'My App', url: 'https://myapp.com' }
80
- });
89
+ ---
90
+
91
+ ## What's New in v1.6.0
92
+
93
+ **Licensing & Builder Identity Scaffolding (Metadata Only)**
94
+
95
+ This is a non-breaking, metadata-only release. No changes to execution or determinism.
96
+
97
+ ### Licensing (Informational Only)
98
+ - Added `LICENSE.md` with draft commercial licensing terms
99
+ - Enforcement is NOT active — all usage currently permitted under MIT
100
+
101
+ ### Builder Manifest Schema
102
+ - Added `builder.manifest.schema.json` for optional builder attribution
103
+ - Fields: `builder_id`, `project_name`, `contact`, `website`, `intended_use`
104
+ - This file is **optional**, **not validated**, and **not loaded at runtime**
105
+
106
+ ### Documentation
107
+ - SDK positioned as "canonical execution surface"
108
+ - Explicit determinism guarantees documented
109
+ - Real product references (ByX, Frontierra)
110
+
111
+ ---
112
+
113
+ ## Determinism Guarantees
114
+
115
+ **The NexArt Code Mode SDK guarantees deterministic output.**
116
+
117
+ Given identical inputs:
118
+ - Same `source` code
119
+ - Same `seed`
120
+ - Same `vars` array
121
+ - Same `width` and `height`
122
+ - Same `mode`
123
+
124
+ The SDK will produce **byte-for-byte identical output** across all executions.
125
+
126
+ ### What Breaks Determinism
127
+
128
+ The following actions will break determinism and are **blocked** by the SDK:
129
+
130
+ | Pattern | Reason | Enforcement |
131
+ |---------|--------|-------------|
132
+ | `Math.random()` | Unseeded randomness | BLOCKED |
133
+ | `Date.now()` | Time-based entropy | BLOCKED |
134
+ | `new Date()` | Time-based entropy | BLOCKED |
135
+ | `performance.now()` | Timing entropy | BLOCKED |
136
+ | `crypto.getRandomValues()` | Crypto randomness | BLOCKED |
137
+ | `fetch()` | External IO | BLOCKED |
138
+ | External imports | Uncontrolled code | BLOCKED |
139
+
140
+ Use `random()` (seeded) and `noise()` (seeded) for all randomness needs.
141
+
142
+ ### Oracle Verification
143
+
144
+ Before any release, run the determinism check:
145
+
146
+ ```bash
147
+ npx tsx scripts/check-determinism.ts
81
148
  ```
82
149
 
150
+ This compares output against a known oracle hash. If the hash changes without a protocol version bump, the release is invalid.
151
+
152
+ ---
153
+
154
+ ## Products Using This SDK
155
+
156
+ - **NexArt**: Primary generative art platform
157
+ - **ByX**: Curated collection system
158
+ - **Frontierra**: External builder integration
159
+
160
+ ---
161
+
162
+ ## v1.5.1
163
+
164
+ **Builder Manifest — Passive Attribution (Write-Only)**
165
+
166
+ - `registerBuilderManifest(manifest?)` — Declare builder identity for future attribution
167
+
168
+ The Builder Manifest is a declaration of intent, not a capability. Write-only, optional, non-enforced.
169
+
83
170
  ---
84
171
 
85
172
  ## v1.4.0 (Protocol v1.2.0)
@@ -153,6 +240,61 @@ cp -r sdk/codemode your-project/lib/codemode
153
240
 
154
241
  ---
155
242
 
243
+ ## Browser Usage (v1.7.0+)
244
+
245
+ For Vite, React, Next.js, or any browser environment, import from the browser-safe entry:
246
+
247
+ ```typescript
248
+ import {
249
+ runLoopMode,
250
+ cancelLoopMode,
251
+ createP5Runtime,
252
+ validateCodeModeSource,
253
+ PROTOCOL_IDENTITY,
254
+ DEFAULT_CONFIG,
255
+ } from '@nexart/codemode-sdk/browser';
256
+ ```
257
+
258
+ **What's included in `@nexart/codemode-sdk/browser`:**
259
+ - All types (RenderMode, EngineConfig, ExecuteCodeModeInput, etc.)
260
+ - P5 runtime (createP5Runtime, injectTimeVariables, injectProtocolVariables)
261
+ - Loop engine (runLoopMode, cancelLoopMode)
262
+ - Execution sandbox (FORBIDDEN_APIS, createSafeMath)
263
+ - Validation (validateCodeModeSource)
264
+ - Builder manifest (registerBuilderManifest)
265
+
266
+ **What's NOT included (Node.js only):**
267
+ - `executeCodeMode` — Uses static-engine which requires Node.js canvas
268
+ - `runStaticMode` — Requires Node.js canvas package
269
+
270
+ For static rendering in browser apps, use your server-side API endpoint.
271
+
272
+ ---
273
+
274
+ ## Node.js Usage (v1.7.0+)
275
+
276
+ For server-side rendering, oracles, or CLI tools, import from the Node entry:
277
+
278
+ ```typescript
279
+ import {
280
+ executeCodeMode,
281
+ runStaticMode,
282
+ runLoopMode,
283
+ validateCodeModeSource,
284
+ } from '@nexart/codemode-sdk/node';
285
+ ```
286
+
287
+ **What's included in `@nexart/codemode-sdk/node`:**
288
+ - Everything from the browser entry
289
+ - `executeCodeMode` — Canonical execution API
290
+ - `runStaticMode` — Node.js static rendering (requires `canvas` package)
291
+
292
+ **Requirements:**
293
+ - Node.js 18+
294
+ - `canvas` package installed for static mode (`npm install canvas`)
295
+
296
+ ---
297
+
156
298
  ## Canonical API
157
299
 
158
300
  ### `executeCodeMode(input: ExecuteCodeModeInput): Promise<ExecuteCodeModeResult>`
@@ -541,13 +683,18 @@ Ensure your server has this endpoint available (NexArt provides this).
541
683
 
542
684
  ```
543
685
  sdk/codemode/
544
- ├── index.ts # Main export
686
+ ├── entry/
687
+ │ ├── browser.ts # Browser-safe entry point (v1.7.0)
688
+ │ └── node.ts # Node.js entry point (v1.7.0)
689
+ ├── index.ts # Main export (app integration layer)
690
+ ├── core-index.ts # Core runtime exports
545
691
  ├── execute.ts # executeCodeMode canonical entry point
546
692
  ├── engine.ts # createEngine entry point (legacy)
547
693
  ├── types.ts # TypeScript types
548
- ├── static-engine.ts # Static mode implementation
549
- ├── loop-engine.ts # Loop mode implementation
694
+ ├── static-engine.ts # Static mode implementation (Node.js)
695
+ ├── loop-engine.ts # Loop mode implementation (browser)
550
696
  ├── p5-runtime.ts # p5.js-like runtime
697
+ ├── execution-sandbox.ts # Determinism enforcement
551
698
  ├── builder-manifest.ts # Builder manifest (write-only)
552
699
  ├── CHANGELOG.md # Version history
553
700
  └── README.md # This file
@@ -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
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * NexArt Code Mode SDK - Builder Manifest
3
- * Version: 1.5.1 (Protocol v1.2.0)
3
+ * Version: 1.6.0 (Protocol v1.2.0)
4
4
  *
5
5
  * ╔══════════════════════════════════════════════════════════════════════════╗
6
6
  * ║ BUILDER MANIFEST — PASSIVE ATTRIBUTION (WRITE-ONLY) ║
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * NexArt Code Mode SDK - Builder Manifest
3
- * Version: 1.5.1 (Protocol v1.2.0)
3
+ * Version: 1.6.0 (Protocol v1.2.0)
4
4
  *
5
5
  * ╔══════════════════════════════════════════════════════════════════════════╗
6
6
  * ║ BUILDER MANIFEST — PASSIVE ATTRIBUTION (WRITE-ONLY) ║
@@ -16,6 +16,6 @@ export { createEngine, } from './engine';
16
16
  /**
17
17
  * SDK Identity
18
18
  */
19
- export declare const SDK_VERSION = "1.1.1";
19
+ export declare const SDK_VERSION = "1.7.0";
20
20
  export declare const SDK_NAME = "@nexart/codemode-sdk";
21
21
  //# sourceMappingURL=core-index.d.ts.map
@@ -22,5 +22,5 @@ export { createEngine, } from './engine';
22
22
  /**
23
23
  * SDK Identity
24
24
  */
25
- export const SDK_VERSION = '1.1.1';
25
+ export const SDK_VERSION = '1.7.0';
26
26
  export const SDK_NAME = '@nexart/codemode-sdk';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @nexart/codemode-sdk/browser — Browser-Safe Entry Point
3
+ *
4
+ * ╔══════════════════════════════════════════════════════════════════════════╗
5
+ * ║ BROWSER-SAFE SDK ENTRY POINT (v1.7.0) ║
6
+ * ║ ║
7
+ * ║ This entrypoint exports ONLY browser-safe modules. ║
8
+ * ║ It does NOT include static-engine or any Node.js dependencies. ║
9
+ * ║ ║
10
+ * ║ Use this for Vite, React, Next.js, or any browser environment. ║
11
+ * ║ ║
12
+ * ║ For Node.js/server: import from '@nexart/codemode-sdk/node' ║
13
+ * ╚══════════════════════════════════════════════════════════════════════════╝
14
+ */
15
+ export type { RenderMode, RuntimeCanvas, EngineConfig, RenderResult, RunOptions, ProgressInfo, Engine, TimeVariables, ProtocolVariables, ProtocolMetadata, ExecuteCodeModeInput, ExecuteCodeModeResult, NexArtBuilderManifest, } from '../types';
16
+ export { PROTOCOL_IDENTITY, DEFAULT_VARS, DEFAULT_CONFIG, } from '../types';
17
+ export { FORBIDDEN_APIS, FORBIDDEN_API_NAMES, createSafeMath, buildSandboxContext, createSandboxedExecutor, executeSandboxed, } from '../execution-sandbox';
18
+ export { createP5Runtime, injectTimeVariables, injectProtocolVariables, createProtocolVAR, VAR_COUNT, VAR_MIN, VAR_MAX, CODE_MODE_PROTOCOL_VERSION, CODE_MODE_PROTOCOL_PHASE, CODE_MODE_ENFORCEMENT, } from '../p5-runtime';
19
+ export type { P5Runtime, P5RuntimeConfig, } from '../p5-runtime';
20
+ export { runLoopMode, cancelLoopMode, } from '../loop-engine';
21
+ export { validateCodeModeSource, } from '../execute';
22
+ export { createEngine, } from '../engine';
23
+ export { registerBuilderManifest, } from '../builder-manifest';
24
+ export declare const SDK_VERSION = "1.7.0";
25
+ export declare const SDK_NAME = "@nexart/codemode-sdk";
26
+ export declare const SDK_ENTRY = "browser";
27
+ /**
28
+ * Note: executeCodeMode is NOT exported from browser entry.
29
+ *
30
+ * In browser environments, static mode requires the canvas package which
31
+ * has Node.js dependencies. For browser apps:
32
+ *
33
+ * - Use runLoopMode() directly for animations
34
+ * - For static rendering, use the server-side endpoint
35
+ * - Or import from '@nexart/codemode-sdk/node' in SSR contexts
36
+ */
37
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../entry/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,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,eAAO,MAAM,WAAW,UAAU,CAAC;AACnC,eAAO,MAAM,QAAQ,yBAAyB,CAAC;AAC/C,eAAO,MAAM,SAAS,YAAY,CAAC;AAEnC;;;;;;;;;GASG"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @nexart/codemode-sdk/browser — Browser-Safe Entry Point
3
+ *
4
+ * ╔══════════════════════════════════════════════════════════════════════════╗
5
+ * ║ BROWSER-SAFE SDK ENTRY POINT (v1.7.0) ║
6
+ * ║ ║
7
+ * ║ This entrypoint exports ONLY browser-safe modules. ║
8
+ * ║ It does NOT include static-engine or any Node.js dependencies. ║
9
+ * ║ ║
10
+ * ║ Use this for Vite, React, Next.js, or any browser environment. ║
11
+ * ║ ║
12
+ * ║ For Node.js/server: import from '@nexart/codemode-sdk/node' ║
13
+ * ╚══════════════════════════════════════════════════════════════════════════╝
14
+ */
15
+ export { PROTOCOL_IDENTITY, DEFAULT_VARS, DEFAULT_CONFIG, } from '../types';
16
+ // ═══════════════════════════════════════════════════════════════════════════
17
+ // EXECUTION SANDBOX — Browser-safe (no Node dependencies)
18
+ // ═══════════════════════════════════════════════════════════════════════════
19
+ export { FORBIDDEN_APIS, FORBIDDEN_API_NAMES, createSafeMath, buildSandboxContext, createSandboxedExecutor, executeSandboxed, } from '../execution-sandbox';
20
+ // ═══════════════════════════════════════════════════════════════════════════
21
+ // P5 RUNTIME — Browser-safe (DOM-based canvas)
22
+ // ═══════════════════════════════════════════════════════════════════════════
23
+ export { createP5Runtime, injectTimeVariables, injectProtocolVariables, createProtocolVAR, VAR_COUNT, VAR_MIN, VAR_MAX, CODE_MODE_PROTOCOL_VERSION, CODE_MODE_PROTOCOL_PHASE, CODE_MODE_ENFORCEMENT, } from '../p5-runtime';
24
+ // ═══════════════════════════════════════════════════════════════════════════
25
+ // LOOP ENGINE — Browser-safe (uses document.createElement, fetch)
26
+ // ═══════════════════════════════════════════════════════════════════════════
27
+ export { runLoopMode, cancelLoopMode, } from '../loop-engine';
28
+ // ═══════════════════════════════════════════════════════════════════════════
29
+ // VALIDATION — Browser-safe (pure logic)
30
+ // ═══════════════════════════════════════════════════════════════════════════
31
+ export { validateCodeModeSource, } from '../execute';
32
+ // ═══════════════════════════════════════════════════════════════════════════
33
+ // ENGINE FACTORY — Browser-safe wrapper
34
+ // ═══════════════════════════════════════════════════════════════════════════
35
+ export { createEngine, } from '../engine';
36
+ // ═══════════════════════════════════════════════════════════════════════════
37
+ // BUILDER MANIFEST — Browser-safe (data-only, no side effects)
38
+ // ═══════════════════════════════════════════════════════════════════════════
39
+ export { registerBuilderManifest, } from '../builder-manifest';
40
+ // ═══════════════════════════════════════════════════════════════════════════
41
+ // SDK IDENTITY
42
+ // ═══════════════════════════════════════════════════════════════════════════
43
+ export const SDK_VERSION = '1.7.0';
44
+ export const SDK_NAME = '@nexart/codemode-sdk';
45
+ export const SDK_ENTRY = 'browser';
46
+ /**
47
+ * Note: executeCodeMode is NOT exported from browser entry.
48
+ *
49
+ * In browser environments, static mode requires the canvas package which
50
+ * has Node.js dependencies. For browser apps:
51
+ *
52
+ * - Use runLoopMode() directly for animations
53
+ * - For static rendering, use the server-side endpoint
54
+ * - Or import from '@nexart/codemode-sdk/node' in SSR contexts
55
+ */
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @nexart/codemode-sdk/node — Node.js Entry Point
3
+ *
4
+ * ╔══════════════════════════════════════════════════════════════════════════╗
5
+ * ║ NODE.JS SDK ENTRY POINT (v1.7.0) ║
6
+ * ║ ║
7
+ * ║ This entrypoint exports Node.js-specific modules that require: ║
8
+ * ║ - canvas package (node-canvas) ║
9
+ * ║ - Node.js built-ins (module, fs, path) ║
10
+ * ║ ║
11
+ * ║ Use this for server-side rendering, oracles, or CLI tools. ║
12
+ * ║ ║
13
+ * ║ For browser/Vite: import from '@nexart/codemode-sdk/browser' ║
14
+ * ╚══════════════════════════════════════════════════════════════════════════╝
15
+ */
16
+ export * from './browser';
17
+ export { runStaticMode, } from '../static-engine';
18
+ export { executeCodeMode, } from '../execute';
19
+ export { SDK_VERSION, SDK_NAME } from './browser';
20
+ export declare const SDK_ENTRY = "node";
21
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../entry/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;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"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @nexart/codemode-sdk/node — Node.js Entry Point
3
+ *
4
+ * ╔══════════════════════════════════════════════════════════════════════════╗
5
+ * ║ NODE.JS SDK ENTRY POINT (v1.7.0) ║
6
+ * ║ ║
7
+ * ║ This entrypoint exports Node.js-specific modules that require: ║
8
+ * ║ - canvas package (node-canvas) ║
9
+ * ║ - Node.js built-ins (module, fs, path) ║
10
+ * ║ ║
11
+ * ║ Use this for server-side rendering, oracles, or CLI tools. ║
12
+ * ║ ║
13
+ * ║ For browser/Vite: import from '@nexart/codemode-sdk/browser' ║
14
+ * ╚══════════════════════════════════════════════════════════════════════════╝
15
+ */
16
+ // ═══════════════════════════════════════════════════════════════════════════
17
+ // RE-EXPORT ALL BROWSER-SAFE MODULES
18
+ // ═══════════════════════════════════════════════════════════════════════════
19
+ export * from './browser';
20
+ // ═══════════════════════════════════════════════════════════════════════════
21
+ // STATIC ENGINE — Node.js only (requires canvas package)
22
+ // ═══════════════════════════════════════════════════════════════════════════
23
+ export { runStaticMode, } from '../static-engine';
24
+ // ═══════════════════════════════════════════════════════════════════════════
25
+ // CANONICAL EXECUTION — Node.js only (imports static-engine)
26
+ // ═══════════════════════════════════════════════════════════════════════════
27
+ export { executeCodeMode, } from '../execute';
28
+ // ═══════════════════════════════════════════════════════════════════════════
29
+ // SDK IDENTITY (override browser entry)
30
+ // ═══════════════════════════════════════════════════════════════════════════
31
+ export { SDK_VERSION, SDK_NAME } from './browser';
32
+ export const SDK_ENTRY = 'node';