Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
317 changes: 202 additions & 115 deletions Releases/v4.0.3/.claude/PAI-Install/engine/actions.ts

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Releases/v4.0.3/.claude/PAI-Install/engine/config-gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export function generateSettingsJson(config: PAIConfig): Record<string, any> {
fullName: `${config.aiName} — Personal AI`,
displayName: config.aiName.toUpperCase(),
color: "#3B82F6",
...(config.ttsProvider ? { ttsProvider: config.ttsProvider } : {}),
...(config.ttsProvider === "google-cloud" && config.googleCloudVoice
? { googleCloudVoice: config.googleCloudVoice }
: {}),
voices: {
main: {
voiceId,
Expand Down
21 changes: 20 additions & 1 deletion Releases/v4.0.3/.claude/PAI-Install/engine/detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ function detectExisting(
try {
const envContent = readFileSync(envPath, "utf-8");
result.elevenLabsKeyFound = envContent.includes("ELEVENLABS_API_KEY=");
result.hasApiKeys = result.elevenLabsKeyFound;
const googleKeyFound = envContent.includes("GOOGLE_CLOUD_API_KEY=") || envContent.includes("GOOGLE_API_KEY=");
result.hasApiKeys = result.elevenLabsKeyFound || googleKeyFound;
} catch {
// Permission denied or other error
}
Expand Down Expand Up @@ -166,3 +167,21 @@ export async function validateElevenLabsKey(key: string): Promise<{ valid: boole
return { valid: false, error: e.message || "Network error" };
}
}

/**
* Validate a Google Cloud API key by listing available TTS voices.
*/
export async function validateGoogleCloudKey(key: string): Promise<{ valid: boolean; error?: string }> {
try {
const res = await fetch(
`https://texttospeech.googleapis.com/v1/voices?key=${key}`,
{ signal: AbortSignal.timeout(10000) }
);

if (res.ok) return { valid: true };
const body = await res.text().catch(() => "");
return { valid: false, error: `HTTP ${res.status}${body ? `: ${body.slice(0, 100)}` : ""}` };
} catch (e: any) {
return { valid: false, error: e.message || "Network error" };
}
}
4 changes: 2 additions & 2 deletions Releases/v4.0.3/.claude/PAI-Install/engine/steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const STEPS: StepDefinition[] = [
{
id: "api-keys",
name: "API Keys",
description: "Find or collect ElevenLabs API key for voice features",
description: "Find or collect API keys for voice features",
number: 3,
required: true,
dependsOn: ["prerequisites"],
Expand Down Expand Up @@ -57,7 +57,7 @@ export const STEPS: StepDefinition[] = [
{
id: "voice",
name: "Digital Assistant Voice",
description: "Configure ElevenLabs key, select voice, start voice server, and test",
description: "Choose TTS provider, configure API key, select voice, and test",
number: 7,
required: true,
dependsOn: ["configuration"],
Expand Down
12 changes: 11 additions & 1 deletion Releases/v4.0.3/.claude/PAI-Install/engine/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export interface InstallState {
// Collected data
collected: {
elevenLabsKey?: string;
googleCloudKey?: string;
ttsProvider?: "elevenlabs" | "google-cloud";
principalName?: string;
timezone?: string;
aiName?: string;
Expand Down Expand Up @@ -112,6 +114,14 @@ export interface PAIConfig {
temperatureUnit?: "fahrenheit" | "celsius";
voiceType?: string;
voiceId?: string;
ttsProvider?: "elevenlabs" | "google-cloud";
googleCloudVoice?: {
languageCode: string;
voiceName: string;
voiceType: string;
speakingRate: number;
pitch: number;
};
paiDir: string;
configDir: string;
}
Expand All @@ -127,7 +137,7 @@ export type ServerMessage =
| { type: "input_request"; id: string; prompt: string; inputType: "text" | "password" | "key"; placeholder?: string }
| { type: "choice_request"; id: string; prompt: string; choices: { label: string; value: string; description?: string }[] }
| { type: "progress"; step: StepId; percent: number; detail: string }
| { type: "voice_enabled"; enabled: boolean; mode: "elevenlabs" | "browser" | "none" }
| { type: "voice_enabled"; enabled: boolean; mode: "elevenlabs" | "google-cloud" | "browser" | "none" }
| { type: "install_complete"; success: boolean; summary: InstallSummary }
| { type: "validation_result"; checks: ValidationCheck[] }
| { type: "error"; message: string; step?: StepId };
Expand Down
Loading
Loading