@cortexkit/opencode-magic-context 0.34.2 → 0.35.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 (109) hide show
  1. package/README.md +3 -1
  2. package/dist/agents/hidden-agent-registrations.d.ts +10 -2
  3. package/dist/agents/hidden-agent-registrations.d.ts.map +1 -1
  4. package/dist/agents/magic-context-prompt.d.ts +2 -1
  5. package/dist/agents/magic-context-prompt.d.ts.map +1 -1
  6. package/dist/agents/permissions.d.ts +4 -3
  7. package/dist/agents/permissions.d.ts.map +1 -1
  8. package/dist/config/index.d.ts +3 -0
  9. package/dist/config/index.d.ts.map +1 -1
  10. package/dist/config/project-security.d.ts +3 -0
  11. package/dist/config/project-security.d.ts.map +1 -1
  12. package/dist/config/schema/agent-overrides.d.ts +1 -1
  13. package/dist/config/schema/magic-context.d.ts +51 -10
  14. package/dist/config/schema/magic-context.d.ts.map +1 -1
  15. package/dist/{conflict-warning-hook-fvpfvt0w.js → conflict-warning-hook-p2pmhvn7.js} +2 -1
  16. package/dist/features/magic-context/context-authority.d.ts.map +1 -1
  17. package/dist/features/magic-context/dreamer/provider-output-failure.d.ts +15 -0
  18. package/dist/features/magic-context/dreamer/provider-output-failure.d.ts.map +1 -0
  19. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  20. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  21. package/dist/features/magic-context/mural/compress-cues.d.ts +6 -2
  22. package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
  23. package/dist/features/magic-context/mural/storage-mural-cues.d.ts +4 -4
  24. package/dist/hooks/magic-context/compartment-prompt.d.ts +6 -6
  25. package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
  26. package/dist/hooks/magic-context/compartment-runner-historian.d.ts +2 -14
  27. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  28. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  29. package/dist/hooks/magic-context/compartment-runner-validation.d.ts +16 -2
  30. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  31. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/hook.d.ts +10 -3
  33. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  34. package/dist/hooks/magic-context/module-state-sync.d.ts +1 -1
  35. package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/module-transport.d.ts +2 -1
  37. package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/read-session-chunk.d.ts +5 -0
  40. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +2 -0
  43. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
  44. package/dist/hooks/magic-context/rust-mode-transform.d.ts +6 -0
  45. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/system-prompt-hash.d.ts +19 -5
  47. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/transform.d.ts +3 -0
  49. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  50. package/dist/index-0c9dmw9m.js +116 -0
  51. package/dist/{index-dtas91s5.js → index-8aaadh98.js} +7 -119
  52. package/dist/index-dpdnjawy.js +2892 -0
  53. package/dist/{index-z70pxrq1.js → index-fkyamz2w.js} +732 -613
  54. package/dist/{index-cn960ffd.js → index-h5zjfesc.js} +1 -1
  55. package/dist/{index-fcyvznch.js → index-w0nygb4p.js} +45 -2
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +843 -818
  58. package/dist/plugin/hooks/create-session-hooks.d.ts +12 -0
  59. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  60. package/dist/plugin/rpc-handlers.d.ts +1 -0
  61. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  62. package/dist/plugin/tool-registry.d.ts +4 -0
  63. package/dist/plugin/tool-registry.d.ts.map +1 -1
  64. package/dist/{recomp-orchestrator-6cd3nrt7.js → recomp-orchestrator-29f4rqax.js} +5 -4
  65. package/dist/{send-session-notification-6njqewzk.js → send-session-notification-sr5g06hz.js} +2 -2
  66. package/dist/shared/index.d.ts +2 -0
  67. package/dist/shared/index.d.ts.map +1 -1
  68. package/dist/shared/prompt-surface-a1-golden.d.ts +28 -0
  69. package/dist/shared/prompt-surface-a1-golden.d.ts.map +1 -0
  70. package/dist/shared/prompt-surface-runtime.d.ts +43 -0
  71. package/dist/shared/prompt-surface-runtime.d.ts.map +1 -0
  72. package/dist/shared/prompt-surface.d.ts +49 -0
  73. package/dist/shared/prompt-surface.d.ts.map +1 -0
  74. package/dist/shared/sqlite.d.ts +13 -0
  75. package/dist/shared/sqlite.d.ts.map +1 -1
  76. package/dist/{storage-meta-session-xt41zbw4.js → storage-meta-session-ev8b55a9.js} +2 -2
  77. package/dist/tools/ctx-expand/tools.d.ts +1 -0
  78. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  79. package/dist/tools/ctx-memory/tools.d.ts +1 -0
  80. package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
  81. package/dist/tools/ctx-note/tools.d.ts +1 -0
  82. package/dist/tools/ctx-note/tools.d.ts.map +1 -1
  83. package/dist/tools/ctx-reduce/tools.d.ts +1 -0
  84. package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
  85. package/dist/tools/ctx-search/tools.d.ts +1 -0
  86. package/dist/tools/ctx-search/tools.d.ts.map +1 -1
  87. package/dist/tools/light-descriptions.d.ts +6 -0
  88. package/dist/tools/light-descriptions.d.ts.map +1 -0
  89. package/package.json +1 -1
  90. package/src/agents/hidden-agent-registrations.ts +49 -1
  91. package/src/agents/magic-context-prompt.test.ts +144 -0
  92. package/src/agents/magic-context-prompt.ts +53 -2
  93. package/src/agents/permissions.ts +4 -3
  94. package/src/config/index.test.ts +53 -0
  95. package/src/config/index.ts +4 -0
  96. package/src/config/project-security.test.ts +20 -0
  97. package/src/config/project-security.ts +23 -0
  98. package/src/config/schema/magic-context.test.ts +58 -0
  99. package/src/config/schema/magic-context.ts +61 -1
  100. package/src/shared/index.ts +2 -0
  101. package/src/shared/prompt-surface-a1-golden.md +458 -0
  102. package/src/shared/prompt-surface-a1-golden.ts +41 -0
  103. package/src/shared/prompt-surface-runtime.test.ts +141 -0
  104. package/src/shared/prompt-surface-runtime.ts +250 -0
  105. package/src/shared/prompt-surface.test.ts +109 -0
  106. package/src/shared/prompt-surface.ts +138 -0
  107. package/src/shared/sqlite.test.ts +32 -0
  108. package/src/shared/sqlite.ts +85 -9
  109. package/dist/index-b563sga5.js +0 -134784
