@cortexkit/opencode-magic-context 0.49.35 → 0.49.36
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/README.md +1 -1
- package/dist/auto-search-worker.js +163 -160
- package/dist/chunk-embedding-write-worker.js +58 -56
- package/dist/{compaction-marker-candidates-g0p67ced.js → compaction-marker-candidates-5p1qkve9.js} +3 -1
- package/dist/compaction-marker-candidates-worker.js +24 -23
- package/dist/{compartment-chunk-embedding-y4136are.js → compartment-chunk-embedding-ypktm0tk.js} +5 -4
- package/dist/{conflict-warning-hook-hhw8z5ak.js → conflict-warning-hook-b75jn458.js} +6 -5
- package/dist/{context-fk8e3h9p.js → context-969z683s.js} +485 -91
- package/dist/{embedding-backfill-q6n72sy0.js → embedding-backfill-rma0v2ct.js} +9 -8
- package/dist/embedding-worker.js +2 -2
- package/dist/features/magic-context/compaction-marker-candidates.d.ts.map +1 -1
- package/dist/features/magic-context/compaction-marker.d.ts +5 -3
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-gate.d.ts +2 -0
- package/dist/features/magic-context/dreamer/verify-gate.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-state.d.ts +9 -0
- package/dist/features/magic-context/dreamer/verify-state.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/verify.d.ts +2 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/migration-worker-client.d.ts +3 -0
- package/dist/features/magic-context/migration-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/migration-worker.d.ts +15 -0
- package/dist/features/magic-context/migration-worker.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +2 -2
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/search-rerank.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +4 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/work-metrics-carry-storage.d.ts +10 -0
- package/dist/features/magic-context/work-metrics-carry-storage.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts +5 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/issue-423-fixture.d.ts +1 -1
- package/dist/hooks/magic-context/issue-423-fixture.d.ts.map +1 -1
- package/dist/hooks/magic-context/issue-424-fixture.d.ts +1 -1
- package/dist/hooks/magic-context/issue-424-fixture.d.ts.map +1 -1
- package/dist/hooks/magic-context/project-structural-sentinels.d.ts +25 -0
- package/dist/hooks/magic-context/project-structural-sentinels.d.ts.map +1 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +8 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +2 -0
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/release-recovery-prefix.d.ts +9 -0
- package/dist/hooks/magic-context/release-recovery-prefix.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-structural-noise.d.ts +6 -3
- package/dist/hooks/magic-context/strip-structural-noise.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts +3 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +3 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-cpjk5jd2.js → index-1d042x6w.js} +16 -14
- package/dist/{index-jn0ddrhp.js → index-21fgrfrf.js} +8 -6
- package/dist/{index-pq0dpwrc.js → index-2rs7912w.js} +2 -2
- package/dist/{index-ezv6dz3y.js → index-4ks89h5a.js} +4 -4
- package/dist/{index-vzhhr1ht.js → index-4y35msh5.js} +1 -2
- package/dist/{index-f297z1n8.js → index-72czy45z.js} +5 -5
- package/dist/index-7v05d9b7.js +58 -0
- package/dist/{index-f9b3vtt1.js → index-850vthn3.js} +8 -2
- package/dist/{index-ksv0a31x.js → index-8jjjmhab.js} +12 -1
- package/dist/index-96ztjvkn.js +204 -0
- package/dist/{index-gyaa159j.js → index-9fgmkfaf.js} +6 -3
- package/dist/{index-4bgk5ztz.js → index-9tdvbdv1.js} +187 -90
- package/dist/{index-2v6nvy3k.js → index-ae1ar4v1.js} +1 -1
- package/dist/{index-faxb7mck.js → index-b1ydbp95.js} +1 -1
- package/dist/{index-nxrsns5x.js → index-c5dzns43.js} +75 -75
- package/dist/{index-zhqwda72.js → index-dcjkw41m.js} +1 -1
- package/dist/{index-x2mrq5xv.js → index-dfdg2cgg.js} +179 -49
- package/dist/{index-87ctnzz9.js → index-dz48h1wx.js} +2 -2
- package/dist/{index-b6xz3qbe.js → index-gnmhbyyc.js} +366 -83
- package/dist/{index-qx8j6kds.js → index-j105mf16.js} +2 -2
- package/dist/{index-p56dszfp.js → index-jggt5gf2.js} +1 -1
- package/dist/{index-xwwsbsd3.js → index-pp8vdn01.js} +5 -5
- package/dist/{index-dy7w6wm4.js → index-prw8apnc.js} +5 -5
- package/dist/{index-qncw9hey.js → index-r2epb000.js} +33 -3
- package/dist/{index-brg2w6qc.js → index-tn9drm1a.js} +16 -14
- package/dist/{index-pswsyf1w.js → index-ty4vhe4n.js} +3 -3
- package/dist/{index-pztqab6k.js → index-vd2ywmfe.js} +1 -1
- package/dist/{index-3j9t1v4n.js → index-wcwhhtdh.js} +10 -9
- package/dist/{index-1rhgxqs8.js → index-xd2p95m7.js} +1 -1
- package/dist/{index-0c7p8mq5.js → index-xnm0wq1r.js} +1 -1
- package/dist/{index-3d3872c6.js → index-ys7j6679.js} +4 -4
- package/dist/index.js +38 -37
- package/dist/{message-fts-rowid-map-xg7hr0mk.js → message-fts-rowid-map-t6qsyg9s.js} +4 -3
- package/dist/{message-index-bounded-narw7bnz.js → message-index-bounded-wfk6aqxk.js} +9 -8
- package/dist/migration-worker.js +45 -40
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{project-embedding-registry-tdz7985n.js → project-embedding-registry-3yyegjma.js} +8 -7
- package/dist/raw-ordinal-warmup-worker.js +114 -118
- package/dist/{read-session-chunk-vmg1zjg0.js → read-session-chunk-26yrrhyz.js} +7 -6
- package/dist/{read-session-raw-mncmzbm9.js → read-session-raw-j7c9w57v.js} +3 -2
- package/dist/{recomp-orchestrator-qyyhnc9b.js → recomp-orchestrator-wk509qkp.js} +20 -19
- package/dist/{render-c5p0k846.js → render-h1qarr8a.js} +13 -12
- package/dist/{search-f6hwvcxk.js → search-5h9fydyq.js} +16 -15
- package/dist/{search-archive-0ny7p3bw.js → search-archive-q79hyqxs.js} +9 -8
- package/dist/{send-session-notification-0gwcz3fw.js → send-session-notification-14p3yje4.js} +5 -4
- package/dist/shared/model-suggestion-retry.d.ts +7 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/prompt-async-transport.d.ts.map +1 -1
- package/dist/shared/reusable-worker-entry.d.ts +4 -0
- package/dist/shared/reusable-worker-entry.d.ts.map +1 -0
- package/dist/shared/reusable-worker.d.ts +6 -0
- package/dist/shared/reusable-worker.d.ts.map +1 -0
- package/dist/shared/reusable-worker.fixture.d.ts +2 -0
- package/dist/shared/reusable-worker.fixture.d.ts.map +1 -0
- package/dist/shared/worker-shutdown.d.ts +1 -1
- package/dist/shared/worker-shutdown.d.ts.map +1 -1
- package/dist/{storage-tags-zx1023km.js → storage-tags-vj0yj7ed.js} +1 -1
- package/dist/{store-620rjzt9.js → store-s3eykdjt.js} +1 -1
- package/dist/{transform-postprocess-phase-807ff6t2.js → transform-postprocess-phase-4gj0mtcg.js} +21 -20
- package/dist/v2/auto-search-worker.js +163 -160
- package/dist/v2/chunk-embedding-write-worker.js +59 -57
- package/dist/v2/compaction-marker-candidates-worker.js +24 -23
- package/dist/v2/{compaction-marker-candidates-t1aq6gsj.js → compaction-marker-candidates-yeb2ky46.js} +4 -2
- package/dist/v2/{compartment-chunk-embedding-ncsk0r9e.js → compartment-chunk-embedding-qfk791bd.js} +6 -5
- package/dist/v2/{context-znqfkap4.js → context-bxr039be.js} +1011 -209
- package/dist/v2/{embedding-backfill-11j425e0.js → embedding-backfill-00tw59rx.js} +10 -9
- package/dist/v2/embedding-worker.js +2 -2
- package/dist/v2/fold/code-mode-catalog.d.ts +3 -0
- package/dist/v2/fold/code-mode-catalog.d.ts.map +1 -0
- package/dist/v2/fold/idle.d.ts +1 -0
- package/dist/v2/fold/idle.d.ts.map +1 -1
- package/dist/v2/fold/manual-baseline.d.ts +8 -0
- package/dist/v2/fold/manual-baseline.d.ts.map +1 -0
- package/dist/v2/fold/native-replay-v3.d.ts +7 -0
- package/dist/v2/fold/native-replay-v3.d.ts.map +1 -1
- package/dist/v2/fold/native-replay.d.ts +24 -7
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/fold/summary.d.ts +4 -0
- package/dist/v2/fold/summary.d.ts.map +1 -0
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/channel2.d.ts +6 -0
- package/dist/v2/hooks/channel2.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/restore-rows.d.ts +12 -2
- package/dist/v2/hooks/restore-rows.d.ts.map +1 -1
- package/dist/v2/hooks/synthetic-admission.d.ts +7 -0
- package/dist/v2/hooks/synthetic-admission.d.ts.map +1 -0
- package/dist/v2/hooks/usage-persist.d.ts.map +1 -1
- package/dist/v2/{message-fts-rowid-map-rmk571mb.js → message-fts-rowid-map-z86avy0n.js} +5 -4
- package/dist/v2/{message-index-bounded-620bppw7.js → message-index-bounded-w14496s9.js} +9 -8
- package/dist/v2/migration-worker.js +46 -41
- package/dist/v2/{project-embedding-registry-bm5fe1a8.js → project-embedding-registry-jqq2qeqb.js} +9 -8
- package/dist/v2/raw-ordinal-warmup-worker.js +114 -118
- package/dist/v2/{read-session-chunk-qfwv1k71.js → read-session-chunk-tqnh1ret.js} +7 -6
- package/dist/v2/{read-session-raw-q294t8xs.js → read-session-raw-qpp6x9kg.js} +4 -3
- package/dist/v2/{recomp-orchestrator-fcnjref7.js → recomp-orchestrator-9cjk6aej.js} +19 -18
- package/dist/v2/{render-98a1qv0b.js → render-5dz1knf2.js} +13 -12
- package/dist/v2/{search-z1zqzsmh.js → search-8yfet25y.js} +15 -14
- package/dist/v2/{search-archive-r0y1bafr.js → search-archive-z6z9jqwf.js} +9 -8
- package/dist/v2/{send-session-notification-fst6hkg7.js → send-session-notification-kxp47tsw.js} +4 -3
- package/dist/v2/{server-cpjk5jd2.js → server-1d042x6w.js} +16 -14
- package/dist/v2/{server-fqj6ddpr.js → server-5by3vdzs.js} +186 -89
- package/dist/v2/{server-5jp38p98.js → server-6emy0v9a.js} +1 -2
- package/dist/v2/{server-rktnzs89.js → server-6vzh6wej.js} +1 -1
- package/dist/v2/{server-qa74bj91.js → server-7094pk3w.js} +9 -8
- package/dist/v2/{server-bxpz2dcn.js → server-7acq7815.js} +8 -6
- package/dist/v2/server-7v05d9b7.js +58 -0
- package/dist/v2/{server-24g8r2d0.js → server-7zacmty5.js} +75 -75
- package/dist/v2/server-96ztjvkn.js +204 -0
- package/dist/v2/{server-hnknwaz8.js → server-a9w5f0yw.js} +3 -3
- package/dist/v2/{server-9k0mjef7.js → server-avdveykk.js} +1 -1
- package/dist/v2/{server-hsf0qsn5.js → server-cp1a03vc.js} +1 -1
- package/dist/v2/{server-r3chnxs5.js → server-dfq5vb8j.js} +2 -2
- package/dist/v2/{server-x4m6xcn4.js → server-e51xmr4d.js} +6 -6
- package/dist/v2/{server-7ccxt4nq.js → server-g3gqq4ac.js} +6 -3
- package/dist/v2/{server-kkxzwa6w.js → server-gkse1wyz.js} +3 -3
- package/dist/v2/{server-1xesqm5h.js → server-jd7vzwn4.js} +15 -13
- package/dist/v2/{server-ws5exe6q.js → server-nmyganc8.js} +1 -1
- package/dist/v2/{server-q0z2q2dx.js → server-nq3cb7be.js} +1 -1
- package/dist/v2/{server-55v5hpth.js → server-qjyp27vf.js} +2 -2
- package/dist/v2/{server-xbtw0p9t.js → server-r4430x9m.js} +9 -3
- package/dist/v2/{server-qf2kzsh2.js → server-t8y64xj7.js} +4 -4
- package/dist/v2/{server-s9xgyyj9.js → server-tnzbk64q.js} +34 -4
- package/dist/v2/{server-51779zs2.js → server-v0p37hm2.js} +4 -1
- package/dist/v2/{server-bpvsvtph.js → server-xfjjbrkt.js} +12 -1
- package/dist/v2/server.js +4 -4
- package/dist/v2/{storage-tags-19s0ebf0.js → storage-tags-cw07ky67.js} +1 -1
- package/dist/v2/{store-vdm8v3jd.js → store-z3qe67cg.js} +1 -1
- package/dist/v2/{v2-archive-reader-t2c0eypn.js → v2-archive-reader-z7wr42ry.js} +3 -3
- package/dist/v2/{wrapup-orchestrator-aqpqsveg.js → wrapup-orchestrator-j1v62bkj.js} +19 -18
- package/dist/{v2-archive-reader-tm2eayp2.js → v2-archive-reader-028z6kck.js} +2 -2
- package/dist/{wrapup-orchestrator-k5yp19a6.js → wrapup-orchestrator-xg9avt2p.js} +21 -20
- package/package.json +1 -1
- package/src/shared/model-suggestion-retry.ts +1 -1
- package/src/shared/prompt-async-transport.test.ts +64 -3
- package/src/shared/prompt-async-transport.ts +61 -16
- package/src/shared/reusable-worker-entry.ts +58 -0
- package/src/shared/reusable-worker-reset.test.ts +108 -0
- package/src/shared/reusable-worker.fixture.ts +35 -0
- package/src/shared/reusable-worker.test.ts +253 -0
- package/src/shared/reusable-worker.ts +240 -0
- package/src/shared/worker-shutdown.ts +21 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-7zacmty5.js";
|
|
4
4
|
import {
|
|
5
5
|
embedPauseBySession,
|
|
6
6
|
activeEmbeddingSessions,
|
|
@@ -28,9 +28,12 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
sanitizeDiagnosticText
|
|
30
30
|
} from "./server-z4p0ry94.js";
|
|
31
|
+
import {
|
|
32
|
+
reuseWorker
|
|
33
|
+
} from "./server-96ztjvkn.js";
|
|
31
34
|
import {
|
|
32
35
|
createWorkerShutdown
|
|
33
|
-
} from "./server-
|
|
36
|
+
} from "./server-1d042x6w.js";
|
|
34
37
|
import {
|
|
35
38
|
SYNAPSE_DEFAULT_MODEL,
|
|
36
39
|
isSynapseEmbeddingTruncated,
|
|
@@ -57,7 +60,7 @@ import {
|
|
|
57
60
|
countSessionCompartmentEmbedCoverage2,
|
|
58
61
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
59
62
|
countUnembeddedSessionCompartmentsPolite2
|
|
60
|
-
} from "./server-
|
|
63
|
+
} from "./server-cp1a03vc.js";
|
|
61
64
|
import {
|
|
62
65
|
acquireGitSweepLease,
|
|
63
66
|
renewGitSweepLease,
|
|
@@ -80,7 +83,7 @@ import {
|
|
|
80
83
|
logLocalEmbeddingPoolingUnavailableOnce,
|
|
81
84
|
getEmbeddingProviderIdentity,
|
|
82
85
|
LocalEmbeddingProvider
|
|
83
|
-
} from "./server-
|
|
86
|
+
} from "./server-6vzh6wej.js";
|
|
84
87
|
import {
|
|
85
88
|
isKnownAutocommit
|
|
86
89
|
} from "./server-8ajstryz.js";
|
|
@@ -92,7 +95,6 @@ import {
|
|
|
92
95
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
93
96
|
|
|
94
97
|
// src/features/magic-context/chunk-embedding-writer.ts
|
|
95
|
-
import { Worker } from "node:worker_threads";
|
|
96
98
|
function createChunkEmbeddingWriter(db) {
|
|
97
99
|
const path = getSqliteDatabasePath2(db);
|
|
98
100
|
if (!path)
|
|
@@ -101,7 +103,7 @@ function createChunkEmbeddingWriter(db) {
|
|
|
101
103
|
throw new Error("chunk embedding writer requires a filesystem path");
|
|
102
104
|
const entry = new URL(import.meta.url.endsWith(".ts") ? "./chunk-embedding-write-worker.ts" : "./chunk-embedding-write-worker.js", import.meta.url);
|
|
103
105
|
const timeout = db.prepare("PRAGMA busy_timeout").get().timeout;
|
|
104
|
-
const worker = inRootAsyncContext2(() =>
|
|
106
|
+
const worker = inRootAsyncContext2(() => reuseWorker(entry, { workerData: { path, harness: getHarness2(), timeout } }));
|
|
105
107
|
const shutdown = createWorkerShutdown(worker, "chunk-embedding-writer", timeout + 2000);
|
|
106
108
|
let pending;
|
|
107
109
|
let failure;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/shared/reusable-worker-entry.ts
|
|
2
|
+
import { EventEmitter } from "node:events";
|
|
3
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
4
|
+
function serveWorkerJobs(run, autoClose = true) {
|
|
5
|
+
if (!parentPort)
|
|
6
|
+
throw new Error("worker requires a parent port");
|
|
7
|
+
const parent = parentPort;
|
|
8
|
+
if (!workerData?.reusableWorker) {
|
|
9
|
+
Promise.resolve(run(workerData, parent)).catch(rethrow);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let active;
|
|
13
|
+
parent.on("message", (message) => {
|
|
14
|
+
if (!("start" in message)) {
|
|
15
|
+
if (active?.id === message.jobId)
|
|
16
|
+
active.port.emit("message", message.value);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (active)
|
|
20
|
+
throw new Error("reusable worker received overlapping jobs");
|
|
21
|
+
const id = message.jobId;
|
|
22
|
+
let closed = false;
|
|
23
|
+
const port = Object.assign(new EventEmitter, {
|
|
24
|
+
postMessage(value, transferList) {
|
|
25
|
+
if (!closed)
|
|
26
|
+
parent.postMessage({ jobId: id, value }, transferList);
|
|
27
|
+
},
|
|
28
|
+
close() {
|
|
29
|
+
if (closed)
|
|
30
|
+
return;
|
|
31
|
+
closed = true;
|
|
32
|
+
port.removeAllListeners();
|
|
33
|
+
active = undefined;
|
|
34
|
+
parent.postMessage({
|
|
35
|
+
jobId: id,
|
|
36
|
+
finished: true,
|
|
37
|
+
code: Number(process.exitCode) || 0
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
active = { id, port };
|
|
42
|
+
try {
|
|
43
|
+
Promise.resolve(run(message.start, port)).then(() => {
|
|
44
|
+
if (autoClose)
|
|
45
|
+
port.close();
|
|
46
|
+
}).catch(rethrow);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
rethrow(error);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function rethrow(error) {
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
throw error;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { serveWorkerJobs };
|
|
@@ -997,8 +997,8 @@ function datetime(args) {
|
|
|
997
997
|
}
|
|
998
998
|
var anyString = /^[\s\S]{0,}$/;
|
|
999
999
|
var integer = /^-?\d+$/;
|
|
1000
|
-
var
|
|
1001
|
-
var
|
|
1000
|
+
var number2 = /^-?\d+(?:\.\d+)?$/;
|
|
1001
|
+
var boolean2 = /^(?:true|false)$/i;
|
|
1002
1002
|
var lowercase = /^[^A-Z]*$/;
|
|
1003
1003
|
var uppercase = /^[^a-z]*$/;
|
|
1004
1004
|
|
|
@@ -1855,7 +1855,7 @@ var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
|
1855
1855
|
});
|
|
1856
1856
|
var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
1857
1857
|
$ZodType.init(inst, def);
|
|
1858
|
-
inst._zod.pattern =
|
|
1858
|
+
inst._zod.pattern = number2;
|
|
1859
1859
|
inst._zod.parse = (payload, _ctx) => {
|
|
1860
1860
|
if (def.coerce)
|
|
1861
1861
|
try {
|
|
@@ -1882,7 +1882,7 @@ var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, d
|
|
|
1882
1882
|
});
|
|
1883
1883
|
var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
1884
1884
|
$ZodType.init(inst, def);
|
|
1885
|
-
inst._zod.pattern =
|
|
1885
|
+
inst._zod.pattern = boolean2;
|
|
1886
1886
|
inst._zod.parse = (payload, _ctx) => {
|
|
1887
1887
|
if (def.coerce)
|
|
1888
1888
|
try {
|
|
@@ -2683,7 +2683,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
2683
2683
|
if (keyResult instanceof Promise) {
|
|
2684
2684
|
throw new Error("Async schemas not supported in object keys currently");
|
|
2685
2685
|
}
|
|
2686
|
-
const checkNumericKey = typeof key === "string" &&
|
|
2686
|
+
const checkNumericKey = typeof key === "string" && number2.test(key) && keyResult.issues.length;
|
|
2687
2687
|
if (checkNumericKey) {
|
|
2688
2688
|
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
2689
2689
|
if (retryResult instanceof Promise) {
|
|
@@ -4882,7 +4882,7 @@ function stringifyKeyNames(bySchema, json, visited) {
|
|
|
4882
4882
|
return rest;
|
|
4883
4883
|
rest.type = "string";
|
|
4884
4884
|
if (!values)
|
|
4885
|
-
rest.pattern = (types.includes("number") ?
|
|
4885
|
+
rest.pattern = (types.includes("number") ? number2 : integer).source;
|
|
4886
4886
|
return rest;
|
|
4887
4887
|
}
|
|
4888
4888
|
var pendingRecords = new WeakMap;
|
|
@@ -5583,7 +5583,7 @@ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
|
5583
5583
|
return this;
|
|
5584
5584
|
}
|
|
5585
5585
|
}));
|
|
5586
|
-
function
|
|
5586
|
+
function number(params) {
|
|
5587
5587
|
return _number(ZodNumber, params);
|
|
5588
5588
|
}
|
|
5589
5589
|
var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
|
|
@@ -5598,7 +5598,7 @@ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
|
5598
5598
|
ZodType.init(inst, def);
|
|
5599
5599
|
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
5600
5600
|
});
|
|
5601
|
-
function
|
|
5601
|
+
function boolean(params) {
|
|
5602
5602
|
return _boolean(ZodBoolean, params);
|
|
5603
5603
|
}
|
|
5604
5604
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
@@ -6565,17 +6565,17 @@ var PermissionSchema = object({
|
|
|
6565
6565
|
}).optional();
|
|
6566
6566
|
var AgentOverrideConfigSchema = object({
|
|
6567
6567
|
model: string().optional().describe("Primary model ID (e.g. 'claude-sonnet-4-6')"),
|
|
6568
|
-
temperature:
|
|
6569
|
-
top_p:
|
|
6568
|
+
temperature: number().min(0).max(2).optional().describe("Sampling temperature (0-2)"),
|
|
6569
|
+
top_p: number().min(0).max(1).optional().describe("Nucleus sampling top_p (0-1)"),
|
|
6570
6570
|
prompt: string().optional().describe("Additional system prompt text"),
|
|
6571
|
-
tools: record(string(),
|
|
6572
|
-
disable:
|
|
6571
|
+
tools: record(string(), boolean()).optional().describe("Tool enable/disable overrides"),
|
|
6572
|
+
disable: boolean().optional().describe("Disable this agent"),
|
|
6573
6573
|
description: string().optional().describe("Agent description"),
|
|
6574
6574
|
mode: _enum(["subagent", "primary", "all"]).optional().describe("Agent mode (subagent, primary, or all)"),
|
|
6575
6575
|
color: string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("Hex color for the agent (e.g. '#a1b2c3')"),
|
|
6576
|
-
maxSteps:
|
|
6576
|
+
maxSteps: number().optional().describe("Maximum tool-call steps per invocation"),
|
|
6577
6577
|
permission: PermissionSchema.describe("Per-tool permission overrides"),
|
|
6578
|
-
maxTokens:
|
|
6578
|
+
maxTokens: number().optional().describe("Maximum output tokens"),
|
|
6579
6579
|
variant: string().optional().describe("OpenCode reasoning variant (e.g. for extended thinking)"),
|
|
6580
6580
|
fallback_models: union([string(), array(string())]).optional().describe("Fallback model IDs if primary is unavailable")
|
|
6581
6581
|
});
|
|
@@ -6691,19 +6691,19 @@ var OpenCodeTaskExecutionSchema = object({
|
|
|
6691
6691
|
model: OcEntrySchema.optional().describe("OpenCode model entry for this task."),
|
|
6692
6692
|
fallback_models: array(OcEntrySchema).optional().describe("Ordered OpenCode fallback entries for this task."),
|
|
6693
6693
|
variant: string().optional().describe("OpenCode reasoning variant for this task's primary entry when it declares none. Fallback entries declare variants per-entry."),
|
|
6694
|
-
timeout_minutes:
|
|
6694
|
+
timeout_minutes: number().min(5).optional().describe("Minutes allowed for this task before it is aborted.")
|
|
6695
6695
|
}).strict();
|
|
6696
6696
|
var PiTaskExecutionSchema = object({
|
|
6697
6697
|
model: PiEntrySchema.optional().describe("Pi model entry for this task."),
|
|
6698
6698
|
fallback_models: array(PiEntrySchema).optional().describe("Ordered Pi fallback entries for this task."),
|
|
6699
6699
|
thinking_level: PiThinkingLevelSchema.describe("Pi thinking level for this task's primary entry when it declares none. Fallback entries declare thinking levels per-entry."),
|
|
6700
|
-
timeout_minutes:
|
|
6700
|
+
timeout_minutes: number().min(5).optional().describe("Minutes allowed for this task before it is aborted.")
|
|
6701
6701
|
}).strict();
|
|
6702
6702
|
var OmpTaskExecutionSchema = object({
|
|
6703
6703
|
model: OmpEntrySchema.optional().describe("OMP model entry for this task."),
|
|
6704
6704
|
fallback_models: array(OmpEntrySchema).optional().describe("Ordered OMP fallback entries for this task."),
|
|
6705
6705
|
thinking_level: OmpThinkingLevelSchema.describe("OMP thinking level for this task's primary entry when it declares none. Fallback entries declare thinking levels per-entry."),
|
|
6706
|
-
timeout_minutes:
|
|
6706
|
+
timeout_minutes: number().min(5).optional().describe("Minutes allowed for this task before it is aborted.")
|
|
6707
6707
|
}).strict();
|
|
6708
6708
|
var DreamerOpenCodeHarnessBlockSchema = object({
|
|
6709
6709
|
model: OcEntrySchema.optional().describe("Primary OpenCode model entry."),
|
|
@@ -6758,14 +6758,14 @@ var CronScheduleSchema = string().refine((s) => s.trim() === "" || isValidCron(s
|
|
|
6758
6758
|
}).describe('5-field cron schedule (e.g. "0 3 * * *"), or "" to disable this task.');
|
|
6759
6759
|
var DreamTaskBaseConfigSchema = object({
|
|
6760
6760
|
schedule: CronScheduleSchema.default(""),
|
|
6761
|
-
token_budget:
|
|
6761
|
+
token_budget: number().int().positive().optional().describe("Cumulative prompt-token investigation budget (input + cache read + cache write) for one tool-loop child. Defaults: 2,500,000 for map-memories and verify; 3,000,000 for verify-broad; other tool-loop tasks vary. Completed answers are retained even if their usage crosses the budget.")
|
|
6762
6762
|
}).strict();
|
|
6763
6763
|
var DREAM_TASK_PROMOTION_DEFAULTS = {
|
|
6764
6764
|
"review-user-memories": 3,
|
|
6765
6765
|
"promote-primers": 2
|
|
6766
6766
|
};
|
|
6767
|
-
var PromotionThresholdSchema =
|
|
6768
|
-
var PrimerPromotionThresholdSchema =
|
|
6767
|
+
var PromotionThresholdSchema = number().min(2).max(20).default(DREAM_TASK_PROMOTION_DEFAULTS["review-user-memories"]).describe("review-user-memories: min candidate observations before promotion is considered (default: 3)");
|
|
6768
|
+
var PrimerPromotionThresholdSchema = number().min(2).max(20).default(DREAM_TASK_PROMOTION_DEFAULTS["promote-primers"]).describe("promote-primers: min recurring source days before promotion is considered (default: 2)");
|
|
6769
6769
|
var DreamTaskConfigSchema = DreamTaskBaseConfigSchema.extend({
|
|
6770
6770
|
promotion_threshold: PromotionThresholdSchema
|
|
6771
6771
|
});
|
|
@@ -6776,7 +6776,7 @@ var PromotePrimersTaskConfigSchema = DreamTaskBaseConfigSchema.extend({
|
|
|
6776
6776
|
promotion_threshold: PrimerPromotionThresholdSchema
|
|
6777
6777
|
});
|
|
6778
6778
|
var RetrospectiveTaskConfigSchema = DreamTaskBaseConfigSchema.extend({
|
|
6779
|
-
recency_days:
|
|
6779
|
+
recency_days: number().int().min(1).max(3650).default(30).describe("retrospective: collect source messages from only the most recent N days")
|
|
6780
6780
|
});
|
|
6781
6781
|
var DEFAULT_TASK_SCHEDULES = {
|
|
6782
6782
|
"map-memories": "0 2 * * *",
|
|
@@ -6809,7 +6809,7 @@ var DreamTasksSchema = object({
|
|
|
6809
6809
|
"classify-memories": DreamTaskBaseConfigSchema.default(() => DreamTaskBaseConfigSchema.parse(defaultTaskConfig("classify-memories"))),
|
|
6810
6810
|
retrospective: RetrospectiveTaskConfigSchema.default(() => RetrospectiveTaskConfigSchema.parse(defaultTaskConfig("retrospective"))),
|
|
6811
6811
|
"maintain-docs": DreamTaskBaseConfigSchema.extend({
|
|
6812
|
-
max_tokens:
|
|
6812
|
+
max_tokens: number().int().positive().default(12000).describe("Maximum combined token count of proposed ARCHITECTURE.md and STRUCTURE.md")
|
|
6813
6813
|
}).default(() => ({
|
|
6814
6814
|
...DreamTaskBaseConfigSchema.parse(defaultTaskConfig("maintain-docs")),
|
|
6815
6815
|
max_tokens: 12000
|
|
@@ -6833,13 +6833,13 @@ var AgentMetadataSchema = AgentOverrideConfigSchema.pick({
|
|
|
6833
6833
|
maxTokens: true
|
|
6834
6834
|
});
|
|
6835
6835
|
var DreamerConfigSchema = AgentMetadataSchema.extend({
|
|
6836
|
-
disable:
|
|
6836
|
+
disable: boolean().optional().describe("Disable the dreamer: no scheduled or manual dream task runs. Also turns off smart notes (ctx_note drops surface_condition even with smart_notes.enabled true) and the historian's collection of user observations for review-user-memories. dreamer.inject_docs still applies."),
|
|
6837
6837
|
runner: _enum(["broca", "host"]).optional().describe(`Which side runs the dreamer completions the Rust module routes (classify-memories) in Rust transform mode: "host" runs them on this process's carrier, "broca" routes them to the Broca module. When unset, historian.runner applies, and when that is unset too the harness decides the same way it does for the historian. User-level config only.`),
|
|
6838
6838
|
opencode: DreamerOpenCodeHarnessBlockSchema.optional(),
|
|
6839
6839
|
pi: DreamerPiHarnessBlockSchema.optional(),
|
|
6840
6840
|
omp: DreamerOmpHarnessBlockSchema.optional(),
|
|
6841
6841
|
tasks: DreamTasksSchema.default(() => DreamTasksSchema.parse({})),
|
|
6842
|
-
inject_docs:
|
|
6842
|
+
inject_docs: boolean().default(true).describe("Inject ARCHITECTURE.md and STRUCTURE.md into the m[0] `<project-docs>` block (default true). Not a dreamer setting despite its place under dreamer: it applies on every host, also with dreamer.disable true.")
|
|
6843
6843
|
});
|
|
6844
6844
|
var HistorianConfigSchema = AgentMetadataSchema.extend({
|
|
6845
6845
|
expand_tools: record(string(), union([
|
|
@@ -6855,9 +6855,9 @@ var HistorianConfigSchema = AgentMetadataSchema.extend({
|
|
|
6855
6855
|
omp: OmpHarnessBlockSchema.optional(),
|
|
6856
6856
|
runner: _enum(["broca", "host"]).optional().describe('Which side runs the historian completion in Rust transform mode: "host" queues it for this process to run on the configured historian model, "broca" routes it to the Broca module. When unset the harness decides: OpenCode 1 and OpenCode 2 use "host", Claude Code (through the Thalamus gateway, which has no host to run a completion) uses "broca". User-level config only — it decides whose provider account pays for the call.'),
|
|
6857
6857
|
host_runner: object({
|
|
6858
|
-
enabled:
|
|
6858
|
+
enabled: boolean().optional().describe("Whether this process answers historian runs queued for a claimant (default true). Setting it to false stops the pull loop without changing historian.runner, so an operator can take one machine out of the lane and leave the queued runs for another claimant or for the runner setting to be changed deliberately.")
|
|
6859
6859
|
}).optional().describe("Controls for this process's historian pull loop, which answers runs the Rust module queues for the host runner (`historian.runner: \"host\"`, or unset on OpenCode 1 and OpenCode 2). User-level config only — it decides whether this machine's provider account is spent on folds."),
|
|
6860
|
-
two_pass:
|
|
6860
|
+
two_pass: boolean().default(false).describe("Run a second editor pass over historian output to clean low-signal U: lines and cross-compartment duplicates. Adds ~1 extra API call and ~1.3x cost per historian run. Useful for models without extended thinking support. (default: false)"),
|
|
6861
6861
|
disallowed_tools: array(_enum(["*", "read", "aft_outline", "aft_zoom", "aft_search"])).default([]).describe("Legacy compatibility setting. Historians, recomp and editor passes always run with zero tools and locked permissions; this list no longer changes their tool surface. (default: [])")
|
|
6862
6862
|
}).optional();
|
|
6863
6863
|
var EmbeddingFallbackProviderSchema = _enum(["local", "openai-compatible", "off"]);
|
|
@@ -6880,7 +6880,7 @@ var BaseEmbeddingConfigSchema = object({
|
|
|
6880
6880
|
query_instruction: union([string(), literal(false)]).optional().describe("OpenAI-compatible query prefix override. A string is prepended verbatim to search queries; false disables the built-in model-family instruction. Qwen3-Embedding, gte-Qwen instruct, e5 instruct, and Nomic families have built-in recipes. Query-only changes do not re-embed stored content. User-level only; project values are ignored."),
|
|
6881
6881
|
document_prefix: string().optional().describe("OpenAI-compatible stored-document prefix override, prepended verbatim. Defaults to the model-family recipe (empty for Qwen3/gte/e5 instruct; 'search_document: ' for Nomic). Changing it changes stored vectors and triggers re-embedding. User-level only; project values are ignored."),
|
|
6882
6882
|
truncate: string().optional().describe("Optional truncate mode sent in the embedding request body (e.g. NVIDIA NIM accepts 'NONE' | 'START' | 'END'). Omitted from the request when unset."),
|
|
6883
|
-
max_input_tokens:
|
|
6883
|
+
max_input_tokens: number().int().positive().optional().describe("Optional maximum input tokens for chunk embeddings. Defaults conservatively to 512 when omitted."),
|
|
6884
6884
|
local_runtime: _enum(["auto", "native", "wasm"]).default("auto").describe("Local provider only: ONNX runtime selection. 'auto' uses native under Node and uses WASM under Bun versions before 1.4.0, where Bun's NAPI teardown race can panic on quit; native is restored automatically on Bun 1.4.0+. Inference runs in a dedicated worker after disabling POSIX telemetry in the native process environment. Compiled Bun hosts and hosts without a verified in-process opt-out use a subprocess instead. Windows native ONNX emits OS-controlled ETW diagnostics, not direct uploads. On Bun before 1.4.0, even explicit 'native' uses WASM because native worker teardown can crash the process. Set 'wasm' to avoid loading the native addon on newer hosts too."),
|
|
6885
6885
|
local_dtype: _enum([
|
|
6886
6886
|
"auto",
|
|
@@ -6970,8 +6970,8 @@ var RerankConfigSchema = object({
|
|
|
6970
6970
|
endpoint: string().trim().optional().describe("User-level rerank API base URL; prefix with tei+ for Hugging Face TEI."),
|
|
6971
6971
|
model: string().trim().optional().describe("Hosted reranker model name."),
|
|
6972
6972
|
api_key: string().optional().describe("Bearer API key; supports {env:NAME} in user config, like embedding.api_key."),
|
|
6973
|
-
timeout_ms:
|
|
6974
|
-
top_n:
|
|
6973
|
+
timeout_ms: number().int().transform((n) => Math.max(50, Math.min(15000, n))).default(1500).describe("Hosted request timeout in milliseconds, clamped to 50–15000; also cancelled by ctx_search's abort signal."),
|
|
6974
|
+
top_n: number().int().min(1).max(20).default(20).describe("Maximum fused candidates sent to the hosted reranker (1–20). Requests ask for a score for every submitted document; partial replies are rejected.")
|
|
6975
6975
|
}).superRefine((data, ctx) => {
|
|
6976
6976
|
if (data.provider !== "remote")
|
|
6977
6977
|
return;
|
|
@@ -6985,66 +6985,66 @@ var RerankConfigSchema = object({
|
|
|
6985
6985
|
}
|
|
6986
6986
|
}).describe("Explicit ctx_search reranking only. Defaults to local Synapse. Hosted settings are user-level only; projects may only select off.");
|
|
6987
6987
|
var MagicContextConfigSchema = object({
|
|
6988
|
-
enabled:
|
|
6989
|
-
allow_home_project:
|
|
6988
|
+
enabled: boolean().default(true).describe("Enable magic context (default: true)"),
|
|
6989
|
+
allow_home_project: boolean().default(false).describe("Allow Magic Context sessions launched from the exact canonical home directory. A non-git home uses its deterministic dir: identity; a home repository uses its git: identity. USER-LEVEL ONLY: project config is ignored. The home identity is excluded from registry seed exports, never resolves descendants by containment, and cannot join a workspace."),
|
|
6990
6990
|
mural: object({
|
|
6991
|
-
enabled:
|
|
6991
|
+
enabled: boolean().default(false),
|
|
6992
6992
|
model: unknown().optional().describe("Deprecated: ignored. compress-cues now uses the dreamer model for each harness, like every other dreamer task; override it with dreamer.opencode.tasks.compress-cues.model (or the pi/omp equivalent). Remove this key; it no longer does anything.").meta({ deprecated: true })
|
|
6993
6993
|
}).default({ enabled: false }).describe("Experimental mural: a single deterministically-rendered image of project memories that did not fit the context budget. Cues are compressed per-memory by the compress-cues dreamer task."),
|
|
6994
6994
|
transform_mode: _enum(["ts", "rust"]).default("ts").describe('Experimental: routes the entire Magic Context runtime for the project through the ck-mc Rust module over subc (requires user-level `subc` config); "ts" is the current TypeScript pipeline.'),
|
|
6995
|
-
auto_update:
|
|
6995
|
+
auto_update: boolean().optional().describe("Enable automatic npm self-update checks for the OpenCode plugin. Security: USER-only in config loader, so hostile project configs cannot suppress updates."),
|
|
6996
6996
|
language: string().trim().toLowerCase().refine((s) => isValidLanguageCode(s), 'language must be a 2-letter ISO 639-1 code (e.g. "tr", "es", "de")').optional().describe("Output language for Magic Context's generated content and guidance, as a " + '2-letter ISO 639-1 code (e.g. "tr", "es", "de", "ja", "pt"). When set, the ' + "historian, dreamer, and the agent-guidance block instruct the model to " + "write its PROSE in this language while keeping all structural tokens (XML tags, " + "the five memory category names, code identifiers, file paths) in English. " + "USER-LEVEL ONLY (ignored in project config for security). Unset = today's " + "behavior (model mirrors the conversation; English scaffolding). Changing it " + "triggers one cache re-materialization; existing compartments/memories keep their " + "original language until naturally rewritten."),
|
|
6997
6997
|
profile: string().trim().min(1).optional().describe("Select a named user-owned model profile. A valid project name overrides this user default; an empty string, null, or other non-string project value is ignored with a warning so the user selection still applies. Unknown names warn and use the base configuration."),
|
|
6998
6998
|
profiles: ConfigProfilesSchema.optional().describe("User-level named model profiles. A profile may contain only historian/dreamer model, fallback_models, OpenCode variant, and Pi/OMP thinking_level fields; task execution policy (including timeout_minutes) is excluded. Project configs may select a name but cannot define profiles."),
|
|
6999
6999
|
historian: HistorianConfigSchema.describe("Historian metadata plus independent strict OpenCode, Pi, and OMP execution blocks. Retained metadata stays at historian; model, fallback_models, variant, and thinking_level belong only in historian.opencode, historian.pi, or historian.omp."),
|
|
7000
7000
|
dreamer: DreamerConfigSchema.optional().describe("Dreamer metadata and scheduling plus independent strict OpenCode, Pi, and OMP execution blocks. schedule and promotion_threshold stay at dreamer.tasks; model, fallback_models, variant, thinking_level, and timeout_minutes belong only in the matching harness block. Each task follows the setting it serves: memory tasks need memory.enabled, evaluate-smart-notes needs smart_notes.enabled, review-user-memories needs its schedule, maintain-docs only a runnable dreamer."),
|
|
7001
7001
|
smart_notes: object({
|
|
7002
|
-
enabled:
|
|
7003
|
-
retina_handoff:
|
|
7002
|
+
enabled: boolean().default(true).describe("Enable smart-note authoring and condition evaluation. Needs a runnable dreamer, which evaluates the conditions: with dreamer.disable true (or no dreamer block) ctx_note offers no surface_condition whatever this says. User-level only: tool definitions are process-wide. Changes require a host restart and rebuild each session's cached prompt once. Pending notes remain stored and unchecked; already-ready notes still surface."),
|
|
7003
|
+
retina_handoff: boolean().default(false).describe("When true, dreamer skips smart notes whose surface conditions compiled to retina provider configs at authoring time. Default false keeps both paths active until the retina consumer is deployed.")
|
|
7004
7004
|
}).default({ enabled: true, retina_handoff: false }).describe("Smart-note ownership transition controls."),
|
|
7005
7005
|
cache_ttl: union([string(), object({ default: string() }).catchall(string())]).default("5m").describe(`How long Magic Context assumes the provider's cached prefix stays valid. This is MC's own deferral gate — it does not change the provider's actual cache lifetime. String (e.g. "5m", "1h", "30s") or per-model object ({ default: "5m", "provider/model": "1h", "provider/*": "never" }); keys resolve most-specific first (exact provider/model, bare model ID, shorter dash-prefixes, then the provider/* wildcard, then default). User and project settings, including an explicit "5m" or object default, apply on the next pass. Only built-in defaults are frozen per session, including across restarts: when unset, GPT-5.6 and later (including gpt-6*, through any provider prefix) use 30m, other models use 5m. /ctx-status shows the effective TTL and whether it comes from your config or a frozen built-in default. Editing the TTL does not itself rewrite prompt bytes; a lowered TTL rebuilds only after normal idle expiry. OpenAI documents at least 30 minutes since the latest write or reuse: https://developers.openai.com/api/docs/guides/prompt-caching (Cache lifetime and Summary of model differences). Set to "never" to mean MC never assumes expiry (for lanes kept warm externally by a cache-keep tool) — disables the idle-TTL heuristic so MC never initiates a rebuild based on elapsed time. Provider-side extended TTL is a separate request-level concern (cache_control: { ttl } in the request body).`),
|
|
7006
7006
|
prompt_surface: PromptSurfaceConfigSchema.default({ default: "full" }).describe("Prompt-surface presets: default is full; models use bare model IDs, provider/model, or provider/* routing keys. Guidance and tool-description overrides are user-level only. OpenCode 1.x, Pi, and OMP register tool descriptions once per process (they follow the default preset). OpenCode 2 rewrites the five ctx_* descriptions per request from the draft model."),
|
|
7007
7007
|
output_reserve: union([
|
|
7008
|
-
|
|
7009
|
-
object({ default:
|
|
7008
|
+
number().min(0),
|
|
7009
|
+
object({ default: number().min(0) }).catchall(number().min(0))
|
|
7010
7010
|
]).optional().describe('User-only output-token reservation override. Number or per-model object ({ default: 16384, "provider/model": 8192 }); 0 disables reservation. Takes precedence over every derived source: an explicit value here always wins against catalog output limits, provider window-geometry facts, and the 25%-of-context fallback (usable window = context window minus this reserve). When unset, Magic Context reserves the catalog output limit (capped at 25% of context) for shared-window providers and keeps proven separate-quota Google/Gemini windows unchanged.'),
|
|
7011
7011
|
models: object({
|
|
7012
7012
|
window_overlay_path: unknown().optional().describe("Deprecated: ignored. Fusiform no longer publishes window-overlay data, so this setting no longer changes model window geometry. Remove this key.").meta({ deprecated: true })
|
|
7013
7013
|
}).optional().describe("Deprecated user-only Fusiform window-overlay settings; ignored."),
|
|
7014
|
-
toast_duration_ms:
|
|
7014
|
+
toast_duration_ms: number().min(0).max(60000).default(5000).describe("TUI toast lifetime in milliseconds for Magic Context notifications. Set to 0 to disable Magic Context toasts entirely (min: 0, max: 60000, default: 5000)"),
|
|
7015
7015
|
execute_threshold_percentage: union([
|
|
7016
|
-
|
|
7017
|
-
object({ default:
|
|
7016
|
+
number().min(20).max(90, EXECUTE_THRESHOLD_CAP_MESSAGE),
|
|
7017
|
+
object({ default: number().min(20).max(90, EXECUTE_THRESHOLD_CAP_MESSAGE) }).catchall(number().min(20).max(90, EXECUTE_THRESHOLD_CAP_MESSAGE))
|
|
7018
7018
|
]).default(DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE).describe('Context percentage that forces queued operations to execute. Number or per-model object ({ default: 65, "provider/model": 45 }). Values above 90 are rejected because the runtime caps at 90% of the output-reserved safe window (MAX_EXECUTE_THRESHOLD). Default: DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE'),
|
|
7019
7019
|
execute_threshold_tokens: object({
|
|
7020
|
-
default:
|
|
7021
|
-
}).catchall(
|
|
7022
|
-
protected_tokens:
|
|
7020
|
+
default: number().min(5000).max(2000000).optional()
|
|
7021
|
+
}).catchall(number().min(5000).max(2000000)).optional().describe("Absolute token thresholds per model. When matched, overrides execute_threshold_percentage for that model. Accepts `default` for all models or per-model keys. Values above 90% × context_limit are clamped with a warning log. Min 5_000, max 2_000_000."),
|
|
7022
|
+
protected_tokens: number().int().min(PROTECTED_TOKENS_MIN).max(1e6).optional().describe("Positive integer token floor to protect from automatic reclaim (min: 4_000, max: 1_000_000). When omitted, the derived default is clamp(round(0.05 × usableSoft), min(16_000, round(0.08 × usableSoft)), 64_000)."),
|
|
7023
7023
|
protected_tags: unknown().optional().describe("Deprecated: number of recent tags to protect. Ignored for behaviour; use protected_tokens instead.").meta({ deprecated: true }),
|
|
7024
7024
|
clear_reasoning_age: unknown().optional().describe("Deprecated and ignored. Use keep_reasoning_tokens instead.").meta({ deprecated: true }),
|
|
7025
7025
|
keep_reasoning_tokens: union([
|
|
7026
|
-
|
|
7027
|
-
object({ default:
|
|
7026
|
+
number().int().min(0).max(1e6),
|
|
7027
|
+
object({ default: number().int().min(0).max(1e6).optional() }).catchall(number().int().min(0).max(1e6))
|
|
7028
7028
|
]).optional().describe("Reasoning tokens to keep on rebuilding passes. Number or per-model object; exact, shorter model keys, provider/*, then default. Omitted: fixed 10,000. 0 removes all eligible historical reasoning; newest and exempt steps always stay."),
|
|
7029
|
-
history_budget_percentage:
|
|
7030
|
-
historian_timeout_ms:
|
|
7029
|
+
history_budget_percentage: number().min(0.05).max(0.5).default(DEFAULT_HISTORY_BUDGET_PERCENTAGE).describe("Fraction of usable context (context_limit × execute_threshold) reserved for the session history block (default: 0.15)"),
|
|
7030
|
+
historian_timeout_ms: number().min(60000).default(DEFAULT_HISTORIAN_TIMEOUT_MS).describe("Timeout for each historian prompt call in both TypeScript and Rust transform modes, in milliseconds (default: 600000). A historian setting kept at the top level for compatibility; no effect while historian.disable is true or compaction.enabled is false."),
|
|
7031
7031
|
commit_cluster_trigger: object({
|
|
7032
|
-
enabled:
|
|
7033
|
-
min_clusters:
|
|
7032
|
+
enabled: boolean().default(true).describe("Enable commit-cluster based historian triggering (default: true)"),
|
|
7033
|
+
min_clusters: number().min(1).default(3).describe("Minimum commit clusters required to trigger historian (min: 1, default: 3)")
|
|
7034
7034
|
}).default({ enabled: true, min_clusters: 3 }).describe("Commit-cluster trigger: fire historian when enough commit clusters accumulate in the unsummarized tail. A historian setting kept at the top level for compatibility; no effect while historian.disable is true or compaction.enabled is false."),
|
|
7035
7035
|
system_prompt_injection: object({
|
|
7036
|
-
enabled:
|
|
7036
|
+
enabled: boolean().default(true).describe("When false, NO injection happens for ANY agent — global escape hatch. (default: true)"),
|
|
7037
7037
|
skip_signatures: array(string()).default(["<!-- magic-context: skip -->"]).describe(`Substring opt-out list. If the agent's system prompt contains any of these strings, skip ALL Magic Context injection for that call. Default "<!-- magic-context: skip -->" is meant to be added inside a user's custom agent prompt to opt that agent out.`)
|
|
7038
7038
|
}).default({
|
|
7039
7039
|
enabled: true,
|
|
7040
7040
|
skip_signatures: ["<!-- magic-context: skip -->"]
|
|
7041
7041
|
}).describe("Controls whether and where Magic Context augments the system prompt. Lets users opt specific agents out of the Magic Context guidance and the surrounding project-docs / user-profile blocks. OpenCode's internal hidden agents — title, summary, and compaction — are always skipped automatically."),
|
|
7042
7042
|
sqlite: object({
|
|
7043
|
-
cache_size_mb:
|
|
7044
|
-
mmap_size_mb:
|
|
7043
|
+
cache_size_mb: number().min(2).max(2048).default(64).describe("Page-cache size in MiB per connection (PRAGMA cache_size). Larger keeps more hot pages resident, cutting re-reads on repeated full-table scans. (min 2, max 2048, default 64)"),
|
|
7044
|
+
mmap_size_mb: number().min(0).max(8192).default(0).describe("Memory-mapped I/O size in MiB (PRAGMA mmap_size). 0 disables mmap (SQLite default). Raising it can cut read overhead on large DBs at the cost of address space. (min 0, max 8192, default 0)")
|
|
7045
7045
|
}).default({ cache_size_mb: 64, mmap_size_mb: 0 }).describe("SQLite connection tuning for Magic Context's own context.db. These are per-connection PRAGMAs applied at open; they do not change the schema or what is stored."),
|
|
7046
7046
|
storage: object({
|
|
7047
|
-
enforce_private_permissions:
|
|
7047
|
+
enforce_private_permissions: boolean().default(true).describe("When true (default), Magic Context creates and re-tightens its TypeScript-mode storage directories to owner-only 0700 and storage files to owner-only 0600. Set false only for a deliberate trusted-group deployment whose operator manages those files externally; in TypeScript mode Magic Context then skips its own creation modes and recursive tightening. In Rust transform mode, ck-mc's store library always keeps the shared data directory owner-only 0700, regardless of this setting. USER-LEVEL ONLY — ignored in project config for security. On Windows, POSIX chmod modes are already meaningless, so this setting is a no-op.")
|
|
7048
7048
|
}).default({ enforce_private_permissions: true }).describe("Storage permission policy. The default keeps session content and memories owner-private. Disabling enforcement is for trusted shared-group storage managed externally; TypeScript mode follows that policy, but Rust transform mode always keeps its shared data directory owner-only because ck-mc's store library enforces it."),
|
|
7049
7049
|
rerank: RerankConfigSchema.optional(),
|
|
7050
7050
|
embedding: EmbeddingConfigSchema.default({
|
|
@@ -7056,40 +7056,40 @@ var MagicContextConfigSchema = object({
|
|
|
7056
7056
|
connection_file: string().trim().min(1).transform(expandConfigPath).describe("Path to the owner-only subc connection file.")
|
|
7057
7057
|
}).optional().describe("User-only Synapse daemon connection settings."),
|
|
7058
7058
|
shadow_embedding: object({
|
|
7059
|
-
enabled:
|
|
7059
|
+
enabled: boolean().default(false).describe("Developer-only Synapse shadow embedding lane switch.")
|
|
7060
7060
|
}).default({ enabled: false }).describe("Developer-only Synapse shadow embedding lane."),
|
|
7061
|
-
temporal_awareness:
|
|
7062
|
-
keep_subagents:
|
|
7063
|
-
debug_rpc:
|
|
7064
|
-
fail_closed_blocking:
|
|
7061
|
+
temporal_awareness: boolean().default(true).describe('Inject wall-clock gap markers (<!-- +Xm -->) between user messages where > 5 min elapsed since the previous message, and add compact date ranges to compartment headings. Gives the agent a sense of session pacing and "how long ago" across multi-day sessions. Graduated from experimental.temporal_awareness; default: true (set false to opt out).'),
|
|
7062
|
+
keep_subagents: boolean().default(false).describe("Debug: keep every settled Magic Context child session instead of deleting it after success: historian, all Dreamer tasks, smart-note evaluation and compilation, user-memory review, and memory migration. Kept Dreamer children can contain memory-pool text and user messages from other sessions of the same operator; their full transcript (prompt, tool calls, token usage, output) stays in the host session store. Kept sessions accumulate until manually cleared; leave false for normal use. Requires a restart to take effect. On OpenCode 2, one hidden session holds many runs; it is kept once any of its runs settled, and only a Dreamer session none of whose runs settled is still deleted."),
|
|
7063
|
+
debug_rpc: boolean().default(false).describe("Developer-only: enable authenticated loopback RPCs for memory counters and heap snapshots. Disabled by default. USER-LEVEL ONLY and requires a restart."),
|
|
7064
|
+
fail_closed_blocking: boolean().default(true).describe("When Magic Context cannot operate (schema fence mismatch, storage open/migration failure), block the primary-session prompt with a loud recovery error instead of silently degrading to native compaction. Default true. Set false only to restore the old degrade-silently behavior (not recommended). USER-LEVEL ONLY — ignored in project config for security. Requires a restart."),
|
|
7065
7065
|
compaction: object({
|
|
7066
|
-
enabled:
|
|
7066
|
+
enabled: boolean().default(true).describe("When false, Magic Context stops managing the context window and keeps its knowledge layer: memory and docs/user-profile/key-files injection through additive m[0]/m[1], raw-message FTS indexing, dreamer, notes, ctx_search, ctx_expand, ctx_memory, and /ctx-embed remain available. MC's historian/compartment preparation, tagging, markers, pruning, folding, drops, strips, splicing, synthetic context-management todos, temporal markers, nudges, and fail-closed blocking stop; ctx_expand remains a knowledge-surface tool. fail_closed_blocking is inert: a transform failure passes the input messages through without blocking or cancelling. This setting does not enable native compaction: OpenCode's compaction.auto / compaction.prune or Pi's equivalent owns the window, or nothing does. MC's compaction.enabled in magic-context.jsonc is distinct from OpenCode's compaction.auto / compaction.prune in opencode.jsonc; they are different files and different owners. On the first turn after disabling, a long session may trigger one native compaction cycle; MC removes only its own marker boundary, leaves native boundaries and stored compartments intact, and does no pre-trimming mitigation. Marker cleanup is lazy per session, so an unresumed session is cleaned when it is next resumed. If compaction is enabled again, run /ctx-wrapup when the historian is runnable to catch up. OpenCode peer verification against v1.18.4 confirms native compaction covers child sessions: subagents receive additive memory/docs injection and no MC reclaim in this mode, so keep subagent tasks small or leave compaction.enabled on for long subagent runs. This is boot-resolved and requires a process restart; project-tier compaction.enabled is stripped so a cloned repository cannot disable the user's setting. The sidebar reports raw usage as Context: <pct>% · native compaction or Context: <pct>% · no active compaction and does not show an MC execute-threshold fill. /ctx-wrapup, /ctx-recomp, and /ctx-flush refuse without context-management side effects; /ctx-embed remains functional. Raw content hidden by a native boundary before Magic Context's first pass is not retroactively indexed.")
|
|
7067
7067
|
}).default({ enabled: true }).describe("Compaction-off mode gate. Default true (MC manages the context window as today). Set compaction.enabled=false to keep the knowledge layer while letting native compaction (or nothing) own the window. Boot-resolved; requires a restart to change."),
|
|
7068
7068
|
todowrite: object({
|
|
7069
|
-
enabled:
|
|
7070
|
-
overlay:
|
|
7069
|
+
enabled: boolean().default(false).describe("Pi only: off by default. Set todowrite.enabled=true to register Magic Context's todowrite task-list tool and /todos command. OpenCode ships its own built-in todowrite; this setting has no effect there."),
|
|
7070
|
+
overlay: boolean().default(true).describe("Pi only: show the persistent todo overlay above the editor while tasks are active.")
|
|
7071
7071
|
}).default({ enabled: false, overlay: true }).describe("Pi-only todowrite tool and overlay controls. Pi registers tools and widgets at extension boot, so changing this after /cd requires /reload or restart."),
|
|
7072
7072
|
pi: PiConfigSchema.describe("Pi-only child-process extension controls. This setting is user-level only; project configuration cannot choose which extensions a user's subagent children load."),
|
|
7073
7073
|
smart_drops: unknown().optional().describe("Deprecated: ignored. Content-aware supersession reclaim is always on, only on passes already rebuilding the cache. Remove this key; it no longer does anything.").meta({ deprecated: true }),
|
|
7074
|
-
protected_tools: record(string(),
|
|
7074
|
+
protected_tools: record(string(), number().int().nonnegative()).default({ ...DEFAULT_PROTECTED_TOOLS }).transform((map) => mergeProtectedTools(map)).describe("Keep each tool's newest N still-active results in every automatic drop lane (issue 621). User and project maps merge over defaults {todowrite: 1, ctx_reduce: 3}; 0 turns protection off. Names are case-insensitive and ignore leading mcp_. Holds even at 95% pressure, with no byte cap: large protected outputs can reach refusal sooner. Queued drops, from the agent or historian publication, are held until newer calls displace the result and a later cache-rebuilding pass applies them. The historian's summary is unaffected; the raw result leaves at the next fold. Frozen strips are unaffected. Changes and rotation never originate a bust; dropped results are never restored."),
|
|
7075
7075
|
caveman_text_compression: object({
|
|
7076
|
-
enabled:
|
|
7077
|
-
min_chars:
|
|
7076
|
+
enabled: boolean().default(false).describe("Apply deterministic caveman-style text compression to old conversation text. Active for primary sessions when enabled; never for subagents. Compresses user/assistant text in oldest-first tiers: ultra (oldest 20%), full, lite, untouched (newest 40%)."),
|
|
7077
|
+
min_chars: number().min(100).max(1e4).default(500).describe("Text parts shorter than this (characters) stay untouched. Min 100, max 10000. Default: 500.")
|
|
7078
7078
|
}).default({ enabled: false, min_chars: 500 }).describe("Age-tier caveman compression for long user/assistant text parts. Active for primary sessions when enabled; never for subagents. Oldest 20% of eligible tags (outside protected tail) go to ultra, next 20% to full, next 20% to lite, newest 40% untouched. Graduated from experimental.caveman_text_compression; opt-in, default off (lossy)."),
|
|
7079
7079
|
memory: object({
|
|
7080
|
-
enabled:
|
|
7081
|
-
injection_budget_tokens:
|
|
7082
|
-
auto_promote:
|
|
7083
|
-
retrieval_count_promotion_threshold:
|
|
7080
|
+
enabled: boolean().default(true).describe("Enable cross-session project memory (default: true). Also gates the dreamer's project-memory tasks: while false, map-memories, verify, verify-broad, curate, compress-cues, classify-memories, retrospective, promote-primers and refresh-primers neither run on schedule nor through /ctx-dream; maintain-docs, evaluate-smart-notes and review-user-memories still run. memory.auto_search and memory.git_commit_indexing do not depend on it. Does not affect history embedding or semantic ctx_search over session history; set embedding.provider to 'off' to stop all embedding."),
|
|
7081
|
+
injection_budget_tokens: number().min(500).max(20000).default(4000).describe("Token budget for memory injection on session start (min: 500, max: 20000, default: 4000)"),
|
|
7082
|
+
auto_promote: boolean().default(true).describe("Automatically promote eligible session facts into memory (default: true). No effect while memory.enabled is false."),
|
|
7083
|
+
retrieval_count_promotion_threshold: number().min(1).default(3).describe("Currently has no effect: no code reads this value, and memories are not promoted to permanent by retrieval count. Kept so existing configs stay valid (min: 1, default: 3)."),
|
|
7084
7084
|
auto_search: object({
|
|
7085
|
-
enabled:
|
|
7086
|
-
score_threshold:
|
|
7087
|
-
min_prompt_chars:
|
|
7085
|
+
enabled: boolean().default(true).describe("Automatically append a compact <ctx-search-hint> to eligible user messages when relevant memories, conversation, or commits are found. Graduated from experimental.auto_search; on by default (set false to opt out). Independent of memory.enabled despite its place under memory: with memory off it still searches past conversation and commits, only the memory source is skipped."),
|
|
7086
|
+
score_threshold: number().min(0.3).max(0.95).default(0.6).describe("Top hit score must exceed this threshold for the hint to fire (min: 0.3, max: 0.95, default: 0.60)"),
|
|
7087
|
+
min_prompt_chars: number().min(5).max(500).default(20).describe("Skip hint when user message is shorter than this (min: 5, max: 500, default: 20)")
|
|
7088
7088
|
}).default({ enabled: true, score_threshold: 0.6, min_prompt_chars: 20 }).describe("Auto-search hint: transform-time ctx_search on each new user message; when the top hit clears the threshold, append a compact <ctx-search-hint> block of vague fragments to that user message. Does NOT inject full content. Graduated from experimental.auto_search; enabled by default (set enabled: false to opt out). Independent of memory.enabled despite its place under memory: with memory off it still searches past conversation and commits."),
|
|
7089
7089
|
git_commit_indexing: object({
|
|
7090
|
-
enabled:
|
|
7091
|
-
since_days:
|
|
7092
|
-
max_commits:
|
|
7090
|
+
enabled: boolean().default(false).describe("Index HEAD git commits for ctx_search (git_commit source). Graduated from experimental.git_commit_indexing; opt-in, default off. Independent of memory.enabled despite its place under memory."),
|
|
7091
|
+
since_days: number().min(7).max(3650).default(365).describe("Days of HEAD history to index (min: 7, max: 3650, default: 365)"),
|
|
7092
|
+
max_commits: number().min(100).max(20000).default(2000).describe("Max commits kept per project; oldest evicted (min: 100, max: 20000, default: 2000)")
|
|
7093
7093
|
}).default({ enabled: false, since_days: 365, max_commits: 2000 }).describe("Index git commit messages from HEAD into ctx_search. Commits become a 4th searchable source alongside memories and session history. Graduated from experimental.git_commit_indexing; opt-in, default off (per-project embedding cost). Independent of memory.enabled despite its place under memory.")
|
|
7094
7094
|
}).default({
|
|
7095
7095
|
enabled: true,
|
|
@@ -7177,4 +7177,4 @@ function deriveDefaultProtectedTokens(usableSoft) {
|
|
|
7177
7177
|
return Math.min(64000, Math.max(lowerBound, target));
|
|
7178
7178
|
}
|
|
7179
7179
|
|
|
7180
|
-
export { string, unknown, array, object, union, tuple, record, isValidLanguageCode, withContentLanguageDirective, buildPrimaryLanguageDirective, parseCron, nextOccurrence, nextDueAtMs, renderToolTemplate, promptSurfaceConfigIdentity, resolveModelConfigValue, resolvePromptSurface, DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE, DEFAULT_HISTORIAN_TIMEOUT_MS, PROTECTED_TOKENS_MIN, DEFAULT_LOCAL_EMBEDDING_MODEL, PER_HARNESS_MIGRATION_INVENTORY, PER_HARNESS_MODEL_KEYS, ConfigProfilesSchema, DREAM_TASK_PROMOTION_DEFAULTS, MagicContextConfigSchema, LIVE_RELOAD_CONFIG_PATHS, deriveDefaultProtectedTokens };
|
|
7180
|
+
export { string, number, boolean, unknown, array, object, union, tuple, record, literal, isValidLanguageCode, withContentLanguageDirective, buildPrimaryLanguageDirective, parseCron, nextOccurrence, nextDueAtMs, renderToolTemplate, promptSurfaceConfigIdentity, resolveModelConfigValue, resolvePromptSurface, DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE, DEFAULT_HISTORIAN_TIMEOUT_MS, PROTECTED_TOKENS_MIN, DEFAULT_LOCAL_EMBEDDING_MODEL, PER_HARNESS_MIGRATION_INVENTORY, PER_HARNESS_MODEL_KEYS, ConfigProfilesSchema, DREAM_TASK_PROMOTION_DEFAULTS, MagicContextConfigSchema, LIVE_RELOAD_CONFIG_PATHS, deriveDefaultProtectedTokens };
|