@meetopenbot/firecrawl 1.0.3 → 1.0.5

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.
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from '@meetopenbot/plugin-sdk';
2
+ declare const plugin: Plugin;
3
+ export { plugin };
4
+ export default plugin;
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- // node_modules/@meetopenbot/plugin-sdk/dist/plugin.js
1
+ // ../plugin-sdk/dist/plugin.js
2
2
  function definePlugin(definition) {
3
3
  return definition;
4
4
  }
5
5
 
6
- // node_modules/@meetopenbot/plugin-sdk/dist/helpers.js
6
+ // ../plugin-sdk/dist/helpers.js
7
7
  function shouldHandleInvoke(event, agentId) {
8
8
  const routedTo = event.data?.agentId;
9
9
  return !(typeof routedTo === "string" && routedTo && routedTo !== agentId);
@@ -151,6 +151,11 @@ var plugin = definePlugin({
151
151
  const apiKey = getApiKey();
152
152
  if (!apiKey) {
153
153
  yield buildApiKeyWidget(context.agentId, threadId);
154
+ yield agentOutput({
155
+ agentId: context.agentId,
156
+ content: "API key required. Please provide it in the widget.",
157
+ threadId
158
+ });
154
159
  return;
155
160
  }
156
161
  try {
@@ -167,6 +172,11 @@ var plugin = definePlugin({
167
172
  const errMsg = started?.error || "Unknown error";
168
173
  if (isAuthError(errMsg)) {
169
174
  yield buildApiKeyWidget(context.agentId, threadId, errMsg);
175
+ yield agentOutput({
176
+ agentId: context.agentId,
177
+ content: `Authentication failed: ${errMsg}. Please update the API key in the widget.`,
178
+ threadId
179
+ });
170
180
  } else {
171
181
  yield agentOutput({
172
182
  agentId: context.agentId,
@@ -178,7 +188,7 @@ var plugin = definePlugin({
178
188
  }
179
189
  yield agentOutput({
180
190
  agentId: context.agentId,
181
- content: `Firecrawl agent task created (id: ${started.id}). Waiting for results...`,
191
+ content: `Task created (id: ${started.id}). Waiting for results...`,
182
192
  threadId
183
193
  });
184
194
  const startTime = Date.now();
@@ -187,7 +197,7 @@ var plugin = definePlugin({
187
197
  if (Date.now() - startTime > POLL_TIMEOUT_MS) {
188
198
  yield agentOutput({
189
199
  agentId: context.agentId,
190
- content: `Firecrawl agent timed out after ${Math.round(POLL_TIMEOUT_MS / 1e3)}s.`,
200
+ content: `Timed out after ${Math.round(POLL_TIMEOUT_MS / 1e3)}s.`,
191
201
  threadId
192
202
  });
193
203
  return;
@@ -200,7 +210,7 @@ var plugin = definePlugin({
200
210
  if (status.status === "completed") {
201
211
  yield agentOutput({
202
212
  agentId: context.agentId,
203
- content: "Firecrawl agent completed successfully.",
213
+ content: "Completed successfully.",
204
214
  threadId
205
215
  });
206
216
  yield agentOutput({
@@ -213,7 +223,7 @@ var plugin = definePlugin({
213
223
  if (status.status === "failed" || status.status === "cancelled") {
214
224
  yield agentOutput({
215
225
  agentId: context.agentId,
216
- content: `Firecrawl agent ${status.status}: ${status.error || "no details provided"}`,
226
+ content: `Agent ${status.status}: ${status.error || "no details provided"}`,
217
227
  threadId
218
228
  });
219
229
  return;
@@ -232,6 +242,11 @@ var plugin = definePlugin({
232
242
  const message = error instanceof Error ? error.message : "Firecrawl request failed.";
233
243
  if (isAuthError(message)) {
234
244
  yield buildApiKeyWidget(context.agentId, threadId, message);
245
+ yield agentOutput({
246
+ agentId: context.agentId,
247
+ content: `Authentication failed: ${message}. Please update the API key in the widget.`,
248
+ threadId
249
+ });
235
250
  } else {
236
251
  yield agentOutput({
237
252
  agentId: context.agentId,
@@ -242,7 +257,7 @@ var plugin = definePlugin({
242
257
  }
243
258
  });
244
259
  builder.on(
245
- "plugin:ui:widget:response",
260
+ "client:ui:widget:response",
246
261
  async function* (event, handlerCtx) {
247
262
  const { metadata, values, widgetId } = event.data;
248
263
  if (!metadata || metadata.type !== "api_key_request" || metadata.source !== "firecrawl") {
@@ -270,14 +285,14 @@ var plugin = definePlugin({
270
285
  });
271
286
  yield agentOutput({
272
287
  agentId: context.agentId,
273
- content: "Saved Firecrawl API key to workspace variables. Re-send your last message to retry.",
288
+ content: "API key saved to workspace variables. Re-send your last message to retry.",
274
289
  meta: { agentId: handlerCtx.state.agentId }
275
290
  });
276
291
  } catch (error) {
277
292
  const errorMessage = error instanceof Error ? error.message : String(error);
278
293
  yield agentOutput({
279
294
  agentId: context.agentId,
280
- content: `[firecrawl] failed to save API key: ${errorMessage}`,
295
+ content: `Failed to save API key: ${errorMessage}`,
281
296
  meta: { agentId: handlerCtx.state.agentId }
282
297
  });
283
298
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetopenbot/firecrawl",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "description": "Firecrawl agent plugin for OpenBot",
6
6
  "main": "./dist/index.js",
@@ -8,15 +8,15 @@
8
8
  "access": "public"
9
9
  },
10
10
  "exports": {
11
- ".": "./dist/index.js"
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ }
12
16
  },
13
17
  "files": [
14
18
  "dist"
15
19
  ],
16
- "scripts": {
17
- "build": "esbuild src/index.ts --bundle --platform=node --target=node18 --format=esm --outfile=dist/index.js",
18
- "prepublishOnly": "npm run build"
19
- },
20
20
  "engines": {
21
21
  "node": ">=18"
22
22
  },
@@ -25,6 +25,12 @@
25
25
  "esbuild": "^0.21.0"
26
26
  },
27
27
  "dependencies": {
28
- "@meetopenbot/plugin-sdk": "^0.1.1"
28
+ "@meetopenbot/plugin-sdk": "^0.2.0"
29
+ },
30
+ "types": "./dist/index.d.ts",
31
+ "scripts": {
32
+ "build": "esbuild src/index.ts --bundle --platform=node --target=node18 --format=esm --outfile=dist/index.js && node ../../scripts/write-plugin-declaration.mjs",
33
+ "dev": "esbuild src/index.ts --bundle --platform=node --target=node18 --format=esm --outfile=dist/index.js --watch",
34
+ "typecheck": "tsc --noEmit --allowImportingTsExtensions --module ESNext --moduleResolution Bundler --target ES2022 --skipLibCheck src/index.ts"
29
35
  }
30
- }
36
+ }