@cortexkit/pi-magic-context 0.49.13 → 0.49.15

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.
@@ -22,7 +22,7 @@ var [
22
22
  import("./embedding-cache-7rp4gqzr.js"),
23
23
  import("./storage-memory-axnsk5t1.js"),
24
24
  import("./project-embedding-registry-52zwmtbn.js"),
25
- import("./search-hffb8xht.js"),
25
+ import("./search-ddbz6v60.js"),
26
26
  import("./embedding-activity-ew6dshfd.js"),
27
27
  import("./harness-9872e0ym.js"),
28
28
  import("./sqlite-adjpy399.js"),
@@ -28,8 +28,8 @@ import"./index-apgwdby5.js";
28
28
  import {
29
29
  LATEST_SUPPORTED_VERSION,
30
30
  enforceSchemaFence
31
- } from "./index-t27xk4r7.js";
32
- import"./index-3cnarwf8.js";
31
+ } from "./index-ccsscaap.js";
32
+ import"./index-bet4sd3e.js";
33
33
  import"./index-jrap43gc.js";
34
34
  import"./index-135e8hvg.js";
35
35
  import"./index-8976mezv.js";
@@ -1,109 +1,21 @@
1
1
  import {
2
- subagentTemperature,
3
- promptFingerprint,
4
- readHostSystemPrompt
5
- } from "./index-y29y2j2w.js";
2
+ HISTORIAN_TEMPERATURE_ENV2,
3
+ HISTORIAN_MAX_OUTPUT_TOKENS_ENV2,
4
+ SUBAGENT_OUTPUT_CEILING_ENV2,
5
+ calibrateHistorianProviderPayload2,
6
+ ceilProviderOutputTokens2,
7
+ withoutProviderTemperature2,
8
+ historianCalibrationExtension
9
+ } from "./index-ajfpyk0x.js";
6
10
  import"./index-6x556c2q.js";
7
- import"./index-0h2mkab2.js";
8
11
  import"./index-7bqrfyny.js";
