@cortexkit/opencode-magic-context 0.49.13 → 0.49.15

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 (75) hide show
  1. package/dist/auto-search-worker.js +1 -1
  2. package/dist/chunk-embedding-write-worker.js +1 -1
  3. package/dist/{context-azqk0vfd.js → context-0m46day0.js} +133 -17
  4. package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
  5. package/dist/features/magic-context/dreamer/verify.d.ts +22 -3
  6. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  7. package/dist/features/magic-context/storage-tags.d.ts +2 -0
  8. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  9. package/dist/hooks/magic-context/apply-operations.d.ts +3 -1
  10. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  11. package/dist/hooks/magic-context/compartment-runner-types.d.ts +2 -2
  12. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  13. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  14. package/dist/hooks/magic-context/compartment-runner.d.ts +4 -0
  15. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  16. package/dist/hooks/magic-context/compartment-trigger.d.ts +1 -1
  17. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  18. package/dist/hooks/magic-context/degraded-pass-refusal.d.ts +2 -0
  19. package/dist/hooks/magic-context/degraded-pass-refusal.d.ts.map +1 -1
  20. package/dist/hooks/magic-context/historian-prompt.generated.d.ts +1 -1
  21. package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -1
  22. package/dist/hooks/magic-context/pending-drop-eligibility.d.ts +14 -0
  23. package/dist/hooks/magic-context/pending-drop-eligibility.d.ts.map +1 -0
  24. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  25. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +1 -0
  26. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  27. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  28. package/dist/{index-hnm8raee.js → index-1vc7jrkg.js} +2 -2
  29. package/dist/{index-wj6ht7nm.js → index-42vcjcwe.js} +52 -17
  30. package/dist/{index-b16gpywn.js → index-944w16m0.js} +2 -2
  31. package/dist/{index-wz6mzzb1.js → index-mc1cqza6.js} +3 -3
  32. package/dist/{index-2jr1smmh.js → index-snp5wbge.js} +99 -11
  33. package/dist/{index-v13skev1.js → index-thvnpfsv.js} +1 -1
  34. package/dist/{index-sj89f3b0.js → index-ts1hjk1h.js} +100 -15
  35. package/dist/{index-aw1bh90w.js → index-xn6q9pg6.js} +2 -2
  36. package/dist/{index-qkd9zz0p.js → index-yxycg7fs.js} +1 -1
  37. package/dist/index.js +13 -13
  38. package/dist/{message-index-seaqpb7c.js → message-index-a6gztaqx.js} +3 -3
  39. package/dist/{message-index-bounded-vm64mqpq.js → message-index-bounded-vtgpq6b4.js} +3 -3
  40. package/dist/migration-worker.js +1 -1
  41. package/dist/raw-ordinal-warmup-worker.js +3 -3
  42. package/dist/{read-session-chunk-ax05f7gr.js → read-session-chunk-3ae3nfdn.js} +2 -2
  43. package/dist/{recomp-orchestrator-dmbeadwt.js → recomp-orchestrator-nwzcfhx4.js} +6 -6
  44. package/dist/{search-5yd5ytzs.js → search-deajrd90.js} +4 -4
  45. package/dist/{storage-tags-yygfb9c8.js → storage-tags-s5bg1ahx.js} +1 -1
  46. package/dist/{transform-postprocess-phase-72v86syx.js → transform-postprocess-phase-ne3z1zmt.js} +6 -6
  47. package/dist/v2/auto-search-worker.js +1 -1
  48. package/dist/v2/chunk-embedding-write-worker.js +1 -1
  49. package/dist/v2/{context-w055w17c.js → context-4qczzck7.js} +265 -32
  50. package/dist/v2/hidden-completion.d.ts +23 -3
  51. package/dist/v2/hidden-completion.d.ts.map +1 -1
  52. package/dist/v2/hooks/context.d.ts.map +1 -1
  53. package/dist/v2/hooks/hidden-child.d.ts +19 -0
  54. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  55. package/dist/v2/{message-index-bounded-wepg5723.js → message-index-bounded-rxxznd34.js} +3 -3
  56. package/dist/v2/{message-index-gcmd0ng0.js → message-index-f947qtbz.js} +3 -3
  57. package/dist/v2/migration-worker.js +1 -1
  58. package/dist/v2/raw-ordinal-warmup-worker.js +3 -3
  59. package/dist/v2/{read-session-chunk-hr3w5bjk.js → read-session-chunk-rq9nx1nn.js} +2 -2
  60. package/dist/v2/{recomp-orchestrator-ca7qt75a.js → recomp-orchestrator-5zhxtwha.js} +5 -5
  61. package/dist/v2/{search-c86dcv14.js → search-n8wqxb1j.js} +4 -4
  62. package/dist/v2/{server-xh7jar6k.js → server-cfbr1s2x.js} +2 -2
  63. package/dist/v2/{server-b81w6sw3.js → server-dd0tz6cn.js} +99 -11
  64. package/dist/v2/{server-t4prcjc1.js → server-e298hswg.js} +1 -1
  65. package/dist/v2/{server-m97brnat.js → server-ehyava47.js} +2 -2
  66. package/dist/v2/{server-n8ch9683.js → server-kmbarfmn.js} +1 -1
  67. package/dist/v2/server.js +2 -2
  68. package/dist/v2/{storage-tags-a2gq6dw7.js → storage-tags-hcc2adpf.js} +1 -1
  69. package/dist/v2/store-reader.d.ts +27 -1
  70. package/dist/v2/store-reader.d.ts.map +1 -1
  71. package/dist/v2/{wrapup-orchestrator-e1a2w6jh.js → wrapup-orchestrator-65pwye0d.js} +5 -5
  72. package/dist/{wrapup-orchestrator-2051r6qm.js → wrapup-orchestrator-28xzsj5q.js} +7 -7
  73. package/package.json +1 -1
  74. /package/dist/{index-fwefky9w.js → index-mht7bq0z.js} +0 -0
  75. /package/dist/v2/{server-bxpwy6fy.js → server-atbc19ab.js} +0 -0
