@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.
Files changed (64) hide show
  1. package/README.md +19 -5
  2. package/dist/antigravity-hook.js +98 -42
  3. package/dist/antigravity-statusline.js +6 -6
  4. package/dist/antigravity-stop-hook.js +135 -51
  5. package/dist/claude-hook.js +98 -42
  6. package/dist/claude-sessionstart-hook.js +386 -99
  7. package/dist/claude-stop-hook.js +135 -51
  8. package/dist/cline.js +433 -118
  9. package/dist/codebuddy-hook.js +98 -42
  10. package/dist/codebuddy-sessionstart-hook.js +386 -99
  11. package/dist/codebuddy-stop-hook.js +135 -51
  12. package/dist/codex-hook.js +98 -42
  13. package/dist/codex-sessionstart-hook.js +386 -99
  14. package/dist/codex-stop-hook.js +135 -51
  15. package/dist/copilot-hook.js +98 -42
  16. package/dist/copilot-sessionstart-hook.js +386 -99
  17. package/dist/copilot-stop-hook.js +135 -51
  18. package/dist/cursor-hook.js +98 -42
  19. package/dist/cursor-sessionstart-hook.js +386 -99
  20. package/dist/cursor-stop-hook.js +135 -51
  21. package/dist/daemon-start.js +10 -10
  22. package/dist/dcode-hook.js +98 -42
  23. package/dist/dcode-sessionstart-hook.js +386 -99
  24. package/dist/dcode-stop-hook.js +135 -51
  25. package/dist/deepen.js +193 -52
  26. package/dist/devin-hook.js +98 -42
  27. package/dist/devin-sessionstart-hook.js +386 -99
  28. package/dist/devin-stop-hook.js +135 -51
  29. package/dist/droid-hook.js +98 -42
  30. package/dist/droid-sessionstart-hook.js +386 -99
  31. package/dist/droid-stop-hook.js +135 -51
  32. package/dist/dsh.js +452 -125
  33. package/dist/grok-hook.js +98 -42
  34. package/dist/grok-sessionstart-hook.js +386 -99
  35. package/dist/grok-stop-hook.js +135 -51
  36. package/dist/hindsight-seed.js +6 -6
  37. package/dist/index.js +457 -137
  38. package/dist/installer.js +92 -80
  39. package/dist/kilo.js +457 -137
  40. package/dist/kimi-hook.js +98 -42
  41. package/dist/kimi-sessionstart-hook.js +386 -99
  42. package/dist/kimi-stop-hook.js +135 -51
  43. package/dist/mcp-server.js +180 -65
  44. package/dist/opencode2.js +613 -131
  45. package/dist/pi.js +433 -125
  46. package/dist/prime-agent.js +433 -125
  47. package/dist/qwen-hook.js +98 -42
  48. package/dist/qwen-sessionstart-hook.js +386 -99
  49. package/dist/qwen-stop-hook.js +135 -51
  50. package/dist/status.js +76 -18
  51. package/dist/survey-supervisor.js +73 -9
  52. package/dist/traecode-hook.js +98 -42
  53. package/dist/traecode-sessionstart-hook.js +386 -99
  54. package/dist/traecode-stop-hook.js +135 -51
  55. package/dist/workbuddy-hook.js +98 -42
  56. package/dist/workbuddy-sessionstart-hook.js +386 -99
  57. package/dist/workbuddy-stop-hook.js +135 -51
  58. package/dist/zcode-hook.js +98 -42
  59. package/dist/zcode-sessionstart-hook.js +386 -99
  60. package/dist/zcode-stop-hook.js +135 -51
  61. package/index.js +4 -1
  62. package/package.json +6 -4
  63. package/plugin.json +1 -1
  64. package/skill/SKILL.md +16 -4
