@theokit/agents 4.29.1 → 4.30.1
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/bridge.js +1 -1
- package/dist/{chunk-6M2HOKRH.js → chunk-LWF36KFK.js} +24 -9
- package/dist/chunk-LWF36KFK.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/persistence.d.ts +1 -1
- package/dist/persistence.js +2 -0
- package/dist/persistence.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-6M2HOKRH.js.map +0 -1
package/dist/bridge.js
CHANGED
|
@@ -1189,6 +1189,18 @@ function buildSdkTools(compiledTools, defineTool, extraSdkTools = [], runContext
|
|
|
1189
1189
|
}
|
|
1190
1190
|
__name(buildSdkTools, "buildSdkTools");
|
|
1191
1191
|
var resolverApiKey = /* @__PURE__ */ __name(async (k) => typeof k === "function" ? await k() : k, "resolverApiKey");
|
|
1192
|
+
function eventoDeErroDoSdk(err) {
|
|
1193
|
+
const sdkErr = err;
|
|
1194
|
+
return {
|
|
1195
|
+
type: "error",
|
|
1196
|
+
code: sdkErr.code ?? "SDK_ERROR",
|
|
1197
|
+
message: err instanceof Error ? err.message : "SDK agent error",
|
|
1198
|
+
// O SDK computa `isRetryable` por classe de erro na construção; fixá-lo em `false` aqui
|
|
1199
|
+
// contradizia o próprio erro.
|
|
1200
|
+
retryable: sdkErr.isRetryable === true
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
__name(eventoDeErroDoSdk, "eventoDeErroDoSdk");
|
|
1192
1204
|
function createSdkAgentStream(compiled, compiledTools, apiKey, overrides = {}) {
|
|
1193
1205
|
const model = overrides.model ?? compiled.model ?? "openai/gpt-4o-mini";
|
|
1194
1206
|
const reasoningEffort = overrides.reasoningEffort ?? compiled.reasoningEffort;
|
|
@@ -1240,12 +1252,7 @@ function createSdkAgentStream(compiled, compiledTools, apiKey, overrides = {}) {
|
|
|
1240
1252
|
t0
|
|
1241
1253
|
});
|
|
1242
1254
|
} catch (err) {
|
|
1243
|
-
yield
|
|
1244
|
-
type: "error",
|
|
1245
|
-
code: "SDK_ERROR",
|
|
1246
|
-
message: err instanceof Error ? err.message : "SDK agent error",
|
|
1247
|
-
retryable: false
|
|
1248
|
-
};
|
|
1255
|
+
yield eventoDeErroDoSdk(err);
|
|
1249
1256
|
}
|
|
1250
1257
|
}
|
|
1251
1258
|
}), "factory");
|
|
@@ -1958,9 +1965,13 @@ async function* presentUIMessageStream(events, opts) {
|
|
|
1958
1965
|
continue;
|
|
1959
1966
|
}
|
|
1960
1967
|
if (event.type === "error") {
|
|
1968
|
+
const code = event.code;
|
|
1961
1969
|
yield {
|
|
1962
1970
|
type: "error",
|
|
1963
|
-
errorText: event.message
|
|
1971
|
+
errorText: event.message,
|
|
1972
|
+
...code !== void 0 ? {
|
|
1973
|
+
errorCode: code
|
|
1974
|
+
} : {}
|
|
1964
1975
|
};
|
|
1965
1976
|
break;
|
|
1966
1977
|
}
|
|
@@ -1970,9 +1981,13 @@ async function* presentUIMessageStream(events, opts) {
|
|
|
1970
1981
|
}
|
|
1971
1982
|
}
|
|
1972
1983
|
} catch (err) {
|
|
1984
|
+
const code = err.code;
|
|
1973
1985
|
yield {
|
|
1974
1986
|
type: "error",
|
|
1975
|
-
errorText: String(err)
|
|
1987
|
+
errorText: String(err),
|
|
1988
|
+
...typeof code === "string" ? {
|
|
1989
|
+
errorCode: code
|
|
1990
|
+
} : {}
|
|
1976
1991
|
};
|
|
1977
1992
|
}
|
|
1978
1993
|
yield* presenter.finish(turnMetadata);
|
|
@@ -3532,4 +3547,4 @@ export {
|
|
|
3532
3547
|
generateAgentManifest,
|
|
3533
3548
|
agentsPlugin
|
|
3534
3549
|
};
|
|
3535
|
-
//# sourceMappingURL=chunk-
|
|
3550
|
+
//# sourceMappingURL=chunk-LWF36KFK.js.map
|