@promptbook/browser 0.104.0-9 → 0.105.0-0

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 (66) hide show
  1. package/esm/index.es.js +266 -46
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +0 -6
  4. package/esm/typings/src/_packages/core.index.d.ts +10 -6
  5. package/esm/typings/src/_packages/types.index.d.ts +8 -0
  6. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  7. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -0
  8. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +16 -2
  9. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
  10. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
  11. package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
  12. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +23 -3
  13. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +5 -1
  14. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +5 -1
  15. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +5 -1
  16. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +6 -2
  17. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +6 -2
  18. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +5 -1
  19. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +5 -1
  20. package/esm/typings/src/book-components/icons/SaveIcon.d.ts +6 -2
  21. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +1 -1
  22. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +9 -7
  23. package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
  24. package/esm/typings/src/commitments/IMPORT/IMPORT.d.ts +34 -0
  25. package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
  26. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
  27. package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
  28. package/esm/typings/src/commitments/index.d.ts +2 -1
  29. package/esm/typings/src/config.d.ts +14 -1
  30. package/esm/typings/src/errors/utils/deserializeError.d.ts +1 -1
  31. package/esm/typings/src/execution/PromptResult.d.ts +24 -1
  32. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
  34. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
  35. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +8 -4
  37. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
  38. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
  39. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +12 -8
  40. package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -1
  41. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +5 -0
  43. package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
  44. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +5 -1
  45. package/esm/typings/src/scrapers/_common/utils/promptbookFetch.test.d.ts +1 -0
  46. package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
  47. package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
  48. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
  49. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
  50. package/esm/typings/src/types/LlmToolDefinition.d.ts +27 -0
  51. package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
  52. package/esm/typings/src/types/Prompt.d.ts +13 -0
  53. package/esm/typings/src/types/typeAliasEmoji.d.ts +2 -2
  54. package/esm/typings/src/utils/misc/parseNumber.d.ts +1 -1
  55. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +7 -2
  56. package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
  57. package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
  58. package/esm/typings/src/utils/validators/url/isValidAgentUrl.d.ts +16 -0
  59. package/esm/typings/src/utils/validators/url/isValidAgentUrl.test.d.ts +1 -0
  60. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
  61. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +4 -3
  62. package/esm/typings/src/version.d.ts +1 -1
  63. package/package.json +2 -2
  64. package/umd/index.umd.js +266 -46
  65. package/umd/index.umd.js.map +1 -1
  66. package/esm/typings/servers.d.ts +0 -50
@@ -1,9 +1,14 @@
1
+ import type { string_persona_description } from '../../types/typeAliases';
1
2
  /**
2
- * @@@@
3
+ * Generates a random agent persona description.
3
4
  *
5
+ * This function selects a random personality profile from a predefined pool
6
+ * of common AI agent characteristics (e.g., friendly, professional, creative).
7
+ *
8
+ * @returns A string describing the agent's persona
4
9
  * @private internal helper function
5
10
  */
6
- export declare function $randomAgentPersona(): string;
11
+ export declare function $randomAgentPersona(): string_persona_description;
7
12
  /**
8
13
  * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
9
14
  */
@@ -6,4 +6,4 @@
6
6
  export declare function $randomItem<TItem>(...items: Array<TItem>): TItem;
7
7
  /**
8
8
  * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
9
- */
9
+ */
@@ -10,4 +10,4 @@ import type { number_seed } from '../../types/typeAliases';
10
10
  export declare function $randomSeed(): number_seed;
