@cortexkit/opencode-magic-context 0.41.2 → 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/README.md +9 -3
- package/dist/announcement-3c1vertn.js +14 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +756 -4
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/conflict-warning-hook-ejkc9sjn.js +16 -0
- package/dist/derive-budgets-bc366cz8.js +13 -0
- package/dist/features/magic-context/compartment-lease.d.ts +6 -0
- package/dist/features/magic-context/compartment-lease.d.ts.map +1 -1
- 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/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +18 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +13 -14
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -1
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage-subagent-invocations.d.ts +3 -2
- package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +6 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +2 -2
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts +2 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
- 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/compaction-marker-manager.d.ts +6 -1
- package/dist/hooks/magic-context/compaction-marker-manager.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/compartment-runner.d.ts +2 -1
- package/dist/hooks/magic-context/compartment-runner.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 +9 -5
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +6 -0
- package/dist/hooks/magic-context/inject-compartments.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/module-state-sync.d.ts +2 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +11 -4
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts +6 -1
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- 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-db.d.ts +15 -0
- package/dist/hooks/magic-context/read-session-db.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 +15 -2
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts +6 -0
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/sentinel.d.ts +8 -19
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/hooks/magic-context/strip-content.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 +32 -0
- 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-j8r0ejb3.js → index-0y2mcg5y.js} +1971 -11203
- package/dist/{index-1yh8g550.js → index-22jkk6wg.js} +2 -15
- package/dist/{index-dmvy29z0.js → index-3wzdwt6p.js} +11 -15
- package/dist/{index-eq9wr75c.js → index-4avmwfp5.js} +57 -108
- package/dist/{index-d1mxrd3p.js → index-7k55qm8a.js} +17 -12
- package/dist/{index-2wchnyk6.js → index-avwt563y.js} +8 -1
- package/dist/{index-4x691bz5.js → index-dkv2dn46.js} +5 -2
- package/dist/{index-rgdqj8nj.js → index-e7vx3byk.js} +1 -1
- package/dist/{index-szf8w1p5.js → index-fmsr7v69.js} +2 -2
- package/dist/{index-y1yr57fw.js → index-fz104x1j.js} +18 -18
- package/dist/{index-d62ypazr.js → index-jdxxq8cz.js} +6 -11
- package/dist/{index-9j3tx8hy.js → index-may8skc8.js} +6 -25
- package/dist/{index-cvda5jb3.js → index-mjv9je4e.js} +23 -19
- package/dist/{index-zwjhba2r.js → index-q264erdp.js} +122 -41
- package/dist/{index-b9j85d29.js → index-raatkvw5.js} +49 -11
- package/dist/{index-9xexf8s7.js → index-rn7gafjr.js} +1 -9
- package/dist/index-sd3egckz.js +1583 -0
- package/dist/index-v6t0tg85.js +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2660 -3255
- package/dist/model-resolution-dxatzjde.js +12 -0
- package/dist/{index-dynqfgx1.js → module-asyncify-2EFITU5U-rkqjhjxd.js} +69 -8
- package/dist/plugin/boot-deadline.d.ts +47 -0
- package/dist/plugin/boot-deadline.d.ts.map +1 -0
- package/dist/plugin/conflict-warning-hook.d.ts +10 -0
- package/dist/plugin/conflict-warning-hook.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +5 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/prompt-context-5y5ms8f9.js +6 -0
- package/dist/recomp-orchestrator-q98r6rga.js +19 -0
- package/dist/rpc-notifications-4amf6mf4.js +14 -0
- package/dist/{index-vnz6jvdc.js → safe-notification-target-q9z81zt3.js} +4 -3
- package/dist/send-session-notification-hdh02wy9.js +16 -0
- 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/conflict-detector.d.ts +3 -1
- package/dist/shared/conflict-detector.d.ts.map +1 -1
- 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/harness.d.ts +3 -3
- package/dist/shared/harness.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-resolution.d.ts +3 -3
- package/dist/shared/model-resolution.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/prompt-surface-runtime.d.ts +2 -2
- package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
- 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/shared/transcript.d.ts +2 -1
- package/dist/shared/transcript.d.ts.map +1 -1
- package/dist/storage-meta-session-dvwfw778.js +20 -0
- package/dist/task-config-hnv93r7p.js +9 -0
- package/dist/transformers-node-wasm.js +328 -328
- package/dist/transformers-web.js +72 -72
- package/dist/{transformers.node-b1wa0hgx.js → transformers.node-dpmf3wpx.js} +74 -74
- package/package.json +1 -1
- package/src/config/index.test.ts +72 -0
- package/src/config/index.ts +96 -15
- package/src/config/project-security.hostile-matrix.test.ts +78 -9
- package/src/config/project-security.ts +4 -3
- package/src/config/schema/magic-context.test.ts +64 -0
- package/src/config/schema/magic-context.ts +100 -6
- 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/conflict-detector.test.ts +24 -0
- package/src/shared/conflict-detector.ts +25 -7
- 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/harness.ts +3 -3
- package/src/shared/jsonc-parser.test.ts +14 -1
- package/src/shared/jsonc-parser.ts +93 -0
- package/src/shared/model-resolution.test.ts +61 -0
- package/src/shared/model-resolution.ts +14 -5
- package/src/shared/model-suggestion-retry.ts +143 -28
- package/src/shared/pi-executable.ts +20 -0
- package/src/shared/prompt-surface-runtime.ts +3 -3
- 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 +32 -2
- package/src/shared/transcript.ts +3 -1
- package/src/tui/index.tsx +15 -1
- package/src/tui-compiled/index.tsx +234 -222
- package/dist/announcement-3g9xg433.js +0 -18
- package/dist/conflict-warning-hook-rf17b6et.js +0 -17
- package/dist/derive-budgets-9q2d3r93.js +0 -14
- package/dist/emscripten-module-49k43zfy.js +0 -507
- package/dist/emscripten-module-ex4v0x4z.js +0 -606
- package/dist/emscripten-module-jfs3d1dq.js +0 -1536
- package/dist/emscripten-module-ss4g4spn.js +0 -4563
- package/dist/ffi-bbm9vkfa.js +0 -92
- package/dist/ffi-kb5r0x1j.js +0 -92
- package/dist/ffi-qnrt0y78.js +0 -80
- package/dist/ffi-yx2hpf4p.js +0 -80
- package/dist/index-8mtsfhyg.js +0 -146
- package/dist/index-8sseka65.js +0 -251
- package/dist/index-ss632za9.js +0 -77
- package/dist/model-resolution-6w6wzw18.js +0 -17
- package/dist/module-ES6BEMUI-1yjdz59c.js +0 -14
- package/dist/module-asyncify-2EFITU5U-fdkx4fhy.js +0 -9
- package/dist/prompt-context-29qkb28f.js +0 -7
- package/dist/recomp-orchestrator-m37p3fq6.js +0 -34
- package/dist/rpc-notifications-1ffm755w.js +0 -17
- package/dist/safe-notification-target-2a8py95v.js +0 -11
- package/dist/send-session-notification-bw7eex6w.js +0 -20
- package/dist/storage-meta-session-dse3qv6s.js +0 -23
- package/dist/task-config-gv6s04fp.js +0 -18
- /package/dist/{index-37yzyeca.js → index-3fe78beq.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__require
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-22jkk6wg.js";
|
|
4
4
|
|
|
5
5
|
// ../../node_modules/.bun/@huggingface+transformers@4.2.0/node_modules/@huggingface/transformers/dist/transformers.node.mjs
|
|
6
6
|
import fs from "fs";
|
|
@@ -4257,18 +4257,18 @@ var Environment = class {
|
|
|
4257
4257
|
}
|
|
4258
4258
|
}
|
|
4259
4259
|
};
|
|
4260
|
-
function setupGlobals(
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4260
|
+
function setupGlobals(env2) {
|
|
4261
|
+
env2.set("false", false);
|
|
4262
|
+
env2.set("true", true);
|
|
4263
|
+
env2.set("none", null);
|
|
4264
|
+
env2.set("raise_exception", (args) => {
|
|
4265
4265
|
throw new Error(args);
|
|
4266
4266
|
});
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4267
|
+
env2.set("range", range);
|
|
4268
|
+
env2.set("strftime_now", strftime_now);
|
|
4269
|
+
env2.set("True", true);
|
|
4270
|
+
env2.set("False", false);
|
|
4271
|
+
env2.set("None", null);
|
|
4272
4272
|
}
|
|
4273
4273
|
function getAttributeValue(item, attributePath) {
|
|
4274
4274
|
const parts = attributePath.split(".");
|
|
@@ -4333,8 +4333,8 @@ function compareRuntimeValues(a, b, caseSensitive = false) {
|
|
|
4333
4333
|
}
|
|
4334
4334
|
var Interpreter = class {
|
|
4335
4335
|
global;
|
|
4336
|
-
constructor(
|
|
4337
|
-
this.global =
|
|
4336
|
+
constructor(env2) {
|
|
4337
|
+
this.global = env2 ?? new Environment;
|
|
4338
4338
|
}
|
|
4339
4339
|
run(program) {
|
|
4340
4340
|
return this.evaluate(program, this.global);
|
|
@@ -5417,14 +5417,14 @@ var Template = class {
|
|
|
5417
5417
|
this.parsed = parse(tokens);
|
|
5418
5418
|
}
|
|
5419
5419
|
render(items) {
|
|
5420
|
-
const
|
|
5421
|
-
setupGlobals(
|
|
5420
|
+
const env2 = new Environment;
|
|
5421
|
+
setupGlobals(env2);
|
|
5422
5422
|
if (items) {
|
|
5423
5423
|
for (const [key, value] of Object.entries(items)) {
|
|
5424
|
-
|
|
5424
|
+
env2.set(key, value);
|
|
5425
5425
|
}
|
|
5426
5426
|
}
|
|
5427
|
-
const interpreter = new Interpreter(
|
|
5427
|
+
const interpreter = new Interpreter(env2);
|
|
5428
5428
|
const result = interpreter.run(this.parsed);
|
|
5429
5429
|
return result.value;
|
|
5430
5430
|
}
|
|
@@ -6071,8 +6071,8 @@ function getFetchHeaders(urlOrPath) {
|
|
|
6071
6071
|
const headers = new Headers;
|
|
6072
6072
|
if (isNode) {
|
|
6073
6073
|
const IS_CI = !!process.env?.TESTING_REMOTELY;
|
|
6074
|
-
const
|
|
6075
|
-
headers.set("User-Agent", `transformers.js/${
|
|
6074
|
+
const version = env3.version;
|
|
6075
|
+
headers.set("User-Agent", `transformers.js/${version}; is_ci/${IS_CI};`);
|
|
6076
6076
|
const isHFURL = isValidUrl(urlOrPath, ["http:", "https:"], ["huggingface.co", "hf.co"]);
|
|
6077
6077
|
if (isHFURL) {
|
|
6078
6078
|
const token = process.env?.HF_TOKEN ?? process.env?.HF_ACCESS_TOKEN;
|
|
@@ -6835,7 +6835,7 @@ function dynamic_time_warping(matrix) {
|
|
|
6835
6835
|
const outputShape = [output_length + 1, input_length + 1];
|
|
6836
6836
|
const cost = Array.from({ length: outputShape[0] }, () => Array(outputShape[1]).fill(Infinity));
|
|
6837
6837
|
cost[0][0] = 0;
|
|
6838
|
-
const
|
|
6838
|
+
const trace = Array.from({ length: outputShape[0] }, () => Array(outputShape[1]).fill(-1));
|
|
6839
6839
|
for (let j2 = 1;j2 < outputShape[1]; ++j2) {
|
|
6840
6840
|
for (let i2 = 1;i2 < outputShape[0]; ++i2) {
|
|
6841
6841
|
const c0 = cost[i2 - 1][j2 - 1];
|
|
@@ -6853,14 +6853,14 @@ function dynamic_time_warping(matrix) {
|
|
|
6853
6853
|
t = 2;
|
|
6854
6854
|
}
|
|
6855
6855
|
cost[i2][j2] = matrix[i2 - 1][j2 - 1] + c;
|
|
6856
|
-
|
|
6856
|
+
trace[i2][j2] = t;
|
|
6857
6857
|
}
|
|
6858
6858
|
}
|
|
6859
6859
|
for (let i2 = 0;i2 < outputShape[1]; ++i2) {
|
|
6860
|
-
|
|
6860
|
+
trace[0][i2] = 2;
|
|
6861
6861
|
}
|
|
6862
6862
|
for (let i2 = 0;i2 < outputShape[0]; ++i2) {
|
|
6863
|
-
|
|
6863
|
+
trace[i2][0] = 1;
|
|
6864
6864
|
}
|
|
6865
6865
|
let i = output_length;
|
|
6866
6866
|
let j = input_length;
|
|
@@ -6869,7 +6869,7 @@ function dynamic_time_warping(matrix) {
|
|
|
6869
6869
|
while (i > 0 || j > 0) {
|
|
6870
6870
|
text_indices.push(i - 1);
|
|
6871
6871
|
time_indices.push(j - 1);
|
|
6872
|
-
switch (
|
|
6872
|
+
switch (trace[i][j]) {
|
|
6873
6873
|
case 0:
|
|
6874
6874
|
--i;
|
|
6875
6875
|
--j;
|
|
@@ -9513,7 +9513,7 @@ async function es(a = {}) {
|
|
|
9513
9513
|
};
|
|
9514
9514
|
}, r.ad = (b, E) => {
|
|
9515
9515
|
var I = E.buffer;
|
|
9516
|
-
let
|
|
9516
|
+
let F = E.byteOffset, j = E.byteLength;
|
|
9517
9517
|
if (E = 16 * Math.ceil(Number(j) / 16), b = L(b), !n) {
|
|
9518
9518
|
var te = Dr(o);
|
|
9519
9519
|
n = L(te);
|
|
@@ -13018,9 +13018,9 @@ function reshape(data, dimensions) {
|
|
|
13018
13018
|
}
|
|
13019
13019
|
return reshapedArray[0];
|
|
13020
13020
|
}
|
|
13021
|
-
function permute(
|
|
13022
|
-
const [permutedData, shape] = permute_data(
|
|
13023
|
-
return new Tensor22(
|
|
13021
|
+
function permute(tensor, axes) {
|
|
13022
|
+
const [permutedData, shape] = permute_data(tensor.data, tensor.dims, axes);
|
|
13023
|
+
return new Tensor22(tensor.type, permutedData, shape);
|
|
13024
13024
|
}
|
|
13025
13025
|
function interpolate(input, [out_height, out_width], mode = "bilinear", align_corners = false) {
|
|
13026
13026
|
const in_channels = input.dims.at(-3) ?? 1;
|
|
@@ -13180,8 +13180,8 @@ function cat(tensors, dim = 0) {
|
|
|
13180
13180
|
const resultType = tensors[0].type;
|
|
13181
13181
|
if (dim === 0) {
|
|
13182
13182
|
let offset = 0;
|
|
13183
|
-
for (const
|
|
13184
|
-
const tensorData =
|
|
13183
|
+
for (const tensor of tensors) {
|
|
13184
|
+
const tensorData = tensor.data;
|
|
13185
13185
|
result.set(tensorData, offset);
|
|
13186
13186
|
offset += tensorData.length;
|
|
13187
13187
|
}
|
|
@@ -13304,20 +13304,20 @@ function full(size, fill_value) {
|
|
|
13304
13304
|
}
|
|
13305
13305
|
return fullHelper(size, fill_value, dtype, typedArrayCls);
|
|
13306
13306
|
}
|
|
13307
|
-
function full_like(
|
|
13308
|
-
return full(
|
|
13307
|
+
function full_like(tensor, fill_value) {
|
|
13308
|
+
return full(tensor.dims, fill_value);
|
|
13309
13309
|
}
|
|
13310
13310
|
function ones(size) {
|
|
13311
13311
|
return fullHelper(size, 1n, "int64", BigInt64Array);
|
|
13312
13312
|
}
|
|
13313
|
-
function ones_like(
|
|
13314
|
-
return ones(
|
|
13313
|
+
function ones_like(tensor) {
|
|
13314
|
+
return ones(tensor.dims);
|
|
13315
13315
|
}
|
|
13316
13316
|
function zeros(size) {
|
|
13317
13317
|
return fullHelper(size, 0n, "int64", BigInt64Array);
|
|
13318
13318
|
}
|
|
13319
|
-
function zeros_like(
|
|
13320
|
-
return zeros(
|
|
13319
|
+
function zeros_like(tensor) {
|
|
13320
|
+
return zeros(tensor.dims);
|
|
13321
13321
|
}
|
|
13322
13322
|
function rand(size) {
|
|
13323
13323
|
const length = size.reduce((a, b) => a * b, 1);
|
|
@@ -13327,11 +13327,11 @@ function randn(size) {
|
|
|
13327
13327
|
const length = size.reduce((a, b) => a * b, 1);
|
|
13328
13328
|
return new Tensor22("float32", Float32Array.from({ length }, () => random.gauss()), size);
|
|
13329
13329
|
}
|
|
13330
|
-
function quantize_embeddings(
|
|
13331
|
-
if (
|
|
13330
|
+
function quantize_embeddings(tensor, precision) {
|
|
13331
|
+
if (tensor.dims.length !== 2) {
|
|
13332
13332
|
throw new Error("The tensor must have 2 dimensions");
|
|
13333
13333
|
}
|
|
13334
|
-
if (
|
|
13334
|
+
if (tensor.dims.at(-1) % 8 !== 0) {
|
|
13335
13335
|
throw new Error("The last dimension of the tensor must be a multiple of 8");
|
|
13336
13336
|
}
|
|
13337
13337
|
if (!["binary", "ubinary"].includes(precision)) {
|
|
@@ -13340,7 +13340,7 @@ function quantize_embeddings(tensor2, precision) {
|
|
|
13340
13340
|
const signed = precision === "binary";
|
|
13341
13341
|
const dtype = signed ? "int8" : "uint8";
|
|
13342
13342
|
const cls = signed ? Int8Array : Uint8Array;
|
|
13343
|
-
const inputData =
|
|
13343
|
+
const inputData = tensor.data;
|
|
13344
13344
|
const outputData = new cls(inputData.length / 8);
|
|
13345
13345
|
for (let i = 0;i < inputData.length; ++i) {
|
|
13346
13346
|
const bit = inputData[i] > 0 ? 1 : 0;
|
|
@@ -13351,7 +13351,7 @@ function quantize_embeddings(tensor2, precision) {
|
|
|
13351
13351
|
outputData[arrayIndex] -= 128;
|
|
13352
13352
|
}
|
|
13353
13353
|
}
|
|
13354
|
-
return new Tensor22(dtype, outputData, [
|
|
13354
|
+
return new Tensor22(dtype, outputData, [tensor.dims[0], tensor.dims[1] / 8]);
|
|
13355
13355
|
}
|
|
13356
13356
|
async function get_tokenizer_files(modelId) {
|
|
13357
13357
|
if (!modelId) {
|
|
@@ -13367,16 +13367,16 @@ async function loadTokenizer(pretrained_model_name_or_path, options) {
|
|
|
13367
13367
|
const tokenizerFiles = await get_tokenizer_files(pretrained_model_name_or_path);
|
|
13368
13368
|
return await Promise.all(tokenizerFiles.map((file) => getModelJSON(pretrained_model_name_or_path, file, true, options)));
|
|
13369
13369
|
}
|
|
13370
|
-
function prepareTensorForDecode(
|
|
13371
|
-
const dims =
|
|
13370
|
+
function prepareTensorForDecode(tensor) {
|
|
13371
|
+
const dims = tensor.dims;
|
|
13372
13372
|
switch (dims.length) {
|
|
13373
13373
|
case 1:
|
|
13374
|
-
return
|
|
13374
|
+
return tensor.tolist();
|
|
13375
13375
|
case 2:
|
|
13376
13376
|
if (dims[0] !== 1) {
|
|
13377
13377
|
throw new Error("Unable to decode tensor with `batch size !== 1`. Use `tokenizer.batch_decode(...)` for batched inputs.");
|
|
13378
13378
|
}
|
|
13379
|
-
return
|
|
13379
|
+
return tensor.tolist()[0];
|
|
13380
13380
|
default:
|
|
13381
13381
|
throw new Error(`Expected tensor to have 1-2 dimensions, got ${dims.length}.`);
|
|
13382
13382
|
}
|
|
@@ -15934,26 +15934,26 @@ var RawImage = class _RawImage {
|
|
|
15934
15934
|
return await loadImageFunction(img);
|
|
15935
15935
|
}
|
|
15936
15936
|
}
|
|
15937
|
-
static fromTensor(
|
|
15938
|
-
if (
|
|
15939
|
-
throw new Error(`Tensor should have 3 dimensions, but has ${
|
|
15937
|
+
static fromTensor(tensor, channel_format = "CHW") {
|
|
15938
|
+
if (tensor.dims.length !== 3) {
|
|
15939
|
+
throw new Error(`Tensor should have 3 dimensions, but has ${tensor.dims.length} dimensions.`);
|
|
15940
15940
|
}
|
|
15941
15941
|
if (channel_format === "CHW") {
|
|
15942
|
-
|
|
15942
|
+
tensor = tensor.transpose(1, 2, 0);
|
|
15943
15943
|
} else if (channel_format === "HWC") {} else {
|
|
15944
15944
|
throw new Error(`Unsupported channel format: ${channel_format}`);
|
|
15945
15945
|
}
|
|
15946
|
-
if (!(
|
|
15947
|
-
throw new Error(`Unsupported tensor type: ${
|
|
15946
|
+
if (!(tensor.data instanceof Uint8ClampedArray || tensor.data instanceof Uint8Array)) {
|
|
15947
|
+
throw new Error(`Unsupported tensor type: ${tensor.type}`);
|
|
15948
15948
|
}
|
|
15949
|
-
switch (
|
|
15949
|
+
switch (tensor.dims[2]) {
|
|
15950
15950
|
case 1:
|
|
15951
15951
|
case 2:
|
|
15952
15952
|
case 3:
|
|
15953
15953
|
case 4:
|
|
15954
|
-
return new _RawImage(
|
|
15954
|
+
return new _RawImage(tensor.data, tensor.dims[1], tensor.dims[0], tensor.dims[2]);
|
|
15955
15955
|
default:
|
|
15956
|
-
throw new Error(`Unsupported number of channels: ${
|
|
15956
|
+
throw new Error(`Unsupported number of channels: ${tensor.dims[2]}`);
|
|
15957
15957
|
}
|
|
15958
15958
|
}
|
|
15959
15959
|
grayscale() {
|
|
@@ -16240,13 +16240,13 @@ var RawImage = class _RawImage {
|
|
|
16240
16240
|
return await canvas.convertToBlob({ type, quality });
|
|
16241
16241
|
}
|
|
16242
16242
|
toTensor(channel_format = "CHW") {
|
|
16243
|
-
let
|
|
16243
|
+
let tensor = new Tensor22("uint8", new Uint8Array(this.data), [this.height, this.width, this.channels]);
|
|
16244
16244
|
if (channel_format === "HWC") {} else if (channel_format === "CHW") {
|
|
16245
|
-
|
|
16245
|
+
tensor = tensor.permute(2, 0, 1);
|
|
16246
16246
|
} else {
|
|
16247
16247
|
throw new Error(`Unsupported channel format: ${channel_format}`);
|
|
16248
16248
|
}
|
|
16249
|
-
return
|
|
16249
|
+
return tensor;
|
|
16250
16250
|
}
|
|
16251
16251
|
toCanvas() {
|
|
16252
16252
|
if (!apis.IS_WEB_ENV) {
|
|
@@ -19530,25 +19530,25 @@ async function sessionRun(session, inputs) {
|
|
|
19530
19530
|
const checkedInputs = validateInputs(session, inputs);
|
|
19531
19531
|
try {
|
|
19532
19532
|
const ortFeed = Object.fromEntries(Object.entries(checkedInputs).map(([k2, v]) => {
|
|
19533
|
-
const
|
|
19533
|
+
const tensor = v.ort_tensor;
|
|
19534
19534
|
if (apis.IS_NODE_ENV) {
|
|
19535
|
-
if (typeof Float16Array !== "undefined" &&
|
|
19536
|
-
|
|
19535
|
+
if (typeof Float16Array !== "undefined" && tensor.cpuData instanceof Float16Array) {
|
|
19536
|
+
tensor.cpuData = new Uint16Array(tensor.cpuData.buffer);
|
|
19537
19537
|
}
|
|
19538
19538
|
}
|
|
19539
|
-
return [k2,
|
|
19539
|
+
return [k2, tensor];
|
|
19540
19540
|
}));
|
|
19541
19541
|
const output = await runInferenceSession(session, ortFeed);
|
|
19542
19542
|
return replaceTensors(output);
|
|
19543
19543
|
} catch (e) {
|
|
19544
|
-
const formatted = Object.fromEntries(Object.entries(checkedInputs).map(([k2,
|
|
19544
|
+
const formatted = Object.fromEntries(Object.entries(checkedInputs).map(([k2, tensor]) => {
|
|
19545
19545
|
const unpacked = {
|
|
19546
|
-
type:
|
|
19547
|
-
dims:
|
|
19548
|
-
location:
|
|
19546
|
+
type: tensor.type,
|
|
19547
|
+
dims: tensor.dims,
|
|
19548
|
+
location: tensor.location
|
|
19549
19549
|
};
|
|
19550
19550
|
if (unpacked.location !== "gpu-buffer") {
|
|
19551
|
-
unpacked.data =
|
|
19551
|
+
unpacked.data = tensor.data;
|
|
19552
19552
|
}
|
|
19553
19553
|
return [k2, unpacked];
|
|
19554
19554
|
}));
|
|
@@ -19561,12 +19561,12 @@ function validateInputs(session, inputs) {
|
|
|
19561
19561
|
const checkedInputs = /* @__PURE__ */ Object.create(null);
|
|
19562
19562
|
const missingInputs = [];
|
|
19563
19563
|
for (const inputName of session.inputNames) {
|
|
19564
|
-
const
|
|
19565
|
-
if (!(
|
|
19564
|
+
const tensor = inputs[inputName];
|
|
19565
|
+
if (!(tensor instanceof Tensor22)) {
|
|
19566
19566
|
missingInputs.push(inputName);
|
|
19567
19567
|
continue;
|
|
19568
19568
|
}
|
|
19569
|
-
checkedInputs[inputName] = isONNXProxy() ?
|
|
19569
|
+
checkedInputs[inputName] = isONNXProxy() ? tensor.clone() : tensor;
|
|
19570
19570
|
}
|
|
19571
19571
|
if (missingInputs.length > 0) {
|
|
19572
19572
|
throw new Error(`An error occurred during model execution: "Missing the following inputs: ${missingInputs.join(", ")}.`);
|
|
@@ -20965,9 +20965,9 @@ var PreTrainedModel = class extends Callable {
|
|
|
20965
20965
|
const sequences = new Tensor22("int64", all_input_ids.flat(), [all_input_ids.length, all_input_ids[0].length]);
|
|
20966
20966
|
const past_key_values = getPastKeyValues(outputs, model_inputs.past_key_values);
|
|
20967
20967
|
const cachedTensors = new Set(Object.values(past_key_values));
|
|
20968
|
-
for (const
|
|
20969
|
-
if (
|
|
20970
|
-
|
|
20968
|
+
for (const tensor of Object.values(outputs)) {
|
|
20969
|
+
if (tensor.location === "gpu-buffer" && !cachedTensors.has(tensor)) {
|
|
20970
|
+
tensor.dispose();
|
|
20971
20971
|
}
|
|
20972
20972
|
}
|
|
20973
20973
|
const keepCacheAlive = "past_key_values" in kwargs || generation_config.return_dict_in_generate;
|
|
@@ -23824,8 +23824,8 @@ var MultiModalityCausalLM = class extends MultiModalityPreTrainedModel {
|
|
|
23824
23824
|
});
|
|
23825
23825
|
const clamped = decoded_image.add_(1).mul_(255 / 2).clamp_(0, 255).to("uint8");
|
|
23826
23826
|
const images = [];
|
|
23827
|
-
for (const
|
|
23828
|
-
const img = RawImage.fromTensor(
|
|
23827
|
+
for (const tensor of clamped) {
|
|
23828
|
+
const img = RawImage.fromTensor(tensor);
|
|
23829
23829
|
images.push(img);
|
|
23830
23830
|
}
|
|
23831
23831
|
return images;
|
package/package.json
CHANGED
package/src/config/index.test.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
|
|
6
|
+
import { buildOpenCodeConfigWarningBanner } from "../shared/config-warning-surface";
|
|
6
7
|
import { resolveHistorianModel } from "../shared/model-resolution";
|
|
7
8
|
import { createTestTempDir } from "../shared/test-temp-dir";
|
|
8
9
|
import {
|
|
@@ -192,6 +193,49 @@ describe("loadPluginConfig — preload user-config isolation", () => {
|
|
|
192
193
|
});
|
|
193
194
|
});
|
|
194
195
|
|
|
196
|
+
describe("loadPluginConfig — parse failure diagnostics", () => {
|
|
197
|
+
it("recovers the reporter's stray leading character and keeps a loud location warning", () => {
|
|
198
|
+
const result = loadWithUserConfig('\\{\n "cache_ttl": "1h"\n}');
|
|
199
|
+
|
|
200
|
+
expect(result.cache_ttl).toBe("1h");
|
|
201
|
+
expect(result.configParseFailures).toHaveLength(1);
|
|
202
|
+
expect(result.configParseFailures?.[0]).toMatchObject({
|
|
203
|
+
warningClass: "file-parse",
|
|
204
|
+
line: 1,
|
|
205
|
+
column: 1,
|
|
206
|
+
recovered: true,
|
|
207
|
+
message: "invalid symbol",
|
|
208
|
+
});
|
|
209
|
+
expect(result.configWarnings?.[0]).toContain(":1:1: invalid symbol");
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it("keeps file parse and invalid-leaf warning classes distinct", () => {
|
|
213
|
+
const parseResult = loadWithUserConfig('\\{\n "cache_ttl": "1h"\n}');
|
|
214
|
+
const leafResult = loadWithUserConfig('{"protected_tags":"bogus"}');
|
|
215
|
+
|
|
216
|
+
expect(parseResult.configWarningDetails?.[0]?.warningClass).toBe("file-parse");
|
|
217
|
+
expect(
|
|
218
|
+
leafResult.configWarningDetails?.some(
|
|
219
|
+
(detail) => detail.warningClass === "invalid-leaf",
|
|
220
|
+
),
|
|
221
|
+
).toBe(true);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it("puts a recovered parse failure first in the OpenCode warning banner", () => {
|
|
225
|
+
const result = loadWithUserConfig('\\{\n "cache_ttl": "1h"\n}');
|
|
226
|
+
const failures = result.configParseFailures ?? [];
|
|
227
|
+
const banner = buildOpenCodeConfigWarningBanner(
|
|
228
|
+
result.configWarnings ?? [],
|
|
229
|
+
failures,
|
|
230
|
+
failures,
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
expect(banner).toStartWith("## ⚠️ Magic Context Config Warning");
|
|
234
|
+
expect(banner.indexOf("PARSE FAILED")).toBeLessThan(banner.indexOf("Fix the reported"));
|
|
235
|
+
expect(banner).toContain(":1:1");
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
|
|
195
239
|
describe("loadPluginConfig — graduated mural config", () => {
|
|
196
240
|
it("adopts legacy experimental.mural at the top-level and warns once", () => {
|
|
197
241
|
const result = loadWithUserConfig(
|
|
@@ -1509,3 +1553,31 @@ describe("loadPluginConfigDetailed — prompt-surface registration owner", () =>
|
|
|
1509
1553
|
}
|
|
1510
1554
|
});
|
|
1511
1555
|
});
|
|
1556
|
+
|
|
1557
|
+
describe("shared per-harness config loading", () => {
|
|
1558
|
+
it("lets OpenCode load Pi and OMP agent blocks without schema recovery warnings", () => {
|
|
1559
|
+
const config = loadWithUserConfig(
|
|
1560
|
+
JSON.stringify({
|
|
1561
|
+
historian: {
|
|
1562
|
+
opencode: { model: "anthropic/opencode-historian" },
|
|
1563
|
+
pi: { model: "anthropic/pi-historian", thinking_level: "high" },
|
|
1564
|
+
omp: { model: "anthropic/omp-historian", thinking_level: "auto" },
|
|
1565
|
+
},
|
|
1566
|
+
dreamer: {
|
|
1567
|
+
opencode: { model: "anthropic/opencode-dreamer" },
|
|
1568
|
+
pi: { model: "anthropic/pi-dreamer", thinking_level: "medium" },
|
|
1569
|
+
omp: { model: "anthropic/omp-dreamer", thinking_level: "inherit" },
|
|
1570
|
+
},
|
|
1571
|
+
}),
|
|
1572
|
+
);
|
|
1573
|
+
|
|
1574
|
+
expect(config.configWarnings).toBeUndefined();
|
|
1575
|
+
expect(config.historian?.omp).toEqual({
|
|
1576
|
+
model: "anthropic/omp-historian",
|
|
1577
|
+
thinking_level: "auto",
|
|
1578
|
+
});
|
|
1579
|
+
expect(resolveHistorianModel(config, "opencode").primary?.model).toBe(
|
|
1580
|
+
"anthropic/opencode-historian",
|
|
1581
|
+
);
|
|
1582
|
+
});
|
|
1583
|
+
});
|
package/src/config/index.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
CONFIG_WARNING_CLASS,
|
|
5
|
+
type ConfigParseFailure,
|
|
6
|
+
type ConfigWarningDetail,
|
|
7
|
+
} from "../shared/config-diagnostics";
|
|
8
|
+
import {
|
|
9
|
+
detectConfigFile,
|
|
10
|
+
isPrototypePollutionKey,
|
|
11
|
+
parseJsoncRecovering,
|
|
12
|
+
} from "../shared/jsonc-parser";
|
|
4
13
|
import { setOutputReserveConfig } from "../shared/models-dev-cache";
|
|
5
14
|
import type { PromptSurfaceConfig } from "../shared/prompt-surface";
|
|
6
15
|
import { setWindowOverlayPath } from "../shared/window-geometry";
|
|
@@ -28,6 +37,11 @@ import { substituteConfigVariables } from "./variable";
|
|
|
28
37
|
|
|
29
38
|
export interface MagicContextPluginConfig extends MagicContextConfig {
|
|
30
39
|
disabled_hooks?: string[];
|
|
40
|
+
/** Runtime-only diagnostics; never read from user config. */
|
|
41
|
+
configParseFailures?: ConfigParseFailure[];
|
|
42
|
+
configWarningDetails?: ConfigWarningDetail[];
|
|
43
|
+
/** Whether cache_ttl existed in resolved raw config rather than coming from Zod defaults. */
|
|
44
|
+
cacheTtlConfigured?: boolean;
|
|
31
45
|
command?: Record<
|
|
32
46
|
string,
|
|
33
47
|
{
|
|
@@ -74,6 +88,8 @@ interface LoadedConfigFile {
|
|
|
74
88
|
config: Record<string, unknown>;
|
|
75
89
|
/** Warnings from {env:} / {file:} substitution, with config-path prefix applied. */
|
|
76
90
|
warnings: string[];
|
|
91
|
+
parseFailures: ConfigParseFailure[];
|
|
92
|
+
warningDetails: ConfigWarningDetail[];
|
|
77
93
|
}
|
|
78
94
|
|
|
79
95
|
export type LoadOutcome =
|
|
@@ -95,6 +111,9 @@ export interface LoadResultDetailed {
|
|
|
95
111
|
};
|
|
96
112
|
substitutionFailures: Array<{ keyPath: string; source: "user" | "project"; message: string }>;
|
|
97
113
|
recoveredTopLevelKeys: string[];
|
|
114
|
+
configParseFailures: ConfigParseFailure[];
|
|
115
|
+
warningDetails: ConfigWarningDetail[];
|
|
116
|
+
cacheTtlConfigured: boolean;
|
|
98
117
|
}
|
|
99
118
|
|
|
100
119
|
interface LoadedConfigFileDetailed extends LoadedConfigFile {
|
|
@@ -118,10 +137,13 @@ function loadConfigFileDetailed(
|
|
|
118
137
|
rawText = raw.text;
|
|
119
138
|
rawWarnings = raw.warnings;
|
|
120
139
|
} catch (error) {
|
|
140
|
+
const message = `failed to read config: ${error instanceof Error ? error.message : String(error)}`;
|
|
121
141
|
return {
|
|
122
142
|
config: {},
|
|
123
|
-
warnings: [
|
|
124
|
-
|
|
143
|
+
warnings: [`${configPath}: ${message}`],
|
|
144
|
+
parseFailures: [],
|
|
145
|
+
warningDetails: [
|
|
146
|
+
{ warningClass: CONFIG_WARNING_CLASS.FILE_IO, source, path: configPath, message },
|
|
125
147
|
],
|
|
126
148
|
outcome: "project-file-io-error",
|
|
127
149
|
source,
|
|
@@ -135,32 +157,71 @@ function loadConfigFileDetailed(
|
|
|
135
157
|
isProjectConfig: source === "project",
|
|
136
158
|
});
|
|
137
159
|
const rejectedKeyPaths: string[] = [];
|
|
138
|
-
const
|
|
160
|
+
const parsed = parseJsoncRecovering<Record<string, unknown>>(substituted.text, {
|
|
139
161
|
onRejectedKey: (path) => rejectedKeyPaths.push(path.join(".")),
|
|
140
162
|
});
|
|
163
|
+
const config =
|
|
164
|
+
parsed.value && typeof parsed.value === "object" && !Array.isArray(parsed.value)
|
|
165
|
+
? parsed.value
|
|
166
|
+
: {};
|
|
141
167
|
const unsafeKeyWarnings = rejectedKeyPaths.map(
|
|
142
168
|
(path) =>
|
|
143
169
|
`Ignored unsafe config key "${path}" (security: prototype-pollution keys are not allowed).`,
|
|
144
170
|
);
|
|
171
|
+
const firstIssue = parsed.issues[0];
|
|
172
|
+
const recovered = firstIssue !== undefined && Object.keys(config).length > 0;
|
|
173
|
+
const parseFailures: ConfigParseFailure[] = firstIssue
|
|
174
|
+
? [
|
|
175
|
+
{
|
|
176
|
+
warningClass: CONFIG_WARNING_CLASS.FILE_PARSE,
|
|
177
|
+
source,
|
|
178
|
+
path: configPath,
|
|
179
|
+
line: firstIssue.line,
|
|
180
|
+
column: firstIssue.column,
|
|
181
|
+
message: firstIssue.message,
|
|
182
|
+
recovered,
|
|
183
|
+
warning: `${configPath}:${firstIssue.line}:${firstIssue.column}: ${firstIssue.message}; ${recovered ? "recovered values were applied, but the file must be fixed." : "using defaults for this file."}`,
|
|
184
|
+
},
|
|
185
|
+
]
|
|
186
|
+
: [];
|
|
145
187
|
return {
|
|
146
188
|
config,
|
|
147
|
-
warnings: [
|
|
148
|
-
(
|
|
149
|
-
|
|
189
|
+
warnings: [
|
|
190
|
+
...parseFailures.map((failure) => failure.warning),
|
|
191
|
+
...rawWarnings.map((warning) => `${configPath}: ${warning}`),
|
|
192
|
+
...substituted.warnings.map((warning) => `${configPath}: ${warning}`),
|
|
193
|
+
...unsafeKeyWarnings.map((warning) => `${configPath}: ${warning}`),
|
|
194
|
+
],
|
|
195
|
+
parseFailures,
|
|
196
|
+
warningDetails: parseFailures,
|
|
150
197
|
outcome:
|
|
151
|
-
|
|
152
|
-
? "
|
|
153
|
-
:
|
|
154
|
-
? "
|
|
155
|
-
:
|
|
198
|
+
parseFailures.length > 0
|
|
199
|
+
? "project-file-parse-error"
|
|
200
|
+
: rejectedKeyPaths.length > 0
|
|
201
|
+
? "schema-recovery"
|
|
202
|
+
: substituted.warnings.length > 0
|
|
203
|
+
? "substitution-failure"
|
|
204
|
+
: "ok",
|
|
156
205
|
source,
|
|
157
206
|
};
|
|
158
207
|
} catch (error) {
|
|
208
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
209
|
+
const warning = `${configPath}:1:1: ${message}; using defaults for this file.`;
|
|
210
|
+
const failure: ConfigParseFailure = {
|
|
211
|
+
warningClass: CONFIG_WARNING_CLASS.FILE_PARSE,
|
|
212
|
+
source,
|
|
213
|
+
path: configPath,
|
|
214
|
+
line: 1,
|
|
215
|
+
column: 1,
|
|
216
|
+
message,
|
|
217
|
+
recovered: false,
|
|
218
|
+
warning,
|
|
219
|
+
};
|
|
159
220
|
return {
|
|
160
221
|
config: {},
|
|
161
|
-
warnings: [
|
|
162
|
-
|
|
163
|
-
],
|
|
222
|
+
warnings: [warning],
|
|
223
|
+
parseFailures: [failure],
|
|
224
|
+
warningDetails: [failure],
|
|
164
225
|
outcome: "project-file-parse-error",
|
|
165
226
|
source,
|
|
166
227
|
};
|
|
@@ -621,10 +682,12 @@ export function loadPluginConfigDetailed(directory: string): LoadResultDetailed
|
|
|
621
682
|
}
|
|
622
683
|
|
|
623
684
|
const recoveredTopLevelKeys: string[] = [];
|
|
685
|
+
const cacheTtlConfigured = Object.hasOwn(mergedRaw, "cache_ttl");
|
|
624
686
|
const config = parsePluginConfig(mergedRaw, recoveredTopLevelKeys);
|
|
625
687
|
if (profileResolution.activeProfile) config.profile = profileResolution.activeProfile;
|
|
626
688
|
setOutputReserveConfig(config.output_reserve);
|
|
627
689
|
setWindowOverlayPath(config.models?.window_overlay_path);
|
|
690
|
+
const leafValidationWarnings = [...(config.configWarnings ?? [])];
|
|
628
691
|
if (config.configWarnings?.length) {
|
|
629
692
|
allWarnings.push(
|
|
630
693
|
...config.configWarnings.map((w) => {
|
|
@@ -653,6 +716,21 @@ export function loadPluginConfigDetailed(directory: string): LoadResultDetailed
|
|
|
653
716
|
...bindSubstitutionFailures(userLoaded),
|
|
654
717
|
...bindSubstitutionFailures(projectLoaded),
|
|
655
718
|
];
|
|
719
|
+
const configParseFailures = [
|
|
720
|
+
...(userLoaded?.parseFailures ?? []),
|
|
721
|
+
...(projectLoaded?.parseFailures ?? []),
|
|
722
|
+
];
|
|
723
|
+
const warningDetails: ConfigWarningDetail[] = [
|
|
724
|
+
...(userLoaded?.warningDetails ?? []),
|
|
725
|
+
...(projectLoaded?.warningDetails ?? []),
|
|
726
|
+
...leafValidationWarnings.map((message) => ({
|
|
727
|
+
warningClass: CONFIG_WARNING_CLASS.INVALID_LEAF,
|
|
728
|
+
message,
|
|
729
|
+
})),
|
|
730
|
+
];
|
|
731
|
+
config.configParseFailures = configParseFailures;
|
|
732
|
+
config.configWarningDetails = warningDetails;
|
|
733
|
+
config.cacheTtlConfigured = cacheTtlConfigured;
|
|
656
734
|
const sources = {
|
|
657
735
|
userConfig:
|
|
658
736
|
userLoaded?.outcome ??
|
|
@@ -669,5 +747,8 @@ export function loadPluginConfigDetailed(directory: string): LoadResultDetailed
|
|
|
669
747
|
sources,
|
|
670
748
|
substitutionFailures,
|
|
671
749
|
recoveredTopLevelKeys,
|
|
750
|
+
configParseFailures,
|
|
751
|
+
warningDetails,
|
|
752
|
+
cacheTtlConfigured,
|
|
672
753
|
};
|
|
673
754
|
}
|