@composio/core 0.9.1 → 0.11.0
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/{tool.types-CB_4JKhV.d.mts → BaseProvider-BvHvJLXc.d.mts} +24346 -24345
- package/dist/{tool.types-CwbAy9l_.d.cts → BaseProvider-CVbQxTNa.d.cts} +24346 -24345
- package/dist/{CustomTool-PSRHsd85.d.cts → CustomTool-C-IUByoU.d.cts} +1 -1
- package/dist/{CustomTool-BFkwL1aY.d.mts → CustomTool-CChQSp44.d.mts} +1 -1
- package/dist/{CustomTool-Bkk0QYzw.cjs → CustomTool-D3-NreIm.cjs} +81 -81
- package/dist/{CustomTool-IIUhFtP8.mjs → CustomTool-D5s-aADw.mjs} +76 -76
- package/dist/{FileToolModifier.utils.neutral-B7P7wn-b.mjs → FileToolModifier.utils.neutral-BpSceNK8.mjs} +1 -7
- package/dist/{FileToolModifier.utils.neutral-Dfwqgimk.cjs → FileToolModifier.utils.neutral-DSBQs9-i.cjs} +2 -8
- package/dist/{Telemetry-Dm-0sewu.cjs → Telemetry-BQ_pl5AK.cjs} +34 -9
- package/dist/{Telemetry-kgWlkavX.mjs → Telemetry-DQax33Gh.mjs} +34 -9
- package/dist/{composio-Dzlk0Wj4.d.mts → composio-BlASKqjQ.d.mts} +216 -237
- package/dist/{composio-BnLWW0B6.d.cts → composio-pcA13w87.d.cts} +216 -237
- package/dist/{customTool.types-oV5boR1w.d.mts → customTool.types-DLIORcYN.d.mts} +195 -138
- package/dist/{customTool.types-BVgnEbR2.d.cts → customTool.types-QtkAZQma.d.cts} +195 -138
- package/dist/experimental/index.cjs +1 -1
- package/dist/experimental/index.d.cts +2 -2
- package/dist/experimental/index.d.mts +3 -3
- package/dist/experimental/index.mjs +1 -1
- package/dist/index.cjs +623 -654
- package/dist/index.d.cts +415 -18
- package/dist/index.d.mts +415 -18
- package/dist/index.mjs +617 -652
- package/dist/models/Files.node.cjs +1 -1
- package/dist/models/Files.node.mjs +1 -1
- package/dist/{types-4vkdo_RG.d.cts → types-DRG5qLxI.d.cts} +2 -2
- package/dist/{types-AcoPzTnm.d.mts → types-J2KCXP8R.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.cts +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +4 -4
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.cts +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +4 -4
- package/dist/utils/modifiers/FileToolModifier.node.cjs +38 -21
- package/dist/utils/modifiers/FileToolModifier.node.d.cts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +38 -21
- package/dist/utils/modifiers/FileToolModifier.workerd.cjs +1 -1
- package/dist/utils/modifiers/FileToolModifier.workerd.d.cts +1 -1
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
- package/package.json +12 -3
|
@@ -34,10 +34,17 @@ var BatchProcessor = class {
|
|
|
34
34
|
if (this.batch.length > 0) {
|
|
35
35
|
const batchToProcess = this.batch;
|
|
36
36
|
this.batch = [];
|
|
37
|
-
const pending =
|
|
38
|
-
|
|
37
|
+
const pending = new Promise((resolve) => {
|
|
38
|
+
const run = () => {
|
|
39
|
+
Promise.resolve().then(() => this.processBatchCallback(batchToProcess)).catch(() => {}).finally(resolve);
|
|
40
|
+
};
|
|
41
|
+
if (typeof queueMicrotask === "function") queueMicrotask(run);
|
|
42
|
+
else setTimeout(run, 0);
|
|
39
43
|
});
|
|
40
44
|
this.pendingBatches.add(pending);
|
|
45
|
+
pending.finally(() => {
|
|
46
|
+
this.pendingBatches.delete(pending);
|
|
47
|
+
});
|
|
41
48
|
}
|
|
42
49
|
if (this.timer) {
|
|
43
50
|
clearTimeout(this.timer);
|
|
@@ -119,6 +126,7 @@ var TelemetryTransport = class {
|
|
|
119
126
|
telemetryServiceName = "sdk";
|
|
120
127
|
telemetryLanguage = "typescript";
|
|
121
128
|
exitHandlersRegistered = false;
|
|
129
|
+
pendingImmediateTelemetry = /* @__PURE__ */ new Set();
|
|
122
130
|
batchProcessor = new BatchProcessor(200, 10, async (data) => {
|
|
123
131
|
logger_default.debug("Sending batch of telemetry metrics", data);
|
|
124
132
|
await TelemetryService.sendMetric(data);
|
|
@@ -135,7 +143,7 @@ var TelemetryTransport = class {
|
|
|
135
143
|
environment: getEnvVariable("NODE_ENV", "production")
|
|
136
144
|
};
|
|
137
145
|
this.registerExitHandlers();
|
|
138
|
-
this.sendMetric([{
|
|
146
|
+
this.deferTelemetry(() => this.sendMetric([{
|
|
139
147
|
functionName: TELEMETRY_EVENTS.SDK_INITIALIZED,
|
|
140
148
|
durationMs: 0,
|
|
141
149
|
timestamp: Date.now() / 1e3,
|
|
@@ -143,7 +151,7 @@ var TelemetryTransport = class {
|
|
|
143
151
|
source: this.telemetrySource,
|
|
144
152
|
metadata: { provider: this.telemetryMetadata?.provider ?? "openai" },
|
|
145
153
|
error: void 0
|
|
146
|
-
}]);
|
|
154
|
+
}]));
|
|
147
155
|
}
|
|
148
156
|
/**
|
|
149
157
|
* Instrument the telemetry for the given instance.
|
|
@@ -191,7 +199,7 @@ var TelemetryTransport = class {
|
|
|
191
199
|
error.errorId = getRandomUUID();
|
|
192
200
|
if (telemetryEnabled && startTime !== void 0) {
|
|
193
201
|
const durationMs = Date.now() - startTime;
|
|
194
|
-
|
|
202
|
+
this.prepareAndSendErrorTelemetry(error, instrumentedClassName, name, startTime, durationMs);
|
|
195
203
|
}
|
|
196
204
|
}
|
|
197
205
|
}
|
|
@@ -215,15 +223,13 @@ var TelemetryTransport = class {
|
|
|
215
223
|
/**
|
|
216
224
|
* Prepare and send the error telemetry.
|
|
217
225
|
*
|
|
218
|
-
* @TODO This currently blocks the thread and sends the telemetry to the server.
|
|
219
|
-
*
|
|
220
226
|
* @param {unknown} error - The error to send.
|
|
221
227
|
* @param {string} instrumentedClassName - The class name of the instrumented class.
|
|
222
228
|
* @param {string} name - The name of the method that threw the error.
|
|
223
229
|
* @param {number} startTime - The start time of the method invocation in milliseconds.
|
|
224
230
|
* @param {number} durationMs - The duration of the method invocation in milliseconds.
|
|
225
231
|
*/
|
|
226
|
-
|
|
232
|
+
prepareAndSendErrorTelemetry(error, instrumentedClassName, name, startTime, durationMs) {
|
|
227
233
|
const telemetryPayload = {
|
|
228
234
|
functionName: `${instrumentedClassName}.${name}`,
|
|
229
235
|
durationMs,
|
|
@@ -254,7 +260,25 @@ var TelemetryTransport = class {
|
|
|
254
260
|
message: error.message,
|
|
255
261
|
stack: error.stack
|
|
256
262
|
};
|
|
257
|
-
|
|
263
|
+
this.deferTelemetry(() => this.sendErrorTelemetry(telemetryPayload));
|
|
264
|
+
}
|
|
265
|
+
deferTelemetry(callback) {
|
|
266
|
+
const pending = new Promise((resolve) => {
|
|
267
|
+
const run = () => {
|
|
268
|
+
Promise.resolve().then(callback).catch((error) => {
|
|
269
|
+
logger_default.debug("Error sending deferred telemetry", error);
|
|
270
|
+
}).finally(resolve);
|
|
271
|
+
};
|
|
272
|
+
if (typeof queueMicrotask === "function") queueMicrotask(run);
|
|
273
|
+
else setTimeout(run, 0);
|
|
274
|
+
});
|
|
275
|
+
this.pendingImmediateTelemetry.add(pending);
|
|
276
|
+
pending.finally(() => {
|
|
277
|
+
this.pendingImmediateTelemetry.delete(pending);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
async flushImmediateTelemetry() {
|
|
281
|
+
while (this.pendingImmediateTelemetry.size > 0) await Promise.all(Array.from(this.pendingImmediateTelemetry));
|
|
258
282
|
}
|
|
259
283
|
/**
|
|
260
284
|
* Send the telemetry payload to the server.
|
|
@@ -291,6 +315,7 @@ var TelemetryTransport = class {
|
|
|
291
315
|
*/
|
|
292
316
|
async flush() {
|
|
293
317
|
await this.batchProcessor.flush();
|
|
318
|
+
await this.flushImmediateTelemetry();
|
|
294
319
|
}
|
|
295
320
|
/**
|
|
296
321
|
* Register process exit handlers to automatically flush telemetry.
|