@@ -161,10 +161,10 @@ var require_code = __commonJS({
161
161
  function interpolate(x) {
162
162
  return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify(Array.isArray(x) ? x.join(",") : x);
163
163
  }
164
- function stringify(x) {
164
+ function stringify2(x) {
165
165
  return new _Code(safeStringify(x));
166
166
  }
167
- exports.stringify = stringify;
167
+ exports.stringify = stringify2;
168
168
  function safeStringify(x) {
169
169
  return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
170
170
  }
@@ -2984,7 +2984,7 @@ var require_compile = __commonJS({
2984
2984
  const schOrFunc = root.refs[ref];
2985
2985
  if (schOrFunc)
2986
2986
  return schOrFunc;
2987
- let _sch = resolve3.call(this, root, ref);
2987
+ let _sch = resolve4.call(this, root, ref);
2988
2988
  if (_sch === void 0) {
2989
2989
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
2990
2990
  const { schemaId } = this.opts;
@@ -3011,7 +3011,7 @@ var require_compile = __commonJS({
3011
3011
  function sameSchemaEnv(s1, s2) {
3012
3012
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
3013
3013
  }
3014
- function resolve3(root, ref) {
3014
+ function resolve4(root, ref) {
3015
3015
  let sch;
3016
3016
  while (typeof (sch = this.refs[ref]) == "string")
3017
3017
  ref = sch;
@@ -3337,6 +3337,37 @@ var require_utils = __commonJS({
3337
3337
  }
3338
3338
  return output.join("");
3339
3339
  }
3340
+ function removeDotSegmentsRelative(path) {
3341
+ if (path === "" || path[0] === "/") {
3342
+ return removeDotSegments(path);
3343
+ }
3344
+ const segments = path.split("/");
3345
+ const last = segments.length - 1;
3346
+ const output = [];
3347
+ let trailingDirectory = false;
3348
+ for (let i = 0; i <= last; i++) {
3349
+ const segment = segments[i];
3350
+ if (segment === "." || segment === "..") {
3351
+ if (segment === "..") {
3352
+ if (output.length !== 0 && output[output.length - 1] !== "..") {
3353
+ output.pop();
3354
+ } else {
3355
+ output.push("..");
3356
+ }
3357
+ }
3358
+ trailingDirectory = i === last;
3359
+ } else {
3360
+ output.push(segment);
3361
+ }
3362
+ }
3363
+ if (trailingDirectory && output[output.length - 1] !== "..") {
3364
+ output.push("");
3365
+ }
3366
+ if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
3367
+ output.unshift(".");
3368
+ }
3369
+ return output.join("/");
3370
+ }
3340
3371
  var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
3341
3372
  var HOST_DELIM_RE = /[@/?#:]/g;
3342
3373
  var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
@@ -3597,6 +3628,7 @@ var require_utils = __commonJS({
3597
3628
  encodeFragment,
3598
3629
  escapePreservingEscapes,
3599
3630
  removeDotSegments,
3631
+ removeDotSegmentsRelative,
3600
3632
  isIPv4,
3601
3633
  isUUID,
3602
3634
  normalizeIPv6,
@@ -3820,16 +3852,18 @@ var require_schemes = __commonJS({
3820
3852
  var require_fast_uri = __commonJS({
3821
3853
  "node_modules/fast-uri/index.js"(exports, module) {
3822
3854
  "use strict";
3823
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3855
+ var { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3824
3856
  var { SCHEMES, getSchemeHandler } = require_schemes();
3825
3857
  var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
3826
3858
  var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
3827
- function decodeValidScheme(scheme) {
3828
- const decodedScheme = unescape(String(scheme));
3829
- if (!VALID_SCHEME.test(decodedScheme)) {
3859
+ var MALFORMED_HOST_ERROR = "URI host is malformed.";
3860
+ var FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
3861
+ function validateScheme(scheme) {
3862
+ const stringScheme = String(scheme);
3863
+ if (!VALID_SCHEME.test(stringScheme)) {
3830
3864
  throw new TypeError(MALFORMED_SCHEME_ERROR);
3831
3865
  }
3832
- return decodedScheme;
3866
+ return stringScheme;
3833
3867
  }
3834
3868
  function normalize2(uri, options) {
3835
3869
  if (typeof uri === "string") {
@@ -3837,11 +3871,11 @@ var require_fast_uri = __commonJS({
3837
3871
  normalizeString(uri, options);
3838
3872
  } else if (typeof uri === "object") {
3839
3873
  uri = /** @type {T} */
3840
- parse3(serialize(uri, options), options);
3874
+ parse4(serialize(uri, options), options);
3841
3875
  }
3842
3876
  return uri;
3843
3877
  }
3844
- function resolve3(baseURI, relativeURI, options) {
3878
+ function resolve4(baseURI, relativeURI, options) {
3845
3879
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3846
3880
  const {
3847
3881
  parsed: baseParsed,
@@ -3866,6 +3900,9 @@ var require_fast_uri = __commonJS({
3866
3900
  const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved2.scheme);
3867
3901
  const resolvedHost = resolved2.host;
3868
3902
  const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
3903
+ if (hasForbiddenDomainHost(resolved2, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
3904
+ throw new Error(MALFORMED_HOST_ERROR);
3905
+ }
3869
3906
  canonicalizeHost(resolved2, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
3870
3907
  const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
3871
3908
  if (resolved2.error && !encodedASCIIHost) {
@@ -3877,8 +3914,8 @@ var require_fast_uri = __commonJS({
3877
3914
  function resolveComponent(base, relative, options, skipNormalization) {
3878
3915
  const target = {};
3879
3916
  if (!skipNormalization) {
3880
- base = parse3(serialize(base, options), options);
3881
- relative = parse3(serialize(relative, options), options);
3917
+ base = parse4(serialize(base, options), options);
3918
+ relative = parse4(serialize(relative, options), options);
3882
3919
  }
3883
3920
  options = options || {};
3884
3921
  if (!options.tolerant && relative.scheme) {
@@ -3907,14 +3944,15 @@ var require_fast_uri = __commonJS({
3907
3944
  if (relative.path[0] === "/") {
3908
3945
  target.path = removeDotSegments(relative.path);
3909
3946
  } else {
3910
- if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
3947
+ const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
3948
+ if (baseHasAuthority && !base.path) {
3911
3949
  target.path = "/" + relative.path;
3912
3950
  } else if (!base.path) {
3913
3951
  target.path = relative.path;
3914
3952
  } else {
3915
3953
  target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
3916
3954
  }
3917
- target.path = removeDotSegments(target.path);
3955
+ target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
3918
3956
  }
3919
3957
  target.query = relative.query;
3920
3958
  }
@@ -3952,12 +3990,13 @@ var require_fast_uri = __commonJS({
3952
3990
  const options = Object.assign({}, opts);
3953
3991
  const uriTokens = [];
3954
3992
  if (component.scheme) {
3955
- component.scheme = decodeValidScheme(component.scheme);
3993
+ component.scheme = validateScheme(component.scheme);
3956
3994
  }
3957
3995
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
3958
3996
  if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
3959
3997
  const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
3960
- const pathNoScheme = !options.skipEscape && component.scheme === void 0 && !hasAuthority;
3998
+ const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
3999
+ const pathNoScheme = !options.skipEscape && schemelessReference;
3961
4000
  if (component.path !== void 0) {
3962
4001
  if (!options.skipEscape) {
3963
4002
  component.path = serializePathEncoding(component.path, pathNoScheme);
@@ -3966,7 +4005,7 @@ var require_fast_uri = __commonJS({
3966
4005
  }
3967
4006
  }
3968
4007
  if (options.reference !== "suffix" && component.scheme) {
3969
- component.scheme = decodeValidScheme(component.scheme);
4008
+ component.scheme = validateScheme(component.scheme);
3970
4009
  uriTokens.push(component.scheme, ":");
3971
4010
  }
3972
4011
  const authority = recomposeAuthority(component);
@@ -3982,9 +4021,9 @@ var require_fast_uri = __commonJS({
3982
4021
  if (component.path !== void 0) {
3983
4022
  let s = component.path;
3984
4023
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
3985
- s = removeDotSegments(s);
4024
+ s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
3986
4025
  }
3987
- if (pathNoScheme) {
4026
+ if (schemelessReference) {
3988
4027
  s = serializePathEncoding(s, true);
3989
4028
  }
3990
4029
  if (authority === void 0 && s[0] === "/" && s[1] === "/") {
@@ -4031,16 +4070,34 @@ var require_fast_uri = __commonJS({
4031
4070
  return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4032
4071
  }
4033
4072
  function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4073
+ if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
4074
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4075
+ return true;
4076
+ }
4034
4077
  if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4078
+ let url2;
4035
4079
  try {
4036
- parsed.host = new URL("http://" + parsed.host).hostname;
4080
+ url2 = new URL("http://" + parsed.host);
4037
4081
  } catch (e) {
4038
4082
  parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
4039
4083
  return true;
4040
4084
  }
4085
+ if (!isHostOnlyURL(url2)) {
4086
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4087
+ return true;
4088
+ }
4089
+ parsed.host = url2.hostname;
4041
4090
  }
4042
4091
  return false;
4043
4092
  }
4093
+ function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
4094
+ return Boolean(
4095
+ parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
4096
+ );
4097
+ }
4098
+ function isHostOnlyURL(url2) {
4099
+ return url2.username === "" && url2.password === "" && url2.port === "" && url2.pathname === "/" && url2.search === "" && url2.hash === "" && url2.hostname !== "";
4100
+ }
4044
4101
  function parseWithStatus(uri, opts) {
4045
4102
  const options = Object.assign({}, opts);
4046
4103
  const parsed = {
@@ -4095,9 +4152,8 @@ var require_fast_uri = __commonJS({
4095
4152
  parsed.query = matches[7];
4096
4153
  parsed.fragment = matches[8];
4097
4154
  if (parsed.scheme !== void 0) {
4098
- const decodedScheme = unescape(parsed.scheme);
4099
- if (VALID_SCHEME.test(decodedScheme)) {
4100
- parsed.scheme = decodedScheme.toLowerCase();
4155
+ if (VALID_SCHEME.test(parsed.scheme)) {
4156
+ parsed.scheme = parsed.scheme.toLowerCase();
4101
4157
  } else {
4102
4158
  parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
4103
4159
  malformedScheme = true;
@@ -4125,7 +4181,7 @@ var require_fast_uri = __commonJS({
4125
4181
  malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4126
4182
  parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4127
4183
  if (malformedIPLiteral) {
4128
- parsed.error = parsed.error || "URI host is malformed.";
4184
+ parsed.error = parsed.error || MALFORMED_HOST_ERROR;
4129
4185
  malformedAuthorityOrPort = true;
4130
4186
  }
4131
4187
  } else {
@@ -4148,13 +4204,14 @@ var require_fast_uri = __commonJS({
4148
4204
  if (!malformedIPLiteral) {
4149
4205
  malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
4150
4206
  }
4151
- if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4152
- if (uri.indexOf("%") !== -1) {
4153
- if (parsed.host !== void 0 && !malformedIPLiteral) {
4154
- const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4155
- parsed.host = reescapeHostDelimiters(host, isIP);
4156
- }
4207
+ if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
4208
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4209
+ if (!isIP) {
4210
+ host = normalizePercentEncoding(host.toLowerCase());
4157
4211
  }
4212
+ parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
4213
+ }
4214
+ if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4158
4215
  if (parsed.path) {
4159
4216
  parsed.path = normalizePathEncoding(parsed.path);
4160
4217
  }
@@ -4176,7 +4233,7 @@ var require_fast_uri = __commonJS({
4176
4233
  }
4177
4234
  return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
4178
4235
  }
4179
- function parse3(uri, opts) {
4236
+ function parse4(uri, opts) {
4180
4237
  return parseWithStatus(uri, opts).parsed;
4181
4238
  }
4182
4239
  function normalizeString(uri, opts) {
@@ -4209,11 +4266,11 @@ var require_fast_uri = __commonJS({
4209
4266
  var fastUri = {
4210
4267
  SCHEMES,
4211
4268
  normalize: normalize2,
4212
- resolve: resolve3,
4269
+ resolve: resolve4,
4213
4270
  resolveComponent,
4214
4271
  equal,
4215
4272
  serialize,
4216
- parse: parse3
4273
+ parse: parse4
4217
4274
  };
4218
4275
  module.exports = fastUri;
4219
4276
  module.exports.default = fastUri;
@@ -29181,7 +29238,7 @@ var Protocol = class {
29181
29238
  return;
29182
29239
  }
29183
29240
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
29184
- await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
29241
+ await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
29185
29242
  options?.signal?.throwIfAborted();
29186
29243
  }
29187
29244
  } catch (error51) {
@@ -29198,7 +29255,7 @@ var Protocol = class {
29198
29255
  */
29199
29256
  request(request, resultSchema, options) {
29200
29257
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
29201
- return new Promise((resolve3, reject) => {
29258
+ return new Promise((resolve4, reject) => {
29202
29259
  const earlyReject = (error51) => {
29203
29260
  reject(error51);
29204
29261
  };
@@ -29276,7 +29333,7 @@ var Protocol = class {
29276
29333
  if (!parseResult.success) {
29277
29334
  reject(parseResult.error);
29278
29335
  } else {
29279
- resolve3(parseResult.data);
29336
+ resolve4(parseResult.data);
29280
29337
  }
29281
29338
  } catch (error51) {
29282
29339
  reject(error51);
@@ -29538,12 +29595,12 @@ var Protocol = class {
29538
29595
  }
29539
29596
  } catch {
29540
29597
  }
29541
- return new Promise((resolve3, reject) => {
29598
+ return new Promise((resolve4, reject) => {
29542
29599
  if (signal.aborted) {
29543
29600
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
29544
29601
  return;
29545
29602
  }
29546
- const timeoutId = setTimeout(resolve3, interval);
29603
+ const timeoutId = setTimeout(resolve4, interval);
29547
29604
  signal.addEventListener("abort", () => {
29548
29605
  clearTimeout(timeoutId);
29549
29606
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -30674,7 +30731,7 @@ var McpServer = class {
30674
30731
  let task = createTaskResult.task;
30675
30732
  const pollInterval = task.pollInterval ?? 5e3;
30676
30733
  while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
30677
- await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
30734
+ await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
30678
30735
  const updatedTask = await extra.taskStore.getTask(taskId);
30679
30736
  if (!updatedTask) {
30680
30737
  throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
@@ -31338,12 +31395,12 @@ var StdioServerTransport = class {
31338
31395
  this.onclose?.();
31339
31396
  }
31340
31397
  send(message) {
31341
- return new Promise((resolve3) => {
31398
+ return new Promise((resolve4) => {
31342
31399
  const json2 = serializeMessage(message);
31343
31400
  if (this._stdout.write(json2)) {
31344
- resolve3();
31401
+ resolve4();
31345
31402
  } else {
31346
- this._stdout.once("drain", resolve3);
31403
+ this._stdout.once("drain", resolve4);
31347
31404
  }
31348
31405
  });
31349
31406
  }
@@ -31540,14 +31597,14 @@ function probeGitLayout(directory) {
31540
31597
  var PLACEHOLDER = /\{([a-zA-Z_]+)\}/g;
31541
31598
  function applyTemplate(template, resolvers, what) {
31542
31599
  return template.replace(PLACEHOLDER, (_, name) => {
31543
- const resolve3 = resolvers[name];
31544
- if (!resolve3) {
31600
+ const resolve4 = resolvers[name];
31601
+ if (!resolve4) {
31545
31602
  console.error(
31546
31603
  `hindsight: unknown ${what} placeholder "{${name}}" \u2014 valid: ` + Object.keys(resolvers).sort().map((k) => `{${k}}`).join(", ")
31547
31604
  );
31548
31605
  return "unknown";
31549
31606
  }
31550
- return resolve3();
31607
+ return resolve4();
31551
31608
  });
31552
31609
  }
31553
31610
 
@@ -31968,11 +32025,11 @@ function codingBankManifest(overrides, mode = DEFAULT_RETAIN_EXTRACTION_MODE, de
31968
32025
  }
31969
32026
 
31970
32027
  // package.json
31971
- var version2 = "0.8.1";
32028
+ var version2 = "0.8.3";
31972
32029
 
31973
32030
  // src/core/util.ts
31974
- import { accessSync, constants } from "fs";
31975
- import { delimiter, join as join6 } from "path";
32031
+ import { accessSync, constants, statSync as statSync2 } from "fs";
32032
+ import { delimiter, extname, isAbsolute as isAbsolute2, join as join6, resolve as resolve2 } from "path";
31976
32033
  var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
31977
32034
  function semverGte(version3, min) {
31978
32035
  const parts = (v) => {
@@ -32241,15 +32298,19 @@ var HindsightClient = class {
32241
32298
  }
32242
32299
  /**
32243
32300
  * Whether this server honours `operation_id` on an async retain, and can therefore be appended to
32244
- * safely (see MIN_IDEMPOTENT_RETAIN_VERSION). Probed once per client via the version endpoint; anything
32301
+ * safely (see MIN_IDEMPOTENT_RETAIN_VERSION). Probed via the version endpoint; anything
32245
32302
  * unreachable, unparseable or older answers "no", which costs efficiency, never correctness.
32303
+ * Only a "yes" is cached: a long-lived plugin client would otherwise keep replacing for the rest
32304
+ * of the process after one probe that hit a restarting server (#5735).
32246
32305
  */
32247
32306
  async supportsIdempotentRetain() {
32248
- if (this.idempotentRetain === void 0) {
32249
- this.idempotentRetain = await this.probeIdempotentRetain();
32250
- this.log(`server retain idempotency: ${this.idempotentRetain ? "supported" : "unavailable"}`);
32307
+ if (this.idempotentRetain) return true;
32308
+ const supported = await this.probeIdempotentRetain();
32309
+ if (supported || this.idempotentRetain === void 0) {
32310
+ this.log(`server retain idempotency: ${supported ? "supported" : "unavailable"}`);
32251
32311
  }
32252
- return this.idempotentRetain;
32312
+ this.idempotentRetain = supported;
32313
+ return supported;
32253
32314
  }
32254
32315
  /** `/v1/version` first: an ingress that routes only `/v1` to the API (the Helm chart's default)
32255
32316
  * hands a bare `/version` to the control plane, whose HTML 404 or login redirect read as "no",
@@ -33241,7 +33302,7 @@ function resolveHostMemory(harness, directory) {
33241
33302
  }
33242
33303
 
33243
33304
  // src/core/knowledge-tools.ts
33244
- import { createHash as createHash3 } from "crypto";
33305
+ import { createHash as createHash4 } from "crypto";
33245
33306
  import { existsSync as existsSync3 } from "fs";
33246
33307
  import { homedir as homedir5 } from "os";
33247
33308
  import { join as join10 } from "path";
@@ -33251,24 +33312,36 @@ import { execFileSync as execFileSync3 } from "child_process";
33251
33312
 
33252
33313
  // src/core/git.ts
33253
33314
  import { execFileSync } from "child_process";
33254
- import { resolve as resolve2 } from "path";
33255
- function git(repo, ...args) {
33315
+ import { resolve as resolve3 } from "path";
33316
+
33317
+ // src/core/uuid.ts
33318
+ import { createHash as createHash2 } from "crypto";
33319
+
33320
+ // src/core/git.ts
33321
+ var US = "";
33322
+ var RS = "";
33323
+ var GITLOG_FORMAT = `--format=%h${US}%ad${US}%an${US}%s${US}%b${RS}`;
33324
+ function runGit(repo, args, env) {
33256
33325
  return execFileSync("git", ["-C", repo, "-c", "log.showSignature=false", ...args], {
33257
33326
  encoding: "utf8",
33258
33327
  maxBuffer: 1 << 28,
33259
33328
  windowsHide: true,
33329
+ env,
33260
33330
  // execFileSync otherwise forwards failed git stderr into the host's TUI,
33261
33331
  // even when callers catch the error. Keep diagnostics on the error instead.
33262
33332
  stdio: ["ignore", "pipe", "pipe"]
33263
33333
  });
33264
33334
  }
33335
+ function gitLocal(repo, ...args) {
33336
+ return runGit(repo, args, { ...process.env, GIT_NO_LAZY_FETCH: "1" });
33337
+ }
33265
33338
  function repoNameOf(repo) {
33266
- return projectNameOf(resolve2(repo));
33339
+ return projectNameOf(resolve3(repo));
33267
33340
  }
33268
33341
  function commitsSince(dir, sinceSha) {
33269
33342
  if (!/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/.test(sinceSha)) return null;
33270
33343
  try {
33271
- const n = Number.parseInt(git(dir, "rev-list", "--count", `${sinceSha}..HEAD`).trim(), 10);
33344
+ const n = Number.parseInt(gitLocal(dir, "rev-list", "--count", `${sinceSha}..HEAD`).trim(), 10);
33272
33345
  return Number.isFinite(n) ? n : null;
33273
33346
  } catch {
33274
33347
  return null;
@@ -33290,12 +33363,15 @@ function parsePageList(raw) {
33290
33363
 
33291
33364
  // src/core/survey.ts
33292
33365
  import { execFileSync as execFileSync2, spawn as realSpawn3 } from "child_process";
33293
- import { createHash as createHash2 } from "crypto";
33294
- import { existsSync as existsSync2 } from "fs";
33366
+ import { createHash as createHash3 } from "crypto";
33367
+ import { existsSync as existsSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
33295
33368
  import { homedir as homedir4, tmpdir } from "os";
33296
33369
  import { dirname as dirname5, join as join9 } from "path";
33297
33370
  import { fileURLToPath as fileURLToPath2 } from "url";
33298
33371
 
33372
+ // node_modules/smol-toml/dist/stringify.js
33373
+ var HAS_WELLFORMED = !!"".isWellFormed;
33374
+
33299
33375
  // src/core/survey-lease.ts
33300
33376
  import { spawn as realSpawn2 } from "child_process";
33301
33377
  import { randomUUID } from "crypto";
@@ -33306,7 +33382,7 @@ import {
33306
33382
  renameSync as renameSync2,
33307
33383
  rmdirSync,
33308
33384
  rmSync,
33309
- statSync as statSync2,
33385
+ statSync as statSync3,
33310
33386
  unlinkSync,
33311
33387
  utimesSync,
33312
33388
  writeFileSync
@@ -33549,7 +33625,7 @@ function buildKnowledgeTools(client, bankId, opts = {}) {
33549
33625
  annotations: NON_DESTRUCTIVE_WRITE_ANNOTATIONS,
33550
33626
  handler: guarded(async ({ title, content }) => {
33551
33627
  const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
33552
- const docId = /[^\x00-\x7f]/.test(title) || !slug ? `${slug || "doc"}--${createHash3("sha256").update(title).digest("hex")}` : slug;
33628
+ const docId = /[^\x00-\x7f]/.test(title) || !slug ? `${slug || "doc"}--${createHash4("sha256").update(title).digest("hex")}` : slug;
33553
33629
  const stamp = opts.stampFor?.();
33554
33630
  const metadata = {
33555
33631
  ...stamp?.metadata,
@@ -33600,12 +33676,12 @@ function buildRetainStamp(cfg, ctx) {
33600
33676
  const base = resolversFor(ctx);
33601
33677
  const cache = /* @__PURE__ */ new Map();
33602
33678
  const resolvers = Object.fromEntries(
33603
- Object.entries(base).map(([name, resolve3]) => [
33679
+ Object.entries(base).map(([name, resolve4]) => [
33604
33680
  name,
33605
33681
  () => {
33606
33682
  const hit = cache.get(name);
33607
33683
  if (hit !== void 0) return hit;
33608
- const value = resolve3();
33684
+ const value = resolve4();
33609
33685
  cache.set(name, value);
33610
33686
  return value;
33611
33687
  }
@@ -33695,3 +33771,42 @@ export {
33695
33771
  resolveProjectCwd,
33696
33772
  selectTools
33697
33773
  };
33774
+ /*! Bundled license information:
33775
+
33776
+ smol-toml/dist/error.js:
33777
+ smol-toml/dist/primitive.js:
33778
+ smol-toml/dist/date.js:
33779
+ smol-toml/dist/extract.js:
33780
+ smol-toml/dist/util.js:
33781
+ smol-toml/dist/struct.js:
33782
+ smol-toml/dist/parse.js:
33783
+ smol-toml/dist/stringify.js:
33784
+ smol-toml/dist/index.js:
33785
+ (*!
33786
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
33787
+ * SPDX-License-Identifier: BSD-3-Clause
33788
+ *
33789
+ * Redistribution and use in source and binary forms, with or without
33790
+ * modification, are permitted provided that the following conditions are met:
33791
+ *
33792
+ * 1. Redistributions of source code must retain the above copyright notice, this
33793
+ * list of conditions and the following disclaimer.
33794
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
33795
+ * this list of conditions and the following disclaimer in the
33796
+ * documentation and/or other materials provided with the distribution.
33797
+ * 3. Neither the name of the copyright holder nor the names of its contributors
33798
+ * may be used to endorse or promote products derived from this software without
33799
+ * specific prior written permission.
33800
+ *
33801
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33802
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33803
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33804
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
33805
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33806
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33807
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33808
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33809
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33810
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33811
+ *)
33812
+ */