@promptbook/browser 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.
- package/esm/index.es.js +331 -76
- package/esm/index.es.js.map +1 -1
- package/esm/src/avatars/AvatarOrImage.d.ts +5 -1
- package/esm/src/avatars/avatarAnimationScheduler.d.ts +16 -0
- package/esm/src/avatars/avatarInteractionUtils.d.ts +81 -0
- package/esm/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
- package/esm/src/avatars/avatarPointerTracking.d.ts +33 -0
- package/esm/src/avatars/avatarRenderingUtils.d.ts +3 -2
- package/esm/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
- package/esm/src/avatars/avatarVisibilityTracking.d.ts +17 -0
- package/esm/src/avatars/index.d.ts +1 -1
- package/esm/src/avatars/renderAvatarVisual.d.ts +29 -1
- package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +35 -0
- package/esm/src/avatars/visuals/octopusAvatarVisualShared.d.ts +34 -0
- package/esm/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +3 -3
- package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
- package/esm/src/commitments/USE/USE.d.ts +1 -0
- package/esm/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +1 -1
- package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +47 -0
- package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +1 -0
- package/esm/src/commitments/_common/createSerpSearchToolFunction.d.ts +12 -0
- package/esm/src/commitments/index.d.ts +2 -1
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +330 -75
- package/umd/index.umd.js.map +1 -1
- package/umd/src/avatars/AvatarOrImage.d.ts +5 -1
- package/umd/src/avatars/avatarAnimationScheduler.d.ts +16 -0
- package/umd/src/avatars/avatarInteractionUtils.d.ts +81 -0
- package/umd/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
- package/umd/src/avatars/avatarPointerTracking.d.ts +33 -0
- package/umd/src/avatars/avatarRenderingUtils.d.ts +3 -2
- package/umd/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
- package/umd/src/avatars/avatarVisibilityTracking.d.ts +17 -0
- package/umd/src/avatars/index.d.ts +1 -1
- package/umd/src/avatars/renderAvatarVisual.d.ts +29 -1
- package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +35 -0
- package/umd/src/avatars/visuals/octopusAvatarVisualShared.d.ts +34 -0
- package/umd/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +3 -3
- package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
- package/umd/src/commitments/USE/USE.d.ts +1 -0
- package/umd/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +1 -1
- package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +47 -0
- package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.test.d.ts +1 -0
- package/umd/src/commitments/_common/createSerpSearchToolFunction.d.ts +12 -0
- package/umd/src/commitments/index.d.ts +2 -1
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -10,7 +10,7 @@ import { lookup, extension } from 'mime-types';
|
|
|
10
10
|
import { forTime } from 'waitasecond';
|
|
11
11
|
import sha256 from 'crypto-js/sha256';
|
|
12
12
|
import { parse, unparse } from 'papaparse';
|
|
13
|
-
import { Agent as Agent$1, setDefaultOpenAIClient, setDefaultOpenAIKey, fileSearchTool, tool, run } from '@openai/agents';
|
|
13
|
+
import { Agent as Agent$1, setDefaultOpenAIClient, setDefaultOpenAIKey, fileSearchTool, tool, run, webSearchTool } from '@openai/agents';
|
|
14
14
|
import Bottleneck from 'bottleneck';
|
|
15
15
|
import colors from 'colors';
|
|
16
16
|
import OpenAI from 'openai';
|
|
@@ -29,7 +29,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
29
29
|
* @generated
|
|
30
30
|
* @see https://github.com/webgptorg/promptbook
|
|
31
31
|
*/
|
|
32
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
32
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-49';
|
|
33
33
|
/**
|
|
34
34
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
35
35
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -10722,6 +10722,7 @@ class TemplateCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
10722
10722
|
* Supported USE types:
|
|
10723
10723
|
* - USE BROWSER: Enables the agent to use a web browser tool
|
|
10724
10724
|
* - USE SEARCH ENGINE (future): Enables search engine access
|
|
10725
|
+
* - USE DEEPSEARCH: Enables deeper research-oriented search access
|
|
10725
10726
|
* - USE FILE SYSTEM (future): Enables file system operations
|
|
10726
10727
|
* - USE MCP (future): Enables MCP server connections
|
|
10727
10728
|
*
|
|
@@ -10744,7 +10745,7 @@ class UseCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
10744
10745
|
* Short one-line description of USE commitments.
|
|
10745
10746
|
*/
|
|
10746
10747
|
get description() {
|
|
10747
|
-
return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, etc.).';
|
|
10748
|
+
return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, DEEPSEARCH, etc.).';
|
|
10748
10749
|
}
|
|
10749
10750
|
/**
|
|
10750
10751
|
* Icon for this commitment.
|
|
@@ -10765,6 +10766,7 @@ class UseCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
10765
10766
|
|
|
10766
10767
|
- **USE BROWSER** - Enables the agent to use a web browser tool to access and retrieve information from the internet
|
|
10767
10768
|
- **USE SEARCH ENGINE** (future) - Enables search engine access
|
|
10769
|
+
- **USE DEEPSEARCH** - Enables deeper research-oriented search access
|
|
10768
10770
|
- **USE FILE SYSTEM** (future) - Enables file system operations
|
|
10769
10771
|
- **USE MCP** (future) - Enables MCP server connections
|
|
10770
10772
|
|
|
@@ -10819,7 +10821,7 @@ class UseCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
10819
10821
|
* Checks if this is a known USE type
|
|
10820
10822
|
*/
|
|
10821
10823
|
isKnownUseType(useType) {
|
|
10822
|
-
const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'FILE SYSTEM', 'MCP'];
|
|
10824
|
+
const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'DEEPSEARCH', 'FILE SYSTEM', 'MCP'];
|
|
10823
10825
|
return knownTypes.includes(useType.toUpperCase());
|
|
10824
10826
|
}
|
|
10825
10827
|
}
|
|
@@ -10832,6 +10834,7 @@ class UseCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
10832
10834
|
*/
|
|
10833
10835
|
const AGGREGATED_USE_COMMITMENT_TYPES = [
|
|
10834
10836
|
'USE BROWSER',
|
|
10837
|
+
'USE DEEPSEARCH',
|
|
10835
10838
|
'USE SEARCH ENGINE',
|
|
10836
10839
|
'USE TIME',
|
|
10837
10840
|
];
|
|
@@ -10911,6 +10914,15 @@ function createAggregatedUseCommitmentSystemMessage(type, additionalInstructions
|
|
|
10911
10914
|
- Do not tell the user you cannot search for information, YOU CAN.
|
|
10912
10915
|
${block(formatOptionalInstructionBlock('Search instructions', combinedAdditionalInstructions))}
|
|
10913
10916
|
`);
|
|
10917
|
+
case 'USE DEEPSEARCH':
|
|
10918
|
+
return spaceTrim$1((block) => `
|
|
10919
|
+
Tool:
|
|
10920
|
+
- You have access to DeepSearch via the tool "deep_search".
|
|
10921
|
+
- Use it for broader research tasks that need multi-step investigation, comparison, or synthesis across multiple sources.
|
|
10922
|
+
- Prefer it over quick search when the user asks for a well-grounded brief, report, or deeper investigation.
|
|
10923
|
+
- Do not pretend you cannot research current information when this tool is available.
|
|
10924
|
+
${block(formatOptionalInstructionBlock('DeepSearch instructions', combinedAdditionalInstructions))}
|
|
10925
|
+
`);
|
|
10914
10926
|
}
|
|
10915
10927
|
}
|
|
10916
10928
|
/**
|
|
@@ -12460,6 +12472,207 @@ function addConfiguredCalendarIfMissing(configuredCalendars, calendarReference)
|
|
|
12460
12472
|
}
|
|
12461
12473
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12462
12474
|
|
|
12475
|
+
/**
|
|
12476
|
+
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
12477
|
+
*
|
|
12478
|
+
* @private <- TODO: !!!! Export via some package
|
|
12479
|
+
*/
|
|
12480
|
+
class SerpSearchEngine {
|
|
12481
|
+
get title() {
|
|
12482
|
+
return 'SerpApi Search Engine';
|
|
12483
|
+
}
|
|
12484
|
+
get description() {
|
|
12485
|
+
return 'Search engine that uses SerpApi to fetch Google search results';
|
|
12486
|
+
}
|
|
12487
|
+
checkConfiguration() {
|
|
12488
|
+
if (!process.env.SERP_API_KEY) {
|
|
12489
|
+
throw new Error('SERP_API_KEY is not configured');
|
|
12490
|
+
}
|
|
12491
|
+
}
|
|
12492
|
+
async search(query, options = {}) {
|
|
12493
|
+
const apiKey = process.env.SERP_API_KEY;
|
|
12494
|
+
if (!apiKey) {
|
|
12495
|
+
throw new Error('SERP_API_KEY is not configured');
|
|
12496
|
+
}
|
|
12497
|
+
const url = new URL('https://serpapi.com/search');
|
|
12498
|
+
url.searchParams.set('api_key', apiKey);
|
|
12499
|
+
url.searchParams.set('engine', 'google');
|
|
12500
|
+
url.searchParams.set('q', query);
|
|
12501
|
+
for (const [key, value] of Object.entries(options)) {
|
|
12502
|
+
url.searchParams.set(key, String(value));
|
|
12503
|
+
}
|
|
12504
|
+
const response = await fetch(url.toString());
|
|
12505
|
+
if (!response.ok) {
|
|
12506
|
+
const body = await response.text();
|
|
12507
|
+
throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
|
|
12508
|
+
}
|
|
12509
|
+
const data = (await response.json());
|
|
12510
|
+
return (data.organic_results || []).map((item) => ({
|
|
12511
|
+
title: item.title,
|
|
12512
|
+
url: item.link,
|
|
12513
|
+
snippet: item.snippet || '',
|
|
12514
|
+
}));
|
|
12515
|
+
}
|
|
12516
|
+
}
|
|
12517
|
+
|
|
12518
|
+
/**
|
|
12519
|
+
* Creates one SERP-backed tool function used as a local fallback for search-like commitments.
|
|
12520
|
+
*
|
|
12521
|
+
* @param toolName - Technical tool name used for validation messages.
|
|
12522
|
+
* @param resultLabel - Human-readable label used in formatted results.
|
|
12523
|
+
* @returns Async tool function compatible with commitment tool registration.
|
|
12524
|
+
*
|
|
12525
|
+
* @private internal helper for search-like commitments
|
|
12526
|
+
*/
|
|
12527
|
+
function createSerpSearchToolFunction(toolName, resultLabel) {
|
|
12528
|
+
return async (rawArgs) => {
|
|
12529
|
+
const { query, ...searchOptions } = rawArgs;
|
|
12530
|
+
if (typeof query !== 'string' || !query.trim()) {
|
|
12531
|
+
throw new Error(`${toolName} query is required`);
|
|
12532
|
+
}
|
|
12533
|
+
const searchEngine = new SerpSearchEngine();
|
|
12534
|
+
const results = await searchEngine.search(query, searchOptions);
|
|
12535
|
+
return spaceTrim$1((block) => `
|
|
12536
|
+
${resultLabel} results for "${query}"${Object.keys(searchOptions).length === 0
|
|
12537
|
+
? ''
|
|
12538
|
+
: ` with options ${JSON.stringify(searchOptions)}`}:
|
|
12539
|
+
|
|
12540
|
+
${block(results
|
|
12541
|
+
.map((result) => spaceTrim$1(`
|
|
12542
|
+
- **${result.title}**
|
|
12543
|
+
${result.url}
|
|
12544
|
+
${result.snippet}
|
|
12545
|
+
`))
|
|
12546
|
+
.join('\n\n'))}
|
|
12547
|
+
`);
|
|
12548
|
+
};
|
|
12549
|
+
}
|
|
12550
|
+
|
|
12551
|
+
/**
|
|
12552
|
+
* USE DEEPSEARCH commitment definition
|
|
12553
|
+
*
|
|
12554
|
+
* The `USE DEEPSEARCH` commitment indicates that the agent should use a deeper research-oriented
|
|
12555
|
+
* search workflow instead of lightweight web search when it needs fresh information from the internet.
|
|
12556
|
+
*
|
|
12557
|
+
* The content following `USE DEEPSEARCH` is an arbitrary text that the agent should know
|
|
12558
|
+
* (e.g. search scope or research instructions).
|
|
12559
|
+
*
|
|
12560
|
+
* Example usage in agent source:
|
|
12561
|
+
*
|
|
12562
|
+
* ```book
|
|
12563
|
+
* USE DEEPSEARCH
|
|
12564
|
+
* USE DEEPSEARCH Compare official vendor documentation with independent benchmarks.
|
|
12565
|
+
* ```
|
|
12566
|
+
*
|
|
12567
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
12568
|
+
*/
|
|
12569
|
+
class UseDeepSearchCommitmentDefinition extends BaseCommitmentDefinition {
|
|
12570
|
+
constructor() {
|
|
12571
|
+
super('USE DEEPSEARCH');
|
|
12572
|
+
}
|
|
12573
|
+
get requiresContent() {
|
|
12574
|
+
return false;
|
|
12575
|
+
}
|
|
12576
|
+
/**
|
|
12577
|
+
* Short one-line description of USE DEEPSEARCH.
|
|
12578
|
+
*/
|
|
12579
|
+
get description() {
|
|
12580
|
+
return 'Enable the agent to use DeepSearch for more thorough internet research.';
|
|
12581
|
+
}
|
|
12582
|
+
/**
|
|
12583
|
+
* Icon for this commitment.
|
|
12584
|
+
*/
|
|
12585
|
+
get icon() {
|
|
12586
|
+
return '🔬';
|
|
12587
|
+
}
|
|
12588
|
+
/**
|
|
12589
|
+
* Markdown documentation for USE DEEPSEARCH commitment.
|
|
12590
|
+
*/
|
|
12591
|
+
get documentation() {
|
|
12592
|
+
return spaceTrim$1(`
|
|
12593
|
+
# USE DEEPSEARCH
|
|
12594
|
+
|
|
12595
|
+
Enables the agent to use DeepSearch for broader, more thorough internet research than lightweight web search.
|
|
12596
|
+
|
|
12597
|
+
## Key aspects
|
|
12598
|
+
|
|
12599
|
+
- The content following \`USE DEEPSEARCH\` is arbitrary guidance for the research workflow.
|
|
12600
|
+
- In Agents Server, the OpenAI Agents SDK runtime uses a nested deep-research agent for this tool.
|
|
12601
|
+
- Use this for investigations, comparisons, market scans, or other tasks that benefit from deeper synthesis.
|
|
12602
|
+
- Prefer regular \`USE SEARCH ENGINE\` when a quick factual lookup is enough.
|
|
12603
|
+
|
|
12604
|
+
## Examples
|
|
12605
|
+
|
|
12606
|
+
\`\`\`book
|
|
12607
|
+
Due Diligence Researcher
|
|
12608
|
+
|
|
12609
|
+
GOAL Investigate vendors thoroughly before making recommendations.
|
|
12610
|
+
USE DEEPSEARCH Compare official sources with credible third-party analysis.
|
|
12611
|
+
RULE Cite the strongest supporting sources in the final answer.
|
|
12612
|
+
\`\`\`
|
|
12613
|
+
|
|
12614
|
+
\`\`\`book
|
|
12615
|
+
Market Analyst
|
|
12616
|
+
|
|
12617
|
+
GOAL Build concise but well-grounded research briefs.
|
|
12618
|
+
USE DEEPSEARCH Focus on recent public information and competing viewpoints.
|
|
12619
|
+
CLOSED
|
|
12620
|
+
\`\`\`
|
|
12621
|
+
`);
|
|
12622
|
+
}
|
|
12623
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
12624
|
+
const existingTools = requirements.tools || [];
|
|
12625
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'deep_search')
|
|
12626
|
+
? existingTools
|
|
12627
|
+
: [
|
|
12628
|
+
...existingTools,
|
|
12629
|
+
{
|
|
12630
|
+
name: 'deep_search',
|
|
12631
|
+
description: spaceTrim$1(`
|
|
12632
|
+
Research the internet deeply and synthesize a grounded answer.
|
|
12633
|
+
Use this tool for broader investigations, comparisons, and requests that need more than a quick search.
|
|
12634
|
+
`),
|
|
12635
|
+
parameters: {
|
|
12636
|
+
type: 'object',
|
|
12637
|
+
properties: {
|
|
12638
|
+
query: {
|
|
12639
|
+
type: 'string',
|
|
12640
|
+
description: 'The research question or investigation request.',
|
|
12641
|
+
},
|
|
12642
|
+
},
|
|
12643
|
+
required: ['query'],
|
|
12644
|
+
additionalProperties: false,
|
|
12645
|
+
},
|
|
12646
|
+
},
|
|
12647
|
+
];
|
|
12648
|
+
return appendAggregatedUseCommitmentPlaceholder({
|
|
12649
|
+
...requirements,
|
|
12650
|
+
tools: updatedTools,
|
|
12651
|
+
_metadata: {
|
|
12652
|
+
...requirements._metadata,
|
|
12653
|
+
useDeepSearch: content || true,
|
|
12654
|
+
},
|
|
12655
|
+
}, this.type);
|
|
12656
|
+
}
|
|
12657
|
+
/**
|
|
12658
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
12659
|
+
*/
|
|
12660
|
+
getToolTitles() {
|
|
12661
|
+
return {
|
|
12662
|
+
deep_search: 'DeepSearch',
|
|
12663
|
+
};
|
|
12664
|
+
}
|
|
12665
|
+
/**
|
|
12666
|
+
* Gets the local fallback implementation for the `deep_search` tool.
|
|
12667
|
+
*/
|
|
12668
|
+
getToolFunctions() {
|
|
12669
|
+
return {
|
|
12670
|
+
deep_search: createSerpSearchToolFunction('deep_search', 'DeepSearch'),
|
|
12671
|
+
};
|
|
12672
|
+
}
|
|
12673
|
+
}
|
|
12674
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12675
|
+
|
|
12463
12676
|
/**
|
|
12464
12677
|
* Lightweight email token matcher used for `USE EMAIL` first-line parsing.
|
|
12465
12678
|
*
|
|
@@ -14866,49 +15079,6 @@ function addConfiguredProjectIfMissing(configuredProjects, repositoryReference)
|
|
|
14866
15079
|
}
|
|
14867
15080
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14868
15081
|
|
|
14869
|
-
/**
|
|
14870
|
-
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
14871
|
-
*
|
|
14872
|
-
* @private <- TODO: !!!! Export via some package
|
|
14873
|
-
*/
|
|
14874
|
-
class SerpSearchEngine {
|
|
14875
|
-
get title() {
|
|
14876
|
-
return 'SerpApi Search Engine';
|
|
14877
|
-
}
|
|
14878
|
-
get description() {
|
|
14879
|
-
return 'Search engine that uses SerpApi to fetch Google search results';
|
|
14880
|
-
}
|
|
14881
|
-
checkConfiguration() {
|
|
14882
|
-
if (!process.env.SERP_API_KEY) {
|
|
14883
|
-
throw new Error('SERP_API_KEY is not configured');
|
|
14884
|
-
}
|
|
14885
|
-
}
|
|
14886
|
-
async search(query, options = {}) {
|
|
14887
|
-
const apiKey = process.env.SERP_API_KEY;
|
|
14888
|
-
if (!apiKey) {
|
|
14889
|
-
throw new Error('SERP_API_KEY is not configured');
|
|
14890
|
-
}
|
|
14891
|
-
const url = new URL('https://serpapi.com/search');
|
|
14892
|
-
url.searchParams.set('api_key', apiKey);
|
|
14893
|
-
url.searchParams.set('engine', 'google');
|
|
14894
|
-
url.searchParams.set('q', query);
|
|
14895
|
-
for (const [key, value] of Object.entries(options)) {
|
|
14896
|
-
url.searchParams.set(key, String(value));
|
|
14897
|
-
}
|
|
14898
|
-
const response = await fetch(url.toString());
|
|
14899
|
-
if (!response.ok) {
|
|
14900
|
-
const body = await response.text();
|
|
14901
|
-
throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
|
|
14902
|
-
}
|
|
14903
|
-
const data = (await response.json());
|
|
14904
|
-
return (data.organic_results || []).map((item) => ({
|
|
14905
|
-
title: item.title,
|
|
14906
|
-
url: item.link,
|
|
14907
|
-
snippet: item.snippet || '',
|
|
14908
|
-
}));
|
|
14909
|
-
}
|
|
14910
|
-
}
|
|
14911
|
-
|
|
14912
15082
|
/**
|
|
14913
15083
|
* USE SEARCH ENGINE commitment definition
|
|
14914
15084
|
*
|
|
@@ -15052,26 +15222,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15052
15222
|
*/
|
|
15053
15223
|
getToolFunctions() {
|
|
15054
15224
|
return {
|
|
15055
|
-
|
|
15056
|
-
console.log('!!!! [Tool] web_search called', { args });
|
|
15057
|
-
const { query, ...options } = args;
|
|
15058
|
-
if (!query) {
|
|
15059
|
-
throw new Error('Search query is required');
|
|
15060
|
-
}
|
|
15061
|
-
const searchEngine = new SerpSearchEngine();
|
|
15062
|
-
const results = await searchEngine.search(query, options);
|
|
15063
|
-
return spaceTrim$1((block) => `
|
|
15064
|
-
Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
|
|
15065
|
-
|
|
15066
|
-
${block(results
|
|
15067
|
-
.map((result) => spaceTrim$1(`
|
|
15068
|
-
- **${result.title}**
|
|
15069
|
-
${result.url}
|
|
15070
|
-
${result.snippet}
|
|
15071
|
-
`))
|
|
15072
|
-
.join('\n\n'))}
|
|
15073
|
-
`);
|
|
15074
|
-
},
|
|
15225
|
+
web_search: createSerpSearchToolFunction('web_search', 'Search'),
|
|
15075
15226
|
};
|
|
15076
15227
|
}
|
|
15077
15228
|
}
|
|
@@ -16717,6 +16868,7 @@ const COMMITMENT_REGISTRY = [
|
|
|
16717
16868
|
new ClosedCommitmentDefinition(),
|
|
16718
16869
|
new TeamCommitmentDefinition(),
|
|
16719
16870
|
new UseBrowserCommitmentDefinition(),
|
|
16871
|
+
new UseDeepSearchCommitmentDefinition(),
|
|
16720
16872
|
new UseSearchEngineCommitmentDefinition(),
|
|
16721
16873
|
new UseSpawnCommitmentDefinition(),
|
|
16722
16874
|
new UseTimeoutCommitmentDefinition(),
|
|
@@ -17610,6 +17762,11 @@ const SIMPLE_CAPABILITY_BY_COMMITMENT_TYPE = {
|
|
|
17610
17762
|
label: 'Internet',
|
|
17611
17763
|
iconName: 'Search',
|
|
17612
17764
|
},
|
|
17765
|
+
'USE DEEPSEARCH': {
|
|
17766
|
+
type: 'search-engine',
|
|
17767
|
+
label: 'DeepSearch',
|
|
17768
|
+
iconName: 'Search',
|
|
17769
|
+
},
|
|
17613
17770
|
'USE TIME': {
|
|
17614
17771
|
type: 'time',
|
|
17615
17772
|
label: 'Time',
|
|
@@ -27618,6 +27775,14 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
|
|
|
27618
27775
|
* Constant for default agent kit model name.
|
|
27619
27776
|
*/
|
|
27620
27777
|
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
|
|
27778
|
+
/**
|
|
27779
|
+
* Default model used for nested DeepSearch tool invocations.
|
|
27780
|
+
*/
|
|
27781
|
+
const DEFAULT_DEEP_SEARCH_MODEL_NAME = 'o4-mini-deep-research';
|
|
27782
|
+
/**
|
|
27783
|
+
* Tool name used by the Book commitment-backed DeepSearch capability.
|
|
27784
|
+
*/
|
|
27785
|
+
const DEEP_SEARCH_TOOL_NAME = 'deep_search';
|
|
27621
27786
|
/**
|
|
27622
27787
|
* Creates one structured log entry for streamed tool-call updates.
|
|
27623
27788
|
*
|
|
@@ -27660,6 +27825,98 @@ function resolveFinalToolCallState$1(options) {
|
|
|
27660
27825
|
}
|
|
27661
27826
|
return 'COMPLETE';
|
|
27662
27827
|
}
|
|
27828
|
+
/**
|
|
27829
|
+
* Returns true when one tool definition represents the dedicated DeepSearch capability.
|
|
27830
|
+
*
|
|
27831
|
+
* @param toolDefinition - Tool definition from compiled model requirements.
|
|
27832
|
+
* @returns `true` when the tool should be backed by a nested deep-research agent.
|
|
27833
|
+
*
|
|
27834
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
27835
|
+
*/
|
|
27836
|
+
function isDeepSearchToolDefinition(toolDefinition) {
|
|
27837
|
+
return toolDefinition.name === DEEP_SEARCH_TOOL_NAME;
|
|
27838
|
+
}
|
|
27839
|
+
/**
|
|
27840
|
+
* Normalizes Promptbook JSON-schema tool parameters for AgentKit function tools.
|
|
27841
|
+
*
|
|
27842
|
+
* @param parameters - Promptbook tool parameters.
|
|
27843
|
+
* @returns AgentKit-compatible JSON schema or `undefined`.
|
|
27844
|
+
*
|
|
27845
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
27846
|
+
*/
|
|
27847
|
+
function normalizeAgentKitToolParameters(parameters) {
|
|
27848
|
+
var _a, _b;
|
|
27849
|
+
if (!parameters) {
|
|
27850
|
+
return undefined;
|
|
27851
|
+
}
|
|
27852
|
+
return {
|
|
27853
|
+
...parameters,
|
|
27854
|
+
additionalProperties: (_a = parameters.additionalProperties) !== null && _a !== void 0 ? _a : false,
|
|
27855
|
+
required: (_b = parameters.required) !== null && _b !== void 0 ? _b : [],
|
|
27856
|
+
};
|
|
27857
|
+
}
|
|
27858
|
+
/**
|
|
27859
|
+
* Creates instructions for the nested DeepSearch specialist agent.
|
|
27860
|
+
*
|
|
27861
|
+
* @param toolDescription - Model-facing description from the original tool definition.
|
|
27862
|
+
* @returns System instructions for the nested deep-research agent.
|
|
27863
|
+
*
|
|
27864
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
27865
|
+
*/
|
|
27866
|
+
function createDeepSearchAgentInstructions(toolDescription) {
|
|
27867
|
+
const normalizedDescription = toolDescription.trim();
|
|
27868
|
+
return spaceTrim$1((block) => `
|
|
27869
|
+
You are a DeepSearch specialist working as a tool for another agent.
|
|
27870
|
+
Perform thorough, source-grounded public-web research based on the provided request.
|
|
27871
|
+
Use web search to gather current information, compare relevant viewpoints, and synthesize a concise research brief.
|
|
27872
|
+
Do not ask follow-up questions. If the request is not specific enough, state the assumptions you had to make.
|
|
27873
|
+
Include citations in the research brief whenever sources were used.
|
|
27874
|
+
${block(normalizedDescription ? `Tool guidance:\n${normalizedDescription}` : '')}
|
|
27875
|
+
`);
|
|
27876
|
+
}
|
|
27877
|
+
/**
|
|
27878
|
+
* Builds the nested DeepSearch prompt from structured tool arguments.
|
|
27879
|
+
*
|
|
27880
|
+
* @param rawInput - Parsed function-tool arguments provided by the outer agent.
|
|
27881
|
+
* @returns Prompt text passed to the nested deep-research agent.
|
|
27882
|
+
*
|
|
27883
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
27884
|
+
*/
|
|
27885
|
+
function buildDeepSearchToolInput(rawInput) {
|
|
27886
|
+
const input = rawInput && typeof rawInput === 'object' ? rawInput : {};
|
|
27887
|
+
const query = typeof input.query === 'string' ? input.query.trim() : '';
|
|
27888
|
+
const additionalHints = Object.entries(input)
|
|
27889
|
+
.filter(([key, value]) => key !== 'query' && value !== undefined && value !== null && String(value).trim() !== '')
|
|
27890
|
+
.map(([key, value]) => `- ${key}: ${typeof value === 'string' ? value : JSON.stringify(value)}`);
|
|
27891
|
+
return spaceTrim$1((block) => `
|
|
27892
|
+
Research request:
|
|
27893
|
+
${query || JSON.stringify(input)}
|
|
27894
|
+
${block(additionalHints.length > 0 ? `Execution hints:\n${additionalHints.join('\n')}` : '')}
|
|
27895
|
+
`);
|
|
27896
|
+
}
|
|
27897
|
+
/**
|
|
27898
|
+
* Creates the native Agent SDK tool used for `USE DEEPSEARCH`.
|
|
27899
|
+
*
|
|
27900
|
+
* @param toolDefinition - Promptbook tool definition for `deep_search`.
|
|
27901
|
+
* @returns AgentKit tool backed by a nested deep-research agent.
|
|
27902
|
+
*
|
|
27903
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
27904
|
+
*/
|
|
27905
|
+
function createDeepSearchAgentKitTool(toolDefinition) {
|
|
27906
|
+
const deepSearchAgent = new Agent$1({
|
|
27907
|
+
name: 'DeepSearch',
|
|
27908
|
+
model: DEFAULT_DEEP_SEARCH_MODEL_NAME,
|
|
27909
|
+
instructions: createDeepSearchAgentInstructions(toolDefinition.description),
|
|
27910
|
+
tools: [webSearchTool({ searchContextSize: 'high' })],
|
|
27911
|
+
});
|
|
27912
|
+
return deepSearchAgent.asTool({
|
|
27913
|
+
toolName: toolDefinition.name,
|
|
27914
|
+
toolDescription: toolDefinition.description,
|
|
27915
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
27916
|
+
inputBuilder: ({ params }) => buildDeepSearchToolInput(params),
|
|
27917
|
+
customOutputExtractor: (result) => { var _a; return typeof result.finalOutput === 'string' ? result.finalOutput : JSON.stringify((_a = result.finalOutput) !== null && _a !== void 0 ? _a : ''); },
|
|
27918
|
+
});
|
|
27919
|
+
}
|
|
27663
27920
|
/**
|
|
27664
27921
|
* Constant for default JSON schema name.
|
|
27665
27922
|
*/
|
|
@@ -28000,25 +28257,23 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
28000
28257
|
* Builds the tool list for AgentKit, including hosted file search when applicable.
|
|
28001
28258
|
*/
|
|
28002
28259
|
buildAgentKitTools(options) {
|
|
28003
|
-
var _a;
|
|
28004
28260
|
const { tools, vectorStoreId } = options;
|
|
28005
28261
|
const agentKitTools = [];
|
|
28006
28262
|
if (vectorStoreId) {
|
|
28007
28263
|
agentKitTools.push(fileSearchTool(vectorStoreId));
|
|
28008
28264
|
}
|
|
28009
28265
|
if (tools && tools.length > 0) {
|
|
28010
|
-
|
|
28266
|
+
let scriptTools = null;
|
|
28011
28267
|
for (const toolDefinition of tools) {
|
|
28268
|
+
if (isDeepSearchToolDefinition(toolDefinition)) {
|
|
28269
|
+
agentKitTools.push(createDeepSearchAgentKitTool(toolDefinition));
|
|
28270
|
+
continue;
|
|
28271
|
+
}
|
|
28272
|
+
scriptTools !== null && scriptTools !== void 0 ? scriptTools : (scriptTools = this.resolveScriptTools());
|
|
28012
28273
|
agentKitTools.push(tool({
|
|
28013
28274
|
name: toolDefinition.name,
|
|
28014
28275
|
description: toolDefinition.description,
|
|
28015
|
-
parameters: toolDefinition.parameters
|
|
28016
|
-
? {
|
|
28017
|
-
...toolDefinition.parameters,
|
|
28018
|
-
additionalProperties: false,
|
|
28019
|
-
required: (_a = toolDefinition.parameters.required) !== null && _a !== void 0 ? _a : [],
|
|
28020
|
-
}
|
|
28021
|
-
: undefined,
|
|
28276
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
28022
28277
|
strict: false,
|
|
28023
28278
|
execute: async (input, runContext, details) => {
|
|
28024
28279
|
var _a, _b, _c, _d;
|