@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";
@@ -50,30 +50,40 @@ function seedControl(command2, args) {
50
50
 
51
51
  // src/core/bank.ts
52
52
  import { existsSync } from "fs";
53
- import { homedir } from "os";
54
- import { basename, dirname as dirname4, join as join4, normalize, sep } from "path";
53
+ import { homedir as homedir2 } from "os";
54
+ import { basename, dirname as dirname4, join as join5, normalize, sep } from "path";
55
55
 
56
56
  // src/core/diag.ts
57
- import { appendFileSync as appendFileSync2 } from "fs";
57
+ import { join as join3 } from "path";
58
58
 
59
59
  // src/core/log.ts
60
- import { appendFileSync, mkdirSync } from "fs";
61
- import { tmpdir } from "os";
60
+ import { appendFileSync, mkdirSync, renameSync, statSync } from "fs";
61
+ import { homedir } from "os";
62
62
  import { dirname as dirname2, join as join2 } from "path";
63
+ function logsDir() {
64
+ return join2(homedir(), ".hindsight", "coding-agents-logs");
65
+ }
66
+ var LOG_MAX_BYTES = 10 * 1024 * 1024;
67
+ function appendLogLine(file, text) {
68
+ mkdirSync(dirname2(file), { recursive: true, mode: 448 });
69
+ try {
70
+ if (statSync(file).size >= LOG_MAX_BYTES) renameSync(file, `${file}.1`);
71
+ } catch {
72
+ }
73
+ appendFileSync(file, text, { mode: 384 });
74
+ }
63
75
  var WEIGHT = { debug: 10, info: 20, warn: 30, error: 40 };
64
76
  var current = ["debug", "info", "warn", "error"].find(
65
77
  (l) => l === process.env.HINDSIGHT_LOG_LEVEL
66
78
  ) ?? "info";
67
79
  function logFilePath() {
68
- return process.env.HINDSIGHT_LOG_FILE || join2(tmpdir(), "hindsight-coding-agent", "plugin.log");
80
+ return process.env.HINDSIGHT_LOG_FILE || join2(logsDir(), "plugin.log");
69
81
  }
70
82
  function write(level, scope, msg, extra) {
71
83
  if (WEIGHT[level] < WEIGHT[current]) return;
72
84
  try {
73
- const file = logFilePath();
74
- mkdirSync(dirname2(file), { recursive: true });
75
- appendFileSync(
76
- file,
85
+ appendLogLine(
86
+ logFilePath(),
77
87
  `${(/* @__PURE__ */ new Date()).toISOString()} ${level.toUpperCase().padEnd(5)} [${scope}] ${msg}` + (extra && Object.keys(extra).length ? ` ${JSON.stringify(extra)}` : "") + "\n"
78
88
  );
79
89
  } catch {
@@ -88,12 +98,12 @@ var log = {
88
98
 
89
99
  // src/core/diag.ts
90
100
  function diagFilePath() {
91
- return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
101
+ return process.env.HINDSIGHT_DIAG_FILE || join3(logsDir(), "diag.jsonl");
92
102
  }
93
103
  function diag(harness, event, extra = {}) {
94
104
  log.debug(harness, `diag:${event}`, extra);
95
105
  try {
96
- appendFileSync2(
106
+ appendLogLine(
97
107
  diagFilePath(),
98
108
  JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
99
109
  );
@@ -103,7 +113,7 @@ function diag(harness, event, extra = {}) {
103
113
 
104
114
  // src/core/git-layout.ts
105
115
  import { lstatSync, readFileSync, realpathSync } from "fs";
106
- import { dirname as dirname3, isAbsolute, join as join3, resolve } from "path";
116
+ import { dirname as dirname3, isAbsolute, join as join4, resolve } from "path";
107
117
  var TRANSIENT = /* @__PURE__ */ new Set(["EAGAIN", "EMFILE", "ENFILE", "EBUSY", "EINTR", "EIO", "ETIMEDOUT"]);
108
118
  var ATTEMPTS = 3;
109
119
  var BACKOFF_MS = 20;
@@ -139,16 +149,16 @@ function gitDirFromPointer(text, holder) {
139
149
  return isAbsolute(target) ? target : resolve(holder, target);
140
150
  }
141
151
  function commonDirOf(gitDir) {
142
- const pointer = entryKind(join3(gitDir, "commondir")) === "file" ? readTextOrNull(join3(gitDir, "commondir"))?.trim() : null;
152
+ const pointer = entryKind(join4(gitDir, "commondir")) === "file" ? readTextOrNull(join4(gitDir, "commondir"))?.trim() : null;
143
153
  if (!pointer) return gitDir;
144
154
  return isAbsolute(pointer) ? pointer : resolve(gitDir, pointer);
145
155
  }
146
156
  function isBare(commonDir) {
147
- const config = readTextOrNull(join3(commonDir, "config"));
157
+ const config = readTextOrNull(join4(commonDir, "config"));
148
158
  return config !== null && /^\s*bare\s*=\s*true\s*$/im.test(config);
149
159
  }
150
160
  function looksLikeBareRepository(directory) {
151
- return entryKind(join3(directory, "HEAD")) === "file" && entryKind(join3(directory, "objects")) === "dir" && entryKind(join3(directory, "refs")) === "dir";
161
+ return entryKind(join4(directory, "HEAD")) === "file" && entryKind(join4(directory, "objects")) === "dir" && entryKind(join4(directory, "refs")) === "dir";
152
162
  }
153
163
  function canonical(path) {
154
164
  try {
@@ -165,7 +175,7 @@ function resolved(commonDir) {
165
175
  function probeOnce(directory) {
166
176
  let current2 = resolve(directory);
167
177
  for (; ; ) {
168
- const dotGit = join3(current2, ".git");
178
+ const dotGit = join4(current2, ".git");
169
179
  const kind = entryKind(dotGit);
170
180
  if (kind === "dir") {
171
181
  const layout = resolved(commonDirOf(dotGit));
@@ -276,7 +286,7 @@ function gitProjectName(directory, resolveWorktrees, sessionRoot = "") {
276
286
  return dirName(sessionRoot || directory);
277
287
  }
278
288
  function configuredDir(dir) {
279
- const expanded = dir === "~" || dir.startsWith("~/") ? join4(homedir(), dir.slice(1)) : dir;
289
+ const expanded = dir === "~" || dir.startsWith("~/") ? join5(homedir2(), dir.slice(1)) : dir;
280
290
  return normalize(expanded).replace(new RegExp(`\\${sep}+$`), "");
281
291
  }
282
292
  function isWithin(directory, configured) {
@@ -371,7 +381,7 @@ function parseHashedCron(cron) {
371
381
 
372
382
  // src/core/util.ts
373
383
  import { accessSync, constants } from "fs";
374
- import { delimiter, join as join5 } from "path";
384
+ import { delimiter, join as join6 } from "path";
375
385
 
376
386
  // src/core/hindsight.ts
377
387
  var DEFAULT_OBSERVATION_SCOPES = "shared";
@@ -379,7 +389,7 @@ var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
379
389
  var RETRY_AFTER_CEILING_MS = 60 * 1e3;
380
390
 
381
391
  // src/core/config.ts
382
- var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join6(homedir2(), ".hindsight", "coding-agent.json");
392
+ var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join7(homedir3(), ".hindsight", "coding-agent.json");
383
393
  var DEFAULT_DAEMON_PORT = 9077;
384
394
  var DEFAULT_DAEMON_PROFILE = "coding-agent";
385
395
  function resolvePageTrigger(raw) {