@promptbook/core 0.112.0-47 → 0.112.0-49

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 (51) hide show
  1. package/esm/index.es.js +331 -76
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/avatars/AvatarOrImage.d.ts +5 -1
  4. package/esm/src/avatars/avatarAnimationScheduler.d.ts +16 -0
  5. package/esm/src/avatars/avatarInteractionUtils.d.ts +81 -0
  6. package/esm/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
  7. package/esm/src/avatars/avatarPointerTracking.d.ts +33 -0
  8. package/esm/src/avatars/avatarRenderingUtils.d.ts +3 -2
  9. package/esm/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
  10. package/esm/src/avatars/avatarVisibilityTracking.d.ts +17 -0
  11. package/esm/src/avatars/index.d.ts +1 -1
  12. package/esm/src/avatars/renderAvatarVisual.d.ts +29 -1
  13. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +35 -0
  14. package/esm/src/avatars/visuals/octopusAvatarVisualShared.d.ts +34 -0
  15. package/esm/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
  16. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +3 -3
  17. package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
  18. package/esm/src/commitments/USE/USE.d.ts +1 -0
  19. package/esm/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +1 -1
  20. package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +47 -0
  21. package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +1 -0
  22. package/esm/src/commitments/_common/createSerpSearchToolFunction.d.ts +12 -0
  23. package/esm/src/commitments/index.d.ts +2 -1
  24. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
  25. package/esm/src/version.d.ts +1 -1
  26. package/package.json +1 -1
  27. package/umd/index.umd.js +330 -75
  28. package/umd/index.umd.js.map +1 -1
  29. package/umd/src/avatars/AvatarOrImage.d.ts +5 -1
  30. package/umd/src/avatars/avatarAnimationScheduler.d.ts +16 -0
  31. package/umd/src/avatars/avatarInteractionUtils.d.ts +81 -0
  32. package/umd/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
  33. package/umd/src/avatars/avatarPointerTracking.d.ts +33 -0
  34. package/umd/src/avatars/avatarRenderingUtils.d.ts +3 -2
  35. package/umd/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
  36. package/umd/src/avatars/avatarVisibilityTracking.d.ts +17 -0
  37. package/umd/src/avatars/index.d.ts +1 -1
  38. package/umd/src/avatars/renderAvatarVisual.d.ts +29 -1
  39. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +35 -0
  40. package/umd/src/avatars/visuals/octopusAvatarVisualShared.d.ts +34 -0
  41. package/umd/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
  42. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +3 -3
  43. package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
  44. package/umd/src/commitments/USE/USE.d.ts +1 -0
  45. package/umd/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +1 -1
  46. package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +47 -0
  47. package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +1 -0
  48. package/umd/src/commitments/_common/createSerpSearchToolFunction.d.ts +12 -0
  49. package/umd/src/commitments/index.d.ts +2 -1
  50. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
  51. package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js CHANGED
@@ -27,7 +27,7 @@
27
27
  * @generated
28
28
  * @see https://github.com/webgptorg/promptbook
29
29
  */
30
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-47';
30
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-49';
31
31
  /**
32
32
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
33
33
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -15650,6 +15650,7 @@
15650
15650
  * Supported USE types:
15651
15651
  * - USE BROWSER: Enables the agent to use a web browser tool
15652
15652
  * - USE SEARCH ENGINE (future): Enables search engine access
15653
+ * - USE DEEPSEARCH: Enables deeper research-oriented search access
15653
15654
  * - USE FILE SYSTEM (future): Enables file system operations
15654
15655
  * - USE MCP (future): Enables MCP server connections
15655
15656
  *
@@ -15672,7 +15673,7 @@
15672
15673
  * Short one-line description of USE commitments.
15673
15674
  */
15674
15675
  get description() {
15675
- return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, etc.).';
15676
+ return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, DEEPSEARCH, etc.).';
15676
15677
  }
15677
15678
  /**
15678
15679
  * Icon for this commitment.
@@ -15693,6 +15694,7 @@
15693
15694
 
15694
15695
  - **USE BROWSER** - Enables the agent to use a web browser tool to access and retrieve information from the internet
15695
15696
  - **USE SEARCH ENGINE** (future) - Enables search engine access
15697
+ - **USE DEEPSEARCH** - Enables deeper research-oriented search access
15696
15698
  - **USE FILE SYSTEM** (future) - Enables file system operations
15697
15699
  - **USE MCP** (future) - Enables MCP server connections
15698
15700
 
@@ -15747,7 +15749,7 @@
15747
15749
  * Checks if this is a known USE type
15748
15750
  */
