@promptbook/node 0.112.0-47 → 0.112.0-48

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 (43) 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/avatarInteractionUtils.d.ts +81 -0
  5. package/esm/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
  6. package/esm/src/avatars/avatarPointerTracking.d.ts +17 -0
  7. package/esm/src/avatars/avatarRenderingUtils.d.ts +3 -2
  8. package/esm/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
  9. package/esm/src/avatars/index.d.ts +1 -1
  10. package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +35 -0
  11. package/esm/src/avatars/visuals/octopusAvatarVisualShared.d.ts +34 -0
  12. package/esm/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
  13. package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
  14. package/esm/src/commitments/USE/USE.d.ts +1 -0
  15. package/esm/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +1 -1
  16. package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +47 -0
  17. package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +1 -0
  18. package/esm/src/commitments/_common/createSerpSearchToolFunction.d.ts +12 -0
  19. package/esm/src/commitments/index.d.ts +2 -1
  20. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
  21. package/esm/src/version.d.ts +1 -1
  22. package/package.json +2 -2
  23. package/umd/index.umd.js +330 -75
  24. package/umd/index.umd.js.map +1 -1
  25. package/umd/src/avatars/AvatarOrImage.d.ts +5 -1
  26. package/umd/src/avatars/avatarInteractionUtils.d.ts +81 -0
  27. package/umd/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
  28. package/umd/src/avatars/avatarPointerTracking.d.ts +17 -0
  29. package/umd/src/avatars/avatarRenderingUtils.d.ts +3 -2
  30. package/umd/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
  31. package/umd/src/avatars/index.d.ts +1 -1
  32. package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +35 -0
  33. package/umd/src/avatars/visuals/octopusAvatarVisualShared.d.ts +34 -0
  34. package/umd/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
  35. package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
  36. package/umd/src/commitments/USE/USE.d.ts +1 -0
  37. package/umd/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +1 -1
  38. package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +47 -0
  39. package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +1 -0
  40. package/umd/src/commitments/_common/createSerpSearchToolFunction.d.ts +12 -0
  41. package/umd/src/commitments/index.d.ts +2 -1
  42. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
  43. package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js CHANGED
@@ -48,7 +48,7 @@
48
48
  * @generated
49
49
  * @see https://github.com/webgptorg/promptbook
50
50
  */
51
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-47';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-48';
52
52
  /**
53
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
54
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -19596,6 +19596,7 @@
19596
19596
  * Supported USE types:
19597
19597
  * - USE BROWSER: Enables the agent to use a web browser tool
19598
19598
  * - USE SEARCH ENGINE (future): Enables search engine access
19599
+ * - USE DEEPSEARCH: Enables deeper research-oriented search access
19599
19600
  * - USE FILE SYSTEM (future): Enables file system operations
19600
19601
  * - USE MCP (future): Enables MCP server connections
19601
19602
  *
@@ -19618,7 +19619,7 @@
19618
19619
  * Short one-line description of USE commitments.
19619
19620
  */
19620
19621
  get description() {
19621
- return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, etc.).';
19622
+ return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, DEEPSEARCH, etc.).';
19622
19623
  }
19623
19624
  /**
19624
19625
  * Icon for this commitment.
@@ -19639,6 +19640,7 @@
19639
19640
 
19640
19641
  - **USE BROWSER** - Enables the agent to use a web browser tool to access and retrieve information from the internet
19641
19642
  - **USE SEARCH ENGINE** (future) - Enables search engine access
19643
+ - **USE DEEPSEARCH** - Enables deeper research-oriented search access
19642
19644
  - **USE FILE SYSTEM** (future) - Enables file system operations
19643
19645
  - **USE MCP** (future) - Enables MCP server connections
19644
19646
 
@@ -19693,7 +19695,7 @@
19693
19695
  * Checks if this is a known USE type
19694
19696
  */
19695
19697
  isKnownUseType(useType) {
19696
- const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'FILE SYSTEM', 'MCP'];
19698
+ const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'DEEPSEARCH', 'FILE SYSTEM', 'MCP'];
19697
19699
  return knownTypes.includes(useType.toUpperCase());
19698
19700
  }
19699
19701
  }
@@ -19706,6 +19708,7 @@
19706
19708
  */
