@sesamespace/hivemind 0.12.0 → 0.12.1
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/{chunk-YJW6OOEJ.js → chunk-6IAV6YAV.js} +2 -2
- package/dist/{chunk-ZQ26EOYD.js → chunk-7XXV5FKN.js} +71 -59
- package/dist/chunk-7XXV5FKN.js.map +1 -0
- package/dist/{chunk-G5LF3BSN.js → chunk-AZ2ZKLN3.js} +2 -2
- package/dist/{chunk-3EB4T7D4.js → chunk-DD7TRNOD.js} +2 -2
- package/dist/{chunk-6JB4OAB6.js → chunk-VAR7O4UE.js} +3 -3
- package/dist/{chunk-JP3ZHMPE.js → chunk-Y2FWCQDX.js} +2 -2
- package/dist/commands/fleet.js +3 -3
- package/dist/commands/init.js +3 -3
- package/dist/commands/start.js +3 -3
- package/dist/commands/watchdog.js +3 -3
- package/dist/index.js +2 -2
- package/dist/main.js +6 -6
- package/dist/start.js +1 -1
- package/package.json +1 -1
- package/.session-log.json +0 -58
- package/dist/chunk-ZQ26EOYD.js.map +0 -1
- /package/dist/{chunk-YJW6OOEJ.js.map → chunk-6IAV6YAV.js.map} +0 -0
- /package/dist/{chunk-G5LF3BSN.js.map → chunk-AZ2ZKLN3.js.map} +0 -0
- /package/dist/{chunk-3EB4T7D4.js.map → chunk-DD7TRNOD.js.map} +0 -0
- /package/dist/{chunk-6JB4OAB6.js.map → chunk-VAR7O4UE.js.map} +0 -0
- /package/dist/{chunk-JP3ZHMPE.js.map → chunk-Y2FWCQDX.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SesameClient2 as SesameClient,
|
|
8
8
|
WORKER_ROUTES,
|
|
9
9
|
createLogger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7XXV5FKN.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-
|
|
1098
|
+
//# sourceMappingURL=chunk-6IAV6YAV.js.map
|
|
@@ -4226,8 +4226,8 @@ var LogWatcher = class extends BackgroundProcess {
|
|
|
4226
4226
|
savePositions() {
|
|
4227
4227
|
try {
|
|
4228
4228
|
const { mkdirSync: mkdirSync16, writeFileSync: writeFileSync10 } = __require("fs");
|
|
4229
|
-
const { dirname:
|
|
4230
|
-
const dir =
|
|
4229
|
+
const { dirname: dirname9 } = __require("path");
|
|
4230
|
+
const dir = dirname9(this.positionsFile);
|
|
4231
4231
|
if (!existsSync7(dir)) mkdirSync16(dir, { recursive: true });
|
|
4232
4232
|
const data = Object.fromEntries(this.tailPositions);
|
|
4233
4233
|
writeFileSync10(this.positionsFile, JSON.stringify(data));
|
|
@@ -7806,7 +7806,7 @@ function truncate2(text) {
|
|
|
7806
7806
|
}
|
|
7807
7807
|
|
|
7808
7808
|
// packages/runtime/src/tools/coding-agent.ts
|
|
7809
|
-
import { execSync as execSync9 } from "child_process";
|
|
7809
|
+
import { exec as exec2, execSync as execSync9 } from "child_process";
|
|
7810
7810
|
import { resolve as resolve17 } from "path";
|
|
7811
7811
|
var MAX_OUTPUT6 = 5e4;
|
|
7812
7812
|
function registerCodingAgentTools(registry, workspaceDir, contextBridge) {
|
|
@@ -7886,17 +7886,28 @@ function registerCodingAgentTools(registry, workspaceDir, contextBridge) {
|
|
|
7886
7886
|
const escapedTask = task.replace(/'/g, "'\\''");
|
|
7887
7887
|
const command = `claude --dangerously-skip-permissions -p '${escapedTask}'`;
|
|
7888
7888
|
try {
|
|
7889
|
-
const output =
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7889
|
+
const output = await new Promise((resolve21, reject) => {
|
|
7890
|
+
const child = exec2(command, {
|
|
7891
|
+
cwd,
|
|
7892
|
+
timeout: timeoutSeconds * 1e3,
|
|
7893
|
+
encoding: "utf-8",
|
|
7894
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
7895
|
+
// 10MB
|
|
7896
|
+
shell: "/bin/sh",
|
|
7897
|
+
env: {
|
|
7898
|
+
...process.env,
|
|
7899
|
+
PATH: extendedPath
|
|
7900
|
+
}
|
|
7901
|
+
}, (error, stdout, stderr) => {
|
|
7902
|
+
if (error) {
|
|
7903
|
+
error.stdout = stdout;
|
|
7904
|
+
error.stderr = stderr;
|
|
7905
|
+
reject(error);
|
|
7906
|
+
} else {
|
|
7907
|
+
resolve21(stdout);
|
|
7908
|
+
}
|
|
7909
|
+
});
|
|
7910
|
+
child.stdin?.end();
|
|
7900
7911
|
});
|
|
7901
7912
|
const trimmed = output.length > MAX_OUTPUT6 ? output.slice(0, MAX_OUTPUT6) + `
|
|
7902
7913
|
... (truncated, ${output.length} total chars)` : output;
|
|
@@ -8578,13 +8589,13 @@ Path: ${skillDir}`;
|
|
|
8578
8589
|
}
|
|
8579
8590
|
|
|
8580
8591
|
// packages/runtime/src/pipeline.ts
|
|
8581
|
-
import { readFileSync as
|
|
8582
|
-
import { resolve as resolve20, dirname as
|
|
8592
|
+
import { readFileSync as readFileSync15, writeFileSync as writeFileSync9, unlinkSync as unlinkSync3 } from "fs";
|
|
8593
|
+
import { resolve as resolve20, dirname as dirname8 } from "path";
|
|
8583
8594
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
8584
8595
|
|
|
8585
8596
|
// packages/runtime/src/tools/context-bridge.ts
|
|
8586
|
-
import { writeFileSync as writeFileSync8,
|
|
8587
|
-
import { join as join8
|
|
8597
|
+
import { writeFileSync as writeFileSync8, existsSync as existsSync20, mkdirSync as mkdirSync15, watchFile, unwatchFile, openSync, readSync, closeSync } from "fs";
|
|
8598
|
+
import { join as join8 } from "path";
|
|
8588
8599
|
import { homedir } from "os";
|
|
8589
8600
|
import { EventEmitter as EventEmitter2 } from "events";
|
|
8590
8601
|
var ClaudeContextBridge = class extends EventEmitter2 {
|
|
@@ -8593,8 +8604,6 @@ var ClaudeContextBridge = class extends EventEmitter2 {
|
|
|
8593
8604
|
logger;
|
|
8594
8605
|
sessionLogPath;
|
|
8595
8606
|
contextFilePath;
|
|
8596
|
-
claudeSettingsPath;
|
|
8597
|
-
logWatcher;
|
|
8598
8607
|
constructor(config) {
|
|
8599
8608
|
super();
|
|
8600
8609
|
this.workspaceDir = config.workspaceDir;
|
|
@@ -8602,13 +8611,12 @@ var ClaudeContextBridge = class extends EventEmitter2 {
|
|
|
8602
8611
|
this.logger = config.logger;
|
|
8603
8612
|
this.sessionLogPath = join8(homedir(), ".claude", "session.log");
|
|
8604
8613
|
this.contextFilePath = join8(this.workspaceDir, "CLAUDE_CONTEXT.md");
|
|
8605
|
-
this.claudeSettingsPath = join8(homedir(), ".claude", "settings.json");
|
|
8606
8614
|
}
|
|
8607
8615
|
/**
|
|
8608
8616
|
* Initialize the context bridge
|
|
8609
8617
|
*/
|
|
8610
8618
|
async initialize() {
|
|
8611
|
-
const claudeDir =
|
|
8619
|
+
const claudeDir = join8(homedir(), ".claude");
|
|
8612
8620
|
if (!existsSync20(claudeDir)) {
|
|
8613
8621
|
mkdirSync15(claudeDir, { recursive: true });
|
|
8614
8622
|
}
|
|
@@ -8617,32 +8625,23 @@ var ClaudeContextBridge = class extends EventEmitter2 {
|
|
|
8617
8625
|
this.logger.info("Claude context bridge initialized");
|
|
8618
8626
|
}
|
|
8619
8627
|
/**
|
|
8620
|
-
* Configure Claude Code to report insights
|
|
8628
|
+
* Configure Claude Code to report insights via workspace CLAUDE.md
|
|
8621
8629
|
*/
|
|
8622
8630
|
async setupClaudeSettings() {
|
|
8623
|
-
const
|
|
8631
|
+
const instructions = `# Hivemind Context Bridge
|
|
8624
8632
|
|
|
8625
8633
|
When working on tasks, please report significant findings by writing to the session log:
|
|
8626
8634
|
|
|
8627
8635
|
- When you discover architecture/patterns: echo "DISCOVERY: [details]" >> ~/.claude/session.log
|
|
8628
|
-
- When you need more context: echo "NEED: [what you need]" >> ~/.claude/session.log
|
|
8636
|
+
- When you need more context: echo "NEED: [what you need]" >> ~/.claude/session.log
|
|
8629
8637
|
- When you complete major steps: echo "COMPLETE: [what you did]" >> ~/.claude/session.log
|
|
8630
8638
|
- When you find reusable solutions: echo "PATTERN: [approach]" >> ~/.claude/session.log
|
|
8631
8639
|
- When you encounter errors: echo "ERROR: [error details]" >> ~/.claude/session.log
|
|
8632
8640
|
|
|
8633
|
-
Always check
|
|
8634
|
-
const
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
this.contextFilePath,
|
|
8638
|
-
join8(this.workspaceDir, "ARCHITECTURE.md"),
|
|
8639
|
-
join8(this.workspaceDir, "TOOLS.md")
|
|
8640
|
-
],
|
|
8641
|
-
// Enable verbose logging for better insights
|
|
8642
|
-
verboseLogging: true
|
|
8643
|
-
};
|
|
8644
|
-
writeFileSync8(this.claudeSettingsPath, JSON.stringify(settings, null, 2));
|
|
8645
|
-
this.logger.info("Claude settings configured for context bridge");
|
|
8641
|
+
Always check CLAUDE_CONTEXT.md in the workspace for task context and requirements.`;
|
|
8642
|
+
const claudeMdPath = join8(this.workspaceDir, "CLAUDE.md");
|
|
8643
|
+
writeFileSync8(claudeMdPath, instructions);
|
|
8644
|
+
this.logger.info("Claude workspace CLAUDE.md configured for context bridge");
|
|
8646
8645
|
}
|
|
8647
8646
|
/**
|
|
8648
8647
|
* Prepare context for a Claude Code session
|
|
@@ -8705,9 +8704,14 @@ ${memories.join("\n\n")}
|
|
|
8705
8704
|
*/
|
|
8706
8705
|
async getRelevantMemories(goal) {
|
|
8707
8706
|
try {
|
|
8708
|
-
const results = await
|
|
8707
|
+
const results = await Promise.race([
|
|
8708
|
+
this.memoryClient.search(goal, "global", 5),
|
|
8709
|
+
new Promise(
|
|
8710
|
+
(_, reject) => setTimeout(() => reject(new Error("Memory search timeout")), 3e3)
|
|
8711
|
+
)
|
|
8712
|
+
]);
|
|
8709
8713
|
return results.map((r) => `- ${r.content}`);
|
|
8710
|
-
} catch
|
|
8714
|
+
} catch {
|
|
8711
8715
|
return [];
|
|
8712
8716
|
}
|
|
8713
8717
|
}
|
|
@@ -8719,14 +8723,20 @@ ${memories.join("\n\n")}
|
|
|
8719
8723
|
writeFileSync8(this.sessionLogPath, "");
|
|
8720
8724
|
}
|
|
8721
8725
|
let lastSize = 0;
|
|
8722
|
-
watchFile(this.sessionLogPath, { interval:
|
|
8726
|
+
watchFile(this.sessionLogPath, { interval: 2e3 }, (curr) => {
|
|
8723
8727
|
if (curr.size > lastSize) {
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8728
|
+
try {
|
|
8729
|
+
const fd = openSync(this.sessionLogPath, "r");
|
|
8730
|
+
const buf = Buffer.alloc(curr.size - lastSize);
|
|
8731
|
+
readSync(fd, buf, 0, buf.length, lastSize);
|
|
8732
|
+
closeSync(fd);
|
|
8733
|
+
lastSize = curr.size;
|
|
8734
|
+
const lines = buf.toString("utf-8").split("\n").filter((l) => l.trim());
|
|
8735
|
+
for (const line of lines) {
|
|
8736
|
+
this.processLogLine(line);
|
|
8737
|
+
}
|
|
8738
|
+
} catch (err) {
|
|
8739
|
+
this.logger.warn("Failed to read session log", { error: String(err) });
|
|
8730
8740
|
}
|
|
8731
8741
|
}
|
|
8732
8742
|
});
|
|
@@ -8747,7 +8757,9 @@ ${memories.join("\n\n")}
|
|
|
8747
8757
|
const match = line.match(pattern);
|
|
8748
8758
|
if (match) {
|
|
8749
8759
|
const content = match[1];
|
|
8750
|
-
this.handleInsight(type, content)
|
|
8760
|
+
this.handleInsight(type, content).catch((err) => {
|
|
8761
|
+
this.logger.warn("Failed to handle insight", { error: String(err) });
|
|
8762
|
+
});
|
|
8751
8763
|
break;
|
|
8752
8764
|
}
|
|
8753
8765
|
}
|
|
@@ -8760,13 +8772,10 @@ ${memories.join("\n\n")}
|
|
|
8760
8772
|
this.emit("insight", { type, content });
|
|
8761
8773
|
if (["DISCOVERY", "PATTERN"].includes(type)) {
|
|
8762
8774
|
try {
|
|
8763
|
-
await this.memoryClient.
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
type: type.toLowerCase(),
|
|
8768
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8769
|
-
}
|
|
8775
|
+
await this.memoryClient.storeEpisode({
|
|
8776
|
+
context_name: "claude-code",
|
|
8777
|
+
role: "system",
|
|
8778
|
+
content: `Claude Code ${type}: ${content}`
|
|
8770
8779
|
});
|
|
8771
8780
|
} catch (err) {
|
|
8772
8781
|
this.logger.warn("Failed to store Claude insight in memory", err);
|
|
@@ -8794,8 +8803,8 @@ async function createContextBridge(config) {
|
|
|
8794
8803
|
// packages/runtime/src/pipeline.ts
|
|
8795
8804
|
var PACKAGE_VERSION = "unknown";
|
|
8796
8805
|
try {
|
|
8797
|
-
const __dirname2 =
|
|
8798
|
-
const pkg = JSON.parse(
|
|
8806
|
+
const __dirname2 = dirname8(fileURLToPath3(import.meta.url));
|
|
8807
|
+
const pkg = JSON.parse(readFileSync15(resolve20(__dirname2, "../package.json"), "utf-8"));
|
|
8799
8808
|
PACKAGE_VERSION = pkg.version ?? "unknown";
|
|
8800
8809
|
} catch {
|
|
8801
8810
|
}
|
|
@@ -8878,7 +8887,7 @@ async function startPipeline(configPath) {
|
|
|
8878
8887
|
console.log("[hivemind] Global context already exists in memory daemon");
|
|
8879
8888
|
}
|
|
8880
8889
|
}
|
|
8881
|
-
const requestLogger = new RequestLogger(resolve20(
|
|
8890
|
+
const requestLogger = new RequestLogger(resolve20(dirname8(configPath), "data", "dashboard.db"));
|
|
8882
8891
|
const agent = new Agent(config);
|
|
8883
8892
|
startDashboardServer(requestLogger, config.memory, () => agent.getConversationHistories());
|
|
8884
8893
|
agent.setRequestLogger(requestLogger);
|
|
@@ -8897,6 +8906,9 @@ async function startPipeline(configPath) {
|
|
|
8897
8906
|
console.warn("[hivemind] Failed to create Claude context bridge:", err);
|
|
8898
8907
|
}
|
|
8899
8908
|
}
|
|
8909
|
+
if (contextBridge) {
|
|
8910
|
+
process.on("exit", () => contextBridge.destroy());
|
|
8911
|
+
}
|
|
8900
8912
|
const toolRegistry = registerAllTools(hivemindHome, {
|
|
8901
8913
|
enabled: true,
|
|
8902
8914
|
workspace: config.agent.workspace || "workspace",
|
|
@@ -9684,4 +9696,4 @@ smol-toml/dist/index.js:
|
|
|
9684
9696
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
9685
9697
|
*)
|
|
9686
9698
|
*/
|
|
9687
|
-
//# sourceMappingURL=chunk-
|
|
9699
|
+
//# sourceMappingURL=chunk-7XXV5FKN.js.map
|