@vectorize-io/hindsight-coding-agents 0.8.1 → 0.8.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.
Files changed (62) hide show
  1. package/README.md +6 -2
  2. package/dist/antigravity-hook.js +4 -1
  3. package/dist/antigravity-statusline.js +1 -1
  4. package/dist/antigravity-stop-hook.js +4 -1
  5. package/dist/claude-hook.js +4 -1
  6. package/dist/claude-sessionstart-hook.js +4 -1
  7. package/dist/claude-stop-hook.js +4 -1
  8. package/dist/cline.js +33 -28
  9. package/dist/codebuddy-hook.js +4 -1
  10. package/dist/codebuddy-sessionstart-hook.js +4 -1
  11. package/dist/codebuddy-stop-hook.js +4 -1
  12. package/dist/codex-hook.js +4 -1
  13. package/dist/codex-sessionstart-hook.js +4 -1
  14. package/dist/codex-stop-hook.js +4 -1
  15. package/dist/copilot-hook.js +4 -1
  16. package/dist/copilot-sessionstart-hook.js +4 -1
  17. package/dist/copilot-stop-hook.js +4 -1
  18. package/dist/cursor-hook.js +4 -1
  19. package/dist/cursor-sessionstart-hook.js +4 -1
  20. package/dist/cursor-stop-hook.js +4 -1
  21. package/dist/daemon-start.js +1 -1
  22. package/dist/dcode-hook.js +4 -1
  23. package/dist/dcode-sessionstart-hook.js +4 -1
  24. package/dist/dcode-stop-hook.js +4 -1
  25. package/dist/deepen.js +113 -31
  26. package/dist/devin-hook.js +4 -1
  27. package/dist/devin-sessionstart-hook.js +4 -1
  28. package/dist/devin-stop-hook.js +4 -1
  29. package/dist/droid-hook.js +4 -1
  30. package/dist/droid-sessionstart-hook.js +4 -1
  31. package/dist/droid-stop-hook.js +4 -1
  32. package/dist/dsh.js +33 -28
  33. package/dist/grok-hook.js +4 -1
  34. package/dist/grok-sessionstart-hook.js +4 -1
  35. package/dist/grok-stop-hook.js +4 -1
  36. package/dist/hindsight-seed.js +1 -1
  37. package/dist/index.js +33 -28
  38. package/dist/installer.js +4 -1
  39. package/dist/kilo.js +33 -28
  40. package/dist/kimi-hook.js +4 -1
  41. package/dist/kimi-sessionstart-hook.js +4 -1
  42. package/dist/kimi-stop-hook.js +4 -1
  43. package/dist/mcp-server.js +12 -4
  44. package/dist/opencode2.js +33 -28
  45. package/dist/pi.js +33 -28
  46. package/dist/prime-agent.js +33 -28
  47. package/dist/qwen-hook.js +4 -1
  48. package/dist/qwen-sessionstart-hook.js +4 -1
  49. package/dist/qwen-stop-hook.js +4 -1
  50. package/dist/status.js +10 -2
  51. package/dist/traecode-hook.js +4 -1
  52. package/dist/traecode-sessionstart-hook.js +4 -1
  53. package/dist/traecode-stop-hook.js +4 -1
  54. package/dist/workbuddy-hook.js +4 -1
  55. package/dist/workbuddy-sessionstart-hook.js +4 -1
  56. package/dist/workbuddy-stop-hook.js +4 -1
  57. package/dist/zcode-hook.js +4 -1
  58. package/dist/zcode-sessionstart-hook.js +4 -1
  59. package/dist/zcode-stop-hook.js +4 -1
  60. package/package.json +1 -1
  61. package/plugin.json +1 -1
  62. package/skill/SKILL.md +6 -2
package/dist/deepen.js CHANGED
@@ -616,7 +616,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
616
616
  }
617
617
 
618
618
  // package.json
619
- var version = "0.8.1";
619
+ var version = "0.8.2";
620
620
 
621
621
  // src/core/util.ts
622
622
  import { accessSync, constants } from "fs";
@@ -1465,6 +1465,24 @@ var PENDING_MAX_BYTES = 256 * 1024;
1465
1465
 
1466
1466
  // src/core/uuid.ts
1467
1467
  import { createHash as createHash3 } from "crypto";
