@promptbook/cli 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 +1586 -1213
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/CoderRunControlFeedback.d.ts +54 -0
- package/esm/scripts/run-codex-prompts/common/applyCoderRunControlKey.d.ts +14 -0
- package/esm/scripts/run-codex-prompts/common/buildCoderRunControlKeyBadge.d.ts +7 -0
- package/esm/scripts/run-codex-prompts/common/formatCoderRunControlFeedback.d.ts +13 -0
- package/esm/scripts/run-codex-prompts/common/listenForCoderRunControls.d.ts +17 -0
- package/esm/scripts/run-codex-prompts/common/waitForPause.d.ts +0 -8
- package/esm/scripts/run-codex-prompts/common/waitForSkippableWorldTimeDeadline.d.ts +15 -0
- package/esm/scripts/run-codex-prompts/prompts/buildPromptLabel.d.ts +6 -0
- package/esm/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +7 -0
- package/esm/scripts/run-codex-prompts/prompts/listPromptsByStatus.d.ts +7 -0
- package/esm/scripts/run-codex-prompts/prompts/markPromptDone.d.ts +15 -4
- package/esm/scripts/run-codex-prompts/prompts/markPromptFailed.d.ts +34 -1
- package/esm/scripts/run-codex-prompts/prompts/promptRunnerAttribution.d.ts +24 -0
- package/esm/scripts/run-codex-prompts/prompts/resolveInterruptedPrompt.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +15 -1
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +1 -1
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +6 -1
- package/esm/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +11 -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 +1 -1
- package/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.ts +1 -1
- package/src/cli/cli-commands/coder/GitChangesMode.ts +35 -0
- package/src/cli/cli-commands/coder/run.ts +3 -1
- package/src/cli/cli-commands/coder/server.ts +1 -1
- package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +22 -4
- package/src/other/templates/getTemplatesPipelineCollection.ts +778 -706
- package/src/utils/agents/terminalAgentAvatarVisual.ts +1 -1
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +1586 -1213
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/CoderRunControlFeedback.d.ts +54 -0
- package/umd/scripts/run-codex-prompts/common/applyCoderRunControlKey.d.ts +14 -0
- package/umd/scripts/run-codex-prompts/common/buildCoderRunControlKeyBadge.d.ts +7 -0
- package/umd/scripts/run-codex-prompts/common/formatCoderRunControlFeedback.d.ts +13 -0
- package/umd/scripts/run-codex-prompts/common/listenForCoderRunControls.d.ts +17 -0
- package/umd/scripts/run-codex-prompts/common/waitForPause.d.ts +0 -8
- package/umd/scripts/run-codex-prompts/common/waitForSkippableWorldTimeDeadline.d.ts +15 -0
- package/umd/scripts/run-codex-prompts/prompts/buildPromptLabel.d.ts +6 -0
- package/umd/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +7 -0
- package/umd/scripts/run-codex-prompts/prompts/listPromptsByStatus.d.ts +7 -0
- package/umd/scripts/run-codex-prompts/prompts/markPromptDone.d.ts +15 -4
- package/umd/scripts/run-codex-prompts/prompts/markPromptFailed.d.ts +34 -1
- package/umd/scripts/run-codex-prompts/prompts/promptRunnerAttribution.d.ts +24 -0
- package/umd/scripts/run-codex-prompts/prompts/resolveInterruptedPrompt.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/ui/CoderRunUiState.d.ts +15 -1
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunAgentVisual.d.ts +1 -1
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +6 -1
- package/umd/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +11 -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
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunOctopusVisual.d.ts +0 -13
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunOctopusVisual.d.ts +0 -13
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal control key of `ptbk coder run` which the user can press during a run.
|
|
3
|
+
*
|
|
4
|
+
* @private internal type of `ptbk coder` terminal controls
|
|
5
|
+
*/
|
|
6
|
+
export type CoderRunControlKey = 'P' | 'S' | 'X';
|
|
7
|
+
/**
|
|
8
|
+
* Meaning of one control answer, which decides how it is colored in the terminal.
|
|
9
|
+
*
|
|
10
|
+
* @private internal type of `ptbk coder` terminal controls
|
|
11
|
+
*/
|
|
12
|
+
export type CoderRunControlFeedbackTone = 'success' | 'info' | 'warning';
|
|
13
|
+
/**
|
|
14
|
+
* Answer of the runner to one pressed control key.
|
|
15
|
+
*
|
|
16
|
+
* Every single key press produces one of these, including presses which change nothing, so the user
|
|
17
|
+
* always sees that the key was received.
|
|
18
|
+
*
|
|
19
|
+
* @private internal type of `ptbk coder` terminal controls
|
|
20
|
+
*/
|
|
21
|
+
export type CoderRunControlFeedback = {
|
|
22
|
+
/**
|
|
23
|
+
* Control key the answer belongs to.
|
|
24
|
+
*/
|
|
25
|
+
readonly controlKey: CoderRunControlKey;
|
|
26
|
+
/**
|
|
27
|
+
* Human-readable description of what the key press did.
|
|
28
|
+
*/
|
|
29
|
+
readonly message: string;
|
|
30
|
+
/**
|
|
31
|
+
* Meaning of the answer, used to color it.
|
|
32
|
+
*/
|
|
33
|
+
readonly tone: CoderRunControlFeedbackTone;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* One control answer together with how many times the very same answer was repeated in a row.
|
|
37
|
+
*
|
|
38
|
+
* Pressing one control twice can produce the identical answer, so the repeat count is what makes the
|
|
39
|
+
* second press change the rendered frame as well.
|
|
40
|
+
*
|
|
41
|
+
* @private internal type of `ptbk coder` terminal controls
|
|
42
|
+
*/
|
|
43
|
+
export type CoderRunControlFeedbackNotice = CoderRunControlFeedback & {
|
|
44
|
+
/**
|
|
45
|
+
* How many times this exact answer was given in a row, starting at `1`.
|
|
46
|
+
*/
|
|
47
|
+
readonly repeatCount: number;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* How long one control answer stays visible in the rich terminal UI.
|
|
51
|
+
*
|
|
52
|
+
* @private internal constant of `ptbk coder` terminal controls
|
|
53
|
+
*/
|
|
54
|
+
export declare const CODER_RUN_CONTROL_FEEDBACK_DURATION_MS = 5000;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CoderRunControlFeedback } from './CoderRunControlFeedback';
|
|
2
|
+
/**
|
|
3
|
+
* Applies the terminal control bound to one pressed key and describes what that key press did.
|
|
4
|
+
*
|
|
5
|
+
* This is the single place where the `P`, `S` and `X` keys are turned into runner actions, so the
|
|
6
|
+
* plain console listener and the rich terminal UI always perform the same action and always answer
|
|
7
|
+
* the user, even when the pressed control changed nothing.
|
|
8
|
+
*
|
|
9
|
+
* @param keyName Name of the pressed key as reported by the `keypress` event.
|
|
10
|
+
* @returns The answer shown to the user, or `undefined` when the key is not a control key.
|
|
11
|
+
*
|
|
12
|
+
* @private internal utility of `ptbk coder` terminal controls
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyCoderRunControlKey(keyName: string | undefined): CoderRunControlFeedback | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CoderRunControlKey } from './CoderRunControlFeedback';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the colored badge of one control key, for example ` S `.
|
|
4
|
+
*
|
|
5
|
+
* @private internal utility of `ptbk coder` terminal controls
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildCoderRunControlKeyBadge(controlKey: CoderRunControlKey): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CoderRunControlFeedback } from './CoderRunControlFeedback';
|
|
2
|
+
/**
|
|
3
|
+
* Formats one control answer as a single colored terminal line.
|
|
4
|
+
*
|
|
5
|
+
* The same line is printed by the plain console listener and rendered inside the `Controls` box of the
|
|
6
|
+
* rich terminal UI, so both modes answer a pressed control key identically.
|
|
7
|
+
*
|
|
8
|
+
* @param feedback Answer of the runner to the pressed control key.
|
|
9
|
+
* @param repeatCount How many times this exact answer was given in a row, rendered from the second time on.
|
|
10
|
+
*
|
|
11
|
+
* @private internal utility of `ptbk coder` terminal controls
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatCoderRunControlFeedback(feedback: CoderRunControlFeedback, repeatCount?: number): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Listens for the terminal control keys while the plain console output is used.
|
|
3
|
+
*
|
|
4
|
+
* Every recognized key press is answered with one printed line, because the plain mode has no frame
|
|
5
|
+
* which could show the new state on its own. The rich terminal UI installs its own listener in
|
|
6
|
+
* [`renderCoderRunUi`](../ui/renderCoderRunUi.ts) and shares the very same key handling through
|
|
7
|
+
* [`applyCoderRunControlKey`](./applyCoderRunControlKey.ts).
|
|
8
|
+
*
|
|
9
|
+
* @private internal utility of `ptbk coder` terminal controls
|
|
10
|
+
*/
|
|
11
|
+
export declare function listenForCoderRunControls(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Backwards-compatible alias for the shared terminal controls listener.
|
|
14
|
+
*
|
|
15
|
+
* @private internal utility of `ptbk coder` terminal controls
|
|
16
|
+
*/
|
|
17
|
+
export declare function listenForPause(): void;
|
|
@@ -54,14 +54,6 @@ export declare function waitForSkippableMilliseconds(waitToken: CoderRunSkippabl
|
|
|
54
54
|
* Restores all shared terminal controls to their default state.
|
|
55
55
|
*/
|
|
56
56
|
export declare function resetCoderRunControls(): void;
|
|
57
|
-
/**
|
|
58
|
-
* Listens for the terminal control keys.
|
|
59
|
-
*/
|
|
60
|
-
export declare function listenForCoderRunControls(): void;
|
|
61
|
-
/**
|
|
62
|
-
* Backwards-compatible alias for the shared terminal controls listener.
|
|
63
|
-
*/
|
|
64
|
-
export declare function listenForPause(): void;
|
|
65
57
|
/**
|
|
66
58
|
* If the execution is paused, it will wait until it is resumed.
|
|
67
59
|
*
|
|
@@ -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,6 @@
|
|
|
1
|
+
import type { PromptFile } from './types/PromptFile';
|
|
2
|
+
import type { PromptSection } from './types/PromptSection';
|
|
3
|
+
/**
|
|
4
|
+
* Builds a label that identifies the prompt section by index.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildPromptLabel(file: PromptFile, section: PromptSection): string;
|
|
@@ -21,6 +21,13 @@ export type BuildPromptStatusDetailsOptions = {
|
|
|
21
21
|
* Model the harness runs the prompt with.
|
|
22
22
|
*/
|
|
23
23
|
readonly modelName: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Harness which left the prompt in the middle of its implementation, when another harness took the work over.
|
|
26
|
+
*
|
|
27
|
+
* Present only for a prompt resumed through `--git-changes continue`, so a status line always names both the
|
|
28
|
+
* harness which started the work and the one which is finishing it.
|
|
29
|
+
*/
|
|
30
|
+
readonly startedByRunnerSignature?: string;
|
|
24
31
|
/**
|
|
25
32
|
* How many coding attempts the prompt has taken so far.
|
|
26
33
|
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PromptFile } from './types/PromptFile';
|
|
2
|
+
import type { PromptSelection } from './types/PromptSelection';
|
|
3
|
+
import type { PromptStatus } from './types/PromptStatus';
|
|
4
|
+
/**
|
|
5
|
+
* Lists prompts in one checklist status across all files.
|
|
6
|
+
*/
|
|
7
|
+
export declare function listPromptsByStatus(files: PromptFile[], status: PromptStatus): PromptSelection[];
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { ThinkingLevel } from '../../../src/cli/cli-commands/coder/ThinkingLevel';
|
|
3
|
-
import type { CoderRunStep } from '../common/CoderRunStep';
|
|
1
|
+
import { type BuildPromptStatusDetailsOptions } from './buildPromptStatusDetails';
|
|
4
2
|
import type { PromptFile } from './types/PromptFile';
|
|
5
3
|
import type { PromptSection } from './types/PromptSection';
|
|
4
|
+
/**
|
|
5
|
+
* Input for marking one prompt section as implemented, verified and committed.
|
|
6
|
+
*/
|
|
7
|
+
export type MarkPromptDoneOptions = BuildPromptStatusDetailsOptions & {
|
|
8
|
+
/**
|
|
9
|
+
* Prompt file the marked section belongs to.
|
|
10
|
+
*/
|
|
11
|
+
readonly file: PromptFile;
|
|
12
|
+
/**
|
|
13
|
+
* Section which has just been finished.
|
|
14
|
+
*/
|
|
15
|
+
readonly section: PromptSection;
|
|
16
|
+
};
|
|
6
17
|
/**
|
|
7
18
|
* Marks a prompt section as done and records the per-step usage pricing and runner details.
|
|
8
19
|
*/
|
|
9
|
-
export declare function markPromptDone(
|
|
20
|
+
export declare function markPromptDone(options: MarkPromptDoneOptions): void;
|
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
2
|
import type { PromptFile } from './types/PromptFile';
|
|
3
3
|
import type { PromptSection } from './types/PromptSection';
|
|
4
|
+
/**
|
|
5
|
+
* Input for marking one prompt section as failed.
|
|
6
|
+
*/
|
|
7
|
+
export type MarkPromptFailedOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* Prompt file the marked section belongs to.
|
|
10
|
+
*/
|
|
11
|
+
readonly file: PromptFile;
|
|
12
|
+
/**
|
|
13
|
+
* Section which could not be implemented.
|
|
14
|
+
*/
|
|
15
|
+
readonly section: PromptSection;
|
|
16
|
+
/**
|
|
17
|
+
* Harness which ran the prompt.
|
|
18
|
+
*/
|
|
19
|
+
readonly runnerName: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Model the harness ran the prompt with.
|
|
22
|
+
*/
|
|
23
|
+
readonly modelName: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Harness which left the prompt in the middle of its implementation, when another harness took the work over.
|
|
26
|
+
*/
|
|
27
|
+
readonly startedByRunnerSignature?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Moment the failed prompt round started, used to report how long the attempt took.
|
|
30
|
+
*/
|
|
31
|
+
readonly promptExecutionStartedDate: moment.Moment;
|
|
32
|
+
/**
|
|
33
|
+
* How many coding attempts the prompt has taken before it was given up on.
|
|
34
|
+
*/
|
|
35
|
+
readonly attemptCount: number;
|
|
36
|
+
};
|
|
4
37
|
/**
|
|
5
38
|
* Marks a prompt section as failed and records runner details.
|
|
6
39
|
*/
|
|
7
|
-
export declare function markPromptFailed(
|
|
40
|
+
export declare function markPromptFailed(options: MarkPromptFailedOptions): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats who worked on one prompt for its status line.
|
|
3
|
+
*
|
|
4
|
+
* Produces `` by Claude Code `claude-opus-5` `` for a prompt implemented by a single harness and
|
|
5
|
+
* `` by Claude Code `claude-opus-5`, started by OpenAI Codex `gpt-5.6-luna` `` for a prompt which one
|
|
6
|
+
* harness started and another one continued through `--git-changes continue`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatPromptRunnerAttribution(options: {
|
|
9
|
+
/**
|
|
10
|
+
* Harness which runs the prompt right now, already formatted as a runner signature.
|
|
11
|
+
*/
|
|
12
|
+
readonly currentRunnerSignature: string;
|
|
13
|
+
/**
|
|
14
|
+
* Harness which left the prompt in the middle of its implementation, when the work was taken over.
|
|
15
|
+
*/
|
|
16
|
+
readonly startedByRunnerSignature?: string;
|
|
17
|
+
}): string;
|
|
18
|
+
/**
|
|
19
|
+
* Reads which harness started the work recorded on one prompt status line.
|
|
20
|
+
*
|
|
21
|
+
* A line written by a single harness names that harness, and a line of a prompt which was already taken
|
|
22
|
+
* over keeps naming the harness which started it, so the original author survives any number of takeovers.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parsePromptStartedByRunnerSignature(statusLine: string): string | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PromptFile } from './types/PromptFile';
|
|
2
|
+
import type { PromptSelection } from './types/PromptSelection';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the one prompt which `--git-changes continue` resumes.
|
|
5
|
+
*
|
|
6
|
+
* A coder which was killed or crashed leaves exactly one prompt behind in the in-progress `[^]` status,
|
|
7
|
+
* so anything else means the working tree changes cannot be attributed to a single interrupted prompt.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveInterruptedPrompt(files: PromptFile[]): PromptSelection;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import moment from 'moment';
|
|
4
4
|
import { type CoderRunProgressSnapshot } from '../common/buildCoderRunProgressSnapshot';
|
|
5
|
+
import type { CoderRunControlFeedback, CoderRunControlFeedbackNotice } from '../common/CoderRunControlFeedback';
|
|
5
6
|
import type { PriorityFilter } from '../prompts/priorityFilter';
|
|
6
7
|
import type { PromptStats } from '../prompts/types/PromptStats';
|
|
7
8
|
import type { CoderRunAgentVisual } from './buildCoderRunAgentVisual';
|
|
@@ -59,6 +60,7 @@ export declare class CoderRunUiState extends EventEmitter {
|
|
|
59
60
|
phase: CoderRunPhase;
|
|
60
61
|
statusMessage: string;
|
|
61
62
|
errors: string[];
|
|
63
|
+
controlFeedback: CoderRunControlFeedbackNotice | undefined;
|
|
62
64
|
private stats;
|
|
63
65
|
private readonly timer;
|
|
64
66
|
private initialDone;
|
|
@@ -77,7 +79,7 @@ export declare class CoderRunUiState extends EventEmitter {
|
|
|
77
79
|
*/
|
|
78
80
|
setConfig(config: CoderRunConfig): void;
|
|
79
81
|
/**
|
|
80
|
-
* Replaces the ASCII-art agent visual renderer shown
|
|
82
|
+
* Replaces the ASCII-art agent visual renderer shown above the dashboard boxes.
|
|
81
83
|
*/
|
|
82
84
|
setAgentVisual(agentVisual: CoderRunAgentVisual | undefined): void;
|
|
83
85
|
/**
|
|
@@ -146,9 +148,21 @@ export declare class CoderRunUiState extends EventEmitter {
|
|
|
146
148
|
* Sets or clears the Enter-key action label shown in the controls panel.
|
|
147
149
|
*/
|
|
148
150
|
setPendingEnterLabel(pendingEnterLabel: string | undefined): void;
|
|
151
|
+
/**
|
|
152
|
+
* Shows the answer of the runner to one pressed control key, or clears the currently shown one.
|
|
153
|
+
*
|
|
154
|
+
* Pressing one control twice in a row can produce the very same answer, for example when there is
|
|
155
|
+
* nothing to skip. The repeat count is therefore tracked here, so that even such a press changes the
|
|
156
|
+
* rendered frame and the user always sees that the key arrived.
|
|
157
|
+
*/
|
|
158
|
+
setControlFeedback(controlFeedback: CoderRunControlFeedback | undefined): void;
|
|
149
159
|
/**
|
|
150
160
|
* Appends an error message to the error list shown in the UI.
|
|
151
161
|
*/
|
|
152
162
|
addError(errorMessage: string): void;
|
|
163
|
+
/**
|
|
164
|
+
* Counts how many times the shown answer repeats the previously shown one.
|
|
165
|
+
*/
|
|
166
|
+
private countControlFeedbackRepeat;
|
|
153
167
|
private emitChange;
|
|
154
168
|
}
|
|
@@ -33,7 +33,7 @@ export type CoderRunAgentVisual = TerminalAgentAvatarVisual;
|
|
|
33
33
|
* visuals are rendered through the shared canvas avatar pipeline into terminal ASCII art, using a
|
|
34
34
|
* transparent horizontal canvas instead of the website's framed 1:1 surface.
|
|
35
35
|
*
|
|
36
|
-
* The visual is decorative, so any failure returns `null` and the caller
|
|
36
|
+
* The visual is decorative, so any failure returns `null` and the caller renders no header visual at all.
|
|
37
37
|
*
|
|
38
38
|
* @param agentSource Source of the `--agent` book file.
|
|
39
39
|
* @returns ANSI-colored ASCII-art renderer or `null` when the visual cannot be rendered.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CoderRunControlFeedbackNotice } from '../common/CoderRunControlFeedback';
|
|
1
2
|
import type { CoderRunPauseState } from '../common/waitForPause';
|
|
2
3
|
import type { CoderRunConfig, CoderRunPhase, CoderRunProgressSnapshot } from './CoderRunUiState';
|
|
3
4
|
import type { CoderRunAgentVisual } from './buildCoderRunAgentVisual';
|
|
@@ -14,7 +15,7 @@ export type BuildCoderRunUiFrameOptions = {
|
|
|
14
15
|
readonly animationTimeMs: number;
|
|
15
16
|
readonly spinner: string;
|
|
16
17
|
/**
|
|
17
|
-
* ANSI ASCII-art renderer of the `--agent` avatar visual shown
|
|
18
|
+
* ANSI ASCII-art renderer of the `--agent` avatar visual shown above the dashboard boxes.
|
|
18
19
|
*/
|
|
19
20
|
readonly agentVisual?: CoderRunAgentVisual;
|
|
20
21
|
/**
|
|
@@ -40,6 +41,10 @@ export type BuildCoderRunUiFrameOptions = {
|
|
|
40
41
|
readonly agentOutputLines: readonly string[];
|
|
41
42
|
readonly errors: readonly string[];
|
|
42
43
|
readonly progress: CoderRunProgressSnapshot;
|
|
44
|
+
/**
|
|
45
|
+
* Answer of the runner to the control key which was pressed last, shown in the `Controls` box.
|
|
46
|
+
*/
|
|
47
|
+
readonly controlFeedback?: CoderRunControlFeedbackNotice;
|
|
43
48
|
};
|
|
44
49
|
/**
|
|
45
50
|
* Structured row rendered in the agent-run `Agents` table.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CoderRunControlFeedbackNotice } from '../common/CoderRunControlFeedback';
|
|
1
2
|
import type { CoderRunPauseState } from '../common/waitForPause';
|
|
2
3
|
import type { CoderRunPhase } from './CoderRunUiState';
|
|
3
4
|
/**
|
|
@@ -73,3 +74,13 @@ export declare function buildCoderRunControlPills(options: {
|
|
|
73
74
|
readonly isEndAfterCurrentPromptRequested: boolean;
|
|
74
75
|
readonly sessionTotal: number;
|
|
75
76
|
}): readonly string[];
|
|
77
|
+
/**
|
|
78
|
+
* Builds the body of the `Controls` box.
|
|
79
|
+
*
|
|
80
|
+
* The pills are always shown, and right after a control key was pressed the answer of the runner to
|
|
81
|
+
* that key is shown underneath, so no key press ever leaves the frame unchanged.
|
|
82
|
+
*/
|
|
83
|
+
export declare function buildControlsBoxLines(options: {
|
|
84
|
+
readonly controlPills: readonly string[];
|
|
85
|
+
readonly controlFeedback: CoderRunControlFeedbackNotice | undefined;
|
|
86
|
+
}): readonly string[];
|
|
@@ -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/esm/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
|
*/
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ export function createLocalAgentRunOptions(
|
|
|
17
17
|
noUi: options.noUi,
|
|
18
18
|
thinkingLevel: options.thinkingLevel,
|
|
19
19
|
noCommit: true,
|
|
20
|
-
|
|
20
|
+
gitChanges: 'ignore',
|
|
21
21
|
normalizeLineEndings: false,
|
|
22
22
|
allowCredits: options.allowCredits,
|
|
23
23
|
autoPush: false,
|
|
@@ -0,0 +1,35 @@
|
|
|
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 const GIT_CHANGES_MODE_VALUES = ['fail', 'ignore', 'continue'] as const;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Behavior requested for a working tree which has uncommitted changes.
|
|
14
|
+
*
|
|
15
|
+
* @private internal shared utility of `ptbk coder run`
|
|
16
|
+
*/
|
|
17
|
+
export type GitChangesMode = (typeof GIT_CHANGES_MODE_VALUES)[number];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Mode applied when `--git-changes` is not used at all.
|
|
21
|
+
*
|
|
22
|
+
* @private internal shared utility of `ptbk coder run`
|
|
23
|
+
*/
|
|
24
|
+
export const DEFAULT_GIT_CHANGES_MODE: GitChangesMode = 'fail';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Checks whether a value is a supported `--git-changes` mode.
|
|
28
|
+
*
|
|
29
|
+
* @private internal shared utility of `ptbk coder run`
|
|
30
|
+
*/
|
|
31
|
+
export function isGitChangesMode(value: string): value is GitChangesMode {
|
|
32
|
+
return GIT_CHANGES_MODE_VALUES.includes(value as GitChangesMode);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Note: [🟡] Code for CLI command [run](src/cli/cli-commands/coder/run.ts) should never be published outside of `@promptbook/cli`
|
|
@@ -48,6 +48,8 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
|
|
|
48
48
|
Features:
|
|
49
49
|
- Automatically stages and commits changes with agent identity unless --no-commit is used
|
|
50
50
|
- Commits only the prompt file and the files the coding agent has changed, leaving unrelated changes alone
|
|
51
|
+
- Refuses to start on a dirty working tree unless --git-changes says what should happen with the changes
|
|
52
|
+
- Optional --git-changes continue resumes the single prompt an interrupted coder left in the [^] status
|
|
51
53
|
- Optional post-commit git push with explicit --auto-push opt-in
|
|
52
54
|
- Optional pre-prompt git pull with explicit --auto-pull opt-in
|
|
53
55
|
- Optional --isolate runs every prompt in its own temporary git worktree and merges it back when verified
|
|
@@ -234,7 +236,7 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
|
|
|
234
236
|
waitBetweenPrompts,
|
|
235
237
|
waitAfterError,
|
|
236
238
|
noCommit: runnerOptions.noCommit,
|
|
237
|
-
|
|
239
|
+
gitChanges: runnerOptions.gitChanges,
|
|
238
240
|
agentName: runnerOptions.agentName,
|
|
239
241
|
model: runnerOptions.model,
|
|
240
242
|
agent,
|
|
@@ -199,7 +199,7 @@ export function $initializeCoderServerCommand(program: Program): $side_effect {
|
|
|
199
199
|
waitBetweenPrompts,
|
|
200
200
|
waitAfterError,
|
|
201
201
|
noCommit: runnerOptions.noCommit,
|
|
202
|
-
|
|
202
|
+
gitChanges: runnerOptions.gitChanges,
|
|
203
203
|
agentName: runnerOptions.agentName,
|
|
204
204
|
model: runnerOptions.model,
|
|
205
205
|
agent,
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
PTBK_MODEL_ENV,
|
|
11
11
|
PTBK_THINKING_LEVEL_ENV,
|
|
12
12
|
} from '../../../book-3.0/cliAgentEnv';
|
|
13
|
+
import type { GitChangesMode } from '../coder/GitChangesMode';
|
|
14
|
+
import { DEFAULT_GIT_CHANGES_MODE, GIT_CHANGES_MODE_VALUES } from '../coder/GitChangesMode';
|
|
13
15
|
import type { ThinkingLevel } from '../coder/ThinkingLevel';
|
|
14
16
|
import { THINKING_LEVEL_VALUES } from '../coder/ThinkingLevel';
|
|
15
17
|
|
|
@@ -40,7 +42,7 @@ export type PromptRunnerCliOptions = {
|
|
|
40
42
|
readonly ui: boolean;
|
|
41
43
|
readonly thinkingLevel?: ThinkingLevel;
|
|
42
44
|
readonly commit: boolean;
|
|
43
|
-
readonly
|
|
45
|
+
readonly gitChanges: GitChangesMode;
|
|
44
46
|
readonly allowCredits: boolean;
|
|
45
47
|
readonly normalizeLineEndings: boolean;
|
|
46
48
|
readonly autoPush: boolean;
|
|
@@ -68,7 +70,7 @@ export type NormalizedPromptRunnerCliOptions = {
|
|
|
68
70
|
readonly noUi: boolean;
|
|
69
71
|
readonly thinkingLevel?: ThinkingLevel;
|
|
70
72
|
readonly noCommit: boolean;
|
|
71
|
-
readonly
|
|
73
|
+
readonly gitChanges: GitChangesMode;
|
|
72
74
|
readonly allowCredits: boolean;
|
|
73
75
|
readonly normalizeLineEndings: boolean;
|
|
74
76
|
readonly autoPush: boolean;
|
|
@@ -120,6 +122,18 @@ export const PROMPT_RUNNER_MODEL_OPTION_DESCRIPTION = spaceTrim(`
|
|
|
120
122
|
Gemini examples: gemini-3-flash-preview, default
|
|
121
123
|
`);
|
|
122
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Commander description for the `--git-changes` option.
|
|
127
|
+
*
|
|
128
|
+
* @private internal utility of `promptbookCli`
|
|
129
|
+
*/
|
|
130
|
+
export const GIT_CHANGES_OPTION_DESCRIPTION = spaceTrim(`
|
|
131
|
+
Decide what happens when the working tree has uncommitted changes before a prompt starts:
|
|
132
|
+
- fail: refuse to start and ask for a commit or a stash (the default)
|
|
133
|
+
- ignore: start anyway and leave the uncommitted changes where they are
|
|
134
|
+
- continue: resume the single prompt which was left in the middle of its implementation
|
|
135
|
+
`);
|
|
136
|
+
|
|
123
137
|
/**
|
|
124
138
|
* Registers runner selection flags on a command.
|
|
125
139
|
*
|
|
@@ -165,7 +179,11 @@ export function addPromptRunnerRuntimeOptions(command: Program): void {
|
|
|
165
179
|
export function addPromptRunnerExecutionOptions(command: Program): void {
|
|
166
180
|
addPromptRunnerRuntimeOptions(command);
|
|
167
181
|
command.option('--no-commit', 'Leave successful changes in the working directory instead of creating git commits');
|
|
168
|
-
command.
|
|
182
|
+
command.addOption(
|
|
183
|
+
new Option('--git-changes <mode>', GIT_CHANGES_OPTION_DESCRIPTION)
|
|
184
|
+
.choices([...GIT_CHANGES_MODE_VALUES])
|
|
185
|
+
.default(DEFAULT_GIT_CHANGES_MODE),
|
|
186
|
+
);
|
|
169
187
|
command.option(
|
|
170
188
|
'--no-normalize-line-endings',
|
|
171
189
|
'Disable automatic LF normalization for files changed in each coding round',
|
|
@@ -190,7 +208,7 @@ export function normalizePromptRunnerCliOptions(
|
|
|
190
208
|
return {
|
|
191
209
|
...selectionOptions,
|
|
192
210
|
noCommit: !cliOptions.commit,
|
|
193
|
-
|
|
211
|
+
gitChanges: cliOptions.gitChanges ?? DEFAULT_GIT_CHANGES_MODE,
|
|
194
212
|
normalizeLineEndings: cliOptions.normalizeLineEndings,
|
|
195
213
|
autoPush: cliOptions.autoPush,
|
|
196
214
|
autoPull: cliOptions.autoPull,
|