memorix 1.8.7 → 1.8.9

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/dist/cli/index.js CHANGED
@@ -3232,7 +3232,7 @@ ${import_picocolors.default.gray(m3)} ${s4}
3232
3232
 
3233
3233
  // src/cli/version.ts
3234
3234
  function getCliVersion() {
3235
- return true ? "1.8.7" : pkg.version;
3235
+ return true ? "1.8.9" : pkg.version;
3236
3236
  }
3237
3237
  var init_version = __esm({
3238
3238
  "src/cli/version.ts"() {
@@ -7695,12 +7695,12 @@ async function removeMultipleAsync(orama, ids, batchSize, language, skipHooks) {
7695
7695
  if (!skipHooks) {
7696
7696
  await runMultipleHook(orama.beforeRemoveMultiple, orama, docIdsForHooks);
7697
7697
  }
7698
- await new Promise((resolve8, reject) => {
7698
+ await new Promise((resolve9, reject) => {
7699
7699
  let i4 = 0;
7700
7700
  async function _removeMultiple() {
7701
7701
  const batch = ids.slice(i4 * batchSize, ++i4 * batchSize);
7702
7702
  if (!batch.length) {
7703
- return resolve8();
7703
+ return resolve9();
7704
7704
  }
7705
7705
  for (const doc of batch) {
7706
7706
  try {
@@ -22569,7 +22569,7 @@ function toProviderInput(input, baseUrl) {
22569
22569
  return { type: input.modality, url: input.url };
22570
22570
  }
22571
22571
  function parseCacheJsonInWorker(filePath) {
22572
- return new Promise((resolve8, reject) => {
22572
+ return new Promise((resolve9, reject) => {
22573
22573
  void import("worker_threads").then(({ Worker: Worker2 }) => {
22574
22574
  const worker = new Worker2(
22575
22575
  `
@@ -22590,7 +22590,7 @@ function parseCacheJsonInWorker(filePath) {
22590
22590
  worker.once("message", (msg) => {
22591
22591
  void worker.terminate();
22592
22592
  if (msg?.ok && Array.isArray(msg.entries)) {
22593
- resolve8(msg.entries);
22593
+ resolve9(msg.entries);
22594
22594
  return;
22595
22595
  }
22596
22596
  reject(new Error(msg?.error || "embedding cache worker parse failed"));
@@ -22654,8 +22654,8 @@ async function streamJsonArrayToJsonl(filePath, tmpPath) {
22654
22654
  let count3 = 0;
22655
22655
  const writeLine = async (line) => {
22656
22656
  if (!out.write(line)) {
22657
- await new Promise((resolve8, reject) => {
22658
- out.once("drain", resolve8);
22657
+ await new Promise((resolve9, reject) => {
22658
+ out.once("drain", resolve9);
22659
22659
  out.once("error", reject);
22660
22660
  });
22661
22661
  }
@@ -22687,7 +22687,7 @@ async function streamJsonArrayToJsonl(filePath, tmpPath) {
22687
22687
  `);
22688
22688
  count3 += 1;
22689
22689
  if (count3 % 50 === 0) {
22690
- await new Promise((resolve8) => setImmediate(resolve8));
22690
+ await new Promise((resolve9) => setImmediate(resolve9));
22691
22691
  }
22692
22692
  }
22693
22693
  }
@@ -22696,8 +22696,8 @@ async function streamJsonArrayToJsonl(filePath, tmpPath) {
22696
22696
  }
22697
22697
  }
22698
22698
  } finally {
22699
- await new Promise((resolve8, reject) => {
22700
- out.end(() => resolve8());
22699
+ await new Promise((resolve9, reject) => {
22700
+ out.end(() => resolve9());
22701
22701
  out.once("error", reject);
22702
22702
  });
22703
22703
  }
@@ -22742,7 +22742,7 @@ async function loadCacheJsonl(filePath) {
22742
22742
  } catch {
22743
22743
  }
22744
22744
  if (onDiskCount % 250 === 0) {
22745
- await new Promise((resolve8) => setImmediate(resolve8));
22745
+ await new Promise((resolve9) => setImmediate(resolve9));
22746
22746
  }
22747
22747
  }
22748
22748
  diskCacheEntryCount = onDiskCount;
@@ -22987,7 +22987,7 @@ async function saveDiskCacheNow() {
22987
22987
  return;
22988
22988
  }
22989
22989
  const tmpPath = `${jsonlPath}.tmp`;
22990
- await new Promise((resolve8, reject) => {
22990
+ await new Promise((resolve9, reject) => {
22991
22991
  const out = createWriteStream(tmpPath);
22992
22992
  const entries = cache3.entries();
22993
22993
  const writeBatch = () => {
@@ -23006,7 +23006,7 @@ async function saveDiskCacheNow() {
23006
23006
  }
23007
23007
  setImmediate(writeBatch);
23008
23008
  };
23009
- out.on("finish", resolve8);
23009
+ out.on("finish", resolve9);
23010
23010
  out.on("error", reject);
23011
23011
  writeBatch();
23012
23012
  });
@@ -23110,7 +23110,7 @@ function abortError() {
23110
23110
  }
23111
23111
  function raceWithAbort(promise2, signal) {
23112
23112
  if (signal.aborted) return Promise.reject(abortError());
23113
- return new Promise((resolve8, reject) => {
23113
+ return new Promise((resolve9, reject) => {
23114
23114
  const onAbort = () => {
23115
23115
  signal.removeEventListener("abort", onAbort);
23116
23116
  reject(abortError());
@@ -23119,7 +23119,7 @@ function raceWithAbort(promise2, signal) {
23119
23119
  promise2.then(
23120
23120
  (value) => {
23121
23121
  signal.removeEventListener("abort", onAbort);
23122
- resolve8(value);
23122
+ resolve9(value);
23123
23123
  },
23124
23124
  (error40) => {
23125
23125
  signal.removeEventListener("abort", onAbort);
@@ -23130,12 +23130,12 @@ function raceWithAbort(promise2, signal) {
23130
23130
  }
23131
23131
  async function waitForRetry(waitMs, signal) {
23132
23132
  if (!signal) {
23133
- await new Promise((resolve8) => setTimeout(resolve8, waitMs));
23133
+ await new Promise((resolve9) => setTimeout(resolve9, waitMs));
23134
23134
  return;
23135
23135
  }
23136
23136
  const abortSignal = signal;
23137
23137
  if (abortSignal.aborted) throw new Error("Embedding API retry aborted");
23138
- await new Promise((resolve8, reject) => {
23138
+ await new Promise((resolve9, reject) => {
23139
23139
  const timer = setTimeout(done, waitMs);
23140
23140
  const onAbort = () => {
23141
23141
  clearTimeout(timer);
@@ -23144,7 +23144,7 @@ async function waitForRetry(waitMs, signal) {
23144
23144
  };
23145
23145
  function done() {
23146
23146
  abortSignal.removeEventListener("abort", onAbort);
23147
- resolve8();
23147
+ resolve9();
23148
23148
  }
23149
23149
  abortSignal.addEventListener("abort", onAbort, { once: true });
23150
23150
  });
@@ -24953,12 +24953,12 @@ var init_policy = __esm({
24953
24953
 
24954
24954
  // src/timeout.ts
24955
24955
  function withTimeout(promise2, ms2, label) {
24956
- return new Promise((resolve8, reject) => {
24956
+ return new Promise((resolve9, reject) => {
24957
24957
  const timer = setTimeout(() => reject(new Error(`${label} timed out after ${ms2}ms`)), ms2);
24958
24958
  promise2.then(
24959
24959
  (value) => {
24960
24960
  clearTimeout(timer);
24961
- resolve8(value);
24961
+ resolve9(value);
24962
24962
  },
24963
24963
  (error40) => {
24964
24964
  clearTimeout(timer);
@@ -24970,7 +24970,7 @@ function withTimeout(promise2, ms2, label) {
24970
24970
  function withTimeoutSignal(operation, ms2, label, parentSignal) {
24971
24971
  const controller = new AbortController();
24972
24972
  const signal = parentSignal ? AbortSignal.any([parentSignal, controller.signal]) : controller.signal;
24973
- return new Promise((resolve8, reject) => {
24973
+ return new Promise((resolve9, reject) => {
24974
24974
  let settled = false;
24975
24975
  let timedOut = false;
24976
24976
  let timer;
@@ -25007,7 +25007,7 @@ function withTimeoutSignal(operation, ms2, label, parentSignal) {
25007
25007
  if (settled) return;
25008
25008
  settled = true;
25009
25009
  cleanup();
25010
- resolve8(value);
25010
+ resolve9(value);
25011
25011
  },
25012
25012
  (error40) => {
25013
25013
  if (settled) return;
@@ -27022,7 +27022,7 @@ function validateRequest(request) {
27022
27022
  }
27023
27023
  }
27024
27024
  function collectOutput(stream2, limit2, onOverflow) {
27025
- return new Promise((resolve8, reject) => {
27025
+ return new Promise((resolve9, reject) => {
27026
27026
  let value = "";
27027
27027
  let size = 0;
27028
27028
  stream2.setEncoding("utf8");
@@ -27036,7 +27036,7 @@ function collectOutput(stream2, limit2, onOverflow) {
27036
27036
  value += chunk;
27037
27037
  });
27038
27038
  stream2.on("error", reject);
27039
- stream2.on("end", () => resolve8(value));
27039
+ stream2.on("end", () => resolve9(value));
27040
27040
  });
27041
27041
  }
27042
27042
  async function runMaintenanceInChildProcess(request, options = {}) {
@@ -27047,7 +27047,7 @@ async function runMaintenanceInChildProcess(request, options = {}) {
27047
27047
  }
27048
27048
  const timeoutMs = Number.isFinite(options.timeoutMs) ? Math.max(1e3, Math.floor(options.timeoutMs)) : DEFAULT_TIMEOUT_MS;
27049
27049
  const env3 = { ...process.env, ...options.env };
27050
- return new Promise((resolve8, reject) => {
27050
+ return new Promise((resolve9, reject) => {
27051
27051
  let settled = false;
27052
27052
  let child;
27053
27053
  try {
@@ -27087,7 +27087,7 @@ async function runMaintenanceInChildProcess(request, options = {}) {
27087
27087
  )));
27088
27088
  return;
27089
27089
  }
27090
- settle(() => resolve8(parseMaintenanceRunnerOutput(out)));
27090
+ settle(() => resolve9(parseMaintenanceRunnerOutput(out)));
27091
27091
  } catch (error40) {
27092
27092
  settle(() => reject(error40));
27093
27093
  }
@@ -37230,7 +37230,7 @@ var init_sleep = __esm({
37230
37230
  "node_modules/openai/internal/utils/sleep.mjs"() {
37231
37231
  "use strict";
37232
37232
  init_esm_shims();
37233
- sleep2 = (ms2) => new Promise((resolve8) => setTimeout(resolve8, ms2));
37233
+ sleep2 = (ms2) => new Promise((resolve9) => setTimeout(resolve9, ms2));
37234
37234
  }
37235
37235
  });
37236
37236
 
@@ -38419,8 +38419,8 @@ var init_api_promise = __esm({
38419
38419
  init_parse();
38420
38420
  APIPromise = class _APIPromise extends Promise {
38421
38421
  constructor(client, responsePromise, parseResponse2 = defaultParseResponse) {
38422
- super((resolve8) => {
38423
- resolve8(null);
38422
+ super((resolve9) => {
38423
+ resolve9(null);
38424
38424
  });
38425
38425
  this.responsePromise = responsePromise;
38426
38426
  this.parseResponse = parseResponse2;
@@ -39064,12 +39064,12 @@ var init_EventStream = __esm({
39064
39064
  _EventStream_errored.set(this, false);
39065
39065
  _EventStream_aborted.set(this, false);
39066
39066
  _EventStream_catchingPromiseCreated.set(this, false);
39067
- __classPrivateFieldSet(this, _EventStream_connectedPromise, new Promise((resolve8, reject) => {
39068
- __classPrivateFieldSet(this, _EventStream_resolveConnectedPromise, resolve8, "f");
39067
+ __classPrivateFieldSet(this, _EventStream_connectedPromise, new Promise((resolve9, reject) => {
39068
+ __classPrivateFieldSet(this, _EventStream_resolveConnectedPromise, resolve9, "f");
39069
39069
  __classPrivateFieldSet(this, _EventStream_rejectConnectedPromise, reject, "f");
39070
39070
  }), "f");
39071
- __classPrivateFieldSet(this, _EventStream_endPromise, new Promise((resolve8, reject) => {
39072
- __classPrivateFieldSet(this, _EventStream_resolveEndPromise, resolve8, "f");
39071
+ __classPrivateFieldSet(this, _EventStream_endPromise, new Promise((resolve9, reject) => {
39072
+ __classPrivateFieldSet(this, _EventStream_resolveEndPromise, resolve9, "f");
39073
39073
  __classPrivateFieldSet(this, _EventStream_rejectEndPromise, reject, "f");
39074
39074
  }), "f");
39075
39075
  __classPrivateFieldGet(this, _EventStream_connectedPromise, "f").catch(() => {
@@ -39153,11 +39153,11 @@ var init_EventStream = __esm({
39153
39153
  * const message = await stream.emitted('message') // rejects if the stream errors
39154
39154
  */
39155
39155
  emitted(event) {
39156
- return new Promise((resolve8, reject) => {
39156
+ return new Promise((resolve9, reject) => {
39157
39157
  __classPrivateFieldSet(this, _EventStream_catchingPromiseCreated, true, "f");
39158
39158
  if (event !== "error")
39159
39159
  this.once("error", reject);
39160
- this.once(event, resolve8);
39160
+ this.once(event, resolve9);
39161
39161
  });
39162
39162
  }
39163
39163
  async done() {
@@ -40226,7 +40226,7 @@ var init_ChatCompletionStream = __esm({
40226
40226
  if (done) {
40227
40227
  return { value: void 0, done: true };
40228
40228
  }
40229
- return new Promise((resolve8, reject) => readQueue.push({ resolve: resolve8, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
40229
+ return new Promise((resolve9, reject) => readQueue.push({ resolve: resolve9, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
40230
40230
  }
40231
40231
  const chunk = pushQueue.shift();
40232
40232
  return { value: chunk, done: false };
@@ -41209,7 +41209,7 @@ var init_AssistantStream = __esm({
41209
41209
  if (done) {
41210
41210
  return { value: void 0, done: true };
41211
41211
  }
41212
- return new Promise((resolve8, reject) => readQueue.push({ resolve: resolve8, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
41212
+ return new Promise((resolve9, reject) => readQueue.push({ resolve: resolve9, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
41213
41213
  }
41214
41214
  const chunk = pushQueue.shift();
41215
41215
  return { value: chunk, done: false };
@@ -43498,7 +43498,7 @@ var init_ResponseStream = __esm({
43498
43498
  if (done) {
43499
43499
  return { value: void 0, done: true };
43500
43500
  }
43501
- return new Promise((resolve8, reject) => readQueue.push({ resolve: resolve8, reject })).then((event2) => event2 ? { value: event2, done: false } : { value: void 0, done: true });
43501
+ return new Promise((resolve9, reject) => readQueue.push({ resolve: resolve9, reject })).then((event2) => event2 ? { value: event2, done: false } : { value: void 0, done: true });
43502
43502
  }
43503
43503
  const event = pushQueue.shift();
43504
43504
  return { value: event, done: false };
@@ -63708,8 +63708,8 @@ var init_event_stream = __esm({
63708
63708
  constructor(isComplete, extractResult) {
63709
63709
  this.isComplete = isComplete;
63710
63710
  this.extractResult = extractResult;
63711
- this.finalResultPromise = new Promise((resolve8) => {
63712
- this.resolveFinalResult = resolve8;
63711
+ this.finalResultPromise = new Promise((resolve9) => {
63712
+ this.resolveFinalResult = resolve9;
63713
63713
  });
63714
63714
  }
63715
63715
  push(event) {
@@ -63743,7 +63743,7 @@ var init_event_stream = __esm({
63743
63743
  } else if (this.done) {
63744
63744
  return;
63745
63745
  } else {
63746
- const result = await new Promise((resolve8) => this.waiting.push(resolve8));
63746
+ const result = await new Promise((resolve9) => this.waiting.push(resolve9));
63747
63747
  if (result.done)
63748
63748
  return;
63749
63749
  yield result.value;
@@ -64014,7 +64014,7 @@ var init_sleep2 = __esm({
64014
64014
  "node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs"() {
64015
64015
  "use strict";
64016
64016
  init_esm_shims();
64017
- sleep3 = (ms2) => new Promise((resolve8) => setTimeout(resolve8, ms2));
64017
+ sleep3 = (ms2) => new Promise((resolve9) => setTimeout(resolve9, ms2));
64018
64018
  }
64019
64019
  });
64020
64020
 
@@ -64814,8 +64814,8 @@ var init_api_promise2 = __esm({
64814
64814
  init_parse2();
64815
64815
  APIPromise2 = class _APIPromise extends Promise {
64816
64816
  constructor(client, responsePromise, parseResponse2 = defaultParseResponse2) {
64817
- super((resolve8) => {
64818
- resolve8(null);
64817
+ super((resolve9) => {
64818
+ resolve9(null);
64819
64819
  });
64820
64820
  this.responsePromise = responsePromise;
64821
64821
  this.parseResponse = parseResponse2;
@@ -66776,12 +66776,12 @@ var init_BetaMessageStream = __esm({
66776
66776
  }
66777
66777
  return this._emit("error", new AnthropicError(String(error40)));
66778
66778
  });
66779
- __classPrivateFieldSet2(this, _BetaMessageStream_connectedPromise, new Promise((resolve8, reject) => {
66780
- __classPrivateFieldSet2(this, _BetaMessageStream_resolveConnectedPromise, resolve8, "f");
66779
+ __classPrivateFieldSet2(this, _BetaMessageStream_connectedPromise, new Promise((resolve9, reject) => {
66780
+ __classPrivateFieldSet2(this, _BetaMessageStream_resolveConnectedPromise, resolve9, "f");
66781
66781
  __classPrivateFieldSet2(this, _BetaMessageStream_rejectConnectedPromise, reject, "f");
66782
66782
  }), "f");
66783
- __classPrivateFieldSet2(this, _BetaMessageStream_endPromise, new Promise((resolve8, reject) => {
66784
- __classPrivateFieldSet2(this, _BetaMessageStream_resolveEndPromise, resolve8, "f");
66783
+ __classPrivateFieldSet2(this, _BetaMessageStream_endPromise, new Promise((resolve9, reject) => {
66784
+ __classPrivateFieldSet2(this, _BetaMessageStream_resolveEndPromise, resolve9, "f");
66785
66785
  __classPrivateFieldSet2(this, _BetaMessageStream_rejectEndPromise, reject, "f");
66786
66786
  }), "f");
66787
66787
  __classPrivateFieldGet2(this, _BetaMessageStream_connectedPromise, "f").catch(() => {
@@ -66951,11 +66951,11 @@ var init_BetaMessageStream = __esm({
66951
66951
  * const message = await stream.emitted('message') // rejects if the stream errors
66952
66952
  */
66953
66953
  emitted(event) {
66954
- return new Promise((resolve8, reject) => {
66954
+ return new Promise((resolve9, reject) => {
66955
66955
  __classPrivateFieldSet2(this, _BetaMessageStream_catchingPromiseCreated, true, "f");
66956
66956
  if (event !== "error")
66957
66957
  this.once("error", reject);
66958
- this.once(event, resolve8);
66958
+ this.once(event, resolve9);
66959
66959
  });
66960
66960
  }
66961
66961
  async done() {
@@ -67298,7 +67298,7 @@ var init_BetaMessageStream = __esm({
67298
67298
  if (done) {
67299
67299
  return { value: void 0, done: true };
67300
67300
  }
67301
- return new Promise((resolve8, reject) => readQueue.push({ resolve: resolve8, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
67301
+ return new Promise((resolve9, reject) => readQueue.push({ resolve: resolve9, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
67302
67302
  }
67303
67303
  const chunk = pushQueue.shift();
67304
67304
  return { value: chunk, done: false };
@@ -67373,13 +67373,13 @@ Wrap your summary in <summary></summary> tags.`;
67373
67373
 
67374
67374
  // node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs
67375
67375
  function promiseWithResolvers() {
67376
- let resolve8;
67376
+ let resolve9;
67377
67377
  let reject;
67378
67378
  const promise2 = new Promise((res, rej) => {
67379
- resolve8 = res;
67379
+ resolve9 = res;
67380
67380
  reject = rej;
67381
67381
  });
67382
- return { promise: promise2, resolve: resolve8, reject };
67382
+ return { promise: promise2, resolve: resolve9, reject };
67383
67383
  }
67384
67384
  async function generateToolResponse(params, lastMessage = params.messages.at(-1), requestOptions) {
67385
67385
  if (!lastMessage || lastMessage.role !== "assistant" || !lastMessage.content || typeof lastMessage.content === "string") {
@@ -69237,12 +69237,12 @@ var init_MessageStream = __esm({
69237
69237
  }
69238
69238
  return this._emit("error", new AnthropicError(String(error40)));
69239
69239
  });
69240
- __classPrivateFieldSet2(this, _MessageStream_connectedPromise, new Promise((resolve8, reject) => {
69241
- __classPrivateFieldSet2(this, _MessageStream_resolveConnectedPromise, resolve8, "f");
69240
+ __classPrivateFieldSet2(this, _MessageStream_connectedPromise, new Promise((resolve9, reject) => {
69241
+ __classPrivateFieldSet2(this, _MessageStream_resolveConnectedPromise, resolve9, "f");
69242
69242
  __classPrivateFieldSet2(this, _MessageStream_rejectConnectedPromise, reject, "f");
69243
69243
  }), "f");
69244
- __classPrivateFieldSet2(this, _MessageStream_endPromise, new Promise((resolve8, reject) => {
69245
- __classPrivateFieldSet2(this, _MessageStream_resolveEndPromise, resolve8, "f");
69244
+ __classPrivateFieldSet2(this, _MessageStream_endPromise, new Promise((resolve9, reject) => {
69245
+ __classPrivateFieldSet2(this, _MessageStream_resolveEndPromise, resolve9, "f");
69246
69246
  __classPrivateFieldSet2(this, _MessageStream_rejectEndPromise, reject, "f");
69247
69247
  }), "f");
69248
69248
  __classPrivateFieldGet2(this, _MessageStream_connectedPromise, "f").catch(() => {
@@ -69412,11 +69412,11 @@ var init_MessageStream = __esm({
69412
69412
  * const message = await stream.emitted('message') // rejects if the stream errors
69413
69413
  */
69414
69414
  emitted(event) {
69415
- return new Promise((resolve8, reject) => {
69415
+ return new Promise((resolve9, reject) => {
69416
69416
  __classPrivateFieldSet2(this, _MessageStream_catchingPromiseCreated, true, "f");
69417
69417
  if (event !== "error")
69418
69418
  this.once("error", reject);
69419
- this.once(event, resolve8);
69419
+ this.once(event, resolve9);
69420
69420
  });
69421
69421
  }
69422
69422
  async done() {
@@ -69734,7 +69734,7 @@ var init_MessageStream = __esm({
69734
69734
  if (done) {
69735
69735
  return { value: void 0, done: true };
69736
69736
  }
69737
- return new Promise((resolve8, reject) => readQueue.push({ resolve: resolve8, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
69737
+ return new Promise((resolve9, reject) => readQueue.push({ resolve: resolve9, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
69738
69738
  }
69739
69739
  const chunk = pushQueue.shift();
69740
69740
  return { value: chunk, done: false };
@@ -73112,7 +73112,7 @@ var require_p_retry = __commonJS({
73112
73112
  return error40;
73113
73113
  };
73114
73114
  var isNetworkError = (errorMessage) => networkErrorMsgs.includes(errorMessage);
73115
- var pRetry2 = (input, options) => new Promise((resolve8, reject) => {
73115
+ var pRetry2 = (input, options) => new Promise((resolve9, reject) => {
73116
73116
  options = {
73117
73117
  onFailedAttempt: () => {
73118
73118
  },
@@ -73122,7 +73122,7 @@ var require_p_retry = __commonJS({
73122
73122
  const operation = retry2.operation(options);
73123
73123
  operation.attempt(async (attemptNumber) => {
73124
73124
  try {
73125
- resolve8(await input(attemptNumber));
73125
+ resolve9(await input(attemptNumber));
73126
73126
  } catch (error40) {
73127
73127
  if (!(error40 instanceof Error)) {
73128
73128
  reject(new TypeError(`Non-error was thrown: "${error40}". You should only throw errors.`));
@@ -73660,8 +73660,8 @@ var require_retry3 = __commonJS({
73660
73660
  }
73661
73661
  const delay2 = getNextRetryDelay(config2);
73662
73662
  err.config.retryConfig.currentRetryAttempt += 1;
73663
- const backoff = config2.retryBackoff ? config2.retryBackoff(err, delay2) : new Promise((resolve8) => {
73664
- setTimeout(resolve8, delay2);
73663
+ const backoff = config2.retryBackoff ? config2.retryBackoff(err, delay2) : new Promise((resolve9) => {
73664
+ setTimeout(resolve9, delay2);
73665
73665
  });
73666
73666
  if (config2.onRetryAttempt) {
73667
73667
  await config2.onRetryAttempt(err);
@@ -74578,8 +74578,8 @@ var require_helpers = __commonJS({
74578
74578
  function req(url2, opts = {}) {
74579
74579
  const href = typeof url2 === "string" ? url2 : url2.href;
74580
74580
  const req2 = (href.startsWith("https:") ? https2 : http3).request(url2, opts);
74581
- const promise2 = new Promise((resolve8, reject) => {
74582
- req2.once("response", resolve8).once("error", reject).end();
74581
+ const promise2 = new Promise((resolve9, reject) => {
74582
+ req2.once("response", resolve9).once("error", reject).end();
74583
74583
  });
74584
74584
  req2.then = promise2.then.bind(promise2);
74585
74585
  return req2;
@@ -74758,7 +74758,7 @@ var require_parse_proxy_response = __commonJS({
74758
74758
  var debug_1 = __importDefault(require_src2());
74759
74759
  var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
74760
74760
  function parseProxyResponse(socket) {
74761
- return new Promise((resolve8, reject) => {
74761
+ return new Promise((resolve9, reject) => {
74762
74762
  let buffersLength = 0;
74763
74763
  const buffers = [];
74764
74764
  function read() {
@@ -74824,7 +74824,7 @@ var require_parse_proxy_response = __commonJS({
74824
74824
  }
74825
74825
  debug("got proxy server response: %o %o", firstLine, headers);
74826
74826
  cleanup();
74827
- resolve8({
74827
+ resolve9({
74828
74828
  connect: {
74829
74829
  statusCode,
74830
74830
  statusText,
@@ -75071,7 +75071,7 @@ var require_ponyfill_es2018 = __commonJS({
75071
75071
  return new originalPromise(executor);
75072
75072
  }
75073
75073
  function promiseResolvedWith(value) {
75074
- return newPromise((resolve8) => resolve8(value));
75074
+ return newPromise((resolve9) => resolve9(value));
75075
75075
  }
75076
75076
  function promiseRejectedWith(reason) {
75077
75077
  return originalPromiseReject(reason);
@@ -75241,8 +75241,8 @@ var require_ponyfill_es2018 = __commonJS({
75241
75241
  return new TypeError("Cannot " + name + " a stream using a released reader");
75242
75242
  }
75243
75243
  function defaultReaderClosedPromiseInitialize(reader2) {
75244
- reader2._closedPromise = newPromise((resolve8, reject) => {
75245
- reader2._closedPromise_resolve = resolve8;
75244
+ reader2._closedPromise = newPromise((resolve9, reject) => {
75245
+ reader2._closedPromise_resolve = resolve9;
75246
75246
  reader2._closedPromise_reject = reject;
75247
75247
  });
75248
75248
  }
@@ -75416,8 +75416,8 @@ var require_ponyfill_es2018 = __commonJS({
75416
75416
  }
75417
75417
  let resolvePromise;
75418
75418
  let rejectPromise;
75419
- const promise2 = newPromise((resolve8, reject) => {
75420
- resolvePromise = resolve8;
75419
+ const promise2 = newPromise((resolve9, reject) => {
75420
+ resolvePromise = resolve9;
75421
75421
  rejectPromise = reject;
75422
75422
  });
75423
75423
  const readRequest = {
@@ -75522,8 +75522,8 @@ var require_ponyfill_es2018 = __commonJS({
75522
75522
  const reader2 = this._reader;
75523
75523
  let resolvePromise;
75524
75524
  let rejectPromise;
75525
- const promise2 = newPromise((resolve8, reject) => {
75526
- resolvePromise = resolve8;
75525
+ const promise2 = newPromise((resolve9, reject) => {
75526
+ resolvePromise = resolve9;
75527
75527
  rejectPromise = reject;
75528
75528
  });
75529
75529
  const readRequest = {
@@ -76542,8 +76542,8 @@ var require_ponyfill_es2018 = __commonJS({
76542
76542
  }
76543
76543
  let resolvePromise;
76544
76544
  let rejectPromise;
76545
- const promise2 = newPromise((resolve8, reject) => {
76546
- resolvePromise = resolve8;
76545
+ const promise2 = newPromise((resolve9, reject) => {
76546
+ resolvePromise = resolve9;
76547
76547
  rejectPromise = reject;
76548
76548
  });
76549
76549
  const readIntoRequest = {
@@ -76855,10 +76855,10 @@ var require_ponyfill_es2018 = __commonJS({
76855
76855
  wasAlreadyErroring = true;
76856
76856
  reason = void 0;
76857
76857
  }
76858
- const promise2 = newPromise((resolve8, reject) => {
76858
+ const promise2 = newPromise((resolve9, reject) => {
76859
76859
  stream2._pendingAbortRequest = {
76860
76860
  _promise: void 0,
76861
- _resolve: resolve8,
76861
+ _resolve: resolve9,
76862
76862
  _reject: reject,
76863
76863
  _reason: reason,
76864
76864
  _wasAlreadyErroring: wasAlreadyErroring
@@ -76875,9 +76875,9 @@ var require_ponyfill_es2018 = __commonJS({
76875
76875
  if (state === "closed" || state === "errored") {
76876
76876
  return promiseRejectedWith(new TypeError(`The stream (in ${state} state) is not in the writable state and cannot be closed`));
76877
76877
  }
76878
- const promise2 = newPromise((resolve8, reject) => {
76878
+ const promise2 = newPromise((resolve9, reject) => {
76879
76879
  const closeRequest = {
76880
- _resolve: resolve8,
76880
+ _resolve: resolve9,
76881
76881
  _reject: reject
76882
76882
  };
76883
76883
  stream2._closeRequest = closeRequest;
@@ -76890,9 +76890,9 @@ var require_ponyfill_es2018 = __commonJS({
76890
76890
  return promise2;
76891
76891
  }
76892
76892
  function WritableStreamAddWriteRequest(stream2) {
76893
- const promise2 = newPromise((resolve8, reject) => {
76893
+ const promise2 = newPromise((resolve9, reject) => {
76894
76894
  const writeRequest = {
76895
- _resolve: resolve8,
76895
+ _resolve: resolve9,
76896
76896
  _reject: reject
76897
76897
  };
76898
76898
  stream2._writeRequests.push(writeRequest);
@@ -77508,8 +77508,8 @@ var require_ponyfill_es2018 = __commonJS({
77508
77508
  return new TypeError("Cannot " + name + " a stream using a released writer");
77509
77509
  }
77510
77510
  function defaultWriterClosedPromiseInitialize(writer) {
77511
- writer._closedPromise = newPromise((resolve8, reject) => {
77512
- writer._closedPromise_resolve = resolve8;
77511
+ writer._closedPromise = newPromise((resolve9, reject) => {
77512
+ writer._closedPromise_resolve = resolve9;
77513
77513
  writer._closedPromise_reject = reject;
77514
77514
  writer._closedPromiseState = "pending";
77515
77515
  });
@@ -77545,8 +77545,8 @@ var require_ponyfill_es2018 = __commonJS({
77545
77545
  writer._closedPromiseState = "resolved";
77546
77546
  }
77547
77547
  function defaultWriterReadyPromiseInitialize(writer) {
77548
- writer._readyPromise = newPromise((resolve8, reject) => {
77549
- writer._readyPromise_resolve = resolve8;
77548
+ writer._readyPromise = newPromise((resolve9, reject) => {
77549
+ writer._readyPromise_resolve = resolve9;
77550
77550
  writer._readyPromise_reject = reject;
77551
77551
  });
77552
77552
  writer._readyPromiseState = "pending";
@@ -77633,7 +77633,7 @@ var require_ponyfill_es2018 = __commonJS({
77633
77633
  source._disturbed = true;
77634
77634
  let shuttingDown = false;
77635
77635
  let currentWrite = promiseResolvedWith(void 0);
77636
- return newPromise((resolve8, reject) => {
77636
+ return newPromise((resolve9, reject) => {
77637
77637
  let abortAlgorithm;
77638
77638
  if (signal !== void 0) {
77639
77639
  abortAlgorithm = () => {
@@ -77778,7 +77778,7 @@ var require_ponyfill_es2018 = __commonJS({
77778
77778
  if (isError) {
77779
77779
  reject(error40);
77780
77780
  } else {
77781
- resolve8(void 0);
77781
+ resolve9(void 0);
77782
77782
  }
77783
77783
  return null;
77784
77784
  }
@@ -78059,8 +78059,8 @@ var require_ponyfill_es2018 = __commonJS({
78059
78059
  let branch1;
78060
78060
  let branch2;
78061
78061
  let resolveCancelPromise;
78062
- const cancelPromise = newPromise((resolve8) => {
78063
- resolveCancelPromise = resolve8;
78062
+ const cancelPromise = newPromise((resolve9) => {
78063
+ resolveCancelPromise = resolve9;
78064
78064
  });
78065
78065
  function pullAlgorithm() {
78066
78066
  if (reading) {
@@ -78151,8 +78151,8 @@ var require_ponyfill_es2018 = __commonJS({
78151
78151
  let branch1;
78152
78152
  let branch2;
78153
78153
  let resolveCancelPromise;
78154
- const cancelPromise = newPromise((resolve8) => {
78155
- resolveCancelPromise = resolve8;
78154
+ const cancelPromise = newPromise((resolve9) => {
78155
+ resolveCancelPromise = resolve9;
78156
78156
  });
78157
78157
  function forwardReaderError(thisReader) {
78158
78158
  uponRejection(thisReader._closedPromise, (r6) => {
@@ -78932,8 +78932,8 @@ var require_ponyfill_es2018 = __commonJS({
78932
78932
  const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);
78933
78933
  const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);
78934
78934
  let startPromise_resolve;
78935
- const startPromise = newPromise((resolve8) => {
78936
- startPromise_resolve = resolve8;
78935
+ const startPromise = newPromise((resolve9) => {
78936
+ startPromise_resolve = resolve9;
78937
78937
  });
78938
78938
  InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
78939
78939
  SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
@@ -79026,8 +79026,8 @@ var require_ponyfill_es2018 = __commonJS({
79026
79026
  if (stream2._backpressureChangePromise !== void 0) {
79027
79027
  stream2._backpressureChangePromise_resolve();
79028
79028
  }
79029
- stream2._backpressureChangePromise = newPromise((resolve8) => {
79030
- stream2._backpressureChangePromise_resolve = resolve8;
79029
+ stream2._backpressureChangePromise = newPromise((resolve9) => {
79030
+ stream2._backpressureChangePromise_resolve = resolve9;
79031
79031
  });
79032
79032
  stream2._backpressure = backpressure;
79033
79033
  }
@@ -79195,8 +79195,8 @@ var require_ponyfill_es2018 = __commonJS({
79195
79195
  return controller._finishPromise;
79196
79196
  }
79197
79197
  const readable = stream2._readable;
79198
- controller._finishPromise = newPromise((resolve8, reject) => {
79199
- controller._finishPromise_resolve = resolve8;
79198
+ controller._finishPromise = newPromise((resolve9, reject) => {
79199
+ controller._finishPromise_resolve = resolve9;
79200
79200
  controller._finishPromise_reject = reject;
79201
79201
  });
79202
79202
  const cancelPromise = controller._cancelAlgorithm(reason);
@@ -79222,8 +79222,8 @@ var require_ponyfill_es2018 = __commonJS({
79222
79222
  return controller._finishPromise;
79223
79223
  }
79224
79224
  const readable = stream2._readable;
79225
- controller._finishPromise = newPromise((resolve8, reject) => {
79226
- controller._finishPromise_resolve = resolve8;
79225
+ controller._finishPromise = newPromise((resolve9, reject) => {
79226
+ controller._finishPromise_resolve = resolve9;
79227
79227
  controller._finishPromise_reject = reject;
79228
79228
  });
79229
79229
  const flushPromise = controller._flushAlgorithm();
@@ -79253,8 +79253,8 @@ var require_ponyfill_es2018 = __commonJS({
79253
79253
  return controller._finishPromise;
79254
79254
  }
79255
79255
  const writable = stream2._writable;
79256
- controller._finishPromise = newPromise((resolve8, reject) => {
79257
- controller._finishPromise_resolve = resolve8;
79256
+ controller._finishPromise = newPromise((resolve9, reject) => {
79257
+ controller._finishPromise_resolve = resolve9;
79258
79258
  controller._finishPromise_reject = reject;
79259
79259
  });
79260
79260
  const cancelPromise = controller._cancelAlgorithm(reason);
@@ -81241,7 +81241,7 @@ import zlib from "zlib";
81241
81241
  import Stream4, { PassThrough as PassThrough2, pipeline as pump } from "stream";
81242
81242
  import { Buffer as Buffer3 } from "buffer";
81243
81243
  async function fetch2(url2, options_) {
81244
- return new Promise((resolve8, reject) => {
81244
+ return new Promise((resolve9, reject) => {
81245
81245
  const request = new Request2(url2, options_);
81246
81246
  const { parsedURL, options } = getNodeRequestOptions(request);
81247
81247
  if (!supportedSchemas.has(parsedURL.protocol)) {
@@ -81250,7 +81250,7 @@ async function fetch2(url2, options_) {
81250
81250
  if (parsedURL.protocol === "data:") {
81251
81251
  const data = dist_default(request.url);
81252
81252
  const response2 = new Response2(data, { headers: { "Content-Type": data.typeFull } });
81253
- resolve8(response2);
81253
+ resolve9(response2);
81254
81254
  return;
81255
81255
  }
81256
81256
  const send = (parsedURL.protocol === "https:" ? https : http2).request;
@@ -81372,7 +81372,7 @@ async function fetch2(url2, options_) {
81372
81372
  if (responseReferrerPolicy) {
81373
81373
  requestOptions.referrerPolicy = responseReferrerPolicy;
81374
81374
  }
81375
- resolve8(fetch2(new Request2(locationURL, requestOptions)));
81375
+ resolve9(fetch2(new Request2(locationURL, requestOptions)));
81376
81376
  finalize();
81377
81377
  return;
81378
81378
  }
@@ -81405,7 +81405,7 @@ async function fetch2(url2, options_) {
81405
81405
  const codings = headers.get("Content-Encoding");
81406
81406
  if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
81407
81407
  response = new Response2(body, responseOptions);
81408
- resolve8(response);
81408
+ resolve9(response);
81409
81409
  return;
81410
81410
  }
81411
81411
  const zlibOptions = {
@@ -81419,7 +81419,7 @@ async function fetch2(url2, options_) {
81419
81419
  }
81420
81420
  });
81421
81421
  response = new Response2(body, responseOptions);
81422
- resolve8(response);
81422
+ resolve9(response);
81423
81423
  return;
81424
81424
  }
81425
81425
  if (codings === "deflate" || codings === "x-deflate") {
@@ -81443,12 +81443,12 @@ async function fetch2(url2, options_) {
81443
81443
  });
81444
81444
  }
81445
81445
  response = new Response2(body, responseOptions);
81446
- resolve8(response);
81446
+ resolve9(response);
81447
81447
  });
81448
81448
  raw.once("end", () => {
81449
81449
  if (!response) {
81450
81450
  response = new Response2(body, responseOptions);
81451
- resolve8(response);
81451
+ resolve9(response);
81452
81452
  }
81453
81453
  });
81454
81454
  return;
@@ -81460,11 +81460,11 @@ async function fetch2(url2, options_) {
81460
81460
  }
81461
81461
  });
81462
81462
  response = new Response2(body, responseOptions);
81463
- resolve8(response);
81463
+ resolve9(response);
81464
81464
  return;
81465
81465
  }
81466
81466
  response = new Response2(body, responseOptions);
81467
- resolve8(response);
81467
+ resolve9(response);
81468
81468
  });
81469
81469
  writeToStream(request_, request).catch(reject);
81470
81470
  });
@@ -87587,7 +87587,7 @@ var require_jwtaccess = __commonJS({
87587
87587
  }
87588
87588
  }
87589
87589
  fromStreamAsync(inputStream) {
87590
- return new Promise((resolve8, reject) => {
87590
+ return new Promise((resolve9, reject) => {
87591
87591
  if (!inputStream) {
87592
87592
  reject(new Error("Must pass in a stream containing the service account auth settings."));
87593
87593
  }
@@ -87596,7 +87596,7 @@ var require_jwtaccess = __commonJS({
87596
87596
  try {
87597
87597
  const data = JSON.parse(s4);
87598
87598
  this.fromJSON(data);
87599
- resolve8();
87599
+ resolve9();
87600
87600
  } catch (err) {
87601
87601
  reject(err);
87602
87602
  }
@@ -87836,7 +87836,7 @@ var require_jwtclient = __commonJS({
87836
87836
  }
87837
87837
  }
87838
87838
  fromStreamAsync(inputStream) {
87839
- return new Promise((resolve8, reject) => {
87839
+ return new Promise((resolve9, reject) => {
87840
87840
  if (!inputStream) {
87841
87841
  throw new Error("Must pass in a stream containing the service account auth settings.");
87842
87842
  }
@@ -87845,7 +87845,7 @@ var require_jwtclient = __commonJS({
87845
87845
  try {
87846
87846
  const data = JSON.parse(s4);
87847
87847
  this.fromJSON(data);
87848
- resolve8();
87848
+ resolve9();
87849
87849
  } catch (e5) {
87850
87850
  reject(e5);
87851
87851
  }
@@ -87979,7 +87979,7 @@ var require_refreshclient = __commonJS({
87979
87979
  }
87980
87980
  }
87981
87981
  async fromStreamAsync(inputStream) {
87982
- return new Promise((resolve8, reject) => {
87982
+ return new Promise((resolve9, reject) => {
87983
87983
  if (!inputStream) {
87984
87984
  return reject(new Error("Must pass in a stream containing the user refresh token."));
87985
87985
  }
@@ -87988,7 +87988,7 @@ var require_refreshclient = __commonJS({
87988
87988
  try {
87989
87989
  const data = JSON.parse(s4);
87990
87990
  this.fromJSON(data);
87991
- return resolve8();
87991
+ return resolve9();
87992
87992
  } catch (err) {
87993
87993
  return reject(err);
87994
87994
  }
@@ -89834,7 +89834,7 @@ var require_pluggable_auth_handler = __commonJS({
89834
89834
  * @return A promise that resolves with the executable response.
89835
89835
  */
89836
89836
  retrieveResponseFromExecutable(envMap) {
89837
- return new Promise((resolve8, reject) => {
89837
+ return new Promise((resolve9, reject) => {
89838
89838
  const child = childProcess.spawn(this.commandComponents[0], this.commandComponents.slice(1), {
89839
89839
  env: { ...process.env, ...Object.fromEntries(envMap) }
89840
89840
  });
@@ -89856,7 +89856,7 @@ var require_pluggable_auth_handler = __commonJS({
89856
89856
  try {
89857
89857
  const responseJson = JSON.parse(output);
89858
89858
  const response = new executable_response_1.ExecutableResponse(responseJson);
89859
- return resolve8(response);
89859
+ return resolve9(response);
89860
89860
  } catch (error40) {
89861
89861
  if (error40 instanceof executable_response_1.ExecutableResponseError) {
89862
89862
  return reject(error40);
@@ -91051,7 +91051,7 @@ var require_googleauth = __commonJS({
91051
91051
  }
91052
91052
  }
91053
91053
  fromStreamAsync(inputStream, options) {
91054
- return new Promise((resolve8, reject) => {
91054
+ return new Promise((resolve9, reject) => {
91055
91055
  if (!inputStream) {
91056
91056
  throw new Error("Must pass in a stream containing the Google auth settings.");
91057
91057
  }
@@ -91061,7 +91061,7 @@ var require_googleauth = __commonJS({
91061
91061
  try {
91062
91062
  const data = JSON.parse(chunks.join(""));
91063
91063
  const r6 = this._cacheClientFromJSON(data, options);
91064
- return resolve8(r6);
91064
+ return resolve9(r6);
91065
91065
  } catch (err) {
91066
91066
  if (!this.keyFilename)
91067
91067
  throw err;
@@ -91071,7 +91071,7 @@ var require_googleauth = __commonJS({
91071
91071
  });
91072
91072
  this.cachedCredential = client;
91073
91073
  this.setGapicJWTValues(client);
91074
- return resolve8(client);
91074
+ return resolve9(client);
91075
91075
  }
91076
91076
  } catch (err) {
91077
91077
  return reject(err);
@@ -91107,17 +91107,17 @@ var require_googleauth = __commonJS({
91107
91107
  * Run the Google Cloud SDK command that prints the default project ID
91108
91108
  */
91109
91109
  async getDefaultServiceProjectId() {
91110
- return new Promise((resolve8) => {
91110
+ return new Promise((resolve9) => {
91111
91111
  (0, child_process_1.exec)("gcloud config config-helper --format json", (err, stdout2) => {
91112
91112
  if (!err && stdout2) {
91113
91113
  try {
91114
91114
  const projectId = JSON.parse(stdout2).configuration.properties.core.project;
91115
- resolve8(projectId);
91115
+ resolve9(projectId);
91116
91116
  return;
91117
91117
  } catch (e5) {
91118
91118
  }
91119
91119
  }
91120
- resolve8(null);
91120
+ resolve9(null);
91121
91121
  });
91122
91122
  });
91123
91123
  }
@@ -98795,14 +98795,14 @@ function __asyncValues(o4) {
98795
98795
  }, i4);
98796
98796
  function verb(n3) {
98797
98797
  i4[n3] = o4[n3] && function(v6) {
98798
- return new Promise(function(resolve8, reject) {
98799
- v6 = o4[n3](v6), settle(resolve8, reject, v6.done, v6.value);
98798
+ return new Promise(function(resolve9, reject) {
98799
+ v6 = o4[n3](v6), settle(resolve9, reject, v6.done, v6.value);
98800
98800
  });
98801
98801
  };
98802
98802
  }
98803
- function settle(resolve8, reject, d4, v6) {
98803
+ function settle(resolve9, reject, d4, v6) {
98804
98804
  Promise.resolve(v6).then(function(v7) {
98805
- resolve8({ value: v7, done: d4 });
98805
+ resolve9({ value: v7, done: d4 });
98806
98806
  }, reject);
98807
98807
  }
98808
98808
  }
@@ -109172,8 +109172,8 @@ var init_node = __esm({
109172
109172
  const url2 = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.BidiGenerateMusic?key=${apiKey}`;
109173
109173
  let onopenResolve = () => {
109174
109174
  };
109175
- const onopenPromise = new Promise((resolve8) => {
109176
- onopenResolve = resolve8;
109175
+ const onopenPromise = new Promise((resolve9) => {
109176
+ onopenResolve = resolve9;
109177
109177
  });
109178
109178
  const callbacks = params.callbacks;
109179
109179
  const onopenAwaitedCallback = function() {
@@ -109379,8 +109379,8 @@ var init_node = __esm({
109379
109379
  }
109380
109380
  let onopenResolve = () => {
109381
109381
  };
109382
- const onopenPromise = new Promise((resolve8) => {
109383
- onopenResolve = resolve8;
109382
+ const onopenPromise = new Promise((resolve9) => {
109383
+ onopenResolve = resolve9;
109384
109384
  });
109385
109385
  const callbacks = params.callbacks;
109386
109386
  const onopenAwaitedCallback = function() {
@@ -111728,7 +111728,7 @@ var init_node = __esm({
111728
111728
  return void 0;
111729
111729
  }
111730
111730
  };
111731
- sleep$1 = (ms2) => new Promise((resolve8) => setTimeout(resolve8, ms2));
111731
+ sleep$1 = (ms2) => new Promise((resolve9) => setTimeout(resolve9, ms2));
111732
111732
  FallbackEncoder3 = ({ headers, body }) => {
111733
111733
  return {
111734
111734
  bodyHeaders: {
@@ -112237,8 +112237,8 @@ ${underline}`);
112237
112237
  };
112238
112238
  APIPromise3 = class _APIPromise extends Promise {
112239
112239
  constructor(client, responsePromise, parseResponse2 = defaultParseResponse3) {
112240
- super((resolve8) => {
112241
- resolve8(null);
112240
+ super((resolve9) => {
112241
+ resolve9(null);
112242
112242
  });
112243
112243
  this.responsePromise = responsePromise;
112244
112244
  this.parseResponse = parseResponse2;
@@ -127208,7 +127208,7 @@ function retryIntervalFromResponse(res) {
127208
127208
  return 0;
127209
127209
  }
127210
127210
  async function delay(delay2) {
127211
- return new Promise((resolve8) => setTimeout(resolve8, delay2));
127211
+ return new Promise((resolve9) => setTimeout(resolve9, delay2));
127212
127212
  }
127213
127213
  var defaultBackoff, PermanentError, TemporaryError, codeRangeRE2;
127214
127214
  var init_retries = __esm({
@@ -168911,12 +168911,12 @@ function capRetryDelayMs(delayMs, options) {
168911
168911
  return maxRetryDelayMs > 0 ? Math.min(delayMs, maxRetryDelayMs) : delayMs;
168912
168912
  }
168913
168913
  function sleep5(ms2, signal) {
168914
- return new Promise((resolve8, reject) => {
168914
+ return new Promise((resolve9, reject) => {
168915
168915
  if (signal?.aborted) {
168916
168916
  reject(new Error("Request was aborted"));
168917
168917
  return;
168918
168918
  }
168919
- const timeout = setTimeout(resolve8, ms2);
168919
+ const timeout = setTimeout(resolve9, ms2);
168920
168920
  signal?.addEventListener("abort", () => {
168921
168921
  clearTimeout(timeout);
168922
168922
  reject(new Error("Request was aborted"));
@@ -169248,7 +169248,7 @@ async function connectWebSocket(url2, headers, signal, connectTimeoutMs = DEFAUL
169248
169248
  }
169249
169249
  const wsHeaders = headersToRecord(headers);
169250
169250
  delete wsHeaders["OpenAI-Beta"];
169251
- return new Promise((resolve8, reject) => {
169251
+ return new Promise((resolve9, reject) => {
169252
169252
  let settled = false;
169253
169253
  let timeout;
169254
169254
  let socket;
@@ -169283,7 +169283,7 @@ async function connectWebSocket(url2, headers, signal, connectTimeoutMs = DEFAUL
169283
169283
  return;
169284
169284
  settled = true;
169285
169285
  cleanup();
169286
- resolve8(socket);
169286
+ resolve9(socket);
169287
169287
  };
169288
169288
  const onError = (event) => {
169289
169289
  fail2(extractWebSocketError(event));
@@ -169440,9 +169440,9 @@ async function* parseWebSocket(socket, signal, idleTimeoutMs) {
169440
169440
  const wake = () => {
169441
169441
  if (!pending)
169442
169442
  return;
169443
- const resolve8 = pending;
169443
+ const resolve9 = pending;
169444
169444
  pending = null;
169445
- resolve8();
169445
+ resolve9();
169446
169446
  };
169447
169447
  const onMessage = (event) => {
169448
169448
  void (async () => {
@@ -169509,8 +169509,8 @@ async function* parseWebSocket(socket, signal, idleTimeoutMs) {
169509
169509
  if (done)
169510
169510
  break;
169511
169511
  let timeout;
169512
- await new Promise((resolve8, reject) => {
169513
- pending = resolve8;
169512
+ await new Promise((resolve9, reject) => {
169513
+ pending = resolve9;
169514
169514
  if (idleTimeoutMs !== void 0 && idleTimeoutMs > 0) {
169515
169515
  timeout = setTimeout(() => {
169516
169516
  const error40 = new Error(`WebSocket idle timeout after ${idleTimeoutMs}ms`);
@@ -185438,14 +185438,14 @@ async function executeVectorBackfill(request) {
185438
185438
  return worker.runOnce();
185439
185439
  }
185440
185440
  async function readStdin() {
185441
- return new Promise((resolve8, reject) => {
185441
+ return new Promise((resolve9, reject) => {
185442
185442
  let raw = "";
185443
185443
  process.stdin.setEncoding("utf8");
185444
185444
  process.stdin.on("data", (chunk) => {
185445
185445
  raw += chunk;
185446
185446
  });
185447
185447
  process.stdin.once("error", reject);
185448
- process.stdin.once("end", () => resolve8(raw));
185448
+ process.stdin.once("end", () => resolve9(raw));
185449
185449
  });
185450
185450
  }
185451
185451
  async function main() {
@@ -186818,7 +186818,7 @@ async function attachCachedVectors(database, candidates) {
186818
186818
  } catch {
186819
186819
  }
186820
186820
  if (index % 50 === 0) {
186821
- await new Promise((resolve8) => setImmediate(resolve8));
186821
+ await new Promise((resolve9) => setImmediate(resolve9));
186822
186822
  }
186823
186823
  }
186824
186824
  }
@@ -186894,7 +186894,7 @@ async function hydrateIndex(observations2, options = {}) {
186894
186894
  }
186895
186895
  }
186896
186896
  }
186897
- await new Promise((resolve8) => setImmediate(resolve8));
186897
+ await new Promise((resolve9) => setImmediate(resolve9));
186898
186898
  }
186899
186899
  deferredCachedVectorHydration = options.skipCachedVectors ? null : deferCachedVectors ? attachCachedVectors(database, candidates).catch(() => {
186900
186900
  }) : null;
@@ -193365,6 +193365,15 @@ var init_registry2 = __esm({
193365
193365
  install: "memorix setup --agent copilot",
193366
193366
  surfaces: ["MCP", "skills", "hooks"]
193367
193367
  },
193368
+ {
193369
+ agent: "grok",
193370
+ name: "Grok Build",
193371
+ entry: "official-config",
193372
+ status: "ready",
193373
+ install: "memorix setup --agent grok --global",
193374
+ surfaces: ["hooks", "AGENTS.md"],
193375
+ note: "Writes ~/.grok/hooks/memorix.json and leaves Grok MCP host-owned; setup does not write config.toml."
193376
+ },
193368
193377
  {
193369
193378
  agent: "cursor",
193370
193379
  name: "Cursor",
@@ -193879,6 +193888,9 @@ function resolveHookCommand() {
193879
193888
  }
193880
193889
  return "memorix";
193881
193890
  }
193891
+ function getGrokHome() {
193892
+ return process.env.GROK_HOME?.trim() || path30.join(os5.homedir(), ".grok");
193893
+ }
193882
193894
  function resolveWindowsMemorixShim() {
193883
193895
  try {
193884
193896
  const output = String(execSync2("where.exe memorix.cmd", {
@@ -193912,6 +193924,90 @@ function generateClaudeConfig() {
193912
193924
  }
193913
193925
  };
193914
193926
  }
193927
+ function generateGrokConfig() {
193928
+ const cmd = `${resolveHookCommand()} hook --agent grok`;
193929
+ const hookEntry = {
193930
+ type: "command",
193931
+ command: cmd,
193932
+ timeout: 10
193933
+ };
193934
+ return {
193935
+ hooks: {
193936
+ SessionStart: [{ hooks: [hookEntry] }],
193937
+ SessionEnd: [{ hooks: [hookEntry] }],
193938
+ PostToolUse: [{ hooks: [hookEntry] }],
193939
+ PostToolUseFailure: [{ hooks: [hookEntry] }],
193940
+ UserPromptSubmit: [{ hooks: [hookEntry] }],
193941
+ PreCompact: [{ hooks: [hookEntry] }],
193942
+ PostCompact: [{ hooks: [hookEntry] }],
193943
+ Stop: [{ hooks: [hookEntry] }],
193944
+ StopFailure: [{ hooks: [hookEntry] }]
193945
+ }
193946
+ };
193947
+ }
193948
+ function isJsonRecord(value) {
193949
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
193950
+ }
193951
+ function isMemorixGrokCommand(value) {
193952
+ return value === "memorix hook --agent grok" || value === "memorix.cmd hook --agent grok";
193953
+ }
193954
+ function isMemorixGrokHook(value) {
193955
+ return isJsonRecord(value) && value.type === "command" && isMemorixGrokCommand(value.command);
193956
+ }
193957
+ function mergeGrokHookConfig(existing, generated) {
193958
+ const merged = { ...existing };
193959
+ const existingHooks = isJsonRecord(existing.hooks) ? { ...existing.hooks } : {};
193960
+ const generatedHooks = isJsonRecord(generated.hooks) ? generated.hooks : {};
193961
+ for (const [event, generatedGroups] of Object.entries(generatedHooks)) {
193962
+ const currentGroups = Array.isArray(existingHooks[event]) ? existingHooks[event] : [];
193963
+ const preservedGroups = currentGroups.flatMap((group) => {
193964
+ if (!isJsonRecord(group) || !Array.isArray(group.hooks)) return [group];
193965
+ const preservedHooks = group.hooks.filter((hook) => !isMemorixGrokHook(hook));
193966
+ if (preservedHooks.length === 0) return [];
193967
+ return [{ ...group, hooks: preservedHooks }];
193968
+ });
193969
+ existingHooks[event] = [...preservedGroups, ...Array.isArray(generatedGroups) ? generatedGroups : []];
193970
+ }
193971
+ merged.hooks = existingHooks;
193972
+ return merged;
193973
+ }
193974
+ function removeMemorixGrokHooks(config2) {
193975
+ const cleaned = { ...config2 };
193976
+ const hooks = isJsonRecord(config2.hooks) ? { ...config2.hooks } : null;
193977
+ if (!hooks) return cleaned;
193978
+ for (const [event, groups] of Object.entries(hooks)) {
193979
+ if (!Array.isArray(groups)) continue;
193980
+ const preservedGroups = groups.flatMap((group) => {
193981
+ if (!isJsonRecord(group) || !Array.isArray(group.hooks)) return [group];
193982
+ const preservedHooks = group.hooks.filter((hook) => !isMemorixGrokHook(hook));
193983
+ if (preservedHooks.length === 0) return [];
193984
+ return [{ ...group, hooks: preservedHooks }];
193985
+ });
193986
+ if (preservedGroups.length > 0) hooks[event] = preservedGroups;
193987
+ else delete hooks[event];
193988
+ }
193989
+ if (Object.keys(hooks).length > 0) cleaned.hooks = hooks;
193990
+ else delete cleaned.hooks;
193991
+ return cleaned;
193992
+ }
193993
+ async function readGrokHookConfig(configPath) {
193994
+ let content;
193995
+ try {
193996
+ content = await fs19.readFile(configPath, "utf-8");
193997
+ } catch (error40) {
193998
+ if (error40.code === "ENOENT") return {};
193999
+ throw error40;
194000
+ }
194001
+ if (!content.trim()) return {};
194002
+ try {
194003
+ const parsed = JSON.parse(content);
194004
+ if (!isJsonRecord(parsed)) throw new Error("top-level value must be an object");
194005
+ return parsed;
194006
+ } catch (error40) {
194007
+ const reason = error40 instanceof Error ? error40.message : String(error40);
194008
+ throw new Error(`Cannot safely update Grok hook config ${configPath}: ${reason}`);
194009
+ }
194010
+ }
193915
194011
  function generateCopilotConfig() {
193916
194012
  const cmd = `${resolveHookCommand()} hook`;
193917
194013
  const hasPwsh = detectPwsh();
@@ -194333,6 +194429,8 @@ function getProjectConfigPath(agent, projectRoot) {
194333
194429
  return path30.join(projectRoot, ".gemini", "settings.json");
194334
194430
  case "workbuddy":
194335
194431
  return "";
194432
+ case "grok":
194433
+ return path30.join(projectRoot, ".grok", "hooks", "memorix.json");
194336
194434
  default:
194337
194435
  return path30.join(projectRoot, ".memorix", "hooks.json");
194338
194436
  }
@@ -194368,6 +194466,8 @@ function getGlobalConfigPath(agent) {
194368
194466
  return path30.join(process.env.DSH_HOME?.trim() || path30.join(home, ".dsh"), "AGENTS.md");
194369
194467
  case "workbuddy":
194370
194468
  return "";
194469
+ case "grok":
194470
+ return path30.join(getGrokHome(), "hooks", "memorix.json");
194371
194471
  default:
194372
194472
  return path30.join(home, ".memorix", "hooks.json");
194373
194473
  }
@@ -194394,6 +194494,8 @@ function getAgentRulesPath(agent, root, global2 = false) {
194394
194494
  return path30.join(root, ".trae", "rules", "project_rules.md");
194395
194495
  case "dsh":
194396
194496
  return path30.join(process.env.DSH_HOME?.trim() || path30.join(root, ".dsh"), "AGENTS.md");
194497
+ case "grok":
194498
+ return path30.join(getGrokHome(), "AGENTS.md");
194397
194499
  case "workbuddy":
194398
194500
  return "";
194399
194501
  default:
@@ -194424,6 +194526,8 @@ function getAgentRulesPath(agent, root, global2 = false) {
194424
194526
  return path30.join(root, "AGENTS.md");
194425
194527
  case "workbuddy":
194426
194528
  return path30.join(root, "AGENTS.md");
194529
+ case "grok":
194530
+ return path30.join(root, "AGENTS.md");
194427
194531
  default:
194428
194532
  return path30.join(root, ".agent", "rules", "memorix.md");
194429
194533
  }
@@ -194475,6 +194579,12 @@ async function detectInstalledAgents() {
194475
194579
  agents.push("kiro");
194476
194580
  } catch {
194477
194581
  }
194582
+ const grokDir = getGrokHome();
194583
+ try {
194584
+ await fs19.access(grokDir);
194585
+ agents.push("grok");
194586
+ } catch {
194587
+ }
194478
194588
  const codexDir = path30.join(home, ".codex");
194479
194589
  try {
194480
194590
  await fs19.access(codexDir);
@@ -194561,6 +194671,9 @@ async function installHooks(agent, projectRoot, global2 = false) {
194561
194671
  if (basename7 === "AGENTS.md" || basename7 === "GEMINI.md" || basename7 === "CONTEXT.md") {
194562
194672
  continue;
194563
194673
  }
194674
+ if (agent === "grok" && path30.resolve(entry.path) === path30.resolve(configPath)) {
194675
+ continue;
194676
+ }
194564
194677
  await unlink3(entry.path);
194565
194678
  await removeFile2(projectRoot, entry.path);
194566
194679
  } catch {
@@ -194573,6 +194686,9 @@ async function installHooks(agent, projectRoot, global2 = false) {
194573
194686
  case "claude":
194574
194687
  generated = generateClaudeConfig();
194575
194688
  break;
194689
+ case "grok":
194690
+ generated = generateGrokConfig();
194691
+ break;
194576
194692
  case "copilot":
194577
194693
  generated = generateCopilotConfig();
194578
194694
  break;
@@ -194667,7 +194783,16 @@ async function installHooks(agent, projectRoot, global2 = false) {
194667
194783
  generated = generateClaudeConfig();
194668
194784
  }
194669
194785
  await fs19.mkdir(path30.dirname(configPath), { recursive: true });
194670
- if (agent === "kiro") {
194786
+ if (agent === "grok") {
194787
+ const existing = await readGrokHookConfig(configPath);
194788
+ const merged = mergeGrokHookConfig(existing, generated);
194789
+ await fs19.writeFile(configPath, JSON.stringify(merged, null, 2), "utf-8");
194790
+ try {
194791
+ const { recordFile: recordFile2 } = await Promise.resolve().then(() => (init_audit(), audit_exports));
194792
+ await recordFile2(projectRoot, "hook", configPath, agent);
194793
+ } catch {
194794
+ }
194795
+ } else if (agent === "kiro") {
194671
194796
  const hookFiles = generateKiroHookFiles();
194672
194797
  const hooksDir = path30.join(path30.dirname(configPath));
194673
194798
  await fs19.mkdir(hooksDir, { recursive: true });
@@ -194748,6 +194873,9 @@ async function installHooks(agent, projectRoot, global2 = false) {
194748
194873
  case "kiro":
194749
194874
  events.push("session_end", "user_prompt", "post_edit");
194750
194875
  break;
194876
+ case "grok":
194877
+ events.push("session_start", "post_tool", "user_prompt", "pre_compact", "post_compact", "session_end");
194878
+ break;
194751
194879
  }
194752
194880
  await installAgentRules(agent, projectRoot, global2);
194753
194881
  const skillPaths = await installOfficialSkillsForAgent(agent, projectRoot, global2);
@@ -194768,7 +194896,7 @@ async function installAgentRules(agent, projectRoot, global2 = false) {
194768
194896
  const rulesPath = getAgentRulesPath(agent, rulesRoot, global2);
194769
194897
  try {
194770
194898
  await fs19.mkdir(path30.dirname(rulesPath), { recursive: true });
194771
- if (agent === "claude" || agent === "codex" || agent === "opencode" || agent === "antigravity" || agent === "gemini-cli" || agent === "dsh") {
194899
+ if (agent === "claude" || agent === "codex" || agent === "opencode" || agent === "antigravity" || agent === "gemini-cli" || agent === "dsh" || agent === "grok") {
194772
194900
  try {
194773
194901
  const existing = await fs19.readFile(rulesPath, "utf-8");
194774
194902
  await fs19.writeFile(rulesPath, mergeMemorixRulesContent(existing, rulesContent), "utf-8");
@@ -194937,7 +195065,16 @@ async function uninstallHooks(agent, projectRoot, global2 = false) {
194937
195065
  const configPath = global2 ? getGlobalConfigPath(agent) : getProjectConfigPath(agent, projectRoot);
194938
195066
  let success2 = false;
194939
195067
  try {
194940
- if (agent === "kiro" || agent === "opencode") {
195068
+ if (agent === "grok") {
195069
+ const config2 = await readGrokHookConfig(configPath);
195070
+ const cleaned = removeMemorixGrokHooks(config2);
195071
+ if (Object.keys(cleaned).length === 0) {
195072
+ await fs19.unlink(configPath);
195073
+ } else {
195074
+ await fs19.writeFile(configPath, JSON.stringify(cleaned, null, 2), "utf-8");
195075
+ }
195076
+ success2 = true;
195077
+ } else if (agent === "kiro" || agent === "opencode") {
194941
195078
  await fs19.unlink(configPath);
194942
195079
  success2 = true;
194943
195080
  } else {
@@ -194960,6 +195097,11 @@ async function uninstallHooks(agent, projectRoot, global2 = false) {
194960
195097
  const agentFiles = prevFiles.filter((e5) => e5.agent === agent);
194961
195098
  for (const entry of agentFiles) {
194962
195099
  try {
195100
+ if (agent === "grok" && path30.resolve(entry.path) === path30.resolve(configPath)) {
195101
+ await removeFile2(projectRoot, entry.path);
195102
+ auditCleaned = true;
195103
+ continue;
195104
+ }
194963
195105
  const basename7 = path30.basename(entry.path);
194964
195106
  if (basename7 === "AGENTS.md" || basename7 === "GEMINI.md" || basename7 === "CONTEXT.md") {
194965
195107
  try {
@@ -195020,14 +195162,14 @@ async function uninstallHooks(agent, projectRoot, global2 = false) {
195020
195162
  }
195021
195163
  async function getHookStatus(projectRoot) {
195022
195164
  const results = [];
195023
- const agents = ["claude", "copilot", "windsurf", "cursor", "kiro", "codex", "antigravity", "gemini-cli", "opencode", "pi", "trae"];
195165
+ const agents = ["claude", "copilot", "windsurf", "cursor", "kiro", "codex", "antigravity", "gemini-cli", "opencode", "pi", "trae", "grok"];
195024
195166
  for (const agent of agents) {
195025
195167
  const projectPath = getProjectConfigPath(agent, projectRoot);
195026
195168
  const globalPath = getGlobalConfigPath(agent);
195027
195169
  let installed = false;
195028
195170
  let outdated = false;
195029
195171
  let usedPath = projectPath;
195030
- const verifiedByDefault = agent !== "opencode" && agent !== "pi";
195172
+ const verifiedByDefault = agent !== "opencode" && agent !== "pi" && agent !== "grok";
195031
195173
  try {
195032
195174
  await fs19.access(projectPath);
195033
195175
  installed = true;
@@ -195055,11 +195197,12 @@ async function getHookStatus(projectRoot) {
195055
195197
  if (agent === "copilot" && process.platform === "win32" && installed) {
195056
195198
  runtimeReady = detectPwsh();
195057
195199
  }
195200
+ const verified = installed && (verifiedByDefault || agent === "grok" && usedPath === globalPath);
195058
195201
  results.push({
195059
195202
  agent,
195060
195203
  installed,
195061
195204
  outdated,
195062
- verified: installed && verifiedByDefault,
195205
+ verified,
195063
195206
  runtimeReady,
195064
195207
  configPath: usedPath
195065
195208
  });
@@ -195121,7 +195264,7 @@ function getSetupAgentTargets() {
195121
195264
  return [...SUPPORTED_SETUP_AGENTS];
195122
195265
  }
195123
195266
  function buildSetupPlan(options) {
195124
- const mcp = options.mcp ?? "stdio";
195267
+ const mcp = options.agent === "grok" ? "none" : options.mcp ?? "stdio";
195125
195268
  const actions = [];
195126
195269
  const isPackageOwnedAgent = options.agent !== "all" && PACKAGE_OWNED_INTEGRATION_AGENTS.has(options.agent);
195127
195270
  const includeHooks = options.hooks ?? true;
@@ -195630,7 +195773,7 @@ async function writeClaudeMarketplace(marketplacePath) {
195630
195773
  },
195631
195774
  category: "development",
195632
195775
  source: "./plugins/memorix",
195633
- homepage: "https://github.com/AVIDS2/memorix#readme"
195776
+ homepage: "https://mem.rglens.com"
195634
195777
  }
195635
195778
  ]
195636
195779
  };
@@ -196108,7 +196251,7 @@ async function installAgentSetup(agent, plan, global2) {
196108
196251
  const hasHermesPlugin = plan.actions.includes("hermes-plugin") && agent === "hermes";
196109
196252
  const hasOmpPackage = plan.actions.includes("omp-package") && agent === "omp";
196110
196253
  const hasCodeBuddyPlugin = plan.actions.includes("codebuddy-plugin") && agent === "codebuddy";
196111
- const wantsMcpConfig = plan.mcp !== "none" && agent !== "pi" && !(agent === "codex" && !global2);
196254
+ const wantsMcpConfig = plan.mcp !== "none" && agent !== "pi" && agent !== "grok" && !(agent === "codex" && !global2);
196112
196255
  if (PLUGIN_PACKAGE_AGENTS.has(agent) && plan.includePlugin && !global2) {
196113
196256
  v3.info(`${agent}: project setup leaves user-level plugins untouched. Run \`memorix setup --agent ${agent} --global\` to install its plugin, skills, and lifecycle hooks.`);
196114
196257
  }
@@ -196267,6 +196410,9 @@ async function installAgentSetup(agent, plan, global2) {
196267
196410
  }
196268
196411
  if (agent === "pi") {
196269
196412
  v3.info("pi: Pi has no MCP config lane in the current CLI; use the installed package extension and skill.");
196413
+ } else if (agent === "grok") {
196414
+ v3.info("grok: lifecycle hooks write ~/.grok/hooks/memorix.json. MCP stays host-owned (do not write config.toml).");
196415
+ if (!global2) v3.info("grok: project hooks require `/hooks-trust` or launching Grok with `--trust`.");
196270
196416
  } else if (plan.mcp === "stdio") {
196271
196417
  v3.info(`${agent}: MCP server command is \`memorix serve\``);
196272
196418
  } else if (plan.mcp === "http") {
@@ -196345,7 +196491,8 @@ var init_setup = __esm({
196345
196491
  "trae",
196346
196492
  "dsh",
196347
196493
  "workbuddy",
196348
- "pi"
196494
+ "pi",
196495
+ "grok"
196349
196496
  ];
196350
196497
  getSetupIntegrationRows2 = getSetupIntegrationRows;
196351
196498
  setup_default = defineCommand({
@@ -196356,7 +196503,7 @@ var init_setup = __esm({
196356
196503
  args: {
196357
196504
  agent: {
196358
196505
  type: "string",
196359
- description: "Target agent (claude, codex, codebuddy, opencode, cursor, windsurf, copilot, gemini-cli, antigravity, openclaw, hermes, omp, kiro, trae, dsh, pi, all)",
196506
+ description: "Target agent (claude, codex, codebuddy, opencode, cursor, windsurf, copilot, gemini-cli, antigravity, openclaw, hermes, omp, kiro, trae, dsh, pi, grok, all)",
196360
196507
  required: false
196361
196508
  },
196362
196509
  mcp: {
@@ -196423,6 +196570,7 @@ var init_setup = __esm({
196423
196570
  { value: "codex", label: "Codex", hint: "plugin package + marketplace + MCP" },
196424
196571
  { value: "copilot", label: "GitHub Copilot CLI", hint: "plugin package + hooks + MCP" },
196425
196572
  { value: "cursor", label: "Cursor", hint: "MCP + rules + skills" },
196573
+ { value: "grok", label: "Grok Build", hint: "hooks file; MCP stays host-owned" },
196426
196574
  { value: "gemini-cli", label: "Gemini CLI", hint: "extension + MCP" },
196427
196575
  { value: "openclaw", label: "OpenClaw", hint: "bundle + hook pack + skills + MCP" },
196428
196576
  { value: "hermes", label: "Hermes Agent", hint: "plugin + hooks + commands + skills + MCP" },
@@ -196733,7 +196881,8 @@ function getAgentLabel(agent) {
196733
196881
  "gemini-cli": "Gemini CLI",
196734
196882
  trae: "Trae",
196735
196883
  dsh: "DeepSeek Harness",
196736
- workbuddy: "WorkBuddy"
196884
+ workbuddy: "WorkBuddy",
196885
+ grok: "Grok Build"
196737
196886
  };
196738
196887
  return labels[agent] || agent;
196739
196888
  }
@@ -196750,7 +196899,8 @@ function getAgentHint(agent) {
196750
196899
  "gemini-cli": "settings + GEMINI.md",
196751
196900
  trae: "rules",
196752
196901
  dsh: "MCP patch + AGENTS.md + skills",
196753
- workbuddy: "MCP + AGENTS.md"
196902
+ workbuddy: "MCP + AGENTS.md",
196903
+ grok: "hooks file (~/.grok/hooks/memorix.json)"
196754
196904
  };
196755
196905
  return hints[agent] || "integration files";
196756
196906
  }
@@ -197797,7 +197947,7 @@ var init_current_facts = __esm({
197797
197947
  });
197798
197948
 
197799
197949
  // src/codegraph/scip-provider.ts
197800
- import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve4 } from "path";
197950
+ import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve5 } from "path";
197801
197951
  function isRecord3(value) {
197802
197952
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
197803
197953
  }
@@ -197809,8 +197959,8 @@ function text2(value, max = 240) {
197809
197959
  function safeRelativePath(projectRoot, value, exclude) {
197810
197960
  const raw = text2(value, 1024);
197811
197961
  if (!raw || isAbsolute3(raw)) return void 0;
197812
- const absolute = resolve4(projectRoot, raw);
197813
- const fromRoot = relative3(resolve4(projectRoot), absolute);
197962
+ const absolute = resolve5(projectRoot, raw);
197963
+ const fromRoot = relative3(resolve5(projectRoot), absolute);
197814
197964
  if (!fromRoot || fromRoot === ".." || fromRoot.startsWith("..\\") || fromRoot.startsWith("../") || isAbsolute3(fromRoot)) return void 0;
197815
197965
  const normalized = normalizeCodePath(fromRoot);
197816
197966
  return isCodeGraphExcludedPath(normalized, exclude) ? void 0 : normalized;
@@ -197954,7 +198104,7 @@ __export(external_provider_exports, {
197954
198104
  });
197955
198105
  import { spawn as spawn5 } from "child_process";
197956
198106
  import { existsSync as existsSync18, readFileSync as readFileSync11 } from "fs";
197957
- import { delimiter, dirname as dirname5, extname, isAbsolute as isAbsolute4, join as join24, relative as relative4, resolve as resolve5, sep as sep2 } from "path";
198107
+ import { delimiter, dirname as dirname5, extname, isAbsolute as isAbsolute4, join as join24, relative as relative4, resolve as resolve6, sep as sep2 } from "path";
197958
198108
  function boundedTimeout(value) {
197959
198109
  if (!Number.isFinite(value)) return DEFAULT_EXTERNAL_CODEGRAPH_TIMEOUT_MS;
197960
198110
  return Math.max(100, Math.min(Math.floor(value), MAX_EXTERNAL_CODEGRAPH_TIMEOUT_MS));
@@ -197972,14 +198122,14 @@ function safeText(value, maxLength = MAX_EXTERNAL_TEXT_LENGTH) {
197972
198122
  return normalized;
197973
198123
  }
197974
198124
  function sameProjectRoot(left, right) {
197975
- const normalizedLeft = resolve5(left).replace(/\\/g, "/");
197976
- const normalizedRight = resolve5(right).replace(/\\/g, "/");
198125
+ const normalizedLeft = resolve6(left).replace(/\\/g, "/");
198126
+ const normalizedRight = resolve6(right).replace(/\\/g, "/");
197977
198127
  return process.platform === "win32" ? normalizedLeft.toLowerCase() === normalizedRight.toLowerCase() : normalizedLeft === normalizedRight;
197978
198128
  }
197979
198129
  function resolveCommandCandidates(command) {
197980
198130
  const requested = command?.trim() || "codegraph";
197981
198131
  if (isAbsolute4(requested) || requested.includes("/") || requested.includes("\\")) {
197982
- return [resolve5(requested)];
198132
+ return [resolve6(requested)];
197983
198133
  }
197984
198134
  const names = extname(requested) ? [requested] : process.platform === "win32" ? [requested + ".exe", requested + ".cmd", requested + ".js", requested] : [requested];
197985
198135
  const directories = [
@@ -197993,7 +198143,7 @@ function resolveLaunch(command) {
197993
198143
  if (!existsSync18(candidate2)) continue;
197994
198144
  const extension3 = extname(candidate2).toLowerCase();
197995
198145
  if (extension3 === ".cmd") {
197996
- const bundleRoot = resolve5(dirname5(candidate2), "..");
198146
+ const bundleRoot = resolve6(dirname5(candidate2), "..");
197997
198147
  const node = join24(bundleRoot, "node.exe");
197998
198148
  const entry = join24(bundleRoot, "lib", "dist", "bin", "codegraph.js");
197999
198149
  if (existsSync18(node) && existsSync18(entry)) {
@@ -198004,7 +198154,7 @@ function resolveLaunch(command) {
198004
198154
  const match2 = shim.match(/["']([^"']*%(?:~)?dp0%?[^"']*\.m?js)["']/i);
198005
198155
  if (match2?.[1]) {
198006
198156
  const base = dirname5(candidate2).endsWith(sep2) ? dirname5(candidate2) : dirname5(candidate2) + sep2;
198007
- const entry2 = resolve5(match2[1].replace(/%(?:~)?dp0%?/gi, base));
198157
+ const entry2 = resolve6(match2[1].replace(/%(?:~)?dp0%?/gi, base));
198008
198158
  if (existsSync18(entry2)) return { executable: process.execPath, prefixArgs: [entry2] };
198009
198159
  }
198010
198160
  } catch {
@@ -198239,7 +198389,7 @@ async function runExternalCodeGraphLifecycle(input) {
198239
198389
  function safeRelativePath2(projectRoot, value, exclude) {
198240
198390
  const path48 = safeText(value, 1024);
198241
198391
  if (!path48 || isAbsolute4(path48)) return void 0;
198242
- const absolute = resolve5(projectRoot, path48);
198392
+ const absolute = resolve6(projectRoot, path48);
198243
198393
  const fromRoot = relative4(projectRoot, absolute);
198244
198394
  if (!fromRoot || fromRoot === ".." || fromRoot.startsWith("..\\") || fromRoot.startsWith("../") || isAbsolute4(fromRoot)) return void 0;
198245
198395
  const normalized = normalizeCodePath(fromRoot);
@@ -204025,13 +204175,13 @@ __export(transfer_exports, {
204025
204175
  import { promises as fs21 } from "fs";
204026
204176
  import path35 from "path";
204027
204177
  async function readStandardInput() {
204028
- return new Promise((resolve8, reject) => {
204178
+ return new Promise((resolve9, reject) => {
204029
204179
  let content = "";
204030
204180
  process.stdin.setEncoding("utf8");
204031
204181
  process.stdin.on("data", (chunk) => {
204032
204182
  content += chunk;
204033
204183
  });
204034
- process.stdin.on("end", () => resolve8(content));
204184
+ process.stdin.on("end", () => resolve9(content));
204035
204185
  process.stdin.on("error", reject);
204036
204186
  });
204037
204187
  }
@@ -206877,7 +207027,7 @@ var init_tool_profile = __esm({
206877
207027
  function getMcpServerInfo() {
206878
207028
  return {
206879
207029
  name: "memorix",
206880
- version: true ? "1.8.7" : "1.0.1"
207030
+ version: true ? "1.8.9" : "1.0.1"
206881
207031
  };
206882
207032
  }
206883
207033
  function createMcpDiscoverResult(capabilities, serverInfo) {
@@ -209789,7 +209939,7 @@ var init_protocol = __esm({
209789
209939
  return;
209790
209940
  }
209791
209941
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
209792
- await new Promise((resolve8) => setTimeout(resolve8, pollInterval));
209942
+ await new Promise((resolve9) => setTimeout(resolve9, pollInterval));
209793
209943
  options?.signal?.throwIfAborted();
209794
209944
  }
209795
209945
  } catch (error40) {
@@ -209806,7 +209956,7 @@ var init_protocol = __esm({
209806
209956
  */
209807
209957
  request(request, resultSchema, options) {
209808
209958
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
209809
- return new Promise((resolve8, reject) => {
209959
+ return new Promise((resolve9, reject) => {
209810
209960
  const earlyReject = (error40) => {
209811
209961
  reject(error40);
209812
209962
  };
@@ -209884,7 +210034,7 @@ var init_protocol = __esm({
209884
210034
  if (!parseResult.success) {
209885
210035
  reject(parseResult.error);
209886
210036
  } else {
209887
- resolve8(parseResult.data);
210037
+ resolve9(parseResult.data);
209888
210038
  }
209889
210039
  } catch (error40) {
209890
210040
  reject(error40);
@@ -210145,12 +210295,12 @@ var init_protocol = __esm({
210145
210295
  }
210146
210296
  } catch {
210147
210297
  }
210148
- return new Promise((resolve8, reject) => {
210298
+ return new Promise((resolve9, reject) => {
210149
210299
  if (signal.aborted) {
210150
210300
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
210151
210301
  return;
210152
210302
  }
210153
- const timeoutId = setTimeout(resolve8, interval);
210303
+ const timeoutId = setTimeout(resolve9, interval);
210154
210304
  signal.addEventListener("abort", () => {
210155
210305
  clearTimeout(timeoutId);
210156
210306
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -213198,7 +213348,7 @@ var require_compile = __commonJS({
213198
213348
  const schOrFunc = root.refs[ref];
213199
213349
  if (schOrFunc)
213200
213350
  return schOrFunc;
213201
- let _sch = resolve8.call(this, root, ref);
213351
+ let _sch = resolve9.call(this, root, ref);
213202
213352
  if (_sch === void 0) {
213203
213353
  const schema = (_a6 = root.localRefs) === null || _a6 === void 0 ? void 0 : _a6[ref];
213204
213354
  const { schemaId } = this.opts;
@@ -213225,7 +213375,7 @@ var require_compile = __commonJS({
213225
213375
  function sameSchemaEnv(s1, s22) {
213226
213376
  return s1.schema === s22.schema && s1.root === s22.root && s1.baseId === s22.baseId;
213227
213377
  }
213228
- function resolve8(root, ref) {
213378
+ function resolve9(root, ref) {
213229
213379
  let sch;
213230
213380
  while (typeof (sch = this.refs[ref]) == "string")
213231
213381
  ref = sch;
@@ -213859,7 +214009,7 @@ var require_fast_uri = __commonJS({
213859
214009
  }
213860
214010
  return uri;
213861
214011
  }
213862
- function resolve8(baseURI, relativeURI, options) {
214012
+ function resolve9(baseURI, relativeURI, options) {
213863
214013
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
213864
214014
  const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
213865
214015
  const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
@@ -214143,7 +214293,7 @@ var require_fast_uri = __commonJS({
214143
214293
  var fastUri = {
214144
214294
  SCHEMES,
214145
214295
  normalize,
214146
- resolve: resolve8,
214296
+ resolve: resolve9,
214147
214297
  resolveComponent,
214148
214298
  equal,
214149
214299
  serialize,
@@ -219052,7 +219202,7 @@ var init_mcp = __esm({
219052
219202
  let task = createTaskResult.task;
219053
219203
  const pollInterval = task.pollInterval ?? 5e3;
219054
219204
  while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
219055
- await new Promise((resolve8) => setTimeout(resolve8, pollInterval));
219205
+ await new Promise((resolve9) => setTimeout(resolve9, pollInterval));
219056
219206
  const updatedTask = await extra.taskStore.getTask(taskId);
219057
219207
  if (!updatedTask) {
219058
219208
  throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
@@ -223159,7 +223309,7 @@ async function buildTeamSnapshot(dataDir, projectId, scope, mode) {
223159
223309
  }
223160
223310
  }
223161
223311
  function readBody(req) {
223162
- return new Promise((resolve8, reject) => {
223312
+ return new Promise((resolve9, reject) => {
223163
223313
  const chunks = [];
223164
223314
  let size = 0;
223165
223315
  req.on("data", (c6) => {
@@ -223170,7 +223320,7 @@ function readBody(req) {
223170
223320
  }
223171
223321
  chunks.push(c6);
223172
223322
  });
223173
- req.on("end", () => resolve8(Buffer.concat(chunks).toString("utf-8")));
223323
+ req.on("end", () => resolve9(Buffer.concat(chunks).toString("utf-8")));
223174
223324
  req.on("error", reject);
223175
223325
  });
223176
223326
  }
@@ -223223,7 +223373,7 @@ async function startDashboard(dataDir, port, staticDir, projectId, projectName,
223223
223373
  await serveStatic(req, res, resolvedStaticDir);
223224
223374
  }
223225
223375
  });
223226
- return new Promise((resolve8, reject) => {
223376
+ return new Promise((resolve9, reject) => {
223227
223377
  server.on("error", (err) => {
223228
223378
  if (err.code === "EADDRINUSE") {
223229
223379
  console.error(`Port ${port} is already in use. Try: memorix dashboard --port ${port + 1}`);
@@ -223246,7 +223396,7 @@ async function startDashboard(dataDir, port, staticDir, projectId, projectName,
223246
223396
  Press Ctrl+C to stop
223247
223397
  `);
223248
223398
  if (autoOpen) openBrowser(url2);
223249
- resolve8();
223399
+ resolve9();
223250
223400
  });
223251
223401
  });
223252
223402
  }
@@ -266730,15 +266880,15 @@ ${json4}
266730
266880
  if (inControlPlane) {
266731
266881
  const http3 = await import("http");
266732
266882
  const postData = JSON.stringify({ projectId: project.id, projectName: project.name });
266733
- await new Promise((resolve8) => {
266883
+ await new Promise((resolve9) => {
266734
266884
  const req = http3.request({
266735
266885
  hostname: "127.0.0.1",
266736
266886
  port: portNum,
266737
266887
  path: "/api/set-current-project",
266738
266888
  method: "POST",
266739
266889
  headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData) }
266740
- }, () => resolve8());
266741
- req.on("error", () => resolve8());
266890
+ }, () => resolve9());
266891
+ req.on("error", () => resolve9());
266742
266892
  req.write(postData);
266743
266893
  req.end();
266744
266894
  });
@@ -266763,33 +266913,33 @@ ${json4}
266763
266913
  }
266764
266914
  if (dashboardRunning) {
266765
266915
  const { createConnection } = await import("net");
266766
- const isAlive = await new Promise((resolve8) => {
266916
+ const isAlive = await new Promise((resolve9) => {
266767
266917
  const sock = createConnection(portNum, "127.0.0.1");
266768
266918
  sock.once("connect", () => {
266769
266919
  sock.destroy();
266770
- resolve8(true);
266920
+ resolve9(true);
266771
266921
  });
266772
266922
  sock.once("error", () => {
266773
266923
  sock.destroy();
266774
- resolve8(false);
266924
+ resolve9(false);
266775
266925
  });
266776
266926
  setTimeout(() => {
266777
266927
  sock.destroy();
266778
- resolve8(false);
266928
+ resolve9(false);
266779
266929
  }, 1e3);
266780
266930
  });
266781
266931
  if (isAlive) {
266782
266932
  const http3 = await import("http");
266783
266933
  const postData = JSON.stringify({ projectId: project.id, projectName: project.name });
266784
- await new Promise((resolve8) => {
266934
+ await new Promise((resolve9) => {
266785
266935
  const req = http3.request({
266786
266936
  hostname: "127.0.0.1",
266787
266937
  port: portNum,
266788
266938
  path: "/api/set-current-project",
266789
266939
  method: "POST",
266790
266940
  headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData) }
266791
- }, () => resolve8());
266792
- req.on("error", () => resolve8());
266941
+ }, () => resolve9());
266942
+ req.on("error", () => resolve9());
266793
266943
  req.write(postData);
266794
266944
  req.end();
266795
266945
  });
@@ -266835,18 +266985,18 @@ ${json4}
266835
266985
  dashboardRunning = false;
266836
266986
  });
266837
266987
  const { createConnection } = await import("net");
266838
- await new Promise((resolve8) => {
266988
+ await new Promise((resolve9) => {
266839
266989
  const deadline = Date.now() + 5e3;
266840
266990
  const tryConnect = () => {
266841
266991
  const sock = createConnection(portNum, "127.0.0.1");
266842
266992
  sock.once("connect", () => {
266843
266993
  sock.destroy();
266844
- resolve8();
266994
+ resolve9();
266845
266995
  });
266846
266996
  sock.once("error", () => {
266847
266997
  sock.destroy();
266848
266998
  if (Date.now() < deadline) setTimeout(tryConnect, 100);
266849
- else resolve8();
266999
+ else resolve9();
266850
267000
  });
266851
267001
  };
266852
267002
  tryConnect();
@@ -268340,10 +268490,10 @@ function describeAutoUpdateFailure(error40, timeoutMs) {
268340
268490
  async function fetchLatestVersion() {
268341
268491
  try {
268342
268492
  const { default: https2 } = await import("https");
268343
- return new Promise((resolve8) => {
268493
+ return new Promise((resolve9) => {
268344
268494
  const req = https2.get(REGISTRY_URL, { timeout: 5e3 }, (res) => {
268345
268495
  if (res.statusCode !== 200) {
268346
- resolve8(null);
268496
+ resolve9(null);
268347
268497
  return;
268348
268498
  }
268349
268499
  let body = "";
@@ -268353,16 +268503,16 @@ async function fetchLatestVersion() {
268353
268503
  res.on("end", () => {
268354
268504
  try {
268355
268505
  const data = JSON.parse(body);
268356
- resolve8(data.version ?? null);
268506
+ resolve9(data.version ?? null);
268357
268507
  } catch {
268358
- resolve8(null);
268508
+ resolve9(null);
268359
268509
  }
268360
268510
  });
268361
268511
  });
268362
- req.on("error", () => resolve8(null));
268512
+ req.on("error", () => resolve9(null));
268363
268513
  req.on("timeout", () => {
268364
268514
  req.destroy();
268365
- resolve8(null);
268515
+ resolve9(null);
268366
268516
  });
268367
268517
  });
268368
268518
  } catch {
@@ -269039,7 +269189,7 @@ var init_dist8 = __esm({
269039
269189
  request[bodyBufferKey] = buffered;
269040
269190
  return Promise.resolve(buffered);
269041
269191
  }
269042
- const promise2 = new Promise((resolve8, reject) => {
269192
+ const promise2 = new Promise((resolve9, reject) => {
269043
269193
  const chunks = [];
269044
269194
  let settled = false;
269045
269195
  const finish = (callback) => {
@@ -269057,7 +269207,7 @@ var init_dist8 = __esm({
269057
269207
  else if (recovered === void 0) reject(error40 ?? normalizeAbortError(request, incoming));
269058
269208
  else {
269059
269209
  request[bodyBufferKey] = recovered;
269060
- resolve8(recovered);
269210
+ resolve9(recovered);
269061
269211
  }
269062
269212
  });
269063
269213
  return true;
@@ -269069,7 +269219,7 @@ var init_dist8 = __esm({
269069
269219
  finish(() => {
269070
269220
  const buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks);
269071
269221
  request[bodyBufferKey] = buffer;
269072
- resolve8(buffer);
269222
+ resolve9(buffer);
269073
269223
  });
269074
269224
  };
269075
269225
  const onError = (error40) => {
@@ -269555,7 +269705,7 @@ var init_dist8 = __esm({
269555
269705
  });
269556
269706
  if (!chunk) {
269557
269707
  if (i4 === 1) {
269558
- await new Promise((resolve8) => setTimeout(resolve8));
269708
+ await new Promise((resolve9) => setTimeout(resolve9));
269559
269709
  maxReadCount = 3;
269560
269710
  continue;
269561
269711
  }
@@ -270364,9 +270514,9 @@ data:
270364
270514
  const initRequest = messages.find((m6) => isInitializeRequest(m6));
270365
270515
  const clientProtocolVersion = initRequest ? initRequest.params.protocolVersion : req.headers.get("mcp-protocol-version") ?? DEFAULT_NEGOTIATED_PROTOCOL_VERSION;
270366
270516
  if (this._enableJsonResponse) {
270367
- return new Promise((resolve8) => {
270517
+ return new Promise((resolve9) => {
270368
270518
  this._streamMapping.set(streamId, {
270369
- resolveJson: resolve8,
270519
+ resolveJson: resolve9,
270370
270520
  cleanup: () => {
270371
270521
  this._streamMapping.delete(streamId);
270372
270522
  }
@@ -271121,13 +271271,13 @@ var init_serve_http = __esm({
271121
271271
  res.end(message);
271122
271272
  }
271123
271273
  function parseBody(req) {
271124
- return new Promise((resolve8, reject) => {
271274
+ return new Promise((resolve9, reject) => {
271125
271275
  const chunks = [];
271126
271276
  req.on("data", (chunk) => chunks.push(chunk));
271127
271277
  req.on("end", () => {
271128
271278
  try {
271129
271279
  const body = Buffer.concat(chunks).toString("utf-8");
271130
- resolve8(body ? JSON.parse(body) : void 0);
271280
+ resolve9(body ? JSON.parse(body) : void 0);
271131
271281
  } catch (err) {
271132
271282
  reject(err);
271133
271283
  }
@@ -273333,6 +273483,45 @@ function normalizeCompactionMetadata(payload, ...records) {
273333
273483
  ...details ? { details } : {}
273334
273484
  };
273335
273485
  }
273486
+ function normalizeGrok(payload, event) {
273487
+ const result = {
273488
+ sessionId: firstString(payload.sessionId, payload.session_id, process.env.GROK_SESSION_ID) ?? "",
273489
+ cwd: firstString(payload.cwd, payload.workspaceRoot, payload.workspace_root, process.env.GROK_WORKSPACE_ROOT) ?? "",
273490
+ transcriptPath: firstString(payload.transcriptPath, payload.transcript_path)
273491
+ };
273492
+ const toolName = firstString(payload.toolName, payload.tool_name);
273493
+ if (toolName) {
273494
+ result.toolName = toolName;
273495
+ const toolInput = asRecord2(payload.toolInput) ?? asRecord2(payload.tool_input);
273496
+ result.toolInput = toolInput;
273497
+ if (/^(bash|run_terminal_command)$/i.test(toolName)) {
273498
+ result.command = firstString(toolInput?.command, toolInput?.cmd);
273499
+ }
273500
+ if (/^(write|edit|multi_edit|multiedittool|search_replace)$/i.test(toolName)) {
273501
+ result.filePath = firstString(toolInput?.path, toolInput?.file_path, toolInput?.filePath);
273502
+ }
273503
+ result.toolResult = stringifyValue(
273504
+ payload.toolResult ?? payload.tool_response ?? payload.tool_result ?? payload.error
273505
+ );
273506
+ }
273507
+ if (event === "user_prompt") {
273508
+ result.userPrompt = firstString(payload.prompt, payload.userPrompt, payload.user_prompt) ?? "";
273509
+ }
273510
+ if (event === "post_response" || event === "session_end") {
273511
+ result.aiResponse = firstString(
273512
+ payload.lastAssistantMessage,
273513
+ payload.last_assistant_message,
273514
+ payload.assistantMessage,
273515
+ payload.assistant_message,
273516
+ payload.aiResponse,
273517
+ payload.ai_response
273518
+ );
273519
+ }
273520
+ if (event === "session_start") {
273521
+ result.sessionStartReason = firstString(payload.source, payload.sessionStartReason, payload.session_start_reason);
273522
+ }
273523
+ return result;
273524
+ }
273336
273525
  function detectAgent(payload) {
273337
273526
  if (typeof payload._memorix_agent === "string") {
273338
273527
  return payload._memorix_agent;
@@ -273345,6 +273534,10 @@ function detectAgent(payload) {
273345
273534
  if (payload.agent === "omp") return "omp";
273346
273535
  if (payload.agent === "hermes") return "hermes";
273347
273536
  if (payload.agent === "openclaw") return "openclaw";
273537
+ if (payload.agent === "grok") return "grok";
273538
+ if ("hookEventName" in payload && ("sessionId" in payload || "GROK_SESSION_ID" in process.env)) {
273539
+ return "grok";
273540
+ }
273348
273541
  if ("hook_event_name" in payload && "session_id" in payload) return "claude";
273349
273542
  if ("hook_event_name" in payload) {
273350
273543
  return "claude";
@@ -273382,6 +273575,8 @@ function extractEventName(payload, agent) {
273382
273575
  return payload.hook_event_name ?? "";
273383
273576
  case "kiro":
273384
273577
  return payload.event_type ?? "";
273578
+ case "grok":
273579
+ return payload.hookEventName ?? payload.hook_event_name ?? "";
273385
273580
  default:
273386
273581
  return "";
273387
273582
  }
@@ -273730,6 +273925,9 @@ function normalizeHookInput(payload) {
273730
273925
  case "codebuddy":
273731
273926
  agentSpecific = normalizeClaude(payload, event);
273732
273927
  break;
273928
+ case "grok":
273929
+ agentSpecific = normalizeGrok(payload, event);
273930
+ break;
273733
273931
  default:
273734
273932
  agentSpecific = { sessionId: "", cwd: "" };
273735
273933
  }
@@ -273767,6 +273965,7 @@ var init_normalizer = __esm({
273767
273965
  post_command: "post_command",
273768
273966
  post_tool: "post_tool",
273769
273967
  pre_compact: "pre_compact",
273968
+ post_compact: "post_compact",
273770
273969
  session_end: "session_end",
273771
273970
  post_response: "post_response",
273772
273971
  // Claude Code
@@ -273778,6 +273977,12 @@ var init_normalizer = __esm({
273778
273977
  PreCompact: "pre_compact",
273779
273978
  Stop: "session_end",
273780
273979
  SessionEnd: "session_end",
273980
+ // Grok Build (Claude-compatible PascalCase plus snake_case hookEventName)
273981
+ user_prompt_submit: "user_prompt",
273982
+ pre_tool_use: "post_tool",
273983
+ post_tool_use: "post_tool",
273984
+ post_tool_use_failure: "post_tool",
273985
+ stop_failure: "session_end",
273781
273986
  // GitHub Copilot (camelCase, different names from Cursor)
273782
273987
  userPromptSubmitted: "user_prompt",
273783
273988
  preToolUse: "post_tool",
@@ -274041,7 +274246,7 @@ function hookObservationRuntimeOptions(projectRoot) {
274041
274246
  };
274042
274247
  }
274043
274248
  async function readHookStdin(stdin2, timeoutMs) {
274044
- return new Promise((resolve8) => {
274249
+ return new Promise((resolve9) => {
274045
274250
  const chunks = [];
274046
274251
  let settled = false;
274047
274252
  const finish = () => {
@@ -274057,7 +274262,7 @@ async function readHookStdin(stdin2, timeoutMs) {
274057
274262
  } else {
274058
274263
  stdin2.unref?.();
274059
274264
  }
274060
- resolve8(Buffer.concat(chunks).toString("utf-8").trim());
274265
+ resolve9(Buffer.concat(chunks).toString("utf-8").trim());
274061
274266
  };
274062
274267
  const onData = (chunk) => {
274063
274268
  chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
@@ -274080,13 +274285,13 @@ async function runHookWithDeadline(options) {
274080
274285
  const exit = options.exit ?? ((code) => {
274081
274286
  process.exit(code);
274082
274287
  });
274083
- await new Promise((resolve8) => {
274288
+ await new Promise((resolve9) => {
274084
274289
  let finished2 = false;
274085
274290
  const settle = () => {
274086
274291
  if (finished2) return;
274087
274292
  finished2 = true;
274088
274293
  clearTimeout(timer);
274089
- resolve8();
274294
+ resolve9();
274090
274295
  };
274091
274296
  const timer = setTimeout(() => {
274092
274297
  if (finished2) return;
@@ -274592,6 +274797,7 @@ function formatHookOutput(agent, rawEventName, output) {
274592
274797
  } : {}
274593
274798
  };
274594
274799
  }
274800
+ if (agent === "grok") return {};
274595
274801
  const finalOutput = { ...output };
274596
274802
  const hookSpecificOutputEvents = /* @__PURE__ */ new Set([
274597
274803
  "PreToolUse",
@@ -274803,7 +275009,8 @@ var init_types9 = __esm({
274803
275009
  workbuddy: "community",
274804
275010
  pi: "community",
274805
275011
  omp: "community",
274806
- antigravity: "community"
275012
+ antigravity: "community",
275013
+ grok: "community"
274807
275014
  };
274808
275015
  }
274809
275016
  });
@@ -274866,7 +275073,8 @@ function getAgentLabel2(agent) {
274866
275073
  omp: "Oh-my-Pi",
274867
275074
  trae: "Trae",
274868
275075
  dsh: "DeepSeek Harness",
274869
- workbuddy: "WorkBuddy"
275076
+ workbuddy: "WorkBuddy",
275077
+ grok: "Grok Build"
274870
275078
  };
274871
275079
  return labels[agent] || agent;
274872
275080
  }
@@ -274886,6 +275094,7 @@ function getAgentHint2(agent) {
274886
275094
  trae: ".trae/rules/project_rules.md (rules only, no hooks system)",
274887
275095
  dsh: "~/.dsh/cordis.patch.yml MCP row via `memorix setup --agent dsh` (no hooks system)",
274888
275096
  workbuddy: "~/.workbuddy/mcp.json MCP row via `memorix setup --agent workbuddy` (no hooks system)",
275097
+ grok: "~/.grok/hooks/memorix.json (own file, not RuleSync dest)",
274889
275098
  codex: "Codex plugin hooks; use `memorix setup --agent codex`"
274890
275099
  };
274891
275100
  return hints[agent] || "";
@@ -277051,7 +277260,7 @@ function buildWindowsBackgroundStartScript(options) {
277051
277260
  }
277052
277261
  async function startWindowsBackgroundService(options) {
277053
277262
  const script = buildWindowsBackgroundStartScript(options);
277054
- return new Promise((resolve8, reject) => {
277263
+ return new Promise((resolve9, reject) => {
277055
277264
  const launcher = spawn6("powershell.exe", [
277056
277265
  "-NoLogo",
277057
277266
  "-NoProfile",
@@ -277074,7 +277283,7 @@ async function startWindowsBackgroundService(options) {
277074
277283
  launcher.stdout?.destroy();
277075
277284
  launcher.stderr?.destroy();
277076
277285
  launcher.unref();
277077
- if (result.pid !== void 0) resolve8(result.pid);
277286
+ if (result.pid !== void 0) resolve9(result.pid);
277078
277287
  else reject(result.error ?? new Error("Windows background launcher failed"));
277079
277288
  };
277080
277289
  const tryResolvePid = () => {
@@ -277161,7 +277370,7 @@ async function acquireBackgroundLock(lockPath, staleMs = BACKGROUND_LOCK_STALE_M
277161
277370
  }
277162
277371
  } catch {
277163
277372
  }
277164
- await new Promise((resolve8) => setTimeout(resolve8, 200));
277373
+ await new Promise((resolve9) => setTimeout(resolve9, 200));
277165
277374
  }
277166
277375
  }
277167
277376
  throw new Error(
@@ -277709,7 +277918,7 @@ __export(agent_integrations_exports, {
277709
277918
  import { spawnSync as spawnSync2 } from "child_process";
277710
277919
  import { existsSync as existsSync30, realpathSync as realpathSync2 } from "fs";
277711
277920
  import { mkdir as mkdir8, readFile as readFile9, writeFile as writeFile9 } from "fs/promises";
277712
- import { basename as basename5, dirname as dirname8, resolve as resolve6 } from "path";
277921
+ import { basename as basename5, dirname as dirname8, resolve as resolve7 } from "path";
277713
277922
  import { homedir as homedir35 } from "os";
277714
277923
  function requestedAgents(agent) {
277715
277924
  const all = getSetupAgentTargets();
@@ -277736,7 +277945,7 @@ function worstStatus(statuses) {
277736
277945
  return "skipped";
277737
277946
  }
277738
277947
  function isMcpConfigAgent(agent) {
277739
- return agent !== "pi";
277948
+ return agent !== "pi" && agent !== "grok";
277740
277949
  }
277741
277950
  function isActionableMcpRepairIssue(issue2) {
277742
277951
  return issue2 !== "memorix-server-missing";
@@ -278107,7 +278316,7 @@ function defaultClaudeProjectKey(projectRoot) {
278107
278316
  return canonicalProjectPath(projectRoot);
278108
278317
  }
278109
278318
  function canonicalProjectPath(projectRoot) {
278110
- const resolved = resolve6(projectRoot);
278319
+ const resolved = resolve7(projectRoot);
278111
278320
  const canonical = existsSync30(resolved) ? realpathSync2(resolved) : resolved;
278112
278321
  return canonical.replace(/\\/g, "/");
278113
278322
  }
@@ -278589,7 +278798,8 @@ var init_agent_integrations = __esm({
278589
278798
  "opencode",
278590
278799
  "trae",
278591
278800
  "dsh",
278592
- "workbuddy"
278801
+ "workbuddy",
278802
+ "grok"
278593
278803
  ]);
278594
278804
  CODEX_PLUGIN_NAME = "memorix";
278595
278805
  CODEX_PLUGIN_MARKETPLACE = "personal";
@@ -278737,15 +278947,15 @@ var init_doctor = __esm({
278737
278947
  lines.push(ok(`Background control plane running (PID ${bgPid}, port ${bgPort})`));
278738
278948
  try {
278739
278949
  const http3 = await import("http");
278740
- backgroundHealthy = await new Promise((resolve8) => {
278950
+ backgroundHealthy = await new Promise((resolve9) => {
278741
278951
  const req = http3.request({ hostname: "127.0.0.1", port: bgPort, path: "/api/team", timeout: 3e3 }, (res) => {
278742
278952
  res.resume();
278743
- resolve8(res.statusCode === 200);
278953
+ resolve9(res.statusCode === 200);
278744
278954
  });
278745
- req.on("error", () => resolve8(false));
278955
+ req.on("error", () => resolve9(false));
278746
278956
  req.on("timeout", () => {
278747
278957
  req.destroy();
278748
- resolve8(false);
278958
+ resolve9(false);
278749
278959
  });
278750
278960
  req.end();
278751
278961
  });
@@ -278769,15 +278979,15 @@ var init_doctor = __esm({
278769
278979
  if (!bgRunning) {
278770
278980
  try {
278771
278981
  const http3 = await import("http");
278772
- const portUsed = await new Promise((resolve8) => {
278982
+ const portUsed = await new Promise((resolve9) => {
278773
278983
  const req = http3.request({ hostname: "127.0.0.1", port: 3211, path: "/api/team", timeout: 2e3 }, (res) => {
278774
278984
  res.resume();
278775
- resolve8(res.statusCode === 200);
278985
+ resolve9(res.statusCode === 200);
278776
278986
  });
278777
- req.on("error", () => resolve8(false));
278987
+ req.on("error", () => resolve9(false));
278778
278988
  req.on("timeout", () => {
278779
278989
  req.destroy();
278780
- resolve8(false);
278990
+ resolve9(false);
278781
278991
  });
278782
278992
  req.end();
278783
278993
  });
@@ -279404,8 +279614,8 @@ Project: ${projectName} (${projectId})
279404
279614
  toRemove.length > 0 ? `delete ${toRemove.length}` : "",
279405
279615
  toArchive.length > 0 ? `archive ${toArchive.length}` : ""
279406
279616
  ].filter(Boolean).join(" and ");
279407
- const answer = await new Promise((resolve8) => {
279408
- rl.question(`Proceed to ${desc} observations? (y/N) `, resolve8);
279617
+ const answer = await new Promise((resolve9) => {
279618
+ rl.question(`Proceed to ${desc} observations? (y/N) `, resolve9);
279409
279619
  });
279410
279620
  rl.close();
279411
279621
  if (answer.trim().toLowerCase() !== "y") {
@@ -279477,7 +279687,7 @@ var init_purge = __esm({
279477
279687
  const readline = await import("readline");
279478
279688
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
279479
279689
  const question = purgeAll ? "Retire ALL memories from every project? (y/N) " : "Retire all memories for this project? (y/N) ";
279480
- const answer = await new Promise((resolve8) => rl.question(question, resolve8));
279690
+ const answer = await new Promise((resolve9) => rl.question(question, resolve9));
279481
279691
  rl.close();
279482
279692
  if (answer.trim().toLowerCase() !== "y") {
279483
279693
  console.log("Cancelled.");
@@ -279841,8 +280051,8 @@ async function confirm(description) {
279841
280051
  }
279842
280052
  const readline = await import("readline");
279843
280053
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
279844
- const answer = await new Promise((resolve8) => {
279845
- rl.question(`Proceed to ${description}? (y/N) `, resolve8);
280054
+ const answer = await new Promise((resolve9) => {
280055
+ rl.question(`Proceed to ${description}? (y/N) `, resolve9);
279846
280056
  });
279847
280057
  rl.close();
279848
280058
  return answer.trim().toLowerCase() === "y";
@@ -280155,8 +280365,8 @@ function spawnAgentWithStream(command, args, opts, stdinData, onStdoutLine, onCo
280155
280365
  if (done) {
280156
280366
  return Promise.resolve({ value: void 0, done: true });
280157
280367
  }
280158
- return new Promise((resolve8) => {
280159
- waiters.push({ resolve: resolve8 });
280368
+ return new Promise((resolve9) => {
280369
+ waiters.push({ resolve: resolve9 });
280160
280370
  });
280161
280371
  }
280162
280372
  };
@@ -280196,7 +280406,7 @@ function spawnAgentWithStream(command, args, opts, stdinData, onStdoutLine, onCo
280196
280406
  }, SIGKILL_GRACE_MS);
280197
280407
  }, timeoutMs);
280198
280408
  }
280199
- const completion = new Promise((resolve8) => {
280409
+ const completion = new Promise((resolve9) => {
280200
280410
  let exitCode = null;
280201
280411
  let exitSignal = null;
280202
280412
  let exited = false;
@@ -280216,7 +280426,7 @@ function spawnAgentWithStream(command, args, opts, stdinData, onStdoutLine, onCo
280216
280426
  const tail = stdinError ? `${stdinError}
280217
280427
  ${ring.toString()}` : ring.toString();
280218
280428
  const baseResult = { exitCode, signal: exitSignal, tailOutput: tail, killed };
280219
- resolve8(onCompletion ? onCompletion(baseResult) : baseResult);
280429
+ resolve9(onCompletion ? onCompletion(baseResult) : baseResult);
280220
280430
  }
280221
280431
  child.on("exit", (code, signal) => {
280222
280432
  exited = true;
@@ -280243,7 +280453,7 @@ ${ring.toString()}` : ring.toString();
280243
280453
  closeStream();
280244
280454
  const tail = stdinError ? `${stdinError}
280245
280455
  ` : "";
280246
- resolve8({
280456
+ resolve9({
280247
280457
  exitCode: null,
280248
280458
  signal: null,
280249
280459
  tailOutput: `${tail}spawn error: ${err.message}
@@ -281416,7 +281626,7 @@ var init_worktree = __esm({
281416
281626
  import { spawn as spawn7 } from "child_process";
281417
281627
  function runGate(gate, command, cwd, timeoutMs, outputBudget = DEFAULT_OUTPUT_BUDGET) {
281418
281628
  const start = Date.now();
281419
- return new Promise((resolve8) => {
281629
+ return new Promise((resolve9) => {
281420
281630
  const chunks = [];
281421
281631
  let totalBytes = 0;
281422
281632
  let settled = false;
@@ -281425,7 +281635,7 @@ function runGate(gate, command, cwd, timeoutMs, outputBudget = DEFAULT_OUTPUT_BU
281425
281635
  if (settled) return;
281426
281636
  settled = true;
281427
281637
  if (timer) clearTimeout(timer);
281428
- resolve8(result);
281638
+ resolve9(result);
281429
281639
  };
281430
281640
  const proc = spawn7(command, {
281431
281641
  cwd,
@@ -282163,7 +282373,7 @@ function hashErrorPattern(errorOutput) {
282163
282373
  return createHash22("sha256").update(sanitized).digest("hex").slice(0, 12);
282164
282374
  }
282165
282375
  function sleep6(ms2) {
282166
- return new Promise((resolve8) => setTimeout(() => resolve8([]), ms2));
282376
+ return new Promise((resolve9) => setTimeout(() => resolve9([]), ms2));
282167
282377
  }
282168
282378
  var DEFAULT_BRIDGE_CONFIG, _storeObservation, _searchObservations;
282169
282379
  var init_memorix_bridge = __esm({
@@ -283124,7 +283334,7 @@ ${formatCostSummary(costSummary)}`);
283124
283334
  }
283125
283335
  }
283126
283336
  function sleep7(ms2) {
283127
- return new Promise((resolve8) => setTimeout(resolve8, ms2));
283337
+ return new Promise((resolve9) => setTimeout(resolve9, ms2));
283128
283338
  }
283129
283339
  function isGitRepository(projectDir2) {
283130
283340
  try {
@@ -288377,14 +288587,14 @@ var main2 = defineCommand({
288377
288587
  async run({ args }) {
288378
288588
  let q4 = args.question || "";
288379
288589
  if (!q4 && !process.stdin.isTTY) {
288380
- q4 = await new Promise((resolve8) => {
288590
+ q4 = await new Promise((resolve9) => {
288381
288591
  let data = "";
288382
288592
  process.stdin.setEncoding("utf-8");
288383
288593
  process.stdin.on("data", (chunk) => {
288384
288594
  data += chunk;
288385
288595
  });
288386
- process.stdin.on("end", () => resolve8(data.trim()));
288387
- process.stdin.on("error", () => resolve8(""));
288596
+ process.stdin.on("end", () => resolve9(data.trim()));
288597
+ process.stdin.on("error", () => resolve9(""));
288388
288598
  });
288389
288599
  }
288390
288600
  if (!q4) {