@promptbook/cli 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 +334 -77
- 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 +1 -1
- package/umd/index.umd.js +333 -76
- 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
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
* @generated
|
|
61
61
|
* @see https://github.com/webgptorg/promptbook
|
|
62
62
|
*/
|
|
63
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
63
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-49';
|
|
64
64
|
/**
|
|
65
65
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
66
66
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -23221,6 +23221,7 @@
|
|
|
23221
23221
|
* Supported USE types:
|
|
23222
23222
|
* - USE BROWSER: Enables the agent to use a web browser tool
|
|
23223
23223
|
* - USE SEARCH ENGINE (future): Enables search engine access
|
|
23224
|
+
* - USE DEEPSEARCH: Enables deeper research-oriented search access
|
|
23224
23225
|
* - USE FILE SYSTEM (future): Enables file system operations
|
|
23225
23226
|
* - USE MCP (future): Enables MCP server connections
|
|
23226
23227
|
*
|
|
@@ -23243,7 +23244,7 @@
|
|
|
23243
23244
|
* Short one-line description of USE commitments.
|
|
23244
23245
|
*/
|
|
23245
23246
|
get description() {
|
|
23246
|
-
return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, etc.).';
|
|
23247
|
+
return 'Enable the agent to use specific tools or capabilities (BROWSER, SEARCH ENGINE, DEEPSEARCH, etc.).';
|
|
23247
23248
|
}
|
|
23248
23249
|
/**
|
|
23249
23250
|
* Icon for this commitment.
|
|
@@ -23264,6 +23265,7 @@
|
|
|
23264
23265
|
|
|
23265
23266
|
- **USE BROWSER** - Enables the agent to use a web browser tool to access and retrieve information from the internet
|
|
23266
23267
|
- **USE SEARCH ENGINE** (future) - Enables search engine access
|
|
23268
|
+
- **USE DEEPSEARCH** - Enables deeper research-oriented search access
|
|
23267
23269
|
- **USE FILE SYSTEM** (future) - Enables file system operations
|
|
23268
23270
|
- **USE MCP** (future) - Enables MCP server connections
|
|
23269
23271
|
|
|
@@ -23318,7 +23320,7 @@
|
|
|
23318
23320
|
* Checks if this is a known USE type
|
|
23319
23321
|
*/
|
|
23320
23322
|
isKnownUseType(useType) {
|
|
23321
|
-
const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'FILE SYSTEM', 'MCP'];
|
|
23323
|
+
const knownTypes = ['BROWSER', 'SEARCH ENGINE', 'DEEPSEARCH', 'FILE SYSTEM', 'MCP'];
|
|
23322
23324
|
return knownTypes.includes(useType.toUpperCase());
|
|
23323
23325
|
}
|
|
23324
23326
|
}
|
|
@@ -23331,6 +23333,7 @@
|
|
|
23331
23333
|
*/
|
|
23332
23334
|
const AGGREGATED_USE_COMMITMENT_TYPES = [
|
|
23333
23335
|
'USE BROWSER',
|
|
23336
|
+
'USE DEEPSEARCH',
|
|
23334
23337
|
'USE SEARCH ENGINE',
|
|
23335
23338
|
'USE TIME',
|
|
23336
23339
|
];
|
|
@@ -23410,6 +23413,15 @@
|
|
|
23410
23413
|
- Do not tell the user you cannot search for information, YOU CAN.
|
|
23411
23414
|
${block(formatOptionalInstructionBlock('Search instructions', combinedAdditionalInstructions))}
|
|
23412
23415
|
`);
|
|
23416
|
+
case 'USE DEEPSEARCH':
|
|
23417
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
23418
|
+
Tool:
|
|
23419
|
+
- You have access to DeepSearch via the tool "deep_search".
|
|
23420
|
+
- Use it for broader research tasks that need multi-step investigation, comparison, or synthesis across multiple sources.
|
|
23421
|
+
- Prefer it over quick search when the user asks for a well-grounded brief, report, or deeper investigation.
|
|
23422
|
+
- Do not pretend you cannot research current information when this tool is available.
|
|
23423
|
+
${block(formatOptionalInstructionBlock('DeepSearch instructions', combinedAdditionalInstructions))}
|
|
23424
|
+
`);
|
|
23413
23425
|
}
|
|
23414
23426
|
}
|
|
23415
23427
|
/**
|
|
@@ -24959,6 +24971,207 @@
|
|
|
24959
24971
|
}
|
|
24960
24972
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24961
24973
|
|
|
24974
|
+
/**
|
|
24975
|
+
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
24976
|
+
*
|
|
24977
|
+
* @private <- TODO: !!!! Export via some package
|
|
24978
|
+
*/
|
|
24979
|
+
class SerpSearchEngine {
|
|
24980
|
+
get title() {
|
|
24981
|
+
return 'SerpApi Search Engine';
|
|
24982
|
+
}
|
|
24983
|
+
get description() {
|
|
24984
|
+
return 'Search engine that uses SerpApi to fetch Google search results';
|
|
24985
|
+
}
|
|
24986
|
+
checkConfiguration() {
|
|
24987
|
+
if (!process.env.SERP_API_KEY) {
|
|
24988
|
+
throw new Error('SERP_API_KEY is not configured');
|
|
24989
|
+
}
|
|
24990
|
+
}
|
|
24991
|
+
async search(query, options = {}) {
|
|
24992
|
+
const apiKey = process.env.SERP_API_KEY;
|
|
24993
|
+
if (!apiKey) {
|
|
24994
|
+
throw new Error('SERP_API_KEY is not configured');
|
|
24995
|
+
}
|
|
24996
|
+
const url = new URL('https://serpapi.com/search');
|
|
24997
|
+
url.searchParams.set('api_key', apiKey);
|
|
24998
|
+
url.searchParams.set('engine', 'google');
|
|
24999
|
+
url.searchParams.set('q', query);
|
|
25000
|
+
for (const [key, value] of Object.entries(options)) {
|
|
25001
|
+
url.searchParams.set(key, String(value));
|
|
25002
|
+
}
|
|
25003
|
+
const response = await fetch(url.toString());
|
|
25004
|
+
if (!response.ok) {
|
|
25005
|
+
const body = await response.text();
|
|
25006
|
+
throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
|
|
25007
|
+
}
|
|
25008
|
+
const data = (await response.json());
|
|
25009
|
+
return (data.organic_results || []).map((item) => ({
|
|
25010
|
+
title: item.title,
|
|
25011
|
+
url: item.link,
|
|
25012
|
+
snippet: item.snippet || '',
|
|
25013
|
+
}));
|
|
25014
|
+
}
|
|
25015
|
+
}
|
|
25016
|
+
|
|
25017
|
+
/**
|
|
25018
|
+
* Creates one SERP-backed tool function used as a local fallback for search-like commitments.
|
|
25019
|
+
*
|
|
25020
|
+
* @param toolName - Technical tool name used for validation messages.
|
|
25021
|
+
* @param resultLabel - Human-readable label used in formatted results.
|
|
25022
|
+
* @returns Async tool function compatible with commitment tool registration.
|
|
25023
|
+
*
|
|
25024
|
+
* @private internal helper for search-like commitments
|
|
25025
|
+
*/
|
|
25026
|
+
function createSerpSearchToolFunction(toolName, resultLabel) {
|
|
25027
|
+
return async (rawArgs) => {
|
|
25028
|
+
const { query, ...searchOptions } = rawArgs;
|
|
25029
|
+
if (typeof query !== 'string' || !query.trim()) {
|
|
25030
|
+
throw new Error(`${toolName} query is required`);
|
|
25031
|
+
}
|
|
25032
|
+
const searchEngine = new SerpSearchEngine();
|
|
25033
|
+
const results = await searchEngine.search(query, searchOptions);
|
|
25034
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
25035
|
+
${resultLabel} results for "${query}"${Object.keys(searchOptions).length === 0
|
|
25036
|
+
? ''
|
|
25037
|
+
: ` with options ${JSON.stringify(searchOptions)}`}:
|
|
25038
|
+
|
|
25039
|
+
${block(results
|
|
25040
|
+
.map((result) => _spaceTrim.spaceTrim(`
|
|
25041
|
+
- **${result.title}**
|
|
25042
|
+
${result.url}
|
|
25043
|
+
${result.snippet}
|
|
25044
|
+
`))
|
|
25045
|
+
.join('\n\n'))}
|
|
25046
|
+
`);
|
|
25047
|
+
};
|
|
25048
|
+
}
|
|
25049
|
+
|
|
25050
|
+
/**
|
|
25051
|
+
* USE DEEPSEARCH commitment definition
|
|
25052
|
+
*
|
|
25053
|
+
* The `USE DEEPSEARCH` commitment indicates that the agent should use a deeper research-oriented
|
|
25054
|
+
* search workflow instead of lightweight web search when it needs fresh information from the internet.
|
|
25055
|
+
*
|
|
25056
|
+
* The content following `USE DEEPSEARCH` is an arbitrary text that the agent should know
|
|
25057
|
+
* (e.g. search scope or research instructions).
|
|
25058
|
+
*
|
|
25059
|
+
* Example usage in agent source:
|
|
25060
|
+
*
|
|
25061
|
+
* ```book
|
|
25062
|
+
* USE DEEPSEARCH
|
|
25063
|
+
* USE DEEPSEARCH Compare official vendor documentation with independent benchmarks.
|
|
25064
|
+
* ```
|
|
25065
|
+
*
|
|
25066
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
25067
|
+
*/
|
|
25068
|
+
class UseDeepSearchCommitmentDefinition extends BaseCommitmentDefinition {
|
|
25069
|
+
constructor() {
|
|
25070
|
+
super('USE DEEPSEARCH');
|
|
25071
|
+
}
|
|
25072
|
+
get requiresContent() {
|
|
25073
|
+
return false;
|
|
25074
|
+
}
|
|
25075
|
+
/**
|
|
25076
|
+
* Short one-line description of USE DEEPSEARCH.
|
|
25077
|
+
*/
|
|
25078
|
+
get description() {
|
|
25079
|
+
return 'Enable the agent to use DeepSearch for more thorough internet research.';
|
|
25080
|
+
}
|
|
25081
|
+
/**
|
|
25082
|
+
* Icon for this commitment.
|
|
25083
|
+
*/
|
|
25084
|
+
get icon() {
|
|
25085
|
+
return '🔬';
|
|
25086
|
+
}
|
|
25087
|
+
/**
|
|
25088
|
+
* Markdown documentation for USE DEEPSEARCH commitment.
|
|
25089
|
+
*/
|
|
25090
|
+
get documentation() {
|
|
25091
|
+
return _spaceTrim.spaceTrim(`
|
|
25092
|
+
# USE DEEPSEARCH
|
|
25093
|
+
|
|
25094
|
+
Enables the agent to use DeepSearch for broader, more thorough internet research than lightweight web search.
|
|
25095
|
+
|
|
25096
|
+
## Key aspects
|
|
25097
|
+
|
|
25098
|
+
- The content following \`USE DEEPSEARCH\` is arbitrary guidance for the research workflow.
|
|
25099
|
+
- In Agents Server, the OpenAI Agents SDK runtime uses a nested deep-research agent for this tool.
|
|
25100
|
+
- Use this for investigations, comparisons, market scans, or other tasks that benefit from deeper synthesis.
|
|
25101
|
+
- Prefer regular \`USE SEARCH ENGINE\` when a quick factual lookup is enough.
|
|
25102
|
+
|
|
25103
|
+
## Examples
|
|
25104
|
+
|
|
25105
|
+
\`\`\`book
|
|
25106
|
+
Due Diligence Researcher
|
|
25107
|
+
|
|
25108
|
+
GOAL Investigate vendors thoroughly before making recommendations.
|
|
25109
|
+
USE DEEPSEARCH Compare official sources with credible third-party analysis.
|
|
25110
|
+
RULE Cite the strongest supporting sources in the final answer.
|
|
25111
|
+
\`\`\`
|
|
25112
|
+
|
|
25113
|
+
\`\`\`book
|
|
25114
|
+
Market Analyst
|
|
25115
|
+
|
|
25116
|
+
GOAL Build concise but well-grounded research briefs.
|
|
25117
|
+
USE DEEPSEARCH Focus on recent public information and competing viewpoints.
|
|
25118
|
+
CLOSED
|
|
25119
|
+
\`\`\`
|
|
25120
|
+
`);
|
|
25121
|
+
}
|
|
25122
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
25123
|
+
const existingTools = requirements.tools || [];
|
|
25124
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'deep_search')
|
|
25125
|
+
? existingTools
|
|
25126
|
+
: [
|
|
25127
|
+
...existingTools,
|
|
25128
|
+
{
|
|
25129
|
+
name: 'deep_search',
|
|
25130
|
+
description: _spaceTrim.spaceTrim(`
|
|
25131
|
+
Research the internet deeply and synthesize a grounded answer.
|
|
25132
|
+
Use this tool for broader investigations, comparisons, and requests that need more than a quick search.
|
|
25133
|
+
`),
|
|
25134
|
+
parameters: {
|
|
25135
|
+
type: 'object',
|
|
25136
|
+
properties: {
|
|
25137
|
+
query: {
|
|
25138
|
+
type: 'string',
|
|
25139
|
+
description: 'The research question or investigation request.',
|
|
25140
|
+
},
|
|
25141
|
+
},
|
|
25142
|
+
required: ['query'],
|
|
25143
|
+
additionalProperties: false,
|
|
25144
|
+
},
|
|
25145
|
+
},
|
|
25146
|
+
];
|
|
25147
|
+
return appendAggregatedUseCommitmentPlaceholder({
|
|
25148
|
+
...requirements,
|
|
25149
|
+
tools: updatedTools,
|
|
25150
|
+
_metadata: {
|
|
25151
|
+
...requirements._metadata,
|
|
25152
|
+
useDeepSearch: content || true,
|
|
25153
|
+
},
|
|
25154
|
+
}, this.type);
|
|
25155
|
+
}
|
|
25156
|
+
/**
|
|
25157
|
+
* Gets human-readable titles for tool functions provided by this commitment.
|
|
25158
|
+
*/
|
|
25159
|
+
getToolTitles() {
|
|
25160
|
+
return {
|
|
25161
|
+
deep_search: 'DeepSearch',
|
|
25162
|
+
};
|
|
25163
|
+
}
|
|
25164
|
+
/**
|
|
25165
|
+
* Gets the local fallback implementation for the `deep_search` tool.
|
|
25166
|
+
*/
|
|
25167
|
+
getToolFunctions() {
|
|
25168
|
+
return {
|
|
25169
|
+
deep_search: createSerpSearchToolFunction('deep_search', 'DeepSearch'),
|
|
25170
|
+
};
|
|
25171
|
+
}
|
|
25172
|
+
}
|
|
25173
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
25174
|
+
|
|
24962
25175
|
/**
|
|
24963
25176
|
* Lightweight email token matcher used for `USE EMAIL` first-line parsing.
|
|
24964
25177
|
*
|
|
@@ -27346,49 +27559,6 @@
|
|
|
27346
27559
|
}
|
|
27347
27560
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
27348
27561
|
|
|
27349
|
-
/**
|
|
27350
|
-
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
27351
|
-
*
|
|
27352
|
-
* @private <- TODO: !!!! Export via some package
|
|
27353
|
-
*/
|
|
27354
|
-
class SerpSearchEngine {
|
|
27355
|
-
get title() {
|
|
27356
|
-
return 'SerpApi Search Engine';
|
|
27357
|
-
}
|
|
27358
|
-
get description() {
|
|
27359
|
-
return 'Search engine that uses SerpApi to fetch Google search results';
|
|
27360
|
-
}
|
|
27361
|
-
checkConfiguration() {
|
|
27362
|
-
if (!process.env.SERP_API_KEY) {
|
|
27363
|
-
throw new Error('SERP_API_KEY is not configured');
|
|
27364
|
-
}
|
|
27365
|
-
}
|
|
27366
|
-
async search(query, options = {}) {
|
|
27367
|
-
const apiKey = process.env.SERP_API_KEY;
|
|
27368
|
-
if (!apiKey) {
|
|
27369
|
-
throw new Error('SERP_API_KEY is not configured');
|
|
27370
|
-
}
|
|
27371
|
-
const url = new URL('https://serpapi.com/search');
|
|
27372
|
-
url.searchParams.set('api_key', apiKey);
|
|
27373
|
-
url.searchParams.set('engine', 'google');
|
|
27374
|
-
url.searchParams.set('q', query);
|
|
27375
|
-
for (const [key, value] of Object.entries(options)) {
|
|
27376
|
-
url.searchParams.set(key, String(value));
|
|
27377
|
-
}
|
|
27378
|
-
const response = await fetch(url.toString());
|
|
27379
|
-
if (!response.ok) {
|
|
27380
|
-
const body = await response.text();
|
|
27381
|
-
throw new Error(`SerpApi failed with status ${response.status}: ${response.statusText}\n${body}`);
|
|
27382
|
-
}
|
|
27383
|
-
const data = (await response.json());
|
|
27384
|
-
return (data.organic_results || []).map((item) => ({
|
|
27385
|
-
title: item.title,
|
|
27386
|
-
url: item.link,
|
|
27387
|
-
snippet: item.snippet || '',
|
|
27388
|
-
}));
|
|
27389
|
-
}
|
|
27390
|
-
}
|
|
27391
|
-
|
|
27392
27562
|
/**
|
|
27393
27563
|
* USE SEARCH ENGINE commitment definition
|
|
27394
27564
|
*
|
|
@@ -27532,26 +27702,7 @@
|
|
|
27532
27702
|
*/
|
|
27533
27703
|
getToolFunctions() {
|
|
27534
27704
|
return {
|
|
27535
|
-
|
|
27536
|
-
console.log('!!!! [Tool] web_search called', { args });
|
|
27537
|
-
const { query, ...options } = args;
|
|
27538
|
-
if (!query) {
|
|
27539
|
-
throw new Error('Search query is required');
|
|
27540
|
-
}
|
|
27541
|
-
const searchEngine = new SerpSearchEngine();
|
|
27542
|
-
const results = await searchEngine.search(query, options);
|
|
27543
|
-
return _spaceTrim.spaceTrim((block) => `
|
|
27544
|
-
Search results for "${query}"${Object.keys(options).length === 0 ? '' : ` with options ${JSON.stringify(options)}`}:
|
|
27545
|
-
|
|
27546
|
-
${block(results
|
|
27547
|
-
.map((result) => _spaceTrim.spaceTrim(`
|
|
27548
|
-
- **${result.title}**
|
|
27549
|
-
${result.url}
|
|
27550
|
-
${result.snippet}
|
|
27551
|
-
`))
|
|
27552
|
-
.join('\n\n'))}
|
|
27553
|
-
`);
|
|
27554
|
-
},
|
|
27705
|
+
web_search: createSerpSearchToolFunction('web_search', 'Search'),
|
|
27555
27706
|
};
|
|
27556
27707
|
}
|
|
27557
27708
|
}
|
|
@@ -29197,6 +29348,7 @@
|
|
|
29197
29348
|
new ClosedCommitmentDefinition(),
|
|
29198
29349
|
new TeamCommitmentDefinition(),
|
|
29199
29350
|
new UseBrowserCommitmentDefinition(),
|
|
29351
|
+
new UseDeepSearchCommitmentDefinition(),
|
|
29200
29352
|
new UseSearchEngineCommitmentDefinition(),
|
|
29201
29353
|
new UseSpawnCommitmentDefinition(),
|
|
29202
29354
|
new UseTimeoutCommitmentDefinition(),
|
|
@@ -42250,6 +42402,11 @@
|
|
|
42250
42402
|
label: 'Internet',
|
|
42251
42403
|
iconName: 'Search',
|
|
42252
42404
|
},
|
|
42405
|
+
'USE DEEPSEARCH': {
|
|
42406
|
+
type: 'search-engine',
|
|
42407
|
+
label: 'DeepSearch',
|
|
42408
|
+
iconName: 'Search',
|
|
42409
|
+
},
|
|
42253
42410
|
'USE TIME': {
|
|
42254
42411
|
type: 'time',
|
|
42255
42412
|
label: 'Time',
|
|
@@ -49430,7 +49587,9 @@ bash "$1"
|
|
|
49430
49587
|
this.statusMessage = 'Initializing...';
|
|
49431
49588
|
this.errors = [];
|
|
49432
49589
|
this.stats = { done: 0, forAgent: 0, belowMinimumPriority: 0, toBeWritten: 0 };
|
|
49433
|
-
|
|
49590
|
+
// Match the plain CLI progress header and count active run time from startup.
|
|
49591
|
+
// Explicit waits/pauses are excluded later through `pauseTimer()` / `resumeTimer()`.
|
|
49592
|
+
this.timer = new CoderRunTimer(startTime);
|
|
49434
49593
|
}
|
|
49435
49594
|
/**
|
|
49436
49595
|
* Pauses the elapsed timer (e.g. while waiting for user input or paused state).
|
|
@@ -51816,6 +51975,14 @@ bash "$1"
|
|
|
51816
51975
|
* Constant for default agent kit model name.
|
|
51817
51976
|
*/
|
|
51818
51977
|
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
|
|
51978
|
+
/**
|
|
51979
|
+
* Default model used for nested DeepSearch tool invocations.
|
|
51980
|
+
*/
|
|
51981
|
+
const DEFAULT_DEEP_SEARCH_MODEL_NAME = 'o4-mini-deep-research';
|
|
51982
|
+
/**
|
|
51983
|
+
* Tool name used by the Book commitment-backed DeepSearch capability.
|
|
51984
|
+
*/
|
|
51985
|
+
const DEEP_SEARCH_TOOL_NAME = 'deep_search';
|
|
51819
51986
|
/**
|
|
51820
51987
|
* Creates one structured log entry for streamed tool-call updates.
|
|
51821
51988
|
*
|
|
@@ -51858,6 +52025,98 @@ bash "$1"
|
|
|
51858
52025
|
}
|
|
51859
52026
|
return 'COMPLETE';
|
|
51860
52027
|
}
|
|
52028
|
+
/**
|
|
52029
|
+
* Returns true when one tool definition represents the dedicated DeepSearch capability.
|
|
52030
|
+
*
|
|
52031
|
+
* @param toolDefinition - Tool definition from compiled model requirements.
|
|
52032
|
+
* @returns `true` when the tool should be backed by a nested deep-research agent.
|
|
52033
|
+
*
|
|
52034
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
52035
|
+
*/
|
|
52036
|
+
function isDeepSearchToolDefinition(toolDefinition) {
|
|
52037
|
+
return toolDefinition.name === DEEP_SEARCH_TOOL_NAME;
|
|
52038
|
+
}
|
|
52039
|
+
/**
|
|
52040
|
+
* Normalizes Promptbook JSON-schema tool parameters for AgentKit function tools.
|
|
52041
|
+
*
|
|
52042
|
+
* @param parameters - Promptbook tool parameters.
|
|
52043
|
+
* @returns AgentKit-compatible JSON schema or `undefined`.
|
|
52044
|
+
*
|
|
52045
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
52046
|
+
*/
|
|
52047
|
+
function normalizeAgentKitToolParameters(parameters) {
|
|
52048
|
+
var _a, _b;
|
|
52049
|
+
if (!parameters) {
|
|
52050
|
+
return undefined;
|
|
52051
|
+
}
|
|
52052
|
+
return {
|
|
52053
|
+
...parameters,
|
|
52054
|
+
additionalProperties: (_a = parameters.additionalProperties) !== null && _a !== void 0 ? _a : false,
|
|
52055
|
+
required: (_b = parameters.required) !== null && _b !== void 0 ? _b : [],
|
|
52056
|
+
};
|
|
52057
|
+
}
|
|
52058
|
+
/**
|
|
52059
|
+
* Creates instructions for the nested DeepSearch specialist agent.
|
|
52060
|
+
*
|
|
52061
|
+
* @param toolDescription - Model-facing description from the original tool definition.
|
|
52062
|
+
* @returns System instructions for the nested deep-research agent.
|
|
52063
|
+
*
|
|
52064
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
52065
|
+
*/
|
|
52066
|
+
function createDeepSearchAgentInstructions(toolDescription) {
|
|
52067
|
+
const normalizedDescription = toolDescription.trim();
|
|
52068
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
52069
|
+
You are a DeepSearch specialist working as a tool for another agent.
|
|
52070
|
+
Perform thorough, source-grounded public-web research based on the provided request.
|
|
52071
|
+
Use web search to gather current information, compare relevant viewpoints, and synthesize a concise research brief.
|
|
52072
|
+
Do not ask follow-up questions. If the request is not specific enough, state the assumptions you had to make.
|
|
52073
|
+
Include citations in the research brief whenever sources were used.
|
|
52074
|
+
${block(normalizedDescription ? `Tool guidance:\n${normalizedDescription}` : '')}
|
|
52075
|
+
`);
|
|
52076
|
+
}
|
|
52077
|
+
/**
|
|
52078
|
+
* Builds the nested DeepSearch prompt from structured tool arguments.
|
|
52079
|
+
*
|
|
52080
|
+
* @param rawInput - Parsed function-tool arguments provided by the outer agent.
|
|
52081
|
+
* @returns Prompt text passed to the nested deep-research agent.
|
|
52082
|
+
*
|
|
52083
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
52084
|
+
*/
|
|
52085
|
+
function buildDeepSearchToolInput(rawInput) {
|
|
52086
|
+
const input = rawInput && typeof rawInput === 'object' ? rawInput : {};
|
|
52087
|
+
const query = typeof input.query === 'string' ? input.query.trim() : '';
|
|
52088
|
+
const additionalHints = Object.entries(input)
|
|
52089
|
+
.filter(([key, value]) => key !== 'query' && value !== undefined && value !== null && String(value).trim() !== '')
|
|
52090
|
+
.map(([key, value]) => `- ${key}: ${typeof value === 'string' ? value : JSON.stringify(value)}`);
|
|
52091
|
+
return _spaceTrim.spaceTrim((block) => `
|
|
52092
|
+
Research request:
|
|
52093
|
+
${query || JSON.stringify(input)}
|
|
52094
|
+
${block(additionalHints.length > 0 ? `Execution hints:\n${additionalHints.join('\n')}` : '')}
|
|
52095
|
+
`);
|
|
52096
|
+
}
|
|
52097
|
+
/**
|
|
52098
|
+
* Creates the native Agent SDK tool used for `USE DEEPSEARCH`.
|
|
52099
|
+
*
|
|
52100
|
+
* @param toolDefinition - Promptbook tool definition for `deep_search`.
|
|
52101
|
+
* @returns AgentKit tool backed by a nested deep-research agent.
|
|
52102
|
+
*
|
|
52103
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
52104
|
+
*/
|
|
52105
|
+
function createDeepSearchAgentKitTool(toolDefinition) {
|
|
52106
|
+
const deepSearchAgent = new agents.Agent({
|
|
52107
|
+
name: 'DeepSearch',
|
|
52108
|
+
model: DEFAULT_DEEP_SEARCH_MODEL_NAME,
|
|
52109
|
+
instructions: createDeepSearchAgentInstructions(toolDefinition.description),
|
|
52110
|
+
tools: [agents.webSearchTool({ searchContextSize: 'high' })],
|
|
52111
|
+
});
|
|
52112
|
+
return deepSearchAgent.asTool({
|
|
52113
|
+
toolName: toolDefinition.name,
|
|
52114
|
+
toolDescription: toolDefinition.description,
|
|
52115
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
52116
|
+
inputBuilder: ({ params }) => buildDeepSearchToolInput(params),
|
|
52117
|
+
customOutputExtractor: (result) => { var _a; return typeof result.finalOutput === 'string' ? result.finalOutput : JSON.stringify((_a = result.finalOutput) !== null && _a !== void 0 ? _a : ''); },
|
|
52118
|
+
});
|
|
52119
|
+
}
|
|
51861
52120
|
/**
|
|
51862
52121
|
* Constant for default JSON schema name.
|
|
51863
52122
|
*/
|
|
@@ -52198,25 +52457,23 @@ bash "$1"
|
|
|
52198
52457
|
* Builds the tool list for AgentKit, including hosted file search when applicable.
|
|
52199
52458
|
*/
|
|
52200
52459
|
buildAgentKitTools(options) {
|
|
52201
|
-
var _a;
|
|
52202
52460
|
const { tools, vectorStoreId } = options;
|
|
52203
52461
|
const agentKitTools = [];
|
|
52204
52462
|
if (vectorStoreId) {
|
|
52205
52463
|
agentKitTools.push(agents.fileSearchTool(vectorStoreId));
|
|
52206
52464
|
}
|
|
52207
52465
|
if (tools && tools.length > 0) {
|
|
52208
|
-
|
|
52466
|
+
let scriptTools = null;
|
|
52209
52467
|
for (const toolDefinition of tools) {
|
|
52468
|
+
if (isDeepSearchToolDefinition(toolDefinition)) {
|
|
52469
|
+
agentKitTools.push(createDeepSearchAgentKitTool(toolDefinition));
|
|
52470
|
+
continue;
|
|
52471
|
+
}
|
|
52472
|
+
scriptTools !== null && scriptTools !== void 0 ? scriptTools : (scriptTools = this.resolveScriptTools());
|
|
52210
52473
|
agentKitTools.push(agents.tool({
|
|
52211
52474
|
name: toolDefinition.name,
|
|
52212
52475
|
description: toolDefinition.description,
|
|
52213
|
-
parameters: toolDefinition.parameters
|
|
52214
|
-
? {
|
|
52215
|
-
...toolDefinition.parameters,
|
|
52216
|
-
additionalProperties: false,
|
|
52217
|
-
required: (_a = toolDefinition.parameters.required) !== null && _a !== void 0 ? _a : [],
|
|
52218
|
-
}
|
|
52219
|
-
: undefined,
|
|
52476
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
52220
52477
|
strict: false,
|
|
52221
52478
|
execute: async (input, runContext, details) => {
|
|
52222
52479
|
var _a, _b, _c, _d;
|