@@ -2,6 +2,7 @@ import type { HiddenCompletionExecutor } from "../hooks/magic-context/compartmen
2
2
  import type { Database } from "../shared/sqlite";
3
3
  import { type HiddenChildHost, type HiddenChildRows } from "./hidden-child-record";
4
4
  import { type HiddenChildAttempt, type HiddenChildHook } from "./hooks/hidden-child";
5
+ import type { StoreRow } from "./store-reader";
5
6
  export type { HiddenChildHost, HiddenChildRows } from "./hidden-child-record";
6
7
  export interface V2HiddenCompletionOptions {
7
8
  db: Database;
@@ -30,14 +31,33 @@ export interface V2HiddenCompletionOptions {
30
31
  * receive it.
31
32
  */
32
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>;
33
53
  }
34
54
  /**
35
- * Rebuild the child's tool calls in the host message shape the dreamer validators read
55
+ * Rebuild the child's assistant text and tool calls in the host message shape the dreamer validators read
36
56
  * (`state.status`, `state.input`, `state.output`), matching what the OpenCode 1 transport
37
57
  * returns. Curate counts an operation as applied only from its result text, so the text
38
58
  * has to survive this conversion.
39
59
  */
40
- export declare function toolLoopMessages(attempt: HiddenChildAttempt): unknown[];
60
+ export declare function toolLoopMessages(attempt: HiddenChildAttempt, rows?: readonly StoreRow<"assistant">[]): unknown[];
41
61
  /**
42
62
  * A terminal provider or model-resolution failure persisted by the host, as opposed to an unsettled
43
63
  * dispatch error, timeout, or abort. The type keeps lifecycle handling independent of provider
@@ -59,5 +79,5 @@ export declare const V2_HIDDEN_EXECUTOR_CAPABILITIES: HiddenCompletionExecutor["
59
79
  * first successful open later reaches them without a restart.
60
80
  */
61
81
  export declare function createLateHiddenExecutor(current: () => HiddenCompletionExecutor | undefined): HiddenCompletionExecutor;
62
- export declare function createV2HiddenCompletionExecutor(host: HiddenChildHost, options: V2HiddenCompletionOptions): Promise<HiddenCompletionExecutor>;
82
+ export declare function createV2HiddenCompletionExecutor(host: HiddenChildHost, options: V2HiddenCompletionOptions): Promise<V2HiddenCompletionExecutor>;
63
83
  //# sourceMappingURL=hidden-completion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hidden-completion.d.ts","sourceRoot":"","sources":["../../src/v2/hidden-completion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAER,wBAAwB,EAG3B,MAAM,iDAAiD,CAAC;AASzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAGH,KAAK,eAAe,EAIpB,KAAK,eAAe,EAGvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGH,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAEvB,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI9E,MAAM,WAAW,yBAAyB;IACtC,EAAE,EAAE,QAAQ,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,eAAe,CAAC;IACtB,UAAU,EAAE,MAAM,eAAe,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;IAC3D,WAAW,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KA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carrier.
16
16
  */
17
17
  export declare function hiddenAgentAllowedTools(agent: string | undefined): readonly string[] | undefined;
18
+ /**
19
+ * Why a hidden run ends when its plugin instance is disposed. OpenCode 2 disposes
20
+ * a plugin instance when it reloads the plugin (`/plugins` then ctrl+u, a
21
+ * rewritten config, a location reinitialising) and loads a fresh instance in the
22
+ * same process. The disposed instance cancels its in-flight hidden runs and the
23
+ * run's error carries this text; the instance that replaces it refuses any turn
24
+ * of such a child with the same text, so both sides of a reload name one cause.
25
+ */
26
+ export declare const HIDDEN_RUN_DISPOSED_REASON = "the Magic Context plugin instance that started this hidden run was disposed (OpenCode reloaded the plugin), so the run was cancelled; the work is retried on a later run";
27
+ /** Record that `sessionID` belonged to a plugin instance that has been disposed. */
28
+ export declare function noteChildOfDisposedInstance(sessionID: string): void;
29
+ /** Whether `sessionID` is a hidden child whose plugin instance was disposed. */
30
+ export declare function isChildOfDisposedInstance(sessionID: string): boolean;
31
+ /** Clears the process-wide record, for tests. */
32
+ export declare function __resetDisposedChildrenForTests(): void;
18
33
  /** One OpenCode 2 permission rule: the action is the tool id, the resource a pattern. */
19
34
  export interface HiddenPermissionRule {
20
35
  action: string;
@@ -121,6 +136,10 @@ export declare class HiddenChildHook {
121
136
  * restart) arrives here unshaped: its user message is a bare run marker, and
122
137
  * passing it on would send the marker to the model with whatever tools the
123
138
  * user's own permissions allow.
139
+ *
140
+ * A child whose instance was disposed by a plugin reload is refused with that
141
+ * reason, whatever agent the host reports for it: its instance has cancelled
142
+ * the run, and this instance has no record of the prompt it was sent.
124
143
  */
125
144
  apply(draft: SessionContext): boolean;
126
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hidden-child.d.ts","sourceRoot":"","sources":["../../../src/v2/hooks/hidden-child.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,sBAAsB,EAEzB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EACH,uBAAuB,EACvB,KAAK,iBAAiB,EACzB,MAAM,oDAAoD,CAAC;AAQ5D,O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O;CAyIxC"}
@@ -4,7 +4,7 @@ import {
4
4
  yieldIndexChunk2
5
5
  } from "./server-wafzvyhg.js";
6
6
  import"./server-1zx87sdm.js";
7
- import"./server-bxpwy6fy.js";
7
+ import"./server-atbc19ab.js";
8
8
  import"./server-0ppsweh6.js";
9
9
  import"./server-pavzsdc6.js";
10
10
  import"./server-f2xf5gcb.js";
@@ -14,7 +14,7 @@ import"./server-51779zs2.js";
14
14
  import"./server-prg55b7k.js";
15
15
  import"./server-2ra6pwf3.js";
16
16
  import"./server-d8tj10db.js";
17
- import"./server-m97brnat.js";
17
+ import"./server-ehyava47.js";
18
18
  import"./server-zs8d0s3b.js";
19
19
  import {
20
20
  MESSAGE_INDEX_MAX_FTS_BYTES2,
@@ -23,7 +23,7 @@ import {
23
23
  markMessageIndexDirty2,
24
24
  getIndexableContent2,
25
25
  indexSingleMessage2
26
- } from "./server-t4prcjc1.js";
26
+ } from "./server-e298hswg.js";
27
27
  import"./server-yrvqaswb.js";
28
28
  import"./server-da07v4xp.js";
29
29
  import"./server-rrqpvwqd.js";
@@ -17,9 +17,9 @@ import {
17
17
  indexMessagesAfterOrdinal2,
18
18
  indexSourcesAfterOrdinal2,
19
19
  sweepOrphanedOpenCodeMessageIndexes2
20
- } from "./server-t4prcjc1.js";
21
- import"./server-m97brnat.js";
22
- import"./server-bxpwy6fy.js";
20
+ } from "./server-e298hswg.js";
21
+ import"./server-ehyava47.js";
22
+ import"./server-atbc19ab.js";
23
23
  import"./server-1zx87sdm.js";
24
24
  import"./server-d8tj10db.js";
25
25
  import"./server-prg55b7k.js";
@@ -18,7 +18,7 @@ import"./server-fb3zxn06.js";
18
18
  import {
19
19
  setSqlitePragmaConfig,
20
20
  initializeDatabase
21
- } from "./server-n8ch9683.js";
21
+ } from "./server-kmbarfmn.js";
22
22
  import"./server-yrvqaswb.js";
