@theokit/sdk 4.56.0 → 4.57.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 +71 -0
- package/dist/{agent-PJMBK7HQ.cjs → agent-2T2EJIP6.cjs} +10 -10
- package/dist/{agent-PJMBK7HQ.cjs.map → agent-2T2EJIP6.cjs.map} +1 -1
- package/dist/{agent-K3PQBS7D.js → agent-ZIYCVEZL.js} +9 -9
- package/dist/{agent-K3PQBS7D.js.map → agent-ZIYCVEZL.js.map} +1 -1
- package/dist/agent-session-store-G2BMUZQV.js +7 -0
- package/dist/{agent-session-store-P6V3FINW.js.map → agent-session-store-G2BMUZQV.js.map} +1 -1
- package/dist/agent-session-store-WAKLOKWK.cjs +24 -0
- package/dist/{agent-session-store-ZJ3JSRS4.cjs.map → agent-session-store-WAKLOKWK.cjs.map} +1 -1
- package/dist/{chunk-HLPSLDGL.cjs → chunk-43GFJ5SD.cjs} +7 -7
- package/dist/{chunk-HLPSLDGL.cjs.map → chunk-43GFJ5SD.cjs.map} +1 -1
- package/dist/{chunk-KBXWEWKS.js → chunk-7TCRNXNK.js} +50 -30
- package/dist/chunk-7TCRNXNK.js.map +1 -0
- package/dist/{chunk-JHPGF3FP.cjs → chunk-BUIK7GUA.cjs} +22 -2
- package/dist/chunk-BUIK7GUA.cjs.map +1 -0
- package/dist/{chunk-6VLKVX7O.cjs → chunk-E7JHD6QJ.cjs} +4 -3
- package/dist/chunk-E7JHD6QJ.cjs.map +1 -0
- package/dist/{chunk-DZBSJX6J.js → chunk-FKMUFNQE.js} +21 -4
- package/dist/chunk-FKMUFNQE.js.map +1 -0
- package/dist/{chunk-BMAZLQQ4.js → chunk-G24KZRSA.js} +3 -3
- package/dist/{chunk-BMAZLQQ4.js.map → chunk-G24KZRSA.js.map} +1 -1
- package/dist/{chunk-ODTZ7HX3.js → chunk-G6EEYRDD.js} +3 -3
- package/dist/chunk-G6EEYRDD.js.map +1 -0
- package/dist/{chunk-MVAPK2BX.js → chunk-IACR5LEM.js} +3 -3
- package/dist/{chunk-MVAPK2BX.js.map → chunk-IACR5LEM.js.map} +1 -1
- package/dist/{chunk-V2UUGUY4.cjs → chunk-KKK3FZ4A.cjs} +6 -6
- package/dist/{chunk-V2UUGUY4.cjs.map → chunk-KKK3FZ4A.cjs.map} +1 -1
- package/dist/{chunk-M7UHYBEY.js → chunk-LEM2GOMI.js} +3 -3
- package/dist/{chunk-M7UHYBEY.js.map → chunk-LEM2GOMI.js.map} +1 -1
- package/dist/{chunk-LQYQHXIW.cjs → chunk-M2JWHKO6.cjs} +103 -83
- package/dist/chunk-M2JWHKO6.cjs.map +1 -0
- package/dist/{chunk-YPJ5NH5N.cjs → chunk-QI7WE46I.cjs} +29 -6
- package/dist/chunk-QI7WE46I.cjs.map +1 -0
- package/dist/{chunk-OHBIUXKM.js → chunk-WG7R5W6R.js} +4 -4
- package/dist/{chunk-OHBIUXKM.js.map → chunk-WG7R5W6R.js.map} +1 -1
- package/dist/{chunk-H5GOSXSC.cjs → chunk-X7O4255I.cjs} +4 -4
- package/dist/{chunk-H5GOSXSC.cjs.map → chunk-X7O4255I.cjs.map} +1 -1
- package/dist/{chunk-GJ6RK75E.js → chunk-YJDH3CKG.js} +29 -6
- package/dist/chunk-YJDH3CKG.js.map +1 -0
- package/dist/{chunk-CTCGWIUD.cjs → chunk-Z4BCLVTI.cjs} +5 -5
- package/dist/{chunk-CTCGWIUD.cjs.map → chunk-Z4BCLVTI.cjs.map} +1 -1
- package/dist/{compact-session-FUJDVF7B.js → compact-session-QGDNP45U.js} +4 -4
- package/dist/{compact-session-FUJDVF7B.js.map → compact-session-QGDNP45U.js.map} +1 -1
- package/dist/{compact-session-LEWF554G.cjs → compact-session-YHFQIXV5.cjs} +12 -12
- package/dist/{compact-session-LEWF554G.cjs.map → compact-session-YHFQIXV5.cjs.map} +1 -1
- package/dist/cron.cjs +9 -9
- package/dist/cron.js +8 -8
- package/dist/eval.cjs +8 -8
- package/dist/eval.js +7 -7
- package/dist/{fs-session-store-IN7JTTXD.js → fs-session-store-4BHGIWRE.js} +4 -4
- package/dist/{fs-session-store-IN7JTTXD.js.map → fs-session-store-4BHGIWRE.js.map} +1 -1
- package/dist/{fs-session-store-3MOJQGP2.cjs → fs-session-store-XZ7ZTB3A.cjs} +5 -5
- package/dist/{fs-session-store-3MOJQGP2.cjs.map → fs-session-store-XZ7ZTB3A.cjs.map} +1 -1
- package/dist/{index-manager-WC5ZVJWO.cjs → index-manager-AO4LJQZ4.cjs} +4 -4
- package/dist/{index-manager-WC5ZVJWO.cjs.map → index-manager-AO4LJQZ4.cjs.map} +1 -1
- package/dist/{index-manager-WBIMDVQT.js → index-manager-QDPIYIGV.js} +3 -3
- package/dist/{index-manager-WBIMDVQT.js.map → index-manager-QDPIYIGV.js.map} +1 -1
- package/dist/index.cjs +38 -38
- package/dist/index.js +11 -11
- package/dist/{inject-session-WQGGMCQY.cjs → inject-session-MLCJMYDG.cjs} +7 -7
- package/dist/{inject-session-WQGGMCQY.cjs.map → inject-session-MLCJMYDG.cjs.map} +1 -1
- package/dist/{inject-session-BJMJH5BX.js → inject-session-RBQZ45UM.js} +5 -5
- package/dist/{inject-session-BJMJH5BX.js.map → inject-session-RBQZ45UM.js.map} +1 -1
- package/dist/internal/persistence/session-transcript.d.cts +40 -1
- package/dist/internal/persistence/session-transcript.d.ts +40 -1
- package/dist/persistence.cjs +4 -4
- package/dist/persistence.js +1 -1
- package/dist/session-transcript-HF5GEU5M.cjs +63 -0
- package/dist/{session-transcript-JXHFTB7G.cjs.map → session-transcript-HF5GEU5M.cjs.map} +1 -1
- package/dist/session-transcript-P462ZRHX.js +6 -0
- package/dist/{session-transcript-AKDYYGXQ.js.map → session-transcript-P462ZRHX.js.map} +1 -1
- package/docs/error-codes.md +4 -4
- package/docs/harness-capability-map.md +1 -1
- package/package.json +5 -9
- package/dist/agent-session-store-P6V3FINW.js +0 -7
- package/dist/agent-session-store-ZJ3JSRS4.cjs +0 -24
- package/dist/chunk-6VLKVX7O.cjs.map +0 -1
- package/dist/chunk-DZBSJX6J.js.map +0 -1
- package/dist/chunk-GJ6RK75E.js.map +0 -1
- package/dist/chunk-JHPGF3FP.cjs.map +0 -1
- package/dist/chunk-KBXWEWKS.js.map +0 -1
- package/dist/chunk-LQYQHXIW.cjs.map +0 -1
- package/dist/chunk-ODTZ7HX3.js.map +0 -1
- package/dist/chunk-YPJ5NH5N.cjs.map +0 -1
- package/dist/session-transcript-AKDYYGXQ.js +0 -6
- package/dist/session-transcript-JXHFTB7G.cjs +0 -51
package/dist/index.cjs
CHANGED
|
@@ -8,22 +8,22 @@ require('./chunk-QDED6YO6.cjs');
|
|
|
8
8
|
var chunkGNT35C5U_cjs = require('./chunk-GNT35C5U.cjs');
|
|
9
9
|
require('./chunk-XWL6O3SW.cjs');
|
|
10
10
|
require('./chunk-VTYY7XL5.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
require('./chunk-
|
|
14
|
-
var
|
|
11
|
+
var chunkX7O4255I_cjs = require('./chunk-X7O4255I.cjs');
|
|
12
|
+
var chunkM2JWHKO6_cjs = require('./chunk-M2JWHKO6.cjs');
|
|
13
|
+
require('./chunk-KKK3FZ4A.cjs');
|
|
14
|
+
var chunkE7JHD6QJ_cjs = require('./chunk-E7JHD6QJ.cjs');
|
|
15
15
|
require('./chunk-53CBTBWO.cjs');
|
|
16
16
|
require('./chunk-BV2MWEMV.cjs');
|
|
17
17
|
var chunkNGESVVJN_cjs = require('./chunk-NGESVVJN.cjs');
|
|
18
18
|
require('./chunk-BUUUWQMB.cjs');
|
|
19
19
|
require('./chunk-EI2Q7SJ5.cjs');
|
|
20
20
|
require('./chunk-GHX4P3V2.cjs');
|
|
21
|
-
require('./chunk-
|
|
22
|
-
var
|
|
21
|
+
require('./chunk-QI7WE46I.cjs');
|
|
22
|
+
var chunk43GFJ5SD_cjs = require('./chunk-43GFJ5SD.cjs');
|
|
23
23
|
require('./chunk-F3YZMOAU.cjs');
|
|
24
24
|
require('./chunk-4OTIXDMU.cjs');
|
|
25
25
|
require('./chunk-DQKERTND.cjs');
|
|
26
|
-
require('./chunk-
|
|
26
|
+
require('./chunk-Z4BCLVTI.cjs');
|
|
27
27
|
require('./chunk-2ZPEDVLM.cjs');
|
|
28
28
|
require('./chunk-E3WZ6Y4H.cjs');
|
|
29
29
|
require('./chunk-KRD3GQAA.cjs');
|
|
@@ -42,7 +42,7 @@ require('./chunk-VKJ7V7EB.cjs');
|
|
|
42
42
|
require('./chunk-ILCGLTSA.cjs');
|
|
43
43
|
require('./chunk-CQGYNZ3K.cjs');
|
|
44
44
|
require('./chunk-4I55V454.cjs');
|
|
45
|
-
require('./chunk-
|
|
45
|
+
require('./chunk-BUIK7GUA.cjs');
|
|
46
46
|
require('./chunk-SKXBJ2NU.cjs');
|
|
47
47
|
require('./chunk-2ADR2GSO.cjs');
|
|
48
48
|
var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
|
|
@@ -69,8 +69,8 @@ var fs = require('fs');
|
|
|
69
69
|
// src/agent-factory.ts
|
|
70
70
|
function createAgentFactory(common) {
|
|
71
71
|
return {
|
|
72
|
-
forSession: (agentId, overrides) =>
|
|
73
|
-
getOrCreate: (agentId, overrides) =>
|
|
72
|
+
forSession: (agentId, overrides) => chunkM2JWHKO6_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
|
|
73
|
+
getOrCreate: (agentId, overrides) => chunkM2JWHKO6_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
function mergeAgentOptions(common, overrides, agentId) {
|
|
@@ -1018,7 +1018,7 @@ function foldLayers(entries, accumulatingKeys = []) {
|
|
|
1018
1018
|
return combined;
|
|
1019
1019
|
}
|
|
1020
1020
|
function diaryPath(cwd) {
|
|
1021
|
-
return path.join(
|
|
1021
|
+
return path.join(chunkE7JHD6QJ_cjs.memoryDir(cwd), "dream-diary.md");
|
|
1022
1022
|
}
|
|
1023
1023
|
function renderDiaryEntry(entry) {
|
|
1024
1024
|
const stamp = new Date(entry.timestampMs).toISOString();
|
|
@@ -1165,7 +1165,7 @@ async function runInner(options) {
|
|
|
1165
1165
|
const now = options.now ?? Date.now;
|
|
1166
1166
|
const timestampMs = now();
|
|
1167
1167
|
try {
|
|
1168
|
-
const facts = await
|
|
1168
|
+
const facts = await chunkE7JHD6QJ_cjs.readFactsFromMarkdown(options.cwd);
|
|
1169
1169
|
if (facts.length === 0) {
|
|
1170
1170
|
return emptyResult("skipped");
|
|
1171
1171
|
}
|
|
@@ -1199,7 +1199,7 @@ async function runInner(options) {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
async function writeConsolidatedNotes(cwd, clusters, timestampMs) {
|
|
1201
1201
|
if (clusters.length === 0) return 0;
|
|
1202
|
-
const notesDir = path.join(
|
|
1202
|
+
const notesDir = path.join(chunkE7JHD6QJ_cjs.memoryDir(cwd), "notes");
|
|
1203
1203
|
await promises.mkdir(notesDir, { recursive: true });
|
|
1204
1204
|
const isoSlug = new Date(timestampMs).toISOString().replace(/[^\dT]/g, "-");
|
|
1205
1205
|
const file = path.join(notesDir, `dreamed-${isoSlug}.md`);
|
|
@@ -1265,8 +1265,8 @@ var Memory = {
|
|
|
1265
1265
|
openArgs.embedding = await resolveEmbedding(opts.embedding, peer.MEMORY_EMBEDDING_ADAPTERS);
|
|
1266
1266
|
return await peer.IndexManager.open(openArgs);
|
|
1267
1267
|
}
|
|
1268
|
-
const { IndexManager } = await import('./index-manager-
|
|
1269
|
-
openArgs.embedding = await resolveEmbedding(opts.embedding,
|
|
1268
|
+
const { IndexManager } = await import('./index-manager-AO4LJQZ4.cjs');
|
|
1269
|
+
openArgs.embedding = await resolveEmbedding(opts.embedding, chunkM2JWHKO6_cjs.MEMORY_EMBEDDING_ADAPTERS);
|
|
1270
1270
|
return await IndexManager.open(openArgs);
|
|
1271
1271
|
},
|
|
1272
1272
|
/**
|
|
@@ -1277,7 +1277,7 @@ var Memory = {
|
|
|
1277
1277
|
*/
|
|
1278
1278
|
async runDreamingSweep(opts) {
|
|
1279
1279
|
const peer = await tryLoadSdkMemoryPeer();
|
|
1280
|
-
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS :
|
|
1280
|
+
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkM2JWHKO6_cjs.MEMORY_EMBEDDING_ADAPTERS;
|
|
1281
1281
|
const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
|
|
1282
1282
|
const result = peer !== null ? (
|
|
1283
1283
|
// biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
|
|
@@ -1343,9 +1343,9 @@ function extractRawId(id, expectedAdapterId) {
|
|
|
1343
1343
|
return id.slice(prefix.length);
|
|
1344
1344
|
}
|
|
1345
1345
|
async function readAllSqliteFacts(cwd) {
|
|
1346
|
-
const dbPath =
|
|
1346
|
+
const dbPath = chunkE7JHD6QJ_cjs.defaultIndexPath(cwd);
|
|
1347
1347
|
if (!fs.existsSync(dbPath)) return [];
|
|
1348
|
-
const db = await
|
|
1348
|
+
const db = await chunkE7JHD6QJ_cjs.openMemoryDb({ filePath: dbPath });
|
|
1349
1349
|
try {
|
|
1350
1350
|
const stmt = db.prepare("SELECT id, path, source, start_line, end_line, text FROM chunks");
|
|
1351
1351
|
const rows = stmt.all();
|
|
@@ -1364,7 +1364,7 @@ function nfcEqual(a, b) {
|
|
|
1364
1364
|
}
|
|
1365
1365
|
async function migrateSqliteToLance(opts) {
|
|
1366
1366
|
const cwd = opts.cwd;
|
|
1367
|
-
const finalPath =
|
|
1367
|
+
const finalPath = chunkE7JHD6QJ_cjs.lanceStoragePath(cwd);
|
|
1368
1368
|
const newPath = path.join(cwd, ".theokit", "memory", "lance-new");
|
|
1369
1369
|
const rawLog = opts.logger ?? ((m) => console.log(m));
|
|
1370
1370
|
const log = (m) => rawLog(chunkJTB5Q42C_cjs.redactSecrets(m));
|
|
@@ -1408,7 +1408,7 @@ async function migrateSqliteToLance(opts) {
|
|
|
1408
1408
|
};
|
|
1409
1409
|
fs.mkdirSync(newPath, { recursive: true });
|
|
1410
1410
|
log(`Writing Lance index to ${newPath} ...`);
|
|
1411
|
-
const lance = await
|
|
1411
|
+
const lance = await chunkE7JHD6QJ_cjs.LanceIndex.open({
|
|
1412
1412
|
cwd,
|
|
1413
1413
|
embedding: placeholderEmbedding,
|
|
1414
1414
|
storagePath: newPath
|
|
@@ -1841,7 +1841,7 @@ function isBuiltAgent(m) {
|
|
|
1841
1841
|
return typeof m.send === "function";
|
|
1842
1842
|
}
|
|
1843
1843
|
async function materialize(def, index) {
|
|
1844
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1844
|
+
const { Agent: Agent2 } = await import('./agent-2T2EJIP6.cjs');
|
|
1845
1845
|
return Agent2.create({
|
|
1846
1846
|
// `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
|
|
1847
1847
|
// here means "declare nothing and let the default apply" — forwarding the literal would create
|
|
@@ -1983,7 +1983,7 @@ var FIXTURE_USER = {
|
|
|
1983
1983
|
};
|
|
1984
1984
|
var FIXTURE_MODELS = [
|
|
1985
1985
|
{
|
|
1986
|
-
id:
|
|
1986
|
+
id: chunkM2JWHKO6_cjs.DEFAULT_AGENTIC_MODEL_ID,
|
|
1987
1987
|
name: "Gemini 2.0 Flash",
|
|
1988
1988
|
displayName: "Gemini 2.0 Flash",
|
|
1989
1989
|
parameters: [
|
|
@@ -2059,7 +2059,7 @@ async function listLocalModelsViaOpenAiCompat(baseUrl) {
|
|
|
2059
2059
|
try {
|
|
2060
2060
|
response = await fetch(url, { method: "GET" });
|
|
2061
2061
|
} catch (fetchErr) {
|
|
2062
|
-
const mapped =
|
|
2062
|
+
const mapped = chunk43GFJ5SD_cjs.mapOllamaTransportError({
|
|
2063
2063
|
providerId: "ollama",
|
|
2064
2064
|
cause: fetchErr,
|
|
2065
2065
|
endpoint: "/v1/models"
|
|
@@ -2071,8 +2071,8 @@ async function listLocalModelsViaOpenAiCompat(baseUrl) {
|
|
|
2071
2071
|
);
|
|
2072
2072
|
}
|
|
2073
2073
|
if (!response.ok) {
|
|
2074
|
-
const body = await
|
|
2075
|
-
const mapped =
|
|
2074
|
+
const body = await chunk43GFJ5SD_cjs.readErrorResponseBody(response);
|
|
2075
|
+
const mapped = chunk43GFJ5SD_cjs.mapOllamaHttpError({
|
|
2076
2076
|
providerId: "ollama",
|
|
2077
2077
|
status: response.status,
|
|
2078
2078
|
body,
|
|
@@ -2186,7 +2186,7 @@ var Theokit = class {
|
|
|
2186
2186
|
envVars: p.envVars
|
|
2187
2187
|
}));
|
|
2188
2188
|
},
|
|
2189
|
-
embeddingAdapters: () => Object.entries(
|
|
2189
|
+
embeddingAdapters: () => Object.entries(chunkM2JWHKO6_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
|
|
2190
2190
|
id,
|
|
2191
2191
|
transport: adapter.transport,
|
|
2192
2192
|
defaultModel: adapter.defaultModel
|
|
@@ -2204,7 +2204,7 @@ var Theokit = class {
|
|
|
2204
2204
|
};
|
|
2205
2205
|
async function maybeListLocalModels(providerName) {
|
|
2206
2206
|
chunkNIRE5CNO_cjs.registerBuiltins();
|
|
2207
|
-
await
|
|
2207
|
+
await chunk43GFJ5SD_cjs.discoverProviderPlugins();
|
|
2208
2208
|
const profile = chunkNIRE5CNO_cjs.getProviderProfile(providerName);
|
|
2209
2209
|
if (profile === void 0) return void 0;
|
|
2210
2210
|
if (profile.authType !== "none") return void 0;
|
|
@@ -2222,13 +2222,13 @@ async function executeCatalogRequest(request) {
|
|
|
2222
2222
|
if (apiKey === void 0) {
|
|
2223
2223
|
throw new chunkK3FW2XZD_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
2224
2224
|
}
|
|
2225
|
-
if (
|
|
2225
|
+
if (chunk43GFJ5SD_cjs.shouldUseFixtureMode(apiKey)) {
|
|
2226
2226
|
return request.fixture;
|
|
2227
2227
|
}
|
|
2228
|
-
if (!
|
|
2228
|
+
if (!chunk43GFJ5SD_cjs.isFixtureApiKey(apiKey) && process.env.THEOKIT_API_BASE_URL === void 0) {
|
|
2229
2229
|
throw new chunkK3FW2XZD_cjs.AuthenticationError("Invalid API key", { code: "authentication_error" });
|
|
2230
2230
|
}
|
|
2231
|
-
return
|
|
2231
|
+
return chunk43GFJ5SD_cjs.httpRequest(request.path, { apiKey });
|
|
2232
2232
|
}
|
|
2233
2233
|
|
|
2234
2234
|
// src/tool-blast-radius.ts
|
|
@@ -2405,35 +2405,35 @@ Object.defineProperty(exports, "fn", {
|
|
|
2405
2405
|
});
|
|
2406
2406
|
Object.defineProperty(exports, "Cron", {
|
|
2407
2407
|
enumerable: true,
|
|
2408
|
-
get: function () { return
|
|
2408
|
+
get: function () { return chunkX7O4255I_cjs.Cron; }
|
|
2409
2409
|
});
|
|
2410
2410
|
Object.defineProperty(exports, "Agent", {
|
|
2411
2411
|
enumerable: true,
|
|
2412
|
-
get: function () { return
|
|
2412
|
+
get: function () { return chunkM2JWHKO6_cjs.Agent; }
|
|
2413
2413
|
});
|
|
2414
2414
|
Object.defineProperty(exports, "AgentBuilder", {
|
|
2415
2415
|
enumerable: true,
|
|
2416
|
-
get: function () { return
|
|
2416
|
+
get: function () { return chunkM2JWHKO6_cjs.AgentBuilder; }
|
|
2417
2417
|
});
|
|
2418
2418
|
Object.defineProperty(exports, "Tool", {
|
|
2419
2419
|
enumerable: true,
|
|
2420
|
-
get: function () { return
|
|
2420
|
+
get: function () { return chunkM2JWHKO6_cjs.Tool; }
|
|
2421
2421
|
});
|
|
2422
2422
|
Object.defineProperty(exports, "ToolError", {
|
|
2423
2423
|
enumerable: true,
|
|
2424
|
-
get: function () { return
|
|
2424
|
+
get: function () { return chunkM2JWHKO6_cjs.ToolError; }
|
|
2425
2425
|
});
|
|
2426
2426
|
Object.defineProperty(exports, "UsageAccumulator", {
|
|
2427
2427
|
enumerable: true,
|
|
2428
|
-
get: function () { return
|
|
2428
|
+
get: function () { return chunkM2JWHKO6_cjs.UsageAccumulator; }
|
|
2429
2429
|
});
|
|
2430
2430
|
Object.defineProperty(exports, "computeCost", {
|
|
2431
2431
|
enumerable: true,
|
|
2432
|
-
get: function () { return
|
|
2432
|
+
get: function () { return chunkM2JWHKO6_cjs.computeCost; }
|
|
2433
2433
|
});
|
|
2434
2434
|
Object.defineProperty(exports, "getPricingEntry", {
|
|
2435
2435
|
enumerable: true,
|
|
2436
|
-
get: function () { return
|
|
2436
|
+
get: function () { return chunkM2JWHKO6_cjs.getPricingEntry; }
|
|
2437
2437
|
});
|
|
2438
2438
|
Object.defineProperty(exports, "emitRunEvent", {
|
|
2439
2439
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -7,11 +7,11 @@ import { Workflow, agentStep } from './chunk-XV4IZNV4.js';
|
|
|
7
7
|
export { Workflow, agentStep, fn } from './chunk-XV4IZNV4.js';
|
|
8
8
|
import './chunk-AQLGBKNT.js';
|
|
9
9
|
import './chunk-HY66GLM6.js';
|
|
10
|
-
export { Cron } from './chunk-
|
|
11
|
-
import { MEMORY_EMBEDDING_ADAPTERS, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-
|
|
12
|
-
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-
|
|
13
|
-
import './chunk-
|
|
14
|
-
import { lanceStoragePath, LanceIndex, readFactsFromMarkdown, defaultIndexPath, openMemoryDb, memoryDir } from './chunk-
|
|
10
|
+
export { Cron } from './chunk-LEM2GOMI.js';
|
|
11
|
+
import { MEMORY_EMBEDDING_ADAPTERS, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-7TCRNXNK.js';
|
|
12
|
+
export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry } from './chunk-7TCRNXNK.js';
|
|
13
|
+
import './chunk-WG7R5W6R.js';
|
|
14
|
+
import { lanceStoragePath, LanceIndex, readFactsFromMarkdown, defaultIndexPath, openMemoryDb, memoryDir } from './chunk-G6EEYRDD.js';
|
|
15
15
|
import './chunk-YMA4S2WO.js';
|
|
16
16
|
import './chunk-2SFBB54R.js';
|
|
17
17
|
import { configure, submit, list, get, cancel, subscribe } from './chunk-SUKXXLWD.js';
|
|
@@ -19,12 +19,12 @@ export { emitRunEvent } from './chunk-SUKXXLWD.js';
|
|
|
19
19
|
import './chunk-K2BQQ445.js';
|
|
20
20
|
import './chunk-XN7NOENA.js';
|
|
21
21
|
import './chunk-H73MEMQB.js';
|
|
22
|
-
import './chunk-
|
|
23
|
-
import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpRequest, mapOllamaTransportError, readErrorResponseBody, mapOllamaHttpError } from './chunk-
|
|
22
|
+
import './chunk-YJDH3CKG.js';
|
|
23
|
+
import { discoverProviderPlugins, shouldUseFixtureMode, isFixtureApiKey, httpRequest, mapOllamaTransportError, readErrorResponseBody, mapOllamaHttpError } from './chunk-IACR5LEM.js';
|
|
24
24
|
import './chunk-3E77SX4H.js';
|
|
25
25
|
import './chunk-WTMU7J4U.js';
|
|
26
26
|
import './chunk-5JLFFPCH.js';
|
|
27
|
-
import './chunk-
|
|
27
|
+
import './chunk-G24KZRSA.js';
|
|
28
28
|
import './chunk-HKCKOAIO.js';
|
|
29
29
|
import './chunk-7FHZ4VQX.js';
|
|
30
30
|
import './chunk-KVNWIAO4.js';
|
|
@@ -43,7 +43,7 @@ import './chunk-RIAM53CP.js';
|
|
|
43
43
|
import './chunk-UC3HT2S4.js';
|
|
44
44
|
import './chunk-OC4NTGMN.js';
|
|
45
45
|
import './chunk-44JAAH4X.js';
|
|
46
|
-
import './chunk-
|
|
46
|
+
import './chunk-FKMUFNQE.js';
|
|
47
47
|
import './chunk-CQ2TQ32Y.js';
|
|
48
48
|
import './chunk-CV7XMBHP.js';
|
|
49
49
|
import { withCwdMutex } from './chunk-Q5EWJPRY.js';
|
|
@@ -1269,7 +1269,7 @@ var Memory = {
|
|
|
1269
1269
|
openArgs.embedding = await resolveEmbedding(opts.embedding, peer.MEMORY_EMBEDDING_ADAPTERS);
|
|
1270
1270
|
return await peer.IndexManager.open(openArgs);
|
|
1271
1271
|
}
|
|
1272
|
-
const { IndexManager } = await import('./index-manager-
|
|
1272
|
+
const { IndexManager } = await import('./index-manager-QDPIYIGV.js');
|
|
1273
1273
|
openArgs.embedding = await resolveEmbedding(opts.embedding, MEMORY_EMBEDDING_ADAPTERS);
|
|
1274
1274
|
return await IndexManager.open(openArgs);
|
|
1275
1275
|
},
|
|
@@ -1845,7 +1845,7 @@ function isBuiltAgent(m) {
|
|
|
1845
1845
|
return typeof m.send === "function";
|
|
1846
1846
|
}
|
|
1847
1847
|
async function materialize(def, index) {
|
|
1848
|
-
const { Agent: Agent2 } = await import('./agent-
|
|
1848
|
+
const { Agent: Agent2 } = await import('./agent-ZIYCVEZL.js');
|
|
1849
1849
|
return Agent2.create({
|
|
1850
1850
|
// `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
|
|
1851
1851
|
// here means "declare nothing and let the default apply" — forwarding the literal would create
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkKKK3FZ4A_cjs = require('./chunk-KKK3FZ4A.cjs');
|
|
4
4
|
var chunk4OTIXDMU_cjs = require('./chunk-4OTIXDMU.cjs');
|
|
5
|
-
require('./chunk-
|
|
6
|
-
var
|
|
5
|
+
require('./chunk-Z4BCLVTI.cjs');
|
|
6
|
+
var chunkBUIK7GUA_cjs = require('./chunk-BUIK7GUA.cjs');
|
|
7
7
|
require('./chunk-I6TGFUCO.cjs');
|
|
8
8
|
require('./chunk-JTB5Q42C.cjs');
|
|
9
9
|
require('./chunk-NUKRL3I6.cjs');
|
|
10
10
|
|
|
11
11
|
// src/internal/session/inject-session.ts
|
|
12
12
|
async function injectSessionTurn(opts) {
|
|
13
|
-
await
|
|
13
|
+
await chunkKKK3FZ4A_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
14
14
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
15
|
-
const transcript =
|
|
15
|
+
const transcript = chunkBUIK7GUA_cjs.SessionTranscript.fromRecords(prior, {
|
|
16
16
|
cwd: opts.loc.cwd,
|
|
17
17
|
sessionId: opts.sessionId,
|
|
18
18
|
model: opts.loc.model ?? "unknown"
|
|
@@ -25,5 +25,5 @@ async function injectSessionTurn(opts) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
exports.injectSessionTurn = injectSessionTurn;
|
|
28
|
-
//# sourceMappingURL=inject-session-
|
|
29
|
-
//# sourceMappingURL=inject-session-
|
|
28
|
+
//# sourceMappingURL=inject-session-MLCJMYDG.cjs.map
|
|
29
|
+
//# sourceMappingURL=inject-session-MLCJMYDG.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-
|
|
1
|
+
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-MLCJMYDG.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { enqueueSessionWrite } from './chunk-
|
|
1
|
+
import { enqueueSessionWrite } from './chunk-WG7R5W6R.js';
|
|
2
2
|
import { invalidateSessionCache } from './chunk-WTMU7J4U.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import { SessionTranscript } from './chunk-
|
|
3
|
+
import './chunk-G24KZRSA.js';
|
|
4
|
+
import { SessionTranscript } from './chunk-FKMUFNQE.js';
|
|
5
5
|
import './chunk-VF7EWVDG.js';
|
|
6
6
|
import './chunk-T7XEKOVW.js';
|
|
7
7
|
import './chunk-T7O6K6PX.js';
|
|
@@ -23,5 +23,5 @@ async function injectSessionTurn(opts) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export { injectSessionTurn };
|
|
26
|
-
//# sourceMappingURL=inject-session-
|
|
27
|
-
//# sourceMappingURL=inject-session-
|
|
26
|
+
//# sourceMappingURL=inject-session-RBQZ45UM.js.map
|
|
27
|
+
//# sourceMappingURL=inject-session-RBQZ45UM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-
|
|
1
|
+
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-RBQZ45UM.js","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
|
|
@@ -81,8 +81,47 @@ export declare function defaultBaseDir(): string;
|
|
|
81
81
|
* paths without a leading tilde pass through untouched.
|
|
82
82
|
*/
|
|
83
83
|
export declare function expandTilde(p: string): string;
|
|
84
|
-
/**
|
|
84
|
+
/** Is this id already a canonical UUID, and therefore usable as a filename verbatim? */
|
|
85
|
+
export declare function isSessionUuid(id: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The transcript filename for an agent id — always a UUID.
|
|
88
|
+
*
|
|
89
|
+
* #400: the Claude Code CLI resumes a transcript ONLY when its basename is a UUID. Measured against
|
|
90
|
+
* CLI 2.1.236: `<uuid>.jsonl` resumes; `agent-<uuid>.jsonl` and `billing-bot.jsonl` are both ignored,
|
|
91
|
+
* with no error — the session simply is not offered. So a session written under a human-readable
|
|
92
|
+
* agent id was invisible to `claude --continue`, which is the interoperability this project claims
|
|
93
|
+
* as its difference from a proprietary session store.
|
|
94
|
+
*
|
|
95
|
+
* An id that is ALREADY a UUID passes through verbatim, so a transcript Claude Code wrote keeps its
|
|
96
|
+
* own name and the two directions stay symmetric. Anything else is derived with a UUIDv8, which is
|
|
97
|
+
* deterministic: the same agent id always yields the same filename, so nothing has to be persisted
|
|
98
|
+
* to map one back to the other.
|
|
99
|
+
*
|
|
100
|
+
* A DERIVED name is version 8 — RFC 9562's slot for a UUID whose bits come from an
|
|
101
|
+
* implementation-defined scheme, which is exactly what this is. The obvious alternative was v5, but
|
|
102
|
+
* RFC 4122 fixes v5's hash to SHA-1, and reaching for SHA-1 in 2026 means either shipping a weak
|
|
103
|
+
* primitive or arguing with every scanner that flags it, forever. v8 lets the hash be SHA-256 and
|
|
104
|
+
* lets the version nibble say honestly that this is our scheme rather than a standard one.
|
|
105
|
+
*
|
|
106
|
+
* There is no security claim here either way — no secret, no signature, and nothing an attacker
|
|
107
|
+
* gains by colliding two agent ids inside one consumer's own directory. The hash is a naming
|
|
108
|
+
* function. The point of preferring SHA-256 is not that SHA-1 was exploitable here; it is that a
|
|
109
|
+
* weak primitive in the tree costs a permanent argument with every scanner that sees it.
|
|
110
|
+
*
|
|
111
|
+
* The version nibble was measured, not assumed: CLI 2.1.236 resumes a v8-named transcript exactly as
|
|
112
|
+
* it does a v4 one.
|
|
113
|
+
*/
|
|
114
|
+
export declare function sessionUuidFor(id: string): string;
|
|
115
|
+
/** The `.jsonl` path for a session: `<baseDir>/projects/<encoded-cwd>/<session-uuid>.jsonl`. */
|
|
85
116
|
export declare function transcriptPath(baseDir: string, cwd: string, sessionId: string): string;
|
|
117
|
+
/**
|
|
118
|
+
* The path this session used BEFORE #400 made transcript filenames UUIDs.
|
|
119
|
+
*
|
|
120
|
+
* Kept so an existing transcript is never orphaned: {@link FsSessionStore} prefers this file when it
|
|
121
|
+
* exists, so history written under the old scheme keeps accumulating in the same file instead of
|
|
122
|
+
* being silently abandoned for a fresh one under the new name.
|
|
123
|
+
*/
|
|
124
|
+
export declare function legacyTranscriptPath(baseDir: string, cwd: string, sessionId: string): string;
|
|
86
125
|
/** Write records as one JSONL line each (atomic; parent dir created). Returns the path. */
|
|
87
126
|
export declare function writeTranscript(path: string, records: readonly SessionRecord[]): Promise<string>;
|
|
88
127
|
/** Parse a transcript `.jsonl` into records; a missing file yields `[]`; malformed lines are skipped. */
|
|
@@ -81,8 +81,47 @@ export declare function defaultBaseDir(): string;
|
|
|
81
81
|
* paths without a leading tilde pass through untouched.
|
|
82
82
|
*/
|
|
83
83
|
export declare function expandTilde(p: string): string;
|
|
84
|
-
/**
|
|
84
|
+
/** Is this id already a canonical UUID, and therefore usable as a filename verbatim? */
|
|
85
|
+
export declare function isSessionUuid(id: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The transcript filename for an agent id — always a UUID.
|
|
88
|
+
*
|
|
89
|
+
* #400: the Claude Code CLI resumes a transcript ONLY when its basename is a UUID. Measured against
|
|
90
|
+
* CLI 2.1.236: `<uuid>.jsonl` resumes; `agent-<uuid>.jsonl` and `billing-bot.jsonl` are both ignored,
|
|
91
|
+
* with no error — the session simply is not offered. So a session written under a human-readable
|
|
92
|
+
* agent id was invisible to `claude --continue`, which is the interoperability this project claims
|
|
93
|
+
* as its difference from a proprietary session store.
|
|
94
|
+
*
|
|
95
|
+
* An id that is ALREADY a UUID passes through verbatim, so a transcript Claude Code wrote keeps its
|
|
96
|
+
* own name and the two directions stay symmetric. Anything else is derived with a UUIDv8, which is
|
|
97
|
+
* deterministic: the same agent id always yields the same filename, so nothing has to be persisted
|
|
98
|
+
* to map one back to the other.
|
|
99
|
+
*
|
|
100
|
+
* A DERIVED name is version 8 — RFC 9562's slot for a UUID whose bits come from an
|
|
101
|
+
* implementation-defined scheme, which is exactly what this is. The obvious alternative was v5, but
|
|
102
|
+
* RFC 4122 fixes v5's hash to SHA-1, and reaching for SHA-1 in 2026 means either shipping a weak
|
|
103
|
+
* primitive or arguing with every scanner that flags it, forever. v8 lets the hash be SHA-256 and
|
|
104
|
+
* lets the version nibble say honestly that this is our scheme rather than a standard one.
|
|
105
|
+
*
|
|
106
|
+
* There is no security claim here either way — no secret, no signature, and nothing an attacker
|
|
107
|
+
* gains by colliding two agent ids inside one consumer's own directory. The hash is a naming
|
|
108
|
+
* function. The point of preferring SHA-256 is not that SHA-1 was exploitable here; it is that a
|
|
109
|
+
* weak primitive in the tree costs a permanent argument with every scanner that sees it.
|
|
110
|
+
*
|
|
111
|
+
* The version nibble was measured, not assumed: CLI 2.1.236 resumes a v8-named transcript exactly as
|
|
112
|
+
* it does a v4 one.
|
|
113
|
+
*/
|
|
114
|
+
export declare function sessionUuidFor(id: string): string;
|
|
115
|
+
/** The `.jsonl` path for a session: `<baseDir>/projects/<encoded-cwd>/<session-uuid>.jsonl`. */
|
|
85
116
|
export declare function transcriptPath(baseDir: string, cwd: string, sessionId: string): string;
|
|
117
|
+
/**
|
|
118
|
+
* The path this session used BEFORE #400 made transcript filenames UUIDs.
|
|
119
|
+
*
|
|
120
|
+
* Kept so an existing transcript is never orphaned: {@link FsSessionStore} prefers this file when it
|
|
121
|
+
* exists, so history written under the old scheme keeps accumulating in the same file instead of
|
|
122
|
+
* being silently abandoned for a fresh one under the new name.
|
|
123
|
+
*/
|
|
124
|
+
export declare function legacyTranscriptPath(baseDir: string, cwd: string, sessionId: string): string;
|
|
86
125
|
/** Write records as one JSONL line each (atomic; parent dir created). Returns the path. */
|
|
87
126
|
export declare function writeTranscript(path: string, records: readonly SessionRecord[]): Promise<string>;
|
|
88
127
|
/** Parse a transcript `.jsonl` into records; a missing file yields `[]`; malformed lines are skipped. */
|
package/dist/persistence.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkVTYY7XL5_cjs = require('./chunk-VTYY7XL5.cjs');
|
|
4
4
|
var chunk4I55V454_cjs = require('./chunk-4I55V454.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkBUIK7GUA_cjs = require('./chunk-BUIK7GUA.cjs');
|
|
6
6
|
var chunkSKXBJ2NU_cjs = require('./chunk-SKXBJ2NU.cjs');
|
|
7
7
|
var chunk2ADR2GSO_cjs = require('./chunk-2ADR2GSO.cjs');
|
|
8
8
|
var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
|
|
@@ -114,15 +114,15 @@ Object.defineProperty(exports, "sessionHasWriter", {
|
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "encodeProjectDir", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunkBUIK7GUA_cjs.encodeProjectDir; }
|
|
118
118
|
});
|
|
119
119
|
Object.defineProperty(exports, "transcriptPath", {
|
|
120
120
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunkBUIK7GUA_cjs.transcriptPath; }
|
|
122
122
|
});
|
|
123
123
|
Object.defineProperty(exports, "transcriptRoot", {
|
|
124
124
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunkBUIK7GUA_cjs.transcriptRoot; }
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "applyWalWithFallback", {
|
|
128
128
|
enumerable: true,
|
package/dist/persistence.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { PersistenceSchema } from './chunk-HY66GLM6.js';
|
|
2
2
|
export { SessionBusyError, acquireSessionWriter, sessionHasWriter } from './chunk-44JAAH4X.js';
|
|
3
|
-
export { encodeProjectDir, transcriptPath, transcriptRoot } from './chunk-
|
|
3
|
+
export { encodeProjectDir, transcriptPath, transcriptRoot } from './chunk-FKMUFNQE.js';
|
|
4
4
|
export { applyWalWithFallback, isCorruptionError, openSqliteResilient, sanitizeFts5Query } from './chunk-CQ2TQ32Y.js';
|
|
5
5
|
export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds, withFileLock } from './chunk-CV7XMBHP.js';
|
|
6
6
|
export { withCwdMutex } from './chunk-Q5EWJPRY.js';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkBUIK7GUA_cjs = require('./chunk-BUIK7GUA.cjs');
|
|
4
|
+
require('./chunk-I6TGFUCO.cjs');
|
|
5
|
+
require('./chunk-JTB5Q42C.cjs');
|
|
6
|
+
require('./chunk-NUKRL3I6.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "SessionTranscript", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunkBUIK7GUA_cjs.SessionTranscript; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "defaultBaseDir", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkBUIK7GUA_cjs.defaultBaseDir; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "encodeProjectDir", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunkBUIK7GUA_cjs.encodeProjectDir; }
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "expandTilde", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return chunkBUIK7GUA_cjs.expandTilde; }
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "isSessionUuid", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return chunkBUIK7GUA_cjs.isSessionUuid; }
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "legacyTranscriptPath", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return chunkBUIK7GUA_cjs.legacyTranscriptPath; }
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "readTranscript", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () { return chunkBUIK7GUA_cjs.readTranscript; }
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "reconstructMessages", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () { return chunkBUIK7GUA_cjs.reconstructMessages; }
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "safeSessionId", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () { return chunkBUIK7GUA_cjs.safeSessionId; }
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "sessionUuidFor", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () { return chunkBUIK7GUA_cjs.sessionUuidFor; }
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "transcriptPath", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () { return chunkBUIK7GUA_cjs.transcriptPath; }
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "transcriptRoot", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () { return chunkBUIK7GUA_cjs.transcriptRoot; }
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "writeTranscript", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () { return chunkBUIK7GUA_cjs.writeTranscript; }
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=session-transcript-HF5GEU5M.cjs.map
|
|
63
|
+
//# sourceMappingURL=session-transcript-HF5GEU5M.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"session-transcript-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"session-transcript-HF5GEU5M.cjs"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { SessionTranscript, defaultBaseDir, encodeProjectDir, expandTilde, isSessionUuid, legacyTranscriptPath, readTranscript, reconstructMessages, safeSessionId, sessionUuidFor, transcriptPath, transcriptRoot, writeTranscript } from './chunk-FKMUFNQE.js';
|
|
2
|
+
import './chunk-VF7EWVDG.js';
|
|
3
|
+
import './chunk-T7XEKOVW.js';
|
|
4
|
+
import './chunk-T7O6K6PX.js';
|
|
5
|
+
//# sourceMappingURL=session-transcript-P462ZRHX.js.map
|
|
6
|
+
//# sourceMappingURL=session-transcript-P462ZRHX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"session-transcript-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"session-transcript-P462ZRHX.js"}
|
package/docs/error-codes.md
CHANGED
|
@@ -15,7 +15,7 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
|
|
|
15
15
|
| `agent_disposed` | domain | — | `packages/sdk/src/errors.ts:668` |
|
|
16
16
|
| `agent_id_already_exists` | domain | ConfigurationError | `packages/sdk/src/agent-helpers.ts:54` |
|
|
17
17
|
| `agent_not_registered` | domain | UnknownAgentError | `packages/sdk/src/internal/cron/run-job.ts:61` |
|
|
18
|
-
| `agent_rehydration_failed` | domain | UnknownAgentError | `packages/sdk/src/agent-helpers.ts:
|
|
18
|
+
| `agent_rehydration_failed` | domain | UnknownAgentError | `packages/sdk/src/agent-helpers.ts:332` |
|
|
19
19
|
| `anthropic_auth_failed` | domain | AuthenticationError | `packages/sdk/src/internal/error-mappers/anthropic.ts:56` |
|
|
20
20
|
| `anthropic_rate_limit` | domain | RateLimitError | `packages/sdk/src/internal/error-mappers/anthropic.ts:59` |
|
|
21
21
|
| `anthropic_server_error` | domain | NetworkError | `packages/sdk/src/internal/error-mappers/anthropic.ts:71` |
|
|
@@ -102,7 +102,7 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
|
|
|
102
102
|
| `live_session_protected` | domain | — | `packages/sdk/src/internal/persistence/transcript-ops.ts:39` +1 |
|
|
103
103
|
| `local_provider_http_error` | domain | ConfigurationError | `packages/sdk/src/internal/catalog/local-models.ts:61` |
|
|
104
104
|
| `local_provider_unreachable` | domain | ConfigurationError | `packages/sdk/src/internal/catalog/local-models.ts:46` |
|
|
105
|
-
| `malformed_api_key` | domain | AuthenticationError | `packages/sdk/src/agent-helpers.ts:
|
|
105
|
+
| `malformed_api_key` | domain | AuthenticationError | `packages/sdk/src/agent-helpers.ts:226` +1 |
|
|
106
106
|
| `max_delegation_depth` | domain | MaxDelegationDepthError | `packages/sdk/src/a2a/subagent.ts:218` |
|
|
107
107
|
| `mcp_buffer_overflow` | domain | NetworkError | `packages/sdk/src/internal/mcp/client.ts:314` |
|
|
108
108
|
| `mcp_closed` | domain | NetworkError | `packages/sdk/src/internal/mcp/client.ts:289` |
|
|
@@ -116,7 +116,7 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
|
|
|
116
116
|
| `memory_path_traversal` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/validation/validate-agent-options.ts:280` |
|
|
117
117
|
| `memory_tool_bad_args` | domain | ConfigurationError | `packages/sdk/src/internal/memory/tools.ts:132` +1 |
|
|
118
118
|
| `migration_destination_exists` | domain | ConfigurationError | `packages/sdk/src/internal/memory/migrate-sqlite-to-lance.ts:114` +1 |
|
|
119
|
-
| `missing_api_key` | domain | AuthenticationError, ConfigurationError | `packages/sdk/src/agent-helpers.ts:
|
|
119
|
+
| `missing_api_key` | domain | AuthenticationError, ConfigurationError | `packages/sdk/src/agent-helpers.ts:217` +2 |
|
|
120
120
|
| `missing_frontmatter` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/skill-frontmatter.ts:66` |
|
|
121
121
|
| `missing_model` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/validation/validate-agent-options.ts:35` |
|
|
122
122
|
| `model_unavailable` | transport | buildErrorMetadata | `packages/sdk/src/internal/error-mappers/ollama.ts:75` +1 |
|
|
@@ -203,7 +203,7 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
|
|
|
203
203
|
| `transport_failure` | domain | NetworkError | `packages/sdk/src/internal/llm/transport-error.ts:48` |
|
|
204
204
|
| `transport_unavailable` | domain | ConfigurationError | `packages/sdk/src/internal/llm/router.ts:484` +1 |
|
|
205
205
|
| `unknown` | transport | AgentRunError, MemoryAdapterError, TheokitAgentError | `packages/memory-honcho/src/adapter.ts:264` +5 |
|
|
206
|
-
| `unknown_agent` | domain | UnknownAgentError | `packages/sdk/src/agent-helpers.ts:
|
|
206
|
+
| `unknown_agent` | domain | UnknownAgentError | `packages/sdk/src/agent-helpers.ts:411` +1 |
|
|
207
207
|
| `unknown_artifact` | domain | UnknownAgentError | `packages/sdk/src/internal/cloud-agent/cloud-agent.ts:279` |
|
|
208
208
|
| `unknown_category` | domain | ConfigurationError | `packages/sdk-memory/src/internal/categorized-memory.ts:76` |
|
|
209
209
|
| `unknown_cron_job` | domain | UnknownAgentError | `packages/sdk/src/cron.ts:84` +2 |
|