Skip to content
Source
Sign inSign up

settings.ts

70 lines2.8 KB

1import { TrimmedString, makeProviderSettingsSchema } from "@t3tools/contracts";
2import * as Effect from "effect/Effect";
3import * as Schema from "effect/Schema";
4​
5export const AcpRegistryDistributionPreference = Schema.Literals(["auto", "binary", "npx", "uvx"]);
6export type AcpRegistryDistributionPreference = typeof AcpRegistryDistributionPreference.Type;
7​
8export const AcpRegistrySettings = makeProviderSettingsSchema(
9 {
10 source: Schema.Literals(["registry", "local"]).pipe(
11 Schema.withDecodingDefault(Effect.succeed("registry")),
12 Schema.annotateKey({
13 title: "ACP source",
14 providerSettingsForm: {
15 control: "select",
16 options: [
17 { value: "registry", label: "ACP Registry" },
18 { value: "local", label: "Local command" },
19 ],
20 },
21 }),
22 ),
23 enabled: Schema.Boolean.pipe(
24 Schema.withDecodingDefault(Effect.succeed(true)),
25 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
26 ),
27 agentId: TrimmedString.pipe(
28 Schema.withDecodingDefault(Effect.succeed("")),
29 Schema.annotateKey({
30 title: "Registry agent ID",
31 description: "Agent identifier from the official ACP Registry, for example 'devin'.",
32 providerSettingsForm: { placeholder: "devin", clearWhenEmpty: "persist" },
33 }),
34 ),
35 commandPath: TrimmedString.pipe(
36 Schema.withDecodingDefault(Effect.succeed("")),
37 Schema.annotateKey({
38 title: "Executable override",
39 description:
40 "Executable on this environment. For registry agents, this overrides the distribution executable while keeping its arguments and environment.",
41 providerSettingsForm: { placeholder: "Registry default", clearWhenEmpty: "omit" },
42 }),
43 ),
44 commandArgs: Schema.Array(Schema.String).pipe(
45 Schema.withDecodingDefault(Effect.succeed([])),
46 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
47 ),
48 authMethodId: TrimmedString.pipe(
49 Schema.withDecodingDefault(Effect.succeed("")),
50 Schema.annotateKey({
51 title: "Authentication method",
52 description:
53 "Optional ACP authentication method ID. By default, the first agent-managed method is selected.",
54 providerSettingsForm: { placeholder: "auto", clearWhenEmpty: "omit" },
55 }),
56 ),
57 distribution: AcpRegistryDistributionPreference.pipe(
58 Schema.withDecodingDefault(Effect.succeed("auto")),
59 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
60 ),
61 customModels: Schema.Array(Schema.String).pipe(
62 Schema.withDecodingDefault(Effect.succeed([])),
63 Schema.annotateKey({ providerSettingsForm: { hidden: true } }),
64 ),
65 },
66 {
67 order: ["source", "agentId", "commandPath", "authMethodId"],
68 },
69);
70export type AcpRegistrySettings = typeof AcpRegistrySettings.Type;