@promptbook/cli 0.112.0-117 → 0.112.0-118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatSidebarDefault.tsx +5 -6
- package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +17 -7
- package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +17 -7
- package/apps/agents-server/src/utils/userChat/createImmediateUserChatAnswerModelRequirements.ts +11 -0
- package/apps/agents-server/src/utils/userChat/listUserChats.ts +5 -7
- package/esm/index.es.js +417 -64
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/parseDuration.d.ts +19 -0
- package/esm/src/_packages/node.index.d.ts +10 -0
- package/esm/src/book-3.0/BookNodeAgentSource.d.ts +1 -1
- package/esm/src/book-3.0/CliAgent.d.ts +7 -2
- package/esm/src/book-3.0/cliAgentEnv.d.ts +33 -0
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +2 -18
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/_packages/node.index.ts +10 -0
- package/src/avatars/avatarAnimationScheduler.ts +33 -2
- package/src/avatars/visuals/fractalAvatarVisual.ts +5 -4
- package/src/avatars/visuals/minecraft2AvatarVisual.ts +16 -11
- package/src/avatars/visuals/minecraftAvatarVisual.ts +21 -7
- package/src/avatars/visuals/octopus3d2AvatarVisual.ts +69 -17
- package/src/avatars/visuals/octopus3d3AvatarVisual.ts +81 -18
- package/src/avatars/visuals/octopus3dAvatarVisual.ts +69 -17
- package/src/book-3.0/Book.ts +3 -1
- package/src/book-3.0/BookNodeAgentSource.ts +2 -2
- package/src/book-3.0/CliAgent.ts +84 -6
- package/src/book-3.0/cliAgentEnv.ts +46 -0
- package/src/cli/cli-commands/coder/run.ts +28 -3
- package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +9 -29
- package/src/other/templates/getTemplatesPipelineCollection.ts +713 -735
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +417 -64
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/parseDuration.d.ts +19 -0
- package/umd/src/_packages/node.index.d.ts +10 -0
- package/umd/src/book-3.0/BookNodeAgentSource.d.ts +1 -1
- package/umd/src/book-3.0/CliAgent.d.ts +7 -2
- package/umd/src/book-3.0/cliAgentEnv.d.ts +33 -0
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +2 -18
- package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
* @generated
|
|
64
64
|
* @see https://github.com/webgptorg/promptbook
|
|
65
65
|
*/
|
|
66
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
66
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-118';
|
|
67
67
|
/**
|
|
68
68
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
69
69
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1745,12 +1745,13 @@
|
|
|
1745
1745
|
}
|
|
1746
1746
|
// Note: [🟡] Code for CLI command [run](src/cli/cli-commands/coder/run.ts) should never be published outside of `@promptbook/cli`
|
|
1747
1747
|
|
|
1748
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
1748
1749
|
/**
|
|
1749
|
-
*
|
|
1750
|
+
* All CLI harness names supported by `CliAgent` and `ptbk agent exec`.
|
|
1750
1751
|
*
|
|
1751
|
-
* @
|
|
1752
|
+
* @public exported from `@promptbook/node`
|
|
1752
1753
|
*/
|
|
1753
|
-
const
|
|
1754
|
+
const CLI_AGENT_HARNESS_NAMES = [
|
|
1754
1755
|
'openai-codex',
|
|
1755
1756
|
'github-copilot',
|
|
1756
1757
|
'cline',
|
|
@@ -1759,23 +1760,33 @@
|
|
|
1759
1760
|
'gemini',
|
|
1760
1761
|
];
|
|
1761
1762
|
/**
|
|
1762
|
-
* Environment variable used as the default runner identifier when `--harness` is omitted
|
|
1763
|
+
* Environment variable used as the default runner identifier when `--harness` is omitted or not set in `CliAgent`.
|
|
1763
1764
|
*
|
|
1764
|
-
*
|
|
1765
|
+
* Set this to one of the harness names (`openai-codex`, `github-copilot`, `cline`, `claude-code`, `opencode`, `gemini`)
|
|
1766
|
+
* so that `CliAgent` and `ptbk agent exec` can run without an explicit `harness` option.
|
|
1767
|
+
*
|
|
1768
|
+
* @public exported from `@promptbook/node`
|
|
1765
1769
|
*/
|
|
1766
1770
|
const PTBK_HARNESS_ENV = 'PTBK_HARNESS';
|
|
1767
1771
|
/**
|
|
1768
|
-
* Environment variable used as the default runner model when `--model` is omitted
|
|
1772
|
+
* Environment variable used as the default runner model when `--model` is omitted or not set in `CliAgent`.
|
|
1769
1773
|
*
|
|
1770
|
-
* @
|
|
1774
|
+
* @public exported from `@promptbook/node`
|
|
1771
1775
|
*/
|
|
1772
1776
|
const PTBK_MODEL_ENV = 'PTBK_MODEL';
|
|
1773
1777
|
/**
|
|
1774
|
-
* Environment variable used as the default
|
|
1778
|
+
* Environment variable used as the default thinking level when `--thinking-level` is omitted or not set in `CliAgent`.
|
|
1775
1779
|
*
|
|
1776
|
-
* @
|
|
1780
|
+
* @public exported from `@promptbook/node`
|
|
1777
1781
|
*/
|
|
1778
1782
|
const PTBK_THINKING_LEVEL_ENV = 'PTBK_THINKING_LEVEL';
|
|
1783
|
+
|
|
1784
|
+
/**
|
|
1785
|
+
* Runner identifiers supported by Promptbook CLI agent orchestration commands.
|
|
1786
|
+
*
|
|
1787
|
+
* @private internal utility of `promptbookCli`
|
|
1788
|
+
*/
|
|
1789
|
+
const PROMPT_RUNNER_HARNESS_NAMES = CLI_AGENT_HARNESS_NAMES;
|
|
1779
1790
|
/**
|
|
1780
1791
|
* Description block shared by runner-backed CLI commands.
|
|
1781
1792
|
*
|
|
@@ -5129,6 +5140,7 @@
|
|
|
5129
5140
|
noUi: options.noUi,
|
|
5130
5141
|
thinkingLevel: options.thinkingLevel,
|
|
5131
5142
|
waitForUser: false,
|
|
5143
|
+
waitBetweenPrompts: 0,
|
|
5132
5144
|
noCommit: options.noCommit,
|
|
5133
5145
|
ignoreGitChanges: options.ignoreGitChanges,
|
|
5134
5146
|
normalizeLineEndings: options.normalizeLineEndings,
|
|
@@ -10821,21 +10833,22 @@
|
|
|
10821
10833
|
* @private helper of `fractalAvatarVisual`
|
|
10822
10834
|
*/
|
|
10823
10835
|
function drawDragonCurveLayer(context, points, options) {
|
|
10824
|
-
const {
|
|
10836
|
+
const { primaryColor, secondaryColor, tertiaryColor, shadowColor, strokeWidth, timeMs, layerIndex } = options;
|
|
10825
10837
|
const firstPoint = points[0];
|
|
10826
10838
|
const lastPoint = points[points.length - 1];
|
|
10827
10839
|
const ribbonGradient = context.createLinearGradient(firstPoint.x, firstPoint.y, lastPoint.x, lastPoint.y);
|
|
10828
10840
|
ribbonGradient.addColorStop(0, `${primaryColor}f2`);
|
|
10829
10841
|
ribbonGradient.addColorStop(0.5, `${secondaryColor}e6`);
|
|
10830
10842
|
ribbonGradient.addColorStop(1, `${tertiaryColor}f2`);
|
|
10843
|
+
// Approximate the blurred shadow stroke with a wider semi-transparent stroke instead of
|
|
10844
|
+
// context.filter blur, which triggers a costly software rasterization pass every frame.
|
|
10831
10845
|
context.save();
|
|
10832
10846
|
context.beginPath();
|
|
10833
10847
|
tracePolyline(context, points);
|
|
10834
|
-
context.strokeStyle = `${shadowColor}
|
|
10835
|
-
context.lineWidth = strokeWidth *
|
|
10848
|
+
context.strokeStyle = `${shadowColor}48`;
|
|
10849
|
+
context.lineWidth = strokeWidth * 4.5;
|
|
10836
10850
|
context.lineJoin = 'round';
|
|
10837
10851
|
context.lineCap = 'round';
|
|
10838
|
-
context.filter = `blur(${size * 0.022}px)`;
|
|
10839
10852
|
context.stroke();
|
|
10840
10853
|
context.restore();
|
|
10841
10854
|
context.beginPath();
|
|
@@ -11419,11 +11432,23 @@
|
|
|
11419
11432
|
* @private helper of `minecraft2AvatarVisual`
|
|
11420
11433
|
*/
|
|
11421
11434
|
function drawMinecraftShadow(context, size, palette, interaction, timeMs) {
|
|
11435
|
+
const cx = size * 0.5 + interaction.gazeX * size * 0.03;
|
|
11436
|
+
const cy = size * 0.85 + Math.sin(timeMs / 880) * size * 0.01;
|
|
11437
|
+
const rx = size * (0.16 + interaction.intensity * 0.015);
|
|
11438
|
+
const ry = size * 0.055;
|
|
11439
|
+
// Radial gradient approximates the blurry ellipse shadow without context.filter blur.
|
|
11422
11440
|
context.save();
|
|
11423
|
-
context.
|
|
11424
|
-
context.
|
|
11441
|
+
context.translate(cx, cy);
|
|
11442
|
+
context.scale(1, ry / rx);
|
|
11443
|
+
const blurRadius = rx * 1.4;
|
|
11444
|
+
const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
|
|
11445
|
+
shadowGradient.addColorStop(0, `${palette.shadow}7a`);
|
|
11446
|
+
shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
|
|
11447
|
+
shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
|
|
11448
|
+
shadowGradient.addColorStop(1, `${palette.shadow}00`);
|
|
11449
|
+
context.fillStyle = shadowGradient;
|
|
11425
11450
|
context.beginPath();
|
|
11426
|
-
context.
|
|
11451
|
+
context.arc(0, 0, blurRadius, 0, Math.PI * 2);
|
|
11427
11452
|
context.fill();
|
|
11428
11453
|
context.restore();
|
|
11429
11454
|
}
|
|
@@ -11647,13 +11672,27 @@
|
|
|
11647
11672
|
spotlight.addColorStop(1, `${palette.highlight}00`);
|
|
11648
11673
|
context.fillStyle = spotlight;
|
|
11649
11674
|
context.fillRect(0, 0, size, size);
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11675
|
+
{
|
|
11676
|
+
// Radial gradient approximates the blurry ellipse shadow without context.filter blur.
|
|
11677
|
+
const cx = size * 0.5;
|
|
11678
|
+
const cy = size * 0.86;
|
|
11679
|
+
const rx = size * 0.2;
|
|
11680
|
+
const ry = size * 0.06;
|
|
11681
|
+
const blurRadius = rx * 1.4;
|
|
11682
|
+
const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
|
|
11683
|
+
shadowGradient.addColorStop(0, 'rgba(0,0,0,0.28)');
|
|
11684
|
+
shadowGradient.addColorStop(0.45, 'rgba(0,0,0,0.14)');
|
|
11685
|
+
shadowGradient.addColorStop(0.8, 'rgba(0,0,0,0.05)');
|
|
11686
|
+
shadowGradient.addColorStop(1, 'rgba(0,0,0,0)');
|
|
11687
|
+
context.save();
|
|
11688
|
+
context.translate(cx, cy);
|
|
11689
|
+
context.scale(1, ry / rx);
|
|
11690
|
+
context.fillStyle = shadowGradient;
|
|
11691
|
+
context.beginPath();
|
|
11692
|
+
context.arc(0, 0, blurRadius, 0, Math.PI * 2);
|
|
11693
|
+
context.fill();
|
|
11694
|
+
context.restore();
|
|
11695
|
+
}
|
|
11657
11696
|
drawVoxelCuboid(context, {
|
|
11658
11697
|
x: bodyX,
|
|
11659
11698
|
y: bodyY,
|
|
@@ -12705,6 +12744,35 @@
|
|
|
12705
12744
|
y: -0.62,
|
|
12706
12745
|
z: 0.94,
|
|
12707
12746
|
});
|
|
12747
|
+
/**
|
|
12748
|
+
* Cache keyed by the `createRandom` factory reference (stable per mounted `<Avatar/>`).
|
|
12749
|
+
*
|
|
12750
|
+
* @private helper of `octopus3dAvatarVisual`
|
|
12751
|
+
*/
|
|
12752
|
+
const octopus3dStableStateCache = new WeakMap();
|
|
12753
|
+
/**
|
|
12754
|
+
* Returns the stable per-avatar state, computing it on first access and caching for subsequent frames.
|
|
12755
|
+
*
|
|
12756
|
+
* @private helper of `octopus3dAvatarVisual`
|
|
12757
|
+
*/
|
|
12758
|
+
function getOctopus3dStableState(createRandom) {
|
|
12759
|
+
const cached = octopus3dStableStateCache.get(createRandom);
|
|
12760
|
+
if (cached !== undefined) {
|
|
12761
|
+
return cached;
|
|
12762
|
+
}
|
|
12763
|
+
const animationRandom = createRandom('octopus3d-animation-profile');
|
|
12764
|
+
const eyeRandom = createRandom('octopus3d-eye-profile');
|
|
12765
|
+
const leftEyePhaseOffset = eyeRandom() * 0.6;
|
|
12766
|
+
const rightEyePhaseOffset = eyeRandom() * 0.6;
|
|
12767
|
+
const state = {
|
|
12768
|
+
morphologyProfile: createOctopus3MorphologyProfile(createRandom),
|
|
12769
|
+
animationPhase: animationRandom() * Math.PI * 2,
|
|
12770
|
+
leftEyePhaseOffset,
|
|
12771
|
+
rightEyePhaseOffset,
|
|
12772
|
+
};
|
|
12773
|
+
octopus3dStableStateCache.set(createRandom, state);
|
|
12774
|
+
return state;
|
|
12775
|
+
}
|
|
12708
12776
|
/**
|
|
12709
12777
|
* Proper 3D Octopus visual built from projected organic meshes and tentacles.
|
|
12710
12778
|
*
|
|
@@ -12717,10 +12785,7 @@
|
|
|
12717
12785
|
isAnimated: true,
|
|
12718
12786
|
supportsPointerTracking: true,
|
|
12719
12787
|
render({ context, size, palette, createRandom, timeMs, interaction }) {
|
|
12720
|
-
const morphologyProfile =
|
|
12721
|
-
const animationRandom = createRandom('octopus3d-animation-profile');
|
|
12722
|
-
const eyeRandom = createRandom('octopus3d-eye-profile');
|
|
12723
|
-
const animationPhase = animationRandom() * Math.PI * 2;
|
|
12788
|
+
const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset } = getOctopus3dStableState(createRandom);
|
|
12724
12789
|
const sceneCenterX = size * 0.5;
|
|
12725
12790
|
const sceneCenterY = size * 0.56;
|
|
12726
12791
|
const bob = Math.sin(timeMs / 920 + animationPhase) * size * 0.014;
|
|
@@ -12817,12 +12882,12 @@
|
|
|
12817
12882
|
x: -faceEyeSpacing,
|
|
12818
12883
|
y: faceEyeYOffset,
|
|
12819
12884
|
z: resolveEllipsoidSurfaceDepth(mantleRadiusX, mantleRadiusY, mantleRadiusZ, -faceEyeSpacing, faceEyeYOffset),
|
|
12820
|
-
}, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase +
|
|
12885
|
+
}, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + leftEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
|
|
12821
12886
|
drawProjectedOrganicEye(context, {
|
|
12822
12887
|
x: faceEyeSpacing,
|
|
12823
12888
|
y: faceEyeYOffset,
|
|
12824
12889
|
z: resolveEllipsoidSurfaceDepth(mantleRadiusX, mantleRadiusY, mantleRadiusZ, faceEyeSpacing, faceEyeYOffset),
|
|
12825
|
-
}, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.7 +
|
|
12890
|
+
}, faceEyeRadiusX, faceEyeRadiusY, mantleCenter, headPitch, headYaw, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.7 + rightEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
|
|
12826
12891
|
drawProjectedOrganicMouth(context, [
|
|
12827
12892
|
{
|
|
12828
12893
|
x: -mouthHalfWidth,
|
|
@@ -12866,14 +12931,28 @@
|
|
|
12866
12931
|
/**
|
|
12867
12932
|
* Draws the soft ground shadow below the octopus.
|
|
12868
12933
|
*
|
|
12934
|
+
* Uses a scaled radial gradient instead of `context.filter = 'blur()'` to approximate the
|
|
12935
|
+
* blurry ellipse without triggering a costly software rasterization pass on every frame.
|
|
12936
|
+
*
|
|
12869
12937
|
* @private helper of `octopus3dAvatarVisual`
|
|
12870
12938
|
*/
|
|
12871
12939
|
function drawOctopus3dShadow(context, size, palette, interaction, timeMs) {
|
|
12940
|
+
const cx = size * 0.5 + interaction.gazeX * size * 0.04;
|
|
12941
|
+
const cy = size * 0.87 + Math.sin(timeMs / 920) * size * 0.008;
|
|
12942
|
+
const rx = size * (0.18 + interaction.intensity * 0.02);
|
|
12943
|
+
const ry = size * 0.06;
|
|
12872
12944
|
context.save();
|
|
12873
|
-
context.
|
|
12874
|
-
context.
|
|
12945
|
+
context.translate(cx, cy);
|
|
12946
|
+
context.scale(1, ry / rx);
|
|
12947
|
+
const blurRadius = rx * 1.4;
|
|
12948
|
+
const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
|
|
12949
|
+
shadowGradient.addColorStop(0, `${palette.shadow}7a`);
|
|
12950
|
+
shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
|
|
12951
|
+
shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
|
|
12952
|
+
shadowGradient.addColorStop(1, `${palette.shadow}00`);
|
|
12953
|
+
context.fillStyle = shadowGradient;
|
|
12875
12954
|
context.beginPath();
|
|
12876
|
-
context.
|
|
12955
|
+
context.arc(0, 0, blurRadius, 0, Math.PI * 2);
|
|
12877
12956
|
context.fill();
|
|
12878
12957
|
context.restore();
|
|
12879
12958
|
}
|
|
@@ -13104,6 +13183,35 @@
|
|
|
13104
13183
|
y: -0.6,
|
|
13105
13184
|
z: 0.98,
|
|
13106
13185
|
});
|
|
13186
|
+
/**
|
|
13187
|
+
* Cache keyed by the `createRandom` factory reference (stable per mounted `<Avatar/>`).
|
|
13188
|
+
*
|
|
13189
|
+
* @private helper of `octopus3d2AvatarVisual`
|
|
13190
|
+
*/
|
|
13191
|
+
const octopus3d2StableStateCache = new WeakMap();
|
|
13192
|
+
/**
|
|
13193
|
+
* Returns the stable per-avatar state, computing it on first access and caching for subsequent frames.
|
|
13194
|
+
*
|
|
13195
|
+
* @private helper of `octopus3d2AvatarVisual`
|
|
13196
|
+
*/
|
|
13197
|
+
function getOctopus3d2StableState(createRandom) {
|
|
13198
|
+
const cached = octopus3d2StableStateCache.get(createRandom);
|
|
13199
|
+
if (cached !== undefined) {
|
|
13200
|
+
return cached;
|
|
13201
|
+
}
|
|
13202
|
+
const animationRandom = createRandom('octopus3d2-animation-profile');
|
|
13203
|
+
const eyeRandom = createRandom('octopus3d2-eye-profile');
|
|
13204
|
+
const leftEyePhaseOffset = eyeRandom() * 0.7;
|
|
13205
|
+
const rightEyePhaseOffset = eyeRandom() * 0.7;
|
|
13206
|
+
const state = {
|
|
13207
|
+
morphologyProfile: createOctopus3MorphologyProfile(createRandom),
|
|
13208
|
+
animationPhase: animationRandom() * Math.PI * 2,
|
|
13209
|
+
leftEyePhaseOffset,
|
|
13210
|
+
rightEyePhaseOffset,
|
|
13211
|
+
};
|
|
13212
|
+
octopus3d2StableStateCache.set(createRandom, state);
|
|
13213
|
+
return state;
|
|
13214
|
+
}
|
|
13107
13215
|
/**
|
|
13108
13216
|
* Octopus 3D 2 avatar visual.
|
|
13109
13217
|
*
|
|
@@ -13116,10 +13224,7 @@
|
|
|
13116
13224
|
isAnimated: true,
|
|
13117
13225
|
supportsPointerTracking: true,
|
|
13118
13226
|
render({ context, size, palette, createRandom, timeMs, interaction }) {
|
|
13119
|
-
const morphologyProfile =
|
|
13120
|
-
const animationRandom = createRandom('octopus3d2-animation-profile');
|
|
13121
|
-
const eyeRandom = createRandom('octopus3d2-eye-profile');
|
|
13122
|
-
const animationPhase = animationRandom() * Math.PI * 2;
|
|
13227
|
+
const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset } = getOctopus3d2StableState(createRandom);
|
|
13123
13228
|
const sceneCenterX = size * 0.5;
|
|
13124
13229
|
const sceneCenterY = size * 0.575;
|
|
13125
13230
|
const bob = Math.sin(timeMs / 940 + animationPhase) * size * 0.013;
|
|
@@ -13172,8 +13277,8 @@
|
|
|
13172
13277
|
const rightEyeLocalCenter = sampleBlobbyOctopusSurfacePoint(surfaceOptions, eyeLatitude, eyeLongitude);
|
|
13173
13278
|
const eyeRadiusX = size * morphologyProfile.face.eyeRadiusXRatio * 0.78;
|
|
13174
13279
|
const eyeRadiusY = eyeRadiusX * morphologyProfile.face.eyeHeightRatio * 0.92;
|
|
13175
|
-
drawProjectedOrganicEye(context, leftEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase +
|
|
13176
|
-
drawProjectedOrganicEye(context, rightEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.9 +
|
|
13280
|
+
drawProjectedOrganicEye(context, leftEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + leftEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
|
|
13281
|
+
drawProjectedOrganicEye(context, rightEyeLocalCenter, eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.9 + rightEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
|
|
13177
13282
|
drawProjectedOrganicMouth(context, [
|
|
13178
13283
|
sampleBlobbyOctopusSurfacePoint(surfaceOptions, mouthLatitude, mouthCenterLongitude - mouthHalfLongitude),
|
|
13179
13284
|
sampleBlobbyOctopusSurfacePoint(surfaceOptions, mouthCurveLatitude, mouthCenterLongitude),
|
|
@@ -13202,14 +13307,28 @@
|
|
|
13202
13307
|
/**
|
|
13203
13308
|
* Draws the soft floor shadow that anchors the single mesh in the frame.
|
|
13204
13309
|
*
|
|
13310
|
+
* Uses a scaled radial gradient instead of `context.filter = 'blur()'` to approximate the
|
|
13311
|
+
* blurry ellipse without triggering a costly software rasterization pass on every frame.
|
|
13312
|
+
*
|
|
13205
13313
|
* @private helper of `octopus3d2AvatarVisual`
|
|
13206
13314
|
*/
|
|
13207
13315
|
function drawBlobbyOctopusShadow(context, size, palette, interaction, timeMs, morphologyProfile) {
|
|
13316
|
+
const cx = size * 0.5 + interaction.gazeX * size * 0.045;
|
|
13317
|
+
const cy = size * 0.88 + Math.sin(timeMs / 940) * size * 0.008;
|
|
13318
|
+
const rx = size * (0.18 + (morphologyProfile.body.horizontalStretch - 1) * 0.04 + interaction.intensity * 0.018);
|
|
13319
|
+
const ry = size * 0.062;
|
|
13208
13320
|
context.save();
|
|
13209
|
-
context.
|
|
13210
|
-
context.
|
|
13321
|
+
context.translate(cx, cy);
|
|
13322
|
+
context.scale(1, ry / rx);
|
|
13323
|
+
const blurRadius = rx * 1.4;
|
|
13324
|
+
const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
|
|
13325
|
+
shadowGradient.addColorStop(0, `${palette.shadow}7a`);
|
|
13326
|
+
shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
|
|
13327
|
+
shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
|
|
13328
|
+
shadowGradient.addColorStop(1, `${palette.shadow}00`);
|
|
13329
|
+
context.fillStyle = shadowGradient;
|
|
13211
13330
|
context.beginPath();
|
|
13212
|
-
context.
|
|
13331
|
+
context.arc(0, 0, blurRadius, 0, Math.PI * 2);
|
|
13213
13332
|
context.fill();
|
|
13214
13333
|
context.restore();
|
|
13215
13334
|
}
|
|
@@ -13365,6 +13484,40 @@
|
|
|
13365
13484
|
* @private helper of `octopus3d3AvatarVisual`
|
|
13366
13485
|
*/
|
|
13367
13486
|
const OCTOPUS_TENTACLE_COUNT = 8;
|
|
13487
|
+
/**
|
|
13488
|
+
* Cache keyed by the `createRandom` factory reference, which is stable for the lifetime of one
|
|
13489
|
+
* mounted `<Avatar/>` component (created inside `resolveAvatarRenderDefinition` and held in a
|
|
13490
|
+
* React `useMemo`). Using a `WeakMap` ensures the entry is collected when the component unmounts.
|
|
13491
|
+
*
|
|
13492
|
+
* @private helper of `octopus3d3AvatarVisual`
|
|
13493
|
+
*/
|
|
13494
|
+
const stableStateCache = new WeakMap();
|
|
13495
|
+
/**
|
|
13496
|
+
* Returns the stable per-avatar state, computing it on first access and returning the cached
|
|
13497
|
+
* result on every subsequent call within the same `<Avatar/>` mount.
|
|
13498
|
+
*
|
|
13499
|
+
* @private helper of `octopus3d3AvatarVisual`
|
|
13500
|
+
*/
|
|
13501
|
+
function getOctopus3d3StableState(createRandom) {
|
|
13502
|
+
const cached = stableStateCache.get(createRandom);
|
|
13503
|
+
if (cached !== undefined) {
|
|
13504
|
+
return cached;
|
|
13505
|
+
}
|
|
13506
|
+
const morphologyProfile = createOctopus3MorphologyProfile(createRandom);
|
|
13507
|
+
const animationRandom = createRandom('octopus3d3-animation-profile');
|
|
13508
|
+
const eyeRandom = createRandom('octopus3d3-eye-profile');
|
|
13509
|
+
const leftEyePhaseOffset = eyeRandom() * 0.7;
|
|
13510
|
+
const rightEyePhaseOffset = eyeRandom() * 0.7;
|
|
13511
|
+
const state = {
|
|
13512
|
+
morphologyProfile,
|
|
13513
|
+
animationPhase: animationRandom() * Math.PI * 2,
|
|
13514
|
+
leftEyePhaseOffset,
|
|
13515
|
+
rightEyePhaseOffset,
|
|
13516
|
+
tentacleProfiles: createContinuousTentacleProfiles(createRandom, morphologyProfile),
|
|
13517
|
+
};
|
|
13518
|
+
stableStateCache.set(createRandom, state);
|
|
13519
|
+
return state;
|
|
13520
|
+
}
|
|
13368
13521
|
/**
|
|
13369
13522
|
* Octopus 3D 3 avatar visual.
|
|
13370
13523
|
*
|
|
@@ -13377,11 +13530,7 @@
|
|
|
13377
13530
|
isAnimated: true,
|
|
13378
13531
|
supportsPointerTracking: true,
|
|
13379
13532
|
render({ context, size, palette, createRandom, timeMs, interaction }) {
|
|
13380
|
-
const morphologyProfile =
|
|
13381
|
-
const animationRandom = createRandom('octopus3d3-animation-profile');
|
|
13382
|
-
const eyeRandom = createRandom('octopus3d3-eye-profile');
|
|
13383
|
-
const animationPhase = animationRandom() * Math.PI * 2;
|
|
13384
|
-
const tentacleProfiles = createContinuousTentacleProfiles(createRandom, morphologyProfile);
|
|
13533
|
+
const { morphologyProfile, animationPhase, leftEyePhaseOffset, rightEyePhaseOffset, tentacleProfiles } = getOctopus3d3StableState(createRandom);
|
|
13385
13534
|
const sceneCenterX = size * 0.5;
|
|
13386
13535
|
const sceneCenterY = size * 0.535;
|
|
13387
13536
|
const bob = Math.sin(timeMs / 960 + animationPhase) * size * 0.012;
|
|
@@ -13458,8 +13607,8 @@
|
|
|
13458
13607
|
size,
|
|
13459
13608
|
palette,
|
|
13460
13609
|
});
|
|
13461
|
-
drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, -eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase +
|
|
13462
|
-
drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.85 +
|
|
13610
|
+
drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, -eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + leftEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
|
|
13611
|
+
drawProjectedOrganicEye(context, sampleContinuousOctopusSurfacePoint(surfaceOptions, eyeLatitude, eyeLongitude), eyeRadiusX, eyeRadiusY, meshCenter, rotationX, rotationY, sceneCenterX, sceneCenterY, size, palette, timeMs, animationPhase + 0.85 + rightEyePhaseOffset, interaction, morphologyProfile.face.eyeStyle);
|
|
13463
13612
|
drawProjectedOrganicMouth(context, [
|
|
13464
13613
|
sampleContinuousOctopusSurfacePoint(surfaceOptions, mouthLatitude, mouthCenterLongitude - mouthHalfLongitude),
|
|
13465
13614
|
sampleContinuousOctopusSurfacePoint(surfaceOptions, mouthCurveLatitude, mouthCenterLongitude),
|
|
@@ -13510,14 +13659,30 @@
|
|
|
13510
13659
|
/**
|
|
13511
13660
|
* Draws the soft lower shadow that anchors the octopus in the avatar frame.
|
|
13512
13661
|
*
|
|
13662
|
+
* Uses a scaled radial gradient instead of `context.filter = 'blur()'` to approximate the
|
|
13663
|
+
* blurry ellipse without triggering a costly software rasterization pass on every frame.
|
|
13664
|
+
*
|
|
13513
13665
|
* @private helper of `octopus3d3AvatarVisual`
|
|
13514
13666
|
*/
|
|
13515
13667
|
function drawContinuousOctopusShadow(context, size, palette, interaction, timeMs, morphologyProfile) {
|
|
13668
|
+
const cx = size * 0.5 + interaction.gazeX * size * 0.045;
|
|
13669
|
+
const cy = size * 0.9 + Math.sin(timeMs / 980) * size * 0.007;
|
|
13670
|
+
const rx = size * (0.19 + morphologyProfile.tentacles.rootSpreadScale * 0.022 + interaction.intensity * 0.02);
|
|
13671
|
+
const ry = size * 0.06;
|
|
13672
|
+
// Scale the context so that drawing a circle produces the correct ellipse aspect ratio,
|
|
13673
|
+
// then fill with a radial gradient that approximates the blurry edge without context.filter.
|
|
13516
13674
|
context.save();
|
|
13517
|
-
context.
|
|
13518
|
-
context.
|
|
13675
|
+
context.translate(cx, cy);
|
|
13676
|
+
context.scale(1, ry / rx);
|
|
13677
|
+
const blurRadius = rx * 1.4;
|
|
13678
|
+
const shadowGradient = context.createRadialGradient(0, 0, 0, 0, 0, blurRadius);
|
|
13679
|
+
shadowGradient.addColorStop(0, `${palette.shadow}7a`);
|
|
13680
|
+
shadowGradient.addColorStop(0.45, `${palette.shadow}44`);
|
|
13681
|
+
shadowGradient.addColorStop(0.8, `${palette.shadow}1a`);
|
|
13682
|
+
shadowGradient.addColorStop(1, `${palette.shadow}00`);
|
|
13683
|
+
context.fillStyle = shadowGradient;
|
|
13519
13684
|
context.beginPath();
|
|
13520
|
-
context.
|
|
13685
|
+
context.arc(0, 0, blurRadius, 0, Math.PI * 2);
|
|
13521
13686
|
context.fill();
|
|
13522
13687
|
context.restore();
|
|
13523
13688
|
}
|
|
@@ -28742,14 +28907,50 @@
|
|
|
28742
28907
|
* Builds the prompt sent to the selected coding runner for one queued user-thread book.
|
|
28743
28908
|
*/
|
|
28744
28909
|
function buildAgentMessagePrompt(messageRelativePath, agentSystemMessage) {
|
|
28745
|
-
|
|
28746
|
-
|
|
28910
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
28911
|
+
# Answer 1 user question
|
|
28747
28912
|
|
|
28748
|
-
|
|
28749
|
-
|
|
28750
|
-
|
|
28751
|
-
|
|
28752
|
-
|
|
28913
|
+
- Read \`${messageRelativePath}\` and answer the most recent \`MESSAGE @User\`
|
|
28914
|
+
- Only change the queued message file by appending one new \`MESSAGE @Agent\` block
|
|
28915
|
+
- Do not modify any other file in the repository
|
|
28916
|
+
|
|
28917
|
+
## Rules for the answering
|
|
28918
|
+
|
|
28919
|
+
## Formatting
|
|
28920
|
+
|
|
28921
|
+
- You can use Markdown formatting in the messages like **bold** or *italic*
|
|
28922
|
+
|
|
28923
|
+
## Sources and citations
|
|
28924
|
+
|
|
28925
|
+
Mark sources and citations like this "【https://example.com/document123.pdf 】"
|
|
28926
|
+
|
|
28927
|
+
At the same time, you can write sources naturally in the text of the answers
|
|
28928
|
+
|
|
28929
|
+
For example:
|
|
28930
|
+
|
|
28931
|
+
> According to paragraph §745b, the fee can be waived for a person over 65 years old. 【https://praha13.cz/2026/paragraph-745.doc】
|
|
28932
|
+
|
|
28933
|
+
- "paragraph §745b" fits naturally in the text.
|
|
28934
|
+
- "【https://praha13.cz/2026/paragraph-745.doc】" The exact format of the quote is important for further processing of the answer.
|
|
28935
|
+
- The "【" and "】" symbols are used to mark the source and will be parsed, inside should be valid URL used as a source for the answer.
|
|
28936
|
+
|
|
28937
|
+
## Quick buttons
|
|
28938
|
+
|
|
28939
|
+
If there is a meaningful follow-up procedure, use quick buttons at the end of the answer:
|
|
28940
|
+
|
|
28941
|
+
\`\`\`
|
|
28942
|
+
How big is the contract you are posting?
|
|
28943
|
+
|
|
28944
|
+
[Up to 50,000 CZK](?message=We are posting an order up to 50,000 CZK)
|
|
28945
|
+
[Up to 100,000 CZK](?message=We are posting an order up to 100,000 CZK)
|
|
28946
|
+
[Over 100,000 CZK](?message=We are posting an order over 100,000 CZK)
|
|
28947
|
+
\`\`\`
|
|
28948
|
+
|
|
28949
|
+
|
|
28950
|
+
## This is how you should behave
|
|
28951
|
+
|
|
28952
|
+
${block(agentSystemMessage)}
|
|
28953
|
+
`);
|
|
28753
28954
|
}
|
|
28754
28955
|
|
|
28755
28956
|
/**
|
|
@@ -35894,7 +36095,9 @@
|
|
|
35894
36095
|
* @private internal utility of `Book`
|
|
35895
36096
|
*/
|
|
35896
36097
|
function parseCommitmentHeader(line) {
|
|
35897
|
-
|
|
36098
|
+
// Require at least 2 characters in the first keyword word to avoid treating common
|
|
36099
|
+
// single-letter words (e.g. "V" in Czech, "I" or "A" in English) as commitment headers.
|
|
36100
|
+
const match = /^([A-Z][A-Z0-9]+(?: [A-Z0-9]+)*)(?:\s+(.*))?$/u.exec(line);
|
|
35898
36101
|
if (!match) {
|
|
35899
36102
|
return null;
|
|
35900
36103
|
}
|
|
@@ -39308,6 +39511,57 @@
|
|
|
39308
39511
|
// Note: [🟡] Code for CLI command [init](src/cli/cli-commands/coder/init.ts) should never be published outside of `@promptbook/cli`
|
|
39309
39512
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
39310
39513
|
|
|
39514
|
+
/**
|
|
39515
|
+
* Pattern that matches durations like "1h", "30m", "5s", "1h30m", "1h30m5s".
|
|
39516
|
+
*/
|
|
39517
|
+
const DURATION_PATTERN = /^(?:(\d+)h)?(?:(\d+)m(?:in)?)?(?:(\d+)s)?$/;
|
|
39518
|
+
/**
|
|
39519
|
+
* Parses a human-readable duration string into milliseconds.
|
|
39520
|
+
*
|
|
39521
|
+
* Supported formats: `Xh`, `Xm`, `Xs`, and combinations like `1h30m`, `1h30m5s`.
|
|
39522
|
+
*
|
|
39523
|
+
* @returns Duration in milliseconds
|
|
39524
|
+
* @throws When the string does not match any supported format
|
|
39525
|
+
*
|
|
39526
|
+
* @private internal utility of `ptbk coder run`
|
|
39527
|
+
*/
|
|
39528
|
+
function parseDuration(durationString) {
|
|
39529
|
+
var _a, _b, _c;
|
|
39530
|
+
const trimmed = durationString.trim();
|
|
39531
|
+
if (!trimmed) {
|
|
39532
|
+
throw new Error(`Invalid duration: empty string. Expected a format like "1h", "30m", "5s", or combinations like "1h30m".`);
|
|
39533
|
+
}
|
|
39534
|
+
const match = trimmed.match(DURATION_PATTERN);
|
|
39535
|
+
if (!match || (match[1] === undefined && match[2] === undefined && match[3] === undefined)) {
|
|
39536
|
+
throw new Error(`Invalid duration: "${durationString}". Expected a format like "1h", "30m", "5s", or combinations like "1h30m5s".`);
|
|
39537
|
+
}
|
|
39538
|
+
const hours = parseInt((_a = match[1]) !== null && _a !== void 0 ? _a : '0', 10);
|
|
39539
|
+
const minutes = parseInt((_b = match[2]) !== null && _b !== void 0 ? _b : '0', 10);
|
|
39540
|
+
const seconds = parseInt((_c = match[3]) !== null && _c !== void 0 ? _c : '0', 10);
|
|
39541
|
+
return (hours * 3600 + minutes * 60 + seconds) * 1000;
|
|
39542
|
+
}
|
|
39543
|
+
/**
|
|
39544
|
+
* Formats a duration in milliseconds into a compact human-readable string.
|
|
39545
|
+
*
|
|
39546
|
+
* Examples: `3600000` → `"1h"`, `90000` → `"1m 30s"`, `5000` → `"5s"`.
|
|
39547
|
+
*
|
|
39548
|
+
* @private internal utility of `ptbk coder run`
|
|
39549
|
+
*/
|
|
39550
|
+
function formatDurationMs(ms) {
|
|
39551
|
+
const totalSeconds = Math.ceil(ms / 1000);
|
|
39552
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
39553
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
39554
|
+
const seconds = totalSeconds % 60;
|
|
39555
|
+
const parts = [];
|
|
39556
|
+
if (hours > 0)
|
|
39557
|
+
parts.push(`${hours}h`);
|
|
39558
|
+
if (minutes > 0)
|
|
39559
|
+
parts.push(`${minutes}m`);
|
|
39560
|
+
if (seconds > 0 || parts.length === 0)
|
|
39561
|
+
parts.push(`${seconds}s`);
|
|
39562
|
+
return parts.join(' ');
|
|
39563
|
+
}
|
|
39564
|
+
|
|
39311
39565
|
/**
|
|
39312
39566
|
* Initializes `coder run` command for Promptbook CLI utilities
|
|
39313
39567
|
*
|
|
@@ -39340,7 +39594,13 @@
|
|
|
39340
39594
|
command.option('--preserve-logs', 'Keep generated temp prompt/log artifacts after successful rounds for debugging and analytics', false);
|
|
39341
39595
|
addPromptRunnerExecutionOptions(command);
|
|
39342
39596
|
command.option('--priority <minimum-priority>', 'Filter prompts by minimum priority level', parseIntOption, 0);
|
|
39343
|
-
command.option('--
|
|
39597
|
+
command.option('--wait [duration]', _spaceTrim.spaceTrim(`
|
|
39598
|
+
Wait between prompt rounds.
|
|
39599
|
+
Without a value (default): waits for user confirmation before each prompt (interactive mode).
|
|
39600
|
+
With a duration like 1h, 30m, 5s: waits that long between prompts to avoid hitting rate limits of the harness.
|
|
39601
|
+
`), true);
|
|
39602
|
+
// Note: --no-wait disables the default interactive wait-for-user behaviour
|
|
39603
|
+
command.option('--no-wait', 'Skip all waiting between prompts and run non-interactively');
|
|
39344
39604
|
command.option('--auto-migrate', 'Run testing-server database migrations automatically after each successfully processed prompt');
|
|
39345
39605
|
command.option('--allow-destructive-auto-migrate', 'Allow auto-migrate even when heuristic SQL safety check flags destructive pending migrations');
|
|
39346
39606
|
command.action(handleActionErrors(async (cliOptions) => {
|
|
@@ -39349,10 +39609,23 @@
|
|
|
39349
39609
|
const runnerOptions = normalizePromptRunnerCliOptions(cliOptions, {
|
|
39350
39610
|
isAgentRequired: !dryRun,
|
|
39351
39611
|
});
|
|
39612
|
+
// [1] Parse the --wait option:
|
|
39613
|
+
// true (default or --wait without value): wait for user confirmation
|
|
39614
|
+
// false (--no-wait): no waiting at all
|
|
39615
|
+
// string (--wait 1h): wait that long between prompt rounds
|
|
39616
|
+
let waitForUser = false;
|
|
39617
|
+
let waitBetweenPrompts = 0;
|
|
39618
|
+
if (wait === true) {
|
|
39619
|
+
waitForUser = true;
|
|
39620
|
+
}
|
|
39621
|
+
else if (typeof wait === 'string' && wait !== '') {
|
|
39622
|
+
waitBetweenPrompts = parseDuration(wait);
|
|
39623
|
+
}
|
|
39352
39624
|
// Convert commander options to RunOptions format
|
|
39353
39625
|
const runOptions = {
|
|
39354
39626
|
dryRun,
|
|
39355
|
-
waitForUser
|
|
39627
|
+
waitForUser,
|
|
39628
|
+
waitBetweenPrompts,
|
|
39356
39629
|
noCommit: runnerOptions.noCommit,
|
|
39357
39630
|
ignoreGitChanges: runnerOptions.ignoreGitChanges,
|
|
39358
39631
|
agentName: runnerOptions.agentName,
|
|
@@ -62795,6 +63068,7 @@
|
|
|
62795
63068
|
noUi: options.noUi,
|
|
62796
63069
|
thinkingLevel: options.thinkingLevel,
|
|
62797
63070
|
waitForUser: false,
|
|
63071
|
+
waitBetweenPrompts: 0,
|
|
62798
63072
|
noCommit: true,
|
|
62799
63073
|
ignoreGitChanges: true,
|
|
62800
63074
|
normalizeLineEndings: false,
|
|
@@ -68329,7 +68603,7 @@
|
|
|
68329
68603
|
/**
|
|
68330
68604
|
* CLI usage text for this script.
|
|
68331
68605
|
*/
|
|
68332
|
-
const USAGE = 'Usage: run-codex-prompts [--dry-run] [--harness <harness-name>] [--model <model>] [--context <context-or-file>] [--test <test-command...>] [--preserve-logs] [--no-ui] [--thinking-level <thinking-level>] [--priority <minimum-priority>] [--allow-credits] [--auto-migrate] [--allow-destructive-auto-migrate] [--no-wait] [--no-commit] [--ignore-git-changes] [--no-normalize-line-endings] [--auto-push] [--auto-pull]';
|
|
68606
|
+
const USAGE = 'Usage: run-codex-prompts [--dry-run] [--harness <harness-name>] [--model <model>] [--context <context-or-file>] [--test <test-command...>] [--preserve-logs] [--no-ui] [--thinking-level <thinking-level>] [--priority <minimum-priority>] [--allow-credits] [--auto-migrate] [--allow-destructive-auto-migrate] [--wait [duration]] [--no-wait] [--no-commit] [--ignore-git-changes] [--no-normalize-line-endings] [--auto-push] [--auto-pull]';
|
|
68333
68607
|
/**
|
|
68334
68608
|
* Top-level flags supported by this command.
|
|
68335
68609
|
*/
|
|
@@ -68346,6 +68620,7 @@
|
|
|
68346
68620
|
'--allow-credits',
|
|
68347
68621
|
'--auto-migrate',
|
|
68348
68622
|
'--allow-destructive-auto-migrate',
|
|
68623
|
+
'--wait',
|
|
68349
68624
|
'--no-wait',
|
|
68350
68625
|
'--no-commit',
|
|
68351
68626
|
'--ignore-git-changes',
|
|
@@ -68384,6 +68659,22 @@
|
|
|
68384
68659
|
const allowDestructiveAutoMigrate = args.includes('--allow-destructive-auto-migrate');
|
|
68385
68660
|
const autoPush = args.includes('--auto-push');
|
|
68386
68661
|
const autoPull = args.includes('--auto-pull');
|
|
68662
|
+
// [1] Parse --wait [duration]:
|
|
68663
|
+
// absent or --no-wait: no waiting
|
|
68664
|
+
// --wait (no value): wait for user confirmation
|
|
68665
|
+
// --wait 1h: wait 1h between prompt rounds to avoid rate limits
|
|
68666
|
+
const waitOptionalValue = readOptionalOptionValue(args, '--wait');
|
|
68667
|
+
let waitForUser = false;
|
|
68668
|
+
let waitBetweenPrompts = 0;
|
|
68669
|
+
if (waitOptionalValue === null) {
|
|
68670
|
+
// --wait present without a duration value: interactive mode
|
|
68671
|
+
waitForUser = true;
|
|
68672
|
+
}
|
|
68673
|
+
else if (waitOptionalValue !== undefined) {
|
|
68674
|
+
// --wait <duration>: time-based wait between rounds
|
|
68675
|
+
waitBetweenPrompts = parseDuration(waitOptionalValue);
|
|
68676
|
+
}
|
|
68677
|
+
// --no-wait (or no flag): both waitForUser and waitBetweenPrompts remain false/0
|
|
68387
68678
|
let thinkingLevel;
|
|
68388
68679
|
if (hasTestCommandFlag && testCommand === undefined) {
|
|
68389
68680
|
exitWithUsageError('Missing value for --test. Use a shell command such as `npm run test` and quote it when it contains top-level CLI flags.');
|
|
@@ -68402,7 +68693,8 @@
|
|
|
68402
68693
|
}
|
|
68403
68694
|
return {
|
|
68404
68695
|
dryRun,
|
|
68405
|
-
waitForUser
|
|
68696
|
+
waitForUser,
|
|
68697
|
+
waitBetweenPrompts,
|
|
68406
68698
|
noCommit,
|
|
68407
68699
|
ignoreGitChanges,
|
|
68408
68700
|
normalizeLineEndings,
|
|
@@ -68421,6 +68713,23 @@
|
|
|
68421
68713
|
priority,
|
|
68422
68714
|
};
|
|
68423
68715
|
}
|
|
68716
|
+
/**
|
|
68717
|
+
* Reads an optional value for a flag that may appear with or without a following value.
|
|
68718
|
+
*
|
|
68719
|
+
* Returns `undefined` when the flag is absent, `null` when the flag is present but has no value
|
|
68720
|
+
* (the next token is another flag or the end of args), and the value string otherwise.
|
|
68721
|
+
*/
|
|
68722
|
+
function readOptionalOptionValue(args, flag) {
|
|
68723
|
+
if (!args.includes(flag)) {
|
|
68724
|
+
return undefined;
|
|
68725
|
+
}
|
|
68726
|
+
const index = args.indexOf(flag);
|
|
68727
|
+
const nextArg = args[index + 1];
|
|
68728
|
+
if (nextArg === undefined || nextArg.startsWith('-')) {
|
|
68729
|
+
return null;
|
|
68730
|
+
}
|
|
68731
|
+
return nextArg;
|
|
68732
|
+
}
|
|
68424
68733
|
/**
|
|
68425
68734
|
* Reads a value of a CLI option that follows a given flag.
|
|
68426
68735
|
*/
|
|
@@ -70876,6 +71185,7 @@
|
|
|
70876
71185
|
initializeRunUi(uiHandle, runner.name, actualRunnerModel, options);
|
|
70877
71186
|
let hasShownUpcomingTasks = false;
|
|
70878
71187
|
let hasWaitedForStart = false;
|
|
71188
|
+
let hasRunAtLeastOneRound = false;
|
|
70879
71189
|
while (just(true)) {
|
|
70880
71190
|
if (options.autoPull && !options.dryRun) {
|
|
70881
71191
|
await waitForRequestedPause({
|
|
@@ -70911,6 +71221,16 @@
|
|
|
70911
71221
|
}
|
|
70912
71222
|
const nextPrompt = promptQueueSnapshot.nextPrompt;
|
|
70913
71223
|
const promptLabel = buildPromptLabelForDisplay(nextPrompt.file, nextPrompt.section);
|
|
71224
|
+
// Wait between prompt rounds (skipped for the first round)
|
|
71225
|
+
if (hasRunAtLeastOneRound) {
|
|
71226
|
+
await waitBetweenPromptRoundsIfNeeded({
|
|
71227
|
+
options,
|
|
71228
|
+
isRichUiEnabled,
|
|
71229
|
+
progressDisplay,
|
|
71230
|
+
uiHandle,
|
|
71231
|
+
});
|
|
71232
|
+
}
|
|
71233
|
+
hasRunAtLeastOneRound = true;
|
|
70914
71234
|
hasWaitedForStart = await waitForPromptConfirmationIfNeeded({
|
|
70915
71235
|
options,
|
|
70916
71236
|
nextPrompt,
|
|
@@ -71146,6 +71466,39 @@
|
|
|
71146
71466
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.resumeTimer();
|
|
71147
71467
|
return true;
|
|
71148
71468
|
}
|
|
71469
|
+
/**
|
|
71470
|
+
* Countdown update interval for the between-rounds wait display.
|
|
71471
|
+
*/
|
|
71472
|
+
const WAIT_COUNTDOWN_UPDATE_INTERVAL_MS = 30000;
|
|
71473
|
+
/**
|
|
71474
|
+
* Waits the configured time between prompt rounds to avoid hitting harness rate limits.
|
|
71475
|
+
* Does nothing when `waitBetweenPrompts` is zero.
|
|
71476
|
+
*/
|
|
71477
|
+
async function waitBetweenPromptRoundsIfNeeded(options) {
|
|
71478
|
+
const { options: runOptions, isRichUiEnabled, progressDisplay, uiHandle } = options;
|
|
71479
|
+
const { waitBetweenPrompts } = runOptions;
|
|
71480
|
+
if (waitBetweenPrompts <= 0) {
|
|
71481
|
+
return;
|
|
71482
|
+
}
|
|
71483
|
+
progressDisplay === null || progressDisplay === void 0 ? void 0 : progressDisplay.pauseTimer();
|
|
71484
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.pauseTimer();
|
|
71485
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('waiting');
|
|
71486
|
+
let remaining = waitBetweenPrompts;
|
|
71487
|
+
while (remaining > 0) {
|
|
71488
|
+
const statusMessage = `Waiting ${formatDurationMs(remaining)} before next prompt to avoid rate limits...`;
|
|
71489
|
+
if (!isRichUiEnabled) {
|
|
71490
|
+
console.info(colors__default["default"].gray(statusMessage));
|
|
71491
|
+
}
|
|
71492
|
+
else {
|
|
71493
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(statusMessage);
|
|
71494
|
+
}
|
|
71495
|
+
const sleepMs = Math.min(WAIT_COUNTDOWN_UPDATE_INTERVAL_MS, remaining);
|
|
71496
|
+
await new Promise((resolve) => setTimeout(resolve, sleepMs));
|
|
71497
|
+
remaining -= sleepMs;
|
|
71498
|
+
}
|
|
71499
|
+
progressDisplay === null || progressDisplay === void 0 ? void 0 : progressDisplay.resumeTimer();
|
|
71500
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.resumeTimer();
|
|
71501
|
+
}
|
|
71149
71502
|
/**
|
|
71150
71503
|
* Stops active displays and prints the git identity tip for real runs.
|
|
71151
71504
|
*/
|