@nexart/codemode-sdk 1.8.1 → 1.8.3

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 (144) hide show
  1. package/CHANGELOG.md +86 -1
  2. package/COMMERCIAL.md +25 -23
  3. package/LICENSE.md +10 -41
  4. package/README.md +82 -11
  5. package/dist/sdk/codemode/core-index.d.ts +6 -4
  6. package/dist/sdk/codemode/core-index.d.ts.map +1 -1
  7. package/dist/sdk/codemode/core-index.js +6 -4
  8. package/dist/{entry → sdk/codemode/entry}/browser.d.ts +5 -2
  9. package/dist/sdk/codemode/entry/browser.d.ts.map +1 -0
  10. package/dist/{entry → sdk/codemode/entry}/browser.js +10 -4
  11. package/dist/{entry → sdk/codemode/entry}/node.d.ts +2 -1
  12. package/dist/sdk/codemode/entry/node.d.ts.map +1 -0
  13. package/dist/{entry → sdk/codemode/entry}/node.js +2 -1
  14. package/dist/sdk/codemode/p5-runtime.d.ts +3 -2
  15. package/dist/sdk/codemode/p5-runtime.d.ts.map +1 -1
  16. package/dist/sdk/codemode/p5-runtime.js +6 -4
  17. package/dist/{runtime.d.ts → sdk/codemode/runtime.d.ts} +2 -2
  18. package/dist/sdk/codemode/runtime.d.ts.map +1 -0
  19. package/dist/{runtime.js → sdk/codemode/runtime.js} +3 -2
  20. package/dist/sdk/codemode/static-engine.d.ts.map +1 -1
  21. package/dist/sdk/codemode/static-engine.js +24 -11
  22. package/dist/sdk/codemode/types.d.ts +2 -1
  23. package/dist/sdk/codemode/types.d.ts.map +1 -1
  24. package/dist/sdk/codemode/types.js +5 -3
  25. package/dist/sdk/codemode/version.d.ts +18 -0
  26. package/dist/sdk/codemode/version.d.ts.map +1 -0
  27. package/dist/sdk/codemode/version.js +17 -0
  28. package/examples/agent-quickstart.ts +159 -0
  29. package/examples/preflight-test.ts +1 -1
  30. package/package.json +2 -1
  31. package/dist/builder-manifest.d.ts +0 -79
  32. package/dist/builder-manifest.d.ts.map +0 -1
  33. package/dist/builder-manifest.js +0 -97
  34. package/dist/core-index.d.ts +0 -21
  35. package/dist/core-index.d.ts.map +0 -1
  36. package/dist/core-index.js +0 -26
  37. package/dist/engine.d.ts +0 -24
  38. package/dist/engine.d.ts.map +0 -1
  39. package/dist/engine.js +0 -67
  40. package/dist/entry/browser.d.ts.map +0 -1
  41. package/dist/entry/node.d.ts.map +0 -1
  42. package/dist/execute.d.ts +0 -46
  43. package/dist/execute.d.ts.map +0 -1
  44. package/dist/execute.js +0 -283
  45. package/dist/execution-sandbox.d.ts +0 -107
  46. package/dist/execution-sandbox.d.ts.map +0 -1
  47. package/dist/execution-sandbox.js +0 -207
  48. package/dist/index.d.ts +0 -31
  49. package/dist/index.d.ts.map +0 -1
  50. package/dist/index.js +0 -63
  51. package/dist/loop-engine.d.ts +0 -22
  52. package/dist/loop-engine.d.ts.map +0 -1
  53. package/dist/loop-engine.js +0 -229
  54. package/dist/noise-bridge.d.ts +0 -44
  55. package/dist/noise-bridge.d.ts.map +0 -1
  56. package/dist/noise-bridge.js +0 -68
  57. package/dist/noise-engine.d.ts +0 -74
  58. package/dist/noise-engine.d.ts.map +0 -1
  59. package/dist/noise-engine.js +0 -132
  60. package/dist/noise-sketches/fractalNoise.d.ts +0 -11
  61. package/dist/noise-sketches/fractalNoise.d.ts.map +0 -1
  62. package/dist/noise-sketches/fractalNoise.js +0 -121
  63. package/dist/noise-sketches/index.d.ts +0 -21
  64. package/dist/noise-sketches/index.d.ts.map +0 -1
  65. package/dist/noise-sketches/index.js +0 -28
  66. package/dist/p5-runtime.d.ts +0 -75
  67. package/dist/p5-runtime.d.ts.map +0 -1
  68. package/dist/p5-runtime.js +0 -1031
  69. package/dist/runtime.d.ts.map +0 -1
  70. package/dist/sdk/codemode/index.d.ts +0 -31
  71. package/dist/sdk/codemode/index.d.ts.map +0 -1
  72. package/dist/sdk/codemode/index.js +0 -63
  73. package/dist/sdk/codemode/noise-bridge.d.ts +0 -44
  74. package/dist/sdk/codemode/noise-bridge.d.ts.map +0 -1
  75. package/dist/sdk/codemode/noise-bridge.js +0 -68
  76. package/dist/sdk/codemode/noise-engine.d.ts +0 -74
  77. package/dist/sdk/codemode/noise-engine.d.ts.map +0 -1
  78. package/dist/sdk/codemode/noise-engine.js +0 -132
  79. package/dist/sdk/codemode/noise-sketches/fractalNoise.d.ts +0 -11
  80. package/dist/sdk/codemode/noise-sketches/fractalNoise.d.ts.map +0 -1
  81. package/dist/sdk/codemode/noise-sketches/fractalNoise.js +0 -121
  82. package/dist/sdk/codemode/noise-sketches/index.d.ts +0 -21
  83. package/dist/sdk/codemode/noise-sketches/index.d.ts.map +0 -1
  84. package/dist/sdk/codemode/noise-sketches/index.js +0 -28
  85. package/dist/shared/noiseSnapshot.d.ts +0 -59
  86. package/dist/shared/noiseSnapshot.d.ts.map +0 -1
  87. package/dist/shared/noiseSnapshot.js +0 -72
  88. package/dist/sound-bridge.d.ts +0 -89
  89. package/dist/sound-bridge.d.ts.map +0 -1
  90. package/dist/sound-bridge.js +0 -128
  91. package/dist/soundart-engine.d.ts +0 -87
  92. package/dist/soundart-engine.d.ts.map +0 -1
  93. package/dist/soundart-engine.js +0 -173
  94. package/dist/soundart-sketches/chladniBloom.d.ts +0 -3
  95. package/dist/soundart-sketches/chladniBloom.d.ts.map +0 -1
  96. package/dist/soundart-sketches/chladniBloom.js +0 -53
  97. package/dist/soundart-sketches/dualVortex.d.ts +0 -3
  98. package/dist/soundart-sketches/dualVortex.d.ts.map +0 -1
  99. package/dist/soundart-sketches/dualVortex.js +0 -67
  100. package/dist/soundart-sketches/geometryIllusion.d.ts +0 -3
  101. package/dist/soundart-sketches/geometryIllusion.d.ts.map +0 -1
  102. package/dist/soundart-sketches/geometryIllusion.js +0 -89
  103. package/dist/soundart-sketches/index.d.ts +0 -39
  104. package/dist/soundart-sketches/index.d.ts.map +0 -1
  105. package/dist/soundart-sketches/index.js +0 -72
  106. package/dist/soundart-sketches/isoflow.d.ts +0 -3
  107. package/dist/soundart-sketches/isoflow.d.ts.map +0 -1
  108. package/dist/soundart-sketches/isoflow.js +0 -60
  109. package/dist/soundart-sketches/loomWeave.d.ts +0 -3
  110. package/dist/soundart-sketches/loomWeave.d.ts.map +0 -1
  111. package/dist/soundart-sketches/loomWeave.js +0 -59
  112. package/dist/soundart-sketches/noiseTerraces.d.ts +0 -3
  113. package/dist/soundart-sketches/noiseTerraces.d.ts.map +0 -1
  114. package/dist/soundart-sketches/noiseTerraces.js +0 -53
  115. package/dist/soundart-sketches/orb.d.ts +0 -3
  116. package/dist/soundart-sketches/orb.d.ts.map +0 -1
  117. package/dist/soundart-sketches/orb.js +0 -50
  118. package/dist/soundart-sketches/pixelGlyphs.d.ts +0 -3
  119. package/dist/soundart-sketches/pixelGlyphs.d.ts.map +0 -1
  120. package/dist/soundart-sketches/pixelGlyphs.js +0 -72
  121. package/dist/soundart-sketches/prismFlowFields.d.ts +0 -3
  122. package/dist/soundart-sketches/prismFlowFields.d.ts.map +0 -1
  123. package/dist/soundart-sketches/prismFlowFields.js +0 -51
  124. package/dist/soundart-sketches/radialBurst.d.ts +0 -3
  125. package/dist/soundart-sketches/radialBurst.d.ts.map +0 -1
  126. package/dist/soundart-sketches/radialBurst.js +0 -60
  127. package/dist/soundart-sketches/resonantSoundBodies.d.ts +0 -3
  128. package/dist/soundart-sketches/resonantSoundBodies.d.ts.map +0 -1
  129. package/dist/soundart-sketches/resonantSoundBodies.js +0 -89
  130. package/dist/soundart-sketches/rings.d.ts +0 -11
  131. package/dist/soundart-sketches/rings.d.ts.map +0 -1
  132. package/dist/soundart-sketches/rings.js +0 -89
  133. package/dist/soundart-sketches/squares.d.ts +0 -3
  134. package/dist/soundart-sketches/squares.d.ts.map +0 -1
  135. package/dist/soundart-sketches/squares.js +0 -52
  136. package/dist/soundart-sketches/waveStripes.d.ts +0 -3
  137. package/dist/soundart-sketches/waveStripes.d.ts.map +0 -1
  138. package/dist/soundart-sketches/waveStripes.js +0 -44
  139. package/dist/static-engine.d.ts +0 -20
  140. package/dist/static-engine.d.ts.map +0 -1
  141. package/dist/static-engine.js +0 -157
  142. package/dist/types.d.ts +0 -191
  143. package/dist/types.d.ts.map +0 -1
  144. package/dist/types.js +0 -32
