@christang/keel 5.128.0 → 5.130.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 +13 -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 +141 -12
- package/src/core/config.js +8 -0
- package/src/core/shift.js +31 -11
package/README.md
CHANGED
|
@@ -182,7 +182,7 @@ because a permission granted in conversation does not survive a context reset. D
|
|
|
182
182
|
`keel/config.yaml` instead:
|
|
183
183
|
|
|
184
184
|
```yaml
|
|
185
|
-
authorize: # accepted names: commit, push, push:<branch glob>, release, archive, continuation, issue:<owner>/<repo>, protocol-refresh, chat-reply:<group>, issue-close:<owner>/<repo>, cleanup:scratch, push-protected:<branch glob>[@<role>]
|
|
185
|
+
authorize: # accepted names: commit, push, push:<branch glob>, release, archive, continuation, issue:<owner>/<repo>, protocol-refresh, chat-reply:<group>, issue-close:<owner>/<repo>, cleanup:scratch, push-protected:<branch glob>[@<role>], shift-restore, self-shift
|
|
186
186
|
- commit
|
|
187
187
|
- push
|
|
188
188
|
```
|
|
@@ -231,6 +231,18 @@ refused. A permission mode that cannot be relied on to ask, `bypassPermissions`
|
|
|
231
231
|
refused too. Declaring it turns the push check on by itself, and a bare `push` beside it is
|
|
232
232
|
refused.
|
|
233
233
|
|
|
234
|
+
`shift-restore` (#319) covers the two things a session started by a shift change on the Claude
|
|
235
|
+
desktop app must do right after `keel shift resume`: turn its own Remote Control back on, and rename
|
|
236
|
+
itself back to its working title. A clear there keeps neither. Without the declaration, the woken
|
|
237
|
+
session reads that restore as another session's request and stops to ask you. It reaches only that
|
|
238
|
+
session, so it takes no scope, and it covers no other session, no clear or archive, and no repository
|
|
239
|
+
action.
|
|
240
|
+
|
|
241
|
+
`self-shift` (#319) is its outgoing counterpart: the four steps `keel shift ready --wake` prints on
|
|
242
|
+
the desktop app once the note is stored — turn the session's own Remote Control off and wait, create
|
|
243
|
+
the one-shot wake task, rename the session, clear it. It does not decide that a shift happens; that
|
|
244
|
+
stays with the task-boundary rule and the coordinator. It takes no scope.
|
|
245
|
+
|
|
234
246
|
`cleanup:scratch` covers removing temporary worktrees and run output under the session's own
|
|
235
247
|
scratchpad, after checking that they are merged and that no process is using them. It never covers
|
|
236
248
|
a branch or another session's files, and like the tracker scopes it is carried, not enforced.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.130.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.130.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.130.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.130.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.130.0"
|
|
51
|
+
PROTOCOL_VERSION = "5.130.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
|
|
@@ -6788,6 +6788,123 @@ def validate_shift_change_scenario() -> int:
|
|
|
6788
6788
|
return 0
|
|
6789
6789
|
|
|
6790
6790
|
|
|
6791
|
+
def validate_self_shift_authorization_scenario() -> int:
|
|
6792
|
+
"""Issue #319: `self-shift` lets a desktop session take its own four steps.
|
|
6793
|
+
|
|
6794
|
+
The name is read and listed by `--doctor`, a scoped form is refused, and a
|
|
6795
|
+
desktop `keel shift ready --wake` says the steps are standing-authorized
|
|
6796
|
+
only when the repository declares it.
|
|
6797
|
+
"""
|
|
6798
|
+
label = "self-shift-authorization:"
|
|
6799
|
+
with tempfile.TemporaryDirectory(prefix="keel-self-shift-") as raw:
|
|
6800
|
+
base = Path(raw)
|
|
6801
|
+
_rtl, verify, env, _ = shift_scratch(base)
|
|
6802
|
+
env = {**env, "KEEL_SHIFT_WAKE_TIMEOUT_MS": "2000"}
|
|
6803
|
+
desktop = {**env, "CLAUDE_CODE_ENTRYPOINT": "claude-desktop", "CLAUDE_CODE_HOST_SESSION_ID": "local_test-319"}
|
|
6804
|
+
config = verify / "keel" / "config.yaml"
|
|
6805
|
+
reason = ("--force-reason", "the fixture config is uncommitted")
|
|
6806
|
+
|
|
6807
|
+
def declare(*entries: str) -> None:
|
|
6808
|
+
write_text(config, "authorize:\n" + "".join(f" - {entry}\n" for entry in entries))
|
|
6809
|
+
|
|
6810
|
+
declare("commit", "self-shift")
|
|
6811
|
+
doctor = run_keel(verify, "--doctor", env=env)
|
|
6812
|
+
if "self-shift" not in doctor.stdout or "unrecognized" in (doctor.stdout + doctor.stderr).lower():
|
|
6813
|
+
report(f"{label} self-shift was not read and listed as a standing authorization: {doctor.stdout.strip()} {doctor.stderr.strip()}")
|
|
6814
|
+
return 1
|
|
6815
|
+
granted = run_keel(verify, "shift", "ready", "--wake", *reason, "verify note: R015", env=desktop)
|
|
6816
|
+
if "Standing-authorized by `self-shift`" not in granted.stdout:
|
|
6817
|
+
report(f"{label} a desktop ready --wake with self-shift declared does not say the steps are standing-authorized: {granted.stdout.strip()} {granted.stderr.strip()}")
|
|
6818
|
+
return 1
|
|
6819
|
+
run_keel(verify, "shift", "resume", env=desktop)
|
|
6820
|
+
|
|
6821
|
+
declare("commit")
|
|
6822
|
+
asked = run_keel(verify, "shift", "ready", "--wake", *reason, "verify note: R016", env=desktop)
|
|
6823
|
+
if "Standing-authorized by `self-shift`" in asked.stdout:
|
|
6824
|
+
report(f"{label} a desktop ready --wake without self-shift says the steps are standing-authorized: {asked.stdout.strip()}")
|
|
6825
|
+
return 1
|
|
6826
|
+
if "self-shift" not in asked.stdout:
|
|
6827
|
+
report(f"{label} a desktop ready --wake without self-shift does not name the declaration that would allow it: {asked.stdout.strip()}")
|
|
6828
|
+
return 1
|
|
6829
|
+
run_keel(verify, "shift", "resume", env=desktop)
|
|
6830
|
+
|
|
6831
|
+
declare("commit", "self-shift:anything")
|
|
6832
|
+
scoped = run_keel(verify, "--doctor", env=env)
|
|
6833
|
+
combined = scoped.stdout + scoped.stderr
|
|
6834
|
+
if "self-shift:anything" not in combined or "commit: authorized" in combined:
|
|
6835
|
+
report(f"{label} a scoped self-shift was not refused by name: {combined.strip()}")
|
|
6836
|
+
return 1
|
|
6837
|
+
|
|
6838
|
+
for relative in ("README.md", "docs/shift-change.md", "docs/shift-change.zh-CN.md"):
|
|
6839
|
+
if "self-shift" not in (ROOT / relative).read_text(encoding="utf-8"):
|
|
6840
|
+
report(f"{label} {relative} does not name self-shift.")
|
|
6841
|
+
return 1
|
|
6842
|
+
if "self-shift-authorization" not in {name for name, _ in SCENARIOS}:
|
|
6843
|
+
report(f"{label} scenario is not registered.")
|
|
6844
|
+
return 1
|
|
6845
|
+
report("self-shift-authorization scenario passed.")
|
|
6846
|
+
return 0
|
|
6847
|
+
|
|
6848
|
+
|
|
6849
|
+
def validate_shift_restore_authorization_scenario() -> int:
|
|
6850
|
+
"""Issue #319: `shift-restore` lets a woken desktop shift restore itself.
|
|
6851
|
+
|
|
6852
|
+
The name is read and listed by `--doctor`, a scoped form is refused, and
|
|
6853
|
+
a desktop `keel shift resume` says the restore is standing-authorized only
|
|
6854
|
+
when the repository declares it.
|
|
6855
|
+
"""
|
|
6856
|
+
label = "shift-restore-authorization:"
|
|
6857
|
+
with tempfile.TemporaryDirectory(prefix="keel-shift-restore-") as raw:
|
|
6858
|
+
base = Path(raw)
|
|
6859
|
+
_rtl, verify, env, _ = shift_scratch(base)
|
|
6860
|
+
env = {**env, "KEEL_SHIFT_WAKE_TIMEOUT_MS": "2000"}
|
|
6861
|
+
desktop = {**env, "CLAUDE_CODE_ENTRYPOINT": "claude-desktop", "CLAUDE_CODE_HOST_SESSION_ID": "local_test-319"}
|
|
6862
|
+
config = verify / "keel" / "config.yaml"
|
|
6863
|
+
|
|
6864
|
+
def declare(*entries: str) -> None:
|
|
6865
|
+
write_text(config, "authorize:\n" + "".join(f" - {entry}\n" for entry in entries))
|
|
6866
|
+
|
|
6867
|
+
declare("commit", "shift-restore")
|
|
6868
|
+
doctor = run_keel(verify, "--doctor", env=env)
|
|
6869
|
+
if "shift-restore" not in doctor.stdout:
|
|
6870
|
+
report(f"{label} keel --doctor does not list shift-restore: {doctor.stdout.strip()} {doctor.stderr.strip()}")
|
|
6871
|
+
return 1
|
|
6872
|
+
if "unrecognized" in (doctor.stdout + doctor.stderr).lower():
|
|
6873
|
+
report(f"{label} shift-restore was not read as a standing authorization: {doctor.stdout.strip()} {doctor.stderr.strip()}")
|
|
6874
|
+
return 1
|
|
6875
|
+
run_keel(verify, "shift", "ready", "--wake", "--force-reason", "the fixture config is uncommitted", "verify note: R013", env=desktop)
|
|
6876
|
+
granted = run_keel(verify, "shift", "resume", env=desktop)
|
|
6877
|
+
if "Standing-authorized by `shift-restore`" not in granted.stdout:
|
|
6878
|
+
report(f"{label} a desktop resume with shift-restore declared does not say it is standing-authorized: {granted.stdout.strip()}")
|
|
6879
|
+
return 1
|
|
6880
|
+
|
|
6881
|
+
declare("commit")
|
|
6882
|
+
run_keel(verify, "shift", "ready", "--wake", "--force-reason", "the fixture config is uncommitted", "verify note: R014", env=desktop)
|
|
6883
|
+
asked = run_keel(verify, "shift", "resume", env=desktop)
|
|
6884
|
+
if "Standing-authorized" in asked.stdout:
|
|
6885
|
+
report(f"{label} a desktop resume without shift-restore says the restore is standing-authorized: {asked.stdout.strip()}")
|
|
6886
|
+
return 1
|
|
6887
|
+
if "shift-restore" not in asked.stdout:
|
|
6888
|
+
report(f"{label} a desktop resume without shift-restore does not name the declaration that would allow it: {asked.stdout.strip()}")
|
|
6889
|
+
return 1
|
|
6890
|
+
|
|
6891
|
+
declare("commit", "shift-restore:anything")
|
|
6892
|
+
scoped = run_keel(verify, "--doctor", env=env)
|
|
6893
|
+
combined = scoped.stdout + scoped.stderr
|
|
6894
|
+
if "shift-restore:anything" not in combined or "commit: authorized" in combined:
|
|
6895
|
+
report(f"{label} a scoped shift-restore was not refused by name: {combined.strip()}")
|
|
6896
|
+
return 1
|
|
6897
|
+
|
|
6898
|
+
if "shift-restore" not in (ROOT / "README.md").read_text(encoding="utf-8"):
|
|
6899
|
+
report(f"{label} README.md does not document shift-restore.")
|
|
6900
|
+
return 1
|
|
6901
|
+
if "shift-restore-authorization" not in {name for name, _ in SCENARIOS}:
|
|
6902
|
+
report(f"{label} scenario is not registered.")
|
|
6903
|
+
return 1
|
|
6904
|
+
report("shift-restore-authorization scenario passed.")
|
|
6905
|
+
return 0
|
|
6906
|
+
|
|
6907
|
+
|
|
6791
6908
|
def validate_shift_desktop_wake_scenario() -> int:
|
|
6792
6909
|
"""Issue #319: on the desktop app a clear starts no session until a prompt.
|
|
6793
6910
|
|
|
@@ -6811,13 +6928,20 @@ def validate_shift_desktop_wake_scenario() -> int:
|
|
|
6811
6928
|
if "Desktop session: local_test-319" not in note.read_text(encoding="utf-8"):
|
|
6812
6929
|
report(f"{label} the note does not record the desktop session id.")
|
|
6813
6930
|
return 1
|
|
6814
|
-
#
|
|
6815
|
-
#
|
|
6816
|
-
for needle in ("create_scheduled_task", "send_message", "local_test-319", "
|
|
6817
|
-
"mcp__ccd_session_mgmt__set_remote_control", "
|
|
6931
|
+
# Remote Control off, then the task, so the wake cannot fire before the
|
|
6932
|
+
# clear; then rename and clear (#319 comments 6143435530, 6144856601).
|
|
6933
|
+
for needle in ("create_scheduled_task", "send_message", "local_test-319", "set_session_title",
|
|
6934
|
+
"mcp__ccd_session_mgmt__set_remote_control", "shift-restore"):
|
|
6818
6935
|
if needle not in armed.stdout:
|
|
6819
6936
|
report(f"{label} the desktop clear hint does not name {needle}: {armed.stdout.strip()}")
|
|
6820
6937
|
return 1
|
|
6938
|
+
off = armed.stdout.find('set_remote_control("self", false)')
|
|
6939
|
+
if off == -1 or off > armed.stdout.find("create_scheduled_task"):
|
|
6940
|
+
report(f"{label} the desktop clear hint does not turn Remote Control off before create_scheduled_task: {armed.stdout.strip()}")
|
|
6941
|
+
return 1
|
|
6942
|
+
if "mcp__ccd_session_mgmt__clear_session" in armed.stdout:
|
|
6943
|
+
report(f"{label} the desktop clear hint still blames approval of clear_session: {armed.stdout.strip()}")
|
|
6944
|
+
return 1
|
|
6821
6945
|
if "The wake is armed" in armed.stdout:
|
|
6822
6946
|
report(f"{label} the desktop clear hint still says the waiter wakes the new session: {armed.stdout.strip()}")
|
|
6823
6947
|
return 1
|
|
@@ -6828,6 +6952,9 @@ def validate_shift_desktop_wake_scenario() -> int:
|
|
|
6828
6952
|
if "set_remote_control" not in resumed.stdout:
|
|
6829
6953
|
report(f"{label} resume on the desktop app does not say to turn Remote Control back on: {resumed.stdout.strip()}")
|
|
6830
6954
|
return 1
|
|
6955
|
+
if "set_session_title" not in resumed.stdout:
|
|
6956
|
+
report(f"{label} resume on the desktop app does not say to rename the session back: {resumed.stdout.strip()}")
|
|
6957
|
+
return 1
|
|
6831
6958
|
|
|
6832
6959
|
plain = run_keel(verify, "shift", "ready", "--wake", "verify note: next is R012", env=env)
|
|
6833
6960
|
if plain.returncode != 0:
|
|
@@ -6836,7 +6963,7 @@ def validate_shift_desktop_wake_scenario() -> int:
|
|
|
6836
6963
|
if "The wake is armed" not in plain.stdout:
|
|
6837
6964
|
report(f"{label} outside the desktop app the clear hint no longer says the wake is armed: {plain.stdout.strip()}")
|
|
6838
6965
|
return 1
|
|
6839
|
-
for needle in ("send_message", "create_scheduled_task", "
|
|
6966
|
+
for needle in ("send_message", "create_scheduled_task", "set_session_title", "shift-restore"):
|
|
6840
6967
|
if needle in plain.stdout:
|
|
6841
6968
|
report(f"{label} outside the desktop app the clear hint names {needle}: {plain.stdout.strip()}")
|
|
6842
6969
|
return 1
|
|
@@ -6844,13 +6971,13 @@ def validate_shift_desktop_wake_scenario() -> int:
|
|
|
6844
6971
|
report(f"{label} a note written outside the desktop app records a desktop session.")
|
|
6845
6972
|
return 1
|
|
6846
6973
|
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
|
|
6974
|
+
if "set_remote_control" in again.stdout or "set_session_title" in again.stdout:
|
|
6975
|
+
report(f"{label} resume outside the desktop app names the desktop restore: {again.stdout.strip()}")
|
|
6849
6976
|
return 1
|
|
6850
6977
|
|
|
6851
6978
|
for relative in ("docs/shift-change.md", "docs/shift-change.zh-CN.md"):
|
|
6852
6979
|
text = (ROOT / relative).read_text(encoding="utf-8")
|
|
6853
|
-
for needle in ("send_message", "set_remote_control", "
|
|
6980
|
+
for needle in ("send_message", "set_remote_control", "set_session_title", "shift-restore"):
|
|
6854
6981
|
if needle not in text:
|
|
6855
6982
|
report(f"{label} {relative} does not name {needle} for the desktop app.")
|
|
6856
6983
|
return 1
|
|
@@ -28912,7 +29039,7 @@ def validate_continuation_authorization_scenario() -> int:
|
|
|
28912
29039
|
ACCEPTED_AUTHORIZE_NAMES = (
|
|
28913
29040
|
"commit, push, push:<branch glob>, release, archive, continuation, "
|
|
28914
29041
|
"issue:<owner>/<repo>, protocol-refresh, chat-reply:<group>, "
|
|
28915
|
-
"issue-close:<owner>/<repo>, cleanup:scratch, push-protected:<branch glob>[@<role>]"
|
|
29042
|
+
"issue-close:<owner>/<repo>, cleanup:scratch, push-protected:<branch glob>[@<role>], shift-restore, self-shift"
|
|
28916
29043
|
)
|
|
28917
29044
|
|
|
28918
29045
|
|
|
@@ -28974,7 +29101,7 @@ def validate_continuation_docs_scenario() -> int:
|
|
|
28974
29101
|
return 1
|
|
28975
29102
|
|
|
28976
29103
|
config_text = (ROOT / "keel/config.yaml").read_text(encoding="utf-8")
|
|
28977
|
-
if "commit, push, push:<branch glob>,\n# release, archive, continuation, issue:<owner>/<repo>, protocol-refresh,\n# chat-reply:<group>, issue-close:<owner>/<repo>, cleanup:scratch,\n# push-protected:<branch glob>[@<role>]" not in config_text:
|
|
29104
|
+
if "commit, push, push:<branch glob>,\n# release, archive, continuation, issue:<owner>/<repo>, protocol-refresh,\n# chat-reply:<group>, issue-close:<owner>/<repo>, cleanup:scratch,\n# push-protected:<branch glob>[@<role>], shift-restore, self-shift" not in config_text:
|
|
28978
29105
|
report(
|
|
28979
29106
|
f"{label}: keel/config.yaml's comment lacks: protocol-refresh in the "
|
|
28980
29107
|
"seven-name vocabulary."
|
|
@@ -40288,6 +40415,8 @@ SCENARIOS: tuple = (
|
|
|
40288
40415
|
("host-run-session", validate_host_run_session_scenario),
|
|
40289
40416
|
("shift-without-role", validate_shift_without_role_scenario),
|
|
40290
40417
|
("shift-desktop-wake", validate_shift_desktop_wake_scenario),
|
|
40418
|
+
("shift-restore-authorization", validate_shift_restore_authorization_scenario),
|
|
40419
|
+
("self-shift-authorization", validate_self_shift_authorization_scenario),
|
|
40291
40420
|
("resource-lock", validate_resource_lock_scenario),
|
|
40292
40421
|
("chat-supersedes", validate_chat_supersedes_scenario),
|
|
40293
40422
|
("chat-ack", validate_chat_ack_scenario),
|
package/src/core/config.js
CHANGED
|
@@ -31,6 +31,14 @@ const STANDING_AUTHORIZATION_ACTIONS = [
|
|
|
31
31
|
// A branch the Claude write guard asks the user about, one push at a time,
|
|
32
32
|
// instead of refusing (#280); `@<role>` limits who may be asked.
|
|
33
33
|
"push-protected",
|
|
34
|
+
// Restoring the session a desktop shift change started: turning its Remote
|
|
35
|
+
// Control back on and renaming it back, right after `keel shift resume`
|
|
36
|
+
// (#319). It reaches that one session, so it takes no scope.
|
|
37
|
+
"shift-restore",
|
|
38
|
+
// A session's own four outgoing steps on the desktop app, after `keel shift
|
|
39
|
+
// ready --wake` stored its note: Remote Control off, the wake task, the
|
|
40
|
+
// rename, and the clear (#319). Never the decision to change shift.
|
|
41
|
+
"self-shift",
|
|
34
42
|
];
|
|
35
43
|
|
|
36
44
|
// The actions whose credential reaches further than the checkout the
|
package/src/core/shift.js
CHANGED
|
@@ -422,7 +422,7 @@ function ready(where, options) {
|
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
const waiter = options.wake ? armWake(where, role, since) : null;
|
|
425
|
-
return { role: role || null, note, closed: open.map((todo) => todo.id), waiter, startedBy: role ? null : options.forceReason, desktop };
|
|
425
|
+
return { role: role || null, note, closed: open.map((todo) => todo.id), waiter, startedBy: role ? null : options.forceReason, desktop, worktree: where.worktree };
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
// --- the one-shot wake (#293) -------------------------------------------------------
|
|
@@ -743,13 +743,26 @@ function clearHint(result) {
|
|
|
743
743
|
let last;
|
|
744
744
|
if (!result.role) last = `Without a chat role nothing wakes the new session; ${result.startedBy} — tell it to run \`keel shift resume\`.`;
|
|
745
745
|
else if (result.waiter && result.desktop) {
|
|
746
|
-
// Nothing starts a cleared desktop session but a prompt (#319 D3).
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
746
|
+
// Nothing starts a cleared desktop session but a prompt (#319 D3). The task
|
|
747
|
+
// comes after Remote Control is off, which can block for hours while the
|
|
748
|
+
// session is followed remotely; a wake that fires first is queued, and the
|
|
749
|
+
// app then refuses the clear to keep it (#319 D1 of shift-desktop-wake-order).
|
|
750
|
+
last = [
|
|
751
|
+
"On the Claude desktop app a clear starts no session until a prompt arrives, so the waiter alone wakes nothing (#319). Do these in order:",
|
|
752
|
+
'1. Turn Remote Control off with set_remote_control("self", false), and wait for that call to return; it can take long while someone follows this session remotely.',
|
|
753
|
+
"2. Only then create a one-shot scheduled task with the host's `create_scheduled_task`, firing about three minutes later, "
|
|
754
|
+
+ `whose prompt calls \`send_message\` to session \`${result.desktop}\` with: "${result.role}: your new shift starts now. `
|
|
755
|
+
+ "Run `keel context` and `keel shift resume`, then restore Remote Control and this session's title as `keel shift resume` says.\" "
|
|
756
|
+
+ "A task created earlier can fire first, and the app then refuses the clear to keep its message.",
|
|
757
|
+
`3. Rename this session with \`set_session_title\` (for example "${result.role} · shifted ${store.isoLocal(new Date()).slice(0, 16)}"), so its archived copy can be told apart.`,
|
|
758
|
+
'4. Call clear_session("self").',
|
|
759
|
+
"Keel creates no task. Restoring unattended needs `mcp__ccd_session_mgmt__set_remote_control` in `permissions.allow`, "
|
|
760
|
+
+ "and `shift-restore` under `authorize:` in keel/config.yaml so the woken session does not stop to ask.",
|
|
761
|
+
// The outgoing side's confirmation is the repository's to waive (#319).
|
|
762
|
+
require("./config").readStandingAuthorization(result.worktree).scopes.has("self-shift")
|
|
763
|
+
? "Standing-authorized by `self-shift` in keel/config.yaml: take these four steps now, without asking."
|
|
764
|
+
: "Declaring `self-shift` under authorize: in keel/config.yaml lets a session take these four steps without asking.",
|
|
765
|
+
].join("\n");
|
|
753
766
|
} else if (result.waiter) {
|
|
754
767
|
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.`;
|
|
755
768
|
} else if (result.closed.length) last = "The coordinator's `keel shift start` then wakes the new shift.";
|
|
@@ -830,9 +843,16 @@ function runShift(argv) {
|
|
|
830
843
|
// A new coordinator learns whom its previous shift left unstarted (#289 D2).
|
|
831
844
|
const waiting = (result.waiting || []).map((w) => w.role);
|
|
832
845
|
const still = waiting.length ? `\n\nStill waiting for \`keel shift start\`: ${waiting.join(", ")}.` : "";
|
|
833
|
-
// A clear on the desktop app
|
|
834
|
-
const
|
|
835
|
-
|
|
846
|
+
// A clear on the desktop app keeps neither Remote Control nor the title (#319).
|
|
847
|
+
const { readStandingAuthorization } = require("./config");
|
|
848
|
+
const restore = readStandingAuthorization(where.worktree).scopes.has("shift-restore");
|
|
849
|
+
const remote = desktopSession() && restore
|
|
850
|
+
? "\n\nStanding-authorized by `shift-restore` in keel/config.yaml: turn Remote Control back on with "
|
|
851
|
+
+ "`set_remote_control(\"self\", true)` and rename this session back to its working title with `set_session_title`, now, without asking."
|
|
852
|
+
: desktopSession()
|
|
853
|
+
? "\n\nOn the Claude desktop app a clear keeps neither Remote Control nor this session's title: turn Remote Control back on with "
|
|
854
|
+
+ "`set_remote_control(\"self\", true)` and rename the session back with `set_session_title`. "
|
|
855
|
+
+ "Declaring `shift-restore` under authorize: in keel/config.yaml lets a woken session do this without asking."
|
|
836
856
|
: "";
|
|
837
857
|
out(result, `${result.text.replace(/\s+$/, "")}\n\n(The note moved to ${result.note}.)${still}${remind ? `\n\n${patrolReminder(patrol)}` : ""}${remote}`);
|
|
838
858
|
return 0;
|