@nexart/codemode-sdk 1.6.0 → 1.8.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 (121) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +221 -9
  3. package/dist/core-index.d.ts +1 -1
  4. package/dist/core-index.js +1 -1
  5. package/dist/entry/browser.d.ts +43 -0
  6. package/dist/entry/browser.d.ts.map +1 -0
  7. package/dist/entry/browser.js +63 -0
  8. package/dist/entry/node.d.ts +23 -0
  9. package/dist/entry/node.d.ts.map +1 -0
  10. package/dist/entry/node.js +34 -0
  11. package/dist/index.d.ts +14 -33
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +41 -33
  14. package/dist/runtime.d.ts +52 -0
  15. package/dist/runtime.d.ts.map +1 -0
  16. package/dist/runtime.js +219 -0
  17. package/dist/sdk/codemode/builder-manifest.d.ts +79 -0
  18. package/dist/sdk/codemode/builder-manifest.d.ts.map +1 -0
  19. package/dist/sdk/codemode/builder-manifest.js +97 -0
  20. package/dist/sdk/codemode/core-index.d.ts +21 -0
  21. package/dist/sdk/codemode/core-index.d.ts.map +1 -0
  22. package/dist/sdk/codemode/core-index.js +26 -0
  23. package/dist/sdk/codemode/engine.d.ts +24 -0
  24. package/dist/sdk/codemode/engine.d.ts.map +1 -0
  25. package/dist/sdk/codemode/engine.js +67 -0
  26. package/dist/sdk/codemode/execute.d.ts +46 -0
  27. package/dist/sdk/codemode/execute.d.ts.map +1 -0
  28. package/dist/sdk/codemode/execute.js +283 -0
  29. package/dist/sdk/codemode/execution-sandbox.d.ts +107 -0
  30. package/dist/sdk/codemode/execution-sandbox.d.ts.map +1 -0
  31. package/dist/sdk/codemode/execution-sandbox.js +207 -0
  32. package/dist/sdk/codemode/index.d.ts +31 -0
  33. package/dist/sdk/codemode/index.d.ts.map +1 -0
  34. package/dist/sdk/codemode/index.js +63 -0
  35. package/dist/sdk/codemode/loop-engine.d.ts +22 -0
  36. package/dist/sdk/codemode/loop-engine.d.ts.map +1 -0
  37. package/dist/sdk/codemode/loop-engine.js +229 -0
  38. package/dist/sdk/codemode/noise-bridge.d.ts +44 -0
  39. package/dist/sdk/codemode/noise-bridge.d.ts.map +1 -0
  40. package/dist/sdk/codemode/noise-bridge.js +68 -0
  41. package/dist/sdk/codemode/noise-engine.d.ts +74 -0
  42. package/dist/sdk/codemode/noise-engine.d.ts.map +1 -0
  43. package/dist/sdk/codemode/noise-engine.js +132 -0
  44. package/dist/sdk/codemode/noise-sketches/fractalNoise.d.ts +11 -0
  45. package/dist/sdk/codemode/noise-sketches/fractalNoise.d.ts.map +1 -0
  46. package/dist/sdk/codemode/noise-sketches/fractalNoise.js +121 -0
  47. package/dist/sdk/codemode/noise-sketches/index.d.ts +21 -0
  48. package/dist/sdk/codemode/noise-sketches/index.d.ts.map +1 -0
  49. package/dist/sdk/codemode/noise-sketches/index.js +28 -0
  50. package/dist/sdk/codemode/p5-runtime.d.ts +75 -0
  51. package/dist/sdk/codemode/p5-runtime.d.ts.map +1 -0
  52. package/dist/sdk/codemode/p5-runtime.js +1031 -0
  53. package/dist/sdk/codemode/sound-bridge.d.ts +89 -0
  54. package/dist/sdk/codemode/sound-bridge.d.ts.map +1 -0
  55. package/dist/sdk/codemode/sound-bridge.js +128 -0
  56. package/dist/sdk/codemode/soundart-engine.d.ts +87 -0
  57. package/dist/sdk/codemode/soundart-engine.d.ts.map +1 -0
  58. package/dist/sdk/codemode/soundart-engine.js +173 -0
  59. package/dist/sdk/codemode/soundart-sketches/chladniBloom.d.ts +3 -0
  60. package/dist/sdk/codemode/soundart-sketches/chladniBloom.d.ts.map +1 -0
  61. package/dist/sdk/codemode/soundart-sketches/chladniBloom.js +53 -0
  62. package/dist/sdk/codemode/soundart-sketches/dualVortex.d.ts +3 -0
  63. package/dist/sdk/codemode/soundart-sketches/dualVortex.d.ts.map +1 -0
  64. package/dist/sdk/codemode/soundart-sketches/dualVortex.js +67 -0
  65. package/dist/sdk/codemode/soundart-sketches/geometryIllusion.d.ts +3 -0
  66. package/dist/sdk/codemode/soundart-sketches/geometryIllusion.d.ts.map +1 -0
  67. package/dist/sdk/codemode/soundart-sketches/geometryIllusion.js +89 -0
  68. package/dist/sdk/codemode/soundart-sketches/index.d.ts +39 -0
  69. package/dist/sdk/codemode/soundart-sketches/index.d.ts.map +1 -0
  70. package/dist/sdk/codemode/soundart-sketches/index.js +72 -0
  71. package/dist/sdk/codemode/soundart-sketches/isoflow.d.ts +3 -0
  72. package/dist/sdk/codemode/soundart-sketches/isoflow.d.ts.map +1 -0
  73. package/dist/sdk/codemode/soundart-sketches/isoflow.js +60 -0
  74. package/dist/sdk/codemode/soundart-sketches/loomWeave.d.ts +3 -0
  75. package/dist/sdk/codemode/soundart-sketches/loomWeave.d.ts.map +1 -0
  76. package/dist/sdk/codemode/soundart-sketches/loomWeave.js +59 -0
  77. package/dist/sdk/codemode/soundart-sketches/noiseTerraces.d.ts +3 -0
  78. package/dist/sdk/codemode/soundart-sketches/noiseTerraces.d.ts.map +1 -0
  79. package/dist/sdk/codemode/soundart-sketches/noiseTerraces.js +53 -0
  80. package/dist/sdk/codemode/soundart-sketches/orb.d.ts +3 -0
  81. package/dist/sdk/codemode/soundart-sketches/orb.d.ts.map +1 -0
  82. package/dist/sdk/codemode/soundart-sketches/orb.js +50 -0
  83. package/dist/sdk/codemode/soundart-sketches/pixelGlyphs.d.ts +3 -0
  84. package/dist/sdk/codemode/soundart-sketches/pixelGlyphs.d.ts.map +1 -0
  85. package/dist/sdk/codemode/soundart-sketches/pixelGlyphs.js +72 -0
  86. package/dist/sdk/codemode/soundart-sketches/prismFlowFields.d.ts +3 -0
  87. package/dist/sdk/codemode/soundart-sketches/prismFlowFields.d.ts.map +1 -0
  88. package/dist/sdk/codemode/soundart-sketches/prismFlowFields.js +51 -0
  89. package/dist/sdk/codemode/soundart-sketches/radialBurst.d.ts +3 -0
  90. package/dist/sdk/codemode/soundart-sketches/radialBurst.d.ts.map +1 -0
  91. package/dist/sdk/codemode/soundart-sketches/radialBurst.js +60 -0
  92. package/dist/sdk/codemode/soundart-sketches/resonantSoundBodies.d.ts +3 -0
  93. package/dist/sdk/codemode/soundart-sketches/resonantSoundBodies.d.ts.map +1 -0
  94. package/dist/sdk/codemode/soundart-sketches/resonantSoundBodies.js +89 -0
  95. package/dist/sdk/codemode/soundart-sketches/rings.d.ts +11 -0
  96. package/dist/sdk/codemode/soundart-sketches/rings.d.ts.map +1 -0
  97. package/dist/sdk/codemode/soundart-sketches/rings.js +89 -0
  98. package/dist/sdk/codemode/soundart-sketches/squares.d.ts +3 -0
  99. package/dist/sdk/codemode/soundart-sketches/squares.d.ts.map +1 -0
  100. package/dist/sdk/codemode/soundart-sketches/squares.js +52 -0
  101. package/dist/sdk/codemode/soundart-sketches/waveStripes.d.ts +3 -0
  102. package/dist/sdk/codemode/soundart-sketches/waveStripes.d.ts.map +1 -0
  103. package/dist/sdk/codemode/soundart-sketches/waveStripes.js +44 -0
  104. package/dist/sdk/codemode/static-engine.d.ts +20 -0
  105. package/dist/sdk/codemode/static-engine.d.ts.map +1 -0
  106. package/dist/sdk/codemode/static-engine.js +144 -0
  107. package/dist/sdk/codemode/types.d.ts +191 -0
  108. package/dist/sdk/codemode/types.d.ts.map +1 -0
  109. package/dist/sdk/codemode/types.js +32 -0
  110. package/dist/shared/noiseSnapshot.d.ts +59 -0
  111. package/dist/shared/noiseSnapshot.d.ts.map +1 -0
  112. package/dist/shared/noiseSnapshot.js +72 -0
  113. package/dist/shared/soundSnapshot.d.ts +94 -0
  114. package/dist/shared/soundSnapshot.d.ts.map +1 -0
  115. package/dist/shared/soundSnapshot.js +128 -0
  116. package/dist/static-engine.d.ts.map +1 -1
  117. package/dist/static-engine.js +24 -11
  118. package/examples/basic.ts +61 -0
  119. package/examples/preflight-test.ts +275 -0
  120. package/examples/verify.ts +151 -0
  121. package/package.json +45 -5
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAKH,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACpE,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EACV,MAAM,EACN,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,yBAAyB,EACzB,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAGrF,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,cAAc,EACd,4BAA4B,EAC5B,kBAAkB,EAClB,KAAK,eAAe,GACrB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAChH,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK/D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EACV,MAAM,EACN,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGjE,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,yBAAyB,EACzB,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,cAAc,EACd,4BAA4B,EAC5B,kBAAkB,EAClB,KAAK,eAAe,GACrB,MAAM,kBAAkB,CAAC;AAkB1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,55 +1,63 @@
1
1
  /**
2
- * NexArt Code Mode Runtime SDK
3
- * Version: 1.1.0 (Protocol v1.0.0)
2
+ * NexArt Code Mode Runtime SDK - App Integration Layer
4
3
  *
5
4
  * ╔══════════════════════════════════════════════════════════════════════════╗
6
- * ║ @nexart/codemode-sdk Canonical Code Mode Authority
5
+ * ║ LOCAL SDK WRAPPER
7
6
  * ║ ║
8
- * ║ This SDK defines the official Code Mode execution surface.
9
- * ║ All implementations (NexArt, ByX, external) MUST use this SDK.
7
+ * ║ This file re-exports the core runtime from @nexart/codemode-sdk (npm)
8
+ * ║ and adds app-specific integrations (SoundArt, Noise, etc.)
10
9
  * ║ ║
11
- * ║ Protocol: nexart
12
- * ║ Engine: codemode
13
- * ║ SDK Version: 1.1.0 ║
14
- * ║ Protocol Version: 1.0.0 ║
15
- * ║ Phase: 1 ║
16
- * ║ Enforcement: HARD ║
10
+ * ║ For core Code Mode: import from '@nexart/codemode-sdk'
11
+ * ║ For app integrations: import from 'sdk/codemode'
17
12
  * ╚══════════════════════════════════════════════════════════════════════════╝
18
- *
19
- * @example
20
- * ```typescript
21
- * import { executeCodeMode } from '@nexart/codemode-sdk';
22
- *
23
- * const result = await executeCodeMode({
24
- * source: `function setup() { background(255); ellipse(width/2, height/2, 100); }`,
25
- * width: 1950,
26
- * height: 2400,
27
- * seed: 12345,
28
- * vars: [50, 0, 0, 0, 0, 0, 0, 0, 0, 0],
29
- * mode: 'static'
30
- * });
31
- *
32
- * console.log(result.metadata.protocolVersion); // '1.0.0'
33
- * ```
34
13
  */
