schema_registry.ts view source
SchemaRegistry Global instance of the schema registry for convenience.
3 declarations
schema_registry.ts view source
SchemaRegistry Global instance of the schema registry for convenience.
schema_registry.ts view source
A central registry for schemas and actions. Provides a single source of truth for schema definitions.
schemasAll schemas, including model schemas, action params, and responses.
type Array<z.ZodType>
model_schemasModel schemas are distinct from the action schemas. Models are the nouns compared to the Action verbs, and compared to Views they are data not Svelte components.
type Array<z.ZodType>
action_params_schemasAction parameter schemas.
type Array<z.ZodType>
action_response_schemasAction response schemas.
type Array<z.ZodType>
schema_by_nameMap of schema names to schemas.
type Map<VocabName, z.ZodType>
name_by_schemaMap of schemas to their names, for reverse lookup.
Zod schemas don't have a name property and we don't want to abuse description.
type Map<z.ZodType, VocabName>
action_specsCollection of all action specs.
type Array<ActionSpecUnion>
request_response_action_specsCollection of 'request_response' action specs.
type Array<RequestResponseActionSpec>
remote_notification_action_specsCollection of 'remote_notification' action specs.
type Array<RemoteNotificationActionSpec>
local_call_action_specsCollection of 'local_call' action specs.
type Array<LocalCallActionSpec>
action_spec_by_name_mapMap of action spec names to action specs.
type Map<ActionMethod, ActionSpecUnion>
add_schemaAdd a schema to the appropriate registries.
type (name: VocabName, schema: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | { method: string; initiator: "both" | "frontend" | "backend"; side_effects: true | null; ... 5 more ...; async: true; } | { ...; } | { ...; }): void
nameschemaZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | { method: string; initiator: "both" | "frontend" | "backend"; side_effects: true | null; input: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; ... 4 more ...; async: true; } | { ...; } | { ...; }voidregister_manyRegister multiple schemas at once.
type (schemas: Record<string, any>): void
schemasRecord<string, any>voidlookup_schema_nameLookup a schema name, guaranteed to return a string, or throws.
type (schema: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>): VocabName
schemaZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>get_action_specGet an action specification by method name.
type (method: "ping" | "session_load" | "filer_change" | "diskfile_update" | "diskfile_delete" | "directory_create" | "completion_create" | "completion_progress" | "ollama_progress" | ... 15 more ... | "terminal_close"): { ...; } | ... 2 more ... | undefined
method"ping" | "session_load" | "filer_change" | "diskfile_update" | "diskfile_delete" | "directory_create" | "completion_create" | "completion_progress" | "ollama_progress" | ... 15 more ... | "terminal_close"{ method: string; initiator: "both" | "frontend" | "backend"; side_effects: true | null; input: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; output: ZodType<unknown, unknown, $ZodTypeInternals<...>>; description: string; kind: "request_response"; auth: "public" | ... 2 more ... | { ...; }; async: ...get_schemaGet a schema by name.
type (name: VocabName): ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | undefined
nameZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | undefinedschema_registry.ts view source
VocabName