1468
+ var HINDSIGHT_NAMESPACE = "e75686a4-e923-4326-a0d1-358f1c6c3eb4";
1469
+ function uuidV5(name, namespace = HINDSIGHT_NAMESPACE) {
1470
+ const ns = Buffer.from(namespace.replace(/-/g, ""), "hex");
1471
+ if (ns.length !== 16) throw new Error(`invalid UUID namespace: ${namespace}`);
1472
+ const bytes = Buffer.from(
1473
+ createHash3("sha1").update(ns).update(Buffer.from(name, "utf8")).digest().subarray(0, 16)
1474
+ );
1475
+ bytes[6] = bytes[6] & 15 | 80;
1476
+ bytes[8] = bytes[8] & 63 | 128;
1477
+ const hex = bytes.toString("hex");
1478
+ return [
1479
+ hex.slice(0, 8),
1480
+ hex.slice(8, 12),
1481
+ hex.slice(12, 16),
1482
+ hex.slice(16, 20),
1483
+ hex.slice(20)
1484
+ ].join("-");
1485
+ }
1468
1486
 
1469
1487
  // src/core/chat.ts
1470
1488
  function withRefId(refId, turns, baseTs) {
@@ -1933,6 +1951,8 @@ import { resolve as resolve2 } from "path";
1933
1951
  var US = "";
1934
1952
  var RS = "";
1935
1953
  var GITLOG_HEAD = "gitlog-head:";
1954
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
1955
+ var GITLOG_DIVIDER = "\n\n---\n\n";
1936
1956
  function git(repo, ...args) {
1937
1957
  return execFileSync("git", ["-C", repo, "-c", "log.showSignature=false", ...args], {
1938
1958
  encoding: "utf8",
@@ -2019,18 +2039,44 @@ function gitLogText(repo, limit) {
2019
2039
  "--reverse",
2020
2040
  // applied after -n: the newest N, printed oldest first
2021
2041
  "--date=short",
2022
- `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`
2042
+ GITLOG_FORMAT
2023
2043
  );
2024
2044
  } catch {
2025
2045
  return "";
2026
2046
  }
2047
+ return gitLogRecords(raw).join(GITLOG_DIVIDER);
2048
+ }
2049
+ function gitLogRecords(raw) {
2027
2050
  return raw.split(RS).map((rec) => rec.trim()).filter(Boolean).map((rec) => {
2028
2051
  const [sha, date, author, subj, body] = rec.split(US);
2029
2052
  const header = `${sha} ${date} ${author}`;
2030
2053
  const msg = subj + (body?.trim() ? "\n\n" + body.trim() : "");
2031
2054
  return `${header}
2032
2055
  ${msg}`;
2033
- }).join("\n\n---\n\n");
2056
+ });
2057
+ }
2058
+ function gitLogRecordsSince(repo, baseSha, head) {
2059
+ if (!/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/.test(baseSha)) return null;
2060
+ try {
2061
+ git(repo, "merge-base", "--is-ancestor", baseSha, head);
2062
+ } catch {
2063
+ return null;
2064
+ }
2065
+ try {
2066
+ return gitLogRecords(
2067
+ git(
2068
+ repo,
2069
+ "log",
2070
+ "--no-merges",
2071
+ "--reverse",
2072
+ "--date=short",
2073
+ GITLOG_FORMAT,
2074
+ `${baseSha}..${head}`
2075
+ )
2076
+ );
2077
+ } catch {
2078
+ return null;
2079
+ }
2034
2080
  }
