@vectorize-io/hindsight-coding-agents 0.0.4 → 0.0.5
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 +80 -79
- package/dist/antigravity-hook.js +46 -17
- package/dist/antigravity-statusline.js +25 -1
- package/dist/antigravity-stop-hook.js +158 -17
- package/dist/claude-hook.js +46 -17
- package/dist/claude-sessionstart-hook.js +169 -28
- package/dist/claude-stop-hook.js +158 -17
- package/dist/cline.js +35 -6
- package/dist/codex-hook.js +46 -17
- package/dist/codex-sessionstart-hook.js +169 -28
- package/dist/codex-stop-hook.js +158 -17
- package/dist/copilot-hook.js +46 -17
- package/dist/copilot-sessionstart-hook.js +169 -28
- package/dist/copilot-stop-hook.js +158 -17
- package/dist/cursor-hook.js +46 -17
- package/dist/cursor-sessionstart-hook.js +169 -28
- package/dist/cursor-stop-hook.js +158 -17
- package/dist/daemon-start.js +626 -0
- package/dist/deepen.js +25 -1
- package/dist/devin-hook.js +46 -17
- package/dist/devin-sessionstart-hook.js +169 -28
- package/dist/devin-stop-hook.js +158 -17
- package/dist/grok-hook.js +46 -17
- package/dist/grok-sessionstart-hook.js +169 -28
- package/dist/grok-stop-hook.js +158 -17
- package/dist/hindsight-seed.js +25 -1
- package/dist/index.js +35 -6
- package/dist/installer.js +407 -152
- package/dist/kilo.js +35 -6
- package/dist/mcp-server.js +25 -1
- package/dist/status.js +25 -1
- package/package.json +2 -1
package/dist/devin-stop-hook.js
CHANGED
|
@@ -80,10 +80,24 @@ var DEFAULT_SEED_LIMIT = 300;
|
|
|
80
80
|
|
|
81
81
|
// src/core/config.ts
|
|
82
82
|
var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join3(homedir2(), ".hindsight", "coding-agent.json");
|
|
83
|
+
var DEFAULT_DAEMON_PORT = 9077;
|
|
84
|
+
var DEFAULT_DAEMON_IDLE_TIMEOUT = 300;
|
|
85
|
+
var DEFAULT_DAEMON_PROFILE = "coding-agent";
|
|
83
86
|
function resolveConfig(raw = {}) {
|
|
87
|
+
const serverMode = ["cloud", "self-hosted", "daemon"].includes(raw.serverMode) ? raw.serverMode : "cloud";
|
|
88
|
+
const apiPort = raw.apiPort || DEFAULT_DAEMON_PORT;
|
|
84
89
|
return {
|
|
85
|
-
|
|
90
|
+
serverMode,
|
|
91
|
+
// Daemon mode resolves the URL HERE rather than at each call site: every entry point already
|
|
92
|
+
// builds its client from cfg.apiUrl, so collapsing the mode into that one field means the
|
|
93
|
+
// daemon needs no plumbing through eight separate constructors.
|
|
94
|
+
apiUrl: serverMode === "daemon" ? `http://127.0.0.1:${apiPort}` : raw.apiUrl ?? "https://api.hindsight.vectorize.io",
|
|
86
95
|
apiToken: raw.apiToken || void 0,
|
|
96
|
+
apiPort,
|
|
97
|
+
daemonIdleTimeout: raw.daemonIdleTimeout ?? DEFAULT_DAEMON_IDLE_TIMEOUT,
|
|
98
|
+
daemonProfile: raw.daemonProfile || DEFAULT_DAEMON_PROFILE,
|
|
99
|
+
embedVersion: raw.embedVersion || void 0,
|
|
100
|
+
embedPackagePath: raw.embedPackagePath || void 0,
|
|
87
101
|
bankId: raw.bankId,
|
|
88
102
|
dynamicBankId: raw.dynamicBankId,
|
|
89
103
|
bankIdTemplate: raw.bankIdTemplate,
|
|
@@ -129,8 +143,16 @@ function applyLayer(raw, layer, harness) {
|
|
|
129
143
|
return out;
|
|
130
144
|
}
|
|
131
145
|
var ENV_KEYS = {
|
|
146
|
+
serverMode: "HINDSIGHT_SERVER_MODE",
|
|
132
147
|
apiUrl: "HINDSIGHT_API_URL",
|
|
133
148
|
apiToken: "HINDSIGHT_API_TOKEN",
|
|
149
|
+
// These four keep the names the old per-agent Claude Code plugin used, so a user migrating from
|
|
150
|
+
// it can carry their existing environment over unchanged.
|
|
151
|
+
apiPort: "HINDSIGHT_API_PORT",
|
|
152
|
+
daemonIdleTimeout: "HINDSIGHT_DAEMON_IDLE_TIMEOUT",
|
|
153
|
+
embedVersion: "HINDSIGHT_EMBED_VERSION",
|
|
154
|
+
embedPackagePath: "HINDSIGHT_EMBED_PACKAGE_PATH",
|
|
155
|
+
daemonProfile: "HINDSIGHT_DAEMON_PROFILE",
|
|
134
156
|
bankId: "HINDSIGHT_BANK_ID",
|
|
135
157
|
dynamicBankId: "HINDSIGHT_DYNAMIC_BANK_ID",
|
|
136
158
|
bankIdTemplate: "HINDSIGHT_BANK_ID_TEMPLATE",
|
|
@@ -161,6 +183,8 @@ var ENV_BOOLEANS = /* @__PURE__ */ new Set([
|
|
|
161
183
|
"codebaseSurvey"
|
|
162
184
|
]);
|
|
163
185
|
var ENV_NUMBERS = /* @__PURE__ */ new Set([
|
|
186
|
+
"apiPort",
|
|
187
|
+
"daemonIdleTimeout",
|
|
164
188
|
"retainEveryTurns",
|
|
165
189
|
"reflectTimeoutMs",
|
|
166
190
|
"pageRefreshEveryTurns",
|
|
@@ -802,6 +826,122 @@ async function retainLiveSession(client, sessionId, turns, startTs, harness) {
|
|
|
802
826
|
);
|
|
803
827
|
}
|
|
804
828
|
|
|
829
|
+
// src/core/daemon.ts
|
|
830
|
+
import { execFileSync as execFileSync2, spawn as realSpawn2 } from "child_process";
|
|
831
|
+
import { dirname as dirname5, join as join6 } from "path";
|
|
832
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
833
|
+
var DAEMON_WAIT_RETAIN_MS = 4e4;
|
|
834
|
+
async function isServerHealthy(baseUrl, timeoutMs = 2e3) {
|
|
835
|
+
try {
|
|
836
|
+
const res = await fetch(`${baseUrl}/health`, { signal: AbortSignal.timeout(timeoutMs) });
|
|
837
|
+
return res.ok;
|
|
838
|
+
} catch {
|
|
839
|
+
return false;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
function hasRustToolchain() {
|
|
843
|
+
if (process.platform !== "darwin") return true;
|
|
844
|
+
try {
|
|
845
|
+
execFileSync2("cargo", ["--version"], { stdio: "pipe", timeout: 1e4 });
|
|
846
|
+
return true;
|
|
847
|
+
} catch {
|
|
848
|
+
return false;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
function hasUvx() {
|
|
852
|
+
try {
|
|
853
|
+
execFileSync2("uvx", ["--version"], { stdio: "pipe", timeout: 1e4 });
|
|
854
|
+
return true;
|
|
855
|
+
} catch {
|
|
856
|
+
return false;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
var PROVIDER_PROBES = [
|
|
860
|
+
{ provider: "openai", keyEnv: "OPENAI_API_KEY" },
|
|
861
|
+
{ provider: "anthropic", keyEnv: "ANTHROPIC_API_KEY" },
|
|
862
|
+
{ provider: "gemini", keyEnv: "GEMINI_API_KEY" },
|
|
863
|
+
{ provider: "groq", keyEnv: "GROQ_API_KEY" }
|
|
864
|
+
];
|
|
865
|
+
function detectLlm(env = process.env) {
|
|
866
|
+
const explicit = env.HINDSIGHT_API_LLM_PROVIDER?.trim();
|
|
867
|
+
if (explicit) {
|
|
868
|
+
return {
|
|
869
|
+
provider: explicit,
|
|
870
|
+
apiKey: env.HINDSIGHT_API_LLM_API_KEY?.trim() || void 0,
|
|
871
|
+
source: "HINDSIGHT_API_LLM_PROVIDER"
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
for (const probe of PROVIDER_PROBES) {
|
|
875
|
+
const key = env[probe.keyEnv]?.trim();
|
|
876
|
+
if (key) return { provider: probe.provider, apiKey: key, source: probe.keyEnv };
|
|
877
|
+
}
|
|
878
|
+
if (onPath("claude")) {
|
|
879
|
+
return { provider: "claude-code", source: "the Claude Code CLI on PATH (no API key needed)" };
|
|
880
|
+
}
|
|
881
|
+
return void 0;
|
|
882
|
+
}
|
|
883
|
+
function onPath(bin) {
|
|
884
|
+
try {
|
|
885
|
+
execFileSync2("which", [bin], { stdio: "pipe", timeout: 5e3 });
|
|
886
|
+
return true;
|
|
887
|
+
} catch {
|
|
888
|
+
return false;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
function startDaemonDetached(cfg, harness, spawnFn = realSpawn2) {
|
|
892
|
+
try {
|
|
893
|
+
const starter = join6(dirname5(fileURLToPath2(import.meta.url)), "daemon-start.js");
|
|
894
|
+
const child = spawnFn("node", [starter, "--harness", harness], {
|
|
895
|
+
detached: true,
|
|
896
|
+
stdio: "ignore"
|
|
897
|
+
});
|
|
898
|
+
child.on("error", () => {
|
|
899
|
+
});
|
|
900
|
+
child.unref();
|
|
901
|
+
diag(harness, "daemon_start_spawned", { apiUrl: cfg.apiUrl });
|
|
902
|
+
} catch {
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
async function ensureDaemon(cfg, harness, opts = {}) {
|
|
906
|
+
if (cfg.serverMode !== "daemon") return;
|
|
907
|
+
if (await isServerHealthy(cfg.apiUrl)) return;
|
|
908
|
+
if (!preflightDaemon(cfg, harness)) return;
|
|
909
|
+
startDaemonDetached(cfg, harness, opts.spawnFn);
|
|
910
|
+
await waitForHealth(cfg.apiUrl, opts.waitMs ?? 0);
|
|
911
|
+
}
|
|
912
|
+
async function waitForHealth(baseUrl, budgetMs, pollMs = 1e3) {
|
|
913
|
+
const deadline = Date.now() + budgetMs;
|
|
914
|
+
while (Date.now() < deadline) {
|
|
915
|
+
await new Promise((r) => setTimeout(r, pollMs));
|
|
916
|
+
if (await isServerHealthy(baseUrl)) return true;
|
|
917
|
+
}
|
|
918
|
+
return false;
|
|
919
|
+
}
|
|
920
|
+
function preflightDaemon(cfg, harness) {
|
|
921
|
+
if (!hasUvx()) {
|
|
922
|
+
diag(harness, "daemon_uvx_missing", { apiUrl: cfg.apiUrl });
|
|
923
|
+
log.warn(harness, "daemon mode needs `uv` on PATH \u2014 see https://docs.astral.sh/uv/");
|
|
924
|
+
return false;
|
|
925
|
+
}
|
|
926
|
+
if (!hasRustToolchain()) {
|
|
927
|
+
diag(harness, "daemon_rust_missing", { platform: process.platform });
|
|
928
|
+
log.warn(
|
|
929
|
+
harness,
|
|
930
|
+
"daemon mode on macOS needs a current Rust toolchain (litellm ships no macOS wheel) \u2014 install from https://rustup.rs, then `rustup default stable && rustup update`"
|
|
931
|
+
);
|
|
932
|
+
return false;
|
|
933
|
+
}
|
|
934
|
+
if (!detectLlm()) {
|
|
935
|
+
diag(harness, "daemon_no_llm", {});
|
|
936
|
+
log.warn(
|
|
937
|
+
harness,
|
|
938
|
+
"daemon mode needs an LLM for fact extraction \u2014 set OPENAI_API_KEY (or ANTHROPIC_API_KEY / GEMINI_API_KEY / HINDSIGHT_API_LLM_PROVIDER), or install the Claude Code CLI"
|
|
939
|
+
);
|
|
940
|
+
return false;
|
|
941
|
+
}
|
|
942
|
+
return true;
|
|
943
|
+
}
|
|
944
|
+
|
|
805
945
|
// src/core/transcript.ts
|
|
806
946
|
import { readFileSync as readFileSync4 } from "fs";
|
|
807
947
|
|
|
@@ -936,6 +1076,7 @@ async function runRetainHook(spec, makeClient = (o) => new HindsightClient(o)) {
|
|
|
936
1076
|
cfg = resolved.cfg;
|
|
937
1077
|
const bankId = resolved.bankId;
|
|
938
1078
|
if (cfg.disabled) return;
|
|
1079
|
+
await ensureDaemon(cfg, spec.harness, { waitMs: DAEMON_WAIT_RETAIN_MS });
|
|
939
1080
|
const client = makeClient({ apiUrl: cfg.apiUrl, apiToken: cfg.apiToken, bank: bankId });
|
|
940
1081
|
await buildRetain({
|
|
941
1082
|
harness: spec.harness,
|
|
@@ -950,24 +1091,24 @@ async function runRetainHook(spec, makeClient = (o) => new HindsightClient(o)) {
|
|
|
950
1091
|
import { readFileSync as readFileSync7 } from "fs";
|
|
951
1092
|
|
|
952
1093
|
// src/core/git.ts
|
|
953
|
-
import { execFileSync as
|
|
1094
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
954
1095
|
import { resolve } from "path";
|
|
955
1096
|
|
|
956
1097
|
// src/core/status.ts
|
|
957
|
-
import { execFileSync as
|
|
1098
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
958
1099
|
|
|
959
1100
|
// src/core/survey.ts
|
|
960
|
-
import { spawn as
|
|
1101
|
+
import { spawn as realSpawn3 } from "child_process";
|
|
961
1102
|
import { accessSync, constants, existsSync as existsSync2 } from "fs";
|
|
962
1103
|
import { homedir as homedir3 } from "os";
|
|
963
|
-
import { delimiter, dirname as
|
|
964
|
-
import { fileURLToPath as
|
|
1104
|
+
import { delimiter, dirname as dirname6, join as join7 } from "path";
|
|
1105
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
965
1106
|
|
|
966
1107
|
// src/core/skill-sync.ts
|
|
967
1108
|
import { cpSync, existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
|
|
968
1109
|
import { homedir as homedir4 } from "os";
|
|
969
|
-
import { dirname as
|
|
970
|
-
import { fileURLToPath as
|
|
1110
|
+
import { dirname as dirname7, join as join8 } from "path";
|
|
1111
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
971
1112
|
|
|
972
1113
|
// src/core/transcript-codex.ts
|
|
973
1114
|
import { readFileSync as readFileSync8 } from "fs";
|
|
@@ -1129,17 +1270,17 @@ function readCopilotTranscript(path) {
|
|
|
1129
1270
|
// src/core/transcript-grok.ts
|
|
1130
1271
|
import { existsSync as existsSync4, readFileSync as readFileSync12, readdirSync } from "fs";
|
|
1131
1272
|
import { homedir as homedir5 } from "os";
|
|
1132
|
-
import { join as
|
|
1273
|
+
import { join as join9 } from "path";
|
|
1133
1274
|
var CHAT_HISTORY = "chat_history.jsonl";
|
|
1134
|
-
function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME ||
|
|
1135
|
-
const sessionsDir =
|
|
1136
|
-
const direct =
|
|
1275
|
+
function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME || join9(homedir5(), ".grok")) {
|
|
1276
|
+
const sessionsDir = join9(grokHome, "sessions");
|
|
1277
|
+
const direct = join9(sessionsDir, encodeURIComponent(cwd), sessionId, CHAT_HISTORY);
|
|
1137
1278
|
if (existsSync4(direct)) return direct;
|
|
1138
1279
|
try {
|
|
1139
1280
|
for (const candidate of readdirSync(sessionsDir)) {
|
|
1140
|
-
const directory =
|
|
1141
|
-
if (readFileSync12(
|
|
1142
|
-
return
|
|
1281
|
+
const directory = join9(sessionsDir, candidate);
|
|
1282
|
+
if (readFileSync12(join9(directory, ".cwd"), "utf8").trim() === cwd) {
|
|
1283
|
+
return join9(directory, sessionId, CHAT_HISTORY);
|
|
1143
1284
|
}
|
|
1144
1285
|
}
|
|
1145
1286
|
} catch {
|
|
@@ -1183,9 +1324,9 @@ function readGrokTranscript(path) {
|
|
|
1183
1324
|
import { existsSync as existsSync5 } from "fs";
|
|
1184
1325
|
import { createRequire } from "module";
|
|
1185
1326
|
import { homedir as homedir6 } from "os";
|
|
1186
|
-
import { join as
|
|
1327
|
+
import { join as join10 } from "path";
|
|
1187
1328
|
function devinSessionDb(home = homedir6()) {
|
|
1188
|
-
return
|
|
1329
|
+
return join10(home, ".local", "share", "devin", "cli", "sessions.db");
|
|
1189
1330
|
}
|
|
1190
1331
|
function parseDevinMessages(nodes) {
|
|
1191
1332
|
const messages = /* @__PURE__ */ new Map();
|
package/dist/grok-hook.js
CHANGED
|
@@ -106,10 +106,24 @@ function startBackgroundSeed(repoDir, opts = {}) {
|
|
|
106
106
|
|
|
107
107
|
// src/core/config.ts
|
|
108
108
|
var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join3(homedir2(), ".hindsight", "coding-agent.json");
|
|
109
|
+
var DEFAULT_DAEMON_PORT = 9077;
|
|
110
|
+
var DEFAULT_DAEMON_IDLE_TIMEOUT = 300;
|
|
111
|
+
var DEFAULT_DAEMON_PROFILE = "coding-agent";
|
|
109
112
|
function resolveConfig(raw = {}) {
|
|
113
|
+
const serverMode = ["cloud", "self-hosted", "daemon"].includes(raw.serverMode) ? raw.serverMode : "cloud";
|
|
114
|
+
const apiPort = raw.apiPort || DEFAULT_DAEMON_PORT;
|
|
110
115
|
return {
|
|
111
|
-
|
|
116
|
+
serverMode,
|
|
117
|
+
// Daemon mode resolves the URL HERE rather than at each call site: every entry point already
|
|
118
|
+
// builds its client from cfg.apiUrl, so collapsing the mode into that one field means the
|
|
119
|
+
// daemon needs no plumbing through eight separate constructors.
|
|
120
|
+
apiUrl: serverMode === "daemon" ? `http://127.0.0.1:${apiPort}` : raw.apiUrl ?? "https://api.hindsight.vectorize.io",
|
|
112
121
|
apiToken: raw.apiToken || void 0,
|
|
122
|
+
apiPort,
|
|
123
|
+
daemonIdleTimeout: raw.daemonIdleTimeout ?? DEFAULT_DAEMON_IDLE_TIMEOUT,
|
|
124
|
+
daemonProfile: raw.daemonProfile || DEFAULT_DAEMON_PROFILE,
|
|
125
|
+
embedVersion: raw.embedVersion || void 0,
|
|
126
|
+
embedPackagePath: raw.embedPackagePath || void 0,
|
|
113
127
|
bankId: raw.bankId,
|
|
114
128
|
dynamicBankId: raw.dynamicBankId,
|
|
115
129
|
bankIdTemplate: raw.bankIdTemplate,
|
|
@@ -155,8 +169,16 @@ function applyLayer(raw, layer, harness) {
|
|
|
155
169
|
return out;
|
|
156
170
|
}
|
|
157
171
|
var ENV_KEYS = {
|
|
172
|
+
serverMode: "HINDSIGHT_SERVER_MODE",
|
|
158
173
|
apiUrl: "HINDSIGHT_API_URL",
|
|
159
174
|
apiToken: "HINDSIGHT_API_TOKEN",
|
|
175
|
+
// These four keep the names the old per-agent Claude Code plugin used, so a user migrating from
|
|
176
|
+
// it can carry their existing environment over unchanged.
|
|
177
|
+
apiPort: "HINDSIGHT_API_PORT",
|
|
178
|
+
daemonIdleTimeout: "HINDSIGHT_DAEMON_IDLE_TIMEOUT",
|
|
179
|
+
embedVersion: "HINDSIGHT_EMBED_VERSION",
|
|
180
|
+
embedPackagePath: "HINDSIGHT_EMBED_PACKAGE_PATH",
|
|
181
|
+
daemonProfile: "HINDSIGHT_DAEMON_PROFILE",
|
|
160
182
|
bankId: "HINDSIGHT_BANK_ID",
|
|
161
183
|
dynamicBankId: "HINDSIGHT_DYNAMIC_BANK_ID",
|
|
162
184
|
bankIdTemplate: "HINDSIGHT_BANK_ID_TEMPLATE",
|
|
@@ -187,6 +209,8 @@ var ENV_BOOLEANS = /* @__PURE__ */ new Set([
|
|
|
187
209
|
"codebaseSurvey"
|
|
188
210
|
]);
|
|
189
211
|
var ENV_NUMBERS = /* @__PURE__ */ new Set([
|
|
212
|
+
"apiPort",
|
|
213
|
+
"daemonIdleTimeout",
|
|
190
214
|
"retainEveryTurns",
|
|
191
215
|
"reflectTimeoutMs",
|
|
192
216
|
"pageRefreshEveryTurns",
|
|
@@ -1011,6 +1035,11 @@ async function runHook(spec, makeClient = (o) => new HindsightClient(o)) {
|
|
|
1011
1035
|
// src/core/retain-hook.ts
|
|
1012
1036
|
import { readFileSync as readFileSync5 } from "fs";
|
|
1013
1037
|
|
|
1038
|
+
// src/core/daemon.ts
|
|
1039
|
+
import { execFileSync as execFileSync2, spawn as realSpawn2 } from "child_process";
|
|
1040
|
+
import { dirname as dirname5, join as join6 } from "path";
|
|
1041
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1042
|
+
|
|
1014
1043
|
// src/core/transcript.ts
|
|
1015
1044
|
import { readFileSync as readFileSync4 } from "fs";
|
|
1016
1045
|
|
|
@@ -1053,24 +1082,24 @@ function actionLine(tool, input) {
|
|
|
1053
1082
|
import { readFileSync as readFileSync7 } from "fs";
|
|
1054
1083
|
|
|
1055
1084
|
// src/core/git.ts
|
|
1056
|
-
import { execFileSync as
|
|
1085
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
1057
1086
|
import { resolve } from "path";
|
|
1058
1087
|
|
|
1059
1088
|
// src/core/status.ts
|
|
1060
|
-
import { execFileSync as
|
|
1089
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
1061
1090
|
|
|
1062
1091
|
// src/core/survey.ts
|
|
1063
|
-
import { spawn as
|
|
1092
|
+
import { spawn as realSpawn3 } from "child_process";
|
|
1064
1093
|
import { accessSync, constants, existsSync as existsSync2 } from "fs";
|
|
1065
1094
|
import { homedir as homedir3 } from "os";
|
|
1066
|
-
import { delimiter, dirname as
|
|
1067
|
-
import { fileURLToPath as
|
|
1095
|
+
import { delimiter, dirname as dirname6, join as join7 } from "path";
|
|
1096
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
1068
1097
|
|
|
1069
1098
|
// src/core/skill-sync.ts
|
|
1070
1099
|
import { cpSync, existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
|
|
1071
1100
|
import { homedir as homedir4 } from "os";
|
|
1072
|
-
import { dirname as
|
|
1073
|
-
import { fileURLToPath as
|
|
1101
|
+
import { dirname as dirname7, join as join8 } from "path";
|
|
1102
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
1074
1103
|
|
|
1075
1104
|
// src/core/transcript-codex.ts
|
|
1076
1105
|
import { readFileSync as readFileSync8 } from "fs";
|
|
@@ -1232,17 +1261,17 @@ function readCopilotTranscript(path) {
|
|
|
1232
1261
|
// src/core/transcript-grok.ts
|
|
1233
1262
|
import { existsSync as existsSync4, readFileSync as readFileSync12, readdirSync } from "fs";
|
|
1234
1263
|
import { homedir as homedir5 } from "os";
|
|
1235
|
-
import { join as
|
|
1264
|
+
import { join as join9 } from "path";
|
|
1236
1265
|
var CHAT_HISTORY = "chat_history.jsonl";
|
|
1237
|
-
function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME ||
|
|
1238
|
-
const sessionsDir =
|
|
1239
|
-
const direct =
|
|
1266
|
+
function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME || join9(homedir5(), ".grok")) {
|
|
1267
|
+
const sessionsDir = join9(grokHome, "sessions");
|
|
1268
|
+
const direct = join9(sessionsDir, encodeURIComponent(cwd), sessionId, CHAT_HISTORY);
|
|
1240
1269
|
if (existsSync4(direct)) return direct;
|
|
1241
1270
|
try {
|
|
1242
1271
|
for (const candidate of readdirSync(sessionsDir)) {
|
|
1243
|
-
const directory =
|
|
1244
|
-
if (readFileSync12(
|
|
1245
|
-
return
|
|
1272
|
+
const directory = join9(sessionsDir, candidate);
|
|
1273
|
+
if (readFileSync12(join9(directory, ".cwd"), "utf8").trim() === cwd) {
|
|
1274
|
+
return join9(directory, sessionId, CHAT_HISTORY);
|
|
1246
1275
|
}
|
|
1247
1276
|
}
|
|
1248
1277
|
} catch {
|
|
@@ -1286,9 +1315,9 @@ function readGrokTranscript(path) {
|
|
|
1286
1315
|
import { existsSync as existsSync5 } from "fs";
|
|
1287
1316
|
import { createRequire } from "module";
|
|
1288
1317
|
import { homedir as homedir6 } from "os";
|
|
1289
|
-
import { join as
|
|
1318
|
+
import { join as join10 } from "path";
|
|
1290
1319
|
function devinSessionDb(home = homedir6()) {
|
|
1291
|
-
return
|
|
1320
|
+
return join10(home, ".local", "share", "devin", "cli", "sessions.db");
|
|
1292
1321
|
}
|
|
1293
1322
|
function parseDevinMessages(nodes) {
|
|
1294
1323
|
const messages = /* @__PURE__ */ new Map();
|