@buz-extensions/buz 1.0.0-beta.2 → 1.0.0-beta.3

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.
Files changed (2) hide show
  1. package/index.ts +21 -57
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -1,57 +1,24 @@
1
1
  import type { ChannelPlugin, OpenClawPluginApi } from "openclaw/plugin-sdk/line";
2
- import {
3
- buildCatchallMultiAccountChannelSchema,
4
- buildChannelConfigSchema,
5
- emptyPluginConfigSchema,
6
- } from "openclaw/plugin-sdk/line";
2
+ import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/line";
3
+ import { buildChannelConfigSchema } from "openclaw/plugin-sdk/line";
7
4
  import { z } from "zod";
8
5
 
9
- const BuzAccountSchema = z.object({
10
- enabled: z.boolean().optional(),
11
- name: z.string().optional(),
12
- serverAddress: z.string().optional(),
13
- secretKey: z.string().optional(),
14
- });
6
+ const BuzAccountSchema = z
7
+ .object({
8
+ enabled: z.boolean().optional(),
9
+ serverAddress: z.string().optional(),
10
+ secretKey: z.string().optional(),
11
+ })
12
+ .partial();
15
13
 
16
- const BuzConfigSchema = buildCatchallMultiAccountChannelSchema(BuzAccountSchema).extend({
17
- enabled: z.boolean().optional(),
18
- name: z.string().optional(),
19
- serverAddress: z.string().optional(),
20
- secretKey: z.string().optional(),
21
- });
22
-
23
- const buzChannelConfigSchema = buildChannelConfigSchema(BuzConfigSchema);
24
- buzChannelConfigSchema.uiHints = {
25
- enabled: { label: "Enabled" },
26
- name: { label: "Name" },
27
- serverAddress: {
28
- label: "Host Address",
29
- placeholder: "grpc.buz.ai:443",
30
- help: "buz gRPC server host:port",
31
- },
32
- secretKey: {
33
- label: "Secret Key",
34
- sensitive: true,
35
- help: "IM secret key used to authenticate with buz",
36
- },
37
- defaultAccount: {
38
- label: "Default Account",
39
- advanced: true,
40
- },
41
- accounts: {
42
- label: "Custom entries",
43
- },
44
- "accounts.*.enabled": { label: "Enabled" },
45
- "accounts.*.name": { label: "Name" },
46
- "accounts.*.serverAddress": {
47
- label: "Host Address",
48
- placeholder: "grpc.buz.ai:443",
49
- },
50
- "accounts.*.secretKey": {
51
- label: "Secret Key",
52
- sensitive: true,
53
- },
54
- };
14
+ const BuzConfigSchema = z
15
+ .object({
16
+ enabled: z.boolean().optional(),
17
+ serverAddress: z.string().optional(),
18
+ secretKey: z.string().optional(),
19
+ accounts: z.record(z.string(), BuzAccountSchema.optional()).optional(),
20
+ })
21
+ .partial();
55
22
 
56
23
  export const buzChannelPlugin = {
57
24
  id: "buz",
@@ -68,7 +35,7 @@ export const buzChannelPlugin = {
68
35
  threads: true,
69
36
  media: false,
70
37
  },
71
- configSchema: buzChannelConfigSchema,
38
+ configSchema: buildChannelConfigSchema(BuzConfigSchema),
72
39
  config: {
73
40
  listAccountIds: (cfg: any) => {
74
41
  const accounts = cfg?.channels?.["buz"]?.accounts || {};
@@ -83,7 +50,6 @@ export const buzChannelPlugin = {
83
50
  id === "default"
84
51
  ? {
85
52
  enabled: channelConfig.enabled,
86
- name: channelConfig.name,
87
53
  serverAddress: channelConfig.serverAddress,
88
54
  secretKey: channelConfig.secretKey,
89
55
  }
@@ -94,7 +60,7 @@ export const buzChannelPlugin = {
94
60
 
95
61
  return {
96
62
  accountId: id,
97
- name: accountConfig.name || `buz (${id})`,
63
+ name: `buz (${id})`,
98
64
  enabled: accountConfig.enabled !== false,
99
65
  serverAddress: accountConfig.serverAddress,
100
66
  secretKey: accountConfig.secretKey,
@@ -108,7 +74,6 @@ export const buzChannelPlugin = {
108
74
  name: account.name,
109
75
  enabled: account.enabled,
110
76
  configured: Boolean(account.configured),
111
- serverAddress: account.serverAddress,
112
77
  }),
113
78
  },
114
79
  messaging: {
@@ -124,8 +89,8 @@ export const buzChannelPlugin = {
124
89
  {
125
90
  id: "serverAddress",
126
91
  type: "text",
127
- label: "Host Address",
128
- placeholder: "grpc.buz.ai:443",
92
+ label: "Server Address",
93
+ placeholder: "e.g. grpc.buz.ai:443",
129
94
  },
130
95
  {
131
96
  id: "secretKey",
@@ -187,7 +152,6 @@ export const buzChannelPlugin = {
187
152
  lastStartAt: runtime?.lastStartAt ?? null,
188
153
  lastStopAt: runtime?.lastStopAt ?? null,
189
154
  mode: "grpc",
190
- serverAddress: account.serverAddress,
191
155
  ...(runtime?.lastError ? { lastError: runtime.lastError } : {}),
192
156
  ...(runtime?.lastInboundAt ? { lastInboundAt: runtime.lastInboundAt } : {}),
193
157
  ...(runtime?.lastOutboundAt ? { lastOutboundAt: runtime.lastOutboundAt } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buz-extensions/buz",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "OpenClaw buz channel plugin",
5
5
  "type": "module",
6
6
  "license": "MIT",