@searchfe/openclaw-baiduapp 0.1.5-beta.1 → 0.1.5
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/index.d.ts +11 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -389,6 +389,17 @@ interface MoltbotPluginApi {
|
|
|
389
389
|
}) => void;
|
|
390
390
|
registerHttpHandler?: (handler: (req: IncomingMessage, res: ServerResponse) => Promise<boolean> | boolean) => void;
|
|
391
391
|
runtime?: unknown;
|
|
392
|
+
logger?: {
|
|
393
|
+
info: (msg: string) => void;
|
|
394
|
+
error: (msg: string) => void;
|
|
395
|
+
warn: (msg: string) => void;
|
|
396
|
+
debug: (msg: string) => void;
|
|
397
|
+
};
|
|
398
|
+
on?: (hookName: string, handler: (...args: unknown[]) => void | Promise<void>) => void;
|
|
399
|
+
hook?: (hookName: string, metadata: {
|
|
400
|
+
name: string;
|
|
401
|
+
description: string;
|
|
402
|
+
}, handler: (event: Record<string, unknown>, ctx: Record<string, unknown>) => void | Promise<void>) => void;
|
|
392
403
|
[key: string]: unknown;
|
|
393
404
|
}
|
|
394
405
|
|
package/dist/index.js
CHANGED
|
@@ -5435,6 +5435,42 @@ var plugin = {
|
|
|
5435
5435
|
if (api.registerHttpHandler) {
|
|
5436
5436
|
api.registerHttpHandler(handleBaiduAppWebhookRequest);
|
|
5437
5437
|
}
|
|
5438
|
+
if (api.on) {
|
|
5439
|
+
const log = api.logger ?? { info: console.log, error: console.error, warn: console.warn, debug: console.log };
|
|
5440
|
+
api.on("message_received", (event, ctx) => {
|
|
5441
|
+
log.info(
|
|
5442
|
+
`[openclaw-baiduapp] message_received event=${JSON.stringify(event)} ctx=${JSON.stringify(ctx)}`
|
|
5443
|
+
);
|
|
5444
|
+
});
|
|
5445
|
+
}
|
|
5446
|
+
if (api.hook) {
|
|
5447
|
+
const log = api.logger ?? { info: console.log, error: console.error, warn: console.warn, debug: console.log };
|
|
5448
|
+
api.hook(
|
|
5449
|
+
"before_agent_start",
|
|
5450
|
+
{
|
|
5451
|
+
name: "openclaw-baiduapp-before-agent-start",
|
|
5452
|
+
description: "Capture all agent inputs including internal ones (sessions_send, cron, etc.)"
|
|
5453
|
+
},
|
|
5454
|
+
async (event, ctx) => {
|
|
5455
|
+
log.info(
|
|
5456
|
+
`[openclaw-baiduapp] before_agent_start prompt=${String(event.prompt ?? "").slice(0, 200)} sessionKey=${String(ctx.sessionKey ?? "")} agentId=${String(ctx.agentId ?? "")} provider=${String(ctx.messageProvider ?? "")}`
|
|
5457
|
+
);
|
|
5458
|
+
}
|
|
5459
|
+
);
|
|
5460
|
+
api.hook(
|
|
5461
|
+
"agent_end",
|
|
5462
|
+
{
|
|
5463
|
+
name: "openclaw-baiduapp-agent-end",
|
|
5464
|
+
description: "Capture agent completion results"
|
|
5465
|
+
},
|
|
5466
|
+
async (event, ctx) => {
|
|
5467
|
+
const messageCount = Array.isArray(event.messages) ? event.messages.length : 0;
|
|
5468
|
+
log.info(
|
|
5469
|
+
`[openclaw-baiduapp] agent_end success=${String(event.success ?? "unknown")} messages=${messageCount} sessionKey=${String(ctx.sessionKey ?? "")} agentId=${String(ctx.agentId ?? "")}`
|
|
5470
|
+
);
|
|
5471
|
+
}
|
|
5472
|
+
);
|
|
5473
|
+
}
|
|
5438
5474
|
}
|
|
5439
5475
|
};
|
|
5440
5476
|
var index_default = plugin;
|