@christang/keel 5.223.0 → 5.224.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/validation/common.py +2 -2
- package/scripts/validation/registry.py +3 -0
- package/scripts/validation/shift.py +135 -1
- package/src/core/chat/notice.js +14 -2
- package/src/core/gates.js +8 -1
- package/src/core/shift.js +32 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.224.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.224.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.224.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.224.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.224.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",
|
|
@@ -35,10 +35,10 @@ os.environ["KEEL_UPDATE_CLAUDE"] = str(Path(tempfile.gettempdir()) / "keel-suite
|
|
|
35
35
|
os.environ["KEEL_UPDATE_CODEX"] = str(Path(tempfile.gettempdir()) / "keel-suite-has-no-codex")
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
PACKAGE_VERSION = "5.
|
|
38
|
+
PACKAGE_VERSION = "5.224.0"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
PROTOCOL_VERSION = "5.
|
|
41
|
+
PROTOCOL_VERSION = "5.224.0"
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
@@ -429,6 +429,9 @@ SCENARIOS: tuple = (
|
|
|
429
429
|
("shift-resume-removes-old-sessions", shift.validate_shift_resume_removes_old_sessions_scenario),
|
|
430
430
|
("shift-cli-removes-after-exit", shift.validate_shift_cli_removes_after_exit_scenario),
|
|
431
431
|
("shift-cli-keeps-worktree-in-use", shift.validate_shift_cli_keeps_worktree_in_use_scenario),
|
|
432
|
+
("shift-replaced-refuses", shift.validate_shift_replaced_refuses_scenario),
|
|
433
|
+
("shift-unreplaced-not-refused", shift.validate_shift_unreplaced_not_refused_scenario),
|
|
434
|
+
("shift-replaced-told", shift.validate_shift_replaced_told_scenario),
|
|
432
435
|
("shift-cli-names-failed-removal", shift.validate_shift_cli_names_failed_removal_scenario),
|
|
433
436
|
("shift-ready-says-session-stays", shift.validate_shift_ready_says_session_stays_scenario),
|
|
434
437
|
("shift-ready-promises-removal-when-removable", shift.validate_shift_ready_promises_removal_when_removable_scenario),
|
|
@@ -4001,12 +4001,14 @@ def validate_shift_cli_removes_after_exit_scenario() -> int:
|
|
|
4001
4001
|
|
|
4002
4002
|
|
|
4003
4003
|
def handover_old_session(base: Path, row_cwd: Path, worktree_path: Path | None, ready_out: list | None = None,
|
|
4004
|
-
config_text: str | None = None, **fake_env: str):
|
|
4004
|
+
config_text: str | None = None, probe=None, **fake_env: str):
|
|
4005
4005
|
"""A delivered hand-over of `5b14fbae` from verify's worktree under the contract fake (#492).
|
|
4006
4006
|
|
|
4007
4007
|
Returns the `rm` calls the fake logged and `keel shift status` from rtl.
|
|
4008
4008
|
The row's `cwd` and the host's recorded `worktreePath` are the inputs.
|
|
4009
4009
|
`ready_out`, when given, receives what `shift ready --wake` printed as text and then as `--json` (#506).
|
|
4010
|
+
`probe`, when given, is called as `probe(verify, env, OLD)` once the hand-over is delivered and the old
|
|
4011
|
+
session is still listed, to run commands as the replaced session (#506).
|
|
4010
4012
|
"""
|
|
4011
4013
|
OLD = "5b14fbae-b6aa-40b6-a72a-b3f89d2c6eea"
|
|
4012
4014
|
rtl, verify, env, _ = shift_scratch(base)
|
|
@@ -4039,6 +4041,8 @@ def handover_old_session(base: Path, row_cwd: Path, worktree_path: Path | None,
|
|
|
4039
4041
|
as_json = run_keel(verify, "shift", "ready", "--wake", "--json", "next: rerun R032", env=cli_env)
|
|
4040
4042
|
ready_out.extend([readied.stdout, as_json.stdout])
|
|
4041
4043
|
run_keel(verify, "tick", "--repo", str(rtl), env=env)
|
|
4044
|
+
if probe is not None:
|
|
4045
|
+
probe(verify, env, OLD)
|
|
4042
4046
|
removals = [json.loads(line) for line in calls.read_text().splitlines() if json.loads(line)["argv"][:1] == ["rm"]]
|
|
4043
4047
|
return removals, run_keel(rtl, "shift", "status", env=env).stdout, verify
|
|
4044
4048
|
finally:
|
|
@@ -4789,6 +4793,9 @@ def validate_shift_cli_self_shift_scenario() -> int:
|
|
|
4789
4793
|
# The tick and the waiter start one session: a fresh lock holds the tick off.
|
|
4790
4794
|
calls.write_text("")
|
|
4791
4795
|
agents_row("idle", "done")
|
|
4796
|
+
# In life the next hand-over comes from the new session; this fixture reuses one id, so the
|
|
4797
|
+
# delivered record that names it as replaced is cleared first (#506).
|
|
4798
|
+
(queue / "verify.json").unlink(missing_ok=True)
|
|
4792
4799
|
run_keel(verify, "shift", "ready", "--wake", "next: rerun R014", env={**cli_env, "KEEL_SHIFT_HANDOVER_TIMEOUT_MS": "1"})
|
|
4793
4800
|
lock = queue / "verify.lock"
|
|
4794
4801
|
write_text(lock, "held")
|
|
@@ -4810,6 +4817,7 @@ def validate_shift_cli_self_shift_scenario() -> int:
|
|
|
4810
4817
|
calls.write_text("")
|
|
4811
4818
|
agents_row("idle", "done")
|
|
4812
4819
|
write_text(fail, "x")
|
|
4820
|
+
(queue / "verify.json").unlink(missing_ok=True)
|
|
4813
4821
|
run_keel(verify, "shift", "ready", "--wake", "next: rerun R013", env={**cli_env, "KEEL_SHIFT_HANDOVER_TIMEOUT_MS": "1"})
|
|
4814
4822
|
tick()
|
|
4815
4823
|
text = status_text()
|
|
@@ -4905,6 +4913,8 @@ def validate_shift_cli_keeps_old_sessions_scenario() -> int:
|
|
|
4905
4913
|
live = {"kind": "background", "name": "verify", "sessionId": OLD, "id": OLD[:8], "status": "idle", "state": "working",
|
|
4906
4914
|
"cwd": bound["verify"], "startedAt": 1792490000000}
|
|
4907
4915
|
agents.write_text(json.dumps([*olds, live]))
|
|
4916
|
+
# One id plays every old shift here; the delivered record of the last one would refuse the next (#506).
|
|
4917
|
+
(mailbox_common_dir(rtl) / "keel-chat" / "shift" / "queue" / "verify.json").unlink(missing_ok=True)
|
|
4908
4918
|
readied = run_keel(verify, "shift", "ready", "--wake", "next: rerun R020", env=cli_env)
|
|
4909
4919
|
if readied.returncode != 0:
|
|
4910
4920
|
raise RuntimeError(f"ready --wake failed: {readied.stderr!r}")
|
|
@@ -6652,3 +6662,127 @@ def validate_branches_pointed_out_scenario() -> int:
|
|
|
6652
6662
|
return 1
|
|
6653
6663
|
report(f"{label.rstrip(':')} scenario passed.")
|
|
6654
6664
|
return 0
|
|
6665
|
+
|
|
6666
|
+
|
|
6667
|
+
def replaced_session_probe(results: dict):
|
|
6668
|
+
"""A `probe` for `handover_old_session` that runs the gates as the replaced session (#506)."""
|
|
6669
|
+
def probe(verify: Path, env: dict, old: str) -> None:
|
|
6670
|
+
queue = mailbox_common_dir(verify) / "keel-chat" / "shift" / "queue" / "verify.json"
|
|
6671
|
+
results["entry"] = json.loads(queue.read_text())
|
|
6672
|
+
results["queue_before"] = queue.read_bytes()
|
|
6673
|
+
as_old = {**env, "CLAUDE_CODE_ENTRYPOINT": "cli", "CLAUDE_CODE_SESSION_ID": old}
|
|
6674
|
+
as_other = {**env, "CLAUDE_CODE_ENTRYPOINT": "cli", "CLAUDE_CODE_SESSION_ID": "0f0f0f0f-aaaa-bbbb-cccc-111122223333"}
|
|
6675
|
+
as_none = {k: v for k, v in env.items() if k != "CLAUDE_CODE_SESSION_ID"}
|
|
6676
|
+
results["start_old"] = run_keel(verify, "gate", "task-start", env=as_old)
|
|
6677
|
+
results["ready_old"] = run_keel(verify, "shift", "ready", "--wake", "again", env=as_old)
|
|
6678
|
+
results["complete_old"] = run_keel(verify, "gate", "task-complete", env=as_old)
|
|
6679
|
+
results["start_other"] = run_keel(verify, "gate", "task-start", env=as_other)
|
|
6680
|
+
results["start_none"] = run_keel(verify, "gate", "task-start", env=as_none)
|
|
6681
|
+
results["guard_exists"] = (verify / "keel" / "guard.json").exists()
|
|
6682
|
+
results["queue_after"] = queue.read_bytes()
|
|
6683
|
+
return probe
|
|
6684
|
+
|
|
6685
|
+
|
|
6686
|
+
def validate_shift_replaced_refuses_scenario() -> int:
|
|
6687
|
+
"""Issue #506: a session a hand-over replaced cannot start a task or hand over again."""
|
|
6688
|
+
label = "shift-replaced-refuses:"
|
|
6689
|
+
results: dict = {}
|
|
6690
|
+
with tempfile.TemporaryDirectory(prefix="keel-shift-506b-") as raw:
|
|
6691
|
+
try:
|
|
6692
|
+
handover_old_session(Path(raw), Path("rtl"), Path("verify"), probe=replaced_session_probe(results))
|
|
6693
|
+
except RuntimeError as error:
|
|
6694
|
+
report(f"{label} {error}")
|
|
6695
|
+
return 1
|
|
6696
|
+
entry = results.get("entry", {})
|
|
6697
|
+
if entry.get("state") != "delivered" or not entry.get("new_session"):
|
|
6698
|
+
report(f"{label} the fixture did not deliver a hand-over: {entry!r}")
|
|
6699
|
+
return 1
|
|
6700
|
+
start = results["start_old"].stdout
|
|
6701
|
+
for needle in ("Status: fail", "Problem:", "handed over", "verify", entry["new_session"]):
|
|
6702
|
+
if needle not in start:
|
|
6703
|
+
report(f"{label} task-start as the replaced session lacks {needle!r}: {start!r}")
|
|
6704
|
+
return 1
|
|
6705
|
+
ready = results["ready_old"]
|
|
6706
|
+
if ready.returncode == 0:
|
|
6707
|
+
report(f"{label} shift ready as the replaced session exited 0: {ready.stdout!r}")
|
|
6708
|
+
return 1
|
|
6709
|
+
for needle in ("verify", entry["new_session"]):
|
|
6710
|
+
if needle not in ready.stderr + ready.stdout:
|
|
6711
|
+
report(f"{label} shift ready does not name {needle!r}: {ready.stderr!r}")
|
|
6712
|
+
return 1
|
|
6713
|
+
if results["guard_exists"]:
|
|
6714
|
+
report(f"{label} task-start wrote a guard manifest for the replaced session.")
|
|
6715
|
+
return 1
|
|
6716
|
+
if results["queue_after"] != results["queue_before"]:
|
|
6717
|
+
report(f"{label} the hand-over entry changed after the refused commands.")
|
|
6718
|
+
return 1
|
|
6719
|
+
report("shift-replaced-refuses scenario passed.")
|
|
6720
|
+
return 0
|
|
6721
|
+
|
|
6722
|
+
|
|
6723
|
+
def validate_shift_unreplaced_not_refused_scenario() -> int:
|
|
6724
|
+
"""Issue #506: another session, no session, and task-complete are not refused for it."""
|
|
6725
|
+
label = "shift-unreplaced-not-refused:"
|
|
6726
|
+
results: dict = {}
|
|
6727
|
+
with tempfile.TemporaryDirectory(prefix="keel-shift-506c-") as raw:
|
|
6728
|
+
try:
|
|
6729
|
+
handover_old_session(Path(raw), Path("rtl"), Path("verify"), probe=replaced_session_probe(results))
|
|
6730
|
+
except RuntimeError as error:
|
|
6731
|
+
report(f"{label} {error}")
|
|
6732
|
+
return 1
|
|
6733
|
+
new_session = results["entry"]["new_session"]
|
|
6734
|
+
for what in ("start_other", "start_none", "complete_old"):
|
|
6735
|
+
shown = results[what].stdout + results[what].stderr
|
|
6736
|
+
if "handed over" in shown:
|
|
6737
|
+
report(f"{label} {what} carries the replaced-session wording: {shown!r}")
|
|
6738
|
+
return 1
|
|
6739
|
+
if new_session in shown:
|
|
6740
|
+
report(f"{label} {what} names the new session: {shown!r}")
|
|
6741
|
+
return 1
|
|
6742
|
+
report("shift-unreplaced-not-refused scenario passed.")
|
|
6743
|
+
return 0
|
|
6744
|
+
|
|
6745
|
+
|
|
6746
|
+
def validate_shift_replaced_told_scenario() -> int:
|
|
6747
|
+
"""Issue #506: the replaced session is told first, when it starts and when it is prompted."""
|
|
6748
|
+
label = "shift-replaced-told:"
|
|
6749
|
+
seen: dict = {}
|
|
6750
|
+
|
|
6751
|
+
def probe(verify: Path, env: dict, old: str) -> None:
|
|
6752
|
+
queue = mailbox_common_dir(verify) / "keel-chat" / "shift" / "queue" / "verify.json"
|
|
6753
|
+
seen["new_session"] = json.loads(queue.read_text())["new_session"]
|
|
6754
|
+
for event, extra in (("session-start", {"source": "resume"}), ("user-prompt-submit", {"prompt": "are you still there"})):
|
|
6755
|
+
for who, session_id in (("old", old), ("other", "0f0f0f0f-aaaa-bbbb-cccc-111122223333")):
|
|
6756
|
+
payload = {"session_id": session_id, "cwd": str(verify), "hook_event_name": event, **extra}
|
|
6757
|
+
ran = subprocess.run(
|
|
6758
|
+
["node", str(ROOT / "bin" / "keel.js"), "chat", "hook", event],
|
|
6759
|
+
cwd=verify, env=env, input=json.dumps(payload), text=True, capture_output=True, check=False,
|
|
6760
|
+
)
|
|
6761
|
+
try:
|
|
6762
|
+
context = json.loads(ran.stdout or "{}").get("hookSpecificOutput", {}).get("additionalContext", "")
|
|
6763
|
+
except ValueError:
|
|
6764
|
+
context = ran.stdout
|
|
6765
|
+
seen[(event, who)] = (ran.returncode, context)
|
|
6766
|
+
|
|
6767
|
+
with tempfile.TemporaryDirectory(prefix="keel-shift-506d-") as raw:
|
|
6768
|
+
try:
|
|
6769
|
+
handover_old_session(Path(raw), Path("rtl"), Path("verify"), probe=probe)
|
|
6770
|
+
except RuntimeError as error:
|
|
6771
|
+
report(f"{label} {error}")
|
|
6772
|
+
return 1
|
|
6773
|
+
for event in ("session-start", "user-prompt-submit"):
|
|
6774
|
+
code, context = seen[(event, "old")]
|
|
6775
|
+
if code != 0:
|
|
6776
|
+
report(f"{label} the {event} hook exited {code} for the old session.")
|
|
6777
|
+
return 1
|
|
6778
|
+
first = context.splitlines()[0] if context else ""
|
|
6779
|
+
for needle in ("handed over", "verify", seen["new_session"], "Tell the user"):
|
|
6780
|
+
if needle not in first:
|
|
6781
|
+
report(f"{label} the {event} context for the old session does not start with {needle!r}: {context!r}")
|
|
6782
|
+
return 1
|
|
6783
|
+
_, other = seen[(event, "other")]
|
|
6784
|
+
if "handed over" in other:
|
|
6785
|
+
report(f"{label} the {event} context for another session carries the notice: {other!r}")
|
|
6786
|
+
return 1
|
|
6787
|
+
report("shift-replaced-told scenario passed.")
|
|
6788
|
+
return 0
|
package/src/core/chat/notice.js
CHANGED
|
@@ -725,6 +725,18 @@ function hook(event, input, { mail = false } = {}) {
|
|
|
725
725
|
return { code: 0, stdout: `${JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", watchPaths: [watched] } })}\n` };
|
|
726
726
|
}
|
|
727
727
|
if (!where || !role) return languageLine ? promptOutput(languageLine) : { code: 0 };
|
|
728
|
+
// A session a hand-over replaced is told first, whatever else is announced
|
|
729
|
+
// (#506 D3). The record is all that is read; a failure says nothing.
|
|
730
|
+
let replacedLine = null;
|
|
731
|
+
if (event === "session-start" || event === "user-prompt-submit") {
|
|
732
|
+
try {
|
|
733
|
+
const shift = require("../shift");
|
|
734
|
+
const info = shift.replacedBy(where, payload.session_id || process.env.CLAUDE_CODE_SESSION_ID);
|
|
735
|
+
replacedLine = info ? shift.replacedNotice(info) : null;
|
|
736
|
+
} catch {
|
|
737
|
+
replacedLine = null;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
728
740
|
const file = sessionFile(where, payload);
|
|
729
741
|
const session = file && fs.existsSync(file) ? store.readJsonFile(file) : null;
|
|
730
742
|
if (event === "session-end" && file) fs.rmSync(file, { force: true });
|
|
@@ -746,12 +758,12 @@ function hook(event, input, { mail = false } = {}) {
|
|
|
746
758
|
const output = {
|
|
747
759
|
hookSpecificOutput: { hookEventName: "SessionStart", watchPaths: [ensureSignal(where, role), ensureWorktreeSignal(where)] },
|
|
748
760
|
};
|
|
749
|
-
const context = [bridgeLine(where), text].filter(Boolean).join("\n");
|
|
761
|
+
const context = [replacedLine, bridgeLine(where), text].filter(Boolean).join("\n");
|
|
750
762
|
if (context) output.hookSpecificOutput.additionalContext = context;
|
|
751
763
|
return { code: 0, stdout: `${JSON.stringify(output)}\n` };
|
|
752
764
|
}
|
|
753
765
|
if (event === "user-prompt-submit") {
|
|
754
|
-
const context = [languageLine, text].filter(Boolean).join("\n");
|
|
766
|
+
const context = [replacedLine, languageLine, text].filter(Boolean).join("\n");
|
|
755
767
|
return context ? promptOutput(context) : { code: 0 };
|
|
756
768
|
}
|
|
757
769
|
// file-changed
|
package/src/core/gates.js
CHANGED
|
@@ -2377,7 +2377,14 @@ function runGate(repo, stage, options) {
|
|
|
2377
2377
|
if (!GATE_STAGES.has(stage)) {
|
|
2378
2378
|
throw new GateInputError(`unsupported gate stage: ${stage}`);
|
|
2379
2379
|
}
|
|
2380
|
-
if (stage === "task-start")
|
|
2380
|
+
if (stage === "task-start") {
|
|
2381
|
+
// A session a hand-over replaced begins no new work (#506 D4).
|
|
2382
|
+
const replaced = require("./shift").replacedNoticeHere(repo);
|
|
2383
|
+
if (replaced) {
|
|
2384
|
+
return gateResult("task-start", "fail", options.change || "(none)", [], [problem("session-replaced", replaced)]);
|
|
2385
|
+
}
|
|
2386
|
+
return taskStart(repo, options);
|
|
2387
|
+
}
|
|
2381
2388
|
if (stage === "task-complete") return taskComplete(repo, options);
|
|
2382
2389
|
return changeClose(repo, options);
|
|
2383
2390
|
}
|
package/src/core/shift.js
CHANGED
|
@@ -458,6 +458,8 @@ function awaitClear(pid, timeoutMs) {
|
|
|
458
458
|
}
|
|
459
459
|
|
|
460
460
|
function ready(where, options) {
|
|
461
|
+
const replaced = replacedNoticeHere(where.worktree);
|
|
462
|
+
if (replaced) throw new ShiftError(replaced);
|
|
461
463
|
const role = readyRole(where, options);
|
|
462
464
|
if (options.wake && !role) {
|
|
463
465
|
throw new ShiftError("--wake wakes a chat role, and this worktree has none: bind one with `keel chat role --set <name>`, or name it with --role.");
|
|
@@ -536,6 +538,34 @@ function handOffs(where) {
|
|
|
536
538
|
.map((name) => store.readJsonFile(path.join(shiftDir(where), "queue", name))).filter((entry) => entry && entry.role);
|
|
537
539
|
}
|
|
538
540
|
|
|
541
|
+
// The hand-over that replaced this session, or null (#506 D1). A session is
|
|
542
|
+
// replaced when the role's latest hand-over is `delivered`, names it as the old
|
|
543
|
+
// session and names a new one. Only the record is read: no process, no host.
|
|
544
|
+
function replacedBy(where, sessionId) {
|
|
545
|
+
if (!sessionId) return null;
|
|
546
|
+
const entry = handOffs(where).find((item) => item.state === "delivered" && item.new_session
|
|
547
|
+
&& item.session === sessionId && !String(sessionId).startsWith(item.new_session));
|
|
548
|
+
return entry ? { role: entry.role, newSession: entry.new_session, deliveredAt: entry.delivered_at || null } : null;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// One sentence for every surface that tells or refuses a replaced session (D2).
|
|
552
|
+
function replacedNotice(info) {
|
|
553
|
+
return `This session was handed over for role ${info.role}${info.deliveredAt ? ` at ${info.deliveredAt}` : ""} to session ${info.newSession}: `
|
|
554
|
+
+ "it no longer owns the role and shares its worktree with the new shift. Tell the user before doing anything here; "
|
|
555
|
+
+ "`keel gate task-start` and `keel shift ready` refuse this session, and to use it again the user must end the new shift first.";
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// The notice for the session running this command, or null.
|
|
559
|
+
function replacedNoticeHere(repo, sessionId = process.env.CLAUDE_CODE_SESSION_ID) {
|
|
560
|
+
try {
|
|
561
|
+
const where = store.locate(repo);
|
|
562
|
+
const info = where ? replacedBy(where, sessionId) : null;
|
|
563
|
+
return info ? replacedNotice(info) : null;
|
|
564
|
+
} catch {
|
|
565
|
+
return null;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
539
569
|
const SHIFT_START_TEXT = (role) => `${role}: your new shift starts now. Run keel context, then keel shift resume.`;
|
|
540
570
|
|
|
541
571
|
// The old session has finished when it is gone, stopped (no status), or idle.
|
|
@@ -1761,4 +1791,5 @@ function waitingFor(repo) {
|
|
|
1761
1791
|
}
|
|
1762
1792
|
|
|
1763
1793
|
module.exports = {
|
|
1764
|
-
desktopProcess, foundTranscripts, handOver, handOffRisks, check, describe, runShift, shiftStatus: status, waitingFor
|
|
1794
|
+
desktopProcess, foundTranscripts, handOver, handOffRisks, check, describe, runShift, shiftStatus: status, waitingFor,
|
|
1795
|
+
replacedBy, replacedNotice, replacedNoticeHere };
|