feat(config): add team-mode configuration schema and merge support

This commit is contained in:
YeonGyu-Kim
2026-04-28 10:44:53 +09:00
parent caaa3d4c08
commit ec121a730f
10 changed files with 245 additions and 4 deletions
+1
View File
@@ -21,4 +21,5 @@ export type {
RuntimeFallbackConfig,
ModelCapabilitiesConfig,
FallbackModels,
TeamModeConfig,
} from "./schema"
+1
View File
@@ -18,6 +18,7 @@ export * from "./schema/notification"
export * from "./schema/oh-my-opencode-config"
export * from "./schema/ralph-loop"
export * from "./schema/runtime-fallback"
export * from "./schema/team-mode"
export * from "./schema/skills"
export * from "./schema/sisyphus"
export * from "./schema/sisyphus-agent"
+1
View File
@@ -22,6 +22,7 @@ export const BuiltinSkillNameSchema = z.enum([
"git-master",
"review-work",
"ai-slop-remover",
"team-mode",
])
export const OverridableAgentNameSchema = z.enum([
+1
View File
@@ -38,6 +38,7 @@ export const HookNameSchema = z.enum([
"delegate-task-retry",
"prometheus-md-only",
"sisyphus-junior-notepad",
"team-tool-gating",
"no-sisyphus-gpt",
"no-hephaestus-non-gpt",
"start-work",
@@ -0,0 +1,40 @@
import { describe, expect, it } from "bun:test"
import { OhMyOpenCodeConfigSchema } from "./oh-my-opencode-config"
describe("OhMyOpenCodeConfigSchema team_mode", () => {
it("accepts team_mode when provided", () => {
// given
const rawConfig = {
team_mode: {
enabled: true,
max_parallel_members: 2,
},
}
// when
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig)
// then
expect(result.success).toBe(true)
if (result.success) {
expect(result.data.team_mode).toMatchObject({
enabled: true,
max_parallel_members: 2,
})
}
})
it("allows team_mode omission", () => {
// given
const rawConfig = {}
// when
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig)
// then
expect(result.success).toBe(true)
if (result.success) {
expect(result.data.team_mode).toBeUndefined()
}
})
})
@@ -17,6 +17,7 @@ import { OpenClawConfigSchema } from "./openclaw"
import { ModelCapabilitiesConfigSchema } from "./model-capabilities"
import { RalphLoopConfigSchema } from "./ralph-loop"
import { RuntimeFallbackConfigSchema } from "./runtime-fallback"
import { TeamModeConfigSchema } from "./team-mode"
import { SkillsConfigSchema } from "./skills"
import { SisyphusConfigSchema } from "./sisyphus"
import { SisyphusAgentConfigSchema } from "./sisyphus-agent"
@@ -63,6 +64,7 @@ export const OhMyOpenCodeConfigSchema = z.object({
notification: NotificationConfigSchema.optional(),
model_capabilities: ModelCapabilitiesConfigSchema.optional(),
openclaw: OpenClawConfigSchema.optional(),
team_mode: TeamModeConfigSchema.optional(),
babysitting: BabysittingConfigSchema.optional(),
git_master: GitMasterConfigSchema.default({
commit_footer: true,
+48
View File
@@ -0,0 +1,48 @@
/// <reference types="bun-types" />
import { describe, expect, test } from "bun:test"
import { TeamModeConfigSchema } from "./team-mode"
describe("TeamModeConfigSchema", () => {
describe("#given all fields are omitted", () => {
test("#when parsed #then it returns the default team mode config", () => {
// given
const input = {}
// when
const result = TeamModeConfigSchema.parse(input)
// then
expect(result).toEqual({
enabled: false,
tmux_visualization: false,
max_parallel_members: 4,
max_members: 8,
max_messages_per_run: 10000,
max_wall_clock_minutes: 120,
max_member_turns: 500,
message_payload_max_bytes: 32768,
recipient_unread_max_bytes: 262144,
mailbox_poll_interval_ms: 3000,
})
})
})
describe("#given invalid bounds are provided", () => {
test("#when parsed #then it rejects out of range values", () => {
// given
const invalidInputs = [
{ max_parallel_members: -1 },
{ max_members: 9 },
{ message_payload_max_bytes: 512 },
]
// when
const results = invalidInputs.map((input) => TeamModeConfigSchema.safeParse(input))
// then
expect(results.every((result) => !result.success)).toBe(true)
})
})
})
+18
View File
@@ -0,0 +1,18 @@
import { z } from "zod"
/** Team Mode config - see .sisyphus/plans/team-mode.md (D-01/D-25). */
export const TeamModeConfigSchema = z.object({
enabled: z.boolean().default(false),
tmux_visualization: z.boolean().default(false),
max_parallel_members: z.number().int().min(1).max(8).default(4),
max_members: z.number().int().min(1).max(8).default(8),
max_messages_per_run: z.number().int().min(1).default(10000),
max_wall_clock_minutes: z.number().int().min(1).default(120),
max_member_turns: z.number().int().min(1).default(500),
base_dir: z.string().optional(),
message_payload_max_bytes: z.number().int().min(1024).default(32768),
recipient_unread_max_bytes: z.number().int().min(1024).default(262144),
mailbox_poll_interval_ms: z.number().int().min(500).default(3000),
})
export type TeamModeConfig = z.infer<typeof TeamModeConfigSchema>