@christang/keel 5.231.0 → 5.231.2
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/test_codex_host.js +34 -3
- package/scripts/validation/chat.py +61 -0
- package/scripts/validation/common.py +2 -2
- package/scripts/validation/registry.py +1 -0
- package/src/core/chat/store.js +3 -2
- package/src/core/codex-host.js +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.231.
|
|
3
|
+
"version": "5.231.2",
|
|
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.2",
|
|
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.2",
|
|
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.2",
|
|
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.2",
|
|
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",
|
|
@@ -133,16 +133,16 @@ async function reviewerHost() {
|
|
|
133
133
|
const server=http.createServer();
|
|
134
134
|
server.on('upgrade',(req,s)=>{
|
|
135
135
|
peers.push(s);s.write('HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: '+crypto.createHash('sha1').update(req.headers['sec-websocket-key']+'258EAFA5-E914-47DA-95CA-C5AB0DC85B11').digest('base64')+'\r\n\r\n');
|
|
136
|
-
let buf=Buffer.alloc(0);s.on('end',()=>{for(const t of threads.values()){t.loaded=false;t.reviewer=t.savedReviewer;}});
|
|
136
|
+
let buf=Buffer.alloc(0), experimentalApi=false;s.on('end',()=>{for(const t of threads.values()){t.loaded=false;t.reviewer=t.savedReviewer;}});
|
|
137
137
|
s.on('data',chunk=>{buf=Buffer.concat([buf,chunk]);while(buf.length>=6){let n=buf[1]&127,off=2;if(n===126){if(buf.length<8)return;n=buf.readUInt16BE(2);off=4;}else if(n===127){if(buf.length<14)return;n=Number(buf.readBigUInt64BE(2));off=10;}if(buf.length<off+4+n)return;const mask=buf.subarray(off,off+4),data=Buffer.from(buf.subarray(off+4,off+4+n));buf=buf.subarray(off+4+n);for(let i=0;i<data.length;i++)data[i]^=mask[i%4];const x=JSON.parse(data);requests.push(x);if(!x.id)continue;
|
|
138
138
|
let result={},error;const p=x.params||{};let t=threads.get(p.threadId);
|
|
139
139
|
const reply=()=>({thread:{id:t.id,cwd:t.cwd||dir,status:{type:t.status||(t.loaded?'idle':'notLoaded')}},approvalsReviewer:mismatch?'user':t.reviewer,approvalPolicy:'on-request',sandbox:{type:'workspaceWrite',networkAccess:false,writableRoots:[]}});
|
|
140
|
-
if(x.method==='initialize')result={userAgent:'native-reviewer-fixture'};
|
|
140
|
+
if(x.method==='initialize'){experimentalApi=p.capabilities?.experimentalApi===true;result={userAgent:'native-reviewer-fixture'};}
|
|
141
141
|
else if(x.method==='thread/start'){t={id:'reviewer-'+ ++serial,reviewer:p.approvalsReviewer||'user',savedReviewer:'user',loaded:true};threads.set(t.id,t);result=reply();}
|
|
142
142
|
else if(x.method==='thread/name/set'){}
|
|
143
143
|
else if(x.method==='thread/settings/update'){if(rejectPersistence)error={message:'native reviewer persistence rejected'};else t.savedReviewer=t.reviewer=p.approvalsReviewer;}
|
|
144
144
|
else if(x.method==='thread/read')result=reply();
|
|
145
|
-
else if(x.method==='thread/resume'){if(t.resumeError)error={message:t.resumeError};else {t.loaded=true;t.cwd=p.cwd||t.cwd;t.reviewer=p.approvalsReviewer||t.savedReviewer;result=reply();if(t.wrongResumeCwd)result.thread.cwd='/wrong-resumed-cwd';}}
|
|
145
|
+
else if(x.method==='thread/resume'){if(p.runtimeWorkspaceRoots!==undefined&&!experimentalApi)error={message:'thread/resume.runtimeWorkspaceRoots requires experimentalApi capability'};else if(t.resumeError)error={message:t.resumeError};else {t.loaded=true;t.cwd=p.cwd||t.cwd;t.reviewer=p.approvalsReviewer||t.savedReviewer;result=reply();if(t.wrongResumeCwd)result.thread.cwd='/wrong-resumed-cwd';}}
|
|
146
146
|
else if(x.method==='turn/start'){t.reviewer=p.approvalsReviewer||t.reviewer;turnReviewers.push(t.reviewer);t.savedReviewer=t.reviewer;result={turn:{id:'reviewer-turn-'+turnReviewers.length}};}
|
|
147
147
|
else error={message:'unsupported fixture RPC '+x.method};
|
|
148
148
|
if(dropStartReply&&x.method==='thread/start')continue;
|
|
@@ -272,6 +272,37 @@ test('recover restores original owned cwd without rewriting role claims or start
|
|
|
272
272
|
}finally{await h.close();}
|
|
273
273
|
});
|
|
274
274
|
|
|
275
|
+
test('legacy recover negotiates workspace roots support without adding a reviewer or changing claims',async()=>{
|
|
276
|
+
const h=await reviewerHost();
|
|
277
|
+
try {
|
|
278
|
+
const args=['--repo',h.dir,'--role','reviewer-worker','--json'];
|
|
279
|
+
const started=await run([...args,'--socket',h.sock],'start');
|
|
280
|
+
assert.equal(started.code,0,started.err);
|
|
281
|
+
const id=JSON.parse(started.out).thread;
|
|
282
|
+
const delivered=await run([...args,'--record','prior-claim','--text','prior work'],'deliver');
|
|
283
|
+
assert.equal(delivered.code,0,delivered.err);
|
|
284
|
+
const file=path.join(h.dir,'.git/keel-chat/codex-roles/reviewer-worker.json');
|
|
285
|
+
const before=fs.readFileSync(file);
|
|
286
|
+
const record=JSON.parse(before);
|
|
287
|
+
assert.equal(Object.hasOwn(record,'approvalsReviewer'),false);
|
|
288
|
+
assert.equal(Object.hasOwn(record,'nativePolicy'),false);
|
|
289
|
+
h.threads.get(id).cwd='/drifted-cwd';
|
|
290
|
+
h.threads.get(id).loaded=false;
|
|
291
|
+
const previous=h.requests.length;
|
|
292
|
+
|
|
293
|
+
const result=await run(args,'recover');
|
|
294
|
+
assert.equal(result.code,0,result.err);
|
|
295
|
+
assert.equal(JSON.parse(result.out).thread,id);
|
|
296
|
+
const recoveryRequests=h.requests.slice(previous);
|
|
297
|
+
const resume=recoveryRequests.find(request=>request.method==='thread/resume');
|
|
298
|
+
assert.equal(resume.params.cwd,h.dir);
|
|
299
|
+
assert.deepEqual(resume.params.runtimeWorkspaceRoots,[h.dir]);
|
|
300
|
+
assert.equal(Object.hasOwn(resume.params,'approvalsReviewer'),false);
|
|
301
|
+
assert.deepEqual(fs.readFileSync(file),before);
|
|
302
|
+
assert.equal(recoveryRequests.some(request=>['thread/start','turn/start'].includes(request.method)),false);
|
|
303
|
+
} finally {await h.close();}
|
|
304
|
+
});
|
|
305
|
+
|
|
275
306
|
test('recover refuses unsafe native and role boundaries without changing records',async()=>{
|
|
276
307
|
const h=await reviewerHost();try{
|
|
277
308
|
const started=await run(h.args(),'start');assert.equal(started.code,0,started.err);const id=JSON.parse(started.out).thread,t=h.threads.get(id);
|
|
@@ -1394,6 +1394,67 @@ def validate_chat_no_wake_dm_scenario() -> int:
|
|
|
1394
1394
|
return 0
|
|
1395
1395
|
|
|
1396
1396
|
|
|
1397
|
+
def validate_chat_direct_participants_json_scenario() -> int:
|
|
1398
|
+
"""Expose direct participants without needing a role rename (#552)."""
|
|
1399
|
+
with tempfile.TemporaryDirectory(prefix="keel-direct-json-") as raw:
|
|
1400
|
+
sender, receiver, env = chat_scratch_group(Path(raw))
|
|
1401
|
+
store = mailbox_common_dir(sender) / "keel-chat"
|
|
1402
|
+
direct_group = "dm-rtl--verify"
|
|
1403
|
+
|
|
1404
|
+
def chat(worktree: Path, *args: str):
|
|
1405
|
+
result = run_keel(worktree, "chat", *args, env=env)
|
|
1406
|
+
assert result.returncode == 0, result.stderr
|
|
1407
|
+
return result
|
|
1408
|
+
|
|
1409
|
+
def snapshot():
|
|
1410
|
+
return {
|
|
1411
|
+
file.relative_to(store): file.read_bytes()
|
|
1412
|
+
for directory in (store / "groups", store / "cursors")
|
|
1413
|
+
for file in directory.rglob("*") if file.is_file()
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
def send(*args: str) -> str:
|
|
1417
|
+
return chat_json(chat(sender, *args, "--json"))["id"]
|
|
1418
|
+
|
|
1419
|
+
send("post", "soc", "initial cursor")
|
|
1420
|
+
chat(receiver, "read", "soc")
|
|
1421
|
+
silent = send("dm", "verify", "--no-wake", "silent direct record")
|
|
1422
|
+
plain = send("post", "soc", "ordinary group record")
|
|
1423
|
+
assert would_wake(receiver, env) == 1, "silent DM or plain group record woke receiver"
|
|
1424
|
+
ordinary = send("dm", "verify", "ordinary direct record")
|
|
1425
|
+
assert would_wake(receiver, env) == 0, "ordinary DM did not wake receiver"
|
|
1426
|
+
assert not (store / "renames.json").exists(), "initial reads must have no rename map"
|
|
1427
|
+
|
|
1428
|
+
def assert_reads(role: str):
|
|
1429
|
+
before = snapshot()
|
|
1430
|
+
assert before, "expected stored history and a read cursor"
|
|
1431
|
+
unread = {r["id"]: r for r in chat_json(chat(receiver, "unread", "--json"))["unread"]}
|
|
1432
|
+
direct = {r["id"]: r for r in chat_json(chat(receiver, direct_group, "--peek", "--json"))["records"]}
|
|
1433
|
+
group = {r["id"]: r for r in chat_json(chat(receiver, "soc", "--peek", "--json"))["records"]}
|
|
1434
|
+
for record_id in (ordinary, silent, plain):
|
|
1435
|
+
shown = chat_json(chat(receiver, "show", record_id, "--json"))
|
|
1436
|
+
assert shown["readers"] == [], "peek/show must not mark a record as read"
|
|
1437
|
+
peeked = group[record_id] if record_id == plain else direct[record_id]
|
|
1438
|
+
for surface, record in (("unread", unread[record_id]), ("peek", peeked), ("show", shown["record"])):
|
|
1439
|
+
assert record["id"] == record_id
|
|
1440
|
+
assert not record.get("mentions"), f"{surface} must not rely on mentions"
|
|
1441
|
+
if record_id == plain:
|
|
1442
|
+
assert "direct" not in record, f"{surface} gave a plain group record direct participants"
|
|
1443
|
+
else:
|
|
1444
|
+
assert record.get("direct") == ["rtl", role], f"{surface} lost canonical DM participants: {record.get('direct')!r}"
|
|
1445
|
+
assert bool(record.get("no_wake")) == (record_id == silent), f"{surface} changed no-wake"
|
|
1446
|
+
assert snapshot() == before, "JSON projections rewrote history or cursors"
|
|
1447
|
+
|
|
1448
|
+
assert_reads("verify")
|
|
1449
|
+
original_records = {file: data for file, data in snapshot().items() if file.parts[0] == "groups" and "log" in file.parts}
|
|
1450
|
+
chat(receiver, "role", "--rename", "verify", "check")
|
|
1451
|
+
assert_reads("check")
|
|
1452
|
+
assert all((store / file).read_bytes() == data for file, data in original_records.items()), "rename rewrote original records"
|
|
1453
|
+
|
|
1454
|
+
report("chat-direct-participants-json scenario passed.")
|
|
1455
|
+
return 0
|
|
1456
|
+
|
|
1457
|
+
|
|
1397
1458
|
def validate_chat_wakes_without_no_wake_scenario() -> int:
|
|
1398
1459
|
"""Issue #502: without the option a mention still wakes, as before."""
|
|
1399
1460
|
label = "chat-wakes-without-no-wake:"
|
|
@@ -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.2"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
PROTOCOL_VERSION = "5.231.
|
|
41
|
+
PROTOCOL_VERSION = "5.231.2"
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
|
|
@@ -532,6 +532,7 @@ SCENARIOS: tuple = (
|
|
|
532
532
|
("chat-summary", chat.validate_chat_summary_scenario),
|
|
533
533
|
("chat-no-wake-post", chat.validate_chat_no_wake_post_scenario),
|
|
534
534
|
("chat-no-wake-dm", chat.validate_chat_no_wake_dm_scenario),
|
|
535
|
+
("chat-direct-participants-json", chat.validate_chat_direct_participants_json_scenario),
|
|
535
536
|
("chat-wakes-without-no-wake", chat.validate_chat_wakes_without_no_wake_scenario),
|
|
536
537
|
("worktree-overview", shift.validate_worktree_overview_scenario),
|
|
537
538
|
("sync-status-lists-local-only", sync.validate_sync_status_lists_local_only_scenario),
|
package/src/core/chat/store.js
CHANGED
|
@@ -228,15 +228,16 @@ function canonicalRole(root, name, renames = readRenames(root)) {
|
|
|
228
228
|
// Every role field a record carries, read through the renames (D2); a direct
|
|
229
229
|
// group's members come from its name, so they are given as `direct`.
|
|
230
230
|
function mapRecord(record, renames) {
|
|
231
|
-
if (!record
|
|
231
|
+
if (!record) return record;
|
|
232
232
|
const map = (name) => (validName(name) ? canonicalRole(null, name, renames) : name);
|
|
233
|
+
if (record.group && isDirect(record.group)) record.direct = [...new Set(directMembers(record.group).map(map))];
|
|
234
|
+
if (!Object.keys(renames).length) return record;
|
|
233
235
|
record.from = map(record.from);
|
|
234
236
|
if (record.assignee) record.assignee = map(record.assignee);
|
|
235
237
|
if (Array.isArray(record.mentions)) record.mentions = [...new Set(record.mentions.map(map))];
|
|
236
238
|
// A join or leave keeps the name it was written for; `member` is the role
|
|
237
239
|
// it now means, applied once membership is computed (groupState).
|
|
238
240
|
if ((record.kind === "join" || record.kind === "leave") && record.target) record.member = map(record.target);
|
|
239
|
-
if (record.group && isDirect(record.group)) record.direct = [...new Set(directMembers(record.group).map(map))];
|
|
240
241
|
return record;
|
|
241
242
|
}
|
|
242
243
|
|
package/src/core/codex-host.js
CHANGED
|
@@ -193,8 +193,10 @@ async function run(args) {
|
|
|
193
193
|
}
|
|
194
194
|
if (action === "handover" && recorded?.registration) throw Error("registered frontend handover requires separate successor authorization; no replacement started");
|
|
195
195
|
const savedPolicy = onboarding.policyFor(recorded);
|
|
196
|
+
// Recovery can restore runtimeWorkspaceRoots even for legacy role records.
|
|
197
|
+
const needsExperimentalApi = action === "recover" || requestedReviewer || recorded?.approvalsReviewer || savedPolicy;
|
|
196
198
|
client = await connect(options.socket, ms);
|
|
197
|
-
const host = await client.call("initialize", {clientInfo: {name: "keel", version: "1"}, ...(
|
|
199
|
+
const host = await client.call("initialize", {clientInfo: {name: "keel", version: "1"}, ...(needsExperimentalApi ? {capabilities: {experimentalApi: true}} : {})});
|
|
198
200
|
if (!host || typeof host.userAgent !== "string" || !host.userAgent) throw Error("Codex host returned no initialization identity");
|
|
199
201
|
client.notify("initialized");
|
|
200
202
|
const result = {socket: options.socket, host};
|