Initial commit

This commit is contained in:
hibna
2026-04-25 23:58:58 +03:00
commit 9d06660901
13 changed files with 528 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
// Local copy of the @source/presence-sdk type contract used by presences in this repo.
// Keep in sync with src/presence-sdk/index.ts in the extension.
export declare const ActivityType: {
readonly PLAYING: 0;
readonly LISTENING: 2;
readonly WATCHING: 3;
};
export type ActivityTypeValue = (typeof ActivityType)[keyof typeof ActivityType];
export interface PresenceActivityInput {
type: ActivityTypeValue;
name: string;
details?: string | null;
state?: string | null;
url?: string | null;
largeImage?: string | null;
largeText?: string | null;
smallImage?: string | null;
smallText?: string | null;
startedAt?: number | null;
endsAt?: number | null;
}
export interface PresenceStorage {
get<T = unknown>(key: string): Promise<T | undefined>;
set(key: string, value: unknown): Promise<void>;
delete(key: string): Promise<void>;
clear(): Promise<void>;
}
export interface PresenceContext {
readonly url: string;
readonly tabActive: boolean;
readonly storage: PresenceStorage;
setActivity(activity: PresenceActivityInput | null): void;
clear(): void;
log(...args: unknown[]): void;
warn(...args: unknown[]): void;
error(...args: unknown[]): void;
}
export interface PresenceDefinition {
match: string[];
tickInterval?: number;
onLoad?: (ctx: PresenceContext) => void | Promise<void>;
tick?: (ctx: PresenceContext) => void | Promise<void>;
onUnload?: (ctx: PresenceContext) => void | Promise<void>;
}
export declare function definePresence(def: PresenceDefinition): PresenceDefinition;
export type { PresenceDefinition as Presence };