@promptbook/browser 0.112.0-41 → 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.
Files changed (32) hide show
  1. package/README.md +10 -3
  2. package/esm/index.es.js +113 -22
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
  5. package/esm/src/cli/cli-commands/coder/getTypescriptModule.d.ts +19 -0
  6. package/esm/src/cli/cli-commands/coder/getTypescriptModule.test.d.ts +1 -0
  7. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.test.d.ts +1 -0
  8. package/esm/src/cli/cli-commands/coder/verify.test.d.ts +1 -0
  9. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -14
  10. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.d.ts +40 -0
  11. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.test.d.ts +1 -0
  12. package/esm/src/llm-providers/agent/Agent.test.d.ts +1 -0
  13. package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +4 -0
  14. package/esm/src/llm-providers/agent/AgentOptions.d.ts +8 -0
  15. package/esm/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +9 -0
  16. package/esm/src/version.d.ts +1 -1
  17. package/package.json +2 -2
  18. package/umd/index.umd.js +113 -22
  19. package/umd/index.umd.js.map +1 -1
  20. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
  21. package/umd/src/cli/cli-commands/coder/getTypescriptModule.d.ts +19 -0
  22. package/umd/src/cli/cli-commands/coder/getTypescriptModule.test.d.ts +1 -0
  23. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.test.d.ts +1 -0
  24. package/umd/src/cli/cli-commands/coder/verify.test.d.ts +1 -0
  25. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -14
  26. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.d.ts +40 -0
  27. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.test.d.ts +1 -0
  28. package/umd/src/llm-providers/agent/Agent.test.d.ts +1 -0
  29. package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +4 -0
  30. package/umd/src/llm-providers/agent/AgentOptions.d.ts +8 -0
  31. package/umd/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +9 -0
  32. package/umd/src/version.d.ts +1 -1
package/README.md CHANGED
@@ -466,6 +466,7 @@ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treate
466
466
  - **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
467
467
  - **Interactive or unattended runs:** default wait mode, or `--no-wait` for batch execution
468
468
  - **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
469
+ - **Opt-in remote pushes:** commits stay local unless you explicitly pass `--auto-push`
469
470
  - **Prompt triage:** `--priority` to process only more important tasks first
470
471
  - **Failure logging:** failed runs write a neighboring `.error.log`
471
472
  - **Line-ending normalization:** changed files are normalized back to LF by default
@@ -483,6 +484,8 @@ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompt
483
484
 
484
485
  npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
485
486
 
487
+ 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
488
+
486
489
  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
487
490
 
488
491
  npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
@@ -505,9 +508,11 @@ npx ptbk coder generate-boilerplates
505
508
 
506
509
  npx ptbk coder generate-boilerplates --template prompts/templates/common.md
507
510
 
508
- npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
511
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test
512
+
513
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
509
514
 
510
- npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
515
+ 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
511
516
 
512
517
  npx ptbk coder find-refactor-candidates
513
518
 
@@ -524,7 +529,7 @@ npx ptbk coder verify
524
529
  | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------ | ---- | ----- | ------------------------------------------------------------------------ |
525
530
  | `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/`. |
526
531
  | `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. |
527
- | `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. |
532
+ | `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. |
528
533
  | `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. |
529
534
  | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
530
535
 
@@ -535,12 +540,14 @@ npx ptbk coder verify
535
540
  | `--agent <name>` | Selects the coding backend. |
536
541
  | `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
537
542
  | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
543
+ | `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
538
544
  | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
539
545
  | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
540
546
  | `--ignore-git-changes` | Disables the clean-working-tree guard. |
541
547
  | `--priority <n>` | Runs only prompts at or above the given priority. |
542
548
  | `--dry-run` | Prints which prompts are ready instead of executing them. |
543
549
  | `--allow-credits` | Lets OpenAI Codex spend credits when required. |
550
+ | `--auto-push` | Pushes each successful coding-agent commit to the configured remote. |
544
551
  | `--auto-migrate` | Runs testing-server database migrations after each successful prompt. |
