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