@theokit/sdk 4.16.7 → 4.17.1
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 +60 -3
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +60 -3
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +60 -3
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +60 -3
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +60 -3
- 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 +60 -3
- 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.d.cts
CHANGED
|
@@ -650,6 +650,18 @@ declare class Agent {
|
|
|
650
650
|
trigger?: "manual" | "auto";
|
|
651
651
|
summarize?: (messages: readonly CompressibleMessage[]) => Promise<string>;
|
|
652
652
|
}): Promise<CompactResult>;
|
|
653
|
+
/**
|
|
654
|
+
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
655
|
+
* running an LLM turn (the Codex review-exit mechanism: the parent thread "learns" a result — e.g.
|
|
656
|
+
* review findings — so follow-ups work). Appends onto the DAG leaf and invalidates the in-memory
|
|
657
|
+
* cache; serialized on the per-agent write chain.
|
|
658
|
+
*
|
|
659
|
+
* @public
|
|
660
|
+
*/
|
|
661
|
+
static injectSessionTurn(agentId: string, turn: {
|
|
662
|
+
userText: string;
|
|
663
|
+
assistantText: string;
|
|
664
|
+
}): Promise<void>;
|
|
653
665
|
/**
|
|
654
666
|
* Permanently delete a cloud agent.
|
|
655
667
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -650,6 +650,18 @@ declare class Agent {
|
|
|
650
650
|
trigger?: "manual" | "auto";
|
|
651
651
|
summarize?: (messages: readonly CompressibleMessage[]) => Promise<string>;
|
|
652
652
|
}): Promise<CompactResult>;
|
|
653
|
+
/**
|
|
654
|
+
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
655
|
+
* running an LLM turn (the Codex review-exit mechanism: the parent thread "learns" a result — e.g.
|
|
656
|
+
* review findings — so follow-ups work). Appends onto the DAG leaf and invalidates the in-memory
|
|
657
|
+
* cache; serialized on the per-agent write chain.
|
|
658
|
+
*
|
|
659
|
+
* @public
|
|
660
|
+
*/
|
|
661
|
+
static injectSessionTurn(agentId: string, turn: {
|
|
662
|
+
userText: string;
|
|
663
|
+
assistantText: string;
|
|
664
|
+
}): Promise<void>;
|
|
653
665
|
/**
|
|
654
666
|
* Permanently delete a cloud agent.
|
|
655
667
|
*
|
package/dist/index.js
CHANGED
|
@@ -6118,9 +6118,7 @@ async function hydrateSession(agentId, loc) {
|
|
|
6118
6118
|
hydratedKeys.add(key2);
|
|
6119
6119
|
const persisted = await readSessionMessages(loc.store, agentId);
|
|
6120
6120
|
if (persisted.length === 0) return;
|
|
6121
|
-
|
|
6122
|
-
sessions.set(agentId, persisted);
|
|
6123
|
-
}
|
|
6121
|
+
sessions.set(agentId, persisted);
|
|
6124
6122
|
}
|
|
6125
6123
|
async function flushSessionWrites() {
|
|
6126
6124
|
while (pendingWrites.size > 0) {
|
|
@@ -9028,6 +9026,32 @@ var init_batch = __esm({
|
|
|
9028
9026
|
}
|
|
9029
9027
|
});
|
|
9030
9028
|
|
|
9029
|
+
// src/internal/session/inject-session.ts
|
|
9030
|
+
var inject_session_exports = {};
|
|
9031
|
+
__export(inject_session_exports, {
|
|
9032
|
+
injectSessionTurn: () => injectSessionTurn
|
|
9033
|
+
});
|
|
9034
|
+
async function injectSessionTurn(opts) {
|
|
9035
|
+
await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
9036
|
+
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
9037
|
+
const transcript = SessionTranscript.fromRecords(prior, {
|
|
9038
|
+
cwd: opts.loc.cwd,
|
|
9039
|
+
sessionId: opts.sessionId,
|
|
9040
|
+
model: opts.loc.model ?? "unknown"
|
|
9041
|
+
});
|
|
9042
|
+
transcript.appendUserTurn(opts.userText);
|
|
9043
|
+
transcript.appendAssistantTurn({ text: opts.assistantText });
|
|
9044
|
+
await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));
|
|
9045
|
+
invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
9046
|
+
});
|
|
9047
|
+
}
|
|
9048
|
+
var init_inject_session = __esm({
|
|
9049
|
+
"src/internal/session/inject-session.ts"() {
|
|
9050
|
+
init_session_transcript();
|
|
9051
|
+
init_agent_session();
|
|
9052
|
+
}
|
|
9053
|
+
});
|
|
9054
|
+
|
|
9031
9055
|
// src/types/workflow.ts
|
|
9032
9056
|
var WorkflowDuplicateStepIdError, WorkflowInputError, WorkflowOutputError, WorkflowStateError, WorkflowAlreadyRunningError, WorkflowSnapshotNotFoundError, WorkflowMaxIterationsExceededError, WorkflowNotSerializableError, WorkflowResumeStepNotFoundError, WorkflowParallelError, WorkflowCompensateNotImplementedError;
|
|
9033
9057
|
var init_workflow = __esm({
|
|
@@ -21528,6 +21552,39 @@ var Agent = class _Agent {
|
|
|
21528
21552
|
})
|
|
21529
21553
|
}));
|
|
21530
21554
|
}
|
|
21555
|
+
/**
|
|
21556
|
+
* M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
|
|
21557
|
+
* running an LLM turn (the Codex review-exit mechanism: the parent thread "learns" a result — e.g.
|
|
21558
|
+
* review findings — so follow-ups work). Appends onto the DAG leaf and invalidates the in-memory
|
|
21559
|
+
* cache; serialized on the per-agent write chain.
|
|
21560
|
+
*
|
|
21561
|
+
* @public
|
|
21562
|
+
*/
|
|
21563
|
+
static async injectSessionTurn(agentId, turn) {
|
|
21564
|
+
let reg = getRegisteredAgent(agentId);
|
|
21565
|
+
if (reg === void 0) {
|
|
21566
|
+
await hydrateRegistryFromDisk(process.cwd());
|
|
21567
|
+
reg = getRegisteredAgent(agentId);
|
|
21568
|
+
}
|
|
21569
|
+
if (reg === void 0 || reg.runtime !== "local") {
|
|
21570
|
+
throw new UnknownAgentError(`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`);
|
|
21571
|
+
}
|
|
21572
|
+
const cwd = reg.cwd ?? process.cwd();
|
|
21573
|
+
const optModel = reg.options.model;
|
|
21574
|
+
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
21575
|
+
const { injectSessionTurn: injectSessionTurn2 } = await Promise.resolve().then(() => (init_inject_session(), inject_session_exports));
|
|
21576
|
+
const { FsSessionStore: FsSessionStore2 } = await Promise.resolve().then(() => (init_fs_session_store(), fs_session_store_exports));
|
|
21577
|
+
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
|
|
21578
|
+
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
21579
|
+
const store = new FsSessionStore2({ baseDir, cwd });
|
|
21580
|
+
await injectSessionTurn2({
|
|
21581
|
+
store,
|
|
21582
|
+
loc: { cwd, agentId, model },
|
|
21583
|
+
sessionId: agentId,
|
|
21584
|
+
userText: turn.userText,
|
|
21585
|
+
assistantText: turn.assistantText
|
|
21586
|
+
});
|
|
21587
|
+
}
|
|
21531
21588
|
/**
|
|
21532
21589
|
* Permanently delete a cloud agent.
|
|
21533
21590
|
*
|