@promptbook/components 0.112.0-64 → 0.112.0-65

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 (41) hide show
  1. package/esm/index.es.js +281 -204
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/_packages/components.index.d.ts +0 -2
  4. package/esm/src/_packages/core.index.d.ts +2 -2
  5. package/esm/src/_packages/types.index.d.ts +0 -2
  6. package/esm/src/book-2.0/book-language-documentation/BookLanguageDocumentationExample.d.ts +27 -0
  7. package/esm/src/book-2.0/book-language-documentation/bookLanguageCommonPitfalls.d.ts +25 -0
  8. package/esm/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.d.ts +10 -0
  9. package/esm/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.d.ts +14 -0
  10. package/esm/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.d.ts +43 -0
  11. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +0 -34
  12. package/esm/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +0 -11
  13. package/esm/src/commitments/_common/toolRuntimeContext.d.ts +0 -6
  14. package/esm/src/formfactors/index.d.ts +2 -2
  15. package/esm/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +1 -1
  16. package/esm/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +1 -1
  17. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +0 -4
  18. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +0 -9
  19. package/esm/src/version.d.ts +1 -1
  20. package/package.json +1 -1
  21. package/umd/index.umd.js +281 -204
  22. package/umd/index.umd.js.map +1 -1
  23. package/umd/src/_packages/components.index.d.ts +0 -2
  24. package/umd/src/_packages/core.index.d.ts +2 -2
  25. package/umd/src/_packages/types.index.d.ts +0 -2
  26. package/umd/src/book-2.0/book-language-documentation/BookLanguageDocumentationExample.d.ts +27 -0
  27. package/umd/src/book-2.0/book-language-documentation/bookLanguageCommonPitfalls.d.ts +25 -0
  28. package/umd/src/book-2.0/book-language-documentation/bookLanguageDocumentationExamples.d.ts +10 -0
  29. package/umd/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.d.ts +14 -0
  30. package/umd/src/book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.d.ts +43 -0
  31. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +0 -34
  32. package/umd/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +0 -11
  33. package/umd/src/commitments/_common/toolRuntimeContext.d.ts +0 -6
  34. package/umd/src/formfactors/index.d.ts +2 -2
  35. package/umd/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +1 -1
  36. package/umd/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +1 -1
  37. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +0 -4
  38. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +0 -9
  39. package/umd/src/version.d.ts +1 -1
  40. /package/esm/src/{commitments/KNOWLEDGE/KNOWLEDGE.test.d.ts → book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.test.d.ts} +0 -0
  41. /package/umd/src/{commitments/KNOWLEDGE/KNOWLEDGE.test.d.ts → book-2.0/book-language-documentation/renderGroupedCommitmentDocumentationMarkdown.test.d.ts} +0 -0
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-64';
43
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-65';
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
@@ -10898,18 +10898,6 @@ function parseDataUrlKnowledgeSource(source) {
10898
10898
  }
10899
10899
  // Note: [💞] Ignore a discrepancy between file name and entity name
10900
10900
 
10901
- /**
10902
- * Name of the tool used by agents to search configured `KNOWLEDGE` sources.
10903
- *
10904
- * @public exported from `@promptbook/core`
10905
- */
10906
- const KNOWLEDGE_SEARCH_TOOL_NAME = 'knowledge_search';
10907
- /**
10908
- * Title of the system-message section generated for `KNOWLEDGE` commitments.
10909
- *
10910
- * @private constant of `KnowledgeCommitmentDefinition`
10911
- */
10912
- const KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE = 'Knowledge Search';
10913
10901
  /**
10914
10902
  * KNOWLEDGE commitment definition
10915
10903
  *
@@ -11031,17 +11019,9 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
11031
11019
  knowledgeInfoEntries.push(`Knowledge Source Inline: ${inlineSource.filename} (derived from inline content and processed for retrieval during chat)`);
11032
11020
  }
11033
11021
  if (knowledgeInfoEntries.length === 0) {
11034
- return addKnowledgeSearchToolAndSystemSection(nextRequirements);
11022
+ return nextRequirements;
11035
11023
  }
11036
- return addKnowledgeSearchToolAndSystemSection(nextRequirements);
11037
- }
11038
- /**
11039
- * Gets human-readable titles for tool functions provided by this commitment.
11040
- */
11041
- getToolTitles() {
11042
- return {
11043
- [KNOWLEDGE_SEARCH_TOOL_NAME]: 'Knowledge search',
11044
- };
11024
+ return this.appendToSystemMessage(nextRequirements, knowledgeInfoEntries.join('\n'), '\n\n');
11045
11025
  }
11046
11026
  }
