@christang/keel 5.157.0 → 5.158.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/.claude-plugin/plugin.json +1 -1
- 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 +64 -2
- package/src/core/chat/cli.js +5 -0
- package/src/core/chat/notice.js +55 -0
- package/src/core/context.js +6 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.158.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",
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.158.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.158.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.158.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.158.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",
|
|
@@ -49,8 +49,8 @@ REQUIRED_SCRIPTS = [
|
|
|
49
49
|
"scripts/validate_plugin.py",
|
|
50
50
|
]
|
|
51
51
|
|
|
52
|
-
PACKAGE_VERSION = "5.
|
|
53
|
-
PROTOCOL_VERSION = "5.
|
|
52
|
+
PACKAGE_VERSION = "5.158.0"
|
|
53
|
+
PROTOCOL_VERSION = "5.158.0"
|
|
54
54
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
55
55
|
OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
|
|
56
56
|
# Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
|
|
@@ -2598,6 +2598,67 @@ def validate_chat_wake_now_cli_scenario() -> int:
|
|
|
2598
2598
|
return 0
|
|
2599
2599
|
|
|
2600
2600
|
|
|
2601
|
+
def validate_two_live_sessions_on_one_role_scenario() -> int:
|
|
2602
|
+
"""Issue #369 point 4: two live sessions bound to one role are reported.
|
|
2603
|
+
|
|
2604
|
+
On 2026-10-18 a desktop PM session and its CLI copy both ran as `iecc-pm`
|
|
2605
|
+
in one worktree: both posted under the one name and shared one read
|
|
2606
|
+
cursor, and neither knew. Each session now records itself under the role;
|
|
2607
|
+
with two live ones `keel context`, `keel chat post` and `keel chat unread`
|
|
2608
|
+
say so, and the warning goes once one has ended.
|
|
2609
|
+
"""
|
|
2610
|
+
label = "two-live-sessions-on-one-role:"
|
|
2611
|
+
with tempfile.TemporaryDirectory(prefix="keel-twins-369-") as raw:
|
|
2612
|
+
base = Path(raw)
|
|
2613
|
+
rtl, verify, env, _ = shift_scratch(base)
|
|
2614
|
+
write_text(verify / "openspec/specs/.keep", "")
|
|
2615
|
+
other = subprocess.Popen(["sleep", "300"])
|
|
2616
|
+
try:
|
|
2617
|
+
def as_session(sid: str, pid: int) -> dict:
|
|
2618
|
+
return {**env, "CLAUDE_CODE_ENTRYPOINT": "cli", "CLAUDE_CODE_SESSION_ID": sid, "CLAUDE_PID": str(pid)}
|
|
2619
|
+
|
|
2620
|
+
def start(sid: str, pid: int) -> None:
|
|
2621
|
+
subprocess.run(["node", str(ROOT / "bin" / "keel.js"), "chat", "hook", "session-start"], cwd=verify,
|
|
2622
|
+
env=as_session(sid, pid), text=True, capture_output=True, check=False,
|
|
2623
|
+
input=json.dumps({"cwd": str(verify), "hook_event_name": "SessionStart", "session_id": sid, "source": "startup"}))
|
|
2624
|
+
|
|
2625
|
+
start("sess-a", os.getpid())
|
|
2626
|
+
alone = json.loads(run_keel(verify, "context", "--json", env=as_session("sess-a", os.getpid())).stdout)
|
|
2627
|
+
if any("live sessions" in w for w in alone.get("warnings", [])):
|
|
2628
|
+
report(f"{label} one session was reported as two: {alone.get('warnings')!r}")
|
|
2629
|
+
return 1
|
|
2630
|
+
start("sess-b", other.pid)
|
|
2631
|
+
context = json.loads(run_keel(verify, "context", "--json", env=as_session("sess-a", os.getpid())).stdout)
|
|
2632
|
+
warning = next((w for w in context.get("warnings", []) if "live sessions" in w), "")
|
|
2633
|
+
for needle in ("verify", "sess-a", "sess-b", "read cursor"):
|
|
2634
|
+
if needle not in warning:
|
|
2635
|
+
report(f"{label} keel context's warning does not name {needle!r}: {context.get('warnings')!r}")
|
|
2636
|
+
return 1
|
|
2637
|
+
posted = run_keel(verify, "chat", "post", "soc", "hello", env=as_session("sess-a", os.getpid()))
|
|
2638
|
+
if "live sessions" not in posted.stderr:
|
|
2639
|
+
report(f"{label} keel chat post does not warn: {posted.stdout!r} {posted.stderr!r}")
|
|
2640
|
+
return 1
|
|
2641
|
+
read = run_keel(verify, "chat", "unread", "--json", env=as_session("sess-a", os.getpid()))
|
|
2642
|
+
if "live sessions" not in read.stderr:
|
|
2643
|
+
report(f"{label} keel chat unread does not warn: {read.stderr!r}")
|
|
2644
|
+
return 1
|
|
2645
|
+
json.loads(read.stdout)
|
|
2646
|
+
other.kill()
|
|
2647
|
+
other.wait()
|
|
2648
|
+
after = json.loads(run_keel(verify, "context", "--json", env=as_session("sess-a", os.getpid())).stdout)
|
|
2649
|
+
if any("live sessions" in w for w in after.get("warnings", [])):
|
|
2650
|
+
report(f"{label} the warning stayed after one session ended: {after.get('warnings')!r}")
|
|
2651
|
+
return 1
|
|
2652
|
+
finally:
|
|
2653
|
+
if other.poll() is None:
|
|
2654
|
+
other.kill()
|
|
2655
|
+
if "two-live-sessions-on-one-role" not in {name for name, _ in SCENARIOS}:
|
|
2656
|
+
report(f"{label} scenario is not registered.")
|
|
2657
|
+
return 1
|
|
2658
|
+
report("two-live-sessions-on-one-role scenario passed.")
|
|
2659
|
+
return 0
|
|
2660
|
+
|
|
2661
|
+
|
|
2601
2662
|
def validate_chat_supersedes_scenario() -> int:
|
|
2602
2663
|
"""Issue #252: a record supersedes its author's earlier one.
|
|
2603
2664
|
|
|
@@ -42442,6 +42503,7 @@ SCENARIOS: tuple = (
|
|
|
42442
42503
|
("resource-lock", validate_resource_lock_scenario),
|
|
42443
42504
|
("chat-supersedes", validate_chat_supersedes_scenario),
|
|
42444
42505
|
("chat-mention-skips-code", validate_chat_mention_skips_code_scenario),
|
|
42506
|
+
("two-live-sessions-on-one-role", validate_two_live_sessions_on_one_role_scenario),
|
|
42445
42507
|
("chat-wake-now-cli", validate_chat_wake_now_cli_scenario),
|
|
42446
42508
|
("chat-ack", validate_chat_ack_scenario),
|
|
42447
42509
|
("coordinator-patrol", validate_coordinator_patrol_scenario),
|
package/src/core/chat/cli.js
CHANGED
|
@@ -738,6 +738,11 @@ function runChat(argv) {
|
|
|
738
738
|
migrateIfNeeded(where);
|
|
739
739
|
const role = store.currentRole(where);
|
|
740
740
|
if (role) notice.touchPresence(where, role);
|
|
741
|
+
// Two live sessions on one role share its name and cursor (#369 D3).
|
|
742
|
+
if (role && ["post", "dm", "todo", "unread", "read"].includes(options.positionals[0])) {
|
|
743
|
+
const twins = notice.twinWarning(where, role);
|
|
744
|
+
if (twins) process.stderr.write(`keel chat: ${twins}\n`);
|
|
745
|
+
}
|
|
741
746
|
return dispatch(where, options);
|
|
742
747
|
} catch (error) {
|
|
743
748
|
if (!(error instanceof ChatError)) throw error;
|
package/src/core/chat/notice.js
CHANGED
|
@@ -104,11 +104,65 @@ function touchPresence(where, role, state = "online", host = null, started = nul
|
|
|
104
104
|
};
|
|
105
105
|
try {
|
|
106
106
|
store.writeJsonAtomic(where, presenceFile(where, role), record);
|
|
107
|
+
touchSession(where, role, state);
|
|
107
108
|
} catch {
|
|
108
109
|
// Presence is a convenience: failing to record it must not fail a command.
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
// --- one role, several sessions (#369 point 4) ------------------------------------
|
|
114
|
+
|
|
115
|
+
function sessionsFile(where, role) {
|
|
116
|
+
return path.join(where.root, "presence", `${role}.sessions.json`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function thisSession() {
|
|
120
|
+
if (process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop" && process.env.CLAUDE_CODE_HOST_SESSION_ID) {
|
|
121
|
+
return { id: process.env.CLAUDE_CODE_HOST_SESSION_ID, pid: require("../shift").desktopProcess(), host: "claude-desktop" };
|
|
122
|
+
}
|
|
123
|
+
if (process.env.CLAUDE_CODE_SESSION_ID) {
|
|
124
|
+
const pid = Number(process.env.CLAUDE_PID);
|
|
125
|
+
return { id: process.env.CLAUDE_CODE_SESSION_ID, pid: Number.isInteger(pid) && pid > 1 ? pid : null, host: "claude-code" };
|
|
126
|
+
}
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const SESSION_STALE_MS = 24 * 60 * 60 * 1000;
|
|
131
|
+
const SESSION_RECENT_MS = 30 * 60 * 1000;
|
|
132
|
+
|
|
133
|
+
function sessionLive(entry, now) {
|
|
134
|
+
const pid = Number(entry.pid);
|
|
135
|
+
if (Number.isInteger(pid) && pid > 1) return running(pid);
|
|
136
|
+
return now - Date.parse(entry.last_active || "") < SESSION_RECENT_MS;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Each session records itself, so two on one role are visible (D1); an
|
|
140
|
+
// ended or stale one is dropped.
|
|
141
|
+
function touchSession(where, role, state) {
|
|
142
|
+
const self = thisSession();
|
|
143
|
+
const file = sessionsFile(where, role);
|
|
144
|
+
const sessions = store.readJsonFile(file);
|
|
145
|
+
const now = Date.now();
|
|
146
|
+
for (const [id, entry] of Object.entries(sessions)) {
|
|
147
|
+
const pid = Number(entry.pid);
|
|
148
|
+
const ended = Number.isInteger(pid) && pid > 1 && !running(pid);
|
|
149
|
+
if (ended || now - Date.parse(entry.last_active || "") > SESSION_STALE_MS) delete sessions[id];
|
|
150
|
+
}
|
|
151
|
+
if (self && state === "offline") delete sessions[self.id];
|
|
152
|
+
else if (self) sessions[self.id] = { pid: self.pid, worktree: where.worktree, host: self.host, last_active: store.isoLocal(new Date()) };
|
|
153
|
+
if (!self && !Object.keys(sessions).length && !fs.existsSync(file)) return;
|
|
154
|
+
store.writeJsonAtomic(where, file, sessions);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// The warning for two or more live sessions on a role (D3), or null.
|
|
158
|
+
function twinWarning(where, role, now = Date.now()) {
|
|
159
|
+
const live = Object.entries(store.readJsonFile(sessionsFile(where, role))).filter(([, entry]) => sessionLive(entry, now));
|
|
160
|
+
if (live.length < 2) return null;
|
|
161
|
+
const named = live.map(([id, entry]) => `${id} (pid ${entry.pid || "unknown"}, ${entry.worktree || "unknown worktree"})`).join(", ");
|
|
162
|
+
return `${live.length} live sessions are bound to role ${role}: ${named}. They post under one name and share one read cursor, `
|
|
163
|
+
+ "so one can hide unread records from the other; stop one, or bind it to another role with `keel chat role --set`.";
|
|
164
|
+
}
|
|
165
|
+
|
|
112
166
|
function desktopFields() {
|
|
113
167
|
const id = process.env.CLAUDE_CODE_HOST_SESSION_ID;
|
|
114
168
|
if (process.env.CLAUDE_CODE_ENTRYPOINT !== "claude-desktop" || !id) return { desktop_session: null, desktop_pid: null };
|
|
@@ -552,6 +606,7 @@ module.exports = {
|
|
|
552
606
|
unpark,
|
|
553
607
|
wakeStep,
|
|
554
608
|
resumeCli,
|
|
609
|
+
twinWarning,
|
|
555
610
|
check,
|
|
556
611
|
bridgeLine,
|
|
557
612
|
keptFile,
|
package/src/core/context.js
CHANGED
|
@@ -871,6 +871,12 @@ function resolveContext(repo, options) {
|
|
|
871
871
|
context.ownerLanguage = language.tag;
|
|
872
872
|
context.ownerLanguageRule = ownerLanguageRule(language.tag);
|
|
873
873
|
}
|
|
874
|
+
// Two live sessions on one role post as one and share a cursor (#369).
|
|
875
|
+
if (context.role) {
|
|
876
|
+
const chatWhere = require("./chat/store").locate(repo);
|
|
877
|
+
const twins = chatWhere ? require("./chat/notice").twinWarning(chatWhere, context.role) : null;
|
|
878
|
+
if (twins) context.warnings.push(twins);
|
|
879
|
+
}
|
|
874
880
|
// The patrolling role is reminded to re-arm its schedule (#260).
|
|
875
881
|
const patrol = readPatrolDeclaration(repo);
|
|
876
882
|
if (patrol.message) context.warnings.push(patrol.message);
|