@vectorize-io/hindsight-coding-agents 0.5.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +24 -7
  2. package/dist/antigravity-hook.js +205 -81
  3. package/dist/antigravity-statusline.js +32 -22
  4. package/dist/antigravity-stop-hook.js +216 -79
  5. package/dist/claude-hook.js +205 -81
  6. package/dist/claude-sessionstart-hook.js +167 -105
  7. package/dist/claude-stop-hook.js +216 -79
  8. package/dist/cline.js +279 -86
  9. package/dist/codex-hook.js +205 -81
  10. package/dist/codex-sessionstart-hook.js +167 -105
  11. package/dist/codex-stop-hook.js +216 -79
  12. package/dist/copilot-hook.js +205 -81
  13. package/dist/copilot-sessionstart-hook.js +167 -105
  14. package/dist/copilot-stop-hook.js +216 -79
  15. package/dist/cursor-hook.js +205 -81
  16. package/dist/cursor-sessionstart-hook.js +167 -105
  17. package/dist/cursor-stop-hook.js +216 -79
  18. package/dist/daemon-start.js +28 -18
  19. package/dist/dcode-hook.js +205 -81
  20. package/dist/dcode-sessionstart-hook.js +167 -105
  21. package/dist/dcode-stop-hook.js +216 -79
  22. package/dist/deepen.js +98 -40
  23. package/dist/devin-hook.js +205 -81
  24. package/dist/devin-sessionstart-hook.js +167 -105
  25. package/dist/devin-stop-hook.js +216 -79
  26. package/dist/droid-hook.js +205 -81
  27. package/dist/droid-sessionstart-hook.js +167 -105
  28. package/dist/droid-stop-hook.js +216 -79
  29. package/dist/dsh.js +277 -85
  30. package/dist/grok-hook.js +205 -81
  31. package/dist/grok-sessionstart-hook.js +167 -105
  32. package/dist/grok-stop-hook.js +216 -79
  33. package/dist/hindsight-seed.js +32 -22
  34. package/dist/index.js +280 -88
  35. package/dist/installer.js +308 -214
  36. package/dist/kilo.js +280 -88
  37. package/dist/mcp-server.js +97 -39
  38. package/dist/opencode2.js +279 -87
  39. package/dist/pi.js +279 -87
  40. package/dist/prime-agent.js +279 -87
  41. package/dist/qwen-hook.js +205 -81
  42. package/dist/qwen-sessionstart-hook.js +167 -105
  43. package/dist/qwen-stop-hook.js +216 -79
  44. package/dist/status.js +94 -36
  45. package/dist/zcode-hook.js +205 -81
  46. package/dist/zcode-sessionstart-hook.js +167 -105
  47. package/dist/zcode-stop-hook.js +216 -79
  48. package/package.json +1 -1
  49. package/plugin.json +1 -1
  50. package/skill/SKILL.md +24 -7
@@ -2,8 +2,8 @@
2
2
 
3
3
  // src/core/config.ts
4
4
  import { readFileSync as readFileSync2 } from "fs";
5
- import { homedir as homedir2 } from "os";
6
- import { join as join6 } from "path";
5
+ import { homedir as homedir3 } from "os";
6
+ import { join as join7 } from "path";
7
7
 
8
8
  // src/core/seed.ts
9
9
  import { spawn as realSpawn } from "child_process";
@@ -13,30 +13,40 @@ var DEFAULT_SEED_LIMIT = 300;
13
13
 
14
14
  // src/core/bank.ts
15
15
  import { existsSync } from "fs";
16
- import { homedir } from "os";
17
- import { basename, dirname as dirname4, join as join4, normalize, sep } from "path";
16
+ import { homedir as homedir2 } from "os";
17
+ import { basename, dirname as dirname4, join as join5, normalize, sep } from "path";
18
18
 
19
19
  // src/core/diag.ts
20
- import { appendFileSync as appendFileSync2 } from "fs";
20
+ import { join as join3 } from "path";
21
21
 
22
22
  // src/core/log.ts
23
- import { appendFileSync, mkdirSync } from "fs";
24
- import { tmpdir } from "os";
23
+ import { appendFileSync, mkdirSync, renameSync, statSync } from "fs";
24
+ import { homedir } from "os";
25
25
  import { dirname as dirname2, join as join2 } from "path";
26
+ function logsDir() {
27
+ return join2(homedir(), ".hindsight", "coding-agents-logs");
28
+ }
29
+ var LOG_MAX_BYTES = 10 * 1024 * 1024;
30
+ function appendLogLine(file, text) {
31
+ mkdirSync(dirname2(file), { recursive: true, mode: 448 });
32
+ try {
33
+ if (statSync(file).size >= LOG_MAX_BYTES) renameSync(file, `${file}.1`);
34
+ } catch {
35
+ }
36
+ appendFileSync(file, text, { mode: 384 });
37
+ }
26
38
  var WEIGHT = { debug: 10, info: 20, warn: 30, error: 40 };
27
39
  var current = ["debug", "info", "warn", "error"].find(
28
40
  (l) => l === process.env.HINDSIGHT_LOG_LEVEL
29
41
  ) ?? "info";
30
42
  function logFilePath() {
31
- return process.env.HINDSIGHT_LOG_FILE || join2(tmpdir(), "hindsight-coding-agent", "plugin.log");
43
+ return process.env.HINDSIGHT_LOG_FILE || join2(logsDir(), "plugin.log");
32
44
  }
