/** * Map a Nitro-style route file path to { method, route }. * * Examples: * api/emails/index.get.ts → GET /api/emails * api/emails/[id].get.ts → GET /api/emails/:id * api/emails/[id]/star.patch.ts→ PATCH /api/emails/:id/star * api/events.get.ts → GET /api/events */ export declare function parseRouteFile(relPath: string): { method: string; route: string; } | null; /** * Recursively discover all .ts files under a directory. */ export declare function discoverFiles(dir: string, prefix?: string): Promise; export interface DiscoveredRoute { method: string; route: string; /** Relative path from server/routes/ */ filePath: string; /** Absolute path on disk */ absPath: string; } /** * Discover all API routes in a project's server/routes/ directory. */ export declare function discoverApiRoutes(cwd: string): Promise; /** * Discover all server plugins in a project's server/plugins/ directory. */ export declare function discoverPlugins(cwd: string): Promise; /** * Default plugins that auto-mount when not provided by the template. * Key = filename stem, value = export name from @agent-native/core/server/edge. */ export declare const DEFAULT_PLUGIN_REGISTRY: Record; export interface DiscoveredAction { /** Action name (filename without extension) */ name: string; /** Absolute path to the action file */ absPath: string; /** HTTP method (from defineAction's http config, default POST) */ method: string; /** * Custom route segment from defineAction's `http.path`. When unset the * route falls back to `name`, mirroring the runtime mount * (`action-routes.ts`: `path = http?.path ?? name`). */ path?: string; } /** * Statically extract the `http` config from a defineAction source file. * * Deploy discovery cannot import the action module — edge bundlers rewrite * require()/import in ways that crash (see getFs note above), and action * files often pull in Node-only deps — so we parse the source text instead. * The parse is scoped to the `http: { ... }` object literal so unrelated * `method:`/`path:` keys elsewhere in the file (e.g. a * `fetch(url, { method: "GET" })` in the action body) cannot flip the * route's method. A naive `content.includes('method: "GET"')` did exactly * that, and it also missed PUT/PATCH/DELETE and dropped `http.path`. * * The http config may contain nested object literals before `method` or * `path`, so extract the object body with a small balanced-brace scan rather * than a non-greedy regex that stops at the first closing brace. * * Returns `false` when the action opts out of HTTP (`http: false`); otherwise * `{ method, path? }` with method lowercased and defaulting to "post". */ export declare function parseActionHttpConfig(content: string): false | { method: string; path?: string; }; /** * Discover action files in the actions/ directory. * * When a workspace core is present in the ancestor chain, its actions/ * directory is also scanned and its actions are merged in after the * template's — with template actions winning on name collision. * * These become `/_agent-native/actions/:name` HTTP endpoints. */ export declare function discoverActionFiles(cwd: string): Promise; /** * Returns the stems of default plugins that are missing from the project. */ export declare function getMissingDefaultPlugins(cwd: string): Promise; //# sourceMappingURL=route-discovery.d.ts.map