@christang/keel 5.91.0 → 5.92.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/README.md +43 -0
- package/README.zh-CN.md +38 -0
- package/assets/bootstrap/AGENTS.md +1 -1
- package/bin/keel.js +5 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/scripts/validate_plugin.py +452 -2
- package/src/core/agents.js +606 -0
- package/src/core/config.js +78 -0
package/src/core/config.js
CHANGED
|
@@ -97,6 +97,7 @@ const CONFIG_DECLARATIONS = [
|
|
|
97
97
|
"full_mode_paths",
|
|
98
98
|
"executor_tier",
|
|
99
99
|
"merge",
|
|
100
|
+
"external_agents",
|
|
100
101
|
];
|
|
101
102
|
|
|
102
103
|
const CONFIG_RELATIVE_PATH = path.join("keel", "config.yaml");
|
|
@@ -434,6 +435,82 @@ function readDelegationPolicy(repo) {
|
|
|
434
435
|
return { declared: true, tier, unknown: [], accepted };
|
|
435
436
|
}
|
|
436
437
|
|
|
438
|
+
// `external_agents:` — which external model CLIs this project allows, and the
|
|
439
|
+
// paths that must not be handed to one (#219). Absent allows nothing: every
|
|
440
|
+
// other declaration here authorizes nothing when absent, and sending the
|
|
441
|
+
// repository to another provider is the decision a project makes once,
|
|
442
|
+
// explicitly. The block is two sub-keys, so it is read with configBlockLines
|
|
443
|
+
// and classified here rather than loosening the flat readers.
|
|
444
|
+
//
|
|
445
|
+
// An `egress_deny` entry carries its reason, the same shape as
|
|
446
|
+
// `full_mode_paths`. An entry Keel cannot read is reported by name and the
|
|
447
|
+
// caller refuses every brief until it is corrected: a deny list that silently
|
|
448
|
+
// dropped an entry would send exactly what it was written to keep.
|
|
449
|
+
const EXTERNAL_AGENT_KEYS = ["allow", "egress_deny"];
|
|
450
|
+
|
|
451
|
+
function readExternalAgents(repo) {
|
|
452
|
+
const result = { declared: false, allow: [], egressDeny: [], problems: [], unreadable: [] };
|
|
453
|
+
const block = configBlockLines(repo, "external_agents");
|
|
454
|
+
if (block === null) return result;
|
|
455
|
+
result.declared = true;
|
|
456
|
+
if (block.inline !== null) {
|
|
457
|
+
result.problems.push(
|
|
458
|
+
`keel/config.yaml declares external_agents: inline (${block.inline}); write allow: and egress_deny: on their own lines.`
|
|
459
|
+
);
|
|
460
|
+
result.unreadable.push(block.inline);
|
|
461
|
+
return result;
|
|
462
|
+
}
|
|
463
|
+
let key = null;
|
|
464
|
+
for (const line of block.lines) {
|
|
465
|
+
const sub = line.match(/^ {1,3}(\w+)\s*:\s*(.*?)\s*$/);
|
|
466
|
+
if (sub) {
|
|
467
|
+
key = sub[1];
|
|
468
|
+
if (!EXTERNAL_AGENT_KEYS.includes(key)) {
|
|
469
|
+
result.problems.push(
|
|
470
|
+
`keel/config.yaml external_agents: declares ${key}, which Keel does not read; accepted: ${EXTERNAL_AGENT_KEYS.join(", ")}.`
|
|
471
|
+
);
|
|
472
|
+
result.unreadable.push(key);
|
|
473
|
+
key = null;
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
// `allow: [codex, dsh]` is the one flow form read, because a one-line
|
|
477
|
+
// allowance is the common declaration.
|
|
478
|
+
const flow = sub[2].match(/^\[(.*)\]$/);
|
|
479
|
+
if (key === "allow" && flow) {
|
|
480
|
+
result.allow.push(...flow[1].split(",").map((item) => item.trim()).filter(Boolean));
|
|
481
|
+
} else if (sub[2] !== "") {
|
|
482
|
+
result.problems.push(`keel/config.yaml external_agents: ${key}: holds ${sub[2]}; write its entries as a list.`);
|
|
483
|
+
result.unreadable.push(`${key}: ${sub[2]}`);
|
|
484
|
+
}
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
const item = line.match(/^\s+-\s*(.*?)\s*$/);
|
|
488
|
+
if (!item || key === null) {
|
|
489
|
+
result.problems.push(`keel/config.yaml external_agents: line Keel could not read: ${line.trim()}`);
|
|
490
|
+
result.unreadable.push(line.trim());
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
if (key === "allow") {
|
|
494
|
+
if (/^[A-Za-z0-9._-]+$/.test(item[1])) result.allow.push(item[1]);
|
|
495
|
+
else {
|
|
496
|
+
result.problems.push(`keel/config.yaml external_agents: allow entry ${item[1]} is not an agent name.`);
|
|
497
|
+
result.unreadable.push(item[1]);
|
|
498
|
+
}
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
const entry = item[1].match(/^(\S+?)\s*:\s+(\S.*)$/);
|
|
502
|
+
if (!entry) {
|
|
503
|
+
result.problems.push(
|
|
504
|
+
`keel/config.yaml external_agents: egress_deny entry ${item[1]} has no reason; write it as \`- <glob>: <reason>\`. Every brief is refused until it is corrected, because a deny list that dropped an entry would send what it was written to keep.`
|
|
505
|
+
);
|
|
506
|
+
result.unreadable.push(item[1]);
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
509
|
+
result.egressDeny.push({ pattern: entry[1], reason: entry[2] });
|
|
510
|
+
}
|
|
511
|
+
return result;
|
|
512
|
+
}
|
|
513
|
+
|
|
437
514
|
// Which guidance an executor loads, declared by the repository rather than
|
|
438
515
|
// judged by the executor. #135's argument is that "do I need this help?" is the
|
|
439
516
|
// judgement a weak executor gets most wrong, so the skip is written down; the
|
|
@@ -664,6 +741,7 @@ function triageIssue(repo, labels, issue = null) {
|
|
|
664
741
|
}
|
|
665
742
|
|
|
666
743
|
module.exports = {
|
|
744
|
+
readExternalAgents,
|
|
667
745
|
CONFIG_RELATIVE_PATH,
|
|
668
746
|
DELEGATION_TIERS,
|
|
669
747
|
EXECUTOR_TIERS,
|