@promptbook/wizard 0.112.0-115 → 0.112.0-118

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 (31) hide show
  1. package/esm/index.es.js +211 -59
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/_packages/components.index.d.ts +2 -0
  4. package/esm/src/_packages/node.index.d.ts +20 -0
  5. package/esm/src/book-3.0/BookNodeAgentSource.d.ts +1 -1
  6. package/esm/src/book-3.0/CliAgent.d.ts +15 -17
  7. package/esm/src/book-3.0/agentFolderPaths.d.ts +30 -0
  8. package/esm/src/book-3.0/cliAgentEnv.d.ts +33 -0
  9. package/esm/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
  10. package/esm/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
  11. package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
  12. package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
  13. package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +2 -18
  14. package/esm/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
  15. package/esm/src/version.d.ts +1 -1
  16. package/package.json +2 -3
  17. package/umd/index.umd.js +215 -59
  18. package/umd/index.umd.js.map +1 -1
  19. package/umd/src/_packages/components.index.d.ts +2 -0
  20. package/umd/src/_packages/node.index.d.ts +20 -0
  21. package/umd/src/book-3.0/BookNodeAgentSource.d.ts +1 -1
  22. package/umd/src/book-3.0/CliAgent.d.ts +15 -17
  23. package/umd/src/book-3.0/agentFolderPaths.d.ts +30 -0
  24. package/umd/src/book-3.0/cliAgentEnv.d.ts +33 -0
  25. package/umd/src/book-components/BookEditor/BookEditorBrowserConfig.d.ts +2 -0
  26. package/umd/src/book-components/BookEditor/BookEditorForClient.d.ts +7 -0
  27. package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +9 -0
  28. package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +2 -30
  29. package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +2 -18
  30. package/umd/src/scrapers/website/utils/createShowdownConverter.d.ts +2 -2
  31. package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('socket.io-client'), require('spacetrim'), require('@anthropic-ai/sdk'), require('bottleneck'), require('colors'), require('@azure/openai'), require('fs/promises'), require('child_process'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('@mozilla/readability'), require('jsdom'), require('showdown'), require('dotenv'), require('crypto-js/sha256'), require('jszip'), require('rxjs'), require('crypto'), require('moment'), require('mime-types'), require('papaparse'), require('@openai/agents'), require('openai')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'socket.io-client', 'spacetrim', '@anthropic-ai/sdk', 'bottleneck', 'colors', '@azure/openai', 'fs/promises', 'child_process', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', '@mozilla/readability', 'jsdom', 'showdown', 'dotenv', 'crypto-js/sha256', 'jszip', 'rxjs', 'crypto', 'moment', 'mime-types', 'papaparse', '@openai/agents', 'openai'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-wizard"] = {}, global.socket_ioClient, global._spaceTrim, global.Anthropic, global.Bottleneck, global.colors, global.openai, global.promises, global.child_process, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.readability, global.jsdom, global.showdown, global.dotenv, global.sha256, global.JSZip, global.rxjs, global.crypto, global.moment, global.mimeTypes, global.papaparse, global.agents, global.OpenAI));
5
- })(this, (function (exports, socket_ioClient, _spaceTrim, Anthropic, Bottleneck, colors, openai, promises, child_process, waitasecond, cryptoJs, hexEncoder, path, readability, jsdom, showdown, dotenv, sha256, JSZip, rxjs, crypto, moment, mimeTypes, papaparse, agents, OpenAI) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('socket.io-client'), require('spacetrim'), require('@anthropic-ai/sdk'), require('bottleneck'), require('colors'), require('@azure/openai'), require('fs/promises'), require('child_process'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('@mozilla/readability'), require('jsdom'), require('showdown'), require('dotenv'), require('crypto-js/sha256'), require('jszip'), require('rxjs'), require('moment'), require('mime-types'), require('papaparse'), require('@openai/agents'), require('openai')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'socket.io-client', 'spacetrim', '@anthropic-ai/sdk', 'bottleneck', 'colors', '@azure/openai', 'fs/promises', 'child_process', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', '@mozilla/readability', 'jsdom', 'showdown', 'dotenv', 'crypto-js/sha256', 'jszip', 'rxjs', 'moment', 'mime-types', 'papaparse', '@openai/agents', 'openai'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-wizard"] = {}, global.socket_ioClient, global._spaceTrim, global.Anthropic, global.Bottleneck, global.colors, global.openai, global.promises, global.child_process, global.waitasecond, global.CryptoJS, global.hexEncoder, global.path, global.readability, global.jsdom, global.showdown, global.dotenv, global.sha256, global.JSZip, global.rxjs, global.moment, global.mimeTypes, global.papaparse, global.agents, global.OpenAI));
5
+ })(this, (function (exports, socket_ioClient, _spaceTrim, Anthropic, Bottleneck, colors, openai, promises, child_process, waitasecond, CryptoJS, hexEncoder, path, readability, jsdom, showdown, dotenv, sha256, JSZip, rxjs, moment, mimeTypes, papaparse, agents, OpenAI) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -28,11 +28,14 @@
28
28
  var Anthropic__default = /*#__PURE__*/_interopDefaultLegacy(Anthropic);
29
29
  var Bottleneck__default = /*#__PURE__*/_interopDefaultLegacy(Bottleneck);
30
30
  var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
31
+ var CryptoJS__default = /*#__PURE__*/_interopDefaultLegacy(CryptoJS);
31
32
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
33
+ var showdown__default = /*#__PURE__*/_interopDefaultLegacy(showdown);
32
34
  var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
33
35
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
34
36
  var JSZip__default = /*#__PURE__*/_interopDefaultLegacy(JSZip);
35
37
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
38
+ var papaparse__default = /*#__PURE__*/_interopDefaultLegacy(papaparse);
36
39
  var OpenAI__default = /*#__PURE__*/_interopDefaultLegacy(OpenAI);
37
40
 
38
41
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
@@ -49,7 +52,7 @@
49
52
  * @generated
50
53
  * @see https://github.com/webgptorg/promptbook
51
54
  */
52
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-115';
55
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-118';
53
56
  /**
54
57
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
55
58
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2357,7 +2360,7 @@
2357
2360
  * @private internal helper function
2358
2361
  */
2359
2362
  function $randomToken(randomness) {
2360
- return crypto.randomBytes(randomness).toString('hex');
2363
+ return CryptoJS__default["default"].lib.WordArray.random(randomness).toString(CryptoJS__default["default"].enc.Hex);
2361
2364
  }
2362
2365
  // TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
2363
2366
  // TODO: Maybe use nanoid instead https://github.com/ai/nanoid
@@ -13312,7 +13315,7 @@
13312
13315
  * @public exported from `@promptbook/editable`
13313
13316
  */
13314
13317
  function knowledgeSourceContentToName(knowledgeSourceContent) {
13315
- const hash = cryptoJs.SHA256(hexEncoder__default["default"].parse(JSON.stringify(knowledgeSourceContent)))
13318
+ const hash = CryptoJS__default["default"].SHA256(hexEncoder__default["default"].parse(JSON.stringify(knowledgeSourceContent)))
13316
13319
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
13317
13320
  .toString( /* hex */)
13318
13321
  .substring(0, 20);
@@ -14192,7 +14195,7 @@
14192
14195
  console.warn('CSV string contains carriage return characters, but in the CSV settings the `newline` setting does not include them. Autohealing the CSV string.');
14193
14196
  value = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
14194
14197
  }
14195
- const csv = papaparse.parse(value, settings);
14198
+ const csv = papaparse__default["default"].parse(value, settings);
14196
14199
  return csv;
14197
14200
  }
14198
14201
 
@@ -14277,10 +14280,10 @@
14277
14280
  i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
14278
14281
  );
14279
14282
  */
14280
- await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
14283
+ await onProgress(papaparse__default["default"].unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
14281
14284
  }
14282
14285
  }
