@theokit/sdk 4.39.2 → 4.39.3
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 +21 -0
- package/dist/{agent-KGKKAGXY.js → agent-CJPUQ6BT.js} +6 -6
- package/dist/{agent-KGKKAGXY.js.map → agent-CJPUQ6BT.js.map} +1 -1
- package/dist/{agent-TOWHPM7B.cjs → agent-IKDNM7OA.cjs} +7 -7
- package/dist/{agent-TOWHPM7B.cjs.map → agent-IKDNM7OA.cjs.map} +1 -1
- package/dist/{chunk-AFJAQ5JV.js → chunk-23HI77BZ.js} +8 -3
- package/dist/chunk-23HI77BZ.js.map +1 -0
- package/dist/{chunk-AYDSWY35.cjs → chunk-GKZY34TD.cjs} +50 -50
- package/dist/{chunk-AYDSWY35.cjs.map → chunk-GKZY34TD.cjs.map} +1 -1
- package/dist/{chunk-TZ47DTM2.cjs → chunk-IIBQBMIS.cjs} +5 -5
- package/dist/{chunk-TZ47DTM2.cjs.map → chunk-IIBQBMIS.cjs.map} +1 -1
- package/dist/{chunk-ERBH54V3.js → chunk-JWRMBFSP.js} +7 -7
- package/dist/{chunk-ERBH54V3.js.map → chunk-JWRMBFSP.js.map} +1 -1
- package/dist/{chunk-Z5DYGBPV.cjs → chunk-N4JNY5DT.cjs} +3 -3
- package/dist/{chunk-Z5DYGBPV.cjs.map → chunk-N4JNY5DT.cjs.map} +1 -1
- package/dist/{chunk-7HP6N5X3.js → chunk-ONVIALVV.js} +3 -3
- package/dist/{chunk-7HP6N5X3.js.map → chunk-ONVIALVV.js.map} +1 -1
- package/dist/{chunk-MDN44YMZ.js → chunk-PP3ZKVZZ.js} +3 -3
- package/dist/{chunk-MDN44YMZ.js.map → chunk-PP3ZKVZZ.js.map} +1 -1
- package/dist/{chunk-LR3VKB7A.cjs → chunk-SEWAPWAF.cjs} +20 -20
- package/dist/{chunk-LR3VKB7A.cjs.map → chunk-SEWAPWAF.cjs.map} +1 -1
- package/dist/{chunk-UDSGSPUY.cjs → chunk-T6KFGMNY.cjs} +9 -4
- package/dist/chunk-T6KFGMNY.cjs.map +1 -0
- package/dist/{chunk-RMO7HAIF.js → chunk-X627TO3A.js} +3 -3
- package/dist/{chunk-RMO7HAIF.js.map → chunk-X627TO3A.js.map} +1 -1
- package/dist/{compact-session-KPYRNTQN.js → compact-session-AZU2LEAE.js} +4 -4
- package/dist/{compact-session-KPYRNTQN.js.map → compact-session-AZU2LEAE.js.map} +1 -1
- package/dist/{compact-session-FCEFK2CG.cjs → compact-session-TRCEYCPG.cjs} +12 -12
- package/dist/{compact-session-FCEFK2CG.cjs.map → compact-session-TRCEYCPG.cjs.map} +1 -1
- package/dist/cron.cjs +6 -6
- package/dist/cron.js +5 -5
- package/dist/eval.cjs +5 -5
- package/dist/eval.js +4 -4
- package/dist/index.cjs +36 -36
- package/dist/index.js +7 -7
- package/dist/{inject-session-BIVVFWGL.cjs → inject-session-BVSERZCI.cjs} +4 -4
- package/dist/{inject-session-BIVVFWGL.cjs.map → inject-session-BVSERZCI.cjs.map} +1 -1
- package/dist/{inject-session-OLWZ2NJN.js → inject-session-E75EP3LL.js} +3 -3
- package/dist/{inject-session-OLWZ2NJN.js.map → inject-session-E75EP3LL.js.map} +1 -1
- package/dist/models.cjs +9 -9
- package/dist/models.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AFJAQ5JV.js.map +0 -1
- package/dist/chunk-UDSGSPUY.cjs.map +0 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
|
|
4
4
|
var chunkQMIG7TKG_cjs = require('./chunk-QMIG7TKG.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkN4JNY5DT_cjs = require('./chunk-N4JNY5DT.cjs');
|
|
6
6
|
var chunkMWVLE5RY_cjs = require('./chunk-MWVLE5RY.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkSEWAPWAF_cjs = require('./chunk-SEWAPWAF.cjs');
|
|
8
8
|
var chunkLNTQRD23_cjs = require('./chunk-LNTQRD23.cjs');
|
|
9
9
|
var chunkK6TWHNT4_cjs = require('./chunk-K6TWHNT4.cjs');
|
|
10
10
|
var chunkWPZTYOUX_cjs = require('./chunk-WPZTYOUX.cjs');
|
|
@@ -24,7 +24,7 @@ var chunk33B2BSME_cjs = require('./chunk-33B2BSME.cjs');
|
|
|
24
24
|
var chunkLOTWA65Z_cjs = require('./chunk-LOTWA65Z.cjs');
|
|
25
25
|
var chunkOVGNXGCK_cjs = require('./chunk-OVGNXGCK.cjs');
|
|
26
26
|
var chunkVYHJZVL5_cjs = require('./chunk-VYHJZVL5.cjs');
|
|
27
|
-
var
|
|
27
|
+
var chunkT6KFGMNY_cjs = require('./chunk-T6KFGMNY.cjs');
|
|
28
28
|
var chunkCJHBSSAF_cjs = require('./chunk-CJHBSSAF.cjs');
|
|
29
29
|
var chunkZAKTZ5B4_cjs = require('./chunk-ZAKTZ5B4.cjs');
|
|
30
30
|
var chunkLY4KEOOY_cjs = require('./chunk-LY4KEOOY.cjs');
|
|
@@ -1616,7 +1616,7 @@ function createRealCloudRun(options) {
|
|
|
1616
1616
|
conversation: []
|
|
1617
1617
|
};
|
|
1618
1618
|
const apiKey = resolveApiKey(options.agentOptions.apiKey);
|
|
1619
|
-
const baseUrl =
|
|
1619
|
+
const baseUrl = chunkSEWAPWAF_cjs.getConfiguredBaseUrl();
|
|
1620
1620
|
const handle = new RealCloudRun(
|
|
1621
1621
|
{
|
|
1622
1622
|
id,
|
|
@@ -1699,7 +1699,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1699
1699
|
async consumeStream(response) {
|
|
1700
1700
|
let finalStatus = "finished";
|
|
1701
1701
|
let finalText = "";
|
|
1702
|
-
for await (const record of
|
|
1702
|
+
for await (const record of chunkSEWAPWAF_cjs.parseSseStream(response.body, this.controller.signal)) {
|
|
1703
1703
|
const parsed = safeParse(record.data);
|
|
1704
1704
|
if (parsed === void 0) continue;
|
|
1705
1705
|
const update = this.applyRecord(record.event, parsed);
|
|
@@ -1808,7 +1808,7 @@ var CloudAgent = class {
|
|
|
1808
1808
|
*/
|
|
1809
1809
|
isFixtureMode() {
|
|
1810
1810
|
const apiKey = resolveApiKey(this.options.apiKey);
|
|
1811
|
-
return
|
|
1811
|
+
return chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) && chunkSEWAPWAF_cjs.getConfiguredBaseUrl() === void 0;
|
|
1812
1812
|
}
|
|
1813
1813
|
// SE9 — integrated structured output; delegates to the shared helper.
|
|
1814
1814
|
generate(message, options) {
|
|
@@ -1859,7 +1859,7 @@ var CloudAgent = class {
|
|
|
1859
1859
|
const userText = typeof message === "string" ? message : message.text;
|
|
1860
1860
|
const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
|
|
1861
1861
|
const apiKey = resolveApiKey(this.options.apiKey);
|
|
1862
|
-
const useRealRuntime = apiKey !== void 0 && !
|
|
1862
|
+
const useRealRuntime = apiKey !== void 0 && !chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) && chunkSEWAPWAF_cjs.getConfiguredBaseUrl() !== void 0;
|
|
1863
1863
|
return useRealRuntime ? createRealCloudRun({
|
|
1864
1864
|
agentId: this.agentId,
|
|
1865
1865
|
model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
|
|
@@ -2653,7 +2653,7 @@ function resolveWindowForRun(model, contextWindow) {
|
|
|
2653
2653
|
const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
|
|
2654
2654
|
return chunkOVGNXGCK_cjs.resolveEffectiveContextWindow({
|
|
2655
2655
|
...override !== void 0 ? { override } : {},
|
|
2656
|
-
catalog:
|
|
2656
|
+
catalog: chunkT6KFGMNY_cjs.getCatalogModelInfo(model)?.limit?.context,
|
|
2657
2657
|
margin: chunkOVGNXGCK_cjs.CONTEXT_WINDOW_MARGIN,
|
|
2658
2658
|
floor: chunkOVGNXGCK_cjs.CONTEXT_WINDOW_FLOOR
|
|
2659
2659
|
});
|
|
@@ -2679,7 +2679,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2679
2679
|
try {
|
|
2680
2680
|
const parcial = await safeConversation(run);
|
|
2681
2681
|
if (parcial !== void 0) {
|
|
2682
|
-
|
|
2682
|
+
chunkN4JNY5DT_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
|
|
2683
2683
|
userText,
|
|
2684
2684
|
conversation: parcial
|
|
2685
2685
|
});
|
|
@@ -2689,11 +2689,11 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2689
2689
|
chunkA76OFN2B_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
|
|
2690
2690
|
`);
|
|
2691
2691
|
}
|
|
2692
|
-
await
|
|
2692
|
+
await chunkN4JNY5DT_cjs.flushSessionWrites();
|
|
2693
2693
|
return;
|
|
2694
2694
|
}
|
|
2695
2695
|
if (result.result !== void 0) {
|
|
2696
|
-
|
|
2696
|
+
chunkN4JNY5DT_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
|
|
2697
2697
|
}
|
|
2698
2698
|
const conversation = await safeConversation(run);
|
|
2699
2699
|
const resolvedWindow = resolveWindowForRun(model, contextWindow);
|
|
@@ -2704,7 +2704,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2704
2704
|
}
|
|
2705
2705
|
const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
|
|
2706
2706
|
const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
|
|
2707
|
-
|
|
2707
|
+
chunkN4JNY5DT_cjs.persistTurnToTranscript(
|
|
2708
2708
|
sessionStore,
|
|
2709
2709
|
{ cwd: workspaceCwd, agentId, model },
|
|
2710
2710
|
agentId,
|
|
@@ -2716,7 +2716,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2716
2716
|
// The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
|
|
2717
2717
|
// `contextWindow` here would budget against a number the clamp already rejected.
|
|
2718
2718
|
contextWindow: effectiveWindow,
|
|
2719
|
-
summarize:
|
|
2719
|
+
summarize: chunkSEWAPWAF_cjs.buildDefaultSummarizer({
|
|
2720
2720
|
agentModel: model,
|
|
2721
2721
|
...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
|
|
2722
2722
|
})
|
|
@@ -2758,7 +2758,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2758
2758
|
agentId,
|
|
2759
2759
|
runId: result.id
|
|
2760
2760
|
});
|
|
2761
|
-
await
|
|
2761
|
+
await chunkN4JNY5DT_cjs.flushSessionWrites();
|
|
2762
2762
|
}
|
|
2763
2763
|
async function safeConversation(run) {
|
|
2764
2764
|
try {
|
|
@@ -3345,7 +3345,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3345
3345
|
};
|
|
3346
3346
|
function safeRequire(moduleName) {
|
|
3347
3347
|
try {
|
|
3348
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3348
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-GKZY34TD.cjs', document.baseURI).href)));
|
|
3349
3349
|
return r(moduleName);
|
|
3350
3350
|
} catch {
|
|
3351
3351
|
return void 0;
|
|
@@ -3570,7 +3570,7 @@ var cachedOtel;
|
|
|
3570
3570
|
function loadOtel() {
|
|
3571
3571
|
if (cachedOtel === void 0) {
|
|
3572
3572
|
try {
|
|
3573
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3573
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-GKZY34TD.cjs', document.baseURI).href)));
|
|
3574
3574
|
const mod = r("@opentelemetry/api");
|
|
3575
3575
|
cachedOtel = mod;
|
|
3576
3576
|
} catch {
|
|
@@ -6078,7 +6078,7 @@ function applyToolResultGuard(parts, opts) {
|
|
|
6078
6078
|
(p) => (
|
|
6079
6079
|
// SE7 — guard the TEXT of a tool result (string or the text blocks of a
|
|
6080
6080
|
// structured content); image blocks pass through untouched.
|
|
6081
|
-
p.type === "tool_result" ? { ...p, content:
|
|
6081
|
+
p.type === "tool_result" ? { ...p, content: chunkSEWAPWAF_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
|
|
6082
6082
|
)
|
|
6083
6083
|
);
|
|
6084
6084
|
}
|
|
@@ -6273,7 +6273,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
6273
6273
|
const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
|
|
6274
6274
|
if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
|
|
6275
6275
|
for (const key of candidates) {
|
|
6276
|
-
const info =
|
|
6276
|
+
const info = chunkT6KFGMNY_cjs.getCatalogModelInfo(key);
|
|
6277
6277
|
const cost = info?.cost;
|
|
6278
6278
|
if (cost === void 0) continue;
|
|
6279
6279
|
const [prov, ...modelParts] = key.split("/");
|
|
@@ -6285,7 +6285,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
6285
6285
|
...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
|
|
6286
6286
|
...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
|
|
6287
6287
|
// M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
|
|
6288
|
-
pricingVersion:
|
|
6288
|
+
pricingVersion: chunkT6KFGMNY_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
|
|
6289
6289
|
};
|
|
6290
6290
|
}
|
|
6291
6291
|
return void 0;
|
|
@@ -6738,12 +6738,12 @@ var FallbackLlmClient = class {
|
|
|
6738
6738
|
let lastError;
|
|
6739
6739
|
for (const client of this.clients) {
|
|
6740
6740
|
if (signal.aborted) throw abortError(signal);
|
|
6741
|
-
const attempt = await
|
|
6741
|
+
const attempt = await chunkSEWAPWAF_cjs.tryFirstEvent(client, request, signal, true);
|
|
6742
6742
|
if (attempt.kind === "handshake_error") {
|
|
6743
6743
|
lastError = attempt.error;
|
|
6744
6744
|
continue;
|
|
6745
6745
|
}
|
|
6746
|
-
return yield*
|
|
6746
|
+
return yield* chunkSEWAPWAF_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
6747
6747
|
}
|
|
6748
6748
|
if (lastError !== void 0) throw lastError;
|
|
6749
6749
|
throw new chunkE7WWIX34_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
@@ -7124,7 +7124,7 @@ function resolveMcpCwd(configCwd) {
|
|
|
7124
7124
|
function registerPluginProviderProfiles(entries) {
|
|
7125
7125
|
let registered2 = 0;
|
|
7126
7126
|
for (const entry of entries) {
|
|
7127
|
-
|
|
7127
|
+
chunkT6KFGMNY_cjs.registerProvider(entry.profile);
|
|
7128
7128
|
registered2 += 1;
|
|
7129
7129
|
}
|
|
7130
7130
|
return registered2;
|
|
@@ -7313,7 +7313,7 @@ function createRealLocalRun(options) {
|
|
|
7313
7313
|
}
|
|
7314
7314
|
var pluginProvidersAnnounced = false;
|
|
7315
7315
|
function resolveRunProvider(options) {
|
|
7316
|
-
|
|
7316
|
+
chunkT6KFGMNY_cjs.registerBuiltins();
|
|
7317
7317
|
const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
|
|
7318
7318
|
const registered2 = registerPluginProviderProfiles(profiles);
|
|
7319
7319
|
if (registered2 > 0 && !pluginProvidersAnnounced) {
|
|
@@ -7323,15 +7323,15 @@ function resolveRunProvider(options) {
|
|
|
7323
7323
|
`);
|
|
7324
7324
|
}
|
|
7325
7325
|
const parsedModel = chunkVYHJZVL5_cjs.parseModelId(options.model?.id);
|
|
7326
|
-
const modelInferredProvider = parsedModel.provider !== void 0 &&
|
|
7327
|
-
const keyInferredProvider =
|
|
7328
|
-
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ??
|
|
7326
|
+
const modelInferredProvider = parsedModel.provider !== void 0 && chunkT6KFGMNY_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
|
|
7327
|
+
const keyInferredProvider = chunkSEWAPWAF_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
|
|
7328
|
+
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkSEWAPWAF_cjs.detectPrimaryProvider();
|
|
7329
7329
|
const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
|
|
7330
7330
|
return { primary, effectiveModelId };
|
|
7331
7331
|
}
|
|
7332
7332
|
function mergeExplicitApiKey(pools, primary, apiKey) {
|
|
7333
7333
|
if (apiKey === void 0 || apiKey.length === 0) return pools;
|
|
7334
|
-
if (
|
|
7334
|
+
if (chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
|
|
7335
7335
|
const existing = pools?.[primary];
|
|
7336
7336
|
if (existing !== void 0 && existing.length > 0) return pools;
|
|
7337
7337
|
return { ...pools ?? {}, [primary]: [apiKey] };
|
|
@@ -7354,7 +7354,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7354
7354
|
const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
|
|
7355
7355
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
7356
7356
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
7357
|
-
const chain =
|
|
7357
|
+
const chain = chunkSEWAPWAF_cjs.resolveProviderChain({
|
|
7358
7358
|
primary,
|
|
7359
7359
|
...fallback !== void 0 ? { fallback } : {},
|
|
7360
7360
|
...apiKeys !== void 0 ? { apiKeys } : {},
|
|
@@ -7626,7 +7626,7 @@ function buildRealRunOptions(args) {
|
|
|
7626
7626
|
};
|
|
7627
7627
|
}
|
|
7628
7628
|
async function createFixtureRunHelper(args) {
|
|
7629
|
-
const sessionMessages =
|
|
7629
|
+
const sessionMessages = chunkN4JNY5DT_cjs.getSessionMessages(args.inputs.agentId);
|
|
7630
7630
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
7631
7631
|
return createLocalRun({
|
|
7632
7632
|
agentId: args.inputs.agentId,
|
|
@@ -7645,7 +7645,7 @@ async function createFixtureRunHelper(args) {
|
|
|
7645
7645
|
}
|
|
7646
7646
|
async function dispatchLocalRun(args) {
|
|
7647
7647
|
const apiKey = resolveApiKey(args.inputs.options.apiKey);
|
|
7648
|
-
if (
|
|
7648
|
+
if (chunkSEWAPWAF_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
7649
7649
|
return createRealLocalRun(
|
|
7650
7650
|
buildRealRunOptions({
|
|
7651
7651
|
inputs: args.inputs,
|
|
@@ -7901,10 +7901,10 @@ async function disposeLocalAgentSession(agent) {
|
|
|
7901
7901
|
agent.lifecycleAbortController.abort();
|
|
7902
7902
|
await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
|
|
7903
7903
|
disposeSessionMcpClients(agent.agentId);
|
|
7904
|
-
await
|
|
7904
|
+
await chunkN4JNY5DT_cjs.flushSessionWrites();
|
|
7905
7905
|
await flushRegistrySaves(agent.workspaceCwd);
|
|
7906
7906
|
await disposeSessionStore(agent.sessionStore);
|
|
7907
|
-
|
|
7907
|
+
chunkN4JNY5DT_cjs.discardSession(agent.workspaceCwd, agent.agentId);
|
|
7908
7908
|
}
|
|
7909
7909
|
async function reloadLocalAgent(agent) {
|
|
7910
7910
|
if (agent.context !== void 0) await agent.context.refresh();
|
|
@@ -8679,7 +8679,7 @@ var LocalAgentMemory = class {
|
|
|
8679
8679
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
8680
8680
|
const cfg = this.options.memory?.activeRecall;
|
|
8681
8681
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
8682
|
-
if (this.breaker === void 0) this.breaker = new
|
|
8682
|
+
if (this.breaker === void 0) this.breaker = new chunkSEWAPWAF_cjs.CircuitBreaker();
|
|
8683
8683
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
8684
8684
|
const result = await runActiveMemory({
|
|
8685
8685
|
userText,
|
|
@@ -9081,8 +9081,8 @@ async function localAgentUsePersonality(args) {
|
|
|
9081
9081
|
registry,
|
|
9082
9082
|
store: args.personalityStore,
|
|
9083
9083
|
invalidateCache: (reason) => args.invalidateCache(reason),
|
|
9084
|
-
appendSessionMessage: (msg) =>
|
|
9085
|
-
clearSession: () =>
|
|
9084
|
+
appendSessionMessage: (msg) => chunkN4JNY5DT_cjs.appendSessionMessage(args.agentId, msg),
|
|
9085
|
+
clearSession: () => chunkN4JNY5DT_cjs.clearSession(args.agentId),
|
|
9086
9086
|
opts: args.opts ?? {}
|
|
9087
9087
|
})
|
|
9088
9088
|
);
|
|
@@ -9436,7 +9436,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9436
9436
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
9437
9437
|
await inputs.options.onBeforeSend({
|
|
9438
9438
|
conversationId: inputs.agentId,
|
|
9439
|
-
previousMessageCount:
|
|
9439
|
+
previousMessageCount: chunkN4JNY5DT_cjs.getSessionMessages(inputs.agentId).length
|
|
9440
9440
|
});
|
|
9441
9441
|
}
|
|
9442
9442
|
await inputs.runPreHook(userText);
|
|
@@ -9448,8 +9448,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9448
9448
|
userText,
|
|
9449
9449
|
sendOptions: options
|
|
9450
9450
|
});
|
|
9451
|
-
const priorMessages = [...
|
|
9452
|
-
|
|
9451
|
+
const priorMessages = [...chunkN4JNY5DT_cjs.getSessionMessages(inputs.agentId)];
|
|
9452
|
+
chunkN4JNY5DT_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
9453
9453
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9454
9454
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
|
|
9455
9455
|
const portPathActive = shouldUsePortMemoryPath();
|
|
@@ -9661,7 +9661,7 @@ var LocalAgent = class {
|
|
|
9661
9661
|
);
|
|
9662
9662
|
await acquireLeaseIfPossible(this.sessionStore, this.agentId);
|
|
9663
9663
|
try {
|
|
9664
|
-
await
|
|
9664
|
+
await chunkN4JNY5DT_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
9665
9665
|
await this.personalityStore.hydrate(this.agentId);
|
|
9666
9666
|
} catch (err) {
|
|
9667
9667
|
await releaseLeaseIfPossible(this.sessionStore, this.agentId);
|
|
@@ -9994,7 +9994,7 @@ async function createLocalAgent(options) {
|
|
|
9994
9994
|
if (apiKey === void 0) {
|
|
9995
9995
|
throw new chunkE7WWIX34_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
9996
9996
|
}
|
|
9997
|
-
const willFlowToProvider = !
|
|
9997
|
+
const willFlowToProvider = !chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) && !chunkSEWAPWAF_cjs.shouldUseRealLocalRuntime(apiKey);
|
|
9998
9998
|
const shape = validateApiKeyShape(apiKey, {
|
|
9999
9999
|
strict: willFlowToProvider,
|
|
10000
10000
|
// `options.model` is already normalized by `runCreateUnderSpan`; `normalizeModel`
|
|
@@ -10005,7 +10005,7 @@ async function createLocalAgent(options) {
|
|
|
10005
10005
|
if (shape.malformed) {
|
|
10006
10006
|
throw new chunkE7WWIX34_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
10007
10007
|
}
|
|
10008
|
-
if (!
|
|
10008
|
+
if (!chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) && chunkSEWAPWAF_cjs.getConfiguredBaseUrl() === void 0 && !chunkSEWAPWAF_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
10009
10009
|
throw new chunkE7WWIX34_cjs.AuthenticationError("Invalid API key", {
|
|
10010
10010
|
code: "authentication_error"
|
|
10011
10011
|
});
|
|
@@ -10025,11 +10025,11 @@ async function createCloudAgent(options) {
|
|
|
10025
10025
|
if (shape.malformed) {
|
|
10026
10026
|
throw new chunkE7WWIX34_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
10027
10027
|
}
|
|
10028
|
-
const baseUrl =
|
|
10028
|
+
const baseUrl = chunkSEWAPWAF_cjs.getConfiguredBaseUrl();
|
|
10029
10029
|
if (baseUrl === void 0) {
|
|
10030
10030
|
return new CloudAgent(options);
|
|
10031
10031
|
}
|
|
10032
|
-
const response = await
|
|
10032
|
+
const response = await chunkSEWAPWAF_cjs.httpRequest("/v1/agents", {
|
|
10033
10033
|
apiKey,
|
|
10034
10034
|
method: "POST",
|
|
10035
10035
|
body: {
|
|
@@ -10054,7 +10054,7 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
10054
10054
|
return process.cwd();
|
|
10055
10055
|
}
|
|
10056
10056
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
10057
|
-
await
|
|
10057
|
+
await chunkSEWAPWAF_cjs.discoverProviderPlugins();
|
|
10058
10058
|
await validateRehydratedAgent(agentId, existing);
|
|
10059
10059
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
10060
10060
|
const mergedOptions = {
|
|
@@ -10182,7 +10182,7 @@ var Agent = class _Agent {
|
|
|
10182
10182
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
10183
10183
|
});
|
|
10184
10184
|
try {
|
|
10185
|
-
await
|
|
10185
|
+
await chunkSEWAPWAF_cjs.discoverProviderPlugins();
|
|
10186
10186
|
const agent = await runCreateUnderSpan(options, span);
|
|
10187
10187
|
return agent;
|
|
10188
10188
|
} catch (err) {
|
|
@@ -10451,9 +10451,9 @@ var Agent = class _Agent {
|
|
|
10451
10451
|
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
10452
10452
|
);
|
|
10453
10453
|
}
|
|
10454
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
10454
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-TRCEYCPG.cjs');
|
|
10455
10455
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
10456
|
-
return
|
|
10456
|
+
return chunkN4JNY5DT_cjs.enqueueSessionWrite(
|
|
10457
10457
|
cwd,
|
|
10458
10458
|
agentId,
|
|
10459
10459
|
() => compactSessionTranscript({
|
|
@@ -10487,7 +10487,7 @@ var Agent = class _Agent {
|
|
|
10487
10487
|
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
10488
10488
|
);
|
|
10489
10489
|
}
|
|
10490
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
10490
|
+
const { injectSessionTurn } = await import('./inject-session-BVSERZCI.cjs');
|
|
10491
10491
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
10492
10492
|
await injectSessionTurn({
|
|
10493
10493
|
store,
|
|
@@ -10632,5 +10632,5 @@ exports.generateCronId = generateCronId;
|
|
|
10632
10632
|
exports.getPricingEntry = getPricingEntry;
|
|
10633
10633
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
10634
10634
|
exports.resolveApiKey = resolveApiKey;
|
|
10635
|
-
//# sourceMappingURL=chunk-
|
|
10636
|
-
//# sourceMappingURL=chunk-
|
|
10635
|
+
//# sourceMappingURL=chunk-GKZY34TD.cjs.map
|
|
10636
|
+
//# sourceMappingURL=chunk-GKZY34TD.cjs.map
|