"use strict";
/**
 * @tensorify.io/sdk
 *
 * TypeScript SDK for developing Tensorify plugins with comprehensive validation,
 * frontend enforcement, and publishing tools.
 *
 * @version 2.0.0-alpha
 * @author AlphaWolf Ventures, Inc.
 * @license ISC
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.MANIFEST_VERSIONS = exports.MIN_TYPESCRIPT_VERSION = exports.SDK_VERSION = exports.PLUGIN_CATEGORIES = exports.getPluginMetadata = exports.createPluginTemplate = exports.isValidPluginDirectory = exports.autoDetectEntrypointClassName = exports.indentCode = exports.sanitizeVariableName = exports.generateVariableName = exports.processDynamicLabelTemplate = exports.mergeSettingsWithDefaults = exports.createDefaultSettings = exports.validatePluginSettings = exports.validatePlugin = exports.buildPluginManifest = exports.writeManifestFile = exports.readPackageJson = exports.generatePluginManifest = exports.DEFAULT_VALUES = exports.UI_TYPE_TO_DATA_TYPE_MAP = exports.SettingsDataType = exports.SettingsUIType = exports.NextNodeAsOutput = exports.PrevNodeAsInput = exports.IconType = exports.NodeViewContainerType = exports.EdgeType = exports.HandlePosition = exports.HandleViewType = exports.PluginCapability = exports.NodeType = exports.TensorifyPlugin = exports.DataType = exports.MLPlugin = exports.BasePlugin = void 0;
exports.createManifest = createManifest;
exports.validateManifest = validateManifest;
exports.createEntryPoint = createEntryPoint;
// ========================================
// V2-ALPHA CORE CLASSES
// ========================================
// New V2-Alpha plugin system
var base_plugin_1 = require("./base-plugin");
Object.defineProperty(exports, "BasePlugin", { enumerable: true, get: function () { return base_plugin_1.BasePlugin; } });
var ml_plugin_1 = require("./ml-plugin");
Object.defineProperty(exports, "MLPlugin", { enumerable: true, get: function () { return ml_plugin_1.MLPlugin; } });
// V2-Alpha Type exports
var v2_alpha_types_1 = require("./v2-alpha-types");
Object.defineProperty(exports, "DataType", { enumerable: true, get: function () { return v2_alpha_types_1.DataType; } });
// ========================================
// LEGACY CLASSES (V2-Beta compatibility)
// ========================================
// Main abstract class that all legacy plugins extend
var TensorifyPlugin_1 = require("./core/TensorifyPlugin");
Object.defineProperty(exports, "TensorifyPlugin", { enumerable: true, get: function () { return TensorifyPlugin_1.TensorifyPlugin; } });
// ========================================
// TYPE DEFINITIONS
// ========================================
// Core types
var core_1 = require("./types/core");
Object.defineProperty(exports, "NodeType", { enumerable: true, get: function () { return core_1.NodeType; } });
Object.defineProperty(exports, "PluginCapability", { enumerable: true, get: function () { return core_1.PluginCapability; } });
// Visual configuration types
var visual_1 = require("./types/visual");
Object.defineProperty(exports, "HandleViewType", { enumerable: true, get: function () { return visual_1.HandleViewType; } });
Object.defineProperty(exports, "HandlePosition", { enumerable: true, get: function () { return visual_1.HandlePosition; } });
Object.defineProperty(exports, "EdgeType", { enumerable: true, get: function () { return visual_1.EdgeType; } });
Object.defineProperty(exports, "NodeViewContainerType", { enumerable: true, get: function () { return visual_1.NodeViewContainerType; } });
Object.defineProperty(exports, "IconType", { enumerable: true, get: function () { return visual_1.IconType; } });
// Convenience handle presets for mandatory flow
var handles_1 = require("./constants/handles");
Object.defineProperty(exports, "PrevNodeAsInput", { enumerable: true, get: function () { return handles_1.PrevNodeAsInput; } });
Object.defineProperty(exports, "NextNodeAsOutput", { enumerable: true, get: function () { return handles_1.NextNodeAsOutput; } });
// Settings field types
var settings_1 = require("./types/settings");
Object.defineProperty(exports, "SettingsUIType", { enumerable: true, get: function () { return settings_1.SettingsUIType; } });
Object.defineProperty(exports, "SettingsDataType", { enumerable: true, get: function () { return settings_1.SettingsDataType; } });
Object.defineProperty(exports, "UI_TYPE_TO_DATA_TYPE_MAP", { enumerable: true, get: function () { return settings_1.UI_TYPE_TO_DATA_TYPE_MAP; } });
Object.defineProperty(exports, "DEFAULT_VALUES", { enumerable: true, get: function () { return settings_1.DEFAULT_VALUES; } });
const core_2 = require("./types/core");
const visual_2 = require("./types/visual");
// ========================================
// UTILITY FUNCTIONS
// ========================================
// Plugin development utilities
var plugin_utils_1 = require("./utils/plugin-utils");
Object.defineProperty(exports, "generatePluginManifest", { enumerable: true, get: function () { return plugin_utils_1.generatePluginManifest; } });
Object.defineProperty(exports, "readPackageJson", { enumerable: true, get: function () { return plugin_utils_1.readPackageJson; } });
Object.defineProperty(exports, "writeManifestFile", { enumerable: true, get: function () { return plugin_utils_1.writeManifestFile; } });
Object.defineProperty(exports, "buildPluginManifest", { enumerable: true, get: function () { return plugin_utils_1.buildPluginManifest; } });
Object.defineProperty(exports, "validatePlugin", { enumerable: true, get: function () { return plugin_utils_1.validatePlugin; } });
Object.defineProperty(exports, "validatePluginSettings", { enumerable: true, get: function () { return plugin_utils_1.validatePluginSettings; } });
Object.defineProperty(exports, "createDefaultSettings", { enumerable: true, get: function () { return plugin_utils_1.createDefaultSettings; } });
Object.defineProperty(exports, "mergeSettingsWithDefaults", { enumerable: true, get: function () { return plugin_utils_1.mergeSettingsWithDefaults; } });
Object.defineProperty(exports, "processDynamicLabelTemplate", { enumerable: true, get: function () { return plugin_utils_1.processDynamicLabelTemplate; } });
Object.defineProperty(exports, "generateVariableName", { enumerable: true, get: function () { return plugin_utils_1.generateVariableName; } });
Object.defineProperty(exports, "sanitizeVariableName", { enumerable: true, get: function () { return plugin_utils_1.sanitizeVariableName; } });
Object.defineProperty(exports, "indentCode", { enumerable: true, get: function () { return plugin_utils_1.indentCode; } });
Object.defineProperty(exports, "autoDetectEntrypointClassName", { enumerable: true, get: function () { return plugin_utils_1.autoDetectEntrypointClassName; } });
Object.defineProperty(exports, "isValidPluginDirectory", { enumerable: true, get: function () { return plugin_utils_1.isValidPluginDirectory; } });
Object.defineProperty(exports, "createPluginTemplate", { enumerable: true, get: function () { return plugin_utils_1.createPluginTemplate; } });
Object.defineProperty(exports, "getPluginMetadata", { enumerable: true, get: function () { return plugin_utils_1.getPluginMetadata; } });
// ========================================
// CONSTANTS AND HELPERS
// ========================================
/**
 * Supported node type categories for plugins
 */
