@christang/keel 5.111.0 → 5.112.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 +10 -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/plugins/keel/scripts/session-start.js +8 -0
- package/scripts/validate_plugin.py +69 -2
- package/src/core/config.js +26 -0
- package/src/core/context.js +5 -0
- package/src/core/shift.js +6 -1
package/README.md
CHANGED
|
@@ -797,6 +797,16 @@ issue_roles:
|
|
|
797
797
|
role:verify: verify
|
|
798
798
|
```
|
|
799
799
|
|
|
800
|
+
A host schedule made inside a session ends with that session, so a shift change or restart drops
|
|
801
|
+
it. Declare which role patrols and how often, and that role's new sessions — and its `keel shift
|
|
802
|
+
resume` — are reminded to re-create it (#260); Keel itself still schedules nothing:
|
|
803
|
+
|
|
804
|
+
```yaml
|
|
805
|
+
patrol:
|
|
806
|
+
role: iecc-pm
|
|
807
|
+
every: 30m
|
|
808
|
+
```
|
|
809
|
+
|
|
800
810
|
## Commands
|
|
801
811
|
|
|
802
812
|
```bash
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.112.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.112.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.112.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.112.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",
|
|
@@ -660,6 +660,14 @@ function main() {
|
|
|
660
660
|
+ `(commits in ${context.recent.range}; a pointer, not a selection).`
|
|
661
661
|
);
|
|
662
662
|
}
|
|
663
|
+
// The patrolling role re-arms its schedule after a shift change (#260).
|
|
664
|
+
if (context.patrol && context.patrol.role) {
|
|
665
|
+
lines.push(
|
|
666
|
+
`- patrol: role ${context.patrol.role} runs \`keel patrol\` every ${context.patrol.every}; `
|
|
667
|
+
+ "a session's schedule ends with the session, so re-create it with the host "
|
|
668
|
+
+ "if this session has none, and wake the model only on exit 2."
|
|
669
|
+
);
|
|
670
|
+
}
|
|
663
671
|
// The role other sessions address this one by (#245).
|
|
664
672
|
if (context.role) {
|
|
665
673
|
lines.push(`- chat role: ${context.role} (other sessions address this one by it).`);
|
|
@@ -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.112.0"
|
|
51
|
+
PROTOCOL_VERSION = "5.112.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
|
|
@@ -2583,6 +2583,72 @@ def chat_logs_snapshot(repo: Path) -> dict:
|
|
|
2583
2583
|
return {str(p): p.read_bytes() for p in groups.rglob("*") if p.is_file()}
|
|
2584
2584
|
|
|
2585
2585
|
|
|
2586
|
+
def validate_patrol_rearm_scenario() -> int:
|
|
2587
|
+
"""Issue #260: the patrolling role is reminded to re-arm its schedule.
|
|
2588
|
+
|
|
2589
|
+
`patrol:` names the role and interval; that role's `keel context`, session
|
|
2590
|
+
projection, and `keel shift resume` remind it; other roles and a broken
|
|
2591
|
+
declaration are quiet. Keel schedules nothing.
|
|
2592
|
+
"""
|
|
2593
|
+
label = "patrol-rearm:"
|
|
2594
|
+
with tempfile.TemporaryDirectory(prefix="keel-patrol-rearm-") as raw:
|
|
2595
|
+
base = Path(raw)
|
|
2596
|
+
repo = mailbox_repository(base / "repo")
|
|
2597
|
+
write_text(repo / "openspec/specs/.keep", "")
|
|
2598
|
+
write_authorize_config(repo, "patrol:\n role: iecc-pm\n every: 30m\n")
|
|
2599
|
+
subprocess.run(["git", "add", "-A"], cwd=repo, check=True, capture_output=True)
|
|
2600
|
+
subprocess.run(["git", "commit", "-q", "-m", "patrol"], cwd=repo, check=True, capture_output=True)
|
|
2601
|
+
pm = chat_worktree(repo, base / "pm")
|
|
2602
|
+
rtl = chat_worktree(repo, base / "rtl")
|
|
2603
|
+
env = chat_environment()
|
|
2604
|
+
run_keel(pm, "chat", "role", "--set", "iecc-pm", env=env)
|
|
2605
|
+
run_keel(rtl, "chat", "role", "--set", "rtl", env=env)
|
|
2606
|
+
|
|
2607
|
+
def look(cwd: Path) -> tuple[dict, str]:
|
|
2608
|
+
context = json.loads(run_keel(cwd, "context", "--json", env=env).stdout)
|
|
2609
|
+
session = run_session_start_hook(
|
|
2610
|
+
cwd, {"hook_event_name": "SessionStart", "source": "startup", "cwd": str(cwd)},
|
|
2611
|
+
keel_cli=f'node "{ROOT / "bin" / "keel.js"}"',
|
|
2612
|
+
)
|
|
2613
|
+
return context, session_start_context(session) or ""
|
|
2614
|
+
|
|
2615
|
+
context, note = look(pm)
|
|
2616
|
+
if context.get("patrol") != {"role": "iecc-pm", "every": "30m"}:
|
|
2617
|
+
report(f"{label} the coordinator's context carries patrol {context.get('patrol')!r}.")
|
|
2618
|
+
return 1
|
|
2619
|
+
if "keel patrol" not in note or "30m" not in note:
|
|
2620
|
+
report(f"{label} the coordinator's projection does not remind it: {note!r}")
|
|
2621
|
+
return 1
|
|
2622
|
+
ready = run_keel(pm, "shift", "ready", "next: keep patrolling", env=env)
|
|
2623
|
+
if ready.returncode != 0:
|
|
2624
|
+
report(f"{label} keel shift ready failed: {ready.stdout} {ready.stderr}")
|
|
2625
|
+
return 1
|
|
2626
|
+
resumed = run_keel(pm, "shift", "resume", env=env)
|
|
2627
|
+
tail = resumed.stdout.strip().splitlines()[-1] if resumed.stdout.strip() else ""
|
|
2628
|
+
if "keel patrol" not in tail or "30m" not in tail:
|
|
2629
|
+
report(f"{label} keel shift resume does not end with the reminder: {resumed.stdout!r}")
|
|
2630
|
+
return 1
|
|
2631
|
+
|
|
2632
|
+
context, note = look(rtl)
|
|
2633
|
+
if "patrol" in context:
|
|
2634
|
+
report(f"{label} another role carries patrol: {context.get('patrol')!r}")
|
|
2635
|
+
return 1
|
|
2636
|
+
if "keel patrol" in note:
|
|
2637
|
+
report(f"{label} another role's projection reminds it: {note!r}")
|
|
2638
|
+
return 1
|
|
2639
|
+
|
|
2640
|
+
write_authorize_config(pm, "patrol:\n role: iecc-pm\n every: soon\n")
|
|
2641
|
+
broken = json.loads(run_keel(pm, "context", "--json", env=env).stdout)
|
|
2642
|
+
if "patrol" in broken:
|
|
2643
|
+
report(f"{label} a malformed declaration still reminds: {broken.get('patrol')!r}")
|
|
2644
|
+
return 1
|
|
2645
|
+
if not any("patrol" in w for w in broken.get("warnings", [])):
|
|
2646
|
+
report(f"{label} the malformed declaration is not reported: {broken.get('warnings')!r}")
|
|
2647
|
+
return 1
|
|
2648
|
+
report("patrol-rearm scenario passed.")
|
|
2649
|
+
return 0
|
|
2650
|
+
|
|
2651
|
+
|
|
2586
2652
|
def validate_coordinator_patrol_scenario() -> int:
|
|
2587
2653
|
"""Issue #260: declared waits, and a patrol that notifies once.
|
|
2588
2654
|
|
|
@@ -38962,6 +39028,7 @@ SCENARIOS: tuple = (
|
|
|
38962
39028
|
("chat-supersedes", validate_chat_supersedes_scenario),
|
|
38963
39029
|
("chat-ack", validate_chat_ack_scenario),
|
|
38964
39030
|
("coordinator-patrol", validate_coordinator_patrol_scenario),
|
|
39031
|
+
("patrol-rearm", validate_patrol_rearm_scenario),
|
|
38965
39032
|
("patrol-issue-routing", validate_patrol_issue_routing_scenario),
|
|
38966
39033
|
("chat-listen-only", validate_chat_listen_only_scenario),
|
|
38967
39034
|
("chat-summary", validate_chat_summary_scenario),
|
package/src/core/config.js
CHANGED
|
@@ -129,6 +129,7 @@ const CONFIG_DECLARATIONS = [
|
|
|
129
129
|
"external_agents",
|
|
130
130
|
"read_only_roles",
|
|
131
131
|
"issue_roles",
|
|
132
|
+
"patrol",
|
|
132
133
|
];
|
|
133
134
|
|
|
134
135
|
const CONFIG_RELATIVE_PATH = path.join("keel", "config.yaml");
|
|
@@ -872,7 +873,32 @@ function readIssueRoles(repo) {
|
|
|
872
873
|
return { routes, unreadable };
|
|
873
874
|
}
|
|
874
875
|
|
|
876
|
+
// `patrol:` — which role runs `keel patrol`, and how often (#260). Keel only
|
|
877
|
+
// reminds that role to re-create its host schedule; it schedules nothing. A
|
|
878
|
+
// declaration missing a value, or with a malformed one, reminds nobody.
|
|
879
|
+
function readPatrolDeclaration(repo) {
|
|
880
|
+
const block = configMap(repo, "patrol");
|
|
881
|
+
if (!Object.keys(block).length) return { declared: false, role: null, every: null, message: null };
|
|
882
|
+
const problems = [];
|
|
883
|
+
if (!/^[a-z0-9][a-z0-9-]{0,31}$/.test(block.role || "")) problems.push(`role \`${block.role || ""}\` is not a chat role name`);
|
|
884
|
+
if (!/^\d+[smhd]$/.test(block.every || "")) problems.push(`every \`${block.every || ""}\` is not a duration such as 30m`);
|
|
885
|
+
if (problems.length) {
|
|
886
|
+
return {
|
|
887
|
+
declared: true, role: null, every: null,
|
|
888
|
+
message: `keel/config.yaml patrol: ${problems.join("; ")}, so no session is reminded to run \`keel patrol\`.`,
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
return { declared: true, role: block.role, every: block.every, message: null };
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
function patrolReminder(patrol) {
|
|
895
|
+
return `Patrol: role ${patrol.role} runs \`keel patrol\` every ${patrol.every}; a session's schedule ends with `
|
|
896
|
+
+ "the session, so re-create it with the host if this session has none, and wake the model only on exit 2.";
|
|
897
|
+
}
|
|
898
|
+
|
|
875
899
|
module.exports = {
|
|
900
|
+
readPatrolDeclaration,
|
|
901
|
+
patrolReminder,
|
|
876
902
|
readIssueRoles,
|
|
877
903
|
readReadOnlyRoles,
|
|
878
904
|
readExternalAgents,
|
package/src/core/context.js
CHANGED
|
@@ -18,6 +18,7 @@ const {
|
|
|
18
18
|
readExecutorTier,
|
|
19
19
|
readMergeDeclaration,
|
|
20
20
|
readReadOnlyRoles,
|
|
21
|
+
readPatrolDeclaration,
|
|
21
22
|
} = require("./config");
|
|
22
23
|
const { isKeelSourceRepo } = require("./capabilities");
|
|
23
24
|
|
|
@@ -847,6 +848,10 @@ function resolveContext(repo, options) {
|
|
|
847
848
|
} catch {
|
|
848
849
|
context.role = null;
|
|
849
850
|
}
|
|
851
|
+
// The patrolling role is reminded to re-arm its schedule (#260).
|
|
852
|
+
const patrol = readPatrolDeclaration(repo);
|
|
853
|
+
if (patrol.message) context.warnings.push(patrol.message);
|
|
854
|
+
if (patrol.role && context.role === patrol.role) context.patrol = { role: patrol.role, every: patrol.every };
|
|
850
855
|
context.warnings.push(...gitWarnings(repo));
|
|
851
856
|
// A broken `authorize:` declaration is otherwise reported only by
|
|
852
857
|
// `keel --doctor`, an explicitly-invoked diagnostic — surfaced here too so a
|
package/src/core/shift.js
CHANGED
|
@@ -458,7 +458,12 @@ function runShift(argv) {
|
|
|
458
458
|
out(result, `No shift note waits for ${result.role || "this worktree"}.`);
|
|
459
459
|
return 0;
|
|
460
460
|
}
|
|
461
|
-
|
|
461
|
+
// A new shift of the patrolling role re-creates its schedule (#260).
|
|
462
|
+
const { readPatrolDeclaration, patrolReminder } = require("./config");
|
|
463
|
+
const patrol = readPatrolDeclaration(where.worktree);
|
|
464
|
+
const remind = patrol.role && result.role === patrol.role;
|
|
465
|
+
if (remind) result.patrol = { role: patrol.role, every: patrol.every };
|
|
466
|
+
out(result, `${result.text.replace(/\s+$/, "")}\n\n(The note moved to ${result.note}.)${remind ? `\n\n${patrolReminder(patrol)}` : ""}`);
|
|
462
467
|
return 0;
|
|
463
468
|
}
|
|
464
469
|
case "status": {
|