@vectorize-io/hindsight-coding-agents 0.7.0 → 0.8.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 (56) hide show
  1. package/README.md +137 -13
  2. package/dist/antigravity-hook.js +711 -55
  3. package/dist/antigravity-statusline.js +68 -7
  4. package/dist/antigravity-stop-hook.js +771 -57
  5. package/dist/claude-hook.js +711 -55
  6. package/dist/claude-sessionstart-hook.js +789 -68
  7. package/dist/claude-stop-hook.js +771 -57
  8. package/dist/cline.js +295 -75
  9. package/dist/codex-hook.js +711 -55
  10. package/dist/codex-sessionstart-hook.js +789 -68
  11. package/dist/codex-stop-hook.js +771 -57
  12. package/dist/copilot-hook.js +711 -55
  13. package/dist/copilot-sessionstart-hook.js +789 -68
  14. package/dist/copilot-stop-hook.js +771 -57
  15. package/dist/cursor-hook.js +711 -55
  16. package/dist/cursor-sessionstart-hook.js +789 -68
  17. package/dist/cursor-stop-hook.js +771 -57
  18. package/dist/daemon-start.js +38 -1
  19. package/dist/dcode-hook.js +711 -55
  20. package/dist/dcode-sessionstart-hook.js +789 -68
  21. package/dist/dcode-stop-hook.js +771 -57
  22. package/dist/deepen.js +236 -61
  23. package/dist/devin-hook.js +711 -55
  24. package/dist/devin-sessionstart-hook.js +789 -68
  25. package/dist/devin-stop-hook.js +771 -57
  26. package/dist/droid-hook.js +711 -55
  27. package/dist/droid-sessionstart-hook.js +789 -68
  28. package/dist/droid-stop-hook.js +771 -57
  29. package/dist/dsh.js +296 -76
  30. package/dist/grok-hook.js +711 -55
  31. package/dist/grok-sessionstart-hook.js +789 -68
  32. package/dist/grok-stop-hook.js +771 -57
  33. package/dist/hindsight-seed.js +41 -4
  34. package/dist/index.js +295 -75
  35. package/dist/installer.js +1148 -303
  36. package/dist/kilo.js +295 -75
  37. package/dist/kimi-hook.js +3909 -0
  38. package/dist/kimi-sessionstart-hook.js +4650 -0
  39. package/dist/kimi-stop-hook.js +4218 -0
  40. package/dist/mcp-server.js +162 -33
  41. package/dist/opencode2.js +298 -76
  42. package/dist/pi.js +299 -75
  43. package/dist/prime-agent.js +299 -75
  44. package/dist/qwen-hook.js +711 -55
  45. package/dist/qwen-sessionstart-hook.js +789 -68
  46. package/dist/qwen-stop-hook.js +771 -57
  47. package/dist/status.js +132 -14
  48. package/dist/traecode-hook.js +3909 -0
  49. package/dist/traecode-sessionstart-hook.js +4650 -0
  50. package/dist/traecode-stop-hook.js +4218 -0
  51. package/dist/zcode-hook.js +711 -55
  52. package/dist/zcode-sessionstart-hook.js +789 -68
  53. package/dist/zcode-stop-hook.js +771 -57
  54. package/package.json +15 -11
  55. package/plugin.json +1 -1
  56. package/skill/SKILL.md +70 -11
