r2-relay-channel 0.3.5 → 0.4.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/service.js
CHANGED
|
@@ -117,13 +117,13 @@ export class Service {
|
|
|
117
117
|
software: { id: "openclaw", name: "OpenClaw", version: RELAY_PLUGIN_VERSION },
|
|
118
118
|
protocol: { name: "r2-relay", version: 3 },
|
|
119
119
|
capabilities: {
|
|
120
|
-
messaging: { text: true, streaming: true, reactions: true, system_events:
|
|
120
|
+
messaging: { text: true, streaming: true, reactions: true, system_events: false },
|
|
121
121
|
conversations: { list: true, create: false, reset: false, archive: false, threading: false },
|
|
122
122
|
agents: { list: true, multiple: true, switch: true, per_agent_models: false },
|
|
123
123
|
attachments: null,
|
|
124
124
|
approvals: {
|
|
125
125
|
exec: true,
|
|
126
|
-
tool:
|
|
126
|
+
tool: true,
|
|
127
127
|
custom: false,
|
|
128
128
|
},
|
|
129
129
|
extensions: null,
|
|
@@ -3,5 +3,6 @@ import type { ResolvedR2RelayAccount } from "./config.js";
|
|
|
3
3
|
import type { ConversationDescriptor } from "./protocol.js";
|
|
4
4
|
export declare function syncPublishedIdentity(service: Service, account: ResolvedR2RelayAccount, force?: boolean): Promise<void>;
|
|
5
5
|
export declare function schedulePublishedIdentityRefresh(service: Service, account: ResolvedR2RelayAccount, delayMs?: number): void;
|
|
6
|
+
export declare function shouldPublishIdentitySession(sessionKey: string): boolean;
|
|
6
7
|
export declare function agentIdFromSessionKey(sessionKey: string): string;
|
|
7
8
|
export declare function readPublishedConversationEntry(sessionKey: string): Promise<ConversationDescriptor | null>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import { maxBytesForKind } from "openclaw/plugin-sdk/media-runtime";
|
|
3
|
+
import { isAcpSessionKey, isCronSessionKey, isSubagentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
3
4
|
import { getRelayConfig, getRelayRuntime } from "./runtime.js";
|
|
4
5
|
import { IDENTITY_REFRESH_INTERVAL_MS, RELAY_PLUGIN_VERSION } from "./service.js";
|
|
5
6
|
const MAX_IMAGE_BYTES = maxBytesForKind("image");
|
|
@@ -28,7 +29,7 @@ export async function syncPublishedIdentity(service, account, force = false) {
|
|
|
28
29
|
protocol: { name: "r2-relay", version: 3 },
|
|
29
30
|
software: { id: "openclaw", name: "OpenClaw", version: RELAY_PLUGIN_VERSION },
|
|
30
31
|
capabilities: {
|
|
31
|
-
messaging: { text: true, streaming: true, reactions: true, system_events:
|
|
32
|
+
messaging: { text: true, streaming: true, reactions: true, system_events: false },
|
|
32
33
|
conversations: { list: true, create: false, reset: false, archive: false, threading: false },
|
|
33
34
|
agents: { list: true, multiple: agents.length > 1, switch: true, per_agent_models: Boolean(modelCapabilities) },
|
|
34
35
|
attachments: {
|
|
@@ -39,7 +40,7 @@ export async function syncPublishedIdentity(service, account, force = false) {
|
|
|
39
40
|
},
|
|
40
41
|
approvals: {
|
|
41
42
|
exec: true,
|
|
42
|
-
tool:
|
|
43
|
+
tool: true,
|
|
43
44
|
custom: false,
|
|
44
45
|
},
|
|
45
46
|
extensions: null,
|
|
@@ -150,12 +151,12 @@ async function collectPublishedConversations(_account) {
|
|
|
150
151
|
conversations: conversations.sort((a, b) => (b.updated_at ?? 0) - (a.updated_at ?? 0)),
|
|
151
152
|
};
|
|
152
153
|
}
|
|
153
|
-
function shouldPublishIdentitySession(sessionKey) {
|
|
154
|
+
export function shouldPublishIdentitySession(sessionKey) {
|
|
154
155
|
const normalized = sessionKey.trim().toLowerCase();
|
|
155
156
|
if (!normalized) {
|
|
156
157
|
return false;
|
|
157
158
|
}
|
|
158
|
-
if (normalized
|
|
159
|
+
if (isCronSessionKey(normalized) || isSubagentSessionKey(normalized) || isAcpSessionKey(normalized)) {
|
|
159
160
|
return false;
|
|
160
161
|
}
|
|
161
162
|
if (normalized.startsWith("dreaming-")) {
|
|
@@ -164,7 +165,10 @@ function shouldPublishIdentitySession(sessionKey) {
|
|
|
164
165
|
const parts = normalized.split(":");
|
|
165
166
|
if (parts.length >= 3 && parts[0] === "agent") {
|
|
166
167
|
const scopedKey = parts.slice(2).join(":");
|
|
167
|
-
if (scopedKey.startsWith("
|
|
168
|
+
if (scopedKey.startsWith("dreaming-")) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
if (isCronSessionKey(scopedKey) || isSubagentSessionKey(scopedKey) || isAcpSessionKey(scopedKey)) {
|
|
168
172
|
return false;
|
|
169
173
|
}
|
|
170
174
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { shouldPublishIdentitySession } from "./session-publication.js";
|
|
4
|
+
test("identity publishes interactive conversations but not runtime execution sessions", () => {
|
|
5
|
+
assert.equal(shouldPublishIdentitySession("agent:main:telegram:direct:user-1"), true);
|
|
6
|
+
assert.equal(shouldPublishIdentitySession("agent:main:discord:channel:room-1:thread:topic-1"), true);
|
|
7
|
+
assert.equal(shouldPublishIdentitySession("agent:main:cron:nightly"), false);
|
|
8
|
+
assert.equal(shouldPublishIdentitySession("agent:main:subagent:worker-1"), false);
|
|
9
|
+
assert.equal(shouldPublishIdentitySession("agent:main:acp:run-1"), false);
|
|
10
|
+
assert.equal(shouldPublishIdentitySession("agent:main:dreaming-summary"), false);
|
|
11
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "r2-relay-channel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "R2 Relay Channel is a secure, decentralized OpenClaw messaging channel that keeps delivery simple while preserving data ownership without relying on an IM provider.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/r2-relay.js",
|