langwatch 1.11.0 → 1.12.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/agent/index.d.mts +7 -1
- package/dist/agent/index.d.ts +7 -1
- package/dist/agent/index.js +26 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +26 -1
- package/dist/agent/index.mjs.map +1 -1
- package/dist/{chunk-2PD3YA5H.js → chunk-3WIN2UXZ.js} +2 -2
- package/dist/{chunk-2PD3YA5H.js.map → chunk-3WIN2UXZ.js.map} +1 -1
- package/dist/{chunk-VMNKKJVI.mjs → chunk-BAE4KYKJ.mjs} +2 -2
- package/dist/{chunk-BS5CNZ5S.mjs → chunk-F5UYCQT3.mjs} +2 -2
- package/dist/{chunk-BS5CNZ5S.mjs.map → chunk-F5UYCQT3.mjs.map} +1 -1
- package/dist/{chunk-AJDFFRSW.js → chunk-QLYKPPAW.js} +12 -12
- package/dist/{chunk-AJDFFRSW.js.map → chunk-QLYKPPAW.js.map} +1 -1
- package/dist/cli/bundle.js +295 -217
- package/dist/{implementation-aczLxVpV.d.mts → implementation-BA3xa5UR.d.mts} +1 -1
- package/dist/{implementation-D58yPTJW.d.ts → implementation-rpImK8WS.d.ts} +1 -1
- package/dist/index.d.mts +55 -2
- package/dist/index.d.ts +55 -2
- package/dist/index.js +89 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -2
- package/dist/index.mjs.map +1 -1
- package/dist/observability-sdk/index.d.mts +3 -3
- package/dist/observability-sdk/index.d.ts +3 -3
- package/dist/observability-sdk/index.js +2 -2
- package/dist/observability-sdk/index.mjs +1 -1
- package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
- package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
- package/dist/observability-sdk/setup/node/index.js +3 -3
- package/dist/observability-sdk/setup/node/index.mjs +2 -2
- package/dist/{types-D_YNU-VL.d.ts → types-Cr25FO-i.d.ts} +395 -293
- package/dist/{types-BmMuUDrO.d.mts → types-DJyJypkv.d.mts} +395 -293
- package/package.json +1 -1
- /package/dist/{chunk-VMNKKJVI.mjs.map → chunk-BAE4KYKJ.mjs.map} +0 -0
package/dist/agent/index.d.mts
CHANGED
|
@@ -209,7 +209,13 @@ interface ConnectAgentOptions<P extends ParameterInput = ParameterDefinitions> {
|
|
|
209
209
|
environment?: string;
|
|
210
210
|
/** A definition map, a Standard JSON Schema object, or a JSON Schema object. */
|
|
211
211
|
parameters?: P;
|
|
212
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* Whether this process connects. Takes any boolean, so one expression can
|
|
214
|
+
* gate the deployments that connect. Without it the default is true, except
|
|
215
|
+
* when CI is truthy; a value given here replaces that rule rather than adding
|
|
216
|
+
* to it, so keep the CI half: `process.env.APP_ENV !== "production" && !process.env.CI`.
|
|
217
|
+
* LANGWATCH_AGENT_CONNECT=0 always disables.
|
|
218
|
+
*/
|
|
213
219
|
enabled?: boolean;
|
|
214
220
|
/** Names this instance in the platform. Also LANGWATCH_AGENT_INSTANCE_LABEL. */
|
|
215
221
|
instanceLabel?: string;
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -209,7 +209,13 @@ interface ConnectAgentOptions<P extends ParameterInput = ParameterDefinitions> {
|
|
|
209
209
|
environment?: string;
|
|
210
210
|
/** A definition map, a Standard JSON Schema object, or a JSON Schema object. */
|
|
211
211
|
parameters?: P;
|
|
212
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* Whether this process connects. Takes any boolean, so one expression can
|
|
214
|
+
* gate the deployments that connect. Without it the default is true, except
|
|
215
|
+
* when CI is truthy; a value given here replaces that rule rather than adding
|
|
216
|
+
* to it, so keep the CI half: `process.env.APP_ENV !== "production" && !process.env.CI`.
|
|
217
|
+
* LANGWATCH_AGENT_CONNECT=0 always disables.
|
|
218
|
+
*/
|
|
213
219
|
enabled?: boolean;
|
|
214
220
|
/** Names this instance in the platform. Also LANGWATCH_AGENT_INSTANCE_LABEL. */
|
|
215
221
|
instanceLabel?: string;
|
package/dist/agent/index.js
CHANGED
|
@@ -87,7 +87,7 @@ var os = __toESM(require("os"));
|
|
|
87
87
|
var import_node_crypto = require("crypto");
|
|
88
88
|
|
|
89
89
|
// package.json
|
|
90
|
-
var version = "1.
|
|
90
|
+
var version = "1.12.0";
|
|
91
91
|
|
|
92
92
|
// src/internal/constants.ts
|
|
93
93
|
var LANGWATCH_SDK_VERSION = version;
|
|
@@ -1212,6 +1212,8 @@ var AgentClient = class {
|
|
|
1212
1212
|
try {
|
|
1213
1213
|
const result = await import_api.context.with(parent, () => runtime.run(call));
|
|
1214
1214
|
if (entry.cancelled) return;
|
|
1215
|
+
this.releaseCall({ callId: frame.callId, entry });
|
|
1216
|
+
await this.flushSpans();
|
|
1215
1217
|
this.send({
|
|
1216
1218
|
type: "result",
|
|
1217
1219
|
protocol: PROTOCOL_VERSION,
|
|
@@ -1224,11 +1226,34 @@ var AgentClient = class {
|
|
|
1224
1226
|
const code = error instanceof AgentParameterError ? error.code : "agent_call_failed";
|
|
1225
1227
|
const message = describeError(error);
|
|
1226
1228
|
this.logger.warn(`agent "${runtime.name}" call ${frame.callId} failed: ${message}`);
|
|
1229
|
+
this.releaseCall({ callId: frame.callId, entry });
|
|
1230
|
+
await this.flushSpans();
|
|
1227
1231
|
this.sendError({ callId: frame.callId, code, message });
|
|
1228
1232
|
} finally {
|
|
1229
1233
|
this.releaseCall({ callId: frame.callId, entry });
|
|
1230
1234
|
}
|
|
1231
1235
|
}
|
|
1236
|
+
/**
|
|
1237
|
+
* Exports the spans of the call now instead of at the exporter's next
|
|
1238
|
+
* schedule. The judge reads the agent's spans right after the last turn,
|
|
1239
|
+
* and a batch exporter would otherwise hold them for seconds, which is what
|
|
1240
|
+
* made the judge report the spans missing.
|
|
1241
|
+
*
|
|
1242
|
+
* The call awaits this before it sends its result or its error: the frame is
|
|
1243
|
+
* what tells the platform the turn is over, so a frame that goes out first
|
|
1244
|
+
* lets the judge read the call while its spans are still in the exporter.
|
|
1245
|
+
*/
|
|
1246
|
+
async flushSpans() {
|
|
1247
|
+
const provider = import_api.trace.getTracerProvider();
|
|
1248
|
+
const delegate = typeof provider.getDelegate === "function" ? provider.getDelegate() : provider;
|
|
1249
|
+
const flush = delegate?.forceFlush;
|
|
1250
|
+
if (typeof flush !== "function") return;
|
|
1251
|
+
try {
|
|
1252
|
+
await flush.call(delegate);
|
|
1253
|
+
} catch (error) {
|
|
1254
|
+
this.logger.debug(`span flush after a call failed: ${describeError(error)}`);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1232
1257
|
/** Frees the slot the call holds and drops its deadline timer. */
|
|
1233
1258
|
releaseCall({ callId, entry }) {
|
|
1234
1259
|
if (entry.timer) {
|