@christang/keel 5.125.0 → 5.127.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/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.127.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.127.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.127.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.127.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.127.0"
|
|
51
|
+
PROTOCOL_VERSION = "5.127.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
|
|
@@ -2201,11 +2201,17 @@ def mailbox_common_dir(repo: Path) -> Path:
|
|
|
2201
2201
|
|
|
2202
2202
|
|
|
2203
2203
|
CHAT_ROLE_VARIABLES = ("KEEL_CHAT_ROLE", "KEEL_MAIL_ROLE")
|
|
2204
|
+
# The desktop app's session markers (#319 D5): a run inside it must not change
|
|
2205
|
+
# what shift scenarios see.
|
|
2206
|
+
DESKTOP_HOST_VARIABLES = ("CLAUDE_CODE_ENTRYPOINT", "CLAUDE_CODE_HOST_SESSION_ID")
|
|
2204
2207
|
|
|
2205
2208
|
|
|
2206
2209
|
def chat_environment(**extra: str) -> dict[str, str]:
|
|
2207
|
-
"""The test process's environment without any inherited chat role."""
|
|
2208
|
-
env = {
|
|
2210
|
+
"""The test process's environment without any inherited chat role or desktop host."""
|
|
2211
|
+
env = {
|
|
2212
|
+
key: value for key, value in os.environ.items()
|
|
2213
|
+
if key not in CHAT_ROLE_VARIABLES and key not in DESKTOP_HOST_VARIABLES
|
|
2214
|
+
}
|
|
2209
2215
|
env.update(extra)
|
|
2210
2216
|
return env
|
|
2211
2217
|
|
|
@@ -5963,7 +5969,7 @@ def validate_shift_role_elsewhere_scenario() -> int:
|
|
|
5963
5969
|
if started.returncode != 0:
|
|
5964
5970
|
report(f"{label} keel shift start verify was refused: {started.stderr}")
|
|
5965
5971
|
return 1
|
|
5966
|
-
lone = shift(loose2, "ready", "nothing requested here")
|
|
5972
|
+
lone = shift(loose2, "ready", "--force-reason", "the coordinator opens it", "nothing requested here")
|
|
5967
5973
|
if lone.returncode != 0:
|
|
5968
5974
|
report(f"{label} ready in an unbound worktree with no open request failed: {lone.stderr}")
|
|
5969
5975
|
return 1
|
|
@@ -6782,6 +6788,76 @@ def validate_shift_change_scenario() -> int:
|
|
|
6782
6788
|
return 0
|
|
6783
6789
|
|
|
6784
6790
|
|
|
6791
|
+
def validate_shift_desktop_wake_scenario() -> int:
|
|
6792
|
+
"""Issue #319: on the desktop app a clear starts no session until a prompt.
|
|
6793
|
+
|
|
6794
|
+
`ready --wake` there records the session id and prints the partner recipe
|
|
6795
|
+
(a one-shot scheduled task that `send_message`s the session, which turns
|
|
6796
|
+
Remote Control back on first) instead of promising the waiter wakes it;
|
|
6797
|
+
`resume` there says to restore Remote Control. Elsewhere nothing changes.
|
|
6798
|
+
"""
|
|
6799
|
+
label = "shift-desktop-wake:"
|
|
6800
|
+
with tempfile.TemporaryDirectory(prefix="keel-shift-desktop-") as raw:
|
|
6801
|
+
base = Path(raw)
|
|
6802
|
+
_rtl, verify, env, _ = shift_scratch(base)
|
|
6803
|
+
env = {**env, "KEEL_SHIFT_WAKE_TIMEOUT_MS": "2000"}
|
|
6804
|
+
desktop = {**env, "CLAUDE_CODE_ENTRYPOINT": "claude-desktop", "CLAUDE_CODE_HOST_SESSION_ID": "local_test-319"}
|
|
6805
|
+
note = mailbox_common_dir(verify) / "keel-chat" / "shift" / "verify.md"
|
|
6806
|
+
|
|
6807
|
+
armed = run_keel(verify, "shift", "ready", "--wake", "verify note: next is R011", env=desktop)
|
|
6808
|
+
if armed.returncode != 0:
|
|
6809
|
+
report(f"{label} ready --wake on the desktop app failed: {armed.stderr.strip()}")
|
|
6810
|
+
return 1
|
|
6811
|
+
if "Desktop session: local_test-319" not in note.read_text(encoding="utf-8"):
|
|
6812
|
+
report(f"{label} the note does not record the desktop session id.")
|
|
6813
|
+
return 1
|
|
6814
|
+
for needle in ("create_scheduled_task", "send_message", "local_test-319", "set_remote_control", "mcp__ccd_session_mgmt__set_remote_control"):
|
|
6815
|
+
if needle not in armed.stdout:
|
|
6816
|
+
report(f"{label} the desktop clear hint does not name {needle}: {armed.stdout.strip()}")
|
|
6817
|
+
return 1
|
|
6818
|
+
if "The wake is armed" in armed.stdout:
|
|
6819
|
+
report(f"{label} the desktop clear hint still says the waiter wakes the new session: {armed.stdout.strip()}")
|
|
6820
|
+
return 1
|
|
6821
|
+
resumed = run_keel(verify, "shift", "resume", env=desktop)
|
|
6822
|
+
if "next is R011" not in resumed.stdout:
|
|
6823
|
+
report(f"{label} resume on the desktop app did not print the note: {resumed.stdout.strip()} {resumed.stderr.strip()}")
|
|
6824
|
+
return 1
|
|
6825
|
+
if "set_remote_control" not in resumed.stdout:
|
|
6826
|
+
report(f"{label} resume on the desktop app does not say to turn Remote Control back on: {resumed.stdout.strip()}")
|
|
6827
|
+
return 1
|
|
6828
|
+
|
|
6829
|
+
plain = run_keel(verify, "shift", "ready", "--wake", "verify note: next is R012", env=env)
|
|
6830
|
+
if plain.returncode != 0:
|
|
6831
|
+
report(f"{label} ready --wake outside the desktop app failed: {plain.stderr.strip()}")
|
|
6832
|
+
return 1
|
|
6833
|
+
if "The wake is armed" not in plain.stdout:
|
|
6834
|
+
report(f"{label} outside the desktop app the clear hint no longer says the wake is armed: {plain.stdout.strip()}")
|
|
6835
|
+
return 1
|
|
6836
|
+
for needle in ("send_message", "create_scheduled_task"):
|
|
6837
|
+
if needle in plain.stdout:
|
|
6838
|
+
report(f"{label} outside the desktop app the clear hint names {needle}: {plain.stdout.strip()}")
|
|
6839
|
+
return 1
|
|
6840
|
+
if "Desktop session:" in note.read_text(encoding="utf-8"):
|
|
6841
|
+
report(f"{label} a note written outside the desktop app records a desktop session.")
|
|
6842
|
+
return 1
|
|
6843
|
+
again = run_keel(verify, "shift", "resume", env=env)
|
|
6844
|
+
if "set_remote_control" in again.stdout:
|
|
6845
|
+
report(f"{label} resume outside the desktop app names set_remote_control: {again.stdout.strip()}")
|
|
6846
|
+
return 1
|
|
6847
|
+
|
|
6848
|
+
for relative in ("docs/shift-change.md", "docs/shift-change.zh-CN.md"):
|
|
6849
|
+
text = (ROOT / relative).read_text(encoding="utf-8")
|
|
6850
|
+
for needle in ("send_message", "set_remote_control"):
|
|
6851
|
+
if needle not in text:
|
|
6852
|
+
report(f"{label} {relative} does not name {needle} for the desktop app.")
|
|
6853
|
+
return 1
|
|
6854
|
+
if "shift-desktop-wake" not in {name for name, _ in SCENARIOS}:
|
|
6855
|
+
report(f"{label} scenario is not registered.")
|
|
6856
|
+
return 1
|
|
6857
|
+
report("shift-desktop-wake scenario passed.")
|
|
6858
|
+
return 0
|
|
6859
|
+
|
|
6860
|
+
|
|
6785
6861
|
def validate_shift_without_role_scenario() -> int:
|
|
6786
6862
|
"""Owner's remark of 2026-10-05: a shift change needs no chat role.
|
|
6787
6863
|
|
|
@@ -6800,14 +6876,38 @@ def validate_shift_without_role_scenario() -> int:
|
|
|
6800
6876
|
return chat_json(run_keel(repo, "context", "--json", env=env))
|
|
6801
6877
|
|
|
6802
6878
|
before = context().get("status")
|
|
6803
|
-
|
|
6879
|
+
# Issue #317: nothing wakes the session after a clear here, so plain
|
|
6880
|
+
# `ready` is refused and points to a role and --wake.
|
|
6881
|
+
plain = run_keel(repo, "shift", "ready", "next: rerun R007", env=env)
|
|
6882
|
+
if plain.returncode != 1:
|
|
6883
|
+
report(f"{label} plain ready in a worktree without a chat role exited {plain.returncode}, not 1: {plain.stdout.strip()}")
|
|
6884
|
+
return 1
|
|
6885
|
+
if "keel chat role --set" not in plain.stderr:
|
|
6886
|
+
report(f"{label} the refusal does not name `keel chat role --set`: {plain.stderr.strip()}")
|
|
6887
|
+
return 1
|
|
6888
|
+
if "--wake" not in plain.stderr:
|
|
6889
|
+
report(f"{label} the refusal does not name --wake: {plain.stderr.strip()}")
|
|
6890
|
+
return 1
|
|
6891
|
+
if list((common / "shift" / "worktree").glob("*.md")):
|
|
6892
|
+
report(f"{label} the refused ready stored a worktree note.")
|
|
6893
|
+
return 1
|
|
6894
|
+
ready = run_keel(repo, "shift", "ready", "--force-reason", "the owner opens it", "next: rerun R007", env=env)
|
|
6804
6895
|
if ready.returncode != 0:
|
|
6805
|
-
report(f"{label} keel shift ready refused in a worktree without a chat role: {ready.stderr.strip()}")
|
|
6896
|
+
report(f"{label} keel shift ready --force-reason refused in a worktree without a chat role: {ready.stderr.strip()}")
|
|
6897
|
+
return 1
|
|
6898
|
+
if "the owner opens it" not in ready.stdout:
|
|
6899
|
+
report(f"{label} the clear hint does not name who starts the new session: {ready.stdout.strip()}")
|
|
6806
6900
|
return 1
|
|
6807
6901
|
notes = list((common / "shift" / "worktree").glob("*.md"))
|
|
6808
6902
|
if len(notes) != 1:
|
|
6809
6903
|
report(f"{label} ready kept {len(notes)} worktree notes under keel-chat/shift/worktree/, not one.")
|
|
6810
6904
|
return 1
|
|
6905
|
+
if "Started by hand: the owner opens it" not in notes[0].read_text(encoding="utf-8"):
|
|
6906
|
+
report(f"{label} the note does not record who starts the new session.")
|
|
6907
|
+
return 1
|
|
6908
|
+
if "Left as is" in notes[0].read_text(encoding="utf-8"):
|
|
6909
|
+
report(f"{label} the note lists loose ends left as is when the check found none.")
|
|
6910
|
+
return 1
|
|
6811
6911
|
text = run_keel(repo, "context", env=env).stdout
|
|
6812
6912
|
if "keel shift resume" not in text:
|
|
6813
6913
|
report(f"{label} keel context does not point to the waiting note: {text.strip()}")
|
|
@@ -6838,7 +6938,7 @@ def validate_shift_without_role_scenario() -> int:
|
|
|
6838
6938
|
|
|
6839
6939
|
# Issue #261: `--file -` is stdin, and an unreadable file is a named refusal.
|
|
6840
6940
|
missing = base / "missing-note.md"
|
|
6841
|
-
refused = run_keel(repo, "shift", "ready", "--file", str(missing), env=env)
|
|
6941
|
+
refused = run_keel(repo, "shift", "ready", "--force-reason", "the owner opens it", "--file", str(missing), env=env)
|
|
6842
6942
|
if re.search(r"^\s+at ", refused.stderr, re.M):
|
|
6843
6943
|
report(f"{label} an unreadable --file escaped as an uncaught exception: {refused.stderr.strip()}")
|
|
6844
6944
|
return 1
|
|
@@ -6852,7 +6952,7 @@ def validate_shift_without_role_scenario() -> int:
|
|
|
6852
6952
|
report(f"{label} the refusal of an unreadable --file does not name the path: {refused.stderr.strip()}")
|
|
6853
6953
|
return 1
|
|
6854
6954
|
piped = subprocess.run(
|
|
6855
|
-
["node", str(ROOT / "bin" / "keel.js"), "shift", "ready", "--file", "-"],
|
|
6955
|
+
["node", str(ROOT / "bin" / "keel.js"), "shift", "ready", "--force-reason", "the owner opens it", "--file", "-"],
|
|
6856
6956
|
cwd=repo, env=env, input="next: from stdin via --file -\n",
|
|
6857
6957
|
text=True, encoding="utf-8", errors="replace", capture_output=True, check=False,
|
|
6858
6958
|
)
|
|
@@ -6868,9 +6968,17 @@ def validate_shift_without_role_scenario() -> int:
|
|
|
6868
6968
|
return 1
|
|
6869
6969
|
|
|
6870
6970
|
for relative, needle in (("docs/shift-change.md", "no chat role"), ("docs/shift-change.zh-CN.md", "不绑定聊天角色")):
|
|
6871
|
-
|
|
6971
|
+
text = (ROOT / relative).read_text(encoding="utf-8")
|
|
6972
|
+
if needle not in text:
|
|
6872
6973
|
report(f"{label} {relative} does not say a chat role is optional ({needle!r}).")
|
|
6873
6974
|
return 1
|
|
6975
|
+
intro = text.split("## ", 1)[0]
|
|
6976
|
+
if "--wake" not in intro:
|
|
6977
|
+
report(f"{label} {relative} does not say an unbound self-shift needs --wake.")
|
|
6978
|
+
return 1
|
|
6979
|
+
if "--force-reason" not in intro:
|
|
6980
|
+
report(f"{label} {relative} does not say --force-reason files an unbound self-shift by hand.")
|
|
6981
|
+
return 1
|
|
6874
6982
|
if "shift-without-role" not in {name for name, _ in SCENARIOS}:
|
|
6875
6983
|
report(f"{label} scenario is not registered.")
|
|
6876
6984
|
return 1
|
|
@@ -40176,6 +40284,7 @@ SCENARIOS: tuple = (
|
|
|
40176
40284
|
("role-drift", validate_role_drift_scenario),
|
|
40177
40285
|
("host-run-session", validate_host_run_session_scenario),
|
|
40178
40286
|
("shift-without-role", validate_shift_without_role_scenario),
|
|
40287
|
+
("shift-desktop-wake", validate_shift_desktop_wake_scenario),
|
|
40179
40288
|
("resource-lock", validate_resource_lock_scenario),
|
|
40180
40289
|
("chat-supersedes", validate_chat_supersedes_scenario),
|
|
40181
40290
|
("chat-ack", validate_chat_ack_scenario),
|
package/src/core/shift.js
CHANGED
|
@@ -366,11 +366,26 @@ function readyRole(where, options) {
|
|
|
366
366
|
return bound;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
+
// The Claude desktop app's session id, or null elsewhere (#319 D1). There a
|
|
370
|
+
// clear starts no session until a prompt arrives.
|
|
371
|
+
function desktopSession() {
|
|
372
|
+
const id = process.env.CLAUDE_CODE_HOST_SESSION_ID;
|
|
373
|
+
return process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop" && id ? id : null;
|
|
374
|
+
}
|
|
375
|
+
|
|
369
376
|
function ready(where, options) {
|
|
370
377
|
const role = readyRole(where, options);
|
|
371
378
|
if (options.wake && !role) {
|
|
372
379
|
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.");
|
|
373
380
|
}
|
|
381
|
+
// No request can name an unbound worktree, so its `ready` is a self-shift
|
|
382
|
+
// that nothing wakes after the clear (#317 D1).
|
|
383
|
+
if (!role && !options.forceReason) {
|
|
384
|
+
throw new ShiftError(
|
|
385
|
+
"This worktree has no chat role, so nothing will start the session that follows a clear: no request can name it, and --wake needs a role. "
|
|
386
|
+
+ "Bind one with `keel chat role --set <name>` and run `keel shift ready --wake`, or give --force-reason \"<who starts the new session>\"."
|
|
387
|
+
);
|
|
388
|
+
}
|
|
374
389
|
const since = Date.now();
|
|
375
390
|
const result = check(where, role);
|
|
376
391
|
if (!result.ready && !options.forceReason) {
|
|
@@ -379,13 +394,16 @@ function ready(where, options) {
|
|
|
379
394
|
const text = readNoteText(options).replace(/\s+$/, "");
|
|
380
395
|
if (!text.trim()) throw new ShiftError("keel shift ready needs the shift note: give it as text, with --file, or on stdin.");
|
|
381
396
|
const stamp = store.isoLocal(new Date());
|
|
397
|
+
const desktop = desktopSession();
|
|
382
398
|
const head = [
|
|
383
399
|
`# Shift note: ${role || path.basename(where.worktree)}`,
|
|
384
400
|
"",
|
|
385
401
|
`Written ${stamp} in ${result.worktree}.`,
|
|
402
|
+
desktop ? `Desktop session: ${desktop}.` : "",
|
|
386
403
|
// A shift the role started itself; the patrol may nudge it to resume (#307 D4).
|
|
387
404
|
options.wake ? "Self-initiated: this shift armed `keel shift ready --wake`." : "",
|
|
388
|
-
|
|
405
|
+
!role ? `Started by hand: ${options.forceReason}.` : "",
|
|
406
|
+
options.forceReason && result.items.length ? `\nLeft as is (${options.forceReason}):\n${result.items.map((item) => `- ${item.kind}: ${item.detail}`).join("\n")}` : "",
|
|
389
407
|
"",
|
|
390
408
|
].join("\n");
|
|
391
409
|
const note = ownNotePath(where, role);
|
|
@@ -404,7 +422,7 @@ function ready(where, options) {
|
|
|
404
422
|
}
|
|
405
423
|
}
|
|
406
424
|
const waiter = options.wake ? armWake(where, role, since) : null;
|
|
407
|
-
return { role: role || null, note, closed: open.map((todo) => todo.id), waiter };
|
|
425
|
+
return { role: role || null, note, closed: open.map((todo) => todo.id), waiter, startedBy: role ? null : options.forceReason, desktop };
|
|
408
426
|
}
|
|
409
427
|
|
|
410
428
|
// --- the one-shot wake (#293) -------------------------------------------------------
|
|
@@ -723,8 +741,15 @@ const CLEAR_HINT = [
|
|
|
723
741
|
// or — without a chat role — the person who opens it.
|
|
724
742
|
function clearHint(result) {
|
|
725
743
|
let last;
|
|
726
|
-
if (!result.role) last =
|
|
727
|
-
else if (result.waiter) {
|
|
744
|
+
if (!result.role) last = `Without a chat role nothing wakes the new session; ${result.startedBy} — tell it to run \`keel shift resume\`.`;
|
|
745
|
+
else if (result.waiter && result.desktop) {
|
|
746
|
+
// Nothing starts a cleared desktop session but a prompt (#319 D3).
|
|
747
|
+
last = "On the Claude desktop app a clear starts no session until a prompt arrives, so the waiter alone wakes nothing (#319). "
|
|
748
|
+
+ "Before you clear, create a one-shot scheduled task with the host's `create_scheduled_task`, firing a few minutes after the clear, "
|
|
749
|
+
+ `whose prompt calls \`send_message\` to session \`${result.desktop}\` with: "${result.role}: your new shift starts now. `
|
|
750
|
+
+ 'First turn Remote Control back on with set_remote_control("self", true), then run `keel context` and `keel shift resume`." '
|
|
751
|
+
+ "Keel creates no task. Turning Remote Control back on unattended needs `mcp__ccd_session_mgmt__set_remote_control` in `permissions.allow`.";
|
|
752
|
+
} else if (result.waiter) {
|
|
728
753
|
last = `The wake is armed: once ${result.role}'s next session starts (after a clear or a fresh start), it gets one message to run \`keel shift resume\`. The waiter gives up after two hours.`;
|
|
729
754
|
} else if (result.closed.length) last = "The coordinator's `keel shift start` then wakes the new shift.";
|
|
730
755
|
else {
|
|
@@ -804,7 +829,11 @@ function runShift(argv) {
|
|
|
804
829
|
// A new coordinator learns whom its previous shift left unstarted (#289 D2).
|
|
805
830
|
const waiting = (result.waiting || []).map((w) => w.role);
|
|
806
831
|
const still = waiting.length ? `\n\nStill waiting for \`keel shift start\`: ${waiting.join(", ")}.` : "";
|
|
807
|
-
|
|
832
|
+
// A clear on the desktop app does not keep Remote Control (#319 D4).
|
|
833
|
+
const remote = desktopSession()
|
|
834
|
+
? "\n\nOn the Claude desktop app Remote Control does not survive a clear: turn it back on with `set_remote_control(\"self\", true)`."
|
|
835
|
+
: "";
|
|
836
|
+
out(result, `${result.text.replace(/\s+$/, "")}\n\n(The note moved to ${result.note}.)${still}${remind ? `\n\n${patrolReminder(patrol)}` : ""}${remote}`);
|
|
808
837
|
return 0;
|
|
809
838
|
}
|
|
810
839
|
case "history": {
|