15749
15751
  isKnownUseType(useType) {
15750
- const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'FILE SYSTEM', 'MCP'];
15752
+ const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'DEEPSEARCH', 'FILE SYSTEM', 'MCP'];
15751
15753
  return knownTypes.includes(useType.toUpperCase());
15752
15754
  }
15753
15755
  }
@@ -15760,6 +15762,7 @@
15760
15762
  */
15761
15763
  const AGGREGATED_USE_COMMITMENT_TYPES = [
15762
15764
  'USE BROWSER',
15765
+ 'USE DEEPSEARCH',
15763
15766
  'USE SEARCH ENGINE',
15764
15767
  'USE TIME',
15765
15768
  ];
@@ -15839,6 +15842,15 @@
15839
15842
  - Do not tell the user you cannot search for information, YOU CAN.
15840
15843
  ${block(formatOptionalInstructionBlock('Search instructions', combinedAdditionalInstructions))}
15841
15844
  `);
15845
+ case 'USE DEEPSEARCH':
15846
+ return spacetrim.spaceTrim((block) => `
15847
+ Tool:
15848
+ - You have access to DeepSearch via the tool "deep_search".
15849
+ - Use it for broader research tasks that need multi-step investigation, comparison, or synthesis across multiple sources.
15850
+ - Prefer it over quick search when the user asks for a well-grounded brief, report, or deeper investigation.
15851
+ - Do not pretend you cannot research current information when this tool is available.
15852
+ ${block(formatOptionalInstructionBlock('DeepSearch instructions', combinedAdditionalInstructions))}
15853
+ `);
15842
15854
  }
15843
15855
  }
15844
15856
  /**
@@ -17388,6 +17400,207 @@
17388
17400
  }
17389
17401
  // Note: [💞] Ignore a discrepancy between file name and entity name
17390
17402
 
17403
+ /**
17404
+ * A search engine implementation that uses the SerpApi to fetch Google search results.
17405
+ *
17406
+ * @private <- TODO: !!!! Export via some package
17407
+ */
17408
+ class SerpSearchEngine {
17409
+ get title() {
17410
+ return 'SerpApi Search Engine';
17411
+ }
17412
+ get description() {
17413
+ return 'Search engine that uses SerpApi to fetch Google search results';
17414
+ }
17415
+ checkConfiguration() {
17416
+ if (!process.env.SERP_API_KEY) {
17417
+ throw new Error('SERP_API_KEY is not configured');
17418
+ }
17419
+ }
17420
+ async search(query, options = {}) {
17421
+ const apiKey = process.env.SERP_API_KEY;
17422
+ if (!apiKey) {
17423
+ throw new Error('SERP_API_KEY is not configured');
17424
+ }
17425
+ const url = new URL('https://serpapi.com/search');
17426
+ url.searchParams.set('api_key', apiKey);
17427
+ url.searchParams.set('engine', 'google');
17428
+ url.searchParams.set('q', query);
17429
+ for (const [key, value] of Object.entries(options)) {
17430
+ url.searchParams.set(key, String(value));
17431
+ }
17432
+ const response = await fetch(url.toString());
17433
+ if (!response.ok) {
17434
+ const body = await response.text();
17435
+ throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
17436
+ }
17437
+ const data = (await response.json());
17438
+ return (data.organic_results || []).map((item) => ({
17439
+ title: item.title,
17440
+ url: item.link,
17441
+ snippet: item.snippet || '',
17442
+ }));
17443
+ }
17444
+ }
17445
+
17446
+ /**
17447
+ * Creates one SERP-backed tool function used as a local fallback for search-like commitments.
17448
+ *
17449
+ * @param toolName - Technical tool name used for validation messages.
17450
+ * @param resultLabel - Human-readable label used in formatted results.
17451
+ * @returns Async tool function compatible with commitment tool registration.
17452
+ *
17453
+ * @private internal helper for search-like commitments
17454
+ */
17455
+ function createSerpSearchToolFunction(toolName, resultLabel) {
17456
+ return async (rawArgs) => {
17457
+ const { query, ...searchOptions } = rawArgs;
17458
+ if (typeof query !== 'string' || !query.trim()) {
17459
+ throw new Error(`${toolName} query is required`);
17460
+ }
17461
+ const searchEngine = new SerpSearchEngine();
17462
+ const results = await searchEngine.search(query, searchOptions);
17463
+ return spacetrim.spaceTrim((block) => `
17464
+ ${resultLabel} results for "${query}"${Object.keys(searchOptions).length === 0
17465
+ ? ''
17466
+ : ` with options ${JSON.stringify(searchOptions)}`}:
17467
+
17468
+ ${block(results
17469
+ .map((result) => spacetrim.spaceTrim(`
17470
+ - **${result.title}**
17471
+ ${result.url}
17472
+ ${result.snippet}
17473
+ `))
17474
+ .join('\n\n'))}
17475
+ `);
17476
+ };
17477
+ }
17478
+
17479
+ /**
17480
+ * USE DEEPSEARCH commitment definition
17481
+ *
17482
+ * The `USE DEEPSEARCH` commitment indicates that the agent should use a deeper research-oriented
17483
+ * search workflow instead of lightweight web search when it needs fresh information from the internet.
17484
+ *
17485
+ * The content following `USE DEEPSEARCH` is an arbitrary text that the agent should know
17486
+ * (e.g. search scope or research instructions).
17487
+ *
17488
+ * Example usage in agent source:
17489
+ *
17490
+ * ```book
17491
+ * USE DEEPSEARCH
17492
+ * USE DEEPSEARCH Compare official vendor documentation with independent benchmarks.
17493
+ * ```
17494
+ *
17495
+ * @private [🪔] Maybe export the commitments through some package
17496
+ */
17497
+ class UseDeepSearchCommitmentDefinition extends BaseCommitmentDefinition {
17498
+ constructor() {
17499
+ super('USE DEEPSEARCH');
17500
+ }
17501
+ get requiresContent() {
17502
+ return false;
17503
+ }
17504
+ /**
17505
+ * Short one-line description of USE DEEPSEARCH.
17506
+ */
17507
+ get description() {
17508
+ return 'Enable the agent to use DeepSearch for more thorough internet research.';
17509
+ }
17510
+ /**
17511
+ * Icon for this commitment.
17512
+ */
17513
+ get icon() {
17514
+ return '🔬';
17515
+ }
17516
+ /**
17517
+ * Markdown documentation for USE DEEPSEARCH commitment.
17518
+ */
17519
+ get documentation() {
17520
+ return spacetrim.spaceTrim(`
17521
+ # USE DEEPSEARCH
17522
+
17523
+ Enables the agent to use DeepSearch for broader, more thorough internet research than lightweight web search.
17524
+
17525
+ ## Key aspects
17526
+
17527
+ - The content following \`USE DEEPSEARCH\` is arbitrary guidance for the research workflow.
17528
+ - In Agents Server, the OpenAI Agents SDK runtime uses a nested deep-research agent for this tool.
17529
+ - Use this for investigations, comparisons, market scans, or other tasks that benefit from deeper synthesis.
17530
+ - Prefer regular \`USE SEARCH ENGINE\` when a quick factual lookup is enough.
17531
+
17532
+ ## Examples
17533
+
17534
+ \`\`\`book
17535
+ Due Diligence Researcher
17536
+
17537
+ GOAL Investigate vendors thoroughly before making recommendations.
17538
+ USE DEEPSEARCH Compare official sources with credible third-party analysis.
17539
+ RULE Cite the strongest supporting sources in the final answer.
17540
+ \`\`\`
17541
+
17542
+ \`\`\`book
17543
+ Market Analyst
17544
+
17545
+ GOAL Build concise but well-grounded research briefs.
17546
+ USE DEEPSEARCH Focus on recent public information and competing viewpoints.
17547
+ CLOSED
17548
+ \`\`\`
17549
+ `);
17550
+ }
17551
+ applyToAgentModelRequirements(requirements, content) {
17552
+ const existingTools = requirements.tools || [];
17553
+ const updatedTools = existingTools.some((tool) => tool.name === 'deep_search')
17554
+ ? existingTools
17555
+ : [
17556
+ ...existingTools,
17557
+ {
17558
+ name: 'deep_search',
17559
+ description: spacetrim.spaceTrim(`
17560
+ Research the internet deeply and synthesize a grounded answer.
17561
+ Use this tool for broader investigations, comparisons, and requests that need more than a quick search.
17562
+ `),
17563
+ parameters: {
17564
+ type: 'object',
17565
+ properties: {
17566
+ query: {
17567
+ type: 'string',
17568
+ description: 'The research question or investigation request.',
17569
+ },
17570
+ },
17571
+ required: ['query'],
17572
+ additionalProperties: false,
17573
+ },
17574
+ },
17575
+ ];
17576
+ return appendAggregatedUseCommitmentPlaceholder({
17577
+ ...requirements,
17578
+ tools: updatedTools,
17579
+ _metadata: {
17580
+ ...requirements._metadata,
17581
+ useDeepSearch: content || true,
17582
+ },
17583
+ }, this.type);
17584
+ }
17585
+ /**
17586
+ * Gets human-readable titles for tool functions provided by this commitment.
17587
+ */
17588
+ getToolTitles() {
17589
+ return {
17590
+ deep_search: 'DeepSearch',
17591
+ };
17592
+ }
17593
+ /**
17594
+ * Gets the local fallback implementation for the `deep_search` tool.
17595
+ */
17596
+ getToolFunctions() {
17597
+ return {
17598
+ deep_search: createSerpSearchToolFunction('deep_search', 'DeepSearch'),
17599
+ };
17600
+ }
17601
+ }
17602
+ // Note: [💞] Ignore a discrepancy between file name and entity name
17603
+
17391
17604
  /**
17392
17605
  * Lightweight email token matcher used for `USE EMAIL` first-line parsing.
17393
17606
  *
@@ -19775,49 +19988,6 @@
19775
19988
  }
19776
19989
  // Note: [💞] Ignore a discrepancy between file name and entity name
19777
19990
 
19778
- /**
19779
- * A search engine implementation that uses the SerpApi to fetch Google search results.
19780
- *
19781
- * @private <- TODO: !!!! Export via some package
19782
- */
19783
- class SerpSearchEngine {
19784
- get title() {
19785
- return 'SerpApi Search Engine';
19786
- }
19787
- get description() {
19788
- return 'Search engine that uses SerpApi to fetch Google search results';
19789
- }
19790
- checkConfiguration() {
19791
- if (!process.env.SERP_API_KEY) {
19792
- throw new Error('SERP_API_KEY is not configured');
19793
- }
19794
- }
19795
- async search(query, options = {}) {
19796
- const apiKey = process.env.SERP_API_KEY;
19797
- if (!apiKey) {
19798
- throw new Error('SERP_API_KEY is not configured');
19799
- }
19800
- const url = new URL('https://serpapi.com/search');
19801
- url.searchParams.set('api_key', apiKey);
19802
- url.searchParams.set('engine', 'google');
19803
- url.searchParams.set('q', query);
19804
- for (const [key, value] of Object.entries(options)) {
19805
- url.searchParams.set(key, String(value));
19806
- }
19807
- const response = await fetch(url.toString());
19808
- if (!response.ok) {
19809
- const body = await response.text();
19810
- throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
19811
- }
19812
- const data = (await response.json());
19813
- return (data.organic_results || []).map((item) => ({
19814
- title: item.title,
19815
- url: item.link,
19816
- snippet: item.snippet || '',
19817
- }));
19818
- }
19819
- }
19820
-
19821
19991
  /**
19822
19992
  * USE SEARCH ENGINE commitment definition
19823
19993
  *
@@ -19961,26 +20131,7 @@
19961
20131
  */
