@promptbook/core 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 CHANGED
@@ -688,6 +688,7 @@ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treate
688
688
  - **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
689
689
  - **Interactive or unattended runs:** default wait mode, or `--no-wait` for batch execution
690
690
  - **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
691
+ - **Opt-in remote pushes:** commits stay local unless you explicitly pass `--auto-push`
691
692
  - **Prompt triage:** `--priority` to process only more important tasks first
692
693
  - **Failure logging:** failed runs write a neighboring `.error.log`
693
694
  - **Line-ending normalization:** changed files are normalized back to LF by default
@@ -705,6 +706,8 @@ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompt
705
706
 
706
707
  npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
707
708
 
709
+ 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
710
+
708
711
  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
709
712
 
710
713
  npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
@@ -727,9 +730,11 @@ npx ptbk coder generate-boilerplates
727
730
 
728
731
  npx ptbk coder generate-boilerplates --template prompts/templates/common.md
729
732
 
730
- npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
733
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test
734
+
735
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
731
736
 
732
- npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
737
+ 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
733
738
 
734
739
  npx ptbk coder find-refactor-candidates
735
740
 
@@ -746,7 +751,7 @@ npx ptbk coder verify
746
751
  | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------ | ---- | ----- | ------------------------------------------------------------------------ |
747
752
  | `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/`. |
748
753
  | `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. |
749
- | `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, marks success or failure, then commits and pushes the result. |
754
+ | `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. |
750
755
  | `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. |
751
756
  | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
752
757
 
@@ -757,12 +762,14 @@ npx ptbk coder verify
757
762
  | `--agent <name>` | Selects the coding backend. |
758
763
  | `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
759
764
  | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
765
+ | `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
760
766
  | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
761
767
  | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
762
768
  | `--ignore-git-changes` | Disables the clean-working-tree guard. |
763
769
  | `--priority <n>` | Runs only prompts at or above the given priority. |
764
770
  | `--dry-run` | Prints which prompts are ready instead of executing them. |
765
771
  | `--allow-credits` | Lets OpenAI Codex spend credits when required. |
772
+ | `--auto-push` | Pushes each successful coding-agent commit to the configured remote. |
766
773
  | `--auto-migrate` | Runs testing-server database migrations after each successful prompt. |
767
774
 
768
775
  #### Typical usage pattern
package/esm/index.es.js CHANGED
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
28
28
  * @generated
29
29
  * @see https://github.com/webgptorg/promptbook
30
30
  */
31
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-42';
31
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-43';
32
32
  /**
33
33
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
34
34
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -7868,7 +7868,7 @@ function createEmptyAgentModelRequirements() {
7868
7868
  systemMessage: '',
7869
7869
  promptSuffix: '',
7870
7870
  // modelName: 'gpt-5',
7871
- modelName: 'gemini-2.5-flash-lite',
7871
+ modelName: 'gpt-5.4-mini',
7872
7872
  temperature: 0.7,
7873
7873
  topP: 0.9,
7874
7874
  topK: 50,
@@ -15056,6 +15056,15 @@ const teamToolFunctions = {};
15056
15056
  * Map of team tool titles.
15057
15057
  */
15058
15058
  const teamToolTitles = {};
15059
+ /**
15060
+ * Shared TEAM usage rules appended ahead of teammate listings.
15061
+ *
15062
+ * @private
15063
+ */
15064
+ const TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES = [
15065
+ '- If a teammate is relevant to the request, consult that teammate using the matching tool.',
15066
+ '- Do not ask the user for information that a listed teammate can provide directly.',
15067
+ ];
15059
15068
  /**
15060
15069
  * Constant for remote agents by Url.
15061
15070
  */
@@ -15145,12 +15154,9 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
15145
15154
  if (updatedTools.some((tool) => tool.name === entry.toolName)) {
15146
15155
  continue;
15147
15156
  }
