@kontextmind/kxm 0.7.150 → 0.7.152
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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +14 -0
- package/docs/architecture/agent-path.md +5 -0
- package/docs/operations/troubleshooting.md +1 -0
- package/docs/reference/cli-reference.md +4 -4
- package/docs/reference/config-reference.md +17 -4
- package/docs/reference/harness-routing.md +7 -1
- package/package.json +1 -1
- package/plugins/kxm/.claude-plugin/plugin.json +1 -1
- package/plugins/kxm/dist/cli.js +153 -60
- package/plugins/kxm/dist/core.js +22 -3
- package/plugins/kxm/dist/mcp-server.js +1 -1
- package/plugins/kxm/dist/runtime-supervisor.js +676 -130
- package/plugins/kxm/dist/runtime.js +720 -164
- package/plugins/kxm/dist/server.js +1 -1
- package/plugins/kxm/package.json +1 -1
- package/plugins/kxm/src/cli/system.ts +4 -1
- package/plugins/kxm/src/engine-fold.ts +1 -0
- package/plugins/kxm/src/engine.ts +264 -22
- package/plugins/kxm/src/improve-sources.ts +17 -3
- package/plugins/kxm/src/improve.ts +14 -0
- package/plugins/kxm/src/mcp-server.ts +1 -1
- package/plugins/kxm/src/policy-draft.mjs +2 -2
- package/plugins/kxm/src/role.ts +1 -1
- package/plugins/kxm/src/route-fallback.ts +504 -0
- package/plugins/kxm/src/route-switch.ts +49 -0
- package/plugins/kxm/src/routing.ts +24 -1
- package/schemas/common.schema.json +2 -1
- package/schemas/role.schema.json +1 -1
- package/schemas/run-event.schema.json +20 -1
- package/scripts/ci-unit-shard.mjs +29 -13
|
@@ -32,11 +32,31 @@ function escapeRegExp(value) {
|
|
|
32
32
|
return value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
// Node's glob returns backslashes on Windows. Lane membership compares posix paths.
|
|
36
|
+
export function toPosixPath(file) {
|
|
37
|
+
return file.replaceAll("\\", "/");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function normalizeUnitFiles(files) {
|
|
41
|
+
return files.map((file) => toPosixPath(file)).sort();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function planUnitFiles(files) {
|
|
45
|
+
const normalized = normalizeUnitFiles(files);
|
|
46
|
+
if (!normalized.includes(ENGINE_FILE)) throw new Error(`${ENGINE_FILE} is missing`);
|
|
47
|
+
for (const file of SERIAL_FILES) {
|
|
48
|
+
if (!normalized.includes(file)) throw new Error(`${file} is missing`);
|
|
49
|
+
}
|
|
50
|
+
const reserved = new Set([ENGINE_FILE, ...SERIAL_FILES]);
|
|
51
|
+
const light = normalized.filter((file) => !reserved.has(file));
|
|
52
|
+
return { files: normalized, serial: [...SERIAL_FILES], light };
|
|
53
|
+
}
|
|
54
|
+
|
|
35
55
|
export function listUnitFiles(root) {
|
|
36
|
-
return [
|
|
56
|
+
return normalizeUnitFiles([
|
|
37
57
|
...globSync("test/core/*.test.ts", { cwd: root }),
|
|
38
58
|
...globSync("packages/core/*/tests/unit/*.test.ts", { cwd: root }),
|
|
39
|
-
]
|
|
59
|
+
]);
|
|
40
60
|
}
|
|
41
61
|
|
|
42
62
|
export function extractTestPatterns(source) {
|
|
@@ -96,19 +116,13 @@ export function planEngineShard(root, index, total = SHARD_TOTAL) {
|
|
|
96
116
|
}
|
|
97
117
|
|
|
98
118
|
export function planSerial(root) {
|
|
99
|
-
|
|
100
|
-
if (!files.includes(ENGINE_FILE)) throw new Error(`${ENGINE_FILE} is missing`);
|
|
101
|
-
for (const file of SERIAL_FILES) {
|
|
102
|
-
if (!files.includes(file)) throw new Error(`${file} is missing`);
|
|
103
|
-
}
|
|
104
|
-
return [...SERIAL_FILES];
|
|
119
|
+
return planUnitFiles(listUnitFiles(root)).serial;
|
|
105
120
|
}
|
|
106
121
|
|
|
107
122
|
export function planLight(root) {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return files;
|
|
123
|
+
const { light } = planUnitFiles(listUnitFiles(root));
|
|
124
|
+
if (light.length === 0) throw new Error("light lane has no unit files");
|
|
125
|
+
return light;
|
|
112
126
|
}
|
|
113
127
|
|
|
114
128
|
export function coverageOfShards(root, total = SHARD_TOTAL) {
|
|
@@ -117,7 +131,9 @@ export function coverageOfShards(root, total = SHARD_TOTAL) {
|
|
|
117
131
|
const plan = planEngineShard(root, index, total);
|
|
118
132
|
for (const pattern of plan.patterns) heavy.set(pattern.source, (heavy.get(pattern.source) ?? 0) + 1);
|
|
119
133
|
}
|
|
120
|
-
|
|
134
|
+
const lanes = planUnitFiles(listUnitFiles(root));
|
|
135
|
+
if (lanes.light.length === 0) throw new Error("light lane has no unit files");
|
|
136
|
+
return { files: lanes.files, serial: lanes.serial, light: lanes.light, heavy };
|
|
121
137
|
}
|
|
122
138
|
|
|
123
139
|
function runNode(args, label, children) {
|