@promptbook/wizard 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
@@ -438,6 +438,7 @@ Prompts marked with `[-]` are not ready yet, prompts containing `@@@` are treate
438
438
  - **Reasoning control:** `--thinking-level low|medium|high|xhigh` for supported runners
439
439
  - **Interactive or unattended runs:** default wait mode, or `--no-wait` for batch execution
440
440
  - **Git safety:** clean working tree check by default, optional `--ignore-git-changes`
441
+ - **Opt-in remote pushes:** commits stay local unless you explicitly pass `--auto-push`
441
442
  - **Prompt triage:** `--priority` to process only more important tasks first
442
443
  - **Failure logging:** failed runs write a neighboring `.error.log`
443
444
  - **Line-ending normalization:** changed files are normalized back to LF by default
@@ -455,6 +456,8 @@ npx ts-node ./src/cli/test/ptbk.ts coder generate-boilerplates --template prompt
455
456
 
456
457
  npx ts-node ./src/cli/test/ptbk.ts coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
457
458
 
459
+ 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
460
+
458
461
  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
459
462
 
460
463
  npx ts-node ./src/cli/test/ptbk.ts coder find-refactor-candidates
@@ -477,9 +480,11 @@ npx ptbk coder generate-boilerplates
477
480
 
478
481
  npx ptbk coder generate-boilerplates --template prompts/templates/common.md
479
482
 
480
- npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md
483
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --test npm run test
484
+
485
+ npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --auto-push
481
486
 
482
- npx ptbk coder run --agent github-copilot --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --ignore-git-changes --no-wait
487
+ 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
483
488
 
484
489
  npx ptbk coder find-refactor-candidates
485
490
 
@@ -496,7 +501,7 @@ npx ptbk coder verify
496
501
  | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------ | ---- | ----- | ------------------------------------------------------------------------ |
497
502
  | `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/`. |
498
503
  | `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. |
499
- | `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. |
504
+ | `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. |
500
505
  | `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. |
501
506
  | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
502
507
 
@@ -507,12 +512,14 @@ npx ptbk coder verify
507
512
  | `--agent <name>` | Selects the coding backend. |
508
513
  | `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
509
514
  | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
515
+ | `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
510
516
  | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
511
517
  | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
512
518
  | `--ignore-git-changes` | Disables the clean-working-tree guard. |
513
519
  | `--priority <n>` | Runs only prompts at or above the given priority. |
514
520
  | `--dry-run` | Prints which prompts are ready instead of executing them. |
515
521
  | `--allow-credits` | Lets OpenAI Codex spend credits when required. |
522
+ | `--auto-push` | Pushes each successful coding-agent commit to the configured remote. |
516
523
  | `--auto-migrate` | Runs testing-server database migrations after each successful prompt. |
517
524
 
518
525
  #### Typical usage pattern
package/esm/index.es.js CHANGED
@@ -38,7 +38,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
38
38
  * @generated
39
39
  * @see https://github.com/webgptorg/promptbook
40
40
  */
41
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-42';
41
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-44';
42
42
  /**
43
43
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
44
44
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -18784,7 +18784,7 @@ function createEmptyAgentModelRequirements() {
18784
18784
  systemMessage: '',
18785
18785
  promptSuffix: '',
18786
18786
  // modelName: 'gpt-5',
18787
- modelName: 'gemini-2.5-flash-lite',
18787
+ modelName: 'gpt-5.4-mini',
18788
18788
  temperature: 0.7,
18789
18789
  topP: 0.9,
18790
18790
  topK: 50,
@@ -19824,7 +19824,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
19824
19824
  * Short one-line description of GOAL.
19825
19825
  */
19826
19826
  get description() {
19827
- return 'Define main **goals** the AI assistant should achieve, with later goals having higher priority.';
19827
+ return 'Define the effective agent **goal**; when multiple goals exist, only the last one stays effective.';
19828
19828
  }