11
11
  /**
12
12
  * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
13
- */
13
+ */
@@ -0,0 +1,16 @@
1
+ import type { string_agent_url } from '../../../types/typeAliases';
2
+ import type { really_unknown } from '../../organization/really_unknown';
3
+ /**
4
+ * Tests if given string is valid agent URL
5
+ *
6
+ * Note: There are few similar functions:
7
+ * - `isValidUrl` which tests any URL
8
+ * - `isValidAgentUrl` *(this one)* which tests just agent URL
9
+ * - `isValidPipelineUrl` which tests just pipeline URL
10
+ *
11
+ * @public exported from `@promptbook/utils`
12
+ */
13
+ export declare function isValidAgentUrl(url: really_unknown): url is string_agent_url;
14
+ /**
15
+ * TODO: [🐠] Maybe more info why the URL is invalid
16
+ */
@@ -3,8 +3,9 @@ import type { really_unknown } from '../../organization/really_unknown';
3
3
  /**
4
4
  * Tests if given string is valid pipeline URL URL.
5
5
  *
6
- * Note: There are two similar functions:
6
+ * Note: There are few similar functions:
7
7
  * - `isValidUrl` which tests any URL
8
+ * - `isValidAgentUrl` which tests just agent URL
8
9
  * - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
9
10
  *
10
11
  * @public exported from `@promptbook/utils`
@@ -5,9 +5,10 @@ import type { really_unknown } from '../../organization/really_unknown';
5
5
  *
6
6
  * Note: [🔂] This function is idempotent.
7
7
  * Note: Dataurl are considered perfectly valid.
8
- * Note: There are two similar functions:
9
- * - `isValidUrl` which tests any URL
10
- * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
8
+ * Note: There are few similar functions:
9
+ * - `isValidUrl` *(this one)* which tests any URL
10
+ * - `isValidAgentUrl` which tests just agent URL
11
+ * - `isValidPipelineUrl` which tests just pipeline URL
11
12
  *
12
13
  * @public exported from `@promptbook/utils`
13
14
  */
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.104.0-8`).
18
+ * It follows semantic versioning (e.g., `0.104.0`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/browser",
3
- "version": "0.104.0-9",
3
+ "version": "0.105.0-0",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -94,7 +94,7 @@
94
94
  "module": "./esm/index.es.js",
95
95
  "typings": "./esm/typings/src/_packages/browser.index.d.ts",
96
96
  "peerDependencies": {
97
- "@promptbook/core": "0.104.0-9"
97
+ "@promptbook/core": "0.105.0-0"
98
98
  },
99
99
  "dependencies": {
100
100
  "crypto": "1.0.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-9';
26
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-0';
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
@@ -2212,9 +2212,10 @@
2212
2212
  *
2213
2213
  * Note: [🔂] This function is idempotent.
2214
2214
  * Note: Dataurl are considered perfectly valid.
2215
- * Note: There are two similar functions:
2216
- * - `isValidUrl` which tests any URL
2217
- * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
2215
+ * Note: There are few similar functions:
2216
+ * - `isValidUrl` *(this one)* which tests any URL
2217
+ * - `isValidAgentUrl` which tests just agent URL
2218
+ * - `isValidPipelineUrl` which tests just pipeline URL
2218
2219
  *
2219
2220
  * @public exported from `@promptbook/utils`
2220
2221
  */
@@ -2492,8 +2493,8 @@
2492
2493
  */
2493
2494
  function removeDiacritics(input) {
2494
2495
  /*eslint no-control-regex: "off"*/
2495
- return input.replace(/[^\u0000-\u007E]/g, (a) => {
2496
- return DIACRITIC_VARIANTS_LETTERS[a] || a;
2496
+ return input.replace(/[^\u0000-\u007E]/g, (character) => {
2497
+ return DIACRITIC_VARIANTS_LETTERS[character] || character;
2497
2498
  });
2498
2499
  }
2499
2500
  /**
@@ -2624,6 +2625,39 @@
2624
2625
  * Note: [💞] Ignore a discrepancy between file name and entity name
2625
2626
  */
2626
2627
 
2628
+ /**
2629
+ * Tests if given string is valid agent URL
2630
+ *
2631
+ * Note: There are few similar functions:
2632
+ * - `isValidUrl` which tests any URL
2633
+ * - `isValidAgentUrl` *(this one)* which tests just agent URL
2634
+ * - `isValidPipelineUrl` which tests just pipeline URL
2635
+ *
2636
+ * @public exported from `@promptbook/utils`
2637
+ */
2638
+ function isValidAgentUrl(url) {
2639
+ if (!isValidUrl(url)) {
2640
+ return false;
2641
+ }
2642
+ if (!url.startsWith('https://') && !url.startsWith('http://') /* <- Note: [👣] */) {
2643
+ return false;
2644
+ }
2645
+ if (url.includes('#')) {
2646
+ // TODO: [🐠]
2647
+ return false;
2648
+ }
2649
+ /*
2650
+ Note: [👣][🧠] Is it secure to allow pipeline URLs on private and unsecured networks?
2651
+ if (isUrlOnPrivateNetwork(url)) {
2652
+ return false;
2653
+ }
2654
+ */
2655
+ return true;
2656
+ }
2657
+ /**
2658
+ * TODO: [🐠] Maybe more info why the URL is invalid
2659
+ */
2660
+
2627
2661
  /**
2628
2662
  * Normalizes agent name from arbitrary string to valid agent name
2629
2663
  *
@@ -2655,8 +2689,8 @@
2655
2689
  */
2656
2690
  function createCommitmentRegex(commitment, aliases = [], requiresContent = true) {
2657
2691
  const allCommitments = [commitment, ...aliases];
2658
- const patterns = allCommitments.map((c) => {
2659
- const escapedCommitment = c.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
2692
+ const patterns = allCommitments.map((commitment) => {
2693
+ const escapedCommitment = commitment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
2660
2694
  return escapedCommitment.split(/\s+/).join('\\s+');
2661
2695
  });
2662
2696
  const keywordPattern = patterns.join('|');
@@ -2678,8 +2712,8 @@
2678
2712
  */
2679
2713
  function createCommitmentTypeRegex(commitment, aliases = []) {
2680
2714
  const allCommitments = [commitment, ...aliases];
2681
- const patterns = allCommitments.map((c) => {
2682
- const escapedCommitment = c.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
2715
+ const patterns = allCommitments.map((commitment) => {
2716
+ const escapedCommitment = commitment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
2683
2717
  return escapedCommitment.split(/\s+/).join('\\s+');
2684
2718
  });
2685
2719
  const keywordPattern = patterns.join('|');
@@ -3189,9 +3223,7 @@
3189
3223
  // Get existing dictionary entries from metadata
3190
3224
  const existingDictionary = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
3191
3225
  // Merge the new dictionary entry with existing entries
3192
- const mergedDictionary = existingDictionary
3193
- ? `${existingDictionary}\n${trimmedContent}`
3194
- : trimmedContent;
3226
+ const mergedDictionary = existingDictionary ? `${existingDictionary}\n${trimmedContent}` : trimmedContent;
3195
3227
  // Store the merged dictionary in metadata for debugging and inspection
3196
3228
  const updatedMetadata = {
3197
3229
  ...requirements.metadata,
@@ -3342,21 +3374,108 @@
3342
3374
  applyToAgentModelRequirements(requirements, content) {
3343
3375
  const trimmedContent = content.trim();
3344
3376
  if (!trimmedContent) {
3345
- return requirements;
3377
+ return {
3378
+ ...requirements,
3379
+ parentAgentUrl: undefined,
3380
+ };
3346
3381
  }
3347
- // Validate URL
3348
- try {
3349
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
3350
- const url = new URL(trimmedContent);
3351
- // TODO: Add more validation if needed (e.g. check for valid protocol)
3382
+ if (trimmedContent.toUpperCase() === 'VOID' ||
3383
+ trimmedContent.toUpperCase() === 'NULL' ||
3384
+ trimmedContent.toUpperCase() === 'NONE' ||
3385
+ trimmedContent.toUpperCase() === 'NIL') {
3386
+ return {
3387
+ ...requirements,
3388
+ parentAgentUrl: null,
3389
+ };
3352
3390
  }
3353
- catch (error) {
3354
- console.warn(`Invalid URL in FROM commitment: ${trimmedContent}`);
3391
+ if (!isValidAgentUrl(trimmedContent)) {
3392
+ throw new Error(spaceTrim$1.spaceTrim((block) => `
3393
+ Invalid agent URL in FROM commitment: "${trimmedContent}"
3394
+
3395
+ \`\`\`book
3396
+ ${block(content)}
3397
+ \`\`\`
3398
+
3399
+
3400
+ `));
3401
+ }
3402
+ const parentAgentUrl = trimmedContent;
3403
+ return {
3404
+ ...requirements,
3405
+ parentAgentUrl,
3406
+ };
3407
+ }
3408
+ }
3409
+ /**
3410
+ * Note: [💞] Ignore a discrepancy between file name and entity name
3411
+ */
3412
+
3413
+ /**
3414
+ * IMPORT commitment definition
3415
+ *
3416
+ * The IMPORT commitment tells the agent to import content from another agent at the current location.
3417
+ *
3418
+ * Example usage in agent source:
3419
+ *
3420
+ * ```book
3421
+ * IMPORT https://s6.ptbk.io/benjamin-white
3422
+ * ```
3423
+ *
3424
+ * @private [🪔] Maybe export the commitments through some package
3425
+ */
3426
+ class ImportCommitmentDefinition extends BaseCommitmentDefinition {
3427
+ constructor(type = 'IMPORT') {
3428
+ super(type);
3429
+ }
3430
+ /**
3431
+ * Short one-line description of IMPORT.
3432
+ */
3433
+ get description() {
3434
+ return 'Import content from another agent.';
3435
+ }
3436
+ /**
3437
+ * Icon for this commitment.
3438
+ */
3439
+ get icon() {
3440
+ return '📥';
3441
+ }
3442
+ /**
3443
+ * Markdown documentation for IMPORT commitment.
3444
+ */
3445
+ get documentation() {
3446
+ return spaceTrim$1.spaceTrim(`
3447
+ # ${this.type}
3448
+
3449
+ Imports content from another agent at the location of the commitment.
3450
+
3451
+ ## Examples
3452
+
3453
+ \`\`\`book
3454
+ My AI Agent
3455
+
3456
+ IMPORT https://s6.ptbk.io/benjamin-white
3457
+ RULE Speak only in English.
3458
+ \`\`\`
3459
+ `);
3460
+ }
3461
+ applyToAgentModelRequirements(requirements, content) {
3462
+ const trimmedContent = content.trim();
3463
+ if (!trimmedContent) {
3355
3464
  return requirements;
3356
3465
  }
3466
+ if (!isValidAgentUrl(trimmedContent)) {
3467
+ throw new Error(spaceTrim$1.spaceTrim((block) => `
3468
+ Invalid agent URL in IMPORT commitment: "${trimmedContent}"
3469
+
3470
+ \`\`\`book
3471
+ ${block(content)}
3472
+ \`\`\`
3473
+ `));
3474
+ }
3475
+ const importedAgentUrl = trimmedContent;
3357
3476
  return {
3358
3477
  ...requirements,
3359
- parentAgentUrl: trimmedContent,
3478
+ importedAgentUrls: [...(requirements.importedAgentUrls || []), importedAgentUrl],
3360
3479
  };
3361
3480
  }
3362
3481
  }
