@cortexkit/opencode-magic-context 0.49.55 → 0.49.57

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.
Files changed (63) hide show
  1. package/dist/{context-vx5gw5h2.js → context-a617pcqe.js} +210 -57
  2. package/dist/features/magic-context/mural/render-mural.d.ts +17 -0
  3. package/dist/features/magic-context/mural/render-mural.d.ts.map +1 -1
  4. package/dist/features/magic-context/mural/render-trigger.d.ts +2 -1
  5. package/dist/features/magic-context/mural/render-trigger.d.ts.map +1 -1
  6. package/dist/features/magic-context/mural/resolve-mural.d.ts +8 -2
  7. package/dist/features/magic-context/mural/resolve-mural.d.ts.map +1 -1
  8. package/dist/features/magic-context/pi-identity-fold-guards.d.ts +38 -0
  9. package/dist/features/magic-context/pi-identity-fold-guards.d.ts.map +1 -0
  10. package/dist/features/magic-context/storage-historian-runs.d.ts +7 -0
  11. package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
  12. package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
  13. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  14. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  15. package/dist/hooks/magic-context/compartment-runner-types.d.ts +9 -0
  16. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  17. package/dist/hooks/magic-context/compartment-runner.d.ts +7 -1
  18. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  19. package/dist/hooks/magic-context/historian-failure-report.d.ts +112 -0
  20. package/dist/hooks/magic-context/historian-failure-report.d.ts.map +1 -0
  21. package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
  22. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +11 -1
  23. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  24. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  25. package/dist/{index-eyr425dx.js → index-0r2jk2na.js} +2 -2
  26. package/dist/{index-a3n2dczz.js → index-1wsb0e8h.js} +1 -1
  27. package/dist/{index-xj5bap1r.js → index-3600gm9z.js} +268 -21
  28. package/dist/{index-tx8nfw85.js → index-bev3zks1.js} +25 -1
  29. package/dist/{index-567xsm72.js → index-pdnan1e3.js} +3 -3
  30. package/dist/{index-9n6mdfqy.js → index-wpcjxzrm.js} +53 -27
  31. package/dist/{index-yamsmkmh.js → index-x8e50d8f.js} +2 -2
  32. package/dist/{index-xvtjwhm6.js → index-zyanqxtc.js} +2 -2
  33. package/dist/index.js +11 -11
  34. package/dist/raw-ordinal-warmup-worker.js +2 -2
  35. package/dist/{recomp-orchestrator-wbm4kpq9.js → recomp-orchestrator-xwsjrqcs.js} +3 -3
  36. package/dist/{render-73vrt30h.js → render-22ebrmep.js} +1 -1
  37. package/dist/{search-archive-ew4c3bsw.js → search-archive-bqqf5p7f.js} +2 -2
  38. package/dist/{transform-postprocess-phase-mt4dcbhd.js → transform-postprocess-phase-nejydt3q.js} +3 -3
  39. package/dist/v2/{context-13er940g.js → context-4gxr2xd4.js} +240 -67
  40. package/dist/v2/hidden-child-native.d.ts +10 -13
  41. package/dist/v2/hidden-child-native.d.ts.map +1 -1
  42. package/dist/v2/hidden-child-record.d.ts +2 -0
  43. package/dist/v2/hidden-child-record.d.ts.map +1 -1
  44. package/dist/v2/hidden-child-sweep.d.ts +39 -0
  45. package/dist/v2/hidden-child-sweep.d.ts.map +1 -0
  46. package/dist/v2/hidden-completion.d.ts.map +1 -1
  47. package/dist/v2/hooks/context.d.ts.map +1 -1
  48. package/dist/v2/hooks/usage-persist.d.ts +7 -1
  49. package/dist/v2/hooks/usage-persist.d.ts.map +1 -1
  50. package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
  51. package/dist/v2/{recomp-orchestrator-cdkfynz4.js → recomp-orchestrator-1de5c0zr.js} +2 -2
  52. package/dist/v2/{render-a7j6fqbd.js → render-g44ksejs.js} +1 -1
  53. package/dist/v2/{search-archive-3a36887a.js → search-archive-5ycchnyp.js} +2 -2
  54. package/dist/v2/{server-96g41nad.js → server-dqwx9pdh.js} +268 -21
  55. package/dist/v2/{server-79tbtk5w.js → server-r7nj8ga0.js} +1 -1
  56. package/dist/v2/{server-578pc4tf.js → server-t5c8awdm.js} +2 -2
  57. package/dist/v2/{server-7rmf6a57.js → server-v57wr0r9.js} +25 -1
  58. package/dist/v2/server.js +2 -2
  59. package/dist/v2/{v2-archive-reader-jm3d7ccj.js → v2-archive-reader-tgydjgfy.js} +1 -1
  60. package/dist/v2/{wrapup-orchestrator-xnqq81c4.js → wrapup-orchestrator-3871zj7c.js} +2 -2
  61. package/dist/{v2-archive-reader-9bbfh131.js → v2-archive-reader-2czwvyc9.js} +1 -1
  62. package/dist/{wrapup-orchestrator-svhee0fn.js → wrapup-orchestrator-m1yzmgq4.js} +4 -4
  63. package/package.json +1 -1
@@ -194,6 +194,8 @@ import {
194
194
  producerPromptFailureReason,
195
195
  resolveHiddenCompletionExecutor,
196
196
  createV1HiddenCompletionExecutor,
197
+ readHistorianFailureStreak,
198
+ describeHistorianJoinRefusal,
197
199
  shouldWaitForNewHistorianHistory,
198
200
  EMPTY_READ_REPLY,
199
201
  noteTouchedAt,
@@ -218,7 +220,7 @@ import {
218
220
  startCompartmentAgent,
219
221
  setRecompStarting2,
220
222
  setRecompTerminal2
221
- } from "./server-96g41nad.js";
223
+ } from "./server-dqwx9pdh.js";
222
224
  import {
223
225
  resolveHistorianModel2
224
226
  } from "./server-5kym00ag.js";
