@cortexkit/opencode-magic-context 0.49.81 → 0.49.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-search-worker.js +3 -3
- package/dist/chunk-embedding-write-worker.js +4 -4
- package/dist/{conflict-warning-hook-8s8r0c0v.js → conflict-warning-hook-a0wrnzch.js} +2 -2
- package/dist/{context-359s1ncq.js → context-xmyke353.js} +258 -31
- package/dist/{embedding-backfill-0tvprmrn.js → embedding-backfill-k994xdas.js} +4 -4
- package/dist/features/magic-context/dreamer/map-memories-retry.d.ts +18 -0
- package/dist/features/magic-context/dreamer/map-memories-retry.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts +2 -0
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts +1 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-registry.d.ts +7 -0
- package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +9 -0
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/memory/identity-merge-command.d.ts +4 -0
- package/dist/features/magic-context/memory/identity-merge-command.d.ts.map +1 -0
- package/dist/features/magic-context/memory/project-binding-notice.d.ts +5 -0
- package/dist/features/magic-context/memory/project-binding-notice.d.ts.map +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
- package/dist/features/magic-context/storage-clone.d.ts +17 -0
- package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
- package/dist/features/magic-context/store-generation-rebase.d.ts +13 -0
- package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +1 -7
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/stored-compartment-gaps.d.ts +16 -0
- package/dist/hooks/magic-context/stored-compartment-gaps.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform.d.ts +1 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-m4q6ptgz.js → index-2xhzmwf6.js} +4 -4
- package/dist/{index-jhhkb4jv.js → index-2ygw6q5s.js} +1 -1
- package/dist/{index-v0epndb8.js → index-93rezfvc.js} +22 -2
- package/dist/{index-1rx9bfrk.js → index-b2787fk6.js} +111 -40
- package/dist/{index-tebcx987.js → index-bd34njzg.js} +1 -1
- package/dist/{index-zpd4pxnp.js → index-dg5jvh9r.js} +6 -6
- package/dist/{index-6athgjba.js → index-e21n48yd.js} +34 -2
- package/dist/{index-726b5jh5.js → index-eptthgkw.js} +5 -5
- package/dist/{index-6sckwxjj.js → index-eyk7msgw.js} +344 -159
- package/dist/{index-9554nr2q.js → index-fgy6hnr3.js} +6 -1
- package/dist/{index-tzy5h4x6.js → index-fpqdbb67.js} +1 -1
- package/dist/{index-x8a7jmkh.js → index-fzgyvsb1.js} +15 -4
- package/dist/{index-1sq1krqw.js → index-g6hfh4h4.js} +4 -4
- package/dist/{index-wwzamy3j.js → index-hz1xdb15.js} +3 -3
- package/dist/{index-nda0zgna.js → index-kknjvmpx.js} +2 -1
- package/dist/{index-m6rkq3t4.js → index-rnyaa7cj.js} +1 -1
- package/dist/{index-yfn52pb6.js → index-shpyv8gq.js} +2 -2
- package/dist/{index-7jefmy0g.js → index-stx8zd81.js} +2 -2
- package/dist/{index-jg7sbt3v.js → index-vpw46557.js} +1 -1
- package/dist/{index-xx05vta0.js → index-w2wpx7t5.js} +1 -1
- package/dist/{index-177yv84k.js → index-w8dcjt7f.js} +1 -1
- package/dist/{index-ma258g0g.js → index-wxxcfpxh.js} +5 -5
- package/dist/{index-xsdaz3mq.js → index-x8qgqnym.js} +30 -11
- package/dist/{index-aawwdt26.js → index-zvane1rq.js} +2 -2
- package/dist/index.js +32 -32
- package/dist/migration-worker.js +3 -3
- package/dist/plugin/rpc-handlers.d.ts +2 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{project-embedding-registry-sw4z2ptg.js → project-embedding-registry-y3z36mjy.js} +3 -3
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{recomp-orchestrator-ar3xw3f4.js → recomp-orchestrator-fjdp3t1d.js} +14 -14
- package/dist/{render-bjxgkrk6.js → render-c9fjwrad.js} +6 -6
- package/dist/{rpc-notifications-3hed126v.js → rpc-notifications-t9q0ynq7.js} +3 -1
- package/dist/{search-z56487n8.js → search-1jejx5cx.js} +9 -9
- package/dist/{search-archive-p3jhx9wc.js → search-archive-s2jas2jb.js} +2 -2
- package/dist/{send-session-notification-ykvt5k2s.js → send-session-notification-7x518gew.js} +1 -1
- package/dist/shared/prompt-surface-runtime.d.ts +1 -1
- package/dist/shared/rpc-notifications.d.ts +8 -3
- package/dist/shared/rpc-notifications.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +4 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/status-summary.d.ts +2 -0
- package/dist/shared/status-summary.d.ts.map +1 -1
- package/dist/shared/status-view-check.d.ts.map +1 -1
- package/dist/shared/status-view.d.ts +1 -0
- package/dist/shared/status-view.d.ts.map +1 -1
- package/dist/shared/user-facing-codes.d.ts +5 -0
- package/dist/shared/user-facing-codes.d.ts.map +1 -1
- package/dist/{store-8trkpmtx.js → store-ggrq9e14.js} +6 -2
- package/dist/{store-reader-3eh1s1m8.js → store-reader-tr64nxyy.js} +1 -1
- package/dist/{task-config-t6bpyka7.js → task-config-qt6n4bxm.js} +1 -1
- package/dist/tools/ctx-memory/constants.d.ts +1 -1
- package/dist/tools/ctx-memory/constants.d.ts.map +1 -1
- package/dist/tools/light-descriptions.d.ts +1 -1
- package/dist/tools/light-descriptions.d.ts.map +1 -1
- package/dist/tools/parameter-descriptions.d.ts +6 -6
- package/dist/tools/parameter-descriptions.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-6kyqctnq.js → transform-postprocess-phase-p2egg02g.js} +15 -15
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +4 -4
- package/dist/v2/{context-dpe94zcx.js → context-zn18k0yk.js} +648 -245
- package/dist/v2/{embedding-backfill-qnaswpmb.js → embedding-backfill-hjvjxp7d.js} +4 -4
- package/dist/v2/fork-inheritance.d.ts +25 -17
- package/dist/v2/fork-inheritance.d.ts.map +1 -1
- package/dist/v2/hidden-child-native.d.ts +6 -6
- package/dist/v2/hidden-child-native.d.ts.map +1 -1
- package/dist/v2/hidden-child-record.d.ts +21 -3
- package/dist/v2/hidden-child-record.d.ts.map +1 -1
- package/dist/v2/hidden-child-sweep.d.ts +1 -1
- package/dist/v2/hidden-child-sweep.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts +1 -0
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hidden-run-holder.d.ts +16 -0
- package/dist/v2/hidden-run-holder.d.ts.map +1 -0
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/dream-timer.d.ts +5 -7
- package/dist/v2/hooks/dream-timer.d.ts.map +1 -1
- package/dist/v2/hooks/fork-history-status.d.ts +10 -0
- package/dist/v2/hooks/fork-history-status.d.ts.map +1 -0
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/store.d.ts +4 -0
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/hooks/types.d.ts +5 -26
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/migration-worker.js +3 -3
- package/dist/v2/{project-embedding-registry-52f2jept.js → project-embedding-registry-mzsvyads.js} +3 -3
- package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
- package/dist/v2/{recomp-orchestrator-7t6fkpbb.js → recomp-orchestrator-jn39mxh0.js} +13 -13
- package/dist/v2/{render-hwqk0d8t.js → render-q2aj9bgy.js} +6 -6
- package/dist/v2/retrospective-raw-provider.d.ts.map +1 -1
- package/dist/v2/{rpc-notifications-3hed126v.js → rpc-notifications-t9q0ynq7.js} +3 -1
- package/dist/v2/{search-eftsvbg7.js → search-9xn6ds9x.js} +8 -8
- package/dist/v2/{search-archive-mdxzvgpm.js → search-archive-fj59gjv1.js} +2 -2
- package/dist/v2/{send-session-notification-8g4r97bp.js → send-session-notification-p52rhjzy.js} +1 -1
- package/dist/v2/{server-ma9jwnas.js → server-1cn3kryt.js} +4 -4
- package/dist/v2/{server-34pvhvxt.js → server-1efjj215.js} +22 -2
- package/dist/v2/{server-92g7d776.js → server-2kswss3d.js} +2 -1
- package/dist/v2/{server-jn4pktdk.js → server-2ktxmtbd.js} +1 -1
- package/dist/v2/{server-zw1e3wq5.js → server-2w1rdttn.js} +1 -1
- package/dist/v2/{server-jtq03rkb.js → server-4z964n1c.js} +1 -1
- package/dist/v2/{server-pxdpwycq.js → server-53n8hv5q.js} +6 -6
- package/dist/v2/{server-rbtx6q5v.js → server-569he5mh.js} +1 -1
- package/dist/v2/{server-rthnpmbp.js → server-5yfq912a.js} +34 -2
- package/dist/v2/{server-mhrgymcs.js → server-68q80y27.js} +2 -2
- package/dist/v2/{server-afsz3cmx.js → server-bt546axy.js} +1 -1
- package/dist/v2/{server-dhdn8mwq.js → server-c8mqs0v5.js} +30 -11
- package/dist/v2/{server-x8a7jmkh.js → server-fzgyvsb1.js} +15 -4
- package/dist/v2/{server-76v5y7zm.js → server-g1a0nhtk.js} +2 -2
- package/dist/v2/{server-25qtxt4d.js → server-gx1s06dx.js} +6 -1
- package/dist/v2/{server-x8ksqcw7.js → server-pejjj0nv.js} +1 -1
- package/dist/v2/{server-a1zp7exh.js → server-vt6nj2hn.js} +106 -35
- package/dist/v2/{server-qjff96a6.js → server-wdq85mxj.js} +4 -4
- package/dist/v2/server.js +3 -3
- package/dist/v2/{store-m3zny7q2.js → store-qdgzd38f.js} +6 -2
- package/dist/v2/{store-reader-yaxtdy6f.js → store-reader-83tka051.js} +1 -1
- package/dist/v2/store-reader.d.ts +15 -8
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{task-config-7md27rx8.js → task-config-ex2vajr2.js} +1 -1
- package/dist/v2/tui/index.d.ts +1 -1
- package/dist/v2/tui/index.d.ts.map +1 -1
- package/dist/v2/{v2-archive-reader-p89x05hj.js → v2-archive-reader-9z8z97db.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-c0bwb0wa.js → wrapup-orchestrator-vd5zfp3v.js} +13 -13
- package/dist/{v2-archive-reader-vzmzb245.js → v2-archive-reader-r0xpxsb1.js} +1 -1
- package/dist/{wrapup-orchestrator-548q5y55.js → wrapup-orchestrator-k29zqfp9.js} +15 -15
- package/package.json +1 -1
- package/src/agents/smart-notes-dreamer-gate.golden.json +169 -169
- package/src/features/magic-context/dreamer/task-registry.ts +8 -0
- package/src/shared/prompt-surface-a1-golden.md +8 -7
- package/src/shared/rpc-notifications.test.ts +29 -0
- package/src/shared/rpc-notifications.ts +24 -5
- package/src/shared/rpc-types.ts +4 -0
- package/src/shared/status-summary.ts +9 -1
- package/src/shared/status-view-check.ts +2 -0
- package/src/shared/status-view.test.ts +9 -0
- package/src/shared/status-view.ts +4 -0
- package/src/shared/user-facing-codes.ts +5 -0
- package/src/tui/slots/sidebar-content.tsx +11 -5
- package/src/tui-compiled/slots/sidebar-content.tsx +191 -176
- package/src/v2/tui/index.ts +7 -2
|
@@ -107,13 +107,13 @@ import {
|
|
|
107
107
|
import {
|
|
108
108
|
shouldSkipHomeProjectMemory,
|
|
109
109
|
resolveProjectIdentity
|
|
110
|
-
} from "./index-
|
|
110
|
+
} from "./index-fpqdbb67.js";
|
|
111
111
|
import {
|
|
112
112
|
getSchemaFenceRejection,
|
|
113
113
|
LATEST_SUPPORTED_VERSION,
|
|
114
114
|
getPersistedSchemaVersion,
|
|
115
115
|
openDatabase
|
|
116
|
-
} from "./index-
|
|
116
|
+
} from "./index-zvane1rq.js";
|
|
117
117
|
import {
|
|
118
118
|
areRustHistorianSyntheticParts2,
|
|
119
119
|
isStrictGapHealingMessage2,
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
resolveStoredPathWorkspaceIdentity,
|
|
131
131
|
sourceNameForMemory,
|
|
132
132
|
computeWorkspaceEpochFingerprint
|
|
133
|
-
} from "./index-
|
|
133
|
+
} from "./index-w2wpx7t5.js";
|
|
134
134
|
import {
|
|
135
135
|
BoundedSessionMap
|
|
136
136
|
} from "./index-jrj95cce.js";
|
|
@@ -202,7 +202,7 @@ import {
|
|
|
202
202
|
getProjectState,
|
|
203
203
|
recordSubagentInvocation,
|
|
204
204
|
getLatestHistorianInvocationId
|
|
205
|
-
} from "./index-
|
|
205
|
+
} from "./index-x8qgqnym.js";
|
|
206
206
|
import {
|
|
207
207
|
clearCompressionDepth,
|
|
208
208
|
clearCompressionDepthRange,
|
|
@@ -269,10 +269,10 @@ import {
|
|
|
269
269
|
getSessionNotes,
|
|
270
270
|
getReadySmartNotes,
|
|
271
271
|
insertPrimerCandidates
|
|
272
|
-
} from "./index-
|
|
272
|
+
} from "./index-bd34njzg.js";
|
|
273
273
|
import {
|
|
274
274
|
pushNotification2
|
|
275
|
-
} from "./index-
|
|
275
|
+
} from "./index-fzgyvsb1.js";
|
|
276
276
|
import {
|
|
277
277
|
computeCueContentHash,
|
|
278
278
|
getMuralCueState,
|
|
@@ -287,13 +287,13 @@ import {
|
|
|
287
287
|
getProjectChunkEmbeddingModelId2,
|
|
288
288
|
getProjectEmbeddingMaxInputTokens2,
|
|
289
289
|
embedItemsWindowBounded2
|
|
290
|
-
} from "./index-
|
|
290
|
+
} from "./index-shpyv8gq.js";
|
|
291
291
|
import {
|
|
292
292
|
renderUserFacingFailure,
|
|
293
293
|
userFacingFailureCode,
|
|
294
294
|
promoteSessionFactsDurable,
|
|
295
295
|
embedPromotedFacts
|
|
296
|
-
} from "./index-
|
|
296
|
+
} from "./index-fgy6hnr3.js";
|
|
297
297
|
import {
|
|
298
298
|
isMarkerCandidateBasisCurrent2,
|
|
299
299
|
invalidateMarkerCandidateBasis2,
|
|
@@ -307,7 +307,7 @@ import {
|
|
|
307
307
|
} from "./index-832w615x.js";
|
|
308
308
|
import {
|
|
309
309
|
sendStatusNotification2
|
|
310
|
-
} from "./index-
|
|
310
|
+
} from "./index-g6hfh4h4.js";
|
|
311
311
|
import {
|
|
312
312
|
isCompactionEnabled,
|
|
313
313
|
migrateLegacyAgentEnabledInMemory
|
|
@@ -321,6 +321,9 @@ import {
|
|
|
321
321
|
import {
|
|
322
322
|
piModelRefToCanonical
|
|
323
323
|
} from "./index-avwt563y.js";
|
|
324
|
+
import {
|
|
325
|
+
sameProjectDirectory
|
|
326
|
+
} from "./index-knvkbfvh.js";
|
|
324
327
|
import {
|
|
325
328
|
getErrorMessage,
|
|
326
329
|
describeError
|
|
@@ -4675,7 +4678,7 @@ function providerOutputFailureFromInvalidManifest(messages, responseText) {
|
|
|
4675
4678
|
}
|
|
4676
4679
|
|
|
4677
4680
|
// src/v2/hooks/hidden-child.ts
|
|
4678
|
-
import { createHash as
|
|
4681
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
4679
4682
|
|
|
4680
4683
|
// src/shared/historian-cache.ts
|
|
4681
4684
|
function withoutHistorianTailCache(body) {
|
|
@@ -4708,6 +4711,43 @@ function withoutHistorianTailCache(body) {
|
|
|
4708
4711
|
return body;
|
|
4709
4712
|
}
|
|
4710
4713
|
|
|
4714
|
+
// src/v2/hidden-run-holder.ts
|
|
4715
|
+
import { createHash as createHash3, randomUUID } from "node:crypto";
|
|
4716
|
+
import { stat } from "node:fs/promises";
|
|
4717
|
+
var HOLDER_PREFIX = "ses_mc_bg_";
|
|
4718
|
+
var HOLDER_CANDIDATES = 3;
|
|
4719
|
+
function isHiddenRunHolder(id) {
|
|
4720
|
+
return id.startsWith(HOLDER_PREFIX);
|
|
4721
|
+
}
|
|
4722
|
+
function supportsQuietHiddenChildren(version) {
|
|
4723
|
+
return typeof version === "string" && /^\d+\.\d+\.\d+$/.test(version) && version !== "2.3.0";
|
|
4724
|
+
}
|
|
4725
|
+
function matchesHiddenRunLocation(wanted, returned) {
|
|
4726
|
+
return sameProjectDirectory(wanted, returned ?? "");
|
|
4727
|
+
}
|
|
4728
|
+
async function hiddenRunPlacement(createHolder, directory) {
|
|
4729
|
+
if (!(await stat(directory)).isDirectory())
|
|
4730
|
+
throw new Error(`Not a run directory: ${directory}`);
|
|
4731
|
+
const base = HOLDER_PREFIX + createHash3("sha256").update(directory).digest("hex").slice(0, 32);
|
|
4732
|
+
const displaced = [];
|
|
4733
|
+
for (let index = 0;index < HOLDER_CANDIDATES; index++) {
|
|
4734
|
+
const id = index === 0 ? base : `${base}_${index + 1}`;
|
|
4735
|
+
const holder = await createHolder({
|
|
4736
|
+
id,
|
|
4737
|
+
title: "Magic Context background runs",
|
|
4738
|
+
location: { directory },
|
|
4739
|
+
metadata: { magic_context: "background-holder" }
|
|
4740
|
+
});
|
|
4741
|
+
if (holder.id !== id || holder.parentID)
|
|
4742
|
+
throw new Error(`OpenCode did not return the expected background holder ${id}`);
|
|
4743
|
+
if (holder.metadata?.magic_context === "background-holder" && matchesHiddenRunLocation(directory, holder.location?.directory)) {
|
|
4744
|
+
return { id: `ses_aut_${randomUUID()}`, parentID: id };
|
|
4745
|
+
}
|
|
4746
|
+
displaced.push(id);
|
|
4747
|
+
}
|
|
4748
|
+
throw new Error(`No background holder at ${directory}; displaced holders: ${displaced.join(", ")}`);
|
|
4749
|
+
}
|
|
4750
|
+
|
|
4711
4751
|
// src/v2/hooks/claude-agent-instructions.ts
|
|
4712
4752
|
var CLAUDE_AGENT_PROVIDER_ID = "claude-agent";
|
|
4713
4753
|
function deliversInstructionsInUserMessage(providerID) {
|
|
@@ -4725,6 +4765,7 @@ ${system}
|
|
|
4725
4765
|
var HIDDEN_HISTORIAN_AGENT = "historian";
|
|
4726
4766
|
var HIDDEN_DREAMER_AGENT = "dreamer-classifier";
|
|
4727
4767
|
var HIDDEN_CURATE_AGENT = DREAMER_AGENT;
|
|
4768
|
+
var HOLDER_CHAT_REFUSAL = "This session holds Magic Context's background runs and can't be used for chat.";
|
|
4728
4769
|
var AGENT_TOOLS = {
|
|
4729
4770
|
[HIDDEN_HISTORIAN_AGENT]: [],
|
|
4730
4771
|
[HIDDEN_DREAMER_AGENT]: [],
|
|
@@ -4912,7 +4953,7 @@ var REFUSAL_PART_DIGESTS = 8;
|
|
|
4912
4953
|
function textDigest(text) {
|
|
4913
4954
|
return {
|
|
4914
4955
|
length: text.length,
|
|
4915
|
-
sha256:
|
|
4956
|
+
sha256: createHash4("sha256").update(text).digest("hex").slice(0, 16)
|
|
4916
4957
|
};
|
|
4917
4958
|
}
|
|
4918
4959
|
function firstDifference(a, b) {
|
|
@@ -4957,7 +4998,7 @@ class HiddenChildHook {
|
|
|
4957
4998
|
}
|
|
4958
4999
|
}
|
|
4959
5000
|
owns(sessionID) {
|
|
4960
|
-
return this.childIDs.has(sessionID);
|
|
5001
|
+
return this.childIDs.has(sessionID) || isHiddenRunHolder(sessionID);
|
|
4961
5002
|
}
|
|
4962
5003
|
async cacheRequest(draft) {
|
|
4963
5004
|
const attempt = this.active.get(draft.sessionID);
|
|
@@ -5048,6 +5089,10 @@ class HiddenChildHook {
|
|
|
5048
5089
|
}
|
|
5049
5090
|
return false;
|
|
5050
5091
|
}
|
|
5092
|
+
if (isHiddenRunHolder(draft.sessionID)) {
|
|
5093
|
+
this.note(`[magic-context] hidden child refused: ${HOLDER_CHAT_REFUSAL} session=${draft.sessionID}`);
|
|
5094
|
+
throw new HiddenCompletionRefusal("hidden_prompt_unrecognized", HOLDER_CHAT_REFUSAL, true);
|
|
5095
|
+
}
|
|
5051
5096
|
const texts = userTexts(draft.messages.at(-1));
|
|
5052
5097
|
const named = new Set;
|
|
5053
5098
|
for (const text of texts) {
|
|
@@ -6496,7 +6541,7 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
6496
6541
|
}
|
|
6497
6542
|
}
|
|
6498
6543
|
// src/shared/prompt-surface-runtime.ts
|
|
6499
|
-
import { createHash as
|
|
6544
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
6500
6545
|
import { existsSync as existsSync5, readFileSync as readFileSync5, statSync as statSync4 } from "node:fs";
|
|
6501
6546
|
import { dirname as dirname4, isAbsolute as isAbsolute3, resolve as resolve2 } from "node:path";
|
|
6502
6547
|
|
|
@@ -6504,7 +6549,7 @@ import { dirname as dirname4, isAbsolute as isAbsolute3, resolve as resolve2 } f
|
|
|
6504
6549
|
var CTX_REDUCE_LIGHT_DESCRIPTION = `Stamp an item as no longer needed for the work ahead. Not a delete: stamping QUEUES it, the item stays readable until Magic Context clears stamped items in one sweep, newest tags are protected, and a cleared item goes to the archive (recent: a [dropped §N§] placeholder; older: removed) recoverable via ctx_expand(tag=N). The question is "does this need to stay on my desk for what comes next?" — a file you keep editing stays, the grep that found it goes. Stamp used reads/searches/outputs, acted-on build/test output, redundant dumps, extracted pasted payloads; keep user messages, your own text, unresolved errors, raw evidence, exact wording that may matter. Look at each tag; never blanket-stamp "1-50". Grammar: "3-5", "1,2,9", "1-5,8,12-15".`;
|
|
6505
6550
|
var CTX_EXPAND_LIGHT_DESCRIPTION = "Recover one item with tag=N (a §N§ or dropped placeholder number), not a message ordinal; text or one tool call with full input/output. message=N and start/end are whole-message ordinals from history/search, never tag numbers. Recover raw conversation behind a <session-history> heading or around a ctx_search hit: ctx_expand(start, end) returns [N] U:/A: lines (~15K-token cap; oversized ranges return the head and where to continue). verbose=true lists messages with per-part previews to pick one; message=N returns that message in full, including a tool output released with ctx_reduce. Ranges after the last compartment are your live tail, not expandable.";
|
|
6506
6551
|
var CTX_NOTE_LIGHT_DESCRIPTION = 'Session notes are pending intentions: work you intend to return to, with findings attached ("take a note" always qualifies). Not active steps, an executing plan, or restart insurance; a record of how things stand (world-state, a design at a point in time) with nothing you intend to do about it — that goes stale silently; a fact worth keeping is memory, the rest is nothing. First line = title (<80 chars). write saves; read lists rows (note_ids for bodies); update changes one; dismiss retires 1–50. Dismiss a note when its work lands or is abandoned; a queue you never dismiss from stops being read. surface_condition parks it until an outside check against repo files, git, GitHub or the web holds.';
|
|
6507
|
-
var CTX_MEMORY_LIGHT_DESCRIPTION = "Durable facts about this project, shared with every agent
|
|
6552
|
+
var CTX_MEMORY_LIGHT_DESCRIPTION = "Durable facts about this project, shared with every agent and kept for the months this work lasts; active ones are already in <project-memory> as `#id: fact`. Write one standalone fact you must not have to find again — a rule, an architecture fact, a constraint, a config value, a naming convention — especially what cost you turns. A pending intention with evidence is ctx_note, not memory. write (content + category); update one id (content + category); archive one or more ids (reason optional); merge 2+ distinct same-category ids (content); get 1–20 ids in any status.";
|
|
6508
6553
|
var CTX_SEARCH_LIGHT_DESCRIPTION = 'Search the archive — everything that ever happened here that is not on your desk: memories not in <project-memory>, compacted conversation, commits, notes. Phrase query as a natural-language question carrying the exact terms you expect ("where is the opencode source code path?", "why did we choose SQLite over postgres?", "how does the dreamer lease work?") — a keyword stack finds less. Sources (omit for all): memory (rules, conventions), message (compacted conversation; hits carry ordinals for ctx_expand), git_commit (when did this change), primer (reusable project Q&A the dreamer distils from recurring questions), note (parked follow-ups). Memory ids alone (`#7234`) resolve directly. from/to restrict every source to an inclusive UTC date range.';
|
|
6509
6554
|
|
|
6510
6555
|
// src/shared/prompt-surface-runtime.ts
|
|
@@ -6529,7 +6574,7 @@ function promptSurfaceHashMaterial(systemContent, preset = "full") {
|
|
|
6529
6574
|
\x00magic-context-prompt-surface:${preset}`;
|
|
6530
6575
|
}
|
|
6531
6576
|
function systemPromptFingerprint(systemContent, preset = "full") {
|
|
6532
|
-
return
|
|
6577
|
+
return createHash5("md5").update(promptSurfaceHashMaterial(systemContent, preset)).digest("hex");
|
|
6533
6578
|
}
|
|
6534
6579
|
var PROMPT_SURFACE_TOOL_ID_SET = new Set(ACTIVE_TOOL_IDS);
|
|
6535
6580
|
function resolveUserConfigDirectory(options) {
|
|
@@ -7224,7 +7269,7 @@ function compareMemorySelectionPriority(left, right) {
|
|
|
7224
7269
|
}
|
|
7225
7270
|
|
|
7226
7271
|
// src/features/magic-context/mural/render-trigger.ts
|
|
7227
|
-
import { createHash as
|
|
7272
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
7228
7273
|
|
|
7229
7274
|
// src/features/magic-context/mural/mural-selection.ts
|
|
7230
7275
|
var DEFAULT_MURAL_MEMORY_BUDGET = 8000;
|
|
@@ -8000,7 +8045,7 @@ function ensureMuralRendered(db, projectIdentity, budgetTokens = DEFAULT_MURAL_M
|
|
|
8000
8045
|
log2(`[mural] skipped for ${projectIdentity}: ${skipReason}`);
|
|
8001
8046
|
return { hasMural: false, rerendered: false, skipReason };
|
|
8002
8047
|
}
|
|
8003
|
-
const textHash =
|
|
8048
|
+
const textHash = createHash6("sha256").update(plan.layout.text).digest("hex");
|
|
8004
8049
|
if (existing && existing.contentHash === textHash && existing.width === plan.width && existing.height === plan.height) {
|
|
8005
8050
|
return rememberRender(db, projectIdentity, key, existing.image, {
|
|
8006
8051
|
hasMural: true,
|
|
@@ -8059,9 +8104,9 @@ function resolveMuralWire(db, projectIdentity, modelKey, enabled, budgetTokens =
|
|
|
8059
8104
|
}
|
|
8060
8105
|
|
|
8061
8106
|
// src/features/magic-context/request-tool-definitions.ts
|
|
8062
|
-
import { createHash as
|
|
8107
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
8063
8108
|
var IDENTITY_SCOPE = "names-descriptions-v1";
|
|
8064
|
-
var sha = (value) =>
|
|
8109
|
+
var sha = (value) => createHash7("sha256").update(JSON.stringify(value)).digest("hex");
|
|
8065
8110
|
function v2ToolDefinitionsHash(tools) {
|
|
8066
8111
|
const pairs = Object.entries(tools).map(([name, tool]) => [name, tool.description]).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0);
|
|
8067
8112
|
return JSON.stringify({
|
|
@@ -8175,7 +8220,7 @@ function classifyRequestToolsChange(previous, current) {
|
|
|
8175
8220
|
function requestToolSchemaDigest(schema) {
|
|
8176
8221
|
const pieces = [];
|
|
8177
8222
|
writeCanonicalJson(toJsonValue(schema, ""), [], pieces);
|
|
8178
|
-
return
|
|
8223
|
+
return createHash7("sha256").update(pieces.join("")).digest("hex");
|
|
8179
8224
|
}
|
|
8180
8225
|
function isJsonValue(value) {
|
|
8181
8226
|
return value !== undefined && typeof value !== "function" && typeof value !== "symbol";
|
|
@@ -8374,14 +8419,14 @@ function parseUserMemoryRow(row) {
|
|
|
8374
8419
|
}
|
|
8375
8420
|
|
|
8376
8421
|
// src/features/magic-context/compaction-marker.ts
|
|
8377
|
-
import { createHash as
|
|
8422
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
8378
8423
|
import { existsSync as existsSync6, statSync as statSync5 } from "node:fs";
|
|
8379
8424
|
var BASE62_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
8380
8425
|
var ID_PREFIX_HEX_LENGTH = 12;
|
|
8381
8426
|
var ID_SUFFIX_LENGTH = 14;
|
|
8382
8427
|
var ID_PREFIX_MASK = (1n << BigInt(ID_PREFIX_HEX_LENGTH * 4)) - 1n;
|
|
8383
8428
|
function deterministicBase62(seed, length) {
|
|
8384
|
-
let value = BigInt(`0x${
|
|
8429
|
+
let value = BigInt(`0x${createHash8("sha256").update(seed).digest("hex")}`);
|
|
8385
8430
|
const chars = Array(length);
|
|
8386
8431
|
for (let index = length - 1;index >= 0; index -= 1) {
|
|
8387
8432
|
chars[index] = BASE62_CHARS[Number(value % 62n)];
|
|
@@ -15485,6 +15530,9 @@ function readCoordinateRebaseNotice(db, sessionId) {
|
|
|
15485
15530
|
}) : [];
|
|
15486
15531
|
return {
|
|
15487
15532
|
generation: record.generation,
|
|
15533
|
+
...Object.hasOwn(record, "inheritedGaps") ? {
|
|
15534
|
+
inheritedGaps: Array.isArray(record.inheritedGaps) ? record.inheritedGaps.flatMap((gap) => gap && typeof gap === "object" && Number.isSafeInteger(gap.start) && Number.isSafeInteger(gap.end) && gap.start >= 1 && gap.end >= gap.start ? [{ start: gap.start, end: gap.end }] : []) : []
|
|
15535
|
+
} : {},
|
|
15488
15536
|
previousGeneration: record.previousGeneration === "v1" || record.previousGeneration === "v2" ? record.previousGeneration : null,
|
|
15489
15537
|
at: count(record.at),
|
|
15490
15538
|
unresolvedCompartments: count(record.unresolvedCompartments),
|
|
@@ -16018,8 +16066,9 @@ function recoverUnresolvedCompartments(args) {
|
|
|
16018
16066
|
const derivedSequences = new Set(result.derived.map((note) => note.sequence));
|
|
16019
16067
|
const notice = {
|
|
16020
16068
|
generation,
|
|
16069
|
+
...previous?.inheritedGaps !== undefined ? { inheritedGaps: previous.inheritedGaps } : {},
|
|
16021
16070
|
previousGeneration: previous?.previousGeneration ?? null,
|
|
16022
|
-
at: previous?.at
|
|
16071
|
+
at: previous?.at || now,
|
|
16023
16072
|
unresolvedCompartments: result.unresolved.length,
|
|
16024
16073
|
discardedReductions: previous?.discardedReductions ?? 0,
|
|
16025
16074
|
droppedDepthRows: previous?.droppedDepthRows ?? 0,
|
|
@@ -17577,17 +17626,9 @@ async function validateBoundarySnapshotOffThread(args, options = {}) {
|
|
|
17577
17626
|
};
|
|
17578
17627
|
}
|
|
17579
17628
|
|
|
17580
|
-
// src/hooks/magic-context/compartment-
|
|
17581
|
-
|
|
17582
|
-
|
|
17583
|
-
if (inconsistentProducerWindows.has(model))
|
|
17584
|
-
return;
|
|
17585
|
-
inconsistentProducerWindows.add(model);
|
|
17586
|
-
sessionLog2(sessionId, `producer window inconsistent for ${model}: window=${window} reserve=${reserve}; sending unguarded`);
|
|
17587
|
-
}
|
|
17588
|
-
var HISTORIAN_ALERT_COOLDOWN_MS = 60 * 1000;
|
|
17589
|
-
function nonNarrativeStoredGapRanges(db, sessionId, compartments) {
|
|
17590
|
-
const rebasedToV2 = readCoordinateRebaseNotice(db, sessionId)?.generation === "v2";
|
|
17629
|
+
// src/hooks/magic-context/stored-compartment-gaps.ts
|
|
17630
|
+
function nonNarrativeStoredGapRanges(db, sessionId, compartments, readRange = (start, end) => readRawSessionMessageRange2(sessionId, start, end), onConversionGap) {
|
|
17631
|
+
const notice = readCoordinateRebaseNotice(db, sessionId);
|
|
17591
17632
|
const safeRanges = [];
|
|
17592
17633
|
for (let index = 0;index < compartments.length; index += 1) {
|
|
17593
17634
|
const previous = compartments[index - 1];
|
|
@@ -17598,14 +17639,44 @@ function nonNarrativeStoredGapRanges(db, sessionId, compartments) {
|
|
|
17598
17639
|
const end = current.startMessage - 1;
|
|
17599
17640
|
if (end < start)
|
|
17600
17641
|
continue;
|
|
17601
|
-
const
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
|
|
17642
|
+
const ordinals = new Set;
|
|
17643
|
+
let valid = true;
|
|
17644
|
+
let needsConversion = false;
|
|
17645
|
+
for (const message of readRange(start, end)) {
|
|
17646
|
+
const { ordinal } = message;
|
|
17647
|
+
if (ordinal < start || ordinal > end) {
|
|
17648
|
+
valid = false;
|
|
17649
|
+
break;
|
|
17650
|
+
}
|
|
17651
|
+
if (!areRustHistorianSyntheticParts2(message.parts)) {
|
|
17652
|
+
const insideInheritedGap = notice?.inheritedGaps?.some((gap) => gap.start <= ordinal && ordinal <= gap.end);
|
|
17653
|
+
if (index === 0 || notice?.generation !== "v2" || insideInheritedGap === false || !isStrictGapHealingMessage2(message)) {
|
|
17654
|
+
valid = false;
|
|
17655
|
+
break;
|
|
17656
|
+
}
|
|
17657
|
+
needsConversion = true;
|
|
17658
|
+
}
|
|
17659
|
+
ordinals.add(ordinal);
|
|
17660
|
+
}
|
|
17661
|
+
if (valid && ordinals.size === end - start + 1) {
|
|
17662
|
+
const gap = { start, end };
|
|
17663
|
+
safeRanges.push(gap);
|
|
17664
|
+
if (needsConversion)
|
|
17665
|
+
onConversionGap?.(gap);
|
|
17666
|
+
}
|
|
17606
17667
|
}
|
|
17607
17668
|
return safeRanges;
|
|
17608
17669
|
}
|
|
17670
|
+
|
|
17671
|
+
// src/hooks/magic-context/compartment-runner-incremental.ts
|
|
17672
|
+
var inconsistentProducerWindows = new Set;
|
|
17673
|
+
function logInconsistentProducerWindowOnce(sessionId, model, window, reserve) {
|
|
17674
|
+
if (inconsistentProducerWindows.has(model))
|
|
17675
|
+
return;
|
|
17676
|
+
inconsistentProducerWindows.add(model);
|
|
17677
|
+
sessionLog2(sessionId, `producer window inconsistent for ${model}: window=${window} reserve=${reserve}; sending unguarded`);
|
|
17678
|
+
}
|
|
17679
|
+
var HISTORIAN_ALERT_COOLDOWN_MS = 60 * 1000;
|
|
17609
17680
|
var lastHistorianAlertBySession = new Map;
|
|
17610
17681
|
var loggedStoredValidationFailures = new Map;
|
|
17611
17682
|
function logStoredValidationFailureOnce(sessionId, error) {
|
|
@@ -19419,4 +19490,4 @@ async function executeContextRecomp(deps, options = {}) {
|
|
|
19419
19490
|
return (await executeContextRecompWithResult(deps, options)).message;
|
|
19420
19491
|
}
|
|
19421
19492
|
|
|
19422
|
-
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, isCommitRetentionPaused, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, providerOutputFailureFromInvalidManifest, 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, hiddenModelCooldowns, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, emptyTokenTotals, sumTokensFromChildMessages, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, stripMemoryMuralBlock, servedHeadTexts, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, headMessagesForSizing, rawTailAfterNewestCompartment, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, readHistorianFailureStreak, describeHistorianJoinRefusal, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|
|
19493
|
+
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, isCommitRetentionPaused, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, providerOutputFailureFromInvalidManifest, supportsQuietHiddenChildren, matchesHiddenRunLocation, hiddenRunPlacement, 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, hiddenModelCooldowns, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, emptyTokenTotals, sumTokensFromChildMessages, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, validateStoredCompartments, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, stripMemoryMuralBlock, servedHeadTexts, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, headMessagesForSizing, rawTailAfterNewestCompartment, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, readHistorianFailureStreak, describeHistorianJoinRefusal, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, nonNarrativeStoredGapRanges, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
enqueueShadowEmbeddingItems2,
|
|
39
39
|
getProjectEmbeddingSnapshot2,
|
|
40
40
|
embedItemsForProject2
|
|
41
|
-
} from "./index-
|
|
41
|
+
} from "./index-shpyv8gq.js";
|
|
42
42
|
import {
|
|
43
43
|
recordEmbeddingMeasurement
|
|
44
44
|
} from "./index-2amn2s73.js";
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
sanitizeFtsQuery,
|
|
55
55
|
searchMemoriesFTS,
|
|
56
56
|
searchMemoriesFTSUnion
|
|
57
|
-
} from "./index-
|
|
57
|
+
} from "./index-fgy6hnr3.js";
|
|
58
58
|
import {
|
|
59
59
|
ModuleMemoryAuthorityError2,
|
|
60
60
|
getMemoriesByProject2,
|
|
@@ -71,10 +71,10 @@ import {
|
|
|
71
71
|
withMemoryHintContent,
|
|
72
72
|
autoSearchRelevance,
|
|
73
73
|
recordAutoSearchLane
|
|
74
|
-
} from "./index-
|
|
74
|
+
} from "./index-rnyaa7cj.js";
|
|
75
75
|
import {
|
|
76
76
|
ensureMemoryEmbeddings2
|
|
77
|
-
} from "./index-
|
|
77
|
+
} from "./index-w8dcjt7f.js";
|
|
78
78
|
import {
|
|
79
79
|
MESSAGE_FTS_SESSION_FILTER_SQL,
|
|
80
80
|
withMessageFtsSessionFilter
|
|
@@ -88,11 +88,11 @@ import {
|
|
|
88
88
|
expandWorkspaceIdentitySetWithAliases,
|
|
89
89
|
resolveStoredPathWorkspaceIdentity,
|
|
90
90
|
sourceNameForMemory
|
|
91
|
-
} from "./index-
|
|
91
|
+
} from "./index-w2wpx7t5.js";
|
|
92
92
|
import {
|
|
93
93
|
getNotes,
|
|
94
94
|
getActivePrimers
|
|
95
|
-
} from "./index-
|
|
95
|
+
} from "./index-bd34njzg.js";
|
|
96
96
|
import {
|
|
97
97
|
isKnownAutocommit
|
|
98
98
|
} from "./index-8ajstryz.js";
|
|
@@ -439,7 +439,7 @@ class V2StoreReader2 {
|
|
|
439
439
|
const order = columns.has("time_updated") ? "time_updated DESC, id DESC" : "id DESC";
|
|
440
440
|
const page = this.prepare(`SELECT id, COALESCE(directory, '') AS directory FROM session_v2
|
|
441
441
|
WHERE parent_id IS NULL${archived}
|
|
442
|
-
AND COALESCE(json_extract(metadata, '$.magic_context'), '')
|
|
442
|
+
AND COALESCE(json_extract(metadata, '$.magic_context'), '') NOT IN ('hidden-run', 'background-holder')
|
|
443
443
|
ORDER BY ${order} LIMIT ? OFFSET ?`);
|
|
444
444
|
const pageSize = 500;
|
|
445
445
|
for (let offset = 0;; offset += pageSize) {
|
|
@@ -460,7 +460,7 @@ class V2StoreReader2 {
|
|
|
460
460
|
WHERE session_id = session_v2.id AND type = 'user'
|
|
461
461
|
) AS time FROM session_v2
|
|
462
462
|
WHERE parent_id IS NULL
|
|
463
|
-
AND COALESCE(json_extract(metadata, '$.magic_context'), '')
|
|
463
|
+
AND COALESCE(json_extract(metadata, '$.magic_context'), '') NOT IN ('hidden-run', 'background-holder')
|
|
464
464
|
AND id IN (${chunk.map(() => "?").join(",")})`).all(...chunk);
|
|
465
465
|
for (const row of rows)
|
|
466
466
|
if (row.time !== null)
|
|
@@ -746,6 +746,38 @@ class V2StoreReader2 {
|
|
|
746
746
|
return this.prepare(`SELECT id, type, seq, time_created FROM session_message
|
|
747
747
|
WHERE session_id = ? AND seq <= ? ORDER BY seq ASC`).all(sessionID, throughSeq);
|
|
748
748
|
}
|
|
749
|
+
matchingForkBodies(parentID, forkID, throughSeq) {
|
|
750
|
+
const matchParts = this.hasPartTable() ? `
|
|
751
|
+
AND NOT EXISTS (
|
|
752
|
+
SELECT ordinal, type, call_id, data FROM session_part WHERE message_id = p.id
|
|
753
|
+
EXCEPT SELECT ordinal, type, call_id, data FROM session_part WHERE message_id = f.id
|
|
754
|
+
) AND NOT EXISTS (
|
|
755
|
+
SELECT ordinal, type, call_id, data FROM session_part WHERE message_id = f.id
|
|
756
|
+
EXCEPT SELECT ordinal, type, call_id, data FROM session_part WHERE message_id = p.id
|
|
757
|
+
)` : "";
|
|
758
|
+
const rows = this.prepare(`SELECT p.id AS parentId, f.id AS forkId FROM session_message p JOIN session_message f ON f.seq = p.seq
|
|
759
|
+
WHERE p.session_id = ? AND f.session_id = ? AND p.seq <= ?
|
|
760
|
+
AND p.type = f.type AND p.time_created = f.time_created AND p.data = f.data${matchParts}`).all(parentID, forkID, throughSeq);
|
|
761
|
+
return new Map(rows.map(({ parentId, forkId }) => [parentId, forkId]));
|
|
762
|
+
}
|
|
763
|
+
*iterateRawMessageRange(sessionID, from, to) {
|
|
764
|
+
if (!Number.isSafeInteger(from) || !Number.isSafeInteger(to) || from < 1 || to < from)
|
|
765
|
+
return;
|
|
766
|
+
let anchor;
|
|
767
|
+
for (let after = from - 1;after < to; after += 1) {
|
|
768
|
+
const [row] = this.messagePage(sessionID, after, 1, to, anchor);
|
|
769
|
+
if (!row)
|
|
770
|
+
return;
|
|
771
|
+
anchor = { id: row.id, timeCreated: row.time_created ?? 0 };
|
|
772
|
+
yield row;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
messageCountAndNewestId(sessionID) {
|
|
776
|
+
const row = this.prepare(`SELECT COUNT(*) AS count, (
|
|
777
|
+
SELECT id FROM session_message WHERE session_id = ? ORDER BY seq DESC LIMIT 1
|
|
778
|
+
) AS newestId FROM session_message WHERE session_id = ?`).get(sessionID, sessionID);
|
|
779
|
+
return [row.count, row.newestId];
|
|
780
|
+
}
|
|
749
781
|
latestSequenceForIds(sessionID, ids) {
|
|
750
782
|
let latest = -1;
|
|
751
783
|
for (let offset = 0;offset < ids.length; offset += 500) {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getCompartments,
|
|
10
10
|
getLastCompartmentEndMessage,
|
|
11
11
|
requestPendingMaterialization
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-x8qgqnym.js";
|
|
13
13
|
import {
|
|
14
14
|
inRootAsyncContext2
|
|
15
15
|
} from "./index-gzy5w8ya.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from "./index-2q0t43fy.js";
|
|
27
27
|
import {
|
|
28
28
|
pushNotification2
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-fzgyvsb1.js";
|
|
30
30
|
import {
|
|
31
31
|
describeBoundaryDiagnostics,
|
|
32
32
|
resolveWrapupProtectedTailBoundary,
|
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
getActiveCompartmentRun,
|
|
36
36
|
markActiveCompartmentRunPublished,
|
|
37
37
|
registerActiveCompartmentRun
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-b2787fk6.js";
|
|
39
39
|
import {
|
|
40
40
|
sendStatusNotification2
|
|
41
|
-
} from "./index-
|
|
41
|
+
} from "./index-g6hfh4h4.js";
|
|
42
42
|
import {
|
|
43
43
|
setRecompStarting2,
|
|
44
44
|
setRecompTerminal2
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-hz1xdb15.js";
|
|
46
46
|
|
|
47
47
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
|
48
48
|
import * as crypto from "node:crypto";
|