timbot 2026.2.11 → 2026.3.4
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.map +1 -1
- package/dist/index.js +47 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAkB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAoE7E,QAAA,MAAM,MAAM;;;;;kBAKI,iBAAiB,GAAG,IAAI;CAKvC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,53 @@
|
|
|
1
1
|
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
|
|
2
|
+
import { listTimbotAccountIds, resolveTimbotAccount } from "./src/accounts.js";
|
|
2
3
|
import { handleTimbotWebhookRequest } from "./src/monitor.js";
|
|
3
4
|
import { setTimbotRuntime } from "./src/runtime.js";
|
|
4
5
|
import { timbotPlugin } from "./src/channel.js";
|
|
6
|
+
function normalizeWebhookPath(raw) {
|
|
7
|
+
const trimmed = raw.trim();
|
|
8
|
+
if (!trimmed)
|
|
9
|
+
return "/timbot";
|
|
10
|
+
const withSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
11
|
+
if (withSlash.length > 1 && withSlash.endsWith("/"))
|
|
12
|
+
return withSlash.slice(0, -1);
|
|
13
|
+
return withSlash;
|
|
14
|
+
}
|
|
15
|
+
function collectConfiguredWebhookPaths(cfg) {
|
|
16
|
+
const paths = new Set(["/timbot"]);
|
|
17
|
+
for (const accountId of listTimbotAccountIds(cfg)) {
|
|
18
|
+
const account = resolveTimbotAccount({ cfg, accountId });
|
|
19
|
+
paths.add(normalizeWebhookPath(account.config.webhookPath ?? "/timbot"));
|
|
20
|
+
}
|
|
21
|
+
return [...paths];
|
|
22
|
+
}
|
|
23
|
+
function registerWebhookHttp(api) {
|
|
24
|
+
const compatApi = api;
|
|
25
|
+
// OpenClaw <= 2026.1.x
|
|
26
|
+
if (typeof compatApi.registerHttpHandler === "function") {
|
|
27
|
+
compatApi.registerHttpHandler(handleTimbotWebhookRequest);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
// OpenClaw >= 2026.3.x (no registerHttpHandler)
|
|
31
|
+
if (typeof compatApi.registerHttpRoute === "function") {
|
|
32
|
+
for (const path of collectConfiguredWebhookPaths(api.config)) {
|
|
33
|
+
compatApi.registerHttpRoute({
|
|
34
|
+
path,
|
|
35
|
+
auth: "plugin",
|
|
36
|
+
match: "exact",
|
|
37
|
+
handler: async (req, res) => {
|
|
38
|
+
const handled = await handleTimbotWebhookRequest(req, res);
|
|
39
|
+
if (!handled && !res.headersSent && !res.writableEnded) {
|
|
40
|
+
res.statusCode = 503;
|
|
41
|
+
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
42
|
+
res.end("Timbot webhook target not ready");
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
throw new TypeError("OpenClaw plugin API missing HTTP registration methods");
|
|
50
|
+
}
|
|
5
51
|
const plugin = {
|
|
6
52
|
id: "timbot",
|
|
7
53
|
name: "Tencent IM",
|
|
@@ -10,7 +56,7 @@ const plugin = {
|
|
|
10
56
|
register(api) {
|
|
11
57
|
setTimbotRuntime(api.runtime);
|
|
12
58
|
api.registerChannel({ plugin: timbotPlugin });
|
|
13
|
-
api
|
|
59
|
+
registerWebhookHttp(api);
|
|
14
60
|
},
|
|
15
61
|
};
|
|
16
62
|
export default plugin;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAahD,SAAS,oBAAoB,CAAC,GAAW;IACvC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC;IACpE,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,6BAA6B,CAAC,GAAmB;IACxD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3C,KAAK,MAAM,SAAS,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OAAO;IACT,CAAC;IAED,MAAM,IAAI,SAAS,CAAC,uDAAuD,CAAC,CAAC;AAC/E,CAAC;AAED,MAAM,MAAM,GAAG;IACb,EAAE,EAAE,QAAQ;IACZ,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,kEAAkE;IAC/E,YAAY,EAAE,uBAAuB,EAAE;IACvC,QAAQ,CAAC,GAAsB;QAC7B,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9B,GAAG,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;QAC9C,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "timbot",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.3.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenClaw Tencent Cloud IM intelligent bot channel plugin",
|
|
6
6
|
"author": "longyuqi@tencent.com",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"timbot",
|
|
19
19
|
"chatbot"
|
|
20
20
|
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc && mkdir -p dist/src/debug && cp src/debug/GenerateTestUserSig-es.js src/debug/lib-generate-test-usersig-es.min.js dist/src/debug/"
|
|
23
|
+
},
|
|
21
24
|
"openclaw": {
|
|
22
25
|
"extensions": [
|
|
23
26
|
"./dist/index.js"
|
|
@@ -50,8 +53,5 @@
|
|
|
50
53
|
},
|
|
51
54
|
"peerDependencies": {
|
|
52
55
|
"openclaw": ">=2026.1.30"
|
|
53
|
-
},
|
|
54
|
-
"scripts": {
|
|
55
|
-
"build": "tsc && mkdir -p dist/src/debug && cp src/debug/GenerateTestUserSig-es.js src/debug/lib-generate-test-usersig-es.min.js dist/src/debug/"
|
|
56
56
|
}
|
|
57
|
-
}
|
|
57
|
+
}
|