Spaces:
Sleeping
Sleeping
| /** | |
| * Plugin Name: SA-Orchestration | |
| * Description: Arbitration record + Demand→Plan linkage + append-only acceptance events. First slice of SA-Core / MissionNet alignment layer above the Fluent stack. | |
| * Version: 0.7.2 | |
| * Author: Mark Holak | |
| * License: GPL-2.0-or-later | |
| * Text Domain: sa-orchestration | |
| * | |
| * Asterion (markdown corpus) is canonical-at-write; this DB layer is cache. | |
| * If runtime ≠ Asterion, runtime is wrong. See SA-orchestration/CORE_MODEL.md. | |
| */ | |
| defined( 'ABSPATH' ) || exit; | |
| define( 'SA_ORCH_VERSION', '0.7.3' ); | |
| define( 'SA_ORCH_FILE', __FILE__ ); | |
| define( 'SA_ORCH_DIR', plugin_dir_path( __FILE__ ) ); | |
| define( 'SA_ORCH_URL', plugin_dir_url( __FILE__ ) ); | |
| define( 'SA_ORCH_DB_PREFIX', 'sa_' ); // tables become {wp_prefix}sa_* | |
| require_once SA_ORCH_DIR . 'includes/class-sa-migrations.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-asterion.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-bridge-fluent.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-arbitration.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-link.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-acceptance.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-rest.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-reasoning.php'; | |
| require_once SA_ORCH_DIR . 'includes/interface-sa-llm-provider.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-llm-provider-simulated.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-llm-provider-openai.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-llm-settings.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-llm-providers.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-strategy.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-projection-fluent-support.php'; | |
| require_once SA_ORCH_DIR . 'includes/interface-sa-surface-adapter.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-adapter-fluent-boards.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-adapter-fluent-support.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-fluent-state.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-asterion-explorer.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-attention-bridge.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-actor-registry.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-actor-admin.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-actor-handoff.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-token-log.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-env.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-demand-registry.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-sara-service.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-sara-rest.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-sara-admin.php'; | |
| require_once SA_ORCH_DIR . 'includes/class-sa-asterion-projection.php'; // Board #30 | |
| require_once SA_ORCH_DIR . 'includes/class-sa-seed-generator.php'; // Board #26 | |
| require_once SA_ORCH_DIR . 'includes/class-sa-leaf-link.php'; // Board #40 v0.8.0 MVP | |
| require_once SA_ORCH_DIR . 'includes/class-sa-admin.php'; | |
| register_activation_hook( __FILE__, [ 'SA_Orch_Migrations', 'install' ] ); | |
| add_action( 'rest_api_init', [ 'SA_Orch_Rest', 'register_routes' ] ); | |
| add_action( 'rest_api_init', [ 'SA_Orch_Sara_Rest', 'register_routes' ] ); | |
| add_action( 'rest_api_init', [ 'SA_Orch_Asterion_Projection', 'register_routes' ] ); // Board #30 | |
| add_action( 'rest_api_init', [ 'SA_Orch_Seed_Generator', 'register_routes' ] ); // Board #26 | |
| add_action( 'rest_api_init', [ 'SA_Orch_Leaf_Link', 'register_routes' ] ); // Board #40 v0.8.0 MVP | |
| add_action( 'admin_menu', [ 'SA_Orch_Admin', 'register_menu' ] ); | |
| add_action( 'admin_menu', [ 'SA_Orch_Asterion_Explorer', 'register_menu' ] ); | |
| add_action( 'admin_menu', [ 'SA_Orch_Actor_Admin', 'register_menu' ] ); | |
| add_action( 'admin_menu', [ 'SA_Orch_Seed_Generator', 'register_menu' ] ); // Board #26 | |
| add_action( 'admin_menu', [ 'SA_Orch_Leaf_Link', 'register_menu' ] ); // Board #40 v0.8.0 MVP | |
| add_action( 'init', [ 'SA_Orch_Actor_Registry', 'register_role' ] ); | |
| add_action( 'admin_init', [ 'SA_Orch_Actor_Admin', 'maybe_handle_action' ] ); | |
| add_action( 'init', [ 'SA_Orch_Projection_Fluent_Support', 'register_hooks' ] ); | |
| add_action( 'init', [ 'SA_Orch_Sara_Admin', 'register_hooks' ] ); | |
| add_action( 'init', [ 'SA_Orch_Asterion_Projection', 'register_hooks' ] ); // Board #30 | |
| add_action( 'init', [ 'SA_Orch_Attention_Bridge', 'register_hooks' ] ); | |
| // Board #16 → Board #23 hook integration. Token Log answers the | |
| // 'sa_orch_handoff_has_llm_token' filter with a deterministic boolean, | |
| // turning Board #23's MODE_UNKNOWN into MODE_AI / MODE_HUMAN once a | |
| // commit is linked to a token row. | |
| add_filter( 'sa_orch_handoff_has_llm_token', [ 'SA_Orch_Token_Log', 'answer_handoff_filter' ], 10, 3 ); | |
| // Board #24 rev2 — Fluent Boards no-conflict dequeue compatibility. | |
| // | |
| // Fluent Boards' AdminMenuHandler registers a wp_print_scripts callback that | |
| // strips any plugin script whose src is under plugins_url() and doesn't | |
| // match an approved allowlist. Default allowlist: fluent-crm, fluent-boards. | |
| // Our Sara/Attention scripts are neither, so they get dequeued AFTER our | |
| // admin_enqueue_scripts call, before any <script> tag is rendered. | |
| // | |
| // We add 'sa-orchestration' to the allowlist via this filter. Surgical: | |
| // it does NOT disable Fluent Boards' no-conflict mechanism (other plugins' | |
| // scripts are still stripped), and it does NOT change any other behavior | |
| // in Sara, Attention, or anything else. Just whitelists our plugin path. | |
| add_filter( 'fluent_boards/asset_listed_slugs', function ( $slugs ) { | |
| if ( ! is_array( $slugs ) ) $slugs = []; | |
| if ( ! in_array( '\/sa-orchestration\/', $slugs, true ) ) { | |
| $slugs[] = '\/sa-orchestration\/'; | |
| } | |
| return $slugs; | |
| } ); | |