@vectorize-io/hindsight-coding-agents 0.5.3 → 0.5.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/dist/antigravity-hook.js +67 -33
- package/dist/antigravity-stop-hook.js +61 -31
- package/dist/claude-hook.js +67 -33
- package/dist/claude-sessionstart-hook.js +239 -71
- package/dist/claude-stop-hook.js +61 -31
- package/dist/cline.js +213 -50
- package/dist/codex-hook.js +67 -33
- package/dist/codex-sessionstart-hook.js +239 -71
- package/dist/codex-stop-hook.js +61 -31
- package/dist/copilot-hook.js +67 -33
- package/dist/copilot-sessionstart-hook.js +239 -71
- package/dist/copilot-stop-hook.js +61 -31
- package/dist/cursor-hook.js +67 -33
- package/dist/cursor-sessionstart-hook.js +239 -71
- package/dist/cursor-stop-hook.js +61 -31
- package/dist/dcode-hook.js +67 -33
- package/dist/dcode-sessionstart-hook.js +239 -71
- package/dist/dcode-stop-hook.js +61 -31
- package/dist/deepen.js +40 -13
- package/dist/devin-hook.js +67 -33
- package/dist/devin-sessionstart-hook.js +239 -71
- package/dist/devin-stop-hook.js +61 -31
- package/dist/droid-hook.js +67 -33
- package/dist/droid-sessionstart-hook.js +239 -71
- package/dist/droid-stop-hook.js +61 -31
- package/dist/dsh.js +215 -52
- package/dist/grok-hook.js +67 -33
- package/dist/grok-sessionstart-hook.js +239 -71
- package/dist/grok-stop-hook.js +61 -31
- package/dist/index.js +215 -52
- package/dist/installer.js +1030 -268
- package/dist/kilo.js +215 -52
- package/dist/mcp-server.js +33 -6
- package/dist/opencode2.js +215 -52
- package/dist/pi.js +214 -51
- package/dist/prime-agent.js +214 -51
- package/dist/qwen-hook.js +67 -33
- package/dist/qwen-sessionstart-hook.js +239 -71
- package/dist/qwen-stop-hook.js +61 -31
- package/dist/status.js +31 -4
- package/dist/survey-supervisor.js +81 -0
- package/dist/zcode-hook.js +67 -33
- package/dist/zcode-sessionstart-hook.js +239 -71
- package/dist/zcode-stop-hook.js +61 -31
- package/package.json +2 -1
- package/plugin.json +1 -1
package/dist/codex-hook.js
CHANGED
|
@@ -946,9 +946,16 @@ var HindsightClient = class {
|
|
|
946
946
|
body: JSON.stringify({ query, budget: opts.budget ?? "high" }),
|
|
947
947
|
signal: ctrl.signal
|
|
948
948
|
});
|
|
949
|
-
if (!resp.ok)
|
|
949
|
+
if (!resp.ok)
|
|
950
|
+
throw new Error(
|
|
951
|
+
`reflect ${resp.status} ${(await resp.text()).slice(0, 1e3)}${this.authHint(resp.status)}`
|
|
952
|
+
);
|
|
950
953
|
const data = await resp.json();
|
|
951
954
|
return (data.text || "").trim();
|
|
955
|
+
} catch (e) {
|
|
956
|
+
if (ctrl.signal.aborted)
|
|
957
|
+
throw new Error(`reflect timed out after ${opts.timeoutMs}ms`, { cause: e });
|
|
958
|
+
throw e;
|
|
952
959
|
} finally {
|
|
953
960
|
clearTimeout(timer);
|
|
954
961
|
}
|
|
@@ -1702,13 +1709,14 @@ async function buildHookOutput(args) {
|
|
|
1702
1709
|
} else if (cfg.autoReflect && reflectAnswer === void 0) {
|
|
1703
1710
|
reflectRanThisTurn = true;
|
|
1704
1711
|
const t0 = Date.now();
|
|
1712
|
+
const timeoutMs = Math.min(cfg.reflectTimeoutMs, HOOK_REFLECT_CAP_MS);
|
|
1705
1713
|
try {
|
|
1706
1714
|
reflectAnswer = await client.reflect(buildReflectQuery(prompt), {
|
|
1707
1715
|
// Automatic reflection runs inside a hard 25s hook window. Hindsight's low budget is the
|
|
1708
1716
|
// supported default for bounded reflect calls; callers that explicitly invoke the MCP
|
|
1709
1717
|
// tool still get the deeper high-budget path.
|
|
1710
1718
|
budget: "low",
|
|
1711
|
-
timeoutMs
|
|
1719
|
+
timeoutMs
|
|
1712
1720
|
});
|
|
1713
1721
|
diag(harness, reflectAnswer ? "reflect_ok" : "reflect_empty", {
|
|
1714
1722
|
ms: Date.now() - t0,
|
|
@@ -1726,7 +1734,10 @@ async function buildHookOutput(args) {
|
|
|
1726
1734
|
});
|
|
1727
1735
|
diag(harness, "reflect_failed", {
|
|
1728
1736
|
ms: Date.now() - t0,
|
|
1729
|
-
|
|
1737
|
+
bank: client.bank,
|
|
1738
|
+
timeoutMs,
|
|
1739
|
+
// Wider than describeError's default: the server's error body is the useful part.
|
|
1740
|
+
error: describeError(e, 1500),
|
|
1730
1741
|
query: prompt.slice(0, 80)
|
|
1731
1742
|
});
|
|
1732
1743
|
}
|
|
@@ -1905,7 +1916,7 @@ function* streamLines(path, start) {
|
|
|
1905
1916
|
}
|
|
1906
1917
|
|
|
1907
1918
|
// src/core/session-start.ts
|
|
1908
|
-
import { readFileSync as
|
|
1919
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
1909
1920
|
|
|
1910
1921
|
// src/core/git.ts
|
|
1911
1922
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -1915,24 +1926,42 @@ import { resolve as resolve2 } from "path";
|
|
|
1915
1926
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
1916
1927
|
|
|
1917
1928
|
// src/core/survey.ts
|
|
1918
|
-
import { spawn as
|
|
1929
|
+
import { spawn as realSpawn4 } from "child_process";
|
|
1930
|
+
import { createHash as createHash4 } from "crypto";
|
|
1919
1931
|
import { existsSync as existsSync3 } from "fs";
|
|
1920
|
-
import { homedir as homedir3 } from "os";
|
|
1921
|
-
import { dirname as dirname8, join as
|
|
1932
|
+
import { homedir as homedir3, tmpdir as tmpdir4 } from "os";
|
|
1933
|
+
import { dirname as dirname8, join as join11 } from "path";
|
|
1922
1934
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
1923
1935
|
|
|
1936
|
+
// src/core/survey-lease.ts
|
|
1937
|
+
import { spawn as realSpawn3 } from "child_process";
|
|
1938
|
+
import { randomUUID } from "crypto";
|
|
1939
|
+
import {
|
|
1940
|
+
mkdirSync as mkdirSync4,
|
|
1941
|
+
mkdtempSync,
|
|
1942
|
+
readdirSync,
|
|
1943
|
+
renameSync as renameSync2,
|
|
1944
|
+
rmdirSync,
|
|
1945
|
+
rmSync as rmSync2,
|
|
1946
|
+
statSync as statSync3,
|
|
1947
|
+
unlinkSync,
|
|
1948
|
+
utimesSync,
|
|
1949
|
+
writeFileSync as writeFileSync2
|
|
1950
|
+
} from "fs";
|
|
1951
|
+
import { join as join10 } from "path";
|
|
1952
|
+
|
|
1924
1953
|
// src/core/auto-update.ts
|
|
1925
|
-
import { spawn as
|
|
1954
|
+
import { spawn as realSpawn5 } from "child_process";
|
|
1926
1955
|
import {
|
|
1927
1956
|
existsSync as existsSync4,
|
|
1928
|
-
mkdirSync as
|
|
1957
|
+
mkdirSync as mkdirSync5,
|
|
1929
1958
|
readFileSync as readFileSync7,
|
|
1930
1959
|
realpathSync as realpathSync2,
|
|
1931
|
-
unlinkSync,
|
|
1932
|
-
writeFileSync as
|
|
1960
|
+
unlinkSync as unlinkSync2,
|
|
1961
|
+
writeFileSync as writeFileSync3
|
|
1933
1962
|
} from "fs";
|
|
1934
|
-
import { homedir as homedir4, tmpdir as
|
|
1935
|
-
import { dirname as dirname9, join as
|
|
1963
|
+
import { homedir as homedir4, tmpdir as tmpdir5 } from "os";
|
|
1964
|
+
import { dirname as dirname9, join as join12 } from "path";
|
|
1936
1965
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
1937
1966
|
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
1938
1967
|
var LOCK_STALE_MS = 10 * 60 * 1e3;
|
|
@@ -1940,9 +1969,14 @@ var LOCK_STALE_MS = 10 * 60 * 1e3;
|
|
|
1940
1969
|
// src/core/skill-sync.ts
|
|
1941
1970
|
import { cpSync, existsSync as existsSync5, readFileSync as readFileSync8 } from "fs";
|
|
1942
1971
|
import { homedir as homedir5 } from "os";
|
|
1943
|
-
import { dirname as dirname10, join as
|
|
1972
|
+
import { dirname as dirname10, join as join13 } from "path";
|
|
1944
1973
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
1945
1974
|
|
|
1975
|
+
// src/core/legacy.ts
|
|
1976
|
+
import { existsSync as existsSync6, readFileSync as readFileSync9 } from "fs";
|
|
1977
|
+
import { homedir as homedir6 } from "os";
|
|
1978
|
+
import { join as join14, relative, isAbsolute as isAbsolute2 } from "path";
|
|
1979
|
+
|
|
1946
1980
|
// src/core/transcript-codex.ts
|
|
1947
1981
|
function isSyntheticUserText(text) {
|
|
1948
1982
|
const s = text.trimStart();
|
|
@@ -2073,19 +2107,19 @@ function readCopilotTranscript(path) {
|
|
|
2073
2107
|
}
|
|
2074
2108
|
|
|
2075
2109
|
// src/core/transcript-grok.ts
|
|
2076
|
-
import { existsSync as
|
|
2077
|
-
import { homedir as
|
|
2078
|
-
import { join as
|
|
2110
|
+
import { existsSync as existsSync7, readFileSync as readFileSync11, readdirSync as readdirSync2 } from "fs";
|
|
2111
|
+
import { homedir as homedir7 } from "os";
|
|
2112
|
+
import { join as join15 } from "path";
|
|
2079
2113
|
var CHAT_HISTORY = "chat_history.jsonl";
|
|
2080
|
-
function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME ||
|
|
2081
|
-
const sessionsDir =
|
|
2082
|
-
const direct =
|
|
2083
|
-
if (
|
|
2114
|
+
function grokTranscriptPath(cwd, sessionId, grokHome = process.env.GROK_HOME || join15(homedir7(), ".grok")) {
|
|
2115
|
+
const sessionsDir = join15(grokHome, "sessions");
|
|
2116
|
+
const direct = join15(sessionsDir, encodeURIComponent(cwd), sessionId, CHAT_HISTORY);
|
|
2117
|
+
if (existsSync7(direct)) return direct;
|
|
2084
2118
|
try {
|
|
2085
|
-
for (const candidate of
|
|
2086
|
-
const directory =
|
|
2087
|
-
if (
|
|
2088
|
-
return
|
|
2119
|
+
for (const candidate of readdirSync2(sessionsDir)) {
|
|
2120
|
+
const directory = join15(sessionsDir, candidate);
|
|
2121
|
+
if (readFileSync11(join15(directory, ".cwd"), "utf8").trim() === cwd) {
|
|
2122
|
+
return join15(directory, sessionId, CHAT_HISTORY);
|
|
2089
2123
|
}
|
|
2090
2124
|
}
|
|
2091
2125
|
} catch {
|
|
@@ -2120,12 +2154,12 @@ function readGrokTranscript(path) {
|
|
|
2120
2154
|
}
|
|
2121
2155
|
|
|
2122
2156
|
// src/core/transcript-devin.ts
|
|
2123
|
-
import { existsSync as
|
|
2157
|
+
import { existsSync as existsSync8 } from "fs";
|
|
2124
2158
|
import { createRequire } from "module";
|
|
2125
|
-
import { homedir as
|
|
2126
|
-
import { join as
|
|
2127
|
-
function devinSessionDb(home =
|
|
2128
|
-
return
|
|
2159
|
+
import { homedir as homedir8 } from "os";
|
|
2160
|
+
import { join as join16 } from "path";
|
|
2161
|
+
function devinSessionDb(home = homedir8()) {
|
|
2162
|
+
return join16(home, ".local", "share", "devin", "cli", "sessions.db");
|
|
2129
2163
|
}
|
|
2130
2164
|
function parseDevinMessages(nodes) {
|
|
2131
2165
|
const messages = /* @__PURE__ */ new Map();
|
|
@@ -2162,7 +2196,7 @@ function readDevinTranscript(sessionId, dbPath = devinSessionDb()) {
|
|
|
2162
2196
|
diag("devin-cli", "sqlite_unavailable", { node: process.version, dbPath });
|
|
2163
2197
|
return [];
|
|
2164
2198
|
}
|
|
2165
|
-
if (!
|
|
2199
|
+
if (!existsSync8(dbPath)) {
|
|
2166
2200
|
diag("devin-cli", "session_db_missing", { dbPath });
|
|
2167
2201
|
return [];
|
|
2168
2202
|
}
|
|
@@ -2435,7 +2469,7 @@ function readDroidTranscript(path) {
|
|
|
2435
2469
|
}
|
|
2436
2470
|
|
|
2437
2471
|
// src/core/transcript-zcode.ts
|
|
2438
|
-
import { readFileSync as
|
|
2472
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
2439
2473
|
function messageText2(content) {
|
|
2440
2474
|
if (typeof content === "string") return content.trim();
|
|
2441
2475
|
if (!Array.isArray(content)) return "";
|
|
@@ -2445,7 +2479,7 @@ function readZcodeTranscript(path) {
|
|
|
2445
2479
|
if (!path) return [];
|
|
2446
2480
|
let body;
|
|
2447
2481
|
try {
|
|
2448
|
-
body =
|
|
2482
|
+
body = readFileSync12(path, "utf8");
|
|
2449
2483
|
} catch {
|
|
2450
2484
|
return [];
|
|
2451
2485
|
}
|