bereach-openclaw 1.5.3 → 1.5.4
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.
|
@@ -2055,4 +2055,23 @@ export const definitions: ToolDefinition[] = [
|
|
|
2055
2055
|
properties: {},
|
|
2056
2056
|
},
|
|
2057
2057
|
},
|
|
2058
|
+
|
|
2059
|
+
// ── API Key Setup ────────────────────────────────────────────────
|
|
2060
|
+
|
|
2061
|
+
{
|
|
2062
|
+
name: "bereach_set_api_key",
|
|
2063
|
+
description: "Save the BeReach API key in plugin configuration. Call this when the user provides their API key (starts with brc_). After saving, tell the user to restart the gateway with 'openclaw gateway restart' and start a new chat with /new.",
|
|
2064
|
+
handler: "__set_api_key__",
|
|
2065
|
+
parameters: {
|
|
2066
|
+
type: "object",
|
|
2067
|
+
required: ["apiKey"],
|
|
2068
|
+
properties: {
|
|
2069
|
+
apiKey: {
|
|
2070
|
+
type: "string",
|
|
2071
|
+
description: "The BeReach API key (must start with brc_)",
|
|
2072
|
+
},
|
|
2073
|
+
},
|
|
2074
|
+
additionalProperties: false,
|
|
2075
|
+
},
|
|
2076
|
+
},
|
|
2058
2077
|
];
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/skills/bereach/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bereach
|
|
3
3
|
description: "Automate LinkedIn outreach via BeReach (bereach.ai). Use when: prospecting, engaging posts, scraping engagement, searching LinkedIn, managing inbox, running campaigns, managing invitations, analytics, company pages, Sales Navigator, content engagement, feed monitoring. Requires BEREACH_API_KEY."
|
|
4
|
-
lastUpdatedAt:
|
|
4
|
+
lastUpdatedAt: 1775565279
|
|
5
5
|
metadata: { "openclaw": { "requires": { "env": ["BEREACH_API_KEY"] }, "primaryEnv": "BEREACH_API_KEY" } }
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -45,13 +45,13 @@ At install or upgrade, set up the workspace with these templates:
|
|
|
45
45
|
|
|
46
46
|
When the user provides their BeReach API key (`brc_...`):
|
|
47
47
|
|
|
48
|
-
1.
|
|
48
|
+
1. Call the `bereach_set_api_key` tool with their key
|
|
49
49
|
2. Tell them to restart the gateway: `openclaw gateway restart`
|
|
50
50
|
3. After restart, start a new chat with `/new`
|
|
51
51
|
|
|
52
52
|
If the user doesn't have a key, direct them to https://bereach.ai/token
|
|
53
53
|
|
|
54
|
-
**Never**
|
|
54
|
+
**Never** use config.patch, environment variables, or manual config edits. Always use the `bereach_set_api_key` tool.
|
|
55
55
|
|
|
56
56
|
## Two Modes of Operation
|
|
57
57
|
|
package/src/hooks/context.ts
CHANGED
|
@@ -1015,16 +1015,16 @@ export function registerContextHook(api: any, apiKey: string | undefined, state:
|
|
|
1015
1015
|
"IMPORTANT: BeReach plugin is installed but no API key is configured.",
|
|
1016
1016
|
"",
|
|
1017
1017
|
"If the user provides their BeReach API key (a string starting with brc_):",
|
|
1018
|
-
"-
|
|
1019
|
-
"- Then restart the gateway: openclaw gateway restart",
|
|
1018
|
+
"- Call the bereach_set_api_key tool with their key",
|
|
1019
|
+
"- Then tell them to restart the gateway: openclaw gateway restart",
|
|
1020
1020
|
"- Then start a new chat: /new",
|
|
1021
1021
|
"",
|
|
1022
1022
|
"If the user has NOT provided a key yet:",
|
|
1023
1023
|
"- Ask them for their BeReach API key",
|
|
1024
1024
|
"- They can get one at https://bereach.ai/token",
|
|
1025
1025
|
"",
|
|
1026
|
-
"
|
|
1027
|
-
"Do NOT
|
|
1026
|
+
"ALWAYS use the bereach_set_api_key tool to save the key.",
|
|
1027
|
+
"Do NOT use config.patch, environment variables, or any other method.",
|
|
1028
1028
|
].join("\n") };
|
|
1029
1029
|
}
|
|
1030
1030
|
|
package/src/hooks/enforcement.ts
CHANGED
|
@@ -592,11 +592,14 @@ export function registerEnforcementHook(
|
|
|
592
592
|
const toolName: string = ctx?.toolName ?? ctx?.name ?? "";
|
|
593
593
|
if (!toolName.startsWith("bereach_")) return;
|
|
594
594
|
|
|
595
|
+
// Allow set_api_key and self_upgrade without an API key
|
|
596
|
+
if (toolName === "bereach_set_api_key" || toolName === "bereach_self_upgrade") return;
|
|
597
|
+
|
|
595
598
|
// Resolve API key dynamically
|
|
596
599
|
const resolvedKey = api?.pluginConfig?.BEREACH_API_KEY ?? api?.pluginConfig?.apiKey ?? apiKey;
|
|
597
600
|
const key = typeof resolvedKey === "string" && resolvedKey.trim() ? resolvedKey.trim() : undefined;
|
|
598
601
|
if (!key) {
|
|
599
|
-
return { block: true, blockReason: "BLOCKED: BeReach API key not configured.
|
|
602
|
+
return { block: true, blockReason: "BLOCKED: BeReach API key not configured. Provide your key so the agent can save it with bereach_set_api_key. Get a key at https://bereach.ai/token" };
|
|
600
603
|
}
|
|
601
604
|
|
|
602
605
|
const params: Record<string, unknown> = ctx?.params ?? ctx?.input ?? {};
|
package/src/tools/index.ts
CHANGED
|
@@ -127,7 +127,7 @@ export function registerAllTools(api: any, taskType?: string) {
|
|
|
127
127
|
let skipped = 0;
|
|
128
128
|
|
|
129
129
|
for (const def of definitions) {
|
|
130
|
-
if (!def.apiPath && def.handler !== "__self_upgrade__" && def.handler !== "__local__") {
|
|
130
|
+
if (!def.apiPath && def.handler !== "__self_upgrade__" && def.handler !== "__local__" && def.handler !== "__set_api_key__") {
|
|
131
131
|
console.warn(`[bereach:tools] SKIP ${def.name}: no apiPath defined`);
|
|
132
132
|
continue;
|
|
133
133
|
}
|
|
@@ -148,10 +148,28 @@ export function registerAllTools(api: any, taskType?: string) {
|
|
|
148
148
|
return executeSelfUpgrade();
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
if (def.handler === "__set_api_key__") {
|
|
152
|
+
const key = String(params.apiKey ?? "").trim();
|
|
153
|
+
if (!key || !key.startsWith("brc_")) {
|
|
154
|
+
return {
|
|
155
|
+
content: [{ type: "text" as const, text: JSON.stringify({ success: false, error: "Invalid key format. Must start with brc_. Get your key at https://bereach.ai/token" }) }],
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (typeof api?.config?.set !== "function") {
|
|
159
|
+
return {
|
|
160
|
+
content: [{ type: "text" as const, text: JSON.stringify({ success: false, error: "Config API not available. Set BEREACH_API_KEY as an environment variable instead." }) }],
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
api.config.set("plugins.entries.bereach-openclaw.config.BEREACH_API_KEY", key);
|
|
164
|
+
return {
|
|
165
|
+
content: [{ type: "text" as const, text: JSON.stringify({ success: true, message: `API key saved (…${key.slice(-6)}). Tell the user to run: openclaw gateway restart, then /new` }) }],
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
151
169
|
const apiKey = resolveApiKey(api);
|
|
152
170
|
if (!apiKey) {
|
|
153
171
|
return {
|
|
154
|
-
content: [{ type: "text" as const, text: JSON.stringify({ success: false, error: "BEREACH_API_KEY not configured. The user should
|
|
172
|
+
content: [{ type: "text" as const, text: JSON.stringify({ success: false, error: "BEREACH_API_KEY not configured. The user should provide their key so you can call bereach_set_api_key. Get a key at https://bereach.ai/token" }) }],
|
|
155
173
|
};
|
|
156
174
|
}
|
|
157
175
|
|