@theokit/sdk 5.9.1 → 5.9.2
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 +74 -0
- package/dist/{agent-R5RERYFU.js → agent-GZVZXKME.js} +15 -14
- package/dist/{agent-R5RERYFU.js.map → agent-GZVZXKME.js.map} +1 -1
- package/dist/{agent-5M7WLUWH.cjs → agent-WQ4LLTSY.cjs} +16 -15
- package/dist/{agent-5M7WLUWH.cjs.map → agent-WQ4LLTSY.cjs.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-TC4RWP3Y.js → chunk-47Z6LP3I.js} +3 -3
- package/dist/{chunk-TC4RWP3Y.js.map → chunk-47Z6LP3I.js.map} +1 -1
- package/dist/{chunk-TTBIQTO5.cjs → chunk-DLUCTZ56.cjs} +15 -15
- package/dist/{chunk-TTBIQTO5.cjs.map → chunk-DLUCTZ56.cjs.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-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-56BCEM26.cjs → chunk-JU76WCW7.cjs} +90 -89
- package/dist/chunk-JU76WCW7.cjs.map +1 -0
- package/dist/{chunk-LL4QA3DI.cjs → chunk-KXKT3HSD.cjs} +4 -4
- package/dist/{chunk-LL4QA3DI.cjs.map → chunk-KXKT3HSD.cjs.map} +1 -1
- package/dist/{chunk-QCIARBLS.js → chunk-M2CCHC66.js} +3 -3
- package/dist/{chunk-QCIARBLS.js.map → chunk-M2CCHC66.js.map} +1 -1
- package/dist/{chunk-QDQQYRJI.js → chunk-N7KYUNFO.js} +3 -3
- package/dist/{chunk-QDQQYRJI.js.map → chunk-N7KYUNFO.js.map} +1 -1
- package/dist/{chunk-UNZOJVVC.js → chunk-OZLQ6ZFM.js} +3 -3
- package/dist/{chunk-UNZOJVVC.js.map → chunk-OZLQ6ZFM.js.map} +1 -1
- package/dist/{chunk-OOM236Z4.js → chunk-PEIV7LOU.js} +18 -17
- package/dist/chunk-PEIV7LOU.js.map +1 -0
- 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-B3XXQX6L.cjs → chunk-RX3CFWQ2.cjs} +6 -6
- package/dist/{chunk-B3XXQX6L.cjs.map → chunk-RX3CFWQ2.cjs.map} +1 -1
- 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-76PIKR4P.cjs → chunk-VZ2JZ2EH.cjs} +5 -5
- package/dist/{chunk-76PIKR4P.cjs.map → chunk-VZ2JZ2EH.cjs.map} +1 -1
- package/dist/{chunk-T5KOSR5Y.cjs → chunk-X7Z2FEI7.cjs} +8 -8
- package/dist/{chunk-T5KOSR5Y.cjs.map → chunk-X7Z2FEI7.cjs.map} +1 -1
- 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-R2C3HXR3.js → chunk-ZDF2IJKC.js} +3 -3
- package/dist/{chunk-R2C3HXR3.js.map → chunk-ZDF2IJKC.js.map} +1 -1
- 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.cjs +15 -14
- package/dist/cron.js +14 -13
- package/dist/eval.cjs +14 -13
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +13 -12
- package/dist/eval.js.map +1 -1
- package/dist/fs-session-store-LCZBM3LT.js +10 -0
- package/dist/{fs-session-store-STZZFXH2.js.map → fs-session-store-LCZBM3LT.js.map} +1 -1
- package/dist/{fs-session-store-JHBJFKVV.cjs → fs-session-store-SVEMRE4K.cjs} +5 -5
- package/dist/{fs-session-store-JHBJFKVV.cjs.map → fs-session-store-SVEMRE4K.cjs.map} +1 -1
- package/dist/{index-manager-ONQJSWX5.js → index-manager-6B2UF5S3.js} +5 -5
- package/dist/{index-manager-ONQJSWX5.js.map → index-manager-6B2UF5S3.js.map} +1 -1
- package/dist/{index-manager-ZGJN25FD.cjs → index-manager-M3FHJCHQ.cjs} +6 -6
- package/dist/{index-manager-ZGJN25FD.cjs.map → index-manager-M3FHJCHQ.cjs.map} +1 -1
- package/dist/index.cjs +55 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -3
- package/dist/index.d.ts +30 -3
- package/dist/index.js +18 -17
- 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/storage/index.cjs +32 -32
- package/dist/internal/memory/storage/index.js +3 -3
- 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-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 +7 -7
- package/dist/persistence.js +2 -2
- 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/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/docs/error-codes.md +13 -13
- 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-ARMFXTY6.cjs.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-OOM236Z4.js.map +0 -1
- package/dist/chunk-R3ZQBPA5.cjs +0 -18
- package/dist/chunk-RA7IE4NK.cjs.map +0 -1
- package/dist/chunk-YRJA2POB.cjs +0 -601
- package/dist/chunk-YRJA2POB.cjs.map +0 -1
- 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 chunkDLUCTZ56_cjs = require('./chunk-DLUCTZ56.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 chunkVZ2JZ2EH_cjs = require('./chunk-VZ2JZ2EH.cjs');
|
|
11
|
+
var chunkRX3CFWQ2_cjs = require('./chunk-RX3CFWQ2.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,7 +23,7 @@ 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
|
|
26
|
+
var chunkZWACQM5U_cjs = require('./chunk-ZWACQM5U.cjs');
|
|
27
27
|
var chunkOF2CLCTH_cjs = require('./chunk-OF2CLCTH.cjs');
|
|
28
28
|
var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
|
|
29
29
|
var chunkJLRLCBJ4_cjs = require('./chunk-JLRLCBJ4.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');
|
|
@@ -820,7 +821,7 @@ async function readLegacyFacts(jsonPath) {
|
|
|
820
821
|
}
|
|
821
822
|
async function writeMigratedFacts(cwd, jsonPath, facts) {
|
|
822
823
|
try {
|
|
823
|
-
for (const fact of facts) await
|
|
824
|
+
for (const fact of facts) await chunkVZ2JZ2EH_cjs.appendFactToMarkdown(cwd, fact);
|
|
824
825
|
await promises.unlink(jsonPath).catch(() => void 0);
|
|
825
826
|
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
|
|
826
827
|
`);
|
|
@@ -837,11 +838,11 @@ async function migrateLegacyJson(cwd, config) {
|
|
|
837
838
|
const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
|
|
838
839
|
if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
|
|
839
840
|
migrationRun.add(key);
|
|
840
|
-
const jsonPath =
|
|
841
|
+
const jsonPath = chunkVZ2JZ2EH_cjs.legacyMemoryJsonPath(cwd, config);
|
|
841
842
|
if (!await fileExists(jsonPath)) {
|
|
842
843
|
return { migrated: false, factCount: 0, reason: "no-legacy-json" };
|
|
843
844
|
}
|
|
844
|
-
if (await fileExists(
|
|
845
|
+
if (await fileExists(chunkVZ2JZ2EH_cjs.memoryMdPath(chunkVZ2JZ2EH_cjs.resolveMemoryRoot(cwd, config)))) {
|
|
845
846
|
chunk6LHQPOMI_cjs.diag(
|
|
846
847
|
`[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
|
|
847
848
|
`
|
|
@@ -870,19 +871,19 @@ function unstoredRememberWarning(message) {
|
|
|
870
871
|
if (isMemoryWritePrompt(message) && extractMemoryFact(message).length > 0) return void 0;
|
|
871
872
|
const trimmed = message.trim();
|
|
872
873
|
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 (${
|
|
874
|
+
return `[theokit-sdk] NOTHING WAS STORED \u2014 this message does not match the memory capture pattern: ${JSON.stringify(quoted)}. Supported: "Remember: <fact>" or "Remember (${chunkVZ2JZ2EH_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
875
|
}
|
|
875
876
|
function extractMemoryKind(message) {
|
|
876
877
|
const match = REMEMBER_PATTERN.exec(message);
|
|
877
878
|
const declared = match?.[1];
|
|
878
879
|
if (declared === void 0) return void 0;
|
|
879
880
|
const lowered = declared.toLowerCase();
|
|
880
|
-
return
|
|
881
|
+
return chunkVZ2JZ2EH_cjs.MEMORY_KINDS.includes(lowered) ? lowered : void 0;
|
|
881
882
|
}
|
|
882
883
|
async function readMemoryFacts(cwd, config) {
|
|
883
884
|
if (!config.enabled) return [];
|
|
884
885
|
await migrateLegacyJson(cwd, config);
|
|
885
|
-
return
|
|
886
|
+
return chunkVZ2JZ2EH_cjs.readFacts(cwd, config);
|
|
886
887
|
}
|
|
887
888
|
async function appendMemoryFact(cwd, config, fact) {
|
|
888
889
|
if (!config.enabled) return;
|
|
@@ -891,7 +892,7 @@ async function appendMemoryFact(cwd, config, fact) {
|
|
|
891
892
|
text: chunk6LHQPOMI_cjs.redactSecrets(fact.text),
|
|
892
893
|
...fact.kind === void 0 ? {} : { kind: fact.kind }
|
|
893
894
|
};
|
|
894
|
-
await
|
|
895
|
+
await chunkVZ2JZ2EH_cjs.appendFact(cwd, config, sanitized);
|
|
895
896
|
}
|
|
896
897
|
|
|
897
898
|
// src/internal/runtime/fixtures/fixture-scripts.ts
|
|
@@ -1562,7 +1563,7 @@ function createRealCloudRun(options) {
|
|
|
1562
1563
|
conversation: []
|
|
1563
1564
|
};
|
|
1564
1565
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(options.agentOptions.apiKey);
|
|
1565
|
-
const baseUrl =
|
|
1566
|
+
const baseUrl = chunkQY3CIMUV_cjs.getConfiguredBaseUrl();
|
|
1566
1567
|
const handle = new RealCloudRun(
|
|
1567
1568
|
{
|
|
1568
1569
|
id,
|
|
@@ -1576,7 +1577,7 @@ function createRealCloudRun(options) {
|
|
|
1576
1577
|
apiKey,
|
|
1577
1578
|
baseUrl,
|
|
1578
1579
|
userText,
|
|
1579
|
-
fetchImpl: options.fetch
|
|
1580
|
+
fetchImpl: chunkEHD25JBZ_cjs.boundFetch(options.fetch),
|
|
1580
1581
|
sendOptions: options.sendOptions,
|
|
1581
1582
|
systemPrompt: options.systemPrompt,
|
|
1582
1583
|
agentConfig: options.agentConfig
|
|
@@ -1645,7 +1646,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1645
1646
|
async consumeStream(response) {
|
|
1646
1647
|
let finalStatus = "finished";
|
|
1647
1648
|
let finalText = "";
|
|
1648
|
-
for await (const record of
|
|
1649
|
+
for await (const record of chunkQY3CIMUV_cjs.parseSseStream(response.body, this.controller.signal)) {
|
|
1649
1650
|
const parsed = safeParse(record.data);
|
|
1650
1651
|
if (parsed === void 0) continue;
|
|
1651
1652
|
const update = this.applyRecord(record.event, parsed);
|
|
@@ -1812,7 +1813,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1812
1813
|
*/
|
|
1813
1814
|
isFixtureMode() {
|
|
1814
1815
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(this.options.apiKey);
|
|
1815
|
-
return
|
|
1816
|
+
return chunkQY3CIMUV_cjs.isFixtureApiKey(apiKey) && chunkQY3CIMUV_cjs.getConfiguredBaseUrl() === void 0;
|
|
1816
1817
|
}
|
|
1817
1818
|
// SE9 — integrated structured output; delegates to the shared helper.
|
|
1818
1819
|
generate(message, options) {
|
|
@@ -1864,7 +1865,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1864
1865
|
const userText = typeof message === "string" ? message : message.text;
|
|
1865
1866
|
const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
|
|
1866
1867
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(this.options.apiKey);
|
|
1867
|
-
const useRealRuntime = apiKey !== void 0 && !
|
|
1868
|
+
const useRealRuntime = apiKey !== void 0 && !chunkQY3CIMUV_cjs.isFixtureApiKey(apiKey) && chunkQY3CIMUV_cjs.getConfiguredBaseUrl() !== void 0;
|
|
1868
1869
|
return useRealRuntime ? createRealCloudRun({
|
|
1869
1870
|
agentId: this.agentId,
|
|
1870
1871
|
model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
|
|
@@ -2089,15 +2090,15 @@ function resolveSessionDir(local) {
|
|
|
2089
2090
|
"[theokit-sdk] local.sessionDir and local.baseDir are both set; using sessionDir. baseDir is the deprecated name for the same option (#301)."
|
|
2090
2091
|
);
|
|
2091
2092
|
}
|
|
2092
|
-
return
|
|
2093
|
+
return chunkZWACQM5U_cjs.expandTilde(local.sessionDir);
|
|
2093
2094
|
}
|
|
2094
2095
|
if (local?.baseDir !== void 0) {
|
|
2095
2096
|
chunk6LHQPOMI_cjs.diag(
|
|
2096
2097
|
"[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
2098
|
);
|
|
2098
|
-
return
|
|
2099
|
+
return chunkZWACQM5U_cjs.expandTilde(local.baseDir);
|
|
2099
2100
|
}
|
|
2100
|
-
return
|
|
2101
|
+
return chunkZWACQM5U_cjs.defaultBaseDir();
|
|
2101
2102
|
}
|
|
2102
2103
|
var SCHEMA_VERSION2 = 1;
|
|
2103
2104
|
var FILE_NAME = "personality.json";
|
|
@@ -2904,7 +2905,7 @@ function resolveWindowForRun(model, contextWindow) {
|
|
|
2904
2905
|
const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
|
|
2905
2906
|
return chunkJ5623RIV_cjs.resolveEffectiveContextWindow({
|
|
2906
2907
|
...override !== void 0 ? { override } : {},
|
|
2907
|
-
catalog:
|
|
2908
|
+
catalog: chunkHU666T3Q_cjs.getCatalogModelInfo(model)?.limit?.context,
|
|
2908
2909
|
margin: chunkJ5623RIV_cjs.CONTEXT_WINDOW_MARGIN,
|
|
2909
2910
|
floor: chunkJ5623RIV_cjs.CONTEXT_WINDOW_FLOOR
|
|
2910
2911
|
});
|
|
@@ -2929,7 +2930,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2929
2930
|
try {
|
|
2930
2931
|
const partial = await safeConversation(run);
|
|
2931
2932
|
if (partial !== void 0) {
|
|
2932
|
-
|
|
2933
|
+
chunkFR6COQXZ_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
|
|
2933
2934
|
userText,
|
|
2934
2935
|
conversation: partial
|
|
2935
2936
|
});
|
|
@@ -2939,11 +2940,11 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2939
2940
|
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
|
|
2940
2941
|
`);
|
|
2941
2942
|
}
|
|
2942
|
-
await
|
|
2943
|
+
await chunkFR6COQXZ_cjs.flushSessionWrites();
|
|
2943
2944
|
return;
|
|
2944
2945
|
}
|
|
2945
2946
|
if (result.result !== void 0) {
|
|
2946
|
-
|
|
2947
|
+
chunkFR6COQXZ_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
|
|
2947
2948
|
}
|
|
2948
2949
|
const conversation = await safeConversation(run);
|
|
2949
2950
|
const resolvedWindow = resolveWindowForRun(model, contextWindow);
|
|
@@ -2954,7 +2955,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2954
2955
|
}
|
|
2955
2956
|
const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
|
|
2956
2957
|
const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
|
|
2957
|
-
|
|
2958
|
+
chunkFR6COQXZ_cjs.persistTurnToTranscript(
|
|
2958
2959
|
sessionStore,
|
|
2959
2960
|
{ cwd: workspaceCwd, agentId, model },
|
|
2960
2961
|
agentId,
|
|
@@ -2966,7 +2967,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2966
2967
|
// The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
|
|
2967
2968
|
// `contextWindow` here would budget against a number the clamp already rejected.
|
|
2968
2969
|
contextWindow: effectiveWindow,
|
|
2969
|
-
summarize:
|
|
2970
|
+
summarize: chunkQY3CIMUV_cjs.buildDefaultSummarizer({
|
|
2970
2971
|
agentModel: model,
|
|
2971
2972
|
...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
|
|
2972
2973
|
})
|
|
@@ -2979,7 +2980,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2979
2980
|
cwd: workspaceCwd,
|
|
2980
2981
|
// Resolved once, here, and handed to both writers. Recomputing it inside either one is how
|
|
2981
2982
|
// the summary ended up in a directory the indexer never scanned (#463).
|
|
2982
|
-
memoryRoot:
|
|
2983
|
+
memoryRoot: chunkVZ2JZ2EH_cjs.resolveMemoryRoot(workspaceCwd, inputs.memory),
|
|
2983
2984
|
runId: result.id,
|
|
2984
2985
|
agentId,
|
|
2985
2986
|
userText,
|
|
@@ -2991,7 +2992,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2991
2992
|
if (memoryProvider?.recordSessionSummary !== void 0) {
|
|
2992
2993
|
await memoryProvider.recordSessionSummary(summaryArgs);
|
|
2993
2994
|
} else {
|
|
2994
|
-
await
|
|
2995
|
+
await chunkVZ2JZ2EH_cjs.writeSessionSummary(summaryArgs);
|
|
2995
2996
|
}
|
|
2996
2997
|
} catch (cause) {
|
|
2997
2998
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
@@ -3008,7 +3009,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
3008
3009
|
agentId,
|
|
3009
3010
|
runId: result.id
|
|
3010
3011
|
});
|
|
3011
|
-
await
|
|
3012
|
+
await chunkFR6COQXZ_cjs.flushSessionWrites();
|
|
3012
3013
|
}
|
|
3013
3014
|
async function safeConversation(run) {
|
|
3014
3015
|
try {
|
|
@@ -3638,7 +3639,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3638
3639
|
};
|
|
3639
3640
|
function safeRequire(moduleName) {
|
|
3640
3641
|
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-
|
|
3642
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-JU76WCW7.cjs', document.baseURI).href)));
|
|
3642
3643
|
return r(moduleName);
|
|
3643
3644
|
} catch {
|
|
3644
3645
|
return void 0;
|
|
@@ -3881,7 +3882,7 @@ var cachedOtel;
|
|
|
3881
3882
|
function loadOtel() {
|
|
3882
3883
|
if (cachedOtel === void 0) {
|
|
3883
3884
|
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-
|
|
3885
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-JU76WCW7.cjs', document.baseURI).href)));
|
|
3885
3886
|
const mod = r("@opentelemetry/api");
|
|
3886
3887
|
cachedOtel = mod;
|
|
3887
3888
|
} catch {
|
|
@@ -5584,7 +5585,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
5584
5585
|
const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
|
|
5585
5586
|
if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
|
|
5586
5587
|
for (const key of candidates) {
|
|
5587
|
-
const info =
|
|
5588
|
+
const info = chunkHU666T3Q_cjs.getCatalogModelInfo(key);
|
|
5588
5589
|
const cost = info?.cost;
|
|
5589
5590
|
if (cost === void 0) continue;
|
|
5590
5591
|
const [prov, ...modelParts] = key.split("/");
|
|
@@ -5596,7 +5597,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
5596
5597
|
...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
|
|
5597
5598
|
...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
|
|
5598
5599
|
// M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
|
|
5599
|
-
pricingVersion:
|
|
5600
|
+
pricingVersion: chunkHU666T3Q_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
|
|
5600
5601
|
};
|
|
5601
5602
|
}
|
|
5602
5603
|
return void 0;
|
|
@@ -6649,7 +6650,7 @@ function applyToolResultGuard(parts, opts) {
|
|
|
6649
6650
|
(p) => (
|
|
6650
6651
|
// SE7 — guard the TEXT of a tool result (string or the text blocks of a
|
|
6651
6652
|
// structured content); image blocks pass through untouched.
|
|
6652
|
-
p.type === "tool_result" ? { ...p, content:
|
|
6653
|
+
p.type === "tool_result" ? { ...p, content: chunkQY3CIMUV_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
|
|
6653
6654
|
)
|
|
6654
6655
|
);
|
|
6655
6656
|
}
|
|
@@ -6941,13 +6942,13 @@ var FallbackLlmClient = class {
|
|
|
6941
6942
|
async *stream(request, signal) {
|
|
6942
6943
|
let lastError;
|
|
6943
6944
|
for (const client of this.clients) {
|
|
6944
|
-
if (signal.aborted) throw
|
|
6945
|
-
const attempt = await
|
|
6945
|
+
if (signal.aborted) throw chunkQY3CIMUV_cjs.abortError(signal);
|
|
6946
|
+
const attempt = await chunkQY3CIMUV_cjs.tryFirstEvent(client, request, signal, true);
|
|
6946
6947
|
if (attempt.kind === "handshake_error") {
|
|
6947
6948
|
lastError = attempt.error;
|
|
6948
6949
|
continue;
|
|
6949
6950
|
}
|
|
6950
|
-
return yield*
|
|
6951
|
+
return yield* chunkQY3CIMUV_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
6951
6952
|
}
|
|
6952
6953
|
if (lastError !== void 0) throw lastError;
|
|
6953
6954
|
throw new chunkUNFBHV46_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
@@ -7583,9 +7584,9 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7583
7584
|
{ code: "invalid_max_iterations" }
|
|
7584
7585
|
);
|
|
7585
7586
|
}
|
|
7586
|
-
const { primary, effectiveModelId } =
|
|
7587
|
+
const { primary, effectiveModelId } = chunkQY3CIMUV_cjs.resolveRunProvider(options);
|
|
7587
7588
|
const fallback = options.agentOptions.providers?.fallback;
|
|
7588
|
-
const apiKeys =
|
|
7589
|
+
const apiKeys = chunkQY3CIMUV_cjs.mergeExplicitApiKey(
|
|
7589
7590
|
options.agentOptions.providers?.apiKeys,
|
|
7590
7591
|
primary,
|
|
7591
7592
|
options.agentOptions.apiKey
|
|
@@ -7594,7 +7595,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7594
7595
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
7595
7596
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
7596
7597
|
const modelBaseUrl = options.model?.url;
|
|
7597
|
-
const chain =
|
|
7598
|
+
const chain = chunkQY3CIMUV_cjs.resolveProviderChain({
|
|
7598
7599
|
primary,
|
|
7599
7600
|
...modelBaseUrl !== void 0 ? { baseUrl: modelBaseUrl } : {},
|
|
7600
7601
|
...fallback !== void 0 ? { fallback } : {},
|
|
@@ -7854,7 +7855,7 @@ function buildRealRunOptions(args) {
|
|
|
7854
7855
|
};
|
|
7855
7856
|
}
|
|
7856
7857
|
async function createFixtureRunHelper(args) {
|
|
7857
|
-
const sessionMessages =
|
|
7858
|
+
const sessionMessages = chunkFR6COQXZ_cjs.getSessionMessages(args.inputs.agentId);
|
|
7858
7859
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
7859
7860
|
return createLocalRun({
|
|
7860
7861
|
agentId: args.inputs.agentId,
|
|
@@ -7873,7 +7874,7 @@ async function createFixtureRunHelper(args) {
|
|
|
7873
7874
|
}
|
|
7874
7875
|
async function dispatchLocalRun(args) {
|
|
7875
7876
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(args.inputs.options.apiKey);
|
|
7876
|
-
if (
|
|
7877
|
+
if (chunkQY3CIMUV_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
7877
7878
|
return createRealLocalRun(
|
|
7878
7879
|
buildRealRunOptions({
|
|
7879
7880
|
inputs: args.inputs,
|
|
@@ -8129,10 +8130,10 @@ async function disposeLocalAgentSession(agent) {
|
|
|
8129
8130
|
agent.lifecycleAbortController.abort();
|
|
8130
8131
|
await chunkZF2LDKQQ_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
|
|
8131
8132
|
disposeSessionMcpClients(agent.agentId);
|
|
8132
|
-
await
|
|
8133
|
+
await chunkFR6COQXZ_cjs.flushSessionWrites();
|
|
8133
8134
|
await flushRegistrySaves(agent.workspaceCwd);
|
|
8134
8135
|
await disposeSessionStore(agent.sessionStore);
|
|
8135
|
-
|
|
8136
|
+
chunkFR6COQXZ_cjs.discardSession(agent.workspaceCwd, agent.agentId);
|
|
8136
8137
|
}
|
|
8137
8138
|
async function reloadLocalAgent(agent) {
|
|
8138
8139
|
if (agent.context !== void 0) await agent.context.refresh();
|
|
@@ -8384,7 +8385,7 @@ async function finalize(args, queryMode, result) {
|
|
|
8384
8385
|
};
|
|
8385
8386
|
args.cache?.set(args.userText, queryMode, result, tenantCtx);
|
|
8386
8387
|
if (args.persistTranscripts === true && args.cwd !== void 0) {
|
|
8387
|
-
await chunkTMKTSYDS_cjs.persistActiveMemoryTranscript(args.memoryRoot ??
|
|
8388
|
+
await chunkTMKTSYDS_cjs.persistActiveMemoryTranscript(args.memoryRoot ?? chunkVZ2JZ2EH_cjs.resolveMemoryRoot(args.cwd), {
|
|
8388
8389
|
runId: args.runId ?? `run-${Date.now()}`,
|
|
8389
8390
|
startedAtMs: Date.now() - result.durationMs,
|
|
8390
8391
|
userText: args.userText,
|
|
@@ -8487,7 +8488,7 @@ var openAiMemoryEmbeddingProviderAdapter = {
|
|
|
8487
8488
|
transport: "remote",
|
|
8488
8489
|
authProviderId: "openai",
|
|
8489
8490
|
autoSelectPriority: 20,
|
|
8490
|
-
create: (options) =>
|
|
8491
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8491
8492
|
{
|
|
8492
8493
|
id: "openai",
|
|
8493
8494
|
defaultBaseUrl: "https://api.openai.com",
|
|
@@ -8509,7 +8510,7 @@ var azureOpenAiMemoryEmbeddingProviderAdapter = {
|
|
|
8509
8510
|
transport: "remote",
|
|
8510
8511
|
authProviderId: "azure-openai",
|
|
8511
8512
|
autoSelectPriority: 25,
|
|
8512
|
-
create: (options) =>
|
|
8513
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8513
8514
|
{
|
|
8514
8515
|
id: "azure-openai",
|
|
8515
8516
|
defaultBaseUrl: "https://your-resource.openai.azure.com",
|
|
@@ -8545,7 +8546,7 @@ var cohereMemoryEmbeddingProviderAdapter = {
|
|
|
8545
8546
|
transport: "remote",
|
|
8546
8547
|
authProviderId: "cohere",
|
|
8547
8548
|
autoSelectPriority: 30,
|
|
8548
|
-
create: (options) =>
|
|
8549
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8549
8550
|
{
|
|
8550
8551
|
id: "cohere",
|
|
8551
8552
|
defaultBaseUrl: "https://api.cohere.com",
|
|
@@ -8591,7 +8592,7 @@ var deepinfraMemoryEmbeddingProviderAdapter = {
|
|
|
8591
8592
|
transport: "remote",
|
|
8592
8593
|
authProviderId: "deepinfra",
|
|
8593
8594
|
autoSelectPriority: 13,
|
|
8594
|
-
create: (options) =>
|
|
8595
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8595
8596
|
{
|
|
8596
8597
|
id: "deepinfra",
|
|
8597
8598
|
defaultBaseUrl: "https://api.deepinfra.com",
|
|
@@ -8617,7 +8618,7 @@ var geminiMemoryEmbeddingProviderAdapter = {
|
|
|
8617
8618
|
transport: "remote",
|
|
8618
8619
|
authProviderId: "gemini",
|
|
8619
8620
|
autoSelectPriority: 30,
|
|
8620
|
-
create: (options) =>
|
|
8621
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8621
8622
|
{
|
|
8622
8623
|
id: "gemini",
|
|
8623
8624
|
defaultBaseUrl: "https://generativelanguage.googleapis.com",
|
|
@@ -8645,7 +8646,7 @@ var jinaMemoryEmbeddingProviderAdapter = {
|
|
|
8645
8646
|
transport: "remote",
|
|
8646
8647
|
authProviderId: "jina",
|
|
8647
8648
|
autoSelectPriority: 35,
|
|
8648
|
-
create: (options) =>
|
|
8649
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8649
8650
|
{
|
|
8650
8651
|
id: "jina",
|
|
8651
8652
|
defaultBaseUrl: "https://api.jina.ai",
|
|
@@ -8668,7 +8669,7 @@ var mistralMemoryEmbeddingProviderAdapter = {
|
|
|
8668
8669
|
transport: "remote",
|
|
8669
8670
|
authProviderId: "mistral",
|
|
8670
8671
|
autoSelectPriority: 18,
|
|
8671
|
-
create: (options) =>
|
|
8672
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8672
8673
|
{
|
|
8673
8674
|
id: "mistral",
|
|
8674
8675
|
defaultBaseUrl: "https://api.mistral.ai",
|
|
@@ -8710,7 +8711,7 @@ var ollamaMemoryEmbeddingProviderAdapter = {
|
|
|
8710
8711
|
autoSelectPriority: 10,
|
|
8711
8712
|
create: (options) => {
|
|
8712
8713
|
const apiKey = options.apiKey ?? process.env.OLLAMA_API_KEY ?? OLLAMA_LOCAL_SENTINEL_KEY;
|
|
8713
|
-
return
|
|
8714
|
+
return chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8714
8715
|
{
|
|
8715
8716
|
id: "ollama",
|
|
8716
8717
|
defaultBaseUrl: "http://localhost:11434",
|
|
@@ -8738,7 +8739,7 @@ var openRouterMemoryEmbeddingProviderAdapter = {
|
|
|
8738
8739
|
transport: "remote",
|
|
8739
8740
|
authProviderId: "openrouter",
|
|
8740
8741
|
autoSelectPriority: 15,
|
|
8741
|
-
create: (options) =>
|
|
8742
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8742
8743
|
{
|
|
8743
8744
|
id: "openrouter",
|
|
8744
8745
|
defaultBaseUrl: "https://openrouter.ai/api",
|
|
@@ -8766,7 +8767,7 @@ var voyageMemoryEmbeddingProviderAdapter = {
|
|
|
8766
8767
|
transport: "remote",
|
|
8767
8768
|
authProviderId: "voyage",
|
|
8768
8769
|
autoSelectPriority: 14,
|
|
8769
|
-
create: (options) =>
|
|
8770
|
+
create: (options) => chunkYEHQ3SIC_cjs.createOpenAiCompatibleRuntime(
|
|
8770
8771
|
{
|
|
8771
8772
|
id: "voyage",
|
|
8772
8773
|
defaultBaseUrl: "https://api.voyageai.com",
|
|
@@ -8975,7 +8976,7 @@ var LocalAgentMemory = class {
|
|
|
8975
8976
|
const openOpts = { cwd: this.workspaceCwd, memoryRoot };
|
|
8976
8977
|
if (embedding !== void 0) openOpts.embedding = embedding;
|
|
8977
8978
|
if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
|
|
8978
|
-
this.index = await
|
|
8979
|
+
this.index = await chunkDLUCTZ56_cjs.IndexManager.open(openOpts);
|
|
8979
8980
|
await this.index.sync();
|
|
8980
8981
|
this.toolsCache = [
|
|
8981
8982
|
createMemorySearchTool({ index: this.index }),
|
|
@@ -8996,7 +8997,7 @@ var LocalAgentMemory = class {
|
|
|
8996
8997
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
8997
8998
|
const cfg = this.options.memory?.activeRecall;
|
|
8998
8999
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
8999
|
-
if (this.breaker === void 0) this.breaker = new
|
|
9000
|
+
if (this.breaker === void 0) this.breaker = new chunkQY3CIMUV_cjs.CircuitBreaker();
|
|
9000
9001
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
9001
9002
|
const result = await runActiveMemory({
|
|
9002
9003
|
userText,
|
|
@@ -9019,7 +9020,7 @@ var LocalAgentMemory = class {
|
|
|
9019
9020
|
* and the active-memory transcript writer. Three separate resolutions is how they drifted (#463).
|
|
9020
9021
|
*/
|
|
9021
9022
|
memoryRoot() {
|
|
9022
|
-
this.memoryRootCache ??=
|
|
9023
|
+
this.memoryRootCache ??= chunkVZ2JZ2EH_cjs.resolveMemoryRoot(this.workspaceCwd, this.options.memory);
|
|
9023
9024
|
return this.memoryRootCache;
|
|
9024
9025
|
}
|
|
9025
9026
|
buildActiveMemoryOptions(cfg) {
|
|
@@ -9134,7 +9135,7 @@ function createLocalAgentMemoryProvider(opts) {
|
|
|
9134
9135
|
return { facts: [], systemPromptAdditions: summary };
|
|
9135
9136
|
},
|
|
9136
9137
|
async recordSessionSummary(args) {
|
|
9137
|
-
await
|
|
9138
|
+
await chunkVZ2JZ2EH_cjs.writeSessionSummary(args);
|
|
9138
9139
|
},
|
|
9139
9140
|
async sync(handle) {
|
|
9140
9141
|
const state = handle[INTERNAL_LAM_KEY];
|
|
@@ -9311,8 +9312,8 @@ async function localAgentUsePersonality(agent, name, opts) {
|
|
|
9311
9312
|
registry,
|
|
9312
9313
|
store: agent.personalityStore,
|
|
9313
9314
|
invalidateCache: (reason) => agent.invalidateCache(reason),
|
|
9314
|
-
appendSessionMessage: (msg) =>
|
|
9315
|
-
clearSession: () =>
|
|
9315
|
+
appendSessionMessage: (msg) => chunkFR6COQXZ_cjs.appendSessionMessage(agent.agentId, msg),
|
|
9316
|
+
clearSession: () => chunkFR6COQXZ_cjs.clearSession(agent.agentId),
|
|
9316
9317
|
opts: opts ?? {}
|
|
9317
9318
|
})
|
|
9318
9319
|
);
|
|
@@ -9866,7 +9867,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9866
9867
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
9867
9868
|
await inputs.options.onBeforeSend({
|
|
9868
9869
|
conversationId: inputs.agentId,
|
|
9869
|
-
previousMessageCount:
|
|
9870
|
+
previousMessageCount: chunkFR6COQXZ_cjs.getSessionMessages(inputs.agentId).length
|
|
9870
9871
|
});
|
|
9871
9872
|
}
|
|
9872
9873
|
await inputs.runPreHook(userText);
|
|
@@ -9878,8 +9879,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9878
9879
|
userText,
|
|
9879
9880
|
sendOptions: options
|
|
9880
9881
|
});
|
|
9881
|
-
const priorMessages = [...
|
|
9882
|
-
|
|
9882
|
+
const priorMessages = [...chunkFR6COQXZ_cjs.getSessionMessages(inputs.agentId)];
|
|
9883
|
+
chunkFR6COQXZ_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
9883
9884
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9884
9885
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9885
9886
|
const memoryTools = void 0;
|
|
@@ -10132,7 +10133,7 @@ var LocalAgent = class {
|
|
|
10132
10133
|
this.options = options;
|
|
10133
10134
|
this.workspaceCwd = resolveCwd(options.local?.cwd);
|
|
10134
10135
|
this.transcriptBaseDir = resolveSessionDir(options.local);
|
|
10135
|
-
this.sessionStore = options.local?.sessionStore ?? new
|
|
10136
|
+
this.sessionStore = options.local?.sessionStore ?? new chunkRX3CFWQ2_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
|
|
10136
10137
|
this.settingSourcesIncludeProject = includesSetting(options, "project");
|
|
10137
10138
|
this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
|
|
10138
10139
|
const sub = bootstrapSubmanagers({
|
|
@@ -10185,7 +10186,7 @@ var LocalAgent = class {
|
|
|
10185
10186
|
);
|
|
10186
10187
|
await acquireLeaseIfPossible(this.sessionStore, this.agentId);
|
|
10187
10188
|
try {
|
|
10188
|
-
await
|
|
10189
|
+
await chunkFR6COQXZ_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
10189
10190
|
await this.personalityStore.hydrate(this.agentId);
|
|
10190
10191
|
} catch (err) {
|
|
10191
10192
|
await releaseLeaseIfPossible(this.sessionStore, this.agentId);
|
|
@@ -10526,22 +10527,22 @@ async function maybeInjectHandoffTools(options) {
|
|
|
10526
10527
|
};
|
|
10527
10528
|
}
|
|
10528
10529
|
function keyWillFlowToProvider(apiKey, provider) {
|
|
10529
|
-
if (
|
|
10530
|
-
if (
|
|
10530
|
+
if (chunkQY3CIMUV_cjs.isFixtureApiKey(apiKey)) return false;
|
|
10531
|
+
if (chunkQY3CIMUV_cjs.getConfiguredBaseUrl() !== void 0) return false;
|
|
10531
10532
|
if (provider === void 0) return false;
|
|
10532
|
-
const profile =
|
|
10533
|
+
const profile = chunkSGC7LSHF_cjs.getProviderProfile(provider);
|
|
10533
10534
|
if (profile === void 0) return false;
|
|
10534
10535
|
return profile.authType !== "none";
|
|
10535
10536
|
}
|
|
10536
10537
|
function missingApiKeyMessage() {
|
|
10537
|
-
const present =
|
|
10538
|
+
const present = chunkQY3CIMUV_cjs.presentProviderCredentialEnvVars();
|
|
10538
10539
|
const base = `Missing API key \u2014 set ${chunk6LHQPOMI_cjs.API_KEY_ENV_VAR}, or pass \`apiKey\` to Agent.create()`;
|
|
10539
10540
|
if (present.length === 0) return `${base}.`;
|
|
10540
10541
|
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
10542
|
}
|
|
10542
10543
|
function providerNeedsCallerKey(provider) {
|
|
10543
10544
|
if (provider === void 0) return true;
|
|
10544
|
-
const profile =
|
|
10545
|
+
const profile = chunkSGC7LSHF_cjs.getProviderProfile(provider);
|
|
10545
10546
|
if (profile === void 0) return true;
|
|
10546
10547
|
return profile.authType === "api_key";
|
|
10547
10548
|
}
|
|
@@ -10554,7 +10555,7 @@ async function createLocalAgent(options) {
|
|
|
10554
10555
|
}
|
|
10555
10556
|
} else {
|
|
10556
10557
|
const willFlowToProvider = keyWillFlowToProvider(apiKey, provider);
|
|
10557
|
-
const shape =
|
|
10558
|
+
const shape = chunkQY3CIMUV_cjs.validateApiKeyShape(apiKey, {
|
|
10558
10559
|
strict: willFlowToProvider,
|
|
10559
10560
|
...willFlowToProvider ? { provider } : {}
|
|
10560
10561
|
});
|
|
@@ -10573,15 +10574,15 @@ async function createCloudAgent(options) {
|
|
|
10573
10574
|
code: "missing_api_key"
|
|
10574
10575
|
});
|
|
10575
10576
|
}
|
|
10576
|
-
const shape =
|
|
10577
|
+
const shape = chunkQY3CIMUV_cjs.validateApiKeyShape(apiKey);
|
|
10577
10578
|
if (shape.malformed) {
|
|
10578
10579
|
throw new chunkUNFBHV46_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
10579
10580
|
}
|
|
10580
|
-
const baseUrl =
|
|
10581
|
+
const baseUrl = chunkQY3CIMUV_cjs.getConfiguredBaseUrl();
|
|
10581
10582
|
if (baseUrl === void 0) {
|
|
10582
10583
|
return new CloudAgent(options);
|
|
10583
10584
|
}
|
|
10584
|
-
const response = await
|
|
10585
|
+
const response = await chunkQY3CIMUV_cjs.httpRequest("/v1/agents", {
|
|
10585
10586
|
apiKey,
|
|
10586
10587
|
method: "POST",
|
|
10587
10588
|
body: {
|
|
@@ -10606,7 +10607,7 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
10606
10607
|
return process.cwd();
|
|
10607
10608
|
}
|
|
10608
10609
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
10609
|
-
await
|
|
10610
|
+
await chunkQY3CIMUV_cjs.discoverProviderPlugins();
|
|
10610
10611
|
await validateRehydratedAgent(agentId, existing);
|
|
10611
10612
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
10612
10613
|
const mergedOptions = {
|
|
@@ -10757,7 +10758,7 @@ var Agent = class _Agent {
|
|
|
10757
10758
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
10758
10759
|
});
|
|
10759
10760
|
try {
|
|
10760
|
-
await
|
|
10761
|
+
await chunkQY3CIMUV_cjs.discoverProviderPlugins();
|
|
10761
10762
|
const agent = await runCreateUnderSpan(options, span);
|
|
10762
10763
|
return agent;
|
|
10763
10764
|
} catch (err) {
|
|
@@ -11055,9 +11056,9 @@ var Agent = class _Agent {
|
|
|
11055
11056
|
*/
|
|
11056
11057
|
static async compact(agentId, options = {}) {
|
|
11057
11058
|
const reg = await requireLocalAgent(agentId, "compact");
|
|
11058
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
11059
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-4QHBBGEY.cjs');
|
|
11059
11060
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
11060
|
-
return
|
|
11061
|
+
return chunkFR6COQXZ_cjs.enqueueSessionWrite(
|
|
11061
11062
|
cwd,
|
|
11062
11063
|
agentId,
|
|
11063
11064
|
() => compactSessionTranscript({
|
|
@@ -11085,7 +11086,7 @@ var Agent = class _Agent {
|
|
|
11085
11086
|
*/
|
|
11086
11087
|
static async injectSessionTurn(agentId, turn) {
|
|
11087
11088
|
const reg = await requireLocalAgent(agentId, "injectSessionTurn");
|
|
11088
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
11089
|
+
const { injectSessionTurn } = await import('./inject-session-OMLFL2V3.cjs');
|
|
11089
11090
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
11090
11091
|
await injectSessionTurn({
|
|
11091
11092
|
store,
|
|
@@ -11115,7 +11116,7 @@ var Agent = class _Agent {
|
|
|
11115
11116
|
*/
|
|
11116
11117
|
static async transcript(agentId) {
|
|
11117
11118
|
const reg = await requireLocalAgent(agentId, "transcript");
|
|
11118
|
-
const { readSessionMessages } = await import('./agent-session-store-
|
|
11119
|
+
const { readSessionMessages } = await import('./agent-session-store-SVEJHSUA.cjs');
|
|
11119
11120
|
const { store } = await openLocalStore(reg);
|
|
11120
11121
|
return readSessionMessages(store, agentId);
|
|
11121
11122
|
}
|
|
@@ -11235,8 +11236,8 @@ async function openLocalStore(reg) {
|
|
|
11235
11236
|
const cwd = reg.cwd ?? process.cwd();
|
|
11236
11237
|
const optModel = reg.options.model;
|
|
11237
11238
|
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-
|
|
11239
|
+
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-SVEMRE4K.cjs');
|
|
11240
|
+
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-RACG7BK2.cjs');
|
|
11240
11241
|
const configuredSessionDir = reg.options.local?.sessionDir ?? reg.options.local?.baseDir;
|
|
11241
11242
|
const baseDir = configuredSessionDir !== void 0 ? expandTilde2(configuredSessionDir) : defaultBaseDir2();
|
|
11242
11243
|
return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
|
|
@@ -11256,5 +11257,5 @@ exports.managedSettingsPathFor = managedSettingsPathFor;
|
|
|
11256
11257
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
11257
11258
|
exports.readManagedSettings = readManagedSettings;
|
|
11258
11259
|
exports.resolveSessionDir = resolveSessionDir;
|
|
11259
|
-
//# sourceMappingURL=chunk-
|
|
11260
|
-
//# sourceMappingURL=chunk-
|
|
11260
|
+
//# sourceMappingURL=chunk-JU76WCW7.cjs.map
|
|
11261
|
+
//# sourceMappingURL=chunk-JU76WCW7.cjs.map
|