@zzedbot/yunzhijia 1.0.11 → 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.

Potentially problematic release.


This version of @zzedbot/yunzhijia might be problematic. Click here for more details.

@@ -1,106 +0,0 @@
1
- import { buildChannelConfigSchema, DEFAULT_ACCOUNT_ID, } from "openclaw/plugin-sdk";
2
- import { getAccountConfig, isAccountConfigured, listAccountIds } from "./config.js";
3
- // Fixed plugin without getChatChannelMeta dependency
4
- const yunzhijiaMessageActions = {
5
- listActions: () => ["send"],
6
- extractToolSend: () => null,
7
- handleAction: async ({ action, params, accountId, cfg }) => {
8
- if (action === "send") {
9
- const account = getAccountConfig(cfg, accountId ?? DEFAULT_ACCOUNT_ID);
10
- if (!account) {
11
- throw new Error(`YunzhiJia account not found: ${accountId}`);
12
- }
13
- const { sendWebhookMessage } = await import("./webhook.js");
14
- const content = typeof params.message === "string" ? params.message : "";
15
- const result = await sendWebhookMessage(content, account.webhookToken);
16
- return { success: result.success };
17
- }
18
- throw new Error(`Action ${action} not supported for YunzhiJia`);
19
- },
20
- };
21
- export const yunzhijiaPlugin = {
22
- id: "yunzhijia",
23
- meta: {
24
- id: "yunzhijia",
25
- label: "YunzhiJia",
26
- selectionLabel: "YunzhiJia (Kingdee)",
27
- docsPath: "/channels/yunzhijia",
28
- blurb: "Kingdee YunzhiJia enterprise messaging integration",
29
- aliases: ["kingdee", "yzj"],
30
- },
31
- capabilities: {
32
- chatTypes: ["direct", "group"],
33
- media: false,
34
- },
35
- configSchema: buildChannelConfigSchema({
36
- type: "object",
37
- properties: {
38
- appSecret: { type: "string" },
39
- webhookToken: { type: "string" },
40
- allowFrom: { type: "array", items: { type: "string" } },
41
- requireMention: { type: "boolean" },
42
- responsePrefix: { type: "string" },
43
- },
44
- required: ["appSecret", "webhookToken"],
45
- }),
46
- config: {
47
- listAccountIds: (cfg) => listAccountIds(cfg),
48
- resolveAccount: (cfg, accountId) => getAccountConfig(cfg, accountId ?? DEFAULT_ACCOUNT_ID) ?? {
49
- appSecret: "",
50
- webhookToken: "",
51
- },
52
- defaultAccountId: () => DEFAULT_ACCOUNT_ID,
53
- isConfigured: (account) => isAccountConfigured(account),
54
- describeAccount: (account) => ({
55
- accountId: DEFAULT_ACCOUNT_ID,
56
- enabled: account?.enabled !== false,
57
- configured: isAccountConfigured(account),
58
- }),
59
- },
60
- security: {
61
- resolveDmPolicy: ({ account }) => ({
62
- policy: account.requireMention !== false ? "pairing" : "open",
63
- allowFrom: account.allowFrom ?? [],
64
- allowFromPath: "channels.yunzhijia.allowFrom",
65
- normalizeEntry: (raw) => raw.replace(/^(yunzhijia|yzj):/i, ""),
66
- }),
67
- },
68
- mentions: {
69
- stripPatterns: ({ ctx }) => {
70
- const robotName = ctx.To?.replace(/^yunzhijia:robot:/, "") || "";
71
- return [`@${robotName}`];
72
- },
73
- },
74
- actions: yunzhijiaMessageActions,
75
- outbound: {
76
- deliveryMode: "direct",
77
- textChunkLimit: 2000,
78
- sendText: async ({ to, text, accountId, cfg }) => {
79
- const account = getAccountConfig(cfg, accountId ?? DEFAULT_ACCOUNT_ID);
80
- if (!account) {
81
- throw new Error(`YunzhiJia account not found: ${accountId}`);
82
- }
83
- const { sendWebhookMessage } = await import("./webhook.js");
84
- const result = await sendWebhookMessage(text, account.webhookToken);
85
- return {
86
- channel: "yunzhijia",
87
- messageId: result.messageId,
88
- timestamp: Date.now(),
89
- to,
90
- };
91
- },
92
- sendMedia: async ({ to, text, mediaUrl, accountId, cfg }) => {
93
- const combinedText = mediaUrl ? `${text || ""} ${mediaUrl}`.trim() : text;
94
- return await yunzhijiaPlugin.outbound.sendText({
95
- to,
96
- text: combinedText,
97
- accountId,
98
- cfg,
99
- });
100
- },
101
- },
102
- gateway: {
103
- startAccount: async () => { },
104
- stopAccount: async () => { },
105
- },
106
- };
@@ -1,2 +0,0 @@
1
- import type { ChannelPlugin } from "openclaw/plugin-sdk";
2
- export declare const yunzhijiaPlugin: ChannelPlugin;
@@ -1,104 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.yunzhijiaPlugin = void 0;
4
- // @ts-nocheck
5
- const plugin_sdk_1 = require("openclaw/plugin-sdk");
6
- const config_js_1 = require("./config.js");
7
- const webhook_js_1 = require("./webhook.js");
8
- // Simple channel meta for YunzhiJia
9
- const meta = {
10
- id: "yunzhijia",
11
- label: "YunzhiJia",
12
- selectionLabel: "YunzhiJia (Kingdee)",
13
- docsPath: "/channels/yunzhijia",
14
- blurb: "Kingdee YunzhiJia enterprise messaging integration",
15
- aliases: ["kingdee", "yzj"],
16
- };
17
- const yunzhijiaMessageActions = {
18
- listActions: () => ["send"],
19
- extractToolSend: () => null,
20
- handleAction: async ({ action, params, accountId, cfg }) => {
21
- if (action === "send") {
22
- const account = (0, config_js_1.getAccountConfig)(cfg, accountId ?? plugin_sdk_1.DEFAULT_ACCOUNT_ID);
23
- if (!account) {
24
- throw new Error(`YunzhiJia account not found: ${accountId}`);
25
- }
26
- const content = typeof params.message === "string" ? params.message : "";
27
- const result = await (0, webhook_js_1.sendWebhookMessage)(content, account.webhookToken);
28
- return { success: result.success };
29
- }
30
- throw new Error(`Action ${action} not supported for YunzhiJia`);
31
- },
32
- };
33
- exports.yunzhijiaPlugin = {
34
- id: "yunzhijia",
35
- meta: meta,
36
- capabilities: {
37
- chatTypes: ["direct", "group"],
38
- media: false,
39
- },
40
- configSchema: (0, plugin_sdk_1.buildChannelConfigSchema)({
41
- type: "object",
42
- properties: {
43
- appSecret: { type: "string" },
44
- webhookToken: { type: "string" },
45
- allowFrom: { type: "array", items: { type: "string" } },
46
- requireMention: { type: "boolean" },
47
- responsePrefix: { type: "string" },
48
- },
49
- required: ["appSecret", "webhookToken"],
50
- }),
51
- config: {
52
- listAccountIds: (cfg) => (0, config_js_1.listAccountIds)(cfg),
53
- resolveAccount: (cfg, accountId) => (0, config_js_1.getAccountConfig)(cfg, accountId ?? plugin_sdk_1.DEFAULT_ACCOUNT_ID) ?? {
54
- appSecret: "",
55
- webhookToken: "",
56
- },
57
- defaultAccountId: () => plugin_sdk_1.DEFAULT_ACCOUNT_ID,
58
- isConfigured: (account) => (0, config_js_1.isAccountConfigured)(account),
59
- describeAccount: (account) => ({
60
- accountId: plugin_sdk_1.DEFAULT_ACCOUNT_ID,
61
- enabled: account?.enabled !== false,
62
- configured: (0, config_js_1.isAccountConfigured)(account),
63
- }),
64
- },
65
- security: {
66
- resolveDmPolicy: ({ account }) => ({
67
- policy: account.requireMention !== false ? "pairing" : "open",
68
- allowFrom: account.allowFrom ?? [],
69
- allowFromPath: "channels.yunzhijia.allowFrom",
70
- normalizeEntry: (raw) => raw.replace(/^(yunzhijia|yzj):/i, ""),
71
- }),
72
- },
73
- actions: yunzhijiaMessageActions,
74
- outbound: {
75
- deliveryMode: "direct",
76
- textChunkLimit: 2000,
77
- sendText: async ({ to, text, accountId, cfg }) => {
78
- const account = (0, config_js_1.getAccountConfig)(cfg, accountId ?? plugin_sdk_1.DEFAULT_ACCOUNT_ID);
79
- if (!account) {
80
- throw new Error(`YunzhiJia account not found: ${accountId}`);
81
- }
82
- const result = await (0, webhook_js_1.sendWebhookMessage)(text, account.webhookToken);
83
- return {
84
- channel: "yunzhijia",
85
- messageId: result.messageId,
86
- timestamp: Date.now(),
87
- to,
88
- };
89
- },
90
- sendMedia: async ({ to, text, mediaUrl, accountId, cfg }) => {
91
- const combinedText = mediaUrl ? `${text || ""} ${mediaUrl}`.trim() : text;
92
- return await exports.yunzhijiaPlugin.outbound.sendText({
93
- to,
94
- text: combinedText,
95
- accountId,
96
- cfg,
97
- });
98
- },
99
- },
100
- gateway: {
101
- startAccount: async () => { },
102
- stopAccount: async () => { },
103
- },
104
- };
package/dist/plugin.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { type ChannelPlugin, type ResolvedYunzhiJiaAccount } from "openclaw/plugin-sdk";
2
- export declare const yunzhijiaPlugin: ChannelPlugin<ResolvedYunzhiJiaAccount>;
package/dist/plugin.js DELETED
@@ -1,272 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.yunzhijiaPlugin = void 0;
4
- const plugin_sdk_1 = require("openclaw/plugin-sdk");
5
- const http_js_1 = require("./http.js");
6
- const webhook_js_1 = require("./webhook.js");
7
- const config_js_1 = require("./config.js");
8
- const runtime_js_1 = require("./runtime.js");
9
- const meta = (0, plugin_sdk_1.getChatChannelMeta)("yunzhijia");
10
- // Register HTTP route for YunzhiJia webhook
11
- (0, plugin_sdk_1.registerPluginHttpRoute)("/receive", async (req, res, { config }) => {
12
- await (0, http_js_1.handleYunzhiJiaWebhook)(req, res, config.channels?.yunzhijia ?? {});
13
- });
14
- exports.yunzhijiaPlugin = {
15
- id: "yunzhijia",
16
- meta: {
17
- ...meta,
18
- displayName: "YunzhiJia",
19
- description: "Kingdee YunzhiJia enterprise messaging integration",
20
- quickstartAllowFrom: true,
21
- },
22
- capabilities: {
23
- chatTypes: ["direct", "channel"],
24
- polls: false,
25
- reactions: false,
26
- threads: false,
27
- media: true,
28
- nativeCommands: false,
29
- blockStreaming: false,
30
- },
31
- reload: { configPrefixes: ["channels.yunzhijia"] },
32
- configSchema: (0, plugin_sdk_1.buildChannelConfigSchema)(config_js_1.YunzhiJiaConfigSchema),
33
- config: {
34
- listAccountIds: (cfg) => {
35
- const yunzhijiaCfg = cfg.channels?.yunzhijia;
36
- if (!yunzhijiaCfg)
37
- return [config_js_1.DEFAULT_ACCOUNT_ID];
38
- const accountIds = Object.keys(yunzhijiaCfg.accounts || {});
39
- return accountIds.length > 0 ? accountIds : [config_js_1.DEFAULT_ACCOUNT_ID];
40
- },
41
- resolveAccount: (cfg, accountId) => {
42
- const yunzhijiaCfg = cfg.channels?.yunzhijia;
43
- if (!yunzhijiaCfg) {
44
- return {
45
- accountId,
46
- config: {},
47
- name: accountId === config_js_1.DEFAULT_ACCOUNT_ID ? "Default" : accountId,
48
- enabled: false,
49
- configured: false,
50
- };
51
- }
52
- const accountConfig = yunzhijiaCfg.accounts?.[accountId] ?? {
53
- webhookToken: yunzhijiaCfg.webhookToken,
54
- appSecret: yunzhijiaCfg.appSecret,
55
- enabled: yunzhijiaCfg.enabled,
56
- name: yunzhijiaCfg.name,
57
- requireMention: yunzhijiaCfg.requireMention,
58
- skipSignatureVerification: yunzhijiaCfg.skipSignatureVerification,
59
- };
60
- return {
61
- accountId,
62
- config: accountConfig,
63
- name: accountConfig.name ?? (accountId === config_js_1.DEFAULT_ACCOUNT_ID ? "Default" : accountId),
64
- enabled: accountConfig.enabled ?? true,
65
- configured: Boolean(accountConfig.webhookToken?.trim()),
66
- };
67
- },
68
- defaultAccountId: () => config_js_1.DEFAULT_ACCOUNT_ID,
69
- setAccountEnabled: ({ cfg, accountId, enabled }) => {
70
- // Implementation needed for proper account management
71
- const current = cfg.channels?.yunzhijia || {};
72
- if (accountId === config_js_1.DEFAULT_ACCOUNT_ID) {
73
- return {
74
- ...cfg,
75
- channels: {
76
- ...cfg.channels,
77
- yunzhijia: {
78
- ...current,
79
- enabled: enabled,
80
- },
81
- },
82
- };
83
- }
84
- return {
85
- ...cfg,
86
- channels: {
87
- ...cfg.channels,
88
- yunzhijia: {
89
- ...current,
90
- accounts: {
91
- ...current.accounts,
92
- [accountId]: {
93
- ...(current.accounts?.[accountId] || {}),
94
- enabled: enabled,
95
- },
96
- },
97
- },
98
- },
99
- };
100
- },
101
- deleteAccount: ({ cfg, accountId }) => {
102
- if (accountId === config_js_1.DEFAULT_ACCOUNT_ID) {
103
- const { webhookToken, appSecret, name, enabled, requireMention, ...rest } = cfg.channels?.yunzhijia || {};
104
- return {
105
- ...cfg,
106
- channels: {
107
- ...cfg.channels,
108
- yunzhijia: rest,
109
- },
110
- };
111
- }
112
- const accounts = { ...cfg.channels?.yunzhijia?.accounts };
113
- delete accounts[accountId];
114
- return {
115
- ...cfg,
116
- channels: {
117
- ...cfg.channels,
118
- yunzhijia: {
119
- ...cfg.channels?.yunzhijia,
120
- accounts,
121
- },
122
- },
123
- };
124
- },
125
- isConfigured: (account) => account.configured,
126
- describeAccount: (account) => ({
127
- accountId: account.accountId,
128
- name: account.name,
129
- enabled: account.enabled,
130
- configured: account.configured,
131
- }),
132
- resolveAllowFrom: ({ cfg, accountId }) => {
133
- const account = cfg.channels?.yunzhijia?.accounts?.[accountId] || cfg.channels?.yunzhijia;
134
- return account?.allowFrom || [];
135
- },
136
- formatAllowFrom: ({ allowFrom }) => allowFrom.map(String).filter(Boolean),
137
- },
138
- security: {
139
- resolveDmPolicy: ({ account }) => ({
140
- policy: "open",
141
- allowFrom: account.config.allowFrom || [],
142
- approveHint: "云之家频道已配置完成",
143
- normalizeEntry: (raw) => raw,
144
- }),
145
- collectWarnings: ({ account, cfg }) => {
146
- const warnings = [];
147
- if (!account.configured) {
148
- warnings.push("- YunzhiJia 账户未配置 webhookToken");
149
- }
150
- return warnings;
151
- },
152
- },
153
- messaging: {
154
- normalizeTarget: (target) => target,
155
- targetResolver: {
156
- looksLikeId: (target) => /^[a-zA-Z0-9]+$/.test(target),
157
- hint: "<user-id>",
158
- },
159
- },
160
- outbound: {
161
- deliveryMode: "direct",
162
- chunker: null,
163
- chunkerMode: "text",
164
- textChunkLimit: 3000,
165
- pollMaxOptions: 0,
166
- sendText: async ({ to, text, accountId, deps }) => {
167
- const account = deps?.resolveAccount?.(accountId);
168
- if (!account?.configured) {
169
- throw new Error(`YunzhiJia account ${accountId} is not configured`);
170
- }
171
- await (0, webhook_js_1.sendToYunzhiJiaWebhook)(text, account.config);
172
- return { channel: "yunzhijia", to };
173
- },
174
- sendMedia: async ({ to, text, mediaUrl, accountId, deps }) => {
175
- const account = deps?.resolveAccount?.(accountId);
176
- if (!account?.configured) {
177
- throw new Error(`YunzhiJia account ${accountId} is not configured`);
178
- }
179
- await (0, webhook_js_1.sendMediaToYunzhiJia)(text, mediaUrl, account.config);
180
- return { channel: "yunzhijia", to };
181
- },
182
- sendPoll: async () => {
183
- throw new Error("Polls are not supported by YunzhiJia");
184
- },
185
- },
186
- status: {
187
- defaultRuntime: {
188
- accountId: config_js_1.DEFAULT_ACCOUNT_ID,
189
- running: true,
190
- lastStartAt: null,
191
- lastStopAt: null,
192
- lastError: null,
193
- lastInboundAt: null,
194
- lastOutboundAt: null,
195
- },
196
- collectStatusIssues: () => [],
197
- buildChannelSummary: ({ snapshot }) => ({
198
- configured: snapshot.configured ?? false,
199
- running: snapshot.running ?? false,
200
- lastStartAt: snapshot.lastStartAt ?? null,
201
- lastStopAt: snapshot.lastStopAt ?? null,
202
- lastError: snapshot.lastError ?? null,
203
- lastInboundAt: snapshot.lastInboundAt ?? null,
204
- lastOutboundAt: snapshot.lastOutboundAt ?? null,
205
- }),
206
- probeAccount: async ({ account }) => {
207
- return {
208
- ok: account.configured,
209
- bot: { username: "YunzhiJia Bot" },
210
- application: null,
211
- };
212
- },
213
- auditAccount: async () => undefined,
214
- buildAccountSnapshot: ({ account, runtime }) => ({
215
- accountId: account.accountId,
216
- name: account.name,
217
- enabled: account.enabled,
218
- configured: account.configured,
219
- running: runtime?.running ?? false,
220
- lastStartAt: runtime?.lastStartAt ?? null,
221
- lastStopAt: runtime?.lastStopAt ?? null,
222
- lastError: runtime?.lastError ?? null,
223
- lastInboundAt: runtime?.lastInboundAt ?? null,
224
- lastOutboundAt: runtime?.lastOutboundAt ?? null,
225
- }),
226
- },
227
- gateway: {
228
- startAccount: async (ctx) => {
229
- ctx.log?.info(`[${ctx.accountId}] YunzhiJia provider started (webhook-based)`);
230
- // No actual gateway needed for webhook-based channels
231
- return Promise.resolve();
232
- },
233
- logoutAccount: async ({ accountId, cfg }) => {
234
- const nextCfg = { ...cfg };
235
- const nextYunzhiJia = cfg.channels?.yunzhijia ? { ...cfg.channels.yunzhijia } : undefined;
236
- let cleared = false;
237
- if (nextYunzhiJia) {
238
- if (accountId === config_js_1.DEFAULT_ACCOUNT_ID) {
239
- delete nextYunzhiJia.webhookToken;
240
- delete nextYunzhiJia.appSecret;
241
- cleared = true;
242
- }
243
- if (nextYunzhiJia.accounts && accountId in nextYunzhiJia.accounts) {
244
- const accountEntry = nextYunzhiJia.accounts[accountId];
245
- if (accountEntry) {
246
- delete accountEntry.webhookToken;
247
- delete accountEntry.appSecret;
248
- cleared = true;
249
- }
250
- }
251
- }
252
- if (cleared) {
253
- if (nextYunzhiJia && Object.keys(nextYunzhiJia).length > 0) {
254
- nextCfg.channels = { ...nextCfg.channels, yunzhijia: nextYunzhiJia };
255
- }
256
- else {
257
- const nextChannels = { ...nextCfg.channels };
258
- delete nextChannels.yunzhijia;
259
- if (Object.keys(nextChannels).length > 0) {
260
- nextCfg.channels = nextChannels;
261
- }
262
- else {
263
- delete nextCfg.channels;
264
- }
265
- }
266
- }
267
- const resolved = (0, runtime_js_1.getYunzhiJiaRuntime)().channel.config.resolveAccount(nextCfg, accountId);
268
- const loggedOut = !resolved.configured;
269
- return { cleared, loggedOut };
270
- },
271
- },
272
- };
@@ -1,17 +0,0 @@
1
- import type { YunzhiJiaIncomingMessage, YunzhiJiaAccountConfig } from "./types.js";
2
- /**
3
- * Process incoming YunzhiJia message
4
- *
5
- * @param message - The incoming message from YunzhiJia
6
- * @param signature - Signature from request header
7
- * @param sessionId - Session ID from request header
8
- * @param account - Account configuration
9
- * @param accountId - Account ID
10
- * @param config - OpenClaw configuration
11
- * @param runtime - Runtime environment
12
- * @returns Response for immediate reply (empty content for async processing)
13
- */
14
- export declare function processIncomingMessage(message: YunzhiJiaIncomingMessage, signature: string, sessionId: string, account: YunzhiJiaAccountConfig, accountId: string, config: OpenClawConfig, runtime: RuntimeEnv): Promise<{
15
- success: boolean;
16
- immediateResponse?: boolean;
17
- }>;
package/dist/receiver.js DELETED
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processIncomingMessage = processIncomingMessage;
4
- const utils_js_1 = require("./utils.js");
5
- const webhook_js_1 = require("./webhook.js");
6
- const runtime_js_1 = require("./runtime.js");
7
- /**
8
- * Process incoming YunzhiJia message
9
- *
10
- * @param message - The incoming message from YunzhiJia
11
- * @param signature - Signature from request header
12
- * @param sessionId - Session ID from request header
13
- * @param account - Account configuration
14
- * @param accountId - Account ID
15
- * @param config - OpenClaw configuration
16
- * @param runtime - Runtime environment
17
- * @returns Response for immediate reply (empty content for async processing)
18
- */
19
- async function processIncomingMessage(message, signature, sessionId, account, accountId, config, runtime) {
20
- const logger = {
21
- info: (msg) => runtime.log?.(msg),
22
- warn: (msg) => runtime.log?.(msg),
23
- error: (msg) => runtime.error?.(msg),
24
- debug: (msg) => runtime.log?.(msg),
25
- };
26
- // Verify signature
27
- if (!(0, utils_js_1.verifySignature)(message, signature, account.appSecret)) {
28
- logger.warn("Invalid signature received");
29
- return { success: false };
30
- }
31
- // Check mention requirement
32
- if (account.requireMention !== false && !(0, utils_js_1.isBotMentioned)(message.content, message.robotName)) {
33
- logger.debug("Message does not mention bot, ignoring");
34
- return { success: true, immediateResponse: true };
35
- }
36
- // Extract clean content (remove bot mention)
37
- const cleanContent = (0, utils_js_1.extractCleanContent)(message.content, message.robotName);
38
- // Create session key for conversation tracking
39
- const sessionKey = (0, utils_js_1.createSessionKey)(sessionId, message.robotId);
40
- // Route to appropriate agent
41
- const route = (0, runtime_js_1.getYunzhiJiaRuntime)().channel.routing.resolveAgentRoute({
42
- cfg: config,
43
- channel: "yunzhijia",
44
- accountId,
45
- peer: {
46
- kind: "direct",
47
- id: message.operatorOpenid,
48
- },
49
- });
50
- // Create message context
51
- const ctxPayload = {
52
- Body: cleanContent,
53
- RawBody: message.content,
54
- CommandBody: cleanContent,
55
- From: `yunzhijia:user:${message.operatorOpenid}`,
56
- To: `yunzhijia:robot:${message.robotId}`,
57
- SessionKey: sessionKey,
58
- AccountId: accountId,
59
- ChatType: "direct",
60
- ConversationLabel: message.operatorName,
61
- SenderName: message.operatorName,
62
- SenderId: message.operatorOpenid,
63
- Provider: "yunzhijia",
64
- Surface: "yunzhijia",
65
- MessageSid: message.msgId,
66
- OriginatingChannel: "yunzhijia",
67
- OriginatingTo: `yunzhijia:robot:${message.robotId}`,
68
- Timestamp: message.time,
69
- };
70
- // Record inbound session
71
- const storePath = (0, runtime_js_1.getYunzhiJiaRuntime)().channel.session.resolveStorePath(config.session?.store, {
72
- agentId: route.agentId,
73
- });
74
- await (0, runtime_js_1.getYunzhiJiaRuntime)().channel.session.recordInboundSession({
75
- storePath,
76
- sessionKey: ctxPayload.SessionKey ?? sessionKey,
77
- ctx: ctxPayload,
78
- onRecordError: (err) => {
79
- logger.error(`Failed updating session meta: ${String(err)}`);
80
- },
81
- });
82
- // Dispatch to agent for processing
83
- const { onModelSelected, ...prefixOptions } = createReplyPrefixOptions({
84
- cfg: config,
85
- agentId: route.agentId,
86
- channel: "yunzhijia",
87
- accountId,
88
- });
89
- // Fire-and-forget processing
90
- void (0, runtime_js_1.getYunzhiJiaRuntime)().channel.reply.dispatchReplyWithBufferedBlockDispatcher({
91
- ctx: ctxPayload,
92
- cfg: config,
93
- dispatcherOptions: {
94
- ...prefixOptions,
95
- deliver: async (payload) => {
96
- if (!payload.text) {
97
- return;
98
- }
99
- await (0, webhook_js_1.sendWebhookMessage)(payload.text, account.webhookToken, logger);
100
- },
101
- },
102
- replyOptions: {
103
- onModelSelected,
104
- },
105
- }).catch((err) => {
106
- logger.error(`Message processing failed: ${String(err)}`);
107
- });
108
- // Return empty response for async processing (within 3-second timeout)
109
- return { success: true, immediateResponse: true };
110
- }
package/dist/runtime.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { PluginRuntime } from "openclaw/plugin-sdk";
2
- export declare function getYunzhiJiaRuntime(): PluginRuntime;
3
- export declare function setYunzhiJiaRuntime(runtime: PluginRuntime): void;
package/dist/runtime.js DELETED
@@ -1,16 +0,0 @@
1
- "use strict";
2
- // This file will be replaced by the actual OpenClaw runtime injection
3
- // during plugin loading. It serves as a type-safe placeholder.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getYunzhiJiaRuntime = getYunzhiJiaRuntime;
6
- exports.setYunzhiJiaRuntime = setYunzhiJiaRuntime;
7
- let _runtime;
8
- function getYunzhiJiaRuntime() {
9
- if (!_runtime) {
10
- throw new Error("YunzhiJia runtime not initialized");
11
- }
12
- return _runtime;
13
- }
14
- function setYunzhiJiaRuntime(runtime) {
15
- _runtime = runtime;
16
- }
package/dist/test.d.ts DELETED
@@ -1,4 +0,0 @@
1
- declare function testSignature(): void;
2
- declare function testChannel(): Promise<void>;
3
- declare function runTests(): Promise<void>;
4
- export { testSignature, testChannel, runTests };