35
14
  // ═══════════════════════════════════════════════════════════════════════════
36
- // CANONICAL EXECUTION ENTRY POINT
15
+ // CORE RUNTIME - Re-exported from @nexart/codemode-sdk (npm package)
16
+ // ═══════════════════════════════════════════════════════════════════════════
17
+ export { executeCodeMode, validateCodeModeSource, DEFAULT_CONFIG, PROTOCOL_IDENTITY, } from '@nexart/codemode-sdk';
18
+ // ═══════════════════════════════════════════════════════════════════════════
19
+ // LOCAL P5 RUNTIME - Used by app integrations (SoundArt, Noise)
20
+ // The npm package also exports createP5Runtime, but we keep local for
21
+ // app-specific extensions that need tighter integration
37
22
  // ═══════════════════════════════════════════════════════════════════════════
38
- export { executeCodeMode, validateCodeModeSource } from './execute';
39
- export { PROTOCOL_IDENTITY } from './types';
23
+ export { createP5Runtime, injectTimeVariables, injectProtocolVariables, createProtocolVAR } from './p5-runtime';
40
24
  // ═══════════════════════════════════════════════════════════════════════════
41
- // LEGACY ENGINE API (use executeCodeMode for new implementations)
25
+ // LEGACY ENGINE API (kept for backwards compatibility)
42
26
  // ═══════════════════════════════════════════════════════════════════════════
