@theokit/sdk 4.29.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-LBCEK6VH.cjs → agent-6GQBOHHA.cjs} +8 -8
- package/dist/{agent-LBCEK6VH.cjs.map → agent-6GQBOHHA.cjs.map} +1 -1
- package/dist/{agent-CdjSCbYz.d.cts → agent-Bzg2_uGr.d.cts} +55 -1
- package/dist/{agent-FBTLZI6V.js → agent-DY5LGZ5E.js} +7 -7
- package/dist/{agent-FBTLZI6V.js.map → agent-DY5LGZ5E.js.map} +1 -1
- package/dist/{agent-BZz4X8ZM.d.ts → agent-Ekv8y7_c.d.ts} +55 -1
- package/dist/agent.d.ts +15 -2
- package/dist/{chunk-EULKRTB5.js → chunk-4JWZRASX.js} +3 -3
- package/dist/{chunk-EULKRTB5.js.map → chunk-4JWZRASX.js.map} +1 -1
- package/dist/{chunk-YQAPEYUV.cjs → chunk-CYTAM3E6.cjs} +81 -43
- package/dist/chunk-CYTAM3E6.cjs.map +1 -0
- package/dist/{chunk-54YLX4Q6.cjs → chunk-FDGRQQWX.cjs} +5 -5
- package/dist/{chunk-54YLX4Q6.cjs.map → chunk-FDGRQQWX.cjs.map} +1 -1
- package/dist/{chunk-VUJ3NVDC.js → chunk-FZ75EZR5.js} +52 -14
- 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-CIIshMs3.d.cts → cron-CjzvXGT2.d.cts} +1 -1
- package/dist/{cron-dElBjDaL.d.ts → cron-D0Z29gI-.d.ts} +1 -1
- package/dist/cron.cjs +7 -7
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- 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.cjs.map +1 -1
- package/dist/index.d.cts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- 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/internal/plugins/types.d.cts +1 -1
- package/dist/internal/plugins/types.d.ts +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/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/types/plugin.d.ts +32 -0
- 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-HK7ZHSAX.cjs.map +0 -1
- package/dist/chunk-HZQEDNF6.js +0 -66
- package/dist/chunk-HZQEDNF6.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/chunk-VUJ3NVDC.js.map +0 -1
- package/dist/chunk-YQAPEYUV.cjs.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
|
}
|
|
@@ -6785,9 +6802,12 @@ async function runIteration(inputs, ctx) {
|
|
|
6785
6802
|
async function transformLlmOutputText(inputs, text, ctx) {
|
|
6786
6803
|
return inputs.pluginManager !== void 0 ? inputs.pluginManager.runTransformLlmOutputHooks(text, ctx) : text;
|
|
6787
6804
|
}
|
|
6788
|
-
async function guardAndTransformToolResults(inputs, raw, ctx) {
|
|
6805
|
+
async function guardAndTransformToolResults(inputs, raw, ctx, toolCalls) {
|
|
6789
6806
|
const guarded = inputs.toolResultGuard !== void 0 ? applyToolResultGuard(raw, inputs.toolResultGuard) : raw;
|
|
6790
|
-
return inputs.pluginManager !== void 0 ? inputs.pluginManager.runTransformToolResultHooks(guarded,
|
|
6807
|
+
return inputs.pluginManager !== void 0 ? inputs.pluginManager.runTransformToolResultHooks(guarded, {
|
|
6808
|
+
...ctx,
|
|
6809
|
+
toolCalls: toolCalls.map((c) => ({ id: c.id, name: c.name, args: c.input }))
|
|
6810
|
+
}) : guarded;
|
|
6791
6811
|
}
|
|
6792
6812
|
async function continueOrTerminate(inputs, ctx, llmOutput) {
|
|
6793
6813
|
if (llmOutput.errored) return "error";
|
|
@@ -6810,7 +6830,12 @@ async function continueOrTerminate(inputs, ctx, llmOutput) {
|
|
|
6810
6830
|
ctx.sendSpan
|
|
6811
6831
|
// M3 #64 — nest tool.call spans under agent.send
|
|
6812
6832
|
);
|
|
6813
|
-
const toolResults = await guardAndTransformToolResults(
|
|
6833
|
+
const toolResults = await guardAndTransformToolResults(
|
|
6834
|
+
inputs,
|
|
6835
|
+
rawResults,
|
|
6836
|
+
tCtx,
|
|
6837
|
+
llmOutput.toolCalls
|
|
6838
|
+
);
|
|
6814
6839
|
ctx.messages.push({ role: "user", content: toolResults });
|
|
6815
6840
|
if (inputs.onStep !== void 0) {
|
|
6816
6841
|
const cb = inputs.onStep;
|
|
@@ -6851,12 +6876,12 @@ var FallbackLlmClient = class {
|
|
|
6851
6876
|
let lastError;
|
|
6852
6877
|
for (const client of this.clients) {
|
|
6853
6878
|
if (signal.aborted) throw abortError(signal);
|
|
6854
|
-
const attempt = await
|
|
6879
|
+
const attempt = await chunkUKNMWCPZ_cjs.tryFirstEvent(client, request, signal, true);
|
|
6855
6880
|
if (attempt.kind === "handshake_error") {
|
|
6856
6881
|
lastError = attempt.error;
|
|
6857
6882
|
continue;
|
|
6858
6883
|
}
|
|
6859
|
-
return yield*
|
|
6884
|
+
return yield* chunkUKNMWCPZ_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
6860
6885
|
}
|
|
6861
6886
|
if (lastError !== void 0) throw lastError;
|
|
6862
6887
|
throw new chunkA44COQJJ_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
@@ -7363,8 +7388,8 @@ function resolveRunProvider(options) {
|
|
|
7363
7388
|
}
|
|
7364
7389
|
const parsedModel = chunkVYHJZVL5_cjs.parseModelId(options.model?.id);
|
|
7365
7390
|
const modelInferredProvider = parsedModel.provider !== void 0 && chunkD42XHI4O_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
|
|
7366
|
-
const keyInferredProvider =
|
|
7367
|
-
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();
|
|
7368
7393
|
const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
|
|
7369
7394
|
return { primary, effectiveModelId };
|
|
7370
7395
|
}
|
|
@@ -7393,7 +7418,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7393
7418
|
const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
|
|
7394
7419
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
7395
7420
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
7396
|
-
const chain =
|
|
7421
|
+
const chain = chunkUKNMWCPZ_cjs.resolveProviderChain({
|
|
7397
7422
|
primary,
|
|
7398
7423
|
...fallback !== void 0 ? { fallback } : {},
|
|
7399
7424
|
...apiKeys !== void 0 ? { apiKeys } : {},
|
|
@@ -7618,7 +7643,7 @@ function buildRealRunOptions(args) {
|
|
|
7618
7643
|
};
|
|
7619
7644
|
}
|
|
7620
7645
|
async function createFixtureRunHelper(args) {
|
|
7621
|
-
const sessionMessages =
|
|
7646
|
+
const sessionMessages = chunkXJT5VACT_cjs.getSessionMessages(args.inputs.agentId);
|
|
7622
7647
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
7623
7648
|
return createLocalRun({
|
|
7624
7649
|
agentId: args.inputs.agentId,
|
|
@@ -8067,7 +8092,7 @@ async function embedBatch(opts) {
|
|
|
8067
8092
|
body = JSON.parse(text);
|
|
8068
8093
|
} catch {
|
|
8069
8094
|
}
|
|
8070
|
-
throw
|
|
8095
|
+
throw chunkUKNMWCPZ_cjs.mapOpenAICompatibleError({
|
|
8071
8096
|
providerId: opts.providerId,
|
|
8072
8097
|
status: response.status,
|
|
8073
8098
|
body,
|
|
@@ -8618,7 +8643,7 @@ var LocalAgentMemory = class {
|
|
|
8618
8643
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
8619
8644
|
const cfg = this.options.memory?.activeRecall;
|
|
8620
8645
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
8621
|
-
if (this.breaker === void 0) this.breaker = new
|
|
8646
|
+
if (this.breaker === void 0) this.breaker = new chunkUKNMWCPZ_cjs.CircuitBreaker();
|
|
8622
8647
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
8623
8648
|
const result = await runActiveMemory({
|
|
8624
8649
|
userText,
|
|
@@ -9022,8 +9047,8 @@ async function localAgentUsePersonality(args) {
|
|
|
9022
9047
|
registry,
|
|
9023
9048
|
store: args.personalityStore,
|
|
9024
9049
|
invalidateCache: (reason) => args.invalidateCache(reason),
|
|
9025
|
-
appendSessionMessage: (msg) =>
|
|
9026
|
-
clearSession: () =>
|
|
9050
|
+
appendSessionMessage: (msg) => chunkXJT5VACT_cjs.appendSessionMessage(args.agentId, msg),
|
|
9051
|
+
clearSession: () => chunkXJT5VACT_cjs.clearSession(args.agentId),
|
|
9027
9052
|
opts: args.opts ?? {}
|
|
9028
9053
|
})
|
|
9029
9054
|
);
|
|
@@ -9371,7 +9396,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9371
9396
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
9372
9397
|
await inputs.options.onBeforeSend({
|
|
9373
9398
|
conversationId: inputs.agentId,
|
|
9374
|
-
previousMessageCount:
|
|
9399
|
+
previousMessageCount: chunkXJT5VACT_cjs.getSessionMessages(inputs.agentId).length
|
|
9375
9400
|
});
|
|
9376
9401
|
}
|
|
9377
9402
|
await inputs.runPreHook(userText);
|
|
@@ -9383,8 +9408,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9383
9408
|
userText,
|
|
9384
9409
|
sendOptions: options
|
|
9385
9410
|
});
|
|
9386
|
-
const priorMessages = [...
|
|
9387
|
-
|
|
9411
|
+
const priorMessages = [...chunkXJT5VACT_cjs.getSessionMessages(inputs.agentId)];
|
|
9412
|
+
chunkXJT5VACT_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
9388
9413
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9389
9414
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
|
|
9390
9415
|
const portPathActive = shouldUsePortMemoryPath();
|
|
@@ -9546,7 +9571,7 @@ var LocalAgent = class {
|
|
|
9546
9571
|
this.options = options;
|
|
9547
9572
|
this.workspaceCwd = resolveCwd(options.local?.cwd);
|
|
9548
9573
|
this.transcriptBaseDir = resolveBaseDir(options.local?.baseDir);
|
|
9549
|
-
this.sessionStore = options.local?.sessionStore ?? new
|
|
9574
|
+
this.sessionStore = options.local?.sessionStore ?? new chunkU447MTG4_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
|
|
9550
9575
|
this.settingSourcesIncludeProject = includesSetting(options, "project");
|
|
9551
9576
|
this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
|
|
9552
9577
|
const sub = bootstrapSubmanagers({
|
|
@@ -9594,7 +9619,7 @@ var LocalAgent = class {
|
|
|
9594
9619
|
this.settingSourcesIncludeProject,
|
|
9595
9620
|
this.options.agents
|
|
9596
9621
|
);
|
|
9597
|
-
await
|
|
9622
|
+
await chunkXJT5VACT_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
9598
9623
|
await this.personalityStore.hydrate(this.agentId);
|
|
9599
9624
|
}
|
|
9600
9625
|
/** T4.2 — expose PluginManager so agent-loop can fire pre_tool_call hooks. @internal */
|
|
@@ -9774,7 +9799,7 @@ var LocalAgent = class {
|
|
|
9774
9799
|
this.lifecycleAbortController.abort();
|
|
9775
9800
|
await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${this.agentId}`, () => Promise.resolve());
|
|
9776
9801
|
disposeSessionMcpClients(this.agentId);
|
|
9777
|
-
await
|
|
9802
|
+
await chunkXJT5VACT_cjs.flushSessionWrites();
|
|
9778
9803
|
await flushRegistrySaves(this.workspaceCwd);
|
|
9779
9804
|
}
|
|
9780
9805
|
[Symbol.asyncDispose]() {
|
|
@@ -9982,7 +10007,7 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
9982
10007
|
return process.cwd();
|
|
9983
10008
|
}
|
|
9984
10009
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
9985
|
-
await
|
|
10010
|
+
await chunkUKNMWCPZ_cjs.discoverProviderPlugins();
|
|
9986
10011
|
await validateRehydratedAgent(agentId, existing);
|
|
9987
10012
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
9988
10013
|
const mergedOptions = {
|
|
@@ -10110,7 +10135,7 @@ var Agent = class _Agent {
|
|
|
10110
10135
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
10111
10136
|
});
|
|
10112
10137
|
try {
|
|
10113
|
-
await
|
|
10138
|
+
await chunkUKNMWCPZ_cjs.discoverProviderPlugins();
|
|
10114
10139
|
const agent = await runCreateUnderSpan(options, span);
|
|
10115
10140
|
return agent;
|
|
10116
10141
|
} catch (err) {
|
|
@@ -10259,8 +10284,21 @@ var Agent = class _Agent {
|
|
|
10259
10284
|
* Caveats:
|
|
10260
10285
|
* - The function-level `agentId` always wins over `options.agentId`.
|
|
10261
10286
|
* - Options differ between calls? Last-call-wins for this handle (matches `Agent.resume`).
|
|
10262
|
-
* -
|
|
10263
|
-
*
|
|
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.
|
|
10264
10302
|
*
|
|
10265
10303
|
* @public
|
|
10266
10304
|
*/
|
|
@@ -10366,9 +10404,9 @@ var Agent = class _Agent {
|
|
|
10366
10404
|
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
10367
10405
|
);
|
|
10368
10406
|
}
|
|
10369
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
10407
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-2BFNMENR.cjs');
|
|
10370
10408
|
const { cwd, model, store } = await abrirStoreLocal(reg);
|
|
10371
|
-
return
|
|
10409
|
+
return chunkXJT5VACT_cjs.enqueueSessionWrite(
|
|
10372
10410
|
cwd,
|
|
10373
10411
|
agentId,
|
|
10374
10412
|
() => compactSessionTranscript({
|
|
@@ -10402,7 +10440,7 @@ var Agent = class _Agent {
|
|
|
10402
10440
|
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
10403
10441
|
);
|
|
10404
10442
|
}
|
|
10405
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
10443
|
+
const { injectSessionTurn } = await import('./inject-session-MIFEKATN.cjs');
|
|
10406
10444
|
const { cwd, model, store } = await abrirStoreLocal(reg);
|
|
10407
10445
|
await injectSessionTurn({
|
|
10408
10446
|
store,
|
|
@@ -10449,7 +10487,7 @@ async function abrirStoreLocal(reg) {
|
|
|
10449
10487
|
const cwd = reg.cwd ?? process.cwd();
|
|
10450
10488
|
const optModel = reg.options.model;
|
|
10451
10489
|
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
10452
|
-
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-
|
|
10490
|
+
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-26WVVMC4.cjs');
|
|
10453
10491
|
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-LPNZR3YS.cjs');
|
|
10454
10492
|
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
10455
10493
|
return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
|
|
@@ -10470,5 +10508,5 @@ exports.isFixtureApiKey = isFixtureApiKey;
|
|
|
10470
10508
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
10471
10509
|
exports.resolveApiKey = resolveApiKey;
|
|
10472
10510
|
exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
10473
|
-
//# sourceMappingURL=chunk-
|
|
10474
|
-
//# sourceMappingURL=chunk-
|
|
10511
|
+
//# sourceMappingURL=chunk-CYTAM3E6.cjs.map
|
|
10512
|
+
//# sourceMappingURL=chunk-CYTAM3E6.cjs.map
|