@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.cjs
CHANGED
|
@@ -6006,7 +6006,9 @@ function isCompactSummary(content) {
|
|
|
6006
6006
|
function plainText(content) {
|
|
6007
6007
|
if (typeof content === "string") return content;
|
|
6008
6008
|
if (!Array.isArray(content)) return void 0;
|
|
6009
|
-
const texts = content.filter(
|
|
6009
|
+
const texts = content.filter(
|
|
6010
|
+
(p) => p !== null && typeof p === "object" && p.type === "text" && typeof p.text === "string"
|
|
6011
|
+
).map((p) => p.text);
|
|
6010
6012
|
return texts.length > 0 ? texts.join("\n") : void 0;
|
|
6011
6013
|
}
|
|
6012
6014
|
async function compactSessionTranscript(opts) {
|
|
@@ -6127,8 +6129,10 @@ async function autoCompactIfNeeded(opts) {
|
|
|
6127
6129
|
return true;
|
|
6128
6130
|
} catch (cause) {
|
|
6129
6131
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
6130
|
-
process.stderr.write(
|
|
6131
|
-
`)
|
|
6132
|
+
process.stderr.write(
|
|
6133
|
+
`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
|
|
6134
|
+
`
|
|
6135
|
+
);
|
|
6132
6136
|
return false;
|
|
6133
6137
|
}
|
|
6134
6138
|
}
|
|
@@ -6138,11 +6142,11 @@ var init_compact_session = __esm({
|
|
|
6138
6142
|
init_compaction();
|
|
6139
6143
|
init_router();
|
|
6140
6144
|
init_real_local_run_provider();
|
|
6145
|
+
init_session_transcript();
|
|
6141
6146
|
init_providers();
|
|
6142
6147
|
init_compression_model_registry();
|
|
6143
6148
|
init_compression_summarizer();
|
|
6144
6149
|
init_agent_session();
|
|
6145
|
-
init_session_transcript();
|
|
6146
6150
|
COMPACT_SUMMARY_MARKER = "[[theokit:compact-summary]]";
|
|
6147
6151
|
COMPACT_USER_MESSAGE_MAX_TOKENS = 2e4;
|
|
6148
6152
|
autoCompactAttempts = (() => {
|
|
@@ -6247,10 +6251,17 @@ var init_context = __esm({
|
|
|
6247
6251
|
}
|
|
6248
6252
|
});
|
|
6249
6253
|
|
|
6254
|
+
// src/goal-loop.ts
|
|
6255
|
+
var GOAL_CONTINUATION_MARKER;
|
|
6256
|
+
var init_goal_loop = __esm({
|
|
6257
|
+
"src/goal-loop.ts"() {
|
|
6258
|
+
GOAL_CONTINUATION_MARKER = "[[theokit:goal-continuation]]";
|
|
6259
|
+
}
|
|
6260
|
+
});
|
|
6261
|
+
|
|
6250
6262
|
// src/internal/runtime/lifecycle/run-until.ts
|
|
6251
6263
|
var run_until_exports = {};
|
|
6252
6264
|
__export(run_until_exports, {
|
|
6253
|
-
GOAL_CONTINUATION_MARKER: () => GOAL_CONTINUATION_MARKER,
|
|
6254
6265
|
composeContinuation: () => composeContinuation,
|
|
6255
6266
|
runUntilImpl: () => runUntilImpl
|
|
6256
6267
|
});
|
|
@@ -6415,10 +6426,9 @@ ${goal}
|
|
|
6415
6426
|
${lastResponse.slice(-1e3)}`
|
|
6416
6427
|
].join("\n");
|
|
6417
6428
|
}
|
|
6418
|
-
var GOAL_CONTINUATION_MARKER;
|
|
6419
6429
|
var init_run_until = __esm({
|
|
6420
6430
|
"src/internal/runtime/lifecycle/run-until.ts"() {
|
|
6421
|
-
|
|
6431
|
+
init_goal_loop();
|
|
6422
6432
|
}
|
|
6423
6433
|
});
|
|
6424
6434
|
|
|
@@ -17158,7 +17168,9 @@ async function loadDriver(filePath) {
|
|
|
17158
17168
|
}
|
|
17159
17169
|
try {
|
|
17160
17170
|
const mod = await (driverLoaderOverrides?.nodeSqlite?.() ?? Promise.resolve(
|
|
17161
|
-
process.getBuiltinModule?.(
|
|
17171
|
+
process.getBuiltinModule?.(
|
|
17172
|
+
"node:sqlite"
|
|
17173
|
+
) ?? (() => {
|
|
17162
17174
|
throw new Error("node:sqlite built-in unavailable (Node < 22.3)");
|
|
17163
17175
|
})()
|
|
17164
17176
|
));
|
|
@@ -19692,8 +19704,8 @@ async function getRegisteredAgentOrThrow(agentId) {
|
|
|
19692
19704
|
// src/agent.ts
|
|
19693
19705
|
init_errors();
|
|
19694
19706
|
init_discovery();
|
|
19695
|
-
init_agent_session();
|
|
19696
19707
|
init_agent_factory_registry();
|
|
19708
|
+
init_agent_session();
|
|
19697
19709
|
var streamObjectImport;
|
|
19698
19710
|
var Agent = class _Agent {
|
|
19699
19711
|
constructor() {
|
|
@@ -19985,7 +19997,9 @@ var Agent = class _Agent {
|
|
|
19985
19997
|
reg = getRegisteredAgent(agentId);
|
|
19986
19998
|
}
|
|
19987
19999
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
19988
|
-
throw new UnknownAgentError(
|
|
20000
|
+
throw new UnknownAgentError(
|
|
20001
|
+
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
20002
|
+
);
|
|
19989
20003
|
}
|
|
19990
20004
|
const cwd = reg.cwd ?? process.cwd();
|
|
19991
20005
|
const optModel = reg.options.model;
|
|
@@ -19995,16 +20009,20 @@ var Agent = class _Agent {
|
|
|
19995
20009
|
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
|
|
19996
20010
|
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
19997
20011
|
const store = new FsSessionStore2({ baseDir, cwd });
|
|
19998
|
-
return enqueueSessionWrite(
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
20003
|
-
|
|
20004
|
-
|
|
20005
|
-
|
|
20012
|
+
return enqueueSessionWrite(
|
|
20013
|
+
cwd,
|
|
20014
|
+
agentId,
|
|
20015
|
+
() => compactSessionTranscript2({
|
|
20016
|
+
store,
|
|
20017
|
+
loc: { cwd, agentId, model },
|
|
20018
|
+
sessionId: agentId,
|
|
20019
|
+
trigger: options.trigger ?? "manual",
|
|
20020
|
+
summarize: options.summarize ?? buildDefaultSummarizer2({
|
|
20021
|
+
agentModel: model,
|
|
20022
|
+
...reg.options.apiKey !== void 0 ? { apiKey: reg.options.apiKey } : {}
|
|
20023
|
+
})
|
|
20006
20024
|
})
|
|
20007
|
-
|
|
20025
|
+
);
|
|
20008
20026
|
}
|
|
20009
20027
|
/**
|
|
20010
20028
|
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
@@ -20021,7 +20039,9 @@ var Agent = class _Agent {
|
|
|
20021
20039
|
reg = getRegisteredAgent(agentId);
|
|
20022
20040
|
}
|
|
20023
20041
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
20024
|
-
throw new UnknownAgentError(
|
|
20042
|
+
throw new UnknownAgentError(
|
|
20043
|
+
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
20044
|
+
);
|
|
20025
20045
|
}
|
|
20026
20046
|
const cwd = reg.cwd ?? process.cwd();
|
|
20027
20047
|
const optModel = reg.options.model;
|