@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/cron.js
CHANGED
|
@@ -6061,10 +6061,12 @@ function buildDefaultSummarizer(opts) {
|
|
|
6061
6061
|
return async (messages) => {
|
|
6062
6062
|
registerBuiltins();
|
|
6063
6063
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
6064
|
+
const prefixProfile = modelPrefix !== void 0 ? getProviderProfile(modelPrefix) : void 0;
|
|
6065
|
+
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
6064
6066
|
const route = resolveSummarizerRoute({
|
|
6065
6067
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
6066
6068
|
modelPrefix,
|
|
6067
|
-
prefixHasProfile:
|
|
6069
|
+
prefixHasProfile: prefixUsable,
|
|
6068
6070
|
envProvider: detectPrimaryProvider()
|
|
6069
6071
|
});
|
|
6070
6072
|
const provider = route.provider;
|
|
@@ -7592,6 +7594,32 @@ var init_batch = __esm({
|
|
|
7592
7594
|
}
|
|
7593
7595
|
});
|
|
7594
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
|
+
|
|
7595
7623
|
// src/agent-builder.ts
|
|
7596
7624
|
var AgentBuilder = class {
|
|
7597
7625
|
opts = {};
|
|
@@ -19899,6 +19927,39 @@ var Agent = class _Agent {
|
|
|
19899
19927
|
})
|
|
19900
19928
|
}));
|
|
19901
19929
|
}
|
|
19930
|
+
/**
|
|
19931
|
+
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
19932
|
+
* running an LLM turn (the Codex review-exit mechanism: the parent thread "learns" a result — e.g.
|
|
19933
|
+
* review findings — so follow-ups work). Appends onto the DAG leaf and invalidates the in-memory
|
|
19934
|
+
* cache; serialized on the per-agent write chain.
|
|
19935
|
+
*
|
|
19936
|
+
* @public
|
|
19937
|
+
*/
|
|
19938
|
+
static async injectSessionTurn(agentId, turn) {
|
|
19939
|
+
let reg = getRegisteredAgent(agentId);
|
|
19940
|
+
if (reg === void 0) {
|
|
19941
|
+
await hydrateRegistryFromDisk(process.cwd());
|
|
19942
|
+
reg = getRegisteredAgent(agentId);
|
|
19943
|
+
}
|
|
19944
|
+
if (reg === void 0 || reg.runtime !== "local") {
|
|
19945
|
+
throw new UnknownAgentError(`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`);
|
|
19946
|
+
}
|
|
19947
|
+
const cwd = reg.cwd ?? process.cwd();
|
|
19948
|
+
const optModel = reg.options.model;
|
|
19949
|
+
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
19950
|
+
const { injectSessionTurn: injectSessionTurn2 } = await Promise.resolve().then(() => (init_inject_session(), inject_session_exports));
|
|
19951
|
+
const { FsSessionStore: FsSessionStore2 } = await Promise.resolve().then(() => (init_fs_session_store(), fs_session_store_exports));
|
|
19952
|
+
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
|
|
19953
|
+
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
19954
|
+
const store = new FsSessionStore2({ baseDir, cwd });
|
|
19955
|
+
await injectSessionTurn2({
|
|
19956
|
+
store,
|
|
19957
|
+
loc: { cwd, agentId, model },
|
|
19958
|
+
sessionId: agentId,
|
|
19959
|
+
userText: turn.userText,
|
|
19960
|
+
assistantText: turn.assistantText
|
|
19961
|
+
});
|
|
19962
|
+
}
|
|
19902
19963
|
/**
|
|
19903
19964
|
* Permanently delete a cloud agent.
|
|
19904
19965
|
*
|