@promptbook/remote-server 0.103.0-47 → 0.103.0-49

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 (55) hide show
  1. package/esm/index.es.js +35 -9
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/servers.d.ts +1 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +6 -0
  5. package/esm/typings/src/_packages/types.index.d.ts +4 -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 +17 -3
  8. package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +2 -1
  9. package/esm/typings/src/book-2.0/agent-source/computeAgentHash.d.ts +8 -0
  10. package/esm/typings/src/book-2.0/agent-source/computeAgentHash.test.d.ts +1 -0
  11. package/esm/typings/src/book-2.0/agent-source/createDefaultAgentName.d.ts +8 -0
  12. package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.d.ts +9 -0
  13. package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.test.d.ts +1 -0
  14. package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +1 -1
  15. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +14 -8
  16. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +10 -0
  17. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +57 -32
  18. package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +28 -0
  19. package/esm/typings/src/commitments/index.d.ts +2 -1
  20. package/esm/typings/src/config.d.ts +1 -0
  21. package/esm/typings/src/errors/DatabaseError.d.ts +2 -2
  22. package/esm/typings/src/errors/WrappedError.d.ts +2 -2
  23. package/esm/typings/src/execution/ExecutionTask.d.ts +2 -2
  24. package/esm/typings/src/execution/LlmExecutionTools.d.ts +6 -1
  25. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +2 -2
  26. package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
  27. package/esm/typings/src/llm-providers/agent/Agent.d.ts +17 -4
  28. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +10 -1
  29. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +6 -2
  30. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +30 -4
  31. package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
  32. package/esm/typings/src/remote-server/startAgentServer.d.ts +2 -2
  33. package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -2
  34. package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
  35. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  36. package/esm/typings/src/utils/color/Color.d.ts +7 -0
  37. package/esm/typings/src/utils/color/Color.test.d.ts +1 -0
  38. package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -2
  39. package/esm/typings/src/utils/misc/computeHash.d.ts +11 -0
  40. package/esm/typings/src/utils/misc/computeHash.test.d.ts +1 -0
  41. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -0
  42. package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +3 -0
  43. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -0
  44. package/esm/typings/src/utils/normalization/titleToName.d.ts +2 -0
  45. package/esm/typings/src/utils/organization/$sideEffect.d.ts +2 -2
  46. package/esm/typings/src/utils/organization/$side_effect.d.ts +2 -2
  47. package/esm/typings/src/utils/organization/TODO_USE.d.ts +2 -2
  48. package/esm/typings/src/utils/organization/keepUnused.d.ts +2 -2
  49. package/esm/typings/src/utils/organization/preserve.d.ts +3 -3
  50. package/esm/typings/src/utils/organization/really_any.d.ts +7 -0
  51. package/esm/typings/src/utils/serialization/asSerializable.d.ts +2 -2
  52. package/esm/typings/src/version.d.ts +1 -1
  53. package/package.json +2 -2
  54. package/umd/index.umd.js +35 -9
  55. package/umd/index.umd.js.map +1 -1
package/esm/index.es.js CHANGED
@@ -33,7 +33,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
33
33
  * @generated
34
34
  * @see https://github.com/webgptorg/promptbook
35
35
  */
36
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-47';
36
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-49';
37
37
  /**
38
38
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
39
39
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -369,6 +369,9 @@ class Color {
369
369
  if (hex.length === 3) {
370
370
  return Color.fromHex3(hex);
371
371
  }
372
+ if (hex.length === 4) {
373
+ return Color.fromHex4(hex);
374
+ }
372
375
  if (hex.length === 6) {
373
376
  return Color.fromHex6(hex);
374
377
  }
@@ -389,6 +392,19 @@ class Color {
389
392
  const b = parseInt(hex.substr(2, 1), 16) * 16;
390
393
  return take(new Color(r, g, b));
391
394
  }
395
+ /**
396
+ * Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
397
+ *
398
+ * @param color in hex for example `09df`
399
+ * @returns Color object
400
+ */
401
+ static fromHex4(hex) {
402
+ const r = parseInt(hex.substr(0, 1), 16) * 16;
403
+ const g = parseInt(hex.substr(1, 1), 16) * 16;
404
+ const b = parseInt(hex.substr(2, 1), 16) * 16;
405
+ const a = parseInt(hex.substr(3, 1), 16) * 16;
406
+ return take(new Color(r, g, b, a));
407
+ }
392
408
  /**
393
409
  * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
394
410
  *
@@ -579,7 +595,8 @@ class Color {
579
595
  * @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
580
596
  */
581
597
  static isHexColorString(value) {
582
- return typeof value === 'string' && /^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value);
598
+ return (typeof value === 'string' &&
599
+ /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
583
600
  }
