@youdotcom-oss/ai-sdk-plugin 1.0.1 → 1.0.2
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/dist/main.js +14 -102
- package/package.json +5 -9
package/dist/main.js
CHANGED
|
@@ -954,7 +954,6 @@ var string = (params) => {
|
|
|
954
954
|
};
|
|
955
955
|
var integer = /^-?\d+$/;
|
|
956
956
|
var number = /^-?\d+(?:\.\d+)?$/;
|
|
957
|
-
var boolean = /^(?:true|false)$/i;
|
|
958
957
|
var lowercase = /^[^A-Z]*$/;
|
|
959
958
|
var uppercase = /^[^a-z]*$/;
|
|
960
959
|
|
|
@@ -1819,26 +1818,6 @@ var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, d
|
|
|
1819
1818
|
$ZodCheckNumberFormat.init(inst, def);
|
|
1820
1819
|
$ZodNumber.init(inst, def);
|
|
1821
1820
|
});
|
|
1822
|
-
var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
1823
|
-
$ZodType.init(inst, def);
|
|
1824
|
-
inst._zod.pattern = boolean;
|
|
1825
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
1826
|
-
if (def.coerce)
|
|
1827
|
-
try {
|
|
1828
|
-
payload.value = Boolean(payload.value);
|
|
1829
|
-
} catch (_) {}
|
|
1830
|
-
const input = payload.value;
|
|
1831
|
-
if (typeof input === "boolean")
|
|
1832
|
-
return payload;
|
|
1833
|
-
payload.issues.push({
|
|
1834
|
-
expected: "boolean",
|
|
1835
|
-
code: "invalid_type",
|
|
1836
|
-
input,
|
|
1837
|
-
inst
|
|
1838
|
-
});
|
|
1839
|
-
return payload;
|
|
1840
|
-
};
|
|
1841
|
-
});
|
|
1842
1821
|
var $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {
|
|
1843
1822
|
$ZodType.init(inst, def);
|
|
1844
1823
|
inst._zod.parse = (payload) => payload;
|
|
@@ -3008,12 +2987,6 @@ function _int(Class2, params) {
|
|
|
3008
2987
|
...normalizeParams(params)
|
|
3009
2988
|
});
|
|
3010
2989
|
}
|
|
3011
|
-
function _boolean(Class2, params) {
|
|
3012
|
-
return new Class2({
|
|
3013
|
-
type: "boolean",
|
|
3014
|
-
...normalizeParams(params)
|
|
3015
|
-
});
|
|
3016
|
-
}
|
|
3017
2990
|
function _any(Class2) {
|
|
3018
2991
|
return new Class2({
|
|
3019
2992
|
type: "any"
|
|
@@ -3631,9 +3604,6 @@ var numberProcessor = (schema, ctx, _json, _params) => {
|
|
|
3631
3604
|
if (typeof multipleOf === "number")
|
|
3632
3605
|
json.multipleOf = multipleOf;
|
|
3633
3606
|
};
|
|
3634
|
-
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3635
|
-
json.type = "boolean";
|
|
3636
|
-
};
|
|
3637
3607
|
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3638
3608
|
json.not = {};
|
|
3639
3609
|
};
|
|
@@ -4211,14 +4181,6 @@ var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def
|
|
|
4211
4181
|
function int(params) {
|
|
4212
4182
|
return _int(ZodNumberFormat, params);
|
|
4213
4183
|
}
|
|
4214
|
-
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
4215
|
-
$ZodBoolean.init(inst, def);
|
|
4216
|
-
ZodType.init(inst, def);
|
|
4217
|
-
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
4218
|
-
});
|
|
4219
|
-
function boolean2(params) {
|
|
4220
|
-
return _boolean(ZodBoolean, params);
|
|
4221
|
-
}
|
|
4222
4184
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
4223
4185
|
$ZodAny.init(inst, def);
|
|
4224
4186
|
ZodType.init(inst, def);
|
|
@@ -4567,7 +4529,7 @@ function superRefine(fn) {
|
|
|
4567
4529
|
return _superRefine(fn);
|
|
4568
4530
|
}
|
|
4569
4531
|
|
|
4570
|
-
//
|
|
4532
|
+
// ../../node_modules/.bun/@youdotcom-oss+api@0.0.1/node_modules/@youdotcom-oss/api/src/contents/contents.schemas.ts
|
|
4571
4533
|
var ContentsQuerySchema = object({
|
|
4572
4534
|
urls: array(string2().url()).min(1).describe('Array of webpage URLs to extract content from (e.g., ["https://example.com"])'),
|
|
4573
4535
|
formats: array(_enum(["markdown", "html", "metadata"])).optional().describe('Output formats: array of "markdown" (text), "html" (layout), or "metadata" (structured data)'),
|
|
@@ -4586,27 +4548,12 @@ var ContentsItemSchema = object({
|
|
|
4586
4548
|
}).optional().describe("Structured metadata when available")
|
|
4587
4549
|
});
|
|
4588
4550
|
var ContentsApiResponseSchema = array(ContentsItemSchema);
|
|
4589
|
-
|
|
4590
|
-
count: number2().describe("URLs processed"),
|
|
4591
|
-
formats: array(string2()).describe("Content formats requested"),
|
|
4592
|
-
items: array(object({
|
|
4593
|
-
url: string2().describe("URL"),
|
|
4594
|
-
title: string2().optional().describe("Title"),
|
|
4595
|
-
markdown: string2().optional().describe("Markdown content"),
|
|
4596
|
-
html: string2().optional().describe("HTML content"),
|
|
4597
|
-
metadata: object({
|
|
4598
|
-
jsonld: array(record(string2(), unknown())).optional(),
|
|
4599
|
-
opengraph: record(string2(), string2()).optional(),
|
|
4600
|
-
twitter: record(string2(), string2()).optional()
|
|
4601
|
-
}).optional().describe("Structured metadata")
|
|
4602
|
-
})).describe("Extracted items")
|
|
4603
|
-
});
|
|
4604
|
-
// ../mcp/src/shared/api-constants.ts
|
|
4551
|
+
// ../../node_modules/.bun/@youdotcom-oss+api@0.0.1/node_modules/@youdotcom-oss/api/src/shared/api.constants.ts
|
|
4605
4552
|
var SEARCH_API_URL = "https://ydc-index.io/v1/search";
|
|
4606
4553
|
var EXPRESS_API_URL = "https://api.you.com/v1/agents/runs";
|
|
4607
4554
|
var CONTENTS_API_URL = "https://ydc-index.io/v1/contents";
|
|
4608
4555
|
|
|
4609
|
-
//
|
|
4556
|
+
// ../../node_modules/.bun/@youdotcom-oss+api@0.0.1/node_modules/@youdotcom-oss/api/src/shared/check-response-for-errors.ts
|
|
4610
4557
|
var checkResponseForErrors = (responseData) => {
|
|
4611
4558
|
if (typeof responseData === "object" && responseData !== null && "error" in responseData) {
|
|
4612
4559
|
const errorMessage = typeof responseData.error === "string" ? responseData.error : JSON.stringify(responseData.error);
|
|
@@ -4615,7 +4562,7 @@ var checkResponseForErrors = (responseData) => {
|
|
|
4615
4562
|
return responseData;
|
|
4616
4563
|
};
|
|
4617
4564
|
|
|
4618
|
-
//
|
|
4565
|
+
// ../../node_modules/.bun/@youdotcom-oss+api@0.0.1/node_modules/@youdotcom-oss/api/src/contents/contents.utils.ts
|
|
4619
4566
|
var fetchContents = async ({
|
|
4620
4567
|
contentsQuery: { urls, formats, format, crawl_timeout },
|
|
4621
4568
|
YDC_API_KEY = process.env.YDC_API_KEY,
|
|
@@ -4670,7 +4617,7 @@ var fetchContents = async ({
|
|
|
4670
4617
|
const parsedResults = ContentsApiResponseSchema.parse(results);
|
|
4671
4618
|
return parsedResults;
|
|
4672
4619
|
};
|
|
4673
|
-
//
|
|
4620
|
+
// ../../node_modules/.bun/@youdotcom-oss+api@0.0.1/node_modules/@youdotcom-oss/api/src/express/express.schemas.ts
|
|
4674
4621
|
var ExpressAgentInputSchema = object({
|
|
4675
4622
|
input: string2().min(1, "Input is required").describe("Query or prompt"),
|
|
4676
4623
|
tools: array(object({
|
|
@@ -4714,19 +4661,7 @@ var ExpressAgentMcpResponseSchema = object({
|
|
|
4714
4661
|
}).optional().describe("Search results"),
|
|
4715
4662
|
agent: string2().optional().describe("Agent ID")
|
|
4716
4663
|
});
|
|
4717
|
-
|
|
4718
|
-
answer: string2().describe("AI answer"),
|
|
4719
|
-
hasResults: boolean2().describe("Has web results"),
|
|
4720
|
-
resultCount: number2().describe("Result count"),
|
|
4721
|
-
agent: string2().optional().describe("Agent ID"),
|
|
4722
|
-
results: object({
|
|
4723
|
-
web: array(object({
|
|
4724
|
-
url: string2().describe("URL"),
|
|
4725
|
-
title: string2().describe("Title")
|
|
4726
|
-
})).optional().describe("Web results")
|
|
4727
|
-
}).optional().describe("Search results")
|
|
4728
|
-
});
|
|
4729
|
-
// ../mcp/src/express/express.utils.ts
|
|
4664
|
+
// ../../node_modules/.bun/@youdotcom-oss+api@0.0.1/node_modules/@youdotcom-oss/api/src/express/express.utils.ts
|
|
4730
4665
|
var agentThrowOnFailedStatus = async (response) => {
|
|
4731
4666
|
const errorCode = response.status;
|
|
4732
4667
|
const errorData = await response.json();
|
|
@@ -4792,7 +4727,7 @@ var callExpressAgent = async ({
|
|
|
4792
4727
|
}
|
|
4793
4728
|
return mcpResponse;
|
|
4794
4729
|
};
|
|
4795
|
-
//
|
|
4730
|
+
// ../../node_modules/.bun/@youdotcom-oss+api@0.0.1/node_modules/@youdotcom-oss/api/src/search/search.schemas.ts
|
|
4796
4731
|
var SearchQuerySchema = object({
|
|
4797
4732
|
query: string2().min(1, "Query is required").describe("Search query (supports +, -, site:, filetype:, lang:)"),
|
|
4798
4733
|
count: number2().int().min(1).max(100).optional().describe("Max results per section"),
|
|
@@ -4882,26 +4817,7 @@ var SearchResponseSchema = object({
|
|
|
4882
4817
|
}),
|
|
4883
4818
|
metadata: MetadataSchema.partial()
|
|
4884
4819
|
});
|
|
4885
|
-
|
|
4886
|
-
resultCounts: object({
|
|
4887
|
-
web: number2().describe("Web results"),
|
|
4888
|
-
news: number2().describe("News results"),
|
|
4889
|
-
total: number2().describe("Total results")
|
|
4890
|
-
}),
|
|
4891
|
-
results: object({
|
|
4892
|
-
web: array(object({
|
|
4893
|
-
url: string2().describe("URL"),
|
|
4894
|
-
title: string2().describe("Title"),
|
|
4895
|
-
page_age: string2().optional().describe("Publication timestamp")
|
|
4896
|
-
})).optional().describe("Web results"),
|
|
4897
|
-
news: array(object({
|
|
4898
|
-
url: string2().describe("URL"),
|
|
4899
|
-
title: string2().describe("Title"),
|
|
4900
|
-
page_age: string2().describe("Publication timestamp")
|
|
4901
|
-
})).optional().describe("News results")
|
|
4902
|
-
}).optional().describe("Search results")
|
|
4903
|
-
});
|
|
4904
|
-
// ../mcp/src/search/search.utils.ts
|
|
4820
|
+
// ../../node_modules/.bun/@youdotcom-oss+api@0.0.1/node_modules/@youdotcom-oss/api/src/search/search.utils.ts
|
|
4905
4821
|
var fetchSearchResults = async ({
|
|
4906
4822
|
YDC_API_KEY = process.env.YDC_API_KEY,
|
|
4907
4823
|
searchQuery: { query, site, fileType, language, exactTerms, excludeTerms, ...rest },
|
|
@@ -4951,7 +4867,7 @@ import { tool } from "ai";
|
|
|
4951
4867
|
// package.json
|
|
4952
4868
|
var package_default = {
|
|
4953
4869
|
name: "@youdotcom-oss/ai-sdk-plugin",
|
|
4954
|
-
version: "1.0.
|
|
4870
|
+
version: "1.0.2",
|
|
4955
4871
|
description: "Vercel AI SDK plugin for You.com web search, AI agents, and content extraction via MCP",
|
|
4956
4872
|
license: "MIT",
|
|
4957
4873
|
engines: {
|
|
@@ -5002,13 +4918,9 @@ var package_default = {
|
|
|
5002
4918
|
"check:biome": "biome check",
|
|
5003
4919
|
"check:package": "format-package --check",
|
|
5004
4920
|
"check:types": "tsc --noEmit",
|
|
5005
|
-
"check:write": "
|
|
4921
|
+
"check:write": "biome check --write && bun run format:package",
|
|
5006
4922
|
example: "bun scripts/run-example.ts",
|
|
5007
|
-
format: "biome format --write",
|
|
5008
|
-
"format:check": "biome format",
|
|
5009
4923
|
"format:package": "format-package --write",
|
|
5010
|
-
lint: "biome lint",
|
|
5011
|
-
"lint:fix": "biome lint --write",
|
|
5012
4924
|
prepublishOnly: "bun run build",
|
|
5013
4925
|
test: "bun test",
|
|
5014
4926
|
"test:coverage": "bun test --coverage",
|
|
@@ -5017,19 +4929,19 @@ var package_default = {
|
|
|
5017
4929
|
},
|
|
5018
4930
|
types: "./dist/main.d.ts",
|
|
5019
4931
|
dependencies: {
|
|
5020
|
-
"@youdotcom-oss/
|
|
4932
|
+
"@youdotcom-oss/api": "0.0.1"
|
|
5021
4933
|
},
|
|
5022
4934
|
peerDependencies: {
|
|
5023
4935
|
ai: "^6.0.0"
|
|
5024
4936
|
},
|
|
5025
4937
|
devDependencies: {
|
|
5026
|
-
"@ai-sdk/anthropic": "^3.0.
|
|
5027
|
-
ai: "^6.0.
|
|
4938
|
+
"@ai-sdk/anthropic": "^3.0.35",
|
|
4939
|
+
ai: "^6.0.67"
|
|
5028
4940
|
}
|
|
5029
4941
|
};
|
|
5030
4942
|
|
|
5031
4943
|
// src/main.ts
|
|
5032
|
-
var getUserAgent = () => `AI-SDK-Plugin
|
|
4944
|
+
var getUserAgent = () => `AI-SDK-Plugin/${package_default.version} (You.com;${process.env.NEXT_PUBLIC_SITE_URL || ""})`;
|
|
5033
4945
|
var youSearch = (config2 = {}) => {
|
|
5034
4946
|
const apiKey = config2.apiKey ?? process.env.YDC_API_KEY;
|
|
5035
4947
|
return tool({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@youdotcom-oss/ai-sdk-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Vercel AI SDK plugin for You.com web search, AI agents, and content extraction via MCP",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -51,13 +51,9 @@
|
|
|
51
51
|
"check:biome": "biome check",
|
|
52
52
|
"check:package": "format-package --check",
|
|
53
53
|
"check:types": "tsc --noEmit",
|
|
54
|
-
"check:write": "
|
|
54
|
+
"check:write": "biome check --write && bun run format:package",
|
|
55
55
|
"example": "bun scripts/run-example.ts",
|
|
56
|
-
"format": "biome format --write",
|
|
57
|
-
"format:check": "biome format",
|
|
58
56
|
"format:package": "format-package --write",
|
|
59
|
-
"lint": "biome lint",
|
|
60
|
-
"lint:fix": "biome lint --write",
|
|
61
57
|
"prepublishOnly": "bun run build",
|
|
62
58
|
"test": "bun test",
|
|
63
59
|
"test:coverage": "bun test --coverage",
|
|
@@ -66,13 +62,13 @@
|
|
|
66
62
|
},
|
|
67
63
|
"types": "./dist/main.d.ts",
|
|
68
64
|
"dependencies": {
|
|
69
|
-
"@youdotcom-oss/
|
|
65
|
+
"@youdotcom-oss/api": "0.0.1"
|
|
70
66
|
},
|
|
71
67
|
"peerDependencies": {
|
|
72
68
|
"ai": "^6.0.0"
|
|
73
69
|
},
|
|
74
70
|
"devDependencies": {
|
|
75
|
-
"@ai-sdk/anthropic": "^3.0.
|
|
76
|
-
"ai": "^6.0.
|
|
71
|
+
"@ai-sdk/anthropic": "^3.0.35",
|
|
72
|
+
"ai": "^6.0.67"
|
|
77
73
|
}
|
|
78
74
|
}
|