|
23 | 23 | import java.util.concurrent.atomic.AtomicInteger; |
24 | 24 |
|
25 | 25 | /** |
26 | | - * OpenCode 客户端门面:HTTP Server + SSE 事件流 + 本地 CLI。 |
27 | | - * <p> |
28 | | - * 三条通信通道相互独立,按各自子配置的 {@code enabled} 决定是否创建: |
29 | | - * </p> |
| 26 | + * Facade client for OpenCode: HTTP Server + SSE event stream + local CLI. |
| 27 | + * |
| 28 | + * <p>Three communication channels are independent of each other and are created based on |
| 29 | + * the {@code enabled} flag in their respective sub-configurations:</p> |
30 | 30 | * <ul> |
31 | | - * <li>{@link OpenCodeHttpClientConfig#isEnabled()} = false → HTTP / SSE 子客户端为 {@code null}</li> |
32 | | - * <li>{@link OpenCodeCliConfig#isEnabled()} = false → CLI 子客户端为 {@code null}</li> |
| 31 | + * <li>{@link OpenCodeHttpClientConfig#isEnabled()} = false -> HTTP/SSE sub-clients are {@code null}</li> |
| 32 | + * <li>{@link OpenCodeCliConfig#isEnabled()} = false -> CLI sub-client is {@code null}</li> |
33 | 33 | * </ul> |
34 | 34 | * |
35 | | - * <h3>构造器选择</h3> |
36 | | - * <p>提供 8 个重载覆盖三类场景:</p> |
| 35 | + * <h3>Constructor Selection</h3> |
| 36 | + * <p>Eight overloads cover three scenarios:</p> |
37 | 37 | * <ul> |
38 | | - * <li>仅 HTTP / 仅 CLI:传入单个子配置,禁用另一子系统</li> |
39 | | - * <li>HTTP + CLI:传入两个子配置,子系统都按各自 {@code enabled} 决定</li> |
40 | | - * <li>组合配置:传入 {@link OpenCodeClientConfig},内部拆分为两个子配置</li> |
| 38 | + * <li>HTTP only / CLI only: pass a single sub-config; the other subsystem is disabled</li> |
| 39 | + * <li>HTTP + CLI: pass two sub-configs; each subsystem is enabled per its own {@code enabled} flag</li> |
| 40 | + * <li>Combined config: pass {@link OpenCodeClientConfig}; internally split into two sub-configs</li> |
41 | 41 | * </ul> |
42 | | - * <p>每种场景再分「自动 ObjectMapper/OkHttpClient」与「强制注入」两个变体。 |
43 | | - * 强制注入的版本对 {@code ObjectMapper}/{@code OkHttpClient} 进行 {@code requireNonNull} 校验。</p> |
| 42 | + * <p>Each scenario has a variant with auto-created ObjectMapper/OkHttpClient and a variant with |
| 43 | + * forced injection (the injected version applies {@code requireNonNull} validation).</p> |
| 44 | + * |
| 45 | + * <h3>Startup Health Checks</h3> |
| 46 | + * <p>After subsystem initialization, the primary constructor runs health probes based on |
| 47 | + * {@code startupCheckEnabled} and {@code failFastOnUnavailable} (HTTP: {@code GET /global/health}; |
| 48 | + * CLI: {@code opencode --version}). If the probe fails but fail-fast is not enabled, only a |
| 49 | + * WARN log is emitted and construction continues.</p> |
44 | 50 | * |
45 | | - * <h3>启动自检</h3> |
46 | | - * <p>主构造器在子系统初始化后按 {@code startupCheckEnabled} 与 {@code failFastOnUnavailable} |
47 | | - * 执行健康探测(HTTP:{@code GET /global/health};CLI:{@code opencode --version})。 |
48 | | - * 探测失败但未开启 fail-fast 时仅 WARN,不中断构造。</p> |
| 51 | + * @author [@Loong Wan](https://github.com/loong10k) |
| 52 | + * @since 3.0.0 |
| 53 | + * @see OpenCodeHttpClientConfig |
| 54 | + * @see OpenCodeCliConfig |
| 55 | + * @see OpenCodeClientConfig |
49 | 56 | */ |
50 | 57 | @Slf4j |
51 | 58 | public class OpenCodeClient implements AutoCloseable { |
|
0 commit comments