@cortexkit/pi-magic-context 0.44.0 → 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.
@@ -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)
@@ -11,6 +11,9 @@ function setHarness(value) {
11
11
  function getHarness() {
12
12
  return currentHarness;
13
13
  }
14
+ function harnessOwnsOpenCodeStore(harness = currentHarness) {
15
+ return harness === "opencode" || harness === "opencode2";
16
+ }
14
17
 
15
18
  // ../plugin/src/shared/data-path.ts
16
19
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
@@ -485,4 +488,4 @@ if (!isTestEnv) {
485
488
  process.on("exit", flush);
486
489
  }
487
490
 
488
- export { setHarness, getHarness, getDataDir, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getMagicContextStorageDir, getLegacyOpenCodeMagicContextStorageDir, sanitizeDiagnosticText, hasShareabilitySensitiveText, log, sessionLog, flushLogger };
491
+ export { setHarness, getHarness, harnessOwnsOpenCodeStore, getDataDir, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getMagicContextStorageDir, getLegacyOpenCodeMagicContextStorageDir, sanitizeDiagnosticText, hasShareabilitySensitiveText, log, sessionLog, flushLogger };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log
3
- } from "./index-tfzybajk.js";
3
+ } from "./index-59dmj4zs.js";
4
4
 
5
5
  // ../plugin/src/shared/safe-notification-target.ts
6
6
  var DEFAULT_TITLE_RE = /^(New session - |Child session - )\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log
3
- } from "./index-tfzybajk.js";
3
+ } from "./index-59dmj4zs.js";
4
4
 
5
5
  // ../plugin/src/shared/write-transaction-timing.ts
6
6
  var SLOW_WRITE_TRANSACTION_THRESHOLD_MS = 1000;