The best way to control Claude Code, Codex and more from any computer or phone

main
ts 37 lines 1.41 KB
Raw
1 import {
2 DesktopAppleSpeechResultSchema,
3 DesktopAppleSpeechTranscribeInputSchema,
4 } from "@t3tools/contracts";
5 import * as Effect from "effect/Effect";
6 import * as Schema from "effect/Schema";
7
8 import * as AppleSpeech from "../../speech/AppleSpeech.ts";
9 import * as IpcChannels from "../channels.ts";
10 import * as DesktopIpc from "../DesktopIpc.ts";
11
12 export const appleSpeechAvailable = DesktopIpc.makeIpcMethod({
13 channel: IpcChannels.APPLE_SPEECH_AVAILABLE_CHANNEL,
14 payload: Schema.Void,
15 result: Schema.Array(Schema.String),
16 handler: Effect.fn("desktop.ipc.appleSpeech.available")(function* () {
17 return yield* (yield* AppleSpeech.AppleSpeech).supportedLocales;
18 }),
19 });
20
21 export const appleSpeechPrepare = DesktopIpc.makeIpcMethod({
22 channel: IpcChannels.APPLE_SPEECH_PREPARE_CHANNEL,
23 payload: Schema.String.check(Schema.isMaxLength(64)),
24 result: DesktopAppleSpeechResultSchema,
25 handler: Effect.fn("desktop.ipc.appleSpeech.prepare")(function* (locale) {
26 return yield* (yield* AppleSpeech.AppleSpeech).prepare(locale);
27 }),
28 });
29
30 export const appleSpeechTranscribe = DesktopIpc.makeIpcMethod({
31 channel: IpcChannels.APPLE_SPEECH_TRANSCRIBE_CHANNEL,
32 payload: DesktopAppleSpeechTranscribeInputSchema,
33 result: DesktopAppleSpeechResultSchema,
34 handler: Effect.fn("desktop.ipc.appleSpeech.transcribe")(function* ({ locale, pcm }) {
35 return yield* (yield* AppleSpeech.AppleSpeech).transcribe(locale, pcm);
36 }),
37 });