@buz-extensions/buz 1.0.0-beta.4 → 1.0.0-beta.6

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/index.ts CHANGED
@@ -25,7 +25,7 @@ export const buzChannelPlugin = {
25
25
  meta: {
26
26
  id: "buz",
27
27
  label: "buz",
28
- selectionLabel: "buz (gRPC)",
28
+ selectionLabel: "buz (voice chat)",
29
29
  docsPath: "/channels/buz",
30
30
  blurb: "Connect OpenClaw to buz via gRPC bidirectional stream.",
31
31
  },
@@ -84,42 +84,17 @@ export const buzChannelPlugin = {
84
84
  },
85
85
  resolveSessionTarget: ({ id }: any) => id,
86
86
  },
87
- setupWizard: {
88
- channel: "buz",
89
- status: {
90
- configuredLabel: "configured",
91
- unconfiguredLabel: "needs server + secret",
92
- configuredHint: "configured",
93
- unconfiguredHint: "needs server + secret",
94
- configuredScore: 1,
95
- unconfiguredScore: 0,
96
- resolveConfigured: ({ cfg }: any) => {
97
- const channelConfig = cfg?.channels?.["buz"];
98
- const accounts = channelConfig?.accounts || {};
99
- return Object.values(accounts).some((acc: any) =>
100
- acc?.serverAddress && acc?.secretKey
101
- ) || (channelConfig?.serverAddress && channelConfig?.secretKey);
102
- },
103
- resolveStatusLines: ({ cfg, configured }: any) => {
104
- const accountCount = Object.keys(cfg?.channels?.["buz"]?.accounts || {}).length;
105
- return [`buz: ${configured ? "configured" : "needs server + secret"}`, `Accounts: ${accountCount || 0}`];
106
- },
107
- },
108
- credentials: [],
109
- finalize: async ({ cfg, accountId, credentialValues, prompter }: any) => {
110
- // buz uses setup adapter for configuration
111
- return { cfg };
112
- },
113
- },
114
87
  setup: {
115
88
  validateInput: async (params: any) => {
116
89
  const { setupAdapter } = await import("./src/setup.js");
90
+ // Returns string (error message) or null (valid)
117
91
  return setupAdapter.validateInput(params);
118
92
  },
119
93
  applyAccountConfig: async (params: any) => {
120
94
  const { setupAdapter } = await import("./src/setup.js");
121
- const result = await setupAdapter.applyAccountConfig(params);
122
- return result;
95
+ // Returns OpenClawConfig directly
96
+ const newCfg = await setupAdapter.applyAccountConfig(params);
97
+ return newCfg;
123
98
  },
124
99
  },
125
100
  outbound: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buz-extensions/buz",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "OpenClaw buz channel plugin",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@grpc/grpc-js": "^1.10.0",
29
29
  "@grpc/proto-loader": "^0.7.10",
30
- "zod": "^3.25.76"
30
+ "zod": "^4.3.6"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "openclaw": "*"
package/src/inbound.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { recordInboundSession } from "openclaw/plugin-sdk";
2
+ import { dispatchReplyWithBufferedBlockDispatcher } from "openclaw/plugin-sdk/auto-reply/reply/provider-dispatcher";
2
3
  import { sendText } from "./outbound.js";
4
+ import { resolve } from "path";
5
+ import { homedir } from "os";
3
6
 
4
7
  function resolveDefaultAgentIdCompat(cfg: any): string {
5
8
  const configured = cfg?.defaultAgentId ?? cfg?.agents?.default ?? cfg?.agent?.default;
@@ -11,14 +14,14 @@ function resolveDefaultAgentIdCompat(cfg: any): string {
11
14
  return firstAgentId || "default";
12
15
  }
13
16
 
14
- function resolveDispatchReplyWithBufferedBlockDispatcher(ctx: any):
15
- | ((params: any) => Promise<any>)
16
- | null {
17
- return (
18
- ctx?.runtime?.channel?.reply?.dispatchReplyWithBufferedBlockDispatcher ??
19
- ctx?.core?.channel?.reply?.dispatchReplyWithBufferedBlockDispatcher ??
20
- null
21
- );
17
+ function resolveStorePath(cfg: any): string {
18
+ const configuredPath = cfg?.session?.storePath || ".openclaw/sessions";
19
+ // If it's already an absolute path, use it as-is
20
+ if (configuredPath.startsWith("/") || configuredPath.startsWith("~")) {
21
+ return configuredPath.replace(/^~/, homedir());
22
+ }
23
+ // Otherwise, resolve relative to home directory
24
+ return resolve(homedir(), configuredPath);
22
25
  }
23
26
 
24
27
  export async function handleInboundMessage(ctx: any, inboundMsg: any) {
@@ -67,7 +70,7 @@ export async function handleInboundMessage(ctx: any, inboundMsg: any) {
67
70
 
68
71
  console.log("[buz inbound] ctxPayload:", JSON.stringify(ctxPayload, null, 2));
69
72
 
70
- const storePath = cfg?.session?.storePath || ".openclaw/sessions";
73
+ const storePath = resolveStorePath(cfg);
71
74
  console.log("[buz inbound] recording inbound session, storePath:", storePath);
72
75
  console.log("[buz inbound] sessionKey:", ctxPayload.SessionKey);
73
76
 
@@ -91,17 +94,6 @@ export async function handleInboundMessage(ctx: any, inboundMsg: any) {
91
94
  console.error("[buz inbound] error recording session:", err.message);
92
95
  }
93
96
 
94
- const dispatchReplyWithBufferedBlockDispatcher =
95
- resolveDispatchReplyWithBufferedBlockDispatcher(ctx);
96
- if (!dispatchReplyWithBufferedBlockDispatcher) {
97
- const error = new Error(
98
- "OpenClaw reply runtime is unavailable on plugin context; missing channel reply dispatcher",
99
- );
100
- console.error("[buz inbound] failed to dispatch:", error.message);
101
- ctx.log?.error?.(`[${accountId}] Failed to dispatch inbound message: ${error.message}`);
102
- throw error;
103
- }
104
-
105
97
  try {
106
98
  console.log("[buz inbound] dispatching inbound message...");
107
99
  await dispatchReplyWithBufferedBlockDispatcher({
package/src/setup.ts CHANGED
@@ -17,9 +17,11 @@ export const setupAdapter = {
17
17
  secretKeyLength: secretKey?.length,
18
18
  });
19
19
 
20
- if (!serverAddress) return { ok: false, error: "Server Address is required" };
21
- if (!secretKey) return { ok: false, error: "Secret Key is required" };
22
- return { ok: true, values: input };
20
+ // Return error message as string, or null if valid
21
+ // According to ChannelSetupAdapter.validateInput type: string | null
22
+ if (!serverAddress) return "Server Address is required";
23
+ if (!secretKey) return "Secret Key is required";
24
+ return null;
23
25
  },
24
26
 
25
27
  applyAccountConfig: async (params: any) => {
@@ -93,7 +95,8 @@ export const setupAdapter = {
93
95
  defaultAccountKeys: Object.keys(newCfg.channels["buz"].accounts.default || {}),
94
96
  });
95
97
 
96
- // IMPORTANT: Return the entire cfg object, not just the channels part
97
- return { cfg: newCfg, accountId: resolvedAccountId };
98
+ // IMPORTANT: Return only the cfg object, NOT { cfg, accountId }
99
+ // The ChannelSetupAdapter.applyAccountConfig expects OpenClawConfig as return type
100
+ return newCfg;
98
101
  },
99
102
  };