@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
@@ -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.2 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.2",
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"}
package/dist/engine.js DELETED
@@ -1,67 +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 { DEFAULT_CONFIG } from './types';
15
- import { runStaticMode } from './static-engine';
16
- import { runLoopMode, cancelLoopMode } from './loop-engine';
17
- /**
18
- * Create a NexArt Code Mode rendering engine.
19
- *
20
- * @param config - Engine configuration
21
- * @returns Engine instance
22
- */
23
- export function createEngine(config) {
24
- const resolvedConfig = {
25
- mode: config.mode,
26
- width: config.width ?? DEFAULT_CONFIG.width,
27
- height: config.height ?? DEFAULT_CONFIG.height,
28
- duration: config.duration ?? DEFAULT_CONFIG.duration,
29
- fps: config.fps ?? DEFAULT_CONFIG.fps,
30
- };
31
- let isRunning = false;
32
- const run = async (options) => {
33
- if (isRunning) {
34
- throw new Error('Engine is already running. Call stop() first.');
35
- }
36
- isRunning = true;
37
- try {
38
- if (resolvedConfig.mode === 'static') {
39
- await runStaticMode(resolvedConfig, options);
40
- }
41
- else if (resolvedConfig.mode === 'loop') {
42
- await runLoopMode(resolvedConfig, options);
43
- }
44
- else {
45
- throw new Error(`Unknown mode: ${resolvedConfig.mode}`);
46
- }
47
- }
48
- finally {
49
- isRunning = false;
50
- }
51
- };
52
- const stop = () => {
53
- if (resolvedConfig.mode === 'loop') {
54
- cancelLoopMode();
55
- }
56
- isRunning = false;
57
- };
58
- const getConfig = () => {
59
- return { ...resolvedConfig };
60
- };
61
- return {
62
- run,
63
- stop,
64
- getConfig,
65
- };
66
- }
67
- export { DEFAULT_CONFIG } from './types';
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../entry/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;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,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,eAAO,MAAM,WAAW,UAAU,CAAC;AACnC,eAAO,MAAM,QAAQ,yBAAyB,CAAC;AAC/C,eAAO,MAAM,SAAS,YAAY,CAAC;AAEnC;;;;;;;;;;;GAWG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../entry/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;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"}
package/dist/execute.d.ts DELETED
@@ -1,46 +0,0 @@
1
- /**
2
- * NexArt Code Mode Runtime SDK - Canonical Execution Entry Point
3
- *
4
- * ╔══════════════════════════════════════════════════════════════════════════╗
5
- * ║ CODE MODE PROTOCOL v1.2.0 (Phase 3) — CANONICAL ENTRY POINT ║
6
- * ║ ║
7
- * ║ This is the ONLY official way to execute Code Mode. ║
8
- * ║ All implementations (NexArt, ByX, external) MUST use this function. ║
9
- * ║ ║
10
- * ║ Authority: @nexart/codemode-sdk ║
11
- * ╚══════════════════════════════════════════════════════════════════════════╝
12
- */
13
- import { ExecuteCodeModeInput, ExecuteCodeModeResult } from './types';
14
- /**
15
- * executeCodeMode — Canonical Code Mode Execution Entry Point
16
- *
17
- * This is the ONLY official way to execute Code Mode.
18
- * All implementations MUST use this function.
19
- *
20
- * @param input - Execution parameters
21
- * @returns Promise<ExecuteCodeModeResult> - Execution result with protocol metadata
22
- *
23
- * @example
24
- * ```typescript
25
- * const result = await executeCodeMode({
26
- * source: `function setup() { background(255); ellipse(width/2, height/2, 100); }`,
27
- * width: 1950,
28
- * height: 2400,
29
- * seed: 12345,
30
- * vars: [50, 75, 0, 0, 0, 0, 0, 0, 0, 0],
31
- * mode: 'static'
32
- * });
33
- *
34
- * console.log(result.metadata.protocolVersion); // '1.2.0'
35
- * console.log(result.image); // PNG Blob
36
- * ```
37
- */
38
- export declare function executeCodeMode(input: ExecuteCodeModeInput): Promise<ExecuteCodeModeResult>;
39
- /**
40
- * Validate code without executing
41
- */
42
- export declare function validateCodeModeSource(source: string, mode: 'static' | 'loop'): {
43
- valid: boolean;
44
- errors: string[];
45
- };
46
- //# sourceMappingURL=execute.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../execute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EAMtB,MAAM,SAAS,CAAC;AAuNjB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,qBAAqB,CAAC,CAmChC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAuCpH"}