@promptbook/components 0.112.0-63 → 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/umd/index.umd.js CHANGED
@@ -30,7 +30,7 @@
30
30
  * @generated
31
31
  * @see https://github.com/webgptorg/promptbook
32
32
  */
33
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-63';
33
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-65';
34
34
  /**
35
35
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
36
36
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -10888,18 +10888,6 @@
10888
10888
  }
10889
10889
  // Note: [💞] Ignore a discrepancy between file name and entity name
10890
10890
 
10891
- /**
10892
- * Name of the tool used by agents to search configured `KNOWLEDGE` sources.
10893
- *
10894
- * @public exported from `@promptbook/core`
10895
- */
10896
- const KNOWLEDGE_SEARCH_TOOL_NAME = 'knowledge_search';
10897
- /**
10898
- * Title of the system-message section generated for `KNOWLEDGE` commitments.
10899
- *
10900
- * @private constant of `KnowledgeCommitmentDefinition`
10901
- */
10902
- const KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE = 'Knowledge Search';
10903
10891
  /**
10904
10892
  * KNOWLEDGE commitment definition
10905
10893
  *
@@ -11021,17 +11009,9 @@
11021
11009
  knowledgeInfoEntries.push(`Knowledge Source Inline: ${inlineSource.filename} (derived from inline content and processed for retrieval during chat)`);
11022
11010
  }
11023
11011
  if (knowledgeInfoEntries.length === 0) {
11024
- return addKnowledgeSearchToolAndSystemSection(nextRequirements);
11012
+ return nextRequirements;
11025
11013
  }
11026
- return addKnowledgeSearchToolAndSystemSection(nextRequirements);
11027
- }
11028
- /**
11029
- * Gets human-readable titles for tool functions provided by this commitment.
11030
- */
11031
- getToolTitles() {
11032
- return {
11033
- [KNOWLEDGE_SEARCH_TOOL_NAME]: 'Knowledge search',
11034
- };
11014
+ return this.appendToSystemMessage(nextRequirements, knowledgeInfoEntries.join('\n'), '\n\n');
11035
11015
  }
11036
11016
  }