exports.PLUGIN_CATEGORIES = [
    "custom",
    "trainer",
    "evaluator",
    "model",
    "model_layer",
    "sequence",
    "dataloader",
    "preprocessor",
    "postprocessor",
    "augmentation_stack",
    "optimizer",
    "loss_function",
    "metric",
    "scheduler",
    "regularizer",
    "function",
    "pipeline",
    "report",
];
/**
 * Current SDK version
 */
exports.SDK_VERSION = "2.0.0-alpha";
/**
 * Minimum required TypeScript version
 */
exports.MIN_TYPESCRIPT_VERSION = "4.5.0";
/**
 * Supported manifest format versions
 */
exports.MANIFEST_VERSIONS = ["1.0.0"];
// ========================================
// CONVENIENCE FUNCTIONS
// ========================================
/**
 * Create a new plugin manifest with default values
 *
 * @param overrides Optional properties to override defaults
 * @returns Plugin manifest with defaults applied
 */
function createManifest(overrides = {}) {
    const defaults = {
        name: "my-plugin",
        version: "1.0.0",
        description: "A new Tensorify plugin",
        author: "",
        main: "dist/index.js",
        entrypointClassName: "MyPlugin",
        keywords: ["tensorify", "plugin"],
        frontendConfigs: {
            id: "my-plugin",
            name: "My Plugin",
            category: "custom",
            nodeType: core_2.NodeType.CUSTOM,
            visual: {
                containerType: visual_2.NodeViewContainerType.DEFAULT,
                size: { width: 200, height: 120 },
                padding: { inner: 16, outer: 8, extraPadding: false },
                styling: {
                    borderRadius: 8,
                    borderWidth: 2,
                    shadowLevel: 1,
                    theme: "auto",
                },
                icons: { secondary: [], showIconBackground: true, iconSize: "medium" },
                labels: { showLabels: true, labelPosition: "top" },
            },
            inputHandles: [],
            outputHandles: [],
            settingsFields: [],
        },
        capabilities: [core_2.PluginCapability.CODE_GENERATION],
        requirements: {
            minSdkVersion: exports.SDK_VERSION,
            dependencies: [],
        },
        sdkVersion: exports.SDK_VERSION,
        generatedAt: new Date().toISOString(),
        manifestVersion: "1.0.0",
    };
    return { ...defaults, ...overrides };
}
/**
 * Validate a plugin manifest structure
 *
 * @param manifest Manifest to validate
 * @returns True if valid, throws error if invalid
 */
function validateManifest(manifest) {
    const required = [
        "name",
        "version",
        "entrypointClassName",
        "frontendConfigs",
    ];
    for (const field of required) {
        if (!(field in manifest) ||
            !manifest[field]) {
            throw new Error(`Required field '${field}' is missing from manifest`);
        }
    }
    // Validate semantic versioning
    const versionRegex = /^\d+\.\d+\.\d+$/;
    if (!versionRegex.test(manifest.version)) {
        throw new Error(`Invalid version format: ${manifest.version}`);
    }
    return true;
}
/**
 * Create a plugin entry point for CLI usage
 *
 * @param description Entry point description
 * @param parameters Entry point parameters
 * @returns Plugin entry point object
 */
function createEntryPoint(description, parameters = {}) {
    return {
        description,
        parameters: {
            settings: {
                type: "object",
                required: true,
                description: "Plugin settings object",
            },
            children: {
                type: "any",
                required: false,
                description: "Connected child plugins",
            },
            context: {
                type: "object",
                required: false,
                description: "Code generation context",
            },
            ...parameters,
        },
    };
}
//# sourceMappingURL=index.js.map