@promptbook/remote-server 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('path'), require('child_process'), require('colors'), require('spacetrim'), require('waitasecond'), require('http'), require('express'), require('socket.io'), require('fs/promises'), require('@mozilla/readability'), require('jsdom'), require('crypto-js'), require('crypto-js/enc-hex'), require('showdown'), require('express-openapi-validator'), require('swagger-ui-express'), require('react'), require('react-dom/server'), require('rxjs'), require('crypto'), require('moment'), require('mime-types'), require('crypto-js/sha256'), require('papaparse'), require('@openai/agents'), require('bottleneck'), require('openai')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'path', 'child_process', 'colors', 'spacetrim', 'waitasecond', 'http', 'express', 'socket.io', 'fs/promises', '@mozilla/readability', 'jsdom', 'crypto-js', 'crypto-js/enc-hex', 'showdown', 'express-openapi-validator', 'swagger-ui-express', 'react', 'react-dom/server', 'rxjs', 'crypto', 'moment', 'mime-types', 'crypto-js/sha256', 'papaparse', '@openai/agents', 'bottleneck', 'openai'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-server"] = {}, global.path, global.child_process, global.colors, global._spaceTrim, global.waitasecond, global.http, global.express, global.socket_io, global.promises, global.readability, global.jsdom, global.cryptoJs, global.hexEncoder, global.showdown, global.OpenApiValidator, global.swaggerUi, global.react, global.server, global.rxjs, global.crypto, global.moment, global.mimeTypes, global.sha256, global.papaparse, global.agents, global.Bottleneck, global.OpenAI));
5
- })(this, (function (exports, path, child_process, colors, _spaceTrim, waitasecond, http, express, socket_io, promises, readability, jsdom, cryptoJs, hexEncoder, showdown, OpenApiValidator, swaggerUi, react, server, rxjs, crypto, moment, mimeTypes, sha256, papaparse, agents, Bottleneck, OpenAI) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('path'), require('child_process'), require('colors'), require('spacetrim'), require('waitasecond'), require('http'), require('express'), require('socket.io'), require('fs/promises'), require('@mozilla/readability'), require('jsdom'), require('crypto-js'), require('crypto-js/enc-hex'), require('showdown'), require('express-openapi-validator'), require('swagger-ui-express'), require('react'), require('react-dom/server'), require('rxjs'), require('moment'), require('mime-types'), require('crypto-js/sha256'), require('papaparse'), require('@openai/agents'), require('bottleneck'), require('openai')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'path', 'child_process', 'colors', 'spacetrim', 'waitasecond', 'http', 'express', 'socket.io', 'fs/promises', '@mozilla/readability', 'jsdom', 'crypto-js', 'crypto-js/enc-hex', 'showdown', 'express-openapi-validator', 'swagger-ui-express', 'react', 'react-dom/server', 'rxjs', 'moment', 'mime-types', 'crypto-js/sha256', 'papaparse', '@openai/agents', 'bottleneck', 'openai'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-server"] = {}, global.path, global.child_process, global.colors, global._spaceTrim, global.waitasecond, global.http, global.express, global.socket_io, global.promises, global.readability, global.jsdom, global.CryptoJS, global.hexEncoder, global.showdown, global.OpenApiValidator, global.swaggerUi, global.react, global.server, global.rxjs, global.moment, global.mimeTypes, global.sha256, global.papaparse, global.agents, global.Bottleneck, global.OpenAI));
5
+ })(this, (function (exports, path, child_process, colors, _spaceTrim, waitasecond, http, express, socket_io, promises, readability, jsdom, CryptoJS, hexEncoder, showdown, OpenApiValidator, swaggerUi, react, server, rxjs, moment, mimeTypes, sha256, papaparse, agents, Bottleneck, 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 _spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(_spaceTrim);
29
29
  var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
30
30
  var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
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 OpenApiValidator__namespace = /*#__PURE__*/_interopNamespace(OpenApiValidator);
33
35
  var swaggerUi__default = /*#__PURE__*/_interopDefaultLegacy(swaggerUi);
34
36
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
35
37
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
38
+ var papaparse__default = /*#__PURE__*/_interopDefaultLegacy(papaparse);
36
39
  var Bottleneck__default = /*#__PURE__*/_interopDefaultLegacy(Bottleneck);
37
40
  var OpenAI__default = /*#__PURE__*/_interopDefaultLegacy(OpenAI);
38
41
 
@@ -50,7 +53,7 @@
50
53
  * @generated
51
54
  * @see https://github.com/webgptorg/promptbook
52
55
  */
53
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-115';
56
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-118';
54
57
  /**
55
58
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
56
59
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1958,7 +1961,7 @@
1958
1961
  * @private internal helper function
1959
1962
  */
1960
1963
  function $randomToken(randomness) {
1961
- return crypto.randomBytes(randomness).toString('hex');
1964
+ return CryptoJS__default["default"].lib.WordArray.random(randomness).toString(CryptoJS__default["default"].enc.Hex);
1962
1965
  }
1963
1966
  // TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
1964
1967
  // TODO: Maybe use nanoid instead https://github.com/ai/nanoid
@@ -5502,7 +5505,7 @@
5502
5505
  * @public exported from `@promptbook/editable`
5503
5506
  */
5504
5507
  function knowledgeSourceContentToName(knowledgeSourceContent) {
5505
- const hash = cryptoJs.SHA256(hexEncoder__default["default"].parse(JSON.stringify(knowledgeSourceContent)))
5508
+ const hash = CryptoJS__default["default"].SHA256(hexEncoder__default["default"].parse(JSON.stringify(knowledgeSourceContent)))
5506
5509
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
5507
5510
  .toString( /* hex */)
5508
5511
  .substring(0, 20);
@@ -6496,7 +6499,7 @@
6496
6499
  console.warn('CSV string contains carriage return characters, but in the CSV settings the `newline` setting does not include them. Autohealing the CSV string.');
6497
6500
  value = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
6498
6501
  }
6499
- const csv = papaparse.parse(value, settings);
6502
+ const csv = papaparse__default["default"].parse(value, settings);
6500
6503
  return csv;
6501
6504
  }
6502
6505
 
@@ -6581,10 +6584,10 @@
6581
6584
  i > index ? { ...row, [outputParameterName]: PENDING_VALUE_PLACEHOLDER } : row,
6582
6585
  );
6583
6586
  */
6584
- await onProgress(papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
6587
+ await onProgress(papaparse__default["default"].unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS }));
6585
6588
  }
