@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/umd/index.umd.js CHANGED
@@ -23,7 +23,7 @@
23
23
  * @generated
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-10';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-12';
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
@@ -5720,19 +5720,37 @@
5720
5720
  `);
5721
5721
  }
5722
5722
  applyToAgentModelRequirements(requirements, content) {
5723
- // We simply mark that browser capability is enabled in metadata
5724
- // Get existing metadata
5725
- const existingMetadata = requirements.metadata || {};
5726
5723
  // Get existing tools array or create new one
5727
- const existingTools = existingMetadata.tools || [];
5728
- // Add 'browser' to tools if not already present
5729
- const updatedTools = existingTools.includes('browser') ? existingTools : [...existingTools, 'browser'];
5730
- // Return requirements with updated metadata
5724
+ const existingTools = requirements.tools || [];
5725
+ // Add 'web_browser' to tools if not already present
5726
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
5727
+ ? existingTools
5728
+ : [
5729
+ ...existingTools,
5730
+ {
5731
+ name: 'web_browser',
5732
+ description: spaceTrim$1.spaceTrim(`
5733
+ A tool that can browse the web.
5734
+ Use this tool when you need to access specific websites or browse the internet.
5735
+ `),
5736
+ parameters: {
5737
+ type: 'object',
5738
+ properties: {
5739
+ url: {
5740
+ type: 'string',
5741
+ description: 'The URL to browse',
5742
+ },
5743
+ },
5744
+ required: ['url'],
5745
+ },
5746
+ },
5747
+ ];
5748
+ // Return requirements with updated tools and metadata
5731
5749
  return {
5732
5750
  ...requirements,
5751
+ tools: updatedTools,
5733
5752
  metadata: {
5734
- ...existingMetadata,
5735
- tools: updatedTools,
5753
+ ...requirements.metadata,
5736
5754
  useBrowser: true,
5737
5755
  },
5738
5756
  };
@@ -5825,13 +5843,13 @@
5825
5843
  * The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
5826
5844
  * to access and retrieve up-to-date information from the internet when necessary.
5827
5845
  *
5828
- * The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
5846
+ * The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
5829
5847
  *
5830
5848
  * Example usage in agent source:
5831
5849
  *
5832
5850
  * ```book
5833
5851
  * USE SEARCH ENGINE
5834
- * USE SEARCH ENGINE This will be ignored
5852
+ * USE SEARCH ENGINE Hledej informace o Přemyslovcích
5835
5853
  * ```
5836
5854
  *
5837
5855
  * @private [🪔] Maybe export the commitments through some package
@@ -5863,7 +5881,7 @@
5863
5881
 
5864
5882
  ## Key aspects
5865
5883
 
5866
- - The content following \`USE SEARCH ENGINE\` is ignored (similar to NOTE)
5884
+ - The content following \`USE SEARCH ENGINE\` is an arbitrary text that the agent should know (e.g. search scope or instructions).
5867
5885
  - The actual search engine tool usage is handled by the agent runtime
5868
5886
  - Allows the agent to search for current information from the web
5869
5887
  - Useful for research tasks, finding facts, and accessing dynamic content
@@ -5888,20 +5906,39 @@
5888
5906
  `);
5889
5907
  }
