@vectorize-io/hindsight-coding-agents 0.4.1 → 0.4.2
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 +84 -4
- package/dist/antigravity-hook.js +35 -10
- package/dist/antigravity-statusline.js +24 -2
- package/dist/antigravity-stop-hook.js +48 -11
- package/dist/claude-hook.js +35 -10
- package/dist/claude-sessionstart-hook.js +62 -16
- package/dist/claude-stop-hook.js +48 -11
- package/dist/cline.js +64 -17
- package/dist/codex-hook.js +35 -10
- package/dist/codex-sessionstart-hook.js +62 -16
- package/dist/codex-stop-hook.js +48 -11
- package/dist/copilot-hook.js +35 -10
- package/dist/copilot-sessionstart-hook.js +62 -16
- package/dist/copilot-stop-hook.js +48 -11
- package/dist/cursor-hook.js +35 -10
- package/dist/cursor-sessionstart-hook.js +62 -16
- package/dist/cursor-stop-hook.js +48 -11
- package/dist/daemon-start.js +15 -3
- package/dist/deepen.js +37 -9
- package/dist/devin-hook.js +35 -10
- package/dist/devin-sessionstart-hook.js +62 -16
- package/dist/devin-stop-hook.js +48 -11
- package/dist/dsh.js +64 -17
- package/dist/grok-hook.js +35 -10
- package/dist/grok-sessionstart-hook.js +62 -16
- package/dist/grok-stop-hook.js +48 -11
- package/dist/hindsight-seed.js +26 -3
- package/dist/index.js +64 -17
- package/dist/installer.js +16 -4
- package/dist/kilo.js +64 -17
- package/dist/mcp-server.js +38 -9
- package/dist/prime-agent.js +64 -17
- package/dist/status.js +38 -9
- package/package.json +3 -2
- package/skill/SKILL.md +345 -68
package/dist/index.js
CHANGED
|
@@ -34,7 +34,8 @@ function startBackgroundSeed(repoDir, opts = {}) {
|
|
|
34
34
|
],
|
|
35
35
|
{
|
|
36
36
|
detached: true,
|
|
37
|
-
stdio: "ignore"
|
|
37
|
+
stdio: "ignore",
|
|
38
|
+
windowsHide: true
|
|
38
39
|
}
|
|
39
40
|
);
|
|
40
41
|
child.on("error", () => {
|
|
@@ -74,14 +75,36 @@ function getProjectRootFromGit(directory) {
|
|
|
74
75
|
const commonDir = execFileSync(
|
|
75
76
|
"git",
|
|
76
77
|
["rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
77
|
-
{
|
|
78
|
+
{
|
|
79
|
+
cwd: directory,
|
|
80
|
+
encoding: "utf-8",
|
|
81
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
82
|
+
timeout: 1e3,
|
|
83
|
+
windowsHide: true
|
|
84
|
+
}
|
|
78
85
|
).trim();
|
|
79
86
|
if (!commonDir) return null;
|
|
80
|
-
|
|
87
|
+
if (basename(commonDir) === ".git") return dirname2(commonDir);
|
|
88
|
+
if (basename(commonDir).startsWith(".") && isBareRepository(commonDir)) {
|
|
89
|
+
return dirname2(commonDir);
|
|
90
|
+
}
|
|
91
|
+
return commonDir;
|
|
81
92
|
} catch {
|
|
82
93
|
return null;
|
|
83
94
|
}
|
|
84
95
|
}
|
|
96
|
+
function isBareRepository(commonDir) {
|
|
97
|
+
try {
|
|
98
|
+
return execFileSync("git", ["-C", commonDir, "rev-parse", "--is-bare-repository"], {
|
|
99
|
+
encoding: "utf-8",
|
|
100
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
101
|
+
timeout: 1e3,
|
|
102
|
+
env: { ...process.env, GIT_DIR: void 0, GIT_WORK_TREE: void 0 }
|
|
103
|
+
}).trim() === "true";
|
|
104
|
+
} catch {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
85
108
|
function projectNameOf(directory, sessionRoot) {
|
|
86
109
|
return gitProjectName(directory, true, sessionRoot);
|
|
87
110
|
}
|
|
@@ -844,14 +867,16 @@ var HindsightClient = class {
|
|
|
844
867
|
return;
|
|
845
868
|
}
|
|
846
869
|
if (r.status !== 409) created++;
|
|
847
|
-
} else
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
870
|
+
} else {
|
|
871
|
+
const sourceDrift = hit.description !== page.source_query;
|
|
872
|
+
const triggerDrift = hit.trigger != null && hit.trigger.tags_match !== pageTrigger.tags_match;
|
|
873
|
+
if (!sourceDrift && !triggerDrift) continue;
|
|
874
|
+
const patch = {};
|
|
875
|
+
if (sourceDrift) {
|
|
852
876
|
patch.source_query = page.source_query;
|
|
853
877
|
patch.tags = page.tags;
|
|
854
878
|
}
|
|
879
|
+
if (triggerDrift) patch.trigger = pageTrigger;
|
|
855
880
|
const r = await this.req(
|
|
856
881
|
"PATCH",
|
|
857
882
|
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(hit.id)}`),
|
|
@@ -1234,7 +1259,11 @@ async function isServerHealthy(baseUrl, timeoutMs = 2e3) {
|
|
|
1234
1259
|
function hasRustToolchain() {
|
|
1235
1260
|
if (process.platform !== "darwin") return true;
|
|
1236
1261
|
try {
|
|
1237
|
-
execFileSync2("cargo", ["--version"], {
|
|
1262
|
+
execFileSync2("cargo", ["--version"], {
|
|
1263
|
+
stdio: "pipe",
|
|
1264
|
+
timeout: 1e4,
|
|
1265
|
+
windowsHide: true
|
|
1266
|
+
});
|
|
1238
1267
|
return true;
|
|
1239
1268
|
} catch {
|
|
1240
1269
|
return false;
|
|
@@ -1242,7 +1271,11 @@ function hasRustToolchain() {
|
|
|
1242
1271
|
}
|
|
1243
1272
|
function hasUvx() {
|
|
1244
1273
|
try {
|
|
1245
|
-
execFileSync2("uvx", ["--version"], {
|
|
1274
|
+
execFileSync2("uvx", ["--version"], {
|
|
1275
|
+
stdio: "pipe",
|
|
1276
|
+
timeout: 1e4,
|
|
1277
|
+
windowsHide: true
|
|
1278
|
+
});
|
|
1246
1279
|
return true;
|
|
1247
1280
|
} catch {
|
|
1248
1281
|
return false;
|
|
@@ -1274,7 +1307,11 @@ function detectLlm(env = process.env) {
|
|
|
1274
1307
|
}
|
|
1275
1308
|
function onPath(bin) {
|
|
1276
1309
|
try {
|
|
1277
|
-
execFileSync2("which", [bin], {
|
|
1310
|
+
execFileSync2("which", [bin], {
|
|
1311
|
+
stdio: "pipe",
|
|
1312
|
+
timeout: 5e3,
|
|
1313
|
+
windowsHide: true
|
|
1314
|
+
});
|
|
1278
1315
|
return true;
|
|
1279
1316
|
} catch {
|
|
1280
1317
|
return false;
|
|
@@ -1285,7 +1322,8 @@ function startDaemonDetached(cfg, harness, spawnFn = realSpawn2) {
|
|
|
1285
1322
|
const starter = join5(dirname4(fileURLToPath2(import.meta.url)), "daemon-start.js");
|
|
1286
1323
|
const child = spawnFn("node", [starter, "--harness", harness], {
|
|
1287
1324
|
detached: true,
|
|
1288
|
-
stdio: "ignore"
|
|
1325
|
+
stdio: "ignore",
|
|
1326
|
+
windowsHide: true
|
|
1289
1327
|
});
|
|
1290
1328
|
child.on("error", () => {
|
|
1291
1329
|
});
|
|
@@ -15860,7 +15898,11 @@ import { execFileSync as execFileSync4 } from "child_process";
|
|
|
15860
15898
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
15861
15899
|
import { resolve } from "path";
|
|
15862
15900
|
function git(repo, ...args) {
|
|
15863
|
-
return execFileSync3("git", ["-C", repo, ...args], {
|
|
15901
|
+
return execFileSync3("git", ["-C", repo, ...args], {
|
|
15902
|
+
encoding: "utf8",
|
|
15903
|
+
maxBuffer: 1 << 28,
|
|
15904
|
+
windowsHide: true
|
|
15905
|
+
});
|
|
15864
15906
|
}
|
|
15865
15907
|
function repoNameOf(repo) {
|
|
15866
15908
|
return projectNameOf(resolve(repo));
|
|
@@ -15908,9 +15950,9 @@ var TOOL_GUIDE = `- hindsight_search_knowledge_pages(query) \u2014 FIRST STOP fo
|
|
|
15908
15950
|
- hindsight_reflect(query) \u2014 when pages are too shallow and you need the WHY: deep reasoning over the repo's full memory for the past decision and exact values that explain a behavior or bug (slower \u2014 use deliberately, and credit results with a blockquote header "> \u{1F9E0} **From Hindsight memory** \u2014 <summary>").
|
|
15909
15951
|
- hindsight_capture_initiative(title, summary) \u2014 right after the user approves a plan or finishes brainstorming a new feature/capability and you are about to start implementing (BEFORE you write any code), call this to record it as a tracked page; then call it AGAIN with relates_to_page_id set to that page whenever the goal, scope, or rationale materially changes mid-work, so the page tracks the current plan and not the opening one. Skip bug fixes, small tweaks, chores, and trivial course-corrections.
|
|
15910
15952
|
- hindsight_ingest_document(title, content) \u2014 save an external document or durable notes/findings you want remembered (not the current conversation \u2014 that is captured automatically at session end).`;
|
|
15911
|
-
var
|
|
15953
|
+
var PAGES_FIRST_ON_GOALS = "- The user just set a NEW task or goal \u2192 search the knowledge pages FIRST with hindsight_search_knowledge_pages. No synthesis is injected automatically in this configuration; call hindsight_reflect only when those pages are too shallow and deeper reasoning is needed.\n";
|
|
15912
15954
|
function toolGuide(opts) {
|
|
15913
|
-
return (opts?.reflectOnNewGoals ?
|
|
15955
|
+
return (opts?.reflectOnNewGoals ? PAGES_FIRST_ON_GOALS : "") + TOOL_GUIDE;
|
|
15914
15956
|
}
|
|
15915
15957
|
function buildKnowledgePreamble(pages, opts) {
|
|
15916
15958
|
const body = pages.length ? `Knowledge pages currently in this repository:
|
|
@@ -16126,6 +16168,7 @@ function startCodebaseSurvey(repoDir, opts = {}) {
|
|
|
16126
16168
|
cwd: repoDir,
|
|
16127
16169
|
detached: true,
|
|
16128
16170
|
stdio: "ignore",
|
|
16171
|
+
windowsHide: true,
|
|
16129
16172
|
env: plan.env
|
|
16130
16173
|
});
|
|
16131
16174
|
child.on("error", () => {
|
|
@@ -16142,7 +16185,8 @@ var DEEPEN_DIFF_TARGET = 300;
|
|
|
16142
16185
|
function commitCount(repoDir) {
|
|
16143
16186
|
try {
|
|
16144
16187
|
const out = execFileSync4("git", ["-C", repoDir, "rev-list", "--count", "HEAD"], {
|
|
16145
|
-
encoding: "utf8"
|
|
16188
|
+
encoding: "utf8",
|
|
16189
|
+
windowsHide: true
|
|
16146
16190
|
});
|
|
16147
16191
|
return Number(out.trim()) || 0;
|
|
16148
16192
|
} catch {
|
|
@@ -16651,7 +16695,10 @@ async function gitSyncNote(args) {
|
|
|
16651
16695
|
try {
|
|
16652
16696
|
const { execFileSync: execFileSync5 } = await import("child_process");
|
|
16653
16697
|
const n = Number(
|
|
16654
|
-
execFileSync5("git", ["-C", cwd, "rev-list", "--count", "HEAD"], {
|
|
16698
|
+
execFileSync5("git", ["-C", cwd, "rev-list", "--count", "HEAD"], {
|
|
16699
|
+
encoding: "utf8",
|
|
16700
|
+
windowsHide: true
|
|
16701
|
+
}).trim()
|
|
16655
16702
|
);
|
|
16656
16703
|
if (n > 0) target = Math.min(DEEPEN_DIFF_TARGET, n);
|
|
16657
16704
|
} catch {
|
package/dist/installer.js
CHANGED
|
@@ -127,7 +127,11 @@ import { fileURLToPath as fileURLToPath2 } from "url";
|
|
|
127
127
|
function hasRustToolchain() {
|
|
128
128
|
if (process.platform !== "darwin") return true;
|
|
129
129
|
try {
|
|
130
|
-
execFileSync2("cargo", ["--version"], {
|
|
130
|
+
execFileSync2("cargo", ["--version"], {
|
|
131
|
+
stdio: "pipe",
|
|
132
|
+
timeout: 1e4,
|
|
133
|
+
windowsHide: true
|
|
134
|
+
});
|
|
131
135
|
return true;
|
|
132
136
|
} catch {
|
|
133
137
|
return false;
|
|
@@ -135,7 +139,11 @@ function hasRustToolchain() {
|
|
|
135
139
|
}
|
|
136
140
|
function hasUvx() {
|
|
137
141
|
try {
|
|
138
|
-
execFileSync2("uvx", ["--version"], {
|
|
142
|
+
execFileSync2("uvx", ["--version"], {
|
|
143
|
+
stdio: "pipe",
|
|
144
|
+
timeout: 1e4,
|
|
145
|
+
windowsHide: true
|
|
146
|
+
});
|
|
139
147
|
return true;
|
|
140
148
|
} catch {
|
|
141
149
|
return false;
|
|
@@ -167,7 +175,11 @@ function detectLlm(env = process.env) {
|
|
|
167
175
|
}
|
|
168
176
|
function onPath(bin) {
|
|
169
177
|
try {
|
|
170
|
-
execFileSync2("which", [bin], {
|
|
178
|
+
execFileSync2("which", [bin], {
|
|
179
|
+
stdio: "pipe",
|
|
180
|
+
timeout: 5e3,
|
|
181
|
+
windowsHide: true
|
|
182
|
+
});
|
|
171
183
|
return true;
|
|
172
184
|
} catch {
|
|
173
185
|
return false;
|
|
@@ -985,7 +997,7 @@ function zstdDecompressFrames(buffer) {
|
|
|
985
997
|
|
|
986
998
|
// src/core/history.ts
|
|
987
999
|
function claudeProjectDir(repoDir, home = homedir7()) {
|
|
988
|
-
return join11(home, ".claude", "projects", repoDir.replace(/[
|
|
1000
|
+
return join11(home, ".claude", "projects", repoDir.replace(/[^a-zA-Z0-9]/g, "-"));
|
|
989
1001
|
}
|
|
990
1002
|
function withinRepo(dir, repoDir) {
|
|
991
1003
|
return !!dir && (dir === repoDir || dir.startsWith(repoDir.endsWith("/") ? repoDir : repoDir + "/"));
|
package/dist/kilo.js
CHANGED
|
@@ -34,7 +34,8 @@ function startBackgroundSeed(repoDir, opts = {}) {
|
|
|
34
34
|
],
|
|
35
35
|
{
|
|
36
36
|
detached: true,
|
|
37
|
-
stdio: "ignore"
|
|
37
|
+
stdio: "ignore",
|
|
38
|
+
windowsHide: true
|
|
38
39
|
}
|
|
39
40
|
);
|
|
40
41
|
child.on("error", () => {
|
|
@@ -74,14 +75,36 @@ function getProjectRootFromGit(directory) {
|
|
|
74
75
|
const commonDir = execFileSync(
|
|
75
76
|
"git",
|
|
76
77
|
["rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
77
|
-
{
|
|
78
|
+
{
|
|
79
|
+
cwd: directory,
|
|
80
|
+
encoding: "utf-8",
|
|
81
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
82
|
+
timeout: 1e3,
|
|
83
|
+
windowsHide: true
|
|
84
|
+
}
|
|
78
85
|
).trim();
|
|
79
86
|
if (!commonDir) return null;
|
|
80
|
-
|
|
87
|
+
if (basename(commonDir) === ".git") return dirname2(commonDir);
|
|
88
|
+
if (basename(commonDir).startsWith(".") && isBareRepository(commonDir)) {
|
|
89
|
+
return dirname2(commonDir);
|
|
90
|
+
}
|
|
91
|
+
return commonDir;
|
|
81
92
|
} catch {
|
|
82
93
|
return null;
|
|
83
94
|
}
|
|
84
95
|
}
|
|
96
|
+
function isBareRepository(commonDir) {
|
|
97
|
+
try {
|
|
98
|
+
return execFileSync("git", ["-C", commonDir, "rev-parse", "--is-bare-repository"], {
|
|
99
|
+
encoding: "utf-8",
|
|
100
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
101
|
+
timeout: 1e3,
|
|
102
|
+
env: { ...process.env, GIT_DIR: void 0, GIT_WORK_TREE: void 0 }
|
|
103
|
+
}).trim() === "true";
|
|
104
|
+
} catch {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
85
108
|
function projectNameOf(directory, sessionRoot) {
|
|
86
109
|
return gitProjectName(directory, true, sessionRoot);
|
|
87
110
|
}
|
|
@@ -844,14 +867,16 @@ var HindsightClient = class {
|
|
|
844
867
|
return;
|
|
845
868
|
}
|
|
846
869
|
if (r.status !== 409) created++;
|
|
847
|
-
} else
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
870
|
+
} else {
|
|
871
|
+
const sourceDrift = hit.description !== page.source_query;
|
|
872
|
+
const triggerDrift = hit.trigger != null && hit.trigger.tags_match !== pageTrigger.tags_match;
|
|
873
|
+
if (!sourceDrift && !triggerDrift) continue;
|
|
874
|
+
const patch = {};
|
|
875
|
+
if (sourceDrift) {
|
|
852
876
|
patch.source_query = page.source_query;
|
|
853
877
|
patch.tags = page.tags;
|
|
854
878
|
}
|
|
879
|
+
if (triggerDrift) patch.trigger = pageTrigger;
|
|
855
880
|
const r = await this.req(
|
|
856
881
|
"PATCH",
|
|
857
882
|
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(hit.id)}`),
|
|
@@ -1234,7 +1259,11 @@ async function isServerHealthy(baseUrl, timeoutMs = 2e3) {
|
|
|
1234
1259
|
function hasRustToolchain() {
|
|
1235
1260
|
if (process.platform !== "darwin") return true;
|
|
1236
1261
|
try {
|
|
1237
|
-
execFileSync2("cargo", ["--version"], {
|
|
1262
|
+
execFileSync2("cargo", ["--version"], {
|
|
1263
|
+
stdio: "pipe",
|
|
1264
|
+
timeout: 1e4,
|
|
1265
|
+
windowsHide: true
|
|
1266
|
+
});
|
|
1238
1267
|
return true;
|
|
1239
1268
|
} catch {
|
|
1240
1269
|
return false;
|
|
@@ -1242,7 +1271,11 @@ function hasRustToolchain() {
|
|
|
1242
1271
|
}
|
|
1243
1272
|
function hasUvx() {
|
|
1244
1273
|
try {
|
|
1245
|
-
execFileSync2("uvx", ["--version"], {
|
|
1274
|
+
execFileSync2("uvx", ["--version"], {
|
|
1275
|
+
stdio: "pipe",
|
|
1276
|
+
timeout: 1e4,
|
|
1277
|
+
windowsHide: true
|
|
1278
|
+
});
|
|
1246
1279
|
return true;
|
|
1247
1280
|
} catch {
|
|
1248
1281
|
return false;
|
|
@@ -1274,7 +1307,11 @@ function detectLlm(env = process.env) {
|
|
|
1274
1307
|
}
|
|
1275
1308
|
function onPath(bin) {
|
|
1276
1309
|
try {
|
|
1277
|
-
execFileSync2("which", [bin], {
|
|
1310
|
+
execFileSync2("which", [bin], {
|
|
1311
|
+
stdio: "pipe",
|
|
1312
|
+
timeout: 5e3,
|
|
1313
|
+
windowsHide: true
|
|
1314
|
+
});
|
|
1278
1315
|
return true;
|
|
1279
1316
|
} catch {
|
|
1280
1317
|
return false;
|
|
@@ -1285,7 +1322,8 @@ function startDaemonDetached(cfg, harness, spawnFn = realSpawn2) {
|
|
|
1285
1322
|
const starter = join5(dirname4(fileURLToPath2(import.meta.url)), "daemon-start.js");
|
|
1286
1323
|
const child = spawnFn("node", [starter, "--harness", harness], {
|
|
1287
1324
|
detached: true,
|
|
1288
|
-
stdio: "ignore"
|
|
1325
|
+
stdio: "ignore",
|
|
1326
|
+
windowsHide: true
|
|
1289
1327
|
});
|
|
1290
1328
|
child.on("error", () => {
|
|
1291
1329
|
});
|
|
@@ -15860,7 +15898,11 @@ import { execFileSync as execFileSync4 } from "child_process";
|
|
|
15860
15898
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
15861
15899
|
import { resolve } from "path";
|
|
15862
15900
|
function git(repo, ...args) {
|
|
15863
|
-
return execFileSync3("git", ["-C", repo, ...args], {
|
|
15901
|
+
return execFileSync3("git", ["-C", repo, ...args], {
|
|
15902
|
+
encoding: "utf8",
|
|
15903
|
+
maxBuffer: 1 << 28,
|
|
15904
|
+
windowsHide: true
|
|
15905
|
+
});
|
|
15864
15906
|
}
|
|
15865
15907
|
function repoNameOf(repo) {
|
|
15866
15908
|
return projectNameOf(resolve(repo));
|
|
@@ -15908,9 +15950,9 @@ var TOOL_GUIDE = `- hindsight_search_knowledge_pages(query) \u2014 FIRST STOP fo
|
|
|
15908
15950
|
- hindsight_reflect(query) \u2014 when pages are too shallow and you need the WHY: deep reasoning over the repo's full memory for the past decision and exact values that explain a behavior or bug (slower \u2014 use deliberately, and credit results with a blockquote header "> \u{1F9E0} **From Hindsight memory** \u2014 <summary>").
|
|
15909
15951
|
- hindsight_capture_initiative(title, summary) \u2014 right after the user approves a plan or finishes brainstorming a new feature/capability and you are about to start implementing (BEFORE you write any code), call this to record it as a tracked page; then call it AGAIN with relates_to_page_id set to that page whenever the goal, scope, or rationale materially changes mid-work, so the page tracks the current plan and not the opening one. Skip bug fixes, small tweaks, chores, and trivial course-corrections.
|
|
15910
15952
|
- hindsight_ingest_document(title, content) \u2014 save an external document or durable notes/findings you want remembered (not the current conversation \u2014 that is captured automatically at session end).`;
|
|
15911
|
-
var
|
|
15953
|
+
var PAGES_FIRST_ON_GOALS = "- The user just set a NEW task or goal \u2192 search the knowledge pages FIRST with hindsight_search_knowledge_pages. No synthesis is injected automatically in this configuration; call hindsight_reflect only when those pages are too shallow and deeper reasoning is needed.\n";
|
|
15912
15954
|
function toolGuide(opts) {
|
|
15913
|
-
return (opts?.reflectOnNewGoals ?
|
|
15955
|
+
return (opts?.reflectOnNewGoals ? PAGES_FIRST_ON_GOALS : "") + TOOL_GUIDE;
|
|
15914
15956
|
}
|
|
15915
15957
|
function buildKnowledgePreamble(pages, opts) {
|
|
15916
15958
|
const body = pages.length ? `Knowledge pages currently in this repository:
|
|
@@ -16126,6 +16168,7 @@ function startCodebaseSurvey(repoDir, opts = {}) {
|
|
|
16126
16168
|
cwd: repoDir,
|
|
16127
16169
|
detached: true,
|
|
16128
16170
|
stdio: "ignore",
|
|
16171
|
+
windowsHide: true,
|
|
16129
16172
|
env: plan.env
|
|
16130
16173
|
});
|
|
16131
16174
|
child.on("error", () => {
|
|
@@ -16142,7 +16185,8 @@ var DEEPEN_DIFF_TARGET = 300;
|
|
|
16142
16185
|
function commitCount(repoDir) {
|
|
16143
16186
|
try {
|
|
16144
16187
|
const out = execFileSync4("git", ["-C", repoDir, "rev-list", "--count", "HEAD"], {
|
|
16145
|
-
encoding: "utf8"
|
|
16188
|
+
encoding: "utf8",
|
|
16189
|
+
windowsHide: true
|
|
16146
16190
|
});
|
|
16147
16191
|
return Number(out.trim()) || 0;
|
|
16148
16192
|
} catch {
|
|
@@ -16651,7 +16695,10 @@ async function gitSyncNote(args) {
|
|
|
16651
16695
|
try {
|
|
16652
16696
|
const { execFileSync: execFileSync5 } = await import("child_process");
|
|
16653
16697
|
const n = Number(
|
|
16654
|
-
execFileSync5("git", ["-C", cwd, "rev-list", "--count", "HEAD"], {
|
|
16698
|
+
execFileSync5("git", ["-C", cwd, "rev-list", "--count", "HEAD"], {
|
|
16699
|
+
encoding: "utf8",
|
|
16700
|
+
windowsHide: true
|
|
16701
|
+
}).trim()
|
|
16655
16702
|
);
|
|
16656
16703
|
if (n > 0) target = Math.min(DEEPEN_DIFF_TARGET, n);
|
|
16657
16704
|
} catch {
|
package/dist/mcp-server.js
CHANGED
|
@@ -31022,14 +31022,36 @@ function getProjectRootFromGit(directory) {
|
|
|
31022
31022
|
const commonDir = execFileSync(
|
|
31023
31023
|
"git",
|
|
31024
31024
|
["rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
31025
|
-
{
|
|
31025
|
+
{
|
|
31026
|
+
cwd: directory,
|
|
31027
|
+
encoding: "utf-8",
|
|
31028
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
31029
|
+
timeout: 1e3,
|
|
31030
|
+
windowsHide: true
|
|
31031
|
+
}
|
|
31026
31032
|
).trim();
|
|
31027
31033
|
if (!commonDir) return null;
|
|
31028
|
-
|
|
31034
|
+
if (basename(commonDir) === ".git") return dirname2(commonDir);
|
|
31035
|
+
if (basename(commonDir).startsWith(".") && isBareRepository(commonDir)) {
|
|
31036
|
+
return dirname2(commonDir);
|
|
31037
|
+
}
|
|
31038
|
+
return commonDir;
|
|
31029
31039
|
} catch {
|
|
31030
31040
|
return null;
|
|
31031
31041
|
}
|
|
31032
31042
|
}
|
|
31043
|
+
function isBareRepository(commonDir) {
|
|
31044
|
+
try {
|
|
31045
|
+
return execFileSync("git", ["-C", commonDir, "rev-parse", "--is-bare-repository"], {
|
|
31046
|
+
encoding: "utf-8",
|
|
31047
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
31048
|
+
timeout: 1e3,
|
|
31049
|
+
env: { ...process.env, GIT_DIR: void 0, GIT_WORK_TREE: void 0 }
|
|
31050
|
+
}).trim() === "true";
|
|
31051
|
+
} catch {
|
|
31052
|
+
return false;
|
|
31053
|
+
}
|
|
31054
|
+
}
|
|
31033
31055
|
function projectNameOf(directory, sessionRoot) {
|
|
31034
31056
|
return gitProjectName(directory, true, sessionRoot);
|
|
31035
31057
|
}
|
|
@@ -31789,14 +31811,16 @@ var HindsightClient = class {
|
|
|
31789
31811
|
return;
|
|
31790
31812
|
}
|
|
31791
31813
|
if (r.status !== 409) created++;
|
|
31792
|
-
} else
|
|
31793
|
-
const
|
|
31794
|
-
|
|
31795
|
-
|
|
31796
|
-
|
|
31814
|
+
} else {
|
|
31815
|
+
const sourceDrift = hit.description !== page.source_query;
|
|
31816
|
+
const triggerDrift = hit.trigger != null && hit.trigger.tags_match !== pageTrigger.tags_match;
|
|
31817
|
+
if (!sourceDrift && !triggerDrift) continue;
|
|
31818
|
+
const patch = {};
|
|
31819
|
+
if (sourceDrift) {
|
|
31797
31820
|
patch.source_query = page.source_query;
|
|
31798
31821
|
patch.tags = page.tags;
|
|
31799
31822
|
}
|
|
31823
|
+
if (triggerDrift) patch.trigger = pageTrigger;
|
|
31800
31824
|
const r = await this.req(
|
|
31801
31825
|
"PATCH",
|
|
31802
31826
|
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(hit.id)}`),
|
|
@@ -32156,7 +32180,11 @@ import { execFileSync as execFileSync3 } from "child_process";
|
|
|
32156
32180
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
32157
32181
|
import { resolve } from "path";
|
|
32158
32182
|
function git(repo, ...args) {
|
|
32159
|
-
return execFileSync2("git", ["-C", repo, ...args], {
|
|
32183
|
+
return execFileSync2("git", ["-C", repo, ...args], {
|
|
32184
|
+
encoding: "utf8",
|
|
32185
|
+
maxBuffer: 1 << 28,
|
|
32186
|
+
windowsHide: true
|
|
32187
|
+
});
|
|
32160
32188
|
}
|
|
32161
32189
|
function repoNameOf(repo) {
|
|
32162
32190
|
return projectNameOf(resolve(repo));
|
|
@@ -32201,7 +32229,8 @@ var DEEPEN_DIFF_TARGET = 300;
|
|
|
32201
32229
|
function commitCount(repoDir) {
|
|
32202
32230
|
try {
|
|
32203
32231
|
const out = execFileSync3("git", ["-C", repoDir, "rev-list", "--count", "HEAD"], {
|
|
32204
|
-
encoding: "utf8"
|
|
32232
|
+
encoding: "utf8",
|
|
32233
|
+
windowsHide: true
|
|
32205
32234
|
});
|
|
32206
32235
|
return Number(out.trim()) || 0;
|
|
32207
32236
|
} catch {
|
package/dist/prime-agent.js
CHANGED
|
@@ -14545,7 +14545,8 @@ function startBackgroundSeed(repoDir, opts = {}) {
|
|
|
14545
14545
|
],
|
|
14546
14546
|
{
|
|
14547
14547
|
detached: true,
|
|
14548
|
-
stdio: "ignore"
|
|
14548
|
+
stdio: "ignore",
|
|
14549
|
+
windowsHide: true
|
|
14549
14550
|
}
|
|
14550
14551
|
);
|
|
14551
14552
|
child.on("error", () => {
|
|
@@ -14585,14 +14586,36 @@ function getProjectRootFromGit(directory) {
|
|
|
14585
14586
|
const commonDir = execFileSync(
|
|
14586
14587
|
"git",
|
|
14587
14588
|
["rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
14588
|
-
{
|
|
14589
|
+
{
|
|
14590
|
+
cwd: directory,
|
|
14591
|
+
encoding: "utf-8",
|
|
14592
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
14593
|
+
timeout: 1e3,
|
|
14594
|
+
windowsHide: true
|
|
14595
|
+
}
|
|
14589
14596
|
).trim();
|
|
14590
14597
|
if (!commonDir) return null;
|
|
14591
|
-
|
|
14598
|
+
if (basename(commonDir) === ".git") return dirname2(commonDir);
|
|
14599
|
+
if (basename(commonDir).startsWith(".") && isBareRepository(commonDir)) {
|
|
14600
|
+
return dirname2(commonDir);
|
|
14601
|
+
}
|
|
14602
|
+
return commonDir;
|
|
14592
14603
|
} catch {
|
|
14593
14604
|
return null;
|
|
14594
14605
|
}
|
|
14595
14606
|
}
|
|
14607
|
+
function isBareRepository(commonDir) {
|
|
14608
|
+
try {
|
|
14609
|
+
return execFileSync("git", ["-C", commonDir, "rev-parse", "--is-bare-repository"], {
|
|
14610
|
+
encoding: "utf-8",
|
|
14611
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
14612
|
+
timeout: 1e3,
|
|
14613
|
+
env: { ...process.env, GIT_DIR: void 0, GIT_WORK_TREE: void 0 }
|
|
14614
|
+
}).trim() === "true";
|
|
14615
|
+
} catch {
|
|
14616
|
+
return false;
|
|
14617
|
+
}
|
|
14618
|
+
}
|
|
14596
14619
|
function projectNameOf(directory, sessionRoot) {
|
|
14597
14620
|
return gitProjectName(directory, true, sessionRoot);
|
|
14598
14621
|
}
|
|
@@ -15355,14 +15378,16 @@ var HindsightClient = class {
|
|
|
15355
15378
|
return;
|
|
15356
15379
|
}
|
|
15357
15380
|
if (r.status !== 409) created++;
|
|
15358
|
-
} else
|
|
15359
|
-
const
|
|
15360
|
-
|
|
15361
|
-
|
|
15362
|
-
|
|
15381
|
+
} else {
|
|
15382
|
+
const sourceDrift = hit.description !== page.source_query;
|
|
15383
|
+
const triggerDrift = hit.trigger != null && hit.trigger.tags_match !== pageTrigger.tags_match;
|
|
15384
|
+
if (!sourceDrift && !triggerDrift) continue;
|
|
15385
|
+
const patch = {};
|
|
15386
|
+
if (sourceDrift) {
|
|
15363
15387
|
patch.source_query = page.source_query;
|
|
15364
15388
|
patch.tags = page.tags;
|
|
15365
15389
|
}
|
|
15390
|
+
if (triggerDrift) patch.trigger = pageTrigger;
|
|
15366
15391
|
const r = await this.req(
|
|
15367
15392
|
"PATCH",
|
|
15368
15393
|
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(hit.id)}`),
|
|
@@ -15743,7 +15768,11 @@ async function isServerHealthy(baseUrl, timeoutMs = 2e3) {
|
|
|
15743
15768
|
function hasRustToolchain() {
|
|
15744
15769
|
if (process.platform !== "darwin") return true;
|
|
15745
15770
|
try {
|
|
15746
|
-
execFileSync2("cargo", ["--version"], {
|
|
15771
|
+
execFileSync2("cargo", ["--version"], {
|
|
15772
|
+
stdio: "pipe",
|
|
15773
|
+
timeout: 1e4,
|
|
15774
|
+
windowsHide: true
|
|
15775
|
+
});
|
|
15747
15776
|
return true;
|
|
15748
15777
|
} catch {
|
|
15749
15778
|
return false;
|
|
@@ -15751,7 +15780,11 @@ function hasRustToolchain() {
|
|
|
15751
15780
|
}
|
|
15752
15781
|
function hasUvx() {
|
|
15753
15782
|
try {
|
|
15754
|
-
execFileSync2("uvx", ["--version"], {
|
|
15783
|
+
execFileSync2("uvx", ["--version"], {
|
|
15784
|
+
stdio: "pipe",
|
|
15785
|
+
timeout: 1e4,
|
|
15786
|
+
windowsHide: true
|
|
15787
|
+
});
|
|
15755
15788
|
return true;
|
|
15756
15789
|
} catch {
|
|
15757
15790
|
return false;
|
|
@@ -15783,7 +15816,11 @@ function detectLlm(env = process.env) {
|
|
|
15783
15816
|
}
|
|
15784
15817
|
function onPath(bin) {
|
|
15785
15818
|
try {
|
|
15786
|
-
execFileSync2("which", [bin], {
|
|
15819
|
+
execFileSync2("which", [bin], {
|
|
15820
|
+
stdio: "pipe",
|
|
15821
|
+
timeout: 5e3,
|
|
15822
|
+
windowsHide: true
|
|
15823
|
+
});
|
|
15787
15824
|
return true;
|
|
15788
15825
|
} catch {
|
|
15789
15826
|
return false;
|
|
@@ -15794,7 +15831,8 @@ function startDaemonDetached(cfg, harness, spawnFn = realSpawn2) {
|
|
|
15794
15831
|
const starter = join5(dirname4(fileURLToPath2(import.meta.url)), "daemon-start.js");
|
|
15795
15832
|
const child = spawnFn("node", [starter, "--harness", harness], {
|
|
15796
15833
|
detached: true,
|
|
15797
|
-
stdio: "ignore"
|
|
15834
|
+
stdio: "ignore",
|
|
15835
|
+
windowsHide: true
|
|
15798
15836
|
});
|
|
15799
15837
|
child.on("error", () => {
|
|
15800
15838
|
});
|
|
@@ -15855,7 +15893,11 @@ import { execFileSync as execFileSync4 } from "child_process";
|
|
|
15855
15893
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
15856
15894
|
import { resolve } from "path";
|
|
15857
15895
|
function git(repo, ...args) {
|
|
15858
|
-
return execFileSync3("git", ["-C", repo, ...args], {
|
|
15896
|
+
return execFileSync3("git", ["-C", repo, ...args], {
|
|
15897
|
+
encoding: "utf8",
|
|
15898
|
+
maxBuffer: 1 << 28,
|
|
15899
|
+
windowsHide: true
|
|
15900
|
+
});
|
|
15859
15901
|
}
|
|
15860
15902
|
function repoNameOf(repo) {
|
|
15861
15903
|
return projectNameOf(resolve(repo));
|
|
@@ -15903,9 +15945,9 @@ var TOOL_GUIDE = `- hindsight_search_knowledge_pages(query) \u2014 FIRST STOP fo
|
|
|
15903
15945
|
- hindsight_reflect(query) \u2014 when pages are too shallow and you need the WHY: deep reasoning over the repo's full memory for the past decision and exact values that explain a behavior or bug (slower \u2014 use deliberately, and credit results with a blockquote header "> \u{1F9E0} **From Hindsight memory** \u2014 <summary>").
|
|
15904
15946
|
- hindsight_capture_initiative(title, summary) \u2014 right after the user approves a plan or finishes brainstorming a new feature/capability and you are about to start implementing (BEFORE you write any code), call this to record it as a tracked page; then call it AGAIN with relates_to_page_id set to that page whenever the goal, scope, or rationale materially changes mid-work, so the page tracks the current plan and not the opening one. Skip bug fixes, small tweaks, chores, and trivial course-corrections.
|
|
15905
15947
|
- hindsight_ingest_document(title, content) \u2014 save an external document or durable notes/findings you want remembered (not the current conversation \u2014 that is captured automatically at session end).`;
|
|
15906
|
-
var
|
|
15948
|
+
var PAGES_FIRST_ON_GOALS = "- The user just set a NEW task or goal \u2192 search the knowledge pages FIRST with hindsight_search_knowledge_pages. No synthesis is injected automatically in this configuration; call hindsight_reflect only when those pages are too shallow and deeper reasoning is needed.\n";
|
|
15907
15949
|
function toolGuide(opts) {
|
|
15908
|
-
return (opts?.reflectOnNewGoals ?
|
|
15950
|
+
return (opts?.reflectOnNewGoals ? PAGES_FIRST_ON_GOALS : "") + TOOL_GUIDE;
|
|
15909
15951
|
}
|
|
15910
15952
|
function buildKnowledgePreamble(pages, opts) {
|
|
15911
15953
|
const body = pages.length ? `Knowledge pages currently in this repository:
|
|
@@ -16110,6 +16152,7 @@ function startCodebaseSurvey(repoDir, opts = {}) {
|
|
|
16110
16152
|
cwd: repoDir,
|
|
16111
16153
|
detached: true,
|
|
16112
16154
|
stdio: "ignore",
|
|
16155
|
+
windowsHide: true,
|
|
16113
16156
|
env: plan.env
|
|
16114
16157
|
});
|
|
16115
16158
|
child.on("error", () => {
|
|
@@ -16126,7 +16169,8 @@ var DEEPEN_DIFF_TARGET = 300;
|
|
|
16126
16169
|
function commitCount(repoDir) {
|
|
16127
16170
|
try {
|
|
16128
16171
|
const out = execFileSync4("git", ["-C", repoDir, "rev-list", "--count", "HEAD"], {
|
|
16129
|
-
encoding: "utf8"
|
|
16172
|
+
encoding: "utf8",
|
|
16173
|
+
windowsHide: true
|
|
16130
16174
|
});
|
|
16131
16175
|
return Number(out.trim()) || 0;
|
|
16132
16176
|
} catch {
|
|
@@ -16635,7 +16679,10 @@ async function gitSyncNote(args) {
|
|
|
16635
16679
|
try {
|
|
16636
16680
|
const { execFileSync: execFileSync5 } = await import("child_process");
|
|
16637
16681
|
const n = Number(
|
|
16638
|
-
execFileSync5("git", ["-C", cwd, "rev-list", "--count", "HEAD"], {
|
|
16682
|
+
execFileSync5("git", ["-C", cwd, "rev-list", "--count", "HEAD"], {
|
|
16683
|
+
encoding: "utf8",
|
|
16684
|
+
windowsHide: true
|
|
16685
|
+
}).trim()
|
|
16639
16686
|
);
|
|
16640
16687
|
if (n > 0) target = Math.min(DEEPEN_DIFF_TARGET, n);
|
|
16641
16688
|
} catch {
|