Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Labels are short, English and prefixed by dimension, so issues and PRs can be fi
| --- | --- |
| `area:canvas` | Canvas, nodes, direct manipulation |
| `area:agent` | Agent runtime, assistant chat, tools |
| `area:harness` | Harness and skill integration (Default, OpenCode, Codex, Claude Code, JiuwenSwarm, DSH, Pi) |
| `area:harness` | Harness and skill integration (Default, OpenCode, Codex, Claude Code, JiuwenSwarm, DSH, Pi, Antigravity) |
| `area:provider` | Model providers and generation protocols |
| `area:assets` | Assets, library, reference inputs |
| `area:timeline` | Timeline, subtitles, export |
Expand Down
8 changes: 5 additions & 3 deletions apps/api/src/opendirector_api/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Draft(BaseModel):
assets: list[dict[str, JsonValue]] = Field(default_factory=list, max_length=MAX_REFERENCES)
runtime: Runtime = 'default'
runtimeModel: str | None = Field(default=None, max_length=200)
harnessModels: dict[Literal["opencode", "codex", "claude", "jiuwenswarm", "deepseek", "pi"], Annotated[str, Field(max_length=200)] | None] = Field(default_factory=dict)
harnessModels: dict[Literal["opencode", "codex", "claude", "jiuwenswarm", "deepseek", "pi", "antigravity"], Annotated[str, Field(max_length=200)] | None] = Field(default_factory=dict)
thinking: Literal['auto', 'low', 'medium', 'high'] = 'auto'
builtinModelThinking: dict[str, Literal['auto', 'low', 'medium', 'high']] = Field(default_factory=dict)
modelSelections: dict[str, str | None] = Field(default_factory=dict)
Expand Down Expand Up @@ -514,7 +514,7 @@ def trace_input(project_id: UUID, turn_id: UUID):

@router.get('/traces/{turn_id}/{source}')
def trace(project_id: UUID, turn_id: UUID,
source: Literal['opencode', 'codex', 'claude', 'jiuwenswarm', 'deepseek', 'pi', 'model'],
source: Literal['opencode', 'codex', 'claude', 'jiuwenswarm', 'deepseek', 'pi', 'antigravity', 'model'],
cursor: Annotated[str | None, Query(pattern=r'^(?:[0-9]+:[0-9]+:[0-9]+)?$', max_length=64)] = None):
folder = child(conversations.path(project_id), 'agent-runs')
filename = normpath(join(folder, f'{turn_id}.{source}.jsonl'))
Expand Down Expand Up @@ -615,7 +615,7 @@ async def runtime_detail(project_id: UUID, runtime: Runtime):
return {**item, 'status': await runtime_status(runtime)}

@router.get('/runtimes/{runtime}/models')
async def runtime_models(project_id: UUID, runtime: Literal['opencode', 'codex', 'claude', 'jiuwenswarm', 'deepseek', 'pi'], selected: str | None = None):
async def runtime_models(project_id: UUID, runtime: Literal['opencode', 'codex', 'claude', 'jiuwenswarm', 'deepseek', 'pi', 'antigravity'], selected: str | None = None):
await asyncio.to_thread(conversations.path, project_id)
if runtime == 'deepseek':
from opendirector.agent.deepseek import model_choices as deepseek_models
Expand Down Expand Up @@ -789,6 +789,8 @@ async def renew_session() -> None:
if inherited:
sources.update({source['id']: source for source in inherited})
chain.events.put({'type': 'sources', 'sources': inherited})
if event['type'] == 'replace':
text = event['text']
if event['type'] == 'sources':
for source in event['sources']:
sources.setdefault(source['id'], source)
Expand Down
5 changes: 5 additions & 0 deletions apps/api/src/opendirector_api/localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@
"bigmodel_image_prompt": "Enter a GLM-Image prompt.",
"bigmodel_image_size": "GLM-Image requires a preset size, or dimensions of 1024–2048 in multiples of 32.",
"moss_layout_reference": "MOSS layout JSON does not accept additional text references. Put the requirements in the JSON or remove the text references.",
"antigravity_login": "Antigravity CLI is not signed in or its sign-in expired. Run agy in a terminal to sign in, then try again.",
"antigravity_models": "Could not read the Antigravity model list. Check the local agy installation.",
"antigravity_failed": "Antigravity did not finish this turn. Check its sign-in, the selected model, or the native trace.",
"antigravity_denied": "Antigravity requested a tool outside OpenDirector's allowed scope. It was denied and this turn has no reply.",
"antigravity_empty": "Antigravity returned no reply for this turn. Check the native trace.",
"agent_dependency_unavailable": "Bundled Agent is unavailable. Reinstall with pip install --force-reinstall opendirector; for a source checkout, use pip install -e .",
"invalid_input": "The request is invalid. Check the required fields and their formats.",
"invalid_project": "The project or asset identifier is invalid.",
Expand Down
4 changes: 4 additions & 0 deletions docs/architecture/agent-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ Harness 指承担模型调用、工具执行和上下文管理的 Agent 执行
| JiuwenSwarm | jiuwenswarm-process,优先 PATH,再查找常见 CLI 安装目录,通过 stdin/stdout JSONL 直接调用 | 本机 Jiuwen 模型目录、配置与环境变量 |
| DeepSeek Harness | dsh,优先 PATH,再查找常见 CLI 安装目录,以 acp profile 运行标准 JSON-RPC | CLI 原生 profile、模型目录与认证 |
| Pi | pi,优先 PATH,再查找 `~/.pi/agent/bin`,每轮一个 `--mode json` 进程读取原生 JSONL 事件流 | 本机 `~/.pi` 的 provider 认证、设置与模型目录 |
| Antigravity | agy,优先 PATH,再查找安装器使用的 `~/.gemini/bin`,每轮一个 `--input-format stream-json --output-format stream-json` 进程,提示从 stdin 输入 | 本机 agy 的账号登录、模型目录与全局设置 |

