/** * @hiai-gg/hiai-observe — TypeScript client SDK for HiAi Observe API. * * Provides typed access to all major resources: issues, monitors, alerts, * traces, logs, releases, team, dashboard, comments, maintenance, incidents, * notifications, and search. * * @example * ```ts * import { HiaiClient } from "@hiai-gg/hiai-observe"; * * const client = new HiaiClient({ * baseUrl: "http://localhost:8001", * apiKey: "ho_your_api_key_here", * }); * * const { data, total } = await client.issues.list({ status: "unresolved" }); * const dashboard = await client.dashboard.get(); * ``` */ export declare class HiaiError extends Error { readonly status: number; readonly body?: unknown | undefined; constructor(message: string, status: number, body?: unknown | undefined); } export interface HiaiClientOptions { /** Base URL of the HiAi Observe instance (e.g. "http://localhost:8001") */ baseUrl: string; /** API key for authentication */ apiKey: string; /** Custom fetch implementation (defaults to global fetch) */ fetch?: typeof globalThis.fetch; } export interface PaginationParams { limit?: number; offset?: number; } export interface PaginatedResponse { data: T[]; total: number; limit: number; offset: number; } export interface Project { id: string; name: string; slug: string; description?: string | null; logoUrl?: string | null; customDomain?: string | null; autoResolveOnDeploy?: boolean; createdAt: string; } export interface Issue { id: string; projectId: string; title: string; type: string; fingerprint: string; status: "unresolved" | "resolved" | "ignored"; count: number; firstSeen: string; lastSeen: string; assignedTo?: string | null; environment?: string | null; metadata?: Record | null; } export interface IssueDetail extends Issue { events: Event[]; } export interface Event { id: string; projectId: string; issueId?: string | null; message?: string | null; exceptionType?: string | null; stackTrace?: string | null; level: string; tags?: Record | null; context?: Record | null; fingerprint?: string | null; sdk?: string | null; environment?: string | null; createdAt: string; } export interface Monitor { id: string; projectId: string; name: string; url: string; type: string; monitorGroup?: string | null; intervalSeconds: number; active: boolean; method?: string | null; headers?: Record | null; body?: string | null; authType?: string | null; ignoreSsl?: boolean; maxRedirects?: number; keyword?: string | null; keywordNot?: string | null; dnsRecordType?: string | null; dnsExpectedValue?: string | null; dnsResolver?: string | null; uptime24h?: number | null; createdAt: string; } export interface MonitorCreateInput { name: string; url: string; project_id: string; type?: string; group?: string; interval_seconds?: number; method?: string; headers?: Record; body?: string; auth_type?: string; auth_value?: string; ignore_ssl?: boolean; max_redirects?: number; keyword?: string; keyword_not?: string; dns_record_type?: string; dns_expected_value?: string; dns_resolver?: string; } export interface MonitorUpdateInput { name?: string; url?: string; interval_seconds?: number; active?: boolean; method?: string; headers?: Record; body?: string; auth_type?: string; auth_value?: string; ignore_ssl?: boolean; max_redirects?: number; keyword?: string; keyword_not?: string; dns_record_type?: string; dns_expected_value?: string; dns_resolver?: string; } export interface AlertCondition { type: "error_rate" | "uptime_down" | "resource_threshold" | "trace_error" | "token_usage"; threshold: number; duration?: number; operator: "gt" | "lt" | "eq" | "gte" | "lte"; consecutiveFailures?: number; resource?: "cpu" | "memory" | "disk"; model?: string; } export interface AlertChannel { type: string; target: string; } export interface Alert { id: string; projectId: string; name: string; severity: "critical" | "warning" | "info"; condition: AlertCondition; channels: AlertChannel[]; isActive: boolean; cooldownSeconds: number; lastTriggered?: string | null; createdAt: string; } export interface AlertCreateInput { name: string; projectId: string; severity?: "critical" | "warning" | "info"; condition: AlertCondition; channels: AlertChannel[]; cooldownSeconds?: number; } export interface AlertUpdateInput { name?: string; severity?: "critical" | "warning" | "info"; condition?: Partial; channels?: AlertChannel[]; isActive?: boolean; cooldownSeconds?: number; } export interface AlertHistoryEntry { id: string; alertId: string; triggeredAt: string; resolvedAt?: string | null; context?: Record | null; } export interface Trace { id: string; projectId: string; traceId: string; spanId: string; parentSpanId?: string | null; name: string; kind?: string | null; status?: string; startTime: string; endTime?: string | null; durationMs?: number | null; attributes?: Record | null; tokenUsage?: { prompt: number; completion: number; total: number; } | null; model?: string | null; createdAt: string; } export interface LogEntry { id: string; containerId: string; containerName: string; stream: string; message: string; level?: string | null; timestamp: string; } export interface Release { id: string; projectId: string; version: string; environment: string; deployedAt?: string | null; createdAt: string; } export interface ReleaseCreateInput { projectId: string; version: string; environment?: "production" | "staging" | "development"; deployedAt?: string; } export interface ReleaseHealth { releaseId: string; version: string; environment: string; newIssuesCount: number; errorRate: number; healthScore: "green" | "yellow" | "red"; windowHours: number; } export interface TeamMember { id: string; projectId: string; name: string; email: string; role: "owner" | "admin" | "member" | "viewer"; createdAt: string; updatedAt?: string | null; } export interface TeamMemberCreateInput { projectId: string; name: string; email: string; role?: "owner" | "admin" | "member" | "viewer"; } export interface TeamMemberUpdateInput { name?: string; email?: string; role?: "owner" | "admin" | "member" | "viewer"; } export interface Comment { id: string; issueId: string; authorName: string; body: string; createdAt: string; } export interface CommentCreateInput { authorName: string; body: string; } export interface MaintenanceWindow { id: string; projectId: string; name: string; description?: string | null; startsAt: string; endsAt: string; monitorIds: string[]; createdAt: string; } export interface MaintenanceWindowCreateInput { projectId: string; name: string; description?: string; startsAt: string; endsAt: string; monitorIds?: string[]; } export interface MaintenanceWindowUpdateInput { name?: string; description?: string; startsAt?: string; endsAt?: string; monitorIds?: string[]; } export interface Incident { id: string; projectId: string; monitorId?: string | null; title: string; status: "investigating" | "identified" | "monitoring" | "resolved"; createdAt: string; updatedAt: string; resolvedAt?: string | null; } export interface IncidentCreateInput { projectId: string; monitorId?: string; title: string; status?: "investigating" | "identified" | "monitoring" | "resolved"; } export interface IncidentUpdateInput { title?: string; status?: "investigating" | "identified" | "monitoring" | "resolved"; monitorId?: string; } export interface DashboardData { errorCount24h: number; uptimePercent: number; activeContainers: number; traceCount24h: number; recentIssues: Array<{ id: string; title: string; type: string; count: number; status: string; lastSeen: string; }>; monitorStatuses: Array<{ id: string; name: string; url: string; active: boolean; isUp: boolean; }>; alertCount: number; errorBuckets: Array<{ hour: string; count: number; }>; traceBuckets: Array<{ hour: string; count: number; }>; } export interface NotificationConfig { id: string; projectId: string; channel: string; config: Record; enabled: boolean; configured: boolean; createdAt: string; updatedAt?: string | null; } export interface SearchResults { issues: Array; events: Array; traces: Array; } type FetchFn = (url: string, init?: RequestInit) => Promise; declare class IssuesResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List issues with optional filters */ list(params?: { projectId?: string; status?: string; search?: string; environment?: string; level?: string; limit?: number; offset?: number; }): Promise>; /** Get issue detail with recent events */ get(id: string): Promise; /** Update issue status or assignment */ update(id: string, data: { status?: string; assignedTo?: string | null; }): Promise; /** Delete an issue and its events */ delete(id: string): Promise<{ deleted: boolean; }>; /** Merge source issues into a target */ merge(targetIssueId: string, sourceIssueIds: string[]): Promise<{ merged: number; targetIssueId: string; totalEvents: number; }>; /** List comments for an issue */ listComments(issueId: string, params?: PaginationParams): Promise>; /** Add comment to an issue */ addComment(issueId: string, data: CommentCreateInput): Promise; } declare class EventsResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List events */ list(params?: { issueId?: string; projectId?: string; limit?: number; offset?: number; }): Promise>; /** Get single event */ get(id: string): Promise; } declare class MonitorsResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List monitors with uptime */ list(params?: { project_id?: string; group?: string; hours?: number; }): Promise<{ monitors: Monitor[]; }>; /** Get monitor detail */ get(id: string): Promise<{ monitor: Monitor; }>; /** Create a monitor */ create(data: MonitorCreateInput): Promise<{ monitor: Monitor; }>; /** Update a monitor */ update(id: string, data: MonitorUpdateInput): Promise<{ monitor: Monitor; }>; /** Delete a monitor */ delete(id: string): Promise<{ deleted: boolean; }>; /** Get monitor groups */ groups(projectId?: string): Promise<{ groups: string[]; }>; /** Get check history for a monitor */ checks(id: string, params?: { limit?: number; offset?: number; from?: string; to?: string; }): Promise<{ data: unknown[]; total: number; }>; } declare class AlertsResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List alert rules */ list(params?: { projectId?: string; search?: string; limit?: number; offset?: number; }): Promise<{ items: Alert[]; total: number; limit: number; offset: number; }>; /** Get alert detail with history */ get(id: string): Promise; /** Create alert rule */ create(data: AlertCreateInput): Promise; /** Update alert rule */ update(id: string, data: AlertUpdateInput): Promise; /** Delete alert rule */ delete(id: string): Promise<{ deleted: boolean; }>; /** Test a single alert */ test(id: string): Promise; /** Test all active alerts */ testAll(): Promise<{ message: string; results: unknown[]; }>; /** List alert trigger history */ history(params?: { alertId?: string; limit?: number; offset?: number; }): Promise<{ items: AlertHistoryEntry[]; total: number; }>; /** List available notification channels */ channels(): Promise<{ channels: unknown[]; }>; } declare class TracesResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List traces with filters */ list(params?: { projectId?: string; traceId?: string; workflowName?: string; agentName?: string; status?: string; from?: string; to?: string; limit?: number; offset?: number; }): Promise<{ data: Trace[]; total: number; limit: number; offset: number; }>; /** Get trace detail with span tree */ get(id: string): Promise; /** Aggregated stats (token usage + latency) */ stats(projectId: string, params?: { from?: string; to?: string; groupBy?: string; }): Promise<{ tokenUsage: unknown; latency: unknown; }>; /** List workflow runs */ workflows(params?: { projectId?: string; workflowName?: string; status?: string; limit?: number; offset?: number; }): Promise; /** Get workflow run detail */ getWorkflow(id: string): Promise; } declare class LogsResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** Search logs */ search(params?: { container?: string; level?: string; search?: string; regex?: string; fuzzy?: string; from?: string; to?: string; limit?: number; offset?: number; }): Promise<{ data: { logs: LogEntry[]; total: number; limit: number; offset: number; }; }>; /** Log statistics (24h) */ stats(): Promise<{ total24h: number; byLevel: Record; byContainer: Array<{ name: string; count: number; }>; byHour: Array<{ hour: string; count: number; }>; }>; /** Log volume over time */ volume(params?: { interval?: string; containerId?: string; from?: string; to?: string; }): Promise<{ data: unknown[]; }>; /** List log containers */ containers(): Promise<{ data: string[]; }>; /** Clear logs before a timestamp */ clear(before?: string): Promise<{ deleted: number; }>; } declare class ReleasesResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List releases */ list(params?: { projectId?: string; environment?: string; limit?: number; offset?: number; }): Promise>; /** Get release detail */ get(id: string): Promise; /** Create a release */ create(data: ReleaseCreateInput): Promise; /** Update a release */ update(id: string, data: { version?: string; environment?: string; deployedAt?: string; }): Promise; /** Delete a release */ delete(id: string): Promise<{ deleted: boolean; }>; /** Get release health metrics */ health(id: string): Promise; } declare class TeamResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List team members */ list(params?: { projectId?: string; limit?: number; offset?: number; }): Promise>; /** Add team member */ create(data: TeamMemberCreateInput): Promise; /** Update team member */ update(id: string, data: TeamMemberUpdateInput): Promise; /** Remove team member */ delete(id: string): Promise<{ deleted: boolean; }>; } declare class CommentsResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** Delete a comment */ delete(id: string): Promise<{ deleted: boolean; }>; } declare class MaintenanceResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List maintenance windows */ list(params?: { projectId?: string; status?: string; limit?: number; offset?: number; }): Promise<{ items: MaintenanceWindow[]; total: number; }>; /** Get currently active maintenance windows */ activeNow(projectId?: string): Promise<{ items: MaintenanceWindow[]; }>; /** Get maintenance window */ get(id: string): Promise; /** Create maintenance window */ create(data: MaintenanceWindowCreateInput): Promise; /** Update maintenance window */ update(id: string, data: MaintenanceWindowUpdateInput): Promise; /** Delete maintenance window */ delete(id: string): Promise<{ deleted: boolean; }>; } declare class IncidentsResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List incidents */ list(params?: { projectId?: string; status?: string; limit?: number; offset?: number; }): Promise<{ items: Incident[]; total: number; }>; /** Get active (non-resolved) incidents */ active(projectId?: string): Promise<{ items: Incident[]; }>; /** Get incident */ get(id: string): Promise; /** Create incident */ create(data: IncidentCreateInput): Promise; /** Update incident */ update(id: string, data: IncidentUpdateInput): Promise; /** Delete incident */ delete(id: string): Promise<{ deleted: boolean; }>; } declare class NotificationsResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List notification configs */ list(projectId?: string): Promise<{ notifications: NotificationConfig[]; }>; /** Get notification channel config */ get(channel: string, projectId?: string): Promise; /** Upsert notification channel config */ upsert(channel: string, data: { projectId: string; config: Record; enabled?: boolean; }): Promise; /** Delete notification channel config */ delete(channel: string, projectId?: string): Promise<{ deleted: boolean; }>; /** Test a notification channel */ test(channel: string, projectId?: string): Promise; } declare class SearchResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** Cross-project search across issues, events, and traces */ search(q: string, params?: { projectId?: string; limit?: number; }): Promise; } declare class ProjectsResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** List all projects */ list(): Promise<{ projects: Project[]; }>; /** Create a project */ create(data: { name: string; }): Promise<{ project: Project; apiKey: string; }>; /** Delete a project and all its data */ delete(id: string): Promise<{ deleted: boolean; }>; /** Rotate project API key */ rotateKey(id: string): Promise<{ apiKey: string; }>; } declare class DashboardResource { private readonly fetch; private readonly baseUrl; private readonly apiKey; constructor(fetch: FetchFn, baseUrl: string, apiKey: string); /** Get aggregated dashboard data */ get(projectId?: string): Promise; } /** * HiAi Observe client SDK. * * @example * ```ts * const client = new HiaiClient({ * baseUrl: "http://localhost:8001", * apiKey: "ho_abc123", * }); * * // List unresolved issues * const { data } = await client.issues.list({ status: "unresolved" }); * * // Get dashboard summary * const dash = await client.dashboard.get(); * * // Create a monitor * await client.monitors.create({ name: "API", url: "https://api.example.com/health", project_id: "..." }); * * // Search across everything * const results = await client.search.search("timeout"); * ``` */ export declare class HiaiClient { private readonly fetch; private readonly baseUrl; private readonly apiKey; /** Issue tracking */ readonly issues: IssuesResource; /** Error events */ readonly events: EventsResource; /** Uptime monitors */ readonly monitors: MonitorsResource; /** Alert rules and history */ readonly alerts: AlertsResource; /** Distributed traces */ readonly traces: TracesResource; /** Container log search */ readonly logs: LogsResource; /** Release tracking */ readonly releases: ReleasesResource; /** Team members */ readonly team: TeamResource; /** Issue comments */ readonly comments: CommentsResource; /** Maintenance windows */ readonly maintenance: MaintenanceResource; /** Incident lifecycle */ readonly incidents: IncidentsResource; /** Notification channel config */ readonly notifications: NotificationsResource; /** Cross-project search */ readonly search: SearchResource; /** Project management */ readonly projects: ProjectsResource; /** Aggregated dashboard */ readonly dashboard: DashboardResource; constructor(options: HiaiClientOptions); /** Get the OpenAPI spec from the server */ openapi(): Promise>; } export {}; //# sourceMappingURL=client.d.ts.map