@cortexkit/opencode-magic-context 0.49.14 → 0.49.16

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 (135) hide show
  1. package/dist/auto-search-worker.js +3 -3
  2. package/dist/chunk-embedding-write-worker.js +5 -3
  3. package/dist/config/schema/magic-context.d.ts +65 -65
  4. package/dist/config/schema/magic-context.d.ts.map +1 -1
  5. package/dist/{conflict-warning-hook-mgq17yr3.js → conflict-warning-hook-znry4j76.js} +5 -5
  6. package/dist/{context-cpxqpkzv.js → context-3znk23va.js} +128 -24
  7. package/dist/{embedding-backfill-5e1t5wha.js → embedding-backfill-q4n8dend.js} +8 -6
  8. package/dist/embedding-worker.js +2 -2
  9. package/dist/features/magic-context/dreamer/verify.d.ts +22 -3
  10. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  11. package/dist/features/magic-context/message-fts-rowid-map.d.ts +2 -2
  12. package/dist/features/magic-context/message-fts-rowid-map.d.ts.map +1 -1
  13. package/dist/features/magic-context/message-fts-session-filter.d.ts +2 -0
  14. package/dist/features/magic-context/message-fts-session-filter.d.ts.map +1 -1
  15. package/dist/features/magic-context/message-time-backfill.d.ts +2 -2
  16. package/dist/features/magic-context/message-time-backfill.d.ts.map +1 -1
  17. package/dist/features/magic-context/storage-db.d.ts +2 -1
  18. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  19. package/dist/hooks/magic-context/compartment-runner-historian.d.ts +2 -2
  20. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  21. package/dist/hooks/magic-context/compartment-runner-types.d.ts +2 -2
  22. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  23. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  24. package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
  25. package/dist/hooks/magic-context/historian-host-runner.d.ts.map +1 -1
  26. package/dist/hooks/magic-context/historian-prompt-fit.d.ts +2 -1
  27. package/dist/hooks/magic-context/historian-prompt-fit.d.ts.map +1 -1
  28. package/dist/hooks/magic-context/historian-prompt.generated.d.ts +1 -1
  29. package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -1
  30. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +26 -0
  31. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/recomp-orchestrator.d.ts +3 -3
  33. package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
  34. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  36. package/dist/{index-xn6q9pg6.js → index-4qfy7v57.js} +11 -62
  37. package/dist/{index-e4dsjj1p.js → index-5mwk1nek.js} +1 -1
  38. package/dist/index-6a6dq53h.js +96 -0
  39. package/dist/{index-e20m7284.js → index-7b2cfmaz.js} +1 -1
  40. package/dist/{index-mmfa86mt.js → index-7pa32z07.js} +169 -149
  41. package/dist/{index-3kdm78zp.js → index-9nkg2dzk.js} +3 -3
  42. package/dist/{index-t4q9zbbf.js → index-ayym1x7f.js} +119 -30
  43. package/dist/{index-dgs16axy.js → index-b17m64g9.js} +1 -1
  44. package/dist/{index-yxycg7fs.js → index-cj9g0j7a.js} +22 -14
  45. package/dist/{index-dyvbsvga.js → index-dqe8pq4x.js} +21 -10
  46. package/dist/{index-5591fg8y.js → index-ek1yxvvz.js} +44 -77
  47. package/dist/{index-3kx0kg0f.js → index-hehkf6zm.js} +3 -3
  48. package/dist/{index-944w16m0.js → index-j6zw70pf.js} +4 -4
  49. package/dist/index-kaqs6h31.js +58 -0
  50. package/dist/{index-w900fbhd.js → index-kn4t1haw.js} +15 -12
  51. package/dist/{index-1d289pq2.js → index-mtw9e71a.js} +1 -1
  52. package/dist/{index-mht7bq0z.js → index-nd7m2a5a.js} +7 -5
  53. package/dist/{index-thvnpfsv.js → index-p4vde22c.js} +14 -14
  54. package/dist/{index-y1qysm3q.js → index-qrahzcqv.js} +3 -3
  55. package/dist/{index-kf4epshg.js → index-v63beg1z.js} +3 -3
  56. package/dist/{index-tyckte5c.js → index-v9asb16b.js} +4 -4
  57. package/dist/{index-1sarmj9z.js → index-wgypt3cs.js} +6 -6
  58. package/dist/{index-bxdg2nbt.js → index-wv9n2zcq.js} +1 -1
  59. package/dist/index.js +38 -36
  60. package/dist/message-fts-rowid-map-yvx5a9jw.js +23 -0
  61. package/dist/{message-index-bounded-vtgpq6b4.js → message-index-bounded-6th8djy9.js} +8 -8
  62. package/dist/{message-index-a6gztaqx.js → message-index-t4pz7akd.js} +9 -9
  63. package/dist/{message-time-backfill-qjge9044.js → message-time-backfill-8egzkd3z.js} +4 -4
  64. package/dist/migration-worker.js +4 -2
  65. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  66. package/dist/{project-embedding-registry-x45bv3qr.js → project-embedding-registry-2dea0a77.js} +7 -5
  67. package/dist/raw-ordinal-warmup-worker.js +37 -7
  68. package/dist/{read-session-chunk-3ae3nfdn.js → read-session-chunk-4pwqxm5a.js} +6 -6
  69. package/dist/{read-session-raw-m56hc7v2.js → read-session-raw-5ar8se5v.js} +1 -1
  70. package/dist/{recomp-orchestrator-xqb9gwgm.js → recomp-orchestrator-tjcaj5x7.js} +17 -17
  71. package/dist/search-archive-02jws7hw.js +25 -0
  72. package/dist/{search-deajrd90.js → search-rb01n29x.js} +15 -14
  73. package/dist/{send-session-notification-24r4esbh.js → send-session-notification-2x9edkrp.js} +4 -4
  74. package/dist/shared/model-suggestion-retry.d.ts +2 -0
  75. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  76. package/dist/shared/resolve-fallbacks.d.ts +3 -3
  77. package/dist/{storage-tags-s5bg1ahx.js → storage-tags-4z1w27xa.js} +1 -1
  78. package/dist/tools/ctx-expand/search-archive.d.ts +5 -1
  79. package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
  80. package/dist/{transform-postprocess-phase-k5t63qm5.js → transform-postprocess-phase-xaw5c3xp.js} +17 -17
  81. package/dist/v2/auto-search-worker.js +3 -3
  82. package/dist/v2/chunk-embedding-write-worker.js +8 -6
  83. package/dist/v2/{context-k4jrq71s.js → context-acw1nhv8.js} +164 -91
  84. package/dist/v2/{embedding-backfill-jmaf8zrr.js → embedding-backfill-jyd6492b.js} +10 -8
  85. package/dist/v2/embedding-worker.js +2 -2
  86. package/dist/v2/hidden-completion.d.ts +20 -1
  87. package/dist/v2/hidden-completion.d.ts.map +1 -1
  88. package/dist/v2/hooks/context.d.ts.map +1 -1
  89. package/dist/v2/hooks/hidden-child.d.ts +19 -0
  90. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  91. package/dist/v2/message-fts-rowid-map-8vf0v7cr.js +22 -0
  92. package/dist/v2/{message-index-bounded-rxxznd34.js → message-index-bounded-dsrf49y7.js} +7 -7
  93. package/dist/v2/{message-index-f947qtbz.js → message-index-e6qzw477.js} +8 -8
  94. package/dist/v2/{message-time-backfill-bsteyc4d.js → message-time-backfill-q5pgxf0d.js} +4 -4
  95. package/dist/v2/migration-worker.js +6 -4
  96. package/dist/v2/{project-embedding-registry-0msp56p8.js → project-embedding-registry-rek75aqw.js} +9 -7
  97. package/dist/v2/raw-ordinal-warmup-worker.js +37 -7
  98. package/dist/v2/{read-session-chunk-rq9nx1nn.js → read-session-chunk-7bpygfv2.js} +5 -5
  99. package/dist/v2/{read-session-raw-b3tf6ra1.js → read-session-raw-pw2n1qgc.js} +1 -1
  100. package/dist/v2/{recomp-orchestrator-1j1nqrrr.js → recomp-orchestrator-hzpgg06e.js} +18 -18
  101. package/dist/v2/search-archive-fn4wy8sx.js +24 -0
  102. package/dist/v2/{search-n8wqxb1j.js → search-sf2vg5pk.js} +17 -16
  103. package/dist/v2/{send-session-notification-8ghn9tnv.js → send-session-notification-hmr7q0nt.js} +2 -2
  104. package/dist/v2/{server-k2bzedxk.js → server-00hx04yn.js} +1 -1
  105. package/dist/v2/{server-atbc19ab.js → server-0mzjjw3s.js} +7 -5
  106. package/dist/v2/{server-ehyava47.js → server-1hcbw661.js} +3 -3
  107. package/dist/v2/{server-th4y11y7.js → server-271qxsf5.js} +6 -6
  108. package/dist/v2/{server-prg55b7k.js → server-6714jebr.js} +22 -2
  109. package/dist/v2/{server-fnqxt9j6.js → server-6fyp0v67.js} +120 -31
  110. package/dist/v2/{server-yrvqaswb.js → server-785mb90s.js} +21 -10
  111. package/dist/v2/{server-ef89gdsx.js → server-aavz8pm6.js} +3 -3
  112. package/dist/v2/{server-gvkm8xaj.js → server-e3ftpk7v.js} +1 -1
  113. package/dist/v2/{server-e298hswg.js → server-g59aatsz.js} +14 -14
  114. package/dist/v2/{server-g10mdym6.js → server-gha9x4qq.js} +1 -1
  115. package/dist/v2/{server-4gn3z5an.js → server-hgg55hde.js} +1 -1
  116. package/dist/v2/server-kaqs6h31.js +58 -0
  117. package/dist/v2/{server-qhfvvfxj.js → server-kqpawe1a.js} +3 -3
  118. package/dist/v2/{server-hek6z3w6.js → server-kr2kc9dz.js} +5 -5
  119. package/dist/v2/{server-cfbr1s2x.js → server-n5q841qn.js} +12 -63
  120. package/dist/v2/{server-kmbarfmn.js → server-r9gjxcte.js} +24 -16
  121. package/dist/v2/{server-6cdy4rc0.js → server-vgpab6rd.js} +2 -2
  122. package/dist/v2/{server-zc3e54vy.js → server-y5pznjt9.js} +1 -1
  123. package/dist/v2/server-zyw55ygv.js +96 -0
  124. package/dist/v2/server.js +4 -4
  125. package/dist/v2/{storage-tags-hcc2adpf.js → storage-tags-hkwtbp3g.js} +1 -1
  126. package/dist/v2/store-reader.d.ts +27 -1
  127. package/dist/v2/store-reader.d.ts.map +1 -1
  128. package/dist/v2/{wrapup-orchestrator-hkv8apcc.js → wrapup-orchestrator-x4xj1782.js} +18 -18
  129. package/dist/{wrapup-orchestrator-kxqj4rwh.js → wrapup-orchestrator-vj2tbp22.js} +18 -18
  130. package/package.json +1 -1
  131. package/src/config/schema/magic-context.ts +14 -6
  132. package/src/shared/model-resolution.test.ts +22 -0
  133. package/src/shared/model-suggestion-retry.ts +9 -3
  134. package/src/shared/resolve-fallbacks.test.ts +2 -3
  135. package/src/shared/resolve-fallbacks.ts +3 -3
