@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
@@ -370,6 +370,40 @@ function diag(harness, event, extra = {}) {
370
370
  import { lstatSync, readFileSync, realpathSync } from "fs";
371
371
  import { dirname as dirname3, isAbsolute, join as join3, resolve } from "path";
372
372
 
373
+ // src/core/missions.ts
374
+ import { createHash } from "crypto";
375
+ var DEFAULT_PAGE_TRIGGER_CRON = "H * * * *";
376
+ var CRON_FIELD_RANGES = [
377
+ [0, 59],
378
+ // minute
379
+ [0, 23],
380
+ // hour
381
+ [1, 31],
382
+ // day of month
383
+ [1, 12],
384
+ // month
385
+ [0, 6]
386
+ // day of week
387
+ ];
388
+ var HASHED_FIELD = /^H(?:\((\d+)-(\d+)\))?$/;
389
+ function isHashedCron(cron) {
390
+ return /(^|\s)H/.test(cron);
391
+ }
392
+ function parseHashedCron(cron) {
393
+ const fields = cron.trim().split(/\s+/);
394
+ if (fields.length !== CRON_FIELD_RANGES.length) return void 0;
395
+ for (const [i, field] of fields.entries()) {
396
+ if (!field.startsWith("H")) continue;
397
+ const m = HASHED_FIELD.exec(field);
398
+ if (!m) return void 0;
399
+ if (m[1] === void 0) continue;
400
+ const [lo, hi] = [Number(m[1]), Number(m[2])];
401
+ const [min, max] = CRON_FIELD_RANGES[i];
402
+ if (lo > hi || lo < min || hi > max) return void 0;
403
+ }
404
+ return fields;
405
+ }
406
+
373
407
  // src/core/util.ts
374
408
  import { accessSync, constants } from "fs";
375
409
  import { delimiter, join as join5 } from "path";
@@ -383,16 +417,22 @@ var RETRY_AFTER_CEILING_MS = 60 * 1e3;
383
417
  var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join6(homedir2(), ".hindsight", "coding-agent.json");
384
418
  var DEFAULT_DAEMON_PORT = 9077;
385
419
  var DEFAULT_DAEMON_PROFILE = "coding-agent";
386
- function resolvePageTriggerType(raw) {
387
- if (raw.pageTriggerType === "manual") return "manual";
388
- if (raw.pageTriggerType === "cron") {
389
- if (raw.pageTriggerCron?.trim()) return "cron";
420
+ function resolvePageTrigger(raw) {
421
+ if (raw.pageTriggerType === "manual") return { type: "manual" };
422
+ if (raw.pageTriggerType === "auto-refresh") return { type: "auto-refresh" };
423
+ if (raw.pageTriggerType !== void 0 && raw.pageTriggerType !== "cron")
390
424
  log.warn(
391
425
  "config",
392
- 'pageTriggerType "cron" needs pageTriggerCron (UTC 5-field, e.g. "0 3 * * *") \u2014 falling back to "auto-refresh"'
426
+ `ignoring pageTriggerType=${JSON.stringify(raw.pageTriggerType)} \u2014 expected cron|auto-refresh|manual`
393
427
  );
394
- }
395
- return "auto-refresh";
428
+ const cron = raw.pageTriggerCron?.trim();
429
+ if (!cron) return { type: "cron", cron: DEFAULT_PAGE_TRIGGER_CRON };
430
+ if (!isHashedCron(cron) || parseHashedCron(cron)) return { type: "cron", cron };
431
+ log.warn(
432
+ "config",
433
+ `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)}`
434
+ );
435
+ return { type: "cron", cron: DEFAULT_PAGE_TRIGGER_CRON };
396
436
  }
397
437
  var DEFAULT_REFLECT_TOOL_TIMEOUT_MS = 33e4;
398
438
  var REFLECT_BUDGETS = ["low", "mid", "high"];
@@ -424,6 +464,7 @@ function resolveObservationScopes(raw) {
424
464
  function resolveConfig(raw = {}) {
425
465
  const serverMode = ["cloud", "self-hosted", "daemon"].includes(raw.serverMode) ? raw.serverMode : "cloud";
426
466
  const apiPort = raw.apiPort || DEFAULT_DAEMON_PORT;
467
+ const pageTrigger = resolvePageTrigger(raw);
427
468
  return {
428
469
  serverMode,
429
470
  // Daemon mode resolves the URL HERE rather than at each call site: every entry point already
@@ -458,8 +499,8 @@ function resolveConfig(raw = {}) {
458
499
  reflectBudget: resolveReflectBudget(raw),
459
500
  autoReflect: raw.autoReflect ?? true,
460
501
  pageRefreshEveryTurns: raw.pageRefreshEveryTurns || 10,
461
- pageTriggerType: resolvePageTriggerType(raw),
462
- pageTriggerCron: raw.pageTriggerCron?.trim() || void 0,
502
+ pageTriggerType: pageTrigger.type,
503
+ pageTriggerCron: pageTrigger.cron,
463
504
  autoSeed: raw.autoSeed ?? true,
464
505
  seedLimit: raw.seedLimit || DEFAULT_SEED_LIMIT,
465
506
  codebaseSurvey: raw.codebaseSurvey ?? true,