@getgavel/cli 0.1.5 → 0.1.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.
Files changed (2) hide show
  1. package/dist/gavel.js +13 -4
  2. package/package.json +1 -1
package/dist/gavel.js CHANGED
@@ -20,12 +20,14 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
20
20
  gavel get <D-12>
21
21
  gavel wait <D-12> [--timeout <seconds>] until it's decided (default 60)
22
22
  gavel withdraw <D-12> [--reason <words>] take back what you asked, while it isn't decided
23
- gavel attach <D-12> --file context.json a context item, or a list of them
23
+ gavel attach <D-12> --file context.json the sidebar's sections ({items, pictures, involved,
24
+ background}), or a context item, or a list of them
24
25
  gavel upload <file> [--type <content type>]
25
26
  a screenshot or recording (PNG, JPEG, GIF, WebP, HEIC up to
26
27
  50 MB; MP4, MOV up to 500 MB), sent and finished: put its id
27
- in a context item's attachmentId (section pictures, kind
28
- screenshot or recording) for attach, ask, todo or log
28
+ in pictures (which: before or after, and its order) for ask,
29
+ revise or attach, or in a context item's attachmentId
30
+ (section pictures) for todo or log
29
31
  gavel answer <requestId> (<response> | --response <words>)
30
32
  answer an Ask someone
31
33
  gavel act <D-12> (<note> | --note <words>)
@@ -188,6 +190,13 @@ const contextList = (file) => {
188
190
  const json = readJson(file);
189
191
  return Array.isArray(json) ? json : [json];
190
192
  };
193
+ // attach's body: the sidebar's sections ({items, pictures, involved, background}) as they are, else
194
+ // a context item or a list of them, as its items.
195
+ const SECTIONS = ["items", "pictures", "involved", "background"];
196
+ const attachBody = (file) => {
197
+ const json = readJson(file);
198
+ return json && typeof json === "object" && !Array.isArray(json) && SECTIONS.some((k) => k in json) ? json : { items: Array.isArray(json) ? json : [json] };
199
+ };
191
200
  // --as <name> (or --as=<name>) may come anywhere on the line; it's the caller's, not the command's.
192
201
  export function takeAs(argv) {
193
202
  const rest = [];
@@ -280,7 +289,7 @@ export function toRequest(argv) {
280
289
  return { method: "POST", path: `/v1/decisions/${ref(p[0])}/withdraw`, body: compact({ reason: f.reason && readText(f.reason) }) };
281
290
  case "attach":
282
291
  upTo(1);
283
- return { method: "POST", path: `/v1/decisions/${ref(p[0])}/context`, body: { items: contextList(need(f.file, "--file context.json")) } };
292
+ return { method: "POST", path: `/v1/decisions/${ref(p[0])}/context`, body: attachBody(need(f.file, "--file context.json")) };
284
293
  case "answer":
285
294
  return { method: "POST", path: `/v1/requests/${encodeURIComponent(need(p[0], "the request id"))}/answer`, body: { response: readText(words("response", p.slice(1), "the response")) } };
286
295
  case "act":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getgavel/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
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",