Default 与 OpenCode CLI 分别配置。外部 CLI 不读取 OpenDirector 保存的模型凭证。进程继承服务端环境,包括 PATH 和第三方 API 配置。

Pi 沿用用户自己的 `~/.pi` 认证与设置,因此命令行里不传模型凭证。它以 `--mode json --print` 在一次运行中输出 JSONL 事件,适配层读取 `session`、`message_update`、`message_end` 和 `agent_end`:增量只用于显示,完成的助手消息是正文依据,被重试的失败尝试不结束本轮,只有 `agent_end` 最后一条助手消息的错误才作为失败原因返回。pi 在 print/json 模式下不询问信任,启动时显式传 `--approve`;否则本工程的 `.agents/skills`、`AGENTS.md` 与 `.pi` 设置会被静默跳过。会话写入工程内的 `agent-runs/pi-sessions/native/`,续聊用 `--session-id` 复用同一执行目录,不写入用户全局会话列表。

Antigravity 沿用本机 agy 的账号登录,命令行里不传模型凭证。`-p` 不读 stdin,而完整的对话回放会超过 Windows 命令行长度上限,所以提示以一条 `{"event":"user"}` 的 stream-json 消息写入 stdin。CLI 没有系统提示参数,新会话把运行说明放在第一条消息里,续聊时不再重复。适配层把 `agent_response` 步骤的 `text_delta` 作为显示增量,以 `result.response` 为正文依据,只补出流里没有显示的部分。`result.status` 不是 `SUCCESS` 时本轮失败;headless 模式下被拒绝的工具会让 CLI 返回 `SUCCESS` 但 `response` 为空,并附带 `denied_actions`,这种情况同样判为失败并列出被拒绝的动作。续聊用 `--conversation` 复用同一执行目录;原生会话固定写在 `~/.gemini/antigravity-cli/conversations/`,CLI 不提供改到工程目录的参数,因此会出现在用户的 agy 会话列表中。续接前检查该会话文件,缺失时保留执行目录并以完整历史重新开始。agy 还会加载用户全局的 Skill、插件与 MCP 配置,CLI 没有按次关闭的参数。

会话保存 runtime、模型和推理强度,浏览器偏好用于辅助恢复选择。适配层不指定固定迭代轮数,沿用 harness 的预算和停止机制。

