示例工程 18-streaming-ui
18-streaming-ui/app/.tsc/shared/ipc.d.ts
export declare const CH: {
readonly start: "stream:start";
readonly cancel: "stream:cancel";
readonly port: "stream:port";
};
export type StreamOptions = {
chunks: number;
intervalMs: number;
shuffle: boolean;
from: number;
};
export type StreamMessage = {
type: "chunk";
seq: number;
token: string;
at: number;
} | {
type: "done";
total: number;
lastSeq: number;
} | {
type: "cancelled";
sent: number;
};
export type StartResult = {
ok: true;
streamId: string;
from: number;
to: number;
} | {
ok: false;
code: string;
};
export type Api = {
start(options: StreamOptions): Promise<StartResult>;
cancel(): Promise<{
ok: boolean;
}>;
onStream(cb: (message: StreamMessage) => void): () => void;
};
//# sourceMappingURL=ipc.d.ts.map