19962
20132
  getToolFunctions() {
19963
20133
  return {
19964
- async web_search(args) {
19965
- console.log('!!!! [Tool] web_search called', { args });
19966
- const { query, ...options } = args;
19967
- if (!query) {
19968
- throw new Error('Search query is required');
19969
- }
19970
- const searchEngine = new SerpSearchEngine();
19971
- const results = await searchEngine.search(query, options);
19972
- return spacetrim.spaceTrim((block) => `
19973
- Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
19974
-
19975
- ${block(results
19976
- .map((result) => spacetrim.spaceTrim(`
19977
- - **${result.title}**
19978
- ${result.url}
19979
- ${result.snippet}
19980
- `))
19981
- .join('\n\n'))}
19982
- `);
19983
- },
20134
+ web_search: createSerpSearchToolFunction('web_search', 'Search'),
19984
20135
  };
19985
20136
  }
19986
20137
  }
@@ -21626,6 +21777,7 @@
21626
21777
  new ClosedCommitmentDefinition(),
21627
21778
  new TeamCommitmentDefinition(),
21628
21779
  new UseBrowserCommitmentDefinition(),
21780
+ new UseDeepSearchCommitmentDefinition(),
21629
21781
  new UseSearchEngineCommitmentDefinition(),
21630
21782
  new UseSpawnCommitmentDefinition(),
