@respan/cli 0.6.5 → 0.6.7
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/hooks/claude-code.cjs +1 -0
- package/dist/hooks/claude-code.js +2 -0
- package/dist/hooks/gemini-cli.cjs +29 -3
- package/dist/hooks/gemini-cli.js +33 -4
- package/oclif.manifest.json +851 -851
- package/package.json +1 -1
|
@@ -812,10 +812,8 @@ function processChunk(hookData) {
|
|
|
812
812
|
debug(`Delayed send (version=${state.send_version}, delay=${SEND_DELAY}s), ${state.accumulated_text.length} chars`);
|
|
813
813
|
launchDelayedSend(sessionId, state.send_version, spans, creds.apiKey, creds.baseUrl);
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function mainWorker(raw) {
|
|
816
816
|
try {
|
|
817
|
-
const raw = fs2.readFileSync(0, "utf-8");
|
|
818
|
-
process.stdout.write("{}\n");
|
|
819
817
|
if (!raw.trim()) return;
|
|
820
818
|
const hookData = JSON.parse(raw);
|
|
821
819
|
const event = String(hookData.hook_event_name ?? "");
|
|
@@ -839,4 +837,32 @@ function main() {
|
|
|
839
837
|
}
|
|
840
838
|
}
|
|
841
839
|
}
|
|
840
|
+
function main() {
|
|
841
|
+
if (process.env._RESPAN_GEM_WORKER === "1") {
|
|
842
|
+
const raw2 = process.env._RESPAN_GEM_DATA ?? "";
|
|
843
|
+
mainWorker(raw2);
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
let raw = "";
|
|
847
|
+
try {
|
|
848
|
+
raw = fs2.readFileSync(0, "utf-8");
|
|
849
|
+
} catch {
|
|
850
|
+
}
|
|
851
|
+
process.stdout.write("{}\n");
|
|
852
|
+
if (!raw.trim()) {
|
|
853
|
+
process.exit(0);
|
|
854
|
+
}
|
|
855
|
+
try {
|
|
856
|
+
const scriptPath = __filename || process.argv[1];
|
|
857
|
+
const child = (0, import_node_child_process.execFile)("node", [scriptPath], {
|
|
858
|
+
env: { ...process.env, _RESPAN_GEM_WORKER: "1", _RESPAN_GEM_DATA: raw },
|
|
859
|
+
stdio: "ignore",
|
|
860
|
+
detached: true
|
|
861
|
+
});
|
|
862
|
+
child.unref();
|
|
863
|
+
} catch (e) {
|
|
864
|
+
mainWorker(raw);
|
|
865
|
+
}
|
|
866
|
+
process.exit(0);
|
|
867
|
+
}
|
|
842
868
|
main();
|
package/dist/hooks/gemini-cli.js
CHANGED
|
@@ -549,11 +549,8 @@ function processChunk(hookData) {
|
|
|
549
549
|
launchDelayedSend(sessionId, state.send_version, spans, creds.apiKey, creds.baseUrl);
|
|
550
550
|
}
|
|
551
551
|
// ── Main ──────────────────────────────────────────────────────────
|
|
552
|
-
function
|
|
552
|
+
function mainWorker(raw) {
|
|
553
553
|
try {
|
|
554
|
-
const raw = fs.readFileSync(0, 'utf-8');
|
|
555
|
-
// Respond to Gemini CLI immediately so it doesn't block
|
|
556
|
-
process.stdout.write('{}\n');
|
|
557
554
|
if (!raw.trim())
|
|
558
555
|
return;
|
|
559
556
|
const hookData = JSON.parse(raw);
|
|
@@ -583,4 +580,36 @@ function main() {
|
|
|
583
580
|
}
|
|
584
581
|
}
|
|
585
582
|
}
|
|
583
|
+
function main() {
|
|
584
|
+
// Worker mode: re-invoked as detached subprocess
|
|
585
|
+
if (process.env._RESPAN_GEM_WORKER === '1') {
|
|
586
|
+
const raw = process.env._RESPAN_GEM_DATA ?? '';
|
|
587
|
+
mainWorker(raw);
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
// Read stdin synchronously, respond immediately, fork worker, exit
|
|
591
|
+
let raw = '';
|
|
592
|
+
try {
|
|
593
|
+
raw = fs.readFileSync(0, 'utf-8');
|
|
594
|
+
}
|
|
595
|
+
catch { }
|
|
596
|
+
process.stdout.write('{}\n');
|
|
597
|
+
if (!raw.trim()) {
|
|
598
|
+
process.exit(0);
|
|
599
|
+
}
|
|
600
|
+
try {
|
|
601
|
+
const scriptPath = __filename || process.argv[1];
|
|
602
|
+
const child = execFile('node', [scriptPath], {
|
|
603
|
+
env: { ...process.env, _RESPAN_GEM_WORKER: '1', _RESPAN_GEM_DATA: raw },
|
|
604
|
+
stdio: 'ignore',
|
|
605
|
+
detached: true,
|
|
606
|
+
});
|
|
607
|
+
child.unref();
|
|
608
|
+
}
|
|
609
|
+
catch (e) {
|
|
610
|
+
// Fallback: run inline
|
|
611
|
+
mainWorker(raw);
|
|
612
|
+
}
|
|
613
|
+
process.exit(0);
|
|
614
|
+
}
|
|
586
615
|
main();
|