@cortexkit/pi-magic-context 0.44.1 → 0.44.2
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.
- package/dist/historian-calibration-extension.js +17 -0
- package/dist/{index-mwpk0wn9.js → index-esnhck8v.js} +14695 -14254
- package/dist/{index-nm3c0sn8.js → index-gsff513e.js} +159 -39
- package/dist/index-n8kg008j.js +245 -0
- package/dist/index.js +1313 -439
- package/dist/{read-session-chunk-ka7n4kah.js → read-session-chunk-zhtcx9f1.js} +1 -1
- package/dist/subagent-entry.js +18 -2
- package/package.json +1 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import"./index-59dmj4zs.js";
|
|
2
|
+
import {
|
|
3
|
+
promptFingerprint
|
|
4
|
+
} from "./index-n8kg008j.js";
|
|
5
|
+
|
|
1
6
|
// src/historian-calibration-extension.ts
|
|
7
|
+
import { readFileSync } from "node:fs";
|
|
2
8
|
var HISTORIAN_TEMPERATURE_ENV = "MAGIC_CONTEXT_HISTORIAN_TEMPERATURE";
|
|
3
9
|
var HISTORIAN_MAX_OUTPUT_TOKENS_ENV = "MAGIC_CONTEXT_HISTORIAN_MAX_OUTPUT_TOKENS";
|
|
4
10
|
function finiteNumber(value) {
|
|
@@ -48,6 +54,17 @@ function calibrateHistorianProviderPayload(payload, temperature, maxOutputTokens
|
|
|
48
54
|
return calibrated;
|
|
49
55
|
}
|
|
50
56
|
function historianCalibrationExtension(pi) {
|
|
57
|
+
const intendedPath = process.env.MAGIC_CONTEXT_SUBAGENT_PROMPT_FILE;
|
|
58
|
+
if (intendedPath) {
|
|
59
|
+
const intended = readFileSync(intendedPath, "utf8");
|
|
60
|
+
pi.on("context", (_event, ctx) => {
|
|
61
|
+
const effective = ctx.getSystemPrompt();
|
|
62
|
+
process.stdout.write(`${JSON.stringify({ type: "mc_system_prompt", ...promptFingerprint(effective), containsIntended: effective.includes(intended) })}
|
|
63
|
+
`);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (process.env.MAGIC_CONTEXT_SUBAGENT_PROVENANCE_ONLY === "1")
|
|
67
|
+
return;
|
|
51
68
|
const temperature = finiteNumber(process.env[HISTORIAN_TEMPERATURE_ENV]);
|
|
52
69
|
const maxOutputTokens = finiteNumber(process.env[HISTORIAN_MAX_OUTPUT_TOKENS_ENV]);
|
|
53
70
|
if (temperature === undefined && maxOutputTokens === undefined)
|