@promptbook/remote-server 0.104.0-1 → 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 (57) hide show
  1. package/esm/index.es.js +43 -38
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/servers.d.ts +8 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +2 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +16 -2
  6. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +29 -1
  7. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +6 -6
  8. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.closed.test.d.ts +1 -0
  9. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -3
  10. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +5 -1
  11. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
  12. package/esm/typings/src/book-components/Chat/CodeBlock/CodeBlock.d.ts +13 -0
  13. package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
  14. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +9 -13
  15. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +3 -3
  16. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +1 -1
  17. package/esm/typings/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +56 -0
  18. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +1 -1
  19. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +1 -1
  20. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +1 -1
  21. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +1 -1
  22. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +1 -1
  23. package/esm/typings/src/book-components/icons/SaveIcon.d.ts +1 -1
  24. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +22 -12
  25. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +27 -15
  26. package/esm/typings/src/commitments/DICTIONARY/DICTIONARY.d.ts +46 -0
  27. package/esm/typings/src/commitments/index.d.ts +2 -1
  28. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +1 -1
  29. package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +6 -2
  30. package/esm/typings/src/llm-providers/agent/Agent.d.ts +6 -1
  31. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
  32. package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +1 -1
  34. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
  35. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +1 -1
  36. package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
  37. package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
  38. package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
  39. package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
  40. package/esm/typings/src/types/Message.d.ts +49 -0
  41. package/esm/typings/src/types/ModelRequirements.d.ts +38 -14
  42. package/esm/typings/src/types/typeAliases.d.ts +23 -1
  43. package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +2 -1
  44. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +4 -4
  45. package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +1 -1
  46. package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +1 -1
  47. package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +1 -1
  48. package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
  49. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
  50. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
  51. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +3 -2
  52. package/esm/typings/src/utils/random/$randomBase58.d.ts +12 -0
  53. package/esm/typings/src/version.d.ts +1 -1
  54. package/package.json +2 -2
  55. package/umd/index.umd.js +47 -42
  56. package/umd/index.umd.js.map +1 -1
  57. package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +0 -10
@@ -1,9 +1,10 @@
1
+ import type { string_persona_description } from '../../types/typeAliases';
1
2
  /**
2
- * @@@@
3
+ * Generates a random agent persona description.
3
4
  *
4
5
  * @private internal helper function
5
6
  */
6
- export declare function $randomAgentPersona(): string;
7
+ export declare function $randomAgentPersona(): string_persona_description;
7
8
  /**
8
9
  * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
9
10
  */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Generates random base58 string
