@getgavel/cli 0.1.16 → 0.1.17
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 +9 -0
- package/dist/bridge/background.js +32 -1
- package/dist/bridge/bridge.js +322 -249
- package/dist/bridge/claude-code.js +0 -96
- package/dist/bridge/claude-live.js +107 -33
- package/dist/bridge/codex-app.js +135 -0
- package/dist/bridge/codex.js +440 -77
- package/dist/bridge/harness.js +1 -0
- package/dist/bridge/setup.js +27 -18
- package/dist/bridge/websocket.js +166 -0
- package/dist/gavel.js +79 -21
- package/dist/hook.js +67 -7
- package/hooks/hooks.json +30 -0
- package/package.json +5 -2
- package/skills/gavel/SKILL.md +30 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gavel",
|
|
3
|
+
"displayName": "Gavel",
|
|
4
|
+
"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
|
+
"author": { "name": "Gavel", "url": "https://getgavel.ai" },
|
|
6
|
+
"homepage": "https://getgavel.ai/agents",
|
|
7
|
+
"repository": "https://github.com/ntommarello/gavel",
|
|
8
|
+
"keywords": ["gavel", "decisions", "chat"]
|
|
9
|
+
}
|
|
@@ -326,6 +326,33 @@ function send(socket, line) {
|
|
|
326
326
|
// The events that start a bridge when none runs here: a session starting, or a prompt in one whose
|
|
327
327
|
// bridge has gone.
|
|
328
328
|
const STARTS = new Set(["SessionStart", "UserPromptSubmit"]);
|
|
329
|
+
// The chat off in Gavel stops the bridge (D-1140): it leaves this mark as it goes, and while the
|
|
330
|
+
// chat stays off a prompt starts it again (to look) at most once a minute; a session's start always
|
|
331
|
+
// looks.
|
|
332
|
+
const OFF_RECHECK_MS = 60_000;
|
|
333
|
+
const offMark = (home, cwd, harness) => join(bridgeDir(home), `${bridgeKey(cwd, harness)}.off`);
|
|
334
|
+
export function markChatOff(opts, off) {
|
|
335
|
+
const file = offMark(opts.home, opts.cwd, opts.harness);
|
|
336
|
+
try {
|
|
337
|
+
if (off) {
|
|
338
|
+
privateDir(bridgeDir(opts.home));
|
|
339
|
+
writeFileSync(file, `${new Date().toISOString()}\n`, { mode: 0o600 });
|
|
340
|
+
}
|
|
341
|
+
else
|
|
342
|
+
unlinkSync(file);
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
345
|
+
// nothing to mark or clear
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function offRecently(home, cwd, harness) {
|
|
349
|
+
try {
|
|
350
|
+
return Date.now() - statSync(offMark(home, cwd, harness)).mtimeMs < OFF_RECHECK_MS;
|
|
351
|
+
}
|
|
352
|
+
catch {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
329
356
|
// `gavel bridge event <name>`, run by a hook: the hook's input to the folder's running bridge, with
|
|
330
357
|
// the session's inbox from the hook's environment; a bridge started first when a session starts.
|
|
331
358
|
// Prints nothing (a hook's stdout can reach the model) and always exits 0, so a hook never fails a
|
|
@@ -351,7 +378,11 @@ export async function hookEvent(opts) {
|
|
|
351
378
|
at: Date.now(),
|
|
352
379
|
};
|
|
353
380
|
let live = runningBridge(opts.home, cwd, opts.harness);
|
|
354
|
-
|
|
381
|
+
// Hooks a plugin or the user's settings give every folder start a bridge only where this
|
|
382
|
+
// harness has a Gavel agent set up.
|
|
383
|
+
const setUp = (opts.harness === "codex" ? codexSetups(cwd, opts.home, opts.env) : claudeSetups(cwd, opts.home)).some((s) => s.where.endsWith("this folder"));
|
|
384
|
+
const looksAgain = opts.name === "SessionStart" || !offRecently(opts.home, cwd, opts.harness);
|
|
385
|
+
if (!live && setUp && STARTS.has(opts.name) && looksAgain) {
|
|
355
386
|
const started = await startBridge({ home: opts.home, cwd, harness: opts.harness, server: opts.server, untilClosed: true, env: opts.env });
|
|
356
387
|
if (started.bridge !== "failed")
|
|
357
388
|
live = runningBridge(opts.home, cwd, opts.harness);
|