2035
2081
  function gitLogNewestAuthorDate(repo) {
2036
2082
  try {
@@ -2039,44 +2085,50 @@ function gitLogNewestAuthorDate(repo) {
2039
2085
  return null;
2040
2086
  }
2041
2087
  }
2088
+ async function retainGitLog(client, repo, content, opts, head, append) {
2089
+ const repoName = repoNameOf(repo);
2090
+ const stamp = opts.stampFor?.();
2091
+ const tags = [
2092
+ .../* @__PURE__ */ new Set([
2093
+ ...stamp?.tags ?? [],
2094
+ "source:git",
2095
+ "source:git-log",
2096
+ ...head ? [`${GITLOG_HEAD}${head}`] : []
2097
+ ])
2098
+ ];
2099
+ await client.retain(
2100
+ content,
2101
+ // No commit count: an append makes the document longer than any count a replace wrote.
2102
+ `git commit-message history for ${repoName}`,
2103
+ `gitlog:${repoName}`,
2104
+ tags,
2105
+ "gitlog",
2106
+ {
2107
+ // Anchor the document in time on the newest commit it contains, so extraction can date the
2108
+ // facts it pulls out of these messages. Previously no timestamp was passed at all: retain
2109
+ // then stamped "now", the extraction prompt got `Event Date: Unknown`, and every fact landed
2110
+ // with a null occurred_start/occurred_end — invisible to temporal search (#3602).
2111
+ timestamp: gitLogNewestAuthorDate(repo) ?? void 0,
2112
+ // `retain` only sets metadata when it is truthy, so an empty stamp sends none.
2113
+ metadata: Object.keys(stamp?.metadata ?? {}).length ? stamp?.metadata : void 0,
2114
+ ...append ? { updateMode: "append", operationId: append.operationId } : {}
2115
+ }
2116
+ );
2117
+ }
2042
2118
  async function ingestGitLog(client, repo, opts = { limit: 300 }) {
2043
2119
  const log3 = opts.log ?? (() => {
2044
2120
  });
2121
+ const head = gitHeadSha(repo);
2045
2122
  const text = gitLogText(repo, opts.limit);
2046
2123
  if (!text) {
2047
2124
  log3("[gitlog] no commits found \u2014 skipping");
2048
2125
  return 0;
2049
2126
  }
2050
2127
  const repoName = repoNameOf(repo);
2051
- const n = text.split("\n\n---\n\n").length;
2128
+ const n = text.split(GITLOG_DIVIDER).length;
2052
2129
  log3(`[gitlog] ingesting last ${n} commit messages for ${repoName} as ONE document \u2026`);
2053
2130
  try {
2054
- const head = gitHeadSha(repo);
2055
- const stamp = opts.stampFor?.();
2056
- const tags = [
2057
- .../* @__PURE__ */ new Set([
2058
- ...stamp?.tags ?? [],
2059
- "source:git",
2060
- "source:git-log",
2061
- ...head ? [`${GITLOG_HEAD}${head}`] : []
2062
- ])
2063
- ];
2064
- await client.retain(
2065
- text,
2066
- `git commit-message history (last ${n}) for ${repoName}`,
2067
- `gitlog:${repoName}`,
2068
- tags,
2069
- "gitlog",
2070
- {
2071
- // Anchor the document in time on the newest commit it contains, so extraction can date the
2072
- // facts it pulls out of these messages. Previously no timestamp was passed at all: retain
2073
- // then stamped "now", the extraction prompt got `Event Date: Unknown`, and every fact landed
2074
- // with a null occurred_start/occurred_end — invisible to temporal search (#3602).
2075
- timestamp: gitLogNewestAuthorDate(repo) ?? void 0,
2076
- // `retain` only sets metadata when it is truthy, so an empty stamp sends none.
2077
- metadata: Object.keys(stamp?.metadata ?? {}).length ? stamp?.metadata : void 0
2078
- }
2079
- );
2131
+ await retainGitLog(client, repo, text, opts, head);
2080
2132
  log3(`[gitlog] done: ${n} commit messages ingested as 1 document under strategy 'gitlog'`);
2081
2133
  return 0;
2082
2134
  } catch (e) {
@@ -2084,6 +2136,36 @@ async function ingestGitLog(client, repo, opts = { limit: 300 }) {
2084
2136
  return 1;
2085
2137
  }
2086
2138
  }
2139
+ async function appendGitLog(client, repo, opts, head) {
2140
+ const log3 = opts.log ?? (() => {
2141
+ });
2142
+ const canonical2 = `gitlog:${repoNameOf(repo)}`;
2143
+ const tags = await client.documentTags?.(canonical2).catch(() => void 0);
2144
+ const base = tags?.find((t) => t.startsWith(GITLOG_HEAD))?.slice(GITLOG_HEAD.length);
2145
+ if (!base) return null;
2146
+ const records = gitLogRecordsSince(repo, base, head);
2147
+ if (records === null || records.length > opts.limit) return null;
2148
+ if (!records.length) {
2149
+ log3("[gitlog] no new non-merge commits \u2014 skipping");
2150
+ return 0;
2151
+ }
2152
+ const appendable = await client.supportsAppendRetain?.().catch(() => false);
2153
+ if (!appendable) return null;
2154
+ const content = GITLOG_DIVIDER.slice(1) + records.join(GITLOG_DIVIDER);
2155
+ const operationId = uuidV5(`${client.bank}
2156
+ ${canonical2}
2157
+ append
2158
+ ${base}
2159
+ ${content}`);
2160
+ log3(`[gitlog] appending ${records.length} new commit message(s) to ${canonical2} \u2026`);
2161
+ try {
2162
+ await retainGitLog(client, repo, content, opts, head, { operationId });
2163
+ return 0;
2164
+ } catch (e) {
2165
+ log3(` ! gitlog append failed: ${e.message?.slice(0, 120)}`);
2166
+ return 1;
2167
+ }
2168
+ }
2087
2169
  async function gitLogIsCurrent(client, repo, head) {
2088
2170
  const canonical2 = `gitlog:${repoNameOf(repo)}`;
2089
2171
  if ((await client.listDocumentIds(`${GITLOG_HEAD}${head}`, "all_strict")).has(canonical2))
@@ -2102,7 +2184,7 @@ async function syncGitLog(client, repo, opts) {
2102
2184
  log3("[gitlog] current with HEAD \u2014 skipping");
2103
2185
  return 0;
2104
2186
  }
2105
- return ingestGitLog(client, repo, opts);
2187
+ return (head ? await appendGitLog(client, repo, opts, head) : null) ?? ingestGitLog(client, repo, opts);
2106
2188
  }
2107
2189
 
2108
2190
  // src/core/survey.ts
@@ -657,7 +657,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
657
657
  }
658
658
 
659
659
  // package.json
660
- var version = "0.8.1";
660
+ var version = "0.8.2";
661
661
 
662
662
  // src/core/util.ts
663
663
  import { accessSync, constants } from "fs";
@@ -2472,6 +2472,9 @@ import { join as join11 } from "path";
2472
2472
  // src/core/git.ts
2473
2473
  import { execFileSync as execFileSync2 } from "child_process";
2474
2474
  import { resolve as resolve2 } from "path";
2475
+ var US = "";
2476
+ var RS = "";
2477
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
2475
2478
 
2476
2479
  // src/core/status.ts
2477
2480
  import { execFileSync as execFileSync4 } from "child_process";
@@ -673,7 +673,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
673
673
  }
