@introspection-ai/recipes 0.50.0 → 0.51.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/dist/connector-tools.d.ts.map +1 -1
- package/dist/connector-tools.js +1 -4
- package/dist/connector-tools.js.map +1 -1
- package/dist/documents/module.d.ts.map +1 -1
- package/dist/documents/module.js +1 -3
- package/dist/documents/module.js.map +1 -1
- package/dist/egress.d.ts +23 -0
- package/dist/egress.d.ts.map +1 -0
- package/dist/egress.js +36 -0
- package/dist/egress.js.map +1 -0
- package/dist/productivity/http.d.ts.map +1 -1
- package/dist/productivity/http.js +8 -21
- package/dist/productivity/http.js.map +1 -1
- package/dist/productivity/module.d.ts.map +1 -1
- package/dist/productivity/module.js +1 -3
- package/dist/productivity/module.js.map +1 -1
- package/dist/recipe/companions.d.ts +2 -1
- package/dist/recipe/companions.d.ts.map +1 -1
- package/dist/recipe/companions.js +11 -9
- package/dist/recipe/companions.js.map +1 -1
- package/dist/recipe/manifest.generated.d.ts +2 -1
- package/dist/recipe/manifest.generated.d.ts.map +1 -1
- package/dist/recipe/manifest.generated.js +3 -2
- package/dist/recipe/manifest.generated.js.map +1 -1
- package/dist/search/egress.d.ts +12 -0
- package/dist/search/egress.d.ts.map +1 -0
- package/dist/search/egress.js +24 -0
- package/dist/search/egress.js.map +1 -0
- package/dist/search/http.d.ts +16 -0
- package/dist/search/http.d.ts.map +1 -0
- package/dist/search/http.js +75 -0
- package/dist/search/http.js.map +1 -0
- package/dist/search/index.d.ts +9 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +5 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/mcp.d.ts +58 -0
- package/dist/search/mcp.d.ts.map +1 -0
- package/dist/search/mcp.js +84 -0
- package/dist/search/mcp.js.map +1 -0
- package/dist/search/module.d.ts +16 -0
- package/dist/search/module.d.ts.map +1 -0
- package/dist/search/module.js +27 -0
- package/dist/search/module.js.map +1 -0
- package/dist/search/tool.d.ts +96 -0
- package/dist/search/tool.d.ts.map +1 -0
- package/dist/search/tool.js +505 -0
- package/dist/search/tool.js.map +1 -0
- package/dist/search/types.d.ts +247 -0
- package/dist/search/types.d.ts.map +1 -0
- package/dist/search/types.js +60 -0
- package/dist/search/types.js.map +1 -0
- package/docs/README.md +1 -0
- package/docs/mcp-configuration.md +2 -1
- package/docs/search/README.md +801 -0
- package/package.json +10 -5
- package/skills/search/SKILL.md +72 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import type { McpCallToolResult } from "./mcp.js";
|
|
2
|
+
/**
|
|
3
|
+
* The search provider contract this host implements. A provider module, and
|
|
4
|
+
* the package that exports them, declare the version they were written
|
|
5
|
+
* against, and the host refuses one that differs; bump it on any breaking
|
|
6
|
+
* change to `SearchProviderModule` or the types it uses.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SEARCH_PROVIDER_API_VERSION: 1;
|
|
9
|
+
/** The providers `web_search` knows, by the id a call names. */
|
|
10
|
+
export declare const SEARCH_PROVIDER_IDS: readonly ["tavily", "parallel", "exa", "keenable", "perplexity", "brave"];
|
|
11
|
+
export type SearchProviderId = (typeof SEARCH_PROVIDER_IDS)[number];
|
|
12
|
+
/** One quality scale for every provider; each maps it to its own setting. */
|
|
13
|
+
export declare const SEARCH_MODES: readonly ["fast", "default", "deep"];
|
|
14
|
+
export type SearchMode = (typeof SEARCH_MODES)[number];
|
|
15
|
+
export declare const SEARCH_FRESHNESS: readonly ["day", "week", "month", "year"];
|
|
16
|
+
export type SearchFreshness = (typeof SEARCH_FRESHNESS)[number];
|
|
17
|
+
/**
|
|
18
|
+
* `snippets`: a short excerpt per result. `context`: extracted, query-relevant
|
|
19
|
+
* page text for grounding (Brave's LLM Context, others' text or highlights).
|
|
20
|
+
*/
|
|
21
|
+
export declare const SEARCH_CONTENT: readonly ["snippets", "context"];
|
|
22
|
+
export type SearchContent = (typeof SEARCH_CONTENT)[number];
|
|
23
|
+
export declare const SEARCH_MAX_RESULTS = 10;
|
|
24
|
+
export declare const SEARCH_DEFAULT_RESULTS = 5;
|
|
25
|
+
/** Characters kept per result for each content level. */
|
|
26
|
+
export declare const SEARCH_CONTENT_CHARS: Readonly<Record<SearchContent, number>>;
|
|
27
|
+
/** The arguments a call may set, beyond the query, provider and mode. */
|
|
28
|
+
export declare const SEARCH_OPTIONS: readonly ["freshness", "include_sites", "exclude_sites", "context", "country"];
|
|
29
|
+
export type SearchOption = (typeof SEARCH_OPTIONS)[number];
|
|
30
|
+
/**
|
|
31
|
+
* How a provider serves an argument: `native` maps it to the provider's own
|
|
32
|
+
* parameter with the same meaning, `approximate` to something close (the
|
|
33
|
+
* descriptor's note says what), `none` cannot serve it.
|
|
34
|
+
*/
|
|
35
|
+
export type SearchSupport = "native" | "approximate" | "none";
|
|
36
|
+
export interface SearchModeMapping {
|
|
37
|
+
/** The provider's own value for this mode (Tavily `advanced`, Exa `auto`). */
|
|
38
|
+
setting: string;
|
|
39
|
+
/** Set when the provider has no setting that means this mode: what it does instead. */
|
|
40
|
+
approximate?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface SearchCapabilities {
|
|
43
|
+
modes: Readonly<Record<SearchMode, SearchModeMapping>>;
|
|
44
|
+
/** The provider parameter `modes` sets, for docs and traces. */
|
|
45
|
+
mode_parameter: string;
|
|
46
|
+
/** The most results one request returns. */
|
|
47
|
+
max_results: number;
|
|
48
|
+
options: Readonly<Record<SearchOption, SearchSupport>>;
|
|
49
|
+
/** The ISO 3166-1 alpha-2 codes `country` accepts, where the provider names a closed set. */
|
|
50
|
+
countries?: readonly string[];
|
|
51
|
+
/**
|
|
52
|
+
* Whether one request may carry both included and excluded sites. When it
|
|
53
|
+
* may not (Perplexity answers 400, Parallel drops the exclusions), a call
|
|
54
|
+
* with both sends only the included sites and notes the rest as ignored.
|
|
55
|
+
*/
|
|
56
|
+
combine_sites: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The most sites a request may restrict to, where the provider takes fewer
|
|
59
|
+
* than a call may list (Keenable takes one): the first are sent, and the
|
|
60
|
+
* rest noted as ignored.
|
|
61
|
+
*/
|
|
62
|
+
max_include_sites?: number;
|
|
63
|
+
/** One sentence per approximated option, saying what it becomes. */
|
|
64
|
+
notes?: Partial<Record<SearchOption, string>>;
|
|
65
|
+
/** The longest query the provider accepts, in characters and in words, where it states one. */
|
|
66
|
+
max_query_chars?: number;
|
|
67
|
+
max_query_words?: number;
|
|
68
|
+
/** The host the provider calls: the endpoint the runtime must bind. */
|
|
69
|
+
host: string;
|
|
70
|
+
/** The header the provider's key travels in, and its prefix. */
|
|
71
|
+
credential: {
|
|
72
|
+
header: string;
|
|
73
|
+
prefix?: string;
|
|
74
|
+
};
|
|
75
|
+
/** How the provider bills a request, per setting where it differs. */
|
|
76
|
+
billing: string;
|
|
77
|
+
}
|
|
78
|
+
/** One call, normalized: options the provider cannot serve already removed. */
|
|
79
|
+
export interface SearchRequest {
|
|
80
|
+
query: string;
|
|
81
|
+
mode: SearchMode;
|
|
82
|
+
/** `capabilities.modes[mode].setting`. */
|
|
83
|
+
setting: string;
|
|
84
|
+
max_results: number;
|
|
85
|
+
freshness?: SearchFreshness;
|
|
86
|
+
include_sites: string[];
|
|
87
|
+
exclude_sites: string[];
|
|
88
|
+
content: SearchContent;
|
|
89
|
+
/** Characters to keep per result. */
|
|
90
|
+
max_chars: number;
|
|
91
|
+
/** ISO 3166-1 alpha-2, upper case: results for this country. */
|
|
92
|
+
country?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Stable across the calls of one `createWebSearch`, the task it serves, for
|
|
95
|
+
* providers that group or rate-limit by session. Never the task id.
|
|
96
|
+
*/
|
|
97
|
+
session: string;
|
|
98
|
+
}
|
|
99
|
+
export interface SearchResultItem {
|
|
100
|
+
url: string;
|
|
101
|
+
title?: string;
|
|
102
|
+
snippet?: string;
|
|
103
|
+
published_at?: string;
|
|
104
|
+
score?: number;
|
|
105
|
+
site?: string;
|
|
106
|
+
}
|
|
107
|
+
export interface SearchNote {
|
|
108
|
+
option: SearchOption | "max_results" | "mode";
|
|
109
|
+
outcome: "ignored" | "approximated";
|
|
110
|
+
detail: string;
|
|
111
|
+
}
|
|
112
|
+
export interface SearchUnits {
|
|
113
|
+
name: string;
|
|
114
|
+
count: number;
|
|
115
|
+
}
|
|
116
|
+
/** What a provider returns for one request. */
|
|
117
|
+
export interface SearchProviderResult {
|
|
118
|
+
results: SearchResultItem[];
|
|
119
|
+
/** Billing units the provider reported (credits, dollars), if any. */
|
|
120
|
+
units?: SearchUnits;
|
|
121
|
+
}
|
|
122
|
+
export type SearchFetch = (input: string, init?: {
|
|
123
|
+
method?: string;
|
|
124
|
+
headers?: Record<string, string>;
|
|
125
|
+
body?: string;
|
|
126
|
+
signal?: AbortSignal;
|
|
127
|
+
}) => Promise<{
|
|
128
|
+
ok: boolean;
|
|
129
|
+
status: number;
|
|
130
|
+
headers: {
|
|
131
|
+
get(name: string): string | null;
|
|
132
|
+
};
|
|
133
|
+
json(): Promise<unknown>;
|
|
134
|
+
text(): Promise<string>;
|
|
135
|
+
}>;
|
|
136
|
+
/** What the host hands a provider for each request. */
|
|
137
|
+
export interface SearchCallContext {
|
|
138
|
+
/**
|
|
139
|
+
* Sends one JSON request to `path` on the provider's host, with the
|
|
140
|
+
* credential its egress lane needs, and throws `SearchProviderError` for a
|
|
141
|
+
* failure (429 with its retry delay, 401, 402, 5xx…). Resolves to the
|
|
142
|
+
* parsed body.
|
|
143
|
+
*/
|
|
144
|
+
request(path: string, init: {
|
|
145
|
+
method: "GET" | "POST";
|
|
146
|
+
body?: unknown;
|
|
147
|
+
headers?: Record<string, string>;
|
|
148
|
+
}): Promise<unknown>;
|
|
149
|
+
now: () => Date;
|
|
150
|
+
signal?: AbortSignal;
|
|
151
|
+
}
|
|
152
|
+
export declare const SEARCH_ERROR_CODES: readonly ["not_bound", "not_configured", "out_of_credit", "invalid_request", "query_too_long", "max_uses_exceeded", "too_many_requests", "unavailable", "provider_error"];
|
|
153
|
+
export type SearchErrorCode = (typeof SEARCH_ERROR_CODES)[number];
|
|
154
|
+
export interface SearchErrorInfo {
|
|
155
|
+
code: SearchErrorCode;
|
|
156
|
+
message: string;
|
|
157
|
+
status?: number;
|
|
158
|
+
retry_after_seconds?: number;
|
|
159
|
+
/** For `query_too_long` and `max_uses_exceeded`: the limit the call passed. */
|
|
160
|
+
limit?: number;
|
|
161
|
+
}
|
|
162
|
+
/** Thrown by a provider (or the host) to report a typed failure. */
|
|
163
|
+
export declare class SearchProviderError extends Error {
|
|
164
|
+
readonly search: SearchErrorInfo;
|
|
165
|
+
constructor(info: SearchErrorInfo);
|
|
166
|
+
}
|
|
167
|
+
/** How one request maps onto a provider's MCP tool. */
|
|
168
|
+
export interface SearchMcpPlan {
|
|
169
|
+
tool: string;
|
|
170
|
+
args: Record<string, unknown>;
|
|
171
|
+
/** What the tool cannot express; with REST bound too, the call goes to REST instead. */
|
|
172
|
+
unsupported: Array<SearchOption | "mode">;
|
|
173
|
+
/**
|
|
174
|
+
* The provider setting the tool runs, when it is not the mode's: its fixed
|
|
175
|
+
* setting, or null when the server picks one it does not report.
|
|
176
|
+
*/
|
|
177
|
+
setting?: string | null;
|
|
178
|
+
}
|
|
179
|
+
/** A provider's hosted MCP server, which `web_search` prefers to its REST API. */
|
|
180
|
+
export interface SearchMcpAdapter {
|
|
181
|
+
/** The provider's hosted server, for docs and bindings; the bound URL may differ. */
|
|
182
|
+
url: string;
|
|
183
|
+
/** The header its key travels in, injected by the egress like a REST key. */
|
|
184
|
+
credential: {
|
|
185
|
+
header: string;
|
|
186
|
+
prefix?: string;
|
|
187
|
+
};
|
|
188
|
+
/** The tools it may call, in order of preference. */
|
|
189
|
+
tools: readonly string[];
|
|
190
|
+
/** The call for this request, given the tools the bound server offers; undefined when it offers none of them. */
|
|
191
|
+
plan(request: SearchRequest, hasTool: (tool: string) => boolean, now: Date): SearchMcpPlan | undefined;
|
|
192
|
+
/** An error it throws that is not a `SearchProviderError` is reported as `provider_error`. */
|
|
193
|
+
parse(result: McpCallToolResult, request: SearchRequest, plan: SearchMcpPlan): SearchProviderResult;
|
|
194
|
+
}
|
|
195
|
+
/** A search provider: a descriptor, its REST call and, optionally, its MCP server. */
|
|
196
|
+
export interface SearchProviderModule {
|
|
197
|
+
kind: "search";
|
|
198
|
+
apiVersion: typeof SEARCH_PROVIDER_API_VERSION;
|
|
199
|
+
id: SearchProviderId;
|
|
200
|
+
capabilities: SearchCapabilities;
|
|
201
|
+
mcp?: SearchMcpAdapter;
|
|
202
|
+
search(request: SearchRequest, context: SearchCallContext): Promise<SearchProviderResult>;
|
|
203
|
+
}
|
|
204
|
+
export type SearchProviders = Readonly<Partial<Record<SearchProviderId, SearchProviderModule>>>;
|
|
205
|
+
/**
|
|
206
|
+
* What a search provider package exports as its default
|
|
207
|
+
* (`@introspection-ai/recipe-search`): its providers by id. It needs no
|
|
208
|
+
* run-time import of `@introspection-ai/recipes`, only these types.
|
|
209
|
+
*/
|
|
210
|
+
export interface RecipeSearchModule {
|
|
211
|
+
kind: "search";
|
|
212
|
+
apiVersion: typeof SEARCH_PROVIDER_API_VERSION;
|
|
213
|
+
providers: SearchProviders;
|
|
214
|
+
}
|
|
215
|
+
/** The arguments of one call, from the model or from Recipe code. */
|
|
216
|
+
export interface WebSearchArgs {
|
|
217
|
+
query: string;
|
|
218
|
+
provider?: SearchProviderId;
|
|
219
|
+
mode?: SearchMode;
|
|
220
|
+
max_results?: number;
|
|
221
|
+
freshness?: SearchFreshness;
|
|
222
|
+
/** `"arxiv.org"` restricts to a site; `"-pinterest.com"` excludes one. */
|
|
223
|
+
sites?: string[];
|
|
224
|
+
/** ISO 3166-1 alpha-2 (`"US"`, `"DE"`): results for that country. */
|
|
225
|
+
country?: string;
|
|
226
|
+
content?: SearchContent;
|
|
227
|
+
}
|
|
228
|
+
/** One call's structured result, for the host and its trace; the model reads text. */
|
|
229
|
+
export interface WebSearchResult {
|
|
230
|
+
results: SearchResultItem[];
|
|
231
|
+
provider: SearchProviderId;
|
|
232
|
+
mode: SearchMode;
|
|
233
|
+
/**
|
|
234
|
+
* The provider's own setting that ran: the mode's, unless an MCP tool ran
|
|
235
|
+
* its own; null when the server does not report which.
|
|
236
|
+
*/
|
|
237
|
+
setting: string | null;
|
|
238
|
+
/** Whether the provider's MCP server or its REST API served the call. */
|
|
239
|
+
transport: "mcp" | "rest";
|
|
240
|
+
content: SearchContent;
|
|
241
|
+
notes: SearchNote[];
|
|
242
|
+
usage: {
|
|
243
|
+
requests: number;
|
|
244
|
+
units?: SearchUnits;
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/search/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAG,CAAU,CAAC;AAEtD,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,YAC9B,QAAQ,EACR,UAAU,EACV,KAAK,EACL,UAAU,EACV,YAAY,EACZ,OAAO,CACC,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,6EAA6E;AAC7E,eAAO,MAAM,YAAY,YAAI,MAAM,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC;AACjE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,gBAAgB,YAAI,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AAC1E,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,cAAc,YAAI,UAAU,EAAE,SAAS,CAAU,CAAC;AAC/D,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K,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,WAAW,CAAA;KAAE,CAAC;CAClD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The search provider contract this host implements. A provider module, and
|
|
3
|
+
* the package that exports them, declare the version they were written
|
|
4
|
+
* against, and the host refuses one that differs; bump it on any breaking
|
|
5
|
+
* change to `SearchProviderModule` or the types it uses.
|
|
6
|
+
*/
|
|
7
|
+
export const SEARCH_PROVIDER_API_VERSION = 1;
|
|
8
|
+
/** The providers `web_search` knows, by the id a call names. */
|
|
9
|
+
export const SEARCH_PROVIDER_IDS = [
|
|
10
|
+
"tavily",
|
|
11
|
+
"parallel",
|
|
12
|
+
"exa",
|
|
13
|
+
"keenable",
|
|
14
|
+
"perplexity",
|
|
15
|
+
"brave",
|
|
16
|
+
];
|
|
17
|
+
/** One quality scale for every provider; each maps it to its own setting. */
|
|
18
|
+
export const SEARCH_MODES = ["fast", "default", "deep"];
|
|
19
|
+
export const SEARCH_FRESHNESS = ["day", "week", "month", "year"];
|
|
20
|
+
/**
|
|
21
|
+
* `snippets`: a short excerpt per result. `context`: extracted, query-relevant
|
|
22
|
+
* page text for grounding (Brave's LLM Context, others' text or highlights).
|
|
23
|
+
*/
|
|
24
|
+
export const SEARCH_CONTENT = ["snippets", "context"];
|
|
25
|
+
export const SEARCH_MAX_RESULTS = 10;
|
|
26
|
+
export const SEARCH_DEFAULT_RESULTS = 5;
|
|
27
|
+
/** Characters kept per result for each content level. */
|
|
28
|
+
export const SEARCH_CONTENT_CHARS = {
|
|
29
|
+
snippets: 300,
|
|
30
|
+
context: 1500,
|
|
31
|
+
};
|
|
32
|
+
/** The arguments a call may set, beyond the query, provider and mode. */
|
|
33
|
+
export const SEARCH_OPTIONS = [
|
|
34
|
+
"freshness",
|
|
35
|
+
"include_sites",
|
|
36
|
+
"exclude_sites",
|
|
37
|
+
"context",
|
|
38
|
+
"country",
|
|
39
|
+
];
|
|
40
|
+
export const SEARCH_ERROR_CODES = [
|
|
41
|
+
"not_bound",
|
|
42
|
+
"not_configured",
|
|
43
|
+
"out_of_credit",
|
|
44
|
+
"invalid_request",
|
|
45
|
+
"query_too_long",
|
|
46
|
+
"max_uses_exceeded",
|
|
47
|
+
"too_many_requests",
|
|
48
|
+
"unavailable",
|
|
49
|
+
"provider_error",
|
|
50
|
+
];
|
|
51
|
+
/** Thrown by a provider (or the host) to report a typed failure. */
|
|
52
|
+
export class SearchProviderError extends Error {
|
|
53
|
+
search;
|
|
54
|
+
constructor(info) {
|
|
55
|
+
super(info.message);
|
|
56
|
+
this.name = "SearchProviderError";
|
|
57
|
+
this.search = info;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/search/types.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAU,CAAC;AAEtD,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ;IACR,UAAU;IACV,KAAK;IACL,UAAU;IACV,YAAY;IACZ,OAAO;CACC,CAAC;AAGX,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC;AAGjE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC;AAG1E;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,SAAS,CAAU,CAAC;AAG/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAA4C;IAC3E,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,IAAI;CACd,CAAC;AAEF,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,WAAW;IACX,eAAe;IACf,eAAe;IACf,SAAS;IACT,SAAS;CACD,CAAC;AAwIX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,WAAW;IACX,gBAAgB;IAChB,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,mBAAmB;IACnB,aAAa;IACb,gBAAgB;CACR,CAAC;AAYX,oEAAoE;AACpE,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACnC,MAAM,CAAkB;IACjC,YAAY,IAAqB;QAC/B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;CACF"}
|
package/docs/README.md
CHANGED
|
@@ -26,6 +26,7 @@ at run time.
|
|
|
26
26
|
| Add Slack tools to a Recipe | [Slack channel connector](channels/slack.md) |
|
|
27
27
|
| Read and mark up Word and PDF files from a Recipe | [Document tools](documents/README.md) |
|
|
28
28
|
| Work with a person's mail, calendar and files | [Productivity tools](productivity/README.md) |
|
|
29
|
+
| Search the web from a Recipe | [Web search](search/README.md) |
|
|
29
30
|
| Define portable evaluation judges | [Recipe judges](recipe-judges.md) |
|
|
30
31
|
|
|
31
32
|
## Boundary
|
|
@@ -147,7 +147,8 @@ derived agent. Every resolved agent owns its mode independently.
|
|
|
147
147
|
|
|
148
148
|
A server can sit behind one of the agent's own tools, so the model sees that
|
|
149
149
|
one stable tool and the Recipe can change or compare the providers behind it.
|
|
150
|
-
The productivity tools (`mail`, `calendar`, `drive`) work this way
|
|
150
|
+
The productivity tools (`mail`, `calendar`, `drive`) work this way, as does
|
|
151
|
+
`web_search` with its providers' servers ([Web search](search/README.md#declare-the-servers)):
|
|
151
152
|
|
|
152
153
|
```yaml
|
|
153
154
|
tools: [mail]
|