@getgavel/cli 0.1.11 → 0.1.13

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.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/dist/gavel.js +104 -14
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -31,6 +31,8 @@ gavel search "onboarding copy" # before you ask
31
31
  gavel ask --file decision.json # put a decision to your person
32
32
  gavel wait D-12 --timeout 60 # until it's decided
33
33
  gavel watch # one GAVEL_WAKE line per new thing for you; run it in the background
34
+ gavel find "nudge a decision" # the API's routes for what you want, and who may call each
35
+ gavel work claim # when you're free: your next ready task; work done W-12 when it ships
34
36
  gavel help # every command
35
37
  gavel act --help # one command's usage
36
38
  ```
@@ -53,6 +55,7 @@ gavel set-my-day --day-start 09:00 --day-end 18:00 # their day, alerts,
53
55
  gavel move-agent-mine <agent id> --under <agent id> # their agents: edit, pause, archive…
54
56
  gavel my-blockers # what's stuck; nudge-mine, reassign
55
57
  gavel invite-person --email gia@acme.com # their workspace: roles, areas, boards…
58
+ gavel answer-mine <requestId> "The second" --their-words "tell Ada the second" # their view; ask-mine too
56
59
  gavel call GET /v1/me --for-person true # any route, as you or as them
57
60
  ```
58
61
 
package/dist/gavel.js CHANGED
@@ -57,21 +57,31 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
57
57
  gavel work file (<title> | --title <words>) [--status <status>] [--description <words>]
58
58
  [--worker <email or agent> | --worker none] [--reporter <email or agent>]
59
59
  [--waiting-on <email or agent>] [--decision <D-12>] [--code <url>]... [--label <Group: Name>]...
60
+ [--waits-on <W-3,W-4>]
60
61
  a work item on the Board's Being done (W-12), when you
61
62
  start: you're its worker unless you name another, Backlog
62
63
  unless --status (Triage, Backlog, Needs Decision, Queued,
63
- Building, Blocked, Deployed, Icebox, Closed, Duplicate)
64
+ Building, Blocked, Deployed, Icebox, Closed, Duplicate);
65
+ --waits-on the items it waits on
64
66
  gavel work move <W-12> [<status>] [--waiting-on <email or agent>] [--decision <D-12>]
65
67
  [--code <url>]... [--worker <email or agent> | --worker none] [--title <words>]
66
- [--description <words>] [--label <Group: Name>]... [--label none]
68
+ [--description <words>] [--label <Group: Name>]... [--label none] [--waits-on <W-3,W-4> | --waits-on none]
67
69
  move it as your work moves: Building, Blocked with
68
70
  --waiting-on, Needs Decision with --decision, Deployed
69
71
  with --code (a commit or pull request; again for each);
70
- --label sets all its labels (again for each)
72
+ --label sets all its labels (again for each), --waits-on
73
+ all the items it waits on
71
74
  gavel work show <W-12> an item and its history
72
75
  gavel work list [--worker me|<email or agent>] [--status <status>] [--open true]
73
76
  the workspace's items, the latest changed first, and
74
77
  its labels
78
+ gavel work claim [--label <Group: Name>] [--area <area>]
79
+ when you're free: the next ready item, yours in Building
80
+ while you work (any call keeps it; 10 minutes quiet and
81
+ it goes back to Queued); none ready, what's waiting
82
+ gavel work renew <W-12> keep your claim through a long quiet stretch
83
+ gavel work release <W-12> [--why <words>] let it go: back to Queued, the why in its history
84
+ gavel work done <W-12> [--code <url>]... finish it: Deployed with its code, your claim ends
75
85
  gavel message (--to-agent <id> | --to-person <email>) (<text> | --text <words>) [--decision <D-12>]
76
86
  start a conversation with another agent
77
87
  gavel message --conversation <C-12> (<text> | --text <words>)
@@ -110,6 +120,8 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
110
120
  gavel call <GET|POST|PUT|PATCH|DELETE> </v1/path> [--query <name=value>] [--body <file.json>]
111
121
  [--for-person true] any route of the API as you, or as your person with
112
122
  --for-person: MCP's do_action, the answer as it comes
123
+ gavel find (<words> | --query <words>) [--limit <n>]
124
+ the API's routes for what you want to do, who may call each
113
125
  gavel me
114
126
  gavel my-queue [--view mine|asked|decided] [--before <time>] [--limit <n>]
115
127
  your person's queue, what they asked, or their Decided
@@ -173,7 +185,7 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
173
185
  a stuck decision to someone else, for them: an Admin's
174
186
  gavel workspace-settings its name, triage person, depth and untrusted areas
