@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,31 +1,31 @@
1
- import {
2
- setEmbeddingSessionBusy,
3
- getProjectEmbeddings,
4
- getMemoriesByProject,
5
- installProjectEmbeddingSearchBridge,
6
- ensureMemoryEmbeddings,
7
- unifiedSearch
8
- } from "./index-qaa5j277.js";
9
- import {
10
- setHarness
11
- } from "./index-7n8gb6j3.js";
12
- import"./index-vgcemg0n.js";
13
- import"./index-spk5vrhy.js";
14
- import"./index-266qrgss.js";
15
- import {
16
- Database
17
- } from "./index-0qejsd7f.js";
18
- import"./index-xpbh1ypk.js";
19
- import"./index-7s8vw2y0.js";
20
- import"./index-td885aah.js";
21
- import"./index-2p1e8706.js";
22
-
23
1
  // ../plugin/src/hooks/magic-context/auto-search-worker.ts
24
2
  import { parentPort, workerData } from "node:worker_threads";
25
3
  var port = parentPort;
26
4
  if (!port)
27
5
  throw new Error("auto-search worker requires a parent port");
28
6
  var input = workerData;
7
+ if (input.job === "messages") {
8
+ port.postMessage({ kind: "accepted" });
9
+ }
10
+ var [
11
+ { ensureMemoryEmbeddings },
12
+ { getProjectEmbeddings },
13
+ { getMemoriesByProject },
14
+ { installProjectEmbeddingSearchBridge },
15
+ { searchMessageHistory, unifiedSearch },
16
+ { setEmbeddingSessionBusy },
17
+ { setHarness },
18
+ { Database }
19
+ ] = await Promise.all([
20
+ import("./embedding-backfill-b71dvfs8.js"),
21
+ import("./embedding-cache-7rp4gqzr.js"),
22
+ import("./storage-memory-1z20y55x.js"),
23
+ import("./project-embedding-registry-ky7wrkr1.js"),
24
+ import("./search-jbh28nwy.js"),
25
+ import("./embedding-activity-ew6dshfd.js"),
26
+ import("./harness-9872e0ym.js"),
27
+ import("./sqlite-3yye76ht.js")
28
+ ]);
29
29
  setHarness(input.harness);
30
30
  setEmbeddingSessionBusy(input.sessionId, input.embeddingHostBusy === true);
31
31
  var nextId = 0;
@@ -85,6 +85,11 @@ try {
85
85
  }
86
86
  }
87
87
  port.postMessage({ kind: "result", results: [] });
