@promptbook/node 0.112.0-42 → 0.112.0-44

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 (30) hide show
  1. package/README.md +10 -3
  2. package/esm/index.es.js +207 -57
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
  5. package/esm/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +2 -1
  6. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
  7. package/esm/src/cli/cli-commands/coder/getTypescriptModule.d.ts +19 -0
  8. package/esm/src/cli/cli-commands/coder/getTypescriptModule.test.d.ts +1 -0
  9. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.test.d.ts +1 -0
  10. package/esm/src/commitments/PERSONA/PERSONA.d.ts +7 -0
  11. package/esm/src/llm-providers/agent/Agent.test.d.ts +1 -0
  12. package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +4 -0
  13. package/esm/src/llm-providers/agent/AgentOptions.d.ts +8 -0
  14. package/esm/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +9 -0
  15. package/esm/src/version.d.ts +1 -1
  16. package/package.json +2 -2
  17. package/umd/index.umd.js +207 -57
  18. package/umd/index.umd.js.map +1 -1
  19. package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
  20. package/umd/src/book-2.0/agent-source/TeammateProfileResolver.d.ts +2 -1
  21. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
  22. package/umd/src/cli/cli-commands/coder/getTypescriptModule.d.ts +19 -0
  23. package/umd/src/cli/cli-commands/coder/getTypescriptModule.test.d.ts +1 -0
  24. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.test.d.ts +1 -0
  25. package/umd/src/commitments/PERSONA/PERSONA.d.ts +7 -0
  26. package/umd/src/llm-providers/agent/Agent.test.d.ts +1 -0
  27. package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +4 -0
  28. package/umd/src/llm-providers/agent/AgentOptions.d.ts +8 -0
  29. package/umd/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +9 -0
  30. 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, then commits and pushes the result. |
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-42';
38
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-44';
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
@@ -15342,7 +15342,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
15342
15342
  * Short one-line description of GOAL.
15343
15343
  */
15344
15344
  get description() {
15345
- return 'Define main **goals** the AI assistant should achieve, with later goals having higher priority.';
15345
+ return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
15346
15346
  }
15347
15347
  /**
15348
15348
  * Icon for this commitment.
@@ -15357,12 +15357,14 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
15357
15357
  return spaceTrim$1(`
15358
15358
  # ${this.type}
15359
15359
 
15360
- Defines the main goal which should be achieved by the AI assistant. There can be multiple goals, and later goals are more important than earlier goals.
15360
+ Defines the main goal which should be achieved by the AI assistant.
15361
+ There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
15361
15362
 
15362
15363
  ## Key aspects
15363
15364
 
15364
15365
  - Both terms work identically and can be used interchangeably.
15365
- - Later goals have higher priority and can override earlier goals.
15366
+ - Later goals overwrite earlier goals.
15367
+ - The public agent profile text is derived from the last goal.
15366
15368
  - Goals provide clear direction and purpose for the agent's responses.
15367
15369
  - Goals influence decision-making and response prioritization.
15368
15370
 
@@ -15375,9 +15377,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
15375
15377
  \`\`\`book
15376
15378
  Customer Support Agent
15377
15379
 
15378
- PERSONA You are a helpful customer support representative
15379
15380
  GOAL Resolve customer issues quickly and efficiently
15380
- GOAL Maintain high customer satisfaction scores
15381
15381
  GOAL Always follow company policies and procedures
15382
15382
  RULE Be polite and professional at all times
15383
15383
  \`\`\`
@@ -15385,9 +15385,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
15385
15385
  \`\`\`book
15386
15386
  Educational Assistant
15387
15387
 
15388
- PERSONA You are an educational assistant specializing in mathematics
15389
15388
  GOAL Help students understand mathematical concepts clearly
15390
- GOAL Encourage critical thinking and problem-solving skills
15391
15389
  GOAL Ensure all explanations are age-appropriate and accessible
15392
15390
  STYLE Use simple language and provide step-by-step explanations
15393
15391
  \`\`\`
@@ -15395,9 +15393,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
15395
15393
  \`\`\`book
15396
15394
  Safety-First Assistant
15397
15395
 
15398
- PERSONA You are a general-purpose AI assistant
15399
15396
  GOAL Be helpful and informative in all interactions
15400
- GOAL Provide accurate and reliable information
15401
15397
  GOAL Always prioritize user safety and ethical guidelines
15402
15398
  RULE Never provide harmful or dangerous advice
15403
15399
  \`\`\`
@@ -18256,7 +18252,16 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
18256
18252
  * Short one-line description of PERSONA.
18257
18253
  */