43
27
  export { createEngine } from './engine';
44
- export { DEFAULT_CONFIG } from './types';
28
+ export { DEFAULT_CONFIG as LOCAL_DEFAULT_CONFIG } from './types';
45
29
  // SoundArt → Code Mode integration
46
30
  export { renderSoundArtViaCodeMode, canRenderViaCodeMode, getCodeModeAvailableStyles, } from './soundart-engine';
47
31
  export { createSoundSnapshot, createEmptySoundSnapshot, freezeSoundSnapshot, } from '../../shared/soundSnapshot';
48
32
  export { injectSoundGlobals, createSoundGlobals, createEmptySoundGlobals, generateSoundPalette, inferGenreProfile, createSoundHelpers, } from './sound-bridge';
49
33
  export { getSoundArtSketch, getAvailableSoundArtSketches, isSoundArtSketchAvailable, } from './soundart-sketches';
50
- export { createP5Runtime } from './p5-runtime';
51
34
  // Noise → Code Mode integration
52
35
  export { renderNoiseViaCodeMode, compileNoiseSystem, canRenderNoiseViaCodeMode, } from './noise-engine';
53
36
  export { createNoiseSnapshot, validateNoiseSnapshot, } from '../../shared/noiseSnapshot';
54
37
  export { createNoiseGlobals, injectNoiseGlobals, } from './noise-bridge';