88
+ } else if (input.job === "messages") {
89
+ if (!input.messageRequest)
90
+ throw new Error("message search job carries no request");
91
+ const outcome = searchMessageHistory(db, input.messageRequest);
92
+ port.postMessage({ kind: "messages", outcome });
88
93
  } else {
89
94
  const results = await unifiedSearch(db, input.sessionId, input.projectPath, input.query, {
90
95
  ...input.options,
@@ -0,0 +1,10 @@
1
+ import {
2
+ setEmbeddingSessionBusy2,
3
+ observeEmbeddingActivity2,
4
+ isEmbeddingHostBusy2
5
+ } from "./index-9p40dgkm.js";
6
+ export {
7
+ isEmbeddingHostBusy2 as isEmbeddingHostBusy,
8
+ observeEmbeddingActivity2 as observeEmbeddingActivity,
9
+ setEmbeddingSessionBusy2 as setEmbeddingSessionBusy
10
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ ensureMemoryEmbeddings2
3
+ } from "./index-904reqtg.js";
4
+ import"./index-yarjn32j.js";
5
+ import"./index-bejpsj10.js";
6
+ import"./index-yhzhdp3m.js";
7
+ import"./index-9p40dgkm.js";
8
+ import"./index-1evzceyw.js";
9
+ import"./index-21v1kfs7.js";
10
+ import"./index-041ex0cj.js";
11
+ import"./index-r024r8da.js";
12
+ import"./index-0vrkp1jq.js";
13
+ import"./index-bgmv2kaf.js";
14
+ import"./index-3cgbv47m.js";
15
+ import"./index-r56xgha8.js";
16
+ import"./index-x3dcnxh0.js";
17
+ import"./index-0h2mkab2.js";
18
+ export {
19
+ ensureMemoryEmbeddings2 as ensureMemoryEmbeddings
20
+ };
@@ -0,0 +1,16 @@
1
+ import {
2
+ getProjectEmbeddings2,
3
+ peekProjectEmbeddings2,
4
+ invalidateProject2,
5
+ invalidateMemory2,
6
+ resetEmbeddingCacheForTests2,
7
+ setEmbeddingCacheTtlForTests2
8
+ } from "./index-yhzhdp3m.js";
9
+ export {
10
+ getProjectEmbeddings2 as getProjectEmbeddings,
11
+ invalidateMemory2 as invalidateMemory,
12
+ invalidateProject2 as invalidateProject,
13
+ peekProjectEmbeddings2 as peekProjectEmbeddings,
14
+ resetEmbeddingCacheForTests2 as resetEmbeddingCacheForTests,
15
+ setEmbeddingCacheTtlForTests2 as setEmbeddingCacheTtlForTests
16
+ };
@@ -1,25 +1,28 @@
1
1
  import {
2
- setHarness,
3
- log
4
- } from "./index-7n8gb6j3.js";
2
+ setHarness2
3
+ } from "./index-0h2mkab2.js";
4
+ import {
5
+ log2
6
+ } from "./index-x3dcnxh0.js";
5
7
  import {
6
8
  resolveLocalEmbeddingWorkerRuntime,
7
9
  getLocalEmbeddingNativeMemoryStats,
8
10
  LocalEmbeddingProvider
9
- } from "./index-vgcemg0n.js";
10
- import"./index-spk5vrhy.js";
11
- import"./index-266qrgss.js";
11
+ } from "./index-1evzceyw.js";
12
+ import"./index-bgmv2kaf.js";
13
+ import"./index-21v1kfs7.js";
14
+ import"./index-r56xgha8.js";
12
15
  import {
13
16
  setStoragePrivatePermissionEnforcement
14
17
  } from "./index-vf38qhee.js";
15
18
 
16
19
  // ../plugin/src/features/magic-context/memory/embedding-worker.ts
17
20
  import { parentPort, workerData } from "node:worker_threads";
18
- setHarness(workerData.harness);
21
+ setHarness2(workerData.harness);
19
22
  setStoragePrivatePermissionEnforcement(workerData.enforcePrivateStoragePermissions !== false);
20
23
  var unsafeNative = workerData.runtimePreference === "native" && resolveLocalEmbeddingWorkerRuntime("native") === "wasm";
21
24
  if (unsafeNative)
22
- log("[magic-context] native embedding worker teardown is unsafe on this Bun version; using WASM. Upgrade the host to Bun >=1.4.0 for native inference.");
25
+ log2("[magic-context] native embedding worker teardown is unsafe on this Bun version; using WASM. Upgrade the host to Bun >=1.4.0 for native inference.");
23
26
  var provider = new LocalEmbeddingProvider(workerData.model, workerData.maxInputTokens, workerData.dtype, unsafeNative ? "wasm" : workerData.runtimePreference);
24
27
  var queue = Promise.resolve();
25
28
  parentPort?.on("message", (request) => {
@@ -0,0 +1,10 @@
1
+ import {
2
+ setHarness2,
3
+ getHarness2,
4
+ harnessOwnsOpenCodeStore2
5
+ } from "./index-0h2mkab2.js";
6
+ export {
7
+ getHarness2 as getHarness,
8
+ harnessOwnsOpenCodeStore2 as harnessOwnsOpenCodeStore,
9
+ setHarness2 as setHarness
10
+ };
@@ -1,8 +1,10 @@
1
- import"./index-7n8gb6j3.js";
2
1
  import {
2
+ subagentTemperature,
3
3
  promptFingerprint,
4
4
  readHostSystemPrompt
5
- } from "./index-w76x3af7.js";
5
+ } from "./index-zh1jw8qp.js";
6
+ import"./index-0h2mkab2.js";
7
+ import"./index-x3dcnxh0.js";
6
8
 
7
9
  // src/historian-calibration-extension.ts
8
10
  import { readFileSync } from "node:fs";
@@ -54,6 +56,21 @@ function calibrateHistorianProviderPayload(payload, temperature, maxOutputTokens
54
56
  }
55
57
  return calibrated;
56
58
  }
59
+ function withoutProviderTemperature(payload) {
60
+ if (!payload || typeof payload !== "object" || Array.isArray(payload))
61
+ return payload;
62
+ const clean = { ...payload };
63
+ delete clean.temperature;
64
+ for (const key of ["generationConfig", "inferenceConfig"]) {
65
+ const nested = clean[key];
66
+ if (nested && typeof nested === "object" && !Array.isArray(nested)) {
67
+ const options = { ...nested };
68
+ delete options.temperature;
69
+ clean[key] = options;
70
+ }
71
+ }
72
+ return clean;
73
+ }
57
74
  function historianCalibrationExtension(pi) {
58
75
  const intendedPath = process.env.MAGIC_CONTEXT_SUBAGENT_PROMPT_FILE;
59
76
  if (intendedPath) {
@@ -72,11 +89,20 @@ function historianCalibrationExtension(pi) {
72
89
  const maxOutputTokens = finiteNumber(process.env[HISTORIAN_MAX_OUTPUT_TOKENS_ENV]);
73
90
  if (temperature === undefined && maxOutputTokens === undefined)
74
91
  return;
75
- pi.on("before_provider_request", (event) => calibrateHistorianProviderPayload(event.payload, temperature, maxOutputTokens));
92
+ pi.on("before_provider_request", (event, ctx) => {
93
+ const model = ctx.model;
94
+ const key = `${model?.provider ?? "unknown"}/${model?.id ?? "unknown"}`;
95
+ const sampling = subagentTemperature(key, model, temperature, (_message, decision) => {
96
+ process.stdout.write(`${JSON.stringify({ type: "mc_temperature", model: key, supported: decision.supported ?? null, source: decision.source, ...decision.entry ? { entry: decision.entry } : {} })}
97
+ `);
98
+ });
99
+ return calibrateHistorianProviderPayload(sampling === undefined ? withoutProviderTemperature(event.payload) : event.payload, sampling, maxOutputTokens);
100
+ });
76
101
  }
77
102
  export {
78
103
  HISTORIAN_MAX_OUTPUT_TOKENS_ENV,
79
104
  HISTORIAN_TEMPERATURE_ENV,
80
105
  calibrateHistorianProviderPayload,
81
- historianCalibrationExtension as default
106
+ historianCalibrationExtension as default,
107
+ withoutProviderTemperature
82
108
  };