@cortexkit/opencode-magic-context 0.49.0 → 0.49.2
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-fp14dw0n.js → announcement-hdbkt8v5.js} +1 -1
- package/dist/auto-search-worker.js +3 -3
- package/dist/config/{mural-model-deprecation.d.ts → deprecated-config.d.ts} +4 -1
- package/dist/config/deprecated-config.d.ts.map +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +2 -2
- package/dist/config/schema/magic-context.d.ts +4 -4
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-kzx4dmk1.js → conflict-warning-hook-asnt6hfc.js} +3 -3
- package/dist/{context-nj5f293n.js → context-tfyhtdcs.js} +111 -45
- package/dist/{derive-budgets-qz5rrr08.js → derive-budgets-j4ry8j8n.js} +1 -1
- package/dist/{embedding-backfill-aetxv1vt.js → embedding-backfill-wyc3ykyf.js} +7 -7
- package/dist/embedding-worker-process.js +30 -0
- package/dist/embedding-worker.js +5 -5
- package/dist/features/magic-context/dreamer/task-registry.d.ts +2 -3
- package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts +8 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-process.d.ts +2 -0
- package/dist/features/magic-context/memory/embedding-worker-process.d.ts.map +1 -0
- package/dist/features/magic-context/memory/onnx-telemetry.d.ts +3 -0
- package/dist/features/magic-context/memory/onnx-telemetry.d.ts.map +1 -0
- package/dist/features/magic-context/overflow-detection.d.ts +1 -2
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts +1 -0
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +1 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +1 -0
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts +3 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-persist.d.ts +8 -14
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts +62 -0
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts +38 -0
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-replay.d.ts +3 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/opaque-thinking.d.ts +12 -0
- package/dist/hooks/magic-context/opaque-thinking.d.ts.map +1 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts +2 -2
- package/dist/hooks/magic-context/pending-materialization.d.ts +8 -0
- package/dist/hooks/magic-context/pending-materialization.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-db.d.ts +3 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +1 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.d.ts +5 -2
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-date-refresh.d.ts +29 -0
- package/dist/hooks/magic-context/system-date-refresh.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-dates.d.ts +6 -0
- package/dist/hooks/magic-context/system-prompt-dates.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-delivery.d.ts +47 -0
- package/dist/hooks/magic-context/system-prompt-delivery.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +4 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +8 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +2 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +6 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-9qjqq45k.js → index-0pjvpfkf.js} +21 -1
- package/dist/index-6m7rdv7y.js +733 -0
- package/dist/{index-1r0k9js3.js → index-6tfxmc4n.js} +10 -10
- package/dist/{index-gzcmtmar.js → index-7w18gg78.js} +25 -1
- package/dist/{index-nm6a8xpd.js → index-att4bfan.js} +1 -1
- package/dist/{index-ezmszwbd.js → index-eypn4ba6.js} +7 -4
- package/dist/{index-ha87j7a8.js → index-fdtkt5r1.js} +6 -6
- package/dist/{index-kp5qe690.js → index-fg00p1cg.js} +38 -36
- package/dist/{index-1bc61ans.js → index-fvnzcnww.js} +44 -1
- package/dist/index-gbmqa9x9.js +1170 -0
- package/dist/{index-pxwp2hjk.js → index-gzky5rva.js} +30 -53
- package/dist/{index-kq57tdf0.js → index-k6xvbj2e.js} +255 -1075
- package/dist/{index-0w56v4fm.js → index-mw7c950g.js} +1 -1
- package/dist/{index-1g30axtz.js → index-p0n5ryq8.js} +82 -900
- package/dist/{index-b7mv1jx3.js → index-p1hnwfd8.js} +1 -1
- package/dist/{index-peshmj6h.js → index-r2zcs71c.js} +6 -4
- package/dist/{index-kmpvemph.js → index-rafsaxac.js} +2 -2
- package/dist/{index-stbr4ce6.js → index-s7fc0fkn.js} +1 -1
- package/dist/{index-hj2q50k0.js → index-sfhndpcb.js} +463 -6
- package/dist/index-sv0bb7vg.js +6972 -0
- package/dist/{index-57mrqed8.js → index-w23dh319.js} +17 -258
- package/dist/{index-9rt53q79.js → index-xgrwmj82.js} +1 -1
- package/dist/{index-h2py7207.js → index-xnanvj3w.js} +765 -1255
- package/dist/{index-2jcbj7r1.js → index-zfzdpeq2.js} +2269 -3802
- package/dist/{index-s4j7t92z.js → index-zg8yq4ya.js} +29 -744
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +209 -61
- package/dist/{message-index-bounded-h0mrd4pr.js → message-index-bounded-hqktkhdy.js} +7 -6
- package/dist/migration-worker.js +6 -5
- package/dist/plugin/hooks/create-session-hooks.d.ts +3 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{project-embedding-registry-rtt0djyb.js → project-embedding-registry-0gv3h6y8.js} +6 -6
- package/dist/raw-ordinal-warmup-worker.js +1 -1
- package/dist/{read-session-chunk-ty89v75e.js → read-session-chunk-5mh0bh8y.js} +5 -4
- package/dist/{recomp-orchestrator-4f1yyd1q.js → recomp-orchestrator-kpkhkjhq.js} +20 -19
- package/dist/{search-pz4f4wge.js → search-p9w39qv4.js} +15 -14
- package/dist/{send-session-notification-38cd5dqt.js → send-session-notification-xffh3bbe.js} +2 -2
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/storage-file-mutex.d.ts +9 -0
- package/dist/shared/storage-file-mutex.d.ts.map +1 -0
- package/dist/shared/storage-permissions.d.ts +6 -0
- package/dist/shared/storage-permissions.d.ts.map +1 -1
- package/dist/shared/window-geometry.d.ts +9 -66
- package/dist/shared/window-geometry.d.ts.map +1 -1
- package/dist/standalone-plugin-marker.d.ts +8 -0
- package/dist/standalone-plugin-marker.d.ts.map +1 -0
- package/dist/tools/ctx-reduce/constants.d.ts +1 -2
- package/dist/tools/ctx-reduce/constants.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-tck4g20s.js → transform-postprocess-phase-481j5a7z.js} +20 -19
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/{context-crbt6p1y.js → context-gsdtha5v.js} +873 -2122
- package/dist/v2/{derive-budgets-fgej9j46.js → derive-budgets-enckmg7y.js} +2 -2
- package/dist/v2/{embedding-backfill-ph1qfyn3.js → embedding-backfill-dbvjbcmm.js} +8 -9
- package/dist/v2/embedding-worker-process.js +29 -0
- package/dist/v2/embedding-worker.js +3 -4
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/copied-tag-notation.d.ts +19 -0
- package/dist/v2/hooks/copied-tag-notation.d.ts.map +1 -0
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/system-prompt-response.d.ts +5 -0
- package/dist/v2/hooks/system-prompt-response.d.ts.map +1 -0
- package/dist/v2/{message-index-bounded-xwqdywxg.js → message-index-bounded-p6v0n8qh.js} +8 -7
- package/dist/v2/migration-worker.js +6 -5
- package/dist/v2/{project-embedding-registry-d6m7tyxr.js → project-embedding-registry-nyq7z8y6.js} +7 -8
- package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
- package/dist/v2/{read-session-chunk-8p5mdryx.js → read-session-chunk-fhyfe4qa.js} +6 -5
- package/dist/v2/{recomp-orchestrator-ckfgt6wq.js → recomp-orchestrator-5xy7w136.js} +22 -22
- package/dist/v2/{search-ym8rehhz.js → search-j7bakcwa.js} +17 -17
- package/dist/v2/{send-session-notification-5m0yapqx.js → send-session-notification-f6v698r5.js} +2 -2
- package/dist/v2/{server-jvxzm1jy.js → server-1fszbabv.js} +28 -28
- package/dist/v2/{server-3j4d00kf.js → server-2htmbqbv.js} +25 -1
- package/dist/v2/{server-c5rrgrcd.js → server-4c7jt8gq.js} +25 -1
- package/dist/v2/{server-ycw9qqcy.js → server-4enr7s6x.js} +1 -1
- package/dist/v2/{server-v4mewb78.js → server-6tcrjfw8.js} +1 -1
- package/dist/v2/{server-x4hscabv.js → server-7spkq1y6.js} +2257 -3746
- package/dist/v2/{server-sa8jvrfc.js → server-7vkj6zhb.js} +29 -744
- package/dist/v2/{server-xwz4dqh9.js → server-8xmq9h3f.js} +30 -53
- package/dist/v2/{server-1tk82krw.js → server-bgzy0phk.js} +463 -6
- package/dist/v2/server-c7n2ftng.js +6860 -0
- package/dist/v2/server-cvgn49tr.js +733 -0
- package/dist/v2/{server-zm570tr2.js → server-cw6521wn.js} +232 -7
- package/dist/v2/{server-pj4pjv02.js → server-czb2rkpk.js} +21 -1
- package/dist/v2/{server-19zjmn02.js → server-d6g4whc2.js} +20 -14
- package/dist/v2/{server-1bc61ans.js → server-fvnzcnww.js} +44 -1
- package/dist/v2/{server-w32kmdez.js → server-kh958yj8.js} +3 -3
- package/dist/v2/{server-q4ph9bwn.js → server-mqvtz7wz.js} +7 -7
- package/dist/v2/{server-2s6ayq3t.js → server-ras2sxnc.js} +133 -13
- package/dist/v2/{server-ss95ky04.js → server-s2st631p.js} +1 -1
- package/dist/v2/{server-2s9qz6n7.js → server-t528t8qm.js} +1 -1
- package/dist/v2/{server-8k2agx29.js → server-vb7pbd9p.js} +17 -258
- package/dist/v2/{server-zp53y8js.js → server-zbxjj2mz.js} +2 -2
- package/dist/v2/server.d.ts.map +1 -1
- package/dist/v2/server.js +149 -5
- package/dist/v2/{storage-tags-8vw924zn.js → storage-tags-5yxrvkaf.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-a7efxaax.js → wrapup-orchestrator-yem5422s.js} +28 -28
- package/dist/{wrapup-orchestrator-barbc6h9.js → wrapup-orchestrator-xvrr27ws.js} +21 -20
- package/package.json +4 -4
- package/src/config/{mural-model-deprecation.ts → deprecated-config.ts} +19 -0
- package/src/config/index.test.ts +15 -37
- package/src/config/index.ts +2 -3
- package/src/config/project-security.ts +3 -3
- package/src/config/schema/magic-context.ts +11 -7
- package/src/features/magic-context/dreamer/task-registry.ts +2 -3
- package/src/shared/models-dev-cache.ts +1 -7
- package/src/shared/sqlite-640-review.test.ts +5 -1
- package/src/shared/storage-file-mutex-review.test.ts +162 -0
- package/src/shared/storage-file-mutex.ts +130 -0
- package/src/shared/storage-permissions.ts +46 -0
- package/src/shared/window-geometry.test.ts +102 -236
- package/src/shared/window-geometry.ts +23 -413
- package/dist/config/mural-model-deprecation.d.ts.map +0 -1
- package/dist/index-2jgwttpt.js +0 -3269
- package/dist/index-mfkzp7qj.js +0 -229
- package/dist/v2/server-4ez8mntn.js +0 -3213
- package/dist/v2/server-mfkzp7qj.js +0 -229
- package/src/shared/__fixtures__/window-overlay.v1.json +0 -337
- /package/dist/{index-2pp04pmg.js → index-69vas84q.js} +0 -0
- /package/dist/v2/{index-2pp04pmg.js → index-69vas84q.js} +0 -0
|
@@ -4,50 +4,27 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
6
|
} from "./index-nsjyysj0.js";
|
|
7
|
+
import {
|
|
8
|
+
projectDirectoryKey
|
|
9
|
+
} from "./index-7w18gg78.js";
|
|
7
10
|
import {
|
|
8
11
|
writeStorageFileAtomicSync
|
|
9
|
-
} from "./index-
|
|
12
|
+
} from "./index-fvnzcnww.js";
|
|
10
13
|
|
|
11
14
|
// src/features/magic-context/memory/project-identity.ts
|
|
12
15
|
import { execFileSync } from "node:child_process";
|
|
13
16
|
import { createHash as createHash2 } from "node:crypto";
|
|
14
|
-
import { existsSync, realpathSync
|
|
17
|
+
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
15
18
|
import { homedir } from "node:os";
|
|
16
|
-
import
|
|
19
|
+
import path2 from "node:path";
|
|
17
20
|
|
|
18
21
|
// src/features/magic-context/memory/project-identity-cache.ts
|
|
19
22
|
import { createHash } from "node:crypto";
|
|
20
23
|
import { readFileSync } from "node:fs";
|
|
21
|
-
import path2 from "node:path";
|
|
22
|
-
|
|
23
|
-
// src/shared/project-directory-key.ts
|
|
24
|
-
import { realpathSync } from "node:fs";
|
|
25
24
|
import path from "node:path";
|
|
26
|
-
function projectDirectoryKey(directory) {
|
|
27
|
-
const slashed = directory.replaceAll("\\", "/").replace(/^\/\/\?\/UNC\//i, "//").replace(/^\/\/\?\//, "");
|
|
28
|
-
if (/^[a-z]:\//i.test(slashed) || slashed.startsWith("//")) {
|
|
29
|
-
return path.win32.normalize(slashed).replaceAll("\\", "/").replace(/\/$/, "").toLowerCase();
|
|
30
|
-
}
|
|
31
|
-
return path.resolve(directory);
|
|
32
|
-
}
|
|
33
|
-
function sameProjectDirectory(a, b) {
|
|
34
|
-
if (a.length === 0 || b.length === 0)
|
|
35
|
-
return false;
|
|
36
|
-
return projectDirectoryKey(a) === projectDirectoryKey(b);
|
|
37
|
-
}
|
|
38
|
-
var realpathForCanonicalDirectory = (directory) => realpathSync.native(directory);
|
|
39
|
-
function canonicalProjectDirectory(directory) {
|
|
40
|
-
let resolved = directory;
|
|
41
|
-
try {
|
|
42
|
-
resolved = realpathForCanonicalDirectory(directory);
|
|
43
|
-
} catch {}
|
|
44
|
-
return projectDirectoryKey(resolved);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// src/features/magic-context/memory/project-identity-cache.ts
|
|
48
25
|
function cachePath(directory, storageDir = getMagicContextStorageDir()) {
|
|
49
26
|
const hash = createHash("sha256").update(projectDirectoryKey(directory)).digest("hex");
|
|
50
|
-
return
|
|
27
|
+
return path.join(storageDir, "project-identities", `${hash}.json`);
|
|
51
28
|
}
|
|
52
29
|
function rememberGitIdentity(directory, identity) {
|
|
53
30
|
try {
|
|
@@ -153,7 +130,7 @@ function getErrorStderr(error) {
|
|
|
153
130
|
return "";
|
|
154
131
|
}
|
|
155
132
|
function directoryFallback(directory) {
|
|
156
|
-
const canonical =
|
|
133
|
+
const canonical = path2.resolve(directory);
|
|
157
134
|
const hash = createHash2("md5").update(canonical, "utf8").digest("hex").slice(0, 12);
|
|
158
135
|
return `dir:${hash}`;
|
|
159
136
|
}
|
|
@@ -225,7 +202,7 @@ function classifyGitError(error, rawDirectory) {
|
|
|
225
202
|
}
|
|
226
203
|
function resolveProjectIdentityStrict(directory, allowHomeProject = homeProjectPermission) {
|
|
227
204
|
assertProjectAllowed(directory, allowHomeProject);
|
|
228
|
-
const canonical =
|
|
205
|
+
const canonical = path2.resolve(directory);
|
|
229
206
|
const cached = identityCache.get(canonical);
|
|
230
207
|
if (cached !== undefined) {
|
|
231
208
|
return cached;
|
|
@@ -292,9 +269,9 @@ function nearestLastKnownGitIdentity(canonical) {
|
|
|
292
269
|
const cached = lastKnownGitIdentity(current);
|
|
293
270
|
if (cached !== undefined)
|
|
294
271
|
return { identity: cached, source: current };
|
|
295
|
-
if (existsSync(
|
|
272
|
+
if (existsSync(path2.join(current, ".git")))
|
|
296
273
|
break;
|
|
297
|
-
const parent =
|
|
274
|
+
const parent = path2.dirname(current);
|
|
298
275
|
if (parent === current)
|
|
299
276
|
break;
|
|
300
277
|
current = parent;
|
|
@@ -305,7 +282,7 @@ function nearestLastKnownGitIdentity(canonical) {
|
|
|
305
282
|
if (exactOrAncestor)
|
|
306
283
|
return exactOrAncestor;
|
|
307
284
|
try {
|
|
308
|
-
const realCanonical =
|
|
285
|
+
const realCanonical = realpathSync.native(canonical);
|
|
309
286
|
if (realCanonical !== canonical)
|
|
310
287
|
return walk(realCanonical);
|
|
311
288
|
} catch {}
|
|
@@ -333,7 +310,7 @@ function recordDubiousOwnershipFallback(canonical) {
|
|
|
333
310
|
log2(`[magic-context] ${formatDubiousOwnershipWarning(canonical)}`);
|
|
334
311
|
}
|
|
335
312
|
function takeDubiousOwnershipProjectIdentityWarning(directory) {
|
|
336
|
-
const canonical =
|
|
313
|
+
const canonical = path2.resolve(directory);
|
|
337
314
|
if (!dubiousOwnershipFallbackDirectories.has(canonical))
|
|
338
315
|
return null;
|
|
339
316
|
if (dubiousOwnershipWarnedDirectories.has(canonical))
|
|
@@ -344,7 +321,7 @@ function takeDubiousOwnershipProjectIdentityWarning(directory) {
|
|
|
344
321
|
function canonicalUserHomeDirectory() {
|
|
345
322
|
const homeDirectory = userHomeDirectoryForIdentity();
|
|
346
323
|
try {
|
|
347
|
-
return
|
|
324
|
+
return realpathSync.native(homeDirectory);
|
|
348
325
|
} catch {
|
|
349
326
|
return homeDirectory;
|
|
350
327
|
}
|
|
@@ -353,20 +330,20 @@ function isUserHomeDirectory(directory) {
|
|
|
353
330
|
if (projectDirectoryKey(directory) === projectDirectoryKey(userHomeDirectoryForIdentity()))
|
|
354
331
|
return true;
|
|
355
332
|
try {
|
|
356
|
-
return projectDirectoryKey(
|
|
333
|
+
return projectDirectoryKey(realpathSync.native(path2.resolve(directory))) === projectDirectoryKey(canonicalUserHomeDirectory());
|
|
357
334
|
} catch {
|
|
358
335
|
return false;
|
|
359
336
|
}
|
|
360
337
|
}
|
|
361
338
|
function assertProjectAllowed(directory, allowHomeProject) {
|
|
362
|
-
const canonical =
|
|
339
|
+
const canonical = path2.resolve(directory);
|
|
363
340
|
if (!allowHomeProject && (isUserHomeDirectory(directory) || isUserHomeDirectory(gitRootDirectory(canonical) ?? canonical))) {
|
|
364
341
|
throw new ProjectIdentityError("home_project_disabled", directory, "Home project memory is disabled; set allow_home_project to opt in");
|
|
365
342
|
}
|
|
366
343
|
}
|
|
367
344
|
function resolveProjectIdentity(directory, allowHomeProject = homeProjectPermission) {
|
|
368
345
|
assertProjectAllowed(directory, allowHomeProject);
|
|
369
|
-
const canonical =
|
|
346
|
+
const canonical = path2.resolve(directory);
|
|
370
347
|
const cachedFallback = directoryFallbackCache.get(canonical);
|
|
371
348
|
if (cachedFallback !== undefined) {
|
|
372
349
|
if (!hasGitDir(canonical)) {
|
|
@@ -414,7 +391,7 @@ function resolveProjectIdentityOrFallback(directory, allowHomeProject = homeProj
|
|
|
414
391
|
try {
|
|
415
392
|
return resolveProjectIdentity(directory, allowHomeProject);
|
|
416
393
|
} catch (error) {
|
|
417
|
-
const canonical =
|
|
394
|
+
const canonical = path2.resolve(directory);
|
|
418
395
|
if (hasGitDir(canonical) || error instanceof ProjectIdentityError && error.errorClass === "home_project_disabled")
|
|
419
396
|
throw error;
|
|
420
397
|
const fallback = rememberedIdentityOrDirectoryFallback(canonical);
|
|
@@ -428,7 +405,7 @@ function hasGitDir(canonical) {
|
|
|
428
405
|
return true;
|
|
429
406
|
}
|
|
430
407
|
try {
|
|
431
|
-
const realCanonical =
|
|
408
|
+
const realCanonical = realpathSync.native(canonical);
|
|
432
409
|
return realCanonical !== canonical && hasGitDirInAncestorChain(realCanonical);
|
|
433
410
|
} catch {
|
|
434
411
|
return false;
|
|
@@ -437,14 +414,14 @@ function hasGitDir(canonical) {
|
|
|
437
414
|
function gitRootInAncestorChain(startDirectory) {
|
|
438
415
|
let current = startDirectory;
|
|
439
416
|
while (true) {
|
|
440
|
-
if (existsSync(
|
|
417
|
+
if (existsSync(path2.join(current, ".git"))) {
|
|
441
418
|
try {
|
|
442
|
-
return
|
|
419
|
+
return realpathSync.native(current);
|
|
443
420
|
} catch {
|
|
444
|
-
return
|
|
421
|
+
return path2.resolve(current);
|
|
445
422
|
}
|
|
446
423
|
}
|
|
447
|
-
const parent =
|
|
424
|
+
const parent = path2.dirname(current);
|
|
448
425
|
if (parent === current) {
|
|
449
426
|
return null;
|
|
450
427
|
}
|
|
@@ -459,21 +436,21 @@ function gitRootDirectory(canonical) {
|
|
|
459
436
|
if (direct)
|
|
460
437
|
return direct;
|
|
461
438
|
try {
|
|
462
|
-
const realCanonical =
|
|
439
|
+
const realCanonical = realpathSync.native(canonical);
|
|
463
440
|
return realCanonical === canonical ? null : gitRootInAncestorChain(realCanonical);
|
|
464
441
|
} catch {
|
|
465
442
|
return null;
|
|
466
443
|
}
|
|
467
444
|
}
|
|
468
445
|
function directoryHasGitMetadata(directory) {
|
|
469
|
-
return gitRootDirectory(
|
|
446
|
+
return gitRootDirectory(path2.resolve(directory)) !== null;
|
|
470
447
|
}
|
|
471
448
|
function describeUnresolvedProjectIdentity(directory) {
|
|
472
|
-
const resolvedDirectory =
|
|
449
|
+
const resolvedDirectory = path2.resolve(directory);
|
|
473
450
|
const canonicalHome = canonicalUserHomeDirectory();
|
|
474
451
|
const canonicalDirectory = (() => {
|
|
475
452
|
try {
|
|
476
|
-
return
|
|
453
|
+
return realpathSync.native(resolvedDirectory);
|
|
477
454
|
} catch {
|
|
478
455
|
return resolvedDirectory;
|
|
479
456
|
}
|
|
@@ -489,7 +466,7 @@ function isUsableProjectIdentity(identity) {
|
|
|
489
466
|
return typeof identity === "string" && identity.trim().length > 0;
|
|
490
467
|
}
|
|
491
468
|
function resolveProjectIdentityForSession(directory, allowHomeProject = homeProjectPermission) {
|
|
492
|
-
const resolvedDirectory =
|
|
469
|
+
const resolvedDirectory = path2.resolve(directory);
|
|
493
470
|
const cacheKey = `${allowHomeProject ? "1" : "0"}\x00${resolvedDirectory}`;
|
|
494
471
|
const cached = sessionIdentityCache.get(cacheKey);
|
|
495
472
|
if (cached && (cached.revalidateAt === null || nowMs() < cached.revalidateAt) && !(cached.identity?.startsWith("dir:") && hasGitDir(resolvedDirectory))) {
|
|
@@ -500,7 +477,7 @@ function resolveProjectIdentityForSession(directory, allowHomeProject = homeProj
|
|
|
500
477
|
const canonicalDirectory = (() => {
|
|
501
478
|
try {
|
|
502
479
|
filesystemProbeObserverForTests?.();
|
|
503
|
-
return
|
|
480
|
+
return realpathSync.native(resolvedDirectory);
|
|
504
481
|
} catch {
|
|
505
482
|
return resolvedDirectory;
|
|
506
483
|
}
|
|
@@ -568,4 +545,4 @@ function setBootQuietPeriodForTests(startAtMs) {
|
|
|
568
545
|
bootQuietUntilMs = startAtMs === null ? 0 : startAtMs + BOOT_QUIET_MS;
|
|
569
546
|
}
|
|
570
547
|
|
|
571
|
-
export {
|
|
548
|
+
export { setHomeProjectPermission, shouldSkipHomeProjectMemory, ProjectIdentityError, resolveProjectIdentityStrict, takeDubiousOwnershipProjectIdentityWarning, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, describeUnresolvedProjectIdentity, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, bootQuietRemainingMs, scheduleAfterBootQuiet, setBootQuietPeriodForTests };
|