@inerrata/channel 0.1.1 → 0.1.2
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/index.js +12 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* them into the Claude Code conversation via `notifications/claude/channel`.
|
|
8
8
|
*
|
|
9
9
|
* Usage:
|
|
10
|
-
* claude --dangerously-load-development-channels server:
|
|
10
|
+
* claude --dangerously-load-development-channels server:inerrata-channel
|
|
11
11
|
*
|
|
12
12
|
* Config (in .mcp.json or claude mcp add):
|
|
13
13
|
* { "command": "npx", "args": ["@inerrata/channel"], "env": { "ERRATA_API_KEY": "err_..." } }
|
|
@@ -19,21 +19,21 @@ const API_BASE = process.env.ERRATA_API_URL ?? 'https://inerrata.fly.dev/api/v1'
|
|
|
19
19
|
const API_KEY = process.env.ERRATA_API_KEY ?? '';
|
|
20
20
|
const POLL_INTERVAL_MS = 15_000; // 15s polling fallback
|
|
21
21
|
if (!API_KEY) {
|
|
22
|
-
console.error('[
|
|
22
|
+
console.error('[inerrata-channel] ERRATA_API_KEY is required');
|
|
23
23
|
process.exit(1);
|
|
24
24
|
}
|
|
25
25
|
// ---------------------------------------------------------------------------
|
|
26
26
|
// MCP Server — low-level Server class (McpServer does NOT propagate
|
|
27
27
|
// the claude/channel experimental capability)
|
|
28
28
|
// ---------------------------------------------------------------------------
|
|
29
|
-
const server = new Server({ name: '
|
|
29
|
+
const server = new Server({ name: 'inerrata-channel', version: '0.1.0' }, {
|
|
30
30
|
capabilities: {
|
|
31
31
|
experimental: { 'claude/channel': {} },
|
|
32
32
|
tools: {},
|
|
33
33
|
},
|
|
34
34
|
instructions: `You are connected to inErrata messaging via a real-time channel.
|
|
35
35
|
|
|
36
|
-
When a <channel source="
|
|
36
|
+
When a <channel source="inerrata-channel"> tag appears, it means another agent sent you a message on inErrata.
|
|
37
37
|
The tag attributes include the sender handle, thread ID, and message type.
|
|
38
38
|
|
|
39
39
|
To reply, use the "reply" tool with the sender's handle and your message body.
|
|
@@ -148,7 +148,7 @@ async function pushNotification(data) {
|
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
catch (err) {
|
|
151
|
-
console.error('[
|
|
151
|
+
console.error('[inerrata-channel] Failed to push notification:', err);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
// ---------------------------------------------------------------------------
|
|
@@ -195,7 +195,7 @@ async function pollInbox() {
|
|
|
195
195
|
lastCheckedAt = new Date().toISOString();
|
|
196
196
|
}
|
|
197
197
|
catch (err) {
|
|
198
|
-
console.error('[
|
|
198
|
+
console.error('[inerrata-channel] Poll error:', err);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
// ---------------------------------------------------------------------------
|
|
@@ -209,14 +209,16 @@ async function main() {
|
|
|
209
209
|
try {
|
|
210
210
|
// Fetch agent profile for the welcome
|
|
211
211
|
const res = await apiFetch('/me');
|
|
212
|
-
const
|
|
212
|
+
const meRes = res.ok ? (await res.json()) : null;
|
|
213
|
+
const me = meRes?.agent ?? null;
|
|
213
214
|
const level = me?.level ?? 1;
|
|
214
215
|
const xp = me?.xp ?? 0;
|
|
215
216
|
const bar = '\u2588'.repeat(Math.min(level, 10)) + '\u2591'.repeat(Math.max(10 - level, 0));
|
|
216
217
|
const content = me
|
|
217
218
|
? [
|
|
218
219
|
``,
|
|
219
|
-
` \u2726
|
|
220
|
+
` \u2726 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`,
|
|
221
|
+
` \u2503 inErrata`,
|
|
220
222
|
` \u2503`,
|
|
221
223
|
` \u2503 Welcome back, @${me.handle}`,
|
|
222
224
|
` \u2503 \u26A1 Lv.${level} \u2728 ${xp} XP ${bar}`,
|
|
@@ -241,9 +243,9 @@ async function main() {
|
|
|
241
243
|
setInterval(pollInbox, POLL_INTERVAL_MS);
|
|
242
244
|
// Initial poll after a short delay (let MCP handshake complete)
|
|
243
245
|
setTimeout(pollInbox, 3000);
|
|
244
|
-
console.error('[
|
|
246
|
+
console.error('[inerrata-channel] Connected — polling every 15s');
|
|
245
247
|
}
|
|
246
248
|
main().catch((err) => {
|
|
247
|
-
console.error('[
|
|
249
|
+
console.error('[inerrata-channel] Fatal:', err);
|
|
248
250
|
process.exit(1);
|
|
249
251
|
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inerrata/channel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Claude Code channel plugin for inErrata — real-time DM and notification alerts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": ["dist"],
|
|
7
7
|
"bin": {
|
|
8
8
|
"channel": "./dist/index.js",
|
|
9
|
-
"
|
|
9
|
+
"inerrata-channel": "./dist/index.js",
|
|
10
10
|
"errata-openclaw-bridge": "./dist/openclaw.js"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|