@promptbook/cli 0.112.0-101 → 0.112.0-103
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/package.json +1 -1
- package/apps/agents-server/scripts/prerender-homepage.js +76 -1
- package/apps/agents-server/src/app/actions.ts +0 -6
- package/apps/agents-server/src/app/admin/about/page.tsx +1 -1
- package/apps/agents-server/src/app/admin/image-generator-test/ImageAttachmentsEditor.tsx +11 -6
- package/apps/agents-server/src/app/admin/login-methods/shibboleth/page.tsx +365 -0
- package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +13 -15
- package/apps/agents-server/src/app/admin/servers/ServersRegistryTable.tsx +3 -3
- package/apps/agents-server/src/app/admin/servers/useCreateServerWizard.ts +13 -14
- package/apps/agents-server/src/app/admin/update/UpdateClient.tsx +12 -3
- package/apps/agents-server/src/app/admin/usage/UsageClientTimelineChart.tsx +1 -1
- package/apps/agents-server/src/app/admin/users/[userId]/UserDetailClient.tsx +21 -14
- package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatPageLayout.tsx +2 -2
- package/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatSidebarDefault.tsx +11 -7
- package/apps/agents-server/src/app/api/admin/cli-access/route.ts +27 -123
- package/apps/agents-server/src/app/api/admin/code-runners/authentication/route.ts +33 -125
- package/apps/agents-server/src/app/api/auth/login/route.ts +0 -10
- package/apps/agents-server/src/app/api/auth/shibboleth/acs/route.ts +77 -57
- package/apps/agents-server/src/app/api/auth/shibboleth/login/route.ts +57 -33
- package/apps/agents-server/src/app/api/auth/shibboleth/metadata/route.ts +4 -29
- package/apps/agents-server/src/app/api/auth/shibboleth/status/route.ts +17 -0
- package/apps/agents-server/src/app/api/upload/route.ts +148 -209
- package/apps/agents-server/src/app/api/users/[username]/route.ts +1 -1
- package/apps/agents-server/src/app/api/users/route.ts +5 -5
- package/apps/agents-server/src/app/dashboard/page.tsx +1 -1
- package/apps/agents-server/src/app/docs/[docId]/page.tsx +1 -1
- package/apps/agents-server/src/app/docs/page.tsx +1 -1
- package/apps/agents-server/src/app/globals.css +100 -0
- package/apps/agents-server/src/app/layout.tsx +7 -0
- package/apps/agents-server/src/app/recycle-bin/page.tsx +1 -1
- package/apps/agents-server/src/app/system/settings/KeybindingsSettingsClient.tsx +13 -7
- package/apps/agents-server/src/components/AdminTerminal/useAdminTerminalSession.ts +29 -1
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +3 -3
- package/apps/agents-server/src/components/AgentProfile/AgentProfileImage.tsx +8 -2
- package/apps/agents-server/src/components/DocsToolbar/DocsToolbar.tsx +4 -4
- package/apps/agents-server/src/components/DocumentationContent/DocumentationContent.tsx +9 -9
- package/apps/agents-server/src/components/Footer/Footer.tsx +7 -7
- package/apps/agents-server/src/components/Header/Header.tsx +24 -4
- package/apps/agents-server/src/components/Header/HeaderTypes.ts +6 -0
- package/apps/agents-server/src/components/Header/buildHeaderSystemMenuItems.ts +51 -1
- package/apps/agents-server/src/components/Homepage/Card.tsx +1 -1
- package/apps/agents-server/src/components/Homepage/Section.tsx +3 -1
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +12 -1
- package/apps/agents-server/src/components/LoginForm/LoginForm.tsx +100 -149
- package/apps/agents-server/src/components/Skeleton/ConsolePageLoadingSkeleton.tsx +1 -1
- package/apps/agents-server/src/components/Skeleton/DocumentationRouteLoadingSkeleton.tsx +1 -1
- package/apps/agents-server/src/components/Skeleton/HomepageLoadingSkeleton.tsx +1 -1
- package/apps/agents-server/src/components/UsersList/UsersList.tsx +20 -4
- package/apps/agents-server/src/components/UsersList/useUsersAdmin.ts +3 -0
- package/apps/agents-server/src/constants/shibbolethAuth.ts +139 -0
- package/apps/agents-server/src/database/metadataDefaults.ts +54 -80
- package/apps/agents-server/src/database/migrate.ts +30 -1
- package/apps/agents-server/src/database/migrations/2026-06-0100-shibboleth-auth.sql +136 -0
- package/apps/agents-server/src/database/sqlite/$provideLocalSqliteSupabase.ts +88 -36
- package/apps/agents-server/src/languages/ServerTranslationKeys.ts +4 -2
- package/apps/agents-server/src/languages/translations/czech.yaml +4 -2
- package/apps/agents-server/src/languages/translations/english.yaml +5 -3
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +54 -11
- package/apps/agents-server/src/utils/cdn/classes/DigitalOceanSpaces.ts +18 -2
- package/apps/agents-server/src/utils/cdn/classes/TrackedFilesStorage.ts +6 -5
- package/apps/agents-server/src/utils/cdn/interfaces/IFilesStorage.ts +5 -0
- package/apps/agents-server/src/utils/chatExport/renderHtmlToPdfOnServer.ts +11 -0
- package/apps/agents-server/src/utils/createAdminTerminalRouteHandlers.ts +264 -0
- package/apps/agents-server/src/utils/shareTargetPayloads.ts +19 -66
- package/apps/agents-server/src/utils/shibbolethAuthentication.ts +729 -621
- package/apps/agents-server/src/utils/upload/createBookEditorUploadHandler.ts +19 -28
- package/apps/agents-server/src/utils/upload/uploadFileToServer.ts +113 -0
- package/esm/index.es.js +194 -35
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/waitForPause.d.ts +12 -0
- package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +1 -0
- package/esm/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +1 -1
- package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/book-components/Chat/MarkdownContent/MarkdownContent.tsx +63 -4
- package/src/other/templates/getTemplatesPipelineCollection.ts +730 -739
- package/src/version.ts +2 -2
- package/src/versions.txt +2 -0
- package/umd/index.umd.js +194 -35
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/waitForPause.d.ts +12 -0
- package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +1 -0
- package/umd/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +1 -1
- package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
- package/apps/agents-server/src/app/api/auth/methods/route.ts +0 -44
- package/apps/agents-server/src/constants/authenticationMethods.ts +0 -74
- package/apps/agents-server/src/constants/shibbolethAuthentication.ts +0 -107
package/esm/index.es.js
CHANGED
|
@@ -58,7 +58,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
58
58
|
* @generated
|
|
59
59
|
* @see https://github.com/webgptorg/promptbook
|
|
60
60
|
*/
|
|
61
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
61
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-103';
|
|
62
62
|
/**
|
|
63
63
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
64
64
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3615,16 +3615,30 @@ function resolveNextCliPath() {
|
|
|
3615
3615
|
// Note: [🟡] Code for CLI runtime [buildAgentsServer](src/cli/cli-commands/agents-server/buildAgentsServer.ts) should never be published outside of `@promptbook/cli`
|
|
3616
3616
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3617
3617
|
|
|
3618
|
+
/**
|
|
3619
|
+
* Default label used before the next pause checkpoint is known.
|
|
3620
|
+
*/
|
|
3621
|
+
const DEFAULT_PAUSE_TARGET_LABEL = 'the next task';
|
|
3618
3622
|
/**
|
|
3619
3623
|
* Current pause state.
|
|
3620
3624
|
*/
|
|
3621
3625
|
let pauseState = 'RUNNING';
|
|
3626
|
+
/**
|
|
3627
|
+
* Label of the next checkpoint where the requested pause will take effect.
|
|
3628
|
+
*/
|
|
3629
|
+
let pauseTargetLabel = DEFAULT_PAUSE_TARGET_LABEL;
|
|
3622
3630
|
/**
|
|
3623
3631
|
* Stores one new pause state in the shared runner controller.
|
|
3624
3632
|
*/
|
|
3625
3633
|
function setPauseState(nextPauseState) {
|
|
3626
3634
|
pauseState = nextPauseState;
|
|
3627
3635
|
}
|
|
3636
|
+
/**
|
|
3637
|
+
* Stores one new pause target label in the shared runner controller.
|
|
3638
|
+
*/
|
|
3639
|
+
function setPauseTargetLabel(nextPauseTargetLabel) {
|
|
3640
|
+
pauseTargetLabel = nextPauseTargetLabel.trim() || DEFAULT_PAUSE_TARGET_LABEL;
|
|
3641
|
+
}
|
|
3628
3642
|
/**
|
|
3629
3643
|
* Applies the same three-state toggle used by the `P` hotkey.
|
|
3630
3644
|
*/
|
|
@@ -3635,9 +3649,11 @@ function togglePauseState() {
|
|
|
3635
3649
|
}
|
|
3636
3650
|
if (pauseState === 'PAUSING') {
|
|
3637
3651
|
setPauseState('RUNNING');
|
|
3652
|
+
resetPauseTargetLabel();
|
|
3638
3653
|
return 'CANCELLED_PAUSE';
|
|
3639
3654
|
}
|
|
3640
3655
|
setPauseState('RUNNING');
|
|
3656
|
+
resetPauseTargetLabel();
|
|
3641
3657
|
return 'RESUMED';
|
|
3642
3658
|
}
|
|
3643
3659
|
/**
|
|
@@ -3678,7 +3694,8 @@ async function checkPause(options) {
|
|
|
3678
3694
|
if (pauseState === 'PAUSING') {
|
|
3679
3695
|
setPauseState('PAUSED');
|
|
3680
3696
|
if (!(options === null || options === void 0 ? void 0 : options.silent)) {
|
|
3681
|
-
console.log(colors.bgWhite.black(
|
|
3697
|
+
console.log(colors.bgWhite.black(`Paused before ${getPauseTargetLabel()}`) +
|
|
3698
|
+
colors.gray(' (Press "p" to resume)'));
|
|
3682
3699
|
}
|
|
3683
3700
|
(_a = options === null || options === void 0 ? void 0 : options.onPaused) === null || _a === void 0 ? void 0 : _a.call(options);
|
|
3684
3701
|
while (getPauseState() === 'PAUSED') {
|
|
@@ -3696,6 +3713,24 @@ async function checkPause(options) {
|
|
|
3696
3713
|
function getPauseState() {
|
|
3697
3714
|
return pauseState;
|
|
3698
3715
|
}
|
|
3716
|
+
/**
|
|
3717
|
+
* Returns the label of the next checkpoint where pausing will take effect.
|
|
3718
|
+
*/
|
|
3719
|
+
function getPauseTargetLabel() {
|
|
3720
|
+
return pauseTargetLabel;
|
|
3721
|
+
}
|
|
3722
|
+
/**
|
|
3723
|
+
* Updates the label of the next pause checkpoint.
|
|
3724
|
+
*/
|
|
3725
|
+
function announcePauseTargetLabel(nextPauseTargetLabel) {
|
|
3726
|
+
setPauseTargetLabel(nextPauseTargetLabel);
|
|
3727
|
+
}
|
|
3728
|
+
/**
|
|
3729
|
+
* Restores the default generic pause target label.
|
|
3730
|
+
*/
|
|
3731
|
+
function resetPauseTargetLabel() {
|
|
3732
|
+
setPauseTargetLabel(DEFAULT_PAUSE_TARGET_LABEL);
|
|
3733
|
+
}
|
|
3699
3734
|
|
|
3700
3735
|
/**
|
|
3701
3736
|
* Just says that the variable is not used but should be kept
|
|
@@ -3933,18 +3968,18 @@ function buildScriptPathSessionRows(scriptPaths, bodyWidth) {
|
|
|
3933
3968
|
/**
|
|
3934
3969
|
* Builds the colored phase badge shown in the session box.
|
|
3935
3970
|
*/
|
|
3936
|
-
function buildPausePresentation(phase, pauseState, statusMessage) {
|
|
3971
|
+
function buildPausePresentation(phase, pauseState, pauseTargetLabel, statusMessage) {
|
|
3937
3972
|
if (pauseState === 'PAUSING') {
|
|
3938
3973
|
return {
|
|
3939
3974
|
badge: colors.bgYellow.black(' PAUSING '),
|
|
3940
|
-
stateMessage:
|
|
3975
|
+
stateMessage: `Pausing before ${pauseTargetLabel}`,
|
|
3941
3976
|
pauseControl: colors.bgMagenta.white(' P ') + colors.white(' Cancel pause'),
|
|
3942
3977
|
};
|
|
3943
3978
|
}
|
|
3944
3979
|
if (pauseState === 'PAUSED') {
|
|
3945
3980
|
return {
|
|
3946
3981
|
badge: colors.bgWhite.black(' PAUSED '),
|
|
3947
|
-
stateMessage:
|
|
3982
|
+
stateMessage: `Paused before ${pauseTargetLabel}`,
|
|
3948
3983
|
pauseControl: colors.bgGreen.black(' P ') + colors.white(' Resume'),
|
|
3949
3984
|
};
|
|
3950
3985
|
}
|
|
@@ -4076,7 +4111,7 @@ function buildCoderRunUiFrame(options) {
|
|
|
4076
4111
|
const octopusAnimationFrame = isCoderRunUiAutoRefreshing(options.phase, options.pauseState)
|
|
4077
4112
|
? options.animationFrame
|
|
4078
4113
|
: 0;
|
|
4079
|
-
const pausePresentation = buildPausePresentation(options.phase, options.pauseState, options.statusMessage);
|
|
4114
|
+
const pausePresentation = buildPausePresentation(options.phase, options.pauseState, options.pauseTargetLabel, options.statusMessage);
|
|
4080
4115
|
const sessionLines = buildSessionLines$1(options, totalWidth, pausePresentation);
|
|
4081
4116
|
const currentTaskLines = options.currentPromptLabel
|
|
4082
4117
|
? [
|
|
@@ -4704,6 +4739,7 @@ function renderCoderRunUi(startTime, options = {}) {
|
|
|
4704
4739
|
animationFrame: spinnerFrame,
|
|
4705
4740
|
spinner: SPINNER_FRAMES[spinnerFrame],
|
|
4706
4741
|
pauseState: getPauseState(),
|
|
4742
|
+
pauseTargetLabel: getPauseTargetLabel(),
|
|
4707
4743
|
config: state.config,
|
|
4708
4744
|
phase: state.phase,
|
|
4709
4745
|
currentPromptLabel: state.currentPromptLabel,
|
|
@@ -33837,6 +33873,14 @@ const CODEX_COMPLETION_LINE = /^\s*tokens used\b/i;
|
|
|
33837
33873
|
* Idle timeout after completion marker to capture trailing output.
|
|
33838
33874
|
*/
|
|
33839
33875
|
const CODEX_COMPLETION_IDLE_MS = 60 * 1000;
|
|
33876
|
+
/**
|
|
33877
|
+
* Number of seconds in one hour.
|
|
33878
|
+
*/
|
|
33879
|
+
const SECONDS_PER_HOUR = 60 * 60;
|
|
33880
|
+
/**
|
|
33881
|
+
* Poll interval used while waiting for the next rate-limit retry so pause requests can be honored promptly.
|
|
33882
|
+
*/
|
|
33883
|
+
const RATE_LIMIT_BACKOFF_POLL_MS = 1000;
|
|
33840
33884
|
/**
|
|
33841
33885
|
* Maximum delay between retries while rate-limited.
|
|
33842
33886
|
*/
|
|
@@ -33856,8 +33900,8 @@ async function waitFor(delayMs) {
|
|
|
33856
33900
|
*/
|
|
33857
33901
|
function formatDelay(delayMs) {
|
|
33858
33902
|
const totalSeconds = Math.max(0, Math.round(delayMs / 1000));
|
|
33859
|
-
const hours = Math.floor(totalSeconds /
|
|
33860
|
-
const minutes = Math.floor((totalSeconds %
|
|
33903
|
+
const hours = Math.floor(totalSeconds / SECONDS_PER_HOUR);
|
|
33904
|
+
const minutes = Math.floor((totalSeconds % SECONDS_PER_HOUR) / 60);
|
|
33861
33905
|
const seconds = totalSeconds % 60;
|
|
33862
33906
|
const parts = [];
|
|
33863
33907
|
if (hours > 0) {
|
|
@@ -33898,6 +33942,7 @@ class OpenAiCodexRunner {
|
|
|
33898
33942
|
* Runs the Codex prompt in a temporary script and waits for completion output.
|
|
33899
33943
|
*/
|
|
33900
33944
|
async runPrompt(options) {
|
|
33945
|
+
var _a;
|
|
33901
33946
|
const scriptContent = buildCodexScript({
|
|
33902
33947
|
prompt: options.prompt,
|
|
33903
33948
|
projectPath: options.projectPath,
|
|
@@ -33908,7 +33953,14 @@ class OpenAiCodexRunner {
|
|
|
33908
33953
|
allowCredits: this.options.allowCredits,
|
|
33909
33954
|
codexCommand: this.options.codexCommand,
|
|
33910
33955
|
});
|
|
33911
|
-
|
|
33956
|
+
for (let retryIndex = 0;; retryIndex++) {
|
|
33957
|
+
if (retryIndex > 0) {
|
|
33958
|
+
await ((_a = options.waitForPauseCheckpoint) === null || _a === void 0 ? void 0 : _a.call(options, {
|
|
33959
|
+
checkpointLabel: 'retrying the OpenAI Codex model call after rate limit',
|
|
33960
|
+
phase: 'running',
|
|
33961
|
+
statusMessage: 'Retrying OpenAI Codex after rate limit',
|
|
33962
|
+
}));
|
|
33963
|
+
}
|
|
33912
33964
|
try {
|
|
33913
33965
|
const output = await $runGoScriptUntilMarkerIdle({
|
|
33914
33966
|
scriptPath: options.scriptPath,
|
|
@@ -33935,11 +33987,29 @@ class OpenAiCodexRunner {
|
|
|
33935
33987
|
const retryIndex = this.rateLimitBackoff.retryCount;
|
|
33936
33988
|
const summary = extractFailureSummary(details);
|
|
33937
33989
|
console.warn(colors.yellow(`[codex] Rate limit/quota detected (${summary}). Retry #${retryIndex} in ${formatDelay(delayMs)} at ${retryAt}.`));
|
|
33938
|
-
await
|
|
33990
|
+
await waitForRetryDelay(delayMs, options);
|
|
33939
33991
|
}
|
|
33940
33992
|
}
|
|
33941
33993
|
}
|
|
33942
33994
|
}
|
|
33995
|
+
/**
|
|
33996
|
+
* Waits for the next Codex retry while polling for requested pause checkpoints.
|
|
33997
|
+
*/
|
|
33998
|
+
async function waitForRetryDelay(delayMs, options) {
|
|
33999
|
+
var _a;
|
|
34000
|
+
let remainingDelayMs = delayMs;
|
|
34001
|
+
while (remainingDelayMs > 0) {
|
|
34002
|
+
const remainingDelayLabel = formatDelay(remainingDelayMs);
|
|
34003
|
+
await ((_a = options.waitForPauseCheckpoint) === null || _a === void 0 ? void 0 : _a.call(options, {
|
|
34004
|
+
checkpointLabel: 'the next OpenAI Codex retry after rate limit',
|
|
34005
|
+
phase: 'running',
|
|
34006
|
+
statusMessage: `Waiting ${remainingDelayLabel} before retrying OpenAI Codex`,
|
|
34007
|
+
}));
|
|
34008
|
+
const currentDelayMs = Math.min(RATE_LIMIT_BACKOFF_POLL_MS, remainingDelayMs);
|
|
34009
|
+
await waitFor(currentDelayMs);
|
|
34010
|
+
remainingDelayMs -= currentDelayMs;
|
|
34011
|
+
}
|
|
34012
|
+
}
|
|
33943
34013
|
|
|
33944
34014
|
/**
|
|
33945
34015
|
* Builds the shell script that runs Opencode with the prompt and coding context.
|
|
@@ -34260,6 +34330,10 @@ const MAX_PROMPT_TEST_ATTEMPTS = 3;
|
|
|
34260
34330
|
* Maximum amount of verification output sent back to the coding agent as retry feedback.
|
|
34261
34331
|
*/
|
|
34262
34332
|
const MAX_TEST_FEEDBACK_OUTPUT_CHARS = 12000;
|
|
34333
|
+
/**
|
|
34334
|
+
* File extension used by generated shell scripts.
|
|
34335
|
+
*/
|
|
34336
|
+
const SHELL_SCRIPT_EXTENSION = '.sh';
|
|
34263
34337
|
/**
|
|
34264
34338
|
* Runs one coding prompt and, when configured, verifies it with a shell command that can feed failures back.
|
|
34265
34339
|
*/
|
|
@@ -34268,12 +34342,14 @@ async function runPromptWithTestFeedback(options) {
|
|
|
34268
34342
|
const normalizedTestCommand = (_a = options.testCommand) === null || _a === void 0 ? void 0 : _a.trim();
|
|
34269
34343
|
if (!normalizedTestCommand) {
|
|
34270
34344
|
(_b = options.onAttemptStarted) === null || _b === void 0 ? void 0 : _b.call(options, 1);
|
|
34345
|
+
await waitForPromptAttemptPauseCheckpoint(options.waitForPauseCheckpoint, options.runner.name, 1);
|
|
34271
34346
|
const result = await options.runner.runPrompt({
|
|
34272
34347
|
prompt: options.prompt,
|
|
34273
34348
|
scriptPath: options.scriptPath,
|
|
34274
34349
|
projectPath: options.projectPath,
|
|
34275
34350
|
logPath: options.logPath,
|
|
34276
34351
|
preserveArtifactsOnSuccess: options.preserveArtifactsOnSuccess,
|
|
34352
|
+
waitForPauseCheckpoint: options.waitForPauseCheckpoint,
|
|
34277
34353
|
});
|
|
34278
34354
|
return { ...result, attemptCount: 1 };
|
|
34279
34355
|
}
|
|
@@ -34281,13 +34357,16 @@ async function runPromptWithTestFeedback(options) {
|
|
|
34281
34357
|
let promptForCurrentAttempt = options.prompt;
|
|
34282
34358
|
for (let attemptCount = 1; attemptCount <= MAX_PROMPT_TEST_ATTEMPTS; attemptCount++) {
|
|
34283
34359
|
(_d = options.onAttemptStarted) === null || _d === void 0 ? void 0 : _d.call(options, attemptCount);
|
|
34360
|
+
await waitForPromptAttemptPauseCheckpoint(options.waitForPauseCheckpoint, options.runner.name, attemptCount);
|
|
34284
34361
|
const result = await options.runner.runPrompt({
|
|
34285
34362
|
prompt: promptForCurrentAttempt,
|
|
34286
34363
|
scriptPath: options.scriptPath,
|
|
34287
34364
|
projectPath: options.projectPath,
|
|
34288
34365
|
logPath: options.logPath,
|
|
34289
34366
|
preserveArtifactsOnSuccess: options.preserveArtifactsOnSuccess,
|
|
34367
|
+
waitForPauseCheckpoint: options.waitForPauseCheckpoint,
|
|
34290
34368
|
});
|
|
34369
|
+
await waitForVerificationPauseCheckpoint(options.waitForPauseCheckpoint, normalizedTestCommand, attemptCount);
|
|
34291
34370
|
console.info(colors.gray(`Running verification command after attempt #${attemptCount}: ${normalizedTestCommand}`));
|
|
34292
34371
|
try {
|
|
34293
34372
|
await runPromptTestCommandExecutor({
|
|
@@ -34321,6 +34400,44 @@ async function runPromptWithTestFeedback(options) {
|
|
|
34321
34400
|
}
|
|
34322
34401
|
throw new Error('Unexpected prompt verification state.');
|
|
34323
34402
|
}
|
|
34403
|
+
/**
|
|
34404
|
+
* Waits for a pause checkpoint immediately before one model attempt begins.
|
|
34405
|
+
*/
|
|
34406
|
+
async function waitForPromptAttemptPauseCheckpoint(waitForPauseCheckpoint, runnerName, attemptCount) {
|
|
34407
|
+
await (waitForPauseCheckpoint === null || waitForPauseCheckpoint === void 0 ? void 0 : waitForPauseCheckpoint({
|
|
34408
|
+
checkpointLabel: buildPromptAttemptPauseLabel(runnerName, attemptCount),
|
|
34409
|
+
phase: 'running',
|
|
34410
|
+
statusMessage: buildPromptAttemptStatusMessage(runnerName, attemptCount),
|
|
34411
|
+
}));
|
|
34412
|
+
}
|
|
34413
|
+
/**
|
|
34414
|
+
* Waits for a pause checkpoint immediately before one verification command begins.
|
|
34415
|
+
*/
|
|
34416
|
+
async function waitForVerificationPauseCheckpoint(waitForPauseCheckpoint, testCommand, attemptCount) {
|
|
34417
|
+
await (waitForPauseCheckpoint === null || waitForPauseCheckpoint === void 0 ? void 0 : waitForPauseCheckpoint({
|
|
34418
|
+
checkpointLabel: buildVerificationPauseLabel(attemptCount),
|
|
34419
|
+
phase: 'verifying',
|
|
34420
|
+
statusMessage: `Running verification after attempt #${attemptCount}: ${testCommand}`,
|
|
34421
|
+
}));
|
|
34422
|
+
}
|
|
34423
|
+
/**
|
|
34424
|
+
* Builds the human-readable pause label used before one runner attempt begins.
|
|
34425
|
+
*/
|
|
34426
|
+
function buildPromptAttemptPauseLabel(runnerName, attemptCount) {
|
|
34427
|
+
return `calling ${runnerName} (attempt ${attemptCount})`;
|
|
34428
|
+
}
|
|
34429
|
+
/**
|
|
34430
|
+
* Builds the status line shown while one runner attempt is about to start.
|
|
34431
|
+
*/
|
|
34432
|
+
function buildPromptAttemptStatusMessage(runnerName, attemptCount) {
|
|
34433
|
+
return `Calling ${runnerName} (attempt ${attemptCount})`;
|
|
34434
|
+
}
|
|
34435
|
+
/**
|
|
34436
|
+
* Builds the human-readable pause label used before one verification command begins.
|
|
34437
|
+
*/
|
|
34438
|
+
function buildVerificationPauseLabel(attemptCount) {
|
|
34439
|
+
return `running verification after attempt #${attemptCount}`;
|
|
34440
|
+
}
|
|
34324
34441
|
/**
|
|
34325
34442
|
* Builds one feedback block appended to the next coding attempt after tests fail.
|
|
34326
34443
|
*/
|
|
@@ -34370,8 +34487,8 @@ function limitVerificationOutputForFeedback(verificationOutput) {
|
|
|
34370
34487
|
* Derives a dedicated temp-script path for verification commands.
|
|
34371
34488
|
*/
|
|
34372
34489
|
function buildPromptTestScriptPath(scriptPath) {
|
|
34373
|
-
if (scriptPath.toLowerCase().endsWith(
|
|
34374
|
-
return `${scriptPath.slice(0, -
|
|
34490
|
+
if (scriptPath.toLowerCase().endsWith(SHELL_SCRIPT_EXTENSION)) {
|
|
34491
|
+
return `${scriptPath.slice(0, -SHELL_SCRIPT_EXTENSION.length)}.test.sh`;
|
|
34375
34492
|
}
|
|
34376
34493
|
return `${scriptPath}.test.sh`;
|
|
34377
34494
|
}
|
|
@@ -34562,7 +34679,7 @@ function buildAgentRunUiFrame(options) {
|
|
|
34562
34679
|
const totalWidth = Math.max(MIN_FRAME_WIDTH, Math.min(options.terminalWidth, MAX_FRAME_WIDTH));
|
|
34563
34680
|
const isPromptActive = options.phase === 'running' || options.phase === 'verifying' || options.phase === 'loading';
|
|
34564
34681
|
const promptStatusPrefix = isPromptActive ? `${colors.yellow(`${options.spinner} `)}` : '';
|
|
34565
|
-
const pausePresentation = buildPausePresentation(options.phase, options.pauseState, options.statusMessage);
|
|
34682
|
+
const pausePresentation = buildPausePresentation(options.phase, options.pauseState, options.pauseTargetLabel, options.statusMessage);
|
|
34566
34683
|
const sessionLines = buildSessionLines(options, totalWidth, pausePresentation);
|
|
34567
34684
|
const agentStatusLines = buildAgentStatusTableLines(options, totalWidth);
|
|
34568
34685
|
const currentTaskLines = options.currentPromptLabel
|
|
@@ -68802,8 +68919,12 @@ async function runPromptRound({ options, runner, runnerMetadata, nextPrompt, pro
|
|
|
68802
68919
|
const commitMessage = buildCommitMessage(nextPrompt.file, nextPrompt.section);
|
|
68803
68920
|
const codexPrompt = appendCoderContext(buildCodexPrompt(nextPrompt.file, nextPrompt.section), resolvedCoderContext);
|
|
68804
68921
|
const scriptPath = buildScriptPath(nextPrompt.file, nextPrompt.section);
|
|
68805
|
-
await waitForRequestedPause();
|
|
68806
68922
|
setPromptRoundRunningState({ isRichUiEnabled, promptLabel, scriptPath, uiHandle });
|
|
68923
|
+
await waitForRequestedPause({
|
|
68924
|
+
checkpointLabel: 'preparing the current prompt execution',
|
|
68925
|
+
phase: 'running',
|
|
68926
|
+
statusMessage: 'Preparing prompt execution',
|
|
68927
|
+
});
|
|
68807
68928
|
const promptExecutionStartedDate = moment();
|
|
68808
68929
|
let attemptCount = 1;
|
|
68809
68930
|
const roundChangedFilesSnapshot = options.normalizeLineEndings
|
|
@@ -68824,11 +68945,8 @@ async function runPromptRound({ options, runner, runnerMetadata, nextPrompt, pro
|
|
|
68824
68945
|
onAttemptStarted: (nextAttemptCount) => {
|
|
68825
68946
|
attemptCount = nextAttemptCount;
|
|
68826
68947
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setAttempt(nextAttemptCount);
|
|
68827
|
-
if (nextAttemptCount > 1) {
|
|
68828
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(`Retrying (attempt ${nextAttemptCount})`);
|
|
68829
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('verifying');
|
|
68830
|
-
}
|
|
68831
68948
|
},
|
|
68949
|
+
waitForPauseCheckpoint: waitForRequestedPause,
|
|
68832
68950
|
});
|
|
68833
68951
|
await finalizeSuccessfulPromptRound({
|
|
68834
68952
|
options,
|
|
@@ -68842,6 +68960,7 @@ async function runPromptRound({ options, runner, runnerMetadata, nextPrompt, pro
|
|
|
68842
68960
|
isRichUiEnabled,
|
|
68843
68961
|
progressDisplay,
|
|
68844
68962
|
uiHandle,
|
|
68963
|
+
waitForRequestedPause,
|
|
68845
68964
|
});
|
|
68846
68965
|
}
|
|
68847
68966
|
catch (error) {
|
|
@@ -68854,6 +68973,7 @@ async function runPromptRound({ options, runner, runnerMetadata, nextPrompt, pro
|
|
|
68854
68973
|
options,
|
|
68855
68974
|
roundChangedFilesSnapshot,
|
|
68856
68975
|
uiHandle,
|
|
68976
|
+
waitForRequestedPause,
|
|
68857
68977
|
});
|
|
68858
68978
|
throw error;
|
|
68859
68979
|
}
|
|
@@ -68877,9 +68997,13 @@ function setPromptRoundRunningState(options) {
|
|
|
68877
68997
|
* Finalizes a successful prompt round, including prompt bookkeeping and commit flow.
|
|
68878
68998
|
*/
|
|
68879
68999
|
async function finalizeSuccessfulPromptRound(options) {
|
|
68880
|
-
const { options: runOptions, nextPrompt, runnerMetadata, promptExecutionStartedDate, result, commitMessage, logPath, roundChangedFilesSnapshot, isRichUiEnabled, progressDisplay, uiHandle, } = options;
|
|
69000
|
+
const { options: runOptions, nextPrompt, runnerMetadata, promptExecutionStartedDate, result, commitMessage, logPath, roundChangedFilesSnapshot, isRichUiEnabled, progressDisplay, uiHandle, waitForRequestedPause, } = options;
|
|
68881
69001
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.stopCapturingAgentOutput();
|
|
68882
|
-
|
|
69002
|
+
await waitForRequestedPause({
|
|
69003
|
+
checkpointLabel: 'recording the successful prompt result',
|
|
69004
|
+
phase: 'running',
|
|
69005
|
+
statusMessage: 'Recording prompt result',
|
|
69006
|
+
});
|
|
68883
69007
|
markPromptDone(nextPrompt.file, nextPrompt.section, result.usage, runnerMetadata.runnerName, runnerMetadata.modelName, promptExecutionStartedDate, result.attemptCount);
|
|
68884
69008
|
await writePromptFile(nextPrompt.file);
|
|
68885
69009
|
await normalizeLineEndingsForCurrentRound(runOptions, roundChangedFilesSnapshot);
|
|
@@ -68891,22 +69015,42 @@ async function finalizeSuccessfulPromptRound(options) {
|
|
|
68891
69015
|
progressDisplay,
|
|
68892
69016
|
uiHandle,
|
|
68893
69017
|
});
|
|
69018
|
+
await waitForRequestedPause({
|
|
69019
|
+
checkpointLabel: 'committing the successful changes',
|
|
69020
|
+
phase: 'running',
|
|
69021
|
+
statusMessage: 'Committing changes',
|
|
69022
|
+
});
|
|
68894
69023
|
await commitChanges(commitMessage, {
|
|
68895
69024
|
autoPush: runOptions.autoPush,
|
|
68896
69025
|
// Keep the live runtime log out of default commits because it is deleted after a successful round.
|
|
68897
69026
|
excludePaths: runOptions.preserveLogs ? undefined : [logPath],
|
|
68898
69027
|
});
|
|
68899
69028
|
}
|
|
69029
|
+
else {
|
|
69030
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage('Leaving changes uncommitted');
|
|
69031
|
+
}
|
|
69032
|
+
if (runOptions.autoMigrate) {
|
|
69033
|
+
await waitForRequestedPause({
|
|
69034
|
+
checkpointLabel: 'running testing-server auto-migration',
|
|
69035
|
+
phase: 'running',
|
|
69036
|
+
statusMessage: 'Running testing-server auto-migration',
|
|
69037
|
+
});
|
|
69038
|
+
}
|
|
68900
69039
|
await runPostPromptAutoMigrationIfEnabled(runOptions);
|
|
68901
69040
|
}
|
|
68902
69041
|
/**
|
|
68903
69042
|
* Finalizes a failed prompt round, persisting prompt failure metadata before rethrowing.
|
|
68904
69043
|
*/
|
|
68905
69044
|
async function finalizeFailedPromptRound(options) {
|
|
68906
|
-
const { nextPrompt, runnerMetadata, promptExecutionStartedDate, attemptCount, error, options: runOptions, roundChangedFilesSnapshot, uiHandle, } = options;
|
|
69045
|
+
const { nextPrompt, runnerMetadata, promptExecutionStartedDate, attemptCount, error, options: runOptions, roundChangedFilesSnapshot, uiHandle, waitForRequestedPause, } = options;
|
|
68907
69046
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.stopCapturingAgentOutput();
|
|
68908
69047
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('error');
|
|
68909
69048
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.addError(error instanceof Error ? error.message : String(error));
|
|
69049
|
+
await waitForRequestedPause({
|
|
69050
|
+
checkpointLabel: 'recording the prompt failure',
|
|
69051
|
+
phase: 'error',
|
|
69052
|
+
statusMessage: 'Recording prompt failure',
|
|
69053
|
+
});
|
|
68910
69054
|
markPromptFailed(nextPrompt.file, nextPrompt.section, runnerMetadata.runnerName, runnerMetadata.modelName, promptExecutionStartedDate, attemptCount);
|
|
68911
69055
|
await writePromptFile(nextPrompt.file);
|
|
68912
69056
|
await writePromptErrorLog({
|
|
@@ -68941,6 +69085,8 @@ async function waitForCommitConfirmationIfNeeded(options) {
|
|
|
68941
69085
|
}
|
|
68942
69086
|
progressDisplay === null || progressDisplay === void 0 ? void 0 : progressDisplay.resumeTimer();
|
|
68943
69087
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.resumeTimer();
|
|
69088
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('running');
|
|
69089
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage('Committing changes');
|
|
68944
69090
|
}
|
|
68945
69091
|
/**
|
|
68946
69092
|
* Formats commit preview lines for the rich terminal UI.
|
|
@@ -69013,11 +69159,21 @@ async function runCodexPrompts(providedOptions) {
|
|
|
69013
69159
|
let hasShownUpcomingTasks = false;
|
|
69014
69160
|
let hasWaitedForStart = false;
|
|
69015
69161
|
while (just(true)) {
|
|
69016
|
-
|
|
69162
|
+
if (options.autoPull && !options.dryRun) {
|
|
69163
|
+
await waitForRequestedPause({
|
|
69164
|
+
checkpointLabel: 'pulling the latest repository changes',
|
|
69165
|
+
phase: 'loading',
|
|
69166
|
+
statusMessage: 'Pulling latest changes...',
|
|
69167
|
+
});
|
|
69168
|
+
}
|
|
69017
69169
|
await pullLatestChangesIfEnabled({
|
|
69018
69170
|
options,
|
|
69019
69171
|
isRichUiEnabled,
|
|
69020
|
-
|
|
69172
|
+
});
|
|
69173
|
+
await waitForRequestedPause({
|
|
69174
|
+
checkpointLabel: 'loading prompts',
|
|
69175
|
+
phase: 'loading',
|
|
69176
|
+
statusMessage: 'Loading prompts...',
|
|
69021
69177
|
});
|
|
69022
69178
|
const promptQueueSnapshot = await loadPromptQueueSnapshot({
|
|
69023
69179
|
options,
|
|
@@ -69047,6 +69203,11 @@ async function runCodexPrompts(providedOptions) {
|
|
|
69047
69203
|
uiHandle,
|
|
69048
69204
|
});
|
|
69049
69205
|
if (!options.ignoreGitChanges) {
|
|
69206
|
+
await waitForRequestedPause({
|
|
69207
|
+
checkpointLabel: 'checking the git working tree',
|
|
69208
|
+
phase: 'loading',
|
|
69209
|
+
statusMessage: 'Checking the working tree...',
|
|
69210
|
+
});
|
|
69050
69211
|
await ensureWorkingTreeClean();
|
|
69051
69212
|
}
|
|
69052
69213
|
await runPromptRound({
|
|
@@ -69095,12 +69256,10 @@ function validateRunCodexPromptOptions(options) {
|
|
|
69095
69256
|
* Pulls the latest repository state before loading prompts when the feature is enabled.
|
|
69096
69257
|
*/
|
|
69097
69258
|
async function pullLatestChangesIfEnabled(options) {
|
|
69098
|
-
const { options: runOptions, isRichUiEnabled
|
|
69259
|
+
const { options: runOptions, isRichUiEnabled } = options;
|
|
69099
69260
|
if (!runOptions.autoPull || runOptions.dryRun) {
|
|
69100
69261
|
return;
|
|
69101
69262
|
}
|
|
69102
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('loading');
|
|
69103
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage('Pulling latest changes...');
|
|
69104
69263
|
if (!isRichUiEnabled) {
|
|
69105
69264
|
console.info(colors.gray('Pulling latest changes before the next prompt...'));
|
|
69106
69265
|
}
|
|
@@ -69124,22 +69283,26 @@ function createRunDisplays(options, runStartDate) {
|
|
|
69124
69283
|
*/
|
|
69125
69284
|
function createPauseWaiter(options) {
|
|
69126
69285
|
const { isRichUiEnabled, progressDisplay, uiHandle } = options;
|
|
69127
|
-
return async () => {
|
|
69286
|
+
return async (checkpoint) => {
|
|
69287
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase(checkpoint.phase);
|
|
69288
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(checkpoint.statusMessage);
|
|
69289
|
+
announcePauseTargetLabel(checkpoint.checkpointLabel);
|
|
69128
69290
|
await checkPause({
|
|
69129
69291
|
silent: isRichUiEnabled,
|
|
69130
69292
|
onPaused: () => {
|
|
69131
69293
|
progressDisplay === null || progressDisplay === void 0 ? void 0 : progressDisplay.pauseTimer();
|
|
69132
69294
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.pauseTimer();
|
|
69133
69295
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('paused');
|
|
69134
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(
|
|
69296
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(`Paused before ${checkpoint.checkpointLabel}`);
|
|
69135
69297
|
},
|
|
69136
69298
|
onResumed: () => {
|
|
69137
69299
|
progressDisplay === null || progressDisplay === void 0 ? void 0 : progressDisplay.resumeTimer();
|
|
69138
69300
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.resumeTimer();
|
|
69139
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase(
|
|
69140
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(
|
|
69301
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase(checkpoint.phase);
|
|
69302
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(checkpoint.statusMessage);
|
|
69141
69303
|
},
|
|
69142
69304
|
});
|
|
69305
|
+
resetPauseTargetLabel();
|
|
69143
69306
|
};
|
|
69144
69307
|
}
|
|
69145
69308
|
/**
|
|
@@ -69184,11 +69347,7 @@ function initializeRunUi(uiHandle, runnerName, actualRunnerModel, options) {
|
|
|
69184
69347
|
*/
|
|
69185
69348
|
async function loadPromptQueueSnapshot(options) {
|
|
69186
69349
|
const { options: runOptions, isRichUiEnabled, progressDisplay, uiHandle } = options;
|
|
69187
|
-
|
|
69188
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setCurrentScriptPath(undefined);
|
|
69189
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('loading');
|
|
69190
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage('Loading prompts...');
|
|
69191
|
-
}
|
|
69350
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setCurrentScriptPath(undefined);
|
|
69192
69351
|
const promptFiles = await loadPromptFiles(PROMPTS_DIR$1);
|
|
69193
69352
|
const stats = summarizePrompts(promptFiles, runOptions.priority);
|
|
69194
69353
|
progressDisplay === null || progressDisplay === void 0 ? void 0 : progressDisplay.update(stats);
|