@youdotcom-oss/api 0.0.1 → 0.1.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.
- package/README.md +19 -19
- package/bin/cli.js +12 -26
- package/package.json +1 -1
- package/src/cli.ts +4 -4
- package/src/express/express.schemas.ts +12 -4
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ bunx @youdotcom-oss/api contents --json '{
|
|
|
38
38
|
}' --client MyAgent
|
|
39
39
|
|
|
40
40
|
# Discover available parameters with --schema
|
|
41
|
-
|
|
41
|
+
ydc search --schema | jq '.properties | keys'
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
### Programmatic Usage
|
|
@@ -99,9 +99,9 @@ export YDC_CLIENT="YourAgentName" # Optional: default client for tracking
|
|
|
99
99
|
All commands require the `--json` flag with a JSON string containing the query parameters:
|
|
100
100
|
|
|
101
101
|
```bash
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
ydc search --json '{"query":"..."}'
|
|
103
|
+
ydc express --json '{"input":"..."}'
|
|
104
|
+
ydc contents --json '{"urls":["..."]}'
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
### Global Options
|
|
@@ -118,13 +118,13 @@ Use `--schema` to discover what parameters each command accepts:
|
|
|
118
118
|
|
|
119
119
|
```bash
|
|
120
120
|
# Get schema for search command
|
|
121
|
-
|
|
121
|
+
ydc search --schema
|
|
122
122
|
|
|
123
123
|
# Get schema for express command
|
|
124
|
-
|
|
124
|
+
ydc express --schema
|
|
125
125
|
|
|
126
126
|
# Get schema for contents command
|
|
127
|
-
|
|
127
|
+
ydc contents --schema
|
|
128
128
|
```
|
|
129
129
|
|
|
130
130
|
The schema output describes the JSON structure to pass via `--json`.
|
|
@@ -132,21 +132,21 @@ The schema output describes the JSON structure to pass via `--json`.
|
|
|
132
132
|
### Search Command
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
|
-
|
|
135
|
+
ydc search --json '{"query":"..."}' [options]
|
|
136
136
|
|
|
137
137
|
Examples:
|
|
138
138
|
# Basic search
|
|
139
|
-
|
|
139
|
+
ydc search --json '{"query":"machine learning"}' --client Openclaw
|
|
140
140
|
|
|
141
141
|
# Search with livecrawl (KEY FEATURE)
|
|
142
|
-
|
|
142
|
+
ydc search --json '{
|
|
143
143
|
"query":"documentation",
|
|
144
144
|
"livecrawl":"web",
|
|
145
145
|
"livecrawl_formats":"markdown"
|
|
146
146
|
}' --client Openclaw
|
|
147
147
|
|
|
148
148
|
# Advanced filters
|
|
149
|
-
|
|
149
|
+
ydc search --json '{
|
|
150
150
|
"query":"AI papers",
|
|
151
151
|
"site":"arxiv.org",
|
|
152
152
|
"fileType":"pdf",
|
|
@@ -185,7 +185,7 @@ Examples:
|
|
|
185
185
|
### Express Command
|
|
186
186
|
|
|
187
187
|
```bash
|
|
188
|
-
|
|
188
|
+
ydc express --json '{"input":"..."}' [options]
|
|
189
189
|
|
|
190
190
|
Examples:
|
|
191
191
|
# Fast answer
|
|
@@ -212,7 +212,7 @@ Examples:
|
|
|
212
212
|
### Contents Command
|
|
213
213
|
|
|
214
214
|
```bash
|
|
215
|
-
|
|
215
|
+
ydc contents --json '{"urls":["..."]}' [options]
|
|
216
216
|
|
|
217
217
|
Examples:
|
|
218
218
|
# Extract markdown
|
|
@@ -275,7 +275,7 @@ Examples:
|
|
|
275
275
|
|
|
276
276
|
```bash
|
|
277
277
|
# Direct access to response fields
|
|
278
|
-
|
|
278
|
+
ydc search --json '{"query":"AI"}' | jq '.results.web[0].title'
|
|
279
279
|
|
|
280
280
|
# No need to unwrap .data or .success
|
|
281
281
|
```
|
|
@@ -390,9 +390,9 @@ exit 1
|
|
|
390
390
|
|
|
391
391
|
```bash
|
|
392
392
|
#!/usr/bin/env bash
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
393
|
+
ydc search --json '{"query":"AI"}' --client Openclaw &
|
|
394
|
+
ydc search --json '{"query":"ML"}' --client Openclaw &
|
|
395
|
+
ydc search --json '{"query":"LLM"}' --client Openclaw &
|
|
396
396
|
wait
|
|
397
397
|
```
|
|
398
398
|
|
|
@@ -418,7 +418,7 @@ answer=$(api express --json '{
|
|
|
418
418
|
|
|
419
419
|
# Extract top result URL and fetch content
|
|
420
420
|
url=$(echo "$search" | jq -r '.results.web[0].url')
|
|
421
|
-
|
|
421
|
+
ydc contents --json "{\"urls\":[\"$url\"],\"formats\":[\"markdown\"]}" \
|
|
422
422
|
--client Openclaw | jq -r '.[0].markdown' > output.md
|
|
423
423
|
```
|
|
424
424
|
|
|
@@ -441,7 +441,7 @@ query=$(jq -n '{
|
|
|
441
441
|
}')
|
|
442
442
|
|
|
443
443
|
# Execute search
|
|
444
|
-
|
|
444
|
+
ydc search --json "$query" --client Openclaw
|
|
445
445
|
```
|
|
446
446
|
|
|
447
447
|
## Agent Skills Integration
|
package/bin/cli.js
CHANGED
|
@@ -15,7 +15,7 @@ import { parseArgs as parseArgs4 } from "node:util";
|
|
|
15
15
|
// package.json
|
|
16
16
|
var package_default = {
|
|
17
17
|
name: "@youdotcom-oss/api",
|
|
18
|
-
version: "0.0
|
|
18
|
+
version: "0.1.0",
|
|
19
19
|
description: "You.com API client with bundled CLI for agents supporting Agent Skills",
|
|
20
20
|
license: "MIT",
|
|
21
21
|
engines: {
|
|
@@ -1894,10 +1894,6 @@ var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, d
|
|
|
1894
1894
|
$ZodCheckNumberFormat.init(inst, def);
|
|
1895
1895
|
$ZodNumber.init(inst, def);
|
|
1896
1896
|
});
|
|
1897
|
-
var $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {
|
|
1898
|
-
$ZodType.init(inst, def);
|
|
1899
|
-
inst._zod.parse = (payload) => payload;
|
|
1900
|
-
});
|
|
1901
1897
|
var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
1902
1898
|
$ZodType.init(inst, def);
|
|
1903
1899
|
inst._zod.parse = (payload) => payload;
|
|
@@ -3169,11 +3165,6 @@ function _int(Class2, params) {
|
|
|
3169
3165
|
...normalizeParams(params)
|
|
3170
3166
|
});
|
|
3171
3167
|
}
|
|
3172
|
-
function _any(Class2) {
|
|
3173
|
-
return new Class2({
|
|
3174
|
-
type: "any"
|
|
3175
|
-
});
|
|
3176
|
-
}
|
|
3177
3168
|
function _unknown(Class2) {
|
|
3178
3169
|
return new Class2({
|
|
3179
3170
|
type: "unknown"
|
|
@@ -4584,14 +4575,6 @@ var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def
|
|
|
4584
4575
|
function int(params) {
|
|
4585
4576
|
return _int(ZodNumberFormat, params);
|
|
4586
4577
|
}
|
|
4587
|
-
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
4588
|
-
$ZodAny.init(inst, def);
|
|
4589
|
-
ZodType.init(inst, def);
|
|
4590
|
-
inst._zod.processJSONSchema = (ctx, json, params) => anyProcessor(inst, ctx, json, params);
|
|
4591
|
-
});
|
|
4592
|
-
function any() {
|
|
4593
|
-
return _any(ZodAny);
|
|
4594
|
-
}
|
|
4595
4578
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
4596
4579
|
$ZodUnknown.init(inst, def);
|
|
4597
4580
|
ZodType.init(inst, def);
|
|
@@ -5071,13 +5054,13 @@ var ExpressAgentInputSchema = object({
|
|
|
5071
5054
|
})).optional().describe("Tools (web search only)")
|
|
5072
5055
|
});
|
|
5073
5056
|
var ApiSearchResultItemSchema = object({
|
|
5074
|
-
source_type: string2().optional(),
|
|
5057
|
+
source_type: string2().nullable().optional(),
|
|
5075
5058
|
citation_uri: string2().optional(),
|
|
5076
5059
|
url: string2(),
|
|
5077
5060
|
title: string2(),
|
|
5078
5061
|
snippet: string2(),
|
|
5079
|
-
thumbnail_url: string2().optional(),
|
|
5080
|
-
provider:
|
|
5062
|
+
thumbnail_url: string2().nullable().optional(),
|
|
5063
|
+
provider: string2().nullable().optional()
|
|
5081
5064
|
});
|
|
5082
5065
|
var ExpressAgentApiOutputItemSchema = union([
|
|
5083
5066
|
object({
|
|
@@ -5093,7 +5076,10 @@ var ExpressAgentApiResponseSchema = object({
|
|
|
5093
5076
|
output: array(ExpressAgentApiOutputItemSchema),
|
|
5094
5077
|
agent: string2().optional().describe("Agent identifier"),
|
|
5095
5078
|
mode: string2().optional().describe("Agent mode"),
|
|
5096
|
-
input: array(
|
|
5079
|
+
input: array(object({
|
|
5080
|
+
role: _enum(["user"]).describe("User role"),
|
|
5081
|
+
content: string2().describe("User question")
|
|
5082
|
+
})).optional().describe("Input messages")
|
|
5097
5083
|
}).passthrough();
|
|
5098
5084
|
var McpSearchResultItemSchema = object({
|
|
5099
5085
|
url: string2().describe("URL"),
|
|
@@ -5439,11 +5425,11 @@ Output Format:
|
|
|
5439
5425
|
Invalid args: Error message on stderr (exit 2)
|
|
5440
5426
|
|
|
5441
5427
|
Examples:
|
|
5442
|
-
ydc search "AI developments" --client Openclaw
|
|
5443
|
-
ydc
|
|
5444
|
-
ydc
|
|
5445
|
-
ydc contents https://example.com --formats markdown
|
|
5428
|
+
ydc search --json '{"query":"AI developments"}' --client Openclaw
|
|
5429
|
+
ydc express --json '{"input":"What happened today?","tools":[{"type":"web_search"}]}' --client MyAgent
|
|
5430
|
+
ydc contents --json '{"urls":["https://example.com"],"formats":["markdown"]}'
|
|
5446
5431
|
ydc search --schema # Get JSON schema for search --json input
|
|
5432
|
+
ydc search --json '{"query":"AI"}' | jq '.data.results.web[0].title'
|
|
5447
5433
|
|
|
5448
5434
|
More info: https://github.com/youdotcom-oss/dx-toolkit/tree/main/packages/api
|
|
5449
5435
|
`);
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -54,11 +54,11 @@ Output Format:
|
|
|
54
54
|
Invalid args: Error message on stderr (exit 2)
|
|
55
55
|
|
|
56
56
|
Examples:
|
|
57
|
-
ydc search "AI developments" --client Openclaw
|
|
58
|
-
ydc
|
|
59
|
-
ydc
|
|
60
|
-
ydc contents https://example.com --formats markdown
|
|
57
|
+
ydc search --json '{"query":"AI developments"}' --client Openclaw
|
|
58
|
+
ydc express --json '{"input":"What happened today?","tools":[{"type":"web_search"}]}' --client MyAgent
|
|
59
|
+
ydc contents --json '{"urls":["https://example.com"],"formats":["markdown"]}'
|
|
61
60
|
ydc search --schema # Get JSON schema for search --json input
|
|
61
|
+
ydc search --json '{"query":"AI"}' | jq '.data.results.web[0].title'
|
|
62
62
|
|
|
63
63
|
More info: https://github.com/youdotcom-oss/dx-toolkit/tree/main/packages/api
|
|
64
64
|
`)
|
|
@@ -19,13 +19,13 @@ export type ExpressAgentInput = z.infer<typeof ExpressAgentInputSchema>
|
|
|
19
19
|
// Search result content item from web_search.results
|
|
20
20
|
// Note: thumbnail_url, source_type, and provider are API-only pass-through fields not used in MCP output
|
|
21
21
|
const ApiSearchResultItemSchema = z.object({
|
|
22
|
-
source_type: z.string().optional(),
|
|
22
|
+
source_type: z.string().nullable().optional(),
|
|
23
23
|
citation_uri: z.string().optional(), // Used as fallback for url in transformation
|
|
24
24
|
url: z.string(),
|
|
25
25
|
title: z.string(),
|
|
26
26
|
snippet: z.string(),
|
|
27
|
-
thumbnail_url: z.string().optional(), // API-only, not transformed to MCP output
|
|
28
|
-
provider: z.
|
|
27
|
+
thumbnail_url: z.string().nullable().optional(), // API-only, not transformed to MCP output
|
|
28
|
+
provider: z.string().nullable().optional(), // API-only, not transformed to MCP output
|
|
29
29
|
})
|
|
30
30
|
|
|
31
31
|
// Union of possible output item types from API
|
|
@@ -47,7 +47,15 @@ export const ExpressAgentApiResponseSchema = z
|
|
|
47
47
|
output: z.array(ExpressAgentApiOutputItemSchema),
|
|
48
48
|
agent: z.string().optional().describe('Agent identifier'),
|
|
49
49
|
mode: z.string().optional().describe('Agent mode'),
|
|
50
|
-
input: z
|
|
50
|
+
input: z
|
|
51
|
+
.array(
|
|
52
|
+
z.object({
|
|
53
|
+
role: z.enum(['user']).describe('User role'),
|
|
54
|
+
content: z.string().describe('User question'),
|
|
55
|
+
}),
|
|
56
|
+
)
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('Input messages'),
|
|
51
59
|
})
|
|
52
60
|
.passthrough()
|
|
53
61
|
|