@cortexkit/pi-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.
Files changed (31) hide show
  1. package/dist/auto-search-worker.js +3 -3
  2. package/dist/{embedding-backfill-b71dvfs8.js → embedding-backfill-scywarbn.js} +7 -7
  3. package/dist/embedding-worker-process.js +29 -0
  4. package/dist/embedding-worker.js +5 -5
  5. package/dist/index-0j0zqb4t.js +712 -0
  6. package/dist/{index-hwqb3s7f.js → index-0rasmwm8.js} +5 -5
  7. package/dist/{index-bejpsj10.js → index-27jh224p.js} +1 -1
  8. package/dist/{index-ehybv5nr.js → index-28vnkyy7.js} +1129 -2990
  9. package/dist/{index-r024r8da.js → index-4gfq5t09.js} +16 -1
  10. package/dist/{index-vf38qhee.js → index-81nthk8j.js} +44 -1
  11. package/dist/{index-yzcjxnt2.js → index-b2anqqad.js} +422 -6
  12. package/dist/{index-1evzceyw.js → index-cyrnv16r.js} +314 -1072
  13. package/dist/index-fqb1bddn.js +4947 -0
  14. package/dist/{index-041ex0cj.js → index-g7hndmqm.js} +20 -34
  15. package/dist/index-gc2749rx.js +1168 -0
  16. package/dist/{index-t7xfqtg6.js → index-p5zesr4e.js} +22 -718
  17. package/dist/{index-yarjn32j.js → index-r874cgmv.js} +38 -36
  18. package/dist/{index-3mgf68pn.js → index-rd53pk0h.js} +1 -1
  19. package/dist/{index-904reqtg.js → index-rdtgp48t.js} +6 -4
  20. package/dist/index.js +1637 -1126
  21. package/dist/{message-index-bounded-qz5dz2se.js → message-index-bounded-110sb4fm.js} +6 -5
  22. package/dist/migration-worker.js +6 -5
  23. package/dist/{project-embedding-registry-ky7wrkr1.js → project-embedding-registry-64t0mw8y.js} +6 -6
  24. package/dist/raw-ordinal-warmup-worker.js +1 -1
  25. package/dist/{read-session-chunk-24sd89tf.js → read-session-chunk-rvmc25n5.js} +3 -2
  26. package/dist/{search-jbh28nwy.js → search-7z3w8pmz.js} +15 -14
  27. package/dist/subagent-entry.js +17 -16
  28. package/package.json +3 -3
  29. package/dist/index-3rea6zd9.js +0 -2396
  30. package/dist/index-bgmv2kaf.js +0 -290
  31. /package/dist/{index-5prbx026.js → index-2pp04pmg.js} +0 -0
@@ -2,41 +2,27 @@ import {
2
2
  getMagicContextStorageDir,
3
3
  log2
4
4
  } from "./index-x3dcnxh0.js";
5
+ import {
6
+ projectDirectoryKey
7
+ } from "./index-4gfq5t09.js";
5
8
  import {
6
9
  writeStorageFileAtomicSync
7
- } from "./index-vf38qhee.js";
10
+ } from "./index-81nthk8j.js";
8
11
 
9
12
  // ../plugin/src/features/magic-context/memory/project-identity.ts
10
13
  import { execFileSync } from "node:child_process";
11
14
  import { createHash as createHash2 } from "node:crypto";
12
15
  import { existsSync, realpathSync, statSync } from "node:fs";
13
16
  import { homedir } from "node:os";
14
- import path3 from "node:path";
17
+ import path2 from "node:path";
15
18
 
16
19
  // ../plugin/src/features/magic-context/memory/project-identity-cache.ts
17
20
  import { createHash } from "node:crypto";
18
21
  import { readFileSync } from "node:fs";
19
- import path2 from "node:path";
20
-
21
- // ../plugin/src/shared/project-directory-key.ts
22
22
  import path from "node:path";
