@christang/keel 5.231.11 → 5.231.12

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.231.11",
3
+ "version": "5.231.12",
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,4 +1,4 @@
1
- <!-- keel:start version=5.231.11 -->
1
+ <!-- keel:start version=5.231.12 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the durable authority, and memory or transcripts may only inform.
package/bin/keel.js CHANGED
@@ -108,6 +108,7 @@ Usage:
108
108
  keel worktrees add [--repo <path>] --path <path> --branch <new-branch> [--base <ref>] [--json]
109
109
  keel sync status [--repo <path>] [--verify] [--remote <name>] [--json] (what exists only on this machine; fetches nothing, --verify asks the remote its sha)
110
110
  keel patrol [--issues <file>] [--idle <dur>] [--since-last [--notify]] [--nudge] [--json] [--repo <path>] (the coordinator's patrol; keel patrol task prints its schedule)
111
+ keel codex list [--repo <path>] [--json] (read local managed role registrations offline)
111
112
  keel codex status|start|deliver|handover|drain|recover [--repo <path>] [--role <role>] [--socket <path>] [--json] (managed Codex roles; explicit host identity)
112
113
  keel codex status [--repo <path>] --role <role> --record <id> [--json] (read the durable delivery receipt locally)
113
114
  keel codex inspect-registration --repo <path> --role <role> --thread <id> --socket <path> --authority <reference>
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.231.11",
3
+ "version": "5.231.12",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.231.11",
9
+ "version": "5.231.12",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@fission-ai/openspec": "1.14.0"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@christang/keel",
3
3
  "displayName": "Keel",
4
4
  "description": "Keel OpenSpec execution discipline CLI for Claude Code, Codex, and OpenCode.",
5
- "version": "5.231.11",
5
+ "version": "5.231.12",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.231.11",
3
+ "version": "5.231.12",
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.11",
3
+ "version": "5.231.12",
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",
@@ -9,6 +9,63 @@ const fs=require('node:fs');
9
9
  const {spawn}=require('node:child_process');
10
10
  const cli=path.resolve(__dirname,'../bin/keel.js');
11
11
  function run(args,action="status"){return new Promise(resolve=>{const p=spawn(process.execPath,['chat','tick'].includes(action)?[cli,action,...args]:[cli,'codex',action,...args]);let out='',err='';p.stdout.on('data',b=>out+=b);p.stderr.on('data',b=>err+=b);p.on('close',code=>resolve({code,out,err}));});}
12
+ test('list managed roles offline without draining or changing the shared mailbox', async t => {
13
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'keel-role-list-'));
14
+ t.after(() => fs.rmSync(dir, {recursive: true, force: true}));
15
+ require('node:child_process').execFileSync('git', ['init', '-q', dir]);
16
+ const store = require('../src/core/chat/store');
17
+ const where = store.requireLocation(dir);
18
+ async function list() {
19
+ const result = await run(['--repo', dir, '--json'], 'list');
20
+ assert.equal(result.code, 0, result.err);
21
+ return JSON.parse(result.out).roles;
22
+ }
23
+ assert.deepEqual(await list(), []);
24
+ assert.ok(!fs.existsSync(where.root));
25
+ const socket = path.join(dir, 'host.sock');
26
+ let connections = 0;
27
+ const server = require('node:net').createServer(peer => { connections++; peer.destroy(); });
28
+ await new Promise(resolve => server.listen(socket, resolve));
29
+ t.after(() => new Promise(resolve => server.close(resolve)));
30
+ const registry = path.join(where.root, 'codex-roles');
31
+ fs.mkdirSync(registry, {recursive: true});
32
+ const bindings = {};
33
+ for (const role of ['worker', 'paused', 'moved']) {
34
+ const worktree = path.join(dir, role);
35
+ bindings[worktree] = role === 'moved' ? 'other' : role;
36
+ fs.mkdirSync(worktree);
37
+ fs.writeFileSync(path.join(registry, role + '.json'), JSON.stringify({
38
+ state: 'managed', role, worktree, thread: role + '-thread', socket, deliveries: {private: 'secret'},
39
+ }));
40
+ }
41
+ fs.writeFileSync(path.join(where.root, 'roles.json'), JSON.stringify(bindings));
42
+ store.createGroup(where, 'owner', 'team', ['worker', 'group-only']);
43
+ store.writeRecord(where, {group: 'team', kind: 'todo', from: 'owner', assignee: 'worker', text: 'pending'});
44
+ require('../src/core/chat/notice').park(where, 'paused', 'owner', 'maintenance');
45
+ fs.writeFileSync(path.join(registry, 'broken.json'), '{');
46
+ fs.writeFileSync(path.join(registry, 'broken-new.json'), JSON.stringify({state: 'creation-pending'}));
47
+ function snapshot() {
48
+ return fs.readdirSync(where.root, {recursive: true}).sort().map(name => {
49
+ const file = path.join(where.root, name);
50
+ return [name, fs.statSync(file).isFile() ? fs.readFileSync(file) : null];
51
+ });
52
+ }
53
+ const before = snapshot();
54
+ const rows = await list();
55
+ assert.deepEqual(rows.map(row => row.role), ['broken', 'broken-new', 'moved', 'paused', 'worker']);
56
+ assert.deepEqual(rows[0], {role: 'broken', state: 'invalid', worktree: null, thread: null, socket: null, parked: false, error: 'unreadable-registration'});
57
+ assert.equal(rows[1].error, 'creation-pending');
58
+ assert.equal(rows[2].error, 'binding-mismatch');
59
+ assert.equal(rows[2].state, 'invalid');
60
+ for (const row of rows.slice(3)) {
61
+ assert.deepEqual(row, {role: row.role, state: 'managed', worktree: path.join(dir, row.role),
62
+ thread: row.role + '-thread', socket, parked: row.role === 'paused'});
63
+ }
64
+ assert.deepEqual(await list(), rows);
65
+ assert.deepEqual(snapshot(), before);
66
+ assert.equal(connections, 0);
67
+ });
68
+
12
69
  test('managed CLI lifecycle, mailbox scheduling and frame boundaries',async()=>{
13
70
  const dir=fs.mkdtempSync(path.join(os.tmpdir(),'keel-host-'));const sock=path.join(dir,'host.sock');const requests=[];const requestDetails=[];const peers=[];const blank=new Set(),lost=new Set();let active=true,serial=0,uncertain=false,invalidHost=false,injectNotice=false,unloaded=false,resumeActive=false,resumeFails=false,resumeMismatch=false,readMismatch=false,resumeDelay=false,initNameFails=false;
14
71
  let observationTurn = null;
@@ -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.11"
38
+ PACKAGE_VERSION = "5.231.12"
39
39
 
40
40
 
41
- PROTOCOL_VERSION = "5.231.11"
41
+ PROTOCOL_VERSION = "5.231.12"
42
42
 
43
43
 
44
44
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
@@ -244,6 +244,45 @@ async function observeDelivery(receipt, role, timeout) {
244
244
  return observation;
245
245
  }
246
246
 
247
+ function listManagedRoles(where) {
248
+ const fs = require('node:fs');
249
+ const store = require('./chat/store');
250
+ const {parkOf} = require('./chat/notice');
251
+ const directory = path.join(where.root, 'codex-roles');
252
+ let files;
253
+ try {
254
+ files = fs.readdirSync(directory, {withFileTypes: true});
255
+ } catch (error) {
256
+ if (error.code === 'ENOENT') return [];
257
+ throw error;
258
+ }
259
+ const bindings = store.readRoles(where.root);
260
+ const rows = files.filter(file => file.name.endsWith('.json')).map(file => {
261
+ const role = file.name.slice(0, -5);
262
+ const row = {role, state: 'invalid', worktree: null, thread: null, socket: null, parked: !!parkOf(where, role)};
263
+ let entry;
264
+ try {
265
+ if (!file.isFile()) return {...row, error: 'unreadable-registration'};
266
+ entry = JSON.parse(fs.readFileSync(path.join(directory, file.name), 'utf8'));
267
+ } catch {
268
+ return {...row, error: 'unreadable-registration'};
269
+ }
270
+ for (const key of ['worktree', 'thread', 'socket']) {
271
+ if (typeof entry?.[key] === 'string' && entry[key]) row[key] = entry[key];
272
+ }
273
+ if (entry?.state === 'creation-pending') return {...row, error: 'creation-pending'};
274
+ if (entry?.state !== 'managed' || entry.role !== role || !row.worktree || !row.thread || !row.socket) {
275
+ return {...row, error: 'invalid-registration'};
276
+ }
277
+ if (bindings[row.worktree] !== role || Object.values(bindings).filter(value => value === role).length !== 1) {
278
+ return {...row, error: 'binding-mismatch'};
279
+ }
280
+ row.state = 'managed';
281
+ return row;
282
+ });
283
+ return rows.sort((a, b) => a.role < b.role ? -1 : a.role > b.role ? 1 : 0);
284
+ }
285
+
247
286
  async function run(args) {
248
287
  const onboarding = require("./codex-onboarding");
249
288
  if (onboarding.actions.includes(args[0])) return onboarding.run(args, {connect});
@@ -253,12 +292,13 @@ async function run(args) {
253
292
  let registrationLock;
254
293
  try {
255
294
  const action = args.shift();
256
- if (!["status", "start", "deliver", "handover", "drain", "recover"].includes(action)) throw Error("Usage: keel codex status|start|deliver|handover|drain|recover [--socket path] [--role name] [--repo path] [--thread id] [--timeout ms] [--json]");
295
+ if (!["list", "status", "start", "deliver", "handover", "drain", "recover"].includes(action)) throw Error("Usage: keel codex list|status|start|deliver|handover|drain|recover [--socket path] [--role name] [--repo path] [--thread id] [--timeout ms] [--json]");
257
296
  const options = {socket: path.join(process.env.CODEX_HOME || path.join(os.homedir(), ".codex"), "app-server-control/app-server-control.sock"), timeout: 5000, repo: process.cwd()};
258
297
  let explicitSocket = false;
259
298
  let explicitTimeout = false;
260
299
  while (args.length) {
261
300
  const flag = args.shift();
301
+ if (action === "list" && !["--repo", "--json"].includes(flag)) throw Error("Usage: keel codex list [--repo path] [--json]");
262
302
  if (flag === "--json") options.json = true;
263
303
  else if (flag === "--observe") options.observe = true;
264
304
  else if (["--socket", "--thread", "--timeout", "--role", "--repo", "--record", "--text", "--note", "--approvals-reviewer"].includes(flag)) {
@@ -279,6 +319,11 @@ async function run(args) {
279
319
  if (!Number.isInteger(ms) || ms < 50 || ms > 60000) throw Error("timeout must be 50–60000 milliseconds");
280
320
  const fs = require("node:fs");
281
321
  const store = require("./chat/store");
322
+ if (action === "list") {
323
+ const roles = listManagedRoles(store.requireLocation(path.resolve(options.repo)));
324
+ process.stdout.write(JSON.stringify({roles}) + "\n");
325
+ return 0;
326
+ }
282
327
  if (action === "drain") {
283
328
  const deliveries = await wakeManaged(store.requireLocation(path.resolve(options.repo)), options.role);
284
329
  process.stdout.write(JSON.stringify({deliveries}) + "\n");