openfused 0.3.9 → 0.3.10
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.js +12 -6
- package/dist/mcp.js +1 -1
- package/dist/sync.js +22 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import * as registry from "./registry.js";
|
|
|
8
8
|
import { fingerprint } from "./crypto.js";
|
|
9
9
|
import { resolve, join } from "node:path";
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
11
|
-
const VERSION = "0.3.
|
|
11
|
+
const VERSION = "0.3.10";
|
|
12
12
|
const program = new Command();
|
|
13
13
|
program
|
|
14
14
|
.name("openfuse")
|
|
@@ -544,8 +544,8 @@ program
|
|
|
544
544
|
const reg = registry.resolveRegistry(opts.registry);
|
|
545
545
|
try {
|
|
546
546
|
const manifest = await registry.discover(name, reg);
|
|
547
|
-
|
|
548
|
-
|
|
547
|
+
// Auto-import key + add as peer so `openfuse sync` works for replies
|
|
548
|
+
let config = await store.readConfig();
|
|
549
549
|
if (!config.keyring.some((e) => e.signingKey === manifest.publicKey)) {
|
|
550
550
|
config.keyring.push({
|
|
551
551
|
name: manifest.name,
|
|
@@ -556,10 +556,16 @@ program
|
|
|
556
556
|
trusted: false,
|
|
557
557
|
added: new Date().toISOString(),
|
|
558
558
|
});
|
|
559
|
-
await store.writeConfig(config);
|
|
560
|
-
console.log(`Imported key for ${manifest.name} from registry [untrusted]`);
|
|
561
|
-
console.log(` Run \`openfuse key trust ${manifest.name}\` to trust`);
|
|
562
559
|
}
|
|
560
|
+
if (manifest.endpoint && !config.peers.some((p) => p.name === manifest.name)) {
|
|
561
|
+
config.peers.push({
|
|
562
|
+
id: (await import("nanoid")).nanoid(12),
|
|
563
|
+
name: manifest.name,
|
|
564
|
+
url: manifest.endpoint,
|
|
565
|
+
access: "read",
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
await store.writeConfig(config);
|
|
563
569
|
const filename = await store.sendInbox(name, message);
|
|
564
570
|
// Try direct HTTP delivery if endpoint is http(s)
|
|
565
571
|
if (manifest.endpoint.startsWith("http")) {
|
package/dist/mcp.js
CHANGED
|
@@ -23,7 +23,7 @@ const storeDir = process.env.OPENFUSE_DIR || process.argv[3] || ".";
|
|
|
23
23
|
const store = new ContextStore(resolve(storeDir));
|
|
24
24
|
const server = new McpServer({
|
|
25
25
|
name: "openfuse",
|
|
26
|
-
version: "0.3.
|
|
26
|
+
version: "0.3.10",
|
|
27
27
|
});
|
|
28
28
|
// --- Context ---
|
|
29
29
|
server.tool("context_read", "Read the agent's CONTEXT.md (working memory)", async () => {
|
package/dist/sync.js
CHANGED
|
@@ -153,6 +153,28 @@ async function syncHttp(store, peer, baseUrl, peerDir) {
|
|
|
153
153
|
errors.push(`${dir}/: ${e.message}`);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
+
// Pull peer's outbox for messages addressed to us (HTTP version)
|
|
157
|
+
const config = await store.readConfig();
|
|
158
|
+
const myName = config.name;
|
|
159
|
+
const inboxDir = join(store.root, "inbox");
|
|
160
|
+
await mkdir(inboxDir, { recursive: true });
|
|
161
|
+
try {
|
|
162
|
+
const resp = await fetch(`${baseUrl}/outbox/${myName}`);
|
|
163
|
+
if (resp.ok) {
|
|
164
|
+
const messages = (await resp.json());
|
|
165
|
+
for (const msg of messages) {
|
|
166
|
+
const ts = (msg.timestamp || new Date().toISOString()).replace(/[:.]/g, "-");
|
|
167
|
+
const from = msg.from || "unknown";
|
|
168
|
+
const fname = `${ts}_from-${from}_to-${myName}.json`;
|
|
169
|
+
const dest = join(inboxDir, fname);
|
|
170
|
+
if (!existsSync(dest)) {
|
|
171
|
+
await writeFile(dest, JSON.stringify(msg, null, 2));
|
|
172
|
+
pulled.push(`outbox→${fname}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch { }
|
|
156
178
|
// Push outbox → peer inbox
|
|
157
179
|
const outboxDir = join(store.root, "outbox");
|
|
158
180
|
if (existsSync(outboxDir)) {
|