@getgavel/cli 0.1.23 → 0.1.24

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": "gavel",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "displayName": "Gavel",
5
5
  "description": "Gavel in Claude Code: your person's chat in Gavel reaches your sessions at once (Gavel's bridge, started with each session), the end-of-turn reminder of what's waiting for you, and how to work with Gavel.",
6
6
  "author": { "name": "Gavel", "url": "https://getgavel.ai" },
@@ -110,6 +110,32 @@ export function displayHook(home, cwd) {
110
110
  }
111
111
  return { port, secret, url: `http://127.0.0.1:${port}${DISPLAY_PATH}${secret}`, file };
112
112
  }
113
+ // The display hook on another port, the folder's own being another program's: kept for next time,
114
+ // and its address rewritten where the bridge's hooks put it, the folder's own settings, which a
115
+ // running session reloads; never in a file git tracks. What it did, in words for the bridge's log.
116
+ export function moveDisplayHook(home, cwd, port) {
117
+ const was = displayHook(home, cwd);
118
+ writeFileSync(was.file, `${JSON.stringify({ port, secret: was.secret })}\n`, { mode: 0o600 });
119
+ const name = ".claude/settings.local.json";
120
+ let settings;
121
+ try {
122
+ settings = JSON.parse(readFileSync(join(cwd, name), "utf8"));
123
+ }
124
+ catch {
125
+ return `kept it; no ${name} here names the hook`;
126
+ }
127
+ const named = Object.values(settings.hooks ?? {})
128
+ .flatMap((groups) => (groups ?? []).flatMap((g) => g.hooks ?? []))
129
+ .filter((h) => h.url === was.url);
130
+ if (!named.length)
131
+ return `kept it; ${name} doesn't name the hook`;
132
+ if (gitIn(["ls-files", "--error-unmatch", name], cwd))
133
+ return `kept it, but git tracks ${name}, so the hook there still names the old port`;
134
+ for (const h of named)
135
+ h.url = `http://127.0.0.1:${port}${DISPLAY_PATH}${was.secret}`;
136
+ writeWhole(join(cwd, name), `${JSON.stringify(settings, null, 2)}\n`);
137
+ return `wrote it into ${name}`;
138
+ }
113
139
  const gitIn = (args, cwd) => {
114
140
  try {
115
141
  execFileSync("git", args, { cwd, stdio: "ignore" });
@@ -662,8 +688,10 @@ export class ClaudeCodeHarness {
662
688
  this.listener = l;
663
689
  this.stateNow();
664
690
  void this.liveSession().then(() => this.stateNow());
691
+ // Claude Code's words as they're shown, on the folder's own port; one another program holds is
692
+ // left for one the system hands out, so they're neither unheard nor sent to that program.
665
693
  const hook = displayHook(this.ctx.home, this.ctx.cwd);
666
- this.display = createServer((req, res) => {
694
+ const display = createServer((req, res) => {
667
695
  let raw = "";
668
696
  req.on("data", (c) => {
669
697
  raw += c;
@@ -684,11 +712,24 @@ export class ClaudeCodeHarness {
684
712
  }
685
713
  });
686
714
  });
687
- this.display.on("error", () => {
715
+ let moved = false;
716
+ display.on("error", (e) => {
717
+ if (e.code === "EADDRINUSE" && !moved) {
718
+ moved = true;
719
+ display.listen(0, "127.0.0.1");
720
+ return;
721
+ }
688
722
  this.display = null;
723
+ console.error(`gavel bridge: Claude Code's words as they're shown can't reach the bridge here (${e.code ?? e.message}); they show in Gavel once kept.`);
724
+ });
725
+ display.on("listening", () => {
726
+ const at = display.address();
727
+ if (moved)
728
+ console.error(`gavel bridge: another program holds port ${hook.port}, where Claude Code sends its words as they're shown, so the bridge took ${at.port} and ${moveDisplayHook(this.ctx.home, this.ctx.cwd, at.port)}.`);
689
729
  });
690
- this.display.listen(hook.port, "127.0.0.1");
691
- this.display.unref();
730
+ display.listen(hook.port, "127.0.0.1");
731
+ display.unref();
732
+ this.display = display;
692
733
  }
693
734
  // The chat off in Gavel (D-1140): what the bridge kept on the laptop for it goes too, its copies
694
735
  // of the person's pictures and the ids it joins by. The hooks stay: they start no bridge while
package/dist/gavel.js CHANGED
@@ -99,21 +99,25 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
99
99
  gavel work file (<title> | --title <words>) [--status <status>] [--description <words>]
100
100
  [--worker <email or agent> | --worker none] [--reporter <email or agent>]
101
101
  [--waiting-on <email or agent>] [--decision <D-12>] [--code <url>]... [--label <Group: Name>]...
102
- [--waits-on <W-3,W-4>] [--key <key>]
102
+ [--waits-on <W-3,W-4>] [--program <W-145>] [--key <key>]
103
103
  a work item on the Board's Being done (W-12), when you
104
- start: you're its worker unless you name another, Backlog
104
+ start: you're its worker unless you name another, your
105
+ person its reporter unless you name who directed it (you
106
+ only for your own finding), Backlog
105
107
  unless --status (Triage, Backlog, Needs Decision, Queued,
106
108
  Building, Blocked, Deployed, Icebox, Closed, Duplicate);
107
- --waits-on the items it waits on; --key your own id for
108
- it, so a retry files it once
109
+ --waits-on the items it waits on; --program the item
110
+ it's a piece of; --key your own id for it, so a retry
111
+ files it once
109
112
  gavel work move <W-12> [<status>] [--waiting-on <email or agent>] [--decision <D-12>]
110
- [--code <url>]... [--worker <email or agent> | --worker none] [--title <words>]
111
- [--description <words>] [--label <Group: Name>]... [--label none] [--waits-on <W-3,W-4> | --waits-on none]
113
+ [--code <url>]... [--worker <email or agent> | --worker none] [--reporter <email or agent>]
114
+ [--title <words>] [--description <words>] [--label <Group: Name>]... [--label none]
115
+ [--waits-on <W-3,W-4> | --waits-on none] [--program <W-145> | --program none]
112
116
  move it as your work moves: Building, Blocked with
113
117
  --waiting-on, Needs Decision with --decision, Deployed
114
118
  with --code (a commit or pull request; again for each);
115
119
  --label sets all its labels (again for each), --waits-on
116
- all the items it waits on
120
+ all the items it waits on, --reporter who directed it
117
121
  gavel work show <W-12> an item and its history
118
122
  gavel work list [--worker me|<email or agent>] [--status <status>] [--open true]
119
123
  the workspace's items, the latest changed first, and
@@ -127,11 +131,13 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
127
131
  gavel work done <W-12> [--code <url>]... finish it: Deployed with its code, your claim ends; if
128
132
  your push already deployed it, done, the code added
129
133
  gavel message (--to-agent <id> | --to-person <email>) (<text> | --text <words>) [--decision <D-12>]
130
- [--no-reply true] [--key <key>]
134
+ [--no-reply true] [--now true] [--key <key>]
131
135
  start a conversation with another agent
132
- gavel message --conversation <C-12> (<text> | --text <words>) [--no-reply true] [--key <key>]
136
+ gavel message --conversation <C-12> (<text> | --text <words>) [--no-reply true] [--now true] [--key <key>]
133
137
  reply in one; --no-reply true: a note, which never wakes
134
- them; --key: your own id for it, so a retry sends it once
138
+ them; --now true: wake an agent below you at once (else
139
+ it comes with their next routine wake); --key: your own
140
+ id for it, so a retry sends it once
135
141
  gavel message --item <W-12> (<text> | --text <words>) [--no-reply true] [--key <key>]
136
142
  write in a work item's thread, which all on it read
137
143
  gavel conversations [<C-12>] yours, or one with its messages (reads it)
@@ -195,7 +201,8 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
195
201
  gavel undo <eventId> their latest action, by them or by you (the card's
196
202
  undo.eventId)
197
203
  gavel todo-done <D-12> --their-words <words> [--note <words>]
198
- gavel todo-cant <D-12> (<reason> | --reason <words>) --their-words <words>
204
+ gavel todo-ignore <D-12> [<reason> | --reason <words>] --their-words <words>
205
+ closes it; its asker hears it was ignored
199
206
  gavel decided-without-you [--date <YYYY-MM-DD>]
200
207
  what their agents decided on their own that day
201
208
  gavel overrule <D-12> [--text <words> --their-words <words>] [--note <words>]
@@ -208,6 +215,10 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
208
215
  [--later-like-now true|false] [--muted true|false] [--workspace-sound <name>|none]
209
216
  [--snooze-until <time>|none]
210
217
  gavel set-my-reports [--weekly-report true|false] [--slack-messages true|false]
218
+ gavel set-agent-runtime <agent id> [--model <id>|cursor-default|none] [--effort low|medium|high|xhigh|max|none]
219
+ [--context 300k|1m|none] a Cursor agent's model, effort and context (none: the router's)
220
+ gavel set-area-runtime <area id> [--model <id>|cursor-default|none] [--effort <effort>|none] [--context 300k|1m|none]
221
+ gavel set-job-runtime work|wake|chat|night [--model <id>|cursor-default|none] [--effort <effort>|none] [--context 300k|1m|none]
211
222
  gavel my-notifications [--limit <n>] what went out to them, and how many are unread
212
223
  gavel mark-notification-read <id>
213
224
  gavel my-weekly-report
@@ -310,8 +321,8 @@ const FLAGS = {
310
321
  inbox: [],
311
322
  status: ["text", "description", "folders", "state", "issue", "waiting-on", "item"],
312
323
  "claim-folders": ["mode", "item"],
313
- work: ["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label", "open", "waits-on", "area", "why", "key"],
314
- message: ["to-agent", "to-person", "conversation", "item", "text", "decision", "no-reply", "key"],
324
+ work: ["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label", "open", "waits-on", "program", "area", "why", "key"],
325
+ message: ["to-agent", "to-person", "conversation", "item", "text", "decision", "no-reply", "now", "key"],
315
326
  thread: [],
316
327
  conversations: [],
317
328
  "wait-for-reply": ["timeout"],
@@ -341,6 +352,7 @@ const FLAGS = {
341
352
  defer: ["trust-words"],
342
353
  undo: [],
343
354
  "todo-done": ["note", "their-words"],
355
+ "todo-ignore": ["reason", "their-words"],
344
356
  "todo-cant": ["reason", "their-words"],
345
357
  "decided-without-you": ["date"],
346
358
  overrule: ["text", "note", "their-words"],
@@ -348,6 +360,9 @@ const FLAGS = {
348
360
  "set-my-day": ["timezone", "day-start", "day-end", "morning", "later-every"],
349
361
  "set-my-alerts": ["on-call", "sounds", "sound", "later-like-now", "muted", "workspace-sound", "snooze-until"],
350
362
  "set-my-reports": ["weekly-report", "slack-messages"],
363
+ "set-agent-runtime": ["model", "effort", "context"],
364
+ "set-area-runtime": ["model", "effort", "context"],
365
+ "set-job-runtime": ["model", "effort", "context"],
351
366
  "my-notifications": ["limit"],
352
367
  "mark-notification-read": [],
353
368
  "my-weekly-report": [],
@@ -409,6 +424,7 @@ const FOR_PERSON = [
409
424
  "defer",
410
425
  "undo",
411
426
  "todo-done",
427
+ "todo-ignore",
412
428
  "todo-cant",
413
429
  "decided-without-you",
414
430
  "overrule",
@@ -416,6 +432,9 @@ const FOR_PERSON = [
416
432
  "set-my-day",
417
433
  "set-my-alerts",
418
434
  "set-my-reports",
435
+ "set-agent-runtime",
436
+ "set-area-runtime",
437
+ "set-job-runtime",
419
438
  "my-notifications",
420
439
  "mark-notification-read",
421
440
  "my-weekly-report",
@@ -542,22 +561,23 @@ function workRequest(p, f, code, label) {
542
561
  };
543
562
  switch (sub) {
544
563
  case "file": {
545
- only(["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label", "waits-on", "key"]);
564
+ only(["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label", "waits-on", "program", "key"]);
546
565
  if (f.title !== undefined && rest.length)
547
566
  throw new UsageError("give the title once: as words or as --title");
548
567
  const title = readText(need(f.title ?? rest.join(" "), "the item's title"));
549
568
  return {
550
569
  method: "POST",
551
570
  path: "/v1/work",
552
- body: compact({ title, status: f.status, description, worker, reporter: f.reporter, waitingOn: f["waiting-on"], decision: f.decision, code: links, labels, waitsOn, key: f.key }),
571
+ body: compact({ title, status: f.status, description, worker, reporter: f.reporter, waitingOn: f["waiting-on"], decision: f.decision, code: links, labels, waitsOn, program: f.program, key: f.key }),
553
572
  };
554
573
  }
555
574
  case "move": {
556
- only(["title", "status", "description", "worker", "waiting-on", "decision", "code", "label", "waits-on"]);
575
+ only(["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label", "waits-on", "program"]);
557
576
  const [item, ...words] = rest;
558
577
  if (f.status !== undefined && words.length)
559
578
  throw new UsageError("give the status once: as words or as --status");
560
- const body = compact({ status: f.status ?? (words.join(" ") || undefined), title: f.title, description, worker, waitingOn: f["waiting-on"], decision: f.decision, code: links, labels, waitsOn });
579
+ const program = f.program === undefined ? undefined : f.program === "none" ? null : f.program;
580
+ const body = compact({ status: f.status ?? (words.join(" ") || undefined), title: f.title, description, worker, reporter: f.reporter, waitingOn: f["waiting-on"], decision: f.decision, code: links, labels, waitsOn, program });
561
581
  if (!Object.keys(body).length)
562
582
  throw new UsageError("work move needs a status or something to change");
563
583
  return { method: "PATCH", path: `/v1/work/${ref(item)}`, body };
@@ -664,8 +684,14 @@ function personRequest(command, p, f, options) {
664
684
  case "todo-done":
665
685
  upTo(1);
666
686
  return asThem("POST", `/v1/decisions/${ref(p[0])}/done`, { note: f.note && readText(f.note), theirWords: theirWords() });
667
- case "todo-cant":
668
- return asThem("POST", `/v1/decisions/${ref(p[0])}/cant`, { reason: words("reason", p.slice(1), "why it can't be done"), theirWords: theirWords() });
687
+ // todo-cant is todo-ignore's earlier name.
688
+ case "todo-ignore":
689
+ case "todo-cant": {
690
+ if (f.reason !== undefined && p.length > 1)
691
+ throw new UsageError("give why once: as words or as --reason");
692
+ const reason = f.reason ?? p.slice(1).join(" ");
693
+ return asThem("POST", `/v1/decisions/${ref(p[0])}/ignore`, { reason: reason ? readText(reason) : undefined, theirWords: theirWords() });
694
+ }
669
695
  case "decided-without-you":
670
696
  upTo(0);
671
697
  return asThem("GET", `/v1/decided-without-you${f.date ? `?date=${encodeURIComponent(f.date)}` : ""}`);
@@ -696,6 +722,19 @@ function personRequest(command, p, f, options) {
696
722
  case "set-my-reports":
697
723
  upTo(0);
698
724
  return changes({ weeklyReport: yesNo("weekly-report"), slackMessages: yesNo("slack-messages") });
725
+ case "set-agent-runtime":
726
+ case "set-area-runtime":
727
+ case "set-job-runtime": {
728
+ upTo(1);
729
+ const body = compact({ model: orNone("model"), effort: orNone("effort"), context: orNone("context") });
730
+ if (!Object.keys(body).length)
731
+ throw new UsageError("give --model, --effort or --context: none sets one back to the router's pick");
732
+ if (command === "set-agent-runtime")
733
+ return asThem("PUT", `/v1/agents/${encodeURIComponent(need(p[0], "the agent's id"))}/runtime`, body);
734
+ if (command === "set-area-runtime")
735
+ return asThem("PUT", `/v1/areas/${encodeURIComponent(need(p[0], "the area's id"))}/runtime`, body);
736
+ return asThem("PUT", `/v1/workspace/runtime/jobs/${encodeURIComponent(need(p[0], "the kind of job: work, wake, chat or night"))}`, body);
737
+ }
699
738
  case "my-notifications":
700
739
  upTo(0);
701
740
  return asThem("GET", `/v1/notifications${f.limit ? `?limit=${encodeURIComponent(f.limit)}` : ""}`);
@@ -1153,7 +1192,7 @@ export function toRequest(argv) {
1153
1192
  case "message": {
1154
1193
  const text = readText(words("text", p, "what to say"));
1155
1194
  if (f.item) {
1156
- if (f.conversation || f["to-agent"] || f["to-person"] || f.decision !== undefined)
1195
+ if (f.conversation || f["to-agent"] || f["to-person"] || f.decision !== undefined || f.now !== undefined)
1157
1196
  throw new UsageError("--item writes in a work item's thread: give it alone, with --no-reply and --key if you like");
1158
1197
  const quiet = f["no-reply"];
1159
1198
  if (quiet !== undefined && quiet !== "true" && quiet !== "false")
@@ -1167,7 +1206,9 @@ export function toRequest(argv) {
1167
1206
  const noReply = f["no-reply"];
1168
1207
  if (noReply !== undefined && noReply !== "true" && noReply !== "false")
1169
1208
  throw new UsageError("--no-reply is true or false");
1170
- const sending = { noReply: noReply === undefined ? undefined : noReply === "true", key: f.key };
1209
+ if (f.now !== undefined && f.now !== "true" && f.now !== "false")
1210
+ throw new UsageError("--now is true or false");
1211
+ const sending = { noReply: noReply === undefined ? undefined : noReply === "true", now: f.now === undefined ? undefined : f.now === "true", key: f.key };
1171
1212
  if (f.conversation)
1172
1213
  return { method: "POST", path: `/v1/conversations/${encodeURIComponent(f.conversation)}/messages`, body: compact({ text, ...sending }) };
1173
1214
  return { method: "POST", path: "/v1/conversations", body: compact({ toAgentId: f["to-agent"], toPerson: f["to-person"], text, decision: f.decision, ...sending }) };
@@ -1836,7 +1877,9 @@ export function wakeLine(item) {
1836
1877
  case "claim":
1837
1878
  return `GAVEL_WAKE claim on ${item.ref} ran out, back in Queued: see gavel inbox, then give it to an agent or let one claim it`;
1838
1879
  case "work":
1839
- return `GAVEL_WAKE work ${item.ref} Blocked half an hour: move it, or name it Blocked again with gavel work move ${item.ref} Blocked`;
1880
+ return item.type === "stale"
1881
+ ? `GAVEL_WAKE work ${item.ref} two hours quiet in Building: move it to where it really is (gavel work done ${item.ref}, gavel work release ${item.ref}, or Blocked with gavel work move), or work on it`
1882
+ : `GAVEL_WAKE work ${item.ref} Blocked half an hour: move it, or name it Blocked again with gavel work move ${item.ref} Blocked`;
1840
1883
  case "drift":
1841
1884
  return `GAVEL_WAKE drift on ${item.ref}: it may go against ${item.type ?? "a decision"}: see gavel inbox`;
1842
1885
  case "task":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getgavel/cli",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "The gavel command: an agent's Gavel from a shell (pair, ask, wait, watch and the rest)",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://getgavel.ai/agents",