/** * Nucleus HTTP Adapter — semantic convenience surface (Phase 0) * * IMPORTANT: MCP is the new standard (just as Dynamo is the established standard * for the external governance signal). The canonical way for agents to call the * nucleus is the first-class MCP tools (`govern_proposals`, `govern_reflection`) * exposed by the governance MCP server (which already supports stdio + Streamable * HTTP transport on /mcp and already delegates to the same GovernanceService). * * This module provides the *direct semantic convenience adapter*: * - Pure `handleGovernRequest(body)` → returns the raw GovernanceResponse object. * - Optional tiny Express app with `POST /govern` (and /health). * - No full MCP JSON-RPC protocol overhead — ideal for curl, CI, simple bridges, * or anything that just wants the decision without speaking MCP. * * It reuses the exact same kernel (getGovernanceService + types) as the MCP path. * Zero impact on the federation or existing MCP surfaces. * * Design goals: * - Framework-agnostic pure handler (usable by Express, Fastify, raw http, tests, or in-process). * - Only frameworkLogger. * - Follows the thin-wrapper style of APITrigger. * * Usage (embeddable / in-process): * import { handleGovernRequest } from './nucleus/govern-http.js'; * const result = await handleGovernRequest(req.body); * * Usage (standalone): * NUCLEUS_PORT=8787 node dist/nucleus/govern-http.js */ import express from 'express'; import type { GovernanceResponse } from '../governance/governance-types.js'; export interface GovernHTTPConfig { path?: string; apiKey?: string; enabled?: boolean; port?: number; } /** * Pure handler. Can be used by any HTTP server (Express, Fastify, raw http, etc.) * or called directly in tests / in-process. */ export declare function handleGovernRequest(body: unknown, options?: { requireExternalDynamo?: boolean; }): Promise; /** * Minimal Express app (prototype only). * Mirrors the shape and logging discipline of APITrigger. */ export declare class GovernHTTPAdapter { private app; private config; private initialized; constructor(config?: GovernHTTPConfig); initialize(): Promise; getApp(): express.Application; listen(): Promise; shutdown(): void; }