sessionpipe-conformance 0.5.0 → 0.6.1

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/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // sessionpipe-conformance 0.5.0 · Apache-2.0 · https://sessionpipe.org
2
+ // sessionpipe-conformance 0.6.1 · Apache-2.0 · https://sessionpipe.org
3
3
 
4
4
  // src/cli.ts
5
5
  import { readdirSync as readdirSync5, statSync as statSync4 } from "node:fs";
@@ -357,20 +357,19 @@ function installedClaudeShaped(file, harness, events, cmd, o) {
357
357
  // ../core/src/adapters/antigravity.ts
358
358
  var NAME = "antigravity";
359
359
  var HOOK_NAME = "sessionpipe";
360
- var AG_EVENTS = ["PreInvocation", "PostInvocation", "PreToolUse", "PostToolUse", "Stop"];
360
+ var AG_EVENTS = ["PreInvocation", "PostInvocation", "PostToolUse", "Stop"];
361
+ var AG_STALE_PRETOOL = '{"decision":"ask","reason":"sessionpipe: an outdated PreToolUse hook is still loaded. Restart this conversation (or run sessionpipe install) to drop it."}\n';
362
+ var antigravityAnswer = (event) => event === "PreToolUse" ? AG_STALE_PRETOOL : "{}\n";
361
363
  var gemini = (env) => env.GEMINI_CLI_HOME || path3.join(HOME, ".gemini");
362
364
  var hooksFile = (env) => path3.join(gemini(env), "config", "hooks.json");
363
365
  var projectsDir = (env) => path3.join(gemini(env), "config", "projects");
364
366
  var dataDirs = (env) => ["antigravity", "antigravity-cli", "antigravity-ide"].map((d) => path3.join(gemini(env), d));
365
367
  var ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
366
368
  var validTool = (n) => typeof n === "string" && /^[A-Za-z0-9_.:-]{1,120}$/.test(n);
367
- function entry(cmd, lean) {
369
+ function entry(cmd) {
368
370
  const handler = (e) => ({ type: "command", command: cmd([NAME, e]).command, timeout: 5 });
369
371
  const out = { enabled: true };
370
- for (const e of AG_EVENTS) {
371
- if (lean && e === "PreToolUse") continue;
372
- out[e] = /Tool/.test(e) ? [{ matcher: "*", hooks: [handler(e)] }] : [handler(e)];
373
- }
372
+ for (const e of AG_EVENTS) out[e] = /Tool/.test(e) ? [{ matcher: "*", hooks: [handler(e)] }] : [handler(e)];
374
373
  return out;
375
374
  }
376
375
  var antigravity = {
@@ -378,12 +377,12 @@ var antigravity = {
378
377
  events: AG_EVENTS,
379
378
  detect: (env = process.env) => existsSync2(path3.join(gemini(env), "config")) || dataDirs(env).some((d) => existsSync2(d)),
380
379
  configFiles: (env = process.env) => [hooksFile(env)],
381
- install(cmd, env = process.env, opts = {}) {
380
+ install(cmd, env = process.env) {
382
381
  const file = hooksFile(env);
383
382
  const f = readJsonFile(file);
384
383
  if (!f.ok) return [{ file, changed: false, skipped: true, note: `${f.reason}; not touched` }];
385
384
  const hooks = f.value;
386
- const e = entry(cmd, opts.lean);
385
+ const e = entry(cmd);
387
386
  if (JSON.stringify(hooks[HOOK_NAME]) === JSON.stringify(e)) return [{ file, changed: false }];
388
387
  hooks[HOOK_NAME] = e;
389
388
  mkdirSync2(path3.dirname(file), { recursive: true });
@@ -412,14 +411,14 @@ var antigravity = {
412
411
  writeFileSync2(file, formatJson(hooks, f));
413
412
  return [{ file, changed: true }];
414
413
  },
415
- installed(cmd, env = process.env, opts = {}) {
414
+ installed(cmd, env = process.env) {
416
415
  const file = hooksFile(env);
417
416
  const f = readJsonFile(file);
418
417
  const have = f.ok ? f.value[HOOK_NAME] : void 0;
419
418
  return [
420
419
  {
421
420
  file,
422
- state: !have ? "missing" : JSON.stringify(have) === JSON.stringify(entry(cmd, opts.lean)) ? "current" : "stale"
421
+ state: !have ? "missing" : JSON.stringify(have) === JSON.stringify(entry(cmd)) ? "current" : "stale"
423
422
  }
424
423
  ];
425
424
  },
@@ -431,7 +430,8 @@ var antigravity = {
431
430
  } catch {
432
431
  }
433
432
  const id = s.conversationId ?? s.session_id ?? s.sessionId;
434
- if (!id) return { session: { id: "" }, events: [], stdout: "{}\n" };
433
+ const stdout = antigravityAnswer(event);
434
+ if (!id) return { session: { id: "" }, events: [], stdout };
435
435
  const workspaces = agWorkspaces(s.workspacePaths);
436
436
  const session = { id: String(id), cwd: workspaces[0] ?? input.cwd };
437
437
  if (typeof s.modelName === "string" && s.modelName !== "auto") session.model = s.modelName;
@@ -452,7 +452,8 @@ var antigravity = {
452
452
  if (tool) events.push(ev("tool.started", { tool, input: toolCall?.args }));
453
453
  break;
454
454
  case "PostToolUse":
455
- if (tool)
455
+ if (!tool) events.push(ev("session.heartbeat", {}));
456
+ else
456
457
  events.push(
457
458
  ev("tool.ended", {
458
459
  tool,
@@ -466,9 +467,9 @@ var antigravity = {
466
467
  events.push(ev("turn.ended", { reason: s.error ? "error" : "stop" }));
467
468
  break;
468
469
  default:
469
- return { session, events: [], stdout: "{}\n" };
470
+ return { session, events: [], stdout };
470
471
  }
471
- const r2 = { session, events, stdout: "{}\n", hints: { workspaces } };
472
+ const r2 = { session, events, stdout, hints: { workspaces } };
472
473
  if (typeof s.transcriptPath === "string") r2.transcript = s.transcriptPath;
473
474
  return r2;
474
475
  },