23
- function projectDirectoryKey(directory) {
24
- const slashed = directory.replaceAll("\\", "/").replace(/^\/\/\?\/UNC\//i, "//").replace(/^\/\/\?\//, "");
25
- if (/^[a-z]:\//i.test(slashed) || slashed.startsWith("//")) {
26
- return path.win32.normalize(slashed).replaceAll("\\", "/").replace(/\/$/, "").toLowerCase();
27
- }
28
- return path.resolve(directory);
29
- }
30
- function sameProjectDirectory(a, b) {
31
- if (a.length === 0 || b.length === 0)
32
- return false;
33
- return projectDirectoryKey(a) === projectDirectoryKey(b);
34
- }
35
-
36
- // ../plugin/src/features/magic-context/memory/project-identity-cache.ts
37
23
  function cachePath(directory, storageDir = getMagicContextStorageDir()) {
38
24
  const hash = createHash("sha256").update(projectDirectoryKey(directory)).digest("hex");
39
- return path2.join(storageDir, "project-identities", `${hash}.json`);
25
+ return path.join(storageDir, "project-identities", `${hash}.json`);
40
26
  }
41
27
  function rememberGitIdentity(directory, identity) {
42
28
  try {
@@ -127,7 +113,7 @@ function getErrorStderr(error) {
127
113
  return "";
128
114
  }
129
115
  function directoryFallback(directory) {
130
- const canonical = path3.resolve(directory);
116
+ const canonical = path2.resolve(directory);
131
117
  const hash = createHash2("md5").update(canonical, "utf8").digest("hex").slice(0, 12);
132
118
  return `dir:${hash}`;
133
119
  }
@@ -199,7 +185,7 @@ function classifyGitError(error, rawDirectory) {
199
185
  }
200
186
  function resolveProjectIdentityStrict(directory, allowHomeProject = homeProjectPermission) {
201
187
  assertProjectAllowed(directory, allowHomeProject);
202
- const canonical = path3.resolve(directory);
188
+ const canonical = path2.resolve(directory);
203
189
  const cached = identityCache.get(canonical);
204
190
  if (cached !== undefined) {
205
191
  return cached;
@@ -266,9 +252,9 @@ function nearestLastKnownGitIdentity(canonical) {
266
252
  const cached = lastKnownGitIdentity(current);
267
253
  if (cached !== undefined)
268
254
  return { identity: cached, source: current };
269
- if (existsSync(path3.join(current, ".git")))
255
+ if (existsSync(path2.join(current, ".git")))
270
256
  break;
271
- const parent = path3.dirname(current);
257
+ const parent = path2.dirname(current);
272
258
  if (parent === current)
273
259
  break;
274
260
  current = parent;
@@ -318,20 +304,20 @@ function isUserHomeDirectory(directory) {
318
304
  if (projectDirectoryKey(directory) === projectDirectoryKey(userHomeDirectoryForIdentity()))
319
305
  return true;
320
306
  try {
321
- return projectDirectoryKey(realpathSync.native(path3.resolve(directory))) === projectDirectoryKey(canonicalUserHomeDirectory());
307
+ return projectDirectoryKey(realpathSync.native(path2.resolve(directory))) === projectDirectoryKey(canonicalUserHomeDirectory());
322
308
  } catch {
323
309
  return false;
324
310
  }
325
311
  }
326
312
  function assertProjectAllowed(directory, allowHomeProject) {
327
- const canonical = path3.resolve(directory);
313
+ const canonical = path2.resolve(directory);
328
314
  if (!allowHomeProject && (isUserHomeDirectory(directory) || isUserHomeDirectory(gitRootDirectory(canonical) ?? canonical))) {
329
315
  throw new ProjectIdentityError("home_project_disabled", directory, "Home project memory is disabled; set allow_home_project to opt in");
330
316
  }
331
317
  }
332
318
  function resolveProjectIdentity(directory, allowHomeProject = homeProjectPermission) {
333
319
  assertProjectAllowed(directory, allowHomeProject);
334
- const canonical = path3.resolve(directory);
320
+ const canonical = path2.resolve(directory);
335
321
  const cachedFallback = directoryFallbackCache.get(canonical);
336
322
  if (cachedFallback !== undefined) {
337
323
  if (!hasGitDir(canonical)) {
@@ -379,7 +365,7 @@ function resolveProjectIdentityOrFallback(directory, allowHomeProject = homeProj
379
365
  try {
380
366
  return resolveProjectIdentity(directory, allowHomeProject);
381
367
  } catch (error) {
382
- const canonical = path3.resolve(directory);
368
+ const canonical = path2.resolve(directory);
383
369
  if (hasGitDir(canonical) || error instanceof ProjectIdentityError && error.errorClass === "home_project_disabled")
384
370
  throw error;
385
371
  const fallback = rememberedIdentityOrDirectoryFallback(canonical);
@@ -402,14 +388,14 @@ function hasGitDir(canonical) {
402
388
  function gitRootInAncestorChain(startDirectory) {
403
389
  let current = startDirectory;
404
390
  while (true) {
405
- if (existsSync(path3.join(current, ".git"))) {
391
+ if (existsSync(path2.join(current, ".git"))) {
406
392
  try {
407
393
  return realpathSync.native(current);
408
394
  } catch {
409
- return path3.resolve(current);
395
+ return path2.resolve(current);
410
396
  }
411
397
  }
412
- const parent = path3.dirname(current);
398
+ const parent = path2.dirname(current);
413
399
  if (parent === current) {
414
400
  return null;
415
401
  }
@@ -431,13 +417,13 @@ function gitRootDirectory(canonical) {
431
417
  }
432
418
  }
433
419
  function directoryHasGitMetadata(directory) {
434
- return gitRootDirectory(path3.resolve(directory)) !== null;
420
+ return gitRootDirectory(path2.resolve(directory)) !== null;
435
421
  }
436
422
  function isUsableProjectIdentity(identity) {
437
423
  return typeof identity === "string" && identity.trim().length > 0;
438
424
  }
439
425
  function resolveProjectIdentityForSession(directory, allowHomeProject = homeProjectPermission) {
440
- const resolvedDirectory = path3.resolve(directory);
426
+ const resolvedDirectory = path2.resolve(directory);
441
427
  const cacheKey = `${allowHomeProject ? "1" : "0"}\x00${resolvedDirectory}`;
442
428
  const cached = sessionIdentityCache.get(cacheKey);
443
429
  if (cached && (cached.revalidateAt === null || nowMs() < cached.revalidateAt) && !(cached.identity?.startsWith("dir:") && hasGitDir(resolvedDirectory))) {
@@ -516,4 +502,4 @@ function setBootQuietPeriodForTests(startAtMs) {
516
502
  bootQuietUntilMs = startAtMs === null ? 0 : startAtMs + BOOT_QUIET_MS;
517
503
  }
518
504
 
519
- export { sameProjectDirectory, setHomeProjectPermission, ProjectIdentityError, resolveProjectIdentityStrict, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, bootQuietRemainingMs, scheduleAfterBootQuiet, setBootQuietPeriodForTests };
505
+ export { setHomeProjectPermission, ProjectIdentityError, resolveProjectIdentityStrict, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, bootQuietRemainingMs, scheduleAfterBootQuiet, setBootQuietPeriodForTests };