@promptbook/node 0.114.0-19 → 0.114.0-20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/esm/index.es.js +124 -3
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/waitForPause.d.ts +92 -0
- package/esm/scripts/run-codex-prompts/common/waitForSkippableWorldTimeDeadline.d.ts +15 -0
- package/esm/src/cli/cli-commands/coder/GitChangesMode.d.ts +28 -0
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +9 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +124 -3
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/waitForPause.d.ts +92 -0
- package/umd/scripts/run-codex-prompts/common/waitForSkippableWorldTimeDeadline.d.ts +15 -0
- package/umd/src/cli/cli-commands/coder/GitChangesMode.d.ts +28 -0
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +9 -2
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pause lifecycle of `ptbk coder run`.
|
|
3
|
+
*/
|
|
4
|
+
export type CoderRunPauseState = 'RUNNING' | 'PAUSING' | 'PAUSED';
|
|
5
|
+
/**
|
|
6
|
+
* Result of toggling the pause hotkey state.
|
|
7
|
+
*/
|
|
8
|
+
export type CoderRunPauseToggleResult = 'REQUESTED_PAUSE' | 'CANCELLED_PAUSE' | 'RESUMED';
|
|
9
|
+
/**
|
|
10
|
+
* Result of requesting a timed wait skip.
|
|
11
|
+
*/
|
|
12
|
+
export type CoderRunSkipCurrentWaitResult = 'REQUESTED_SKIP' | 'NO_ACTIVE_WAIT';
|
|
13
|
+
/**
|
|
14
|
+
* Result of toggling the dynamic end-after-current-prompt state.
|
|
15
|
+
*/
|
|
16
|
+
export type CoderRunEndAfterCurrentPromptToggleResult = 'REQUESTED_END' | 'CANCELLED_END';
|
|
17
|
+
/**
|
|
18
|
+
* Token that identifies one active timed wait which can be skipped by the user.
|
|
19
|
+
*/
|
|
20
|
+
export type CoderRunSkippableWaitToken = symbol;
|
|
21
|
+
/**
|
|
22
|
+
* Applies the same three-state toggle used by the `P` hotkey.
|
|
23
|
+
*/
|
|
24
|
+
export declare function togglePauseState(): CoderRunPauseToggleResult;
|
|
25
|
+
/**
|
|
26
|
+
* Applies the two-state toggle used by the `X` hotkey.
|
|
27
|
+
*/
|
|
28
|
+
export declare function toggleEndAfterCurrentPromptState(): CoderRunEndAfterCurrentPromptToggleResult;
|
|
29
|
+
/**
|
|
30
|
+
* Returns whether the dynamic end-after-current-prompt control is active.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getEndAfterCurrentPromptState(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Starts one timed wait which can be skipped by the `S` hotkey.
|
|
35
|
+
*/
|
|
36
|
+
export declare function beginSkippableWait(): CoderRunSkippableWaitToken;
|
|
37
|
+
/**
|
|
38
|
+
* Finishes one timed wait and clears any skip request that belonged to it.
|
|
39
|
+
*/
|
|
40
|
+
export declare function finishSkippableWait(waitToken: CoderRunSkippableWaitToken): void;
|
|
41
|
+
/**
|
|
42
|
+
* Requests that the currently active timed wait ends immediately.
|
|
43
|
+
*/
|
|
44
|
+
export declare function requestSkipCurrentWait(): CoderRunSkipCurrentWaitResult;
|
|
45
|
+
/**
|
|
46
|
+
* Returns whether one timed wait should end early.
|
|
47
|
+
*/
|
|
48
|
+
export declare function shouldSkipCurrentWait(waitToken: CoderRunSkippableWaitToken): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Waits for either a timeout or an `S` hotkey skip request.
|
|
51
|
+
*/
|
|
52
|
+
export declare function waitForSkippableMilliseconds(waitToken: CoderRunSkippableWaitToken, durationMs: number): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Restores all shared terminal controls to their default state.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resetCoderRunControls(): void;
|
|
57
|
+
/**
|
|
58
|
+
* If the execution is paused, it will wait until it is resumed.
|
|
59
|
+
*
|
|
60
|
+
* @param options.silent - When `true`, suppresses console output (used when the terminal UI handles display).
|
|
61
|
+
* @param options.onPaused - Callback invoked when entering the PAUSED state.
|
|
62
|
+
* @param options.onResumed - Callback invoked when leaving the PAUSED state.
|
|
63
|
+
*/
|
|
64
|
+
export declare function checkPause(options?: {
|
|
65
|
+
silent?: boolean;
|
|
66
|
+
onPaused?: () => void;
|
|
67
|
+
onResumed?: () => void;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Returns the current pause state for external consumers such as the terminal UI.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getPauseState(): CoderRunPauseState;
|
|
73
|
+
/**
|
|
74
|
+
* Returns the label of the next checkpoint where pausing will take effect.
|
|
75
|
+
*/
|
|
76
|
+
export declare function getPauseTargetLabel(): string;
|
|
77
|
+
/**
|
|
78
|
+
* Updates the label of the next pause checkpoint.
|
|
79
|
+
*/
|
|
80
|
+
export declare function announcePauseTargetLabel(nextPauseTargetLabel: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Restores the default generic pause target label.
|
|
83
|
+
*/
|
|
84
|
+
export declare function resetPauseTargetLabel(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Requests a pause from an external controller (e.g. the Ink UI).
|
|
87
|
+
*/
|
|
88
|
+
export declare function requestPause(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Resumes execution from an external controller after a pause.
|
|
91
|
+
*/
|
|
92
|
+
export declare function requestResume(): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type WorldTimeDeadlineTick } from './waitUntilWorldTimeDeadline';
|
|
2
|
+
/**
|
|
3
|
+
* Waits until one wall-clock deadline has passed, or until the user skips the wait with the `S` control.
|
|
4
|
+
*
|
|
5
|
+
* This is the single way `ptbk coder` waits for a deadline the user is allowed to cut short, so every
|
|
6
|
+
* wait which shows the `S Skip current waiting` control really reacts to it: the pacing waits between
|
|
7
|
+
* prompts, the cool-down after an error, the harness session-limit waits and the server keep-alive poll.
|
|
8
|
+
*
|
|
9
|
+
* @private internal utility of `ptbk coder` wait handling
|
|
10
|
+
*/
|
|
11
|
+
export declare function waitForSkippableWorldTimeDeadline(options: {
|
|
12
|
+
readonly deadlineTimeMs: number;
|
|
13
|
+
readonly pollIntervalMs: number;
|
|
14
|
+
readonly onTick?: WorldTimeDeadlineTick;
|
|
15
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported values of the `--git-changes` option, which decides what happens with a dirty working tree.
|
|
3
|
+
*
|
|
4
|
+
* - `fail` — refuse to start while the working tree has uncommitted changes
|
|
5
|
+
* - `ignore` — start anyway and leave the uncommitted changes where they are
|
|
6
|
+
* - `continue` — resume the single prompt which was left in the middle of its implementation
|
|
7
|
+
*
|
|
8
|
+
* @private internal shared utility of `ptbk coder run`
|
|
9
|
+
*/
|
|
10
|
+
export declare const GIT_CHANGES_MODE_VALUES: readonly ["fail", "ignore", "continue"];
|
|
11
|
+
/**
|
|
12
|
+
* Behavior requested for a working tree which has uncommitted changes.
|
|
13
|
+
*
|
|
14
|
+
* @private internal shared utility of `ptbk coder run`
|
|
15
|
+
*/
|
|
16
|
+
export type GitChangesMode = (typeof GIT_CHANGES_MODE_VALUES)[number];
|
|
17
|
+
/**
|
|
18
|
+
* Mode applied when `--git-changes` is not used at all.
|
|
19
|
+
*
|
|
20
|
+
* @private internal shared utility of `ptbk coder run`
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_GIT_CHANGES_MODE: GitChangesMode;
|
|
23
|
+
/**
|
|
24
|
+
* Checks whether a value is a supported `--git-changes` mode.
|
|
25
|
+
*
|
|
26
|
+
* @private internal shared utility of `ptbk coder run`
|
|
27
|
+
*/
|
|
28
|
+
export declare function isGitChangesMode(value: string): value is GitChangesMode;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command as Program } from 'commander';
|
|
2
2
|
import { PTBK_HARNESS_ENV, PTBK_MODEL_ENV, PTBK_THINKING_LEVEL_ENV } from '../../../book-3.0/cliAgentEnv';
|
|
3
|
+
import type { GitChangesMode } from '../coder/GitChangesMode';
|
|
3
4
|
import type { ThinkingLevel } from '../coder/ThinkingLevel';
|
|
4
5
|
export { PTBK_HARNESS_ENV, PTBK_MODEL_ENV, PTBK_THINKING_LEVEL_ENV };
|
|
5
6
|
/**
|
|
@@ -25,7 +26,7 @@ export type PromptRunnerCliOptions = {
|
|
|
25
26
|
readonly ui: boolean;
|
|
26
27
|
readonly thinkingLevel?: ThinkingLevel;
|
|
27
28
|
readonly commit: boolean;
|
|
28
|
-
readonly
|
|
29
|
+
readonly gitChanges: GitChangesMode;
|
|
29
30
|
readonly allowCredits: boolean;
|
|
30
31
|
readonly normalizeLineEndings: boolean;
|
|
31
32
|
readonly autoPush: boolean;
|
|
@@ -48,7 +49,7 @@ export type NormalizedPromptRunnerCliOptions = {
|
|
|
48
49
|
readonly noUi: boolean;
|
|
49
50
|
readonly thinkingLevel?: ThinkingLevel;
|
|
50
51
|
readonly noCommit: boolean;
|
|
51
|
-
readonly
|
|
52
|
+
readonly gitChanges: GitChangesMode;
|
|
52
53
|
readonly allowCredits: boolean;
|
|
53
54
|
readonly normalizeLineEndings: boolean;
|
|
54
55
|
readonly autoPush: boolean;
|
|
@@ -78,6 +79,12 @@ export declare const PROMPT_RUNNER_HARNESS_OPTION_DESCRIPTION = "Select runner:
|
|
|
78
79
|
* @private internal utility of `promptbookCli`
|
|
79
80
|
*/
|
|
80
81
|
export declare const PROMPT_RUNNER_MODEL_OPTION_DESCRIPTION: string;
|
|
82
|
+
/**
|
|
83
|
+
* Commander description for the `--git-changes` option.
|
|
84
|
+
*
|
|
85
|
+
* @private internal utility of `promptbookCli`
|
|
86
|
+
*/
|
|
87
|
+
export declare const GIT_CHANGES_OPTION_DESCRIPTION: string;
|
|
81
88
|
/**
|
|
82
89
|
* Registers runner selection flags on a command.
|
|
83
90
|
*
|
package/umd/src/version.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.114.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.114.0-19`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|