@@ -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)
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * NexArt Code Mode Runtime SDK - Types
3
- * Version: 1.6.0 (Protocol v1.2.0)
3
+ * See version.ts for SDK version (single source of truth)
4
4
  *
5
5
  * Type definitions for the Code Mode runtime engine.
6
6
  * This is the canonical type surface for @nexart/codemode-sdk.
@@ -8,6 +8,7 @@
8
8
  /**
9
9
  * Protocol Constants
10
10
  * These define the locked protocol identity.
11
+ * Imports from version.ts (single source of truth).
11
12
  */
12
13
  export declare const PROTOCOL_IDENTITY: {
13
14
  readonly protocol: "nexart";
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;CAMpB,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE3C;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;CACZ,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;CACtB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5C,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;IAC9C,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,KA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C;IACF,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;KAChC,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE;QACZ,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;QAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -1,19 +1,21 @@
1
1
  /**
2
2
  * NexArt Code Mode Runtime SDK - Types
3
- * Version: 1.6.0 (Protocol v1.2.0)
3
+ * See version.ts for SDK version (single source of truth)
4
4
  *
5
5
  * Type definitions for the Code Mode runtime engine.
6
6
  * This is the canonical type surface for @nexart/codemode-sdk.
7
7
  */
8
+ import { PROTOCOL_VERSION, PROTOCOL_PHASE } from './version';
8
9
  /**
9
10
  * Protocol Constants
10
11
  * These define the locked protocol identity.
12
+ * Imports from version.ts (single source of truth).
11
13
  */
12
14
  export const PROTOCOL_IDENTITY = {
13
15
  protocol: 'nexart',
14
16
  engine: 'codemode',
15
- protocolVersion: '1.2.0',
16
- phase: 3,
17
+ protocolVersion: PROTOCOL_VERSION,
18
+ phase: PROTOCOL_PHASE,
17
19
  deterministic: true,
18
20
  };
19
21
  /**
@@ -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.3";
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.3 (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.3';
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})`;
@@ -0,0 +1,159 @@
1
+ /**
2
+ * @nexart/codemode-sdk — Agent Quickstart Example
3
+ * See package.json for SDK version
4
+ *
5
+ * This example demonstrates the RECOMMENDED approach for AI coding agents.
6
+ *
7
+ * Key principles:
8
+ * - Use createRuntime() — the modern, agent-first API
9
+ * - Always use strict: true to catch determinism violations
10
+ * - Never use Math.random(), Date.now(), or other non-deterministic APIs
11
+ * - Use runtime.random(), runtime.noise() for all randomness
12
+ * - Use runtime.digest() for verification
13
+ *
14
+ * This example requires NO canvas, NO p5, and is browser-safe.
15
+ */
16
+
17
+ import { createRuntime } from "../entry/browser";
18
+
19
+ // ─────────────────────────────────────────────────────────────────────────────
20
+ // STEP 1: Create a deterministic runtime
21
+ // ─────────────────────────────────────────────────────────────────────────────
22
+
23
+ const runtime = createRuntime({
24
+ seed: "agent-quickstart-demo", // Any string or number
25
+ vars: [50, 75, 25, 0, 0, 0, 0, 0, 0, 0], // VAR[0..9] inputs (0-100 each)
26
+ strict: true, // ALWAYS use strict: true — throws on non-deterministic APIs
27
+ mode: "static", // "static" = single frame, "loop" = animation
28
+ metadata: { example: "agent-quickstart" } // Optional metadata for digest
29
+ });
30
+
31
+ console.log("=== Agent Quickstart Example ===\n");
32
+
33
+ // ─────────────────────────────────────────────────────────────────────────────
34
+ // STEP 2: Use deterministic APIs
35
+ // ─────────────────────────────────────────────────────────────────────────────
36
+
37
+ // Deterministic random values (Mulberry32 PRNG)
38
+ const randomValues = [
39
+ runtime.random(), // [0, 1) — deterministic float
40
+ runtime.random(), // Next value in sequence
41
+ runtime.randomInt(0, 100), // Deterministic integer in range [0, 100]
42
+ runtime.randomInt(1, 6), // Like rolling a die
43
+ runtime.randomRange(10, 20) // Deterministic float in range [10, 20]
44
+ ];
45
+
46
+ console.log("Deterministic random values:");
47
+ randomValues.forEach((val, i) => console.log(` [${i}] ${val}`));
48
+ console.log();
49
+
50
+ // Deterministic noise (Perlin)
51
+ const noiseValues = [
52
+ runtime.noise(0.1, 0.2), // 2D Perlin noise
53
+ runtime.noise(0.5, 0.5), // Different position
54
+ runtime.noise(1.0, 2.0, 3.0) // 3D Perlin noise
55
+ ];
56
+
57
+ console.log("Deterministic noise values:");
58
+ noiseValues.forEach((val, i) => console.log(` [${i}] ${val}`));
59
+ console.log();
60
+
61
+ // ─────────────────────────────────────────────────────────────────────────────
62
+ // STEP 3: Execute code with strict enforcement
63
+ // ─────────────────────────────────────────────────────────────────────────────
64
+
65
+ // runtime.run() executes code with strict mode enforcement
66
+ // If any non-deterministic API is called, it throws an actionable error
67
+ const result = runtime.run(() => {
68
+ // This code is safe — uses only deterministic APIs
69
+ const positions: Array<{x: number, y: number}> = [];
70
+ for (let i = 0; i < 5; i++) {
71
+ positions.push({
72
+ x: runtime.random() * 100,
73
+ y: runtime.random() * 100
74
+ });
75
+ }
76
+ return positions;
77
+ });
78
+
79
+ console.log("Generated positions (deterministic):");
80
+ result.forEach((pos, i) => console.log(` [${i}] x=${pos.x.toFixed(2)}, y=${pos.y.toFixed(2)}`));
81
+ console.log();
82
+
83
+ // ─────────────────────────────────────────────────────────────────────────────
84
+ // STEP 4: Get state snapshot and digest for verification
85
+ // ─────────────────────────────────────────────────────────────────────────────
86
+
87
+ const state = runtime.getState();
88
+ const digest = runtime.digest();
89
+
90
+ console.log("State snapshot:");
91
+ console.log(` sdkVersion: "${state.sdkVersion}"`);
92
+ console.log(` seed: ${state.seed}`);
93
+ console.log(` vars: [${state.vars.join(", ")}]`);
94
+ console.log(` mode: "${state.mode}"`);
95
+ console.log();
96
+
97
+ console.log("Verification digest:");
98
+ console.log(` ${digest}`);
99
+ console.log();
100
+
101
+ // ─────────────────────────────────────────────────────────────────────────────
102
+ // STEP 5: Verify determinism (same inputs → same outputs)
103
+ // ─────────────────────────────────────────────────────────────────────────────
104
+
105
+ // Create a second runtime with identical inputs
106
+ const runtime2 = createRuntime({
107
+ seed: "agent-quickstart-demo",
108
+ vars: [50, 75, 25, 0, 0, 0, 0, 0, 0, 0],
109
+ strict: true,
110
+ mode: "static",
111
+ metadata: { example: "agent-quickstart" }
112
+ });
113
+
114
+ // Generate the same sequence
115
+ for (let i = 0; i < randomValues.length; i++) {
116
+ if (i < 2) runtime2.random();
117
+ else if (i === 2) runtime2.randomInt(0, 100);
118
+ else if (i === 3) runtime2.randomInt(1, 6);
119
+ else runtime2.randomRange(10, 20);
120
+ }
121
+
122
+ // Generate the same noise values
123
+ runtime2.noise(0.1, 0.2);
124
+ runtime2.noise(0.5, 0.5);
125
+ runtime2.noise(1.0, 2.0, 3.0);
126
+
127
+ // Run the same code
128
+ runtime2.run(() => {
129
+ for (let i = 0; i < 5; i++) {
130
+ runtime2.random();
131
+ runtime2.random();
132
+ }
133
+ });
134
+
135
+ const digest2 = runtime2.digest();
136
+
137
+ console.log("Determinism verification:");
138
+ console.log(` Runtime 1 digest: ${digest}`);
139
+ console.log(` Runtime 2 digest: ${digest2}`);
140
+ console.log(` Match: ${digest === digest2 ? "✅ PASS" : "❌ FAIL"}`);
141
+ console.log();
142
+
143
+ // ─────────────────────────────────────────────────────────────────────────────
144
+ // WHAT NOT TO DO — These would throw in strict mode:
145
+ // ─────────────────────────────────────────────────────────────────────────────
146
+
147
+ console.log("=== Common Mistakes (DO NOT DO THIS) ===\n");
148
+ console.log("❌ Math.random() → Use runtime.random()");
149
+ console.log("❌ Date.now() → Pass time as input or use frame counters");
150
+ console.log("❌ performance.now() → Use deterministic timing");
151
+ console.log("❌ new Date() → Pass time as input");
152
+ console.log();
153
+
154
+ // Example of what strict mode catches:
155
+ // runtime.run(() => {
156
+ // Math.random(); // Throws: NEXART_STRICT: Non-deterministic API used: Math.random. Use runtime.random() instead.
157
+ // });
158
+
159
+ console.log("=== Example Complete ===");
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @nexart/codemode-sdk — Preflight Release Tests
3
3
  *
4
- * Extended verification tests for v1.8.0 release validation.
4
+ * Extended verification tests for v1.8.3 release validation.
5
5
  * Tests strict mode restoration, error messages, and cross-env digest parity.
6
6
  *
7
7
  * Run: npx tsx examples/preflight-test.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexart/codemode-sdk",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "NexArt Code Mode SDK - Deterministic, reproducible, verifiable generative art runtime. Agent-first design for AI coding assistants.",
5
5
  "type": "module",
6
6
  "main": "./dist/entry/browser.js",
@@ -48,6 +48,7 @@
48
48
  "test": "npx tsx smoke-test.ts",
49
49
  "example:basic": "npx tsx examples/basic.ts",
50
50
  "example:verify": "npx tsx examples/verify.ts",
51
+ "example:agent": "npx tsx examples/agent-quickstart.ts",
51
52
  "prepublishOnly": "npm run build && npm run test"
52
53
  },
