@theokit/sdk 4.30.0 → 4.31.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 +43 -0
- package/dist/{agent-LD76RI74.cjs → agent-6GQBOHHA.cjs} +8 -8
- package/dist/{agent-LD76RI74.cjs.map → agent-6GQBOHHA.cjs.map} +1 -1
- package/dist/{agent-7YUGJJTU.js → agent-DY5LGZ5E.js} +7 -7
- package/dist/{agent-7YUGJJTU.js.map → agent-DY5LGZ5E.js.map} +1 -1
- package/dist/agent.d.ts +15 -2
- package/dist/{chunk-5YCAR23S.js → chunk-4JWZRASX.js} +3 -3
- package/dist/{chunk-5YCAR23S.js.map → chunk-4JWZRASX.js.map} +1 -1
- package/dist/{chunk-GWMQ5CS3.cjs → chunk-CYTAM3E6.cjs} +70 -40
- package/dist/chunk-CYTAM3E6.cjs.map +1 -0
- package/dist/{chunk-NG6B2PMA.cjs → chunk-FDGRQQWX.cjs} +5 -5
- package/dist/{chunk-NG6B2PMA.cjs.map → chunk-FDGRQQWX.cjs.map} +1 -1
- package/dist/{chunk-ISZ3MBUD.js → chunk-FZ75EZR5.js} +41 -11
- package/dist/chunk-FZ75EZR5.js.map +1 -0
- package/dist/chunk-ICSCKB3N.js +140 -0
- package/dist/chunk-ICSCKB3N.js.map +1 -0
- package/dist/{chunk-U6QGZHPN.js → chunk-PORDVVJS.js} +5 -6
- package/dist/chunk-PORDVVJS.js.map +1 -0
- package/dist/{chunk-NRSH7RJY.js → chunk-TLG444A6.js} +61 -13
- package/dist/chunk-TLG444A6.js.map +1 -0
- package/dist/{chunk-2HRYBRD7.cjs → chunk-U447MTG4.cjs} +5 -6
- package/dist/chunk-U447MTG4.cjs.map +1 -0
- package/dist/{chunk-2MF3IE2D.cjs → chunk-UKNMWCPZ.cjs} +63 -15
- package/dist/chunk-UKNMWCPZ.cjs.map +1 -0
- package/dist/{chunk-SQLZ7ONU.js → chunk-VUXLNVX7.js} +3 -3
- package/dist/{chunk-SQLZ7ONU.js.map → chunk-VUXLNVX7.js.map} +1 -1
- package/dist/{chunk-HK7ZHSAX.cjs → chunk-WQEQCJTZ.cjs} +64 -3
- package/dist/chunk-WQEQCJTZ.cjs.map +1 -0
- package/dist/{chunk-YU6KON2I.cjs → chunk-XJT5VACT.cjs} +3 -3
- package/dist/{chunk-YU6KON2I.cjs.map → chunk-XJT5VACT.cjs.map} +1 -1
- package/dist/{compact-session-OO7NVWPB.cjs → compact-session-2BFNMENR.cjs} +11 -11
- package/dist/{compact-session-OO7NVWPB.cjs.map → compact-session-2BFNMENR.cjs.map} +1 -1
- package/dist/{compact-session-OO2GD76G.js → compact-session-2JONXHLR.js} +3 -3
- package/dist/{compact-session-OO2GD76G.js.map → compact-session-2JONXHLR.js.map} +1 -1
- package/dist/cron.cjs +7 -7
- package/dist/cron.js +6 -6
- package/dist/eval.cjs +10 -11
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +6 -7
- package/dist/eval.js.map +1 -1
- package/dist/fs-session-store-26WVVMC4.cjs +17 -0
- package/dist/{fs-session-store-KAUQYSGI.cjs.map → fs-session-store-26WVVMC4.cjs.map} +1 -1
- package/dist/fs-session-store-7AEI4STY.js +8 -0
- package/dist/{fs-session-store-ZKB5NN37.js.map → fs-session-store-7AEI4STY.js.map} +1 -1
- package/dist/index.cjs +28 -28
- package/dist/index.d.cts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +8 -8
- package/dist/{inject-session-6MJUSGZP.cjs → inject-session-MIFEKATN.cjs} +4 -4
- package/dist/{inject-session-6MJUSGZP.cjs.map → inject-session-MIFEKATN.cjs.map} +1 -1
- package/dist/{inject-session-KOFHS5K3.js → inject-session-NNSCCIVP.js} +3 -3
- package/dist/{inject-session-KOFHS5K3.js.map → inject-session-NNSCCIVP.js.map} +1 -1
- package/dist/internal/llm/retrying-client.d.ts +29 -0
- package/dist/internal/persistence/index.cjs +18 -19
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +1 -2
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/persistence.cjs +10 -11
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +1 -2
- package/dist/persistence.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2HRYBRD7.cjs.map +0 -1
- package/dist/chunk-2MF3IE2D.cjs.map +0 -1
- package/dist/chunk-C7PICHRF.cjs +0 -68
- package/dist/chunk-C7PICHRF.cjs.map +0 -1
- package/dist/chunk-GWMQ5CS3.cjs.map +0 -1
- package/dist/chunk-HK7ZHSAX.cjs.map +0 -1
- package/dist/chunk-HZQEDNF6.js +0 -66
- package/dist/chunk-HZQEDNF6.js.map +0 -1
- package/dist/chunk-ISZ3MBUD.js.map +0 -1
- package/dist/chunk-NRSH7RJY.js.map +0 -1
- package/dist/chunk-R6ZP6KNB.js +0 -80
- package/dist/chunk-R6ZP6KNB.js.map +0 -1
- package/dist/chunk-U6QGZHPN.js.map +0 -1
- package/dist/fs-session-store-KAUQYSGI.cjs +0 -17
- package/dist/fs-session-store-ZKB5NN37.js +0 -8
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
|
|
4
4
|
var chunkMZ5ZRORA_cjs = require('./chunk-MZ5ZRORA.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
5
|
+
var chunkXJT5VACT_cjs = require('./chunk-XJT5VACT.cjs');
|
|
6
|
+
var chunkU447MTG4_cjs = require('./chunk-U447MTG4.cjs');
|
|
7
|
+
var chunkUKNMWCPZ_cjs = require('./chunk-UKNMWCPZ.cjs');
|
|
8
8
|
var chunkJLMXKTBX_cjs = require('./chunk-JLMXKTBX.cjs');
|
|
9
9
|
var chunkN24XBYNX_cjs = require('./chunk-N24XBYNX.cjs');
|
|
10
10
|
var chunkWPZTYOUX_cjs = require('./chunk-WPZTYOUX.cjs');
|
|
@@ -15,7 +15,7 @@ var chunkNINIJCHU_cjs = require('./chunk-NINIJCHU.cjs');
|
|
|
15
15
|
var chunkYPEPCZHF_cjs = require('./chunk-YPEPCZHF.cjs');
|
|
16
16
|
var chunkVJ26EKGJ_cjs = require('./chunk-VJ26EKGJ.cjs');
|
|
17
17
|
var chunkGIW4L6HY_cjs = require('./chunk-GIW4L6HY.cjs');
|
|
18
|
-
var
|
|
18
|
+
var chunkWQEQCJTZ_cjs = require('./chunk-WQEQCJTZ.cjs');
|
|
19
19
|
var chunkYLQQX5W2_cjs = require('./chunk-YLQQX5W2.cjs');
|
|
20
20
|
var chunk4SXHEZIV_cjs = require('./chunk-4SXHEZIV.cjs');
|
|
21
21
|
var chunkWJVHMTKB_cjs = require('./chunk-WJVHMTKB.cjs');
|
|
@@ -1663,7 +1663,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1663
1663
|
async consumeStream(response) {
|
|
1664
1664
|
let finalStatus = "finished";
|
|
1665
1665
|
let finalText = "";
|
|
1666
|
-
for await (const record of
|
|
1666
|
+
for await (const record of chunkUKNMWCPZ_cjs.parseSseStream(response.body, this.controller.signal)) {
|
|
1667
1667
|
const parsed = safeParse(record.data);
|
|
1668
1668
|
if (parsed === void 0) continue;
|
|
1669
1669
|
const update = this.applyRecord(record.event, parsed);
|
|
@@ -2228,7 +2228,7 @@ var PersonalityStore = class {
|
|
|
2228
2228
|
async #persist(agentId, slug) {
|
|
2229
2229
|
const filePath = this.#filePath();
|
|
2230
2230
|
await promises.mkdir(path.dirname(filePath), { recursive: true });
|
|
2231
|
-
await
|
|
2231
|
+
await chunkWQEQCJTZ_cjs.withFileLock(filePath, async () => {
|
|
2232
2232
|
const current = await readState(filePath);
|
|
2233
2233
|
const nextAgents = { ...current.agents };
|
|
2234
2234
|
if (slug === void 0) delete nextAgents[agentId];
|
|
@@ -2720,11 +2720,28 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2720
2720
|
try {
|
|
2721
2721
|
result = await run.wait();
|
|
2722
2722
|
} catch {
|
|
2723
|
-
|
|
2723
|
+
try {
|
|
2724
|
+
const parcial = await safeConversation(run);
|
|
2725
|
+
if (parcial !== void 0) {
|
|
2726
|
+
chunkXJT5VACT_cjs.persistTurnToTranscript(
|
|
2727
|
+
sessionStore,
|
|
2728
|
+
{ cwd: workspaceCwd, agentId, model },
|
|
2729
|
+
agentId,
|
|
2730
|
+
{ userText, conversation: parcial }
|
|
2731
|
+
);
|
|
2732
|
+
}
|
|
2733
|
+
} catch (cause) {
|
|
2734
|
+
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
2735
|
+
process.stderr.write(
|
|
2736
|
+
`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
|
|
2737
|
+
`
|
|
2738
|
+
);
|
|
2739
|
+
}
|
|
2740
|
+
await chunkXJT5VACT_cjs.flushSessionWrites();
|
|
2724
2741
|
return;
|
|
2725
2742
|
}
|
|
2726
2743
|
if (result.result !== void 0) {
|
|
2727
|
-
|
|
2744
|
+
chunkXJT5VACT_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
|
|
2728
2745
|
}
|
|
2729
2746
|
const conversation = await safeConversation(run);
|
|
2730
2747
|
const resolvedWindow = chunkEVADEGM7_cjs.resolveEffectiveContextWindow({
|
|
@@ -2739,7 +2756,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2739
2756
|
}
|
|
2740
2757
|
const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
|
|
2741
2758
|
const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
|
|
2742
|
-
|
|
2759
|
+
chunkXJT5VACT_cjs.persistTurnToTranscript(
|
|
2743
2760
|
sessionStore,
|
|
2744
2761
|
{ cwd: workspaceCwd, agentId, model },
|
|
2745
2762
|
agentId,
|
|
@@ -2749,7 +2766,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2749
2766
|
autoCompact: {
|
|
2750
2767
|
usageTotal: usageForTrigger,
|
|
2751
2768
|
contextWindow,
|
|
2752
|
-
summarize:
|
|
2769
|
+
summarize: chunkUKNMWCPZ_cjs.buildDefaultSummarizer({
|
|
2753
2770
|
agentModel: model,
|
|
2754
2771
|
...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
|
|
2755
2772
|
})
|
|
@@ -2793,7 +2810,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2793
2810
|
agentId,
|
|
2794
2811
|
runId: result.id
|
|
2795
2812
|
});
|
|
2796
|
-
await
|
|
2813
|
+
await chunkXJT5VACT_cjs.flushSessionWrites();
|
|
2797
2814
|
}
|
|
2798
2815
|
async function safeConversation(run) {
|
|
2799
2816
|
try {
|
|
@@ -3550,7 +3567,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3550
3567
|
};
|
|
3551
3568
|
function safeRequire(moduleName) {
|
|
3552
3569
|
try {
|
|
3553
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3570
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-CYTAM3E6.cjs', document.baseURI).href)));
|
|
3554
3571
|
return r(moduleName);
|
|
3555
3572
|
} catch {
|
|
3556
3573
|
return void 0;
|
|
@@ -3775,7 +3792,7 @@ var cachedOtel;
|
|
|
3775
3792
|
function loadOtel() {
|
|
3776
3793
|
if (cachedOtel === void 0) {
|
|
3777
3794
|
try {
|
|
3778
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3795
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-CYTAM3E6.cjs', document.baseURI).href)));
|
|
3779
3796
|
const mod = r("@opentelemetry/api");
|
|
3780
3797
|
cachedOtel = mod;
|
|
3781
3798
|
} catch {
|
|
@@ -6204,7 +6221,7 @@ function applyToolResultGuard(parts, opts) {
|
|
|
6204
6221
|
(p) => (
|
|
6205
6222
|
// SE7 — guard the TEXT of a tool result (string or the text blocks of a
|
|
6206
6223
|
// structured content); image blocks pass through untouched.
|
|
6207
|
-
p.type === "tool_result" ? { ...p, content:
|
|
6224
|
+
p.type === "tool_result" ? { ...p, content: chunkUKNMWCPZ_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
|
|
6208
6225
|
)
|
|
6209
6226
|
);
|
|
6210
6227
|
}
|
|
@@ -6859,12 +6876,12 @@ var FallbackLlmClient = class {
|
|
|
6859
6876
|
let lastError;
|
|
6860
6877
|
for (const client of this.clients) {
|
|
6861
6878
|
if (signal.aborted) throw abortError(signal);
|
|
6862
|
-
const attempt = await
|
|
6879
|
+
const attempt = await chunkUKNMWCPZ_cjs.tryFirstEvent(client, request, signal, true);
|
|
6863
6880
|
if (attempt.kind === "handshake_error") {
|
|
6864
6881
|
lastError = attempt.error;
|
|
6865
6882
|
continue;
|
|
6866
6883
|
}
|
|
6867
|
-
return yield*
|
|
6884
|
+
return yield* chunkUKNMWCPZ_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
6868
6885
|
}
|
|
6869
6886
|
if (lastError !== void 0) throw lastError;
|
|
6870
6887
|
throw new chunkA44COQJJ_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
@@ -7371,8 +7388,8 @@ function resolveRunProvider(options) {
|
|
|
7371
7388
|
}
|
|
7372
7389
|
const parsedModel = chunkVYHJZVL5_cjs.parseModelId(options.model?.id);
|
|
7373
7390
|
const modelInferredProvider = parsedModel.provider !== void 0 && chunkD42XHI4O_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
|
|
7374
|
-
const keyInferredProvider =
|
|
7375
|
-
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ??
|
|
7391
|
+
const keyInferredProvider = chunkUKNMWCPZ_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
|
|
7392
|
+
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkUKNMWCPZ_cjs.detectPrimaryProvider();
|
|
7376
7393
|
const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
|
|
7377
7394
|
return { primary, effectiveModelId };
|
|
7378
7395
|
}
|
|
@@ -7401,7 +7418,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7401
7418
|
const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
|
|
7402
7419
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
7403
7420
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
7404
|
-
const chain =
|
|
7421
|
+
const chain = chunkUKNMWCPZ_cjs.resolveProviderChain({
|
|
7405
7422
|
primary,
|
|
7406
7423
|
...fallback !== void 0 ? { fallback } : {},
|
|
7407
7424
|
...apiKeys !== void 0 ? { apiKeys } : {},
|
|
@@ -7626,7 +7643,7 @@ function buildRealRunOptions(args) {
|
|
|
7626
7643
|
};
|
|
7627
7644
|
}
|
|
7628
7645
|
async function createFixtureRunHelper(args) {
|
|
7629
|
-
const sessionMessages =
|
|
7646
|
+
const sessionMessages = chunkXJT5VACT_cjs.getSessionMessages(args.inputs.agentId);
|
|
7630
7647
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
7631
7648
|
return createLocalRun({
|
|
7632
7649
|
agentId: args.inputs.agentId,
|
|
@@ -8075,7 +8092,7 @@ async function embedBatch(opts) {
|
|
|
8075
8092
|
body = JSON.parse(text);
|
|
8076
8093
|
} catch {
|
|
8077
8094
|
}
|
|
8078
|
-
throw
|
|
8095
|
+
throw chunkUKNMWCPZ_cjs.mapOpenAICompatibleError({
|
|
8079
8096
|
providerId: opts.providerId,
|
|
8080
8097
|
status: response.status,
|
|
8081
8098
|
body,
|
|
@@ -8626,7 +8643,7 @@ var LocalAgentMemory = class {
|
|
|
8626
8643
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
8627
8644
|
const cfg = this.options.memory?.activeRecall;
|
|
8628
8645
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
8629
|
-
if (this.breaker === void 0) this.breaker = new
|
|
8646
|
+
if (this.breaker === void 0) this.breaker = new chunkUKNMWCPZ_cjs.CircuitBreaker();
|
|
8630
8647
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
8631
8648
|
const result = await runActiveMemory({
|
|
8632
8649
|
userText,
|
|
@@ -9030,8 +9047,8 @@ async function localAgentUsePersonality(args) {
|
|
|
9030
9047
|
registry,
|
|
9031
9048
|
store: args.personalityStore,
|
|
9032
9049
|
invalidateCache: (reason) => args.invalidateCache(reason),
|
|
9033
|
-
appendSessionMessage: (msg) =>
|
|
9034
|
-
clearSession: () =>
|
|
9050
|
+
appendSessionMessage: (msg) => chunkXJT5VACT_cjs.appendSessionMessage(args.agentId, msg),
|
|
9051
|
+
clearSession: () => chunkXJT5VACT_cjs.clearSession(args.agentId),
|
|
9035
9052
|
opts: args.opts ?? {}
|
|
9036
9053
|
})
|
|
9037
9054
|
);
|
|
@@ -9379,7 +9396,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9379
9396
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
9380
9397
|
await inputs.options.onBeforeSend({
|
|
9381
9398
|
conversationId: inputs.agentId,
|
|
9382
|
-
previousMessageCount:
|
|
9399
|
+
previousMessageCount: chunkXJT5VACT_cjs.getSessionMessages(inputs.agentId).length
|
|
9383
9400
|
});
|
|
9384
9401
|
}
|
|
9385
9402
|
await inputs.runPreHook(userText);
|
|
@@ -9391,8 +9408,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9391
9408
|
userText,
|
|
9392
9409
|
sendOptions: options
|
|
9393
9410
|
});
|
|
9394
|
-
const priorMessages = [...
|
|
9395
|
-
|
|
9411
|
+
const priorMessages = [...chunkXJT5VACT_cjs.getSessionMessages(inputs.agentId)];
|
|
9412
|
+
chunkXJT5VACT_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
9396
9413
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9397
9414
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
|
|
9398
9415
|
const portPathActive = shouldUsePortMemoryPath();
|
|
@@ -9554,7 +9571,7 @@ var LocalAgent = class {
|
|
|
9554
9571
|
this.options = options;
|
|
9555
9572
|
this.workspaceCwd = resolveCwd(options.local?.cwd);
|
|
9556
9573
|
this.transcriptBaseDir = resolveBaseDir(options.local?.baseDir);
|
|
9557
|
-
this.sessionStore = options.local?.sessionStore ?? new
|
|
9574
|
+
this.sessionStore = options.local?.sessionStore ?? new chunkU447MTG4_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
|
|
9558
9575
|
this.settingSourcesIncludeProject = includesSetting(options, "project");
|
|
9559
9576
|
this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
|
|
9560
9577
|
const sub = bootstrapSubmanagers({
|
|
@@ -9602,7 +9619,7 @@ var LocalAgent = class {
|
|
|
9602
9619
|
this.settingSourcesIncludeProject,
|
|
9603
9620
|
this.options.agents
|
|
9604
9621
|
);
|
|
9605
|
-
await
|
|
9622
|
+
await chunkXJT5VACT_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
9606
9623
|
await this.personalityStore.hydrate(this.agentId);
|
|
9607
9624
|
}
|
|
9608
9625
|
/** T4.2 — expose PluginManager so agent-loop can fire pre_tool_call hooks. @internal */
|
|
@@ -9782,7 +9799,7 @@ var LocalAgent = class {
|
|
|
9782
9799
|
this.lifecycleAbortController.abort();
|
|
9783
9800
|
await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${this.agentId}`, () => Promise.resolve());
|
|
9784
9801
|
disposeSessionMcpClients(this.agentId);
|
|
9785
|
-
await
|
|
9802
|
+
await chunkXJT5VACT_cjs.flushSessionWrites();
|
|
9786
9803
|
await flushRegistrySaves(this.workspaceCwd);
|
|
9787
9804
|
}
|
|
9788
9805
|
[Symbol.asyncDispose]() {
|
|
@@ -9990,7 +10007,7 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
9990
10007
|
return process.cwd();
|
|
9991
10008
|
}
|
|
9992
10009
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
9993
|
-
await
|
|
10010
|
+
await chunkUKNMWCPZ_cjs.discoverProviderPlugins();
|
|
9994
10011
|
await validateRehydratedAgent(agentId, existing);
|
|
9995
10012
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
9996
10013
|
const mergedOptions = {
|
|
@@ -10118,7 +10135,7 @@ var Agent = class _Agent {
|
|
|
10118
10135
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
10119
10136
|
});
|
|
10120
10137
|
try {
|
|
10121
|
-
await
|
|
10138
|
+
await chunkUKNMWCPZ_cjs.discoverProviderPlugins();
|
|
10122
10139
|
const agent = await runCreateUnderSpan(options, span);
|
|
10123
10140
|
return agent;
|
|
10124
10141
|
} catch (err) {
|
|
@@ -10267,8 +10284,21 @@ var Agent = class _Agent {
|
|
|
10267
10284
|
* Caveats:
|
|
10268
10285
|
* - The function-level `agentId` always wins over `options.agentId`.
|
|
10269
10286
|
* - Options differ between calls? Last-call-wins for this handle (matches `Agent.resume`).
|
|
10270
|
-
* -
|
|
10271
|
-
*
|
|
10287
|
+
* - A DISPOSED agent is replaced automatically. `dispose()` evicts the id from the
|
|
10288
|
+
* live cache (`liveAgentRegistry.forget`), so the next `getOrCreate(id)` builds a
|
|
10289
|
+
* fresh handle — no `Agent.delete(agentId)` needed.
|
|
10290
|
+
*
|
|
10291
|
+
* This bullet used to say the opposite ("Disposed agents are NOT auto-deleted...
|
|
10292
|
+
* call `Agent.delete(agentId)` first"). It was measured false in M91:
|
|
10293
|
+
* `tests/m91-getorcreate-apos-dispose.test.ts` builds an agent, disposes it, and
|
|
10294
|
+
* gets a different instance back. The claim was about the PERSISTENT registry and
|
|
10295
|
+
* read as being about the live cache — and consumers built around the wrong half.
|
|
10296
|
+
* The agent-builder's M85 interrupt rotates the session id to work around a
|
|
10297
|
+
* constraint that does not exist.
|
|
10298
|
+
*
|
|
10299
|
+
* - `close()` marks the handle disposed WITHOUT evicting the cache entry. It is
|
|
10300
|
+
* internal and unused today; if it becomes reachable, this bullet stops being true
|
|
10301
|
+
* for that path.
|
|
10272
10302
|
*
|
|
10273
10303
|
* @public
|
|
10274
10304
|
*/
|
|
@@ -10374,9 +10404,9 @@ var Agent = class _Agent {
|
|
|
10374
10404
|
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
10375
10405
|
);
|
|
10376
10406
|
}
|
|
10377
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
10407
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-2BFNMENR.cjs');
|
|
10378
10408
|
const { cwd, model, store } = await abrirStoreLocal(reg);
|
|
10379
|
-
return
|
|
10409
|
+
return chunkXJT5VACT_cjs.enqueueSessionWrite(
|
|
10380
10410
|
cwd,
|
|
10381
10411
|
agentId,
|
|
10382
10412
|
() => compactSessionTranscript({
|
|
@@ -10410,7 +10440,7 @@ var Agent = class _Agent {
|
|
|
10410
10440
|
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
10411
10441
|
);
|
|
10412
10442
|
}
|
|
10413
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
10443
|
+
const { injectSessionTurn } = await import('./inject-session-MIFEKATN.cjs');
|
|
10414
10444
|
const { cwd, model, store } = await abrirStoreLocal(reg);
|
|
10415
10445
|
await injectSessionTurn({
|
|
10416
10446
|
store,
|
|
@@ -10457,7 +10487,7 @@ async function abrirStoreLocal(reg) {
|
|
|
10457
10487
|
const cwd = reg.cwd ?? process.cwd();
|
|
10458
10488
|
const optModel = reg.options.model;
|
|
10459
10489
|
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
10460
|
-
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-
|
|
10490
|
+
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-26WVVMC4.cjs');
|
|
10461
10491
|
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-LPNZR3YS.cjs');
|
|
10462
10492
|
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
10463
10493
|
return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
|
|
@@ -10478,5 +10508,5 @@ exports.isFixtureApiKey = isFixtureApiKey;
|
|
|
10478
10508
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
10479
10509
|
exports.resolveApiKey = resolveApiKey;
|
|
10480
10510
|
exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
10481
|
-
//# sourceMappingURL=chunk-
|
|
10482
|
-
//# sourceMappingURL=chunk-
|
|
10511
|
+
//# sourceMappingURL=chunk-CYTAM3E6.cjs.map
|
|
10512
|
+
//# sourceMappingURL=chunk-CYTAM3E6.cjs.map
|