@theokit/sdk 4.19.1 → 4.19.2
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/dist/cron-Bhdyjl0B.d.ts +2582 -0
- package/dist/cron-M2Xz7lq2.d.cts +2582 -0
- package/dist/cron.cjs +40 -20
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +3 -0
- package/dist/cron.d.ts +3 -0
- package/dist/cron.js +40 -20
- package/dist/cron.js.map +1 -1
- package/dist/errors-CG2RpeW-.d.ts +516 -0
- package/dist/errors-gE8612p9.d.cts +516 -0
- package/dist/errors.d.cts +3 -0
- package/dist/eval.cjs +40 -20
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +40 -20
- package/dist/eval.js.map +1 -1
- package/dist/goal-loop.d.ts +35 -0
- package/dist/index.cjs +160 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2309 -0
- package/dist/index.d.ts +2309 -0
- package/dist/index.js +160 -142
- package/dist/index.js.map +1 -1
- package/dist/internal/persistence/index.cjs +3 -1
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +3 -1
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/runtime/lifecycle/run-until.d.ts +1 -1
- package/dist/persistence.cjs +3 -1
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +3 -1
- package/dist/persistence.js.map +1 -1
- package/dist/provider-catalog.json +1295 -0
- package/dist/run-DFM1H2jW.d.cts +1589 -0
- package/dist/run-DFM1H2jW.d.ts +1589 -0
- package/package.json +1 -1
package/dist/cron.d.cts
ADDED
package/dist/cron.d.ts
ADDED
package/dist/cron.js
CHANGED
|
@@ -6003,7 +6003,9 @@ function isCompactSummary(content) {
|
|
|
6003
6003
|
function plainText(content) {
|
|
6004
6004
|
if (typeof content === "string") return content;
|
|
6005
6005
|
if (!Array.isArray(content)) return void 0;
|
|
6006
|
-
const texts = content.filter(
|
|
6006
|
+
const texts = content.filter(
|
|
6007
|
+
(p) => p !== null && typeof p === "object" && p.type === "text" && typeof p.text === "string"
|
|
6008
|
+
).map((p) => p.text);
|
|
6007
6009
|
return texts.length > 0 ? texts.join("\n") : void 0;
|
|
6008
6010
|
}
|
|
6009
6011
|
async function compactSessionTranscript(opts) {
|
|
@@ -6124,8 +6126,10 @@ async function autoCompactIfNeeded(opts) {
|
|
|
6124
6126
|
return true;
|
|
6125
6127
|
} catch (cause) {
|
|
6126
6128
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
6127
|
-
process.stderr.write(
|
|
6128
|
-
`)
|
|
6129
|
+
process.stderr.write(
|
|
6130
|
+
`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
|
|
6131
|
+
`
|
|
6132
|
+
);
|
|
6129
6133
|
return false;
|
|
6130
6134
|
}
|
|
6131
6135
|
}
|
|
@@ -6135,11 +6139,11 @@ var init_compact_session = __esm({
|
|
|
6135
6139
|
init_compaction();
|
|
6136
6140
|
init_router();
|
|
6137
6141
|
init_real_local_run_provider();
|
|
6142
|
+
init_session_transcript();
|
|
6138
6143
|
init_providers();
|
|
6139
6144
|
init_compression_model_registry();
|
|
6140
6145
|
init_compression_summarizer();
|
|
6141
6146
|
init_agent_session();
|
|
6142
|
-
init_session_transcript();
|
|
6143
6147
|
COMPACT_SUMMARY_MARKER = "[[theokit:compact-summary]]";
|
|
6144
6148
|
COMPACT_USER_MESSAGE_MAX_TOKENS = 2e4;
|
|
6145
6149
|
autoCompactAttempts = (() => {
|
|
@@ -6244,10 +6248,17 @@ var init_context = __esm({
|
|
|
6244
6248
|
}
|
|
6245
6249
|
});
|
|
6246
6250
|
|
|
6251
|
+
// src/goal-loop.ts
|
|
6252
|
+
var GOAL_CONTINUATION_MARKER;
|
|
6253
|
+
var init_goal_loop = __esm({
|
|
6254
|
+
"src/goal-loop.ts"() {
|
|
6255
|
+
GOAL_CONTINUATION_MARKER = "[[theokit:goal-continuation]]";
|
|
6256
|
+
}
|
|
6257
|
+
});
|
|
6258
|
+
|
|
6247
6259
|
// src/internal/runtime/lifecycle/run-until.ts
|
|
6248
6260
|
var run_until_exports = {};
|
|
6249
6261
|
__export(run_until_exports, {
|
|
6250
|
-
GOAL_CONTINUATION_MARKER: () => GOAL_CONTINUATION_MARKER,
|
|
6251
6262
|
composeContinuation: () => composeContinuation,
|
|
6252
6263
|
runUntilImpl: () => runUntilImpl
|
|
6253
6264
|
});
|
|
@@ -6412,10 +6423,9 @@ ${goal}
|
|
|
6412
6423
|
${lastResponse.slice(-1e3)}`
|
|
6413
6424
|
].join("\n");
|
|
6414
6425
|
}
|
|
6415
|
-
var GOAL_CONTINUATION_MARKER;
|
|
6416
6426
|
var init_run_until = __esm({
|
|
6417
6427
|
"src/internal/runtime/lifecycle/run-until.ts"() {
|
|
6418
|
-
|
|
6428
|
+
init_goal_loop();
|
|
6419
6429
|
}
|
|
6420
6430
|
});
|
|
6421
6431
|
|
|
@@ -17155,7 +17165,9 @@ async function loadDriver(filePath) {
|
|
|
17155
17165
|
}
|
|
17156
17166
|
try {
|
|
17157
17167
|
const mod = await (driverLoaderOverrides?.nodeSqlite?.() ?? Promise.resolve(
|
|
17158
|
-
process.getBuiltinModule?.(
|
|
17168
|
+
process.getBuiltinModule?.(
|
|
17169
|
+
"node:sqlite"
|
|
17170
|
+
) ?? (() => {
|
|
17159
17171
|
throw new Error("node:sqlite built-in unavailable (Node < 22.3)");
|
|
17160
17172
|
})()
|
|
17161
17173
|
));
|
|
@@ -19689,8 +19701,8 @@ async function getRegisteredAgentOrThrow(agentId) {
|
|
|
19689
19701
|
// src/agent.ts
|
|
19690
19702
|
init_errors();
|
|
19691
19703
|
init_discovery();
|
|
19692
|
-
init_agent_session();
|
|
19693
19704
|
init_agent_factory_registry();
|
|
19705
|
+
init_agent_session();
|
|
19694
19706
|
var streamObjectImport;
|
|
19695
19707
|
var Agent = class _Agent {
|
|
19696
19708
|
constructor() {
|
|
@@ -19982,7 +19994,9 @@ var Agent = class _Agent {
|
|
|
19982
19994
|
reg = getRegisteredAgent(agentId);
|
|
19983
19995
|
}
|
|
19984
19996
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
19985
|
-
throw new UnknownAgentError(
|
|
19997
|
+
throw new UnknownAgentError(
|
|
19998
|
+
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
19999
|
+
);
|
|
19986
20000
|
}
|
|
19987
20001
|
const cwd = reg.cwd ?? process.cwd();
|
|
19988
20002
|
const optModel = reg.options.model;
|
|
@@ -19992,16 +20006,20 @@ var Agent = class _Agent {
|
|
|
19992
20006
|
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
|
|
19993
20007
|
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
19994
20008
|
const store = new FsSessionStore2({ baseDir, cwd });
|
|
19995
|
-
return enqueueSessionWrite(
|
|
19996
|
-
|
|
19997
|
-
|
|
19998
|
-
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
20009
|
+
return enqueueSessionWrite(
|
|
20010
|
+
cwd,
|
|
20011
|
+
agentId,
|
|
20012
|
+
() => compactSessionTranscript2({
|
|
20013
|
+
store,
|
|
20014
|
+
loc: { cwd, agentId, model },
|
|
20015
|
+
sessionId: agentId,
|
|
20016
|
+
trigger: options.trigger ?? "manual",
|
|
20017
|
+
summarize: options.summarize ?? buildDefaultSummarizer2({
|
|
20018
|
+
agentModel: model,
|
|
20019
|
+
...reg.options.apiKey !== void 0 ? { apiKey: reg.options.apiKey } : {}
|
|
20020
|
+
})
|
|
20003
20021
|
})
|
|
20004
|
-
|
|
20022
|
+
);
|
|
20005
20023
|
}
|
|
20006
20024
|
/**
|
|
20007
20025
|
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
@@ -20018,7 +20036,9 @@ var Agent = class _Agent {
|
|
|
20018
20036
|
reg = getRegisteredAgent(agentId);
|
|
20019
20037
|
}
|
|
20020
20038
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
20021
|
-
throw new UnknownAgentError(
|
|
20039
|
+
throw new UnknownAgentError(
|
|
20040
|
+
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
20041
|
+
);
|
|
20022
20042
|
}
|
|
20023
20043
|
const cwd = reg.cwd ?? process.cwd();
|
|
20024
20044
|
const optModel = reg.options.model;
|