@promptbook/remote-server 0.112.0-126 → 0.112.0-128

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 (46) hide show
  1. package/README.md +5 -5
  2. package/esm/index.es.js +221 -51
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/src/_packages/components.index.d.ts +2 -0
  5. package/esm/src/_packages/types.index.d.ts +2 -0
  6. package/esm/src/avatars/avatarAnimationScheduler.d.ts +4 -0
  7. package/esm/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
  8. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  9. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
  10. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  11. package/esm/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
  12. package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
  13. package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
  14. package/esm/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
  15. package/esm/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
  16. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
  17. package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  18. package/esm/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
  19. package/esm/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
  20. package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
  21. package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
  22. package/esm/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
  23. package/esm/src/version.d.ts +1 -1
  24. package/package.json +2 -2
  25. package/umd/index.umd.js +221 -51
  26. package/umd/index.umd.js.map +1 -1
  27. package/umd/src/_packages/components.index.d.ts +2 -0
  28. package/umd/src/_packages/types.index.d.ts +2 -0
  29. package/umd/src/avatars/avatarAnimationScheduler.d.ts +4 -0
  30. package/umd/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
  31. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
  32. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
  33. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  34. package/umd/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
  35. package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
  36. package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
  37. package/umd/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
  38. package/umd/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
  39. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
  40. package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  41. package/umd/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
  42. package/umd/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
  43. package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
  44. package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
  45. package/umd/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
  46. package/umd/src/version.d.ts +1 -1
package/README.md CHANGED
@@ -467,7 +467,7 @@ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treate
467
467
  - **Multi-runner execution:** `openai-codex`, `github-copilot`, `cline`, `claude-code`, `opencode`, `gemini`
468
468
  - **Context injection:** `--agent agents/coding/developer.book --context AGENTS.md` or inline extra instructions
469
469
  - **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
470
- - **Interactive or unattended runs:** default wait mode, or `--no-wait` for batch execution
470
+ - **Unattended or interactive runs:** default auto mode, or `--no-auto` to wait for user confirmation before each prompt
471
471
  - **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
472
472
  - **Opt-in remote pushes:** commits stay local unless you explicitly pass `--auto-push`
473
473
  - **Prompt triage:** `--priority` to process only more important tasks first
@@ -489,7 +489,7 @@ npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gp
489
489
 
490
490
  npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --auto-push
491
491
 
492
- npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --ignore-git-changes --no-wait
492
+ npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --ignore-git-changes
493
493
 
494
494
  npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
495
495
 
@@ -515,7 +515,7 @@ ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh -
515
515
 
516
516
  ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --auto-push
517
517
 
518
- ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --test npm run test --ignore-git-changes --no-wait
518
+ ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --test npm run test --ignore-git-changes
519
519
 
520
520
  ptbk coder find-refactor-candidates
521
521
 
@@ -545,7 +545,7 @@ ptbk coder verify
545
545
  | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
546
546
  | `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
547
547
  | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
548
- | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
548
+ | `--no-auto` | Waits for user confirmation before each prompt instead of running automatically through the queue. |
549
549
  | `--ignore-git-changes` | Disables the clean-working-tree guard. |
550
550
  | `--priority <n>` | Runs only prompts at or above the given priority. |
551
551
  | `--dry-run` | Prints which prompts are ready instead of executing them. |
@@ -558,7 +558,7 @@ ptbk coder verify
558
558
  1. Initialize once with `ptbk coder init`.
559
559
  2. Customize `prompts/templates/*.md` if needed, then create or write prompt files in `prompts/`.
560
560
  3. Customize the starter `AGENTS.md` with repository-specific instructions, then pass `--agent agents/coding/developer.book --context AGENTS.md`.
561
- 4. Run one prompt at a time interactively, or use `--no-wait` for unattended batches.
561
+ 4. Run unattended batches by default, or pass `--no-auto` to confirm each prompt interactively.
562
562
  5. Finish with `ptbk coder verify` so resolved prompts are archived and broken ones get explicit repair follow-ups.
563
563
 
564
564
 
package/esm/index.es.js CHANGED
@@ -39,7 +39,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
39
39
  * @generated
40
40
  * @see https://github.com/webgptorg/promptbook
41
41
  */