@@ -6,7 +6,7 @@ import {
6
6
  resolveLegacyConfigSources,
7
7
  getProtectedTokensTierOverrides,
8
8
  loadPluginConfigDetailed
9
- } from "./server-zc3e54vy.js";
9
+ } from "./server-y5pznjt9.js";
10
10
  import {
11
11
  getHarness2,
12
12
  harnessOwnsOpenCodeStore2
@@ -46,7 +46,7 @@ import {
46
46
  DEFAULT_HISTORIAN_TIMEOUT_MS,
47
47
  DEFAULT_LOCAL_EMBEDDING_MODEL,
48
48
  DREAM_TASK_PROMOTION_DEFAULTS
49
- } from "./server-th4y11y7.js";
49
+ } from "./server-271qxsf5.js";
50
50
  import {
51
51
  CANONICAL_DREAM_TASKS,
52
52
  DREAM_TASK_CAPABILITIES,
@@ -195,6 +195,8 @@ import {
195
195
  HIDDEN_CURATE_AGENT,
196
196
  hiddenAgentFor,
197
197
  hiddenToolLoop,
198
+ HIDDEN_RUN_DISPOSED_REASON,
199
+ noteChildOfDisposedInstance,
198
200
  hiddenChildPermissions,
199
201
  registerHiddenChildAgents,
200
202
  hiddenToolCallRefusal,
@@ -281,7 +283,7 @@ import {
281
283
  startCompartmentAgent,
282
284
  setRecompStarting2,
283
285
  setRecompTerminal2
284
- } from "./server-fnqxt9j6.js";
286
+ } from "./server-6fyp0v67.js";
285
287
  import {
286
288
  resolveHistorianModel2
287
289
  } from "./server-8cd2j99z.js";
@@ -306,7 +308,7 @@ import {
306
308
  openDatabaseAsync,
307
309
  isDatabasePersisted,
308
310
  getDatabasePersistenceError
309
- } from "./server-kmbarfmn.js";
311
+ } from "./server-r9gjxcte.js";
310
312
  import {
311
313
  setHomeProjectPermission,
312
314
  shouldSkipHomeProjectMemory,
@@ -322,7 +324,7 @@ import {
322
324
  storedPathBelongsToIdentity,
323
325
  beginBootQuietPeriod,
324
326
  scheduleAfterBootQuiet
325
- } from "./server-gvkm8xaj.js";
327
+ } from "./server-e3ftpk7v.js";
326
328
  import {
327
329
  detectLatestTurnThinkingMismatch,
328
330
  isPrefixBoundThinkingModel,
@@ -510,7 +512,7 @@ import {
510
512
  readRawSessionMessageById2,
511
513
  readSessionChunk2,
512
514
  readRawSessionSeedTail2
513
- } from "./server-ehyava47.js";
515
+ } from "./server-1hcbw661.js";
514
516
  import {
515
517
  embedPauseBySession,
516
518
  embedRunStateBySession,
@@ -539,7 +541,7 @@ import {
539
541
  embedSessionCompartmentChunks2,
540
542
  getEmbeddingCoverageStatus2,
541
543
  getAutoEmbeddingSessionCoverage2
542
- } from "./server-hek6z3w6.js";
544
+ } from "./server-kr2kc9dz.js";
543
545
  import {
544
546
  textMentionsRecentCommit,
545
547
  hasMeaningfulUserText2,
@@ -573,10 +575,18 @@ import {
573
575
  SqliteAcquisitionBusyError2,
574
576
  withAsyncPrivilegedWriter2
575
577
  } from "./server-wafzvyhg.js";
576
- import"./server-yrvqaswb.js";
578
+ import"./server-51779zs2.js";
579
+ import {
580
+ isRawCompactionSummaryInfo2,
581
+ extractInMemoryMessageViews2,
582
+ buildInMemoryTailRawMessages2,
583
+ RawOrdinalsNotReady2,
584
+ runSessionWarmupWorker
585
+ } from "./server-6714jebr.js";
586
+ import"./server-785mb90s.js";
577
587
  import {
578
588
  deleteChunkEmbedBackoffForSession
579
- } from "./server-qhfvvfxj.js";
589
+ } from "./server-kqpawe1a.js";
580
590
  import {
581
591
  registerOwnRpcServerInstance,
582
592
  rpcPortDir,
@@ -602,7 +612,7 @@ import {
602
612
  isMessageIndexReconciledThrough2,
603
613
  indexMessagesAfterOrdinal2,
604
614
  sweepOrphanedOpenCodeMessageIndexes2
605
- } from "./server-e298hswg.js";
615
+ } from "./server-g59aatsz.js";
606
616
  import {
607
617
  stableStringify,
608
618
  getTemporalDecisions,
@@ -703,15 +713,7 @@ import {
703
713
  adoptNullOwnerToolTag2,
704
714
  getCandidateToolOwners2,
705
715
  pickNearestPriorOwner2
706
- } from "./server-atbc19ab.js";
707
- import"./server-51779zs2.js";
708
- import {
709
- isRawCompactionSummaryInfo2,
710
- extractInMemoryMessageViews2,
711
- buildInMemoryTailRawMessages2,
712
- RawOrdinalsNotReady2,
713
- runSessionWarmupWorker
714
- } from "./server-prg55b7k.js";
716
+ } from "./server-0mzjjw3s.js";
715
717
  import {
716
718
  resolveOpenCodeDbPath,
717
719
  assertOpenCodeStoreGeneration,
@@ -745,7 +747,7 @@ import {
745
747
  resolveStoredPathWorkspaceIdentity,
746
748
  storedPathBelongsToWorkspace,
747
749
  computeWorkspaceEpochFingerprint
748
- } from "./server-k2bzedxk.js";
750
+ } from "./server-00hx04yn.js";
749
751
  import {
750
752
  configureContextDatabasePragmas2
751
753
  } from "./server-fb3zxn06.js";