@@ -376,7 +378,6 @@ import {
376
378
  setPersistedTodoSyntheticAnchor,
377
379
  clearPersistedTodoSyntheticAnchor,
378
380
  setNoteLastReadAt,
379
- getHistorianFailureState,
380
381
  clearHistorianFailureState,
381
382
  getOverflowState,
382
383
  loadTransformPassStateSnapshot,
@@ -793,7 +794,7 @@ import {
793
794
  saveSourceContent,
794
795
  replaceSourceContent,
795
796
  getSourceContents
796
- } from "./server-7rmf6a57.js";
797
+ } from "./server-v57wr0r9.js";
797
798
  import {
798
799
  startBootDeadline,
799
800
  getUnconfirmedMigrationHolders,
@@ -999,10 +1000,10 @@ import {
999
1000
  import"./server-52x68mj4.js";
1000
1001
  import {
1001
1002
  readV2ArchiveOffThread2
1002
- } from "./server-578pc4tf.js";
1003
+ } from "./server-t5c8awdm.js";
1003
1004
  import {
1004
1005
  renderSearchArchiveOffThread2
1005
- } from "./server-79tbtk5w.js";
1006
+ } from "./server-r7nj8ga0.js";
1006
1007
  import {
1007
1008
  markHostInstructionRow,
1008
1009
  hostInstructionRow,
@@ -20200,10 +20201,18 @@ function historianJoinFailClosedMessage(input) {
20200
20201
  if (estimate?.trusted === true && Number.isFinite(estimate.tokens) && estimate.tokens > 0 && Number.isFinite(input.contextLimitTokens) && input.contextLimitTokens > 0 && estimate.tokens < input.contextLimitTokens) {
20201
20202
  return null;
20202
20203
  }
20203
- const budgetMs = input.budgetMs ?? HISTORIAN_INLINE_JOIN_BUDGET_MS;
20204
- const seconds = budgetMs / 1000;
20205
- const reason = input.lastHistorianError?.replace(/\s+/g, " ").trim() || "background historian is still running";
20206
- return `historian did not complete within ${seconds} s: ${reason}`;
20204
+ return describeHistorianJoinRefusal({
20205
+ waitedMs: input.budgetMs ?? HISTORIAN_INLINE_JOIN_BUDGET_MS,
20206
+ usagePercentage: input.usagePercentage,
20207
+ run: input.joinedRun,
20208
+ failures: input.failures ?? {
20209
+ count: 0,
20210
+ lastError: null,
20211
+ lastFailureAt: null,
20212
+ since: null
20213
+ },
20214
+ now: input.now
20215
+ });
20207
20216
  }
20208
20217
  function runCompartmentPhase(args) {
20209
20218
  if (args.historianRunnable !== false && !args.compactionOff && args.canRunCompartments && !getActiveCompartmentRun(args.sessionId) && (args.sessionMeta.compartmentInProgress || args.contextUsage.percentage >= BLOCK_UNTIL_DONE_PERCENTAGE) && isHistorianDrainBudgetSpent({
@@ -20250,6 +20259,7 @@ async function runCompartmentPhaseImpl(args) {
20250
20259
  let rebuiltHistoryThisPass = false;
20251
20260
  let historianJoinTimedOut = false;
20252
20261
  let historianJoinBudgetMs = null;
20262
+ let historianJoinedRun;
20253
20263
  let chainedRecoveryRuns = 0;
20254
20264
  const historianRunnable = args.historianRunnable !== false;
20255
20265
  if (args.compactionOff) {
@@ -20267,6 +20277,7 @@ async function runCompartmentPhaseImpl(args) {
20267
20277
  rebuiltHistoryThisPass,
20268
20278
  historianJoinTimedOut,
20269
20279
  historianJoinBudgetMs,
20280
+ historianJoinedRun,
20270
20281
  chainedRecoveryRuns,
20271
20282
  recoveryHistoryRemains: false
20272
20283
  };
@@ -20322,6 +20333,7 @@ async function runCompartmentPhaseImpl(args) {
20322
20333
  if (activeRun.inlineJoinTimedOutBudgetMs !== undefined && !activeRun.settled) {
20323
20334
  historianJoinTimedOut = true;
20324
20335
  historianJoinBudgetMs = activeRun.inlineJoinTimedOutBudgetMs;
20336
+ historianJoinedRun = activeRun;
20325
20337
  sessionLog2(args.sessionId, "transform: compartment inline join budget already exhausted for this run — not waiting again");
20326
20338
  return "timed_out";
20327
20339
  }
@@ -20342,6 +20354,7 @@ async function runCompartmentPhaseImpl(args) {
20342
20354
  if (result === "timeout") {
20343
20355
  activeRun.inlineJoinTimedOutBudgetMs = join.budgetMs;
20344
20356
  historianJoinTimedOut = true;
20357
+ historianJoinedRun = activeRun;
20345
20358
  sessionLog2(args.sessionId, `transform: compartment await timed out after ${timeoutMs}ms — proceeding without waiting`);
20346
20359
  return "timed_out";
20347
20360
  }
@@ -20579,6 +20592,7 @@ async function runCompartmentPhaseImpl(args) {
20579
20592
  rebuiltHistoryThisPass,
20580
20593
  historianJoinTimedOut,
20581
20594
  historianJoinBudgetMs,
20595
+ historianJoinedRun,
20582
20596
  chainedRecoveryRuns,
20583
20597
  recoveryHistoryRemains
20584
20598
  };
@@ -21028,9 +21042,17 @@ function createTransform(deps) {
21028
21042
  deps.liveModelBySession.set(sessionId, currentOutgoingModel);
21029
21043
  const outgoingModelKey = resolveModelKey(currentOutgoingModel.providerID, currentOutgoingModel.modelID);
21030
21044
  const lastUsageModelKey = persistedUsageBeforeResets?.lastObservedModelKey ?? null;
21031
- if (lastUsageModelKey != null && outgoingModelKey != null && piModelRefToCanonical(lastUsageModelKey) !== piModelRefToCanonical(outgoingModelKey)) {
21032
- const outgoingOverflow = getOverflowState(db, sessionId, outgoingModelKey);
21033
- const preserveOutgoingOverflow = outgoingOverflow.detectedContextLimit > 0 && outgoingOverflow.detectedContextLimitModelKey !== null;
21045
+ const modelChangedSinceUsage = lastUsageModelKey != null && outgoingModelKey != null && piModelRefToCanonical(lastUsageModelKey) !== piModelRefToCanonical(outgoingModelKey);
21046
+ const storedOverflow = getOverflowState(db, sessionId);
21047
+ const detectedLimitForOtherModel = outgoingModelKey != null && storedOverflow.detectedContextLimit > 0 && storedOverflow.detectedContextLimitModelKey !== null && storedOverflow.detectedContextLimitModelKey !== piModelRefToCanonical(outgoingModelKey);
21048
+ if (detectedLimitForOtherModel && !modelChangedSinceUsage) {
21049
+ sessionLog2(sessionId, `transform: clearing detected limit ${storedOverflow.detectedContextLimit} and overflow recovery recorded for ${storedOverflow.detectedContextLimitModelKey}; outgoing model is ${outgoingModelKey}`);
21050
+ clearDetectedContextLimit(db, sessionId);
21051
+ clearEmergencyRecovery(db, sessionId);
21052
+ forgetHistoryBoundaryRecovery(sessionId);
21053
+ }
21054
+ if (modelChangedSinceUsage) {
21055
+ const preserveOutgoingOverflow = storedOverflow.detectedContextLimit > 0 && storedOverflow.detectedContextLimitModelKey !== null && !detectedLimitForOtherModel;
21034
21056
  dropSlot(sessionId, "model-change");
21035
21057
  sessionLog2(sessionId, `transform: model change since last usage (${lastUsageModelKey} -> ${outgoingModelKey}), clearing stale per-model state`);
21036
21058
  updateSessionMeta(db, sessionId, {
@@ -21044,7 +21066,7 @@ function createTransform(deps) {
21044
21066
  clearPersistedReasoningWatermark(db, sessionId);
21045
21067
  clearEmergencyDropSample(db, sessionId);
21046
21068
  if (preserveOutgoingOverflow) {
21047
- sessionLog2(sessionId, `transform: preserving detected limit ${outgoingOverflow.detectedContextLimit} and overflow recovery for outgoing model ${outgoingModelKey}`);
21069
+ sessionLog2(sessionId, `transform: preserving detected limit ${storedOverflow.detectedContextLimit} and overflow recovery for outgoing model ${outgoingModelKey}`);
21048
21070
  } else {
21049
21071
  clearDetectedContextLimit(db, sessionId);
21050
21072
  clearEmergencyRecovery(db, sessionId);
@@ -22334,10 +22356,12 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
22334
22356
  budgetMs: compartmentPhase.historianJoinBudgetMs,
22335
22357
  finalWireEstimate,
22336
22358
  contextLimitTokens: boundaryContextLimit,
22337
- lastHistorianError: getHistorianFailureState(db, sessionId).lastError
22359
+ joinedRun: compartmentPhase.historianJoinedRun,
22360
+ failures: readHistorianFailureStreak(db, sessionId),
22361
+ usagePercentage: contextUsage.percentage
22338
22362
  }) : null;
22339
22363
  if (timedOutHistorianFailure) {
22340
- sessionLog2(sessionId, `transform: ${timedOutHistorianFailure}; finalEstimate=${finalWireEstimate?.tokens ?? "unavailable"} estimateTrusted=${finalWireEstimate?.trusted ?? false} contextLimit=${boundaryContextLimit} emergencyReclaimed=${postTransformResult.emergencyReclaimedTokens}`);
22364
+ sessionLog2(sessionId, `transform: historian join refusal: ${timedOutHistorianFailure}; finalEstimate=${finalWireEstimate?.tokens ?? "unavailable"} estimateTrusted=${finalWireEstimate?.trusted ?? false} contextLimit=${boundaryContextLimit} emergencyReclaimed=${postTransformResult.emergencyReclaimedTokens}`);
22341
22365
  keepRecoveryArmed();
22342
22366
  throw new EmergencyFailClosedError(timedOutHistorianFailure);
22343
22367
  }
@@ -26049,7 +26073,7 @@ function registerRpcHandlers(rpcServer, args) {
26049
26073
  const db = readDatabase();
26050
26074
  if (!db)
26051
26075
  return { ok: false, error: "db unavailable" };
26052
- const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-cdkfynz4.js"));
26076
+ const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-1de5c0zr.js"));
26053
26077
  const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-95p89k7q.js"));
26054
26078
  log2(`[rpc] recomp requested for session ${sessionId}`);
26055
26079
  if (!args.client && !args.hiddenCompletionExecutor) {
@@ -26134,7 +26158,7 @@ function registerRpcHandlers(rpcServer, args) {
26134
26158
  const db = readDatabase();
26135
26159
  if (!db)
26136
26160
  return { ok: false, error: "db unavailable" };
26137
- const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-xnqq81c4.js"));
26161
+ const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-3871zj7c.js"));
26138
26162
  const model = liveSessionState.liveModelBySession.get(sessionId);
26139
26163
  const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
26140
26164
  const ctx = {
@@ -30072,7 +30096,104 @@ function errorText(value) {
30072
30096
  }
30073
30097
  }
30074
30098
 
30099
+ // src/v2/hidden-child-sweep.ts
30100
+ var PREFIX = "hidden_child:";
30101
+ var HIDDEN_CHILD_MAX_AGE_MS = 60 * 60 * 1000;
30102
+ var HIDDEN_CHILD_SWEEP_INTERVAL_MS = 30 * 60 * 1000;
30103
+ var HIDDEN_CHILD_DEADLINE_GRACE_MS = 10 * 60 * 1000;
30104
+ var SWEEP_REMOVAL_LIMIT = 50;
30105
+ var SWEEP_BUDGET_MS = 30000;
30106
+ function recordHiddenChild(db, child) {
30107
+ db.prepare("INSERT INTO schema_migrations_meta (key, value) VALUES (?, ?)").run(`${PREFIX}${child.id}`, JSON.stringify(child));
30108
+ }
30109
+ function forgetHiddenChild(db, id) {
30110
+ db.prepare("DELETE FROM schema_migrations_meta WHERE key = ?").run(`${PREFIX}${id}`);
30111
+ }
30112
+ function extendHiddenChildDeadline(db, id, deadlineAt) {
30113
+ db.prepare(`UPDATE schema_migrations_meta
30114
+ SET value = json_set(value, '$.deadline_at', MAX(COALESCE(json_extract(value, '$.deadline_at'), 0), ?))
30115
+ WHERE key = ?`).run(deadlineAt, `${PREFIX}${id}`);
30116
+ }
30117
+ function markHiddenChildRemovalFailed(db, id, failedAt) {
30118
+ db.prepare("UPDATE schema_migrations_meta SET value = json_set(value, '$.failed_at', ?) WHERE key = ?").run(failedAt, `${PREFIX}${id}`);
30119
+ }
30120
+ function createHiddenChildSweeper(remove, log, options = {}) {
30121
+ let stopped = false;
30122
+ let running;
30123
+ return {
30124
+ start(db) {
30125
+ if (stopped || running)
30126
+ return;
30127
+ running = sweepHiddenChildren(db, remove, log, {
30128
+ ...options,
30129
+ shouldStop: () => stopped || options.shouldStop?.() === true
30130
+ }).catch((error) => log("[magic-context] hidden-child sweep failed", error)).finally(() => {
30131
+ running = undefined;
30132
+ });
30133
+ },
30134
+ async dispose() {
30135
+ stopped = true;
30136
+ await running;
30137
+ }
30138
+ };
30139
+ }
30140
+ async function sweepHiddenChildren(db, remove, note, options = {}) {
30141
+ const now = options.now ?? Date.now();
30142
+ const clock = options.clock ?? (() => performance.now());
30143
+ const passDeadline = clock() + (options.budgetMs ?? SWEEP_BUDGET_MS);
30144
+ let remaining = options.limit ?? SWEEP_REMOVAL_LIMIT;
30145
+ const rows = db.prepare(`SELECT key, value FROM (
30146
+ SELECT key, value,
30147
+ CASE WHEN json_valid(value) THEN json_extract(value, '$.failed_at') END AS failed_at,
30148
+ CASE WHEN json_valid(value) THEN json_extract(value, '$.created_at') END AS created_at
30149
+ FROM schema_migrations_meta WHERE key GLOB ?
30150
+ )
30151
+ ORDER BY failed_at IS NOT NULL, COALESCE(failed_at, created_at), created_at, key`).all(`${PREFIX}*`);
30152
+ for (const row of rows) {
30153
+ if (remaining <= 0 || clock() >= passDeadline || options.shouldStop?.())
30154
+ break;
30155
+ let timer;
30156
+ try {
30157
+ const child = JSON.parse(row.value);
30158
+ if (!child || typeof child.id !== "string" || row.key !== `${PREFIX}${child.id}` || typeof child.directory !== "string" || !Number.isFinite(child.created_at) || child.deadline_at !== undefined && !Number.isFinite(child.deadline_at))
30159
+ throw new Error(`invalid cleanup record ${row.key}`);
30160
+ const expiresAt = Math.max(child.created_at + (options.maxAgeMs ?? HIDDEN_CHILD_MAX_AGE_MS), child.deadline_at === undefined ? 0 : child.deadline_at + HIDDEN_CHILD_DEADLINE_GRACE_MS);
30161
+ if (now <= expiresAt || options.isLive?.(child.id))
30162
+ continue;
30163
+ remaining--;
30164
+ try {
30165
+ await Promise.race([
30166
+ remove({ sessionID: child.id }),
30167
+ new Promise((_, reject) => {
30168
+ timer = setTimeout(() => reject(new Error("session.remove timed out")), Math.min(options.removalTimeoutMs ?? 5000, Math.max(1, passDeadline - clock())));
30169
+ })
30170
+ ]);
30171
+ } catch (error) {
30172
+ if (!isSessionNotFound(error)) {
30173
+ try {
30174
+ markHiddenChildRemovalFailed(db, child.id, now);
30175
+ } catch (markError) {
30176
+ note(`[magic-context] hidden-child sweep could not mark ${row.key} failed: ${String(markError)}`);
30177
+ }
30178
+ throw error;
30179
+ }
30180
+ }
30181
+ forgetHiddenChild(db, child.id);
30182
+ note(`[magic-context] stale hidden child ${child.id} removed`);
30183
+ } catch (error) {
30184
+ note(`[magic-context] hidden-child sweep deferred ${row.key}: ${String(error)}`);
30185
+ } finally {
30186
+ if (timer)
30187
+ clearTimeout(timer);
30188
+ }
30189
+ }
30190
+ }
30191
+
30075
30192
  // src/v2/hidden-child-native.ts
30193
+ var liveChildren = new Set;
30194
+ function isLiveHiddenChild(id) {
30195
+ return liveChildren.has(id);
30196
+ }
30076
30197
  function nativeSessionRemove(session) {
30077
30198
  const remove = session.remove;
30078
30199
  if (typeof remove !== "function")
@@ -30088,7 +30209,6 @@ function isSessionNotFound(error) {
30088
30209
  const label = [fields.name, fields._tag, fields.message].filter((value) => typeof value === "string").join(" ");
30089
30210
  return /not\s*found/i.test(label);
30090
30211
  }
30091
- var parentDroppedNoted = false;
30092
30212
  function createNativeHiddenChildren(host, removeSession, options) {
30093
30213
  const removing = new Map;
30094
30214
  const remove = (child) => {
@@ -30110,68 +30230,74 @@ function createNativeHiddenChildren(host, removeSession, options) {
30110
30230
  if (timer)
30111
30231
  clearTimeout(timer);
30112
30232
  }
30233
+ forgetHiddenChild(options.db, child.id);
30113
30234
  options.log(`[magic-context] hidden child ${child.id} removed`);
30114
30235
  } catch (error) {
30115
- if (isSessionNotFound(error))
30236
+ if (isSessionNotFound(error)) {
30237
+ try {
30238
+ forgetHiddenChild(options.db, child.id);
30239
+ } catch (storeError) {
30240
+ options.log(`[magic-context] hidden child ${child.id} record cleanup deferred: ${errorText(storeError)}`);
30241
+ }
30116
30242
  return;
30117
- options.log(`[magic-context] hidden child ${child.id} could not be removed; it goes when its parent session is deleted: ${errorText(error)}`);
30243
+ }
30244
+ options.log(`[magic-context] hidden child ${child.id} could not be removed: ${errorText(error)}`);
30118
30245
  }
30119
30246
  })().finally(() => {
30120
30247
  removing.delete(child.id);
30248
+ liveChildren.delete(child.id);
30121
30249
  });
30122
30250
  removing.set(child.id, done);
30123
30251
  return done;
30124
30252
  };
30125
- const noteCreated = (sessionID, role, parentID) => {
30126
- options.log(`[magic-context] hidden child ${sessionID} created role=${role} parent=${parentID} keep_subagents=${options.keepSubagents}`);
30127
- };
30128
- const confirmPlacement = async (sessionID, parentID, role) => {
30129
- let stored;
30130
- try {
30131
- stored = await host.get({ sessionID });
30132
- } catch (error) {
30133
- noteCreated(sessionID, role, "unknown");
30134
- options.log(`[magic-context] could not read back hidden child ${sessionID} to confirm its parent: ${errorText(error)}`);
30135
- return;
30136
- }
30137
- noteCreated(sessionID, role, stored.parentID ?? "none");
30138
- const directory = stored.location?.directory;
30139
- if (options.directory !== undefined && directory !== undefined && !sameProjectDirectory(directory, options.directory)) {
30140
- throw new HiddenCompletionRefusal("hidden_prompt_unrecognized", `hidden child ${sessionID} is bound to ${directory}, not to this instance's ${options.directory}. Reopen the parent session in ${directory}, then run /ctx-recomp so its owning instance can rebuild history.`, true);
30141
- }
30142
- if (stored.parentID === parentID || parentDroppedNoted)
30143
- return;
30144
- parentDroppedNoted = true;
30145
- options.log(`[magic-context] this OpenCode 2 host does not keep the parent of hidden-run sessions (asked for ${parentID}, read back ${stored.parentID ?? "none"}); they are created as separate sessions and still removed when each run ends`);
30146
- };
30147
30253
  const create = async (identity, role, model) => {
30148
- const parentID = identity.parentSessionId;
30149
30254
  const input = childCreateInput(identity, role, model);
30150
- const { location, ...parented } = input;
30151
- const created = await host.create(parentID ? { ...parented, parentID } : { ...parented, location });
30255
+ const created = await host.create(input);
30152
30256
  if (!created.id)
30153
30257
  throw new Error("OpenCode 2 did not return a child session id");
30258
+ const createdAt = Date.now();
30259
+ liveChildren.add(created.id);
30260
+ if (!options.keepSubagents) {
30261
+ try {
30262
+ recordHiddenChild(options.db, {
30263
+ id: created.id,
30264
+ directory: identity.directory,
30265
+ created_at: createdAt,
30266
+ deadline_at: createdAt + identity.timeoutMs
30267
+ });
30268
+ } catch (storeError) {
30269
+ let removed = false;
30270
+ let timer;
30271
+ try {
30272
+ await Promise.race([
30273
+ removeSession({ sessionID: created.id }),
30274
+ new Promise((_, reject) => {
30275
+ timer = setTimeout(() => reject(new Error("session.remove timed out")), options.removalTimeoutMs ?? 5000);
30276
+ })
30277
+ ]);
30278
+ removed = true;
30279
+ } catch (error) {
30280
+ removed = isSessionNotFound(error);
30281
+ } finally {
30282
+ if (timer)
30283
+ clearTimeout(timer);
30284
+ liveChildren.delete(created.id);
30285
+ }
30286
+ options.log(`[magic-context] hidden child ${created.id} record failed; removed=${removed}: ${errorText(storeError)}`);
30287
+ throw storeError;
30288
+ }
30289
+ }
30154
30290
  options.hook.registerChild(created.id, input.agent);
30155
- const child = {
30291
+ options.log(`[magic-context] hidden child ${created.id} created role=${role} keep_subagents=${options.keepSubagents}`);
30292
+ return {
30156
30293
  id: created.id,
30157
30294
  role,
30158
30295
  generation: options.generation,
30159
30296
  title: roleTitle(role),
30160
30297
  model,
30161
- created_at: Date.now(),
30298
+ created_at: createdAt,
30162
30299
  directory: identity.directory
30163
30300
  };
30164
- if (parentID) {
30165
- try {
30166
- await confirmPlacement(created.id, parentID, role);
30167
- } catch (error) {
30168
- await remove(child);
30169
- throw error;
30170
- }
30171
- } else {
30172
- noteCreated(created.id, role, "none");
30173
- }
30174
- return child;
30175
30301
  };
30176
30302
  const kept = (child) => keptUnderRetention(options.keepSubagents, child);
30177
30303
  return {
@@ -30179,6 +30305,7 @@ function createNativeHiddenChildren(host, removeSession, options) {
30179
30305
  create,
30180
30306
  retire(child) {
30181
30307
  if (kept(child)) {
30308
+ liveChildren.delete(child.id);
30182
30309
  options.log(`[magic-context] hidden child ${child.id} kept (keep_subagents)`);
30183
30310
  } else {
30184
30311
  remove(child);
@@ -30190,23 +30317,33 @@ function createNativeHiddenChildren(host, removeSession, options) {
30190
30317
  return;
30191
30318
  }
30192
30319
  if (kept(child)) {
30320
+ liveChildren.delete(child.id);
30193
30321
  options.log(`[magic-context] hidden child ${child.id} kept (keep_subagents)`);
30194
30322
  } else {
30195
30323
  await remove(child);
30196
30324
  }
30197
30325
  },
30326
+ extendDeadline(child, deadlineAt) {
30327
+ if (options.keepSubagents)
30328
+ return;
30329
+ try {
30330
+ extendHiddenChildDeadline(options.db, child.id, deadlineAt);
30331
+ } catch (error) {
30332
+ options.log(`[magic-context] hidden child ${child.id} deadline update deferred: ${errorText(error)}`);
30333
+ }
30334
+ },
30198
30335
  updateModel: (child, model) => ({ ...child, model }),
30199
30336
  markEverSettled: (child) => ({ ...child, ever_settled: true })
30200
30337
  };
30201
30338
  }
30202
30339
 
30203
30340
  // src/v2/hidden-child-cleanup.ts
30204
- var PREFIX = "opencode2_hidden_children:";
30341
+ var PREFIX2 = "opencode2_hidden_children:";
30205
30342
  var COMPLETE = "opencode2_hidden_children_cleanup_complete";
30206
30343
  async function cleanupLegacyHiddenChildren(db, remove, note, options = {}) {
30207
30344
  if (db.prepare("SELECT 1 FROM schema_migrations_meta WHERE key = ?").get(COMPLETE))
30208
30345
  return;
30209
- const rows = db.prepare("SELECT key, value FROM schema_migrations_meta WHERE key GLOB ? ORDER BY key LIMIT 25").all(`${PREFIX}*`);
30346
+ const rows = db.prepare("SELECT key, value FROM schema_migrations_meta WHERE key GLOB ? ORDER BY key LIMIT 25").all(`${PREFIX2}*`);
30210
30347
  let remaining = options.limit ?? 25;
30211
30348
  const now = options.now ?? (() => performance.now());
30212
30349
  const deadline = now() + (options.budgetMs ?? 2000);
@@ -30258,7 +30395,7 @@ async function cleanupLegacyHiddenChildren(db, remove, note, options = {}) {
30258
30395
  if (Object.keys(record.active ?? {}).length === 0 && (record.retired_children ?? []).length === 0)
30259
30396
  db.prepare("DELETE FROM schema_migrations_meta WHERE key = ?").run(row.key);
30260
30397
  }
30261
- if (!db.prepare("SELECT 1 FROM schema_migrations_meta WHERE key GLOB ? LIMIT 1").get(`${PREFIX}*`))
30398
+ if (!db.prepare("SELECT 1 FROM schema_migrations_meta WHERE key GLOB ? LIMIT 1").get(`${PREFIX2}*`))
30262
30399
  db.prepare("INSERT OR IGNORE INTO schema_migrations_meta (key, value) VALUES (?, 'true')").run(COMPLETE);
30263
30400
  }
30264
30401
 
@@ -30656,12 +30793,12 @@ async function createV2HiddenCompletionExecutor(host, options) {
30656
30793
  if (!removeSession)
30657
30794
  throw new Error("Magic Context requires OpenCode 2.0.22 session.remove");
30658
30795
  const lifecycle = createNativeHiddenChildren(host, (input) => removeSession.call(host, input), {
30796
+ db: options.db,
30659
30797
  hook: options.hook,
30660
30798
  generation,
30661
30799
  keepSubagents: options.keepSubagents === true,
30662
30800
  log: note,
30663
- removalTimeoutMs: options.removalTimeoutMs,
30664
- directory: options.directory
30801
+ removalTimeoutMs: options.removalTimeoutMs
30665
30802
  });
30666
30803
  const acquireRole = async (role) => {
30667
30804
  const previous = roleTails.get(role) ?? Promise.resolve();
@@ -30890,6 +31027,7 @@ async function createV2HiddenCompletionExecutor(host, options) {
30890
31027
  run.attempt = { child: attempt, baseline };
30891
31028
  options.hook.registerAttempt(marker, attempt);
30892
31029
  const deadline = Date.now() + run.identity.timeoutMs;
31030
+ lifecycle.extendDeadline(run.child, deadline);
30893
31031
  const budget = run.budget;
30894
31032
  if (budget?.snapshot().finalizeFired) {
30895
31033
  throw new DreamTokenBudgetExceeded(run.child.id, budget.snapshot().spent);
@@ -56236,17 +56374,26 @@ function persistV2UsageReading(args) {
56236
56374
  updateSessionMeta(db, sessionID, { lastResponseTime: responseTime });
56237
56375
  return;
56238
56376
  }
56239
- const percentage = reading.inputTokens / reading.limit * 100;
56377
+ let limit = reading.limit;
56378
+ const readingModel = reading.modelKey ?? draftModelKey;
56379
+ if (served && clearDisprovedDetectedLimit(db, sessionID, readingModel, reading.inputTokens)) {
56380
+ const slash = readingModel.indexOf("/");
56381
+ const relimit = slash > 0 ? args.limitFor?.(readingModel.slice(0, slash), readingModel.slice(slash + 1)) : undefined;
56382
+ if (typeof relimit === "number" && Number.isFinite(relimit) && relimit > 0) {
56383
+ limit = relimit;
56384
+ }
56385
+ }
56386
+ const percentage = reading.inputTokens / limit * 100;
56240
56387
  const updates = {
56241
56388
  lastContextPercentage: percentage,
56242
56389
  lastInputTokens: reading.inputTokens,
56243
- lastUsageContextLimit: reading.limit,
56390
+ lastUsageContextLimit: limit,
56244
56391
  lastObservedModelKey: reading.modelKey ?? draftModelKey
56245
56392
  };
56246
56393
  if (responseTime)
56247
56394
  updates.lastResponseTime = responseTime;
56248
56395
  updateSessionMeta(db, sessionID, updates);
56249
- sessionLog2(sessionID, `v2 usage: inputTokens=${reading.inputTokens} contextLimit=${reading.limit} percentage=${percentage} responseModel=${reading.modelKey ?? "legacy"} draftContextLimit=${reading.admissionLimit} pressure=${readingMatchesDraft ? "current" : "stale-model-ignored"}`);
56396
+ sessionLog2(sessionID, `v2 usage: inputTokens=${reading.inputTokens} contextLimit=${limit} percentage=${percentage} responseModel=${reading.modelKey ?? "legacy"} draftContextLimit=${reading.admissionLimit} pressure=${readingMatchesDraft ? "current" : "stale-model-ignored"}`);
56250
56397
  if (readingMatchesDraft) {
56251
56398
  args.contextUsageMap.set(sessionID, {
56252
56399
  usage: { inputTokens: reading.inputTokens, percentage },
@@ -56257,6 +56404,16 @@ function persistV2UsageReading(args) {
56257
56404
  args.contextUsageMap.delete(sessionID);
56258
56405
  }
56259
56406
  }
56407
+ function clearDisprovedDetectedLimit(db, sessionID, readingModel, inputTokens) {
56408
+ const stored = getOverflowState(db, sessionID);
56409
+ if (stored.detectedContextLimit <= 0 || inputTokens <= stored.detectedContextLimit || stored.detectedContextLimitModelKey !== null && stored.detectedContextLimitModelKey !== piModelRefToCanonical(readingModel))
56410
+ return false;
56411
+ clearDetectedContextLimit(db, sessionID);
56412
+ dropSlot(sessionID, "session-cache-invalidated");
56413
+ clearInjectionCache(sessionID);
56414
+ sessionLog2(sessionID, `v2 usage: detected limit ${stored.detectedContextLimit} invalidated by a successful ${inputTokens}-token request on ${readingModel}; using catalog/default`);
56415
+ return true;
56416
+ }
56260
56417
 
56261
56418
  // src/v2/hooks/context.ts
56262
56419
  class V2LkgAdmissionReplay extends Error {
@@ -56718,11 +56875,23 @@ async function registerContext(context) {
56718
56875
  let db = await probeV2StorageAtBoot(storage);
56719
56876
  const storageOpenedAtBoot = db !== undefined;
56720
56877
  let legacyCleanupStarted = false;
56878
+ const hiddenChildSweep = createHiddenChildSweeper(nativeRemove, log2, {
56879
+ isLive: isLiveHiddenChild
56880
+ });
56881
+ let hiddenChildSweepTimer;
56882
+ const sweepChildren = (database) => {
56883
+ hiddenChildSweep.start(database);
56884
+ };
56721
56885
  const cleanupLegacyOnce = async (database) => {
56722
56886
  if (legacyCleanupStarted)
56723
56887
  return;
56724
56888
  legacyCleanupStarted = true;
56725
56889
  await cleanupLegacyHiddenChildren(database, nativeRemove, log2);
56890
+ sweepChildren(database);
56891
+ hiddenChildSweepTimer = inRootAsyncContext2(() => setInterval(() => {
56892
+ sweepChildren(database);
56893
+ }, HIDDEN_CHILD_SWEEP_INTERVAL_MS));
56894
+ hiddenChildSweepTimer.unref?.();
56726
56895
  };
56727
56896
  if (db && isDatabasePersisted(db))
56728
56897
  await cleanupLegacyOnce(db);
@@ -57111,7 +57280,8 @@ async function registerContext(context) {
57111
57280
  sessionID: draft.sessionID,
57112
57281
  draftModel: draft.model,
57113
57282
  reading,
57114
- contextUsageMap: usage
57283
+ contextUsageMap: usage,
57284
+ limitFor
57115
57285
  });
57116
57286
  }
57117
57287
  } finally {
@@ -58331,6 +58501,9 @@ async function registerContext(context) {
58331
58501
  }, 0));
58332
58502
  return {
58333
58503
  async dispose() {
58504
+ if (hiddenChildSweepTimer)
58505
+ clearInterval(hiddenChildSweepTimer);
58506
+ await hiddenChildSweep.dispose();
58334
58507
  messageTimesCache.clear();
58335
58508
  hostFoldIdle?.dispose();
58336
58509
  usageController.abort();
@@ -1,13 +1,18 @@
1
+ import type { Database } from "../shared/sqlite";
1
2
  import { type HiddenChildHost, type HiddenChildLifecycle } from "./hidden-child-record";
2
3
  import type { HiddenChildHook } from "./hooks/hidden-child";
3
4
  /**
4
5
  * The hidden-child lifecycle for OpenCode 2 hosts whose plugin session API has `session.remove`.
5
- * Every run gets a fresh child created under the user's session, and the child is removed when
6
- * the run ends, whether it succeeded or failed. Nothing is recorded in context.db: a child whose
7
- * removal fails still goes when its parent session is deleted, because the host deletes a
8
- * session's children with it.
6
+ * Every run gets a fresh root child in the run's directory, and the child is removed when the run
7
+ * ends, whether it succeeded or failed. A context.db record survives failed removal or a crash
8
+ * so an age-gated sweep can retry without touching another instance's live run.
9
+ *
10
+ * The child is never given the user's session as its parent: OpenCode 2.3 reports every idle of a
11
+ * parented session to its parent and wakes the parent, so each historian or dreamer run would
12
+ * start a turn in the user's session.
9
13
  */
10
14
  type RemoveSession = NonNullable<HiddenChildHost["removeSession"]>;
15
+ export declare function isLiveHiddenChild(id: string): boolean;
11
16
  /**
12
17
  * The feature gate for this lifecycle: the host's own `session.remove`, bound to its session API,
13
18
  * or undefined on hosts that do not expose one to plugins. Hosts are told apart by what they
@@ -16,21 +21,13 @@ type RemoveSession = NonNullable<HiddenChildHost["removeSession"]>;
16
21
  export declare function nativeSessionRemove(session: object): RemoveSession | undefined;
17
22
  /** True when the host reports that the session is already gone. */
18
23
  export declare function isSessionNotFound(error: unknown): boolean;
19
- /** Clears the once-per-process notice, for tests. */
20
- export declare function __resetParentDroppedNotice(): void;
21
24
  export declare function createNativeHiddenChildren(host: HiddenChildHost, removeSession: RemoveSession, options: {
25
+ db: Database;
22
26
  hook: HiddenChildHook;
23
27
  generation: string;
24
28
  keepSubagents: boolean;
25
29
  log: (message: string) => void;
26
30
  removalTimeoutMs?: number;
27
- /**
28
- * The directory of the plugin instance that owns this lifecycle. OpenCode 2
29
- * runs a session's hooks in the instance of the session's own location,
30
- * and a child takes its parent's location, so a child bound to any other
31
- * directory would be shaped (and guarded) by a different instance.
32
- */
33
- directory?: string;
34
31
  }): HiddenChildLifecycle;
35
32
  export {};
36
33
  //# sourceMappingURL=hidden-child-native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hidden-child-native.d.ts","sourceRoot":"","sources":["../../src/v2/hidden-child-native.ts"],"names":[],"mappings":"AAKA,OAAO,EAGH,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAM5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;GAMG;AAEH,KAAK,aAAa,GAAG,WAAW,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC;AAEnE;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAI9E;AAED,mEAAmE;AACnE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQzD;AAMD,qDAAqD;AACrD,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED,wBAAgB,0BAA0B,CACtC,IAAI,EAAE,eAAe,EACrB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE;IACL,IAAI,EAAE,eAAe,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,GACF,oBAAoB,CAwJtB"}
1
+ {"version":3,"file":"hidden-child-native.d.ts","sourceRoot":"","sources":["../../src/v2/hidden-child-native.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAGH,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAM5B,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;;GASG;AAEH,KAAK,aAAa,GAAG,WAAW,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC;AAInE,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAI9E;AAED,mEAAmE;AACnE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQzD;AAED,wBAAgB,0BAA0B,CACtC,IAAI,EAAE,eAAe,EACrB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE;IACL,EAAE,EAAE,QAAQ,CAAC;IACb,IAAI,EAAE,eAAe,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B,GACF,oBAAoB,CAoJtB"}
@@ -124,6 +124,8 @@ export interface HiddenChildLifecycle {
124
124
  * Resolves once any cleanup this lifecycle does for a finished run is over; never rejects.
125
125
  */
126
126
  finish(child: PersistedHiddenChild, retired: boolean): Promise<void>;
127
+ /** A retry can outlive the original timeout; never shorten its durable sweep protection. */
128
+ extendDeadline(child: PersistedHiddenChild, deadlineAt: number): void;
127
129
  updateModel(child: PersistedHiddenChild, model: HiddenChildModel): PersistedHiddenChild;
128
130
  markEverSettled(child: PersistedHiddenChild): PersistedHiddenChild;
129
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hidden-child-record.d.ts","sourceRoot":"","sources":["../../src/v2/hidden-child-record.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAIH,KAAK,oBAAoB,EAI5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,8EAA8E;AAE9E,MAAM,WAAW,gBAAgB;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAEzE,MAAM,WAAW,oBAAoB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,eAAe,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,gBAAgB,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,gGAAgG;IAChG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,sFAAsF;AACtF,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC;AAEjF,MAAM,WAAW,eAAe;IAC5B,MAAM,CAAC,KAAK,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MA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