@promptbook/wizard 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/umd/index.umd.js
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
* @generated
|
|
50
50
|
* @see https://github.com/webgptorg/promptbook
|
|
51
51
|
*/
|
|
52
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
52
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-49';
|
|
53
53
|
/**
|
|
54
54
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
55
55
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -23836,6 +23836,7 @@
|
|
|
23836
23836
|
* Supported USE types:
|
|
23837
23837
|
* - USE BROWSER: Enables the agent to use a web browser tool
|
|
23838
23838
|
* - USE SEARCH ENGINE (future): Enables search engine access
|
|
23839
|
+
* - USE DEEPSEARCH: Enables deeper research-oriented search access
|
|
23839
23840
|
* - USE FILE SYSTEM (future): Enables file system operations
|
|
23840
23841
|
* - USE MCP (future): Enables MCP server connections
|
|
23841
23842
|
*
|
|
@@ -23858,7 +23859,7 @@
|
|
|
23858
23859
|
* Short one-line description of USE commitments.
|
|
23859
23860
|
*/
|
|
23860
23861
|
get description() {
|
|
23861
|
-
return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, etc.).';
|
|
23862
|
+
return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, DEEPSEARCH, etc.).';
|
|
23862
23863
|
}
|
|
23863
23864
|
/**
|
|
23864
23865
|
* Icon for this commitment.
|
|
@@ -23879,6 +23880,7 @@
|
|
|
23879
23880
|
|
|
23880
23881
|
- **USE BROWSER** - Enables the agent to use a web browser tool to access and retrieve information from the internet
|
|
23881
23882
|
- **USE SEARCH ENGINE** (future) - Enables search engine access
|
|
23883
|
+
- **USE DEEPSEARCH** - Enables deeper research-oriented search access
|
|
23882
23884
|
- **USE FILE SYSTEM** (future) - Enables file system operations
|
|
23883
23885
|
- **USE MCP** (future) - Enables MCP server connections
|
|
23884
23886
|
|
|
@@ -23933,7 +23935,7 @@
|
|
|
23933
23935
|
* Checks if this is a known USE type
|
|
23934
23936
|
*/
|
|
23935
23937
|
isKnownUseType(useType) {
|
|
23936
|
-
const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'FILE SYSTEM', 'MCP'];
|
|
23938
|
+
const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'DEEPSEARCH', 'FILE SYSTEM', 'MCP'];
|
|
23937
23939
|
return knownTypes.includes(useType.toUpperCase());
|
|
23938
23940
|
}
|
|
23939
23941
|
}
|
|
@@ -23946,6 +23948,7 @@
|
|
|
23946
23948
|
*/
|
|
23947
23949
|
const AGGREGATED_USE_COMMITMENT_TYPES = [
|
|
23948
23950
|
'USE BROWSER',
|
|
23951
|
+
'USE DEEPSEARCH',
|
|
23949
23952
|
'USE SEARCH ENGINE',
|
|
23950
23953
|
'USE TIME',
|
|
23951
23954
|
];
|
|
@@ -24025,6 +24028,15 @@
|
|
|
24025
24028
|
- Do not tell the user you cannot search for information, YOU CAN.
|
|
24026
24029
|
${block(formatOptionalInstructionBlock('Search instructions', combinedAdditionalInstructions))}
|
|
24027
24030
|
`);
|
|
24031
|
+
case 'USE DEEPSEARCH':
|
|
24032
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
24033
|
+
Tool:
|
|
24034
|
+
- You have access to DeepSearch via the tool "deep_search".
|
|
24035
|
+
- Use it for broader research tasks that need multi-step investigation, comparison, or synthesis across multiple sources.
|
|
24036
|
+
- Prefer it over quick search when the user asks for a well-grounded brief, report, or deeper investigation.
|
|
24037
|
+
- Do not pretend you cannot research current information when this tool is available.
|
|
24038
|
+
${block(formatOptionalInstructionBlock('DeepSearch instructions', combinedAdditionalInstructions))}
|
|
24039
|
+
`);
|
|
24028
24040
|
}
|
|
24029
24041
|
}
|
|
24030
24042
|
/**
|
|
@@ -25574,6 +25586,207 @@
|
|
|
25574
25586
|
}
|
|
25575
25587
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
25576
25588
|
|
|
25589
|
+
/**
|
|
25590
|
+
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
25591
|
+
*
|
|
25592
|
+
* @private <- TODO: !!!! Export via some package
|
|
25593
|
+
*/
|
|
25594
|
+
class SerpSearchEngine {
|
|
25595
|
+
get title() {
|
|
25596
|
+
return 'SerpApi Search Engine';
|
|
25597
|
+
}
|
|
25598
|
+
get description() {
|
|
25599
|
+
return 'Search engine that uses SerpApi to fetch Google search results';
|
|
25600
|
+
}
|
|
25601
|
+
checkConfiguration() {
|
|
25602
|
+
if (!process.env.SERP_API_KEY) {
|
|
25603
|
+
throw new Error('SERP_API_KEY is not configured');
|
|
25604
|
+
}
|
|
25605
|
+
}
|
|
25606
|
+
async search(query, options = {}) {
|
|
25607
|
+
const apiKey = process.env.SERP_API_KEY;
|
|
25608
|
+
if (!apiKey) {
|
|
25609
|
+
throw new Error('SERP_API_KEY is not configured');
|
|
25610
|
+
}
|
|
25611
|
+
const url = new URL('https://serpapi.com/search');
|
|
25612
|
+
url.searchParams.set('api_key', apiKey);
|
|
25613
|
+
url.searchParams.set('engine', 'google');
|
|
25614
|
+
url.searchParams.set('q', query);
|
|
25615
|
+
for (const [key, value] of Object.entries(options)) {
|
|
25616
|
+
url.searchParams.set(key, String(value));
|
|
25617
|
+
}
|
|
25618
|
+
const response = await fetch(url.toString());
|
|
25619
|
+
if (!response.ok) {
|
|
25620
|
+
const body = await response.text();
|
|
25621
|
+
throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
|
|
25622
|
+
}
|
|
25623
|
+
const data = (await response.json());
|
|
25624
|
+
return (data.organic_results || []).map((item) => ({
|
|
25625
|
+
title: item.title,
|
|
25626
|
+
url: item.link,
|
|
25627
|
+
snippet: item.snippet || '',
|
|
25628
|
+
}));
|
|
25629
|
+
}
|
|
25630
|
+
}
|
|
25631
|
+
|
|
25632
|
+
/**
|
|
25633
|
+
* Creates one SERP-backed tool function used as a local fallback for search-like commitments.
|
|
25634
|
+
*
|
|
25635
|
+
* @param toolName - Technical tool name used for validation messages.
|
|
25636
|
+
* @param resultLabel - Human-readable label used in formatted results.
|
|
25637
|
+
* @returns Async tool function compatible with commitment tool registration.
|
|
25638
|
+
*
|
|
25639
|
+
* @private internal helper for search-like commitments
|
|
25640
|
+
*/
|
|
25641
|
+
function createSerpSearchToolFunction(toolName, resultLabel) {
|
|
25642
|
+
return async (rawArgs) => {
|
|
25643
|
+
const { query, ...searchOptions } = rawArgs;
|
|
25644
|
+
if (typeof query !== 'string' || !query.trim()) {
|
|
25645
|
+
throw new Error(`${toolName} query is required`);
|
|
25646
|
+
}
|
|
25647
|
+
const searchEngine = new SerpSearchEngine();
|
|
25648
|
+
const results = await searchEngine.search(query, searchOptions);
|
|
25649
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
25650
|
+
${resultLabel} results for "${query}"${Object.keys(searchOptions).length === 0
|
|
25651
|
+
? ''
|
|
25652
|
+
: ` with options ${JSON.stringify(searchOptions)}`}:
|
|
25653
|
+
|
|
25654
|
+
${block(results
|
|
25655
|
+
.map((result) => _spaceTrim.spaceTrim(`
|
|
25656
|
+
- **${result.title}**
|
|
25657
|
+
${result.url}
|
|
25658
|
+
${result.snippet}
|
|
25659
|
+
`))
|
|
25660
|
+
.join('\n\n'))}
|
|
25661
|
+
`);
|
|
25662
|
+
};
|
|
25663
|
+
}
|
|
25664
|
+
|
|
25665
|
+
/**
|
|
25666
|
+
* USE DEEPSEARCH commitment definition
|
|
25667
|
+
*
|
|
25668
|
+
* The `USE DEEPSEARCH` commitment indicates that the agent should use a deeper research-oriented
|
|
25669
|
+
* search workflow instead of lightweight web search when it needs fresh information from the internet.
|
|
25670
|
+
*
|
|
25671
|
+
* The content following `USE DEEPSEARCH` is an arbitrary text that the agent should know
|
|
25672
|
+
* (e.g. search scope or research instructions).
|
|
25673
|
+
*
|
|
25674
|
+
* Example usage in agent source:
|
|
25675
|
+
*
|
|
25676
|
+
* ```book
|
|
25677
|
+
* USE DEEPSEARCH
|
|
25678
|
+
* USE DEEPSEARCH Compare official vendor documentation with independent benchmarks.
|
|
25679
|
+
* ```
|
|
25680
|
+
*
|
|
25681
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
25682
|
+
*/
|
|
25683
|
+
class UseDeepSearchCommitmentDefinition extends BaseCommitmentDefinition {
|
|
25684
|
+
constructor() {
|
|
25685
|
+
super('USE DEEPSEARCH');
|
|
25686
|
+
}
|
|
25687
|
+
get requiresContent() {
|
|
25688
|
+
return false;
|
|
25689
|
+
}
|
|
25690
|
+
/**
|
|
25691
|
+
* Short one-line description of USE DEEPSEARCH.
|
|
25692
|
+
*/
|
|
25693
|
+
get description() {
|
|
25694
|
+
return 'Enable the agent to use DeepSearch for more thorough internet research.';
|
|
25695
|
+
}
|
|
25696
|
+
/**
|
|
25697
|
+
* Icon for this commitment.
|
|
25698
|
+
*/
|
|
25699
|
+
get icon() {
|
|
25700
|
+
return '🔬';
|
|
25701
|
+
}
|
|
25702
|
+
/**
|
|
25703
|
+
* Markdown documentation for USE DEEPSEARCH commitment.
|
|
25704
|
+
*/
|
|
25705
|
+
get documentation() {
|
|
25706
|
+
return _spaceTrim.spaceTrim(`
|
|
25707
|
+
# USE DEEPSEARCH
|
|
25708
|
+
|
|
25709
|
+
Enables the agent to use DeepSearch for broader, more thorough internet research than lightweight web search.
|
|
25710
|
+
|
|
25711
|
+
## Key aspects
|
|
25712
|
+
|
|
25713
|
+
- The content following \`USE DEEPSEARCH\` is arbitrary guidance for the research workflow.
|
|
25714
|
+
- In Agents Server, the OpenAI Agents SDK runtime uses a nested deep-research agent for this tool.
|
|
25715
|
+
- Use this for investigations, comparisons, market scans, or other tasks that benefit from deeper synthesis.
|
|
25716
|
+
- Prefer regular \`USE SEARCH ENGINE\` when a quick factual lookup is enough.
|
|
25717
|
+
|
|
25718
|
+
## Examples
|
|
25719
|
+
|
|
25720
|
+
\`\`\`book
|
|
25721
|
+
Due Diligence Researcher
|
|
25722
|
+
|
|
25723
|
+
GOAL Investigate vendors thoroughly before making recommendations.
|
|
25724
|
+
USE DEEPSEARCH Compare official sources with credible third-party analysis.
|
|
25725
|
+
RULE Cite the strongest supporting sources in the final answer.
|
|
25726
|
+
\`\`\`
|
|
25727
|
+
|
|
25728
|
+
\`\`\`book
|
|
25729
|
+
Market Analyst
|
|
25730
|
+
|
|
25731
|
+
GOAL Build concise but well-grounded research briefs.
|
|
25732
|
+
USE DEEPSEARCH Focus on recent public information and competing viewpoints.
|
|
25733
|
+
CLOSED
|
|
25734
|
+
\`\`\`
|
|
25735
|
+
`);
|
|
25736
|
+
}
|
|
25737
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
25738
|
+
const existingTools = requirements.tools || [];
|
|
25739
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'deep_search')
|
|
25740
|
+
? existingTools
|
|
25741
|
+
: [
|
|
25742
|
+
...existingTools,
|
|
25743
|
+
{
|
|
25744
|
+
name: 'deep_search',
|
|
25745
|
+
description: _spaceTrim.spaceTrim(`
|
|
25746
|
+
Research the internet deeply and synthesize a grounded answer.
|
|
25747
|
+
Use this tool for broader investigations, comparisons, and requests that need more than a quick search.
|
|
25748
|
+
`),
|
|
25749
|
+
parameters: {
|
|
25750
|
+
type: 'object',
|
|
25751
|
+
properties: {
|
|
25752
|
+
query: {
|
|
25753
|
+
type: 'string',
|
|
25754
|
+
description: 'The research question or investigation request.',
|
|
25755
|
+
},
|
|
25756
|
+
},
|
|
25757
|
+
required: ['query'],
|
|
25758
|
+
additionalProperties: false,
|
|
25759
|
+
},
|
|
25760
|
+
},
|
|
25761
|
+
];
|
|
25762
|
+
return appendAggregatedUseCommitmentPlaceholder({
|
|
25763
|
+
...requirements,
|
|
25764
|
+
tools: updatedTools,
|
|
25765
|
+
_metadata: {
|
|
25766
|
+
...requirements._metadata,
|
|
25767
|
+
useDeepSearch: content || true,
|
|
25768
|
+
},
|
|
25769
|
+
}, this.type);
|
|
25770
|
+
}
|
|
25771
|
+
/**
|
|
25772
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
25773
|
+
*/
|
|
25774
|
+
getToolTitles() {
|
|
25775
|
+
return {
|
|
25776
|
+
deep_search: 'DeepSearch',
|
|
25777
|
+
};
|
|
25778
|
+
}
|
|
25779
|
+
/**
|
|
25780
|
+
* Gets the local fallback implementation for the `deep_search` tool.
|
|
25781
|
+
*/
|
|
25782
|
+
getToolFunctions() {
|
|
25783
|
+
return {
|
|
25784
|
+
deep_search: createSerpSearchToolFunction('deep_search', 'DeepSearch'),
|
|
25785
|
+
};
|
|
25786
|
+
}
|
|
25787
|
+
}
|
|
25788
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
25789
|
+
|
|
25577
25790
|
/**
|
|
25578
25791
|
* Lightweight email token matcher used for `USE EMAIL` first-line parsing.
|
|
25579
25792
|
*
|
|
@@ -27961,49 +28174,6 @@
|
|
|
27961
28174
|
}
|
|
27962
28175
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
27963
28176
|
|
|
27964
|
-
/**
|
|
27965
|
-
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
27966
|
-
*
|
|
27967
|
-
* @private <- TODO: !!!! Export via some package
|
|
27968
|
-
*/
|
|
27969
|
-
class SerpSearchEngine {
|
|
27970
|
-
get title() {
|
|
27971
|
-
return 'SerpApi Search Engine';
|
|
27972
|
-
}
|
|
27973
|
-
get description() {
|
|
27974
|
-
return 'Search engine that uses SerpApi to fetch Google search results';
|
|
27975
|
-
}
|
|
27976
|
-
checkConfiguration() {
|
|
27977
|
-
if (!process.env.SERP_API_KEY) {
|
|
27978
|
-
throw new Error('SERP_API_KEY is not configured');
|
|
27979
|
-
}
|
|
27980
|
-
}
|
|
27981
|
-
async search(query, options = {}) {
|
|
27982
|
-
const apiKey = process.env.SERP_API_KEY;
|
|
27983
|
-
if (!apiKey) {
|
|
27984
|
-
throw new Error('SERP_API_KEY is not configured');
|
|
27985
|
-
}
|
|
27986
|
-
const url = new URL('https://serpapi.com/search');
|
|
27987
|
-
url.searchParams.set('api_key', apiKey);
|
|
27988
|
-
url.searchParams.set('engine', 'google');
|
|
27989
|
-
url.searchParams.set('q', query);
|
|
27990
|
-
for (const [key, value] of Object.entries(options)) {
|
|
27991
|
-
url.searchParams.set(key, String(value));
|
|
27992
|
-
}
|
|
27993
|
-
const response = await fetch(url.toString());
|
|
27994
|
-
if (!response.ok) {
|
|
27995
|
-
const body = await response.text();
|
|
27996
|
-
throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
|
|
27997
|
-
}
|
|
27998
|
-
const data = (await response.json());
|
|
27999
|
-
return (data.organic_results || []).map((item) => ({
|
|
28000
|
-
title: item.title,
|
|
28001
|
-
url: item.link,
|
|
28002
|
-
snippet: item.snippet || '',
|
|
28003
|
-
}));
|
|
28004
|
-
}
|
|
28005
|
-
}
|
|
28006
|
-
|
|
28007
28177
|
/**
|
|
28008
28178
|
* USE SEARCH ENGINE commitment definition
|
|
28009
28179
|
*
|
|
@@ -28147,26 +28317,7 @@
|
|
|
28147
28317
|
*/
|
|
28148
28318
|
getToolFunctions() {
|
|
28149
28319
|
return {
|
|
28150
|
-
|
|
28151
|
-
console.log('!!!! [Tool] web_search called', { args });
|
|
28152
|
-
const { query, ...options } = args;
|
|
28153
|
-
if (!query) {
|
|
28154
|
-
throw new Error('Search query is required');
|
|
28155
|
-
}
|
|
28156
|
-
const searchEngine = new SerpSearchEngine();
|
|
28157
|
-
const results = await searchEngine.search(query, options);
|
|
28158
|
-
return _spaceTrim.spaceTrim((block) => `
|
|
28159
|
-
Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
|
|
28160
|
-
|
|
28161
|
-
${block(results
|
|
28162
|
-
.map((result) => _spaceTrim.spaceTrim(`
|
|
28163
|
-
- **${result.title}**
|
|
28164
|
-
${result.url}
|
|
28165
|
-
${result.snippet}
|
|
28166
|
-
`))
|
|
28167
|
-
.join('\n\n'))}
|
|
28168
|
-
`);
|
|
28169
|
-
},
|
|
28320
|
+
web_search: createSerpSearchToolFunction('web_search', 'Search'),
|
|
28170
28321
|
};
|
|
28171
28322
|
}
|
|
28172
28323
|
}
|
|
@@ -29765,6 +29916,7 @@
|
|
|
29765
29916
|
new ClosedCommitmentDefinition(),
|
|
29766
29917
|
new TeamCommitmentDefinition(),
|
|
29767
29918
|
new UseBrowserCommitmentDefinition(),
|
|
29919
|
+
new UseDeepSearchCommitmentDefinition(),
|
|
29768
29920
|
new UseSearchEngineCommitmentDefinition(),
|
|
29769
29921
|
new UseSpawnCommitmentDefinition(),
|
|
29770
29922
|
new UseTimeoutCommitmentDefinition(),
|
|
@@ -30943,6 +31095,11 @@
|
|
|
30943
31095
|
label: 'Internet',
|
|
30944
31096
|
iconName: 'Search',
|
|
30945
31097
|
},
|
|
31098
|
+
'USE DEEPSEARCH': {
|
|
31099
|
+
type: 'search-engine',
|
|
31100
|
+
label: 'DeepSearch',
|
|
31101
|
+
iconName: 'Search',
|
|
31102
|
+
},
|
|
30946
31103
|
'USE TIME': {
|
|
30947
31104
|
type: 'time',
|
|
30948
31105
|
label: 'Time',
|
|
@@ -39188,6 +39345,14 @@
|
|
|
39188
39345
|
* Constant for default agent kit model name.
|
|
39189
39346
|
*/
|
|
39190
39347
|
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
|
|
39348
|
+
/**
|
|
39349
|
+
* Default model used for nested DeepSearch tool invocations.
|
|
39350
|
+
*/
|
|
39351
|
+
const DEFAULT_DEEP_SEARCH_MODEL_NAME = 'o4-mini-deep-research';
|
|
39352
|
+
/**
|
|
39353
|
+
* Tool name used by the Book commitment-backed DeepSearch capability.
|
|
39354
|
+
*/
|
|
39355
|
+
const DEEP_SEARCH_TOOL_NAME = 'deep_search';
|
|
39191
39356
|
/**
|
|
39192
39357
|
* Creates one structured log entry for streamed tool-call updates.
|
|
39193
39358
|
*
|
|
@@ -39230,6 +39395,98 @@
|
|
|
39230
39395
|
}
|
|
39231
39396
|
return 'COMPLETE';
|
|
39232
39397
|
}
|
|
39398
|
+
/**
|
|
39399
|
+
* Returns true when one tool definition represents the dedicated DeepSearch capability.
|
|
39400
|
+
*
|
|
39401
|
+
* @param toolDefinition - Tool definition from compiled model requirements.
|
|
39402
|
+
* @returns `true` when the tool should be backed by a nested deep-research agent.
|
|
39403
|
+
*
|
|
39404
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
39405
|
+
*/
|
|
39406
|
+
function isDeepSearchToolDefinition(toolDefinition) {
|
|
39407
|
+
return toolDefinition.name === DEEP_SEARCH_TOOL_NAME;
|
|
39408
|
+
}
|
|
39409
|
+
/**
|
|
39410
|
+
* Normalizes Promptbook JSON-schema tool parameters for AgentKit function tools.
|
|
39411
|
+
*
|
|
39412
|
+
* @param parameters - Promptbook tool parameters.
|
|
39413
|
+
* @returns AgentKit-compatible JSON schema or `undefined`.
|
|
39414
|
+
*
|
|
39415
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
39416
|
+
*/
|
|
39417
|
+
function normalizeAgentKitToolParameters(parameters) {
|
|
39418
|
+
var _a, _b;
|
|
39419
|
+
if (!parameters) {
|
|
39420
|
+
return undefined;
|
|
39421
|
+
}
|
|
39422
|
+
return {
|
|
39423
|
+
...parameters,
|
|
39424
|
+
additionalProperties: (_a = parameters.additionalProperties) !== null && _a !== void 0 ? _a : false,
|
|
39425
|
+
required: (_b = parameters.required) !== null && _b !== void 0 ? _b : [],
|
|
39426
|
+
};
|
|
39427
|
+
}
|
|
39428
|
+
/**
|
|
39429
|
+
* Creates instructions for the nested DeepSearch specialist agent.
|
|
39430
|
+
*
|
|
39431
|
+
* @param toolDescription - Model-facing description from the original tool definition.
|
|
39432
|
+
* @returns System instructions for the nested deep-research agent.
|
|
39433
|
+
*
|
|
39434
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
39435
|
+
*/
|
|
39436
|
+
function createDeepSearchAgentInstructions(toolDescription) {
|
|
39437
|
+
const normalizedDescription = toolDescription.trim();
|
|
39438
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
39439
|
+
You are a DeepSearch specialist working as a tool for another agent.
|
|
39440
|
+
Perform thorough, source-grounded public-web research based on the provided request.
|
|
39441
|
+
Use web search to gather current information, compare relevant viewpoints, and synthesize a concise research brief.
|
|
39442
|
+
Do not ask follow-up questions. If the request is not specific enough, state the assumptions you had to make.
|
|
39443
|
+
Include citations in the research brief whenever sources were used.
|
|
39444
|
+
${block(normalizedDescription ? `Tool guidance:\n${normalizedDescription}` : '')}
|
|
39445
|
+
`);
|
|
39446
|
+
}
|
|
39447
|
+
/**
|
|
39448
|
+
* Builds the nested DeepSearch prompt from structured tool arguments.
|
|
39449
|
+
*
|
|
39450
|
+
* @param rawInput - Parsed function-tool arguments provided by the outer agent.
|
|
39451
|
+
* @returns Prompt text passed to the nested deep-research agent.
|
|
39452
|
+
*
|
|
39453
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
39454
|
+
*/
|
|
39455
|
+
function buildDeepSearchToolInput(rawInput) {
|
|
39456
|
+
const input = rawInput && typeof rawInput === 'object' ? rawInput : {};
|
|
39457
|
+
const query = typeof input.query === 'string' ? input.query.trim() : '';
|
|
39458
|
+
const additionalHints = Object.entries(input)
|
|
39459
|
+
.filter(([key, value]) => key !== 'query' && value !== undefined && value !== null && String(value).trim() !== '')
|
|
39460
|
+
.map(([key, value]) => `- ${key}: ${typeof value === 'string' ? value : JSON.stringify(value)}`);
|
|
39461
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
39462
|
+
Research request:
|
|
39463
|
+
${query || JSON.stringify(input)}
|
|
39464
|
+
${block(additionalHints.length > 0 ? `Execution hints:\n${additionalHints.join('\n')}` : '')}
|
|
39465
|
+
`);
|
|
39466
|
+
}
|
|
39467
|
+
/**
|
|
39468
|
+
* Creates the native Agent SDK tool used for `USE DEEPSEARCH`.
|
|
39469
|
+
*
|
|
39470
|
+
* @param toolDefinition - Promptbook tool definition for `deep_search`.
|
|
39471
|
+
* @returns AgentKit tool backed by a nested deep-research agent.
|
|
39472
|
+
*
|
|
39473
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
39474
|
+
*/
|
|
39475
|
+
function createDeepSearchAgentKitTool(toolDefinition) {
|
|
39476
|
+
const deepSearchAgent = new agents.Agent({
|
|
39477
|
+
name: 'DeepSearch',
|
|
39478
|
+
model: DEFAULT_DEEP_SEARCH_MODEL_NAME,
|
|
39479
|
+
instructions: createDeepSearchAgentInstructions(toolDefinition.description),
|
|
39480
|
+
tools: [agents.webSearchTool({ searchContextSize: 'high' })],
|
|
39481
|
+
});
|
|
39482
|
+
return deepSearchAgent.asTool({
|
|
39483
|
+
toolName: toolDefinition.name,
|
|
39484
|
+
toolDescription: toolDefinition.description,
|
|
39485
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
39486
|
+
inputBuilder: ({ params }) => buildDeepSearchToolInput(params),
|
|
39487
|
+
customOutputExtractor: (result) => { var _a; return typeof result.finalOutput === 'string' ? result.finalOutput : JSON.stringify((_a = result.finalOutput) !== null && _a !== void 0 ? _a : ''); },
|
|
39488
|
+
});
|
|
39489
|
+
}
|
|
39233
39490
|
/**
|
|
39234
39491
|
* Constant for default JSON schema name.
|
|
39235
39492
|
*/
|
|
@@ -39570,25 +39827,23 @@
|
|
|
39570
39827
|
* Builds the tool list for AgentKit, including hosted file search when applicable.
|
|
39571
39828
|
*/
|
|
39572
39829
|
buildAgentKitTools(options) {
|
|
39573
|
-
var _a;
|
|
39574
39830
|
const { tools, vectorStoreId } = options;
|
|
39575
39831
|
const agentKitTools = [];
|
|
39576
39832
|
if (vectorStoreId) {
|
|
39577
39833
|
agentKitTools.push(agents.fileSearchTool(vectorStoreId));
|
|
39578
39834
|
}
|
|
39579
39835
|
if (tools && tools.length > 0) {
|
|
39580
|
-
|
|
39836
|
+
let scriptTools = null;
|
|
39581
39837
|
for (const toolDefinition of tools) {
|
|
39838
|
+
if (isDeepSearchToolDefinition(toolDefinition)) {
|
|
39839
|
+
agentKitTools.push(createDeepSearchAgentKitTool(toolDefinition));
|
|
39840
|
+
continue;
|
|
39841
|
+
}
|
|
39842
|
+
scriptTools !== null && scriptTools !== void 0 ? scriptTools : (scriptTools = this.resolveScriptTools());
|
|
39582
39843
|
agentKitTools.push(agents.tool({
|
|
39583
39844
|
name: toolDefinition.name,
|
|
39584
39845
|
description: toolDefinition.description,
|
|
39585
|
-
parameters: toolDefinition.parameters
|
|
39586
|
-
? {
|
|
39587
|
-
...toolDefinition.parameters,
|
|
39588
|
-
additionalProperties: false,
|
|
39589
|
-
required: (_a = toolDefinition.parameters.required) !== null && _a !== void 0 ? _a : [],
|
|
39590
|
-
}
|
|
39591
|
-
: undefined,
|
|
39846
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
39592
39847
|
strict: false,
|
|
39593
39848
|
execute: async (input, runContext, details) => {
|
|
39594
39849
|
var _a, _b, _c, _d;
|