@vectorize-io/hindsight-coding-agents 0.5.1 → 0.5.3

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 +84 -9
  2. package/dist/antigravity-hook.js +424 -81
  3. package/dist/antigravity-statusline.js +56 -11
  4. package/dist/antigravity-stop-hook.js +515 -134
  5. package/dist/claude-hook.js +424 -81
  6. package/dist/claude-sessionstart-hook.js +392 -98
  7. package/dist/claude-stop-hook.js +515 -134
  8. package/dist/cline.js +218 -73
  9. package/dist/codex-hook.js +424 -81
  10. package/dist/codex-sessionstart-hook.js +392 -98
  11. package/dist/codex-stop-hook.js +515 -134
  12. package/dist/copilot-hook.js +424 -81
  13. package/dist/copilot-sessionstart-hook.js +392 -98
  14. package/dist/copilot-stop-hook.js +515 -134
  15. package/dist/cursor-hook.js +424 -81
  16. package/dist/cursor-sessionstart-hook.js +392 -98
  17. package/dist/cursor-stop-hook.js +515 -134
  18. package/dist/daemon-start.js +50 -9
  19. package/dist/dcode-hook.js +424 -81
  20. package/dist/dcode-sessionstart-hook.js +392 -98
  21. package/dist/dcode-stop-hook.js +515 -134
  22. package/dist/deepen.js +164 -27
  23. package/dist/devin-hook.js +424 -81
  24. package/dist/devin-sessionstart-hook.js +392 -98
  25. package/dist/devin-stop-hook.js +515 -134
  26. package/dist/droid-hook.js +2920 -0
  27. package/dist/droid-sessionstart-hook.js +3487 -0
  28. package/dist/droid-stop-hook.js +3188 -0
  29. package/dist/dsh.js +260 -109
  30. package/dist/grok-hook.js +424 -81
  31. package/dist/grok-sessionstart-hook.js +392 -98
  32. package/dist/grok-stop-hook.js +515 -134
  33. package/dist/hindsight-seed.js +56 -11
  34. package/dist/index.js +257 -110
  35. package/dist/installer.js +530 -223
  36. package/dist/kilo.js +257 -110
  37. package/dist/mcp-server.js +537 -146
  38. package/dist/opencode2.js +257 -110
  39. package/dist/pi.js +256 -109
  40. package/dist/prime-agent.js +256 -109
  41. package/dist/qwen-hook.js +424 -81
  42. package/dist/qwen-sessionstart-hook.js +392 -98
  43. package/dist/qwen-stop-hook.js +515 -134
  44. package/dist/status.js +128 -20
  45. package/dist/zcode-hook.js +2920 -0
  46. package/dist/zcode-sessionstart-hook.js +3487 -0
  47. package/dist/zcode-stop-hook.js +3188 -0
  48. package/package.json +11 -5
  49. package/plugin.json +1 -1
  50. package/skill/SKILL.md +42 -8
@@ -278,9 +278,13 @@ function isOptedIn(config, directory) {
278
278
  const pathMap = config.mapPathToBank;
279
279
  return Boolean(pathMap && directories.some((candidate) => mapLookup(pathMap, candidate)));
280
280
  }
281
- function deriveBankId(config, directory, harness = "coding", sessionRoot) {
281
+ function mappedBank(config, directory, sessionRoot) {
282
282
  const pathMap = config.mapPathToBank;
283
- const mapped = directory && pathMap ? lookupDirectories(config, directory, sessionRoot).map((candidate) => mapLookup(pathMap, candidate)).find((bank) => bank !== void 0) : void 0;
283
+ if (!directory || !pathMap) return void 0;
284
+ return lookupDirectories(config, directory, sessionRoot).map((candidate) => mapLookup(pathMap, candidate)).find((bank) => bank !== void 0);
285
+ }
286
+ function deriveBankId(config, directory, harness = "coding", sessionRoot) {
287
+ const mapped = mappedBank(config, directory, sessionRoot);
284
288
  if (mapped) return mapped;
285
289
  const dynamic = config.dynamicBankId ?? !config.bankId;
286
290
  if (!dynamic) return config.bankId || DEFAULT_BANK_NAME;
@@ -307,6 +311,40 @@ function deriveBankIdOrSkip(config, directory, harness = "coding", sessionRoot)
307
311
  }
308
312
  }
309
313
 
