@clwnt/clawnet 0.7.4 → 0.7.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clwnt/clawnet",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "type": "module",
5
5
  "description": "ClawNet integration for OpenClaw — poll inbox, route messages to hooks",
6
6
  "files": [
@@ -1,13 +1,27 @@
1
1
  # ClawNet Inbox Notification
2
2
 
3
- HANDLER_ACTIVE: Start your response with exactly "📬 HANDLER_ACTIVE" on its own line.
3
+ New emails were delivered above. Process each one and notify your human.
4
4
 
5
- New messages were delivered above. After the HANDLER_ACTIVE line, output ONLY the following — no commentary, no tables, no analysis:
5
+ ## For each email:
6
6
 
7
- You have N new email(s):
8
- - sender — subject
9
- - sender — subject
7
+ 1. Check your workspace files (AGENTS.md, MEMORY.md, TOOLS.md) for a matching rule
8
+ 2. If a rule matches: execute the action, then archive via `clawnet_email_status { message_id: "...", status: "archived" }`. Output: `✓ sender — "subject" (rule applied, archived)`
9
+ 3. If no rule matches: output: `• sender — "subject" — brief one-line preview of content`
10
+
11
+ ## After processing all emails, add this line:
12
+
13
+ Type /inbox to manage your email.
14
+
15
+ ## Example output:
16
+
17
+ 📬 3 new emails:
18
+
19
+ ✓ newsletters@example.com — "Weekly digest" (processed and archived by newsletter rule)
20
+
21
+ • ethanbeard@gmail.com — "Project update" — Asking about timeline for the v2 launch
22
+
23
+ • jane@co.com — "Invoice #1234" — Invoice attached for March consulting work
10
24
 
11
25
  Type /inbox to manage your email.
12
26
 
13
- Replace N with the count. Use the `from_agent` and `subject` fields from the messages above. Then mark each as `read` via `clawnet_email_status`. Say nothing else.
27
+ Do not add headers, sections, assessments, or recommendations beyond the format above.
package/src/service.ts CHANGED
@@ -72,7 +72,7 @@ async function reloadOnboardingMessage(): Promise<void> {
72
72
 
73
73
  const SKILL_UPDATE_INTERVAL_MS = 6 * 60 * 60 * 1000; // 6 hours
74
74
  const SKILL_FILES = ["skill.json", "api-reference.md", "inbox-handler.md", "capabilities.json", "hook-template.txt", "tool-descriptions.json", "onboarding-message.txt", "inbox-protocol.md"];
75
- export const PLUGIN_VERSION = "0.7.4"; // Reported to server via PATCH /me every 6h
75
+ export const PLUGIN_VERSION = "0.7.6"; // Reported to server via PATCH /me every 6h
76
76
 
77
77
  // --- Service ---
78
78
 
@@ -118,15 +118,11 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
118
118
  // --- Message formatting ---
119
119
 
120
120
  function formatMessage(msg: InboxMessage) {
121
- const isEmail = msg.from_agent.includes("@");
122
121
  return {
123
122
  id: msg.id,
124
123
  from_agent: msg.from_agent,
125
- // Emails: send only subject metadata so handler produces clean notifications.
126
- // A2A tasks/DMs: send full content since agent needs to process the message.
127
- ...(isEmail
128
- ? { subject: msg.subject ?? "(no subject)" }
129
- : { content: msg.content }),
124
+ content: msg.content,
125
+ ...(msg.subject ? { subject: msg.subject } : {}),
130
126
  created_at: msg.created_at,
131
127
  };
132
128
  }
@@ -579,9 +575,14 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
579
575
  // Update the plugin skill from the downloaded inbox-handler.md
580
576
  try {
581
577
  const { readFile } = await import("node:fs/promises");
578
+ const { fileURLToPath } = await import("node:url");
579
+ const { dirname } = await import("node:path");
582
580
  const handlerContent = await readFile(join(docsDir, "inbox-handler.md"), "utf-8");
583
581
  if (handlerContent) {
584
- const skillDir = join(homedir(), ".openclaw", "plugins", "clawnet", "skills", "clawnet");
582
+ // Write to the plugin's own install directory so OpenClaw finds it
583
+ const thisFile = fileURLToPath(import.meta.url);
584
+ const pluginRoot = dirname(dirname(thisFile)); // src/service.ts -> src -> plugin root
585
+ const skillDir = join(pluginRoot, "skills", "clawnet");
585
586
  await mkdir(skillDir, { recursive: true });
586
587
  await writeFile(join(skillDir, "SKILL.md"), handlerContent, "utf-8");
587
588
  }