@promptbook/components 0.104.0-10 → 0.104.0-11

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 (27) hide show
  1. package/esm/index.es.js +70 -13
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/types.index.d.ts +6 -0
  4. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +23 -0
  5. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +2 -2
  6. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +1 -1
  7. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +1 -1
  8. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +1 -1
  9. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +1 -1
  10. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +1 -1
  11. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +1 -1
  12. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +1 -1
  13. package/esm/typings/src/book-components/icons/SaveIcon.d.ts +1 -1
  14. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -2
  15. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +0 -54
  16. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +1 -1
  17. package/esm/typings/src/llm-providers/agent/Agent.d.ts +6 -1
  18. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +1 -1
  19. package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
  20. package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
  21. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
  22. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
  23. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +3 -2
  24. package/esm/typings/src/version.d.ts +1 -1
  25. package/package.json +1 -1
  26. package/umd/index.umd.js +70 -13
  27. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -35,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
35
35
  * @generated
36
36
  * @see https://github.com/webgptorg/promptbook
37
37
  */
38
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-10';
38
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-11';
39
39
  /**
40
40
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
41
41
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -7317,7 +7317,57 @@ function parseAgentSource(agentSource) {
7317
7317
  }
7318
7318
  const meta = {};
7319
7319
  const links = [];
7320
+ const capabilities = [];
7320
7321
  for (const commitment of parseResult.commitments) {
7322
+ if (commitment.type === 'USE BROWSER') {
7323
+ capabilities.push({
7324
+ type: 'browser',
7325
+ label: 'Browser',
7326
+ iconName: 'Globe',
7327
+ });
7328
+ continue;
7329
+ }
7330
+ if (commitment.type === 'USE SEARCH ENGINE') {
7331
+ capabilities.push({
7332
+ type: 'search-engine',
7333
+ label: 'Search Internet',
7334
+ iconName: 'Search',
7335
+ });
7336
+ continue;
7337
+ }
7338
+ if (commitment.type === 'KNOWLEDGE') {
7339
+ const content = spaceTrim$2(commitment.content).split('\n')[0] || '';
7340
+ let label = content;
7341
+ let iconName = 'Book';
7342
+ if (content.startsWith('http://') || content.startsWith('https://')) {
7343
+ try {
7344
+ const url = new URL(content);
7345
+ if (url.pathname.endsWith('.pdf')) {
7346
+ label = url.pathname.split('/').pop() || 'Document.pdf';
7347
+ iconName = 'FileText';
7348
+ }
7349
+ else {
7350
+ label = url.hostname.replace(/^www\./, '');
7351
+ }
7352
+ }
7353
+ catch (e) {
7354
+ // Invalid URL, treat as text
7355
+ }
7356
+ }
7357
+ else {
7358
+ // Text content - take first few words
7359
+ const words = content.split(/\s+/);
7360
+ if (words.length > 4) {
7361
+ label = words.slice(0, 4).join(' ') + '...';
7362
+ }
7363
+ }
7364
+ capabilities.push({
7365
+ type: 'knowledge',
7366
+ label,
7367
+ iconName,
7368
+ });
7369
+ continue;
7370
+ }
7321
7371
  if (commitment.type === 'META LINK') {
7322
7372
  const linkValue = spaceTrim$2(commitment.content);
7323
7373
  links.push(linkValue);
@@ -7364,6 +7414,7 @@ function parseAgentSource(agentSource) {
7364
7414
  meta,
7365
7415
  links,
7366
7416
  parameters,
7417
+ capabilities,
7367
7418
  };
7368
7419
  }
7369
7420
  /**
@@ -7725,7 +7776,7 @@ var styles$5 = {"MarkdownContent":"MarkdownContent-module_MarkdownContent__2JuyX
7725
7776
  styleInject(css_248z$6);
7726
7777
 
7727
7778
  /**
7728
- * @@@
7779
+ * Creates a showdown converter configured for chat markdown rendering
7729
7780
  *
7730
7781
  * @private utility of `MarkdownContent` component
7731
7782
  */
@@ -7773,13 +7824,13 @@ function createChatMarkdownConverter() {
7773
7824
  });
7774
7825
  }
7775
7826
  /**
7776
- * @@@
7827
+ * Pre-configured showdown converter for chat markdown
7777
7828
  *
7778
7829
  * @private utility of `MarkdownContent` component
7779
7830
  */
7780
7831
  const chatMarkdownConverter = createChatMarkdownConverter();