3
+ *
4
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
5
+ * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
6
+ *
7
+ * @param length - length of the string
8
+ * @returns secure random base58 string
9
+ *
10
+ * @private internal helper function
11
+ */
12
+ export declare function $randomBase58(length: number): string;
@@ -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-0`).
18
+ * It follows semantic versioning (e.g., `0.104.0-10`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/remote-server",
3
- "version": "0.104.0-1",
3
+ "version": "0.104.0-11",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -95,7 +95,7 @@
95
95
  "module": "./esm/index.es.js",
96
96
  "typings": "./esm/typings/src/_packages/remote-server.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.104.0-1"
98
+ "@promptbook/core": "0.104.0-11"
99
99
  },
100
100
  "dependencies": {
101
101
  "colors": "1.4.0",
package/umd/index.umd.js CHANGED
@@ -47,7 +47,7 @@
47
47
  * @generated
48
48
  * @see https://github.com/webgptorg/promptbook
49
49
  */
50
- const PROMPTBOOK_ENGINE_VERSION = '0.104.0-1';
50
+ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-11';
51
51
  /**
52
52
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
53
53
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1195,13 +1195,14 @@
1195
1195
  *
1196
1196
  * @public exported from `@promptbook/utils`
1197
1197
  */
1198
- const $isRunningInNode = new Function(`
1199
- try {
1200
- return this === global;
1201
- } catch (e) {
1202
- return false;
1198
+ function $isRunningInNode() {
1199
+ try {
1200
+ return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
1201
+ }
1202
+ catch (e) {
1203
+ return false;
1204
+ }
1203
1205
  }
1204
- `);
1205
1206
  /**
1206
1207
  * TODO: [🎺]
1207
1208
  */
@@ -3843,6 +3844,15 @@
3843
3844
  return promptResult;
3844
3845
  };
3845
3846
  }
3847
+ if (llmTools.callImageGenerationModel !== undefined) {
3848
+ proxyTools.callImageGenerationModel = async (prompt) => {
3849
+ // console.info('[🚕] callImageGenerationModel through countTotalUsage');
3850
+ const promptResult = await llmTools.callImageGenerationModel(prompt);
3851
+ totalUsage = addUsage(totalUsage, promptResult.usage);
3852
+ spending.next(promptResult.usage);
3853
+ return promptResult;
3854
+ };
3855
+ }
3846
3856
  // <- Note: [🤖]
3847
3857
  return proxyTools;
3848
3858
  }
@@ -3851,7 +3861,7 @@
3851
3861
  * TODO: [🧠] Is there some meaningfull way how to test this util
3852
3862
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
3853
3863
  * > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
3854
- * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
3864
+ * TODO: [👷‍♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
3855
3865
  */
3856
3866
 
3857
3867
  /**
@@ -3952,6 +3962,12 @@
3952
3962
  callEmbeddingModel(prompt) {
3953
3963
  return this.callCommonModel(prompt);
3954
3964
  }
3965
+ /**
3966
+ * Calls the best available embedding model
3967
+ */
3968
+ callImageGenerationModel(prompt) {
3969
+ return this.callCommonModel(prompt);
3970
+ }
3955
3971
  // <- Note: [🤖]
3956
3972
  /**
3957
3973
  * Calls the best available model
@@ -3978,6 +3994,11 @@
3978
3994
  continue llm;
3979
3995
  }
3980
3996
  return await llmExecutionTools.callEmbeddingModel(prompt);
3997
+ case 'IMAGE_GENERATION':
3998
+ if (llmExecutionTools.callImageGenerationModel === undefined) {
3999
+ continue llm;
4000
+ }
4001
+ return await llmExecutionTools.callImageGenerationModel(prompt);
3981
4002
  // <- case [🤖]:
3982
4003
  default:
3983
4004
  throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
@@ -6524,8 +6545,9 @@
6524
6545
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6525
6546
  break variant;
6526
6547
  case 'EMBEDDING':
6548
+ case 'IMAGE_GENERATION':
6527
6549
  throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6528
- Embedding model can not be used in pipeline
6550
+ ${modelRequirements.modelVariant} model can not be used in pipeline
6529
6551
 
6530
6552
  This should be catched during parsing
6531
6553
 
@@ -7666,13 +7688,14 @@
7666
7688
  *
7667
7689
  * @public exported from `@promptbook/utils`
7668
7690
  */
7669
- const $isRunningInBrowser = new Function(`
7670
- try {
7671
- return this === window;
7672
- } catch (e) {
7673
- return false;
7691
+ function $isRunningInBrowser() {
7692
+ try {
7693
+ return typeof window !== 'undefined' && typeof window.document !== 'undefined';
7694
+ }
7695
+ catch (e) {
7696
+ return false;
7697
+ }
7674
7698
  }
7675
- `);
7676
7699
  /**
7677
7700
  * TODO: [🎺]
7678
7701
  */
@@ -7684,17 +7707,17 @@
7684
7707
  *
7685
7708
  * @public exported from `@promptbook/utils`
7686
7709
  */
7687
- const $isRunningInWebWorker = new Function(`
7688
- try {
7689
- if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
7690
- return true;
7691
- } else {
7710
+ function $isRunningInWebWorker() {
7711
+ try {
7712
+ // Note: Check for importScripts which is specific to workers
7713
+ // and not available in the main browser thread
7714
+ return (typeof self !== 'undefined' &&
7715
+ typeof self.importScripts === 'function');
7716
+ }
7717
+ catch (e) {
7692
7718
  return false;
7693
7719
  }
7694
- } catch (e) {
7695
- return false;
7696
7720
  }
7697
- `);
7698
7721
  /**
7699
7722
  * TODO: [🎺]
7700
7723
  */
@@ -7826,7 +7849,7 @@
7826
7849
  ${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
7827
7850
  ${morePieces.join('; ')}
7828
7851
  `);
7829
- if ($isRunningInNode) {
7852
+ if ($isRunningInNode()) {
7830
7853
  if (isInstalled && isFullyConfigured) {
7831
7854
  providerMessage = colors__default["default"].green(providerMessage);
7832
7855
  }
@@ -7990,24 +8013,6 @@
7990
8013
  * TODO: [🌺] Use some intermediate util splitWords
7991
8014
  */
7992
8015
 
7993
- /**
7994
- * Detects if the code is running in jest environment
7995
- *
7996
- * Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
7997
- *
7998
- * @public exported from `@promptbook/utils`
7999
- */
8000
- new Function(`
8001
- try {
8002
- return process.env.JEST_WORKER_ID !== undefined;
8003
- } catch (e) {
8004
- return false;
8005
- }
8006
- `);
8007
- /**
8008
- * TODO: [🎺]
8009
- */
8010
-
8011
8016
  /**
8012
8017
  * Makes first letter of a string lowercase
8013
8018
  *