/**
 * Execution Types
 *
 * Types for agent execution and runtime management.
 */
// =============================================================================
// Branch Type Mapping
// =============================================================================
/**
 * Map ticket category to branch type.
 * Used when creating branches for agent work.
 */
export const CATEGORY_TO_BRANCH_TYPE = {
    // ===========================================================================
    // Conventional Commits (standard types)
    // ===========================================================================
    // feat - New features and additions
    'feature': 'feat',
    'feat': 'feat',
    'new': 'feat',
    // fix - Bug fixes
    'bug': 'fix',
    'fix': 'fix',
    'bugfix': 'fix',
    // docs - Documentation
    'docs': 'docs',
    'documentation': 'docs',
    // test - Testing
    'test': 'test',
    'testing': 'test',
    // chore - Maintenance tasks
    'chore': 'chore',
    'maintenance': 'chore',
    // perf - Performance improvements
    'performance': 'perf',
    'perf': 'perf',
    // ci - CI/CD pipeline
    'ci': 'ci',
    'pipeline': 'ci',
    // build - Build system (mapped to 'ship' to avoid conflict with commit type)
    'build': 'build',
    'deps': 'build',
    'dependencies': 'build',
    // refactor - Code refactoring
    'refactor': 'rfct',
    'cleanup': 'rfct',
    'rfct': 'rfct',
    // ===========================================================================
    // Extended Types (proletariat extras)
    // ===========================================================================
    // sec - Security fixes
    'security': 'sec',
    'sec': 'sec',
    // db - Database changes
    'database': 'db',
    'migration': 'db',
    'schema': 'db',
    'db': 'db',
    // rel - Releases
    'release': 'rel',
    'rel': 'rel',
    // ===========================================================================
    // 5Tool Founder Types (business/ops categories)
    // ===========================================================================
    // ship - Shipping and deployment
    'ship': 'ship',
    'deploy': 'ship',
    'launch': 'ship',
    // grow - Growth and marketing
    'growth': 'grow',
    'marketing': 'grow',
    'grow': 'grow',
    // cx - Customer experience/support
    'support': 'cx',
    'customer': 'cx',
    'cx': 'cx',
    // strat - Strategy and planning
    'strategy': 'strat',
    'planning': 'strat',
    'strat': 'strat',
    // ops - Operations
    'ops': 'ops',
    'operations': 'ops',
    'bizops': 'ops',
};
/**
 * Get branch type from ticket category.
 * Defaults to 'feat' if no mapping found.
 */
export function getBranchType(category) {
    if (!category)
        return 'feat';
    const normalized = category.toLowerCase().trim();
    return CATEGORY_TO_BRANCH_TYPE[normalized] || 'feat';
}
/**
 * Generate branch name for agent work.
 * Format: {ticketId}/{type}/{owner}/{agent}/{slug}
 *
 * Example: TKT-054/feat/chris/altman/update-branch-naming
 *
 * - ticketId first for easy filtering: git branch | grep TKT-054
 * - owner: the human who owns the HQ/spawned the agent
 * - agent: the AI agent doing the work
 */
export function generateBranchName(ticketId, ticketTitle, ownerName, agentName, category) {
    const type = getBranchType(category);
    const slug = ticketTitle
        .toLowerCase()
        .replace(/[^a-z0-9\s-]/g, '')
        .replace(/\s+/g, '-')
        .substring(0, 20)
        .replace(/-+$/, '');
    return `${ticketId}/${type}/${ownerName}/${agentName}/${slug}`;
}
/**
 * Extract ticket ID from a tmux session name.
 * Session names like: prlt-TKT-347-implement or TKT-347-implement
 * Returns the ticket ID (e.g., "TKT-347") or undefined if not found.
 */
export function extractTicketFromSession(sessionName) {
    if (!sessionName)
        return undefined;
    const name = sessionName.replace(/^prlt-/, '');
    const match = name.match(/^(TKT-\d+)/);
    return match ? match[1] : undefined;
}
export const DEFAULT_EXECUTION_CONFIG = {
    defaultEnvironment: 'host',
    defaultExecutor: 'claude-code',
    autoExecute: false,
    shell: 'zsh', // macOS default
    outputMode: 'interactive', // Show streaming UI by default
    permissionMode: 'safe', // Require approval for dangerous operations by default
    tmux: {
        session: 'proletariat',
        layout: 'window',
        controlMode: true, // Use -u -CC for native iTerm scrolling/selection
        windowMode: 'tab', // Open tmux windows as tabs in current window by default
    },
    terminal: {
        app: 'Terminal',
        openInBackground: true, // Don't steal focus when opening new tabs
    },
    devcontainer: {
        defaultImage: 'mcr.microsoft.com/devcontainers/base:ubuntu',
        memory: '8g',
        cpus: 4,
        autoStart: true,
    },
    docker: {
        image: 'claude-code:latest',
        network: 'host',
    },
    firewall: {
        allowlistDomains: [],
    },
    vm: {
        user: 'agent',
        syncMethod: 'git',
    },
};
//# sourceMappingURL=types.js.map