19707
19709
  const AGGREGATED_USE_COMMITMENT_TYPES = [
19708
19710
  'USE BROWSER',
19711
+ 'USE DEEPSEARCH',
19709
19712
  'USE SEARCH ENGINE',
19710
19713
  'USE TIME',
19711
19714
  ];
@@ -19785,6 +19788,15 @@
19785
19788
  - Do not tell the user you cannot search for information, YOU CAN.
19786
19789
  ${block(formatOptionalInstructionBlock('Search instructions', combinedAdditionalInstructions))}
19787
19790
  `);
19791
+ case 'USE DEEPSEARCH':
19792
+ return _spaceTrim.spaceTrim((block) => `
19793
+ Tool:
19794
+ - You have access to DeepSearch via the tool "deep_search".
19795
+ - Use it for broader research tasks that need multi-step investigation, comparison, or synthesis across multiple sources.
19796
+ - Prefer it over quick search when the user asks for a well-grounded brief, report, or deeper investigation.
19797
+ - Do not pretend you cannot research current information when this tool is available.
19798
+ ${block(formatOptionalInstructionBlock('DeepSearch instructions', combinedAdditionalInstructions))}
19799
+ `);
19788
19800
  }
19789
19801
  }
19790
19802
  /**
@@ -21334,6 +21346,207 @@
21334
21346
  }
21335
21347
  // Note: [💞] Ignore a discrepancy between file name and entity name
21336
21348
 
21349
+ /**
21350
+ * A search engine implementation that uses the SerpApi to fetch Google search results.
21351
+ *
21352
+ * @private <- TODO: !!!! Export via some package
21353
+ */
21354
+ class SerpSearchEngine {
21355
+ get title() {
21356
+ return 'SerpApi Search Engine';
21357
+ }
21358
+ get description() {
21359
+ return 'Search engine that uses SerpApi to fetch Google search results';
21360
+ }
21361
+ checkConfiguration() {
21362
+ if (!process.env.SERP_API_KEY) {
21363
+ throw new Error('SERP_API_KEY is not configured');
21364
+ }
21365
+ }
21366
+ async search(query, options = {}) {
21367
+ const apiKey = process.env.SERP_API_KEY;
21368
+ if (!apiKey) {
21369
+ throw new Error('SERP_API_KEY is not configured');
21370
+ }
21371
+ const url = new URL('https://serpapi.com/search');
21372
+ url.searchParams.set('api_key', apiKey);
21373
+ url.searchParams.set('engine', 'google');
21374
+ url.searchParams.set('q', query);
21375
+ for (const [key, value] of Object.entries(options)) {
21376
+ url.searchParams.set(key, String(value));
21377
+ }
21378
+ const response = await fetch(url.toString());
21379
+ if (!response.ok) {
21380
+ const body = await response.text();
21381
+ throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
21382
+ }
21383
+ const data = (await response.json());
21384
+ return (data.organic_results || []).map((item) => ({
21385
+ title: item.title,
21386
+ url: item.link,
21387
+ snippet: item.snippet || '',
21388
+ }));
21389
+ }
21390
+ }
21391
+
21392
+ /**
21393
+ * Creates one SERP-backed tool function used as a local fallback for search-like commitments.
21394
+ *
21395
+ * @param toolName - Technical tool name used for validation messages.
21396
+ * @param resultLabel - Human-readable label used in formatted results.
21397
+ * @returns Async tool function compatible with commitment tool registration.
21398
+ *
21399
+ * @private internal helper for search-like commitments
21400
+ */
21401
+ function createSerpSearchToolFunction(toolName, resultLabel) {
21402
+ return async (rawArgs) => {
21403
+ const { query, ...searchOptions } = rawArgs;
21404
+ if (typeof query !== 'string' || !query.trim()) {
21405
+ throw new Error(`${toolName} query is required`);
21406
+ }
21407
+ const searchEngine = new SerpSearchEngine();
21408
+ const results = await searchEngine.search(query, searchOptions);
21409
+ return _spaceTrim.spaceTrim((block) => `
21410
+ ${resultLabel} results for "${query}"${Object.keys(searchOptions).length === 0
21411
+ ? ''
21412
+ : ` with options ${JSON.stringify(searchOptions)}`}:
21413
+
21414
+ ${block(results
21415
+ .map((result) => _spaceTrim.spaceTrim(`
21416
+ - **${result.title}**
21417
+ ${result.url}
21418
+ ${result.snippet}
21419
+ `))
21420
+ .join('\n\n'))}
21421
+ `);
21422
+ };
21423
+ }
21424
+
21425
+ /**
21426
+ * USE DEEPSEARCH commitment definition
21427
+ *
21428
+ * The `USE DEEPSEARCH` commitment indicates that the agent should use a deeper research-oriented
21429
+ * search workflow instead of lightweight web search when it needs fresh information from the internet.
21430
+ *
21431
+ * The content following `USE DEEPSEARCH` is an arbitrary text that the agent should know
21432
+ * (e.g. search scope or research instructions).
21433
+ *
21434
+ * Example usage in agent source:
21435
+ *
21436
+ * ```book
21437
+ * USE DEEPSEARCH
21438
+ * USE DEEPSEARCH Compare official vendor documentation with independent benchmarks.
21439
+ * ```
21440
+ *
21441
+ * @private [🪔] Maybe export the commitments through some package
21442
+ */
21443
+ class UseDeepSearchCommitmentDefinition extends BaseCommitmentDefinition {
21444
+ constructor() {
21445
+ super('USE DEEPSEARCH');
21446
+ }
21447
+ get requiresContent() {
21448
+ return false;
21449
+ }
21450
+ /**
21451
+ * Short one-line description of USE DEEPSEARCH.
21452
+ */
21453
+ get description() {
21454
+ return 'Enable the agent to use DeepSearch for more thorough internet research.';
21455
+ }
21456
+ /**
21457
+ * Icon for this commitment.
21458
+ */
21459
+ get icon() {
21460
+ return '🔬';
21461
+ }
21462
+ /**
21463
+ * Markdown documentation for USE DEEPSEARCH commitment.
21464
+ */
21465
+ get documentation() {
21466
+ return _spaceTrim.spaceTrim(`
21467
+ # USE DEEPSEARCH
21468
+
21469
+ Enables the agent to use DeepSearch for broader, more thorough internet research than lightweight web search.
21470
+
21471
+ ## Key aspects
21472
+
21473
+ - The content following \`USE DEEPSEARCH\` is arbitrary guidance for the research workflow.
21474
+ - In Agents Server, the OpenAI Agents SDK runtime uses a nested deep-research agent for this tool.
21475
+ - Use this for investigations, comparisons, market scans, or other tasks that benefit from deeper synthesis.
21476
+ - Prefer regular \`USE SEARCH ENGINE\` when a quick factual lookup is enough.
21477
+
21478
+ ## Examples
21479
+
21480
+ \`\`\`book
21481
+ Due Diligence Researcher
21482
+
21483
+ GOAL Investigate vendors thoroughly before making recommendations.
21484
+ USE DEEPSEARCH Compare official sources with credible third-party analysis.
21485
+ RULE Cite the strongest supporting sources in the final answer.
21486
+ \`\`\`
21487
+
21488
+ \`\`\`book
21489
+ Market Analyst
21490
+
21491
+ GOAL Build concise but well-grounded research briefs.
21492
+ USE DEEPSEARCH Focus on recent public information and competing viewpoints.
21493
+ CLOSED
21494
+ \`\`\`
21495
+ `);
21496
+ }
21497
+ applyToAgentModelRequirements(requirements, content) {
21498
+ const existingTools = requirements.tools || [];
21499
+ const updatedTools = existingTools.some((tool) => tool.name === 'deep_search')
21500
+ ? existingTools
21501
+ : [
21502
+ ...existingTools,
21503
+ {
21504
+ name: 'deep_search',
21505
+ description: _spaceTrim.spaceTrim(`
21506
+ Research the internet deeply and synthesize a grounded answer.
21507
+ Use this tool for broader investigations, comparisons, and requests that need more than a quick search.
21508
+ `),
21509
+ parameters: {
21510
+ type: 'object',
21511
+ properties: {
21512
+ query: {
21513
+ type: 'string',
21514
+ description: 'The research question or investigation request.',
21515
+ },
21516
+ },
21517
+ required: ['query'],
21518
+ additionalProperties: false,
21519
+ },
21520
+ },
21521
+ ];
21522
+ return appendAggregatedUseCommitmentPlaceholder({
21523
+ ...requirements,
21524
+ tools: updatedTools,
21525
+ _metadata: {
21526
+ ...requirements._metadata,
21527
+ useDeepSearch: content || true,
21528
+ },
21529
+ }, this.type);
21530
+ }
21531
+ /**
21532
+ * Gets human-readable titles for tool functions provided by this commitment.
21533
+ */
21534
+ getToolTitles() {
21535
+ return {
21536
+ deep_search: 'DeepSearch',
21537
+ };
21538
+ }
21539
+ /**
21540
+ * Gets the local fallback implementation for the `deep_search` tool.
21541
+ */
21542
+ getToolFunctions() {
21543
+ return {
21544
+ deep_search: createSerpSearchToolFunction('deep_search', 'DeepSearch'),
21545
+ };
21546
+ }
21547
+ }
21548
+ // Note: [💞] Ignore a discrepancy between file name and entity name
21549
+
21337
21550
  /**
21338
21551
  * Lightweight email token matcher used for `USE EMAIL` first-line parsing.
21339
21552
  *
@@ -23721,49 +23934,6 @@
23721
23934
  }
23722
23935
  // Note: [💞] Ignore a discrepancy between file name and entity name
23723
23936
 
23724
- /**
23725
- * A search engine implementation that uses the SerpApi to fetch Google search results.
23726
- *
23727
- * @private <- TODO: !!!! Export via some package
23728
- */
23729
- class SerpSearchEngine {
23730
- get title() {
23731
- return 'SerpApi Search Engine';
23732
- }
23733
- get description() {
23734
- return 'Search engine that uses SerpApi to fetch Google search results';
23735
- }
23736
- checkConfiguration() {
23737
- if (!process.env.SERP_API_KEY) {
23738
- throw new Error('SERP_API_KEY is not configured');
23739
- }
23740
- }
23741
- async search(query, options = {}) {
23742
- const apiKey = process.env.SERP_API_KEY;
23743
- if (!apiKey) {
23744
- throw new Error('SERP_API_KEY is not configured');
23745
- }
23746
- const url = new URL('https://serpapi.com/search');
23747
- url.searchParams.set('api_key', apiKey);
23748
- url.searchParams.set('engine', 'google');
23749
- url.searchParams.set('q', query);
23750
- for (const [key, value] of Object.entries(options)) {
23751
- url.searchParams.set(key, String(value));
23752
- }
23753
- const response = await fetch(url.toString());
23754
- if (!response.ok) {
23755
- const body = await response.text();
23756
- throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
23757
- }
23758
- const data = (await response.json());
23759
- return (data.organic_results || []).map((item) => ({
23760
- title: item.title,
23761
- url: item.link,
23762
- snippet: item.snippet || '',
23763
- }));
23764
- }
23765
- }
23766
-
23767
23937
  /**
23768
23938
  * USE SEARCH ENGINE commitment definition
23769
23939
  *
@@ -23907,26 +24077,7 @@
23907
24077
  */
