Files
openclaw/src/transcripts/provider-types.ts
Peter Steinberger cac0b2db18 refactor: move transcripts into core
Move meeting notes into core transcripts, remove the bundled meeting-notes plugin/API, and require explicit transcripts.enabled before exposing the recording-capable tool.
2026-05-26 14:51:11 +01:00

110 lines
2.5 KiB
TypeScript

import type { OpenClawConfig } from "../config/types.openclaw.js";
export type TranscriptSourceKind =
| "live-audio"
| "live-caption"
| "posthoc-transcript"
| "recording-stt";
export type TranscriptSourceLocator = {
providerId: string;
kind?: TranscriptSourceKind;
accountId?: string;
guildId?: string;
channelId?: string;
meetingUrl?: string;
threadTs?: string;
fileId?: string;
[key: string]: string | undefined;
};
export type TranscriptParticipant = {
id?: string;
label: string;
};
export type TranscriptUtterance = {
id?: string;
sessionId?: string;
startedAt?: string;
endedAt?: string;
speaker?: TranscriptParticipant;
text: string;
final?: boolean;
metadata?: Record<string, unknown>;
};
export type TranscriptSessionDescriptor = {
sessionId: string;
title?: string;
source: TranscriptSourceLocator;
startedAt: string;
stoppedAt?: string;
metadata?: Record<string, unknown>;
};
export type TranscriptStartRequest = {
cfg?: OpenClawConfig;
session: TranscriptSessionDescriptor;
abortSignal?: AbortSignal;
startupWaitMs?: number;
onUtterance: (utterance: TranscriptUtterance) => void | Promise<void>;
onStatus?: (status: TranscriptSourceStatus) => void | Promise<void>;
};
export type TranscriptsStartResult =
| {
ok: true;
session: TranscriptSessionDescriptor;
}
| {
ok: false;
error: string;
};
export type TranscriptStopRequest = {
cfg?: OpenClawConfig;
sessionId: string;
source: TranscriptSourceLocator;
reason?: string;
};
export type TranscriptsStopResult =
| {
ok: true;
sessionId: string;
stoppedAt?: string;
}
| {
ok: false;
error: string;
};
export type TranscriptSourceStatus = {
sessionId?: string;
active: boolean;
message?: string;
source?: TranscriptSourceLocator;
};
export type TranscriptImportRequest = {
cfg?: OpenClawConfig;
session: TranscriptSessionDescriptor;
text: string;
speakerLabel?: string;
};
export type TranscriptSourceProvider = {
id: string;
aliases?: readonly string[];
name: string;
sourceKinds: readonly TranscriptSourceKind[];
start?: (request: TranscriptStartRequest) => Promise<TranscriptsStartResult>;
stop?: (request: TranscriptStopRequest) => Promise<TranscriptsStopResult>;
status?: (
source: TranscriptSourceLocator,
cfg?: OpenClawConfig,
) => Promise<TranscriptSourceStatus[]>;
importTranscript?: (request: TranscriptImportRequest) => Promise<TranscriptUtterance[]>;
};