@remnic/plugin-claude-code 10.0.128 → 10.0.130
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.
|
@@ -969,8 +969,8 @@ test("runner source: path inputs are type-validated before use (#1518 validate p
|
|
|
969
969
|
assert.match(src, /const cwd = input\.cwd \|\| ""/, "cwd must be defaulted to empty string");
|
|
970
970
|
assert.match(
|
|
971
971
|
src,
|
|
972
|
-
/const transcriptPath = input\.transcript_path \|\| ""/,
|
|
973
|
-
"transcript_path must be defaulted to empty string",
|
|
972
|
+
/const transcriptPath = input\.transcript_path \|\| input\.transcriptPath \|\| ""/,
|
|
973
|
+
"transcript_path must be defaulted to empty string (camelCase fallback allowed, snake_case wins)",
|
|
974
974
|
);
|
|
975
975
|
});
|
|
976
976
|
|
|
@@ -48,6 +48,11 @@ function run(config) {
|
|
|
48
48
|
const LOG_FILES = config.logFiles;
|
|
49
49
|
const LOG_TAGS = config.logTags;
|
|
50
50
|
const DEFAULT_LOG_FILE = config.defaultLogFile;
|
|
51
|
+
// Host-configured project-directory env var (e.g. "AGY_PROJECT_DIR" for
|
|
52
|
+
// agy, "DEVIN_PROJECT_DIR" for Devin). The active host's variable wins so
|
|
53
|
+
// a stray cross-host variable cannot reroute another host's recall; the
|
|
54
|
+
// shared fallbacks below only apply when the host's own variable is unset.
|
|
55
|
+
const PROJECT_DIR_ENV = config.projectDirEnv || "";
|
|
51
56
|
|
|
52
57
|
const HOME = process.env.HOME || process.env.USERPROFILE || os.homedir();
|
|
53
58
|
|
|
@@ -206,6 +211,29 @@ function run(config) {
|
|
|
206
211
|
}
|
|
207
212
|
}
|
|
208
213
|
|
|
214
|
+
// Antigravity CLI documents camelCase payload fields (conversationId,
|
|
215
|
+
// transcriptPath, lastUserInput). Apply them only when the snake_case key
|
|
216
|
+
// is absent so existing host payloads are unchanged.
|
|
217
|
+
// JSON.parse only yields plain objects, arrays, and primitives, so
|
|
218
|
+
// Object.prototype.toString is the exact string test here.
|
|
219
|
+
function isHookString(v) {
|
|
220
|
+
return Object.prototype.toString.call(v) === "[object String]";
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function normalizeHookInput(input) {
|
|
224
|
+
if (input.session_id === undefined || input.session_id === "") {
|
|
225
|
+
if (isHookString(input.conversationId) && input.conversationId) {
|
|
226
|
+
input.session_id = input.conversationId;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (input.prompt === undefined || input.prompt === "") {
|
|
230
|
+
if (isHookString(input.lastUserInput) && input.lastUserInput) {
|
|
231
|
+
input.prompt = input.lastUserInput;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return input;
|
|
235
|
+
}
|
|
236
|
+
|
|
209
237
|
function parseInput(raw) {
|
|
210
238
|
try {
|
|
211
239
|
const d = JSON.parse(raw);
|
|
@@ -645,6 +673,14 @@ function run(config) {
|
|
|
645
673
|
}
|
|
646
674
|
|
|
647
675
|
function parseTranscript(transcriptPath) {
|
|
676
|
+
// Hosts with non-file transcripts (agy: SQLite conversation db) can
|
|
677
|
+
// supply config.parseTranscript(transcriptPath) to decode them. The
|
|
678
|
+
// override must return the same [{role, content}] shape in stable order
|
|
679
|
+
// so cursor counting works unchanged.
|
|
680
|
+
if (config.parseTranscript instanceof Function) {
|
|
681
|
+
const custom = config.parseTranscript(transcriptPath);
|
|
682
|
+
if (custom !== undefined) return custom;
|
|
683
|
+
}
|
|
648
684
|
if (config.transcriptFormat === "atif") return parseAtifTranscript(transcriptPath);
|
|
649
685
|
return parseJsonlTranscript(transcriptPath);
|
|
650
686
|
}
|
|
@@ -653,7 +689,9 @@ function run(config) {
|
|
|
653
689
|
// can supply config.resolveTranscriptPath(input) to derive it — e.g. from
|
|
654
690
|
// the session id and a well-known transcript directory.
|
|
655
691
|
function transcriptPathFor(input) {
|
|
656
|
-
|
|
692
|
+
// Antigravity CLI documents camelCase payload fields (transcriptPath);
|
|
693
|
+
// snake_case wins when both are present so existing hosts are unchanged.
|
|
694
|
+
const transcriptPath = input.transcript_path || input.transcriptPath || "";
|
|
657
695
|
if (isString(transcriptPath) && transcriptPath) {
|
|
658
696
|
return transcriptPath;
|
|
659
697
|
}
|
|
@@ -669,10 +707,20 @@ function run(config) {
|
|
|
669
707
|
}
|
|
670
708
|
|
|
671
709
|
// Hosts that omit cwd from the hook payload still export a project-dir
|
|
672
|
-
// env var (Devin: DEVIN_PROJECT_DIR; Claude Code compat: CLAUDE_PROJECT_DIR
|
|
710
|
+
// env var (Devin: DEVIN_PROJECT_DIR; Claude Code compat: CLAUDE_PROJECT_DIR;
|
|
711
|
+
// Antigravity: AGY_PROJECT_DIR).
|
|
712
|
+
// Hosts that omit cwd from the hook payload still export a project-dir
|
|
713
|
+
// env var. The active host's variable (config.projectDirEnv) wins; the
|
|
714
|
+
// shared fallbacks preserve the pre-existing hosts' behavior when the
|
|
715
|
+
// host's own variable is unset. AGY_PROJECT_DIR is intentionally absent
|
|
716
|
+
// from the shared fallback — agy reaches it through its own projectDirEnv,
|
|
717
|
+
// so a stray AGY variable can never reroute another host's recall.
|
|
673
718
|
function cwdFor(input) {
|
|
674
719
|
const cwd = input.cwd || "";
|
|
675
720
|
if (isString(cwd) && cwd) return cwd;
|
|
721
|
+
if (PROJECT_DIR_ENV && isString(process.env[PROJECT_DIR_ENV]) && process.env[PROJECT_DIR_ENV]) {
|
|
722
|
+
return process.env[PROJECT_DIR_ENV];
|
|
723
|
+
}
|
|
676
724
|
return process.env.DEVIN_PROJECT_DIR || process.env.CLAUDE_PROJECT_DIR || "";
|
|
677
725
|
}
|
|
678
726
|
|
|
@@ -1504,7 +1552,7 @@ function run(config) {
|
|
|
1504
1552
|
const log = makeLogger("post-tool-observe");
|
|
1505
1553
|
try {
|
|
1506
1554
|
const raw = readStdin();
|
|
1507
|
-
const input = parseInput(raw);
|
|
1555
|
+
const input = normalizeHookInput(parseInput(raw));
|
|
1508
1556
|
const token = process.env.REMNIC_HOOK_TOKEN || resolveToken();
|
|
1509
1557
|
if (token) await observeWorker(input, token, log);
|
|
1510
1558
|
} catch (err) {
|
|
@@ -1518,7 +1566,7 @@ function run(config) {
|
|
|
1518
1566
|
const log = makeLogger("session-end");
|
|
1519
1567
|
try {
|
|
1520
1568
|
const raw = readStdin();
|
|
1521
|
-
const input = parseInput(raw);
|
|
1569
|
+
const input = normalizeHookInput(parseInput(raw));
|
|
1522
1570
|
const token = process.env.REMNIC_HOOK_TOKEN || resolveToken();
|
|
1523
1571
|
await handleSessionEnd(input, token, log, raw, { drainRetry: true });
|
|
1524
1572
|
} catch (err) {
|
|
@@ -1536,7 +1584,7 @@ function run(config) {
|
|
|
1536
1584
|
|
|
1537
1585
|
const log = makeLogger(event);
|
|
1538
1586
|
const raw = readStdin();
|
|
1539
|
-
const input = parseInput(raw);
|
|
1587
|
+
const input = normalizeHookInput(parseInput(raw));
|
|
1540
1588
|
|
|
1541
1589
|
const handlers = {
|
|
1542
1590
|
"session-start": handleSessionStart,
|