19829
19829
  /**
19830
19830
  * Icon for this commitment.
@@ -19839,12 +19839,14 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
19839
19839
  return spaceTrim$1(`
19840
19840
  # ${this.type}
19841
19841
 
19842
- 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.
19842
+ Defines the main goal which should be achieved by the AI assistant.
19843
+ There can be multiple goals in source, but after inheritance/source rewriting only the last \`GOAL\` /\`GOALS\` remains effective.
19843
19844
 
19844
19845
  ## Key aspects
19845
19846
 
19846
19847
  - Both terms work identically and can be used interchangeably.
19847
- - Later goals have higher priority and can override earlier goals.
19848
+ - Later goals overwrite earlier goals.
19849
+ - The public agent profile text is derived from the last goal.
19848
19850
  - Goals provide clear direction and purpose for the agent's responses.
19849
19851
  - Goals influence decision-making and response prioritization.
19850
19852
 
@@ -19857,9 +19859,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
19857
19859
  \`\`\`book
19858
19860
  Customer Support Agent
19859
19861
 
19860
- PERSONA You are a helpful customer support representative
19861
19862
  GOAL Resolve customer issues quickly and efficiently
19862
- GOAL Maintain high customer satisfaction scores
19863
19863
  GOAL Always follow company policies and procedures
19864
19864
  RULE Be polite and professional at all times
19865
19865
  \`\`\`
@@ -19867,9 +19867,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
19867
19867
  \`\`\`book
19868
19868
  Educational Assistant
19869
19869
 
19870
- PERSONA You are an educational assistant specializing in mathematics
19871
19870
  GOAL Help students understand mathematical concepts clearly
19872
- GOAL Encourage critical thinking and problem-solving skills
19873
19871
  GOAL Ensure all explanations are age-appropriate and accessible
19874
19872
  STYLE Use simple language and provide step-by-step explanations
19875
19873
  \`\`\`
@@ -19877,9 +19875,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
19877
19875
  \`\`\`book
19878
19876
  Safety-First Assistant
19879
19877
 
19880
- PERSONA You are a general-purpose AI assistant
19881
19878
  GOAL Be helpful and informative in all interactions
19882
- GOAL Provide accurate and reliable information
19883
19879
  GOAL Always prioritize user safety and ethical guidelines
19884
19880
  RULE Never provide harmful or dangerous advice
19885
19881
  \`\`\`
@@ -22498,7 +22494,16 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
22498
22494
  * Short one-line description of PERSONA.
22499
22495
  */
22500
22496
  get description() {
22501
- return 'Define who the agent is: background, expertise, and personality.';
22497
+ return 'Deprecated legacy profile commitment. Prefer `GOAL` for agent profile text and inheritance-safe rewrites.';
22498
+ }
22499
+ /**
22500
+ * Optional UI/docs-only deprecation metadata.
22501
+ */
22502
+ get deprecation() {
22503
+ return {
22504
+ message: 'Use `GOAL` for agent profile text and inheritance-safe rewrites.',
22505
+ replacedBy: ['GOAL'],
22506
+ };
22502
22507
  }
22503
22508
  /**
22504
22509
  * Icon for this commitment.
@@ -22513,16 +22518,24 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
22513
22518
  return spaceTrim$1(`
22514
22519
  # ${this.type}
22515
22520
 
22516
- Defines who the agent is, their background, expertise, and personality traits.
22521
+ Deprecated legacy commitment that defines who the agent is, their background, expertise, and personality traits.
22517
22522
 
22518
- ## Key aspects
22523
+ ## Migration
22519
22524
 
22520
- - Multiple \`PERSONA\` and \`PERSONAE\` commitments are merged together.
22521
- - Both terms work identically and can be used interchangeably.
22522
- - If they are in conflict, the last one takes precedence.
22523
- - You can write persona content in multiple lines.
22525
+ - Existing \`${this.type}\` books still parse and compile.
22526
+ - New books should prefer \`GOAL\`.
22527
+ - Agent profile rendering now prefers the last \`GOAL\` and only falls back to \`${this.type}\` when no goal exists.
22528
+ - Runtime compilation keeps the legacy multi-\`PERSONA\` merge behavior for backward compatibility.
22524
22529
 
22525
- ## Examples
22530
+ ## Preferred replacement
22531
+
22532
+ \`\`\`book
22533
+ Programming Assistant
22534
+
22535
+ GOAL Help the user solve programming problems with practical TypeScript and React guidance.
22536
+ \`\`\`
22537
+
22538
+ ## Legacy compatibility example
22526
22539
 
22527
22540
  \`\`\`book
22528
22541
  Programming Assistant
@@ -23230,6 +23243,15 @@ const teamToolFunctions = {};
23230
23243
  * Map of team tool titles.
23231
23244
  */