11037
11017
  /**
@@ -11045,128 +11025,6 @@
11045
11025
  const significantText = contentWithoutUrls.replace(/[\s.,!?;:'"`()[\]{}<>/-]+/g, '');
11046
11026
  return significantText.length > 0;
11047
11027
  }
11048
- /**
11049
- * Adds the shared `knowledge_search` tool definition and the consolidated system-message section.
11050
- *
11051
- * @param requirements - Requirements after one `KNOWLEDGE` commitment was applied.
11052
- * @returns Requirements with the knowledge search instructions and tool definition.
11053
- *
11054
- * @private internal utility of `KnowledgeCommitmentDefinition`
11055
- */
11056
- function addKnowledgeSearchToolAndSystemSection(requirements) {
11057
- const nextRequirements = addKnowledgeSearchTool(requirements);
11058
- const section = createKnowledgeSearchSystemSection(nextRequirements);
11059
- const sectionHeader = `## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE}`;
11060
- if (nextRequirements.systemMessage.includes(sectionHeader)) {
11061
- return {
11062
- ...nextRequirements,
11063
- systemMessage: nextRequirements.systemMessage.replace(new RegExp(`## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?(?=\\n\\n##|$)`), section),
11064
- };
11065
- }
11066
- return {
11067
- ...nextRequirements,
11068
- systemMessage: nextRequirements.systemMessage.trim()
11069
- ? `${nextRequirements.systemMessage}\n\n${section}`
11070
- : section,
11071
- };
11072
- }
11073
- /**
11074
- * Adds the `knowledge_search` model tool when it is not already present.
11075
- *
11076
- * @param requirements - Current model requirements.
11077
- * @returns Requirements with the tool definition available to the model.
11078
- *
11079
- * @private internal utility of `KnowledgeCommitmentDefinition`
11080
- */
11081
- function addKnowledgeSearchTool(requirements) {
11082
- const existingTools = requirements.tools || [];
11083
- if (existingTools.some((tool) => tool.name === KNOWLEDGE_SEARCH_TOOL_NAME)) {
11084
- return requirements;
11085
- }
11086
- return {
11087
- ...requirements,
11088
- tools: [
11089
- ...existingTools,
11090
- {
11091
- name: KNOWLEDGE_SEARCH_TOOL_NAME,
11092
- description: spacetrim.spaceTrim(`
11093
- Search the agent's configured knowledge sources and return relevant excerpts with citation ids.
11094
- Use this before answering questions that may depend on the agent's KNOWLEDGE commitments.
11095
- `),
11096
- parameters: {
11097
- type: 'object',
11098
- properties: {
11099
- query: {
11100
- type: 'string',
11101
- description: 'The natural-language search query for the knowledge base.',
11102
- },
11103
- limit: {
11104
- type: 'integer',
11105
- description: 'Maximum number of matching source excerpts to return.',
11106
- },
11107
- },
11108
- required: ['query'],
11109
- },
11110
- },
11111
- ],
11112
- };
11113
- }
11114
- /**
11115
- * Creates the model-facing system-message section for knowledge search.
11116
- *
11117
- * @param requirements - Current model requirements.
11118
- * @returns Markdown system-message section.
11119
- *
11120
- * @private internal utility of `KnowledgeCommitmentDefinition`
11121
- */
11122
- function createKnowledgeSearchSystemSection(requirements) {
11123
- const sourceEntries = createKnowledgeSourceSystemEntries(requirements);
11124
- const sourceList = sourceEntries.length > 0 ? sourceEntries.map((entry) => `- ${entry}`).join('\n') : '- None';
11125
- return spacetrim.spaceTrim(`
11126
- ## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE}
11127
-
11128
- - Use \`${KNOWLEDGE_SEARCH_TOOL_NAME}\` to search the configured knowledge sources before answering questions that depend on this agent's knowledge base.
11129
- - Base source-backed factual answers on the returned excerpts.
11130
- - When you use a returned excerpt, include its citation marker in the answer body, for example \`[0:0]\`.
11131
- - If the search returns no relevant information, say that the knowledge base did not contain the answer instead of inventing it.
11132
-
11133
- Configured knowledge sources:
11134
- ${sourceList}
11135
- `);
11136
- }
11137
- /**
11138
- * Builds a stable list of configured knowledge sources for system-message diagnostics.
11139
- *
11140
- * @param requirements - Current model requirements.
11141
- * @returns Human-readable source entries.
11142
- *
11143
- * @private internal utility of `KnowledgeCommitmentDefinition`
11144
- */
11145
- function createKnowledgeSourceSystemEntries(requirements) {
11146
- var _a;
11147
- const entries = [];
11148
- const seenEntries = new Set();
11149
- for (const source of requirements.knowledgeSources || []) {
11150
- const entry = `Source URL: ${source} (processed for retrieval during chat)`;
11151
- if (seenEntries.has(entry)) {
11152
- continue;
11153
- }
11154
- seenEntries.add(entry);
11155
- entries.push(entry);
11156
- }
11157
- const inlineSources = (((_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.inlineKnowledgeSources) || [])
11158
- .map((source) => source.filename)
11159
- .filter(Boolean);
11160
- for (const filename of inlineSources) {
11161
- const entry = `Knowledge Source Inline: ${filename} (Inline source: processed for retrieval during chat)`;
11162
- if (seenEntries.has(entry)) {
11163
- continue;
11164
- }
11165
- seenEntries.add(entry);
11166
- entries.push(entry);
11167
- }
11168
- return entries;
11169
- }
11170
11028
 
11171
11029
  /**
11172
11030
  * LANGUAGE commitment definition
@@ -13754,7 +13612,11 @@
13754
13612
  // Create new system message with persona at the beginning
13755
13613
  // Format: "You are {agentName}\n{personaContent}"
13756
13614
  // The # PERSONA comment will be removed later by removeCommentsFromSystemMessage
13757
- const personaSection = `# PERSONA\nYou are ${agentName}\n${mergedPersonaContent}`; // <- TODO: Use spaceTrim
13615
+ const personaSection = spacetrim.spaceTrim((block) => `
13616
+ # PERSONA
13617
+ You are ${agentName}
13618
+ ${block(mergedPersonaContent)}
13619
+ `);
13758
13620
  const newSystemMessage = cleanedMessage ? `${personaSection}\n\n${cleanedMessage}` : personaSection;
13759
13621
  return {
13760
13622
  ...requirements,
@@ -38157,6 +38019,174 @@
38157
38019
  .filter(Boolean);
38158
38020
  }
38159
38021
 
38022
+ /**
38023
+ * End-to-end examples used by the standalone Book language documentation.
38024
+ *
38025
+ * These are intentionally compact but complete, so they can be copy-pasted and
38026
+ * used as practical starting points.
38027
+ *
38028
+ * @private internal utility of `createStandaloneBookLanguageMarkdown`
38029
+ */
38030
+ [
38031
+ {
38032
+ id: 'minimal-hello-world-agent',
38033
+ title: 'Minimal hello-world agent',
38034
+ goal: 'Create the smallest useful agent with identity and greeting.',
38035
+ source: spacetrim.spaceTrim(`
38036
+ Hello World Agent
38037
+
38038
+ GOAL Be a concise and friendly assistant.
38039
+ INITIAL MESSAGE Hello! I am ready to help.
38040
+ CLOSED
38041
+ `),
38042
+ walkthrough: [
38043
+ 'The first line (`Hello World Agent`) is the agent name.',
38044
+ '`GOAL` defines the effective role and profile text.',
38045
+ '`INITIAL MESSAGE` sets a deterministic first message for a new chat.',
38046
+ '`CLOSED` prevents conversational self-modification.',
38047
+ ],
38048
+ },
38049
+ {
38050
+ id: 'tool-using-browser-search-agent',
38051
+ title: 'Tool-using agent (Browser + Search engine)',
38052
+ goal: 'Enable internet research with clear sourcing behavior.',
38053
+ source: spacetrim.spaceTrim(`
38054
+ Web Research Assistant
38055
+
38056
+ GOAL Research topics using fresh and verifiable information.
38057
+ USE SEARCH ENGINE Prefer official sources and recent publications.
38058
+ USE BROWSER
38059
+ RULE Verify important claims across multiple sources when possible.
38060
+ RULE Include source links in your final answer.
38061
+ INITIAL MESSAGE Ask me what topic you want to research and how deep the report should be.
38062
+ `),
38063
+ walkthrough: [
38064
+ '`USE SEARCH ENGINE` provides web search tooling and optional search instructions.',
38065
+ '`USE BROWSER` enables URL fetching and interactive browsing tools.',
38066
+ '`RULE` commitments make reliability behavior explicit and repeatable.',
38067
+ 'This pattern is ideal for current-events and fact-checking agents.',
38068
+ ],
38069
+ },
38070
+ {
38071
+ id: 'rule-and-knowledge-agent',
38072
+ title: 'Agent with RULE and KNOWLEDGE',
38073
+ goal: 'Ground responses in explicit constraints and curated sources.',
38074
+ source: spacetrim.spaceTrim(`
38075
+ Support Policy Assistant
38076
+
38077
+ GOAL Answer questions about support policy.
38078
+ KNOWLEDGE Refunds are available within 30 days with proof of purchase.
38079
+ KNOWLEDGE https://example.com/support-policy
38080
+ RULE If a policy item is missing in available knowledge, say it explicitly.
38081
+ RULE Never invent legal or policy statements.
38082
+ INITIAL MESSAGE I can explain refund and support rules from provided knowledge.
38083
+ `),
38084
+ walkthrough: [
38085
+ '`KNOWLEDGE` may be inline text or an external URL/document.',
38086
+ '`RULE` commitments define non-negotiable behavior constraints.',
38087
+ 'Combining both creates predictable, grounded policy responses.',
38088
+ 'Use this pattern for compliance, support, and internal procedures.',
38089
+ ],
38090
+ },
38091
+ {
38092
+ id: 'memory-agent-with-long-term-memory',
38093
+ title: 'MEMORY agent with long-term memory',
38094
+ goal: 'Persist user preferences across conversations.',
38095
+ source: spacetrim.spaceTrim(`
38096
+ Customer Success Memory Agent
38097
+
38098
+ GOAL Support SaaS customers while remembering relevant setup and preference context.
38099
+ MEMORY Remember product setup, user goals, and communication preferences.
38100
+ RULE Store only user-approved preferences and project context.
38101
+ RULE Never store secrets or sensitive data unless explicitly requested and allowed.
38102
+ INITIAL MESSAGE I can remember your setup and preferences for future sessions.
38103
+ `),
38104
+ walkthrough: [
38105
+ '`MEMORY` adds runtime memory tools and memory-specific system guidance.',
38106
+ '`RULE` commitments narrow what should be remembered to reduce privacy risks.',
38107
+ 'In Agents Server, memory is runtime-backed and user-scoped.',
38108
+ 'Use this for assistants that must preserve context over time.',
38109
+ ],
38110
+ },
38111
+ {
38112
+ id: 'use-project-and-wallet-integration-agent',
38113
+ title: 'USE PROJECT and WALLET external integration',
38114
+ goal: 'Work with GitHub repositories and wallet-backed credentials.',
38115
+ source: spacetrim.spaceTrim(`
38116
+ Repository Maintainer
38117
+
38118
+ GOAL Maintain a GitHub repository and prepare safe pull requests.
38119
+ USE PROJECT https://github.com/acme/website
38120
+ WALLET Store credentials for repository operations.
38121
+ RULE Before editing files, explain the planned change and impacted paths.
38122
+ RULE Never reveal raw credentials in chat output.
38123
+ INITIAL MESSAGE I can inspect the repository and help you prepare PR-ready changes.
38124
+ `),
38125
+ walkthrough: [
38126
+ '`USE PROJECT` enables repository tools for listing, reading, editing files, and creating PRs.',
38127
+ 'Credentials are resolved from wallet records at runtime in Agents Server.',
38128
+ '`WALLET` is kept here as a compatibility marker, but current Book 2.0 parsing treats it as deprecated/ignored.',
38129
+ 'In current runtime behavior, wallet-backed integrations are driven by commitments such as `USE PROJECT` and `USE EMAIL`.',
38130
+ ],
38131
+ },
38132
+ {
38133
+ id: 'use-calendar-integration-agent',
38134
+ title: 'USE CALENDAR integration',
38135
+ goal: 'Coordinate meetings and schedules through a connected Google Calendar.',
38136
+ source: spacetrim.spaceTrim(`
38137
+ Calendar Assistant
38138
+
38139
+ GOAL Schedule meetings and keep the calendar conflict-free.
38140
+ USE CALENDAR https://calendar.google.com/calendar/u/0/r
38141
+ SCOPES https://www.googleapis.com/auth/calendar
38142
+ RULE Confirm destructive actions before deleting an event.
38143
+ INITIAL MESSAGE Tell me the meeting details and I will schedule it in your calendar.
38144
+ `),
38145
+ walkthrough: [
38146
+ '`USE CALENDAR` enables calendar tools for listing, reading, creating, updating, and deleting events.',
38147
+ 'The first calendar URL identifies which calendar integration should be used.',
38148
+ '`SCOPES` can explicitly request required Google Calendar OAuth permissions.',
38149
+ 'Credentials are resolved from wallet-backed Google Calendar OAuth records at runtime in Agents Server.',
38150
+ ],
38151
+ },
38152
+ {
38153
+ id: 'agents-team-example',
38154
+ title: 'Agents TEAM (with in-book teammates)',
38155
+ goal: 'Delegate sub-tasks to specialized teammates.',
38156
+ source: spacetrim.spaceTrim(`
38157
+ Team Manager
38158
+
38159
+ GOAL Coordinate specialists and deliver one consolidated answer.
38160
+ TEAM Ask {Legal Reviewer} for legal constraints and {Implementation Reviewer} for technical feasibility.
38161
+ RULE Always summarize teammate outputs into one action plan.
38162
+
38163
+ ---
38164
+
38165
+ Legal Reviewer
38166
+
38167
+ FROM VOID
38168
+ GOAL Review legal and compliance risk.
38169
+ RULE Flag legal/compliance risk and uncertainty clearly.
38170
+ CLOSED
38171
+
38172
+ ---
38173
+
38174
+ Implementation Reviewer
38175
+
38176
+ FROM VOID
38177
+ GOAL Review implementation effort and delivery risk.
38178
+ RULE Estimate complexity and identify blockers.
38179
+ CLOSED
38180
+ `),
38181
+ walkthrough: [
38182
+ 'The main agent delegates via `TEAM` commitment.',
38183
+ 'References in `{...}` are resolved against embedded agents inside the same book (split by `---`).',
38184
+ 'Each teammate can be isolated with `FROM VOID` for deterministic specialization.',
38185
+ 'This pattern works well for multi-role review and decision support.',
38186
+ ],
38187
+ },
38188
+ ];
38189
+
38160
38190
  /**
38161
38191
  * Gets all tool titles provided by all commitments
38162
38192
  *
@@ -38407,6 +38437,72 @@
38407
38437
  },
38408
38438
  });
38409
38439
 
38440
+ /**
38441
+ * Matcher is form of app that evaluates (spreadsheet) content against defined criteria or patterns,
38442
+ * determining if it matches or meets specific requirements. Used for classification,
38443
+ * validation, filtering, and quality assessment of inputs.
38444
+ *
38445
+ * @public exported from `@promptbook/core`
38446
+ */
38447
+ ({
38448
+ name: 'EXPERIMENTAL_MATCHER',
38449
+ description: spacetrim.spaceTrim(`
38450
+ An evaluation system that determines whether content meets specific criteria or patterns.
38451
+ Used for content validation, quality assessment, and intelligent filtering tasks. Currently in experimental phase.
38452
+ `),
38453
+ documentationUrl: `https://github.com/webgptorg/promptbook/discussions/177`,
38454
+ pipelineInterface: {
38455
+ inputParameters: [
38456
+ /* Input parameters for content to be matched and criteria to match against */
38457
+ {
38458
+ name: 'nonce',
38459
+ description: 'Just to prevent EXPERIMENTAL_MATCHER to be set as implicit formfactor',
38460
+ isInput: true,
38461
+ isOutput: false,
38462
+ },
38463
+ ],
38464
+ outputParameters: [
38465
+ /* Output parameters containing match results, confidence scores, and relevant metadata */
38466
+ ],
38467
+ },
38468
+ });
38469
+
38470
+ /**
38471
+ * Translator is form of app that transforms input text from one form to another,
38472
+ * such as language translation, style conversion, tone modification, or other text transformations.
38473
+ *
38474
+ * @public exported from `@promptbook/core`
38475
+ */
38476
+ ({
38477
+ name: 'TRANSLATOR',
38478
+ description: spacetrim.spaceTrim(`
38479
+ A text transformation system that converts input content into different forms,
38480
+ including language translations, paraphrasing, style conversions, and tone adjustments.
38481
+ This form factor takes one input and produces one transformed output.
38482
+ `),
38483
+ documentationUrl: `https://github.com/webgptorg/promptbook/discussions/175`,
38484
+ pipelineInterface: {
38485
+ inputParameters: [
38486
+ {
38487
+ name: 'inputMessage',
38488
+ description: `Input message to be translated`,
38489
+ isInput: true,
38490
+ isOutput: false,
38491
+ },
38492
+ ],
38493
+ outputParameters: [
38494
+ {
38495
+ name: 'outputMessage',
38496
+ description: `Translated output message`,
38497
+ isInput: false,
38498
+ isOutput: true,
38499
+ },
38500
+ ],
38501
+ // <- TODO: [🤓] Maybe add {summary}
38502
+ // <- TODO: [🧠] maybe change to {inputText}, {inputText} / or make system for any name of first input and first outpur parameter
38503
+ },
38504
+ });
38505
+
38410
38506
  /**
38411
38507
  * Register for LLM tools metadata.
38412
38508
  *
@@ -38584,11 +38680,11 @@
38584
38680
  if (attachments.length === 0) {
38585
38681
  return '';
38586
38682
  }
38587
- return [
38588
- CHAT_ATTACHMENTS_HEADING,
38589
- ...attachments.map((attachment) => formatChatAttachmentLine(attachment)),
38590
- CHAT_ATTACHMENTS_INSTRUCTION,
38591
- ].join('\n');
38683
+ return spacetrim.spaceTrim((block) => `
38684
+ ${CHAT_ATTACHMENTS_HEADING}
38685
+ ${block(attachments.map((attachment) => formatChatAttachmentLine(attachment)).join('\n'))}
38686
+ ${CHAT_ATTACHMENTS_INSTRUCTION}
38687
+ `);
38592
38688
  }
38593
38689
 
38594
38690
  /**
@@ -38829,24 +38925,24 @@
38829
38925
  : ''}`
38830
38926
  : null;
38831
38927
  const warningsLine = contentResolution.warnings.length > 0 ? `Warnings: ${contentResolution.warnings.join(' | ')}` : null;
38832
- if (!contentResolution.content) {
38928
+ const metadataLines = [decodingLine, warningsLine].filter((line) => Boolean(line)).join('\n');
38929
+ const resolvedContent = contentResolution.content;
38930
+ if (!resolvedContent) {
38833
38931
  const reason = contentResolution.reason || 'content unavailable';
38834
- return [`- ${attachmentLabel}: ${reason}. URL: ${contentResolution.attachment.url}`, decodingLine, warningsLine]
38835
- .filter(Boolean)
38836
- .join('\n');
38932
+ return spacetrim.spaceTrim((block) => `
38933
+ - ${attachmentLabel}: ${reason}. URL: ${contentResolution.attachment.url}
38934
+ ${block(metadataLines)}
38935
+ `);
38837
38936
  }
38838
38937
  const truncatedLabel = contentResolution.isTruncated ? ' [truncated]' : '';
38839
- return [
38840
- `File: ${attachmentLabel}${truncatedLabel}`,
38841
- `URL: ${contentResolution.attachment.url}`,
38842
- decodingLine,
38843
- warningsLine,
38844
- '```text',
38845
- contentResolution.content,
38846
- '```',
38847
- ]
38848
- .filter(Boolean)
38849
- .join('\n');
38938
+ return spacetrim.spaceTrim((block) => `
38939
+ File: ${attachmentLabel}${truncatedLabel}
38940
+ URL: ${contentResolution.attachment.url}
38941
+ ${block(metadataLines)}
38942
+ \`\`\`text
38943
+ ${block(resolvedContent)}
38944
+ \`\`\`
38945
+ `);
38850
38946
  }
38851
38947
  /**
38852
38948
  * Formats inline attachment-content context section for the model.
@@ -38860,11 +38956,14 @@
38860
38956
  if (resolvedContents.length === 0) {
38861
38957
  return '';
38862
38958
  }
38863
- return [
38864
- CHAT_ATTACHMENT_CONTENT_HEADING,
38865
- CHAT_ATTACHMENT_CONTENT_INSTRUCTION,
38866
- ...resolvedContents.map((resolvedContent) => formatResolvedChatAttachmentContent(resolvedContent)),
38867
- ].join('\n\n');
38959
+ return spacetrim.spaceTrim((block) => `
38960
+ ${CHAT_ATTACHMENT_CONTENT_HEADING}
38961
+ ${CHAT_ATTACHMENT_CONTENT_INSTRUCTION}
38962
+
38963
+ ${block(resolvedContents
38964
+ .map((resolvedContent) => formatResolvedChatAttachmentContent(resolvedContent))
38965
+ .join('\n\n'))}
38966
+ `);
38868
38967
  }
38869
38968
 
38870
38969
  /**
@@ -40009,9 +40108,11 @@
40009
40108
  * Creates the retry-history error message shared by all OpenAI-compatible model variants.
40010
40109
  */
40011
40110
  createAttemptHistoryError(finalErrorMessage) {
40012
- return new PipelineExecutionError(`All attempts failed. Attempt history:\n` +
40013
- formatUnsupportedParameterAttemptHistory(this.attemptStack) +
40014
- `\nFinal error: ${finalErrorMessage}`);
40111
+ return new PipelineExecutionError(spacetrim.spaceTrim((block) => `
40112
+ All attempts failed. Attempt history:
40113
+ ${block(formatUnsupportedParameterAttemptHistory(this.attemptStack))}
40114
+ Final error: ${finalErrorMessage}
40115
+ `));
40015
40116
  }
40016
40117
  }
