@theokit/sdk 5.15.0 → 5.15.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 +12 -0
- package/dist/{agent-DRDGUU6T.js → agent-66U5QCPF.js} +5 -5
- package/dist/{agent-DRDGUU6T.js.map → agent-66U5QCPF.js.map} +1 -1
- package/dist/{agent-B6FQad6P.d.cts → agent-BL4kxgwq.d.cts} +7 -1
- package/dist/{agent-B6C9i_qu.d.ts → agent-ByDx7K30.d.ts} +7 -1
- package/dist/{agent-VI2HITPT.cjs → agent-CB27KF6O.cjs} +6 -6
- package/dist/{agent-VI2HITPT.cjs.map → agent-CB27KF6O.cjs.map} +1 -1
- package/dist/{chunk-IOBHFP2E.js → chunk-26GI3OYA.js} +71 -4
- package/dist/chunk-26GI3OYA.js.map +1 -0
- package/dist/{chunk-64ECM3XM.cjs → chunk-26UQG242.cjs} +49 -49
- package/dist/{chunk-64ECM3XM.cjs.map → chunk-26UQG242.cjs.map} +1 -1
- package/dist/{chunk-DJKGDLYZ.cjs → chunk-3E3VSMB6.cjs} +73 -6
- package/dist/{chunk-DJKGDLYZ.cjs.map → chunk-3E3VSMB6.cjs.map} +1 -1
- package/dist/{chunk-U7PRI3XM.cjs → chunk-FBIDOOJM.cjs} +3 -3
- package/dist/{chunk-U7PRI3XM.cjs.map → chunk-FBIDOOJM.cjs.map} +1 -1
- package/dist/{chunk-ARC2V7NY.js → chunk-O2RCS3SJ.js} +3 -3
- package/dist/{chunk-ARC2V7NY.js.map → chunk-O2RCS3SJ.js.map} +1 -1
- package/dist/{chunk-KMFBNKCT.cjs → chunk-TRPRTZEH.cjs} +4 -4
- package/dist/{chunk-KMFBNKCT.cjs.map → chunk-TRPRTZEH.cjs.map} +1 -1
- package/dist/{chunk-23SS4ID4.js → chunk-VNRNZ3WI.js} +3 -3
- package/dist/{chunk-23SS4ID4.js.map → chunk-VNRNZ3WI.js.map} +1 -1
- package/dist/{chunk-5M5GQYBM.js → chunk-ZQWRUJHE.js} +6 -6
- package/dist/{chunk-5M5GQYBM.js.map → chunk-ZQWRUJHE.js.map} +1 -1
- package/dist/{compact-session-NX7HUNTB.cjs → compact-session-CHBJOYWP.cjs} +12 -12
- package/dist/{compact-session-NX7HUNTB.cjs.map → compact-session-CHBJOYWP.cjs.map} +1 -1
- package/dist/{compact-session-Q5IGNFPW.js → compact-session-F3J3FMEU.js} +3 -3
- package/dist/{compact-session-Q5IGNFPW.js.map → compact-session-F3J3FMEU.js.map} +1 -1
- package/dist/{cron-Bh3aWgQ2.d.cts → cron-B7KH9sHW.d.cts} +1 -1
- package/dist/{cron-CCDxeeFZ.d.ts → cron-FEO7UAQF.d.ts} +1 -1
- package/dist/cron.cjs +5 -5
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +4 -4
- package/dist/eval.cjs +4 -4
- package/dist/eval.js +3 -3
- package/dist/index.cjs +31 -31
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -7
- package/dist/{inject-session-4ROYLZHY.js → inject-session-LC2TROHM.js} +3 -3
- package/dist/{inject-session-4ROYLZHY.js.map → inject-session-LC2TROHM.js.map} +1 -1
- package/dist/{inject-session-AWKDCGHV.cjs → inject-session-T4RXANG3.cjs} +4 -4
- package/dist/{inject-session-AWKDCGHV.cjs.map → inject-session-T4RXANG3.cjs.map} +1 -1
- package/dist/internal/llm/hermes-tool-extract.d.ts +2 -0
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/types/hooks.d.ts +7 -1
- package/package.json +1 -1
- package/dist/chunk-IOBHFP2E.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkL7JPXZ2C_cjs = require('./chunk-L7JPXZ2C.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkFBIDOOJM_cjs = require('./chunk-FBIDOOJM.cjs');
|
|
5
5
|
var chunkNEH3BPFD_cjs = require('./chunk-NEH3BPFD.cjs');
|
|
6
6
|
var chunk7YUPSBDV_cjs = require('./chunk-7YUPSBDV.cjs');
|
|
7
7
|
var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
|
|
@@ -9,7 +9,7 @@ var chunkXE3CAY6Z_cjs = require('./chunk-XE3CAY6Z.cjs');
|
|
|
9
9
|
var chunkRS7YQR4X_cjs = require('./chunk-RS7YQR4X.cjs');
|
|
10
10
|
var chunkVWYFGE27_cjs = require('./chunk-VWYFGE27.cjs');
|
|
11
11
|
var chunkFTXY4D44_cjs = require('./chunk-FTXY4D44.cjs');
|
|
12
|
-
var
|
|
12
|
+
var chunk3E3VSMB6_cjs = require('./chunk-3E3VSMB6.cjs');
|
|
13
13
|
var chunk2ZPEDVLM_cjs = require('./chunk-2ZPEDVLM.cjs');
|
|
14
14
|
var chunkQG4SXZ2A_cjs = require('./chunk-QG4SXZ2A.cjs');
|
|
15
15
|
var chunkUDAKAE4Z_cjs = require('./chunk-UDAKAE4Z.cjs');
|
|
@@ -1625,7 +1625,7 @@ function createRealCloudRun(options) {
|
|
|
1625
1625
|
conversation: []
|
|
1626
1626
|
};
|
|
1627
1627
|
const apiKey = chunkRNXXYF22_cjs.resolveApiKey(options.agentOptions.apiKey);
|
|
1628
|
-
const baseUrl =
|
|
1628
|
+
const baseUrl = chunk3E3VSMB6_cjs.getConfiguredBaseUrl();
|
|
1629
1629
|
const handle = new RealCloudRun(
|
|
1630
1630
|
{
|
|
1631
1631
|
id,
|
|
@@ -1711,7 +1711,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1711
1711
|
async consumeStream(response) {
|
|
1712
1712
|
let finalStatus = "finished";
|
|
1713
1713
|
let finalText = "";
|
|
1714
|
-
for await (const record of
|
|
1714
|
+
for await (const record of chunk3E3VSMB6_cjs.parseSseStream(response.body, this.controller.signal)) {
|
|
1715
1715
|
const parsed = safeParse(record.data);
|
|
1716
1716
|
if (parsed === void 0) continue;
|
|
1717
1717
|
const update = this.applyRecord(record.event, parsed);
|
|
@@ -1882,7 +1882,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1882
1882
|
*/
|
|
1883
1883
|
isFixtureMode() {
|
|
1884
1884
|
const apiKey = chunkRNXXYF22_cjs.resolveApiKey(this.options.apiKey);
|
|
1885
|
-
return
|
|
1885
|
+
return chunk3E3VSMB6_cjs.isFixtureApiKey(apiKey) && chunk3E3VSMB6_cjs.getConfiguredBaseUrl() === void 0;
|
|
1886
1886
|
}
|
|
1887
1887
|
// SE9 — integrated structured output; delegates to the shared helper.
|
|
1888
1888
|
generate(message, options) {
|
|
@@ -1937,7 +1937,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1937
1937
|
const userText = typeof message === "string" ? message : message.text;
|
|
1938
1938
|
const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
|
|
1939
1939
|
const apiKey = chunkRNXXYF22_cjs.resolveApiKey(this.options.apiKey);
|
|
1940
|
-
const useRealRuntime = apiKey !== void 0 && !
|
|
1940
|
+
const useRealRuntime = apiKey !== void 0 && !chunk3E3VSMB6_cjs.isFixtureApiKey(apiKey) && chunk3E3VSMB6_cjs.getConfiguredBaseUrl() !== void 0;
|
|
1941
1941
|
return useRealRuntime ? createRealCloudRun({
|
|
1942
1942
|
agentId: this.agentId,
|
|
1943
1943
|
model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
|
|
@@ -3002,7 +3002,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
3002
3002
|
try {
|
|
3003
3003
|
const partial = await safeConversation(run);
|
|
3004
3004
|
if (partial !== void 0) {
|
|
3005
|
-
|
|
3005
|
+
chunkFBIDOOJM_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
|
|
3006
3006
|
userText,
|
|
3007
3007
|
conversation: partial
|
|
3008
3008
|
});
|
|
@@ -3012,11 +3012,11 @@ async function runPostRunLifecycle(inputs) {
|
|
|
3012
3012
|
chunkRNXXYF22_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
|
|
3013
3013
|
`);
|
|
3014
3014
|
}
|
|
3015
|
-
await
|
|
3015
|
+
await chunkFBIDOOJM_cjs.flushSessionWrites();
|
|
3016
3016
|
return;
|
|
3017
3017
|
}
|
|
3018
3018
|
if (result.result !== void 0) {
|
|
3019
|
-
|
|
3019
|
+
chunkFBIDOOJM_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
|
|
3020
3020
|
}
|
|
3021
3021
|
const conversation = await safeConversation(run);
|
|
3022
3022
|
const resolvedWindow = resolveWindowForRun(model, contextWindow);
|
|
@@ -3027,7 +3027,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
3027
3027
|
}
|
|
3028
3028
|
const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
|
|
3029
3029
|
const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
|
|
3030
|
-
|
|
3030
|
+
chunkFBIDOOJM_cjs.persistTurnToTranscript(
|
|
3031
3031
|
sessionStore,
|
|
3032
3032
|
{ cwd: workspaceCwd, agentId, model },
|
|
3033
3033
|
agentId,
|
|
@@ -3039,7 +3039,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
3039
3039
|
// The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
|
|
3040
3040
|
// `contextWindow` here would budget against a number the clamp already rejected.
|
|
3041
3041
|
contextWindow: effectiveWindow,
|
|
3042
|
-
summarize:
|
|
3042
|
+
summarize: chunk3E3VSMB6_cjs.buildDefaultSummarizer({
|
|
3043
3043
|
agentModel: model,
|
|
3044
3044
|
...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
|
|
3045
3045
|
})
|
|
@@ -3081,7 +3081,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
3081
3081
|
agentId,
|
|
3082
3082
|
runId: result.id
|
|
3083
3083
|
});
|
|
3084
|
-
await
|
|
3084
|
+
await chunkFBIDOOJM_cjs.flushSessionWrites();
|
|
3085
3085
|
}
|
|
3086
3086
|
async function safeConversation(run) {
|
|
3087
3087
|
try {
|
|
@@ -3098,12 +3098,12 @@ var WORKSPACE_TRUST = {
|
|
|
3098
3098
|
entries: "absolute folder realpaths"
|
|
3099
3099
|
};
|
|
3100
3100
|
function workspaceTrustRecordPath() {
|
|
3101
|
-
return path.join(path.dirname(
|
|
3101
|
+
return path.join(path.dirname(chunk3E3VSMB6_cjs.trustFilePath()), "trusted-workspace-plugins.json");
|
|
3102
3102
|
}
|
|
3103
3103
|
function readTrustedWorkspaceFolders() {
|
|
3104
3104
|
const path$1 = workspaceTrustRecordPath();
|
|
3105
3105
|
const trusted = /* @__PURE__ */ new Set();
|
|
3106
|
-
for (const entry of
|
|
3106
|
+
for (const entry of chunk3E3VSMB6_cjs.readTrustArray(path$1, WORKSPACE_TRUST)) {
|
|
3107
3107
|
if (path.isAbsolute(entry)) {
|
|
3108
3108
|
trusted.add(entry);
|
|
3109
3109
|
continue;
|
|
@@ -4013,7 +4013,7 @@ var HISTOGRAM_NAMES = {
|
|
|
4013
4013
|
};
|
|
4014
4014
|
function safeRequire(moduleName) {
|
|
4015
4015
|
try {
|
|
4016
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
4016
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-26UQG242.cjs', document.baseURI).href)));
|
|
4017
4017
|
return r(moduleName);
|
|
4018
4018
|
} catch {
|
|
4019
4019
|
return void 0;
|
|
@@ -4256,7 +4256,7 @@ var cachedOtel;
|
|
|
4256
4256
|
function loadOtel() {
|
|
4257
4257
|
if (cachedOtel === void 0) {
|
|
4258
4258
|
try {
|
|
4259
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
4259
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-26UQG242.cjs', document.baseURI).href)));
|
|
4260
4260
|
const mod = r("@opentelemetry/api");
|
|
4261
4261
|
cachedOtel = mod;
|
|
4262
4262
|
} catch {
|
|
@@ -7192,7 +7192,7 @@ function applyToolResultGuard(parts, opts) {
|
|
|
7192
7192
|
(p) => (
|
|
7193
7193
|
// SE7 — guard the TEXT of a tool result (string or the text blocks of a
|
|
7194
7194
|
// structured content); image blocks pass through untouched.
|
|
7195
|
-
p.type === "tool_result" ? { ...p, content:
|
|
7195
|
+
p.type === "tool_result" ? { ...p, content: chunk3E3VSMB6_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
|
|
7196
7196
|
)
|
|
7197
7197
|
);
|
|
7198
7198
|
}
|
|
@@ -7534,13 +7534,13 @@ var FallbackLlmClient = class {
|
|
|
7534
7534
|
async *stream(request, signal) {
|
|
7535
7535
|
let lastError;
|
|
7536
7536
|
for (const client of this.clients) {
|
|
7537
|
-
if (signal.aborted) throw
|
|
7538
|
-
const attempt = await
|
|
7537
|
+
if (signal.aborted) throw chunk3E3VSMB6_cjs.abortError(signal);
|
|
7538
|
+
const attempt = await chunk3E3VSMB6_cjs.tryFirstEvent(client, request, signal, true);
|
|
7539
7539
|
if (attempt.kind === "handshake_error") {
|
|
7540
7540
|
lastError = attempt.error;
|
|
7541
7541
|
continue;
|
|
7542
7542
|
}
|
|
7543
|
-
return yield*
|
|
7543
|
+
return yield* chunk3E3VSMB6_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
7544
7544
|
}
|
|
7545
7545
|
if (lastError !== void 0) throw lastError;
|
|
7546
7546
|
throw new chunkCEGU5AVD_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
@@ -8221,9 +8221,9 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
8221
8221
|
);
|
|
8222
8222
|
}
|
|
8223
8223
|
validatePruneToolResults(options.sendOptions.pruneToolResults);
|
|
8224
|
-
const { primary, effectiveModelId } =
|
|
8224
|
+
const { primary, effectiveModelId } = chunk3E3VSMB6_cjs.resolveRunProvider(options);
|
|
8225
8225
|
const fallback = options.agentOptions.providers?.fallback;
|
|
8226
|
-
const apiKeys =
|
|
8226
|
+
const apiKeys = chunk3E3VSMB6_cjs.mergeExplicitApiKey(
|
|
8227
8227
|
options.agentOptions.providers?.apiKeys,
|
|
8228
8228
|
primary,
|
|
8229
8229
|
options.agentOptions.apiKey
|
|
@@ -8232,7 +8232,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
8232
8232
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
8233
8233
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
8234
8234
|
const modelBaseUrl = options.model?.url;
|
|
8235
|
-
const chain =
|
|
8235
|
+
const chain = chunk3E3VSMB6_cjs.resolveProviderChain({
|
|
8236
8236
|
primary,
|
|
8237
8237
|
...modelBaseUrl !== void 0 ? { baseUrl: modelBaseUrl } : {},
|
|
8238
8238
|
...fallback !== void 0 ? { fallback } : {},
|
|
@@ -8517,7 +8517,7 @@ function buildRealRunOptions(args) {
|
|
|
8517
8517
|
};
|
|
8518
8518
|
}
|
|
8519
8519
|
async function createFixtureRunHelper(args) {
|
|
8520
|
-
const sessionMessages =
|
|
8520
|
+
const sessionMessages = chunkFBIDOOJM_cjs.getSessionMessages(args.inputs.agentId);
|
|
8521
8521
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
8522
8522
|
return createLocalRun({
|
|
8523
8523
|
agentId: args.inputs.agentId,
|
|
@@ -8536,7 +8536,7 @@ async function createFixtureRunHelper(args) {
|
|
|
8536
8536
|
}
|
|
8537
8537
|
async function dispatchLocalRun(args) {
|
|
8538
8538
|
const apiKey = chunkRNXXYF22_cjs.resolveApiKey(args.inputs.options.apiKey);
|
|
8539
|
-
if (
|
|
8539
|
+
if (chunk3E3VSMB6_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
8540
8540
|
return createRealLocalRun(
|
|
8541
8541
|
buildRealRunOptions({
|
|
8542
8542
|
inputs: args.inputs,
|
|
@@ -8622,10 +8622,10 @@ async function disposeLocalAgentSession(agent) {
|
|
|
8622
8622
|
agent.lifecycleAbortController.abort();
|
|
8623
8623
|
await chunkU3DW3WDE_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
|
|
8624
8624
|
disposeSessionMcpClients(agent.agentId);
|
|
8625
|
-
await
|
|
8625
|
+
await chunkFBIDOOJM_cjs.flushSessionWrites();
|
|
8626
8626
|
await flushRegistrySaves(agent.workspaceCwd);
|
|
8627
8627
|
await disposeSessionStore(agent.sessionStore);
|
|
8628
|
-
|
|
8628
|
+
chunkFBIDOOJM_cjs.discardSession(agent.workspaceCwd, agent.agentId);
|
|
8629
8629
|
}
|
|
8630
8630
|
async function reloadLocalAgent(agent) {
|
|
8631
8631
|
if (agent.context !== void 0) await agent.context.refresh();
|
|
@@ -9489,7 +9489,7 @@ var LocalAgentMemory = class {
|
|
|
9489
9489
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
9490
9490
|
const cfg = this.options.memory?.activeRecall;
|
|
9491
9491
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
9492
|
-
if (this.breaker === void 0) this.breaker = new
|
|
9492
|
+
if (this.breaker === void 0) this.breaker = new chunk3E3VSMB6_cjs.CircuitBreaker();
|
|
9493
9493
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
9494
9494
|
const result = await runActiveMemory({
|
|
9495
9495
|
userText,
|
|
@@ -9804,8 +9804,8 @@ async function localAgentUsePersonality(agent, name, opts) {
|
|
|
9804
9804
|
registry,
|
|
9805
9805
|
store: agent.personalityStore,
|
|
9806
9806
|
invalidateCache: (reason) => agent.invalidateCache(reason),
|
|
9807
|
-
appendSessionMessage: (msg) =>
|
|
9808
|
-
clearSession: () =>
|
|
9807
|
+
appendSessionMessage: (msg) => chunkFBIDOOJM_cjs.appendSessionMessage(agent.agentId, msg),
|
|
9808
|
+
clearSession: () => chunkFBIDOOJM_cjs.clearSession(agent.agentId),
|
|
9809
9809
|
opts: opts ?? {}
|
|
9810
9810
|
})
|
|
9811
9811
|
);
|
|
@@ -10322,7 +10322,7 @@ function applyIdleReset(agentId, minutes) {
|
|
|
10322
10322
|
const previous = lastSendAt.get(agentId);
|
|
10323
10323
|
lastSendAt.set(agentId, now);
|
|
10324
10324
|
if (minutes === void 0 || !Number.isFinite(minutes) || minutes <= 0) return;
|
|
10325
|
-
if (previous !== void 0 && now - previous > minutes * 6e4)
|
|
10325
|
+
if (previous !== void 0 && now - previous > minutes * 6e4) chunkFBIDOOJM_cjs.clearSession(agentId);
|
|
10326
10326
|
}
|
|
10327
10327
|
async function executeSendLocked(inputs, message, options) {
|
|
10328
10328
|
if (inputs.disposed) throw new chunkCEGU5AVD_cjs.AgentDisposedError(inputs.agentId);
|
|
@@ -10342,7 +10342,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
10342
10342
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
10343
10343
|
await inputs.options.onBeforeSend({
|
|
10344
10344
|
conversationId: inputs.agentId,
|
|
10345
|
-
previousMessageCount:
|
|
10345
|
+
previousMessageCount: chunkFBIDOOJM_cjs.getSessionMessages(inputs.agentId).length
|
|
10346
10346
|
});
|
|
10347
10347
|
}
|
|
10348
10348
|
await inputs.runPreHook(userText);
|
|
@@ -10354,8 +10354,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
10354
10354
|
userText,
|
|
10355
10355
|
sendOptions: options
|
|
10356
10356
|
});
|
|
10357
|
-
const priorMessages = [...
|
|
10358
|
-
|
|
10357
|
+
const priorMessages = [...chunkFBIDOOJM_cjs.getSessionMessages(inputs.agentId)];
|
|
10358
|
+
chunkFBIDOOJM_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
10359
10359
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
10360
10360
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
10361
10361
|
const memoryTools = void 0;
|
|
@@ -10708,7 +10708,7 @@ var LocalAgent = class {
|
|
|
10708
10708
|
);
|
|
10709
10709
|
await acquireLeaseIfPossible(this.sessionStore, this.agentId);
|
|
10710
10710
|
try {
|
|
10711
|
-
await
|
|
10711
|
+
await chunkFBIDOOJM_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
10712
10712
|
await this.personalityStore.hydrate(this.agentId);
|
|
10713
10713
|
} catch (err) {
|
|
10714
10714
|
await releaseLeaseIfPossible(this.sessionStore, this.agentId);
|
|
@@ -11114,15 +11114,15 @@ async function maybeInjectHandoffTools(options) {
|
|
|
11114
11114
|
};
|
|
11115
11115
|
}
|
|
11116
11116
|
function keyWillFlowToProvider(apiKey, provider) {
|
|
11117
|
-
if (
|
|
11118
|
-
if (
|
|
11117
|
+
if (chunk3E3VSMB6_cjs.isFixtureApiKey(apiKey)) return false;
|
|
11118
|
+
if (chunk3E3VSMB6_cjs.getConfiguredBaseUrl() !== void 0) return false;
|
|
11119
11119
|
if (provider === void 0) return false;
|
|
11120
11120
|
const profile = chunkSPEN7RJU_cjs.getProviderProfile(provider);
|
|
11121
11121
|
if (profile === void 0) return false;
|
|
11122
11122
|
return profile.authType !== "none";
|
|
11123
11123
|
}
|
|
11124
11124
|
function missingApiKeyMessage() {
|
|
11125
|
-
const present =
|
|
11125
|
+
const present = chunk3E3VSMB6_cjs.presentProviderCredentialEnvVars();
|
|
11126
11126
|
const base = `Missing API key \u2014 set ${chunkRNXXYF22_cjs.API_KEY_ENV_VAR}, or pass \`apiKey\` to Agent.create()`;
|
|
11127
11127
|
if (present.length === 0) return `${base}.`;
|
|
11128
11128
|
return `${base}. ${present.join(" and ")} ${present.length === 1 ? "is" : "are"} set, but a provider credential is not read from the environment automatically \u2014 pass it explicitly, e.g. \`Agent.create({ apiKey: process.env.${present[0]}, ... })\`.`;
|
|
@@ -11142,7 +11142,7 @@ async function createLocalAgent(options) {
|
|
|
11142
11142
|
}
|
|
11143
11143
|
} else {
|
|
11144
11144
|
const willFlowToProvider = keyWillFlowToProvider(apiKey, provider);
|
|
11145
|
-
const shape =
|
|
11145
|
+
const shape = chunk3E3VSMB6_cjs.validateApiKeyShape(apiKey, {
|
|
11146
11146
|
strict: willFlowToProvider,
|
|
11147
11147
|
...willFlowToProvider ? { provider } : {}
|
|
11148
11148
|
});
|
|
@@ -11161,15 +11161,15 @@ async function createCloudAgent(options) {
|
|
|
11161
11161
|
code: "missing_api_key"
|
|
11162
11162
|
});
|
|
11163
11163
|
}
|
|
11164
|
-
const shape =
|
|
11164
|
+
const shape = chunk3E3VSMB6_cjs.validateApiKeyShape(apiKey);
|
|
11165
11165
|
if (shape.malformed) {
|
|
11166
11166
|
throw new chunkCEGU5AVD_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
11167
11167
|
}
|
|
11168
|
-
const baseUrl =
|
|
11168
|
+
const baseUrl = chunk3E3VSMB6_cjs.getConfiguredBaseUrl();
|
|
11169
11169
|
if (baseUrl === void 0) {
|
|
11170
11170
|
return new CloudAgent(options);
|
|
11171
11171
|
}
|
|
11172
|
-
const response = await
|
|
11172
|
+
const response = await chunk3E3VSMB6_cjs.httpRequest("/v1/agents", {
|
|
11173
11173
|
apiKey,
|
|
11174
11174
|
method: "POST",
|
|
11175
11175
|
body: {
|
|
@@ -11194,7 +11194,7 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
11194
11194
|
return process.cwd();
|
|
11195
11195
|
}
|
|
11196
11196
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
11197
|
-
await
|
|
11197
|
+
await chunk3E3VSMB6_cjs.discoverProviderPlugins();
|
|
11198
11198
|
await validateRehydratedAgent(agentId, existing);
|
|
11199
11199
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
11200
11200
|
const mergedMemory = mergeResumedMemory(existing.options.memory, options.memory);
|
|
@@ -11355,7 +11355,7 @@ var Agent = class _Agent {
|
|
|
11355
11355
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
11356
11356
|
});
|
|
11357
11357
|
try {
|
|
11358
|
-
await
|
|
11358
|
+
await chunk3E3VSMB6_cjs.discoverProviderPlugins();
|
|
11359
11359
|
const agent = await runCreateUnderSpan(options, span);
|
|
11360
11360
|
return agent;
|
|
11361
11361
|
} catch (err) {
|
|
@@ -11662,9 +11662,9 @@ var Agent = class _Agent {
|
|
|
11662
11662
|
*/
|
|
11663
11663
|
static async compact(agentId, options = {}) {
|
|
11664
11664
|
const reg = await requireLocalAgent(agentId, "compact");
|
|
11665
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
11665
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-CHBJOYWP.cjs');
|
|
11666
11666
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
11667
|
-
return
|
|
11667
|
+
return chunkFBIDOOJM_cjs.enqueueSessionWrite(
|
|
11668
11668
|
cwd,
|
|
11669
11669
|
agentId,
|
|
11670
11670
|
() => compactSessionTranscript({
|
|
@@ -11692,7 +11692,7 @@ var Agent = class _Agent {
|
|
|
11692
11692
|
*/
|
|
11693
11693
|
static async injectSessionTurn(agentId, turn) {
|
|
11694
11694
|
const reg = await requireLocalAgent(agentId, "injectSessionTurn");
|
|
11695
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
11695
|
+
const { injectSessionTurn } = await import('./inject-session-T4RXANG3.cjs');
|
|
11696
11696
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
11697
11697
|
await injectSessionTurn({
|
|
11698
11698
|
store,
|
|
@@ -11865,5 +11865,5 @@ exports.managedSettingsPathFor = managedSettingsPathFor;
|
|
|
11865
11865
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
11866
11866
|
exports.readManagedSettings = readManagedSettings;
|
|
11867
11867
|
exports.resolveSessionDir = resolveSessionDir;
|
|
11868
|
-
//# sourceMappingURL=chunk-
|
|
11869
|
-
//# sourceMappingURL=chunk-
|
|
11868
|
+
//# sourceMappingURL=chunk-26UQG242.cjs.map
|
|
11869
|
+
//# sourceMappingURL=chunk-26UQG242.cjs.map
|