@theokit/sdk 5.0.0-next.1 → 5.0.0-next.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 +195 -0
- package/dist/{agent-XMKRP27S.js → agent-2KJ3IGRA.js} +10 -10
- package/dist/{agent-XMKRP27S.js.map → agent-2KJ3IGRA.js.map} +1 -1
- package/dist/{agent-CgNzshyV.d.cts → agent-C3KO5LKm.d.cts} +49 -3
- package/dist/{agent-CdYJfKr6.d.ts → agent-CvmTR9uf.d.ts} +49 -3
- package/dist/{agent-2E7DI47Y.cjs → agent-V6YLX3W6.cjs} +11 -11
- package/dist/{agent-2E7DI47Y.cjs.map → agent-V6YLX3W6.cjs.map} +1 -1
- package/dist/{chunk-WFC26L6Y.js → chunk-2XRAWOZZ.js} +25 -2
- package/dist/chunk-2XRAWOZZ.js.map +1 -0
- package/dist/{chunk-XCCGNU3D.js → chunk-4S5TWFIZ.js} +5 -5
- package/dist/chunk-4S5TWFIZ.js.map +1 -0
- package/dist/{chunk-JTZ74HFD.js → chunk-67ADYSTW.js} +29 -9
- package/dist/chunk-67ADYSTW.js.map +1 -0
- package/dist/{chunk-2ZLVT7H3.js → chunk-CYKKYNOT.js} +3 -3
- package/dist/{chunk-2ZLVT7H3.js.map → chunk-CYKKYNOT.js.map} +1 -1
- package/dist/{chunk-WJXOICRC.js → chunk-DX4RUWOK.js} +3 -3
- package/dist/{chunk-WJXOICRC.js.map → chunk-DX4RUWOK.js.map} +1 -1
- package/dist/{chunk-CEILSTWB.cjs → chunk-GGZ5GPE3.cjs} +29 -8
- package/dist/chunk-GGZ5GPE3.cjs.map +1 -0
- package/dist/{chunk-7ZK4DJD7.cjs → chunk-GJKMSGZ7.cjs} +4 -4
- package/dist/{chunk-7ZK4DJD7.cjs.map → chunk-GJKMSGZ7.cjs.map} +1 -1
- package/dist/{chunk-NCGWJ3HS.js → chunk-GO5QW4YL.js} +74 -35
- package/dist/chunk-GO5QW4YL.js.map +1 -0
- package/dist/{chunk-HWSALKOR.cjs → chunk-H6YM3PV6.cjs} +5 -5
- package/dist/chunk-H6YM3PV6.cjs.map +1 -0
- package/dist/{chunk-RHZ6HP23.cjs → chunk-IU5N5224.cjs} +8 -8
- package/dist/{chunk-RHZ6HP23.cjs.map → chunk-IU5N5224.cjs.map} +1 -1
- package/dist/{chunk-UNK4HNJH.js → chunk-J2SH3PNH.js} +3 -3
- package/dist/{chunk-UNK4HNJH.js.map → chunk-J2SH3PNH.js.map} +1 -1
- package/dist/{chunk-WMH2MSOP.cjs → chunk-K6VDRJ6I.cjs} +114 -75
- package/dist/chunk-K6VDRJ6I.cjs.map +1 -0
- package/dist/{chunk-2NE7DTOK.cjs → chunk-KBXADFBJ.cjs} +15 -15
- package/dist/{chunk-2NE7DTOK.cjs.map → chunk-KBXADFBJ.cjs.map} +1 -1
- package/dist/{chunk-6HIACV34.js → chunk-L4RPP6ZC.js} +3 -3
- package/dist/{chunk-6HIACV34.js.map → chunk-L4RPP6ZC.js.map} +1 -1
- package/dist/{chunk-LKFET5A3.cjs → chunk-LOHMT36V.cjs} +25 -2
- package/dist/chunk-LOHMT36V.cjs.map +1 -0
- package/dist/{chunk-ILGZ2ZZV.js → chunk-N6OOOYFZ.js} +3 -3
- package/dist/{chunk-ILGZ2ZZV.js.map → chunk-N6OOOYFZ.js.map} +1 -1
- package/dist/{chunk-LHSWHYF3.cjs → chunk-RXZSVNDG.cjs} +5 -5
- package/dist/{chunk-LHSWHYF3.cjs.map → chunk-RXZSVNDG.cjs.map} +1 -1
- package/dist/{chunk-G4ZGYKJG.cjs → chunk-SYVWE64W.cjs} +6 -6
- package/dist/chunk-SYVWE64W.cjs.map +1 -0
- package/dist/{chunk-V6ZY4AX6.cjs → chunk-VNDJS6I3.cjs} +8 -8
- package/dist/{chunk-V6ZY4AX6.cjs.map → chunk-VNDJS6I3.cjs.map} +1 -1
- package/dist/{chunk-IJM7UGS5.js → chunk-XJZEBGXD.js} +5 -5
- package/dist/chunk-XJZEBGXD.js.map +1 -0
- package/dist/context/index.cjs +7 -7
- package/dist/context/index.js +3 -3
- package/dist/{context-74SBFD27.cjs → context-NI33FS2R.cjs} +7 -7
- package/dist/{context-74SBFD27.cjs.map → context-NI33FS2R.cjs.map} +1 -1
- package/dist/context-Y7B7SI5X.js +6 -0
- package/dist/{context-NZ2AC6S7.js.map → context-Y7B7SI5X.js.map} +1 -1
- package/dist/{cron-Bw6mSgD4.d.cts → cron-C3PhZED0.d.cts} +1 -1
- package/dist/{cron-DJv9oXSZ.d.ts → cron-crfMMdAw.d.ts} +1 -1
- package/dist/cron.cjs +10 -10
- package/dist/cron.d.cts +3 -3
- package/dist/cron.d.ts +3 -3
- package/dist/cron.js +9 -9
- package/dist/eval.cjs +9 -9
- package/dist/eval.js +8 -8
- package/dist/{index-manager-QH6OXEV5.js → index-manager-E56WW5RO.js} +5 -5
- package/dist/{index-manager-QH6OXEV5.js.map → index-manager-E56WW5RO.js.map} +1 -1
- package/dist/{index-manager-DXR2RSFI.cjs → index-manager-OL6HTYAO.cjs} +6 -6
- package/dist/{index-manager-DXR2RSFI.cjs.map → index-manager-OL6HTYAO.cjs.map} +1 -1
- package/dist/index.cjs +31 -31
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +13 -13
- package/dist/internal/memory/storage/index.cjs +31 -31
- package/dist/internal/memory/storage/index.js +3 -3
- package/dist/internal/persistence/index.cjs +4 -4
- package/dist/internal/persistence/index.js +1 -1
- package/dist/internal/persistence/paths.d.cts +25 -12
- package/dist/internal/persistence/paths.d.ts +25 -12
- package/dist/internal/runtime/compat/compat-config-file.d.ts +31 -0
- package/dist/internal/runtime/compat/foreign-config-sources.d.ts +31 -1
- package/dist/internal/runtime/hooks/hooks-executor.d.ts +2 -1
- package/dist/internal/runtime/plugin-loader/plugin-bundles.d.ts +2 -1
- package/dist/project.cjs +3 -3
- package/dist/project.js +1 -1
- package/dist/{sdk-agent-Dxjb0IfM.d.cts → sdk-agent-BOiKqOgL.d.cts} +28 -1
- package/dist/{sdk-agent-ldzpyAaF.d.ts → sdk-agent-D4a_BR_6.d.ts} +28 -1
- package/dist/subagents-loader-TPZLTXYZ.cjs +16 -0
- package/dist/{subagents-loader-YWFE7KYE.cjs.map → subagents-loader-TPZLTXYZ.cjs.map} +1 -1
- package/dist/subagents-loader-Y6JFYXAY.js +7 -0
- package/dist/{subagents-loader-LSKM2UIK.js.map → subagents-loader-Y6JFYXAY.js.map} +1 -1
- package/dist/subagents-loader.cjs +3 -3
- package/dist/subagents-loader.d.cts +2 -2
- package/dist/subagents-loader.d.ts +2 -2
- package/dist/subagents-loader.js +2 -2
- package/dist/types/agent.d.ts +47 -1
- package/dist/types/sdk-agent.d.ts +28 -1
- package/dist/workflow.d.cts +1 -1
- package/dist/workflow.d.ts +1 -1
- package/docs/error-codes.md +21 -21
- package/docs/harness-capability-map.md +3 -1
- package/package.json +1 -1
- package/dist/chunk-CEILSTWB.cjs.map +0 -1
- package/dist/chunk-G4ZGYKJG.cjs.map +0 -1
- package/dist/chunk-HWSALKOR.cjs.map +0 -1
- package/dist/chunk-IJM7UGS5.js.map +0 -1
- package/dist/chunk-JTZ74HFD.js.map +0 -1
- package/dist/chunk-LKFET5A3.cjs.map +0 -1
- package/dist/chunk-NCGWJ3HS.js.map +0 -1
- package/dist/chunk-WFC26L6Y.js.map +0 -1
- package/dist/chunk-WMH2MSOP.cjs.map +0 -1
- package/dist/chunk-XCCGNU3D.js.map +0 -1
- package/dist/context-NZ2AC6S7.js +0 -6
- package/dist/subagents-loader-LSKM2UIK.js +0 -7
- package/dist/subagents-loader-YWFE7KYE.cjs +0 -16
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkKVSAY6NZ_cjs = require('./chunk-KVSAY6NZ.cjs');
|
|
4
4
|
var chunkY2KYR2ED_cjs = require('./chunk-Y2KYR2ED.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunkKBXADFBJ_cjs = require('./chunk-KBXADFBJ.cjs');
|
|
6
|
+
var chunkH6YM3PV6_cjs = require('./chunk-H6YM3PV6.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 chunkRXZSVNDG_cjs = require('./chunk-RXZSVNDG.cjs');
|
|
11
11
|
var chunk7FDKWDA2_cjs = require('./chunk-7FDKWDA2.cjs');
|
|
12
12
|
var chunk2HPNT6HH_cjs = require('./chunk-2HPNT6HH.cjs');
|
|
13
13
|
var chunk2ZPEDVLM_cjs = require('./chunk-2ZPEDVLM.cjs');
|
|
14
|
-
var
|
|
14
|
+
var chunkIU5N5224_cjs = require('./chunk-IU5N5224.cjs');
|
|
15
15
|
var chunkRQMCOFAI_cjs = require('./chunk-RQMCOFAI.cjs');
|
|
16
16
|
var chunkAA27GEYS_cjs = require('./chunk-AA27GEYS.cjs');
|
|
17
17
|
var chunkYSTXFWQE_cjs = require('./chunk-YSTXFWQE.cjs');
|
|
@@ -26,8 +26,8 @@ var chunkGZV6AVRL_cjs = require('./chunk-GZV6AVRL.cjs');
|
|
|
26
26
|
var chunkBJUJT5ED_cjs = require('./chunk-BJUJT5ED.cjs');
|
|
27
27
|
var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
|
|
28
28
|
var chunkJLRLCBJ4_cjs = require('./chunk-JLRLCBJ4.cjs');
|
|
29
|
-
var
|
|
30
|
-
var
|
|
29
|
+
var chunkSYVWE64W_cjs = require('./chunk-SYVWE64W.cjs');
|
|
30
|
+
var chunkGGZ5GPE3_cjs = require('./chunk-GGZ5GPE3.cjs');
|
|
31
31
|
var chunkHW7SEELD_cjs = require('./chunk-HW7SEELD.cjs');
|
|
32
32
|
var chunkATT276RD_cjs = require('./chunk-ATT276RD.cjs');
|
|
33
33
|
var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
|
|
@@ -39,10 +39,10 @@ var chunk6LHQPOMI_cjs = require('./chunk-6LHQPOMI.cjs');
|
|
|
39
39
|
var promises = require('fs/promises');
|
|
40
40
|
var crypto = require('crypto');
|
|
41
41
|
var path = require('path');
|
|
42
|
+
var fs = require('fs');
|
|
42
43
|
var child_process = require('child_process');
|
|
43
44
|
var zod = require('zod');
|
|
44
45
|
var module$1 = require('module');
|
|
45
|
-
var fs = require('fs');
|
|
46
46
|
var os = require('os');
|
|
47
47
|
|
|
48
48
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -272,7 +272,7 @@ function enabledPluginNames(plugins) {
|
|
|
272
272
|
// src/internal/runtime/registry/agent-registry-store.ts
|
|
273
273
|
var SCHEMA_VERSION = 1;
|
|
274
274
|
var LEGACY_SCHEMA_VERSION_STRING = "1.0";
|
|
275
|
-
var
|
|
275
|
+
var REGISTRY_RELATIVE_SUFFIX = path.join("agents", "registry.json");
|
|
276
276
|
function stripSecretsFromOptions(options) {
|
|
277
277
|
return assignDefined({
|
|
278
278
|
name: options.name,
|
|
@@ -382,7 +382,7 @@ function serializeAgents(agents2) {
|
|
|
382
382
|
return out;
|
|
383
383
|
}
|
|
384
384
|
function registryPath(cwd) {
|
|
385
|
-
return path.join(cwd,
|
|
385
|
+
return path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), REGISTRY_RELATIVE_SUFFIX);
|
|
386
386
|
}
|
|
387
387
|
async function loadRegistry(cwd) {
|
|
388
388
|
void chunkJLRLCBJ4_cjs.sweepStaleAtomicTemps(registryPath(cwd)).catch(() => void 0);
|
|
@@ -817,7 +817,7 @@ async function readLegacyFacts(jsonPath) {
|
|
|
817
817
|
}
|
|
818
818
|
async function writeMigratedFacts(cwd, jsonPath, facts) {
|
|
819
819
|
try {
|
|
820
|
-
for (const fact of facts) await
|
|
820
|
+
for (const fact of facts) await chunkRXZSVNDG_cjs.appendFactToMarkdown(cwd, fact);
|
|
821
821
|
await promises.unlink(jsonPath).catch(() => void 0);
|
|
822
822
|
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
|
|
823
823
|
`);
|
|
@@ -834,11 +834,11 @@ async function migrateLegacyJson(cwd, config) {
|
|
|
834
834
|
const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
|
|
835
835
|
if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
|
|
836
836
|
migrationRun.add(key);
|
|
837
|
-
const jsonPath =
|
|
837
|
+
const jsonPath = chunkRXZSVNDG_cjs.legacyMemoryJsonPath(cwd, config);
|
|
838
838
|
if (!await fileExists(jsonPath)) {
|
|
839
839
|
return { migrated: false, factCount: 0, reason: "no-legacy-json" };
|
|
840
840
|
}
|
|
841
|
-
if (await fileExists(
|
|
841
|
+
if (await fileExists(chunkRXZSVNDG_cjs.memoryMdPath(chunkRXZSVNDG_cjs.resolveMemoryRoot(cwd, config)))) {
|
|
842
842
|
chunk6LHQPOMI_cjs.diag(
|
|
843
843
|
`[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
|
|
844
844
|
`
|
|
@@ -867,19 +867,19 @@ function unstoredRememberWarning(message) {
|
|
|
867
867
|
if (isMemoryWritePrompt(message) && extractMemoryFact(message).length > 0) return void 0;
|
|
868
868
|
const trimmed = message.trim();
|
|
869
869
|
const quoted = trimmed.length > QUOTED_MESSAGE_MAX ? `${trimmed.slice(0, QUOTED_MESSAGE_MAX)}\u2026` : trimmed;
|
|
870
|
-
return `[theokit-sdk] NOTHING WAS STORED \u2014 this message does not match the memory capture pattern: ${JSON.stringify(quoted)}. Supported: "Remember: <fact>" or "Remember (${
|
|
870
|
+
return `[theokit-sdk] NOTHING WAS STORED \u2014 this message does not match the memory capture pattern: ${JSON.stringify(quoted)}. Supported: "Remember: <fact>" or "Remember (${chunkRXZSVNDG_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.`;
|
|
871
871
|
}
|
|
872
872
|
function extractMemoryKind(message) {
|
|
873
873
|
const match = REMEMBER_PATTERN.exec(message);
|
|
874
874
|
const declared = match?.[1];
|
|
875
875
|
if (declared === void 0) return void 0;
|
|
876
876
|
const lowered = declared.toLowerCase();
|
|
877
|
-
return
|
|
877
|
+
return chunkRXZSVNDG_cjs.MEMORY_KINDS.includes(lowered) ? lowered : void 0;
|
|
878
878
|
}
|
|
879
879
|
async function readMemoryFacts(cwd, config) {
|
|
880
880
|
if (!config.enabled) return [];
|
|
881
881
|
await migrateLegacyJson(cwd, config);
|
|
882
|
-
return
|
|
882
|
+
return chunkRXZSVNDG_cjs.readFacts(cwd, config);
|
|
883
883
|
}
|
|
884
884
|
async function appendMemoryFact(cwd, config, fact) {
|
|
885
885
|
if (!config.enabled) return;
|
|
@@ -888,7 +888,7 @@ async function appendMemoryFact(cwd, config, fact) {
|
|
|
888
888
|
text: chunk6LHQPOMI_cjs.redactSecrets(fact.text),
|
|
889
889
|
...fact.kind === void 0 ? {} : { kind: fact.kind }
|
|
890
890
|
};
|
|
891
|
-
await
|
|
891
|
+
await chunkRXZSVNDG_cjs.appendFact(cwd, config, sanitized);
|
|
892
892
|
}
|
|
893
893
|
|
|
894
894
|
// src/internal/runtime/fixtures/fixture-scripts.ts
|
|
@@ -2121,14 +2121,14 @@ async function readState(filePath) {
|
|
|
2121
2121
|
try {
|
|
2122
2122
|
parsed = JSON.parse(raw);
|
|
2123
2123
|
} catch {
|
|
2124
|
-
|
|
2124
|
+
chunkH6YM3PV6_cjs.warnOnce(
|
|
2125
2125
|
"personality-store-json-parse",
|
|
2126
2126
|
"[theokit-sdk] personality.json is malformed; treating as empty"
|
|
2127
2127
|
);
|
|
2128
2128
|
return emptyState();
|
|
2129
2129
|
}
|
|
2130
2130
|
if (!isStateV1(parsed)) {
|
|
2131
|
-
|
|
2131
|
+
chunkH6YM3PV6_cjs.warnOnce(
|
|
2132
2132
|
"personality-store-bad-version",
|
|
2133
2133
|
`[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
|
|
2134
2134
|
);
|
|
@@ -2159,7 +2159,7 @@ var PersonalityStore = class {
|
|
|
2159
2159
|
try {
|
|
2160
2160
|
await this.#persist(agentId, slug);
|
|
2161
2161
|
} catch (err) {
|
|
2162
|
-
|
|
2162
|
+
chunkH6YM3PV6_cjs.warnOnce(
|
|
2163
2163
|
`personality-store-persist-failure-${agentId}`,
|
|
2164
2164
|
`[theokit-sdk] personality persist failed for ${chunk6LHQPOMI_cjs.redactSecrets(agentId)}: ${chunk6LHQPOMI_cjs.redactSecrets(
|
|
2165
2165
|
err.message
|
|
@@ -2176,7 +2176,7 @@ var PersonalityStore = class {
|
|
|
2176
2176
|
try {
|
|
2177
2177
|
state = await readState(filePath);
|
|
2178
2178
|
} catch (err) {
|
|
2179
|
-
|
|
2179
|
+
chunkH6YM3PV6_cjs.warnOnce(
|
|
2180
2180
|
`personality-store-hydrate-failure-${agentId}`,
|
|
2181
2181
|
`[theokit-sdk] personality hydrate failed for ${chunk6LHQPOMI_cjs.redactSecrets(agentId)}: ${chunk6LHQPOMI_cjs.redactSecrets(
|
|
2182
2182
|
err.message
|
|
@@ -2205,7 +2205,7 @@ var PersonalityStore = class {
|
|
|
2205
2205
|
});
|
|
2206
2206
|
}
|
|
2207
2207
|
#filePath() {
|
|
2208
|
-
return path.join(
|
|
2208
|
+
return path.join(chunkGGZ5GPE3_cjs.getTheokitHome(this.#cwd), FILE_NAME);
|
|
2209
2209
|
}
|
|
2210
2210
|
};
|
|
2211
2211
|
|
|
@@ -2521,6 +2521,37 @@ function removeAll(arr, toRemove) {
|
|
|
2521
2521
|
if (idx !== -1) arr.splice(idx, 1);
|
|
2522
2522
|
}
|
|
2523
2523
|
}
|
|
2524
|
+
function readCompatConfigFile(cwd) {
|
|
2525
|
+
const path$1 = path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), "config.json");
|
|
2526
|
+
if (!fs.existsSync(path$1)) return [];
|
|
2527
|
+
let raw;
|
|
2528
|
+
try {
|
|
2529
|
+
raw = fs.readFileSync(path$1, "utf8");
|
|
2530
|
+
} catch {
|
|
2531
|
+
return [];
|
|
2532
|
+
}
|
|
2533
|
+
let parsed;
|
|
2534
|
+
try {
|
|
2535
|
+
parsed = JSON.parse(raw);
|
|
2536
|
+
} catch (cause) {
|
|
2537
|
+
chunk6LHQPOMI_cjs.diag(
|
|
2538
|
+
`[theokit] ${path$1} is not valid JSON \u2014 ignoring its "compat.adapters" (${cause.message}).
|
|
2539
|
+
`
|
|
2540
|
+
);
|
|
2541
|
+
return [];
|
|
2542
|
+
}
|
|
2543
|
+
const adapters = parsed.compat?.adapters;
|
|
2544
|
+
if (adapters === void 0) return [];
|
|
2545
|
+
if (!Array.isArray(adapters)) {
|
|
2546
|
+
chunk6LHQPOMI_cjs.diag(`[theokit] ${path$1}: "compat.adapters" must be an array \u2014 ignoring it.
|
|
2547
|
+
`);
|
|
2548
|
+
return [];
|
|
2549
|
+
}
|
|
2550
|
+
return adapters;
|
|
2551
|
+
}
|
|
2552
|
+
function resolveCompatSources(options, cwd) {
|
|
2553
|
+
return options.local?.compatSources ?? readCompatConfigFile(cwd);
|
|
2554
|
+
}
|
|
2524
2555
|
function spawnAndCollect(options) {
|
|
2525
2556
|
return new Promise((resolve) => {
|
|
2526
2557
|
const timeoutMs = options.timeoutMs ?? 3e4;
|
|
@@ -2583,7 +2614,7 @@ var HooksExecutor = class {
|
|
|
2583
2614
|
this.config = {};
|
|
2584
2615
|
return;
|
|
2585
2616
|
}
|
|
2586
|
-
this.config = await
|
|
2617
|
+
this.config = await chunkH6YM3PV6_cjs.loadHookConfig(this.cwd, this.compatSources);
|
|
2587
2618
|
}
|
|
2588
2619
|
/** Fire every hook registered for `event` and aggregate the decisions. */
|
|
2589
2620
|
async run(payload) {
|
|
@@ -2636,7 +2667,7 @@ var HooksExecutor = class {
|
|
|
2636
2667
|
if (result.exitCode !== 0) {
|
|
2637
2668
|
const stderr = result.stderr.trim();
|
|
2638
2669
|
const base = stderr.length > 0 ? stderr : `Hook exited with code ${result.exitCode}`;
|
|
2639
|
-
const missing =
|
|
2670
|
+
const missing = chunkGGZ5GPE3_cjs.undefinedVariablesIn(command.command, env);
|
|
2640
2671
|
if (missing.length === 0) return { decision: "deny", reason: base };
|
|
2641
2672
|
return {
|
|
2642
2673
|
decision: "deny",
|
|
@@ -2648,7 +2679,7 @@ var HooksExecutor = class {
|
|
|
2648
2679
|
};
|
|
2649
2680
|
function runtimeEnvFor(sourcePath, cwd) {
|
|
2650
2681
|
if (sourcePath === void 0) return {};
|
|
2651
|
-
return
|
|
2682
|
+
return chunkGGZ5GPE3_cjs.adapterForConfigPath(sourcePath)?.runtimeEnv(cwd) ?? {};
|
|
2652
2683
|
}
|
|
2653
2684
|
function parseDecisionFromStdout(stdout) {
|
|
2654
2685
|
const trimmed = stdout.trim();
|
|
@@ -2757,7 +2788,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2757
2788
|
cwd: workspaceCwd,
|
|
2758
2789
|
// Resolved once, here, and handed to both writers. Recomputing it inside either one is how
|
|
2759
2790
|
// the summary ended up in a directory the indexer never scanned (#463).
|
|
2760
|
-
memoryRoot:
|
|
2791
|
+
memoryRoot: chunkRXZSVNDG_cjs.resolveMemoryRoot(workspaceCwd, inputs.memory),
|
|
2761
2792
|
runId: result.id,
|
|
2762
2793
|
agentId,
|
|
2763
2794
|
userText,
|
|
@@ -2769,7 +2800,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2769
2800
|
if (memoryProvider?.recordSessionSummary !== void 0) {
|
|
2770
2801
|
await memoryProvider.recordSessionSummary(summaryArgs);
|
|
2771
2802
|
} else {
|
|
2772
|
-
await
|
|
2803
|
+
await chunkRXZSVNDG_cjs.writeSessionSummary(summaryArgs);
|
|
2773
2804
|
}
|
|
2774
2805
|
} catch (cause) {
|
|
2775
2806
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
@@ -2821,8 +2852,10 @@ var SkillsManager = class {
|
|
|
2821
2852
|
}
|
|
2822
2853
|
async refresh() {
|
|
2823
2854
|
const roots = this.skillsDir === void 0 ? [
|
|
2824
|
-
...
|
|
2825
|
-
|
|
2855
|
+
...chunkGGZ5GPE3_cjs.projectConfigRoots(this.cwd, this.compatSources, "skills").map(
|
|
2856
|
+
(root) => path.join(root, "skills")
|
|
2857
|
+
),
|
|
2858
|
+
...(await chunkSYVWE64W_cjs.pluginBundleDirs(this.cwd, this.compatSources)).map((b) => path.join(b, "skills"))
|
|
2826
2859
|
] : [this.skillsDir];
|
|
2827
2860
|
const discovered = [];
|
|
2828
2861
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -2966,7 +2999,7 @@ async function resolveSendSkills(inputs, userText, memoryFacts) {
|
|
|
2966
2999
|
inputs.settingSourcesIncludeProject,
|
|
2967
3000
|
settings.skillsDir,
|
|
2968
3001
|
settings.inline,
|
|
2969
|
-
inputs.options.
|
|
3002
|
+
resolveCompatSources(inputs.options, inputs.workspaceCwd)
|
|
2970
3003
|
);
|
|
2971
3004
|
await manager.initialize();
|
|
2972
3005
|
return { manager, autoInject: settings.autoInject ?? true };
|
|
@@ -3406,7 +3439,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3406
3439
|
};
|
|
3407
3440
|
function safeRequire(moduleName) {
|
|
3408
3441
|
try {
|
|
3409
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3442
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-K6VDRJ6I.cjs', document.baseURI).href)));
|
|
3410
3443
|
return r(moduleName);
|
|
3411
3444
|
} catch {
|
|
3412
3445
|
return void 0;
|
|
@@ -3649,7 +3682,7 @@ var cachedOtel;
|
|
|
3649
3682
|
function loadOtel() {
|
|
3650
3683
|
if (cachedOtel === void 0) {
|
|
3651
3684
|
try {
|
|
3652
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3685
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-K6VDRJ6I.cjs', document.baseURI).href)));
|
|
3653
3686
|
const mod = r("@opentelemetry/api");
|
|
3654
3687
|
cachedOtel = mod;
|
|
3655
3688
|
} catch {
|
|
@@ -3968,7 +4001,7 @@ function applyAggregateCap(sources, maxTotal) {
|
|
|
3968
4001
|
}
|
|
3969
4002
|
const remaining = maxTotal - totalBytes;
|
|
3970
4003
|
if (remaining > 0) {
|
|
3971
|
-
const { finalContent } =
|
|
4004
|
+
const { finalContent } = chunkIU5N5224_cjs.truncateWithMarker(s.content, remaining);
|
|
3972
4005
|
kept.push({ ...s, content: finalContent, truncated: true });
|
|
3973
4006
|
totalBytes = maxTotal;
|
|
3974
4007
|
} else {
|
|
@@ -4042,9 +4075,9 @@ var FileContextManager = class {
|
|
|
4042
4075
|
this.lastScope = [...touchedFiles];
|
|
4043
4076
|
const config = await loadContextConfig(this.cwd);
|
|
4044
4077
|
const legacy = await loadSources(config, this.cwd);
|
|
4045
|
-
const maxBytesPerFile = this.settings.maxBytesPerFile ??
|
|
4078
|
+
const maxBytesPerFile = this.settings.maxBytesPerFile ?? chunkIU5N5224_cjs.DEFAULT_MAX_BYTES_PER_FILE;
|
|
4046
4079
|
const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
|
|
4047
|
-
const discovered = await
|
|
4080
|
+
const discovered = await chunkIU5N5224_cjs.runDiscovery({
|
|
4048
4081
|
cwd: this.cwd,
|
|
4049
4082
|
maxBytesPerFile,
|
|
4050
4083
|
skipLegacyTheokitContext: true,
|
|
@@ -4103,8 +4136,8 @@ var FileContextManager = class {
|
|
|
4103
4136
|
}
|
|
4104
4137
|
};
|
|
4105
4138
|
async function loadContextConfig(cwd) {
|
|
4106
|
-
const mdDir = path.join(cwd, "
|
|
4107
|
-
const jsonPath = path.join(cwd, "
|
|
4139
|
+
const mdDir = path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), "context");
|
|
4140
|
+
const jsonPath = path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), "context.json");
|
|
4108
4141
|
const mdEntities = await loadMarkdownEntities({
|
|
4109
4142
|
dir: mdDir,
|
|
4110
4143
|
schema: ContextSourceFrontmatterSchema,
|
|
@@ -4113,7 +4146,7 @@ async function loadContextConfig(cwd) {
|
|
|
4113
4146
|
});
|
|
4114
4147
|
if (mdEntities.length > 0) {
|
|
4115
4148
|
if (fs.existsSync(jsonPath)) {
|
|
4116
|
-
|
|
4149
|
+
chunkH6YM3PV6_cjs.warnOnce(
|
|
4117
4150
|
"context-both-present",
|
|
4118
4151
|
"[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
|
|
4119
4152
|
);
|
|
@@ -4123,7 +4156,7 @@ async function loadContextConfig(cwd) {
|
|
|
4123
4156
|
};
|
|
4124
4157
|
}
|
|
4125
4158
|
if (!fs.existsSync(jsonPath)) return { sources: [] };
|
|
4126
|
-
|
|
4159
|
+
chunkH6YM3PV6_cjs.warnOnce(
|
|
4127
4160
|
"context-json-deprecated",
|
|
4128
4161
|
// Names no command: `theokit-migrate-config` was unpublished with the `bin` entry, and a warning
|
|
4129
4162
|
// that tells you to run something the package does not ship is worse than one that tells you
|
|
@@ -4264,7 +4297,7 @@ var PluginsManager = class {
|
|
|
4264
4297
|
}
|
|
4265
4298
|
async refresh() {
|
|
4266
4299
|
this.plugins = [];
|
|
4267
|
-
for (const pluginsRoot of
|
|
4300
|
+
for (const pluginsRoot of chunkGGZ5GPE3_cjs.pluginBundleRoots(this.cwd, this.compatSources)) {
|
|
4268
4301
|
await this.refreshRoot(pluginsRoot);
|
|
4269
4302
|
}
|
|
4270
4303
|
}
|
|
@@ -4276,7 +4309,7 @@ var PluginsManager = class {
|
|
|
4276
4309
|
const folderName = entry.name;
|
|
4277
4310
|
const cliPath = path.join(pluginsRoot, folderName, ".claude-plugin", "plugin.json");
|
|
4278
4311
|
if (fs.existsSync(cliPath)) {
|
|
4279
|
-
const cliMetadata = await loadPluginManifestFromJson(cliPath, folderName);
|
|
4312
|
+
const cliMetadata = await loadPluginManifestFromJson(this.cwd, cliPath, folderName);
|
|
4280
4313
|
if (this.enabled === void 0 || this.enabled.includes(cliMetadata.name)) {
|
|
4281
4314
|
this.plugins.push(cliMetadata);
|
|
4282
4315
|
}
|
|
@@ -4284,22 +4317,22 @@ var PluginsManager = class {
|
|
|
4284
4317
|
}
|
|
4285
4318
|
const mdPath = path.join(pluginsRoot, folderName, "PLUGIN.md");
|
|
4286
4319
|
const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
|
|
4287
|
-
const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
|
|
4320
|
+
const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(this.cwd, pluginsRoot, folderName) : await loadPluginManifestFromJson(this.cwd, jsonPath, folderName);
|
|
4288
4321
|
if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
|
|
4289
|
-
|
|
4322
|
+
chunkH6YM3PV6_cjs.warnOnce(
|
|
4290
4323
|
`plugin-${folderName}-both`,
|
|
4291
4324
|
`[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
|
|
4292
4325
|
);
|
|
4293
4326
|
}
|
|
4294
4327
|
if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
|
|
4295
|
-
|
|
4328
|
+
chunkH6YM3PV6_cjs.warnOnce(
|
|
4296
4329
|
"plugin-json-deprecated",
|
|
4297
4330
|
// Same reason as the context.json warning: the CLI it used to name is no longer published.
|
|
4298
4331
|
"[theokit-sdk] plugin.json manifests are deprecated; replace each with a PLUGIN.md"
|
|
4299
4332
|
);
|
|
4300
4333
|
}
|
|
4301
4334
|
if (this.enabled === void 0 || this.enabled.includes(metadata.name)) {
|
|
4302
|
-
await this.assertEntryFileExists(metadata, folderName);
|
|
4335
|
+
await this.assertEntryFileExists(metadata, folderName, pluginsRoot);
|
|
4303
4336
|
this.plugins.push(metadata);
|
|
4304
4337
|
}
|
|
4305
4338
|
}
|
|
@@ -4307,10 +4340,10 @@ var PluginsManager = class {
|
|
|
4307
4340
|
list() {
|
|
4308
4341
|
return Promise.resolve(this.plugins);
|
|
4309
4342
|
}
|
|
4310
|
-
async assertEntryFileExists(metadata, folderName) {
|
|
4343
|
+
async assertEntryFileExists(metadata, folderName, pluginsRoot) {
|
|
4311
4344
|
const entry = metadata.entry;
|
|
4312
4345
|
if (entry === void 0) return;
|
|
4313
|
-
const pluginRoot = path.join(
|
|
4346
|
+
const pluginRoot = path.join(pluginsRoot, folderName);
|
|
4314
4347
|
const entryPath = chunk7A6535RA_cjs.safePathJoin(pluginRoot, entry);
|
|
4315
4348
|
try {
|
|
4316
4349
|
await promises.readFile(entryPath, "utf8");
|
|
@@ -4346,7 +4379,7 @@ var PluginsManager = class {
|
|
|
4346
4379
|
}
|
|
4347
4380
|
}
|
|
4348
4381
|
};
|
|
4349
|
-
async function loadPluginManifestFromJson(manifestPath, folderName) {
|
|
4382
|
+
async function loadPluginManifestFromJson(cwd, manifestPath, folderName) {
|
|
4350
4383
|
let raw;
|
|
4351
4384
|
try {
|
|
4352
4385
|
raw = await promises.readFile(manifestPath, "utf8");
|
|
@@ -4374,12 +4407,12 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
|
|
|
4374
4407
|
const name = typeof record.name === "string" ? record.name : folderName;
|
|
4375
4408
|
const version = typeof record.version === "string" ? record.version : "0.0.0";
|
|
4376
4409
|
const capabilities = Array.isArray(record.capabilities) ? record.capabilities.filter((cap) => typeof cap === "string") : [];
|
|
4377
|
-
const source =
|
|
4410
|
+
const source = path.relative(cwd, manifestPath);
|
|
4378
4411
|
const metadata = { name, version, capabilities, source };
|
|
4379
4412
|
if (typeof record.entry === "string") metadata.entry = record.entry;
|
|
4380
4413
|
return metadata;
|
|
4381
4414
|
}
|
|
4382
|
-
async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
|
|
4415
|
+
async function loadPluginManifestFromMarkdown(cwd, pluginsRoot, folderName) {
|
|
4383
4416
|
const mdPath = path.join(pluginsRoot, folderName, "PLUGIN.md");
|
|
4384
4417
|
let raw;
|
|
4385
4418
|
try {
|
|
@@ -4405,7 +4438,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
|
|
|
4405
4438
|
});
|
|
4406
4439
|
}
|
|
4407
4440
|
const fm = entity.frontmatter;
|
|
4408
|
-
const source =
|
|
4441
|
+
const source = path.relative(cwd, mdPath);
|
|
4409
4442
|
const metadata = {
|
|
4410
4443
|
name: fm.name ?? folderName,
|
|
4411
4444
|
version: fm.version ?? "0.0.0",
|
|
@@ -4461,14 +4494,20 @@ function buildSkills(args, out) {
|
|
|
4461
4494
|
staticSkills?.inline,
|
|
4462
4495
|
// #524 — the same declaration the per-send manager reads. Omitting it here would make
|
|
4463
4496
|
// `agent.skills` disagree with the system prompt about which skills exist.
|
|
4464
|
-
args.options.
|
|
4497
|
+
resolveCompatSources(args.options, args.workspaceCwd)
|
|
4465
4498
|
);
|
|
4466
4499
|
const localSkills = out.skillsManager;
|
|
4467
4500
|
out.skills = {
|
|
4468
4501
|
// Project to the public shape (name + description only). Inline skills carry
|
|
4469
4502
|
// their body + references on the object; `list()` must never leak them —
|
|
4470
4503
|
// the body is reachable exclusively through `get()`.
|
|
4471
|
-
list: async () => (await localSkills.list()).map((s) => ({
|
|
4504
|
+
list: async () => (await localSkills.list()).map((s) => ({
|
|
4505
|
+
name: s.name,
|
|
4506
|
+
description: s.description,
|
|
4507
|
+
// The PATH, never the body. Dropping it with the body answered a question nobody asked and
|
|
4508
|
+
// silenced the one #524 is about: which root did this skill come from.
|
|
4509
|
+
...s.source === void 0 ? {} : { source: s.source }
|
|
4510
|
+
})),
|
|
4472
4511
|
get: (name) => localSkills.get(name)
|
|
4473
4512
|
};
|
|
4474
4513
|
}
|
|
@@ -4482,7 +4521,7 @@ function buildPlugins(args, out) {
|
|
|
4482
4521
|
args.settingSourcesIncludePlugins,
|
|
4483
4522
|
false,
|
|
4484
4523
|
void 0,
|
|
4485
|
-
args.options.
|
|
4524
|
+
resolveCompatSources(args.options, args.workspaceCwd)
|
|
4486
4525
|
);
|
|
4487
4526
|
const localPlugins = out.pluginsManager;
|
|
4488
4527
|
out.plugins = { list: () => localPlugins.list() };
|
|
@@ -7170,7 +7209,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
|
|
|
7170
7209
|
if (exposedSet.has(name)) continue;
|
|
7171
7210
|
const hint = suggestClosest(name, exposedSet);
|
|
7172
7211
|
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)`;
|
|
7173
|
-
|
|
7212
|
+
chunkH6YM3PV6_cjs.warnOnce(
|
|
7174
7213
|
`personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
|
|
7175
7214
|
message
|
|
7176
7215
|
);
|
|
@@ -7613,7 +7652,7 @@ async function dispatchLocalRun(args) {
|
|
|
7613
7652
|
});
|
|
7614
7653
|
}
|
|
7615
7654
|
async function readProjectMcpServers(cwd) {
|
|
7616
|
-
const path$1 = path.join(cwd, "
|
|
7655
|
+
const path$1 = path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), "mcp.json");
|
|
7617
7656
|
try {
|
|
7618
7657
|
const raw = await promises.readFile(path$1, "utf8");
|
|
7619
7658
|
const parsed = JSON.parse(raw);
|
|
@@ -7855,7 +7894,7 @@ async function reloadLocalAgent(agent) {
|
|
|
7855
7894
|
if (agent.context !== void 0) await agent.context.refresh();
|
|
7856
7895
|
if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
|
|
7857
7896
|
if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
|
|
7858
|
-
return await
|
|
7897
|
+
return await chunkSYVWE64W_cjs.loadSubagents(
|
|
7859
7898
|
agent.workspaceCwd,
|
|
7860
7899
|
agent.settingSourcesIncludeProject,
|
|
7861
7900
|
agent.options.agents
|
|
@@ -8101,7 +8140,7 @@ async function finalize(args, queryMode, result) {
|
|
|
8101
8140
|
};
|
|
8102
8141
|
args.cache?.set(args.userText, queryMode, result, tenantCtx);
|
|
8103
8142
|
if (args.persistTranscripts === true && args.cwd !== void 0) {
|
|
8104
|
-
await chunkTMKTSYDS_cjs.persistActiveMemoryTranscript(args.memoryRoot ??
|
|
8143
|
+
await chunkTMKTSYDS_cjs.persistActiveMemoryTranscript(args.memoryRoot ?? chunkRXZSVNDG_cjs.resolveMemoryRoot(args.cwd), {
|
|
8105
8144
|
runId: args.runId ?? `run-${Date.now()}`,
|
|
8106
8145
|
startedAtMs: Date.now() - result.durationMs,
|
|
8107
8146
|
userText: args.userText,
|
|
@@ -8692,7 +8731,7 @@ var LocalAgentMemory = class {
|
|
|
8692
8731
|
const openOpts = { cwd: this.workspaceCwd, memoryRoot };
|
|
8693
8732
|
if (embedding !== void 0) openOpts.embedding = embedding;
|
|
8694
8733
|
if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
|
|
8695
|
-
this.index = await
|
|
8734
|
+
this.index = await chunkKBXADFBJ_cjs.IndexManager.open(openOpts);
|
|
8696
8735
|
await this.index.sync();
|
|
8697
8736
|
this.toolsCache = [
|
|
8698
8737
|
createMemorySearchTool({ index: this.index }),
|
|
@@ -8736,7 +8775,7 @@ var LocalAgentMemory = class {
|
|
|
8736
8775
|
* and the active-memory transcript writer. Three separate resolutions is how they drifted (#463).
|
|
8737
8776
|
*/
|
|
8738
8777
|
memoryRoot() {
|
|
8739
|
-
this.memoryRootCache ??=
|
|
8778
|
+
this.memoryRootCache ??= chunkRXZSVNDG_cjs.resolveMemoryRoot(this.workspaceCwd, this.options.memory);
|
|
8740
8779
|
return this.memoryRootCache;
|
|
8741
8780
|
}
|
|
8742
8781
|
buildActiveMemoryOptions(cfg) {
|
|
@@ -8851,7 +8890,7 @@ function createLocalAgentMemoryProvider(opts) {
|
|
|
8851
8890
|
return { facts: [], systemPromptAdditions: summary };
|
|
8852
8891
|
},
|
|
8853
8892
|
async recordSessionSummary(args) {
|
|
8854
|
-
await
|
|
8893
|
+
await chunkRXZSVNDG_cjs.writeSessionSummary(args);
|
|
8855
8894
|
},
|
|
8856
8895
|
async sync(handle) {
|
|
8857
8896
|
const state = handle[INTERNAL_LAM_KEY];
|
|
@@ -8874,7 +8913,7 @@ var PersonalityFrontmatterSchema = zod.z.object({
|
|
|
8874
8913
|
var RESERVED_CLEAR_SLUGS = ["none", "default", "neutral"];
|
|
8875
8914
|
|
|
8876
8915
|
// src/internal/personality/registry.ts
|
|
8877
|
-
var
|
|
8916
|
+
var PERSONALITIES_SUFFIX = "personalities";
|
|
8878
8917
|
var USER_SUBDIR = ".theokit/personalities";
|
|
8879
8918
|
var PersonalityRegistry = class _PersonalityRegistry {
|
|
8880
8919
|
#byName;
|
|
@@ -8889,7 +8928,7 @@ var PersonalityRegistry = class _PersonalityRegistry {
|
|
|
8889
8928
|
* @internal
|
|
8890
8929
|
*/
|
|
8891
8930
|
static async load(cwd) {
|
|
8892
|
-
const projectDir = path.join(cwd,
|
|
8931
|
+
const projectDir = path.join(chunkGGZ5GPE3_cjs.theokitConfigRoot(cwd), PERSONALITIES_SUFFIX);
|
|
8893
8932
|
const userDir = path.join(os.homedir(), USER_SUBDIR);
|
|
8894
8933
|
const [userEntities, projectEntities] = await Promise.all([
|
|
8895
8934
|
loadMarkdownEntities({
|
|
@@ -8941,7 +8980,7 @@ function addEntity(byName, entity, origin, collisionMap) {
|
|
|
8941
8980
|
);
|
|
8942
8981
|
}
|
|
8943
8982
|
if (origin === "project" && collisionMap?.has(fm.name)) {
|
|
8944
|
-
|
|
8983
|
+
chunkH6YM3PV6_cjs.warnOnce(
|
|
8945
8984
|
`personality-collision-${fm.name}`,
|
|
8946
8985
|
`[theokit-sdk] personality "${fm.name}" overridden by project preset`
|
|
8947
8986
|
);
|
|
@@ -8991,14 +9030,14 @@ async function performPersonalitySwitch(args) {
|
|
|
8991
9030
|
|
|
8992
9031
|
// src/internal/local-agent/local-agent-personality-extensions.ts
|
|
8993
9032
|
function resolveActivePersonalityPreset(args) {
|
|
8994
|
-
const forkCtx =
|
|
9033
|
+
const forkCtx = chunkH6YM3PV6_cjs.currentPersonalityContext();
|
|
8995
9034
|
const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
|
|
8996
9035
|
if (slug === void 0) return void 0;
|
|
8997
9036
|
return args.personalityRegistry?.get(slug);
|
|
8998
9037
|
}
|
|
8999
9038
|
async function ensurePersonalityRegistryIfNeeded(args) {
|
|
9000
9039
|
if (args.personalityRegistry !== void 0) return args.personalityRegistry;
|
|
9001
|
-
const forkSlug =
|
|
9040
|
+
const forkSlug = chunkH6YM3PV6_cjs.currentPersonalityContext()?.slug;
|
|
9002
9041
|
const ownSlug = args.personalityStore.active(args.agentId);
|
|
9003
9042
|
if (forkSlug === void 0 && ownSlug === void 0) return void 0;
|
|
9004
9043
|
return await PersonalityRegistry.load(args.workspaceCwd);
|
|
@@ -9011,8 +9050,8 @@ function applyPersonalityOverlay(preset, base) {
|
|
|
9011
9050
|
${preset.systemPrompt}`;
|
|
9012
9051
|
}
|
|
9013
9052
|
async function localAgentUsePersonality(agent, name, opts) {
|
|
9014
|
-
if (
|
|
9015
|
-
|
|
9053
|
+
if (chunkH6YM3PV6_cjs.currentPersonalityContext() !== void 0) {
|
|
9054
|
+
chunkH6YM3PV6_cjs.warnPersonalitySwitchInsideFork(agent.agentId);
|
|
9016
9055
|
return null;
|
|
9017
9056
|
}
|
|
9018
9057
|
if (agent.personalityRegistry === void 0) {
|
|
@@ -9073,7 +9112,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
|
|
|
9073
9112
|
async function localAgentFork(parent, options) {
|
|
9074
9113
|
const { forkAgentImpl } = await import('./fork-agent-WAEQI2DL.cjs');
|
|
9075
9114
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
9076
|
-
const { withPersonalityContext } = await import('./context-
|
|
9115
|
+
const { withPersonalityContext } = await import('./context-NI33FS2R.cjs');
|
|
9077
9116
|
const create = getAgentFacade().create;
|
|
9078
9117
|
return withPersonalityContext(
|
|
9079
9118
|
{ slug: parent.personalitySlugSnapshot, isFork: true },
|
|
@@ -9864,8 +9903,8 @@ var LocalAgent = class {
|
|
|
9864
9903
|
this.pluginsManager = sub.pluginsManager;
|
|
9865
9904
|
if (sub.plugins !== void 0) this.plugins = sub.plugins;
|
|
9866
9905
|
reportUnknownLocalOptions(options.local);
|
|
9867
|
-
const compatSources = options.
|
|
9868
|
-
|
|
9906
|
+
const compatSources = resolveCompatSources(options, this.workspaceCwd);
|
|
9907
|
+
chunkGGZ5GPE3_cjs.reportUndeclaredSources(this.workspaceCwd, compatSources);
|
|
9869
9908
|
this.hooksExecutor = new HooksExecutor(this.workspaceCwd, compatSources);
|
|
9870
9909
|
this.defaultMemoryProviderForLoop = createLocalAgentMemoryProvider({
|
|
9871
9910
|
agentOptions: options,
|
|
@@ -9893,11 +9932,11 @@ var LocalAgent = class {
|
|
|
9893
9932
|
if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
|
|
9894
9933
|
const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
|
|
9895
9934
|
await this.pluginManagerCode.initialize(codePlugins);
|
|
9896
|
-
this.resolvedSubagents = await
|
|
9935
|
+
this.resolvedSubagents = await chunkSYVWE64W_cjs.loadSubagents(
|
|
9897
9936
|
this.workspaceCwd,
|
|
9898
9937
|
this.settingSourcesIncludeProject,
|
|
9899
9938
|
this.options.agents,
|
|
9900
|
-
this.options.
|
|
9939
|
+
resolveCompatSources(this.options, this.workspaceCwd)
|
|
9901
9940
|
);
|
|
9902
9941
|
await acquireLeaseIfPossible(this.sessionStore, this.agentId);
|
|
9903
9942
|
try {
|
|
@@ -10846,7 +10885,7 @@ var Agent = class _Agent {
|
|
|
10846
10885
|
*/
|
|
10847
10886
|
static async describe(agentId) {
|
|
10848
10887
|
const agent = await getRegisteredAgentOrThrow(agentId);
|
|
10849
|
-
const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-
|
|
10888
|
+
const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-TPZLTXYZ.cjs');
|
|
10850
10889
|
const settingSources = agent.options.local?.settingSources;
|
|
10851
10890
|
const subagents = await loadSubagents2(
|
|
10852
10891
|
agent.cwd ?? process.cwd(),
|
|
@@ -10944,5 +10983,5 @@ exports.computeCost = computeCost;
|
|
|
10944
10983
|
exports.generateCronId = generateCronId;
|
|
10945
10984
|
exports.getPricingEntry = getPricingEntry;
|
|
10946
10985
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
10947
|
-
//# sourceMappingURL=chunk-
|
|
10948
|
-
//# sourceMappingURL=chunk-
|
|
10986
|
+
//# sourceMappingURL=chunk-K6VDRJ6I.cjs.map
|
|
10987
|
+
//# sourceMappingURL=chunk-K6VDRJ6I.cjs.map
|