@getgavel/cli 0.1.17 → 0.1.19
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 -0
- package/dist/bridge/bridge.js +22 -7
- package/dist/gavel.js +13 -3
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gavel",
|
|
3
|
+
"version": "0.1.19",
|
|
3
4
|
"displayName": "Gavel",
|
|
4
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.",
|
|
5
6
|
"author": { "name": "Gavel", "url": "https://getgavel.ai" },
|
package/dist/bridge/bridge.js
CHANGED
|
@@ -125,6 +125,17 @@ function joined(events) {
|
|
|
125
125
|
return out;
|
|
126
126
|
}
|
|
127
127
|
const sentKey = (m) => `${m.text}\u0000${m.gavelId ?? ""}`;
|
|
128
|
+
// An answer from Gavel the bridge can read, or null (a proxy's page, a cut-off body): treated as a
|
|
129
|
+
// failed call, so nothing Gavel or the network sends can end the bridge.
|
|
130
|
+
async function answer(res) {
|
|
131
|
+
try {
|
|
132
|
+
const body = (await res.json());
|
|
133
|
+
return body && typeof body === "object" ? body : null;
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
128
139
|
// The Gavel side for a harness: the one peek (presence, the person's messages, Stop), their messages
|
|
129
140
|
// put in beside it with their pictures, the session's words kept (the transcript) and shown as written
|
|
130
141
|
// (live), its state, and wakes for what waits in Gavel.
|
|
@@ -325,6 +336,9 @@ async function harnessBridge(h, harness, setup, ctx) {
|
|
|
325
336
|
pending = [];
|
|
326
337
|
}
|
|
327
338
|
}
|
|
339
|
+
catch (err) {
|
|
340
|
+
complain(`${err instanceof Error ? err.message : String(err)} waking ${h.name}; trying again`);
|
|
341
|
+
}
|
|
328
342
|
finally {
|
|
329
343
|
waking = false;
|
|
330
344
|
}
|
|
@@ -352,14 +366,15 @@ async function harnessBridge(h, harness, setup, ctx) {
|
|
|
352
366
|
console.error(`gavel bridge: HTTP ${res.status} watching what waits in Gavel; ${h.name} isn't woken for it`);
|
|
353
367
|
return;
|
|
354
368
|
}
|
|
355
|
-
|
|
369
|
+
const body = res.ok ? await answer(res) : null;
|
|
370
|
+
if (!body) {
|
|
356
371
|
failures++;
|
|
357
372
|
await pause(backoff(failures));
|
|
358
373
|
continue;
|
|
359
374
|
}
|
|
360
375
|
failures = 0;
|
|
361
376
|
start = false;
|
|
362
|
-
const
|
|
377
|
+
const items = Array.isArray(body.items) ? body.items : [];
|
|
363
378
|
const known = new Set(pending.map((i) => `${i.kind}:${i.id}`));
|
|
364
379
|
pending.push(...items.filter((i) => i.kind !== "chat" && !known.has(`${i.kind}:${i.id}`)));
|
|
365
380
|
await tryWake();
|
|
@@ -407,7 +422,7 @@ async function harnessBridge(h, harness, setup, ctx) {
|
|
|
407
422
|
process.on("SIGINT", () => stop());
|
|
408
423
|
process.on("SIGTERM", () => stop());
|
|
409
424
|
const here = { home: ctx.home, cwd: ctx.cwd, harness };
|
|
410
|
-
void watchLoop();
|
|
425
|
+
void watchLoop().catch((err) => console.error(`gavel bridge: ${err instanceof Error ? err.message : String(err)}; ${h.name} isn't woken for what waits in Gavel`));
|
|
411
426
|
let start = true;
|
|
412
427
|
let failures = 0;
|
|
413
428
|
try {
|
|
@@ -433,15 +448,15 @@ async function harnessBridge(h, harness, setup, ctx) {
|
|
|
433
448
|
console.error(`gavel bridge: ${(await res.text()) || `HTTP ${res.status}`}`);
|
|
434
449
|
return 1;
|
|
435
450
|
}
|
|
436
|
-
|
|
451
|
+
const peeked = res.ok ? await answer(res) : null;
|
|
452
|
+
if (!peeked || typeof peeked.on !== "boolean") {
|
|
437
453
|
failures++;
|
|
438
|
-
console.error(`gavel bridge: HTTP ${res.status}; trying again`);
|
|
454
|
+
console.error(`gavel bridge: ${res.ok ? "an answer it can't read" : `HTTP ${res.status}`}; trying again`);
|
|
439
455
|
await pause(backoff(failures));
|
|
440
456
|
continue;
|
|
441
457
|
}
|
|
442
458
|
failures = 0;
|
|
443
459
|
start = false;
|
|
444
|
-
const peeked = (await res.json());
|
|
445
460
|
if (peeked.stop?.id)
|
|
446
461
|
void stopTurn(peeked.stop.id);
|
|
447
462
|
if (peeked.on !== on) {
|
|
@@ -469,7 +484,7 @@ async function harnessBridge(h, harness, setup, ctx) {
|
|
|
469
484
|
}
|
|
470
485
|
if (!on)
|
|
471
486
|
continue;
|
|
472
|
-
const waiting = peeked.unread.filter((u) => !handled.has(u.id));
|
|
487
|
+
const waiting = (Array.isArray(peeked.unread) ? peeked.unread : []).filter((u) => !handled.has(u.id));
|
|
473
488
|
for (const m of waiting)
|
|
474
489
|
if (!delivering.has(m.id))
|
|
475
490
|
enqueue(m);
|
package/dist/gavel.js
CHANGED
|
@@ -63,10 +63,12 @@ const USAGE = `gavel: Gavel from the command line (https://getgavel.ai/agents)
|
|
|
63
63
|
gavel revise <D-12> --file decision.json a draft the editor sent back, fixed (the whole ask again)
|
|
64
64
|
gavel todo --file todo.json ask a person to do something: title, steps, why (MCP ask_to_do's input)
|
|
65
65
|
gavel get <D-12>
|
|
66
|
-
gavel subscribe (<D-12> | --item <W-12> [--stop true])
|
|
66
|
+
gavel subscribe (<D-12> | --item <W-12> [--stop true] | --quiet answer,decision|none)
|
|
67
67
|
follow a decision you didn't ask (wait returns its answer
|
|
68
68
|
to you too), or a work item: what happens to it wakes you;
|
|
69
|
-
--stop true stops following the item
|
|
69
|
+
--stop true stops following the item; --quiet: answers to
|
|
70
|
+
what you wait on, or decisions you decide, wake you only
|
|
71
|
+
with something else (none wakes you on them again)
|
|
70
72
|
gavel wait <D-12> [--timeout <seconds>] until it's decided (default 60)
|
|
71
73
|
gavel withdraw <D-12> [--reason <words>] take back what you asked, while it isn't decided
|
|
72
74
|
gavel attach <D-12> --file context.json the sidebar's sections ({items, pictures, involved,
|
|
@@ -296,7 +298,7 @@ const FLAGS = {
|
|
|
296
298
|
revise: ["file"],
|
|
297
299
|
todo: ["file"],
|
|
298
300
|
get: [],
|
|
299
|
-
subscribe: ["item", "stop"],
|
|
301
|
+
subscribe: ["item", "stop", "quiet"],
|
|
300
302
|
wait: ["timeout"],
|
|
301
303
|
withdraw: ["reason"],
|
|
302
304
|
attach: ["file"],
|
|
@@ -1082,6 +1084,14 @@ export function toRequest(argv) {
|
|
|
1082
1084
|
return { method: "GET", path: `/v1/decisions/${ref(p[0])}` };
|
|
1083
1085
|
case "subscribe": {
|
|
1084
1086
|
upTo(1);
|
|
1087
|
+
if (f.quiet !== undefined) {
|
|
1088
|
+
if (p.length || f.item !== undefined || f.stop !== undefined)
|
|
1089
|
+
throw new UsageError("--quiet goes alone: gavel subscribe --quiet answer,decision (or none)");
|
|
1090
|
+
const kinds = f.quiet === "none" ? [] : f.quiet.split(",").map((k) => k.trim());
|
|
1091
|
+
if (f.quiet !== "none" && (!kinds.length || kinds.some((k) => k !== "answer" && k !== "decision")))
|
|
1092
|
+
throw new UsageError("--quiet is answer, decision, answer,decision or none");
|
|
1093
|
+
return { method: "PUT", path: "/v1/inbox/quiet", body: { kinds } };
|
|
1094
|
+
}
|
|
1085
1095
|
if (f.stop !== undefined && f.stop !== "true" && f.stop !== "false")
|
|
1086
1096
|
throw new UsageError("--stop is true or false");
|
|
1087
1097
|
if (f.item === undefined) {
|
package/package.json
CHANGED