@promptbook/cli 0.104.0-11 → 0.104.0-13
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/apps/agents-server/src/app/agents/[agentName]/AgentProfileWrapper.tsx +14 -8
- package/apps/agents-server/src/app/api/upload/route.ts +4 -2
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +1 -1
- package/apps/agents-server/src/components/Homepage/AgentsList.tsx +2 -2
- package/apps/agents-server/src/components/Homepage/DeletedAgentsList.tsx +2 -2
- package/apps/agents-server/src/components/Homepage/ExternalAgentsSection.tsx +1 -1
- package/apps/agents-server/src/tools/$provideBrowserForServer.ts +1 -1
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +1 -1
- package/apps/agents-server/src/utils/messages/sendMessage.ts +6 -5
- package/esm/index.es.js +96 -31
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +5 -0
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
- package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
- package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
- package/esm/typings/src/search-engines/SearchResult.d.ts +4 -4
- package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +1 -1
- package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +1 -1
- package/esm/typings/src/types/LlmToolDefinition.d.ts +20 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
- package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
- package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +96 -31
- package/umd/index.umd.js.map +1 -1
|
@@ -4,14 +4,17 @@ import { AgentBasicInformation, string_agent_name } from '@promptbook-local/type
|
|
|
4
4
|
import { AgentProfile } from '../../../components/AgentProfile/AgentProfile';
|
|
5
5
|
import { AgentOptionsMenu } from './AgentOptionsMenu';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Props for the `AgentProfileWrapper` component
|
|
9
|
+
*/
|
|
7
10
|
type AgentProfileWrapperProps = {
|
|
8
11
|
/***
|
|
9
|
-
*
|
|
12
|
+
* Basic information about the agent
|
|
10
13
|
*/
|
|
11
14
|
readonly agent: AgentBasicInformation;
|
|
12
15
|
|
|
13
16
|
/***
|
|
14
|
-
*
|
|
17
|
+
* URL where the agent can be accessed
|
|
15
18
|
*/
|
|
16
19
|
readonly agentUrl: string;
|
|
17
20
|
|
|
@@ -21,34 +24,37 @@ type AgentProfileWrapperProps = {
|
|
|
21
24
|
readonly publicUrl: URL;
|
|
22
25
|
|
|
23
26
|
/***
|
|
24
|
-
*
|
|
27
|
+
* Email address associated with the agent
|
|
25
28
|
*/
|
|
26
29
|
readonly agentEmail: string;
|
|
27
30
|
|
|
28
31
|
/***
|
|
29
|
-
*
|
|
32
|
+
* Unique name identifier for the agent
|
|
30
33
|
*/
|
|
31
34
|
readonly agentName: string_agent_name;
|
|
32
35
|
|
|
33
36
|
/***
|
|
34
|
-
*
|
|
37
|
+
* Brand color for the agent in hexadecimal format
|
|
35
38
|
*/
|
|
36
39
|
readonly brandColorHex: string;
|
|
37
40
|
|
|
38
41
|
/***
|
|
39
|
-
*
|
|
42
|
+
* Indicates if the current user has administrative privileges
|
|
40
43
|
*/
|
|
41
44
|
readonly isAdmin: boolean;
|
|
42
45
|
|
|
43
46
|
/***
|
|
44
|
-
*
|
|
47
|
+
* Indicates if the agent operates in headless mode
|
|
45
48
|
*/
|
|
46
49
|
readonly isHeadless: boolean;
|
|
47
50
|
|
|
51
|
+
/***
|
|
52
|
+
* Actions to be rendered within the agent profile
|
|
53
|
+
*/
|
|
48
54
|
readonly actions: React.ReactNode;
|
|
49
55
|
|
|
50
56
|
/***
|
|
51
|
-
*
|
|
57
|
+
* Child components to render within the agent profile
|
|
52
58
|
*/
|
|
53
59
|
readonly children: React.ReactNode;
|
|
54
60
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PostgrestSingleResponse, SupabaseClient } from '@supabase/supabase-js';
|
|
1
2
|
import { $getTableName } from '@/src/database/$getTableName';
|
|
2
3
|
import { $provideSupabase } from '@/src/database/$provideSupabase';
|
|
3
4
|
import { serializeError } from '@promptbook-local/utils';
|
|
@@ -6,12 +7,13 @@ import { NextRequest, NextResponse } from 'next/server';
|
|
|
6
7
|
import { assertsError } from '../../../../../../src/errors/assertsError';
|
|
7
8
|
import { getUserIdFromRequest } from '../../../../src/utils/getUserIdFromRequest';
|
|
8
9
|
import { getMetadata } from '../../../database/getMetadata';
|
|
10
|
+
import type { AgentsServerDatabase } from '../../../database/schema';
|
|
9
11
|
|
|
10
12
|
export async function POST(request: NextRequest) {
|
|
11
13
|
try {
|
|
12
14
|
const body = (await request.json()) as HandleUploadBody;
|
|
13
15
|
const userId = await getUserIdFromRequest(request);
|
|
14
|
-
const supabase = $provideSupabase();
|
|
16
|
+
const supabase: SupabaseClient<AgentsServerDatabase> = $provideSupabase();
|
|
15
17
|
|
|
16
18
|
// Handle Vercel Blob client upload protocol
|
|
17
19
|
const jsonResponse = await handleUpload({
|
|
@@ -38,7 +40,7 @@ export async function POST(request: NextRequest) {
|
|
|
38
40
|
|
|
39
41
|
// Create a DB record at the start of the upload to track it
|
|
40
42
|
const uploadPurpose = purpose || 'GENERIC_UPLOAD';
|
|
41
|
-
const { data: insertedFile, error: insertError } = await supabase
|
|
43
|
+
const { data: insertedFile, error: insertError }: PostgrestSingleResponse<Pick<AgentsServerDatabase['public']['Tables']['File']['Row'], 'id'>> = await supabase
|
|
42
44
|
.from(await $getTableName('File'))
|
|
43
45
|
.insert({
|
|
44
46
|
userId: userId || null,
|
|
@@ -83,7 +83,7 @@ export function AgentProfile(props: AgentProfileProps) {
|
|
|
83
83
|
|
|
84
84
|
const { meta, agentName } = agent;
|
|
85
85
|
const fullname = (meta.fullname as string) || agentName || 'Agent';
|
|
86
|
-
const personaDescription = agent.personaDescription || '';
|
|
86
|
+
const personaDescription = meta.description || agent.personaDescription || '';
|
|
87
87
|
const imageUrl = meta.image || generatePlaceholderAgentProfileImageUrl(permanentId, publicUrl);
|
|
88
88
|
|
|
89
89
|
const [isQrModalOpen, setIsQrModalOpen] = useState(false);
|
|
@@ -17,12 +17,12 @@ type AgentWithVisibility = AgentBasicInformation & {
|
|
|
17
17
|
|
|
18
18
|
type AgentsListProps = {
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* List of agents to display, each with basic information and visibility status
|
|
21
21
|
*/
|
|
22
22
|
readonly agents: AgentWithVisibility[];
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Indicates if the current user has administrative privileges for managing agents
|
|
26
26
|
*/
|
|
27
27
|
readonly isAdmin: boolean;
|
|
28
28
|
|
|
@@ -8,12 +8,12 @@ import { AgentBasicInformation } from '../../../../../src/book-2.0/agent-source/
|
|
|
8
8
|
|
|
9
9
|
type DeletedAgentsListProps = {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* List of deleted agents available for restoration
|
|
12
12
|
*/
|
|
13
13
|
readonly agents: readonly AgentBasicInformation[];
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Indicates if the current user has administrative privileges for managing agents
|
|
17
17
|
*/
|
|
18
18
|
readonly isAdmin: boolean;
|
|
19
19
|
|
|
@@ -10,7 +10,7 @@ import { BrowserContext, chromium } from 'playwright';
|
|
|
10
10
|
let browserInstance: BrowserContext | null = null;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Provides a browser context for server-side operations, with caching to reuse instances.
|
|
14
14
|
*/
|
|
15
15
|
export async function $provideBrowserForServer(): Promise<BrowserContext> {
|
|
16
16
|
if (browserInstance !== null && browserInstance.browser() && browserInstance.browser()!.isConnected()) {
|
|
@@ -11,7 +11,7 @@ import { IIFilesStorageWithCdn } from '../utils/cdn/interfaces/IFilesStorage';
|
|
|
11
11
|
let cdn: IIFilesStorageWithCdn | null = null;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Provides a CDN storage interface for server-side file operations, with caching to reuse instances.
|
|
15
15
|
*/
|
|
16
16
|
export function $provideCdnForServer(): IIFilesStorageWithCdn {
|
|
17
17
|
if (!cdn) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PostgrestSingleResponse, SupabaseClient } from '@supabase/supabase-js';
|
|
1
2
|
import type { really_any } from '@promptbook-local/types';
|
|
2
3
|
import { serializeError } from '@promptbook-local/utils';
|
|
3
4
|
import { assertsError } from '../../../../../src/errors/assertsError';
|
|
@@ -5,15 +6,16 @@ import { $getTableName } from '../../database/$getTableName';
|
|
|
5
6
|
import { $provideSupabaseForServer } from '../../database/$provideSupabaseForServer';
|
|
6
7
|
import { EMAIL_PROVIDERS } from '../../message-providers';
|
|
7
8
|
import { OutboundEmail } from '../../message-providers/email/_common/Email';
|
|
9
|
+
import type { AgentsServerDatabase } from '../../database/schema';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Sends a message
|
|
11
13
|
*/
|
|
12
14
|
export async function sendMessage(message: OutboundEmail): Promise<void> {
|
|
13
|
-
const supabase = await $provideSupabaseForServer();
|
|
15
|
+
const supabase: SupabaseClient<AgentsServerDatabase> = await $provideSupabaseForServer();
|
|
14
16
|
|
|
15
17
|
// 1. Insert message
|
|
16
|
-
const { data: insertedMessage, error: insertError } = await supabase
|
|
18
|
+
const { data: insertedMessage, error: insertError }: PostgrestSingleResponse<AgentsServerDatabase['public']['Tables']['Message']['Row']> = await supabase
|
|
17
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
20
|
.from(await $getTableName('Message'))
|
|
19
21
|
.insert({
|
|
@@ -46,11 +48,11 @@ export async function sendMessage(message: OutboundEmail): Promise<void> {
|
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
let isSent = false;
|
|
51
|
+
let isSent: boolean = false;
|
|
50
52
|
|
|
51
53
|
for (const providerName of providers) {
|
|
52
54
|
const provider = EMAIL_PROVIDERS[providerName];
|
|
53
|
-
let isSuccessful = false;
|
|
55
|
+
let isSuccessful: boolean = false;
|
|
54
56
|
let raw: really_any = null;
|
|
55
57
|
|
|
56
58
|
try {
|
|
@@ -67,7 +69,6 @@ export async function sendMessage(message: OutboundEmail): Promise<void> {
|
|
|
67
69
|
// 3. Log attempt
|
|
68
70
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
71
|
await supabase.from(await $getTableName('MessageSendAttempt')).insert({
|
|
70
|
-
// @ts-expect-error: insertedMessage is any
|
|
71
72
|
messageId: insertedMessage.id,
|
|
72
73
|
providerName,
|
|
73
74
|
isSuccessful,
|
package/esm/index.es.js
CHANGED
|
@@ -47,7 +47,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-13';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -5663,7 +5663,7 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
|
5663
5663
|
}
|
|
5664
5664
|
/**
|
|
5665
5665
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
5666
|
-
* TODO: [👷♂️]
|
|
5666
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
5667
5667
|
*/
|
|
5668
5668
|
|
|
5669
5669
|
/**
|
|
@@ -5848,7 +5848,7 @@ async function $provideLlmToolsForWizardOrCli(options) {
|
|
|
5848
5848
|
}
|
|
5849
5849
|
/**
|
|
5850
5850
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
5851
|
-
* TODO: [👷♂️]
|
|
5851
|
+
* TODO: [👷♂️] Write a comprehensive manual about the construction of LLM tools
|
|
5852
5852
|
* TODO: [🥃] Allow `ptbk make` without llm tools
|
|
5853
5853
|
* TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
|
|
5854
5854
|
* TODO: [®] DRY Register logic
|
|
@@ -8005,7 +8005,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
|
|
|
8005
8005
|
}
|
|
8006
8006
|
/**
|
|
8007
8007
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
8008
|
-
* TODO: [👷♂️]
|
|
8008
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
8009
8009
|
*/
|
|
8010
8010
|
|
|
8011
8011
|
/**
|
|
@@ -11273,7 +11273,12 @@ const jokerCommandParser = {
|
|
|
11273
11273
|
* @see {@link ModelVariant}
|
|
11274
11274
|
* @public exported from `@promptbook/core`
|
|
11275
11275
|
*/
|
|
11276
|
-
const MODEL_VARIANTS = [
|
|
11276
|
+
const MODEL_VARIANTS = [
|
|
11277
|
+
'COMPLETION',
|
|
11278
|
+
'CHAT',
|
|
11279
|
+
'IMAGE_GENERATION',
|
|
11280
|
+
'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */,
|
|
11281
|
+
];
|
|
11277
11282
|
|
|
11278
11283
|
/**
|
|
11279
11284
|
* Parses the model command
|
|
@@ -19302,6 +19307,22 @@ resultContent, rawResponse) {
|
|
|
19302
19307
|
* TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
|
|
19303
19308
|
*/
|
|
19304
19309
|
|
|
19310
|
+
/**
|
|
19311
|
+
* Maps Promptbook tools to OpenAI tools.
|
|
19312
|
+
*
|
|
19313
|
+
* @private
|
|
19314
|
+
*/
|
|
19315
|
+
function mapToolsToOpenAi(tools) {
|
|
19316
|
+
return tools.map((tool) => ({
|
|
19317
|
+
type: 'function',
|
|
19318
|
+
function: {
|
|
19319
|
+
name: tool.name,
|
|
19320
|
+
description: tool.description,
|
|
19321
|
+
parameters: tool.parameters,
|
|
19322
|
+
},
|
|
19323
|
+
}));
|
|
19324
|
+
}
|
|
19325
|
+
|
|
19305
19326
|
/**
|
|
19306
19327
|
* Parses an OpenAI error message to identify which parameter is unsupported
|
|
19307
19328
|
*
|
|
@@ -19499,6 +19520,9 @@ class OpenAiCompatibleExecutionTools {
|
|
|
19499
19520
|
},
|
|
19500
19521
|
],
|
|
19501
19522
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
19523
|
+
tools: currentModelRequirements.tools === undefined
|
|
19524
|
+
? undefined
|
|
19525
|
+
: mapToolsToOpenAi(currentModelRequirements.tools),
|
|
19502
19526
|
};
|
|
19503
19527
|
const start = $getCurrentDate();
|
|
19504
19528
|
if (this.options.isVerbose) {
|
|
@@ -19643,6 +19667,7 @@ class OpenAiCompatibleExecutionTools {
|
|
|
19643
19667
|
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
19644
19668
|
const rawRequest = {
|
|
19645
19669
|
...modelSettings,
|
|
19670
|
+
model: modelName,
|
|
19646
19671
|
prompt: rawPromptContent,
|
|
19647
19672
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
19648
19673
|
};
|
|
@@ -19897,8 +19922,8 @@ class OpenAiCompatibleExecutionTools {
|
|
|
19897
19922
|
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
19898
19923
|
const rawRequest = {
|
|
19899
19924
|
...modelSettings,
|
|
19900
|
-
size: modelSettings.size || '1024x1024',
|
|
19901
19925
|
prompt: rawPromptContent,
|
|
19926
|
+
size: modelSettings.size || '1024x1024',
|
|
19902
19927
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
19903
19928
|
response_format: 'url', // TODO: [🧠] Maybe allow b64_json
|
|
19904
19929
|
};
|
|
@@ -20796,6 +20821,7 @@ class OpenAiAssistantExecutionTools extends OpenAiExecutionTools {
|
|
|
20796
20821
|
thread: {
|
|
20797
20822
|
messages: threadMessages,
|
|
20798
20823
|
},
|
|
20824
|
+
tools: modelRequirements.tools === undefined ? undefined : mapToolsToOpenAi(modelRequirements.tools),
|
|
20799
20825
|
// <- TODO: Add user identification here> user: this.options.user,
|
|
20800
20826
|
};
|
|
20801
20827
|
const start = $getCurrentDate();
|
|
@@ -23218,9 +23244,7 @@ class DictionaryCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
23218
23244
|
// Get existing dictionary entries from metadata
|
|
23219
23245
|
const existingDictionary = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
|
|
23220
23246
|
// Merge the new dictionary entry with existing entries
|
|
23221
|
-
const mergedDictionary = existingDictionary
|
|
23222
|
-
? `${existingDictionary}\n${trimmedContent}`
|
|
23223
|
-
: trimmedContent;
|
|
23247
|
+
const mergedDictionary = existingDictionary ? `${existingDictionary}\n${trimmedContent}` : trimmedContent;
|
|
23224
23248
|
// Store the merged dictionary in metadata for debugging and inspection
|
|
23225
23249
|
const updatedMetadata = {
|
|
23226
23250
|
...requirements.metadata,
|
|
@@ -25749,19 +25773,37 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
25749
25773
|
`);
|
|
25750
25774
|
}
|
|
25751
25775
|
applyToAgentModelRequirements(requirements, content) {
|
|
25752
|
-
// We simply mark that browser capability is enabled in metadata
|
|
25753
|
-
// Get existing metadata
|
|
25754
|
-
const existingMetadata = requirements.metadata || {};
|
|
25755
25776
|
// Get existing tools array or create new one
|
|
25756
|
-
const existingTools =
|
|
25757
|
-
// Add '
|
|
25758
|
-
const updatedTools = existingTools.
|
|
25759
|
-
|
|
25777
|
+
const existingTools = requirements.tools || [];
|
|
25778
|
+
// Add 'web_browser' to tools if not already present
|
|
25779
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
|
|
25780
|
+
? existingTools
|
|
25781
|
+
: [
|
|
25782
|
+
...existingTools,
|
|
25783
|
+
{
|
|
25784
|
+
name: 'web_browser',
|
|
25785
|
+
description: spaceTrim$1(`
|
|
25786
|
+
A tool that can browse the web.
|
|
25787
|
+
Use this tool when you need to access specific websites or browse the internet.
|
|
25788
|
+
`),
|
|
25789
|
+
parameters: {
|
|
25790
|
+
type: 'object',
|
|
25791
|
+
properties: {
|
|
25792
|
+
url: {
|
|
25793
|
+
type: 'string',
|
|
25794
|
+
description: 'The URL to browse',
|
|
25795
|
+
},
|
|
25796
|
+
},
|
|
25797
|
+
required: ['url'],
|
|
25798
|
+
},
|
|
25799
|
+
},
|
|
25800
|
+
];
|
|
25801
|
+
// Return requirements with updated tools and metadata
|
|
25760
25802
|
return {
|
|
25761
25803
|
...requirements,
|
|
25804
|
+
tools: updatedTools,
|
|
25762
25805
|
metadata: {
|
|
25763
|
-
...
|
|
25764
|
-
tools: updatedTools,
|
|
25806
|
+
...requirements.metadata,
|
|
25765
25807
|
useBrowser: true,
|
|
25766
25808
|
},
|
|
25767
25809
|
};
|
|
@@ -25854,13 +25896,13 @@ class UseMcpCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
25854
25896
|
* The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
|
|
25855
25897
|
* to access and retrieve up-to-date information from the internet when necessary.
|
|
25856
25898
|
*
|
|
25857
|
-
* The content following `USE SEARCH ENGINE` is
|
|
25899
|
+
* The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
|
|
25858
25900
|
*
|
|
25859
25901
|
* Example usage in agent source:
|
|
25860
25902
|
*
|
|
25861
25903
|
* ```book
|
|
25862
25904
|
* USE SEARCH ENGINE
|
|
25863
|
-
* USE SEARCH ENGINE
|
|
25905
|
+
* USE SEARCH ENGINE Hledej informace o Přemyslovcích
|
|
25864
25906
|
* ```
|
|
25865
25907
|
*
|
|
25866
25908
|
* @private [🪔] Maybe export the commitments through some package
|
|
@@ -25892,7 +25934,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
25892
25934
|
|
|
25893
25935
|
## Key aspects
|
|
25894
25936
|
|
|
25895
|
-
- The content following \`USE SEARCH ENGINE\` is
|
|
25937
|
+
- The content following \`USE SEARCH ENGINE\` is an arbitrary text that the agent should know (e.g. search scope or instructions).
|
|
25896
25938
|
- The actual search engine tool usage is handled by the agent runtime
|
|
25897
25939
|
- Allows the agent to search for current information from the web
|
|
25898
25940
|
- Useful for research tasks, finding facts, and accessing dynamic content
|
|
@@ -25917,20 +25959,39 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
25917
25959
|
`);
|
|
25918
25960
|
}
|
|
25919
25961
|
applyToAgentModelRequirements(requirements, content) {
|
|
25920
|
-
// We simply mark that search engine capability is enabled in metadata
|
|
25921
|
-
// Get existing metadata
|
|
25922
|
-
const existingMetadata = requirements.metadata || {};
|
|
25923
25962
|
// Get existing tools array or create new one
|
|
25924
|
-
const existingTools =
|
|
25925
|
-
// Add '
|
|
25926
|
-
const updatedTools = existingTools.
|
|
25927
|
-
|
|
25963
|
+
const existingTools = requirements.tools || [];
|
|
25964
|
+
// Add 'web_search' to tools if not already present
|
|
25965
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'web_search')
|
|
25966
|
+
? existingTools
|
|
25967
|
+
: [
|
|
25968
|
+
...existingTools,
|
|
25969
|
+
{
|
|
25970
|
+
name: 'web_search',
|
|
25971
|
+
description: spaceTrim$1(`
|
|
25972
|
+
Search the internet for information.
|
|
25973
|
+
Use this tool when you need to find up-to-date information or facts that you don't know.
|
|
25974
|
+
${!content ? '' : `Search scope / instructions: ${content}`}
|
|
25975
|
+
`),
|
|
25976
|
+
parameters: {
|
|
25977
|
+
type: 'object',
|
|
25978
|
+
properties: {
|
|
25979
|
+
query: {
|
|
25980
|
+
type: 'string',
|
|
25981
|
+
description: 'The search query',
|
|
25982
|
+
},
|
|
25983
|
+
},
|
|
25984
|
+
required: ['query'],
|
|
25985
|
+
},
|
|
25986
|
+
},
|
|
25987
|
+
];
|
|
25988
|
+
// Return requirements with updated tools and metadata
|
|
25928
25989
|
return {
|
|
25929
25990
|
...requirements,
|
|
25991
|
+
tools: updatedTools,
|
|
25930
25992
|
metadata: {
|
|
25931
|
-
...
|
|
25932
|
-
|
|
25933
|
-
useSearchEngine: true,
|
|
25993
|
+
...requirements.metadata,
|
|
25994
|
+
useSearchEngine: content || true,
|
|
25934
25995
|
},
|
|
25935
25996
|
};
|
|
25936
25997
|
}
|
|
@@ -26595,6 +26656,10 @@ function parseAgentSource(agentSource) {
|
|
|
26595
26656
|
meta.image = spaceTrim$2(commitment.content);
|
|
26596
26657
|
continue;
|
|
26597
26658
|
}
|
|
26659
|
+
if (commitment.type === 'META DESCRIPTION') {
|
|
26660
|
+
meta.description = spaceTrim$2(commitment.content);
|
|
26661
|
+
continue;
|
|
26662
|
+
}
|
|
26598
26663
|
if (commitment.type === 'META COLOR') {
|
|
26599
26664
|
meta.color = normalizeSeparator(commitment.content);
|
|
26600
26665
|
continue;
|