openclaw-extension-typex 1.0.12 → 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/message.d.ts +2 -1
- package/dist/client/message.js +26 -2
- package/dist/client/monitor.d.ts +3 -1
- package/dist/client/monitor.js +3 -1
- package/dist/plugin.js +2 -1
- package/package.json +1 -1
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)();
|
|
@@ -42,6 +44,27 @@ async function processTypeXMessage(client, payload, appId, options = {}) {
|
|
|
42
44
|
OriginatingChannel: "openclaw-extension-typex",
|
|
43
45
|
OriginatingTo: chatId,
|
|
44
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
|
+
}
|
|
45
68
|
// Dispatch to Agent
|
|
46
69
|
await channel.reply.dispatchReplyWithBufferedBlockDispatcher({
|
|
47
70
|
ctx,
|
|
@@ -72,7 +95,8 @@ async function processTypeXMessage(client, payload, appId, options = {}) {
|
|
|
72
95
|
},
|
|
73
96
|
replyOptions: {
|
|
74
97
|
disableBlockStreaming: true,
|
|
75
|
-
embedded
|
|
98
|
+
// Do not use embedded agent; let gateway bindings decide the agent.
|
|
99
|
+
embedded: false,
|
|
76
100
|
},
|
|
77
101
|
});
|
|
78
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/plugin.js
CHANGED