File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6868| 其他 API | 可用 | commands、skills、formatters、LSPs、MCP servers、path、VCS、instance dispose、global upgrade |
6969| Question / permission API | 可用 | 待回答问题与权限、reply / reject |
7070| SSE 事件流 | 可用 | ` subscribe ` 、` subscribeQueue ` 、` subscribeSession ` 、` subscribeEventTypes ` 、类型化 ` EventHandler ` |
71- | CLI 封装 | 可用 | ` run ` 、` runJson ` 、sessions、agents、models、providers/auth、MCP、stats、export / import、db、debug、serve / web / attach、github、plugin、console |
71+ | CLI 封装 | 可用 | ` run ` 、` runJson ` 、` run(RunOptions) ` 全旗标、` tui(TuiOptions) ` 、sessions、agents、models、providers/auth、MCP(含 ` mcp auth list ` )、stats、export / import、db、debug、serve / web / attach 全旗标(` --mdns/--cors/--mdns-domain ` )、github、plugin、console、` raw ` 逃生通道 |
72+ | MCP 配置模型 | 可用 | ` McpServerConfig ` (` local ` stdio / ` remote ` HTTP-SSE,environment/headers/oauth/timeout/enabled),接入 ` OpenCodeConfig.mcp ` |
7273
7374<a id =" 3-requirements--compatibility " ></a >
7475## 3. 运行要求与兼容性
@@ -241,6 +242,17 @@ OpenCodeCliResult result = cli.run("Explain async/await in JavaScript");
241242System . out. println(result. getStdout());
242243
243244cli. run(" Hello" , " plan" , " anthropic/claude-sonnet-4-5" ); // agent + model
245+
246+ // 全旗标 run(--command/--continue/--fork/--share/--file/--title/--attach/
247+ // --variant/--thinking/--dir/--port 均可组合)
248+ cli. run(new OpenCodeRunOptions (" 修复失败的测试" )
249+ .model(" anthropic/claude-sonnet-4-5" )
250+ .format(" json" )
251+ .attach(" http://localhost:4096" )
252+ .variant(" high" ));
253+
254+ // 交互式 TUI
255+ cli. tui(new OpenCodeTuiOptions (). project(" ." ). continueLast(true ). fork(true ));
244256cli. sessionList();
245257cli. serve(4096 , " 127.0.0.1" ); // opencode serve --port 4096 --hostname 127.0.0.1
246258cli. upgrade(" v1.18.0" , " npm" );
You can’t perform that action at this time.
0 commit comments