14283
- return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
14286
+ return papaparse__default["default"].unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
14284
14287
  },
14285
14288
  },
14286
14289
  {
@@ -14308,7 +14311,7 @@
14308
14311
  return /* not await */ mapCallback({ [key]: value }, index, array.length);
14309
14312
  }));
14310
14313
  }));
14311
- return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
14314
+ return papaparse__default["default"].unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
14312
14315
  },
14313
14316
  },
14314
14317
  ],
@@ -16324,7 +16327,7 @@
16324
16327
  const { filename: sourceFilename, url } = source;
16325
16328
  const { rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose } = options;
16326
16329
  // TODO: [👬] DRY
16327
- const hash = cryptoJs.SHA256(
16330
+ const hash = CryptoJS__default["default"].SHA256(
16328
16331
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
16329
16332
  hexEncoder__default["default"].parse(sourceFilename || url || 'untitled'))
16330
16333
  .toString( /* hex */)
@@ -17227,7 +17230,7 @@
17227
17230
  * @private utility of `WebsiteScraper`
17228
17231
  */
17229
17232
  function createShowdownConverter() {
17230
- return new showdown.Converter({
17233
+ return new showdown__default["default"].Converter({
17231
17234
  flavor: 'github',
17232
17235
  /*
17233
17236
  > import showdownHighlight from 'showdown-highlight';
@@ -17411,7 +17414,7 @@
17411
17414
  * @public exported from `@promptbook/utils`
17412
17415
  */
17413
17416
  function computeHash(value) {
17414
- return cryptoJs.SHA256(hexEncoder__default["default"].parse(_spaceTrim.spaceTrim(valueToString(value)))).toString( /* hex */);
17417
+ return CryptoJS__default["default"].SHA256(hexEncoder__default["default"].parse(_spaceTrim.spaceTrim(valueToString(value)))).toString( /* hex */);
17415
17418
  }
17416
17419
  // TODO: [🥬][🥬] Use this ACRY
17417
17420
 
@@ -22105,21 +22108,22 @@
22105
22108
  * @private helper of `fractalAvatarVisual`
22106
22109
  */
22107
22110
  function drawDragonCurveLayer(context, points, options) {
22108
- const { size, primaryColor, secondaryColor, tertiaryColor, shadowColor, strokeWidth, timeMs, layerIndex } = options;
22111
+ const { primaryColor, secondaryColor, tertiaryColor, shadowColor, strokeWidth, timeMs, layerIndex } = options;
22109
22112
  const firstPoint = points[0];
22110
22113
  const lastPoint = points[points.length - 1];
22111
22114
  const ribbonGradient = context.createLinearGradient(firstPoint.x, firstPoint.y, lastPoint.x, lastPoint.y);
22112
22115
  ribbonGradient.addColorStop(0, `${primaryColor}f2`);
22113
22116
  ribbonGradient.addColorStop(0.5, `${secondaryColor}e6`);
22114
22117
  ribbonGradient.addColorStop(1, `${tertiaryColor}f2`);
22118
+ // Approximate the blurred shadow stroke with a wider semi-transparent stroke instead of
22119
+ // context.filter blur, which triggers a costly software rasterization pass every frame.
22115
22120
  context.save();
22116
22121
  context.beginPath();
22117
22122
  tracePolyline(context, points);
22118
- context.strokeStyle = `${shadowColor}82`;
22119
- context.lineWidth = strokeWidth * 1.8;
22123
+ context.strokeStyle = `${shadowColor}48`;
22124
+ context.lineWidth = strokeWidth * 4.5;
22120
22125
  context.lineJoin = 'round';
22121
22126
  context.lineCap = 'round';
22122
- context.filter = `blur(${size * 0.022}px)`;
22123
22127
  context.stroke();
22124
22128
  context.restore();
22125
22129
  context.beginPath();
@@ -22703,11 +22707,23 @@
22703
22707
  * @private helper of `minecraft2AvatarVisual`
22704
22708
  */
22705
22709
  function drawMinecraftShadow(context, size, palette, interaction, timeMs) {
22710
+ const cx = size * 0.5 + interaction.gazeX * size * 0.03;
22711
+ const cy = size * 0.85 + Math.sin(timeMs / 880) * size * 0.01;
22712
+ const rx = size * (0.16 + interaction.intensity * 0.015);
22713
+ const ry = size * 0.055;
22714
+ // Radial gradient approximates the blurry ellipse shadow without context.filter blur.
22706
22715
  context.save();
22707
- context.fillStyle = `${palette.shadow}66`;
22708
- context.filter = `blur(${size * 0.02}px)`;
22716
+ context.translate(cx, cy);
22717
+ context.scale(1, ry / rx);
22718
+ const blurRadius = rx * 1.4;
22719
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
22720
+ shadowGradient.addColorStop(0, `${palette.shadow}7a`);
22721
+ shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
22722
+ shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
22723
+ shadowGradient.addColorStop(1, `${palette.shadow}00`);
22724
+ context.fillStyle = shadowGradient;
22709
22725
  context.beginPath();
22710
- context.ellipse(size * 0.5 + interaction.gazeX * size * 0.03, size * 0.85 + Math.sin(timeMs / 880) * size * 0.01, size * (0.16 + interaction.intensity * 0.015), size * 0.055, 0, 0, Math.PI * 2);
22726
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
22711
22727
  context.fill();
22712
22728
  context.restore();
22713
22729
  }
@@ -22931,13 +22947,27 @@
22931
22947
  spotlight.addColorStop(1, `${palette.highlight}00`);
22932
22948
  context.fillStyle = spotlight;
22933
22949
  context.fillRect(0, 0, size, size);
22934
- context.save();
22935
- context.fillStyle = 'rgba(0, 0, 0, 0.22)';
22936
- context.filter = `blur(${size * 0.018}px)`;
22937
- context.beginPath();
22938
- context.ellipse(size * 0.5, size * 0.86, size * 0.2, size * 0.06, 0, 0, Math.PI * 2);
22939
- context.fill();
22940
- context.restore();
22950
+ {
22951
+ // Radial gradient approximates the blurry ellipse shadow without context.filter blur.
22952
+ const cx = size * 0.5;
22953
+ const cy = size * 0.86;
22954
+ const rx = size * 0.2;
22955
+ const ry = size * 0.06;
22956
+ const blurRadius = rx * 1.4;
22957
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
22958
+ shadowGradient.addColorStop(0, 'rgba(0,0,0,0.28)');
22959
+ shadowGradient.addColorStop(0.45, 'rgba(0,0,0,0.14)');
22960
+ shadowGradient.addColorStop(0.8, 'rgba(0,0,0,0.05)');
22961
+ shadowGradient.addColorStop(1, 'rgba(0,0,0,0)');
22962
+ context.save();
22963
+ context.translate(cx, cy);
22964
+ context.scale(1, ry / rx);
22965
+ context.fillStyle = shadowGradient;
22966
+ context.beginPath();
22967
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
22968
+ context.fill();
22969
+ context.restore();
22970
+ }
22941
22971
  drawVoxelCuboid(context, {
22942
22972
  x: bodyX,
22943
22973
  y: bodyY,
@@ -23989,6 +24019,35 @@
23989
24019
  y: -0.62,
23990
24020
  z: 0.94,
23991
24021
  });
24022
+ /**
24023
+ * Cache keyed by the `createRandom` factory reference (stable per mounted `<Avatar/>`).
24024
+ *
24025
+ * @private helper of `octopus3dAvatarVisual`
24026
+ */
24027
+ const octopus3dStableStateCache = new WeakMap();
24028
+ /**
24029
+ * Returns the stable per-avatar state, computing it on first access and caching for subsequent frames.
24030
+ *
24031
+ * @private helper of `octopus3dAvatarVisual`
24032
+ */
24033
+ function getOctopus3dStableState(createRandom) {
24034
+ const cached = octopus3dStableStateCache.get(createRandom);
24035
+ if (cached !== undefined) {
24036
+ return cached;
24037
+ }
24038
+ const animationRandom = createRandom('octopus3d-animation-profile');
24039
+ const eyeRandom = createRandom('octopus3d-eye-profile');
24040
+ const leftEyePhaseOffset = eyeRandom() * 0.6;
24041
+ const rightEyePhaseOffset = eyeRandom() * 0.6;
24042
+ const state = {
24043
+ morphologyProfile: createOctopus3MorphologyProfile(createRandom),
24044
+ animationPhase: animationRandom() * Math.PI * 2,
24045
+ leftEyePhaseOffset,
24046
+ rightEyePhaseOffset,
24047
+ };
24048
+ octopus3dStableStateCache.set(createRandom, state);
24049
+ return state;
24050
+ }
23992
24051
  /**
23993
24052
  * Proper 3D Octopus visual built from projected organic meshes and tentacles.
23994
24053
  *
@@ -24001,10 +24060,7 @@
24001
24060
  isAnimated: true,
24002
24061
  supportsPointerTracking: true,
24003
24062
  render({ context, size, palette, createRandom, timeMs, interaction }) {
24004
- const morphologyProfile = createOctopus3MorphologyProfile(createRandom);
24005
- const animationRandom = createRandom('octopus3d-animation-profile');
24006
- const eyeRandom = createRandom('octopus3d-eye-profile');
24007
- const animationPhase = animationRandom() * Math.PI * 2;
24063
+ const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset } = getOctopus3dStableState(createRandom);
24008
24064
  const sceneCenterX = size * 0.5;
24009
24065
  const sceneCenterY = size * 0.56;
24010
24066
  const bob = Math.sin(timeMs / 920 + animationPhase) * size * 0.014;
@@ -24101,12 +24157,12 @@
24101
24157
  x: -faceEyeSpacing,
24102
24158
  y: faceEyeYOffset,
24103
24159
  z: resolveEllipsoidSurfaceDepth(mantleRadiusX, mantleRadiusY, mantleRadiusZ, -faceEyeSpacing, faceEyeYOffset),
24104
- }, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + eyeRandom() * 0.6, interaction, morphologyProfile.face.eyeStyle);
24160
+ }, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + leftEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
24105
24161
  drawProjectedOrganicEye(context, {
24106
24162
  x: faceEyeSpacing,
24107
24163
  y: faceEyeYOffset,
24108
24164
  z: resolveEllipsoidSurfaceDepth(mantleRadiusX, mantleRadiusY, mantleRadiusZ, faceEyeSpacing, faceEyeYOffset),
24109
- }, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.7 + eyeRandom() * 0.6, interaction, morphologyProfile.face.eyeStyle);
24165
+ }, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.7 + rightEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
24110
24166
  drawProjectedOrganicMouth(context, [
24111
24167
  {
24112
24168
  x: -mouthHalfWidth,
@@ -24150,14 +24206,28 @@
24150
24206
  /**
24151
24207
  * Draws the soft ground shadow below the octopus.
24152
24208
  *
24209
+ * Uses a scaled radial gradient instead of `context.filter = 'blur()'` to approximate the
24210
+ * blurry ellipse without triggering a costly software rasterization pass on every frame.
24211
+ *
24153
24212
  * @private helper of `octopus3dAvatarVisual`
24154
24213
  */
24155
24214
  function drawOctopus3dShadow(context, size, palette, interaction, timeMs) {
24215
+ const cx = size * 0.5 + interaction.gazeX * size * 0.04;
24216
+ const cy = size * 0.87 + Math.sin(timeMs / 920) * size * 0.008;
24217
+ const rx = size * (0.18 + interaction.intensity * 0.02);
24218
+ const ry = size * 0.06;
24156
24219
  context.save();
24157
- context.fillStyle = `${palette.shadow}66`;
24158
- context.filter = `blur(${size * 0.022}px)`;
24220
+ context.translate(cx, cy);
24221
+ context.scale(1, ry / rx);
24222
+ const blurRadius = rx * 1.4;
24223
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
24224
+ shadowGradient.addColorStop(0, `${palette.shadow}7a`);
24225
+ shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
24226
+ shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
24227
+ shadowGradient.addColorStop(1, `${palette.shadow}00`);
24228
+ context.fillStyle = shadowGradient;
24159
24229
  context.beginPath();
24160
- context.ellipse(size * 0.5 + interaction.gazeX * size * 0.04, size * 0.87 + Math.sin(timeMs / 920) * size * 0.008, size * (0.18 + interaction.intensity * 0.02), size * 0.06, 0, 0, Math.PI * 2);
24230
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
24161
24231
  context.fill();
24162
24232
  context.restore();
24163
24233
  }
@@ -24388,6 +24458,35 @@
24388
24458
  y: -0.6,
24389
24459
  z: 0.98,
24390
24460
  });
24461
+ /**
24462
+ * Cache keyed by the `createRandom` factory reference (stable per mounted `<Avatar/>`).
24463
+ *
24464
+ * @private helper of `octopus3d2AvatarVisual`
24465
+ */
24466
+ const octopus3d2StableStateCache = new WeakMap();
24467
+ /**
24468
+ * Returns the stable per-avatar state, computing it on first access and caching for subsequent frames.
24469
+ *
24470
+ * @private helper of `octopus3d2AvatarVisual`
24471
+ */
24472
+ function getOctopus3d2StableState(createRandom) {
24473
+ const cached = octopus3d2StableStateCache.get(createRandom);
24474
+ if (cached !== undefined) {
24475
+ return cached;
24476
+ }
24477
+ const animationRandom = createRandom('octopus3d2-animation-profile');
24478
+ const eyeRandom = createRandom('octopus3d2-eye-profile');
24479
+ const leftEyePhaseOffset = eyeRandom() * 0.7;
24480
+ const rightEyePhaseOffset = eyeRandom() * 0.7;
24481
+ const state = {
24482
+ morphologyProfile: createOctopus3MorphologyProfile(createRandom),
24483
+ animationPhase: animationRandom() * Math.PI * 2,
24484
+ leftEyePhaseOffset,
24485
+ rightEyePhaseOffset,
24486
+ };
24487
+ octopus3d2StableStateCache.set(createRandom, state);
24488
+ return state;
24489
+ }
24391
24490
  /**
24392
24491
  * Octopus 3D 2 avatar visual.
24393
24492
  *
@@ -24400,10 +24499,7 @@
24400
24499
  isAnimated: true,
24401
24500
  supportsPointerTracking: true,
24402
24501
  render({ context, size, palette, createRandom, timeMs, interaction }) {
24403
- const morphologyProfile = createOctopus3MorphologyProfile(createRandom);
24404
- const animationRandom = createRandom('octopus3d2-animation-profile');
24405
- const eyeRandom = createRandom('octopus3d2-eye-profile');
24406
- const animationPhase = animationRandom() * Math.PI * 2;
24502
+ const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset } = getOctopus3d2StableState(createRandom);
24407
24503
  const sceneCenterX = size * 0.5;
24408
24504
  const sceneCenterY = size * 0.575;
24409
24505
  const bob = Math.sin(timeMs / 940 + animationPhase) * size * 0.013;
@@ -24456,8 +24552,8 @@
24456
24552
  const rightEyeLocalCenter = sampleBlobbyOctopusSurfacePoint(surfaceOptions, eyeLatitude, eyeLongitude);
24457
24553
  const eyeRadiusX = size * morphologyProfile.face.eyeRadiusXRatio * 0.78;
24458
24554
  const eyeRadiusY = eyeRadiusX * morphologyProfile.face.eyeHeightRatio * 0.92;
24459
- drawProjectedOrganicEye(context, leftEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + eyeRandom() * 0.7, interaction, morphologyProfile.face.eyeStyle);
24460
- drawProjectedOrganicEye(context, rightEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.9 + eyeRandom() * 0.7, interaction, morphologyProfile.face.eyeStyle);
24555
+ drawProjectedOrganicEye(context, leftEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + leftEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
24556
+ drawProjectedOrganicEye(context, rightEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.9 + rightEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
24461
24557
  drawProjectedOrganicMouth(context, [
24462
24558
  sampleBlobbyOctopusSurfacePoint(surfaceOptions, mouthLatitude, mouthCenterLongitude - mouthHalfLongitude),
24463
24559
  sampleBlobbyOctopusSurfacePoint(surfaceOptions, mouthCurveLatitude, mouthCenterLongitude),
@@ -24486,14 +24582,28 @@
24486
24582
  /**
24487
24583
  * Draws the soft floor shadow that anchors the single mesh in the frame.
24488
24584
  *
24585
+ * Uses a scaled radial gradient instead of `context.filter = 'blur()'` to approximate the
24586
+ * blurry ellipse without triggering a costly software rasterization pass on every frame.
24587
+ *
24489
24588
  * @private helper of `octopus3d2AvatarVisual`
24490
24589
  */
24491
24590
  function drawBlobbyOctopusShadow(context, size, palette, interaction, timeMs, morphologyProfile) {
24591
+ const cx = size * 0.5 + interaction.gazeX * size * 0.045;
24592
+ const cy = size * 0.88 + Math.sin(timeMs / 940) * size * 0.008;
24593
+ const rx = size * (0.18 + (morphologyProfile.body.horizontalStretch - 1) * 0.04 + interaction.intensity * 0.018);
24594
+ const ry = size * 0.062;
24492
24595
  context.save();
24493
- context.fillStyle = `${palette.shadow}66`;
24494
- context.filter = `blur(${size * 0.024}px)`;
24596
+ context.translate(cx, cy);
24597
+ context.scale(1, ry / rx);
24598
+ const blurRadius = rx * 1.4;
24599
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
24600
+ shadowGradient.addColorStop(0, `${palette.shadow}7a`);
24601
+ shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
24602
+ shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
24603
+ shadowGradient.addColorStop(1, `${palette.shadow}00`);
24604
+ context.fillStyle = shadowGradient;
24495
24605
  context.beginPath();
24496
- context.ellipse(size * 0.5 + interaction.gazeX * size * 0.045, size * 0.88 + Math.sin(timeMs / 940) * size * 0.008, size * (0.18 + (morphologyProfile.body.horizontalStretch - 1) * 0.04 + interaction.intensity * 0.018), size * 0.062, 0, 0, Math.PI * 2);
24606
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
24497
24607
  context.fill();
24498
24608
  context.restore();
24499
24609
  }
@@ -24649,6 +24759,40 @@
24649
24759
  * @private helper of `octopus3d3AvatarVisual`
24650
24760
  */
24651
24761
  const OCTOPUS_TENTACLE_COUNT = 8;
24762
+ /**
24763
+ * Cache keyed by the `createRandom` factory reference, which is stable for the lifetime of one
24764
+ * mounted `<Avatar/>` component (created inside `resolveAvatarRenderDefinition` and held in a
24765
+ * React `useMemo`). Using a `WeakMap` ensures the entry is collected when the component unmounts.
24766
+ *
24767
+ * @private helper of `octopus3d3AvatarVisual`
24768
+ */
24769
+ const stableStateCache = new WeakMap();
24770
+ /**
24771
+ * Returns the stable per-avatar state, computing it on first access and returning the cached
24772
+ * result on every subsequent call within the same `<Avatar/>` mount.
24773
+ *
24774
+ * @private helper of `octopus3d3AvatarVisual`
24775
+ */
24776
+ function getOctopus3d3StableState(createRandom) {
24777
+ const cached = stableStateCache.get(createRandom);
24778
+ if (cached !== undefined) {
24779
+ return cached;
24780
+ }
24781
+ const morphologyProfile = createOctopus3MorphologyProfile(createRandom);
24782
+ const animationRandom = createRandom('octopus3d3-animation-profile');
24783
+ const eyeRandom = createRandom('octopus3d3-eye-profile');
24784
+ const leftEyePhaseOffset = eyeRandom() * 0.7;
24785
+ const rightEyePhaseOffset = eyeRandom() * 0.7;
24786
+ const state = {
24787
+ morphologyProfile,
24788
+ animationPhase: animationRandom() * Math.PI * 2,
24789
+ leftEyePhaseOffset,
24790
+ rightEyePhaseOffset,
24791
+ tentacleProfiles: createContinuousTentacleProfiles(createRandom, morphologyProfile),
24792
+ };
24793
+ stableStateCache.set(createRandom, state);
24794
+ return state;
24795
+ }
24652
24796
  /**
24653
24797
  * Octopus 3D 3 avatar visual.
24654
24798
  *
@@ -24661,11 +24805,7 @@
24661
24805
  isAnimated: true,
24662
24806
  supportsPointerTracking: true,
24663
24807
  render({ context, size, palette, createRandom, timeMs, interaction }) {
24664
- const morphologyProfile = createOctopus3MorphologyProfile(createRandom);
24665
- const animationRandom = createRandom('octopus3d3-animation-profile');
24666
- const eyeRandom = createRandom('octopus3d3-eye-profile');
24667
- const animationPhase = animationRandom() * Math.PI * 2;
24668
- const tentacleProfiles = createContinuousTentacleProfiles(createRandom, morphologyProfile);
24808
+ const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset, tentacleProfiles } = getOctopus3d3StableState(createRandom);
24669
24809
  const sceneCenterX = size * 0.5;
24670
24810
  const sceneCenterY = size * 0.535;
24671
24811
  const bob = Math.sin(timeMs / 960 + animationPhase) * size * 0.012;
@@ -24742,8 +24882,8 @@
24742
24882
  size,
24743
24883
  palette,
24744
24884
  });
24745
- drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, -eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + eyeRandom() * 0.7, interaction, morphologyProfile.face.eyeStyle);
24746
- drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.85 + eyeRandom() * 0.7, interaction, morphologyProfile.face.eyeStyle);
24885
+ drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, -eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + leftEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
24886
+ drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.85 + rightEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
24747
24887
  drawProjectedOrganicMouth(context, [
24748
24888
  sampleContinuousOctopusSurfacePoint(surfaceOptions, mouthLatitude, mouthCenterLongitude - mouthHalfLongitude),
24749
24889
  sampleContinuousOctopusSurfacePoint(surfaceOptions, mouthCurveLatitude, mouthCenterLongitude),
@@ -24794,14 +24934,30 @@
24794
24934
  /**
24795
24935
  * Draws the soft lower shadow that anchors the octopus in the avatar frame.
24796
24936
  *
24937
+ * Uses a scaled radial gradient instead of `context.filter = 'blur()'` to approximate the
24938
+ * blurry ellipse without triggering a costly software rasterization pass on every frame.
24939
+ *
24797
24940
  * @private helper of `octopus3d3AvatarVisual`
24798
24941
  */
24799
24942
  function drawContinuousOctopusShadow(context, size, palette, interaction, timeMs, morphologyProfile) {
24943
+ const cx = size * 0.5 + interaction.gazeX * size * 0.045;
24944
+ const cy = size * 0.9 + Math.sin(timeMs / 980) * size * 0.007;
24945
+ const rx = size * (0.19 + morphologyProfile.tentacles.rootSpreadScale * 0.022 + interaction.intensity * 0.02);
24946
+ const ry = size * 0.06;
24947
+ // Scale the context so that drawing a circle produces the correct ellipse aspect ratio,
24948
+ // then fill with a radial gradient that approximates the blurry edge without context.filter.
24800
24949
  context.save();
24801
- context.fillStyle = `${palette.shadow}66`;
24802
- context.filter = `blur(${size * 0.025}px)`;
24950
+ context.translate(cx, cy);
24951
+ context.scale(1, ry / rx);
24952
+ const blurRadius = rx * 1.4;
24953
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
24954
+ shadowGradient.addColorStop(0, `${palette.shadow}7a`);
24955
+ shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
24956
+ shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
24957
+ shadowGradient.addColorStop(1, `${palette.shadow}00`);
24958
+ context.fillStyle = shadowGradient;
24803
24959
  context.beginPath();
24804
- context.ellipse(size * 0.5 + interaction.gazeX * size * 0.045, size * 0.9 + Math.sin(timeMs / 980) * size * 0.007, size * (0.19 + morphologyProfile.tentacles.rootSpreadScale * 0.022 + interaction.intensity * 0.02), size * 0.06, 0, 0, Math.PI * 2);
24960
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
24805
24961
  context.fill();
24806
24962
  context.restore();
24807
24963
  }
@@ -49810,7 +49966,7 @@
49810
49966
  * Computes one stable hash from a JSON-serializable value.
49811
49967
  */
49812
49968
  function computeJsonHash$1(value) {
49813
- return cryptoJs.SHA256(JSON.stringify(value)).toString();
49969
+ return CryptoJS__default["default"].SHA256(JSON.stringify(value)).toString();
49814
49970
  }
49815
49971
  /**
49816
49972
  * Handles OpenAI AgentKit-backed executions for `AgentLlmExecutionTools`.
@@ -49968,7 +50124,7 @@
49968
50124
  * Computes one stable hash from a JSON-serializable value.
49969
50125
  */
49970
50126
  function computeJsonHash(value) {
49971
- return cryptoJs.SHA256(JSON.stringify(value)).toString();
50127
+ return CryptoJS__default["default"].SHA256(JSON.stringify(value)).toString();
49972
50128
  }
49973
50129
  /**
49974
50130
  * Removes assistant-managed requirements before the prompt is executed via OpenAI Assistants.
@@ -50770,7 +50926,7 @@
50770
50926
  * Returns a virtual model name representing the agent behavior.
50771
50927
  */
50772
50928
  get modelName() {
50773
- const hash = cryptoJs.SHA256(hexEncoder__default["default"].parse(this.options.agentSource)).toString( /* hex */);
50929
+ const hash = CryptoJS__default["default"].SHA256(hexEncoder__default["default"].parse(this.options.agentSource)).toString( /* hex */);
50774
50930
  const agentId = hash.substring(0, 10);
50775
50931
  return (normalizeToKebabCase(this.title) + '-' + agentId);
50776
50932
  }