18258
18254
  get description() {
18259
- return 'Define who the agent is: background, expertise, and personality.';
18255
+ return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
18256
+ }
18257
+ /**
18258
+ * Optional UI/docs-only deprecation metadata.
18259
+ */
18260
+ get deprecation() {
18261
+ return {
18262
+ message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
18263
+ replacedBy: ['GOAL'],
18264
+ };
18260
18265
  }
18261
18266
  /**
18262
18267
  * Icon for this commitment.
@@ -18271,16 +18276,24 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
18271
18276
  return spaceTrim$1(`
18272
18277
  # ${this.type}
18273
18278
 
18274
- Defines who the agent is, their background, expertise, and personality traits.
18279
+ Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
18275
18280
 
18276
- ## Key aspects
18281
+ ## Migration
18277
18282
 
18278
- - Multiple \`PERSONA\` and \`PERSONAE\` commitments are merged together.
18279
- - Both terms work identically and can be used interchangeably.
18280
- - If they are in conflict, the last one takes precedence.
18281
- - You can write persona content in multiple lines.
18283
+ - Existing \`${this.type}\` books still parse and compile.
18284
+ - New books should prefer \`GOAL\`.
18285
+ - Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
18286
+ - Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
18282
18287
 
18283
- ## Examples
18288
+ ## Preferred replacement
18289
+
18290
+ \`\`\`book
18291
+ Programming Assistant
18292
+
18293
+ GOAL Help the user solve programming problems with practical TypeScript and React guidance.
18294
+ \`\`\`
18295
+
18296
+ ## Legacy compatibility example
18284
18297
 
18285
18298
  \`\`\`book
18286
18299
  Programming Assistant
@@ -18988,6 +19001,15 @@ const teamToolFunctions = {};
18988
19001
  * Map of team tool titles.
18989
19002
  */
18990
19003
  const teamToolTitles = {};
19004
+ /**
19005
+ * Shared TEAM usage rules appended ahead of teammate listings.
19006
+ *
19007
+ * @private
19008
+ */
19009
+ const TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES = [
19010
+ '- If a teammate is relevant to the request, consult that teammate using the matching tool.',
19011
+ '- Do not ask the user for information that a listed teammate can provide directly.',
19012
+ ];
18991
19013
  /**
18992
19014
  * Constant for remote agents by Url.
18993
19015
  */
@@ -19036,7 +19058,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
19036
19058
  \`\`\`book
19037
19059
  Legal Assistant
19038
19060
 
19039
- PERSONA An expert software developer
19061
+ GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
19040
19062
  TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
19041
19063
  \`\`\`
19042
19064
  `);
@@ -19077,12 +19099,9 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
19077
19099
  if (updatedTools.some((tool) => tool.name === entry.toolName)) {
19078
19100
  continue;
19079
19101
  }