23
23
  import"./server-0ppsweh6.js";
24
24
  import"./server-zs8d0s3b.js";
@@ -35,7 +35,7 @@ try {
35
35
  { configureContextDatabasePragmas }
36
36
  ] = await Promise.all([
37
37
  import("./harness-e4avh192.js"),
38
- import("./message-index-gcmd0ng0.js"),
38
+ import("./message-index-f947qtbz.js"),
39
39
  import("./sqlite-context-pragmas-mv9jqwjh.js")
40
40
  ]);
41
41
  setHarness(input.harness ?? "opencode");
@@ -49,7 +49,7 @@ try {
49
49
  const { setHarness } = await import("./harness-e4avh192.js");
50
50
  setHarness(input.harness ?? "opencode");
51
51
  const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
52
- import("./message-index-bounded-wepg5723.js"),
52
+ import("./message-index-bounded-rxxznd34.js"),
53
53
  import("./sqlite-context-pragmas-mv9jqwjh.js")
54
54
  ]);
55
55
  configureContextDatabasePragmas(db);
@@ -59,7 +59,7 @@ try {
59
59
  const result = await indexMessageInShortChunks(writer, input.sessionId, message, input, () => !cancellation || Atomics.load(cancellation, 0) === 0);
60
60
  reply = { kind: "indexed", inserted: result.inserted, measurements: result.measurements };
61
61
  } else if (input.tagRatio !== undefined) {
62
- const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-a2gq6dw7.js");
62
+ const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-hcc2adpf.js");
63
63
  const delta = input.tagState ? scanTagOwnerDelta(db, input.sessionId, input.tagState) : null;
64
64
  if (delta)
65
65
  reply = { kind: "tag-delta", delta };
@@ -35,8 +35,8 @@ import {
35
35
  readSessionChunk2,
36
36
  getRawSessionMessageIdsThrough2,
37
37
  readRawSessionSeedTail2
38
- } from "./server-m97brnat.js";
39
- import"./server-bxpwy6fy.js";
38
+ } from "./server-ehyava47.js";
39
+ import"./server-atbc19ab.js";
40
40
  import"./server-1zx87sdm.js";
