@theokit/sdk 5.15.3 → 5.16.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/CHANGELOG.md +16 -0
- package/dist/{agent-MOSFFVPU.js → agent-FB56RAXD.js} +11 -10
- package/dist/{agent-MOSFFVPU.js.map → agent-FB56RAXD.js.map} +1 -1
- package/dist/{agent-LTJYDRWI.cjs → agent-TM634NHQ.cjs} +12 -11
- package/dist/{agent-LTJYDRWI.cjs.map → agent-TM634NHQ.cjs.map} +1 -1
- package/dist/chunk-22HVMMXX.cjs +13 -0
- package/dist/chunk-22HVMMXX.cjs.map +1 -0
- package/dist/{chunk-QJVTDW3G.cjs → chunk-3JGRKXA7.cjs} +4 -4
- package/dist/{chunk-QJVTDW3G.cjs.map → chunk-3JGRKXA7.cjs.map} +1 -1
- package/dist/{chunk-CMDM4VF6.js → chunk-4XYCF5PA.js} +3 -3
- package/dist/{chunk-CMDM4VF6.js.map → chunk-4XYCF5PA.js.map} +1 -1
- package/dist/{chunk-4OMRDNPY.js → chunk-6WPNFZH3.js} +4 -4
- package/dist/{chunk-4OMRDNPY.js.map → chunk-6WPNFZH3.js.map} +1 -1
- package/dist/{chunk-5L7S2VOL.js → chunk-A3T2A2WU.js} +3 -69
- package/dist/chunk-A3T2A2WU.js.map +1 -0
- package/dist/{chunk-LAZTNGNR.cjs → chunk-BJB6RDEA.cjs} +59 -59
- package/dist/{chunk-LAZTNGNR.cjs.map → chunk-BJB6RDEA.cjs.map} +1 -1
- package/dist/{chunk-3ZRJ4RNB.cjs → chunk-BXEHUUDJ.cjs} +27 -27
- package/dist/{chunk-3ZRJ4RNB.cjs.map → chunk-BXEHUUDJ.cjs.map} +1 -1
- package/dist/{chunk-4TTR63O7.js → chunk-DLCYS5RI.js} +3 -3
- package/dist/{chunk-4TTR63O7.js.map → chunk-DLCYS5RI.js.map} +1 -1
- package/dist/chunk-GA4ZRKYF.cjs +75 -0
- package/dist/chunk-GA4ZRKYF.cjs.map +1 -0
- package/dist/chunk-ICBNSAO4.js +11 -0
- package/dist/chunk-ICBNSAO4.js.map +1 -0
- package/dist/{chunk-HFEAU2L2.js → chunk-MNE4633K.js} +3 -3
- package/dist/{chunk-HFEAU2L2.js.map → chunk-MNE4633K.js.map} +1 -1
- package/dist/{chunk-WAKGYSQ6.js → chunk-NHD5IN3E.js} +10 -10
- package/dist/{chunk-WAKGYSQ6.js.map → chunk-NHD5IN3E.js.map} +1 -1
- package/dist/{chunk-Q4UOCMAO.cjs → chunk-S5WTJ6LL.cjs} +5 -5
- package/dist/{chunk-Q4UOCMAO.cjs.map → chunk-S5WTJ6LL.cjs.map} +1 -1
- package/dist/chunk-SGKMTBCO.cjs +18 -0
- package/dist/{chunk-EDIYR4VR.cjs.map → chunk-SGKMTBCO.cjs.map} +1 -1
- package/dist/{chunk-RB3ZMMUU.cjs → chunk-TDKLSWHU.cjs} +4 -4
- package/dist/{chunk-RB3ZMMUU.cjs.map → chunk-TDKLSWHU.cjs.map} +1 -1
- package/dist/{chunk-AQ23NII7.js → chunk-UNUGF36D.js} +3 -3
- package/dist/{chunk-AQ23NII7.js.map → chunk-UNUGF36D.js.map} +1 -1
- package/dist/{chunk-Z5MB2HAN.cjs → chunk-WVQRE7CO.cjs} +4 -70
- package/dist/chunk-WVQRE7CO.cjs.map +1 -0
- package/dist/chunk-Z2UVCAYS.js +72 -0
- package/dist/chunk-Z2UVCAYS.js.map +1 -0
- package/dist/{compact-session-PIDZQ7AR.cjs → compact-session-OHA543HN.cjs} +14 -13
- package/dist/{compact-session-PIDZQ7AR.cjs.map → compact-session-OHA543HN.cjs.map} +1 -1
- package/dist/{compact-session-ZPEJSTLA.js → compact-session-XPJS27JD.js} +5 -4
- package/dist/{compact-session-ZPEJSTLA.js.map → compact-session-XPJS27JD.js.map} +1 -1
- package/dist/cron.cjs +11 -10
- package/dist/cron.js +10 -9
- package/dist/eval.cjs +10 -9
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +9 -8
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +219 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -1
- package/dist/index.d.ts +106 -1
- package/dist/index.js +185 -14
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-Z2HIB6P6.cjs → inject-session-NTL2UAE6.cjs} +5 -5
- package/dist/{inject-session-Z2HIB6P6.cjs.map → inject-session-NTL2UAE6.cjs.map} +1 -1
- package/dist/{inject-session-OMBJKMVD.js → inject-session-SCJ6MTUT.js} +4 -4
- package/dist/{inject-session-OMBJKMVD.js.map → inject-session-SCJ6MTUT.js.map} +1 -1
- package/dist/internal/providers/builtin/openai-chatgpt.d.ts +8 -0
- package/dist/internal/trim-trailing-slashes.d.ts +6 -0
- package/dist/models.cjs +12 -16
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +4 -8
- package/dist/models.js.map +1 -1
- package/dist/openai-chatgpt-IVAL4MW6.cjs +22 -0
- package/dist/openai-chatgpt-IVAL4MW6.cjs.map +1 -0
- package/dist/openai-chatgpt-ZFNZWT2L.js +9 -0
- package/dist/openai-chatgpt-ZFNZWT2L.js.map +1 -0
- package/dist/providers.cjs +5 -4
- package/dist/providers.js +3 -2
- package/dist/sandbox/e2b-sandbox.d.cts +61 -0
- package/dist/sandbox/e2b-sandbox.d.ts +61 -0
- package/dist/sandbox/index.cjs +55 -0
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +1 -0
- package/dist/sandbox/index.d.ts +1 -0
- package/dist/sandbox/index.js +54 -1
- package/dist/sandbox/index.js.map +1 -1
- package/docs/error-codes.md +2 -1
- package/docs/harness-capability-map.md +21 -1
- package/package.json +5 -1
- package/dist/chunk-5L7S2VOL.js.map +0 -1
- package/dist/chunk-EDIYR4VR.cjs +0 -18
- package/dist/chunk-Z5MB2HAN.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -10,25 +10,25 @@ var chunk4JF52NED_cjs = require('./chunk-4JF52NED.cjs');
|
|
|
10
10
|
require('./chunk-D3BL3EEB.cjs');
|
|
11
11
|
var chunkERBKPA2N_cjs = require('./chunk-ERBKPA2N.cjs');
|
|
12
12
|
require('./chunk-VTYY7XL5.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var chunkTDKLSWHU_cjs = require('./chunk-TDKLSWHU.cjs');
|
|
14
|
+
var chunkBJB6RDEA_cjs = require('./chunk-BJB6RDEA.cjs');
|
|
15
|
+
require('./chunk-BV2MWEMV.cjs');
|
|
15
16
|
var chunkER3BF23R_cjs = require('./chunk-ER3BF23R.cjs');
|
|
16
|
-
require('./chunk-
|
|
17
|
+
require('./chunk-3JGRKXA7.cjs');
|
|
17
18
|
require('./chunk-PNL63WDP.cjs');
|
|
19
|
+
var chunkEOWIUDKG_cjs = require('./chunk-EOWIUDKG.cjs');
|
|
18
20
|
require('./chunk-HI5TJWQE.cjs');
|
|
19
21
|
require('./chunk-NDXZXGVP.cjs');
|
|
20
|
-
require('./chunk-BV2MWEMV.cjs');
|
|
21
22
|
require('./chunk-DEHPRORL.cjs');
|
|
22
23
|
require('./chunk-GHX4P3V2.cjs');
|
|
23
24
|
require('./chunk-EBX6XUN7.cjs');
|
|
24
25
|
var chunkKC2HKUPT_cjs = require('./chunk-KC2HKUPT.cjs');
|
|
25
26
|
var chunkN2ORTDSO_cjs = require('./chunk-N2ORTDSO.cjs');
|
|
26
|
-
var
|
|
27
|
+
var chunkBXEHUUDJ_cjs = require('./chunk-BXEHUUDJ.cjs');
|
|
27
28
|
require('./chunk-MJGY3E3C.cjs');
|
|
28
29
|
require('./chunk-YJNYDJ2T.cjs');
|
|
29
30
|
require('./chunk-3F53FLQ7.cjs');
|
|
30
31
|
require('./chunk-QOGNZMHD.cjs');
|
|
31
|
-
var chunkEOWIUDKG_cjs = require('./chunk-EOWIUDKG.cjs');
|
|
32
32
|
require('./chunk-2ZPEDVLM.cjs');
|
|
33
33
|
require('./chunk-XR6O6G3B.cjs');
|
|
34
34
|
require('./chunk-X4ZYEZPD.cjs');
|
|
@@ -61,15 +61,17 @@ require('./chunk-FZSPVIFK.cjs');
|
|
|
61
61
|
var chunkJVH3NNJ3_cjs = require('./chunk-JVH3NNJ3.cjs');
|
|
62
62
|
require('./chunk-3YCNBOX7.cjs');
|
|
63
63
|
var chunkKX5QXLBS_cjs = require('./chunk-KX5QXLBS.cjs');
|
|
64
|
-
require('./chunk-
|
|
64
|
+
var chunk22HVMMXX_cjs = require('./chunk-22HVMMXX.cjs');
|
|
65
|
+
require('./chunk-S5WTJ6LL.cjs');
|
|
65
66
|
var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
|
|
66
|
-
require('./chunk-
|
|
67
|
-
var
|
|
67
|
+
require('./chunk-SGKMTBCO.cjs');
|
|
68
|
+
var chunkWVQRE7CO_cjs = require('./chunk-WVQRE7CO.cjs');
|
|
68
69
|
require('./chunk-NVXXWAU7.cjs');
|
|
70
|
+
require('./chunk-GA4ZRKYF.cjs');
|
|
69
71
|
require('./chunk-UMCCYXFZ.cjs');
|
|
70
72
|
require('./chunk-PXYINWBC.cjs');
|
|
71
73
|
require('./chunk-IOFMRS6T.cjs');
|
|
72
|
-
require('./chunk-EHD25JBZ.cjs');
|
|
74
|
+
var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
|
|
73
75
|
var chunkCEGU5AVD_cjs = require('./chunk-CEGU5AVD.cjs');
|
|
74
76
|
var chunkRNXXYF22_cjs = require('./chunk-RNXXYF22.cjs');
|
|
75
77
|
var node_crypto = require('node:crypto');
|
|
@@ -81,8 +83,8 @@ var node_os = require('node:os');
|
|
|
81
83
|
// src/agent-factory.ts
|
|
82
84
|
function createAgentFactory(common) {
|
|
83
85
|
return {
|
|
84
|
-
forSession: (agentId, overrides) =>
|
|
85
|
-
getOrCreate: (agentId, overrides) =>
|
|
86
|
+
forSession: (agentId, overrides) => chunkBJB6RDEA_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
|
|
87
|
+
getOrCreate: (agentId, overrides) => chunkBJB6RDEA_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
90
|
function mergeAgentOptions(common, overrides, agentId) {
|
|
@@ -548,6 +550,94 @@ function describeCredential(input) {
|
|
|
548
550
|
fingerprint: node_crypto.createHash("sha256").update(secret).digest("hex").slice(0, 8)
|
|
549
551
|
};
|
|
550
552
|
}
|
|
553
|
+
var DecisionChecksumError = class extends chunkCEGU5AVD_cjs.TheokitAgentError {
|
|
554
|
+
constructor(modelPath, expected, actual) {
|
|
555
|
+
super(`decide: checksum mismatch for ${modelPath} (expected ${expected}, got ${actual})`, {
|
|
556
|
+
code: "decision_checksum_mismatch",
|
|
557
|
+
isRetryable: false
|
|
558
|
+
});
|
|
559
|
+
this.modelPath = modelPath;
|
|
560
|
+
this.expected = expected;
|
|
561
|
+
this.actual = actual;
|
|
562
|
+
}
|
|
563
|
+
modelPath;
|
|
564
|
+
expected;
|
|
565
|
+
actual;
|
|
566
|
+
name = "DecisionChecksumError";
|
|
567
|
+
};
|
|
568
|
+
var sessionCache = /* @__PURE__ */ new Map();
|
|
569
|
+
async function defaultLoadSession(model) {
|
|
570
|
+
const name = "onnxruntime-node";
|
|
571
|
+
let ort;
|
|
572
|
+
try {
|
|
573
|
+
ort = await import(
|
|
574
|
+
/* @vite-ignore */
|
|
575
|
+
name
|
|
576
|
+
);
|
|
577
|
+
} catch {
|
|
578
|
+
throw new Error("decide: install `onnxruntime-node` to run a local classifier");
|
|
579
|
+
}
|
|
580
|
+
const session = await ort.InferenceSession.create(model);
|
|
581
|
+
const tensor = (a) => new ort.Tensor("int64", BigInt64Array.from(a, BigInt), [1, a.length]);
|
|
582
|
+
return {
|
|
583
|
+
async run(t) {
|
|
584
|
+
const feeds = {
|
|
585
|
+
input_ids: tensor(t.inputIds),
|
|
586
|
+
attention_mask: tensor(t.attentionMask ?? t.inputIds.map(() => 1))
|
|
587
|
+
};
|
|
588
|
+
const out = await session.run(feeds);
|
|
589
|
+
const first = Object.values(out)[0];
|
|
590
|
+
if (!first) throw new Error("decide: model returned no output");
|
|
591
|
+
return Array.from(first.data, Number);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
function softmax(logits) {
|
|
596
|
+
const max = Math.max(...logits);
|
|
597
|
+
const exps = logits.map((x) => Math.exp(x - max));
|
|
598
|
+
const sum = exps.reduce((a, b) => a + b, 0);
|
|
599
|
+
return exps.map((e) => e / sum);
|
|
600
|
+
}
|
|
601
|
+
async function decide(opts) {
|
|
602
|
+
if (opts.labels.length === 0) throw new Error("decide: labels must not be empty");
|
|
603
|
+
if (new Set(opts.labels).size !== opts.labels.length) {
|
|
604
|
+
throw new Error("decide: labels must be unique");
|
|
605
|
+
}
|
|
606
|
+
if (!/^[0-9a-f]{64}$/i.test(opts.sha256)) {
|
|
607
|
+
throw new Error("decide: sha256 must be 64 hex characters");
|
|
608
|
+
}
|
|
609
|
+
const bytes = await promises.readFile(opts.modelPath);
|
|
610
|
+
const actual = node_crypto.createHash("sha256").update(bytes).digest("hex");
|
|
611
|
+
const expected = opts.sha256.toLowerCase();
|
|
612
|
+
if (actual !== expected) throw new DecisionChecksumError(opts.modelPath, expected, actual);
|
|
613
|
+
const load = () => (opts.loadSession ?? defaultLoadSession)(new Uint8Array(bytes));
|
|
614
|
+
let session;
|
|
615
|
+
if (opts.loadSession) {
|
|
616
|
+
session = await load();
|
|
617
|
+
} else {
|
|
618
|
+
let cached = sessionCache.get(actual);
|
|
619
|
+
if (!cached) {
|
|
620
|
+
cached = load();
|
|
621
|
+
sessionCache.set(actual, cached);
|
|
622
|
+
cached.catch(() => sessionCache.delete(actual));
|
|
623
|
+
}
|
|
624
|
+
session = await cached;
|
|
625
|
+
}
|
|
626
|
+
const logits = await session.run(await opts.tokenize(opts.text));
|
|
627
|
+
if (logits.length !== opts.labels.length) {
|
|
628
|
+
throw new Error(
|
|
629
|
+
`decide: model returned ${logits.length} scores for ${opts.labels.length} labels`
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
const probs = softmax(logits);
|
|
633
|
+
const scores = {};
|
|
634
|
+
let best = 0;
|
|
635
|
+
opts.labels.forEach((l, i) => {
|
|
636
|
+
scores[l] = probs[i];
|
|
637
|
+
if (probs[i] > probs[best]) best = i;
|
|
638
|
+
});
|
|
639
|
+
return { label: opts.labels[best], scores, source: "local-onnx", modelSha256: actual };
|
|
640
|
+
}
|
|
551
641
|
|
|
552
642
|
// src/define-provider.ts
|
|
553
643
|
function defineProvider(profile, opts) {
|
|
@@ -573,8 +663,8 @@ var Provider = class _Provider {
|
|
|
573
663
|
* `.plugins(Provider.builtins())` once, then pick a `provider/model` id. @public
|
|
574
664
|
*/
|
|
575
665
|
static builtins() {
|
|
576
|
-
|
|
577
|
-
return
|
|
666
|
+
chunkWVQRE7CO_cjs.registerBuiltins();
|
|
667
|
+
return chunkWVQRE7CO_cjs.listProviders().map((profile) => defineProvider(profile));
|
|
578
668
|
}
|
|
579
669
|
/**
|
|
580
670
|
* The builtin serving `modelId`, or `undefined` when none does.
|
|
@@ -760,6 +850,87 @@ var EventBus = class {
|
|
|
760
850
|
}
|
|
761
851
|
};
|
|
762
852
|
|
|
853
|
+
// src/generate-image.ts
|
|
854
|
+
function sniffMime(b) {
|
|
855
|
+
const at = (i, ...v) => v.every((x, k) => b[i + k] === x);
|
|
856
|
+
if (at(0, 137, 80, 78, 71, 13, 10, 26, 10)) return "image/png";
|
|
857
|
+
if (at(0, 255, 216, 255)) return "image/jpeg";
|
|
858
|
+
if (at(0, 82, 73, 70, 70) && at(8, 87, 69, 66, 80)) return "image/webp";
|
|
859
|
+
return "application/octet-stream";
|
|
860
|
+
}
|
|
861
|
+
function parseSseLine(line) {
|
|
862
|
+
if (!line.startsWith("data:")) return void 0;
|
|
863
|
+
try {
|
|
864
|
+
return JSON.parse(line.slice(5));
|
|
865
|
+
} catch {
|
|
866
|
+
return void 0;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
function imageFromSse(sse) {
|
|
870
|
+
for (const line of sse.split("\n")) {
|
|
871
|
+
const ev = parseSseLine(line);
|
|
872
|
+
const done = ev?.type === "response.output_item.done" && ev.item?.type === "image_generation_call";
|
|
873
|
+
if (done && ev?.item?.result) return ev.item.result;
|
|
874
|
+
}
|
|
875
|
+
return void 0;
|
|
876
|
+
}
|
|
877
|
+
async function assertOk(res) {
|
|
878
|
+
if (res.ok) return;
|
|
879
|
+
const text = await res.text().catch(() => "");
|
|
880
|
+
throw new Error(`generateImage: provider returned ${res.status} ${text.slice(0, 300)}`);
|
|
881
|
+
}
|
|
882
|
+
async function generateViaChatGpt(opts) {
|
|
883
|
+
const { codexFetch } = await import('./openai-chatgpt-IVAL4MW6.cjs');
|
|
884
|
+
const base = chunk22HVMMXX_cjs.trimTrailingSlashes(opts.baseUrl ?? "https://chatgpt.com/backend-api/codex");
|
|
885
|
+
const res = await (opts.fetch ?? codexFetch())(`${base}/responses`, {
|
|
886
|
+
method: "POST",
|
|
887
|
+
headers: { "content-type": "application/json", accept: "text/event-stream" },
|
|
888
|
+
body: JSON.stringify({
|
|
889
|
+
model: opts.model ?? "gpt-5.4",
|
|
890
|
+
instructions: "Generate the requested image with the image_generation tool.",
|
|
891
|
+
input: [{ role: "user", content: [{ type: "input_text", text: opts.prompt }] }],
|
|
892
|
+
tools: [{ type: "image_generation" }],
|
|
893
|
+
tool_choice: { type: "image_generation" },
|
|
894
|
+
store: false,
|
|
895
|
+
stream: true
|
|
896
|
+
}),
|
|
897
|
+
signal: opts.signal
|
|
898
|
+
});
|
|
899
|
+
await assertOk(res);
|
|
900
|
+
const b64 = imageFromSse(await res.text());
|
|
901
|
+
if (b64 === void 0) throw new Error("generateImage: provider returned no image data");
|
|
902
|
+
return b64;
|
|
903
|
+
}
|
|
904
|
+
async function generateImage(opts) {
|
|
905
|
+
if (opts.route === "chatgpt") {
|
|
906
|
+
const image2 = new Uint8Array(Buffer.from(await generateViaChatGpt(opts), "base64"));
|
|
907
|
+
return { image: image2, mimeType: sniffMime(image2) };
|
|
908
|
+
}
|
|
909
|
+
const apiKey = opts.apiKey ?? process.env.OPENAI_API_KEY;
|
|
910
|
+
if (!apiKey) throw new Error("generateImage: no API key (pass apiKey or set OPENAI_API_KEY)");
|
|
911
|
+
const base = chunk22HVMMXX_cjs.trimTrailingSlashes(opts.baseUrl ?? "https://api.openai.com/v1");
|
|
912
|
+
const body = {
|
|
913
|
+
model: opts.model ?? "gpt-image-1",
|
|
914
|
+
prompt: opts.prompt,
|
|
915
|
+
n: 1
|
|
916
|
+
};
|
|
917
|
+
if (opts.size !== void 0) body.size = opts.size;
|
|
918
|
+
const res = await chunkEHD25JBZ_cjs.boundFetch(opts.fetch)(`${base}/images/generations`, {
|
|
919
|
+
method: "POST",
|
|
920
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${apiKey}` },
|
|
921
|
+
body: JSON.stringify(body),
|
|
922
|
+
signal: opts.signal
|
|
923
|
+
});
|
|
924
|
+
await assertOk(res);
|
|
925
|
+
const json = await res.json();
|
|
926
|
+
const b64 = json.data?.[0]?.b64_json;
|
|
927
|
+
if (typeof b64 !== "string" || b64.length === 0) {
|
|
928
|
+
throw new Error("generateImage: provider returned no image data");
|
|
929
|
+
}
|
|
930
|
+
const image = new Uint8Array(Buffer.from(b64, "base64"));
|
|
931
|
+
return { image, mimeType: sniffMime(image) };
|
|
932
|
+
}
|
|
933
|
+
|
|
763
934
|
// src/goal-loop.ts
|
|
764
935
|
function runGoalLoop(agent, goal, options, depsOverride) {
|
|
765
936
|
async function* wrap() {
|
|
@@ -1100,7 +1271,7 @@ var Memory = {
|
|
|
1100
1271
|
return await peer.IndexManager.open(openArgs);
|
|
1101
1272
|
}
|
|
1102
1273
|
const { IndexManager } = await import('./index-manager-CT6MMG7S.cjs');
|
|
1103
|
-
openArgs.embedding = await resolveEmbedding(opts.embedding,
|
|
1274
|
+
openArgs.embedding = await resolveEmbedding(opts.embedding, chunkBJB6RDEA_cjs.MEMORY_EMBEDDING_ADAPTERS);
|
|
1104
1275
|
return await IndexManager.open(openArgs);
|
|
1105
1276
|
},
|
|
1106
1277
|
/**
|
|
@@ -1111,7 +1282,7 @@ var Memory = {
|
|
|
1111
1282
|
*/
|
|
1112
1283
|
async runDreamingSweep(opts) {
|
|
1113
1284
|
const peer = await tryLoadSdkMemoryPeer();
|
|
1114
|
-
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS :
|
|
1285
|
+
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkBJB6RDEA_cjs.MEMORY_EMBEDDING_ADAPTERS;
|
|
1115
1286
|
const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
|
|
1116
1287
|
const result = peer !== null ? (
|
|
1117
1288
|
// biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
|
|
@@ -1722,7 +1893,7 @@ function guardSessionDestruction(sessionId, live) {
|
|
|
1722
1893
|
// src/session-messages.ts
|
|
1723
1894
|
async function readSessionMessages2(options) {
|
|
1724
1895
|
const cwd = options.cwd ?? process.cwd();
|
|
1725
|
-
const baseDir =
|
|
1896
|
+
const baseDir = chunkBJB6RDEA_cjs.resolveSessionDir({ sessionDir: options.sessionDir });
|
|
1726
1897
|
return chunkEOWIUDKG_cjs.readSessionMessages(new chunkN2ORTDSO_cjs.FsSessionStore({ baseDir, cwd }), options.sessionId);
|
|
1727
1898
|
}
|
|
1728
1899
|
|
|
@@ -1739,7 +1910,7 @@ function isBuiltAgent(m) {
|
|
|
1739
1910
|
return typeof m.send === "function";
|
|
1740
1911
|
}
|
|
1741
1912
|
async function materialize(def, index) {
|
|
1742
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1913
|
+
const { Agent: Agent2 } = await import('./agent-TM634NHQ.cjs');
|
|
1743
1914
|
return Agent2.create({
|
|
1744
1915
|
// `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
|
|
1745
1916
|
// here means "declare nothing and let the default apply" — forwarding the literal would create
|
|
@@ -1881,7 +2052,7 @@ var FIXTURE_USER = {
|
|
|
1881
2052
|
};
|
|
1882
2053
|
var FIXTURE_MODELS = [
|
|
1883
2054
|
{
|
|
1884
|
-
id:
|
|
2055
|
+
id: chunkBJB6RDEA_cjs.DEFAULT_AGENTIC_MODEL_ID,
|
|
1885
2056
|
name: "Gemini 2.0 Flash",
|
|
1886
2057
|
displayName: "Gemini 2.0 Flash",
|
|
1887
2058
|
parameters: [
|
|
@@ -1957,7 +2128,7 @@ async function listLocalModelsViaOpenAiCompat(baseUrl) {
|
|
|
1957
2128
|
try {
|
|
1958
2129
|
response = await fetch(url, { method: "GET" });
|
|
1959
2130
|
} catch (fetchErr) {
|
|
1960
|
-
const mapped =
|
|
2131
|
+
const mapped = chunkBXEHUUDJ_cjs.mapOllamaTransportError({
|
|
1961
2132
|
providerId: "ollama",
|
|
1962
2133
|
cause: fetchErr,
|
|
1963
2134
|
endpoint: "/v1/models"
|
|
@@ -1969,8 +2140,8 @@ async function listLocalModelsViaOpenAiCompat(baseUrl) {
|
|
|
1969
2140
|
);
|
|
1970
2141
|
}
|
|
1971
2142
|
if (!response.ok) {
|
|
1972
|
-
const body = await
|
|
1973
|
-
const mapped =
|
|
2143
|
+
const body = await chunkBXEHUUDJ_cjs.readErrorResponseBody(response);
|
|
2144
|
+
const mapped = chunkBXEHUUDJ_cjs.mapOllamaHttpError({
|
|
1974
2145
|
providerId: "ollama",
|
|
1975
2146
|
status: response.status,
|
|
1976
2147
|
body,
|
|
@@ -2033,9 +2204,9 @@ var Theokit = class {
|
|
|
2033
2204
|
});
|
|
2034
2205
|
},
|
|
2035
2206
|
capabilities: (providerOrModelId) => {
|
|
2036
|
-
|
|
2207
|
+
chunkWVQRE7CO_cjs.registerBuiltins();
|
|
2037
2208
|
const providerId = providerOrModelId.includes("/") ? providerOrModelId.split("/")[0] ?? providerOrModelId : providerOrModelId;
|
|
2038
|
-
return
|
|
2209
|
+
return chunkWVQRE7CO_cjs.getCatalogCapabilities(providerId);
|
|
2039
2210
|
}
|
|
2040
2211
|
};
|
|
2041
2212
|
/**
|
|
@@ -2074,8 +2245,8 @@ var Theokit = class {
|
|
|
2074
2245
|
*/
|
|
2075
2246
|
static inspect = {
|
|
2076
2247
|
builtinProviders: () => {
|
|
2077
|
-
|
|
2078
|
-
return
|
|
2248
|
+
chunkWVQRE7CO_cjs.registerBuiltins();
|
|
2249
|
+
return chunkWVQRE7CO_cjs.listProviders().map((p) => ({
|
|
2079
2250
|
name: p.name,
|
|
2080
2251
|
apiMode: p.apiMode,
|
|
2081
2252
|
authType: p.authType,
|
|
@@ -2084,7 +2255,7 @@ var Theokit = class {
|
|
|
2084
2255
|
envVars: p.envVars
|
|
2085
2256
|
}));
|
|
2086
2257
|
},
|
|
2087
|
-
embeddingAdapters: () => Object.entries(
|
|
2258
|
+
embeddingAdapters: () => Object.entries(chunkBJB6RDEA_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
|
|
2088
2259
|
id,
|
|
2089
2260
|
transport: adapter.transport,
|
|
2090
2261
|
defaultModel: adapter.defaultModel
|
|
@@ -2101,9 +2272,9 @@ var Theokit = class {
|
|
|
2101
2272
|
// and may be promoted onto Theokit once the agent.ts cycle is broken.
|
|
2102
2273
|
};
|
|
2103
2274
|
async function maybeListLocalModels(providerName) {
|
|
2104
|
-
|
|
2105
|
-
await
|
|
2106
|
-
const profile =
|
|
2275
|
+
chunkWVQRE7CO_cjs.registerBuiltins();
|
|
2276
|
+
await chunkBXEHUUDJ_cjs.discoverProviderPlugins();
|
|
2277
|
+
const profile = chunkWVQRE7CO_cjs.getProviderProfile(providerName);
|
|
2107
2278
|
if (profile === void 0) return void 0;
|
|
2108
2279
|
if (profile.authType !== "none") return void 0;
|
|
2109
2280
|
const baseUrl = resolveLocalProviderBaseUrl(profile.name, profile.baseUrl);
|
|
@@ -2120,13 +2291,13 @@ async function executeCatalogRequest(request) {
|
|
|
2120
2291
|
if (apiKey === void 0) {
|
|
2121
2292
|
throw new chunkCEGU5AVD_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
2122
2293
|
}
|
|
2123
|
-
if (
|
|
2294
|
+
if (chunkBXEHUUDJ_cjs.shouldUseFixtureMode(apiKey)) {
|
|
2124
2295
|
return request.fixture;
|
|
2125
2296
|
}
|
|
2126
|
-
if (!
|
|
2297
|
+
if (!chunkBXEHUUDJ_cjs.isFixtureApiKey(apiKey) && process.env.THEOKIT_API_BASE_URL === void 0) {
|
|
2127
2298
|
throw new chunkCEGU5AVD_cjs.AuthenticationError("Invalid API key", { code: "authentication_error" });
|
|
2128
2299
|
}
|
|
2129
|
-
return
|
|
2300
|
+
return chunkBXEHUUDJ_cjs.httpRequest(request.path, { apiKey });
|
|
2130
2301
|
}
|
|
2131
2302
|
|
|
2132
2303
|
// src/tool-blast-radius.ts
|
|
@@ -2307,43 +2478,43 @@ Object.defineProperty(exports, "SqliteSessionStore", {
|
|
|
2307
2478
|
});
|
|
2308
2479
|
Object.defineProperty(exports, "Cron", {
|
|
2309
2480
|
enumerable: true,
|
|
2310
|
-
get: function () { return
|
|
2481
|
+
get: function () { return chunkTDKLSWHU_cjs.Cron; }
|
|
2311
2482
|
});
|
|
2312
2483
|
Object.defineProperty(exports, "Agent", {
|
|
2313
2484
|
enumerable: true,
|
|
2314
|
-
get: function () { return
|
|
2485
|
+
get: function () { return chunkBJB6RDEA_cjs.Agent; }
|
|
2315
2486
|
});
|
|
2316
2487
|
Object.defineProperty(exports, "AgentBuilder", {
|
|
2317
2488
|
enumerable: true,
|
|
2318
|
-
get: function () { return
|
|
2489
|
+
get: function () { return chunkBJB6RDEA_cjs.AgentBuilder; }
|
|
2319
2490
|
});
|
|
2320
2491
|
Object.defineProperty(exports, "Tool", {
|
|
2321
2492
|
enumerable: true,
|
|
2322
|
-
get: function () { return
|
|
2493
|
+
get: function () { return chunkBJB6RDEA_cjs.Tool; }
|
|
2323
2494
|
});
|
|
2324
2495
|
Object.defineProperty(exports, "ToolError", {
|
|
2325
2496
|
enumerable: true,
|
|
2326
|
-
get: function () { return
|
|
2497
|
+
get: function () { return chunkBJB6RDEA_cjs.ToolError; }
|
|
2327
2498
|
});
|
|
2328
2499
|
Object.defineProperty(exports, "UsageAccumulator", {
|
|
2329
2500
|
enumerable: true,
|
|
2330
|
-
get: function () { return
|
|
2501
|
+
get: function () { return chunkBJB6RDEA_cjs.UsageAccumulator; }
|
|
2331
2502
|
});
|
|
2332
2503
|
Object.defineProperty(exports, "computeCost", {
|
|
2333
2504
|
enumerable: true,
|
|
2334
|
-
get: function () { return
|
|
2505
|
+
get: function () { return chunkBJB6RDEA_cjs.computeCost; }
|
|
2335
2506
|
});
|
|
2336
2507
|
Object.defineProperty(exports, "getPricingEntry", {
|
|
2337
2508
|
enumerable: true,
|
|
2338
|
-
get: function () { return
|
|
2509
|
+
get: function () { return chunkBJB6RDEA_cjs.getPricingEntry; }
|
|
2339
2510
|
});
|
|
2340
2511
|
Object.defineProperty(exports, "managedSettingsPathFor", {
|
|
2341
2512
|
enumerable: true,
|
|
2342
|
-
get: function () { return
|
|
2513
|
+
get: function () { return chunkBJB6RDEA_cjs.managedSettingsPathFor; }
|
|
2343
2514
|
});
|
|
2344
2515
|
Object.defineProperty(exports, "readManagedSettings", {
|
|
2345
2516
|
enumerable: true,
|
|
2346
|
-
get: function () { return
|
|
2517
|
+
get: function () { return chunkBJB6RDEA_cjs.readManagedSettings; }
|
|
2347
2518
|
});
|
|
2348
2519
|
Object.defineProperty(exports, "emitRunEvent", {
|
|
2349
2520
|
enumerable: true,
|
|
@@ -2351,11 +2522,11 @@ Object.defineProperty(exports, "emitRunEvent", {
|
|
|
2351
2522
|
});
|
|
2352
2523
|
Object.defineProperty(exports, "inferApiMode", {
|
|
2353
2524
|
enumerable: true,
|
|
2354
|
-
get: function () { return
|
|
2525
|
+
get: function () { return chunkBXEHUUDJ_cjs.inferApiMode; }
|
|
2355
2526
|
});
|
|
2356
2527
|
Object.defineProperty(exports, "normalizeUsage", {
|
|
2357
2528
|
enumerable: true,
|
|
2358
|
-
get: function () { return
|
|
2529
|
+
get: function () { return chunkBXEHUUDJ_cjs.normalizeUsage; }
|
|
2359
2530
|
});
|
|
2360
2531
|
Object.defineProperty(exports, "withCwdMutex", {
|
|
2361
2532
|
enumerable: true,
|
|
@@ -2447,6 +2618,7 @@ Object.defineProperty(exports, "setDiagnosticsSink", {
|
|
|
2447
2618
|
});
|
|
2448
2619
|
exports.AgentFactory = AgentFactory;
|
|
2449
2620
|
exports.Budget = Budget;
|
|
2621
|
+
exports.DecisionChecksumError = DecisionChecksumError;
|
|
2450
2622
|
exports.EventBus = EventBus;
|
|
2451
2623
|
exports.JobQueue = JobQueue;
|
|
2452
2624
|
exports.LayerOrderError = LayerOrderError;
|
|
@@ -2475,6 +2647,7 @@ exports.chargeAndCheckThresholds = chargeAndCheckThresholds;
|
|
|
2475
2647
|
exports.createCounterBudgetTracker = createCounterBudgetTracker;
|
|
2476
2648
|
exports.createTokenLimiter = createTokenLimiter;
|
|
2477
2649
|
exports.createUnicodeNormalizer = createUnicodeNormalizer;
|
|
2650
|
+
exports.decide = decide;
|
|
2478
2651
|
exports.decideApproval = decideApproval;
|
|
2479
2652
|
exports.describeAction = describeAction;
|
|
2480
2653
|
exports.describeCredential = describeCredential;
|
|
@@ -2482,6 +2655,7 @@ exports.effectiveToolNames = effectiveToolNames;
|
|
|
2482
2655
|
exports.evaluateBlastRadius = evaluateBlastRadius;
|
|
2483
2656
|
exports.extractRawId = extractRawId;
|
|
2484
2657
|
exports.foldLayers = foldLayers;
|
|
2658
|
+
exports.generateImage = generateImage;
|
|
2485
2659
|
exports.guardSessionDestruction = guardSessionDestruction;
|
|
2486
2660
|
exports.isInside = isInside;
|
|
2487
2661
|
exports.loadProjectEnv = loadProjectEnv;
|