7781
7832
  /**
7782
- * @@@
7833
+ * Renders math expressions in markdown using KaTeX
7783
7834
  *
7784
7835
  * @private utility of `MarkdownContent` component
7785
7836
  */
@@ -7976,7 +8027,7 @@ function AboutPromptbookInformation(props) {
7976
8027
  }
7977
8028
 
7978
8029
  /**
7979
- * @@@
8030
+ * Renders an about icon
7980
8031
  *
7981
8032
  * @private internal subcomponent used by various components
7982
8033
  */
@@ -7986,7 +8037,7 @@ function AboutIcon(props) {
7986
8037
  }
7987
8038
 
7988
8039
  /**
7989
- * @@@
8040
+ * Renders an attachment icon
7990
8041
  *
7991
8042
  * @public exported from `@promptbook/components`
7992
8043
  */
@@ -7995,7 +8046,7 @@ function AttachmentIcon({ size = 24, color = 'currentColor' }) {
7995
8046
  }
7996
8047
 
7997
8048
  /**
7998
- * @@@
8049
+ * Renders a camera icon
7999
8050
  *
8000
8051
  * @public exported from `@promptbook/components`
8001
8052
  */
@@ -8004,7 +8055,7 @@ function CameraIcon({ size = 24, color = 'currentColor' }) {
8004
8055
  }
8005
8056
 
8006
8057
  /**
8007
- * @@@
8058
+ * Renders a download icon
8008
8059
  *
8009
8060
  * @private internal subcomponent used by various components
8010
8061
  */
@@ -8098,7 +8149,7 @@ var styles$4 = {"MenuHamburger":"HamburgerMenu-module_MenuHamburger__Jd-wk","Men
8098
8149
  styleInject(css_248z$5);
8099
8150
 
8100
8151
  /**
8101
- * @@@
8152
+ * An animated hamburger menu button component.
8102
8153
  *
8103
8154
  * @private Internal component
8104
8155
  */
@@ -8111,7 +8162,7 @@ var styles$3 = {"dropdown":"Dropdown-module_dropdown__ZShv1","button":"Dropdown-
8111
8162
  styleInject(css_248z$4);
8112
8163
 
8113
8164
  /**
8114
- * @@@
8165
+ * A dropdown menu component that displays a list of actions triggered by a hamburger menu button.
8115
8166
  *
8116
8167
  * @private internal subcomponent used by various components
8117
8168
  */
@@ -9034,7 +9085,7 @@ const MicIcon = ({ size }) => (jsxs("svg", { width: size, height: size, viewBox:
9034
9085
  const ResetIcon = () => (jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsx("path", { d: "M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4L17.65,6.35z" }) }));
9035
9086
 
9036
9087
  /**
9037
- * @@@
9088
+ * Renders a save icon
9038
9089
  *
9039
9090
  * @public exported from `@promptbook/components`
9040
9091
  */
@@ -12476,7 +12527,7 @@ function countUsage(llmTools) {
12476
12527
  * TODO: [🧠] Is there some meaningfull way how to test this util
12477
12528
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
12478
12529
  * > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
12479
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
12530
+ * TODO: [👷‍♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
12480
12531
  */
12481
12532
 
12482
12533
  /**
@@ -17788,6 +17839,11 @@ class Agent extends AgentLlmExecutionTools {
17788
17839
  * Links found in the agent source
17789
17840
  */
17790
17841
  this.links = [];
17842
+ /**
17843
+ * Capabilities of the agent
17844
+ * This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc.
17845
+ */
17846
+ this.capabilities = [];
17791
17847
  /**
17792
17848
  * Metadata like image or color
17793
17849
  */
@@ -17797,11 +17853,12 @@ class Agent extends AgentLlmExecutionTools {
17797
17853
  this.agentSource = agentSource;
17798
17854
  this.agentSource.subscribe((source) => {
17799
17855
  this.updateAgentSource(source);
17800
- const { agentName, personaDescription, initialMessage, links, meta } = parseAgentSource(source);
17856
+ const { agentName, personaDescription, initialMessage, links, meta, capabilities } = parseAgentSource(source);
17801
17857
  this._agentName = agentName;
17802
17858
  this.personaDescription = personaDescription;
17803
17859
  this.initialMessage = initialMessage;
17804
17860
  this.links = links;
17861
+ this.capabilities = capabilities;
17805
17862
  this.meta = { ...this.meta, ...meta };
17806
17863
  });
17807
17864
  }