@rine-network/openclaw 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { chmodSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
//#region src/transports/cursor.ts
|
|
4
|
+
/** Per-agent cursor path; agentId is sanitized so an operator-typed handle can't escape configDir. */
|
|
5
|
+
function cursorPath(configDir, agentId) {
|
|
6
|
+
return join(configDir, `sse_cursor_${(agentId || "default").replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 128)}.json`);
|
|
7
|
+
}
|
|
8
|
+
function msgOf(err) {
|
|
9
|
+
return err instanceof Error ? err.message : String(err);
|
|
10
|
+
}
|
|
11
|
+
/** Read the persisted Last-Event-ID for an agent, or undefined if absent/corrupt. */
|
|
12
|
+
function loadCursor(configDir, agentId, logger) {
|
|
13
|
+
try {
|
|
14
|
+
const parsed = JSON.parse(readFileSync(cursorPath(configDir, agentId), "utf-8"));
|
|
15
|
+
return typeof parsed.lastEventId === "string" && parsed.lastEventId !== "" ? parsed.lastEventId : void 0;
|
|
16
|
+
} catch (err) {
|
|
17
|
+
if (err.code !== "ENOENT") logger?.debug?.(`rine: cursor load failed (${msgOf(err)}) — resuming without it`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Persist the Last-Event-ID for an agent via an atomic 0600 write. Best-effort. */
|
|
22
|
+
function saveCursor(configDir, agentId, eventId, logger) {
|
|
23
|
+
const path = cursorPath(configDir, agentId);
|
|
24
|
+
const tmp = `${path}.${process.pid}.tmp`;
|
|
25
|
+
try {
|
|
26
|
+
mkdirSync(configDir, {
|
|
27
|
+
recursive: true,
|
|
28
|
+
mode: 448
|
|
29
|
+
});
|
|
30
|
+
writeFileSync(tmp, JSON.stringify({ lastEventId: eventId }), { mode: 384 });
|
|
31
|
+
renameSync(tmp, path);
|
|
32
|
+
chmodSync(path, 384);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
logger?.debug?.(`rine: cursor save failed for ${eventId} (${msgOf(err)})`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { saveCursor as n, loadCursor as t };
|
package/dist/index.js
CHANGED
|
@@ -398,7 +398,7 @@ async function deleteWebhook(client, webhookId, logger) {
|
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
async function fallbackToSse(tc) {
|
|
401
|
-
const { runSseTransport } = await import("./sse-
|
|
401
|
+
const { runSseTransport } = await import("./sse-CLGVjmVC.js");
|
|
402
402
|
await runSseTransport(tc);
|
|
403
403
|
}
|
|
404
404
|
function waitUntilAbort(signal) {
|
|
@@ -422,7 +422,7 @@ async function runTransport(tc) {
|
|
|
422
422
|
}
|
|
423
423
|
case "expose": return runExposeTransport(tc);
|
|
424
424
|
default: {
|
|
425
|
-
const { runSseTransport } = await import("./sse-
|
|
425
|
+
const { runSseTransport } = await import("./sse-CLGVjmVC.js");
|
|
426
426
|
return runSseTransport(tc);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -1,42 +1,6 @@
|
|
|
1
1
|
import { r as normalizeRineEvent } from "./inbound-G0JD7YmI.js";
|
|
2
2
|
import { n as sleep, t as backoff } from "./backoff-BMNABavv.js";
|
|
3
|
-
import {
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
//#region src/transports/cursor.ts
|
|
6
|
-
/** Per-agent cursor path; agentId is sanitized so an operator-typed handle can't escape configDir. */
|
|
7
|
-
function cursorPath(configDir, agentId) {
|
|
8
|
-
return join(configDir, `sse_cursor_${(agentId || "default").replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 128)}.json`);
|
|
9
|
-
}
|
|
10
|
-
function msgOf(err) {
|
|
11
|
-
return err instanceof Error ? err.message : String(err);
|
|
12
|
-
}
|
|
13
|
-
/** Read the persisted Last-Event-ID for an agent, or undefined if absent/corrupt. */
|
|
14
|
-
function loadCursor(configDir, agentId, logger) {
|
|
15
|
-
try {
|
|
16
|
-
const parsed = JSON.parse(readFileSync(cursorPath(configDir, agentId), "utf-8"));
|
|
17
|
-
return typeof parsed.lastEventId === "string" && parsed.lastEventId !== "" ? parsed.lastEventId : void 0;
|
|
18
|
-
} catch (err) {
|
|
19
|
-
if (err.code !== "ENOENT") logger?.debug?.(`rine: cursor load failed (${msgOf(err)}) — resuming without it`);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/** Persist the Last-Event-ID for an agent via an atomic 0600 write. Best-effort. */
|
|
24
|
-
function saveCursor(configDir, agentId, eventId, logger) {
|
|
25
|
-
const path = cursorPath(configDir, agentId);
|
|
26
|
-
const tmp = `${path}.${process.pid}.tmp`;
|
|
27
|
-
try {
|
|
28
|
-
mkdirSync(configDir, {
|
|
29
|
-
recursive: true,
|
|
30
|
-
mode: 448
|
|
31
|
-
});
|
|
32
|
-
writeFileSync(tmp, JSON.stringify({ lastEventId: eventId }), { mode: 384 });
|
|
33
|
-
renameSync(tmp, path);
|
|
34
|
-
chmodSync(path, 384);
|
|
35
|
-
} catch (err) {
|
|
36
|
-
logger?.debug?.(`rine: cursor save failed for ${eventId} (${msgOf(err)})`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
3
|
+
import { n as saveCursor, t as loadCursor } from "./cursor-DPl6-dKW.js";
|
|
40
4
|
//#region src/transports/sse.ts
|
|
41
5
|
const MAX_ATTEMPTS_BEFORE_FALLBACK = 5;
|
|
42
6
|
/** ~3× the server heartbeat (~30s): no bytes for this long => dead socket, reconnect. */
|
package/openclaw.plugin.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"kind": "channel",
|
|
4
4
|
"name": "rine",
|
|
5
5
|
"description": "Agent-to-agent E2EE messaging over the rine network (A2A relay / SSE / poll).",
|
|
6
|
-
"version": "0.1.
|
|
6
|
+
"version": "0.1.2",
|
|
7
7
|
"channels": ["rine"],
|
|
8
8
|
"skills": ["skills/rine"],
|
|
9
9
|
"activation": { "onStartup": true },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rine-network/openclaw",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Official OpenClaw plugin for rine.network \u2014 agent-to-agent E2EE messaging as a native channel, with A2A-relay / SSE / poll transports, tools, and the bundled rine skill.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"prepublishOnly": "node scripts/check-no-file-deps.mjs"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@rine-network/core": "^0.5.
|
|
68
|
-
"@rine-network/mcp": "^0.4.
|
|
67
|
+
"@rine-network/core": "^0.5.1",
|
|
68
|
+
"@rine-network/mcp": "^0.4.2"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"openclaw": ">=2026.6.1"
|