@mindstudio-ai/agent 0.1.50 → 0.1.52

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.
package/dist/index.js CHANGED
@@ -1,10 +1,3 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
1
  // src/errors.ts
9
2
  var MindStudioError = class extends Error {
10
3
  constructor(message, code, status, details) {
@@ -88,26 +81,23 @@ function sleep(ms) {
88
81
  }
89
82
 
90
83
  // src/context.ts
91
- var als;
92
- function getAls() {
93
- if (!als) {
94
- try {
95
- const { AsyncLocalStorage } = __require("async_hooks");
96
- als = new AsyncLocalStorage();
97
- } catch {
98
- als = {
99
- getStore: () => void 0,
100
- run: (_store, fn) => fn()
101
- };
102
- }
84
+ var noopAls = {
85
+ getStore: () => void 0,
86
+ run: (_store, fn) => fn()
87
+ };
88
+ var als = noopAls;
89
+ try {
90
+ if (typeof process !== "undefined" && process.versions?.node) {
91
+ const mod = await import("async_hooks");
92
+ als = new mod.AsyncLocalStorage();
103
93
  }
104
- return als;
94
+ } catch {
105
95
  }
106
96
  function getRequestContext() {
107
- return getAls().getStore();
97
+ return als.getStore();
108
98
  }
109
99
  function runWithContext(ctx, fn) {
110
- return getAls().run(ctx, fn);
100
+ return als.run(ctx, fn);
111
101
  }
112
102
 
113
103
  // src/rate-limit.ts