@@ -5720,19 +5839,38 @@
5720
5839
  `);
5721
5840
  }
5722
5841
  applyToAgentModelRequirements(requirements, content) {
5723
- // We simply mark that browser capability is enabled in metadata
5724
- // Get existing metadata
5725
- const existingMetadata = requirements.metadata || {};
5726
5842
  // 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
5843
+ const existingTools = requirements.tools || [];
5844
+ // Add 'web_browser' to tools if not already present
5845
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_browser')
5846
+ ? existingTools
5847
+ : ([
5848
+ // TODO: [🔰] Use through proper MCP server
5849
+ ...existingTools,
5850
+ {
5851
+ name: 'web_browser',
5852
+ description: spaceTrim$1.spaceTrim(`
5853
+ A tool that can browse the web.
5854
+ Use this tool when you need to access specific websites or browse the internet.
5855
+ `),
5856
+ parameters: {
5857
+ type: 'object',
5858
+ properties: {
5859
+ url: {
5860
+ type: 'string',
5861
+ description: 'The URL to browse',
5862
+ },
5863
+ },
5864
+ required: ['url'],
5865
+ },
5866
+ },
5867
+ ]);
5868
+ // Return requirements with updated tools and metadata
5731
5869
  return {
5732
5870
  ...requirements,
5871
+ tools: updatedTools,
5733
5872
  metadata: {
5734
- ...existingMetadata,
5735
- tools: updatedTools,
5873
+ ...requirements.metadata,
5736
5874
  useBrowser: true,
5737
5875
  },
5738
5876
  };
@@ -5825,13 +5963,13 @@
5825
5963
  * The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
5826
5964
  * to access and retrieve up-to-date information from the internet when necessary.
5827
5965
  *
5828
- * The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
5966
+ * The content following `USE SEARCH ENGINE` is an arbitrary text that the agent should know (e.g. search scope or instructions).
5829
5967
  *
5830
5968
  * Example usage in agent source:
5831
5969
  *
5832
5970
  * ```book
