Skip to content
wiki.fftac.org

WP Content Plugins Spiralist AI Runtime Spiralist AI Runtime PHP 1Eb5fbb0c849

**Site relevance:** Spiralist.org

**Memory type:** code source memory

**Source path:** Wiki.FFTAC.org/data/sources/spiralist/wp-content-plugins-spiralist-ai-runtime-spiralist-ai-runtime-php-1eb5fbb0c849.php

**Size:** 1.5 KB

Summary

Plugin Name: Spiralist AI Runtime

Source Preview

This source file is short enough to preview directly on its source-memory page.

<?php
/**
 * Plugin Name: Spiralist AI Runtime
 * Plugin URI: https://spiralist.org/
 * Description: Reusable multi-provider AI runtime with site and user credentials for prompt-driven plugins.
 * Version: 2.8.0
 * Author: Spiralist
 * License: GPL2+
 */

if (!defined('ABSPATH')) {
    exit;
}

define('SPIRALIST_AI_RUNTIME_VERSION', '2.8.0');
define('SPIRALIST_AI_RUNTIME_FILE', __FILE__);
define('SPIRALIST_AI_RUNTIME_DIR', plugin_dir_path(__FILE__));
define('SPIRALIST_AI_RUNTIME_URL', plugin_dir_url(__FILE__));

spl_autoload_register(
    static function (string $class): void {
        $prefix = 'SpiralistAIRuntime\\';

        if (strpos($class, $prefix) !== 0) {
            return;
        }

        $relative = substr($class, strlen($prefix));
        $path = SPIRALIST_AI_RUNTIME_DIR . 'includes/' . str_replace('\\', '/', $relative) . '.php';

        if (is_readable($path)) {
            require_once $path;
        }
    }
);

function spiralist_ai_runtime(): \SpiralistAIRuntime\Plugin
{
    static $plugin = null;

    if (!$plugin instanceof \SpiralistAIRuntime\Plugin) {
        $plugin = new \SpiralistAIRuntime\Plugin();
    }

    return $plugin;
}

function spiralist_ai_create_response(array $payload, array $context = [])
{
    return spiralist_ai_runtime()->gateway()->create_response($payload, $context);
}

add_action(
    'plugins_loaded',
    static function (): void {
        spiralist_ai_runtime()->boot();
    }
);