19080
- const toolDescription = entry.description
19081
- ? `Consult teammate ${entry.teammate.label}\n${entry.description}`
19082
- : `Consult teammate ${entry.teammate.label}`;
19083
19102
  updatedTools.push({
19084
19103
  name: entry.toolName,
19085
- description: toolDescription,
19104
+ description: buildTeamToolDescription(entry),
19086
19105
  parameters: {
19087
19106
  type: 'object',
19088
19107
  properties: {
@@ -19151,22 +19170,72 @@ function resolveTeamTeammateLabels(teamContent, teammates) {
19151
19170
  /**
19152
19171
  * Builds the textual TEAM section body for the final system message.
19153
19172
  *
19154
- * Each teammate is listed with its tool name and, when available, a one-line description.
19155
- * Uses `spaceTrim` to ensure consistent whitespace and indentation.
19173
+ * Each teammate is listed with its tool name, TEAM instructions, and optional profile hints.
19156
19174
  */
19157
19175
  function buildTeamSystemMessageBody(teamEntries) {
19158
- const lines = teamEntries.map((entry, index) => {
19159
- const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
19160
- if (!entry.description) {
19161
- return toolLine;
19162
- }
19163
- return spaceTrim$1(`
19164
- ${toolLine}
19165
- ${entry.description}
19166
- `);
19167
- });
19176
+ const lines = [
19177
+ ...TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES,
19178
+ '',
19179
+ ...teamEntries.map((entry, index) => {
19180
+ const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
19181
+ const detailLines = collectTeamEntryDetails(entry).map(formatTeamEntryDetailLine);
19182
+ return [toolLine, ...detailLines].join('\n');
19183
+ }),
19184
+ ];
19168
19185
  return lines.join('\n');
19169
19186
  }
19187
+ /**
19188
+ * Builds the model-visible description for one teammate tool.
19189
+ *
19190
+ * @private
19191
+ */
19192
+ function buildTeamToolDescription(entry) {
19193
+ const detailLines = collectTeamEntryDetails(entry).map(({ label, content }) => `${label}: ${content}`);
19194
+ return [`Consult teammate ${entry.teammate.label}`, ...detailLines].join('\n');
19195
+ }
19196
+ /**
19197
+ * Collects structured teammate details that should stay visible to the model.
19198
+ *
19199
+ * @private
19200
+ */
19201
+ function collectTeamEntryDetails(entry) {
19202
+ var _a;
19203
+ const details = [];
19204
+ const instructions = entry.teammate.instructions.trim();
19205
+ const description = ((_a = entry.description) === null || _a === void 0 ? void 0 : _a.trim()) || '';
19206
+ if (instructions) {
19207
+ details.push({
19208
+ label: 'TEAM instructions',
19209
+ content: instructions,
19210
+ });
19211
+ }
19212
+ if (description) {
19213
+ details.push({
19214
+ label: 'Profile',
19215
+ content: description,
19216
+ });
19217
+ }
19218
+ return details;
19219
+ }
19220
+ /**
19221
+ * Formats one teammate detail line for the TEAM system-message section.
19222
+ *
19223
+ * @private
19224
+ */
19225
+ function formatTeamEntryDetailLine(detail) {
19226
+ return indentMultilineText(`${detail.label}: ${detail.content}`, ' ');
19227
+ }
19228
+ /**
19229
+ * Indents all lines of one potentially multi-line text block.
19230
+ *
19231
+ * @private
19232
+ */
19233
+ function indentMultilineText(text, prefix) {
19234
+ return text
19235
+ .split('\n')
19236
+ .map((line) => `${prefix}${line}`)
19237
+ .join('\n');
19238
+ }
19170
19239
  /**
19171
19240
  * Registers tool function and title for a teammate tool.
19172
19241
  */
@@ -28016,7 +28085,7 @@ function parseParameters(text) {
28016
28085
  function parseAgentSource(agentSource) {
28017
28086
  const parseResult = parseAgentSourceWithCommitments(agentSource);
28018
28087
  const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
28019
- const personaDescription = extractPersonaDescription(parseResult.commitments);
28088
+ const personaDescription = extractAgentProfileText(parseResult.commitments);
28020
28089
  const initialMessage = extractInitialMessage(parseResult.commitments);
28021
28090
  const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
28022
28091
  ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
@@ -28120,25 +28189,33 @@ const META_COMMITMENT_APPLIERS = {
28120
28189
  */
28121
28190
  const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
28122
28191
  /**
28123
- * Builds the combined persona description from PERSONA commitments.
28192
+ * Resolves the public agent profile text from the last GOAL/GOALS commitment,
28193
+ * falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
28124
28194
  *
28125
28195
  * @private internal utility of `parseAgentSource`
28126
28196
  */
28127
- function extractPersonaDescription(commitments) {
28128
- let personaDescription = null;
28197
+ function extractAgentProfileText(commitments) {
28198
+ let goalDescription = '';
28199
+ let hasGoalDescription = false;
28200
+ let personaDescription = '';
28201
+ let hasPersonaDescription = false;
28129
28202
  for (const commitment of commitments) {
28130
- if (commitment.type !== 'PERSONA') {
28131
- continue;
28203
+ if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
28204
+ goalDescription = commitment.content;
28205
+ hasGoalDescription = true;
28132
28206
  }
28133
- if (personaDescription === null) {
28134
- personaDescription = '';
28207
+ if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
28208
+ personaDescription = commitment.content;
28209
+ hasPersonaDescription = true;
28135
28210
  }
28136
- else {
28137
- personaDescription += `\n\n${personaDescription}`;
28138
- }
28139
- personaDescription += commitment.content;
28140
28211
  }
28141
- return personaDescription;
28212
+ if (hasGoalDescription) {
28213
+ return goalDescription;
28214
+ }
28215
+ if (hasPersonaDescription) {
28216
+ return personaDescription;
28217
+ }
28218
+ return null;
28142
28219
  }
28143
28220
  /**
28144
28221
  * Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
@@ -28659,7 +28736,7 @@ function createEmptyAgentModelRequirements() {
28659
28736
  systemMessage: '',
28660
28737
  promptSuffix: '',
28661
28738
  // modelName: 'gpt-5',
28662
- modelName: 'gemini-2.5-flash-lite',
28739
+ modelName: 'gpt-5.4-mini',
28663
28740
  temperature: 0.7,
28664
28741
  topP: 0.9,
28665
28742
  topK: 50,
@@ -28820,6 +28897,15 @@ const COMMITMENTS_WITH_AGENT_REFERENCES = new Set(['FROM', 'IMPORT', 'IMPORTS',
28820
28897
  * @private internal constant of `createAgentModelRequirementsWithCommitments`
28821
28898
  */
28822
28899
  const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
28900
+ /**
28901
+ * Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
28902
+ *
28903
+ * @private internal constant of `createAgentModelRequirementsWithCommitments`
28904
+ */
28905
+ const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
28906
+ ['GOAL', 'GOAL'],
28907
+ ['GOALS', 'GOAL'],
28908
+ ]);
28823
28909
  /**
28824
28910
  * Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
28825
28911
  *
@@ -28870,7 +28956,7 @@ function getSafeReferenceCommitmentFallback(commitmentType, originalContent) {
28870
28956
  */
28871
28957
  async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
28872
28958
  const parseResult = parseAgentSourceWithCommitments(agentSource);
28873
- const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
28959
+ const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
28874
28960
  let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
28875
28961
  requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
28876
28962
  requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
@@ -28881,6 +28967,35 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
28881
28967
  requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
28882
28968
  return finalizeRequirements(requirements);
28883
28969
  }
28970
+ /**
28971
+ * Removes earlier commitments that are overwritten by later commitments of the same semantic group.
28972
+ *
28973
+ * This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
28974
+ * and multi-goal sources expose one effective goal to the runtime.
28975
+ *
28976
+ * @param commitments - Parsed commitments after DELETE-like filtering.
28977
+ * @returns Commitments with overwritten entries removed while preserving source order.
28978
+ *
28979
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
28980
+ */
28981
+ function filterOverwrittenCommitments(commitments) {
28982
+ const seenOverwriteGroups = new Set();
28983
+ const keptCommitments = [];
28984
+ for (let index = commitments.length - 1; index >= 0; index--) {
28985
+ const commitment = commitments[index];
28986
+ const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
28987
+ if (!overwriteGroup) {
28988
+ keptCommitments.push(commitment);
28989
+ continue;
28990
+ }
28991
+ if (seenOverwriteGroups.has(overwriteGroup)) {
28992
+ continue;
28993
+ }
28994
+ seenOverwriteGroups.add(overwriteGroup);
28995
+ keptCommitments.push(commitment);
28996
+ }
28997
+ return keptCommitments.reverse();
28998
+ }
28884
28999
  /**
28885
29000
  * Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
28886
29001
  *
@@ -29472,7 +29587,7 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
29472
29587
  * Selects the best model using the preparePersona function
29473
29588
  * This directly uses preparePersona to ensure DRY principle
29474
29589
  *
29475
- * @param agentSource The agent source to derive persona description from
29590
+ * @param agentSource The agent source to derive effective profile text from
29476
29591
  * @param llmTools LLM tools for preparing persona
29477
29592
  * @returns The name of the best selected model
29478
29593
  *
@@ -29480,9 +29595,9 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
29480
29595
  */
29481
29596
  async function selectBestModelUsingPersona(agentSource, llmTools) {
29482
29597
  var _a;
29483
- // Parse agent source to get persona description
29598
+ // Parse agent source to get the effective profile description
29484
29599
  const { agentName, personaDescription } = parseAgentSource(agentSource);
29485
- // Use agent name as fallback if no persona description is available
29600
+ // Use agent name as fallback if no profile description is available
29486
29601
  const description = personaDescription || agentName || 'AI Agent';
29487
29602
  try {
29488
29603
  // Use preparePersona directly
@@ -33253,7 +33368,7 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
33253
33368
  /**
33254
33369
  * Constant for default agent kit model name.
33255
33370
  */
33256
- const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
33371
+ const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
33257
33372
  /**
33258
33373
  * Creates one structured log entry for streamed tool-call updates.
33259
33374
  *
@@ -35319,6 +35434,7 @@ class AgentLlmExecutionTools {
35319
35434
  * @param agentSource The agent source string that defines the agent's behavior
35320
35435
  */
35321
35436
  constructor(options) {
35437
+ var _a;
35322
35438
  this.options = options;
35323
35439
  /**
35324
35440
  * Cached model requirements to avoid re-parsing the agent source
@@ -35328,6 +35444,7 @@ class AgentLlmExecutionTools {
35328
35444
  * Cached parsed agent information
35329
35445
  */
35330
35446
  this._cachedAgentInfo = null;
35447
+ this.precomputedModelRequirements = (_a = options.precomputedModelRequirements) !== null && _a !== void 0 ? _a : null;
35331
35448
  }
35332
35449
  /**
35333
35450
  * Updates the agent source and clears the cache
@@ -35335,9 +35452,13 @@ class AgentLlmExecutionTools {
35335
35452
  * @param agentSource The new agent source string
35336
35453
  */
35337
35454
  updateAgentSource(agentSource) {
35455
+ if (this.options.agentSource === agentSource) {
35456
+ return;
35457
+ }
35338
35458
  this.options.agentSource = agentSource;
35339
35459
  this._cachedAgentInfo = null;
35340
35460
  this._cachedModelRequirements = null;
35461
+ this.precomputedModelRequirements = null;
35341
35462
  }
35342
35463
  /**
35343
35464
  * Get cached or parse agent information
@@ -35354,6 +35475,16 @@ class AgentLlmExecutionTools {
35354
35475
  * Note: [🐤] This is names `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united
35355
35476
  */
35356
35477
  async getModelRequirements() {
35478
+ var _a, _b;
35479
+ if (this.precomputedModelRequirements !== null) {
35480
+ if (this.options.isVerbose) {
35481
+ console.info('[🤰]', 'Using precomputed agent model requirements', {
35482
+ agent: this.title,
35483
+ toolCount: (_b = (_a = this.precomputedModelRequirements.tools) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
35484
+ });
35485
+ }
35486
+ return this.precomputedModelRequirements;
35487
+ }
35357
35488
  if (this._cachedModelRequirements === null) {
35358
35489
  const preparationStartedAtMs = Date.now();
35359
35490
  if (this.options.isVerbose) {
@@ -35463,6 +35594,7 @@ class AgentLlmExecutionTools {
35463
35594
  * Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
35464
35595
  */
35465
35596
  async prepareChatPrompt(prompt) {
35597
+ var _a;
35466
35598
  const chatPrompt = this.requireChatPrompt(prompt);
35467
35599
  const { sanitizedRequirements, promptSuffix } = await this.getSanitizedAgentModelRequirements();
35468
35600
  const attachments = normalizeChatAttachments(chatPrompt.attachments);
@@ -35480,7 +35612,16 @@ class AgentLlmExecutionTools {
35480
35612
  mergedTools,
35481
35613
  knowledgeSourcesForAgent,
35482
35614
  });
35483
- console.log('!!!! promptWithAgentModelRequirements:', forwardedPrompt);
35615
+ if (this.options.isVerbose) {
35616
+ console.info('[🤰]', 'Prepared agent chat prompt', {
35617
+ agent: this.title,
35618
+ usedPrecomputedModelRequirements: this.precomputedModelRequirements !== null,
35619
+ toolNames: mergedTools.map((tool) => tool.name),
35620
+ knowledgeSourcesCount: (_a = knowledgeSourcesForAgent === null || knowledgeSourcesForAgent === void 0 ? void 0 : knowledgeSourcesForAgent.length) !== null && _a !== void 0 ? _a : 0,
35621
+ promptSuffixLength: promptSuffix.length,
35622
+ systemMessageLength: sanitizedRequirements.systemMessage.length,
35623
+ });
35624
+ }
35484
35625
  return {
35485
35626
  forwardedPrompt,
35486
35627
  sanitizedRequirements,
@@ -35667,6 +35808,7 @@ class AgentLlmExecutionTools {
35667
35808
  * Runs one prepared prompt through the deprecated OpenAI Assistant backend.
35668
35809
  */
35669
35810
  async callOpenAiAssistantChatModelStream(options) {
35811
+ var _a, _b, _c, _d;
35670
35812
  const assistant = await this.getOrPrepareOpenAiAssistant({
35671
35813
  llmTools: options.llmTools,
35672
35814
  originalPrompt: options.originalPrompt,
@@ -35674,7 +35816,14 @@ class AgentLlmExecutionTools {
35674
35816
  onProgress: options.onProgress,
35675
35817
  });
35676
35818
  const promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools = createOpenAiAssistantPrompt(options.preparedChatPrompt.forwardedPrompt);
35677
- console.log('!!!! promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools:', promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools);
35819
+ if (this.options.isVerbose) {
35820
+ console.info('[🤰]', 'Prepared OpenAI Assistant prompt', {
35821
+ agent: this.title,
35822
+ toolNames: (_b = (_a = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements.tools) === null || _a === void 0 ? void 0 : _a.map((tool) => tool.name)) !== null && _b !== void 0 ? _b : [],
35823
+ knowledgeSourcesCount: (_d = (_c = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements
35824
+ .knowledgeSources) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
35825
+ });
35826
+ }
35678
35827
  return assistant.callChatModelStream(promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools, options.onProgress, options.streamOptions);
35679
35828
  }
35680
35829
  /**
@@ -36365,7 +36514,8 @@ class Agent extends AgentLlmExecutionTools {
36365
36514
  isVerbose: options.isVerbose,
36366
36515
  llmTools: getSingleLlmExecutionTools(options.executionTools.llm),
36367
36516
  assistantPreparationMode: options.assistantPreparationMode,
36368
- agentSource: agentSource.value, // <- TODO: [🐱‍🚀] Allow to pass BehaviorSubject<string_book> OR refresh llmExecutionTools.callChat on agentSource change
36517
+ agentSource: agentSource.value,
36518
+ precomputedModelRequirements: options.precomputedModelRequirements,
36369
36519
  });
36370
36520
  this._agentName = undefined;
36371
36521
  /**