5833
5971
  * USE SEARCH ENGINE
5834
- * USE SEARCH ENGINE This will be ignored
5972
+ * USE SEARCH ENGINE Hledej informace o Přemyslovcích
5835
5973
  * ```
5836
5974
  *
5837
5975
  * @private [🪔] Maybe export the commitments through some package
@@ -5863,7 +6001,7 @@
5863
6001
 
5864
6002
  ## Key aspects
5865
6003
 
5866
- - The content following \`USE SEARCH ENGINE\` is ignored (similar to NOTE)
6004
+ - The content following \`USE SEARCH ENGINE\` is an arbitrary text that the agent should know (e.g. search scope or instructions).
5867
6005
  - The actual search engine tool usage is handled by the agent runtime
5868
6006
  - Allows the agent to search for current information from the web
5869
6007
  - Useful for research tasks, finding facts, and accessing dynamic content
@@ -5888,20 +6026,45 @@
5888
6026
  `);
5889
6027
  }
5890
6028
  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
6029
  // 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
6030
+ const existingTools = requirements.tools || [];
6031
+ // Add 'web_search' to tools if not already present
6032
+ const updatedTools = existingTools.some((tool) => tool.name === 'web_search')
6033
+ ? existingTools
6034
+ : [
6035
+ ...existingTools,
6036
+ { type: 'web_search' },
6037
+ // <- Note: [🔰] This is just using simple native search tool by OpenAI @see https://platform.openai.com/docs/guides/tools-web-search
6038
+ // In future we will use proper MCP search tool:
6039
+ /*
6040
+
6041
+ {
6042
+ name: 'web_search',
6043
+ description: spaceTrim(`
6044
+ Search the internet for information.
6045
+ Use this tool when you need to find up-to-date information or facts that you don't know.
6046
+ ${!content ? '' : `Search scope / instructions: ${content}`}
6047
+ `),
6048
+ parameters: {
6049
+ type: 'object',
6050
+ properties: {
6051
+ query: {
6052
+ type: 'string',
6053
+ description: 'The search query',
6054
+ },
6055
+ },
6056
+ required: ['query'],
6057
+ },
6058
+ },
6059
+ */
6060
+ ];
6061
+ // Return requirements with updated tools and metadata
5899
6062
  return {
5900
6063
  ...requirements,
6064
+ tools: updatedTools,
5901
6065
  metadata: {
5902
- ...existingMetadata,
5903
- tools: updatedTools,
5904
- useSearchEngine: true,
6066
+ ...requirements.metadata,
6067
+ useSearchEngine: content || true,
5905
6068
  },
5906
6069
  };
