@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
56 lines • 2.75 kB
TypeScript
import type { PathSpec } from '../../types.ts';
import { ApiError } from '../api/errors.ts';
export declare const REFUSED_ERRORS: ReadonlySet<string>;
export interface SlackResponse {
ok: boolean;
error?: string;
needed?: string;
provided?: string;
[key: string]: unknown;
}
export declare class SlackApiError extends ApiError {
readonly endpoint: string;
readonly slackError: string;
readonly needed: string | null;
readonly provided: string | null;
constructor(endpoint: string, slackError: string, needed?: string | null, provided?: string | null, status?: number | null);
}
/**
* Report a conversation Slack will not show as permission denied.
*
* `not_in_channel`, `missing_scope` and the rest are Slack declining to show
* what the path names, never the conversation saying it is empty, so the path
* answers the way a directory the caller may not open does: ls names it and
* fails, find reports it and walks on.
*/
export declare function refusalsDenied<T>(pathSpec: PathSpec, run: () => Promise<T>): Promise<T>;
export interface SlackTransport {
call(endpoint: string, params?: Record<string, string>, body?: unknown): Promise<SlackResponse>;
downloadFile?(url: string, offset?: number, size?: number | null): Promise<Uint8Array>;
downloadFileStream?(url: string, signal?: AbortSignal): AsyncIterable<Uint8Array>;
uploadBytes?(url: string, data: Uint8Array): Promise<void>;
searchAvailable?(): boolean;
searcher?(): SlackTransport | null;
}
export declare abstract class HttpSlackTransport implements SlackTransport {
protected readonly timeout?: number | undefined;
protected readonly fetch: typeof fetch;
constructor(timeout?: number | undefined);
protected abstract baseUrl(): string;
protected abstract authHeaders(endpoint?: string): Promise<Record<string, string>> | Record<string, string>;
call(endpoint: string, params?: Record<string, string>, body?: unknown): Promise<SlackResponse>;
downloadFile(url: string, offset?: number, size?: number | null): Promise<Uint8Array>;
uploadBytes(url: string, data: Uint8Array): Promise<void>;
downloadFileStream(url: string, signal?: AbortSignal): AsyncGenerator<Uint8Array, void>;
}
export declare class NodeSlackTransport extends HttpSlackTransport {
private readonly token;
private readonly searchToken?;
private readonly baseUrlOverride?;
constructor(token: string, searchToken?: string | undefined, baseUrlOverride?: string | undefined, timeout?: number);
protected baseUrl(): string;
protected authHeaders(endpoint?: string): Record<string, string>;
searchAvailable(): boolean;
searcher(): SlackTransport | null;
}
//# sourceMappingURL=client.d.ts.map