@cortexkit/pi-magic-context 0.49.25 → 0.49.27

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 (39) hide show
  1. package/dist/auto-search-worker.js +4 -4
  2. package/dist/chunk-embedding-write-worker.js +8 -9
  3. package/dist/{compartment-chunk-embedding-g9a977b8.js → compartment-chunk-embedding-pkk5beqp.js} +3 -3
  4. package/dist/{embedding-backfill-qxzjy5v2.js → embedding-backfill-25fp3b8w.js} +7 -7
  5. package/dist/{index-0dr64gsy.js → index-0s14xaca.js} +2 -2
  6. package/dist/{index-n8e5e9fp.js → index-0x1c054v.js} +1 -1
  7. package/dist/{index-hxp6q5f8.js → index-48twbev2.js} +50 -36
  8. package/dist/{index-j3pz3a1b.js → index-4zemngt7.js} +1 -1
  9. package/dist/{index-d53veb5e.js → index-5d506f7y.js} +719 -23
  10. package/dist/{index-8hmqdav2.js → index-6981g1xv.js} +39 -8
  11. package/dist/{index-1g0r4req.js → index-bkcwcghx.js} +1308 -104
  12. package/dist/{index-8a2wvrda.js → index-bvpar0bg.js} +2 -5
  13. package/dist/{index-w1avzkdt.js → index-g026ztby.js} +1 -1
  14. package/dist/{index-cm9e52mb.js → index-kagezf2h.js} +18 -4
  15. package/dist/{index-wb2t932e.js → index-kmk3xpf9.js} +1 -1
  16. package/dist/{index-zn2xdbjy.js → index-sdsnb5b6.js} +8 -8
  17. package/dist/index-v0ht940m.js +488 -0
  18. package/dist/{index-cms6wfmd.js → index-vea2d9ka.js} +1 -1
  19. package/dist/{index-nxq2srg9.js → index-wjbqw6r1.js} +1 -1
  20. package/dist/{index-00c5a49f.js → index-xa90f88m.js} +3 -3
  21. package/dist/{index-fzfpq5bd.js → index-xw070axm.js} +3 -3
  22. package/dist/index.js +726 -688
  23. package/dist/{message-fts-rowid-map-1tb3qjtc.js → message-fts-rowid-map-3mbvdgn9.js} +2 -4
  24. package/dist/{message-index-bounded-yj7s7cwz.js → message-index-bounded-avbaa7wa.js} +19 -22
  25. package/dist/migration-worker.js +7 -8
  26. package/dist/{project-embedding-registry-9e82qsb6.js → project-embedding-registry-hc4ahjdt.js} +6 -6
  27. package/dist/raw-ordinal-warmup-worker.js +7 -30
  28. package/dist/{read-session-chunk-rndwjfrx.js → read-session-chunk-1rfprgc1.js} +6 -4
  29. package/dist/{read-session-raw-napqv76k.js → read-session-raw-g9b1zdn5.js} +3 -1
  30. package/dist/{search-archive-qa1sf8hc.js → search-archive-mpjeecwj.js} +5 -5
  31. package/dist/{search-2aa5kzyp.js → search-vkkfg27q.js} +13 -14
  32. package/dist/{storage-tags-r48vxthe.js → storage-tags-9qaasrky.js} +2 -2
  33. package/dist/subagent-entry.js +17 -18
  34. package/dist/tag-snapshot-worker-pi.js +9 -10
  35. package/package.json +1 -1
  36. package/dist/index-n4wyxcgr.js +0 -712
  37. package/dist/index-wrr9rp9a.js +0 -16
  38. package/dist/index-zmg1td73.js +0 -2100
  39. package/dist/message-index-fedjhja5.js +0 -58