584
601
  /**
585
602
  * Creates new Color object
@@ -914,6 +931,7 @@ const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
914
931
  ({
915
932
  TITLE: Color.fromHex('#244EA8'),
916
933
  LINE: Color.fromHex('#eeeeee'),
934
+ SEPARATOR: Color.fromHex('#cccccc'),
917
935
  COMMITMENT: Color.fromHex('#DA0F78'),
918
936
  PARAMETER: Color.fromHex('#8e44ad'),
919
937
  });
@@ -1285,7 +1303,7 @@ function $execCommand(options) {
1285
1303
  */
1286
1304
 
1287
1305
  /**
1288
- * !!!!!
1306
+ * [🐱‍🚀]
1289
1307
  * Remote server is a proxy server that uses its execution tools internally and exposes the executor interface externally.
1290
1308
  *
1291
1309
  * You can simply use `RemoteExecutionTools` on client-side javascript and connect to your remote server.
@@ -1293,11 +1311,11 @@ function $execCommand(options) {
1293
1311
  *
1294
1312
  * @see https://github.com/webgptorg/promptbook#remote-server
1295
1313
  * @public exported from `@promptbook/remote-server`
1296
- * <- TODO: !!!! Maybe change to `@promptbook/agent-server`
1314
+ * <- TODO: [🐱‍🚀] Change to `@promptbook/agent-server`
1297
1315
  */
1298
1316
  async function startAgentServer(options) {
1299
1317
  const { port = 4440 } = options;
1300
- // TODO: !!!! [🌕]
1318
+ // TODO: [🐱‍🚀] [🌕]
1301
1319
  const agentsServerRoot = join(__dirname, '../apps/agents-server');
1302
1320
  console.trace(`!!! Starting agents server on port ${port}...`);
1303
1321
  console.log(`!!! cwd`, process.cwd());
@@ -1534,7 +1552,7 @@ class DatabaseError extends Error {
1534
1552
  }
1535
1553
  }
1536
1554
  /**
1537
- * TODO: !!!! Explain that NotFoundError (!!! and other specific errors) has priority over DatabaseError in some contexts
1555
+ * TODO: [🐱‍🚀] Explain that NotFoundError ([🐱‍🚀] and other specific errors) has priority over DatabaseError in some contexts
1538
1556
  */
1539
1557
 
1540
1558
  /**
@@ -2222,7 +2240,7 @@ function deepClone(objectValue) {
2222
2240
  TODO: [🧠] Is there a better implementation?
2223
2241
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
2224
2242
  > for (const propertyName of propertyNames) {
2225
- > const value = (objectValue as really_any)[propertyName];
2243
+ > const value = (objectValue as chococake)[propertyName];
2226
2244
  > if (value && typeof value === 'object') {
2227
2245
  > deepClone(value);
2228
2246
  > }
@@ -4594,6 +4612,8 @@ function removeDiacritics(input) {
4594
4612
  /**
4595
4613
  * Converts a given text to kebab-case format.
4596
4614
  *
4615
+ * Note: [🔂] This function is idempotent.
4616
+ *
4597
4617
  * @param text The text to be converted.
4598
4618
  * @returns The kebab-case formatted string.
4599
4619
  * @example 'hello-world'
@@ -4749,6 +4769,8 @@ function removeEmojis(text) {
4749
4769
  /**
4750
4770
  * Converts a title string into a normalized name.
4751
4771
  *
4772
+ * Note: [🔂] This function is idempotent.
4773
+ *
4752
4774
  * @param value The title string to be converted to a name.
4753
4775
  * @returns A normalized name derived from the input title.
4754
4776
  * @example 'Hello World!' -> 'hello-world'
@@ -7851,6 +7873,8 @@ async function $provideScrapersForNode(tools, options) {
7851
7873
  /**
7852
7874
  * Normalizes a given text to camelCase format.
7853
7875
  *
7876
+ * Note: [🔂] This function is idempotent.
7877
+ *
7854
7878
  * @param text The text to be normalized.
7855
7879
  * @param _isFirstLetterCapital Whether the first letter should be capitalized.
7856
7880
  * @returns The camelCase formatted string.
@@ -7977,6 +8001,9 @@ function nameToUriParts(name) {
7977
8001
  }
7978
8002
 
7979
8003
  /**
8004
+ * Normalizes a given text to PascalCase format.
8005
+ *
8006
+ * Note: [🔂] This function is idempotent.
7980
8007
  *
7981
8008
  * @param text @public exported from `@promptbook/utils`
7982
8009
  * @returns
@@ -9626,8 +9653,7 @@ function startRemoteServer(options) {
9626
9653
  };
9627
9654
  }
9628
9655
  /**
9629
- * TODO !!!! Add agent
9630
- * TODO: !!!! Allow to chat with agents directly via remote server
9656
+
9631
9657
  * TODO: [🕋] Use here `aboutPromptbookInformation`
9632
9658
  * TODO: [🌡] Add CORS and security - probably via `helmet`
9633
9659
  * TODO: Split this file into multiple functions - handler for each request