@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.
- 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/avatarInteractionUtils.d.ts +81 -0
- package/esm/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
- package/esm/src/avatars/avatarPointerTracking.d.ts +17 -0
- package/esm/src/avatars/avatarRenderingUtils.d.ts +3 -2
- package/esm/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
- package/esm/src/avatars/index.d.ts +1 -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/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/avatarInteractionUtils.d.ts +81 -0
- package/umd/src/avatars/avatarInteractionUtils.test.d.ts +1 -0
- package/umd/src/avatars/avatarPointerTracking.d.ts +17 -0
- package/umd/src/avatars/avatarRenderingUtils.d.ts +3 -2
- package/umd/src/avatars/avatarRenderingUtils.test.d.ts +1 -0
- package/umd/src/avatars/index.d.ts +1 -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/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
|
@@ -17,7 +17,7 @@ import { Subject, BehaviorSubject } from 'rxjs';
|
|
|
17
17
|
import moment from 'moment';
|
|
18
18
|
import { lookup, extension } from 'mime-types';
|
|
19
19
|
import { parse, unparse } from 'papaparse';
|
|
20
|
-
import { Agent as Agent$1, setDefaultOpenAIClient, setDefaultOpenAIKey, fileSearchTool, tool, run } from '@openai/agents';
|
|
20
|
+
import { Agent as Agent$1, setDefaultOpenAIClient, setDefaultOpenAIKey, fileSearchTool, tool, run, webSearchTool } from '@openai/agents';
|
|
21
21
|
import Bottleneck from 'bottleneck';
|
|
22
22
|
import OpenAI from 'openai';
|
|
23
23
|
|
|
@@ -35,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
35
35
|
* @generated
|
|
36
36
|
* @see https://github.com/webgptorg/promptbook
|
|
37
37
|
*/
|
|
38
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
38
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-48';
|
|
39
39
|
/**
|
|
40
40
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
41
41
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -19583,6 +19583,7 @@ class TemplateCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19583
19583
|
* Supported USE types:
|
|
19584
19584
|
* - USE BROWSER: Enables the agent to use a web browser tool
|
|
19585
19585
|
* - USE SEARCH ENGINE (future): Enables search engine access
|
|
19586
|
+
* - USE DEEPSEARCH: Enables deeper research-oriented search access
|
|
19586
19587
|
* - USE FILE SYSTEM (future): Enables file system operations
|
|
19587
19588
|
* - USE MCP (future): Enables MCP server connections
|
|
19588
19589
|
*
|
|
@@ -19605,7 +19606,7 @@ class UseCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19605
19606
|
* Short one-line description of USE commitments.
|
|
19606
19607
|
*/
|
|
19607
19608
|
get description() {
|
|
19608
|
-
return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, etc.).';
|
|
19609
|
+
return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, DEEPSEARCH, etc.).';
|
|
19609
19610
|
}
|
|
19610
19611
|
/**
|
|
19611
19612
|
* Icon for this commitment.
|
|
@@ -19626,6 +19627,7 @@ class UseCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19626
19627
|
|
|
19627
19628
|
- **USE BROWSER** - Enables the agent to use a web browser tool to access and retrieve information from the internet
|
|
19628
19629
|
- **USE SEARCH ENGINE** (future) - Enables search engine access
|
|
19630
|
+
- **USE DEEPSEARCH** - Enables deeper research-oriented search access
|
|
19629
19631
|
- **USE FILE SYSTEM** (future) - Enables file system operations
|
|
19630
19632
|
- **USE MCP** (future) - Enables MCP server connections
|
|
19631
19633
|
|
|
@@ -19680,7 +19682,7 @@ class UseCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19680
19682
|
* Checks if this is a known USE type
|
|
19681
19683
|
*/
|
|
19682
19684
|
isKnownUseType(useType) {
|
|
19683
|
-
const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'FILE SYSTEM', 'MCP'];
|
|
19685
|
+
const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'DEEPSEARCH', 'FILE SYSTEM', 'MCP'];
|
|
19684
19686
|
return knownTypes.includes(useType.toUpperCase());
|
|
19685
19687
|
}
|
|
19686
19688
|
}
|
|
@@ -19693,6 +19695,7 @@ class UseCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19693
19695
|
*/
|
|
19694
19696
|
const AGGREGATED_USE_COMMITMENT_TYPES = [
|
|
19695
19697
|
'USE BROWSER',
|
|
19698
|
+
'USE DEEPSEARCH',
|
|
19696
19699
|
'USE SEARCH ENGINE',
|
|
19697
19700
|
'USE TIME',
|
|
19698
19701
|
];
|
|
@@ -19772,6 +19775,15 @@ function createAggregatedUseCommitmentSystemMessage(type, additionalInstructions
|
|
|
19772
19775
|
- Do not tell the user you cannot search for information, YOU CAN.
|
|
19773
19776
|
${block(formatOptionalInstructionBlock('Search instructions', combinedAdditionalInstructions))}
|
|
19774
19777
|
`);
|
|
19778
|
+
case 'USE DEEPSEARCH':
|
|
19779
|
+
return spaceTrim$1((block) => `
|
|
19780
|
+
Tool:
|
|
19781
|
+
- You have access to DeepSearch via the tool "deep_search".
|
|
19782
|
+
- Use it for broader research tasks that need multi-step investigation, comparison, or synthesis across multiple sources.
|
|
19783
|
+
- Prefer it over quick search when the user asks for a well-grounded brief, report, or deeper investigation.
|
|
19784
|
+
- Do not pretend you cannot research current information when this tool is available.
|
|
19785
|
+
${block(formatOptionalInstructionBlock('DeepSearch instructions', combinedAdditionalInstructions))}
|
|
19786
|
+
`);
|
|
19775
19787
|
}
|
|
19776
19788
|
}
|
|
19777
19789
|
/**
|
|
@@ -21321,6 +21333,207 @@ function addConfiguredCalendarIfMissing(configuredCalendars, calendarReference)
|
|
|
21321
21333
|
}
|
|
21322
21334
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21323
21335
|
|
|
21336
|
+
/**
|
|
21337
|
+
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
21338
|
+
*
|
|
21339
|
+
* @private <- TODO: !!!! Export via some package
|
|
21340
|
+
*/
|
|
21341
|
+
class SerpSearchEngine {
|
|
21342
|
+
get title() {
|
|
21343
|
+
return 'SerpApi Search Engine';
|
|
21344
|
+
}
|
|
21345
|
+
get description() {
|
|
21346
|
+
return 'Search engine that uses SerpApi to fetch Google search results';
|
|
21347
|
+
}
|
|
21348
|
+
checkConfiguration() {
|
|
21349
|
+
if (!process.env.SERP_API_KEY) {
|
|
21350
|
+
throw new Error('SERP_API_KEY is not configured');
|
|
21351
|
+
}
|
|
21352
|
+
}
|
|
21353
|
+
async search(query, options = {}) {
|
|
21354
|
+
const apiKey = process.env.SERP_API_KEY;
|
|
21355
|
+
if (!apiKey) {
|
|
21356
|
+
throw new Error('SERP_API_KEY is not configured');
|
|
21357
|
+
}
|
|
21358
|
+
const url = new URL('https://serpapi.com/search');
|
|
21359
|
+
url.searchParams.set('api_key', apiKey);
|
|
21360
|
+
url.searchParams.set('engine', 'google');
|
|
21361
|
+
url.searchParams.set('q', query);
|
|
21362
|
+
for (const [key, value] of Object.entries(options)) {
|
|
21363
|
+
url.searchParams.set(key, String(value));
|
|
21364
|
+
}
|
|
21365
|
+
const response = await fetch(url.toString());
|
|
21366
|
+
if (!response.ok) {
|
|
21367
|
+
const body = await response.text();
|
|
21368
|
+
throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
|
|
21369
|
+
}
|
|
21370
|
+
const data = (await response.json());
|
|
21371
|
+
return (data.organic_results || []).map((item) => ({
|
|
21372
|
+
title: item.title,
|
|
21373
|
+
url: item.link,
|
|
21374
|
+
snippet: item.snippet || '',
|
|
21375
|
+
}));
|
|
21376
|
+
}
|
|
21377
|
+
}
|
|
21378
|
+
|
|
21379
|
+
/**
|
|
21380
|
+
* Creates one SERP-backed tool function used as a local fallback for search-like commitments.
|
|
21381
|
+
*
|
|
21382
|
+
* @param toolName - Technical tool name used for validation messages.
|
|
21383
|
+
* @param resultLabel - Human-readable label used in formatted results.
|
|
21384
|
+
* @returns Async tool function compatible with commitment tool registration.
|
|
21385
|
+
*
|
|
21386
|
+
* @private internal helper for search-like commitments
|
|
21387
|
+
*/
|
|
21388
|
+
function createSerpSearchToolFunction(toolName, resultLabel) {
|
|
21389
|
+
return async (rawArgs) => {
|
|
21390
|
+
const { query, ...searchOptions } = rawArgs;
|
|
21391
|
+
if (typeof query !== 'string' || !query.trim()) {
|
|
21392
|
+
throw new Error(`${toolName} query is required`);
|
|
21393
|
+
}
|
|
21394
|
+
const searchEngine = new SerpSearchEngine();
|
|
21395
|
+
const results = await searchEngine.search(query, searchOptions);
|
|
21396
|
+
return spaceTrim$1((block) => `
|
|
21397
|
+
${resultLabel} results for "${query}"${Object.keys(searchOptions).length === 0
|
|
21398
|
+
? ''
|
|
21399
|
+
: ` with options ${JSON.stringify(searchOptions)}`}:
|
|
21400
|
+
|
|
21401
|
+
${block(results
|
|
21402
|
+
.map((result) => spaceTrim$1(`
|
|
21403
|
+
- **${result.title}**
|
|
21404
|
+
${result.url}
|
|
21405
|
+
${result.snippet}
|
|
21406
|
+
`))
|
|
21407
|
+
.join('\n\n'))}
|
|
21408
|
+
`);
|
|
21409
|
+
};
|
|
21410
|
+
}
|
|
21411
|
+
|
|
21412
|
+
/**
|
|
21413
|
+
* USE DEEPSEARCH commitment definition
|
|
21414
|
+
*
|
|
21415
|
+
* The `USE DEEPSEARCH` commitment indicates that the agent should use a deeper research-oriented
|
|
21416
|
+
* search workflow instead of lightweight web search when it needs fresh information from the internet.
|
|
21417
|
+
*
|
|
21418
|
+
* The content following `USE DEEPSEARCH` is an arbitrary text that the agent should know
|
|
21419
|
+
* (e.g. search scope or research instructions).
|
|
21420
|
+
*
|
|
21421
|
+
* Example usage in agent source:
|
|
21422
|
+
*
|
|
21423
|
+
* ```book
|
|
21424
|
+
* USE DEEPSEARCH
|
|
21425
|
+
* USE DEEPSEARCH Compare official vendor documentation with independent benchmarks.
|
|
21426
|
+
* ```
|
|
21427
|
+
*
|
|
21428
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
21429
|
+
*/
|
|
21430
|
+
class UseDeepSearchCommitmentDefinition extends BaseCommitmentDefinition {
|
|
21431
|
+
constructor() {
|
|
21432
|
+
super('USE DEEPSEARCH');
|
|
21433
|
+
}
|
|
21434
|
+
get requiresContent() {
|
|
21435
|
+
return false;
|
|
21436
|
+
}
|
|
21437
|
+
/**
|
|
21438
|
+
* Short one-line description of USE DEEPSEARCH.
|
|
21439
|
+
*/
|
|
21440
|
+
get description() {
|
|
21441
|
+
return 'Enable the agent to use DeepSearch for more thorough internet research.';
|
|
21442
|
+
}
|
|
21443
|
+
/**
|
|
21444
|
+
* Icon for this commitment.
|
|
21445
|
+
*/
|
|
21446
|
+
get icon() {
|
|
21447
|
+
return '🔬';
|
|
21448
|
+
}
|
|
21449
|
+
/**
|
|
21450
|
+
* Markdown documentation for USE DEEPSEARCH commitment.
|
|
21451
|
+
*/
|
|
21452
|
+
get documentation() {
|
|
21453
|
+
return spaceTrim$1(`
|
|
21454
|
+
# USE DEEPSEARCH
|
|
21455
|
+
|
|
21456
|
+
Enables the agent to use DeepSearch for broader, more thorough internet research than lightweight web search.
|
|
21457
|
+
|
|
21458
|
+
## Key aspects
|
|
21459
|
+
|
|
21460
|
+
- The content following \`USE DEEPSEARCH\` is arbitrary guidance for the research workflow.
|
|
21461
|
+
- In Agents Server, the OpenAI Agents SDK runtime uses a nested deep-research agent for this tool.
|
|
21462
|
+
- Use this for investigations, comparisons, market scans, or other tasks that benefit from deeper synthesis.
|
|
21463
|
+
- Prefer regular \`USE SEARCH ENGINE\` when a quick factual lookup is enough.
|
|
21464
|
+
|
|
21465
|
+
## Examples
|
|
21466
|
+
|
|
21467
|
+
\`\`\`book
|
|
21468
|
+
Due Diligence Researcher
|
|
21469
|
+
|
|
21470
|
+
GOAL Investigate vendors thoroughly before making recommendations.
|
|
21471
|
+
USE DEEPSEARCH Compare official sources with credible third-party analysis.
|
|
21472
|
+
RULE Cite the strongest supporting sources in the final answer.
|
|
21473
|
+
\`\`\`
|
|
21474
|
+
|
|
21475
|
+
\`\`\`book
|
|
21476
|
+
Market Analyst
|
|
21477
|
+
|
|
21478
|
+
GOAL Build concise but well-grounded research briefs.
|
|
21479
|
+
USE DEEPSEARCH Focus on recent public information and competing viewpoints.
|
|
21480
|
+
CLOSED
|
|
21481
|
+
\`\`\`
|
|
21482
|
+
`);
|
|
21483
|
+
}
|
|
21484
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
21485
|
+
const existingTools = requirements.tools || [];
|
|
21486
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'deep_search')
|
|
21487
|
+
? existingTools
|
|
21488
|
+
: [
|
|
21489
|
+
...existingTools,
|
|
21490
|
+
{
|
|
21491
|
+
name: 'deep_search',
|
|
21492
|
+
description: spaceTrim$1(`
|
|
21493
|
+
Research the internet deeply and synthesize a grounded answer.
|
|
21494
|
+
Use this tool for broader investigations, comparisons, and requests that need more than a quick search.
|
|
21495
|
+
`),
|
|
21496
|
+
parameters: {
|
|
21497
|
+
type: 'object',
|
|
21498
|
+
properties: {
|
|
21499
|
+
query: {
|
|
21500
|
+
type: 'string',
|
|
21501
|
+
description: 'The research question or investigation request.',
|
|
21502
|
+
},
|
|
21503
|
+
},
|
|
21504
|
+
required: ['query'],
|
|
21505
|
+
additionalProperties: false,
|
|
21506
|
+
},
|
|
21507
|
+
},
|
|
21508
|
+
];
|
|
21509
|
+
return appendAggregatedUseCommitmentPlaceholder({
|
|
21510
|
+
...requirements,
|
|
21511
|
+
tools: updatedTools,
|
|
21512
|
+
_metadata: {
|
|
21513
|
+
...requirements._metadata,
|
|
21514
|
+
useDeepSearch: content || true,
|
|
21515
|
+
},
|
|
21516
|
+
}, this.type);
|
|
21517
|
+
}
|
|
21518
|
+
/**
|
|
21519
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
21520
|
+
*/
|
|
21521
|
+
getToolTitles() {
|
|
21522
|
+
return {
|
|
21523
|
+
deep_search: 'DeepSearch',
|
|
21524
|
+
};
|
|
21525
|
+
}
|
|
21526
|
+
/**
|
|
21527
|
+
* Gets the local fallback implementation for the `deep_search` tool.
|
|
21528
|
+
*/
|
|
21529
|
+
getToolFunctions() {
|
|
21530
|
+
return {
|
|
21531
|
+
deep_search: createSerpSearchToolFunction('deep_search', 'DeepSearch'),
|
|
21532
|
+
};
|
|
21533
|
+
}
|
|
21534
|
+
}
|
|
21535
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21536
|
+
|
|
21324
21537
|
/**
|
|
21325
21538
|
* Lightweight email token matcher used for `USE EMAIL` first-line parsing.
|
|
21326
21539
|
*
|
|
@@ -23708,49 +23921,6 @@ function addConfiguredProjectIfMissing(configuredProjects, repositoryReference)
|
|
|
23708
23921
|
}
|
|
23709
23922
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23710
23923
|
|
|
23711
|
-
/**
|
|
23712
|
-
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
23713
|
-
*
|
|
23714
|
-
* @private <- TODO: !!!! Export via some package
|
|
23715
|
-
*/
|
|
23716
|
-
class SerpSearchEngine {
|
|
23717
|
-
get title() {
|
|
23718
|
-
return 'SerpApi Search Engine';
|
|
23719
|
-
}
|
|
23720
|
-
get description() {
|
|
23721
|
-
return 'Search engine that uses SerpApi to fetch Google search results';
|
|
23722
|
-
}
|
|
23723
|
-
checkConfiguration() {
|
|
23724
|
-
if (!process.env.SERP_API_KEY) {
|
|
23725
|
-
throw new Error('SERP_API_KEY is not configured');
|
|
23726
|
-
}
|
|
23727
|
-
}
|
|
23728
|
-
async search(query, options = {}) {
|
|
23729
|
-
const apiKey = process.env.SERP_API_KEY;
|
|
23730
|
-
if (!apiKey) {
|
|
23731
|
-
throw new Error('SERP_API_KEY is not configured');
|
|
23732
|
-
}
|
|
23733
|
-
const url = new URL('https://serpapi.com/search');
|
|
23734
|
-
url.searchParams.set('api_key', apiKey);
|
|
23735
|
-
url.searchParams.set('engine', 'google');
|
|
23736
|
-
url.searchParams.set('q', query);
|
|
23737
|
-
for (const [key, value] of Object.entries(options)) {
|
|
23738
|
-
url.searchParams.set(key, String(value));
|
|
23739
|
-
}
|
|
23740
|
-
const response = await fetch(url.toString());
|
|
23741
|
-
if (!response.ok) {
|
|
23742
|
-
const body = await response.text();
|
|
23743
|
-
throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
|
|
23744
|
-
}
|
|
23745
|
-
const data = (await response.json());
|
|
23746
|
-
return (data.organic_results || []).map((item) => ({
|
|
23747
|
-
title: item.title,
|
|
23748
|
-
url: item.link,
|
|
23749
|
-
snippet: item.snippet || '',
|
|
23750
|
-
}));
|
|
23751
|
-
}
|
|
23752
|
-
}
|
|
23753
|
-
|
|
23754
23924
|
/**
|
|
23755
23925
|
* USE SEARCH ENGINE commitment definition
|
|
23756
23926
|
*
|
|
@@ -23894,26 +24064,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
23894
24064
|
*/
|
|
23895
24065
|
getToolFunctions() {
|
|
23896
24066
|
return {
|
|
23897
|
-
|
|
23898
|
-
console.log('!!!! [Tool] web_search called', { args });
|
|
23899
|
-
const { query, ...options } = args;
|
|
23900
|
-
if (!query) {
|
|
23901
|
-
throw new Error('Search query is required');
|
|
23902
|
-
}
|
|
23903
|
-
const searchEngine = new SerpSearchEngine();
|
|
23904
|
-
const results = await searchEngine.search(query, options);
|
|
23905
|
-
return spaceTrim$1((block) => `
|
|
23906
|
-
Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
|
|
23907
|
-
|
|
23908
|
-
${block(results
|
|
23909
|
-
.map((result) => spaceTrim$1(`
|
|
23910
|
-
- **${result.title}**
|
|
23911
|
-
${result.url}
|
|
23912
|
-
${result.snippet}
|
|
23913
|
-
`))
|
|
23914
|
-
.join('\n\n'))}
|
|
23915
|
-
`);
|
|
23916
|
-
},
|
|
24067
|
+
web_search: createSerpSearchToolFunction('web_search', 'Search'),
|
|
23917
24068
|
};
|
|
23918
24069
|
}
|
|
23919
24070
|
}
|
|
@@ -25559,6 +25710,7 @@ const COMMITMENT_REGISTRY = [
|
|
|
25559
25710
|
new ClosedCommitmentDefinition(),
|
|
25560
25711
|
new TeamCommitmentDefinition(),
|
|
25561
25712
|
new UseBrowserCommitmentDefinition(),
|
|
25713
|
+
new UseDeepSearchCommitmentDefinition(),
|
|
25562
25714
|
new UseSearchEngineCommitmentDefinition(),
|
|
25563
25715
|
new UseSpawnCommitmentDefinition(),
|
|
25564
25716
|
new UseTimeoutCommitmentDefinition(),
|
|
@@ -28152,6 +28304,11 @@ const SIMPLE_CAPABILITY_BY_COMMITMENT_TYPE = {
|
|
|
28152
28304
|
label: 'Internet',
|
|
28153
28305
|
iconName: 'Search',
|
|
28154
28306
|
},
|
|
28307
|
+
'USE DEEPSEARCH': {
|
|
28308
|
+
type: 'search-engine',
|
|
28309
|
+
label: 'DeepSearch',
|
|
28310
|
+
iconName: 'Search',
|
|
28311
|
+
},
|
|
28155
28312
|
'USE TIME': {
|
|
28156
28313
|
type: 'time',
|
|
28157
28314
|
label: 'Time',
|
|
@@ -33397,6 +33554,14 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
|
|
|
33397
33554
|
* Constant for default agent kit model name.
|
|
33398
33555
|
*/
|
|
33399
33556
|
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
|
|
33557
|
+
/**
|
|
33558
|
+
* Default model used for nested DeepSearch tool invocations.
|
|
33559
|
+
*/
|
|
33560
|
+
const DEFAULT_DEEP_SEARCH_MODEL_NAME = 'o4-mini-deep-research';
|
|
33561
|
+
/**
|
|
33562
|
+
* Tool name used by the Book commitment-backed DeepSearch capability.
|
|
33563
|
+
*/
|
|
33564
|
+
const DEEP_SEARCH_TOOL_NAME = 'deep_search';
|
|
33400
33565
|
/**
|
|
33401
33566
|
* Creates one structured log entry for streamed tool-call updates.
|
|
33402
33567
|
*
|
|
@@ -33439,6 +33604,98 @@ function resolveFinalToolCallState$1(options) {
|
|
|
33439
33604
|
}
|
|
33440
33605
|
return 'COMPLETE';
|
|
33441
33606
|
}
|
|
33607
|
+
/**
|
|
33608
|
+
* Returns true when one tool definition represents the dedicated DeepSearch capability.
|
|
33609
|
+
*
|
|
33610
|
+
* @param toolDefinition - Tool definition from compiled model requirements.
|
|
33611
|
+
* @returns `true` when the tool should be backed by a nested deep-research agent.
|
|
33612
|
+
*
|
|
33613
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
33614
|
+
*/
|
|
33615
|
+
function isDeepSearchToolDefinition(toolDefinition) {
|
|
33616
|
+
return toolDefinition.name === DEEP_SEARCH_TOOL_NAME;
|
|
33617
|
+
}
|
|
33618
|
+
/**
|
|
33619
|
+
* Normalizes Promptbook JSON-schema tool parameters for AgentKit function tools.
|
|
33620
|
+
*
|
|
33621
|
+
* @param parameters - Promptbook tool parameters.
|
|
33622
|
+
* @returns AgentKit-compatible JSON schema or `undefined`.
|
|
33623
|
+
*
|
|
33624
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
33625
|
+
*/
|
|
33626
|
+
function normalizeAgentKitToolParameters(parameters) {
|
|
33627
|
+
var _a, _b;
|
|
33628
|
+
if (!parameters) {
|
|
33629
|
+
return undefined;
|
|
33630
|
+
}
|
|
33631
|
+
return {
|
|
33632
|
+
...parameters,
|
|
33633
|
+
additionalProperties: (_a = parameters.additionalProperties) !== null && _a !== void 0 ? _a : false,
|
|
33634
|
+
required: (_b = parameters.required) !== null && _b !== void 0 ? _b : [],
|
|
33635
|
+
};
|
|
33636
|
+
}
|
|
33637
|
+
/**
|
|
33638
|
+
* Creates instructions for the nested DeepSearch specialist agent.
|
|
33639
|
+
*
|
|
33640
|
+
* @param toolDescription - Model-facing description from the original tool definition.
|
|
33641
|
+
* @returns System instructions for the nested deep-research agent.
|
|
33642
|
+
*
|
|
33643
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
33644
|
+
*/
|
|
33645
|
+
function createDeepSearchAgentInstructions(toolDescription) {
|
|
33646
|
+
const normalizedDescription = toolDescription.trim();
|
|
33647
|
+
return spaceTrim$1((block) => `
|
|
33648
|
+
You are a DeepSearch specialist working as a tool for another agent.
|
|
33649
|
+
Perform thorough, source-grounded public-web research based on the provided request.
|
|
33650
|
+
Use web search to gather current information, compare relevant viewpoints, and synthesize a concise research brief.
|
|
33651
|
+
Do not ask follow-up questions. If the request is not specific enough, state the assumptions you had to make.
|
|
33652
|
+
Include citations in the research brief whenever sources were used.
|
|
33653
|
+
${block(normalizedDescription ? `Tool guidance:\n${normalizedDescription}` : '')}
|
|
33654
|
+
`);
|
|
33655
|
+
}
|
|
33656
|
+
/**
|
|
33657
|
+
* Builds the nested DeepSearch prompt from structured tool arguments.
|
|
33658
|
+
*
|
|
33659
|
+
* @param rawInput - Parsed function-tool arguments provided by the outer agent.
|
|
33660
|
+
* @returns Prompt text passed to the nested deep-research agent.
|
|
33661
|
+
*
|
|
33662
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
33663
|
+
*/
|
|
33664
|
+
function buildDeepSearchToolInput(rawInput) {
|
|
33665
|
+
const input = rawInput && typeof rawInput === 'object' ? rawInput : {};
|
|
33666
|
+
const query = typeof input.query === 'string' ? input.query.trim() : '';
|
|
33667
|
+
const additionalHints = Object.entries(input)
|
|
33668
|
+
.filter(([key, value]) => key !== 'query' && value !== undefined && value !== null && String(value).trim() !== '')
|
|
33669
|
+
.map(([key, value]) => `- ${key}: ${typeof value === 'string' ? value : JSON.stringify(value)}`);
|
|
33670
|
+
return spaceTrim$1((block) => `
|
|
33671
|
+
Research request:
|
|
33672
|
+
${query || JSON.stringify(input)}
|
|
33673
|
+
${block(additionalHints.length > 0 ? `Execution hints:\n${additionalHints.join('\n')}` : '')}
|
|
33674
|
+
`);
|
|
33675
|
+
}
|
|
33676
|
+
/**
|
|
33677
|
+
* Creates the native Agent SDK tool used for `USE DEEPSEARCH`.
|
|
33678
|
+
*
|
|
33679
|
+
* @param toolDefinition - Promptbook tool definition for `deep_search`.
|
|
33680
|
+
* @returns AgentKit tool backed by a nested deep-research agent.
|
|
33681
|
+
*
|
|
33682
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
33683
|
+
*/
|
|
33684
|
+
function createDeepSearchAgentKitTool(toolDefinition) {
|
|
33685
|
+
const deepSearchAgent = new Agent$1({
|
|
33686
|
+
name: 'DeepSearch',
|
|
33687
|
+
model: DEFAULT_DEEP_SEARCH_MODEL_NAME,
|
|
33688
|
+
instructions: createDeepSearchAgentInstructions(toolDefinition.description),
|
|
33689
|
+
tools: [webSearchTool({ searchContextSize: 'high' })],
|
|
33690
|
+
});
|
|
33691
|
+
return deepSearchAgent.asTool({
|
|
33692
|
+
toolName: toolDefinition.name,
|
|
33693
|
+
toolDescription: toolDefinition.description,
|
|
33694
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
33695
|
+
inputBuilder: ({ params }) => buildDeepSearchToolInput(params),
|
|
33696
|
+
customOutputExtractor: (result) => { var _a; return typeof result.finalOutput === 'string' ? result.finalOutput : JSON.stringify((_a = result.finalOutput) !== null && _a !== void 0 ? _a : ''); },
|
|
33697
|
+
});
|
|
33698
|
+
}
|
|
33442
33699
|
/**
|
|
33443
33700
|
* Constant for default JSON schema name.
|
|
33444
33701
|
*/
|
|
@@ -33779,25 +34036,23 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
33779
34036
|
* Builds the tool list for AgentKit, including hosted file search when applicable.
|
|
33780
34037
|
*/
|
|
33781
34038
|
buildAgentKitTools(options) {
|
|
33782
|
-
var _a;
|
|
33783
34039
|
const { tools, vectorStoreId } = options;
|
|
33784
34040
|
const agentKitTools = [];
|
|
33785
34041
|
if (vectorStoreId) {
|
|
33786
34042
|
agentKitTools.push(fileSearchTool(vectorStoreId));
|
|
33787
34043
|
}
|
|
33788
34044
|
if (tools && tools.length > 0) {
|
|
33789
|
-
|
|
34045
|
+
let scriptTools = null;
|
|
33790
34046
|
for (const toolDefinition of tools) {
|
|
34047
|
+
if (isDeepSearchToolDefinition(toolDefinition)) {
|
|
34048
|
+
agentKitTools.push(createDeepSearchAgentKitTool(toolDefinition));
|
|
34049
|
+
continue;
|
|
34050
|
+
}
|
|
34051
|
+
scriptTools !== null && scriptTools !== void 0 ? scriptTools : (scriptTools = this.resolveScriptTools());
|
|
33791
34052
|
agentKitTools.push(tool({
|
|
33792
34053
|
name: toolDefinition.name,
|
|
33793
34054
|
description: toolDefinition.description,
|
|
33794
|
-
parameters: toolDefinition.parameters
|
|
33795
|
-
? {
|
|
33796
|
-
...toolDefinition.parameters,
|
|
33797
|
-
additionalProperties: false,
|
|
33798
|
-
required: (_a = toolDefinition.parameters.required) !== null && _a !== void 0 ? _a : [],
|
|
33799
|
-
}
|
|
33800
|
-
: undefined,
|
|
34055
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
33801
34056
|
strict: false,
|
|
33802
34057
|
execute: async (input, runContext, details) => {
|
|
33803
34058
|
var _a, _b, _c, _d;
|