You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(config): migrate config.ts root Info to Effect Schema
Final file in the config migration track. The 144-line zod `Info` schema
becomes a `Schema.Struct` with Schema references for every already-
migrated leaf (Server, Layout, Command, Skills, Formatter, LSP, Provider,
MCP, Plugin, ModelID, ConfigSkills) plus three ZodOverride escape hatches
for schemas still living at the zod layer:
- `ConfigAgent.Info` (has .transform for catchall\u2192options / tools\u2192
permission / steps\u2194maxSteps normalisation)
- `ConfigPermission.Info` (uses ZodPreprocess for __originalKeys order
preservation)
- `Log.Level` (external to src/config \u2014 zod enum with .meta ref)
Also:
- `mode` and `agent` fields use `Schema.StructWithRest` (known fields +
catchall) to match the existing z.object().catchall() shape.
- `compaction.reserved`: `NonNegativeInt` via isInt + isGreaterThanOrEqualTo(0).
- `experimental.mcp_timeout`: `PositiveInt` via isInt + isGreaterThan(0).
- `.strict()` (and .meta({ref:"Config"})) re-applied after zod derivation
since the walker emits z.object() without strict and strict() strips meta.
- `DeepMutable` type utility strips readonly from Schema's inferred type to
match the mutable shape zod callers expect (the service code mutates
Info objects directly). Tuples preserved so `ConfigPlugin.Spec`'s
`[string, Options]` isn't widened.
SDK byte-identical. All 1993 runtime tests pass. Runtime smoke verified:
strict enforcement, agent known+catchall fields, compaction.reserved
refinements, autoupdate union, permission key-order, plugin tuple,
layout enum.
"Enable or disable snapshot tracking. When false, filesystem snapshots are not recorded and undoing or reverting will not undo/redo file changes. Defaults to true.",
102
-
),
103
-
// User-facing plugin config is stored as Specs; provenance gets attached later while configs are merged.
104
-
plugin: ConfigPlugin.Spec.zod.array().optional(),
105
-
share: z
106
-
.enum(["manual","auto","disabled"])
107
-
.optional()
108
-
.describe(
109
-
"Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing",
110
-
),
111
-
autoshare: z
112
-
.boolean()
113
-
.optional()
114
-
.describe("@deprecated Use 'share' field instead. Share newly created sessions automatically"),
115
-
autoupdate: z
116
-
.union([z.boolean(),z.literal("notify")])
117
-
.optional()
118
-
.describe(
119
-
"Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications",
120
-
),
121
-
disabled_providers: z.array(z.string()).optional().describe("Disable providers that are loaded automatically"),
122
-
enabled_providers: z
123
-
.array(z.string())
124
-
.optional()
125
-
.describe("When set, ONLY these providers will be enabled. All other providers will be ignored"),
126
-
model: ConfigModelID.zod.describe("Model to use in the format of provider/model, eg anthropic/claude-2").optional(),
127
-
small_model: ConfigModelID.zod
128
-
.describe("Small model to use for tasks like title generation in the format of provider/model")
129
-
.optional(),
130
-
default_agent: z
131
-
.string()
132
-
.optional()
133
-
.describe(
134
-
"Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid.",
135
-
),
136
-
username: z.string().optional().describe("Custom username to display in conversations instead of system username"),
137
-
mode: z
138
-
.object({
139
-
build: ConfigAgent.Info.optional(),
140
-
plan: ConfigAgent.Info.optional(),
141
-
})
142
-
.catchall(ConfigAgent.Info)
143
-
.optional()
144
-
.describe("@deprecated Use `agent` field instead."),
145
-
agent: z
146
-
.object({
83
+
// Schemas that still live at the zod layer (have .transform / .preprocess /
84
+
// .meta not expressible in current Effect Schema) get referenced via a
85
+
// ZodOverride-annotated Schema.Any. Walker sees the annotation and emits the
"Enable or disable snapshot tracking. When false, filesystem snapshots are not recorded and undoing or reverting will not undo/redo file changes. Defaults to true.",
114
+
}),
115
+
// User-facing plugin config is stored as Specs; provenance gets attached later while configs are merged.
0 commit comments