@@ -791,7 +793,7 @@ import {
791
793
  readGitFileChangeTimesSince,
792
794
  verificationFileExists,
793
795
  normalizeVerificationFiles
794
- } from "./server-6cdy4rc0.js";
796
+ } from "./server-vgpab6rd.js";
795
797
  import {
796
798
  deriveTriggerBudget2,
797
799
  deriveHistorianChunkTokens2,
@@ -812,7 +814,7 @@ import {
812
814
  releaseGitSweepLease,
813
815
  recordSessionProjectIdentity,
814
816
  hasRecordedSessionProjectIdentity
815
- } from "./server-4gn3z5an.js";
817
+ } from "./server-hgg55hde.js";
816
818
  import {
817
819
  saveEmbeddingIfHashMatches,
818
820
  invalidateProject2,
@@ -820,10 +822,10 @@ import {
820
822
  } from "./server-4dhv7mqz.js";
821
823
  import {
822
824
  getLocalEmbeddingNativeMemoryStats
823
- } from "./server-g10mdym6.js";
825
+ } from "./server-gha9x4qq.js";
824
826
  import {
825
827
  cosineSimilarity
826
- } from "./server-ef89gdsx.js";
828
+ } from "./server-aavz8pm6.js";
827
829
  import {
828
830
  computeCueContentHash,
829
831
  hasMuralCueColumns,
@@ -875,16 +877,19 @@ import {
875
877
  SubcModuleTransport,
876
878
  indexCommitsForProject,
877
879
  embedUnembeddedCommits,
878
- withMessageFtsSessionFilter,
879
880
  createUnifiedSearchDiagnostics2,
880
881
  parseIdShapedQuery2,
881
882
  resolveMemoriesByIdsForSearch2,
882
883
  unifiedSearch2,
883
884
  formatSearchResults2
884
- } from "./server-cfbr1s2x.js";
885
+ } from "./server-n5q841qn.js";
885
886
  import {
886
887
  resolvePromptContext2
887
888
  } from "./server-fmsr7v69.js";
