@cortexkit/pi-magic-context 0.44.1 → 0.44.3

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.
@@ -23,7 +23,7 @@ import {
23
23
  getRawSessionTagKeysThrough2,
24
24
  getLegacyProtectedTailStartOrdinal2,
25
25
  readSessionChunk2
26
- } from "./index-nm3c0sn8.js";
26
+ } from "./index-tckvezry.js";
27
27
  import"./index-59dmj4zs.js";
28
28
  export {
29
29
  cleanUserText2 as cleanUserText,
@@ -1,3 +1,6 @@
1
+ import {
2
+ TOKEN_BUDGET_TOOL_REFUSAL
3
+ } from "./index-tckvezry.js";
1
4
  import {
2
5
  setHarness,
3
6
  log
@@ -10,11 +13,11 @@ import {
10
13
  ensureProjectRegisteredFromPiDirectory,
11
14
  resolvePiHarnessKind,
12
15
  registerMagicContextTools
13
- } from "./index-mwpk0wn9.js";
14
- import"./index-nm3c0sn8.js";
16
+ } from "./index-atb1ecv9.js";
15
17
  import"./index-97e5fzy3.js";
16
18
 
17
19
  // src/subagent-entry.ts
20
+ import { readFileSync } from "node:fs";
18
21
  var SUBAGENT_DREAMER_ACTIONS_FLAG = "magic-context-dreamer-actions";
19
22
  var openedDb;
20
23
  function magicContextSubagentExtension(pi) {
@@ -24,6 +27,19 @@ function magicContextSubagentExtension(pi) {
24
27
  type: "boolean",
25
28
  default: false
26
29
  });
30
+ const budgetGuardFile = process.env.MAGIC_CONTEXT_SUBAGENT_BUDGET_GUARD_FILE;
31
+ if (budgetGuardFile) {
32
+ pi.on("tool_call", () => {
33
+ try {
34
+ if (readFileSync(budgetGuardFile, "utf8") === "finalize") {
35
+ return { block: true, reason: TOKEN_BUDGET_TOOL_REFUSAL };
36
+ }
37
+ } catch {
38
+ return { block: true, reason: TOKEN_BUDGET_TOOL_REFUSAL };
39
+ }
40
+ return;
41
+ });
42
+ }
27
43
  pi.on("session_start", async () => {
28
44
  try {
29
45
  const directory = process.cwd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/pi-magic-context",
3
- "version": "0.44.1",
3
+ "version": "0.44.3",
4
4
  "type": "module",
5
5
  "description": "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -48,7 +48,6 @@
48
48
  "comment-json": "^5.0.0",
49
49
  "onnxruntime-web": "1.26.0-dev.20260416-b7804b056c",
50
50
  "quickjs-emscripten": "^0.32.0",
51
- "typebox": "^1.3.1",
52
51
  "zod": "^4.1.8"
53
52
  },
54
53
  "optionalDependencies": {
@@ -68,11 +67,13 @@
68
67
  "pi-ai-086": "npm:@earendil-works/pi-ai@0.86.0",
69
68
  "pi-coding-agent-086": "npm:@earendil-works/pi-coding-agent@0.86.0",
70
69
  "pi-coding-agent-087": "npm:@earendil-works/pi-coding-agent@0.87.1",
70
+ "typebox": "^1.3.1",
71
71
  "typescript": "^5.8.0"
72
72
  },
73
73
  "peerDependencies": {
74
- "@earendil-works/pi-coding-agent": ">=0.80.2",
75
- "@earendil-works/pi-tui": ">=0.80.2"
74
+ "@earendil-works/pi-coding-agent": "*",
75
+ "@earendil-works/pi-tui": "*",
76
+ "typebox": "*"
76
77
  },
77
78
  "peerDependenciesMeta": {
78
79
  "@earendil-works/pi-coding-agent": {
@@ -80,6 +81,9 @@
80
81
  },
81
82
  "@earendil-works/pi-tui": {
82
83
  "optional": true
84
+ },
85
+ "typebox": {
86
+ "optional": true
83
87
  }
84
88
  },
85
89
  "exports": {