15148
- const toolDescription = entry.description
15149
- ? `Consult teammate ${entry.teammate.label}\n${entry.description}`
15150
- : `Consult teammate ${entry.teammate.label}`;
15151
15157
  updatedTools.push({
15152
15158
  name: entry.toolName,
15153
- description: toolDescription,
15159
+ description: buildTeamToolDescription(entry),
15154
15160
  parameters: {
15155
15161
  type: 'object',
15156
15162
  properties: {
@@ -15219,22 +15225,72 @@ function resolveTeamTeammateLabels(teamContent, teammates) {
15219
15225
  /**
15220
15226
  * Builds the textual TEAM section body for the final system message.
15221
15227
  *
15222
- * Each teammate is listed with its tool name and, when available, a one-line description.
15223
- * Uses `spaceTrim` to ensure consistent whitespace and indentation.
15228
+ * Each teammate is listed with its tool name, TEAM instructions, and optional profile hints.
15224
15229
  */
15225
15230
  function buildTeamSystemMessageBody(teamEntries) {
15226
- const lines = teamEntries.map((entry, index) => {
15227
- const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
15228
- if (!entry.description) {
15229
- return toolLine;
15230
- }
15231
- return spaceTrim$1(`
15232
- ${toolLine}
15233
- ${entry.description}
15234
- `);
15235
- });
15231
+ const lines = [
15232
+ ...TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES,
15233
+ '',
15234
+ ...teamEntries.map((entry, index) => {
15235
+ const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
15236
+ const detailLines = collectTeamEntryDetails(entry).map(formatTeamEntryDetailLine);
15237
+ return [toolLine, ...detailLines].join('\n');
15238
+ }),
15239
+ ];
15236
15240
  return lines.join('\n');
15237
15241
  }
15242
+ /**
15243
+ * Builds the model-visible description for one teammate tool.
15244
+ *
15245
+ * @private
15246
+ */
15247
+ function buildTeamToolDescription(entry) {
15248
+ const detailLines = collectTeamEntryDetails(entry).map(({ label, content }) => `${label}: ${content}`);
15249
+ return [`Consult teammate ${entry.teammate.label}`, ...detailLines].join('\n');
15250
+ }
15251
+ /**
15252
+ * Collects structured teammate details that should stay visible to the model.
15253
+ *
15254
+ * @private
15255
+ */
15256
+ function collectTeamEntryDetails(entry) {
15257
+ var _a;
15258
+ const details = [];
15259
+ const instructions = entry.teammate.instructions.trim();
15260
+ const description = ((_a = entry.description) === null || _a === void 0 ? void 0 : _a.trim()) || '';
15261
+ if (instructions) {
15262
+ details.push({
15263
+ label: 'TEAM instructions',
15264
+ content: instructions,
15265
+ });
15266
+ }
15267
+ if (description) {
15268
+ details.push({
15269
+ label: 'Profile',
15270
+ content: description,
15271
+ });
15272
+ }
15273
+ return details;
15274
+ }
15275
+ /**
15276
+ * Formats one teammate detail line for the TEAM system-message section.
15277
+ *
15278
+ * @private
15279
+ */
15280
+ function formatTeamEntryDetailLine(detail) {
15281
+ return indentMultilineText(`${detail.label}: ${detail.content}`, ' ');
15282
+ }
15283
+ /**
15284
+ * Indents all lines of one potentially multi-line text block.
15285
+ *
15286
+ * @private
15287
+ */
15288
+ function indentMultilineText(text, prefix) {
15289
+ return text
15290
+ .split('\n')
15291
+ .map((line) => `${prefix}${line}`)
15292
+ .join('\n');
15293
+ }
15238
15294
  /**
15239
15295
  * Registers tool function and title for a teammate tool.
15240
15296
  */
@@ -32701,7 +32757,7 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
32701
32757
  /**
32702
32758
  * Constant for default agent kit model name.
32703
32759
  */
32704
- const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
32760
+ const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
32705
32761
  /**
32706
32762
  * Creates one structured log entry for streamed tool-call updates.
32707
32763
  *
@@ -34767,6 +34823,7 @@ class AgentLlmExecutionTools {
34767
34823
  * @param agentSource The agent source string that defines the agent's behavior
34768
34824
  */
34769
34825
  constructor(options) {
34826
+ var _a;
34770
34827
  this.options = options;
34771
34828
  /**
34772
34829
  * Cached model requirements to avoid re-parsing the agent source
@@ -34776,6 +34833,7 @@ class AgentLlmExecutionTools {
34776
34833
  * Cached parsed agent information
34777
34834
  */
34778
34835
  this._cachedAgentInfo = null;
34836
+ this.precomputedModelRequirements = (_a = options.precomputedModelRequirements) !== null && _a !== void 0 ? _a : null;
34779
34837
  }
34780
34838
  /**
34781
34839
  * Updates the agent source and clears the cache
@@ -34783,9 +34841,13 @@ class AgentLlmExecutionTools {
34783
34841
  * @param agentSource The new agent source string
34784
34842
  */
34785
34843
  updateAgentSource(agentSource) {
34844
+ if (this.options.agentSource === agentSource) {
34845
+ return;
34846
+ }
34786
34847
  this.options.agentSource = agentSource;
34787
34848
  this._cachedAgentInfo = null;
34788
34849
  this._cachedModelRequirements = null;
34850
+ this.precomputedModelRequirements = null;
34789
34851
  }
34790
34852
  /**
34791
34853
  * Get cached or parse agent information
@@ -34802,6 +34864,16 @@ class AgentLlmExecutionTools {
34802
34864
  * Note: [🐤] This is names `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united
34803
34865
  */
34804
34866
  async getModelRequirements() {
34867
+ var _a, _b;
34868
+ if (this.precomputedModelRequirements !== null) {
34869
+ if (this.options.isVerbose) {
34870
+ console.info('[🤰]', 'Using precomputed agent model requirements', {
34871
+ agent: this.title,
34872
+ toolCount: (_b = (_a = this.precomputedModelRequirements.tools) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
34873
+ });
34874
+ }
34875
+ return this.precomputedModelRequirements;
34876
+ }
34805
34877
  if (this._cachedModelRequirements === null) {
34806
34878
  const preparationStartedAtMs = Date.now();
34807
34879
  if (this.options.isVerbose) {
@@ -34911,6 +34983,7 @@ class AgentLlmExecutionTools {
34911
34983
  * Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
34912
34984
  */
34913
34985
  async prepareChatPrompt(prompt) {
34986
+ var _a;
34914
34987
  const chatPrompt = this.requireChatPrompt(prompt);
34915
34988
  const { sanitizedRequirements, promptSuffix } = await this.getSanitizedAgentModelRequirements();
34916
34989
  const attachments = normalizeChatAttachments(chatPrompt.attachments);
@@ -34928,7 +35001,16 @@ class AgentLlmExecutionTools {
34928
35001
  mergedTools,
34929
35002
  knowledgeSourcesForAgent,
34930
35003
  });
34931
- console.log('!!!! promptWithAgentModelRequirements:', forwardedPrompt);
35004
+ if (this.options.isVerbose) {
35005
+ console.info('[🤰]', 'Prepared agent chat prompt', {
35006
+ agent: this.title,
35007
+ usedPrecomputedModelRequirements: this.precomputedModelRequirements !== null,
35008
+ toolNames: mergedTools.map((tool) => tool.name),
35009
+ knowledgeSourcesCount: (_a = knowledgeSourcesForAgent === null || knowledgeSourcesForAgent === void 0 ? void 0 : knowledgeSourcesForAgent.length) !== null && _a !== void 0 ? _a : 0,
35010
+ promptSuffixLength: promptSuffix.length,
35011
+ systemMessageLength: sanitizedRequirements.systemMessage.length,
35012
+ });
35013
+ }
34932
35014
  return {
34933
35015
  forwardedPrompt,
34934
35016
  sanitizedRequirements,
@@ -35115,6 +35197,7 @@ class AgentLlmExecutionTools {
35115
35197
  * Runs one prepared prompt through the deprecated OpenAI Assistant backend.
35116
35198
  */
35117
35199
  async callOpenAiAssistantChatModelStream(options) {
35200
+ var _a, _b, _c, _d;
35118
35201
  const assistant = await this.getOrPrepareOpenAiAssistant({
35119
35202
  llmTools: options.llmTools,
35120
35203
  originalPrompt: options.originalPrompt,
@@ -35122,7 +35205,14 @@ class AgentLlmExecutionTools {
35122
35205
  onProgress: options.onProgress,
35123
35206
  });
35124
35207
  const promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools = createOpenAiAssistantPrompt(options.preparedChatPrompt.forwardedPrompt);
35125
- console.log('!!!! promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools:', promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools);
35208
+ if (this.options.isVerbose) {
35209
+ console.info('[🤰]', 'Prepared OpenAI Assistant prompt', {
35210
+ agent: this.title,
35211
+ toolNames: (_b = (_a = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements.tools) === null || _a === void 0 ? void 0 : _a.map((tool) => tool.name)) !== null && _b !== void 0 ? _b : [],
35212
+ knowledgeSourcesCount: (_d = (_c = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements
35213
+ .knowledgeSources) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
35214
+ });
35215
+ }
35126
35216
  return assistant.callChatModelStream(promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools, options.onProgress, options.streamOptions);
35127
35217
  }
35128
35218
  /**
@@ -35813,7 +35903,8 @@ class Agent extends AgentLlmExecutionTools {
35813
35903
  isVerbose: options.isVerbose,
35814
35904
  llmTools: getSingleLlmExecutionTools(options.executionTools.llm),
35815
35905
  assistantPreparationMode: options.assistantPreparationMode,
35816
- agentSource: agentSource.value, // <- TODO: [🐱‍🚀] Allow to pass BehaviorSubject<string_book> OR refresh llmExecutionTools.callChat on agentSource change
35906
+ agentSource: agentSource.value,
35907
+ precomputedModelRequirements: options.precomputedModelRequirements,
35817
35908
  });
35818
35909
  this._agentName = undefined;
35819
35910
  /**
@@ -38431,6 +38522,7 @@ function $generateBookBoilerplate(options) {
38431
38522
 
38432
38523
  PERSONA ${block(personaDescription)}
38433
38524
  ${block(initialRules.map((rule) => `RULE ${rule}`).join('\n'))}
38525
+ CLOSED
38434
38526
  `));
38435
38527
  // Note: `META COLOR ${color || PROMPTBOOK_COLOR.toHex()}` was removed for now
38436
38528
  // Note: `META FONT Playfair Display, sans-serif` was removed for now