40017
40118
 
@@ -42605,7 +42706,7 @@
42605
42706
  });
42606
42707
  }
42607
42708
  let vectorStoreId = cachedVectorStoreId;
42608
- if (this.isNativeKnowledgeSearchEnabled && !vectorStoreId && knowledgeSources && knowledgeSources.length > 0) {
42709
+ if (!vectorStoreId && knowledgeSources && knowledgeSources.length > 0) {
42609
42710
  const vectorStoreResult = await this.createVectorStoreWithKnowledgeSources({
42610
42711
  client: await this.getClient(),
42611
42712
  name,
@@ -42614,19 +42715,13 @@
42614
42715
  });
42615
42716
  vectorStoreId = vectorStoreResult.vectorStoreId;
42616
42717
  }
42617
- else if (this.isNativeKnowledgeSearchEnabled && vectorStoreId && this.options.isVerbose) {
42718
+ else if (vectorStoreId && this.options.isVerbose) {
42618
42719
  console.info('[🤰]', 'Using cached vector store for AgentKit agent', {
42619
42720
  name,
42620
42721
  vectorStoreId,
42621
42722
  });
42622
42723
  }
42623
- if (!this.isNativeKnowledgeSearchEnabled) {
42624
- vectorStoreId = undefined;
42625
- }
42626
- const agentKitTools = this.buildAgentKitTools({
42627
- tools,
42628
- vectorStoreId,
42629
- });
42724
+ const agentKitTools = this.buildAgentKitTools({ tools, vectorStoreId });
42630
42725
  const openAiAgentKitAgent = new agents.Agent({
42631
42726
  name,
42632
42727
  model: this.agentKitModelName,
@@ -42645,7 +42740,7 @@
42645
42740
  name,
42646
42741
  model: this.agentKitModelName,
42647
42742
  toolCount: agentKitTools.length,
42648
- hasVectorStore: this.isNativeKnowledgeSearchEnabled && Boolean(vectorStoreId),
42743
+ hasVectorStore: Boolean(vectorStoreId),
42649
42744
  });
42650
42745
  }
42651
42746
  return preparedAgent;
@@ -43144,12 +43239,6 @@
43144
43239
  get agentKitOptions() {
43145
43240
  return this.options;
43146
43241
  }
43147
- /**
43148
- * Returns true when hosted OpenAI vector-store search should back `knowledgeSources`.
43149
- */
43150
- get isNativeKnowledgeSearchEnabled() {
43151
- return this.agentKitOptions.isNativeKnowledgeSearchEnabled !== false;
43152
- }
43153
43242
  /**
43154
43243
  * Discriminant for type guards.
43155
43244
  */
@@ -48877,7 +48966,6 @@
48877
48966
  request_wallet_record: { title: 'Requesting wallet', emoji: '👛' },
48878
48967
  web_search: { title: 'Searching the web', emoji: '🔎' },
48879
48968
  deep_search: { title: 'Deep research', emoji: '🔬' },
48880
- knowledge_search: { title: 'Searching knowledge', emoji: '📚' },
48881
48969
  useSearchEngine: { title: 'Searching the web', emoji: '🔎' },
48882
48970
  search: { title: 'Searching the web', emoji: '🔎' },
48883
48971
  useBrowser: { title: 'Browsing the web', emoji: '🌐' },
@@ -49753,13 +49841,6 @@
49753
49841
  content: sanitizedContentWithoutButtons,
49754
49842
  citations: message.citations,
49755
49843
  }), [message.citations, sanitizedContentWithoutButtons]);
