@vectorize-io/hindsight-coding-agents 0.5.2 → 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.
- package/README.md +42 -8
- package/dist/antigravity-hook.js +286 -76
- package/dist/antigravity-statusline.js +17 -10
- package/dist/antigravity-stop-hook.js +297 -79
- package/dist/claude-hook.js +286 -76
- package/dist/claude-sessionstart-hook.js +252 -93
- package/dist/claude-stop-hook.js +297 -79
- package/dist/cline.js +74 -18
- package/dist/codex-hook.js +286 -76
- package/dist/codex-sessionstart-hook.js +252 -93
- package/dist/codex-stop-hook.js +297 -79
- package/dist/copilot-hook.js +286 -76
- package/dist/copilot-sessionstart-hook.js +252 -93
- package/dist/copilot-stop-hook.js +297 -79
- package/dist/cursor-hook.js +286 -76
- package/dist/cursor-sessionstart-hook.js +252 -93
- package/dist/cursor-stop-hook.js +297 -79
- package/dist/daemon-start.js +17 -10
- package/dist/dcode-hook.js +286 -76
- package/dist/dcode-sessionstart-hook.js +252 -93
- package/dist/dcode-stop-hook.js +297 -79
- package/dist/deepen.js +73 -19
- package/dist/devin-hook.js +286 -76
- package/dist/devin-sessionstart-hook.js +252 -93
- package/dist/devin-stop-hook.js +297 -79
- package/dist/droid-hook.js +286 -76
- package/dist/droid-sessionstart-hook.js +252 -93
- package/dist/droid-stop-hook.js +297 -79
- package/dist/dsh.js +111 -53
- package/dist/grok-hook.js +286 -76
- package/dist/grok-sessionstart-hook.js +252 -93
- package/dist/grok-stop-hook.js +297 -79
- package/dist/hindsight-seed.js +17 -10
- package/dist/index.js +113 -55
- package/dist/installer.js +383 -218
- package/dist/kilo.js +113 -55
- package/dist/mcp-server.js +67 -17
- package/dist/opencode2.js +113 -55
- package/dist/pi.js +112 -54
- package/dist/prime-agent.js +112 -54
- package/dist/qwen-hook.js +286 -76
- package/dist/qwen-sessionstart-hook.js +252 -93
- package/dist/qwen-stop-hook.js +297 -79
- package/dist/status.js +67 -17
- package/dist/zcode-hook.js +2920 -0
- package/dist/zcode-sessionstart-hook.js +3487 -0
- package/dist/zcode-stop-hook.js +3188 -0
- package/package.json +6 -3
- package/plugin.json +1 -1
- package/skill/SKILL.md +17 -7
package/dist/deepen.js
CHANGED
|
@@ -452,6 +452,7 @@ function pagesFor(project) {
|
|
|
452
452
|
var PAGE_MAX_TOKENS = 4096;
|
|
453
453
|
var PAGE_TAGS_MATCH = "all";
|
|
454
454
|
var PAGE_FACT_TYPES = ["world", "experience", "observation"];
|
|
455
|
+
var DEFAULT_PAGE_TRIGGER_CRON = "H * * * *";
|
|
455
456
|
var CRON_FIELD_RANGES = [
|
|
456
457
|
[0, 59],
|
|
457
458
|
// minute
|
|
@@ -505,14 +506,23 @@ function pageTriggerFor(trigger, bank, page) {
|
|
|
505
506
|
function buildPageTrigger(cfg2 = {}) {
|
|
506
507
|
const base = { fact_types: PAGE_FACT_TYPES, tags_match: PAGE_TAGS_MATCH };
|
|
507
508
|
switch (cfg2.pageTriggerType) {
|
|
508
|
-
case "
|
|
509
|
-
return { ...base,
|
|
509
|
+
case "auto-refresh":
|
|
510
|
+
return { ...base, refresh_after_consolidation: true };
|
|
510
511
|
case "manual":
|
|
511
512
|
return { ...base, refresh_after_consolidation: false };
|
|
513
|
+
// "cron" and an unset type alike: the default schedule stands in for a missing expression, so
|
|
514
|
+
// a trigger built from a partial config is never a cron trigger with nothing to fire on.
|
|
512
515
|
default:
|
|
513
|
-
return { ...base,
|
|
516
|
+
return { ...base, refresh_cron: cfg2.pageTriggerCron || DEFAULT_PAGE_TRIGGER_CRON };
|
|
514
517
|
}
|
|
515
518
|
}
|
|
519
|
+
function pageTriggerDrifted(current2, desired) {
|
|
520
|
+
return current2.tags_match !== desired.tags_match || (current2.refresh_cron ?? null) !== (desired.refresh_cron ?? null) || Boolean(current2.refresh_after_consolidation) !== Boolean(desired.refresh_after_consolidation);
|
|
521
|
+
}
|
|
522
|
+
function pageTriggerPatch(desired) {
|
|
523
|
+
if (desired.refresh_after_consolidation === false) return { ...desired, refresh_cron: null };
|
|
524
|
+
return desired;
|
|
525
|
+
}
|
|
516
526
|
var CODING_BANK_TEMPLATE = {
|
|
517
527
|
version: "1",
|
|
518
528
|
bank: {
|
|
@@ -1052,14 +1062,14 @@ var HindsightClient = class {
|
|
|
1052
1062
|
if (r.status !== 409) created++;
|
|
1053
1063
|
} else {
|
|
1054
1064
|
const sourceDrift = hit.description !== page.source_query;
|
|
1055
|
-
const triggerDrift = hit.trigger != null && hit.trigger
|
|
1065
|
+
const triggerDrift = hit.trigger != null && pageTriggerDrifted(hit.trigger, body.trigger);
|
|
1056
1066
|
if (!sourceDrift && !triggerDrift) continue;
|
|
1057
1067
|
const patch = {};
|
|
1058
1068
|
if (sourceDrift) {
|
|
1059
1069
|
patch.source_query = page.source_query;
|
|
1060
1070
|
patch.tags = page.tags;
|
|
1061
1071
|
}
|
|
1062
|
-
if (triggerDrift) patch.trigger =
|
|
1072
|
+
if (triggerDrift) patch.trigger = pageTriggerPatch(body.trigger);
|
|
1063
1073
|
const r = await this.req(
|
|
1064
1074
|
"PATCH",
|
|
1065
1075
|
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(hit.id)}`),
|
|
@@ -1075,9 +1085,41 @@ var HindsightClient = class {
|
|
|
1075
1085
|
updated++;
|
|
1076
1086
|
}
|
|
1077
1087
|
}
|
|
1088
|
+
const initiatives = await this.resyncInitiativeTriggers(roots, pageTrigger);
|
|
1078
1089
|
this.log(
|
|
1079
|
-
`[bank] knowledge pages seeded on ${this.bank} (scoped to ${this.project ?? this.bank}): ${created} created, ${updated} re-synced, ${pages.length - created - updated} unchanged`
|
|
1090
|
+
`[bank] knowledge pages seeded on ${this.bank} (scoped to ${this.project ?? this.bank}): ${created} created, ${updated} re-synced, ${pages.length - created - updated} unchanged` + (initiatives ? `, ${initiatives} initiative pages re-synced` : "")
|
|
1091
|
+
);
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Bring the captured initiative pages onto the same refresh policy as the seeded taxonomy.
|
|
1095
|
+
*
|
|
1096
|
+
* `captureInitiative` stamps this very trigger when it creates a page, so on a bank seeded under
|
|
1097
|
+
* an older default they are the same drift as the taxonomy — and on a real repo they are most of
|
|
1098
|
+
* it: five taxonomy pages against one page per initiative, each an LLM synthesis per
|
|
1099
|
+
* consolidation under the auto-refresh that used to be the default (#3506).
|
|
1100
|
+
*
|
|
1101
|
+
* Only the trigger is touched. Their `name` and `source_query` are written once, from the
|
|
1102
|
+
* initiative's own title, and re-stating either would rebuild a page whose question never
|
|
1103
|
+
* changed. The tree read above is reused rather than re-fetched.
|
|
1104
|
+
*/
|
|
1105
|
+
async resyncInitiativeTriggers(roots, pageTrigger) {
|
|
1106
|
+
const folder = roots.find(
|
|
1107
|
+
(n) => n.kind === "folder" && (n.name || "").toLowerCase() === "initiatives"
|
|
1080
1108
|
);
|
|
1109
|
+
let updated = 0;
|
|
1110
|
+
for (const page of folder?.children ?? []) {
|
|
1111
|
+
if (page.kind !== "page" || page.trigger == null) continue;
|
|
1112
|
+
const desired = pageTriggerFor(pageTrigger, this.bank, page.name);
|
|
1113
|
+
if (!pageTriggerDrifted(page.trigger, desired)) continue;
|
|
1114
|
+
const r = await this.req(
|
|
1115
|
+
"PATCH",
|
|
1116
|
+
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(page.id)}`),
|
|
1117
|
+
{ trigger: pageTriggerPatch(desired) }
|
|
1118
|
+
);
|
|
1119
|
+
if ([404, 405, 501].includes(r.status)) break;
|
|
1120
|
+
updated++;
|
|
1121
|
+
}
|
|
1122
|
+
return updated;
|
|
1081
1123
|
}
|
|
1082
1124
|
/** URL/id-safe slug: lowercase, non-alphanumerics → "-", trim dashes, cap length; fallback "initiative". */
|
|
1083
1125
|
slugify(s) {
|
|
@@ -1100,11 +1142,13 @@ var HindsightClient = class {
|
|
|
1100
1142
|
let pageId = args.relatesToPageId;
|
|
1101
1143
|
if (!pageId) {
|
|
1102
1144
|
const folderId = await this.ensureFolder("Initiatives");
|
|
1145
|
+
const subject = this.project ?? this.bank;
|
|
1103
1146
|
const r = await this.req("POST", this.bankUrl("/knowledge-base/pages"), {
|
|
1104
1147
|
name: args.title,
|
|
1105
|
-
source_query: `Summarize the "${args.title}" initiative: what is being built or changed and why, and its current state \u2014 drawn from the project's memory
|
|
1148
|
+
source_query: `Summarize the "${args.title}" initiative: what is being built or changed and why, and its current state \u2014 drawn from the project's memory.` + pageScopeRule(subject),
|
|
1106
1149
|
parent_id: folderId,
|
|
1107
1150
|
tags: ["knowledge:feature-work"],
|
|
1151
|
+
max_tokens: PAGE_MAX_TOKENS,
|
|
1108
1152
|
trigger: pageTriggerFor(args.pageTrigger ?? buildPageTrigger(), this.bank, args.title)
|
|
1109
1153
|
});
|
|
1110
1154
|
try {
|
|
@@ -1223,17 +1267,22 @@ var DEFAULT_SEED_LIMIT = 300;
|
|
|
1223
1267
|
var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join6(homedir2(), ".hindsight", "coding-agent.json");
|
|
1224
1268
|
var DEFAULT_DAEMON_PORT = 9077;
|
|
1225
1269
|
var DEFAULT_DAEMON_PROFILE = "coding-agent";
|
|
1226
|
-
function
|
|
1227
|
-
if (raw.pageTriggerType === "manual") return "manual";
|
|
1228
|
-
if (raw.pageTriggerType === "
|
|
1229
|
-
|
|
1230
|
-
if (cron && (!isHashedCron(cron) || parseHashedCron(cron))) return "cron";
|
|
1270
|
+
function resolvePageTrigger(raw) {
|
|
1271
|
+
if (raw.pageTriggerType === "manual") return { type: "manual" };
|
|
1272
|
+
if (raw.pageTriggerType === "auto-refresh") return { type: "auto-refresh" };
|
|
1273
|
+
if (raw.pageTriggerType !== void 0 && raw.pageTriggerType !== "cron")
|
|
1231
1274
|
log.warn(
|
|
1232
1275
|
"config",
|
|
1233
|
-
|
|
1276
|
+
`ignoring pageTriggerType=${JSON.stringify(raw.pageTriggerType)} \u2014 expected cron|auto-refresh|manual`
|
|
1234
1277
|
);
|
|
1235
|
-
|
|
1236
|
-
return "
|
|
1278
|
+
const cron = raw.pageTriggerCron?.trim();
|
|
1279
|
+
if (!cron) return { type: "cron", cron: DEFAULT_PAGE_TRIGGER_CRON };
|
|
1280
|
+
if (!isHashedCron(cron) || parseHashedCron(cron)) return { type: "cron", cron };
|
|
1281
|
+
log.warn(
|
|
1282
|
+
"config",
|
|
1283
|
+
`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)}`
|
|
1284
|
+
);
|
|
1285
|
+
return { type: "cron", cron: DEFAULT_PAGE_TRIGGER_CRON };
|
|
1237
1286
|
}
|
|
1238
1287
|
var DEFAULT_REFLECT_TOOL_TIMEOUT_MS = 33e4;
|
|
1239
1288
|
var REFLECT_BUDGETS = ["low", "mid", "high"];
|
|
@@ -1265,6 +1314,7 @@ function resolveObservationScopes(raw) {
|
|
|
1265
1314
|
function resolveConfig(raw = {}) {
|
|
1266
1315
|
const serverMode = ["cloud", "self-hosted", "daemon"].includes(raw.serverMode) ? raw.serverMode : "cloud";
|
|
1267
1316
|
const apiPort = raw.apiPort || DEFAULT_DAEMON_PORT;
|
|
1317
|
+
const pageTrigger = resolvePageTrigger(raw);
|
|
1268
1318
|
return {
|
|
1269
1319
|
serverMode,
|
|
1270
1320
|
// Daemon mode resolves the URL HERE rather than at each call site: every entry point already
|
|
@@ -1299,8 +1349,8 @@ function resolveConfig(raw = {}) {
|
|
|
1299
1349
|
reflectBudget: resolveReflectBudget(raw),
|
|
1300
1350
|
autoReflect: raw.autoReflect ?? true,
|
|
1301
1351
|
pageRefreshEveryTurns: raw.pageRefreshEveryTurns || 10,
|
|
1302
|
-
pageTriggerType:
|
|
1303
|
-
pageTriggerCron:
|
|
1352
|
+
pageTriggerType: pageTrigger.type,
|
|
1353
|
+
pageTriggerCron: pageTrigger.cron,
|
|
1304
1354
|
autoSeed: raw.autoSeed ?? true,
|
|
1305
1355
|
seedLimit: raw.seedLimit || DEFAULT_SEED_LIMIT,
|
|
1306
1356
|
codebaseSurvey: raw.codebaseSurvey ?? true,
|
|
@@ -1691,7 +1741,10 @@ var HARNESS_NAMES = [
|
|
|
1691
1741
|
"qwen-code",
|
|
1692
1742
|
// Factory Droid is a per-prompt HOOK host: the installer wires ~/.factory/hooks.json and the
|
|
1693
1743
|
// stdio MCP registration in ~/.factory/mcp.json (see src/installer.ts).
|
|
1694
|
-
"factory-droid"
|
|
1744
|
+
"factory-droid",
|
|
1745
|
+
// ZCode is a per-prompt HOOK host too, registered in its own CLI config
|
|
1746
|
+
// (~/.zcode/cli/config.json) under `hooks.events` — never the user's real Claude Code settings.
|
|
1747
|
+
"zcode"
|
|
1695
1748
|
];
|
|
1696
1749
|
var HOOK_BINS = {
|
|
1697
1750
|
"claude-code": "hindsight-claude-hook",
|
|
@@ -1703,7 +1756,8 @@ var HOOK_BINS = {
|
|
|
1703
1756
|
"copilot-cli": "hindsight-copilot-hook",
|
|
1704
1757
|
"grok-build": "hindsight-grok-hook",
|
|
1705
1758
|
"qwen-code": "hindsight-qwen-hook",
|
|
1706
|
-
"factory-droid": "hindsight-droid-hook"
|
|
1759
|
+
"factory-droid": "hindsight-droid-hook",
|
|
1760
|
+
zcode: "hindsight-zcode-hook"
|
|
1707
1761
|
// more hook harnesses: add a HookSpec entry point (see src/cursor-hook.ts) + a registration here.
|
|
1708
1762
|
};
|
|
1709
1763
|
var PLUGIN_ENTRYPOINTS = {
|