@promptbook/browser 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.
Files changed (40) hide show
  1. package/esm/index.es.js +115 -23
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/types.index.d.ts +8 -0
  4. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -0
  5. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +5 -0
  6. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
  7. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +2 -2
  8. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
  9. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +1 -1
  10. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +1 -1
  11. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +1 -1
  12. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +1 -1
  13. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +1 -1
  14. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +1 -1
  15. package/esm/typings/src/book-components/icons/SaveIcon.d.ts +1 -1
  16. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -2
  17. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +0 -54
  18. package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
  19. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
  20. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  21. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
  22. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
  23. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +1 -1
  24. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
  25. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
  26. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -1
  27. package/esm/typings/src/llm-providers/agent/Agent.d.ts +6 -1
  28. package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
  29. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +1 -1
  30. package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
  31. package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
  32. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
  33. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
  34. package/esm/typings/src/types/LlmToolDefinition.d.ts +20 -0
  35. package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
  36. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +3 -2
  37. package/esm/typings/src/version.d.ts +1 -1
  38. package/package.json +2 -2
  39. package/umd/index.umd.js +115 -23
  40. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -19,7 +19,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
19
19
  * @generated
20
20
  * @see https://github.com/webgptorg/promptbook
21
21
  */
22
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-10';
22
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-12';
23
23
  /**
24
24
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
25
25
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -5716,19 +5716,37 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
5716
5716
  `);
5717
5717
  }
5718
5718
  applyToAgentModelRequirements(requirements, content) {
5719
- // We simply mark that browser capability is enabled in metadata
5720
- // Get existing metadata
5721
- const existingMetadata = requirements.metadata || {};
5722
5719
  // Get existing tools array or create new one
5723
- const existingTools = existingMetadata.tools || [];
5724
- // Add 'browser' to tools if not already present
5725
- const updatedTools = existingTools.includes('browser') ? existingTools : [...existingTools, 'browser'];
5726
- // Return requirements with updated metadata
5720
+ const existingTools = requirements.tools || [];
5721
+ // Add 'web_browser' to tools if not already present
5722
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
5723
+ ? existingTools
5724
+ : [
5725
+ ...existingTools,
5726
+ {
5727
+ name: 'web_browser',
5728
+ description: spaceTrim$1(`
5729
+ A tool that can browse the web.
5730
+ Use this tool when you need to access specific websites or browse the internet.
5731
+ `),
5732
+ parameters: {
5733
+ type: 'object',
5734
+ properties: {
5735
+ url: {
5736
+ type: 'string',
5737
+ description: 'The URL to browse',
5738
+ },
5739
+ },
5740
+ required: ['url'],
5741
+ },
5742
+ },
5743
+ ];
5744
+ // Return requirements with updated tools and metadata
5727
5745
  return {
5728
5746
  ...requirements,
5747
+ tools: updatedTools,
5729
5748
  metadata: {
5730
- ...existingMetadata,
5731
- tools: updatedTools,
5749
+ ...requirements.metadata,
5732
5750
  useBrowser: true,
5733
5751
  },
5734
5752
  };
@@ -5821,13 +5839,13 @@ class UseMcpCommitmentDefinition extends BaseCommitmentDefinition {
5821
5839
  * The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
5822
5840
  * to access and retrieve up-to-date information from the internet when necessary.
5823
5841
  *
5824
- * The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
5842
+ * The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
5825
5843
  *
5826
5844
  * Example usage in agent source:
5827
5845
  *
5828
5846
  * ```book
5829
5847
  * USE SEARCH ENGINE
5830
- * USE SEARCH ENGINE This will be ignored
5848
+ * USE SEARCH ENGINE Hledej informace o Přemyslovcích
5831
5849
  * ```
5832
5850
  *
5833
5851
  * @private [🪔] Maybe export the commitments through some package
@@ -5859,7 +5877,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
5859
5877
 
5860
5878
  ## Key aspects
5861
5879
 
5862
- - The content following \`USE SEARCH ENGINE\` is ignored (similar to NOTE)
5880
+ - The content following \`USE SEARCH ENGINE\` is an arbitrary text that the agent should know (e.g. search scope or instructions).
5863
5881
  - The actual search engine tool usage is handled by the agent runtime
5864
5882
  - Allows the agent to search for current information from the web
5865
5883
  - Useful for research tasks, finding facts, and accessing dynamic content
@@ -5884,20 +5902,39 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
5884
5902
  `);
5885
5903
  }
5886
5904
  applyToAgentModelRequirements(requirements, content) {
5887
- // We simply mark that search engine capability is enabled in metadata
5888
- // Get existing metadata
5889
- const existingMetadata = requirements.metadata || {};
5890
5905
  // Get existing tools array or create new one
5891
- const existingTools = existingMetadata.tools || [];
5892
- // Add 'search-engine' to tools if not already present
5893
- const updatedTools = existingTools.includes('search-engine') ? existingTools : [...existingTools, 'search-engine'];
5894
- // Return requirements with updated metadata
5906
+ const existingTools = requirements.tools || [];
5907
+ // Add 'web_search' to tools if not already present
5908
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_search')
5909
+ ? existingTools
5910
+ : [
5911
+ ...existingTools,
5912
+ {
5913
+ name: 'web_search',
5914
+ description: spaceTrim$1(`
5915
+ Search the internet for information.
5916
+ Use this tool when you need to find up-to-date information or facts that you don't know.
5917
+ ${!content ? '' : `Search scope / instructions: ${content}`}
5918
+ `),
5919
+ parameters: {
5920
+ type: 'object',
5921
+ properties: {
5922
+ query: {
5923
+ type: 'string',
5924
+ description: 'The search query',
5925
+ },
5926
+ },
5927
+ required: ['query'],
5928
+ },
5929
+ },
5930
+ ];
5931
+ // Return requirements with updated tools and metadata
5895
5932
  return {
5896
5933
  ...requirements,
5934
+ tools: updatedTools,
5897
5935
  metadata: {
5898
- ...existingMetadata,
5899
- tools: updatedTools,
5900
- useSearchEngine: true,
5936
+ ...requirements.metadata,
5937
+ useSearchEngine: content || true,
5901
5938
  },
5902
5939
  };
5903
5940
  }
@@ -6301,7 +6338,57 @@ function parseAgentSource(agentSource) {
6301
6338
  }
6302
6339
  const meta = {};
6303
6340
  const links = [];
6341
+ const capabilities = [];
6304
6342
  for (const commitment of parseResult.commitments) {
6343
+ if (commitment.type === 'USE BROWSER') {
6344
+ capabilities.push({
6345
+ type: 'browser',
6346
+ label: 'Browser',
6347
+ iconName: 'Globe',
6348
+ });
6349
+ continue;
6350
+ }
6351
+ if (commitment.type === 'USE SEARCH ENGINE') {
6352
+ capabilities.push({
6353
+ type: 'search-engine',
6354
+ label: 'Search Internet',
6355
+ iconName: 'Search',
6356
+ });
6357
+ continue;
6358
+ }
6359
+ if (commitment.type === 'KNOWLEDGE') {
6360
+ const content = spaceTrim$2(commitment.content).split('\n')[0] || '';
6361
+ let label = content;
6362
+ let iconName = 'Book';
6363
+ if (content.startsWith('http://') || content.startsWith('https://')) {
6364
+ try {
6365
+ const url = new URL(content);
6366
+ if (url.pathname.endsWith('.pdf')) {
6367
+ label = url.pathname.split('/').pop() || 'Document.pdf';
6368
+ iconName = 'FileText';
6369
+ }
6370
+ else {
6371
+ label = url.hostname.replace(/^www\./, '');
6372
+ }
6373
+ }
6374
+ catch (e) {
6375
+ // Invalid URL, treat as text
6376
+ }
6377
+ }
6378
+ else {
6379
+ // Text content - take first few words
6380
+ const words = content.split(/\s+/);
6381
+ if (words.length > 4) {
6382
+ label = words.slice(0, 4).join(' ') + '...';
6383
+ }
6384
+ }
6385
+ capabilities.push({
6386
+ type: 'knowledge',
6387
+ label,
6388
+ iconName,
6389
+ });
6390
+ continue;
6391
+ }
6305
6392
  if (commitment.type === 'META LINK') {
6306
6393
  const linkValue = spaceTrim$2(commitment.content);
6307
6394
  links.push(linkValue);
@@ -6312,6 +6399,10 @@ function parseAgentSource(agentSource) {
6312
6399
  meta.image = spaceTrim$2(commitment.content);
6313
6400
  continue;
6314
6401
  }
6402
+ if (commitment.type === 'META DESCRIPTION') {
6403
+ meta.description = spaceTrim$2(commitment.content);
6404
+ continue;
6405
+ }
6315
6406
  if (commitment.type === 'META COLOR') {
6316
6407
  meta.color = normalizeSeparator(commitment.content);
6317
6408
  continue;
@@ -6348,6 +6439,7 @@ function parseAgentSource(agentSource) {
6348
6439
  meta,
6349
6440
  links,
6350
6441
  parameters,
6442
+ capabilities,
6351
6443
  };
6352
6444
  }
6353
6445
  /**