33
45
  function write(level, scope, msg, extra) {
34
46
  if (WEIGHT[level] < WEIGHT[current]) return;
35
47
  try {
36
- const file = logFilePath();
37
- mkdirSync(dirname2(file), { recursive: true });
38
- appendFileSync(
39
- file,
48
+ appendLogLine(
49
+ logFilePath(),
40
50
  `${(/* @__PURE__ */ new Date()).toISOString()} ${level.toUpperCase().padEnd(5)} [${scope}] ${msg}` + (extra && Object.keys(extra).length ? ` ${JSON.stringify(extra)}` : "") + "\n"
41
51
  );
42
52
  } catch {
@@ -51,12 +61,12 @@ var log = {
51
61
 
52
62
  // src/core/diag.ts
53
63
  function diagFilePath() {
54
- return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
64
+ return process.env.HINDSIGHT_DIAG_FILE || join3(logsDir(), "diag.jsonl");
55
65
  }
56
66
  function diag(harness, event, extra = {}) {
57
67
  log.debug(harness, `diag:${event}`, extra);
58
68
  try {
59
- appendFileSync2(
69
+ appendLogLine(
60
70
  diagFilePath(),
61
71
  JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
62
72
  );
@@ -66,7 +76,7 @@ function diag(harness, event, extra = {}) {
66
76
 
67
77
  // src/core/git-layout.ts
68
78
  import { lstatSync, readFileSync, realpathSync } from "fs";
69
- import { dirname as dirname3, isAbsolute, join as join3, resolve } from "path";
79
+ import { dirname as dirname3, isAbsolute, join as join4, resolve } from "path";
70
80
  var TRANSIENT = /* @__PURE__ */ new Set(["EAGAIN", "EMFILE", "ENFILE", "EBUSY", "EINTR", "EIO", "ETIMEDOUT"]);
71
81
  var ATTEMPTS = 3;
72
82
  var BACKOFF_MS = 20;
@@ -102,16 +112,16 @@ function gitDirFromPointer(text, holder) {
102
112
  return isAbsolute(target) ? target : resolve(holder, target);
103
113
  }
104
114
  function commonDirOf(gitDir) {
105
- const pointer = entryKind(join3(gitDir, "commondir")) === "file" ? readTextOrNull(join3(gitDir, "commondir"))?.trim() : null;
115
+ const pointer = entryKind(join4(gitDir, "commondir")) === "file" ? readTextOrNull(join4(gitDir, "commondir"))?.trim() : null;
106
116
  if (!pointer) return gitDir;
107
117
  return isAbsolute(pointer) ? pointer : resolve(gitDir, pointer);
108
118
  }
109
119
  function isBare(commonDir) {
110
- const config = readTextOrNull(join3(commonDir, "config"));
120
+ const config = readTextOrNull(join4(commonDir, "config"));
111
121
  return config !== null && /^\s*bare\s*=\s*true\s*$/im.test(config);
112
122
  }
113
123
  function looksLikeBareRepository(directory) {
114
- return entryKind(join3(directory, "HEAD")) === "file" && entryKind(join3(directory, "objects")) === "dir" && entryKind(join3(directory, "refs")) === "dir";
124
+ return entryKind(join4(directory, "HEAD")) === "file" && entryKind(join4(directory, "objects")) === "dir" && entryKind(join4(directory, "refs")) === "dir";
115
125
  }
116
126
  function canonical(path) {
117
127
  try {
@@ -128,7 +138,7 @@ function resolved(commonDir) {
128
138
  function probeOnce(directory) {
129
139
  let current2 = resolve(directory);
130
140
  for (; ; ) {
131
- const dotGit = join3(current2, ".git");
141
+ const dotGit = join4(current2, ".git");
132
142
  const kind = entryKind(dotGit);
133
143
  if (kind === "dir") {
134
144
  const layout = resolved(commonDirOf(dotGit));
@@ -239,7 +249,7 @@ function gitProjectName(directory, resolveWorktrees, sessionRoot = "") {
239
249
  return dirName(sessionRoot || directory);
240
250
  }
241
251
  function configuredDir(dir) {
242
- const expanded = dir === "~" || dir.startsWith("~/") ? join4(homedir(), dir.slice(1)) : dir;
252
+ const expanded = dir === "~" || dir.startsWith("~/") ? join5(homedir2(), dir.slice(1)) : dir;
243
253
  return normalize(expanded).replace(new RegExp(`\\${sep}+$`), "");
244
254
  }
245
255
  function isWithin(directory, configured) {
@@ -347,7 +357,7 @@ function parseHashedCron(cron) {
347
357
 
348
358
  // src/core/util.ts
349
359
  import { accessSync, constants } from "fs";
350
- import { delimiter, join as join5 } from "path";
360
+ import { delimiter, join as join6 } from "path";
351
361
 
352
362
  // src/core/hindsight.ts
353
363
  var DEFAULT_OBSERVATION_SCOPES = "shared";
@@ -355,7 +365,7 @@ var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
355
365
  var RETRY_AFTER_CEILING_MS = 60 * 1e3;
356
366
 
357
367
  // src/core/config.ts
358
- var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join6(homedir2(), ".hindsight", "coding-agent.json");
368
+ var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join7(homedir3(), ".hindsight", "coding-agent.json");
359
369
  var DEFAULT_DAEMON_PORT = 9077;
360
370
  var DEFAULT_DAEMON_PROFILE = "coding-agent";
361
371
  function resolvePageTrigger(raw) {