OpenCode 的 share 功能 允许你为自己的 OpenCode 对话创建 public links,这样你就可以与 teammates 协作,或从其他人那里获得帮助。
How it works(工作原理)
当你分享一个对话时,OpenCode 会执行以下操作:
- 为你的 session 创建一个唯一的 public URL
- 将你的 conversation history 同步到我们的 servers
- 通过可分享链接访问该对话 ——
opncd.ai/s/<share-id>
Sharing(分享方式)
OpenCode 支持三种 sharing 模式,用于控制对话如何被分享:
Manual(默认)
默认情况下,OpenCode 使用 manual 分享模式。session 不会自动分享,但你可以通过 /share 命令手动分享:
/share
该命令会生成一个唯一的 URL,并自动复制到你的 clipboard。
如果你希望在 [config file] 中显式设置为 manual 模式,可以这样配置:
```json title=”opencode.json” { “$schema”: “https://opncd.ai/config.json“, “share”: “manual” }
---### Auto-share(自动分享)你可以在 [config file] 中将 `share` 选项设置为 `"auto"`,从而为所有新对话启用自动分享:```json title="opencode.json"{"$schema": "https://opncd.ai/config.json","share": "auto"}
启用 auto-share 后,每一个新 conversation 都会自动被分享,并生成一个访问链接。
Disabled(禁用分享)
你可以在 [config file] 中将 share 选项设置为 "disabled",从而完全关闭分享功能:
```json title=”opencode.json” { “$schema”: “https://opncd.ai/config.json“, “share”: “disabled” }
如果你希望在团队层面强制执行该配置,可以将它添加到项目中的 `opencode.json` 并提交到 Git。---## Un-sharing(取消分享)如果你想停止分享某个对话并将其从 public 访问中移除,可以执行:
/unshare ```
该命令会移除 share link,并删除与该对话相关的数据。
Privacy(隐私)
在分享对话时,有几个需要注意的点。
Data retention(数据保留)
被分享的对话会一直保持可访问状态,直到你主动执行 unshare。这包括:
- 完整的 conversation history
- 所有 messages 和 responses
- Session metadata
Recommendations(建议)
- 只分享不包含敏感信息的对话。
- 在分享前先检查 conversation 内容。
- 协作完成后及时取消分享。
- 避免分享包含 proprietary code 或 confidential data 的对话。
- 对于敏感项目,建议完全禁用 sharing 功能。
For enterprises(企业场景)
对于 enterprise 部署场景,share 功能可以:
- 完全禁用(Disabled),以满足安全合规要求
- 仅允许通过 SSO 认证的用户访问(Restricted)
- Self-hosted(自托管) 在你自己的基础设施上
