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