@fungi.computer/forage 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/dist/app-api.d.ts +3 -3
- package/dist/app-api.js +7 -7
- 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/schemas.d.ts +33 -33
- package/dist/schemas.js +21 -23
- package/package.json +2 -2
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 ("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 ("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 ("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. */
|
|
@@ -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/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/forage",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.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.1.0",
|
|
33
33
|
"yaml": "2.9.0",
|
|
34
34
|
"zod": "4.4.3"
|
|
35
35
|
},
|