@relaymessenger/openclaw-plugin 0.4.3-staging.7 → 0.4.3-staging.8

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.
@@ -129,22 +129,21 @@ export const relayMessageAdapter = defineChannelMessageAdapter({
129
129
  },
130
130
  },
131
131
  });
132
- const relaySetupAdapter = {
133
- applyAccountConfig: ({ cfg, accountId, input }) => {
134
- const core = cfg;
135
- const patch = input;
136
- const section = { ...core.channels?.relay };
137
- const relay = accountId === DEFAULT_ACCOUNT_ID ? { ...section, ...patch } : { ...section, accounts: { ...section.accounts, [accountId]: { ...section.accounts?.[accountId], ...patch } } };
138
- return { ...cfg, channels: { ...core.channels, relay } };
139
- },
140
- };
141
132
  const RELAY_MISSING_TOKEN = `relay: account "default" has no Relay Agent Token`;
142
133
  const baseRelaySetupContract = defineChannelSetupContract({
134
+ adapter: {
135
+ applyAccountConfig: ({ cfg, accountId, input }) => {
136
+ const core = cfg;
137
+ const section = { ...core.channels?.relay };
138
+ const patch = input;
139
+ const relay = accountId === DEFAULT_ACCOUNT_ID ? { ...section, ...patch } : { ...section, accounts: { ...section.accounts, [accountId]: { ...section.accounts?.[accountId], ...patch } } };
140
+ return { ...cfg, channels: { ...core.channels, relay } };
141
+ },
142
+ },
143
143
  fields: {
144
144
  token: { kind: "string", sensitive: true, cli: { flags: "--token <token>", description: "Relay Agent Token" } },
145
145
  baseUrl: { kind: "string", cli: { flags: "--base-url <url>", description: "Relay API origin" } },
146
146
  },
147
- legacyAdapter: relaySetupAdapter,
148
147
  });
149
148
  export const relaySetupContract = { ...baseRelaySetupContract, parseInput: (input) => { const result = baseRelaySetupContract.parseInput(input); if (!result.ok || typeof result.value.token !== "string" || !result.value.token.trim())
150
149
  return { ok: false, error: RELAY_MISSING_TOKEN }; return result; } };
@@ -165,32 +164,6 @@ export const relayChannelPlugin = createChatChannelPlugin({
165
164
  },
166
165
  reload: { configPrefixes: ["channels.relay"] },
167
166
  setupContract: relaySetupContract,
168
- setup: {
169
- applyAccountConfig: ({ cfg, accountId, input }) => {
170
- const core = cfg;
171
- const section = { ...core.channels?.relay };
172
- const patch = input;
173
- const relay = !accountId || accountId === DEFAULT_ACCOUNT_ID
174
- ? { ...section, ...patch }
175
- : {
176
- ...section,
177
- accounts: {
178
- ...section.accounts,
179
- [accountId]: {
180
- ...section.accounts?.[accountId],
181
- ...patch,
182
- },
183
- },
184
- };
185
- return {
186
- ...cfg,
187
- channels: {
188
- ...core.channels,
189
- relay,
190
- },
191
- };
192
- },
193
- },
194
167
  config: {
195
168
  listAccountIds: (cfg) => listRelayAccountIds(cfg),
196
169
  resolveAccount: (cfg, accountId) => resolveRelayAccount({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relaymessenger/openclaw-plugin",
3
- "version": "0.4.3-staging.7",
3
+ "version": "0.4.3-staging.8",
4
4
  "description": "Native Relay channel plugin for OpenClaw",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/channel.ts CHANGED
@@ -188,24 +188,22 @@ export const relayMessageAdapter = defineChannelMessageAdapter({
188
188
  },
189
189
  });
190
190
 
191
- const relaySetupAdapter = {
192
- applyAccountConfig: ({ cfg, accountId, input }: { cfg: OpenClawConfig; accountId: string; input: unknown }) => {
193
- const core = cfg as RelayCoreConfig;
194
- const patch = input as Record<string, unknown>;
195
- const section = { ...core.channels?.relay };
196
- const relay = accountId === DEFAULT_ACCOUNT_ID ? { ...section, ...patch } : { ...section, accounts: { ...section.accounts, [accountId]: { ...section.accounts?.[accountId], ...patch } } };
197
- return { ...cfg, channels: { ...core.channels, relay } } as OpenClawConfig;
198
- },
199
- };
200
-
201
191
  const RELAY_MISSING_TOKEN = `relay: account "default" has no Relay Agent Token`;
202
192
 
203
193
  const baseRelaySetupContract = defineChannelSetupContract({
194
+ adapter: {
195
+ applyAccountConfig: ({ cfg, accountId, input }: { cfg: OpenClawConfig; accountId: string; input: unknown }) => {
196
+ const core = cfg as RelayCoreConfig;
197
+ const section = { ...core.channels?.relay };
198
+ const patch = input as Record<string, unknown>;
199
+ const relay = accountId === DEFAULT_ACCOUNT_ID ? { ...section, ...patch } : { ...section, accounts: { ...section.accounts, [accountId]: { ...section.accounts?.[accountId], ...patch } } };
200
+ return { ...cfg, channels: { ...core.channels, relay } } as OpenClawConfig;
201
+ },
202
+ },
204
203
  fields: {
205
204
  token: { kind: "string", sensitive: true, cli: { flags: "--token <token>", description: "Relay Agent Token" } },
206
205
  baseUrl: { kind: "string", cli: { flags: "--base-url <url>", description: "Relay API origin" } },
207
206
  },
208
- legacyAdapter: relaySetupAdapter,
209
207
  });
210
208
 
211
209
  export const relaySetupContract = { ...baseRelaySetupContract, parseInput: (input: unknown) => { const result = baseRelaySetupContract.parseInput(input); if (!result.ok || typeof (result.value as Record<string, unknown>).token !== "string" || !((result.value as Record<string, unknown>).token as string).trim()) return { ok: false as const, error: RELAY_MISSING_TOKEN }; return result; } };
@@ -228,33 +226,6 @@ export const relayChannelPlugin: ChannelPlugin<ResolvedRelayAccount> =
228
226
  },
229
227
  reload: { configPrefixes: ["channels.relay"] },
230
228
  setupContract: relaySetupContract,
231
- setup: {
232
- applyAccountConfig: ({ cfg, accountId, input }) => {
233
- const core = cfg as RelayCoreConfig;
234
- const section = { ...core.channels?.relay };
235
- const patch = input as Record<string, unknown>;
236
- const relay =
237
- !accountId || accountId === DEFAULT_ACCOUNT_ID
238
- ? { ...section, ...patch }
239
- : {
240
- ...section,
241
- accounts: {
242
- ...section.accounts,
243
- [accountId]: {
244
- ...section.accounts?.[accountId],
245
- ...patch,
246
- },
247
- },
248
- };
249
- return {
250
- ...cfg,
251
- channels: {
252
- ...core.channels,
253
- relay,
254
- },
255
- } as OpenClawConfig;
256
- },
257
- },
258
229
  config: {
259
230
  listAccountIds: (cfg) =>
260
231
  listRelayAccountIds(cfg as RelayCoreConfig),