@promptbook/cli 0.112.0-128 → 0.112.0-129

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.
@@ -0,0 +1,27 @@
1
+ import type { CoderRunUiHandle } from '../ui/renderCoderRunUi';
2
+ /**
3
+ * Distinct kinds of wait shown by the run loop so the UI can label them clearly.
4
+ *
5
+ * @public exported from `@promptbook/cli`
6
+ */
7
+ export type CoderRunWaitKind = 'after-prompt' | 'between-prompts' | 'after-error';
8
+ /**
9
+ * Returns the human-readable status message used for one wait kind.
10
+ *
11
+ * @private internal utility of `sleepWithCountdown`
12
+ */
13
+ export declare function describeCoderRunWait(waitKind: CoderRunWaitKind, remainingMs: number, totalMs?: number): string;
14
+ /**
15
+ * Sleeps the requested duration while refreshing the status message on a UI handle and the plain console.
16
+ *
17
+ * The wait kind is shown in the UI status so the user can distinguish `--wait-after-prompt`,
18
+ * `--wait-between-prompts`, and `--wait-after-error` waits at a glance.
19
+ *
20
+ * @public exported from `@promptbook/cli`
21
+ */
22
+ export declare function sleepWithCountdown(options: {
23
+ durationMs: number;
24
+ waitKind: CoderRunWaitKind;
25
+ isRichUiEnabled: boolean;
26
+ uiHandle?: CoderRunUiHandle;
27
+ }): Promise<void>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Default wait duration applied before retrying a prompt round after an error (10 minutes).
3
+ *
4
+ * @private internal constant of `ptbk coder` wait handling
5
+ */
6
+ export declare const DEFAULT_WAIT_AFTER_ERROR_MS: number;
7
+ /**
8
+ * Parses an optional Commander duration string and returns the resolved milliseconds.
9
+ *
10
+ * Returns `defaultMs` when the flag was not provided or was provided without a non-empty value.
11
+ *
12
+ * @private internal utility of `ptbk coder` wait handling
13
+ */
14
+ export declare function parseOptionalWaitDuration(value: string | undefined, defaultMs: number): number;
@@ -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.112.0-126`).
18
+ * It follows semantic versioning (e.g., `0.112.0-128`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/cli",
3
- "version": "0.112.0-128",
3
+ "version": "0.112.0-129",
4
4
  "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -11,7 +11,10 @@ import {
11
11
  normalizePromptRunnerCliOptions,
12
12
  PROMPT_RUNNER_DESCRIPTION,
13
13
  } from '../common/promptRunnerCliOptions';
14
- import { parseDuration } from '../../../../scripts/run-codex-prompts/common/parseDuration';
14
+ import {
15
+ DEFAULT_WAIT_AFTER_ERROR_MS,
16
+ parseOptionalWaitDuration,
17
+ } from './waitOptions';
15
18
 
16
19
  /**
17
20
  * Initializes `coder run` command for Promptbook CLI utilities
@@ -63,10 +66,25 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
63
66
  addPromptRunnerExecutionOptions(command);
64
67
  command.option('--priority <minimum-priority>', 'Filter prompts by minimum priority level', parseIntOption, 0);
65
68
  command.option(
66
- '--wait <duration>',
69
+ '--wait-after-prompt <duration>',
70
+ spaceTrim(`
71
+ Wait this long after each prompt has been implemented, verified and committed before starting the next prompt.
72
+ Accepts durations like 1h, 30m, 5s. Defaults to 0 (no wait).
73
+ `),
74
+ );
75
+ command.option(
76
+ '--wait-between-prompts <duration>',
77
+ spaceTrim(`
78
+ Pace prompts so that each next prompt starts at least this long after the previous one began.
79
+ If the previous prompt already took longer than this, the next prompt starts immediately.
80
+ Accepts durations like 1h, 30m, 5s. Defaults to 0 (no pacing).
81
+ `),
82
+ );
83
+ command.option(
84
+ '--wait-after-error <duration>',
67
85
  spaceTrim(`
