@promptbook/wizard 0.112.0-125 → 0.112.0-127

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 +225 -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 +225 -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
@@ -436,7 +436,7 @@ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treate
436
436
  - **Multi-runner execution:** `openai-codex`, `github-copilot`, `cline`, `claude-code`, `opencode`, `gemini`
437
437
  - **Context injection:** `--agent agents/coding/developer.book --context AGENTS.md` or inline extra instructions
438
438
  - **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
439
- - **Interactive or unattended runs:** default wait mode, or `--no-wait` for batch execution
439
+ - **Unattended or interactive runs:** default auto mode, or `--no-auto` to wait for user confirmation before each prompt
440
440
  - **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
441
441
  - **Opt-in remote pushes:** commits stay local unless you explicitly pass `--auto-push`
442
442
  - **Prompt triage:** `--priority` to process only more important tasks first
@@ -458,7 +458,7 @@ npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gp
458
458
 
459
459
  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
460
460
 
461
- 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
461
+ 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
462
462
 
463
463
  npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
464
464
 
@@ -484,7 +484,7 @@ ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh -
484
484
 
485
485
  ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --auto-push
486
486
 
487
- 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
487
+ 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
488
488
 
489
489
  ptbk coder find-refactor-candidates
490
490
 
@@ -514,7 +514,7 @@ ptbk coder verify
514
514
  | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
515
515
  | `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
516
516
  | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
517
- | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
517
+ | `--no-auto` | Waits for user confirmation before each prompt instead of running automatically through the queue. |
518
518
  | `--ignore-git-changes` | Disables the clean-working-tree guard. |
519
519
  | `--priority <n>` | Runs only prompts at or above the given priority. |
520
520
  | `--dry-run` | Prints which prompts are ready instead of executing them. |
@@ -527,7 +527,7 @@ ptbk coder verify
527
527
  1. Initialize once with `ptbk coder init`.
528
528
  2. Customize `prompts/templates/*.md` if needed, then create or write prompt files in `prompts/`.
529
529
  3. Customize the starter `AGENTS.md` with repository-specific instructions, then pass `--agent agents/coding/developer.book --context AGENTS.md`.
530
- 4. Run one prompt at a time interactively, or use `--no-wait` for unattended batches.
530
+ 4. Run unattended batches by default, or pass `--no-auto` to confirm each prompt interactively.
531
531
  5. Finish with `ptbk coder verify` so resolved prompts are archived and broken ones get explicit repair follow-ups.
532
532
 
533
533
 
package/esm/index.es.js CHANGED
@@ -37,7 +37,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
37
37
  * @generated
38
38
  * @see https://github.com/webgptorg/promptbook
39
39
  */
40
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-125';
40
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-127';
41
41
  /**
42
42
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
43
43
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -19365,8 +19365,11 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
19365
19365
  if (!trimmedContent) {
19366
19366
  return requirements;
19367
19367
  }
19368
- // Add goal as a proper h2 section to the system message
19369
- const goalSection = `## Goal\n\n${trimmedContent}`;
19368
+ const goalSection = spaceTrim$1((block) => `
19369
+ ## Goal
19370
+
19371
+ ${block(trimmedContent)}
19372
+ `);
19370
19373
  const requirementsWithGoal = this.appendToSystemMessage(requirements, goalSection, '\n\n');
19371
19374
  return this.appendToPromptSuffix(requirementsWithGoal, trimmedContent);
19372
19375
  }
@@ -19752,8 +19755,11 @@ class LanguageCommitmentDefinition extends BaseCommitmentDefinition {
19752
19755
  if (!trimmedContent) {
19753
19756
  return requirements;
19754
19757
  }
19755
- // Add language as a bullet under a ## Language section
19756
- const languageSection = `## Language\n\n- Your language is ${trimmedContent}`;
19758
+ const languageSection = spaceTrim$1((block) => `
19759
+ ## Language
19760
+
19761
+ - Your language is ${block(trimmedContent)}
19762
+ `);
19757
19763
  return this.appendToSystemMessage(requirements, languageSection, '\n\n');
19758
19764
  }
19759
19765
  }
@@ -24595,41 +24601,91 @@ function drawBlobbyOctopusShadow(context, size, palette, interaction, timeMs, mo
24595
24601
  context.fill();
24596
24602
  context.restore();
24597
24603
  }
24604
+ /**
24605
+ * Number of latitude segments used by the single blobby octopus mesh.
24606
+ *
24607
+ * @private helper of `octopus3d2AvatarVisual`
24608
+ */
24609
+ const LATITUDE_PATCH_COUNT$1 = 12;
24610
+ /**
24611
+ * Number of longitude segments used by the single blobby octopus mesh.
24612
+ *
24613
+ * @private helper of `octopus3d2AvatarVisual`
24614
+ */
24615
+ const LONGITUDE_PATCH_COUNT$1 = 24;
24598
24616
  /**
24599
24617
  * Resolves all visible projected patches for the single blobby octopus mesh.
24600
24618
  *
24619
+ * Within a single frame, mesh corner samples and longitude-only lobe-wave values are
24620
+ * quantized to the patch grid and computed once each rather than re-evaluated for every
24621
+ * patch corner — the patch loop alone would call `sampleBlobbyOctopusSurfacePoint`
24622
+ * `latitudePatchCount * longitudePatchCount * 4` times without caching, even though most
24623
+ * corners are shared between neighboring patches.
24624
+ *
24601
24625
  * @private helper of `octopus3d2AvatarVisual`
24602
24626
  */
