@vectorize-io/hindsight-coding-agents 0.8.2 → 0.8.4
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 +13 -3
- package/dist/antigravity-hook.js +95 -42
- package/dist/antigravity-statusline.js +6 -6
- package/dist/antigravity-stop-hook.js +132 -51
- package/dist/claude-hook.js +95 -42
- package/dist/claude-sessionstart-hook.js +385 -100
- package/dist/claude-stop-hook.js +132 -51
- package/dist/cline.js +403 -92
- package/dist/codebuddy-hook.js +95 -42
- package/dist/codebuddy-sessionstart-hook.js +385 -100
- package/dist/codebuddy-stop-hook.js +132 -51
- package/dist/codex-hook.js +95 -42
- package/dist/codex-sessionstart-hook.js +385 -100
- package/dist/codex-stop-hook.js +132 -51
- package/dist/copilot-hook.js +95 -42
- package/dist/copilot-sessionstart-hook.js +385 -100
- package/dist/copilot-stop-hook.js +132 -51
- package/dist/cursor-hook.js +95 -42
- package/dist/cursor-sessionstart-hook.js +385 -100
- package/dist/cursor-stop-hook.js +132 -51
- package/dist/daemon-start.js +10 -10
- package/dist/dcode-hook.js +95 -42
- package/dist/dcode-sessionstart-hook.js +385 -100
- package/dist/dcode-stop-hook.js +132 -51
- package/dist/deepen.js +82 -23
- package/dist/devin-hook.js +95 -42
- package/dist/devin-sessionstart-hook.js +385 -100
- package/dist/devin-stop-hook.js +132 -51
- package/dist/droid-hook.js +95 -42
- package/dist/droid-sessionstart-hook.js +385 -100
- package/dist/droid-stop-hook.js +132 -51
- package/dist/dsh.js +422 -99
- package/dist/grok-hook.js +95 -42
- package/dist/grok-sessionstart-hook.js +385 -100
- package/dist/grok-stop-hook.js +132 -51
- package/dist/hindsight-seed.js +6 -6
- package/dist/index.js +427 -111
- package/dist/installer.js +89 -80
- package/dist/kilo.js +427 -111
- package/dist/kimi-hook.js +95 -42
- package/dist/kimi-sessionstart-hook.js +385 -100
- package/dist/kimi-stop-hook.js +132 -51
- package/dist/mcp-server.js +169 -62
- package/dist/opencode2.js +583 -105
- package/dist/pi.js +403 -99
- package/dist/prime-agent.js +403 -99
- package/dist/qwen-hook.js +95 -42
- package/dist/qwen-sessionstart-hook.js +385 -100
- package/dist/qwen-stop-hook.js +132 -51
- package/dist/status.js +67 -17
- package/dist/survey-supervisor.js +73 -9
- package/dist/traecode-hook.js +95 -42
- package/dist/traecode-sessionstart-hook.js +385 -100
- package/dist/traecode-stop-hook.js +132 -51
- package/dist/workbuddy-hook.js +95 -42
- package/dist/workbuddy-sessionstart-hook.js +385 -100
- package/dist/workbuddy-stop-hook.js +132 -51
- package/dist/zcode-hook.js +95 -42
- package/dist/zcode-sessionstart-hook.js +385 -100
- package/dist/zcode-stop-hook.js +132 -51
- package/index.js +4 -1
- package/package.json +7 -4
- package/plugin.json +1 -1
- package/skill/SKILL.md +10 -2
package/dist/installer.js
CHANGED
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
existsSync as existsSync13,
|
|
9
9
|
mkdirSync as mkdirSync7,
|
|
10
10
|
mkdtempSync as mkdtempSync2,
|
|
11
|
-
readFileSync as
|
|
11
|
+
readFileSync as readFileSync16,
|
|
12
12
|
readSync as readSync4,
|
|
13
13
|
realpathSync as realpathSync3,
|
|
14
14
|
rmSync as rmSync4,
|
|
15
|
-
writeFileSync as
|
|
15
|
+
writeFileSync as writeFileSync6
|
|
16
16
|
} from "fs";
|
|
17
17
|
import { homedir as homedir13, tmpdir as tmpdir5 } from "os";
|
|
18
18
|
import { isatty } from "tty";
|
|
@@ -2217,11 +2217,11 @@ var PAGE_TAXONOMY = [
|
|
|
2217
2217
|
var PAGE_NAMES = PAGE_TAXONOMY.map((page) => page.name);
|
|
2218
2218
|
|
|
2219
2219
|
// package.json
|
|
2220
|
-
var version = "0.8.
|
|
2220
|
+
var version = "0.8.4";
|
|
2221
2221
|
|
|
2222
2222
|
// src/core/util.ts
|
|
2223
|
-
import { accessSync, constants } from "fs";
|
|
2224
|
-
import { delimiter, join as join6 } from "path";
|
|
2223
|
+
import { accessSync, constants, statSync as statSync2 } from "fs";
|
|
2224
|
+
import { delimiter, extname, isAbsolute as isAbsolute2, join as join6, resolve as resolve2 } from "path";
|
|
2225
2225
|
function isOurMcpEntry(entry) {
|
|
2226
2226
|
if (!entry || typeof entry !== "object") return false;
|
|
2227
2227
|
const candidate = entry;
|
|
@@ -2261,7 +2261,7 @@ import { tmpdir } from "os";
|
|
|
2261
2261
|
import { dirname as dirname5, join as join8 } from "path";
|
|
2262
2262
|
|
|
2263
2263
|
// src/core/turn-journal.ts
|
|
2264
|
-
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync5, statSync as
|
|
2264
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync5, statSync as statSync3 } from "fs";
|
|
2265
2265
|
import { tmpdir as tmpdir2 } from "os";
|
|
2266
2266
|
import { dirname as dirname6, join as join9 } from "path";
|
|
2267
2267
|
|
|
@@ -2546,7 +2546,7 @@ function formatUsageReport(usage, path = usageFilePath()) {
|
|
|
2546
2546
|
|
|
2547
2547
|
// src/core/git.ts
|
|
2548
2548
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
2549
|
-
import { resolve as
|
|
2549
|
+
import { resolve as resolve3 } from "path";
|
|
2550
2550
|
var US = "";
|
|
2551
2551
|
var RS = "";
|
|
2552
2552
|
var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
|
|
@@ -2557,7 +2557,7 @@ import { execFileSync as execFileSync4 } from "child_process";
|
|
|
2557
2557
|
// src/core/survey.ts
|
|
2558
2558
|
import { execFileSync as execFileSync3, spawn as realSpawn4 } from "child_process";
|
|
2559
2559
|
import { createHash as createHash4 } from "crypto";
|
|
2560
|
-
import { existsSync as existsSync3 } from "fs";
|
|
2560
|
+
import { existsSync as existsSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync3 } from "fs";
|
|
2561
2561
|
import { homedir as homedir4, tmpdir as tmpdir3 } from "os";
|
|
2562
2562
|
import { dirname as dirname8, join as join13 } from "path";
|
|
2563
2563
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -2572,7 +2572,7 @@ import {
|
|
|
2572
2572
|
renameSync as renameSync3,
|
|
2573
2573
|
rmdirSync,
|
|
2574
2574
|
rmSync as rmSync2,
|
|
2575
|
-
statSync as
|
|
2575
|
+
statSync as statSync4,
|
|
2576
2576
|
unlinkSync,
|
|
2577
2577
|
utimesSync,
|
|
2578
2578
|
writeFileSync as writeFileSync2
|
|
@@ -2584,10 +2584,10 @@ import { spawn as realSpawn5 } from "child_process";
|
|
|
2584
2584
|
import {
|
|
2585
2585
|
existsSync as existsSync4,
|
|
2586
2586
|
mkdirSync as mkdirSync5,
|
|
2587
|
-
readFileSync as
|
|
2587
|
+
readFileSync as readFileSync8,
|
|
2588
2588
|
realpathSync as realpathSync2,
|
|
2589
2589
|
unlinkSync as unlinkSync2,
|
|
2590
|
-
writeFileSync as
|
|
2590
|
+
writeFileSync as writeFileSync4
|
|
2591
2591
|
} from "fs";
|
|
2592
2592
|
import { homedir as homedir5, tmpdir as tmpdir4 } from "os";
|
|
2593
2593
|
import { dirname as dirname9, join as join14 } from "path";
|
|
@@ -2598,7 +2598,7 @@ var NPM_VIEW_HARD_DEADLINE_MS = NPM_VIEW_TIMEOUT_MS + 1e3;
|
|
|
2598
2598
|
var LOCK_STALE_MS = 10 * 60 * 1e3;
|
|
2599
2599
|
|
|
2600
2600
|
// src/core/skill-sync.ts
|
|
2601
|
-
import { cpSync, existsSync as existsSync6, readFileSync as
|
|
2601
|
+
import { cpSync, existsSync as existsSync6, readFileSync as readFileSync9 } from "fs";
|
|
2602
2602
|
import { homedir as homedir6 } from "os";
|
|
2603
2603
|
import { dirname as dirname10, join as join16 } from "path";
|
|
2604
2604
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
@@ -2657,9 +2657,9 @@ var resolveSkillDirs = (harness, home) => {
|
|
|
2657
2657
|
};
|
|
2658
2658
|
|
|
2659
2659
|
// src/core/legacy.ts
|
|
2660
|
-
import { existsSync as existsSync7, readFileSync as
|
|
2660
|
+
import { existsSync as existsSync7, readFileSync as readFileSync10 } from "fs";
|
|
2661
2661
|
import { homedir as homedir7 } from "os";
|
|
2662
|
-
import { join as join17, relative, isAbsolute as
|
|
2662
|
+
import { join as join17, relative, isAbsolute as isAbsolute3 } from "path";
|
|
2663
2663
|
var LEGACY_CONFIG_FILES = {
|
|
2664
2664
|
"claude-code": "claude-code.json",
|
|
2665
2665
|
codex: "codex.json"
|
|
@@ -2683,7 +2683,7 @@ function readOne(harness, home) {
|
|
|
2683
2683
|
if (!existsSync7(source)) return void 0;
|
|
2684
2684
|
let raw;
|
|
2685
2685
|
try {
|
|
2686
|
-
raw = JSON.parse(
|
|
2686
|
+
raw = JSON.parse(readFileSync10(source, "utf8"));
|
|
2687
2687
|
} catch {
|
|
2688
2688
|
return void 0;
|
|
2689
2689
|
}
|
|
@@ -2711,9 +2711,9 @@ function readOne(harness, home) {
|
|
|
2711
2711
|
|
|
2712
2712
|
// src/core/traecode-mcp.ts
|
|
2713
2713
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
2714
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as
|
|
2714
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync11, readdirSync as readdirSync2, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
2715
2715
|
import { homedir as homedir8 } from "os";
|
|
2716
|
-
import { dirname as dirname11, isAbsolute as
|
|
2716
|
+
import { dirname as dirname11, isAbsolute as isAbsolute4, join as join18 } from "path";
|
|
2717
2717
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
2718
2718
|
var MCP_SERVER_NAME = "hindsight";
|
|
2719
2719
|
var MCP_FILE_REL = join18(".trae", "mcp.json");
|
|
@@ -2748,7 +2748,7 @@ function gateStateFile() {
|
|
|
2748
2748
|
}
|
|
2749
2749
|
function readGateState(opts = {}) {
|
|
2750
2750
|
try {
|
|
2751
|
-
return JSON.parse(
|
|
2751
|
+
return JSON.parse(readFileSync11(opts.stateFile ?? gateStateFile(), "utf8"));
|
|
2752
2752
|
} catch {
|
|
2753
2753
|
return {};
|
|
2754
2754
|
}
|
|
@@ -2756,7 +2756,7 @@ function readGateState(opts = {}) {
|
|
|
2756
2756
|
function workspaceMcpGateState(settingsPath) {
|
|
2757
2757
|
let raw;
|
|
2758
2758
|
try {
|
|
2759
|
-
raw =
|
|
2759
|
+
raw = readFileSync11(settingsPath, "utf8");
|
|
2760
2760
|
} catch {
|
|
2761
2761
|
return "unknown";
|
|
2762
2762
|
}
|
|
@@ -2772,13 +2772,13 @@ function enableWorkspaceMcpSetting(settingsPath) {
|
|
|
2772
2772
|
try {
|
|
2773
2773
|
let doc = {};
|
|
2774
2774
|
try {
|
|
2775
|
-
doc = JSON.parse(
|
|
2775
|
+
doc = JSON.parse(readFileSync11(settingsPath, "utf8"));
|
|
2776
2776
|
} catch {
|
|
2777
2777
|
if (existsSync8(settingsPath)) return false;
|
|
2778
2778
|
}
|
|
2779
2779
|
doc[WORKSPACE_MCP_KEY] = true;
|
|
2780
2780
|
mkdirSync6(dirname11(settingsPath), { recursive: true });
|
|
2781
|
-
|
|
2781
|
+
writeFileSync5(settingsPath, JSON.stringify(doc, null, 2) + "\n");
|
|
2782
2782
|
return true;
|
|
2783
2783
|
} catch {
|
|
2784
2784
|
return false;
|
|
@@ -2786,7 +2786,7 @@ function enableWorkspaceMcpSetting(settingsPath) {
|
|
|
2786
2786
|
}
|
|
2787
2787
|
function markWorkspaceMcpEnabled(opts = {}) {
|
|
2788
2788
|
try {
|
|
2789
|
-
|
|
2789
|
+
writeFileSync5(
|
|
2790
2790
|
opts.stateFile ?? gateStateFile(),
|
|
2791
2791
|
JSON.stringify({ ...readGateState(opts), workspaceMcpEnabled: true }, null, 2) + "\n"
|
|
2792
2792
|
);
|
|
@@ -2803,7 +2803,7 @@ function workspaceMcpHint(opts = {}) {
|
|
|
2803
2803
|
if (typeof state.lastHint === "number" && now - state.lastHint < HINT_MIN_INTERVAL_MS) {
|
|
2804
2804
|
return void 0;
|
|
2805
2805
|
}
|
|
2806
|
-
|
|
2806
|
+
writeFileSync5(
|
|
2807
2807
|
opts.stateFile ?? gateStateFile(),
|
|
2808
2808
|
JSON.stringify({ ...state, lastHint: now }, null, 2) + "\n"
|
|
2809
2809
|
);
|
|
@@ -2821,10 +2821,10 @@ function gitignoreCovers(lines) {
|
|
|
2821
2821
|
function ensureGitignored(repo) {
|
|
2822
2822
|
const gitignore = join18(repo, ".gitignore");
|
|
2823
2823
|
if (!existsSync8(gitignore)) return;
|
|
2824
|
-
const current2 =
|
|
2824
|
+
const current2 = readFileSync11(gitignore, "utf8");
|
|
2825
2825
|
if (gitignoreCovers(current2.split("\n"))) return;
|
|
2826
2826
|
const addition = (current2.endsWith("\n") || current2 === "" ? "" : "\n") + "# hindsight MCP registration (machine-specific)\n.trae/mcp.json\n";
|
|
2827
|
-
|
|
2827
|
+
writeFileSync5(gitignore, current2 + addition);
|
|
2828
2828
|
}
|
|
2829
2829
|
function ensureTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
2830
2830
|
registerTraecodeWorkspaceMcp(cwd, opts);
|
|
@@ -2834,7 +2834,7 @@ function ensureTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
|
2834
2834
|
function registerTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
2835
2835
|
try {
|
|
2836
2836
|
const home = opts.home ?? homedir8();
|
|
2837
|
-
if (!cwd || !
|
|
2837
|
+
if (!cwd || !isAbsolute4(cwd) || dirname11(cwd) === cwd || cwd === home) return "skipped";
|
|
2838
2838
|
const dist = opts.dist ?? bundledDistDir();
|
|
2839
2839
|
const script = join18(dist, "mcp-server.js");
|
|
2840
2840
|
if (!existsSync8(script)) return "skipped";
|
|
@@ -2842,7 +2842,7 @@ function registerTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
|
2842
2842
|
let doc = {};
|
|
2843
2843
|
let exists = false;
|
|
2844
2844
|
try {
|
|
2845
|
-
doc = JSON.parse(
|
|
2845
|
+
doc = JSON.parse(readFileSync11(file, "utf8"));
|
|
2846
2846
|
exists = true;
|
|
2847
2847
|
} catch {
|
|
2848
2848
|
if (existsSync8(file)) return "skipped";
|
|
@@ -2872,7 +2872,7 @@ function registerTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
|
2872
2872
|
if (existing !== void 0 && canon(merged) === canon(existing)) return "current";
|
|
2873
2873
|
servers[MCP_SERVER_NAME] = merged;
|
|
2874
2874
|
mkdirSync6(dirname11(file), { recursive: true });
|
|
2875
|
-
|
|
2875
|
+
writeFileSync5(file, JSON.stringify(doc, null, 2) + "\n");
|
|
2876
2876
|
if (!exists) ensureGitignored(cwd);
|
|
2877
2877
|
diag("traecode", "workspace_mcp_registered", { cwd, file });
|
|
2878
2878
|
return "registered";
|
|
@@ -2887,11 +2887,11 @@ function registerTraecodeWorkspaceMcp(cwd, opts = {}) {
|
|
|
2887
2887
|
function removeTraecodeWorkspaceMcpEntry(cwd, opts = {}) {
|
|
2888
2888
|
try {
|
|
2889
2889
|
const home = opts.home ?? homedir8();
|
|
2890
|
-
if (!cwd || !
|
|
2890
|
+
if (!cwd || !isAbsolute4(cwd) || dirname11(cwd) === cwd || cwd === home) return false;
|
|
2891
2891
|
const file = join18(cwd, MCP_FILE_REL);
|
|
2892
2892
|
let doc;
|
|
2893
2893
|
try {
|
|
2894
|
-
doc = JSON.parse(
|
|
2894
|
+
doc = JSON.parse(readFileSync11(file, "utf8"));
|
|
2895
2895
|
} catch {
|
|
2896
2896
|
return false;
|
|
2897
2897
|
}
|
|
@@ -2902,7 +2902,7 @@ function removeTraecodeWorkspaceMcpEntry(cwd, opts = {}) {
|
|
|
2902
2902
|
delete record[MCP_SERVER_NAME];
|
|
2903
2903
|
if (Object.keys(record).length === 0) delete doc.mcpServers;
|
|
2904
2904
|
if (Object.keys(doc).length === 0) rmSync3(file);
|
|
2905
|
-
else
|
|
2905
|
+
else writeFileSync5(file, JSON.stringify(doc, null, 2) + "\n");
|
|
2906
2906
|
return true;
|
|
2907
2907
|
} catch {
|
|
2908
2908
|
return false;
|
|
@@ -2951,7 +2951,7 @@ function findWorkspaceStorageDir(storage, repo) {
|
|
|
2951
2951
|
}
|
|
2952
2952
|
for (const name of entries) {
|
|
2953
2953
|
try {
|
|
2954
|
-
const doc = JSON.parse(
|
|
2954
|
+
const doc = JSON.parse(readFileSync11(join18(storage, name, "workspace.json"), "utf8"));
|
|
2955
2955
|
if (typeof doc.folder !== "string") continue;
|
|
2956
2956
|
let folder;
|
|
2957
2957
|
try {
|
|
@@ -2969,7 +2969,7 @@ function findWorkspaceStorageDir(storage, repo) {
|
|
|
2969
2969
|
function ensureWorkspaceMcpEnabled(cwd, opts = {}) {
|
|
2970
2970
|
try {
|
|
2971
2971
|
const home = opts.home ?? homedir8();
|
|
2972
|
-
if (!cwd || !
|
|
2972
|
+
if (!cwd || !isAbsolute4(cwd) || dirname11(cwd) === cwd || cwd === home) return "failed";
|
|
2973
2973
|
const dir = findWorkspaceStorageDir(traecodeWorkspaceStorageDir(home), cwd);
|
|
2974
2974
|
if (!dir) return "failed";
|
|
2975
2975
|
const db = join18(dir, "state.vscdb");
|
|
@@ -3004,7 +3004,7 @@ function workspaceEnableHint(opts = {}) {
|
|
|
3004
3004
|
if (typeof state.lastEnableHint === "number" && now - state.lastEnableHint < HINT_MIN_INTERVAL_MS) {
|
|
3005
3005
|
return void 0;
|
|
3006
3006
|
}
|
|
3007
|
-
|
|
3007
|
+
writeFileSync5(
|
|
3008
3008
|
opts.stateFile ?? gateStateFile(),
|
|
3009
3009
|
JSON.stringify({ ...state, lastEnableHint: now }, null, 2) + "\n"
|
|
3010
3010
|
);
|
|
@@ -3186,6 +3186,10 @@ function readCursorTranscript(path) {
|
|
|
3186
3186
|
}
|
|
3187
3187
|
|
|
3188
3188
|
// src/core/transcript-antigravity.ts
|
|
3189
|
+
function unwrapUserRequest(text) {
|
|
3190
|
+
const request = /<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/.exec(text);
|
|
3191
|
+
return request ? request[1] : text.replace(/<ADDITIONAL_METADATA>[\s\S]*?<\/ADDITIONAL_METADATA>/g, "");
|
|
3192
|
+
}
|
|
3189
3193
|
function readAntigravityTranscript(path) {
|
|
3190
3194
|
if (!path) return [];
|
|
3191
3195
|
const turns = [];
|
|
@@ -3195,7 +3199,8 @@ function readAntigravityTranscript(path) {
|
|
|
3195
3199
|
const role = event.role ?? event.message?.role ?? event.type;
|
|
3196
3200
|
const normalizedRole = role === "user" || role === "USER_INPUT" ? "user" : role === "assistant" || role === "model" || role === "PLANNER_RESPONSE" ? "assistant" : void 0;
|
|
3197
3201
|
const content = event.content ?? event.text ?? event.message?.content ?? event.message?.text;
|
|
3198
|
-
const
|
|
3202
|
+
const text = typeof content === "string" ? stripInjectedMemory(content) : "";
|
|
3203
|
+
const clean = (normalizedRole === "user" ? unwrapUserRequest(text) : text).trim();
|
|
3199
3204
|
if (normalizedRole && clean) {
|
|
3200
3205
|
turns.push({
|
|
3201
3206
|
role: normalizedRole,
|
|
@@ -3226,7 +3231,7 @@ function readCopilotTranscript(path) {
|
|
|
3226
3231
|
}
|
|
3227
3232
|
|
|
3228
3233
|
// src/core/transcript-grok.ts
|
|
3229
|
-
import { existsSync as existsSync9, readFileSync as
|
|
3234
|
+
import { existsSync as existsSync9, readFileSync as readFileSync12, readdirSync as readdirSync3 } from "fs";
|
|
3230
3235
|
import { homedir as homedir9 } from "os";
|
|
3231
3236
|
import { join as join19 } from "path";
|
|
3232
3237
|
var CHAT_HISTORY = "chat_history.jsonl";
|
|
@@ -3237,7 +3242,7 @@ function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME ||
|
|
|
3237
3242
|
try {
|
|
3238
3243
|
for (const candidate of readdirSync3(sessionsDir)) {
|
|
3239
3244
|
const directory = join19(sessionsDir, candidate);
|
|
3240
|
-
if (
|
|
3245
|
+
if (readFileSync12(join19(directory, ".cwd"), "utf8").trim() === cwd) {
|
|
3241
3246
|
return join19(directory, sessionId, CHAT_HISTORY);
|
|
3242
3247
|
}
|
|
3243
3248
|
}
|
|
@@ -3588,7 +3593,7 @@ function readDroidTranscript(path) {
|
|
|
3588
3593
|
}
|
|
3589
3594
|
|
|
3590
3595
|
// src/core/transcript-zcode.ts
|
|
3591
|
-
import { readFileSync as
|
|
3596
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
3592
3597
|
function messageText(content) {
|
|
3593
3598
|
if (typeof content === "string") return content.trim();
|
|
3594
3599
|
if (!Array.isArray(content)) return "";
|
|
@@ -3598,7 +3603,7 @@ function readZcodeTranscript(path) {
|
|
|
3598
3603
|
if (!path) return [];
|
|
3599
3604
|
let body;
|
|
3600
3605
|
try {
|
|
3601
|
-
body =
|
|
3606
|
+
body = readFileSync13(path, "utf8");
|
|
3602
3607
|
} catch {
|
|
3603
3608
|
return [];
|
|
3604
3609
|
}
|
|
@@ -3819,12 +3824,12 @@ function readWorkbuddyTranscript(path) {
|
|
|
3819
3824
|
}
|
|
3820
3825
|
|
|
3821
3826
|
// src/core/transcript-codebuddy-ide.ts
|
|
3822
|
-
import { readFileSync as
|
|
3827
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
3823
3828
|
import { basename as basename3, dirname as dirname12, join as join22 } from "path";
|
|
3824
3829
|
var IDE_CONTEXT_RE = /<(user_info|git_status|additional_data|system_reminder)\b[\s\S]*?<\/\1>/g;
|
|
3825
3830
|
function readJson(path) {
|
|
3826
3831
|
try {
|
|
3827
|
-
return JSON.parse(
|
|
3832
|
+
return JSON.parse(readFileSync14(path, "utf8"));
|
|
3828
3833
|
} catch {
|
|
3829
3834
|
return void 0;
|
|
3830
3835
|
}
|
|
@@ -4038,7 +4043,9 @@ var HOOK_HARNESSES = {
|
|
|
4038
4043
|
parse: (ev) => ({
|
|
4039
4044
|
sessionId: ev.session_id,
|
|
4040
4045
|
transcriptPath: ev.transcript_path,
|
|
4041
|
-
cwd: ev.cwd
|
|
4046
|
+
cwd: ev.cwd,
|
|
4047
|
+
// The transcript may not hold the final reply yet when Stop fires after a tool call (#5790).
|
|
4048
|
+
lastAssistantMessage: ev.last_assistant_message
|
|
4042
4049
|
})
|
|
4043
4050
|
}
|
|
4044
4051
|
},
|
|
@@ -4525,9 +4532,9 @@ import {
|
|
|
4525
4532
|
existsSync as existsSync12,
|
|
4526
4533
|
openSync as openSync2,
|
|
4527
4534
|
readdirSync as readdirSync5,
|
|
4528
|
-
readFileSync as
|
|
4535
|
+
readFileSync as readFileSync15,
|
|
4529
4536
|
readSync as readSync2,
|
|
4530
|
-
statSync as
|
|
4537
|
+
statSync as statSync5
|
|
4531
4538
|
} from "fs";
|
|
4532
4539
|
import { createHash as createHash5 } from "crypto";
|
|
4533
4540
|
import { homedir as homedir12 } from "os";
|
|
@@ -4691,7 +4698,7 @@ function withinRepo(dir, repoDir) {
|
|
|
4691
4698
|
}
|
|
4692
4699
|
function claudeSessionCwd(file) {
|
|
4693
4700
|
try {
|
|
4694
|
-
for (const line of
|
|
4701
|
+
for (const line of readFileSync15(file, "utf8").split("\n", 400)) {
|
|
4695
4702
|
if (!line.includes('"cwd"')) continue;
|
|
4696
4703
|
const cwd = JSON.parse(line).cwd;
|
|
4697
4704
|
if (cwd) return cwd;
|
|
@@ -4765,7 +4772,7 @@ function codexHistory(repoDir, home) {
|
|
|
4765
4772
|
const walk = (dir) => {
|
|
4766
4773
|
for (const entry of readdirSync5(dir)) {
|
|
4767
4774
|
const p = join23(dir, entry);
|
|
4768
|
-
if (
|
|
4775
|
+
if (statSync5(p).isDirectory()) walk(p);
|
|
4769
4776
|
else if (entry.endsWith(".jsonl")) files.push(p);
|
|
4770
4777
|
}
|
|
4771
4778
|
};
|
|
@@ -4886,7 +4893,7 @@ function dshHistory(repoDir, home) {
|
|
|
4886
4893
|
return { supported: true, sessions, unattributed };
|
|
4887
4894
|
}
|
|
4888
4895
|
function readDshLog(file) {
|
|
4889
|
-
const bytes =
|
|
4896
|
+
const bytes = readFileSync15(file);
|
|
4890
4897
|
const text = file.endsWith(".zstd") ? zstdDecompressFrames(bytes) : bytes.toString("utf8");
|
|
4891
4898
|
return text.split("\n").filter((line) => line.trim());
|
|
4892
4899
|
}
|
|
@@ -5181,7 +5188,7 @@ function isPlainObject(value) {
|
|
|
5181
5188
|
}
|
|
5182
5189
|
function readJson2(path) {
|
|
5183
5190
|
try {
|
|
5184
|
-
const parsed = JSON.parse(
|
|
5191
|
+
const parsed = JSON.parse(readFileSync16(path, "utf8"));
|
|
5185
5192
|
return isPlainObject(parsed) ? parsed : {};
|
|
5186
5193
|
} catch {
|
|
5187
5194
|
return {};
|
|
@@ -5199,7 +5206,7 @@ function parseJsonc(text) {
|
|
|
5199
5206
|
function writeJson(path, value) {
|
|
5200
5207
|
mkdirSync7(dirname13(path), { recursive: true });
|
|
5201
5208
|
backupOnce(path);
|
|
5202
|
-
|
|
5209
|
+
writeFileSync6(path, JSON.stringify(value, null, 2) + "\n");
|
|
5203
5210
|
}
|
|
5204
5211
|
function backupOnce(path) {
|
|
5205
5212
|
if (existsSync13(path) && !existsSync13(`${path}.hindsight-backup`)) {
|
|
@@ -5207,7 +5214,7 @@ function backupOnce(path) {
|
|
|
5207
5214
|
}
|
|
5208
5215
|
}
|
|
5209
5216
|
function writeJsonc(path, key, value) {
|
|
5210
|
-
const text = existsSync13(path) ?
|
|
5217
|
+
const text = existsSync13(path) ? readFileSync16(path, "utf8") : "";
|
|
5211
5218
|
const edits = modify(text, [key], value, {
|
|
5212
5219
|
formattingOptions: {
|
|
5213
5220
|
tabSize: 2,
|
|
@@ -5220,7 +5227,7 @@ function writeJsonc(path, key, value) {
|
|
|
5220
5227
|
const next = applyEdits(text, edits);
|
|
5221
5228
|
mkdirSync7(dirname13(path), { recursive: true });
|
|
5222
5229
|
backupOnce(path);
|
|
5223
|
-
|
|
5230
|
+
writeFileSync6(path, next.endsWith("\n") ? next : `${next}
|
|
5224
5231
|
`);
|
|
5225
5232
|
}
|
|
5226
5233
|
function mergeHookEvent(existing, entry) {
|
|
@@ -5237,6 +5244,7 @@ function setOrDelete(obj, key, arr) {
|
|
|
5237
5244
|
var cmdHook = (dist, file, timeout) => ({
|
|
5238
5245
|
hooks: [{ type: "command", command: `node "${join24(dist, file)}"`, timeout }]
|
|
5239
5246
|
});
|
|
5247
|
+
var nodeCommand = (script) => script.includes(" ") ? `node "${script}"` : `node ${script}`;
|
|
5240
5248
|
var processHook = (dist, file, timeoutMs) => ({
|
|
5241
5249
|
hooks: [{ type: "process", command: "node", args: [join24(dist, file)], timeoutMs }]
|
|
5242
5250
|
});
|
|
@@ -5254,7 +5262,7 @@ function mergeHarnessHooks(hooks, harness, dist) {
|
|
|
5254
5262
|
if (installedEvents.has(hook.event)) continue;
|
|
5255
5263
|
installedEvents.add(hook.event);
|
|
5256
5264
|
const entry = spec.configStyle === "nested" ? cmdHook(dist, hook.entry, hook.timeout) : spec.configStyle === "process" ? processHook(dist, hook.entry, hook.timeout) : {
|
|
5257
|
-
command:
|
|
5265
|
+
command: nodeCommand(join24(dist, hook.entry)),
|
|
5258
5266
|
...hook.timeout ? { timeout: hook.timeout } : {}
|
|
5259
5267
|
};
|
|
5260
5268
|
hooks[hook.event] = mergeHookEvent(hooks[hook.event], entry);
|
|
@@ -5323,7 +5331,7 @@ function registerOpencodePlugin(c, name) {
|
|
|
5323
5331
|
const path = opencodeConfigPath(c);
|
|
5324
5332
|
let cfg = {};
|
|
5325
5333
|
if (existsSync13(path)) {
|
|
5326
|
-
const parsed = parseJsonc(
|
|
5334
|
+
const parsed = parseJsonc(readFileSync16(path, "utf8"));
|
|
5327
5335
|
if (!parsed) {
|
|
5328
5336
|
c.log?.(`${name}: SKIPPED \u2014 could not parse ${path}; add the plugin entry manually`);
|
|
5329
5337
|
return;
|
|
@@ -5337,7 +5345,7 @@ function registerOpencodePlugin(c, name) {
|
|
|
5337
5345
|
function unregisterOpencodePlugin(c, name) {
|
|
5338
5346
|
const path = opencodeConfigPath(c);
|
|
5339
5347
|
if (!existsSync13(path)) return;
|
|
5340
|
-
const cfg = parseJsonc(
|
|
5348
|
+
const cfg = parseJsonc(readFileSync16(path, "utf8"));
|
|
5341
5349
|
if (!cfg || !Array.isArray(cfg.plugin)) return;
|
|
5342
5350
|
const kept = cfg.plugin.filter((p) => !String(p).includes(MARKER));
|
|
5343
5351
|
writeJsonc(path, "plugin", kept.length ? kept : void 0);
|
|
@@ -5401,7 +5409,7 @@ var kilo = {
|
|
|
5401
5409
|
const path = kiloConfigPath(c);
|
|
5402
5410
|
let cfg = {};
|
|
5403
5411
|
if (existsSync13(path)) {
|
|
5404
|
-
const parsed = parseJsonc(
|
|
5412
|
+
const parsed = parseJsonc(readFileSync16(path, "utf8"));
|
|
5405
5413
|
if (!parsed) {
|
|
5406
5414
|
c.log?.(`kilo: SKIPPED \u2014 could not parse ${path}; add the plugin entry manually`);
|
|
5407
5415
|
return;
|
|
@@ -5416,7 +5424,7 @@ var kilo = {
|
|
|
5416
5424
|
uninstall(c) {
|
|
5417
5425
|
const path = kiloConfigPath(c);
|
|
5418
5426
|
if (!existsSync13(path)) return;
|
|
5419
|
-
const cfg = parseJsonc(
|
|
5427
|
+
const cfg = parseJsonc(readFileSync16(path, "utf8"));
|
|
5420
5428
|
if (!cfg || !Array.isArray(cfg.plugin)) return;
|
|
5421
5429
|
const kept = cfg.plugin.filter((p) => !String(p).includes(MARKER));
|
|
5422
5430
|
writeJsonc(path, "plugin", kept.length ? kept : void 0);
|
|
@@ -5496,7 +5504,7 @@ var codex = {
|
|
|
5496
5504
|
writeJson(hooksPath, cfg);
|
|
5497
5505
|
c.log?.(`codex: hooks merged into ${hooksPath}`);
|
|
5498
5506
|
const tomlPath = join24(c.home, ".codex", "config.toml");
|
|
5499
|
-
const existing = existsSync13(tomlPath) ?
|
|
5507
|
+
const existing = existsSync13(tomlPath) ? readFileSync16(tomlPath, "utf8") : "";
|
|
5500
5508
|
const toml = existing.replace(CODEX_MCP_BLOCK_RE, "");
|
|
5501
5509
|
const additions = [];
|
|
5502
5510
|
if (!/^\s*(codex_hooks|hooks)\s*=/m.test(toml)) {
|
|
@@ -5516,7 +5524,7 @@ var codex = {
|
|
|
5516
5524
|
copyFileSync(tomlPath, `${tomlPath}.hindsight-backup`);
|
|
5517
5525
|
}
|
|
5518
5526
|
mkdirSync7(dirname13(tomlPath), { recursive: true });
|
|
5519
|
-
|
|
5527
|
+
writeFileSync6(tomlPath, next);
|
|
5520
5528
|
c.log?.(`codex: wrote ${additions.length} section(s) to ${tomlPath}`);
|
|
5521
5529
|
}
|
|
5522
5530
|
installSkill(c, "codex");
|
|
@@ -5533,9 +5541,9 @@ var codex = {
|
|
|
5533
5541
|
uninstallSkill(c, "codex");
|
|
5534
5542
|
const tomlPath = join24(c.home, ".codex", "config.toml");
|
|
5535
5543
|
if (existsSync13(tomlPath)) {
|
|
5536
|
-
const toml =
|
|
5544
|
+
const toml = readFileSync16(tomlPath, "utf8");
|
|
5537
5545
|
const cleaned = toml.replace(CODEX_MCP_BLOCK_RE, "");
|
|
5538
|
-
if (cleaned !== toml)
|
|
5546
|
+
if (cleaned !== toml) writeFileSync6(tomlPath, cleaned);
|
|
5539
5547
|
}
|
|
5540
5548
|
c.log?.(
|
|
5541
5549
|
"codex: hooks + MCP section + skill removed ([features] hooks flag left as-is \u2014 other hooks may use it)"
|
|
@@ -5572,14 +5580,14 @@ var antigravity = {
|
|
|
5572
5580
|
if (!settings.statusLine) {
|
|
5573
5581
|
settings.statusLine = {
|
|
5574
5582
|
type: "command",
|
|
5575
|
-
command:
|
|
5583
|
+
command: nodeCommand(join24(c.dist, "antigravity-statusline.js"))
|
|
5576
5584
|
};
|
|
5577
5585
|
writeJson(settingsPath, settings);
|
|
5578
5586
|
c.log?.(`antigravity-cli: Hindsight status line enabled in ${settingsPath}`);
|
|
5579
5587
|
} else if (JSON.stringify(settings.statusLine).includes(MARKER)) {
|
|
5580
5588
|
settings.statusLine = {
|
|
5581
5589
|
type: "command",
|
|
5582
|
-
command:
|
|
5590
|
+
command: nodeCommand(join24(c.dist, "antigravity-statusline.js"))
|
|
5583
5591
|
};
|
|
5584
5592
|
writeJson(settingsPath, settings);
|
|
5585
5593
|
} else {
|
|
@@ -5665,7 +5673,7 @@ function stageRuntime(c) {
|
|
|
5665
5673
|
const source = join24(c.pkgRoot, resource);
|
|
5666
5674
|
if (existsSync13(source)) cpSync2(source, join24(target, resource), { recursive: true });
|
|
5667
5675
|
}
|
|
5668
|
-
|
|
5676
|
+
writeFileSync6(
|
|
5669
5677
|
join24(target, ORIGIN_FILE),
|
|
5670
5678
|
JSON.stringify({ source: c.pkgRoot, stagedAt: (/* @__PURE__ */ new Date()).toISOString() })
|
|
5671
5679
|
);
|
|
@@ -6028,7 +6036,7 @@ var grok = {
|
|
|
6028
6036
|
detect: (c) => onPath2("grok") || existsSync13(join24(c.home, ".grok")),
|
|
6029
6037
|
install(c) {
|
|
6030
6038
|
const path = join24(c.home, ".grok", "config.toml");
|
|
6031
|
-
const existing = existsSync13(path) ?
|
|
6039
|
+
const existing = existsSync13(path) ? readFileSync16(path, "utf8") : "";
|
|
6032
6040
|
const stripped = existing.replace(GROK_BLOCK_RE, "\n");
|
|
6033
6041
|
const withoutOurs = hasUnmarkedGrokEntries(stripped) ? stripUnmarkedGrokEntries(stripped) : stripped;
|
|
6034
6042
|
const tomlString = (value) => JSON.stringify(value);
|
|
@@ -6050,7 +6058,7 @@ ${GROK_MARKER_END}
|
|
|
6050
6058
|
if (existsSync13(path) && !existsSync13(`${path}.hindsight-backup`))
|
|
6051
6059
|
copyFileSync(path, `${path}.hindsight-backup`);
|
|
6052
6060
|
mkdirSync7(dirname13(path), { recursive: true });
|
|
6053
|
-
|
|
6061
|
+
writeFileSync6(path, next);
|
|
6054
6062
|
const hooksPath = grokHooksPath(c);
|
|
6055
6063
|
const file = readJson2(hooksPath);
|
|
6056
6064
|
const hooks = isPlainObject(file.hooks) ? file.hooks : {};
|
|
@@ -6062,11 +6070,11 @@ ${GROK_MARKER_END}
|
|
|
6062
6070
|
uninstall(c) {
|
|
6063
6071
|
const path = join24(c.home, ".grok", "config.toml");
|
|
6064
6072
|
if (existsSync13(path)) {
|
|
6065
|
-
const existing =
|
|
6073
|
+
const existing = readFileSync16(path, "utf8");
|
|
6066
6074
|
const stripped = existing.replace(GROK_BLOCK_RE, "\n");
|
|
6067
6075
|
const cleaned = hasUnmarkedGrokEntries(stripped) ? stripUnmarkedGrokEntries(stripped) : stripped;
|
|
6068
6076
|
const safe = parseGrokToml(cleaned) !== null || parseGrokToml(existing) === null;
|
|
6069
|
-
if (cleaned !== existing && safe)
|
|
6077
|
+
if (cleaned !== existing && safe) writeFileSync6(path, cleaned);
|
|
6070
6078
|
}
|
|
6071
6079
|
const hooksPath = grokHooksPath(c);
|
|
6072
6080
|
if (existsSync13(hooksPath)) {
|
|
@@ -6093,7 +6101,7 @@ var kimi = {
|
|
|
6093
6101
|
detect: (c) => onPath2("kimi") || existsSync13(kimiHome(c)),
|
|
6094
6102
|
install(c) {
|
|
6095
6103
|
const path = join24(kimiHome(c), "config.toml");
|
|
6096
|
-
const existing = existsSync13(path) ?
|
|
6104
|
+
const existing = existsSync13(path) ? readFileSync16(path, "utf8") : "";
|
|
6097
6105
|
const withoutOurs = existing.replace(KIMI_BLOCK_RE, "\n");
|
|
6098
6106
|
const spec = HOOK_HARNESSES["kimi-code"];
|
|
6099
6107
|
const entries = Object.values(spec.install).map(
|
|
@@ -6110,7 +6118,7 @@ ${entries}${KIMI_MARKER_END}
|
|
|
6110
6118
|
if (existsSync13(path) && !existsSync13(`${path}.hindsight-backup`))
|
|
6111
6119
|
copyFileSync(path, `${path}.hindsight-backup`);
|
|
6112
6120
|
mkdirSync7(dirname13(path), { recursive: true });
|
|
6113
|
-
|
|
6121
|
+
writeFileSync6(path, `${withoutOurs.replace(/\n*$/, "\n")}${block}`);
|
|
6114
6122
|
const mcpPath = join24(kimiHome(c), "mcp.json");
|
|
6115
6123
|
const mcp = readJson2(mcpPath);
|
|
6116
6124
|
mcp.mcpServers = { ...mcp.mcpServers ?? {}, hindsight: mcpServerEntry(c.dist, "kimi-code") };
|
|
@@ -6121,9 +6129,9 @@ ${entries}${KIMI_MARKER_END}
|
|
|
6121
6129
|
uninstall(c) {
|
|
6122
6130
|
const path = join24(kimiHome(c), "config.toml");
|
|
6123
6131
|
if (existsSync13(path)) {
|
|
6124
|
-
const existing =
|
|
6132
|
+
const existing = readFileSync16(path, "utf8");
|
|
6125
6133
|
const cleaned = existing.replace(KIMI_BLOCK_RE, "\n");
|
|
6126
|
-
if (cleaned !== existing)
|
|
6134
|
+
if (cleaned !== existing) writeFileSync6(path, cleaned);
|
|
6127
6135
|
}
|
|
6128
6136
|
const mcpPath = join24(kimiHome(c), "mcp.json");
|
|
6129
6137
|
if (existsSync13(mcpPath)) {
|
|
@@ -6144,7 +6152,7 @@ function removeLegacyClineHooks(c) {
|
|
|
6144
6152
|
const hooksDir = join24(c.home, "Documents", "Cline", "Hooks");
|
|
6145
6153
|
for (const event of CLINE_OLD_HOOK_EVENTS) {
|
|
6146
6154
|
const path = join24(hooksDir, event);
|
|
6147
|
-
if (existsSync13(path) &&
|
|
6155
|
+
if (existsSync13(path) && readFileSync16(path, "utf8").includes(CLINE_HOOK_MARKER)) {
|
|
6148
6156
|
rmSync4(path, { force: true });
|
|
6149
6157
|
}
|
|
6150
6158
|
}
|
|
@@ -6199,7 +6207,7 @@ function prepareDcodeMarketplace(c) {
|
|
|
6199
6207
|
let marketplace = { plugins: [] };
|
|
6200
6208
|
if (existsSync13(conventionalPath)) {
|
|
6201
6209
|
try {
|
|
6202
|
-
const parsed = JSON.parse(
|
|
6210
|
+
const parsed = JSON.parse(readFileSync16(conventionalPath, "utf8"));
|
|
6203
6211
|
if (!parsed || typeof parsed !== "object" || !Array.isArray(parsed.plugins)) {
|
|
6204
6212
|
path = join24(root, DCODE_FALLBACK_MARKETPLACE);
|
|
6205
6213
|
} else if (typeof parsed.name === "string" && parsed.name !== DCODE_MARKETPLACE) {
|
|
@@ -6213,7 +6221,7 @@ function prepareDcodeMarketplace(c) {
|
|
|
6213
6221
|
}
|
|
6214
6222
|
if (path !== conventionalPath && existsSync13(path)) {
|
|
6215
6223
|
try {
|
|
6216
|
-
const parsed = JSON.parse(
|
|
6224
|
+
const parsed = JSON.parse(readFileSync16(path, "utf8"));
|
|
6217
6225
|
if (!parsed || typeof parsed !== "object" || !Array.isArray(parsed.plugins) || parsed.name !== DCODE_MARKETPLACE) {
|
|
6218
6226
|
c.log?.(`dcode: refusing to replace malformed marketplace file ${path}`);
|
|
6219
6227
|
return false;
|
|
@@ -6290,7 +6298,7 @@ var dsh = {
|
|
|
6290
6298
|
detect: (c) => onPath2("dsh") || existsSync13(dshHome(c)),
|
|
6291
6299
|
install(c) {
|
|
6292
6300
|
const path = join24(dshHome(c), "cordis.patch.yml");
|
|
6293
|
-
const existing = existsSync13(path) ?
|
|
6301
|
+
const existing = existsSync13(path) ? readFileSync16(path, "utf8") : "";
|
|
6294
6302
|
const others = dshUserPatches(existing);
|
|
6295
6303
|
const entry = pathToFileURL(join24(c.dist, "dsh.js")).href;
|
|
6296
6304
|
const block = `${DSH_MARKER_START}
|
|
@@ -6302,7 +6310,7 @@ ${DSH_MARKER_END}
|
|
|
6302
6310
|
if (existsSync13(path) && !existsSync13(`${path}.hindsight-backup`))
|
|
6303
6311
|
copyFileSync(path, `${path}.hindsight-backup`);
|
|
6304
6312
|
mkdirSync7(dirname13(path), { recursive: true });
|
|
6305
|
-
|
|
6313
|
+
writeFileSync6(path, others ? `${others}
|
|
6306
6314
|
|
|
6307
6315
|
${block}` : block);
|
|
6308
6316
|
installSkill(c, "dsh");
|
|
@@ -6313,10 +6321,10 @@ ${block}` : block);
|
|
|
6313
6321
|
uninstall(c) {
|
|
6314
6322
|
const path = join24(dshHome(c), "cordis.patch.yml");
|
|
6315
6323
|
if (existsSync13(path)) {
|
|
6316
|
-
const existing =
|
|
6324
|
+
const existing = readFileSync16(path, "utf8");
|
|
6317
6325
|
const others = existing.replace(DSH_BLOCK_RE, "\n").trim();
|
|
6318
6326
|
if (others !== existing.trim())
|
|
6319
|
-
|
|
6327
|
+
writeFileSync6(path, others ? `${others}
|
|
6320
6328
|
` : `${DSH_EMPTY_LIST}
|
|
6321
6329
|
`);
|
|
6322
6330
|
}
|
|
@@ -6721,7 +6729,7 @@ function importConversations(harness, ctx) {
|
|
|
6721
6729
|
}
|
|
6722
6730
|
const turns = found.sessions.reduce((n, s) => n + s.turns.length, 0);
|
|
6723
6731
|
const file = join24(mkdtempSync2(join24(tmpdir5(), "hindsight-import-")), "conversations.json");
|
|
6724
|
-
|
|
6732
|
+
writeFileSync6(file, JSON.stringify(found.sessions));
|
|
6725
6733
|
ctx.log?.(
|
|
6726
6734
|
`${harness}: importing ${found.sessions.length} past sessions (${turns} turns) from ${repo} \u2014 this runs extraction and may take a while`
|
|
6727
6735
|
);
|
|
@@ -6840,7 +6848,7 @@ if (isMain || mainPath?.endsWith("installer.js")) {
|
|
|
6840
6848
|
const pkgRoot = dirname13(dist);
|
|
6841
6849
|
let version2;
|
|
6842
6850
|
try {
|
|
6843
|
-
version2 = JSON.parse(
|
|
6851
|
+
version2 = JSON.parse(readFileSync16(join24(pkgRoot, "package.json"), "utf8")).version;
|
|
6844
6852
|
} catch {
|
|
6845
6853
|
version2 = void 0;
|
|
6846
6854
|
}
|
|
@@ -6877,6 +6885,7 @@ export {
|
|
|
6877
6885
|
ORIGIN_FILE,
|
|
6878
6886
|
flagValue,
|
|
6879
6887
|
flagValueArgs,
|
|
6888
|
+
nodeCommand,
|
|
6880
6889
|
parseJsonc,
|
|
6881
6890
|
run,
|
|
6882
6891
|
runtimeDir
|