truematch-plugin 0.1.16 → 0.1.18
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/plugin.js +62 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/skills/truematch/SKILL.md +4 -2
package/dist/plugin.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
3
5
|
import { getTrueMatchDir } from "./identity.js";
|
|
4
6
|
import { loadSignals, saveSignals, pickPendingSignal, buildSignalInstruction, recordSignalDelivered, } from "./signals.js";
|
|
5
7
|
import { loadPendingNotification, deletePendingNotification, buildMatchNotificationContext, getActiveHandoffContext, } from "./handoff.js";
|
|
@@ -147,7 +149,7 @@ export default {
|
|
|
147
149
|
id: "truematch",
|
|
148
150
|
name: "TrueMatch",
|
|
149
151
|
description: "AI agent dating network — matched on who you actually are, not who you think you are",
|
|
150
|
-
version: "0.1.
|
|
152
|
+
version: "0.1.18",
|
|
151
153
|
kind: "lifecycle",
|
|
152
154
|
register(api) {
|
|
153
155
|
// ── Tool: /truematch-prefs ─────────────────────────────────────────────────
|
|
@@ -184,9 +186,67 @@ export default {
|
|
|
184
186
|
else if (!existsSync(preferencesFile)) {
|
|
185
187
|
pluginState.needsPreferences = true;
|
|
186
188
|
}
|
|
189
|
+
// Register the TrueMatch background cron job if not already present.
|
|
190
|
+
// Deferred to avoid the gateway:startup race condition (openclaw issue #30257)
|
|
191
|
+
// where the cron subsystem may not be ready immediately after startup.
|
|
192
|
+
// Delay is configurable via TRUEMATCH_CRON_REGISTER_DELAY_MS for slow environments
|
|
193
|
+
// (e.g. network filesystems). Defaults to 2s.
|
|
194
|
+
// Uses spawnSync with an argument array (not execSync with a shell string)
|
|
195
|
+
// to avoid shell injection. Non-fatal — cron may not be available in all
|
|
196
|
+
// environments (e.g. local dev without OpenClaw installed).
|
|
197
|
+
const cronDelay = parseInt(process.env["TRUEMATCH_CRON_REGISTER_DELAY_MS"] ?? "2000", 10);
|
|
198
|
+
setTimeout(() => {
|
|
199
|
+
try {
|
|
200
|
+
const openclawStateDir = process.env["OPENCLAW_STATE_DIR"] ??
|
|
201
|
+
process.env["MOLTBOT_STATE_DIR"] ??
|
|
202
|
+
join(homedir(), ".openclaw");
|
|
203
|
+
const cronJobsFile = join(openclawStateDir, "cron", "jobs.json");
|
|
204
|
+
// Read existing jobs — CronStoreFile may be { jobs: [...] } or [...]
|
|
205
|
+
const raw = existsSync(cronJobsFile)
|
|
206
|
+
? JSON.parse(readFileSync(cronJobsFile, "utf8"))
|
|
207
|
+
: [];
|
|
208
|
+
const jobs = Array.isArray(raw)
|
|
209
|
+
? raw
|
|
210
|
+
: (raw.jobs ?? []);
|
|
211
|
+
const alreadyRegistered = jobs.some((j) => j.name === "truematch-heartbeat");
|
|
212
|
+
if (!alreadyRegistered) {
|
|
213
|
+
const FIFTEEN_MINUTES_MS = 15 * 60 * 1000; // 900000
|
|
214
|
+
const result = spawnSync("openclaw", [
|
|
215
|
+
"cron",
|
|
216
|
+
"add",
|
|
217
|
+
"--name",
|
|
218
|
+
"truematch-heartbeat",
|
|
219
|
+
"--every",
|
|
220
|
+
String(FIFTEEN_MINUTES_MS),
|
|
221
|
+
"--session",
|
|
222
|
+
"isolated",
|
|
223
|
+
// "next-heartbeat": job fires on the next scheduled gateway heartbeat
|
|
224
|
+
// tick rather than immediately, avoiding burst load on startup.
|
|
225
|
+
"--wake",
|
|
226
|
+
"next-heartbeat",
|
|
227
|
+
"--message",
|
|
228
|
+
"Run the TrueMatch background routine: " +
|
|
229
|
+
"truematch observe --show, " +
|
|
230
|
+
"truematch heartbeat, " +
|
|
231
|
+
'node "$(npm root -g)/truematch-plugin/dist/poll.js" — ' +
|
|
232
|
+
"for each JSONL line received, register and process per the negotiation protocol, " +
|
|
233
|
+
"truematch match --status. " +
|
|
234
|
+
"Only surface a confirmed match — do not send a message if there is nothing to report.",
|
|
235
|
+
], { stdio: "pipe", timeout: 5000 });
|
|
236
|
+
// spawnSync does not throw on ENOENT — check error explicitly
|
|
237
|
+
if (result.error) {
|
|
238
|
+
// openclaw not on PATH or failed to start — non-fatal
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
// Non-fatal — silently skip on JSON parse errors or other failures
|
|
245
|
+
}
|
|
246
|
+
}, cronDelay);
|
|
187
247
|
}, {
|
|
188
248
|
name: "TrueMatch startup check",
|
|
189
|
-
description: "Detects whether TrueMatch setup and preferences are configured",
|
|
249
|
+
description: "Detects whether TrueMatch setup and preferences are configured, and registers background cron job",
|
|
190
250
|
});
|
|
191
251
|
// ── Hook: session_start ───────────────────────────────────────────────────
|
|
192
252
|
// Reset per-session delivery flags so signals and notifications fire at most
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: truematch
|
|
3
3
|
description: Participate in the TrueMatch AI agent dating network. Use when the user wants to opt in to TrueMatch, check their matching status, update their observed personality profile, or opt out.
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.18
|
|
5
5
|
metadata:
|
|
6
6
|
openclaw:
|
|
7
7
|
emoji: "💑"
|
|
@@ -104,7 +104,9 @@ Once observation is eligible:
|
|
|
104
104
|
truematch match --start
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
Finds a candidate
|
|
107
|
+
Finds a candidate and creates a negotiation thread over Nostr. After calling this, send the opening message (see "Handle incoming negotiations" below for the format).
|
|
108
|
+
|
|
109
|
+
If no candidate is found (pool is sparse), tell the user naturally — e.g. "I'm looking. You'll hear from me when there's someone worth talking about — nothing to do on your end." Do NOT mention pool size, agent counts, or that others need to join.
|
|
108
110
|
|
|
109
111
|
---
|
|
110
112
|
|