@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.
- package/README.md +24 -7
- package/dist/antigravity-hook.js +205 -81
- package/dist/antigravity-statusline.js +32 -22
- package/dist/antigravity-stop-hook.js +216 -79
- package/dist/claude-hook.js +205 -81
- package/dist/claude-sessionstart-hook.js +167 -105
- package/dist/claude-stop-hook.js +216 -79
- package/dist/cline.js +279 -86
- package/dist/codex-hook.js +205 -81
- package/dist/codex-sessionstart-hook.js +167 -105
- package/dist/codex-stop-hook.js +216 -79
- package/dist/copilot-hook.js +205 -81
- package/dist/copilot-sessionstart-hook.js +167 -105
- package/dist/copilot-stop-hook.js +216 -79
- package/dist/cursor-hook.js +205 -81
- package/dist/cursor-sessionstart-hook.js +167 -105
- package/dist/cursor-stop-hook.js +216 -79
- package/dist/daemon-start.js +28 -18
- package/dist/dcode-hook.js +205 -81
- package/dist/dcode-sessionstart-hook.js +167 -105
- package/dist/dcode-stop-hook.js +216 -79
- package/dist/deepen.js +98 -40
- package/dist/devin-hook.js +205 -81
- package/dist/devin-sessionstart-hook.js +167 -105
- package/dist/devin-stop-hook.js +216 -79
- package/dist/droid-hook.js +205 -81
- package/dist/droid-sessionstart-hook.js +167 -105
- package/dist/droid-stop-hook.js +216 -79
- package/dist/dsh.js +277 -85
- package/dist/grok-hook.js +205 -81
- package/dist/grok-sessionstart-hook.js +167 -105
- package/dist/grok-stop-hook.js +216 -79
- package/dist/hindsight-seed.js +32 -22
- package/dist/index.js +280 -88
- package/dist/installer.js +308 -214
- package/dist/kilo.js +280 -88
- package/dist/mcp-server.js +97 -39
- package/dist/opencode2.js +279 -87
- package/dist/pi.js +279 -87
- package/dist/prime-agent.js +279 -87
- package/dist/qwen-hook.js +205 -81
- package/dist/qwen-sessionstart-hook.js +167 -105
- package/dist/qwen-stop-hook.js +216 -79
- package/dist/status.js +94 -36
- package/dist/zcode-hook.js +205 -81
- package/dist/zcode-sessionstart-hook.js +167 -105
- package/dist/zcode-stop-hook.js +216 -79
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skill/SKILL.md +24 -7
package/dist/hindsight-seed.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// src/core/config.ts
|
|
4
4
|
import { readFileSync as readFileSync2 } from "fs";
|
|
5
|
-
import { homedir as
|
|
6
|
-
import { join as
|
|
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
|
|
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 {
|
|
57
|
+
import { join as join3 } from "path";
|
|
58
58
|
|
|
59
59
|
// src/core/log.ts
|
|
60
|
-
import { appendFileSync, mkdirSync } from "fs";
|
|
61
|
-
import {
|
|
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(
|
|
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
|
-
|
|
74
|
-
|
|
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 || "
|
|
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
|
-
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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 =
|
|
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("~/") ?
|
|
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
|
|
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 ||
|
|
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) {
|