11047
11027
  /**
@@ -11055,128 +11035,6 @@ function hasMeaningfulNonUrlText(content, urls) {
11055
11035
  const significantText = contentWithoutUrls.replace(/[\s.,!?;:'"`()[\]{}<>/-]+/g, '');
11056
11036
  return significantText.length > 0;
11057
11037
  }
11058
- /**
11059
- * Adds the shared `knowledge_search` tool definition and the consolidated system-message section.
11060
- *
11061
- * @param requirements - Requirements after one `KNOWLEDGE` commitment was applied.
11062
- * @returns Requirements with the knowledge search instructions and tool definition.
11063
- *
11064
- * @private internal utility of `KnowledgeCommitmentDefinition`
11065
- */
11066
- function addKnowledgeSearchToolAndSystemSection(requirements) {
11067
- const nextRequirements = addKnowledgeSearchTool(requirements);
11068
- const section = createKnowledgeSearchSystemSection(nextRequirements);
11069
- const sectionHeader = `## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE}`;
11070
- if (nextRequirements.systemMessage.includes(sectionHeader)) {
11071
- return {
11072
- ...nextRequirements,
11073
- systemMessage: nextRequirements.systemMessage.replace(new RegExp(`## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?(?=\\n\\n##|$)`), section),
11074
- };
11075
- }
11076
- return {
11077
- ...nextRequirements,
11078
- systemMessage: nextRequirements.systemMessage.trim()
11079
- ? `${nextRequirements.systemMessage}\n\n${section}`
11080
- : section,
11081
- };
11082
- }
11083
- /**
11084
- * Adds the `knowledge_search` model tool when it is not already present.
11085
- *
11086
- * @param requirements - Current model requirements.
11087
- * @returns Requirements with the tool definition available to the model.
11088
- *
11089
- * @private internal utility of `KnowledgeCommitmentDefinition`
11090
- */
11091
- function addKnowledgeSearchTool(requirements) {
11092
- const existingTools = requirements.tools || [];
11093
- if (existingTools.some((tool) => tool.name === KNOWLEDGE_SEARCH_TOOL_NAME)) {
11094
- return requirements;
11095
- }
11096
- return {
11097
- ...requirements,
11098
- tools: [
11099
- ...existingTools,
11100
- {
11101
- name: KNOWLEDGE_SEARCH_TOOL_NAME,
11102
- description: spaceTrim$1(`
11103
- Search the agent's configured knowledge sources and return relevant excerpts with citation ids.
11104
- Use this before answering questions that may depend on the agent's KNOWLEDGE commitments.
11105
- `),
11106
- parameters: {
11107
- type: 'object',
11108
- properties: {
11109
- query: {
11110
- type: 'string',
11111
- description: 'The natural-language search query for the knowledge base.',
11112
- },
11113
- limit: {
11114
- type: 'integer',
11115
- description: 'Maximum number of matching source excerpts to return.',
11116
- },
11117
- },
11118
- required: ['query'],
11119
- },
11120
- },
11121
- ],
11122
- };
11123
- }
11124
- /**
11125
- * Creates the model-facing system-message section for knowledge search.
11126
- *
11127
- * @param requirements - Current model requirements.
11128
- * @returns Markdown system-message section.
11129
- *
11130
- * @private internal utility of `KnowledgeCommitmentDefinition`
11131
- */
11132
- function createKnowledgeSearchSystemSection(requirements) {
11133
- const sourceEntries = createKnowledgeSourceSystemEntries(requirements);
11134
- const sourceList = sourceEntries.length > 0 ? sourceEntries.map((entry) => `- ${entry}`).join('\n') : '- None';
11135
- return spaceTrim$1(`
11136
- ## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE}
11137
-
11138
- - Use \`${KNOWLEDGE_SEARCH_TOOL_NAME}\` to search the configured knowledge sources before answering questions that depend on this agent's knowledge base.
11139
- - Base source-backed factual answers on the returned excerpts.
11140
- - When you use a returned excerpt, include its citation marker in the answer body, for example \`[0:0]\`.
11141
- - If the search returns no relevant information, say that the knowledge base did not contain the answer instead of inventing it.
11142
-
11143
- Configured knowledge sources:
11144
- ${sourceList}
11145
- `);
11146
- }
11147
- /**
11148
- * Builds a stable list of configured knowledge sources for system-message diagnostics.
11149
- *
11150
- * @param requirements - Current model requirements.
11151
- * @returns Human-readable source entries.
11152
- *
11153
- * @private internal utility of `KnowledgeCommitmentDefinition`
11154
- */
11155
- function createKnowledgeSourceSystemEntries(requirements) {
11156
- var _a;
11157
- const entries = [];
11158
- const seenEntries = new Set();
11159
- for (const source of requirements.knowledgeSources || []) {
11160
- const entry = `Source URL: ${source} (processed for retrieval during chat)`;
11161
- if (seenEntries.has(entry)) {
11162
- continue;
11163
- }
11164
- seenEntries.add(entry);
11165
- entries.push(entry);
11166
- }
11167
- const inlineSources = (((_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.inlineKnowledgeSources) || [])
11168
- .map((source) => source.filename)
11169
- .filter(Boolean);
11170
- for (const filename of inlineSources) {
11171
- const entry = `Knowledge Source Inline: ${filename} (Inline source: processed for retrieval during chat)`;
11172
- if (seenEntries.has(entry)) {
11173
- continue;
11174
- }
11175
- seenEntries.add(entry);
11176
- entries.push(entry);
11177
- }
11178
- return entries;
11179
- }
11180
11038
 
11181
11039
  /**
11182
11040
  * LANGUAGE commitment definition
@@ -13764,7 +13622,11 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
13764
13622
  // Create new system message with persona at the beginning
13765
13623
  // Format: "You are {agentName}\n{personaContent}"
13766
13624
  // The # PERSONA comment will be removed later by removeCommentsFromSystemMessage
13767
- const personaSection = `# PERSONA\nYou are ${agentName}\n${mergedPersonaContent}`; // <- TODO: Use spaceTrim
13625
+ const personaSection = spaceTrim$1((block) => `
13626
+ # PERSONA
13627
+ You are ${agentName}
13628
+ ${block(mergedPersonaContent)}
13629
+ `);
13768
13630
  const newSystemMessage = cleanedMessage ? `${personaSection}\n\n${cleanedMessage}` : personaSection;
13769
13631
  return {
13770
13632
  ...requirements,
@@ -38167,6 +38029,174 @@ function extractMcpServers(agentSource) {
38167
38029
  .filter(Boolean);
38168
38030
  }
38169
38031
 
38032
+ /**
38033
+ * End-to-end examples used by the standalone Book language documentation.
38034
+ *
38035
+ * These are intentionally compact but complete, so they can be copy-pasted and
38036
+ * used as practical starting points.
38037
+ *
38038
+ * @private internal utility of `createStandaloneBookLanguageMarkdown`
38039
+ */
38040
+ [
38041
+ {
38042
+ id: 'minimal-hello-world-agent',
38043
+ title: 'Minimal hello-world agent',
38044
+ goal: 'Create the smallest useful agent with identity and greeting.',
38045
+ source: spaceTrim$1(`
38046
+ Hello World Agent
38047
+
38048
+ GOAL Be a concise and friendly assistant.
38049
+ INITIAL MESSAGE Hello! I am ready to help.
38050
+ CLOSED
38051
+ `),
38052
+ walkthrough: [
38053
+ 'The first line (`Hello World Agent`) is the agent name.',
38054
+ '`GOAL` defines the effective role and profile text.',
38055
+ '`INITIAL MESSAGE` sets a deterministic first message for a new chat.',
38056
+ '`CLOSED` prevents conversational self-modification.',
38057
+ ],
38058
+ },
38059
+ {
38060
+ id: 'tool-using-browser-search-agent',
38061
+ title: 'Tool-using agent (Browser + Search engine)',
38062
+ goal: 'Enable internet research with clear sourcing behavior.',
38063
+ source: spaceTrim$1(`
38064
+ Web Research Assistant
38065
+
38066
+ GOAL Research topics using fresh and verifiable information.
38067
+ USE SEARCH ENGINE Prefer official sources and recent publications.
38068
+ USE BROWSER
38069
+ RULE Verify important claims across multiple sources when possible.
38070
+ RULE Include source links in your final answer.
38071
+ INITIAL MESSAGE Ask me what topic you want to research and how deep the report should be.
38072
+ `),
38073
+ walkthrough: [
38074
+ '`USE SEARCH ENGINE` provides web search tooling and optional search instructions.',
38075
+ '`USE BROWSER` enables URL fetching and interactive browsing tools.',
38076
+ '`RULE` commitments make reliability behavior explicit and repeatable.',
38077
+ 'This pattern is ideal for current-events and fact-checking agents.',
38078
+ ],
38079
+ },
38080
+ {
38081
+ id: 'rule-and-knowledge-agent',
38082
+ title: 'Agent with RULE and KNOWLEDGE',
38083
+ goal: 'Ground responses in explicit constraints and curated sources.',
38084
+ source: spaceTrim$1(`
38085
+ Support Policy Assistant
38086
+
38087
+ GOAL Answer questions about support policy.
38088
+ KNOWLEDGE Refunds are available within 30 days with proof of purchase.
38089
+ KNOWLEDGE https://example.com/support-policy
38090
+ RULE If a policy item is missing in available knowledge, say it explicitly.
38091
+ RULE Never invent legal or policy statements.
38092
+ INITIAL MESSAGE I can explain refund and support rules from provided knowledge.
38093
+ `),
38094
+ walkthrough: [
38095
+ '`KNOWLEDGE` may be inline text or an external URL/document.',
38096
+ '`RULE` commitments define non-negotiable behavior constraints.',
38097
+ 'Combining both creates predictable, grounded policy responses.',
38098
+ 'Use this pattern for compliance, support, and internal procedures.',
38099
+ ],
38100
+ },
38101
+ {
38102
+ id: 'memory-agent-with-long-term-memory',
38103
+ title: 'MEMORY agent with long-term memory',
38104
+ goal: 'Persist user preferences across conversations.',
38105
+ source: spaceTrim$1(`
38106
+ Customer Success Memory Agent
38107
+
38108
+ GOAL Support SaaS customers while remembering relevant setup and preference context.
38109
+ MEMORY Remember product setup, user goals, and communication preferences.
38110
+ RULE Store only user-approved preferences and project context.
38111
+ RULE Never store secrets or sensitive data unless explicitly requested and allowed.
38112
+ INITIAL MESSAGE I can remember your setup and preferences for future sessions.
38113
+ `),
38114
+ walkthrough: [
38115
+ '`MEMORY` adds runtime memory tools and memory-specific system guidance.',
38116
+ '`RULE` commitments narrow what should be remembered to reduce privacy risks.',
38117
+ 'In Agents Server, memory is runtime-backed and user-scoped.',
38118
+ 'Use this for assistants that must preserve context over time.',
38119
+ ],
38120
+ },
38121
+ {
38122
+ id: 'use-project-and-wallet-integration-agent',
38123
+ title: 'USE PROJECT and WALLET external integration',
38124
+ goal: 'Work with GitHub repositories and wallet-backed credentials.',
38125
+ source: spaceTrim$1(`
38126
+ Repository Maintainer
38127
+
38128
+ GOAL Maintain a GitHub repository and prepare safe pull requests.
38129
+ USE PROJECT https://github.com/acme/website
38130
+ WALLET Store credentials for repository operations.
38131
+ RULE Before editing files, explain the planned change and impacted paths.
38132
+ RULE Never reveal raw credentials in chat output.
38133
+ INITIAL MESSAGE I can inspect the repository and help you prepare PR-ready changes.
38134
+ `),
38135
+ walkthrough: [
38136
+ '`USE PROJECT` enables repository tools for listing, reading, editing files, and creating PRs.',
38137
+ 'Credentials are resolved from wallet records at runtime in Agents Server.',
38138
+ '`WALLET` is kept here as a compatibility marker, but current Book 2.0 parsing treats it as deprecated/ignored.',
38139
+ 'In current runtime behavior, wallet-backed integrations are driven by commitments such as `USE PROJECT` and `USE EMAIL`.',
38140
+ ],
38141
+ },
38142
+ {
38143
+ id: 'use-calendar-integration-agent',
38144
+ title: 'USE CALENDAR integration',
38145
+ goal: 'Coordinate meetings and schedules through a connected Google Calendar.',
38146
+ source: spaceTrim$1(`
38147
+ Calendar Assistant
38148
+
38149
+ GOAL Schedule meetings and keep the calendar conflict-free.
38150
+ USE CALENDAR https://calendar.google.com/calendar/u/0/r
38151
+ SCOPES https://www.googleapis.com/auth/calendar
38152
+ RULE Confirm destructive actions before deleting an event.
38153
+ INITIAL MESSAGE Tell me the meeting details and I will schedule it in your calendar.
38154
+ `),
38155
+ walkthrough: [
38156
+ '`USE CALENDAR` enables calendar tools for listing, reading, creating, updating, and deleting events.',
38157
+ 'The first calendar URL identifies which calendar integration should be used.',
38158
+ '`SCOPES` can explicitly request required Google Calendar OAuth permissions.',
38159
+ 'Credentials are resolved from wallet-backed Google Calendar OAuth records at runtime in Agents Server.',
38160
+ ],
38161
+ },
38162
+ {
38163
+ id: 'agents-team-example',
38164
+ title: 'Agents TEAM (with in-book teammates)',
38165
+ goal: 'Delegate sub-tasks to specialized teammates.',
38166
+ source: spaceTrim$1(`
38167
+ Team Manager
38168
+
38169
+ GOAL Coordinate specialists and deliver one consolidated answer.
38170
+ TEAM Ask {Legal Reviewer} for legal constraints and {Implementation Reviewer} for technical feasibility.
38171
+ RULE Always summarize teammate outputs into one action plan.
38172
+
38173
+ ---
38174
+
38175
+ Legal Reviewer
38176
+
38177
+ FROM VOID
38178
+ GOAL Review legal and compliance risk.
38179
+ RULE Flag legal/compliance risk and uncertainty clearly.
38180
+ CLOSED
38181
+
38182
+ ---
38183
+
38184
+ Implementation Reviewer
38185
+
38186
+ FROM VOID
38187
+ GOAL Review implementation effort and delivery risk.
38188
+ RULE Estimate complexity and identify blockers.
38189
+ CLOSED
38190
+ `),
38191
+ walkthrough: [
38192
+ 'The main agent delegates via `TEAM` commitment.',
38193
+ 'References in `{...}` are resolved against embedded agents inside the same book (split by `---`).',
38194
+ 'Each teammate can be isolated with `FROM VOID` for deterministic specialization.',
38195
+ 'This pattern works well for multi-role review and decision support.',
38196
+ ],
38197
+ },
38198
+ ];
38199
+
38170
38200
  /**
38171
38201
  * Gets all tool titles provided by all commitments
38172
38202
  *
@@ -38417,6 +38447,72 @@ const EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRA
38417
38447
  },
38418
38448
  });
38419
38449
 
38450
+ /**
38451
+ * Matcher is form of app that evaluates (spreadsheet) content against defined criteria or patterns,
38452
+ * determining if it matches or meets specific requirements. Used for classification,
38453
+ * validation, filtering, and quality assessment of inputs.
38454
+ *
38455
+ * @public exported from `@promptbook/core`
38456
+ */
38457
+ ({
38458
+ name: 'EXPERIMENTAL_MATCHER',
38459
+ description: spaceTrim$1(`
38460
+ An evaluation system that determines whether content meets specific criteria or patterns.
38461
+ Used for content validation, quality assessment, and intelligent filtering tasks. Currently in experimental phase.
38462
+ `),
38463
+ documentationUrl: `https://github.com/webgptorg/promptbook/discussions/177`,
38464
+ pipelineInterface: {
38465
+ inputParameters: [
38466
+ /* Input parameters for content to be matched and criteria to match against */
38467
+ {
38468
+ name: 'nonce',
38469
+ description: 'Just to prevent EXPERIMENTAL_MATCHER to be set as implicit formfactor',
38470
+ isInput: true,
38471
+ isOutput: false,
38472
+ },
38473
+ ],
38474
+ outputParameters: [
38475
+ /* Output parameters containing match results, confidence scores, and relevant metadata */
38476
+ ],
38477
+ },
38478
+ });
38479
+
38480
+ /**
38481
+ * Translator is form of app that transforms input text from one form to another,
38482
+ * such as language translation, style conversion, tone modification, or other text transformations.
38483
+ *
38484
+ * @public exported from `@promptbook/core`
38485
+ */
38486
+ ({
38487
+ name: 'TRANSLATOR',
38488
+ description: spaceTrim$1(`
38489
+ A text transformation system that converts input content into different forms,
38490
+ including language translations, paraphrasing, style conversions, and tone adjustments.
38491
+ This form factor takes one input and produces one transformed output.
38492
+ `),
38493
+ documentationUrl: `https://github.com/webgptorg/promptbook/discussions/175`,
38494
+ pipelineInterface: {
38495
+ inputParameters: [
38496
+ {
38497
+ name: 'inputMessage',
38498
+ description: `Input message to be translated`,
38499
+ isInput: true,
38500
+ isOutput: false,
38501
+ },
38502
+ ],
38503
+ outputParameters: [
38504
+ {
38505
+ name: 'outputMessage',
38506
+ description: `Translated output message`,
38507
+ isInput: false,
38508
+ isOutput: true,
38509
+ },
38510
+ ],
38511
+ // <- TODO: [🤓] Maybe add {summary}
38512
+ // <- TODO: [🧠] maybe change to {inputText}, {inputText} / or make system for any name of first input and first outpur parameter
38513
+ },
38514
+ });
38515
+
38420
38516
  /**
38421
38517
  * Register for LLM tools metadata.
38422
38518
  *
@@ -38594,11 +38690,11 @@ function formatChatAttachmentContext(attachments) {
38594
38690
  if (attachments.length === 0) {
38595
38691
  return '';
38596
38692
  }
38597
- return [
38598
- CHAT_ATTACHMENTS_HEADING,
38599
- ...attachments.map((attachment) => formatChatAttachmentLine(attachment)),
38600
- CHAT_ATTACHMENTS_INSTRUCTION,
38601
- ].join('\n');
38693
+ return spaceTrim$1((block) => `
38694
+ ${CHAT_ATTACHMENTS_HEADING}
38695
+ ${block(attachments.map((attachment) => formatChatAttachmentLine(attachment)).join('\n'))}
38696
+ ${CHAT_ATTACHMENTS_INSTRUCTION}
38697
+ `);
38602
38698
  }
38603
38699
 
38604
38700
  /**
@@ -38839,24 +38935,24 @@ function formatResolvedChatAttachmentContent(contentResolution) {
38839
38935
  : ''}`
38840
38936
  : null;
38841
38937
  const warningsLine = contentResolution.warnings.length > 0 ? `Warnings: ${contentResolution.warnings.join(' | ')}` : null;
38842
- if (!contentResolution.content) {
38938
+ const metadataLines = [decodingLine, warningsLine].filter((line) => Boolean(line)).join('\n');
38939
+ const resolvedContent = contentResolution.content;
38940
+ if (!resolvedContent) {
38843
38941
  const reason = contentResolution.reason || 'content unavailable';
38844
- return [`- ${attachmentLabel}: ${reason}. URL: ${contentResolution.attachment.url}`, decodingLine, warningsLine]
38845
- .filter(Boolean)
38846
- .join('\n');
38942
+ return spaceTrim$1((block) => `
38943
+ - ${attachmentLabel}: ${reason}. URL: ${contentResolution.attachment.url}
38944
+ ${block(metadataLines)}
38945
+ `);
38847
38946
  }
38848
38947
  const truncatedLabel = contentResolution.isTruncated ? ' [truncated]' : '';
38849
- return [
38850
- `File: ${attachmentLabel}${truncatedLabel}`,
38851
- `URL: ${contentResolution.attachment.url}`,
38852
- decodingLine,
38853
- warningsLine,
38854
- '```text',
38855
- contentResolution.content,
38856
- '```',
38857
- ]
38858
- .filter(Boolean)
38859
- .join('\n');
38948
+ return spaceTrim$1((block) => `
38949
+ File: ${attachmentLabel}${truncatedLabel}
38950
+ URL: ${contentResolution.attachment.url}
38951
+ ${block(metadataLines)}
38952
+ \`\`\`text
38953
+ ${block(resolvedContent)}
38954
+ \`\`\`
38955
+ `);
38860
38956
  }
38861
38957
  /**
38862
38958
  * Formats inline attachment-content context section for the model.
@@ -38870,11 +38966,14 @@ function formatChatAttachmentContentContext(resolvedContents) {
38870
38966
  if (resolvedContents.length === 0) {
38871
38967
  return '';
38872
38968
  }
38873
- return [
38874
- CHAT_ATTACHMENT_CONTENT_HEADING,
38875
- CHAT_ATTACHMENT_CONTENT_INSTRUCTION,
38876
- ...resolvedContents.map((resolvedContent) => formatResolvedChatAttachmentContent(resolvedContent)),
38877
- ].join('\n\n');
38969
+ return spaceTrim$1((block) => `
38970
+ ${CHAT_ATTACHMENT_CONTENT_HEADING}
38971
+ ${CHAT_ATTACHMENT_CONTENT_INSTRUCTION}
38972
+
38973
+ ${block(resolvedContents
38974
+ .map((resolvedContent) => formatResolvedChatAttachmentContent(resolvedContent))
38975
+ .join('\n\n'))}
38976
+ `);
38878
38977
  }
38879
38978
 
38880
38979
  /**
@@ -40019,9 +40118,11 @@ class OpenAiCompatibleUnsupportedParameterRetrier {
40019
40118
  * Creates the retry-history error message shared by all OpenAI-compatible model variants.
40020
40119
  */
40021
40120
  createAttemptHistoryError(finalErrorMessage) {
40022
- return new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
40023
- formatUnsupportedParameterAttemptHistory(this.attemptStack) +
40024
- `\nFinal error: ${finalErrorMessage}`);
40121
+ return new PipelineExecutionError(spaceTrim$1((block) => `
40122
+ All attempts failed. Attempt history:
40123
+ ${block(formatUnsupportedParameterAttemptHistory(this.attemptStack))}
40124
+ Final error: ${finalErrorMessage}
40125
+ `));
40025
40126
  }
