import { type ServerOptions, type Skill } from '@janux/server'; import type { AgentsAuthConfig, CacheConfig, CspConfig, FontConfig, JanuxConfig, JanuxOutput, McpAuthConfig, NavigationConfig, RedirectRule, RewriteRule, ServiceWorkerConfig } from 'janux'; export type { JanuxOutput } from 'janux'; export { registerInstrumentation, type InstrumentationModule } from './instrumentation.js'; export { builtFontAssets } from './fonts.js'; export { builtServiceWorker, SERVICE_WORKER_FILE } from './service-worker.js'; export { scheduleFiles, scheduleName, scheduleConfigFile, scheduleServerOptions } from './schedules.js'; export { channelFiles, channelName, channelServerOptions } from './channels.js'; export type JanuxPluginOptions = JanuxConfig; export interface JanuxAppConfig { root: string; routesDir: string; serverDir: string; clientEntry: string; /** Compiler evolution switches, as configured (defaults applied where they are read). */ compiler?: JanuxConfig['compiler']; agentModule?: string; storesModule?: string; i18nModule?: string; middlewareModule?: string; ctxModule?: string; /** `src/session.ts`, whose default export is the app's `SessionStore`. */ sessionModule?: string; /** * `src/sw.ts`, the app's service worker. Its presence is the opt-in: without * the file nothing is built, nothing is registered, and the shell is byte * for byte what it was before the feature existed. */ serviceWorkerEntry?: string; matchersModule?: string; websocketModule?: string; /** `src/schedules/`, when the app has one — each file is a schedule (see `schedules.ts`). */ schedulesDir?: string; /** `src/channels/`, when the app has one — each file is an inbound surface (see `channels.ts`). */ channelsDir?: string; /** * `src/skills/**`, parsed. Data rather than a directory, so a bundled * deployment carries the procedures inside its config instead of hoping the * markdown made it into the serverless function. */ skills: Skill[]; /** `src/feed.ts`, whose default export is the app's `FeedConfig`. */ feedModule?: string; /** `src/instrumentation.ts`, loaded and `register()`ed before the server serves. */ instrumentationModule?: string; mcpAuth?: McpAuthConfig; agents?: AgentsAuthConfig; httpHandlersDir?: string; stylesheet?: string; favicon?: string; /** `/manifest.webmanifest` when `public/` holds one: what makes the app installable. */ webManifest?: string; title?: string; lang?: string; siteUrl?: string; inlineStyles?: boolean; llmsTxt?: { title?: string; description?: string; }; output: JanuxOutput; /** Fonts to self-host, as declared in janux.config.ts. */ fonts: FontConfig[]; /** Legacy URLs answered with a 3xx, as declared in janux.config.ts. */ redirects?: RedirectRule[]; /** URLs served by another route of this app, as declared in janux.config.ts. */ rewrites?: RewriteRule[]; navigation?: NavigationConfig; csp?: boolean | CspConfig; cache?: CacheConfig; serviceWorker?: ServiceWorkerConfig; } /** * The app root, published for the app's own modules to read. * * A module that finds its data files with `import.meta.dirname` gets the * *bundle's* directory once bundled, which is why the Vercel adapter has always * set this before importing the app. Every path that boots an app publishes it * too, so `dir: 'content/notes'` is not secretly a promise about the working * directory. * * Called when an app is *served*, never merely when its config is read: tooling * resolves the config of apps it will not run, and a stale root is worse than * no root — it points a running app's modules at someone else's files. */ export declare function publishAppRoot(root: string): void; /** * A path in its forward-slash form, whatever OS produced it. * * Everything the framework derives from `relative()` — generated import * specifiers, dev URLs, the route reports `janux info` prints — must read the * same on Windows, where `relative()` answers with backslashes. */ export declare function toPosix(path: string): string; /** Resolves the conventional app layout: src/routes, src/server, src/client.ts, src/agent.ts, src/stores.ts. */ export declare function resolveAppConfig(root: string, pluginOptions?: JanuxPluginOptions): Promise; /** * The `ServerOptions` fields the HTML shell reads. Dev (the Vite plugin) and * prod (`janux build` / `janux start`) resolve the same app config, so they map * these in one place: the favicon was wired in dev and forgotten in prod, and * every build shipped a shell with no icon link — a 404 `/favicon.ico` on every * page. The stylesheet URL is the one field that legitimately differs, so it * comes from the caller. */ export declare function shellOptions(app: JanuxAppConfig, stylesheets: string[], fonts?: Pick): Pick; /** * The declared migration map, on its way to the server that applies it. * * Same reasoning as `shellOptions`: dev (the Vite plugin) and prod * (`janux build` / `janux start`) build their `ServerOptions` separately, and a * routing field wired into one and forgotten in the other is a redirect that * works locally and 404s in production. */ export declare function routingOptions(app: JanuxAppConfig): Pick; /** * `mcpAuth` in janux.config.ts → the bearer verifier `ServerOptions` takes. * The env var (`tokenEnv`) is read here, at boot, and wins over the literal * `token`; declaring neither leaves the endpoint open, exactly as before. */ export declare function mcpAuthOptions(config: McpAuthConfig | undefined): ServerOptions['mcpAuth']; export declare function apiFiles(serverDir: string): string[]; /** `src/server/shop.api.ts` → `shop`: the prefix its exports get as tools. */ export declare function apiModuleName(filePath: string): string;