175
187
  gavel edit-workspace [--name <name>] [--triage-person <person id>|none] [--sub-agent-depth <n>]
176
- [--never-trusted <area id,area id>|none]
188
+ [--never-trusted <area id,area id>|none] [--coordinator <agent id>|none]
177
189
  Admins and Owners; only what you give changes
178
190
  gavel workspace-people everyone, with their role
179
191
  gavel set-role <person id> --role owner|admin|member
@@ -200,13 +212,20 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
200
212
  gavel workspace-logo the logo, and the ones its connections offer
201
213
  gavel set-workspace-logo slack|github|linear|none
202
214
  gavel workspace-connections what's connected, never a key; keys stay your person's
215
+ gavel ask-mine --file decision.json --their-words <words>
216
+ ask as your person, only on their word
217
+ gavel withdraw-mine <D-12> [--reason <words>]
218
+ take back one your person asked, while it isn't decided
219
+ gavel my-requests the Ask someone requests waiting on your person's view
220
+ gavel answer-mine <requestId> (<response> | --response <words>) --their-words <words>
221
+ their view, only on their word
203
222
 
204
223
  --as <name> on a fleet token, which chat you are (the name you go by,
205
224
  e.g. worker 35 or the task you're on; keep using the same one)
206
225
 
207
226
  gavel <command> --help shows one command's usage. A command refuses a flag or a word it doesn't
208
227
  take, and a flag given twice (but --option, --code, --label and --query), with its usage.
209
- The commands from my-queue to workspace-connections act for your person, as them, once they've let you
228
+ The commands from my-queue to answer-mine act for your person, as them, once they've let you
210
229
  (Settings › Agents); each goes with X-Gavel-For-Person.
211
230
  A text argument or --file of "-" is read from stdin.
212
231
  Environment: GAVEL_TOKEN (required, but a GitHub Actions job with id-token: write trades GitHub's
@@ -232,7 +251,7 @@ const FLAGS = {
232
251
  act: ["note"],
233
252
  inbox: [],
234
253
  status: ["text", "description", "folders", "state", "issue", "waiting-on", "item"],
235
- work: ["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label", "open"],
254
+ work: ["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label", "open", "waits-on", "area", "why"],
236
255
  message: ["to-agent", "to-person", "conversation", "text", "decision"],
237
256
  conversations: [],
238
257
  "wait-for-reply": ["timeout"],
@@ -250,6 +269,7 @@ const FLAGS = {
250
269
  "start-cloud-agent": ["name", "repo", "task", "branch", "open-pr", "machine", "agent"],
251
270
  "move-agent": ["under"],
252
271
  call: ["query", "body", "for-person"],
272
+ find: ["query", "limit"],
253
273
  me: [],
254
274
  "my-queue": ["view", "before", "limit"],
255
275
  "decide-mine": ["option", "text", "note", "their-words"],
@@ -289,7 +309,7 @@ const FLAGS = {
289
309
  "nudge-mine": [],
290
310
  reassign: ["to-person", "to-agent", "note"],
291
311
  "workspace-settings": [],
292
- "edit-workspace": ["name", "triage-person", "sub-agent-depth", "never-trusted"],
312
+ "edit-workspace": ["name", "triage-person", "sub-agent-depth", "never-trusted", "coordinator"],
293
313
  "workspace-people": [],
294
314
  "set-role": ["role"],
295
315
  invitations: [],
@@ -311,6 +331,10 @@ const FLAGS = {
311
331
  "workspace-logo": [],
312
332
  "set-workspace-logo": [],
313
333
  "workspace-connections": [],
334
+ "ask-mine": ["file", "their-words"],
335
+ "withdraw-mine": ["reason"],
336
+ "my-requests": [],
337
+ "answer-mine": ["response", "their-words"],
314
338
  };
315
339
  // Your person's own actions, sent as them (X-Gavel-For-Person) once they've let you act for them
316
340
  // (D-911): the MCP tools' names.
@@ -375,6 +399,10 @@ const FOR_PERSON = [
375
399
  "workspace-logo",
376
400
  "set-workspace-logo",
377
401
  "workspace-connections",
402
+ "ask-mine",
403
+ "withdraw-mine",
404
+ "my-requests",
405
+ "answer-mine",
378
406
  ];
379
407
  const isCommand = (name) => Object.hasOwn(FLAGS, name);
380
408
  // A command's own entries in USAGE: each line naming it, with the lines indented under it.
@@ -440,29 +468,55 @@ function workRequest(p, f, code, label) {
440
468
  const description = f.description === undefined ? undefined : readText(f.description);
441
469
  const links = code.length ? code.map((url) => ({ url })) : undefined;
442
470
  const labels = !label.length ? undefined : label.length === 1 && label[0] === "none" ? [] : label;
471
+ const waitsOn = f["waits-on"] === undefined ? undefined : f["waits-on"] === "none" ? [] : f["waits-on"].split(",").map((r) => r.trim()).filter(Boolean);
443
472
  const ref = (value) => {
444
473
  if (!value || !/^W-\d+$/i.test(value))
445
474
  throw new UsageError(`work ${sub} needs its item, like W-12`);
446
475
  return encodeURIComponent(value.toUpperCase());
447
476
  };
477
+ const onlyItem = () => {
478
+ if (rest.length > 1)
479
+ throw new UsageError(`work ${sub} doesn't take "${rest[1]}"`);
480
+ return ref(rest[0]);
481
+ };
448
482
  switch (sub) {
449
483
  case "file": {
450
- only(["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label"]);
484
+ only(["title", "status", "description", "worker", "reporter", "waiting-on", "decision", "code", "label", "waits-on"]);
451
485
  if (f.title !== undefined && rest.length)
452
486
  throw new UsageError("give the title once: as words or as --title");
453
487
  const title = readText(need(f.title ?? rest.join(" "), "the item's title"));
454
- return { method: "POST", path: "/v1/work", body: compact({ title, status: f.status, description, worker, reporter: f.reporter, waitingOn: f["waiting-on"], decision: f.decision, code: links, labels }) };
488
+ return {
489
+ method: "POST",
490
+ path: "/v1/work",
491
+ body: compact({ title, status: f.status, description, worker, reporter: f.reporter, waitingOn: f["waiting-on"], decision: f.decision, code: links, labels, waitsOn }),
492
+ };
455
493
  }
456
494
  case "move": {
457
- only(["title", "status", "description", "worker", "waiting-on", "decision", "code", "label"]);
495
+ only(["title", "status", "description", "worker", "waiting-on", "decision", "code", "label", "waits-on"]);
458
496
  const [item, ...words] = rest;
459
497
  if (f.status !== undefined && words.length)
460
498
  throw new UsageError("give the status once: as words or as --status");
461
- const body = compact({ status: f.status ?? (words.join(" ") || undefined), title: f.title, description, worker, waitingOn: f["waiting-on"], decision: f.decision, code: links, labels });
499
+ 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 });
462
500
  if (!Object.keys(body).length)
463
501
  throw new UsageError("work move needs a status or something to change");
464
502
  return { method: "PATCH", path: `/v1/work/${ref(item)}`, body };
465
503
  }
504
+ case "claim":
505
+ only(["label", "area"]);
506
+ if (rest.length)
507
+ throw new UsageError(`work claim doesn't take "${rest[0]}"`);
508
+ if (label.length > 1)
509
+ throw new UsageError("work claim takes one --label");
510
+ return { method: "POST", path: "/v1/work/claim", body: compact({ label: label[0], area: f.area }) };
511
+ case "renew":
512
+ only([]);
513
+ return { method: "POST", path: `/v1/work/${onlyItem()}/renew`, body: {} };
514
+ case "release":
515
+ only(["why"]);
516
+ return { method: "POST", path: `/v1/work/${onlyItem()}/release`, body: compact({ why: f.why === undefined ? undefined : readText(f.why) }) };
517
+ case "done":
518
+ only(["code"]);
519
+ return { method: "POST", path: `/v1/work/${onlyItem()}/done`, body: compact({ code: links }) };
466
520
  case "show":
467
521
  only([]);
468
522
  if (rest.length > 1)
@@ -478,7 +532,7 @@ function workRequest(p, f, code, label) {
478
532
  return { method: "GET", path: `/v1/work${query.size ? `?${query}` : ""}` };
479
533
  }
480
534
  default:
481
- throw new UsageError(sub ? `work doesn't take "${sub}": use file, move, show or list` : "work needs file, move, show or list");
535
+ throw new UsageError(sub ? `work doesn't take "${sub}": use file, move, show, list, claim, renew, release or done` : "work needs file, move, show, list, claim, renew, release or done");
482
536
  }
483
537
  }
484
538
  // gavel my-queue … overrule: your person's actions, as them (FOR_PERSON).
@@ -686,6 +740,7 @@ function personRequest(command, p, f, options) {
686
740
  triagePersonId: orNone("triage-person"),
687
741
  subAgentMaxDepth: depth === undefined ? undefined : Number(depth),
688
742
  neverTrustableAreaIds: untrusted === undefined ? undefined : untrusted === "none" ? [] : list(untrusted),
743
+ coordinatorAgentId: orNone("coordinator"),
689
744
  });
690
745
  if (!Object.keys(body).length)
691
746
  throw new UsageError("edit-workspace needs something to change");
@@ -775,6 +830,24 @@ function personRequest(command, p, f, options) {
775
830
  case "workspace-connections":
776
831
  upTo(0);
777
832
  return asThem("GET", "/v1/connections");
833
+ case "ask-mine": {
834
+ upTo(0);
835
+ const decision = readJson(need(f.file, "--file decision.json"));
836
+ if (!decision || typeof decision !== "object" || Array.isArray(decision))
837
+ throw new UsageError("--file holds one decision, as MCP ask's input");
838
+ return asThem("POST", "/v1/decisions", { ...decision, theirWords: theirWords() });
839
+ }
840
+ case "withdraw-mine":
841
+ upTo(1);
842
+ return asThem("POST", `/v1/decisions/${ref(p[0])}/withdraw`, { reason: f.reason && readText(f.reason) });
843
+ case "my-requests":
844
+ upTo(0);
845
+ return asThem("GET", "/v1/requests");
846
+ case "answer-mine":
847
+ return asThem("POST", `/v1/requests/${encodeURIComponent(need(p[0], "the request id"))}/answer`, {
848
+ response: words("response", p.slice(1), "the response"),
849
+ theirWords: theirWords(),
850
+ });
778
851
  default:
779
852
  throw new UsageError(`unknown command "${command}"`);
780
853
  }
@@ -1041,6 +1114,14 @@ export function toRequest(argv) {
1041
1114
  agentId: f.agent,
1042
1115
  }),
1043
1116
  };
