assistant-cloud
Version:
Cloud integration for assistant-ui
58 lines • 2.08 kB
TypeScript
import { AssistantCloudAuthStrategy } from "./AssistantCloudAuthStrategy.js";
import { AssistantCloudRunReport } from "./AssistantCloudRuns.js";
//#region src/AssistantCloudAPI.d.ts
type AssistantCloudTelemetryConfig = {
enabled?: boolean;
/**
* Called before each telemetry report is sent.
* Return a modified report to enrich it (e.g. add `model_id`),
* or return `null` to skip the report.
*/
beforeReport?: (report: AssistantCloudRunReport) => AssistantCloudRunReport | null;
};
type AssistantCloudConfig = ({
baseUrl: string;
authToken: () => Promise<string | null>;
} | {
baseUrl?: string;
apiKey: string;
userId: string;
workspaceId: string;
} | {
baseUrl: string;
anonymous: true;
}) & {
/**
* Client-side run telemetry reporting. Default: `true`.
*
* When enabled, the SDK automatically reports run metadata (status, step
* count, tool calls, and token usage) to Assistant Cloud after each
* assistant message is saved. No message content is sent.
*
* - `true` / `undefined` — enabled with defaults
* - `false` — disabled
* - `{ beforeReport }` — enabled with a hook to enrich or filter reports
*/
telemetry?: boolean | AssistantCloudTelemetryConfig;
};
declare class CloudAPIError extends Error {
readonly status: number;
constructor(message: string, status: number);
}
type MakeRequestOptions = {
method?: "POST" | "PUT" | "DELETE" | undefined;
headers?: Record<string, string> | undefined;
query?: Record<string, string | number | boolean> | undefined;
body?: object | undefined;
};
declare class AssistantCloudAPI {
_auth: AssistantCloudAuthStrategy;
_baseUrl: string;
constructor(config: AssistantCloudConfig);
initializeAuth(): Promise<boolean>;
makeRawRequest(endpoint: string, options?: MakeRequestOptions): Promise<Response>;
makeRequest(endpoint: string, options?: MakeRequestOptions): Promise<any>;
}
//#endregion
export { AssistantCloudAPI, AssistantCloudConfig, AssistantCloudTelemetryConfig, CloudAPIError };
//# sourceMappingURL=AssistantCloudAPI.d.ts.map