@christang/keel 5.122.0 → 5.123.0
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 +4 -0
- package/assets/bootstrap/AGENTS.md +1 -1
- 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 +50 -2
- package/src/core/patrol.js +31 -2
package/README.md
CHANGED
|
@@ -801,6 +801,10 @@ coordinator gets one direct message from `keel-patrol`, which wakes its session,
|
|
|
801
801
|
`--disk-free-gb` dropping below `--disk-min-gb` (default 20), and a role that left two nudges in a row
|
|
802
802
|
unanswered. Shift-status changes and new commits are printed, not sent. Every run appends one line to
|
|
803
803
|
`patrol/log/<role>.log` in the chat store, so a silent run can still be audited.
|
|
804
|
+
The host can also pass the weekly quota's percent used with `--quota <percent>`: each threshold in
|
|
805
|
+
`--quota-alerts` (default `90,95,99`) becomes a risk once per quota period, a drop in the figure starts
|
|
806
|
+
a new period, and at `--quota-quiet-at` (default 90) or above, `--nudge` sends nothing, since every
|
|
807
|
+
nudge wakes a large session.
|
|
804
808
|
|
|
805
809
|
`keel patrol --nudge` goes further and nudges each idle role itself, with one direct message from
|
|
806
810
|
`keel-patrol` that wakes its session (#307): when records addressed to it have waited longer than
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.123.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.
|
|
9
|
+
"version": "5.123.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.123.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.123.0",
|
|
4
4
|
"description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TanglmChris",
|
|
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
|
|
|
47
47
|
"scripts/validate_plugin.py",
|
|
48
48
|
]
|
|
49
49
|
|
|
50
|
-
PACKAGE_VERSION = "5.
|
|
51
|
-
PROTOCOL_VERSION = "5.
|
|
50
|
+
PACKAGE_VERSION = "5.123.0"
|
|
51
|
+
PROTOCOL_VERSION = "5.123.0"
|
|
52
52
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
53
53
|
OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
|
|
54
54
|
# Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
|
|
@@ -2973,6 +2973,53 @@ def validate_patrol_escalate_scenario() -> int:
|
|
|
2973
2973
|
return 0
|
|
2974
2974
|
|
|
2975
2975
|
|
|
2976
|
+
def validate_patrol_quota_scenario() -> int:
|
|
2977
|
+
"""Issue #307 part 2: quota thresholds once per period; nudges pause near the limit."""
|
|
2978
|
+
label = "patrol-quota:"
|
|
2979
|
+
with tempfile.TemporaryDirectory(prefix="keel-patrol-quota-") as raw:
|
|
2980
|
+
base = Path(raw)
|
|
2981
|
+
rtl, verify, env, _ = shift_scratch(base)
|
|
2982
|
+
env = {**env, "KEEL_PATROL_UNREAD_EVERY_MS": "1"}
|
|
2983
|
+
run_keel(rtl, "chat", "post", "soc", "@verify rerun R007 please", env=env)
|
|
2984
|
+
time.sleep(1.2)
|
|
2985
|
+
|
|
2986
|
+
def patrol(quota: str) -> subprocess.CompletedProcess[str]:
|
|
2987
|
+
return run_keel(rtl, "patrol", "--since-last", "--notify", "--nudge", "--idle", "1s", "--quota", quota, env=env)
|
|
2988
|
+
|
|
2989
|
+
expected = {"50": None, "91": "past 90%", "93": None, "96": "past 95%", "10": None, "92": "past 90%"}
|
|
2990
|
+
for quota, want in expected.items():
|
|
2991
|
+
result = patrol(quota)
|
|
2992
|
+
lines = [line for line in result.stdout.splitlines() if line.startswith("risk: weekly quota")]
|
|
2993
|
+
if want is None and lines:
|
|
2994
|
+
report(f"{label} quota {quota} reported {lines!r}.")
|
|
2995
|
+
return 1
|
|
2996
|
+
if want is not None and len(lines) != 1:
|
|
2997
|
+
report(f"{label} quota {quota} should report one quota line: {result.stdout!r} {result.stderr!r}")
|
|
2998
|
+
return 1
|
|
2999
|
+
if want is not None and want not in lines[0]:
|
|
3000
|
+
report(f"{label} quota {quota} should report {want!r}: {lines[0]!r}")
|
|
3001
|
+
return 1
|
|
3002
|
+
if quota == "50" and "nudged verify: unread" not in result.stdout:
|
|
3003
|
+
report(f"{label} verify was not nudged at 50%: {result.stdout!r}")
|
|
3004
|
+
return 1
|
|
3005
|
+
if quota == "91" and "nudged verify" in result.stdout:
|
|
3006
|
+
report(f"{label} verify was nudged at 91%: {result.stdout!r}")
|
|
3007
|
+
return 1
|
|
3008
|
+
if quota == "91" and "nudges paused: quota at 91%" not in result.stdout:
|
|
3009
|
+
report(f"{label} the pause is not said at 91%: {result.stdout!r}")
|
|
3010
|
+
return 1
|
|
3011
|
+
sent = chat_records_with(rtl, "dm-keel-patrol--rtl", "weekly quota")
|
|
3012
|
+
if len(sent) != 3:
|
|
3013
|
+
report(f"{label} expected three quota messages to rtl, found {len(sent)}.")
|
|
3014
|
+
return 1
|
|
3015
|
+
refused = run_keel(rtl, "patrol", "--quota", "120", env=env)
|
|
3016
|
+
if refused.returncode != 1:
|
|
3017
|
+
report(f"{label} --quota 120 exited {refused.returncode}.")
|
|
3018
|
+
return 1
|
|
3019
|
+
report("patrol-quota scenario passed.")
|
|
3020
|
+
return 0
|
|
3021
|
+
|
|
3022
|
+
|
|
2976
3023
|
def validate_coordinator_patrol_scenario() -> int:
|
|
2977
3024
|
"""Issue #260: declared waits, and a patrol that notifies once.
|
|
2978
3025
|
|
|
@@ -40049,6 +40096,7 @@ SCENARIOS: tuple = (
|
|
|
40049
40096
|
("patrol-since-last", validate_patrol_since_last_scenario),
|
|
40050
40097
|
("patrol-nudge", validate_patrol_nudge_scenario),
|
|
40051
40098
|
("patrol-escalate", validate_patrol_escalate_scenario),
|
|
40099
|
+
("patrol-quota", validate_patrol_quota_scenario),
|
|
40052
40100
|
("patrol-host-task", validate_patrol_host_task_scenario),
|
|
40053
40101
|
("patrol-rearm", validate_patrol_rearm_scenario),
|
|
40054
40102
|
("patrol-issue-routing", validate_patrol_issue_routing_scenario),
|
package/src/core/patrol.js
CHANGED
|
@@ -287,6 +287,22 @@ function nudgeRoles(where, patroller, options) {
|
|
|
287
287
|
return { sent, escalations };
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
// --- quota thresholds (#307 part 2) ---------------------------------------------------
|
|
291
|
+
//
|
|
292
|
+
// The host reports the weekly quota's percent used; each threshold is a risk
|
|
293
|
+
// once per period, and a drop in the figure starts a new period (D2).
|
|
294
|
+
function quotaRisk(where, options) {
|
|
295
|
+
if (options.quota === null) return null;
|
|
296
|
+
const file = path.join(where.root, "patrol", "quota.json");
|
|
297
|
+
const state = store.readJsonFile(file);
|
|
298
|
+
let reported = Array.isArray(state.reported) ? state.reported : [];
|
|
299
|
+
if (typeof state.last === "number" && options.quota < state.last) reported = [];
|
|
300
|
+
const reached = options.quotaAlerts.filter((threshold) => threshold <= options.quota && !reported.includes(threshold));
|
|
301
|
+
store.writeJsonAtomic(where, file, { last: options.quota, reported: [...reported, ...reached].sort((a, b) => a - b) });
|
|
302
|
+
if (!reached.length) return null;
|
|
303
|
+
return `weekly quota is at ${options.quota}%, past ${Math.max(...reached)}%`;
|
|
304
|
+
}
|
|
305
|
+
|
|
290
306
|
function notifyRisks(where, role, risks) {
|
|
291
307
|
const group = store.directName(NOTIFY_SENDER, role);
|
|
292
308
|
if (!store.groupState(store.readLog(where, group)).exists) {
|
|
@@ -304,6 +320,7 @@ function render(result) {
|
|
|
304
320
|
for (const change of changes) lines.push(`changed: ${change}`);
|
|
305
321
|
for (const sent of result.nudges || []) lines.push(`nudged ${sent.role}: ${sent.kind}`);
|
|
306
322
|
for (const risk of result.risks || []) lines.push(`risk: ${risk}`);
|
|
323
|
+
if (result.paused) lines.push(result.paused);
|
|
307
324
|
for (const held of result.held) lines.push(`met: ${held.from} waited for ${held.condition} (${held.id})`);
|
|
308
325
|
for (const sent of result.notices) lines.push(`notified ${sent.to}: ${sent.text}`);
|
|
309
326
|
for (const wait of result.unchecked) lines.push(`unchecked: ${wait.from} waits for ${wait.condition}; pass --issues to check it`);
|
|
@@ -405,7 +422,7 @@ function runPatrol(argv) {
|
|
|
405
422
|
throw error;
|
|
406
423
|
}
|
|
407
424
|
}
|
|
408
|
-
const options = { repo: process.cwd(), issues: null, idle: "30m", json: false, sinceLast: false, notify: false, nudge: false, context: [], shiftAt: 50, diskFreeGb: null, diskMinGb: 20 };
|
|
425
|
+
const options = { repo: process.cwd(), issues: null, idle: "30m", json: false, sinceLast: false, notify: false, nudge: false, context: [], shiftAt: 50, diskFreeGb: null, diskMinGb: 20, quota: null, quotaAlerts: [90, 95, 99], quotaQuietAt: 90 };
|
|
409
426
|
try {
|
|
410
427
|
for (let index = 0; index < argv.length; index += 1) {
|
|
411
428
|
const arg = argv[index];
|
|
@@ -417,6 +434,9 @@ function runPatrol(argv) {
|
|
|
417
434
|
else if (arg === "--shift-at") options.shiftAt = Number(argv[++index]);
|
|
418
435
|
else if (arg === "--disk-free-gb") options.diskFreeGb = Number(argv[++index]);
|
|
419
436
|
else if (arg === "--disk-min-gb") options.diskMinGb = Number(argv[++index]);
|
|
437
|
+
else if (arg === "--quota") options.quota = Number(argv[++index]);
|
|
438
|
+
else if (arg === "--quota-alerts") options.quotaAlerts = String(argv[++index] || "").split(",").map(Number);
|
|
439
|
+
else if (arg === "--quota-quiet-at") options.quotaQuietAt = Number(argv[++index]);
|
|
420
440
|
else if (arg === "--help" || arg === "-h") {
|
|
421
441
|
process.stdout.write(`${USAGE}\nExit 0: wrote nothing. 2: sent a notice or marked a wait met. 1: error.\n`);
|
|
422
442
|
return EXIT_QUIET;
|
|
@@ -431,13 +451,22 @@ function runPatrol(argv) {
|
|
|
431
451
|
options.contexts = parseContexts(options.context);
|
|
432
452
|
if (options.diskFreeGb !== null && !(options.diskFreeGb >= 0)) throw new PatrolError("--disk-free-gb needs a number of gigabytes.");
|
|
433
453
|
if (!(options.diskMinGb > 0)) throw new PatrolError("--disk-min-gb needs a positive number of gigabytes.");
|
|
454
|
+
const percent = (value) => Number.isFinite(value) && value >= 0 && value <= 100;
|
|
455
|
+
if (options.quota !== null && !percent(options.quota)) throw new PatrolError("--quota needs the percent used, from 0 to 100.");
|
|
456
|
+
if (!options.quotaAlerts.length || !options.quotaAlerts.every(percent)) throw new PatrolError("--quota-alerts needs percentages separated by commas, such as 90,95,99.");
|
|
457
|
+
if (!percent(options.quotaQuietAt)) throw new PatrolError("--quota-quiet-at needs a percentage from 0 to 100.");
|
|
434
458
|
if (parseSince(options.idle) === null) throw new PatrolError(`--idle ${JSON.stringify(options.idle)} is not a duration; use 90s, 15m, 2h, or 3d.`);
|
|
435
459
|
options.issues = readIssues(options.issues);
|
|
436
460
|
const where = store.requireLocation(path.resolve(options.repo));
|
|
437
461
|
const role = store.requireRole(where);
|
|
438
462
|
const result = patrol(where, role, options);
|
|
439
463
|
result.risks = [];
|
|
440
|
-
|
|
464
|
+
const quota = quotaRisk(where, options);
|
|
465
|
+
if (quota) result.risks.push(quota);
|
|
466
|
+
// Near the limit nudges stop, since each wakes a large session (D3).
|
|
467
|
+
const quiet = options.quota !== null && options.quota >= options.quotaQuietAt;
|
|
468
|
+
if (options.nudge && quiet) result.paused = `nudges paused: quota at ${options.quota}%`;
|
|
469
|
+
if (options.nudge && !quiet) {
|
|
441
470
|
const nudged = nudgeRoles(where, role, options);
|
|
442
471
|
result.nudges = nudged.sent;
|
|
443
472
|
result.risks.push(...nudged.escalations);
|