6586
6589
  }
6587
- return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6590
+ return papaparse__default["default"].unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6588
6591
  },
6589
6592
  },
6590
6593
  {
@@ -6612,7 +6615,7 @@
6612
6615
  return /* not await */ mapCallback({ [key]: value }, index, array.length);
6613
6616
  }));
6614
6617
  }));
6615
- return papaparse.unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6618
+ return papaparse__default["default"].unparse(mappedData, { ...settings, ...MANDATORY_CSV_SETTINGS });
6616
6619
  },
6617
6620
  },
6618
6621
  ],
@@ -9541,7 +9544,7 @@
9541
9544
  const { filename: sourceFilename, url } = source;
9542
9545
  const { rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose } = options;
9543
9546
  // TODO: [👬] DRY
9544
- const hash = cryptoJs.SHA256(
9547
+ const hash = CryptoJS__default["default"].SHA256(
9545
9548
  // <- TODO: [🥬] Encapsulate sha256 to some private utility function
9546
9549
  hexEncoder__default["default"].parse(sourceFilename || url || 'untitled'))
9547
9550
  .toString( /* hex */)
@@ -9632,7 +9635,7 @@
9632
9635
  * @private utility of `WebsiteScraper`
9633
9636
  */
9634
9637
  function createShowdownConverter() {
9635
- return new showdown.Converter({
9638
+ return new showdown__default["default"].Converter({
9636
9639
  flavor: 'github',
9637
9640
  /*
9638
9641
  > import showdownHighlight from 'showdown-highlight';
@@ -10824,7 +10827,7 @@
10824
10827
  * @public exported from `@promptbook/utils`
10825
10828
  */
10826
10829
  function computeHash(value) {
10827
- return cryptoJs.SHA256(hexEncoder__default["default"].parse(_spaceTrim.spaceTrim(valueToString(value)))).toString( /* hex */);
10830
+ return CryptoJS__default["default"].SHA256(hexEncoder__default["default"].parse(_spaceTrim.spaceTrim(valueToString(value)))).toString( /* hex */);
10828
10831
  }
10829
10832
  // TODO: [🥬][🥬] Use this ACRY
10830
10833
 
@@ -14250,21 +14253,22 @@
14250
14253
  * @private helper of `fractalAvatarVisual`
14251
14254
  */
14252
14255
  function drawDragonCurveLayer(context, points, options) {
14253
- const { size, primaryColor, secondaryColor, tertiaryColor, shadowColor, strokeWidth, timeMs, layerIndex } = options;
14256
+ const { primaryColor, secondaryColor, tertiaryColor, shadowColor, strokeWidth, timeMs, layerIndex } = options;
14254
14257
  const firstPoint = points[0];
14255
14258
  const lastPoint = points[points.length - 1];
14256
14259
  const ribbonGradient = context.createLinearGradient(firstPoint.x, firstPoint.y, lastPoint.x, lastPoint.y);
14257
14260
  ribbonGradient.addColorStop(0, `${primaryColor}f2`);
14258
14261
  ribbonGradient.addColorStop(0.5, `${secondaryColor}e6`);
14259
14262
  ribbonGradient.addColorStop(1, `${tertiaryColor}f2`);
14263
+ // Approximate the blurred shadow stroke with a wider semi-transparent stroke instead of
14264
+ // context.filter blur, which triggers a costly software rasterization pass every frame.
14260
14265
  context.save();
14261
14266
  context.beginPath();
14262
14267
  tracePolyline(context, points);
14263
- context.strokeStyle = `${shadowColor}82`;
14264
- context.lineWidth = strokeWidth * 1.8;
14268
+ context.strokeStyle = `${shadowColor}48`;
14269
+ context.lineWidth = strokeWidth * 4.5;
14265
14270
  context.lineJoin = 'round';
14266
14271
  context.lineCap = 'round';
14267
- context.filter = `blur(${size * 0.022}px)`;
14268
14272
  context.stroke();
14269
14273
  context.restore();
14270
14274
  context.beginPath();
@@ -14848,11 +14852,23 @@
14848
14852
  * @private helper of `minecraft2AvatarVisual`
14849
14853
  */
14850
14854
  function drawMinecraftShadow(context, size, palette, interaction, timeMs) {
14855
+ const cx = size * 0.5 + interaction.gazeX * size * 0.03;
14856
+ const cy = size * 0.85 + Math.sin(timeMs / 880) * size * 0.01;
14857
+ const rx = size * (0.16 + interaction.intensity * 0.015);
14858
+ const ry = size * 0.055;
14859
+ // Radial gradient approximates the blurry ellipse shadow without context.filter blur.
14851
14860
  context.save();
14852
- context.fillStyle = `${palette.shadow}66`;
14853
- context.filter = `blur(${size * 0.02}px)`;
14861
+ context.translate(cx, cy);
14862
+ context.scale(1, ry / rx);
14863
+ const blurRadius = rx * 1.4;
14864
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
14865
+ shadowGradient.addColorStop(0, `${palette.shadow}7a`);
14866
+ shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
14867
+ shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
14868
+ shadowGradient.addColorStop(1, `${palette.shadow}00`);
14869
+ context.fillStyle = shadowGradient;
14854
14870
  context.beginPath();
14855
- 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);
14871
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
14856
14872
  context.fill();
14857
14873
  context.restore();
14858
14874
  }
@@ -15076,13 +15092,27 @@
15076
15092
  spotlight.addColorStop(1, `${palette.highlight}00`);
15077
15093
  context.fillStyle = spotlight;
15078
15094
  context.fillRect(0, 0, size, size);
15079
- context.save();
15080
- context.fillStyle = 'rgba(0, 0, 0, 0.22)';
15081
- context.filter = `blur(${size * 0.018}px)`;
15082
- context.beginPath();
15083
- context.ellipse(size * 0.5, size * 0.86, size * 0.2, size * 0.06, 0, 0, Math.PI * 2);
15084
- context.fill();
15085
- context.restore();
15095
+ {
15096
+ // Radial gradient approximates the blurry ellipse shadow without context.filter blur.
15097
+ const cx = size * 0.5;
15098
+ const cy = size * 0.86;
15099
+ const rx = size * 0.2;
15100
+ const ry = size * 0.06;
15101
+ const blurRadius = rx * 1.4;
15102
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
15103
+ shadowGradient.addColorStop(0, 'rgba(0,0,0,0.28)');
15104
+ shadowGradient.addColorStop(0.45, 'rgba(0,0,0,0.14)');
15105
+ shadowGradient.addColorStop(0.8, 'rgba(0,0,0,0.05)');
15106
+ shadowGradient.addColorStop(1, 'rgba(0,0,0,0)');
15107
+ context.save();
15108
+ context.translate(cx, cy);
15109
+ context.scale(1, ry / rx);
15110
+ context.fillStyle = shadowGradient;
15111
+ context.beginPath();
15112
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
15113
+ context.fill();
15114
+ context.restore();
15115
+ }
15086
15116
  drawVoxelCuboid(context, {
15087
15117
  x: bodyX,
15088
15118
  y: bodyY,
@@ -16134,6 +16164,35 @@
16134
16164
  y: -0.62,
16135
16165
  z: 0.94,
16136
16166
  });
16167
+ /**
16168
+ * Cache keyed by the `createRandom` factory reference (stable per mounted `<Avatar/>`).
16169
+ *
16170
+ * @private helper of `octopus3dAvatarVisual`
16171
+ */
16172
+ const octopus3dStableStateCache = new WeakMap();
16173
+ /**
16174
+ * Returns the stable per-avatar state, computing it on first access and caching for subsequent frames.
16175
+ *
16176
+ * @private helper of `octopus3dAvatarVisual`
16177
+ */
16178
+ function getOctopus3dStableState(createRandom) {
16179
+ const cached = octopus3dStableStateCache.get(createRandom);
16180
+ if (cached !== undefined) {
16181
+ return cached;
16182
+ }
16183
+ const animationRandom = createRandom('octopus3d-animation-profile');
16184
+ const eyeRandom = createRandom('octopus3d-eye-profile');
16185
+ const leftEyePhaseOffset = eyeRandom() * 0.6;
16186
+ const rightEyePhaseOffset = eyeRandom() * 0.6;
16187
+ const state = {
16188
+ morphologyProfile: createOctopus3MorphologyProfile(createRandom),
16189
+ animationPhase: animationRandom() * Math.PI * 2,
16190
+ leftEyePhaseOffset,
16191
+ rightEyePhaseOffset,
16192
+ };
16193
+ octopus3dStableStateCache.set(createRandom, state);
16194
+ return state;
16195
+ }
16137
16196
  /**
16138
16197
  * Proper 3D Octopus visual built from projected organic meshes and tentacles.
16139
16198
  *
@@ -16146,10 +16205,7 @@
16146
16205
  isAnimated: true,
16147
16206
  supportsPointerTracking: true,
16148
16207
  render({ context, size, palette, createRandom, timeMs, interaction }) {
16149
- const morphologyProfile = createOctopus3MorphologyProfile(createRandom);
16150
- const animationRandom = createRandom('octopus3d-animation-profile');
16151
- const eyeRandom = createRandom('octopus3d-eye-profile');
16152
- const animationPhase = animationRandom() * Math.PI * 2;
16208
+ const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset } = getOctopus3dStableState(createRandom);
16153
16209
  const sceneCenterX = size * 0.5;
16154
16210
  const sceneCenterY = size * 0.56;
16155
16211
  const bob = Math.sin(timeMs / 920 + animationPhase) * size * 0.014;
@@ -16246,12 +16302,12 @@
16246
16302
  x: -faceEyeSpacing,
16247
16303
  y: faceEyeYOffset,
16248
16304
  z: resolveEllipsoidSurfaceDepth(mantleRadiusX, mantleRadiusY, mantleRadiusZ, -faceEyeSpacing, faceEyeYOffset),
16249
- }, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + eyeRandom() * 0.6, interaction, morphologyProfile.face.eyeStyle);
16305
+ }, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + leftEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
16250
16306
  drawProjectedOrganicEye(context, {
16251
16307
  x: faceEyeSpacing,
16252
16308
  y: faceEyeYOffset,
16253
16309
  z: resolveEllipsoidSurfaceDepth(mantleRadiusX, mantleRadiusY, mantleRadiusZ, faceEyeSpacing, faceEyeYOffset),
16254
- }, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.7 + eyeRandom() * 0.6, interaction, morphologyProfile.face.eyeStyle);
16310
+ }, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.7 + rightEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
16255
16311
  drawProjectedOrganicMouth(context, [
16256
16312
  {
16257
16313
  x: -mouthHalfWidth,
@@ -16295,14 +16351,28 @@
16295
16351
  /**
16296
16352
  * Draws the soft ground shadow below the octopus.
16297
16353
  *
16354
+ * Uses a scaled radial gradient instead of `context.filter = 'blur()'` to approximate the
16355
+ * blurry ellipse without triggering a costly software rasterization pass on every frame.
16356
+ *
16298
16357
  * @private helper of `octopus3dAvatarVisual`
16299
16358
  */
16300
16359
  function drawOctopus3dShadow(context, size, palette, interaction, timeMs) {
16360
+ const cx = size * 0.5 + interaction.gazeX * size * 0.04;
16361
+ const cy = size * 0.87 + Math.sin(timeMs / 920) * size * 0.008;
16362
+ const rx = size * (0.18 + interaction.intensity * 0.02);
16363
+ const ry = size * 0.06;
16301
16364
  context.save();
16302
- context.fillStyle = `${palette.shadow}66`;
16303
- context.filter = `blur(${size * 0.022}px)`;
16365
+ context.translate(cx, cy);
16366
+ context.scale(1, ry / rx);
16367
+ const blurRadius = rx * 1.4;
16368
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
16369
+ shadowGradient.addColorStop(0, `${palette.shadow}7a`);
16370
+ shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
16371
+ shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
16372
+ shadowGradient.addColorStop(1, `${palette.shadow}00`);
16373
+ context.fillStyle = shadowGradient;
16304
16374
  context.beginPath();
16305
- 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);
16375
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
16306
16376
  context.fill();
16307
16377
  context.restore();
16308
16378
  }
@@ -16533,6 +16603,35 @@
16533
16603
  y: -0.6,
16534
16604
  z: 0.98,
16535
16605
  });
16606
+ /**
16607
+ * Cache keyed by the `createRandom` factory reference (stable per mounted `<Avatar/>`).
16608
+ *
16609
+ * @private helper of `octopus3d2AvatarVisual`
16610
+ */
16611
+ const octopus3d2StableStateCache = new WeakMap();
16612
+ /**
16613
+ * Returns the stable per-avatar state, computing it on first access and caching for subsequent frames.
16614
+ *
16615
+ * @private helper of `octopus3d2AvatarVisual`
16616
+ */
16617
+ function getOctopus3d2StableState(createRandom) {
16618
+ const cached = octopus3d2StableStateCache.get(createRandom);
16619
+ if (cached !== undefined) {
16620
+ return cached;
16621
+ }
16622
+ const animationRandom = createRandom('octopus3d2-animation-profile');
16623
+ const eyeRandom = createRandom('octopus3d2-eye-profile');
16624
+ const leftEyePhaseOffset = eyeRandom() * 0.7;
16625
+ const rightEyePhaseOffset = eyeRandom() * 0.7;
16626
+ const state = {
16627
+ morphologyProfile: createOctopus3MorphologyProfile(createRandom),
16628
+ animationPhase: animationRandom() * Math.PI * 2,
16629
+ leftEyePhaseOffset,
16630
+ rightEyePhaseOffset,
16631
+ };
16632
+ octopus3d2StableStateCache.set(createRandom, state);
16633
+ return state;
16634
+ }
16536
16635
  /**
16537
16636
  * Octopus 3D 2 avatar visual.
16538
16637
  *
@@ -16545,10 +16644,7 @@
16545
16644
  isAnimated: true,
16546
16645
  supportsPointerTracking: true,
16547
16646
  render({ context, size, palette, createRandom, timeMs, interaction }) {
16548
- const morphologyProfile = createOctopus3MorphologyProfile(createRandom);
16549
- const animationRandom = createRandom('octopus3d2-animation-profile');
16550
- const eyeRandom = createRandom('octopus3d2-eye-profile');
16551
- const animationPhase = animationRandom() * Math.PI * 2;
16647
+ const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset } = getOctopus3d2StableState(createRandom);
16552
16648
  const sceneCenterX = size * 0.5;
16553
16649
  const sceneCenterY = size * 0.575;
16554
16650
  const bob = Math.sin(timeMs / 940 + animationPhase) * size * 0.013;
@@ -16601,8 +16697,8 @@
16601
16697
  const rightEyeLocalCenter = sampleBlobbyOctopusSurfacePoint(surfaceOptions, eyeLatitude, eyeLongitude);
16602
16698
  const eyeRadiusX = size * morphologyProfile.face.eyeRadiusXRatio * 0.78;
16603
16699
  const eyeRadiusY = eyeRadiusX * morphologyProfile.face.eyeHeightRatio * 0.92;
16604
- drawProjectedOrganicEye(context, leftEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + eyeRandom() * 0.7, interaction, morphologyProfile.face.eyeStyle);
16605
- drawProjectedOrganicEye(context, rightEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.9 + eyeRandom() * 0.7, interaction, morphologyProfile.face.eyeStyle);
16700
+ drawProjectedOrganicEye(context, leftEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + leftEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
16701
+ drawProjectedOrganicEye(context, rightEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.9 + rightEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
16606
16702
  drawProjectedOrganicMouth(context, [
16607
16703
  sampleBlobbyOctopusSurfacePoint(surfaceOptions, mouthLatitude, mouthCenterLongitude - mouthHalfLongitude),
16608
16704
  sampleBlobbyOctopusSurfacePoint(surfaceOptions, mouthCurveLatitude, mouthCenterLongitude),
@@ -16631,14 +16727,28 @@
16631
16727
  /**
16632
16728
  * Draws the soft floor shadow that anchors the single mesh in the frame.
16633
16729
  *
16730
+ * Uses a scaled radial gradient instead of `context.filter = 'blur()'` to approximate the
16731
+ * blurry ellipse without triggering a costly software rasterization pass on every frame.
16732
+ *
16634
16733
  * @private helper of `octopus3d2AvatarVisual`
16635
16734
  */
16636
16735
  function drawBlobbyOctopusShadow(context, size, palette, interaction, timeMs, morphologyProfile) {
16736
+ const cx = size * 0.5 + interaction.gazeX * size * 0.045;
16737
+ const cy = size * 0.88 + Math.sin(timeMs / 940) * size * 0.008;
16738
+ const rx = size * (0.18 + (morphologyProfile.body.horizontalStretch - 1) * 0.04 + interaction.intensity * 0.018);
16739
+ const ry = size * 0.062;
16637
16740
  context.save();
16638
- context.fillStyle = `${palette.shadow}66`;
16639
- context.filter = `blur(${size * 0.024}px)`;
16741
+ context.translate(cx, cy);
16742
+ context.scale(1, ry / rx);
16743
+ const blurRadius = rx * 1.4;
16744
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
16745
+ shadowGradient.addColorStop(0, `${palette.shadow}7a`);
16746
+ shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
16747
+ shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
16748
+ shadowGradient.addColorStop(1, `${palette.shadow}00`);
16749
+ context.fillStyle = shadowGradient;
16640
16750
  context.beginPath();
16641
- 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);
16751
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
16642
16752
  context.fill();
16643
16753
  context.restore();
16644
16754
  }
@@ -16794,6 +16904,40 @@
16794
16904
  * @private helper of `octopus3d3AvatarVisual`
16795
16905
  */
16796
16906
  const OCTOPUS_TENTACLE_COUNT = 8;
16907
+ /**
16908
+ * Cache keyed by the `createRandom` factory reference, which is stable for the lifetime of one
16909
+ * mounted `<Avatar/>` component (created inside `resolveAvatarRenderDefinition` and held in a
16910
+ * React `useMemo`). Using a `WeakMap` ensures the entry is collected when the component unmounts.
16911
+ *
16912
+ * @private helper of `octopus3d3AvatarVisual`
16913
+ */
16914
+ const stableStateCache = new WeakMap();
16915
+ /**
16916
+ * Returns the stable per-avatar state, computing it on first access and returning the cached
16917
+ * result on every subsequent call within the same `<Avatar/>` mount.
16918
+ *
16919
+ * @private helper of `octopus3d3AvatarVisual`
16920
+ */
16921
+ function getOctopus3d3StableState(createRandom) {
16922
+ const cached = stableStateCache.get(createRandom);
16923
+ if (cached !== undefined) {
16924
+ return cached;
16925
+ }
16926
+ const morphologyProfile = createOctopus3MorphologyProfile(createRandom);
16927
+ const animationRandom = createRandom('octopus3d3-animation-profile');
16928
+ const eyeRandom = createRandom('octopus3d3-eye-profile');
16929
+ const leftEyePhaseOffset = eyeRandom() * 0.7;
16930
+ const rightEyePhaseOffset = eyeRandom() * 0.7;
16931
+ const state = {
16932
+ morphologyProfile,
16933
+ animationPhase: animationRandom() * Math.PI * 2,
16934
+ leftEyePhaseOffset,
16935
+ rightEyePhaseOffset,
16936
+ tentacleProfiles: createContinuousTentacleProfiles(createRandom, morphologyProfile),
16937
+ };
16938
+ stableStateCache.set(createRandom, state);
16939
+ return state;
16940
+ }
16797
16941
  /**
16798
16942
  * Octopus 3D 3 avatar visual.
16799
16943
  *
@@ -16806,11 +16950,7 @@
16806
16950
  isAnimated: true,
16807
16951
  supportsPointerTracking: true,
16808
16952
  render({ context, size, palette, createRandom, timeMs, interaction }) {
16809
- const morphologyProfile = createOctopus3MorphologyProfile(createRandom);
16810
- const animationRandom = createRandom('octopus3d3-animation-profile');
16811
- const eyeRandom = createRandom('octopus3d3-eye-profile');
16812
- const animationPhase = animationRandom() * Math.PI * 2;
16813
- const tentacleProfiles = createContinuousTentacleProfiles(createRandom, morphologyProfile);
16953
+ const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset, tentacleProfiles } = getOctopus3d3StableState(createRandom);
16814
16954
  const sceneCenterX = size * 0.5;
16815
16955
  const sceneCenterY = size * 0.535;
16816
16956
  const bob = Math.sin(timeMs / 960 + animationPhase) * size * 0.012;
@@ -16887,8 +17027,8 @@
16887
17027
  size,
16888
17028
  palette,
16889
17029
  });
16890
- drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, -eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + eyeRandom() * 0.7, interaction, morphologyProfile.face.eyeStyle);
16891
- 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);
17030
+ drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, -eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + leftEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
17031
+ drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.85 + rightEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
16892
17032
  drawProjectedOrganicMouth(context, [
16893
17033
  sampleContinuousOctopusSurfacePoint(surfaceOptions, mouthLatitude, mouthCenterLongitude - mouthHalfLongitude),
16894
17034
  sampleContinuousOctopusSurfacePoint(surfaceOptions, mouthCurveLatitude, mouthCenterLongitude),
@@ -16939,14 +17079,30 @@
16939
17079
  /**
16940
17080
  * Draws the soft lower shadow that anchors the octopus in the avatar frame.
16941
17081
  *
17082
+ * Uses a scaled radial gradient instead of `context.filter = 'blur()'` to approximate the
17083
+ * blurry ellipse without triggering a costly software rasterization pass on every frame.
17084
+ *
16942
17085
  * @private helper of `octopus3d3AvatarVisual`
16943
17086
  */
16944
17087
  function drawContinuousOctopusShadow(context, size, palette, interaction, timeMs, morphologyProfile) {
17088
+ const cx = size * 0.5 + interaction.gazeX * size * 0.045;
17089
+ const cy = size * 0.9 + Math.sin(timeMs / 980) * size * 0.007;
17090
+ const rx = size * (0.19 + morphologyProfile.tentacles.rootSpreadScale * 0.022 + interaction.intensity * 0.02);
17091
+ const ry = size * 0.06;
17092
+ // Scale the context so that drawing a circle produces the correct ellipse aspect ratio,
17093
+ // then fill with a radial gradient that approximates the blurry edge without context.filter.
16945
17094
  context.save();
16946
- context.fillStyle = `${palette.shadow}66`;
16947
- context.filter = `blur(${size * 0.025}px)`;
17095
+ context.translate(cx, cy);
17096
+ context.scale(1, ry / rx);
17097
+ const blurRadius = rx * 1.4;
17098
+ const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
17099
+ shadowGradient.addColorStop(0, `${palette.shadow}7a`);
17100
+ shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
17101
+ shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
17102
+ shadowGradient.addColorStop(1, `${palette.shadow}00`);
17103
+ context.fillStyle = shadowGradient;
16948
17104
  context.beginPath();
16949
- 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);
17105
+ context.arc(0, 0, blurRadius, 0, Math.PI * 2);
16950
17106
  context.fill();
16951
17107
  context.restore();
16952
17108
  }
@@ -39679,7 +39835,7 @@
39679
39835
  * Computes one stable hash from a JSON-serializable value.
39680
39836
  */
39681
39837
  function computeJsonHash$1(value) {
39682
- return cryptoJs.SHA256(JSON.stringify(value)).toString();
39838
+ return CryptoJS__default["default"].SHA256(JSON.stringify(value)).toString();
39683
39839
  }
39684
39840
  /**
39685
39841
  * Handles OpenAI AgentKit-backed executions for `AgentLlmExecutionTools`.
@@ -39837,7 +39993,7 @@
39837
39993
  * Computes one stable hash from a JSON-serializable value.
39838
39994
  */
39839
39995
  function computeJsonHash(value) {
39840
- return cryptoJs.SHA256(JSON.stringify(value)).toString();
39996
+ return CryptoJS__default["default"].SHA256(JSON.stringify(value)).toString();
39841
39997
  }
39842
39998
  /**
39843
39999
  * Removes assistant-managed requirements before the prompt is executed via OpenAI Assistants.
@@ -40639,7 +40795,7 @@
40639
40795
  * Returns a virtual model name representing the agent behavior.
40640
40796
  */
40641
40797
  get modelName() {
40642
- const hash = cryptoJs.SHA256(hexEncoder__default["default"].parse(this.options.agentSource)).toString( /* hex */);
40798
+ const hash = CryptoJS__default["default"].SHA256(hexEncoder__default["default"].parse(this.options.agentSource)).toString( /* hex */);
40643
40799
  const agentId = hash.substring(0, 10);
40644
40800
  return (normalizeToKebabCase(this.title) + '-' + agentId);
40645
40801
  }