@vectorize-io/hindsight-coding-agents 0.4.0 → 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 +56 -25
- package/dist/antigravity-statusline.js +24 -2
- package/dist/antigravity-stop-hook.js +69 -26
- package/dist/claude-hook.js +56 -25
- package/dist/claude-sessionstart-hook.js +83 -31
- package/dist/claude-stop-hook.js +69 -26
- package/dist/cline.js +85 -32
- package/dist/codex-hook.js +56 -25
- package/dist/codex-sessionstart-hook.js +83 -31
- package/dist/codex-stop-hook.js +69 -26
- package/dist/copilot-hook.js +56 -25
- package/dist/copilot-sessionstart-hook.js +83 -31
- package/dist/copilot-stop-hook.js +69 -26
- package/dist/cursor-hook.js +56 -25
- package/dist/cursor-sessionstart-hook.js +83 -31
- package/dist/cursor-stop-hook.js +69 -26
- package/dist/daemon-start.js +15 -3
- package/dist/deepen.js +58 -24
- package/dist/devin-hook.js +56 -25
- package/dist/devin-sessionstart-hook.js +83 -31
- package/dist/devin-stop-hook.js +69 -26
- package/dist/dsh.js +85 -32
- package/dist/grok-hook.js +56 -25
- package/dist/grok-sessionstart-hook.js +83 -31
- package/dist/grok-stop-hook.js +69 -26
- package/dist/hindsight-seed.js +26 -3
- package/dist/index.js +85 -32
- package/dist/installer.js +16 -4
- package/dist/kilo.js +85 -32
- package/dist/mcp-server.js +59 -24
- package/dist/prime-agent.js +85 -32
- package/dist/status.js +59 -24
- 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
|
}
|
|
@@ -322,7 +345,7 @@ var PAGE_TAXONOMY = [
|
|
|
322
345
|
},
|
|
323
346
|
{
|
|
324
347
|
name: "Initiatives and enhancements",
|
|
325
|
-
source_query: "Based on this repository's commit history, what are the major initiatives, features, and enhancements the project has worked on? Summarize the themes and notable changes over time. When a source memory carries a
|
|
348
|
+
source_query: "Based on this repository's commit history, what are the major initiatives, features, and enhancements the project has worked on? Summarize the themes and notable changes over time. When a source memory's context carries a `[[page:<id>]]` link, repeat that link in the summary of what it describes, so each initiative links to its detailed page.",
|
|
326
349
|
tags: ["knowledge:feature-work"]
|
|
327
350
|
}
|
|
328
351
|
];
|
|
@@ -331,9 +354,10 @@ function pagesFor(project) {
|
|
|
331
354
|
return PAGE_TAXONOMY.map((page) => ({ ...page, source_query: page.source_query + scope }));
|
|
332
355
|
}
|
|
333
356
|
var PAGE_MAX_TOKENS = 4096;
|
|
357
|
+
var PAGE_TAGS_MATCH = "all";
|
|
334
358
|
var PAGE_FACT_TYPES = ["world", "experience", "observation"];
|
|
335
359
|
function buildPageTrigger(cfg = {}) {
|
|
336
|
-
const base = { fact_types: PAGE_FACT_TYPES };
|
|
360
|
+
const base = { fact_types: PAGE_FACT_TYPES, tags_match: PAGE_TAGS_MATCH };
|
|
337
361
|
switch (cfg.pageTriggerType) {
|
|
338
362
|
case "cron":
|
|
339
363
|
return { ...base, refresh_cron: cfg.pageTriggerCron };
|
|
@@ -843,11 +867,20 @@ var HindsightClient = class {
|
|
|
843
867
|
return;
|
|
844
868
|
}
|
|
845
869
|
if (r.status !== 409) created++;
|
|
846
|
-
} else
|
|
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) {
|
|
876
|
+
patch.source_query = page.source_query;
|
|
877
|
+
patch.tags = page.tags;
|
|
878
|
+
}
|
|
879
|
+
if (triggerDrift) patch.trigger = pageTrigger;
|
|
847
880
|
const r = await this.req(
|
|
848
881
|
"PATCH",
|
|
849
882
|
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(hit.id)}`),
|
|
850
|
-
|
|
883
|
+
patch
|
|
851
884
|
);
|
|
852
885
|
if ([404, 405, 501].includes(r.status)) {
|
|
853
886
|
this.knowledgePagesSupported = false;
|
|
@@ -868,10 +901,17 @@ var HindsightClient = class {
|
|
|
868
901
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "initiative";
|
|
869
902
|
}
|
|
870
903
|
/**
|
|
871
|
-
* Active-path capture: register a major feature as a per-initiative page + a
|
|
872
|
-
* New initiative → creates a page under the Initiatives folder
|
|
904
|
+
* Active-path capture: register a major feature as a per-initiative page + a marker memory.
|
|
905
|
+
* New initiative → creates a page under the Initiatives folder.
|
|
873
906
|
* Update (relatesToPageId) → no new page; only a marker accruing to the existing page, so an
|
|
874
907
|
* enhancement or a mid-work plan change lands on the initiative it belongs to.
|
|
908
|
+
*
|
|
909
|
+
* The marker carries its page id in two places, neither of them a tag (#3641):
|
|
910
|
+
* `metadata.relatedPageId` for provenance (visible on the document, and to a reflect loop that
|
|
911
|
+
* expands one), and a `[[page:<id>]]` link in the retain CONTEXT, which is the only one of the
|
|
912
|
+
* three channels a page synthesis actually reads — reflect's search results keep `context` and
|
|
913
|
+
* `tags` but strip `metadata` (`_UNREAD_RESULT_FIELDS`), and the id has no business in a tag
|
|
914
|
+
* vocabulary that exists to be matched with exact set-ops.
|
|
875
915
|
*/
|
|
876
916
|
async captureInitiative(args) {
|
|
877
917
|
let pageId = args.relatesToPageId;
|
|
@@ -894,20 +934,11 @@ var HindsightClient = class {
|
|
|
894
934
|
const verb = args.relatesToPageId ? "Update to an existing initiative" : "New initiative";
|
|
895
935
|
const content = `${verb}: ${args.title}. ${args.summary}`;
|
|
896
936
|
const markerId = `initiative-marker-${this.slugify(args.title)}-${Date.now()}`;
|
|
897
|
-
const tags = [
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
])
|
|
903
|
-
];
|
|
904
|
-
if (Object.keys(args.stamp?.metadata ?? {}).length) {
|
|
905
|
-
await this.retain(content, "initiative marker", markerId, tags, "document", {
|
|
906
|
-
metadata: args.stamp?.metadata
|
|
907
|
-
});
|
|
908
|
-
} else {
|
|
909
|
-
await this.retain(content, "initiative marker", markerId, tags, "document");
|
|
910
|
-
}
|
|
937
|
+
const tags = [.../* @__PURE__ */ new Set([...args.stamp?.tags ?? [], "knowledge:feature-work"])];
|
|
938
|
+
const context = `initiative marker for [[page:${pageId}]]`;
|
|
939
|
+
await this.retain(content, context, markerId, tags, "document", {
|
|
940
|
+
metadata: { ...args.stamp?.metadata ?? {}, relatedPageId: pageId }
|
|
941
|
+
});
|
|
911
942
|
return { page_id: pageId };
|
|
912
943
|
}
|
|
913
944
|
/** Find a root folder by name (case-insensitive) or create it; returns its id. Fail-open to undefined. */
|
|
@@ -1228,7 +1259,11 @@ async function isServerHealthy(baseUrl, timeoutMs = 2e3) {
|
|
|
1228
1259
|
function hasRustToolchain() {
|
|
1229
1260
|
if (process.platform !== "darwin") return true;
|
|
1230
1261
|
try {
|
|
1231
|
-
execFileSync2("cargo", ["--version"], {
|
|
1262
|
+
execFileSync2("cargo", ["--version"], {
|
|
1263
|
+
stdio: "pipe",
|
|
1264
|
+
timeout: 1e4,
|
|
1265
|
+
windowsHide: true
|
|
1266
|
+
});
|
|
1232
1267
|
return true;
|
|
1233
1268
|
} catch {
|
|
1234
1269
|
return false;
|
|
@@ -1236,7 +1271,11 @@ function hasRustToolchain() {
|
|
|
1236
1271
|
}
|
|
1237
1272
|
function hasUvx() {
|
|
1238
1273
|
try {
|
|
1239
|
-
execFileSync2("uvx", ["--version"], {
|
|
1274
|
+
execFileSync2("uvx", ["--version"], {
|
|
1275
|
+
stdio: "pipe",
|
|
1276
|
+
timeout: 1e4,
|
|
1277
|
+
windowsHide: true
|
|
1278
|
+
});
|
|
1240
1279
|
return true;
|
|
1241
1280
|
} catch {
|
|
1242
1281
|
return false;
|
|
@@ -1268,7 +1307,11 @@ function detectLlm(env = process.env) {
|
|
|
1268
1307
|
}
|
|
1269
1308
|
function onPath(bin) {
|
|
1270
1309
|
try {
|
|
1271
|
-
execFileSync2("which", [bin], {
|
|
1310
|
+
execFileSync2("which", [bin], {
|
|
1311
|
+
stdio: "pipe",
|
|
1312
|
+
timeout: 5e3,
|
|
1313
|
+
windowsHide: true
|
|
1314
|
+
});
|
|
1272
1315
|
return true;
|
|
1273
1316
|
} catch {
|
|
1274
1317
|
return false;
|
|
@@ -1279,7 +1322,8 @@ function startDaemonDetached(cfg, harness, spawnFn = realSpawn2) {
|
|
|
1279
1322
|
const starter = join5(dirname4(fileURLToPath2(import.meta.url)), "daemon-start.js");
|
|
1280
1323
|
const child = spawnFn("node", [starter, "--harness", harness], {
|
|
1281
1324
|
detached: true,
|
|
1282
|
-
stdio: "ignore"
|
|
1325
|
+
stdio: "ignore",
|
|
1326
|
+
windowsHide: true
|
|
1283
1327
|
});
|
|
1284
1328
|
child.on("error", () => {
|
|
1285
1329
|
});
|
|
@@ -15854,7 +15898,11 @@ import { execFileSync as execFileSync4 } from "child_process";
|
|
|
15854
15898
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
15855
15899
|
import { resolve } from "path";
|
|
15856
15900
|
function git(repo, ...args) {
|
|
15857
|
-
return execFileSync3("git", ["-C", repo, ...args], {
|
|
15901
|
+
return execFileSync3("git", ["-C", repo, ...args], {
|
|
15902
|
+
encoding: "utf8",
|
|
15903
|
+
maxBuffer: 1 << 28,
|
|
15904
|
+
windowsHide: true
|
|
15905
|
+
});
|
|
15858
15906
|
}
|
|
15859
15907
|
function repoNameOf(repo) {
|
|
15860
15908
|
return projectNameOf(resolve(repo));
|
|
@@ -15902,9 +15950,9 @@ var TOOL_GUIDE = `- hindsight_search_knowledge_pages(query) \u2014 FIRST STOP fo
|
|
|
15902
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>").
|
|
15903
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.
|
|
15904
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).`;
|
|
15905
|
-
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";
|
|
15906
15954
|
function toolGuide(opts) {
|
|
15907
|
-
return (opts?.reflectOnNewGoals ?
|
|
15955
|
+
return (opts?.reflectOnNewGoals ? PAGES_FIRST_ON_GOALS : "") + TOOL_GUIDE;
|
|
15908
15956
|
}
|
|
15909
15957
|
function buildKnowledgePreamble(pages, opts) {
|
|
15910
15958
|
const body = pages.length ? `Knowledge pages currently in this repository:
|
|
@@ -16120,6 +16168,7 @@ function startCodebaseSurvey(repoDir, opts = {}) {
|
|
|
16120
16168
|
cwd: repoDir,
|
|
16121
16169
|
detached: true,
|
|
16122
16170
|
stdio: "ignore",
|
|
16171
|
+
windowsHide: true,
|
|
16123
16172
|
env: plan.env
|
|
16124
16173
|
});
|
|
16125
16174
|
child.on("error", () => {
|
|
@@ -16136,7 +16185,8 @@ var DEEPEN_DIFF_TARGET = 300;
|
|
|
16136
16185
|
function commitCount(repoDir) {
|
|
16137
16186
|
try {
|
|
16138
16187
|
const out = execFileSync4("git", ["-C", repoDir, "rev-list", "--count", "HEAD"], {
|
|
16139
|
-
encoding: "utf8"
|
|
16188
|
+
encoding: "utf8",
|
|
16189
|
+
windowsHide: true
|
|
16140
16190
|
});
|
|
16141
16191
|
return Number(out.trim()) || 0;
|
|
16142
16192
|
} catch {
|
|
@@ -16645,7 +16695,10 @@ async function gitSyncNote(args) {
|
|
|
16645
16695
|
try {
|
|
16646
16696
|
const { execFileSync: execFileSync5 } = await import("child_process");
|
|
16647
16697
|
const n = Number(
|
|
16648
|
-
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()
|
|
16649
16702
|
);
|
|
16650
16703
|
if (n > 0) target = Math.min(DEEPEN_DIFF_TARGET, n);
|
|
16651
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
|
}
|
|
@@ -322,7 +345,7 @@ var PAGE_TAXONOMY = [
|
|
|
322
345
|
},
|
|
323
346
|
{
|
|
324
347
|
name: "Initiatives and enhancements",
|
|
325
|
-
source_query: "Based on this repository's commit history, what are the major initiatives, features, and enhancements the project has worked on? Summarize the themes and notable changes over time. When a source memory carries a
|
|
348
|
+
source_query: "Based on this repository's commit history, what are the major initiatives, features, and enhancements the project has worked on? Summarize the themes and notable changes over time. When a source memory's context carries a `[[page:<id>]]` link, repeat that link in the summary of what it describes, so each initiative links to its detailed page.",
|
|
326
349
|
tags: ["knowledge:feature-work"]
|
|
327
350
|
}
|
|
328
351
|
];
|
|
@@ -331,9 +354,10 @@ function pagesFor(project) {
|
|
|
331
354
|
return PAGE_TAXONOMY.map((page) => ({ ...page, source_query: page.source_query + scope }));
|
|
332
355
|
}
|
|
333
356
|
var PAGE_MAX_TOKENS = 4096;
|
|
357
|
+
var PAGE_TAGS_MATCH = "all";
|
|
334
358
|
var PAGE_FACT_TYPES = ["world", "experience", "observation"];
|
|
335
359
|
function buildPageTrigger(cfg = {}) {
|
|
336
|
-
const base = { fact_types: PAGE_FACT_TYPES };
|
|
360
|
+
const base = { fact_types: PAGE_FACT_TYPES, tags_match: PAGE_TAGS_MATCH };
|
|
337
361
|
switch (cfg.pageTriggerType) {
|
|
338
362
|
case "cron":
|
|
339
363
|
return { ...base, refresh_cron: cfg.pageTriggerCron };
|
|
@@ -843,11 +867,20 @@ var HindsightClient = class {
|
|
|
843
867
|
return;
|
|
844
868
|
}
|
|
845
869
|
if (r.status !== 409) created++;
|
|
846
|
-
} else
|
|
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) {
|
|
876
|
+
patch.source_query = page.source_query;
|
|
877
|
+
patch.tags = page.tags;
|
|
878
|
+
}
|
|
879
|
+
if (triggerDrift) patch.trigger = pageTrigger;
|
|
847
880
|
const r = await this.req(
|
|
848
881
|
"PATCH",
|
|
849
882
|
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(hit.id)}`),
|
|
850
|
-
|
|
883
|
+
patch
|
|
851
884
|
);
|
|
852
885
|
if ([404, 405, 501].includes(r.status)) {
|
|
853
886
|
this.knowledgePagesSupported = false;
|
|
@@ -868,10 +901,17 @@ var HindsightClient = class {
|
|
|
868
901
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "initiative";
|
|
869
902
|
}
|
|
870
903
|
/**
|
|
871
|
-
* Active-path capture: register a major feature as a per-initiative page + a
|
|
872
|
-
* New initiative → creates a page under the Initiatives folder
|
|
904
|
+
* Active-path capture: register a major feature as a per-initiative page + a marker memory.
|
|
905
|
+
* New initiative → creates a page under the Initiatives folder.
|
|
873
906
|
* Update (relatesToPageId) → no new page; only a marker accruing to the existing page, so an
|
|
874
907
|
* enhancement or a mid-work plan change lands on the initiative it belongs to.
|
|
908
|
+
*
|
|
909
|
+
* The marker carries its page id in two places, neither of them a tag (#3641):
|
|
910
|
+
* `metadata.relatedPageId` for provenance (visible on the document, and to a reflect loop that
|
|
911
|
+
* expands one), and a `[[page:<id>]]` link in the retain CONTEXT, which is the only one of the
|
|
912
|
+
* three channels a page synthesis actually reads — reflect's search results keep `context` and
|
|
913
|
+
* `tags` but strip `metadata` (`_UNREAD_RESULT_FIELDS`), and the id has no business in a tag
|
|
914
|
+
* vocabulary that exists to be matched with exact set-ops.
|
|
875
915
|
*/
|
|
876
916
|
async captureInitiative(args) {
|
|
877
917
|
let pageId = args.relatesToPageId;
|
|
@@ -894,20 +934,11 @@ var HindsightClient = class {
|
|
|
894
934
|
const verb = args.relatesToPageId ? "Update to an existing initiative" : "New initiative";
|
|
895
935
|
const content = `${verb}: ${args.title}. ${args.summary}`;
|
|
896
936
|
const markerId = `initiative-marker-${this.slugify(args.title)}-${Date.now()}`;
|
|
897
|
-
const tags = [
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
])
|
|
903
|
-
];
|
|
904
|
-
if (Object.keys(args.stamp?.metadata ?? {}).length) {
|
|
905
|
-
await this.retain(content, "initiative marker", markerId, tags, "document", {
|
|
906
|
-
metadata: args.stamp?.metadata
|
|
907
|
-
});
|
|
908
|
-
} else {
|
|
909
|
-
await this.retain(content, "initiative marker", markerId, tags, "document");
|
|
910
|
-
}
|
|
937
|
+
const tags = [.../* @__PURE__ */ new Set([...args.stamp?.tags ?? [], "knowledge:feature-work"])];
|
|
938
|
+
const context = `initiative marker for [[page:${pageId}]]`;
|
|
939
|
+
await this.retain(content, context, markerId, tags, "document", {
|
|
940
|
+
metadata: { ...args.stamp?.metadata ?? {}, relatedPageId: pageId }
|
|
941
|
+
});
|
|
911
942
|
return { page_id: pageId };
|
|
912
943
|
}
|
|
913
944
|
/** Find a root folder by name (case-insensitive) or create it; returns its id. Fail-open to undefined. */
|
|
@@ -1228,7 +1259,11 @@ async function isServerHealthy(baseUrl, timeoutMs = 2e3) {
|
|
|
1228
1259
|
function hasRustToolchain() {
|
|
1229
1260
|
if (process.platform !== "darwin") return true;
|
|
1230
1261
|
try {
|
|
1231
|
-
execFileSync2("cargo", ["--version"], {
|
|
1262
|
+
execFileSync2("cargo", ["--version"], {
|
|
1263
|
+
stdio: "pipe",
|
|
1264
|
+
timeout: 1e4,
|
|
1265
|
+
windowsHide: true
|
|
1266
|
+
});
|
|
1232
1267
|
return true;
|
|
1233
1268
|
} catch {
|
|
1234
1269
|
return false;
|
|
@@ -1236,7 +1271,11 @@ function hasRustToolchain() {
|
|
|
1236
1271
|
}
|
|
1237
1272
|
function hasUvx() {
|
|
1238
1273
|
try {
|
|
1239
|
-
execFileSync2("uvx", ["--version"], {
|
|
1274
|
+
execFileSync2("uvx", ["--version"], {
|
|
1275
|
+
stdio: "pipe",
|
|
1276
|
+
timeout: 1e4,
|
|
1277
|
+
windowsHide: true
|
|
1278
|
+
});
|
|
1240
1279
|
return true;
|
|
1241
1280
|
} catch {
|
|
1242
1281
|
return false;
|
|
@@ -1268,7 +1307,11 @@ function detectLlm(env = process.env) {
|
|
|
1268
1307
|
}
|
|
1269
1308
|
function onPath(bin) {
|
|
1270
1309
|
try {
|
|
1271
|
-
execFileSync2("which", [bin], {
|
|
1310
|
+
execFileSync2("which", [bin], {
|
|
1311
|
+
stdio: "pipe",
|
|
1312
|
+
timeout: 5e3,
|
|
1313
|
+
windowsHide: true
|
|
1314
|
+
});
|
|
1272
1315
|
return true;
|
|
1273
1316
|
} catch {
|
|
1274
1317
|
return false;
|
|
@@ -1279,7 +1322,8 @@ function startDaemonDetached(cfg, harness, spawnFn = realSpawn2) {
|
|
|
1279
1322
|
const starter = join5(dirname4(fileURLToPath2(import.meta.url)), "daemon-start.js");
|
|
1280
1323
|
const child = spawnFn("node", [starter, "--harness", harness], {
|
|
1281
1324
|
detached: true,
|
|
1282
|
-
stdio: "ignore"
|
|
1325
|
+
stdio: "ignore",
|
|
1326
|
+
windowsHide: true
|
|
1283
1327
|
});
|
|
1284
1328
|
child.on("error", () => {
|
|
1285
1329
|
});
|
|
@@ -15854,7 +15898,11 @@ import { execFileSync as execFileSync4 } from "child_process";
|
|
|
15854
15898
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
15855
15899
|
import { resolve } from "path";
|
|
15856
15900
|
function git(repo, ...args) {
|
|
15857
|
-
return execFileSync3("git", ["-C", repo, ...args], {
|
|
15901
|
+
return execFileSync3("git", ["-C", repo, ...args], {
|
|
15902
|
+
encoding: "utf8",
|
|
15903
|
+
maxBuffer: 1 << 28,
|
|
15904
|
+
windowsHide: true
|
|
15905
|
+
});
|
|
15858
15906
|
}
|
|
15859
15907
|
function repoNameOf(repo) {
|
|
15860
15908
|
return projectNameOf(resolve(repo));
|
|
@@ -15902,9 +15950,9 @@ var TOOL_GUIDE = `- hindsight_search_knowledge_pages(query) \u2014 FIRST STOP fo
|
|
|
15902
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>").
|
|
15903
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.
|
|
15904
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).`;
|
|
15905
|
-
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";
|
|
15906
15954
|
function toolGuide(opts) {
|
|
15907
|
-
return (opts?.reflectOnNewGoals ?
|
|
15955
|
+
return (opts?.reflectOnNewGoals ? PAGES_FIRST_ON_GOALS : "") + TOOL_GUIDE;
|
|
15908
15956
|
}
|
|
15909
15957
|
function buildKnowledgePreamble(pages, opts) {
|
|
15910
15958
|
const body = pages.length ? `Knowledge pages currently in this repository:
|
|
@@ -16120,6 +16168,7 @@ function startCodebaseSurvey(repoDir, opts = {}) {
|
|
|
16120
16168
|
cwd: repoDir,
|
|
16121
16169
|
detached: true,
|
|
16122
16170
|
stdio: "ignore",
|
|
16171
|
+
windowsHide: true,
|
|
16123
16172
|
env: plan.env
|
|
16124
16173
|
});
|
|
16125
16174
|
child.on("error", () => {
|
|
@@ -16136,7 +16185,8 @@ var DEEPEN_DIFF_TARGET = 300;
|
|
|
16136
16185
|
function commitCount(repoDir) {
|
|
16137
16186
|
try {
|
|
16138
16187
|
const out = execFileSync4("git", ["-C", repoDir, "rev-list", "--count", "HEAD"], {
|
|
16139
|
-
encoding: "utf8"
|
|
16188
|
+
encoding: "utf8",
|
|
16189
|
+
windowsHide: true
|
|
16140
16190
|
});
|
|
16141
16191
|
return Number(out.trim()) || 0;
|
|
16142
16192
|
} catch {
|
|
@@ -16645,7 +16695,10 @@ async function gitSyncNote(args) {
|
|
|
16645
16695
|
try {
|
|
16646
16696
|
const { execFileSync: execFileSync5 } = await import("child_process");
|
|
16647
16697
|
const n = Number(
|
|
16648
|
-
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()
|
|
16649
16702
|
);
|
|
16650
16703
|
if (n > 0) target = Math.min(DEEPEN_DIFF_TARGET, n);
|
|
16651
16704
|
} catch {
|