55
38
  export { getNoiseSketch, getAvailableNoiseSketchNames, isValidNoiseSketch, } from './noise-sketches';
39
+ // ═══════════════════════════════════════════════════════════════════════════
40
+ // BUILDER MANIFEST (v1.6.0) — Passive Attribution
41
+ //
42
+ // The Builder Manifest is a declaration of intent, not a capability.
43
+ // The SDK does not expose any API to read or inspect manifests.
44
+ //
45
+ // This is:
46
+ // - Declarative (write-only)
47
+ // - Optional (no errors if missing)
48
+ // - Non-enforced (no validation)
49
+ // - Non-rewarding (no incentives)
50
+ //
51
+ // There is NO SDK API to read manifests, NO validation, NO attribution
52
+ // logic, and NO tracking. Execution behavior is identical with or without
53
+ // a manifest registered.
54
+ // ═══════════════════════════════════════════════════════════════════════════
55
+ export { registerBuilderManifest } from './builder-manifest';
56
+ // ═══════════════════════════════════════════════════════════════════════════
57
+ // EXECUTION BOUNDARY (Internal — Not Exported)
58
+ //
59
+ // The execution sandbox blocks all external entropy sources at runtime.
60
+ // See EXECUTION_BOUNDARY.md for details.
61
+ // ═══════════════════════════════════════════════════════════════════════════
62
+ // Note: FORBIDDEN_APIS and createSafeMath are NOT exported.
63
+ // They are internal implementation details used by the engines.
@@ -0,0 +1,52 @@
1
+ /**
2
+ * NexArt Code Mode SDK - Agent-First Runtime Authority Layer
3
+ * Version: 1.8.0 (Protocol v1.2.0)
4
+ *
5
+ * ╔══════════════════════════════════════════════════════════════════════════╗
6
+ * ║ AGENT-FIRST RUNTIME — DETERMINISTIC EXECUTION AUTHORITY ║
7
+ * ║ ║
8
+ * ║ This module provides a high-level runtime API designed for AI agents ║
9
+ * ║ (Replit, Lovable, Claude Code) to reliably execute deterministic code. ║
10
+ * ║ ║
11
+ * ║ Key Features: ║
12
+ * ║ - Deterministic PRNG: runtime.random() (seeded Mulberry32) ║
13
+ * ║ - Deterministic noise: runtime.noise(x, y?, z?) (seeded Perlin) ║
14
+ * ║ - Strict mode: Throws on Math.random, Date.now, performance.now ║
15
+ * ║ - Digest: Stable hash for verification and replay ║
16
+ * ║ - State snapshot: Canonical state for bundles ║
17
+ * ║ ║
18
+ * ║ BROWSER-SAFE: No Node.js dependencies. Works in Vite/Next/React. ║
19
+ * ╚══════════════════════════════════════════════════════════════════════════╝
20
+ */
21
+ export declare const RUNTIME_VERSION = "1.8.0";
22
+ export interface RuntimeOptions {
23
+ seed: string | number;
24
+ vars?: number[];
25
+ strict?: boolean;
26
+ mode?: 'static' | 'loop';
27
+ metadata?: Record<string, unknown>;
28
+ }
29
+ export interface RuntimeState {
30
+ sdkVersion: string;
31
+ seed: number;
32
+ vars: number[];
33
+ mode: 'static' | 'loop';
34
+ metadata?: Record<string, unknown>;
35
+ }
36
+ export interface NexArtRuntime {
37
+ random(): number;
38
+ randomInt(min: number, max: number): number;
39
+ randomRange(min: number, max: number): number;
40
+ noise(x: number, y?: number, z?: number): number;
41
+ run<T>(fn: () => T): T;
42
+ digest(): string;
43
+ getState(): RuntimeState;
44
+ getSeed(): number;
45
+ readonly strict: boolean;
46
+ }
47
+ export declare function createRuntime(options: RuntimeOptions): NexArtRuntime;
48
+ export declare const NexArtRuntime: {
49
+ create: typeof createRuntime;
50
+ VERSION: string;
51
+ };
52
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,IAAI,MAAM,CAAC;IACjB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5C,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9C,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjD,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IACvB,MAAM,IAAI,MAAM,CAAC;IACjB,QAAQ,IAAI,YAAY,CAAC;IACzB,OAAO,IAAI,MAAM,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAqGD,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,aAAa,CAuHpE;AAED,eAAO,MAAM,aAAa;;;CAGzB,CAAC"}
@@ -0,0 +1,219 @@
1
+ /**
2
+ * NexArt Code Mode SDK - Agent-First Runtime Authority Layer
3
+ * Version: 1.8.0 (Protocol v1.2.0)
4
+ *
5
+ * ╔══════════════════════════════════════════════════════════════════════════╗
6
+ * ║ AGENT-FIRST RUNTIME — DETERMINISTIC EXECUTION AUTHORITY ║
7
+ * ║ ║
8
+ * ║ This module provides a high-level runtime API designed for AI agents ║
9
+ * ║ (Replit, Lovable, Claude Code) to reliably execute deterministic code. ║
10
+ * ║ ║
11
+ * ║ Key Features: ║
12
+ * ║ - Deterministic PRNG: runtime.random() (seeded Mulberry32) ║
13
+ * ║ - Deterministic noise: runtime.noise(x, y?, z?) (seeded Perlin) ║
14
+ * ║ - Strict mode: Throws on Math.random, Date.now, performance.now ║
15
+ * ║ - Digest: Stable hash for verification and replay ║
16
+ * ║ - State snapshot: Canonical state for bundles ║
17
+ * ║ ║
18
+ * ║ BROWSER-SAFE: No Node.js dependencies. Works in Vite/Next/React. ║
19
+ * ╚══════════════════════════════════════════════════════════════════════════╝
20
+ */
21
+ export const RUNTIME_VERSION = '1.8.0';
22
+ function hashSeed(seed) {
23
+ if (typeof seed === 'number') {
24
+ return Math.floor(seed) >>> 0;
25
+ }
26
+ let hash = 0;
27
+ for (let i = 0; i < seed.length; i++) {
28
+ const char = seed.charCodeAt(i);
29
+ hash = ((hash << 5) - hash) + char;
30
+ hash = hash >>> 0;
31
+ }
32
+ return hash || 1;
33
+ }
34
+ function createSeededRNG(seed) {
35
+ let a = seed >>> 0;
36
+ return () => {
37
+ a += 0x6D2B79F5;
38
+ let t = Math.imul(a ^ (a >>> 15), a | 1);
39
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
40
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
41
+ };
42
+ }
43
+ function createSeededNoise(seed) {
44
+ const permutation = [];
45
+ const rng = createSeededRNG(seed);
46
+ for (let i = 0; i < 256; i++) {
47
+ permutation[i] = i;
48
+ }
49
+ for (let i = 255; i > 0; i--) {
50
+ const j = Math.floor(rng() * (i + 1));
51
+ [permutation[i], permutation[j]] = [permutation[j], permutation[i]];
52
+ }
53
+ for (let i = 0; i < 256; i++) {
54
+ permutation[256 + i] = permutation[i];
55
+ }
56
+ const fade = (t) => t * t * t * (t * (t * 6 - 15) + 10);
57
+ const lerp = (a, b, t) => a + t * (b - a);
58
+ const grad = (hash, x, y, z) => {
59
+ const h = hash & 15;
60
+ const u = h < 8 ? x : y;
61
+ const v = h < 4 ? y : h === 12 || h === 14 ? x : z;
62
+ return ((h & 1) === 0 ? u : -u) + ((h & 2) === 0 ? v : -v);
63
+ };
64
+ return (x, y = 0, z = 0) => {
65
+ const X = Math.floor(x) & 255;
66
+ const Y = Math.floor(y) & 255;
67
+ const Z = Math.floor(z) & 255;
68
+ x -= Math.floor(x);
69
+ y -= Math.floor(y);
70
+ z -= Math.floor(z);
71
+ const u = fade(x);
72
+ const v = fade(y);
73
+ const w = fade(z);
74
+ const A = permutation[X] + Y;
75
+ const AA = permutation[A] + Z;
76
+ const AB = permutation[A + 1] + Z;
77
+ const B = permutation[X + 1] + Y;
78
+ const BA = permutation[B] + Z;
79
+ const BB = permutation[B + 1] + Z;
80
+ return (lerp(lerp(lerp(grad(permutation[AA], x, y, z), grad(permutation[BA], x - 1, y, z), u), lerp(grad(permutation[AB], x, y - 1, z), grad(permutation[BB], x - 1, y - 1, z), u), v), lerp(lerp(grad(permutation[AA + 1], x, y, z - 1), grad(permutation[BA + 1], x - 1, y, z - 1), u), lerp(grad(permutation[AB + 1], x, y - 1, z - 1), grad(permutation[BB + 1], x - 1, y - 1, z - 1), u), v), w) + 1) / 2;
81
+ };
82
+ }
83
+ function stableStringify(obj) {
84
+ if (obj === null)
85
+ return 'null';
86
+ if (obj === undefined)
87
+ return 'undefined';
88
+ if (typeof obj !== 'object')
89
+ return JSON.stringify(obj);
90
+ if (Array.isArray(obj)) {
91
+ return '[' + obj.map(stableStringify).join(',') + ']';
92
+ }
93
+ const keys = Object.keys(obj).sort();
94
+ const pairs = keys.map(k => `${JSON.stringify(k)}:${stableStringify(obj[k])}`);
95
+ return '{' + pairs.join(',') + '}';
96
+ }
97
+ function fnv1aHash(str) {
98
+ let hash = 0x811c9dc5;
99
+ for (let i = 0; i < str.length; i++) {
100
+ hash ^= str.charCodeAt(i);
101
+ hash = Math.imul(hash, 0x01000193);
102
+ }
103
+ const h1 = (hash >>> 0).toString(16).padStart(8, '0');
104
+ let hash2 = 0x811c9dc5;
105
+ for (let i = str.length - 1; i >= 0; i--) {
106
+ hash2 ^= str.charCodeAt(i);
107
+ hash2 = Math.imul(hash2, 0x01000193);
108
+ }
109
+ const h2 = (hash2 >>> 0).toString(16).padStart(8, '0');
110
+ return h1 + h2;
111
+ }
112
+ export function createRuntime(options) {
113
+ const numericSeed = hashSeed(options.seed);
114
+ const vars = options.vars ?? [];
115
+ const mode = options.mode ?? 'static';
116
+ const strict = options.strict ?? false;
117
+ const metadata = options.metadata;
118
+ if (vars.length > 10) {
119
+ throw new Error(`[NexArt Runtime] vars array must have 0-10 elements, got ${vars.length}`);
120
+ }
121
+ for (let i = 0; i < vars.length; i++) {
122
+ if (typeof vars[i] !== 'number' || !Number.isFinite(vars[i])) {
123
+ throw new Error(`[NexArt Runtime] vars[${i}] must be a finite number`);
124
+ }
125
+ if (vars[i] < 0 || vars[i] > 100) {
126
+ throw new Error(`[NexArt Runtime] vars[${i}] must be in range 0-100, got ${vars[i]}`);
127
+ }
128
+ }
129
+ const paddedVars = [...vars];
130
+ while (paddedVars.length < 10) {
131
+ paddedVars.push(0);
132
+ }
133
+ const rng = createSeededRNG(numericSeed);
134
+ const noiseFunc = createSeededNoise(numericSeed);
135
+ const state = {
136
+ sdkVersion: RUNTIME_VERSION,
137
+ seed: numericSeed,
138
+ vars: paddedVars,
139
+ mode,
140
+ ...(metadata !== undefined && { metadata }),
141
+ };
142
+ function random() {
143
+ return rng();
144
+ }
145
+ function randomInt(min, max) {
146
+ const range = max - min + 1;
147
+ return Math.floor(rng() * range) + min;
148
+ }
149
+ function randomRange(min, max) {
150
+ return rng() * (max - min) + min;
151
+ }
152
+ function noise(x, y, z) {
153
+ return noiseFunc(x, y ?? 0, z ?? 0);
154
+ }
155
+ function run(fn) {
156
+ if (!strict) {
157
+ return fn();
158
+ }
159
+ const originalMathRandom = Math.random;
160
+ const originalDateNow = Date.now;
161
+ const hasPerformance = typeof performance !== 'undefined' && performance !== null;
162
+ const originalPerformanceNow = hasPerformance ? performance.now : undefined;
163
+ const throwMathRandom = () => {
164
+ throw new Error('NEXART_STRICT: Non-deterministic API used: Math.random. Use runtime.random() instead.');
165
+ };
166
+ const throwDateNow = () => {
167
+ throw new Error('NEXART_STRICT: Non-deterministic API used: Date.now. Pass time as an input or use deterministic counters.');
168
+ };
169
+ const throwPerformanceNow = () => {
170
+ throw new Error('NEXART_STRICT: Non-deterministic API used: performance.now.');
171
+ };
172
+ try {
173
+ Math.random = throwMathRandom;
174
+ Date.now = throwDateNow;
175
+ if (hasPerformance && originalPerformanceNow) {
176
+ performance.now = throwPerformanceNow;
177
+ }
178
+ return fn();
179
+ }
180
+ finally {
181
+ Math.random = originalMathRandom;
182
+ Date.now = originalDateNow;
183
+ if (hasPerformance && originalPerformanceNow) {
184
+ performance.now = originalPerformanceNow;
185
+ }
186
+ }
187
+ }
188
+ function digest() {
189
+ const input = stableStringify({
190
+ sdkVersion: RUNTIME_VERSION,
191
+ seed: numericSeed,
192
+ vars: paddedVars,
193
+ mode,
194
+ ...(metadata !== undefined && { metadata }),
195
+ });
196
+ return fnv1aHash(input);
197
+ }
198
+ function getState() {
199
+ return { ...state, vars: [...state.vars] };
200
+ }
201
+ function getSeed() {
202
+ return numericSeed;
203
+ }
204
+ return Object.freeze({
205
+ random,
206
+ randomInt,
207
+ randomRange,
208
+ noise,
209
+ run,
210
+ digest,
211
+ getState,
212
+ getSeed,
213
+ strict,
214
+ });
215
+ }
216
+ export const NexArtRuntime = {
217
+ create: createRuntime,
218
+ VERSION: RUNTIME_VERSION,
219
+ };
@@ -0,0 +1,79 @@
1
+ /**
2
+ * NexArt Code Mode SDK - Builder Manifest
3
+ * Version: 1.6.0 (Protocol v1.2.0)
4
+ *
5
+ * ╔══════════════════════════════════════════════════════════════════════════╗
6
+ * ║ BUILDER MANIFEST — PASSIVE ATTRIBUTION (WRITE-ONLY) ║
7
+ * ║ ║
8
+ * ║ The Builder Manifest is a declaration of intent, not a capability. ║
9
+ * ║ The SDK does not expose any API to read or inspect manifests. ║
10
+ * ║ ║
11
+ * ║ This is: ║
12
+ * ║ - Declarative (write-only, no read API exposed) ║
13
+ * ║ - Optional (no errors if missing or invalid) ║
14
+ * ║ - Non-enforced (no validation logic) ║
15
+ * ║ - Non-rewarding (no incentives, no tracking) ║
16
+ * ║ ║
17
+ * ║ There is: ║
18
+ * ║ - No SDK API to read manifests ║
19
+ * ║ - No validation ║
20
+ * ║ - No attribution logic ║
21
+ * ║ - No tracking, analytics, or network calls ║
22
+ * ║ ║
23
+ * ║ Execution behavior is identical with or without a manifest. ║
24
+ * ╚══════════════════════════════════════════════════════════════════════════╝
25
+ */
26
+ import type { NexArtBuilderManifest } from './types';
27
+ /**
28
+ * Register a builder manifest for attribution.
29
+ *
30
+ * This is optional and does not affect execution behavior.
31
+ * The manifest is stored in-memory only and is not:
32
+ * - Serialized to disk
33
+ * - Sent over the network
34
+ * - Logged to console
35
+ * - Used for validation or enforcement
36
+ *
37
+ * @param manifest - Optional builder manifest. Pass undefined to clear.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * import { registerBuilderManifest } from "@nexart/codemode-sdk";
42
+ *
43
+ * registerBuilderManifest({
44
+ * protocol: "nexart",
45
+ * manifestVersion: "0.1",
46
+ * app: { name: "My App", url: "https://myapp.com" }
47
+ * });
48
+ * ```
49
+ */
50
+ export declare function registerBuilderManifest(manifest?: NexArtBuilderManifest): void;
51
+ /**
52
+ * Get the currently registered builder manifest.
53
+ *
54
+ * ╔══════════════════════════════════════════════════════════════════════════╗
55
+ * ║ INTERNAL FUNCTION — NOT EXPORTED TO SDK CONSUMERS ║
56
+ * ║ ║
57
+ * ║ This function exists only for internal SDK execution context. ║
58
+ * ║ It is NOT part of the public API and must NOT be exported from index. ║
59
+ * ║ Runtime code and sketch code cannot access this function. ║
60
+ * ╚══════════════════════════════════════════════════════════════════════════╝
61
+ *
62
+ * @internal
63
+ */
64
+ export declare function getBuilderManifest(): NexArtBuilderManifest | null;
65
+ /**
66
+ * Clear the registered builder manifest.
67
+ *
68
+ * ╔══════════════════════════════════════════════════════════════════════════╗
69
+ * ║ INTERNAL FUNCTION — NOT EXPORTED TO SDK CONSUMERS ║
70
+ * ║ ║
71
+ * ║ This function exists only for internal SDK execution context. ║
72
+ * ║ It is NOT part of the public API and must NOT be exported from index. ║
73
+ * ║ Runtime code and sketch code cannot access this function. ║
74
+ * ╚══════════════════════════════════════════════════════════════════════════╝
75
+ *
76
+ * @internal
77
+ */
78
+ export declare function clearBuilderManifest(): void;
79
+ //# sourceMappingURL=builder-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder-manifest.d.ts","sourceRoot":"","sources":["../../../builder-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAiB9E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,IAAI,qBAAqB,GAAG,IAAI,CAEjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
@@ -0,0 +1,97 @@
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
+ }
@@ -0,0 +1,21 @@
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.1.1";
20
+ export declare const SDK_NAME = "@nexart/codemode-sdk";
21
+ //# sourceMappingURL=core-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-index.d.ts","sourceRoot":"","sources":["../../../core-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,iBAAiB,EACjB,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,OAAO,EACP,OAAO,EACP,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,WAAW,EACX,cAAc,GACf,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,GACb,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,eAAO,MAAM,WAAW,UAAU,CAAC;AACnC,eAAO,MAAM,QAAQ,yBAAyB,CAAC"}
@@ -0,0 +1,26 @@
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.1.1';
26
+ export const SDK_NAME = '@nexart/codemode-sdk';
@@ -0,0 +1,24 @@
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
@@ -0,0 +1 @@
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"}