@theokit/sdk 5.9.1 → 5.10.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 +119 -0
- package/dist/{agent-enXXu447.d.ts → agent-CmKwSyyD.d.ts} +27 -0
- package/dist/{agent-5M7WLUWH.cjs → agent-TLRURB7W.cjs} +18 -16
- package/dist/{agent-5M7WLUWH.cjs.map → agent-TLRURB7W.cjs.map} +1 -1
- package/dist/{agent-Dh2YHSLj.d.cts → agent-XMkGzff_.d.cts} +27 -0
- package/dist/{agent-R5RERYFU.js → agent-XTLAVVYC.js} +17 -15
- package/dist/{agent-R5RERYFU.js.map → agent-XTLAVVYC.js.map} +1 -1
- package/dist/agent-session-store-ODD3IZCW.js +6 -0
- package/dist/{agent-session-store-AFML3AXC.js.map → agent-session-store-ODD3IZCW.js.map} +1 -1
- package/dist/agent-session-store-SVEJHSUA.cjs +23 -0
- package/dist/{agent-session-store-MTSIY3MH.cjs.map → agent-session-store-SVEJHSUA.cjs.map} +1 -1
- package/dist/auth/index.cjs +8 -7
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +3 -2
- package/dist/auth/index.js.map +1 -1
- package/dist/{chunk-QCIARBLS.js → chunk-523O5UYB.js} +3 -3
- package/dist/{chunk-QCIARBLS.js.map → chunk-523O5UYB.js.map} +1 -1
- package/dist/chunk-7KIN3L2S.js +103 -0
- package/dist/chunk-7KIN3L2S.js.map +1 -0
- package/dist/chunk-ASK2OQM5.cjs +84 -0
- package/dist/chunk-ASK2OQM5.cjs.map +1 -0
- package/dist/{chunk-56BCEM26.cjs → chunk-CVEQ5366.cjs} +105 -91
- package/dist/chunk-CVEQ5366.cjs.map +1 -0
- package/dist/{chunk-R2C3HXR3.js → chunk-DPY2M74T.js} +3 -3
- package/dist/{chunk-R2C3HXR3.js.map → chunk-DPY2M74T.js.map} +1 -1
- package/dist/chunk-EHD25JBZ.cjs +10 -0
- package/dist/chunk-EHD25JBZ.cjs.map +1 -0
- package/dist/{chunk-NOO6GZTZ.js → chunk-EVH3OUMY.js} +13 -12
- package/dist/chunk-EVH3OUMY.js.map +1 -0
- package/dist/{chunk-5522X223.js → chunk-EXI7EHDN.js} +4 -4
- package/dist/{chunk-5522X223.js.map → chunk-EXI7EHDN.js.map} +1 -1
- package/dist/{chunk-PSLCVSCS.cjs → chunk-FR6COQXZ.cjs} +6 -6
- package/dist/{chunk-PSLCVSCS.cjs.map → chunk-FR6COQXZ.cjs.map} +1 -1
- package/dist/{chunk-JOFVLOFY.js → chunk-FTZTZBCU.js} +12 -4
- package/dist/chunk-FTZTZBCU.js.map +1 -0
- package/dist/{chunk-T5KOSR5Y.cjs → chunk-FYEHYQ7T.cjs} +8 -8
- package/dist/{chunk-T5KOSR5Y.cjs.map → chunk-FYEHYQ7T.cjs.map} +1 -1
- package/dist/{chunk-HOHR75KF.js → chunk-HI3W37FY.js} +4 -3
- package/dist/chunk-HI3W37FY.js.map +1 -0
- package/dist/chunk-HU666T3Q.cjs +1891 -0
- package/dist/chunk-HU666T3Q.cjs.map +1 -0
- package/dist/{chunk-53RDNK3H.js → chunk-I2ORT6QD.js} +3 -3
- package/dist/{chunk-53RDNK3H.js.map → chunk-I2ORT6QD.js.map} +1 -1
- package/dist/{chunk-UNZOJVVC.js → chunk-IZDDSLL2.js} +5 -4
- package/dist/chunk-IZDDSLL2.js.map +1 -0
- package/dist/{chunk-TTBIQTO5.cjs → chunk-L3C6CCBG.cjs} +15 -15
- package/dist/{chunk-TTBIQTO5.cjs.map → chunk-L3C6CCBG.cjs.map} +1 -1
- package/dist/{chunk-B3XXQX6L.cjs → chunk-NQVWSSX2.cjs} +10 -9
- package/dist/chunk-NQVWSSX2.cjs.map +1 -0
- package/dist/{chunk-LL4QA3DI.cjs → chunk-PCLRIQPX.cjs} +4 -4
- package/dist/{chunk-LL4QA3DI.cjs.map → chunk-PCLRIQPX.cjs.map} +1 -1
- package/dist/chunk-Q7GYMXVC.js +8 -0
- package/dist/chunk-Q7GYMXVC.js.map +1 -0
- package/dist/{chunk-ARMFXTY6.cjs → chunk-QY3CIMUV.cjs} +34 -33
- package/dist/chunk-QY3CIMUV.cjs.map +1 -0
- package/dist/chunk-R5YPDAKD.cjs +108 -0
- package/dist/chunk-R5YPDAKD.cjs.map +1 -0
- package/dist/chunk-RGQICWFU.js +82 -0
- package/dist/chunk-RGQICWFU.js.map +1 -0
- package/dist/{chunk-OOM236Z4.js → chunk-RTE2DD4S.js} +32 -18
- package/dist/chunk-RTE2DD4S.js.map +1 -0
- package/dist/chunk-SGC7LSHF.cjs +18 -0
- package/dist/{chunk-R3ZQBPA5.cjs.map → chunk-SGC7LSHF.cjs.map} +1 -1
- package/dist/{chunk-RA7IE4NK.cjs → chunk-SKDNCTXG.cjs} +4 -3
- package/dist/chunk-SKDNCTXG.cjs.map +1 -0
- package/dist/chunk-SVCPJRUB.js +1874 -0
- package/dist/chunk-SVCPJRUB.js.map +1 -0
- package/dist/{chunk-EJROML3Q.js → chunk-TX56N7FR.js} +4 -3
- package/dist/chunk-TX56N7FR.js.map +1 -0
- package/dist/{chunk-QDQQYRJI.js → chunk-W2ZVTEOD.js} +3 -3
- package/dist/{chunk-QDQQYRJI.js.map → chunk-W2ZVTEOD.js.map} +1 -1
- package/dist/{chunk-TC4RWP3Y.js → chunk-X3LOJJMO.js} +89 -29
- package/dist/chunk-X3LOJJMO.js.map +1 -0
- package/dist/{chunk-2WXHA33T.js → chunk-XERM7PDQ.js} +3 -3
- package/dist/{chunk-2WXHA33T.js.map → chunk-XERM7PDQ.js.map} +1 -1
- package/dist/{chunk-MEUBLCM4.cjs → chunk-YEHQ3SIC.cjs} +4 -3
- package/dist/chunk-YEHQ3SIC.cjs.map +1 -0
- package/dist/{chunk-YIFFF23U.cjs → chunk-ZAM7BJXJ.cjs} +5 -5
- package/dist/{chunk-YIFFF23U.cjs.map → chunk-ZAM7BJXJ.cjs.map} +1 -1
- package/dist/{chunk-76PIKR4P.cjs → chunk-ZD66GFH5.cjs} +91 -29
- package/dist/chunk-ZD66GFH5.cjs.map +1 -0
- package/dist/{chunk-GZV6AVRL.cjs → chunk-ZWACQM5U.cjs} +11 -3
- package/dist/chunk-ZWACQM5U.cjs.map +1 -0
- package/dist/{compact-session-RBPLUPCK.cjs → compact-session-4QHBBGEY.cjs} +16 -15
- package/dist/{compact-session-RBPLUPCK.cjs.map → compact-session-4QHBBGEY.cjs.map} +1 -1
- package/dist/{compact-session-2N3ZYJTW.js → compact-session-PVAWTKKL.js} +7 -6
- package/dist/{compact-session-2N3ZYJTW.js.map → compact-session-PVAWTKKL.js.map} +1 -1
- package/dist/{cron-DTuaPMVI.d.ts → cron-BPccQCO8.d.ts} +1 -1
- package/dist/{cron-QTgcwcZt.d.cts → cron-Blj6wMYg.d.cts} +1 -1
- package/dist/cron.cjs +17 -15
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +16 -14
- package/dist/eval.cjs +20 -18
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +16 -14
- package/dist/eval.js.map +1 -1
- package/dist/fs-session-store-3VI4CPTX.js +11 -0
- package/dist/{fs-session-store-STZZFXH2.js.map → fs-session-store-3VI4CPTX.js.map} +1 -1
- package/dist/fs-session-store-IQ6PEHYF.cjs +20 -0
- package/dist/{fs-session-store-JHBJFKVV.cjs.map → fs-session-store-IQ6PEHYF.cjs.map} +1 -1
- package/dist/{index-manager-ONQJSWX5.js → index-manager-JVYIVTZG.js} +6 -5
- package/dist/{index-manager-ONQJSWX5.js.map → index-manager-JVYIVTZG.js.map} +1 -1
- package/dist/{index-manager-ZGJN25FD.cjs → index-manager-YGXRFJMZ.cjs} +7 -6
- package/dist/{index-manager-ZGJN25FD.cjs.map → index-manager-YGXRFJMZ.cjs.map} +1 -1
- package/dist/index.cjs +68 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -6
- package/dist/index.d.ts +42 -6
- package/dist/index.js +31 -23
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-YNNOE3O6.js → inject-session-O24XGRR6.js} +5 -5
- package/dist/{inject-session-YNNOE3O6.js.map → inject-session-O24XGRR6.js.map} +1 -1
- package/dist/{inject-session-3FPXJDJP.cjs → inject-session-OMLFL2V3.cjs} +7 -7
- package/dist/{inject-session-3FPXJDJP.cjs.map → inject-session-OMLFL2V3.cjs.map} +1 -1
- package/dist/internal/memory/adapters/index.cjs +3 -2
- package/dist/internal/memory/adapters/index.js +2 -1
- package/dist/internal/memory/dreaming/phases.d.ts +2 -0
- package/dist/internal/memory/dreaming/run.d.ts +5 -0
- package/dist/internal/memory/sdk-memory-peer-loader.d.ts +2 -0
- package/dist/internal/memory/storage/fact-ceiling.d.cts +19 -0
- package/dist/internal/memory/storage/fact-ceiling.d.ts +19 -0
- package/dist/internal/memory/storage/index.cjs +41 -32
- package/dist/internal/memory/storage/index.d.cts +1 -0
- package/dist/internal/memory/storage/index.d.ts +1 -0
- package/dist/internal/memory/storage/index.js +4 -3
- package/dist/internal/memory/storage/markdown-store.d.cts +3 -1
- package/dist/internal/memory/storage/markdown-store.d.ts +3 -1
- package/dist/internal/memory/types.d.ts +6 -0
- package/dist/internal/persistence/index.cjs +7 -6
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +2 -1
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/persistence/persistence-schema.d.cts +1 -1
- package/dist/internal/persistence/persistence-schema.d.ts +1 -1
- package/dist/internal/providers/catalog-loader.d.ts +30 -3
- package/dist/internal/runtime/registry/agent-registry-store.d.ts +2 -0
- package/dist/internal/runtime-fetch.d.ts +1 -0
- package/dist/models.cjs +12 -11
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +4 -3
- package/dist/models.js.map +1 -1
- package/dist/persistence.cjs +14 -13
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +4 -3
- package/dist/persistence.js.map +1 -1
- package/dist/providers.cjs +6 -5
- package/dist/providers.js +4 -3
- package/dist/{session-transcript-VTBTCGQX.js → session-transcript-AR7IBICT.js} +3 -3
- package/dist/{session-transcript-VTBTCGQX.js.map → session-transcript-AR7IBICT.js.map} +1 -1
- package/dist/{session-transcript-LGHSNVY5.cjs → session-transcript-RACG7BK2.cjs} +16 -16
- package/dist/{session-transcript-LGHSNVY5.cjs.map → session-transcript-RACG7BK2.cjs.map} +1 -1
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/subscription/index.cjs +2 -1
- package/dist/subscription/index.cjs.map +1 -1
- package/dist/subscription/index.js +2 -1
- package/dist/subscription/index.js.map +1 -1
- package/dist/types/agent.d.ts +27 -0
- package/docs/error-codes.md +40 -38
- package/docs/harness-capability-map.md +6 -1
- package/package.json +2 -2
- package/dist/agent-session-store-AFML3AXC.js +0 -6
- package/dist/agent-session-store-MTSIY3MH.cjs +0 -23
- package/dist/chunk-56BCEM26.cjs.map +0 -1
- package/dist/chunk-76PIKR4P.cjs.map +0 -1
- package/dist/chunk-ARMFXTY6.cjs.map +0 -1
- package/dist/chunk-B3XXQX6L.cjs.map +0 -1
- package/dist/chunk-BKMDRBJ7.js +0 -180
- package/dist/chunk-BKMDRBJ7.js.map +0 -1
- package/dist/chunk-EJROML3Q.js.map +0 -1
- package/dist/chunk-GZV6AVRL.cjs.map +0 -1
- package/dist/chunk-HOHR75KF.js.map +0 -1
- package/dist/chunk-JOFVLOFY.js.map +0 -1
- package/dist/chunk-MEUBLCM4.cjs.map +0 -1
- package/dist/chunk-MFZODA5Y.js +0 -583
- package/dist/chunk-MFZODA5Y.js.map +0 -1
- package/dist/chunk-NOO6GZTZ.js.map +0 -1
- package/dist/chunk-OF2CLCTH.cjs +0 -186
- package/dist/chunk-OF2CLCTH.cjs.map +0 -1
- package/dist/chunk-OOM236Z4.js.map +0 -1
- package/dist/chunk-R3ZQBPA5.cjs +0 -18
- package/dist/chunk-RA7IE4NK.cjs.map +0 -1
- package/dist/chunk-TC4RWP3Y.js.map +0 -1
- package/dist/chunk-UNZOJVVC.js.map +0 -1
- package/dist/chunk-YRJA2POB.cjs +0 -601
- package/dist/chunk-YRJA2POB.cjs.map +0 -1
- package/dist/fs-session-store-JHBJFKVV.cjs +0 -19
- package/dist/fs-session-store-STZZFXH2.js +0 -10
- package/dist/provider-catalog.json +0 -1295
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkJ6GXS5A2_cjs = require('./chunk-J6GXS5A2.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkFR6COQXZ_cjs = require('./chunk-FR6COQXZ.cjs');
|
|
5
|
+
var chunkL3C6CCBG_cjs = require('./chunk-L3C6CCBG.cjs');
|
|
6
6
|
var chunkKIKKTW5O_cjs = require('./chunk-KIKKTW5O.cjs');
|
|
7
7
|
var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunkYEHQ3SIC_cjs = require('./chunk-YEHQ3SIC.cjs');
|
|
9
9
|
var chunkTMKTSYDS_cjs = require('./chunk-TMKTSYDS.cjs');
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
10
|
+
var chunkZD66GFH5_cjs = require('./chunk-ZD66GFH5.cjs');
|
|
11
|
+
var chunkNQVWSSX2_cjs = require('./chunk-NQVWSSX2.cjs');
|
|
12
|
+
var chunkQY3CIMUV_cjs = require('./chunk-QY3CIMUV.cjs');
|
|
13
13
|
var chunk2ZPEDVLM_cjs = require('./chunk-2ZPEDVLM.cjs');
|
|
14
14
|
var chunkXKZFIP7Z_cjs = require('./chunk-XKZFIP7Z.cjs');
|
|
15
15
|
var chunkN6OEX5TN_cjs = require('./chunk-N6OEX5TN.cjs');
|
|
@@ -23,8 +23,8 @@ var chunkIJ7M6GOG_cjs = require('./chunk-IJ7M6GOG.cjs');
|
|
|
23
23
|
var chunkGM54F4FE_cjs = require('./chunk-GM54F4FE.cjs');
|
|
24
24
|
var chunkSA6K24NB_cjs = require('./chunk-SA6K24NB.cjs');
|
|
25
25
|
var chunkIIYJMXYW_cjs = require('./chunk-IIYJMXYW.cjs');
|
|
26
|
-
var
|
|
27
|
-
var
|
|
26
|
+
var chunkZWACQM5U_cjs = require('./chunk-ZWACQM5U.cjs');
|
|
27
|
+
var chunkASK2OQM5_cjs = require('./chunk-ASK2OQM5.cjs');
|
|
28
28
|
var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
|
|
29
29
|
var chunkJLRLCBJ4_cjs = require('./chunk-JLRLCBJ4.cjs');
|
|
30
30
|
var chunkC7GKRGKN_cjs = require('./chunk-C7GKRGKN.cjs');
|
|
@@ -32,9 +32,10 @@ var chunkTY56BKSK_cjs = require('./chunk-TY56BKSK.cjs');
|
|
|
32
32
|
var chunkMPR2ISL2_cjs = require('./chunk-MPR2ISL2.cjs');
|
|
33
33
|
var chunkJ5623RIV_cjs = require('./chunk-J5623RIV.cjs');
|
|
34
34
|
var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
|
|
35
|
-
var
|
|
36
|
-
var
|
|
35
|
+
var chunkSGC7LSHF_cjs = require('./chunk-SGC7LSHF.cjs');
|
|
36
|
+
var chunkHU666T3Q_cjs = require('./chunk-HU666T3Q.cjs');
|
|
37
37
|
var chunkNVXXWAU7_cjs = require('./chunk-NVXXWAU7.cjs');
|
|
38
|
+
var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
|
|
38
39
|
var chunkUNFBHV46_cjs = require('./chunk-UNFBHV46.cjs');
|
|
39
40
|
var chunk6LHQPOMI_cjs = require('./chunk-6LHQPOMI.cjs');
|
|
40
41
|
var promises = require('fs/promises');
|
|
@@ -337,6 +338,8 @@ function serializeMemory(memory) {
|
|
|
337
338
|
if (memory.scope !== void 0) out.scope = memory.scope;
|
|
338
339
|
if (memory.activeRecall !== void 0) out.activeRecall = { ...memory.activeRecall };
|
|
339
340
|
if (memory.index !== void 0) out.index = serializeMemoryIndex(memory.index);
|
|
341
|
+
if (memory.maxFacts !== void 0) out.maxFacts = memory.maxFacts;
|
|
342
|
+
if (memory.directory !== void 0) out.directory = memory.directory;
|
|
340
343
|
return out;
|
|
341
344
|
}
|
|
342
345
|
function serializeMemoryIndex(index) {
|
|
@@ -820,7 +823,7 @@ async function readLegacyFacts(jsonPath) {
|
|
|
820
823
|
}
|
|
821
824
|
async function writeMigratedFacts(cwd, jsonPath, facts) {
|
|
822
825
|
try {
|
|
823
|
-
for (const fact of facts) await
|
|
826
|
+
for (const fact of facts) await chunkZD66GFH5_cjs.appendFactToMarkdown(cwd, fact);
|
|
824
827
|
await promises.unlink(jsonPath).catch(() => void 0);
|
|
825
828
|
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
|
|
826
829
|
`);
|
|
@@ -837,11 +840,11 @@ async function migrateLegacyJson(cwd, config) {
|
|
|
837
840
|
const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
|
|
838
841
|
if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
|
|
839
842
|
migrationRun.add(key);
|
|
840
|
-
const jsonPath =
|
|
843
|
+
const jsonPath = chunkZD66GFH5_cjs.legacyMemoryJsonPath(cwd, config);
|
|
841
844
|
if (!await fileExists(jsonPath)) {
|
|
842
845
|
return { migrated: false, factCount: 0, reason: "no-legacy-json" };
|
|
843
846
|
}
|
|
844
|
-
if (await fileExists(
|
|
847
|
+
if (await fileExists(chunkZD66GFH5_cjs.memoryMdPath(chunkZD66GFH5_cjs.resolveMemoryRoot(cwd, config)))) {
|
|
845
848
|
chunk6LHQPOMI_cjs.diag(
|
|
846
849
|
`[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
|
|
847
850
|
`
|
|
@@ -870,28 +873,29 @@ function unstoredRememberWarning(message) {
|
|
|
870
873
|
if (isMemoryWritePrompt(message) && extractMemoryFact(message).length > 0) return void 0;
|
|
871
874
|
const trimmed = message.trim();
|
|
872
875
|
const quoted = trimmed.length > QUOTED_MESSAGE_MAX ? `${trimmed.slice(0, QUOTED_MESSAGE_MAX)}\u2026` : trimmed;
|
|
873
|
-
return `[theokit-sdk] NOTHING WAS STORED \u2014 this message does not match the memory capture pattern: ${JSON.stringify(quoted)}. Supported: "Remember: <fact>" or "Remember (${
|
|
876
|
+
return `[theokit-sdk] NOTHING WAS STORED \u2014 this message does not match the memory capture pattern: ${JSON.stringify(quoted)}. Supported: "Remember: <fact>" or "Remember (${chunkZD66GFH5_cjs.MEMORY_KINDS.join("|")}): <fact>". It still reaches the session transcript, so a follow-up may answer from it \u2014 that is search over transcripts, not a durable memory.`;
|
|
874
877
|
}
|
|
875
878
|
function extractMemoryKind(message) {
|
|
876
879
|
const match = REMEMBER_PATTERN.exec(message);
|
|
877
880
|
const declared = match?.[1];
|
|
878
881
|
if (declared === void 0) return void 0;
|
|
879
882
|
const lowered = declared.toLowerCase();
|
|
880
|
-
return
|
|
883
|
+
return chunkZD66GFH5_cjs.MEMORY_KINDS.includes(lowered) ? lowered : void 0;
|
|
881
884
|
}
|
|
882
885
|
async function readMemoryFacts(cwd, config) {
|
|
883
886
|
if (!config.enabled) return [];
|
|
884
887
|
await migrateLegacyJson(cwd, config);
|
|
885
|
-
return
|
|
888
|
+
return chunkZD66GFH5_cjs.readFacts(cwd, config);
|
|
886
889
|
}
|
|
887
890
|
async function appendMemoryFact(cwd, config, fact) {
|
|
888
891
|
if (!config.enabled) return;
|
|
892
|
+
chunkZD66GFH5_cjs.resolveMaxFacts(config.maxFacts);
|
|
889
893
|
await migrateLegacyJson(cwd, config);
|
|
890
894
|
const sanitized = {
|
|
891
895
|
text: chunk6LHQPOMI_cjs.redactSecrets(fact.text),
|
|
892
896
|
...fact.kind === void 0 ? {} : { kind: fact.kind }
|
|
893
897
|
};
|
|
894
|
-
await
|
|
898
|
+
await chunkZD66GFH5_cjs.appendFact(cwd, config, sanitized);
|
|
895
899
|
}
|
|
896
900
|
|
|
897
901
|
// src/internal/runtime/fixtures/fixture-scripts.ts
|
|
@@ -1562,7 +1566,7 @@ function createRealCloudRun(options) {
|
|
|
1562
1566
|
conversation: []
|
|
1563
1567
|
};
|
|
1564
1568
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(options.agentOptions.apiKey);
|
|
1565
|
-
const baseUrl =
|
|
1569
|
+
const baseUrl = chunkQY3CIMUV_cjs.getConfiguredBaseUrl();
|
|
1566
1570
|
const handle = new RealCloudRun(
|
|
1567
1571
|
{
|
|
1568
1572
|
id,
|
|
@@ -1576,7 +1580,7 @@ function createRealCloudRun(options) {
|
|
|
1576
1580
|
apiKey,
|
|
1577
1581
|
baseUrl,
|
|
1578
1582
|
userText,
|
|
1579
|
-
fetchImpl: options.fetch
|
|
1583
|
+
fetchImpl: chunkEHD25JBZ_cjs.boundFetch(options.fetch),
|
|
1580
1584
|
sendOptions: options.sendOptions,
|
|
1581
1585
|
systemPrompt: options.systemPrompt,
|
|
1582
1586
|
agentConfig: options.agentConfig
|
|
@@ -1645,7 +1649,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1645
1649
|
async consumeStream(response) {
|
|
1646
1650
|
let finalStatus = "finished";
|
|
1647
1651
|
let finalText = "";
|
|
1648
|
-
for await (const record of
|
|
1652
|
+
for await (const record of chunkQY3CIMUV_cjs.parseSseStream(response.body, this.controller.signal)) {
|
|
1649
1653
|
const parsed = safeParse(record.data);
|
|
1650
1654
|
if (parsed === void 0) continue;
|
|
1651
1655
|
const update = this.applyRecord(record.event, parsed);
|
|
@@ -1812,7 +1816,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1812
1816
|
*/
|
|
1813
1817
|
isFixtureMode() {
|
|
1814
1818
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(this.options.apiKey);
|
|
1815
|
-
return
|
|
1819
|
+
return chunkQY3CIMUV_cjs.isFixtureApiKey(apiKey) && chunkQY3CIMUV_cjs.getConfiguredBaseUrl() === void 0;
|
|
1816
1820
|
}
|
|
1817
1821
|
// SE9 — integrated structured output; delegates to the shared helper.
|
|
1818
1822
|
generate(message, options) {
|
|
@@ -1864,7 +1868,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1864
1868
|
const userText = typeof message === "string" ? message : message.text;
|
|
1865
1869
|
const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
|
|
1866
1870
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(this.options.apiKey);
|
|
1867
|
-
const useRealRuntime = apiKey !== void 0 && !
|
|
1871
|
+
const useRealRuntime = apiKey !== void 0 && !chunkQY3CIMUV_cjs.isFixtureApiKey(apiKey) && chunkQY3CIMUV_cjs.getConfiguredBaseUrl() !== void 0;
|
|
1868
1872
|
return useRealRuntime ? createRealCloudRun({
|
|
1869
1873
|
agentId: this.agentId,
|
|
1870
1874
|
model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
|
|
@@ -2089,15 +2093,15 @@ function resolveSessionDir(local) {
|
|
|
2089
2093
|
"[theokit-sdk] local.sessionDir and local.baseDir are both set; using sessionDir. baseDir is the deprecated name for the same option (#301)."
|
|
2090
2094
|
);
|
|
2091
2095
|
}
|
|
2092
|
-
return
|
|
2096
|
+
return chunkZWACQM5U_cjs.expandTilde(local.sessionDir);
|
|
2093
2097
|
}
|
|
2094
2098
|
if (local?.baseDir !== void 0) {
|
|
2095
2099
|
chunk6LHQPOMI_cjs.diag(
|
|
2096
2100
|
"[theokit-sdk] local.baseDir is deprecated; rename it to local.sessionDir (#301). It is the directory for session transcripts, not the working directory \u2014 that is local.cwd."
|
|
2097
2101
|
);
|
|
2098
|
-
return
|
|
2102
|
+
return chunkZWACQM5U_cjs.expandTilde(local.baseDir);
|
|
2099
2103
|
}
|
|
2100
|
-
return
|
|
2104
|
+
return chunkZWACQM5U_cjs.defaultBaseDir();
|
|
2101
2105
|
}
|
|
2102
2106
|
var SCHEMA_VERSION2 = 1;
|
|
2103
2107
|
var FILE_NAME = "personality.json";
|
|
@@ -2198,7 +2202,7 @@ var PersonalityStore = class {
|
|
|
2198
2202
|
async #persist(agentId, slug) {
|
|
2199
2203
|
const filePath = this.#filePath();
|
|
2200
2204
|
await promises.mkdir(path.dirname(filePath), { recursive: true });
|
|
2201
|
-
await
|
|
2205
|
+
await chunkASK2OQM5_cjs.withFileLock(filePath, async () => {
|
|
2202
2206
|
const current = await readState(filePath);
|
|
2203
2207
|
const nextAgents = { ...current.agents };
|
|
2204
2208
|
if (slug === void 0) delete nextAgents[agentId];
|
|
@@ -2904,7 +2908,7 @@ function resolveWindowForRun(model, contextWindow) {
|
|
|
2904
2908
|
const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
|
|
2905
2909
|
return chunkJ5623RIV_cjs.resolveEffectiveContextWindow({
|
|
2906
2910
|
...override !== void 0 ? { override } : {},
|
|
2907
|
-
catalog:
|
|
2911
|
+
catalog: chunkHU666T3Q_cjs.getCatalogModelInfo(model)?.limit?.context,
|
|
2908
2912
|
margin: chunkJ5623RIV_cjs.CONTEXT_WINDOW_MARGIN,
|
|
2909
2913
|
floor: chunkJ5623RIV_cjs.CONTEXT_WINDOW_FLOOR
|
|
2910
2914
|
});
|
|
@@ -2929,7 +2933,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2929
2933
|
try {
|
|
2930
2934
|
const partial = await safeConversation(run);
|
|
2931
2935
|
if (partial !== void 0) {
|
|
2932
|
-
|
|
2936
|
+
chunkFR6COQXZ_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
|
|
2933
2937
|
userText,
|
|
2934
2938
|
conversation: partial
|
|
2935
2939
|
});
|
|
@@ -2939,11 +2943,11 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2939
2943
|
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
|
|
2940
2944
|
`);
|
|
2941
2945
|
}
|
|
2942
|
-
await
|
|
2946
|
+
await chunkFR6COQXZ_cjs.flushSessionWrites();
|
|
2943
2947
|
return;
|
|
2944
2948
|
}
|
|
2945
2949
|
if (result.result !== void 0) {
|
|
2946
|
-
|
|
2950
|
+
chunkFR6COQXZ_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
|
|
2947
2951
|
}
|
|
2948
2952
|
const conversation = await safeConversation(run);
|
|
2949
2953
|
const resolvedWindow = resolveWindowForRun(model, contextWindow);
|
|
@@ -2954,7 +2958,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2954
2958
|
}
|
|
2955
2959
|
const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
|
|
2956
2960
|
const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
|
|
2957
|
-
|
|
2961
|
+
chunkFR6COQXZ_cjs.persistTurnToTranscript(
|
|
2958
2962
|
sessionStore,
|
|
2959
2963
|
{ cwd: workspaceCwd, agentId, model },
|
|
2960
2964
|
agentId,
|
|
@@ -2966,7 +2970,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2966
2970
|
// The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
|
|
2967
2971
|
// `contextWindow` here would budget against a number the clamp already rejected.
|
|
2968
2972
|
contextWindow: effectiveWindow,
|
|
2969
|
-
summarize:
|
|
2973
|
+
summarize: chunkQY3CIMUV_cjs.buildDefaultSummarizer({
|
|
2970
2974
|
agentModel: model,
|
|
2971
2975
|
...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
|
|
2972
2976
|
})
|
|
@@ -2979,7 +2983,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2979
2983
|
cwd: workspaceCwd,
|
|
2980
2984
|
// Resolved once, here, and handed to both writers. Recomputing it inside either one is how
|
|
2981
2985
|
// the summary ended up in a directory the indexer never scanned (#463).
|
|
2982
|
-
memoryRoot:
|
|
2986
|
+
memoryRoot: chunkZD66GFH5_cjs.resolveMemoryRoot(workspaceCwd, inputs.memory),
|
|
2983
2987
|
runId: result.id,
|
|
2984
2988
|
agentId,
|
|
2985
2989
|
userText,
|
|
@@ -2991,7 +2995,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2991
2995
|
if (memoryProvider?.recordSessionSummary !== void 0) {
|
|
2992
2996
|
await memoryProvider.recordSessionSummary(summaryArgs);
|
|
2993
2997
|
} else {
|
|
2994
|
-
await
|
|
2998
|
+
await chunkZD66GFH5_cjs.writeSessionSummary(summaryArgs);
|
|
2995
2999
|
}
|
|
2996
3000
|
} catch (cause) {
|
|
2997
3001
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
@@ -3008,7 +3012,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
3008
3012
|
agentId,
|
|
3009
3013
|
runId: result.id
|
|
3010
3014
|
});
|
|
3011
|
-
await
|
|
3015
|
+
await chunkFR6COQXZ_cjs.flushSessionWrites();
|
|
3012
3016
|
}
|
|
3013
3017
|
async function safeConversation(run) {
|
|
3014
3018
|
try {
|
|
@@ -3613,6 +3617,7 @@ function validateToolSchema(tool) {
|
|
|
3613
3617
|
}
|
|
3614
3618
|
function validateMemory(options) {
|
|
3615
3619
|
const memory = options.memory;
|
|
3620
|
+
chunkZD66GFH5_cjs.resolveMaxFacts(memory?.maxFacts);
|
|
3616
3621
|
if (memory?.storePath === void 0) return;
|
|
3617
3622
|
const storePath = memory.storePath;
|
|
3618
3623
|
if (storePath.includes("..") || storePath.startsWith("/") || /^[A-Z]:/i.test(storePath)) {
|
|
@@ -3638,7 +3643,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3638
3643
|
};
|
|
3639
3644
|
function safeRequire(moduleName) {
|
|
3640
3645
|
try {
|
|
3641
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3646
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-CVEQ5366.cjs', document.baseURI).href)));
|
|
3642
3647
|
return r(moduleName);
|
|
3643
3648
|
} catch {
|
|
3644
3649
|
return void 0;
|
|
@@ -3881,7 +3886,7 @@ var cachedOtel;
|
|
|
3881
3886
|
function loadOtel() {
|
|
3882
3887
|
if (cachedOtel === void 0) {
|
|
3883
3888
|
try {
|
|
3884
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3889
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-CVEQ5366.cjs', document.baseURI).href)));
|
|
3885
3890
|
const mod = r("@opentelemetry/api");
|
|
3886
3891
|
cachedOtel = mod;
|
|
3887
3892
|
} catch {
|
|
@@ -5584,7 +5589,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
5584
5589
|
const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
|
|
5585
5590
|
if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
|
|
5586
5591
|
for (const key of candidates) {
|
|
5587
|
-
const info =
|
|
5592
|
+
const info = chunkHU666T3Q_cjs.getCatalogModelInfo(key);
|
|
5588
5593
|
const cost = info?.cost;
|
|
5589
5594
|
if (cost === void 0) continue;
|
|
5590
5595
|
const [prov, ...modelParts] = key.split("/");
|
|
@@ -5596,7 +5601,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
5596
5601
|
...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
|
|
5597
5602
|
...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
|
|
5598
5603
|
// M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
|
|
5599
|
-
pricingVersion:
|
|
5604
|
+
pricingVersion: chunkHU666T3Q_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
|
|
5600
5605
|
};
|
|
5601
5606
|
}
|
|
5602
5607
|
return void 0;
|
|
@@ -6649,7 +6654,7 @@ function applyToolResultGuard(parts, opts) {
|
|
|
6649
6654
|
(p) => (
|
|
6650
6655
|
// SE7 — guard the TEXT of a tool result (string or the text blocks of a
|
|
6651
6656
|
// structured content); image blocks pass through untouched.
|
|
6652
|
-
p.type === "tool_result" ? { ...p, content:
|
|
6657
|
+
p.type === "tool_result" ? { ...p, content: chunkQY3CIMUV_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
|
|
6653
6658
|
)
|
|
6654
6659
|
);
|
|
6655
6660
|
}
|
|
@@ -6941,13 +6946,13 @@ var FallbackLlmClient = class {
|
|
|
6941
6946
|
async *stream(request, signal) {
|
|
6942
6947
|
let lastError;
|
|
6943
6948
|
for (const client of this.clients) {
|
|
6944
|
-
if (signal.aborted) throw
|
|
6945
|
-
const attempt = await
|
|
6949
|
+
if (signal.aborted) throw chunkQY3CIMUV_cjs.abortError(signal);
|
|
6950
|
+
const attempt = await chunkQY3CIMUV_cjs.tryFirstEvent(client, request, signal, true);
|
|
6946
6951
|
if (attempt.kind === "handshake_error") {
|
|
6947
6952
|
lastError = attempt.error;
|
|
6948
6953
|
continue;
|
|
6949
6954
|
}
|
|
6950
|
-
return yield*
|
|
6955
|
+
return yield* chunkQY3CIMUV_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
6951
6956
|
}
|
|
6952
6957
|
if (lastError !== void 0) throw lastError;
|
|
6953
6958
|
throw new chunkUNFBHV46_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
@@ -7583,9 +7588,9 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7583
7588
|
{ code: "invalid_max_iterations" }
|
|
7584
7589
|
);
|
|
7585
7590
|
}
|
|
7586
|
-
const { primary, effectiveModelId } =
|
|
7591
|
+
const { primary, effectiveModelId } = chunkQY3CIMUV_cjs.resolveRunProvider(options);
|
|
7587
7592
|
const fallback = options.agentOptions.providers?.fallback;
|
|
7588
|
-
const apiKeys =
|
|
7593
|
+
const apiKeys = chunkQY3CIMUV_cjs.mergeExplicitApiKey(
|
|
7589
7594
|
options.agentOptions.providers?.apiKeys,
|
|
7590
7595
|
primary,
|
|
7591
7596
|
options.agentOptions.apiKey
|
|
@@ -7594,7 +7599,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7594
7599
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
7595
7600
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
7596
7601
|
const modelBaseUrl = options.model?.url;
|
|
7597
|
-
const chain =
|
|
7602
|
+
const chain = chunkQY3CIMUV_cjs.resolveProviderChain({
|
|
7598
7603
|
primary,
|
|
7599
7604
|
...modelBaseUrl !== void 0 ? { baseUrl: modelBaseUrl } : {},
|
|
7600
7605
|
...fallback !== void 0 ? { fallback } : {},
|
|
@@ -7854,7 +7859,7 @@ function buildRealRunOptions(args) {
|
|
|
7854
7859
|
};
|
|
7855
7860
|
}
|
|
7856
7861
|
async function createFixtureRunHelper(args) {
|
|
7857
|
-
const sessionMessages =
|
|
7862
|
+
const sessionMessages = chunkFR6COQXZ_cjs.getSessionMessages(args.inputs.agentId);
|
|
7858
7863
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
7859
7864
|
return createLocalRun({
|
|
7860
7865
|
agentId: args.inputs.agentId,
|
|
@@ -7873,7 +7878,7 @@ async function createFixtureRunHelper(args) {
|
|
|
7873
7878
|
}
|
|
7874
7879
|
async function dispatchLocalRun(args) {
|
|
7875
7880
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(args.inputs.options.apiKey);
|
|
7876
|
-
if (
|
|
7881
|
+
if (chunkQY3CIMUV_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
7877
7882
|
return createRealLocalRun(
|
|
7878
7883
|
buildRealRunOptions({
|
|
7879
7884
|
inputs: args.inputs,
|
|
@@ -8129,10 +8134,10 @@ async function disposeLocalAgentSession(agent) {
|
|
|
8129
8134
|
agent.lifecycleAbortController.abort();
|
|
8130
8135
|
await chunkZF2LDKQQ_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
|
|
8131
8136
|
disposeSessionMcpClients(agent.agentId);
|
|
8132
|
-
await
|
|
8137
|
+
await chunkFR6COQXZ_cjs.flushSessionWrites();
|
|
8133
8138
|
await flushRegistrySaves(agent.workspaceCwd);
|
|
8134
8139
|
await disposeSessionStore(agent.sessionStore);
|
|
8135
|
-
|
|
8140
|
+
chunkFR6COQXZ_cjs.discardSession(agent.workspaceCwd, agent.agentId);
|
|
8136
8141
|
}
|
|
8137
8142
|
async function reloadLocalAgent(agent) {
|
|
8138
8143
|
if (agent.context !== void 0) await agent.context.refresh();
|
|
@@ -8384,7 +8389,7 @@ async function finalize(args, queryMode, result) {
|
|
|
8384
8389
|
};
|
|
8385
8390
|
args.cache?.set(args.userText, queryMode, result, tenantCtx);
|
|
8386
8391
|
if (args.persistTranscripts === true && args.cwd !== void 0) {
|
|
8387
|
-
await chunkTMKTSYDS_cjs.persistActiveMemoryTranscript(args.memoryRoot ??
|
|
8392
|
+
await chunkTMKTSYDS_cjs.persistActiveMemoryTranscript(args.memoryRoot ?? chunkZD66GFH5_cjs.resolveMemoryRoot(args.cwd), {
|
|
8388
8393
|
runId: args.runId ?? `run-${Date.now()}`,
|
|
8389
8394
|
startedAtMs: Date.now() - result.durationMs,
|
|
8390
8395
|
userText: args.userText,
|
|
@@ -8487,7 +8492,7 @@ var openAiMemoryEmbeddingProviderAdapter = {
|
|
|
8487
8492
|
transport: "remote",
|
|
8488
8493
|
authProviderId: "openai",
|
|
8489
8494
|
autoSelectPriority: 20,
|
|
8490
|
-
create: (options) =>
|
|
8495
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8491
8496
|
{
|
|
8492
8497
|
id: "openai",
|
|
8493
8498
|
defaultBaseUrl: "https://api.openai.com",
|
|
@@ -8509,7 +8514,7 @@ var azureOpenAiMemoryEmbeddingProviderAdapter = {
|
|
|
8509
8514
|
transport: "remote",
|
|
8510
8515
|
authProviderId: "azure-openai",
|
|
8511
8516
|
autoSelectPriority: 25,
|
|
8512
|
-
create: (options) =>
|
|
8517
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8513
8518
|
{
|
|
8514
8519
|
id: "azure-openai",
|
|
8515
8520
|
defaultBaseUrl: "https://your-resource.openai.azure.com",
|
|
@@ -8545,7 +8550,7 @@ var cohereMemoryEmbeddingProviderAdapter = {
|
|
|
8545
8550
|
transport: "remote",
|
|
8546
8551
|
authProviderId: "cohere",
|
|
8547
8552
|
autoSelectPriority: 30,
|
|
8548
|
-
create: (options) =>
|
|
8553
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8549
8554
|
{
|
|
8550
8555
|
id: "cohere",
|
|
8551
8556
|
defaultBaseUrl: "https://api.cohere.com",
|
|
@@ -8591,7 +8596,7 @@ var deepinfraMemoryEmbeddingProviderAdapter = {
|
|
|
8591
8596
|
transport: "remote",
|
|
8592
8597
|
authProviderId: "deepinfra",
|
|
8593
8598
|
autoSelectPriority: 13,
|
|
8594
|
-
create: (options) =>
|
|
8599
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8595
8600
|
{
|
|
8596
8601
|
id: "deepinfra",
|
|
8597
8602
|
defaultBaseUrl: "https://api.deepinfra.com",
|
|
@@ -8617,7 +8622,7 @@ var geminiMemoryEmbeddingProviderAdapter = {
|
|
|
8617
8622
|
transport: "remote",
|
|
8618
8623
|
authProviderId: "gemini",
|
|
8619
8624
|
autoSelectPriority: 30,
|
|
8620
|
-
create: (options) =>
|
|
8625
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8621
8626
|
{
|
|
8622
8627
|
id: "gemini",
|
|
8623
8628
|
defaultBaseUrl: "https://generativelanguage.googleapis.com",
|
|
@@ -8645,7 +8650,7 @@ var jinaMemoryEmbeddingProviderAdapter = {
|
|
|
8645
8650
|
transport: "remote",
|
|
8646
8651
|
authProviderId: "jina",
|
|
8647
8652
|
autoSelectPriority: 35,
|
|
8648
|
-
create: (options) =>
|
|
8653
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8649
8654
|
{
|
|
8650
8655
|
id: "jina",
|
|
8651
8656
|
defaultBaseUrl: "https://api.jina.ai",
|
|
@@ -8668,7 +8673,7 @@ var mistralMemoryEmbeddingProviderAdapter = {
|
|
|
8668
8673
|
transport: "remote",
|
|
8669
8674
|
authProviderId: "mistral",
|
|
8670
8675
|
autoSelectPriority: 18,
|
|
8671
|
-
create: (options) =>
|
|
8676
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8672
8677
|
{
|
|
8673
8678
|
id: "mistral",
|
|
8674
8679
|
defaultBaseUrl: "https://api.mistral.ai",
|
|
@@ -8710,7 +8715,7 @@ var ollamaMemoryEmbeddingProviderAdapter = {
|
|
|
8710
8715
|
autoSelectPriority: 10,
|
|
8711
8716
|
create: (options) => {
|
|
8712
8717
|
const apiKey = options.apiKey ?? process.env.OLLAMA_API_KEY ?? OLLAMA_LOCAL_SENTINEL_KEY;
|
|
8713
|
-
return
|
|
8718
|
+
return chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8714
8719
|
{
|
|
8715
8720
|
id: "ollama",
|
|
8716
8721
|
defaultBaseUrl: "http://localhost:11434",
|
|
@@ -8738,7 +8743,7 @@ var openRouterMemoryEmbeddingProviderAdapter = {
|
|
|
8738
8743
|
transport: "remote",
|
|
8739
8744
|
authProviderId: "openrouter",
|
|
8740
8745
|
autoSelectPriority: 15,
|
|
8741
|
-
create: (options) =>
|
|
8746
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8742
8747
|
{
|
|
8743
8748
|
id: "openrouter",
|
|
8744
8749
|
defaultBaseUrl: "https://openrouter.ai/api",
|
|
@@ -8766,7 +8771,7 @@ var voyageMemoryEmbeddingProviderAdapter = {
|
|
|
8766
8771
|
transport: "remote",
|
|
8767
8772
|
authProviderId: "voyage",
|
|
8768
8773
|
autoSelectPriority: 14,
|
|
8769
|
-
create: (options) =>
|
|
8774
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8770
8775
|
{
|
|
8771
8776
|
id: "voyage",
|
|
8772
8777
|
defaultBaseUrl: "https://api.voyageai.com",
|
|
@@ -8975,7 +8980,7 @@ var LocalAgentMemory = class {
|
|
|
8975
8980
|
const openOpts = { cwd: this.workspaceCwd, memoryRoot };
|
|
8976
8981
|
if (embedding !== void 0) openOpts.embedding = embedding;
|
|
8977
8982
|
if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
|
|
8978
|
-
this.index = await
|
|
8983
|
+
this.index = await chunkL3C6CCBG_cjs.IndexManager.open(openOpts);
|
|
8979
8984
|
await this.index.sync();
|
|
8980
8985
|
this.toolsCache = [
|
|
8981
8986
|
createMemorySearchTool({ index: this.index }),
|
|
@@ -8996,7 +9001,7 @@ var LocalAgentMemory = class {
|
|
|
8996
9001
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
8997
9002
|
const cfg = this.options.memory?.activeRecall;
|
|
8998
9003
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
8999
|
-
if (this.breaker === void 0) this.breaker = new
|
|
9004
|
+
if (this.breaker === void 0) this.breaker = new chunkQY3CIMUV_cjs.CircuitBreaker();
|
|
9000
9005
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
9001
9006
|
const result = await runActiveMemory({
|
|
9002
9007
|
userText,
|
|
@@ -9019,7 +9024,7 @@ var LocalAgentMemory = class {
|
|
|
9019
9024
|
* and the active-memory transcript writer. Three separate resolutions is how they drifted (#463).
|
|
9020
9025
|
*/
|
|
9021
9026
|
memoryRoot() {
|
|
9022
|
-
this.memoryRootCache ??=
|
|
9027
|
+
this.memoryRootCache ??= chunkZD66GFH5_cjs.resolveMemoryRoot(this.workspaceCwd, this.options.memory);
|
|
9023
9028
|
return this.memoryRootCache;
|
|
9024
9029
|
}
|
|
9025
9030
|
buildActiveMemoryOptions(cfg) {
|
|
@@ -9134,7 +9139,7 @@ function createLocalAgentMemoryProvider(opts) {
|
|
|
9134
9139
|
return { facts: [], systemPromptAdditions: summary };
|
|
9135
9140
|
},
|
|
9136
9141
|
async recordSessionSummary(args) {
|
|
9137
|
-
await
|
|
9142
|
+
await chunkZD66GFH5_cjs.writeSessionSummary(args);
|
|
9138
9143
|
},
|
|
9139
9144
|
async sync(handle) {
|
|
9140
9145
|
const state = handle[INTERNAL_LAM_KEY];
|
|
@@ -9311,8 +9316,8 @@ async function localAgentUsePersonality(agent, name, opts) {
|
|
|
9311
9316
|
registry,
|
|
9312
9317
|
store: agent.personalityStore,
|
|
9313
9318
|
invalidateCache: (reason) => agent.invalidateCache(reason),
|
|
9314
|
-
appendSessionMessage: (msg) =>
|
|
9315
|
-
clearSession: () =>
|
|
9319
|
+
appendSessionMessage: (msg) => chunkFR6COQXZ_cjs.appendSessionMessage(agent.agentId, msg),
|
|
9320
|
+
clearSession: () => chunkFR6COQXZ_cjs.clearSession(agent.agentId),
|
|
9316
9321
|
opts: opts ?? {}
|
|
9317
9322
|
})
|
|
9318
9323
|
);
|
|
@@ -9866,7 +9871,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9866
9871
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
9867
9872
|
await inputs.options.onBeforeSend({
|
|
9868
9873
|
conversationId: inputs.agentId,
|
|
9869
|
-
previousMessageCount:
|
|
9874
|
+
previousMessageCount: chunkFR6COQXZ_cjs.getSessionMessages(inputs.agentId).length
|
|
9870
9875
|
});
|
|
9871
9876
|
}
|
|
9872
9877
|
await inputs.runPreHook(userText);
|
|
@@ -9878,8 +9883,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9878
9883
|
userText,
|
|
9879
9884
|
sendOptions: options
|
|
9880
9885
|
});
|
|
9881
|
-
const priorMessages = [...
|
|
9882
|
-
|
|
9886
|
+
const priorMessages = [...chunkFR6COQXZ_cjs.getSessionMessages(inputs.agentId)];
|
|
9887
|
+
chunkFR6COQXZ_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
9883
9888
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9884
9889
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9885
9890
|
const memoryTools = void 0;
|
|
@@ -10132,7 +10137,7 @@ var LocalAgent = class {
|
|
|
10132
10137
|
this.options = options;
|
|
10133
10138
|
this.workspaceCwd = resolveCwd(options.local?.cwd);
|
|
10134
10139
|
this.transcriptBaseDir = resolveSessionDir(options.local);
|
|
10135
|
-
this.sessionStore = options.local?.sessionStore ?? new
|
|
10140
|
+
this.sessionStore = options.local?.sessionStore ?? new chunkNQVWSSX2_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
|
|
10136
10141
|
this.settingSourcesIncludeProject = includesSetting(options, "project");
|
|
10137
10142
|
this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
|
|
10138
10143
|
const sub = bootstrapSubmanagers({
|
|
@@ -10185,7 +10190,7 @@ var LocalAgent = class {
|
|
|
10185
10190
|
);
|
|
10186
10191
|
await acquireLeaseIfPossible(this.sessionStore, this.agentId);
|
|
10187
10192
|
try {
|
|
10188
|
-
await
|
|
10193
|
+
await chunkFR6COQXZ_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
10189
10194
|
await this.personalityStore.hydrate(this.agentId);
|
|
10190
10195
|
} catch (err) {
|
|
10191
10196
|
await releaseLeaseIfPossible(this.sessionStore, this.agentId);
|
|
@@ -10526,22 +10531,22 @@ async function maybeInjectHandoffTools(options) {
|
|
|
10526
10531
|
};
|
|
10527
10532
|
}
|
|
10528
10533
|
function keyWillFlowToProvider(apiKey, provider) {
|
|
10529
|
-
if (
|
|
10530
|
-
if (
|
|
10534
|
+
if (chunkQY3CIMUV_cjs.isFixtureApiKey(apiKey)) return false;
|
|
10535
|
+
if (chunkQY3CIMUV_cjs.getConfiguredBaseUrl() !== void 0) return false;
|
|
10531
10536
|
if (provider === void 0) return false;
|
|
10532
|
-
const profile =
|
|
10537
|
+
const profile = chunkSGC7LSHF_cjs.getProviderProfile(provider);
|
|
10533
10538
|
if (profile === void 0) return false;
|
|
10534
10539
|
return profile.authType !== "none";
|
|
10535
10540
|
}
|
|
10536
10541
|
function missingApiKeyMessage() {
|
|
10537
|
-
const present =
|
|
10542
|
+
const present = chunkQY3CIMUV_cjs.presentProviderCredentialEnvVars();
|
|
10538
10543
|
const base = `Missing API key \u2014 set ${chunk6LHQPOMI_cjs.API_KEY_ENV_VAR}, or pass \`apiKey\` to Agent.create()`;
|
|
10539
10544
|
if (present.length === 0) return `${base}.`;
|
|
10540
10545
|
return `${base}. ${present.join(" and ")} ${present.length === 1 ? "is" : "are"} set, but a provider credential is not read from the environment automatically \u2014 pass it explicitly, e.g. \`Agent.create({ apiKey: process.env.${present[0]}, ... })\`.`;
|
|
10541
10546
|
}
|
|
10542
10547
|
function providerNeedsCallerKey(provider) {
|
|
10543
10548
|
if (provider === void 0) return true;
|
|
10544
|
-
const profile =
|
|
10549
|
+
const profile = chunkSGC7LSHF_cjs.getProviderProfile(provider);
|
|
10545
10550
|
if (profile === void 0) return true;
|
|
10546
10551
|
return profile.authType === "api_key";
|
|
10547
10552
|
}
|
|
@@ -10554,7 +10559,7 @@ async function createLocalAgent(options) {
|
|
|
10554
10559
|
}
|
|
10555
10560
|
} else {
|
|
10556
10561
|
const willFlowToProvider = keyWillFlowToProvider(apiKey, provider);
|
|
10557
|
-
const shape =
|
|
10562
|
+
const shape = chunkQY3CIMUV_cjs.validateApiKeyShape(apiKey, {
|
|
10558
10563
|
strict: willFlowToProvider,
|
|
10559
10564
|
...willFlowToProvider ? { provider } : {}
|
|
10560
10565
|
});
|
|
@@ -10573,15 +10578,15 @@ async function createCloudAgent(options) {
|
|
|
10573
10578
|
code: "missing_api_key"
|
|
10574
10579
|
});
|
|
10575
10580
|
}
|
|
10576
|
-
const shape =
|
|
10581
|
+
const shape = chunkQY3CIMUV_cjs.validateApiKeyShape(apiKey);
|
|
10577
10582
|
if (shape.malformed) {
|
|
10578
10583
|
throw new chunkUNFBHV46_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
10579
10584
|
}
|
|
10580
|
-
const baseUrl =
|
|
10585
|
+
const baseUrl = chunkQY3CIMUV_cjs.getConfiguredBaseUrl();
|
|
10581
10586
|
if (baseUrl === void 0) {
|
|
10582
10587
|
return new CloudAgent(options);
|
|
10583
10588
|
}
|
|
10584
|
-
const response = await
|
|
10589
|
+
const response = await chunkQY3CIMUV_cjs.httpRequest("/v1/agents", {
|
|
10585
10590
|
apiKey,
|
|
10586
10591
|
method: "POST",
|
|
10587
10592
|
body: {
|
|
@@ -10606,13 +10611,15 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
10606
10611
|
return process.cwd();
|
|
10607
10612
|
}
|
|
10608
10613
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
10609
|
-
await
|
|
10614
|
+
await chunkQY3CIMUV_cjs.discoverProviderPlugins();
|
|
10610
10615
|
await validateRehydratedAgent(agentId, existing);
|
|
10611
10616
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
10617
|
+
const mergedMemory = mergeResumedMemory(existing.options.memory, options.memory);
|
|
10612
10618
|
const mergedOptions = {
|
|
10613
10619
|
...existing.options,
|
|
10614
10620
|
...options,
|
|
10615
10621
|
...mergedLocal !== void 0 ? { local: mergedLocal } : {},
|
|
10622
|
+
...mergedMemory !== void 0 ? { memory: mergedMemory } : {},
|
|
10616
10623
|
// SE8 — normalize a caller-supplied bare-string model override at this resume
|
|
10617
10624
|
// boundary (Agent.resume never flows through runCreateUnderSpan). Cloud resume
|
|
10618
10625
|
// honors it; local resume forces the persisted model below.
|
|
@@ -10620,6 +10627,7 @@ async function rehydrateExistingAgent(agentId, existing, options) {
|
|
|
10620
10627
|
mcpServers: void 0,
|
|
10621
10628
|
agentId
|
|
10622
10629
|
};
|
|
10630
|
+
chunkZD66GFH5_cjs.resolveMaxFacts(mergedOptions.memory?.maxFacts);
|
|
10623
10631
|
if (existing.runtime === "cloud") {
|
|
10624
10632
|
return new CloudAgent(mergedOptions, agentId);
|
|
10625
10633
|
}
|
|
@@ -10627,6 +10635,12 @@ async function rehydrateExistingAgent(agentId, existing, options) {
|
|
|
10627
10635
|
await agent.initialize();
|
|
10628
10636
|
return agent;
|
|
10629
10637
|
}
|
|
10638
|
+
function mergeResumedMemory(persisted, override) {
|
|
10639
|
+
if (override === void 0) return persisted;
|
|
10640
|
+
if (persisted === void 0) return override;
|
|
10641
|
+
const named = Object.entries(override).filter(([, value]) => value !== void 0);
|
|
10642
|
+
return { ...persisted, ...Object.fromEntries(named) };
|
|
10643
|
+
}
|
|
10630
10644
|
async function validateRehydratedAgent(agentId, entry) {
|
|
10631
10645
|
if (entry.runtime !== "local") return;
|
|
10632
10646
|
const candidate = entry.options.local?.cwd ?? entry.cwd;
|
|
@@ -10757,7 +10771,7 @@ var Agent = class _Agent {
|
|
|
10757
10771
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
10758
10772
|
});
|
|
10759
10773
|
try {
|
|
10760
|
-
await
|
|
10774
|
+
await chunkQY3CIMUV_cjs.discoverProviderPlugins();
|
|
10761
10775
|
const agent = await runCreateUnderSpan(options, span);
|
|
10762
10776
|
return agent;
|
|
10763
10777
|
} catch (err) {
|
|
@@ -11055,9 +11069,9 @@ var Agent = class _Agent {
|
|
|
11055
11069
|
*/
|
|
11056
11070
|
static async compact(agentId, options = {}) {
|
|
11057
11071
|
const reg = await requireLocalAgent(agentId, "compact");
|
|
11058
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
11072
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-4QHBBGEY.cjs');
|
|
11059
11073
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
11060
|
-
return
|
|
11074
|
+
return chunkFR6COQXZ_cjs.enqueueSessionWrite(
|
|
11061
11075
|
cwd,
|
|
11062
11076
|
agentId,
|
|
11063
11077
|
() => compactSessionTranscript({
|
|
@@ -11085,7 +11099,7 @@ var Agent = class _Agent {
|
|
|
11085
11099
|
*/
|
|
11086
11100
|
static async injectSessionTurn(agentId, turn) {
|
|
11087
11101
|
const reg = await requireLocalAgent(agentId, "injectSessionTurn");
|
|
11088
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
11102
|
+
const { injectSessionTurn } = await import('./inject-session-OMLFL2V3.cjs');
|
|
11089
11103
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
11090
11104
|
await injectSessionTurn({
|
|
11091
11105
|
store,
|
|
@@ -11115,7 +11129,7 @@ var Agent = class _Agent {
|
|
|
11115
11129
|
*/
|
|
11116
11130
|
static async transcript(agentId) {
|
|
11117
11131
|
const reg = await requireLocalAgent(agentId, "transcript");
|
|
11118
|
-
const { readSessionMessages } = await import('./agent-session-store-
|
|
11132
|
+
const { readSessionMessages } = await import('./agent-session-store-SVEJHSUA.cjs');
|
|
11119
11133
|
const { store } = await openLocalStore(reg);
|
|
11120
11134
|
return readSessionMessages(store, agentId);
|
|
11121
11135
|
}
|
|
@@ -11235,8 +11249,8 @@ async function openLocalStore(reg) {
|
|
|
11235
11249
|
const cwd = reg.cwd ?? process.cwd();
|
|
11236
11250
|
const optModel = reg.options.model;
|
|
11237
11251
|
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
11238
|
-
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-
|
|
11239
|
-
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-
|
|
11252
|
+
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-IQ6PEHYF.cjs');
|
|
11253
|
+
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-RACG7BK2.cjs');
|
|
11240
11254
|
const configuredSessionDir = reg.options.local?.sessionDir ?? reg.options.local?.baseDir;
|
|
11241
11255
|
const baseDir = configuredSessionDir !== void 0 ? expandTilde2(configuredSessionDir) : defaultBaseDir2();
|
|
11242
11256
|
return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
|
|
@@ -11256,5 +11270,5 @@ exports.managedSettingsPathFor = managedSettingsPathFor;
|
|
|
11256
11270
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
11257
11271
|
exports.readManagedSettings = readManagedSettings;
|
|
11258
11272
|
exports.resolveSessionDir = resolveSessionDir;
|
|
11259
|
-
//# sourceMappingURL=chunk-
|
|
11260
|
-
//# sourceMappingURL=chunk-
|
|
11273
|
+
//# sourceMappingURL=chunk-CVEQ5366.cjs.map
|
|
11274
|
+
//# sourceMappingURL=chunk-CVEQ5366.cjs.map
|