@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.
package/dist/eval.js CHANGED
@@ -6002,7 +6002,9 @@ function isCompactSummary(content) {
6002
6002
  function plainText(content) {
6003
6003
  if (typeof content === "string") return content;
6004
6004
  if (!Array.isArray(content)) return void 0;
6005
- const texts = content.filter((p) => p !== null && typeof p === "object" && p.type === "text" && typeof p.text === "string").map((p) => p.text);
6005
+ const texts = content.filter(
6006
+ (p) => p !== null && typeof p === "object" && p.type === "text" && typeof p.text === "string"
6007
+ ).map((p) => p.text);
6006
6008
  return texts.length > 0 ? texts.join("\n") : void 0;
6007
6009
  }
6008
6010
  async function compactSessionTranscript(opts) {
@@ -6123,8 +6125,10 @@ async function autoCompactIfNeeded(opts) {
6123
6125
  return true;
6124
6126
  } catch (cause) {
6125
6127
  const msg = cause instanceof Error ? cause.message : String(cause);
6126
- process.stderr.write(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
6127
- `);
6128
+ process.stderr.write(
6129
+ `[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
6130
+ `
6131
+ );
6128
6132
  return false;
6129
6133
  }
6130
6134
  }
@@ -6134,11 +6138,11 @@ var init_compact_session = __esm({
6134
6138
  init_compaction();
6135
6139
  init_router();
6136
6140
  init_real_local_run_provider();
6141
+ init_session_transcript();
6137
6142
  init_providers();
6138
6143
  init_compression_model_registry();
6139
6144
  init_compression_summarizer();
6140
6145
  init_agent_session();
6141
- init_session_transcript();
6142
6146
  COMPACT_SUMMARY_MARKER = "[[theokit:compact-summary]]";
6143
6147
  COMPACT_USER_MESSAGE_MAX_TOKENS = 2e4;
6144
6148
  autoCompactAttempts = (() => {
@@ -6243,10 +6247,17 @@ var init_context = __esm({
6243
6247
  }
6244
6248
  });
6245
6249
 
6250
+ // src/goal-loop.ts
6251
+ var GOAL_CONTINUATION_MARKER;
6252
+ var init_goal_loop = __esm({
6253
+ "src/goal-loop.ts"() {
6254
+ GOAL_CONTINUATION_MARKER = "[[theokit:goal-continuation]]";
6255
+ }
6256
+ });
6257
+
6246
6258
  // src/internal/runtime/lifecycle/run-until.ts
6247
6259
  var run_until_exports = {};
6248
6260
  __export(run_until_exports, {
6249
- GOAL_CONTINUATION_MARKER: () => GOAL_CONTINUATION_MARKER,
6250
6261
  composeContinuation: () => composeContinuation,
6251
6262
  runUntilImpl: () => runUntilImpl
6252
6263
  });
@@ -6411,10 +6422,9 @@ ${goal}
6411
6422
  ${lastResponse.slice(-1e3)}`
6412
6423
  ].join("\n");
6413
6424
  }
6414
- var GOAL_CONTINUATION_MARKER;
6415
6425
  var init_run_until = __esm({
6416
6426
  "src/internal/runtime/lifecycle/run-until.ts"() {
6417
- GOAL_CONTINUATION_MARKER = "[[theokit:goal-continuation]]";
6427
+ init_goal_loop();
6418
6428
  }
6419
6429
  });
6420
6430
 
@@ -17150,7 +17160,9 @@ async function loadDriver(filePath) {
17150
17160
  }
17151
17161
  try {
17152
17162
  const mod = await (driverLoaderOverrides?.nodeSqlite?.() ?? Promise.resolve(
17153
- process.getBuiltinModule?.("node:sqlite") ?? (() => {
17163
+ process.getBuiltinModule?.(
17164
+ "node:sqlite"
17165
+ ) ?? (() => {
17154
17166
  throw new Error("node:sqlite built-in unavailable (Node < 22.3)");
17155
17167
  })()
17156
17168
  ));
@@ -19684,8 +19696,8 @@ async function getRegisteredAgentOrThrow(agentId) {
19684
19696
  // src/agent.ts
19685
19697
  init_errors();
19686
19698
  init_discovery();
19687
- init_agent_session();
19688
19699
  init_agent_factory_registry();
19700
+ init_agent_session();
19689
19701
  var streamObjectImport;
19690
19702
  var Agent = class _Agent {
19691
19703
  constructor() {
@@ -19977,7 +19989,9 @@ var Agent = class _Agent {
19977
19989
  reg = getRegisteredAgent(agentId);
19978
19990
  }
19979
19991
  if (reg === void 0 || reg.runtime !== "local") {
19980
- throw new UnknownAgentError(`No local agent "${agentId}" registered \u2014 compact targets local sessions.`);
19992
+ throw new UnknownAgentError(
19993
+ `No local agent "${agentId}" registered \u2014 compact targets local sessions.`
19994
+ );
19981
19995
  }
19982
19996
  const cwd = reg.cwd ?? process.cwd();
19983
19997
  const optModel = reg.options.model;
@@ -19987,16 +20001,20 @@ var Agent = class _Agent {
19987
20001
  const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await Promise.resolve().then(() => (init_session_transcript(), session_transcript_exports));
19988
20002
  const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
19989
20003
  const store = new FsSessionStore2({ baseDir, cwd });
19990
- return enqueueSessionWrite(cwd, agentId, () => compactSessionTranscript2({
19991
- store,
19992
- loc: { cwd, agentId, model },
19993
- sessionId: agentId,
19994
- trigger: options.trigger ?? "manual",
19995
- summarize: options.summarize ?? buildDefaultSummarizer2({
19996
- agentModel: model,
19997
- ...reg.options.apiKey !== void 0 ? { apiKey: reg.options.apiKey } : {}
20004
+ return enqueueSessionWrite(
20005
+ cwd,
20006
+ agentId,
20007
+ () => compactSessionTranscript2({
20008
+ store,
20009
+ loc: { cwd, agentId, model },
20010
+ sessionId: agentId,
20011
+ trigger: options.trigger ?? "manual",
20012
+ summarize: options.summarize ?? buildDefaultSummarizer2({
20013
+ agentModel: model,
20014
+ ...reg.options.apiKey !== void 0 ? { apiKey: reg.options.apiKey } : {}
20015
+ })
19998
20016
  })
19999
- }));
20017
+ );
20000
20018
  }
20001
20019
  /**
20002
20020
  * M51 — inject a SYNTHETIC user+assistant pair into a LOCAL session's persisted transcript WITHOUT
@@ -20013,7 +20031,9 @@ var Agent = class _Agent {
20013
20031
  reg = getRegisteredAgent(agentId);
20014
20032
  }
20015
20033
  if (reg === void 0 || reg.runtime !== "local") {
20016
- throw new UnknownAgentError(`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`);
20034
+ throw new UnknownAgentError(
20035
+ `No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
20036
+ );
20017
20037
  }
20018
20038
  const cwd = reg.cwd ?? process.cwd();
20019
20039
  const optModel = reg.options.model;