opencode-bridge by different-ai/openwork
npx skills add https://github.com/different-ai/openwork --skill opencode-bridgeOpenWork 通过三种机制与 OpenCode 通信:
opencode 进程并获取 JSON 响应。opencode -p "your prompt" -f json -q
返回包含响应内容的 JSON。
| 标志 | 描述 |
|---|---|
-p | 要执行的提示 |
-f | 输出格式 (text, ) |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
json-q | 静默模式(无加载动画) |
-c | 工作目录 |
-d | 调试模式 |
{
"content": "Here is the result...",
"session_id": "abc123"
}
~/.opencode/opencode.db
或项目本地:
.opencode/opencode.db
CREATE TABLE sessions (
id TEXT PRIMARY KEY,
parent_session_id TEXT,
title TEXT,
message_count INTEGER,
prompt_tokens INTEGER,
completion_tokens INTEGER,
summary_message_id TEXT,
cost REAL,
created_at INTEGER,
updated_at INTEGER
);
CREATE TABLE messages (
id TEXT PRIMARY KEY,
session_id TEXT,
role TEXT, -- 'user', 'assistant', 'tool'
parts TEXT, -- JSON array of content parts
model TEXT,
created_at INTEGER,
updated_at INTEGER
);
use tauri_plugin_sql::{Migration, MigrationKind};
#[tauri::command]
async fn list_sessions(db: tauri::State<'_, Database>) -> Result<Vec<Session>, String> {
let sessions = sqlx::query_as::<_, Session>(
"SELECT * FROM sessions ORDER BY updated_at DESC"
)
.fetch_all(&db.pool)
.await
.map_err(|e| e.to_string())?;
Ok(sessions)
}
import Database from "@tauri-apps/plugin-sql";
const db = await Database.load("sqlite:~/.opencode/opencode.db");
const sessions = await db.select<Session[]>(
"SELECT * FROM sessions ORDER BY updated_at DESC"
);
OpenWork 可以注册为 OpenCode 连接的 MCP 服务器。
{
"mcpServers": {
"openwork": {
"type": "stdio",
"command": "openwork-mcp-bridge"
}
}
}
消息包含一个 parts JSON 数组,其中包含不同类型的内容:
{ "type": "text", "text": "Hello world" }
{
"type": "tool_call",
"id": "call_123",
"name": "bash",
"input": "{\"command\": \"ls\"}"
}
{
"type": "tool_result",
"tool_call_id": "call_123",
"content": "file1.txt\nfile2.txt",
"is_error": false
}
{
"type": "finish",
"reason": "end_turn",
"time": 1704067200
}
which opencode
opencode --version
ls ~/.opencode/opencode.db
opencode -p "Hello" -f json -q
每周安装量
159
代码仓库
GitHub 星标数
12.3K
首次出现
2026年1月22日
安全审计
安装于
opencode157
gemini-cli152
codex150
github-copilot149
cursor149
amp147
OpenWork communicates with OpenCode via three mechanisms:
opencode with prompts and get JSON responses.opencode -p "your prompt" -f json -q
Returns JSON with the response content.
| Flag | Description |
|---|---|
-p | Prompt to execute |
-f | Output format (text, json) |
-q | Quiet mode (no spinner) |
-c | Working directory |
-d | Debug mode |
{
"content": "Here is the result...",
"session_id": "abc123"
}
~/.opencode/opencode.db
Or project-local:
.opencode/opencode.db
CREATE TABLE sessions (
id TEXT PRIMARY KEY,
parent_session_id TEXT,
title TEXT,
message_count INTEGER,
prompt_tokens INTEGER,
completion_tokens INTEGER,
summary_message_id TEXT,
cost REAL,
created_at INTEGER,
updated_at INTEGER
);
CREATE TABLE messages (
id TEXT PRIMARY KEY,
session_id TEXT,
role TEXT, -- 'user', 'assistant', 'tool'
parts TEXT, -- JSON array of content parts
model TEXT,
created_at INTEGER,
updated_at INTEGER
);
use tauri_plugin_sql::{Migration, MigrationKind};
#[tauri::command]
async fn list_sessions(db: tauri::State<'_, Database>) -> Result<Vec<Session>, String> {
let sessions = sqlx::query_as::<_, Session>(
"SELECT * FROM sessions ORDER BY updated_at DESC"
)
.fetch_all(&db.pool)
.await
.map_err(|e| e.to_string())?;
Ok(sessions)
}
import Database from "@tauri-apps/plugin-sql";
const db = await Database.load("sqlite:~/.opencode/opencode.db");
const sessions = await db.select<Session[]>(
"SELECT * FROM sessions ORDER BY updated_at DESC"
);
OpenWork can register as an MCP server that OpenCode connects to.
{
"mcpServers": {
"openwork": {
"type": "stdio",
"command": "openwork-mcp-bridge"
}
}
}
Messages contain a parts JSON array with different content types:
{ "type": "text", "text": "Hello world" }
{
"type": "tool_call",
"id": "call_123",
"name": "bash",
"input": "{\"command\": \"ls\"}"
}
{
"type": "tool_result",
"tool_call_id": "call_123",
"content": "file1.txt\nfile2.txt",
"is_error": false
}
{
"type": "finish",
"reason": "end_turn",
"time": 1704067200
}
which opencode
opencode --version
ls ~/.opencode/opencode.db
opencode -p "Hello" -f json -q
Weekly Installs
159
Repository
GitHub Stars
12.3K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode157
gemini-cli152
codex150
github-copilot149
cursor149
amp147
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
152,900 周安装