@vectorize-io/hindsight-coding-agents 0.3.3 → 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 +124 -37
- package/cordis.patch.yml +18 -0
- package/dist/antigravity-hook.js +440 -265
- package/dist/antigravity-statusline.js +130 -27
- package/dist/antigravity-stop-hook.js +446 -266
- package/dist/claude-hook.js +440 -265
- package/dist/claude-sessionstart-hook.js +436 -269
- package/dist/claude-stop-hook.js +446 -266
- package/dist/cline.js +652 -340
- package/dist/codex-hook.js +440 -265
- package/dist/codex-sessionstart-hook.js +436 -269
- package/dist/codex-stop-hook.js +446 -266
- package/dist/copilot-hook.js +440 -265
- package/dist/copilot-sessionstart-hook.js +436 -269
- package/dist/copilot-stop-hook.js +446 -266
- package/dist/cursor-hook.js +440 -265
- package/dist/cursor-sessionstart-hook.js +436 -269
- package/dist/cursor-stop-hook.js +446 -266
- package/dist/daemon-start.js +101 -45
- package/dist/deepen.js +302 -119
- package/dist/devin-hook.js +440 -265
- package/dist/devin-sessionstart-hook.js +436 -269
- package/dist/devin-stop-hook.js +446 -266
- package/dist/dsh.js +17339 -0
- package/dist/grok-hook.js +440 -265
- package/dist/grok-sessionstart-hook.js +436 -269
- package/dist/grok-stop-hook.js +446 -266
- package/dist/hindsight-seed.js +122 -24
- package/dist/index.js +685 -372
- package/dist/installer.js +229 -49
- package/dist/kilo.js +685 -372
- package/dist/mcp-server.js +529 -289
- package/dist/prime-agent.js +1055 -741
- package/dist/status.js +419 -244
- package/package.json +27 -3
- 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];
|
|
@@ -892,6 +890,100 @@ import {
|
|
|
892
890
|
} from "fs";
|
|
893
891
|
import { homedir as homedir7 } from "os";
|
|
894
892
|
import { join as join11 } from "path";
|
|
893
|
+
import * as zlib2 from "zlib";
|
|
894
|
+
|
|
895
|
+
// src/core/transcript-dsh.ts
|
|
896
|
+
function textOf(message) {
|
|
897
|
+
return (message.content || []).filter((block) => block?.type === "text" && typeof block.text === "string").map((block) => block.text).join("\n").trim();
|
|
898
|
+
}
|
|
899
|
+
function stampOf(event) {
|
|
900
|
+
return typeof event.time === "number" ? { timestamp: new Date(event.time).toISOString() } : {};
|
|
901
|
+
}
|
|
902
|
+
function readDshEvents(events) {
|
|
903
|
+
const turns = [];
|
|
904
|
+
for (const event of events || []) {
|
|
905
|
+
if (!event || typeof event !== "object") continue;
|
|
906
|
+
const stamp = stampOf(event);
|
|
907
|
+
if (event.type === "user/message") {
|
|
908
|
+
const message = event.data;
|
|
909
|
+
if (!message || message.source?.kind !== "user") continue;
|
|
910
|
+
const text = stripInjectedMemory(textOf(message)).trim();
|
|
911
|
+
if (text) turns.push({ role: "user", content: text, ...stamp });
|
|
912
|
+
} else if (event.type === "assistant/message") {
|
|
913
|
+
const message = event.data?.message;
|
|
914
|
+
if (!message) continue;
|
|
915
|
+
const text = stripInjectedMemory(textOf(message)).trim();
|
|
916
|
+
if (text) turns.push({ role: "assistant", content: text, ...stamp });
|
|
917
|
+
} else if (event.type === "tool/call") {
|
|
918
|
+
const call = event.data;
|
|
919
|
+
if (!call?.name) continue;
|
|
920
|
+
turns.push({
|
|
921
|
+
role: "action",
|
|
922
|
+
content: actionLine(call.name, parseArgs(call.arguments)),
|
|
923
|
+
...stamp
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
return turns;
|
|
928
|
+
}
|
|
929
|
+
function parseArgs(raw) {
|
|
930
|
+
if (!raw) return void 0;
|
|
931
|
+
try {
|
|
932
|
+
return JSON.parse(raw);
|
|
933
|
+
} catch {
|
|
934
|
+
return raw;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
// src/core/zstd-frames.ts
|
|
939
|
+
import * as zlib from "zlib";
|
|
940
|
+
var ZSTD_MAGIC = 4247762216;
|
|
941
|
+
function scanZstdFrames(buffer) {
|
|
942
|
+
const frames = [];
|
|
943
|
+
let offset = 0;
|
|
944
|
+
while (offset < buffer.length) {
|
|
945
|
+
const start = offset;
|
|
946
|
+
if (buffer.length - offset < 5) return frames;
|
|
947
|
+
if (buffer.readUInt32LE(offset) !== ZSTD_MAGIC) return frames;
|
|
948
|
+
offset += 4;
|
|
949
|
+
const descriptor = buffer.readUInt8(offset);
|
|
950
|
+
offset += 1;
|
|
951
|
+
if ((descriptor & 24) !== 0) return frames;
|
|
952
|
+
const contentSizeFlag = descriptor >>> 6;
|
|
953
|
+
const singleSegment = (descriptor & 32) !== 0;
|
|
954
|
+
const hasChecksum = (descriptor & 4) !== 0;
|
|
955
|
+
const dictionaryFlag = descriptor & 3;
|
|
956
|
+
const dictionaryBytes = dictionaryFlag === 3 ? 4 : dictionaryFlag;
|
|
957
|
+
const contentSizeBytes = contentSizeFlag === 0 ? singleSegment ? 1 : 0 : 1 << contentSizeFlag;
|
|
958
|
+
offset += (singleSegment ? 0 : 1) + dictionaryBytes + contentSizeBytes;
|
|
959
|
+
if (offset > buffer.length) return frames;
|
|
960
|
+
for (; ; ) {
|
|
961
|
+
if (buffer.length - offset < 3) return frames;
|
|
962
|
+
const blockHeader = buffer.readUIntLE(offset, 3);
|
|
963
|
+
offset += 3;
|
|
964
|
+
const lastBlock = (blockHeader & 1) !== 0;
|
|
965
|
+
const blockType = blockHeader >>> 1 & 3;
|
|
966
|
+
if (blockType === 3) return frames;
|
|
967
|
+
const payloadBytes = blockType === 1 ? 1 : blockHeader >>> 3;
|
|
968
|
+
offset += payloadBytes;
|
|
969
|
+
if (offset > buffer.length) return frames;
|
|
970
|
+
if (lastBlock) break;
|
|
971
|
+
}
|
|
972
|
+
if (hasChecksum) {
|
|
973
|
+
if (buffer.length - offset < 4) return frames;
|
|
974
|
+
offset += 4;
|
|
975
|
+
}
|
|
976
|
+
frames.push({ start, end: offset });
|
|
977
|
+
}
|
|
978
|
+
return frames;
|
|
979
|
+
}
|
|
980
|
+
function zstdDecompressFrames(buffer) {
|
|
981
|
+
return scanZstdFrames(buffer).map(
|
|
982
|
+
(frame) => zlib.zstdDecompressSync(buffer.subarray(frame.start, frame.end)).toString("utf8")
|
|
983
|
+
).join("");
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
// src/core/history.ts
|
|
895
987
|
function claudeProjectDir(repoDir, home = homedir7()) {
|
|
896
988
|
return join11(home, ".claude", "projects", repoDir.replace(/[/.]/g, "-"));
|
|
897
989
|
}
|
|
@@ -991,6 +1083,56 @@ function codexHistory(repoDir, home) {
|
|
|
991
1083
|
}
|
|
992
1084
|
return { supported: true, sessions };
|
|
993
1085
|
}
|
|
1086
|
+
function dshHistory(repoDir, home) {
|
|
1087
|
+
const root = process.env.DSH_HOME ? join11(process.env.DSH_HOME, "sessions") : join11(home, ".dsh", "sessions");
|
|
1088
|
+
if (!existsSync7(root)) return { supported: true, sessions: [] };
|
|
1089
|
+
if (typeof zlib2.zstdDecompressSync !== "function") {
|
|
1090
|
+
return {
|
|
1091
|
+
supported: false,
|
|
1092
|
+
reason: `reading dsh session logs needs Node's built-in Zstandard support (Node 22.15+); this import is running on ${process.version}`,
|
|
1093
|
+
sessions: []
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
const sessions = [];
|
|
1097
|
+
let unattributed = 0;
|
|
1098
|
+
for (const dir of readdirSync2(root).map((project) => join11(root, project))) {
|
|
1099
|
+
let sessionDirs;
|
|
1100
|
+
try {
|
|
1101
|
+
sessionDirs = readdirSync2(dir).map((id) => join11(dir, id));
|
|
1102
|
+
} catch {
|
|
1103
|
+
continue;
|
|
1104
|
+
}
|
|
1105
|
+
for (const sessionDir of sessionDirs) {
|
|
1106
|
+
const file = ["session.jsonl.zstd", "session.jsonl"].map((name) => join11(sessionDir, name)).find((candidate) => existsSync7(candidate));
|
|
1107
|
+
if (!file) continue;
|
|
1108
|
+
try {
|
|
1109
|
+
const lines = readDshLog(file);
|
|
1110
|
+
const header = JSON.parse(lines[0] ?? "{}");
|
|
1111
|
+
if (!header.cwd) {
|
|
1112
|
+
unattributed++;
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
if (!withinRepo(header.cwd, repoDir)) continue;
|
|
1116
|
+
const events = lines.slice(1).flatMap((line) => {
|
|
1117
|
+
try {
|
|
1118
|
+
return [JSON.parse(line)];
|
|
1119
|
+
} catch {
|
|
1120
|
+
return [];
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
const s = toSession(header.id ?? sessionDir, readDshEvents(events));
|
|
1124
|
+
if (s) sessions.push(s);
|
|
1125
|
+
} catch {
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
return { supported: true, sessions, unattributed };
|
|
1130
|
+
}
|
|
1131
|
+
function readDshLog(file) {
|
|
1132
|
+
const bytes = readFileSync8(file);
|
|
1133
|
+
const text = file.endsWith(".zstd") ? zstdDecompressFrames(bytes) : bytes.toString("utf8");
|
|
1134
|
+
return text.split("\n").filter((line) => line.trim());
|
|
1135
|
+
}
|
|
994
1136
|
var SQLITE_HISTORY = "keeps session history in an internal SQLite database, whose schema is unversioned and would break on any upstream change";
|
|
995
1137
|
function importLocalHistory(harness, repoDir, home = homedir7()) {
|
|
996
1138
|
switch (harness) {
|
|
@@ -998,6 +1140,8 @@ function importLocalHistory(harness, repoDir, home = homedir7()) {
|
|
|
998
1140
|
return claudeHistory(repoDir, home);
|
|
999
1141
|
case "codex":
|
|
1000
1142
|
return codexHistory(repoDir, home);
|
|
1143
|
+
case "dsh":
|
|
1144
|
+
return dshHistory(repoDir, home);
|
|
1001
1145
|
case "opencode":
|
|
1002
1146
|
case "kilo":
|
|
1003
1147
|
case "cursor-cli":
|
|
@@ -1300,6 +1444,11 @@ function setOrDelete(obj, key, arr) {
|
|
|
1300
1444
|
var cmdHook = (dist, file, timeout) => ({
|
|
1301
1445
|
hooks: [{ type: "command", command: `node "${join13(dist, file)}"`, timeout }]
|
|
1302
1446
|
});
|
|
1447
|
+
var mcpServerEntry = (dist, harness) => ({
|
|
1448
|
+
command: "node",
|
|
1449
|
+
args: [join13(dist, "mcp-server.js")],
|
|
1450
|
+
env: { HINDSIGHT_MCP_HARNESS: harness }
|
|
1451
|
+
});
|
|
1303
1452
|
function mergeHarnessHooks(hooks, harness, dist) {
|
|
1304
1453
|
const spec = HOOK_HARNESSES[harness];
|
|
1305
1454
|
const installedEvents = /* @__PURE__ */ new Set();
|
|
@@ -1451,6 +1600,8 @@ var claudeCode = {
|
|
|
1451
1600
|
"--scope",
|
|
1452
1601
|
"user",
|
|
1453
1602
|
"hindsight",
|
|
1603
|
+
"--env",
|
|
1604
|
+
"HINDSIGHT_MCP_HARNESS=claude-code",
|
|
1454
1605
|
"--",
|
|
1455
1606
|
"node",
|
|
1456
1607
|
join13(c.dist, "mcp-server.js")
|
|
@@ -1459,7 +1610,7 @@ var claudeCode = {
|
|
|
1459
1610
|
} else {
|
|
1460
1611
|
c.log?.(
|
|
1461
1612
|
`claude-code: could not run \`claude mcp add\` \u2014 register the tools manually:
|
|
1462
|
-
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")}"`
|
|
1463
1614
|
);
|
|
1464
1615
|
}
|
|
1465
1616
|
},
|
|
@@ -1487,6 +1638,11 @@ function defaultClaudeMcp(args) {
|
|
|
1487
1638
|
return false;
|
|
1488
1639
|
}
|
|
1489
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" }`;
|
|
1490
1646
|
var codex = {
|
|
1491
1647
|
name: "codex",
|
|
1492
1648
|
detect: (c) => onPath2("codex") || existsSync9(join13(c.home, ".codex")),
|
|
@@ -1498,7 +1654,8 @@ var codex = {
|
|
|
1498
1654
|
writeJson(hooksPath, cfg);
|
|
1499
1655
|
c.log?.(`codex: hooks merged into ${hooksPath}`);
|
|
1500
1656
|
const tomlPath = join13(c.home, ".codex", "config.toml");
|
|
1501
|
-
|
|
1657
|
+
const existing = existsSync9(tomlPath) ? readFileSync10(tomlPath, "utf8") : "";
|
|
1658
|
+
const toml = existing.replace(CODEX_MCP_BLOCK_RE, "");
|
|
1502
1659
|
const additions = [];
|
|
1503
1660
|
if (!/^\s*(codex_hooks|hooks)\s*=/m.test(toml)) {
|
|
1504
1661
|
if (/^\[features\]/m.test(toml)) {
|
|
@@ -1509,21 +1666,16 @@ var codex = {
|
|
|
1509
1666
|
additions.push("[features]\nhooks = true");
|
|
1510
1667
|
}
|
|
1511
1668
|
}
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
args = ["${join13(c.dist, "mcp-server.js")}"]`
|
|
1517
|
-
);
|
|
1518
|
-
}
|
|
1519
|
-
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) {
|
|
1520
1673
|
if (existsSync9(tomlPath) && !existsSync9(`${tomlPath}.hindsight-backup`)) {
|
|
1521
1674
|
copyFileSync(tomlPath, `${tomlPath}.hindsight-backup`);
|
|
1522
1675
|
}
|
|
1523
1676
|
mkdirSync3(dirname8(tomlPath), { recursive: true });
|
|
1524
|
-
writeFileSync2(tomlPath,
|
|
1525
|
-
`);
|
|
1526
|
-
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}`);
|
|
1527
1679
|
}
|
|
1528
1680
|
installSkill(c, "codex", join13(c.home, ".agents", "skills"));
|
|
1529
1681
|
},
|
|
@@ -1540,10 +1692,7 @@ args = ["${join13(c.dist, "mcp-server.js")}"]`
|
|
|
1540
1692
|
const tomlPath = join13(c.home, ".codex", "config.toml");
|
|
1541
1693
|
if (existsSync9(tomlPath)) {
|
|
1542
1694
|
const toml = readFileSync10(tomlPath, "utf8");
|
|
1543
|
-
const cleaned = toml.replace(
|
|
1544
|
-
/\n?\[mcp_servers\.hindsight\]\ncommand = "node"\nargs = \[[^\]]*\]\n?/g,
|
|
1545
|
-
"\n"
|
|
1546
|
-
);
|
|
1695
|
+
const cleaned = toml.replace(CODEX_MCP_BLOCK_RE, "");
|
|
1547
1696
|
if (cleaned !== toml) writeFileSync2(tomlPath, cleaned);
|
|
1548
1697
|
}
|
|
1549
1698
|
c.log?.(
|
|
@@ -1573,11 +1722,7 @@ var antigravity = {
|
|
|
1573
1722
|
const mcp = readJson(mcpPath);
|
|
1574
1723
|
mcp.mcpServers = {
|
|
1575
1724
|
...mcp.mcpServers ?? {},
|
|
1576
|
-
hindsight:
|
|
1577
|
-
command: "node",
|
|
1578
|
-
args: [join13(c.dist, "mcp-server.js")],
|
|
1579
|
-
env: { HINDSIGHT_MCP_HARNESS: "antigravity-cli" }
|
|
1580
|
-
}
|
|
1725
|
+
hindsight: mcpServerEntry(c.dist, "antigravity-cli")
|
|
1581
1726
|
};
|
|
1582
1727
|
writeJson(mcpPath, mcp);
|
|
1583
1728
|
const settingsPath = join13(c.home, ".gemini", "antigravity-cli", "settings.json");
|
|
@@ -1870,11 +2015,7 @@ var devin = {
|
|
|
1870
2015
|
const mcp = readJson(mcpPath);
|
|
1871
2016
|
mcp.mcpServers = {
|
|
1872
2017
|
...mcp.mcpServers ?? {},
|
|
1873
|
-
hindsight:
|
|
1874
|
-
command: "node",
|
|
1875
|
-
args: [join13(c.dist, "mcp-server.js")],
|
|
1876
|
-
env: { HINDSIGHT_MCP_HARNESS: "devin-cli" }
|
|
1877
|
-
}
|
|
2018
|
+
hindsight: mcpServerEntry(c.dist, "devin-cli")
|
|
1878
2019
|
};
|
|
1879
2020
|
writeJson(mcpPath, mcp);
|
|
1880
2021
|
c.log?.(`devin-cli: hooks merged into ${configPath}, MCP into ${mcpPath}`);
|
|
@@ -1913,7 +2054,7 @@ var cursor = {
|
|
|
1913
2054
|
const mcp = readJson(mcpPath);
|
|
1914
2055
|
mcp.mcpServers = {
|
|
1915
2056
|
...mcp.mcpServers ?? {},
|
|
1916
|
-
hindsight:
|
|
2057
|
+
hindsight: mcpServerEntry(c.dist, "cursor-cli")
|
|
1917
2058
|
};
|
|
1918
2059
|
writeJson(mcpPath, mcp);
|
|
1919
2060
|
c.log?.(`cursor-cli: hooks merged into ${hooksPath}, MCP into ${mcpPath}`);
|
|
@@ -1953,7 +2094,7 @@ var copilot = {
|
|
|
1953
2094
|
const mcp = readJson(mcpPath);
|
|
1954
2095
|
mcp.mcpServers = {
|
|
1955
2096
|
...mcp.mcpServers ?? {},
|
|
1956
|
-
hindsight:
|
|
2097
|
+
hindsight: mcpServerEntry(c.dist, "copilot-cli")
|
|
1957
2098
|
};
|
|
1958
2099
|
writeJson(mcpPath, mcp);
|
|
1959
2100
|
installSkill(c, "copilot-cli", join13(c.home, ".copilot", "skills"));
|
|
@@ -2010,6 +2151,7 @@ ${GROK_MARKER_START}
|
|
|
2010
2151
|
[mcp_servers.hindsight]
|
|
2011
2152
|
command = "node"
|
|
2012
2153
|
args = [${tomlString(join13(c.dist, "mcp-server.js"))}]
|
|
2154
|
+
env = { HINDSIGHT_MCP_HARNESS = "grok-build" }
|
|
2013
2155
|
${GROK_MARKER_END}
|
|
2014
2156
|
`;
|
|
2015
2157
|
if (existsSync9(path) && !existsSync9(`${path}.hindsight-backup`))
|
|
@@ -2057,11 +2199,7 @@ var cline = {
|
|
|
2057
2199
|
const mcp = readJson(mcpPath);
|
|
2058
2200
|
mcp.mcpServers = {
|
|
2059
2201
|
...mcp.mcpServers ?? {},
|
|
2060
|
-
hindsight:
|
|
2061
|
-
command: "node",
|
|
2062
|
-
args: [join13(c.dist, "mcp-server.js")],
|
|
2063
|
-
env: { HINDSIGHT_MCP_HARNESS: "cline-cli" }
|
|
2064
|
-
}
|
|
2202
|
+
hindsight: mcpServerEntry(c.dist, "cline-cli")
|
|
2065
2203
|
};
|
|
2066
2204
|
writeJson(mcpPath, mcp);
|
|
2067
2205
|
installSkill(c, "cline-cli", join13(c.home, ".cline", "data", "settings", "skills"));
|
|
@@ -2084,6 +2222,47 @@ var cline = {
|
|
|
2084
2222
|
c.log?.("cline-cli: native plugin + MCP + skill removed");
|
|
2085
2223
|
}
|
|
2086
2224
|
};
|
|
2225
|
+
var DSH_MARKER_START = "# HINDSIGHT_CODING_AGENTS_DSH_START";
|
|
2226
|
+
var DSH_MARKER_END = "# HINDSIGHT_CODING_AGENTS_DSH_END";
|
|
2227
|
+
var DSH_BLOCK_RE = new RegExp(`\\n?${DSH_MARKER_START}[\\s\\S]*?${DSH_MARKER_END}\\n?`);
|
|
2228
|
+
function dshHome(c) {
|
|
2229
|
+
return process.env.DSH_HOME || join13(c.home, ".dsh");
|
|
2230
|
+
}
|
|
2231
|
+
var dsh = {
|
|
2232
|
+
name: "dsh",
|
|
2233
|
+
detect: (c) => onPath2("dsh") || existsSync9(dshHome(c)),
|
|
2234
|
+
install(c) {
|
|
2235
|
+
const path = join13(dshHome(c), "cordis.patch.yml");
|
|
2236
|
+
const existing = existsSync9(path) ? readFileSync10(path, "utf8") : "";
|
|
2237
|
+
const others = existing.replace(DSH_BLOCK_RE, "\n").trim();
|
|
2238
|
+
const entry = pathToFileURL(join13(c.dist, "dsh.js")).href;
|
|
2239
|
+
const block = `${DSH_MARKER_START}
|
|
2240
|
+
- insert:
|
|
2241
|
+
- id: hindsight
|
|
2242
|
+
name: ${JSON.stringify(entry)}
|
|
2243
|
+
${DSH_MARKER_END}
|
|
2244
|
+
`;
|
|
2245
|
+
if (existsSync9(path) && !existsSync9(`${path}.hindsight-backup`))
|
|
2246
|
+
copyFileSync(path, `${path}.hindsight-backup`);
|
|
2247
|
+
mkdirSync3(dirname8(path), { recursive: true });
|
|
2248
|
+
writeFileSync2(path, others ? `${others}
|
|
2249
|
+
|
|
2250
|
+
${block}` : block);
|
|
2251
|
+
installSkill(c, "dsh", join13(c.home, ".agents", "skills"));
|
|
2252
|
+
c.log?.(`dsh: plugin registered in ${path} (applies to every dsh profile)`);
|
|
2253
|
+
},
|
|
2254
|
+
uninstall(c) {
|
|
2255
|
+
const path = join13(dshHome(c), "cordis.patch.yml");
|
|
2256
|
+
if (existsSync9(path)) {
|
|
2257
|
+
const existing = readFileSync10(path, "utf8");
|
|
2258
|
+
const others = existing.replace(DSH_BLOCK_RE, "\n").trim();
|
|
2259
|
+
if (others !== existing.trim()) writeFileSync2(path, others ? `${others}
|
|
2260
|
+
` : "[]\n");
|
|
2261
|
+
}
|
|
2262
|
+
uninstallSkill(c, join13(c.home, ".agents", "skills"));
|
|
2263
|
+
c.log?.("dsh: plugin entry + skill removed");
|
|
2264
|
+
}
|
|
2265
|
+
};
|
|
2087
2266
|
var INSTALLERS = [
|
|
2088
2267
|
opencode,
|
|
2089
2268
|
kilo,
|
|
@@ -2095,7 +2274,8 @@ var INSTALLERS = [
|
|
|
2095
2274
|
cursor,
|
|
2096
2275
|
copilot,
|
|
2097
2276
|
grok,
|
|
2098
|
-
cline
|
|
2277
|
+
cline,
|
|
2278
|
+
dsh
|
|
2099
2279
|
];
|
|
2100
2280
|
var HARNESS_ALIASES = { agy: "antigravity-cli" };
|
|
2101
2281
|
function importConversations(harness, ctx) {
|