sessionpipe 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/cli.js +20 -19
- package/dist/cli.js.map +3 -3
- package/dist/hook.js +5 -2
- package/dist/hook.js.map +2 -2
- package/dist/index.js +16 -15
- package/dist/index.js.map +2 -2
- package/dist/launcher.d.ts +2 -1
- package/dist/launcher.d.ts.map +1 -1
- package/dist/worker.js +16 -15
- package/dist/worker.js.map +2 -2
- package/package.json +1 -1
package/dist/launcher.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export declare function dataDir(env?: NodeJS.ProcessEnv): string;
|
|
|
3
3
|
export declare const launcherPath: (env?: NodeJS.ProcessEnv) => string;
|
|
4
4
|
export declare const usesLauncher: (platform?: NodeJS.Platform) => boolean;
|
|
5
5
|
/** The launcher, in sh. No node at all prints what Antigravity needs and exits 0: the
|
|
6
|
-
* hook must stay invisible to the harness whatever is missing
|
|
6
|
+
* hook must stay invisible to the harness whatever is missing (and a PreToolUse entry
|
|
7
|
+
* an older install left must not turn into a silent deny). */
|
|
7
8
|
export declare function launcherScript(node: string, hook: string, version: string): string;
|
|
8
9
|
/** Copy the hook and worker out of the npm install and (re)write the launcher. The
|
|
9
10
|
* worker goes first, so a hook that starts mid-copy never spawns a missing one. */
|
package/dist/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,QAAQ,qBAAqB,CAAC;AAG3C,wBAAgB,OAAO,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAGpE;AACD,eAAO,MAAM,YAAY,GAAI,MAAK,MAAM,CAAC,UAAwB,KAAG,MAA2C,CAAC;AAChH,eAAO,MAAM,YAAY,GAAI,WAAU,MAAM,CAAC,QAA2B,KAAG,OAA+B,CAAC;AAI5G;;+DAE+D;AAC/D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CASlF;AAkBD;oFACoF;AACpF,wBAAgB,eAAe,CAAC,CAAC,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CAAE,GAAG;IAC/G,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB,CASA;AAED,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,IAAI,CAEzE;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,iEAAiE;IACjE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,6CAA6C;AAC7C,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,aAAa,CAwClG"}
|
package/dist/worker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// sessionpipe 0.6.
|
|
2
|
+
// sessionpipe 0.6.1 · Apache-2.0 · https://sessionpipe.org
|
|
3
3
|
|
|
4
4
|
// src/worker.ts
|
|
5
5
|
import { readFileSync as readFileSync9, unlinkSync as unlinkSync5 } from "node:fs";
|
|
@@ -372,20 +372,19 @@ function installedClaudeShaped(file, harness, events, cmd, o) {
|
|
|
372
372
|
// ../core/src/adapters/antigravity.ts
|
|
373
373
|
var NAME = "antigravity";
|
|
374
374
|
var HOOK_NAME = "sessionpipe";
|
|
375
|
-
var AG_EVENTS = ["PreInvocation", "PostInvocation", "
|
|
375
|
+
var AG_EVENTS = ["PreInvocation", "PostInvocation", "PostToolUse", "Stop"];
|
|
376
|
+
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';
|
|
377
|
+
var antigravityAnswer = (event) => event === "PreToolUse" ? AG_STALE_PRETOOL : "{}\n";
|
|
376
378
|
var gemini = (env) => env.GEMINI_CLI_HOME || path4.join(HOME, ".gemini");
|
|
377
379
|
var hooksFile = (env) => path4.join(gemini(env), "config", "hooks.json");
|
|
378
380
|
var projectsDir = (env) => path4.join(gemini(env), "config", "projects");
|
|
379
381
|
var dataDirs = (env) => ["antigravity", "antigravity-cli", "antigravity-ide"].map((d) => path4.join(gemini(env), d));
|
|
380
382
|
var ID_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
381
383
|
var validTool = (n) => typeof n === "string" && /^[A-Za-z0-9_.:-]{1,120}$/.test(n);
|
|
382
|
-
function entry(cmd
|
|
384
|
+
function entry(cmd) {
|
|
383
385
|
const handler = (e) => ({ type: "command", command: cmd([NAME, e]).command, timeout: 5 });
|
|
384
386
|
const out = { enabled: true };
|
|
385
|
-
for (const e of AG_EVENTS) {
|
|
386
|
-
if (lean && e === "PreToolUse") continue;
|
|
387
|
-
out[e] = /Tool/.test(e) ? [{ matcher: "*", hooks: [handler(e)] }] : [handler(e)];
|
|
388
|
-
}
|
|
387
|
+
for (const e of AG_EVENTS) out[e] = /Tool/.test(e) ? [{ matcher: "*", hooks: [handler(e)] }] : [handler(e)];
|
|
389
388
|
return out;
|
|
390
389
|
}
|
|
391
390
|
var antigravity = {
|
|
@@ -393,12 +392,12 @@ var antigravity = {
|
|
|
393
392
|
events: AG_EVENTS,
|
|
394
393
|
detect: (env = process.env) => existsSync2(path4.join(gemini(env), "config")) || dataDirs(env).some((d) => existsSync2(d)),
|
|
395
394
|
configFiles: (env = process.env) => [hooksFile(env)],
|
|
396
|
-
install(cmd, env = process.env
|
|
395
|
+
install(cmd, env = process.env) {
|
|
397
396
|
const file = hooksFile(env);
|
|
398
397
|
const f = readJsonFile(file);
|
|
399
398
|
if (!f.ok) return [{ file, changed: false, skipped: true, note: `${f.reason}; not touched` }];
|
|
400
399
|
const hooks = f.value;
|
|
401
|
-
const e = entry(cmd
|
|
400
|
+
const e = entry(cmd);
|
|
402
401
|
if (JSON.stringify(hooks[HOOK_NAME]) === JSON.stringify(e)) return [{ file, changed: false }];
|
|
403
402
|
hooks[HOOK_NAME] = e;
|
|
404
403
|
mkdirSync2(path4.dirname(file), { recursive: true });
|
|
@@ -427,14 +426,14 @@ var antigravity = {
|
|
|
427
426
|
writeFileSync2(file, formatJson(hooks, f));
|
|
428
427
|
return [{ file, changed: true }];
|
|
429
428
|
},
|
|
430
|
-
installed(cmd, env = process.env
|
|
429
|
+
installed(cmd, env = process.env) {
|
|
431
430
|
const file = hooksFile(env);
|
|
432
431
|
const f = readJsonFile(file);
|
|
433
432
|
const have = f.ok ? f.value[HOOK_NAME] : void 0;
|
|
434
433
|
return [
|
|
435
434
|
{
|
|
436
435
|
file,
|
|
437
|
-
state: !have ? "missing" : JSON.stringify(have) === JSON.stringify(entry(cmd
|
|
436
|
+
state: !have ? "missing" : JSON.stringify(have) === JSON.stringify(entry(cmd)) ? "current" : "stale"
|
|
438
437
|
}
|
|
439
438
|
];
|
|
440
439
|
},
|
|
@@ -446,7 +445,8 @@ var antigravity = {
|
|
|
446
445
|
} catch {
|
|
447
446
|
}
|
|
448
447
|
const id = s.conversationId ?? s.session_id ?? s.sessionId;
|
|
449
|
-
|
|
448
|
+
const stdout = antigravityAnswer(event);
|
|
449
|
+
if (!id) return { session: { id: "" }, events: [], stdout };
|
|
450
450
|
const workspaces = agWorkspaces(s.workspacePaths);
|
|
451
451
|
const session = { id: String(id), cwd: workspaces[0] ?? input.cwd };
|
|
452
452
|
if (typeof s.modelName === "string" && s.modelName !== "auto") session.model = s.modelName;
|
|
@@ -467,7 +467,8 @@ var antigravity = {
|
|
|
467
467
|
if (tool) events.push(ev("tool.started", { tool, input: toolCall?.args }));
|
|
468
468
|
break;
|
|
469
469
|
case "PostToolUse":
|
|
470
|
-
if (tool)
|
|
470
|
+
if (!tool) events.push(ev("session.heartbeat", {}));
|
|
471
|
+
else
|
|
471
472
|
events.push(
|
|
472
473
|
ev("tool.ended", {
|
|
473
474
|
tool,
|
|
@@ -481,9 +482,9 @@ var antigravity = {
|
|
|
481
482
|
events.push(ev("turn.ended", { reason: s.error ? "error" : "stop" }));
|
|
482
483
|
break;
|
|
483
484
|
default:
|
|
484
|
-
return { session, events: [], stdout
|
|
485
|
+
return { session, events: [], stdout };
|
|
485
486
|
}
|
|
486
|
-
const r = { session, events, stdout
|
|
487
|
+
const r = { session, events, stdout, hints: { workspaces } };
|
|
487
488
|
if (typeof s.transcriptPath === "string") r.transcript = s.transcriptPath;
|
|
488
489
|
return r;
|
|
489
490
|
},
|