68
- Wait this long between prompt rounds to avoid hitting rate limits of the harness.
69
- Accepts durations like 1h, 30m, 5s.
86
+ Wait this long before retrying a prompt after an error occurs (up to 3 retries before giving up).
87
+ Accepts durations like 1h, 30m, 5s. Defaults to 10m.
70
88
  `),
71
89
  );
72
90
  // Note: --no-auto disables the default auto behaviour and waits for user confirmation before each prompt
@@ -92,7 +110,9 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
92
110
  test,
93
111
  preserveLogs,
94
112
  priority,
95
- wait,
113
+ waitAfterPrompt: waitAfterPromptValue,
114
+ waitBetweenPrompts: waitBetweenPromptsValue,
115
+ waitAfterError: waitAfterErrorValue,
96
116
  auto,
97
117
  autoMigrate,
98
118
  allowDestructiveAutoMigrate,
@@ -103,7 +123,9 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
103
123
  readonly test?: string | string[];
104
124
  readonly preserveLogs: boolean;
105
125
  readonly priority: number;
106
- readonly wait?: string;
126
+ readonly waitAfterPrompt?: string;
127
+ readonly waitBetweenPrompts?: string;
128
+ readonly waitAfterError?: string;
107
129
  readonly auto: boolean;
108
130
  readonly autoMigrate: boolean;
109
131
  readonly allowDestructiveAutoMigrate: boolean;
@@ -114,18 +136,24 @@ export function $initializeCoderRunCommand(program: Program): $side_effect {
114
136
  isAgentRequired: !dryRun,
115
137
  });
116
138
 
117
- // [1] Parse the --wait and --no-auto options:
118
- // default: run automatically through the queue (no waiting)
139
+ // [1] Parse the wait options and --no-auto:
140
+ // default: run automatically through the queue (no waiting between prompts)
119
141
  // --no-auto: wait for user confirmation before each prompt (interactive mode)
120
- // --wait <duration>: wait that long between prompt rounds to avoid rate limits
142
+ // --wait-after-prompt: pause after a successful round before starting the next prompt
143
+ // --wait-between-prompts: pace from start of one prompt to start of next
144
+ // --wait-after-error: wait before retrying after an error (default 10m)
121
145
  const waitForUser = !auto;
122
- const waitBetweenPrompts = typeof wait === 'string' && wait !== '' ? parseDuration(wait) : 0;
146
+ const waitAfterPrompt = parseOptionalWaitDuration(waitAfterPromptValue, 0);
147
+ const waitBetweenPrompts = parseOptionalWaitDuration(waitBetweenPromptsValue, 0);
148
+ const waitAfterError = parseOptionalWaitDuration(waitAfterErrorValue, DEFAULT_WAIT_AFTER_ERROR_MS);
123
149
 
124
150
  // Convert commander options to RunOptions format
125
151
  const runOptions = {
126
152
  dryRun,
127
153
  waitForUser,
154
+ waitAfterPrompt,
128
155
  waitBetweenPrompts,
156
+ waitAfterError,
129
157
  noCommit: runnerOptions.noCommit,
130
158
  ignoreGitChanges: runnerOptions.ignoreGitChanges,
131
159
  agentName: runnerOptions.agentName,
@@ -15,7 +15,7 @@ import {
15
15
  normalizePromptRunnerCliOptions,
16
16
  PROMPT_RUNNER_DESCRIPTION,
17
17
  } from '../common/promptRunnerCliOptions';
18
- import { parseDuration } from '../../../../scripts/run-codex-prompts/common/parseDuration';
18
+ import { DEFAULT_WAIT_AFTER_ERROR_MS, parseOptionalWaitDuration } from './waitOptions';
19
19
 
20
20
  /**
21
21
  * Default port used by `ptbk coder server`.
@@ -79,10 +79,25 @@ export function $initializeCoderServerCommand(program: Program): $side_effect {
79
79
  addPromptRunnerExecutionOptions(command);
80
80
  command.option('--priority <minimum-priority>', 'Filter prompts by minimum priority level', parseIntOption, 0);
81
81
  command.option(
82
- '--wait <duration>',
82
+ '--wait-after-prompt <duration>',
83
83
  spaceTrim(`
