1// Shared with the client settings form; keep schema code browser-safe.
2import {
3 CustomModelSetting,
4 makeBinaryPathSetting,
5 makeProviderSettingsSchema,
6 TrimmedString,
7} from "@t3tools/contracts";
8import * as Effect from "effect/Effect";
9import * as Schema from "effect/Schema";
10
11export const PiSettings = makeProviderSettingsSchema(
12 {
13 enabled: Schema.Boolean.pipe(
14 Schema.withDecodingDefault(Effect.succeed(false)),
15 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
16 ),
17 binaryPath: makeBinaryPathSetting("pi").pipe(
18 Schema.annotateKey({
19 title: "Binary path",
20 description: "Path to the Pi coding agent binary.",
21 providerSettingsForm: { placeholder: "pi", clearWhenEmpty: "omit" },
22 }),
23 ),
24 launchArgs: TrimmedString.pipe(
25 Schema.withDecodingDefault(Effect.succeed("")),
26 Schema.annotateKey({
27 title: "Launch arguments",
28 description: "Additional CLI arguments passed to pi --mode rpc on session start.",
29 providerSettingsForm: { clearWhenEmpty: "omit" },
30 }),
31 ),
32 customModels: Schema.Array(CustomModelSetting).pipe(
33 Schema.withDecodingDefault(Effect.succeed([])),
34 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
35 ),
36 },
37 {
38 order: ["binaryPath", "launchArgs"],
39 },
40);
41export type PiSettings = typeof PiSettings.Type;