23232
23245
  const teamToolTitles = {};
23246
+ /**
23247
+ * Shared TEAM usage rules appended ahead of teammate listings.
23248
+ *
23249
+ * @private
23250
+ */
23251
+ const TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES = [
23252
+ '- If a teammate is relevant to the request, consult that teammate using the matching tool.',
23253
+ '- Do not ask the user for information that a listed teammate can provide directly.',
23254
+ ];
23233
23255
  /**
23234
23256
  * Constant for remote agents by Url.
23235
23257
  */
@@ -23278,7 +23300,7 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
23278
23300
  \`\`\`book
23279
23301
  Legal Assistant
23280
23302
 
23281
- PERSONA An expert software developer
23303
+ GOAL Get expert software-development advice from the teammate when legal discussion needs technical context.
23282
23304
  TEAM You can talk with http://localhost:4440/agents/GMw67JN8TXxN7y to discuss the legal aspects.
23283
23305
  \`\`\`
23284
23306
  `);
@@ -23319,12 +23341,9 @@ class TeamCommitmentDefinition extends BaseCommitmentDefinition {
23319
23341
  if (updatedTools.some((tool) => tool.name === entry.toolName)) {
23320
23342
  continue;
23321
23343
  }
23322
- const toolDescription = entry.description
23323
- ? `Consult teammate ${entry.teammate.label}\n${entry.description}`
23324
- : `Consult teammate ${entry.teammate.label}`;
23325
23344
  updatedTools.push({
23326
23345
  name: entry.toolName,
23327
- description: toolDescription,
23346
+ description: buildTeamToolDescription(entry),
23328
23347
  parameters: {
23329
23348
  type: 'object',
23330
23349
  properties: {
@@ -23393,22 +23412,72 @@ function resolveTeamTeammateLabels(teamContent, teammates) {
23393
23412
  /**
23394
23413
  * Builds the textual TEAM section body for the final system message.
23395
23414
  *
23396
- * Each teammate is listed with its tool name and, when available, a one-line description.
23397
- * Uses `spaceTrim` to ensure consistent whitespace and indentation.
23415
+ * Each teammate is listed with its tool name, TEAM instructions, and optional profile hints.
23398
23416
  */
23399
23417
  function buildTeamSystemMessageBody(teamEntries) {
23400
- const lines = teamEntries.map((entry, index) => {
23401
- const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
23402
- if (!entry.description) {
23403
- return toolLine;
23404
- }
23405
- return spaceTrim$1(`
23406
- ${toolLine}
23407
- ${entry.description}
23408
- `);
23409
- });
23418
+ const lines = [
23419
+ ...TEAM_SYSTEM_MESSAGE_GUIDANCE_LINES,
23420
+ '',
23421
+ ...teamEntries.map((entry, index) => {
23422
+ const toolLine = `${index + 1}) ${entry.teammate.label} tool \`${entry.toolName}\``;
23423
+ const detailLines = collectTeamEntryDetails(entry).map(formatTeamEntryDetailLine);
23424
+ return [toolLine, ...detailLines].join('\n');
23425
+ }),
23426
+ ];
23410
23427
  return lines.join('\n');
23411
23428
  }
23429
+ /**
23430
+ * Builds the model-visible description for one teammate tool.
23431
+ *
23432
+ * @private
23433
+ */
23434
+ function buildTeamToolDescription(entry) {
23435
+ const detailLines = collectTeamEntryDetails(entry).map(({ label, content }) => `${label}: ${content}`);
23436
+ return [`Consult teammate ${entry.teammate.label}`, ...detailLines].join('\n');
23437
+ }
23438
+ /**
23439
+ * Collects structured teammate details that should stay visible to the model.
23440
+ *
23441
+ * @private
23442
+ */
23443
+ function collectTeamEntryDetails(entry) {
23444
+ var _a;
23445
+ const details = [];
23446
+ const instructions = entry.teammate.instructions.trim();
23447
+ const description = ((_a = entry.description) === null || _a === void 0 ? void 0 : _a.trim()) || '';
23448
+ if (instructions) {
23449
+ details.push({
23450
+ label: 'TEAM instructions',
23451
+ content: instructions,
23452
+ });
23453
+ }
23454
+ if (description) {
23455
+ details.push({
23456
+ label: 'Profile',
23457
+ content: description,
23458
+ });
23459
+ }
23460
+ return details;
23461
+ }
23462
+ /**
23463
+ * Formats one teammate detail line for the TEAM system-message section.
23464
+ *
23465
+ * @private
23466
+ */
23467
+ function formatTeamEntryDetailLine(detail) {
23468
+ return indentMultilineText(`${detail.label}: ${detail.content}`, ' ');
23469
+ }
23470
+ /**
23471
+ * Indents all lines of one potentially multi-line text block.
23472
+ *
23473
+ * @private
23474
+ */
23475
+ function indentMultilineText(text, prefix) {
23476
+ return text
23477
+ .split('\n')
23478
+ .map((line) => `${prefix}${line}`)
23479
+ .join('\n');
23480
+ }
23412
23481
  /**
23413
23482
  * Registers tool function and title for a teammate tool.
23414
23483
  */
@@ -30055,6 +30124,15 @@ const COMMITMENTS_WITH_AGENT_REFERENCES = new Set(['FROM', 'IMPORT', 'IMPORTS',
30055
30124
  * @private internal constant of `createAgentModelRequirementsWithCommitments`
30056
30125
  */
30057
30126
  const DELETE_COMMITMENT_TYPES = new Set(['DELETE', 'CANCEL', 'DISCARD', 'REMOVE']);
30127
+ /**
30128
+ * Commitments whose earlier occurrences are overwritten by the last occurrence in source order.
30129
+ *
30130
+ * @private internal constant of `createAgentModelRequirementsWithCommitments`
30131
+ */
30132
+ const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
30133
+ ['GOAL', 'GOAL'],
30134
+ ['GOALS', 'GOAL'],
30135
+ ]);
30058
30136
  /**
30059
30137
  * Regex pattern matching markdown horizontal lines that should not be copied into the final system message.
30060
30138
  *
@@ -30105,7 +30183,7 @@ function getSafeReferenceCommitmentFallback(commitmentType, originalContent) {
30105
30183
  */
30106
30184
  async function createAgentModelRequirementsWithCommitments(agentSource, modelName, options) {
30107
30185
  const parseResult = parseAgentSourceWithCommitments(agentSource);
30108
- const filteredCommitments = filterDeletedCommitments(parseResult.commitments);
30186
+ const filteredCommitments = filterOverwrittenCommitments(filterDeletedCommitments(parseResult.commitments));
30109
30187
  let requirements = createInitialAgentModelRequirements(parseResult.agentName, modelName);
30110
30188
  requirements = await applyCommitmentsToRequirements(requirements, filteredCommitments, options);
30111
30189
  requirements = aggregateUseCommitmentSystemMessages(requirements, filteredCommitments);
@@ -30116,6 +30194,35 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
30116
30194
  requirements = await applyPendingInlineKnowledgeSources(requirements, options === null || options === void 0 ? void 0 : options.inlineKnowledgeSourceUploader);
30117
30195
  return finalizeRequirements(requirements);
30118
30196
  }
30197
+ /**
30198
+ * Removes earlier commitments that are overwritten by later commitments of the same semantic group.
30199
+ *
30200
+ * This currently keeps only the last `GOAL` / `GOALS` commitment so inheritance rewrites
30201
+ * and multi-goal sources expose one effective goal to the runtime.
30202
+ *
30203
+ * @param commitments - Parsed commitments after DELETE-like filtering.
30204
+ * @returns Commitments with overwritten entries removed while preserving source order.
30205
+ *
30206
+ * @private internal utility of `createAgentModelRequirementsWithCommitments`
30207
+ */
30208
+ function filterOverwrittenCommitments(commitments) {
30209
+ const seenOverwriteGroups = new Set();
30210
+ const keptCommitments = [];
30211
+ for (let index = commitments.length - 1; index >= 0; index--) {
30212
+ const commitment = commitments[index];
30213
+ const overwriteGroup = OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE.get(commitment.type);
30214
+ if (!overwriteGroup) {
30215
+ keptCommitments.push(commitment);
30216
+ continue;
30217
+ }
30218
+ if (seenOverwriteGroups.has(overwriteGroup)) {
30219
+ continue;
30220
+ }
30221
+ seenOverwriteGroups.add(overwriteGroup);
30222
+ keptCommitments.push(commitment);
30223
+ }
30224
+ return keptCommitments.reverse();
30225
+ }
30119
30226
  /**
30120
30227
  * Creates the initial requirements object with the parsed agent name stored in metadata and an optional model override.
30121
30228
  *
@@ -30758,7 +30865,7 @@ function createDefaultAgentName(agentSource) {
30758
30865
  function parseAgentSource(agentSource) {
30759
30866
  const parseResult = parseAgentSourceWithCommitments(agentSource);
30760
30867
  const resolvedAgentName = parseResult.agentName || createDefaultAgentName(agentSource);
30761
- const personaDescription = extractPersonaDescription(parseResult.commitments);
30868
+ const personaDescription = extractAgentProfileText(parseResult.commitments);
30762
30869
  const initialMessage = extractInitialMessage(parseResult.commitments);
30763
30870
  const parsedProfile = extractParsedAgentProfile(parseResult.commitments);
30764
30871
  ensureMetaFullname(parsedProfile.meta, resolvedAgentName);
@@ -30862,25 +30969,33 @@ const META_COMMITMENT_APPLIERS = {
30862
30969
  */
30863
30970
  const LOCAL_AGENT_REFERENCE_PREFIXES = ['./', '../', '/'];
30864
30971
  /**
30865
- * Builds the combined persona description from PERSONA commitments.
30972
+ * Resolves the public agent profile text from the last GOAL/GOALS commitment,
30973
+ * falling back to the deprecated PERSONA/PERSONAE commitments when no goal exists.
30866
30974
  *
30867
30975
  * @private internal utility of `parseAgentSource`
30868
30976
  */
30869
- function extractPersonaDescription(commitments) {
30870
- let personaDescription = null;
30977
+ function extractAgentProfileText(commitments) {
30978
+ let goalDescription = '';
30979
+ let hasGoalDescription = false;
30980
+ let personaDescription = '';
30981
+ let hasPersonaDescription = false;
30871
30982
  for (const commitment of commitments) {
30872
- if (commitment.type !== 'PERSONA') {
30873
- continue;
30874
- }
30875
- if (personaDescription === null) {
30876
- personaDescription = '';
30983
+ if (commitment.type === 'GOAL' || commitment.type === 'GOALS') {
30984
+ goalDescription = commitment.content;
30985
+ hasGoalDescription = true;
30877
30986
  }
30878
- else {
30879
- personaDescription += `\n\n${personaDescription}`;
30987
+ if (commitment.type === 'PERSONA' || commitment.type === 'PERSONAE') {
30988
+ personaDescription = commitment.content;
30989
+ hasPersonaDescription = true;
30880
30990
  }
30881
- personaDescription += commitment.content;
30882
30991
  }
30883
- return personaDescription;
30992
+ if (hasGoalDescription) {
30993
+ return goalDescription;
30994
+ }
30995
+ if (hasPersonaDescription) {
30996
+ return personaDescription;
30997
+ }
30998
+ return null;
30884
30999
  }
30885
31000
  /**
30886
31001
  * Resolves the last INITIAL MESSAGE commitment, which is the public initial-message value.
@@ -31367,7 +31482,7 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
31367
31482
  * Selects the best model using the preparePersona function
31368
31483
  * This directly uses preparePersona to ensure DRY principle
31369
31484
  *
31370
- * @param agentSource The agent source to derive persona description from
31485
+ * @param agentSource The agent source to derive effective profile text from
31371
31486
  * @param llmTools LLM tools for preparing persona
31372
31487
  * @returns The name of the best selected model
31373
31488
  *
@@ -31375,9 +31490,9 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
31375
31490
  */
31376
31491
  async function selectBestModelUsingPersona(agentSource, llmTools) {
31377
31492
  var _a;
31378
- // Parse agent source to get persona description
31493
+ // Parse agent source to get the effective profile description
31379
31494
  const { agentName, personaDescription } = parseAgentSource(agentSource);
31380
- // Use agent name as fallback if no persona description is available
31495
+ // Use agent name as fallback if no profile description is available
31381
31496
  const description = personaDescription || agentName || 'AI Agent';
31382
31497
  try {
31383
31498
  // Use preparePersona directly
@@ -39033,7 +39148,7 @@ function promptbookifyAiText(text) {
39033
39148
  /**
39034
39149
  * Constant for default agent kit model name.
39035
39150
  */
39036
- const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
39151
+ const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
39037
39152
  /**
39038
39153
  * Creates one structured log entry for streamed tool-call updates.
39039
39154
  *
@@ -40083,6 +40198,7 @@ class AgentLlmExecutionTools {
40083
40198
  * @param agentSource The agent source string that defines the agent's behavior
40084
40199
  */
40085
40200
  constructor(options) {
40201
+ var _a;
40086
40202
  this.options = options;
40087
40203
  /**
40088
40204
  * Cached model requirements to avoid re-parsing the agent source
@@ -40092,6 +40208,7 @@ class AgentLlmExecutionTools {
40092
40208
  * Cached parsed agent information
40093
40209
  */
40094
40210
  this._cachedAgentInfo = null;
40211
+ this.precomputedModelRequirements = (_a = options.precomputedModelRequirements) !== null && _a !== void 0 ? _a : null;
40095
40212
  }
40096
40213
  /**
40097
40214
  * Updates the agent source and clears the cache
@@ -40099,9 +40216,13 @@ class AgentLlmExecutionTools {
40099
40216
  * @param agentSource The new agent source string
40100
40217
  */
40101
40218
  updateAgentSource(agentSource) {
40219
+ if (this.options.agentSource === agentSource) {
40220
+ return;
40221
+ }
40102
40222
  this.options.agentSource = agentSource;
40103
40223
  this._cachedAgentInfo = null;
40104
40224
  this._cachedModelRequirements = null;
40225
+ this.precomputedModelRequirements = null;
40105
40226
  }
40106
40227
  /**
40107
40228
  * Get cached or parse agent information
@@ -40118,6 +40239,16 @@ class AgentLlmExecutionTools {
40118
40239
  * Note: [🐤] This is names `getModelRequirements` *(not `getAgentModelRequirements`)* because in future these two will be united
40119
40240
  */
40120
40241
  async getModelRequirements() {
40242
+ var _a, _b;
40243
+ if (this.precomputedModelRequirements !== null) {
40244
+ if (this.options.isVerbose) {
40245
+ console.info('[🤰]', 'Using precomputed agent model requirements', {
40246
+ agent: this.title,
40247
+ toolCount: (_b = (_a = this.precomputedModelRequirements.tools) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
40248
+ });
40249
+ }
40250
+ return this.precomputedModelRequirements;
40251
+ }
40121
40252
  if (this._cachedModelRequirements === null) {
40122
40253
  const preparationStartedAtMs = Date.now();
40123
40254
  if (this.options.isVerbose) {
@@ -40227,6 +40358,7 @@ class AgentLlmExecutionTools {
40227
40358
  * Resolves agent requirements, attachments, and runtime overrides into one forwarded chat prompt.
40228
40359
  */
40229
40360
  async prepareChatPrompt(prompt) {
40361
+ var _a;
40230
40362
  const chatPrompt = this.requireChatPrompt(prompt);
40231
40363
  const { sanitizedRequirements, promptSuffix } = await this.getSanitizedAgentModelRequirements();
40232
40364
  const attachments = normalizeChatAttachments(chatPrompt.attachments);
@@ -40244,7 +40376,16 @@ class AgentLlmExecutionTools {
40244
40376
  mergedTools,
40245
40377
  knowledgeSourcesForAgent,
40246
40378
  });
40247
- console.log('!!!! promptWithAgentModelRequirements:', forwardedPrompt);
40379
+ if (this.options.isVerbose) {
40380
+ console.info('[🤰]', 'Prepared agent chat prompt', {
40381
+ agent: this.title,
40382
+ usedPrecomputedModelRequirements: this.precomputedModelRequirements !== null,
40383
+ toolNames: mergedTools.map((tool) => tool.name),
40384
+ knowledgeSourcesCount: (_a = knowledgeSourcesForAgent === null || knowledgeSourcesForAgent === void 0 ? void 0 : knowledgeSourcesForAgent.length) !== null && _a !== void 0 ? _a : 0,
40385
+ promptSuffixLength: promptSuffix.length,
40386
+ systemMessageLength: sanitizedRequirements.systemMessage.length,
40387
+ });
40388
+ }
40248
40389
  return {
40249
40390
  forwardedPrompt,
40250
40391
  sanitizedRequirements,
@@ -40431,6 +40572,7 @@ class AgentLlmExecutionTools {
40431
40572
  * Runs one prepared prompt through the deprecated OpenAI Assistant backend.
40432
40573
  */
40433
40574
  async callOpenAiAssistantChatModelStream(options) {
40575
+ var _a, _b, _c, _d;
40434
40576
  const assistant = await this.getOrPrepareOpenAiAssistant({
40435
40577
  llmTools: options.llmTools,
40436
40578
  originalPrompt: options.originalPrompt,
@@ -40438,7 +40580,14 @@ class AgentLlmExecutionTools {
40438
40580
  onProgress: options.onProgress,
40439
40581
  });
40440
40582
  const promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools = createOpenAiAssistantPrompt(options.preparedChatPrompt.forwardedPrompt);
40441
- console.log('!!!! promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools:', promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools);
40583
+ if (this.options.isVerbose) {
40584
+ console.info('[🤰]', 'Prepared OpenAI Assistant prompt', {
40585
+ agent: this.title,
40586
+ toolNames: (_b = (_a = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements.tools) === null || _a === void 0 ? void 0 : _a.map((tool) => tool.name)) !== null && _b !== void 0 ? _b : [],
40587
+ knowledgeSourcesCount: (_d = (_c = promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools.modelRequirements
40588
+ .knowledgeSources) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
40589
+ });
40590
+ }
40442
40591
  return assistant.callChatModelStream(promptWithAgentModelRequirementsForOpenAiAssistantExecutionTools, options.onProgress, options.streamOptions);
40443
40592
  }
40444
40593
  /**
@@ -41129,7 +41278,8 @@ class Agent extends AgentLlmExecutionTools {
41129
41278
  isVerbose: options.isVerbose,
41130
41279
  llmTools: getSingleLlmExecutionTools(options.executionTools.llm),
41131
41280
  assistantPreparationMode: options.assistantPreparationMode,
41132
- agentSource: agentSource.value, // <- TODO: [🐱‍🚀] Allow to pass BehaviorSubject<string_book> OR refresh llmExecutionTools.callChat on agentSource change
41281
+ agentSource: agentSource.value,
41282
+ precomputedModelRequirements: options.precomputedModelRequirements,
41133
41283
  });
41134
41284
  this._agentName = undefined;
41135
41285
  /**