@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/src/version.ts
CHANGED
|
@@ -16,11 +16,11 @@ export const BOOK_LANGUAGE_VERSION: string_semantic_version = '2.0.0';
|
|
|
16
16
|
* @generated
|
|
17
17
|
* @see https://github.com/webgptorg/promptbook
|
|
18
18
|
*/
|
|
19
|
-
export const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version = '0.112.0-
|
|
19
|
+
export const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version = '0.112.0-103';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Represents the version string of the Promptbook engine.
|
|
23
|
-
* It follows semantic versioning (e.g., `0.112.0-
|
|
23
|
+
* It follows semantic versioning (e.g., `0.112.0-102`).
|
|
24
24
|
*
|
|
25
25
|
* @generated
|
|
26
26
|
*/
|
package/src/versions.txt
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
* @generated
|
|
61
61
|
* @see https://github.com/webgptorg/promptbook
|
|
62
62
|
*/
|
|
63
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
63
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-103';
|
|
64
64
|
/**
|
|
65
65
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
66
66
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3617,16 +3617,30 @@
|
|
|
3617
3617
|
// Note: [🟡] Code for CLI runtime [buildAgentsServer](src/cli/cli-commands/agents-server/buildAgentsServer.ts) should never be published outside of `@promptbook/cli`
|
|
3618
3618
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3619
3619
|
|
|
3620
|
+
/**
|
|
3621
|
+
* Default label used before the next pause checkpoint is known.
|
|
3622
|
+
*/
|
|
3623
|
+
const DEFAULT_PAUSE_TARGET_LABEL = 'the next task';
|
|
3620
3624
|
/**
|
|
3621
3625
|
* Current pause state.
|
|
3622
3626
|
*/
|
|
3623
3627
|
let pauseState = 'RUNNING';
|
|
3628
|
+
/**
|
|
3629
|
+
* Label of the next checkpoint where the requested pause will take effect.
|
|
3630
|
+
*/
|
|
3631
|
+
let pauseTargetLabel = DEFAULT_PAUSE_TARGET_LABEL;
|
|
3624
3632
|
/**
|
|
3625
3633
|
* Stores one new pause state in the shared runner controller.
|
|
3626
3634
|
*/
|
|
3627
3635
|
function setPauseState(nextPauseState) {
|
|
3628
3636
|
pauseState = nextPauseState;
|
|
3629
3637
|
}
|
|
3638
|
+
/**
|
|
3639
|
+
* Stores one new pause target label in the shared runner controller.
|
|
3640
|
+
*/
|
|
3641
|
+
function setPauseTargetLabel(nextPauseTargetLabel) {
|
|
3642
|
+
pauseTargetLabel = nextPauseTargetLabel.trim() || DEFAULT_PAUSE_TARGET_LABEL;
|
|
3643
|
+
}
|
|
3630
3644
|
/**
|
|
3631
3645
|
* Applies the same three-state toggle used by the `P` hotkey.
|
|
3632
3646
|
*/
|
|
@@ -3637,9 +3651,11 @@
|
|
|
3637
3651
|
}
|
|
3638
3652
|
if (pauseState === 'PAUSING') {
|
|
3639
3653
|
setPauseState('RUNNING');
|
|
3654
|
+
resetPauseTargetLabel();
|
|
3640
3655
|
return 'CANCELLED_PAUSE';
|
|
3641
3656
|
}
|
|
3642
3657
|
setPauseState('RUNNING');
|
|
3658
|
+
resetPauseTargetLabel();
|
|
3643
3659
|
return 'RESUMED';
|
|
3644
3660
|
}
|
|
3645
3661
|
/**
|
|
@@ -3680,7 +3696,8 @@
|
|
|
3680
3696
|
if (pauseState === 'PAUSING') {
|
|
3681
3697
|
setPauseState('PAUSED');
|
|
3682
3698
|
if (!(options === null || options === void 0 ? void 0 : options.silent)) {
|
|
3683
|
-
console.log(colors__default["default"].bgWhite.black(
|
|
3699
|
+
console.log(colors__default["default"].bgWhite.black(`Paused before ${getPauseTargetLabel()}`) +
|
|
3700
|
+
colors__default["default"].gray(' (Press "p" to resume)'));
|
|
3684
3701
|
}
|
|
3685
3702
|
(_a = options === null || options === void 0 ? void 0 : options.onPaused) === null || _a === void 0 ? void 0 : _a.call(options);
|
|
3686
3703
|
while (getPauseState() === 'PAUSED') {
|
|
@@ -3698,6 +3715,24 @@
|
|
|
3698
3715
|
function getPauseState() {
|
|
3699
3716
|
return pauseState;
|
|
3700
3717
|
}
|
|
3718
|
+
/**
|
|
3719
|
+
* Returns the label of the next checkpoint where pausing will take effect.
|
|
3720
|
+
*/
|
|
3721
|
+
function getPauseTargetLabel() {
|
|
3722
|
+
return pauseTargetLabel;
|
|
3723
|
+
}
|
|
3724
|
+
/**
|
|
3725
|
+
* Updates the label of the next pause checkpoint.
|
|
3726
|
+
*/
|
|
3727
|
+
function announcePauseTargetLabel(nextPauseTargetLabel) {
|
|
3728
|
+
setPauseTargetLabel(nextPauseTargetLabel);
|
|
3729
|
+
}
|
|
3730
|
+
/**
|
|
3731
|
+
* Restores the default generic pause target label.
|
|
3732
|
+
*/
|
|
3733
|
+
function resetPauseTargetLabel() {
|
|
3734
|
+
setPauseTargetLabel(DEFAULT_PAUSE_TARGET_LABEL);
|
|
3735
|
+
}
|
|
3701
3736
|
|
|
3702
3737
|
/**
|
|
3703
3738
|
* Just says that the variable is not used but should be kept
|
|
@@ -3935,18 +3970,18 @@
|
|
|
3935
3970
|
/**
|
|
3936
3971
|
* Builds the colored phase badge shown in the session box.
|
|
3937
3972
|
*/
|
|
3938
|
-
function buildPausePresentation(phase, pauseState, statusMessage) {
|
|
3973
|
+
function buildPausePresentation(phase, pauseState, pauseTargetLabel, statusMessage) {
|
|
3939
3974
|
if (pauseState === 'PAUSING') {
|
|
3940
3975
|
return {
|
|
3941
3976
|
badge: colors__default["default"].bgYellow.black(' PAUSING '),
|
|
3942
|
-
stateMessage:
|
|
3977
|
+
stateMessage: `Pausing before ${pauseTargetLabel}`,
|
|
3943
3978
|
pauseControl: colors__default["default"].bgMagenta.white(' P ') + colors__default["default"].white(' Cancel pause'),
|
|
3944
3979
|
};
|
|
3945
3980
|
}
|
|
3946
3981
|
if (pauseState === 'PAUSED') {
|
|
3947
3982
|
return {
|
|
3948
3983
|
badge: colors__default["default"].bgWhite.black(' PAUSED '),
|
|
3949
|
-
stateMessage:
|
|
3984
|
+
stateMessage: `Paused before ${pauseTargetLabel}`,
|
|
3950
3985
|
pauseControl: colors__default["default"].bgGreen.black(' P ') + colors__default["default"].white(' Resume'),
|
|
3951
3986
|
};
|
|
3952
3987
|
}
|
|
@@ -4078,7 +4113,7 @@
|
|
|
4078
4113
|
const octopusAnimationFrame = isCoderRunUiAutoRefreshing(options.phase, options.pauseState)
|
|
4079
4114
|
? options.animationFrame
|
|
4080
4115
|
: 0;
|
|
4081
|
-
const pausePresentation = buildPausePresentation(options.phase, options.pauseState, options.statusMessage);
|
|
4116
|
+
const pausePresentation = buildPausePresentation(options.phase, options.pauseState, options.pauseTargetLabel, options.statusMessage);
|
|
4082
4117
|
const sessionLines = buildSessionLines$1(options, totalWidth, pausePresentation);
|
|
4083
4118
|
const currentTaskLines = options.currentPromptLabel
|
|
4084
4119
|
? [
|
|
@@ -4706,6 +4741,7 @@
|
|
|
4706
4741
|
animationFrame: spinnerFrame,
|
|
4707
4742
|
spinner: SPINNER_FRAMES[spinnerFrame],
|
|
4708
4743
|
pauseState: getPauseState(),
|
|
4744
|
+
pauseTargetLabel: getPauseTargetLabel(),
|
|
4709
4745
|
config: state.config,
|
|
4710
4746
|
phase: state.phase,
|
|
4711
4747
|
currentPromptLabel: state.currentPromptLabel,
|
|
@@ -33839,6 +33875,14 @@
|
|
|
33839
33875
|
* Idle timeout after completion marker to capture trailing output.
|
|
33840
33876
|
*/
|
|
33841
33877
|
const CODEX_COMPLETION_IDLE_MS = 60 * 1000;
|
|
33878
|
+
/**
|
|
33879
|
+
* Number of seconds in one hour.
|
|
33880
|
+
*/
|
|
33881
|
+
const SECONDS_PER_HOUR = 60 * 60;
|
|
33882
|
+
/**
|
|
33883
|
+
* Poll interval used while waiting for the next rate-limit retry so pause requests can be honored promptly.
|
|
33884
|
+
*/
|
|
33885
|
+
const RATE_LIMIT_BACKOFF_POLL_MS = 1000;
|
|
33842
33886
|
/**
|
|
33843
33887
|
* Maximum delay between retries while rate-limited.
|
|
33844
33888
|
*/
|
|
@@ -33858,8 +33902,8 @@
|
|
|
33858
33902
|
*/
|
|
33859
33903
|
function formatDelay(delayMs) {
|
|
33860
33904
|
const totalSeconds = Math.max(0, Math.round(delayMs / 1000));
|
|
33861
|
-
const hours = Math.floor(totalSeconds /
|
|
33862
|
-
const minutes = Math.floor((totalSeconds %
|
|
33905
|
+
const hours = Math.floor(totalSeconds / SECONDS_PER_HOUR);
|
|
33906
|
+
const minutes = Math.floor((totalSeconds % SECONDS_PER_HOUR) / 60);
|
|
33863
33907
|
const seconds = totalSeconds % 60;
|
|
33864
33908
|
const parts = [];
|
|
33865
33909
|
if (hours > 0) {
|
|
@@ -33900,6 +33944,7 @@
|
|
|
33900
33944
|
* Runs the Codex prompt in a temporary script and waits for completion output.
|
|
33901
33945
|
*/
|
|
33902
33946
|
async runPrompt(options) {
|
|
33947
|
+
var _a;
|
|
33903
33948
|
const scriptContent = buildCodexScript({
|
|
33904
33949
|
prompt: options.prompt,
|
|
33905
33950
|
projectPath: options.projectPath,
|
|
@@ -33910,7 +33955,14 @@
|
|
|
33910
33955
|
allowCredits: this.options.allowCredits,
|
|
33911
33956
|
codexCommand: this.options.codexCommand,
|
|
33912
33957
|
});
|
|
33913
|
-
|
|
33958
|
+
for (let retryIndex = 0;; retryIndex++) {
|
|
33959
|
+
if (retryIndex > 0) {
|
|
33960
|
+
await ((_a = options.waitForPauseCheckpoint) === null || _a === void 0 ? void 0 : _a.call(options, {
|
|
33961
|
+
checkpointLabel: 'retrying the OpenAI Codex model call after rate limit',
|
|
33962
|
+
phase: 'running',
|
|
33963
|
+
statusMessage: 'Retrying OpenAI Codex after rate limit',
|
|
33964
|
+
}));
|
|
33965
|
+
}
|
|
33914
33966
|
try {
|
|
33915
33967
|
const output = await $runGoScriptUntilMarkerIdle({
|
|
33916
33968
|
scriptPath: options.scriptPath,
|
|
@@ -33937,11 +33989,29 @@
|
|
|
33937
33989
|
const retryIndex = this.rateLimitBackoff.retryCount;
|
|
33938
33990
|
const summary = extractFailureSummary(details);
|
|
33939
33991
|
console.warn(colors__default["default"].yellow(`[codex] Rate limit/quota detected (${summary}). Retry #${retryIndex} in ${formatDelay(delayMs)} at ${retryAt}.`));
|
|
33940
|
-
await
|
|
33992
|
+
await waitForRetryDelay(delayMs, options);
|
|
33941
33993
|
}
|
|
33942
33994
|
}
|
|
33943
33995
|
}
|
|
33944
33996
|
}
|
|
33997
|
+
/**
|
|
33998
|
+
* Waits for the next Codex retry while polling for requested pause checkpoints.
|
|
33999
|
+
*/
|
|
34000
|
+
async function waitForRetryDelay(delayMs, options) {
|
|
34001
|
+
var _a;
|
|
34002
|
+
let remainingDelayMs = delayMs;
|
|
34003
|
+
while (remainingDelayMs > 0) {
|
|
34004
|
+
const remainingDelayLabel = formatDelay(remainingDelayMs);
|
|
34005
|
+
await ((_a = options.waitForPauseCheckpoint) === null || _a === void 0 ? void 0 : _a.call(options, {
|
|
34006
|
+
checkpointLabel: 'the next OpenAI Codex retry after rate limit',
|
|
34007
|
+
phase: 'running',
|
|
34008
|
+
statusMessage: `Waiting ${remainingDelayLabel} before retrying OpenAI Codex`,
|
|
34009
|
+
}));
|
|
34010
|
+
const currentDelayMs = Math.min(RATE_LIMIT_BACKOFF_POLL_MS, remainingDelayMs);
|
|
34011
|
+
await waitFor(currentDelayMs);
|
|
34012
|
+
remainingDelayMs -= currentDelayMs;
|
|
34013
|
+
}
|
|
34014
|
+
}
|
|
33945
34015
|
|
|
33946
34016
|
/**
|
|
33947
34017
|
* Builds the shell script that runs Opencode with the prompt and coding context.
|
|
@@ -34262,6 +34332,10 @@
|
|
|
34262
34332
|
* Maximum amount of verification output sent back to the coding agent as retry feedback.
|
|
34263
34333
|
*/
|
|
34264
34334
|
const MAX_TEST_FEEDBACK_OUTPUT_CHARS = 12000;
|
|
34335
|
+
/**
|
|
34336
|
+
* File extension used by generated shell scripts.
|
|
34337
|
+
*/
|
|
34338
|
+
const SHELL_SCRIPT_EXTENSION = '.sh';
|
|
34265
34339
|
/**
|
|
34266
34340
|
* Runs one coding prompt and, when configured, verifies it with a shell command that can feed failures back.
|
|
34267
34341
|
*/
|
|
@@ -34270,12 +34344,14 @@
|
|
|
34270
34344
|
const normalizedTestCommand = (_a = options.testCommand) === null || _a === void 0 ? void 0 : _a.trim();
|
|
34271
34345
|
if (!normalizedTestCommand) {
|
|
34272
34346
|
(_b = options.onAttemptStarted) === null || _b === void 0 ? void 0 : _b.call(options, 1);
|
|
34347
|
+
await waitForPromptAttemptPauseCheckpoint(options.waitForPauseCheckpoint, options.runner.name, 1);
|
|
34273
34348
|
const result = await options.runner.runPrompt({
|
|
34274
34349
|
prompt: options.prompt,
|
|
34275
34350
|
scriptPath: options.scriptPath,
|
|
34276
34351
|
projectPath: options.projectPath,
|
|
34277
34352
|
logPath: options.logPath,
|
|
34278
34353
|
preserveArtifactsOnSuccess: options.preserveArtifactsOnSuccess,
|
|
34354
|
+
waitForPauseCheckpoint: options.waitForPauseCheckpoint,
|
|
34279
34355
|
});
|
|
34280
34356
|
return { ...result, attemptCount: 1 };
|
|
34281
34357
|
}
|
|
@@ -34283,13 +34359,16 @@
|
|
|
34283
34359
|
let promptForCurrentAttempt = options.prompt;
|
|
34284
34360
|
for (let attemptCount = 1; attemptCount <= MAX_PROMPT_TEST_ATTEMPTS; attemptCount++) {
|
|
34285
34361
|
(_d = options.onAttemptStarted) === null || _d === void 0 ? void 0 : _d.call(options, attemptCount);
|
|
34362
|
+
await waitForPromptAttemptPauseCheckpoint(options.waitForPauseCheckpoint, options.runner.name, attemptCount);
|
|
34286
34363
|
const result = await options.runner.runPrompt({
|
|
34287
34364
|
prompt: promptForCurrentAttempt,
|
|
34288
34365
|
scriptPath: options.scriptPath,
|
|
34289
34366
|
projectPath: options.projectPath,
|
|
34290
34367
|
logPath: options.logPath,
|
|
34291
34368
|
preserveArtifactsOnSuccess: options.preserveArtifactsOnSuccess,
|
|
34369
|
+
waitForPauseCheckpoint: options.waitForPauseCheckpoint,
|
|
34292
34370
|
});
|
|
34371
|
+
await waitForVerificationPauseCheckpoint(options.waitForPauseCheckpoint, normalizedTestCommand, attemptCount);
|
|
34293
34372
|
console.info(colors__default["default"].gray(`Running verification command after attempt #${attemptCount}: ${normalizedTestCommand}`));
|
|
34294
34373
|
try {
|
|
34295
34374
|
await runPromptTestCommandExecutor({
|
|
@@ -34323,6 +34402,44 @@
|
|
|
34323
34402
|
}
|
|
34324
34403
|
throw new Error('Unexpected prompt verification state.');
|
|
34325
34404
|
}
|
|
34405
|
+
/**
|
|
34406
|
+
* Waits for a pause checkpoint immediately before one model attempt begins.
|
|
34407
|
+
*/
|
|
34408
|
+
async function waitForPromptAttemptPauseCheckpoint(waitForPauseCheckpoint, runnerName, attemptCount) {
|
|
34409
|
+
await (waitForPauseCheckpoint === null || waitForPauseCheckpoint === void 0 ? void 0 : waitForPauseCheckpoint({
|
|
34410
|
+
checkpointLabel: buildPromptAttemptPauseLabel(runnerName, attemptCount),
|
|
34411
|
+
phase: 'running',
|
|
34412
|
+
statusMessage: buildPromptAttemptStatusMessage(runnerName, attemptCount),
|
|
34413
|
+
}));
|
|
34414
|
+
}
|
|
34415
|
+
/**
|
|
34416
|
+
* Waits for a pause checkpoint immediately before one verification command begins.
|
|
34417
|
+
*/
|
|
34418
|
+
async function waitForVerificationPauseCheckpoint(waitForPauseCheckpoint, testCommand, attemptCount) {
|
|
34419
|
+
await (waitForPauseCheckpoint === null || waitForPauseCheckpoint === void 0 ? void 0 : waitForPauseCheckpoint({
|
|
34420
|
+
checkpointLabel: buildVerificationPauseLabel(attemptCount),
|
|
34421
|
+
phase: 'verifying',
|
|
34422
|
+
statusMessage: `Running verification after attempt #${attemptCount}: ${testCommand}`,
|
|
34423
|
+
}));
|
|
34424
|
+
}
|
|
34425
|
+
/**
|
|
34426
|
+
* Builds the human-readable pause label used before one runner attempt begins.
|
|
34427
|
+
*/
|
|
34428
|
+
function buildPromptAttemptPauseLabel(runnerName, attemptCount) {
|
|
34429
|
+
return `calling ${runnerName} (attempt ${attemptCount})`;
|
|
34430
|
+
}
|
|
34431
|
+
/**
|
|
34432
|
+
* Builds the status line shown while one runner attempt is about to start.
|
|
34433
|
+
*/
|
|
34434
|
+
function buildPromptAttemptStatusMessage(runnerName, attemptCount) {
|
|
34435
|
+
return `Calling ${runnerName} (attempt ${attemptCount})`;
|
|
34436
|
+
}
|
|
34437
|
+
/**
|
|
34438
|
+
* Builds the human-readable pause label used before one verification command begins.
|
|
34439
|
+
*/
|
|
34440
|
+
function buildVerificationPauseLabel(attemptCount) {
|
|
34441
|
+
return `running verification after attempt #${attemptCount}`;
|
|
34442
|
+
}
|
|
34326
34443
|
/**
|
|
34327
34444
|
* Builds one feedback block appended to the next coding attempt after tests fail.
|
|
34328
34445
|
*/
|
|
@@ -34372,8 +34489,8 @@
|
|
|
34372
34489
|
* Derives a dedicated temp-script path for verification commands.
|
|
34373
34490
|
*/
|
|
34374
34491
|
function buildPromptTestScriptPath(scriptPath) {
|
|
34375
|
-
if (scriptPath.toLowerCase().endsWith(
|
|
34376
|
-
return `${scriptPath.slice(0, -
|
|
34492
|
+
if (scriptPath.toLowerCase().endsWith(SHELL_SCRIPT_EXTENSION)) {
|
|
34493
|
+
return `${scriptPath.slice(0, -SHELL_SCRIPT_EXTENSION.length)}.test.sh`;
|
|
34377
34494
|
}
|
|
34378
34495
|
return `${scriptPath}.test.sh`;
|
|
34379
34496
|
}
|
|
@@ -34564,7 +34681,7 @@
|
|
|
34564
34681
|
const totalWidth = Math.max(MIN_FRAME_WIDTH, Math.min(options.terminalWidth, MAX_FRAME_WIDTH));
|
|
34565
34682
|
const isPromptActive = options.phase === 'running' || options.phase === 'verifying' || options.phase === 'loading';
|
|
34566
34683
|
const promptStatusPrefix = isPromptActive ? `${colors__default["default"].yellow(`${options.spinner} `)}` : '';
|
|
34567
|
-
const pausePresentation = buildPausePresentation(options.phase, options.pauseState, options.statusMessage);
|
|
34684
|
+
const pausePresentation = buildPausePresentation(options.phase, options.pauseState, options.pauseTargetLabel, options.statusMessage);
|
|
34568
34685
|
const sessionLines = buildSessionLines(options, totalWidth, pausePresentation);
|
|
34569
34686
|
const agentStatusLines = buildAgentStatusTableLines(options, totalWidth);
|
|
34570
34687
|
const currentTaskLines = options.currentPromptLabel
|
|
@@ -68804,8 +68921,12 @@
|
|
|
68804
68921
|
const commitMessage = buildCommitMessage(nextPrompt.file, nextPrompt.section);
|
|
68805
68922
|
const codexPrompt = appendCoderContext(buildCodexPrompt(nextPrompt.file, nextPrompt.section), resolvedCoderContext);
|
|
68806
68923
|
const scriptPath = buildScriptPath(nextPrompt.file, nextPrompt.section);
|
|
68807
|
-
await waitForRequestedPause();
|
|
68808
68924
|
setPromptRoundRunningState({ isRichUiEnabled, promptLabel, scriptPath, uiHandle });
|
|
68925
|
+
await waitForRequestedPause({
|
|
68926
|
+
checkpointLabel: 'preparing the current prompt execution',
|
|
68927
|
+
phase: 'running',
|
|
68928
|
+
statusMessage: 'Preparing prompt execution',
|
|
68929
|
+
});
|
|
68809
68930
|
const promptExecutionStartedDate = moment__default["default"]();
|
|
68810
68931
|
let attemptCount = 1;
|
|
68811
68932
|
const roundChangedFilesSnapshot = options.normalizeLineEndings
|
|
@@ -68826,11 +68947,8 @@
|
|
|
68826
68947
|
onAttemptStarted: (nextAttemptCount) => {
|
|
68827
68948
|
attemptCount = nextAttemptCount;
|
|
68828
68949
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setAttempt(nextAttemptCount);
|
|
68829
|
-
if (nextAttemptCount > 1) {
|
|
68830
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(`Retrying (attempt ${nextAttemptCount})`);
|
|
68831
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('verifying');
|
|
68832
|
-
}
|
|
68833
68950
|
},
|
|
68951
|
+
waitForPauseCheckpoint: waitForRequestedPause,
|
|
68834
68952
|
});
|
|
68835
68953
|
await finalizeSuccessfulPromptRound({
|
|
68836
68954
|
options,
|
|
@@ -68844,6 +68962,7 @@
|
|
|
68844
68962
|
isRichUiEnabled,
|
|
68845
68963
|
progressDisplay,
|
|
68846
68964
|
uiHandle,
|
|
68965
|
+
waitForRequestedPause,
|
|
68847
68966
|
});
|
|
68848
68967
|
}
|
|
68849
68968
|
catch (error) {
|
|
@@ -68856,6 +68975,7 @@
|
|
|
68856
68975
|
options,
|
|
68857
68976
|
roundChangedFilesSnapshot,
|
|
68858
68977
|
uiHandle,
|
|
68978
|
+
waitForRequestedPause,
|
|
68859
68979
|
});
|
|
68860
68980
|
throw error;
|
|
68861
68981
|
}
|
|
@@ -68879,9 +68999,13 @@
|
|
|
68879
68999
|
* Finalizes a successful prompt round, including prompt bookkeeping and commit flow.
|
|
68880
69000
|
*/
|
|
68881
69001
|
async function finalizeSuccessfulPromptRound(options) {
|
|
68882
|
-
const { options: runOptions, nextPrompt, runnerMetadata, promptExecutionStartedDate, result, commitMessage, logPath, roundChangedFilesSnapshot, isRichUiEnabled, progressDisplay, uiHandle, } = options;
|
|
69002
|
+
const { options: runOptions, nextPrompt, runnerMetadata, promptExecutionStartedDate, result, commitMessage, logPath, roundChangedFilesSnapshot, isRichUiEnabled, progressDisplay, uiHandle, waitForRequestedPause, } = options;
|
|
68883
69003
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.stopCapturingAgentOutput();
|
|
68884
|
-
|
|
69004
|
+
await waitForRequestedPause({
|
|
69005
|
+
checkpointLabel: 'recording the successful prompt result',
|
|
69006
|
+
phase: 'running',
|
|
69007
|
+
statusMessage: 'Recording prompt result',
|
|
69008
|
+
});
|
|
68885
69009
|
markPromptDone(nextPrompt.file, nextPrompt.section, result.usage, runnerMetadata.runnerName, runnerMetadata.modelName, promptExecutionStartedDate, result.attemptCount);
|
|
68886
69010
|
await writePromptFile(nextPrompt.file);
|
|
68887
69011
|
await normalizeLineEndingsForCurrentRound(runOptions, roundChangedFilesSnapshot);
|
|
@@ -68893,22 +69017,42 @@
|
|
|
68893
69017
|
progressDisplay,
|
|
68894
69018
|
uiHandle,
|
|
68895
69019
|
});
|
|
69020
|
+
await waitForRequestedPause({
|
|
69021
|
+
checkpointLabel: 'committing the successful changes',
|
|
69022
|
+
phase: 'running',
|
|
69023
|
+
statusMessage: 'Committing changes',
|
|
69024
|
+
});
|
|
68896
69025
|
await commitChanges(commitMessage, {
|
|
68897
69026
|
autoPush: runOptions.autoPush,
|
|
68898
69027
|
// Keep the live runtime log out of default commits because it is deleted after a successful round.
|
|
68899
69028
|
excludePaths: runOptions.preserveLogs ? undefined : [logPath],
|
|
68900
69029
|
});
|
|
68901
69030
|
}
|
|
69031
|
+
else {
|
|
69032
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage('Leaving changes uncommitted');
|
|
69033
|
+
}
|
|
69034
|
+
if (runOptions.autoMigrate) {
|
|
69035
|
+
await waitForRequestedPause({
|
|
69036
|
+
checkpointLabel: 'running testing-server auto-migration',
|
|
69037
|
+
phase: 'running',
|
|
69038
|
+
statusMessage: 'Running testing-server auto-migration',
|
|
69039
|
+
});
|
|
69040
|
+
}
|
|
68902
69041
|
await runPostPromptAutoMigrationIfEnabled(runOptions);
|
|
68903
69042
|
}
|
|
68904
69043
|
/**
|
|
68905
69044
|
* Finalizes a failed prompt round, persisting prompt failure metadata before rethrowing.
|
|
68906
69045
|
*/
|
|
68907
69046
|
async function finalizeFailedPromptRound(options) {
|
|
68908
|
-
const { nextPrompt, runnerMetadata, promptExecutionStartedDate, attemptCount, error, options: runOptions, roundChangedFilesSnapshot, uiHandle, } = options;
|
|
69047
|
+
const { nextPrompt, runnerMetadata, promptExecutionStartedDate, attemptCount, error, options: runOptions, roundChangedFilesSnapshot, uiHandle, waitForRequestedPause, } = options;
|
|
68909
69048
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.stopCapturingAgentOutput();
|
|
68910
69049
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('error');
|
|
68911
69050
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.addError(error instanceof Error ? error.message : String(error));
|
|
69051
|
+
await waitForRequestedPause({
|
|
69052
|
+
checkpointLabel: 'recording the prompt failure',
|
|
69053
|
+
phase: 'error',
|
|
69054
|
+
statusMessage: 'Recording prompt failure',
|
|
69055
|
+
});
|
|
68912
69056
|
markPromptFailed(nextPrompt.file, nextPrompt.section, runnerMetadata.runnerName, runnerMetadata.modelName, promptExecutionStartedDate, attemptCount);
|
|
68913
69057
|
await writePromptFile(nextPrompt.file);
|
|
68914
69058
|
await writePromptErrorLog({
|
|
@@ -68943,6 +69087,8 @@
|
|
|
68943
69087
|
}
|
|
68944
69088
|
progressDisplay === null || progressDisplay === void 0 ? void 0 : progressDisplay.resumeTimer();
|
|
68945
69089
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.resumeTimer();
|
|
69090
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('running');
|
|
69091
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage('Committing changes');
|
|
68946
69092
|
}
|
|
68947
69093
|
/**
|
|
68948
69094
|
* Formats commit preview lines for the rich terminal UI.
|
|
@@ -69015,11 +69161,21 @@
|
|
|
69015
69161
|
let hasShownUpcomingTasks = false;
|
|
69016
69162
|
let hasWaitedForStart = false;
|
|
69017
69163
|
while (just(true)) {
|
|
69018
|
-
|
|
69164
|
+
if (options.autoPull && !options.dryRun) {
|
|
69165
|
+
await waitForRequestedPause({
|
|
69166
|
+
checkpointLabel: 'pulling the latest repository changes',
|
|
69167
|
+
phase: 'loading',
|
|
69168
|
+
statusMessage: 'Pulling latest changes...',
|
|
69169
|
+
});
|
|
69170
|
+
}
|
|
69019
69171
|
await pullLatestChangesIfEnabled({
|
|
69020
69172
|
options,
|
|
69021
69173
|
isRichUiEnabled,
|
|
69022
|
-
|
|
69174
|
+
});
|
|
69175
|
+
await waitForRequestedPause({
|
|
69176
|
+
checkpointLabel: 'loading prompts',
|
|
69177
|
+
phase: 'loading',
|
|
69178
|
+
statusMessage: 'Loading prompts...',
|
|
69023
69179
|
});
|
|
69024
69180
|
const promptQueueSnapshot = await loadPromptQueueSnapshot({
|
|
69025
69181
|
options,
|
|
@@ -69049,6 +69205,11 @@
|
|
|
69049
69205
|
uiHandle,
|
|
69050
69206
|
});
|
|
69051
69207
|
if (!options.ignoreGitChanges) {
|
|
69208
|
+
await waitForRequestedPause({
|
|
69209
|
+
checkpointLabel: 'checking the git working tree',
|
|
69210
|
+
phase: 'loading',
|
|
69211
|
+
statusMessage: 'Checking the working tree...',
|
|
69212
|
+
});
|
|
69052
69213
|
await ensureWorkingTreeClean();
|
|
69053
69214
|
}
|
|
69054
69215
|
await runPromptRound({
|
|
@@ -69097,12 +69258,10 @@
|
|
|
69097
69258
|
* Pulls the latest repository state before loading prompts when the feature is enabled.
|
|
69098
69259
|
*/
|
|
69099
69260
|
async function pullLatestChangesIfEnabled(options) {
|
|
69100
|
-
const { options: runOptions, isRichUiEnabled
|
|
69261
|
+
const { options: runOptions, isRichUiEnabled } = options;
|
|
69101
69262
|
if (!runOptions.autoPull || runOptions.dryRun) {
|
|
69102
69263
|
return;
|
|
69103
69264
|
}
|
|
69104
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('loading');
|
|
69105
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage('Pulling latest changes...');
|
|
69106
69265
|
if (!isRichUiEnabled) {
|
|
69107
69266
|
console.info(colors__default["default"].gray('Pulling latest changes before the next prompt...'));
|
|
69108
69267
|
}
|
|
@@ -69126,22 +69285,26 @@
|
|
|
69126
69285
|
*/
|
|
69127
69286
|
function createPauseWaiter(options) {
|
|
69128
69287
|
const { isRichUiEnabled, progressDisplay, uiHandle } = options;
|
|
69129
|
-
return async () => {
|
|
69288
|
+
return async (checkpoint) => {
|
|
69289
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase(checkpoint.phase);
|
|
69290
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(checkpoint.statusMessage);
|
|
69291
|
+
announcePauseTargetLabel(checkpoint.checkpointLabel);
|
|
69130
69292
|
await checkPause({
|
|
69131
69293
|
silent: isRichUiEnabled,
|
|
69132
69294
|
onPaused: () => {
|
|
69133
69295
|
progressDisplay === null || progressDisplay === void 0 ? void 0 : progressDisplay.pauseTimer();
|
|
69134
69296
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.pauseTimer();
|
|
69135
69297
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('paused');
|
|
69136
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(
|
|
69298
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(`Paused before ${checkpoint.checkpointLabel}`);
|
|
69137
69299
|
},
|
|
69138
69300
|
onResumed: () => {
|
|
69139
69301
|
progressDisplay === null || progressDisplay === void 0 ? void 0 : progressDisplay.resumeTimer();
|
|
69140
69302
|
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.resumeTimer();
|
|
69141
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase(
|
|
69142
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(
|
|
69303
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase(checkpoint.phase);
|
|
69304
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage(checkpoint.statusMessage);
|
|
69143
69305
|
},
|
|
69144
69306
|
});
|
|
69307
|
+
resetPauseTargetLabel();
|
|
69145
69308
|
};
|
|
69146
69309
|
}
|
|
69147
69310
|
/**
|
|
@@ -69186,11 +69349,7 @@
|
|
|
69186
69349
|
*/
|
|
69187
69350
|
async function loadPromptQueueSnapshot(options) {
|
|
69188
69351
|
const { options: runOptions, isRichUiEnabled, progressDisplay, uiHandle } = options;
|
|
69189
|
-
|
|
69190
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setCurrentScriptPath(undefined);
|
|
69191
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setPhase('loading');
|
|
69192
|
-
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setStatusMessage('Loading prompts...');
|
|
69193
|
-
}
|
|
69352
|
+
uiHandle === null || uiHandle === void 0 ? void 0 : uiHandle.state.setCurrentScriptPath(undefined);
|
|
69194
69353
|
const promptFiles = await loadPromptFiles(PROMPTS_DIR$1);
|
|
69195
69354
|
const stats = summarizePrompts(promptFiles, runOptions.priority);
|
|
69196
69355
|
progressDisplay === null || progressDisplay === void 0 ? void 0 : progressDisplay.update(stats);
|