40026
40127
  }
40027
40128
 
@@ -42615,7 +42716,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
42615
42716
  });
42616
42717
  }
42617
42718
  let vectorStoreId = cachedVectorStoreId;
42618
- if (this.isNativeKnowledgeSearchEnabled && !vectorStoreId && knowledgeSources && knowledgeSources.length > 0) {
42719
+ if (!vectorStoreId && knowledgeSources && knowledgeSources.length > 0) {
42619
42720
  const vectorStoreResult = await this.createVectorStoreWithKnowledgeSources({
42620
42721
  client: await this.getClient(),
42621
42722
  name,
@@ -42624,19 +42725,13 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
42624
42725
  });
42625
42726
  vectorStoreId = vectorStoreResult.vectorStoreId;
42626
42727
  }
42627
- else if (this.isNativeKnowledgeSearchEnabled && vectorStoreId && this.options.isVerbose) {
42728
+ else if (vectorStoreId && this.options.isVerbose) {
42628
42729
  console.info('[🤰]', 'Using cached vector store for AgentKit agent', {
42629
42730
  name,
42630
42731
  vectorStoreId,
42631
42732
  });
42632
42733
  }
42633
- if (!this.isNativeKnowledgeSearchEnabled) {
42634
- vectorStoreId = undefined;
42635
- }
42636
- const agentKitTools = this.buildAgentKitTools({
42637
- tools,
42638
- vectorStoreId,
42639
- });
42734
+ const agentKitTools = this.buildAgentKitTools({ tools, vectorStoreId });
42640
42735
  const openAiAgentKitAgent = new Agent$1({
42641
42736
  name,
42642
42737
  model: this.agentKitModelName,
@@ -42655,7 +42750,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
42655
42750
  name,
42656
42751
  model: this.agentKitModelName,
42657
42752
  toolCount: agentKitTools.length,
42658
- hasVectorStore: this.isNativeKnowledgeSearchEnabled && Boolean(vectorStoreId),
42753
+ hasVectorStore: Boolean(vectorStoreId),
42659
42754
  });
42660
42755
  }
42661
42756
  return preparedAgent;
@@ -43154,12 +43249,6 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
43154
43249
  get agentKitOptions() {
43155
43250
  return this.options;
43156
43251
  }
43157
- /**
43158
- * Returns true when hosted OpenAI vector-store search should back `knowledgeSources`.
43159
- */
43160
- get isNativeKnowledgeSearchEnabled() {
43161
- return this.agentKitOptions.isNativeKnowledgeSearchEnabled !== false;
43162
- }
43163
43252
  /**
43164
43253
  * Discriminant for type guards.
43165
43254
  */
@@ -48887,7 +48976,6 @@ const TOOL_TITLES = {
48887
48976
  request_wallet_record: { title: 'Requesting wallet', emoji: '👛' },
48888
48977
  web_search: { title: 'Searching the web', emoji: '🔎' },
48889
48978
  deep_search: { title: 'Deep research', emoji: '🔬' },
48890
- knowledge_search: { title: 'Searching knowledge', emoji: '📚' },
48891
48979
  useSearchEngine: { title: 'Searching the web', emoji: '🔎' },
48892
48980
  search: { title: 'Searching the web', emoji: '🔎' },
48893
48981
  useBrowser: { title: 'Browsing the web', emoji: '🌐' },
@@ -49763,13 +49851,6 @@ const ChatMessageItem = memo(
49763
49851
  content: sanitizedContentWithoutButtons,
49764
49852
  citations: message.citations,
49765
49853
  }), [message.citations, sanitizedContentWithoutButtons]);
