File size: 1,779 Bytes
f51c224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
defined( 'ABSPATH' ) || exit;

/**
 * Provider contract for the Strategy LLM Review layer.
 *
 * Layer 3 of the review stack:
 *   1. Trace data
 *   2. Deterministic Trace Audit
 *   3. Strategy LLM Review (this contract; v0.5 = simulated only)
 *   4. Human arbitration
 *
 * Implementations of this interface must:
 *   - Treat the deterministic audit as authoritative for closure_state and
 *     needs_human_arbitration. They MUST NOT override either.
 *   - Return a five-key advisory shape (see review_trace docblock).
 *   - Be local-dev safe. No external calls unless the operator has explicitly
 *     enabled and configured a network-backed provider.
 */
interface SA_Orch_LLM_Provider_Interface {

    /** Stable id used in settings ('simulated', 'openai', 'anthropic', etc.). */
    public function id(): string;

    /** Human-readable name shown in the admin dropdown. */
    public function name(): string;

    /** Whether this provider needs an API token to function. */
    public function requires_api_key(): bool;

    /**
     * Produce a strategy review of the trace.
     *
     * Input:
     *   $trace                — output of SA_Orch_Rest::get_demand_trace().
     *   $deterministic_audit  — output of SA_Orch_Reasoning::evaluate( $trace ).
     *
     * Output (required keys):
     *   [
     *     'summary'               => string,                    // narrative
     *     'agreement_with_audit'  => 'true'|'false'|'partial',
     *     'additional_risks'      => string[],                  // risks not caught by audit
     *     'suggested_next_action' => string,
     *     'confidence'            => 'low'|'medium'|'high',
     *   ]
     */
    public function review_trace( array $trace, array $deterministic_audit ): array;
}