@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/index.cjs
CHANGED
|
@@ -9031,6 +9031,32 @@ var init_batch = __esm({
|
|
|
9031
9031
|
}
|
|
9032
9032
|
});
|
|
9033
9033
|
|
|
9034
|
+
// src/internal/session/inject-session.ts
|
|
9035
|
+
var inject_session_exports = {};
|
|
9036
|
+
__export(inject_session_exports, {
|
|
9037
|
+
injectSessionTurn: () => injectSessionTurn
|
|
9038
|
+
});
|
|
9039
|
+
async function injectSessionTurn(opts) {
|
|
9040
|
+
await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
9041
|
+
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
9042
|
+
const transcript = SessionTranscript.fromRecords(prior, {
|
|
9043
|
+
cwd: opts.loc.cwd,
|
|
9044
|
+
sessionId: opts.sessionId,
|
|
9045
|
+
model: opts.loc.model ?? "unknown"
|
|
9046
|
+
});
|
|
9047
|
+
transcript.appendUserTurn(opts.userText);
|
|
9048
|
+
transcript.appendAssistantTurn({ text: opts.assistantText });
|
|
9049
|
+
await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));
|
|
9050
|
+
invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
9051
|
+
});
|
|
9052
|
+
}
|
|
9053
|
+
var init_inject_session = __esm({
|
|
9054
|
+
"src/internal/session/inject-session.ts"() {
|
|
9055
|
+
init_session_transcript();
|
|
9056
|
+
init_agent_session();
|
|
9057
|
+
}
|
|
9058
|
+
});
|
|
9059
|
+
|
|
9034
9060
|
// src/types/workflow.ts
|
|
9035
9061
|
var WorkflowDuplicateStepIdError, WorkflowInputError, WorkflowOutputError, WorkflowStateError, WorkflowAlreadyRunningError, WorkflowSnapshotNotFoundError, WorkflowMaxIterationsExceededError, WorkflowNotSerializableError, WorkflowResumeStepNotFoundError, WorkflowParallelError, WorkflowCompensateNotImplementedError;
|
|
9036
9062
|
var init_workflow = __esm({
|
|
@@ -21531,6 +21557,39 @@ var Agent = class _Agent {
|
|
|
21531
21557
|
})
|
|
21532
21558
|
}));
|
|
21533
21559
|
}
|
|
21560
|
+
/**
|
|
21561
|
+
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
21562
|
+
* running an LLM turn (the Codex review-exit mechanism: the parent thread "learns" a result — e.g.
|
|
21563
|
+
* review findings — so follow-ups work). Appends onto the DAG leaf and invalidates the in-memory
|
|
21564
|
+
* cache; serialized on the per-agent write chain.
|
|
21565
|
+
*
|
|
21566
|
+
* @public
|
|
21567
|
+
*/
|
|
21568
|
+
static async injectSessionTurn(agentId, turn) {
|
|
21569
|
+
let reg = getRegisteredAgent(agentId);
|
|
21570
|
+
if (reg === void 0) {
|
|
21571
|
+
await hydrateRegistryFromDisk(process.cwd());
|
|
21572
|
+
reg = getRegisteredAgent(agentId);
|
|
21573
|
+
}
|
|
21574
|
+
if (reg === void 0 || reg.runtime !== "local") {
|
|
21575
|
+
throw new exports.UnknownAgentError(`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`);
|
|
21576
|
+
}
|
|
21577
|
+
const cwd = reg.cwd ?? process.cwd();
|
|
21578
|
+
const optModel = reg.options.model;
|
|
21579
|
+
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
21580
|
+
const { injectSessionTurn: injectSessionTurn2 } = await Promise.resolve().then(() => (init_inject_session(), inject_session_exports));
|
|
21581
|
+
const { FsSessionStore: FsSessionStore2 } = await Promise.resolve().then(() => (init_fs_session_store(), fs_session_store_exports));
|
|
21582
|
+
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
|
|
21583
|
+
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
21584
|
+
const store = new FsSessionStore2({ baseDir, cwd });
|
|
21585
|
+
await injectSessionTurn2({
|
|
21586
|
+
store,
|
|
21587
|
+
loc: { cwd, agentId, model },
|
|
21588
|
+
sessionId: agentId,
|
|
21589
|
+
userText: turn.userText,
|
|
21590
|
+
assistantText: turn.assistantText
|
|
21591
|
+
});
|
|
21592
|
+
}
|
|
21534
21593
|
/**
|
|
21535
21594
|
* Permanently delete a cloud agent.
|
|
21536
21595
|
*
|