@cortexkit/opencode-magic-context 0.34.1 → 0.35.0
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/README.md +3 -1
- package/dist/agents/magic-context-prompt.d.ts +2 -1
- package/dist/agents/magic-context-prompt.d.ts.map +1 -1
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +3 -0
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +42 -1
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-fvpfvt0w.js → conflict-warning-hook-p2pmhvn7.js} +2 -1
- package/dist/features/magic-context/context-authority.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/provider-output-failure.d.ts +15 -0
- package/dist/features/magic-context/dreamer/provider-output-failure.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts +9 -5
- package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-gate.d.ts +8 -2
- package/dist/features/magic-context/dreamer/verify-gate.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts +2 -0
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/fail-closed-block.d.ts +2 -0
- package/dist/features/magic-context/fail-closed-block.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts +13 -5
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/mural/cue-validation.d.ts +7 -7
- package/dist/features/magic-context/mural/cue-validation.d.ts.map +1 -1
- package/dist/features/magic-context/mural/storage-mural-cues.d.ts +17 -7
- package/dist/features/magic-context/mural/storage-mural-cues.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +21 -3
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +2 -14
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +16 -2
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts +1 -0
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +10 -3
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +2 -1
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +5 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +2 -0
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +22 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +19 -5
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts +1 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +4 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/index-0c9dmw9m.js +116 -0
- package/dist/{index-x8spt5wy.js → index-4anesz49.js} +849 -633
- package/dist/{index-dtas91s5.js → index-8aaadh98.js} +7 -119
- package/dist/{index-b563sga5.js → index-h8mk7vpa.js} +541 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1010 -840
- package/dist/plugin/hooks/create-session-hooks.d.ts +12 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +1 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts +4 -0
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/{recomp-orchestrator-k72ejkkh.js → recomp-orchestrator-zc915ceq.js} +3 -2
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/prompt-surface-runtime.d.ts +43 -0
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -0
- package/dist/shared/prompt-surface.d.ts +49 -0
- package/dist/shared/prompt-surface.d.ts.map +1 -0
- package/dist/{storage-meta-session-xt41zbw4.js → storage-meta-session-53cjs6mr.js} +1 -1
- package/dist/tools/ctx-expand/tools.d.ts +1 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/tools.d.ts +1 -0
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-note/tools.d.ts +1 -0
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts +1 -0
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/tools.d.ts +1 -0
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/dist/tools/light-descriptions.d.ts +6 -0
- package/dist/tools/light-descriptions.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/agents/magic-context-prompt.test.ts +144 -0
- package/src/agents/magic-context-prompt.ts +53 -2
- package/src/config/index.test.ts +53 -0
- package/src/config/index.ts +4 -0
- package/src/config/project-security.test.ts +20 -0
- package/src/config/project-security.ts +23 -0
- package/src/config/schema/magic-context.test.ts +58 -0
- package/src/config/schema/magic-context.ts +61 -1
- package/src/shared/index.ts +2 -0
- package/src/shared/prompt-surface-a1-golden.md +458 -0
- package/src/shared/prompt-surface-runtime.test.ts +141 -0
- package/src/shared/prompt-surface-runtime.ts +250 -0
- package/src/shared/prompt-surface.test.ts +109 -0
- package/src/shared/prompt-surface.ts +138 -0
|
@@ -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
|
|
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 || !
|
|
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 =
|
|
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 {
|
|
589
|
+
export { detectConflicts, sendConflictWarning, cleanupConflictWarnings, sendSchemaFenceWarning, sendStartupAnnouncement };
|