@vectorize-io/hindsight-coding-agents 0.5.5 → 0.6.0
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/README.md +19 -5
- package/dist/antigravity-hook.js +84 -70
- package/dist/antigravity-statusline.js +32 -22
- package/dist/antigravity-stop-hook.js +160 -71
- package/dist/claude-hook.js +84 -70
- package/dist/claude-sessionstart-hook.js +111 -97
- package/dist/claude-stop-hook.js +160 -71
- package/dist/cline.js +158 -75
- package/dist/codex-hook.js +84 -70
- package/dist/codex-sessionstart-hook.js +111 -97
- package/dist/codex-stop-hook.js +160 -71
- package/dist/copilot-hook.js +84 -70
- package/dist/copilot-sessionstart-hook.js +111 -97
- package/dist/copilot-stop-hook.js +160 -71
- package/dist/cursor-hook.js +84 -70
- package/dist/cursor-sessionstart-hook.js +111 -97
- package/dist/cursor-stop-hook.js +160 -71
- package/dist/daemon-start.js +28 -18
- package/dist/dcode-hook.js +84 -70
- package/dist/dcode-sessionstart-hook.js +111 -97
- package/dist/dcode-stop-hook.js +160 -71
- package/dist/deepen.js +42 -32
- package/dist/devin-hook.js +84 -70
- package/dist/devin-sessionstart-hook.js +111 -97
- package/dist/devin-stop-hook.js +160 -71
- package/dist/droid-hook.js +84 -70
- package/dist/droid-sessionstart-hook.js +111 -97
- package/dist/droid-stop-hook.js +160 -71
- package/dist/dsh.js +156 -74
- package/dist/grok-hook.js +84 -70
- package/dist/grok-sessionstart-hook.js +111 -97
- package/dist/grok-stop-hook.js +160 -71
- package/dist/hindsight-seed.js +32 -22
- package/dist/index.js +159 -77
- package/dist/installer.js +308 -214
- package/dist/kilo.js +159 -77
- package/dist/mcp-server.js +41 -31
- package/dist/opencode2.js +158 -76
- package/dist/pi.js +158 -76
- package/dist/prime-agent.js +158 -76
- package/dist/qwen-hook.js +84 -70
- package/dist/qwen-sessionstart-hook.js +111 -97
- package/dist/qwen-stop-hook.js +160 -71
- package/dist/status.js +38 -28
- package/dist/zcode-hook.js +84 -70
- package/dist/zcode-sessionstart-hook.js +111 -97
- package/dist/zcode-stop-hook.js +160 -71
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skill/SKILL.md +19 -5
package/dist/cursor-hook.js
CHANGED
|
@@ -5,16 +5,28 @@ import { existsSync as existsSync2, readFileSync as readFileSync5 } from "fs";
|
|
|
5
5
|
|
|
6
6
|
// src/core/bank.ts
|
|
7
7
|
import { existsSync } from "fs";
|
|
8
|
-
import { homedir } from "os";
|
|
9
|
-
import { basename, dirname as dirname3, join as
|
|
8
|
+
import { homedir as homedir2 } from "os";
|
|
9
|
+
import { basename, dirname as dirname3, join as join4, normalize, sep } from "path";
|
|
10
10
|
|
|
11
11
|
// src/core/diag.ts
|
|
12
|
-
import {
|
|
12
|
+
import { join as join2 } from "path";
|
|
13
13
|
|
|
14
14
|
// src/core/log.ts
|
|
15
|
-
import { appendFileSync, mkdirSync } from "fs";
|
|
16
|
-
import {
|
|
15
|
+
import { appendFileSync, mkdirSync, renameSync, statSync } from "fs";
|
|
16
|
+
import { homedir } from "os";
|
|
17
17
|
import { dirname, join } from "path";
|
|
18
|
+
function logsDir() {
|
|
19
|
+
return join(homedir(), ".hindsight", "coding-agents-logs");
|
|
20
|
+
}
|
|
21
|
+
var LOG_MAX_BYTES = 10 * 1024 * 1024;
|
|
22
|
+
function appendLogLine(file, text) {
|
|
23
|
+
mkdirSync(dirname(file), { recursive: true, mode: 448 });
|
|
24
|
+
try {
|
|
25
|
+
if (statSync(file).size >= LOG_MAX_BYTES) renameSync(file, `${file}.1`);
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
appendFileSync(file, text, { mode: 384 });
|
|
29
|
+
}
|
|
18
30
|
var WEIGHT = { debug: 10, info: 20, warn: 30, error: 40 };
|
|
19
31
|
var current = ["debug", "info", "warn", "error"].find(
|
|
20
32
|
(l) => l === process.env.HINDSIGHT_LOG_LEVEL
|
|
@@ -23,15 +35,13 @@ function setLogLevel(level) {
|
|
|
23
35
|
if (!process.env.HINDSIGHT_LOG_LEVEL) current = level;
|
|
24
36
|
}
|
|
25
37
|
function logFilePath() {
|
|
26
|
-
return process.env.HINDSIGHT_LOG_FILE || join(
|
|
38
|
+
return process.env.HINDSIGHT_LOG_FILE || join(logsDir(), "plugin.log");
|
|
27
39
|
}
|
|
28
40
|
function write(level, scope, msg, extra) {
|
|
29
41
|
if (WEIGHT[level] < WEIGHT[current]) return;
|
|
30
42
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
appendFileSync(
|
|
34
|
-
file,
|
|
43
|
+
appendLogLine(
|
|
44
|
+
logFilePath(),
|
|
35
45
|
`${(/* @__PURE__ */ new Date()).toISOString()} ${level.toUpperCase().padEnd(5)} [${scope}] ${msg}` + (extra && Object.keys(extra).length ? ` ${JSON.stringify(extra)}` : "") + "\n"
|
|
36
46
|
);
|
|
37
47
|
} catch {
|
|
@@ -60,12 +70,12 @@ function describeError(value, maxChars = 200) {
|
|
|
60
70
|
|
|
61
71
|
// src/core/diag.ts
|
|
62
72
|
function diagFilePath() {
|
|
63
|
-
return process.env.HINDSIGHT_DIAG_FILE || "
|
|
73
|
+
return process.env.HINDSIGHT_DIAG_FILE || join2(logsDir(), "diag.jsonl");
|
|
64
74
|
}
|
|
65
75
|
function diag(harness, event, extra = {}) {
|
|
66
76
|
log.debug(harness, `diag:${event}`, extra);
|
|
67
77
|
try {
|
|
68
|
-
|
|
78
|
+
appendLogLine(
|
|
69
79
|
diagFilePath(),
|
|
70
80
|
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
71
81
|
);
|
|
@@ -75,7 +85,7 @@ function diag(harness, event, extra = {}) {
|
|
|
75
85
|
|
|
76
86
|
// src/core/git-layout.ts
|
|
77
87
|
import { lstatSync, readFileSync, realpathSync } from "fs";
|
|
78
|
-
import { dirname as dirname2, isAbsolute, join as
|
|
88
|
+
import { dirname as dirname2, isAbsolute, join as join3, resolve } from "path";
|
|
79
89
|
var TRANSIENT = /* @__PURE__ */ new Set(["EAGAIN", "EMFILE", "ENFILE", "EBUSY", "EINTR", "EIO", "ETIMEDOUT"]);
|
|
80
90
|
var ATTEMPTS = 3;
|
|
81
91
|
var BACKOFF_MS = 20;
|
|
@@ -111,16 +121,16 @@ function gitDirFromPointer(text, holder) {
|
|
|
111
121
|
return isAbsolute(target) ? target : resolve(holder, target);
|
|
112
122
|
}
|
|
113
123
|
function commonDirOf(gitDir) {
|
|
114
|
-
const pointer = entryKind(
|
|
124
|
+
const pointer = entryKind(join3(gitDir, "commondir")) === "file" ? readTextOrNull(join3(gitDir, "commondir"))?.trim() : null;
|
|
115
125
|
if (!pointer) return gitDir;
|
|
116
126
|
return isAbsolute(pointer) ? pointer : resolve(gitDir, pointer);
|
|
117
127
|
}
|
|
118
128
|
function isBare(commonDir) {
|
|
119
|
-
const config = readTextOrNull(
|
|
129
|
+
const config = readTextOrNull(join3(commonDir, "config"));
|
|
120
130
|
return config !== null && /^\s*bare\s*=\s*true\s*$/im.test(config);
|
|
121
131
|
}
|
|
122
132
|
function looksLikeBareRepository(directory) {
|
|
123
|
-
return entryKind(
|
|
133
|
+
return entryKind(join3(directory, "HEAD")) === "file" && entryKind(join3(directory, "objects")) === "dir" && entryKind(join3(directory, "refs")) === "dir";
|
|
124
134
|
}
|
|
125
135
|
function canonical(path) {
|
|
126
136
|
try {
|
|
@@ -137,7 +147,7 @@ function resolved(commonDir) {
|
|
|
137
147
|
function probeOnce(directory) {
|
|
138
148
|
let current2 = resolve(directory);
|
|
139
149
|
for (; ; ) {
|
|
140
|
-
const dotGit =
|
|
150
|
+
const dotGit = join3(current2, ".git");
|
|
141
151
|
const kind = entryKind(dotGit);
|
|
142
152
|
if (kind === "dir") {
|
|
143
153
|
const layout = resolved(commonDirOf(dotGit));
|
|
@@ -248,7 +258,7 @@ function gitProjectName(directory, resolveWorktrees, sessionRoot = "") {
|
|
|
248
258
|
return dirName(sessionRoot || directory);
|
|
249
259
|
}
|
|
250
260
|
function configuredDir(dir) {
|
|
251
|
-
const expanded = dir === "~" || dir.startsWith("~/") ?
|
|
261
|
+
const expanded = dir === "~" || dir.startsWith("~/") ? join4(homedir2(), dir.slice(1)) : dir;
|
|
252
262
|
return normalize(expanded).replace(new RegExp(`\\${sep}+$`), "");
|
|
253
263
|
}
|
|
254
264
|
function isWithin(directory, configured) {
|
|
@@ -322,18 +332,18 @@ function deriveBankIdOrSkip(config, directory, harness = "coding", sessionRoot)
|
|
|
322
332
|
|
|
323
333
|
// src/core/config.ts
|
|
324
334
|
import { readFileSync as readFileSync2 } from "fs";
|
|
325
|
-
import { homedir as
|
|
326
|
-
import { join as
|
|
335
|
+
import { homedir as homedir3 } from "os";
|
|
336
|
+
import { join as join7 } from "path";
|
|
327
337
|
|
|
328
338
|
// src/core/seed.ts
|
|
329
339
|
import { spawn as realSpawn } from "child_process";
|
|
330
|
-
import { dirname as dirname4, join as
|
|
340
|
+
import { dirname as dirname4, join as join5 } from "path";
|
|
331
341
|
import { fileURLToPath } from "url";
|
|
332
342
|
var DEFAULT_SEED_LIMIT = 300;
|
|
333
343
|
function startBackgroundSeed(repoDir, opts = {}) {
|
|
334
344
|
try {
|
|
335
345
|
const spawnFn = opts.spawn ?? realSpawn;
|
|
336
|
-
const enginePath = opts.enginePath ??
|
|
346
|
+
const enginePath = opts.enginePath ?? join5(dirname4(fileURLToPath(import.meta.url)), "deepen.js");
|
|
337
347
|
const limit = opts.limit ?? DEFAULT_SEED_LIMIT;
|
|
338
348
|
const child = spawnFn(
|
|
339
349
|
"node",
|
|
@@ -590,7 +600,7 @@ function codingBankManifest(overrides) {
|
|
|
590
600
|
|
|
591
601
|
// src/core/util.ts
|
|
592
602
|
import { accessSync, constants } from "fs";
|
|
593
|
-
import { delimiter, join as
|
|
603
|
+
import { delimiter, join as join6 } from "path";
|
|
594
604
|
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
595
605
|
function semverGte(version, min) {
|
|
596
606
|
const parts = (v) => {
|
|
@@ -1262,7 +1272,7 @@ var HindsightClient = class {
|
|
|
1262
1272
|
};
|
|
1263
1273
|
|
|
1264
1274
|
// src/core/config.ts
|
|
1265
|
-
var CONFIG_PATH = process.env.HINDSIGHT_CONFIG ||
|
|
1275
|
+
var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join7(homedir3(), ".hindsight", "coding-agent.json");
|
|
1266
1276
|
var DEFAULT_DAEMON_PORT = 9077;
|
|
1267
1277
|
var DEFAULT_DAEMON_PROFILE = "coding-agent";
|
|
1268
1278
|
function resolvePageTrigger(raw) {
|
|
@@ -1604,11 +1614,11 @@ ${toolGuide(opts)}
|
|
|
1604
1614
|
}
|
|
1605
1615
|
|
|
1606
1616
|
// src/core/session-cache.ts
|
|
1607
|
-
import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, renameSync, rmSync, writeFileSync } from "fs";
|
|
1608
|
-
import { tmpdir
|
|
1609
|
-
import { dirname as dirname5, join as
|
|
1617
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, renameSync as renameSync2, rmSync, writeFileSync } from "fs";
|
|
1618
|
+
import { tmpdir } from "os";
|
|
1619
|
+
import { dirname as dirname5, join as join8 } from "path";
|
|
1610
1620
|
function sessionCacheFile(harness, sessionId) {
|
|
1611
|
-
return
|
|
1621
|
+
return join8(tmpdir(), `hindsight-${harness}`, `${sessionId}.json`);
|
|
1612
1622
|
}
|
|
1613
1623
|
function readSessionCache(cacheFile) {
|
|
1614
1624
|
try {
|
|
@@ -1622,7 +1632,7 @@ function writeFileAtomic(path, body) {
|
|
|
1622
1632
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
1623
1633
|
try {
|
|
1624
1634
|
writeFileSync(tmp, body);
|
|
1625
|
-
|
|
1635
|
+
renameSync2(tmp, path);
|
|
1626
1636
|
} catch (e) {
|
|
1627
1637
|
try {
|
|
1628
1638
|
rmSync(tmp, { force: true });
|
|
@@ -1638,7 +1648,7 @@ function writeSessionCache(cacheFile, cache) {
|
|
|
1638
1648
|
}
|
|
1639
1649
|
}
|
|
1640
1650
|
function sessionRootFile(harness, sessionId) {
|
|
1641
|
-
return
|
|
1651
|
+
return join8(tmpdir(), `hindsight-${harness}`, `${sessionId}.root`);
|
|
1642
1652
|
}
|
|
1643
1653
|
function sessionRootDir(harness, sessionId, cwd) {
|
|
1644
1654
|
if (!sessionId || !cwd) return cwd;
|
|
@@ -1656,9 +1666,9 @@ function sessionRootDir(harness, sessionId, cwd) {
|
|
|
1656
1666
|
}
|
|
1657
1667
|
|
|
1658
1668
|
// src/core/turn-journal.ts
|
|
1659
|
-
import { appendFileSync as
|
|
1660
|
-
import { tmpdir as
|
|
1661
|
-
import { dirname as dirname6, join as
|
|
1669
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync4, statSync as statSync2 } from "fs";
|
|
1670
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
1671
|
+
import { dirname as dirname6, join as join9 } from "path";
|
|
1662
1672
|
|
|
1663
1673
|
// src/core/transcript-util.ts
|
|
1664
1674
|
var MEMORY_TAG_RE = /<(hook_prompt|task-notification|system-reminder|hindsight_memory|hindsight_memories|hindsight_bank|relevant_memories|user_feedback|hindsight_knowledge|hindsight_knowledge_refresh)\b[\s\S]*?<\/\1>/g;
|
|
@@ -1698,20 +1708,20 @@ function actionLine(tool, input) {
|
|
|
1698
1708
|
// src/core/turn-journal.ts
|
|
1699
1709
|
var JOURNAL_MAX_BYTES = 8 * 1024 * 1024;
|
|
1700
1710
|
function journalPath(harness, sessionId) {
|
|
1701
|
-
return
|
|
1711
|
+
return join9(tmpdir2(), `hindsight-${harness}`, `${sessionId || "no-session"}.journal.jsonl`);
|
|
1702
1712
|
}
|
|
1703
1713
|
function appendJournalTurn(path, turn) {
|
|
1704
1714
|
const content = stripInjectedMemory(turn.content ?? "").trim();
|
|
1705
1715
|
if (!content) return;
|
|
1706
1716
|
try {
|
|
1707
|
-
if (
|
|
1717
|
+
if (statSync2(path).size >= JOURNAL_MAX_BYTES) return;
|
|
1708
1718
|
} catch {
|
|
1709
1719
|
}
|
|
1710
1720
|
const last = readJournalTranscript(path).at(-1);
|
|
1711
1721
|
if (last && last.role === turn.role && last.content === content) return;
|
|
1712
1722
|
try {
|
|
1713
1723
|
mkdirSync3(dirname6(path), { recursive: true });
|
|
1714
|
-
|
|
1724
|
+
appendFileSync2(
|
|
1715
1725
|
path,
|
|
1716
1726
|
JSON.stringify({
|
|
1717
1727
|
role: turn.role,
|
|
@@ -1946,7 +1956,7 @@ async function runHook(spec, makeClient = (o) => new HindsightClient(o)) {
|
|
|
1946
1956
|
}
|
|
1947
1957
|
|
|
1948
1958
|
// src/core/retain-hook.ts
|
|
1949
|
-
import { readFileSync as
|
|
1959
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
1950
1960
|
|
|
1951
1961
|
// src/core/retain-cursor.ts
|
|
1952
1962
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -1958,14 +1968,14 @@ import { createHash as createHash3 } from "crypto";
|
|
|
1958
1968
|
|
|
1959
1969
|
// src/core/daemon.ts
|
|
1960
1970
|
import { execFileSync, spawn as realSpawn2 } from "child_process";
|
|
1961
|
-
import { dirname as dirname7, join as
|
|
1971
|
+
import { dirname as dirname7, join as join10 } from "path";
|
|
1962
1972
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1963
1973
|
|
|
1964
1974
|
// src/core/retain-stamp.ts
|
|
1965
1975
|
import { basename as basename2 } from "path";
|
|
1966
1976
|
|
|
1967
1977
|
// src/core/jsonl.ts
|
|
1968
|
-
import { closeSync, openSync, readSync, statSync as
|
|
1978
|
+
import { closeSync, openSync, readSync, statSync as statSync3 } from "fs";
|
|
1969
1979
|
import { StringDecoder } from "string_decoder";
|
|
1970
1980
|
var CHUNK_BYTES = 64 * 1024;
|
|
1971
1981
|
var MAX_TRANSCRIPT_BYTES = 32 * 1024 * 1024;
|
|
@@ -1973,7 +1983,7 @@ function readJsonlTail(path, opts) {
|
|
|
1973
1983
|
const maxBytes = opts.maxBytes ?? MAX_TRANSCRIPT_BYTES;
|
|
1974
1984
|
let size;
|
|
1975
1985
|
try {
|
|
1976
|
-
size =
|
|
1986
|
+
size = statSync3(path).size;
|
|
1977
1987
|
} catch {
|
|
1978
1988
|
return { lines: emptyLines(), skippedBytes: 0 };
|
|
1979
1989
|
}
|
|
@@ -2025,8 +2035,12 @@ function* streamLines(path, start) {
|
|
|
2025
2035
|
}
|
|
2026
2036
|
}
|
|
2027
2037
|
|
|
2038
|
+
// src/core/usage.ts
|
|
2039
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
2040
|
+
import { join as join11 } from "path";
|
|
2041
|
+
|
|
2028
2042
|
// src/core/session-start.ts
|
|
2029
|
-
import { readFileSync as
|
|
2043
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
2030
2044
|
|
|
2031
2045
|
// src/core/git.ts
|
|
2032
2046
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -2039,8 +2053,8 @@ import { execFileSync as execFileSync3 } from "child_process";
|
|
|
2039
2053
|
import { spawn as realSpawn4 } from "child_process";
|
|
2040
2054
|
import { createHash as createHash4 } from "crypto";
|
|
2041
2055
|
import { existsSync as existsSync3 } from "fs";
|
|
2042
|
-
import { homedir as
|
|
2043
|
-
import { dirname as dirname8, join as
|
|
2056
|
+
import { homedir as homedir4, tmpdir as tmpdir3 } from "os";
|
|
2057
|
+
import { dirname as dirname8, join as join13 } from "path";
|
|
2044
2058
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
2045
2059
|
|
|
2046
2060
|
// src/core/survey-lease.ts
|
|
@@ -2050,42 +2064,42 @@ import {
|
|
|
2050
2064
|
mkdirSync as mkdirSync4,
|
|
2051
2065
|
mkdtempSync,
|
|
2052
2066
|
readdirSync,
|
|
2053
|
-
renameSync as
|
|
2067
|
+
renameSync as renameSync3,
|
|
2054
2068
|
rmdirSync,
|
|
2055
2069
|
rmSync as rmSync2,
|
|
2056
|
-
statSync as
|
|
2070
|
+
statSync as statSync4,
|
|
2057
2071
|
unlinkSync,
|
|
2058
2072
|
utimesSync,
|
|
2059
2073
|
writeFileSync as writeFileSync2
|
|
2060
2074
|
} from "fs";
|
|
2061
|
-
import { join as
|
|
2075
|
+
import { join as join12 } from "path";
|
|
2062
2076
|
|
|
2063
2077
|
// src/core/auto-update.ts
|
|
2064
2078
|
import { spawn as realSpawn5 } from "child_process";
|
|
2065
2079
|
import {
|
|
2066
2080
|
existsSync as existsSync4,
|
|
2067
2081
|
mkdirSync as mkdirSync5,
|
|
2068
|
-
readFileSync as
|
|
2082
|
+
readFileSync as readFileSync8,
|
|
2069
2083
|
realpathSync as realpathSync2,
|
|
2070
2084
|
unlinkSync as unlinkSync2,
|
|
2071
2085
|
writeFileSync as writeFileSync3
|
|
2072
2086
|
} from "fs";
|
|
2073
|
-
import { homedir as
|
|
2074
|
-
import { dirname as dirname9, join as
|
|
2087
|
+
import { homedir as homedir5, tmpdir as tmpdir4 } from "os";
|
|
2088
|
+
import { dirname as dirname9, join as join14 } from "path";
|
|
2075
2089
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
2076
2090
|
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
2077
2091
|
var LOCK_STALE_MS = 10 * 60 * 1e3;
|
|
2078
2092
|
|
|
2079
2093
|
// src/core/skill-sync.ts
|
|
2080
|
-
import { cpSync, existsSync as existsSync5, readFileSync as
|
|
2081
|
-
import { homedir as
|
|
2082
|
-
import { dirname as dirname10, join as
|
|
2094
|
+
import { cpSync, existsSync as existsSync5, readFileSync as readFileSync9 } from "fs";
|
|
2095
|
+
import { homedir as homedir6 } from "os";
|
|
2096
|
+
import { dirname as dirname10, join as join15 } from "path";
|
|
2083
2097
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
2084
2098
|
|
|
2085
2099
|
// src/core/legacy.ts
|
|
2086
|
-
import { existsSync as existsSync6, readFileSync as
|
|
2087
|
-
import { homedir as
|
|
2088
|
-
import { join as
|
|
2100
|
+
import { existsSync as existsSync6, readFileSync as readFileSync10 } from "fs";
|
|
2101
|
+
import { homedir as homedir7 } from "os";
|
|
2102
|
+
import { join as join16, relative, isAbsolute as isAbsolute2 } from "path";
|
|
2089
2103
|
|
|
2090
2104
|
// src/core/transcript-codex.ts
|
|
2091
2105
|
function isSyntheticUserText(text) {
|
|
@@ -2217,19 +2231,19 @@ function readCopilotTranscript(path) {
|
|
|
2217
2231
|
}
|
|
2218
2232
|
|
|
2219
2233
|
// src/core/transcript-grok.ts
|
|
2220
|
-
import { existsSync as existsSync7, readFileSync as
|
|
2221
|
-
import { homedir as
|
|
2222
|
-
import { join as
|
|
2234
|
+
import { existsSync as existsSync7, readFileSync as readFileSync12, readdirSync as readdirSync2 } from "fs";
|
|
2235
|
+
import { homedir as homedir8 } from "os";
|
|
2236
|
+
import { join as join17 } from "path";
|
|
2223
2237
|
var CHAT_HISTORY = "chat_history.jsonl";
|
|
2224
|
-
function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME ||
|
|
2225
|
-
const sessionsDir =
|
|
2226
|
-
const direct =
|
|
2238
|
+
function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME || join17(homedir8(), ".grok")) {
|
|
2239
|
+
const sessionsDir = join17(grokHome, "sessions");
|
|
2240
|
+
const direct = join17(sessionsDir, encodeURIComponent(cwd), sessionId, CHAT_HISTORY);
|
|
2227
2241
|
if (existsSync7(direct)) return direct;
|
|
2228
2242
|
try {
|
|
2229
2243
|
for (const candidate of readdirSync2(sessionsDir)) {
|
|
2230
|
-
const directory =
|
|
2231
|
-
if (
|
|
2232
|
-
return
|
|
2244
|
+
const directory = join17(sessionsDir, candidate);
|
|
2245
|
+
if (readFileSync12(join17(directory, ".cwd"), "utf8").trim() === cwd) {
|
|
2246
|
+
return join17(directory, sessionId, CHAT_HISTORY);
|
|
2233
2247
|
}
|
|
2234
2248
|
}
|
|
2235
2249
|
} catch {
|
|
@@ -2266,10 +2280,10 @@ function readGrokTranscript(path) {
|
|
|
2266
2280
|
// src/core/transcript-devin.ts
|
|
2267
2281
|
import { existsSync as existsSync8 } from "fs";
|
|
2268
2282
|
import { createRequire } from "module";
|
|
2269
|
-
import { homedir as
|
|
2270
|
-
import { join as
|
|
2271
|
-
function devinSessionDb(home =
|
|
2272
|
-
return
|
|
2283
|
+
import { homedir as homedir9 } from "os";
|
|
2284
|
+
import { join as join18 } from "path";
|
|
2285
|
+
function devinSessionDb(home = homedir9()) {
|
|
2286
|
+
return join18(home, ".local", "share", "devin", "cli", "sessions.db");
|
|
2273
2287
|
}
|
|
2274
2288
|
function parseDevinMessages(nodes) {
|
|
2275
2289
|
const messages = /* @__PURE__ */ new Map();
|
|
@@ -2579,7 +2593,7 @@ function readDroidTranscript(path) {
|
|
|
2579
2593
|
}
|
|
2580
2594
|
|
|
2581
2595
|
// src/core/transcript-zcode.ts
|
|
2582
|
-
import { readFileSync as
|
|
2596
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
2583
2597
|
function messageText2(content) {
|
|
2584
2598
|
if (typeof content === "string") return content.trim();
|
|
2585
2599
|
if (!Array.isArray(content)) return "";
|
|
@@ -2589,7 +2603,7 @@ function readZcodeTranscript(path) {
|
|
|
2589
2603
|
if (!path) return [];
|
|
2590
2604
|
let body;
|
|
2591
2605
|
try {
|
|
2592
|
-
body =
|
|
2606
|
+
body = readFileSync13(path, "utf8");
|
|
2593
2607
|
} catch {
|
|
2594
2608
|
return [];
|
|
2595
2609
|
}
|