@vectorize-io/hindsight-coding-agents 0.8.1 → 0.8.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 +19 -5
- package/dist/antigravity-hook.js +98 -42
- package/dist/antigravity-statusline.js +6 -6
- package/dist/antigravity-stop-hook.js +135 -51
- package/dist/claude-hook.js +98 -42
- package/dist/claude-sessionstart-hook.js +386 -99
- package/dist/claude-stop-hook.js +135 -51
- package/dist/cline.js +433 -118
- package/dist/codebuddy-hook.js +98 -42
- package/dist/codebuddy-sessionstart-hook.js +386 -99
- package/dist/codebuddy-stop-hook.js +135 -51
- package/dist/codex-hook.js +98 -42
- package/dist/codex-sessionstart-hook.js +386 -99
- package/dist/codex-stop-hook.js +135 -51
- package/dist/copilot-hook.js +98 -42
- package/dist/copilot-sessionstart-hook.js +386 -99
- package/dist/copilot-stop-hook.js +135 -51
- package/dist/cursor-hook.js +98 -42
- package/dist/cursor-sessionstart-hook.js +386 -99
- package/dist/cursor-stop-hook.js +135 -51
- package/dist/daemon-start.js +10 -10
- package/dist/dcode-hook.js +98 -42
- package/dist/dcode-sessionstart-hook.js +386 -99
- package/dist/dcode-stop-hook.js +135 -51
- package/dist/deepen.js +193 -52
- package/dist/devin-hook.js +98 -42
- package/dist/devin-sessionstart-hook.js +386 -99
- package/dist/devin-stop-hook.js +135 -51
- package/dist/droid-hook.js +98 -42
- package/dist/droid-sessionstart-hook.js +386 -99
- package/dist/droid-stop-hook.js +135 -51
- package/dist/dsh.js +452 -125
- package/dist/grok-hook.js +98 -42
- package/dist/grok-sessionstart-hook.js +386 -99
- package/dist/grok-stop-hook.js +135 -51
- package/dist/hindsight-seed.js +6 -6
- package/dist/index.js +457 -137
- package/dist/installer.js +92 -80
- package/dist/kilo.js +457 -137
- package/dist/kimi-hook.js +98 -42
- package/dist/kimi-sessionstart-hook.js +386 -99
- package/dist/kimi-stop-hook.js +135 -51
- package/dist/mcp-server.js +180 -65
- package/dist/opencode2.js +613 -131
- package/dist/pi.js +433 -125
- package/dist/prime-agent.js +433 -125
- package/dist/qwen-hook.js +98 -42
- package/dist/qwen-sessionstart-hook.js +386 -99
- package/dist/qwen-stop-hook.js +135 -51
- package/dist/status.js +76 -18
- package/dist/survey-supervisor.js +73 -9
- package/dist/traecode-hook.js +98 -42
- package/dist/traecode-sessionstart-hook.js +386 -99
- package/dist/traecode-stop-hook.js +135 -51
- package/dist/workbuddy-hook.js +98 -42
- package/dist/workbuddy-sessionstart-hook.js +386 -99
- package/dist/workbuddy-stop-hook.js +135 -51
- package/dist/zcode-hook.js +98 -42
- package/dist/zcode-sessionstart-hook.js +386 -99
- package/dist/zcode-stop-hook.js +135 -51
- package/index.js +4 -1
- package/package.json +6 -4
- package/plugin.json +1 -1
- package/skill/SKILL.md +16 -4
package/dist/index.js
CHANGED
|
@@ -228,14 +228,14 @@ function probeGitLayout(directory) {
|
|
|
228
228
|
var PLACEHOLDER = /\{([a-zA-Z_]+)\}/g;
|
|
229
229
|
function applyTemplate(template, resolvers, what) {
|
|
230
230
|
return template.replace(PLACEHOLDER, (_, name) => {
|
|
231
|
-
const
|
|
232
|
-
if (!
|
|
231
|
+
const resolve4 = resolvers[name];
|
|
232
|
+
if (!resolve4) {
|
|
233
233
|
console.error(
|
|
234
234
|
`hindsight: unknown ${what} placeholder "{${name}}" \u2014 valid: ` + Object.keys(resolvers).sort().map((k) => `{${k}}`).join(", ")
|
|
235
235
|
);
|
|
236
236
|
return "unknown";
|
|
237
237
|
}
|
|
238
|
-
return
|
|
238
|
+
return resolve4();
|
|
239
239
|
});
|
|
240
240
|
}
|
|
241
241
|
|
|
@@ -656,29 +656,33 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
|
|
|
656
656
|
}
|
|
657
657
|
|
|
658
658
|
// package.json
|
|
659
|
-
var version = "0.8.
|
|
659
|
+
var version = "0.8.3";
|
|
660
660
|
|
|
661
661
|
// src/core/util.ts
|
|
662
|
-
import { accessSync, constants } from "fs";
|
|
663
|
-
import { delimiter, join as join6 } from "path";
|
|
664
|
-
function binOnPath(bin) {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
662
|
+
import { accessSync, constants, statSync as statSync2 } from "fs";
|
|
663
|
+
import { delimiter, extname, isAbsolute as isAbsolute2, join as join6, resolve as resolve2 } from "path";
|
|
664
|
+
function binOnPath(bin, opts = {}) {
|
|
665
|
+
const platform = opts.platform ?? process.platform;
|
|
666
|
+
const env = opts.env ?? process.env;
|
|
667
|
+
const runnable = (file3) => {
|
|
668
|
+
try {
|
|
669
|
+
if (!statSync2(file3).isFile()) return false;
|
|
670
|
+
if (platform !== "win32") accessSync(file3, constants.X_OK);
|
|
668
671
|
return true;
|
|
672
|
+
} catch {
|
|
673
|
+
return false;
|
|
669
674
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
675
|
+
};
|
|
676
|
+
if (isAbsolute2(bin) || /[\\/]/.test(bin)) return runnable(bin) ? resolve2(bin) : void 0;
|
|
677
|
+
const names = platform !== "win32" || extname(bin) ? [bin] : (opts.exts ?? (env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";")).filter(Boolean).map((ext) => bin + ext.toLowerCase());
|
|
678
|
+
for (const dir of (env.PATH || "").split(delimiter)) {
|
|
679
|
+
if (!dir) continue;
|
|
680
|
+
for (const name of names) {
|
|
681
|
+
const file3 = join6(dir, name);
|
|
682
|
+
if (runnable(file3)) return resolve2(file3);
|
|
677
683
|
}
|
|
678
|
-
return false;
|
|
679
|
-
} catch {
|
|
680
|
-
return false;
|
|
681
684
|
}
|
|
685
|
+
return void 0;
|
|
682
686
|
}
|
|
683
687
|
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
684
688
|
function semverGte(version4, min) {
|
|
@@ -948,15 +952,19 @@ var HindsightClient = class {
|
|
|
948
952
|
}
|
|
949
953
|
/**
|
|
950
954
|
* Whether this server honours `operation_id` on an async retain, and can therefore be appended to
|
|
951
|
-
* safely (see MIN_IDEMPOTENT_RETAIN_VERSION). Probed
|
|
955
|
+
* safely (see MIN_IDEMPOTENT_RETAIN_VERSION). Probed via the version endpoint; anything
|
|
952
956
|
* unreachable, unparseable or older answers "no", which costs efficiency, never correctness.
|
|
957
|
+
* Only a "yes" is cached: a long-lived plugin client would otherwise keep replacing for the rest
|
|
958
|
+
* of the process after one probe that hit a restarting server (#5735).
|
|
953
959
|
*/
|
|
954
960
|
async supportsIdempotentRetain() {
|
|
955
|
-
if (this.idempotentRetain
|
|
956
|
-
|
|
957
|
-
|
|
961
|
+
if (this.idempotentRetain) return true;
|
|
962
|
+
const supported = await this.probeIdempotentRetain();
|
|
963
|
+
if (supported || this.idempotentRetain === void 0) {
|
|
964
|
+
this.log(`server retain idempotency: ${supported ? "supported" : "unavailable"}`);
|
|
958
965
|
}
|
|
959
|
-
|
|
966
|
+
this.idempotentRetain = supported;
|
|
967
|
+
return supported;
|
|
960
968
|
}
|
|
961
969
|
/** `/v1/version` first: an ingress that routes only `/v1` to the API (the Helm chart's default)
|
|
962
970
|
* hands a bare `/version` to the control plane, whose HTML 404 or login redirect read as "no",
|
|
@@ -1990,15 +1998,15 @@ function stagedVersion(pkgRoot) {
|
|
|
1990
1998
|
}
|
|
1991
1999
|
}
|
|
1992
2000
|
function isNewer(candidate, current2) {
|
|
1993
|
-
const
|
|
2001
|
+
const parse6 = (v) => {
|
|
1994
2002
|
const [core = "", ...rest] = v.trim().split("-");
|
|
1995
2003
|
return {
|
|
1996
2004
|
nums: core.split(".").map((n) => Number.parseInt(n, 10)),
|
|
1997
2005
|
pre: rest.length > 0
|
|
1998
2006
|
};
|
|
1999
2007
|
};
|
|
2000
|
-
const a =
|
|
2001
|
-
const b =
|
|
2008
|
+
const a = parse6(candidate);
|
|
2009
|
+
const b = parse6(current2);
|
|
2002
2010
|
if (a.nums.length !== 3 || b.nums.length !== 3) return false;
|
|
2003
2011
|
if (a.nums.some(Number.isNaN) || b.nums.some(Number.isNaN)) return false;
|
|
2004
2012
|
for (let i = 0; i < 3; i++) {
|
|
@@ -2075,7 +2083,7 @@ function spawnNpm(spawnImpl, bin, args, opts) {
|
|
|
2075
2083
|
return process.platform === "win32" ? spawnImpl([bin, ...args].join(" "), { ...opts, shell: true }) : spawnImpl(bin, args, opts);
|
|
2076
2084
|
}
|
|
2077
2085
|
async function npmViewVersion(pkg, spawnImpl = realSpawn2) {
|
|
2078
|
-
return new Promise((
|
|
2086
|
+
return new Promise((resolve4) => {
|
|
2079
2087
|
let out = "";
|
|
2080
2088
|
let settled = false;
|
|
2081
2089
|
let deadline;
|
|
@@ -2084,7 +2092,7 @@ async function npmViewVersion(pkg, spawnImpl = realSpawn2) {
|
|
|
2084
2092
|
settled = true;
|
|
2085
2093
|
if (deadline) clearTimeout(deadline);
|
|
2086
2094
|
if (reason) log.info("auto-update", `version check failed: ${reason}`);
|
|
2087
|
-
|
|
2095
|
+
resolve4(v);
|
|
2088
2096
|
};
|
|
2089
2097
|
try {
|
|
2090
2098
|
const child = spawnNpm(spawnImpl, "npm", ["view", pkg, "version", "--json"], {
|
|
@@ -2281,8 +2289,8 @@ async function waitBounded(p, ms) {
|
|
|
2281
2289
|
try {
|
|
2282
2290
|
await Promise.race([
|
|
2283
2291
|
p,
|
|
2284
|
-
new Promise((
|
|
2285
|
-
timer = setTimeout(
|
|
2292
|
+
new Promise((resolve4) => {
|
|
2293
|
+
timer = setTimeout(resolve4, Math.max(ms, 0));
|
|
2286
2294
|
})
|
|
2287
2295
|
]);
|
|
2288
2296
|
} finally {
|
|
@@ -16917,7 +16925,7 @@ function date4(params) {
|
|
|
16917
16925
|
config(en_default());
|
|
16918
16926
|
|
|
16919
16927
|
// src/core/knowledge-tools.ts
|
|
16920
|
-
import { createHash as
|
|
16928
|
+
import { createHash as createHash4 } from "crypto";
|
|
16921
16929
|
import { existsSync as existsSync4 } from "fs";
|
|
16922
16930
|
import { homedir as homedir6 } from "os";
|
|
16923
16931
|
import { join as join12 } from "path";
|
|
@@ -16927,20 +16935,53 @@ import { execFileSync as execFileSync4 } from "child_process";
|
|
|
16927
16935
|
|
|
16928
16936
|
// src/core/git.ts
|
|
16929
16937
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
16930
|
-
import { resolve as
|
|
16938
|
+
import { resolve as resolve3 } from "path";
|
|
16939
|
+
|
|
16940
|
+
// src/core/uuid.ts
|
|
16941
|
+
import { createHash as createHash2 } from "crypto";
|
|
16942
|
+
var HINDSIGHT_NAMESPACE = "e75686a4-e923-4326-a0d1-358f1c6c3eb4";
|
|
16943
|
+
function uuidV5(name, namespace = HINDSIGHT_NAMESPACE) {
|
|
16944
|
+
const ns = Buffer.from(namespace.replace(/-/g, ""), "hex");
|
|
16945
|
+
if (ns.length !== 16) throw new Error(`invalid UUID namespace: ${namespace}`);
|
|
16946
|
+
const bytes = Buffer.from(
|
|
16947
|
+
createHash2("sha1").update(ns).update(Buffer.from(name, "utf8")).digest().subarray(0, 16)
|
|
16948
|
+
);
|
|
16949
|
+
bytes[6] = bytes[6] & 15 | 80;
|
|
16950
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
16951
|
+
const hex5 = bytes.toString("hex");
|
|
16952
|
+
return [
|
|
16953
|
+
hex5.slice(0, 8),
|
|
16954
|
+
hex5.slice(8, 12),
|
|
16955
|
+
hex5.slice(12, 16),
|
|
16956
|
+
hex5.slice(16, 20),
|
|
16957
|
+
hex5.slice(20)
|
|
16958
|
+
].join("-");
|
|
16959
|
+
}
|
|
16960
|
+
|
|
16961
|
+
// src/core/git.ts
|
|
16962
|
+
var US = "";
|
|
16963
|
+
var RS = "";
|
|
16931
16964
|
var GITLOG_HEAD = "gitlog-head:";
|
|
16932
|
-
|
|
16965
|
+
var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
|
|
16966
|
+
function runGit(repo, args, env) {
|
|
16933
16967
|
return execFileSync2("git", ["-C", repo, "-c", "log.showSignature=false", ...args], {
|
|
16934
16968
|
encoding: "utf8",
|
|
16935
16969
|
maxBuffer: 1 << 28,
|
|
16936
16970
|
windowsHide: true,
|
|
16971
|
+
env,
|
|
16937
16972
|
// execFileSync otherwise forwards failed git stderr into the host's TUI,
|
|
16938
16973
|
// even when callers catch the error. Keep diagnostics on the error instead.
|
|
16939
16974
|
stdio: ["ignore", "pipe", "pipe"]
|
|
16940
16975
|
});
|
|
16941
16976
|
}
|
|
16977
|
+
function git(repo, ...args) {
|
|
16978
|
+
return runGit(repo, args);
|
|
16979
|
+
}
|
|
16980
|
+
function gitLocal(repo, ...args) {
|
|
16981
|
+
return runGit(repo, args, { ...process.env, GIT_NO_LAZY_FETCH: "1" });
|
|
16982
|
+
}
|
|
16942
16983
|
function repoNameOf(repo) {
|
|
16943
|
-
return projectNameOf(
|
|
16984
|
+
return projectNameOf(resolve3(repo));
|
|
16944
16985
|
}
|
|
16945
16986
|
function gitHeadSha(dir) {
|
|
16946
16987
|
try {
|
|
@@ -16952,7 +16993,7 @@ function gitHeadSha(dir) {
|
|
|
16952
16993
|
function commitsSince(dir, sinceSha) {
|
|
16953
16994
|
if (!/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/.test(sinceSha)) return null;
|
|
16954
16995
|
try {
|
|
16955
|
-
const n = Number.parseInt(
|
|
16996
|
+
const n = Number.parseInt(gitLocal(dir, "rev-list", "--count", `${sinceSha}..HEAD`).trim(), 10);
|
|
16956
16997
|
return Number.isFinite(n) ? n : null;
|
|
16957
16998
|
} catch {
|
|
16958
16999
|
return null;
|
|
@@ -16977,12 +17018,198 @@ async function gitLogIsCurrent(client, repo, head) {
|
|
|
16977
17018
|
|
|
16978
17019
|
// src/core/survey.ts
|
|
16979
17020
|
import { execFileSync as execFileSync3, spawn as realSpawn5 } from "child_process";
|
|
16980
|
-
import { createHash as
|
|
16981
|
-
import { existsSync as existsSync3 } from "fs";
|
|
17021
|
+
import { createHash as createHash3 } from "crypto";
|
|
17022
|
+
import { existsSync as existsSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
16982
17023
|
import { homedir as homedir5, tmpdir as tmpdir2 } from "os";
|
|
16983
17024
|
import { dirname as dirname7, join as join11 } from "path";
|
|
16984
17025
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
16985
17026
|
|
|
17027
|
+
// node_modules/smol-toml/dist/stringify.js
|
|
17028
|
+
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
17029
|
+
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
17030
|
+
function extendedTypeOf(obj) {
|
|
17031
|
+
let type = typeof obj;
|
|
17032
|
+
if (type === "object") {
|
|
17033
|
+
if (Array.isArray(obj))
|
|
17034
|
+
return "array";
|
|
17035
|
+
if (typeof obj.getUTCDate === "function" && obj instanceof Date)
|
|
17036
|
+
return "date";
|
|
17037
|
+
if (globalThis.Temporal) {
|
|
17038
|
+
if (obj.until) {
|
|
17039
|
+
if (obj instanceof Temporal.ZonedDateTime)
|
|
17040
|
+
return "temporal/tz+uc";
|
|
17041
|
+
if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate)
|
|
17042
|
+
return "temporal/uc";
|
|
17043
|
+
if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant)
|
|
17044
|
+
return "temporal";
|
|
17045
|
+
if (obj instanceof Temporal.PlainYearMonth)
|
|
17046
|
+
return "temporal/x";
|
|
17047
|
+
} else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) {
|
|
17048
|
+
return "temporal/x";
|
|
17049
|
+
}
|
|
17050
|
+
}
|
|
17051
|
+
}
|
|
17052
|
+
return type;
|
|
17053
|
+
}
|
|
17054
|
+
function isArrayOfTables(obj) {
|
|
17055
|
+
for (let i = 0; i < obj.length; i++) {
|
|
17056
|
+
if (extendedTypeOf(obj[i]) !== "object")
|
|
17057
|
+
return false;
|
|
17058
|
+
}
|
|
17059
|
+
return obj.length != 0;
|
|
17060
|
+
}
|
|
17061
|
+
function formatWellFormedStringUnchecked(s) {
|
|
17062
|
+
return JSON.stringify(s).replaceAll("\x7F", "\\u007f");
|
|
17063
|
+
}
|
|
17064
|
+
function formatString(s) {
|
|
17065
|
+
return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
|
|
17066
|
+
}
|
|
17067
|
+
function formatKey(s) {
|
|
17068
|
+
if (BARE_KEY.test(s))
|
|
17069
|
+
return s;
|
|
17070
|
+
if (HAS_WELLFORMED && !s.isWellFormed())
|
|
17071
|
+
throw new RangeError("key contains illegal lone surrogates");
|
|
17072
|
+
return formatWellFormedStringUnchecked(s);
|
|
17073
|
+
}
|
|
17074
|
+
function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
|
|
17075
|
+
if (depth === 0) {
|
|
17076
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
17077
|
+
}
|
|
17078
|
+
switch (type) {
|
|
17079
|
+
// @ts-expect-error -- intentional fallthrough case
|
|
17080
|
+
case "number":
|
|
17081
|
+
if (isNaN(val))
|
|
17082
|
+
return "nan";
|
|
17083
|
+
if (val === Infinity)
|
|
17084
|
+
return "inf";
|
|
17085
|
+
if (val === -Infinity)
|
|
17086
|
+
return "-inf";
|
|
17087
|
+
if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
|
|
17088
|
+
return val.toFixed(1);
|
|
17089
|
+
case "bigint":
|
|
17090
|
+
case "boolean":
|
|
17091
|
+
case "temporal":
|
|
17092
|
+
return val.toString();
|
|
17093
|
+
case "string":
|
|
17094
|
+
return formatString(val);
|
|
17095
|
+
case "date":
|
|
17096
|
+
if (isNaN(val.getTime()))
|
|
17097
|
+
throw new TypeError("cannot serialize invalid date");
|
|
17098
|
+
return val.toISOString();
|
|
17099
|
+
case "object":
|
|
17100
|
+
return stringifyInlineTable(val, depth, numberAsFloat, strictTemporal);
|
|
17101
|
+
case "array":
|
|
17102
|
+
return stringifyArray(val, depth, numberAsFloat, strictTemporal);
|
|
17103
|
+
// @ts-expect-error -- intentional fallthrough case
|
|
17104
|
+
case "temporal/tz+uc":
|
|
17105
|
+
if (strictTemporal) {
|
|
17106
|
+
let tz = val.timeZoneId;
|
|
17107
|
+
let tzc = tz.charCodeAt(0);
|
|
17108
|
+
if (
|
|
17109
|
+
// Classic offset
|
|
17110
|
+
tzc !== 43 && tzc !== 45 && // Fast pre-check pass; see below for the actually accepted values
|
|
17111
|
+
(tzc !== 85 && tzc !== 71 && tzc !== 90 && tzc !== 69 || // UTC and its aliases; Temporal implementations don't all canonicalise unfortunately
|
|
17112
|
+
tz !== "UTC" && tz !== "UCT" && tz !== "Universal" && tz !== "Zulu" && // GMT is a TZ but it's for all intents and purposes equivalent to UTC. Safe to downgrade.
|
|
17113
|
+
!tz.startsWith("GMT") && tz !== "Greenwich" && // Etc/* are all safe to downgrade to offset (either UTC, GMT, or offset)
|
|
17114
|
+
!tz.startsWith("Etc/"))
|
|
17115
|
+
) {
|
|
17116
|
+
throw new TypeError("Temporal objects with an IANA timezone are not allowed in Temporal strict mode");
|
|
17117
|
+
}
|
|
17118
|
+
}
|
|
17119
|
+
case "temporal/uc":
|
|
17120
|
+
if (strictTemporal && val.calendarId !== "iso8601")
|
|
17121
|
+
throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
|
|
17122
|
+
return val.toString({
|
|
17123
|
+
calendarName: "never",
|
|
17124
|
+
timeZoneName: "never"
|
|
17125
|
+
});
|
|
17126
|
+
case "temporal/x":
|
|
17127
|
+
throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
|
|
17128
|
+
}
|
|
17129
|
+
}
|
|
17130
|
+
function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
|
|
17131
|
+
let keys = Object.keys(obj);
|
|
17132
|
+
if (keys.length === 0)
|
|
17133
|
+
return "{}";
|
|
17134
|
+
let res = "{ ";
|
|
17135
|
+
for (let i = 0; i < keys.length; i++) {
|
|
17136
|
+
let k = keys[i];
|
|
17137
|
+
if (i)
|
|
17138
|
+
res += ", ";
|
|
17139
|
+
res += formatKey(k) + " = " + stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat, strictTemporal);
|
|
17140
|
+
}
|
|
17141
|
+
return res + " }";
|
|
17142
|
+
}
|
|
17143
|
+
function stringifyArray(array3, depth, numberAsFloat, strictTemporal) {
|
|
17144
|
+
if (array3.length === 0)
|
|
17145
|
+
return "[]";
|
|
17146
|
+
let res = "[ ";
|
|
17147
|
+
for (let i = 0; i < array3.length; i++) {
|
|
17148
|
+
if (i)
|
|
17149
|
+
res += ", ";
|
|
17150
|
+
if (array3[i] === null || array3[i] === void 0) {
|
|
17151
|
+
throw new TypeError("arrays cannot contain null or undefined values");
|
|
17152
|
+
}
|
|
17153
|
+
res += stringifyValue(array3[i], extendedTypeOf(array3[i]), depth - 1, numberAsFloat, strictTemporal);
|
|
17154
|
+
}
|
|
17155
|
+
return res + " ]";
|
|
17156
|
+
}
|
|
17157
|
+
function stringifyArrayTable(array3, key, depth, numberAsFloat, strictTemporal) {
|
|
17158
|
+
if (depth === 0) {
|
|
17159
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
17160
|
+
}
|
|
17161
|
+
let res = "";
|
|
17162
|
+
for (let i = 0; i < array3.length; i++) {
|
|
17163
|
+
res += `${res && "\n"}[[${key}]]
|
|
17164
|
+
`;
|
|
17165
|
+
res += stringifyTable(0, array3[i], key, depth, numberAsFloat, strictTemporal);
|
|
17166
|
+
}
|
|
17167
|
+
return res;
|
|
17168
|
+
}
|
|
17169
|
+
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
|
|
17170
|
+
if (depth === 0) {
|
|
17171
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
17172
|
+
}
|
|
17173
|
+
let preamble = "";
|
|
17174
|
+
let tables = "";
|
|
17175
|
+
let keys = Object.keys(obj);
|
|
17176
|
+
for (let i = 0; i < keys.length; i++) {
|
|
17177
|
+
let k = keys[i];
|
|
17178
|
+
if (obj[k] !== null && obj[k] !== void 0) {
|
|
17179
|
+
let type = extendedTypeOf(obj[k]);
|
|
17180
|
+
if (type === "symbol" || type === "function") {
|
|
17181
|
+
throw new TypeError(`cannot serialize values of type '${type}'`);
|
|
17182
|
+
}
|
|
17183
|
+
let key = formatKey(k);
|
|
17184
|
+
if (type === "array" && isArrayOfTables(obj[k])) {
|
|
17185
|
+
tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
|
|
17186
|
+
} else if (type === "object") {
|
|
17187
|
+
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
17188
|
+
tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat, strictTemporal);
|
|
17189
|
+
} else {
|
|
17190
|
+
preamble += key;
|
|
17191
|
+
preamble += " = ";
|
|
17192
|
+
preamble += stringifyValue(obj[k], type, depth, numberAsFloat, strictTemporal);
|
|
17193
|
+
preamble += "\n";
|
|
17194
|
+
}
|
|
17195
|
+
}
|
|
17196
|
+
}
|
|
17197
|
+
if (tableKey && (preamble || !tables))
|
|
17198
|
+
preamble = preamble ? `[${tableKey}]
|
|
17199
|
+
${preamble}` : `[${tableKey}]`;
|
|
17200
|
+
return preamble && tables ? `${preamble}
|
|
17201
|
+
${tables}` : preamble || tables;
|
|
17202
|
+
}
|
|
17203
|
+
function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
|
|
17204
|
+
if (extendedTypeOf(obj) !== "object") {
|
|
17205
|
+
throw new TypeError("stringify can only be called with an object");
|
|
17206
|
+
}
|
|
17207
|
+
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
|
|
17208
|
+
if (str[str.length - 1] !== "\n")
|
|
17209
|
+
return str + "\n";
|
|
17210
|
+
return str;
|
|
17211
|
+
}
|
|
17212
|
+
|
|
16986
17213
|
// src/core/survey-lease.ts
|
|
16987
17214
|
import { spawn as realSpawn4 } from "child_process";
|
|
16988
17215
|
import { randomUUID } from "crypto";
|
|
@@ -16993,7 +17220,7 @@ import {
|
|
|
16993
17220
|
renameSync as renameSync2,
|
|
16994
17221
|
rmdirSync,
|
|
16995
17222
|
rmSync,
|
|
16996
|
-
statSync as
|
|
17223
|
+
statSync as statSync3,
|
|
16997
17224
|
unlinkSync as unlinkSync2,
|
|
16998
17225
|
utimesSync,
|
|
16999
17226
|
writeFileSync as writeFileSync2
|
|
@@ -17030,7 +17257,7 @@ function reclaimIfStale(directory, staleMs) {
|
|
|
17030
17257
|
return true;
|
|
17031
17258
|
}
|
|
17032
17259
|
if (owners.length !== 1) return false;
|
|
17033
|
-
const age = Date.now() -
|
|
17260
|
+
const age = Date.now() - statSync3(join10(directory, owners[0])).mtimeMs;
|
|
17034
17261
|
if (Math.abs(age) <= staleMs) return false;
|
|
17035
17262
|
releaseLease({ directory, owner: owners[0] });
|
|
17036
17263
|
return true;
|
|
@@ -17104,7 +17331,7 @@ function opencodeCanDefineSurveyAgent(bin) {
|
|
|
17104
17331
|
windowsHide: true,
|
|
17105
17332
|
stdio: ["ignore", "pipe", "ignore"]
|
|
17106
17333
|
});
|
|
17107
|
-
return Number(/(\d+)\./.exec(out)?.[1] ?? 0)
|
|
17334
|
+
return Number(/(\d+)\./.exec(out)?.[1] ?? 0) === 1;
|
|
17108
17335
|
} catch {
|
|
17109
17336
|
return false;
|
|
17110
17337
|
}
|
|
@@ -17119,6 +17346,7 @@ var SURVEY_DISALLOWED_TOOLS = [
|
|
|
17119
17346
|
"WebSearch",
|
|
17120
17347
|
"Task"
|
|
17121
17348
|
];
|
|
17349
|
+
var tomlValue = (value) => stringify({ v: value }).slice("v = ".length).trim();
|
|
17122
17350
|
function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
17123
17351
|
const env = {
|
|
17124
17352
|
...process.env,
|
|
@@ -17177,9 +17405,9 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
17177
17405
|
"-c",
|
|
17178
17406
|
`mcp_servers.hindsight.command="node"`,
|
|
17179
17407
|
"-c",
|
|
17180
|
-
`mcp_servers.hindsight.args
|
|
17408
|
+
`mcp_servers.hindsight.args=${tomlValue([opts.mcpServerPath])}`,
|
|
17181
17409
|
"-c",
|
|
17182
|
-
`mcp_servers.hindsight.env.HINDSIGHT_MCP_PROJECT_CWD
|
|
17410
|
+
`mcp_servers.hindsight.env.HINDSIGHT_MCP_PROJECT_CWD=${tomlValue(repoDir)}`,
|
|
17183
17411
|
"-c",
|
|
17184
17412
|
`mcp_servers.hindsight.env.HINDSIGHT_MCP_HARNESS="codex"`,
|
|
17185
17413
|
SURVEY_PROMPT
|
|
@@ -17203,10 +17431,19 @@ function buildSurveyPlan(harness, bin, repoDir, opts) {
|
|
|
17203
17431
|
}
|
|
17204
17432
|
}
|
|
17205
17433
|
}
|
|
17434
|
+
var SURVEY_MAX_ATTEMPTS = 3;
|
|
17435
|
+
function surveyAttempts(file3, sha) {
|
|
17436
|
+
try {
|
|
17437
|
+
const state = JSON.parse(readFileSync5(file3, "utf8"));
|
|
17438
|
+
return state.sha === sha && typeof state.attempts === "number" ? state.attempts : 0;
|
|
17439
|
+
} catch {
|
|
17440
|
+
return 0;
|
|
17441
|
+
}
|
|
17442
|
+
}
|
|
17206
17443
|
async function startCodebaseSurvey(repoDir, opts = {}) {
|
|
17207
17444
|
try {
|
|
17208
17445
|
const spawnFn = opts.spawn ?? realSpawn5;
|
|
17209
|
-
const
|
|
17446
|
+
const resolveBin = opts.resolveBin ?? ((bin) => binOnPath(bin, { exts: [".exe"] }));
|
|
17210
17447
|
const mcpServerPath = opts.mcpServerPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "mcp-server.js");
|
|
17211
17448
|
const preferred = opts.harness ?? "claude-code";
|
|
17212
17449
|
const order = [
|
|
@@ -17220,10 +17457,16 @@ async function startCodebaseSurvey(repoDir, opts = {}) {
|
|
|
17220
17457
|
for (const harness of order) {
|
|
17221
17458
|
if (seen.has(harness)) continue;
|
|
17222
17459
|
seen.add(harness);
|
|
17223
|
-
const
|
|
17224
|
-
|
|
17225
|
-
if (
|
|
17460
|
+
const name = resolveAgentBin(harness, opts.claudeBin);
|
|
17461
|
+
const bin = resolveBin(name);
|
|
17462
|
+
if (!bin) {
|
|
17463
|
+
log.info("survey", `${harness}: ${name} not found, trying the next agent`);
|
|
17464
|
+
continue;
|
|
17465
|
+
}
|
|
17466
|
+
if (harness === "opencode" && !(opts.opencodeDefinesAgent ?? opencodeCanDefineSurveyAgent)(bin)) {
|
|
17467
|
+
log.info("survey", `${harness}: ${bin} cannot define the survey agent, trying the next`);
|
|
17226
17468
|
continue;
|
|
17469
|
+
}
|
|
17227
17470
|
const plan = buildSurveyPlan(harness, bin, repoDir, {
|
|
17228
17471
|
model: opts.model,
|
|
17229
17472
|
budgetUsd: opts.budgetUsd,
|
|
@@ -17231,13 +17474,20 @@ async function startCodebaseSurvey(repoDir, opts = {}) {
|
|
|
17231
17474
|
});
|
|
17232
17475
|
const { cfg, bankId } = resolveHostConfig(harness, repoDir);
|
|
17233
17476
|
if (cfg.disabled) return false;
|
|
17234
|
-
const key =
|
|
17235
|
-
const
|
|
17236
|
-
|
|
17237
|
-
key,
|
|
17238
|
-
opts.lease?.staleMs ?? LEASE_STALE_MS
|
|
17239
|
-
);
|
|
17477
|
+
const key = createHash3("sha256").update(JSON.stringify([cfg.apiUrl.replace(/\/+$/, ""), cfg.apiToken ?? "", bankId])).digest("hex");
|
|
17478
|
+
const leaseDir = opts.lease?.dir ?? join11(tmpdir2(), "hindsight-coding-agent", "surveys");
|
|
17479
|
+
const lease = acquireLease(leaseDir, key, opts.lease?.staleMs ?? LEASE_STALE_MS);
|
|
17240
17480
|
if (!lease) return false;
|
|
17481
|
+
const attemptsFile = join11(
|
|
17482
|
+
leaseDir,
|
|
17483
|
+
`attempts-${createHash3("sha256").update(JSON.stringify([key, repoDir])).digest("hex")}.json`
|
|
17484
|
+
);
|
|
17485
|
+
const attempts = opts.sha ? surveyAttempts(attemptsFile, opts.sha) : 0;
|
|
17486
|
+
if (attempts >= SURVEY_MAX_ATTEMPTS) {
|
|
17487
|
+
log.info("survey", `${attempts} surveys already launched at ${opts.sha}, skipping`);
|
|
17488
|
+
releaseLease(lease);
|
|
17489
|
+
return false;
|
|
17490
|
+
}
|
|
17241
17491
|
const spec = {
|
|
17242
17492
|
lease,
|
|
17243
17493
|
bin: plan.bin,
|
|
@@ -17245,7 +17495,7 @@ async function startCodebaseSurvey(repoDir, opts = {}) {
|
|
|
17245
17495
|
...opts.lease?.heartbeatMs ? { heartbeatMs: opts.lease.heartbeatMs } : {}
|
|
17246
17496
|
};
|
|
17247
17497
|
const supervisorPath = opts.supervisorPath ?? join11(dirname7(fileURLToPath4(import.meta.url)), "survey-supervisor.js");
|
|
17248
|
-
return await new Promise((
|
|
17498
|
+
return await new Promise((resolve4) => {
|
|
17249
17499
|
try {
|
|
17250
17500
|
const child = spawnFn("node", [supervisorPath], {
|
|
17251
17501
|
cwd: repoDir,
|
|
@@ -17255,19 +17505,31 @@ async function startCodebaseSurvey(repoDir, opts = {}) {
|
|
|
17255
17505
|
env: { ...plan.env, [SURVEY_SPEC_ENV]: JSON.stringify(spec) }
|
|
17256
17506
|
});
|
|
17257
17507
|
let spawned = false;
|
|
17258
|
-
child.on("error", () => {
|
|
17508
|
+
child.on("error", (e) => {
|
|
17259
17509
|
if (spawned) return;
|
|
17510
|
+
log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
|
|
17260
17511
|
releaseLease(lease);
|
|
17261
|
-
|
|
17512
|
+
resolve4(false);
|
|
17262
17513
|
});
|
|
17263
17514
|
child.once("spawn", () => {
|
|
17264
17515
|
spawned = true;
|
|
17265
17516
|
child.unref();
|
|
17266
|
-
|
|
17517
|
+
if (opts.sha) {
|
|
17518
|
+
try {
|
|
17519
|
+
writeFileSync3(
|
|
17520
|
+
attemptsFile,
|
|
17521
|
+
JSON.stringify({ sha: opts.sha, attempts: attempts + 1 }),
|
|
17522
|
+
{ mode: 384 }
|
|
17523
|
+
);
|
|
17524
|
+
} catch {
|
|
17525
|
+
}
|
|
17526
|
+
}
|
|
17527
|
+
resolve4(true);
|
|
17267
17528
|
});
|
|
17268
|
-
} catch {
|
|
17529
|
+
} catch (e) {
|
|
17530
|
+
log.warn("survey", `survey supervisor failed to launch: ${describeError(e)}`);
|
|
17269
17531
|
releaseLease(lease);
|
|
17270
|
-
|
|
17532
|
+
resolve4(false);
|
|
17271
17533
|
}
|
|
17272
17534
|
});
|
|
17273
17535
|
}
|
|
@@ -17504,7 +17766,7 @@ function buildKnowledgeTools(client, bankId, opts = {}) {
|
|
|
17504
17766
|
annotations: NON_DESTRUCTIVE_WRITE_ANNOTATIONS,
|
|
17505
17767
|
handler: guarded(async ({ title, content }) => {
|
|
17506
17768
|
const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
17507
|
-
const docId = /[^\x00-\x7f]/.test(title) || !slug ? `${slug || "doc"}--${
|
|
17769
|
+
const docId = /[^\x00-\x7f]/.test(title) || !slug ? `${slug || "doc"}--${createHash4("sha256").update(title).digest("hex")}` : slug;
|
|
17508
17770
|
const stamp = opts.stampFor?.();
|
|
17509
17771
|
const metadata = {
|
|
17510
17772
|
...stamp?.metadata,
|
|
@@ -17531,7 +17793,7 @@ function buildKnowledgeTools(client, bankId, opts = {}) {
|
|
|
17531
17793
|
}
|
|
17532
17794
|
|
|
17533
17795
|
// src/core/retain-cursor.ts
|
|
17534
|
-
import { createHash as
|
|
17796
|
+
import { createHash as createHash5 } from "crypto";
|
|
17535
17797
|
var PENDING_MAX_AGE_MS = 12 * 60 * 60 * 1e3;
|
|
17536
17798
|
var PENDING_MAX_BYTES = 256 * 1024;
|
|
17537
17799
|
var MAX_CURSOR_PATHS = 16;
|
|
@@ -17545,9 +17807,21 @@ function pendingReplayable(cursor, now) {
|
|
|
17545
17807
|
if (pending.some((p) => now - p.at > PENDING_MAX_AGE_MS)) return false;
|
|
17546
17808
|
return pending.reduce((n, p) => n + p.content.length, 0) <= PENDING_MAX_BYTES;
|
|
17547
17809
|
}
|
|
17810
|
+
function advanceSegments(cursor, bank) {
|
|
17811
|
+
if (!cursor || cursor.bank === bank) return cursor?.segments;
|
|
17812
|
+
return [...cursor.segments ?? [{ bank: cursor.bank, from: 0 }], { bank, from: cursor.turns }];
|
|
17813
|
+
}
|
|
17814
|
+
function bankTurns(turns, segments, bank) {
|
|
17815
|
+
if (!segments) return turns;
|
|
17816
|
+
return turns.filter((_, i) => {
|
|
17817
|
+
let owner;
|
|
17818
|
+
for (const s of segments) if (s.from <= i) owner = s.bank;
|
|
17819
|
+
return owner === bank;
|
|
17820
|
+
});
|
|
17821
|
+
}
|
|
17548
17822
|
var MAX_CURSOR_OPS = 8;
|
|
17549
17823
|
function fingerprintTurns(turns, count) {
|
|
17550
|
-
const h =
|
|
17824
|
+
const h = createHash5("sha1").update(String(count));
|
|
17551
17825
|
for (let i = 0; i < count; i++) h.update("\n" + JSON.stringify(turns[i]));
|
|
17552
17826
|
return h.digest("hex");
|
|
17553
17827
|
}
|
|
@@ -17555,7 +17829,8 @@ function planRetain(turns, cursor, opts) {
|
|
|
17555
17829
|
if (!turns.length) return { mode: "skip" };
|
|
17556
17830
|
if (!opts.appendSupported || !cursor || cursor.dirty) return { mode: "replace" };
|
|
17557
17831
|
if (!pendingReplayable(cursor, opts.now ?? Date.now())) return { mode: "replace" };
|
|
17558
|
-
if (cursor.bank !== opts.bank)
|
|
17832
|
+
if (cursor.bank !== opts.bank && !cursor.segments?.some((s) => s.bank === opts.bank))
|
|
17833
|
+
return { mode: "replace" };
|
|
17559
17834
|
const seen = cursor.paths ?? [];
|
|
17560
17835
|
const newFile = Boolean(opts.path && seen.length && !seen.includes(opts.path));
|
|
17561
17836
|
const continues = cursor.turns <= turns.length && fingerprintTurns(turns, cursor.turns) === cursor.fingerprint;
|
|
@@ -17571,27 +17846,6 @@ function memoryCursorStore() {
|
|
|
17571
17846
|
};
|
|
17572
17847
|
}
|
|
17573
17848
|
|
|
17574
|
-
// src/core/uuid.ts
|
|
17575
|
-
import { createHash as createHash5 } from "crypto";
|
|
17576
|
-
var HINDSIGHT_NAMESPACE = "e75686a4-e923-4326-a0d1-358f1c6c3eb4";
|
|
17577
|
-
function uuidV5(name, namespace = HINDSIGHT_NAMESPACE) {
|
|
17578
|
-
const ns = Buffer.from(namespace.replace(/-/g, ""), "hex");
|
|
17579
|
-
if (ns.length !== 16) throw new Error(`invalid UUID namespace: ${namespace}`);
|
|
17580
|
-
const bytes = Buffer.from(
|
|
17581
|
-
createHash5("sha1").update(ns).update(Buffer.from(name, "utf8")).digest().subarray(0, 16)
|
|
17582
|
-
);
|
|
17583
|
-
bytes[6] = bytes[6] & 15 | 80;
|
|
17584
|
-
bytes[8] = bytes[8] & 63 | 128;
|
|
17585
|
-
const hex5 = bytes.toString("hex");
|
|
17586
|
-
return [
|
|
17587
|
-
hex5.slice(0, 8),
|
|
17588
|
-
hex5.slice(8, 12),
|
|
17589
|
-
hex5.slice(12, 16),
|
|
17590
|
-
hex5.slice(16, 20),
|
|
17591
|
-
hex5.slice(20)
|
|
17592
|
-
].join("-");
|
|
17593
|
-
}
|
|
17594
|
-
|
|
17595
17849
|
// src/core/chat.ts
|
|
17596
17850
|
function withRefId(refId, turns, baseTs) {
|
|
17597
17851
|
return [{ role: "system", content: `REF-ID: ${refId}`, timestamp: baseTs }, ...turns];
|
|
@@ -17697,8 +17951,17 @@ async function writeSession(client, sessionId, turns, startTs, harness, stamp, c
|
|
|
17697
17951
|
let cursor = cursors?.read(sessionId);
|
|
17698
17952
|
const probed = Boolean(cursors) && cursor?.appendSupported !== true;
|
|
17699
17953
|
const appendSupported = Boolean(cursors) && (cursor?.appendSupported === true || await supportsAppend(client));
|
|
17954
|
+
const moved = Boolean(cursor && cursor.bank !== client.bank);
|
|
17955
|
+
if (moved)
|
|
17956
|
+
log.warn(harness ?? "", "session moved to another bank mid-session", {
|
|
17957
|
+
session: sessionId,
|
|
17958
|
+
from: cursor?.bank,
|
|
17959
|
+
to: client.bank,
|
|
17960
|
+
atTurn: cursor?.turns
|
|
17961
|
+
});
|
|
17962
|
+
const segments = advanceSegments(cursor, client.bank);
|
|
17700
17963
|
let ops = [];
|
|
17701
|
-
if (appendSupported && cursor?.ops?.length && !cursor.dirty)
|
|
17964
|
+
if (appendSupported && cursor?.ops?.length && !cursor.dirty && !moved)
|
|
17702
17965
|
({ cursor, ops } = await settleOps(client, cursor));
|
|
17703
17966
|
const plan = planRetain(turns, cursor, {
|
|
17704
17967
|
appendSupported,
|
|
@@ -17707,7 +17970,7 @@ async function writeSession(client, sessionId, turns, startTs, harness, stamp, c
|
|
|
17707
17970
|
});
|
|
17708
17971
|
if (probed) diag(harness ?? "", "retain_mode", { mode: plan.mode, appendSupported });
|
|
17709
17972
|
const paths = plan.mode === "replace" ? transcriptPath ? [transcriptPath] : void 0 : advancePaths(cursor?.paths, transcriptPath);
|
|
17710
|
-
const outbox = plan.mode === "replace" ? [] : cursor?.pending ?? [];
|
|
17973
|
+
const outbox = plan.mode === "replace" || moved ? [] : cursor?.pending ?? [];
|
|
17711
17974
|
if (plan.mode === "skip" && !outbox.length) return;
|
|
17712
17975
|
const opId = (mode, content) => uuidV5(`${client.bank}
|
|
17713
17976
|
${refId}
|
|
@@ -17749,6 +18012,7 @@ ${content}`);
|
|
|
17749
18012
|
fingerprint: fingerprintTurns(turns, turns.length),
|
|
17750
18013
|
bank: client.bank,
|
|
17751
18014
|
...paths ? { paths } : {},
|
|
18015
|
+
...segments ? { segments } : {},
|
|
17752
18016
|
...appendSupported ? { appendSupported: true } : {}
|
|
17753
18017
|
};
|
|
17754
18018
|
const accepted = (id) => {
|
|
@@ -17761,9 +18025,14 @@ ${content}`);
|
|
|
17761
18025
|
return now?.turns === next.turns && now?.fingerprint === next.fingerprint;
|
|
17762
18026
|
};
|
|
17763
18027
|
if (plan.mode === "replace") {
|
|
17764
|
-
const
|
|
18028
|
+
const share = bankTurns(turns, segments, client.bank);
|
|
18029
|
+
if (!share.length) return;
|
|
18030
|
+
const content = renderSessionJsonl(refId, share, startTs);
|
|
18031
|
+
const base = cursor ? `${cursor.turns}
|
|
18032
|
+
${cursor.fingerprint}` : "";
|
|
17765
18033
|
cursors?.write(sessionId, { ...next, dirty: true });
|
|
17766
|
-
const operationId = opId("replace",
|
|
18034
|
+
const operationId = opId("replace", `${base}
|
|
18035
|
+
${content}`);
|
|
17767
18036
|
await submitWithRetry(() => submit(content, operationId, false), stillOurs, retryUntil);
|
|
17768
18037
|
ops = [];
|
|
17769
18038
|
cursors?.write(sessionId, accepted(operationId));
|
|
@@ -17790,7 +18059,7 @@ ${content}`);
|
|
|
17790
18059
|
}
|
|
17791
18060
|
|
|
17792
18061
|
// src/core/usage.ts
|
|
17793
|
-
import { readFileSync as
|
|
18062
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
17794
18063
|
import { join as join13 } from "path";
|
|
17795
18064
|
function usageFilePath() {
|
|
17796
18065
|
return process.env.HINDSIGHT_USAGE_FILE || join13(logsDir(), "usage.jsonl");
|
|
@@ -17873,12 +18142,12 @@ function buildRetainStamp(cfg, ctx) {
|
|
|
17873
18142
|
const base = resolversFor(ctx);
|
|
17874
18143
|
const cache = /* @__PURE__ */ new Map();
|
|
17875
18144
|
const resolvers = Object.fromEntries(
|
|
17876
|
-
Object.entries(base).map(([name,
|
|
18145
|
+
Object.entries(base).map(([name, resolve4]) => [
|
|
17877
18146
|
name,
|
|
17878
18147
|
() => {
|
|
17879
18148
|
const hit = cache.get(name);
|
|
17880
18149
|
if (hit !== void 0) return hit;
|
|
17881
|
-
const value =
|
|
18150
|
+
const value = resolve4();
|
|
17882
18151
|
cache.set(name, value);
|
|
17883
18152
|
return value;
|
|
17884
18153
|
}
|
|
@@ -17898,7 +18167,7 @@ function buildRetainStamp(cfg, ctx) {
|
|
|
17898
18167
|
}
|
|
17899
18168
|
|
|
17900
18169
|
// src/core/skill-sync.ts
|
|
17901
|
-
import { cpSync, existsSync as existsSync6, readFileSync as
|
|
18170
|
+
import { cpSync, existsSync as existsSync6, readFileSync as readFileSync7 } from "fs";
|
|
17902
18171
|
import { homedir as homedir7 } from "os";
|
|
17903
18172
|
import { dirname as dirname8, join as join15 } from "path";
|
|
17904
18173
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
@@ -17973,7 +18242,7 @@ function syncCompanionSkill(harness, opts = {}) {
|
|
|
17973
18242
|
const dstMd = join15(dst, "SKILL.md");
|
|
17974
18243
|
const installed = existsSync6(dstMd);
|
|
17975
18244
|
if (!installed && !opts.install) return;
|
|
17976
|
-
if (!installed ||
|
|
18245
|
+
if (!installed || readFileSync7(srcMd, "utf8") !== readFileSync7(dstMd, "utf8")) {
|
|
17977
18246
|
cpSync(src, dst, { recursive: true });
|
|
17978
18247
|
}
|
|
17979
18248
|
} catch {
|
|
@@ -17995,9 +18264,9 @@ function brandWord() {
|
|
|
17995
18264
|
}
|
|
17996
18265
|
|
|
17997
18266
|
// src/core/legacy.ts
|
|
17998
|
-
import { existsSync as existsSync7, readFileSync as
|
|
18267
|
+
import { existsSync as existsSync7, readFileSync as readFileSync8 } from "fs";
|
|
17999
18268
|
import { homedir as homedir8 } from "os";
|
|
18000
|
-
import { join as join16, relative, isAbsolute as
|
|
18269
|
+
import { join as join16, relative, isAbsolute as isAbsolute3 } from "path";
|
|
18001
18270
|
var LEGACY_CLAUDE_PLUGIN = "hindsight-memory";
|
|
18002
18271
|
function detectLegacyClaudePlugin(cwd, claudeDir = join16(homedir8(), ".claude")) {
|
|
18003
18272
|
const registry3 = readJson(join16(claudeDir, "plugins", "installed_plugins.json"));
|
|
@@ -18012,7 +18281,7 @@ function detectLegacyClaudePlugin(cwd, claudeDir = join16(homedir8(), ".claude")
|
|
|
18012
18281
|
if (!i || typeof i !== "object") return false;
|
|
18013
18282
|
if (typeof i.projectPath !== "string") return true;
|
|
18014
18283
|
const rel = relative(i.projectPath, cwd);
|
|
18015
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
18284
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute3(rel);
|
|
18016
18285
|
});
|
|
18017
18286
|
if (active) return key;
|
|
18018
18287
|
}
|
|
@@ -18020,7 +18289,7 @@ function detectLegacyClaudePlugin(cwd, claudeDir = join16(homedir8(), ".claude")
|
|
|
18020
18289
|
}
|
|
18021
18290
|
function readJson(path) {
|
|
18022
18291
|
try {
|
|
18023
|
-
const parsed = JSON.parse(
|
|
18292
|
+
const parsed = JSON.parse(readFileSync8(path, "utf8"));
|
|
18024
18293
|
return parsed && typeof parsed === "object" ? parsed : void 0;
|
|
18025
18294
|
} catch {
|
|
18026
18295
|
return void 0;
|
|
@@ -18032,7 +18301,7 @@ function legacyClaudePluginWarning(key) {
|
|
|
18032
18301
|
}
|
|
18033
18302
|
|
|
18034
18303
|
// src/core/session-cache.ts
|
|
18035
|
-
import { mkdirSync as mkdirSync4, readFileSync as
|
|
18304
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync9, renameSync as renameSync3, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
18036
18305
|
import { tmpdir as tmpdir3 } from "os";
|
|
18037
18306
|
import { dirname as dirname9, join as join17 } from "path";
|
|
18038
18307
|
function sessionCacheFile(harness, sessionId) {
|
|
@@ -18040,7 +18309,7 @@ function sessionCacheFile(harness, sessionId) {
|
|
|
18040
18309
|
}
|
|
18041
18310
|
function readSessionCache(cacheFile) {
|
|
18042
18311
|
try {
|
|
18043
|
-
return JSON.parse(
|
|
18312
|
+
return JSON.parse(readFileSync9(cacheFile, "utf8"));
|
|
18044
18313
|
} catch {
|
|
18045
18314
|
return {};
|
|
18046
18315
|
}
|
|
@@ -18049,7 +18318,7 @@ function writeFileAtomic(path, body) {
|
|
|
18049
18318
|
mkdirSync4(dirname9(path), { recursive: true });
|
|
18050
18319
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
18051
18320
|
try {
|
|
18052
|
-
|
|
18321
|
+
writeFileSync4(tmp, body);
|
|
18053
18322
|
renameSync3(tmp, path);
|
|
18054
18323
|
} catch (e) {
|
|
18055
18324
|
try {
|
|
@@ -18159,12 +18428,13 @@ async function buildSessionStartContext(args) {
|
|
|
18159
18428
|
startSeed(cwd, { limit: cfg.seedLimit, harness });
|
|
18160
18429
|
if (cold) {
|
|
18161
18430
|
if (cfg.codebaseSurvey !== false) {
|
|
18431
|
+
const sha = resolveHeadSha(cwd);
|
|
18162
18432
|
const started = await startSurvey(cwd, {
|
|
18163
18433
|
harness,
|
|
18164
18434
|
model: cfg.surveyModel,
|
|
18165
|
-
budgetUsd: cfg.surveyBudgetUsd
|
|
18435
|
+
budgetUsd: cfg.surveyBudgetUsd,
|
|
18436
|
+
sha: sha ?? void 0
|
|
18166
18437
|
});
|
|
18167
|
-
const sha = resolveHeadSha(cwd);
|
|
18168
18438
|
if (started && sha) recordSurveyBaseline(sha);
|
|
18169
18439
|
}
|
|
18170
18440
|
diag(harness, "seed_started", { bank: bankId });
|
|
@@ -18185,7 +18455,8 @@ async function buildSessionStartContext(args) {
|
|
|
18185
18455
|
const started = await startSurvey(cwd, {
|
|
18186
18456
|
harness,
|
|
18187
18457
|
model: cfg.surveyModel,
|
|
18188
|
-
budgetUsd: cfg.surveyBudgetUsd
|
|
18458
|
+
budgetUsd: cfg.surveyBudgetUsd,
|
|
18459
|
+
sha
|
|
18189
18460
|
});
|
|
18190
18461
|
if (started) {
|
|
18191
18462
|
recordSurveyBaseline(sha);
|
|
@@ -18287,7 +18558,7 @@ If you VERIFY this memory is wrong or outdated (the code or facts contradict it)
|
|
|
18287
18558
|
}
|
|
18288
18559
|
|
|
18289
18560
|
// src/core/turn-journal.ts
|
|
18290
|
-
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync5, readFileSync as
|
|
18561
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync5, readFileSync as readFileSync10, statSync as statSync4 } from "fs";
|
|
18291
18562
|
import { tmpdir as tmpdir4 } from "os";
|
|
18292
18563
|
import { dirname as dirname10, join as join18 } from "path";
|
|
18293
18564
|
|
|
@@ -18538,8 +18809,6 @@ var RuntimeCore = class {
|
|
|
18538
18809
|
fetchTranscript;
|
|
18539
18810
|
/** Write-backs started and not yet settled — what `flush` waits for. */
|
|
18540
18811
|
inFlight = /* @__PURE__ */ new Set();
|
|
18541
|
-
lastInjection = "";
|
|
18542
|
-
// most recent turn's injection block, keyed by nothing (see getInjection)
|
|
18543
18812
|
deferInitialReflect = false;
|
|
18544
18813
|
/** Host-notice channel (opencode/Kilo: client.tui.showToast via the adapter). Optional, fail-open. */
|
|
18545
18814
|
notify;
|
|
@@ -18611,7 +18880,11 @@ var RuntimeCore = class {
|
|
|
18611
18880
|
*/
|
|
18612
18881
|
async onPrompt(sessionId, prompt) {
|
|
18613
18882
|
if (process.env.HINDSIGHT_DISABLE_HOOKS) return;
|
|
18614
|
-
if (!sessionId
|
|
18883
|
+
if (!sessionId) return;
|
|
18884
|
+
if (!prompt.trim()) {
|
|
18885
|
+
this.injection.delete(sessionId);
|
|
18886
|
+
return;
|
|
18887
|
+
}
|
|
18615
18888
|
const turns = (this.turnCount.get(sessionId) ?? 0) + 1;
|
|
18616
18889
|
this.turnCount.set(sessionId, turns);
|
|
18617
18890
|
const cacheFile = sessionCacheFile(this.harness, sessionId);
|
|
@@ -18643,18 +18916,21 @@ var RuntimeCore = class {
|
|
|
18643
18916
|
}
|
|
18644
18917
|
const block = blocks.filter(Boolean).join("\n\n");
|
|
18645
18918
|
this.injection.set(sessionId, block);
|
|
18646
|
-
this.lastInjection = block;
|
|
18647
18919
|
}
|
|
18648
18920
|
/**
|
|
18649
|
-
* The
|
|
18650
|
-
*
|
|
18651
|
-
*
|
|
18652
|
-
* turn
|
|
18653
|
-
*
|
|
18921
|
+
* The text to inject into this turn's user message (built by the preceding onPrompt), or
|
|
18922
|
+
* undefined.
|
|
18923
|
+
*
|
|
18924
|
+
* It goes into the USER turn on every host, never the system prompt (#5914). The block changes
|
|
18925
|
+
* from turn to turn — the recall runs once, the roster refresh on a cadence — so a system prompt
|
|
18926
|
+
* carrying it differed between requests and broke the provider's prefix cache from that point
|
|
18927
|
+
* on. Persisted in the turn it belongs to, it leaves the system prompt and the earlier history
|
|
18928
|
+
* byte-identical. That used to need a fallback to the most recent block for opencode's
|
|
18929
|
+
* `experimental.chat.system.transform`, which fired with no session id; nothing reads it that
|
|
18930
|
+
* way any more.
|
|
18654
18931
|
*/
|
|
18655
18932
|
getInjection(sessionId) {
|
|
18656
|
-
|
|
18657
|
-
return keyed ?? this.lastInjection ?? void 0;
|
|
18933
|
+
return this.injection.get(sessionId) || void 0;
|
|
18658
18934
|
}
|
|
18659
18935
|
/**
|
|
18660
18936
|
* Full normalized transcript (rich: user/assistant text + tool calls/outputs): upsert every turn
|
|
@@ -18983,7 +19259,7 @@ __export(external_exports2, {
|
|
|
18983
19259
|
object: () => object2,
|
|
18984
19260
|
optional: () => optional2,
|
|
18985
19261
|
overwrite: () => _overwrite2,
|
|
18986
|
-
parse: () =>
|
|
19262
|
+
parse: () => parse5,
|
|
18987
19263
|
parseAsync: () => parseAsync4,
|
|
18988
19264
|
partialRecord: () => partialRecord2,
|
|
18989
19265
|
pipe: () => pipe2,
|
|
@@ -19287,7 +19563,7 @@ __export(core_exports4, {
|
|
|
19287
19563
|
isValidBase64URL: () => isValidBase64URL2,
|
|
19288
19564
|
isValidJWT: () => isValidJWT2,
|
|
19289
19565
|
locales: () => locales_exports2,
|
|
19290
|
-
parse: () =>
|
|
19566
|
+
parse: () => parse4,
|
|
19291
19567
|
parseAsync: () => parseAsync3,
|
|
19292
19568
|
prettifyError: () => prettifyError2,
|
|
19293
19569
|
regexes: () => regexes_exports2,
|
|
@@ -20161,7 +20437,7 @@ var _parse2 = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
20161
20437
|
}
|
|
20162
20438
|
return result.value;
|
|
20163
20439
|
};
|
|
20164
|
-
var
|
|
20440
|
+
var parse4 = /* @__PURE__ */ _parse2($ZodRealError2);
|
|
20165
20441
|
var _parseAsync2 = (_Err) => async (schema, value, _ctx, params) => {
|
|
20166
20442
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
20167
20443
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -22684,10 +22960,10 @@ var $ZodFunction2 = /* @__PURE__ */ $constructor2("$ZodFunction", (inst, def) =>
|
|
|
22684
22960
|
throw new Error("implement() must be called with a function");
|
|
22685
22961
|
}
|
|
22686
22962
|
return function(...args) {
|
|
22687
|
-
const parsedArgs = inst._def.input ?
|
|
22963
|
+
const parsedArgs = inst._def.input ? parse4(inst._def.input, args) : args;
|
|
22688
22964
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
22689
22965
|
if (inst._def.output) {
|
|
22690
|
-
return
|
|
22966
|
+
return parse4(inst._def.output, result);
|
|
22691
22967
|
}
|
|
22692
22968
|
return result;
|
|
22693
22969
|
};
|
|
@@ -30179,7 +30455,7 @@ var ZodRealError2 = $constructor2("ZodError", initializer4, {
|
|
|
30179
30455
|
});
|
|
30180
30456
|
|
|
30181
30457
|
// node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/parse.js
|
|
30182
|
-
var
|
|
30458
|
+
var parse5 = /* @__PURE__ */ _parse2(ZodRealError2);
|
|
30183
30459
|
var parseAsync4 = /* @__PURE__ */ _parseAsync2(ZodRealError2);
|
|
30184
30460
|
var safeParse4 = /* @__PURE__ */ _safeParse2(ZodRealError2);
|
|
30185
30461
|
var safeParseAsync4 = /* @__PURE__ */ _safeParseAsync2(ZodRealError2);
|
|
@@ -30216,7 +30492,7 @@ var ZodType2 = /* @__PURE__ */ $constructor2("ZodType", (inst, def) => {
|
|
|
30216
30492
|
reg.add(inst, meta3);
|
|
30217
30493
|
return inst;
|
|
30218
30494
|
});
|
|
30219
|
-
inst.parse = (data, params) =>
|
|
30495
|
+
inst.parse = (data, params) => parse5(inst, data, params, { callee: inst.parse });
|
|
30220
30496
|
inst.safeParse = (data, params) => safeParse4(inst, data, params);
|
|
30221
30497
|
inst.parseAsync = async (data, params) => parseAsync4(inst, data, params, { callee: inst.parseAsync });
|
|
30222
30498
|
inst.safeParseAsync = async (data, params) => safeParseAsync4(inst, data, params);
|
|
@@ -31234,12 +31510,12 @@ function tool(input) {
|
|
|
31234
31510
|
tool.schema = external_exports2;
|
|
31235
31511
|
|
|
31236
31512
|
// src/harness/registry.ts
|
|
31237
|
-
import { readFileSync as
|
|
31513
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
31238
31514
|
var jsonChatReader = (harness) => ({
|
|
31239
31515
|
describe: `${harness} sessions via a normalized JSON export (--conversations file: [{ id, turns:[{role,text,timestamp?}] }])`,
|
|
31240
31516
|
async read(opts) {
|
|
31241
31517
|
if (!opts.conversations) return [];
|
|
31242
|
-
return JSON.parse(
|
|
31518
|
+
return JSON.parse(readFileSync11(opts.conversations, "utf8"));
|
|
31243
31519
|
}
|
|
31244
31520
|
});
|
|
31245
31521
|
|
|
@@ -31272,21 +31548,26 @@ function createRuntime(core) {
|
|
|
31272
31548
|
return {
|
|
31273
31549
|
...surveyAgentHook,
|
|
31274
31550
|
tool: tools,
|
|
31275
|
-
// Each user turn: recall on the prompt
|
|
31551
|
+
// Each user turn: recall on the prompt, then add this turn's injection (recalled memories +
|
|
31552
|
+
// attribution/user-feedback framing, plus the knowledge preamble on turn 1 and the roster
|
|
31553
|
+
// refresh on cadence) to the user message as a synthetic text part. The host saves the parts
|
|
31554
|
+
// this hook leaves behind, so the block stays in the turn it was made for and every later
|
|
31555
|
+
// request repeats it byte for byte. It used to be pushed into the system prompt through
|
|
31556
|
+
// `experimental.chat.system.transform`, which made the system prompt change between turns
|
|
31557
|
+
// and broke the provider's prefix cache (#5914).
|
|
31276
31558
|
"chat.message": async (input, output) => {
|
|
31277
31559
|
await core.onPrompt(input.sessionID, textOf(output.parts));
|
|
31278
|
-
},
|
|
31279
|
-
// Push this turn's injection (recalled memories + attribution/user-feedback framing, plus the
|
|
31280
|
-
// knowledge preamble on turn 1 and the roster refresh on cadence) into the system prompt every
|
|
31281
|
-
// turn. opencode fires this hook with NO sessionId (input is just `{model}`), so getInjection
|
|
31282
|
-
// falls back to the most recent turn's block (see RuntimeCore.getInjection).
|
|
31283
|
-
"experimental.chat.system.transform": async (input, output) => {
|
|
31284
31560
|
const inj = core.getInjection(input.sessionID);
|
|
31285
|
-
if (inj)
|
|
31286
|
-
|
|
31287
|
-
|
|
31288
|
-
|
|
31289
|
-
|
|
31561
|
+
if (inj)
|
|
31562
|
+
output.parts.unshift({
|
|
31563
|
+
id: `prt-hindsight-${output.message.id}`,
|
|
31564
|
+
sessionID: input.sessionID,
|
|
31565
|
+
messageID: output.message.id,
|
|
31566
|
+
type: "text",
|
|
31567
|
+
text: inj,
|
|
31568
|
+
synthetic: true
|
|
31569
|
+
});
|
|
31570
|
+
diag(core.harness, inj ? "inject_ok" : "inject_empty", { chars: inj?.length ?? 0 });
|
|
31290
31571
|
},
|
|
31291
31572
|
// Write-back (on by default): normalize the live transcript to rich turns (text + tool calls +
|
|
31292
31573
|
// their inline output) and hand it to core, which upserts every N user turns.
|
|
@@ -31369,3 +31650,42 @@ export {
|
|
|
31369
31650
|
HindsightCodingAgentsPlugin,
|
|
31370
31651
|
src_default as default
|
|
31371
31652
|
};
|
|
31653
|
+
/*! Bundled license information:
|
|
31654
|
+
|
|
31655
|
+
smol-toml/dist/error.js:
|
|
31656
|
+
smol-toml/dist/primitive.js:
|
|
31657
|
+
smol-toml/dist/date.js:
|
|
31658
|
+
smol-toml/dist/extract.js:
|
|
31659
|
+
smol-toml/dist/util.js:
|
|
31660
|
+
smol-toml/dist/struct.js:
|
|
31661
|
+
smol-toml/dist/parse.js:
|
|
31662
|
+
smol-toml/dist/stringify.js:
|
|
31663
|
+
smol-toml/dist/index.js:
|
|
31664
|
+
(*!
|
|
31665
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
31666
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
31667
|
+
*
|
|
31668
|
+
* Redistribution and use in source and binary forms, with or without
|
|
31669
|
+
* modification, are permitted provided that the following conditions are met:
|
|
31670
|
+
*
|
|
31671
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
31672
|
+
* list of conditions and the following disclaimer.
|
|
31673
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
31674
|
+
* this list of conditions and the following disclaimer in the
|
|
31675
|
+
* documentation and/or other materials provided with the distribution.
|
|
31676
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
31677
|
+
* may be used to endorse or promote products derived from this software without
|
|
31678
|
+
* specific prior written permission.
|
|
31679
|
+
*
|
|
31680
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
31681
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
31682
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
31683
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
31684
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
31685
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
31686
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31687
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
31688
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
31689
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31690
|
+
*)
|
|
31691
|
+
*/
|