@cortexkit/opencode-magic-context 0.41.3 → 0.41.4
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/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-z5sd697e.js → conflict-warning-hook-ejkc9sjn.js} +2 -2
- package/dist/{derive-budgets-901a0pk0.js → derive-budgets-bc366cz8.js} +4 -2
- package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +13 -0
- package/dist/features/magic-context/dreamer/storage-dream-runs.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-scheduler.d.ts +3 -0
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +2 -2
- package/dist/hooks/magic-context/command-handler.d.ts +5 -1
- package/dist/hooks/magic-context/command-handler.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-types.d.ts +4 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/derive-budgets.d.ts +1 -0
- package/dist/hooks/magic-context/derive-budgets.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts +3 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts +7 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +4 -3
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts +2 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +5 -2
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/issue-423-fixture.d.ts +37 -0
- package/dist/hooks/magic-context/issue-423-fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/issue-424-fixture.d.ts +11 -0
- package/dist/hooks/magic-context/issue-424-fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/producer-window-guard.d.ts +8 -0
- package/dist/hooks/magic-context/producer-window-guard.d.ts.map +1 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +59 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +2 -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 +4 -1
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +2 -0
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +5 -2
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/sentinel.d.ts +3 -3
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +8 -3
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts +1 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +2 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.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/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/{index-vmmjdpc0.js → index-0y2mcg5y.js} +282 -41
- package/dist/{index-npx8vhmy.js → index-4avmwfp5.js} +1 -1
- package/dist/{index-kby1sng5.js → index-avwt563y.js} +8 -1
- package/dist/{index-0bycg0np.js → index-fz104x1j.js} +1 -1
- package/dist/{index-dn1rwpd8.js → index-mjv9je4e.js} +14 -10
- package/dist/index-sd3egckz.js +1583 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +455 -1400
- package/dist/plugin/hooks/create-session-hooks.d.ts +3 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{recomp-orchestrator-f5m2wk74.js → recomp-orchestrator-q98r6rga.js} +4 -4
- package/dist/shared/cache-ttl-display.d.ts +23 -0
- package/dist/shared/cache-ttl-display.d.ts.map +1 -0
- package/dist/shared/cache-ttl-seed.d.ts +10 -0
- package/dist/shared/cache-ttl-seed.d.ts.map +1 -0
- package/dist/shared/config-diagnostics.d.ts +30 -0
- package/dist/shared/config-diagnostics.d.ts.map +1 -0
- package/dist/shared/config-warning-surface.d.ts +3 -0
- package/dist/shared/config-warning-surface.d.ts.map +1 -0
- package/dist/shared/data-path.d.ts +10 -9
- package/dist/shared/data-path.d.ts.map +1 -1
- package/dist/shared/harness-provider-map.d.ts +7 -0
- package/dist/shared/harness-provider-map.d.ts.map +1 -1
- package/dist/shared/jsonc-parser.d.ts +12 -0
- package/dist/shared/jsonc-parser.d.ts.map +1 -1
- package/dist/shared/model-suggestion-retry.d.ts +14 -10
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/pi-executable.d.ts +6 -0
- package/dist/shared/pi-executable.d.ts.map +1 -0
- package/dist/shared/rpc-types.d.ts +6 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/rpc-utils.d.ts.map +1 -1
- package/dist/shared/status-detail-text.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/{storage-meta-session-3rxx9ekm.js → storage-meta-session-dvwfw778.js} +1 -1
- package/package.json +1 -1
- package/src/config/index.test.ts +44 -0
- package/src/config/index.ts +96 -15
- package/src/shared/cache-ttl-display.test.ts +84 -0
- package/src/shared/cache-ttl-display.ts +64 -0
- package/src/shared/cache-ttl-seed.ts +23 -0
- package/src/shared/config-diagnostics.test.ts +29 -0
- package/src/shared/config-diagnostics.ts +64 -0
- package/src/shared/config-warning-surface.ts +28 -0
- package/src/shared/data-path.ts +10 -9
- package/src/shared/harness-provider-map.test.ts +16 -0
- package/src/shared/harness-provider-map.ts +15 -0
- package/src/shared/jsonc-parser.test.ts +14 -1
- package/src/shared/jsonc-parser.ts +93 -0
- package/src/shared/model-suggestion-retry.ts +143 -28
- package/src/shared/pi-executable.ts +20 -0
- package/src/shared/rpc-types.ts +6 -0
- package/src/shared/rpc-utils.ts +2 -3
- package/src/shared/status-detail-text.test.ts +2 -1
- package/src/shared/status-detail-text.ts +5 -1
- package/src/shared/tag-transcript.ts +21 -2
- package/src/tui/index.tsx +15 -1
- package/src/tui-compiled/index.tsx +234 -222
- package/dist/index-jfpk81yt.js +0 -146
package/dist/index-jfpk81yt.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
// src/shared/jsonc-parser.ts
|
|
2
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
-
function stripJsonComments(content) {
|
|
4
|
-
let result = "";
|
|
5
|
-
let inString = false;
|
|
6
|
-
let escaped = false;
|
|
7
|
-
let inLineComment = false;
|
|
8
|
-
let inBlockComment = false;
|
|
9
|
-
for (let index = 0;index < content.length; index += 1) {
|
|
10
|
-
const char = content[index];
|
|
11
|
-
const next = content[index + 1];
|
|
12
|
-
if (inLineComment) {
|
|
13
|
-
if (char === `
|
|
14
|
-
`) {
|
|
15
|
-
inLineComment = false;
|
|
16
|
-
result += char;
|
|
17
|
-
}
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
if (inBlockComment) {
|
|
21
|
-
if (char === "*" && next === "/") {
|
|
22
|
-
inBlockComment = false;
|
|
23
|
-
index += 1;
|
|
24
|
-
}
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
if (inString) {
|
|
28
|
-
result += char;
|
|
29
|
-
if (escaped) {
|
|
30
|
-
escaped = false;
|
|
31
|
-
} else if (char === "\\") {
|
|
32
|
-
escaped = true;
|
|
33
|
-
} else if (char === '"') {
|
|
34
|
-
inString = false;
|
|
35
|
-
}
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
if (char === '"') {
|
|
39
|
-
inString = true;
|
|
40
|
-
result += char;
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (char === "/" && next === "/") {
|
|
44
|
-
inLineComment = true;
|
|
45
|
-
index += 1;
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (char === "/" && next === "*") {
|
|
49
|
-
inBlockComment = true;
|
|
50
|
-
index += 1;
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
result += char;
|
|
54
|
-
}
|
|
55
|
-
return result;
|
|
56
|
-
}
|
|
57
|
-
function stripTrailingCommas(content) {
|
|
58
|
-
let result = "";
|
|
59
|
-
let inString = false;
|
|
60
|
-
let escaped = false;
|
|
61
|
-
for (let index = 0;index < content.length; index += 1) {
|
|
62
|
-
const char = content[index];
|
|
63
|
-
if (inString) {
|
|
64
|
-
result += char;
|
|
65
|
-
if (escaped) {
|
|
66
|
-
escaped = false;
|
|
67
|
-
} else if (char === "\\") {
|
|
68
|
-
escaped = true;
|
|
69
|
-
} else if (char === '"') {
|
|
70
|
-
inString = false;
|
|
71
|
-
}
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
if (char === '"') {
|
|
75
|
-
inString = true;
|
|
76
|
-
result += char;
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (char === ",") {
|
|
80
|
-
let lookahead = index + 1;
|
|
81
|
-
while (lookahead < content.length && /\s/.test(content[lookahead] ?? "")) {
|
|
82
|
-
lookahead += 1;
|
|
83
|
-
}
|
|
84
|
-
const next = content[lookahead];
|
|
85
|
-
if (next === "}" || next === "]") {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
result += char;
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
}
|
|
93
|
-
var PROTOTYPE_POLLUTION_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
94
|
-
function isPrototypePollutionKey(key) {
|
|
95
|
-
return PROTOTYPE_POLLUTION_KEYS.has(key);
|
|
96
|
-
}
|
|
97
|
-
function sanitizeParsedJson(value, options = {}, path = []) {
|
|
98
|
-
if (Array.isArray(value)) {
|
|
99
|
-
return value.map((entry, index) => sanitizeParsedJson(entry, options, [...path, index]));
|
|
100
|
-
}
|
|
101
|
-
if (value === null || typeof value !== "object")
|
|
102
|
-
return value;
|
|
103
|
-
const source = value;
|
|
104
|
-
const sourcePrototype = Object.getPrototypeOf(source);
|
|
105
|
-
if (sourcePrototype !== null && sourcePrototype !== Object.prototype) {
|
|
106
|
-
options.onRejectedKey?.([...path, "__proto__"]);
|
|
107
|
-
}
|
|
108
|
-
const sanitized = {};
|
|
109
|
-
for (const key of Object.keys(source)) {
|
|
110
|
-
if (isPrototypePollutionKey(key)) {
|
|
111
|
-
options.onRejectedKey?.([...path, key]);
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
Object.defineProperty(sanitized, key, {
|
|
115
|
-
value: sanitizeParsedJson(source[key], options, [...path, key]),
|
|
116
|
-
enumerable: true,
|
|
117
|
-
configurable: true,
|
|
118
|
-
writable: true
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return sanitized;
|
|
122
|
-
}
|
|
123
|
-
function parseJsonc(content, options = {}) {
|
|
124
|
-
const normalized = stripTrailingCommas(stripJsonComments(content));
|
|
125
|
-
return sanitizeParsedJson(JSON.parse(normalized), options);
|
|
126
|
-
}
|
|
127
|
-
function readJsoncFile(filePath) {
|
|
128
|
-
try {
|
|
129
|
-
return parseJsonc(readFileSync(filePath, "utf-8"));
|
|
130
|
-
} catch (_error) {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
function detectConfigFile(basePath) {
|
|
135
|
-
const jsoncPath = `${basePath}.jsonc`;
|
|
136
|
-
const jsonPath = `${basePath}.json`;
|
|
137
|
-
if (existsSync(jsoncPath)) {
|
|
138
|
-
return { format: "jsonc", path: jsoncPath };
|
|
139
|
-
}
|
|
140
|
-
if (existsSync(jsonPath)) {
|
|
141
|
-
return { format: "json", path: jsonPath };
|
|
142
|
-
}
|
|
143
|
-
return { format: "none", path: jsoncPath };
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export { stripJsonComments, isPrototypePollutionKey, parseJsonc, readJsoncFile, detectConfigFile };
|