41
41
  import"./server-d8tj10db.js";
42
42
  import"./server-prg55b7k.js";
@@ -7,10 +7,10 @@ import {
7
7
  setRecompTerminal2,
8
8
  buildRecompDeps2,
9
9
  runManagedRecomp2
10
- } from "./server-b81w6sw3.js";
10
+ } from "./server-dd0tz6cn.js";
11
11
  import"./server-05xjtq6c.js";
12
12
  import"./server-6cdy4rc0.js";
13
- import"./server-t4prcjc1.js";
13
+ import"./server-e298hswg.js";
14
14
  import"./server-ef89gdsx.js";
15
15
  import"./server-n78avt2p.js";
16
16
  import"./server-hek6z3w6.js";
@@ -18,8 +18,8 @@ import"./server-4dhv7mqz.js";
18
18
  import"./server-34kwfsr4.js";
19
19
  import"./server-vbe4se57.js";
20
20
  import"./server-qt1qqasc.js";
21
- import"./server-m97brnat.js";
22
- import"./server-bxpwy6fy.js";
21
+ import"./server-ehyava47.js";
22
+ import"./server-atbc19ab.js";
23
23
  import"./server-1zx87sdm.js";
24
24
  import"./server-d8tj10db.js";
25
25
  import"./server-prg55b7k.js";
@@ -33,7 +33,7 @@ import"./server-th4y11y7.js";
33
33
  import"./server-4gn3z5an.js";
34
34
  import"./server-qhfvvfxj.js";
35
35
  import"./server-rrqpvwqd.js";
36
- import"./server-n8ch9683.js";
36
+ import"./server-kmbarfmn.js";
37
37
  import"./server-fb3zxn06.js";
38
38
  import"./server-k2bzedxk.js";
39
39
  import"./server-fr0wbhdn.js";
@@ -5,16 +5,16 @@ import {
5
5
  resolveMemoriesByIdsForSearch2,
6
6
  unifiedSearch2,
7
7
  formatSearchResults2
8
- } from "./server-xh7jar6k.js";
8
+ } from "./server-cfbr1s2x.js";
9
9
  import"./server-6cdy4rc0.js";
10
- import"./server-t4prcjc1.js";
10
+ import"./server-e298hswg.js";
11
11
  import"./server-ef89gdsx.js";
12
12
  import"./server-n78avt2p.js";
13
13
  import"./server-hek6z3w6.js";
14
14
  import"./server-4dhv7mqz.js";
15
15
  import"./server-qt1qqasc.js";
16
- import"./server-m97brnat.js";
17
- import"./server-bxpwy6fy.js";
16
+ import"./server-ehyava47.js";
17
+ import"./server-atbc19ab.js";
18
18
  import"./server-1zx87sdm.js";
19
19
  import"./server-d8tj10db.js";
20
20
  import"./server-prg55b7k.js";
@@ -64,10 +64,10 @@ import {
64
64
  } from "./server-6cdy4rc0.js";
65
65
  import {
66
66
  isRecord
67
- } from "./server-bxpwy6fy.js";
67
+ } from "./server-atbc19ab.js";
68
68
  import {
69
69
  getIndexedMessageCorpusSize2
70
- } from "./server-t4prcjc1.js";
70
+ } from "./server-e298hswg.js";
71
71
  import {
72
72
  resolveWorkspaceShareCategories,
73
73
  resolveWorkspaceIdentitySet,
@@ -80,7 +80,7 @@ import {
80
80
  toMessageIndexSource2,
81
81
  clearIndexedMessagesInTransaction2,
82
82
  indexSourcesAfterOrdinal2
83
- } from "./server-t4prcjc1.js";
83
+ } from "./server-e298hswg.js";
84
84
  import {
85
85
  detectOverflow,
86
86
  SESSION_META_SELECT_COLUMNS,
@@ -173,7 +173,7 @@ import {
173
173
  getRawSessionTagKeysThrough2,
174
174
  getLegacyProtectedTailStartOrdinal2,
175
175
  readSessionChunk2
176
- } from "./server-m97brnat.js";
176
+ } from "./server-ehyava47.js";
177
177
  import {
178
178
  getTableColumnNames
179
179
  } from "./server-pwv4ezb0.js";
