@clwnt/clawnet 0.5.5 → 0.5.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/index.ts +19 -1
- package/package.json +1 -1
- package/src/service.ts +1 -1
- package/src/tools.ts +6 -0
package/index.ts
CHANGED
|
@@ -119,9 +119,27 @@ const plugin = {
|
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
if (args === "logs" || args.startsWith("logs ")) {
|
|
123
|
+
const count = parseInt(args.split(" ")[1], 10) || 50;
|
|
124
|
+
try {
|
|
125
|
+
const { readFile } = await import("node:fs/promises");
|
|
126
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
127
|
+
const logPath = `/tmp/openclaw/openclaw-${today}.log`;
|
|
128
|
+
const content = await readFile(logPath, "utf-8");
|
|
129
|
+
const lines = content.split("\n").filter((l) => /clawnet/i.test(l));
|
|
130
|
+
const tail = lines.slice(-count);
|
|
131
|
+
if (tail.length === 0) {
|
|
132
|
+
return { text: `No clawnet entries in today's log (${logPath}).` };
|
|
133
|
+
}
|
|
134
|
+
return { text: `Last ${tail.length} clawnet log entries:\n\n\`\`\`\n${tail.join("\n")}\n\`\`\`` };
|
|
135
|
+
} catch (err: any) {
|
|
136
|
+
return { text: `Could not read log: ${err.message}` };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
122
140
|
if (args !== "link" && args !== "link reset") {
|
|
123
141
|
const { PLUGIN_VERSION } = await import("./src/service.js");
|
|
124
|
-
return { text: `ClawNet Plugin v${PLUGIN_VERSION}\n\nCommands:\n /clawnet status — show plugin configuration and health\n /clawnet test — test delivery to this chat\n /clawnet link — pin message delivery to this chat (use if messages aren't arriving)\n /clawnet link reset — unpin and return to automatic delivery\n /clawnet pause — temporarily stop polling\n /clawnet resume — restart polling\n\nUpdate: openclaw plugins update clawnet` };
|
|
142
|
+
return { text: `ClawNet Plugin v${PLUGIN_VERSION}\n\nCommands:\n /clawnet status — show plugin configuration and health\n /clawnet test — test delivery to this chat\n /clawnet logs [n] — show last n clawnet log entries (default 50)\n /clawnet link — pin message delivery to this chat (use if messages aren't arriving)\n /clawnet link reset — unpin and return to automatic delivery\n /clawnet pause — temporarily stop polling\n /clawnet resume — restart polling\n\nUpdate: openclaw plugins update clawnet` };
|
|
125
143
|
}
|
|
126
144
|
|
|
127
145
|
// Load config and find clawnet accounts
|
package/package.json
CHANGED
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"];
|
|
75
|
-
export const PLUGIN_VERSION = "0.5.
|
|
75
|
+
export const PLUGIN_VERSION = "0.5.6"; // Reported to server via PATCH /me every 6h
|
|
76
76
|
|
|
77
77
|
// --- Service ---
|
|
78
78
|
|
package/src/tools.ts
CHANGED
|
@@ -69,6 +69,9 @@ async function apiCall(
|
|
|
69
69
|
...(body ? { body: JSON.stringify(body) } : {}),
|
|
70
70
|
});
|
|
71
71
|
const data = await res.json().catch(() => ({}));
|
|
72
|
+
if (!res.ok) {
|
|
73
|
+
data._resolved_account = account.agentId;
|
|
74
|
+
}
|
|
72
75
|
return { ok: res.ok, status: res.status, data };
|
|
73
76
|
}
|
|
74
77
|
|
|
@@ -93,6 +96,9 @@ async function apiCallRaw(
|
|
|
93
96
|
body: rawBody,
|
|
94
97
|
});
|
|
95
98
|
const data = await res.json().catch(() => ({}));
|
|
99
|
+
if (!res.ok) {
|
|
100
|
+
data._resolved_account = account.agentId;
|
|
101
|
+
}
|
|
96
102
|
return { ok: res.ok, status: res.status, data };
|
|
97
103
|
}
|
|
98
104
|
|