@promptbook/cli 0.104.0-10 → 0.104.0-12
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/admin/files/FilesGalleryClient.tsx +263 -0
- package/apps/agents-server/src/app/admin/files/actions.ts +61 -0
- package/apps/agents-server/src/app/admin/files/page.tsx +13 -0
- package/apps/agents-server/src/app/admin/image-generator-test/ImageGeneratorTestClient.tsx +169 -0
- package/apps/agents-server/src/app/admin/image-generator-test/page.tsx +13 -0
- package/apps/agents-server/src/app/admin/images/ImagesGalleryClient.tsx +256 -0
- package/apps/agents-server/src/app/admin/images/actions.ts +60 -0
- package/apps/agents-server/src/app/admin/images/page.tsx +13 -0
- package/apps/agents-server/src/app/admin/search-engine-test/SearchEngineTestClient.tsx +109 -0
- package/apps/agents-server/src/app/admin/search-engine-test/actions.ts +17 -0
- package/apps/agents-server/src/app/admin/search-engine-test/page.tsx +13 -0
- package/apps/agents-server/src/app/api/images/[filename]/route.ts +22 -1
- package/apps/agents-server/src/app/api/upload/route.ts +4 -2
- package/apps/agents-server/src/components/AgentProfile/AgentCapabilityChips.tsx +38 -0
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +4 -1
- package/apps/agents-server/src/components/Header/Header.tsx +16 -0
- package/apps/agents-server/src/components/Homepage/AgentCard.tsx +13 -8
- package/apps/agents-server/src/database/$getTableName.ts +1 -0
- package/apps/agents-server/src/database/migrations/2025-12-0830-image-purpose.sql +5 -0
- package/apps/agents-server/src/database/migrations/2025-12-0890-file-agent-id.sql +5 -0
- package/apps/agents-server/src/database/schema.ts +14 -1
- package/apps/agents-server/src/utils/messages/sendMessage.ts +6 -5
- package/esm/index.es.js +141 -28
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -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/types/ChatMessage.d.ts +2 -2
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +1 -1
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +1 -1
- package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +1 -1
- package/esm/typings/src/book-components/icons/CameraIcon.d.ts +1 -1
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +1 -1
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +1 -1
- package/esm/typings/src/book-components/icons/SaveIcon.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -2
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +0 -54
- 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/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/countUsage.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/agent/Agent.d.ts +6 -1
- package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
- package/esm/typings/src/remote-server/ui/ServerApp.d.ts +1 -1
- package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
- package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
- package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
- package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
- 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/$randomAgentPersona.d.ts +3 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +141 -28
- package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* @generated
|
|
57
57
|
* @see https://github.com/webgptorg/promptbook
|
|
58
58
|
*/
|
|
59
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
59
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-12';
|
|
60
60
|
/**
|
|
61
61
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
62
62
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -5419,7 +5419,7 @@
|
|
|
5419
5419
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
5420
5420
|
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
5421
5421
|
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
5422
|
-
* TODO: [👷♂️]
|
|
5422
|
+
* TODO: [👷♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
|
|
5423
5423
|
*/
|
|
5424
5424
|
|
|
5425
5425
|
/**
|
|
@@ -5672,7 +5672,7 @@
|
|
|
5672
5672
|
}
|
|
5673
5673
|
/**
|
|
5674
5674
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
5675
|
-
* TODO: [👷♂️]
|
|
5675
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
5676
5676
|
*/
|
|
5677
5677
|
|
|
5678
5678
|
/**
|
|
@@ -5857,7 +5857,7 @@
|
|
|
5857
5857
|
}
|
|
5858
5858
|
/**
|
|
5859
5859
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
5860
|
-
* TODO: [👷♂️]
|
|
5860
|
+
* TODO: [👷♂️] Write a comprehensive manual about the construction of LLM tools
|
|
5861
5861
|
* TODO: [🥃] Allow `ptbk make` without llm tools
|
|
5862
5862
|
* TODO: This should be maybe not under `_common` but under `utils-internal` / `utils/internal`
|
|
5863
5863
|
* TODO: [®] DRY Register logic
|
|
@@ -8014,7 +8014,7 @@
|
|
|
8014
8014
|
}
|
|
8015
8015
|
/**
|
|
8016
8016
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
8017
|
-
* TODO: [👷♂️]
|
|
8017
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
8018
8018
|
*/
|
|
8019
8019
|
|
|
8020
8020
|
/**
|
|
@@ -19311,6 +19311,22 @@
|
|
|
19311
19311
|
* TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
|
|
19312
19312
|
*/
|
|
19313
19313
|
|
|
19314
|
+
/**
|
|
19315
|
+
* Maps Promptbook tools to OpenAI tools.
|
|
19316
|
+
*
|
|
19317
|
+
* @private
|
|
19318
|
+
*/
|
|
19319
|
+
function mapToolsToOpenAi(tools) {
|
|
19320
|
+
return tools.map((tool) => ({
|
|
19321
|
+
type: 'function',
|
|
19322
|
+
function: {
|
|
19323
|
+
name: tool.name,
|
|
19324
|
+
description: tool.description,
|
|
19325
|
+
parameters: tool.parameters,
|
|
19326
|
+
},
|
|
19327
|
+
}));
|
|
19328
|
+
}
|
|
19329
|
+
|
|
19314
19330
|
/**
|
|
19315
19331
|
* Parses an OpenAI error message to identify which parameter is unsupported
|
|
19316
19332
|
*
|
|
@@ -19508,6 +19524,9 @@
|
|
|
19508
19524
|
},
|
|
19509
19525
|
],
|
|
19510
19526
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
19527
|
+
tools: currentModelRequirements.tools === undefined
|
|
19528
|
+
? undefined
|
|
19529
|
+
: mapToolsToOpenAi(currentModelRequirements.tools),
|
|
19511
19530
|
};
|
|
19512
19531
|
const start = $getCurrentDate();
|
|
19513
19532
|
if (this.options.isVerbose) {
|
|
@@ -19652,6 +19671,7 @@
|
|
|
19652
19671
|
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
19653
19672
|
const rawRequest = {
|
|
19654
19673
|
...modelSettings,
|
|
19674
|
+
model: modelName,
|
|
19655
19675
|
prompt: rawPromptContent,
|
|
19656
19676
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
19657
19677
|
};
|
|
@@ -19906,8 +19926,8 @@
|
|
|
19906
19926
|
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
19907
19927
|
const rawRequest = {
|
|
19908
19928
|
...modelSettings,
|
|
19909
|
-
size: modelSettings.size || '1024x1024',
|
|
19910
19929
|
prompt: rawPromptContent,
|
|
19930
|
+
size: modelSettings.size || '1024x1024',
|
|
19911
19931
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
19912
19932
|
response_format: 'url', // TODO: [🧠] Maybe allow b64_json
|
|
19913
19933
|
};
|
|
@@ -20805,6 +20825,7 @@
|
|
|
20805
20825
|
thread: {
|
|
20806
20826
|
messages: threadMessages,
|
|
20807
20827
|
},
|
|
20828
|
+
tools: modelRequirements.tools === undefined ? undefined : mapToolsToOpenAi(modelRequirements.tools),
|
|
20808
20829
|
// <- TODO: Add user identification here> user: this.options.user,
|
|
20809
20830
|
};
|
|
20810
20831
|
const start = $getCurrentDate();
|
|
@@ -25758,19 +25779,37 @@
|
|
|
25758
25779
|
`);
|
|
25759
25780
|
}
|
|
25760
25781
|
applyToAgentModelRequirements(requirements, content) {
|
|
25761
|
-
// We simply mark that browser capability is enabled in metadata
|
|
25762
|
-
// Get existing metadata
|
|
25763
|
-
const existingMetadata = requirements.metadata || {};
|
|
25764
25782
|
// Get existing tools array or create new one
|
|
25765
|
-
const existingTools =
|
|
25766
|
-
// Add '
|
|
25767
|
-
const updatedTools = existingTools.
|
|
25768
|
-
|
|
25783
|
+
const existingTools = requirements.tools || [];
|
|
25784
|
+
// Add 'web_browser' to tools if not already present
|
|
25785
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
|
|
25786
|
+
? existingTools
|
|
25787
|
+
: [
|
|
25788
|
+
...existingTools,
|
|
25789
|
+
{
|
|
25790
|
+
name: 'web_browser',
|
|
25791
|
+
description: spaceTrim$1.spaceTrim(`
|
|
25792
|
+
A tool that can browse the web.
|
|
25793
|
+
Use this tool when you need to access specific websites or browse the internet.
|
|
25794
|
+
`),
|
|
25795
|
+
parameters: {
|
|
25796
|
+
type: 'object',
|
|
25797
|
+
properties: {
|
|
25798
|
+
url: {
|
|
25799
|
+
type: 'string',
|
|
25800
|
+
description: 'The URL to browse',
|
|
25801
|
+
},
|
|
25802
|
+
},
|
|
25803
|
+
required: ['url'],
|
|
25804
|
+
},
|
|
25805
|
+
},
|
|
25806
|
+
];
|
|
25807
|
+
// Return requirements with updated tools and metadata
|
|
25769
25808
|
return {
|
|
25770
25809
|
...requirements,
|
|
25810
|
+
tools: updatedTools,
|
|
25771
25811
|
metadata: {
|
|
25772
|
-
...
|
|
25773
|
-
tools: updatedTools,
|
|
25812
|
+
...requirements.metadata,
|
|
25774
25813
|
useBrowser: true,
|
|
25775
25814
|
},
|
|
25776
25815
|
};
|
|
@@ -25863,13 +25902,13 @@
|
|
|
25863
25902
|
* The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
|
|
25864
25903
|
* to access and retrieve up-to-date information from the internet when necessary.
|
|
25865
25904
|
*
|
|
25866
|
-
* The content following `USE SEARCH ENGINE` is
|
|
25905
|
+
* The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
|
|
25867
25906
|
*
|
|
25868
25907
|
* Example usage in agent source:
|
|
25869
25908
|
*
|
|
25870
25909
|
* ```book
|
|
25871
25910
|
* USE SEARCH ENGINE
|
|
25872
|
-
* USE SEARCH ENGINE
|
|
25911
|
+
* USE SEARCH ENGINE Hledej informace o Přemyslovcích
|
|
25873
25912
|
* ```
|
|
25874
25913
|
*
|
|
25875
25914
|
* @private [🪔] Maybe export the commitments through some package
|
|
@@ -25901,7 +25940,7 @@
|
|
|
25901
25940
|
|
|
25902
25941
|
## Key aspects
|
|
25903
25942
|
|
|
25904
|
-
- The content following \`USE SEARCH ENGINE\` is
|
|
25943
|
+
- The content following \`USE SEARCH ENGINE\` is an arbitrary text that the agent should know (e.g. search scope or instructions).
|
|
25905
25944
|
- The actual search engine tool usage is handled by the agent runtime
|
|
25906
25945
|
- Allows the agent to search for current information from the web
|
|
25907
25946
|
- Useful for research tasks, finding facts, and accessing dynamic content
|
|
@@ -25926,20 +25965,39 @@
|
|
|
25926
25965
|
`);
|
|
25927
25966
|
}
|
|
25928
25967
|
applyToAgentModelRequirements(requirements, content) {
|
|
25929
|
-
// We simply mark that search engine capability is enabled in metadata
|
|
25930
|
-
// Get existing metadata
|
|
25931
|
-
const existingMetadata = requirements.metadata || {};
|
|
25932
25968
|
// Get existing tools array or create new one
|
|
25933
|
-
const existingTools =
|
|
25934
|
-
// Add '
|
|
25935
|
-
const updatedTools = existingTools.
|
|
25936
|
-
|
|
25969
|
+
const existingTools = requirements.tools || [];
|
|
25970
|
+
// Add 'web_search' to tools if not already present
|
|
25971
|
+
const updatedTools = existingTools.some((tool) => tool.name === 'web_search')
|
|
25972
|
+
? existingTools
|
|
25973
|
+
: [
|
|
25974
|
+
...existingTools,
|
|
25975
|
+
{
|
|
25976
|
+
name: 'web_search',
|
|
25977
|
+
description: spaceTrim$1.spaceTrim(`
|
|
25978
|
+
Search the internet for information.
|
|
25979
|
+
Use this tool when you need to find up-to-date information or facts that you don't know.
|
|
25980
|
+
${!content ? '' : `Search scope / instructions: ${content}`}
|
|
25981
|
+
`),
|
|
25982
|
+
parameters: {
|
|
25983
|
+
type: 'object',
|
|
25984
|
+
properties: {
|
|
25985
|
+
query: {
|
|
25986
|
+
type: 'string',
|
|
25987
|
+
description: 'The search query',
|
|
25988
|
+
},
|
|
25989
|
+
},
|
|
25990
|
+
required: ['query'],
|
|
25991
|
+
},
|
|
25992
|
+
},
|
|
25993
|
+
];
|
|
25994
|
+
// Return requirements with updated tools and metadata
|
|
25937
25995
|
return {
|
|
25938
25996
|
...requirements,
|
|
25997
|
+
tools: updatedTools,
|
|
25939
25998
|
metadata: {
|
|
25940
|
-
...
|
|
25941
|
-
|
|
25942
|
-
useSearchEngine: true,
|
|
25999
|
+
...requirements.metadata,
|
|
26000
|
+
useSearchEngine: content || true,
|
|
25943
26001
|
},
|
|
25944
26002
|
};
|
|
25945
26003
|
}
|
|
@@ -26543,7 +26601,57 @@
|
|
|
26543
26601
|
}
|
|
26544
26602
|
const meta = {};
|
|
26545
26603
|
const links = [];
|
|
26604
|
+
const capabilities = [];
|
|
26546
26605
|
for (const commitment of parseResult.commitments) {
|
|
26606
|
+
if (commitment.type === 'USE BROWSER') {
|
|
26607
|
+
capabilities.push({
|
|
26608
|
+
type: 'browser',
|
|
26609
|
+
label: 'Browser',
|
|
26610
|
+
iconName: 'Globe',
|
|
26611
|
+
});
|
|
26612
|
+
continue;
|
|
26613
|
+
}
|
|
26614
|
+
if (commitment.type === 'USE SEARCH ENGINE') {
|
|
26615
|
+
capabilities.push({
|
|
26616
|
+
type: 'search-engine',
|
|
26617
|
+
label: 'Search Internet',
|
|
26618
|
+
iconName: 'Search',
|
|
26619
|
+
});
|
|
26620
|
+
continue;
|
|
26621
|
+
}
|
|
26622
|
+
if (commitment.type === 'KNOWLEDGE') {
|
|
26623
|
+
const content = spaceTrim__default["default"](commitment.content).split('\n')[0] || '';
|
|
26624
|
+
let label = content;
|
|
26625
|
+
let iconName = 'Book';
|
|
26626
|
+
if (content.startsWith('http://') || content.startsWith('https://')) {
|
|
26627
|
+
try {
|
|
26628
|
+
const url = new URL(content);
|
|
26629
|
+
if (url.pathname.endsWith('.pdf')) {
|
|
26630
|
+
label = url.pathname.split('/').pop() || 'Document.pdf';
|
|
26631
|
+
iconName = 'FileText';
|
|
26632
|
+
}
|
|
26633
|
+
else {
|
|
26634
|
+
label = url.hostname.replace(/^www\./, '');
|
|
26635
|
+
}
|
|
26636
|
+
}
|
|
26637
|
+
catch (e) {
|
|
26638
|
+
// Invalid URL, treat as text
|
|
26639
|
+
}
|
|
26640
|
+
}
|
|
26641
|
+
else {
|
|
26642
|
+
// Text content - take first few words
|
|
26643
|
+
const words = content.split(/\s+/);
|
|
26644
|
+
if (words.length > 4) {
|
|
26645
|
+
label = words.slice(0, 4).join(' ') + '...';
|
|
26646
|
+
}
|
|
26647
|
+
}
|
|
26648
|
+
capabilities.push({
|
|
26649
|
+
type: 'knowledge',
|
|
26650
|
+
label,
|
|
26651
|
+
iconName,
|
|
26652
|
+
});
|
|
26653
|
+
continue;
|
|
26654
|
+
}
|
|
26547
26655
|
if (commitment.type === 'META LINK') {
|
|
26548
26656
|
const linkValue = spaceTrim__default["default"](commitment.content);
|
|
26549
26657
|
links.push(linkValue);
|
|
@@ -26554,6 +26662,10 @@
|
|
|
26554
26662
|
meta.image = spaceTrim__default["default"](commitment.content);
|
|
26555
26663
|
continue;
|
|
26556
26664
|
}
|
|
26665
|
+
if (commitment.type === 'META DESCRIPTION') {
|
|
26666
|
+
meta.description = spaceTrim__default["default"](commitment.content);
|
|
26667
|
+
continue;
|
|
26668
|
+
}
|
|
26557
26669
|
if (commitment.type === 'META COLOR') {
|
|
26558
26670
|
meta.color = normalizeSeparator(commitment.content);
|
|
26559
26671
|
continue;
|
|
@@ -26590,6 +26702,7 @@
|
|
|
26590
26702
|
meta,
|
|
26591
26703
|
links,
|
|
26592
26704
|
parameters,
|
|
26705
|
+
capabilities,
|
|
26593
26706
|
};
|
|
26594
26707
|
}
|
|
26595
26708
|
/**
|