@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/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-39`).
|
|
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.114.0-
|
|
3
|
+
"version": "0.114.0-40",
|
|
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,
|
|
@@ -103,12 +103,11 @@
|
|
|
103
103
|
"bottleneck": "2.19.5",
|
|
104
104
|
"colors": "1.4.0",
|
|
105
105
|
"commander": "12.0.0",
|
|
106
|
-
"crypto": "1.0.1",
|
|
107
106
|
"crypto-js": "4.2.0",
|
|
108
107
|
"dotenv": "16.3.2",
|
|
109
|
-
"express": "4.
|
|
110
|
-
"express-openapi-validator": "5.
|
|
111
|
-
"glob
|
|
108
|
+
"express": "4.22.3",
|
|
109
|
+
"express-openapi-validator": "5.6.2",
|
|
110
|
+
"glob": "13.0.6",
|
|
112
111
|
"ignore": "^5.3.2",
|
|
113
112
|
"jsdom": "25.0.1",
|
|
114
113
|
"jszip": "3.10.1",
|
|
@@ -123,27 +122,27 @@
|
|
|
123
122
|
"rxjs": "7.8.2",
|
|
124
123
|
"showdown": "2.1.0",
|
|
125
124
|
"socket.io": "4.8.3",
|
|
126
|
-
"socket.io-client": "4.
|
|
125
|
+
"socket.io-client": "4.8.3",
|
|
127
126
|
"spacetrim": "0.11.60",
|
|
128
127
|
"swagger-ui-express": "5.0.1",
|
|
129
128
|
"userhome": "1.0.1",
|
|
130
129
|
"waitasecond": "1.11.164",
|
|
131
130
|
"typescript": "5.2.2",
|
|
132
131
|
"ts-node": "10.9.2",
|
|
133
|
-
"next": "15.
|
|
132
|
+
"next": "15.5.25",
|
|
134
133
|
"lucide-react": "0.536.0",
|
|
135
134
|
"raw-loader": "^4.0.2",
|
|
136
135
|
"tailwindcss": "3.4.19",
|
|
137
136
|
"@tailwindcss/typography": "0.5.19",
|
|
138
|
-
"postcss": "8.5.
|
|
137
|
+
"postcss": "8.5.28",
|
|
139
138
|
"autoprefixer": "10.4.27",
|
|
140
139
|
"@ai-sdk/openai": "2.0.127",
|
|
141
|
-
"@aws-sdk/client-s3": "3.
|
|
140
|
+
"@aws-sdk/client-s3": "3.1134.0",
|
|
142
141
|
"@dnd-kit/core": "6.3.1",
|
|
143
142
|
"@dnd-kit/sortable": "10.0.0",
|
|
144
143
|
"@dnd-kit/utilities": "3.2.2",
|
|
145
144
|
"@elevenlabs/react": "0.12.3",
|
|
146
|
-
"@modelcontextprotocol/sdk": "1.
|
|
145
|
+
"@modelcontextprotocol/sdk": "1.26.0",
|
|
147
146
|
"@monaco-editor/react": "4.7.0",
|
|
148
147
|
"@node-saml/node-saml": "^5.1.0",
|
|
149
148
|
"@prisma/studio-core": "0.27.3",
|
|
@@ -160,19 +159,19 @@
|
|
|
160
159
|
"configchecker": "1.5.132",
|
|
161
160
|
"cross-fetch": "4.0.0",
|
|
162
161
|
"destroyable": "0.12.145",
|
|
163
|
-
"dompurify": "3.4.
|
|
162
|
+
"dompurify": "3.4.15",
|
|
164
163
|
"formidable": "3.5.4",
|
|
165
164
|
"highlight.js": "11.11.1",
|
|
166
165
|
"html-to-image": "1.11.13",
|
|
167
|
-
"jspdf": "4.1
|
|
166
|
+
"jspdf": "4.2.1",
|
|
168
167
|
"katex": "0.16.45",
|
|
169
168
|
"leaflet": "1.9.4",
|
|
170
169
|
"localtunnel": "^2.0.2",
|
|
171
170
|
"lorem-ipsum": "2.0.8",
|
|
172
|
-
"mailparser": "3.9.
|
|
171
|
+
"mailparser": "3.9.20",
|
|
173
172
|
"monaco-editor": "0.54.0",
|
|
174
173
|
"node-gzip": "1.1.2",
|
|
175
|
-
"nodemailer": "^
|
|
174
|
+
"nodemailer": "^9.1.1",
|
|
176
175
|
"qrcode": "1.5.4",
|
|
177
176
|
"swagger-ui-dist": "5.32.15",
|
|
178
177
|
"turndown": "7.2.4",
|
|
@@ -181,7 +180,6 @@
|
|
|
181
180
|
"y-monaco": "0.1.6",
|
|
182
181
|
"y-protocols": "1.0.7",
|
|
183
182
|
"y-websocket": "3.0.0",
|
|
184
|
-
"y-websocket-server": "1.0.2",
|
|
185
183
|
"yjs": "13.6.30",
|
|
186
184
|
"zeptomail": "7.0.2",
|
|
187
185
|
"zod": "4.3.6"
|
|
@@ -3,12 +3,12 @@ import type {
|
|
|
3
3
|
Command as Program /* <- Note: [🔸] Using Program because Command is misleading name */,
|
|
4
4
|
} from 'commander';
|
|
5
5
|
import { readFile, writeFile } from 'fs/promises';
|
|
6
|
-
import glob from 'glob-promise'; // <- TODO: [🚰] Use just 'glob'
|
|
7
6
|
import { basename } from 'path';
|
|
8
7
|
import { spaceTrim } from 'spacetrim';
|
|
9
8
|
import { prettifyPipelineString } from '../../conversion/prettify/prettifyPipelineString';
|
|
10
9
|
import { assertsError } from '../../errors/assertsError';
|
|
11
10
|
import { validatePipelineString } from '../../pipeline/validatePipelineString';
|
|
11
|
+
import { findFilesByGlob } from '../../utils/files/findFilesByGlob';
|
|
12
12
|
import type { $side_effect } from '../../utils/organization/$side_effect';
|
|
13
13
|
import { handleActionErrors } from './common/handleActionErrors';
|
|
14
14
|
|
|
@@ -40,7 +40,7 @@ export function $initializePrettifyCommand(program: Program): $side_effect {
|
|
|
40
40
|
prettifyCommand.action(
|
|
41
41
|
handleActionErrors(async (filesGlob, cliOptions) => {
|
|
42
42
|
const { ignore, verbose: isVerbose } = cliOptions;
|
|
43
|
-
const filenames = await
|
|
43
|
+
const filenames = await findFilesByGlob(filesGlob!, { ignore });
|
|
44
44
|
// <- TODO: [😶]
|
|
45
45
|
|
|
46
46
|
for (const filename of filenames) {
|
|
@@ -3,7 +3,6 @@ import type {
|
|
|
3
3
|
Command as Program /* <- Note: [🔸] Using Program because Command is misleading name */,
|
|
4
4
|
} from 'commander';
|
|
5
5
|
import { readFile } from 'fs/promises';
|
|
6
|
-
import glob from 'glob-promise'; // <- TODO: [🚰] Use just 'glob'
|
|
7
6
|
import { basename } from 'path';
|
|
8
7
|
import { spaceTrim } from 'spacetrim';
|
|
9
8
|
import { getAllCommitmentsToolFunctionsForNode } from '../../commitments/_common/getAllCommitmentsToolFunctionsForNode';
|
|
@@ -18,6 +17,7 @@ import { validatePipelineString } from '../../pipeline/validatePipelineString';
|
|
|
18
17
|
import { $provideFilesystemForNode } from '../../scrapers/_common/register/$provideFilesystemForNode';
|
|
19
18
|
import { $provideScrapersForNode } from '../../scrapers/_common/register/$provideScrapersForNode';
|
|
20
19
|
import { JavascriptExecutionTools } from '../../scripting/javascript/JavascriptExecutionTools';
|
|
20
|
+
import { findFilesByGlob } from '../../utils/files/findFilesByGlob';
|
|
21
21
|
import type { $side_effect } from '../../utils/organization/$side_effect';
|
|
22
22
|
import { $provideLlmToolsForCli } from '../common/$provideLlmToolsForCli';
|
|
23
23
|
import { handleActionErrors } from './common/handleActionErrors';
|
|
@@ -89,7 +89,7 @@ export function $initializeTestCommand(program: Program): $side_effect {
|
|
|
89
89
|
|
|
90
90
|
const ignore = (ignoreRaw as string).split(',').map((pattern) => pattern.trim());
|
|
91
91
|
|
|
92
|
-
const filenames = await
|
|
92
|
+
const filenames = await findFilesByGlob(filesGlob!, { ignore });
|
|
93
93
|
// <- TODO: [😶]
|
|
94
94
|
|
|
95
95
|
// console.log({ filesGlob, ignore, filenames });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import colors from 'colors'; // <- TODO: [🔶] Make system to put color and style to both node and browser
|
|
2
2
|
import { readFile, writeFile } from 'fs';
|
|
3
|
-
import glob from 'glob-promise'; // <- TODO: [🚰] Use just 'glob'
|
|
4
3
|
import JSON5 from 'json5';
|
|
5
4
|
import { join } from 'path';
|
|
6
5
|
import { spaceTrim } from 'spacetrim';
|
|
7
6
|
import { promisify } from 'util';
|
|
8
7
|
import { PipelineExecutionError } from '../../../errors/PipelineExecutionError';
|
|
8
|
+
import { findFilesByGlob } from '../../../utils/files/findFilesByGlob';
|
|
9
9
|
import type { AutomaticTranslator } from './automatic-translators/AutomaticTranslator';
|
|
10
10
|
import type { TranslatorOptions } from './automatic-translators/TranslatorOptions';
|
|
11
11
|
|
|
@@ -19,7 +19,9 @@ export async function translateMessages({
|
|
|
19
19
|
from,
|
|
20
20
|
to,
|
|
21
21
|
}: { automaticTranslator: AutomaticTranslator } & TranslatorOptions) {
|
|
22
|
-
for (const filename of await
|
|
22
|
+
for (const filename of await findFilesByGlob(
|
|
23
|
+
join(__dirname, '../../translations/', from || 'en', '/**/*.json5'),
|
|
24
|
+
)) {
|
|
23
25
|
// <- TODO: [😶]
|
|
24
26
|
const fileData = JSON5.parse(await promisify(readFile)(filename, 'utf-8'));
|
|
25
27
|
|