sessionpipe-core 0.6.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/control.js CHANGED
@@ -1,4 +1,4 @@
1
- // sessionpipe-core 0.6.0 · Apache-2.0 · https://sessionpipe.org
1
+ // sessionpipe-core 0.6.1 · Apache-2.0 · https://sessionpipe.org
2
2
 
3
3
  // src/control/verify.ts
4
4
  var GRANT_MAX_MS = 24 * 36e5;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // sessionpipe-core 0.6.0 · Apache-2.0 · https://sessionpipe.org
1
+ // sessionpipe-core 0.6.1 · Apache-2.0 · https://sessionpipe.org
2
2
  var __defProp = Object.defineProperty;
3
3
  var __export = (target, all) => {
4
4
  for (var name in all)
@@ -373,20 +373,19 @@ function installedClaudeShaped(file, harness, events, cmd, o) {
373
373
  // src/adapters/antigravity.ts
374
374
  var NAME = "antigravity";
375
375
  var HOOK_NAME = "sessionpipe";
376
- var AG_EVENTS = ["PreInvocation", "PostInvocation", "PreToolUse", "PostToolUse", "Stop"];
376
+ var AG_EVENTS = ["PreInvocation", "PostInvocation", "PostToolUse", "Stop"];
377
+ 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';
378
+ var antigravityAnswer = (event) => event === "PreToolUse" ? AG_STALE_PRETOOL : "{}\n";
377
379
  var gemini = (env) => env.GEMINI_CLI_HOME || path4.join(HOME, ".gemini");
378
380
  var hooksFile = (env) => path4.join(gemini(env), "config", "hooks.json");
379
381
  var projectsDir = (env) => path4.join(gemini(env), "config", "projects");
380
382
  var dataDirs = (env) => ["antigravity", "antigravity-cli", "antigravity-ide"].map((d) => path4.join(gemini(env), d));
381
383
  var ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
382
384
  var validTool = (n) => typeof n === "string" && /^[A-Za-z0-9_.:-]{1,120}$/.test(n);
383
- function entry(cmd, lean) {
385
+ function entry(cmd) {
384
386
  const handler = (e) => ({ type: "command", command: cmd([NAME, e]).command, timeout: 5 });
385
387
  const out = { enabled: true };
386
- for (const e of AG_EVENTS) {
387
- if (lean && e === "PreToolUse") continue;
388
- out[e] = /Tool/.test(e) ? [{ matcher: "*", hooks: [handler(e)] }] : [handler(e)];
389
- }
388
+ for (const e of AG_EVENTS) out[e] = /Tool/.test(e) ? [{ matcher: "*", hooks: [handler(e)] }] : [handler(e)];
390
389
  return out;
391
390
  }
392
391
  var antigravity = {
@@ -394,12 +393,12 @@ var antigravity = {
394
393
  events: AG_EVENTS,
395
394
  detect: (env = process.env) => existsSync2(path4.join(gemini(env), "config")) || dataDirs(env).some((d) => existsSync2(d)),
396
395
  configFiles: (env = process.env) => [hooksFile(env)],
397
- install(cmd, env = process.env, opts = {}) {
396
+ install(cmd, env = process.env) {
398
397
  const file = hooksFile(env);
399
398
  const f = readJsonFile(file);
400
399
  if (!f.ok) return [{ file, changed: false, skipped: true, note: `${f.reason}; not touched` }];
401
400
  const hooks = f.value;
402
- const e = entry(cmd, opts.lean);
401
+ const e = entry(cmd);
403
402
  if (JSON.stringify(hooks[HOOK_NAME]) === JSON.stringify(e)) return [{ file, changed: false }];
404
403
  hooks[HOOK_NAME] = e;
405
404
  mkdirSync2(path4.dirname(file), { recursive: true });
@@ -428,14 +427,14 @@ var antigravity = {
428
427
  writeFileSync2(file, formatJson(hooks, f));
429
428
  return [{ file, changed: true }];
430
429
  },
431
- installed(cmd, env = process.env, opts = {}) {
430
+ installed(cmd, env = process.env) {
432
431
  const file = hooksFile(env);
433
432
  const f = readJsonFile(file);
434
433
  const have = f.ok ? f.value[HOOK_NAME] : void 0;
435
434
  return [
436
435
  {
437
436
  file,
438
- state: !have ? "missing" : JSON.stringify(have) === JSON.stringify(entry(cmd, opts.lean)) ? "current" : "stale"
437
+ state: !have ? "missing" : JSON.stringify(have) === JSON.stringify(entry(cmd)) ? "current" : "stale"
439
438
  }
440
439
  ];
441
440
  },
@@ -447,7 +446,8 @@ var antigravity = {
447
446
  } catch {
448
447
  }
449
448
  const id = s.conversationId ?? s.session_id ?? s.sessionId;
450
- if (!id) return { session: { id: "" }, events: [], stdout: "{}\n" };
449
+ const stdout = antigravityAnswer(event);
450
+ if (!id) return { session: { id: "" }, events: [], stdout };
451
451
  const workspaces = agWorkspaces(s.workspacePaths);
452
452
  const session = { id: String(id), cwd: workspaces[0] ?? input.cwd };
453
453
  if (typeof s.modelName === "string" && s.modelName !== "auto") session.model = s.modelName;
@@ -468,7 +468,8 @@ var antigravity = {
468
468
  if (tool) events.push(ev("tool.started", { tool, input: toolCall?.args }));
469
469
  break;
470
470
  case "PostToolUse":
471
- if (tool)
471
+ if (!tool) events.push(ev("session.heartbeat", {}));
472
+ else
472
473
  events.push(
473
474
  ev("tool.ended", {
474
475
  tool,
@@ -482,9 +483,9 @@ var antigravity = {
482
483
  events.push(ev("turn.ended", { reason: s.error ? "error" : "stop" }));
483
484
  break;
484
485
  default:
485
- return { session, events: [], stdout: "{}\n" };
486
+ return { session, events: [], stdout };
486
487
  }
487
- const r = { session, events, stdout: "{}\n", hints: { workspaces } };
488
+ const r = { session, events, stdout, hints: { workspaces } };
488
489
  if (typeof s.transcriptPath === "string") r.transcript = s.transcriptPath;
489
490
  return r;
490
491
  },
@@ -2910,6 +2911,7 @@ var StdoutSink = class {
2910
2911
  var PROTOCOL_VERSION = 1;
2911
2912
  export {
2912
2913
  ADAPTERS,
2914
+ AG_STALE_PRETOOL,
2913
2915
  Cursors,
2914
2916
  DEFAULT_CONFIG,
2915
2917
  FileSink,
@@ -2923,6 +2925,7 @@ export {
2923
2925
  TYPE_TIER,
2924
2926
  adapterByName,
2925
2927
  antigravity,
2928
+ antigravityAnswer,
2926
2929
  claudeCode,
2927
2930
  claude_code_control_exports as claudeControl,
2928
2931
  claudeDirs,