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