@promptbook/remote-server 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
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* @generated
|
|
51
51
|
* @see https://github.com/webgptorg/promptbook
|
|
52
52
|
*/
|
|
53
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
53
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-49';
|
|
54
54
|
/**
|
|
55
55
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
56
56
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -16434,6 +16434,7 @@
|
|
|
16434
16434
|
* Supported USE types:
|
|
16435
16435
|
* - USE BROWSER: Enables the agent to use a web browser tool
|
|
16436
16436
|
* - USE SEARCH ENGINE (future): Enables search engine access
|
|
16437
|
+
* - USE DEEPSEARCH: Enables deeper research-oriented search access
|
|
16437
16438
|
* - USE FILE SYSTEM (future): Enables file system operations
|
|
16438
16439
|
* - USE MCP (future): Enables MCP server connections
|
|
16439
16440
|
*
|
|
@@ -16456,7 +16457,7 @@
|
|
|
16456
16457
|
* Short one-line description of USE commitments.
|
|
16457
16458
|
*/
|
|
16458
16459
|
get description() {
|
|
16459
|
-
return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, etc.).';
|
|
16460
|
+
return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, DEEPSEARCH, etc.).';
|
|
16460
16461
|
}
|
|
16461
16462
|
/**
|
|
16462
16463
|
* Icon for this commitment.
|
|
@@ -16477,6 +16478,7 @@
|
|
|
16477
16478
|
|
|
16478
16479
|
- **USE BROWSER** - Enables the agent to use a web browser tool to access and retrieve information from the internet
|
|
16479
16480
|
- **USE SEARCH ENGINE** (future) - Enables search engine access
|
|
16481
|
+
- **USE DEEPSEARCH** - Enables deeper research-oriented search access
|
|
16480
16482
|
- **USE FILE SYSTEM** (future) - Enables file system operations
|
|
16481
16483
|
- **USE MCP** (future) - Enables MCP server connections
|
|
16482
16484
|
|
|
@@ -16531,7 +16533,7 @@
|
|
|
16531
16533
|
* Checks if this is a known USE type
|
|
16532
16534
|
*/
|
|
16533
16535
|
isKnownUseType(useType) {
|
|
16534
|
-
const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'FILE SYSTEM', 'MCP'];
|
|
16536
|
+
const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'DEEPSEARCH', 'FILE SYSTEM', 'MCP'];
|
|
16535
16537
|
return knownTypes.includes(useType.toUpperCase());
|
|
16536
16538
|
}
|
|
16537
16539
|
}
|
|
@@ -16544,6 +16546,7 @@
|
|
|
16544
16546
|
*/
|
|
16545
16547
|
const AGGREGATED_USE_COMMITMENT_TYPES = [
|
|
16546
16548
|
'USE BROWSER',
|
|
16549
|
+
'USE DEEPSEARCH',
|
|
16547
16550
|
'USE SEARCH ENGINE',
|
|
16548
16551
|
'USE TIME',
|
|
16549
16552
|
];
|
|
@@ -16623,6 +16626,15 @@
|
|
|
16623
16626
|
- Do not tell the user you cannot search for information, YOU CAN.
|
|
16624
16627
|
${block(formatOptionalInstructionBlock('Search instructions', combinedAdditionalInstructions))}
|
|
16625
16628
|
`);
|
|
16629
|
+
case 'USE DEEPSEARCH':
|
|
16630
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
16631
|
+
Tool:
|
|
16632
|
+
- You have access to DeepSearch via the tool "deep_search".
|
|
16633
|
+
- Use it for broader research tasks that need multi-step investigation, comparison, or synthesis across multiple sources.
|
|
16634
|
+
- Prefer it over quick search when the user asks for a well-grounded brief, report, or deeper investigation.
|
|
16635
|
+
- Do not pretend you cannot research current information when this tool is available.
|
|
16636
|
+
${block(formatOptionalInstructionBlock('DeepSearch instructions', combinedAdditionalInstructions))}
|
|
16637
|
+
`);
|
|
16626
16638
|
}
|
|
16627
16639
|
}
|
|
16628
16640
|
/**
|
|
@@ -18172,6 +18184,207 @@
|
|
|
18172
18184
|
}
|
|
18173
18185
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18174
18186
|
|
|
18187
|
+
/**
|
|
18188
|
+
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
18189
|
+
*
|
|
18190
|
+
* @private <- TODO: !!!! Export via some package
|
|
18191
|
+
*/
|
|
18192
|
+
class SerpSearchEngine {
|
|
18193
|
+
get title() {
|
|
18194
|
+
return 'SerpApi Search Engine';
|
|
18195
|
+
}
|
|
18196
|
+
get description() {
|
|
18197
|
+
return 'Search engine that uses SerpApi to fetch Google search results';
|
|
18198
|
+
}
|
|
18199
|
+
checkConfiguration() {
|
|
18200
|
+
if (!process.env.SERP_API_KEY) {
|
|
18201
|
+
throw new Error('SERP_API_KEY is not configured');
|
|
18202
|
+
}
|
|
18203
|
+
}
|
|
18204
|
+
async search(query, options = {}) {
|
|
18205
|
+
const apiKey = process.env.SERP_API_KEY;
|
|
18206
|
+
if (!apiKey) {
|
|
18207
|
+
throw new Error('SERP_API_KEY is not configured');
|
|
18208
|
+
}
|
|
18209
|
+
const url = new URL('https://serpapi.com/search');
|
|
18210
|
+
url.searchParams.set('api_key', apiKey);
|
|
18211
|
+
url.searchParams.set('engine', 'google');
|
|
18212
|
+
url.searchParams.set('q', query);
|
|
18213
|
+
for (const [key, value] of Object.entries(options)) {
|
|
18214
|
+
url.searchParams.set(key, String(value));
|
|
18215
|
+
}
|
|
18216
|
+
const response = await fetch(url.toString());
|
|
18217
|
+
if (!response.ok) {
|
|
18218
|
+
const body = await response.text();
|
|
18219
|
+
throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
|
|
18220
|
+
}
|
|
18221
|
+
const data = (await response.json());
|
|
18222
|
+
return (data.organic_results || []).map((item) => ({
|
|
18223
|
+
title: item.title,
|
|
18224
|
+
url: item.link,
|
|
18225
|
+
snippet: item.snippet || '',
|
|
18226
|
+
}));
|
|
18227
|
+
}
|
|
18228
|
+
}
|
|
18229
|
+
|
|
18230
|
+
/**
|
|
18231
|
+
* Creates one SERP-backed tool function used as a local fallback for search-like commitments.
|
|
18232
|
+
*
|
|
18233
|
+
* @param toolName - Technical tool name used for validation messages.
|
|
18234
|
+
* @param resultLabel - Human-readable label used in formatted results.
|
|
18235
|
+
* @returns Async tool function compatible with commitment tool registration.
|
|
18236
|
+
*
|
|
18237
|
+
* @private internal helper for search-like commitments
|
|
18238
|
+
*/
|
|
18239
|
+
function createSerpSearchToolFunction(toolName, resultLabel) {
|
|
18240
|
+
return async (rawArgs) => {
|
|
18241
|
+
const { query, ...searchOptions } = rawArgs;
|
|
18242
|
+
if (typeof query !== 'string' || !query.trim()) {
|
|
18243
|
+
throw new Error(`${toolName} query is required`);
|
|
18244
|
+
}
|
|
18245
|
+
const searchEngine = new SerpSearchEngine();
|
|
18246
|
+
const results = await searchEngine.search(query, searchOptions);
|
|
18247
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
18248
|
+
${resultLabel} results for "${query}"${Object.keys(searchOptions).length === 0
|
|
18249
|
+
? ''
|
|
18250
|
+
: ` with options ${JSON.stringify(searchOptions)}`}:
|
|
18251
|
+
|
|
18252
|
+
${block(results
|
|
18253
|
+
.map((result) => _spaceTrim.spaceTrim(`
|
|
18254
|
+
- **${result.title}**
|
|
18255
|
+
${result.url}
|
|
18256
|
+
${result.snippet}
|
|
18257
|
+
`))
|
|
18258
|
+
.join('\n\n'))}
|
|
18259
|
+
`);
|
|
18260
|
+
};
|
|
18261
|
+
}
|
|
18262
|
+
|
|
18263
|
+
/**
|
|
18264
|
+
* USE DEEPSEARCH commitment definition
|
|
18265
|
+
*
|
|
18266
|
+
* The `USE DEEPSEARCH` commitment indicates that the agent should use a deeper research-oriented
|
|
18267
|
+
* search workflow instead of lightweight web search when it needs fresh information from the internet.
|
|
18268
|
+
*
|
|
18269
|
+
* The content following `USE DEEPSEARCH` is an arbitrary text that the agent should know
|
|
18270
|
+
* (e.g. search scope or research instructions).
|
|
18271
|
+
*
|
|
18272
|
+
* Example usage in agent source:
|
|
18273
|
+
*
|
|
18274
|
+
* ```book
|
|
18275
|
+
* USE DEEPSEARCH
|
|
18276
|
+
* USE DEEPSEARCH Compare official vendor documentation with independent benchmarks.
|
|
18277
|
+
* ```
|
|
18278
|
+
*
|
|
18279
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
18280
|
+
*/
|
|
18281
|
+
class UseDeepSearchCommitmentDefinition extends BaseCommitmentDefinition {
|
|
18282
|
+
constructor() {
|
|
18283
|
+
super('USE DEEPSEARCH');
|
|
18284
|
+
}
|
|
18285
|
+
get requiresContent() {
|
|
18286
|
+
return false;
|
|
18287
|
+
}
|
|
18288
|
+
/**
|
|
18289
|
+
* Short one-line description of USE DEEPSEARCH.
|
|
18290
|
+
*/
|
|
18291
|
+
get description() {
|
|
18292
|
+
return 'Enable the agent to use DeepSearch for more thorough internet research.';
|
|
18293
|
+
}
|
|
18294
|
+
/**
|
|
18295
|
+
* Icon for this commitment.
|
|
18296
|
+
*/
|
|
18297
|
+
get icon() {
|
|
18298
|
+
return '🔬';
|
|
18299
|
+
}
|
|
18300
|
+
/**
|
|
18301
|
+
* Markdown documentation for USE DEEPSEARCH commitment.
|
|
18302
|
+
*/
|
|
18303
|
+
get documentation() {
|
|
18304
|
+
return _spaceTrim.spaceTrim(`
|
|
18305
|
+
# USE DEEPSEARCH
|
|
18306
|
+
|
|
18307
|
+
Enables the agent to use DeepSearch for broader, more thorough internet research than lightweight web search.
|
|
18308
|
+
|
|
18309
|
+
## Key aspects
|
|
18310
|
+
|
|
18311
|
+
- The content following \`USE DEEPSEARCH\` is arbitrary guidance for the research workflow.
|
|
18312
|
+
- In Agents Server, the OpenAI Agents SDK runtime uses a nested deep-research agent for this tool.
|
|
18313
|
+
- Use this for investigations, comparisons, market scans, or other tasks that benefit from deeper synthesis.
|
|
18314
|
+
- Prefer regular \`USE SEARCH ENGINE\` when a quick factual lookup is enough.
|
|
18315
|
+
|
|
18316
|
+
## Examples
|
|
18317
|
+
|
|
18318
|
+
\`\`\`book
|
|
18319
|
+
Due Diligence Researcher
|
|
18320
|
+
|
|
18321
|
+
GOAL Investigate vendors thoroughly before making recommendations.
|
|
18322
|
+
USE DEEPSEARCH Compare official sources with credible third-party analysis.
|
|
18323
|
+
RULE Cite the strongest supporting sources in the final answer.
|
|
18324
|
+
\`\`\`
|
|
18325
|
+
|
|
18326
|
+
\`\`\`book
|
|
18327
|
+
Market Analyst
|
|
18328
|
+
|
|
18329
|
+
GOAL Build concise but well-grounded research briefs.
|
|
18330
|
+
USE DEEPSEARCH Focus on recent public information and competing viewpoints.
|
|
18331
|
+
CLOSED
|
|
18332
|
+
\`\`\`
|
|
18333
|
+
`);
|
|
18334
|
+
}
|
|
18335
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
18336
|
+
const existingTools = requirements.tools || [];
|
|
18337
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'deep_search')
|
|
18338
|
+
? existingTools
|
|
18339
|
+
: [
|
|
18340
|
+
...existingTools,
|
|
18341
|
+
{
|
|
18342
|
+
name: 'deep_search',
|
|
18343
|
+
description: _spaceTrim.spaceTrim(`
|
|
18344
|
+
Research the internet deeply and synthesize a grounded answer.
|
|
18345
|
+
Use this tool for broader investigations, comparisons, and requests that need more than a quick search.
|
|
18346
|
+
`),
|
|
18347
|
+
parameters: {
|
|
18348
|
+
type: 'object',
|
|
18349
|
+
properties: {
|
|
18350
|
+
query: {
|
|
18351
|
+
type: 'string',
|
|
18352
|
+
description: 'The research question or investigation request.',
|
|
18353
|
+
},
|
|
18354
|
+
},
|
|
18355
|
+
required: ['query'],
|
|
18356
|
+
additionalProperties: false,
|
|
18357
|
+
},
|
|
18358
|
+
},
|
|
18359
|
+
];
|
|
18360
|
+
return appendAggregatedUseCommitmentPlaceholder({
|
|
18361
|
+
...requirements,
|
|
18362
|
+
tools: updatedTools,
|
|
18363
|
+
_metadata: {
|
|
18364
|
+
...requirements._metadata,
|
|
18365
|
+
useDeepSearch: content || true,
|
|
18366
|
+
},
|
|
18367
|
+
}, this.type);
|
|
18368
|
+
}
|
|
18369
|
+
/**
|
|
18370
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
18371
|
+
*/
|
|
18372
|
+
getToolTitles() {
|
|
18373
|
+
return {
|
|
18374
|
+
deep_search: 'DeepSearch',
|
|
18375
|
+
};
|
|
18376
|
+
}
|
|
18377
|
+
/**
|
|
18378
|
+
* Gets the local fallback implementation for the `deep_search` tool.
|
|
18379
|
+
*/
|
|
18380
|
+
getToolFunctions() {
|
|
18381
|
+
return {
|
|
18382
|
+
deep_search: createSerpSearchToolFunction('deep_search', 'DeepSearch'),
|
|
18383
|
+
};
|
|
18384
|
+
}
|
|
18385
|
+
}
|
|
18386
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18387
|
+
|
|
18175
18388
|
/**
|
|
18176
18389
|
* Lightweight email token matcher used for `USE EMAIL` first-line parsing.
|
|
18177
18390
|
*
|
|
@@ -20559,49 +20772,6 @@
|
|
|
20559
20772
|
}
|
|
20560
20773
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
20561
20774
|
|
|
20562
|
-
/**
|
|
20563
|
-
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
20564
|
-
*
|
|
20565
|
-
* @private <- TODO: !!!! Export via some package
|
|
20566
|
-
*/
|
|
20567
|
-
class SerpSearchEngine {
|
|
20568
|
-
get title() {
|
|
20569
|
-
return 'SerpApi Search Engine';
|
|
20570
|
-
}
|
|
20571
|
-
get description() {
|
|
20572
|
-
return 'Search engine that uses SerpApi to fetch Google search results';
|
|
20573
|
-
}
|
|
20574
|
-
checkConfiguration() {
|
|
20575
|
-
if (!process.env.SERP_API_KEY) {
|
|
20576
|
-
throw new Error('SERP_API_KEY is not configured');
|
|
20577
|
-
}
|
|
20578
|
-
}
|
|
20579
|
-
async search(query, options = {}) {
|
|
20580
|
-
const apiKey = process.env.SERP_API_KEY;
|
|
20581
|
-
if (!apiKey) {
|
|
20582
|
-
throw new Error('SERP_API_KEY is not configured');
|
|
20583
|
-
}
|
|
20584
|
-
const url = new URL('https://serpapi.com/search');
|
|
20585
|
-
url.searchParams.set('api_key', apiKey);
|
|
20586
|
-
url.searchParams.set('engine', 'google');
|
|
20587
|
-
url.searchParams.set('q', query);
|
|
20588
|
-
for (const [key, value] of Object.entries(options)) {
|
|
20589
|
-
url.searchParams.set(key, String(value));
|
|
20590
|
-
}
|
|
20591
|
-
const response = await fetch(url.toString());
|
|
20592
|
-
if (!response.ok) {
|
|
20593
|
-
const body = await response.text();
|
|
20594
|
-
throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
|
|
20595
|
-
}
|
|
20596
|
-
const data = (await response.json());
|
|
20597
|
-
return (data.organic_results || []).map((item) => ({
|
|
20598
|
-
title: item.title,
|
|
20599
|
-
url: item.link,
|
|
20600
|
-
snippet: item.snippet || '',
|
|
20601
|
-
}));
|
|
20602
|
-
}
|
|
20603
|
-
}
|
|
20604
|
-
|
|
20605
20775
|
/**
|
|
20606
20776
|
* USE SEARCH ENGINE commitment definition
|
|
20607
20777
|
*
|
|
@@ -20745,26 +20915,7 @@
|
|
|
20745
20915
|
*/
|
|
20746
20916
|
getToolFunctions() {
|
|
20747
20917
|
return {
|
|
20748
|
-
|
|
20749
|
-
console.log('!!!! [Tool] web_search called', { args });
|
|
20750
|
-
const { query, ...options } = args;
|
|
20751
|
-
if (!query) {
|
|
20752
|
-
throw new Error('Search query is required');
|
|
20753
|
-
}
|
|
20754
|
-
const searchEngine = new SerpSearchEngine();
|
|
20755
|
-
const results = await searchEngine.search(query, options);
|
|
20756
|
-
return _spaceTrim.spaceTrim((block) => `
|
|
20757
|
-
Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
|
|
20758
|
-
|
|
20759
|
-
${block(results
|
|
20760
|
-
.map((result) => _spaceTrim.spaceTrim(`
|
|
20761
|
-
- **${result.title}**
|
|
20762
|
-
${result.url}
|
|
20763
|
-
${result.snippet}
|
|
20764
|
-
`))
|
|
20765
|
-
.join('\n\n'))}
|
|
20766
|
-
`);
|
|
20767
|
-
},
|
|
20918
|
+
web_search: createSerpSearchToolFunction('web_search', 'Search'),
|
|
20768
20919
|
};
|
|
20769
20920
|
}
|
|
20770
20921
|
}
|
|
@@ -22410,6 +22561,7 @@
|
|
|
22410
22561
|
new ClosedCommitmentDefinition(),
|
|
22411
22562
|
new TeamCommitmentDefinition(),
|
|
22412
22563
|
new UseBrowserCommitmentDefinition(),
|
|
22564
|
+
new UseDeepSearchCommitmentDefinition(),
|
|
22413
22565
|
new UseSearchEngineCommitmentDefinition(),
|
|
22414
22566
|
new UseSpawnCommitmentDefinition(),
|
|
22415
22567
|
new UseTimeoutCommitmentDefinition(),
|
|
@@ -25144,6 +25296,11 @@
|
|
|
25144
25296
|
label: 'Internet',
|
|
25145
25297
|
iconName: 'Search',
|
|
25146
25298
|
},
|
|
25299
|
+
'USE DEEPSEARCH': {
|
|
25300
|
+
type: 'search-engine',
|
|
25301
|
+
label: 'DeepSearch',
|
|
25302
|
+
iconName: 'Search',
|
|
25303
|
+
},
|
|
25147
25304
|
'USE TIME': {
|
|
25148
25305
|
type: 'time',
|
|
25149
25306
|
label: 'Time',
|
|
@@ -30389,6 +30546,14 @@
|
|
|
30389
30546
|
* Constant for default agent kit model name.
|
|
30390
30547
|
*/
|
|
30391
30548
|
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
|
|
30549
|
+
/**
|
|
30550
|
+
* Default model used for nested DeepSearch tool invocations.
|
|
30551
|
+
*/
|
|
30552
|
+
const DEFAULT_DEEP_SEARCH_MODEL_NAME = 'o4-mini-deep-research';
|
|
30553
|
+
/**
|
|
30554
|
+
* Tool name used by the Book commitment-backed DeepSearch capability.
|
|
30555
|
+
*/
|
|
30556
|
+
const DEEP_SEARCH_TOOL_NAME = 'deep_search';
|
|
30392
30557
|
/**
|
|
30393
30558
|
* Creates one structured log entry for streamed tool-call updates.
|
|
30394
30559
|
*
|
|
@@ -30431,6 +30596,98 @@
|
|
|
30431
30596
|
}
|
|
30432
30597
|
return 'COMPLETE';
|
|
30433
30598
|
}
|
|
30599
|
+
/**
|
|
30600
|
+
* Returns true when one tool definition represents the dedicated DeepSearch capability.
|
|
30601
|
+
*
|
|
30602
|
+
* @param toolDefinition - Tool definition from compiled model requirements.
|
|
30603
|
+
* @returns `true` when the tool should be backed by a nested deep-research agent.
|
|
30604
|
+
*
|
|
30605
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
30606
|
+
*/
|
|
30607
|
+
function isDeepSearchToolDefinition(toolDefinition) {
|
|
30608
|
+
return toolDefinition.name === DEEP_SEARCH_TOOL_NAME;
|
|
30609
|
+
}
|
|
30610
|
+
/**
|
|
30611
|
+
* Normalizes Promptbook JSON-schema tool parameters for AgentKit function tools.
|
|
30612
|
+
*
|
|
30613
|
+
* @param parameters - Promptbook tool parameters.
|
|
30614
|
+
* @returns AgentKit-compatible JSON schema or `undefined`.
|
|
30615
|
+
*
|
|
30616
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
30617
|
+
*/
|
|
30618
|
+
function normalizeAgentKitToolParameters(parameters) {
|
|
30619
|
+
var _a, _b;
|
|
30620
|
+
if (!parameters) {
|
|
30621
|
+
return undefined;
|
|
30622
|
+
}
|
|
30623
|
+
return {
|
|
30624
|
+
...parameters,
|
|
30625
|
+
additionalProperties: (_a = parameters.additionalProperties) !== null && _a !== void 0 ? _a : false,
|
|
30626
|
+
required: (_b = parameters.required) !== null && _b !== void 0 ? _b : [],
|
|
30627
|
+
};
|
|
30628
|
+
}
|
|
30629
|
+
/**
|
|
30630
|
+
* Creates instructions for the nested DeepSearch specialist agent.
|
|
30631
|
+
*
|
|
30632
|
+
* @param toolDescription - Model-facing description from the original tool definition.
|
|
30633
|
+
* @returns System instructions for the nested deep-research agent.
|
|
30634
|
+
*
|
|
30635
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
30636
|
+
*/
|
|
30637
|
+
function createDeepSearchAgentInstructions(toolDescription) {
|
|
30638
|
+
const normalizedDescription = toolDescription.trim();
|
|
30639
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
30640
|
+
You are a DeepSearch specialist working as a tool for another agent.
|
|
30641
|
+
Perform thorough, source-grounded public-web research based on the provided request.
|
|
30642
|
+
Use web search to gather current information, compare relevant viewpoints, and synthesize a concise research brief.
|
|
30643
|
+
Do not ask follow-up questions. If the request is not specific enough, state the assumptions you had to make.
|
|
30644
|
+
Include citations in the research brief whenever sources were used.
|
|
30645
|
+
${block(normalizedDescription ? `Tool guidance:\n${normalizedDescription}` : '')}
|
|
30646
|
+
`);
|
|
30647
|
+
}
|
|
30648
|
+
/**
|
|
30649
|
+
* Builds the nested DeepSearch prompt from structured tool arguments.
|
|
30650
|
+
*
|
|
30651
|
+
* @param rawInput - Parsed function-tool arguments provided by the outer agent.
|
|
30652
|
+
* @returns Prompt text passed to the nested deep-research agent.
|
|
30653
|
+
*
|
|
30654
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
30655
|
+
*/
|
|
30656
|
+
function buildDeepSearchToolInput(rawInput) {
|
|
30657
|
+
const input = rawInput && typeof rawInput === 'object' ? rawInput : {};
|
|
30658
|
+
const query = typeof input.query === 'string' ? input.query.trim() : '';
|
|
30659
|
+
const additionalHints = Object.entries(input)
|
|
30660
|
+
.filter(([key, value]) => key !== 'query' && value !== undefined && value !== null && String(value).trim() !== '')
|
|
30661
|
+
.map(([key, value]) => `- ${key}: ${typeof value === 'string' ? value : JSON.stringify(value)}`);
|
|
30662
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
30663
|
+
Research request:
|
|
30664
|
+
${query || JSON.stringify(input)}
|
|
30665
|
+
${block(additionalHints.length > 0 ? `Execution hints:\n${additionalHints.join('\n')}` : '')}
|
|
30666
|
+
`);
|
|
30667
|
+
}
|
|
30668
|
+
/**
|
|
30669
|
+
* Creates the native Agent SDK tool used for `USE DEEPSEARCH`.
|
|
30670
|
+
*
|
|
30671
|
+
* @param toolDefinition - Promptbook tool definition for `deep_search`.
|
|
30672
|
+
* @returns AgentKit tool backed by a nested deep-research agent.
|
|
30673
|
+
*
|
|
30674
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
30675
|
+
*/
|
|
30676
|
+
function createDeepSearchAgentKitTool(toolDefinition) {
|
|
30677
|
+
const deepSearchAgent = new agents.Agent({
|
|
30678
|
+
name: 'DeepSearch',
|
|
30679
|
+
model: DEFAULT_DEEP_SEARCH_MODEL_NAME,
|
|
30680
|
+
instructions: createDeepSearchAgentInstructions(toolDefinition.description),
|
|
30681
|
+
tools: [agents.webSearchTool({ searchContextSize: 'high' })],
|
|
30682
|
+
});
|
|
30683
|
+
return deepSearchAgent.asTool({
|
|
30684
|
+
toolName: toolDefinition.name,
|
|
30685
|
+
toolDescription: toolDefinition.description,
|
|
30686
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
30687
|
+
inputBuilder: ({ params }) => buildDeepSearchToolInput(params),
|
|
30688
|
+
customOutputExtractor: (result) => { var _a; return typeof result.finalOutput === 'string' ? result.finalOutput : JSON.stringify((_a = result.finalOutput) !== null && _a !== void 0 ? _a : ''); },
|
|
30689
|
+
});
|
|
30690
|
+
}
|
|
30434
30691
|
/**
|
|
30435
30692
|
* Constant for default JSON schema name.
|
|
30436
30693
|
*/
|
|
@@ -30771,25 +31028,23 @@
|
|
|
30771
31028
|
* Builds the tool list for AgentKit, including hosted file search when applicable.
|
|
30772
31029
|
*/
|
|
30773
31030
|
buildAgentKitTools(options) {
|
|
30774
|
-
var _a;
|
|
30775
31031
|
const { tools, vectorStoreId } = options;
|
|
30776
31032
|
const agentKitTools = [];
|
|
30777
31033
|
if (vectorStoreId) {
|
|
30778
31034
|
agentKitTools.push(agents.fileSearchTool(vectorStoreId));
|
|
30779
31035
|
}
|
|
30780
31036
|
if (tools && tools.length > 0) {
|
|
30781
|
-
|
|
31037
|
+
let scriptTools = null;
|
|
30782
31038
|
for (const toolDefinition of tools) {
|
|
31039
|
+
if (isDeepSearchToolDefinition(toolDefinition)) {
|
|
31040
|
+
agentKitTools.push(createDeepSearchAgentKitTool(toolDefinition));
|
|
31041
|
+
continue;
|
|
31042
|
+
}
|
|
31043
|
+
scriptTools !== null && scriptTools !== void 0 ? scriptTools : (scriptTools = this.resolveScriptTools());
|
|
30783
31044
|
agentKitTools.push(agents.tool({
|
|
30784
31045
|
name: toolDefinition.name,
|
|
30785
31046
|
description: toolDefinition.description,
|
|
30786
|
-
parameters: toolDefinition.parameters
|
|
30787
|
-
? {
|
|
30788
|
-
...toolDefinition.parameters,
|
|
30789
|
-
additionalProperties: false,
|
|
30790
|
-
required: (_a = toolDefinition.parameters.required) !== null && _a !== void 0 ? _a : [],
|
|
30791
|
-
}
|
|
30792
|
-
: undefined,
|
|
31047
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
30793
31048
|
strict: false,
|
|
30794
31049
|
execute: async (input, runContext, details) => {
|
|
30795
31050
|
var _a, _b, _c, _d;
|