@@ -1,3 +1,6 @@
1
+ import {
2
+ readJsoncFile
3
+ } from "./index-0c9dmw9m.js";
1
4
  import {
2
5
  waitForSafeNotificationTarget
3
6
  } from "./index-73xz0247.js";
@@ -9,7 +12,7 @@ import {
9
12
  } from "./index-wckvcay0.js";
10
13
 
11
14
  // src/plugin/conflict-warning-hook.ts
12
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
15
+ import { existsSync, readFileSync } from "node:fs";
13
16
  import { homedir as homedir3, platform } from "node:os";
14
17
  import { join as join3 } from "node:path";
15
18
 
@@ -17,121 +20,6 @@ import { join as join3 } from "node:path";
17
20
  import { homedir as homedir2 } from "node:os";
18
21
  import { join as join2 } from "node:path";
19
22
 
20
- // src/shared/jsonc-parser.ts
21
- import { existsSync, readFileSync } from "node:fs";
22
- function stripJsonComments(content) {
23
- let result = "";
24
- let inString = false;
25
- let escaped = false;
26
- let inLineComment = false;
27
- let inBlockComment = false;
28
- for (let index = 0;index < content.length; index += 1) {
29
- const char = content[index];
30
- const next = content[index + 1];
31
- if (inLineComment) {
32
- if (char === `
33
- `) {
34
- inLineComment = false;
35
- result += char;
36
- }
37
- continue;
38
- }
39
- if (inBlockComment) {
40
- if (char === "*" && next === "/") {
41
- inBlockComment = false;
42
- index += 1;
43
- }
44
- continue;
45
- }
46
- if (inString) {
47
- result += char;
48
- if (escaped) {
49
- escaped = false;
50
- } else if (char === "\\") {
51
- escaped = true;
52
- } else if (char === '"') {
53
- inString = false;
54
- }
55
- continue;
56
- }
57
- if (char === '"') {
58
- inString = true;
59
- result += char;
60
- continue;
61
- }
62
- if (char === "/" && next === "/") {
63
- inLineComment = true;
64
- index += 1;
65
- continue;
66
- }
67
- if (char === "/" && next === "*") {
68
- inBlockComment = true;
69
- index += 1;
70
- continue;
71
- }
72
- result += char;
73
- }
74
- return result;
75
- }
76
- function stripTrailingCommas(content) {
77
- let result = "";
78
- let inString = false;
79
- let escaped = false;
80
- for (let index = 0;index < content.length; index += 1) {
81
- const char = content[index];
82
- if (inString) {
83
- result += char;
84
- if (escaped) {
85
- escaped = false;
86
- } else if (char === "\\") {
87
- escaped = true;
88
- } else if (char === '"') {
89
- inString = false;
90
- }
91
- continue;
92
- }
93
- if (char === '"') {
94
- inString = true;
95
- result += char;
96
- continue;
97
- }
98
- if (char === ",") {
99
- let lookahead = index + 1;
100
- while (lookahead < content.length && /\s/.test(content[lookahead] ?? "")) {
101
- lookahead += 1;
102
- }
103
- const next = content[lookahead];
104
- if (next === "}" || next === "]") {
105
- continue;
106
- }
107
- }
108
- result += char;
109
- }
110
- return result;
111
- }
112
- function parseJsonc(content) {
113
- const normalized = stripTrailingCommas(stripJsonComments(content));
114
- return JSON.parse(normalized);
115
- }
116
- function readJsoncFile(filePath) {
117
- try {
118
- return parseJsonc(readFileSync(filePath, "utf-8"));
119
- } catch (_error) {
120
- return null;
121
- }
122
- }
123
- function detectConfigFile(basePath) {
124
- const jsoncPath = `${basePath}.jsonc`;
125
- const jsonPath = `${basePath}.json`;
126
- if (existsSync(jsoncPath)) {
127
- return { format: "jsonc", path: jsoncPath };
128
- }
129
- if (existsSync(jsonPath)) {
130
- return { format: "json", path: jsonPath };
131
- }
132
- return { format: "none", path: jsoncPath };
133
- }
134
-
135
23
  // src/shared/opencode-config-dir.ts