@@ -295,13 +295,13 @@ function isWithin(directory, configured) {
295
295
  function mapLookup(map, directory) {
296
296
  const cwd = normalize(directory);
297
297
  let best;
298
- for (const [dir, bank] of Object.entries(map)) {
298
+ for (const [dir, value] of Object.entries(map)) {
299
299
  const p = configuredDir(dir);
300
300
  if (isWithin(cwd, p)) {
301
- if (!best || p.length > best.len) best = { len: p.length, bank };
301
+ if (!best || p.length > best.len) best = { len: p.length, value };
302
302
  }
303
303
  }
304
- return best?.bank;
304
+ return best?.value;
305
305
  }
306
306
  function lookupDirectories(config, directory, sessionRoot = "") {
307
307
  const directories = [normalize(directory)];
@@ -408,6 +408,11 @@ function parseHashedCron(cron) {
408
408
  }
409
409
  return fields;
410
410
  }
411
+ var PLUGIN_GOVERNED_BANK_FIELDS = [
412
+ "retain_strategies",
413
+ "entity_labels",
414
+ "retain_extraction_mode"
415
+ ];
411
416
 
412
417
  // src/core/util.ts
413
418
  import { accessSync, constants } from "fs";
@@ -498,6 +503,7 @@ function resolveCustomPages(raw) {
498
503
  }
499
504
  var DEFAULT_REFLECT_TIMEOUT_MS = 2e4;
500
505
  var DEFAULT_REFLECT_TOOL_TIMEOUT_MS = 33e4;
506
+ var DEFAULT_INJECT_TIMEOUT_MS = 7e3;
501
507
  var REFLECT_BUDGETS = ["low", "mid", "high"];
502
508
  function resolveReflectBudget(raw) {
503
509
  const value = raw.reflectBudget;
@@ -524,6 +530,22 @@ function resolveObservationScopes(raw) {
524
530
  }
525
531
  return DEFAULT_OBSERVATION_SCOPES;
526
532
  }
533
+ function resolveDefaultBankConfig(raw) {
534
+ const value = raw;
535
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
536
+ const out = {};
537
+ for (const [key, v] of Object.entries(value)) {
538
+ if (PLUGIN_GOVERNED_BANK_FIELDS.includes(key)) {
539
+ log.warn(
540
+ "config",
541
+ `ignoring defaultBankConfig.${key} \u2014 the plugin manages this field itself` + (key === "retain_extraction_mode" ? " (set retainExtractionMode instead)" : "")
542
+ );
543
+ continue;
544
+ }
545
+ out[key] = v;
546
+ }
547
+ return out;
548
+ }
527
549
  var AUTO_INJECT_MODES = ["reflect", "pages", "recall", "none"];
528
550
  function resolveAutoInject(raw) {
529
551
  if (raw.autoReflect !== void 0) {
@@ -563,18 +585,21 @@ function resolveConfig(raw = {}) {
563
585
  // write sessions back by default, every harness
564
586
  manageBankConfig: raw.manageBankConfig ?? true,
565
587
  retainExtractionMode: RETAIN_EXTRACTION_MODES.includes(raw.retainExtractionMode) ? raw.retainExtractionMode : DEFAULT_RETAIN_EXTRACTION_MODE,
588
+ defaultBankConfig: resolveDefaultBankConfig(raw.defaultBankConfig),
566
589
  maxParallelRetains: raw.maxParallelRetains || 10,
567
590
  reflectTimeoutMs: raw.reflectTimeoutMs || DEFAULT_REFLECT_TIMEOUT_MS,
568
591
  // Inherit an explicitly-raised reflectTimeoutMs (that is what users reaching for a longer
569
592
  // reflect already set), but never let it LOWER the tool below the default — a short window is
570
593
  // set to bound the automatic hook, not to cut off a call the agent is waiting on.
571
594
  reflectToolTimeoutMs: raw.reflectToolTimeoutMs || Math.max(raw.reflectTimeoutMs || 0, DEFAULT_REFLECT_TOOL_TIMEOUT_MS),
595
+ injectTimeoutMs: raw.injectTimeoutMs || DEFAULT_INJECT_TIMEOUT_MS,
572
596
  reflectBudget: resolveReflectBudget(raw),
573
597
  autoInject: resolveAutoInject(raw),
574
598
  pageSearchLimit: raw.pageSearchLimit || DEFAULT_PAGE_SEARCH_LIMIT,
575
599
  // Same shape as retainMetadata: an object, or nothing. An array would spread into numeric
576
600
  // keys and reach the API as garbage, so it is rejected like any other non-object.
577
601
  recallOptions: raw.recallOptions && typeof raw.recallOptions === "object" && !Array.isArray(raw.recallOptions) ? { ...raw.recallOptions } : {},
602
+ toolGuideExtra: typeof raw.toolGuideExtra === "string" && raw.toolGuideExtra.trim() ? raw.toolGuideExtra : void 0,
578
603
  // Every turn, not every tenth. The guide is what tells the agent WHEN to reach for memory, and
579
604
  // at a cadence of 10 a normal session is told once, on turn 1, and never again. Measured over
580
605
  // 40 real Claude Code turns, moving this from 10 to 1 took searches from 15% of turns to 32.5%
@@ -594,11 +619,15 @@ function resolveConfig(raw = {}) {
594
619
  // Hostile input is a config typo, not an attack: keep only string entries so a stray number or
595
620
  // nested object cannot reach the API as a tag and fail the whole retain.
596
621
  retainTags: Array.isArray(raw.retainTags) ? raw.retainTags.filter((t) => typeof t === "string" && t.trim() !== "") : [],
622
+ // Undefined, not "", when unset or blank: the retain call distinguishes "not configured" (use
623
+ // the built-in default) from a configured value, and an empty context would strip the default.
624
+ retainContext: typeof raw.retainContext === "string" && raw.retainContext.trim() !== "" ? raw.retainContext : void 0,
597
625
  retainMetadata: raw.retainMetadata && typeof raw.retainMetadata === "object" ? Object.fromEntries(
598
626
  Object.entries(raw.retainMetadata).filter(([, v]) => typeof v === "string")
599
627
  ) : {},
600
628
  observationScopes: resolveObservationScopes(raw.observationScopes),
601
629
  banks: raw.banks && typeof raw.banks === "object" ? raw.banks : {},
630
+ paths: raw.paths && typeof raw.paths === "object" ? raw.paths : {},
602
631
  logLevel: ["debug", "info", "warn", "error"].includes(raw.logLevel) ? raw.logLevel : "info",
603
632
  autoUpdate: raw.autoUpdate ?? true
604
633
  };
@@ -615,7 +644,12 @@ function readRaw(path) {
615
644
  }
616
645
  function mergeRaw(a, b) {
617
646
  const { harnesses: _drop, ...flat } = b;
618
- return { ...a, ...flat, banks: { ...a.banks ?? {}, ...b.banks ?? {} } };
647
+ return {
648
+ ...a,
649
+ ...flat,
650
+ banks: { ...a.banks ?? {}, ...b.banks ?? {} },
651
+ paths: { ...a.paths ?? {}, ...b.paths ?? {} }
652
+ };
619
653
  }
620
654
  function applyLayer(raw, layer, harness) {
621
655
  let out = mergeRaw(raw, layer);
@@ -646,9 +680,11 @@ var ENV_KEYS = {
646
680
  maxParallelRetains: "HINDSIGHT_MAX_PARALLEL_RETAINS",
647
681
  reflectTimeoutMs: "HINDSIGHT_REFLECT_TIMEOUT_MS",
648
682
  reflectToolTimeoutMs: "HINDSIGHT_REFLECT_TOOL_TIMEOUT_MS",
683
+ injectTimeoutMs: "HINDSIGHT_INJECT_TIMEOUT_MS",
649
684
  reflectBudget: "HINDSIGHT_REFLECT_BUDGET",
650
685
  autoInject: "HINDSIGHT_AUTO_INJECT",
651
686
  pageSearchLimit: "HINDSIGHT_PAGE_SEARCH_LIMIT",
687
+ toolGuideExtra: "HINDSIGHT_TOOL_GUIDE_EXTRA",
652
688
  autoReflect: "HINDSIGHT_AUTO_REFLECT",
653
689
  pageRefreshEveryTurns: "HINDSIGHT_PAGE_REFRESH_EVERY_TURNS",
654
690
  pageTriggerType: "HINDSIGHT_PAGE_TRIGGER_TYPE",
@@ -690,6 +726,7 @@ var ENV_NUMBERS = /* @__PURE__ */ new Set([
690
726
  "maxParallelRetains",
691
727
  "reflectTimeoutMs",
692
728
  "reflectToolTimeoutMs",
729
+ "injectTimeoutMs",
693
730
  "pageSearchLimit",
694
731
  "pageRefreshEveryTurns",
695
732
  "seedLimit",