@promptbook/cli 0.114.0-39 → 0.114.0-40
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/agents/default/developer.book +13 -19
- package/esm/index.es.js +177 -63
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/runGoScript/createScriptOutputLineReader.d.ts +22 -0
- package/esm/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +11 -1
- package/esm/scripts/run-codex-prompts/ui/startCoderRunUiSubscriptionUsageRefresh.d.ts +37 -0
- package/esm/src/utils/files/findFilesByGlob.d.ts +28 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +13 -15
- package/src/cli/cli-commands/prettify.ts +2 -2
- package/src/cli/cli-commands/test-command.ts +2 -2
- package/src/execution/translation/automatic-translate/translateMessages.ts +4 -2
- package/src/other/templates/getTemplatesPipelineCollection.ts +834 -689
- package/src/utils/files/findFilesByGlob.ts +46 -0
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +180 -67
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/runGoScript/createScriptOutputLineReader.d.ts +22 -0
- package/umd/scripts/run-codex-prompts/runners/claude-code/ClaudeCodeRunner.d.ts +11 -1
- package/umd/scripts/run-codex-prompts/ui/startCoderRunUiSubscriptionUsageRefresh.d.ts +37 -0
- package/umd/src/utils/files/findFilesByGlob.d.ts +28 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns the arbitrarily chopped chunks of one shell output stream into completed lines.
|
|
3
|
+
*
|
|
4
|
+
* @private internal type of the script runners
|
|
5
|
+
*/
|
|
6
|
+
export type ScriptOutputLineReader = {
|
|
7
|
+
/**
|
|
8
|
+
* Returns every line which the given chunk has completed, keeping the unterminated rest for the next chunk.
|
|
9
|
+
*/
|
|
10
|
+
readCompletedLines(chunk: string): readonly string[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Creates a line reader for one shell output stream.
|
|
14
|
+
*
|
|
15
|
+
* A chunk boundary can fall into the middle of a line, so the unterminated rest is remembered until the next chunk
|
|
16
|
+
* completes it. Every observer of the live output therefore sees whole lines only, exactly as the finished output
|
|
17
|
+
* would contain them. One reader belongs to one stream, because interleaving `stdout` and `stderr` into a single
|
|
18
|
+
* buffer would splice two unrelated halves into one nonexistent line.
|
|
19
|
+
*
|
|
20
|
+
* @private internal utility of the script runners
|
|
21
|
+
*/
|
|
22
|
+
export declare function createScriptOutputLineReader(): ScriptOutputLineReader;
|
|
@@ -17,7 +17,9 @@ export declare class ClaudeCodeRunner implements PromptRunner {
|
|
|
17
17
|
/**
|
|
18
18
|
* Returns the latest subscription-limit snapshot emitted by this Claude Code session.
|
|
19
19
|
*
|
|
20
|
-
* Claude exposes these values in the normal stream
|
|
20
|
+
* Claude exposes these values in the normal stream, so no separate quota-only model call is made. The snapshot is
|
|
21
|
+
* kept current while the prompt is still running, which is what lets the dashboard poll it instead of showing the
|
|
22
|
+
* values of the previous prompt for the whole round.
|
|
21
23
|
*/
|
|
22
24
|
getSubscriptionUsage(): Promise<HarnessSubscriptionUsage | undefined>;
|
|
23
25
|
/**
|
|
@@ -28,6 +30,14 @@ export declare class ClaudeCodeRunner implements PromptRunner {
|
|
|
28
30
|
* Runs one Claude Code CLI process and returns its raw output.
|
|
29
31
|
*/
|
|
30
32
|
private runClaudeCodeOnce;
|
|
33
|
+
/**
|
|
34
|
+
* Keeps the snapshot current from one line of the stream which is still being written.
|
|
35
|
+
*
|
|
36
|
+
* A coding prompt can run for hours, and a subscription window keeps moving during all of it. Only a rate-limit
|
|
37
|
+
* event can change the snapshot, so the far more frequent tool and message lines are recognized by their type and
|
|
38
|
+
* skipped before anything is parsed.
|
|
39
|
+
*/
|
|
40
|
+
private updateSubscriptionUsageFromOutputLine;
|
|
31
41
|
/**
|
|
32
42
|
* Keeps the newest usable Claude subscription-limit values reported by the stream.
|
|
33
43
|
*
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PromptRunner } from '../runners/types/PromptRunner';
|
|
2
|
+
import type { CoderRunUiState } from './CoderRunUiState';
|
|
3
|
+
/**
|
|
4
|
+
* How often the harness subscription usage is re-read while `ptbk coder` is running.
|
|
5
|
+
*
|
|
6
|
+
* @private internal constant of coder run UI
|
|
7
|
+
*/
|
|
8
|
+
export declare const CODER_RUN_SUBSCRIPTION_USAGE_REFRESH_INTERVAL_MS: number;
|
|
9
|
+
/**
|
|
10
|
+
* Stops the periodic subscription-usage refresh of one coder run.
|
|
11
|
+
*
|
|
12
|
+
* @private internal type of coder run UI
|
|
13
|
+
*/
|
|
14
|
+
export type CoderRunUiSubscriptionUsageRefreshHandle = {
|
|
15
|
+
/**
|
|
16
|
+
* Ends the refresh, after which the dashboard keeps the last read values.
|
|
17
|
+
*/
|
|
18
|
+
stop(): void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Keeps the harness subscription usage of the coder-run dashboard current for the whole run.
|
|
22
|
+
*
|
|
23
|
+
* A single coding prompt can take hours, so reading the usage once per prompt leaves the dashboard showing values
|
|
24
|
+
* which are long out of date. Reading it on its own clock instead means the percentages and reset countdowns always
|
|
25
|
+
* describe the present moment, no matter how long the current prompt runs.
|
|
26
|
+
*
|
|
27
|
+
* Refreshes never overlap: a read which is still in flight when the next tick arrives simply skips that tick, so a
|
|
28
|
+
* slow or hanging harness cannot pile up requests. The whole refresh is optional dashboard information, so a harness
|
|
29
|
+
* without subscription limits and a run without a dashboard start no timer at all.
|
|
30
|
+
*
|
|
31
|
+
* @private internal utility of coder run UI
|
|
32
|
+
*/
|
|
33
|
+
export declare function startCoderRunUiSubscriptionUsageRefresh(options: {
|
|
34
|
+
readonly runner: PromptRunner;
|
|
35
|
+
readonly uiState: CoderRunUiState | undefined;
|
|
36
|
+
readonly refreshIntervalMs?: number;
|
|
37
|
+
}): CoderRunUiSubscriptionUsageRefreshHandle;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type GlobOptionsWithFileTypesUnset } from 'glob';
|
|
2
|
+
import type { string_filename } from '../../types/string_filename';
|
|
3
|
+
/**
|
|
4
|
+
* Options of `findFilesByGlob`
|
|
5
|
+
*
|
|
6
|
+
* Note: These are the options of `glob` itself, only `ignore` also accepts a readonly array
|
|
7
|
+
* @see https://www.npmjs.com/package/glob#options
|
|
8
|
+
*
|
|
9
|
+
* @private internal type of `findFilesByGlob`
|
|
10
|
+
*/
|
|
11
|
+
export type FindFilesByGlobOptions = Omit<GlobOptionsWithFileTypesUnset, 'ignore'> & {
|
|
12
|
+
/**
|
|
13
|
+
* Glob patterns which are excluded from the result
|
|
14
|
+
*/
|
|
15
|
+
readonly ignore?: string | ReadonlyArray<string>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Finds all filenames matching a glob pattern
|
|
19
|
+
*
|
|
20
|
+
* Note: This is the single place where `glob` is used, so that every caller gets the same shape of results
|
|
21
|
+
* on every operating system - POSIX separators and a stable order - which `glob` itself does not guarantee
|
|
22
|
+
*
|
|
23
|
+
* @param pattern Glob pattern to match, for example `./src/**\/*.ts`
|
|
24
|
+
* @param options Options passed to `glob`
|
|
25
|
+
* @returns Matching filenames with `/` separators, sorted alphabetically
|
|
26
|
+
* @private within the repository
|
|
27
|
+
*/
|
|
28
|
+
export declare function findFilesByGlob(pattern: string, options?: FindFilesByGlobOptions): Promise<Array<string_filename>>;
|
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-39`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|