@seeed-studio/meshtastic 0.1.1 → 0.2.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/.github/scripts/translate_readme.py +632 -0
- package/.github/translate/do-not-translate.md +6 -0
- package/.github/translate/glossary/es.md +23 -0
- package/.github/translate/glossary/fr.md +23 -0
- package/.github/translate/glossary/ja.md +23 -0
- package/.github/translate/glossary/pt.md +23 -0
- package/.github/translate/glossary/zh-CN.md +23 -0
- package/.github/translate/languages.json +37 -0
- package/.github/translate/prompts/es.md +16 -0
- package/.github/translate/prompts/fr.md +16 -0
- package/.github/translate/prompts/ja.md +17 -0
- package/.github/translate/prompts/pt.md +16 -0
- package/.github/translate/prompts/zh-CN.md +15 -0
- package/.github/workflows/publish.yml +25 -0
- package/.github/workflows/readme-translate.yml +166 -0
- package/AGENTS.md +172 -0
- package/LICENSE +21 -0
- package/README.es.md +337 -0
- package/README.fr.md +350 -0
- package/README.ja.md +344 -0
- package/README.md +262 -88
- package/README.pt.md +337 -0
- package/README.zh-CN.md +337 -0
- package/package.json +4 -3
- package/src/channel.ts +70 -17
- package/src/client.ts +108 -17
- package/src/config-schema.ts +37 -7
- package/src/inbound.ts +19 -4
- package/src/monitor.ts +131 -104
- package/src/mqtt-client.ts +30 -6
- package/src/normalize.ts +12 -4
- package/src/onboarding.ts +116 -28
- package/src/policy.ts +6 -2
- package/src/send.ts +13 -7
- package/src/types.ts +4 -2
package/src/send.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import { stripMarkdown } from "openclaw/plugin-sdk/text-runtime";
|
|
4
|
+
|
|
2
5
|
import { resolveMeshtasticAccount } from "./accounts.js";
|
|
3
6
|
import { hexToNodeNum, normalizeMeshtasticMessagingTarget } from "./normalize.js";
|
|
4
7
|
import { getMeshtasticRuntime } from "./runtime.js";
|
|
@@ -50,13 +53,15 @@ export async function sendMessageMeshtastic(
|
|
|
50
53
|
if (!account.configured) {
|
|
51
54
|
throw new Error(
|
|
52
55
|
`Meshtastic is not configured for account "${account.accountId}". ` +
|
|
53
|
-
`
|
|
56
|
+
`Run 'openclaw onboard' or set channels.meshtastic.transport and connection details in config.`,
|
|
54
57
|
);
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
const target = normalizeMeshtasticMessagingTarget(to);
|
|
58
61
|
if (!target) {
|
|
59
|
-
throw new Error(
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Invalid Meshtastic target: "${to}". Use a node ID like "!aabbccdd" or a channel name like "channel:LongFast".`,
|
|
64
|
+
);
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
const tableMode = runtime.channel.text.resolveMarkdownTableMode({
|
|
@@ -65,7 +70,8 @@ export async function sendMessageMeshtastic(
|
|
|
65
70
|
accountId: account.accountId,
|
|
66
71
|
});
|
|
67
72
|
const prepared = runtime.channel.text.convertMarkdownTables(text.trim(), tableMode);
|
|
68
|
-
|
|
73
|
+
const stripped = stripMarkdown(prepared);
|
|
74
|
+
if (!stripped.trim()) {
|
|
69
75
|
throw new Error("Message must be non-empty for Meshtastic sends");
|
|
70
76
|
}
|
|
71
77
|
|
|
@@ -73,17 +79,17 @@ export async function sendMessageMeshtastic(
|
|
|
73
79
|
|
|
74
80
|
if (transport === "mqtt") {
|
|
75
81
|
if (activeMqttSend) {
|
|
76
|
-
await activeMqttSend(
|
|
82
|
+
await activeMqttSend(stripped, target, opts.channelName);
|
|
77
83
|
} else {
|
|
78
|
-
throw new Error("No active MQTT connection.
|
|
84
|
+
throw new Error("No active MQTT connection. Run 'openclaw gateway start' to connect.");
|
|
79
85
|
}
|
|
80
86
|
} else {
|
|
81
87
|
// Serial or HTTP: use active transport if available.
|
|
82
88
|
if (activeSerialSend) {
|
|
83
89
|
const destination = target.startsWith("!") ? hexToNodeNum(target) : undefined;
|
|
84
|
-
await activeSerialSend(
|
|
90
|
+
await activeSerialSend(stripped, destination, opts.channelIndex);
|
|
85
91
|
} else {
|
|
86
|
-
throw new Error(`No active ${transport} connection.
|
|
92
|
+
throw new Error(`No active ${transport} connection. Run 'openclaw gateway start' to connect.`);
|
|
87
93
|
}
|
|
88
94
|
}
|
|
89
95
|
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseProbeResult } from "openclaw/plugin-sdk";
|
|
2
1
|
import type {
|
|
2
|
+
BaseProbeResult,
|
|
3
3
|
BlockStreamingCoalesceConfig,
|
|
4
4
|
DmConfig,
|
|
5
5
|
DmPolicy,
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
GroupToolPolicyConfig,
|
|
9
9
|
MarkdownConfig,
|
|
10
10
|
OpenClawConfig,
|
|
11
|
-
} from "openclaw/plugin-sdk";
|
|
11
|
+
} from "openclaw/plugin-sdk/irc";
|
|
12
12
|
|
|
13
13
|
export type MeshtasticChannelConfig = {
|
|
14
14
|
requireMention?: boolean;
|
|
@@ -28,6 +28,8 @@ export type MeshtasticMqttConfig = {
|
|
|
28
28
|
topic?: string;
|
|
29
29
|
publishTopic?: string;
|
|
30
30
|
tls?: boolean;
|
|
31
|
+
/** Own node ID in !hex format — required for DM detection over MQTT. */
|
|
32
|
+
myNodeId?: string;
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
export type MeshtasticTransport = "serial" | "http" | "mqtt";
|