@promptbook/components 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 +133 -43
  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 +4 -1
  24. package/umd/index.umd.js +143 -52
  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/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('spacetrim'), require('react'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('crypto'), require('moment'), require('mime-types'), require('react-dom'), require('@monaco-editor/react'), require('rxjs'), require('dompurify'), require('katex'), require('showdown'), require('html-to-image'), require('jspdf'), require('react-dom/client'), require('lucide-react'), require('moment/locale/cs'), require('waitasecond'), require('crypto-js/sha256'), require('papaparse'), require('@openai/agents'), require('colors'), require('bottleneck'), require('openai'), require('qrcode')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'spacetrim', 'react', 'crypto-js', 'crypto-js/enc-hex', 'path', 'crypto', 'moment', 'mime-types', 'react-dom', '@monaco-editor/react', 'rxjs', 'dompurify', 'katex', 'showdown', 'html-to-image', 'jspdf', 'react-dom/client', 'lucide-react', 'moment/locale/cs', 'waitasecond', 'crypto-js/sha256', 'papaparse', '@openai/agents', 'colors', 'bottleneck', 'openai', 'qrcode'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-components"] = {}, global.jsxRuntime, global.spacetrim, global.react, global.CryptoJS, global.hexEncoder, global.path, null, global.moment, global.mimeTypes, global.reactDom, global.MonacoEditor, global.rxjs, global.createDOMPurify, global.katex, global.showdown, global.htmlToImage, global.jspdf, global.client, global.lucideReact, null, global.waitasecond, global.sha256, global.papaparse, global.agents, global.colors, global.Bottleneck, global.OpenAI, global.QRCode));
5
- })(this, (function (exports, jsxRuntime, spacetrim, react, CryptoJS, hexEncoder, path, crypto$1, moment, mimeTypes, reactDom, MonacoEditor, rxjs, createDOMPurify, katex, showdown, htmlToImage, jspdf, client, lucideReact, cs, waitasecond, sha256, papaparse, agents, colors, Bottleneck, OpenAI, QRCode) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('spacetrim'), require('react'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('crypto'), require('moment'), require('mime-types'), require('react-dom'), require('@monaco-editor/react'), require('rxjs'), require('dompurify'), require('katex'), require('showdown'), require('html-to-image'), require('jspdf'), require('react-dom/client'), require('lucide-react'), require('moment/locale/cs'), require('waitasecond'), require('crypto-js/sha256'), require('papaparse'), require('colors'), require('bottleneck'), require('qrcode')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'spacetrim', 'react', 'crypto-js', 'crypto-js/enc-hex', 'path', 'crypto', 'moment', 'mime-types', 'react-dom', '@monaco-editor/react', 'rxjs', 'dompurify', 'katex', 'showdown', 'html-to-image', 'jspdf', 'react-dom/client', 'lucide-react', 'moment/locale/cs', 'waitasecond', 'crypto-js/sha256', 'papaparse', 'colors', 'bottleneck', 'qrcode'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-components"] = {}, global.jsxRuntime, global.spacetrim, global.react, global.CryptoJS, global.hexEncoder, global.path, null, global.moment, global.mimeTypes, global.reactDom, global.MonacoEditor, global.rxjs, global.createDOMPurify, global.katex, global.showdown, global.htmlToImage, global.jspdf, global.client, global.lucideReact, null, global.waitasecond, global.sha256, global.papaparse, global.colors, global.Bottleneck, global.QRCode));
5
+ })(this, (function (exports, jsxRuntime, spacetrim, react, CryptoJS, hexEncoder, path, crypto$1, moment, mimeTypes, reactDom, MonacoEditor, rxjs, createDOMPurify, katex, showdown, htmlToImage, jspdf, client, lucideReact, cs, waitasecond, sha256, papaparse, colors, Bottleneck, QRCode) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -17,7 +17,6 @@
17
17
  var papaparse__default = /*#__PURE__*/_interopDefaultLegacy(papaparse);
18
18
  var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
19
19
  var Bottleneck__default = /*#__PURE__*/_interopDefaultLegacy(Bottleneck);
20
- var OpenAI__default = /*#__PURE__*/_interopDefaultLegacy(OpenAI);
21
20
  var QRCode__default = /*#__PURE__*/_interopDefaultLegacy(QRCode);
22
21
 
23
22
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
@@ -34,7 +33,7 @@
34
33
  * @generated
35
34
  * @see https://github.com/webgptorg/promptbook
36
35
  */
37
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-2';
36
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-3';
38
37
  /**
39
38
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
40
39
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -27746,6 +27745,81 @@
27746
27745
  };
27747
27746
  }
27748
27747
 
27748
+ /**
27749
+ * This error type indicates that you try to use a feature that is not available in the current environment
27750
+ *
27751
+ * @public exported from `@promptbook/core`
27752
+ */
27753
+ class EnvironmentMismatchError extends Error {
27754
+ constructor(message) {
27755
+ super(message);
27756
+ this.name = 'EnvironmentMismatchError';
27757
+ Object.setPrototypeOf(this, EnvironmentMismatchError.prototype);
27758
+ }
27759
+ }
27760
+
27761
+ /**
27762
+ * Shared DOM window reused by every render which happens outside of a browser
27763
+ *
27764
+ * @private utility of `$provideServerDomWindow`
27765
+ */
27766
+ let serverDomWindow = null;
27767
+ /**
27768
+ * Provides a DOM `window` for runtimes which do not have one, for example Node.js during server-side rendering
27769
+ *
27770
+ * Note: `$` is used to indicate that this function is not a pure function - it creates and caches one shared DOM window
27771
+ *
27772
+ * @returns DOM window which can back a DOM-dependent library like `DOMPurify`
27773
+ * @throws {EnvironmentMismatchError} When the current runtime can not create a DOM window
27774
+ * @private utility of `renderMarkdown`
27775
+ */
27776
+ function $provideServerDomWindow() {
27777
+ if (serverDomWindow === null) {
27778
+ const { JSDOM } = requireServerDomLibrary();
27779
+ serverDomWindow = new JSDOM('').window;
27780
+ }
27781
+ return serverDomWindow;
27782
+ }
27783
+ /**
27784
+ * Loads `jsdom` which backs the DOM window outside of a browser
27785
+ *
27786
+ * Note: [😷] `jsdom` reaches for Node.js built-ins like `fs`, `child_process` and `net`, so browser bundlers must
27787
+ * never follow the `require` below - even though it is unreachable in a browser, bundlers resolve it statically.
27788
+ * They are told to replace `jsdom` with an empty module by the `browser` field of the generated package
27789
+ * manifests, which is written by `applyBrowserUnsupportedDependencyStubs` during the package generation.
27790
+ *
27791
+ * @returns The `jsdom` library
27792
+ * @throws {EnvironmentMismatchError} When `jsdom` can not be loaded in the current runtime
27793
+ * @private utility of `$provideServerDomWindow`
27794
+ */
27795
+ function requireServerDomLibrary() {
27796
+ let serverDomLibrary = null;
27797
+ let serverDomLibraryError = null;
27798
+ try {
27799
+ // Note: [😷] Keep `'jsdom'` written as a literal, bundlers do not replace a computed module name
27800
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
27801
+ serverDomLibrary = require('jsdom');
27802
+ }
27803
+ catch (error) {
27804
+ assertsError(error);
27805
+ serverDomLibraryError = error;
27806
+ }
27807
+ if (typeof (serverDomLibrary === null || serverDomLibrary === void 0 ? void 0 : serverDomLibrary.JSDOM) !== 'function') {
27808
+ throw new EnvironmentMismatchError(spacetrim.spaceTrim((block) => `
27809
+ Markdown can not be rendered because there is no DOM in the current runtime.
27810
+
27811
+ Rendered markdown is sanitized through \`DOMPurify\`, which needs a DOM - the DOM of the browser
27812
+ when the code runs in a browser and \`jsdom\` in every other runtime, for example during
27813
+ server-side rendering in **Node.js**.
27814
+
27815
+ ${block(serverDomLibraryError === null
27816
+ ? 'The `jsdom` module was resolved but it does not export `JSDOM`, which happens when a bundler replaces `jsdom` with an empty module in a build which is neither a browser build nor a Node.js build.'
27817
+ : `${serverDomLibraryError.name}: ${serverDomLibraryError.message}`)}
27818
+ `));
27819
+ }
27820
+ return serverDomLibrary;
27821
+ }
27822
+
27749
27823
  /**
27750
27824
  * Default citation identifier used for simplified citation markers without an explicit position.
27751
27825
  *
@@ -28042,12 +28116,6 @@
28042
28116
  * @private utility of `renderMarkdown`
28043
28117
  */
28044
28118
  let serverMarkdownSanitizer = null;
28045
- /**
28046
- * Shared JSDOM window backing the server-side DOMPurify instance.
28047
- *
28048
- * @private utility of `renderMarkdown`
28049
- */
28050
- let serverMarkdownSanitizerWindow = null;
28051
28119
  /**
28052
28120
  * Pattern matching CODE FENCE.
28053
28121
  */
@@ -28183,19 +28251,6 @@
28183
28251
  registerMarkdownSanitizerHooks(markdownSanitizer);
28184
28252
  return markdownSanitizer;
28185
28253
  }
28186
- /**
28187
- * Lazily creates the JSDOM window used by server-side markdown sanitization.
28188
- *
28189
- * @private utility of `renderMarkdown`
28190
- */
28191
- function getServerMarkdownSanitizerWindow() {
28192
- if (!serverMarkdownSanitizerWindow) {
28193
- // eslint-disable-next-line @typescript-eslint/no-var-requires
28194
- const { JSDOM } = require('jsdom');
28195
- serverMarkdownSanitizerWindow = new JSDOM('').window;
28196
- }
28197
- return serverMarkdownSanitizerWindow;
28198
- }
28199
28254
  /**
28200
28255
  * Returns the shared DOMPurify instance appropriate for the current runtime.
28201
28256
  *
@@ -28206,7 +28261,7 @@
28206
28261
  browserMarkdownSanitizer !== null && browserMarkdownSanitizer !== void 0 ? browserMarkdownSanitizer : (browserMarkdownSanitizer = createMarkdownSanitizer(window));
28207
28262
  return browserMarkdownSanitizer;
28208
28263
  }
28209
- serverMarkdownSanitizer !== null && serverMarkdownSanitizer !== void 0 ? serverMarkdownSanitizer : (serverMarkdownSanitizer = createMarkdownSanitizer(getServerMarkdownSanitizerWindow()));
28264
+ serverMarkdownSanitizer !== null && serverMarkdownSanitizer !== void 0 ? serverMarkdownSanitizer : (serverMarkdownSanitizer = createMarkdownSanitizer($provideServerDomWindow()));
28210
28265
  return serverMarkdownSanitizer;
28211
28266
  }
28212
28267
  /**
@@ -47801,19 +47856,6 @@
47801
47856
  }
47802
47857
  // TODO: [🐱‍🚀] Explain that NotFoundError ([🐱‍🚀] and other specific errors) has priority over DatabaseError in some contexts
47803
47858
 
47804
- /**
47805
- * This error type indicates that you try to use a feature that is not available in the current environment
47806
- *
47807
- * @public exported from `@promptbook/core`
47808
- */
47809
- class EnvironmentMismatchError extends Error {
47810
- constructor(message) {
47811
- super(message);
47812
- this.name = 'EnvironmentMismatchError';
47813
- Object.setPrototypeOf(this, EnvironmentMismatchError.prototype);
47814
- }
47815
- }
47816
-
47817
47859
  /**
47818
47860
  * This error occurs when some expectation is not met in the execution of the pipeline
47819
47861
  *
@@ -53253,6 +53295,41 @@
53253
53295
  `;
53254
53296
  }
53255
53297
 
53298
+ /**
53299
+ * Creates a loader which imports one module on the first call and reuses the very same module afterwards
53300
+ *
53301
+ * Note: [🐌] Heavy third-party dependencies are imported lazily to keep the startup of the Promptbook CLI fast.
53302
+ * A statically imported dependency is loaded every single time the bundle is loaded, even when the running
53303
+ * command never touches it. A lazily imported dependency is loaded only when the feature is really used.
53304
+ *
53305
+ * @example
53306
+ * const loadJsdomModule = createLazyModuleLoader(() => import('jsdom'));
53307
+ * const { JSDOM } = await loadJsdomModule();
53308
+ *
53309
+ * @private internal utility of Promptbook
53310
+ */
53311
+ function createLazyModuleLoader(importModule) {
53312
+ let importedModulePromise = null;
53313
+ return function loadModule() {
53314
+ if (importedModulePromise === null) {
53315
+ importedModulePromise = importModule();
53316
+ }
53317
+ return importedModulePromise;
53318
+ };
53319
+ }
53320
+ // Note: [🐌] Do not convert the lazy `import(...)` calls back to static `import` statements, it would bring back the
53321
+ // slow startup of the `ptbk` CLI utility
53322
+
53323
+ /**
53324
+ * Loads the OpenAI AgentKit SDK (`@openai/agents`) on demand
53325
+ *
53326
+ * Note: [🐌] The AgentKit SDK is one of the heaviest dependencies of Promptbook, loading it eagerly would slow down
53327
+ * every single run of the `ptbk` CLI utility even when no AgentKit agent is used
53328
+ *
53329
+ * @private internal utility of `@promptbook/openai`
53330
+ */
53331
+ const loadOpenAiAgentsModule = createLazyModuleLoader(() => import('@openai/agents'));
53332
+
53256
53333
  /**
53257
53334
  * Constant for default model used for nested DeepSearch tool invocations.
53258
53335
  */
@@ -53306,11 +53383,12 @@
53306
53383
  /**
53307
53384
  * Builds the tool list for AgentKit, including hosted file search when applicable.
53308
53385
  */
53309
- buildAgentKitTools(options) {
53386
+ async buildAgentKitTools(options) {
53310
53387
  const { tools, vectorStoreId } = options;
53388
+ const { fileSearchTool, tool: agentKitTool } = await loadOpenAiAgentsModule();
53311
53389
  const agentKitTools = [];
53312
53390
  if (vectorStoreId) {
53313
- agentKitTools.push(agents.fileSearchTool(vectorStoreId));
53391
+ agentKitTools.push(fileSearchTool(vectorStoreId));
53314
53392
  }
53315
53393
  if (!tools || tools.length === 0) {
53316
53394
  return agentKitTools;
@@ -53318,11 +53396,11 @@
53318
53396
  let scriptTools = null;
53319
53397
  for (const toolDefinition of tools) {
53320
53398
  if (this.isDeepSearchToolDefinition(toolDefinition)) {
53321
- agentKitTools.push(this.createDeepSearchAgentKitTool(toolDefinition));
53399
+ agentKitTools.push(await this.createDeepSearchAgentKitTool(toolDefinition));
53322
53400
  continue;
53323
53401
  }
53324
53402
  scriptTools !== null && scriptTools !== void 0 ? scriptTools : (scriptTools = this.resolveScriptTools());
53325
- agentKitTools.push(agents.tool({
53403
+ agentKitTools.push(agentKitTool({
53326
53404
  name: toolDefinition.name,
53327
53405
  description: toolDefinition.description,
53328
53406
  parameters: this.normalizeAgentKitToolParameters(toolDefinition.parameters),
@@ -53529,12 +53607,13 @@
53529
53607
  /**
53530
53608
  * Creates the native Agent SDK tool used for `USE DEEPSEARCH`.
53531
53609
  */
53532
- createDeepSearchAgentKitTool(toolDefinition) {
53533
- const deepSearchAgent = new agents.Agent({
53610
+ async createDeepSearchAgentKitTool(toolDefinition) {
53611
+ const { Agent: AgentFromKit, webSearchTool } = await loadOpenAiAgentsModule();
53612
+ const deepSearchAgent = new AgentFromKit({
53534
53613
  name: 'DeepSearch',
53535
53614
  model: DEFAULT_DEEP_SEARCH_MODEL_NAME,
53536
53615
  instructions: this.createDeepSearchAgentInstructions(toolDefinition.description),
53537
- tools: [agents.webSearchTool({ searchContextSize: 'high' })],
53616
+ tools: [webSearchTool({ searchContextSize: 'high' })],
53538
53617
  });
53539
53618
  return deepSearchAgent.asTool({
53540
53619
  toolName: toolDefinition.name,
@@ -54856,6 +54935,14 @@
54856
54935
  }
54857
54936
  }
54858
54937
 
54938
+ /**
54939
+ * Loads the OpenAI SDK (`openai`) on demand
54940
+ *
54941
+ * Note: [🐌] Loaded lazily to keep the startup of the `ptbk` CLI utility fast
54942
+ *
54943
+ * @private internal utility of `OpenAiCompatibleRequestManager`
54944
+ */
54945
+ const loadOpenAiModule = createLazyModuleLoader(() => import('openai'));
54859
54946
  /**
54860
54947
  * Manages OpenAI-compatible client creation plus shared retry and rate-limit behavior.
54861
54948
  *
@@ -54882,7 +54969,8 @@
54882
54969
  timeout: API_REQUEST_TIMEOUT,
54883
54970
  maxRetries: CONNECTION_RETRIES_LIMIT,
54884
54971
  };
54885
- this.client = new OpenAI__default["default"](enhancedOptions);
54972
+ const { default: OpenAI } = await loadOpenAiModule();
54973
+ this.client = new OpenAI(enhancedOptions);
54886
54974
  }
54887
54975
  return this.client;
54888
54976
  }
@@ -57029,8 +57117,9 @@
57029
57117
  vectorStoreId,
57030
57118
  });
57031
57119
  }
57032
- const agentKitTools = this.buildAgentKitTools({ tools, vectorStoreId });
57033
- const openAiAgentKitAgent = new agents.Agent({
57120
+ const { Agent: AgentFromKit } = await loadOpenAiAgentsModule();
57121
+ const agentKitTools = await this.buildAgentKitTools({ tools, vectorStoreId });
57122
+ const openAiAgentKitAgent = new AgentFromKit({
57034
57123
  name,
57035
57124
  model: this.agentKitModelName,
57036
57125
  instructions: instructions || 'You are a helpful assistant.',
@@ -57075,7 +57164,8 @@
57075
57164
  agentName: agentForRun.name,
57076
57165
  input: inputItems,
57077
57166
  };
57078
- const streamResult = await agents.run(agentForRun, inputItems, {
57167
+ const { run } = await loadOpenAiAgentsModule();
57168
+ const streamResult = await run(agentForRun, inputItems, {
57079
57169
  stream: true,
57080
57170
  maxTurns: 200,
57081
57171
  context: {
@@ -57217,11 +57307,12 @@
57217
57307
  * Ensures the AgentKit SDK is wired to the OpenAI client and API key.
57218
57308
  */
57219
57309
  async ensureAgentKitDefaults() {
57310
+ const { setDefaultOpenAIClient, setDefaultOpenAIKey } = await loadOpenAiAgentsModule();
57220
57311
  const client = await this.getClient();
57221
- agents.setDefaultOpenAIClient(client);
57312
+ setDefaultOpenAIClient(client);
57222
57313
  const apiKey = this.agentKitOptions.apiKey;
57223
57314
  if (apiKey && typeof apiKey === 'string') {
57224
- agents.setDefaultOpenAIKey(apiKey);
57315
+ setDefaultOpenAIKey(apiKey);
57225
57316
  }
57226
57317
  }
57227
57318
  /**