49766
- const structuredSourceCitations = useMemo(() => {
49767
- const footnoteSourceKeys = new Set(citationFootnoteRenderModel.footnotes.map((footnote) => footnote.citation.source.trim().toLowerCase()));
49768
- return (message.sources || []).filter((source) => {
49769
- const sourceKey = source.source.trim().toLowerCase();
49770
- return sourceKey && !footnoteSourceKeys.has(sourceKey);
49771
- });
49772
- }, [citationFootnoteRenderModel.footnotes, message.sources]);
49773
49854
  const contentSegments = useMemo(() => splitMessageContentIntoSegments(citationFootnoteRenderModel.content), [citationFootnoteRenderModel.content]);
49774
49855
  const hasMapSegment = useMemo(() => contentSegments.some((segment) => segment.type === 'map'), [contentSegments]);
49775
49856
  const [localHoveredRating, setLocalHoveredRating] = useState(0);
@@ -50041,7 +50122,7 @@ const ChatMessageItem = memo(
50041
50122
  '--message-bg-color': isAgentArticleMode ? articleModeBackgroundColor : color.toHex(),
50042
50123
  '--message-text-color': isAgentArticleMode ? articleModeTextColor : colorOfText.toHex(),
50043
50124
  '--chat-message-swipe-offset': swipeTranslation,
50044
- }, onPointerDown: handleReplyPointerDown, onPointerMove: handleReplyPointerMove, onPointerUp: handleReplyPointerEnd, onPointerCancel: resetReplySwipe, children: [isReplyActionEnabled && (jsx("div", { className: classNames(styles$5.replySwipeIndicator, isMe && styles$5.replySwipeIndicatorRight, isReplySwipeArmed && styles$5.replySwipeIndicatorActive), "aria-hidden": "true", children: jsx(Reply, { className: styles$5.replySwipeIndicatorIcon }) })), !shouldRenderArticleActionsBar && renderMessageReadAndCopyControls(), message.isVoiceCall && (jsx("div", { className: styles$5.voiceCallIndicator, children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsx("path", { d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" }) }) })), replyingToMessage && replyPreviewText && replySenderLabel && (jsx(ChatReplyPreview, { label: replyPreviewLabel, senderLabel: replySenderLabel, previewText: replyPreviewText, className: styles$5.replyBubblePreview })), jsx("div", { ref: contentWithoutButtonsRef, children: jsx(ChatMessageRichContent, { content: message.content, contentSegments: contentSegments, streamingFeaturePlaceholderKind: streamingFeaturePlaceholderKind, onCreateAgent: onCreateAgent, mode: mode }) }), message.attachments && message.attachments.length > 0 && (jsx("div", { className: styles$5.attachments, children: message.attachments.map((attachment, index) => (jsxs("a", { href: attachment.url, target: "_blank", rel: "noopener noreferrer", className: styles$5.attachment, title: attachment.name, children: [jsx("span", { className: styles$5.attachmentIcon, children: "\uD83D\uDCCE" }), jsx("span", { className: styles$5.attachmentName, children: attachment.name })] }, index))) })), jsx(ChatMessageToolCallChips, { chips: toolCallChips, onToolCallClick: onToolCallClick }), citationFootnoteRenderModel.footnotes.length > 0 && (jsx("div", { className: styles$5.citationFootnotes, children: citationFootnoteRenderModel.footnotes.map((footnote) => (jsxs("div", { className: styles$5.citationFootnoteItem, children: [jsx("span", { className: styles$5.citationFootnoteNumber, children: footnote.number }), jsx(SourceChip, { citation: footnote.citation, onClick: onCitationClick, isCitationIdVisible: false })] }, `citation-footnote-${footnote.number}-${footnote.citation.source}`))) })), structuredSourceCitations.length > 0 && (jsx("div", { className: styles$5.sourceCitations, children: structuredSourceCitations.map((citation, index) => (jsx(SourceChip, { citation: citation, onClick: onCitationClick, isCitationIdVisible: false }, `message-source-${citation.source}-${citation.id}-${index}`))) })), transitiveCitations.length > 0 && (jsx("div", { className: styles$5.sourceCitations, children: transitiveCitations.map((citation, index) => (jsx(SourceChip, { citation: citation, suffix: `by ${citation.origin.label}`, onClick: onCitationClick }, `team-source-${citation.source}-${index}`))) })), shouldShowButtons && (jsx("div", { className: styles$5.messageButtons, children: renderableButtons.map(({ button, buttonIndex }) => (jsx("button", { type: "button", className: classNames(styles$5.messageButton, button.type === 'action' && styles$5.actionMessageButton), onClick: (event) => {
50125
+ }, onPointerDown: handleReplyPointerDown, onPointerMove: handleReplyPointerMove, onPointerUp: handleReplyPointerEnd, onPointerCancel: resetReplySwipe, children: [isReplyActionEnabled && (jsx("div", { className: classNames(styles$5.replySwipeIndicator, isMe && styles$5.replySwipeIndicatorRight, isReplySwipeArmed && styles$5.replySwipeIndicatorActive), "aria-hidden": "true", children: jsx(Reply, { className: styles$5.replySwipeIndicatorIcon }) })), !shouldRenderArticleActionsBar && renderMessageReadAndCopyControls(), message.isVoiceCall && (jsx("div", { className: styles$5.voiceCallIndicator, children: jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsx("path", { d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" }) }) })), replyingToMessage && replyPreviewText && replySenderLabel && (jsx(ChatReplyPreview, { label: replyPreviewLabel, senderLabel: replySenderLabel, previewText: replyPreviewText, className: styles$5.replyBubblePreview })), jsx("div", { ref: contentWithoutButtonsRef, children: jsx(ChatMessageRichContent, { content: message.content, contentSegments: contentSegments, streamingFeaturePlaceholderKind: streamingFeaturePlaceholderKind, onCreateAgent: onCreateAgent, mode: mode }) }), message.attachments && message.attachments.length > 0 && (jsx("div", { className: styles$5.attachments, children: message.attachments.map((attachment, index) => (jsxs("a", { href: attachment.url, target: "_blank", rel: "noopener noreferrer", className: styles$5.attachment, title: attachment.name, children: [jsx("span", { className: styles$5.attachmentIcon, children: "\uD83D\uDCCE" }), jsx("span", { className: styles$5.attachmentName, children: attachment.name })] }, index))) })), jsx(ChatMessageToolCallChips, { chips: toolCallChips, onToolCallClick: onToolCallClick }), citationFootnoteRenderModel.footnotes.length > 0 && (jsx("div", { className: styles$5.citationFootnotes, children: citationFootnoteRenderModel.footnotes.map((footnote) => (jsxs("div", { className: styles$5.citationFootnoteItem, children: [jsx("span", { className: styles$5.citationFootnoteNumber, children: footnote.number }), jsx(SourceChip, { citation: footnote.citation, onClick: onCitationClick, isCitationIdVisible: false })] }, `citation-footnote-${footnote.number}-${footnote.citation.source}`))) })), transitiveCitations.length > 0 && (jsx("div", { className: styles$5.sourceCitations, children: transitiveCitations.map((citation, index) => (jsx(SourceChip, { citation: citation, suffix: `by ${citation.origin.label}`, onClick: onCitationClick }, `team-source-${citation.source}-${index}`))) })), shouldShowButtons && (jsx("div", { className: styles$5.messageButtons, children: renderableButtons.map(({ button, buttonIndex }) => (jsx("button", { type: "button", className: classNames(styles$5.messageButton, button.type === 'action' && styles$5.actionMessageButton), onClick: (event) => {
50045
50126
  event.stopPropagation();
50046
50127
  if (button.type === 'message') {
50047
50128
  const quickMessageHandler = onQuickMessageButton || onMessage;
@@ -50093,9 +50174,6 @@ const ChatMessageItem = memo(
50093
50174
  if (prev.message.citations !== next.message.citations) {
50094
50175
  return false;
50095
50176
  }
50096
- if (prev.message.sources !== next.message.sources) {
50097
- return false;
50098
- }
50099
50177
  if (JSON.stringify(prev.message.attachments) !== JSON.stringify(next.message.attachments)) {
50100
50178
  return false;
50101
50179
  }
@@ -51510,7 +51588,7 @@ function renderSearchToolCallDetails(options) {
51510
51588
  const { results, rawText } = extractSearchResults(resultRaw);
51511
51589
  const hasResults = results.length > 0;
51512
51590
  const hasRawText = !hasResults && !!rawText && rawText.trim().length > 0;
51513
- return (jsxs(Fragment, { children: [jsxs("div", { className: styles$5.searchModalHeader, children: [jsx("span", { className: styles$5.searchModalIcon, children: "\uD83D\uDD0E" }), jsx("h3", { className: styles$5.searchModalQuery, children: args.query || args.searchText || 'Search Results' })] }), jsx("div", { className: styles$5.searchModalContent, children: hasResults ? (jsx("div", { className: styles$5.searchResultsList, children: results.map((item, index) => (jsxs("div", { className: styles$5.searchResultItem, children: [jsx("div", { className: styles$5.searchResultUrl, children: item.url && (jsx("a", { href: item.url, target: "_blank", rel: "noreferrer", children: item.url })) }), jsx("h4", { className: styles$5.searchResultTitle, children: item.url ? (jsx("a", { href: item.url, target: "_blank", rel: "noreferrer", children: item.title || item.source || 'Untitled' })) : (item.title || item.source || 'Untitled') }), jsx("p", { className: styles$5.searchResultSnippet, children: item.snippet || item.content || item.excerpt || '' })] }, index))) })) : hasRawText ? (jsx(MarkdownContent, { className: styles$5.searchResultsRaw, content: rawText })) : toolCallState !== 'COMPLETE' ? (jsxs(Fragment, { children: [renderToolCallProgressPlaceholder({
51591
+ return (jsxs(Fragment, { children: [jsxs("div", { className: styles$5.searchModalHeader, children: [jsx("span", { className: styles$5.searchModalIcon, children: "\uD83D\uDD0E" }), jsx("h3", { className: styles$5.searchModalQuery, children: args.query || args.searchText || 'Search Results' })] }), jsx("div", { className: styles$5.searchModalContent, children: hasResults ? (jsx("div", { className: styles$5.searchResultsList, children: results.map((item, index) => (jsxs("div", { className: styles$5.searchResultItem, children: [jsx("div", { className: styles$5.searchResultUrl, children: item.url && (jsx("a", { href: item.url, target: "_blank", rel: "noreferrer", children: item.url })) }), jsx("h4", { className: styles$5.searchResultTitle, children: item.url ? (jsx("a", { href: item.url, target: "_blank", rel: "noreferrer", children: item.title || 'Untitled' })) : (item.title || 'Untitled') }), jsx("p", { className: styles$5.searchResultSnippet, children: item.snippet || item.content || '' })] }, index))) })) : hasRawText ? (jsx(MarkdownContent, { className: styles$5.searchResultsRaw, content: rawText })) : toolCallState !== 'COMPLETE' ? (jsxs(Fragment, { children: [renderToolCallProgressPlaceholder({
51514
51592
  title: 'Search results pending',
51515
51593
  message: resolveToolCallProgressMessage(toolCall),
51516
51594
  }), jsxs("div", { className: styles$5.toolCallDetailsCard, children: [jsxs("div", { className: styles$5.toolCallDetailsCardRow, children: [jsx("strong", { children: "Query" }), jsx("span", { children: String(args.query || args.searchText || 'Search query is being prepared.') })] }), args.location && (jsxs("div", { className: styles$5.toolCallDetailsCardRow, children: [jsx("strong", { children: "Location" }), jsx("span", { children: String(args.location) })] })), args.engine && (jsxs("div", { className: styles$5.toolCallDetailsCardRow, children: [jsx("strong", { children: "Engine" }), jsx("span", { children: String(args.engine) })] }))] })] })) : (jsx("div", { className: styles$5.noResults, children: resultRaw ? 'No search results found.' : 'Search results are not available.' })) })] }));
@@ -52090,7 +52168,6 @@ function renderGenericToolCallDetails(options) {
52090
52168
  function isSearchToolCallName(toolName) {
52091
52169
  return (toolName === 'web_search' ||
52092
52170
  toolName === 'deep_search' ||
52093
- toolName === 'knowledge_search' ||
52094
52171
  toolName === 'useSearchEngine' ||
52095
52172
  toolName === 'search');
52096
52173
  }