84
- Wait this long between prompt rounds to avoid hitting rate limits of the harness.
85
- Accepts durations like 1h, 30m, 5s.
84
+ Wait this long after each prompt has been implemented, verified and committed before starting the next prompt.
85
+ Accepts durations like 1h, 30m, 5s. Defaults to 0 (no wait).
86
+ `),
87
+ );
88
+ command.option(
89
+ '--wait-between-prompts <duration>',
90
+ spaceTrim(`
91
+ Pace prompts so that each next prompt starts at least this long after the previous one began.
92
+ If the previous prompt already took longer than this, the next prompt starts immediately.
93
+ Accepts durations like 1h, 30m, 5s. Defaults to 0 (no pacing).
94
+ `),
95
+ );
96
+ command.option(
97
+ '--wait-after-error <duration>',
98
+ spaceTrim(`
99
+ Wait this long before retrying a prompt after an error occurs (up to 3 retries before giving up).
100
+ Accepts durations like 1h, 30m, 5s. Defaults to 10m.
86
101
  `),
87
102
  );
88
103
  command.option(
@@ -108,7 +123,9 @@ export function $initializeCoderServerCommand(program: Program): $side_effect {
108
123
  test,
109
124
  preserveLogs,
110
125
  priority,
111
- wait,
126
+ waitAfterPrompt: waitAfterPromptValue,
127
+ waitBetweenPrompts: waitBetweenPromptsValue,
128
+ waitAfterError: waitAfterErrorValue,
112
129
  auto,
113
130
  autoMigrate,
114
131
  allowDestructiveAutoMigrate,
@@ -120,7 +137,9 @@ export function $initializeCoderServerCommand(program: Program): $side_effect {
120
137
  readonly test?: string | string[];
121
138
  readonly preserveLogs: boolean;
122
139
  readonly priority: number;
123
- readonly wait?: string;
140
+ readonly waitAfterPrompt?: string;
141
+ readonly waitBetweenPrompts?: string;
142
+ readonly waitAfterError?: string;
124
143
  readonly auto: boolean;
125
144
  readonly autoMigrate: boolean;
126
145
  readonly allowDestructiveAutoMigrate: boolean;
@@ -132,15 +151,19 @@ export function $initializeCoderServerCommand(program: Program): $side_effect {
132
151
  isAgentRequired: !dryRun,
133
152
  });
134
153
 
135
- // [1] Parse the --wait and --no-auto options (same logic as `coder run`)
154
+ // [1] Parse the wait options and --no-auto (same logic as `coder run`)
136
155
  const waitForUser = !auto;
137
- const waitBetweenPrompts = typeof wait === 'string' && wait !== '' ? parseDuration(wait) : 0;
156
+ const waitAfterPrompt = parseOptionalWaitDuration(waitAfterPromptValue, 0);
157
+ const waitBetweenPrompts = parseOptionalWaitDuration(waitBetweenPromptsValue, 0);
158
+ const waitAfterError = parseOptionalWaitDuration(waitAfterErrorValue, DEFAULT_WAIT_AFTER_ERROR_MS);
138
159
 
139
160
  const runOptions = {
140
161
  port,
141
162
  dryRun,
142
163
  waitForUser,
164
+ waitAfterPrompt,
143
165
  waitBetweenPrompts,
166
+ waitAfterError,
144
167
  noCommit: runnerOptions.noCommit,
145
168
  ignoreGitChanges: runnerOptions.ignoreGitChanges,
146
169
  agentName: runnerOptions.agentName,
@@ -0,0 +1,24 @@
1
+ import { parseDuration } from '../../../../scripts/run-codex-prompts/common/parseDuration';
2
+
3
+ /**
4
+ * Default wait duration applied before retrying a prompt round after an error (10 minutes).
5
+ *
6
+ * @private internal constant of `ptbk coder` wait handling
7
+ */
8
+ export const DEFAULT_WAIT_AFTER_ERROR_MS = 10 * 60 * 1000;
9
+
10
+ /**
11
+ * Parses an optional Commander duration string and returns the resolved milliseconds.
12
+ *
13
+ * Returns `defaultMs` when the flag was not provided or was provided without a non-empty value.
14
+ *
15
+ * @private internal utility of `ptbk coder` wait handling
16
+ */
17
+ export function parseOptionalWaitDuration(value: string | undefined, defaultMs: number): number {
18
+ if (typeof value !== 'string' || value === '') {
19
+ return defaultMs;
20
+ }
21
+ return parseDuration(value);
22
+ }
23
+
24
+ // Note: [💞] Ignore a discrepancy between file name and entity name