@remnic/plugin-claude-code 10.0.129 → 10.0.131
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,9 +689,21 @@ 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
|
+
// A payload path that exists is authoritative. A missing path falls
|
|
697
|
+
// through to the host resolver: agy sends a transcriptPath pointing
|
|
698
|
+
// at a .jsonl file that never materializes, while the real transcript
|
|
699
|
+
// lives in the host-resolved SQLite db.
|
|
700
|
+
try {
|
|
701
|
+
if (fs.existsSync(transcriptPath) && fs.statSync(transcriptPath).isFile()) {
|
|
702
|
+
return transcriptPath;
|
|
703
|
+
}
|
|
704
|
+
} catch {
|
|
705
|
+
/* fall through to host resolver */
|
|
706
|
+
}
|
|
659
707
|
}
|
|
660
708
|
if (config.resolveTranscriptPath instanceof Function) {
|
|
661
709
|
try {
|
|
@@ -669,10 +717,20 @@ function run(config) {
|
|
|
669
717
|
}
|
|
670
718
|
|
|
671
719
|
// 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
|
|
720
|
+
// env var (Devin: DEVIN_PROJECT_DIR; Claude Code compat: CLAUDE_PROJECT_DIR;
|
|
721
|
+
// Antigravity: AGY_PROJECT_DIR).
|
|
722
|
+
// Hosts that omit cwd from the hook payload still export a project-dir
|
|
723
|
+
// env var. The active host's variable (config.projectDirEnv) wins; the
|
|
724
|
+
// shared fallbacks preserve the pre-existing hosts' behavior when the
|
|
725
|
+
// host's own variable is unset. AGY_PROJECT_DIR is intentionally absent
|
|
726
|
+
// from the shared fallback — agy reaches it through its own projectDirEnv,
|
|
727
|
+
// so a stray AGY variable can never reroute another host's recall.
|
|
673
728
|
function cwdFor(input) {
|
|
674
729
|
const cwd = input.cwd || "";
|
|
675
730
|
if (isString(cwd) && cwd) return cwd;
|
|
731
|
+
if (PROJECT_DIR_ENV && isString(process.env[PROJECT_DIR_ENV]) && process.env[PROJECT_DIR_ENV]) {
|
|
732
|
+
return process.env[PROJECT_DIR_ENV];
|
|
733
|
+
}
|
|
676
734
|
return process.env.DEVIN_PROJECT_DIR || process.env.CLAUDE_PROJECT_DIR || "";
|
|
677
735
|
}
|
|
678
736
|
|
|
@@ -1504,7 +1562,7 @@ function run(config) {
|
|
|
1504
1562
|
const log = makeLogger("post-tool-observe");
|
|
1505
1563
|
try {
|
|
1506
1564
|
const raw = readStdin();
|
|
1507
|
-
const input = parseInput(raw);
|
|
1565
|
+
const input = normalizeHookInput(parseInput(raw));
|
|
1508
1566
|
const token = process.env.REMNIC_HOOK_TOKEN || resolveToken();
|
|
1509
1567
|
if (token) await observeWorker(input, token, log);
|
|
1510
1568
|
} catch (err) {
|
|
@@ -1518,7 +1576,7 @@ function run(config) {
|
|
|
1518
1576
|
const log = makeLogger("session-end");
|
|
1519
1577
|
try {
|
|
1520
1578
|
const raw = readStdin();
|
|
1521
|
-
const input = parseInput(raw);
|
|
1579
|
+
const input = normalizeHookInput(parseInput(raw));
|
|
1522
1580
|
const token = process.env.REMNIC_HOOK_TOKEN || resolveToken();
|
|
1523
1581
|
await handleSessionEnd(input, token, log, raw, { drainRetry: true });
|
|
1524
1582
|
} catch (err) {
|
|
@@ -1536,7 +1594,7 @@ function run(config) {
|
|
|
1536
1594
|
|
|
1537
1595
|
const log = makeLogger(event);
|
|
1538
1596
|
const raw = readStdin();
|
|
1539
|
-
const input = parseInput(raw);
|
|
1597
|
+
const input = normalizeHookInput(parseInput(raw));
|
|
1540
1598
|
|
|
1541
1599
|
const handlers = {
|
|
1542
1600
|
"session-start": handleSessionStart,
|