@promptbook/openai 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 +109 -11
- 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 +108 -10
- 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/esm/index.es.js
CHANGED
|
@@ -7,7 +7,7 @@ import 'crypto-js/enc-hex';
|
|
|
7
7
|
import Bottleneck from 'bottleneck';
|
|
8
8
|
import OpenAI from 'openai';
|
|
9
9
|
import { io } from 'socket.io-client';
|
|
10
|
-
import { Agent, setDefaultOpenAIClient, setDefaultOpenAIKey, fileSearchTool, tool, run } from '@openai/agents';
|
|
10
|
+
import { Agent, setDefaultOpenAIClient, setDefaultOpenAIKey, fileSearchTool, tool, run, webSearchTool } from '@openai/agents';
|
|
11
11
|
|
|
12
12
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
13
13
|
/**
|
|
@@ -23,7 +23,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-49';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -7473,6 +7473,14 @@ function normalizeChatAttachments(rawAttachments) {
|
|
|
7473
7473
|
* Constant for default agent kit model name.
|
|
7474
7474
|
*/
|
|
7475
7475
|
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-mini';
|
|
7476
|
+
/**
|
|
7477
|
+
* Default model used for nested DeepSearch tool invocations.
|
|
7478
|
+
*/
|
|
7479
|
+
const DEFAULT_DEEP_SEARCH_MODEL_NAME = 'o4-mini-deep-research';
|
|
7480
|
+
/**
|
|
7481
|
+
* Tool name used by the Book commitment-backed DeepSearch capability.
|
|
7482
|
+
*/
|
|
7483
|
+
const DEEP_SEARCH_TOOL_NAME = 'deep_search';
|
|
7476
7484
|
/**
|
|
7477
7485
|
* Creates one structured log entry for streamed tool-call updates.
|
|
7478
7486
|
*
|
|
@@ -7515,6 +7523,98 @@ function resolveFinalToolCallState(options) {
|
|
|
7515
7523
|
}
|
|
7516
7524
|
return 'COMPLETE';
|
|
7517
7525
|
}
|
|
7526
|
+
/**
|
|
7527
|
+
* Returns true when one tool definition represents the dedicated DeepSearch capability.
|
|
7528
|
+
*
|
|
7529
|
+
* @param toolDefinition - Tool definition from compiled model requirements.
|
|
7530
|
+
* @returns `true` when the tool should be backed by a nested deep-research agent.
|
|
7531
|
+
*
|
|
7532
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
7533
|
+
*/
|
|
7534
|
+
function isDeepSearchToolDefinition(toolDefinition) {
|
|
7535
|
+
return toolDefinition.name === DEEP_SEARCH_TOOL_NAME;
|
|
7536
|
+
}
|
|
7537
|
+
/**
|
|
7538
|
+
* Normalizes Promptbook JSON-schema tool parameters for AgentKit function tools.
|
|
7539
|
+
*
|
|
7540
|
+
* @param parameters - Promptbook tool parameters.
|
|
7541
|
+
* @returns AgentKit-compatible JSON schema or `undefined`.
|
|
7542
|
+
*
|
|
7543
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
7544
|
+
*/
|
|
7545
|
+
function normalizeAgentKitToolParameters(parameters) {
|
|
7546
|
+
var _a, _b;
|
|
7547
|
+
if (!parameters) {
|
|
7548
|
+
return undefined;
|
|
7549
|
+
}
|
|
7550
|
+
return {
|
|
7551
|
+
...parameters,
|
|
7552
|
+
additionalProperties: (_a = parameters.additionalProperties) !== null && _a !== void 0 ? _a : false,
|
|
7553
|
+
required: (_b = parameters.required) !== null && _b !== void 0 ? _b : [],
|
|
7554
|
+
};
|
|
7555
|
+
}
|
|
7556
|
+
/**
|
|
7557
|
+
* Creates instructions for the nested DeepSearch specialist agent.
|
|
7558
|
+
*
|
|
7559
|
+
* @param toolDescription - Model-facing description from the original tool definition.
|
|
7560
|
+
* @returns System instructions for the nested deep-research agent.
|
|
7561
|
+
*
|
|
7562
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
7563
|
+
*/
|
|
7564
|
+
function createDeepSearchAgentInstructions(toolDescription) {
|
|
7565
|
+
const normalizedDescription = toolDescription.trim();
|
|
7566
|
+
return spaceTrim$1((block) => `
|
|
7567
|
+
You are a DeepSearch specialist working as a tool for another agent.
|
|
7568
|
+
Perform thorough, source-grounded public-web research based on the provided request.
|
|
7569
|
+
Use web search to gather current information, compare relevant viewpoints, and synthesize a concise research brief.
|
|
7570
|
+
Do not ask follow-up questions. If the request is not specific enough, state the assumptions you had to make.
|
|
7571
|
+
Include citations in the research brief whenever sources were used.
|
|
7572
|
+
${block(normalizedDescription ? `Tool guidance:\n${normalizedDescription}` : '')}
|
|
7573
|
+
`);
|
|
7574
|
+
}
|
|
7575
|
+
/**
|
|
7576
|
+
* Builds the nested DeepSearch prompt from structured tool arguments.
|
|
7577
|
+
*
|
|
7578
|
+
* @param rawInput - Parsed function-tool arguments provided by the outer agent.
|
|
7579
|
+
* @returns Prompt text passed to the nested deep-research agent.
|
|
7580
|
+
*
|
|
7581
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
7582
|
+
*/
|
|
7583
|
+
function buildDeepSearchToolInput(rawInput) {
|
|
7584
|
+
const input = rawInput && typeof rawInput === 'object' ? rawInput : {};
|
|
7585
|
+
const query = typeof input.query === 'string' ? input.query.trim() : '';
|
|
7586
|
+
const additionalHints = Object.entries(input)
|
|
7587
|
+
.filter(([key, value]) => key !== 'query' && value !== undefined && value !== null && String(value).trim() !== '')
|
|
7588
|
+
.map(([key, value]) => `- ${key}: ${typeof value === 'string' ? value : JSON.stringify(value)}`);
|
|
7589
|
+
return spaceTrim$1((block) => `
|
|
7590
|
+
Research request:
|
|
7591
|
+
${query || JSON.stringify(input)}
|
|
7592
|
+
${block(additionalHints.length > 0 ? `Execution hints:\n${additionalHints.join('\n')}` : '')}
|
|
7593
|
+
`);
|
|
7594
|
+
}
|
|
7595
|
+
/**
|
|
7596
|
+
* Creates the native Agent SDK tool used for `USE DEEPSEARCH`.
|
|
7597
|
+
*
|
|
7598
|
+
* @param toolDefinition - Promptbook tool definition for `deep_search`.
|
|
7599
|
+
* @returns AgentKit tool backed by a nested deep-research agent.
|
|
7600
|
+
*
|
|
7601
|
+
* @private helper of `OpenAiAgentKitExecutionTools`
|
|
7602
|
+
*/
|
|
7603
|
+
function createDeepSearchAgentKitTool(toolDefinition) {
|
|
7604
|
+
const deepSearchAgent = new Agent({
|
|
7605
|
+
name: 'DeepSearch',
|
|
7606
|
+
model: DEFAULT_DEEP_SEARCH_MODEL_NAME,
|
|
7607
|
+
instructions: createDeepSearchAgentInstructions(toolDefinition.description),
|
|
7608
|
+
tools: [webSearchTool({ searchContextSize: 'high' })],
|
|
7609
|
+
});
|
|
7610
|
+
return deepSearchAgent.asTool({
|
|
7611
|
+
toolName: toolDefinition.name,
|
|
7612
|
+
toolDescription: toolDefinition.description,
|
|
7613
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
7614
|
+
inputBuilder: ({ params }) => buildDeepSearchToolInput(params),
|
|
7615
|
+
customOutputExtractor: (result) => { var _a; return typeof result.finalOutput === 'string' ? result.finalOutput : JSON.stringify((_a = result.finalOutput) !== null && _a !== void 0 ? _a : ''); },
|
|
7616
|
+
});
|
|
7617
|
+
}
|
|
7518
7618
|
/**
|
|
7519
7619
|
* Constant for default JSON schema name.
|
|
7520
7620
|
*/
|
|
@@ -7855,25 +7955,23 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
7855
7955
|
* Builds the tool list for AgentKit, including hosted file search when applicable.
|
|
7856
7956
|
*/
|
|
7857
7957
|
buildAgentKitTools(options) {
|
|
7858
|
-
var _a;
|
|
7859
7958
|
const { tools, vectorStoreId } = options;
|
|
7860
7959
|
const agentKitTools = [];
|
|
7861
7960
|
if (vectorStoreId) {
|
|
7862
7961
|
agentKitTools.push(fileSearchTool(vectorStoreId));
|
|
7863
7962
|
}
|
|
7864
7963
|
if (tools && tools.length > 0) {
|
|
7865
|
-
|
|
7964
|
+
let scriptTools = null;
|
|
7866
7965
|
for (const toolDefinition of tools) {
|
|
7966
|
+
if (isDeepSearchToolDefinition(toolDefinition)) {
|
|
7967
|
+
agentKitTools.push(createDeepSearchAgentKitTool(toolDefinition));
|
|
7968
|
+
continue;
|
|
7969
|
+
}
|
|
7970
|
+
scriptTools !== null && scriptTools !== void 0 ? scriptTools : (scriptTools = this.resolveScriptTools());
|
|
7867
7971
|
agentKitTools.push(tool({
|
|
7868
7972
|
name: toolDefinition.name,
|
|
7869
7973
|
description: toolDefinition.description,
|
|
7870
|
-
parameters: toolDefinition.parameters
|
|
7871
|
-
? {
|
|
7872
|
-
...toolDefinition.parameters,
|
|
7873
|
-
additionalProperties: false,
|
|
7874
|
-
required: (_a = toolDefinition.parameters.required) !== null && _a !== void 0 ? _a : [],
|
|
7875
|
-
}
|
|
7876
|
-
: undefined,
|
|
7974
|
+
parameters: normalizeAgentKitToolParameters(toolDefinition.parameters),
|
|
7877
7975
|
strict: false,
|
|
7878
7976
|
execute: async (input, runContext, details) => {
|
|
7879
7977
|
var _a, _b, _c, _d;
|