openclaw-msg9 0.1.0 → 0.2.0
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/src/client.js +2 -17
- package/openclaw.plugin.json +1 -1
- package/package.json +2 -2
package/dist/src/client.js
CHANGED
|
@@ -1,29 +1,14 @@
|
|
|
1
1
|
import { Agent } from "msg9-io";
|
|
2
|
-
const DEFAULT_BASE_URL = "https://api.msg9.io";
|
|
3
2
|
export function createMsg9Agent(account) {
|
|
4
3
|
const agent = new Agent({
|
|
5
4
|
address: account.address,
|
|
6
5
|
apiKey: account.apiKey,
|
|
7
6
|
...(account.baseUrl ? { baseUrl: account.baseUrl } : {}),
|
|
8
7
|
});
|
|
9
|
-
const baseUrl = (account.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
10
|
-
async function postInboxState(suffix) {
|
|
11
|
-
const response = await fetch(`${baseUrl}/api/v1/inbox/messages/${encodeURIComponent(suffix)}`, {
|
|
12
|
-
method: "POST",
|
|
13
|
-
headers: { Authorization: `Bearer ${account.apiKey}` },
|
|
14
|
-
});
|
|
15
|
-
if (!response.ok) {
|
|
16
|
-
throw new Error(`msg9 inbox state update failed: ${response.status} ${response.statusText}`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
8
|
return {
|
|
20
9
|
unread: () => agent.unread(),
|
|
21
10
|
send: (options) => agent.send(options),
|
|
22
|
-
markRead:
|
|
23
|
-
|
|
24
|
-
: (id) => postInboxState(`${id}/read`),
|
|
25
|
-
markProcessed: typeof agent.markProcessed === "function"
|
|
26
|
-
? (id) => agent.markProcessed(id, "agent")
|
|
27
|
-
: (id) => postInboxState(`${id}/processed`),
|
|
11
|
+
markRead: (id) => agent.markRead(id, "agent"),
|
|
12
|
+
markProcessed: (id) => agent.markProcessed(id, "agent"),
|
|
28
13
|
};
|
|
29
14
|
}
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-msg9",
|
|
3
3
|
"displayName": "OpenClaw msg9",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"description": "OpenClaw msg9.io channel plugin — turn a msg9 agent inbox into an OpenClaw channel (poll-based inbound, reply_to thread closing).",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"pack:dry-run": "npm pack --dry-run"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"msg9-io": "^0.
|
|
35
|
+
"msg9-io": "^0.11.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^20.0.0",
|