@promptbook/remote-server 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
@@ -469,6 +469,7 @@ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treate
469
469
  - **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
470
470
  - **Interactive or unattended runs:** default wait mode, or `--no-wait` for batch execution
471
471
  - **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
472
+ - **Opt-in remote pushes:** commits stay local unless you explicitly pass `--auto-push`
472
473
  - **Prompt triage:** `--priority` to process only more important tasks first
473
474
  - **Failure logging:** failed runs write a neighboring `.error.log`
474
475
  - **Line-ending normalization:** changed files are normalized back to LF by default
@@ -486,6 +487,8 @@ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompt
486
487
 
487
488
  npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
488
489
 
490
+ 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
491
+
489
492
  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
490
493
 
491
494
  npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
@@ -508,9 +511,11 @@ npx ptbk coder generate-boilerplates
508
511
 
509
512
  npx ptbk coder generate-boilerplates --template prompts/templates/common.md
510
513
 
511
- npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
514
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test
515
+
516
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
512
517
 
513
- npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
518
+ 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
514
519
 
515
520
  npx ptbk coder find-refactor-candidates
516
521
 
@@ -527,7 +532,7 @@ npx ptbk coder verify
527
532
  | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------ | ---- | ----- | ------------------------------------------------------------------------ |
528
533
  | `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/`. |
529
534
  | `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. |
530
- | `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. |
535
+ | `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. |
531
536
  | `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. |
532
537
  | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
533
538
 
@@ -538,12 +543,14 @@ npx ptbk coder verify
538
543
  | `--agent <name>` | Selects the coding backend. |
539
544
  | `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
540
545
  | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
546
+ | `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
541
547
  | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
542
548
  | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
543
549
  | `--ignore-git-changes` | Disables the clean-working-tree guard. |
544
550
  | `--priority <n>` | Runs only prompts at or above the given priority. |
545
551
  | `--dry-run` | Prints which prompts are ready instead of executing them. |
546
552
  | `--allow-credits` | Lets OpenAI Codex spend credits when required. |
553
+ | `--auto-push` | Pushes each successful coding-agent commit to the configured remote. |
547
554
  | `--auto-migrate` | Runs testing-server database migrations after each successful prompt. |
548
555
 
549
556
  #### Typical usage pattern
package/esm/index.es.js CHANGED
@@ -40,7 +40,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
40
40
  * @generated
41
41
  * @see https://github.com/webgptorg/promptbook
42
42
  */
43
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-41';
43
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-43';
44
44
  /**
45
45
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
46
46
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -15829,6 +15829,15 @@ const teamToolFunctions = {};
15829
15829
  * Map of team tool titles.
15830
15830
  */
15831
15831
  const teamToolTitles = {};
15832
+ /**
15833
+ * Shared TEAM usage rules appended ahead of teammate listings.
15834
+ *
15835
+ * @private
15836
+ */
15837
+ const TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES = [
15838
+ '- If a teammate is relevant to the request, consult that teammate using the matching tool.',
15839
+ '- Do not ask the user for information that a listed teammate can provide directly.',
15840
+ ];
15832
15841
  /**
15833
15842
  * Constant for remote agents by Url.
15834
15843
  */
@@ -15918,12 +15927,9 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
15918
15927
  if (updatedTools.some((tool) => tool.name === entry.toolName)) {
15919
15928
  continue;
15920
15929
  }
