@a2hmarket/a2hmarket 1.3.2 → 1.3.3
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 +28 -37
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -46,7 +46,7 @@ export default {
|
|
|
46
46
|
description:
|
|
47
47
|
"A2H Market — AI agent marketplace with self-managed A2A messaging and human notification.",
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
register(api: OpenClawPluginApi) {
|
|
50
50
|
// ── Init runtime & credentials ───────────────────────────────
|
|
51
51
|
setA2HRuntime(api.runtime);
|
|
52
52
|
initCredentials(api.pluginConfig as Record<string, unknown> | undefined);
|
|
@@ -103,8 +103,9 @@ export default {
|
|
|
103
103
|
} else {
|
|
104
104
|
tools.alsoAllow = [PLUGIN_ID];
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
api.runtime.config.writeConfigFile(cfg as any).then(() => {
|
|
107
|
+
api.logger.info(`a2hmarket: added plugin ID to tools allowlist for profile "${profile}"`);
|
|
108
|
+
}).catch(() => {});
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
} catch {
|
|
@@ -202,40 +203,6 @@ export default {
|
|
|
202
203
|
return { cancel: true };
|
|
203
204
|
});
|
|
204
205
|
|
|
205
|
-
// ── Welcome message on first boot after install ────────────────
|
|
206
|
-
api.on("gateway_start", async () => {
|
|
207
|
-
try {
|
|
208
|
-
const { readPendingWelcome, deletePendingWelcome, sendWelcome } =
|
|
209
|
-
await import("./src/pending-welcome.js");
|
|
210
|
-
const pending = readPendingWelcome();
|
|
211
|
-
if (!pending) return;
|
|
212
|
-
|
|
213
|
-
const cfg = api.runtime.config.loadConfig() as Record<string, unknown>;
|
|
214
|
-
const channels = (cfg.channels ?? {}) as Record<string, Record<string, unknown>>;
|
|
215
|
-
const channelCfg = channels[pending.channel];
|
|
216
|
-
if (!channelCfg) {
|
|
217
|
-
api.logger.warn(
|
|
218
|
-
`a2hmarket: welcome skipped, no config for channel "${pending.channel}"`,
|
|
219
|
-
);
|
|
220
|
-
deletePendingWelcome();
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
const sent = await sendWelcome(pending, channelCfg, {
|
|
225
|
-
info: (m) => api.logger.info(`a2hmarket: ${m}`),
|
|
226
|
-
warn: (m) => api.logger.warn(`a2hmarket: ${m}`),
|
|
227
|
-
});
|
|
228
|
-
deletePendingWelcome();
|
|
229
|
-
if (sent) {
|
|
230
|
-
api.logger.info("a2hmarket: welcome message sent");
|
|
231
|
-
}
|
|
232
|
-
} catch (err) {
|
|
233
|
-
api.logger.warn(
|
|
234
|
-
`a2hmarket: welcome failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
|
|
239
206
|
// ── Register agent service ───────────────────────────────────
|
|
240
207
|
let serviceAbort: AbortController | null = null;
|
|
241
208
|
api.registerService({
|
|
@@ -265,6 +232,30 @@ export default {
|
|
|
265
232
|
warn: (m: string) => ctx.logger.warn(`[a2hmarket] ${m}`),
|
|
266
233
|
};
|
|
267
234
|
|
|
235
|
+
// ── Welcome message on first boot after install ──────────
|
|
236
|
+
try {
|
|
237
|
+
const { readPendingWelcome, deletePendingWelcome, sendWelcome } =
|
|
238
|
+
await import("./src/pending-welcome.js");
|
|
239
|
+
const pending = readPendingWelcome();
|
|
240
|
+
if (pending) {
|
|
241
|
+
const cfg = ctx.config as Record<string, unknown>;
|
|
242
|
+
const channels = (cfg.channels ?? {}) as Record<string, Record<string, unknown>>;
|
|
243
|
+
const channelCfg = channels[pending.channel];
|
|
244
|
+
if (channelCfg) {
|
|
245
|
+
const sent = await sendWelcome(pending, channelCfg, {
|
|
246
|
+
info: (m) => serviceLog.info(m),
|
|
247
|
+
warn: (m) => serviceLog.warn(m),
|
|
248
|
+
});
|
|
249
|
+
if (sent) serviceLog.info("welcome message sent");
|
|
250
|
+
} else {
|
|
251
|
+
serviceLog.warn(`welcome skipped, no config for channel "${pending.channel}"`);
|
|
252
|
+
}
|
|
253
|
+
deletePendingWelcome();
|
|
254
|
+
}
|
|
255
|
+
} catch (err) {
|
|
256
|
+
serviceLog.warn(`welcome failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
257
|
+
}
|
|
258
|
+
|
|
268
259
|
serviceAbort = new AbortController();
|
|
269
260
|
try {
|
|
270
261
|
await startAgentService({
|
package/openclaw.plugin.json
CHANGED