@theokit/sdk 4.16.6 → 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 +12 -0
- package/dist/agent.d.ts +12 -0
- package/dist/cron.cjs +62 -1
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +62 -1
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +62 -1
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +62 -1
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +62 -1
- 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 +62 -1
- 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
|
@@ -6063,10 +6063,12 @@ function buildDefaultSummarizer(opts) {
|
|
|
6063
6063
|
return async (messages) => {
|
|
6064
6064
|
registerBuiltins();
|
|
6065
6065
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
6066
|
+
const prefixProfile = modelPrefix !== void 0 ? getProviderProfile(modelPrefix) : void 0;
|
|
6067
|
+
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
6066
6068
|
const route = resolveSummarizerRoute({
|
|
6067
6069
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
6068
6070
|
modelPrefix,
|
|
6069
|
-
prefixHasProfile:
|
|
6071
|
+
prefixHasProfile: prefixUsable,
|
|
6070
6072
|
envProvider: detectPrimaryProvider()
|
|
6071
6073
|
});
|
|
6072
6074
|
const provider = route.provider;
|
|
@@ -7594,6 +7596,32 @@ var init_batch = __esm({
|
|
|
7594
7596
|
}
|
|
7595
7597
|
});
|
|
7596
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
|
+
|
|
7597
7625
|
// src/agent-builder.ts
|
|
7598
7626
|
var AgentBuilder = class {
|
|
7599
7627
|
opts = {};
|
|
@@ -19897,6 +19925,39 @@ var Agent = class _Agent {
|
|
|
19897
19925
|
})
|
|
19898
19926
|
}));
|
|
19899
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
|
+
}
|
|
19900
19961
|
/**
|
|
19901
19962
|
* Permanently delete a cloud agent.
|
|
19902
19963
|
*
|