674
674
 
675
675
  // package.json
676
- var version = "0.8.1";
676
+ var version = "0.8.2";
677
677
 
678
678
  // src/core/util.ts
679
679
  import { accessSync, constants } from "fs";
@@ -2364,7 +2364,10 @@ import { join as join11 } from "path";
2364
2364
  // src/core/git.ts
2365
2365
  import { execFileSync as execFileSync2 } from "child_process";
2366
2366
  import { resolve as resolve2 } from "path";
2367
+ var US = "";
2368
+ var RS = "";
2367
2369
  var GITLOG_HEAD = "gitlog-head:";
2370
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
2368
2371
  function git(repo, ...args) {
2369
2372
  return execFileSync2("git", ["-C", repo, "-c", "log.showSignature=false", ...args], {
2370
2373
  encoding: "utf8",
@@ -633,7 +633,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
633
633
  }
634
634
 
635
635
  // package.json
636
- var version = "0.8.1";
636
+ var version = "0.8.2";
637
637
 
638
638
  // src/core/util.ts
639
639
  import { accessSync, constants } from "fs";
@@ -2766,6 +2766,9 @@ async function runRetainHook(spec, makeClient = (o) => new HindsightClient(o)) {
2766
2766
  // src/core/git.ts
2767
2767
  import { execFileSync as execFileSync2 } from "child_process";
2768
2768
  import { resolve as resolve2 } from "path";
2769
+ var US = "";
2770
+ var RS = "";
2771
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
2769
2772
 
2770
2773
  // src/core/status.ts
2771
2774
  import { execFileSync as execFileSync4 } from "child_process";
@@ -657,7 +657,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
657
657
  }
658
658
 
659
659
  // package.json
660
- var version = "0.8.1";
660
+ var version = "0.8.2";
661
661
 
662
662
  // src/core/util.ts
663
663
  import { accessSync, constants } from "fs";
@@ -2472,6 +2472,9 @@ import { join as join11 } from "path";
2472
2472
  // src/core/git.ts
2473
2473
  import { execFileSync as execFileSync2 } from "child_process";
2474
2474
  import { resolve as resolve2 } from "path";
2475
+ var US = "";
2476
+ var RS = "";
2477
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
2475
2478
 
2476
2479
  // src/core/status.ts
2477
2480
  import { execFileSync as execFileSync4 } from "child_process";
@@ -673,7 +673,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
673
673
  }
674
674
 
675
675
  // package.json
676
- var version = "0.8.1";
676
+ var version = "0.8.2";
677
677
 
678
678
  // src/core/util.ts
679
679
  import { accessSync, constants } from "fs";
@@ -2364,7 +2364,10 @@ import { join as join11 } from "path";
2364
2364
  // src/core/git.ts
2365
2365
  import { execFileSync as execFileSync2 } from "child_process";
2366
2366
  import { resolve as resolve2 } from "path";
2367
+ var US = "";
2368
+ var RS = "";
2367
2369
  var GITLOG_HEAD = "gitlog-head:";
2370
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
2368
2371
  function git(repo, ...args) {
2369
2372
  return execFileSync2("git", ["-C", repo, "-c", "log.showSignature=false", ...args], {
2370
2373
  encoding: "utf8",
@@ -633,7 +633,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
633
633
  }
634
634
 
635
635
  // package.json
636
- var version = "0.8.1";
636
+ var version = "0.8.2";
637
637
 
638
638
  // src/core/util.ts
639
639
  import { accessSync, constants } from "fs";
@@ -2766,6 +2766,9 @@ async function runRetainHook(spec, makeClient = (o) => new HindsightClient(o)) {
2766
2766
  // src/core/git.ts
2767
2767
  import { execFileSync as execFileSync2 } from "child_process";
2768
2768
  import { resolve as resolve2 } from "path";
2769
+ var US = "";
2770
+ var RS = "";
2771
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
2769
2772
 
2770
2773
  // src/core/status.ts
2771
2774
  import { execFileSync as execFileSync4 } from "child_process";
package/dist/dsh.js CHANGED
@@ -656,7 +656,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
656
656
  }
657
657
 
658
658
  // package.json
659
- var version = "0.8.1";
659
+ var version = "0.8.2";
660
660
 
661
661
  // src/core/util.ts
662
662
  import { accessSync, constants } from "fs";
@@ -16917,7 +16917,7 @@ function date4(params) {
16917
16917
  config(en_default());
16918
16918
 
16919
16919
  // src/core/knowledge-tools.ts
16920
- import { createHash as createHash3 } from "crypto";
16920
+ import { createHash as createHash4 } from "crypto";
16921
16921
  import { existsSync as existsSync4 } from "fs";
16922
16922
  import { homedir as homedir6 } from "os";
16923
16923
  import { join as join12 } from "path";
@@ -16928,7 +16928,33 @@ import { execFileSync as execFileSync4 } from "child_process";
16928
16928
  // src/core/git.ts
16929
16929
  import { execFileSync as execFileSync2 } from "child_process";
16930
16930
  import { resolve as resolve2 } from "path";
16931
+
16932
+ // src/core/uuid.ts
16933
+ import { createHash as createHash2 } from "crypto";
16934
+ var HINDSIGHT_NAMESPACE = "e75686a4-e923-4326-a0d1-358f1c6c3eb4";
16935
+ function uuidV5(name2, namespace = HINDSIGHT_NAMESPACE) {
16936
+ const ns = Buffer.from(namespace.replace(/-/g, ""), "hex");
16937
+ if (ns.length !== 16) throw new Error(`invalid UUID namespace: ${namespace}`);
16938
+ const bytes = Buffer.from(
16939
+ createHash2("sha1").update(ns).update(Buffer.from(name2, "utf8")).digest().subarray(0, 16)
16940
+ );
16941
+ bytes[6] = bytes[6] & 15 | 80;
16942
+ bytes[8] = bytes[8] & 63 | 128;
16943
+ const hex3 = bytes.toString("hex");
16944
+ return [
16945
+ hex3.slice(0, 8),
16946
+ hex3.slice(8, 12),
16947
+ hex3.slice(12, 16),
16948
+ hex3.slice(16, 20),
16949
+ hex3.slice(20)
16950
+ ].join("-");
16951
+ }
16952
+
16953
+ // src/core/git.ts
16954
+ var US = "";
16955
+ var RS = "";
16931
16956
  var GITLOG_HEAD = "gitlog-head:";
16957
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
16932
16958
  function git(repo, ...args) {
16933
16959
  return execFileSync2("git", ["-C", repo, "-c", "log.showSignature=false", ...args], {
16934
16960
  encoding: "utf8",
@@ -16977,7 +17003,7 @@ async function gitLogIsCurrent(client, repo, head) {
16977
17003
 
16978
17004
  // src/core/survey.ts
16979
17005
  import { execFileSync as execFileSync3, spawn as realSpawn5 } from "child_process";
16980
- import { createHash as createHash2 } from "crypto";
17006
+ import { createHash as createHash3 } from "crypto";
16981
17007
  import { existsSync as existsSync3 } from "fs";
16982
17008
  import { homedir as homedir5, tmpdir as tmpdir2 } from "os";
16983
17009
  import { dirname as dirname7, join as join11 } from "path";
@@ -17220,7 +17246,7 @@ async function startCodebaseSurvey(repoDir, opts = {}) {
17220
17246
  });
17221
17247
  const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17222
17248
  if (cfg.disabled) return false;
17223
- const key = createHash2("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17249
+ const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17224
17250
  const lease = acquireLease(
17225
17251
  opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys"),
17226
17252
  key,
@@ -17493,7 +17519,7 @@ function buildKnowledgeTools(client, bankId, opts = {}) {
17493
17519
  annotations: NON_DESTRUCTIVE_WRITE_ANNOTATIONS,
17494
17520
  handler: guarded(async ({ title, content }) => {
17495
17521
  const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
17496
- const docId = /[^\x00-\x7f]/.test(title) || !slug ? `${slug || "doc"}--${createHash3("sha256").update(title).digest("hex")}` : slug;
17522
+ const docId = /[^\x00-\x7f]/.test(title) || !slug ? `${slug || "doc"}--${createHash4("sha256").update(title).digest("hex")}` : slug;
17497
17523
  const stamp = opts.stampFor?.();
17498
17524
  const metadata = {
17499
17525
  ...stamp?.metadata,
@@ -17520,7 +17546,7 @@ function buildKnowledgeTools(client, bankId, opts = {}) {
17520
17546
  }
17521
17547
 
17522
17548
  // src/core/retain-cursor.ts
17523
- import { createHash as createHash4 } from "crypto";
17549
+ import { createHash as createHash5 } from "crypto";
17524
17550
  var PENDING_MAX_AGE_MS = 12 * 60 * 60 * 1e3;
17525
17551
  var PENDING_MAX_BYTES = 256 * 1024;
17526
17552
  var MAX_CURSOR_PATHS = 16;
@@ -17536,7 +17562,7 @@ function pendingReplayable(cursor, now) {
17536
17562
  }
17537
17563
  var MAX_CURSOR_OPS = 8;
17538
17564
  function fingerprintTurns(turns, count) {
17539
- const h = createHash4("sha1").update(String(count));
17565
+ const h = createHash5("sha1").update(String(count));
17540
17566
  for (let i = 0; i < count; i++) h.update("\n" + JSON.stringify(turns[i]));
17541
17567
  return h.digest("hex");
17542
17568
  }
@@ -17560,27 +17586,6 @@ function memoryCursorStore() {
17560
17586
  };
17561
17587
  }
17562
17588
 
17563
- // src/core/uuid.ts
17564
- import { createHash as createHash5 } from "crypto";
17565
- var HINDSIGHT_NAMESPACE = "e75686a4-e923-4326-a0d1-358f1c6c3eb4";
17566
- function uuidV5(name2, namespace = HINDSIGHT_NAMESPACE) {
17567
- const ns = Buffer.from(namespace.replace(/-/g, ""), "hex");
17568
- if (ns.length !== 16) throw new Error(`invalid UUID namespace: ${namespace}`);
17569
- const bytes = Buffer.from(
17570
- createHash5("sha1").update(ns).update(Buffer.from(name2, "utf8")).digest().subarray(0, 16)
17571
- );
17572
- bytes[6] = bytes[6] & 15 | 80;
17573
- bytes[8] = bytes[8] & 63 | 128;
17574
- const hex3 = bytes.toString("hex");
17575
- return [
17576
- hex3.slice(0, 8),
17577
- hex3.slice(8, 12),
17578
- hex3.slice(12, 16),
17579
- hex3.slice(16, 20),
17580
- hex3.slice(20)
17581
- ].join("-");
17582
- }
17583
-
17584
17589
  // src/core/chat.ts
17585
17590
  function withRefId(refId, turns, baseTs) {
17586
17591
  return [{ role: "system", content: `REF-ID: ${refId}`, timestamp: baseTs }, ...turns];
package/dist/grok-hook.js CHANGED
@@ -657,7 +657,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
657
657
  }
658
658
 
659
659
  // package.json
660
- var version = "0.8.1";
660
+ var version = "0.8.2";
661
661
 
662
662
  // src/core/util.ts
663
663
  import { accessSync, constants } from "fs";
@@ -2472,6 +2472,9 @@ import { join as join11 } from "path";
2472
2472
  // src/core/git.ts
2473
2473
  import { execFileSync as execFileSync2 } from "child_process";
2474
2474
  import { resolve as resolve2 } from "path";
2475
+ var US = "";
2476
+ var RS = "";
2477
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
2475
2478
 
2476
2479
  // src/core/status.ts
2477
2480
  import { execFileSync as execFileSync4 } from "child_process";
@@ -673,7 +673,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
673
673
  }
674
674
 
675
675
  // package.json
676
- var version = "0.8.1";
676
+ var version = "0.8.2";
677
677
 
678
678
  // src/core/util.ts
679
679
  import { accessSync, constants } from "fs";
@@ -2364,7 +2364,10 @@ import { join as join11 } from "path";
2364
2364
  // src/core/git.ts
2365
2365
  import { execFileSync as execFileSync2 } from "child_process";
2366
2366
  import { resolve as resolve2 } from "path";
2367
+ var US = "";
2368
+ var RS = "";
2367
2369
  var GITLOG_HEAD = "gitlog-head:";
2370
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
2368
2371
  function git(repo, ...args) {
2369
2372
  return execFileSync2("git", ["-C", repo, "-c", "log.showSignature=false", ...args], {
2370
2373
  encoding: "utf8",
@@ -633,7 +633,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
633
633
  }
634
634
 
635
635
  // package.json
636
- var version = "0.8.1";
636
+ var version = "0.8.2";
637
637
 
638
638
  // src/core/util.ts
639
639
  import { accessSync, constants } from "fs";
@@ -2766,6 +2766,9 @@ async function runRetainHook(spec, makeClient = (o) => new HindsightClient(o)) {
2766
2766
  // src/core/git.ts
2767
2767
  import { execFileSync as execFileSync2 } from "child_process";
2768
2768
  import { resolve as resolve2 } from "path";
2769
+ var US = "";
2770
+ var RS = "";
2771
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
2769
2772
 
2770
2773
  // src/core/status.ts
2771
2774
  import { execFileSync as execFileSync4 } from "child_process";
@@ -416,7 +416,7 @@ var PLUGIN_GOVERNED_BANK_FIELDS = [
416
416
  ];
417
417
 
418
418
  // package.json
419
- var version = "0.8.1";
419
+ var version = "0.8.2";
420
420
 
421
421
  // src/core/util.ts
422
422
  import { accessSync, constants } from "fs";
package/dist/index.js CHANGED
@@ -656,7 +656,7 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
656
656
  }
657
657
 
658
658
  // package.json
659
- var version = "0.8.1";
659
+ var version = "0.8.2";
660
660
 
661
661
  // src/core/util.ts
662
662
  import { accessSync, constants } from "fs";
@@ -16917,7 +16917,7 @@ function date4(params) {
16917
16917
  config(en_default());
16918
16918
 
16919
16919
  // src/core/knowledge-tools.ts
16920
- import { createHash as createHash3 } from "crypto";
16920
+ import { createHash as createHash4 } from "crypto";
16921
16921
  import { existsSync as existsSync4 } from "fs";
16922
16922
  import { homedir as homedir6 } from "os";
16923
16923
  import { join as join12 } from "path";
@@ -16928,7 +16928,33 @@ import { execFileSync as execFileSync4 } from "child_process";
16928
16928
  // src/core/git.ts
16929
16929
  import { execFileSync as execFileSync2 } from "child_process";
16930
16930
  import { resolve as resolve2 } from "path";
16931
+
16932
+ // src/core/uuid.ts
16933
+ import { createHash as createHash2 } from "crypto";
16934
+ var HINDSIGHT_NAMESPACE = "e75686a4-e923-4326-a0d1-358f1c6c3eb4";
16935
+ function uuidV5(name, namespace = HINDSIGHT_NAMESPACE) {
16936
+ const ns = Buffer.from(namespace.replace(/-/g, ""), "hex");
16937
+ if (ns.length !== 16) throw new Error(`invalid UUID namespace: ${namespace}`);
16938
+ const bytes = Buffer.from(
16939
+ createHash2("sha1").update(ns).update(Buffer.from(name, "utf8")).digest().subarray(0, 16)
16940
+ );
16941
+ bytes[6] = bytes[6] & 15 | 80;
16942
+ bytes[8] = bytes[8] & 63 | 128;
16943
+ const hex5 = bytes.toString("hex");
16944
+ return [
16945
+ hex5.slice(0, 8),
16946
+ hex5.slice(8, 12),
16947
+ hex5.slice(12, 16),
16948
+ hex5.slice(16, 20),
16949
+ hex5.slice(20)
16950
+ ].join("-");
16951
+ }
16952
+
16953
+ // src/core/git.ts
16954
+ var US = "";
16955
+ var RS = "";
16931
16956
  var GITLOG_HEAD = "gitlog-head:";
16957
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
16932
16958
  function git(repo, ...args) {
16933
16959
  return execFileSync2("git", ["-C", repo, "-c", "log.showSignature=false", ...args], {
16934
16960
  encoding: "utf8",
@@ -16977,7 +17003,7 @@ async function gitLogIsCurrent(client, repo, head) {
16977
17003
 
16978
17004
  // src/core/survey.ts
16979
17005
  import { execFileSync as execFileSync3, spawn as realSpawn5 } from "child_process";
16980
- import { createHash as createHash2 } from "crypto";
17006
+ import { createHash as createHash3 } from "crypto";
16981
17007
  import { existsSync as existsSync3 } from "fs";
16982
17008
  import { homedir as homedir5, tmpdir as tmpdir2 } from "os";
16983
17009
  import { dirname as dirname7, join as join11 } from "path";
@@ -17231,7 +17257,7 @@ async function startCodebaseSurvey(repoDir, opts = {}) {
17231
17257
  });
17232
17258
  const { cfg, bankId } = resolveHostConfig(harness, repoDir);
17233
17259
  if (cfg.disabled) return false;
17234
- const key = createHash2("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17260
+ const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
17235
17261
  const lease = acquireLease(
17236
17262
  opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys"),
17237
17263
  key,
@@ -17504,7 +17530,7 @@ function buildKnowledgeTools(client, bankId, opts = {}) {
17504
17530
  annotations: NON_DESTRUCTIVE_WRITE_ANNOTATIONS,
17505
17531
  handler: guarded(async ({ title, content }) => {
17506
17532
  const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
17507
- const docId = /[^\x00-\x7f]/.test(title) || !slug ? `${slug || "doc"}--${createHash3("sha256").update(title).digest("hex")}` : slug;
17533
+ const docId = /[^\x00-\x7f]/.test(title) || !slug ? `${slug || "doc"}--${createHash4("sha256").update(title).digest("hex")}` : slug;
17508
17534
  const stamp = opts.stampFor?.();
17509
17535
  const metadata = {
17510
17536
  ...stamp?.metadata,
@@ -17531,7 +17557,7 @@ function buildKnowledgeTools(client, bankId, opts = {}) {
17531
17557
  }
17532
17558
 
17533
17559
  // src/core/retain-cursor.ts
17534
- import { createHash as createHash4 } from "crypto";
17560
+ import { createHash as createHash5 } from "crypto";
17535
17561
  var PENDING_MAX_AGE_MS = 12 * 60 * 60 * 1e3;
17536
17562
  var PENDING_MAX_BYTES = 256 * 1024;
17537
17563
  var MAX_CURSOR_PATHS = 16;
@@ -17547,7 +17573,7 @@ function pendingReplayable(cursor, now) {
17547
17573
  }
17548
17574
  var MAX_CURSOR_OPS = 8;
17549
17575
  function fingerprintTurns(turns, count) {
17550
- const h = createHash4("sha1").update(String(count));
17576
+ const h = createHash5("sha1").update(String(count));
17551
17577
  for (let i = 0; i < count; i++) h.update("\n" + JSON.stringify(turns[i]));
17552
17578
  return h.digest("hex");
17553
17579
  }
@@ -17571,27 +17597,6 @@ function memoryCursorStore() {
17571
17597
  };
17572
17598
  }
17573
17599
 
17574
- // src/core/uuid.ts
17575
- import { createHash as createHash5 } from "crypto";
17576
- var HINDSIGHT_NAMESPACE = "e75686a4-e923-4326-a0d1-358f1c6c3eb4";
17577
- function uuidV5(name, namespace = HINDSIGHT_NAMESPACE) {
17578
- const ns = Buffer.from(namespace.replace(/-/g, ""), "hex");
17579
- if (ns.length !== 16) throw new Error(`invalid UUID namespace: ${namespace}`);
17580
- const bytes = Buffer.from(
17581
- createHash5("sha1").update(ns).update(Buffer.from(name, "utf8")).digest().subarray(0, 16)
17582
- );
17583
- bytes[6] = bytes[6] & 15 | 80;
17584
- bytes[8] = bytes[8] & 63 | 128;
17585
- const hex5 = bytes.toString("hex");
17586
- return [
17587
- hex5.slice(0, 8),
17588
- hex5.slice(8, 12),
17589
- hex5.slice(12, 16),
17590
- hex5.slice(16, 20),
17591
- hex5.slice(20)
17592
- ].join("-");
17593
- }
17594
-
17595
17600
  // src/core/chat.ts
17596
17601
  function withRefId(refId, turns, baseTs) {
17597
17602
  return [{ role: "system", content: `REF-ID: ${refId}`, timestamp: baseTs }, ...turns];
package/dist/installer.js CHANGED
@@ -2217,7 +2217,7 @@ var PAGE_TAXONOMY = [
2217
2217
  var PAGE_NAMES = PAGE_TAXONOMY.map((page) => page.name);
2218
2218
 
2219
2219
  // package.json
2220
- var version = "0.8.1";
2220
+ var version = "0.8.2";
2221
2221
 
2222
2222
  // src/core/util.ts
2223
2223
  import { accessSync, constants } from "fs";
@@ -2547,6 +2547,9 @@ function formatUsageReport(usage, path = usageFilePath()) {
2547
2547
  // src/core/git.ts
2548
2548
  import { execFileSync as execFileSync2 } from "child_process";
2549
2549
  import { resolve as resolve2 } from "path";
2550
+ var US = "";
2551
+ var RS = "";
2552
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
2550
2553
 
2551
2554
  // src/core/status.ts
2552
2555
  import { execFileSync as execFileSync4 } from "child_process";