## 执行链路
Expand Down Expand Up @@ -99,6 +102,7 @@ English summary: a Job created by an Agent `generation.submit` records `agentRun
| JiuwenSwarm | 明确允许 skill_tool、list_skill、read_file、bash 和业务 CLI |
| DeepSeek Harness | 沿用原生工具与权限;Skill 限于本轮快照,业务操作通过 Shell 调用 opendirector,未承接的审批不自动批准 |
| Pi | `--approve --tools read,bash,write,edit`:只读、Shell 和文件编辑;Skill 与 `AGENTS.md` 由原生加载器从本轮目录读取,业务操作通过 Shell 调用 opendirector |
| Antigravity | `--settings` 仅本次生效:固定 `agentMode` 为默认模式、开启终端沙箱并使用 `proceed-in-sandbox`,命令在沙箱内自动运行;沙箱会拦截 opendirector 连接本地应用的 socket,因此只允许 `command(opendirector)` 在沙箱外运行。另允许 `read_file(*)` 和写入本轮执行目录,拒绝 `execute_url(*)`、`download_url(*)`;其他命令申请离开沙箱或其余需审批的动作在 headless 模式下自动拒绝,不使用 `--dangerously-skip-permissions`。用户全局设置可能启用 auto 模式(v1.5.7 起默认),该模式会自行判断沙箱外命令,所以按次固定模式。Skill 由原生加载器从本轮目录的 `.agents/skills` 读取,业务操作通过 Shell 调用 opendirector |

工具允许列表与操作系统沙箱提供不同约束。业务工具独立校验工程范围和输入;原生文件访问权限不授予直接改写工程存储的业务权限。

Expand Down
6 changes: 6 additions & 0 deletions docs/development/lessons.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,9 @@ When work exposes a consequential risk or a recurring problem, add a lesson or u
- **Trigger:** Adding a nested input model to an Agent query.
- **Lesson:** [PR #565](https://github.com/ThinkFlowLab/OpenDirector/pull/565) added Pipeline scopes to the query schema. Removing host-provided IDs from every definition raised `KeyError: 'queryId'` on a scope definition and prevented Agent turns from starting.
- **Check:** Project host-owned fields out of the root query branches. Verify that the exposed tool schema preserves nested discriminators and required fields, and that an Agent turn can initialize its tool gateway.

## A harness's own sandbox can block the CLI's path back to the app

- **Trigger:** Adding an external harness whose CLI runs shell commands in its own sandbox.
- **Lesson:** Antigravity CLI turns its terminal sandbox on by default in auto mode. With only permission rules passed, every `opendirector` command that reached the app failed with `Operation not permitted`: the macOS sandbox blocked the local socket outside the execution directory, and executables under `~/Documents`. `opendirector --help` still worked and the reply was a well-formed refusal, so a mocked CLI test and a successful turn status both passed while no project change was possible.
- **Check:** Accept a harness only after a real turn changes the project through `opendirector` and the result is read back. Pin the harness's sandbox and approval mode per run instead of inheriting the user's global settings, and let only `opendirector` leave the sandbox rather than every command.
4 changes: 2 additions & 2 deletions docs/development/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ The image browser workflow covers pinned, followed and mixed references. With an

## Agent 原生视觉读取 / Agent native visual inspection

发布检查使用真实 Bundled、OpenCode、Codex、Claude Code、JiuwenSwarm 和 DeepSeek Harness CLI 以及本地模型夹具,检查原图和 FFmpeg 抽帧是否以正确顺序作为可解码图片到达模型。Bundled 还检查纯文本模型不会收到图片。CI 安装固定版本的外部 CLI,所需 CLI 缺失即失败。Pi 不在此门禁内:它依赖 release CI 未提供的本机服务商凭证。
发布检查使用真实 Bundled、OpenCode、Codex、Claude Code、JiuwenSwarm 和 DeepSeek Harness CLI 以及本地模型夹具,检查原图和 FFmpeg 抽帧是否以正确顺序作为可解码图片到达模型。Bundled 还检查纯文本模型不会收到图片。CI 安装固定版本的外部 CLI,所需 CLI 缺失即失败。Pi 和 Antigravity 不在此门禁内:它们依赖 release CI 未提供的本机服务商凭证或账号登录。

Release checks use the real Bundled, OpenCode, Codex, Claude Code, JiuwenSwarm and DeepSeek Harness CLIs with local model fixtures. They verify that decodable pixels from the still and FFmpeg frame reach the model in order. The Bundled check also verifies that a text-only model receives no pixels. CI installs pinned external CLI versions and fails if a required CLI is unavailable. Pi stays out of this gate: it needs provider credentials that release CI does not provision.
Release checks use the real Bundled, OpenCode, Codex, Claude Code, JiuwenSwarm and DeepSeek Harness CLIs with local model fixtures. They verify that decodable pixels from the still and FFmpeg frame reach the model in order. The Bundled check also verifies that a text-only model receives no pixels. CI installs pinned external CLI versions and fails if a required CLI is unavailable. Pi and Antigravity stay out of this gate: they need provider credentials or an account sign-in that release CI does not provision.

```bash
OPENDIRECTOR_HARNESS_CI=1 python -m pytest tests/test_agent_visual_gate.py::test_harness_native_visual_input
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Select **Edit in this window** to request edit access. In the editing window, se