49756
- const structuredSourceCitations = react.useMemo(() => {
49757
- const footnoteSourceKeys = new Set(citationFootnoteRenderModel.footnotes.map((footnote) => footnote.citation.source.trim().toLowerCase()));
49758
- return (message.sources || []).filter((source) => {
49759
- const sourceKey = source.source.trim().toLowerCase();
49760
- return sourceKey && !footnoteSourceKeys.has(sourceKey);
49761
- });
49762
- }, [citationFootnoteRenderModel.footnotes, message.sources]);
49763
49844
  const contentSegments = react.useMemo(() => splitMessageContentIntoSegments(citationFootnoteRenderModel.content), [citationFootnoteRenderModel.content]);
49764
49845
  const hasMapSegment = react.useMemo(() => contentSegments.some((segment) => segment.type === 'map'), [contentSegments]);
49765
49846
  const [localHoveredRating, setLocalHoveredRating] = react.useState(0);
@@ -50031,7 +50112,7 @@
50031
50112
  '--message-bg-color': isAgentArticleMode ? articleModeBackgroundColor : color.toHex(),
50032
50113
  '--message-text-color': isAgentArticleMode ? articleModeTextColor : colorOfText.toHex(),
50033
50114
  '--chat-message-swipe-offset': swipeTranslation,
