@promptbook/openai 0.112.0-46 → 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/README.md +16 -16
- package/esm/index.es.js +109 -11
- package/esm/index.es.js.map +1 -1
- package/esm/src/avatars/AvatarOrImage.d.ts +49 -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 +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 +2 -1
- package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +41 -1
- package/esm/src/avatars/visuals/asciiOctopusAvatarVisual.d.ts +7 -0
- package/esm/src/avatars/visuals/octopus3AvatarVisual.d.ts +7 -0
- package/esm/src/avatars/visuals/octopusAvatarVisualShared.d.ts +159 -0
- package/esm/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatToolCallModalComponents.d.ts +8 -2
- package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
- package/esm/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +2 -0
- package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +10 -0
- package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
- 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/config.d.ts +2 -2
- package/esm/src/llm-providers/agent/RemoteAgent.d.ts +3 -0
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
- package/esm/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +49 -5
- package/esm/src/utils/agents/resolveAgentAvatarImageUrl.test.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +4 -3
- package/umd/index.umd.js +108 -10
- package/umd/index.umd.js.map +1 -1
- package/umd/src/avatars/AvatarOrImage.d.ts +49 -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 +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 +2 -1
- package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +41 -1
- package/umd/src/avatars/visuals/asciiOctopusAvatarVisual.d.ts +7 -0
- package/umd/src/avatars/visuals/octopus3AvatarVisual.d.ts +7 -0
- package/umd/src/avatars/visuals/octopusAvatarVisualShared.d.ts +159 -0
- package/umd/src/avatars/visuals/octopusAvatarVisualShared.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatToolCallModalComponents.d.ts +8 -2
- package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.test.d.ts +2 -0
- package/umd/src/book-components/Chat/hooks/useChatCompleteNotification.d.ts +2 -0
- package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +10 -0
- package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
- 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/config.d.ts +2 -2
- package/umd/src/llm-providers/agent/RemoteAgent.d.ts +3 -0
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.test.d.ts +1 -0
- package/umd/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +49 -5
- package/umd/src/utils/agents/resolveAgentAvatarImageUrl.test.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!-- ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten -->
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# 🐙 Promptbook: Invisible AI Agents
|
|
4
4
|
|
|
5
|
-
Create persistent AI agents that turn your company's scattered knowledge into action
|
|
5
|
+
Create persistent AI agents that turn your company's scattered knowledge into action - powered by the [Agents Server](https://gallery.ptbk.io/)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -376,13 +376,13 @@ Rest of the documentation is common for **entire promptbook ecosystem**:
|
|
|
376
376
|
|
|
377
377
|
## 📖 The Book Whitepaper
|
|
378
378
|
|
|
379
|
-
Promptbook lets you create **persistent AI agents** that work on real goals for your company. The [**Agents Server**](https://gallery.ptbk.io/) is the heart of the project
|
|
379
|
+
Promptbook lets you create **persistent AI agents** that work on real goals for your company. The [**Agents Server**](https://gallery.ptbk.io/) is the heart of the project - a place where your AI agents live, remember context, collaborate in teams, and get things done.
|
|
380
380
|
|
|
381
381
|
Nowadays, the biggest challenge for most business applications isn't the raw capabilities of AI models. Large language models such as GPT-5.2 and Claude-4.5 are incredibly capable.
|
|
382
382
|
|
|
383
383
|
The main challenge lies in **managing the context**, providing rules and knowledge, and narrowing the personality.
|
|
384
384
|
|
|
385
|
-
In Promptbook, you define your agents **using simple Books**
|
|
385
|
+
In Promptbook, you define your agents **using simple Books** - a human-readable language that is explicit, easy to understand and write, reliable, and highly portable. You then deploy them to the **Agents Server**, where they run persistently and work toward their goals.
|
|
386
386
|
|
|
387
387
|
<table style="border: 1px solid #777; border-radius: 10px;"><tr><td>
|
|
388
388
|
|
|
@@ -483,7 +483,7 @@ Your job is to provide legal advice and support to the company and its employees
|
|
|
483
483
|
|
|
484
484
|
#### `Use` commitments
|
|
485
485
|
|
|
486
|
-
Use commitments grant the agent real capabilities
|
|
486
|
+
Use commitments grant the agent real capabilities - tools it can use to interact with the outside world. `USE EMAIL` lets the agent send emails, `USE BROWSER` lets it access and read web content, `USE SEARCH ENGINE` lets it search the web, and many more.
|
|
487
487
|
|
|
488
488
|
These are what turn a chatbot into a persistent agent that actually does work.
|
|
489
489
|
|
|
@@ -532,7 +532,7 @@ Your job is to provide legal advice and support to the company and its employees
|
|
|
532
532
|
|
|
533
533
|
### Promptbook Ecosystem
|
|
534
534
|
|
|
535
|
-
Promptbook is an ecosystem of tools centered around the **Agents Server**
|
|
535
|
+
Promptbook is an ecosystem of tools centered around the **Agents Server** - a production-ready platform for running persistent AI agents.
|
|
536
536
|
|
|
537
537
|
#### Agents Server
|
|
538
538
|
|
|
@@ -554,7 +554,7 @@ The [Promptbook Engine](https://github.com/webgptorg/promptbook) is the open-sou
|
|
|
554
554
|
|
|
555
555
|
## 💜 The Promptbook Project
|
|
556
556
|
|
|
557
|
-
Promptbook project is an ecosystem centered around the **Agents Server**
|
|
557
|
+
Promptbook project is an ecosystem centered around the **Agents Server** - a platform for creating, deploying, and running persistent AI agents. Following is a list of the most important pieces of the project:
|
|
558
558
|
|
|
559
559
|
<table>
|
|
560
560
|
<thead>
|
|
@@ -567,7 +567,7 @@ Promptbook project is an ecosystem centered around the **Agents Server** — a p
|
|
|
567
567
|
<tr>
|
|
568
568
|
<td><a href="https://gallery.ptbk.io/"><strong>⭐ Agents Server</strong></a></td>
|
|
569
569
|
<td>
|
|
570
|
-
The primary way to use Promptbook. A production-ready platform where your AI agents live
|
|
570
|
+
The primary way to use Promptbook. A production-ready platform where your AI agents live - create, manage, deploy, and interact with persistent agents that work on goals. Available as a hosted service or <a href="https://hub.docker.com/r/hejny/promptbook/">self-hosted via Docker</a>.
|
|
571
571
|
</td>
|
|
572
572
|
</tr>
|
|
573
573
|
<tr>
|
|
@@ -657,8 +657,8 @@ For information on reporting security vulnerabilities, see our [Security Policy]
|
|
|
657
657
|
|
|
658
658
|
The fastest way to get started is with the **Agents Server**:
|
|
659
659
|
|
|
660
|
-
- 🐋 **[Docker image](https://hub.docker.com/r/hejny/promptbook/)**
|
|
661
|
-
- ☁️ **[Hosted Agents Server](https://gallery.ptbk.io/)**
|
|
660
|
+
- 🐋 **[Docker image](https://hub.docker.com/r/hejny/promptbook/)** - Self-host the Agents Server with full control over your data
|
|
661
|
+
- ☁️ **[Hosted Agents Server](https://gallery.ptbk.io/)** - Start creating agents immediately, no setup required
|
|
662
662
|
|
|
663
663
|
### NPM Packages _(for developers embedding the Engine)_
|
|
664
664
|
|
|
@@ -803,7 +803,7 @@ npx ptbk coder verify
|
|
|
803
803
|
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------ | ---- | ----- | ------------------------------------------------------------------------ |
|
|
804
804
|
| `ptbk coder init` | Creates `prompts/`, `prompts/done/`, the project-generic template files materialized in `prompts/templates/` (currently `common.md`), and a starter `AGENTS.md`; ensures `.env` contains `CODING_AGENT_GIT_NAME`, `CODING_AGENT_GIT_EMAIL`, and `CODING_AGENT_GIT_SIGNING_KEY`; adds helper coder scripts to `package.json`; ensures `.gitignore` contains `/.tmp`; and configures `.vscode/settings.json` to save pasted prompt images into `prompts/screenshots/`. |
|
|
805
805
|
| `ptbk coder generate-boilerplates` | Creates new prompt markdown files with fresh emoji tags so you can quickly fill in coding tasks; `--template` accepts either a built-in alias or a markdown file path relative to the project root. |
|
|
806
|
-
| `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, can optionally verify each attempt with a shell test command and feed failing output back for retries, then marks success or failure, commits the result, and pushes only when `--auto-push` is enabled.
|
|
806
|
+
| `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, can optionally verify each attempt with a shell test command and feed failing output back for retries, then marks success or failure, commits the result, and pushes only when `--auto-push` is enabled. |
|
|
807
807
|
| `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors; `--level <xlow | low | medium | high | xhigh | extreme>` ranges from a very benevolent scan to a very aggressive sweep. |
|
|
808
808
|
| `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
|
|
809
809
|
|
|
@@ -814,7 +814,7 @@ npx ptbk coder verify
|
|
|
814
814
|
| `--agent <name>` | Selects the coding backend. |
|
|
815
815
|
| `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
|
|
816
816
|
| `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
|
|
817
|
-
| `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries.
|
|
817
|
+
| `--test <command>` | Runs a verification command after each prompt attempt and feeds failing output back for retries. |
|
|
818
818
|
| `--thinking-level <level>` | Sets reasoning effort for supported runners. |
|
|
819
819
|
| `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
|
|
820
820
|
| `--ignore-git-changes` | Disables the clean-working-tree guard. |
|
|
@@ -917,8 +917,8 @@ _Note: This section is not a complete dictionary, more list of general AI / LLM
|
|
|
917
917
|
|
|
918
918
|
The **[Agents Server](https://gallery.ptbk.io/)** is the primary way to use Promptbook. It is a production-ready platform where you create, deploy, and manage persistent AI agents that work toward goals. Agents remember context across conversations, collaborate in teams, and follow the rules and knowledge you define in the Book language.
|
|
919
919
|
|
|
920
|
-
- **Hosted** at [gallery.ptbk.io](https://gallery.ptbk.io/)
|
|
921
|
-
- **Self-hosted** via [Docker](https://hub.docker.com/r/hejny/promptbook/)
|
|
920
|
+
- **Hosted** at [gallery.ptbk.io](https://gallery.ptbk.io/) - start creating agents immediately
|
|
921
|
+
- **Self-hosted** via [Docker](https://hub.docker.com/r/hejny/promptbook/) - full control over your data and infrastructure
|
|
922
922
|
- **API** for integrating agents into your own applications
|
|
923
923
|
|
|
924
924
|
## 🚂 Promptbook Engine
|
|
@@ -936,7 +936,7 @@ The Engine is the open-source core that powers the Agents Server. If you need to
|
|
|
936
936
|
- When you want agents that **collaborate in teams** and consult each other
|
|
937
937
|
- When you need to **integrate AI agents into your existing applications** via API
|
|
938
938
|
- When you want to **self-host** your AI agents with full control over data and infrastructure
|
|
939
|
-
- When you are writing an app that generates complex things via LLM
|
|
939
|
+
- When you are writing an app that generates complex things via LLM - like **websites, articles, presentations, code, stories, songs**,...
|
|
940
940
|
- When you want to **version** your agent definitions and **test multiple versions**
|
|
941
941
|
- When you want to **log** agent execution and backtrace issues
|
|
942
942
|
|
|
@@ -948,7 +948,7 @@ The Engine is the open-source core that powers the Agents Server. If you need to
|
|
|
948
948
|
- When [OpenAI Assistant (GPTs)](https://help.openai.com/en/articles/8673914-gpts-vs-assistants) is enough for you
|
|
949
949
|
- When you need streaming _(this may be implemented in the future, [see discussion](https://github.com/webgptorg/promptbook/discussions/102))_
|
|
950
950
|
- When you need to use something other than JavaScript or TypeScript _(other languages are on the way, [see the discussion](https://github.com/webgptorg/promptbook/discussions/101))_
|
|
951
|
-
- When your main focus is on something other than text
|
|
951
|
+
- When your main focus is on something other than text - like images, audio, video, spreadsheets _(other media types may be added in the future, [see discussion](https://github.com/webgptorg/promptbook/discussions/103))_
|
|
952
952
|
- When you need to use recursion _([see the discussion](https://github.com/webgptorg/promptbook/discussions/38))_
|
|
953
953
|
|
|
954
954
|
[See more](https://github.com/webgptorg/promptbook/discussions/112)
|
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-48';
|
|
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;
|