@theokit/sdk 5.15.2 → 5.15.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.
- package/CHANGELOG.md +6 -0
- package/dist/{agent-D6WBBNGR.cjs → agent-LTJYDRWI.cjs} +6 -6
- package/dist/{agent-D6WBBNGR.cjs.map → agent-LTJYDRWI.cjs.map} +1 -1
- package/dist/{agent-QRIFX2SY.js → agent-MOSFFVPU.js} +5 -5
- package/dist/{agent-QRIFX2SY.js.map → agent-MOSFFVPU.js.map} +1 -1
- package/dist/{chunk-6XT5LAZG.cjs → chunk-3ZRJ4RNB.cjs} +46 -7
- package/dist/chunk-3ZRJ4RNB.cjs.map +1 -0
- package/dist/{chunk-PSMWZYW6.js → chunk-4OMRDNPY.js} +3 -3
- package/dist/{chunk-PSMWZYW6.js.map → chunk-4OMRDNPY.js.map} +1 -1
- package/dist/{chunk-ATGSV4GS.js → chunk-4TTR63O7.js} +3 -3
- package/dist/{chunk-ATGSV4GS.js.map → chunk-4TTR63O7.js.map} +1 -1
- package/dist/{chunk-JRQJMZKY.js → chunk-HFEAU2L2.js} +44 -5
- package/dist/chunk-HFEAU2L2.js.map +1 -0
- package/dist/{chunk-BTGYRM4J.cjs → chunk-LAZTNGNR.cjs} +49 -49
- package/dist/{chunk-BTGYRM4J.cjs.map → chunk-LAZTNGNR.cjs.map} +1 -1
- package/dist/{chunk-PDFSLD5P.cjs → chunk-QJVTDW3G.cjs} +3 -3
- package/dist/{chunk-PDFSLD5P.cjs.map → chunk-QJVTDW3G.cjs.map} +1 -1
- package/dist/{chunk-VT3NWHFH.cjs → chunk-RB3ZMMUU.cjs} +4 -4
- package/dist/{chunk-VT3NWHFH.cjs.map → chunk-RB3ZMMUU.cjs.map} +1 -1
- package/dist/{chunk-CG64VPPU.js → chunk-WAKGYSQ6.js} +6 -6
- package/dist/{chunk-CG64VPPU.js.map → chunk-WAKGYSQ6.js.map} +1 -1
- package/dist/{compact-session-5DWFHMW4.cjs → compact-session-PIDZQ7AR.cjs} +12 -12
- package/dist/{compact-session-5DWFHMW4.cjs.map → compact-session-PIDZQ7AR.cjs.map} +1 -1
- package/dist/{compact-session-AL65PEMX.js → compact-session-ZPEJSTLA.js} +3 -3
- package/dist/{compact-session-AL65PEMX.js.map → compact-session-ZPEJSTLA.js.map} +1 -1
- package/dist/cron.cjs +5 -5
- package/dist/cron.js +4 -4
- package/dist/eval.cjs +4 -4
- package/dist/eval.js +3 -3
- package/dist/index.cjs +31 -31
- package/dist/index.js +7 -7
- package/dist/{inject-session-E2SZ4A35.js → inject-session-OMBJKMVD.js} +3 -3
- package/dist/{inject-session-E2SZ4A35.js.map → inject-session-OMBJKMVD.js.map} +1 -1
- package/dist/{inject-session-QZULG65O.cjs → inject-session-Z2HIB6P6.cjs} +4 -4
- package/dist/{inject-session-QZULG65O.cjs.map → inject-session-Z2HIB6P6.cjs.map} +1 -1
- package/dist/internal/llm/openai.d.ts +2 -0
- package/dist/internal/llm/responses.d.ts +2 -0
- package/dist/internal/llm/sse.d.ts +6 -0
- package/docs/error-codes.md +5 -4
- package/package.json +1 -1
- package/dist/chunk-6XT5LAZG.cjs.map +0 -1
- package/dist/chunk-JRQJMZKY.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.15.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#967](https://github.com/usetheokit/theokit-sdk/pull/967) [`2e162ca`](https://github.com/usetheokit/theokit-sdk/commit/2e162cad9b3dcc858536e1fc799f76528132f63f) Thanks [@aifactory-paulohenriquevn](https://github.com/apps/aifactory-paulohenriquevn)! - llm: bound the wait for response headers (default 30 s, `responseHeadersTimeoutMs`, `<= 0` disables); a stalled request now fails with a retryable `NetworkError` (`response_headers_timeout`) instead of waiting for undici's 300 s.
|
|
8
|
+
|
|
3
9
|
## 5.15.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLAZTNGNR_cjs = require('./chunk-LAZTNGNR.cjs');
|
|
4
4
|
require('./chunk-ER3BF23R.cjs');
|
|
5
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-QJVTDW3G.cjs');
|
|
6
6
|
require('./chunk-PNL63WDP.cjs');
|
|
7
7
|
require('./chunk-HI5TJWQE.cjs');
|
|
8
8
|
require('./chunk-NDXZXGVP.cjs');
|
|
@@ -12,7 +12,7 @@ require('./chunk-GHX4P3V2.cjs');
|
|
|
12
12
|
require('./chunk-EBX6XUN7.cjs');
|
|
13
13
|
require('./chunk-KC2HKUPT.cjs');
|
|
14
14
|
require('./chunk-N2ORTDSO.cjs');
|
|
15
|
-
require('./chunk-
|
|
15
|
+
require('./chunk-3ZRJ4RNB.cjs');
|
|
16
16
|
require('./chunk-MJGY3E3C.cjs');
|
|
17
17
|
require('./chunk-YJNYDJ2T.cjs');
|
|
18
18
|
require('./chunk-3F53FLQ7.cjs');
|
|
@@ -66,7 +66,7 @@ require('./chunk-RNXXYF22.cjs');
|
|
|
66
66
|
|
|
67
67
|
Object.defineProperty(exports, "Agent", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkLAZTNGNR_cjs.Agent; }
|
|
70
70
|
});
|
|
71
|
-
//# sourceMappingURL=agent-
|
|
72
|
-
//# sourceMappingURL=agent-
|
|
71
|
+
//# sourceMappingURL=agent-LTJYDRWI.cjs.map
|
|
72
|
+
//# sourceMappingURL=agent-LTJYDRWI.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-LTJYDRWI.cjs"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { Agent } from './chunk-
|
|
1
|
+
export { Agent } from './chunk-WAKGYSQ6.js';
|
|
2
2
|
import './chunk-GEQLHBJM.js';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-4OMRDNPY.js';
|
|
4
4
|
import './chunk-3GQYMKVJ.js';
|
|
5
5
|
import './chunk-L5B7EWWH.js';
|
|
6
6
|
import './chunk-ZUWVO442.js';
|
|
@@ -10,7 +10,7 @@ import './chunk-H73MEMQB.js';
|
|
|
10
10
|
import './chunk-BH6M2DGV.js';
|
|
11
11
|
import './chunk-DB5RYCXX.js';
|
|
12
12
|
import './chunk-P7B64NFK.js';
|
|
13
|
-
import './chunk-
|
|
13
|
+
import './chunk-HFEAU2L2.js';
|
|
14
14
|
import './chunk-OIOSY5G6.js';
|
|
15
15
|
import './chunk-2XC6KDJM.js';
|
|
16
16
|
import './chunk-7ACS6P5Z.js';
|
|
@@ -59,5 +59,5 @@ import './chunk-5IUDICRK.js';
|
|
|
59
59
|
import './chunk-Q7GYMXVC.js';
|
|
60
60
|
import './chunk-TNFOU6SB.js';
|
|
61
61
|
import './chunk-3OY6H3I7.js';
|
|
62
|
-
//# sourceMappingURL=agent-
|
|
63
|
-
//# sourceMappingURL=agent-
|
|
62
|
+
//# sourceMappingURL=agent-MOSFFVPU.js.map
|
|
63
|
+
//# sourceMappingURL=agent-MOSFFVPU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"agent-MOSFFVPU.js"}
|
|
@@ -402,6 +402,36 @@ function encodeAnthropicSystem(system) {
|
|
|
402
402
|
|
|
403
403
|
// src/internal/llm/sse.ts
|
|
404
404
|
var DEFAULT_SSE_IDLE_MS = 6e4;
|
|
405
|
+
var DEFAULT_RESPONSE_HEADERS_MS = 3e4;
|
|
406
|
+
function withResponseHeadersTimeout(inner, timeoutMs = DEFAULT_RESPONSE_HEADERS_MS) {
|
|
407
|
+
if (!(timeoutMs > 0)) return inner;
|
|
408
|
+
return (async (input, init) => {
|
|
409
|
+
const controller = new AbortController();
|
|
410
|
+
const callerSignal = init?.signal ?? void 0;
|
|
411
|
+
const onCallerAbort = () => controller.abort(callerSignal?.reason);
|
|
412
|
+
if (callerSignal?.aborted) onCallerAbort();
|
|
413
|
+
else callerSignal?.addEventListener("abort", onCallerAbort, { once: true });
|
|
414
|
+
let timer;
|
|
415
|
+
const timeout = new Promise((_, reject) => {
|
|
416
|
+
timer = setTimeout(() => {
|
|
417
|
+
reject(
|
|
418
|
+
new chunkCEGU5AVD_cjs.NetworkError(`no response headers within ${timeoutMs}ms \u2014 upstream stalled`, {
|
|
419
|
+
code: "response_headers_timeout"
|
|
420
|
+
})
|
|
421
|
+
);
|
|
422
|
+
controller.abort();
|
|
423
|
+
}, timeoutMs);
|
|
424
|
+
});
|
|
425
|
+
try {
|
|
426
|
+
const pending = inner(input, { ...init, signal: controller.signal });
|
|
427
|
+
pending.catch(() => void 0);
|
|
428
|
+
return await Promise.race([pending, timeout]);
|
|
429
|
+
} finally {
|
|
430
|
+
clearTimeout(timer);
|
|
431
|
+
callerSignal?.removeEventListener("abort", onCallerAbort);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
}
|
|
405
435
|
async function* parseSseStream(body, signal, idleTimeoutMs = DEFAULT_SSE_IDLE_MS) {
|
|
406
436
|
if (body === null) return;
|
|
407
437
|
const reader = body.getReader();
|
|
@@ -522,7 +552,10 @@ var AnthropicClient = class {
|
|
|
522
552
|
constructor(options) {
|
|
523
553
|
this.options = options;
|
|
524
554
|
this.baseUrl = options.baseUrl ?? "https://api.anthropic.com";
|
|
525
|
-
this.fetchImpl =
|
|
555
|
+
this.fetchImpl = withResponseHeadersTimeout(
|
|
556
|
+
chunkEHD25JBZ_cjs.boundFetch(options.fetch),
|
|
557
|
+
options.responseHeadersTimeoutMs
|
|
558
|
+
);
|
|
526
559
|
}
|
|
527
560
|
options;
|
|
528
561
|
name = "anthropic";
|
|
@@ -814,7 +847,7 @@ async function resolveBedrockToken(region) {
|
|
|
814
847
|
return cachedToken.value;
|
|
815
848
|
}
|
|
816
849
|
try {
|
|
817
|
-
const r = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
850
|
+
const r = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-3ZRJ4RNB.cjs', document.baseURI).href)));
|
|
818
851
|
const gen = r("@aws/bedrock-token-generator");
|
|
819
852
|
if (typeof gen.getToken !== "function") return void 0;
|
|
820
853
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -1794,7 +1827,10 @@ var OpenAIClient = class {
|
|
|
1794
1827
|
this.options = options;
|
|
1795
1828
|
this.baseUrl = (options.baseUrl ?? "https://api.openai.com").replace(/\/+$/, "");
|
|
1796
1829
|
this.chatPath = options.chatCompletionsPath ?? deriveChatPath(this.baseUrl);
|
|
1797
|
-
this.fetchImpl =
|
|
1830
|
+
this.fetchImpl = withResponseHeadersTimeout(
|
|
1831
|
+
chunkEHD25JBZ_cjs.boundFetch(options.fetch),
|
|
1832
|
+
options.responseHeadersTimeoutMs
|
|
1833
|
+
);
|
|
1798
1834
|
}
|
|
1799
1835
|
options;
|
|
1800
1836
|
name = "openai";
|
|
@@ -2510,7 +2546,10 @@ var ResponsesApiClient = class {
|
|
|
2510
2546
|
this.options = options;
|
|
2511
2547
|
this.name = options.providerName ?? "openai-responses";
|
|
2512
2548
|
this.baseUrl = (options.baseUrl ?? "https://api.openai.com/v1").replace(/\/+$/, "");
|
|
2513
|
-
this.fetchImpl =
|
|
2549
|
+
this.fetchImpl = withResponseHeadersTimeout(
|
|
2550
|
+
chunkEHD25JBZ_cjs.boundFetch(options.fetch),
|
|
2551
|
+
options.responseHeadersTimeoutMs
|
|
2552
|
+
);
|
|
2514
2553
|
}
|
|
2515
2554
|
options;
|
|
2516
2555
|
name;
|
|
@@ -2775,7 +2814,7 @@ async function resolveVertexAccessToken() {
|
|
|
2775
2814
|
async function getAuthClientOrThrow() {
|
|
2776
2815
|
let mod;
|
|
2777
2816
|
try {
|
|
2778
|
-
const r = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2817
|
+
const r = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-3ZRJ4RNB.cjs', document.baseURI).href)));
|
|
2779
2818
|
mod = r("google-auth-library");
|
|
2780
2819
|
} catch (err) {
|
|
2781
2820
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
@@ -3628,5 +3667,5 @@ exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
|
3628
3667
|
exports.trustFilePath = trustFilePath;
|
|
3629
3668
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3630
3669
|
exports.validateApiKeyShape = validateApiKeyShape;
|
|
3631
|
-
//# sourceMappingURL=chunk-
|
|
3632
|
-
//# sourceMappingURL=chunk-
|
|
3670
|
+
//# sourceMappingURL=chunk-3ZRJ4RNB.cjs.map
|
|
3671
|
+
//# sourceMappingURL=chunk-3ZRJ4RNB.cjs.map
|