5907
6070
  }
@@ -6003,6 +6166,8 @@
6003
6166
  new FormatCommitmentDefinition('FORMAT'),
6004
6167
  new FormatCommitmentDefinition('FORMATS'),
6005
6168
  new FromCommitmentDefinition('FROM'),
6169
+ new ImportCommitmentDefinition('IMPORT'),
6170
+ new ImportCommitmentDefinition('IMPORTS'),
6006
6171
  new ModelCommitmentDefinition('MODEL'),
6007
6172
  new ModelCommitmentDefinition('MODELS'),
6008
6173
  new ActionCommitmentDefinition('ACTION'),
@@ -6262,8 +6427,8 @@
6262
6427
  return match;
6263
6428
  });
6264
6429
  // Remove duplicates based on name (keep the first occurrence)
6265
- const uniqueParameters = parameters.filter((param, index, array) => {
6266
- return array.findIndex((p) => p.name === param.name) === index;
6430
+ const uniqueParameters = parameters.filter((parameter, index, array) => {
6431
+ return array.findIndex((parameterItem) => parameterItem.name === parameter.name) === index;
6267
6432
  });
6268
6433
  return uniqueParameters;
6269
6434
  }
@@ -6305,7 +6470,57 @@
6305
6470
  }
6306
6471
  const meta = {};
