@christang/keel 5.126.0 → 5.128.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.128.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.128.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.128.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.128.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.128.0"
|
|
51
|
+
PROTOCOL_VERSION = "5.128.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
|
|
|
@@ -6782,6 +6788,79 @@ 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
|
+
# The clear must not wait for approval, or the wake lands first and the
|
|
6815
|
+
# app refuses the clear (#319 comment 6138487679).
|
|
6816
|
+
for needle in ("create_scheduled_task", "send_message", "local_test-319", "set_remote_control",
|
|
6817
|
+
"mcp__ccd_session_mgmt__set_remote_control", "mcp__ccd_session_mgmt__clear_session", "refuses"):
|
|
6818
|
+
if needle not in armed.stdout:
|
|
6819
|
+
report(f"{label} the desktop clear hint does not name {needle}: {armed.stdout.strip()}")
|
|
6820
|
+
return 1
|
|
6821
|
+
if "The wake is armed" in armed.stdout:
|
|
6822
|
+
report(f"{label} the desktop clear hint still says the waiter wakes the new session: {armed.stdout.strip()}")
|
|
6823
|
+
return 1
|
|
6824
|
+
resumed = run_keel(verify, "shift", "resume", env=desktop)
|
|
6825
|
+
if "next is R011" not in resumed.stdout:
|
|
6826
|
+
report(f"{label} resume on the desktop app did not print the note: {resumed.stdout.strip()} {resumed.stderr.strip()}")
|
|
6827
|
+
return 1
|
|
6828
|
+
if "set_remote_control" not in resumed.stdout:
|
|
6829
|
+
report(f"{label} resume on the desktop app does not say to turn Remote Control back on: {resumed.stdout.strip()}")
|
|
6830
|
+
return 1
|
|
6831
|
+
|
|
6832
|
+
plain = run_keel(verify, "shift", "ready", "--wake", "verify note: next is R012", env=env)
|
|
6833
|
+
if plain.returncode != 0:
|
|
6834
|
+
report(f"{label} ready --wake outside the desktop app failed: {plain.stderr.strip()}")
|
|
6835
|
+
return 1
|
|
6836
|
+
if "The wake is armed" not in plain.stdout:
|
|
6837
|
+
report(f"{label} outside the desktop app the clear hint no longer says the wake is armed: {plain.stdout.strip()}")
|
|
6838
|
+
return 1
|
|
6839
|
+
for needle in ("send_message", "create_scheduled_task", "mcp__ccd_session_mgmt__clear_session"):
|
|
6840
|
+
if needle in plain.stdout:
|
|
6841
|
+
report(f"{label} outside the desktop app the clear hint names {needle}: {plain.stdout.strip()}")
|
|
6842
|
+
return 1
|
|
6843
|
+
if "Desktop session:" in note.read_text(encoding="utf-8"):
|
|
6844
|
+
report(f"{label} a note written outside the desktop app records a desktop session.")
|
|
6845
|
+
return 1
|
|
6846
|
+
again = run_keel(verify, "shift", "resume", env=env)
|
|
6847
|
+
if "set_remote_control" in again.stdout:
|
|
6848
|
+
report(f"{label} resume outside the desktop app names set_remote_control: {again.stdout.strip()}")
|
|
6849
|
+
return 1
|
|
6850
|
+
|
|
6851
|
+
for relative in ("docs/shift-change.md", "docs/shift-change.zh-CN.md"):
|
|
6852
|
+
text = (ROOT / relative).read_text(encoding="utf-8")
|
|
6853
|
+
for needle in ("send_message", "set_remote_control", "mcp__ccd_session_mgmt__clear_session"):
|
|
6854
|
+
if needle not in text:
|
|
6855
|
+
report(f"{label} {relative} does not name {needle} for the desktop app.")
|
|
6856
|
+
return 1
|
|
6857
|
+
if "shift-desktop-wake" not in {name for name, _ in SCENARIOS}:
|
|
6858
|
+
report(f"{label} scenario is not registered.")
|
|
6859
|
+
return 1
|
|
6860
|
+
report("shift-desktop-wake scenario passed.")
|
|
6861
|
+
return 0
|
|
6862
|
+
|
|
6863
|
+
|
|
6785
6864
|
def validate_shift_without_role_scenario() -> int:
|
|
6786
6865
|
"""Owner's remark of 2026-10-05: a shift change needs no chat role.
|
|
6787
6866
|
|
|
@@ -40208,6 +40287,7 @@ SCENARIOS: tuple = (
|
|
|
40208
40287
|
("role-drift", validate_role_drift_scenario),
|
|
40209
40288
|
("host-run-session", validate_host_run_session_scenario),
|
|
40210
40289
|
("shift-without-role", validate_shift_without_role_scenario),
|
|
40290
|
+
("shift-desktop-wake", validate_shift_desktop_wake_scenario),
|
|
40211
40291
|
("resource-lock", validate_resource_lock_scenario),
|
|
40212
40292
|
("chat-supersedes", validate_chat_supersedes_scenario),
|
|
40213
40293
|
("chat-ack", validate_chat_ack_scenario),
|
package/src/core/shift.js
CHANGED
|
@@ -366,6 +366,13 @@ 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) {
|
|
@@ -387,10 +394,12 @@ function ready(where, options) {
|
|
|
387
394
|
const text = readNoteText(options).replace(/\s+$/, "");
|
|
388
395
|
if (!text.trim()) throw new ShiftError("keel shift ready needs the shift note: give it as text, with --file, or on stdin.");
|
|
389
396
|
const stamp = store.isoLocal(new Date());
|
|
397
|
+
const desktop = desktopSession();
|
|
390
398
|
const head = [
|
|
391
399
|
`# Shift note: ${role || path.basename(where.worktree)}`,
|
|
392
400
|
"",
|
|
393
401
|
`Written ${stamp} in ${result.worktree}.`,
|
|
402
|
+
desktop ? `Desktop session: ${desktop}.` : "",
|
|
394
403
|
// A shift the role started itself; the patrol may nudge it to resume (#307 D4).
|
|
395
404
|
options.wake ? "Self-initiated: this shift armed `keel shift ready --wake`." : "",
|
|
396
405
|
!role ? `Started by hand: ${options.forceReason}.` : "",
|
|
@@ -413,7 +422,7 @@ function ready(where, options) {
|
|
|
413
422
|
}
|
|
414
423
|
}
|
|
415
424
|
const waiter = options.wake ? armWake(where, role, since) : null;
|
|
416
|
-
return { role: role || null, note, closed: open.map((todo) => todo.id), waiter, startedBy: role ? null : options.forceReason };
|
|
425
|
+
return { role: role || null, note, closed: open.map((todo) => todo.id), waiter, startedBy: role ? null : options.forceReason, desktop };
|
|
417
426
|
}
|
|
418
427
|
|
|
419
428
|
// --- the one-shot wake (#293) -------------------------------------------------------
|
|
@@ -733,7 +742,15 @@ const CLEAR_HINT = [
|
|
|
733
742
|
function clearHint(result) {
|
|
734
743
|
let last;
|
|
735
744
|
if (!result.role) last = `Without a chat role nothing wakes the new session; ${result.startedBy} — tell it to run \`keel shift resume\`.`;
|
|
736
|
-
else if (result.waiter) {
|
|
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. Unattended, this needs two `permissions.allow` entries: `mcp__ccd_session_mgmt__set_remote_control` to turn Remote Control back on, "
|
|
752
|
+
+ "and `mcp__ccd_session_mgmt__clear_session`, because a clear left waiting for approval lets the wake arrive first and the app then refuses it.";
|
|
753
|
+
} else if (result.waiter) {
|
|
737
754
|
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.`;
|
|
738
755
|
} else if (result.closed.length) last = "The coordinator's `keel shift start` then wakes the new shift.";
|
|
739
756
|
else {
|
|
@@ -813,7 +830,11 @@ function runShift(argv) {
|
|
|
813
830
|
// A new coordinator learns whom its previous shift left unstarted (#289 D2).
|
|
814
831
|
const waiting = (result.waiting || []).map((w) => w.role);
|
|
815
832
|
const still = waiting.length ? `\n\nStill waiting for \`keel shift start\`: ${waiting.join(", ")}.` : "";
|
|
816
|
-
|
|
833
|
+
// A clear on the desktop app does not keep Remote Control (#319 D4).
|
|
834
|
+
const remote = desktopSession()
|
|
835
|
+
? "\n\nOn the Claude desktop app Remote Control does not survive a clear: turn it back on with `set_remote_control(\"self\", true)`."
|
|
836
|
+
: "";
|
|
837
|
+
out(result, `${result.text.replace(/\s+$/, "")}\n\n(The note moved to ${result.note}.)${still}${remind ? `\n\n${patrolReminder(patrol)}` : ""}${remote}`);
|
|
817
838
|
return 0;
|
|
818
839
|
}
|
|
819
840
|
case "history": {
|