@cortexkit/pi-magic-context 0.47.0 → 0.49.0

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 (60) hide show
  1. package/dist/auto-search-worker.js +27 -22
  2. package/dist/embedding-activity-ew6dshfd.js +10 -0
  3. package/dist/embedding-backfill-b71dvfs8.js +20 -0
  4. package/dist/embedding-cache-7rp4gqzr.js +16 -0
  5. package/dist/embedding-worker.js +11 -8
  6. package/dist/harness-9872e0ym.js +10 -0
  7. package/dist/historian-calibration-extension.js +30 -4
  8. package/dist/index-041ex0cj.js +519 -0
  9. package/dist/index-0h2mkab2.js +17 -0
  10. package/dist/{index-2p1e8706.js → index-0vrkp1jq.js} +3 -3
  11. package/dist/index-135e8hvg.js +43 -0
  12. package/dist/{index-vgcemg0n.js → index-1evzceyw.js} +151 -2452
  13. package/dist/index-21v1kfs7.js +2309 -0
  14. package/dist/{index-n3g5mwa8.js → index-290tzwp1.js} +3 -3
  15. package/dist/{index-0qejsd7f.js → index-3cgbv47m.js} +289 -45
  16. package/dist/{index-xpbh1ypk.js → index-3mgf68pn.js} +38 -741
  17. package/dist/index-3rea6zd9.js +2396 -0
  18. package/dist/index-674f6qs2.js +16 -0
  19. package/dist/index-8976mezv.js +209 -0
  20. package/dist/index-904reqtg.js +152 -0
  21. package/dist/index-9p40dgkm.js +22 -0
  22. package/dist/index-9x1f96r8.js +11 -0
  23. package/dist/index-bejpsj10.js +1060 -0
  24. package/dist/{index-spk5vrhy.js → index-bgmv2kaf.js} +1 -16
  25. package/dist/{index-k3ezsjng.js → index-ehybv5nr.js} +14657 -13951
  26. package/dist/index-fapenpch.js +13 -0
  27. package/dist/index-hwqb3s7f.js +3804 -0
  28. package/dist/index-kjd1fj55.js +3106 -0
  29. package/dist/{index-td885aah.js → index-mcgehvgw.js} +181 -230
  30. package/dist/index-r024r8da.js +171 -0
  31. package/dist/{index-266qrgss.js → index-r56xgha8.js} +301 -27
  32. package/dist/{index-kztsbkqq.js → index-t7xfqtg6.js} +171 -168
  33. package/dist/index-vakawmbc.js +1262 -0
  34. package/dist/{index-7n8gb6j3.js → index-x3dcnxh0.js} +34 -33
  35. package/dist/index-xjqheg7a.js +931 -0
  36. package/dist/index-yarjn32j.js +3026 -0
  37. package/dist/index-yhzhdp3m.js +143 -0
  38. package/dist/index-yzcjxnt2.js +787 -0
  39. package/dist/{index-w76x3af7.js → index-zh1jw8qp.js} +107 -4
  40. package/dist/index.js +4926 -2437
  41. package/dist/logger-j6tecd1h.js +19 -0
  42. package/dist/message-index-bounded-qz5dz2se.js +120 -0
  43. package/dist/{message-time-backfill-d3db2etr.js → message-time-backfill-05ppypkz.js} +7 -6
  44. package/dist/migration-worker.js +20 -14
  45. package/dist/project-embedding-registry-ky7wrkr1.js +85 -0
  46. package/dist/raw-ordinal-warmup-worker.js +60 -0
  47. package/dist/{read-session-chunk-atxsyfqv.js → read-session-chunk-24sd89tf.js} +14 -6
  48. package/dist/read-session-raw-npx3920c.js +57 -0
  49. package/dist/{safe-notification-target-6cn3z99t.js → safe-notification-target-vn9kpmv4.js} +3 -2
  50. package/dist/search-jbh28nwy.js +40 -0
  51. package/dist/sqlite-3yye76ht.js +44 -0
  52. package/dist/sqlite-context-pragmas-gcgch6qz.js +6 -0
  53. package/dist/storage-memory-1z20y55x.js +71 -0
  54. package/dist/storage-tags-kjnsqbdb.js +127 -0
  55. package/dist/subagent-entry.js +35 -17
  56. package/dist/transformers-node-wasm.js +18415 -18415
  57. package/package.json +3 -3
  58. package/dist/index-7s8vw2y0.js +0 -5207
  59. package/dist/index-qaa5j277.js +0 -8544
  60. /package/dist/{index-en1k8h8m.js → index-5prbx026.js} +0 -0
@@ -1,19 +1,10 @@
1
- // ../plugin/src/shared/harness.ts
2
- var currentHarness = "opencode";
3
- var harnessLocked = false;
4
- function setHarness(value) {
5
- if (harnessLocked && currentHarness !== value) {
6
- throw new Error(`Magic Context: harness already locked to "${currentHarness}"; cannot change to "${value}"`);
7
- }
8
- currentHarness = value;
9
- harnessLocked = true;
10
- }
11
- function getHarness() {
12
- return currentHarness;
13
- }
14
- function harnessOwnsOpenCodeStore(harness = currentHarness) {
15
- return harness === "opencode" || harness === "opencode2";
16
- }
1
+ import {
2
+ getHarness2
3
+ } from "./index-0h2mkab2.js";
4
+
5
+ // ../plugin/src/shared/logger.ts
6
+ import * as fs from "node:fs";
7
+ import * as path2 from "node:path";
17
8
 
18
9
  // ../plugin/src/shared/data-path.ts
19
10
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
@@ -28,10 +19,10 @@ var registeredTempDirs = new Set;
28
19
  function getDataDir() {
29
20
  return process.env.XDG_DATA_HOME ?? path.join(os.homedir(), ".local", "share");
30
21
  }
