@vectorize-io/hindsight-coding-agents 0.8.0 → 0.8.2
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 +73 -8
- package/dist/antigravity-hook.js +444 -80
- package/dist/antigravity-statusline.js +9 -4
- package/dist/antigravity-stop-hook.js +444 -95
- package/dist/claude-hook.js +444 -80
- package/dist/claude-sessionstart-hook.js +476 -93
- package/dist/claude-stop-hook.js +444 -95
- package/dist/cline.js +322 -122
- package/dist/codebuddy-hook.js +4273 -0
- package/dist/codebuddy-sessionstart-hook.js +5033 -0
- package/dist/codebuddy-stop-hook.js +4567 -0
- package/dist/codex-hook.js +444 -80
- package/dist/codex-sessionstart-hook.js +476 -93
- package/dist/codex-stop-hook.js +444 -95
- package/dist/copilot-hook.js +444 -80
- package/dist/copilot-sessionstart-hook.js +476 -93
- package/dist/copilot-stop-hook.js +444 -95
- package/dist/cursor-hook.js +444 -80
- package/dist/cursor-sessionstart-hook.js +476 -93
- package/dist/cursor-stop-hook.js +444 -95
- package/dist/daemon-start.js +16 -8
- package/dist/dcode-hook.js +444 -80
- package/dist/dcode-sessionstart-hook.js +476 -93
- package/dist/dcode-stop-hook.js +444 -95
- package/dist/deepen.js +252 -79
- package/dist/devin-hook.js +444 -80
- package/dist/devin-sessionstart-hook.js +476 -93
- package/dist/devin-stop-hook.js +444 -95
- package/dist/droid-hook.js +444 -80
- package/dist/droid-sessionstart-hook.js +476 -93
- package/dist/droid-stop-hook.js +444 -95
- package/dist/dsh.js +329 -122
- package/dist/grok-hook.js +444 -80
- package/dist/grok-sessionstart-hook.js +476 -93
- package/dist/grok-stop-hook.js +444 -95
- package/dist/hindsight-seed.js +9 -4
- package/dist/index.js +331 -131
- package/dist/installer.js +1046 -647
- package/dist/kilo.js +331 -131
- package/dist/kimi-hook.js +444 -80
- package/dist/kimi-sessionstart-hook.js +476 -93
- package/dist/kimi-stop-hook.js +444 -95
- package/dist/mcp-server.js +272 -89
- package/dist/opencode2.js +328 -128
- package/dist/pi.js +384 -134
- package/dist/prime-agent.js +384 -134
- package/dist/qwen-hook.js +444 -80
- package/dist/qwen-sessionstart-hook.js +476 -93
- package/dist/qwen-stop-hook.js +444 -95
- package/dist/status.js +124 -43
- package/dist/traecode-hook.js +444 -80
- package/dist/traecode-sessionstart-hook.js +476 -93
- package/dist/traecode-stop-hook.js +444 -95
- package/dist/workbuddy-hook.js +4273 -0
- package/dist/workbuddy-sessionstart-hook.js +5033 -0
- package/dist/workbuddy-stop-hook.js +4567 -0
- package/dist/zcode-hook.js +444 -80
- package/dist/zcode-sessionstart-hook.js +476 -93
- package/dist/zcode-stop-hook.js +444 -95
- package/package.json +9 -3
- package/plugin.json +1 -1
- package/skill/SKILL.md +10 -6
package/dist/deepen.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/deepen.ts
|
|
4
|
-
import { execFileSync as
|
|
4
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
5
5
|
import { tmpdir as tmpdir2 } from "os";
|
|
6
6
|
import { join as join10 } from "path";
|
|
7
7
|
|
|
@@ -11,6 +11,7 @@ import { homedir as homedir2 } from "os";
|
|
|
11
11
|
import { basename, dirname as dirname3, join as join4, normalize, sep } from "path";
|
|
12
12
|
|
|
13
13
|
// src/core/diag.ts
|
|
14
|
+
import { readFileSync } from "fs";
|
|
14
15
|
import { join as join2 } from "path";
|
|
15
16
|
|
|
16
17
|
// src/core/log.ts
|
|
@@ -86,7 +87,7 @@ function diag(harness, event, extra = {}) {
|
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
// src/core/git-layout.ts
|
|
89
|
-
import { lstatSync, readFileSync, realpathSync } from "fs";
|
|
90
|
+
import { lstatSync, readFileSync as readFileSync2, realpathSync } from "fs";
|
|
90
91
|
import { dirname as dirname2, isAbsolute, join as join3, resolve } from "path";
|
|
91
92
|
var TRANSIENT = /* @__PURE__ */ new Set(["EAGAIN", "EMFILE", "ENFILE", "EBUSY", "EINTR", "EIO", "ETIMEDOUT"]);
|
|
92
93
|
var ATTEMPTS = 3;
|
|
@@ -110,7 +111,7 @@ function entryKind(path) {
|
|
|
110
111
|
}
|
|
111
112
|
function readTextOrNull(path) {
|
|
112
113
|
try {
|
|
113
|
-
return
|
|
114
|
+
return readFileSync2(path, "utf8");
|
|
114
115
|
} catch (error) {
|
|
115
116
|
if (TRANSIENT.has(errorCode(error))) throw new TransientProbeError(errorCode(error));
|
|
116
117
|
return null;
|
|
@@ -355,7 +356,7 @@ function deriveBankIdOrSkip(config, directory, harness = "coding", sessionRoot)
|
|
|
355
356
|
// src/core/missions.ts
|
|
356
357
|
import { createHash } from "crypto";
|
|
357
358
|
var GIT_MISSION = "You are ingesting a single git commit: its message and its full diff. Extract the concrete technical DECISION and the CAUSE/INVARIANT it encodes, bound to the specific code entities (functions, methods, files) and behaviors it changes. Preserve exact identifiers, paths, and literal values verbatim. Preserve the 'REF-ID: <token>' marker verbatim in every fact. Capture both WHAT changed and WHY. Issue/PR references (#123, GH-123, PROJ-123) are load-bearing: keep them VERBATIM in the fact text and emit each as an ENTITY, so a later question about that issue or PR retrieves this decision.";
|
|
358
|
-
var GITLOG_MISSION = "You are ingesting an aggregated block of git commit MESSAGES ONLY (no diffs) \u2014 the project's recent commit-message history,
|
|
359
|
+
var GITLOG_MISSION = "You are ingesting an aggregated block of git commit MESSAGES ONLY (no diffs) \u2014 the project's recent commit-message history, oldest first. Extract the project's INITIATIVES, FEATURES, ENHANCEMENTS, and notable changes or THEMES over time \u2014 what the project has been working on and how it has evolved. Do NOT extract per-line code detail (there is no diff to draw it from). Group related commits into a coherent initiative/theme where the messages make that clear; preserve exact identifiers and literal values verbatim when quoting a subject line. Keep issue/PR references (#123, GH-123) VERBATIM and emit each as an ENTITY \u2014 they are how future sessions will ask about this work.";
|
|
359
360
|
var CONVERSATION_MISSION = `You are ingesting a developer conversation as a JSONL transcript (one {role, content} turn per line): the user's requests, the assistant's narration, and compact 'action' turns naming each tool use and its target (e.g. "Edit boltons/strutils.py") with no arguments or outputs. It may be a SHORT decision chat or a LONG working session \u2014 scale the facts to the substance, never to the message count. Extract the FEWEST facts that capture the OUTCOME: the settled DECISIONS and their exact rules/values (quote literals VERBATIM); concrete CHANGES to specific code entities; problems and how they were resolved; conventions or invariants established; at most one fact for a notable REJECTED alternative ('initially proposed X, changed to Y because Z'). A short decision chat usually yields 1-2 facts; a substantial working session several. CRITICAL: a conversation REVISES itself \u2014 record ONLY the FINAL state as what is in effect; a superseded proposal appears ONLY inside the rejected fact, NEVER as its own 'decided' fact; if the same setting changes several times keep only the LAST, and make unmistakably clear which choice WON. Do NOT emit one fact per message, per intermediate proposal, or per action turn. Keep issue/PR references (#123, GH-123) VERBATIM and emit each as an ENTITY. Preserve the 'REF-ID: <token>' marker verbatim in every fact. Do not invent; capture only what was actually settled.`;
|
|
360
361
|
var REFLECT_MISSION = "You are a debugging assistant with the project's past decisions in memory (git rationale and developer chats). Given a bug's SYMPTOM, find the past decision whose rationale explains the ROOT CAUSE \u2014 not one that merely shares vocabulary. Answer with the PRECISE fix: state the EXACT rule and the LITERAL values, identifiers, strings, numbers, or set members that were decided \u2014 quote them VERBATIM, never paraphrase, generalize, or omit them (give the actual decided value, not 'the project standard'). If memories CONFLICT on the same rule, the LATEST decision wins \u2014 prefer facts that explicitly amend or supersede an earlier one, state the superseded rule as no longer in effect, and never present it as the fix. Name the function/file to change and cite the REF-ID(s). If NOTHING in memory genuinely explains THIS symptom, say exactly that in one short sentence \u2014 a wrong-but-confident nearest match is worse than an honest miss; never stretch an unrelated decision to fit.";
|
|
361
362
|
var DOCUMENT_MISSION = "You are ingesting a standalone document (notes, docs, or structural findings). Extract the concrete facts, concepts, and structure it describes.";
|
|
@@ -431,6 +432,8 @@ var KNOWLEDGE_LABELS = {
|
|
|
431
432
|
]
|
|
432
433
|
};
|
|
433
434
|
function pageScopeRule(project) {
|
|
435
|
+
if (project === void 0)
|
|
436
|
+
return ` This bank is shared by several projects: attribute each thing you include to the repository or project its sources name, and group by project where that helps. Leave out facts about external tools, libraries and services those projects merely use, configure, deploy or discuss \u2014 they belong to somebody else's codebase \u2014 including any commit SHA or identifier from such a dependency's repository.`;
|
|
434
437
|
return ` Scope this page to ${project} ITSELF: the bank also holds facts about external tools, libraries and services that ${project} merely uses, configures, deploys or discusses, and those belong to somebody else's codebase. Include something only when its subject is ${project}'s own code, configuration or process; when it is about a dependency, leave it out however well-evidenced it looks \u2014 including any commit SHA or identifier that belongs to that dependency's repository rather than this one.`;
|
|
435
438
|
}
|
|
436
439
|
var PAGE_TAXONOMY = [
|
|
@@ -612,16 +615,19 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
|
|
|
612
615
|
return Object.keys(bank).length > 0 ? { version: "1", bank } : void 0;
|
|
613
616
|
}
|
|
614
617
|
|
|
618
|
+
// package.json
|
|
619
|
+
var version = "0.8.2";
|
|
620
|
+
|
|
615
621
|
// src/core/util.ts
|
|
616
622
|
import { accessSync, constants } from "fs";
|
|
617
623
|
import { delimiter, join as join5 } from "path";
|
|
618
624
|
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
619
|
-
function semverGte(
|
|
625
|
+
function semverGte(version2, min) {
|
|
620
626
|
const parts = (v) => {
|
|
621
627
|
const m = v.trim().match(/^(\d+)\.(\d+)(?:\.(\d+))?/);
|
|
622
628
|
return m ? [Number(m[1]), Number(m[2]), Number(m[3] ?? 0)] : void 0;
|
|
623
629
|
};
|
|
624
|
-
const a =
|
|
630
|
+
const a = version2 ? parts(version2) : void 0;
|
|
625
631
|
const b = parts(min);
|
|
626
632
|
if (!a || !b) return false;
|
|
627
633
|
for (let i = 0; i < 3; i++) {
|
|
@@ -646,6 +652,7 @@ async function pool(items, n, fn, onError, onProgress) {
|
|
|
646
652
|
}
|
|
647
653
|
|
|
648
654
|
// src/core/hindsight.ts
|
|
655
|
+
var USER_AGENT = `hindsight-coding-agents/${version}`;
|
|
649
656
|
function resolveRetainScopes(tags, configured) {
|
|
650
657
|
if (configured !== "per_source") return configured;
|
|
651
658
|
const sources = [...new Set((tags ?? []).filter((t) => t.startsWith("source:")))].sort();
|
|
@@ -681,7 +688,7 @@ async function isEndpointMissing(r) {
|
|
|
681
688
|
const j = await r.json();
|
|
682
689
|
return String(j?.detail ?? "").trim().toLowerCase() === "not found";
|
|
683
690
|
} catch {
|
|
684
|
-
return
|
|
691
|
+
return false;
|
|
685
692
|
}
|
|
686
693
|
}
|
|
687
694
|
var TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "cancelled", "error"]);
|
|
@@ -700,6 +707,12 @@ var ReflectError = class extends Error {
|
|
|
700
707
|
get fallbackEligible() {
|
|
701
708
|
return this.timedOut || this.status !== void 0 && this.status >= 500;
|
|
702
709
|
}
|
|
710
|
+
/** A 4xx the next attempt would get again (bad key, missing bank, rejected body) — retrying it
|
|
711
|
+
* only spends another doomed call (#5207). 408/429 are "not now", so they stay retryable. */
|
|
712
|
+
get permanent() {
|
|
713
|
+
const s = this.status;
|
|
714
|
+
return s !== void 0 && s >= 400 && s < 500 && s !== 408 && s !== 429;
|
|
715
|
+
}
|
|
703
716
|
};
|
|
704
717
|
var DEFAULT_MAX_PARALLEL_RETAINS = 10;
|
|
705
718
|
var DEFAULT_PAGE_SEARCH_LIMIT = 10;
|
|
@@ -710,8 +723,10 @@ var DEFAULT_RECALL_OPTIONS = {
|
|
|
710
723
|
include: { entities: null }
|
|
711
724
|
};
|
|
712
725
|
var POLL_CYCLE_MS = 5e3;
|
|
726
|
+
var POLL_MAX_SERVER_ERRORS = 12;
|
|
713
727
|
var RETRY_AFTER_FLOOR_MS = 10 * 1e3;
|
|
714
728
|
var RETRY_AFTER_CEILING_MS = 60 * 1e3;
|
|
729
|
+
var RATE_LIMIT_BACKOFF_MS = 1e3;
|
|
715
730
|
function shapePage(page) {
|
|
716
731
|
const p = page ?? {};
|
|
717
732
|
const body = typeof p.body === "string" && p.body.trim() ? p.body : p.markdown;
|
|
@@ -724,6 +739,15 @@ function shapePage(page) {
|
|
|
724
739
|
body
|
|
725
740
|
};
|
|
726
741
|
}
|
|
742
|
+
var GLOBAL_DISPATCHER = /* @__PURE__ */ Symbol.for("undici.globalDispatcher.1");
|
|
743
|
+
function signalOnlyDispatcher() {
|
|
744
|
+
void globalThis.Headers;
|
|
745
|
+
const d = globalThis[GLOBAL_DISPATCHER];
|
|
746
|
+
if (typeof d?.compose !== "function") return void 0;
|
|
747
|
+
return d.compose(
|
|
748
|
+
(dispatch) => (opts, handler) => dispatch({ ...opts, headersTimeout: 0, bodyTimeout: 0 }, handler)
|
|
749
|
+
);
|
|
750
|
+
}
|
|
727
751
|
var HindsightClient = class {
|
|
728
752
|
apiUrl;
|
|
729
753
|
/** The credential the NEXT request will sign with — NOT the one the config file holds. The two
|
|
@@ -743,6 +767,7 @@ var HindsightClient = class {
|
|
|
743
767
|
observationScopes;
|
|
744
768
|
pageSearchLimit;
|
|
745
769
|
recallOptions;
|
|
770
|
+
rateLimitPatienceMs;
|
|
746
771
|
constructor(o) {
|
|
747
772
|
this.apiUrl = o.apiUrl.replace(/\/$/, "");
|
|
748
773
|
this.token = o.apiToken;
|
|
@@ -755,6 +780,7 @@ var HindsightClient = class {
|
|
|
755
780
|
this.observationScopes = o.observationScopes ?? DEFAULT_OBSERVATION_SCOPES;
|
|
756
781
|
this.pageSearchLimit = o.pageSearchLimit || DEFAULT_PAGE_SEARCH_LIMIT;
|
|
757
782
|
this.recallOptions = { ...DEFAULT_RECALL_OPTIONS, ...o.recallOptions };
|
|
783
|
+
this.rateLimitPatienceMs = o.rateLimitPatienceMs ?? 0;
|
|
758
784
|
}
|
|
759
785
|
/** The credential in use, for diagnostics. Never log or report the VALUE — booleans only. */
|
|
760
786
|
get apiToken() {
|
|
@@ -763,7 +789,8 @@ var HindsightClient = class {
|
|
|
763
789
|
headers() {
|
|
764
790
|
const h = {
|
|
765
791
|
"Content-Type": "application/json",
|
|
766
|
-
"Accept-Encoding": "identity"
|
|
792
|
+
"Accept-Encoding": "identity",
|
|
793
|
+
"User-Agent": USER_AGENT
|
|
767
794
|
};
|
|
768
795
|
if (this.token) h["Authorization"] = `Bearer ${this.token}`;
|
|
769
796
|
return h;
|
|
@@ -795,7 +822,8 @@ var HindsightClient = class {
|
|
|
795
822
|
* bounds the whole call.
|
|
796
823
|
*/
|
|
797
824
|
async fetchWithAuth(url, init) {
|
|
798
|
-
const
|
|
825
|
+
const dispatcher = init.signal ? signalOnlyDispatcher() : void 0;
|
|
826
|
+
const send = () => fetch(url, { ...init, headers: this.headers(), ...dispatcher ? { dispatcher } : {} });
|
|
799
827
|
const r = await send();
|
|
800
828
|
if (r.status !== 401 || !this.refreshToken()) return r;
|
|
801
829
|
return send();
|
|
@@ -811,13 +839,22 @@ var HindsightClient = class {
|
|
|
811
839
|
}
|
|
812
840
|
/** `tolerate` adds statuses that are returned to the caller instead of thrown (404 always is). */
|
|
813
841
|
async req(method, url, body, tolerate = [], timeoutMs = 15e3) {
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
842
|
+
const payload = body ? JSON.stringify(body) : void 0;
|
|
843
|
+
let r;
|
|
844
|
+
for (let attempt = 0, waited = 0; ; attempt++) {
|
|
845
|
+
r = await this.fetchWithAuth(url, {
|
|
846
|
+
method,
|
|
847
|
+
body: payload,
|
|
848
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
849
|
+
});
|
|
850
|
+
if (r.status !== 429 || tolerate.includes(429)) break;
|
|
851
|
+
const asked = retryAfterMs(r.headers.get("retry-after"));
|
|
852
|
+
const backoff = Math.min(RETRY_AFTER_CEILING_MS, RATE_LIMIT_BACKOFF_MS * 2 ** attempt);
|
|
853
|
+
const wait = Math.min(RETRY_AFTER_CEILING_MS, Math.max(asked, backoff)) * (1 + Math.random() / 2);
|
|
854
|
+
if (waited + wait > this.rateLimitPatienceMs) throw new RateLimitedError(asked);
|
|
855
|
+
await sleep(wait);
|
|
856
|
+
waited += wait;
|
|
857
|
+
}
|
|
821
858
|
if (!r.ok && r.status !== 404 && !tolerate.includes(r.status))
|
|
822
859
|
throw new Error(
|
|
823
860
|
`${method} ${url} -> ${r.status} ${await r.text()}${this.authHint(r.status)}`
|
|
@@ -852,7 +889,7 @@ var HindsightClient = class {
|
|
|
852
889
|
}
|
|
853
890
|
/**
|
|
854
891
|
* Whether this server honours `operation_id` on an async retain, and can therefore be appended to
|
|
855
|
-
* safely (see MIN_IDEMPOTENT_RETAIN_VERSION). Probed once per client via
|
|
892
|
+
* safely (see MIN_IDEMPOTENT_RETAIN_VERSION). Probed once per client via the version endpoint; anything
|
|
856
893
|
* unreachable, unparseable or older answers "no", which costs efficiency, never correctness.
|
|
857
894
|
*/
|
|
858
895
|
async supportsIdempotentRetain() {
|
|
@@ -862,15 +899,21 @@ var HindsightClient = class {
|
|
|
862
899
|
}
|
|
863
900
|
return this.idempotentRetain;
|
|
864
901
|
}
|
|
902
|
+
/** `/v1/version` first: an ingress that routes only `/v1` to the API (the Helm chart's default)
|
|
903
|
+
* hands a bare `/version` to the control plane, whose HTML 404 or login redirect read as "no",
|
|
904
|
+
* so append silently never turned on (#5286). Servers that predate the alias still answer
|
|
905
|
+
* `/version`, so that stays as the fallback. */
|
|
865
906
|
async probeIdempotentRetain() {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
907
|
+
for (const path of ["/v1/version", "/version"]) {
|
|
908
|
+
try {
|
|
909
|
+
const r = await this.req("GET", `${this.apiUrl}${path}`);
|
|
910
|
+
if (!r.ok) continue;
|
|
911
|
+
const j = await r.json();
|
|
912
|
+
return semverGte(j.api_version, MIN_IDEMPOTENT_RETAIN_VERSION);
|
|
913
|
+
} catch {
|
|
914
|
+
}
|
|
873
915
|
}
|
|
916
|
+
return false;
|
|
874
917
|
}
|
|
875
918
|
/**
|
|
876
919
|
* Whether a session write-back may use `update_mode="append"`: the server must dedupe by
|
|
@@ -932,6 +975,14 @@ var HindsightClient = class {
|
|
|
932
975
|
if (items.length < limit || offset + limit >= (j.total ?? 0)) return void 0;
|
|
933
976
|
}
|
|
934
977
|
}
|
|
978
|
+
/** Whether the bank holds any document at all — a one-row listing. A bank that does not exist
|
|
979
|
+
* yet (404) holds none; any other failure throws, so a caller can tell "empty" from "unknown". */
|
|
980
|
+
async hasDocuments() {
|
|
981
|
+
const r = await this.req("GET", this.bankUrl("/documents?limit=1"));
|
|
982
|
+
if (r.status === 404) return false;
|
|
983
|
+
const j = await r.json();
|
|
984
|
+
return (j.total ?? j.items?.length ?? 0) > 0;
|
|
985
|
+
}
|
|
935
986
|
/** Configure the bank: POST the coding bank manifest to /import (missions, retain strategies,
|
|
936
987
|
* entity labels), then seed knowledge pages when the server supports them. Both halves are
|
|
937
988
|
* idempotent and ADDITIVE — nothing the bank already says is overwritten (#3927), bar the
|
|
@@ -1013,7 +1064,13 @@ var HindsightClient = class {
|
|
|
1013
1064
|
this.log(`[wait] draining ${ids.length} ${label} operations \u2026`);
|
|
1014
1065
|
const start = Date.now();
|
|
1015
1066
|
const pending = new Set(ids);
|
|
1067
|
+
const serverErrors = /* @__PURE__ */ new Map();
|
|
1016
1068
|
let failed = 0;
|
|
1069
|
+
const giveUp = (id, status) => {
|
|
1070
|
+
pending.delete(id);
|
|
1071
|
+
failed++;
|
|
1072
|
+
this.log(` \u2026 ${label} op ${id} -> HTTP ${status}, counted as failed`);
|
|
1073
|
+
};
|
|
1017
1074
|
while (pending.size && Date.now() - start < maxMs) {
|
|
1018
1075
|
let backoffMs = POLL_CYCLE_MS;
|
|
1019
1076
|
await pool([...pending], this.maxParallelRetains, async (id) => {
|
|
@@ -1026,7 +1083,14 @@ var HindsightClient = class {
|
|
|
1026
1083
|
);
|
|
1027
1084
|
return;
|
|
1028
1085
|
}
|
|
1029
|
-
if (
|
|
1086
|
+
if (r.status >= 500) {
|
|
1087
|
+
const n = (serverErrors.get(id) ?? 0) + 1;
|
|
1088
|
+
serverErrors.set(id, n);
|
|
1089
|
+
if (n >= POLL_MAX_SERVER_ERRORS) giveUp(id, r.status);
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
if (!r.ok) return giveUp(id, r.status);
|
|
1093
|
+
serverErrors.delete(id);
|
|
1030
1094
|
const st = ((await r.json()).status || "").toLowerCase();
|
|
1031
1095
|
if (TERMINAL.has(st)) {
|
|
1032
1096
|
pending.delete(id);
|
|
@@ -1210,7 +1274,7 @@ var HindsightClient = class {
|
|
|
1210
1274
|
* which is how `pageScopeRule`'s repo name reaches banks seeded by an earlier version.
|
|
1211
1275
|
*/
|
|
1212
1276
|
async seedPages(pageTrigger = buildPageTrigger(), pagesConfig = {}, customPages = {}) {
|
|
1213
|
-
const pages = pagesFor(this.project
|
|
1277
|
+
const pages = pagesFor(this.project, pagesConfig, customPages);
|
|
1214
1278
|
const existing = /* @__PURE__ */ new Map();
|
|
1215
1279
|
let roots;
|
|
1216
1280
|
try {
|
|
@@ -1285,7 +1349,7 @@ var HindsightClient = class {
|
|
|
1285
1349
|
}
|
|
1286
1350
|
const initiatives = await this.resyncInitiativeTriggers(roots, pageTrigger);
|
|
1287
1351
|
this.log(
|
|
1288
|
-
`[bank] knowledge pages seeded on ${this.bank} (scoped to ${this.project ??
|
|
1352
|
+
`[bank] knowledge pages seeded on ${this.bank} (scoped to ${this.project ?? "the shared bank"}): ${created} created, ${updated} re-synced, ${pages.length - created - updated - vanished} unchanged` + (vanished ? `, ${vanished} deleted under us` : "") + (initiatives ? `, ${initiatives} initiative pages re-synced` : "")
|
|
1289
1353
|
);
|
|
1290
1354
|
}
|
|
1291
1355
|
/**
|
|
@@ -1296,23 +1360,33 @@ var HindsightClient = class {
|
|
|
1296
1360
|
* it: five taxonomy pages against one page per initiative, each an LLM synthesis per
|
|
1297
1361
|
* consolidation under the auto-refresh that used to be the default (#3506).
|
|
1298
1362
|
*
|
|
1299
|
-
*
|
|
1300
|
-
*
|
|
1301
|
-
*
|
|
1363
|
+
* Their `name` and `source_query` are written once, from the initiative's own title, and
|
|
1364
|
+
* re-stating either would rebuild a page whose question never changed. The one exception is
|
|
1365
|
+
* the scope clause: a page captured while the clause named the BANK is scoped to a project no
|
|
1366
|
+
* memory is about and comes out empty (#4490), so exactly that clause is swapped for the current
|
|
1367
|
+
* one — the rest of the query, the user's wording included, is kept. The tree read above is
|
|
1368
|
+
* reused rather than re-fetched.
|
|
1302
1369
|
*/
|
|
1303
1370
|
async resyncInitiativeTriggers(roots, pageTrigger) {
|
|
1304
1371
|
const folder = roots.find(
|
|
1305
1372
|
(n) => n.kind === "folder" && (n.name || "").toLowerCase() === "initiatives"
|
|
1306
1373
|
);
|
|
1374
|
+
const bankScope = pageScopeRule(this.bank);
|
|
1307
1375
|
let updated = 0;
|
|
1308
1376
|
for (const page of folder?.children ?? []) {
|
|
1309
|
-
if (page.kind !== "page"
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1377
|
+
if (page.kind !== "page") continue;
|
|
1378
|
+
const patch = {};
|
|
1379
|
+
const query = page.description?.replace(bankScope, pageScopeRule(this.project));
|
|
1380
|
+
if (query !== page.description) patch.source_query = query;
|
|
1381
|
+
if (page.trigger != null) {
|
|
1382
|
+
const desired = pageTriggerFor(pageTrigger, this.bank, page.name);
|
|
1383
|
+
if (pageTriggerDrifted(page.trigger, desired)) patch.trigger = pageTriggerPatch(desired);
|
|
1384
|
+
}
|
|
1385
|
+
if (!patch.trigger && !patch.source_query) continue;
|
|
1312
1386
|
const r = await this.req(
|
|
1313
1387
|
"PATCH",
|
|
1314
1388
|
this.bankUrl(`/knowledge-base/nodes/${encodeURIComponent(page.id)}`),
|
|
1315
|
-
|
|
1389
|
+
patch
|
|
1316
1390
|
);
|
|
1317
1391
|
if (r.status === 404) continue;
|
|
1318
1392
|
updated++;
|
|
@@ -1340,10 +1414,9 @@ var HindsightClient = class {
|
|
|
1340
1414
|
let pageId = args.relatesToPageId;
|
|
1341
1415
|
if (!pageId) {
|
|
1342
1416
|
const folderId = await this.ensureFolder("Initiatives");
|
|
1343
|
-
const subject = this.project ?? this.bank;
|
|
1344
1417
|
const r = await this.req("POST", this.bankUrl("/knowledge-base/pages"), {
|
|
1345
1418
|
name: args.title,
|
|
1346
|
-
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(
|
|
1419
|
+
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(this.project),
|
|
1347
1420
|
parent_id: folderId,
|
|
1348
1421
|
tags: ["knowledge:feature-work"],
|
|
1349
1422
|
max_tokens: PAGE_MAX_TOKENS,
|
|
@@ -1358,7 +1431,7 @@ var HindsightClient = class {
|
|
|
1358
1431
|
}
|
|
1359
1432
|
const verb = args.relatesToPageId ? "Update to an existing initiative" : "New initiative";
|
|
1360
1433
|
const content = `${verb}: ${args.title}. ${args.summary}`;
|
|
1361
|
-
const markerId = `initiative-marker-${this.slugify(
|
|
1434
|
+
const markerId = `initiative-marker-${this.slugify(pageId)}${args.relatesToPageId ? "-update" : ""}`;
|
|
1362
1435
|
const tags = [.../* @__PURE__ */ new Set([...args.stamp?.tags ?? [], "knowledge:feature-work"])];
|
|
1363
1436
|
const context = `initiative marker for [[page:${pageId}]]`;
|
|
1364
1437
|
await this.retain(content, context, markerId, tags, "document", {
|
|
@@ -1392,6 +1465,24 @@ var PENDING_MAX_BYTES = 256 * 1024;
|
|
|
1392
1465
|
|
|
1393
1466
|
// src/core/uuid.ts
|
|
1394
1467
|
import { createHash as createHash3 } from "crypto";
|
|
1468
|
+
var HINDSIGHT_NAMESPACE = "e75686a4-e923-4326-a0d1-358f1c6c3eb4";
|
|
1469
|
+
function uuidV5(name, namespace = HINDSIGHT_NAMESPACE) {
|
|
1470
|
+
const ns = Buffer.from(namespace.replace(/-/g, ""), "hex");
|
|
1471
|
+
if (ns.length !== 16) throw new Error(`invalid UUID namespace: ${namespace}`);
|
|
1472
|
+
const bytes = Buffer.from(
|
|
1473
|
+
createHash3("sha1").update(ns).update(Buffer.from(name, "utf8")).digest().subarray(0, 16)
|
|
1474
|
+
);
|
|
1475
|
+
bytes[6] = bytes[6] & 15 | 80;
|
|
1476
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
1477
|
+
const hex = bytes.toString("hex");
|
|
1478
|
+
return [
|
|
1479
|
+
hex.slice(0, 8),
|
|
1480
|
+
hex.slice(8, 12),
|
|
1481
|
+
hex.slice(12, 16),
|
|
1482
|
+
hex.slice(16, 20),
|
|
1483
|
+
hex.slice(20)
|
|
1484
|
+
].join("-");
|
|
1485
|
+
}
|
|
1395
1486
|
|
|
1396
1487
|
// src/core/chat.ts
|
|
1397
1488
|
function withRefId(refId, turns, baseTs) {
|
|
@@ -1453,7 +1544,7 @@ async function ingestChats(client, sessions, opts = {}) {
|
|
|
1453
1544
|
}
|
|
1454
1545
|
|
|
1455
1546
|
// src/core/config.ts
|
|
1456
|
-
import { readFileSync as
|
|
1547
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
1457
1548
|
import { homedir as homedir3 } from "os";
|
|
1458
1549
|
import { join as join7 } from "path";
|
|
1459
1550
|
|
|
@@ -1673,7 +1764,7 @@ function resolveConfig(raw = {}) {
|
|
|
1673
1764
|
}
|
|
1674
1765
|
function readRaw(path) {
|
|
1675
1766
|
try {
|
|
1676
|
-
return JSON.parse(
|
|
1767
|
+
return JSON.parse(readFileSync3(path, "utf8"));
|
|
1677
1768
|
} catch (e) {
|
|
1678
1769
|
if (e?.code !== "ENOENT") {
|
|
1679
1770
|
console.error(`hindsight: ignoring invalid config at ${path}: ${e?.message || e}`);
|
|
@@ -1860,8 +1951,10 @@ import { resolve as resolve2 } from "path";
|
|
|
1860
1951
|
var US = "";
|
|
1861
1952
|
var RS = "";
|
|
1862
1953
|
var GITLOG_HEAD = "gitlog-head:";
|
|
1954
|
+
var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
|
|
1955
|
+
var GITLOG_DIVIDER = "\n\n---\n\n";
|
|
1863
1956
|
function git(repo, ...args) {
|
|
1864
|
-
return execFileSync("git", ["-C", repo, ...args], {
|
|
1957
|
+
return execFileSync("git", ["-C", repo, "-c", "log.showSignature=false", ...args], {
|
|
1865
1958
|
encoding: "utf8",
|
|
1866
1959
|
maxBuffer: 1 << 28,
|
|
1867
1960
|
windowsHide: true,
|
|
@@ -1934,25 +2027,56 @@ ${diff}`;
|
|
|
1934
2027
|
function gitLogText(repo, limit) {
|
|
1935
2028
|
let raw;
|
|
1936
2029
|
try {
|
|
2030
|
+
const total = Number(git(repo, "rev-list", "--count", "--no-merges", "HEAD").trim());
|
|
2031
|
+
const step = Math.max(1, Math.ceil(limit / 2));
|
|
2032
|
+
const start = total > limit ? Math.ceil((total - limit) / step) * step : 0;
|
|
1937
2033
|
raw = git(
|
|
1938
2034
|
repo,
|
|
1939
2035
|
"log",
|
|
1940
2036
|
`-n`,
|
|
1941
|
-
String(
|
|
2037
|
+
String(total - start),
|
|
1942
2038
|
"--no-merges",
|
|
2039
|
+
"--reverse",
|
|
2040
|
+
// applied after -n: the newest N, printed oldest first
|
|
1943
2041
|
"--date=short",
|
|
1944
|
-
|
|
2042
|
+
GITLOG_FORMAT
|
|
1945
2043
|
);
|
|
1946
2044
|
} catch {
|
|
1947
2045
|
return "";
|
|
1948
2046
|
}
|
|
2047
|
+
return gitLogRecords(raw).join(GITLOG_DIVIDER);
|
|
2048
|
+
}
|
|
2049
|
+
function gitLogRecords(raw) {
|
|
1949
2050
|
return raw.split(RS).map((rec) => rec.trim()).filter(Boolean).map((rec) => {
|
|
1950
2051
|
const [sha, date, author, subj, body] = rec.split(US);
|
|
1951
2052
|
const header = `${sha} ${date} ${author}`;
|
|
1952
2053
|
const msg = subj + (body?.trim() ? "\n\n" + body.trim() : "");
|
|
1953
2054
|
return `${header}
|
|
1954
2055
|
${msg}`;
|
|
1955
|
-
})
|
|
2056
|
+
});
|
|
2057
|
+
}
|
|
2058
|
+
function gitLogRecordsSince(repo, baseSha, head) {
|
|
2059
|
+
if (!/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/.test(baseSha)) return null;
|
|
2060
|
+
try {
|
|
2061
|
+
git(repo, "merge-base", "--is-ancestor", baseSha, head);
|
|
2062
|
+
} catch {
|
|
2063
|
+
return null;
|
|
2064
|
+
}
|
|
2065
|
+
try {
|
|
2066
|
+
return gitLogRecords(
|
|
2067
|
+
git(
|
|
2068
|
+
repo,
|
|
2069
|
+
"log",
|
|
2070
|
+
"--no-merges",
|
|
2071
|
+
"--reverse",
|
|
2072
|
+
"--date=short",
|
|
2073
|
+
GITLOG_FORMAT,
|
|
2074
|
+
`${baseSha}..${head}`
|
|
2075
|
+
)
|
|
2076
|
+
);
|
|
2077
|
+
} catch {
|
|
2078
|
+
return null;
|
|
2079
|
+
}
|
|
1956
2080
|
}
|
|
1957
2081
|
function gitLogNewestAuthorDate(repo) {
|
|
1958
2082
|
try {
|
|
@@ -1961,44 +2085,50 @@ function gitLogNewestAuthorDate(repo) {
|
|
|
1961
2085
|
return null;
|
|
1962
2086
|
}
|
|
1963
2087
|
}
|
|
2088
|
+
async function retainGitLog(client, repo, content, opts, head, append) {
|
|
2089
|
+
const repoName = repoNameOf(repo);
|
|
2090
|
+
const stamp = opts.stampFor?.();
|
|
2091
|
+
const tags = [
|
|
2092
|
+
.../* @__PURE__ */ new Set([
|
|
2093
|
+
...stamp?.tags ?? [],
|
|
2094
|
+
"source:git",
|
|
2095
|
+
"source:git-log",
|
|
2096
|
+
...head ? [`${GITLOG_HEAD}${head}`] : []
|
|
2097
|
+
])
|
|
2098
|
+
];
|
|
2099
|
+
await client.retain(
|
|
2100
|
+
content,
|
|
2101
|
+
// No commit count: an append makes the document longer than any count a replace wrote.
|
|
2102
|
+
`git commit-message history for ${repoName}`,
|
|
2103
|
+
`gitlog:${repoName}`,
|
|
2104
|
+
tags,
|
|
2105
|
+
"gitlog",
|
|
2106
|
+
{
|
|
2107
|
+
// Anchor the document in time on the newest commit it contains, so extraction can date the
|
|
2108
|
+
// facts it pulls out of these messages. Previously no timestamp was passed at all: retain
|
|
2109
|
+
// then stamped "now", the extraction prompt got `Event Date: Unknown`, and every fact landed
|
|
2110
|
+
// with a null occurred_start/occurred_end — invisible to temporal search (#3602).
|
|
2111
|
+
timestamp: gitLogNewestAuthorDate(repo) ?? void 0,
|
|
2112
|
+
// `retain` only sets metadata when it is truthy, so an empty stamp sends none.
|
|
2113
|
+
metadata: Object.keys(stamp?.metadata ?? {}).length ? stamp?.metadata : void 0,
|
|
2114
|
+
...append ? { updateMode: "append", operationId: append.operationId } : {}
|
|
2115
|
+
}
|
|
2116
|
+
);
|
|
2117
|
+
}
|
|
1964
2118
|
async function ingestGitLog(client, repo, opts = { limit: 300 }) {
|
|
1965
2119
|
const log3 = opts.log ?? (() => {
|
|
1966
2120
|
});
|
|
2121
|
+
const head = gitHeadSha(repo);
|
|
1967
2122
|
const text = gitLogText(repo, opts.limit);
|
|
1968
2123
|
if (!text) {
|
|
1969
2124
|
log3("[gitlog] no commits found \u2014 skipping");
|
|
1970
2125
|
return 0;
|
|
1971
2126
|
}
|
|
1972
2127
|
const repoName = repoNameOf(repo);
|
|
1973
|
-
const n = text.split(
|
|
2128
|
+
const n = text.split(GITLOG_DIVIDER).length;
|
|
1974
2129
|
log3(`[gitlog] ingesting last ${n} commit messages for ${repoName} as ONE document \u2026`);
|
|
1975
2130
|
try {
|
|
1976
|
-
|
|
1977
|
-
const stamp = opts.stampFor?.();
|
|
1978
|
-
const tags = [
|
|
1979
|
-
.../* @__PURE__ */ new Set([
|
|
1980
|
-
...stamp?.tags ?? [],
|
|
1981
|
-
"source:git",
|
|
1982
|
-
"source:git-log",
|
|
1983
|
-
...head ? [`${GITLOG_HEAD}${head}`] : []
|
|
1984
|
-
])
|
|
1985
|
-
];
|
|
1986
|
-
await client.retain(
|
|
1987
|
-
text,
|
|
1988
|
-
`git commit-message history (last ${n}) for ${repoName}`,
|
|
1989
|
-
`gitlog:${repoName}`,
|
|
1990
|
-
tags,
|
|
1991
|
-
"gitlog",
|
|
1992
|
-
{
|
|
1993
|
-
// Anchor the document in time on the newest commit it contains, so extraction can date the
|
|
1994
|
-
// facts it pulls out of these messages. Previously no timestamp was passed at all: retain
|
|
1995
|
-
// then stamped "now", the extraction prompt got `Event Date: Unknown`, and every fact landed
|
|
1996
|
-
// with a null occurred_start/occurred_end — invisible to temporal search (#3602).
|
|
1997
|
-
timestamp: gitLogNewestAuthorDate(repo) ?? void 0,
|
|
1998
|
-
// `retain` only sets metadata when it is truthy, so an empty stamp sends none.
|
|
1999
|
-
metadata: Object.keys(stamp?.metadata ?? {}).length ? stamp?.metadata : void 0
|
|
2000
|
-
}
|
|
2001
|
-
);
|
|
2131
|
+
await retainGitLog(client, repo, text, opts, head);
|
|
2002
2132
|
log3(`[gitlog] done: ${n} commit messages ingested as 1 document under strategy 'gitlog'`);
|
|
2003
2133
|
return 0;
|
|
2004
2134
|
} catch (e) {
|
|
@@ -2006,6 +2136,36 @@ async function ingestGitLog(client, repo, opts = { limit: 300 }) {
|
|
|
2006
2136
|
return 1;
|
|
2007
2137
|
}
|
|
2008
2138
|
}
|
|
2139
|
+
async function appendGitLog(client, repo, opts, head) {
|
|
2140
|
+
const log3 = opts.log ?? (() => {
|
|
2141
|
+
});
|
|
2142
|
+
const canonical2 = `gitlog:${repoNameOf(repo)}`;
|
|
2143
|
+
const tags = await client.documentTags?.(canonical2).catch(() => void 0);
|
|
2144
|
+
const base = tags?.find((t) => t.startsWith(GITLOG_HEAD))?.slice(GITLOG_HEAD.length);
|
|
2145
|
+
if (!base) return null;
|
|
2146
|
+
const records = gitLogRecordsSince(repo, base, head);
|
|
2147
|
+
if (records === null || records.length > opts.limit) return null;
|
|
2148
|
+
if (!records.length) {
|
|
2149
|
+
log3("[gitlog] no new non-merge commits \u2014 skipping");
|
|
2150
|
+
return 0;
|
|
2151
|
+
}
|
|
2152
|
+
const appendable = await client.supportsAppendRetain?.().catch(() => false);
|
|
2153
|
+
if (!appendable) return null;
|
|
2154
|
+
const content = GITLOG_DIVIDER.slice(1) + records.join(GITLOG_DIVIDER);
|
|
2155
|
+
const operationId = uuidV5(`${client.bank}
|
|
2156
|
+
${canonical2}
|
|
2157
|
+
append
|
|
2158
|
+
${base}
|
|
2159
|
+
${content}`);
|
|
2160
|
+
log3(`[gitlog] appending ${records.length} new commit message(s) to ${canonical2} \u2026`);
|
|
2161
|
+
try {
|
|
2162
|
+
await retainGitLog(client, repo, content, opts, head, { operationId });
|
|
2163
|
+
return 0;
|
|
2164
|
+
} catch (e) {
|
|
2165
|
+
log3(` ! gitlog append failed: ${e.message?.slice(0, 120)}`);
|
|
2166
|
+
return 1;
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2009
2169
|
async function gitLogIsCurrent(client, repo, head) {
|
|
2010
2170
|
const canonical2 = `gitlog:${repoNameOf(repo)}`;
|
|
2011
2171
|
if ((await client.listDocumentIds(`${GITLOG_HEAD}${head}`, "all_strict")).has(canonical2))
|
|
@@ -2024,11 +2184,11 @@ async function syncGitLog(client, repo, opts) {
|
|
|
2024
2184
|
log3("[gitlog] current with HEAD \u2014 skipping");
|
|
2025
2185
|
return 0;
|
|
2026
2186
|
}
|
|
2027
|
-
return ingestGitLog(client, repo, opts);
|
|
2187
|
+
return (head ? await appendGitLog(client, repo, opts, head) : null) ?? ingestGitLog(client, repo, opts);
|
|
2028
2188
|
}
|
|
2029
2189
|
|
|
2030
2190
|
// src/core/survey.ts
|
|
2031
|
-
import { spawn as realSpawn3 } from "child_process";
|
|
2191
|
+
import { execFileSync as execFileSync2, spawn as realSpawn3 } from "child_process";
|
|
2032
2192
|
import { createHash as createHash4 } from "crypto";
|
|
2033
2193
|
import { existsSync as existsSync2 } from "fs";
|
|
2034
2194
|
import { homedir as homedir4, tmpdir } from "os";
|
|
@@ -2125,16 +2285,16 @@ var SURVEY_DOC_IDS = [
|
|
|
2125
2285
|
];
|
|
2126
2286
|
|
|
2127
2287
|
// src/core/status.ts
|
|
2128
|
-
import { execFileSync as
|
|
2288
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
2129
2289
|
var DEEPEN_DIFF_TARGET = 300;
|
|
2130
2290
|
|
|
2131
2291
|
// src/harness/registry.ts
|
|
2132
|
-
import { readFileSync as
|
|
2292
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
2133
2293
|
var jsonChatReader = (harness) => ({
|
|
2134
2294
|
describe: `${harness} sessions via a normalized JSON export (--conversations file: [{ id, turns:[{role,text,timestamp?}] }])`,
|
|
2135
2295
|
async read(opts) {
|
|
2136
2296
|
if (!opts.conversations) return [];
|
|
2137
|
-
return JSON.parse(
|
|
2297
|
+
return JSON.parse(readFileSync4(opts.conversations, "utf8"));
|
|
2138
2298
|
}
|
|
2139
2299
|
});
|
|
2140
2300
|
var noRuntimeAdapter = (name, hint) => ({
|
|
@@ -2178,7 +2338,15 @@ var HARNESS_NAMES = [
|
|
|
2178
2338
|
"zcode",
|
|
2179
2339
|
// TraeCode is a per-prompt HOOK host registered in ~/.trae-cn/hooks.json (see src/installer.ts).
|
|
2180
2340
|
"traecode",
|
|
2181
|
-
"kimi-code"
|
|
2341
|
+
"kimi-code",
|
|
2342
|
+
// WorkBuddy is a per-prompt HOOK host too: the installer wires ~/.workbuddy/settings.json and
|
|
2343
|
+
// the stdio MCP registration in ~/.workbuddy/mcp.json (see src/installer.ts).
|
|
2344
|
+
"workbuddy",
|
|
2345
|
+
// CodeBuddy Code is the SAME @genie/agent-cli HOOK host, one product config apart (WorkBuddy only
|
|
2346
|
+
// renames the home folder): the installer wires ~/.codebuddy/settings.json and the stdio MCP
|
|
2347
|
+
// registration in CodeBuddy's priority-chained MCP file (see src/installer.ts). The CLI
|
|
2348
|
+
// writes WorkBuddy's transcript format; the CodeBuddy IDE has a reader of its own.
|
|
2349
|
+
"codebuddy"
|
|
2182
2350
|
];
|
|
2183
2351
|
var HOOK_BINS = {
|
|
2184
2352
|
"claude-code": "hindsight-claude-hook",
|
|
@@ -2193,7 +2361,9 @@ var HOOK_BINS = {
|
|
|
2193
2361
|
"factory-droid": "hindsight-droid-hook",
|
|
2194
2362
|
zcode: "hindsight-zcode-hook",
|
|
2195
2363
|
traecode: "hindsight-traecode-hook",
|
|
2196
|
-
"kimi-code": "hindsight-kimi-hook"
|
|
2364
|
+
"kimi-code": "hindsight-kimi-hook",
|
|
2365
|
+
workbuddy: "hindsight-workbuddy-hook",
|
|
2366
|
+
codebuddy: "hindsight-codebuddy-hook"
|
|
2197
2367
|
// more hook harnesses: add a HookSpec entry point (see src/cursor-hook.ts) + a registration here.
|
|
2198
2368
|
};
|
|
2199
2369
|
var PLUGIN_ENTRYPOINTS = {
|
|
@@ -2335,10 +2505,13 @@ async function main() {
|
|
|
2335
2505
|
// outlive the session, so a bank several repos share must not be told it is whichever one
|
|
2336
2506
|
// ran last (#4146). `bankProjectName` answers only when the bank IS this repo's; the
|
|
2337
2507
|
// `banks.<id>.bank` rename below it can point many repos at one destination, so a renamed
|
|
2338
|
-
// bank is not this repo's either. Undefined
|
|
2508
|
+
// bank is not this repo's either. Undefined gives the shared-bank scope (#4490).
|
|
2339
2509
|
project: PAGE_PROJECT,
|
|
2340
2510
|
maxParallelRetains: cfg.maxParallelRetains,
|
|
2341
2511
|
observationScopes: cfg.observationScopes,
|
|
2512
|
+
// Nobody waits on a background seed, and a 429 it gives up on is history missing from the
|
|
2513
|
+
// bank until some later session happens to re-run it.
|
|
2514
|
+
rateLimitPatienceMs: 10 * 60 * 1e3,
|
|
2342
2515
|
log: log2
|
|
2343
2516
|
});
|
|
2344
2517
|
log2(`deepen -> ${client.apiUrl} bank=${FINAL_BANK} harness=${harness.name}`);
|
|
@@ -2387,7 +2560,7 @@ async function main() {
|
|
|
2387
2560
|
gitFails += await syncGitLog(client, REPO, { limit: GITLOG_LIMIT, log: log2, stampFor });
|
|
2388
2561
|
if (GIT_INGEST === "full") {
|
|
2389
2562
|
try {
|
|
2390
|
-
const shas =
|
|
2563
|
+
const shas = execFileSync4(
|
|
2391
2564
|
"git",
|
|
2392
2565
|
["-C", REPO, "rev-list", `-n`, String(DEEPEN_DIFF_TARGET), "HEAD"],
|
|
2393
2566
|
// `install` runs this with inherited stdio: an empty repo's HEAD error must not print.
|