@theokit/sdk 4.16.7 → 4.17.1
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 +12 -0
- package/dist/agent.d.ts +12 -0
- package/dist/cron.cjs +60 -3
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +60 -3
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +60 -3
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +60 -3
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +60 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +60 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/session/inject-session.d.ts +15 -0
- package/package.json +1 -1
package/dist/eval.cjs
CHANGED
|
@@ -5947,9 +5947,7 @@ async function hydrateSession(agentId, loc) {
|
|
|
5947
5947
|
hydratedKeys.add(key);
|
|
5948
5948
|
const persisted = await readSessionMessages(loc.store, agentId);
|
|
5949
5949
|
if (persisted.length === 0) return;
|
|
5950
|
-
|
|
5951
|
-
sessions.set(agentId, persisted);
|
|
5952
|
-
}
|
|
5950
|
+
sessions.set(agentId, persisted);
|
|
5953
5951
|
}
|
|
5954
5952
|
async function flushSessionWrites() {
|
|
5955
5953
|
while (pendingWrites.size > 0) {
|
|
@@ -7596,6 +7594,32 @@ var init_batch = __esm({
|
|
|
7596
7594
|
}
|
|
7597
7595
|
});
|
|
7598
7596
|
|
|
7597
|
+
// src/internal/session/inject-session.ts
|
|
7598
|
+
var inject_session_exports = {};
|
|
7599
|
+
__export(inject_session_exports, {
|
|
7600
|
+
injectSessionTurn: () => injectSessionTurn
|
|
7601
|
+
});
|
|
7602
|
+
async function injectSessionTurn(opts) {
|
|
7603
|
+
await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
7604
|
+
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
7605
|
+
const transcript = SessionTranscript.fromRecords(prior, {
|
|
7606
|
+
cwd: opts.loc.cwd,
|
|
7607
|
+
sessionId: opts.sessionId,
|
|
7608
|
+
model: opts.loc.model ?? "unknown"
|
|
7609
|
+
});
|
|
7610
|
+
transcript.appendUserTurn(opts.userText);
|
|
7611
|
+
transcript.appendAssistantTurn({ text: opts.assistantText });
|
|
7612
|
+
await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));
|
|
7613
|
+
invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
7614
|
+
});
|
|
7615
|
+
}
|
|
7616
|
+
var init_inject_session = __esm({
|
|
7617
|
+
"src/internal/session/inject-session.ts"() {
|
|
7618
|
+
init_session_transcript();
|
|
7619
|
+
init_agent_session();
|
|
7620
|
+
}
|
|
7621
|
+
});
|
|
7622
|
+
|
|
7599
7623
|
// src/agent-builder.ts
|
|
7600
7624
|
var AgentBuilder = class {
|
|
7601
7625
|
opts = {};
|
|
@@ -19899,6 +19923,39 @@ var Agent = class _Agent {
|
|
|
19899
19923
|
})
|
|
19900
19924
|
}));
|
|
19901
19925
|
}
|
|
19926
|
+
/**
|
|
19927
|
+
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
19928
|
+
* running an LLM turn (the Codex review-exit mechanism: the parent thread "learns" a result — e.g.
|
|
19929
|
+
* review findings — so follow-ups work). Appends onto the DAG leaf and invalidates the in-memory
|
|
19930
|
+
* cache; serialized on the per-agent write chain.
|
|
19931
|
+
*
|
|
19932
|
+
* @public
|
|
19933
|
+
*/
|
|
19934
|
+
static async injectSessionTurn(agentId, turn) {
|
|
19935
|
+
let reg = getRegisteredAgent(agentId);
|
|
19936
|
+
if (reg === void 0) {
|
|
19937
|
+
await hydrateRegistryFromDisk(process.cwd());
|
|
19938
|
+
reg = getRegisteredAgent(agentId);
|
|
19939
|
+
}
|
|
19940
|
+
if (reg === void 0 || reg.runtime !== "local") {
|
|
19941
|
+
throw new UnknownAgentError(`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`);
|
|
19942
|
+
}
|
|
19943
|
+
const cwd = reg.cwd ?? process.cwd();
|
|
19944
|
+
const optModel = reg.options.model;
|
|
19945
|
+
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
19946
|
+
const { injectSessionTurn: injectSessionTurn2 } = await Promise.resolve().then(() => (init_inject_session(), inject_session_exports));
|
|
19947
|
+
const { FsSessionStore: FsSessionStore2 } = await Promise.resolve().then(() => (init_fs_session_store(), fs_session_store_exports));
|
|
19948
|
+
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
|
|
19949
|
+
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
19950
|
+
const store = new FsSessionStore2({ baseDir, cwd });
|
|
19951
|
+
await injectSessionTurn2({
|
|
19952
|
+
store,
|
|
19953
|
+
loc: { cwd, agentId, model },
|
|
19954
|
+
sessionId: agentId,
|
|
19955
|
+
userText: turn.userText,
|
|
19956
|
+
assistantText: turn.assistantText
|
|
19957
|
+
});
|
|
19958
|
+
}
|
|
19902
19959
|
/**
|
|
19903
19960
|
* Permanently delete a cloud agent.
|
|
19904
19961
|
*
|