On the welcome screen, select **Get started**. Set up a language model for the built-in assistant or choose an existing harness. Then check one or more tasks. Each checked task shows its saved models or opens its setup form if you have none. **Start creating** places a node for each checked task on the same canvas. **Import media** opens the file picker. **Open an example canvas** opens an editable example project directly, with download progress in step two. Cancelling keeps your task selections. You can add more models in Settings anytime.

For external agent harnesses (Codex, OpenCode, Claude Code, DeepSeek Harness, JiuwenSwarm and Pi), OpenDirector checks the backend's `PATH` first, then common CLI installation directories. These include user bins, npm/nvm, Bun, Volta, Windows Scoop and Python Scripts, and macOS Homebrew and user Python bins. It also checks Codex desktop installs, OpenCode's `.opencode/bin`, Claude's `.claude/local`, Pi's `~/.pi/agent/bin`, and configured npm, pipx and uv bin directories. It checks known directories without scanning the whole disk. Finding a CLI does not establish authentication or configuration readiness. For other locations, add the CLI directory to the backend's `PATH` and restart the backend. The Default agent continues to use the bundled OpenCode.
For external agent harnesses (Codex, OpenCode, Claude Code, DeepSeek Harness, JiuwenSwarm, Pi and Antigravity), OpenDirector checks the backend's `PATH` first, then common CLI installation directories. These include user bins, npm/nvm, Bun, Volta, Windows Scoop and Python Scripts, and macOS Homebrew and user Python bins. It also checks Codex desktop installs, OpenCode's `.opencode/bin`, Claude's `.claude/local`, Pi's `~/.pi/agent/bin`, Antigravity's `~/.gemini/bin`, and configured npm, pipx and uv bin directories. It checks known directories without scanning the whole disk. Finding a CLI does not establish authentication or configuration readiness. For other locations, add the CLI directory to the backend's `PATH` and restart the backend. The Default agent continues to use the bundled OpenCode.

Click the gear at the bottom left to open **Settings**, then open **Model connections**. Add models for chat, image, video, or audio generation as needed.

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/user-guide.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

首次打开时,在欢迎页选择「开始设置」。为内置助手配置一个语言模型,或选择已有的 Harness。接着勾选一项或多项任务。每个勾选项可以选用已有模型,缺模型时直接显示对应的配置表单。点击「开始创作」后,画布会为每项任务添加一个节点。点「导入素材」可直接选文件,点「打开示例画布」可直接进入可编辑的示例项目,下载进度在第二步显示。取消时会保留已勾选的任务。之后可随时在设置中添加其他模型。

选择外部 Agent harness(Codex、OpenCode、Claude Code、DeepSeek Harness、JiuwenSwarm 和 Pi)时,OpenDirector 优先检查后端的 `PATH`,再查找常见 CLI 安装目录,包括用户命令目录、npm/nvm、Bun、Volta、Windows Scoop 与 Python Scripts,以及 macOS Homebrew 和用户 Python 命令目录。同时检查 Codex 桌面版、OpenCode 的 `.opencode/bin`、Claude 的 `.claude/local`,Pi 的 `~/.pi/agent/bin`,以及配置的 npm、pipx 和 uv 命令目录。检测仅访问已知目录,不扫描整个磁盘;找到 CLI 后仍需检查认证与配置是否就绪。其他安装位置可加入后端的 `PATH`,然后重启后端。Default Agent 仍使用应用内置的 OpenCode。
选择外部 Agent harness(Codex、OpenCode、Claude Code、DeepSeek Harness、JiuwenSwarm、Pi 和 Antigravity)时,OpenDirector 优先检查后端的 `PATH`,再查找常见 CLI 安装目录,包括用户命令目录、npm/nvm、Bun、Volta、Windows Scoop 与 Python Scripts,以及 macOS Homebrew 和用户 Python 命令目录。同时检查 Codex 桌面版、OpenCode 的 `.opencode/bin`、Claude 的 `.claude/local`,Pi 的 `~/.pi/agent/bin`、Antigravity 的 `~/.gemini/bin`,以及配置的 npm、pipx 和 uv 命令目录。检测仅访问已知目录,不扫描整个磁盘;找到 CLI 后仍需检查认证与配置是否就绪。其他安装位置可加入后端的 `PATH`,然后重启后端。Default Agent 仍使用应用内置的 OpenCode。

点击左下角齿轮进入“设置”,打开“模型接入”,按用途添加对话、图片、视频或音频模型。

Expand Down
Loading
Loading