889
+ import"./server-kaqs6h31.js";
890
+ import {
891
+ renderSearchArchiveOffThread2
892
+ } from "./server-zyw55ygv.js";
888
893
  import {
889
894
  compareSemverCore
890
895
  } from "./server-84w6rvvf.js";
@@ -9779,6 +9784,9 @@ async function runPostTransformPhase(args) {
9779
9784
  rewritingSignedPrefix = true;
9780
9785
  thinkingReleasedForFit ||= forFit;
9781
9786
  };
9787
+ if (activeThinkingPrefixHold && args.forceSignedRebuildForFit) {
9788
+ releaseThinkingForRewrite(true);
9789
+ }
9782
9790
  const foldDueDecision = m0M1EnabledForFold && args.m0M1 && !freezeM0M1 ? mustMaterialize({
9783
9791
  db: args.db,
9784
9792
  sessionId: args.sessionId,
@@ -9923,7 +9931,7 @@ async function runPostTransformPhase(args) {
9923
9931
  const idleExpiryRebuild = (!freezeM0M1 || activeThinkingPrefixHold) && args.m0M1?.hardSignals?.cacheExpired === true;
9924
9932
  const rideSignals = {
9925
9933
  subagentExecute: !args.fullFeatureMode && args.schedulerDecision === "execute",
9926
- hardFold: foldBustsServedPrefixThisPass || firstRenderBust || idleExpiryRebuild,
9934
+ hardFold: rewritingSignedPrefix || foldBustsServedPrefixThisPass || firstRenderBust || idleExpiryRebuild,
9927
9935
  force: emergencyDropEligible && (args.contextUsage.percentage >= 95 || getEmergencyInputSample(args.db, args.sessionId) === 0),
9928
9936
  explicitFlush: isExplicitFlush && hasPendingMaterializationOrigin(args.pendingMaterializationSessions, args.sessionId, "user_flush"),
9929
9937
  publishedHistory: !prefixPreflightFailed && (publishedM1RefreshedThisPass || !m0M1EnabledForFold && (args.pendingCompartmentInjection?.compartmentCount ?? 0) > 0 && legacyPublishedHeadChanged(args))
@@ -12283,6 +12291,7 @@ class HistorianHostRunner {
12283
12291
  timeoutMs: attemptMs,
12284
12292
  signal,
12285
12293
  fallbackModels: rest.map(withVariant),
12294
+ allowModelSuggestions: false,
12286
12295
  callContext: `historian-host:${claim.runId}`,
12287
12296
  fetchOutput: () => withinAttempt(executor.collect(handle, 50), attemptStartedAt + attemptMs - Date.now(), attemptMs, signal).catch((error) => {
12288
12297
  recordAttempt(undefined, error);
@@ -18124,6 +18133,7 @@ function resolveTransformHostSeams(deps) {
18124
18133
  hostRefuse: deps.hostRefuse ?? abortSessionFailClosed
18125
18134
  };
18126
18135
  }
18136
+ var SIGNED_FIT_REFUSED_MARKER = "signed_fit:refused:v1";
18127
18137
  function createTransform(deps) {
18128
18138
  registerSystemDateRefresh(deps.historyRefreshSessions);
18129
18139
  const finalWireUsage = createFinalWireUsageTracker();
@@ -19045,7 +19055,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
19045
19055
  const protectedTagIds = protectedTagNumbers;
19046
19056
  const protectedCutoff = protectionWindow.cutoff;
19047
19057
  const tPostProcess = performance.now();
19048
- dropProjectionEmergency = thinkingFitRetries.has(sessionId) || contextUsage.percentage >= 95;
19058
+ dropProjectionEmergency = contextUsage.percentage >= 95;
19049
19059
  const postTransformResult = await runPostTransformPhase({
19050
19060
  opencode2: deps.storeGeneration === "v2",
19051
19061
  normalizeRecoveryTail,
@@ -19064,7 +19074,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
19064
19074
  client: deps.client,
19065
19075
  activeAgent,
19066
19076
  batch,
19067
- contextUsage: thinkingFitRetries.has(sessionId) ? { ...contextUsage, percentage: Math.max(95, contextUsage.percentage) } : contextUsage,
19077
+ contextUsage,
19068
19078
  usableWindow: resolvedContextLimit ?? 0,
19069
19079
  schedulerDecision,
19070
19080
  schedulerDeferReason,
@@ -19149,6 +19159,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
19149
19159
  postTransformResult.bustedThisPass = true;
19150
19160
  passOutcome.markFinalized();
19151
19161
  const finalWireTail = describeFinalWireTail(messages);
19162
+ const signedFitPreviouslyRefused = !compactionOff && getMergedReasoningStrippedIds(db, sessionId).has(SIGNED_FIT_REFUSED_MARKER);
19152
19163
  let finalWireEstimate;
19153
19164
  if (postTransformResult.bustedThisPass) {
19154
19165
  try {
@@ -19166,7 +19177,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
19166
19177
  }
19167
19178
  if (!compactionOff) {
19168
19179
  const emergencyUsagePercentage = usagePercentageSynthetic ? Math.max(95, contextUsage.percentage) : windowGeometry?.usableHard && contextUsage.inputTokens > 0 ? contextUsage.inputTokens / windowGeometry.usableHard * 100 : contextUsage.percentage;
19169
- finalWireEstimate = finalWireEstimate ?? (emergencyUsagePercentage >= 95 || schedulerDecision === "execute" ? finalWireUsage.estimate(sessionId, {
19180
+ finalWireEstimate = finalWireEstimate ?? (emergencyUsagePercentage >= 95 || schedulerDecision === "execute" || signedFitPreviouslyRefused ? finalWireUsage.estimate(sessionId, {
19170
19181
  messages,
19171
19182
  systemPromptTokens: sessionMeta.systemPromptTokens,
19172
19183
  providerID: modelForBudget?.providerID,
@@ -19189,8 +19200,11 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
19189
19200
  }
19190
19201
  return;
19191
19202
  }
19192
- if (thinkingFitRetries.has(sessionId) || postTransformResult.thinkingReleasedForFit)
19203
+ if (thinkingFitRetries.has(sessionId) || postTransformResult.thinkingReleasedForFit || signedFitPreviouslyRefused) {
19204
+ if (!signedFitPreviouslyRefused && !addMergedReasoningStrippedIds(db, sessionId, [SIGNED_FIT_REFUSED_MARKER]))
19205
+ throw contextRefusalError("Cannot persist the signed-fit refusal");
19193
19206
  throw contextRefusalError("The request remains over the model window after stripping signed thinking and reclaiming context");
19207
+ }
19194
19208
  }
19195
19209
  if (postTransformResult.prefixTrimStatus === "refused") {
19196
19210
  const untrimmed = finalWireEstimate ?? estimateFinalWireInputTokens({
@@ -22724,8 +22738,8 @@ function registerRpcHandlers(rpcServer, args) {
22724
22738
  const db = readDatabase();
22725
22739
  if (!db)
22726
22740
  return { ok: false, error: "db unavailable" };
22727
- const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-1j1nqrrr.js"));
22728
- const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-8ghn9tnv.js"));
22741
+ const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-hzpgg06e.js"));
22742
+ const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-hmr7q0nt.js"));
22729
22743
  log2(`[rpc] recomp requested for session ${sessionId}`);
22730
22744
  if (!args.client && !args.hiddenCompletionExecutor) {
22731
22745
  return {
@@ -22809,7 +22823,7 @@ function registerRpcHandlers(rpcServer, args) {
22809
22823
  const db = readDatabase();
22810
22824
  if (!db)
22811
22825
  return { ok: false, error: "db unavailable" };
22812
- const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-hkv8apcc.js"));
22826
+ const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-x4xj1782.js"));
22813
22827
  const model = liveSessionState.liveModelBySession.get(sessionId);
22814
22828
  const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
22815
22829
  const ctx = {
@@ -25613,6 +25627,25 @@ function subagentTemperature(model, metadata, temperature, log) {
25613
25627
  }
25614
25628
 
25615
25629
  // src/v2/hidden-completion.ts
25630
+ var DEFAULT_DISPOSE_DRAIN_MS = 2000;
25631
+ async function settleWithin(work, ms) {
25632
+ let timer;
25633
+ try {
25634
+ await Promise.race([
25635
+ work.then(() => {
25636
+ return;
25637
+ }, () => {
25638
+ return;
25639
+ }),
25640
+ new Promise((resolve) => {
25641
+ timer = setTimeout(resolve, Math.max(0, ms));
25642
+ })
25643
+ ]);
25644
+ } finally {
25645
+ if (timer)
25646
+ clearTimeout(timer);
25647
+ }
25648
+ }
25616
25649
  var POLL_INTERVAL_MS = 200;
25617
25650
  function modelKey(model) {
25618
25651
  return `${model.providerID}/${model.modelID}`;
@@ -25776,6 +25809,9 @@ function isProviderFailure(error) {
25776
25809
  }
25777
25810
  async function awaitAssistantRow(openReader, readSessionError, localFailure, childID, afterSeq, deadline, signal) {
25778
25811
  for (;; ) {
25812
+ const refusedBefore = localFailure();
25813
+ if (refusedBefore)
25814
+ throw refusedBefore;
25779
25815
  const { assistant, idle } = withReader(openReader, (reader) => ({
25780
25816
  assistant: reader.latestAssistant(childID),
25781
25817
  idle: reader.latestIdle(childID)
@@ -25851,6 +25887,9 @@ async function createV2HiddenCompletionExecutor(host, options) {
25851
25887
  const generation = options.generation ?? "opencode2";
25852
25888
  const roleTails = new Map;
25853
25889
  const note = options.log ?? log2;
25890
+ let disposed;
25891
+ const openRuns = new Set;
25892
+ const inFlight = new Set;
25854
25893
  const removeSession = host.removeSession;
25855
25894
  if (!removeSession)
25856
25895
  throw new Error("Magic Context requires OpenCode 2.0.22 session.remove");
@@ -25945,10 +25984,17 @@ async function createV2HiddenCompletionExecutor(host, options) {
25945
25984
  return {
25946
25985
  capabilities: V2_HIDDEN_EXECUTOR_CAPABILITIES,
25947
25986
  async open(identity) {
25987
+ if (disposed)
25988
+ throw disposed;
25948
25989
  const role = roleFor(identity);
25949
- const releaseRole = await acquireRole(role);
25990
+ const releaseStore = options.holdStore?.() ?? (() => {});
25991
+ let releaseRole;
25950
25992
  let openedChild;
25993
+ let opened;
25951
25994
  try {
25995
+ releaseRole = await acquireRole(role);
25996
+ if (disposed)
25997
+ throw disposed;
25952
25998
  await options.ensureAgent?.();
25953
25999
  const head = await resolveHead(identity);
25954
26000
  const active = await lifecycle.open(identity, role, head);
@@ -25961,17 +26007,25 @@ async function createV2HiddenCompletionExecutor(host, options) {
25961
26007
  role,
25962
26008
  child: active,
25963
26009
  releaseRole,
26010
+ releaseStore,
25964
26011
  failed: false,
25965
26012
  unsettledFailure: false,
25966
26013
  retired: false
25967
26014
  };
25968
26015
  runs.set(handle, run);
26016
+ opened = run;
26017
+ openRuns.add(run);
26018
+ if (disposed)
26019
+ noteChildOfDisposedInstance(active.id);
25969
26020
  await switchChildModel(run, head);
25970
26021
  return handle;
25971
26022
  } catch (error) {
25972
26023
  if (openedChild)
25973
26024
  lifecycle.retire(openedChild, "hidden-run-open-failed");
25974
- releaseRole();
26025
+ if (opened)
26026
+ openRuns.delete(opened);
26027
+ releaseRole?.();
26028
+ releaseStore();
25975
26029
  throw error;
25976
26030
  }
25977
26031
  },
@@ -25979,6 +26033,15 @@ async function createV2HiddenCompletionExecutor(host, options) {
25979
26033
  const run = runs.get(handle);
25980
26034
  if (!run)
25981
26035
  throw new Error("Unknown hidden completion run");
26036
+ const refuseDisposed = () => {
26037
+ if (!disposed)
26038
+ return;
26039
+ run.failed = true;
26040
+ run.unsettledFailure = true;
26041
+ retire(run, "plugin-instance-disposed");
26042
+ throw disposed;
26043
+ };
26044
+ refuseDisposed();
25982
26045
  if (request.signal?.aborted) {
25983
26046
  await interruptAndRetire(run, "aborted-before-prompt");
25984
26047
  throw new Error("Hidden completion prompt aborted");
@@ -26016,6 +26079,7 @@ async function createV2HiddenCompletionExecutor(host, options) {
26016
26079
  handle.childSessionId = run.child.id;
26017
26080
  }
26018
26081
  await switchChildModel(run, requested);
26082
+ refuseDisposed();
26019
26083
  const baseline = withReader(options.openReader, (reader) => reader.latestSequence(run.child.id));
26020
26084
  const marker = `mc:hidden:${crypto.randomUUID()}:${crypto.randomUUID()}`;
26021
26085
  run.completion = undefined;
@@ -26083,6 +26147,28 @@ async function createV2HiddenCompletionExecutor(host, options) {
26083
26147
  interruptAndRetire(run, "prompt-timeout").finally(() => abortReject(new Error("Hidden completion prompt timed out")));
26084
26148
  }, Math.max(0, deadline - Date.now()));
26085
26149
  request.signal?.addEventListener("abort", onAbort, { once: true });
26150
+ let settle;
26151
+ const entry = {
26152
+ cancel: async (refusal) => {
26153
+ attempt.refusal ??= refusal;
26154
+ noteChildOfDisposedInstance(run.child.id);
26155
+ try {
26156
+ await interruptAndRetire(run, "plugin-instance-disposed");
26157
+ } catch (error) {
26158
+ note(`[magic-context] hidden child ${run.child.id} could not be interrupted on dispose: ${errorText(error)}`);
26159
+ } finally {
26160
+ abortReject(refusal);
26161
+ }
26162
+ },
26163
+ reject: (refusal) => {
26164
+ attempt.refusal ??= refusal;
26165
+ abortReject(refusal);
26166
+ },
26167
+ settled: new Promise((resolve) => {
26168
+ settle = resolve;
26169
+ })
26170
+ };
26171
+ inFlight.add(entry);
26086
26172
  try {
26087
26173
  await Promise.race([
26088
26174
  host.prompt({ sessionID: run.child.id, text: marker }),
@@ -26162,6 +26248,8 @@ async function createV2HiddenCompletionExecutor(host, options) {
26162
26248
  clearInterval(budgetPoll);
26163
26249
  request.signal?.removeEventListener("abort", onAbort);
26164
26250
  options.hook.releaseAttempt(marker);
26251
+ inFlight.delete(entry);
26252
+ settle();
26165
26253
  }
26166
26254
  },
26167
26255
  async collect(handle) {
@@ -26185,9 +26273,27 @@ async function createV2HiddenCompletionExecutor(host, options) {
26185
26273
  }
26186
26274
  } finally {
26187
26275
  runs.delete(handle);
26276
+ openRuns.delete(run);
26188
26277
  run.releaseRole();
26278
+ run.releaseStore();
26189
26279
  }
26190
26280
  await lifecycle.finish(run.child, run.retired);
26281
+ },
26282
+ async dispose() {
26283
+ disposed ??= new HiddenCompletionRefusal("hidden_instance_disposed", HIDDEN_RUN_DISPOSED_REASON, true);
26284
+ const refusal = disposed;
26285
+ for (const run of openRuns)
26286
+ noteChildOfDisposedInstance(run.child.id);
26287
+ const entries = [...inFlight];
26288
+ if (entries.length === 0)
26289
+ return;
26290
+ note(`[magic-context] plugin instance disposed with ${entries.length} hidden run(s) in flight; cancelling them`);
26291
+ const bound = options.disposeDrainMs ?? DEFAULT_DISPOSE_DRAIN_MS;
26292
+ const deadline = Date.now() + bound;
26293
+ await settleWithin(Promise.allSettled(entries.map((entry) => entry.cancel(refusal))), bound);
26294
+ for (const entry of entries)
26295
+ entry.reject(refusal);
26296
+ await settleWithin(Promise.allSettled(entries.map((entry) => entry.settled)), deadline - Date.now());
26191
26297
  }
26192
26298
  };
26193
26299
  }
@@ -32510,6 +32616,7 @@ var VERIFY_BATCH_SIZE = 5;
32510
32616
  var VERIFY_TOKENS_PER_MEMORY = 1e5;
32511
32617
  var VERIFY_RUN_TOKEN_BUDGET = 2500000;
32512
32618
  var VERIFY_RUN_SLICE_MS = 240000;
32619
+ var VERIFY_IN_FLIGHT_GRACE_MS = 120000;
32513
32620
  function verifyBatchTokenBudget(size, configured) {
32514
32621
  return Math.min(configured ?? Number.MAX_SAFE_INTEGER, size * VERIFY_TOKENS_PER_MEMORY);
32515
32622
  }
@@ -32596,7 +32703,15 @@ async function runVerifyWithCooldown(args) {
32596
32703
  const runTokenBudget = Math.min(args.tokenBudget ?? VERIFY_RUN_TOKEN_BUDGET, VERIFY_RUN_TOKEN_BUDGET);
32597
32704
  try {
32598
32705
  for (let i = 0;i < batches.length; i += 1) {
32599
- const remainingMs = Math.max(0, Math.min(args.deadline, sliceDeadline) - Date.now());
32706
+ const now = Date.now();
32707
+ const startCutoff = Math.min(args.deadline, sliceDeadline);
32708
+ const hardStop = Math.min(args.deadline, sliceDeadline + VERIFY_IN_FLIGHT_GRACE_MS);
32709
+ const remainingMs = Math.max(0, hardStop - now);
32710
+ if (now >= startCutoff) {
32711
+ result.stopReason = "deadline";
32712
+ log2(`[dreamer] ${args.forceBroad ? "verify-broad" : "verify"}: stopping before batch ${i + 1}/${batches.length} — the run deadline passed ${now - startCutoff}ms ago`);
32713
+ break;
32714
+ }
32600
32715
  if (remainingMs < VERIFY_BATCH_FLOOR_MS) {
32601
32716
  result.stopReason = "deadline";
32602
32717
  log2(`[dreamer] ${args.forceBroad ? "verify-broad" : "verify"}: stopping before batch ${i + 1}/${batches.length} — remaining budget ${remainingMs}ms is below the ${VERIFY_BATCH_FLOOR_MS}ms batch floor`);
@@ -48836,56 +48951,6 @@ function renderItemByTag(db, sessionId, number, textIndexDomain = "part") {
48836
48951
  return selected ? renderPartFull(selected) ?? "" : `Tag ${number}'s original text part is no longer in stored history.`;
48837
48952
  }
48838
48953
 
48839
- // src/tools/ctx-expand/search-archive.ts
48840
- function renderSearchArchive(db, sessionId, start, end, tokenBudget, archiveOnly = false) {
48841
- return withMessageFtsSessionFilter(db, sessionId, (sessionFirst) => {
48842
- let rawIds;
48843
- const rows = db.prepare(sessionFirst ? `SELECT f.message_ordinal AS ordinal, f.message_id AS id, f.role, f.content
48844
- FROM message_fts_rowid_map AS m
48845
- JOIN message_history_fts AS f ON f.rowid = m.fts_rowid
48846
- WHERE m.session_id = ?1 AND m.message_ordinal BETWEEN ?2 AND ?3
48847
- AND f.session_id = ?1 AND f.message_ordinal BETWEEN ?2 AND ?3
48848
- ORDER BY m.message_ordinal` : `SELECT message_ordinal AS ordinal, message_id AS id, role, content
48849
- FROM message_history_fts
48850
- WHERE session_id = ?1 AND message_ordinal BETWEEN ?2 AND ?3
48851
- ORDER BY CAST(message_ordinal AS INTEGER)`);
48852
- const blocks = [];
48853
- let tokens = 0;
48854
- let lastOrdinal = start - 1;
48855
- let truncated = false;
48856
- for (const row of rows.iterate(sessionId, start, end)) {
48857
- if (!row.content)
48858
- continue;
48859
- if (!archiveOnly) {
48860
- rawIds ??= readRawSessionMessageIdOrdinalsForRange2(sessionId, start, end);
48861
- if (rawIds.get(row.id) === row.ordinal)
48862
- continue;
48863
- }
48864
- const block = `[${row.ordinal}] ${row.role === "user" ? "U" : "A"}: ${row.content}`;
48865
- const cost = estimateTokens(block);
48866
- if (blocks.length > 0 && tokens + cost > tokenBudget) {
48867
- truncated = true;
48868
- break;
48869
- }
48870
- blocks.push(block);
48871
- tokens += cost;
48872
- lastOrdinal = row.ordinal;
48873
- }
48874
- if (blocks.length === 0)
48875
- return null;
48876
- const text = [
48877
- "From the search archive: indexed text only; no surrounding messages or tool output.",
48878
- "",
48879
- ...blocks
48880
- ];
48881
- if (truncated) {
48882
- text.push("", `Truncated at message ${lastOrdinal} (budget: ~${tokenBudget} tokens). Call ctx_expand(start=${lastOrdinal + 1}, end=${end}) for more archived text.`);
48883
- }
48884
- return text.join(`
48885
- `);
48886
- });
48887
- }
48888
-
48889
48954
  // src/tools/ctx-expand/tools.ts
48890
48955
  var ctxExpandArgsShape = {
48891
48956
  tag: tool.schema.union([tool.schema.number(), tool.schema.string()]).optional().describe("Tag number from a §N§ tag or a [dropped §N§] placeholder, not a message ordinal. Returns that one item in full. Use alone."),
@@ -48919,7 +48984,7 @@ function createCtxExpandTool(deps) {
48919
48984
  return renderItemByTag(deps.db, sessionId, mode.tag);
48920
48985
  }
48921
48986
  if (mode.kind === "message") {
48922
- return renderSearchArchive(deps.db, sessionId, mode.message, mode.message, CTX_EXPAND_TOKEN_BUDGET) ?? renderMessageByOrdinal(sessionId, mode.message);
48987
+ return await renderSearchArchiveOffThread2(deps.db, sessionId, mode.message, mode.message, CTX_EXPAND_TOKEN_BUDGET) ?? renderMessageByOrdinal(sessionId, mode.message);
48923
48988
  }
48924
48989
  const { start, end, verbose } = mode;
48925
48990
  const lastCompartmentEnd = getLastCompartmentEndMessage(deps.db, sessionId);
@@ -48927,7 +48992,7 @@ function createCtxExpandTool(deps) {
48927
48992
  return `Range ${start}-${end} is entirely within the live tail (after the last compacted message ${lastCompartmentEnd}); those messages are already visible in context.`;
48928
48993
  }
48929
48994
  const effectiveEnd = lastCompartmentEnd >= 0 ? Math.min(end, lastCompartmentEnd) : end;
48930
- const archived = renderSearchArchive(deps.db, sessionId, start, effectiveEnd, CTX_EXPAND_TOKEN_BUDGET);
48995
+ const archived = await renderSearchArchiveOffThread2(deps.db, sessionId, start, effectiveEnd, CTX_EXPAND_TOKEN_BUDGET);
48931
48996
  if (archived)
48932
48997
  return archived;
48933
48998
  if (verbose) {
@@ -51096,6 +51161,7 @@ function persistV2UsageReading(args) {
51096
51161
  class V2LkgAdmissionReplay extends Error {
51097
51162
  }
51098
51163
  var HIDDEN_SESSION_ERROR_GRACE_MS = 50;
51164
+ var STORE_POOL_DISPOSE_WAIT_MS = 1000;
51099
51165
  function isBlockingV2TransformError(error) {
51100
51166
  return error instanceof EmergencyFailClosedError || error instanceof UnresolvedHistoryBoundaryError || error instanceof UnmanagedOverWindowError || error instanceof DegradedPassRefusalError || isFailClosedBlockingError(error);
51101
51167
  }
@@ -51443,7 +51509,8 @@ async function registerContext(context) {
51443
51509
  ensureAgent: () => hiddenAgentsReady ??= context.agent.reload(),
51444
51510
  modelCatalog: () => Promise.resolve(context.model.list()),
51445
51511
  historianTemperature: () => config.historian?.temperature,
51446
- openReader: openStoreReader
51512
+ openReader: openStoreReader,
51513
+ holdStore: () => readerPool.hold()
51447
51514
  });
51448
51515
  };
51449
51516
  const dreamerAtBoot = config.dreamer;
@@ -51748,6 +51815,10 @@ async function registerContext(context) {
51748
51815
  if (usageController.signal.aborted)
51749
51816
  break;
51750
51817
  const event = value;
51818
+ if (event.type === "provider.updated" || event.type === "model.updated") {
51819
+ queriedModels.clear();
51820
+ continue;
51821
+ }
51751
51822
  if (!event.data?.sessionID)
51752
51823
  continue;
51753
51824
  const sessionID = event.data.sessionID;
@@ -52474,6 +52545,7 @@ ${baseline}
52474
52545
  }, 0));
52475
52546
  return {
52476
52547
  async dispose() {
52548
+ await hiddenCompletionExecutor?.dispose();
52477
52549
  rpcStopped = true;
52478
52550
  rpcServer.stop();
52479
52551
  transform?.disposeRust();
@@ -52487,7 +52559,8 @@ ${baseline}
52487
52559
  release();
52488
52560
  rawProviders.clear();
52489
52561
  restoredRows.clear();
52490
- readerPool.close();
52562
+ if (!await readerPool.closeWhenIdle(STORE_POOL_DISPOSE_WAIT_MS))
52563
+ log2(`[magic-context] v2 store reader pool still held by ${readerPool.holdCount()} hidden run(s) at dispose; it closes when they finish`);
52491
52564
  clearSyntheticCandidates(context);
52492
52565
  }
52493
52566
  };
@@ -1,16 +1,18 @@
1
1
  import {
2
2
  ensureMemoryEmbeddings2
3
- } from "./server-ef89gdsx.js";
4
- import"./server-hek6z3w6.js";
3
+ } from "./server-aavz8pm6.js";
4
+ import"./server-kr2kc9dz.js";
5
5
  import"./server-4dhv7mqz.js";
6
6
  import"./server-qt1qqasc.js";
7
- import"./server-g10mdym6.js";
8
- import"./server-th4y11y7.js";
9
- import"./server-4gn3z5an.js";
10
- import"./server-qhfvvfxj.js";
7
+ import"./server-gha9x4qq.js";
8
+ import"./server-271qxsf5.js";
9
+ import"./server-hgg55hde.js";
10
+ import"./server-kqpawe1a.js";
11
11
  import"./server-rrqpvwqd.js";
12
- import"./server-gvkm8xaj.js";
13
- import"./server-yrvqaswb.js";
12
+ import"./server-e3ftpk7v.js";
13
+ import"./server-785mb90s.js";
14
+ import"./server-6714jebr.js";
15
+ import"./server-51779zs2.js";
14
16
  import"./server-6pmqg9m4.js";
15
17
  import"./server-0ppsweh6.js";
16
18
  import"./server-wafzvyhg.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  log2
6
6
  } from "./server-f2xf5gcb.js";
7
- import"./server-th4y11y7.js";
7
+ import"./server-271qxsf5.js";
8
8
  import"./server-rrqpvwqd.js";
9
9
  import"./server-0ppsweh6.js";
10
10
  import"./server-wafzvyhg.js";
@@ -12,7 +12,7 @@ import {
12
12
  resolveLocalEmbeddingWorkerRuntime,
13
13
  getLocalEmbeddingNativeMemoryStats,
14
14
  LocalEmbeddingProvider
15
- } from "./server-g10mdym6.js";
15
+ } from "./server-gha9x4qq.js";
16
16
  import {
17
17
  setStoragePrivatePermissionEnforcement
18
18
  } from "./server-fvnzcnww.js";
@@ -31,6 +31,25 @@ export interface V2HiddenCompletionOptions {
31
31
  * receive it.
32
32
  */
33
33
  historianTemperature?: () => number | undefined;
34
+ /**
35
+ * Keep the store reader pool open for one hidden run; returns its release. The run
36
+ * reads the store from its first attempt until it is closed, so a pool closed in the
37
+ * meantime must wait for it rather than refuse its next read.
38
+ */
39
+ holdStore?: () => () => void;
40
+ /** Maximum time `dispose` waits for cancelled runs to settle. */
41
+ disposeDrainMs?: number;
42
+ }
43
+ /** The OpenCode 2 executor, plus the cancellation its plugin instance runs on dispose. */
44
+ export interface V2HiddenCompletionExecutor extends HiddenCompletionExecutor {
45
+ /**
46
+ * Cancel every hidden run in flight and refuse new ones, with
47
+ * `HIDDEN_RUN_DISPOSED_REASON`. Each in-flight child is interrupted at the host, so
48
+ * the host stops stepping it before this instance's hooks are removed and the
49
+ * instance that replaces it never receives its turns. Waits at most
50
+ * `disposeDrainMs` for the cancelled attempts to settle.
51
+ */
52
+ dispose(): Promise<void>;
34
53
  }
35
54
  /**
36
55
  * Rebuild the child's assistant text and tool calls in the host message shape the dreamer validators read
@@ -60,5 +79,5 @@ export declare const V2_HIDDEN_EXECUTOR_CAPABILITIES: HiddenCompletionExecutor["
60
79
  * first successful open later reaches them without a restart.
61
80
  */
62
81
  export declare function createLateHiddenExecutor(current: () => HiddenCompletionExecutor | undefined): HiddenCompletionExecutor;
63
- export declare function createV2HiddenCompletionExecutor(host: HiddenChildHost, options: V2HiddenCompletionOptions): Promise<HiddenCompletionExecutor>;
82
+ export declare function createV2HiddenCompletionExecutor(host: HiddenChildHost, options: V2HiddenCompletionOptions): Promise<V2HiddenCompletionExecutor>;
64
83
  //# sourceMappingURL=hidden-completion.d.ts.map