@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/status.js
CHANGED
|
@@ -427,6 +427,7 @@ function pagesFor(project) {
|
|
|
427
427
|
var PAGE_MAX_TOKENS = 4096;
|
|
428
428
|
var PAGE_TAGS_MATCH = "all";
|
|
429
429
|
var PAGE_FACT_TYPES = ["world", "experience", "observation"];
|
|
430
|
+
var DEFAULT_PAGE_TRIGGER_CRON = "H * * * *";
|
|
430
431
|
var CRON_FIELD_RANGES = [
|
|
431
432
|
[0, 59],
|
|
432
433
|
// minute
|
|
@@ -480,14 +481,23 @@ function pageTriggerFor(trigger, bank, page) {
|
|
|
480
481
|
function buildPageTrigger(cfg2 = {}) {
|
|
481
482
|
const base = { fact_types: PAGE_FACT_TYPES, tags_match: PAGE_TAGS_MATCH };
|
|
482
483
|
switch (cfg2.pageTriggerType) {
|
|
483
|
-
case "
|
|
484
|
-
return { ...base,
|
|
484
|
+
case "auto-refresh":
|
|
485
|
+
return { ...base, refresh_after_consolidation: true };
|
|
485
486
|
case "manual":
|
|
486
487
|
return { ...base, refresh_after_consolidation: false };
|
|
488
|
+
// "cron" and an unset type alike: the default schedule stands in for a missing expression, so
|
|
489
|
+
// a trigger built from a partial config is never a cron trigger with nothing to fire on.
|
|
487
490
|
default:
|
|
488
|
-
return { ...base,
|
|
491
|
+
return { ...base, refresh_cron: cfg2.pageTriggerCron || DEFAULT_PAGE_TRIGGER_CRON };
|
|
489
492
|
}
|
|
490
493
|
}
|
|
494
|
+
function pageTriggerDrifted(current2, desired) {
|
|
495
|
+
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);
|
|
496
|
+
}
|
|
497
|
+
function pageTriggerPatch(desired) {
|
|
498
|
+
if (desired.refresh_after_consolidation === false) return { ...desired, refresh_cron: null };
|
|
499
|
+
return desired;
|
|
500
|
+
}
|
|
491
501
|
var CODING_BANK_TEMPLATE = {
|
|
492
502
|
version: "1",
|
|
493
503
|
bank: {
|
|
@@ -1027,14 +1037,14 @@ var HindsightClient = class {
|
|
|
1027
1037
|
if (r.status !== 409) created++;
|
|
1028
1038
|
} else {
|
|
1029
1039
|
const sourceDrift = hit.description !== page.source_query;
|
|
1030
|
-
const triggerDrift = hit.trigger != null && hit.trigger
|
|
1040
|
+
const triggerDrift = hit.trigger != null && pageTriggerDrifted(hit.trigger, body.trigger);
|
|
1031
1041
|
if (!sourceDrift && !triggerDrift) continue;
|
|
1032
1042
|
const patch = {};
|
|
1033
1043
|
if (sourceDrift) {
|
|
1034
1044
|
patch.source_query = page.source_query;
|
|
1035
1045
|
patch.tags = page.tags;
|
|
1036
1046
|
}
|
|
1037
|
-
if (triggerDrift) patch.trigger =
|
|
1047
|
+
if (triggerDrift) patch.trigger = pageTriggerPatch(body.trigger);
|
|
1038
1048
|
const r = await this.req(
|
|
1039
1049
|
"PATCH",
|
|
1040
1050
|
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(hit.id)}`),
|
|
@@ -1050,10 +1060,42 @@ var HindsightClient = class {
|
|
|
1050
1060
|
updated++;
|
|
1051
1061
|
}
|
|
1052
1062
|
}
|
|
1063
|
+
const initiatives = await this.resyncInitiativeTriggers(roots, pageTrigger);
|
|
1053
1064
|
this.log(
|
|
1054
|
-
`[bank] knowledge pages seeded on ${this.bank} (scoped to ${this.project ?? this.bank}): ${created} created, ${updated} re-synced, ${pages.length - created - updated} unchanged`
|
|
1065
|
+
`[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` : "")
|
|
1055
1066
|
);
|
|
1056
1067
|
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Bring the captured initiative pages onto the same refresh policy as the seeded taxonomy.
|
|
1070
|
+
*
|
|
1071
|
+
* `captureInitiative` stamps this very trigger when it creates a page, so on a bank seeded under
|
|
1072
|
+
* an older default they are the same drift as the taxonomy — and on a real repo they are most of
|
|
1073
|
+
* it: five taxonomy pages against one page per initiative, each an LLM synthesis per
|
|
1074
|
+
* consolidation under the auto-refresh that used to be the default (#3506).
|
|
1075
|
+
*
|
|
1076
|
+
* Only the trigger is touched. Their `name` and `source_query` are written once, from the
|
|
1077
|
+
* initiative's own title, and re-stating either would rebuild a page whose question never
|
|
1078
|
+
* changed. The tree read above is reused rather than re-fetched.
|
|
1079
|
+
*/
|
|
1080
|
+
async resyncInitiativeTriggers(roots, pageTrigger) {
|
|
1081
|
+
const folder = roots.find(
|
|
1082
|
+
(n) => n.kind === "folder" && (n.name || "").toLowerCase() === "initiatives"
|
|
1083
|
+
);
|
|
1084
|
+
let updated = 0;
|
|
1085
|
+
for (const page of folder?.children ?? []) {
|
|
1086
|
+
if (page.kind !== "page" || page.trigger == null) continue;
|
|
1087
|
+
const desired = pageTriggerFor(pageTrigger, this.bank, page.name);
|
|
1088
|
+
if (!pageTriggerDrifted(page.trigger, desired)) continue;
|
|
1089
|
+
const r = await this.req(
|
|
1090
|
+
"PATCH",
|
|
1091
|
+
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(page.id)}`),
|
|
1092
|
+
{ trigger: pageTriggerPatch(desired) }
|
|
1093
|
+
);
|
|
1094
|
+
if ([404, 405, 501].includes(r.status)) break;
|
|
1095
|
+
updated++;
|
|
1096
|
+
}
|
|
1097
|
+
return updated;
|
|
1098
|
+
}
|
|
1057
1099
|
/** URL/id-safe slug: lowercase, non-alphanumerics → "-", trim dashes, cap length; fallback "initiative". */
|
|
1058
1100
|
slugify(s) {
|
|
1059
1101
|
return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "initiative";
|
|
@@ -1075,11 +1117,13 @@ var HindsightClient = class {
|
|
|
1075
1117
|
let pageId = args.relatesToPageId;
|
|
1076
1118
|
if (!pageId) {
|
|
1077
1119
|
const folderId = await this.ensureFolder("Initiatives");
|
|
1120
|
+
const subject = this.project ?? this.bank;
|
|
1078
1121
|
const r = await this.req("POST", this.bankUrl("/knowledge-base/pages"), {
|
|
1079
1122
|
name: args.title,
|
|
1080
|
-
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
|
|
1123
|
+
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),
|
|
1081
1124
|
parent_id: folderId,
|
|
1082
1125
|
tags: ["knowledge:feature-work"],
|
|
1126
|
+
max_tokens: PAGE_MAX_TOKENS,
|
|
1083
1127
|
trigger: pageTriggerFor(args.pageTrigger ?? buildPageTrigger(), this.bank, args.title)
|
|
1084
1128
|
});
|
|
1085
1129
|
try {
|
|
@@ -1122,17 +1166,22 @@ var HindsightClient = class {
|
|
|
1122
1166
|
var CONFIG_PATH = process.env.HINDSIGHT_CONFIG || join6(homedir2(), ".hindsight", "coding-agent.json");
|
|
1123
1167
|
var DEFAULT_DAEMON_PORT = 9077;
|
|
1124
1168
|
var DEFAULT_DAEMON_PROFILE = "coding-agent";
|
|
1125
|
-
function
|
|
1126
|
-
if (raw.pageTriggerType === "manual") return "manual";
|
|
1127
|
-
if (raw.pageTriggerType === "
|
|
1128
|
-
|
|
1129
|
-
if (cron && (!isHashedCron(cron) || parseHashedCron(cron))) return "cron";
|
|
1169
|
+
function resolvePageTrigger(raw) {
|
|
1170
|
+
if (raw.pageTriggerType === "manual") return { type: "manual" };
|
|
1171
|
+
if (raw.pageTriggerType === "auto-refresh") return { type: "auto-refresh" };
|
|
1172
|
+
if (raw.pageTriggerType !== void 0 && raw.pageTriggerType !== "cron")
|
|
1130
1173
|
log.warn(
|
|
1131
1174
|
"config",
|
|
1132
|
-
|
|
1175
|
+
`ignoring pageTriggerType=${JSON.stringify(raw.pageTriggerType)} \u2014 expected cron|auto-refresh|manual`
|
|
1133
1176
|
);
|
|
1134
|
-
|
|
1135
|
-
return "
|
|
1177
|
+
const cron = raw.pageTriggerCron?.trim();
|
|
1178
|
+
if (!cron) return { type: "cron", cron: DEFAULT_PAGE_TRIGGER_CRON };
|
|
1179
|
+
if (!isHashedCron(cron) || parseHashedCron(cron)) return { type: "cron", cron };
|
|
1180
|
+
log.warn(
|
|
1181
|
+
"config",
|
|
1182
|
+
`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)}`
|
|
1183
|
+
);
|
|
1184
|
+
return { type: "cron", cron: DEFAULT_PAGE_TRIGGER_CRON };
|
|
1136
1185
|
}
|
|
1137
1186
|
var DEFAULT_REFLECT_TOOL_TIMEOUT_MS = 33e4;
|
|
1138
1187
|
var REFLECT_BUDGETS = ["low", "mid", "high"];
|
|
@@ -1164,6 +1213,7 @@ function resolveObservationScopes(raw) {
|
|
|
1164
1213
|
function resolveConfig(raw = {}) {
|
|
1165
1214
|
const serverMode = ["cloud", "self-hosted", "daemon"].includes(raw.serverMode) ? raw.serverMode : "cloud";
|
|
1166
1215
|
const apiPort = raw.apiPort || DEFAULT_DAEMON_PORT;
|
|
1216
|
+
const pageTrigger = resolvePageTrigger(raw);
|
|
1167
1217
|
return {
|
|
1168
1218
|
serverMode,
|
|
1169
1219
|
// Daemon mode resolves the URL HERE rather than at each call site: every entry point already
|
|
@@ -1198,8 +1248,8 @@ function resolveConfig(raw = {}) {
|
|
|
1198
1248
|
reflectBudget: resolveReflectBudget(raw),
|
|
1199
1249
|
autoReflect: raw.autoReflect ?? true,
|
|
1200
1250
|
pageRefreshEveryTurns: raw.pageRefreshEveryTurns || 10,
|
|
1201
|
-
pageTriggerType:
|
|
1202
|
-
pageTriggerCron:
|
|
1251
|
+
pageTriggerType: pageTrigger.type,
|
|
1252
|
+
pageTriggerCron: pageTrigger.cron,
|
|
1203
1253
|
autoSeed: raw.autoSeed ?? true,
|
|
1204
1254
|
seedLimit: raw.seedLimit || DEFAULT_SEED_LIMIT,
|
|
1205
1255
|
codebaseSurvey: raw.codebaseSurvey ?? true,
|