@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
@@ -17,11 +17,11 @@ var [
17
17
  { setHarness },
18
18
  { Database }
19
19
  ] = await Promise.all([
20
- import("./embedding-backfill-bnnytehy.js"),
20
+ import("./embedding-backfill-scywarbn.js"),
21
21
  import("./embedding-cache-7rp4gqzr.js"),
22
22
  import("./storage-memory-1z20y55x.js"),
23
- import("./project-embedding-registry-jy2hmq28.js"),
24
- import("./search-42szfhwp.js"),
23
+ import("./project-embedding-registry-64t0mw8y.js"),
24
+ import("./search-7z3w8pmz.js"),
25
25
  import("./embedding-activity-ew6dshfd.js"),
26
26
  import("./harness-9872e0ym.js"),
27
27
  import("./sqlite-3yye76ht.js")
@@ -0,0 +1,20 @@
1
+ import {
2
+ ensureMemoryEmbeddings2
3
+ } from "./index-rdtgp48t.js";
4
+ import"./index-r874cgmv.js";
5
+ import"./index-27jh224p.js";
6
+ import"./index-yhzhdp3m.js";
7
+ import"./index-9p40dgkm.js";
8
+ import"./index-gc2749rx.js";
9
+ import"./index-21v1kfs7.js";
10
+ import"./index-cyrnv16r.js";
11
+ import"./index-g7hndmqm.js";
12
+ import"./index-4gfq5t09.js";
13
+ import"./index-0vrkp1jq.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,29 @@
1
+ import"./index-0h2mkab2.js";
2
+ import {
3
+ log2
4
+ } from "./index-x3dcnxh0.js";
5
+
6
+ // ../plugin/src/features/magic-context/memory/embedding-worker-process.ts
7
+ import { Worker } from "node:worker_threads";
8
+ var worker;
9
+ process.on("message", (message) => {
10
+ if (message.entry && !worker) {
11
+ worker = new Worker(new URL(message.entry), { workerData: message.data });
12
+ worker.on("message", (reply) => {
13
+ const wire = {
14
+ ...reply,
15
+ vectors: reply.vectors?.map((vector) => vector === null ? null : Buffer.from(vector.buffer, vector.byteOffset, vector.byteLength).toString("base64"))
16
+ };
17
+ if (process.connected)
18
+ process.send?.(wire);
19
+ });
20
+ worker.on("error", (error) => {
21
+ log2("[magic-context] embedding worker failed:", error);
22
+ process.exit(1);
23
+ });
24
+ worker.on("exit", (code) => process.exit(code));
25
+ } else {
26
+ worker?.postMessage(message);
27
+ }
28
+ });
29
+ process.on("disconnect", () => process.exit(0));
@@ -3,18 +3,18 @@ import {
3
3
  } from "./index-0h2mkab2.js";
4
4
  import {
5
5
  log2
6
- } from "./index-f956htf3.js";
6
+ } from "./index-x3dcnxh0.js";
7
+ import"./index-cyrnv16r.js";
8
+ import"./index-21v1kfs7.js";
9
+ import"./index-r56xgha8.js";
7
10
  import {
8
11
  resolveLocalEmbeddingWorkerRuntime,
9
12
  getLocalEmbeddingNativeMemoryStats,
10
13
  LocalEmbeddingProvider
11
- } from "./index-6pgq5ns2.js";
12
- import"./index-bgmv2kaf.js";
13
- import"./index-419bndtm.js";
14
- import"./index-9xb0axhc.js";
14
+ } from "./index-gc2749rx.js";
15
15
  import {
16
16
  setStoragePrivatePermissionEnforcement
17
- } from "./index-vf38qhee.js";
17
+ } from "./index-81nthk8j.js";
18
18
 
19
19
  // ../plugin/src/features/magic-context/memory/embedding-worker.ts
20
20
  import { parentPort, workerData } from "node:worker_threads";
@@ -1,9 +1,10 @@
1
- import"./index-0h2mkab2.js";
2
- import"./index-f956htf3.js";
3
1
  import {
2
+ subagentTemperature,
4
3
  promptFingerprint,
5
4
  readHostSystemPrompt
6
- } from "./index-zrr5t5a7.js";
5
+ } from "./index-zh1jw8qp.js";
6
+ import"./index-0h2mkab2.js";
7
+ import"./index-x3dcnxh0.js";
7
8
 
8
9
  // src/historian-calibration-extension.ts
9
10
  import { readFileSync } from "node:fs";
@@ -55,6 +56,21 @@ function calibrateHistorianProviderPayload(payload, temperature, maxOutputTokens
55
56
  }
56
57
  return calibrated;
57
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
+ }
58
74
  function historianCalibrationExtension(pi) {
59
75
  const intendedPath = process.env.MAGIC_CONTEXT_SUBAGENT_PROMPT_FILE;
60
76
  if (intendedPath) {
@@ -73,11 +89,20 @@ function historianCalibrationExtension(pi) {
73
89
  const maxOutputTokens = finiteNumber(process.env[HISTORIAN_MAX_OUTPUT_TOKENS_ENV]);
74
90
  if (temperature === undefined && maxOutputTokens === undefined)
75
91
  return;
76
- 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
+ });
77
101
  }
78
102
  export {
79
103
  HISTORIAN_MAX_OUTPUT_TOKENS_ENV,
80
104
  HISTORIAN_TEMPERATURE_ENV,
81
105
  calibrateHistorianProviderPayload,
82
- historianCalibrationExtension as default
106
+ historianCalibrationExtension as default,
107
+ withoutProviderTemperature
83
108
  };