@vectorize-io/hindsight-coding-agents 0.5.3 → 0.5.5
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 +5 -2
- package/dist/antigravity-hook.js +185 -41
- package/dist/antigravity-stop-hook.js +114 -36
- package/dist/claude-hook.js +185 -41
- package/dist/claude-sessionstart-hook.js +292 -76
- package/dist/claude-stop-hook.js +114 -36
- package/dist/cline.js +331 -58
- package/dist/codex-hook.js +185 -41
- package/dist/codex-sessionstart-hook.js +292 -76
- package/dist/codex-stop-hook.js +114 -36
- package/dist/copilot-hook.js +185 -41
- package/dist/copilot-sessionstart-hook.js +292 -76
- package/dist/copilot-stop-hook.js +114 -36
- package/dist/cursor-hook.js +185 -41
- package/dist/cursor-sessionstart-hook.js +292 -76
- package/dist/cursor-stop-hook.js +114 -36
- package/dist/dcode-hook.js +185 -41
- package/dist/dcode-sessionstart-hook.js +292 -76
- package/dist/dcode-stop-hook.js +114 -36
- package/dist/deepen.js +93 -18
- package/dist/devin-hook.js +185 -41
- package/dist/devin-sessionstart-hook.js +292 -76
- package/dist/devin-stop-hook.js +114 -36
- package/dist/droid-hook.js +185 -41
- package/dist/droid-sessionstart-hook.js +292 -76
- package/dist/droid-stop-hook.js +114 -36
- package/dist/dsh.js +333 -60
- package/dist/grok-hook.js +185 -41
- package/dist/grok-sessionstart-hook.js +292 -76
- package/dist/grok-stop-hook.js +114 -36
- package/dist/index.js +333 -60
- package/dist/installer.js +1030 -268
- package/dist/kilo.js +333 -60
- package/dist/mcp-server.js +86 -11
- package/dist/opencode2.js +333 -60
- package/dist/pi.js +332 -59
- package/dist/prime-agent.js +332 -59
- package/dist/qwen-hook.js +185 -41
- package/dist/qwen-sessionstart-hook.js +292 -76
- package/dist/qwen-stop-hook.js +114 -36
- package/dist/status.js +84 -9
- package/dist/survey-supervisor.js +81 -0
- package/dist/zcode-hook.js +185 -41
- package/dist/zcode-sessionstart-hook.js +292 -76
- package/dist/zcode-stop-hook.js +114 -36
- package/package.json +2 -1
- package/plugin.json +1 -1
- package/skill/SKILL.md +5 -2
package/dist/mcp-server.js
CHANGED
|
@@ -31887,6 +31887,22 @@ var KnowledgePagesUnavailableError = class extends Error {
|
|
|
31887
31887
|
}
|
|
31888
31888
|
};
|
|
31889
31889
|
var TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "cancelled", "error"]);
|
|
31890
|
+
var ReflectError = class extends Error {
|
|
31891
|
+
constructor(message, status, timedOut, options) {
|
|
31892
|
+
super(message, options);
|
|
31893
|
+
this.status = status;
|
|
31894
|
+
this.timedOut = timedOut;
|
|
31895
|
+
this.name = "ReflectError";
|
|
31896
|
+
}
|
|
31897
|
+
status;
|
|
31898
|
+
timedOut;
|
|
31899
|
+
/** A timeout or a 5xx means reflect's synthesis (the slow LLM path) broke, while the cheap
|
|
31900
|
+
* retrieval endpoints may still answer — worth falling back. A 4xx will fail the same way on
|
|
31901
|
+
* every endpoint (auth, missing bank), so it is not. */
|
|
31902
|
+
get fallbackEligible() {
|
|
31903
|
+
return this.timedOut || this.status !== void 0 && this.status >= 500;
|
|
31904
|
+
}
|
|
31905
|
+
};
|
|
31890
31906
|
var DEFAULT_MAX_PARALLEL_RETAINS = 10;
|
|
31891
31907
|
var POLL_CYCLE_MS = 5e3;
|
|
31892
31908
|
var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
|
|
@@ -31970,11 +31986,11 @@ var HindsightClient = class {
|
|
|
31970
31986
|
return `${this.apiUrl}/v1/default/banks/${encodeURIComponent(this.bank)}${suffix}`;
|
|
31971
31987
|
}
|
|
31972
31988
|
/** `tolerate` adds statuses that are returned to the caller instead of thrown (404 always is). */
|
|
31973
|
-
async req(method, url2, body, tolerate = []) {
|
|
31989
|
+
async req(method, url2, body, tolerate = [], timeoutMs = 15e3) {
|
|
31974
31990
|
const r = await this.fetchWithAuth(url2, {
|
|
31975
31991
|
method,
|
|
31976
31992
|
body: body ? JSON.stringify(body) : void 0,
|
|
31977
|
-
signal: AbortSignal.timeout(
|
|
31993
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
31978
31994
|
});
|
|
31979
31995
|
if (r.status === 429 && !tolerate.includes(429))
|
|
31980
31996
|
throw new RateLimitedError(retryAfterMs(r.headers.get("retry-after")));
|
|
@@ -32167,7 +32183,7 @@ var HindsightClient = class {
|
|
|
32167
32183
|
/**
|
|
32168
32184
|
* Reflect: synthesized, root-cause answer over the bank. Bounded so a slow server never hangs a
|
|
32169
32185
|
* caller — but `timeoutMs` is REQUIRED, deliberately: the right deadline differs by an order of
|
|
32170
|
-
* magnitude between the automatic hook (
|
|
32186
|
+
* magnitude between the automatic hook (20s, to fit the host's window) and the agent-invoked
|
|
32171
32187
|
* tool (minutes, on a populated bank). This used to default to 120s, which silently overrode the
|
|
32172
32188
|
* tool's configured window and aborted every high-budget synthesis mid-flight (#3590).
|
|
32173
32189
|
*/
|
|
@@ -32180,13 +32196,46 @@ var HindsightClient = class {
|
|
|
32180
32196
|
body: JSON.stringify({ query, budget: opts.budget ?? "high" }),
|
|
32181
32197
|
signal: ctrl.signal
|
|
32182
32198
|
});
|
|
32183
|
-
if (!resp.ok)
|
|
32199
|
+
if (!resp.ok)
|
|
32200
|
+
throw new ReflectError(
|
|
32201
|
+
`reflect ${resp.status} ${(await resp.text()).slice(0, 1e3)}${this.authHint(resp.status)}`,
|
|
32202
|
+
resp.status,
|
|
32203
|
+
false
|
|
32204
|
+
);
|
|
32184
32205
|
const data = await resp.json();
|
|
32185
32206
|
return (data.text || "").trim();
|
|
32207
|
+
} catch (e) {
|
|
32208
|
+
if (ctrl.signal.aborted)
|
|
32209
|
+
throw new ReflectError(`reflect timed out after ${opts.timeoutMs}ms`, void 0, true, {
|
|
32210
|
+
cause: e
|
|
32211
|
+
});
|
|
32212
|
+
throw e;
|
|
32186
32213
|
} finally {
|
|
32187
32214
|
clearTimeout(timer);
|
|
32188
32215
|
}
|
|
32189
32216
|
}
|
|
32217
|
+
/**
|
|
32218
|
+
* Raw recall restricted to consolidated observations — no LLM in the loop, so it still answers
|
|
32219
|
+
* when reflect's synthesis times out or 5xxs. Returns the observation texts in rank order.
|
|
32220
|
+
*/
|
|
32221
|
+
async recallObservations(query, opts) {
|
|
32222
|
+
const r = await this.req(
|
|
32223
|
+
"POST",
|
|
32224
|
+
this.bankUrl("/memories/recall"),
|
|
32225
|
+
{
|
|
32226
|
+
query,
|
|
32227
|
+
types: ["observation"],
|
|
32228
|
+
budget: "low",
|
|
32229
|
+
max_tokens: opts.maxTokens,
|
|
32230
|
+
include: { entities: null }
|
|
32231
|
+
},
|
|
32232
|
+
[],
|
|
32233
|
+
opts.timeoutMs
|
|
32234
|
+
);
|
|
32235
|
+
if (r.status === 404) return [];
|
|
32236
|
+
const j = await r.json();
|
|
32237
|
+
return (j.results ?? []).map((x) => (x.text ?? "").trim()).filter(Boolean);
|
|
32238
|
+
}
|
|
32190
32239
|
/**
|
|
32191
32240
|
* The bank's knowledge-base tree (folders + pages, nested). The tree carries names, source
|
|
32192
32241
|
* queries and staleness but NOT synthesized content, so it is cheap enough to poll.
|
|
@@ -32251,10 +32300,16 @@ var HindsightClient = class {
|
|
|
32251
32300
|
/** Hybrid (BM25 + vector, RRF-fused) server-side search over the bank's knowledge pages.
|
|
32252
32301
|
* Returns page-level hits with a relevance snippet — the real search behind
|
|
32253
32302
|
* hindsight_search_knowledge_pages. */
|
|
32254
|
-
async searchKnowledgePages(query, limit = 3) {
|
|
32303
|
+
async searchKnowledgePages(query, limit = 3, timeoutMs) {
|
|
32255
32304
|
if (this.knowledgePagesSupported === false) throw new KnowledgePagesUnavailableError();
|
|
32256
32305
|
const q = `?q=${encodeURIComponent(query)}&limit=${limit}`;
|
|
32257
|
-
const r = await this.req(
|
|
32306
|
+
const r = await this.req(
|
|
32307
|
+
"GET",
|
|
32308
|
+
this.bankUrl(`/knowledge-base/search${q}`),
|
|
32309
|
+
void 0,
|
|
32310
|
+
[],
|
|
32311
|
+
timeoutMs
|
|
32312
|
+
);
|
|
32258
32313
|
const j = await r.json();
|
|
32259
32314
|
return (j.results ?? []).map((x) => ({
|
|
32260
32315
|
id: x.id,
|
|
@@ -32728,7 +32783,7 @@ function resolveHostMemory(harness, directory) {
|
|
|
32728
32783
|
// src/core/knowledge-tools.ts
|
|
32729
32784
|
import { existsSync as existsSync3 } from "fs";
|
|
32730
32785
|
import { homedir as homedir4 } from "os";
|
|
32731
|
-
import { join as
|
|
32786
|
+
import { join as join9 } from "path";
|
|
32732
32787
|
|
|
32733
32788
|
// src/core/status.ts
|
|
32734
32789
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
@@ -32769,11 +32824,31 @@ function parsePageList(raw) {
|
|
|
32769
32824
|
}
|
|
32770
32825
|
|
|
32771
32826
|
// src/core/survey.ts
|
|
32772
|
-
import { spawn as
|
|
32827
|
+
import { spawn as realSpawn3 } from "child_process";
|
|
32828
|
+
import { createHash as createHash2 } from "crypto";
|
|
32773
32829
|
import { existsSync as existsSync2 } from "fs";
|
|
32774
|
-
import { homedir as homedir3 } from "os";
|
|
32775
|
-
import { dirname as dirname5, join as
|
|
32830
|
+
import { homedir as homedir3, tmpdir as tmpdir2 } from "os";
|
|
32831
|
+
import { dirname as dirname5, join as join8 } from "path";
|
|
32776
32832
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
32833
|
+
|
|
32834
|
+
// src/core/survey-lease.ts
|
|
32835
|
+
import { spawn as realSpawn2 } from "child_process";
|
|
32836
|
+
import { randomUUID } from "crypto";
|
|
32837
|
+
import {
|
|
32838
|
+
mkdirSync as mkdirSync2,
|
|
32839
|
+
mkdtempSync,
|
|
32840
|
+
readdirSync,
|
|
32841
|
+
renameSync,
|
|
32842
|
+
rmdirSync,
|
|
32843
|
+
rmSync,
|
|
32844
|
+
statSync,
|
|
32845
|
+
unlinkSync,
|
|
32846
|
+
utimesSync,
|
|
32847
|
+
writeFileSync
|
|
32848
|
+
} from "fs";
|
|
32849
|
+
import { join as join7 } from "path";
|
|
32850
|
+
|
|
32851
|
+
// src/core/survey.ts
|
|
32777
32852
|
var SURVEY_DOC_IDS = [
|
|
32778
32853
|
"repository-component-map",
|
|
32779
32854
|
"repository-core-concepts",
|
|
@@ -32891,7 +32966,7 @@ function buildKnowledgeTools(client, bankId, opts = {}) {
|
|
|
32891
32966
|
inputSchema: {},
|
|
32892
32967
|
annotations: READ_ONLY_ANNOTATIONS,
|
|
32893
32968
|
handler: async (_args) => {
|
|
32894
|
-
const configPath = process.env.HINDSIGHT_CONFIG ||
|
|
32969
|
+
const configPath = process.env.HINDSIGHT_CONFIG || join9(homedir4(), ".hindsight", "coding-agent.json");
|
|
32895
32970
|
const harness = opts.harness ?? "unknown";
|
|
32896
32971
|
const cfg = applyBankConfig(
|
|
32897
32972
|
loadConfig({ harness: opts.harness }),
|