@theokit/sdk 4.51.1 → 4.52.1
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 +44 -0
- package/dist/{agent-QWNWBCQZ.js → agent-RDHK6MVT.js} +6 -5
- package/dist/{agent-QWNWBCQZ.js.map → agent-RDHK6MVT.js.map} +1 -1
- package/dist/{agent-2KSLHB6B.cjs → agent-U2R2R5JP.cjs} +7 -6
- package/dist/{agent-2KSLHB6B.cjs.map → agent-U2R2R5JP.cjs.map} +1 -1
- package/dist/auth/index.cjs +5 -0
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +15 -0
- package/dist/auth/index.d.ts +15 -0
- package/dist/auth/index.js +1 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/{chunk-DRRSUUI5.js → chunk-42PLABFU.js} +3 -3
- package/dist/{chunk-DRRSUUI5.js.map → chunk-42PLABFU.js.map} +1 -1
- package/dist/{chunk-XI4L45SS.cjs → chunk-6GS7JI64.cjs} +43 -43
- package/dist/{chunk-XI4L45SS.cjs.map → chunk-6GS7JI64.cjs.map} +1 -1
- package/dist/{chunk-3BKWFISQ.cjs → chunk-CY7MIMI4.cjs} +3 -3
- package/dist/{chunk-3BKWFISQ.cjs.map → chunk-CY7MIMI4.cjs.map} +1 -1
- package/dist/chunk-FRITRLZQ.cjs +24 -0
- package/dist/chunk-FRITRLZQ.cjs.map +1 -0
- package/dist/{chunk-BVT6LFQ3.js → chunk-GNPI5IWZ.js} +3 -3
- package/dist/{chunk-BVT6LFQ3.js.map → chunk-GNPI5IWZ.js.map} +1 -1
- package/dist/{chunk-6CSIUJ5W.js → chunk-KELIQH7K.js} +6 -6
- package/dist/{chunk-6CSIUJ5W.js.map → chunk-KELIQH7K.js.map} +1 -1
- package/dist/{chunk-QVIUICFM.js → chunk-M5EK7N6R.js} +6 -14
- package/dist/chunk-M5EK7N6R.js.map +1 -0
- package/dist/chunk-NAF4L3T6.js +22 -0
- package/dist/chunk-NAF4L3T6.js.map +1 -0
- package/dist/{chunk-N6NUMXAJ.cjs → chunk-WLESQ3ZQ.cjs} +8 -16
- package/dist/chunk-WLESQ3ZQ.cjs.map +1 -0
- package/dist/{chunk-2S7IB4O3.cjs → chunk-ZNEE4WWQ.cjs} +5 -5
- package/dist/{chunk-2S7IB4O3.cjs.map → chunk-ZNEE4WWQ.cjs.map} +1 -1
- package/dist/{compact-session-AAFICMPQ.cjs → compact-session-FBVWO6B3.cjs} +12 -11
- package/dist/{compact-session-AAFICMPQ.cjs.map → compact-session-FBVWO6B3.cjs.map} +1 -1
- package/dist/{compact-session-LR73ESZX.js → compact-session-XLXC2CZN.js} +4 -3
- package/dist/{compact-session-LR73ESZX.js.map → compact-session-XLXC2CZN.js.map} +1 -1
- package/dist/cron.cjs +6 -5
- package/dist/cron.js +5 -4
- package/dist/eval.cjs +5 -4
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +4 -3
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +28 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-KOGUD6KM.cjs → inject-session-UBAQ7I3G.cjs} +4 -4
- package/dist/{inject-session-KOGUD6KM.cjs.map → inject-session-UBAQ7I3G.cjs.map} +1 -1
- package/dist/{inject-session-6ZAFN7F7.js → inject-session-UEH5MAKU.js} +3 -3
- package/dist/{inject-session-6ZAFN7F7.js.map → inject-session-UEH5MAKU.js.map} +1 -1
- package/dist/internal/auth/api-key-prefix.d.ts +23 -0
- package/package.json +1 -1
- package/dist/chunk-N6NUMXAJ.cjs.map +0 -1
- package/dist/chunk-QVIUICFM.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCY7MIMI4_cjs = require('./chunk-CY7MIMI4.cjs');
|
|
4
4
|
var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
|
|
5
5
|
var chunk6DCTL32L_cjs = require('./chunk-6DCTL32L.cjs');
|
|
6
6
|
var chunkOI6RHLGC_cjs = require('./chunk-OI6RHLGC.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkWLESQ3ZQ_cjs = require('./chunk-WLESQ3ZQ.cjs');
|
|
8
8
|
var chunkEQMLJ52C_cjs = require('./chunk-EQMLJ52C.cjs');
|
|
9
9
|
var chunk3YYDHUNH_cjs = require('./chunk-3YYDHUNH.cjs');
|
|
10
10
|
var chunkBBZYXVLZ_cjs = require('./chunk-BBZYXVLZ.cjs');
|
|
@@ -1617,7 +1617,7 @@ function createRealCloudRun(options) {
|
|
|
1617
1617
|
conversation: []
|
|
1618
1618
|
};
|
|
1619
1619
|
const apiKey = resolveApiKey(options.agentOptions.apiKey);
|
|
1620
|
-
const baseUrl =
|
|
1620
|
+
const baseUrl = chunkWLESQ3ZQ_cjs.getConfiguredBaseUrl();
|
|
1621
1621
|
const handle = new RealCloudRun(
|
|
1622
1622
|
{
|
|
1623
1623
|
id,
|
|
@@ -1700,7 +1700,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1700
1700
|
async consumeStream(response) {
|
|
1701
1701
|
let finalStatus = "finished";
|
|
1702
1702
|
let finalText = "";
|
|
1703
|
-
for await (const record of
|
|
1703
|
+
for await (const record of chunkWLESQ3ZQ_cjs.parseSseStream(response.body, this.controller.signal)) {
|
|
1704
1704
|
const parsed = safeParse(record.data);
|
|
1705
1705
|
if (parsed === void 0) continue;
|
|
1706
1706
|
const update = this.applyRecord(record.event, parsed);
|
|
@@ -1809,7 +1809,7 @@ var CloudAgent = class {
|
|
|
1809
1809
|
*/
|
|
1810
1810
|
isFixtureMode() {
|
|
1811
1811
|
const apiKey = resolveApiKey(this.options.apiKey);
|
|
1812
|
-
return
|
|
1812
|
+
return chunkWLESQ3ZQ_cjs.isFixtureApiKey(apiKey) && chunkWLESQ3ZQ_cjs.getConfiguredBaseUrl() === void 0;
|
|
1813
1813
|
}
|
|
1814
1814
|
// SE9 — integrated structured output; delegates to the shared helper.
|
|
1815
1815
|
generate(message, options) {
|
|
@@ -1860,7 +1860,7 @@ var CloudAgent = class {
|
|
|
1860
1860
|
const userText = typeof message === "string" ? message : message.text;
|
|
1861
1861
|
const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
|
|
1862
1862
|
const apiKey = resolveApiKey(this.options.apiKey);
|
|
1863
|
-
const useRealRuntime = apiKey !== void 0 && !
|
|
1863
|
+
const useRealRuntime = apiKey !== void 0 && !chunkWLESQ3ZQ_cjs.isFixtureApiKey(apiKey) && chunkWLESQ3ZQ_cjs.getConfiguredBaseUrl() !== void 0;
|
|
1864
1864
|
return useRealRuntime ? createRealCloudRun({
|
|
1865
1865
|
agentId: this.agentId,
|
|
1866
1866
|
model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
|
|
@@ -2680,7 +2680,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2680
2680
|
try {
|
|
2681
2681
|
const partial = await safeConversation(run);
|
|
2682
2682
|
if (partial !== void 0) {
|
|
2683
|
-
|
|
2683
|
+
chunkCY7MIMI4_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
|
|
2684
2684
|
userText,
|
|
2685
2685
|
conversation: partial
|
|
2686
2686
|
});
|
|
@@ -2690,11 +2690,11 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2690
2690
|
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
|
|
2691
2691
|
`);
|
|
2692
2692
|
}
|
|
2693
|
-
await
|
|
2693
|
+
await chunkCY7MIMI4_cjs.flushSessionWrites();
|
|
2694
2694
|
return;
|
|
2695
2695
|
}
|
|
2696
2696
|
if (result.result !== void 0) {
|
|
2697
|
-
|
|
2697
|
+
chunkCY7MIMI4_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
|
|
2698
2698
|
}
|
|
2699
2699
|
const conversation = await safeConversation(run);
|
|
2700
2700
|
const resolvedWindow = resolveWindowForRun(model, contextWindow);
|
|
@@ -2705,7 +2705,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2705
2705
|
}
|
|
2706
2706
|
const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
|
|
2707
2707
|
const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
|
|
2708
|
-
|
|
2708
|
+
chunkCY7MIMI4_cjs.persistTurnToTranscript(
|
|
2709
2709
|
sessionStore,
|
|
2710
2710
|
{ cwd: workspaceCwd, agentId, model },
|
|
2711
2711
|
agentId,
|
|
@@ -2717,7 +2717,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2717
2717
|
// The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
|
|
2718
2718
|
// `contextWindow` here would budget against a number the clamp already rejected.
|
|
2719
2719
|
contextWindow: effectiveWindow,
|
|
2720
|
-
summarize:
|
|
2720
|
+
summarize: chunkWLESQ3ZQ_cjs.buildDefaultSummarizer({
|
|
2721
2721
|
agentModel: model,
|
|
2722
2722
|
...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
|
|
2723
2723
|
})
|
|
@@ -2759,7 +2759,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2759
2759
|
agentId,
|
|
2760
2760
|
runId: result.id
|
|
2761
2761
|
});
|
|
2762
|
-
await
|
|
2762
|
+
await chunkCY7MIMI4_cjs.flushSessionWrites();
|
|
2763
2763
|
}
|
|
2764
2764
|
async function safeConversation(run) {
|
|
2765
2765
|
try {
|
|
@@ -3346,7 +3346,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3346
3346
|
};
|
|
3347
3347
|
function safeRequire(moduleName) {
|
|
3348
3348
|
try {
|
|
3349
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3349
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-6GS7JI64.cjs', document.baseURI).href)));
|
|
3350
3350
|
return r(moduleName);
|
|
3351
3351
|
} catch {
|
|
3352
3352
|
return void 0;
|
|
@@ -3571,7 +3571,7 @@ var cachedOtel;
|
|
|
3571
3571
|
function loadOtel() {
|
|
3572
3572
|
if (cachedOtel === void 0) {
|
|
3573
3573
|
try {
|
|
3574
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3574
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-6GS7JI64.cjs', document.baseURI).href)));
|
|
3575
3575
|
const mod = r("@opentelemetry/api");
|
|
3576
3576
|
cachedOtel = mod;
|
|
3577
3577
|
} catch {
|
|
@@ -5770,7 +5770,7 @@ function applyToolResultGuard(parts, opts) {
|
|
|
5770
5770
|
(p) => (
|
|
5771
5771
|
// SE7 — guard the TEXT of a tool result (string or the text blocks of a
|
|
5772
5772
|
// structured content); image blocks pass through untouched.
|
|
5773
|
-
p.type === "tool_result" ? { ...p, content:
|
|
5773
|
+
p.type === "tool_result" ? { ...p, content: chunkWLESQ3ZQ_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
|
|
5774
5774
|
)
|
|
5775
5775
|
);
|
|
5776
5776
|
}
|
|
@@ -6430,12 +6430,12 @@ var FallbackLlmClient = class {
|
|
|
6430
6430
|
let lastError;
|
|
6431
6431
|
for (const client of this.clients) {
|
|
6432
6432
|
if (signal.aborted) throw abortError(signal);
|
|
6433
|
-
const attempt = await
|
|
6433
|
+
const attempt = await chunkWLESQ3ZQ_cjs.tryFirstEvent(client, request, signal, true);
|
|
6434
6434
|
if (attempt.kind === "handshake_error") {
|
|
6435
6435
|
lastError = attempt.error;
|
|
6436
6436
|
continue;
|
|
6437
6437
|
}
|
|
6438
|
-
return yield*
|
|
6438
|
+
return yield* chunkWLESQ3ZQ_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
6439
6439
|
}
|
|
6440
6440
|
if (lastError !== void 0) throw lastError;
|
|
6441
6441
|
throw new chunk2YGIBOUH_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
@@ -7016,14 +7016,14 @@ function resolveRunProvider(options) {
|
|
|
7016
7016
|
}
|
|
7017
7017
|
const parsedModel = chunkVYHJZVL5_cjs.parseModelId(options.model?.id);
|
|
7018
7018
|
const modelInferredProvider = parsedModel.provider !== void 0 && chunkT6ZCG5AP_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
|
|
7019
|
-
const keyInferredProvider =
|
|
7020
|
-
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ??
|
|
7019
|
+
const keyInferredProvider = chunkWLESQ3ZQ_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
|
|
7020
|
+
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkWLESQ3ZQ_cjs.detectPrimaryProvider();
|
|
7021
7021
|
const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
|
|
7022
7022
|
return { primary, effectiveModelId };
|
|
7023
7023
|
}
|
|
7024
7024
|
function mergeExplicitApiKey(pools, primary, apiKey) {
|
|
7025
7025
|
if (apiKey === void 0 || apiKey.length === 0) return pools;
|
|
7026
|
-
if (
|
|
7026
|
+
if (chunkWLESQ3ZQ_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
|
|
7027
7027
|
const existing = pools?.[primary];
|
|
7028
7028
|
if (existing !== void 0 && existing.length > 0) return pools;
|
|
7029
7029
|
return { ...pools ?? {}, [primary]: [apiKey] };
|
|
@@ -7046,7 +7046,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7046
7046
|
const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
|
|
7047
7047
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
7048
7048
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
7049
|
-
const chain =
|
|
7049
|
+
const chain = chunkWLESQ3ZQ_cjs.resolveProviderChain({
|
|
7050
7050
|
primary,
|
|
7051
7051
|
...fallback !== void 0 ? { fallback } : {},
|
|
7052
7052
|
...apiKeys !== void 0 ? { apiKeys } : {},
|
|
@@ -7328,7 +7328,7 @@ function buildRealRunOptions(args) {
|
|
|
7328
7328
|
};
|
|
7329
7329
|
}
|
|
7330
7330
|
async function createFixtureRunHelper(args) {
|
|
7331
|
-
const sessionMessages =
|
|
7331
|
+
const sessionMessages = chunkCY7MIMI4_cjs.getSessionMessages(args.inputs.agentId);
|
|
7332
7332
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
7333
7333
|
return createLocalRun({
|
|
7334
7334
|
agentId: args.inputs.agentId,
|
|
@@ -7347,7 +7347,7 @@ async function createFixtureRunHelper(args) {
|
|
|
7347
7347
|
}
|
|
7348
7348
|
async function dispatchLocalRun(args) {
|
|
7349
7349
|
const apiKey = resolveApiKey(args.inputs.options.apiKey);
|
|
7350
|
-
if (
|
|
7350
|
+
if (chunkWLESQ3ZQ_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
7351
7351
|
return createRealLocalRun(
|
|
7352
7352
|
buildRealRunOptions({
|
|
7353
7353
|
inputs: args.inputs,
|
|
@@ -7603,10 +7603,10 @@ async function disposeLocalAgentSession(agent) {
|
|
|
7603
7603
|
agent.lifecycleAbortController.abort();
|
|
7604
7604
|
await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
|
|
7605
7605
|
disposeSessionMcpClients(agent.agentId);
|
|
7606
|
-
await
|
|
7606
|
+
await chunkCY7MIMI4_cjs.flushSessionWrites();
|
|
7607
7607
|
await flushRegistrySaves(agent.workspaceCwd);
|
|
7608
7608
|
await disposeSessionStore(agent.sessionStore);
|
|
7609
|
-
|
|
7609
|
+
chunkCY7MIMI4_cjs.discardSession(agent.workspaceCwd, agent.agentId);
|
|
7610
7610
|
}
|
|
7611
7611
|
async function reloadLocalAgent(agent) {
|
|
7612
7612
|
if (agent.context !== void 0) await agent.context.refresh();
|
|
@@ -8380,7 +8380,7 @@ var LocalAgentMemory = class {
|
|
|
8380
8380
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
8381
8381
|
const cfg = this.options.memory?.activeRecall;
|
|
8382
8382
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
8383
|
-
if (this.breaker === void 0) this.breaker = new
|
|
8383
|
+
if (this.breaker === void 0) this.breaker = new chunkWLESQ3ZQ_cjs.CircuitBreaker();
|
|
8384
8384
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
8385
8385
|
const result = await runActiveMemory({
|
|
8386
8386
|
userText,
|
|
@@ -8782,8 +8782,8 @@ async function localAgentUsePersonality(args) {
|
|
|
8782
8782
|
registry,
|
|
8783
8783
|
store: args.personalityStore,
|
|
8784
8784
|
invalidateCache: (reason) => args.invalidateCache(reason),
|
|
8785
|
-
appendSessionMessage: (msg) =>
|
|
8786
|
-
clearSession: () =>
|
|
8785
|
+
appendSessionMessage: (msg) => chunkCY7MIMI4_cjs.appendSessionMessage(args.agentId, msg),
|
|
8786
|
+
clearSession: () => chunkCY7MIMI4_cjs.clearSession(args.agentId),
|
|
8787
8787
|
opts: args.opts ?? {}
|
|
8788
8788
|
})
|
|
8789
8789
|
);
|
|
@@ -9137,7 +9137,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9137
9137
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
9138
9138
|
await inputs.options.onBeforeSend({
|
|
9139
9139
|
conversationId: inputs.agentId,
|
|
9140
|
-
previousMessageCount:
|
|
9140
|
+
previousMessageCount: chunkCY7MIMI4_cjs.getSessionMessages(inputs.agentId).length
|
|
9141
9141
|
});
|
|
9142
9142
|
}
|
|
9143
9143
|
await inputs.runPreHook(userText);
|
|
@@ -9149,8 +9149,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9149
9149
|
userText,
|
|
9150
9150
|
sendOptions: options
|
|
9151
9151
|
});
|
|
9152
|
-
const priorMessages = [...
|
|
9153
|
-
|
|
9152
|
+
const priorMessages = [...chunkCY7MIMI4_cjs.getSessionMessages(inputs.agentId)];
|
|
9153
|
+
chunkCY7MIMI4_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
9154
9154
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9155
9155
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
|
|
9156
9156
|
const portPathActive = shouldUsePortMemoryPath();
|
|
@@ -9362,7 +9362,7 @@ var LocalAgent = class {
|
|
|
9362
9362
|
);
|
|
9363
9363
|
await acquireLeaseIfPossible(this.sessionStore, this.agentId);
|
|
9364
9364
|
try {
|
|
9365
|
-
await
|
|
9365
|
+
await chunkCY7MIMI4_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
9366
9366
|
await this.personalityStore.hydrate(this.agentId);
|
|
9367
9367
|
} catch (err) {
|
|
9368
9368
|
await releaseLeaseIfPossible(this.sessionStore, this.agentId);
|
|
@@ -9695,7 +9695,7 @@ async function createLocalAgent(options) {
|
|
|
9695
9695
|
if (apiKey === void 0) {
|
|
9696
9696
|
throw new chunk2YGIBOUH_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
9697
9697
|
}
|
|
9698
|
-
const willFlowToProvider = !
|
|
9698
|
+
const willFlowToProvider = !chunkWLESQ3ZQ_cjs.isFixtureApiKey(apiKey) && !chunkWLESQ3ZQ_cjs.shouldUseRealLocalRuntime(apiKey);
|
|
9699
9699
|
const shape = validateApiKeyShape(apiKey, {
|
|
9700
9700
|
strict: willFlowToProvider,
|
|
9701
9701
|
// `options.model` is already normalized by `runCreateUnderSpan`; `normalizeModel`
|
|
@@ -9706,7 +9706,7 @@ async function createLocalAgent(options) {
|
|
|
9706
9706
|
if (shape.malformed) {
|
|
9707
9707
|
throw new chunk2YGIBOUH_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
9708
9708
|
}
|
|
9709
|
-
if (!
|
|
9709
|
+
if (!chunkWLESQ3ZQ_cjs.isFixtureApiKey(apiKey) && chunkWLESQ3ZQ_cjs.getConfiguredBaseUrl() === void 0 && !chunkWLESQ3ZQ_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
9710
9710
|
throw new chunk2YGIBOUH_cjs.AuthenticationError("Invalid API key", {
|
|
9711
9711
|
code: "authentication_error"
|
|
9712
9712
|
});
|
|
@@ -9726,11 +9726,11 @@ async function createCloudAgent(options) {
|
|
|
9726
9726
|
if (shape.malformed) {
|
|
9727
9727
|
throw new chunk2YGIBOUH_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
9728
9728
|
}
|
|
9729
|
-
const baseUrl =
|
|
9729
|
+
const baseUrl = chunkWLESQ3ZQ_cjs.getConfiguredBaseUrl();
|
|
9730
9730
|
if (baseUrl === void 0) {
|
|
9731
9731
|
return new CloudAgent(options);
|
|
9732
9732
|
}
|
|
9733
|
-
const response = await
|
|
9733
|
+
const response = await chunkWLESQ3ZQ_cjs.httpRequest("/v1/agents", {
|
|
9734
9734
|
apiKey,
|
|
9735
9735
|
method: "POST",
|
|
9736
9736
|
body: {
|
|
@@ -9755,7 +9755,7 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
9755
9755
|
return process.cwd();
|
|
9756
9756
|
}
|
|
9757
9757
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
9758
|
-
await
|
|
9758
|
+
await chunkWLESQ3ZQ_cjs.discoverProviderPlugins();
|
|
9759
9759
|
await validateRehydratedAgent(agentId, existing);
|
|
9760
9760
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
9761
9761
|
const mergedOptions = {
|
|
@@ -9883,7 +9883,7 @@ var Agent = class _Agent {
|
|
|
9883
9883
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
9884
9884
|
});
|
|
9885
9885
|
try {
|
|
9886
|
-
await
|
|
9886
|
+
await chunkWLESQ3ZQ_cjs.discoverProviderPlugins();
|
|
9887
9887
|
const agent = await runCreateUnderSpan(options, span);
|
|
9888
9888
|
return agent;
|
|
9889
9889
|
} catch (err) {
|
|
@@ -10152,9 +10152,9 @@ var Agent = class _Agent {
|
|
|
10152
10152
|
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
10153
10153
|
);
|
|
10154
10154
|
}
|
|
10155
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
10155
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-FBVWO6B3.cjs');
|
|
10156
10156
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
10157
|
-
return
|
|
10157
|
+
return chunkCY7MIMI4_cjs.enqueueSessionWrite(
|
|
10158
10158
|
cwd,
|
|
10159
10159
|
agentId,
|
|
10160
10160
|
() => compactSessionTranscript({
|
|
@@ -10188,7 +10188,7 @@ var Agent = class _Agent {
|
|
|
10188
10188
|
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
10189
10189
|
);
|
|
10190
10190
|
}
|
|
10191
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
10191
|
+
const { injectSessionTurn } = await import('./inject-session-UBAQ7I3G.cjs');
|
|
10192
10192
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
10193
10193
|
await injectSessionTurn({
|
|
10194
10194
|
store,
|
|
@@ -10333,5 +10333,5 @@ exports.generateCronId = generateCronId;
|
|
|
10333
10333
|
exports.getPricingEntry = getPricingEntry;
|
|
10334
10334
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
10335
10335
|
exports.resolveApiKey = resolveApiKey;
|
|
10336
|
-
//# sourceMappingURL=chunk-
|
|
10337
|
-
//# sourceMappingURL=chunk-
|
|
10336
|
+
//# sourceMappingURL=chunk-6GS7JI64.cjs.map
|
|
10337
|
+
//# sourceMappingURL=chunk-6GS7JI64.cjs.map
|