@cortexkit/opencode-magic-context 0.49.87 → 0.49.89
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/{announcement-fnyxaahs.js → announcement-4ynkaf0d.js} +2 -2
- package/dist/auto-search-worker.js +3 -3
- package/dist/chunk-embedding-write-worker.js +5 -5
- package/dist/{context-gnk68pyy.js → context-grdg1k2k.js} +21 -21
- package/dist/{derive-budgets-90869322.js → derive-budgets-hzzq71rm.js} +2 -2
- package/dist/{embedding-backfill-9khxv6a9.js → embedding-backfill-qjkaee9s.js} +6 -6
- package/dist/embedding-worker.js +2 -2
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-recomp-carry.d.ts +4 -0
- package/dist/hooks/magic-context/compartment-runner-recomp-carry.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts +8 -2
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +3 -5
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/{index-watde7a1.js → index-2pdgy88n.js} +3 -3
- package/dist/{index-c1s40xmj.js → index-39rzef89.js} +7 -5
- package/dist/{index-c5tmzym6.js → index-5df2fw5b.js} +108 -13
- package/dist/{index-7svecf3m.js → index-5pgyqgmx.js} +1 -1
- package/dist/{index-k50xhjw1.js → index-60x5d68t.js} +1 -1
- package/dist/{index-jka4y6mv.js → index-61knrt52.js} +1 -1
- package/dist/{index-74sh122g.js → index-9d3qgwq0.js} +1 -1
- package/dist/{index-2kf73btc.js → index-cr483vx6.js} +1 -1
- package/dist/{index-5nmqgvz2.js → index-dk3hy2a2.js} +6 -6
- package/dist/{index-awyqqnd8.js → index-g0mb2kb4.js} +6 -6
- package/dist/{index-kmrv1fw3.js → index-h9hybzr5.js} +2 -2
- package/dist/{index-vyfrgwhk.js → index-jzfsnbmm.js} +2 -2
- package/dist/{index-rvf1726x.js → index-mrjat4eq.js} +75 -12
- package/dist/{index-b364vr04.js → index-n1ty0vd3.js} +22 -22
- package/dist/{index-csztadkj.js → index-q7msfgwz.js} +272 -101
- package/dist/{index-pmcvg3k1.js → index-qfcjrnpe.js} +6 -5
- package/dist/{index-3dtzyred.js → index-r4y0dczp.js} +1 -1
- package/dist/{index-bxrfq3mv.js → index-tt0vs4x5.js} +1 -1
- package/dist/{index-3x4qvp29.js → index-w51n3576.js} +1 -1
- package/dist/{index-3jgzd7nz.js → index-wmb2mcdw.js} +3 -3
- package/dist/{index-zmqx48vt.js → index-xsqw8kbd.js} +1 -1
- package/dist/{index-hdyfvdag.js → index-zxhev8ze.js} +1 -1
- package/dist/index.js +26 -26
- package/dist/migration-worker.js +4 -4
- package/dist/{project-embedding-registry-8t0gwf59.js → project-embedding-registry-m3fp1pa4.js} +5 -5
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{recomp-orchestrator-2ztmtxt2.js → recomp-orchestrator-dgyb394j.js} +14 -14
- package/dist/{render-d6q6h9hy.js → render-d014e603.js} +6 -6
- package/dist/{search-d5aajhs3.js → search-9gceftb9.js} +11 -11
- package/dist/{search-archive-g96jn6p0.js → search-archive-gybn6q7s.js} +2 -2
- package/dist/shared/recomp-outcome.d.ts +4 -0
- package/dist/shared/recomp-outcome.d.ts.map +1 -0
- package/dist/shared/storage-permissions.d.ts +16 -2
- package/dist/shared/storage-permissions.d.ts.map +1 -1
- package/dist/shared/user-facing-codes.d.ts +4 -1
- package/dist/shared/user-facing-codes.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-b2yjw8by.js → transform-postprocess-phase-34k1zwsy.js} +15 -15
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +5 -5
- package/dist/v2/{context-s86114yy.js → context-8bzydxfy.js} +21 -21
- package/dist/v2/{derive-budgets-ecjy1aqh.js → derive-budgets-hr4qqrnv.js} +3 -3
- package/dist/v2/{embedding-backfill-tazkbpyg.js → embedding-backfill-0ar1bm97.js} +6 -6
- package/dist/v2/embedding-worker.js +2 -2
- package/dist/v2/migration-worker.js +4 -4
- package/dist/v2/{project-embedding-registry-ah3gsg48.js → project-embedding-registry-gx2waee8.js} +5 -5
- package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
- package/dist/v2/{recomp-orchestrator-kc62xgb9.js → recomp-orchestrator-wq7gbkqa.js} +15 -15
- package/dist/v2/{render-j05per51.js → render-2dan17xc.js} +6 -6
- package/dist/v2/{search-archive-b4ptw02k.js → search-archive-89hdy0a2.js} +2 -2
- package/dist/v2/{search-kg31ad2s.js → search-nyqykx7q.js} +10 -10
- package/dist/v2/{server-ct0gs8fc.js → server-09h2vyvs.js} +2 -2
- package/dist/v2/{server-r2es6zt7.js → server-0tv6kytx.js} +108 -13
- package/dist/v2/{server-rz4snd3x.js → server-1rrmxhd1.js} +1 -1
- package/dist/v2/{server-xa8fefhw.js → server-96nm9vk4.js} +1 -1
- package/dist/v2/{server-2p0qayr1.js → server-a85j3kam.js} +1 -1
- package/dist/v2/{server-gwhj0362.js → server-add0j5n3.js} +7 -5
- package/dist/v2/{server-ff5wcfy4.js → server-b0a9h3ds.js} +2 -2
- package/dist/v2/{server-xn7zqs4j.js → server-dgjqvpgd.js} +3 -3
- package/dist/v2/{server-2r9btf0g.js → server-dtcwkdqj.js} +274 -103
- package/dist/v2/{server-axdmkvd5.js → server-f7tzvmzs.js} +1 -1
- package/dist/v2/{server-yh2z4gg2.js → server-fb5hvvfc.js} +75 -12
- package/dist/v2/{server-pbp58w5x.js → server-fn4ky6mn.js} +1 -1
- package/dist/v2/{server-3p6b0qya.js → server-gqkdfdvw.js} +1 -1
- package/dist/v2/{server-cwtehwbb.js → server-j4jjtdc5.js} +1 -1
- package/dist/v2/{server-b93f0bqh.js → server-pjk9spbf.js} +1 -1
- package/dist/v2/{server-gqrw0br5.js → server-ta4h0fch.js} +6 -6
- package/dist/v2/{server-e2k9mt86.js → server-tj65pgvg.js} +1 -1
- package/dist/v2/{server-6vnbz81n.js → server-vy0beygw.js} +1 -1
- package/dist/v2/server.js +5 -5
- package/dist/v2/{v2-archive-reader-2ayz16s4.js → v2-archive-reader-gh1jghf7.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-e20sjbdz.js → wrapup-orchestrator-2h7ayss9.js} +15 -15
- package/dist/{v2-archive-reader-x39mzvwn.js → v2-archive-reader-8158kyfd.js} +1 -1
- package/dist/{wrapup-orchestrator-h3s905vs.js → wrapup-orchestrator-ct59br0c.js} +15 -15
- package/package.json +1 -1
- package/src/shared/recomp-outcome.ts +8 -0
- package/src/shared/storage-permissions-startup.test.ts +296 -6
- package/src/shared/storage-permissions.ts +143 -18
- package/src/shared/user-facing-codes.ts +5 -2
- package/src/tui/dialogs/status-dialog.tsx +3 -0
- package/src/tui/slots/sidebar-content.tsx +6 -2
- package/src/tui-compiled/dialogs/status-dialog.tsx +12 -0
- package/src/tui-compiled/slots/sidebar-content.tsx +7 -2
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
readdirSync,
|
|
18
18
|
readlinkSync,
|
|
19
19
|
readSync,
|
|
20
|
+
realpathSync,
|
|
20
21
|
renameSync,
|
|
21
22
|
rmdirSync,
|
|
22
23
|
rmSync,
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
writeSync
|
|
26
27
|
} from "node:fs";
|
|
27
28
|
import { open as openAsync, writeFile as writeFileAsync } from "node:fs/promises";
|
|
29
|
+
import { homedir } from "node:os";
|
|
28
30
|
import { basename, dirname, join, resolve } from "node:path";
|
|
29
31
|
var enforcePrivateStoragePermissions = true;
|
|
30
32
|
var STORAGE_PERMISSIONS_POLICY_VERSION = 1;
|
|
@@ -33,6 +35,36 @@ var STORAGE_PERMISSIONS_MARKER_BYTES = Buffer.from(`${STORAGE_PERMISSIONS_POLICY
|
|
|
33
35
|
`);
|
|
34
36
|
var STORAGE_PERMISSIONS_MARKER_MAX_AGE_MS = 24 * 60 * 60000;
|
|
35
37
|
var LEGACY_FENCE_TEMP_MIN_AGE_MS = 10 * 60000;
|
|
38
|
+
var MAGIC_CONTEXT_STORAGE_ENTRIES = [
|
|
39
|
+
"context.db",
|
|
40
|
+
"context.db-wal",
|
|
41
|
+
"context.db-shm",
|
|
42
|
+
"context.db-journal",
|
|
43
|
+
"store.db",
|
|
44
|
+
"store.db-wal",
|
|
45
|
+
"store.db-shm",
|
|
46
|
+
"store.db-journal",
|
|
47
|
+
STORAGE_PERMISSIONS_MARKER,
|
|
48
|
+
"models",
|
|
49
|
+
"logs",
|
|
50
|
+
"backups",
|
|
51
|
+
"config-backups",
|
|
52
|
+
"lkg-recovery-fences",
|
|
53
|
+
"rpc",
|
|
54
|
+
"project-identities",
|
|
55
|
+
"heap-snapshots",
|
|
56
|
+
"host-profiler",
|
|
57
|
+
"pi-served-array-digests",
|
|
58
|
+
"pi-served-array-bodies",
|
|
59
|
+
"pi-served-tag-numbers",
|
|
60
|
+
"window-reports.jsonl",
|
|
61
|
+
"window-reports.jsonl.1",
|
|
62
|
+
/^(?:last_announced_version|last-update-check\.json|pending-plugin-update\.json|model-context-limits-(?:opencode|opencode2)\.json)(?:\.[1-9]\d*\.[a-f0-9]{12}\.tmp)?$/,
|
|
63
|
+
/^identity-merge-backup-[A-Za-z0-9]{6}$/,
|
|
64
|
+
/^context\.db\.bak-\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z$/,
|
|
65
|
+
/^context\.db\.corrupt-(?:backup|original)-\d{8}T\d{9}Z(?:-[1-9]\d{0,3})?(?:-wal|-shm)?$/,
|
|
66
|
+
/^context\.db\.recovering-\d{8}T\d{9}Z-[1-9]\d*(?:-[1-9]\d{0,3})?(?:\.(?:count-source|recover-source|(?:fresh\.)?db)(?:-wal|-shm)?|\.sql)$/
|
|
67
|
+
];
|
|
36
68
|
var storagePermissionRoots = new Set;
|
|
37
69
|
function invalidateStoragePermissionMarkers(directory) {
|
|
38
70
|
for (let current = resolve(directory);; current = dirname(current)) {
|
|
@@ -208,11 +240,77 @@ function readStoragePermissionCertificate(marker) {
|
|
|
208
240
|
closeSync(fd);
|
|
209
241
|
}
|
|
210
242
|
}
|
|
243
|
+
function inspectLinkedStorageRoot(root, rootStat) {
|
|
244
|
+
const parent = dirname(root);
|
|
245
|
+
if (root === parent)
|
|
246
|
+
return { skipped: "filesystem-root" };
|
|
247
|
+
try {
|
|
248
|
+
if (root === realpathSync(homedir()))
|
|
249
|
+
return { skipped: "home-folder" };
|
|
250
|
+
} catch (error) {
|
|
251
|
+
if (error.code !== "ENOENT")
|
|
252
|
+
throw error;
|
|
253
|
+
}
|
|
254
|
+
if (lstatSync(parent).dev !== rootStat.dev)
|
|
255
|
+
return { skipped: "mount-point" };
|
|
256
|
+
const entries = readdirSync(root);
|
|
257
|
+
const foreignEntries = entries.filter((name) => name !== ".DS_Store" && !MAGIC_CONTEXT_STORAGE_ENTRIES.some((entry) => typeof entry === "string" ? entry === name : entry.test(name))).length;
|
|
258
|
+
return foreignEntries === 0 ? { entries } : { skipped: foreignEntries };
|
|
259
|
+
}
|
|
211
260
|
function tightenStorageTreeSync(directory, dbPath = join(directory, "context.db")) {
|
|
212
261
|
if (process.platform === "win32") {
|
|
213
262
|
return { tightened: 0, failures: 0 };
|
|
214
263
|
}
|
|
215
|
-
const
|
|
264
|
+
const enforce = shouldEnforcePrivateStoragePermissions();
|
|
265
|
+
const startupPath = resolve(directory);
|
|
266
|
+
let root = startupPath;
|
|
267
|
+
let rootStat;
|
|
268
|
+
let rootLink;
|
|
269
|
+
let linkedEntries;
|
|
270
|
+
try {
|
|
271
|
+
rootStat = lstatSync(root);
|
|
272
|
+
} catch {
|
|
273
|
+
if (enforce)
|
|
274
|
+
return { tightened: 0, failures: 1 };
|
|
275
|
+
}
|
|
276
|
+
if (rootStat?.isSymbolicLink()) {
|
|
277
|
+
try {
|
|
278
|
+
root = realpathSync(startupPath);
|
|
279
|
+
rootStat = lstatSync(root);
|
|
280
|
+
if (rootStat.isDirectory() && enforce) {
|
|
281
|
+
const eligibility = inspectLinkedStorageRoot(root, rootStat);
|
|
282
|
+
if ("skipped" in eligibility) {
|
|
283
|
+
return {
|
|
284
|
+
tightened: 0,
|
|
285
|
+
failures: 0,
|
|
286
|
+
rootLink: { path: startupPath, target: root, skipped: eligibility.skipped }
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
linkedEntries = eligibility.entries;
|
|
290
|
+
}
|
|
291
|
+
} catch (error) {
|
|
292
|
+
if (!enforce)
|
|
293
|
+
return { tightened: 0, failures: 0 };
|
|
294
|
+
const failure = error.code ?? String(error);
|
|
295
|
+
return { tightened: 0, failures: 1, rootLink: { path: startupPath, failure } };
|
|
296
|
+
}
|
|
297
|
+
if (!rootStat.isDirectory()) {
|
|
298
|
+
if (!enforce)
|
|
299
|
+
return { tightened: 0, failures: 0 };
|
|
300
|
+
return {
|
|
301
|
+
tightened: 0,
|
|
302
|
+
failures: 1,
|
|
303
|
+
rootLink: {
|
|
304
|
+
path: startupPath,
|
|
305
|
+
failure: "not a directory",
|
|
306
|
+
nonDirectoryTarget: root
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
rootLink = { path: startupPath, target: root };
|
|
311
|
+
dbPath = join(root, basename(dbPath));
|
|
312
|
+
storagePermissionRoots.add(startupPath);
|
|
313
|
+
}
|
|
216
314
|
const marker = join(root, STORAGE_PERMISSIONS_MARKER);
|
|
217
315
|
let tightened = 0;
|
|
218
316
|
let failures = 0;
|
|
@@ -225,20 +323,14 @@ function tightenStorageTreeSync(directory, dbPath = join(directory, "context.db"
|
|
|
225
323
|
return false;
|
|
226
324
|
}
|
|
227
325
|
};
|
|
228
|
-
if (!
|
|
326
|
+
if (!enforce) {
|
|
229
327
|
storagePermissionRoots.add(root);
|
|
230
328
|
if (!removeMarker())
|
|
231
329
|
failures++;
|
|
232
|
-
return { tightened, failures };
|
|
330
|
+
return { tightened, failures, ...rootLink && { rootLink } };
|
|
233
331
|
}
|
|
234
|
-
|
|
235
|
-
try {
|
|
236
|
-
rootStat = lstatSync(root);
|
|
237
|
-
if (!rootStat.isDirectory())
|
|
238
|
-
return { tightened, failures: 1 };
|
|
239
|
-
} catch {
|
|
332
|
+
if (!rootStat?.isDirectory())
|
|
240
333
|
return { tightened, failures: 1 };
|
|
241
|
-
}
|
|
242
334
|
storagePermissionRoots.add(root);
|
|
243
335
|
let certificate;
|
|
244
336
|
let discardMarker = false;
|
|
@@ -318,13 +410,16 @@ function tightenStorageTreeSync(directory, dbPath = join(directory, "context.db"
|
|
|
318
410
|
return;
|
|
319
411
|
let entries;
|
|
320
412
|
try {
|
|
321
|
-
entries = readdirSync(entryPath);
|
|
413
|
+
entries = (entryPath === root ? linkedEntries : undefined) ?? readdirSync(entryPath);
|
|
322
414
|
} catch {
|
|
323
415
|
failures++;
|
|
324
416
|
return;
|
|
325
417
|
}
|
|
326
|
-
for (const entry of entries)
|
|
418
|
+
for (const entry of entries) {
|
|
419
|
+
if (entryPath === root && linkedEntries && markerRemoved && entry === STORAGE_PERMISSIONS_MARKER)
|
|
420
|
+
continue;
|
|
327
421
|
visit(join(entryPath, entry));
|
|
422
|
+
}
|
|
328
423
|
};
|
|
329
424
|
if (certificate) {
|
|
330
425
|
visit(root, false, false, rootStat);
|
|
@@ -372,7 +467,7 @@ function tightenStorageTreeSync(directory, dbPath = join(directory, "context.db"
|
|
|
372
467
|
}
|
|
373
468
|
}
|
|
374
469
|
}
|
|
375
|
-
return { tightened, failures };
|
|
470
|
+
return { tightened, failures, ...rootLink && { rootLink } };
|
|
376
471
|
}
|
|
377
472
|
|
|
378
473
|
export { setStoragePrivatePermissionEnforcement, shouldEnforcePrivateStoragePermissions, ensureStorageDirectorySync, ensurePrivateStorageDirectorySync, writeStorageFileSync, writeStorageFileAtomicSync, syncStorageDirectorySync, writeStorageFileDurableAtomicSync, copyStorageFileSync, copyStorageTreeSync, writeStorageFileAsync, writeStorageFileHandleAsync, createStorageWriteStream, createStorageFileHandleAsync, tightenStorageTreeSync };
|
|
@@ -17,11 +17,11 @@ import {
|
|
|
17
17
|
} from "./server-x6fn9x8q.js";
|
|
18
18
|
import {
|
|
19
19
|
LocalEmbeddingProvider
|
|
20
|
-
} from "./server-
|
|
20
|
+
} from "./server-pjk9spbf.js";
|
|
21
21
|
import {
|
|
22
22
|
OpenAICompatibleEmbeddingProvider,
|
|
23
23
|
embedTextForProject2
|
|
24
|
-
} from "./server-
|
|
24
|
+
} from "./server-dgjqvpgd.js";
|
|
25
25
|
import {
|
|
26
26
|
saveEmbeddingIfHashMatches
|
|
27
27
|
} from "./server-qjwpqvnf.js";
|
|
@@ -317,10 +317,12 @@ var USER_FACING_FAILURES = {
|
|
|
317
317
|
action: "Check the Magic Context log for the failing task and its error."
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
|
-
function renderUserFacingFailure(key, style = "markdown") {
|
|
320
|
+
function renderUserFacingFailure(key, style = "markdown", overrides) {
|
|
321
321
|
const failure = USER_FACING_FAILURES[key];
|
|
322
|
-
const
|
|
323
|
-
|
|
322
|
+
const sentence = overrides?.sentence ?? failure.sentence;
|
|
323
|
+
const action = overrides?.action ?? failure.action;
|
|
324
|
+
const styledAction = style === "plain" ? action.replaceAll("`", "") : action;
|
|
325
|
+
return `${sentence}${styledAction ? ` ${styledAction}` : ""} (${failure.code})`;
|
|
324
326
|
}
|
|
325
327
|
function userFacingFailureCode(key) {
|
|
326
328
|
return USER_FACING_FAILURES[key].code;
|
|
@@ -140,8 +140,8 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
140
140
|
import("./store-reader-2vhx33n6.js"),
|
|
141
141
|
import("./store-y56y034s.js"),
|
|
142
142
|
import("./read-session-chunk-38wdy8nd.js"),
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
143
|
+
import("./render-2dan17xc.js"),
|
|
144
|
+
import("./search-archive-89hdy0a2.js"),
|
|
145
145
|
import("./expand-attachments-h33jbgyz.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./server-gzy5w8ya.js";
|
|
16
16
|
import {
|
|
17
17
|
setBootQuietPeriodForTests
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-1rrmxhd1.js";
|
|
19
19
|
import {
|
|
20
20
|
isEmbeddingHostBusy2
|
|
21
21
|
} from "./server-qt1qqasc.js";
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
findMisScopedCompartmentChunkEmbeddingIdsForProject,
|
|
69
69
|
recordSessionProjectIdentity,
|
|
70
70
|
repairMisScopedCompartmentChunkEmbeddingsForProject
|
|
71
|
-
} from "./server-
|
|
71
|
+
} from "./server-gqkdfdvw.js";
|
|
72
72
|
import {
|
|
73
73
|
saveEmbeddingIfHashMatches,
|
|
74
74
|
getMemoryEmbedCoverage,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
logLocalEmbeddingPoolingUnavailableOnce,
|
|
84
84
|
getEmbeddingProviderIdentity,
|
|
85
85
|
LocalEmbeddingProvider
|
|
86
|
-
} from "./server-
|
|
86
|
+
} from "./server-pjk9spbf.js";
|
|
87
87
|
import {
|
|
88
88
|
isKnownAutocommit
|
|
89
89
|
} from "./server-8ajstryz.js";
|