@promptbook/remote-server 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
@@ -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-42';
43
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-44';
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
@@ -12183,7 +12183,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
12183
12183
  * Short one-line description of GOAL.
12184
12184
  */
12185
12185
  get description() {
12186
- return 'Define main **goals** the AI assistant should achieve, with later goals having higher priority.';
12186
+ return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
12187
12187
  }
12188
12188
  /**
12189
12189
  * Icon for this commitment.
@@ -12198,12 +12198,14 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
12198
12198
  return spaceTrim$1(`
12199
12199
  # ${this.type}
12200
12200
 
12201
- 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.
12201
+ Defines the main goal which should be achieved by the AI assistant.
12202
+ There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
12202
12203
 
12203
12204
  ## Key aspects
12204
12205
 
12205
12206
  - Both terms work identically and can be used interchangeably.
12206
- - Later goals have higher priority and can override earlier goals.
12207
+ - Later goals overwrite earlier goals.
12208
+ - The public agent profile text is derived from the last goal.
12207
12209
  - Goals provide clear direction and purpose for the agent's responses.
12208
12210
  - Goals influence decision-making and response prioritization.
12209
12211
 
@@ -12216,9 +12218,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
12216
12218
  \`\`\`book
12217
12219
  Customer Support Agent
12218
12220
 
12219
- PERSONA You are a helpful customer support representative
12220
12221
  GOAL Resolve customer issues quickly and efficiently
12221
- GOAL Maintain high customer satisfaction scores
12222
12222
  GOAL Always follow company policies and procedures
12223
12223
  RULE Be polite and professional at all times
12224
12224
  \`\`\`
@@ -12226,9 +12226,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
12226
12226
  \`\`\`book
12227
12227
  Educational Assistant
12228
12228
 
12229
- PERSONA You are an educational assistant specializing in mathematics
12230
12229
  GOAL Help students understand mathematical concepts clearly
12231
- GOAL Encourage critical thinking and problem-solving skills
12232
12230
  GOAL Ensure all explanations are age-appropriate and accessible
12233
12231
  STYLE Use simple language and provide step-by-step explanations
12234
12232
  \`\`\`
@@ -12236,9 +12234,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
12236
12234
  \`\`\`book
12237
12235
  Safety-First Assistant
12238
12236
 
12239
- PERSONA You are a general-purpose AI assistant
12240
12237
  GOAL Be helpful and informative in all interactions
12241
- GOAL Provide accurate and reliable information
12242
12238
  GOAL Always prioritize user safety and ethical guidelines
12243
12239
  RULE Never provide harmful or dangerous advice
12244
12240
  \`\`\`
@@ -15097,7 +15093,16 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
15097
15093
  * Short one-line description of PERSONA.
15098
15094
  */
15099
15095
  get description() {
15100
- return 'Define who the agent is: background, expertise, and personality.';
15096
+ return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
15097
+ }
15098
+ /**
15099
+ * Optional UI/docs-only deprecation metadata.
15100
+ */
15101
+ get deprecation() {
15102
+ return {
15103
+ message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
15104
+ replacedBy: ['GOAL'],
15105
+ };
15101
15106
  }
15102
15107
  /**
15103
15108
  * Icon for this commitment.
@@ -15112,16 +15117,24 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
15112
15117
  return spaceTrim$1(`
15113
15118
  # ${this.type}
15114
15119
 
15115
- Defines who the agent is, their background, expertise, and personality traits.
15120
+ Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
15116
15121
 
15117
- ## Key aspects
15122
+ ## Migration
15118
15123
 
15119
- - Multiple \`PERSONA\` and \`PERSONAE\` commitments are merged together.
15120
- - Both terms work identically and can be used interchangeably.
15121
- - If they are in conflict, the last one takes precedence.
15122
- - You can write persona content in multiple lines.
15124
+ - Existing \`${this.type}\` books still parse and compile.
15125
+ - New books should prefer \`GOAL\`.
15126
+ - Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
15127
+ - Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
15123
15128
 
15124
- ## Examples
15129
+ ## Preferred replacement
15130
+
15131
+ \`\`\`book
15132
+ Programming Assistant
15133
+
15134
+ GOAL Help the user solve programming problems with practical TypeScript and React guidance.
15135
+ \`\`\`
15136
+
15137
+ ## Legacy compatibility example
15125
15138
 
15126
15139
  \`\`\`book
15127
15140
  Programming Assistant
@@ -15829,6 +15842,15 @@ const teamToolFunctions = {};
15829
15842
  * Map of team tool titles.
15830
15843
  */
