feat(config): add team_mode schema (D-25 bounds, OFF by default)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-18 01:39:33 +09:00
parent 064dcc844e
commit df02e23342
4 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
bun test v1.3.12 (700fc117)
2 pass
0 fail
2 expect() calls
Ran 2 tests across 1 file. [136.00ms]

View File

@@ -0,0 +1,7 @@
bun test v1.3.12 (700fc117)
1 pass
1 filtered out
0 fail
1 expect() calls
Ran 1 test across 1 file. [48.00ms]

View File

@@ -0,0 +1,50 @@
/// <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,
base_dir: undefined,
member_delegate_task_budget: 0,
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)
})
})
})

View File

@@ -0,0 +1,19 @@
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(),
member_delegate_task_budget: z.number().int().min(0).default(0),
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>