| 1 | /** |
| 2 | * Grok instance settings. Shared by the server driver and the client |
| 3 | * settings form, so it holds only browser-safe schema code. |
| 4 | * |
| 5 | * @module provider-grok/settings |
| 6 | */ |
| 7 | import { |
| 8 | CustomModelSetting, |
| 9 | makeBinaryPathSetting, |
| 10 | makeProviderSettingsSchema, |
| 11 | } from "@t3tools/contracts"; |
| 12 | import * as Effect from "effect/Effect"; |
| 13 | import * as Schema from "effect/Schema"; |
| 14 | |
| 15 | export const GrokSettings = makeProviderSettingsSchema( |
| 16 | { |
| 17 | // Off by default (like Cursor and OpenCode): the binding is not yet |
| 18 | // stable enough to probe on every install. 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("grok").pipe( |
| 24 | Schema.annotateKey({ |
| 25 | title: "Binary path", |
| 26 | description: "Path to the Grok CLI binary.", |
| 27 | providerSettingsForm: { placeholder: "grok", clearWhenEmpty: "omit" }, |
| 28 | }), |
| 29 | ), |
| 30 | customModels: Schema.Array(CustomModelSetting).pipe( |
| 31 | Schema.withDecodingDefault(Effect.succeed([])), |
| 32 | Schema.annotateKey({ providerSettingsForm: { hidden: true } }), |
| 33 | ), |
| 34 | }, |
| 35 | { |
| 36 | order: ["binaryPath"], |
| 37 | }, |
| 38 | ); |
| 39 | export type GrokSettings = typeof GrokSettings.Type; |