@vectorize-io/hindsight-coding-agents 0.4.2 → 0.5.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 +202 -51
- package/dist/antigravity-hook.js +637 -199
- package/dist/antigravity-statusline.js +219 -84
- package/dist/antigravity-stop-hook.js +654 -205
- package/dist/claude-hook.js +637 -199
- package/dist/claude-sessionstart-hook.js +863 -236
- package/dist/claude-stop-hook.js +654 -205
- package/dist/cline.js +589 -234
- package/dist/codex-hook.js +637 -199
- package/dist/codex-sessionstart-hook.js +863 -236
- package/dist/codex-stop-hook.js +654 -205
- package/dist/copilot-hook.js +637 -199
- package/dist/copilot-sessionstart-hook.js +863 -236
- package/dist/copilot-stop-hook.js +654 -205
- package/dist/cursor-hook.js +637 -199
- package/dist/cursor-sessionstart-hook.js +863 -236
- package/dist/cursor-stop-hook.js +654 -205
- package/dist/daemon-start.js +62 -43
- package/dist/dcode-hook.js +2577 -0
- package/dist/dcode-sessionstart-hook.js +3194 -0
- package/dist/dcode-stop-hook.js +2807 -0
- package/dist/deepen.js +361 -204
- package/dist/devin-hook.js +637 -199
- package/dist/devin-sessionstart-hook.js +863 -236
- package/dist/devin-stop-hook.js +654 -205
- package/dist/dsh.js +592 -235
- package/dist/grok-hook.js +637 -199
- package/dist/grok-sessionstart-hook.js +863 -236
- package/dist/grok-stop-hook.js +654 -205
- package/dist/hindsight-seed.js +222 -83
- package/dist/index.js +589 -234
- package/dist/installer.js +2343 -302
- package/dist/kilo.js +589 -234
- package/dist/mcp-server.js +363 -169
- package/dist/opencode2.js +30092 -0
- package/dist/pi.js +17650 -0
- package/dist/prime-agent.js +625 -260
- package/dist/qwen-hook.js +2577 -0
- package/dist/qwen-sessionstart-hook.js +3194 -0
- package/dist/qwen-stop-hook.js +2807 -0
- package/dist/status.js +300 -136
- package/hooks/hooks.json +37 -0
- package/index.js +10 -0
- package/package.json +15 -8
- package/plugin.json +16 -0
- package/skill/SKILL.md +114 -43
package/dist/daemon-start.js
CHANGED
|
@@ -114,20 +114,20 @@ var init_dist = __esm({
|
|
|
114
114
|
const args = [...baseArgs, "daemon", "--profile", this.profile, "stop"];
|
|
115
115
|
const child = spawn(cmd, args, { stdio: "pipe" });
|
|
116
116
|
this.pipeOutput(child, "daemon.stop");
|
|
117
|
-
await new Promise((
|
|
117
|
+
await new Promise((resolve2) => {
|
|
118
118
|
const timeout = setTimeout(() => {
|
|
119
119
|
this.logger.warn(`[hindsight] daemon stop timed out after 5s`);
|
|
120
|
-
|
|
120
|
+
resolve2();
|
|
121
121
|
}, 5e3);
|
|
122
122
|
child.on("exit", () => {
|
|
123
123
|
clearTimeout(timeout);
|
|
124
124
|
this.logger.info(`[hindsight] daemon stopped`);
|
|
125
|
-
|
|
125
|
+
resolve2();
|
|
126
126
|
});
|
|
127
127
|
child.on("error", (err) => {
|
|
128
128
|
clearTimeout(timeout);
|
|
129
129
|
this.logger.warn(`[hindsight] error stopping daemon: ${err.message}`);
|
|
130
|
-
|
|
130
|
+
resolve2();
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
133
|
}
|
|
@@ -247,10 +247,10 @@ var init_dist = __esm({
|
|
|
247
247
|
if (line) this.logger.warn(`[hindsight:${label}] ${line}`);
|
|
248
248
|
}
|
|
249
249
|
});
|
|
250
|
-
await new Promise((
|
|
250
|
+
await new Promise((resolve2, reject) => {
|
|
251
251
|
child.on("exit", (code) => {
|
|
252
252
|
if (code === 0) {
|
|
253
|
-
|
|
253
|
+
resolve2();
|
|
254
254
|
} else {
|
|
255
255
|
reject(new Error(`${label} failed with code ${code}: ${output.trim()}`));
|
|
256
256
|
}
|
|
@@ -289,7 +289,7 @@ var init_dist = __esm({
|
|
|
289
289
|
}
|
|
290
290
|
} catch {
|
|
291
291
|
}
|
|
292
|
-
await new Promise((
|
|
292
|
+
await new Promise((resolve2) => setTimeout(resolve2, this.readyPollIntervalMs));
|
|
293
293
|
}
|
|
294
294
|
throw new Error(
|
|
295
295
|
`Hindsight daemon did not become ready within ${this.readyTimeoutMs}ms at ${this.baseUrl}`
|
|
@@ -300,9 +300,9 @@ var init_dist = __esm({
|
|
|
300
300
|
});
|
|
301
301
|
|
|
302
302
|
// src/core/config.ts
|
|
303
|
-
import { readFileSync } from "fs";
|
|
303
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
304
304
|
import { homedir as homedir2 } from "os";
|
|
305
|
-
import { join as
|
|
305
|
+
import { join as join6 } from "path";
|
|
306
306
|
|
|
307
307
|
// src/core/seed.ts
|
|
308
308
|
import { spawn as realSpawn } from "child_process";
|
|
@@ -311,15 +311,17 @@ import { fileURLToPath } from "url";
|
|
|
311
311
|
var DEFAULT_SEED_LIMIT = 300;
|
|
312
312
|
|
|
313
313
|
// src/core/bank.ts
|
|
314
|
-
import { execFileSync } from "child_process";
|
|
315
314
|
import { existsSync } from "fs";
|
|
316
315
|
import { homedir } from "os";
|
|
317
|
-
import { basename, dirname as
|
|
316
|
+
import { basename, dirname as dirname4, join as join4, normalize, sep } from "path";
|
|
317
|
+
|
|
318
|
+
// src/core/diag.ts
|
|
319
|
+
import { appendFileSync as appendFileSync2 } from "fs";
|
|
318
320
|
|
|
319
321
|
// src/core/log.ts
|
|
320
322
|
import { appendFileSync, mkdirSync } from "fs";
|
|
321
323
|
import { tmpdir } from "os";
|
|
322
|
-
import { dirname as
|
|
324
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
323
325
|
var WEIGHT = { debug: 10, info: 20, warn: 30, error: 40 };
|
|
324
326
|
var current = ["debug", "info", "warn", "error"].find(
|
|
325
327
|
(l) => l === process.env.HINDSIGHT_LOG_LEVEL
|
|
@@ -328,13 +330,13 @@ function setLogLevel(level) {
|
|
|
328
330
|
if (!process.env.HINDSIGHT_LOG_LEVEL) current = level;
|
|
329
331
|
}
|
|
330
332
|
function logFilePath() {
|
|
331
|
-
return process.env.HINDSIGHT_LOG_FILE ||
|
|
333
|
+
return process.env.HINDSIGHT_LOG_FILE || join2(tmpdir(), "hindsight-coding-agent", "plugin.log");
|
|
332
334
|
}
|
|
333
335
|
function write(level, scope, msg, extra) {
|
|
334
336
|
if (WEIGHT[level] < WEIGHT[current]) return;
|
|
335
337
|
try {
|
|
336
338
|
const file = logFilePath();
|
|
337
|
-
mkdirSync(
|
|
339
|
+
mkdirSync(dirname2(file), { recursive: true });
|
|
338
340
|
appendFileSync(
|
|
339
341
|
file,
|
|
340
342
|
`${(/* @__PURE__ */ new Date()).toISOString()} ${level.toUpperCase().padEnd(5)} [${scope}] ${msg}` + (extra && Object.keys(extra).length ? ` ${JSON.stringify(extra)}` : "") + "\n"
|
|
@@ -349,13 +351,36 @@ var log = {
|
|
|
349
351
|
error: (scope, msg, extra) => write("error", scope, msg, extra)
|
|
350
352
|
};
|
|
351
353
|
|
|
354
|
+
// src/core/diag.ts
|
|
355
|
+
function diagFilePath() {
|
|
356
|
+
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
357
|
+
}
|
|
358
|
+
function diag(harness, event, extra = {}) {
|
|
359
|
+
log.debug(harness, `diag:${event}`, extra);
|
|
360
|
+
try {
|
|
361
|
+
appendFileSync2(
|
|
362
|
+
diagFilePath(),
|
|
363
|
+
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
364
|
+
);
|
|
365
|
+
} catch {
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// src/core/git-layout.ts
|
|
370
|
+
import { lstatSync, readFileSync, realpathSync } from "fs";
|
|
371
|
+
import { dirname as dirname3, isAbsolute, join as join3, resolve } from "path";
|
|
372
|
+
|
|
373
|
+
// src/core/util.ts
|
|
374
|
+
import { accessSync, constants } from "fs";
|
|
375
|
+
import { delimiter, join as join5 } from "path";
|
|
376
|
+
|
|
352
377
|
// src/core/hindsight.ts
|
|
353
378
|
var DEFAULT_OBSERVATION_SCOPES = "shared";
|
|
354
379
|
var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
|
|
355
380
|
var RETRY_AFTER_CEILING_MS = 60 * 1e3;
|
|
356
381
|
|
|
357
382
|
// src/core/config.ts
|
|
358
|
-
var CONFIG_PATH = process.env.HINDSIGHT_CONFIG ||
|
|
383
|
+
var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join6(homedir2(), ".hindsight", "coding-agent.json");
|
|
359
384
|
var DEFAULT_DAEMON_PORT = 9077;
|
|
360
385
|
var DEFAULT_DAEMON_PROFILE = "coding-agent";
|
|
361
386
|
function resolvePageTriggerType(raw) {
|
|
@@ -379,7 +404,13 @@ function resolveReflectBudget(raw) {
|
|
|
379
404
|
log.warn("config", `ignoring reflectBudget=${JSON.stringify(value)} \u2014 expected low|mid|high`);
|
|
380
405
|
return "high";
|
|
381
406
|
}
|
|
382
|
-
var OBSERVATION_SCOPE_MODES = [
|
|
407
|
+
var OBSERVATION_SCOPE_MODES = [
|
|
408
|
+
"shared",
|
|
409
|
+
"combined",
|
|
410
|
+
"per_tag",
|
|
411
|
+
"all_combinations",
|
|
412
|
+
"per_source"
|
|
413
|
+
];
|
|
383
414
|
function resolveObservationScopes(raw) {
|
|
384
415
|
const value = raw;
|
|
385
416
|
if (typeof value === "string")
|
|
@@ -417,6 +448,7 @@ function resolveConfig(raw = {}) {
|
|
|
417
448
|
disabled: raw.disabled ?? false,
|
|
418
449
|
retainSessions: raw.retainSessions ?? true,
|
|
419
450
|
// write sessions back by default, every harness
|
|
451
|
+
manageBankConfig: raw.manageBankConfig ?? true,
|
|
420
452
|
maxParallelRetains: raw.maxParallelRetains || 10,
|
|
421
453
|
reflectTimeoutMs: raw.reflectTimeoutMs || 12e4,
|
|
422
454
|
// Inherit an explicitly-raised reflectTimeoutMs (that is what users reaching for a longer
|
|
@@ -443,12 +475,13 @@ function resolveConfig(raw = {}) {
|
|
|
443
475
|
) : {},
|
|
444
476
|
observationScopes: resolveObservationScopes(raw.observationScopes),
|
|
445
477
|
banks: raw.banks && typeof raw.banks === "object" ? raw.banks : {},
|
|
446
|
-
logLevel: ["debug", "info", "warn", "error"].includes(raw.logLevel) ? raw.logLevel : "info"
|
|
478
|
+
logLevel: ["debug", "info", "warn", "error"].includes(raw.logLevel) ? raw.logLevel : "info",
|
|
479
|
+
autoUpdate: raw.autoUpdate ?? true
|
|
447
480
|
};
|
|
448
481
|
}
|
|
449
482
|
function readRaw(path) {
|
|
450
483
|
try {
|
|
451
|
-
return JSON.parse(
|
|
484
|
+
return JSON.parse(readFileSync2(path, "utf8"));
|
|
452
485
|
} catch (e) {
|
|
453
486
|
if (e?.code !== "ENOENT") {
|
|
454
487
|
console.error(`hindsight: ignoring invalid config at ${path}: ${e?.message || e}`);
|
|
@@ -501,13 +534,15 @@ var ENV_KEYS = {
|
|
|
501
534
|
surveyBudgetUsd: "HINDSIGHT_SURVEY_BUDGET_USD",
|
|
502
535
|
surveyRefreshCommits: "HINDSIGHT_SURVEY_REFRESH_COMMITS",
|
|
503
536
|
logLevel: "HINDSIGHT_LOG_LEVEL",
|
|
537
|
+
autoUpdate: "HINDSIGHT_AUTO_UPDATE",
|
|
504
538
|
gitIngest: "HINDSIGHT_GIT_INGEST",
|
|
505
539
|
// Scalar modes only ("shared", "combined", "per_tag", "all_combinations"). An explicit scope
|
|
506
540
|
// list is a list OF lists, which does not survive flattening into one variable — file-only.
|
|
507
541
|
observationScopes: "HINDSIGHT_OBSERVATION_SCOPES",
|
|
508
542
|
// Comma-separated, e.g. HINDSIGHT_RETAIN_TAGS="project:{gitProject},env:work". A LIST rather than
|
|
509
543
|
// a map, so it flattens cleanly; its sibling retainMetadata stays file-only for the reason above.
|
|
510
|
-
retainTags: "HINDSIGHT_RETAIN_TAGS"
|
|
544
|
+
retainTags: "HINDSIGHT_RETAIN_TAGS",
|
|
545
|
+
manageBankConfig: "HINDSIGHT_MANAGE_BANK_CONFIG"
|
|
511
546
|
};
|
|
512
547
|
var ENV_BOOLEANS = /* @__PURE__ */ new Set([
|
|
513
548
|
"dynamicBankId",
|
|
@@ -517,7 +552,9 @@ var ENV_BOOLEANS = /* @__PURE__ */ new Set([
|
|
|
517
552
|
"retainSessions",
|
|
518
553
|
"autoReflect",
|
|
519
554
|
"autoSeed",
|
|
520
|
-
"codebaseSurvey"
|
|
555
|
+
"codebaseSurvey",
|
|
556
|
+
"autoUpdate",
|
|
557
|
+
"manageBankConfig"
|
|
521
558
|
]);
|
|
522
559
|
var ENV_LISTS = /* @__PURE__ */ new Set(["retainTags", "optInPaths"]);
|
|
523
560
|
var ENV_NUMBERS = /* @__PURE__ */ new Set([
|
|
@@ -560,27 +597,9 @@ function loadConfig(opts = {}) {
|
|
|
560
597
|
}
|
|
561
598
|
|
|
562
599
|
// src/core/daemon.ts
|
|
563
|
-
import { execFileSync
|
|
564
|
-
import { dirname as
|
|
600
|
+
import { execFileSync, spawn as realSpawn2 } from "child_process";
|
|
601
|
+
import { dirname as dirname5, join as join7 } from "path";
|
|
565
602
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
566
|
-
|
|
567
|
-
// src/core/diag.ts
|
|
568
|
-
import { appendFileSync as appendFileSync2 } from "fs";
|
|
569
|
-
function diagFilePath() {
|
|
570
|
-
return process.env.HINDSIGHT_DIAG_FILE || "/tmp/hindsight-plugin.log";
|
|
571
|
-
}
|
|
572
|
-
function diag(harness, event, extra = {}) {
|
|
573
|
-
log.debug(harness, `diag:${event}`, extra);
|
|
574
|
-
try {
|
|
575
|
-
appendFileSync2(
|
|
576
|
-
diagFilePath(),
|
|
577
|
-
JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), harness, event, ...extra }) + "\n"
|
|
578
|
-
);
|
|
579
|
-
} catch {
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
// src/core/daemon.ts
|
|
584
603
|
async function isServerHealthy(baseUrl, timeoutMs = 2e3) {
|
|
585
604
|
try {
|
|
586
605
|
const res = await fetch(`${baseUrl}/health`, { signal: AbortSignal.timeout(timeoutMs) });
|
|
@@ -592,7 +611,7 @@ async function isServerHealthy(baseUrl, timeoutMs = 2e3) {
|
|
|
592
611
|
function hasRustToolchain() {
|
|
593
612
|
if (process.platform !== "darwin") return true;
|
|
594
613
|
try {
|
|
595
|
-
|
|
614
|
+
execFileSync("cargo", ["--version"], {
|
|
596
615
|
stdio: "pipe",
|
|
597
616
|
timeout: 1e4,
|
|
598
617
|
windowsHide: true
|
|
@@ -604,7 +623,7 @@ function hasRustToolchain() {
|
|
|
604
623
|
}
|
|
605
624
|
function hasUvx() {
|
|
606
625
|
try {
|
|
607
|
-
|
|
626
|
+
execFileSync("uvx", ["--version"], {
|
|
608
627
|
stdio: "pipe",
|
|
609
628
|
timeout: 1e4,
|
|
610
629
|
windowsHide: true
|
|
@@ -640,7 +659,7 @@ function detectLlm(env = process.env) {
|
|
|
640
659
|
}
|
|
641
660
|
function onPath(bin) {
|
|
642
661
|
try {
|
|
643
|
-
|
|
662
|
+
execFileSync("which", [bin], {
|
|
644
663
|
stdio: "pipe",
|
|
645
664
|
timeout: 5e3,
|
|
646
665
|
windowsHide: true
|