repositories / pi-ext
pi-ext
bugabingas pi extensions
owned by admin
extensions/activity/types.ts
Rawexport type ActivityStatus =
| "running"
| "stopping"
| "completed"
| "failed"
| "stopped";
export type ActivityKind = "process" | "terminal" | "watch" | "timer";
export type StartCommon = {
title?: string;
notify?: boolean;
timeoutMs?: number;
};
export type ProcessStart = StartCommon & {
kind: "process" | "terminal";
command: string;
args?: string[];
cwd?: string;
cols?: number;
rows?: number;
match?: string;
stopOnMatch?: boolean;
};
export type WatchStart = StartCommon & {
kind: "watch";
path: string;
recursive?: boolean;
};
export type TimerStart = StartCommon & {
kind: "timer";
delayMs: number;
repeat?: boolean;
};
export type ActivityStart = ProcessStart | WatchStart | TimerStart;
export type ActivityEvent = {
sequence: number;
type: "output" | "change" | "tick" | "exit" | "error" | "stop" | "match";
time: number;
text?: string;
};
export type TerminalScreen = {
text: string;
cols: number;
rows: number;
cursorX: number;
cursorY: number;
truncated: boolean;
};
export type ActivitySnapshot = {
id: string;
kind: ActivityKind;
title: string;
status: ActivityStatus;
notify: boolean;
createdAt: number;
sequence: number;
pid?: number;
exitCode?: number | null;
error?: string;
output?: string;
outputTruncated?: boolean;
screen?: TerminalScreen;
events?: ActivityEvent[];
eventsTruncated?: boolean;
};
export type TimerView = {
delayMs: number;
repeat: boolean;
nextAt: number;
};
export type TerminalHandle = {
readonly pid: number | undefined;
write(text: string, keyboard?: boolean): void;
paste(text: string): void;
view(): import("./view.js").TerminalView;
resize(cols: number, rows: number): void;
screen(): TerminalScreen;
stop(): Promise<boolean>;
dispose(): Promise<void>;
};
export type TerminalCallbacks = {
data(text: string): void;
changed(): void;
exit(code: number | null, error?: string): void;
};