@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.js
CHANGED
|
@@ -6060,10 +6060,12 @@ function buildDefaultSummarizer(opts) {
|
|
|
6060
6060
|
return async (messages) => {
|
|
6061
6061
|
registerBuiltins();
|
|
6062
6062
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
6063
|
+
const prefixProfile = modelPrefix !== void 0 ? getProviderProfile(modelPrefix) : void 0;
|
|
6064
|
+
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
6063
6065
|
const route = resolveSummarizerRoute({
|
|
6064
6066
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
6065
6067
|
modelPrefix,
|
|
6066
|
-
prefixHasProfile:
|
|
6068
|
+
prefixHasProfile: prefixUsable,
|
|
6067
6069
|
envProvider: detectPrimaryProvider()
|
|
6068
6070
|
});
|
|
6069
6071
|
const provider = route.provider;
|
|
@@ -7591,6 +7593,32 @@ var init_batch = __esm({
|
|
|
7591
7593
|
}
|
|
7592
7594
|
});
|
|
7593
7595
|
|
|
7596
|
+
// src/internal/session/inject-session.ts
|
|
7597
|
+
var inject_session_exports = {};
|
|
7598
|
+
__export(inject_session_exports, {
|
|
7599
|
+
injectSessionTurn: () => injectSessionTurn
|
|
7600
|
+
});
|
|
7601
|
+
async function injectSessionTurn(opts) {
|
|
7602
|
+
await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
7603
|
+
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
7604
|
+
const transcript = SessionTranscript.fromRecords(prior, {
|
|
7605
|
+
cwd: opts.loc.cwd,
|
|
7606
|
+
sessionId: opts.sessionId,
|
|
7607
|
+
model: opts.loc.model ?? "unknown"
|
|
7608
|
+
});
|
|
7609
|
+
transcript.appendUserTurn(opts.userText);
|
|
7610
|
+
transcript.appendAssistantTurn({ text: opts.assistantText });
|
|
7611
|
+
await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));
|
|
7612
|
+
invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
7613
|
+
});
|
|
7614
|
+
}
|
|
7615
|
+
var init_inject_session = __esm({
|
|
7616
|
+
"src/internal/session/inject-session.ts"() {
|
|
7617
|
+
init_session_transcript();
|
|
7618
|
+
init_agent_session();
|
|
7619
|
+
}
|
|
7620
|
+
});
|
|
7621
|
+
|
|
7594
7622
|
// src/agent-builder.ts
|
|
7595
7623
|
var AgentBuilder = class {
|
|
7596
7624
|
opts = {};
|
|
@@ -19894,6 +19922,39 @@ var Agent = class _Agent {
|
|
|
19894
19922
|
})
|
|
19895
19923
|
}));
|
|
19896
19924
|
}
|
|
19925
|
+
/**
|
|
19926
|
+
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
19927
|
+
* running an LLM turn (the Codex review-exit mechanism: the parent thread "learns" a result — e.g.
|
|
19928
|
+
* review findings — so follow-ups work). Appends onto the DAG leaf and invalidates the in-memory
|
|
19929
|
+
* cache; serialized on the per-agent write chain.
|
|
19930
|
+
*
|
|
19931
|
+
* @public
|
|
19932
|
+
*/
|
|
19933
|
+
static async injectSessionTurn(agentId, turn) {
|
|
19934
|
+
let reg = getRegisteredAgent(agentId);
|
|
19935
|
+
if (reg === void 0) {
|
|
19936
|
+
await hydrateRegistryFromDisk(process.cwd());
|
|
19937
|
+
reg = getRegisteredAgent(agentId);
|
|
19938
|
+
}
|
|
19939
|
+
if (reg === void 0 || reg.runtime !== "local") {
|
|
19940
|
+
throw new UnknownAgentError(`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`);
|
|
19941
|
+
}
|
|
19942
|
+
const cwd = reg.cwd ?? process.cwd();
|
|
19943
|
+
const optModel = reg.options.model;
|
|
19944
|
+
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
19945
|
+
const { injectSessionTurn: injectSessionTurn2 } = await Promise.resolve().then(() => (init_inject_session(), inject_session_exports));
|
|
19946
|
+
const { FsSessionStore: FsSessionStore2 } = await Promise.resolve().then(() => (init_fs_session_store(), fs_session_store_exports));
|
|
19947
|
+
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
|
|
19948
|
+
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
19949
|
+
const store = new FsSessionStore2({ baseDir, cwd });
|
|
19950
|
+
await injectSessionTurn2({
|
|
19951
|
+
store,
|
|
19952
|
+
loc: { cwd, agentId, model },
|
|
19953
|
+
sessionId: agentId,
|
|
19954
|
+
userText: turn.userText,
|
|
19955
|
+
assistantText: turn.assistantText
|
|
19956
|
+
});
|
|
19957
|
+
}
|
|
19897
19958
|
/**
|
|
19898
19959
|
* Permanently delete a cloud agent.
|
|
19899
19960
|
*
|