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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // sessionpipe-conformance 0.5.0 · Apache-2.0 · https://sessionpipe.org
1
+ // sessionpipe-conformance 0.6.1 · Apache-2.0 · https://sessionpipe.org
2
2
 
3
3
  // src/index.ts
4
4
  import { readFileSync as readFileSync6 } from "node:fs";
@@ -352,20 +352,19 @@ function installedClaudeShaped(file, harness, events, cmd, o) {
352
352
  // ../core/src/adapters/antigravity.ts
353
353
  var NAME = "antigravity";
354
354
  var HOOK_NAME = "sessionpipe";
355
- var AG_EVENTS = ["PreInvocation", "PostInvocation", "PreToolUse", "PostToolUse", "Stop"];
355
+ var AG_EVENTS = ["PreInvocation", "PostInvocation", "PostToolUse", "Stop"];
356
+ 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';
357
+ var antigravityAnswer = (event) => event === "PreToolUse" ? AG_STALE_PRETOOL : "{}\n";
356
358
  var gemini = (env) => env.GEMINI_CLI_HOME || path3.join(HOME, ".gemini");
357
359
  var hooksFile = (env) => path3.join(gemini(env), "config", "hooks.json");
358
360
  var projectsDir = (env) => path3.join(gemini(env), "config", "projects");
359
361
  var dataDirs = (env) => ["antigravity", "antigravity-cli", "antigravity-ide"].map((d) => path3.join(gemini(env), d));
360
362
  var ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
361
363
  var validTool = (n) => typeof n === "string" && /^[A-Za-z0-9_.:-]{1,120}$/.test(n);
362
- function entry(cmd, lean) {
364
+ function entry(cmd) {
363
365
  const handler = (e) => ({ type: "command", command: cmd([NAME, e]).command, timeout: 5 });
364
366
  const out = { enabled: true };
365
- for (const e of AG_EVENTS) {
366
- if (lean && e === "PreToolUse") continue;
367
- out[e] = /Tool/.test(e) ? [{ matcher: "*", hooks: [handler(e)] }] : [handler(e)];
368
- }
367
+ for (const e of AG_EVENTS) out[e] = /Tool/.test(e) ? [{ matcher: "*", hooks: [handler(e)] }] : [handler(e)];
369
368
  return out;
370
369
  }
371
370
  var antigravity = {
@@ -373,12 +372,12 @@ var antigravity = {
373
372
  events: AG_EVENTS,
374
373
  detect: (env = process.env) => existsSync2(path3.join(gemini(env), "config")) || dataDirs(env).some((d) => existsSync2(d)),
375
374
  configFiles: (env = process.env) => [hooksFile(env)],
376
- install(cmd, env = process.env, opts = {}) {
375
+ install(cmd, env = process.env) {
377
376
  const file = hooksFile(env);
378
377
  const f = readJsonFile(file);
379
378
  if (!f.ok) return [{ file, changed: false, skipped: true, note: `${f.reason}; not touched` }];
380
379
  const hooks = f.value;
381
- const e = entry(cmd, opts.lean);
380
+ const e = entry(cmd);
382
381
  if (JSON.stringify(hooks[HOOK_NAME]) === JSON.stringify(e)) return [{ file, changed: false }];
383
382
  hooks[HOOK_NAME] = e;
384
383
  mkdirSync2(path3.dirname(file), { recursive: true });
@@ -407,14 +406,14 @@ var antigravity = {
407
406
  writeFileSync2(file, formatJson(hooks, f));
408
407
  return [{ file, changed: true }];
409
408
  },
410
- installed(cmd, env = process.env, opts = {}) {
409
+ installed(cmd, env = process.env) {
411
410
  const file = hooksFile(env);
412
411
  const f = readJsonFile(file);
413
412
  const have = f.ok ? f.value[HOOK_NAME] : void 0;
414
413
  return [
415
414
  {
416
415
  file,
417
- state: !have ? "missing" : JSON.stringify(have) === JSON.stringify(entry(cmd, opts.lean)) ? "current" : "stale"
416
+ state: !have ? "missing" : JSON.stringify(have) === JSON.stringify(entry(cmd)) ? "current" : "stale"
418
417
  }
419
418
  ];
420
419
  },
@@ -426,7 +425,8 @@ var antigravity = {
426
425
  } catch {
427
426
  }
428
427
  const id = s.conversationId ?? s.session_id ?? s.sessionId;
429
- if (!id) return { session: { id: "" }, events: [], stdout: "{}\n" };
428
+ const stdout = antigravityAnswer(event);
429
+ if (!id) return { session: { id: "" }, events: [], stdout };
430
430
  const workspaces = agWorkspaces(s.workspacePaths);
431
431
  const session = { id: String(id), cwd: workspaces[0] ?? input.cwd };
432
432
  if (typeof s.modelName === "string" && s.modelName !== "auto") session.model = s.modelName;
@@ -447,7 +447,8 @@ var antigravity = {
447
447
  if (tool) events.push(ev("tool.started", { tool, input: toolCall?.args }));
448
448
  break;
449
449
  case "PostToolUse":
450
- if (tool)
450
+ if (!tool) events.push(ev("session.heartbeat", {}));
451
+ else
451
452
  events.push(
452
453
  ev("tool.ended", {
453
454
  tool,
@@ -461,9 +462,9 @@ var antigravity = {
461
462
  events.push(ev("turn.ended", { reason: s.error ? "error" : "stop" }));
462
463
  break;
463
464
  default:
464
- return { session, events: [], stdout: "{}\n" };
465
+ return { session, events: [], stdout };
465
466
  }
466
- const r = { session, events, stdout: "{}\n", hints: { workspaces } };
467
+ const r = { session, events, stdout, hints: { workspaces } };
467
468
  if (typeof s.transcriptPath === "string") r.transcript = s.transcriptPath;
468
469
  return r;
469
470
  },