@cortexkit/pi-magic-context 0.48.0 → 0.49.1

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 (47) hide show
  1. package/dist/auto-search-worker.js +3 -3
  2. package/dist/embedding-backfill-scywarbn.js +20 -0
  3. package/dist/embedding-worker-process.js +29 -0
  4. package/dist/embedding-worker.js +6 -6
  5. package/dist/historian-calibration-extension.js +30 -5
  6. package/dist/index-0j0zqb4t.js +712 -0
  7. package/dist/{index-pvm4pd5d.js → index-0rasmwm8.js} +811 -76
  8. package/dist/{index-fp37he9a.js → index-0vrkp1jq.js} +1 -1
  9. package/dist/{index-419bndtm.js → index-21v1kfs7.js} +2 -2
  10. package/dist/{index-fm3ksh5e.js → index-27jh224p.js} +4 -4
  11. package/dist/{index-98z1c1r0.js → index-28vnkyy7.js} +1231 -3018
  12. package/dist/{index-wrm4nbj7.js → index-290tzwp1.js} +1 -1
  13. package/dist/{index-603mt6nm.js → index-4gfq5t09.js} +17 -2
  14. package/dist/{index-vf38qhee.js → index-81nthk8j.js} +44 -1
  15. package/dist/{index-5jp1h0bz.js → index-b2anqqad.js} +467 -14
  16. package/dist/{index-6pgq5ns2.js → index-cyrnv16r.js} +314 -1072
  17. package/dist/index-fqb1bddn.js +4947 -0
  18. package/dist/{index-dkx0b1kt.js → index-g7hndmqm.js} +20 -29
  19. package/dist/index-gc2749rx.js +1168 -0
  20. package/dist/{index-5hd7h4rr.js → index-kjd1fj55.js} +39 -31
  21. package/dist/{index-8y5knskr.js → index-mcgehvgw.js} +93 -9
  22. package/dist/{index-r7xg4hvw.js → index-p5zesr4e.js} +26 -722
  23. package/dist/{index-9xb0axhc.js → index-r56xgha8.js} +1 -1
  24. package/dist/{index-544c0e0x.js → index-r874cgmv.js} +42 -40
  25. package/dist/{index-72bdc1bd.js → index-rd53pk0h.js} +4 -4
  26. package/dist/{index-0am8a7k1.js → index-rdtgp48t.js} +8 -6
  27. package/dist/{index-rt5jgzp1.js → index-vakawmbc.js} +160 -25
  28. package/dist/{index-f956htf3.js → index-x3dcnxh0.js} +6 -2
  29. package/dist/{index-zrr5t5a7.js → index-zh1jw8qp.js} +106 -1
  30. package/dist/index.js +2271 -1769
  31. package/dist/{logger-v3dsxdnm.js → logger-j6tecd1h.js} +1 -1
  32. package/dist/{message-index-bounded-t7vvty76.js → message-index-bounded-110sb4fm.js} +13 -12
  33. package/dist/{message-time-backfill-4ndf7hrq.js → message-time-backfill-05ppypkz.js} +2 -2
  34. package/dist/migration-worker.js +10 -9
  35. package/dist/{project-embedding-registry-jy2hmq28.js → project-embedding-registry-64t0mw8y.js} +10 -10
  36. package/dist/raw-ordinal-warmup-worker.js +4 -4
  37. package/dist/{read-session-chunk-47pjn7fz.js → read-session-chunk-rvmc25n5.js} +10 -7
  38. package/dist/{read-session-raw-yn8nawav.js → read-session-raw-npx3920c.js} +5 -3
  39. package/dist/{safe-notification-target-3c1ns931.js → safe-notification-target-vn9kpmv4.js} +2 -2
  40. package/dist/{search-42szfhwp.js → search-7z3w8pmz.js} +19 -18
  41. package/dist/{storage-tags-jym5z6yk.js → storage-tags-kjnsqbdb.js} +6 -6
  42. package/dist/subagent-entry.js +25 -23
  43. package/package.json +3 -3
  44. package/dist/embedding-backfill-bnnytehy.js +0 -20
  45. package/dist/index-bgmv2kaf.js +0 -290
  46. package/dist/index-hrf13mn3.js +0 -2388
  47. /package/dist/{index-5prbx026.js → index-2pp04pmg.js} +0 -0
@@ -1,37 +1,28 @@
1
1
  import {
2
2
  getMagicContextStorageDir,
3
3
  log2
4
- } from "./index-f956htf3.js";
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
-
31
- // ../plugin/src/features/magic-context/memory/project-identity-cache.ts
32
23
  function cachePath(directory, storageDir = getMagicContextStorageDir()) {
33
24
  const hash = createHash("sha256").update(projectDirectoryKey(directory)).digest("hex");
34
- return path2.join(storageDir, "project-identities", `${hash}.json`);
25
+ return path.join(storageDir, "project-identities", `${hash}.json`);
35
26
  }