9
-
10
- // src/historian-calibration-extension.ts
11
- import { readFileSync } from "node:fs";
12
- var HISTORIAN_TEMPERATURE_ENV = "MAGIC_CONTEXT_HISTORIAN_TEMPERATURE";
13
- var HISTORIAN_MAX_OUTPUT_TOKENS_ENV = "MAGIC_CONTEXT_HISTORIAN_MAX_OUTPUT_TOKENS";
14
- function finiteNumber(value) {
15
- if (value === undefined || value.trim().length === 0)
16
- return;
17
- const parsed = Number(value);
18
- return Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;
19
- }
20
- function calibrateHistorianProviderPayload(payload, temperature, maxOutputTokens) {
21
- if (typeof payload !== "object" || payload === null || Array.isArray(payload))
22
- return payload;
23
- if (temperature === undefined && maxOutputTokens === undefined)
24
- return payload;
25
- const calibrated = { ...payload };
26
- const generationConfig = calibrated.generationConfig;
27
- if (typeof generationConfig === "object" && generationConfig !== null && !Array.isArray(generationConfig)) {
28
- calibrated.generationConfig = {
29
- ...generationConfig,
30
- ...temperature !== undefined ? { temperature } : {},
31
- ...maxOutputTokens !== undefined ? { maxOutputTokens } : {}
32
- };
33
- return calibrated;
34
- }
35
- const inferenceConfig = calibrated.inferenceConfig;
36
- if (typeof inferenceConfig === "object" && inferenceConfig !== null && !Array.isArray(inferenceConfig)) {
37
- calibrated.inferenceConfig = {
38
- ...inferenceConfig,
39
- ...temperature !== undefined ? { temperature } : {},
40
- ...maxOutputTokens !== undefined ? { maxTokens: maxOutputTokens } : {}
41
- };
42
- return calibrated;
43
- }
44
- if (temperature !== undefined) {
45
- calibrated.temperature = temperature;
46
- }
47
- if (maxOutputTokens !== undefined) {
48
- if ("max_output_tokens" in calibrated) {
49
- calibrated.max_output_tokens = maxOutputTokens;
50
- } else if ("max_completion_tokens" in calibrated) {
51
- calibrated.max_completion_tokens = maxOutputTokens;
52
- } else if ("max_tokens" in calibrated) {
53
- calibrated.max_tokens = maxOutputTokens;
54
- } else if ("maxTokens" in calibrated) {
55
- calibrated.maxTokens = maxOutputTokens;
56
- }
57
- }
58
- return calibrated;
59
- }
60
- function withoutProviderTemperature(payload) {
61
- if (!payload || typeof payload !== "object" || Array.isArray(payload))
62
- return payload;
63
- const clean = { ...payload };
64
- delete clean.temperature;
65
- for (const key of ["generationConfig", "inferenceConfig"]) {
66
- const nested = clean[key];
67
- if (nested && typeof nested === "object" && !Array.isArray(nested)) {
68
- const options = { ...nested };
69
- delete options.temperature;
70
- clean[key] = options;
71
- }
72
- }
73
- return clean;
74
- }
75
- function historianCalibrationExtension(pi) {
76
- const intendedPath = process.env.MAGIC_CONTEXT_SUBAGENT_PROMPT_FILE;
77
- if (intendedPath) {
78
- const intended = readFileSync(intendedPath, "utf8");
79
- pi.on("context", (_event, ctx) => {
80
- const effective = readHostSystemPrompt(ctx);
81
- if (effective === undefined)
82
- return;
83
- process.stdout.write(`${JSON.stringify({ type: "mc_system_prompt", ...promptFingerprint(effective), containsIntended: effective.includes(intended) })}
84
- `);
85
- });
86
- }
87
- if (process.env.MAGIC_CONTEXT_SUBAGENT_PROVENANCE_ONLY === "1")
88
- return;
89
- const temperature = finiteNumber(process.env[HISTORIAN_TEMPERATURE_ENV]);
90
- const maxOutputTokens = finiteNumber(process.env[HISTORIAN_MAX_OUTPUT_TOKENS_ENV]);
91
- if (temperature === undefined && maxOutputTokens === undefined)
92
- return;
93
- pi.on("before_provider_request", (event, ctx) => {
94
- const model = ctx.model;
95
- const key = `${model?.provider ?? "unknown"}/${model?.id ?? "unknown"}`;
96
- const sampling = subagentTemperature(key, model, temperature, (_message, decision) => {
97
- process.stdout.write(`${JSON.stringify({ type: "mc_temperature", model: key, supported: decision.supported ?? null, source: decision.source, ...decision.entry ? { entry: decision.entry } : {} })}
98
- `);
99
- });
100
- return calibrateHistorianProviderPayload(sampling === undefined ? withoutProviderTemperature(event.payload) : event.payload, sampling, maxOutputTokens);
101
- });
102
- }
12
+ import"./index-0h2mkab2.js";
103
13
  export {
104
- HISTORIAN_MAX_OUTPUT_TOKENS_ENV,
105
- HISTORIAN_TEMPERATURE_ENV,
106
- calibrateHistorianProviderPayload,
14
+ HISTORIAN_MAX_OUTPUT_TOKENS_ENV2 as HISTORIAN_MAX_OUTPUT_TOKENS_ENV,
15
+ HISTORIAN_TEMPERATURE_ENV2 as HISTORIAN_TEMPERATURE_ENV,
16
+ SUBAGENT_OUTPUT_CEILING_ENV2 as SUBAGENT_OUTPUT_CEILING_ENV,
17
+ calibrateHistorianProviderPayload2 as calibrateHistorianProviderPayload,
18
+ ceilProviderOutputTokens2 as ceilProviderOutputTokens,
107
19
  historianCalibrationExtension as default,
108
- withoutProviderTemperature
20
+ withoutProviderTemperature2 as withoutProviderTemperature
109
21
  };
@@ -22,7 +22,7 @@ import {
22
22
  resolveStoredPathWorkspaceIdentity,
23
23
  sourceNameForMemory,
24
24
  managedAuthorityNoteRow
25
- } from "./index-3cnarwf8.js";
25
+ } from "./index-bet4sd3e.js";
26
26
  import {
27
27
  isKnownAutocommit
28
28
  } from "./index-jrap43gc.js";
@@ -77,7 +77,7 @@ import {
77
77
  } from "./index-hy44m6jc.js";
78
78
  import {
79
79
  getIndexedMessageCorpusSize2
80
- } from "./index-vv1j5cak.js";
80
+ } from "./index-a4pk5yv9.js";
81
81
  import {
82
82
  computeNormalizedHash
83
83
  } from "./index-9x1f96r8.js";