/** * API route registration. * * Extracted from start.ts (Task 11 Part B). * Registers ALL REST endpoints, middleware, static file serving, * and wires Dashboard + Wiki agents via AgentProcessManager. */ import express, { type Express } from 'express'; import { AgentLoop } from '../../agent/index.js'; import { GatewayToolExecutor } from '../../agent/gateway-tool-executor.js'; import type { MessageRouter } from '../../gateways/index.js'; import type { SQLiteDatabase } from '../../sqlite.js'; import type { ApiServer } from '../../api/index.js'; import type { OAuthManager } from '../../auth/index.js'; import type { DiscordGateway } from '../../gateways/discord.js'; import type { SlackGateway } from '../../gateways/slack.js'; import type { MAMAConfig } from '../config/types.js'; import type { MAMAApiShape } from './types.js'; import type { AgentEventBus } from '../../multi-agent/agent-event-bus.js'; import type { TaskLedger } from '../../operator/task-ledger.js'; import type { WorkOrderConsumer } from '../../operator/workorder-consumer.js'; import type { ExternalLifecycleCandidateSet } from '../../operator/external-lifecycle.js'; import type { TaskInfo } from '../../connectors/kagemusha/query-tools.js'; import type { PrivateConnectorPolicy } from '../../connectors/private-connector-policy.js'; export interface KagemushaTaskQueryInput { sourceRoom?: string; status?: string; priority?: string; search?: string; limit?: number; } export type KagemushaTaskQuery = (input: KagemushaTaskQueryInput) => TaskInfo[]; export type KagemushaTaskQueryLoader = () => Promise; type ConnectorEventAdapter = { prepare: (sql: string) => { all: (...args: unknown[]) => unknown[]; }; }; /** * Construct the only lifecycle authority a reconcile work order may carry. * Connector rows are parsed one by one: malformed/private-unsupported evidence * becomes bounded diagnostics, while a database failure deliberately throws so * the scheduler retains its unconsumed batch for retry. */ export declare function buildReconcileExternalLifecycleCandidates(input: { eventIds: readonly string[]; getAdapter: () => ConnectorEventAdapter; ledger: TaskLedger; privateConnectorPolicy: PrivateConnectorPolicy; rawConnectorScope: readonly string[]; }): ExternalLifecycleCandidateSet; export declare function registerKagemushaTaskRoute(app: Express, policy: PrivateConnectorPolicy, loadQuery?: KagemushaTaskQueryLoader): void; export interface RegisterApiRoutesParams { config: MAMAConfig; apiServer: ApiServer; eventBus: AgentEventBus; oauthManager: OAuthManager; mamaApi: MAMAApiShape; messageRouter: MessageRouter; agentLoop: AgentLoop; toolExecutor: GatewayToolExecutor; discordGateway: DiscordGateway | null; slackGateway: SlackGateway | null; graphHandler: (req: express.Request, res: express.Response) => Promise; /** Immutable boot snapshot. Private connector access must not be rediscovered per delta. */ privateConnectorPolicy: PrivateConnectorPolicy; /** Immutable boot scope used for raw evidence projection in worker envelopes. */ rawConnectorScope: readonly string[]; /** mama-core getAdapter() — used for DB queries */ getAdapter: () => { prepare: (sql: string) => { get: (...args: unknown[]) => unknown; all: (...args: unknown[]) => unknown[]; }; exec: (sql: string) => void; }; /** Sessions DB for validation */ sessionsDb?: SQLiteDatabase; /** Stage-2 consumer: per-kind completion hooks register here (started by start.ts AFTER this returns). */ workOrderConsumer?: WorkOrderConsumer; /** TG-05/TG-06: owner-report context store for the operator recovery surface. */ reportContextStore?: import('../../gateways/telegram-report-context-store.js').TelegramReportContextStore; } export declare function registerApiRoutes(params: RegisterApiRoutesParams): Promise; export {}; //# sourceMappingURL=api-routes-init.d.ts.map