53
54
  "keywords": [
@@ -1,79 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,97 +0,0 @@
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
- /** Internal storage - not accessible to SDK consumers */
27
- let currentManifest = null;
28
- /**
29
- * Register a builder manifest for attribution.
30
- *
31
- * This is optional and does not affect execution behavior.
32
- * The manifest is stored in-memory only and is not:
33
- * - Serialized to disk
34
- * - Sent over the network
35
- * - Logged to console
36
- * - Used for validation or enforcement
37
- *
38
- * @param manifest - Optional builder manifest. Pass undefined to clear.
39
- *
40
- * @example
41
- * ```typescript
42
- * import { registerBuilderManifest } from "@nexart/codemode-sdk";
43
- *
44
- * registerBuilderManifest({
45
- * protocol: "nexart",
46
- * manifestVersion: "0.1",
47
- * app: { name: "My App", url: "https://myapp.com" }
48
- * });
49
- * ```
50
- */
51
- export function registerBuilderManifest(manifest) {
52
- if (!manifest) {
53
- currentManifest = null;
54
- return;
55
- }
56
- if (manifest.protocol !== 'nexart') {
57
- currentManifest = null;
58
- return;
59
- }
60
- if (typeof manifest.manifestVersion !== 'string') {
61
- currentManifest = null;
62
- return;
63
- }
64
- currentManifest = manifest;
65
- }
66
- /**
67
- * Get the currently registered builder manifest.
68
- *
69
- * ╔══════════════════════════════════════════════════════════════════════════╗
70
- * ║ INTERNAL FUNCTION — NOT EXPORTED TO SDK CONSUMERS ║
71
- * ║ ║
72
- * ║ This function exists only for internal SDK execution context. ║
73
- * ║ It is NOT part of the public API and must NOT be exported from index. ║
74
- * ║ Runtime code and sketch code cannot access this function. ║
75
- * ╚══════════════════════════════════════════════════════════════════════════╝
76
- *
77
- * @internal
78
- */
79
- export function getBuilderManifest() {
80
- return currentManifest;
81
- }
82
- /**
83
- * Clear the registered builder manifest.
84
- *
85
- * ╔══════════════════════════════════════════════════════════════════════════╗
86
- * ║ INTERNAL FUNCTION — NOT EXPORTED TO SDK CONSUMERS ║
87
- * ║ ║
88
- * ║ This function exists only for internal SDK execution context. ║
89
- * ║ It is NOT part of the public API and must NOT be exported from index. ║
90
- * ║ Runtime code and sketch code cannot access this function. ║
91
- * ╚══════════════════════════════════════════════════════════════════════════╝
92
- *
93
- * @internal
94
- */
95
- export function clearBuilderManifest() {
96
- currentManifest = null;
97
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * @nexart/codemode-sdk v1.4.0 — Core Exports
3
- *
4
- * Canonical execution engine for NexArt Code Mode.
5
- * This is the single source of truth for Code Mode semantics.
6
- *
7
- * Protocol: v1.2.0 (Phase 3)
8
- * Enforcement: HARD
9
- */
10
- export { executeCodeMode, validateCodeModeSource, } from './execute';
11
- export { type RenderMode, type TimeVariables, type ProtocolMetadata, type EngineConfig, type RenderResult, type RunOptions, type ProgressInfo, type Engine, type ExecuteCodeModeInput, type ExecuteCodeModeResult, PROTOCOL_IDENTITY, DEFAULT_VARS, DEFAULT_CONFIG, } from './types';
12
- export { createP5Runtime, injectTimeVariables, createProtocolVAR, VAR_COUNT, VAR_MIN, VAR_MAX, CODE_MODE_PROTOCOL_VERSION, CODE_MODE_PROTOCOL_PHASE, CODE_MODE_ENFORCEMENT, type P5Runtime, type P5RuntimeConfig, } from './p5-runtime';
13
- export { runStaticMode, } from './static-engine';
14
- export { runLoopMode, cancelLoopMode, } from './loop-engine';
15
- export { createEngine, } from './engine';
16
- /**
17
- * SDK Identity
18
- */
19
- export declare const SDK_VERSION = "1.8.0";
20
- export declare const SDK_NAME = "@nexart/codemode-sdk";
21
- //# sourceMappingURL=core-index.d.ts.map
@@ -1 +0,0 @@
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,26 +0,0 @@
1
- /**
2
- * @nexart/codemode-sdk v1.4.0 — Core Exports
3
- *
4
- * Canonical execution engine for NexArt Code Mode.
5
- * This is the single source of truth for Code Mode semantics.
6
- *
7
- * Protocol: v1.2.0 (Phase 3)
8
- * Enforcement: HARD
9
- */
10
- // Core execution
11
- export { executeCodeMode, validateCodeModeSource, } from './execute';
12
- // Protocol types
13
- export { PROTOCOL_IDENTITY, DEFAULT_VARS, DEFAULT_CONFIG, } from './types';
14
- // Runtime
15
- export { createP5Runtime, injectTimeVariables, createProtocolVAR, VAR_COUNT, VAR_MIN, VAR_MAX, CODE_MODE_PROTOCOL_VERSION, CODE_MODE_PROTOCOL_PHASE, CODE_MODE_ENFORCEMENT, } from './p5-runtime';
16
- // Static engine
17
- export { runStaticMode, } from './static-engine';
18
- // Loop engine
19
- export { runLoopMode, cancelLoopMode, } from './loop-engine';
20
- // Engine utilities
21
- export { createEngine, } from './engine';
22
- /**
23
- * SDK Identity
24
- */
25
- export const SDK_VERSION = '1.8.0';
26
- export const SDK_NAME = '@nexart/codemode-sdk';
package/dist/engine.d.ts DELETED
@@ -1,24 +0,0 @@
1
- /**
2
- * NexArt Code Mode Runtime SDK
3
- * Version: 0.1.0
4
- *
5
- * Main entry point for the Code Mode runtime engine.
6
- *
7
- * Usage:
8
- * const engine = createEngine({ mode: 'static' });
9
- * engine.run({
10
- * code: 'function setup() { background(255); ellipse(width/2, height/2, 100); }',
11
- * onComplete: (result) => console.log(result.blob)
12
- * });
13
- */
14
- import type { Engine, EngineConfig } from './types';
15
- /**
16
- * Create a NexArt Code Mode rendering engine.
17
- *
18
- * @param config - Engine configuration
19
- * @returns Engine instance
20
- */
21
- export declare function createEngine(config: EngineConfig): Engine;
22
- export type { Engine, EngineConfig, RunOptions, RenderResult, ProgressInfo } from './types';
23
- export { DEFAULT_CONFIG } from './types';
24
- //# sourceMappingURL=engine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAc,MAAM,SAAS,CAAC;AAKhE;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CA+CzD;AAGD,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}