The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | // Shared with the client settings form; keep schema code browser-safe. |
| 2 | import { |
| 3 | CustomModelSetting, |
| 4 | makeBinaryPathSetting, |
| 5 | makeProviderSettingsSchema, |
| 6 | secretSetting, |
| 7 | SettingsSecretValue, |
| 8 | TrimmedString, |
| 9 | } from "@t3tools/contracts"; |
| 10 | import * as Effect from "effect/Effect"; |
| 11 | import * as Schema from "effect/Schema"; |
| 12 | |
| 13 | export const OpenCodeSettings = makeProviderSettingsSchema( |
| 14 | { |
| 15 | enabled: Schema.Boolean.pipe( |
| 16 | Schema.withDecodingDefault(Effect.succeed(false)), |
| 17 | Schema.annotateKey({ providerSettingsForm: { hidden: true } }), |
| 18 | ), |
| 19 | binaryPath: makeBinaryPathSetting("opencode").pipe( |
| 20 | Schema.annotateKey({ |
| 21 | title: "Binary path", |
| 22 | description: "Path to the OpenCode binary.", |
| 23 | providerSettingsForm: { |
| 24 | placeholder: "opencode", |
| 25 | clearWhenEmpty: "omit", |
| 26 | }, |
| 27 | }), |
| 28 | ), |
| 29 | serverUrl: TrimmedString.pipe( |
| 30 | Schema.withDecodingDefault(Effect.succeed("")), |
| 31 | Schema.annotateKey({ |
| 32 | title: "Server URL", |
| 33 | description: "Leave blank to let T3 Code spawn the server when needed.", |
| 34 | providerSettingsForm: { |
| 35 | placeholder: "http://127.0.0.1:4096", |
| 36 | clearWhenEmpty: "omit", |
| 37 | }, |
| 38 | }), |
| 39 | ), |
| 40 | serverPassword: SettingsSecretValue.pipe( |
| 41 | secretSetting, |
| 42 | Schema.withDecodingDefault(Effect.succeed("")), |
| 43 | Schema.annotateKey({ |
| 44 | title: "Server password", |
| 45 | description: "Stored separately on the host.", |
| 46 | providerSettingsForm: { |
| 47 | control: "password", |
| 48 | placeholder: "Optional", |
| 49 | clearWhenEmpty: "omit", |
| 50 | }, |
| 51 | }), |
| 52 | ), |
| 53 | customModels: Schema.Array(CustomModelSetting).pipe( |
| 54 | Schema.withDecodingDefault(Effect.succeed([])), |
| 55 | Schema.annotateKey({ providerSettingsForm: { hidden: true } }), |
| 56 | ), |
| 57 | }, |
| 58 | { |
| 59 | order: ["binaryPath", "serverUrl", "serverPassword"], |
| 60 | }, |
| 61 | ); |
| 62 | export type OpenCodeSettings = typeof OpenCodeSettings.Type; |