@@ -24,12 +24,12 @@ var [
24
24
  { Database, registerSqliteDiagnosticSink },
25
25
  { log }
26
26
  ] = await Promise.all([
27
- import("./embedding-backfill-qxzjy5v2.js"),
27
+ import("./embedding-backfill-25fp3b8w.js"),
28
28
  import("./embedding-cache-7rp4gqzr.js"),
29
29
  import("./storage-memory-0ndn65fm.js"),
30
- import("./project-embedding-registry-9e82qsb6.js"),
31
- import("./search-2aa5kzyp.js"),
32
- import("./compartment-chunk-embedding-g9a977b8.js"),
30
+ import("./project-embedding-registry-hc4ahjdt.js"),
31
+ import("./search-vkkfg27q.js"),
32
+ import("./compartment-chunk-embedding-pkk5beqp.js"),
33
33
  import("./embedding-activity-ew6dshfd.js"),
34
34
  import("./harness-9872e0ym.js"),
35
35
  import("./sqlite-v89bj0yy.js"),
@@ -15,28 +15,27 @@ import"./index-my0dn413.js";
15
15
  import"./index-fgs78jyd.js";
16
16
  import"./index-gwxaz0z5.js";
17
17
  import"./index-399p688g.js";
18
- import"./index-8hmqdav2.js";
19
- import"./index-8a2wvrda.js";
18
+ import"./index-6981g1xv.js";
19
+ import"./index-bvpar0bg.js";
20
20
  import {
21
21
  replaceCompartmentChunkEmbeddings2,
22
22
  recordChunkEmbedBackoff2,
23
23
  loadUnembeddedSessionChunkCandidates2,
24
24
  countUnembeddedSessionCompartments2
25
- } from "./index-wb2t932e.js";
25
+ } from "./index-kmk3xpf9.js";
26
26
  import {
27
27
  recordSessionProjectIdentity,
28
28
  acquireGitSweepLease,
29
29
  renewGitSweepLease,
30
30
  releaseGitSweepLease
31
- } from "./index-j3pz3a1b.js";
32
- import"./index-hxp6q5f8.js";
33
- import"./index-n4wyxcgr.js";
31
+ } from "./index-4zemngt7.js";
32
+ import"./index-48twbev2.js";
34
33
  import {
35
34
  LATEST_SUPPORTED_VERSION,
36
35
  enforceSchemaFence
37
- } from "./index-d53veb5e.js";
38
- import"./index-0dr64gsy.js";
39
- import"./index-w1avzkdt.js";
36
+ } from "./index-5d506f7y.js";
37
+ import"./index-0s14xaca.js";
38
+ import"./index-g026ztby.js";
40
39
  import"./index-135e8hvg.js";
41
40
  import"./index-23t8ryqw.js";
42
41
  import"./index-hqw0rt9k.js";
@@ -24,10 +24,10 @@ import {
24
24
  countSessionCompartmentEmbedCoverage2,
25
25
  countSessionCompartmentEmbedCoveragePolite2,
26
26
  countUnembeddedSessionCompartmentsPolite2
27
- } from "./index-wb2t932e.js";
27
+ } from "./index-kmk3xpf9.js";
28
28
  import"./index-gwxaz0z5.js";
29
- import"./index-8a2wvrda.js";
30
- import"./index-8hmqdav2.js";
29
+ import"./index-bvpar0bg.js";
30
+ import"./index-6981g1xv.js";
31
31
  import"./index-399p688g.js";
32
32
  import"./index-hqw0rt9k.js";
33
33
  import"./index-my0dn413.js";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  ensureMemoryEmbeddings2
3
- } from "./index-nxq2srg9.js";
4
- import"./index-00c5a49f.js";
3
+ } from "./index-wjbqw6r1.js";
4
+ import"./index-xa90f88m.js";
5
5
  import"./index-9p40dgkm.js";
6
6
  import"./index-yhzhdp3m.js";
7
- import"./index-j3pz3a1b.js";
8
- import"./index-wb2t932e.js";
7
+ import"./index-4zemngt7.js";
8
+ import"./index-kmk3xpf9.js";
9
9
  import"./index-wqpjhx1p.js";
10
10
  import"./index-gwxaz0z5.js";
11
11
  import"./index-ccanzg8p.js";
