@howells/fieldwork-sdk 0.10.1 → 0.11.0

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 (39) hide show
  1. package/README.md +36 -4
  2. package/dist/{adapter-DQrBP1tj.d.ts → adapter-B8kAAAgF.d.ts} +25 -2
  3. package/dist/brave.d.ts +1 -1
  4. package/dist/brave.js +3 -3
  5. package/dist/browserbase.d.ts +1 -1
  6. package/dist/browserbase.js +4 -4
  7. package/dist/{document-DOzhDFFt.js → document-DMIUCoDA.js} +2 -2
  8. package/dist/{download-gyAym9vL.js → download-CP8noBdX.js} +18 -8
  9. package/dist/{errors-DROZyb9T.js → errors-DkFJysIM.js} +9 -0
  10. package/dist/exa.d.ts +2 -2
  11. package/dist/exa.js +5 -5
  12. package/dist/{fieldwork-DNwEf0Mo.d.ts → fieldwork-BrfoehvG.d.ts} +10 -1
  13. package/dist/firecrawl.d.ts +2 -2
  14. package/dist/firecrawl.js +10 -8
  15. package/dist/index.d.ts +4 -4
  16. package/dist/index.js +3 -2
  17. package/dist/{job-DBhGs7Ha.js → job-DnavRq_s.js} +3 -3
  18. package/dist/kernel.d.ts +1 -1
  19. package/dist/kernel.js +29 -13
  20. package/dist/llamaparse.d.ts +1 -1
  21. package/dist/llamaparse.js +5 -5
  22. package/dist/parallel.d.ts +3 -3
  23. package/dist/parallel.js +5 -5
  24. package/dist/{parse-lMLcxUsG.js → parse-Q7H4mrnO.js} +2 -2
  25. package/dist/perplexity.d.ts +2 -2
  26. package/dist/perplexity.js +5 -5
  27. package/dist/reducto.d.ts +1 -1
  28. package/dist/reducto.js +5 -5
  29. package/dist/{schema-COAaWnZB.js → schema--iU4AXSM.js} +1 -1
  30. package/dist/{schema-BFjS6CSz.d.ts → schema-CAPSX7yQ.d.ts} +1 -1
  31. package/dist/serpapi.d.ts +62 -4
  32. package/dist/serpapi.js +230 -5
  33. package/dist/tavily.d.ts +2 -2
  34. package/dist/tavily.js +5 -5
  35. package/dist/tools.d.ts +2 -2
  36. package/dist/tools.js +173 -123
  37. package/dist/{types-rc8bl8Em.js → types-mq6d6YOK.js} +1 -0
  38. package/dist/{util-BqeRYF2b.js → util-DFUXQX6v.js} +1 -1
  39. package/package.json +2 -2
package/dist/tools.js CHANGED
@@ -1,7 +1,7 @@
1
- import { t as FieldworkError } from "./errors-DROZyb9T.js";
2
- import { f as refuseTogether } from "./util-BqeRYF2b.js";
1
+ import { t as FieldworkError } from "./errors-DkFJysIM.js";
2
+ import { f as refuseTogether } from "./util-DFUXQX6v.js";
3
3
  import { a as isNumber, i as isList, n as isFlag, o as isText, r as isJsonObject, t as joinPath } from "./path-DL5P8XH2.js";
4
- import { t as CAPABILITIES } from "./types-rc8bl8Em.js";
4
+ import { t as CAPABILITIES } from "./types-mq6d6YOK.js";
5
5
  import * as z from "zod/mini";
6
6
  // src/tool-specs/schema.ts
