UNPKG

@athenox/talos

Version:

Talos: a backend you describe instead of write. Declare a schema, write the rules in plain language, map URLs to sentences; a small built-in model turns them into query plans.

37 lines (36 loc) • 2.42 kB
/** * Talos — a web application whose backend is a small language model. * * You declare a schema, write the rules as ordinary prose, and say who may do * what. The model reads all three together with the request and *generates* the * query plan. There are no route files, no controllers and no `auth.ts`. * * const paper = defineApp({ schema, prompt, store, roles }) * const { plan, status, result, callId } = await paper.run('les articles de sport', ctx) * paper.instanceId // this instance, for support * await paper.feedback(callId, { rating: 4, text: 'right rows, wrong order' }) * * Three things are deliberately not the model's: * * - **Credentials.** `verifyPassword` is scrypt with a constant-time compare. * - **Permission.** `authorise` is ordinary code reading the declared roles. * Over six training runs the model's refusal of out-of-scope requests reached * 1.000 while its denial of *unauthorised* ones stalled at 0.607. * - **Scope.** Owner-scoped rows are pinned to the session by the runtime, * whatever plan came back. */ export { defineApp, authorise, modelRole, checkVocabulary, addSurfaceForms, modelInfo, planText, windowFor, slugify, embed, type Actions, type Ctx, type Shape, type Fn, type Plan, type Schema, type Store, type Table, } from './runtime.ts'; export { getDb, all, one, run, store, ident, lookupIn, beginTrace, endTrace, createTable, createUserTable, addUser, findUser, userById, hashPassword, verifyPassword, type ColumnType, type Trace, } from './db.ts'; export { useSession, type Session } from './session.ts'; export { sentenceRoute, defineRoutes, serveFiles, rateLimit, feed, camelRow, type RouteOptions, type FeedItem } from './http.ts'; export { sqliteStore, mysqlStore } from './stores.ts'; export { localStore } from './local.ts'; export { fromDrizzle } from './drizzle.ts'; export { rank, similar, type RecommendOptions } from './recommend.ts'; export { embedText, classify, cosine, hasEmbedder } from './embed.ts'; export { find, type FindOptions } from './search.ts'; export { syncSchema } from './schema.ts'; export { parseCsv, toCsv, importCsv, connector } from './io.ts'; export { useImages, processImage, type ImageOptions } from './images.ts'; export { accounts, type AccountsOptions } from './accounts.ts'; export { Telemetry, ENDPOINT, type TelemetryOptions } from './telemetry.ts';