@theokit/sdk 4.19.0 → 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-BoMsrUs1.d.ts → cron-Bhdyjl0B.d.ts} +1 -1
- package/dist/{cron-DWc1r8m8.d.cts → cron-M2Xz7lq2.d.cts} +1 -1
- package/dist/cron.cjs +43 -19
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +43 -19
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +43 -19
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +43 -19
- package/dist/eval.js.map +1 -1
- package/dist/goal-loop.d.ts +35 -0
- package/dist/index.cjs +163 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -103
- package/dist/index.d.ts +109 -103
- package/dist/index.js +164 -141
- 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 -0
- 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 +144 -469
- package/package.json +1 -1
package/dist/cron.d.cts
CHANGED
package/dist/cron.d.ts
CHANGED
package/dist/cron.js
CHANGED
|
@@ -5998,12 +5998,14 @@ __export(compact_session_exports, {
|
|
|
5998
5998
|
shouldAutoCompact: () => shouldAutoCompact
|
|
5999
5999
|
});
|
|
6000
6000
|
function isCompactSummary(content) {
|
|
6001
|
-
return content.startsWith(COMPACT_SUMMARY_MARKER);
|
|
6001
|
+
return content.startsWith(COMPACT_SUMMARY_MARKER) || content.startsWith("[[theokit:goal-continuation]]");
|
|
6002
6002
|
}
|
|
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,6 +6248,14 @@ 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, {
|
|
@@ -6387,6 +6399,7 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
6387
6399
|
}
|
|
6388
6400
|
function composeContinuation(goal, lastResponse) {
|
|
6389
6401
|
return [
|
|
6402
|
+
GOAL_CONTINUATION_MARKER,
|
|
6390
6403
|
"Continue working toward the active goal.",
|
|
6391
6404
|
"",
|
|
6392
6405
|
`<objective>
|
|
@@ -6407,11 +6420,12 @@ ${goal}
|
|
|
6407
6420
|
" current state, requirement by requirement. Treat uncertain or indirect evidence as not achieved.",
|
|
6408
6421
|
"",
|
|
6409
6422
|
`Your last response was:
|
|
6410
|
-
${lastResponse.slice(
|
|
6423
|
+
${lastResponse.slice(-1e3)}`
|
|
6411
6424
|
].join("\n");
|
|
6412
6425
|
}
|
|
6413
6426
|
var init_run_until = __esm({
|
|
6414
6427
|
"src/internal/runtime/lifecycle/run-until.ts"() {
|
|
6428
|
+
init_goal_loop();
|
|
6415
6429
|
}
|
|
6416
6430
|
});
|
|
6417
6431
|
|
|
@@ -17151,7 +17165,9 @@ async function loadDriver(filePath) {
|
|
|
17151
17165
|
}
|
|
17152
17166
|
try {
|
|
17153
17167
|
const mod = await (driverLoaderOverrides?.nodeSqlite?.() ?? Promise.resolve(
|
|
17154
|
-
process.getBuiltinModule?.(
|
|
17168
|
+
process.getBuiltinModule?.(
|
|
17169
|
+
"node:sqlite"
|
|
17170
|
+
) ?? (() => {
|
|
17155
17171
|
throw new Error("node:sqlite built-in unavailable (Node < 22.3)");
|
|
17156
17172
|
})()
|
|
17157
17173
|
));
|
|
@@ -19685,8 +19701,8 @@ async function getRegisteredAgentOrThrow(agentId) {
|
|
|
19685
19701
|
// src/agent.ts
|
|
19686
19702
|
init_errors();
|
|
19687
19703
|
init_discovery();
|
|
19688
|
-
init_agent_session();
|
|
19689
19704
|
init_agent_factory_registry();
|
|
19705
|
+
init_agent_session();
|
|
19690
19706
|
var streamObjectImport;
|
|
19691
19707
|
var Agent = class _Agent {
|
|
19692
19708
|
constructor() {
|
|
@@ -19978,7 +19994,9 @@ var Agent = class _Agent {
|
|
|
19978
19994
|
reg = getRegisteredAgent(agentId);
|
|
19979
19995
|
}
|
|
19980
19996
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
19981
|
-
throw new UnknownAgentError(
|
|
19997
|
+
throw new UnknownAgentError(
|
|
19998
|
+
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
19999
|
+
);
|
|
19982
20000
|
}
|
|
19983
20001
|
const cwd = reg.cwd ?? process.cwd();
|
|
19984
20002
|
const optModel = reg.options.model;
|
|
@@ -19988,16 +20006,20 @@ var Agent = class _Agent {
|
|
|
19988
20006
|
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
|
|
19989
20007
|
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
19990
20008
|
const store = new FsSessionStore2({ baseDir, cwd });
|
|
19991
|
-
return enqueueSessionWrite(
|
|
19992
|
-
|
|
19993
|
-
|
|
19994
|
-
|
|
19995
|
-
|
|
19996
|
-
|
|
19997
|
-
|
|
19998
|
-
|
|
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
|
+
})
|
|
19999
20021
|
})
|
|
20000
|
-
|
|
20022
|
+
);
|
|
20001
20023
|
}
|
|
20002
20024
|
/**
|
|
20003
20025
|
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
@@ -20014,7 +20036,9 @@ var Agent = class _Agent {
|
|
|
20014
20036
|
reg = getRegisteredAgent(agentId);
|
|
20015
20037
|
}
|
|
20016
20038
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
20017
|
-
throw new UnknownAgentError(
|
|
20039
|
+
throw new UnknownAgentError(
|
|
20040
|
+
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
20041
|
+
);
|
|
20018
20042
|
}
|
|
20019
20043
|
const cwd = reg.cwd ?? process.cwd();
|
|
20020
20044
|
const optModel = reg.options.model;
|