136
24
  import { homedir } from "node:os";
137
25
  import { join, resolve } from "node:path";
@@ -402,12 +290,12 @@ function getDesktopStatePath() {
402
290
  }
403
291
  function readDesktopState(directory) {
404
292
  const statePath = getDesktopStatePath();
405
- if (!statePath || !existsSync2(statePath)) {
293
+ if (!statePath || !existsSync(statePath)) {
406
294
  log(`[magic-context] conflict-warning: Desktop state file not found at ${statePath}`);
407
295
  return { sessionId: null, sidecarUrl: null };
408
296
  }
409
297
  try {
410
- const raw = readFileSync2(statePath, "utf-8");
298
+ const raw = readFileSync(statePath, "utf-8");
411
299
  const state = JSON.parse(raw);
412
300
  let sidecarUrl = null;
413
301
  const serverStr = state.server;
@@ -698,4 +586,4 @@ async function sendStartupAnnouncement(client, directory, version, features, foo
698
586
  markSeen(version);
699
587
  }
700
588
 
701
- export { stripJsonComments, parseJsonc, detectConfigFile, detectConflicts, sendConflictWarning, cleanupConflictWarnings, sendSchemaFenceWarning, sendStartupAnnouncement };
589
+ export { detectConflicts, sendConflictWarning, cleanupConflictWarnings, sendSchemaFenceWarning, sendStartupAnnouncement };