42
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-126';
42
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-128';
43
43
  /**
44
44
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
45
45
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -9258,7 +9258,8 @@ function colorizeAvailableProviderMessage(providerMessage, { isInstalled, isFull
9258
9258
  * @private internal function of `$registeredLlmToolsMessage`
9259
9259
  */
9260
9260
  function createUsedEnvMessage() {
9261
- return `Unknown \`.env\` file` ;
9261
+ return `Unknown \`.env\` file`
9262
+ ;
9262
9263
  }
9263
9264
  // TODO: [®] DRY Register logic
9264
9265
  // TODO: [🧠][⚛] Maybe pass env as argument
@@ -11249,8 +11250,11 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
11249
11250
  if (!trimmedContent) {
11250
11251
  return requirements;
11251
11252
  }
11252
- // Add goal as a proper h2 section to the system message
11253
- const goalSection = `## Goal\n\n${trimmedContent}`;
11253
+ const goalSection = spaceTrim$1((block) => `
11254
+ ## Goal
11255
+
11256
+ ${block(trimmedContent)}
11257
+ `);
11254
11258
  const requirementsWithGoal = this.appendToSystemMessage(requirements, goalSection, '\n\n');
11255
11259
  return this.appendToPromptSuffix(requirementsWithGoal, trimmedContent);
11256
11260
  }
@@ -11772,8 +11776,11 @@ class LanguageCommitmentDefinition extends BaseCommitmentDefinition {
11772
11776
  if (!trimmedContent) {
11773
11777
  return requirements;
11774
11778
  }
11775
- // Add language as a bullet under a ## Language section
11776
- const languageSection = `## Language\n\n- Your language is ${trimmedContent}`;
11779
+ const languageSection = spaceTrim$1((block) => `
11780
+ ## Language
11781
+
11782
+ - Your language is ${block(trimmedContent)}
11783
+ `);
11777
11784
  return this.appendToSystemMessage(requirements, languageSection, '\n\n');
11778
11785
  }
11779
11786
  }
@@ -16738,41 +16745,91 @@ function drawBlobbyOctopusShadow(context, size, palette, interaction, timeMs, mo
16738
16745
  context.fill();
16739
16746
  context.restore();
16740
16747
  }
16748
+ /**
16749
+ * Number of latitude segments used by the single blobby octopus mesh.
16750
+ *
16751
+ * @private helper of `octopus3d2AvatarVisual`
16752
+ */
16753
+ const LATITUDE_PATCH_COUNT$1 = 12;
16754
+ /**
16755
+ * Number of longitude segments used by the single blobby octopus mesh.
16756
+ *
16757
+ * @private helper of `octopus3d2AvatarVisual`
16758
+ */
16759
+ const LONGITUDE_PATCH_COUNT$1 = 24;
16741
16760
  /**
16742
16761
  * Resolves all visible projected patches for the single blobby octopus mesh.
16743
16762
  *
16763
+ * Within a single frame, mesh corner samples and longitude-only lobe-wave values are
16764
+ * quantized to the patch grid and computed once each rather than re-evaluated for every
16765
+ * patch corner — the patch loop alone would call `sampleBlobbyOctopusSurfacePoint`
16766
+ * `latitudePatchCount * longitudePatchCount * 4` times without caching, even though most
16767
+ * corners are shared between neighboring patches.
16768
+ *
16744
16769
  * @private helper of `octopus3d2AvatarVisual`
16745
16770
  */