23908
24078
  getToolFunctions() {
23909
24079
  return {
23910
- async web_search(args) {
23911
- console.log('!!!! [Tool] web_search called', { args });
23912
- const { query, ...options } = args;
23913
- if (!query) {
23914
- throw new Error('Search query is required');
23915
- }
23916
- const searchEngine = new SerpSearchEngine();
23917
- const results = await searchEngine.search(query, options);
23918
- return _spaceTrim.spaceTrim((block) => `
23919
- Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
23920
-
23921
- ${block(results
23922
- .map((result) => _spaceTrim.spaceTrim(`
23923
- - **${result.title}**
23924
- ${result.url}
23925
- ${result.snippet}
23926
- `))
23927
- .join('\n\n'))}
23928
- `);
23929
- },
24080
+ web_search: createSerpSearchToolFunction('web_search', 'Search'),
23930
24081
  };
23931
24082
  }
23932
24083
  }
@@ -25572,6 +25723,7 @@
25572
25723
  new ClosedCommitmentDefinition(),
25573
25724
  new TeamCommitmentDefinition(),
25574
25725
  new UseBrowserCommitmentDefinition(),
25726
+ new UseDeepSearchCommitmentDefinition(),
25575
25727
  new UseSearchEngineCommitmentDefinition(),
25576
25728
  new UseSpawnCommitmentDefinition(),
