forked from r.muellner/velum-raycast
Initial commit: Velum Raycast extension
Pseudonymize-and-AI workflow for handling PII-sensitive text via the Velum API and Raycast AI. Commands cover end-to-end email summary and reply, briefing/action-items/structured-data extraction, manual pseudonymize/depseudonymize on selection or clipboard, and session management. Includes Raycast 2.0 Beta workarounds for selection capture and rich-text clipboard. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
46
src/preferences.ts
Normal file
46
src/preferences.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { getPreferenceValues } from "@raycast/api";
|
||||
import type { ExtensionPreferences, QuickOutput, SessionMode } from "./types";
|
||||
|
||||
export type NormalizedPreferences = {
|
||||
velumBaseUrl: string;
|
||||
authentikTokenUrl: string;
|
||||
clientId: string;
|
||||
serviceAccountUsername: string;
|
||||
serviceAccountPassword: string;
|
||||
scope: string;
|
||||
sessionMode: SessionMode;
|
||||
quickOutput: QuickOutput;
|
||||
summaryModel: string;
|
||||
userFullName: string;
|
||||
maxSessions: number;
|
||||
closeAfterAction: boolean;
|
||||
};
|
||||
|
||||
function trimTrailingSlash(value: string): string {
|
||||
return value.trim().replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
function parsePositiveInteger(value: string, fallback: number): number {
|
||||
const parsed = Number.parseInt(value, 10);
|
||||
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
||||
}
|
||||
|
||||
export function getPreferences(): NormalizedPreferences {
|
||||
const preferences = getPreferenceValues<ExtensionPreferences>();
|
||||
|
||||
return {
|
||||
velumBaseUrl: trimTrailingSlash(preferences.velumBaseUrl),
|
||||
authentikTokenUrl: preferences.authentikTokenUrl.trim(),
|
||||
clientId: preferences.clientId.trim(),
|
||||
serviceAccountUsername: preferences.serviceAccountUsername.trim(),
|
||||
serviceAccountPassword: preferences.serviceAccountPassword,
|
||||
scope: preferences.scope?.trim() || "profile",
|
||||
sessionMode: preferences.sessionMode,
|
||||
quickOutput: preferences.quickOutput,
|
||||
summaryModel:
|
||||
preferences.summaryModel?.trim() || "anthropic-claude-sonnet-4-6",
|
||||
userFullName: preferences.userFullName?.trim() ?? "",
|
||||
maxSessions: parsePositiveInteger(preferences.maxSessions, 20),
|
||||
closeAfterAction: preferences.closeAfterAction ?? true,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user