16746
16771
  function resolveVisibleBlobbyOctopusPatches(options) {
16747
16772
  const { center, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, morphologyProfile, animationPhase, timeMs, } = options;
16748
- const latitudePatchCount = 12;
16749
- const longitudePatchCount = 24;
16773
+ const latitudePatchCount = LATITUDE_PATCH_COUNT$1;
16774
+ const longitudePatchCount = LONGITUDE_PATCH_COUNT$1;
16750
16775
  const surfacePatches = [];
16776
+ const latitudeBoundaries = new Float64Array(latitudePatchCount + 1);
16777
+ const longitudeBoundaries = new Float64Array(longitudePatchCount + 1);
16778
+ for (let boundaryIndex = 0; boundaryIndex <= latitudePatchCount; boundaryIndex++) {
16779
+ latitudeBoundaries[boundaryIndex] = -Math.PI / 2 + (boundaryIndex / latitudePatchCount) * Math.PI;
16780
+ }
16781
+ for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
16782
+ longitudeBoundaries[boundaryIndex] = -Math.PI + (boundaryIndex / longitudePatchCount) * Math.PI * 2;
16783
+ }
16784
+ const cachedLobeWavesByCornerLongitude = new Float64Array(longitudePatchCount + 1);
16785
+ for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
16786
+ cachedLobeWavesByCornerLongitude[boundaryIndex] = resolveLowerLobeWave(longitudeBoundaries[boundaryIndex], morphologyProfile, animationPhase, timeMs);
16787
+ }
16788
+ const cornerCount = (latitudePatchCount + 1) * (longitudePatchCount + 1);
16789
+ const transformedCornerSamples = new Array(cornerCount);
16790
+ for (let latitudeBoundaryIndex = 0; latitudeBoundaryIndex <= latitudePatchCount; latitudeBoundaryIndex++) {
16791
+ const cornerLatitude = latitudeBoundaries[latitudeBoundaryIndex];
16792
+ for (let longitudeBoundaryIndex = 0; longitudeBoundaryIndex <= longitudePatchCount; longitudeBoundaryIndex++) {
16793
+ const cornerLongitude = longitudeBoundaries[longitudeBoundaryIndex];
16794
+ const cornerIndex = latitudeBoundaryIndex * (longitudePatchCount + 1) + longitudeBoundaryIndex;
16795
+ const cornerSample = sampleBlobbyOctopusSurfacePointWithLongitudeCache(options, cornerLatitude, cornerLongitude, cachedLobeWavesByCornerLongitude[longitudeBoundaryIndex]);
16796
+ transformedCornerSamples[cornerIndex] = transformScenePoint(cornerSample, center, rotationX, rotationY);
16797
+ }
16798
+ }
16751
16799
  for (let latitudeIndex = 0; latitudeIndex < latitudePatchCount; latitudeIndex++) {
16752
- const startLatitude = -Math.PI / 2 + (latitudeIndex / latitudePatchCount) * Math.PI;
16753
- const endLatitude = -Math.PI / 2 + ((latitudeIndex + 1) / latitudePatchCount) * Math.PI;
16800
+ const startLatitude = latitudeBoundaries[latitudeIndex];
16801
+ const endLatitude = latitudeBoundaries[latitudeIndex + 1];
16754
16802
  const centerLatitude = (startLatitude + endLatitude) / 2;
16755
16803
  const verticalProgress = (Math.sin(centerLatitude) + 1) / 2;
16804
+ const startCornerRowOffset = latitudeIndex * (longitudePatchCount + 1);
16805
+ const endCornerRowOffset = (latitudeIndex + 1) * (longitudePatchCount + 1);
16756
16806
  for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
16757
- const startLongitude = -Math.PI + (longitudeIndex / longitudePatchCount) * Math.PI * 2;
16758
- const endLongitude = -Math.PI + ((longitudeIndex + 1) / longitudePatchCount) * Math.PI * 2;
16807
+ const startLongitude = longitudeBoundaries[longitudeIndex];
16808
+ const endLongitude = longitudeBoundaries[longitudeIndex + 1];
16759
16809
  const centerLongitude = (startLongitude + endLongitude) / 2;
16760
- const localCorners = [
16761
- sampleBlobbyOctopusSurfacePoint(options, startLatitude, startLongitude),
16762
- sampleBlobbyOctopusSurfacePoint(options, startLatitude, endLongitude),
16763
- sampleBlobbyOctopusSurfacePoint(options, endLatitude, endLongitude),
16764
- sampleBlobbyOctopusSurfacePoint(options, endLatitude, startLongitude),
16810
+ const transformedCorners = [
16811
+ transformedCornerSamples[startCornerRowOffset + longitudeIndex],
16812
+ transformedCornerSamples[startCornerRowOffset + longitudeIndex + 1],
16813
+ transformedCornerSamples[endCornerRowOffset + longitudeIndex + 1],
16814
+ transformedCornerSamples[endCornerRowOffset + longitudeIndex],
16765
16815
  ];
16766
- const transformedCorners = localCorners.map((localCorner) => transformScenePoint(localCorner, center, rotationX, rotationY));
16767
16816
  const surfaceNormal = normalizeVector3(crossProduct3D(subtractPoint3D(transformedCorners[1], transformedCorners[0]), subtractPoint3D(transformedCorners[2], transformedCorners[0])));
16768
16817
  if (surfaceNormal.z <= 0.01) {
16769
16818
  continue;
16770
16819
  }
16771
- const projectedCorners = transformedCorners.map((transformedCorner) => projectScenePoint(transformedCorner, size, sceneCenterX, sceneCenterY));
16820
+ const projectedCorners = [
16821
+ projectScenePoint(transformedCorners[0], size, sceneCenterX, sceneCenterY),
16822
+ projectScenePoint(transformedCorners[1], size, sceneCenterX, sceneCenterY),
16823
+ projectScenePoint(transformedCorners[2], size, sceneCenterX, sceneCenterY),
16824
+ projectScenePoint(transformedCorners[3], size, sceneCenterX, sceneCenterY),
16825
+ ];
16772
16826
  surfacePatches.push({
16773
16827
  corners: projectedCorners,
16774
- averageDepth: transformedCorners.reduce((depthSum, transformedCorner) => depthSum + transformedCorner.z, 0) /
16775
- transformedCorners.length,
16828
+ averageDepth: (transformedCorners[0].z +
16829
+ transformedCorners[1].z +
16830
+ transformedCorners[2].z +
16831
+ transformedCorners[3].z) /
16832
+ 4,
16776
16833
  lightIntensity: clampNumber$1(dotProduct3D(surfaceNormal, LIGHT_DIRECTION$1), -1, 1),
16777
16834
  fillStyle: resolveBlobbySurfacePatchFillStyle(palette, verticalProgress, Math.max(0, Math.cos(centerLongitude)), resolveLowerLobeWave(centerLongitude, morphologyProfile, animationPhase, timeMs)),
16778
16835
  outlineColor: verticalProgress < 0.58 ? `${palette.highlight}73` : `${palette.shadow}8a`,
@@ -16790,12 +16847,21 @@ function resolveVisibleBlobbyOctopusPatches(options) {
16790
16847
  * @private helper of `octopus3d2AvatarVisual`
16791
16848
  */
16792
16849
  function sampleBlobbyOctopusSurfacePoint(options, latitude, longitude) {
16850
+ const { morphologyProfile, animationPhase, timeMs } = options;
16851
+ return sampleBlobbyOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, resolveLowerLobeWave(longitude, morphologyProfile, animationPhase, timeMs));
16852
+ }
16853
+ /**
16854
+ * Samples one point on the continuous Octopus 3D 2 surface using a precomputed lower-lobe wave
16855
+ * to skip the per-call trig evaluation for `latitudePatchCount + 1` longitude-shared corners.
16856
+ *
16857
+ * @private helper of `octopus3d2AvatarVisual`
16858
+ */
16859
+ function sampleBlobbyOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, lowerLobeWave) {
16793
16860
  const { radiusX, radiusY, radiusZ, morphologyProfile, timeMs, animationPhase } = options;
16794
16861
  const cosineLatitude = Math.max(0, Math.cos(latitude));
16795
16862
  const verticalProgress = (Math.sin(latitude) + 1) / 2;
16796
16863
  const upperBlend = Math.pow(1 - verticalProgress, 1.2);
16797
16864
  const lowerBlend = Math.pow(verticalProgress, 1.42);
16798
- const lowerLobeWave = resolveLowerLobeWave(longitude, morphologyProfile, animationPhase, timeMs);
16799
16865
  const skirtEnvelope = Math.pow(cosineLatitude, 0.5) * lowerBlend;
16800
16866
  const horizontalScale = 1.02 +
16801
16867
  skirtEnvelope * (0.34 + (morphologyProfile.tentacles.rootSpreadScale - 1) * 0.22 + lowerLobeWave * 0.22) -
@@ -17092,45 +17158,102 @@ function drawContinuousOctopusShadow(context, size, palette, interaction, timeMs
17092
17158
  context.fill();
17093
17159
  context.restore();
17094
17160
  }
17161
+ /**
17162
+ * Number of latitude segments used by the continuous Octopus 3D 3 mesh.
17163
+ *
17164
+ * @private helper of `octopus3d3AvatarVisual`
17165
+ */
17166
+ const LATITUDE_PATCH_COUNT = 16;
17167
+ /**
17168
+ * Number of longitude segments used by the continuous Octopus 3D 3 mesh.
17169
+ *
17170
+ * @private helper of `octopus3d3AvatarVisual`
17171
+ */
17172
+ const LONGITUDE_PATCH_COUNT = 40;
17095
17173
  /**
17096
17174
  * Resolves visible projected patches for the continuous octopus mesh.
17097
17175
  *
17176
+ * Within a single frame, mesh corner samples and longitude-only computations (tentacle
17177
+ * influence and lobe wave) are quantized to the patch grid and computed once each rather
17178
+ * than re-evaluated for every patch corner — the patch loop alone calls `sampleContinuousOctopusSurfacePoint`
17179
+ * for `latitudePatchCount * longitudePatchCount * 4` corners without caching, and each call
17180
+ * triggers an inner 8-iteration `Math.exp` loop, which dominates the per-frame cost.
17181
+ *
17098
17182
  * @private helper of `octopus3d3AvatarVisual`
17099
17183
  */
17100
17184
  function resolveVisibleContinuousOctopusPatches(options) {
17101
17185
  const { center, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette } = options;
17102
- const latitudePatchCount = 16;
17103
- const longitudePatchCount = 40;
17186
+ const latitudePatchCount = LATITUDE_PATCH_COUNT;
17187
+ const longitudePatchCount = LONGITUDE_PATCH_COUNT;
17104
17188
  const surfacePatches = [];
17189
+ const latitudeBoundaries = new Float64Array(latitudePatchCount + 1);
17190
+ const longitudeBoundaries = new Float64Array(longitudePatchCount + 1);
17191
+ for (let boundaryIndex = 0; boundaryIndex <= latitudePatchCount; boundaryIndex++) {
17192
+ latitudeBoundaries[boundaryIndex] = -Math.PI / 2 + (boundaryIndex / latitudePatchCount) * Math.PI;
17193
+ }
17194
+ for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
17195
+ longitudeBoundaries[boundaryIndex] = -Math.PI + (boundaryIndex / longitudePatchCount) * Math.PI * 2;
17196
+ }
17197
+ const cachedTentacleInfluencesByCornerLongitude = new Array(longitudePatchCount + 1);
17198
+ const cachedLobeWavesByCornerLongitude = new Float64Array(longitudePatchCount + 1);
17199
+ const cachedTentacleInfluencesByPatchCenterLongitude = new Array(longitudePatchCount);
17200
+ const cachedLobeWavesByPatchCenterLongitude = new Float64Array(longitudePatchCount);
17201
+ const cachedCosByPatchCenterLongitude = new Float64Array(longitudePatchCount);
17202
+ for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
17203
+ const cornerLongitude = longitudeBoundaries[boundaryIndex];
17204
+ cachedTentacleInfluencesByCornerLongitude[boundaryIndex] = resolveContinuousTentacleInfluence(options, cornerLongitude);
17205
+ cachedLobeWavesByCornerLongitude[boundaryIndex] = resolveContinuousLobeWave(options, cornerLongitude);
17206
+ }
17207
+ for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
17208
+ const patchCenterLongitude = (longitudeBoundaries[longitudeIndex] + longitudeBoundaries[longitudeIndex + 1]) / 2;
17209
+ cachedTentacleInfluencesByPatchCenterLongitude[longitudeIndex] = resolveContinuousTentacleInfluence(options, patchCenterLongitude);
17210
+ cachedLobeWavesByPatchCenterLongitude[longitudeIndex] = resolveContinuousLobeWave(options, patchCenterLongitude);
17211
+ cachedCosByPatchCenterLongitude[longitudeIndex] = Math.max(0, Math.cos(patchCenterLongitude));
17212
+ }
17213
+ const cornerCount = (latitudePatchCount + 1) * (longitudePatchCount + 1);
17214
+ const transformedCornerSamples = new Array(cornerCount);
17215
+ for (let latitudeBoundaryIndex = 0; latitudeBoundaryIndex <= latitudePatchCount; latitudeBoundaryIndex++) {
17216
+ const cornerLatitude = latitudeBoundaries[latitudeBoundaryIndex];
17217
+ for (let longitudeBoundaryIndex = 0; longitudeBoundaryIndex <= longitudePatchCount; longitudeBoundaryIndex++) {
17218
+ const cornerLongitude = longitudeBoundaries[longitudeBoundaryIndex];
17219
+ const cornerIndex = latitudeBoundaryIndex * (longitudePatchCount + 1) + longitudeBoundaryIndex;
17220
+ const cornerSample = sampleContinuousOctopusSurfacePointWithLongitudeCache(options, cornerLatitude, cornerLongitude, cachedTentacleInfluencesByCornerLongitude[longitudeBoundaryIndex], cachedLobeWavesByCornerLongitude[longitudeBoundaryIndex]);
17221
+ transformedCornerSamples[cornerIndex] = transformScenePoint(cornerSample, center, rotationX, rotationY);
17222
+ }
17223
+ }
17105
17224
  for (let latitudeIndex = 0; latitudeIndex < latitudePatchCount; latitudeIndex++) {
17106
- const startLatitude = -Math.PI / 2 + (latitudeIndex / latitudePatchCount) * Math.PI;
17107
- const endLatitude = -Math.PI / 2 + ((latitudeIndex + 1) / latitudePatchCount) * Math.PI;
17225
+ const startLatitude = latitudeBoundaries[latitudeIndex];
17226
+ const endLatitude = latitudeBoundaries[latitudeIndex + 1];
17108
17227
  const centerLatitude = (startLatitude + endLatitude) / 2;
17109
17228
  const verticalProgress = (Math.sin(centerLatitude) + 1) / 2;
17229
+ const startCornerRowOffset = latitudeIndex * (longitudePatchCount + 1);
17230
+ const endCornerRowOffset = (latitudeIndex + 1) * (longitudePatchCount + 1);
17110
17231
  for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
17111
- const startLongitude = -Math.PI + (longitudeIndex / longitudePatchCount) * Math.PI * 2;
17112
- const endLongitude = -Math.PI + ((longitudeIndex + 1) / longitudePatchCount) * Math.PI * 2;
17113
- const centerLongitude = (startLongitude + endLongitude) / 2;
17114
- const localCorners = [
17115
- sampleContinuousOctopusSurfacePoint(options, startLatitude, startLongitude),
17116
- sampleContinuousOctopusSurfacePoint(options, startLatitude, endLongitude),
17117
- sampleContinuousOctopusSurfacePoint(options, endLatitude, endLongitude),
17118
- sampleContinuousOctopusSurfacePoint(options, endLatitude, startLongitude),
17232
+ const transformedCorners = [
17233
+ transformedCornerSamples[startCornerRowOffset + longitudeIndex],
17234
+ transformedCornerSamples[startCornerRowOffset + longitudeIndex + 1],
17235
+ transformedCornerSamples[endCornerRowOffset + longitudeIndex + 1],
17236
+ transformedCornerSamples[endCornerRowOffset + longitudeIndex],
17119
17237
  ];
17120
- const transformedCorners = localCorners.map((localCorner) => transformScenePoint(localCorner, center, rotationX, rotationY));
17121
17238
  const surfaceNormal = normalizeVector3(crossProduct3D(subtractPoint3D(transformedCorners[1], transformedCorners[0]), subtractPoint3D(transformedCorners[2], transformedCorners[0])));
17122
17239
  if (surfaceNormal.z <= 0.008) {
17123
17240
  continue;
17124
17241
  }
17125
- const projectedCorners = transformedCorners.map((transformedCorner) => projectScenePoint(transformedCorner, size, sceneCenterX, sceneCenterY));
17126
- const tentacleInfluence = resolveContinuousTentacleInfluence(options, centerLongitude);
17127
- const lowerLobeWave = resolveContinuousLobeWave(options, centerLongitude);
17242
+ const projectedCorners = [
17243
+ projectScenePoint(transformedCorners[0], size, sceneCenterX, sceneCenterY),
17244
+ projectScenePoint(transformedCorners[1], size, sceneCenterX, sceneCenterY),
17245
+ projectScenePoint(transformedCorners[2], size, sceneCenterX, sceneCenterY),
17246
+ projectScenePoint(transformedCorners[3], size, sceneCenterX, sceneCenterY),
17247
+ ];
17128
17248
  surfacePatches.push({
17129
17249
  corners: projectedCorners,
17130
- averageDepth: transformedCorners.reduce((depthSum, transformedCorner) => depthSum + transformedCorner.z, 0) /
17131
- transformedCorners.length,
17250
+ averageDepth: (transformedCorners[0].z +
17251
+ transformedCorners[1].z +
17252
+ transformedCorners[2].z +
17253
+ transformedCorners[3].z) /
17254
+ 4,
17132
17255
  lightIntensity: clampNumber$1(dotProduct3D(surfaceNormal, LIGHT_DIRECTION), -1, 1),
17133
- fillStyle: resolveContinuousSurfacePatchFillStyle(palette, verticalProgress, Math.max(0, Math.cos(centerLongitude)), tentacleInfluence.core, lowerLobeWave),
17256
+ fillStyle: resolveContinuousSurfacePatchFillStyle(palette, verticalProgress, cachedCosByPatchCenterLongitude[longitudeIndex], cachedTentacleInfluencesByPatchCenterLongitude[longitudeIndex].core, cachedLobeWavesByPatchCenterLongitude[longitudeIndex]),
17134
17257
  outlineColor: verticalProgress < 0.54 ? `${palette.highlight}69` : `${palette.shadow}78`,
17135
17258
  });
17136
17259
  }
@@ -17146,16 +17269,27 @@ function resolveVisibleContinuousOctopusPatches(options) {
17146
17269
  * @private helper of `octopus3d3AvatarVisual`
17147
17270
  */
17148
17271
  function sampleContinuousOctopusSurfacePoint(options, latitude, longitude) {
17272
+ return sampleContinuousOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, resolveContinuousTentacleInfluence(options, longitude), resolveContinuousLobeWave(options, longitude));
17273
+ }
17274
+ /**
17275
+ * Samples one point on the continuous Octopus 3D 3 surface using precomputed longitude-only
17276
+ * values to skip the per-call `Math.exp` tentacle-influence loop and the lobe-wave trig call.
17277
+ *
17278
+ * The patch loop quantizes the mesh into a fixed `(latitudePatchCount + 1) * (longitudePatchCount + 1)`
17279
+ * corner grid, so the same longitude is reused across every latitude row and each
17280
+ * tentacle/lobe value can be computed once per frame instead of `latitudePatchCount * 4` times.
17281
+ *
17282
+ * @private helper of `octopus3d3AvatarVisual`
17283
+ */
17284
+ function sampleContinuousOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, tentacleInfluence, lowerLobeWave) {
17149
17285
  const { radiusX, radiusY, radiusZ, morphologyProfile, timeMs, animationPhase } = options;
17150
17286
  const cosineLatitude = Math.max(0, Math.cos(latitude));
17151
17287
  const verticalProgress = (Math.sin(latitude) + 1) / 2;
17152
17288
  const upperBlend = Math.pow(1 - verticalProgress, 1.28);
17153
17289
  const lowerBlend = smoothStep(0.38, 1, verticalProgress);
17154
17290
  const tipBlend = smoothStep(0.68, 1, verticalProgress);
17155
- const tentacleInfluence = resolveContinuousTentacleInfluence(options, longitude);
17156
17291
  const centerPull = resolveSignedAngularDistance(longitude, tentacleInfluence.centerLongitude);
17157
17292
  const effectiveLongitude = longitude + centerPull * lowerBlend * tentacleInfluence.core * (0.24 + tipBlend * 0.2);
17158
- const lowerLobeWave = resolveContinuousLobeWave(options, longitude);
17159
17293
  const mantleRipple = Math.sin(longitude * morphologyProfile.body.lobeCount +
17160
17294
  animationPhase * 0.6 +
17161
17295
  timeMs / (1750 + morphologyProfile.body.lobeCount * 30)) *
@@ -20486,7 +20620,15 @@ function buildTeammateMetadata(entry) {
20486
20620
  * Builds the teammate request text, optionally including context.
20487
20621
  */
20488
20622
  function buildTeammateRequest(message, context) {
20489
- return context ? `${message}\n\nContext:\n${context}` : message;
20623
+ if (!context) {
20624
+ return message;
20625
+ }
20626
+ return spaceTrim$1((block) => `
20627
+ ${block(message)}
20628
+
20629
+ Context:
20630
+ ${block(context)}
20631
+ `);
20490
20632
  }
20491
20633
  /**
20492
20634
  * Builds a minimal chat prompt for teammate calls.
@@ -24475,7 +24617,11 @@ function createUseProjectToolFunctions() {
24475
24617
  const lineRangedContent = applyOptionalLineRange(decodedContent, args.startLine, args.endLine);
24476
24618
  const wasCharacterTruncated = lineRangedContent.length > MAX_PROJECT_FILE_CONTENT_CHARACTERS;
24477
24619
  const contentToReturn = wasCharacterTruncated
24478
- ? `${lineRangedContent.slice(0, MAX_PROJECT_FILE_CONTENT_CHARACTERS)}\n\n[...truncated...]`
24620
+ ? spaceTrim$1((block) => `
24621
+ ${block(lineRangedContent.slice(0, MAX_PROJECT_FILE_CONTENT_CHARACTERS))}
24622
+
24623
+ [...truncated...]
24624
+ `)
24479
24625
  : lineRangedContent;
24480
24626
  const wasTruncated = decoded.isTruncated || wasCharacterTruncated;
24481
24627
  if (wasCharacterTruncated) {
@@ -33410,11 +33556,19 @@ const JsonFileImportPlugin = {
33410
33556
  try {
33411
33557
  const json = JSON.parse(content);
33412
33558
  const formattedJson = JSON.stringify(json, null, 4);
33413
- return `\`\`\`json\n${formattedJson}\n\`\`\``;
33559
+ return spaceTrim$1((block) => `
33560
+ \`\`\`json
33561
+ ${block(formattedJson)}
33562
+ \`\`\`
33563
+ `);
33414
33564
  }
33415
33565
  catch (error) {
33416
33566
  // If JSON is invalid, still import it but maybe not as pretty JSON
33417
- return `\`\`\`json\n${content}\n\`\`\``;
33567
+ return spaceTrim$1((block) => `
33568
+ \`\`\`json
33569
+ ${block(content)}
33570
+ \`\`\`
33571
+ `);
33418
33572
  }
33419
33573
  },
33420
33574
  };
@@ -33438,7 +33592,11 @@ const TextFileImportPlugin = {
33438
33592
  import(content, mimeType) {
33439
33593
  const extension = mimeTypeToExtension(mimeType);
33440
33594
  const codeBlockType = extension || 'txt';
33441
- return `\`\`\`${codeBlockType}\n${content}\n\`\`\``;
33595
+ return spaceTrim$1((block) => `
33596
+ \`\`\`${codeBlockType}
33597
+ ${block(content)}
33598
+ \`\`\`
33599
+ `);
33442
33600
  },
33443
33601
  };
33444
33602
 
@@ -33685,11 +33843,19 @@ function collectExampleInteractionLines(parseResult, samples) {
33685
33843
  const examples = [];
33686
33844
  const initialMessage = (_a = parseResult.commitments.find((commitment) => commitment.type === 'INITIAL MESSAGE')) === null || _a === void 0 ? void 0 : _a.content;
33687
33845
  if (initialMessage) {
33688
- examples.push(`**Agent:**\n${initialMessage}`);
33846
+ examples.push(spaceTrim$1((block) => `
33847
+ **Agent:**
33848
+ ${block(initialMessage)}
33849
+ `));
33689
33850
  }
33690
33851
  if (samples && samples.length > 0) {
33691
33852
  for (const sample of samples) {
33692
- examples.push(`**User:** ${sample.question}\n\n**Agent:**\n${sample.answer}`);
33853
+ examples.push(spaceTrim$1((block) => `
33854
+ **User:** ${block(String(sample.question))}
33855
+
33856
+ **Agent:**
33857
+ ${block(sample.answer)}
33858
+ `));
33693
33859
  }
33694
33860
  }
33695
33861
  return examples;
@@ -40317,7 +40483,11 @@ function truncateAttachmentInlineText(content, maxCharacters) {
40317
40483
  };
40318
40484
  }
40319
40485
  return {
40320
- content: `${content.slice(0, Math.max(0, maxCharacters))}\n\n[...truncated...]`,
40486
+ content: spaceTrim$1((block) => `
40487
+ ${block(content.slice(0, Math.max(0, maxCharacters)))}
40488
+
40489
+ [...truncated...]
40490
+ `),
40321
40491
  isTruncated: true,
40322
40492
  };
40323
40493
  }