@sesamespace/hivemind 0.12.3 → 0.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ import {
7
7
  SesameClient2 as SesameClient,
8
8
  WORKER_ROUTES,
9
9
  createLogger
10
- } from "./chunk-TQYOGZIN.js";
10
+ } from "./chunk-PGLO6WA5.js";
11
11
 
12
12
  // packages/runtime/src/watchdog.ts
13
13
  import { execSync } from "child_process";
@@ -1095,4 +1095,4 @@ export {
1095
1095
  WorkerMemorySync,
1096
1096
  PrimaryMemorySync
1097
1097
  };
1098
- //# sourceMappingURL=chunk-3SIWFXC7.js.map
1098
+ //# sourceMappingURL=chunk-FIHSUSBJ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FleetManager
3
- } from "./chunk-3SIWFXC7.js";
3
+ } from "./chunk-FIHSUSBJ.js";
4
4
 
5
5
  // packages/cli/src/commands/fleet.ts
6
6
  function formatUptime(seconds) {
@@ -183,4 +183,4 @@ Commands:
183
183
  export {
184
184
  runFleetCommand
185
185
  };
186
- //# sourceMappingURL=chunk-6W56VBXG.js.map
186
+ //# sourceMappingURL=chunk-J3WGHS5W.js.map
@@ -5178,7 +5178,7 @@ function registerFileTools(registry, workspaceDir) {
5178
5178
  required: []
5179
5179
  },
5180
5180
  async (params) => {
5181
- const { readdirSync: readdirSync5, statSync: statSync4 } = await import("fs");
5181
+ const { readdirSync: readdirSync5, statSync: statSync5 } = await import("fs");
5182
5182
  const dirPath = params.path ? resolvePath(workspaceDir, params.path) : workspaceDir;
5183
5183
  if (!existsSync10(dirPath)) {
5184
5184
  return `Error: Directory not found: ${dirPath}`;
@@ -5189,7 +5189,7 @@ function registerFileTools(registry, workspaceDir) {
5189
5189
  for (const entry of entries) {
5190
5190
  if (entry.startsWith(".")) continue;
5191
5191
  try {
5192
- const stat = statSync4(resolve9(dirPath, entry));
5192
+ const stat = statSync5(resolve9(dirPath, entry));
5193
5193
  results.push(stat.isDirectory() ? `${entry}/` : entry);
5194
5194
  } catch {
5195
5195
  results.push(entry);
@@ -8633,12 +8633,13 @@ Path: ${skillDir}`;
8633
8633
  }
8634
8634
 
8635
8635
  // packages/runtime/src/pipeline.ts
8636
- import { readFileSync as readFileSync15, writeFileSync as writeFileSync9, unlinkSync as unlinkSync3 } from "fs";
8636
+ import { readFileSync as readFileSync16, writeFileSync as writeFileSync9, unlinkSync as unlinkSync3 } from "fs";
8637
8637
  import { resolve as resolve20, dirname as dirname8 } from "path";
8638
8638
  import { fileURLToPath as fileURLToPath3 } from "url";
8639
8639
 
8640
8640
  // packages/runtime/src/tools/context-bridge.ts
8641
- import { writeFileSync as writeFileSync8, existsSync as existsSync20, mkdirSync as mkdirSync15, openSync, readSync, closeSync } from "fs";
8641
+ import { writeFileSync as writeFileSync8, readFileSync as readFileSync15, statSync as statSync4, existsSync as existsSync20, mkdirSync as mkdirSync15, openSync, readSync, closeSync } from "fs";
8642
+ import { createHash as createHash2 } from "crypto";
8642
8643
  import { join as join8 } from "path";
8643
8644
  import { homedir } from "os";
8644
8645
  import { EventEmitter as EventEmitter2 } from "events";
@@ -8741,7 +8742,7 @@ ${memories.join("\n\n")}
8741
8742
  `;
8742
8743
  }
8743
8744
  } catch (err) {
8744
- this.logger.warn("Failed to fetch memories for context", err);
8745
+ this.logger.warn("Failed to fetch memories for context", { error: String(err) });
8745
8746
  }
8746
8747
  writeFileSync8(this.contextFilePath, content);
8747
8748
  this.logger.info("Context prepared for Claude Code", { goal: context.goal });
@@ -8769,7 +8770,7 @@ ${memories.join("\n\n")}
8769
8770
  if (!existsSync20(this.sessionLogPath)) {
8770
8771
  writeFileSync8(this.sessionLogPath, "");
8771
8772
  }
8772
- const stats = existsSync20(this.sessionLogPath) ? __require("fs").statSync(this.sessionLogPath) : { size: 0 };
8773
+ const stats = existsSync20(this.sessionLogPath) ? statSync4(this.sessionLogPath) : { size: 0 };
8773
8774
  this.lastLogSize = stats.size;
8774
8775
  this.watchInterval = setInterval(() => {
8775
8776
  this.checkForLogUpdates();
@@ -8781,7 +8782,7 @@ ${memories.join("\n\n")}
8781
8782
  */
8782
8783
  checkForLogUpdates() {
8783
8784
  try {
8784
- const stats = __require("fs").statSync(this.sessionLogPath);
8785
+ const stats = statSync4(this.sessionLogPath);
8785
8786
  if (stats.size > this.lastLogSize) {
8786
8787
  const fd = openSync(this.sessionLogPath, "r");
8787
8788
  const buf = Buffer.alloc(stats.size - this.lastLogSize);
@@ -8826,7 +8827,7 @@ ${memories.join("\n\n")}
8826
8827
  this.logger.info(`Claude insight: ${type}`, { content });
8827
8828
  this.emit("insight", { type, content });
8828
8829
  if (type === "PATTERN") {
8829
- const patternHash = __require("crypto").createHash("md5").update(content).digest("hex");
8830
+ const patternHash = createHash2("md5").update(content).digest("hex");
8830
8831
  if (this.seenPatterns.has(patternHash)) {
8831
8832
  this.logger.debug("Skipping duplicate pattern", { content });
8832
8833
  return;
@@ -8836,18 +8837,13 @@ ${memories.join("\n\n")}
8836
8837
  if (["DISCOVERY", "PATTERN"].includes(type)) {
8837
8838
  try {
8838
8839
  await this.memoryClient.storeEpisode({
8839
- context_name: "claude-code-insights",
8840
+ context_name: "claude-code",
8840
8841
  role: "system",
8841
- content: `${type}: ${content}`,
8842
- metadata: {
8843
- type,
8844
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
8845
- source: "claude-code"
8846
- }
8842
+ content: `Claude Code ${type}: ${content}`
8847
8843
  });
8848
8844
  this.logger.info(`Stored ${type} in memory`, { content });
8849
8845
  } catch (err) {
8850
- this.logger.warn("Failed to store Claude insight in memory", err);
8846
+ this.logger.warn("Failed to store Claude insight in memory", { error: String(err) });
8851
8847
  }
8852
8848
  }
8853
8849
  switch (type) {
@@ -8868,7 +8864,12 @@ ${memories.join("\n\n")}
8868
8864
  */
8869
8865
  async tryProvideContext(need) {
8870
8866
  try {
8871
- const results = await this.memoryClient.search(need, "global", 3);
8867
+ const results = await Promise.race([
8868
+ this.memoryClient.search(need, "global", 3),
8869
+ new Promise(
8870
+ (_, reject) => setTimeout(() => reject(new Error("Memory search timeout")), 3e3)
8871
+ )
8872
+ ]);
8872
8873
  if (results.length > 0) {
8873
8874
  let additionalContext = `
8874
8875
 
@@ -8878,12 +8879,12 @@ ${memories.join("\n\n")}
8878
8879
 
8879
8880
  `;
8880
8881
  additionalContext += results.map((r) => `- ${r.content}`).join("\n");
8881
- const currentContext = __require("fs").readFileSync(this.contextFilePath, "utf-8");
8882
+ const currentContext = existsSync20(this.contextFilePath) ? readFileSync15(this.contextFilePath, "utf-8") : "";
8882
8883
  writeFileSync8(this.contextFilePath, currentContext + additionalContext);
8883
8884
  this.logger.info("Provided additional context to Claude", { need });
8884
8885
  }
8885
8886
  } catch (err) {
8886
- this.logger.warn("Failed to provide additional context", err);
8887
+ this.logger.warn("Failed to provide additional context", { error: String(err) });
8887
8888
  }
8888
8889
  }
8889
8890
  /**
@@ -8891,7 +8892,12 @@ ${memories.join("\n\n")}
8891
8892
  */
8892
8893
  async getSessionSummary() {
8893
8894
  try {
8894
- const results = await this.memoryClient.search("", "claude-code-insights", 50);
8895
+ const results = await Promise.race([
8896
+ this.memoryClient.search("", "claude-code-insights", 50),
8897
+ new Promise(
8898
+ (_, reject) => setTimeout(() => reject(new Error("Memory search timeout")), 3e3)
8899
+ )
8900
+ ]);
8895
8901
  const summary = {
8896
8902
  discoveries: [],
8897
8903
  patterns: [],
@@ -8924,7 +8930,7 @@ ${memories.join("\n\n")}
8924
8930
  }
8925
8931
  return summary;
8926
8932
  } catch (err) {
8927
- this.logger.warn("Failed to get session summary", err);
8933
+ this.logger.warn("Failed to get session summary", { error: String(err) });
8928
8934
  return {
8929
8935
  discoveries: [],
8930
8936
  patterns: [],
@@ -8956,7 +8962,7 @@ async function createContextBridge(config) {
8956
8962
  var PACKAGE_VERSION = "unknown";
8957
8963
  try {
8958
8964
  const __dirname2 = dirname8(fileURLToPath3(import.meta.url));
8959
- const pkg = JSON.parse(readFileSync15(resolve20(__dirname2, "../package.json"), "utf-8"));
8965
+ const pkg = JSON.parse(readFileSync16(resolve20(__dirname2, "../package.json"), "utf-8"));
8960
8966
  PACKAGE_VERSION = pkg.version ?? "unknown";
8961
8967
  } catch {
8962
8968
  }
@@ -9848,4 +9854,4 @@ smol-toml/dist/index.js:
9848
9854
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9849
9855
  *)
9850
9856
  */
9851
- //# sourceMappingURL=chunk-TQYOGZIN.js.map
9857
+ //# sourceMappingURL=chunk-PGLO6WA5.js.map