@promptbook/remote-client 0.114.0-2 → 0.114.0-3

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 (45) hide show
  1. package/esm/index.es.js +35 -2
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/book-components/Chat/utils/$provideServerDomWindow.d.ts +11 -0
  4. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +7 -0
  5. package/esm/src/cli/cli-commands/coder/ping.d.ts +2 -5
  6. package/esm/src/cli/cli-commands/coder.d.ts +1 -1
  7. package/esm/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +34 -0
  8. package/esm/src/cli/cli-commands/common/coderGitSyncCliOptions.test.d.ts +1 -0
  9. package/esm/src/cli/common/loadPromptsModule.d.ts +16 -0
  10. package/esm/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  11. package/esm/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
  12. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +1 -1
  13. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +1 -1
  14. package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +1 -1
  15. package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +1 -1
  16. package/esm/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +1 -1
  17. package/esm/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +1 -1
  18. package/esm/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +1 -1
  19. package/esm/src/llm-providers/openai/utils/loadOpenAiAgentsModule.d.ts +203 -0
  20. package/esm/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +1 -1
  21. package/esm/src/utils/misc/createLazyModuleLoader.d.ts +14 -0
  22. package/esm/src/version.d.ts +1 -1
  23. package/package.json +6 -2
  24. package/umd/index.umd.js +40 -6
  25. package/umd/index.umd.js.map +1 -1
  26. package/umd/src/book-components/Chat/utils/$provideServerDomWindow.d.ts +11 -0
  27. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +7 -0
  28. package/umd/src/cli/cli-commands/coder/ping.d.ts +2 -5
  29. package/umd/src/cli/cli-commands/coder.d.ts +1 -1
  30. package/umd/src/cli/cli-commands/common/coderGitSyncCliOptions.d.ts +34 -0
  31. package/umd/src/cli/cli-commands/common/coderGitSyncCliOptions.test.d.ts +1 -0
  32. package/umd/src/cli/common/loadPromptsModule.d.ts +16 -0
  33. package/umd/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +1 -1
  34. package/umd/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +1 -1
  35. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +1 -1
  36. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsToolBuilder.d.ts +1 -1
  37. package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsStreamRunner.d.ts +1 -1
  38. package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsToolRunner.d.ts +1 -1
  39. package/umd/src/llm-providers/openai/OpenAiCompatibleNonChatPromptCaller.d.ts +1 -1
  40. package/umd/src/llm-providers/openai/OpenAiCompatibleRequestManager.d.ts +1 -1
  41. package/umd/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +1 -1
  42. package/umd/src/llm-providers/openai/utils/loadOpenAiAgentsModule.d.ts +203 -0
  43. package/umd/src/llm-providers/openai/utils/uploadFilesToOpenAi.d.ts +1 -1
  44. package/umd/src/utils/misc/createLazyModuleLoader.d.ts +14 -0
  45. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { spaceTrim as spaceTrim$1 } from 'spacetrim';
2
2
  import CryptoJS from 'crypto-js';
3
- import { io } from 'socket.io-client';
4
3
  import papaparse from 'papaparse';
5
4
  import hexEncoder from 'crypto-js/enc-hex';
6
5
  import { basename } from 'path';
@@ -19,7 +18,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
19
18
  * @generated
20
19
  * @see https://github.com/webgptorg/promptbook
21
20
  */
22
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-2';
21
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-3';
23
22
  /**
24
23
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
25
24
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -1654,6 +1653,31 @@ function deserializeError(error, isStackAddedToMessage = true) {
1654
1653
  return deserializedError;
1655
1654
  }
1656
1655
 
1656
+ /**
1657
+ * Creates a loader which imports one module on the first call and reuses the very same module afterwards
1658
+ *
1659
+ * Note: [🐌] Heavy third-party dependencies are imported lazily to keep the startup of the Promptbook CLI fast.
1660
+ * A statically imported dependency is loaded every single time the bundle is loaded, even when the running
1661
+ * command never touches it. A lazily imported dependency is loaded only when the feature is really used.
1662
+ *
1663
+ * @example
1664
+ * const loadJsdomModule = createLazyModuleLoader(() => import('jsdom'));
1665
+ * const { JSDOM } = await loadJsdomModule();
1666
+ *
1667
+ * @private internal utility of Promptbook
1668
+ */
1669
+ function createLazyModuleLoader(importModule) {
1670
+ let importedModulePromise = null;
1671
+ return function loadModule() {
1672
+ if (importedModulePromise === null) {
1673
+ importedModulePromise = importModule();
1674
+ }
1675
+ return importedModulePromise;
1676
+ };
1677
+ }
1678
+ // Note: [🐌] Do not convert the lazy `import(...)` calls back to static `import` statements, it would bring back the
1679
+ // slow startup of the `ptbk` CLI utility
1680
+
1657
1681
  /**
1658
1682
  * Tests if given string is valid URL.
1659
1683
  *
@@ -1685,6 +1709,14 @@ function isValidUrl(url) {
1685
1709
  }
1686
1710
  }
1687
1711
 
1712
+ /**
1713
+ * Loads the Socket.io client (`socket.io-client`) on demand
1714
+ *
1715
+ * Note: [🐌] Loaded lazily to keep the startup of the `ptbk` CLI utility fast
1716
+ *
1717
+ * @private internal utility of `createRemoteClient`
1718
+ */
1719
+ const loadSocketIoClientModule = createLazyModuleLoader(() => import('socket.io-client'));
1688
1720
  /**
1689
1721
  * Creates a connection to the remote proxy server.
1690
1722
  *
@@ -1713,6 +1745,7 @@ async function createRemoteClient(options) {
1713
1745
 
1714
1746
  `));
1715
1747
  }
1748
+ const { io } = await loadSocketIoClientModule();
1716
1749
  return new Promise((resolve, reject) => {
1717
1750
  const socket = io(remoteServerUrl, {
1718
1751
  retries: CONNECTION_RETRIES_LIMIT,