@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
package/README.md
CHANGED
|
@@ -482,7 +482,7 @@ In short: tools like Claude Code, Codex, or GitHub Copilot are the **engines**;
|
|
|
482
482
|
5. Promptbook Coder marks the prompt as done `[x]`, records runner metadata, then stages, commits, and pushes the resulting changes.
|
|
483
483
|
6. `ptbk coder verify` reviews completed prompts, archives finished files to `prompts/done/`, and appends a repair prompt when more work is needed.
|
|
484
484
|
|
|
485
|
-
Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treated as not fully written, and prompts with more `!` markers have higher priority. A prompt left as `[^]` was interrupted in the middle of its implementation — the in-progress status is never reverted, so a killed or crashed coder always leaves that signal behind.
|
|
485
|
+
Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treated as not fully written, and prompts with more `!` markers have higher priority. A prompt left as `[^]` was interrupted in the middle of its implementation — the in-progress status is never reverted, so a killed or crashed coder always leaves that signal behind, and `--git-changes continue` resumes exactly that prompt with its uncommitted changes still in place.
|
|
486
486
|
|
|
487
487
|
#### Features
|
|
488
488
|
|
|
@@ -490,7 +490,7 @@ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treate
|
|
|
490
490
|
- **Context injection:** `--agent agents/coding/developer.book --context AGENTS.md` or inline extra instructions
|
|
491
491
|
- **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
|
|
492
492
|
- **Unattended or interactive runs:** default auto mode, or `--no-auto` to wait for user confirmation before each prompt
|
|
493
|
-
- **Git safety:** clean working tree check by default,
|
|
493
|
+
- **Git safety:** clean working tree check by default, or `--git-changes ignore` to keep the changes and `--git-changes continue` to resume an interrupted prompt
|
|
494
494
|
- **Opt-in remote pushes:** commits stay local unless you explicitly pass `--auto-push`
|
|
495
495
|
- **Prompt triage:** `--priority` to process only more important tasks first
|
|
496
496
|
- **Failure logging:** failed runs write a neighboring `.error.log`
|
|
@@ -511,7 +511,7 @@ npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gp
|
|
|
511
511
|
|
|
512
512
|
npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --auto-push
|
|
513
513
|
|
|
514
|
-
npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --
|
|
514
|
+
npx ts-node ./src/cli/test/ptbk.ts coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --git-changes ignore
|
|
515
515
|
|
|
516
516
|
npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
|
|
517
517
|
|
|
@@ -537,7 +537,7 @@ ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh -
|
|
|
537
537
|
|
|
538
538
|
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --auto-push
|
|
539
539
|
|
|
540
|
-
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --test npm run test --
|
|
540
|
+
ptbk coder run --harness github-copilot --model gpt-5.4 --thinking-level xhigh --agent agents/coding/developer.book --context AGENTS.md --test npm run test --git-changes ignore
|
|
541
541
|
|
|
542
542
|
ptbk coder find-refactor-candidates
|
|
543
543
|
|
|
@@ -569,7 +569,7 @@ ptbk coder verify
|
|
|
569
569
|
| `--test-before <mode>` | Runs tests before coding: `no` (default), `yes-and-fail` (stop with results), or `yes-and-fix` (create one repair prompt first); defaults to `npm test` when enabled without `--test`. |
|
|
570
570
|
| `--thinking-level <level>` | Sets reasoning effort for supported runners. |
|
|
571
571
|
| `--no-auto` | Waits for user confirmation before each prompt instead of running automatically through the queue. |
|
|
572
|
-
| `--
|
|
572
|
+
| `--git-changes <mode>` | Decides what happens with a dirty working tree: `fail` (default), `ignore` to keep the changes, or `continue` to resume the single interrupted `[^]` prompt with them. |
|
|
573
573
|
| `--priority <n>` | Runs only prompts at or above the given priority. |
|
|
574
574
|
| `--dry-run` | Prints which prompts are ready instead of executing them. |
|
|
575
575
|
| `--allow-credits` | Lets OpenAI Codex spend credits when required. |
|
package/esm/index.es.js
CHANGED
|
@@ -29,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
29
29
|
* @generated
|
|
30
30
|
* @see https://github.com/webgptorg/promptbook
|
|
31
31
|
*/
|
|
32
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-
|
|
32
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.114.0-20';
|
|
33
33
|
/**
|
|
34
34
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
35
35
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -3241,6 +3241,97 @@ async function $runGoScriptWithOutput(options) {
|
|
|
3241
3241
|
});
|
|
3242
3242
|
}
|
|
3243
3243
|
|
|
3244
|
+
/**
|
|
3245
|
+
* Token of the currently active timed wait, if the runner is inside one.
|
|
3246
|
+
*/
|
|
3247
|
+
let activeSkippableWaitToken;
|
|
3248
|
+
/**
|
|
3249
|
+
* Whether the user requested the active timed wait to end immediately.
|
|
3250
|
+
*/
|
|
3251
|
+
let isSkipCurrentWaitRequested = false;
|
|
3252
|
+
/**
|
|
3253
|
+
* Promise resolvers waiting for the active timed wait to be skipped.
|
|
3254
|
+
*/
|
|
3255
|
+
const SKIP_CURRENT_WAIT_RESOLVERS = new Map();
|
|
3256
|
+
/**
|
|
3257
|
+
* Starts one timed wait which can be skipped by the `S` hotkey.
|
|
3258
|
+
*/
|
|
3259
|
+
function beginSkippableWait() {
|
|
3260
|
+
const waitToken = Symbol('coder-run-skippable-wait');
|
|
3261
|
+
activeSkippableWaitToken = waitToken;
|
|
3262
|
+
isSkipCurrentWaitRequested = false;
|
|
3263
|
+
SKIP_CURRENT_WAIT_RESOLVERS.clear();
|
|
3264
|
+
return waitToken;
|
|
3265
|
+
}
|
|
3266
|
+
/**
|
|
3267
|
+
* Finishes one timed wait and clears any skip request that belonged to it.
|
|
3268
|
+
*/
|
|
3269
|
+
function finishSkippableWait(waitToken) {
|
|
3270
|
+
if (activeSkippableWaitToken !== waitToken) {
|
|
3271
|
+
return;
|
|
3272
|
+
}
|
|
3273
|
+
activeSkippableWaitToken = undefined;
|
|
3274
|
+
isSkipCurrentWaitRequested = false;
|
|
3275
|
+
resolveSkipCurrentWaitResolvers(waitToken);
|
|
3276
|
+
SKIP_CURRENT_WAIT_RESOLVERS.delete(waitToken);
|
|
3277
|
+
}
|
|
3278
|
+
/**
|
|
3279
|
+
* Returns whether one timed wait should end early.
|
|
3280
|
+
*/
|
|
3281
|
+
function shouldSkipCurrentWait(waitToken) {
|
|
3282
|
+
return activeSkippableWaitToken === waitToken && isSkipCurrentWaitRequested;
|
|
3283
|
+
}
|
|
3284
|
+
/**
|
|
3285
|
+
* Waits for either a timeout or an `S` hotkey skip request.
|
|
3286
|
+
*/
|
|
3287
|
+
async function waitForSkippableMilliseconds(waitToken, durationMs) {
|
|
3288
|
+
if (durationMs <= 0 || shouldSkipCurrentWait(waitToken)) {
|
|
3289
|
+
return;
|
|
3290
|
+
}
|
|
3291
|
+
await new Promise((resolve) => {
|
|
3292
|
+
let timeout = setTimeout(resolveWait, durationMs);
|
|
3293
|
+
const resolver = () => resolveWait();
|
|
3294
|
+
const resolvers = getSkipCurrentWaitResolvers(waitToken);
|
|
3295
|
+
resolvers.add(resolver);
|
|
3296
|
+
function resolveWait() {
|
|
3297
|
+
if (timeout !== undefined) {
|
|
3298
|
+
clearTimeout(timeout);
|
|
3299
|
+
timeout = undefined;
|
|
3300
|
+
}
|
|
3301
|
+
resolvers.delete(resolver);
|
|
3302
|
+
if (resolvers.size === 0) {
|
|
3303
|
+
SKIP_CURRENT_WAIT_RESOLVERS.delete(waitToken);
|
|
3304
|
+
}
|
|
3305
|
+
resolve();
|
|
3306
|
+
}
|
|
3307
|
+
});
|
|
3308
|
+
}
|
|
3309
|
+
/**
|
|
3310
|
+
* Gets or creates the resolver set for one timed wait.
|
|
3311
|
+
*/
|
|
3312
|
+
function getSkipCurrentWaitResolvers(waitToken) {
|
|
3313
|
+
const existingResolvers = SKIP_CURRENT_WAIT_RESOLVERS.get(waitToken);
|
|
3314
|
+
if (existingResolvers !== undefined) {
|
|
3315
|
+
return existingResolvers;
|
|
3316
|
+
}
|
|
3317
|
+
const resolvers = new Set();
|
|
3318
|
+
SKIP_CURRENT_WAIT_RESOLVERS.set(waitToken, resolvers);
|
|
3319
|
+
return resolvers;
|
|
3320
|
+
}
|
|
3321
|
+
/**
|
|
3322
|
+
* Resolves all pending skip waiters for one timed wait.
|
|
3323
|
+
*/
|
|
3324
|
+
function resolveSkipCurrentWaitResolvers(waitToken) {
|
|
3325
|
+
const resolvers = SKIP_CURRENT_WAIT_RESOLVERS.get(waitToken);
|
|
3326
|
+
if (resolvers === undefined) {
|
|
3327
|
+
return;
|
|
3328
|
+
}
|
|
3329
|
+
for (const resolver of resolvers) {
|
|
3330
|
+
resolver();
|
|
3331
|
+
}
|
|
3332
|
+
resolvers.clear();
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3244
3335
|
/**
|
|
3245
3336
|
* Minimum timer duration used to avoid a zero-millisecond polling loop.
|
|
3246
3337
|
*/
|
|
@@ -3290,6 +3381,32 @@ async function waitForRegularMilliseconds(durationMs) {
|
|
|
3290
3381
|
await new Promise((resolve) => setTimeout(resolve, durationMs));
|
|
3291
3382
|
}
|
|
3292
3383
|
|
|
3384
|
+
/**
|
|
3385
|
+
* Waits until one wall-clock deadline has passed, or until the user skips the wait with the `S` control.
|
|
3386
|
+
*
|
|
3387
|
+
* This is the single way `ptbk coder` waits for a deadline the user is allowed to cut short, so every
|
|
3388
|
+
* wait which shows the `S Skip current waiting` control really reacts to it: the pacing waits between
|
|
3389
|
+
* prompts, the cool-down after an error, the harness session-limit waits and the server keep-alive poll.
|
|
3390
|
+
*
|
|
3391
|
+
* @private internal utility of `ptbk coder` wait handling
|
|
3392
|
+
*/
|
|
3393
|
+
async function waitForSkippableWorldTimeDeadline(options) {
|
|
3394
|
+
const { deadlineTimeMs, pollIntervalMs, onTick } = options;
|
|
3395
|
+
const waitToken = beginSkippableWait();
|
|
3396
|
+
try {
|
|
3397
|
+
await waitUntilWorldTimeDeadline({
|
|
3398
|
+
deadlineTimeMs,
|
|
3399
|
+
pollIntervalMs,
|
|
3400
|
+
onTick,
|
|
3401
|
+
shouldStopWaiting: () => shouldSkipCurrentWait(waitToken),
|
|
3402
|
+
waitForMilliseconds: (waitDurationMs) => waitForSkippableMilliseconds(waitToken, waitDurationMs),
|
|
3403
|
+
});
|
|
3404
|
+
}
|
|
3405
|
+
finally {
|
|
3406
|
+
finishSkippableWait(waitToken);
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3293
3410
|
/**
|
|
3294
3411
|
* Base delimiter used for passing large prompts through stdin.
|
|
3295
3412
|
*/
|
|
@@ -3697,6 +3814,10 @@ class ClaudeCodeRunner {
|
|
|
3697
3814
|
}
|
|
3698
3815
|
/**
|
|
3699
3816
|
* Waits until the Claude Code session can be resumed, keeping terminal status clear.
|
|
3817
|
+
*
|
|
3818
|
+
* The wait runs in the `waiting` phase, where the terminal UI offers `S Skip current waiting`, so it is
|
|
3819
|
+
* a skippable wait: pressing `S` resumes the session with `--resume` immediately instead of sitting out
|
|
3820
|
+
* the reset window.
|
|
3700
3821
|
*/
|
|
3701
3822
|
async function waitForClaudeCodeSessionLimitReset(sessionLimit, resurrectionCount, options) {
|
|
3702
3823
|
var _a, _b;
|
|
@@ -3707,7 +3828,7 @@ async function waitForClaudeCodeSessionLimitReset(sessionLimit, resurrectionCoun
|
|
|
3707
3828
|
if ((_a = options.shouldPrintLiveOutput) !== null && _a !== void 0 ? _a : true) {
|
|
3708
3829
|
console.warn(colors.yellow(`[claude-code] Session limit detected for ${sessionLimit.sessionId}. Resurrection #${resurrectionCount} will resume with --resume after ${formatDurationMs(delayMs)}. ${resetSummary}`));
|
|
3709
3830
|
}
|
|
3710
|
-
await
|
|
3831
|
+
await waitForSkippableWorldTimeDeadline({
|
|
3711
3832
|
deadlineTimeMs: resetDeadlineTimeMs,
|
|
3712
3833
|
pollIntervalMs: CLAUDE_CODE_SESSION_RESURRECTION_POLL_MS,
|
|
3713
3834
|
onTick: async (remainingDelayMs) => {
|
|
@@ -29543,7 +29664,7 @@ function createPromptRunnerOptions(options) {
|
|
|
29543
29664
|
waitBetweenPrompts: 0,
|
|
29544
29665
|
waitAfterError: 0,
|
|
29545
29666
|
noCommit: true,
|
|
29546
|
-
|
|
29667
|
+
gitChanges: 'ignore',
|
|
29547
29668
|
normalizeLineEndings: false,
|
|
29548
29669
|
allowCredits: options.allowCredits,
|
|
29549
29670
|
isVerbose: options.isVerbose,
|