/** * Team Template Types * * Defines the structure for team templates — reusable team recipes * that include roles, hierarchy configuration, and verification pipelines. * Templates are stored in config/templates/ and loaded by TemplateService. * * @module types/team-template */ import type { SolutionBundle } from './solution-bundle.types.js'; /** * Template categories matching common team types. */ export type TemplateCategory = 'development' | 'content' | 'research' | 'operations' | 'custom'; export declare const TEMPLATE_CATEGORIES: TemplateCategory[]; /** * Verification methods available to Team Leaders. * Each method corresponds to a specific skill or tool chain. */ export type VerificationMethod = 'quality_gates' | 'e2e_test' | 'code_review' | 'browser_test' | 'screenshot_review' | 'gemini_vision' | 'content_check' | 'fact_check' | 'source_verify' | 'data_validate' | 'manual_review' | 'custom_script'; export declare const VERIFICATION_METHODS: VerificationMethod[]; /** * A single verification step in the pipeline. */ export interface VerificationStep { /** Step identifier */ id: string; /** Human-readable step name */ name: string; /** Description of what this step verifies */ description: string; /** Verification method */ method: VerificationMethod; /** Whether this step is critical for overall pass/fail */ critical: boolean; /** Step-specific configuration (depends on method) */ config: Record; } /** * Defines the verification steps the Team Leader executes * when reviewing worker output. */ export interface VerificationPipeline { /** Pipeline display name */ name: string; /** Verification steps executed in order */ steps: VerificationStep[]; /** * Overall pass policy: * - 'all': All steps must pass * - 'majority': >50% of steps must pass * - 'critical_only': Only critical steps must pass */ passPolicy: 'all' | 'majority' | 'critical_only'; /** Maximum retry attempts for failed verification (default: 2) */ maxRetries: number; } /** * A role definition within a template. */ /** * Defines what a team or member is responsible for. * Used at both team-level (team's overall scope) and member-level (individual focus areas). */ export interface OwnershipScope { /** Domain areas: "frontend", "backend", "infra", "data", "security" */ domains: string[]; /** What outcomes this owner delivers: "feature_delivery", "quality", "performance" */ deliverables: string[]; /** Specific product areas: "checkout-flow", "landing-page", "API gateway" */ areas?: string[]; } /** * Concrete delivery commitment — what the team accepts, avoids, and produces. * Replaces vague capability tags with actionable service definitions. */ export interface ServiceContract { /** Task types the team can handle: "mid-size product feature", "frontend bugfix" */ accepts: string[]; /** Task types the team should NOT handle: "production DBA changes", "security incident response" */ avoids: string[]; /** Expected deliverables: "PR", "test coverage report", "deployment notes" */ expectedOutput: string[]; /** Non-binding time estimates by complexity */ slaHint?: { simpleTask?: string; mediumTask?: string; complexTask?: string; }; } /** How this role holder is accountable — determines task routing and verification ownership. */ export type ResponsibilityType = 'delivery_owner' | 'quality_owner' | 'system_owner'; export interface TemplateRole { /** Role identifier (matches TeamMember.role) */ role: string; /** Human-readable label for this position */ label: string; /** Default member name */ defaultName: string; /** Number of members with this role to create (default: 1) */ count: number; /** Hierarchy level (0=orchestrator, 1=leader, 2=worker) */ hierarchyLevel: number; /** Whether this role can delegate tasks to subordinates */ canDelegate: boolean; /** Parent role identifier (undefined = reports to Orchestrator) */ reportsTo?: string; /** Default skills assigned to this role */ defaultSkills: string[]; /** Skills to exclude from the role's default set */ excludedSkills?: string[]; /** Custom system prompt additions */ promptAdditions?: string; /** AI runtime override for this role */ runtimeOverride?: 'claude-code' | 'gemini-cli' | 'codex-cli' | 'opencode-cli' | 'antigravity-cli' | 'crewly-agent'; /** Whether to enable browser automation for this role */ enableBrowser?: boolean; /** Job title for this position: "Frontend Tech Lead", "Backend Developer" */ jobTitle?: string; /** What this position is responsible for in the team */ jobDescription?: string; /** What domains/deliverables this role owns (primarily for TL roles) */ ownershipScope?: OwnershipScope; /** Accountability type — determines routing and verification ownership */ responsibilityType?: ResponsibilityType; /** Default autonomy level for members in this role */ autonomyLevel?: 'directed' | 'bounded' | 'domain_autonomous'; /** Expert profile ID — injects expert thinking patterns into this role's prompt */ expertId?: string; /** Domain SOP ID — loads domain-specific standard operating procedures for this role */ domainSOP?: string; /** Risk policy ID — loads config/risk-policies/{riskPolicy}.policy.md into the role's prompt */ riskPolicy?: string; } /** * Marks a template as a first-run starter (specs/onboarding-harness-login.md, * Phase 3). Only free, members-only templates in `config/templates/` carry it. */ export interface TemplateOnboarding { /** Position in the starter list (lower first) */ order: number; /** The default starter (exactly one template sets this) */ recommended: boolean; /** Short display name, e.g. Personal Assistant */ label: string; /** One-line pitch shown under the label */ tagline: string; /** Example first tasks shown under the "派第一件事" box */ suggestions: string[]; } /** * Check if a value is valid onboarding starter metadata. * * @param value - Value to check * @returns True when every field has the right type * * @example * ```ts * if (isValidTemplateOnboarding(raw.onboarding)) starters.push(raw); * ``` */ export declare function isValidTemplateOnboarding(value: unknown): value is TemplateOnboarding; /** * A complete team recipe: roles, skills, hierarchy, and verification pipeline. */ export interface TeamTemplate { /** Unique template identifier (slug format) */ id: string; /** Human-readable template name */ name: string; /** Template description */ description: string; /** Template category */ category: TemplateCategory; /** Version string (semver) */ version: string; /** Template author */ author?: string; /** Tags for search/discovery */ tags?: string[]; /** Icon URL or emoji */ icon?: string; /** Whether this template creates a hierarchical team */ hierarchical: boolean; /** Role definitions with hierarchy configuration */ roles: TemplateRole[]; /** Default runtime for all members */ defaultRuntime: 'claude-code' | 'gemini-cli' | 'codex-cli' | 'opencode-cli' | 'antigravity-cli' | 'crewly-agent'; /** Verification pipeline configuration */ verificationPipeline: VerificationPipeline; /** Default monitoring configuration */ monitoringDefaults?: { idleEvent: boolean; /** Recurring TL progress check interval in minutes; 0 = none (the default), otherwise at least DELEGATION_PROGRESS_CHECK_CONSTANTS.MIN_INTERVAL_MINUTES */ fallbackCheckMinutes: number; }; /** Maximum workers per team leader */ maxWorkersPerLeader?: number; /** Auto-assign tasks to idle workers */ autoAssign?: boolean; /** Minimum cloud tier required to use this template (free if omitted) */ requiredTier?: 'free' | 'pro' | 'enterprise'; /** Team-level ownership scope — what this team is responsible for */ ownershipScope?: OwnershipScope; /** Service contract — what the team accepts, avoids, and delivers */ serviceContract?: ServiceContract; /** Team mission statement */ mission?: string; /** Set when this template is a first-run starter (Phase 3 onboarding) */ onboarding?: TemplateOnboarding; /** * Solution bundle section: norms/SOPs, skills, connectors, Slack layout, * schedules, deploy questions, first-week tasks, recommended runtime and * server tier (specs/solution-bundles.md). Validated by * `services/bundle/bundle-manifest.ts`, not by {@link isValidTeamTemplate}. */ bundle?: SolutionBundle; } /** * Check if a value is a valid TemplateCategory. * * @param value - Value to check * @returns True if valid */ export declare function isValidTemplateCategory(value: unknown): value is TemplateCategory; /** * Check if a value is a valid VerificationMethod. * * @param value - Value to check * @returns True if valid */ export declare function isValidVerificationMethod(value: unknown): value is VerificationMethod; /** * Validate a VerificationStep object. * * @param value - Value to check * @returns True if valid */ export declare function isValidVerificationStep(value: unknown): value is VerificationStep; /** * Validate a VerificationPipeline object. * * @param value - Value to check * @returns True if valid */ export declare function isValidVerificationPipeline(value: unknown): value is VerificationPipeline; /** * Validate a TemplateRole object. * * @param value - Value to check * @returns True if valid */ export declare function isValidTemplateRole(value: unknown): value is TemplateRole; /** * Validate a TeamTemplate object. * * @param value - Value to check * @returns True if valid */ export declare function isValidTeamTemplate(value: unknown): value is TeamTemplate; //# sourceMappingURL=team-template.types.d.ts.map