@promptbook/node 0.112.0-42 → 0.112.0-43
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 +10 -3
- package/esm/index.es.js +113 -22
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/getTypescriptModule.d.ts +19 -0
- package/esm/src/cli/cli-commands/coder/getTypescriptModule.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.test.d.ts +1 -0
- package/esm/src/llm-providers/agent/Agent.test.d.ts +1 -0
- package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +4 -0
- package/esm/src/llm-providers/agent/AgentOptions.d.ts +8 -0
- package/esm/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +9 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +113 -22
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/getTypescriptModule.d.ts +19 -0
- package/umd/src/cli/cli-commands/coder/getTypescriptModule.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.test.d.ts +1 -0
- package/umd/src/llm-providers/agent/Agent.test.d.ts +1 -0
- package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +4 -0
- package/umd/src/llm-providers/agent/AgentOptions.d.ts +8 -0
- package/umd/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +9 -0
- package/umd/src/version.d.ts +1 -1
package/README.md
CHANGED
|
@@ -482,6 +482,7 @@ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treate
|
|
|
482
482
|
- **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
|
|
483
483
|
- **Interactive or unattended runs:** default wait mode, or `--no-wait` for batch execution
|
|
484
484
|
- **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
|
|
485
|
+
- **Opt-in remote pushes:** commits stay local unless you explicitly pass `--auto-push`
|
|
485
486
|
- **Prompt triage:** `--priority` to process only more important tasks first
|
|
486
487
|
- **Failure logging:** failed runs write a neighboring `.error.log`
|
|
487
488
|
- **Line-ending normalization:** changed files are normalized back to LF by default
|
|
@@ -499,6 +500,8 @@ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompt
|
|
|
499
500
|
|
|
500
501
|
npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
|
|
501
502
|
|
|
503
|
+
npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
|
|
504
|
+
|
|
502
505
|
npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
|
|
503
506
|
|
|
504
507
|
npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
|
|
@@ -521,9 +524,11 @@ npx ptbk coder generate-boilerplates
|
|
|
521
524
|
|
|
522
525
|
npx ptbk coder generate-boilerplates --template prompts/templates/common.md
|
|
523
526
|
|
|
524
|
-
npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
|
|
527
|
+
npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test
|
|
528
|
+
|
|
529
|
+
npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
|
|
525
530
|
|
|
526
|
-
npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
|
|
531
|
+
npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test --ignore-git-changes --no-wait
|
|
527
532
|
|
|
528
533
|
npx ptbk coder find-refactor-candidates
|
|
529
534
|
|
|
@@ -540,7 +545,7 @@ npx ptbk coder verify
|
|
|
540
545
|
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------ | ---- | ----- | ------------------------------------------------------------------------ |
|
|
541
546
|
| `ptbk coder init` | Creates `prompts/`, `prompts/done/`, the project-generic template files materialized in `prompts/templates/` (currently `common.md`), and a starter `AGENTS.md`; ensures `.env` contains `CODING_AGENT_GIT_NAME`, `CODING_AGENT_GIT_EMAIL`, and `CODING_AGENT_GIT_SIGNING_KEY`; adds helper coder scripts to `package.json`; ensures `.gitignore` contains `/.tmp`; and configures `.vscode/settings.json` to save pasted prompt images into `prompts/screenshots/`. |
|
|
542
547
|
| `ptbk coder generate-boilerplates` | Creates new prompt markdown files with fresh emoji tags so you can quickly fill in coding tasks; `--template` accepts either a built-in alias or a markdown file path relative to the project root. |
|
|
543
|
-
| `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, marks success or failure,
|
|
548
|
+
| `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, can optionally verify each attempt with a shell test command and feed failing output back for retries, then marks success or failure, commits the result, and pushes only when `--auto-push` is enabled. |
|
|
544
549
|
| `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors; `--level <xlow | low | medium | high | xhigh | extreme>` ranges from a very benevolent scan to a very aggressive sweep. |
|
|
545
550
|
| `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
|
|
546
551
|
|
|
@@ -551,12 +556,14 @@ npx ptbk coder verify
|
|
|
551
556
|
| `--agent <name>` | Selects the coding backend. |
|
|
552
557
|
| `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
|
|
553
558
|
| `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
|
|
559
|
+
| `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
|
|
554
560
|
| `--thinking-level <level>` | Sets reasoning effort for supported runners. |
|
|
555
561
|
| `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
|
|
556
562
|
| `--ignore-git-changes` | Disables the clean-working-tree guard. |
|
|
557
563
|
| `--priority <n>` | Runs only prompts at or above the given priority. |
|
|
558
564
|
| `--dry-run` | Prints which prompts are ready instead of executing them. |
|
|
559
565
|
| `--allow-credits` | Lets OpenAI Codex spend credits when required. |
|
|
566
|
+
| `--auto-push` | Pushes each successful coding-agent commit to the configured remote. |
|
|
560
567
|
| `--auto-migrate` | Runs testing-server database migrations after each successful prompt. |
|
|
561
568
|
|
|
562
569
|
#### Typical usage pattern
|
package/esm/index.es.js
CHANGED
|
@@ -35,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
35
35
|
* @generated
|
|
36
36
|
* @see https://github.com/webgptorg/promptbook
|
|
37
37
|
*/
|
|
38
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
38
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-43';
|
|
39
39
|
/**
|
|
40
40
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
41
41
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -18988,6 +18988,15 @@ const teamToolFunctions = {};
|
|
|
18988
18988
|
* Map of team tool titles.
|
|
18989
18989
|
*/
|
|
18990
18990
|
const teamToolTitles = {};
|
|
18991
|
+
/**
|
|
18992
|
+
* Shared TEAM usage rules appended ahead of teammate listings.
|
|
18993
|
+
*
|
|
18994
|
+
* @private
|
|
18995
|
+
*/
|
|
18996
|
+
const TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES = [
|
|
18997
|
+
'- If a teammate is relevant to the request, consult that teammate using the matching tool.',
|
|
18998
|
+
'- Do not ask the user for information that a listed teammate can provide directly.',
|
|
18999
|
+
];
|
|
18991
19000
|
/**
|
|
18992
19001
|
* Constant for remote agents by Url.
|
|
18993
19002
|
*/
|
|
@@ -19077,12 +19086,9 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19077
19086
|
if (updatedTools.some((tool) => tool.name === entry.toolName)) {
|
|
19078
19087
|
continue;
|
|
19079
19088
|
}
|
|
19080
|
-
const toolDescription = entry.description
|
|
19081
|
-
? `Consult teammate ${entry.teammate.label}\n${entry.description}`
|
|
19082
|
-
: `Consult teammate ${entry.teammate.label}`;
|
|
19083
19089
|
updatedTools.push({
|
|
19084
19090
|
name: entry.toolName,
|
|
19085
|
-
description:
|
|
19091
|
+
description: buildTeamToolDescription(entry),
|
|
19086
19092
|
parameters: {
|
|
19087
19093
|
type: 'object',
|
|
19088
19094
|
properties: {
|
|
@@ -19151,22 +19157,72 @@ function resolveTeamTeammateLabels(teamContent, teammates) {
|
|
|
19151
19157
|
/**
|
|
19152
19158
|
* Builds the textual TEAM section body for the final system message.
|
|
19153
19159
|
*
|
|
19154
|
-
* Each teammate is listed with its tool name
|
|
19155
|
-
* Uses `spaceTrim` to ensure consistent whitespace and indentation.
|
|
19160
|
+
* Each teammate is listed with its tool name, TEAM instructions, and optional profile hints.
|
|
19156
19161
|
*/
|
|
19157
19162
|
function buildTeamSystemMessageBody(teamEntries) {
|
|
19158
|
-
const lines =
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
});
|
|
19163
|
+
const lines = [
|
|
19164
|
+
...TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES,
|
|
19165
|
+
'',
|
|
19166
|
+
...teamEntries.map((entry, index) => {
|
|
19167
|
+
const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
|
|
19168
|
+
const detailLines = collectTeamEntryDetails(entry).map(formatTeamEntryDetailLine);
|
|
19169
|
+
return [toolLine, ...detailLines].join('\n');
|
|
19170
|
+
}),
|
|
19171
|
+
];
|
|
19168
19172
|
return lines.join('\n');
|
|
19169
19173
|
}
|
|
19174
|
+
/**
|
|
19175
|
+
* Builds the model-visible description for one teammate tool.
|
|
19176
|
+
*
|
|
19177
|
+
* @private
|
|
19178
|
+
*/
|
|
19179
|
+
function buildTeamToolDescription(entry) {
|
|
19180
|
+
const detailLines = collectTeamEntryDetails(entry).map(({ label, content }) => `${label}: ${content}`);
|
|
19181
|
+
return [`Consult teammate ${entry.teammate.label}`, ...detailLines].join('\n');
|
|
19182
|
+
}
|
|
19183
|
+
/**
|
|
19184
|
+
* Collects structured teammate details that should stay visible to the model.
|
|
19185
|
+
*
|
|
19186
|
+
* @private
|
|
19187
|
+
*/
|
|
19188
|
+
function collectTeamEntryDetails(entry) {
|
|
19189
|
+
var _a;
|
|
19190
|
+
const details = [];
|
|
19191
|
+
const instructions = entry.teammate.instructions.trim();
|
|
19192
|
+
const description = ((_a = entry.description) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
19193
|
+
if (instructions) {
|
|
19194
|
+
details.push({
|
|
19195
|
+
label: 'TEAM instructions',
|
|
19196
|
+
content: instructions,
|
|
19197
|
+
});
|
|
19198
|
+
}
|
|
19199
|
+
if (description) {
|
|
19200
|
+
details.push({
|
|
19201
|
+
label: 'Profile',
|
|
19202
|
+
content: description,
|
|
19203
|
+
});
|
|
19204
|
+
}
|
|
19205
|
+
return details;
|
|
19206
|
+
}
|
|
19207
|
+
/**
|
|
19208
|
+
* Formats one teammate detail line for the TEAM system-message section.
|
|
19209
|
+
*
|
|
19210
|
+
* @private
|
|
19211
|
+
*/
|
|
19212
|
+
function formatTeamEntryDetailLine(detail) {
|
|
19213
|
+
return indentMultilineText(`${detail.label}: ${detail.content}`, ' ');
|
|
19214
|
+
}
|
|
19215
|
+
/**
|
|
19216
|
+
* Indents all lines of one potentially multi-line text block.
|
|
19217
|
+
*
|
|
19218
|
+
* @private
|
|
19219
|
+
*/
|
|
19220
|
+
function indentMultilineText(text, prefix) {
|
|
19221
|
+
return text
|
|
19222
|
+
.split('\n')
|
|
19223
|
+
.map((line) => `${prefix}${line}`)
|
|
19224
|
+
.join('\n');
|
|
19225
|
+
}
|
|
19170
19226
|
/**
|
|
19171
19227
|
* Registers tool function and title for a teammate tool.
|
|
19172
19228
|
*/
|
|
@@ -28659,7 +28715,7 @@ function createEmptyAgentModelRequirements() {
|
|
|
28659
28715
|
systemMessage: '',
|
|
28660
28716
|
promptSuffix: '',
|
|
28661
28717
|
// modelName: 'gpt-5',
|
|
28662
|
-
modelName: '
|
|
28718
|
+
modelName: 'gpt-5.4-mini',
|
|
28663
28719
|
temperature: 0.7,
|
|
28664
28720
|
topP: 0.9,
|
|
28665
28721
|
topK: 50,
|
|
@@ -33253,7 +33309,7 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
|
|
|
33253
33309
|
/**
|
|
33254
33310
|
* Constant for default agent kit model name.
|
|
33255
33311
|
*/
|
|
33256
|
-
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-
|
|
33312
|
+
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
|
|
33257
33313
|
/**
|
|
33258
33314
|
* Creates one structured log entry for streamed tool-call updates.
|
|
33259
33315
|
*
|
|
@@ -35319,6 +35375,7 @@ class AgentLlmExecutionTools {
|
|
|
35319
35375
|
* @param agentSource The agent source string that defines the agent's behavior
|
|
35320
35376
|
*/
|
|
35321
35377
|
constructor(options) {
|
|
35378
|
+
var _a;
|
|
35322
35379
|
this.options = options;
|
|
35323
35380
|
/**
|
|
35324
35381
|
* Cached model requirements to avoid re-parsing the agent source
|
|
@@ -35328,6 +35385,7 @@ class AgentLlmExecutionTools {
|
|
|
35328
35385
|
* Cached parsed agent information
|
|
35329
35386
|
*/
|
|
35330
35387
|
this._cachedAgentInfo = null;
|
|
35388
|
+
this.precomputedModelRequirements = (_a = options.precomputedModelRequirements) !== null && _a !== void 0 ? _a : null;
|
|
35331
35389
|
}
|
|
35332
35390
|
/**
|
|
35333
35391
|
* Updates the agent source and clears the cache
|
|
@@ -35335,9 +35393,13 @@ class AgentLlmExecutionTools {
|
|
|
35335
35393
|
* @param agentSource The new agent source string
|
|
35336
35394
|
*/
|
|
35337
35395
|
updateAgentSource(agentSource) {
|
|
35396
|
+
if (this.options.agentSource === agentSource) {
|
|
35397
|
+
return;
|
|
35398
|
+
}
|
|
35338
35399
|
this.options.agentSource = agentSource;
|
|
35339
35400
|
this._cachedAgentInfo = null;
|
|
35340
35401
|
this._cachedModelRequirements = null;
|
|
35402
|
+
this.precomputedModelRequirements = null;
|
|
35341
35403
|
}
|
|
35342
35404
|
/**
|
|
35343
35405
|
* Get cached or parse agent information
|
|
@@ -35354,6 +35416,16 @@ class AgentLlmExecutionTools {
|
|
|
35354
35416
|
* Note: [🐤] This is names `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united
|
|
35355
35417
|
*/
|
|
35356
35418
|
async getModelRequirements() {
|
|
35419
|
+
var _a, _b;
|
|
35420
|
+
if (this.precomputedModelRequirements !== null) {
|
|
35421
|
+
if (this.options.isVerbose) {
|
|
35422
|
+
console.info('[🤰]', 'Using precomputed agent model requirements', {
|
|
35423
|
+
agent: this.title,
|
|
35424
|
+
toolCount: (_b = (_a = this.precomputedModelRequirements.tools) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
|
|
35425
|
+
});
|
|
35426
|
+
}
|
|
35427
|
+
return this.precomputedModelRequirements;
|
|
35428
|
+
}
|
|
35357
35429
|
if (this._cachedModelRequirements === null) {
|
|
35358
35430
|
const preparationStartedAtMs = Date.now();
|
|
35359
35431
|
if (this.options.isVerbose) {
|
|
@@ -35463,6 +35535,7 @@ class AgentLlmExecutionTools {
|
|
|
35463
35535
|
* Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
|
|
35464
35536
|
*/
|
|
35465
35537
|
async prepareChatPrompt(prompt) {
|
|
35538
|
+
var _a;
|
|
35466
35539
|
const chatPrompt = this.requireChatPrompt(prompt);
|
|
35467
35540
|
const { sanitizedRequirements, promptSuffix } = await this.getSanitizedAgentModelRequirements();
|
|
35468
35541
|
const attachments = normalizeChatAttachments(chatPrompt.attachments);
|
|
@@ -35480,7 +35553,16 @@ class AgentLlmExecutionTools {
|
|
|
35480
35553
|
mergedTools,
|
|
35481
35554
|
knowledgeSourcesForAgent,
|
|
35482
35555
|
});
|
|
35483
|
-
|
|
35556
|
+
if (this.options.isVerbose) {
|
|
35557
|
+
console.info('[🤰]', 'Prepared agent chat prompt', {
|
|
35558
|
+
agent: this.title,
|
|
35559
|
+
usedPrecomputedModelRequirements: this.precomputedModelRequirements !== null,
|
|
35560
|
+
toolNames: mergedTools.map((tool) => tool.name),
|
|
35561
|
+
knowledgeSourcesCount: (_a = knowledgeSourcesForAgent === null || knowledgeSourcesForAgent === void 0 ? void 0 : knowledgeSourcesForAgent.length) !== null && _a !== void 0 ? _a : 0,
|
|
35562
|
+
promptSuffixLength: promptSuffix.length,
|
|
35563
|
+
systemMessageLength: sanitizedRequirements.systemMessage.length,
|
|
35564
|
+
});
|
|
35565
|
+
}
|
|
35484
35566
|
return {
|
|
35485
35567
|
forwardedPrompt,
|
|
35486
35568
|
sanitizedRequirements,
|
|
@@ -35667,6 +35749,7 @@ class AgentLlmExecutionTools {
|
|
|
35667
35749
|
* Runs one prepared prompt through the deprecated OpenAI Assistant backend.
|
|
35668
35750
|
*/
|
|
35669
35751
|
async callOpenAiAssistantChatModelStream(options) {
|
|
35752
|
+
var _a, _b, _c, _d;
|
|
35670
35753
|
const assistant = await this.getOrPrepareOpenAiAssistant({
|
|
35671
35754
|
llmTools: options.llmTools,
|
|
35672
35755
|
originalPrompt: options.originalPrompt,
|
|
@@ -35674,7 +35757,14 @@ class AgentLlmExecutionTools {
|
|
|
35674
35757
|
onProgress: options.onProgress,
|
|
35675
35758
|
});
|
|
35676
35759
|
const promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools = createOpenAiAssistantPrompt(options.preparedChatPrompt.forwardedPrompt);
|
|
35677
|
-
|
|
35760
|
+
if (this.options.isVerbose) {
|
|
35761
|
+
console.info('[🤰]', 'Prepared OpenAI Assistant prompt', {
|
|
35762
|
+
agent: this.title,
|
|
35763
|
+
toolNames: (_b = (_a = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements.tools) === null || _a === void 0 ? void 0 : _a.map((tool) => tool.name)) !== null && _b !== void 0 ? _b : [],
|
|
35764
|
+
knowledgeSourcesCount: (_d = (_c = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements
|
|
35765
|
+
.knowledgeSources) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
|
|
35766
|
+
});
|
|
35767
|
+
}
|
|
35678
35768
|
return assistant.callChatModelStream(promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools, options.onProgress, options.streamOptions);
|
|
35679
35769
|
}
|
|
35680
35770
|
/**
|
|
@@ -36365,7 +36455,8 @@ class Agent extends AgentLlmExecutionTools {
|
|
|
36365
36455
|
isVerbose: options.isVerbose,
|
|
36366
36456
|
llmTools: getSingleLlmExecutionTools(options.executionTools.llm),
|
|
36367
36457
|
assistantPreparationMode: options.assistantPreparationMode,
|
|
36368
|
-
agentSource: agentSource.value,
|
|
36458
|
+
agentSource: agentSource.value,
|
|
36459
|
+
precomputedModelRequirements: options.precomputedModelRequirements,
|
|
36369
36460
|
});
|
|
36370
36461
|
this._agentName = undefined;
|
|
36371
36462
|
/**
|