50034
- }, onPointerDown: handleReplyPointerDown, onPointerMove: handleReplyPointerMove, onPointerUp: handleReplyPointerEnd, onPointerCancel: resetReplySwipe, children: [isReplyActionEnabled && (jsxRuntime.jsx("div", { className: classNames(styles$5.replySwipeIndicator, isMe && styles$5.replySwipeIndicatorRight, isReplySwipeArmed && styles$5.replySwipeIndicatorActive), "aria-hidden": "true", children: jsxRuntime.jsx(lucideReact.Reply, { className: styles$5.replySwipeIndicatorIcon }) })), !shouldRenderArticleActionsBar && renderMessageReadAndCopyControls(), message.isVoiceCall && (jsxRuntime.jsx("div", { className: styles$5.voiceCallIndicator, children: jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsxRuntime.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 && (jsxRuntime.jsx(ChatReplyPreview, { label: replyPreviewLabel, senderLabel: replySenderLabel, previewText: replyPreviewText, className: styles$5.replyBubblePreview })), jsxRuntime.jsx("div", { ref: contentWithoutButtonsRef, children: jsxRuntime.jsx(ChatMessageRichContent, { content: message.content, contentSegments: contentSegments, streamingFeaturePlaceholderKind: streamingFeaturePlaceholderKind, onCreateAgent: onCreateAgent, mode: mode }) }), message.attachments && message.attachments.length > 0 && (jsxRuntime.jsx("div", { className: styles$5.attachments, children: message.attachments.map((attachment, index) => (jsxRuntime.jsxs("a", { href: attachment.url, target: "_blank", rel: "noopener noreferrer", className: styles$5.attachment, title: attachment.name, children: [jsxRuntime.jsx("span", { className: styles$5.attachmentIcon, children: "\uD83D\uDCCE" }), jsxRuntime.jsx("span", { className: styles$5.attachmentName, children: attachment.name })] }, index))) })), jsxRuntime.jsx(ChatMessageToolCallChips, { chips: toolCallChips, onToolCallClick: onToolCallClick }), citationFootnoteRenderModel.footnotes.length > 0 && (jsxRuntime.jsx("div", { className: styles$5.citationFootnotes, children: citationFootnoteRenderModel.footnotes.map((footnote) => (jsxRuntime.jsxs("div", { className: styles$5.citationFootnoteItem, children: [jsxRuntime.jsx("span", { className: styles$5.citationFootnoteNumber, children: footnote.number }), jsxRuntime.jsx(SourceChip, { citation: footnote.citation, onClick: onCitationClick, isCitationIdVisible: false })] }, `citation-footnote-${footnote.number}-${footnote.citation.source}`))) })), structuredSourceCitations.length > 0 && (jsxRuntime.jsx("div", { className: styles$5.sourceCitations, children: structuredSourceCitations.map((citation, index) => (jsxRuntime.jsx(SourceChip, { citation: citation, onClick: onCitationClick, isCitationIdVisible: false }, `message-source-${citation.source}-${citation.id}-${index}`))) })), transitiveCitations.length > 0 && (jsxRuntime.jsx("div", { className: styles$5.sourceCitations, children: transitiveCitations.map((citation, index) => (jsxRuntime.jsx(SourceChip, { citation: citation, suffix: `by ${citation.origin.label}`, onClick: onCitationClick }, `team-source-${citation.source}-${index}`))) })), shouldShowButtons && (jsxRuntime.jsx("div", { className: styles$5.messageButtons, children: renderableButtons.map(({ button, buttonIndex }) => (jsxRuntime.jsx("button", { type: "button", className: classNames(styles$5.messageButton, button.type === 'action' && styles$5.actionMessageButton), onClick: (event) => {
50115
+ }, onPointerDown: handleReplyPointerDown, onPointerMove: handleReplyPointerMove, onPointerUp: handleReplyPointerEnd, onPointerCancel: resetReplySwipe, children: [isReplyActionEnabled && (jsxRuntime.jsx("div", { className: classNames(styles$5.replySwipeIndicator, isMe && styles$5.replySwipeIndicatorRight, isReplySwipeArmed && styles$5.replySwipeIndicatorActive), "aria-hidden": "true", children: jsxRuntime.jsx(lucideReact.Reply, { className: styles$5.replySwipeIndicatorIcon }) })), !shouldRenderArticleActionsBar && renderMessageReadAndCopyControls(), message.isVoiceCall && (jsxRuntime.jsx("div", { className: styles$5.voiceCallIndicator, children: jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsxRuntime.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 && (jsxRuntime.jsx(ChatReplyPreview, { label: replyPreviewLabel, senderLabel: replySenderLabel, previewText: replyPreviewText, className: styles$5.replyBubblePreview })), jsxRuntime.jsx("div", { ref: contentWithoutButtonsRef, children: jsxRuntime.jsx(ChatMessageRichContent, { content: message.content, contentSegments: contentSegments, streamingFeaturePlaceholderKind: streamingFeaturePlaceholderKind, onCreateAgent: onCreateAgent, mode: mode }) }), message.attachments && message.attachments.length > 0 && (jsxRuntime.jsx("div", { className: styles$5.attachments, children: message.attachments.map((attachment, index) => (jsxRuntime.jsxs("a", { href: attachment.url, target: "_blank", rel: "noopener noreferrer", className: styles$5.attachment, title: attachment.name, children: [jsxRuntime.jsx("span", { className: styles$5.attachmentIcon, children: "\uD83D\uDCCE" }), jsxRuntime.jsx("span", { className: styles$5.attachmentName, children: attachment.name })] }, index))) })), jsxRuntime.jsx(ChatMessageToolCallChips, { chips: toolCallChips, onToolCallClick: onToolCallClick }), citationFootnoteRenderModel.footnotes.length > 0 && (jsxRuntime.jsx("div", { className: styles$5.citationFootnotes, children: citationFootnoteRenderModel.footnotes.map((footnote) => (jsxRuntime.jsxs("div", { className: styles$5.citationFootnoteItem, children: [jsxRuntime.jsx("span", { className: styles$5.citationFootnoteNumber, children: footnote.number }), jsxRuntime.jsx(SourceChip, { citation: footnote.citation, onClick: onCitationClick, isCitationIdVisible: false })] }, `citation-footnote-${footnote.number}-${footnote.citation.source}`))) })), transitiveCitations.length > 0 && (jsxRuntime.jsx("div", { className: styles$5.sourceCitations, children: transitiveCitations.map((citation, index) => (jsxRuntime.jsx(SourceChip, { citation: citation, suffix: `by ${citation.origin.label}`, onClick: onCitationClick }, `team-source-${citation.source}-${index}`))) })), shouldShowButtons && (jsxRuntime.jsx("div", { className: styles$5.messageButtons, children: renderableButtons.map(({ button, buttonIndex }) => (jsxRuntime.jsx("button", { type: "button", className: classNames(styles$5.messageButton, button.type === 'action' && styles$5.actionMessageButton), onClick: (event) => {
50035
50116
  event.stopPropagation();
50036
50117
  if (button.type === 'message') {
50037
50118
  const quickMessageHandler = onQuickMessageButton || onMessage;
@@ -50083,9 +50164,6 @@
50083
50164
  if (prev.message.citations !== next.message.citations) {
50084
50165
  return false;
50085
50166
  }
50086
- if (prev.message.sources !== next.message.sources) {
50087
- return false;
50088
- }
50089
50167
  if (JSON.stringify(prev.message.attachments) !== JSON.stringify(next.message.attachments)) {
50090
50168
  return false;
50091
50169
  }
@@ -51500,7 +51578,7 @@
51500
51578
  const { results, rawText } = extractSearchResults(resultRaw);
51501
51579
  const hasResults = results.length > 0;
51502
51580
  const hasRawText = !hasResults && !!rawText && rawText.trim().length > 0;
51503
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles$5.searchModalHeader, children: [jsxRuntime.jsx("span", { className: styles$5.searchModalIcon, children: "\uD83D\uDD0E" }), jsxRuntime.jsx("h3", { className: styles$5.searchModalQuery, children: args.query || args.searchText || 'Search Results' })] }), jsxRuntime.jsx("div", { className: styles$5.searchModalContent, children: hasResults ? (jsxRuntime.jsx("div", { className: styles$5.searchResultsList, children: results.map((item, index) => (jsxRuntime.jsxs("div", { className: styles$5.searchResultItem, children: [jsxRuntime.jsx("div", { className: styles$5.searchResultUrl, children: item.url && (jsxRuntime.jsx("a", { href: item.url, target: "_blank", rel: "noreferrer", children: item.url })) }), jsxRuntime.jsx("h4", { className: styles$5.searchResultTitle, children: item.url ? (jsxRuntime.jsx("a", { href: item.url, target: "_blank", rel: "noreferrer", children: item.title || item.source || 'Untitled' })) : (item.title || item.source || 'Untitled') }), jsxRuntime.jsx("p", { className: styles$5.searchResultSnippet, children: item.snippet || item.content || item.excerpt || '' })] }, index))) })) : hasRawText ? (jsxRuntime.jsx(MarkdownContent, { className: styles$5.searchResultsRaw, content: rawText })) : toolCallState !== 'COMPLETE' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [renderToolCallProgressPlaceholder({
51581
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles$5.searchModalHeader, children: [jsxRuntime.jsx("span", { className: styles$5.searchModalIcon, children: "\uD83D\uDD0E" }), jsxRuntime.jsx("h3", { className: styles$5.searchModalQuery, children: args.query || args.searchText || 'Search Results' })] }), jsxRuntime.jsx("div", { className: styles$5.searchModalContent, children: hasResults ? (jsxRuntime.jsx("div", { className: styles$5.searchResultsList, children: results.map((item, index) => (jsxRuntime.jsxs("div", { className: styles$5.searchResultItem, children: [jsxRuntime.jsx("div", { className: styles$5.searchResultUrl, children: item.url && (jsxRuntime.jsx("a", { href: item.url, target: "_blank", rel: "noreferrer", children: item.url })) }), jsxRuntime.jsx("h4", { className: styles$5.searchResultTitle, children: item.url ? (jsxRuntime.jsx("a", { href: item.url, target: "_blank", rel: "noreferrer", children: item.title || 'Untitled' })) : (item.title || 'Untitled') }), jsxRuntime.jsx("p", { className: styles$5.searchResultSnippet, children: item.snippet || item.content || '' })] }, index))) })) : hasRawText ? (jsxRuntime.jsx(MarkdownContent, { className: styles$5.searchResultsRaw, content: rawText })) : toolCallState !== 'COMPLETE' ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [renderToolCallProgressPlaceholder({
51504
51582
  title: 'Search results pending',
51505
51583
  message: resolveToolCallProgressMessage(toolCall),
51506
51584
  }), jsxRuntime.jsxs("div", { className: styles$5.toolCallDetailsCard, children: [jsxRuntime.jsxs("div", { className: styles$5.toolCallDetailsCardRow, children: [jsxRuntime.jsx("strong", { children: "Query" }), jsxRuntime.jsx("span", { children: String(args.query || args.searchText || 'Search query is being prepared.') })] }), args.location && (jsxRuntime.jsxs("div", { className: styles$5.toolCallDetailsCardRow, children: [jsxRuntime.jsx("strong", { children: "Location" }), jsxRuntime.jsx("span", { children: String(args.location) })] })), args.engine && (jsxRuntime.jsxs("div", { className: styles$5.toolCallDetailsCardRow, children: [jsxRuntime.jsx("strong", { children: "Engine" }), jsxRuntime.jsx("span", { children: String(args.engine) })] }))] })] })) : (jsxRuntime.jsx("div", { className: styles$5.noResults, children: resultRaw ? 'No search results found.' : 'Search results are not available.' })) })] }));
@@ -52080,7 +52158,6 @@
52080
52158
  function isSearchToolCallName(toolName) {
52081
52159
  return (toolName === 'web_search' ||
52082
52160
  toolName === 'deep_search' ||
52083
- toolName === 'knowledge_search' ||
52084
52161
  toolName === 'useSearchEngine' ||
52085
52162
  toolName === 'search');
52086
52163
  }