T8: typed fit.* API registry + fit.status #7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "t8-registry"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
T8: typed
fit.*API registryStacked on #6 (
t6-better-auth) → … → #1. Merge those first.What
defineFn({ path, summary, docs, keywords?, requires?, input: zod, output: zod, examples?, handler })with full input/output type inference.defineNamespacefor docs shared by all functions in a namespace.createRegistry(fns, namespaces):list,search(query, limit≤50),describe(paths≤50),call(path, args, ctx).describereturns JSON Schemas for input and output, generated withz.toJSONSchema.callvalidates the input, runs the handler, then validates the output. Upstream shape drift shows up as a genericinternal_error, with details kept server-side.fit.a.bC), and duplicates are rejected.zkouška=zkouska), matches prefixes from 3 characters, and ranks an exact path first. Keywords carry the Czech synonyms.toErrorPayload):unknown_function,invalid_arguments,not_connected(with the connect URL;NotConnectedErrorfrom T4),reauth_required,upstream_error,temporarily_unavailableandinternal_error.FnContextgives handlersgetToken(provider)(the T4 token store),listConnections(),fetch,nowandconnectUrl. Tokens are only reachable throughgetToken, and outputs are schema-validated.createFnContextbinds a token store to one user.fit.status: which providers are connected and with which scopes, never credentials. It's the first function to call when something reportsnot_connected.GET /api/functions: a public API reference (namespaces, functions, schemas; no user data). The MCP install page (T21) can link to it.Verified
bun run lint && bun run typecheck && bun run test: 111 tests, 22 of them for the registry. They cover path validation, search (including Czech with and without diacritics, namespace keywords, prefixes, exact path, gibberish and limits), describe/schemas, call input and output validation, error mapping and no-echo guarantees, andfit.status.bun run dev+curl /api/functionsreturns thefitnamespace andfit.statuswith input and output schemas.Astra review (gpt-6-astra)
Fixed: (P2)
formatIssuesforwarded zod messages verbatim. Strict-object errors repeat unexpected keys, so{"SECRET-TOKEN":1}was echoed back. Messages are now built from issue codes and schema values only, and non-identifier path segments become*. Test added.Astra also confirmed that
defineFntyping rejects mismatched handler input and output types.🤖 Generated with Claude Code