21631
21783
  new UseTimeoutCommitmentDefinition(),
@@ -22795,6 +22947,11 @@
22795
22947
  label: 'Internet',
22796
22948
  iconName: 'Search',
22797
22949
  },
22950
+ 'USE DEEPSEARCH': {
22951
+ type: 'search-engine',
22952
+ label: 'DeepSearch',
22953
+ iconName: 'Search',
22954
+ },
22798
22955
  'USE TIME': {
22799
22956
  type: 'time',
22800
22957
  label: 'Time',
@@ -32844,6 +33001,14 @@
32844
33001
  * Constant for default agent kit model name.
32845
33002
  */
32846
33003
  const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
33004
+ /**
33005
+ * Default model used for nested DeepSearch tool invocations.
33006
+ */
33007
+ const DEFAULT_DEEP_SEARCH_MODEL_NAME = 'o4-mini-deep-research';
33008
+ /**
33009
+ * Tool name used by the Book commitment-backed DeepSearch capability.
33010
+ */
33011
+ const DEEP_SEARCH_TOOL_NAME = 'deep_search';
32847
33012
  /**
32848
33013
  * Creates one structured log entry for streamed tool-call updates.
32849
33014
  *
@@ -32886,6 +33051,98 @@
32886
33051
  }
32887
33052
  return 'COMPLETE';
32888
33053
  }
33054
+ /**
33055
+ * Returns true when one tool definition represents the dedicated DeepSearch capability.
33056
+ *
33057
+ * @param toolDefinition - Tool definition from compiled model requirements.
33058
+ * @returns `true` when the tool should be backed by a nested deep-research agent.
33059
+ *
33060
+ * @private helper of `OpenAiAgentKitExecutionTools`
33061
+ */
33062
+ function isDeepSearchToolDefinition(toolDefinition) {
33063
+ return toolDefinition.name === DEEP_SEARCH_TOOL_NAME;
33064
+ }
33065
+ /**
33066
+ * Normalizes Promptbook JSON-schema tool parameters for AgentKit function tools.
33067
+ *
33068
+ * @param parameters - Promptbook tool parameters.
33069
+ * @returns AgentKit-compatible JSON schema or `undefined`.
33070
+ *
33071
+ * @private helper of `OpenAiAgentKitExecutionTools`
33072
+ */
33073
+ function normalizeAgentKitToolParameters(parameters) {
33074
+ var _a, _b;
33075
+ if (!parameters) {
33076
+ return undefined;
33077
+ }
33078
+ return {
33079
+ ...parameters,
33080
+ additionalProperties: (_a = parameters.additionalProperties) !== null && _a !== void 0 ? _a : false,
33081
+ required: (_b = parameters.required) !== null && _b !== void 0 ? _b : [],
33082
+ };
33083
+ }
33084
+ /**
33085
+ * Creates instructions for the nested DeepSearch specialist agent.
33086
+ *
33087
+ * @param toolDescription - Model-facing description from the original tool definition.
33088
+ * @returns System instructions for the nested deep-research agent.
33089
+ *
33090
+ * @private helper of `OpenAiAgentKitExecutionTools`
33091
+ */
33092
+ function createDeepSearchAgentInstructions(toolDescription) {
33093
+ const normalizedDescription = toolDescription.trim();
33094
+ return spacetrim.spaceTrim((block) => `
33095
+ You are a DeepSearch specialist working as a tool for another agent.
33096
+ Perform thorough, source-grounded public-web research based on the provided request.
33097
+ Use web search to gather current information, compare relevant viewpoints, and synthesize a concise research brief.
33098
+ Do not ask follow-up questions. If the request is not specific enough, state the assumptions you had to make.
33099
+ Include citations in the research brief whenever sources were used.
33100
+ ${block(normalizedDescription ? `Tool guidance:\n${normalizedDescription}` : '')}
33101
+ `);
33102
+ }
33103
+ /**
33104
+ * Builds the nested DeepSearch prompt from structured tool arguments.
33105
+ *
33106
+ * @param rawInput - Parsed function-tool arguments provided by the outer agent.
33107
+ * @returns Prompt text passed to the nested deep-research agent.
33108
+ *
33109
+ * @private helper of `OpenAiAgentKitExecutionTools`
33110
+ */
33111
+ function buildDeepSearchToolInput(rawInput) {
33112
+ const input = rawInput && typeof rawInput === 'object' ? rawInput : {};
33113
+ const query = typeof input.query === 'string' ? input.query.trim() : '';
33114
+ const additionalHints = Object.entries(input)
33115
+ .filter(([key, value]) => key !== 'query' && value !== undefined && value !== null && String(value).trim() !== '')
33116
+ .map(([key, value]) => `- ${key}: ${typeof value === 'string' ? value : JSON.stringify(value)}`);
33117
+ return spacetrim.spaceTrim((block) => `
33118
+ Research request:
33119
+ ${query || JSON.stringify(input)}
33120
+ ${block(additionalHints.length > 0 ? `Execution hints:\n${additionalHints.join('\n')}` : '')}
33121
+ `);
33122
+ }
33123
+ /**
33124
+ * Creates the native Agent SDK tool used for `USE DEEPSEARCH`.
33125
+ *
33126
+ * @param toolDefinition - Promptbook tool definition for `deep_search`.
33127
+ * @returns AgentKit tool backed by a nested deep-research agent.
33128
+ *
33129
+ * @private helper of `OpenAiAgentKitExecutionTools`
33130
+ */
33131
+ function createDeepSearchAgentKitTool(toolDefinition) {
33132
+ const deepSearchAgent = new agents.Agent({
33133
+ name: 'DeepSearch',
33134
+ model: DEFAULT_DEEP_SEARCH_MODEL_NAME,
33135
+ instructions: createDeepSearchAgentInstructions(toolDefinition.description),
33136
+ tools: [agents.webSearchTool({ searchContextSize: 'high' })],
33137
+ });
33138
+ return deepSearchAgent.asTool({
33139
+ toolName: toolDefinition.name,
33140
+ toolDescription: toolDefinition.description,
33141
+ parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
33142
+ inputBuilder: ({ params }) => buildDeepSearchToolInput(params),
33143
+ customOutputExtractor: (result) => { var _a; return typeof result.finalOutput === 'string' ? result.finalOutput : JSON.stringify((_a = result.finalOutput) !== null && _a !== void 0 ? _a : ''); },
33144
+ });
33145
+ }
32889
33146
  /**
32890
33147
  * Constant for default JSON schema name.
32891
33148
  */
@@ -33226,25 +33483,23 @@
33226
33483
  * Builds the tool list for AgentKit, including hosted file search when applicable.
33227
33484
  */
33228
33485
  buildAgentKitTools(options) {
33229
- var _a;
33230
33486
  const { tools, vectorStoreId } = options;
33231
33487
  const agentKitTools = [];
33232
33488
  if (vectorStoreId) {
33233
33489
  agentKitTools.push(agents.fileSearchTool(vectorStoreId));
33234
33490
  }
33235
33491
  if (tools && tools.length > 0) {
33236
- const scriptTools = this.resolveScriptTools();
33492
+ let scriptTools = null;
33237
33493
  for (const toolDefinition of tools) {
33494
+ if (isDeepSearchToolDefinition(toolDefinition)) {
33495
+ agentKitTools.push(createDeepSearchAgentKitTool(toolDefinition));
33496
+ continue;
33497
+ }
33498
+ scriptTools !== null && scriptTools !== void 0 ? scriptTools : (scriptTools = this.resolveScriptTools());
33238
33499
  agentKitTools.push(agents.tool({
33239
33500
  name: toolDefinition.name,
33240
33501
  description: toolDefinition.description,
33241
- parameters: toolDefinition.parameters
33242
- ? {
33243
- ...toolDefinition.parameters,
33244
- additionalProperties: false,
33245
- required: (_a = toolDefinition.parameters.required) !== null && _a !== void 0 ? _a : [],
33246
- }
33247
- : undefined,
33502
+ parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
33248
33503
  strict: false,
33249
33504
  execute: async (input, runContext, details) => {
33250
33505
  var _a, _b, _c, _d;