@vectorize-io/hindsight-coding-agents 0.7.0 → 0.8.1
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 +201 -16
- package/dist/antigravity-hook.js +1132 -115
- package/dist/antigravity-statusline.js +77 -11
- package/dist/antigravity-stop-hook.js +1193 -133
- package/dist/claude-hook.js +1132 -115
- package/dist/claude-sessionstart-hook.js +1241 -140
- package/dist/claude-stop-hook.js +1193 -133
- package/dist/cline.js +578 -163
- package/dist/codebuddy-hook.js +4270 -0
- package/dist/codebuddy-sessionstart-hook.js +5030 -0
- package/dist/codebuddy-stop-hook.js +4564 -0
- package/dist/codex-hook.js +1132 -115
- package/dist/codex-sessionstart-hook.js +1241 -140
- package/dist/codex-stop-hook.js +1193 -133
- package/dist/copilot-hook.js +1132 -115
- package/dist/copilot-sessionstart-hook.js +1241 -140
- package/dist/copilot-stop-hook.js +1193 -133
- package/dist/cursor-hook.js +1132 -115
- package/dist/cursor-sessionstart-hook.js +1241 -140
- package/dist/cursor-stop-hook.js +1193 -133
- package/dist/daemon-start.js +54 -9
- package/dist/dcode-hook.js +1132 -115
- package/dist/dcode-sessionstart-hook.js +1241 -140
- package/dist/dcode-stop-hook.js +1193 -133
- package/dist/deepen.js +370 -104
- package/dist/devin-hook.js +1132 -115
- package/dist/devin-sessionstart-hook.js +1241 -140
- package/dist/devin-stop-hook.js +1193 -133
- package/dist/droid-hook.js +1132 -115
- package/dist/droid-sessionstart-hook.js +1241 -140
- package/dist/droid-stop-hook.js +1193 -133
- package/dist/dsh.js +586 -164
- package/dist/grok-hook.js +1132 -115
- package/dist/grok-sessionstart-hook.js +1241 -140
- package/dist/grok-stop-hook.js +1193 -133
- package/dist/hindsight-seed.js +50 -8
- package/dist/index.js +587 -172
- package/dist/installer.js +2010 -769
- package/dist/kilo.js +587 -172
- package/dist/kimi-hook.js +4270 -0
- package/dist/kimi-sessionstart-hook.js +5030 -0
- package/dist/kimi-stop-hook.js +4564 -0
- package/dist/mcp-server.js +419 -115
- package/dist/opencode2.js +586 -169
- package/dist/pi.js +644 -175
- package/dist/prime-agent.js +644 -175
- package/dist/qwen-hook.js +1132 -115
- package/dist/qwen-sessionstart-hook.js +1241 -140
- package/dist/qwen-stop-hook.js +1193 -133
- package/dist/status.js +243 -52
- package/dist/traecode-hook.js +4270 -0
- package/dist/traecode-sessionstart-hook.js +5030 -0
- package/dist/traecode-stop-hook.js +4564 -0
- package/dist/workbuddy-hook.js +4270 -0
- package/dist/workbuddy-sessionstart-hook.js +5030 -0
- package/dist/workbuddy-stop-hook.js +4564 -0
- package/dist/zcode-hook.js +1132 -115
- package/dist/zcode-sessionstart-hook.js +1241 -140
- package/dist/zcode-stop-hook.js +1193 -133
- package/package.json +22 -12
- package/plugin.json +1 -1
- package/skill/SKILL.md +73 -14
package/dist/daemon-start.js
CHANGED
|
@@ -27,8 +27,8 @@ function getEmbedCommand(opts = {}) {
|
|
|
27
27
|
if (opts.embedPackagePath) {
|
|
28
28
|
return ["uv", "run", "--directory", opts.embedPackagePath, "hindsight-embed"];
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
return ["uvx", `hindsight-embed@${
|
|
30
|
+
const version2 = opts.embedVersion && opts.embedVersion.length > 0 ? opts.embedVersion : "latest";
|
|
31
|
+
return ["uvx", `hindsight-embed@${version2}`];
|
|
32
32
|
}
|
|
33
33
|
var silentLogger, consoleLogger, DEFAULT_PORT, DEFAULT_HOST, DEFAULT_PROFILE, DEFAULT_READY_TIMEOUT_MS, DEFAULT_READY_POLL_INTERVAL_MS, HindsightServer;
|
|
34
34
|
var init_dist = __esm({
|
|
@@ -112,7 +112,7 @@ var init_dist = __esm({
|
|
|
112
112
|
embedPackagePath: this.embedPackagePath
|
|
113
113
|
});
|
|
114
114
|
const args = [...baseArgs, "daemon", "--profile", this.profile, "stop"];
|
|
115
|
-
const child = spawn(cmd, args, { stdio: "pipe" });
|
|
115
|
+
const child = spawn(cmd, args, { stdio: "pipe", windowsHide: true });
|
|
116
116
|
this.pipeOutput(child, "daemon.stop");
|
|
117
117
|
await new Promise((resolve2) => {
|
|
118
118
|
const timeout = setTimeout(() => {
|
|
@@ -231,7 +231,7 @@ var init_dist = __esm({
|
|
|
231
231
|
* once it exits with code 0. Rejects on non-zero exit or spawn error.
|
|
232
232
|
*/
|
|
233
233
|
async runCommand(cmd, args, env, label) {
|
|
234
|
-
const child = spawn(cmd, args, { stdio: "pipe", env });
|
|
234
|
+
const child = spawn(cmd, args, { stdio: "pipe", env, windowsHide: true });
|
|
235
235
|
let output = "";
|
|
236
236
|
child.stdout?.on("data", (data) => {
|
|
237
237
|
const text = data.toString();
|
|
@@ -300,7 +300,7 @@ var init_dist = __esm({
|
|
|
300
300
|
});
|
|
301
301
|
|
|
302
302
|
// src/core/config.ts
|
|
303
|
-
import { readFileSync as
|
|
303
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
304
304
|
import { homedir as homedir3 } from "os";
|
|
305
305
|
import { join as join7 } from "path";
|
|
306
306
|
|
|
@@ -316,6 +316,7 @@ import { homedir as homedir2 } from "os";
|
|
|
316
316
|
import { basename, dirname as dirname4, join as join5, normalize, sep } from "path";
|
|
317
317
|
|
|
318
318
|
// src/core/diag.ts
|
|
319
|
+
import { readFileSync } from "fs";
|
|
319
320
|
import { join as join3 } from "path";
|
|
320
321
|
|
|
321
322
|
// src/core/log.ts
|
|
@@ -377,7 +378,7 @@ function diag(harness, event, extra = {}) {
|
|
|
377
378
|
}
|
|
378
379
|
|
|
379
380
|
// src/core/git-layout.ts
|
|
380
|
-
import { lstatSync, readFileSync, realpathSync } from "fs";
|
|
381
|
+
import { lstatSync, readFileSync as readFileSync2, realpathSync } from "fs";
|
|
381
382
|
import { dirname as dirname3, isAbsolute, join as join4, resolve } from "path";
|
|
382
383
|
|
|
383
384
|
// src/core/missions.ts
|
|
@@ -443,12 +444,21 @@ function parseHashedCron(cron) {
|
|
|
443
444
|
}
|
|
444
445
|
return fields;
|
|
445
446
|
}
|
|
447
|
+
var PLUGIN_GOVERNED_BANK_FIELDS = [
|
|
448
|
+
"retain_strategies",
|
|
449
|
+
"entity_labels",
|
|
450
|
+
"retain_extraction_mode"
|
|
451
|
+
];
|
|
452
|
+
|
|
453
|
+
// package.json
|
|
454
|
+
var version = "0.8.1";
|
|
446
455
|
|
|
447
456
|
// src/core/util.ts
|
|
448
457
|
import { accessSync, constants } from "fs";
|
|
449
458
|
import { delimiter, join as join6 } from "path";
|
|
450
459
|
|
|
451
460
|
// src/core/hindsight.ts
|
|
461
|
+
var USER_AGENT = `hindsight-coding-agents/${version}`;
|
|
452
462
|
var DEFAULT_OBSERVATION_SCOPES = "shared";
|
|
453
463
|
var DEFAULT_PAGE_SEARCH_LIMIT = 10;
|
|
454
464
|
var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
|
|
@@ -533,6 +543,7 @@ function resolveCustomPages(raw) {
|
|
|
533
543
|
}
|
|
534
544
|
var DEFAULT_REFLECT_TIMEOUT_MS = 2e4;
|
|
535
545
|
var DEFAULT_REFLECT_TOOL_TIMEOUT_MS = 33e4;
|
|
546
|
+
var DEFAULT_INJECT_TIMEOUT_MS = 7e3;
|
|
536
547
|
var REFLECT_BUDGETS = ["low", "mid", "high"];
|
|
537
548
|
function resolveReflectBudget(raw) {
|
|
538
549
|
const value = raw.reflectBudget;
|
|
@@ -559,6 +570,22 @@ function resolveObservationScopes(raw) {
|
|
|
559
570
|
}
|
|
560
571
|
return DEFAULT_OBSERVATION_SCOPES;
|
|
561
572
|
}
|
|
573
|
+
function resolveDefaultBankConfig(raw) {
|
|
574
|
+
const value = raw;
|
|
575
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
576
|
+
const out = {};
|
|
577
|
+
for (const [key, v] of Object.entries(value)) {
|
|
578
|
+
if (PLUGIN_GOVERNED_BANK_FIELDS.includes(key)) {
|
|
579
|
+
log.warn(
|
|
580
|
+
"config",
|
|
581
|
+
`ignoring defaultBankConfig.${key} \u2014 the plugin manages this field itself` + (key === "retain_extraction_mode" ? " (set retainExtractionMode instead)" : "")
|
|
582
|
+
);
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
out[key] = v;
|
|
586
|
+
}
|
|
587
|
+
return out;
|
|
588
|
+
}
|
|
562
589
|
var AUTO_INJECT_MODES = ["reflect", "pages", "recall", "none"];
|
|
563
590
|
function resolveAutoInject(raw) {
|
|
564
591
|
if (raw.autoReflect !== void 0) {
|
|
@@ -598,18 +625,21 @@ function resolveConfig(raw = {}) {
|
|
|
598
625
|
// write sessions back by default, every harness
|
|
599
626
|
manageBankConfig: raw.manageBankConfig ?? true,
|
|
600
627
|
retainExtractionMode: RETAIN_EXTRACTION_MODES.includes(raw.retainExtractionMode) ? raw.retainExtractionMode : DEFAULT_RETAIN_EXTRACTION_MODE,
|
|
628
|
+
defaultBankConfig: resolveDefaultBankConfig(raw.defaultBankConfig),
|
|
601
629
|
maxParallelRetains: raw.maxParallelRetains || 10,
|
|
602
630
|
reflectTimeoutMs: raw.reflectTimeoutMs || DEFAULT_REFLECT_TIMEOUT_MS,
|
|
603
631
|
// Inherit an explicitly-raised reflectTimeoutMs (that is what users reaching for a longer
|
|
604
632
|
// reflect already set), but never let it LOWER the tool below the default — a short window is
|
|
605
633
|
// set to bound the automatic hook, not to cut off a call the agent is waiting on.
|
|
606
634
|
reflectToolTimeoutMs: raw.reflectToolTimeoutMs || Math.max(raw.reflectTimeoutMs || 0, DEFAULT_REFLECT_TOOL_TIMEOUT_MS),
|
|
635
|
+
injectTimeoutMs: raw.injectTimeoutMs || DEFAULT_INJECT_TIMEOUT_MS,
|
|
607
636
|
reflectBudget: resolveReflectBudget(raw),
|
|
608
637
|
autoInject: resolveAutoInject(raw),
|
|
609
638
|
pageSearchLimit: raw.pageSearchLimit || DEFAULT_PAGE_SEARCH_LIMIT,
|
|
610
639
|
// Same shape as retainMetadata: an object, or nothing. An array would spread into numeric
|
|
611
640
|
// keys and reach the API as garbage, so it is rejected like any other non-object.
|
|
612
641
|
recallOptions: raw.recallOptions && typeof raw.recallOptions === "object" && !Array.isArray(raw.recallOptions) ? { ...raw.recallOptions } : {},
|
|
642
|
+
toolGuideExtra: typeof raw.toolGuideExtra === "string" && raw.toolGuideExtra.trim() ? raw.toolGuideExtra : void 0,
|
|
613
643
|
// Every turn, not every tenth. The guide is what tells the agent WHEN to reach for memory, and
|
|
614
644
|
// at a cadence of 10 a normal session is told once, on turn 1, and never again. Measured over
|
|
615
645
|
// 40 real Claude Code turns, moving this from 10 to 1 took searches from 15% of turns to 32.5%
|
|
@@ -629,18 +659,22 @@ function resolveConfig(raw = {}) {
|
|
|
629
659
|
// Hostile input is a config typo, not an attack: keep only string entries so a stray number or
|
|
630
660
|
// nested object cannot reach the API as a tag and fail the whole retain.
|
|
631
661
|
retainTags: Array.isArray(raw.retainTags) ? raw.retainTags.filter((t) => typeof t === "string" && t.trim() !== "") : [],
|
|
662
|
+
// Undefined, not "", when unset or blank: the retain call distinguishes "not configured" (use
|
|
663
|
+
// the built-in default) from a configured value, and an empty context would strip the default.
|
|
664
|
+
retainContext: typeof raw.retainContext === "string" && raw.retainContext.trim() !== "" ? raw.retainContext : void 0,
|
|
632
665
|
retainMetadata: raw.retainMetadata && typeof raw.retainMetadata === "object" ? Object.fromEntries(
|
|
633
666
|
Object.entries(raw.retainMetadata).filter(([, v]) => typeof v === "string")
|
|
634
667
|
) : {},
|
|
635
668
|
observationScopes: resolveObservationScopes(raw.observationScopes),
|
|
636
669
|
banks: raw.banks && typeof raw.banks === "object" ? raw.banks : {},
|
|
670
|
+
paths: raw.paths && typeof raw.paths === "object" ? raw.paths : {},
|
|
637
671
|
logLevel: ["debug", "info", "warn", "error"].includes(raw.logLevel) ? raw.logLevel : "info",
|
|
638
672
|
autoUpdate: raw.autoUpdate ?? true
|
|
639
673
|
};
|
|
640
674
|
}
|
|
641
675
|
function readRaw(path) {
|
|
642
676
|
try {
|
|
643
|
-
return JSON.parse(
|
|
677
|
+
return JSON.parse(readFileSync3(path, "utf8"));
|
|
644
678
|
} catch (e) {
|
|
645
679
|
if (e?.code !== "ENOENT") {
|
|
646
680
|
console.error(`hindsight: ignoring invalid config at ${path}: ${e?.message || e}`);
|
|
@@ -650,7 +684,12 @@ function readRaw(path) {
|
|
|
650
684
|
}
|
|
651
685
|
function mergeRaw(a, b) {
|
|
652
686
|
const { harnesses: _drop, ...flat } = b;
|
|
653
|
-
return {
|
|
687
|
+
return {
|
|
688
|
+
...a,
|
|
689
|
+
...flat,
|
|
690
|
+
banks: { ...a.banks ?? {}, ...b.banks ?? {} },
|
|
691
|
+
paths: { ...a.paths ?? {}, ...b.paths ?? {} }
|
|
692
|
+
};
|
|
654
693
|
}
|
|
655
694
|
function applyLayer(raw, layer, harness) {
|
|
656
695
|
let out = mergeRaw(raw, layer);
|
|
@@ -681,9 +720,11 @@ var ENV_KEYS = {
|
|
|
681
720
|
maxParallelRetains: "HINDSIGHT_MAX_PARALLEL_RETAINS",
|
|
682
721
|
reflectTimeoutMs: "HINDSIGHT_REFLECT_TIMEOUT_MS",
|
|
683
722
|
reflectToolTimeoutMs: "HINDSIGHT_REFLECT_TOOL_TIMEOUT_MS",
|
|
723
|
+
injectTimeoutMs: "HINDSIGHT_INJECT_TIMEOUT_MS",
|
|
684
724
|
reflectBudget: "HINDSIGHT_REFLECT_BUDGET",
|
|
685
725
|
autoInject: "HINDSIGHT_AUTO_INJECT",
|
|
686
726
|
pageSearchLimit: "HINDSIGHT_PAGE_SEARCH_LIMIT",
|
|
727
|
+
toolGuideExtra: "HINDSIGHT_TOOL_GUIDE_EXTRA",
|
|
687
728
|
autoReflect: "HINDSIGHT_AUTO_REFLECT",
|
|
688
729
|
pageRefreshEveryTurns: "HINDSIGHT_PAGE_REFRESH_EVERY_TURNS",
|
|
689
730
|
pageTriggerType: "HINDSIGHT_PAGE_TRIGGER_TYPE",
|
|
@@ -725,6 +766,7 @@ var ENV_NUMBERS = /* @__PURE__ */ new Set([
|
|
|
725
766
|
"maxParallelRetains",
|
|
726
767
|
"reflectTimeoutMs",
|
|
727
768
|
"reflectToolTimeoutMs",
|
|
769
|
+
"injectTimeoutMs",
|
|
728
770
|
"pageSearchLimit",
|
|
729
771
|
"pageRefreshEveryTurns",
|
|
730
772
|
"seedLimit",
|
|
@@ -765,7 +807,10 @@ import { dirname as dirname5, join as join8 } from "path";
|
|
|
765
807
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
766
808
|
async function isServerHealthy(baseUrl, timeoutMs = 2e3) {
|
|
767
809
|
try {
|
|
768
|
-
const res = await fetch(`${baseUrl}/health`, {
|
|
810
|
+
const res = await fetch(`${baseUrl}/health`, {
|
|
811
|
+
headers: { "User-Agent": USER_AGENT },
|
|
812
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
813
|
+
});
|
|
769
814
|
return res.ok;
|
|
770
815
|
} catch {
|
|
771
816
|
return false;
|