5890
5908
  applyToAgentModelRequirements(requirements, content) {
5891
- // We simply mark that search engine capability is enabled in metadata
5892
- // Get existing metadata
5893
- const existingMetadata = requirements.metadata || {};
5894
5909
  // Get existing tools array or create new one
5895
- const existingTools = existingMetadata.tools || [];
5896
- // Add 'search-engine' to tools if not already present
5897
- const updatedTools = existingTools.includes('search-engine') ? existingTools : [...existingTools, 'search-engine'];
5898
- // Return requirements with updated metadata
5910
+ const existingTools = requirements.tools || [];
5911
+ // Add 'web_search' to tools if not already present
5912
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_search')
5913
+ ? existingTools
5914
+ : [
5915
+ ...existingTools,
5916
+ {
5917
+ name: 'web_search',
5918
+ description: spaceTrim$1.spaceTrim(`
5919
+ Search the internet for information.
5920
+ Use this tool when you need to find up-to-date information or facts that you don't know.
5921
+ ${!content ? '' : `Search scope / instructions: ${content}`}
5922
+ `),
5923
+ parameters: {
5924
+ type: 'object',
5925
+ properties: {
5926
+ query: {
5927
+ type: 'string',
5928
+ description: 'The search query',
5929
+ },
5930
+ },
5931
+ required: ['query'],
5932
+ },
5933
+ },
5934
+ ];
5935
+ // Return requirements with updated tools and metadata
5899
5936
  return {
5900
5937
  ...requirements,
5938
+ tools: updatedTools,
5901
5939
  metadata: {
5902
- ...existingMetadata,
5903
- tools: updatedTools,
5904
- useSearchEngine: true,
5940
+ ...requirements.metadata,
5941
+ useSearchEngine: content || true,
5905
5942
  },
5906
5943
  };
5907
5944
  }
@@ -6305,7 +6342,57 @@
6305
6342
  }
6306
6343
  const meta = {};
6307
6344
  const links = [];
6345
+ const capabilities = [];
6308
6346
  for (const commitment of parseResult.commitments) {
6347
+ if (commitment.type === 'USE BROWSER') {
6348
+ capabilities.push({
6349
+ type: 'browser',
6350
+ label: 'Browser',
6351
+ iconName: 'Globe',
6352
+ });
6353
+ continue;
6354
+ }
6355
+ if (commitment.type === 'USE SEARCH ENGINE') {
6356
+ capabilities.push({
6357
+ type: 'search-engine',
6358
+ label: 'Search Internet',
6359
+ iconName: 'Search',
6360
+ });
6361
+ continue;
6362
+ }
6363
+ if (commitment.type === 'KNOWLEDGE') {
6364
+ const content = spaceTrim__default["default"](commitment.content).split('\n')[0] || '';
6365
+ let label = content;
6366
+ let iconName = 'Book';
6367
+ if (content.startsWith('http://') || content.startsWith('https://')) {
6368
+ try {
6369
+ const url = new URL(content);
6370
+ if (url.pathname.endsWith('.pdf')) {
6371
+ label = url.pathname.split('/').pop() || 'Document.pdf';
6372
+ iconName = 'FileText';
6373
+ }
6374
+ else {
6375
+ label = url.hostname.replace(/^www\./, '');
6376
+ }
6377
+ }
6378
+ catch (e) {
6379
+ // Invalid URL, treat as text
6380
+ }
6381
+ }
6382
+ else {
6383
+ // Text content - take first few words
6384
+ const words = content.split(/\s+/);
6385
+ if (words.length > 4) {
6386
+ label = words.slice(0, 4).join(' ') + '...';
6387
+ }
6388
+ }
6389
+ capabilities.push({
6390
+ type: 'knowledge',
6391
+ label,
6392
+ iconName,
6393
+ });
6394
+ continue;
6395
+ }
6309
6396
  if (commitment.type === 'META LINK') {
6310
6397
  const linkValue = spaceTrim__default["default"](commitment.content);
6311
6398
  links.push(linkValue);
@@ -6316,6 +6403,10 @@
6316
6403
  meta.image = spaceTrim__default["default"](commitment.content);
6317
6404
  continue;
6318
6405
  }
6406
+ if (commitment.type === 'META DESCRIPTION') {
6407
+ meta.description = spaceTrim__default["default"](commitment.content);
6408
+ continue;
6409
+ }
6319
6410
  if (commitment.type === 'META COLOR') {
6320
6411
  meta.color = normalizeSeparator(commitment.content);
6321
6412
  continue;
@@ -6352,6 +6443,7 @@
6352
6443
  meta,
6353
6444
  links,
6354
6445
  parameters,
6446
+ capabilities,
6355
6447
  };
6356
6448
  }
6357
6449
  /**