@vectorize-io/hindsight-coding-agents 0.3.4 → 0.4.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 +101 -32
- package/dist/antigravity-hook.js +424 -263
- package/dist/antigravity-statusline.js +130 -27
- package/dist/antigravity-stop-hook.js +431 -265
- package/dist/claude-hook.js +424 -263
- package/dist/claude-sessionstart-hook.js +436 -269
- package/dist/claude-stop-hook.js +431 -265
- package/dist/cline.js +627 -329
- package/dist/codex-hook.js +424 -263
- package/dist/codex-sessionstart-hook.js +436 -269
- package/dist/codex-stop-hook.js +431 -265
- package/dist/copilot-hook.js +424 -263
- package/dist/copilot-sessionstart-hook.js +436 -269
- package/dist/copilot-stop-hook.js +431 -265
- package/dist/cursor-hook.js +424 -263
- package/dist/cursor-sessionstart-hook.js +436 -269
- package/dist/cursor-stop-hook.js +431 -265
- package/dist/daemon-start.js +101 -45
- package/dist/deepen.js +289 -130
- package/dist/devin-hook.js +424 -263
- package/dist/devin-sessionstart-hook.js +436 -269
- package/dist/devin-stop-hook.js +431 -265
- package/dist/dsh.js +870 -573
- package/dist/grok-hook.js +424 -263
- package/dist/grok-sessionstart-hook.js +436 -269
- package/dist/grok-stop-hook.js +431 -265
- package/dist/hindsight-seed.js +122 -24
- package/dist/index.js +665 -366
- package/dist/installer.js +40 -48
- package/dist/kilo.js +665 -366
- package/dist/mcp-server.js +525 -299
- package/dist/prime-agent.js +881 -581
- package/dist/status.js +419 -244
- package/package.json +10 -2
- package/skill/SKILL.md +20 -4
package/dist/installer.js
CHANGED
|
@@ -31,30 +31,23 @@ import { basename, dirname, join, normalize, sep } from "path";
|
|
|
31
31
|
// src/core/config.ts
|
|
32
32
|
import { readFileSync } from "fs";
|
|
33
33
|
import { homedir as homedir2 } from "os";
|
|
34
|
-
import { join as
|
|
34
|
+
import { join as join4 } from "path";
|
|
35
35
|
|
|
36
36
|
// src/core/seed.ts
|
|
37
37
|
import { spawn as realSpawn } from "child_process";
|
|
38
38
|
import { dirname as dirname2, join as join2 } from "path";
|
|
39
39
|
import { fileURLToPath } from "url";
|
|
40
40
|
|
|
41
|
-
// src/core/config.ts
|
|
42
|
-
var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join3(homedir2(), ".hindsight", "coding-agent.json");
|
|
43
|
-
var DEFAULT_DAEMON_PORT = 9077;
|
|
44
|
-
|
|
45
|
-
// src/core/diag.ts
|
|
46
|
-
import { appendFileSync as appendFileSync2 } from "fs";
|
|
47
|
-
|
|
48
41
|
// src/core/log.ts
|
|
49
42
|
import { appendFileSync, mkdirSync } from "fs";
|
|
50
43
|
import { tmpdir } from "os";
|
|
51
|
-
import { dirname as dirname3, join as
|
|
44
|
+
import { dirname as dirname3, join as join3 } from "path";
|
|
52
45
|
var WEIGHT = { debug: 10, info: 20, warn: 30, error: 40 };
|
|
53
46
|
var current = ["debug", "info", "warn", "error"].find(
|
|
54
47
|
(l) => l === process.env.HINDSIGHT_LOG_LEVEL
|
|
55
48
|
) ?? "info";
|
|
56
49
|
function logFilePath() {
|
|
57
|
-
return process.env.HINDSIGHT_LOG_FILE ||
|
|
50
|
+
return process.env.HINDSIGHT_LOG_FILE || join3(tmpdir(), "hindsight-coding-agent", "plugin.log");
|
|
58
51
|
}
|
|
59
52
|
function write(level, scope, msg, extra) {
|
|
60
53
|
if (WEIGHT[level] < WEIGHT[current]) return;
|
|
@@ -75,7 +68,16 @@ var log = {
|
|
|
75
68
|
error: (scope, msg, extra) => write("error", scope, msg, extra)
|
|
76
69
|
};
|
|
77
70
|
|
|
71
|
+
// src/core/hindsight.ts
|
|
72
|
+
var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
|
|
73
|
+
var RETRY_AFTER_CEILING_MS = 60 * 1e3;
|
|
74
|
+
|
|
75
|
+
// src/core/config.ts
|
|
76
|
+
var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join4(homedir2(), ".hindsight", "coding-agent.json");
|
|
77
|
+
var DEFAULT_DAEMON_PORT = 9077;
|
|
78
|
+
|
|
78
79
|
// src/core/diag.ts
|
|
80
|
+
import { appendFileSync as appendFileSync2 } from "fs";
|
|
79
81
|
function diagFilePath() {
|
|
80
82
|
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
81
83
|
}
|
|
@@ -90,10 +92,6 @@ function diag(harness, event, extra = {}) {
|
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
// src/core/hindsight.ts
|
|
94
|
-
var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
|
|
95
|
-
var RETRY_AFTER_CEILING_MS = 60 * 1e3;
|
|
96
|
-
|
|
97
95
|
// src/core/brand.ts
|
|
98
96
|
function brandWord() {
|
|
99
97
|
const start = [0, 116, 217];
|
|
@@ -1446,6 +1444,11 @@ function setOrDelete(obj, key, arr) {
|
|
|
1446
1444
|
var cmdHook = (dist, file, timeout) => ({
|
|
1447
1445
|
hooks: [{ type: "command", command: `node "${join13(dist, file)}"`, timeout }]
|
|
1448
1446
|
});
|
|
1447
|
+
var mcpServerEntry = (dist, harness) => ({
|
|
1448
|
+
command: "node",
|
|
1449
|
+
args: [join13(dist, "mcp-server.js")],
|
|
1450
|
+
env: { HINDSIGHT_MCP_HARNESS: harness }
|
|
1451
|
+
});
|
|
1449
1452
|
function mergeHarnessHooks(hooks, harness, dist) {
|
|
1450
1453
|
const spec = HOOK_HARNESSES[harness];
|
|
1451
1454
|
const installedEvents = /* @__PURE__ */ new Set();
|
|
@@ -1597,6 +1600,8 @@ var claudeCode = {
|
|
|
1597
1600
|
"--scope",
|
|
1598
1601
|
"user",
|
|
1599
1602
|
"hindsight",
|
|
1603
|
+
"--env",
|
|
1604
|
+
"HINDSIGHT_MCP_HARNESS=claude-code",
|
|
1600
1605
|
"--",
|
|
1601
1606
|
"node",
|
|
1602
1607
|
join13(c.dist, "mcp-server.js")
|
|
@@ -1605,7 +1610,7 @@ var claudeCode = {
|
|
|
1605
1610
|
} else {
|
|
1606
1611
|
c.log?.(
|
|
1607
1612
|
`claude-code: could not run \`claude mcp add\` \u2014 register the tools manually:
|
|
1608
|
-
claude mcp add --scope user hindsight -- node "${join13(c.dist, "mcp-server.js")}"`
|
|
1613
|
+
claude mcp add --scope user hindsight --env HINDSIGHT_MCP_HARNESS=claude-code -- node "${join13(c.dist, "mcp-server.js")}"`
|
|
1609
1614
|
);
|
|
1610
1615
|
}
|
|
1611
1616
|
},
|
|
@@ -1633,6 +1638,11 @@ function defaultClaudeMcp(args) {
|
|
|
1633
1638
|
return false;
|
|
1634
1639
|
}
|
|
1635
1640
|
}
|
|
1641
|
+
var CODEX_MCP_BLOCK_RE = /^\[mcp_servers\.hindsight(?:\.[^\]]+)?\][^\n]*\n(?:(?!\[)[^\n]*\n?)*/gm;
|
|
1642
|
+
var codexMcpBlock = (dist) => `[mcp_servers.hindsight]
|
|
1643
|
+
command = "node"
|
|
1644
|
+
args = [${JSON.stringify(join13(dist, "mcp-server.js"))}]
|
|
1645
|
+
env = { HINDSIGHT_MCP_HARNESS = "codex" }`;
|
|
1636
1646
|
var codex = {
|
|
1637
1647
|
name: "codex",
|
|
1638
1648
|
detect: (c) => onPath2("codex") || existsSync9(join13(c.home, ".codex")),
|
|
@@ -1644,7 +1654,8 @@ var codex = {
|
|
|
1644
1654
|
writeJson(hooksPath, cfg);
|
|
1645
1655
|
c.log?.(`codex: hooks merged into ${hooksPath}`);
|
|
1646
1656
|
const tomlPath = join13(c.home, ".codex", "config.toml");
|
|
1647
|
-
|
|
1657
|
+
const existing = existsSync9(tomlPath) ? readFileSync10(tomlPath, "utf8") : "";
|
|
1658
|
+
const toml = existing.replace(CODEX_MCP_BLOCK_RE, "");
|
|
1648
1659
|
const additions = [];
|
|
1649
1660
|
if (!/^\s*(codex_hooks|hooks)\s*=/m.test(toml)) {
|
|
1650
1661
|
if (/^\[features\]/m.test(toml)) {
|
|
@@ -1655,21 +1666,16 @@ var codex = {
|
|
|
1655
1666
|
additions.push("[features]\nhooks = true");
|
|
1656
1667
|
}
|
|
1657
1668
|
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
args = ["${join13(c.dist, "mcp-server.js")}"]`
|
|
1663
|
-
);
|
|
1664
|
-
}
|
|
1665
|
-
if (additions.length) {
|
|
1669
|
+
additions.push(codexMcpBlock(c.dist));
|
|
1670
|
+
const next = `${toml.replace(/\n*$/, "\n\n")}${additions.join("\n\n")}
|
|
1671
|
+
`;
|
|
1672
|
+
if (next !== existing) {
|
|
1666
1673
|
if (existsSync9(tomlPath) && !existsSync9(`${tomlPath}.hindsight-backup`)) {
|
|
1667
1674
|
copyFileSync(tomlPath, `${tomlPath}.hindsight-backup`);
|
|
1668
1675
|
}
|
|
1669
1676
|
mkdirSync3(dirname8(tomlPath), { recursive: true });
|
|
1670
|
-
writeFileSync2(tomlPath,
|
|
1671
|
-
`);
|
|
1672
|
-
c.log?.(`codex: appended ${additions.length} section(s) to ${tomlPath}`);
|
|
1677
|
+
writeFileSync2(tomlPath, next);
|
|
1678
|
+
c.log?.(`codex: wrote ${additions.length} section(s) to ${tomlPath}`);
|
|
1673
1679
|
}
|
|
1674
1680
|
installSkill(c, "codex", join13(c.home, ".agents", "skills"));
|
|
1675
1681
|
},
|
|
@@ -1686,10 +1692,7 @@ args = ["${join13(c.dist, "mcp-server.js")}"]`
|
|
|
1686
1692
|
const tomlPath = join13(c.home, ".codex", "config.toml");
|
|
1687
1693
|
if (existsSync9(tomlPath)) {
|
|
1688
1694
|
const toml = readFileSync10(tomlPath, "utf8");
|
|
1689
|
-
const cleaned = toml.replace(
|
|
1690
|
-
/\n?\[mcp_servers\.hindsight\]\ncommand = "node"\nargs = \[[^\]]*\]\n?/g,
|
|
1691
|
-
"\n"
|
|
1692
|
-
);
|
|
1695
|
+
const cleaned = toml.replace(CODEX_MCP_BLOCK_RE, "");
|
|
1693
1696
|
if (cleaned !== toml) writeFileSync2(tomlPath, cleaned);
|
|
1694
1697
|
}
|
|
1695
1698
|
c.log?.(
|
|
@@ -1719,11 +1722,7 @@ var antigravity = {
|
|
|
1719
1722
|
const mcp = readJson(mcpPath);
|
|
1720
1723
|
mcp.mcpServers = {
|
|
1721
1724
|
...mcp.mcpServers ?? {},
|
|
1722
|
-
hindsight:
|
|
1723
|
-
command: "node",
|
|
1724
|
-
args: [join13(c.dist, "mcp-server.js")],
|
|
1725
|
-
env: { HINDSIGHT_MCP_HARNESS: "antigravity-cli" }
|
|
1726
|
-
}
|
|
1725
|
+
hindsight: mcpServerEntry(c.dist, "antigravity-cli")
|
|
1727
1726
|
};
|
|
1728
1727
|
writeJson(mcpPath, mcp);
|
|
1729
1728
|
const settingsPath = join13(c.home, ".gemini", "antigravity-cli", "settings.json");
|
|
@@ -2016,11 +2015,7 @@ var devin = {
|
|
|
2016
2015
|
const mcp = readJson(mcpPath);
|
|
2017
2016
|
mcp.mcpServers = {
|
|
2018
2017
|
...mcp.mcpServers ?? {},
|
|
2019
|
-
hindsight:
|
|
2020
|
-
command: "node",
|
|
2021
|
-
args: [join13(c.dist, "mcp-server.js")],
|
|
2022
|
-
env: { HINDSIGHT_MCP_HARNESS: "devin-cli" }
|
|
2023
|
-
}
|
|
2018
|
+
hindsight: mcpServerEntry(c.dist, "devin-cli")
|
|
2024
2019
|
};
|
|
2025
2020
|
writeJson(mcpPath, mcp);
|
|
2026
2021
|
c.log?.(`devin-cli: hooks merged into ${configPath}, MCP into ${mcpPath}`);
|
|
@@ -2059,7 +2054,7 @@ var cursor = {
|
|
|
2059
2054
|
const mcp = readJson(mcpPath);
|
|
2060
2055
|
mcp.mcpServers = {
|
|
2061
2056
|
...mcp.mcpServers ?? {},
|
|
2062
|
-
hindsight:
|
|
2057
|
+
hindsight: mcpServerEntry(c.dist, "cursor-cli")
|
|
2063
2058
|
};
|
|
2064
2059
|
writeJson(mcpPath, mcp);
|
|
2065
2060
|
c.log?.(`cursor-cli: hooks merged into ${hooksPath}, MCP into ${mcpPath}`);
|
|
@@ -2099,7 +2094,7 @@ var copilot = {
|
|
|
2099
2094
|
const mcp = readJson(mcpPath);
|
|
2100
2095
|
mcp.mcpServers = {
|
|
2101
2096
|
...mcp.mcpServers ?? {},
|
|
2102
|
-
hindsight:
|
|
2097
|
+
hindsight: mcpServerEntry(c.dist, "copilot-cli")
|
|
2103
2098
|
};
|
|
2104
2099
|
writeJson(mcpPath, mcp);
|
|
2105
2100
|
installSkill(c, "copilot-cli", join13(c.home, ".copilot", "skills"));
|
|
@@ -2156,6 +2151,7 @@ ${GROK_MARKER_START}
|
|
|
2156
2151
|
[mcp_servers.hindsight]
|
|
2157
2152
|
command = "node"
|
|
2158
2153
|
args = [${tomlString(join13(c.dist, "mcp-server.js"))}]
|
|
2154
|
+
env = { HINDSIGHT_MCP_HARNESS = "grok-build" }
|
|
2159
2155
|
${GROK_MARKER_END}
|
|
2160
2156
|
`;
|
|
2161
2157
|
if (existsSync9(path) && !existsSync9(`${path}.hindsight-backup`))
|
|
@@ -2203,11 +2199,7 @@ var cline = {
|
|
|
2203
2199
|
const mcp = readJson(mcpPath);
|
|
2204
2200
|
mcp.mcpServers = {
|
|
2205
2201
|
...mcp.mcpServers ?? {},
|
|
2206
|
-
hindsight:
|
|
2207
|
-
command: "node",
|
|
2208
|
-
args: [join13(c.dist, "mcp-server.js")],
|
|
2209
|
-
env: { HINDSIGHT_MCP_HARNESS: "cline-cli" }
|
|
2210
|
-
}
|
|
2202
|
+
hindsight: mcpServerEntry(c.dist, "cline-cli")
|
|
2211
2203
|
};
|
|
2212
2204
|
writeJson(mcpPath, mcp);
|
|
2213
2205
|
installSkill(c, "cline-cli", join13(c.home, ".cline", "data", "settings", "skills"));
|