12
- import"./index-hxp6q5f8.js";
13
- import"./index-8a2wvrda.js";
14
- import"./index-8hmqdav2.js";
12
+ import"./index-48twbev2.js";
13
+ import"./index-bvpar0bg.js";
14
+ import"./index-6981g1xv.js";
15
15
  import"./index-399p688g.js";
16
16
  import"./index-hqw0rt9k.js";
17
17
  import"./index-my0dn413.js";
@@ -8,7 +8,7 @@ import {
8
8
  ensureColumn,
9
9
  healAllNullColumns,
10
10
  installV95PerfSchema
11
- } from "./index-w1avzkdt.js";
11
+ } from "./index-g026ztby.js";
12
12
  import {
13
13
  resolveOpenCodeDbPath,
14
14
  openCodeDbPathExists,
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  normalizeStoredProjectPath,
22
22
  storedPathBelongsToIdentity
23
- } from "./index-hxp6q5f8.js";
23
+ } from "./index-48twbev2.js";
24
24
  import {
25
25
  logSlowWriteTransaction
26
26
  } from "./index-hqw0rt9k.js";
@@ -15,7 +15,7 @@ import {
15
15
  jsonHashSink,
16
16
  tagOrderConstraintIndex,
17
17
  tagIdentityRevisionKey
18
- } from "./index-w1avzkdt.js";
18
+ } from "./index-g026ztby.js";
19
19
  import {
20
20
  DEFAULT_PROTECTED_TOOLS,
21
21
  normalizeProtectedToolName,
@@ -5,9 +5,6 @@ import {
5
5
  import {
6
6
  inRootAsyncContext2
7
7
  } from "./index-2qtx0q6h.js";
8
- import {
9
- projectDirectoryKey
10
- } from "./index-wrr9rp9a.js";
11
8
  import {
12
9
  writeStorageFileAtomicSync
13
10
  } from "./index-81nthk8j.js";
@@ -17,15 +14,32 @@ import { execFileSync } from "node:child_process";
17
14
  import { createHash as createHash2 } from "node:crypto";
18
15
  import { existsSync, realpathSync as realpathSync2, statSync as statSync2 } from "node:fs";
19
16
  import { homedir } from "node:os";
20
- import path3 from "node:path";
17
+ import path4 from "node:path";
21
18
 
22
19
  // ../plugin/src/features/magic-context/memory/project-identity-cache.ts
23
20
  import { createHash } from "node:crypto";
24
21
  import { promises as fs, readFileSync } from "node:fs";
22
+ import path2 from "node:path";
23
+
24
+ // ../plugin/src/shared/project-directory-key.ts
25
25
  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
+
39
+ // ../plugin/src/features/magic-context/memory/project-identity-cache.ts
26
40
  function cachePath(directory, storageDir = getMagicContextStorageDir()) {
27
41
  const hash = createHash("sha256").update(projectDirectoryKey(directory)).digest("hex");
28
- return path.join(storageDir, "project-identities", `${hash}.json`);
42
+ return path2.join(storageDir, "project-identities", `${hash}.json`);
29
43
  }
30
44
  function rememberGitIdentity(directory, identity) {
31
45
  try {
@@ -42,7 +56,7 @@ function readRememberedGitIdentity(directory, storageDir) {
42
56
  return;
43
57
  }
44
58
  async function pruneMissingProjectIdentities(storageDir = getMagicContextStorageDir()) {
45
- const directory = path.join(storageDir, "project-identities");
59
+ const directory = path2.join(storageDir, "project-identities");
46
60
  let removed = 0;
47
61
  let entries;
48
62
  try {
@@ -53,10 +67,10 @@ async function pruneMissingProjectIdentities(storageDir = getMagicContextStorage
53
67
  for (const entry of entries) {
54
68
  if (!/^[0-9a-f]{64}\.json$/.test(entry))
55
69
  continue;
56
- const file = path.join(directory, entry);
70
+ const file = path2.join(directory, entry);
57
71
  try {
58
72
  const record = JSON.parse(await fs.readFile(file, "utf8"));
59
- if (typeof record.directory !== "string" || !path.isAbsolute(record.directory) || cachePath(record.directory, storageDir) !== file || !/^git:[0-9a-f]{7,64}$/.test(record.identity))
73
+ if (typeof record.directory !== "string" || !path2.isAbsolute(record.directory) || cachePath(record.directory, storageDir) !== file || !/^git:[0-9a-f]{7,64}$/.test(record.identity))
60
74
  continue;
61
75
  try {
62
76
  await fs.stat(record.directory);
@@ -73,7 +87,7 @@ async function pruneMissingProjectIdentities(storageDir = getMagicContextStorage
73
87
 
74
88
  // ../plugin/src/features/magic-context/memory/unborn-head.ts
75
89
  import { readFileSync as readFileSync2, realpathSync, statSync } from "node:fs";
76
- import path2 from "node:path";
90
+ import path3 from "node:path";
77
91
  var GIT_LOCATION_ENV_VARS = [
78
92
  "GIT_DIR",
79
93
  "GIT_COMMON_DIR",
@@ -109,7 +123,7 @@ function stripLineEnding(text) {
109
123
  return text.replace(/\r?\n$/u, "");
110
124
  }
111
125
  function resolveMetadataPath(baseDirectory, value) {
112
- return path2.resolve(baseDirectory, value);
126
+ return path3.resolve(baseDirectory, value);
113
127
  }
114
128
  function isPlainBranchName(name) {
115
129
  if (name.length === 0 || name.endsWith("/") || name.endsWith("."))
@@ -126,7 +140,7 @@ function isPlainBranchName(name) {
126
140
  function findGitDirectory(start) {
127
141
  let current = start;
128
142
  while (true) {
129
- const dotGit = path2.join(current, ".git");
143
+ const dotGit = path3.join(current, ".git");
130
144
  const kind = entryKind(dotGit);
131
145
  if (kind === "directory")
132
146
  return dotGit;
@@ -142,7 +156,7 @@ function findGitDirectory(start) {
142
156
  }
143
157
  if (kind !== "missing")
144
158
  return;
145
- const parent = path2.dirname(current);
159
+ const parent = path3.dirname(current);
146
160
  if (parent === current)
147
161
  return;
148
162
  current = parent;
@@ -167,7 +181,7 @@ function isUnbornHeadInLayout(directory) {
167
181
  if (gitDirectory === undefined)
168
182
  return false;
169
183
  let commonDirectory = gitDirectory;
170
- const commondir = readText(path2.join(gitDirectory, "commondir"));
184
+ const commondir = readText(path3.join(gitDirectory, "commondir"));
171
185
  if (commondir.ok) {
172
186
  const value = stripLineEnding(commondir.text);
173
187
  if (value === "" || value.includes(`
@@ -177,22 +191,22 @@ function isUnbornHeadInLayout(directory) {
177
191
  } else if (!commondir.missing) {
178
192
  return false;
179
193
  }
180
- if (entryKind(path2.join(gitDirectory, "HEAD")) !== "file")
194
+ if (entryKind(path3.join(gitDirectory, "HEAD")) !== "file")
181
195
  return false;
182
- if (entryKind(path2.join(commonDirectory, "objects")) !== "directory")
196
+ if (entryKind(path3.join(commonDirectory, "objects")) !== "directory")
183
197
  return false;
184
- if (entryKind(path2.join(commonDirectory, "refs")) !== "directory")
198
+ if (entryKind(path3.join(commonDirectory, "refs")) !== "directory")
185
199
  return false;
186
- if (entryKind(path2.join(commonDirectory, "reftable")) !== "missing")
200
+ if (entryKind(path3.join(commonDirectory, "reftable")) !== "missing")
187
201
  return false;
188
- const config = readText(path2.join(commonDirectory, "config"));
202
+ const config = readText(path3.join(commonDirectory, "config"));
189
203
  if (config.ok) {
190
204
  if (/refstorage/iu.test(config.text))
191
205
  return false;
192
206
  } else if (!config.missing) {
193
207
  return false;
194
208
  }
195
- const head = readText(path2.join(gitDirectory, "HEAD"));
209
+ const head = readText(path3.join(gitDirectory, "HEAD"));
196
210
  if (!head.ok)
197
211
  return false;
198
212
  const headMatch = /^ref: (refs\/heads\/(.+))$/u.exec(head.text.replace(/\s+$/u, ""));
@@ -202,10 +216,10 @@ function isUnbornHeadInLayout(directory) {
202
216
  return false;
203
217
  const refSegments = ref.split("/");
204
218
  for (const base of new Set([commonDirectory, gitDirectory])) {
205
- if (entryKind(path2.join(base, ...refSegments)) !== "missing")
219
+ if (entryKind(path3.join(base, ...refSegments)) !== "missing")
206
220
  return false;
207
221
  }
208
- const packed = readText(path2.join(commonDirectory, "packed-refs"));
222
+ const packed = readText(path3.join(commonDirectory, "packed-refs"));
209
223
  if (packed.ok) {
210
224
  if (packedRefsList(packed.text, ref) !== false)
211
225
  return false;
@@ -220,7 +234,7 @@ function isUnbornHeadOnDisk(directory, env = process.env) {
220
234
  }
221
235
  let realDirectory;
222
236
  try {
223
- realDirectory = realpathSync.native(path2.resolve(directory));
237
+ realDirectory = realpathSync.native(path3.resolve(directory));
224
238
  } catch {
225
239
  return false;
226
240
  }
@@ -302,7 +316,7 @@ function getErrorStderr(error) {
302
316
  return "";
303
317
  }
304
318
  function directoryFallback(directory) {
305
- const canonical = path3.resolve(directory);
319
+ const canonical = path4.resolve(directory);
306
320
  const hash = createHash2("md5").update(canonical, "utf8").digest("hex").slice(0, 12);
307
321
  return `dir:${hash}`;
308
322
  }
@@ -374,7 +388,7 @@ function classifyGitError(error, rawDirectory) {
374
388
  }
375
389
  function resolveProjectIdentityStrict(directory, allowHomeProject = homeProjectPermission, options = {}) {
376
390
  assertProjectAllowed(directory, allowHomeProject);
377
- const canonical = path3.resolve(directory);
391
+ const canonical = path4.resolve(directory);
378
392
  const cached = options.cache === false ? undefined : identityCache.get(canonical);
379
393
  if (cached !== undefined) {
380
394
  return cached;
@@ -446,9 +460,9 @@ function nearestLastKnownGitIdentity(canonical) {
446
460
  const cached = lastKnownGitIdentity(current);
447
461
  if (cached !== undefined)
448
462
  return { identity: cached, source: current };
449
- if (existsSync(path3.join(current, ".git")))
463
+ if (existsSync(path4.join(current, ".git")))
450
464
  break;
451
- const parent = path3.dirname(current);
465
+ const parent = path4.dirname(current);
452
466
  if (parent === current)
453
467
  break;
454
468
  current = parent;
@@ -498,20 +512,20 @@ function isUserHomeDirectory(directory) {
498
512
  if (projectDirectoryKey(directory) === projectDirectoryKey(userHomeDirectoryForIdentity()))
499
513
  return true;
500
514
  try {
501
- return projectDirectoryKey(realpathSync2.native(path3.resolve(directory))) === projectDirectoryKey(canonicalUserHomeDirectory());
515
+ return projectDirectoryKey(realpathSync2.native(path4.resolve(directory))) === projectDirectoryKey(canonicalUserHomeDirectory());
502
516
  } catch {
503
517
  return false;
504
518
  }
505
519
  }
506
520
  function assertProjectAllowed(directory, allowHomeProject) {
507
- const canonical = path3.resolve(directory);
521
+ const canonical = path4.resolve(directory);
508
522
  if (!allowHomeProject && (isUserHomeDirectory(directory) || isUserHomeDirectory(gitRootDirectory(canonical) ?? canonical))) {
509
523
  throw new ProjectIdentityError("home_project_disabled", directory, "Home project memory is disabled; set allow_home_project to opt in");
510
524
  }
511
525
  }
512
526
  function resolveProjectIdentity(directory, allowHomeProject = homeProjectPermission) {
513
527
  assertProjectAllowed(directory, allowHomeProject);
514
- const canonical = path3.resolve(directory);
528
+ const canonical = path4.resolve(directory);
515
529
  const cachedFallback = directoryFallbackCache.get(canonical);
516
530
  if (cachedFallback !== undefined) {
517
531
  if (!hasGitDir(canonical)) {
@@ -559,7 +573,7 @@ function resolveProjectIdentityOrFallback(directory, allowHomeProject = homeProj
559
573
  try {
560
574
  return resolveProjectIdentity(directory, allowHomeProject);
561
575
  } catch (error) {
562
- const canonical = path3.resolve(directory);
576
+ const canonical = path4.resolve(directory);
563
577
  if (hasGitDir(canonical) || error instanceof ProjectIdentityError && error.errorClass === "home_project_disabled")
564
578
  throw error;
565
579
  const fallback = rememberedIdentityOrDirectoryFallback(canonical);
@@ -582,14 +596,14 @@ function hasGitDir(canonical) {
582
596
  function gitRootInAncestorChain(startDirectory) {
583
597
  let current = startDirectory;
584
598
  while (true) {
585
- if (existsSync(path3.join(current, ".git"))) {
599
+ if (existsSync(path4.join(current, ".git"))) {
586
600
  try {
587
601
  return realpathSync2.native(current);
588
602
  } catch {
589
- return path3.resolve(current);
603
+ return path4.resolve(current);
590
604
  }
591
605
  }
592
- const parent = path3.dirname(current);
606
+ const parent = path4.dirname(current);
593
607
  if (parent === current) {
594
608
  return null;
595
609
  }
@@ -611,13 +625,13 @@ function gitRootDirectory(canonical) {
611
625
  }
612
626
  }
613
627
  function directoryHasGitMetadata(directory) {
614
- return gitRootDirectory(path3.resolve(directory)) !== null;
628
+ return gitRootDirectory(path4.resolve(directory)) !== null;
615
629
  }
616
630
  function isUsableProjectIdentity(identity) {
617
631
  return typeof identity === "string" && identity.trim().length > 0;
618
632
  }
619
633
  function resolveProjectIdentityForSession(directory, allowHomeProject = homeProjectPermission) {
620
- const resolvedDirectory = path3.resolve(directory);
634
+ const resolvedDirectory = path4.resolve(directory);
621
635
  const cacheKey = `${allowHomeProject ? "1" : "0"}\x00${resolvedDirectory}`;
622
636
  const cached = sessionIdentityCache.get(cacheKey);
623
637
  if (cached && (cached.revalidateAt === null || nowMs() < cached.revalidateAt) && !(cached.identity?.startsWith("dir:") && hasGitDir(resolvedDirectory))) {
@@ -696,4 +710,4 @@ function setBootQuietPeriodForTests(startAtMs) {
696
710
  bootQuietUntilMs = startAtMs === null ? 0 : startAtMs + BOOT_QUIET_MS;
697
711
  }
698
712
 
699
- export { pruneMissingProjectIdentities, setHomeProjectPermission, ProjectIdentityError, resolveProjectIdentityStrict, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, scheduleAfterBootQuiet, setBootQuietPeriodForTests };
713
+ export { sameProjectDirectory, pruneMissingProjectIdentities, setHomeProjectPermission, ProjectIdentityError, resolveProjectIdentityStrict, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, scheduleAfterBootQuiet, setBootQuietPeriodForTests };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-0h2mkab2.js";
4
4
  import {
5
5
  isUserHomeDirectory
6
- } from "./index-hxp6q5f8.js";
6
+ } from "./index-48twbev2.js";
7
7
  import {
8
8
  logSlowWriteTransaction
9
9
  } from "./index-hqw0rt9k.js";