48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
/**
|
|
* Pi instance settings. Shared by the server driver and the client settings
|
|
* form, so it holds only browser-safe schema code.
|
|
*
|
|
* @module provider-pi/settings
|
|
*/
|
|
import {
|
|
CustomModelSetting,
|
|
makeBinaryPathSetting,
|
|
makeProviderSettingsSchema,
|
|
TrimmedString,
|
|
} from "@t3tools/contracts";
|
|
import * as Effect from "effect/Effect";
|
|
import * as Schema from "effect/Schema";
|
|
|
|
export const PiSettings = makeProviderSettingsSchema(
|
|
{
|
|
// Off by default like Cursor and Grok. Users opt in from Settings.
|
|
enabled: Schema.Boolean.pipe(
|
|
Schema.withDecodingDefault(Effect.succeed(false)),
|
|
Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
|
|
),
|
|
binaryPath: makeBinaryPathSetting("pi").pipe(
|
|
Schema.annotateKey({
|
|
title: "Binary path",
|
|
description: "Path to the Pi coding agent binary.",
|
|
providerSettingsForm: { placeholder: "pi", clearWhenEmpty: "omit" },
|
|
}),
|
|
),
|
|
launchArgs: TrimmedString.pipe(
|
|
Schema.withDecodingDefault(Effect.succeed("")),
|
|
Schema.annotateKey({
|
|
title: "Launch arguments",
|
|
description: "Additional CLI arguments passed to pi --mode rpc on session start.",
|
|
providerSettingsForm: { clearWhenEmpty: "omit" },
|
|
}),
|
|
),
|
|
customModels: Schema.Array(CustomModelSetting).pipe(
|
|
Schema.withDecodingDefault(Effect.succeed([])),
|
|
Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
|
|
),
|
|
},
|
|
{
|
|
order: ["binaryPath", "launchArgs"],
|
|
},
|
|
);
|
|
export type PiSettings = typeof PiSettings.Type;
|