API reference
See the generated Forage API reference. It covers
Forage.createCatalog, the createCatalog function, operation definitions, and
the search and description result types.
Classes
Section titled “Classes”ForageError
Section titled “ForageError”A bounded, machine-readable failure at a Forage public seam.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ForageError(
code,message,options?):ForageError
Parameters
Section titled “Parameters”"empty_query" | "empty_catalog" | "unknown_target" |
"duplicate_operation" | "invalid_input"
message
Section titled “message”string
options?
Section titled “options?”ErrorOptions
Returns
Section titled “Returns”Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”
readonlycode:"empty_query"|"empty_catalog"|"unknown_target"|"duplicate_operation"|"invalid_input"
failure
Section titled “failure”
readonlyfailure:object
code:
"empty_query"|"empty_catalog"|"unknown_target"|"duplicate_operation"|"invalid_input"
message
Section titled “message”message:
string
Type Aliases
Section titled “Type Aliases”ForageCatalog
Section titled “ForageCatalog”ForageCatalog =
Readonly<{revision:string;search: (rawInput) =>SearchOutput;describe: (rawInput) =>DescribeOutput;list: (rawInput) =>ListOutput;stamp: () =>string; }>
Immutable public facade for one prepared catalog revision.
ForageDefinition
Section titled “ForageDefinition”ForageDefinition =
Readonly<{replay:"safe";path:string;description:string;input: typeofforageSearchInput| typeofforageDescribeInput| typeofforageListInput;output: typeofsearchOutputSchema| typeofdescribeOutputSchema| typeoflistOutputSchema; }>
Structural operation definition consumed by a capability composer.
ForageApi
Section titled “ForageApi”ForageApi =
object
Public convenience namespace contract.
Properties
Section titled “Properties”createCatalog
Section titled “createCatalog”createCatalog: typeof
createCatalog
Construct one immutable catalog revision.
forageSearchDefinition
Section titled “forageSearchDefinition”forageSearchDefinition: typeof
forageSearchDefinition
Structural search operation definition.
forageDescribeDefinition
Section titled “forageDescribeDefinition”forageDescribeDefinition: typeof
forageDescribeDefinition
Structural description operation definition.
forageListDefinition
Section titled “forageListDefinition”forageListDefinition: typeof
forageListDefinition
Structural exhaustive listing definition.
ForageSearchInput
Section titled “ForageSearchInput”ForageSearchInput =
z.input<typeofforageSearchInput>>
Parsed search request type.
ForageListInput
Section titled “ForageListInput”ForageListInput =
z.input<typeofforageListInput>>
Exhaustive listing request type.
ListOutput
Section titled “ListOutput”ListOutput =
z.infer<typeoflistOutputSchema>>
Exhaustive page response type.
ForageDescribeInput
Section titled “ForageDescribeInput”ForageDescribeInput =
z.input<typeofforageDescribeInput>>
Parsed description request type.
SearchResult
Section titled “SearchResult”SearchResult =
z.infer<typeofsearchResultSchema>>
One ranked search result type.
SearchOutput
Section titled “SearchOutput”SearchOutput =
z.infer<typeofsearchOutputSchema>>
Search response envelope type.
DescribeOutput
Section titled “DescribeOutput”DescribeOutput =
z.infer<typeofdescribeOutputSchema>>
Description response type.
ForageFailure
Section titled “ForageFailure”ForageFailure =
z.infer<typeofforageFailureSchema>>
Typed failure value type.
Operation
Section titled “Operation”Operation =
z.infer<typeofoperationSchema>>
Catalog operation descriptor type.
CatalogInput
Section titled “CatalogInput”CatalogInput =
z.input<typeofcatalogInputSchema>>
Catalog construction input type.
Variables
Section titled “Variables”forageSearchDefinition
Section titled “forageSearchDefinition”
constforageSearchDefinition:ForageDefinition
The search operation has schema metadata only; it has no host behavior.
forageDescribeDefinition
Section titled “forageDescribeDefinition”
constforageDescribeDefinition:ForageDefinition
The description operation has schema metadata only; it has no host behavior.
forageListDefinition
Section titled “forageListDefinition”
constforageListDefinition:ForageDefinition
Pure exhaustive catalog listing; no execution or authority is granted.
Forage
Section titled “Forage”
constForage:ForageApi
Narrow convenience namespace for the package’s public seams.
forageSearchInput
Section titled “forageSearchInput”
constforageSearchInput:ZodObject<{query:ZodString;maxResults:ZodDefault<ZodNumber>>; },$strip>>
Input accepted by the pure catalog search seam.
forageDescribeInput
Section titled “forageDescribeInput”
constforageDescribeInput:ZodObject<{path:ZodString;detail:ZodDefault<ZodEnum<{index:"index";full:"full"; }>>;methods:ZodOptional<ZodArray<ZodString>>>>; },$strip>>
Input accepted by the pure catalog description seam.
forageListInput
Section titled “forageListInput”
constforageListInput:ZodObject<{cursor:ZodOptional<ZodString>>;limit:ZodDefault<ZodNumber>>;namespace:ZodOptional<ZodString>>; },$strip>>
Exhaustive listing request; cursor is scoped to one immutable catalog and filter.
searchResultSchema
Section titled “searchResultSchema”
constsearchResultSchema:ZodObject<{path:ZodString;description:ZodOptional<ZodString>>;score:ZodNumber;matchReason:ZodOptional<ZodString>>;sample:ZodOptional<ZodRecord<ZodString,ZodJSONSchema>>>>;capabilityNotes:ZodOptional<ZodString>>;peers:ZodOptional<ZodArray<ZodObject<{path:ZodString;capabilityNotes:ZodOptional<ZodString>>; },$strip>>>>>>; },$strip>>
One ranked operation in a search response.
searchOutputSchema
Section titled “searchOutputSchema”
constsearchOutputSchema:ZodObject<{results:ZodArray<ZodObject<{path:ZodString;description:ZodOptional<ZodString>>;score:ZodNumber;matchReason:ZodOptional<ZodString>>;sample:ZodOptional<ZodRecord<ZodString,ZodJSONSchema>>>>;capabilityNotes:ZodOptional<ZodString>>;peers:ZodOptional<ZodArray<ZodObject<{path:ZodString;capabilityNotes:ZodOptional<ZodString>>; },$strip>>>>>>; },$strip>>>>;total:ZodNumber;truncated:ZodBoolean;topScore:ZodNumber;margin:ZodNumber;catalogStamp:ZodString; },$strip>>
Bounded search response envelope.
listOutputSchema
Section titled “listOutputSchema”
constlistOutputSchema:ZodObject<{results:ZodArray<ZodObject<{path:ZodString;description:ZodOptional<ZodString>>;score:ZodNumber;matchReason:ZodOptional<ZodString>>;sample:ZodOptional<ZodRecord<ZodString,ZodJSONSchema>>>>;capabilityNotes:ZodOptional<ZodString>>;peers:ZodOptional<ZodArray<ZodObject<{path:ZodString;capabilityNotes:ZodOptional<ZodString>>; },$strip>>>>>>; },$strip>>>>;total:ZodNumber;nextCursor:ZodNullable<ZodString>>;catalogStamp:ZodString; },$strip>>
One exhaustive page, using the exact search operation summary schema.
describeOutputSchema
Section titled “describeOutputSchema”
constdescribeOutputSchema:ZodObject<{path:ZodString;description:ZodOptional<ZodString>>;types:ZodString;kind:ZodEnum<{module:"module";operation:"operation"; }>;usage:ZodOptional<ZodString>>; },$strip>>
Deterministic description response.
forageFailureSchema
Section titled “forageFailureSchema”
constforageFailureSchema:ZodObject<{code:ZodEnum<{empty_query:"empty_query";empty_catalog:"empty_catalog";unknown_target:"unknown_target";duplicate_operation:"duplicate_operation";invalid_input:"invalid_input"; }>;message:ZodString; },$strip>>
Closed failure vocabulary for malformed or absent catalog requests.
operationSchema
Section titled “operationSchema”
constoperationSchema:ZodObject<{path:ZodString;description:ZodOptional<ZodString>>;input:ZodCustom<ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>>>,ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>>>>>;output:ZodOptional<ZodCustom<ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>>>,ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>>>>>>>;capabilityNotes:ZodOptional<ZodString>>;instructions:ZodOptional<ZodString>>; },$strip>>
A secret-free, callback-free operation descriptor.
catalogInputSchema
Section titled “catalogInputSchema”
constcatalogInputSchema:ZodObject<{revision:ZodString;operations:ZodArray<ZodObject<{path:ZodString;description:ZodOptional<ZodString>>;input:ZodCustom<ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>>>,ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>>>>>;output:ZodOptional<ZodCustom<ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>>>,ZodType<unknown,unknown,$ZodTypeInternals<unknown,unknown>>>>>>>>;capabilityNotes:ZodOptional<ZodString>>;instructions:ZodOptional<ZodString>>; },$strip>>>>; },$strip>>
Input used to construct one immutable catalog revision.
Functions
Section titled “Functions”createCatalog()
Section titled “createCatalog()”createCatalog(
input):ForageCatalog
Construct one immutable catalog revision with a narrow public facade.
Parameters
Section titled “Parameters”revision
Section titled “revision”string = ...
operations
Section titled “operations”object[] = ...
Returns
Section titled “Returns”listOperations()
Section titled “listOperations()”listOperations(
operations,catalogStamp,rawInput):object
Page a trusted immutable operation-summary view. Hosts may filter the existing catalog to their bound operations before paging; this is the one cursor owner. Order is namespace then full path, compared by UTF-16 code units, never locale. Unlike search, no equivalent operations are merged into peers.
Parameters
Section titled “Parameters”operations
Section titled “operations”readonly object[]
catalogStamp
Section titled “catalogStamp”string
rawInput
Section titled “rawInput”cursor?
Section titled “cursor?”string = ...
limit?
Section titled “limit?”number = ...
namespace?
Section titled “namespace?”string = ...
Returns
Section titled “Returns”object
results
Section titled “results”results:
object[]
total:
number
nextCursor
Section titled “nextCursor”nextCursor:
string|null
catalogStamp
Section titled “catalogStamp”catalogStamp:
string
References
Section titled “References”default
Section titled “default”Renames and re-exports Forage