@fungi.computer/forage 0.0.2 → 0.2.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 +7 -1
- package/dist/app-api.d.ts +3 -3
- package/dist/app-api.js +7 -7
- package/dist/catalog.js +7 -14
- package/dist/json-schema-boundary.d.ts +2 -2
- package/dist/json-schema-boundary.js +3 -6
- package/dist/json-schema-subset.js +1 -1
- package/dist/normalization.js +1 -1
- package/dist/openapi.d.ts +1 -1
- package/dist/openapi.js +25 -14
- package/dist/schemas.d.ts +33 -33
- package/dist/schemas.js +21 -23
- package/docs/api/index.md +131 -163
- package/docs/api/openapi.md +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -59,7 +59,13 @@ has a unique dotted path, an input schema, and optional description, capability
|
|
|
59
59
|
notes, instructions, and output schema. Forage validates the catalog, orders its
|
|
60
60
|
operations deterministically, and prepares descriptions once when the catalog is
|
|
61
61
|
created. To change the catalog, create a new revision instead of mutating the
|
|
62
|
-
existing one.
|
|
62
|
+
existing one. Every operation must fit one complete description, and the
|
|
63
|
+
catalog's aggregate metadata remains bounded. A whole namespace can exceed a
|
|
64
|
+
description response without making its individually describable operations
|
|
65
|
+
unavailable. Use paged `list({ namespace })` and describe one operation or
|
|
66
|
+
select `methods` when a broad namespace description exceeds the response bound.
|
|
67
|
+
This applies equally to flat namespaces and broad parents of nested namespaces;
|
|
68
|
+
responses are never truncated and the response bound is unchanged.
|
|
63
69
|
|
|
64
70
|
`search` ranks matching operations. `describe` returns a bounded TypeScript
|
|
65
71
|
description for one operation or a namespace. Operation descriptions also
|
package/dist/app-api.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare function appMethodSchemas(api: AppApi): {
|
|
|
11
11
|
[k: string]: {
|
|
12
12
|
readonly description: string;
|
|
13
13
|
readonly effect: "write" | "external" | "read";
|
|
14
|
-
readonly requires: readonly ("agent.list" | "agent.manage" | "agent.rename" | "agent.toolPolicy" | "agent.read" | "agent.send" | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[];
|
|
14
|
+
readonly requires: readonly ("approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[];
|
|
15
15
|
readonly pending: true | undefined;
|
|
16
16
|
readonly input: Pick<z.ZodType<z.core.util.JSONType, unknown, z.core.$ZodTypeInternals<z.core.util.JSONType, unknown>>, "~standard" | "parse" | "safeParse">;
|
|
17
17
|
readonly output: Pick<z.ZodType<z.core.util.JSONType, unknown, z.core.$ZodTypeInternals<z.core.util.JSONType, unknown>>, "~standard" | "parse" | "safeParse">;
|
|
@@ -22,7 +22,7 @@ export declare function appToolSchemas(api: AppApi): {
|
|
|
22
22
|
[k: string]: {
|
|
23
23
|
readonly description: string;
|
|
24
24
|
readonly effect: "write" | "external" | "read";
|
|
25
|
-
readonly requires: readonly ("agent.list" | "agent.manage" | "agent.rename" | "agent.toolPolicy" | "agent.read" | "agent.send" | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[];
|
|
25
|
+
readonly requires: readonly ("approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[];
|
|
26
26
|
readonly pending: true | undefined;
|
|
27
27
|
readonly input: Pick<z.ZodType<z.core.util.JSONType, unknown, z.core.$ZodTypeInternals<z.core.util.JSONType, unknown>>, "~standard" | "parse" | "safeParse">;
|
|
28
28
|
readonly output: Pick<z.ZodType<z.core.util.JSONType, unknown, z.core.$ZodTypeInternals<z.core.util.JSONType, unknown>>, "~standard" | "parse" | "safeParse">;
|
|
@@ -35,7 +35,7 @@ export declare function appToolFamilySchemas(api: AppApi, reply: unknown): {
|
|
|
35
35
|
name: string;
|
|
36
36
|
call: string;
|
|
37
37
|
effect: "write" | "external" | "read";
|
|
38
|
-
requires: readonly ("agent.list" | "agent.manage" | "agent.rename" | "agent.toolPolicy" | "agent.read" | "agent.send" | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[];
|
|
38
|
+
requires: readonly ("approvals" | "agent.list" | "agent.manage" | "agent.rename" | "agent.avatar" | "agent.toolPolicy" | "agent.read" | "agent.send" | "computer.list" | "computer.readFile" | "computer.writeFile" | "computer.execute" | "llm.generation" | "media.generation" | "games:servers" | "git.repository" | "apps.open" | "apps.call" | "app.storage" | "app.events.emit" | "team.workbenchHost" | "marketplace.browse" | "marketplace.purchase" | "workflow.run" | "workflow.publish" | "workflow.arm" | "world" | "channels.read" | "channels.personal.manage")[];
|
|
39
39
|
kind: "ready" | "unindexed";
|
|
40
40
|
tools: {
|
|
41
41
|
row: {
|
package/dist/app-api.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
const bindingName = z
|
|
2
|
+
const bindingName = z.lazy(() => z
|
|
3
3
|
.string()
|
|
4
4
|
.min(1)
|
|
5
5
|
.max(75)
|
|
6
|
-
.regex(/^[A-Za-z][A-Za-z0-9_]*$/);
|
|
7
|
-
const jsonSchema = z.union([z.record(z.string(), z.json()), z.boolean()]);
|
|
6
|
+
.regex(/^[A-Za-z][A-Za-z0-9_]*$/));
|
|
7
|
+
const jsonSchema = z.lazy(() => z.union([z.record(z.string(), z.json()), z.boolean()]));
|
|
8
8
|
/** The shared JSON-Schema compiler for App methods and OpenAPI operations. */
|
|
9
9
|
export function jsonSchemaToZod(source, defaultTarget = "draft-2020-12") {
|
|
10
10
|
return z.fromJSONSchema(jsonSchema.parse(source), { defaultTarget });
|
|
@@ -46,7 +46,7 @@ export function appToolSchemas(api) {
|
|
|
46
46
|
methods: Object.fromEntries(Object.entries(api.methods).filter(([, method]) => method.hidden !== true)),
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
const familyRow = z
|
|
49
|
+
const familyRow = z.lazy(() => z
|
|
50
50
|
.object({
|
|
51
51
|
tool: bindingName,
|
|
52
52
|
title: z.string().max(120),
|
|
@@ -61,8 +61,8 @@ const familyRow = z
|
|
|
61
61
|
// verbatim; it never reads into or defaults any of it.
|
|
62
62
|
call: z.record(z.string(), z.json()),
|
|
63
63
|
})
|
|
64
|
-
.catchall(z.json());
|
|
65
|
-
const familyInventory = z.discriminatedUnion("kind", [
|
|
64
|
+
.catchall(z.json()));
|
|
65
|
+
const familyInventory = z.lazy(() => z.discriminatedUnion("kind", [
|
|
66
66
|
z.strictObject({ kind: z.literal("unindexed") }),
|
|
67
67
|
z.strictObject({
|
|
68
68
|
kind: z.literal("ready"),
|
|
@@ -71,7 +71,7 @@ const familyInventory = z.discriminatedUnion("kind", [
|
|
|
71
71
|
.max(100)
|
|
72
72
|
.refine((rows) => new Set(rows.map((row) => row.tool)).size === rows.length, { message: "Tool family names must be distinct" }),
|
|
73
73
|
}),
|
|
74
|
-
]);
|
|
74
|
+
]));
|
|
75
75
|
/** Decode the signed listing before compiling dynamic discovery schemas.
|
|
76
76
|
* Rows retain App-owned selectors as data. Hosts supply call admission and
|
|
77
77
|
* invocation arguments; this projection supplies neither defaults nor handlers. */
|
package/dist/catalog.js
CHANGED
|
@@ -4,7 +4,7 @@ import { describeCatalog } from "./describe.js";
|
|
|
4
4
|
import { catalogStamp, prepareOperation, searchCatalog, } from "./search.js";
|
|
5
5
|
import { compareCodeUnits } from "./normalization.js";
|
|
6
6
|
import { listOperations } from "./list.js";
|
|
7
|
-
import {
|
|
7
|
+
import { renderOperationTypes, schemaProjectionSize } from "./rendering.js";
|
|
8
8
|
const maximumCatalogProjectionBytes = 1_000_000;
|
|
9
9
|
function parseCatalog(input) {
|
|
10
10
|
const parsed = catalogInputSchema.safeParse(input);
|
|
@@ -42,20 +42,13 @@ function parseCatalog(input) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const preparedOperations = operations.map((operation) => prepareOperation(operation));
|
|
45
|
-
|
|
45
|
+
// Broad namespace descriptions can be narrowed through the existing methods
|
|
46
|
+
// selector or discovered through list pages. Every operation must still fit
|
|
47
|
+
// a complete description on its own; every response keeps the same bound.
|
|
46
48
|
for (const operation of preparedOperations) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
namespaces.set(namespace, group);
|
|
51
|
-
}
|
|
52
|
-
for (const [namespace, group] of namespaces) {
|
|
53
|
-
const rendered = group.map((operation) => operation.rendered);
|
|
54
|
-
const index = renderNamespaceIndex(rendered);
|
|
55
|
-
const full = renderOperationTypes(rendered);
|
|
56
|
-
if (index.length > maximumDescriptionTypes ||
|
|
57
|
-
full.length > maximumDescriptionTypes) {
|
|
58
|
-
throw new ForageError("invalid_input", `Namespace description exceeds the bounded output: ${namespace}`);
|
|
49
|
+
if (renderOperationTypes([operation.rendered]).length >
|
|
50
|
+
maximumDescriptionTypes) {
|
|
51
|
+
throw new ForageError("invalid_input", `Operation description exceeds the bounded output: ${operation.path}`);
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
54
|
return {
|
|
@@ -2,9 +2,9 @@ import * as z from "zod";
|
|
|
2
2
|
export declare const schemaDepthLimit = 32;
|
|
3
3
|
export declare const schemaNodeLimit = 50000;
|
|
4
4
|
export declare const isUnsafeSchemaPropertyName: (name: string) => boolean;
|
|
5
|
-
export declare const parameterName: z.ZodString
|
|
5
|
+
export declare const parameterName: z.ZodLazy<z.ZodString>;
|
|
6
6
|
export declare const thirdPartyText: (limit: number) => z.core.$ZodBranded<z.ZodString, "ThirdPartyText", "out">;
|
|
7
|
-
export declare const jsonSchemaContainer: z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>]
|
|
7
|
+
export declare const jsonSchemaContainer: z.ZodLazy<z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
8
8
|
export declare function jsonSchemaValueInspection(budget?: {
|
|
9
9
|
nodes: number;
|
|
10
10
|
}): z.ZodPipe<z.ZodUnknown, z.ZodTransform<"nodes_limit" | "depth_limit" | "unsafe_name" | null, unknown>>;
|
|
@@ -3,18 +3,15 @@ export const schemaDepthLimit = 32;
|
|
|
3
3
|
export const schemaNodeLimit = 50_000;
|
|
4
4
|
const unsafePropertyNames = new Set(["__proto__", "constructor", "prototype"]);
|
|
5
5
|
export const isUnsafeSchemaPropertyName = (name) => unsafePropertyNames.has(name);
|
|
6
|
-
export const parameterName = z
|
|
6
|
+
export const parameterName = z.lazy(() => z
|
|
7
7
|
.string()
|
|
8
8
|
.min(1)
|
|
9
9
|
.max(128)
|
|
10
|
-
.refine((name) => !unsafePropertyNames.has(name));
|
|
10
|
+
.refine((name) => !unsafePropertyNames.has(name)));
|
|
11
11
|
export const thirdPartyText = (limit) => z.string().max(limit).brand();
|
|
12
12
|
// Maintained decoding of one container level avoids expanding ref-parser's DAG
|
|
13
13
|
// or recursively decoding remote JSON before the domain budget is checked.
|
|
14
|
-
export const jsonSchemaContainer = z.union([
|
|
15
|
-
z.array(z.unknown()),
|
|
16
|
-
z.record(z.string(), z.unknown()),
|
|
17
|
-
]);
|
|
14
|
+
export const jsonSchemaContainer = z.lazy(() => z.union([z.array(z.unknown()), z.record(z.string(), z.unknown())]));
|
|
18
15
|
export function jsonSchemaValueInspection(budget = { nodes: 0 }) {
|
|
19
16
|
return z
|
|
20
17
|
.unknown()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { jsonSchemaValueInspection, parameterName, thirdPartyText, } from "./json-schema-boundary.js";
|
|
3
|
-
const jsonSchema = z.union([z.record(z.string(), z.json()), z.boolean()]);
|
|
3
|
+
const jsonSchema = z.lazy(() => z.union([z.record(z.string(), z.json()), z.boolean()]));
|
|
4
4
|
/** Decode the supported schema subset before using the shared Zod compiler.
|
|
5
5
|
* Refuse depth over 32, more than 50,000 expanded nodes and reserved keys
|
|
6
6
|
* before recursive decoding. Callers bound transport bytes separately.
|
package/dist/normalization.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export const jsonValueSchema = z.json();
|
|
3
|
-
const jsonPrimitiveSchema = z.union([z.string(), z.number(), z.boolean()]);
|
|
3
|
+
const jsonPrimitiveSchema = z.lazy(() => z.union([z.string(), z.number(), z.boolean()]));
|
|
4
4
|
/**
|
|
5
5
|
* Narrow an already-parsed JSON value to its object case. The value was
|
|
6
6
|
* validated once at its boundary, so each nested level is told apart by its
|
package/dist/openapi.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare const openApiOperationSchema: z.ZodObject<{
|
|
|
38
38
|
textSource: z.ZodLiteral<"third_party">;
|
|
39
39
|
tags: z.ZodArray<z.core.$ZodBranded<z.ZodString, "ThirdPartyText", "out">>;
|
|
40
40
|
parameters: z.ZodArray<z.ZodObject<{
|
|
41
|
-
name: z.ZodString
|
|
41
|
+
name: z.ZodLazy<z.ZodString>;
|
|
42
42
|
in: z.ZodEnum<{
|
|
43
43
|
header: "header";
|
|
44
44
|
path: "path";
|
package/dist/openapi.js
CHANGED
|
@@ -11,6 +11,16 @@ const reservedNames = new Set([
|
|
|
11
11
|
"prototype",
|
|
12
12
|
...Object.getOwnPropertyNames(Object.prototype),
|
|
13
13
|
]);
|
|
14
|
+
const operationMethods = [
|
|
15
|
+
"get",
|
|
16
|
+
"head",
|
|
17
|
+
"options",
|
|
18
|
+
"post",
|
|
19
|
+
"put",
|
|
20
|
+
"patch",
|
|
21
|
+
"delete",
|
|
22
|
+
"trace",
|
|
23
|
+
];
|
|
14
24
|
const pathTemplate = z
|
|
15
25
|
.string()
|
|
16
26
|
.max(2048)
|
|
@@ -304,6 +314,18 @@ function inspectExpansion(source, budget) {
|
|
|
304
314
|
throw new OpenApiError(refusal, messages[refusal]);
|
|
305
315
|
}
|
|
306
316
|
}
|
|
317
|
+
function inspectOperationCount(paths) {
|
|
318
|
+
let count = 0;
|
|
319
|
+
for (const item of Object.values(paths)) {
|
|
320
|
+
count +=
|
|
321
|
+
item.$ref !== undefined
|
|
322
|
+
? 1
|
|
323
|
+
: operationMethods.filter((method) => item[method] !== undefined)
|
|
324
|
+
.length;
|
|
325
|
+
if (count > 500)
|
|
326
|
+
throw new OpenApiError("operations_limit", "The spec exceeds 500 operations");
|
|
327
|
+
}
|
|
328
|
+
}
|
|
307
329
|
/** Pure intake: the host supplies bounded spec text, never a fetch locator. */
|
|
308
330
|
export async function normalizeOpenApi(source, options = {}) {
|
|
309
331
|
const authParameter = intakeOptions.parse(options).authParameter;
|
|
@@ -349,9 +371,9 @@ export async function normalizeOpenApi(source, options = {}) {
|
|
|
349
371
|
const budget = { nodes: 0 };
|
|
350
372
|
const names = new Set(reservedNames);
|
|
351
373
|
const operations = [];
|
|
374
|
+
// Refuse oversized catalogs before cloning or compiling individual operations.
|
|
375
|
+
inspectOperationCount(parsed.paths);
|
|
352
376
|
for (const [path, item] of Object.entries(parsed.paths).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
353
|
-
if (operations.length >= 500)
|
|
354
|
-
throw new OpenApiError("operations_limit", "The spec exceeds 500 operations");
|
|
355
377
|
if (item.$ref !== undefined) {
|
|
356
378
|
operations.push({
|
|
357
379
|
status: "unsupported",
|
|
@@ -362,21 +384,10 @@ export async function normalizeOpenApi(source, options = {}) {
|
|
|
362
384
|
});
|
|
363
385
|
continue;
|
|
364
386
|
}
|
|
365
|
-
for (const method of
|
|
366
|
-
"get",
|
|
367
|
-
"head",
|
|
368
|
-
"options",
|
|
369
|
-
"post",
|
|
370
|
-
"put",
|
|
371
|
-
"patch",
|
|
372
|
-
"delete",
|
|
373
|
-
"trace",
|
|
374
|
-
]) {
|
|
387
|
+
for (const method of operationMethods) {
|
|
375
388
|
const raw = item[method];
|
|
376
389
|
if (raw === undefined)
|
|
377
390
|
continue;
|
|
378
|
-
if (operations.length >= 500)
|
|
379
|
-
throw new OpenApiError("operations_limit", "The spec exceeds 500 operations");
|
|
380
391
|
const label = z
|
|
381
392
|
.object({ operationId: z.string().max(128).optional() })
|
|
382
393
|
.safeParse(raw);
|
package/dist/schemas.d.ts
CHANGED
|
@@ -4,19 +4,19 @@ export declare const maximumSampleEntries = 100;
|
|
|
4
4
|
export declare const maximumSampleBytes = 4000;
|
|
5
5
|
export declare const maximumSampleDepth = 16;
|
|
6
6
|
/** Input accepted by the pure catalog search seam. */
|
|
7
|
-
export declare const forageSearchInput: z.ZodObject<{
|
|
7
|
+
export declare const forageSearchInput: z.ZodLazy<z.ZodObject<{
|
|
8
8
|
query: z.ZodString;
|
|
9
9
|
maxResults: z.ZodDefault<z.ZodNumber>;
|
|
10
|
-
}, z.core.$strip
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
11
|
/** Input accepted by the pure catalog description seam. */
|
|
12
|
-
export declare const forageDescribeInput: z.ZodObject<{
|
|
12
|
+
export declare const forageDescribeInput: z.ZodLazy<z.ZodObject<{
|
|
13
13
|
path: z.ZodString;
|
|
14
14
|
detail: z.ZodDefault<z.ZodEnum<{
|
|
15
15
|
index: "index";
|
|
16
16
|
full: "full";
|
|
17
17
|
}>>;
|
|
18
18
|
methods: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
19
|
-
}, z.core.$strip
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
20
|
/** Exhaustive listing request; cursor is scoped to one immutable catalog and filter. */
|
|
21
21
|
export declare const forageListInput: z.ZodObject<{
|
|
22
22
|
cursor: z.ZodOptional<z.ZodString>;
|
|
@@ -29,33 +29,33 @@ export declare const searchResultSchema: z.ZodObject<{
|
|
|
29
29
|
description: z.ZodOptional<z.ZodString>;
|
|
30
30
|
score: z.ZodNumber;
|
|
31
31
|
matchReason: z.ZodOptional<z.ZodString>;
|
|
32
|
-
sample: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema
|
|
32
|
+
sample: z.ZodOptional<z.ZodLazy<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
|
|
33
33
|
capabilityNotes: z.ZodOptional<z.ZodString>;
|
|
34
|
-
peers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
34
|
+
peers: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
35
35
|
path: z.ZodString;
|
|
36
36
|
capabilityNotes: z.ZodOptional<z.ZodString>;
|
|
37
|
-
}, z.core.$strip
|
|
37
|
+
}, z.core.$strip>>>>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
/** Bounded search response envelope. */
|
|
40
|
-
export declare const searchOutputSchema: z.ZodObject<{
|
|
40
|
+
export declare const searchOutputSchema: z.ZodLazy<z.ZodObject<{
|
|
41
41
|
results: z.ZodArray<z.ZodObject<{
|
|
42
42
|
path: z.ZodString;
|
|
43
43
|
description: z.ZodOptional<z.ZodString>;
|
|
44
44
|
score: z.ZodNumber;
|
|
45
45
|
matchReason: z.ZodOptional<z.ZodString>;
|
|
46
|
-
sample: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema
|
|
46
|
+
sample: z.ZodOptional<z.ZodLazy<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
|
|
47
47
|
capabilityNotes: z.ZodOptional<z.ZodString>;
|
|
48
|
-
peers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
48
|
+
peers: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
49
49
|
path: z.ZodString;
|
|
50
50
|
capabilityNotes: z.ZodOptional<z.ZodString>;
|
|
51
|
-
}, z.core.$strip
|
|
51
|
+
}, z.core.$strip>>>>;
|
|
52
52
|
}, z.core.$strip>>;
|
|
53
53
|
total: z.ZodNumber;
|
|
54
54
|
truncated: z.ZodBoolean;
|
|
55
55
|
topScore: z.ZodNumber;
|
|
56
56
|
margin: z.ZodNumber;
|
|
57
57
|
catalogStamp: z.ZodString;
|
|
58
|
-
}, z.core.$strip
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
59
|
/** One exhaustive page, using the exact search operation summary schema. */
|
|
60
60
|
export declare const listOutputSchema: z.ZodObject<{
|
|
61
61
|
results: z.ZodArray<z.ZodObject<{
|
|
@@ -63,19 +63,19 @@ export declare const listOutputSchema: z.ZodObject<{
|
|
|
63
63
|
description: z.ZodOptional<z.ZodString>;
|
|
64
64
|
score: z.ZodNumber;
|
|
65
65
|
matchReason: z.ZodOptional<z.ZodString>;
|
|
66
|
-
sample: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema
|
|
66
|
+
sample: z.ZodOptional<z.ZodLazy<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
|
|
67
67
|
capabilityNotes: z.ZodOptional<z.ZodString>;
|
|
68
|
-
peers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
68
|
+
peers: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
69
69
|
path: z.ZodString;
|
|
70
70
|
capabilityNotes: z.ZodOptional<z.ZodString>;
|
|
71
|
-
}, z.core.$strip
|
|
71
|
+
}, z.core.$strip>>>>;
|
|
72
72
|
}, z.core.$strip>>;
|
|
73
73
|
total: z.ZodNumber;
|
|
74
74
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
75
75
|
catalogStamp: z.ZodString;
|
|
76
76
|
}, z.core.$strip>;
|
|
77
77
|
/** Deterministic description response. */
|
|
78
|
-
export declare const describeOutputSchema: z.ZodObject<{
|
|
78
|
+
export declare const describeOutputSchema: z.ZodLazy<z.ZodObject<{
|
|
79
79
|
path: z.ZodString;
|
|
80
80
|
description: z.ZodOptional<z.ZodString>;
|
|
81
81
|
types: z.ZodString;
|
|
@@ -85,9 +85,9 @@ export declare const describeOutputSchema: z.ZodObject<{
|
|
|
85
85
|
operation: "operation";
|
|
86
86
|
}>;
|
|
87
87
|
usage: z.ZodOptional<z.ZodString>;
|
|
88
|
-
}, z.core.$strip
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
89
|
/** Closed failure vocabulary for malformed or absent catalog requests. */
|
|
90
|
-
export declare const forageFailureSchema: z.ZodObject<{
|
|
90
|
+
export declare const forageFailureSchema: z.ZodLazy<z.ZodObject<{
|
|
91
91
|
code: z.ZodEnum<{
|
|
92
92
|
empty_query: "empty_query";
|
|
93
93
|
empty_catalog: "empty_catalog";
|
|
@@ -96,7 +96,7 @@ export declare const forageFailureSchema: z.ZodObject<{
|
|
|
96
96
|
invalid_input: "invalid_input";
|
|
97
97
|
}>;
|
|
98
98
|
message: z.ZodString;
|
|
99
|
-
}, z.core.$strip
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
100
|
/** Options Forage passes when it asks a schema for its JSON Schema. */
|
|
101
101
|
export type JsonSchemaTarget = Readonly<{
|
|
102
102
|
target: "draft-2020-12";
|
|
@@ -117,10 +117,10 @@ export type JsonSchemaSource = Readonly<{
|
|
|
117
117
|
}>;
|
|
118
118
|
}>;
|
|
119
119
|
/** A secret-free, callback-free operation descriptor. */
|
|
120
|
-
export declare const operationSchema: z.ZodObject<{
|
|
120
|
+
export declare const operationSchema: z.ZodLazy<z.ZodObject<{
|
|
121
121
|
path: z.ZodString;
|
|
122
122
|
description: z.ZodOptional<z.ZodString>;
|
|
123
|
-
input: z.ZodCustom<Readonly<{
|
|
123
|
+
input: z.ZodLazy<z.ZodCustom<Readonly<{
|
|
124
124
|
"~standard": Readonly<{
|
|
125
125
|
jsonSchema: Readonly<{
|
|
126
126
|
/** JSON Schema of the value the operation accepts. */
|
|
@@ -138,8 +138,8 @@ export declare const operationSchema: z.ZodObject<{
|
|
|
138
138
|
output: (options: JsonSchemaTarget) => object;
|
|
139
139
|
}>;
|
|
140
140
|
}>;
|
|
141
|
-
}
|
|
142
|
-
output: z.ZodOptional<z.ZodCustom<Readonly<{
|
|
141
|
+
}>>>;
|
|
142
|
+
output: z.ZodOptional<z.ZodLazy<z.ZodCustom<Readonly<{
|
|
143
143
|
"~standard": Readonly<{
|
|
144
144
|
jsonSchema: Readonly<{
|
|
145
145
|
/** JSON Schema of the value the operation accepts. */
|
|
@@ -157,17 +157,17 @@ export declare const operationSchema: z.ZodObject<{
|
|
|
157
157
|
output: (options: JsonSchemaTarget) => object;
|
|
158
158
|
}>;
|
|
159
159
|
}>;
|
|
160
|
-
}
|
|
160
|
+
}>>>>;
|
|
161
161
|
capabilityNotes: z.ZodOptional<z.ZodString>;
|
|
162
162
|
instructions: z.ZodOptional<z.ZodString>;
|
|
163
|
-
}, z.core.$strip
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
164
|
/** Input used to construct one immutable catalog revision. */
|
|
165
|
-
export declare const catalogInputSchema: z.ZodObject<{
|
|
165
|
+
export declare const catalogInputSchema: z.ZodLazy<z.ZodObject<{
|
|
166
166
|
revision: z.ZodString;
|
|
167
|
-
operations: z.ZodArray<z.ZodObject<{
|
|
167
|
+
operations: z.ZodArray<z.ZodLazy<z.ZodObject<{
|
|
168
168
|
path: z.ZodString;
|
|
169
169
|
description: z.ZodOptional<z.ZodString>;
|
|
170
|
-
input: z.ZodCustom<Readonly<{
|
|
170
|
+
input: z.ZodLazy<z.ZodCustom<Readonly<{
|
|
171
171
|
"~standard": Readonly<{
|
|
172
172
|
jsonSchema: Readonly<{
|
|
173
173
|
/** JSON Schema of the value the operation accepts. */
|
|
@@ -185,8 +185,8 @@ export declare const catalogInputSchema: z.ZodObject<{
|
|
|
185
185
|
output: (options: JsonSchemaTarget) => object;
|
|
186
186
|
}>;
|
|
187
187
|
}>;
|
|
188
|
-
}
|
|
189
|
-
output: z.ZodOptional<z.ZodCustom<Readonly<{
|
|
188
|
+
}>>>;
|
|
189
|
+
output: z.ZodOptional<z.ZodLazy<z.ZodCustom<Readonly<{
|
|
190
190
|
"~standard": Readonly<{
|
|
191
191
|
jsonSchema: Readonly<{
|
|
192
192
|
/** JSON Schema of the value the operation accepts. */
|
|
@@ -204,11 +204,11 @@ export declare const catalogInputSchema: z.ZodObject<{
|
|
|
204
204
|
output: (options: JsonSchemaTarget) => object;
|
|
205
205
|
}>;
|
|
206
206
|
}>;
|
|
207
|
-
}
|
|
207
|
+
}>>>>;
|
|
208
208
|
capabilityNotes: z.ZodOptional<z.ZodString>;
|
|
209
209
|
instructions: z.ZodOptional<z.ZodString>;
|
|
210
|
-
}, z.core.$strip
|
|
211
|
-
}, z.core.$strip
|
|
210
|
+
}, z.core.$strip>>>;
|
|
211
|
+
}, z.core.$strip>>;
|
|
212
212
|
/** Parsed search request type. */
|
|
213
213
|
export type ForageSearchInput = z.input<typeof forageSearchInput>;
|
|
214
214
|
/** Exhaustive listing request type. */
|
package/dist/schemas.js
CHANGED
|
@@ -27,9 +27,7 @@ function jsonDepth(value, depth) {
|
|
|
27
27
|
}
|
|
28
28
|
return maximum;
|
|
29
29
|
}
|
|
30
|
-
const sampleSchema = z
|
|
31
|
-
.record(z.string(), z.json())
|
|
32
|
-
.superRefine((value, context) => {
|
|
30
|
+
const sampleSchema = z.lazy(() => z.record(z.string(), z.json()).superRefine((value, context) => {
|
|
33
31
|
if (Object.keys(value).length > maximumSampleEntries) {
|
|
34
32
|
context.addIssue({
|
|
35
33
|
code: "custom",
|
|
@@ -48,18 +46,18 @@ const sampleSchema = z
|
|
|
48
46
|
message: "Sample exceeds the depth bound",
|
|
49
47
|
});
|
|
50
48
|
}
|
|
51
|
-
});
|
|
49
|
+
}));
|
|
52
50
|
/** Input accepted by the pure catalog search seam. */
|
|
53
|
-
export const forageSearchInput = z.object({
|
|
51
|
+
export const forageSearchInput = z.lazy(() => z.object({
|
|
54
52
|
query: z.string().max(200),
|
|
55
53
|
maxResults: z.number().int().min(1).max(50).default(50),
|
|
56
|
-
});
|
|
54
|
+
}));
|
|
57
55
|
/** Input accepted by the pure catalog description seam. */
|
|
58
|
-
export const forageDescribeInput = z.object({
|
|
56
|
+
export const forageDescribeInput = z.lazy(() => z.object({
|
|
59
57
|
path: z.string().max(160),
|
|
60
58
|
detail: z.enum(["index", "full"]).default("full"),
|
|
61
59
|
methods: z.array(z.string().max(80)).max(50).optional(),
|
|
62
|
-
});
|
|
60
|
+
}));
|
|
63
61
|
/** Exhaustive listing request; cursor is scoped to one immutable catalog and filter. */
|
|
64
62
|
export const forageListInput = z.object({
|
|
65
63
|
cursor: z.string().max(400).optional(),
|
|
@@ -71,10 +69,10 @@ export const forageListInput = z.object({
|
|
|
71
69
|
.regex(/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/)
|
|
72
70
|
.optional(),
|
|
73
71
|
});
|
|
74
|
-
const peerSchema = z.object({
|
|
72
|
+
const peerSchema = z.lazy(() => z.object({
|
|
75
73
|
path: z.string().max(160),
|
|
76
74
|
capabilityNotes: z.string().max(500).optional(),
|
|
77
|
-
});
|
|
75
|
+
}));
|
|
78
76
|
/** One ranked operation in a search response. */
|
|
79
77
|
export const searchResultSchema = z.object({
|
|
80
78
|
path: z.string().max(160),
|
|
@@ -86,7 +84,7 @@ export const searchResultSchema = z.object({
|
|
|
86
84
|
peers: z.array(peerSchema).max(1000).optional(),
|
|
87
85
|
});
|
|
88
86
|
/** Bounded search response envelope. */
|
|
89
|
-
export const searchOutputSchema = z.object({
|
|
87
|
+
export const searchOutputSchema = z.lazy(() => z.object({
|
|
90
88
|
results: z.array(searchResultSchema).max(50),
|
|
91
89
|
total: z.number().int().min(0).max(maximumCatalogOperations),
|
|
92
90
|
truncated: z.boolean(),
|
|
@@ -96,7 +94,7 @@ export const searchOutputSchema = z.object({
|
|
|
96
94
|
.string()
|
|
97
95
|
.length(16)
|
|
98
96
|
.regex(/^[0-9a-f]{16}$/),
|
|
99
|
-
});
|
|
97
|
+
}));
|
|
100
98
|
/** One exhaustive page, using the exact search operation summary schema. */
|
|
101
99
|
export const listOutputSchema = z.object({
|
|
102
100
|
results: z.array(searchResultSchema).max(50),
|
|
@@ -108,7 +106,7 @@ export const listOutputSchema = z.object({
|
|
|
108
106
|
.regex(/^[0-9a-f]{16}$/),
|
|
109
107
|
});
|
|
110
108
|
/** Deterministic description response. */
|
|
111
|
-
export const describeOutputSchema = z.object({
|
|
109
|
+
export const describeOutputSchema = z.lazy(() => z.object({
|
|
112
110
|
path: z.string().max(160),
|
|
113
111
|
description: z.string().max(1000).optional(),
|
|
114
112
|
types: z.string().max(20000),
|
|
@@ -119,9 +117,9 @@ export const describeOutputSchema = z.object({
|
|
|
119
117
|
.optional(),
|
|
120
118
|
kind: z.enum(["module", "operation"]),
|
|
121
119
|
usage: z.string().max(300).optional(),
|
|
122
|
-
});
|
|
120
|
+
}));
|
|
123
121
|
/** Closed failure vocabulary for malformed or absent catalog requests. */
|
|
124
|
-
export const forageFailureSchema = z.object({
|
|
122
|
+
export const forageFailureSchema = z.lazy(() => z.object({
|
|
125
123
|
code: z.enum([
|
|
126
124
|
"empty_query",
|
|
127
125
|
"empty_catalog",
|
|
@@ -130,27 +128,27 @@ export const forageFailureSchema = z.object({
|
|
|
130
128
|
"invalid_input",
|
|
131
129
|
]),
|
|
132
130
|
message: z.string().max(1000),
|
|
133
|
-
});
|
|
134
|
-
const jsonSchemaDescriber = z.object({
|
|
131
|
+
}));
|
|
132
|
+
const jsonSchemaDescriber = z.lazy(() => z.object({
|
|
135
133
|
"~standard": z.object({
|
|
136
134
|
jsonSchema: z.object({
|
|
137
135
|
input: z.instanceof(Function),
|
|
138
136
|
output: z.instanceof(Function),
|
|
139
137
|
}),
|
|
140
138
|
}),
|
|
141
|
-
});
|
|
142
|
-
const jsonSchemaSource = z.custom((value) => jsonSchemaDescriber.safeParse(value).success, "Expected a Standard JSON Schema");
|
|
139
|
+
}));
|
|
140
|
+
const jsonSchemaSource = z.lazy(() => z.custom((value) => jsonSchemaDescriber.safeParse(value).success, "Expected a Standard JSON Schema"));
|
|
143
141
|
/** A secret-free, callback-free operation descriptor. */
|
|
144
|
-
export const operationSchema = z.object({
|
|
142
|
+
export const operationSchema = z.lazy(() => z.object({
|
|
145
143
|
path: z.string().min(3).max(160).regex(pathPattern),
|
|
146
144
|
description: z.string().max(1000).optional(),
|
|
147
145
|
input: jsonSchemaSource,
|
|
148
146
|
output: jsonSchemaSource.optional(),
|
|
149
147
|
capabilityNotes: z.string().max(500).optional(),
|
|
150
148
|
instructions: z.string().max(1000).optional(),
|
|
151
|
-
});
|
|
149
|
+
}));
|
|
152
150
|
/** Input used to construct one immutable catalog revision. */
|
|
153
|
-
export const catalogInputSchema = z.object({
|
|
151
|
+
export const catalogInputSchema = z.lazy(() => z.object({
|
|
154
152
|
revision: z.string().min(1).max(160),
|
|
155
153
|
operations: z.array(operationSchema).max(maximumCatalogOperations),
|
|
156
|
-
});
|
|
154
|
+
}));
|
package/docs/api/index.md
CHANGED
|
@@ -342,12 +342,14 @@ Narrow convenience namespace for the package's public seams.
|
|
|
342
342
|
### forageSearchInput
|
|
343
343
|
|
|
344
344
|
```ts
|
|
345
|
-
const forageSearchInput:
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
345
|
+
const forageSearchInput: ZodLazy<
|
|
346
|
+
ZodObject<
|
|
347
|
+
{
|
|
348
|
+
query: ZodString;
|
|
349
|
+
maxResults: ZodDefault<ZodNumber>;
|
|
350
|
+
},
|
|
351
|
+
$strip
|
|
352
|
+
>
|
|
351
353
|
>;
|
|
352
354
|
```
|
|
353
355
|
|
|
@@ -358,18 +360,20 @@ Input accepted by the pure catalog search seam.
|
|
|
358
360
|
### forageDescribeInput
|
|
359
361
|
|
|
360
362
|
```ts
|
|
361
|
-
const forageDescribeInput:
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
363
|
+
const forageDescribeInput: ZodLazy<
|
|
364
|
+
ZodObject<
|
|
365
|
+
{
|
|
366
|
+
path: ZodString;
|
|
367
|
+
detail: ZodDefault<
|
|
368
|
+
ZodEnum<{
|
|
369
|
+
index: "index";
|
|
370
|
+
full: "full";
|
|
371
|
+
}>
|
|
372
|
+
>;
|
|
373
|
+
methods: ZodOptional<ZodArray<ZodString>>;
|
|
374
|
+
},
|
|
375
|
+
$strip
|
|
376
|
+
>
|
|
373
377
|
>;
|
|
374
378
|
```
|
|
375
379
|
|
|
@@ -404,16 +408,18 @@ const searchResultSchema: ZodObject<
|
|
|
404
408
|
description: ZodOptional<ZodString>;
|
|
405
409
|
score: ZodNumber;
|
|
406
410
|
matchReason: ZodOptional<ZodString>;
|
|
407
|
-
sample: ZodOptional<ZodRecord<ZodString, ZodJSONSchema
|
|
411
|
+
sample: ZodOptional<ZodLazy<ZodRecord<ZodString, ZodJSONSchema>>>;
|
|
408
412
|
capabilityNotes: ZodOptional<ZodString>;
|
|
409
413
|
peers: ZodOptional<
|
|
410
414
|
ZodArray<
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
ZodLazy<
|
|
416
|
+
ZodObject<
|
|
417
|
+
{
|
|
418
|
+
path: ZodString;
|
|
419
|
+
capabilityNotes: ZodOptional<ZodString>;
|
|
420
|
+
},
|
|
421
|
+
$strip
|
|
422
|
+
>
|
|
417
423
|
>
|
|
418
424
|
>
|
|
419
425
|
>;
|
|
@@ -429,40 +435,25 @@ One ranked operation in a search response.
|
|
|
429
435
|
### searchOutputSchema
|
|
430
436
|
|
|
431
437
|
```ts
|
|
432
|
-
const searchOutputSchema: ZodObject<
|
|
433
|
-
{
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
>
|
|
452
|
-
>
|
|
453
|
-
>;
|
|
454
|
-
},
|
|
455
|
-
$strip
|
|
456
|
-
>
|
|
457
|
-
>;
|
|
458
|
-
total: ZodNumber;
|
|
459
|
-
truncated: ZodBoolean;
|
|
460
|
-
topScore: ZodNumber;
|
|
461
|
-
margin: ZodNumber;
|
|
462
|
-
catalogStamp: ZodString;
|
|
463
|
-
},
|
|
464
|
-
$strip
|
|
465
|
-
>;
|
|
438
|
+
const searchOutputSchema: ZodLazy<ZodObject<{
|
|
439
|
+
results: ZodArray<ZodObject<{
|
|
440
|
+
path: ZodString;
|
|
441
|
+
description: ZodOptional<ZodString>;
|
|
442
|
+
score: ZodNumber;
|
|
443
|
+
matchReason: ZodOptional<ZodString>;
|
|
444
|
+
sample: ZodOptional<ZodLazy<ZodRecord<ZodString, ZodJSONSchema>>>;
|
|
445
|
+
capabilityNotes: ZodOptional<ZodString>;
|
|
446
|
+
peers: ZodOptional<ZodArray<ZodLazy<ZodObject<{
|
|
447
|
+
path: ...;
|
|
448
|
+
capabilityNotes: ...;
|
|
449
|
+
}, $strip>>>>;
|
|
450
|
+
}, $strip>>;
|
|
451
|
+
total: ZodNumber;
|
|
452
|
+
truncated: ZodBoolean;
|
|
453
|
+
topScore: ZodNumber;
|
|
454
|
+
margin: ZodNumber;
|
|
455
|
+
catalogStamp: ZodString;
|
|
456
|
+
}, $strip>>;
|
|
466
457
|
```
|
|
467
458
|
|
|
468
459
|
Bounded search response envelope.
|
|
@@ -472,38 +463,23 @@ Bounded search response envelope.
|
|
|
472
463
|
### listOutputSchema
|
|
473
464
|
|
|
474
465
|
```ts
|
|
475
|
-
const listOutputSchema: ZodObject<
|
|
476
|
-
{
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
},
|
|
493
|
-
$strip
|
|
494
|
-
>
|
|
495
|
-
>
|
|
496
|
-
>;
|
|
497
|
-
},
|
|
498
|
-
$strip
|
|
499
|
-
>
|
|
500
|
-
>;
|
|
501
|
-
total: ZodNumber;
|
|
502
|
-
nextCursor: ZodNullable<ZodString>;
|
|
503
|
-
catalogStamp: ZodString;
|
|
504
|
-
},
|
|
505
|
-
$strip
|
|
506
|
-
>;
|
|
466
|
+
const listOutputSchema: ZodObject<{
|
|
467
|
+
results: ZodArray<ZodObject<{
|
|
468
|
+
path: ZodString;
|
|
469
|
+
description: ZodOptional<ZodString>;
|
|
470
|
+
score: ZodNumber;
|
|
471
|
+
matchReason: ZodOptional<ZodString>;
|
|
472
|
+
sample: ZodOptional<ZodLazy<ZodRecord<ZodString, ZodJSONSchema>>>;
|
|
473
|
+
capabilityNotes: ZodOptional<ZodString>;
|
|
474
|
+
peers: ZodOptional<ZodArray<ZodLazy<ZodObject<{
|
|
475
|
+
path: ZodString;
|
|
476
|
+
capabilityNotes: ZodOptional<...>;
|
|
477
|
+
}, $strip>>>>;
|
|
478
|
+
}, $strip>>;
|
|
479
|
+
total: ZodNumber;
|
|
480
|
+
nextCursor: ZodNullable<ZodString>;
|
|
481
|
+
catalogStamp: ZodString;
|
|
482
|
+
}, $strip>;
|
|
507
483
|
```
|
|
508
484
|
|
|
509
485
|
One exhaustive page, using the exact search operation summary schema.
|
|
@@ -513,19 +489,21 @@ One exhaustive page, using the exact search operation summary schema.
|
|
|
513
489
|
### describeOutputSchema
|
|
514
490
|
|
|
515
491
|
```ts
|
|
516
|
-
const describeOutputSchema:
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
492
|
+
const describeOutputSchema: ZodLazy<
|
|
493
|
+
ZodObject<
|
|
494
|
+
{
|
|
495
|
+
path: ZodString;
|
|
496
|
+
description: ZodOptional<ZodString>;
|
|
497
|
+
types: ZodString;
|
|
498
|
+
inputSchema: ZodOptional<ZodJSONSchema>;
|
|
499
|
+
kind: ZodEnum<{
|
|
500
|
+
module: "module";
|
|
501
|
+
operation: "operation";
|
|
502
|
+
}>;
|
|
503
|
+
usage: ZodOptional<ZodString>;
|
|
504
|
+
},
|
|
505
|
+
$strip
|
|
506
|
+
>
|
|
529
507
|
>;
|
|
530
508
|
```
|
|
531
509
|
|
|
@@ -536,18 +514,20 @@ Deterministic description response.
|
|
|
536
514
|
### forageFailureSchema
|
|
537
515
|
|
|
538
516
|
```ts
|
|
539
|
-
const forageFailureSchema:
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
517
|
+
const forageFailureSchema: ZodLazy<
|
|
518
|
+
ZodObject<
|
|
519
|
+
{
|
|
520
|
+
code: ZodEnum<{
|
|
521
|
+
empty_query: "empty_query";
|
|
522
|
+
empty_catalog: "empty_catalog";
|
|
523
|
+
unknown_target: "unknown_target";
|
|
524
|
+
duplicate_operation: "duplicate_operation";
|
|
525
|
+
invalid_input: "invalid_input";
|
|
526
|
+
}>;
|
|
527
|
+
message: ZodString;
|
|
528
|
+
},
|
|
529
|
+
$strip
|
|
530
|
+
>
|
|
551
531
|
>;
|
|
552
532
|
```
|
|
553
533
|
|
|
@@ -558,42 +538,36 @@ Closed failure vocabulary for malformed or absent catalog requests.
|
|
|
558
538
|
### operationSchema
|
|
559
539
|
|
|
560
540
|
```ts
|
|
561
|
-
const operationSchema: ZodObject<{
|
|
541
|
+
const operationSchema: ZodLazy<ZodObject<{
|
|
562
542
|
path: ZodString;
|
|
563
543
|
description: ZodOptional<ZodString>;
|
|
564
|
-
input: ZodCustom<Readonly<{
|
|
544
|
+
input: ZodLazy<ZodCustom<Readonly<{
|
|
565
545
|
~standard: Readonly<{
|
|
566
546
|
jsonSchema: Readonly<{
|
|
567
|
-
input:
|
|
568
|
-
output:
|
|
547
|
+
input: ...;
|
|
548
|
+
output: ...;
|
|
569
549
|
}>;
|
|
570
550
|
}>;
|
|
571
551
|
}>, Readonly<{
|
|
572
552
|
~standard: Readonly<{
|
|
573
553
|
jsonSchema: Readonly<{
|
|
574
|
-
input:
|
|
575
|
-
output:
|
|
554
|
+
input: ...;
|
|
555
|
+
output: ...;
|
|
576
556
|
}>;
|
|
577
557
|
}>;
|
|
578
|
-
}
|
|
579
|
-
output: ZodOptional<ZodCustom<Readonly<{
|
|
558
|
+
}>>>;
|
|
559
|
+
output: ZodOptional<ZodLazy<ZodCustom<Readonly<{
|
|
580
560
|
~standard: Readonly<{
|
|
581
|
-
jsonSchema: Readonly
|
|
582
|
-
input: (options) => ...;
|
|
583
|
-
output: (options) => ...;
|
|
584
|
-
}>;
|
|
561
|
+
jsonSchema: Readonly<...>;
|
|
585
562
|
}>;
|
|
586
563
|
}>, Readonly<{
|
|
587
564
|
~standard: Readonly<{
|
|
588
|
-
jsonSchema: Readonly
|
|
589
|
-
input: (options) => ...;
|
|
590
|
-
output: (options) => ...;
|
|
591
|
-
}>;
|
|
565
|
+
jsonSchema: Readonly<...>;
|
|
592
566
|
}>;
|
|
593
|
-
}
|
|
567
|
+
}>>>>;
|
|
594
568
|
capabilityNotes: ZodOptional<ZodString>;
|
|
595
569
|
instructions: ZodOptional<ZodString>;
|
|
596
|
-
}, $strip
|
|
570
|
+
}, $strip>>;
|
|
597
571
|
```
|
|
598
572
|
|
|
599
573
|
A secret-free, callback-free operation descriptor.
|
|
@@ -603,33 +577,21 @@ A secret-free, callback-free operation descriptor.
|
|
|
603
577
|
### catalogInputSchema
|
|
604
578
|
|
|
605
579
|
```ts
|
|
606
|
-
const catalogInputSchema: ZodObject<{
|
|
580
|
+
const catalogInputSchema: ZodLazy<ZodObject<{
|
|
607
581
|
revision: ZodString;
|
|
608
|
-
operations: ZodArray<ZodObject<{
|
|
582
|
+
operations: ZodArray<ZodLazy<ZodObject<{
|
|
609
583
|
path: ZodString;
|
|
610
584
|
description: ZodOptional<ZodString>;
|
|
611
|
-
input: ZodCustom<Readonly<{
|
|
612
|
-
~standard:
|
|
613
|
-
jsonSchema: Readonly<...>;
|
|
614
|
-
}>;
|
|
585
|
+
input: ZodLazy<ZodCustom<Readonly<{
|
|
586
|
+
~standard: ...;
|
|
615
587
|
}>, Readonly<{
|
|
616
|
-
~standard:
|
|
617
|
-
jsonSchema: Readonly<...>;
|
|
618
|
-
}>;
|
|
619
|
-
}>>;
|
|
620
|
-
output: ZodOptional<ZodCustom<Readonly<{
|
|
621
|
-
~standard: Readonly<{
|
|
622
|
-
jsonSchema: ...;
|
|
623
|
-
}>;
|
|
624
|
-
}>, Readonly<{
|
|
625
|
-
~standard: Readonly<{
|
|
626
|
-
jsonSchema: ...;
|
|
627
|
-
}>;
|
|
588
|
+
~standard: ...;
|
|
628
589
|
}>>>;
|
|
590
|
+
output: ZodOptional<ZodLazy<ZodCustom<Readonly<...>, Readonly<...>>>>;
|
|
629
591
|
capabilityNotes: ZodOptional<ZodString>;
|
|
630
592
|
instructions: ZodOptional<ZodString>;
|
|
631
|
-
}, $strip
|
|
632
|
-
}, $strip
|
|
593
|
+
}, $strip>>>;
|
|
594
|
+
}, $strip>>;
|
|
633
595
|
```
|
|
634
596
|
|
|
635
597
|
Input used to construct one immutable catalog revision.
|
|
@@ -715,8 +677,12 @@ function appToolFamilySchemas(
|
|
|
715
677
|
call: string;
|
|
716
678
|
effect: "write" | "external" | "read";
|
|
717
679
|
requires: readonly (
|
|
680
|
+
| "approvals"
|
|
718
681
|
| "agent.list"
|
|
719
682
|
| "agent.manage"
|
|
683
|
+
| "agent.rename"
|
|
684
|
+
| "agent.avatar"
|
|
685
|
+
| "agent.toolPolicy"
|
|
720
686
|
| "agent.read"
|
|
721
687
|
| "agent.send"
|
|
722
688
|
| "computer.list"
|
|
@@ -760,15 +726,17 @@ arguments; this projection supplies neither defaults nor handlers.
|
|
|
760
726
|
#### Returns
|
|
761
727
|
|
|
762
728
|
\| \{ `name`: `string`; `call`: `string`; `effect`: `"write"` \| `"external"` \|
|
|
763
|
-
`"read"`; `requires`: readonly ( \| `"
|
|
764
|
-
`"agent.
|
|
765
|
-
\| `"
|
|
766
|
-
`"
|
|
767
|
-
|
|
768
|
-
`"
|
|
769
|
-
`"
|
|
770
|
-
`"
|
|
771
|
-
`"
|
|
729
|
+
`"read"`; `requires`: readonly ( \| `"approvals"` \| `"agent.list"` \|
|
|
730
|
+
`"agent.manage"` \| `"agent.rename"` \| `"agent.avatar"` \| `"agent.toolPolicy"`
|
|
731
|
+
\| `"agent.read"` \| `"agent.send"` \| `"computer.list"` \|
|
|
732
|
+
`"computer.readFile"` \| `"computer.writeFile"` \| `"computer.execute"` \|
|
|
733
|
+
`"llm.generation"` \| `"media.generation"` \| `"games:servers"` \|
|
|
734
|
+
`"git.repository"` \| `"apps.open"` \| `"apps.call"` \| `"app.storage"` \|
|
|
735
|
+
`"app.events.emit"` \| `"team.workbenchHost"` \| `"marketplace.browse"` \|
|
|
736
|
+
`"marketplace.purchase"` \| `"workflow.run"` \| `"workflow.publish"` \|
|
|
737
|
+
`"workflow.arm"` \| `"world"` \| `"channels.read"` \|
|
|
738
|
+
`"channels.personal.manage"`)[]; `kind`: `"ready"` \| `"unindexed"`; `tools`:
|
|
739
|
+
`object`[]; \} \| `null`
|
|
772
740
|
|
|
773
741
|
---
|
|
774
742
|
|
package/docs/api/openapi.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/forage",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Pure immutable Zod-typed capability discovery",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@apidevtools/json-schema-ref-parser": "16.0.3",
|
|
32
|
-
"@fungi.computer/puffball": "0.0
|
|
32
|
+
"@fungi.computer/puffball": "0.2.0",
|
|
33
33
|
"yaml": "2.9.0",
|
|
34
34
|
"zod": "4.4.3"
|
|
35
35
|
},
|