@christang/keel 5.165.0 → 5.166.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 +52 -7
- package/src/core/shift.js +15 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.166.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.166.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.166.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.166.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.166.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.166.0"
|
|
53
|
+
PROTOCOL_VERSION = "5.166.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
|
|
@@ -8251,20 +8251,35 @@ def validate_shift_cli_self_shift_scenario() -> int:
|
|
|
8251
8251
|
base = Path(raw)
|
|
8252
8252
|
rtl, verify, env, _ = shift_scratch(base)
|
|
8253
8253
|
calls, agents, fail, norename = base / "claude-calls.jsonl", base / "agents.json", base / "fail-start", base / "no-rename"
|
|
8254
|
+
stoplag = base / "stop-lag"
|
|
8254
8255
|
fake = base / "fake-claude"
|
|
8255
8256
|
# The fake answers with the shapes measured on Claude Code 2.1.303: a live row has `status` and `state`; a stopped one has `state: stopped` and no `status`.
|
|
8257
|
+
# `stop` returns before the process exits (#395): with `stop-lag` holding n, the row stops n listings later, never with `never`;
|
|
8258
|
+
# and a resume of a session still running starts a copy that takes the name, as measured.
|
|
8256
8259
|
write_text(fake, "#!/usr/bin/env python3\nimport json, os, sys\n"
|
|
8257
|
-
f"agents, fail, norename = {str(agents)!r}, {str(fail)!r}, {str(norename)!r}\n"
|
|
8260
|
+
f"agents, fail, norename, stoplag = {str(agents)!r}, {str(fail)!r}, {str(norename)!r}, {str(stoplag)!r}\n"
|
|
8258
8261
|
f"open({str(calls)!r}, 'a').write(json.dumps({{'argv': sys.argv[1:], 'cwd': os.getcwd(), 'claude_env': sorted(k for k in os.environ if k.startswith('CLAUDE'))}}) + '\\n')\n"
|
|
8259
8262
|
"argv = sys.argv[1:]\n"
|
|
8260
|
-
"if argv[:2] == ['agents', '--json']:\n print(open(agents).read()); sys.exit(0)\n"
|
|
8261
8263
|
"rows = json.loads(open(agents).read())\n"
|
|
8264
|
+
"if argv[:2] == ['agents', '--json']:\n"
|
|
8265
|
+
" for row in rows:\n if '_stop_in' in row:\n row['_stop_in'] -= 1\n"
|
|
8266
|
+
" if row['_stop_in'] <= 0:\n row.pop('_stop_in'); row.pop('status', None); row['state'] = 'stopped'\n"
|
|
8267
|
+
" open(agents, 'w').write(json.dumps(rows)); print(json.dumps(rows)); sys.exit(0)\n"
|
|
8262
8268
|
"if argv[:1] == ['stop']:\n"
|
|
8263
|
-
"
|
|
8269
|
+
" lag = open(stoplag).read().strip() if os.path.exists(stoplag) else '0'\n"
|
|
8270
|
+
" for row in rows:\n if row['id'] == argv[1] and 'status' in row:\n"
|
|
8271
|
+
" if lag == '0':\n row.pop('status', None); row['state'] = 'stopped'\n"
|
|
8272
|
+
" else:\n row['_stop_in'] = 10 ** 9 if lag == 'never' else int(lag)\n"
|
|
8264
8273
|
" open(agents, 'w').write(json.dumps(rows)); print('stopped ' + argv[1]); sys.exit(0)\n"
|
|
8265
8274
|
"if argv[:2] == ['--bg', '--resume']:\n"
|
|
8266
|
-
"
|
|
8267
|
-
"
|
|
8275
|
+
" name = argv[3].split(None, 1)[1]\n"
|
|
8276
|
+
" running = [row for row in rows if row['sessionId'] == argv[2] and 'status' in row]\n"
|
|
8277
|
+
" if running:\n"
|
|
8278
|
+
" rows.append({**running[0], 'sessionId': 'c0c0c0c0-0000-0000-0000-000000000000', 'id': 'c0c0c0c0', 'name': name, 'status': 'idle'})\n"
|
|
8279
|
+
" rows[-1].pop('_stop_in', None)\n"
|
|
8280
|
+
" print('note: session ' + argv[2][:8] + ' is already running in the background, so this started a copy as c0c0c0c0.')\n"
|
|
8281
|
+
" for row in rows:\n if row['sessionId'] == argv[2] and not running and not os.path.exists(norename):\n row['name'] = name\n"
|
|
8282
|
+
" open(agents, 'w').write(json.dumps(rows)); print('backgrounded · ' + (rows[-1]['id'] if running else argv[2][:8])); sys.exit(0)\n"
|
|
8268
8283
|
"if argv[:1] == ['--bg'] and os.path.exists(fail):\n print('Workspace not trusted.', file=sys.stderr); sys.exit(1)\n"
|
|
8269
8284
|
"if argv[:1] == ['--bg']:\n print('backgrounded · newsess1 · verify'); sys.exit(0)\n"
|
|
8270
8285
|
"print('stopped')\n")
|
|
@@ -8340,9 +8355,18 @@ def validate_shift_cli_self_shift_scenario() -> int:
|
|
|
8340
8355
|
# Finished: idle, though its state still labels its last message `working` (#393, keel-maint's
|
|
8341
8356
|
# ended turn). The waiter retires it and starts the next, with no tick.
|
|
8342
8357
|
agents_row("idle", "working")
|
|
8358
|
+
write_text(stoplag, "2")
|
|
8343
8359
|
if not wait_for(lambda: len(starts()) >= 1):
|
|
8344
8360
|
report(f"{label} the waiter did not hand over without a tick: {acted()!r}")
|
|
8345
8361
|
return 1
|
|
8362
|
+
listed = json.loads(agents.read_text())
|
|
8363
|
+
if any(row["sessionId"] != OLD for row in listed):
|
|
8364
|
+
report(f"{label} the rename resumed a session that was still running, starting a copy: {listed!r}")
|
|
8365
|
+
return 1
|
|
8366
|
+
if not re.match(r"^verify · shifted ", listed[0]["name"]):
|
|
8367
|
+
report(f"{label} the old session did not take the shifted name: {listed!r}")
|
|
8368
|
+
return 1
|
|
8369
|
+
stoplag.unlink()
|
|
8346
8370
|
order = acted()
|
|
8347
8371
|
shifted = re.compile(r"^/rename verify · shifted \d{4}-\d{2}-\d{2} \d{2}:\d{2}$")
|
|
8348
8372
|
if (order[0] != ["stop", OLD[:8]] or order[1][:3] != ["--bg", "--resume", OLD] or len(order[1]) != 4
|
|
@@ -8408,6 +8432,27 @@ def validate_shift_cli_self_shift_scenario() -> int:
|
|
|
8408
8432
|
return 1
|
|
8409
8433
|
norename.unlink()
|
|
8410
8434
|
|
|
8435
|
+
# A session that never shows as stopped is not resumed for its rename (#395), and the new session still starts.
|
|
8436
|
+
calls.write_text("")
|
|
8437
|
+
agents_row("idle", "done")
|
|
8438
|
+
write_text(stoplag, "never")
|
|
8439
|
+
run_keel(verify, "shift", "ready", "--wake", "next: rerun R016", env={**cli_env, "KEEL_SHIFT_HANDOVER_TIMEOUT_MS": "1"})
|
|
8440
|
+
ticked = run_keel(verify, "tick", "--repo", str(rtl), env={**tick_only, "KEEL_SHIFT_STOP_WAIT_MS": "1000"})
|
|
8441
|
+
text = status_text()
|
|
8442
|
+
if any(argv[:2] == ["--bg", "--resume"] for argv in acted()):
|
|
8443
|
+
report(f"{label} a session that never stopped was resumed for its rename: {acted()!r}")
|
|
8444
|
+
return 1
|
|
8445
|
+
if len(starts()) != 1:
|
|
8446
|
+
report(f"{label} a session that never stopped kept the new session from starting: {acted()!r} {ticked.stderr!r}")
|
|
8447
|
+
return 1
|
|
8448
|
+
if "delivered" not in text:
|
|
8449
|
+
report(f"{label} a session that never stopped kept the hand-off from being delivered: {text!r}")
|
|
8450
|
+
return 1
|
|
8451
|
+
if "rename not shown" not in text:
|
|
8452
|
+
report(f"{label} shift status does not say a session that never stopped was not renamed: {text!r}")
|
|
8453
|
+
return 1
|
|
8454
|
+
stoplag.unlink()
|
|
8455
|
+
|
|
8411
8456
|
# A start that fails stays visible and is a patrol risk.
|
|
8412
8457
|
calls.write_text("")
|
|
8413
8458
|
agents_row("idle", "done")
|
package/src/core/shift.js
CHANGED
|
@@ -525,14 +525,28 @@ function listAgents(claude) {
|
|
|
525
525
|
// Stop the old session, give it a name that says it shifted, stop it again. The
|
|
526
526
|
// rename is a resume with `/rename` and no other flag, which keeps the session id
|
|
527
527
|
// and shows in `claude agents` (measured 2026-10-19); it is best effort (#388 D4).
|
|
528
|
+
// `claude stop` returns before the process exits, and a resume of a session still
|
|
529
|
+
// running starts a copy of it (#395), so the resume waits for the stop to show.
|
|
528
530
|
function retire(claude, entry, row) {
|
|
529
531
|
const id = row.id || entry.session.slice(0, 8);
|
|
532
|
+
const pause = new Int32Array(new SharedArrayBuffer(4));
|
|
530
533
|
if (row.state !== "stopped") spawnSync(claude, ["stop", id], { encoding: "utf8" });
|
|
534
|
+
const stopBy = Date.now() + envMs("KEEL_SHIFT_STOP_WAIT_MS", 30000);
|
|
535
|
+
for (;;) {
|
|
536
|
+
// A listing that failed says nothing about the session: keep waiting.
|
|
537
|
+
const listed = listAgents(claude);
|
|
538
|
+
const now = listed && listed.find((item) => item && item.sessionId === entry.session);
|
|
539
|
+
if (listed && (!now || !now.status)) break;
|
|
540
|
+
if (Date.now() >= stopBy) {
|
|
541
|
+
spawnSync(claude, ["stop", id], { encoding: "utf8" });
|
|
542
|
+
return null;
|
|
543
|
+
}
|
|
544
|
+
Atomics.wait(pause, 0, 0, 500);
|
|
545
|
+
}
|
|
531
546
|
const stamp = store.isoLocal(new Date()).slice(0, 16).replace("T", " ");
|
|
532
547
|
const name = `${entry.role} · shifted ${stamp}`;
|
|
533
548
|
spawnSync(claude, ["--bg", "--resume", entry.session, `/rename ${name}`], { encoding: "utf8", cwd: row.cwd || entry.worktree });
|
|
534
549
|
const deadline = Date.now() + envMs("KEEL_SHIFT_RENAME_WAIT_MS", 30000);
|
|
535
|
-
const pause = new Int32Array(new SharedArrayBuffer(4));
|
|
536
550
|
let shown = false;
|
|
537
551
|
for (;;) {
|
|
538
552
|
const now = (listAgents(claude) || []).find((item) => item && item.sessionId === entry.session);
|