@promptbook/node 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.
- package/README.md +5 -5
- package/esm/index.es.js +257 -59
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/components.index.d.ts +2 -0
- package/esm/src/_packages/types.index.d.ts +2 -0
- package/esm/src/avatars/avatarAnimationScheduler.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
- package/esm/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
- package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
- package/esm/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
- package/esm/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
- package/esm/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
- package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/esm/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
- package/esm/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
- package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
- package/esm/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +257 -59
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/components.index.d.ts +2 -0
- package/umd/src/_packages/types.index.d.ts +2 -0
- package/umd/src/avatars/avatarAnimationScheduler.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/ChatCitationModal.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +4 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
- package/umd/src/book-components/Chat/Chat/ChatToolCallModal.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +3 -1
- package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -0
- package/umd/src/book-components/Chat/SourceChip/SourceChip.d.ts +6 -1
- package/umd/src/book-components/Chat/hooks/useResolvedCitationLabel.d.ts +12 -0
- package/umd/src/book-components/Chat/types/ChatMessage.d.ts +4 -0
- package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/umd/src/book-components/Chat/types/CitationLabelResolver.d.ts +8 -0
- package/umd/src/book-components/Chat/utils/citationHelpers.d.ts +9 -0
- package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.d.ts +14 -0
- package/umd/src/book-components/Chat/utils/decodeJsonUnicodeEscapesInMarkdownText.test.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +4 -0
- package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
* @generated
|
|
52
52
|
* @see https://github.com/webgptorg/promptbook
|
|
53
53
|
*/
|
|
54
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
54
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-127';
|
|
55
55
|
/**
|
|
56
56
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
57
57
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3524,7 +3524,11 @@
|
|
|
3524
3524
|
if (normalized.length <= OUTPUT_SNIPPET_MAX_CHARS) {
|
|
3525
3525
|
return normalized;
|
|
3526
3526
|
}
|
|
3527
|
-
return
|
|
3527
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
3528
|
+
${block(normalized.slice(0, OUTPUT_SNIPPET_MAX_CHARS))}
|
|
3529
|
+
|
|
3530
|
+
...[truncated]
|
|
3531
|
+
`);
|
|
3528
3532
|
}
|
|
3529
3533
|
/**
|
|
3530
3534
|
* Builds one command failure message that keeps a useful snippet of CLI output.
|
|
@@ -3534,7 +3538,11 @@
|
|
|
3534
3538
|
if (!outputSnippet) {
|
|
3535
3539
|
return `Command "bash ${scriptPathPosix}" exited with code ${code !== null && code !== void 0 ? code : 'unknown'}`;
|
|
3536
3540
|
}
|
|
3537
|
-
return
|
|
3541
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
3542
|
+
Command "bash ${scriptPathPosix}" exited with code ${code !== null && code !== void 0 ? code : 'unknown'}
|
|
3543
|
+
|
|
3544
|
+
${block(outputSnippet)}
|
|
3545
|
+
`);
|
|
3538
3546
|
}
|
|
3539
3547
|
/**
|
|
3540
3548
|
* Runs a script until a completion marker is observed and output is idle for a set timeout.
|
|
@@ -3651,7 +3659,9 @@
|
|
|
3651
3659
|
* Handles process exit and resolves or rejects accordingly.
|
|
3652
3660
|
*/
|
|
3653
3661
|
const handleExit = (code) => {
|
|
3654
|
-
const failure = code === 0 || markerSeen
|
|
3662
|
+
const failure = code === 0 || markerSeen
|
|
3663
|
+
? undefined
|
|
3664
|
+
: new Error(buildCommandFailureMessage(scriptPathPosix, code, fullOutput));
|
|
3655
3665
|
const status = failure ? `failed with exit code ${code !== null && code !== void 0 ? code : 'unknown'}` : 'succeeded';
|
|
3656
3666
|
settleWithLog(status, () => {
|
|
3657
3667
|
if (!failure) {
|
|
@@ -3669,8 +3679,14 @@
|
|
|
3669
3679
|
});
|
|
3670
3680
|
commandProcess.on('error', (error) => {
|
|
3671
3681
|
const outputSnippet = createOutputSnippet(fullOutput);
|
|
3672
|
-
const
|
|
3673
|
-
|
|
3682
|
+
const failureMessage = outputSnippet
|
|
3683
|
+
? _spaceTrim.spaceTrim((block) => `
|
|
3684
|
+
Command "bash ${scriptPathPosix}" failed: ${error.message}
|
|
3685
|
+
|
|
3686
|
+
${block(outputSnippet)}
|
|
3687
|
+
`)
|
|
3688
|
+
: `Command "bash ${scriptPathPosix}" failed: ${error.message}`;
|
|
3689
|
+
const failure = new Error(failureMessage);
|
|
3674
3690
|
settleWithLog('failed before completion', () => reject(failure), failure);
|
|
3675
3691
|
});
|
|
3676
3692
|
});
|
|
@@ -4073,7 +4089,11 @@
|
|
|
4073
4089
|
if (normalized.length <= maxChars) {
|
|
4074
4090
|
return normalized;
|
|
4075
4091
|
}
|
|
4076
|
-
return
|
|
4092
|
+
return spaceTrim((block) => `
|
|
4093
|
+
${block(normalized.slice(0, maxChars))}
|
|
4094
|
+
|
|
4095
|
+
...[truncated]
|
|
4096
|
+
`);
|
|
4077
4097
|
}
|
|
4078
4098
|
/**
|
|
4079
4099
|
* Returns true if at least one regex matches the provided text.
|
|
@@ -12495,8 +12515,11 @@
|
|
|
12495
12515
|
if (!trimmedContent) {
|
|
12496
12516
|
return requirements;
|
|
12497
12517
|
}
|
|
12498
|
-
|
|
12499
|
-
|
|
12518
|
+
const goalSection = _spaceTrim.spaceTrim((block) => `
|
|
12519
|
+
## Goal
|
|
12520
|
+
|
|
12521
|
+
${block(trimmedContent)}
|
|
12522
|
+
`);
|
|
12500
12523
|
const requirementsWithGoal = this.appendToSystemMessage(requirements, goalSection, '\n\n');
|
|
12501
12524
|
return this.appendToPromptSuffix(requirementsWithGoal, trimmedContent);
|
|
12502
12525
|
}
|
|
@@ -13018,8 +13041,11 @@
|
|
|
13018
13041
|
if (!trimmedContent) {
|
|
13019
13042
|
return requirements;
|
|
13020
13043
|
}
|
|
13021
|
-
|
|
13022
|
-
|
|
13044
|
+
const languageSection = _spaceTrim.spaceTrim((block) => `
|
|
13045
|
+
## Language
|
|
13046
|
+
|
|
13047
|
+
- Your language is ${block(trimmedContent)}
|
|
13048
|
+
`);
|
|
13023
13049
|
return this.appendToSystemMessage(requirements, languageSection, '\n\n');
|
|
13024
13050
|
}
|
|
13025
13051
|
}
|
|
@@ -17965,41 +17991,91 @@
|
|
|
17965
17991
|
context.fill();
|
|
17966
17992
|
context.restore();
|
|
17967
17993
|
}
|
|
17994
|
+
/**
|
|
17995
|
+
* Number of latitude segments used by the single blobby octopus mesh.
|
|
17996
|
+
*
|
|
17997
|
+
* @private helper of `octopus3d2AvatarVisual`
|
|
17998
|
+
*/
|
|
17999
|
+
const LATITUDE_PATCH_COUNT$1 = 12;
|
|
18000
|
+
/**
|
|
18001
|
+
* Number of longitude segments used by the single blobby octopus mesh.
|
|
18002
|
+
*
|
|
18003
|
+
* @private helper of `octopus3d2AvatarVisual`
|
|
18004
|
+
*/
|
|
18005
|
+
const LONGITUDE_PATCH_COUNT$1 = 24;
|
|
17968
18006
|
/**
|
|
17969
18007
|
* Resolves all visible projected patches for the single blobby octopus mesh.
|
|
17970
18008
|
*
|
|
18009
|
+
* Within a single frame, mesh corner samples and longitude-only lobe-wave values are
|
|
18010
|
+
* quantized to the patch grid and computed once each rather than re-evaluated for every
|
|
18011
|
+
* patch corner — the patch loop alone would call `sampleBlobbyOctopusSurfacePoint`
|
|
18012
|
+
* `latitudePatchCount * longitudePatchCount * 4` times without caching, even though most
|
|
18013
|
+
* corners are shared between neighboring patches.
|
|
18014
|
+
*
|
|
17971
18015
|
* @private helper of `octopus3d2AvatarVisual`
|
|
17972
18016
|
*/
|
|
17973
18017
|
function resolveVisibleBlobbyOctopusPatches(options) {
|
|
17974
18018
|
const { center, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, morphologyProfile, animationPhase, timeMs, } = options;
|
|
17975
|
-
const latitudePatchCount =
|
|
17976
|
-
const longitudePatchCount =
|
|
18019
|
+
const latitudePatchCount = LATITUDE_PATCH_COUNT$1;
|
|
18020
|
+
const longitudePatchCount = LONGITUDE_PATCH_COUNT$1;
|
|
17977
18021
|
const surfacePatches = [];
|
|
18022
|
+
const latitudeBoundaries = new Float64Array(latitudePatchCount + 1);
|
|
18023
|
+
const longitudeBoundaries = new Float64Array(longitudePatchCount + 1);
|
|
18024
|
+
for (let boundaryIndex = 0; boundaryIndex <= latitudePatchCount; boundaryIndex++) {
|
|
18025
|
+
latitudeBoundaries[boundaryIndex] = -Math.PI / 2 + (boundaryIndex / latitudePatchCount) * Math.PI;
|
|
18026
|
+
}
|
|
18027
|
+
for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
|
|
18028
|
+
longitudeBoundaries[boundaryIndex] = -Math.PI + (boundaryIndex / longitudePatchCount) * Math.PI * 2;
|
|
18029
|
+
}
|
|
18030
|
+
const cachedLobeWavesByCornerLongitude = new Float64Array(longitudePatchCount + 1);
|
|
18031
|
+
for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
|
|
18032
|
+
cachedLobeWavesByCornerLongitude[boundaryIndex] = resolveLowerLobeWave(longitudeBoundaries[boundaryIndex], morphologyProfile, animationPhase, timeMs);
|
|
18033
|
+
}
|
|
18034
|
+
const cornerCount = (latitudePatchCount + 1) * (longitudePatchCount + 1);
|
|
18035
|
+
const transformedCornerSamples = new Array(cornerCount);
|
|
18036
|
+
for (let latitudeBoundaryIndex = 0; latitudeBoundaryIndex <= latitudePatchCount; latitudeBoundaryIndex++) {
|
|
18037
|
+
const cornerLatitude = latitudeBoundaries[latitudeBoundaryIndex];
|
|
18038
|
+
for (let longitudeBoundaryIndex = 0; longitudeBoundaryIndex <= longitudePatchCount; longitudeBoundaryIndex++) {
|
|
18039
|
+
const cornerLongitude = longitudeBoundaries[longitudeBoundaryIndex];
|
|
18040
|
+
const cornerIndex = latitudeBoundaryIndex * (longitudePatchCount + 1) + longitudeBoundaryIndex;
|
|
18041
|
+
const cornerSample = sampleBlobbyOctopusSurfacePointWithLongitudeCache(options, cornerLatitude, cornerLongitude, cachedLobeWavesByCornerLongitude[longitudeBoundaryIndex]);
|
|
18042
|
+
transformedCornerSamples[cornerIndex] = transformScenePoint(cornerSample, center, rotationX, rotationY);
|
|
18043
|
+
}
|
|
18044
|
+
}
|
|
17978
18045
|
for (let latitudeIndex = 0; latitudeIndex < latitudePatchCount; latitudeIndex++) {
|
|
17979
|
-
const startLatitude =
|
|
17980
|
-
const endLatitude =
|
|
18046
|
+
const startLatitude = latitudeBoundaries[latitudeIndex];
|
|
18047
|
+
const endLatitude = latitudeBoundaries[latitudeIndex + 1];
|
|
17981
18048
|
const centerLatitude = (startLatitude + endLatitude) / 2;
|
|
17982
18049
|
const verticalProgress = (Math.sin(centerLatitude) + 1) / 2;
|
|
18050
|
+
const startCornerRowOffset = latitudeIndex * (longitudePatchCount + 1);
|
|
18051
|
+
const endCornerRowOffset = (latitudeIndex + 1) * (longitudePatchCount + 1);
|
|
17983
18052
|
for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
|
|
17984
|
-
const startLongitude =
|
|
17985
|
-
const endLongitude =
|
|
18053
|
+
const startLongitude = longitudeBoundaries[longitudeIndex];
|
|
18054
|
+
const endLongitude = longitudeBoundaries[longitudeIndex + 1];
|
|
17986
18055
|
const centerLongitude = (startLongitude + endLongitude) / 2;
|
|
17987
|
-
const
|
|
17988
|
-
|
|
17989
|
-
|
|
17990
|
-
|
|
17991
|
-
|
|
18056
|
+
const transformedCorners = [
|
|
18057
|
+
transformedCornerSamples[startCornerRowOffset + longitudeIndex],
|
|
18058
|
+
transformedCornerSamples[startCornerRowOffset + longitudeIndex + 1],
|
|
18059
|
+
transformedCornerSamples[endCornerRowOffset + longitudeIndex + 1],
|
|
18060
|
+
transformedCornerSamples[endCornerRowOffset + longitudeIndex],
|
|
17992
18061
|
];
|
|
17993
|
-
const transformedCorners = localCorners.map((localCorner) => transformScenePoint(localCorner, center, rotationX, rotationY));
|
|
17994
18062
|
const surfaceNormal = normalizeVector3(crossProduct3D(subtractPoint3D(transformedCorners[1], transformedCorners[0]), subtractPoint3D(transformedCorners[2], transformedCorners[0])));
|
|
17995
18063
|
if (surfaceNormal.z <= 0.01) {
|
|
17996
18064
|
continue;
|
|
17997
18065
|
}
|
|
17998
|
-
const projectedCorners =
|
|
18066
|
+
const projectedCorners = [
|
|
18067
|
+
projectScenePoint(transformedCorners[0], size, sceneCenterX, sceneCenterY),
|
|
18068
|
+
projectScenePoint(transformedCorners[1], size, sceneCenterX, sceneCenterY),
|
|
18069
|
+
projectScenePoint(transformedCorners[2], size, sceneCenterX, sceneCenterY),
|
|
18070
|
+
projectScenePoint(transformedCorners[3], size, sceneCenterX, sceneCenterY),
|
|
18071
|
+
];
|
|
17999
18072
|
surfacePatches.push({
|
|
18000
18073
|
corners: projectedCorners,
|
|
18001
|
-
averageDepth: transformedCorners.
|
|
18002
|
-
transformedCorners.
|
|
18074
|
+
averageDepth: (transformedCorners[0].z +
|
|
18075
|
+
transformedCorners[1].z +
|
|
18076
|
+
transformedCorners[2].z +
|
|
18077
|
+
transformedCorners[3].z) /
|
|
18078
|
+
4,
|
|
18003
18079
|
lightIntensity: clampNumber$1(dotProduct3D(surfaceNormal, LIGHT_DIRECTION$1), -1, 1),
|
|
18004
18080
|
fillStyle: resolveBlobbySurfacePatchFillStyle(palette, verticalProgress, Math.max(0, Math.cos(centerLongitude)), resolveLowerLobeWave(centerLongitude, morphologyProfile, animationPhase, timeMs)),
|
|
18005
18081
|
outlineColor: verticalProgress < 0.58 ? `${palette.highlight}73` : `${palette.shadow}8a`,
|
|
@@ -18017,12 +18093,21 @@
|
|
|
18017
18093
|
* @private helper of `octopus3d2AvatarVisual`
|
|
18018
18094
|
*/
|
|
18019
18095
|
function sampleBlobbyOctopusSurfacePoint(options, latitude, longitude) {
|
|
18096
|
+
const { morphologyProfile, animationPhase, timeMs } = options;
|
|
18097
|
+
return sampleBlobbyOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, resolveLowerLobeWave(longitude, morphologyProfile, animationPhase, timeMs));
|
|
18098
|
+
}
|
|
18099
|
+
/**
|
|
18100
|
+
* Samples one point on the continuous Octopus 3D 2 surface using a precomputed lower-lobe wave
|
|
18101
|
+
* to skip the per-call trig evaluation for `latitudePatchCount + 1` longitude-shared corners.
|
|
18102
|
+
*
|
|
18103
|
+
* @private helper of `octopus3d2AvatarVisual`
|
|
18104
|
+
*/
|
|
18105
|
+
function sampleBlobbyOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, lowerLobeWave) {
|
|
18020
18106
|
const { radiusX, radiusY, radiusZ, morphologyProfile, timeMs, animationPhase } = options;
|
|
18021
18107
|
const cosineLatitude = Math.max(0, Math.cos(latitude));
|
|
18022
18108
|
const verticalProgress = (Math.sin(latitude) + 1) / 2;
|
|
18023
18109
|
const upperBlend = Math.pow(1 - verticalProgress, 1.2);
|
|
18024
18110
|
const lowerBlend = Math.pow(verticalProgress, 1.42);
|
|
18025
|
-
const lowerLobeWave = resolveLowerLobeWave(longitude, morphologyProfile, animationPhase, timeMs);
|
|
18026
18111
|
const skirtEnvelope = Math.pow(cosineLatitude, 0.5) * lowerBlend;
|
|
18027
18112
|
const horizontalScale = 1.02 +
|
|
18028
18113
|
skirtEnvelope * (0.34 + (morphologyProfile.tentacles.rootSpreadScale - 1) * 0.22 + lowerLobeWave * 0.22) -
|
|
@@ -18319,45 +18404,102 @@
|
|
|
18319
18404
|
context.fill();
|
|
18320
18405
|
context.restore();
|
|
18321
18406
|
}
|
|
18407
|
+
/**
|
|
18408
|
+
* Number of latitude segments used by the continuous Octopus 3D 3 mesh.
|
|
18409
|
+
*
|
|
18410
|
+
* @private helper of `octopus3d3AvatarVisual`
|
|
18411
|
+
*/
|
|
18412
|
+
const LATITUDE_PATCH_COUNT = 16;
|
|
18413
|
+
/**
|
|
18414
|
+
* Number of longitude segments used by the continuous Octopus 3D 3 mesh.
|
|
18415
|
+
*
|
|
18416
|
+
* @private helper of `octopus3d3AvatarVisual`
|
|
18417
|
+
*/
|
|
18418
|
+
const LONGITUDE_PATCH_COUNT = 40;
|
|
18322
18419
|
/**
|
|
18323
18420
|
* Resolves visible projected patches for the continuous octopus mesh.
|
|
18324
18421
|
*
|
|
18422
|
+
* Within a single frame, mesh corner samples and longitude-only computations (tentacle
|
|
18423
|
+
* influence and lobe wave) are quantized to the patch grid and computed once each rather
|
|
18424
|
+
* than re-evaluated for every patch corner — the patch loop alone calls `sampleContinuousOctopusSurfacePoint`
|
|
18425
|
+
* for `latitudePatchCount * longitudePatchCount * 4` corners without caching, and each call
|
|
18426
|
+
* triggers an inner 8-iteration `Math.exp` loop, which dominates the per-frame cost.
|
|
18427
|
+
*
|
|
18325
18428
|
* @private helper of `octopus3d3AvatarVisual`
|
|
18326
18429
|
*/
|
|
18327
18430
|
function resolveVisibleContinuousOctopusPatches(options) {
|
|
18328
18431
|
const { center, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette } = options;
|
|
18329
|
-
const latitudePatchCount =
|
|
18330
|
-
const longitudePatchCount =
|
|
18432
|
+
const latitudePatchCount = LATITUDE_PATCH_COUNT;
|
|
18433
|
+
const longitudePatchCount = LONGITUDE_PATCH_COUNT;
|
|
18331
18434
|
const surfacePatches = [];
|
|
18435
|
+
const latitudeBoundaries = new Float64Array(latitudePatchCount + 1);
|
|
18436
|
+
const longitudeBoundaries = new Float64Array(longitudePatchCount + 1);
|
|
18437
|
+
for (let boundaryIndex = 0; boundaryIndex <= latitudePatchCount; boundaryIndex++) {
|
|
18438
|
+
latitudeBoundaries[boundaryIndex] = -Math.PI / 2 + (boundaryIndex / latitudePatchCount) * Math.PI;
|
|
18439
|
+
}
|
|
18440
|
+
for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
|
|
18441
|
+
longitudeBoundaries[boundaryIndex] = -Math.PI + (boundaryIndex / longitudePatchCount) * Math.PI * 2;
|
|
18442
|
+
}
|
|
18443
|
+
const cachedTentacleInfluencesByCornerLongitude = new Array(longitudePatchCount + 1);
|
|
18444
|
+
const cachedLobeWavesByCornerLongitude = new Float64Array(longitudePatchCount + 1);
|
|
18445
|
+
const cachedTentacleInfluencesByPatchCenterLongitude = new Array(longitudePatchCount);
|
|
18446
|
+
const cachedLobeWavesByPatchCenterLongitude = new Float64Array(longitudePatchCount);
|
|
18447
|
+
const cachedCosByPatchCenterLongitude = new Float64Array(longitudePatchCount);
|
|
18448
|
+
for (let boundaryIndex = 0; boundaryIndex <= longitudePatchCount; boundaryIndex++) {
|
|
18449
|
+
const cornerLongitude = longitudeBoundaries[boundaryIndex];
|
|
18450
|
+
cachedTentacleInfluencesByCornerLongitude[boundaryIndex] = resolveContinuousTentacleInfluence(options, cornerLongitude);
|
|
18451
|
+
cachedLobeWavesByCornerLongitude[boundaryIndex] = resolveContinuousLobeWave(options, cornerLongitude);
|
|
18452
|
+
}
|
|
18453
|
+
for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
|
|
18454
|
+
const patchCenterLongitude = (longitudeBoundaries[longitudeIndex] + longitudeBoundaries[longitudeIndex + 1]) / 2;
|
|
18455
|
+
cachedTentacleInfluencesByPatchCenterLongitude[longitudeIndex] = resolveContinuousTentacleInfluence(options, patchCenterLongitude);
|
|
18456
|
+
cachedLobeWavesByPatchCenterLongitude[longitudeIndex] = resolveContinuousLobeWave(options, patchCenterLongitude);
|
|
18457
|
+
cachedCosByPatchCenterLongitude[longitudeIndex] = Math.max(0, Math.cos(patchCenterLongitude));
|
|
18458
|
+
}
|
|
18459
|
+
const cornerCount = (latitudePatchCount + 1) * (longitudePatchCount + 1);
|
|
18460
|
+
const transformedCornerSamples = new Array(cornerCount);
|
|
18461
|
+
for (let latitudeBoundaryIndex = 0; latitudeBoundaryIndex <= latitudePatchCount; latitudeBoundaryIndex++) {
|
|
18462
|
+
const cornerLatitude = latitudeBoundaries[latitudeBoundaryIndex];
|
|
18463
|
+
for (let longitudeBoundaryIndex = 0; longitudeBoundaryIndex <= longitudePatchCount; longitudeBoundaryIndex++) {
|
|
18464
|
+
const cornerLongitude = longitudeBoundaries[longitudeBoundaryIndex];
|
|
18465
|
+
const cornerIndex = latitudeBoundaryIndex * (longitudePatchCount + 1) + longitudeBoundaryIndex;
|
|
18466
|
+
const cornerSample = sampleContinuousOctopusSurfacePointWithLongitudeCache(options, cornerLatitude, cornerLongitude, cachedTentacleInfluencesByCornerLongitude[longitudeBoundaryIndex], cachedLobeWavesByCornerLongitude[longitudeBoundaryIndex]);
|
|
18467
|
+
transformedCornerSamples[cornerIndex] = transformScenePoint(cornerSample, center, rotationX, rotationY);
|
|
18468
|
+
}
|
|
18469
|
+
}
|
|
18332
18470
|
for (let latitudeIndex = 0; latitudeIndex < latitudePatchCount; latitudeIndex++) {
|
|
18333
|
-
const startLatitude =
|
|
18334
|
-
const endLatitude =
|
|
18471
|
+
const startLatitude = latitudeBoundaries[latitudeIndex];
|
|
18472
|
+
const endLatitude = latitudeBoundaries[latitudeIndex + 1];
|
|
18335
18473
|
const centerLatitude = (startLatitude + endLatitude) / 2;
|
|
18336
18474
|
const verticalProgress = (Math.sin(centerLatitude) + 1) / 2;
|
|
18475
|
+
const startCornerRowOffset = latitudeIndex * (longitudePatchCount + 1);
|
|
18476
|
+
const endCornerRowOffset = (latitudeIndex + 1) * (longitudePatchCount + 1);
|
|
18337
18477
|
for (let longitudeIndex = 0; longitudeIndex < longitudePatchCount; longitudeIndex++) {
|
|
18338
|
-
const
|
|
18339
|
-
|
|
18340
|
-
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
sampleContinuousOctopusSurfacePoint(options, startLatitude, endLongitude),
|
|
18344
|
-
sampleContinuousOctopusSurfacePoint(options, endLatitude, endLongitude),
|
|
18345
|
-
sampleContinuousOctopusSurfacePoint(options, endLatitude, startLongitude),
|
|
18478
|
+
const transformedCorners = [
|
|
18479
|
+
transformedCornerSamples[startCornerRowOffset + longitudeIndex],
|
|
18480
|
+
transformedCornerSamples[startCornerRowOffset + longitudeIndex + 1],
|
|
18481
|
+
transformedCornerSamples[endCornerRowOffset + longitudeIndex + 1],
|
|
18482
|
+
transformedCornerSamples[endCornerRowOffset + longitudeIndex],
|
|
18346
18483
|
];
|
|
18347
|
-
const transformedCorners = localCorners.map((localCorner) => transformScenePoint(localCorner, center, rotationX, rotationY));
|
|
18348
18484
|
const surfaceNormal = normalizeVector3(crossProduct3D(subtractPoint3D(transformedCorners[1], transformedCorners[0]), subtractPoint3D(transformedCorners[2], transformedCorners[0])));
|
|
18349
18485
|
if (surfaceNormal.z <= 0.008) {
|
|
18350
18486
|
continue;
|
|
18351
18487
|
}
|
|
18352
|
-
const projectedCorners =
|
|
18353
|
-
|
|
18354
|
-
|
|
18488
|
+
const projectedCorners = [
|
|
18489
|
+
projectScenePoint(transformedCorners[0], size, sceneCenterX, sceneCenterY),
|
|
18490
|
+
projectScenePoint(transformedCorners[1], size, sceneCenterX, sceneCenterY),
|
|
18491
|
+
projectScenePoint(transformedCorners[2], size, sceneCenterX, sceneCenterY),
|
|
18492
|
+
projectScenePoint(transformedCorners[3], size, sceneCenterX, sceneCenterY),
|
|
18493
|
+
];
|
|
18355
18494
|
surfacePatches.push({
|
|
18356
18495
|
corners: projectedCorners,
|
|
18357
|
-
averageDepth: transformedCorners.
|
|
18358
|
-
transformedCorners.
|
|
18496
|
+
averageDepth: (transformedCorners[0].z +
|
|
18497
|
+
transformedCorners[1].z +
|
|
18498
|
+
transformedCorners[2].z +
|
|
18499
|
+
transformedCorners[3].z) /
|
|
18500
|
+
4,
|
|
18359
18501
|
lightIntensity: clampNumber$1(dotProduct3D(surfaceNormal, LIGHT_DIRECTION), -1, 1),
|
|
18360
|
-
fillStyle: resolveContinuousSurfacePatchFillStyle(palette, verticalProgress,
|
|
18502
|
+
fillStyle: resolveContinuousSurfacePatchFillStyle(palette, verticalProgress, cachedCosByPatchCenterLongitude[longitudeIndex], cachedTentacleInfluencesByPatchCenterLongitude[longitudeIndex].core, cachedLobeWavesByPatchCenterLongitude[longitudeIndex]),
|
|
18361
18503
|
outlineColor: verticalProgress < 0.54 ? `${palette.highlight}69` : `${palette.shadow}78`,
|
|
18362
18504
|
});
|
|
18363
18505
|
}
|
|
@@ -18373,16 +18515,27 @@
|
|
|
18373
18515
|
* @private helper of `octopus3d3AvatarVisual`
|
|
18374
18516
|
*/
|
|
18375
18517
|
function sampleContinuousOctopusSurfacePoint(options, latitude, longitude) {
|
|
18518
|
+
return sampleContinuousOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, resolveContinuousTentacleInfluence(options, longitude), resolveContinuousLobeWave(options, longitude));
|
|
18519
|
+
}
|
|
18520
|
+
/**
|
|
18521
|
+
* Samples one point on the continuous Octopus 3D 3 surface using precomputed longitude-only
|
|
18522
|
+
* values to skip the per-call `Math.exp` tentacle-influence loop and the lobe-wave trig call.
|
|
18523
|
+
*
|
|
18524
|
+
* The patch loop quantizes the mesh into a fixed `(latitudePatchCount + 1) * (longitudePatchCount + 1)`
|
|
18525
|
+
* corner grid, so the same longitude is reused across every latitude row and each
|
|
18526
|
+
* tentacle/lobe value can be computed once per frame instead of `latitudePatchCount * 4` times.
|
|
18527
|
+
*
|
|
18528
|
+
* @private helper of `octopus3d3AvatarVisual`
|
|
18529
|
+
*/
|
|
18530
|
+
function sampleContinuousOctopusSurfacePointWithLongitudeCache(options, latitude, longitude, tentacleInfluence, lowerLobeWave) {
|
|
18376
18531
|
const { radiusX, radiusY, radiusZ, morphologyProfile, timeMs, animationPhase } = options;
|
|
18377
18532
|
const cosineLatitude = Math.max(0, Math.cos(latitude));
|
|
18378
18533
|
const verticalProgress = (Math.sin(latitude) + 1) / 2;
|
|
18379
18534
|
const upperBlend = Math.pow(1 - verticalProgress, 1.28);
|
|
18380
18535
|
const lowerBlend = smoothStep(0.38, 1, verticalProgress);
|
|
18381
18536
|
const tipBlend = smoothStep(0.68, 1, verticalProgress);
|
|
18382
|
-
const tentacleInfluence = resolveContinuousTentacleInfluence(options, longitude);
|
|
18383
18537
|
const centerPull = resolveSignedAngularDistance(longitude, tentacleInfluence.centerLongitude);
|
|
18384
18538
|
const effectiveLongitude = longitude + centerPull * lowerBlend * tentacleInfluence.core * (0.24 + tipBlend * 0.2);
|
|
18385
|
-
const lowerLobeWave = resolveContinuousLobeWave(options, longitude);
|
|
18386
18539
|
const mantleRipple = Math.sin(longitude * morphologyProfile.body.lobeCount +
|
|
18387
18540
|
animationPhase * 0.6 +
|
|
18388
18541
|
timeMs / (1750 + morphologyProfile.body.lobeCount * 30)) *
|
|
@@ -21713,7 +21866,15 @@
|
|
|
21713
21866
|
* Builds the teammate request text, optionally including context.
|
|
21714
21867
|
*/
|
|
21715
21868
|
function buildTeammateRequest(message, context) {
|
|
21716
|
-
|
|
21869
|
+
if (!context) {
|
|
21870
|
+
return message;
|
|
21871
|
+
}
|
|
21872
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
21873
|
+
${block(message)}
|
|
21874
|
+
|
|
21875
|
+
Context:
|
|
21876
|
+
${block(context)}
|
|
21877
|
+
`);
|
|
21717
21878
|
}
|
|
21718
21879
|
/**
|
|
21719
21880
|
* Builds a minimal chat prompt for teammate calls.
|
|
@@ -25539,7 +25700,11 @@
|
|
|
25539
25700
|
const lineRangedContent = applyOptionalLineRange(decodedContent, args.startLine, args.endLine);
|
|
25540
25701
|
const wasCharacterTruncated = lineRangedContent.length > MAX_PROJECT_FILE_CONTENT_CHARACTERS;
|
|
25541
25702
|
const contentToReturn = wasCharacterTruncated
|
|
25542
|
-
?
|
|
25703
|
+
? _spaceTrim.spaceTrim((block) => `
|
|
25704
|
+
${block(lineRangedContent.slice(0, MAX_PROJECT_FILE_CONTENT_CHARACTERS))}
|
|
25705
|
+
|
|
25706
|
+
[...truncated...]
|
|
25707
|
+
`)
|
|
25543
25708
|
: lineRangedContent;
|
|
25544
25709
|
const wasTruncated = decoded.isTruncated || wasCharacterTruncated;
|
|
25545
25710
|
if (wasCharacterTruncated) {
|
|
@@ -29075,11 +29240,19 @@
|
|
|
29075
29240
|
try {
|
|
29076
29241
|
const json = JSON.parse(content);
|
|
29077
29242
|
const formattedJson = JSON.stringify(json, null, 4);
|
|
29078
|
-
return
|
|
29243
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
29244
|
+
\`\`\`json
|
|
29245
|
+
${block(formattedJson)}
|
|
29246
|
+
\`\`\`
|
|
29247
|
+
`);
|
|
29079
29248
|
}
|
|
29080
29249
|
catch (error) {
|
|
29081
29250
|
// If JSON is invalid, still import it but maybe not as pretty JSON
|
|
29082
|
-
return
|
|
29251
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
29252
|
+
\`\`\`json
|
|
29253
|
+
${block(content)}
|
|
29254
|
+
\`\`\`
|
|
29255
|
+
`);
|
|
29083
29256
|
}
|
|
29084
29257
|
},
|
|
29085
29258
|
};
|
|
@@ -29103,7 +29276,11 @@
|
|
|
29103
29276
|
import(content, mimeType) {
|
|
29104
29277
|
const extension = mimeTypeToExtension(mimeType);
|
|
29105
29278
|
const codeBlockType = extension || 'txt';
|
|
29106
|
-
return
|
|
29279
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
29280
|
+
\`\`\`${codeBlockType}
|
|
29281
|
+
${block(content)}
|
|
29282
|
+
\`\`\`
|
|
29283
|
+
`);
|
|
29107
29284
|
},
|
|
29108
29285
|
};
|
|
29109
29286
|
|
|
@@ -29350,11 +29527,19 @@
|
|
|
29350
29527
|
const examples = [];
|
|
29351
29528
|
const initialMessage = (_a = parseResult.commitments.find((commitment) => commitment.type === 'INITIAL MESSAGE')) === null || _a === void 0 ? void 0 : _a.content;
|
|
29352
29529
|
if (initialMessage) {
|
|
29353
|
-
examples.push(
|
|
29530
|
+
examples.push(_spaceTrim.spaceTrim((block) => `
|
|
29531
|
+
**Agent:**
|
|
29532
|
+
${block(initialMessage)}
|
|
29533
|
+
`));
|
|
29354
29534
|
}
|
|
29355
29535
|
if (samples && samples.length > 0) {
|
|
29356
29536
|
for (const sample of samples) {
|
|
29357
|
-
examples.push(
|
|
29537
|
+
examples.push(_spaceTrim.spaceTrim((block) => `
|
|
29538
|
+
**User:** ${block(String(sample.question))}
|
|
29539
|
+
|
|
29540
|
+
**Agent:**
|
|
29541
|
+
${block(sample.answer)}
|
|
29542
|
+
`));
|
|
29358
29543
|
}
|
|
29359
29544
|
}
|
|
29360
29545
|
return examples;
|
|
@@ -30541,10 +30726,14 @@
|
|
|
30541
30726
|
* Formats prepared model requirements for a text-only CLI harness prompt.
|
|
30542
30727
|
*/
|
|
30543
30728
|
function formatAgentModelRequirementsForRunner(modelRequirements) {
|
|
30729
|
+
const promptSuffix = modelRequirements.promptSuffix.trim();
|
|
30544
30730
|
return [
|
|
30545
30731
|
modelRequirements.systemMessage.trim(),
|
|
30546
|
-
|
|
30547
|
-
?
|
|
30732
|
+
promptSuffix
|
|
30733
|
+
? _spaceTrim.spaceTrim((block) => `
|
|
30734
|
+
## Prompt suffix
|
|
30735
|
+
${block(promptSuffix)}
|
|
30736
|
+
`)
|
|
30548
30737
|
: '',
|
|
30549
30738
|
]
|
|
30550
30739
|
.filter(Boolean)
|
|
@@ -42352,7 +42541,12 @@
|
|
|
42352
42541
|
* @private internal function of `$registeredLlmToolsMessage`
|
|
42353
42542
|
*/
|
|
42354
42543
|
function createUsedEnvMessage() {
|
|
42355
|
-
return $usedEnvFilename === null
|
|
42544
|
+
return $usedEnvFilename === null
|
|
42545
|
+
? `Unknown \`.env\` file`
|
|
42546
|
+
: _spaceTrim.spaceTrim(`
|
|
42547
|
+
Used \`.env\` file:
|
|
42548
|
+
${$usedEnvFilename}
|
|
42549
|
+
`);
|
|
42356
42550
|
}
|
|
42357
42551
|
// TODO: [®] DRY Register logic
|
|
42358
42552
|
// TODO: [🧠][⚛] Maybe pass env as argument
|
|
@@ -46162,7 +46356,11 @@
|
|
|
46162
46356
|
};
|
|
46163
46357
|
}
|
|
46164
46358
|
return {
|
|
46165
|
-
content:
|
|
46359
|
+
content: _spaceTrim.spaceTrim((block) => `
|
|
46360
|
+
${block(content.slice(0, Math.max(0, maxCharacters)))}
|
|
46361
|
+
|
|
46362
|
+
[...truncated...]
|
|
46363
|
+
`),
|
|
46166
46364
|
isTruncated: true,
|
|
46167
46365
|
};
|
|
46168
46366
|
}
|