15831
15844
  const teamToolTitles = {};
15845
+ /**
15846
+ * Shared TEAM usage rules appended ahead of teammate listings.
15847
+ *
15848
+ * @private
15849
+ */
15850
+ const TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES = [
15851
+ '- If a teammate is relevant to the request, consult that teammate using the matching tool.',
15852
+ '- Do not ask the user for information that a listed teammate can provide directly.',
15853
+ ];
15832
15854
  /**
15833
15855
  * Constant for remote agents by Url.
15834
15856
  */
@@ -15877,7 +15899,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
15877
15899
  \`\`\`book
15878
15900
  Legal Assistant
15879
15901
 
15880
- PERSONA An expert software developer
15902
+ GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
15881
15903
  TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
15882
15904
  \`\`\`
15883
15905
  `);
@@ -15918,12 +15940,9 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
15918
15940
  if (updatedTools.some((tool) => tool.name === entry.toolName)) {
15919
15941
  continue;
15920
15942
  }
15921
- const toolDescription = entry.description
15922
- ? `Consult teammate ${entry.teammate.label}\n${entry.description}`
15923
- : `Consult teammate ${entry.teammate.label}`;
15924
15943
  updatedTools.push({
15925
15944
  name: entry.toolName,
15926
- description: toolDescription,
15945
+ description: buildTeamToolDescription(entry),
15927
15946
  parameters: {
15928
15947
  type: 'object',
15929
15948
  properties: {
@@ -15992,22 +16011,72 @@ function resolveTeamTeammateLabels(teamContent, teammates) {
15992
16011
  /**
15993
16012
  * Builds the textual TEAM section body for the final system message.
15994
16013
  *
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.
16014
+ * Each teammate is listed with its tool name, TEAM instructions, and optional profile hints.
15997
16015
  */
15998
16016
  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
- });
16017
+ const lines = [
16018
+ ...TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES,
16019
+ '',
16020
+ ...teamEntries.map((entry, index) => {
16021
+ const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
16022
+ const detailLines = collectTeamEntryDetails(entry).map(formatTeamEntryDetailLine);
16023
+ return [toolLine, ...detailLines].join('\n');
16024
+ }),
16025
+ ];
16009
16026
  return lines.join('\n');
16010
16027
  }
16028
+ /**
16029
+ * Builds the model-visible description for one teammate tool.
16030
+ *
16031
+ * @private
16032
+ */
16033
+ function buildTeamToolDescription(entry) {
16034
+ const detailLines = collectTeamEntryDetails(entry).map(({ label, content }) => `${label}: ${content}`);
16035
+ return [`Consult teammate ${entry.teammate.label}`, ...detailLines].join('\n');
16036
+ }
16037
+ /**
16038
+ * Collects structured teammate details that should stay visible to the model.
16039
+ *
16040
+ * @private
16041
+ */
16042
+ function collectTeamEntryDetails(entry) {
16043
+ var _a;
16044
+ const details = [];
16045
+ const instructions = entry.teammate.instructions.trim();
16046
+ const description = ((_a = entry.description) === null || _a === void 0 ? void 0 : _a.trim()) || '';
16047
+ if (instructions) {
16048
+ details.push({
16049
+ label: 'TEAM instructions',
16050
+ content: instructions,
16051
+ });
16052
+ }
16053
+ if (description) {
16054
+ details.push({
16055
+ label: 'Profile',
16056
+ content: description,
16057
+ });
16058
+ }
16059
+ return details;
16060
+ }
16061
+ /**
16062
+ * Formats one teammate detail line for the TEAM system-message section.
16063
+ *
16064
+ * @private
16065
+ */
16066
+ function formatTeamEntryDetailLine(detail) {
16067
+ return indentMultilineText(`${detail.label}: ${detail.content}`, ' ');
16068
+ }
16069
+ /**
16070
+ * Indents all lines of one potentially multi-line text block.
16071
+ *
16072
+ * @private
16073
+ */
16074
+ function indentMultilineText(text, prefix) {
16075
+ return text
16076
+ .split('\n')
16077
+ .map((line) => `${prefix}${line}`)
16078
+ .join('\n');
16079
+ }
16011
16080
  /**
16012
16081
  * Registers tool function and title for a teammate tool.
16013
16082
  */
@@ -24998,7 +25067,7 @@ function parseParameters(text) {
24998
25067
  function parseAgentSource(agentSource) {
24999
25068
  const parseResult = parseAgentSourceWithCommitments(agentSource);
25000
25069
  const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
25001
- const personaDescription = extractPersonaDescription(parseResult.commitments);
25070
+ const personaDescription = extractAgentProfileText(parseResult.commitments);
25002
25071
  const initialMessage = extractInitialMessage(parseResult.commitments);
25003
25072
  const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
25004
25073
  ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
@@ -25102,25 +25171,33 @@ const META_COMMITMENT_APPLIERS = {
25102
25171
  */
25103
25172
  const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
25104
25173
  /**
25105
- * Builds the combined persona description from PERSONA commitments.
25174
+ * Resolves the public agent profile text from the last GOAL/GOALS commitment,
25175
+ * falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
25106
25176
  *
25107
25177
  * @private internal utility of `parseAgentSource`
25108
25178
  */
25109
- function extractPersonaDescription(commitments) {
25110
- let personaDescription = null;
25179
+ function extractAgentProfileText(commitments) {
25180
+ let goalDescription = '';
25181
+ let hasGoalDescription = false;
25182
+ let personaDescription = '';
25183
+ let hasPersonaDescription = false;
25111
25184
  for (const commitment of commitments) {
25112
- if (commitment.type !== 'PERSONA') {
25113
- continue;
25185
+ if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
25186
+ goalDescription = commitment.content;
25187
+ hasGoalDescription = true;
25114
25188
  }
25115
- if (personaDescription === null) {
25116
- personaDescription = '';
25189
+ if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
25190
+ personaDescription = commitment.content;
25191
+ hasPersonaDescription = true;
25117
25192
  }
25118
- else {
25119
- personaDescription += `\n\n${personaDescription}`;
25120
- }
25121
- personaDescription += commitment.content;
25122
25193
  }
25123
- return personaDescription;
25194
+ if (hasGoalDescription) {
25195
+ return goalDescription;
25196
+ }
25197
+ if (hasPersonaDescription) {
25198
+ return personaDescription;
25199
+ }
25200
+ return null;
25124
25201
  }
25125
25202
  /**
25126
25203
  * Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
@@ -25641,7 +25718,7 @@ function createEmptyAgentModelRequirements() {
25641
25718
  systemMessage: '',
25642
25719
  promptSuffix: '',
25643
25720
  // modelName: 'gpt-5',
25644
- modelName: 'gemini-2.5-flash-lite',
25721
+ modelName: 'gpt-5.4-mini',
25645
25722
  temperature: 0.7,
25646
25723
  topP: 0.9,
25647
25724
  topK: 50,
@@ -25802,6 +25879,15 @@ const COMMITMENTS_WITH_AGENT_REFERENCES = new Set(['FROM', 'IMPORT', 'IMPORTS',
25802
25879
  * @private internal constant of `createAgentModelRequirementsWithCommitments`
25803
25880
  */
25804
25881
  const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
25882
+ /**
25883
+ * Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
25884
+ *
25885
+ * @private internal constant of `createAgentModelRequirementsWithCommitments`
25886
+ */
25887
+ const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
25888
+ ['GOAL', 'GOAL'],
25889
+ ['GOALS', 'GOAL'],
25890
+ ]);
25805
25891
  /**
25806
25892
  * Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
25807
25893
  *
@@ -25852,7 +25938,7 @@ function getSafeReferenceCommitmentFallback(commitmentType, originalContent) {
25852
25938
  */
25853
25939
  async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
25854
25940
  const parseResult = parseAgentSourceWithCommitments(agentSource);
25855
- const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
25941
+ const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
25856
25942
  let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
25857
25943
  requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
25858
25944
  requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
@@ -25863,6 +25949,35 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
25863
25949
  requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
25864
25950
  return finalizeRequirements(requirements);
25865
25951
  }
25952
+ /**
25953
+ * Removes earlier commitments that are overwritten by later commitments of the same semantic group.
25954
+ *
25955
+ * This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
25956
+ * and multi-goal sources expose one effective goal to the runtime.
25957
+ *
25958
+ * @param commitments - Parsed commitments after DELETE-like filtering.
25959
+ * @returns Commitments with overwritten entries removed while preserving source order.
25960
+ *
25961
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
25962
+ */
25963
+ function filterOverwrittenCommitments(commitments) {
25964
+ const seenOverwriteGroups = new Set();
25965
+ const keptCommitments = [];
25966
+ for (let index = commitments.length - 1; index >= 0; index--) {
25967
+ const commitment = commitments[index];
25968
+ const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
25969
+ if (!overwriteGroup) {
25970
+ keptCommitments.push(commitment);
25971
+ continue;
25972
+ }
25973
+ if (seenOverwriteGroups.has(overwriteGroup)) {
25974
+ continue;
25975
+ }
25976
+ seenOverwriteGroups.add(overwriteGroup);
25977
+ keptCommitments.push(commitment);
25978
+ }
25979
+ return keptCommitments.reverse();
25980
+ }
25866
25981
  /**
25867
25982
  * Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
25868
25983
  *
@@ -26454,7 +26569,7 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
26454
26569
  * Selects the best model using the preparePersona function
26455
26570
  * This directly uses preparePersona to ensure DRY principle
26456
26571
  *
26457
- * @param agentSource The agent source to derive persona description from
26572
+ * @param agentSource The agent source to derive effective profile text from
26458
26573
  * @param llmTools LLM tools for preparing persona
26459
26574
  * @returns The name of the best selected model
26460
26575
  *
@@ -26462,9 +26577,9 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
26462
26577
  */
26463
26578
  async function selectBestModelUsingPersona(agentSource, llmTools) {
26464
26579
  var _a;
26465
- // Parse agent source to get persona description
26580
+ // Parse agent source to get the effective profile description
26466
26581
  const { agentName, personaDescription } = parseAgentSource(agentSource);
26467
- // Use agent name as fallback if no persona description is available
26582
+ // Use agent name as fallback if no profile description is available
26468
26583
  const description = personaDescription || agentName || 'AI Agent';
26469
26584
  try {
26470
26585
  // Use preparePersona directly
@@ -30235,7 +30350,7 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
30235
30350
  /**
30236
30351
  * Constant for default agent kit model name.
30237
30352
  */
30238
- const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
30353
+ const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
30239
30354
  /**
30240
30355
  * Creates one structured log entry for streamed tool-call updates.
30241
30356
  *
@@ -32301,6 +32416,7 @@ class AgentLlmExecutionTools {
32301
32416
  * @param agentSource The agent source string that defines the agent's behavior
32302
32417
  */
32303
32418
  constructor(options) {
32419
+ var _a;
32304
32420
  this.options = options;
32305
32421
  /**
32306
32422
  * Cached model requirements to avoid re-parsing the agent source
@@ -32310,6 +32426,7 @@ class AgentLlmExecutionTools {
32310
32426
  * Cached parsed agent information
32311
32427
  */
32312
32428
  this._cachedAgentInfo = null;
32429
+ this.precomputedModelRequirements = (_a = options.precomputedModelRequirements) !== null && _a !== void 0 ? _a : null;
32313
32430
  }
32314
32431
  /**
32315
32432
  * Updates the agent source and clears the cache
@@ -32317,9 +32434,13 @@ class AgentLlmExecutionTools {
32317
32434
  * @param agentSource The new agent source string
32318
32435
  */
32319
32436
  updateAgentSource(agentSource) {
32437
+ if (this.options.agentSource === agentSource) {
32438
+ return;
32439
+ }
32320
32440
  this.options.agentSource = agentSource;
32321
32441
  this._cachedAgentInfo = null;
32322
32442
  this._cachedModelRequirements = null;
32443
+ this.precomputedModelRequirements = null;
32323
32444
  }
32324
32445
  /**
32325
32446
  * Get cached or parse agent information
@@ -32336,6 +32457,16 @@ class AgentLlmExecutionTools {
32336
32457
  * Note: [🐤] This is names `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united
32337
32458
  */
32338
32459
  async getModelRequirements() {
32460
+ var _a, _b;
32461
+ if (this.precomputedModelRequirements !== null) {
32462
+ if (this.options.isVerbose) {
32463
+ console.info('[🤰]', 'Using precomputed agent model requirements', {
32464
+ agent: this.title,
32465
+ toolCount: (_b = (_a = this.precomputedModelRequirements.tools) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
32466
+ });
32467
+ }
32468
+ return this.precomputedModelRequirements;
32469
+ }
32339
32470
  if (this._cachedModelRequirements === null) {
32340
32471
  const preparationStartedAtMs = Date.now();
32341
32472
  if (this.options.isVerbose) {
@@ -32445,6 +32576,7 @@ class AgentLlmExecutionTools {
32445
32576
  * Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
32446
32577
  */
32447
32578
  async prepareChatPrompt(prompt) {
32579
+ var _a;
32448
32580
  const chatPrompt = this.requireChatPrompt(prompt);
32449
32581
  const { sanitizedRequirements, promptSuffix } = await this.getSanitizedAgentModelRequirements();
32450
32582
  const attachments = normalizeChatAttachments(chatPrompt.attachments);
@@ -32462,7 +32594,16 @@ class AgentLlmExecutionTools {
32462
32594
  mergedTools,
32463
32595
  knowledgeSourcesForAgent,
32464
32596
  });
32465
- console.log('!!!! promptWithAgentModelRequirements:', forwardedPrompt);
32597
+ if (this.options.isVerbose) {
32598
+ console.info('[🤰]', 'Prepared agent chat prompt', {
32599
+ agent: this.title,
32600
+ usedPrecomputedModelRequirements: this.precomputedModelRequirements !== null,
32601
+ toolNames: mergedTools.map((tool) => tool.name),
32602
+ knowledgeSourcesCount: (_a = knowledgeSourcesForAgent === null || knowledgeSourcesForAgent === void 0 ? void 0 : knowledgeSourcesForAgent.length) !== null && _a !== void 0 ? _a : 0,
32603
+ promptSuffixLength: promptSuffix.length,
32604
+ systemMessageLength: sanitizedRequirements.systemMessage.length,
32605
+ });
32606
+ }
32466
32607
  return {
32467
32608
  forwardedPrompt,
32468
32609
  sanitizedRequirements,
@@ -32649,6 +32790,7 @@ class AgentLlmExecutionTools {
32649
32790
  * Runs one prepared prompt through the deprecated OpenAI Assistant backend.
32650
32791
  */
32651
32792
  async callOpenAiAssistantChatModelStream(options) {
32793
+ var _a, _b, _c, _d;
32652
32794
  const assistant = await this.getOrPrepareOpenAiAssistant({
32653
32795
  llmTools: options.llmTools,
32654
32796
  originalPrompt: options.originalPrompt,
@@ -32656,7 +32798,14 @@ class AgentLlmExecutionTools {
32656
32798
  onProgress: options.onProgress,
32657
32799
  });
32658
32800
  const promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools = createOpenAiAssistantPrompt(options.preparedChatPrompt.forwardedPrompt);
32659
- console.log('!!!! promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools:', promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools);
32801
+ if (this.options.isVerbose) {
32802
+ console.info('[🤰]', 'Prepared OpenAI Assistant prompt', {
32803
+ agent: this.title,
32804
+ toolNames: (_b = (_a = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements.tools) === null || _a === void 0 ? void 0 : _a.map((tool) => tool.name)) !== null && _b !== void 0 ? _b : [],
32805
+ knowledgeSourcesCount: (_d = (_c = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements
32806
+ .knowledgeSources) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
32807
+ });
32808
+ }
32660
32809
  return assistant.callChatModelStream(promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools, options.onProgress, options.streamOptions);
32661
32810
  }
32662
32811
  /**
@@ -33347,7 +33496,8 @@ class Agent extends AgentLlmExecutionTools {
33347
33496
  isVerbose: options.isVerbose,
33348
33497
  llmTools: getSingleLlmExecutionTools(options.executionTools.llm),
33349
33498
  assistantPreparationMode: options.assistantPreparationMode,
33350
- agentSource: agentSource.value, // <- TODO: [🐱‍🚀] Allow to pass BehaviorSubject<string_book> OR refresh llmExecutionTools.callChat on agentSource change
33499
+ agentSource: agentSource.value,
33500
+ precomputedModelRequirements: options.precomputedModelRequirements,
33351
33501
  });
33352
33502
  this._agentName = undefined;
33353
33503
  /**