314
+ // src/core/missions.ts
315
+ import { createHash } from "crypto";
316
+ var DEFAULT_PAGE_TRIGGER_CRON = "H * * * *";
317
+ var CRON_FIELD_RANGES = [
318
+ [0, 59],
319
+ // minute
320
+ [0, 23],
321
+ // hour
322
+ [1, 31],
323
+ // day of month
324
+ [1, 12],
325
+ // month
326
+ [0, 6]
327
+ // day of week
328
+ ];
329
+ var HASHED_FIELD = /^H(?:\((\d+)-(\d+)\))?$/;
330
+ function isHashedCron(cron) {
331
+ return /(^|\s)H/.test(cron);
332
+ }
333
+ function parseHashedCron(cron) {
334
+ const fields = cron.trim().split(/\s+/);
335
+ if (fields.length !== CRON_FIELD_RANGES.length) return void 0;
336
+ for (const [i, field] of fields.entries()) {
337
+ if (!field.startsWith("H")) continue;
338
+ const m = HASHED_FIELD.exec(field);
339
+ if (!m) return void 0;
340
+ if (m[1] === void 0) continue;
341
+ const [lo, hi] = [Number(m[1]), Number(m[2])];
342
+ const [min, max] = CRON_FIELD_RANGES[i];
343
+ if (lo > hi || lo < min || hi > max) return void 0;
344
+ }
345
+ return fields;
346
+ }
347
+
310
348
  // src/core/util.ts
311
349
  import { accessSync, constants } from "fs";
312
350
  import { delimiter, join as join5 } from "path";
@@ -320,16 +358,22 @@ var RETRY_AFTER_CEILING_MS = 60 * 1e3;
320
358
  var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join6(homedir2(), ".hindsight", "coding-agent.json");
321
359
  var DEFAULT_DAEMON_PORT = 9077;
322
360
  var DEFAULT_DAEMON_PROFILE = "coding-agent";
323
- function resolvePageTriggerType(raw) {
324
- if (raw.pageTriggerType === "manual") return "manual";
325
- if (raw.pageTriggerType === "cron") {
326
- if (raw.pageTriggerCron?.trim()) return "cron";
361
+ function resolvePageTrigger(raw) {
362
+ if (raw.pageTriggerType === "manual") return { type: "manual" };
363
+ if (raw.pageTriggerType === "auto-refresh") return { type: "auto-refresh" };
364
+ if (raw.pageTriggerType !== void 0 && raw.pageTriggerType !== "cron")
327
365
  log.warn(
328
366
  "config",
329
- 'pageTriggerType "cron" needs pageTriggerCron (UTC 5-field, e.g. "0 3 * * *") \u2014 falling back to "auto-refresh"'
367
+ `ignoring pageTriggerType=${JSON.stringify(raw.pageTriggerType)} \u2014 expected cron|auto-refresh|manual`
330
368
  );
331
- }
332
- return "auto-refresh";
369
+ const cron = raw.pageTriggerCron?.trim();
370
+ if (!cron) return { type: "cron", cron: DEFAULT_PAGE_TRIGGER_CRON };
371
+ if (!isHashedCron(cron) || parseHashedCron(cron)) return { type: "cron", cron };
372
+ log.warn(
373
+ "config",
374
+ `pageTriggerCron ${JSON.stringify(cron)} has a malformed hashed field \u2014 write \`H\` or \`H(<lo>-<hi>)\` within the field's own range, e.g. "H H(0-5) * * *" \u2014 falling back to ${JSON.stringify(DEFAULT_PAGE_TRIGGER_CRON)}`
375
+ );
376
+ return { type: "cron", cron: DEFAULT_PAGE_TRIGGER_CRON };
333
377
  }
334
378
  var DEFAULT_REFLECT_TOOL_TIMEOUT_MS = 33e4;
335
379
  var REFLECT_BUDGETS = ["low", "mid", "high"];
@@ -361,6 +405,7 @@ function resolveObservationScopes(raw) {
361
405
  function resolveConfig(raw = {}) {
362
406
  const serverMode = ["cloud", "self-hosted", "daemon"].includes(raw.serverMode) ? raw.serverMode : "cloud";
363
407
  const apiPort = raw.apiPort || DEFAULT_DAEMON_PORT;
408
+ const pageTrigger = resolvePageTrigger(raw);
364
409
  return {
365
410
  serverMode,
366
411
  // Daemon mode resolves the URL HERE rather than at each call site: every entry point already
@@ -395,8 +440,8 @@ function resolveConfig(raw = {}) {
395
440
  reflectBudget: resolveReflectBudget(raw),
396
441
  autoReflect: raw.autoReflect ?? true,
397
442
  pageRefreshEveryTurns: raw.pageRefreshEveryTurns || 10,
398
- pageTriggerType: resolvePageTriggerType(raw),
399
- pageTriggerCron: raw.pageTriggerCron?.trim() || void 0,
443
+ pageTriggerType: pageTrigger.type,
444
+ pageTriggerCron: pageTrigger.cron,
400
445
  autoSeed: raw.autoSeed ?? true,
401
446
  seedLimit: raw.seedLimit || DEFAULT_SEED_LIMIT,
402
447
  codebaseSurvey: raw.codebaseSurvey ?? true,