36
27
  function rememberGitIdentity(directory, identity) {
37
28
  try {
@@ -122,7 +113,7 @@ function getErrorStderr(error) {
122
113
  return "";
123
114
  }
124
115
  function directoryFallback(directory) {
125
- const canonical = path3.resolve(directory);
116
+ const canonical = path2.resolve(directory);
126
117
  const hash = createHash2("md5").update(canonical, "utf8").digest("hex").slice(0, 12);
127
118
  return `dir:${hash}`;
128
119
  }
@@ -194,7 +185,7 @@ function classifyGitError(error, rawDirectory) {
194
185
  }
195
186
  function resolveProjectIdentityStrict(directory, allowHomeProject = homeProjectPermission) {
196
187
  assertProjectAllowed(directory, allowHomeProject);
197
- const canonical = path3.resolve(directory);
188
+ const canonical = path2.resolve(directory);
198
189
  const cached = identityCache.get(canonical);
199
190
  if (cached !== undefined) {
200
191
  return cached;
@@ -261,9 +252,9 @@ function nearestLastKnownGitIdentity(canonical) {
261
252
  const cached = lastKnownGitIdentity(current);
262
253
  if (cached !== undefined)
263
254
  return { identity: cached, source: current };
264
- if (existsSync(path3.join(current, ".git")))
255
+ if (existsSync(path2.join(current, ".git")))
265
256
  break;
266
- const parent = path3.dirname(current);
257
+ const parent = path2.dirname(current);
267
258
  if (parent === current)
268
259
  break;
269
260
  current = parent;
@@ -313,20 +304,20 @@ function isUserHomeDirectory(directory) {
313
304
  if (projectDirectoryKey(directory) === projectDirectoryKey(userHomeDirectoryForIdentity()))
314
305
  return true;
315
306
  try {
316
- return projectDirectoryKey(realpathSync.native(path3.resolve(directory))) === projectDirectoryKey(canonicalUserHomeDirectory());
307
+ return projectDirectoryKey(realpathSync.native(path2.resolve(directory))) === projectDirectoryKey(canonicalUserHomeDirectory());
317
308
  } catch {
318
309
  return false;
319
310
  }
320
311
  }
321
312
  function assertProjectAllowed(directory, allowHomeProject) {
322
- const canonical = path3.resolve(directory);
313
+ const canonical = path2.resolve(directory);
323
314
  if (!allowHomeProject && (isUserHomeDirectory(directory) || isUserHomeDirectory(gitRootDirectory(canonical) ?? canonical))) {
324
315
  throw new ProjectIdentityError("home_project_disabled", directory, "Home project memory is disabled; set allow_home_project to opt in");
325
316
  }
326
317
  }
327
318
  function resolveProjectIdentity(directory, allowHomeProject = homeProjectPermission) {
328
319
  assertProjectAllowed(directory, allowHomeProject);
329
- const canonical = path3.resolve(directory);
320
+ const canonical = path2.resolve(directory);
330
321
  const cachedFallback = directoryFallbackCache.get(canonical);
331
322
  if (cachedFallback !== undefined) {
332
323
  if (!hasGitDir(canonical)) {
@@ -374,7 +365,7 @@ function resolveProjectIdentityOrFallback(directory, allowHomeProject = homeProj
374
365
  try {
375
366
  return resolveProjectIdentity(directory, allowHomeProject);
376
367
  } catch (error) {
377
- const canonical = path3.resolve(directory);
368
+ const canonical = path2.resolve(directory);
378
369
  if (hasGitDir(canonical) || error instanceof ProjectIdentityError && error.errorClass === "home_project_disabled")
379
370
  throw error;
380
371
  const fallback = rememberedIdentityOrDirectoryFallback(canonical);
@@ -397,14 +388,14 @@ function hasGitDir(canonical) {
397
388
  function gitRootInAncestorChain(startDirectory) {
398
389
  let current = startDirectory;
399
390
  while (true) {
400
- if (existsSync(path3.join(current, ".git"))) {
391
+ if (existsSync(path2.join(current, ".git"))) {
401
392
  try {
402
393
  return realpathSync.native(current);
403
394
  } catch {
404
- return path3.resolve(current);
395
+ return path2.resolve(current);
405
396
  }
406
397
  }
407
- const parent = path3.dirname(current);
398
+ const parent = path2.dirname(current);
408
399
  if (parent === current) {
409
400
  return null;
410
401
  }
@@ -426,13 +417,13 @@ function gitRootDirectory(canonical) {
426
417
  }
427
418
  }
428
419
  function directoryHasGitMetadata(directory) {
429
- return gitRootDirectory(path3.resolve(directory)) !== null;
420
+ return gitRootDirectory(path2.resolve(directory)) !== null;
430
421
  }
431
422
  function isUsableProjectIdentity(identity) {
432
423
  return typeof identity === "string" && identity.trim().length > 0;
433
424
  }
434
425
  function resolveProjectIdentityForSession(directory, allowHomeProject = homeProjectPermission) {
435
- const resolvedDirectory = path3.resolve(directory);
426
+ const resolvedDirectory = path2.resolve(directory);
436
427
  const cacheKey = `${allowHomeProject ? "1" : "0"}\x00${resolvedDirectory}`;
437
428
  const cached = sessionIdentityCache.get(cacheKey);
438
429
  if (cached && (cached.revalidateAt === null || nowMs() < cached.revalidateAt) && !(cached.identity?.startsWith("dir:") && hasGitDir(resolvedDirectory))) {