@theokit/sdk 5.6.0 → 5.7.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 +66 -0
- package/dist/{agent-G6g-uwcB.d.ts → agent-Bqzdhkqr.d.ts} +1 -1
- package/dist/{agent-82d_DrCL.d.cts → agent-Dya5SmhY.d.cts} +1 -1
- package/dist/{agent-JJZM2VIK.js → agent-EQ5HKTWV.js} +11 -10
- package/dist/{agent-JJZM2VIK.js.map → agent-EQ5HKTWV.js.map} +1 -1
- package/dist/{agent-47NS6ZVL.cjs → agent-KA63WDQH.cjs} +12 -11
- package/dist/{agent-47NS6ZVL.cjs.map → agent-KA63WDQH.cjs.map} +1 -1
- package/dist/agent.d.ts +11 -0
- package/dist/{chunk-VUHXC74Q.cjs → chunk-33A27NFX.cjs} +15 -15
- package/dist/{chunk-VUHXC74Q.cjs.map → chunk-33A27NFX.cjs.map} +1 -1
- package/dist/{chunk-HUDNLFY4.js → chunk-3VXQEQE4.js} +13 -4
- package/dist/chunk-3VXQEQE4.js.map +1 -0
- package/dist/{chunk-DZG77WU7.cjs → chunk-3XSWF5AP.cjs} +3 -3
- package/dist/{chunk-DZG77WU7.cjs.map → chunk-3XSWF5AP.cjs.map} +1 -1
- package/dist/{chunk-FPIY5CLV.js → chunk-6JG2RFGK.js} +3 -3
- package/dist/{chunk-FPIY5CLV.js.map → chunk-6JG2RFGK.js.map} +1 -1
- package/dist/{chunk-N2KAIZ5D.js → chunk-7C3HWGCW.js} +3 -19
- package/dist/chunk-7C3HWGCW.js.map +1 -0
- package/dist/{chunk-LD6HASA5.cjs → chunk-7KBNBPFK.cjs} +12 -2
- package/dist/chunk-7KBNBPFK.cjs.map +1 -0
- package/dist/{chunk-GCHZMH42.cjs → chunk-A575WPBL.cjs} +88 -84
- package/dist/chunk-A575WPBL.cjs.map +1 -0
- package/dist/{chunk-5NELQ6LB.js → chunk-A6PDYH55.js} +12 -3
- package/dist/chunk-A6PDYH55.js.map +1 -0
- package/dist/{chunk-2QKV4CGK.js → chunk-CZWN4C6A.js} +3 -3
- package/dist/{chunk-2QKV4CGK.js.map → chunk-CZWN4C6A.js.map} +1 -1
- package/dist/chunk-DQNI52VV.js +20 -0
- package/dist/chunk-DQNI52VV.js.map +1 -0
- package/dist/{chunk-52FDUJSV.cjs → chunk-E6QXZZKE.cjs} +8 -8
- package/dist/{chunk-52FDUJSV.cjs.map → chunk-E6QXZZKE.cjs.map} +1 -1
- package/dist/{chunk-EIOMN5VA.cjs → chunk-EFETPSJZ.cjs} +17 -8
- package/dist/chunk-EFETPSJZ.cjs.map +1 -0
- package/dist/{chunk-HG4UN4MN.cjs → chunk-ER5BOIYD.cjs} +4 -4
- package/dist/{chunk-HG4UN4MN.cjs.map → chunk-ER5BOIYD.cjs.map} +1 -1
- package/dist/{chunk-2UXQASTX.js → chunk-FUUSIT2T.js} +16 -12
- package/dist/chunk-FUUSIT2T.js.map +1 -0
- package/dist/{chunk-7IZKTQ5G.cjs → chunk-GK3UG7YQ.cjs} +2 -21
- package/dist/chunk-GK3UG7YQ.cjs.map +1 -0
- package/dist/{chunk-GFFBXSQT.cjs → chunk-HNAYCTX4.cjs} +5 -5
- package/dist/{chunk-GFFBXSQT.cjs.map → chunk-HNAYCTX4.cjs.map} +1 -1
- package/dist/{chunk-KZSKIUXZ.js → chunk-N7VAE6DZ.js} +31 -3
- package/dist/chunk-N7VAE6DZ.js.map +1 -0
- package/dist/{chunk-7MMTZBTT.js → chunk-P5S3WCSZ.js} +3 -3
- package/dist/{chunk-7MMTZBTT.js.map → chunk-P5S3WCSZ.js.map} +1 -1
- package/dist/{chunk-BZ3YMAMP.js → chunk-R3LBRQAN.js} +3 -3
- package/dist/{chunk-BZ3YMAMP.js.map → chunk-R3LBRQAN.js.map} +1 -1
- package/dist/{chunk-STGSMJMJ.js → chunk-YRLI5DVC.js} +3 -3
- package/dist/{chunk-STGSMJMJ.js.map → chunk-YRLI5DVC.js.map} +1 -1
- package/dist/chunk-YYN6BB7R.cjs +24 -0
- package/dist/chunk-YYN6BB7R.cjs.map +1 -0
- package/dist/{chunk-C4ZQPWXJ.cjs → chunk-ZLMU5EU3.cjs} +33 -4
- package/dist/chunk-ZLMU5EU3.cjs.map +1 -0
- package/dist/{compact-session-7FMYJXQ7.cjs → compact-session-75KD2FCM.cjs} +15 -11
- package/dist/{compact-session-7FMYJXQ7.cjs.map → compact-session-75KD2FCM.cjs.map} +1 -1
- package/dist/{compact-session-YSEK7NQF.js → compact-session-QT6RJOKO.js} +3 -3
- package/dist/{compact-session-YSEK7NQF.js.map → compact-session-QT6RJOKO.js.map} +1 -1
- package/dist/context/index.cjs +11 -7
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.js +7 -3
- package/dist/context/index.js.map +1 -1
- package/dist/{context-HR4KMXMA.cjs → context-7RP5JXGM.cjs} +7 -6
- package/dist/{context-HR4KMXMA.cjs.map → context-7RP5JXGM.cjs.map} +1 -1
- package/dist/context-OJIIXJCV.js +7 -0
- package/dist/{context-J5BJ3LBS.js.map → context-OJIIXJCV.js.map} +1 -1
- package/dist/{cron-DWv69ZSD.d.cts → cron-BwxDUscv.d.cts} +1 -1
- package/dist/{cron-GynWtAax.d.ts → cron-D8uB1Xh5.d.ts} +1 -1
- package/dist/cron.cjs +11 -10
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +10 -9
- package/dist/eval.cjs +10 -9
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +9 -8
- package/dist/eval.js.map +1 -1
- package/dist/{index-manager-BBHDKMQS.cjs → index-manager-W7RHSL6G.cjs} +6 -6
- package/dist/{index-manager-BBHDKMQS.cjs.map → index-manager-W7RHSL6G.cjs.map} +1 -1
- package/dist/{index-manager-27WLNQEE.js → index-manager-Z4XMRVWQ.js} +5 -5
- package/dist/{index-manager-27WLNQEE.js.map → index-manager-Z4XMRVWQ.js.map} +1 -1
- package/dist/index.cjs +42 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -3
- package/dist/index.d.ts +32 -3
- package/dist/index.js +14 -13
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-PC73TMP2.cjs → inject-session-L6MIIELT.cjs} +4 -4
- package/dist/{inject-session-PC73TMP2.cjs.map → inject-session-L6MIIELT.cjs.map} +1 -1
- package/dist/{inject-session-J4LBWAPH.js → inject-session-XWWN4DAA.js} +3 -3
- package/dist/{inject-session-J4LBWAPH.js.map → inject-session-XWWN4DAA.js.map} +1 -1
- package/dist/internal/memory/storage/index.cjs +32 -32
- package/dist/internal/memory/storage/index.js +3 -3
- package/dist/internal/runtime/context/context-discovery.d.ts +27 -0
- package/dist/internal/session/compact-session.d.ts +36 -0
- package/dist/project.cjs +3 -3
- package/dist/project.js +1 -1
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/types/agent.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-2UXQASTX.js.map +0 -1
- package/dist/chunk-5NELQ6LB.js.map +0 -1
- package/dist/chunk-7IZKTQ5G.cjs.map +0 -1
- package/dist/chunk-C4ZQPWXJ.cjs.map +0 -1
- package/dist/chunk-EIOMN5VA.cjs.map +0 -1
- package/dist/chunk-GCHZMH42.cjs.map +0 -1
- package/dist/chunk-HUDNLFY4.js.map +0 -1
- package/dist/chunk-KZSKIUXZ.js.map +0 -1
- package/dist/chunk-LD6HASA5.cjs.map +0 -1
- package/dist/chunk-N2KAIZ5D.js.map +0 -1
- package/dist/context-J5BJ3LBS.js +0 -6
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkKVSAY6NZ_cjs = require('./chunk-KVSAY6NZ.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var chunk3XSWF5AP_cjs = require('./chunk-3XSWF5AP.cjs');
|
|
5
|
+
var chunk33A27NFX_cjs = require('./chunk-33A27NFX.cjs');
|
|
6
|
+
var chunkYYN6BB7R_cjs = require('./chunk-YYN6BB7R.cjs');
|
|
7
7
|
var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
|
|
8
8
|
var chunkD6POWE7E_cjs = require('./chunk-D6POWE7E.cjs');
|
|
9
9
|
var chunkTMKTSYDS_cjs = require('./chunk-TMKTSYDS.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkHNAYCTX4_cjs = require('./chunk-HNAYCTX4.cjs');
|
|
11
11
|
var chunk7FDKWDA2_cjs = require('./chunk-7FDKWDA2.cjs');
|
|
12
|
-
var
|
|
12
|
+
var chunkZLMU5EU3_cjs = require('./chunk-ZLMU5EU3.cjs');
|
|
13
13
|
var chunk2ZPEDVLM_cjs = require('./chunk-2ZPEDVLM.cjs');
|
|
14
|
-
var
|
|
14
|
+
var chunkEFETPSJZ_cjs = require('./chunk-EFETPSJZ.cjs');
|
|
15
|
+
var chunkGK3UG7YQ_cjs = require('./chunk-GK3UG7YQ.cjs');
|
|
15
16
|
var chunkRQMCOFAI_cjs = require('./chunk-RQMCOFAI.cjs');
|
|
16
17
|
var chunkAA27GEYS_cjs = require('./chunk-AA27GEYS.cjs');
|
|
17
18
|
var chunkYSTXFWQE_cjs = require('./chunk-YSTXFWQE.cjs');
|
|
@@ -819,7 +820,7 @@ async function readLegacyFacts(jsonPath) {
|
|
|
819
820
|
}
|
|
820
821
|
async function writeMigratedFacts(cwd, jsonPath, facts) {
|
|
821
822
|
try {
|
|
822
|
-
for (const fact of facts) await
|
|
823
|
+
for (const fact of facts) await chunkHNAYCTX4_cjs.appendFactToMarkdown(cwd, fact);
|
|
823
824
|
await promises.unlink(jsonPath).catch(() => void 0);
|
|
824
825
|
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
|
|
825
826
|
`);
|
|
@@ -836,11 +837,11 @@ async function migrateLegacyJson(cwd, config) {
|
|
|
836
837
|
const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
|
|
837
838
|
if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
|
|
838
839
|
migrationRun.add(key);
|
|
839
|
-
const jsonPath =
|
|
840
|
+
const jsonPath = chunkHNAYCTX4_cjs.legacyMemoryJsonPath(cwd, config);
|
|
840
841
|
if (!await fileExists(jsonPath)) {
|
|
841
842
|
return { migrated: false, factCount: 0, reason: "no-legacy-json" };
|
|
842
843
|
}
|
|
843
|
-
if (await fileExists(
|
|
844
|
+
if (await fileExists(chunkHNAYCTX4_cjs.memoryMdPath(chunkHNAYCTX4_cjs.resolveMemoryRoot(cwd, config)))) {
|
|
844
845
|
chunk6LHQPOMI_cjs.diag(
|
|
845
846
|
`[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
|
|
846
847
|
`
|
|
@@ -869,19 +870,19 @@ function unstoredRememberWarning(message) {
|
|
|
869
870
|
if (isMemoryWritePrompt(message) && extractMemoryFact(message).length > 0) return void 0;
|
|
870
871
|
const trimmed = message.trim();
|
|
871
872
|
const quoted = trimmed.length > QUOTED_MESSAGE_MAX ? `${trimmed.slice(0, QUOTED_MESSAGE_MAX)}\u2026` : trimmed;
|
|
872
|
-
return `[theokit-sdk] NOTHING WAS STORED \u2014 this message does not match the memory capture pattern: ${JSON.stringify(quoted)}. Supported: "Remember: <fact>" or "Remember (${
|
|
873
|
+
return `[theokit-sdk] NOTHING WAS STORED \u2014 this message does not match the memory capture pattern: ${JSON.stringify(quoted)}. Supported: "Remember: <fact>" or "Remember (${chunkHNAYCTX4_cjs.MEMORY_KINDS.join("|")}): <fact>". It still reaches the session transcript, so a follow-up may answer from it \u2014 that is search over transcripts, not a durable memory.`;
|
|
873
874
|
}
|
|
874
875
|
function extractMemoryKind(message) {
|
|
875
876
|
const match = REMEMBER_PATTERN.exec(message);
|
|
876
877
|
const declared = match?.[1];
|
|
877
878
|
if (declared === void 0) return void 0;
|
|
878
879
|
const lowered = declared.toLowerCase();
|
|
879
|
-
return
|
|
880
|
+
return chunkHNAYCTX4_cjs.MEMORY_KINDS.includes(lowered) ? lowered : void 0;
|
|
880
881
|
}
|
|
881
882
|
async function readMemoryFacts(cwd, config) {
|
|
882
883
|
if (!config.enabled) return [];
|
|
883
884
|
await migrateLegacyJson(cwd, config);
|
|
884
|
-
return
|
|
885
|
+
return chunkHNAYCTX4_cjs.readFacts(cwd, config);
|
|
885
886
|
}
|
|
886
887
|
async function appendMemoryFact(cwd, config, fact) {
|
|
887
888
|
if (!config.enabled) return;
|
|
@@ -890,7 +891,7 @@ async function appendMemoryFact(cwd, config, fact) {
|
|
|
890
891
|
text: chunk6LHQPOMI_cjs.redactSecrets(fact.text),
|
|
891
892
|
...fact.kind === void 0 ? {} : { kind: fact.kind }
|
|
892
893
|
};
|
|
893
|
-
await
|
|
894
|
+
await chunkHNAYCTX4_cjs.appendFact(cwd, config, sanitized);
|
|
894
895
|
}
|
|
895
896
|
|
|
896
897
|
// src/internal/runtime/fixtures/fixture-scripts.ts
|
|
@@ -1561,7 +1562,7 @@ function createRealCloudRun(options) {
|
|
|
1561
1562
|
conversation: []
|
|
1562
1563
|
};
|
|
1563
1564
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(options.agentOptions.apiKey);
|
|
1564
|
-
const baseUrl =
|
|
1565
|
+
const baseUrl = chunkZLMU5EU3_cjs.getConfiguredBaseUrl();
|
|
1565
1566
|
const handle = new RealCloudRun(
|
|
1566
1567
|
{
|
|
1567
1568
|
id,
|
|
@@ -1644,7 +1645,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1644
1645
|
async consumeStream(response) {
|
|
1645
1646
|
let finalStatus = "finished";
|
|
1646
1647
|
let finalText = "";
|
|
1647
|
-
for await (const record of
|
|
1648
|
+
for await (const record of chunkZLMU5EU3_cjs.parseSseStream(response.body, this.controller.signal)) {
|
|
1648
1649
|
const parsed = safeParse(record.data);
|
|
1649
1650
|
if (parsed === void 0) continue;
|
|
1650
1651
|
const update = this.applyRecord(record.event, parsed);
|
|
@@ -1811,7 +1812,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1811
1812
|
*/
|
|
1812
1813
|
isFixtureMode() {
|
|
1813
1814
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(this.options.apiKey);
|
|
1814
|
-
return
|
|
1815
|
+
return chunkZLMU5EU3_cjs.isFixtureApiKey(apiKey) && chunkZLMU5EU3_cjs.getConfiguredBaseUrl() === void 0;
|
|
1815
1816
|
}
|
|
1816
1817
|
// SE9 — integrated structured output; delegates to the shared helper.
|
|
1817
1818
|
generate(message, options) {
|
|
@@ -1863,7 +1864,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1863
1864
|
const userText = typeof message === "string" ? message : message.text;
|
|
1864
1865
|
const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
|
|
1865
1866
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(this.options.apiKey);
|
|
1866
|
-
const useRealRuntime = apiKey !== void 0 && !
|
|
1867
|
+
const useRealRuntime = apiKey !== void 0 && !chunkZLMU5EU3_cjs.isFixtureApiKey(apiKey) && chunkZLMU5EU3_cjs.getConfiguredBaseUrl() !== void 0;
|
|
1867
1868
|
return useRealRuntime ? createRealCloudRun({
|
|
1868
1869
|
agentId: this.agentId,
|
|
1869
1870
|
model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
|
|
@@ -2123,14 +2124,14 @@ async function readState(filePath) {
|
|
|
2123
2124
|
try {
|
|
2124
2125
|
parsed = JSON.parse(raw);
|
|
2125
2126
|
} catch {
|
|
2126
|
-
|
|
2127
|
+
chunkGK3UG7YQ_cjs.warnOnce(
|
|
2127
2128
|
"personality-store-json-parse",
|
|
2128
2129
|
"[theokit-sdk] personality.json is malformed; treating as empty"
|
|
2129
2130
|
);
|
|
2130
2131
|
return emptyState();
|
|
2131
2132
|
}
|
|
2132
2133
|
if (!isStateV1(parsed)) {
|
|
2133
|
-
|
|
2134
|
+
chunkGK3UG7YQ_cjs.warnOnce(
|
|
2134
2135
|
"personality-store-bad-version",
|
|
2135
2136
|
`[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
|
|
2136
2137
|
);
|
|
@@ -2161,7 +2162,7 @@ var PersonalityStore = class {
|
|
|
2161
2162
|
try {
|
|
2162
2163
|
await this.#persist(agentId, slug);
|
|
2163
2164
|
} catch (err) {
|
|
2164
|
-
|
|
2165
|
+
chunkGK3UG7YQ_cjs.warnOnce(
|
|
2165
2166
|
`personality-store-persist-failure-${agentId}`,
|
|
2166
2167
|
`[theokit-sdk] personality persist failed for ${chunk6LHQPOMI_cjs.redactSecrets(agentId)}: ${chunk6LHQPOMI_cjs.redactSecrets(
|
|
2167
2168
|
err.message
|
|
@@ -2178,7 +2179,7 @@ var PersonalityStore = class {
|
|
|
2178
2179
|
try {
|
|
2179
2180
|
state = await readState(filePath);
|
|
2180
2181
|
} catch (err) {
|
|
2181
|
-
|
|
2182
|
+
chunkGK3UG7YQ_cjs.warnOnce(
|
|
2182
2183
|
`personality-store-hydrate-failure-${agentId}`,
|
|
2183
2184
|
`[theokit-sdk] personality hydrate failed for ${chunk6LHQPOMI_cjs.redactSecrets(agentId)}: ${chunk6LHQPOMI_cjs.redactSecrets(
|
|
2184
2185
|
err.message
|
|
@@ -2727,7 +2728,7 @@ var HooksExecutor = class {
|
|
|
2727
2728
|
config = {};
|
|
2728
2729
|
async initialize(settingSourcesIncludeProject) {
|
|
2729
2730
|
if (readManagedSettings(this.policy.managedSettingsRoot).disableAllHooks === true) {
|
|
2730
|
-
|
|
2731
|
+
chunkGK3UG7YQ_cjs.warnFailureOnce(
|
|
2731
2732
|
"hooks-disabled-by-policy",
|
|
2732
2733
|
"[theokit-sdk] hooks: an operator policy (managed-settings.json) declares disableAllHooks \u2014 NO hook will run, including any this project declared."
|
|
2733
2734
|
);
|
|
@@ -2738,7 +2739,7 @@ var HooksExecutor = class {
|
|
|
2738
2739
|
this.config = {};
|
|
2739
2740
|
return;
|
|
2740
2741
|
}
|
|
2741
|
-
this.config = await
|
|
2742
|
+
this.config = await chunkGK3UG7YQ_cjs.loadHookConfig(this.cwd, this.compatSources);
|
|
2742
2743
|
}
|
|
2743
2744
|
/** Fire every hook registered for `event` and aggregate the decisions. */
|
|
2744
2745
|
async run(payload) {
|
|
@@ -2928,7 +2929,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2928
2929
|
try {
|
|
2929
2930
|
const partial = await safeConversation(run);
|
|
2930
2931
|
if (partial !== void 0) {
|
|
2931
|
-
|
|
2932
|
+
chunk3XSWF5AP_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
|
|
2932
2933
|
userText,
|
|
2933
2934
|
conversation: partial
|
|
2934
2935
|
});
|
|
@@ -2938,11 +2939,11 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2938
2939
|
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
|
|
2939
2940
|
`);
|
|
2940
2941
|
}
|
|
2941
|
-
await
|
|
2942
|
+
await chunk3XSWF5AP_cjs.flushSessionWrites();
|
|
2942
2943
|
return;
|
|
2943
2944
|
}
|
|
2944
2945
|
if (result.result !== void 0) {
|
|
2945
|
-
|
|
2946
|
+
chunk3XSWF5AP_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
|
|
2946
2947
|
}
|
|
2947
2948
|
const conversation = await safeConversation(run);
|
|
2948
2949
|
const resolvedWindow = resolveWindowForRun(model, contextWindow);
|
|
@@ -2953,7 +2954,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2953
2954
|
}
|
|
2954
2955
|
const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
|
|
2955
2956
|
const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
|
|
2956
|
-
|
|
2957
|
+
chunk3XSWF5AP_cjs.persistTurnToTranscript(
|
|
2957
2958
|
sessionStore,
|
|
2958
2959
|
{ cwd: workspaceCwd, agentId, model },
|
|
2959
2960
|
agentId,
|
|
@@ -2965,7 +2966,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2965
2966
|
// The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
|
|
2966
2967
|
// `contextWindow` here would budget against a number the clamp already rejected.
|
|
2967
2968
|
contextWindow: effectiveWindow,
|
|
2968
|
-
summarize:
|
|
2969
|
+
summarize: chunkZLMU5EU3_cjs.buildDefaultSummarizer({
|
|
2969
2970
|
agentModel: model,
|
|
2970
2971
|
...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
|
|
2971
2972
|
})
|
|
@@ -2978,7 +2979,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2978
2979
|
cwd: workspaceCwd,
|
|
2979
2980
|
// Resolved once, here, and handed to both writers. Recomputing it inside either one is how
|
|
2980
2981
|
// the summary ended up in a directory the indexer never scanned (#463).
|
|
2981
|
-
memoryRoot:
|
|
2982
|
+
memoryRoot: chunkHNAYCTX4_cjs.resolveMemoryRoot(workspaceCwd, inputs.memory),
|
|
2982
2983
|
runId: result.id,
|
|
2983
2984
|
agentId,
|
|
2984
2985
|
userText,
|
|
@@ -2990,7 +2991,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2990
2991
|
if (memoryProvider?.recordSessionSummary !== void 0) {
|
|
2991
2992
|
await memoryProvider.recordSessionSummary(summaryArgs);
|
|
2992
2993
|
} else {
|
|
2993
|
-
await
|
|
2994
|
+
await chunkHNAYCTX4_cjs.writeSessionSummary(summaryArgs);
|
|
2994
2995
|
}
|
|
2995
2996
|
} catch (cause) {
|
|
2996
2997
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
@@ -3007,7 +3008,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
3007
3008
|
agentId,
|
|
3008
3009
|
runId: result.id
|
|
3009
3010
|
});
|
|
3010
|
-
await
|
|
3011
|
+
await chunk3XSWF5AP_cjs.flushSessionWrites();
|
|
3011
3012
|
}
|
|
3012
3013
|
async function safeConversation(run) {
|
|
3013
3014
|
try {
|
|
@@ -3637,7 +3638,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3637
3638
|
};
|
|
3638
3639
|
function safeRequire(moduleName) {
|
|
3639
3640
|
try {
|
|
3640
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3641
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-A575WPBL.cjs', document.baseURI).href)));
|
|
3641
3642
|
return r(moduleName);
|
|
3642
3643
|
} catch {
|
|
3643
3644
|
return void 0;
|
|
@@ -3880,7 +3881,7 @@ var cachedOtel;
|
|
|
3880
3881
|
function loadOtel() {
|
|
3881
3882
|
if (cachedOtel === void 0) {
|
|
3882
3883
|
try {
|
|
3883
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3884
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-A575WPBL.cjs', document.baseURI).href)));
|
|
3884
3885
|
const mod = r("@opentelemetry/api");
|
|
3885
3886
|
cachedOtel = mod;
|
|
3886
3887
|
} catch {
|
|
@@ -4199,7 +4200,7 @@ function applyAggregateCap(sources, maxTotal) {
|
|
|
4199
4200
|
}
|
|
4200
4201
|
const remaining = maxTotal - totalBytes;
|
|
4201
4202
|
if (remaining > 0) {
|
|
4202
|
-
const { finalContent } =
|
|
4203
|
+
const { finalContent } = chunkEFETPSJZ_cjs.truncateWithMarker(s.content, remaining);
|
|
4203
4204
|
kept.push({ ...s, content: finalContent, truncated: true });
|
|
4204
4205
|
totalBytes = maxTotal;
|
|
4205
4206
|
} else {
|
|
@@ -4296,10 +4297,10 @@ var FileContextManager = class {
|
|
|
4296
4297
|
this.lastScope = [...touchedFiles];
|
|
4297
4298
|
const config = await loadContextConfig(this.cwd);
|
|
4298
4299
|
const legacy = await loadSources(config, this.cwd);
|
|
4299
|
-
const maxBytesPerFile = this.settings.maxBytesPerFile ??
|
|
4300
|
+
const maxBytesPerFile = this.settings.maxBytesPerFile ?? chunkEFETPSJZ_cjs.DEFAULT_MAX_BYTES_PER_FILE;
|
|
4300
4301
|
const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
|
|
4301
4302
|
const granted = this.grantedContextDialects();
|
|
4302
|
-
const discovered = await
|
|
4303
|
+
const discovered = await chunkEFETPSJZ_cjs.runDiscovery({
|
|
4303
4304
|
cwd: this.cwd,
|
|
4304
4305
|
maxBytesPerFile,
|
|
4305
4306
|
skipLegacyTheokitContext: true,
|
|
@@ -4372,7 +4373,7 @@ async function loadContextConfig(cwd) {
|
|
|
4372
4373
|
});
|
|
4373
4374
|
if (mdEntities.length > 0) {
|
|
4374
4375
|
if (fs.existsSync(jsonPath)) {
|
|
4375
|
-
|
|
4376
|
+
chunkGK3UG7YQ_cjs.warnOnce(
|
|
4376
4377
|
"context-both-present",
|
|
4377
4378
|
"[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
|
|
4378
4379
|
);
|
|
@@ -4382,7 +4383,7 @@ async function loadContextConfig(cwd) {
|
|
|
4382
4383
|
};
|
|
4383
4384
|
}
|
|
4384
4385
|
if (!fs.existsSync(jsonPath)) return { sources: [] };
|
|
4385
|
-
|
|
4386
|
+
chunkGK3UG7YQ_cjs.warnOnce(
|
|
4386
4387
|
"context-json-deprecated",
|
|
4387
4388
|
// Names no command: `theokit-migrate-config` was unpublished with the `bin` entry, and a warning
|
|
4388
4389
|
// that tells you to run something the package does not ship is worse than one that tells you
|
|
@@ -4545,13 +4546,13 @@ var PluginsManager = class {
|
|
|
4545
4546
|
const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
|
|
4546
4547
|
const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(this.cwd, pluginsRoot, folderName) : await loadPluginManifestFromJson(this.cwd, jsonPath, folderName);
|
|
4547
4548
|
if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
|
|
4548
|
-
|
|
4549
|
+
chunkGK3UG7YQ_cjs.warnOnce(
|
|
4549
4550
|
`plugin-${folderName}-both`,
|
|
4550
4551
|
`[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
|
|
4551
4552
|
);
|
|
4552
4553
|
}
|
|
4553
4554
|
if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
|
|
4554
|
-
|
|
4555
|
+
chunkGK3UG7YQ_cjs.warnOnce(
|
|
4555
4556
|
"plugin-json-deprecated",
|
|
4556
4557
|
// Same reason as the context.json warning: the CLI it used to name is no longer published.
|
|
4557
4558
|
"[theokit-sdk] plugin.json manifests are deprecated; replace each with a PLUGIN.md"
|
|
@@ -6648,7 +6649,7 @@ function applyToolResultGuard(parts, opts) {
|
|
|
6648
6649
|
(p) => (
|
|
6649
6650
|
// SE7 — guard the TEXT of a tool result (string or the text blocks of a
|
|
6650
6651
|
// structured content); image blocks pass through untouched.
|
|
6651
|
-
p.type === "tool_result" ? { ...p, content:
|
|
6652
|
+
p.type === "tool_result" ? { ...p, content: chunkZLMU5EU3_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
|
|
6652
6653
|
)
|
|
6653
6654
|
);
|
|
6654
6655
|
}
|
|
@@ -6940,13 +6941,13 @@ var FallbackLlmClient = class {
|
|
|
6940
6941
|
async *stream(request, signal) {
|
|
6941
6942
|
let lastError;
|
|
6942
6943
|
for (const client of this.clients) {
|
|
6943
|
-
if (signal.aborted) throw
|
|
6944
|
-
const attempt = await
|
|
6944
|
+
if (signal.aborted) throw chunkZLMU5EU3_cjs.abortError(signal);
|
|
6945
|
+
const attempt = await chunkZLMU5EU3_cjs.tryFirstEvent(client, request, signal, true);
|
|
6945
6946
|
if (attempt.kind === "handshake_error") {
|
|
6946
6947
|
lastError = attempt.error;
|
|
6947
6948
|
continue;
|
|
6948
6949
|
}
|
|
6949
|
-
return yield*
|
|
6950
|
+
return yield* chunkZLMU5EU3_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
6950
6951
|
}
|
|
6951
6952
|
if (lastError !== void 0) throw lastError;
|
|
6952
6953
|
throw new chunkJ7J7J2GN_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
@@ -7446,7 +7447,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
|
|
|
7446
7447
|
if (exposedSet.has(name)) continue;
|
|
7447
7448
|
const hint = suggestClosest(name, exposedSet);
|
|
7448
7449
|
const message = hint !== void 0 ? `[theokit-sdk] personality "${opts?.personalityName ?? "?"}" references unknown tool "${name}"; did you mean "${hint}"?` : `[theokit-sdk] personality "${opts?.personalityName ?? "?"}" references unknown tool "${name}" (not exposed)`;
|
|
7449
|
-
|
|
7450
|
+
chunkGK3UG7YQ_cjs.warnOnce(
|
|
7450
7451
|
`personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
|
|
7451
7452
|
message
|
|
7452
7453
|
);
|
|
@@ -7582,9 +7583,9 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7582
7583
|
{ code: "invalid_max_iterations" }
|
|
7583
7584
|
);
|
|
7584
7585
|
}
|
|
7585
|
-
const { primary, effectiveModelId } =
|
|
7586
|
+
const { primary, effectiveModelId } = chunkZLMU5EU3_cjs.resolveRunProvider(options);
|
|
7586
7587
|
const fallback = options.agentOptions.providers?.fallback;
|
|
7587
|
-
const apiKeys =
|
|
7588
|
+
const apiKeys = chunkZLMU5EU3_cjs.mergeExplicitApiKey(
|
|
7588
7589
|
options.agentOptions.providers?.apiKeys,
|
|
7589
7590
|
primary,
|
|
7590
7591
|
options.agentOptions.apiKey
|
|
@@ -7593,7 +7594,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7593
7594
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
7594
7595
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
7595
7596
|
const modelBaseUrl = options.model?.url;
|
|
7596
|
-
const chain =
|
|
7597
|
+
const chain = chunkZLMU5EU3_cjs.resolveProviderChain({
|
|
7597
7598
|
primary,
|
|
7598
7599
|
...modelBaseUrl !== void 0 ? { baseUrl: modelBaseUrl } : {},
|
|
7599
7600
|
...fallback !== void 0 ? { fallback } : {},
|
|
@@ -7853,7 +7854,7 @@ function buildRealRunOptions(args) {
|
|
|
7853
7854
|
};
|
|
7854
7855
|
}
|
|
7855
7856
|
async function createFixtureRunHelper(args) {
|
|
7856
|
-
const sessionMessages =
|
|
7857
|
+
const sessionMessages = chunk3XSWF5AP_cjs.getSessionMessages(args.inputs.agentId);
|
|
7857
7858
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
7858
7859
|
return createLocalRun({
|
|
7859
7860
|
agentId: args.inputs.agentId,
|
|
@@ -7872,7 +7873,7 @@ async function createFixtureRunHelper(args) {
|
|
|
7872
7873
|
}
|
|
7873
7874
|
async function dispatchLocalRun(args) {
|
|
7874
7875
|
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(args.inputs.options.apiKey);
|
|
7875
|
-
if (
|
|
7876
|
+
if (chunkZLMU5EU3_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
7876
7877
|
return createRealLocalRun(
|
|
7877
7878
|
buildRealRunOptions({
|
|
7878
7879
|
inputs: args.inputs,
|
|
@@ -8128,10 +8129,10 @@ async function disposeLocalAgentSession(agent) {
|
|
|
8128
8129
|
agent.lifecycleAbortController.abort();
|
|
8129
8130
|
await chunkZF2LDKQQ_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
|
|
8130
8131
|
disposeSessionMcpClients(agent.agentId);
|
|
8131
|
-
await
|
|
8132
|
+
await chunk3XSWF5AP_cjs.flushSessionWrites();
|
|
8132
8133
|
await flushRegistrySaves(agent.workspaceCwd);
|
|
8133
8134
|
await disposeSessionStore(agent.sessionStore);
|
|
8134
|
-
|
|
8135
|
+
chunk3XSWF5AP_cjs.discardSession(agent.workspaceCwd, agent.agentId);
|
|
8135
8136
|
}
|
|
8136
8137
|
async function reloadLocalAgent(agent) {
|
|
8137
8138
|
if (agent.context !== void 0) await agent.context.refresh();
|
|
@@ -8383,7 +8384,7 @@ async function finalize(args, queryMode, result) {
|
|
|
8383
8384
|
};
|
|
8384
8385
|
args.cache?.set(args.userText, queryMode, result, tenantCtx);
|
|
8385
8386
|
if (args.persistTranscripts === true && args.cwd !== void 0) {
|
|
8386
|
-
await chunkTMKTSYDS_cjs.persistActiveMemoryTranscript(args.memoryRoot ??
|
|
8387
|
+
await chunkTMKTSYDS_cjs.persistActiveMemoryTranscript(args.memoryRoot ?? chunkHNAYCTX4_cjs.resolveMemoryRoot(args.cwd), {
|
|
8387
8388
|
runId: args.runId ?? `run-${Date.now()}`,
|
|
8388
8389
|
startedAtMs: Date.now() - result.durationMs,
|
|
8389
8390
|
userText: args.userText,
|
|
@@ -8974,7 +8975,7 @@ var LocalAgentMemory = class {
|
|
|
8974
8975
|
const openOpts = { cwd: this.workspaceCwd, memoryRoot };
|
|
8975
8976
|
if (embedding !== void 0) openOpts.embedding = embedding;
|
|
8976
8977
|
if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
|
|
8977
|
-
this.index = await
|
|
8978
|
+
this.index = await chunk33A27NFX_cjs.IndexManager.open(openOpts);
|
|
8978
8979
|
await this.index.sync();
|
|
8979
8980
|
this.toolsCache = [
|
|
8980
8981
|
createMemorySearchTool({ index: this.index }),
|
|
@@ -8995,7 +8996,7 @@ var LocalAgentMemory = class {
|
|
|
8995
8996
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
8996
8997
|
const cfg = this.options.memory?.activeRecall;
|
|
8997
8998
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
8998
|
-
if (this.breaker === void 0) this.breaker = new
|
|
8999
|
+
if (this.breaker === void 0) this.breaker = new chunkZLMU5EU3_cjs.CircuitBreaker();
|
|
8999
9000
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
9000
9001
|
const result = await runActiveMemory({
|
|
9001
9002
|
userText,
|
|
@@ -9018,7 +9019,7 @@ var LocalAgentMemory = class {
|
|
|
9018
9019
|
* and the active-memory transcript writer. Three separate resolutions is how they drifted (#463).
|
|
9019
9020
|
*/
|
|
9020
9021
|
memoryRoot() {
|
|
9021
|
-
this.memoryRootCache ??=
|
|
9022
|
+
this.memoryRootCache ??= chunkHNAYCTX4_cjs.resolveMemoryRoot(this.workspaceCwd, this.options.memory);
|
|
9022
9023
|
return this.memoryRootCache;
|
|
9023
9024
|
}
|
|
9024
9025
|
buildActiveMemoryOptions(cfg) {
|
|
@@ -9133,7 +9134,7 @@ function createLocalAgentMemoryProvider(opts) {
|
|
|
9133
9134
|
return { facts: [], systemPromptAdditions: summary };
|
|
9134
9135
|
},
|
|
9135
9136
|
async recordSessionSummary(args) {
|
|
9136
|
-
await
|
|
9137
|
+
await chunkHNAYCTX4_cjs.writeSessionSummary(args);
|
|
9137
9138
|
},
|
|
9138
9139
|
async sync(handle) {
|
|
9139
9140
|
const state = handle[INTERNAL_LAM_KEY];
|
|
@@ -9223,7 +9224,7 @@ function addEntity(byName, entity, origin, collisionMap) {
|
|
|
9223
9224
|
);
|
|
9224
9225
|
}
|
|
9225
9226
|
if (origin === "project" && collisionMap?.has(fm.name)) {
|
|
9226
|
-
|
|
9227
|
+
chunkGK3UG7YQ_cjs.warnOnce(
|
|
9227
9228
|
`personality-collision-${fm.name}`,
|
|
9228
9229
|
`[theokit-sdk] personality "${fm.name}" overridden by project preset`
|
|
9229
9230
|
);
|
|
@@ -9273,14 +9274,14 @@ async function performPersonalitySwitch(args) {
|
|
|
9273
9274
|
|
|
9274
9275
|
// src/internal/local-agent/local-agent-personality-extensions.ts
|
|
9275
9276
|
function resolveActivePersonalityPreset(args) {
|
|
9276
|
-
const forkCtx =
|
|
9277
|
+
const forkCtx = chunkYYN6BB7R_cjs.currentPersonalityContext();
|
|
9277
9278
|
const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
|
|
9278
9279
|
if (slug === void 0) return void 0;
|
|
9279
9280
|
return args.personalityRegistry?.get(slug);
|
|
9280
9281
|
}
|
|
9281
9282
|
async function ensurePersonalityRegistryIfNeeded(args) {
|
|
9282
9283
|
if (args.personalityRegistry !== void 0) return args.personalityRegistry;
|
|
9283
|
-
const forkSlug =
|
|
9284
|
+
const forkSlug = chunkYYN6BB7R_cjs.currentPersonalityContext()?.slug;
|
|
9284
9285
|
const ownSlug = args.personalityStore.active(args.agentId);
|
|
9285
9286
|
if (forkSlug === void 0 && ownSlug === void 0) return void 0;
|
|
9286
9287
|
return await PersonalityRegistry.load(args.workspaceCwd);
|
|
@@ -9293,8 +9294,8 @@ function applyPersonalityOverlay(preset, base) {
|
|
|
9293
9294
|
${preset.systemPrompt}`;
|
|
9294
9295
|
}
|
|
9295
9296
|
async function localAgentUsePersonality(agent, name, opts) {
|
|
9296
|
-
if (
|
|
9297
|
-
|
|
9297
|
+
if (chunkYYN6BB7R_cjs.currentPersonalityContext() !== void 0) {
|
|
9298
|
+
chunkYYN6BB7R_cjs.warnPersonalitySwitchInsideFork(agent.agentId);
|
|
9298
9299
|
return null;
|
|
9299
9300
|
}
|
|
9300
9301
|
if (agent.personalityRegistry === void 0) {
|
|
@@ -9310,8 +9311,8 @@ async function localAgentUsePersonality(agent, name, opts) {
|
|
|
9310
9311
|
registry,
|
|
9311
9312
|
store: agent.personalityStore,
|
|
9312
9313
|
invalidateCache: (reason) => agent.invalidateCache(reason),
|
|
9313
|
-
appendSessionMessage: (msg) =>
|
|
9314
|
-
clearSession: () =>
|
|
9314
|
+
appendSessionMessage: (msg) => chunk3XSWF5AP_cjs.appendSessionMessage(agent.agentId, msg),
|
|
9315
|
+
clearSession: () => chunk3XSWF5AP_cjs.clearSession(agent.agentId),
|
|
9315
9316
|
opts: opts ?? {}
|
|
9316
9317
|
})
|
|
9317
9318
|
);
|
|
@@ -9355,7 +9356,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
|
|
|
9355
9356
|
async function localAgentFork(parent, options) {
|
|
9356
9357
|
const { forkAgentImpl } = await import('./fork-agent-WAEQI2DL.cjs');
|
|
9357
9358
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
9358
|
-
const { withPersonalityContext } = await import('./context-
|
|
9359
|
+
const { withPersonalityContext } = await import('./context-7RP5JXGM.cjs');
|
|
9359
9360
|
const create = getAgentFacade().create;
|
|
9360
9361
|
return withPersonalityContext(
|
|
9361
9362
|
{ slug: parent.personalitySlugSnapshot, isFork: true },
|
|
@@ -9865,7 +9866,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9865
9866
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
9866
9867
|
await inputs.options.onBeforeSend({
|
|
9867
9868
|
conversationId: inputs.agentId,
|
|
9868
|
-
previousMessageCount:
|
|
9869
|
+
previousMessageCount: chunk3XSWF5AP_cjs.getSessionMessages(inputs.agentId).length
|
|
9869
9870
|
});
|
|
9870
9871
|
}
|
|
9871
9872
|
await inputs.runPreHook(userText);
|
|
@@ -9877,8 +9878,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9877
9878
|
userText,
|
|
9878
9879
|
sendOptions: options
|
|
9879
9880
|
});
|
|
9880
|
-
const priorMessages = [...
|
|
9881
|
-
|
|
9881
|
+
const priorMessages = [...chunk3XSWF5AP_cjs.getSessionMessages(inputs.agentId)];
|
|
9882
|
+
chunk3XSWF5AP_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
9882
9883
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9883
9884
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9884
9885
|
const memoryTools = void 0;
|
|
@@ -10184,7 +10185,7 @@ var LocalAgent = class {
|
|
|
10184
10185
|
);
|
|
10185
10186
|
await acquireLeaseIfPossible(this.sessionStore, this.agentId);
|
|
10186
10187
|
try {
|
|
10187
|
-
await
|
|
10188
|
+
await chunk3XSWF5AP_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
10188
10189
|
await this.personalityStore.hydrate(this.agentId);
|
|
10189
10190
|
} catch (err) {
|
|
10190
10191
|
await releaseLeaseIfPossible(this.sessionStore, this.agentId);
|
|
@@ -10525,15 +10526,15 @@ async function maybeInjectHandoffTools(options) {
|
|
|
10525
10526
|
};
|
|
10526
10527
|
}
|
|
10527
10528
|
function keyWillFlowToProvider(apiKey, provider) {
|
|
10528
|
-
if (
|
|
10529
|
-
if (
|
|
10529
|
+
if (chunkZLMU5EU3_cjs.isFixtureApiKey(apiKey)) return false;
|
|
10530
|
+
if (chunkZLMU5EU3_cjs.getConfiguredBaseUrl() !== void 0) return false;
|
|
10530
10531
|
if (provider === void 0) return false;
|
|
10531
10532
|
const profile = chunkANMJJD6D_cjs.getProviderProfile(provider);
|
|
10532
10533
|
if (profile === void 0) return false;
|
|
10533
10534
|
return profile.authType !== "none";
|
|
10534
10535
|
}
|
|
10535
10536
|
function missingApiKeyMessage() {
|
|
10536
|
-
const present =
|
|
10537
|
+
const present = chunkZLMU5EU3_cjs.presentProviderCredentialEnvVars();
|
|
10537
10538
|
const base = `Missing API key \u2014 set ${chunk6LHQPOMI_cjs.API_KEY_ENV_VAR}, or pass \`apiKey\` to Agent.create()`;
|
|
10538
10539
|
if (present.length === 0) return `${base}.`;
|
|
10539
10540
|
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]}, ... })\`.`;
|
|
@@ -10553,7 +10554,7 @@ async function createLocalAgent(options) {
|
|
|
10553
10554
|
}
|
|
10554
10555
|
} else {
|
|
10555
10556
|
const willFlowToProvider = keyWillFlowToProvider(apiKey, provider);
|
|
10556
|
-
const shape =
|
|
10557
|
+
const shape = chunkZLMU5EU3_cjs.validateApiKeyShape(apiKey, {
|
|
10557
10558
|
strict: willFlowToProvider,
|
|
10558
10559
|
...willFlowToProvider ? { provider } : {}
|
|
10559
10560
|
});
|
|
@@ -10572,15 +10573,15 @@ async function createCloudAgent(options) {
|
|
|
10572
10573
|
code: "missing_api_key"
|
|
10573
10574
|
});
|
|
10574
10575
|
}
|
|
10575
|
-
const shape =
|
|
10576
|
+
const shape = chunkZLMU5EU3_cjs.validateApiKeyShape(apiKey);
|
|
10576
10577
|
if (shape.malformed) {
|
|
10577
10578
|
throw new chunkJ7J7J2GN_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
10578
10579
|
}
|
|
10579
|
-
const baseUrl =
|
|
10580
|
+
const baseUrl = chunkZLMU5EU3_cjs.getConfiguredBaseUrl();
|
|
10580
10581
|
if (baseUrl === void 0) {
|
|
10581
10582
|
return new CloudAgent(options);
|
|
10582
10583
|
}
|
|
10583
|
-
const response = await
|
|
10584
|
+
const response = await chunkZLMU5EU3_cjs.httpRequest("/v1/agents", {
|
|
10584
10585
|
apiKey,
|
|
10585
10586
|
method: "POST",
|
|
10586
10587
|
body: {
|
|
@@ -10605,7 +10606,7 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
10605
10606
|
return process.cwd();
|
|
10606
10607
|
}
|
|
10607
10608
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
10608
|
-
await
|
|
10609
|
+
await chunkZLMU5EU3_cjs.discoverProviderPlugins();
|
|
10609
10610
|
await validateRehydratedAgent(agentId, existing);
|
|
10610
10611
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
10611
10612
|
const mergedOptions = {
|
|
@@ -10756,7 +10757,7 @@ var Agent = class _Agent {
|
|
|
10756
10757
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
10757
10758
|
});
|
|
10758
10759
|
try {
|
|
10759
|
-
await
|
|
10760
|
+
await chunkZLMU5EU3_cjs.discoverProviderPlugins();
|
|
10760
10761
|
const agent = await runCreateUnderSpan(options, span);
|
|
10761
10762
|
return agent;
|
|
10762
10763
|
} catch (err) {
|
|
@@ -11054,9 +11055,9 @@ var Agent = class _Agent {
|
|
|
11054
11055
|
*/
|
|
11055
11056
|
static async compact(agentId, options = {}) {
|
|
11056
11057
|
const reg = await requireLocalAgent(agentId, "compact");
|
|
11057
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
11058
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-75KD2FCM.cjs');
|
|
11058
11059
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
11059
|
-
return
|
|
11060
|
+
return chunk3XSWF5AP_cjs.enqueueSessionWrite(
|
|
11060
11061
|
cwd,
|
|
11061
11062
|
agentId,
|
|
11062
11063
|
() => compactSessionTranscript({
|
|
@@ -11067,7 +11068,10 @@ var Agent = class _Agent {
|
|
|
11067
11068
|
summarize: options.summarize ?? buildDefaultSummarizer2({
|
|
11068
11069
|
agentModel: model,
|
|
11069
11070
|
...reg.options.apiKey !== void 0 ? { apiKey: reg.options.apiKey } : {}
|
|
11070
|
-
})
|
|
11071
|
+
}),
|
|
11072
|
+
...options.onPreCompact !== void 0 ? { onPreCompact: options.onPreCompact } : {},
|
|
11073
|
+
...options.onPreCompactError !== void 0 ? { onPreCompactError: options.onPreCompactError } : {},
|
|
11074
|
+
...options.preCompactTimeoutMs !== void 0 ? { preCompactTimeoutMs: options.preCompactTimeoutMs } : {}
|
|
11071
11075
|
})
|
|
11072
11076
|
);
|
|
11073
11077
|
}
|
|
@@ -11081,7 +11085,7 @@ var Agent = class _Agent {
|
|
|
11081
11085
|
*/
|
|
11082
11086
|
static async injectSessionTurn(agentId, turn) {
|
|
11083
11087
|
const reg = await requireLocalAgent(agentId, "injectSessionTurn");
|
|
11084
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
11088
|
+
const { injectSessionTurn } = await import('./inject-session-L6MIIELT.cjs');
|
|
11085
11089
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
11086
11090
|
await injectSessionTurn({
|
|
11087
11091
|
store,
|
|
@@ -11252,5 +11256,5 @@ exports.managedSettingsPathFor = managedSettingsPathFor;
|
|
|
11252
11256
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
11253
11257
|
exports.readManagedSettings = readManagedSettings;
|
|
11254
11258
|
exports.resolveSessionDir = resolveSessionDir;
|
|
11255
|
-
//# sourceMappingURL=chunk-
|
|
11256
|
-
//# sourceMappingURL=chunk-
|
|
11259
|
+
//# sourceMappingURL=chunk-A575WPBL.cjs.map
|
|
11260
|
+
//# sourceMappingURL=chunk-A575WPBL.cjs.map
|