545
552
 
546
553
  #### Typical usage pattern
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.112.0-41';
32
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-43';
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
@@ -10127,6 +10127,15 @@ const teamToolFunctions = {};
10127
10127
  * Map of team tool titles.
10128
10128
  */
10129
10129
  const teamToolTitles = {};
10130
+ /**
10131
+ * Shared TEAM usage rules appended ahead of teammate listings.
10132
+ *
10133
+ * @private
10134
+ */
10135
+ const TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES = [
10136
+ '- If a teammate is relevant to the request, consult that teammate using the matching tool.',
10137
+ '- Do not ask the user for information that a listed teammate can provide directly.',
10138
+ ];
10130
10139
  /**
10131
10140
  * Constant for remote agents by Url.
10132
10141
  */
@@ -10216,12 +10225,9 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
10216
10225
  if (updatedTools.some((tool) => tool.name === entry.toolName)) {
10217
10226
  continue;
10218
10227
  }
10219
- const toolDescription = entry.description
10220
- ? `Consult teammate ${entry.teammate.label}\n${entry.description}`
10221
- : `Consult teammate ${entry.teammate.label}`;
10222
10228
  updatedTools.push({
10223
10229
  name: entry.toolName,
10224
- description: toolDescription,
10230
+ description: buildTeamToolDescription(entry),
10225
10231
  parameters: {
10226
10232
  type: 'object',
10227
10233
  properties: {
@@ -10290,22 +10296,72 @@ function resolveTeamTeammateLabels(teamContent, teammates) {
10290
10296
  /**
10291
10297
  * Builds the textual TEAM section body for the final system message.
10292
10298
  *
10293
- * Each teammate is listed with its tool name and, when available, a one-line description.
10294
- * Uses `spaceTrim` to ensure consistent whitespace and indentation.
10299
+ * Each teammate is listed with its tool name, TEAM instructions, and optional profile hints.
10295
10300
  */
10296
10301
  function buildTeamSystemMessageBody(teamEntries) {
10297
- const lines = teamEntries.map((entry, index) => {
10298
- const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
10299
- if (!entry.description) {
10300
- return toolLine;
10301
- }
10302
- return spaceTrim$1(`
10303
- ${toolLine}
10304
- ${entry.description}
10305
- `);
10306
- });
10302
+ const lines = [
10303
+ ...TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES,
10304
+ '',
10305
+ ...teamEntries.map((entry, index) => {
10306
+ const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
10307
+ const detailLines = collectTeamEntryDetails(entry).map(formatTeamEntryDetailLine);
10308
+ return [toolLine, ...detailLines].join('\n');
10309
+ }),
10310
+ ];
10307
10311
  return lines.join('\n');
10308
10312
  }
10313
+ /**
10314
+ * Builds the model-visible description for one teammate tool.
10315
+ *
10316
+ * @private
10317
+ */
10318
+ function buildTeamToolDescription(entry) {
10319
+ const detailLines = collectTeamEntryDetails(entry).map(({ label, content }) => `${label}: ${content}`);
10320
+ return [`Consult teammate ${entry.teammate.label}`, ...detailLines].join('\n');
10321
+ }
10322
+ /**
10323
+ * Collects structured teammate details that should stay visible to the model.
10324
+ *
10325
+ * @private
10326
+ */
10327
+ function collectTeamEntryDetails(entry) {
10328
+ var _a;
10329
+ const details = [];
10330
+ const instructions = entry.teammate.instructions.trim();
10331
+ const description = ((_a = entry.description) === null || _a === void 0 ? void 0 : _a.trim()) || '';
10332
+ if (instructions) {
10333
+ details.push({
10334
+ label: 'TEAM instructions',
10335
+ content: instructions,
10336
+ });
10337
+ }
10338
+ if (description) {
10339
+ details.push({
10340
+ label: 'Profile',
10341
+ content: description,
10342
+ });
10343
+ }
10344
+ return details;
10345
+ }
10346
+ /**
10347
+ * Formats one teammate detail line for the TEAM system-message section.
10348
+ *
10349
+ * @private
10350
+ */
10351
+ function formatTeamEntryDetailLine(detail) {
10352
+ return indentMultilineText(`${detail.label}: ${detail.content}`, ' ');
10353
+ }
10354
+ /**
10355
+ * Indents all lines of one potentially multi-line text block.
10356
+ *
10357
+ * @private
10358
+ */
10359
+ function indentMultilineText(text, prefix) {
10360
+ return text
10361
+ .split('\n')
10362
+ .map((line) => `${prefix}${line}`)
10363
+ .join('\n');
10364
+ }
10309
10365
  /**
10310
10366
  * Registers tool function and title for a teammate tool.
10311
10367
  */
@@ -22880,7 +22936,7 @@ function createEmptyAgentModelRequirements() {
22880
22936
  systemMessage: '',
22881
22937
  promptSuffix: '',
22882
22938
  // modelName: 'gpt-5',
22883
- modelName: 'gemini-2.5-flash-lite',
22939
+ modelName: 'gpt-5.4-mini',
22884
22940
  temperature: 0.7,
22885
22941
  topP: 0.9,
22886
22942
  topK: 50,
@@ -27474,7 +27530,7 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
27474
27530
  /**
27475
27531
  * Constant for default agent kit model name.
27476
27532
  */
27477
- const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
27533
+ const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
27478
27534
  /**
27479
27535
  * Creates one structured log entry for streamed tool-call updates.
27480
27536
  *
@@ -29540,6 +29596,7 @@ class AgentLlmExecutionTools {
29540
29596
  * @param agentSource The agent source string that defines the agent's behavior
29541
29597
  */
29542
29598
  constructor(options) {
29599
+ var _a;
29543
29600
  this.options = options;
29544
29601
  /**
29545
29602
  * Cached model requirements to avoid re-parsing the agent source
@@ -29549,6 +29606,7 @@ class AgentLlmExecutionTools {
29549
29606
  * Cached parsed agent information
29550
29607
  */
29551
29608
  this._cachedAgentInfo = null;
29609
+ this.precomputedModelRequirements = (_a = options.precomputedModelRequirements) !== null && _a !== void 0 ? _a : null;
29552
29610
  }
29553
29611
  /**
29554
29612
  * Updates the agent source and clears the cache
@@ -29556,9 +29614,13 @@ class AgentLlmExecutionTools {
29556
29614
  * @param agentSource The new agent source string
29557
29615
  */
29558
29616
  updateAgentSource(agentSource) {
29617
+ if (this.options.agentSource === agentSource) {
29618
+ return;
29619
+ }
29559
29620
  this.options.agentSource = agentSource;
29560
29621
  this._cachedAgentInfo = null;
29561
29622
  this._cachedModelRequirements = null;
29623
+ this.precomputedModelRequirements = null;
29562
29624
  }
29563
29625
  /**
29564
29626
  * Get cached or parse agent information
@@ -29575,6 +29637,16 @@ class AgentLlmExecutionTools {
29575
29637
  * Note: [🐤] This is names `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united
29576
29638
  */
29577
29639
  async getModelRequirements() {
29640
+ var _a, _b;
29641
+ if (this.precomputedModelRequirements !== null) {
29642
+ if (this.options.isVerbose) {
29643
+ console.info('[🤰]', 'Using precomputed agent model requirements', {
29644
+ agent: this.title,
29645
+ toolCount: (_b = (_a = this.precomputedModelRequirements.tools) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
29646
+ });
29647
+ }
29648
+ return this.precomputedModelRequirements;
29649
+ }
29578
29650
  if (this._cachedModelRequirements === null) {
29579
29651
  const preparationStartedAtMs = Date.now();
29580
29652
  if (this.options.isVerbose) {
@@ -29684,6 +29756,7 @@ class AgentLlmExecutionTools {
29684
29756
  * Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
29685
29757
  */
29686
29758
  async prepareChatPrompt(prompt) {
29759
+ var _a;
29687
29760
  const chatPrompt = this.requireChatPrompt(prompt);
29688
29761
  const { sanitizedRequirements, promptSuffix } = await this.getSanitizedAgentModelRequirements();
29689
29762
  const attachments = normalizeChatAttachments(chatPrompt.attachments);
@@ -29701,7 +29774,16 @@ class AgentLlmExecutionTools {
29701
29774
  mergedTools,
29702
29775
  knowledgeSourcesForAgent,
29703
29776
  });
29704
- console.log('!!!! promptWithAgentModelRequirements:', forwardedPrompt);
29777
+ if (this.options.isVerbose) {
29778
+ console.info('[🤰]', 'Prepared agent chat prompt', {
29779
+ agent: this.title,
29780
+ usedPrecomputedModelRequirements: this.precomputedModelRequirements !== null,
29781
+ toolNames: mergedTools.map((tool) => tool.name),
29782
+ knowledgeSourcesCount: (_a = knowledgeSourcesForAgent === null || knowledgeSourcesForAgent === void 0 ? void 0 : knowledgeSourcesForAgent.length) !== null && _a !== void 0 ? _a : 0,
29783
+ promptSuffixLength: promptSuffix.length,
29784
+ systemMessageLength: sanitizedRequirements.systemMessage.length,
29785
+ });
29786
+ }
29705
29787
  return {
29706
29788
  forwardedPrompt,
29707
29789
  sanitizedRequirements,
@@ -29888,6 +29970,7 @@ class AgentLlmExecutionTools {
29888
29970
  * Runs one prepared prompt through the deprecated OpenAI Assistant backend.
29889
29971
  */
29890
29972
  async callOpenAiAssistantChatModelStream(options) {
29973
+ var _a, _b, _c, _d;
29891
29974
  const assistant = await this.getOrPrepareOpenAiAssistant({
29892
29975
  llmTools: options.llmTools,
29893
29976
  originalPrompt: options.originalPrompt,
@@ -29895,7 +29978,14 @@ class AgentLlmExecutionTools {
29895
29978
  onProgress: options.onProgress,
29896
29979
  });
29897
29980
  const promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools = createOpenAiAssistantPrompt(options.preparedChatPrompt.forwardedPrompt);
29898
- console.log('!!!! promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools:', promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools);
29981
+ if (this.options.isVerbose) {
29982
+ console.info('[🤰]', 'Prepared OpenAI Assistant prompt', {
29983
+ agent: this.title,
29984
+ toolNames: (_b = (_a = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements.tools) === null || _a === void 0 ? void 0 : _a.map((tool) => tool.name)) !== null && _b !== void 0 ? _b : [],
29985
+ knowledgeSourcesCount: (_d = (_c = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements
29986
+ .knowledgeSources) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
29987
+ });
29988
+ }
29899
29989
  return assistant.callChatModelStream(promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools, options.onProgress, options.streamOptions);
29900
29990
  }
29901
29991
  /**
@@ -30586,7 +30676,8 @@ class Agent extends AgentLlmExecutionTools {
30586
30676
  isVerbose: options.isVerbose,
30587
30677
  llmTools: getSingleLlmExecutionTools(options.executionTools.llm),
30588
30678
  assistantPreparationMode: options.assistantPreparationMode,
30589
- agentSource: agentSource.value, // <- TODO: [🐱‍🚀] Allow to pass BehaviorSubject<string_book> OR refresh llmExecutionTools.callChat on agentSource change
30679
+ agentSource: agentSource.value,
30680
+ precomputedModelRequirements: options.precomputedModelRequirements,
30590
30681
  });
30591
30682
  this._agentName = undefined;
30592
30683
  /**