15921
- const toolDescription = entry.description
15922
- ? `Consult teammate ${entry.teammate.label}\n${entry.description}`
15923
- : `Consult teammate ${entry.teammate.label}`;
15924
15930
  updatedTools.push({
15925
15931
  name: entry.toolName,
15926
- description: toolDescription,
15932
+ description: buildTeamToolDescription(entry),
15927
15933
  parameters: {
15928
15934
  type: 'object',
15929
15935
  properties: {
@@ -15992,22 +15998,72 @@ function resolveTeamTeammateLabels(teamContent, teammates) {
15992
15998
  /**
15993
15999
  * Builds the textual TEAM section body for the final system message.
15994
16000
  *
15995
- * Each teammate is listed with its tool name and, when available, a one-line description.
15996
- * Uses `spaceTrim` to ensure consistent whitespace and indentation.
16001
+ * Each teammate is listed with its tool name, TEAM instructions, and optional profile hints.
15997
16002
  */
15998
16003
  function buildTeamSystemMessageBody(teamEntries) {
15999
- const lines = teamEntries.map((entry, index) => {
16000
- const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
16001
- if (!entry.description) {
16002
- return toolLine;
16003
- }
16004
- return spaceTrim$1(`
16005
- ${toolLine}
16006
- ${entry.description}
16007
- `);
16008
- });
16004
+ const lines = [
16005
+ ...TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES,
16006
+ '',
16007
+ ...teamEntries.map((entry, index) => {
16008
+ const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
16009
+ const detailLines = collectTeamEntryDetails(entry).map(formatTeamEntryDetailLine);
16010
+ return [toolLine, ...detailLines].join('\n');
16011
+ }),
16012
+ ];
16009
16013
  return lines.join('\n');
16010
16014
  }
16015
+ /**
16016
+ * Builds the model-visible description for one teammate tool.
16017
+ *
16018
+ * @private
16019
+ */
16020
+ function buildTeamToolDescription(entry) {
16021
+ const detailLines = collectTeamEntryDetails(entry).map(({ label, content }) => `${label}: ${content}`);
16022
+ return [`Consult teammate ${entry.teammate.label}`, ...detailLines].join('\n');
16023
+ }
16024
+ /**
16025
+ * Collects structured teammate details that should stay visible to the model.
16026
+ *
16027
+ * @private
16028
+ */
16029
+ function collectTeamEntryDetails(entry) {
16030
+ var _a;
16031
+ const details = [];
16032
+ const instructions = entry.teammate.instructions.trim();
16033
+ const description = ((_a = entry.description) === null || _a === void 0 ? void 0 : _a.trim()) || '';
16034
+ if (instructions) {
16035
+ details.push({
16036
+ label: 'TEAM instructions',
16037
+ content: instructions,
16038
+ });
16039
+ }
16040
+ if (description) {
16041
+ details.push({
16042
+ label: 'Profile',
16043
+ content: description,
16044
+ });
16045
+ }
16046
+ return details;
16047
+ }
16048
+ /**
16049
+ * Formats one teammate detail line for the TEAM system-message section.
16050
+ *
16051
+ * @private
16052
+ */
16053
+ function formatTeamEntryDetailLine(detail) {
16054
+ return indentMultilineText(`${detail.label}: ${detail.content}`, ' ');
16055
+ }
16056
+ /**
16057
+ * Indents all lines of one potentially multi-line text block.
16058
+ *
16059
+ * @private
16060
+ */
16061
+ function indentMultilineText(text, prefix) {
16062
+ return text
16063
+ .split('\n')
16064
+ .map((line) => `${prefix}${line}`)
16065
+ .join('\n');
16066
+ }
16011
16067
  /**
16012
16068
  * Registers tool function and title for a teammate tool.
16013
16069
  */
@@ -25641,7 +25697,7 @@ function createEmptyAgentModelRequirements() {
25641
25697
  systemMessage: '',
25642
25698
  promptSuffix: '',
25643
25699
  // modelName: 'gpt-5',
25644
- modelName: 'gemini-2.5-flash-lite',
25700
+ modelName: 'gpt-5.4-mini',
25645
25701
  temperature: 0.7,
25646
25702
  topP: 0.9,
25647
25703
  topK: 50,
@@ -30235,7 +30291,7 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
30235
30291
  /**
30236
30292
  * Constant for default agent kit model name.
30237
30293
  */
30238
- const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
30294
+ const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
30239
30295
  /**
30240
30296
  * Creates one structured log entry for streamed tool-call updates.
30241
30297
  *
@@ -32301,6 +32357,7 @@ class AgentLlmExecutionTools {
32301
32357
  * @param agentSource The agent source string that defines the agent's behavior
32302
32358
  */
32303
32359
  constructor(options) {
32360
+ var _a;
32304
32361
  this.options = options;
32305
32362
  /**
32306
32363
  * Cached model requirements to avoid re-parsing the agent source
@@ -32310,6 +32367,7 @@ class AgentLlmExecutionTools {
32310
32367
  * Cached parsed agent information
32311
32368
  */
32312
32369
  this._cachedAgentInfo = null;
32370
+ this.precomputedModelRequirements = (_a = options.precomputedModelRequirements) !== null && _a !== void 0 ? _a : null;
32313
32371
  }
32314
32372
  /**
32315
32373
  * Updates the agent source and clears the cache
@@ -32317,9 +32375,13 @@ class AgentLlmExecutionTools {
32317
32375
  * @param agentSource The new agent source string
32318
32376
  */
32319
32377
  updateAgentSource(agentSource) {
32378
+ if (this.options.agentSource === agentSource) {
32379
+ return;
32380
+ }
32320
32381
  this.options.agentSource = agentSource;
32321
32382
  this._cachedAgentInfo = null;
32322
32383
  this._cachedModelRequirements = null;
32384
+ this.precomputedModelRequirements = null;
32323
32385
  }
32324
32386
  /**
32325
32387
  * Get cached or parse agent information
@@ -32336,6 +32398,16 @@ class AgentLlmExecutionTools {
32336
32398
  * Note: [🐤] This is names `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united
32337
32399
  */
32338
32400
  async getModelRequirements() {
32401
+ var _a, _b;
32402
+ if (this.precomputedModelRequirements !== null) {
32403
+ if (this.options.isVerbose) {
32404
+ console.info('[🤰]', 'Using precomputed agent model requirements', {
32405
+ agent: this.title,
32406
+ toolCount: (_b = (_a = this.precomputedModelRequirements.tools) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
32407
+ });
32408
+ }
32409
+ return this.precomputedModelRequirements;
32410
+ }
32339
32411
  if (this._cachedModelRequirements === null) {
32340
32412
  const preparationStartedAtMs = Date.now();
32341
32413
  if (this.options.isVerbose) {
@@ -32445,6 +32517,7 @@ class AgentLlmExecutionTools {
32445
32517
  * Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
32446
32518
  */
32447
32519
  async prepareChatPrompt(prompt) {
32520
+ var _a;
32448
32521
  const chatPrompt = this.requireChatPrompt(prompt);
32449
32522
  const { sanitizedRequirements, promptSuffix } = await this.getSanitizedAgentModelRequirements();
32450
32523
  const attachments = normalizeChatAttachments(chatPrompt.attachments);
@@ -32462,7 +32535,16 @@ class AgentLlmExecutionTools {
32462
32535
  mergedTools,
32463
32536
  knowledgeSourcesForAgent,
32464
32537
  });
32465
- console.log('!!!! promptWithAgentModelRequirements:', forwardedPrompt);
32538
+ if (this.options.isVerbose) {
32539
+ console.info('[🤰]', 'Prepared agent chat prompt', {
32540
+ agent: this.title,
32541
+ usedPrecomputedModelRequirements: this.precomputedModelRequirements !== null,
32542
+ toolNames: mergedTools.map((tool) => tool.name),
32543
+ knowledgeSourcesCount: (_a = knowledgeSourcesForAgent === null || knowledgeSourcesForAgent === void 0 ? void 0 : knowledgeSourcesForAgent.length) !== null && _a !== void 0 ? _a : 0,
32544
+ promptSuffixLength: promptSuffix.length,
32545
+ systemMessageLength: sanitizedRequirements.systemMessage.length,
32546
+ });
32547
+ }
32466
32548
  return {
32467
32549
  forwardedPrompt,
32468
32550
  sanitizedRequirements,
@@ -32649,6 +32731,7 @@ class AgentLlmExecutionTools {
32649
32731
  * Runs one prepared prompt through the deprecated OpenAI Assistant backend.
32650
32732
  */
32651
32733
  async callOpenAiAssistantChatModelStream(options) {
32734
+ var _a, _b, _c, _d;
32652
32735
  const assistant = await this.getOrPrepareOpenAiAssistant({
32653
32736
  llmTools: options.llmTools,
32654
32737
  originalPrompt: options.originalPrompt,
@@ -32656,7 +32739,14 @@ class AgentLlmExecutionTools {
32656
32739
  onProgress: options.onProgress,
32657
32740
  });
32658
32741
  const promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools = createOpenAiAssistantPrompt(options.preparedChatPrompt.forwardedPrompt);
32659
- console.log('!!!! promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools:', promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools);
32742
+ if (this.options.isVerbose) {
32743
+ console.info('[🤰]', 'Prepared OpenAI Assistant prompt', {
32744
+ agent: this.title,
32745
+ toolNames: (_b = (_a = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements.tools) === null || _a === void 0 ? void 0 : _a.map((tool) => tool.name)) !== null && _b !== void 0 ? _b : [],
32746
+ knowledgeSourcesCount: (_d = (_c = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements
32747
+ .knowledgeSources) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
32748
+ });
32749
+ }
32660
32750
  return assistant.callChatModelStream(promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools, options.onProgress, options.streamOptions);
32661
32751
  }
32662
32752
  /**
@@ -33347,7 +33437,8 @@ class Agent extends AgentLlmExecutionTools {
33347
33437
  isVerbose: options.isVerbose,
33348
33438
  llmTools: getSingleLlmExecutionTools(options.executionTools.llm),
33349
33439
  assistantPreparationMode: options.assistantPreparationMode,
33350
- agentSource: agentSource.value, // <- TODO: [🐱‍🚀] Allow to pass BehaviorSubject<string_book> OR refresh llmExecutionTools.callChat on agentSource change
33440
+ agentSource: agentSource.value,
33441
+ precomputedModelRequirements: options.precomputedModelRequirements,
33351
33442
  });
33352
33443
  this._agentName = undefined;
33353
33444
  /**