@theokit/sdk 4.19.1 → 4.19.2

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.
@@ -0,0 +1,3 @@
1
+ export { R as Cron } from './cron-M2Xz7lq2.cjs';
2
+ import './run-DFM1H2jW.cjs';
3
+ import 'zod';
package/dist/cron.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { R as Cron } from './cron-Bhdyjl0B.js';
2
+ import './run-DFM1H2jW.js';
3
+ import 'zod';
package/dist/cron.js CHANGED
@@ -6003,7 +6003,9 @@ function isCompactSummary(content) {
6003
6003
  function plainText(content) {
6004
6004
  if (typeof content === "string") return content;
6005
6005
  if (!Array.isArray(content)) return void 0;
6006
- const texts = content.filter((p) => p !== null && typeof p === "object" && p.type === "text" && typeof p.text === "string").map((p) => p.text);
6006
+ const texts = content.filter(
6007
+ (p) => p !== null && typeof p === "object" && p.type === "text" && typeof p.text === "string"
6008
+ ).map((p) => p.text);
6007
6009
  return texts.length > 0 ? texts.join("\n") : void 0;
6008
6010
  }
6009
6011
  async function compactSessionTranscript(opts) {
@@ -6124,8 +6126,10 @@ async function autoCompactIfNeeded(opts) {
6124
6126
  return true;
6125
6127
  } catch (cause) {
6126
6128
  const msg = cause instanceof Error ? cause.message : String(cause);
6127
- process.stderr.write(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
6128
- `);
6129
+ process.stderr.write(
6130
+ `[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
6131
+ `
6132
+ );
6129
6133
  return false;
6130
6134
  }
6131
6135
  }
@@ -6135,11 +6139,11 @@ var init_compact_session = __esm({
6135
6139
  init_compaction();
6136
6140
  init_router();
6137
6141
  init_real_local_run_provider();
6142
+ init_session_transcript();
6138
6143
  init_providers();
6139
6144
  init_compression_model_registry();
6140
6145
  init_compression_summarizer();
6141
6146
  init_agent_session();
6142
- init_session_transcript();
6143
6147
  COMPACT_SUMMARY_MARKER = "[[theokit:compact-summary]]";
6144
6148
  COMPACT_USER_MESSAGE_MAX_TOKENS = 2e4;
6145
6149
  autoCompactAttempts = (() => {
@@ -6244,10 +6248,17 @@ var init_context = __esm({
6244
6248
  }
6245
6249
  });
6246
6250
 
6251
+ // src/goal-loop.ts
6252
+ var GOAL_CONTINUATION_MARKER;
6253
+ var init_goal_loop = __esm({
6254
+ "src/goal-loop.ts"() {
6255
+ GOAL_CONTINUATION_MARKER = "[[theokit:goal-continuation]]";
6256
+ }
6257
+ });
6258
+
6247
6259
  // src/internal/runtime/lifecycle/run-until.ts
6248
6260
  var run_until_exports = {};
6249
6261
  __export(run_until_exports, {
6250
- GOAL_CONTINUATION_MARKER: () => GOAL_CONTINUATION_MARKER,
6251
6262
  composeContinuation: () => composeContinuation,
6252
6263
  runUntilImpl: () => runUntilImpl
6253
6264
  });
@@ -6412,10 +6423,9 @@ ${goal}
6412
6423
  ${lastResponse.slice(-1e3)}`
6413
6424
  ].join("\n");
6414
6425
  }
6415
- var GOAL_CONTINUATION_MARKER;
6416
6426
  var init_run_until = __esm({
6417
6427
  "src/internal/runtime/lifecycle/run-until.ts"() {
6418
- GOAL_CONTINUATION_MARKER = "[[theokit:goal-continuation]]";
6428
+ init_goal_loop();
6419
6429
  }
6420
6430
  });
6421
6431
 
@@ -17155,7 +17165,9 @@ async function loadDriver(filePath) {
17155
17165
  }
17156
17166
  try {
17157
17167
  const mod = await (driverLoaderOverrides?.nodeSqlite?.() ?? Promise.resolve(
17158
- process.getBuiltinModule?.("node:sqlite") ?? (() => {
17168
+ process.getBuiltinModule?.(
17169
+ "node:sqlite"
17170
+ ) ?? (() => {
17159
17171
  throw new Error("node:sqlite built-in unavailable (Node < 22.3)");
17160
17172
  })()
17161
17173
  ));
@@ -19689,8 +19701,8 @@ async function getRegisteredAgentOrThrow(agentId) {
19689
19701
  // src/agent.ts
19690
19702
  init_errors();
19691
19703
  init_discovery();
19692
- init_agent_session();
19693
19704
  init_agent_factory_registry();
19705
+ init_agent_session();
19694
19706
  var streamObjectImport;
19695
19707
  var Agent = class _Agent {
19696
19708
  constructor() {
@@ -19982,7 +19994,9 @@ var Agent = class _Agent {
19982
19994
  reg = getRegisteredAgent(agentId);
19983
19995
  }
19984
19996
  if (reg === void 0 || reg.runtime !== "local") {
19985
- throw new UnknownAgentError(`No local agent "${agentId}" registered \u2014 compact targets local sessions.`);
19997
+ throw new UnknownAgentError(
19998
+ `No local agent "${agentId}" registered \u2014 compact targets local sessions.`
19999
+ );
19986
20000
  }
19987
20001
  const cwd = reg.cwd ?? process.cwd();
19988
20002
  const optModel = reg.options.model;
@@ -19992,16 +20006,20 @@ var Agent = class _Agent {
19992
20006
  const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
19993
20007
  const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
19994
20008
  const store = new FsSessionStore2({ baseDir, cwd });
19995
- return enqueueSessionWrite(cwd, agentId, () => compactSessionTranscript2({
19996
- store,
19997
- loc: { cwd, agentId, model },
19998
- sessionId: agentId,
19999
- trigger: options.trigger ?? "manual",
20000
- summarize: options.summarize ?? buildDefaultSummarizer2({
20001
- agentModel: model,
20002
- ...reg.options.apiKey !== void 0 ? { apiKey: reg.options.apiKey } : {}
20009
+ return enqueueSessionWrite(
20010
+ cwd,
20011
+ agentId,
20012
+ () => compactSessionTranscript2({
20013
+ store,
20014
+ loc: { cwd, agentId, model },
20015
+ sessionId: agentId,
20016
+ trigger: options.trigger ?? "manual",
20017
+ summarize: options.summarize ?? buildDefaultSummarizer2({
20018
+ agentModel: model,
20019
+ ...reg.options.apiKey !== void 0 ? { apiKey: reg.options.apiKey } : {}
20020
+ })
20003
20021
  })
20004
- }));
20022
+ );
20005
20023
  }
20006
20024
  /**
20007
20025
  * M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
@@ -20018,7 +20036,9 @@ var Agent = class _Agent {
20018
20036
  reg = getRegisteredAgent(agentId);
20019
20037
  }
20020
20038
  if (reg === void 0 || reg.runtime !== "local") {
20021
- throw new UnknownAgentError(`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`);
20039
+ throw new UnknownAgentError(
20040
+ `No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
20041
+ );
20022
20042
  }
20023
20043
  const cwd = reg.cwd ?? process.cwd();
20024
20044
  const optModel = reg.options.model;