@sema-agent/server 1.262.0 → 1.263.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/dist/main.js CHANGED
@@ -26,7 +26,7 @@ import { normalizeSuggestNextPrompts, normalizeResilience, normalizeAttachments,
26
26
  import { createBrain, brainSummary } from "./brain.js";
27
27
  import { loadConfig, logConfigDiagnostics } from "./config.js";
28
28
  import { resourceSuspendOptIn } from "./resource-suspend.js";
29
- import { createSessionStore } from "./plugins/session-store.js";
29
+ import { createSessionStore, ensureSessionDurable } from "./plugins/session-store.js";
30
30
  import { ForkRoutingSessionStore } from "./plugins/fork-routing-session-store.js";
31
31
  import { createStoreBackend } from "./plugins/store-backend.js";
32
32
  import { e2bExecutionEnvFactory } from "./plugins/remote-env-e2b.js";
@@ -1258,10 +1258,13 @@ async function main() {
1258
1258
  const webSearch = webSearchCfg ? createWebSearchBackend(webSearchCfg) : undefined;
1259
1259
  if (webSearch)
1260
1260
  logger.info(`WebSearch enabled (provider=${webSearchCfg.provider}, maxResults=${webSearch.maxResults})`);
1261
+ const ensureChildSessionDurable = checkpointStore ? (sessionId) => ensureSessionDurable(sessionStore, sessionId) : undefined;
1261
1262
  const scenarioDeps = {
1262
1263
  runner, subRunner, model: "default", skills, repoClient, requirePrincipal: config.requirePrincipal,
1263
1264
  ...(webSearch ? { webSearch } : {}), metrics, logger,
1264
1265
  ...(backgroundAgentStore ? { backgroundAgentStore } : {}),
1266
+ ...(checkpointStore ? { checkpointStore } : {}),
1267
+ ...(ensureChildSessionDurable ? { ensureChildSessionDurable } : {}),
1265
1268
  oaApiBaseUrl: config.oaApiBaseUrl, oaServiceToken: config.oaServiceToken, oaIssue: config.oaIssue,
1266
1269
  brandIdentity: config.configProvider === "local",
1267
1270
  ...(sendUserFileToolSpec
@@ -1300,6 +1303,14 @@ async function main() {
1300
1303
  let rows = 0, sessions = 0, skipped = 0, failedScopes = 0;
1301
1304
  for (const scope of scopes) {
1302
1305
  try {
1306
+ if (checkpointStore) {
1307
+ const pr = await defaultTaskRegistry.reconcileParkedAgents({ agentStore: store, checkpointStore }, scope, Date.now());
1308
+ if (pr.failed > 0 || pr.rolledBack > 0) {
1309
+ metrics.inc("bg_agents_park_reconciled_failed_total", {}, pr.failed);
1310
+ metrics.inc("bg_agents_park_reconciled_rolledback_total", {}, pr.rolledBack);
1311
+ logger.info("reaper_swept", { metric: "bg_agents_park_reconciled", scope, failed: pr.failed, rolledBack: pr.rolledBack });
1312
+ }
1313
+ }
1303
1314
  const r = await defaultTaskRegistry.reapDurableAgents(scope, { store, sessions: subRunner.sessions, ...(mailboxStore ? { mailbox: mailboxStore } : {}) }, {
1304
1315
  maxAgeMs: config.backgroundAgentRetentionMs,
1305
1316
  staleRunningMaxAgeMs: config.backgroundAgentStaleRunningMs,