cocottetech/@platform/codebase/@packages/surface-adapter-contracts/src/platform-api.ts

26 lines
1.1 KiB
TypeScript

/**
* Minimal platform.api client surface the adapter contract depends on.
*
* The concrete implementation lives in each ai-core specialist
* (`ai-core/src/context/platform-api.client.ts`, a NestJS provider wrapping
* axios). The contract package only declares the shape actions are allowed to
* use, so that an action file has no dependency on NestJS or axios.
*/
export interface PlatformApiClient {
/** GET `<base>/<path>` with optional query params; resolves the JSON body. */
get<T>(path: string, query?: Record<string, string | number | boolean>): Promise<T>;
/** POST `<base>/<path>` with a JSON body; resolves the JSON response body. */
post<T>(path: string, body: unknown): Promise<T>;
}
/**
* Structured logger the adapter context carries. Deliberately a tiny subset of
* NestJS's `LoggerService` so the contract stays framework-free. Implementations
* MUST never log credential values or raw page content (Layer 7 invariant).
*/
export interface AdapterLogger {
log(message: string): void;
warn(message: string): void;
error(message: string, trace?: string): void;
debug?(message: string): void;
}