@@ -183,7 +183,7 @@ import {
183
183
  LATEST_SUPPORTED_VERSION,
184
184
  getPersistedSchemaVersion,
185
185
  openDatabase
186
- } from "./server-n8ch9683.js";
186
+ } from "./server-kmbarfmn.js";
187
187
  import {
188
188
  providerMass,
189
189
  calibrationForModelKey,
@@ -201,7 +201,7 @@ import {
201
201
  foldShrunkPartTags2,
202
202
  getTagNumberByMessageId2,
203
203
  getActiveTagsBySession2
204
- } from "./server-bxpwy6fy.js";
204
+ } from "./server-atbc19ab.js";
205
205
  import {
206
206
  isStrictGapHealingMessage2,
207
207
  noteRawSessionSummaryRowWritten2,
@@ -1220,6 +1220,9 @@ class V2StoreReaderPool {
1220
1220
  capacity;
1221
1221
  connections = new Map;
1222
1222
  closed = false;
1223
+ closing = false;
1224
+ holds = 0;
1225
+ idleWaiters = new Set;
1223
1226
  constructor(capacity = 4) {
1224
1227
  this.capacity = capacity;
1225
1228
  if (!Number.isSafeInteger(capacity) || capacity < 1)
@@ -1264,13 +1267,63 @@ class V2StoreReaderPool {
1264
1267
  if (connection.leases === 0)
1265
1268
  closeConnection(connection);
1266
1269
  }
1270
+ hold() {
1271
+ if (this.closed || this.closing)
1272
+ throw new Error("Store reader pool is closed");
1273
+ this.holds++;
1274
+ let released = false;
1275
+ return () => {
1276
+ if (released)
1277
+ return;
1278
+ released = true;
1279
+ this.holds--;
1280
+ if (this.holds === 0 && this.closing)
1281
+ this.finishClose();
1282
+ };
1283
+ }
1284
+ isClosed() {
1285
+ return this.closed;
1286
+ }
1287
+ holdCount() {
1288
+ return this.holds;
1289
+ }
1267
1290
  close() {
1291
+ if (this.closed || this.closing)
1292
+ return;
1293
+ this.closing = true;
1294
+ if (this.holds === 0)
1295
+ this.finishClose();
1296
+ }
1297
+ async closeWhenIdle(timeoutMs) {
1298
+ this.close();
1299
+ if (this.closed)
1300
+ return true;
1301
+ let timer;
1302
+ let waiter;
1303
+ try {
1304
+ await new Promise((resolve) => {
1305
+ waiter = resolve;
1306
+ this.idleWaiters.add(resolve);
1307
+ timer = setTimeout(resolve, Math.max(0, timeoutMs));
1308
+ });
1309
+ } finally {
1310
+ if (timer)
1311
+ clearTimeout(timer);
1312
+ if (waiter)
1313
+ this.idleWaiters.delete(waiter);
1314
+ }
1315
+ return this.closed;
1316
+ }
1317
+ finishClose() {
1268
1318
  if (this.closed)
1269
1319
  return;
1270
1320
  this.closed = true;
1271
1321
  for (const connection of this.connections.values())
1272
1322
  this.retire(connection);
1273
1323
  this.connections.clear();
1324
+ for (const resolve of this.idleWaiters)
1325
+ resolve();
1326
+ this.idleWaiters.clear();
1274
1327
  }
1275
1328
  }
1276
1329
 
@@ -6557,6 +6610,28 @@ function hiddenToolLoop(identity) {
6557
6610
  function hiddenAgentAllowedTools(agent) {
6558
6611
  return agent !== undefined && Object.hasOwn(AGENT_TOOLS, agent) ? AGENT_TOOLS[agent] : undefined;
6559
6612
  }
6613
+ var HIDDEN_RUN_DISPOSED_REASON = "the Magic Context plugin instance that started this hidden run was disposed (OpenCode reloaded the plugin), so the run was cancelled; the work is retried on a later run";
6614
+ var DISPOSED_CHILDREN_KEY = Symbol.for("@cortexkit/magic-context/v2/disposed-hidden-children");
6615
+ var DISPOSED_CHILDREN_LIMIT = 512;
6616
+ function disposedChildren() {
6617
+ const store = globalThis;
6618
+ store[DISPOSED_CHILDREN_KEY] ??= new Set;
6619
+ return store[DISPOSED_CHILDREN_KEY];
6620
+ }
6621
+ function noteChildOfDisposedInstance(sessionID) {
6622
+ const children = disposedChildren();
6623
+ children.delete(sessionID);
6624
+ children.add(sessionID);
6625
+ while (children.size > DISPOSED_CHILDREN_LIMIT) {
6626
+ const oldest = children.values().next().value;
6627
+ if (oldest === undefined)
6628
+ break;
6629
+ children.delete(oldest);
6630
+ }
6631
+ }
6632
+ function isChildOfDisposedInstance(sessionID) {
6633
+ return disposedChildren().has(sessionID);
6634
+ }
6560
6635
  function hiddenChildPermissions(agent, providerID) {
6561
6636
  const tools = AGENT_TOOLS[agent] ?? [];
6562
6637
  const visible = tools.length === 0 && needsBlockedRead(agent, providerID) ? ["read"] : tools;
@@ -6588,6 +6663,8 @@ async function registerHiddenChildAgents(agent) {
6588
6663
  }
6589
6664
  function hiddenToolCallRefusal(call, hook) {
6590
6665
  const owned = hook.owns(call.sessionID);
6666
+ if (!owned && isChildOfDisposedInstance(call.sessionID))
6667
+ return `Magic Context hidden child ${call.sessionID} refused: ${HIDDEN_RUN_DISPOSED_REASON}; ${call.tool} refused`;
6591
6668
  const agent = owned ? hook.agentFor(call.sessionID) ?? call.agent : call.agent;
6592
6669
  const allowed = hiddenAgentAllowedTools(agent);
6593
6670
  if (allowed === undefined) {
@@ -6717,6 +6794,9 @@ class HiddenChildHook {
6717
6794
  }
6718
6795
  compactionSummary(sessionID, agent) {
6719
6796
  if (!this.owns(sessionID)) {
6797
+ if (isChildOfDisposedInstance(sessionID)) {
6798
+ this.refuse(`Refusing to compact a Magic Context hidden child of a disposed plugin instance: ${HIDDEN_RUN_DISPOSED_REASON}`, { sessionID, messages: [] }, undefined, undefined, "hidden_instance_disposed");
6799
+ }
6720
6800
  if (hiddenAgentAllowedTools(agent) !== undefined) {
6721
6801
  this.refuse("Refusing to compact a Magic Context hidden-agent session this instance did not register", { sessionID, messages: [] }, undefined);
6722
6802
  }
@@ -6731,7 +6811,7 @@ class HiddenChildHook {
6731
6811
  }
6732
6812
  return marker;
6733
6813
  }
6734
- refuse(reason, draft, raw, inFlight) {
6814
+ refuse(reason, draft, raw, inFlight, code = "hidden_prompt_unrecognized") {
6735
6815
  const registered = [...this.attempts.values()].filter((attempt) => attempt.childSessionId === draft.sessionID && attempt.marker).map((attempt) => {
6736
6816
  const marker = attempt.marker;
6737
6817
  return {
@@ -6752,7 +6832,7 @@ class HiddenChildHook {
6752
6832
  active: this.active.has(draft.sessionID),
6753
6833
  ...inFlight === undefined ? {} : { in_flight: inFlight }
6754
6834
  })}`);
6755
- const refusal = new HiddenCompletionRefusal("hidden_prompt_unrecognized", reason, true);
6835
+ const refusal = new HiddenCompletionRefusal(code, reason, true);
6756
6836
  for (const attempt of this.attempts.values()) {
6757
6837
  if (attempt.childSessionId === draft.sessionID)
6758
6838
  attempt.refusal = refusal;
@@ -6767,6 +6847,9 @@ class HiddenChildHook {
6767
6847
  }
6768
6848
  apply(draft) {
6769
6849
  if (!this.owns(draft.sessionID)) {
6850
+ if (isChildOfDisposedInstance(draft.sessionID)) {
6851
+ this.refuse(`Refusing a turn of a Magic Context hidden child of a disposed plugin instance: ${HIDDEN_RUN_DISPOSED_REASON}`, draft, newestUserText(draft), undefined, "hidden_instance_disposed");
6852
+ }
6770
6853
  if (hiddenAgentAllowedTools(draft.agent) !== undefined) {
6771
6854
  this.refuse("Refusing a Magic Context hidden-agent turn this instance did not register", draft, newestUserText(draft));
6772
6855
  }
@@ -8455,6 +8538,7 @@ Examples:
8455
8538
  - Every displayed raw message ordinal MUST appear in exactly one compartment. Gaps between compartments are invalid. When a displayed block is pure tool-only noise with no narrative text, do NOT skip it — extend the preceding compartment's \`end\` to absorb the range, or fold it into the current compartment if it's part of an ongoing work unit. Never create a dedicated compartment just to cover a tool-only run.
8456
8539
  - If a chunk is entirely tool-only with no narrative text (a long autonomous coding stretch), produce a single compartment whose narrative is derived from what the tools collectively accomplished.
8457
8540
  - If the chunk ends mid-topic, leave the unfinished portion out and report its first message index in \`<unprocessed_from>\`.
8541
+ - If every message in the chunk is covered by a compartment, nothing is unprocessed: set \`<unprocessed_from>\` to the chunk's last message index + 1. Never write \`0\` or the last covered index in that case.
8458
8542
 
8459
8543
  ---
8460
8544
 
@@ -9633,16 +9717,19 @@ function validateParsedCompartments(compartments, chunkStart, chunkEnd, unproces
9633
9717
  expectedStart = compartment.endMessage + 1;
9634
9718
  }
9635
9719
  if (unprocessedFrom !== null) {
9720
+ if (expectedStart <= chunkEnd) {
9721
+ if (unprocessedFrom !== expectedStart) {
9722
+ return `<unprocessed_from> ${unprocessedFrom} does not match next uncovered message ${expectedStart}`;
9723
+ }
9724
+ return null;
9725
+ }
9636
9726
  if (unprocessedFrom === chunkEnd + 1) {
9637
9727
  return null;
9638
9728
  }
9639
9729
  if (unprocessedFrom < chunkStart || unprocessedFrom > chunkEnd) {
9640
9730
  return `<unprocessed_from> ${unprocessedFrom} is outside chunk ${chunkStart}-${chunkEnd}`;
9641
9731
  }
9642
- if (unprocessedFrom !== expectedStart) {
9643
- return `<unprocessed_from> ${unprocessedFrom} does not match next uncovered message ${expectedStart}`;
9644
- }
9645
- return null;
9732
+ return `<unprocessed_from> ${unprocessedFrom} does not match completed chunk boundary ${chunkEnd + 1}`;
9646
9733
  }
9647
9734
  if (expectedStart <= chunkEnd) {
9648
9735
  return `output left uncovered messages ${expectedStart}-${chunkEnd} without <unprocessed_from>`;
@@ -18835,6 +18922,7 @@ function registerActiveCompartmentRun(sessionId, promise, kind = "other") {
18835
18922
  kind
18836
18923
  };
18837
18924
  const wrapped = promise.finally(() => {
18925
+ activeRun.settled = true;
18838
18926
  if (activeRuns.get(sessionId)?.promise === wrapped) {
18839
18927
  activeRuns.delete(sessionId);
18840
18928
  }
@@ -19122,4 +19210,4 @@ ${failure}`;
19122
19210
  }
19123
19211
  }
19124
19212
 
19125
- export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, sumTokensFromChildMessages, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
19213
+ export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, sumTokensFromChildMessages, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
@@ -23,7 +23,7 @@ import {
23
23
  } from "./server-pwv4ezb0.js";
24
24
  import {
25
25
  cleanUserText2
26
- } from "./server-m97brnat.js";
26
+ } from "./server-ehyava47.js";
27
27
  import {
28
28
  recordMessageFtsRowid,
29
29
  recordIndexedMessageTime,
@@ -23,7 +23,7 @@ import {
23
23
  TAG_SELECT_COLUMNS2,
24
24
  getCandidateToolOwners2,
25
25
  pickNearestPriorOwner2
26
- } from "./server-bxpwy6fy.js";
26
+ } from "./server-atbc19ab.js";
27
27
  import {
28
28
  OMO_INTERNAL_INITIATOR_MARKER,
29
29
  isSystemDirective,
@@ -7158,4 +7158,4 @@ function readRawSessionSeedTail2(sessionId, boundaryId, onQuery) {
7158
7158
  });
7159
7159
  }
7160
7160
 
7161
- export { detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, expandToolPart, markHostUnservedRow, retreatPastHostUnservedRows, snapTerminalCompartmentToServedRow, isHostRenderedSystemMessage, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, stripSystemInjection, isTextPart, isToolPartWithOutput, isFilePart, buildFileSourceContent, toolPartHasUserAnswer, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, TOOL_USE_DISABLED, needsBlockedRead, withBlockedReadInstruction, rememberV1HiddenRun, recordToolParameters, createDroppedInputGuard, assertExecutableToolInput, isEditTool, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, MAX_EXECUTE_THRESHOLD, escalationBands, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, getProtectionWindowForSession, withReplayEnvelopeSnapshot, invalidateReplayEnvelopeSnapshot, isRustMarkerAdmissionFenced, setRustMarkerAdmissionFence, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadPersistedUsage, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, resetProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, loadTransformPassStateSnapshot, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, getDeferredClearedCompactionMarkerState, retireDeferredClearedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, getThinkingBindingRecoveryTarget, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getTrailingBlankDecisions, addTrailingBlankDecisions, demoteTrailingBlankKeepDecisions, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, getProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, setPendingCompactionMarkerState, replacePendingCompactionMarkerStateIf, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, setSessionWorkMetrics, getObservedEpochFloor, resolveEpochFloorForPass, getReasoningRemovalState, addRemovedReasoningIds, markDropLeavesReasoning, modelAcceptsEmptyContent, isAnthropicFamilyRoute, neutralizeDroppedReasoningPart, restoreNeutralizedReasoningPart, isNeutralizedReasoningPart, variantChangeBustsProviderCache, makeSentinel, makeWholeMessageSentinel, isSentinel, replaySentinelByMessageIds, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, stripSystemInjectedMessages, stripDroppedPlaceholderMessages, replayClearedReasoning, replayStrippedInlineThinking, clearOldReasoning, stripClearedReasoning, stripInlineThinking, findReasoningBearingAssistantIds, findLatestAssistantReasoningMutationExemptMessage, snapshotTrailingBlankSourceDecisions, findTrailingBlankDecisionCandidates, applyFrozenTrailingBlankDecisions, stripReasoningFromAssistantIds, findMergedReasoningStripDecisions, stripReasoningFromMergedAssistants, getEmptyImageParts, stripProcessedImages, projectOpencodeReasoningBudgetCutoff, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningBudgetCutoff, reasoningTextAndOpaque, opencodeReasoningBudgetCutoff, describeFinalWireTail, estimatePartImageTokens, estimateMessageTokens, wireContentBytes, createFinalWireUsageTracker, estimateFinalWireInputTokens, estimateAppendedWireTokens, SKELETON_REAL_INPUT_MAX_BYTES, partHasCompletedResult, extractToolCallObservation, ToolMutationBatch, createToolDropTarget, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
7161
+ export { detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, expandToolPart, markHostUnservedRow, retreatPastHostUnservedRows, snapTerminalCompartmentToServedRow, isHostRenderedSystemMessage, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, stripSystemInjection, isTextPart, isToolPartWithOutput, isFilePart, buildFileSourceContent, toolPartHasUserAnswer, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, TOOL_USE_DISABLED, needsBlockedRead, withBlockedReadInstruction, rememberV1HiddenRun, recordToolParameters, createDroppedInputGuard, assertExecutableToolInput, isEditTool, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, MAX_EXECUTE_THRESHOLD, escalationBands, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, readEpochFloorSnapshot, getProtectionWindowForSession, withReplayEnvelopeSnapshot, invalidateReplayEnvelopeSnapshot, isRustMarkerAdmissionFenced, setRustMarkerAdmissionFence, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadPersistedUsage, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, resetProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, loadTransformPassStateSnapshot, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, getDeferredClearedCompactionMarkerState, retireDeferredClearedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, getThinkingBindingRecoveryTarget, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getTrailingBlankDecisions, addTrailingBlankDecisions, demoteTrailingBlankKeepDecisions, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, getProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, setPendingCompactionMarkerState, replacePendingCompactionMarkerStateIf, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, setSessionWorkMetrics, getObservedEpochFloor, resolveEpochFloorForPass, getReasoningRemovalState, addRemovedReasoningIds, markDropLeavesReasoning, modelAcceptsEmptyContent, isAnthropicFamilyRoute, neutralizeDroppedReasoningPart, restoreNeutralizedReasoningPart, isNeutralizedReasoningPart, variantChangeBustsProviderCache, makeSentinel, makeWholeMessageSentinel, isSentinel, replaySentinelByMessageIds, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, stripSystemInjectedMessages, stripDroppedPlaceholderMessages, replayClearedReasoning, replayStrippedInlineThinking, clearOldReasoning, stripClearedReasoning, stripInlineThinking, findReasoningBearingAssistantIds, findLatestAssistantReasoningMutationExemptMessage, snapshotTrailingBlankSourceDecisions, findTrailingBlankDecisionCandidates, applyFrozenTrailingBlankDecisions, stripReasoningFromAssistantIds, findMergedReasoningStripDecisions, stripReasoningFromMergedAssistants, getEmptyImageParts, stripProcessedImages, projectOpencodeReasoningBudgetCutoff, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningBudgetCutoff, reasoningTextAndOpaque, opencodeReasoningBudgetCutoff, describeFinalWireTail, estimatePartImageTokens, estimateMessageTokens, wireContentBytes, createFinalWireUsageTracker, estimateFinalWireInputTokens, estimateAppendedWireTokens, SKELETON_REAL_INPUT_MAX_BYTES, partHasCompletedResult, extractToolCallObservation, ToolMutationBatch, createToolDropTarget, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
@@ -1212,7 +1212,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1212
1212
  startMessageFtsRowidMapBackfill(db).then(async () => {
1213
1213
  if (!readsOpenCodeStore)
1214
1214
  return;
1215
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-hr3w5bjk.js"));
1215
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-rq9nx1nn.js"));
1216
1216
  const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-bsteyc4d.js"));
1217
1217
  await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
1218
1218
  readPage: readRawSessionMessagePage
package/dist/v2/server.js CHANGED
@@ -7874,7 +7874,7 @@ var require_src2 = __commonJS(function(exports, module) {
7874
7874
  // package.json
7875
7875
  var package_default = {
7876
7876
  name: "@cortexkit/opencode-magic-context",
7877
- version: "0.49.13",
7877
+ version: "0.49.15",
7878
7878
  type: "module",
7879
7879
  description: "OpenCode plugin for Magic Context — cross-session memory and context management",
7880
7880
  main: "dist/index.js",
@@ -8195,7 +8195,7 @@ async function setup(context) {
8195
8195
  if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
8196
8196
  log2(`[magic-context] Magic Context storage is at ${storageDir}, outside the folder Engram backs up (~/.local/share/cortexkit/magic-context). It is not included in CortexKit backups.`);
8197
8197
  }
8198
- const { registerContext } = await import("./context-w055w17c.js");
8198
+ const { registerContext } = await import("./context-4qczzck7.js");
8199
8199
  setHarness2("opencode2");
8200
8200
  bindStaleBuildNotice({}, import.meta.url, "opencode2");
8201
8201
  const duties = await registerContext(context);
@@ -61,7 +61,7 @@ import {
61
61
  adoptNullOwnerToolTag2,
62
62
  getCandidateToolOwners2,
63
63
  pickNearestPriorOwner2
64
- } from "./server-bxpwy6fy.js";
64
+ } from "./server-atbc19ab.js";
65
65
  import"./server-1zx87sdm.js";
66
66
  import"./server-pwv4ezb0.js";
67
67
  import"./server-0ppsweh6.js";