6307
6472
  const links = [];
6473
+ const capabilities = [];
6308
6474
  for (const commitment of parseResult.commitments) {
6475
+ if (commitment.type === 'USE BROWSER') {
6476
+ capabilities.push({
6477
+ type: 'browser',
6478
+ label: 'Browser',
6479
+ iconName: 'Globe',
6480
+ });
6481
+ continue;
6482
+ }
6483
+ if (commitment.type === 'USE SEARCH ENGINE') {
6484
+ capabilities.push({
6485
+ type: 'search-engine',
6486
+ label: 'Search Internet',
6487
+ iconName: 'Search',
6488
+ });
6489
+ continue;
6490
+ }
6491
+ if (commitment.type === 'KNOWLEDGE') {
6492
+ const content = spaceTrim__default["default"](commitment.content).split('\n')[0] || '';
6493
+ let label = content;
6494
+ let iconName = 'Book';
6495
+ if (content.startsWith('http://') || content.startsWith('https://')) {
6496
+ try {
6497
+ const url = new URL(content);
6498
+ if (url.pathname.endsWith('.pdf')) {
6499
+ label = url.pathname.split('/').pop() || 'Document.pdf';
6500
+ iconName = 'FileText';
6501
+ }
6502
+ else {
6503
+ label = url.hostname.replace(/^www\./, '');
6504
+ }
6505
+ }
6506
+ catch (e) {
6507
+ // Invalid URL, treat as text
6508
+ }
6509
+ }
6510
+ else {
6511
+ // Text content - take first few words
6512
+ const words = content.split(/\s+/);
6513
+ if (words.length > 4) {
6514
+ label = words.slice(0, 4).join(' ') + '...';
6515
+ }
6516
+ }
6517
+ capabilities.push({
6518
+ type: 'knowledge',
6519
+ label,
6520
+ iconName,
6521
+ });
6522
+ continue;
6523
+ }
6309
6524
  if (commitment.type === 'META LINK') {
6310
6525
  const linkValue = spaceTrim__default["default"](commitment.content);
6311
6526
  links.push(linkValue);
@@ -6316,6 +6531,10 @@
6316
6531
  meta.image = spaceTrim__default["default"](commitment.content);
6317
6532
  continue;
6318
6533
  }
6534
+ if (commitment.type === 'META DESCRIPTION') {
6535
+ meta.description = spaceTrim__default["default"](commitment.content);
6536
+ continue;
6537
+ }
6319
6538
  if (commitment.type === 'META COLOR') {
6320
6539
  meta.color = normalizeSeparator(commitment.content);
6321
6540
  continue;
@@ -6352,6 +6571,7 @@
6352
6571
  meta,
6353
6572
  links,
6354
6573
  parameters,
6574
+ capabilities,
6355
6575
  };
6356
6576
  }
6357
6577
  /**