@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/eval.js
CHANGED
|
@@ -5997,12 +5997,14 @@ __export(compact_session_exports, {
|
|
|
5997
5997
|
shouldAutoCompact: () => shouldAutoCompact
|
|
5998
5998
|
});
|
|
5999
5999
|
function isCompactSummary(content) {
|
|
6000
|
-
return content.startsWith(COMPACT_SUMMARY_MARKER);
|
|
6000
|
+
return content.startsWith(COMPACT_SUMMARY_MARKER) || content.startsWith("[[theokit:goal-continuation]]");
|
|
6001
6001
|
}
|
|
6002
6002
|
function plainText(content) {
|
|
6003
6003
|
if (typeof content === "string") return content;
|
|
6004
6004
|
if (!Array.isArray(content)) return void 0;
|
|
6005
|
-
const texts = content.filter(
|
|
6005
|
+
const texts = content.filter(
|
|
6006
|
+
(p) => p !== null && typeof p === "object" && p.type === "text" && typeof p.text === "string"
|
|
6007
|
+
).map((p) => p.text);
|
|
6006
6008
|
return texts.length > 0 ? texts.join("\n") : void 0;
|
|
6007
6009
|
}
|
|
6008
6010
|
async function compactSessionTranscript(opts) {
|
|
@@ -6123,8 +6125,10 @@ async function autoCompactIfNeeded(opts) {
|
|
|
6123
6125
|
return true;
|
|
6124
6126
|
} catch (cause) {
|
|
6125
6127
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
6126
|
-
process.stderr.write(
|
|
6127
|
-
`)
|
|
6128
|
+
process.stderr.write(
|
|
6129
|
+
`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
|
|
6130
|
+
`
|
|
6131
|
+
);
|
|
6128
6132
|
return false;
|
|
6129
6133
|
}
|
|
6130
6134
|
}
|
|
@@ -6134,11 +6138,11 @@ var init_compact_session = __esm({
|
|
|
6134
6138
|
init_compaction();
|
|
6135
6139
|
init_router();
|
|
6136
6140
|
init_real_local_run_provider();
|
|
6141
|
+
init_session_transcript();
|
|
6137
6142
|
init_providers();
|
|
6138
6143
|
init_compression_model_registry();
|
|
6139
6144
|
init_compression_summarizer();
|
|
6140
6145
|
init_agent_session();
|
|
6141
|
-
init_session_transcript();
|
|
6142
6146
|
COMPACT_SUMMARY_MARKER = "[[theokit:compact-summary]]";
|
|
6143
6147
|
COMPACT_USER_MESSAGE_MAX_TOKENS = 2e4;
|
|
6144
6148
|
autoCompactAttempts = (() => {
|
|
@@ -6243,6 +6247,14 @@ var init_context = __esm({
|
|
|
6243
6247
|
}
|
|
6244
6248
|
});
|
|
6245
6249
|
|
|
6250
|
+
// src/goal-loop.ts
|
|
6251
|
+
var GOAL_CONTINUATION_MARKER;
|
|
6252
|
+
var init_goal_loop = __esm({
|
|
6253
|
+
"src/goal-loop.ts"() {
|
|
6254
|
+
GOAL_CONTINUATION_MARKER = "[[theokit:goal-continuation]]";
|
|
6255
|
+
}
|
|
6256
|
+
});
|
|
6257
|
+
|
|
6246
6258
|
// src/internal/runtime/lifecycle/run-until.ts
|
|
6247
6259
|
var run_until_exports = {};
|
|
6248
6260
|
__export(run_until_exports, {
|
|
@@ -6386,6 +6398,7 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
6386
6398
|
}
|
|
6387
6399
|
function composeContinuation(goal, lastResponse) {
|
|
6388
6400
|
return [
|
|
6401
|
+
GOAL_CONTINUATION_MARKER,
|
|
6389
6402
|
"Continue working toward the active goal.",
|
|
6390
6403
|
"",
|
|
6391
6404
|
`<objective>
|
|
@@ -6406,11 +6419,12 @@ ${goal}
|
|
|
6406
6419
|
" current state, requirement by requirement. Treat uncertain or indirect evidence as not achieved.",
|
|
6407
6420
|
"",
|
|
6408
6421
|
`Your last response was:
|
|
6409
|
-
${lastResponse.slice(
|
|
6422
|
+
${lastResponse.slice(-1e3)}`
|
|
6410
6423
|
].join("\n");
|
|
6411
6424
|
}
|
|
6412
6425
|
var init_run_until = __esm({
|
|
6413
6426
|
"src/internal/runtime/lifecycle/run-until.ts"() {
|
|
6427
|
+
init_goal_loop();
|
|
6414
6428
|
}
|
|
6415
6429
|
});
|
|
6416
6430
|
|
|
@@ -17146,7 +17160,9 @@ async function loadDriver(filePath) {
|
|
|
17146
17160
|
}
|
|
17147
17161
|
try {
|
|
17148
17162
|
const mod = await (driverLoaderOverrides?.nodeSqlite?.() ?? Promise.resolve(
|
|
17149
|
-
process.getBuiltinModule?.(
|
|
17163
|
+
process.getBuiltinModule?.(
|
|
17164
|
+
"node:sqlite"
|
|
17165
|
+
) ?? (() => {
|
|
17150
17166
|
throw new Error("node:sqlite built-in unavailable (Node < 22.3)");
|
|
17151
17167
|
})()
|
|
17152
17168
|
));
|
|
@@ -19680,8 +19696,8 @@ async function getRegisteredAgentOrThrow(agentId) {
|
|
|
19680
19696
|
// src/agent.ts
|
|
19681
19697
|
init_errors();
|
|
19682
19698
|
init_discovery();
|
|
19683
|
-
init_agent_session();
|
|
19684
19699
|
init_agent_factory_registry();
|
|
19700
|
+
init_agent_session();
|
|
19685
19701
|
var streamObjectImport;
|
|
19686
19702
|
var Agent = class _Agent {
|
|
19687
19703
|
constructor() {
|
|
@@ -19973,7 +19989,9 @@ var Agent = class _Agent {
|
|
|
19973
19989
|
reg = getRegisteredAgent(agentId);
|
|
19974
19990
|
}
|
|
19975
19991
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
19976
|
-
throw new UnknownAgentError(
|
|
19992
|
+
throw new UnknownAgentError(
|
|
19993
|
+
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
19994
|
+
);
|
|
19977
19995
|
}
|
|
19978
19996
|
const cwd = reg.cwd ?? process.cwd();
|
|
19979
19997
|
const optModel = reg.options.model;
|
|
@@ -19983,16 +20001,20 @@ var Agent = class _Agent {
|
|
|
19983
20001
|
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
|
|
19984
20002
|
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
19985
20003
|
const store = new FsSessionStore2({ baseDir, cwd });
|
|
19986
|
-
return enqueueSessionWrite(
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
|
|
19992
|
-
|
|
19993
|
-
|
|
20004
|
+
return enqueueSessionWrite(
|
|
20005
|
+
cwd,
|
|
20006
|
+
agentId,
|
|
20007
|
+
() => compactSessionTranscript2({
|
|
20008
|
+
store,
|
|
20009
|
+
loc: { cwd, agentId, model },
|
|
20010
|
+
sessionId: agentId,
|
|
20011
|
+
trigger: options.trigger ?? "manual",
|
|
20012
|
+
summarize: options.summarize ?? buildDefaultSummarizer2({
|
|
20013
|
+
agentModel: model,
|
|
20014
|
+
...reg.options.apiKey !== void 0 ? { apiKey: reg.options.apiKey } : {}
|
|
20015
|
+
})
|
|
19994
20016
|
})
|
|
19995
|
-
|
|
20017
|
+
);
|
|
19996
20018
|
}
|
|
19997
20019
|
/**
|
|
19998
20020
|
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
@@ -20009,7 +20031,9 @@ var Agent = class _Agent {
|
|
|
20009
20031
|
reg = getRegisteredAgent(agentId);
|
|
20010
20032
|
}
|
|
20011
20033
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
20012
|
-
throw new UnknownAgentError(
|
|
20034
|
+
throw new UnknownAgentError(
|
|
20035
|
+
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
20036
|
+
);
|
|
20013
20037
|
}
|
|
20014
20038
|
const cwd = reg.cwd ?? process.cwd();
|
|
20015
20039
|
const optModel = reg.options.model;
|