kairn-cli 2.7.0 → 2.7.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.
- package/dist/cli.js +37 -5
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1831,6 +1831,16 @@ async function parseAgents(harnessPath) {
|
|
|
1831
1831
|
if (Array.isArray(disallowedTools)) {
|
|
1832
1832
|
node.disallowedTools = disallowedTools;
|
|
1833
1833
|
}
|
|
1834
|
+
const knownKeys = /* @__PURE__ */ new Set(["name", "model", "disallowedTools"]);
|
|
1835
|
+
const extra = {};
|
|
1836
|
+
for (const [key, value] of Object.entries(frontmatter)) {
|
|
1837
|
+
if (!knownKeys.has(key)) {
|
|
1838
|
+
extra[key] = value;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
if (Object.keys(extra).length > 0) {
|
|
1842
|
+
node.extraFrontmatter = extra;
|
|
1843
|
+
}
|
|
1834
1844
|
nodes.push(node);
|
|
1835
1845
|
}
|
|
1836
1846
|
return nodes;
|
|
@@ -1847,8 +1857,10 @@ async function parseSkills(harnessPath) {
|
|
|
1847
1857
|
const name = entry.replace(/\.md$/, "");
|
|
1848
1858
|
nodes.push({ name, content });
|
|
1849
1859
|
} else if (await isDirectory(entryPath)) {
|
|
1850
|
-
|
|
1851
|
-
|
|
1860
|
+
let content = await readFileSafe2(path21.join(entryPath, "skill.md"));
|
|
1861
|
+
if (content === null) {
|
|
1862
|
+
content = await readFileSafe2(path21.join(entryPath, "SKILL.md"));
|
|
1863
|
+
}
|
|
1852
1864
|
if (content === null) continue;
|
|
1853
1865
|
nodes.push({ name: entry, content });
|
|
1854
1866
|
}
|
|
@@ -2445,7 +2457,8 @@ function renderRuleWithFrontmatter(rule) {
|
|
|
2445
2457
|
function renderAgentWithFrontmatter(agent) {
|
|
2446
2458
|
const hasModel = agent.model !== void 0;
|
|
2447
2459
|
const hasDisallowed = agent.disallowedTools !== void 0 && agent.disallowedTools.length > 0;
|
|
2448
|
-
|
|
2460
|
+
const hasExtra = agent.extraFrontmatter !== void 0 && Object.keys(agent.extraFrontmatter).length > 0;
|
|
2461
|
+
if (!hasModel && !hasDisallowed && !hasExtra) {
|
|
2449
2462
|
return agent.content;
|
|
2450
2463
|
}
|
|
2451
2464
|
const yamlLines = ["---"];
|
|
@@ -2458,6 +2471,23 @@ function renderAgentWithFrontmatter(agent) {
|
|
|
2458
2471
|
yamlLines.push(` - ${tool}`);
|
|
2459
2472
|
}
|
|
2460
2473
|
}
|
|
2474
|
+
if (hasExtra) {
|
|
2475
|
+
for (const [key, value] of Object.entries(agent.extraFrontmatter)) {
|
|
2476
|
+
if (Array.isArray(value)) {
|
|
2477
|
+
yamlLines.push(`${key}:`);
|
|
2478
|
+
for (const item of value) {
|
|
2479
|
+
yamlLines.push(` - ${String(item)}`);
|
|
2480
|
+
}
|
|
2481
|
+
} else if (typeof value === "object" && value !== null) {
|
|
2482
|
+
yamlLines.push(`${key}:`);
|
|
2483
|
+
for (const [subKey, subVal] of Object.entries(value)) {
|
|
2484
|
+
yamlLines.push(` ${subKey}: ${String(subVal)}`);
|
|
2485
|
+
}
|
|
2486
|
+
} else {
|
|
2487
|
+
yamlLines.push(`${key}: ${String(value)}`);
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2461
2491
|
yamlLines.push("---");
|
|
2462
2492
|
return yamlLines.join("\n") + "\n\n" + agent.content;
|
|
2463
2493
|
}
|
|
@@ -3344,7 +3374,7 @@ async function evolve(workspacePath, tasks, kairnConfig, evolveConfig, onProgres
|
|
|
3344
3374
|
}
|
|
3345
3375
|
}
|
|
3346
3376
|
}
|
|
3347
|
-
let rngState = 42;
|
|
3377
|
+
let rngState = evolveConfig.rngSeed ?? 42;
|
|
3348
3378
|
const rng = () => {
|
|
3349
3379
|
rngState = rngState * 1664525 + 1013904223 & 4294967295;
|
|
3350
3380
|
return (rngState >>> 0) / 4294967296;
|
|
@@ -3981,7 +4011,9 @@ async function runPopulation(workspacePath, tasks, kairnConfig, evolveConfig, nu
|
|
|
3981
4011
|
const branchEvolveConfig = {
|
|
3982
4012
|
...evolveConfig,
|
|
3983
4013
|
// Disable principal for individual branches — synthesis replaces it
|
|
3984
|
-
usePrincipal: false
|
|
4014
|
+
usePrincipal: false,
|
|
4015
|
+
// Each branch gets its own RNG seed for Thompson Sampling diversity
|
|
4016
|
+
rngSeed: branchConfig.seed
|
|
3985
4017
|
};
|
|
3986
4018
|
const branchProgress = onProgress ? (event) => {
|
|
3987
4019
|
onProgress({ ...event, branchId: branchConfig.branchId });
|