/**
 * Type Definitions for agentics-cli
 *
 * SPARC Architecture Reference:
 * - All types defined here are used across modules
 * - Types are interface-based for loose coupling
 * - No business logic in type definitions
 */
/**
 * Check if input is natural language (not valid JSON)
 */
export function isNaturalLanguageInput(value) {
    if (!value || value.trim() === '')
        return false;
    const trimmed = value.trim();
    // JSON objects start with { or [
    if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
        try {
            JSON.parse(trimmed);
            return false; // Valid JSON, not natural language
        }
        catch {
            return true; // Looks like JSON but isn't valid - treat as NL
        }
    }
    return true; // Doesn't look like JSON, is natural language
}
/**
 * Parse input that can be either JSON or natural language.
 * Returns parsed JSON if valid, otherwise returns NaturalLanguageInput wrapper.
 */
export function parseFlexibleInput(value) {
    if (!value || value.trim() === '') {
        return { type: 'natural-language', description: '' };
    }
    const trimmed = value.trim();
    // Try to parse as JSON if it looks like JSON
    if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
        try {
            return JSON.parse(trimmed);
        }
        catch {
            // Invalid JSON syntax - treat as natural language
            return { type: 'natural-language', description: value };
        }
    }
    // Detect UUID or ruvector-span ID patterns — these are structured references, not natural language
    const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
    const RUVECTOR_SPAN_PATTERN = /^ruvector-span-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
    if (UUID_PATTERN.test(trimmed) || RUVECTOR_SPAN_PATTERN.test(trimmed)) {
        return { id: trimmed, type: 'structured-reference' };
    }
    // Not JSON - treat as natural language description
    return { type: 'natural-language', description: value };
}
/**
 * Check if a FlexibleInput is a NaturalLanguageInput
 */
export function isNaturalLanguage(input) {
    return typeof input === 'object' &&
        input !== null &&
        'type' in input &&
        input.type === 'natural-language';
}
// ============================================================================
// Exit Codes (SPARC_REFINEMENT §5.5)
// ============================================================================
export const EXIT_CODES = {
    SUCCESS: 0,
    GENERAL_ERROR: 1,
    MISUSE: 2,
    USAGE_ERROR: 64,
    DATA_FORMAT_ERROR: 65,
    CANNOT_OPEN_INPUT: 66,
    SERVICE_UNAVAILABLE: 69,
    INTERNAL_ERROR: 70,
    IO_ERROR: 74,
    TEMPORARY_FAILURE: 75,
    PERMISSION_DENIED: 77,
    CONFIG_ERROR: 78,
    // Reserved for agentics-cli
    ARG_VALIDATION_ERROR: 100,
    CONFIG_VALIDATION_ERROR: 110,
    NETWORK_ERROR: 120,
    AUTH_ERROR: 130,
    SERVICE_ERROR: 140,
    RUVECTOR_ACCEPTANCE_FAILED: 141,
    META_SIMULATION_ROUTING_FAILED: 142,
    INTERNAL_CLI_ERROR: 150,
};
//# sourceMappingURL=index.js.map