openclaw-extension-typex 1.0.10 → 1.0.13
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/client/accounts.js +4 -4
- package/dist/client/config.js +1 -1
- package/dist/client/message.d.ts +2 -1
- package/dist/client/message.js +32 -6
- package/dist/client/monitor.d.ts +3 -1
- package/dist/client/monitor.js +3 -1
- package/dist/client/outbound.js +2 -2
- package/dist/onboarding.js +10 -11
- package/dist/plugin.js +7 -6
- package/openclaw.plugin.json +7 -11
- package/package.json +1 -1
package/dist/client/accounts.js
CHANGED
|
@@ -20,7 +20,7 @@ function readFileIfExists(filePath) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
function resolveAccountConfig(cfg, accountId) {
|
|
23
|
-
const accounts = cfg.channels?.typex?.accounts;
|
|
23
|
+
const accounts = cfg.channels?.['openclaw-extension-typex']?.accounts;
|
|
24
24
|
if (!accounts || typeof accounts !== "object") {
|
|
25
25
|
return undefined;
|
|
26
26
|
}
|
|
@@ -33,7 +33,7 @@ function resolveAccountConfig(cfg, accountId) {
|
|
|
33
33
|
return matchKey ? accounts[matchKey] : undefined;
|
|
34
34
|
}
|
|
35
35
|
function mergeTypeXAccountConfig(cfg, accountId) {
|
|
36
|
-
const { accounts: _ignored, ...base } = (cfg.channels?.typex ?? {});
|
|
36
|
+
const { accounts: _ignored, ...base } = (cfg.channels?.['openclaw-extension-typex'] ?? {});
|
|
37
37
|
const account = resolveAccountConfig(cfg, accountId) ?? {};
|
|
38
38
|
return { ...base, ...account };
|
|
39
39
|
}
|
|
@@ -49,7 +49,7 @@ function resolveAppSecret(config) {
|
|
|
49
49
|
return {};
|
|
50
50
|
}
|
|
51
51
|
function listTypeXAccountIds(cfg) {
|
|
52
|
-
const typexCfg = cfg.channels?.typex;
|
|
52
|
+
const typexCfg = cfg.channels?.['openclaw-extension-typex'];
|
|
53
53
|
const accounts = typexCfg?.accounts;
|
|
54
54
|
const ids = new Set();
|
|
55
55
|
const baseConfigured = Boolean(typexCfg?.appId?.trim() && (typexCfg?.appSecret?.trim() || Boolean(typexCfg?.appSecretFile)));
|
|
@@ -73,7 +73,7 @@ function resolveDefaultTypeXAccountId(cfg) {
|
|
|
73
73
|
}
|
|
74
74
|
function resolveTypeXAccount(params) {
|
|
75
75
|
const accountId = (0, plugin_sdk_1.normalizeAccountId)(params.accountId);
|
|
76
|
-
const baseEnabled = params.cfg.channels?.typex?.enabled !== false;
|
|
76
|
+
const baseEnabled = params.cfg.channels?.['openclaw-extension-typex']?.enabled !== false;
|
|
77
77
|
const merged = mergeTypeXAccountConfig(params.cfg, accountId);
|
|
78
78
|
const accountEnabled = merged.enabled !== false;
|
|
79
79
|
const enabled = baseEnabled && accountEnabled;
|
package/dist/client/config.js
CHANGED
|
@@ -15,7 +15,7 @@ const firstDefined = (...values) => {
|
|
|
15
15
|
*/
|
|
16
16
|
function resolveTypeXConfig(params) {
|
|
17
17
|
const { cfg, accountId } = params;
|
|
18
|
-
const typexCfg = cfg.channels?.typex;
|
|
18
|
+
const typexCfg = cfg.channels?.['openclaw-extension-typex'];
|
|
19
19
|
const accountCfg = accountId ? typexCfg?.accounts?.[accountId] : undefined;
|
|
20
20
|
const defaults = cfg.channels?.defaults;
|
|
21
21
|
return {
|
package/dist/client/message.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { TypeXClient } from "./client.js";
|
|
2
2
|
import type { TypeXMessageEntry } from "./types.js";
|
|
3
|
-
import { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
3
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk";
|
|
4
4
|
export type ProcessTypeXMessageOptions = {
|
|
5
|
+
/** Full OpenClaw gateway config (needed for bindings/routing). */
|
|
5
6
|
cfg?: OpenClawConfig;
|
|
6
7
|
accountId?: string;
|
|
7
8
|
botName?: string;
|
package/dist/client/message.js
CHANGED
|
@@ -4,7 +4,9 @@ exports.processTypeXMessage = processTypeXMessage;
|
|
|
4
4
|
const send_js_1 = require("./send.js");
|
|
5
5
|
const runtime_js_1 = require("./runtime.js");
|
|
6
6
|
async function processTypeXMessage(client, payload, appId, options = {}) {
|
|
7
|
-
|
|
7
|
+
// Use the full OpenClaw config for routing/bindings + dispatch.
|
|
8
|
+
// (typexCfg is only the channel-specific config.)
|
|
9
|
+
const cfg = options.cfg;
|
|
8
10
|
const accountId = options.accountId ?? appId;
|
|
9
11
|
const logger = options.logger;
|
|
10
12
|
const runtime = (0, runtime_js_1.getTypeXRuntime)();
|
|
@@ -24,6 +26,7 @@ async function processTypeXMessage(client, payload, appId, options = {}) {
|
|
|
24
26
|
// Attempt simple parsing if it looks like JSON? For now assume plain text or handle in future.
|
|
25
27
|
// Basic logging
|
|
26
28
|
logger?.info(`Processing TypeX message from ${senderId} in ${chatId}`);
|
|
29
|
+
logger?.info(`channel: ${JSON.stringify(channel)}, account: ${accountId}, type: ${typeof accountId}}`);
|
|
27
30
|
// Build Context for Agent
|
|
28
31
|
const ctx = {
|
|
29
32
|
Body: text,
|
|
@@ -33,22 +36,44 @@ async function processTypeXMessage(client, payload, appId, options = {}) {
|
|
|
33
36
|
SenderId: senderId,
|
|
34
37
|
SenderName: payload.sender_name || "User",
|
|
35
38
|
ChatType: "dm", // Simplified, TypeX mostly DM for now?
|
|
36
|
-
Provider: "typex",
|
|
37
|
-
Surface: "typex",
|
|
39
|
+
Provider: "openclaw-extension-typex",
|
|
40
|
+
Surface: "openclaw-extension-typex",
|
|
38
41
|
Timestamp: payload.create_time || Date.now(),
|
|
39
42
|
MessageSid: payload.message_id,
|
|
40
43
|
AccountId: accountId,
|
|
41
|
-
OriginatingChannel: "typex",
|
|
44
|
+
OriginatingChannel: "openclaw-extension-typex",
|
|
42
45
|
OriginatingTo: chatId,
|
|
43
46
|
};
|
|
47
|
+
if (!cfg) {
|
|
48
|
+
logger?.error(`[typex:${accountId}] missing full OpenClaw cfg; cannot route/bind.`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// Resolve agent route (bindings) and stamp SessionKey so the message runs in the right agent lane.
|
|
52
|
+
try {
|
|
53
|
+
const routing = channel.routing;
|
|
54
|
+
const route = routing?.resolveAgentRoute?.({
|
|
55
|
+
cfg,
|
|
56
|
+
channel: "openclaw-extension-typex",
|
|
57
|
+
accountId,
|
|
58
|
+
peer: { kind: "direct", id: String(chatId) },
|
|
59
|
+
});
|
|
60
|
+
if (route?.sessionKey) {
|
|
61
|
+
ctx.SessionKey = route.sessionKey;
|
|
62
|
+
logger?.info(`[typex:${accountId}] resolved route: agentId=${route.agentId} matchedBy=${route.matchedBy} sessionKey=${route.sessionKey}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
logger?.error(`[typex:${accountId}] resolveAgentRoute failed: ${e?.message || String(e)}`);
|
|
67
|
+
}
|
|
44
68
|
// Dispatch to Agent
|
|
45
69
|
await channel.reply.dispatchReplyWithBufferedBlockDispatcher({
|
|
46
70
|
ctx,
|
|
47
71
|
cfg,
|
|
48
72
|
dispatcherOptions: {
|
|
49
|
-
channel: "typex",
|
|
73
|
+
channel: "openclaw-extension-typex",
|
|
50
74
|
accountId,
|
|
51
75
|
deliver: async (payload) => {
|
|
76
|
+
logger?.info(`payload: ${payload}`);
|
|
52
77
|
const responsePayload = payload;
|
|
53
78
|
// Handle text response
|
|
54
79
|
if (responsePayload.text) {
|
|
@@ -70,7 +95,8 @@ async function processTypeXMessage(client, payload, appId, options = {}) {
|
|
|
70
95
|
},
|
|
71
96
|
replyOptions: {
|
|
72
97
|
disableBlockStreaming: true,
|
|
73
|
-
embedded
|
|
98
|
+
// Do not use embedded agent; let gateway bindings decide the agent.
|
|
99
|
+
embedded: false,
|
|
74
100
|
},
|
|
75
101
|
});
|
|
76
102
|
}
|
package/dist/client/monitor.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { RuntimeEnv } from "openclaw/plugin-sdk";
|
|
1
|
+
import type { RuntimeEnv, OpenClawConfig } from "openclaw/plugin-sdk";
|
|
2
2
|
export type MonitorTypeXOpts = {
|
|
3
3
|
account: unknown;
|
|
4
4
|
runtime: RuntimeEnv;
|
|
5
5
|
abortSignal: AbortSignal;
|
|
6
6
|
log?: unknown;
|
|
7
7
|
typexCfg: Record<string, any>;
|
|
8
|
+
/** Full OpenClaw gateway config (needed for bindings/routing). */
|
|
9
|
+
cfg: OpenClawConfig;
|
|
8
10
|
};
|
|
9
11
|
export declare function monitorTypeXProvider(opts: MonitorTypeXOpts): Promise<void>;
|
package/dist/client/monitor.js
CHANGED
|
@@ -40,7 +40,7 @@ const client_js_1 = require("./client.js");
|
|
|
40
40
|
const message_js_1 = require("./message.js");
|
|
41
41
|
async function monitorTypeXProvider(opts) {
|
|
42
42
|
try {
|
|
43
|
-
const { account, runtime, abortSignal, log, typexCfg } = opts;
|
|
43
|
+
const { account, runtime, abortSignal, log, typexCfg, cfg } = opts;
|
|
44
44
|
const accountObj = account;
|
|
45
45
|
const { email, token, appId } = accountObj.config;
|
|
46
46
|
// log is unknown, cast for usage
|
|
@@ -80,6 +80,8 @@ async function monitorTypeXProvider(opts) {
|
|
|
80
80
|
// Dispatch to OpenClaw via processTypeXMessage
|
|
81
81
|
await (0, message_js_1.processTypeXMessage)(client, msg, appId || accountObj.accountId, {
|
|
82
82
|
accountId: accountObj.accountId,
|
|
83
|
+
// Pass the full OpenClaw config so routing/bindings work.
|
|
84
|
+
cfg,
|
|
83
85
|
typexCfg,
|
|
84
86
|
botName: accountObj.name,
|
|
85
87
|
logger
|
package/dist/client/outbound.js
CHANGED
|
@@ -12,7 +12,7 @@ exports.typexOutbound = {
|
|
|
12
12
|
const client = (0, client_js_1.getTypeXClient)(accountId ?? undefined);
|
|
13
13
|
const result = await (0, send_js_1.sendMessageTypeX)(client, { text });
|
|
14
14
|
return {
|
|
15
|
-
channel: "typex",
|
|
15
|
+
channel: "openclaw-extension-typex",
|
|
16
16
|
messageId: result?.message_id || "unknown",
|
|
17
17
|
chatId: to,
|
|
18
18
|
};
|
|
@@ -21,7 +21,7 @@ exports.typexOutbound = {
|
|
|
21
21
|
const client = (0, client_js_1.getTypeXClient)(accountId ?? undefined);
|
|
22
22
|
const result = await (0, send_js_1.sendMessageTypeX)(client, { text: text || "" }, { mediaUrl });
|
|
23
23
|
return {
|
|
24
|
-
channel: "typex",
|
|
24
|
+
channel: "openclaw-extension-typex",
|
|
25
25
|
messageId: result?.message_id || "unknown",
|
|
26
26
|
chatId: to,
|
|
27
27
|
};
|
package/dist/onboarding.js
CHANGED
|
@@ -8,13 +8,12 @@ const qrcode_terminal_1 = __importDefault(require("qrcode-terminal"));
|
|
|
8
8
|
const accounts_js_1 = require("./client/accounts.js");
|
|
9
9
|
const client_js_1 = require("./client/client.js");
|
|
10
10
|
exports.typexOnboardingAdapter = {
|
|
11
|
-
channel: "typex",
|
|
11
|
+
channel: "openclaw-extension-typex",
|
|
12
12
|
getStatus: async ({ cfg }) => {
|
|
13
13
|
const accountId = (0, accounts_js_1.resolveDefaultTypeXAccountId)(cfg);
|
|
14
|
-
const configured = Boolean(cfg.channels?.typex?.accounts?.[accountId]?.
|
|
15
|
-
cfg.channels?.typex?.accounts?.[accountId]?.token);
|
|
14
|
+
const configured = Boolean(cfg.channels?.['openclaw-extension-typex']?.accounts?.[accountId]?.token);
|
|
16
15
|
return {
|
|
17
|
-
channel: "typex",
|
|
16
|
+
channel: "openclaw-extension-typex",
|
|
18
17
|
configured,
|
|
19
18
|
statusLines: [`TypeX (${accountId}): ${configured ? "configured" : "not configured"}`],
|
|
20
19
|
selectionHint: configured ? "configured" : "setup needed",
|
|
@@ -22,7 +21,7 @@ exports.typexOnboardingAdapter = {
|
|
|
22
21
|
};
|
|
23
22
|
},
|
|
24
23
|
configure: async ({ cfg, prompter }) => {
|
|
25
|
-
const typexCfg = (cfg.channels?.typex ?? {});
|
|
24
|
+
const typexCfg = (cfg.channels?.['openclaw-extension-typex'] ?? {});
|
|
26
25
|
const client = (0, client_js_1.getTypeXClient)(undefined, { skipConfigCheck: true, typexCfg, prompter });
|
|
27
26
|
await prompter.note(`Initializing TypeX ...\nPlease scan the QR code shortly.`, "TypeX Setup");
|
|
28
27
|
try {
|
|
@@ -55,15 +54,15 @@ exports.typexOnboardingAdapter = {
|
|
|
55
54
|
}
|
|
56
55
|
if (!cfg.channels)
|
|
57
56
|
cfg.channels = {};
|
|
58
|
-
if (!cfg.channels
|
|
59
|
-
cfg.channels
|
|
60
|
-
if (!cfg.channels
|
|
61
|
-
cfg.channels
|
|
57
|
+
if (!cfg.channels['openclaw-extension-typex'])
|
|
58
|
+
cfg.channels['openclaw-extension-typex'] = {};
|
|
59
|
+
if (!cfg.channels['openclaw-extension-typex'].accounts)
|
|
60
|
+
cfg.channels['openclaw-extension-typex'].accounts = {};
|
|
62
61
|
// save config
|
|
63
|
-
cfg.channels
|
|
62
|
+
cfg.channels['openclaw-extension-typex'].accounts[userId] = {
|
|
64
63
|
token: token,
|
|
65
64
|
};
|
|
66
|
-
cfg.channels
|
|
65
|
+
cfg.channels['openclaw-extension-typex'].defaultAccount = userId;
|
|
67
66
|
await prompter.note("Success! TypeX linked.", "Done");
|
|
68
67
|
await client.sendMessage("openclaw linked");
|
|
69
68
|
return { cfg, accountId: userId };
|
package/dist/plugin.js
CHANGED
|
@@ -41,13 +41,13 @@ exports.typexPlugin = {
|
|
|
41
41
|
configSchema: (0, plugin_sdk_1.buildChannelConfigSchema)(config_schema_js_1.TypeXConfigSchema),
|
|
42
42
|
config: {
|
|
43
43
|
listAccountIds: (cfg) => {
|
|
44
|
-
const accs = cfg.channels?.typex?.accounts || {};
|
|
44
|
+
const accs = cfg.channels?.['openclaw-extension-typex']?.accounts || {};
|
|
45
45
|
return Object.keys(accs);
|
|
46
46
|
},
|
|
47
47
|
resolveAccount: (cfg, accountId) => {
|
|
48
48
|
const id = accountId || plugin_sdk_1.DEFAULT_ACCOUNT_ID;
|
|
49
|
-
const globalCheck = cfg.channels?.typex;
|
|
50
|
-
const account = cfg.channels?.typex?.accounts?.[id] ||
|
|
49
|
+
const globalCheck = cfg.channels?.['openclaw-extension-typex'];
|
|
50
|
+
const account = cfg.channels?.['openclaw-extension-typex']?.accounts?.[id] ||
|
|
51
51
|
(id === plugin_sdk_1.DEFAULT_ACCOUNT_ID ? globalCheck : undefined);
|
|
52
52
|
return {
|
|
53
53
|
accountId: id,
|
|
@@ -59,7 +59,7 @@ exports.typexPlugin = {
|
|
|
59
59
|
};
|
|
60
60
|
},
|
|
61
61
|
defaultAccountId: (cfg) => {
|
|
62
|
-
const accs = cfg.channels?.typex?.accounts || {};
|
|
62
|
+
const accs = cfg.channels?.['openclaw-extension-typex']?.accounts || {};
|
|
63
63
|
const first = Object.keys(accs)[0];
|
|
64
64
|
return first || plugin_sdk_1.DEFAULT_ACCOUNT_ID;
|
|
65
65
|
},
|
|
@@ -79,7 +79,7 @@ exports.typexPlugin = {
|
|
|
79
79
|
gateway: {
|
|
80
80
|
startAccount: async (ctx) => {
|
|
81
81
|
const { account, log, setStatus, abortSignal, runtime, cfg } = ctx;
|
|
82
|
-
const typexCfg = (cfg.channels?.typex ?? {});
|
|
82
|
+
const typexCfg = (cfg.channels?.['openclaw-extension-typex'] ?? {});
|
|
83
83
|
log?.info(`[${account.accountId}] TypeX Provider starting...`);
|
|
84
84
|
setStatus({
|
|
85
85
|
accountId: account.accountId,
|
|
@@ -92,7 +92,8 @@ exports.typexPlugin = {
|
|
|
92
92
|
runtime,
|
|
93
93
|
abortSignal,
|
|
94
94
|
log,
|
|
95
|
-
typexCfg
|
|
95
|
+
typexCfg,
|
|
96
|
+
cfg,
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
catch (err) {
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "openclaw-extension-typex",
|
|
3
|
-
"name": "
|
|
4
|
-
"version": "1.0.
|
|
3
|
+
"name": "TypeX",
|
|
4
|
+
"version": "1.0.11",
|
|
5
5
|
"description": "TypeX channel integration for OpenClaw",
|
|
6
6
|
"channels": [
|
|
7
|
-
"typex"
|
|
7
|
+
"openclaw-extension-typex"
|
|
8
8
|
],
|
|
9
9
|
"entry": "dist/index.js",
|
|
10
10
|
"configSchema": {
|
|
11
11
|
"type": "object",
|
|
12
|
-
"properties": {
|
|
13
|
-
|
|
14
|
-
"type": "object"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"additionalProperties": true
|
|
12
|
+
"properties": {},
|
|
13
|
+
"additionalProperties": false
|
|
18
14
|
},
|
|
19
15
|
"channel": {
|
|
20
|
-
"id": "typex",
|
|
16
|
+
"id": "openclaw-extension-typex",
|
|
21
17
|
"label": "TypeX",
|
|
22
18
|
"selectionLabel": "TypeX (QR Code Login)",
|
|
23
19
|
"detailLabel": "TypeX Bot",
|
|
24
20
|
"blurb": "TypeX bot via QR Code login.",
|
|
25
21
|
"aliases": [
|
|
26
|
-
"typex"
|
|
22
|
+
"openclaw-extension-typex"
|
|
27
23
|
],
|
|
28
24
|
"order": 100,
|
|
29
25
|
"quickstartAllowFrom": true
|