@fungi.computer/forage 0.0.0-stage → 0.0.1

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,341 @@
1
+ import { z } from "zod";
2
+ import { ForageError } from "./errors.js";
3
+ import { canonicalStringify, compareCodeUnits, isJsonObject, jsonValueSchema, } from "./normalization.js";
4
+ import { maximumSampleBytes, maximumSampleDepth, maximumSampleEntries, } from "./schemas.js";
5
+ const schemaNode = z.lazy(() => z.union([
6
+ z.boolean(),
7
+ z.looseObject({
8
+ $ref: z.string().optional(),
9
+ $defs: z.record(z.string(), schemaNode).optional(),
10
+ definitions: z.record(z.string(), schemaNode).optional(),
11
+ const: z.unknown().optional(),
12
+ enum: z.array(z.unknown()).optional(),
13
+ oneOf: z.array(schemaNode).optional(),
14
+ anyOf: z.array(schemaNode).optional(),
15
+ allOf: z.array(schemaNode).optional(),
16
+ type: z.union([z.string(), z.array(z.string())]).optional(),
17
+ properties: z.record(z.string(), schemaNode).optional(),
18
+ additionalProperties: schemaNode.optional(),
19
+ required: z.array(z.string()).optional(),
20
+ prefixItems: z.array(schemaNode).optional(),
21
+ items: z.union([schemaNode, z.array(schemaNode)]).optional(),
22
+ examples: z.array(z.unknown()).optional(),
23
+ default: z.unknown().optional(),
24
+ }),
25
+ ]));
26
+ /**
27
+ * Facts already derived, per schema object and direction. A Standard JSON
28
+ * Schema describes an immutable schema, so its projection is a pure function
29
+ * of the object: compiling a catalog asks for the same projection several
30
+ * times per operation (size, fingerprint, sample, rendering), and a host that
31
+ * recompiles a catalog over the same installed schemas asks again on every
32
+ * compile. Projecting, validating, fingerprinting and sizing once per schema
33
+ * keeps catalog compilation proportional to what actually changed.
34
+ */
35
+ const schemaFacts = new WeakMap();
36
+ function factsFor(schema, io) {
37
+ let entry = schemaFacts.get(schema);
38
+ const cached = entry?.[io];
39
+ if (cached !== undefined)
40
+ return cached;
41
+ let node;
42
+ try {
43
+ node = schemaNode.parse(schema["~standard"].jsonSchema[io]({ target: "draft-2020-12" }));
44
+ }
45
+ catch {
46
+ throw new ForageError("invalid_input", "Schema cannot be projected to JSON Schema");
47
+ }
48
+ const json = jsonValueSchema.safeParse(node);
49
+ const facts = {
50
+ node,
51
+ json: json.success ? json.data : undefined,
52
+ };
53
+ if (entry === undefined) {
54
+ entry = {};
55
+ schemaFacts.set(schema, entry);
56
+ }
57
+ entry[io] = facts;
58
+ return facts;
59
+ }
60
+ function schemaFor(schema, io) {
61
+ return factsFor(schema, io).node;
62
+ }
63
+ function isNodeList(value) {
64
+ return Array.isArray(value);
65
+ }
66
+ /** Bounds the work and size of expanding shared `$defs` in one description. */
67
+ const maximumReferenceExpansions = 256;
68
+ const localReference = /^#\/(?:\$defs|definitions)\/([^/]+)$/u;
69
+ /** Expand a local `$ref` in place; a recursive reference renders `unknown`. */
70
+ function renderReference(reference, depth, refs) {
71
+ const name = localReference.exec(reference)?.[1];
72
+ if (name === undefined || refs.expanding.has(name))
73
+ return "unknown";
74
+ const target = refs.definitions[name];
75
+ if (target === undefined)
76
+ return "unknown";
77
+ refs.budget.expansions += 1;
78
+ if (refs.budget.expansions > maximumReferenceExpansions)
79
+ throw new ForageError("invalid_input", `Schema references expand more than ${String(maximumReferenceExpansions)} times; flatten its shared definitions`);
80
+ return renderNode(target, depth, {
81
+ definitions: refs.definitions,
82
+ expanding: new Set([...refs.expanding, name]),
83
+ budget: refs.budget,
84
+ });
85
+ }
86
+ /** Whether a node renders as a top-level TypeScript union. */
87
+ function rendersUnion(node, refs) {
88
+ if (node === true || node === false)
89
+ return false;
90
+ if (node.$ref !== undefined) {
91
+ const name = localReference.exec(node.$ref)?.[1];
92
+ const target = name === undefined || refs.expanding.has(name)
93
+ ? undefined
94
+ : refs.definitions[name];
95
+ return (name !== undefined &&
96
+ target !== undefined &&
97
+ rendersUnion(target, {
98
+ definitions: refs.definitions,
99
+ expanding: new Set([...refs.expanding, name]),
100
+ budget: refs.budget,
101
+ }));
102
+ }
103
+ if (node.const !== undefined)
104
+ return false;
105
+ return ((node.enum !== undefined && node.enum.length > 1) ||
106
+ (node.oneOf !== undefined && node.oneOf.length > 1) ||
107
+ (node.anyOf !== undefined && node.anyOf.length > 1));
108
+ }
109
+ function renderNode(node, depth, refs) {
110
+ if (node === undefined || node === true || node === false || depth > 12) {
111
+ return "unknown";
112
+ }
113
+ if (node.$ref)
114
+ return renderReference(node.$ref, depth, refs);
115
+ if (node.const !== undefined)
116
+ return JSON.stringify(node.const);
117
+ if (node.enum)
118
+ return node.enum.map((value) => JSON.stringify(value)).join(" | ");
119
+ if (node.oneOf) {
120
+ return node.oneOf
121
+ .map((value) => renderNode(value, depth + 1, refs))
122
+ .join(" | ");
123
+ }
124
+ if (node.anyOf) {
125
+ return node.anyOf
126
+ .map((value) => renderNode(value, depth + 1, refs))
127
+ .join(" | ");
128
+ }
129
+ if (node.allOf) {
130
+ return node.allOf
131
+ .map((value) => {
132
+ const member = renderNode(value, depth + 1, refs);
133
+ // `&` binds tighter than `|`: keep a union member whole.
134
+ return rendersUnion(value, refs) ? `(${member})` : member;
135
+ })
136
+ .join(" & ");
137
+ }
138
+ if (node.type === "object" || node.properties) {
139
+ const properties = Object.entries(node.properties ?? {}).sort(([left], [right]) => compareCodeUnits(left, right));
140
+ if (properties.length === 0) {
141
+ const additional = node.additionalProperties;
142
+ if (additional === false)
143
+ return "Record<string, never>";
144
+ if (additional && additional !== true) {
145
+ return `Record<string, ${renderNode(additional, depth + 1, refs)}>`;
146
+ }
147
+ return "Record<string, unknown>";
148
+ }
149
+ const required = new Set(node.required ?? []);
150
+ const lines = properties.map(([key, value]) => {
151
+ const child = renderNode(value, depth + 1, refs);
152
+ const optional = required.has(key) ? "" : "?";
153
+ const safeKey = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key)
154
+ ? key
155
+ : JSON.stringify(key);
156
+ return `${" ".repeat(depth + 1)}${safeKey}${optional}: ${child};`;
157
+ });
158
+ return `{
159
+ ${lines.join("\n")}
160
+ ${" ".repeat(depth)}}`;
161
+ }
162
+ if (node.type === "array") {
163
+ const items = node.items;
164
+ if (node.prefixItems && node.prefixItems.length > 0) {
165
+ const tuple = node.prefixItems.map((value) => renderNode(value, depth + 1, refs));
166
+ if (items !== undefined && items !== true && !isNodeList(items)) {
167
+ tuple.push(`...${renderNode(items, depth + 1, refs)}[]`);
168
+ }
169
+ return `[${tuple.join(", ")}]`;
170
+ }
171
+ if (items !== undefined && isNodeList(items))
172
+ return `[${items.map((value) => renderNode(value, depth + 1, refs)).join(", ")}][]`;
173
+ const item = renderNode(items, depth + 1, refs);
174
+ const compoundItem = items !== undefined &&
175
+ items !== true &&
176
+ items !== false &&
177
+ (items.oneOf !== undefined ||
178
+ items.anyOf !== undefined ||
179
+ items.allOf !== undefined);
180
+ return `${compoundItem ? `(${item})` : item}[]`;
181
+ }
182
+ switch (node.type) {
183
+ case "string":
184
+ return "string";
185
+ case "number":
186
+ case "integer":
187
+ return "number";
188
+ case "boolean":
189
+ return "boolean";
190
+ case "null":
191
+ return "null";
192
+ default:
193
+ return "unknown";
194
+ }
195
+ }
196
+ /** Render one schema's JSON Schema as deterministic TypeScript type text. */
197
+ function renderSchemaType(schema, io = "input") {
198
+ const root = schemaFor(schema, io);
199
+ const definitions = root === true || root === false
200
+ ? {}
201
+ : { ...root.definitions, ...root.$defs };
202
+ return renderNode(root, 0, {
203
+ definitions,
204
+ expanding: new Set(),
205
+ budget: { expansions: 0 },
206
+ });
207
+ }
208
+ function safeTypeName(name) {
209
+ return name.replace(/[^A-Za-z0-9_$]/g, "_");
210
+ }
211
+ /** A quoted property tree also supports namespace segments that are TS keywords. */
212
+ function renderEnvironment(path, input, output) {
213
+ let declaration = `(input: ${input}) => Promise<${output}>`;
214
+ for (const segment of path.split(".").reverse())
215
+ declaration = `{ [${JSON.stringify(segment)}]: ${declaration} }`;
216
+ return declaration;
217
+ }
218
+ /** Render a namespace index as a callable nested environment. */
219
+ export function renderNamespaceIndex(operations) {
220
+ return operations.length === 0
221
+ ? ""
222
+ : `export declare const env: ${operations.map((operation) => operation.indexEnvironment).join(" & ")};`;
223
+ }
224
+ /** Render whole-operation schemas and their callable nested environment. */
225
+ export function renderOperationTypes(operations) {
226
+ const types = operations.map((operation) => operation.types).join("\n\n");
227
+ return operations.length === 0
228
+ ? types
229
+ : `${types}\nexport declare const env: ${operations.map((operation) => operation.environment).join(" & ")};`;
230
+ }
231
+ /** Prepare all TypeScript descriptions for one operation at installation. */
232
+ export function renderOperation(operation) {
233
+ const name = safeTypeName(operation.path.replace(/\./g, "$"));
234
+ const input = renderSchemaType(operation.input, "input");
235
+ const output = operation.output
236
+ ? renderSchemaType(operation.output, "output")
237
+ : "unknown";
238
+ return Object.freeze({
239
+ indexEnvironment: renderEnvironment(operation.path, input, output),
240
+ environment: renderEnvironment(operation.path, `${name}_Input`, `${name}_Output`),
241
+ types: `export type ${name}_Input = ${input};\nexport type ${name}_Output = ${output};`,
242
+ });
243
+ }
244
+ /** Derive sample arguments solely from input-schema examples and defaults. */
245
+ export function deriveSample(schema) {
246
+ const node = schemaFor(schema, "input");
247
+ if (node === true || node === false || !node.properties) {
248
+ return undefined;
249
+ }
250
+ const properties = node.properties;
251
+ const sample = {};
252
+ let found = false;
253
+ const entries = Object.entries(properties).sort(([left], [right]) => compareCodeUnits(left, right));
254
+ for (const [key, value] of entries) {
255
+ if (value === true || value === false)
256
+ continue;
257
+ const property = value;
258
+ const examples = property.examples;
259
+ if (examples && examples.length > 0) {
260
+ const example = jsonValueSchema.safeParse(examples[0]);
261
+ if (example.success) {
262
+ sample[key] = example.data;
263
+ found = true;
264
+ }
265
+ }
266
+ else if (property.default !== undefined) {
267
+ const fallback = jsonValueSchema.safeParse(property.default);
268
+ if (fallback.success) {
269
+ sample[key] = fallback.data;
270
+ found = true;
271
+ }
272
+ }
273
+ }
274
+ return found ? sample : undefined;
275
+ }
276
+ /** Preserve validator constraints in the operation's Standard JSON Schema. */
277
+ export function inputSchemaProjection(schema) {
278
+ const projection = factsFor(schema, "input").json;
279
+ if (projection === undefined) {
280
+ throw new ForageError("invalid_input", "Schema cannot be projected to JSON Schema");
281
+ }
282
+ return projection;
283
+ }
284
+ /** Produce a canonical schema representation used in peer identity and stamps. */
285
+ export function schemaFingerprint(schema, io = "input") {
286
+ const facts = factsFor(schema, io);
287
+ facts.fingerprint ??= canonicalStringify(facts.json ?? null);
288
+ return facts.fingerprint;
289
+ }
290
+ function schemaDepth(value, depth) {
291
+ if (depth > maximumSampleDepth)
292
+ return depth;
293
+ if (Array.isArray(value)) {
294
+ let maximum = depth;
295
+ for (const item of value) {
296
+ maximum = Math.max(maximum, schemaDepth(item, depth + 1));
297
+ }
298
+ return maximum;
299
+ }
300
+ if (!isJsonObject(value))
301
+ return depth;
302
+ let maximum = depth;
303
+ for (const entry of Object.values(value)) {
304
+ maximum = Math.max(maximum, schemaDepth(entry, depth + 1));
305
+ }
306
+ return maximum;
307
+ }
308
+ /** Validate the bounded JSON projection before a catalog is installed. */
309
+ export function schemaProjectionSize(schema, io) {
310
+ const facts = factsFor(schema, io);
311
+ facts.size ??= { bytes: measureProjection(schema, io, facts.json) };
312
+ return facts.size.bytes;
313
+ }
314
+ function measureProjection(schema, io, projection) {
315
+ if (!projection)
316
+ return undefined;
317
+ const encoded = JSON.stringify(projection);
318
+ if (encoded.length > 20_000 ||
319
+ schemaDepth(projection, 0) > maximumSampleDepth) {
320
+ return undefined;
321
+ }
322
+ if (io === "output")
323
+ return encoded.length;
324
+ const sample = deriveSample(schema);
325
+ if (!sample)
326
+ return encoded.length;
327
+ if (Object.keys(sample).length > maximumSampleEntries ||
328
+ schemaDepth(sample, 0) > maximumSampleDepth) {
329
+ return undefined;
330
+ }
331
+ let sampleText;
332
+ try {
333
+ sampleText = JSON.stringify(sample);
334
+ }
335
+ catch {
336
+ throw new ForageError("invalid_input", "Derived schema sample cannot be serialized");
337
+ }
338
+ if (!sampleText || sampleText.length > maximumSampleBytes)
339
+ return undefined;
340
+ return encoded.length + sampleText.length;
341
+ }
@@ -0,0 +1,231 @@
1
+ import { z } from "zod";
2
+ export declare const maximumDescriptionTypes = 20000;
3
+ export declare const maximumSampleEntries = 100;
4
+ export declare const maximumSampleBytes = 4000;
5
+ export declare const maximumSampleDepth = 16;
6
+ /** Input accepted by the pure catalog search seam. */
7
+ export declare const forageSearchInput: z.ZodObject<{
8
+ query: z.ZodString;
9
+ maxResults: z.ZodDefault<z.ZodNumber>;
10
+ }, z.core.$strip>;
11
+ /** Input accepted by the pure catalog description seam. */
12
+ export declare const forageDescribeInput: z.ZodObject<{
13
+ path: z.ZodString;
14
+ detail: z.ZodDefault<z.ZodEnum<{
15
+ index: "index";
16
+ full: "full";
17
+ }>>;
18
+ methods: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ }, z.core.$strip>;
20
+ /** Exhaustive listing request; cursor is scoped to one immutable catalog and filter. */
21
+ export declare const forageListInput: z.ZodObject<{
22
+ cursor: z.ZodOptional<z.ZodString>;
23
+ limit: z.ZodDefault<z.ZodNumber>;
24
+ namespace: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>;
26
+ /** One ranked operation in a search response. */
27
+ export declare const searchResultSchema: z.ZodObject<{
28
+ path: z.ZodString;
29
+ description: z.ZodOptional<z.ZodString>;
30
+ score: z.ZodNumber;
31
+ matchReason: z.ZodOptional<z.ZodString>;
32
+ sample: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
33
+ capabilityNotes: z.ZodOptional<z.ZodString>;
34
+ peers: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ path: z.ZodString;
36
+ capabilityNotes: z.ZodOptional<z.ZodString>;
37
+ }, z.core.$strip>>>;
38
+ }, z.core.$strip>;
39
+ /** Bounded search response envelope. */
40
+ export declare const searchOutputSchema: z.ZodObject<{
41
+ results: z.ZodArray<z.ZodObject<{
42
+ path: z.ZodString;
43
+ description: z.ZodOptional<z.ZodString>;
44
+ score: z.ZodNumber;
45
+ matchReason: z.ZodOptional<z.ZodString>;
46
+ sample: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
47
+ capabilityNotes: z.ZodOptional<z.ZodString>;
48
+ peers: z.ZodOptional<z.ZodArray<z.ZodObject<{
49
+ path: z.ZodString;
50
+ capabilityNotes: z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strip>>>;
52
+ }, z.core.$strip>>;
53
+ total: z.ZodNumber;
54
+ truncated: z.ZodBoolean;
55
+ topScore: z.ZodNumber;
56
+ margin: z.ZodNumber;
57
+ catalogStamp: z.ZodString;
58
+ }, z.core.$strip>;
59
+ /** One exhaustive page, using the exact search operation summary schema. */
60
+ export declare const listOutputSchema: z.ZodObject<{
61
+ results: z.ZodArray<z.ZodObject<{
62
+ path: z.ZodString;
63
+ description: z.ZodOptional<z.ZodString>;
64
+ score: z.ZodNumber;
65
+ matchReason: z.ZodOptional<z.ZodString>;
66
+ sample: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
67
+ capabilityNotes: z.ZodOptional<z.ZodString>;
68
+ peers: z.ZodOptional<z.ZodArray<z.ZodObject<{
69
+ path: z.ZodString;
70
+ capabilityNotes: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strip>>>;
72
+ }, z.core.$strip>>;
73
+ total: z.ZodNumber;
74
+ nextCursor: z.ZodNullable<z.ZodString>;
75
+ catalogStamp: z.ZodString;
76
+ }, z.core.$strip>;
77
+ /** Deterministic description response. */
78
+ export declare const describeOutputSchema: z.ZodObject<{
79
+ path: z.ZodString;
80
+ description: z.ZodOptional<z.ZodString>;
81
+ types: z.ZodString;
82
+ inputSchema: z.ZodOptional<z.ZodJSONSchema>;
83
+ kind: z.ZodEnum<{
84
+ module: "module";
85
+ operation: "operation";
86
+ }>;
87
+ usage: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strip>;
89
+ /** Closed failure vocabulary for malformed or absent catalog requests. */
90
+ export declare const forageFailureSchema: z.ZodObject<{
91
+ code: z.ZodEnum<{
92
+ empty_query: "empty_query";
93
+ empty_catalog: "empty_catalog";
94
+ unknown_target: "unknown_target";
95
+ duplicate_operation: "duplicate_operation";
96
+ invalid_input: "invalid_input";
97
+ }>;
98
+ message: z.ZodString;
99
+ }, z.core.$strip>;
100
+ /** Options Forage passes when it asks a schema for its JSON Schema. */
101
+ export type JsonSchemaTarget = Readonly<{
102
+ target: "draft-2020-12";
103
+ }>;
104
+ /**
105
+ * Any schema that describes itself through Standard JSON Schema: Zod 4
106
+ * schemas natively, and Effect schemas through Mycelium. Forage only renders
107
+ * descriptions; validation stays with the schema's owner.
108
+ */
109
+ export type JsonSchemaSource = Readonly<{
110
+ "~standard": Readonly<{
111
+ jsonSchema: Readonly<{
112
+ /** JSON Schema of the value the operation accepts. */
113
+ input: (options: JsonSchemaTarget) => object;
114
+ /** JSON Schema of the value the operation returns. */
115
+ output: (options: JsonSchemaTarget) => object;
116
+ }>;
117
+ }>;
118
+ }>;
119
+ /** A secret-free, callback-free operation descriptor. */
120
+ export declare const operationSchema: z.ZodObject<{
121
+ path: z.ZodString;
122
+ description: z.ZodOptional<z.ZodString>;
123
+ input: z.ZodCustom<Readonly<{
124
+ "~standard": Readonly<{
125
+ jsonSchema: Readonly<{
126
+ /** JSON Schema of the value the operation accepts. */
127
+ input: (options: JsonSchemaTarget) => object;
128
+ /** JSON Schema of the value the operation returns. */
129
+ output: (options: JsonSchemaTarget) => object;
130
+ }>;
131
+ }>;
132
+ }>, Readonly<{
133
+ "~standard": Readonly<{
134
+ jsonSchema: Readonly<{
135
+ /** JSON Schema of the value the operation accepts. */
136
+ input: (options: JsonSchemaTarget) => object;
137
+ /** JSON Schema of the value the operation returns. */
138
+ output: (options: JsonSchemaTarget) => object;
139
+ }>;
140
+ }>;
141
+ }>>;
142
+ output: z.ZodOptional<z.ZodCustom<Readonly<{
143
+ "~standard": Readonly<{
144
+ jsonSchema: Readonly<{
145
+ /** JSON Schema of the value the operation accepts. */
146
+ input: (options: JsonSchemaTarget) => object;
147
+ /** JSON Schema of the value the operation returns. */
148
+ output: (options: JsonSchemaTarget) => object;
149
+ }>;
150
+ }>;
151
+ }>, Readonly<{
152
+ "~standard": Readonly<{
153
+ jsonSchema: Readonly<{
154
+ /** JSON Schema of the value the operation accepts. */
155
+ input: (options: JsonSchemaTarget) => object;
156
+ /** JSON Schema of the value the operation returns. */
157
+ output: (options: JsonSchemaTarget) => object;
158
+ }>;
159
+ }>;
160
+ }>>>;
161
+ capabilityNotes: z.ZodOptional<z.ZodString>;
162
+ instructions: z.ZodOptional<z.ZodString>;
163
+ }, z.core.$strip>;
164
+ /** Input used to construct one immutable catalog revision. */
165
+ export declare const catalogInputSchema: z.ZodObject<{
166
+ revision: z.ZodString;
167
+ operations: z.ZodArray<z.ZodObject<{
168
+ path: z.ZodString;
169
+ description: z.ZodOptional<z.ZodString>;
170
+ input: z.ZodCustom<Readonly<{
171
+ "~standard": Readonly<{
172
+ jsonSchema: Readonly<{
173
+ /** JSON Schema of the value the operation accepts. */
174
+ input: (options: JsonSchemaTarget) => object;
175
+ /** JSON Schema of the value the operation returns. */
176
+ output: (options: JsonSchemaTarget) => object;
177
+ }>;
178
+ }>;
179
+ }>, Readonly<{
180
+ "~standard": Readonly<{
181
+ jsonSchema: Readonly<{
182
+ /** JSON Schema of the value the operation accepts. */
183
+ input: (options: JsonSchemaTarget) => object;
184
+ /** JSON Schema of the value the operation returns. */
185
+ output: (options: JsonSchemaTarget) => object;
186
+ }>;
187
+ }>;
188
+ }>>;
189
+ output: z.ZodOptional<z.ZodCustom<Readonly<{
190
+ "~standard": Readonly<{
191
+ jsonSchema: Readonly<{
192
+ /** JSON Schema of the value the operation accepts. */
193
+ input: (options: JsonSchemaTarget) => object;
194
+ /** JSON Schema of the value the operation returns. */
195
+ output: (options: JsonSchemaTarget) => object;
196
+ }>;
197
+ }>;
198
+ }>, Readonly<{
199
+ "~standard": Readonly<{
200
+ jsonSchema: Readonly<{
201
+ /** JSON Schema of the value the operation accepts. */
202
+ input: (options: JsonSchemaTarget) => object;
203
+ /** JSON Schema of the value the operation returns. */
204
+ output: (options: JsonSchemaTarget) => object;
205
+ }>;
206
+ }>;
207
+ }>>>;
208
+ capabilityNotes: z.ZodOptional<z.ZodString>;
209
+ instructions: z.ZodOptional<z.ZodString>;
210
+ }, z.core.$strip>>;
211
+ }, z.core.$strip>;
212
+ /** Parsed search request type. */
213
+ export type ForageSearchInput = z.input<typeof forageSearchInput>;
214
+ /** Exhaustive listing request type. */
215
+ export type ForageListInput = z.input<typeof forageListInput>;
216
+ /** Exhaustive page response type. */
217
+ export type ListOutput = z.infer<typeof listOutputSchema>;
218
+ /** Parsed description request type. */
219
+ export type ForageDescribeInput = z.input<typeof forageDescribeInput>;
220
+ /** One ranked search result type. */
221
+ export type SearchResult = z.infer<typeof searchResultSchema>;
222
+ /** Search response envelope type. */
223
+ export type SearchOutput = z.infer<typeof searchOutputSchema>;
224
+ /** Description response type. */
225
+ export type DescribeOutput = z.infer<typeof describeOutputSchema>;
226
+ /** Typed failure value type. */
227
+ export type ForageFailure = z.infer<typeof forageFailureSchema>;
228
+ /** Catalog operation descriptor type. */
229
+ export type Operation = z.infer<typeof operationSchema>;
230
+ /** Catalog construction input type. */
231
+ export type CatalogInput = z.input<typeof catalogInputSchema>;