1117
+ case "find": {
1118
+ const q = words("query", p, "what you want to do, in words");
1119
+ const limit = f.limit;
1120
+ if (limit !== undefined && !/^\d+$/.test(limit))
1121
+ throw new UsageError("--limit is a number");
1122
+ const query = new URLSearchParams({ q, ...(limit ? { limit } : {}) });
1123
+ return { method: "GET", path: `/v1/actions?${query}` };
1124
+ }
1044
1125
  case "move-agent":
1045
1126
  upTo(1);
1046
1127
  return { method: "PATCH", path: `/v1/agents/${encodeURIComponent(need(p[0], "the agent's id"))}`, body: { parentAgentId: need(f.under, "--under") } };
@@ -1393,7 +1474,8 @@ async function upload(token, as, { file, contentType }) {
1393
1474
  return 0;
1394
1475
  }
1395
1476
  // One line per thing that should wake the chat: refs and Gavel's own words only, never a message's
1396
- // text, so the line itself is never someone else's instructions.
1477
+ // text, so the line itself is never someone else's instructions. A kind newer than this command
1478
+ // still wakes it, with a line that sends it to the inbox.
1397
1479
  export function wakeLine(item) {
1398
1480
  switch (item.kind) {
1399
1481
  case "message":
@@ -1410,6 +1492,14 @@ export function wakeLine(item) {
1410
1492
  : "GAVEL_WAKE clash in your folders: see gavel inbox, and wait for the agent above to say who gets it";
1411
1493
  case "chat":
1412
1494
  return "GAVEL_WAKE chat: your person wrote to you in Gavel: read it with gavel chat";
1495
+ case "health":
1496
+ return "GAVEL_WAKE health: Gavel's chat self-check: see gavel inbox";
1497
+ case "claim":
1498
+ 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`;
1499
+ case "work":
1500
+ return `GAVEL_WAKE work ${item.ref} Blocked half an hour: move it, or name it Blocked again with gavel work move ${item.ref} Blocked`;
1501
+ default:
1502
+ return "GAVEL_WAKE something new: see gavel inbox";
1413
1503
  }
1414
1504
  }
1415
1505
  const backoff = (failures) => Math.min(30_000, 1000 * 2 ** Math.min(failures - 1, 5));
@@ -1423,7 +1513,7 @@ async function watch(token, as) {
1423
1513
  for (;;) {
1424
1514
  let res;
1425
1515
  try {
1426
- res = await fetch(`${base}/v1/inbox/watch?watch=${id}&timeout=50${start ? "&start=true" : ""}`, {
1516
+ res = await fetch(`${base}/v1/inbox/watch?watch=${id}&timeout=50&kinds=health,claim,work${start ? "&start=true" : ""}`, {
1427
1517
  headers: { authorization: `Bearer ${token}`, accept: "application/json", ...agentHeader(as) },
1428
1518
  });
1429
1519
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getgavel/cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
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",