7
7
  const described = (schema, description) => description === void 0 ? schema : {
@@ -261,6 +261,18 @@ const imageResult = object({
261
261
  url: str,
262
262
  width: number()
263
263
  }, ["url"]);
264
+ const imageMatch = object({
265
+ description: str,
266
+ height: number(),
267
+ kind: choice("exact for the same image, visual for a similar one; absent when the provider does not say.", ["exact", "visual"]),
268
+ publishedAt: str,
269
+ siteName: str,
270
+ sourceUrl: str,
271
+ thumbnailUrl: str,
272
+ title: str,
273
+ url: str,
274
+ width: number()
275
+ }, ["sourceUrl"]);
264
276
  const page = object({
265
277
  author: str,
266
278
  description: str,
@@ -338,6 +350,11 @@ const IMAGES_OUTPUT = object({
338
350
  meta,
339
351
  results: list(imageResult)
340
352
  }, ["results"]);
353
+ /** The result of `search_by_image`, a `ReverseImageSearch`. */
354
+ const IMAGE_MATCHES_OUTPUT = object({
355
+ meta,
356
+ results: list(imageMatch)
357
+ }, ["results"]);
341
358
  /** The result of `read_page`, a `Page`. */
342
359
  const PAGE_OUTPUT = page;
343
360
  /** The result of `read_pages`, a `PageBatch`: the pages read, and `failed` for URLs that could not be. */
@@ -1146,130 +1163,163 @@ const READ_SPECS = [
1146
1163
  * these into tools, in this order.
1147
1164
  */
1148
1165
  const SPECS = [
1149
- ...[{
1150
- capability: "search",
1151
- description: "Search the web and return a ranked list of pages with their titles, URLs and matching snippets. Use when you need pages about a topic, product or fact and do not have a URL yet. Do not use to read a page you already have a URL for (use read_page), for pictures (use search_images), or for a question that needs several sources combined into an answer (use research_question).",
1152
- destructive: false,
1153
- fields: [
1154
- {
1155
- name: "query",
1156
- required: true,
1157
- schema: text("What to search for.")
1158
- },
1159
- limit("How many results to return.", 20, [
1160
- "exa",
1161
- "firecrawl",
1162
- "tavily",
1163
- "parallel",
1164
- "perplexity",
1165
- "brave",
1166
- "browserbase"
1167
- ]),
1168
- includeDomains("results", [
1169
- "exa",
1170
- "firecrawl",
1171
- "tavily",
1172
- "parallel",
1173
- "perplexity"
1174
- ]),
1175
- excludeDomains("results", [
1176
- "exa",
1177
- "firecrawl",
1178
- "tavily",
1179
- "parallel",
1180
- "perplexity"
1181
- ]),
1182
- publishedAfter([
1183
- "exa",
1184
- "firecrawl",
1185
- "tavily",
1186
- "parallel",
1187
- "perplexity",
1188
- "brave",
1189
- "serpapi"
1190
- ]),
1191
- publishedBefore([
1192
- "exa",
1193
- "firecrawl",
1194
- "tavily",
1195
- "perplexity",
1196
- "brave",
1197
- "serpapi"
1198
- ]),
1199
- ...recency([
1200
- "firecrawl",
1201
- "perplexity",
1202
- "serpapi"
1203
- ], ["tavily", "brave"]),
1204
- country([
1205
- "exa",
1206
- "firecrawl",
1207
- "tavily",
1208
- "parallel",
1209
- "perplexity",
1210
- "brave",
1211
- "serpapi"
1212
- ], "Localize results to"),
1213
- language([
1214
- "tavily",
1215
- "perplexity",
1216
- "brave",
1217
- "serpapi"
1218
- ]),
1219
- {
1220
- name: "content",
1221
- providers: [
1166
+ ...[
1167
+ {
1168
+ capability: "search",
1169
+ description: "Search the web and return a ranked list of pages with their titles, URLs and matching snippets. Use when you need pages about a topic, product or fact and do not have a URL yet. Do not use to read a page you already have a URL for (use read_page), for pictures of a subject (use search_images), for where an image appears (use search_by_image), or for a question that needs several sources combined into an answer (use research_question).",
1170
+ destructive: false,
1171
+ fields: [
1172
+ {
1173
+ name: "query",
1174
+ required: true,
1175
+ schema: text("What to search for.")
1176
+ },
1177
+ limit("How many results to return.", 20, [
1178
+ "exa",
1179
+ "firecrawl",
1180
+ "tavily",
1181
+ "parallel",
1182
+ "perplexity",
1183
+ "brave",
1184
+ "browserbase"
1185
+ ]),
1186
+ includeDomains("results", [
1187
+ "exa",
1188
+ "firecrawl",
1189
+ "tavily",
1190
+ "parallel",
1191
+ "perplexity"
1192
+ ]),
1193
+ excludeDomains("results", [
1194
+ "exa",
1195
+ "firecrawl",
1196
+ "tavily",
1197
+ "parallel",
1198
+ "perplexity"
1199
+ ]),
1200
+ publishedAfter([
1201
+ "exa",
1202
+ "firecrawl",
1203
+ "tavily",
1204
+ "parallel",
1205
+ "perplexity",
1206
+ "brave",
1207
+ "serpapi"
1208
+ ]),
1209
+ publishedBefore([
1210
+ "exa",
1211
+ "firecrawl",
1212
+ "tavily",
1213
+ "perplexity",
1214
+ "brave",
1215
+ "serpapi"
1216
+ ]),
1217
+ ...recency([
1218
+ "firecrawl",
1219
+ "perplexity",
1220
+ "serpapi"
1221
+ ], ["tavily", "brave"]),
1222
+ country([
1222
1223
  "exa",
1223
1224
  "firecrawl",
1224
1225
  "tavily",
1226
+ "parallel",
1227
+ "perplexity",
1228
+ "brave",
1229
+ "serpapi"
1230
+ ], "Localize results to"),
1231
+ language([
1232
+ "tavily",
1233
+ "perplexity",
1234
+ "brave",
1235
+ "serpapi"
1236
+ ]),
1237
+ {
1238
+ name: "content",
1239
+ providers: [
1240
+ "exa",
1241
+ "firecrawl",
1242
+ "tavily",
1243
+ "brave"
1244
+ ],
1245
+ schema: flag("Include each result's page text. Slower and longer; leave out to get snippets only.")
1246
+ },
1247
+ maxAge(["exa", "tavily"]),
1248
+ maxAgeAtLeast600()
1249
+ ],
1250
+ idempotent: true,
1251
+ name: "search_web",
1252
+ output: SEARCH_OUTPUT,
1253
+ positional: ["query"],
1254
+ readOnly: true,
1255
+ title: "Search the web"
1256
+ },
1257
+ {
1258
+ capability: "images",
1259
+ description: "Search for images and return each image's URL, thumbnail, the page it appears on, its title and its size. Use when you need pictures of a subject. Do not use to find pages (use search_web) or to learn what is in an image.",
1260
+ destructive: false,
1261
+ fields: [
1262
+ {
1263
+ name: "query",
1264
+ required: true,
1265
+ schema: text("What the images should show.")
1266
+ },
1267
+ limit("How many images to return.", 20, [
1268
+ "firecrawl",
1269
+ "parallel",
1225
1270
  "brave"
1226
- ],
1227
- schema: flag("Include each result's page text. Slower and longer; leave out to get snippets only.")
1228
- },
1229
- maxAge(["exa", "tavily"]),
1230
- maxAgeAtLeast600()
1231
- ],
1232
- idempotent: true,
1233
- name: "search_web",
1234
- output: SEARCH_OUTPUT,
1235
- positional: ["query"],
1236
- readOnly: true,
1237
- title: "Search the web"
1238
- }, {
1239
- capability: "images",
1240
- description: "Search for images and return each image's URL, thumbnail, the page it appears on, its title and its size. Use when you need pictures of a subject. Do not use to find pages (use search_web) or to learn what is in an image.",
1241
- destructive: false,
1242
- fields: [
1243
- {
1244
- name: "query",
1245
- required: true,
1246
- schema: text("What the images should show.")
1247
- },
1248
- limit("How many images to return.", 20, [
1249
- "firecrawl",
1250
- "parallel",
1251
- "brave"
1252
- ]),
1253
- includeDomains("images", ["tavily"]),
1254
- excludeDomains("images", ["tavily"]),
1255
- publishedAfter(["serpapi"]),
1256
- publishedBefore(["serpapi"]),
1257
- ...recency(["serpapi"], []),
1258
- country([
1259
- "firecrawl",
1260
- "parallel",
1261
- "brave",
1262
- "serpapi"
1263
- ], "Localize results to"),
1264
- language(["brave", "serpapi"])
1265
- ],
1266
- idempotent: true,
1267
- name: "search_images",
1268
- output: IMAGES_OUTPUT,
1269
- positional: ["query"],
1270
- readOnly: true,
1271
- title: "Search for images"
1272
- }],
1271
+ ]),
1272
+ includeDomains("images", ["tavily"]),
1273
+ excludeDomains("images", ["tavily"]),
1274
+ publishedAfter(["serpapi"]),
1275
+ publishedBefore(["serpapi"]),
1276
+ ...recency(["serpapi"], []),
1277
+ country([
1278
+ "firecrawl",
1279
+ "parallel",
1280
+ "brave",
1281
+ "serpapi"
1282
+ ], "Localize results to"),
1283
+ language(["brave", "serpapi"])
1284
+ ],
1285
+ idempotent: true,
1286
+ name: "search_images",
1287
+ output: IMAGES_OUTPUT,
1288
+ positional: ["query"],
1289
+ readOnly: true,
1290
+ title: "Search for images"
1291
+ },
1292
+ {
1293
+ capability: "reverseImage",
1294
+ description: "Find the web pages an image appears on, given the image's URL. Returns each page's URL (sourceUrl), the matched image when the provider gives one, a thumbnail, a title and whether the match is the same image or a similar one. Use when you have an image and need to know where it is published, who uses it or where a larger copy is. Do not use to find pictures of a subject (use search_images), to find pages by text (use search_web) or to learn what is in an image.",
1295
+ destructive: false,
1296
+ fields: [
1297
+ {
1298
+ name: "imageUrl",
1299
+ required: true,
1300
+ schema: url("The image's full URL, including https://. It must be publicly reachable.")
1301
+ },
1302
+ {
1303
+ name: "query",
1304
+ providers: ["serpapi"],
1305
+ schema: text("Words to refine the search with, such as the subject. SerpApi refuses it together with match \"exact\".")
1306
+ },
1307
+ {
1308
+ name: "match",
1309
+ providers: ["serpapi"],
1310
+ schema: choice("exact for pages showing the same image, visual for pages showing a similar one. Leave out for the provider's default, which lists similar images.", ["exact", "visual"])
1311
+ },
1312
+ country(["serpapi"], "Localize results to"),
1313
+ language(["serpapi"])
1314
+ ],
1315
+ idempotent: true,
1316
+ name: "search_by_image",
1317
+ output: IMAGE_MATCHES_OUTPUT,
1318
+ positional: ["imageUrl"],
1319
+ readOnly: true,
1320
+ title: "Find where an image appears"
1321
+ }
1322
+ ],
1273
1323
  ...READ_SPECS,
1274
1324
  ...ANSWER_SPECS,
1275
1325
  ...BROWSER_SPECS,
@@ -3,6 +3,7 @@
3
3
  const CAPABILITIES = [
4
4
  "search",
5
5
  "images",
6
+ "reverseImage",
6
7
  "read",
7
8
  "readMany",
8
9
  "extract",
@@ -1,4 +1,4 @@
1
- import { t as FieldworkError } from "./errors-DROZyb9T.js";
1
+ import { t as FieldworkError } from "./errors-DkFJysIM.js";
2
2
  // src/util.ts
3
3
  const isJson = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
4
4
  /** The value as an object, or an empty one when it is null, an array or not an object, so a read of a missing body needs no guard. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@howells/fieldwork-sdk",
3
- "version": "0.10.1",
4
- "description": "One API for web search, page reading, extraction, crawling, answers, research, browser sessions, monitoring and document parsing across Exa, Firecrawl, Tavily, Parallel, Perplexity, Brave, SerpApi, Browserbase, Kernel, LlamaParse and Reducto.",
3
+ "version": "0.11.0",
4
+ "description": "One API for web search, reverse image search, page reading, extraction, crawling, answers, research, browser sessions, monitoring and document parsing across Exa, Firecrawl, Tavily, Parallel, Perplexity, Brave, SerpApi, Browserbase, Kernel, LlamaParse and Reducto.",
5
5
  "keywords": [
6
6
  "agents",
7
7
  "brave",