31
- function getMagicContextTempDir(harness = getHarness()) {
22
+ function getMagicContextTempDir(harness = getHarness2()) {
32
23
  return path.join(os.tmpdir(), harness, "magic-context");
33
24
  }
34
- function getMagicContextLogPath(harness = getHarness()) {
25
+ function getMagicContextLogPath(harness = getHarness2()) {
35
26
  const envPath = process.env.MAGIC_CONTEXT_LOG_PATH?.trim();
36
27
  if (envPath)
37
28
  return envPath;
@@ -112,10 +103,6 @@ function getLegacyOpenCodeMagicContextStorageDir() {
112
103
  return path.join(getOpenCodeStorageDir(), "plugin", "magic-context");
113
104
  }
114
105
 
115
- // ../plugin/src/shared/logger.ts
116
- import * as fs from "node:fs";
117
- import * as path2 from "node:path";
118
-
119
106
  // ../plugin/src/shared/redaction.ts
120
107
  import { homedir as homedir2, userInfo } from "node:os";
121
108
  function escapeRegex(value) {
@@ -409,7 +396,7 @@ function classifyStalePluginBuild(error) {
409
396
  }
410
397
  }
411
398
  const ownDist = distForModule(import.meta.url);
412
- return ownDist && chunk.startsWith(`${ownDist}/`) ? { chunk, guidance: stalePluginBuildGuidance(getHarness()) } : null;
399
+ return ownDist && chunk.startsWith(`${ownDist}/`) ? { chunk, guidance: stalePluginBuildGuidance(getHarness2()) } : null;
413
400
  }
414
401
 
415
402
  class StalePluginBuildError extends Error {
@@ -444,7 +431,7 @@ async function importPluginModule(load) {
444
431
  const build = classifyStalePluginBuild(error);
445
432
  if (!build)
446
433
  throw error;
447
- log("[magic-context] lazy import failed", error);
434
+ log2("[magic-context] lazy import failed", error);
448
435
  throw new StalePluginBuildError(build);
449
436
  }
450
437
  }
@@ -565,8 +552,12 @@ function flush() {
565
552
  let currentSize = getCurrentLogSize(logFile);
566
553
  const dataSize = Buffer.byteLength(data);
567
554
  if (currentSize > 0 && currentSize + dataSize > MAX_LOG_FILE_BYTES) {
568
- rotateLogFile(logFile, currentSize);
569
- currentSize = 0;
555
+ flushesSinceSizeCheck = SIZE_CHECK_INTERVAL_FLUSHES;
556
+ currentSize = getCurrentLogSize(logFile);
557
+ if (currentSize > 0 && currentSize + dataSize > MAX_LOG_FILE_BYTES) {
558
+ rotateLogFile(logFile, currentSize);
559
+ currentSize = 0;
560
+ }
570
561
  }
571
562
  fs.appendFileSync(logFile, data, { encoding: "utf8", mode: 384 });
572
563
  buffer = [];
@@ -592,10 +583,10 @@ function scheduleFlush() {
592
583
  }, FLUSH_INTERVAL_MS);
593
584
  }
594
585
  var lineForwarder = null;
595
- function setLogLineForwarder(forward) {
586
+ function setLogLineForwarder2(forward) {
596
587
  lineForwarder = forward;
597
588
  }
598
- function writeForwardedLogLine(line) {
589
+ function writeForwardedLogLine2(line) {
599
590
  if (isTestEnv)
600
591
  return;
601
592
  try {
@@ -608,7 +599,7 @@ function writeForwardedLogLine(line) {
608
599
  scheduleFlush();
609
600
  } catch {}
610
601
  }
611
- function log(message, data) {
602
+ function log2(message, data) {
612
603
  try {
613
604
  let diagnostic = stalePluginBuildDiagnostic(data);
614
605
  if (diagnostic === undefined)
@@ -640,14 +631,24 @@ ${data.stack}` : ""}`)}` : ` ${JSON.stringify(sanitizeConfigValue(data))}`;
640
631
  }
641
632
  } catch {}
642
633
  }
643
- function sessionLog(sessionId, message, data) {
644
- log(`[magic-context][${sessionId}] ${message}`, data);
634
+ function sessionLog2(sessionId, message, data) {
635
+ log2(`[magic-context][${sessionId}] ${message}`, data);
645
636
  }
646
- function flushLogger() {
637
+ function getLoggerDiagnostics2() {
638
+ return {
639
+ swallowedWriteCount,
640
+ lastErrorMessage,
641
+ lastErrorTime
642
+ };
643
+ }
644
+ function flushLogger2() {
647
645
  flush();
648
646
  }
647
+ function getLogFilePath2() {
648
+ return getMagicContextLogPath();
649
+ }
649
650
  if (!isTestEnv) {
650
651
  process.on("exit", flush);
651
652
  }
652
653
 
653
- export { setHarness, getHarness, harnessOwnsOpenCodeStore, getDataDir, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getMagicContextStorageDir, getLegacyOpenCodeMagicContextStorageDir, sanitizeDiagnosticText, hasShareabilitySensitiveText, registerStalePluginBuildHost, classifyStalePluginBuild, importPluginModule, setLogLineForwarder, writeForwardedLogLine, log, sessionLog, flushLogger };
654
+ export { getDataDir, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getMagicContextStorageDir, getLegacyOpenCodeMagicContextStorageDir, sanitizeDiagnosticText, hasShareabilitySensitiveText, registerStalePluginBuildHost, classifyStalePluginBuild, importPluginModule, setLogLineForwarder2, writeForwardedLogLine2, log2, sessionLog2, getLoggerDiagnostics2, flushLogger2, getLogFilePath2 };