@christang/keel 5.231.5 → 5.231.6
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/plugins/keel/hooks/codex.json +8 -4
- package/plugins/keel/scripts/pretooluse-guard.js +1 -1
- package/plugins/keel/scripts/session-start.js +1 -1
- package/scripts/validate_codex_receiving.py +88 -1
- package/scripts/validation/common.py +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.231.
|
|
3
|
+
"version": "5.231.6",
|
|
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.231.
|
|
3
|
+
"version": "5.231.6",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.231.
|
|
9
|
+
"version": "5.231.6",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "1.14.0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.231.
|
|
3
|
+
"version": "5.231.6",
|
|
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.231.
|
|
3
|
+
"version": "5.231.6",
|
|
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",
|
|
@@ -7,12 +7,14 @@
|
|
|
7
7
|
{
|
|
8
8
|
"type": "command",
|
|
9
9
|
"command": "node \"${PLUGIN_ROOT}/scripts/session-start.js\"",
|
|
10
|
-
"timeout": 15
|
|
10
|
+
"timeout": 15,
|
|
11
|
+
"statusMessage": "Keel: Session context"
|
|
11
12
|
},
|
|
12
13
|
{
|
|
13
14
|
"type": "command",
|
|
14
15
|
"command": "node \"${PLUGIN_ROOT}/scripts/codex-mail-hook.js\" session-start",
|
|
15
|
-
"timeout": 10
|
|
16
|
+
"timeout": 10,
|
|
17
|
+
"statusMessage": "Keel: Mail at session start"
|
|
16
18
|
}
|
|
17
19
|
]
|
|
18
20
|
}
|
|
@@ -24,7 +26,8 @@
|
|
|
24
26
|
{
|
|
25
27
|
"type": "command",
|
|
26
28
|
"command": "node \"${PLUGIN_ROOT}/scripts/pretooluse-guard.js\"",
|
|
27
|
-
"timeout": 10
|
|
29
|
+
"timeout": 10,
|
|
30
|
+
"statusMessage": "Keel: Write guard"
|
|
28
31
|
}
|
|
29
32
|
]
|
|
30
33
|
}
|
|
@@ -35,7 +38,8 @@
|
|
|
35
38
|
{
|
|
36
39
|
"type": "command",
|
|
37
40
|
"command": "node \"${PLUGIN_ROOT}/scripts/codex-mail-hook.js\" user-prompt-submit",
|
|
38
|
-
"timeout": 10
|
|
41
|
+
"timeout": 10,
|
|
42
|
+
"statusMessage": "Keel: Mail before prompt"
|
|
39
43
|
}
|
|
40
44
|
]
|
|
41
45
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""Public-interface checks for Codex hooks; native tests are opt-in."""
|
|
3
3
|
import argparse
|
|
4
|
+
import hashlib
|
|
4
5
|
import json
|
|
5
6
|
import os
|
|
6
7
|
from pathlib import Path
|
|
@@ -17,6 +18,25 @@ ROOT = Path(__file__).resolve().parents[1]
|
|
|
17
18
|
PLUGIN = ROOT / "plugins/keel"
|
|
18
19
|
CLI = ROOT / "bin/keel.js"
|
|
19
20
|
RECEIVER = PLUGIN / "scripts/codex-mail-hook.js"
|
|
21
|
+
HOOK_LABELS = {
|
|
22
|
+
("SessionStart", "session-start.js"): "Keel: Session context",
|
|
23
|
+
("SessionStart", "codex-mail-hook.js"): "Keel: Mail at session start",
|
|
24
|
+
("UserPromptSubmit", "codex-mail-hook.js"): "Keel: Mail before prompt",
|
|
25
|
+
("PreToolUse", "pretooluse-guard.js"): "Keel: Write guard",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def check_hook_labels(hooks):
|
|
30
|
+
event_names = {name[0].lower(): name[0] for name in HOOK_LABELS}
|
|
31
|
+
found = {
|
|
32
|
+
key: hook.get("statusMessage")
|
|
33
|
+
for hook in hooks
|
|
34
|
+
for key in HOOK_LABELS
|
|
35
|
+
if event_names.get(hook.get("eventName", "").lower()) == key[0]
|
|
36
|
+
and key[1] in hook["command"]
|
|
37
|
+
}
|
|
38
|
+
assert found == HOOK_LABELS, f"Keel hook labels missing or ambiguous: {found}"
|
|
39
|
+
|
|
20
40
|
|
|
21
41
|
|
|
22
42
|
def run(args, cwd=ROOT, env=None, input=None, check=True, timeout=30):
|
|
@@ -48,13 +68,79 @@ def invoke(repo, event, provider=None, timeout_ms=None):
|
|
|
48
68
|
return json.loads(result.stdout) if result.stdout.strip() else None
|
|
49
69
|
|
|
50
70
|
|
|
71
|
+
def read_hook_response(script, repo, event, env=None):
|
|
72
|
+
proc = subprocess.Popen(
|
|
73
|
+
["node", str(PLUGIN / "scripts" / script)],
|
|
74
|
+
cwd=repo, env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
|
75
|
+
stderr=subprocess.PIPE, text=True,
|
|
76
|
+
)
|
|
77
|
+
try:
|
|
78
|
+
proc.stdin.write(json.dumps({"cwd": str(repo), **event}))
|
|
79
|
+
proc.stdin.close()
|
|
80
|
+
proc.stdin = None
|
|
81
|
+
# Exercise the real pipe. A reader that has not been scheduled must
|
|
82
|
+
# still receive the whole JSON response when it starts draining.
|
|
83
|
+
time.sleep(0.3)
|
|
84
|
+
out, err = proc.communicate(timeout=12)
|
|
85
|
+
assert proc.returncode == 0 and not err, (proc.returncode, err)
|
|
86
|
+
try:
|
|
87
|
+
return json.loads(out)["hookSpecificOutput"]
|
|
88
|
+
except (ValueError, KeyError) as error:
|
|
89
|
+
raise AssertionError(f"{script}: hook response truncated ({len(out)} characters)") from error
|
|
90
|
+
finally:
|
|
91
|
+
if proc.poll() is None:
|
|
92
|
+
proc.kill()
|
|
93
|
+
proc.wait(timeout=5)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def buffered_output():
|
|
97
|
+
with tempfile.TemporaryDirectory(prefix="keel-codex-hook-output-") as raw:
|
|
98
|
+
repo = Path(raw)
|
|
99
|
+
change = repo / "openspec/changes/probe"
|
|
100
|
+
change.mkdir(parents=True)
|
|
101
|
+
context = {
|
|
102
|
+
"status": "ready",
|
|
103
|
+
"selection": {"change": "probe", "task": "1.1", "source": "fixture"},
|
|
104
|
+
"read": ["fixture/" + "a" * 180000 + "/projection-tail"],
|
|
105
|
+
}
|
|
106
|
+
provider = repo / "cli.js"
|
|
107
|
+
provider.write_text(
|
|
108
|
+
"process.stdout.write(process.argv[2] === '--version' ? '5.231.5' : "
|
|
109
|
+
+ json.dumps(json.dumps(context)) + ")",
|
|
110
|
+
encoding="utf-8",
|
|
111
|
+
)
|
|
112
|
+
env = dict(os.environ, KEEL_CLI=shlex.join(["node", str(provider)]))
|
|
113
|
+
projection = read_hook_response("session-start.js", repo, {"hook_event_name": "SessionStart"}, env)
|
|
114
|
+
assert "/projection-tail" in projection["additionalContext"]
|
|
115
|
+
tasks = change / "tasks.md"
|
|
116
|
+
tasks.write_text("- [ ] 1.1 Write in Touch only\n", encoding="utf-8")
|
|
117
|
+
touch = [f"src/fixture-{index:05d}.js" for index in range(12000)]
|
|
118
|
+
manifest = {
|
|
119
|
+
"schema": "keel-write-guard/v1", "change": "probe", "task": "1.1",
|
|
120
|
+
"authority": [{"path": str(tasks.relative_to(repo)), "sha256": hashlib.sha256(tasks.read_bytes()).hexdigest()}],
|
|
121
|
+
"touch": touch,
|
|
122
|
+
}
|
|
123
|
+
(repo / "keel").mkdir()
|
|
124
|
+
(repo / "keel/guard.json").write_text(json.dumps(manifest), encoding="utf-8")
|
|
125
|
+
decision = read_hook_response("pretooluse-guard.js", repo, {
|
|
126
|
+
"hook_event_name": "PreToolUse", "tool_name": "Edit",
|
|
127
|
+
"tool_input": {"file_path": str(repo / "src/outside.js")},
|
|
128
|
+
})
|
|
129
|
+
assert decision["permissionDecision"] == "deny"
|
|
130
|
+
assert touch[-1] in decision["permissionDecisionReason"]
|
|
131
|
+
print("codex hook output: complete SessionStart projection and PreToolUse verdict")
|
|
132
|
+
|
|
133
|
+
|
|
51
134
|
def behavior():
|
|
52
135
|
manifest = json.loads((PLUGIN / ".codex-plugin/plugin.json").read_text())
|
|
53
136
|
assert manifest.get("hooks") == "./hooks/codex.json", "Codex still uses the args-only shared hooks"
|
|
54
137
|
hooks = json.loads((PLUGIN / "hooks/codex.json").read_text())["hooks"]
|
|
55
138
|
assert set(hooks) == {"SessionStart", "PreToolUse", "UserPromptSubmit"}
|
|
56
139
|
assert not any(field in json.dumps(hooks) for field in ["asyncRewake", "watchPaths", "FileChanged"])
|
|
57
|
-
|
|
140
|
+
declared = [dict(h, eventName=event) for event, groups in hooks.items() for g in groups for h in g["hooks"]]
|
|
141
|
+
check_hook_labels(declared)
|
|
142
|
+
buffered_output()
|
|
143
|
+
commands = [h["command"] for h in declared]
|
|
58
144
|
for script in ["session-start.js", "pretooluse-guard.js", "codex-mail-hook.js"]:
|
|
59
145
|
assert any(script in command for command in commands), script
|
|
60
146
|
with tempfile.TemporaryDirectory(prefix="keel-codex-mail-") as raw:
|
|
@@ -177,6 +263,7 @@ trust_level = "trusted"
|
|
|
177
263
|
assert not found["errors"], found
|
|
178
264
|
hooks = found["hooks"]
|
|
179
265
|
assert len(hooks) == 4, hooks
|
|
266
|
+
check_hook_labels(hooks)
|
|
180
267
|
assert all(h["trustStatus"] == "untrusted" for h in hooks), hooks
|
|
181
268
|
assert all(".js" in h["command"] for h in hooks), hooks
|
|
182
269
|
assert {h["eventName"] for h in hooks} == {"preToolUse", "sessionStart", "userPromptSubmit"}
|
|
@@ -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.231.
|
|
38
|
+
PACKAGE_VERSION = "5.231.6"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
PROTOCOL_VERSION = "5.231.
|
|
41
|
+
PROTOCOL_VERSION = "5.231.6"
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|