24603
24627
  function resolveVisibleBlobbyOctopusPatches(options) {
24604
24628
  const { center, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, morphologyProfile, animationPhase, timeMs, } = options;
24605
- const latitudePatchCount = 12;
24606
- const longitudePatchCount = 24;
24629
+ const latitudePatchCount = LATITUDE_PATCH_COUNT$1;
24630
+ const longitudePatchCount = LONGITUDE_PATCH_COUNT$1;
24607
24631
  const surfacePatches = [];
24632
+ const latitudeBoundaries = new Float64Array(latitudePatchCount + 1);
24633
+ const longitudeBoundaries = new Float64Array(longitudePatchCount + 1);
24634
+ for (let boundaryIndex = 0; boundaryIndex <= latitudePatchCount; boundaryIndex++) {
24635
+ latitudeBoundaries[boundaryIndex] = -Math.PI / 2 + (boundaryIndex / latitudePatchCount) * Math.PI;
24636
+ }
24637
+ for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
24638
+ longitudeBoundaries[boundaryIndex] = -Math.PI + (boundaryIndex / longitudePatchCount) * Math.PI * 2;
24639
+ }
24640
+ const cachedLobeWavesByCornerLongitude = new Float64Array(longitudePatchCount + 1);
24641
+ for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
24642
+ cachedLobeWavesByCornerLongitude[boundaryIndex] = resolveLowerLobeWave(longitudeBoundaries[boundaryIndex], morphologyProfile, animationPhase, timeMs);
24643
+ }
24644
+ const cornerCount = (latitudePatchCount + 1) * (longitudePatchCount + 1);
24645
+ const transformedCornerSamples = new Array(cornerCount);
24646
+ for (let latitudeBoundaryIndex = 0; latitudeBoundaryIndex <= latitudePatchCount; latitudeBoundaryIndex++) {
24647
+ const cornerLatitude = latitudeBoundaries[latitudeBoundaryIndex];
24648
+ for (let longitudeBoundaryIndex = 0; longitudeBoundaryIndex <= longitudePatchCount; longitudeBoundaryIndex++) {
24649
+ const cornerLongitude = longitudeBoundaries[longitudeBoundaryIndex];
24650
+ const cornerIndex = latitudeBoundaryIndex * (longitudePatchCount + 1) + longitudeBoundaryIndex;
24651
+ const cornerSample = sampleBlobbyOctopusSurfacePointWithLongitudeCache(options, cornerLatitude, cornerLongitude, cachedLobeWavesByCornerLongitude[longitudeBoundaryIndex]);
24652
+ transformedCornerSamples[cornerIndex] = transformScenePoint(cornerSample, center, rotationX, rotationY);
24653
+ }
24654
+ }
24608
24655
  for (let latitudeIndex = 0; latitudeIndex < latitudePatchCount; latitudeIndex++) {
24609
- const startLatitude = -Math.PI / 2 + (latitudeIndex / latitudePatchCount) * Math.PI;
24610
- const endLatitude = -Math.PI / 2 + ((latitudeIndex + 1) / latitudePatchCount) * Math.PI;
24656
+ const startLatitude = latitudeBoundaries[latitudeIndex];
24657
+ const endLatitude = latitudeBoundaries[latitudeIndex + 1];
24611
24658
  const centerLatitude = (startLatitude + endLatitude) / 2;
24612
24659
  const verticalProgress = (Math.sin(centerLatitude) + 1) / 2;
24660
+ const startCornerRowOffset = latitudeIndex * (longitudePatchCount + 1);
24661
+ const endCornerRowOffset = (latitudeIndex + 1) * (longitudePatchCount + 1);
24613
24662
  for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
24614
- const startLongitude = -Math.PI + (longitudeIndex / longitudePatchCount) * Math.PI * 2;
24615
- const endLongitude = -Math.PI + ((longitudeIndex + 1) / longitudePatchCount) * Math.PI * 2;
24663
+ const startLongitude = longitudeBoundaries[longitudeIndex];
24664
+ const endLongitude = longitudeBoundaries[longitudeIndex + 1];
24616
24665
  const centerLongitude = (startLongitude + endLongitude) / 2;
24617
- const localCorners = [
24618
- sampleBlobbyOctopusSurfacePoint(options, startLatitude, startLongitude),
24619
- sampleBlobbyOctopusSurfacePoint(options, startLatitude, endLongitude),
24620
- sampleBlobbyOctopusSurfacePoint(options, endLatitude, endLongitude),
24621
- sampleBlobbyOctopusSurfacePoint(options, endLatitude, startLongitude),
24666
+ const transformedCorners = [
24667
+ transformedCornerSamples[startCornerRowOffset + longitudeIndex],
24668
+ transformedCornerSamples[startCornerRowOffset + longitudeIndex + 1],
24669
+ transformedCornerSamples[endCornerRowOffset + longitudeIndex + 1],
24670
+ transformedCornerSamples[endCornerRowOffset + longitudeIndex],
24622
24671
  ];
24623
- const transformedCorners = localCorners.map((localCorner) => transformScenePoint(localCorner, center, rotationX, rotationY));
24624
24672
  const surfaceNormal = normalizeVector3(crossProduct3D(subtractPoint3D(transformedCorners[1], transformedCorners[0]), subtractPoint3D(transformedCorners[2], transformedCorners[0])));
24625
24673
  if (surfaceNormal.z <= 0.01) {
24626
24674
  continue;
24627
24675
  }
24628
- const projectedCorners = transformedCorners.map((transformedCorner) => projectScenePoint(transformedCorner, size, sceneCenterX, sceneCenterY));
24676
+ const projectedCorners = [
24677
+ projectScenePoint(transformedCorners[0], size, sceneCenterX, sceneCenterY),
24678
+ projectScenePoint(transformedCorners[1], size, sceneCenterX, sceneCenterY),
24679
+ projectScenePoint(transformedCorners[2], size, sceneCenterX, sceneCenterY),
24680
+ projectScenePoint(transformedCorners[3], size, sceneCenterX, sceneCenterY),
24681
+ ];
24629
24682
  surfacePatches.push({
24630
24683
  corners: projectedCorners,
24631
- averageDepth: transformedCorners.reduce((depthSum, transformedCorner) => depthSum + transformedCorner.z, 0) /
24632
- transformedCorners.length,
24684
+ averageDepth: (transformedCorners[0].z +
24685
+ transformedCorners[1].z +
24686
+ transformedCorners[2].z +
24687
+ transformedCorners[3].z) /
24688
+ 4,
24633
24689
  lightIntensity: clampNumber$1(dotProduct3D(surfaceNormal, LIGHT_DIRECTION$1), -1, 1),
24634
24690
  fillStyle: resolveBlobbySurfacePatchFillStyle(palette, verticalProgress, Math.max(0, Math.cos(centerLongitude)), resolveLowerLobeWave(centerLongitude, morphologyProfile, animationPhase, timeMs)),
24635
24691
  outlineColor: verticalProgress < 0.58 ? `${palette.highlight}73` : `${palette.shadow}8a`,
@@ -24647,12 +24703,21 @@ function resolveVisibleBlobbyOctopusPatches(options) {
24647
24703
  * @private helper of `octopus3d2AvatarVisual`
24648
24704
  */
24649
24705
  function sampleBlobbyOctopusSurfacePoint(options, latitude, longitude) {
24706
+ const { morphologyProfile, animationPhase, timeMs } = options;
24707
+ return sampleBlobbyOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, resolveLowerLobeWave(longitude, morphologyProfile, animationPhase, timeMs));
24708
+ }
24709
+ /**
24710
+ * Samples one point on the continuous Octopus 3D 2 surface using a precomputed lower-lobe wave
24711
+ * to skip the per-call trig evaluation for `latitudePatchCount + 1` longitude-shared corners.
24712
+ *
24713
+ * @private helper of `octopus3d2AvatarVisual`
24714
+ */
24715
+ function sampleBlobbyOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, lowerLobeWave) {
24650
24716
  const { radiusX, radiusY, radiusZ, morphologyProfile, timeMs, animationPhase } = options;
24651
24717
  const cosineLatitude = Math.max(0, Math.cos(latitude));
24652
24718
  const verticalProgress = (Math.sin(latitude) + 1) / 2;
24653
24719
  const upperBlend = Math.pow(1 - verticalProgress, 1.2);
24654
24720
  const lowerBlend = Math.pow(verticalProgress, 1.42);
24655
- const lowerLobeWave = resolveLowerLobeWave(longitude, morphologyProfile, animationPhase, timeMs);
24656
24721
  const skirtEnvelope = Math.pow(cosineLatitude, 0.5) * lowerBlend;
24657
24722
  const horizontalScale = 1.02 +
24658
24723
  skirtEnvelope * (0.34 + (morphologyProfile.tentacles.rootSpreadScale - 1) * 0.22 + lowerLobeWave * 0.22) -
@@ -24949,45 +25014,102 @@ function drawContinuousOctopusShadow(context, size, palette, interaction, timeMs
24949
25014
  context.fill();
24950
25015
  context.restore();
24951
25016
  }
25017
+ /**
25018
+ * Number of latitude segments used by the continuous Octopus 3D 3 mesh.
25019
+ *
25020
+ * @private helper of `octopus3d3AvatarVisual`
25021
+ */
25022
+ const LATITUDE_PATCH_COUNT = 16;
25023
+ /**
25024
+ * Number of longitude segments used by the continuous Octopus 3D 3 mesh.
25025
+ *
25026
+ * @private helper of `octopus3d3AvatarVisual`
25027
+ */
25028
+ const LONGITUDE_PATCH_COUNT = 40;
24952
25029
  /**
24953
25030
  * Resolves visible projected patches for the continuous octopus mesh.
24954
25031
  *
25032
+ * Within a single frame, mesh corner samples and longitude-only computations (tentacle
25033
+ * influence and lobe wave) are quantized to the patch grid and computed once each rather
25034
+ * than re-evaluated for every patch corner — the patch loop alone calls `sampleContinuousOctopusSurfacePoint`
25035
+ * for `latitudePatchCount * longitudePatchCount * 4` corners without caching, and each call
25036
+ * triggers an inner 8-iteration `Math.exp` loop, which dominates the per-frame cost.
25037
+ *
24955
25038
  * @private helper of `octopus3d3AvatarVisual`
24956
25039
  */
24957
25040
  function resolveVisibleContinuousOctopusPatches(options) {
24958
25041
  const { center, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette } = options;
24959
- const latitudePatchCount = 16;
24960
- const longitudePatchCount = 40;
25042
+ const latitudePatchCount = LATITUDE_PATCH_COUNT;
25043
+ const longitudePatchCount = LONGITUDE_PATCH_COUNT;
24961
25044
  const surfacePatches = [];
25045
+ const latitudeBoundaries = new Float64Array(latitudePatchCount + 1);
25046
+ const longitudeBoundaries = new Float64Array(longitudePatchCount + 1);
25047
+ for (let boundaryIndex = 0; boundaryIndex <= latitudePatchCount; boundaryIndex++) {
25048
+ latitudeBoundaries[boundaryIndex] = -Math.PI / 2 + (boundaryIndex / latitudePatchCount) * Math.PI;
25049
+ }
25050
+ for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
25051
+ longitudeBoundaries[boundaryIndex] = -Math.PI + (boundaryIndex / longitudePatchCount) * Math.PI * 2;
25052
+ }
25053
+ const cachedTentacleInfluencesByCornerLongitude = new Array(longitudePatchCount + 1);
25054
+ const cachedLobeWavesByCornerLongitude = new Float64Array(longitudePatchCount + 1);
25055
+ const cachedTentacleInfluencesByPatchCenterLongitude = new Array(longitudePatchCount);
25056
+ const cachedLobeWavesByPatchCenterLongitude = new Float64Array(longitudePatchCount);
25057
+ const cachedCosByPatchCenterLongitude = new Float64Array(longitudePatchCount);
25058
+ for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
25059
+ const cornerLongitude = longitudeBoundaries[boundaryIndex];
25060
+ cachedTentacleInfluencesByCornerLongitude[boundaryIndex] = resolveContinuousTentacleInfluence(options, cornerLongitude);
25061
+ cachedLobeWavesByCornerLongitude[boundaryIndex] = resolveContinuousLobeWave(options, cornerLongitude);
25062
+ }
25063
+ for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
25064
+ const patchCenterLongitude = (longitudeBoundaries[longitudeIndex] + longitudeBoundaries[longitudeIndex + 1]) / 2;
25065
+ cachedTentacleInfluencesByPatchCenterLongitude[longitudeIndex] = resolveContinuousTentacleInfluence(options, patchCenterLongitude);
25066
+ cachedLobeWavesByPatchCenterLongitude[longitudeIndex] = resolveContinuousLobeWave(options, patchCenterLongitude);
25067
+ cachedCosByPatchCenterLongitude[longitudeIndex] = Math.max(0, Math.cos(patchCenterLongitude));
25068
+ }
25069
+ const cornerCount = (latitudePatchCount + 1) * (longitudePatchCount + 1);
25070
+ const transformedCornerSamples = new Array(cornerCount);
25071
+ for (let latitudeBoundaryIndex = 0; latitudeBoundaryIndex <= latitudePatchCount; latitudeBoundaryIndex++) {
25072
+ const cornerLatitude = latitudeBoundaries[latitudeBoundaryIndex];
25073
+ for (let longitudeBoundaryIndex = 0; longitudeBoundaryIndex <= longitudePatchCount; longitudeBoundaryIndex++) {
25074
+ const cornerLongitude = longitudeBoundaries[longitudeBoundaryIndex];
25075
+ const cornerIndex = latitudeBoundaryIndex * (longitudePatchCount + 1) + longitudeBoundaryIndex;
25076
+ const cornerSample = sampleContinuousOctopusSurfacePointWithLongitudeCache(options, cornerLatitude, cornerLongitude, cachedTentacleInfluencesByCornerLongitude[longitudeBoundaryIndex], cachedLobeWavesByCornerLongitude[longitudeBoundaryIndex]);
25077
+ transformedCornerSamples[cornerIndex] = transformScenePoint(cornerSample, center, rotationX, rotationY);
25078
+ }
25079
+ }
24962
25080
  for (let latitudeIndex = 0; latitudeIndex < latitudePatchCount; latitudeIndex++) {
24963
- const startLatitude = -Math.PI / 2 + (latitudeIndex / latitudePatchCount) * Math.PI;
24964
- const endLatitude = -Math.PI / 2 + ((latitudeIndex + 1) / latitudePatchCount) * Math.PI;
25081
+ const startLatitude = latitudeBoundaries[latitudeIndex];
25082
+ const endLatitude = latitudeBoundaries[latitudeIndex + 1];
24965
25083
  const centerLatitude = (startLatitude + endLatitude) / 2;
24966
25084
  const verticalProgress = (Math.sin(centerLatitude) + 1) / 2;
25085
+ const startCornerRowOffset = latitudeIndex * (longitudePatchCount + 1);
25086
+ const endCornerRowOffset = (latitudeIndex + 1) * (longitudePatchCount + 1);
24967
25087
  for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
24968
- const startLongitude = -Math.PI + (longitudeIndex / longitudePatchCount) * Math.PI * 2;
24969
- const endLongitude = -Math.PI + ((longitudeIndex + 1) / longitudePatchCount) * Math.PI * 2;
24970
- const centerLongitude = (startLongitude + endLongitude) / 2;
24971
- const localCorners = [
24972
- sampleContinuousOctopusSurfacePoint(options, startLatitude, startLongitude),
24973
- sampleContinuousOctopusSurfacePoint(options, startLatitude, endLongitude),
24974
- sampleContinuousOctopusSurfacePoint(options, endLatitude, endLongitude),
24975
- sampleContinuousOctopusSurfacePoint(options, endLatitude, startLongitude),
25088
+ const transformedCorners = [
25089
+ transformedCornerSamples[startCornerRowOffset + longitudeIndex],
25090
+ transformedCornerSamples[startCornerRowOffset + longitudeIndex + 1],
25091
+ transformedCornerSamples[endCornerRowOffset + longitudeIndex + 1],
25092
+ transformedCornerSamples[endCornerRowOffset + longitudeIndex],
24976
25093
  ];
24977
- const transformedCorners = localCorners.map((localCorner) => transformScenePoint(localCorner, center, rotationX, rotationY));
24978
25094
  const surfaceNormal = normalizeVector3(crossProduct3D(subtractPoint3D(transformedCorners[1], transformedCorners[0]), subtractPoint3D(transformedCorners[2], transformedCorners[0])));
24979
25095
  if (surfaceNormal.z <= 0.008) {
24980
25096
  continue;
24981
25097
  }
24982
- const projectedCorners = transformedCorners.map((transformedCorner) => projectScenePoint(transformedCorner, size, sceneCenterX, sceneCenterY));
24983
- const tentacleInfluence = resolveContinuousTentacleInfluence(options, centerLongitude);
24984
- const lowerLobeWave = resolveContinuousLobeWave(options, centerLongitude);
25098
+ const projectedCorners = [
25099
+ projectScenePoint(transformedCorners[0], size, sceneCenterX, sceneCenterY),
25100
+ projectScenePoint(transformedCorners[1], size, sceneCenterX, sceneCenterY),
25101
+ projectScenePoint(transformedCorners[2], size, sceneCenterX, sceneCenterY),
25102
+ projectScenePoint(transformedCorners[3], size, sceneCenterX, sceneCenterY),
25103
+ ];
24985
25104
  surfacePatches.push({
24986
25105
  corners: projectedCorners,
24987
- averageDepth: transformedCorners.reduce((depthSum, transformedCorner) => depthSum + transformedCorner.z, 0) /
24988
- transformedCorners.length,
25106
+ averageDepth: (transformedCorners[0].z +
25107
+ transformedCorners[1].z +
25108
+ transformedCorners[2].z +
25109
+ transformedCorners[3].z) /
25110
+ 4,
24989
25111
  lightIntensity: clampNumber$1(dotProduct3D(surfaceNormal, LIGHT_DIRECTION), -1, 1),
24990
- fillStyle: resolveContinuousSurfacePatchFillStyle(palette, verticalProgress, Math.max(0, Math.cos(centerLongitude)), tentacleInfluence.core, lowerLobeWave),
25112
+ fillStyle: resolveContinuousSurfacePatchFillStyle(palette, verticalProgress, cachedCosByPatchCenterLongitude[longitudeIndex], cachedTentacleInfluencesByPatchCenterLongitude[longitudeIndex].core, cachedLobeWavesByPatchCenterLongitude[longitudeIndex]),
24991
25113
  outlineColor: verticalProgress < 0.54 ? `${palette.highlight}69` : `${palette.shadow}78`,
24992
25114
  });
24993
25115
  }
@@ -25003,16 +25125,27 @@ function resolveVisibleContinuousOctopusPatches(options) {
25003
25125
  * @private helper of `octopus3d3AvatarVisual`
25004
25126
  */
25005
25127
  function sampleContinuousOctopusSurfacePoint(options, latitude, longitude) {
25128
+ return sampleContinuousOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, resolveContinuousTentacleInfluence(options, longitude), resolveContinuousLobeWave(options, longitude));
25129
+ }
25130
+ /**
25131
+ * Samples one point on the continuous Octopus 3D 3 surface using precomputed longitude-only
25132
+ * values to skip the per-call `Math.exp` tentacle-influence loop and the lobe-wave trig call.
25133
+ *
25134
+ * The patch loop quantizes the mesh into a fixed `(latitudePatchCount + 1) * (longitudePatchCount + 1)`
25135
+ * corner grid, so the same longitude is reused across every latitude row and each
25136
+ * tentacle/lobe value can be computed once per frame instead of `latitudePatchCount * 4` times.
25137
+ *
25138
+ * @private helper of `octopus3d3AvatarVisual`
25139
+ */
25140
+ function sampleContinuousOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, tentacleInfluence, lowerLobeWave) {
25006
25141
  const { radiusX, radiusY, radiusZ, morphologyProfile, timeMs, animationPhase } = options;
25007
25142
  const cosineLatitude = Math.max(0, Math.cos(latitude));
25008
25143
  const verticalProgress = (Math.sin(latitude) + 1) / 2;
25009
25144
  const upperBlend = Math.pow(1 - verticalProgress, 1.28);
25010
25145
  const lowerBlend = smoothStep(0.38, 1, verticalProgress);
25011
25146
  const tipBlend = smoothStep(0.68, 1, verticalProgress);
25012
- const tentacleInfluence = resolveContinuousTentacleInfluence(options, longitude);
25013
25147
  const centerPull = resolveSignedAngularDistance(longitude, tentacleInfluence.centerLongitude);
25014
25148
  const effectiveLongitude = longitude + centerPull * lowerBlend * tentacleInfluence.core * (0.24 + tipBlend * 0.2);
25015
- const lowerLobeWave = resolveContinuousLobeWave(options, longitude);
25016
25149
  const mantleRipple = Math.sin(longitude * morphologyProfile.body.lobeCount +
25017
25150
  animationPhase * 0.6 +
25018
25151
  timeMs / (1750 + morphologyProfile.body.lobeCount * 30)) *
@@ -28343,7 +28476,15 @@ function buildTeammateMetadata(entry) {
28343
28476
  * Builds the teammate request text, optionally including context.
28344
28477
  */
28345
28478
  function buildTeammateRequest(message, context) {
28346
- return context ? `${message}\n\nContext:\n${context}` : message;
28479
+ if (!context) {
28480
+ return message;
28481
+ }
28482
+ return spaceTrim$1((block) => `
28483
+ ${block(message)}
28484
+
28485
+ Context:
28486
+ ${block(context)}
28487
+ `);
28347
28488
  }
28348
28489
  /**
28349
28490
  * Builds a minimal chat prompt for teammate calls.
@@ -32169,7 +32310,11 @@ function createUseProjectToolFunctions() {
32169
32310
  const lineRangedContent = applyOptionalLineRange(decodedContent, args.startLine, args.endLine);
32170
32311
  const wasCharacterTruncated = lineRangedContent.length > MAX_PROJECT_FILE_CONTENT_CHARACTERS;
32171
32312
  const contentToReturn = wasCharacterTruncated
32172
- ? `${lineRangedContent.slice(0, MAX_PROJECT_FILE_CONTENT_CHARACTERS)}\n\n[...truncated...]`
32313
+ ? spaceTrim$1((block) => `
32314
+ ${block(lineRangedContent.slice(0, MAX_PROJECT_FILE_CONTENT_CHARACTERS))}
32315
+
32316
+ [...truncated...]
32317
+ `)
32173
32318
  : lineRangedContent;
32174
32319
  const wasTruncated = decoded.isTruncated || wasCharacterTruncated;
32175
32320
  if (wasCharacterTruncated) {
@@ -35658,11 +35803,19 @@ const JsonFileImportPlugin = {
35658
35803
  try {
35659
35804
  const json = JSON.parse(content);
35660
35805
  const formattedJson = JSON.stringify(json, null, 4);
35661
- return `\`\`\`json\n${formattedJson}\n\`\`\``;
35806
+ return spaceTrim$1((block) => `
35807
+ \`\`\`json
35808
+ ${block(formattedJson)}
35809
+ \`\`\`
35810
+ `);
35662
35811
  }
35663
35812
  catch (error) {
35664
35813
  // If JSON is invalid, still import it but maybe not as pretty JSON
35665
- return `\`\`\`json\n${content}\n\`\`\``;
35814
+ return spaceTrim$1((block) => `
35815
+ \`\`\`json
35816
+ ${block(content)}
35817
+ \`\`\`
35818
+ `);
35666
35819
  }
35667
35820
  },
35668
35821
  };
@@ -35686,7 +35839,11 @@ const TextFileImportPlugin = {
35686
35839
  import(content, mimeType) {
35687
35840
  const extension = mimeTypeToExtension(mimeType);
35688
35841
  const codeBlockType = extension || 'txt';
35689
- return `\`\`\`${codeBlockType}\n${content}\n\`\`\``;
35842
+ return spaceTrim$1((block) => `
35843
+ \`\`\`${codeBlockType}
35844
+ ${block(content)}
35845
+ \`\`\`
35846
+ `);
35690
35847
  },
35691
35848
  };
35692
35849
 
@@ -35933,11 +36090,19 @@ function collectExampleInteractionLines(parseResult, samples) {
35933
36090
  const examples = [];
35934
36091
  const initialMessage = (_a = parseResult.commitments.find((commitment) => commitment.type === 'INITIAL MESSAGE')) === null || _a === void 0 ? void 0 : _a.content;
35935
36092
  if (initialMessage) {
35936
- examples.push(`**Agent:**\n${initialMessage}`);
36093
+ examples.push(spaceTrim$1((block) => `
36094
+ **Agent:**
36095
+ ${block(initialMessage)}
36096
+ `));
35937
36097
  }
35938
36098
  if (samples && samples.length > 0) {
35939
36099
  for (const sample of samples) {
35940
- examples.push(`**User:** ${sample.question}\n\n**Agent:**\n${sample.answer}`);
36100
+ examples.push(spaceTrim$1((block) => `
36101
+ **User:** ${block(String(sample.question))}
36102
+
36103
+ **Agent:**
36104
+ ${block(sample.answer)}
36105
+ `));
35941
36106
  }
35942
36107
  }
35943
36108
  return examples;
@@ -40462,7 +40627,12 @@ function colorizeAvailableProviderMessage(providerMessage, { isInstalled, isFull
40462
40627
  * @private internal function of `$registeredLlmToolsMessage`
40463
40628
  */
40464
40629
  function createUsedEnvMessage() {
40465
- return $usedEnvFilename === null ? `Unknown \`.env\` file` : `Used \`.env\` file:\n${$usedEnvFilename}`;
40630
+ return $usedEnvFilename === null
40631
+ ? `Unknown \`.env\` file`
40632
+ : spaceTrim$1(`
40633
+ Used \`.env\` file:
40634
+ ${$usedEnvFilename}
40635
+ `);
40466
40636
  }
40467
40637
  // TODO: [®] DRY Register logic
40468
40638
  // TODO: [🧠][⚛] Maybe pass env as argument
@@ -50450,7 +50620,11 @@ function truncateAttachmentInlineText(content, maxCharacters) {
50450
50620
  };
50451
50621
  }
50452
50622
  return {
50453
- content: `${content.slice(0, Math.max(0, maxCharacters))}\n\n[...truncated...]`,
50623
+ content: spaceTrim$1((block) => `
50624
+ ${block(content.slice(0, Math.max(0, maxCharacters)))}
50625
+
50626
+ [...truncated...]
50627
+ `),
50454
50628
  isTruncated: true,
50455
50629
  };
50456
50630
  }