25577
25729
  new UseTimeoutCommitmentDefinition(),
@@ -28165,6 +28317,11 @@
28165
28317
  label: 'Internet',
28166
28318
  iconName: 'Search',
28167
28319
  },
28320
+ 'USE DEEPSEARCH': {
28321
+ type: 'search-engine',
28322
+ label: 'DeepSearch',
28323
+ iconName: 'Search',
28324
+ },
28168
28325
  'USE TIME': {
28169
28326
  type: 'time',
28170
28327
  label: 'Time',
@@ -33410,6 +33567,14 @@
33410
33567
  * Constant for default agent kit model name.
33411
33568
  */
33412
33569
  const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
33570
+ /**
33571
+ * Default model used for nested DeepSearch tool invocations.
33572
+ */
33573
+ const DEFAULT_DEEP_SEARCH_MODEL_NAME = 'o4-mini-deep-research';
33574
+ /**
33575
+ * Tool name used by the Book commitment-backed DeepSearch capability.
33576
+ */
33577
+ const DEEP_SEARCH_TOOL_NAME = 'deep_search';
33413
33578
  /**
33414
33579
  * Creates one structured log entry for streamed tool-call updates.
33415
33580
  *
@@ -33452,6 +33617,98 @@
33452
33617
  }
33453
33618
  return 'COMPLETE';
33454
33619
  }
33620
+ /**
33621
+ * Returns true when one tool definition represents the dedicated DeepSearch capability.
33622
+ *
33623
+ * @param toolDefinition - Tool definition from compiled model requirements.
33624
+ * @returns `true` when the tool should be backed by a nested deep-research agent.
33625
+ *
33626
+ * @private helper of `OpenAiAgentKitExecutionTools`
33627
+ */
33628
+ function isDeepSearchToolDefinition(toolDefinition) {
33629
+ return toolDefinition.name === DEEP_SEARCH_TOOL_NAME;
33630
+ }
33631
+ /**
33632
+ * Normalizes Promptbook JSON-schema tool parameters for AgentKit function tools.
33633
+ *
33634
+ * @param parameters - Promptbook tool parameters.
33635
+ * @returns AgentKit-compatible JSON schema or `undefined`.
33636
+ *
33637
+ * @private helper of `OpenAiAgentKitExecutionTools`
33638
+ */
33639
+ function normalizeAgentKitToolParameters(parameters) {
33640
+ var _a, _b;
33641
+ if (!parameters) {
33642
+ return undefined;
33643
+ }
33644
+ return {
33645
+ ...parameters,
33646
+ additionalProperties: (_a = parameters.additionalProperties) !== null && _a !== void 0 ? _a : false,
33647
+ required: (_b = parameters.required) !== null && _b !== void 0 ? _b : [],
33648
+ };
33649
+ }
33650
+ /**
33651
+ * Creates instructions for the nested DeepSearch specialist agent.
33652
+ *
33653
+ * @param toolDescription - Model-facing description from the original tool definition.
33654
+ * @returns System instructions for the nested deep-research agent.
33655
+ *
33656
+ * @private helper of `OpenAiAgentKitExecutionTools`
33657
+ */
33658
+ function createDeepSearchAgentInstructions(toolDescription) {
33659
+ const normalizedDescription = toolDescription.trim();
33660
+ return _spaceTrim.spaceTrim((block) => `
33661
+ You are a DeepSearch specialist working as a tool for another agent.
33662
+ Perform thorough, source-grounded public-web research based on the provided request.
33663
+ Use web search to gather current information, compare relevant viewpoints, and synthesize a concise research brief.
33664
+ Do not ask follow-up questions. If the request is not specific enough, state the assumptions you had to make.
33665
+ Include citations in the research brief whenever sources were used.
33666
+ ${block(normalizedDescription ? `Tool guidance:\n${normalizedDescription}` : '')}
33667
+ `);
33668
+ }
33669
+ /**
33670
+ * Builds the nested DeepSearch prompt from structured tool arguments.
33671
+ *
33672
+ * @param rawInput - Parsed function-tool arguments provided by the outer agent.
33673
+ * @returns Prompt text passed to the nested deep-research agent.
33674
+ *
33675
+ * @private helper of `OpenAiAgentKitExecutionTools`
33676
+ */
33677
+ function buildDeepSearchToolInput(rawInput) {
33678
+ const input = rawInput && typeof rawInput === 'object' ? rawInput : {};
33679
+ const query = typeof input.query === 'string' ? input.query.trim() : '';
33680
+ const additionalHints = Object.entries(input)
33681
+ .filter(([key, value]) => key !== 'query' && value !== undefined && value !== null && String(value).trim() !== '')
33682
+ .map(([key, value]) => `- ${key}: ${typeof value === 'string' ? value : JSON.stringify(value)}`);
33683
+ return _spaceTrim.spaceTrim((block) => `
33684
+ Research request:
33685
+ ${query || JSON.stringify(input)}
33686
+ ${block(additionalHints.length > 0 ? `Execution hints:\n${additionalHints.join('\n')}` : '')}
33687
+ `);
33688
+ }
33689
+ /**
33690
+ * Creates the native Agent SDK tool used for `USE DEEPSEARCH`.
33691
+ *
33692
+ * @param toolDefinition - Promptbook tool definition for `deep_search`.
33693
+ * @returns AgentKit tool backed by a nested deep-research agent.
33694
+ *
33695
+ * @private helper of `OpenAiAgentKitExecutionTools`
33696
+ */
33697
+ function createDeepSearchAgentKitTool(toolDefinition) {
33698
+ const deepSearchAgent = new agents.Agent({
33699
+ name: 'DeepSearch',
33700
+ model: DEFAULT_DEEP_SEARCH_MODEL_NAME,
33701
+ instructions: createDeepSearchAgentInstructions(toolDefinition.description),
33702
+ tools: [agents.webSearchTool({ searchContextSize: 'high' })],
33703
+ });
33704
+ return deepSearchAgent.asTool({
33705
+ toolName: toolDefinition.name,
33706
+ toolDescription: toolDefinition.description,
33707
+ parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
33708
+ inputBuilder: ({ params }) => buildDeepSearchToolInput(params),
33709
+ customOutputExtractor: (result) => { var _a; return typeof result.finalOutput === 'string' ? result.finalOutput : JSON.stringify((_a = result.finalOutput) !== null && _a !== void 0 ? _a : ''); },
33710
+ });
33711
+ }
33455
33712
  /**
33456
33713
  * Constant for default JSON schema name.
33457
33714
  */
@@ -33792,25 +34049,23 @@
33792
34049
  * Builds the tool list for AgentKit, including hosted file search when applicable.
33793
34050
  */
33794
34051
  buildAgentKitTools(options) {
33795
- var _a;
33796
34052
  const { tools, vectorStoreId } = options;
33797
34053
  const agentKitTools = [];
33798
34054
  if (vectorStoreId) {
33799
34055
  agentKitTools.push(agents.fileSearchTool(vectorStoreId));
33800
34056
  }
33801
34057
  if (tools && tools.length > 0) {
33802
- const scriptTools = this.resolveScriptTools();
34058
+ let scriptTools = null;
33803
34059
  for (const toolDefinition of tools) {
34060
+ if (isDeepSearchToolDefinition(toolDefinition)) {
34061
+ agentKitTools.push(createDeepSearchAgentKitTool(toolDefinition));
34062
+ continue;
34063
+ }
34064
+ scriptTools !== null && scriptTools !== void 0 ? scriptTools : (scriptTools = this.resolveScriptTools());
33804
34065
  agentKitTools.push(agents.tool({
33805
34066
  name: toolDefinition.name,
33806
34067
  description: toolDefinition.description,
33807
- parameters: toolDefinition.parameters
33808
- ? {
33809
- ...toolDefinition.parameters,
33810
- additionalProperties: false,
33811
- required: (_a = toolDefinition.parameters.required) !== null && _a !== void 0 ? _a : [],
33812
- }
33813
- : undefined,
34068
+ parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
33814
34069
  strict: false,
33815
34070
  execute: async (input, runContext, details) => {
33816
34071
  var _a, _b, _c, _d;