Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

fix(creator): stabilize agent and provider workflows

Leggett5aabd4028e2d
diff --git a/.codex/skills/oc-deploy/references/runbook.md b/.codex/skills/oc-deploy/references/runbook.md
index 25dd1435..2a3782e1 100644
--- a/.codex/skills/oc-deploy/references/runbook.md
+++ b/.codex/skills/oc-deploy/references/runbook.md
@@ -9,7 +9,7 @@ HTTP_PROXY=http://127.0.0.1:7897
HTTPS_PROXY=http://127.0.0.1:7897
```
-检查 Node、pnpm 和 `runtime/krillinai/go.mod` 要求的 Go 版本。本机可能使用 `.tools/go-1.22.12/bin/go`,但不要假定它永远存在。不要提交 `.tools/` 或 `.codex/`。
+检查 Node、pnpm 和 `runtime/krillinai/go.mod` 要求的 Go 版本。运行 `command -v go` 和 `go version`,确认 PATH 中的系统 Go 满足 `go.mod` 且兼容当前操作系统;不得把未经验证的 `.tools/go-*` 放在 PATH 前面。项目级 `.codex/skills/oc-*` 可以提交,其他 `.codex` 本地状态和 `.tools/` 不得提交。
## Diagnose:只读诊断
@@ -28,12 +28,15 @@ gh run view <run-id> --repo krillinai/OpenCreator --log-failed
先按改动影响运行定向测试。发布门禁至少包括当前机器原生架构的实际 App 打包和完整 packaged App E2E。macOS arm64 示例:
```bash
-PATH="$PWD/.tools/go-1.22.12/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" \
+command -v go
+go version
+
+PATH="/usr/local/bin:$PATH" \
HTTP_PROXY=http://127.0.0.1:7897 HTTPS_PROXY=http://127.0.0.1:7897 \
OPENCREATOR_DESKTOP_TARGET_PLATFORM=darwin OPENCREATOR_DESKTOP_TARGET_ARCH=arm64 \
pnpm desktop:package
-PATH="$PWD/.tools/go-1.22.12/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" \
+PATH="/usr/local/bin:$PATH" \
HTTP_PROXY=http://127.0.0.1:7897 HTTPS_PROXY=http://127.0.0.1:7897 \
pnpm --filter @opencreator/desktop e2e:package
```
diff --git a/.codex/skills/oc-pr/SKILL.md b/.codex/skills/oc-pr/SKILL.md
new file mode 100644
index 00000000..768cf2e6
--- /dev/null
+++ b/.codex/skills/oc-pr/SKILL.md
@@ -0,0 +1,80 @@
+---
+name: oc-pr
+description: 评估和处理 OpenCreator GitHub PR,先审查实际功能与风险,对不能合入的 PR 用英文反馈,并将满足门禁的 PR 合并到 develop。用于查看、评审或处理 https://github.com/krillinai/OpenCreator/pulls;不用于合并 master 或发布。
+---
+
+# OpenCreator PR
+
+处理 `https://github.com/krillinai/OpenCreator/pulls` 的实时开放 PR。遵守根目录 `AGENTS.md`,所有产品 PR 的目标分支必须是 `develop`。
+
+## 先确定授权模式
+
+- 用户说“查看、评估、review”时只读:不得提交 GitHub review、修改 PR、合并或推送。
+- 用户说“处理 PR、反馈并合并、合并可用 PR”时可提交英文 review,并把满足门禁的 PR 合并到 `develop`。
+- 不把处理 PR 的授权扩展为合并 `master`、强制管理员合并、创建 tag 或发布。
+
+## 获取事实
+
+1. 使用 GitHub API/`gh pr list` 获取当前开放 PR;不得用本地陈旧 `refs/pr/*` 代替页面状态。
+2. 对每个 PR 读取 base/head、提交、文件、描述、checks、reviews、mergeability 和已有讨论。
+3. 网络慢时可设置 `HTTP_PROXY`、`HTTPS_PROXY` 为 `http://127.0.0.1:7897`;先确认 `gh auth status`。
+4. base 不是 `develop` 时不得原样合并。用英文要求 retarget,或在用户明确授权后调整 base。
+
+## 评审顺序
+
+先解释 PR 为用户增加或改变什么功能,再检查实现。不要只根据 CI 颜色或文件数量判断。
+
+执行评审前读取 [references/review-checklist.md](references/review-checklist.md)。重点确认业务正确性、失败/取消/重试、数据与历史版本、凭据隐私、协议边界、Web/Desktop 一致性和 Creator Panel 架构。
+
+测试证据按风险选择:先运行最接近的定向测试和受影响包 typecheck;只有共享层或真实交互无法局部覆盖时扩大。不要为评审普通 PR 自动运行 Desktop 打包。
+
+## 决策
+
+- `APPROVE`:功能正确、边界合理、必要验证通过、无阻断问题。
+- `COMMENT`:有非阻断建议,不影响合入。
+- `REQUEST_CHANGES`:存在可复现功能错误、安全/数据风险、架构违规或必要验证缺口。
+- `BLOCKED_BY_CONFLICTS`:与最新 `develop` 冲突,必须更新分支并重新验证。
+
+不能合入时,按 reference 中的格式用英文提交具体 review:说明当前行为、用户影响、证据和期望修复。不要只写 “tests missing” 或泛泛的风险。
+
+## 合并到 develop
+
+处理模式下,先验证合并结果,再修改远端 `develop`。只有以下条件全部满足才合并:
+
+1. base 是 `develop`,PR 非 draft。
+2. GitHub 报告 mergeable,且没有未解决的阻断 review。
+3. required checks 通过;无 checks 的高风险改动不得直接合并。
+4. 功能评审没有阻断问题,必要的定向验证通过。
+5. 合并前重新获取 `origin/develop`,避免基于过期状态判断。
+6. PR 与最新 `origin/develop` 形成的独立 merge commit 已通过 `$oc-verify` L1;多个重叠 PR 或共享层改动使用 L2。
+
+### 本地合并和验证
+
+1. 要求当前 Git 已跟踪文件没有未提交修改;不得把用户已有修改带入 PR merge commit。获取最新 `origin/develop`,记录 base SHA 和 PR head SHA。
+2. 从精确的 `origin/develop` 创建仅供本次 PR 使用的本地集成分支,例如 `review/pr-<number>-merge`。不创建 worktree,也不并行处理其他 PR。
+3. 使用 `git merge --no-ff <pr-head>` 创建一个只包含该 PR 的独立 merge commit,提交信息标明 PR 编号和来源分支。发生冲突时执行 `git merge --abort`,切回 `develop`,将 PR 标记为 `BLOCKED_BY_CONFLICTS`,并用英文要求提交者更新分支。除非用户明确授权代为解决,否则不得在维护者分支解决冲突。
+4. 创建 merge commit 后完成本轮 `$oc-pr`,不得自动调用 `$oc-verify`。向用户报告 PR 功能、评审结论、base SHA、PR head SHA、merge commit,以及建议的验证级别和预计范围,然后暂停等待确认。
+
+### 显式验证交接
+
+交接提示必须明确说明下一步会做什么,例如:
+
+```text
+PR #<number> 已完成评审并生成本地 merge commit <sha>,尚未更新 develop。
+建议继续执行 $oc-verify L1(或 L2),预计验证:<测试范围>。
+验证通过后将 fast-forward 并 push develop;失败则保持远端不变。是否继续?
+```
+
+只有用户明确确认后,才读取并执行 `$oc-verify`。确认同时授权完成提示中已明确写出的后续动作:验证通过后继续 fast-forward 和 push `develop`;如果提示没有说明 push,则验证后必须再次询问,不得自行推送。
+
+验证失败或仅得到 `PARTIALLY_VERIFIED` 时切回 `develop`,不得 fast-forward、push 或改写远端;保留失败集成分支供诊断,是否删除由后续明确操作决定。只有 `VERIFIED` 或适用于该精确 merge commit 的 `VERIFIED_BY_CI` 才能继续合并;L3 的 `MASTER_SOURCE_READY` 不属于普通 PR 必需条件。
+
+验证通过后再次 fetch,并确认 `origin/develop` 仍是记录的 base SHA。若已前进,当前 merge commit 失效:切回 `develop`,从新的 `origin/develop` 重新创建独立集成分支、merge commit 并验证,不得直接 rebase 后复用旧结果。
+
+base 未变化时,切回本地 `develop`,确保它可以 `--ff-only` 到已验证 merge commit,然后 push `develop`。不得调用会重新生成另一个 merge/squash commit 的 GitHub 合并方式;远端必须收到本机已经验证的精确 commit。push 后确认 `origin/develop`、本地 `develop` 和已验证 commit 完全一致,并确认 GitHub PR 已关闭或标记 merged。
+
+多个 PR 必须逐个处理:每个 PR 一个 `--no-ff` merge commit,每次验证通过并 push 后刷新 `origin/develop`,再处理下一个。不要在一个提交里混合多个 PR;后续 PR 出现回归时通过 revert 对应 merge commit 恢复,不对共享 `develop` reset 或 force push。
+
+## 交付
+
+逐个列出功能、关键发现、GitHub 决策、merge commit 和合并后验证。未执行的真实 Provider、跨平台或 Packaged App 验证必须明确说明。
diff --git a/.codex/skills/oc-pr/agents/openai.yaml b/.codex/skills/oc-pr/agents/openai.yaml
new file mode 100644
index 00000000..7cf7fb4a
--- /dev/null
+++ b/.codex/skills/oc-pr/agents/openai.yaml
@@ -0,0 +1,4 @@
+interface:
+ display_name: "OpenCreator PR"
+ short_description: "评审开放 PR、英文反馈并合并合格改动到 develop"
+ default_prompt: "使用 $oc-pr 处理当前开放 PR,评估功能并将符合条件的改动合并到 develop。"
diff --git a/.codex/skills/oc-pr/references/review-checklist.md b/.codex/skills/oc-pr/references/review-checklist.md
new file mode 100644
index 00000000..6d2919c2
--- /dev/null
+++ b/.codex/skills/oc-pr/references/review-checklist.md
@@ -0,0 +1,67 @@
+# PR 功能评审清单
+
+按 PR 实际风险选择相关部分,不要求每项机械展开。
+
+## 功能与数据
+
+- 用户入口、输入、输出和成功路径是否完整。
+- 空值、上限、非法格式、重复提交、取消、失败和重试是否得到正确结果。
+- 是否会丢失或覆盖已有数据;历史版本、stale 状态和依赖传播是否一致。
+- 文件是否进入受管理目录,路径、大小、编码和下载权限是否受控。
+
+## 架构边界
+
+- Creator 模板复用唯一 `CreatorCollaborationPanel`;差异通过 Adapter、配置或局部 slot 表达。
+- 通用 Panel 不读取执行器私有字段;Runtime 进度使用统一字段。
+- UI-only 状态不写入用户可见 Activity。
+- 通用业务由 Web 与 Daemon 共用;Desktop 差异通过真实 capability 表达。
+- Browser 不显示无效原生入口,Desktop 入口真实调用 Bridge。
+
+## 协议、凭据和运行时
+
+- 协议生产者与所有消费者同步更新,兼容旧持久化数据。
+- 凭据不进入日志、可见配置或仓库;环境变量来源和优先级明确。
+- Provider 请求的认证、超时、取消、响应大小、错误帧和重试语义正确。
+- Mock 测试不能替代关键第三方协议的真实 smoke evidence。
+
+## 测试证据
+
+- 单元测试覆盖关键分支而非只验证组件出现。
+- 共享状态和持久化有 integration test。
+- Creator 新模板包含 Adapter、Activity 过滤去重、Stage 和真实进度测试。
+- Web/Desktop 相关改动包含相同 Fake Daemon、视口、Runtime 调用和持久化结果 parity。
+- CI 必须对应当前 head SHA;旧 run 不能证明更新后的分支。
+
+## 英文反馈模板
+
+```markdown
+Thanks for the contribution. I reviewed the feature behavior,
+implementation boundaries, and validation evidence.
+
+## Blocking issues
+
+### 1. <Concise problem>
+
+<What the code currently does, with a file or behavior reference.>
+
+Impact:
+<The observable failure, data risk, security issue, or violated contract.>
+
+Required change:
+<The concrete behavior or verification needed before merging.>
+
+## Verification required
+
+- <Targeted test or scenario>
+- <Relevant parity, runtime, or provider evidence>
+```
+
+无阻断问题时可使用:
+
+```markdown
+The feature behavior and implementation boundaries look correct.
+The targeted tests and required parity checks pass. Approved for
+merging into develop.
+```
+
+只反馈有证据的问题。把偏好型建议标为 non-blocking,不用 request changes 阻止合并。
diff --git a/.codex/skills/oc-verify/SKILL.md b/.codex/skills/oc-verify/SKILL.md
new file mode 100644
index 00000000..ef329d96
--- /dev/null
+++ b/.codex/skills/oc-verify/SKILL.md
@@ -0,0 +1,47 @@
+---
+name: oc-verify
+description: 验证 OpenCreator develop 分支的增量功能、共享集成和进入 master 前的源码门禁。用于“验证 develop”“检查合并后功能”“确认能否进 master”等请求;普通局部开发修改和实际 Desktop 打包发布不使用。
+---
+
+# OpenCreator Verify
+
+遵守仓库根目录 `AGENTS.md`。目标是用与风险匹配的最小证据证明 `develop` 正常,不把每次验证升级为全仓测试或 Desktop 打包。
+
+## 选择验证级别
+
+- **L1 增量验证(默认,目标 5–10 分钟)**:验证上一个可信基线到当前 `develop` 的改动。执行相关定向测试、受影响 TypeScript 包 typecheck、`git diff --check`,仅在真实交互或平台能力受影响时运行对应 Playwright 用例。
+- **L2 集成验证(目标 10–20 分钟)**:仅用于多个重叠 PR、共享协议/状态/持久化/Creator Service/Host Bridge 改动,或 L1 暴露跨模块影响。验证直接受影响的所有包和用户流程,但不默认全仓测试或 Desktop 打包。
+- **L3 master 源码门禁(用户明确要求)**:用于“验证整个 develop”“准备合并 master”“发布前源码检查”。优先复用同一 commit 已成功的 GitHub CI;缺少可信 CI 时运行与 `.github/workflows/ci.yml` 等价的源码门禁。
+
+执行前读取 [references/verification-matrix.md](references/verification-matrix.md),按改动路径和行为选择验证,不机械执行所有命令。
+
+## 基线和范围
+
+1. 确认当前分支、HEAD、dirty 状态、`origin/develop`、CI workflow 触发条件和已有 runs。保留用户已有改动,不提交 `.tools/` 或无关文件。当前 workflow 不监听 `develop` push 时,不等待或假定会出现 develop push CI。
+2. 可信基线依次为:同一 HEAD 的成功 CI、最近成功且确实覆盖该基线 commit 的 CI、同一会话内对精确 HEAD 有完整命令和结果记录的本地验证。计算该基线到当前 HEAD 的 diff。
+3. PR head 的成功 CI 只是支持证据,不等同于 merge commit 的 CI。无冲突合并且 merge 后代码树等价时可减少重复;发生冲突或手工改动时必须验证冲突涉及的行为。
+4. 已有同一 commit 的成功 CI 或同一会话精确 HEAD 的完整结果时不要重复相同套件;只补未覆盖且与请求相关的真实交互或平台验证。不得凭模糊的历史描述复用本地结果。
+5. 任何失败先判断是否与本次增量相关。无关历史失败只记录;相关失败才允许扩大一层,且扩大前说明原因。
+
+## 时间和停止条件
+
+- L1 默认预算 10 分钟,L2 默认预算 20 分钟。单项合理测试可完成后再停止,但不得无界追加验证。
+- 同一失败最多进行一次有证据的针对性复验。不得靠重复运行掩盖不稳定测试。
+- 不自动安装大型 Runtime、浏览器、模型或打包依赖;确有必要时先说明成本和原因。
+- 不自动运行 `desktop:package`、Packaged App E2E、远端 candidate 或 release。实际应用包验证交给 `$oc-deploy`。
+
+## Web/Desktop 门禁
+
+修改 Web 页面、共享状态、Service、Host Bridge、Daemon 通用业务、Desktop Preload 或协议代理时,必须判断一致性影响。只有相关功能涉及这些边界时运行对应 parity 用例;不要因此默认跑完整 Desktop 包。
+
+## 结果格式
+
+只使用以下结论,并列出实际运行的命令、通过数、跳过项和失败原因:
+
+- `VERIFIED`:本次增量的最小充分验证通过。
+- `VERIFIED_BY_CI`:相同 commit 的适用 CI 已通过,本地未重复。
+- `PARTIALLY_VERIFIED`:环境或预算限制导致必要验证未完成。
+- `FAILED`:相关验证失败,报告首个决定性错误。
+- `MASTER_SOURCE_READY`:仅 L3 完整源码门禁通过。
+
+未执行 `$oc-deploy` preflight 时同时写明 `PACKAGE_NOT_VERIFIED`,不得声称 master 打包应用或发布候选已经正常。
diff --git a/.codex/skills/oc-verify/agents/openai.yaml b/.codex/skills/oc-verify/agents/openai.yaml
new file mode 100644
index 00000000..56261361
--- /dev/null
+++ b/.codex/skills/oc-verify/agents/openai.yaml
@@ -0,0 +1,4 @@
+interface:
+ display_name: "OpenCreator Verify"
+ short_description: "验证 develop 增量功能和进入 master 的源码门禁"
+ default_prompt: "使用 $oc-verify 验证当前 develop 的功能和发布前源码门禁。"
diff --git a/.codex/skills/oc-verify/references/verification-matrix.md b/.codex/skills/oc-verify/references/verification-matrix.md
new file mode 100644
index 00000000..065b8be5
--- /dev/null
+++ b/.codex/skills/oc-verify/references/verification-matrix.md
@@ -0,0 +1,41 @@
+# Develop 验证矩阵
+
+先根据 `git diff --name-only <trusted-base>...HEAD` 识别行为影响,再选择最小集合。路径只是入口;实际依赖关系优先于机械匹配。
+
+## 路径到验证
+
+| 改动范围 | L1 默认验证 | 升级条件 |
+| --- | --- | --- |
+| `apps/web/src/**` | 最近的 Vitest;Web typecheck | 共享交互、Bridge 或无法由组件测试覆盖时增加对应 parity |
+| `apps/daemon/src/**` | 最近的 unit/integration;Daemon typecheck | API、持久化、Stage 或跨模块调用变化时扩大相关集成测试 |
+| `packages/protocol/**` | Protocol build;直接消费者 typecheck | 公共协议行为变化时验证 Daemon、Web、Desktop 相关消费者 |
+| `runtime/krillinai/**` | 先确认 PATH 中 Go 满足 `go.mod` 且兼容当前系统,再运行仓库的 `pnpm krillinai:test` 或可限定的 `go test` | 跨 pipeline/CLI/service 边界时扩大相关包;缺少兼容工具链时停止并标记部分验证,不自动下载 Go |
+| `apps/desktop/src/preload/**`、Host Bridge | Desktop test/typecheck;对应 parity | 原生能力或窗口生命周期变化时进入 `$oc-deploy` preflight |
+| Creator 模板/Adapter/Panel | Adapter、Activity 过滤去重、Stage、进度和 Workspace 定向测试 | 共享 Panel 或 Runtime 契约变化时升 L2 |
+| CSS、文案、展示条件 | 最近组件测试;必要时截图检查 | 不因纯展示改动运行全仓测试 |
+| 构建、打包、资源清单 | 相关构建脚本测试 | 真实交付包验证使用 `$oc-deploy` |
+
+## L2 典型集合
+
+- 受影响包 typecheck。
+- 共享层对应的 unit/integration tests。
+- 每个被改变用户流程的一条主要成功路径和关键失败路径。
+- 相关 `apps/web/e2e/web-desktop-parity.spec.ts` 用例,使用测试标题 `--grep` 限定范围。
+- 仅在编译边界、懒加载、资源产物或构建配置变化时运行对应 build。
+
+## L3 CI 等价门禁
+
+先读取当前 `.github/workflows/ci.yml` 的触发条件,再检查当前 HEAD 的 GitHub CI。workflow 未监听 `develop` push 时,空 run 列表是预期状态,不得把等待一个不会触发的 run 当作验证。没有可复用的成功 run 时,以 workflow 当前内容为准执行,不把此清单当成永久固定副本。当前关注项包括:
+
+- frozen lockfile、writing templates 和高危依赖审计;
+- KrillinAI tests;
+- 全仓 tests、typecheck 和 build;
+- scheduled-task upgrade、smoke;
+- Chromium Desktop Web/Desktop parity;
+- 性能测量和基线检查。
+
+L3 证明源码候选状态,不证明实际 Electron 包。Desktop 包、嵌入 Web 哈希和 Packaged App E2E 必须由 `$oc-deploy` 完成。
+
+## 环境失败
+
+命令缺失、动态加载器错误、浏览器未安装或平台不支持不等于测试断言失败。仓库的 `pnpm krillinai:test` 当前调用 PATH 中的 `go`,不负责安装或选择 Go;运行前先检查 `command -v go`、`go version` 和 `runtime/krillinai/go.mod`。不要因为发现 `.tools/go-*` 就假定它与当前系统动态加载器兼容,也不要为普通 L1/L2 自动下载新工具链。记录原始错误;没有兼容工具链时标记 `PARTIALLY_VERIFIED`,不得改写成通过。
diff --git a/.gitignore b/.gitignore
index 7d296ebc..eca5cb21 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,8 +13,17 @@ test-results/
codex-main/
open-design-main/
.gstack/
-.codex/
+.codex/*
+!.codex/skills/
+.codex/skills/*
+!.codex/skills/oc-deploy/
+!.codex/skills/oc-deploy/**
+!.codex/skills/oc-pr/
+!.codex/skills/oc-pr/**
+!.codex/skills/oc-verify/
+!.codex/skills/oc-verify/**
.worktrees/
+/.tools/
/.tmp/
/codex/
/runtime/krillinai/bin/
diff --git a/apps/daemon/src/api/server.ts b/apps/daemon/src/api/server.ts
index 99d6cbb2..1290dbc7 100644
--- a/apps/daemon/src/api/server.ts
+++ b/apps/daemon/src/api/server.ts
@@ -471,7 +471,7 @@ export async function buildServer(input: BuildServerInput) {
const runtimeTransport = input.runtimeTransport ?? 'app-server';
const getAgentToolBaseUrl = () =>
resolveListeningOrigin(server.server.address());
- const creatorAgentBootstrap = bootstrapCreatorAgentRuntime({
+ const creatorAgentBootstrapInput = {
sourceCodexHome: codexHome,
runtimeRoot: runtimeDir,
...(input.appHome === undefined
@@ -484,7 +484,8 @@ export async function buildServer(input: BuildServerInput) {
'runtime',
'opencreator-runtime'
)
- });
+ };
+ let creatorAgentBootstrap = bootstrapCreatorAgentRuntime(creatorAgentBootstrapInput);
const codexRuntimeReadiness = createCodexRuntimeReadiness({
client: codexControlClient,
mode: process.env.OPENCREATOR_CODEX_RUNTIME_MODE === 'external'
@@ -518,7 +519,7 @@ export async function buildServer(input: BuildServerInput) {
},
async onProviderUpdated(provider) {
if (provider.apiKey !== undefined) {
- await codexProviderCredentialStore.writeApiKey(provider.apiKey);
+ await codexProviderCredentialStore.writeApiKey(provider.apiKey, provider);
}
},
async onConfigurationChanged() {
@@ -527,6 +528,16 @@ export async function buildServer(input: BuildServerInput) {
codexSessionProvider.restart?.(),
invalidatePersistentRuntime('codex_provider_config_changed')
]);
+ for (const thread of threadManager.listThreads({
+ status: 'active',
+ purpose: 'creator_agent'
+ })) {
+ threadManager.setCodexThreadId(thread.id, null);
+ }
+ creatorAgentBootstrap = bootstrapCreatorAgentRuntime(creatorAgentBootstrapInput);
+ if (!creatorAgentBootstrap.available) {
+ throw new Error(creatorAgentBootstrap.error ?? 'Creator Agent bootstrap failed');
+ }
}
});
const creatorServicesConfigStore =
diff --git a/apps/daemon/src/codex/provider-config.ts b/apps/daemon/src/codex/provider-config.ts
index 37ce6f2d..17ded442 100644
--- a/apps/daemon/src/codex/provider-config.ts
+++ b/apps/daemon/src/codex/provider-config.ts
@@ -83,11 +83,7 @@ export function createCodexProviderConfigService(input: {
'请填写 API Key'
);
}
- if (
- normalized.baseUrl.length > 0
- && loginApiKey === undefined
- && current.authentication !== 'api_key'
- ) {
+ if (normalized.baseUrl.length > 0 && loginApiKey === undefined) {
throw new CodexProviderConfigValidationError(
'自定义 Base URL 需要 API Key 登录'
);
@@ -96,6 +92,9 @@ export function createCodexProviderConfigService(input: {
const write = await input.client.request<ConfigWriteResponse>('config/batchWrite', {
edits: [
{ keyPath: 'model', value: normalized.model, mergeStrategy: 'replace' },
+ ...(current.modelProvider.length > 0 && normalized.baseUrl === current.baseUrl
+ ? []
+ : [{ keyPath: 'model_provider', value: null, mergeStrategy: 'replace' }]),
{
keyPath: 'openai_base_url',
value: normalized.baseUrl.length === 0 ? null : normalized.baseUrl,
@@ -148,7 +147,9 @@ function presentProviderConfig(
return {
baseUrl: state.baseUrl,
model: state.model,
- apiKeyConfigured: state.authentication === 'api_key' || storedApiKeyConfigured,
+ apiKeyConfigured: state.baseUrl.length > 0
+ ? storedApiKeyConfigured
+ : state.authentication === 'api_key' || storedApiKeyConfigured,
authentication: state.authentication,
...(state.configVersion === undefined ? {} : { configVersion: state.configVersion })
};
@@ -172,6 +173,7 @@ async function readStoredApiKey(
async function readProviderState(client: RestartableCodexAppServerRequestClient): Promise<{
baseUrl: string;
model: string;
+ modelProvider: string;
authentication: CodexProviderAuthentication;
configVersion?: string;
}> {
@@ -184,9 +186,13 @@ async function readProviderState(client: RestartableCodexAppServerRequestClient)
]);
const config = readRecord(configResponse.config);
const configVersion = readUserConfigVersion(configResponse.layers);
+ const modelProvider = readString(config, 'model_provider');
+ const configuredProvider = readRecord(readRecord(config?.model_providers)?.[modelProvider]);
+ const providerBaseUrl = readString(configuredProvider, 'base_url');
return {
- baseUrl: readString(config, 'openai_base_url'),
+ baseUrl: providerBaseUrl || readString(config, 'openai_base_url'),
model: readString(config, 'model'),
+ modelProvider,
authentication: authenticationOf(accountResponse),
...(configVersion === undefined ? {} : { configVersion })
};
diff --git a/apps/daemon/src/codex/provider-credential-store.ts b/apps/daemon/src/codex/provider-credential-store.ts
index b5d57c0a..aa6b80dc 100644
--- a/apps/daemon/src/codex/provider-credential-store.ts
+++ b/apps/daemon/src/codex/provider-credential-store.ts
@@ -13,8 +13,8 @@ type CredentialEntry = {
};
export type CodexProviderCredentialStore = {
- readApiKey(): Promise<string | undefined>;
- writeApiKey(apiKey: string): Promise<void>;
+ readApiKey(provider?: CodexProviderIdentity): Promise<string | undefined>;
+ writeApiKey(apiKey: string, provider?: CodexProviderIdentity): Promise<void>;
};
export type CodexProviderIdentity = {
@@ -40,7 +40,7 @@ export function createFileCodexProviderCredentialStore(
path: string
): CodexProviderCredentialStore {
return {
- async readApiKey() {
+ async readApiKey(provider) {
const value = await readPrivateJsonFile(path);
if (value === undefined) return undefined;
if (
@@ -50,13 +50,18 @@ export function createFileCodexProviderCredentialStore(
) {
throw new Error('CODEX_PROVIDER_CONFIG_INVALID');
}
+ if (
+ provider !== undefined
+ && value.baseUrl !== normalizeBaseUrl(provider.baseUrl)
+ ) return undefined;
const apiKey = value.apiKey.trim();
return apiKey.length === 0 ? undefined : apiKey;
},
- async writeApiKey(apiKey) {
+ async writeApiKey(apiKey, provider) {
await writePrivateJsonFile(path, {
version: 1,
- apiKey
+ apiKey,
+ ...(provider === undefined ? {} : { baseUrl: normalizeBaseUrl(provider.baseUrl) })
});
}
};
@@ -66,15 +71,22 @@ export function createOpenCreatorCodexProviderCredentialStore(
path: string
): CodexProviderCredentialStore {
return {
- async readApiKey() {
+ async readApiKey(provider) {
const document = await readOpenCreatorCredentials(path);
const current = document.codexProvider?.apiKey.trim();
+ if (
+ provider !== undefined
+ && document.codexProvider?.baseUrl !== normalizeBaseUrl(provider.baseUrl)
+ ) return undefined;
return current === undefined || current.length === 0 ? undefined : current;
},
- async writeApiKey(apiKey) {
+ async writeApiKey(apiKey, provider) {
await updateOpenCreatorCredentials(path, value => ({
...value,
- codexProvider: { apiKey }
+ codexProvider: {
+ apiKey,
+ ...(provider === undefined ? {} : { baseUrl: normalizeBaseUrl(provider.baseUrl) })
+ }
}));
}
};
@@ -91,7 +103,7 @@ export async function readCodexProviderApiKey(input: {
}): Promise<string | undefined> {
let apiKey: string | undefined;
try {
- apiKey = await input.store.readApiKey();
+ apiKey = await input.store.readApiKey(input.provider);
} catch {
apiKey = undefined;
}
@@ -107,7 +119,7 @@ export async function readCodexProviderApiKey(input: {
: undefined;
if (legacyApiKey !== undefined) {
try {
- await input.store.writeApiKey(legacyApiKey);
+ await input.store.writeApiKey(legacyApiKey, input.provider);
} catch {
// Keep using the legacy value until file migration succeeds.
}
@@ -115,6 +127,10 @@ export async function readCodexProviderApiKey(input: {
return legacyApiKey;
}
+function normalizeBaseUrl(baseUrl: string): string {
+ return baseUrl.trim().replace(/\/+$/, '');
+}
+
function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value);
}
diff --git a/apps/daemon/src/config/credentials-file.ts b/apps/daemon/src/config/credentials-file.ts
index c4db07c2..fc55a304 100644
--- a/apps/daemon/src/config/credentials-file.ts
+++ b/apps/daemon/src/config/credentials-file.ts
@@ -8,6 +8,7 @@ export type OpenCreatorCredentialsDocument = {
creatorServices?: Record<string, string>;
codexProvider?: {
apiKey: string;
+ baseUrl?: string;
};
};
@@ -24,7 +25,12 @@ export async function readOpenCreatorCredentials(
? { creatorServices: value.creatorServices }
: {}),
...(isRecord(value.codexProvider) && typeof value.codexProvider.apiKey === 'string'
- ? { codexProvider: { apiKey: value.codexProvider.apiKey } }
+ ? { codexProvider: {
+ apiKey: value.codexProvider.apiKey,
+ ...(typeof value.codexProvider.baseUrl === 'string'
+ ? { baseUrl: value.codexProvider.baseUrl }
+ : {})
+ } }
: {})
};
}
diff --git a/apps/daemon/src/image-generation/provider.ts b/apps/daemon/src/image-generation/provider.ts
index 1039b0a9..b591af2b 100644
--- a/apps/daemon/src/image-generation/provider.ts
+++ b/apps/daemon/src/image-generation/provider.ts
@@ -231,7 +231,10 @@ function openAiImageEndpoint(
baseUrl: string,
operation: 'generations' | 'edits'
): URL {
- const endpoint = openAiCompatibleEndpoint(baseUrl, 'images/generations');
+ const endpoint = openAiCompatibleEndpoint(
+ versionedOpenAiImageBaseUrl(baseUrl),
+ 'images/generations'
+ );
endpoint.pathname = endpoint.pathname.replace(
/\/images\/generations$/i,
`/images/${operation}`
@@ -239,6 +242,21 @@ function openAiImageEndpoint(
return endpoint;
}
+function versionedOpenAiImageBaseUrl(baseUrl: string): string {
+ const trimmed = baseUrl.trim();
+ if (!trimmed) return trimmed;
+ const url = new URL(trimmed);
+ const segments = url.pathname.split('/').filter(Boolean);
+ if (segments.some(segment => /^v\d+(?:[a-z][a-z0-9-]*)?$/i.test(segment))) {
+ return url.toString();
+ }
+ const imagesIndex = segments.findIndex(segment => segment.toLowerCase() === 'images');
+ if (imagesIndex >= 0) segments.splice(imagesIndex, 0, 'v1');
+ else segments.push('v1');
+ url.pathname = `/${segments.join('/')}`;
+ return url.toString();
+}
+
function createImageEditBody(input: {
model: string;
prompt: string;
diff --git a/apps/daemon/src/storage/repositories.ts b/apps/daemon/src/storage/repositories.ts
index f3056cd6..1f5a4fb6 100644
--- a/apps/daemon/src/storage/repositories.ts
+++ b/apps/daemon/src/storage/repositories.ts
@@ -240,7 +240,7 @@ export type ThreadRepository = {
updateThreadSandbox(input: UpdateThreadSandboxInput): void;
updateScheduleThread(input: UpdateScheduleThreadRowInput): void;
setThreadPurpose(input: { id: string; purpose: ThreadPurpose }): void;
- setCodexThreadId(threadId: string, codexThreadId: string): void;
+ setCodexThreadId(threadId: string, codexThreadId: string | null): void;
listCodexBindingRepairCandidates(): Array<{
threadId: string;
codexThreadId: string;
@@ -853,7 +853,7 @@ export function createThreadRepository(db: Database.Database): ThreadRepository
setThreadPurpose(input: { id: string; purpose: ThreadPurpose }): void {
setPurpose.run(input);
},
- setCodexThreadId(threadId: string, codexThreadId: string): void {
+ setCodexThreadId(threadId: string, codexThreadId: string | null): void {
setCodexThreadId.run({ threadId, codexThreadId });
},
listCodexBindingRepairCandidates(): Array<{
diff --git a/apps/daemon/src/threads/manager.ts b/apps/daemon/src/threads/manager.ts
index 2a785758..f3b8fce2 100644
--- a/apps/daemon/src/threads/manager.ts
+++ b/apps/daemon/src/threads/manager.ts
@@ -268,8 +268,10 @@ export function createThreadManager(input: CreateThreadManagerInput): ThreadMana
};
},
- setCodexThreadId(threadId: string, codexThreadId: string): void {
- const owner = threads.getThreadByCodexThreadId(codexThreadId);
+ setCodexThreadId(threadId: string, codexThreadId: string | null): void {
+ const owner = codexThreadId === null
+ ? undefined
+ : threads.getThreadByCodexThreadId(codexThreadId);
if (owner !== undefined && owner.id !== threadId) {
throw new ThreadManagerError(
'THREAD_CODEX_ID_CONFLICT',
diff --git a/apps/daemon/src/threads/types.ts b/apps/daemon/src/threads/types.ts
index 1731d2d4..8e0c2f26 100644
--- a/apps/daemon/src/threads/types.ts
+++ b/apps/daemon/src/threads/types.ts
@@ -124,6 +124,6 @@ export type ThreadManager = {
repairedThreadIds: string[];
unresolvedThreadIds: string[];
};
- setCodexThreadId(threadId: string, codexThreadId: string): void;
+ setCodexThreadId(threadId: string, codexThreadId: string | null): void;
touchThread(threadId: string): void;
};
diff --git a/apps/daemon/test/integration/image-generation-api.test.ts b/apps/daemon/test/integration/image-generation-api.test.ts
index 4cdcba95..86121f91 100644
--- a/apps/daemon/test/integration/image-generation-api.test.ts
+++ b/apps/daemon/test/integration/image-generation-api.test.ts
@@ -77,6 +77,31 @@ describe('image generation API', () => {
.toEqual(['0.png', 'result.json']);
});
+ it('adds v1 to an OpenAI-compatible image provider path without a version', async () => {
+ const config = createDefaultCreatorServicesConfig();
+ config.image.openai.apiKey = 'sk-image-test';
+ config.image.openai.baseUrl = 'https://images.example.test/draw';
+ config.image.openai.model = 'gpt-image-2';
+ const image = Buffer.concat([
+ Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]),
+ Buffer.from('versioned-image')
+ ]);
+ const fetchImpl = vi.fn(async (_url: RequestInfo | URL, _init?: RequestInit) => new Response(JSON.stringify({
+ data: [{ b64_json: image.toString('base64') }]
+ }), { status: 200, headers: { 'Content-Type': 'application/json' } }));
+
+ await generateImageContents({
+ prompt: 'A portrait',
+ provider: 'openai',
+ size: '1024x1024',
+ quality: 'high',
+ count: 1
+ }, config, { fetchImpl: fetchImpl as typeof fetch });
+
+ expect(String(fetchImpl.mock.calls[0]?.[0]))
+ .toBe('https://images.example.test/draw/v1/images/generations');
+ });
+
it('uses the configured Jimeng Ark image model', async () => {
const config = createDefaultCreatorServicesConfig();
config.image.jimeng.apiKey = 'ark-test';
diff --git a/apps/daemon/test/unit/codex-provider-config.test.ts b/apps/daemon/test/unit/codex-provider-config.test.ts
index 0bc46120..9ac5a976 100644
--- a/apps/daemon/test/unit/codex-provider-config.test.ts
+++ b/apps/daemon/test/unit/codex-provider-config.test.ts
@@ -8,7 +8,14 @@ import {
describe('Codex provider configuration', () => {
it('writes provider settings, stores the API key through account login and restarts consumers', async () => {
const calls: Array<{ method: string; params: unknown }> = [];
- let config = { model: 'gpt-old', openai_base_url: '' };
+ let config: Record<string, unknown> = {
+ model: 'gpt-old',
+ model_provider: 'legacy-gateway',
+ openai_base_url: '',
+ model_providers: {
+ 'legacy-gateway': { base_url: 'https://legacy-gateway.example.test/v1' }
+ }
+ };
let version = 'v1';
let account: null | { type: 'apiKey' } = null;
const restart = vi.fn(async () => undefined);
@@ -33,6 +40,7 @@ describe('Codex provider configuration', () => {
const body = params as { edits: Array<{ keyPath: string; value: unknown }> };
config = {
model: String(body.edits.find(edit => edit.keyPath === 'model')?.value),
+ model_provider: body.edits.find(edit => edit.keyPath === 'model_provider')?.value,
openai_base_url: String(
body.edits.find(edit => edit.keyPath === 'openai_base_url')?.value ?? ''
)
@@ -83,6 +91,7 @@ describe('Codex provider configuration', () => {
expect(calls.find(call => call.method === 'config/batchWrite')?.params).toEqual({
edits: [
{ keyPath: 'model', value: 'gpt-custom', mergeStrategy: 'replace' },
+ { keyPath: 'model_provider', value: null, mergeStrategy: 'replace' },
{
keyPath: 'openai_base_url',
value: 'https://gateway.example.test/v1',
@@ -105,6 +114,90 @@ describe('Codex provider configuration', () => {
expect(JSON.stringify(result)).not.toContain('sk-secret');
});
+ it('reports the active custom provider URL instead of an ignored OpenAI override', async () => {
+ const client: RestartableCodexAppServerRequestClient = {
+ async request<Result>(method: string): Promise<Result> {
+ if (method === 'config/read') {
+ return {
+ config: {
+ model: 'gateway-model',
+ model_provider: 'gateway',
+ openai_base_url: 'https://ignored.example.test/v1',
+ model_providers: {
+ gateway: { base_url: 'https://active.example.test/v1' }
+ }
+ },
+ layers: [{ name: { type: 'user', profile: null }, version: 'v1' }]
+ } as Result;
+ }
+ if (method === 'account/read') {
+ return { account: { type: 'apiKey' }, requiresOpenaiAuth: false } as Result;
+ }
+ throw new Error(`Unexpected method: ${method}`);
+ },
+ restart: vi.fn(async () => undefined),
+ close: async () => undefined
+ };
+ const service = createCodexProviderConfigService({
+ client,
+ readiness: { refresh: vi.fn() } as never,
+ readStoredApiKey: async () => 'sk-active'
+ });
+
+ await expect(service.read()).resolves.toMatchObject({
+ baseUrl: 'https://active.example.test/v1',
+ model: 'gateway-model'
+ });
+ });
+
+ it('keeps the active custom provider when only its model changes', async () => {
+ const calls: Array<{ method: string; params: unknown }> = [];
+ const client: RestartableCodexAppServerRequestClient = {
+ async request<Result>(method: string, params: unknown): Promise<Result> {
+ calls.push({ method, params });
+ if (method === 'config/read') {
+ return {
+ config: {
+ model: 'gateway-old',
+ model_provider: 'gateway',
+ model_providers: {
+ gateway: { base_url: 'https://active.example.test/v1' }
+ }
+ },
+ layers: [{ name: { type: 'user', profile: null }, version: 'v1' }]
+ } as Result;
+ }
+ if (method === 'account/read') {
+ return { account: { type: 'apiKey' }, requiresOpenaiAuth: false } as Result;
+ }
+ if (method === 'config/batchWrite') {
+ return { status: 'ok', version: 'v2' } as Result;
+ }
+ if (method === 'account/login/start') {
+ return { type: 'apiKey' } as Result;
+ }
+ throw new Error(`Unexpected method: ${method}`);
+ },
+ restart: vi.fn(async () => undefined),
+ close: async () => undefined
+ };
+ const service = createCodexProviderConfigService({
+ client,
+ readiness: { refresh: vi.fn() } as never,
+ readStoredApiKey: async () => 'sk-active'
+ });
+
+ await service.update({
+ baseUrl: 'https://active.example.test/v1',
+ model: 'gateway-new'
+ });
+
+ const write = calls.find(call => call.method === 'config/batchWrite')?.params as {
+ edits: Array<{ keyPath: string }>;
+ };
+ expect(write.edits).not.toContainEqual(expect.objectContaining({ keyPath: 'model_provider' }));
+ });
+
it('rejects an unauthenticated configuration without an API key', async () => {
const client: RestartableCodexAppServerRequestClient = {
async request<Result>(method: string): Promise<Result> {
@@ -131,6 +224,41 @@ describe('Codex provider configuration', () => {
.rejects.toBeInstanceOf(CodexProviderConfigValidationError);
});
+ it('does not reuse the authenticated key when selecting another custom provider', async () => {
+ const client: RestartableCodexAppServerRequestClient = {
+ async request<Result>(method: string): Promise<Result> {
+ if (method === 'config/read') {
+ return {
+ config: {
+ model: 'gpt-custom',
+ openai_base_url: 'https://gateway.example.test/v1'
+ },
+ layers: [{ name: { type: 'user', profile: null }, version: 'v1' }]
+ } as Result;
+ }
+ if (method === 'account/read') {
+ return { account: { type: 'apiKey' }, requiresOpenaiAuth: false } as Result;
+ }
+ throw new Error(`Unexpected method: ${method}`);
+ },
+ restart: vi.fn(async () => undefined),
+ close: async () => undefined
+ };
+ const service = createCodexProviderConfigService({
+ client,
+ readiness: { refresh: vi.fn() } as never,
+ readStoredApiKey: async provider => (
+ provider.baseUrl === 'https://gateway.example.test/v1' ? 'sk-gateway' : undefined
+ )
+ });
+
+ await expect(service.update({
+ baseUrl: 'https://api.deepseek.com',
+ model: 'deepseek-chat'
+ })).rejects.toThrow('自定义 Base URL 需要 API Key 登录');
+ expect(client.restart).not.toHaveBeenCalled();
+ });
+
it('reports and reuses the stored Codex API key', async () => {
const calls: Array<{ method: string; params: unknown }> = [];
const onProviderUpdated = vi.fn(async () => undefined);
diff --git a/apps/daemon/test/unit/codex-provider-credential-store.test.ts b/apps/daemon/test/unit/codex-provider-credential-store.test.ts
index 00fbd642..1d6f1cc8 100644
--- a/apps/daemon/test/unit/codex-provider-credential-store.test.ts
+++ b/apps/daemon/test/unit/codex-provider-credential-store.test.ts
@@ -49,7 +49,10 @@ describe('CodexProviderCredentialStore', () => {
model: 'gpt-codex'
})
})).resolves.toBe('sk-legacy');
- expect(store.writeApiKey).toHaveBeenCalledWith('sk-legacy');
+ expect(store.writeApiKey).toHaveBeenCalledWith('sk-legacy', {
+ baseUrl: 'https://gateway.example.test/v1',
+ model: 'gpt-codex'
+ });
});
it('persists the Codex API key in a local JSON configuration file', async () => {
@@ -57,12 +60,23 @@ describe('CodexProviderCredentialStore', () => {
const path = join(root, 'config', 'codex-provider.json');
const store = createFileCodexProviderCredentialStore(path);
- await store.writeApiKey('sk-file');
+ await store.writeApiKey('sk-file', {
+ baseUrl: 'https://api.deepseek.com/',
+ model: 'deepseek-chat'
+ });
- await expect(store.readApiKey()).resolves.toBe('sk-file');
+ await expect(store.readApiKey({
+ baseUrl: 'https://api.deepseek.com',
+ model: 'deepseek-reasoner'
+ })).resolves.toBe('sk-file');
+ await expect(store.readApiKey({
+ baseUrl: 'https://gateway.example.test/v1',
+ model: 'gpt-custom'
+ })).resolves.toBeUndefined();
expect(JSON.parse(readFileSync(path, 'utf8'))).toEqual({
version: 1,
- apiKey: 'sk-file'
+ apiKey: 'sk-file',
+ baseUrl: 'https://api.deepseek.com'
});
});
@@ -71,10 +85,35 @@ describe('CodexProviderCredentialStore', () => {
const credentialsFile = join(root, 'credentials.json');
const store = createOpenCreatorCodexProviderCredentialStore(credentialsFile);
- await store.writeApiKey('sk-opencreator');
- await expect(store.readApiKey()).resolves.toBe('sk-opencreator');
+ await store.writeApiKey('sk-opencreator', {
+ baseUrl: 'https://api.deepseek.com',
+ model: 'deepseek-chat'
+ });
+ await expect(store.readApiKey({
+ baseUrl: 'https://api.deepseek.com/',
+ model: 'deepseek-reasoner'
+ })).resolves.toBe('sk-opencreator');
+ await expect(store.readApiKey({
+ baseUrl: 'https://api.openai.com/v1',
+ model: 'gpt-5'
+ })).resolves.toBeUndefined();
expect(JSON.parse(readFileSync(credentialsFile, 'utf8'))).toMatchObject({
- codexProvider: { apiKey: 'sk-opencreator' }
+ codexProvider: {
+ apiKey: 'sk-opencreator',
+ baseUrl: 'https://api.deepseek.com'
+ }
});
});
+
+ it('does not apply an unbound legacy key to a custom provider', async () => {
+ root = mkdtempSync(join(tmpdir(), 'opencreator-codex-provider-'));
+ const credentialsFile = join(root, 'credentials.json');
+ const store = createOpenCreatorCodexProviderCredentialStore(credentialsFile);
+ await store.writeApiKey('sk-legacy-unbound');
+
+ await expect(store.readApiKey({
+ baseUrl: 'https://api.deepseek.com',
+ model: 'deepseek-chat'
+ })).resolves.toBeUndefined();
+ });
});
diff --git a/apps/daemon/test/unit/creator-runtime-advanced.test.ts b/apps/daemon/test/unit/creator-runtime-advanced.test.ts
index 46dd06f2..367bc607 100644
--- a/apps/daemon/test/unit/creator-runtime-advanced.test.ts
+++ b/apps/daemon/test/unit/creator-runtime-advanced.test.ts
@@ -1231,15 +1231,19 @@ describe('creator runtime advanced contracts', () => {
mkdirSync(sourceHome, { recursive: true });
mkdirSync(bundled, { recursive: true });
writeFileSync(join(sourceHome, 'auth.json'), '{"token":"sentinel"}');
+ writeFileSync(join(sourceHome, 'config.toml'), 'model = "gpt-before"\nmodel_provider = "legacy"\n[model_providers.legacy]\nbase_url = "https://legacy.test/v1"\n');
writeFileSync(join(bundled, 'SKILL.md'), '# OpenCreator Runtime\n');
writeFileSync(join(bundled, 'manifest.json'), '{"version":2}\n');
const first = bootstrapCreatorAgentRuntime({ sourceCodexHome: sourceHome, runtimeRoot, bundledSkillDir: bundled });
expect(first).toMatchObject({ available: true, guideVersion: 2 });
writeFileSync(join(first.skillPath, 'SKILL.md'), 'damaged');
writeFileSync(join(first.skillPath, '.opencreator-hash'), 'damaged');
+ writeFileSync(join(sourceHome, 'config.toml'), 'model = "gpt-after"\nopenai_base_url = "https://current.test/v1"\n');
const repaired = bootstrapCreatorAgentRuntime({ sourceCodexHome: sourceHome, runtimeRoot, bundledSkillDir: bundled });
expect(readFileSync(join(repaired.skillPath, 'SKILL.md'), 'utf8')).toBe('# OpenCreator Runtime\n');
expect(readFileSync(join(sourceHome, 'auth.json'), 'utf8')).toBe('{"token":"sentinel"}');
+ expect(readFileSync(join(repaired.codexHome, 'config.toml'), 'utf8')).toContain('model = "gpt-after"');
+ expect(readFileSync(join(repaired.codexHome, 'config.toml'), 'utf8')).not.toContain('model_provider');
});
it('normalizes probe formats and rejects invalid clip ranges before ffmpeg', () => {
diff --git a/apps/daemon/test/unit/storage.test.ts b/apps/daemon/test/unit/storage.test.ts
index 3e83584c..87442086 100644
--- a/apps/daemon/test/unit/storage.test.ts
+++ b/apps/daemon/test/unit/storage.test.ts
@@ -775,6 +775,8 @@ it('persists threads and codex thread binding', () => {
threads.setCodexThreadId('thread_1', '019f-thread');
expect(threads.getThread('thread_1')?.codex_thread_id).toBe('019f-thread');
+ threads.setCodexThreadId('thread_1', null);
+ expect(threads.getThread('thread_1')?.codex_thread_id).toBeNull();
});
it('permanently deletes thread-owned records without deleting project files', () => {
diff --git a/apps/web/e2e/web-desktop-parity.spec.ts b/apps/web/e2e/web-desktop-parity.spec.ts
index 3011b92c..f10ed92f 100644
--- a/apps/web/e2e/web-desktop-parity.spec.ts
+++ b/apps/web/e2e/web-desktop-parity.spec.ts
@@ -1,68 +1,22 @@
import type { CreatorServicesCapabilitiesResponse, CreatorYtDlpStatusResponse } from '@opencreator/protocol';
import { test, expect } from './fixtures/runtime.js';
-import { dirname, join } from 'node:path';
-import { writeFileSync } from 'node:fs';
-import { openRuntimeDatabase } from '../../daemon/src/storage/database.js';
-import { createCreatorRepository } from '../../daemon/src/creator/repository.js';
-import { appendCreatorResultSnapshot } from '../../daemon/src/creator/result-snapshots.js';
-test('Artifact 历史选择和来源在 Browser/Desktop Bridge 下保持一致并可刷新', async ({ browser, runtime }, testInfo) => {
+test('Agent 面板在 Browser/Desktop Bridge 下均不显示产物版本详情', async ({ browser, runtime }, testInfo) => {
test.skip(testInfo.project.name !== 'chromium-desktop', '内部使用相同内容视口');
const created = await runtime.api<{ job: { id: string } }>('POST', '/creator/jobs', {
- projectId: runtime.projectId, templateId: 'image-generation', state: { prompt: '版本来源验收', currentStep: 2, furthestStep: 2 }
+ projectId: runtime.projectId, templateId: 'image-generation', state: { prompt: 'Agent 面板验收', currentStep: 1, furthestStep: 1 }
});
- const db = openRuntimeDatabase(join(dirname(runtime.projectDir), 'runtime', 'app.sqlite'));
- const repository = createCreatorRepository(db);
- for (const version of [1, 2]) {
- const path = join(runtime.projectDir, `history-${version}.png`);
- writeFileSync(path, Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIHWP4z8DwHwAFgAI/ScLbtAAAAABJRU5ErkJggg==', 'base64'));
- const artifact = repository.insertArtifact({ jobId: created.job.id, kind: 'generated_image', path, status: version === 1 ? 'stale' : 'completed', sourceArtifactIds: [], metadata: { fileName: `history-${version}.png`, resultVersion: version } });
- const job = repository.getJob(created.job.id)!;
- repository.updateJob({ id: job.id, status: 'completed', revision: job.revision + 1, state: { ...job.state,
- ...appendCreatorResultSnapshot({ job, version, changedArtifacts: [artifact], action: 'stage-succeeded', stageId: 'generate', description: `生成 ${version}` })
- } });
- }
- const old = repository.getJob(created.job.id)!.artifacts.find(artifact => artifact.metadata.resultVersion === 1)!;
- db.close();
- const results = [];
for (const platform of ['browser', 'desktop'] as const) {
- const current = await runtime.api<{ job: { revision: number } }>('GET', `/creator/jobs/${created.job.id}`);
- await runtime.api('POST', `/creator/jobs/${created.job.id}/actions`, { action: 'select-result-version', expectedRevision: current.job.revision, input: { version: 2 } });
const context = await browser.newContext({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 1, reducedMotion: 'reduce' });
const page = await context.newPage();
if (platform === 'desktop') await installDesktopBridge(page);
try {
await runtime.openApp(page);
await page.goto(`${runtime.origin}/#/workbench?tool=image-generation&jobId=${created.job.id}`);
- await page.getByText('产物版本与来源', { exact: true }).click();
- const details = page.getByRole('region', { name: '产物详情' });
- await details.getByLabel('浏览产物(不改变项目选择)').selectOption(old.id);
- await expect(details).toContainText('已过期,非当前有效结果');
- const requests: unknown[] = [];
- page.on('request', request => {
- if (request.method() === 'POST' && request.url().endsWith('/actions')) {
- const body = request.postDataJSON();
- if (body.action === 'select-result-version') requests.push({ action: body.action, input: body.input });
- }
- });
- await details.getByRole('button', { name: '采用项目版本' }).click();
- await expect(page.getByRole('button', { name: '项目 V1', exact: true })).toBeVisible();
- await page.reload();
- await expect(page.getByRole('button', { name: '项目 V1', exact: true })).toBeVisible();
- await page.getByText('产物版本与来源', { exact: true }).click();
- await expect(details).toContainText('已过期,非当前有效结果');
- const downloadWork = page.waitForEvent('download');
- await details.getByRole('button', { name: '下载 V1' }).click();
- expect((await downloadWork).suggestedFilename()).toBe('history-1.png');
- await details.getByRole('button', { name: '预览 V1' }).click();
- await expect(details.getByRole('img')).toBeVisible();
- await details.evaluate(element => { element.scrollTop = 0; });
- results.push({ text: normalizeParityText(await details.innerText()), box: await details.boundingBox(), requests });
- await page.screenshot({ path: testInfo.outputPath(`artifact-${platform}.png`) });
+ await expect(page.getByText('当前任务', { exact: true })).toBeVisible();
+ await expect(page.getByText('产物版本与来源', { exact: true })).toHaveCount(0);
} finally { await context.close(); }
}
- expect(results[0]).toEqual(results[1]);
- expect(results[0]!.requests).toEqual([{ action: 'select-result-version', input: { version: 1 } }]);
});
test('本地字幕导入在 Browser/Desktop Bridge 下保持相同命令和界面', async ({ browser, runtime }, testInfo) => {
@@ -80,6 +34,7 @@ test('本地字幕导入在 Browser/Desktop Bridge 下保持相同命令和界
await runtime.openApp(page);
await page.goto(`${runtime.origin}/#/workbench?tool=video-translation&jobId=${created.job.id}`);
const group = page.getByRole('group', { name: '导入已有字幕' });
+ await group.getByRole('switch', { name: '导入已有字幕' }).click();
await group.getByRole('combobox', { name: '字幕类型' }).selectOption('target_subtitle');
const request = page.waitForRequest(request => request.url().endsWith('/actions') && request.postDataJSON()?.action === 'import-subtitle');
await group.getByLabel('UTF-8 SRT 文件').setInputFiles({ name: 'local.srt', mimeType: 'application/x-subrip', buffer: Buffer.from('1\n00:00:00,000 --> 00:00:01,000\nHello\n') });
diff --git a/apps/web/src/features/dashboard/CreatorCollaborationPanel.test.tsx b/apps/web/src/features/dashboard/CreatorCollaborationPanel.test.tsx
index 08b422f8..dd557f2e 100644
--- a/apps/web/src/features/dashboard/CreatorCollaborationPanel.test.tsx
+++ b/apps/web/src/features/dashboard/CreatorCollaborationPanel.test.tsx
@@ -44,6 +44,7 @@ describe('Short video script panel', () => {
expect(screen.getByText('20%')).toBeInTheDocument();
expect(screen.getByRole('progressbar', { name: '生成短视频脚本进度' }))
.toHaveAttribute('aria-valuenow', '20');
+ expect(screen.queryByText('产物版本与来源')).not.toBeInTheDocument();
});
});
diff --git a/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx b/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx
index 6eb20d16..2803c4ad 100644
--- a/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx
+++ b/apps/web/src/features/dashboard/CreatorCollaborationPanel.tsx
@@ -29,7 +29,6 @@ import {
type CreatorStageProgressView
} from './creator-panel-adapters.js';
import { useOptionalCreatorSession } from './creator-session-store.js';
-import CreatorArtifactDetails from './CreatorArtifactDetails.js';
export type CreatorPanelQuickAction = {
id: string;
@@ -229,7 +228,6 @@ export default function CreatorCollaborationPanel(props: {
<small>{l('当前任务', 'Current task')}</small>
<strong>{props.currentIssue ?? props.contextSummary}</strong>
</span>
- <CreatorArtifactDetails />
</div>
{session === null ? (
diff --git a/apps/web/src/features/dashboard/VideoTranslationSubtitleImport.tsx b/apps/web/src/features/dashboard/VideoTranslationSubtitleImport.tsx
index 5a9e07b6..79840133 100644
--- a/apps/web/src/features/dashboard/VideoTranslationSubtitleImport.tsx
+++ b/apps/web/src/features/dashboard/VideoTranslationSubtitleImport.tsx
@@ -5,6 +5,7 @@ import { useOptionalCreatorSession } from './creator-session-store.js';
export function VideoTranslationSubtitleImport(props: { sourceLanguage: string; targetLanguage: string; disabled: boolean }) {
const l = useLocalizedCopy();
const session = useOptionalCreatorSession();
+ const [enabled, setEnabled] = useState(() => session?.job.artifacts.some(artifact => artifact.metadata.source === 'local-upload' && artifact.kind.endsWith('_subtitle')) ?? false);
const [kind, setKind] = useState('source_subtitle');
const [busy, setBusy] = useState(false);
const [error, setError] = useState('');
@@ -34,27 +35,45 @@ export function VideoTranslationSubtitleImport(props: { sourceLanguage: string;
}
}
- return <fieldset className="video-translation-field" disabled={props.disabled || busy}>
- <legend>{l('导入已有字幕', 'Import existing subtitles')}</legend>
- <label>{l('字幕类型', 'Subtitle type')}
- <select value={kind} onChange={event => setKind(event.target.value)}>
- <option value="source_subtitle">{l('原文字幕(跳过语音识别)', 'Source subtitles (skip transcription)')}</option>
- <option value="target_subtitle">{l('已翻译字幕(跳过识别和翻译)', 'Translated subtitles (skip transcription and translation)')}</option>
- </select>
- </label>
- <label>{l('UTF-8 SRT 文件', 'UTF-8 SRT file')}
- <input type="file" accept=".srt" onChange={event => {
- const file = event.target.files?.[0];
- event.target.value = '';
- if (file) void importFile(file);
- }} />
- </label>
- <p>{l('语言沿用上方选择。仅有译文时不会生成双语字幕。', 'Uses the language selected above. A translated-only import does not generate bilingual subtitles.')}</p>
- {busy ? <p role="status">{l('正在导入字幕…', 'Importing subtitles…')}</p> : null}
- {error ? <p role="alert">{error}</p> : null}
- {imports.map(artifact => <details key={artifact.id}>
- <summary>{l('本地导入', 'Local import')} · {String(artifact.metadata.fileName)} · {String(artifact.metadata.language)} · {String(artifact.metadata.cueCount)} {l('条字幕', 'cues')} · v{artifact.version}</summary>
- <pre>{Array.isArray(artifact.metadata.cues) ? artifact.metadata.cues.map(cue => cue !== null && typeof cue === 'object' && !Array.isArray(cue) ? `${cue.start} → ${cue.end}\n${cue.text}` : '').join('\n\n') : ''}</pre>
- </details>)}
- </fieldset>;
+ return <div className="video-translation-subtitle-import" role="group" aria-label={l('导入已有字幕', 'Import existing subtitles')}>
+ <div className={`video-translation-toggle-row${props.disabled ? ' is-disabled' : ''}`}>
+ <span>
+ <strong>{l('导入已有字幕', 'Import existing subtitles')}</strong>
+ <small>{l('使用本地 SRT 字幕文件', 'Use a local SRT subtitle file')}</small>
+ </span>
+ <button
+ className="video-translation-switch"
+ type="button"
+ role="switch"
+ aria-checked={enabled}
+ aria-label={l('导入已有字幕', 'Import existing subtitles')}
+ disabled={props.disabled}
+ onClick={() => setEnabled(value => !value)}
+ >
+ <span />
+ </button>
+ </div>
+ {enabled ? <fieldset className="video-translation-subtitle-import-fields video-translation-field" disabled={props.disabled || busy}>
+ <label><span>{l('字幕类型', 'Subtitle type')}</span>
+ <select value={kind} onChange={event => setKind(event.target.value)}>
+ <option value="source_subtitle">{l('原文字幕(跳过语音识别)', 'Source subtitles (skip transcription)')}</option>
+ <option value="target_subtitle">{l('已翻译字幕(跳过识别和翻译)', 'Translated subtitles (skip transcription and translation)')}</option>
+ </select>
+ </label>
+ <label><span>{l('UTF-8 SRT 文件', 'UTF-8 SRT file')}</span>
+ <input type="file" accept=".srt" onChange={event => {
+ const file = event.target.files?.[0];
+ event.target.value = '';
+ if (file) void importFile(file);
+ }} />
+ </label>
+ <p>{l('语言沿用上方选择。仅有译文时不会生成双语字幕。', 'Uses the language selected above. A translated-only import does not generate bilingual subtitles.')}</p>
+ {busy ? <p role="status">{l('正在导入字幕…', 'Importing subtitles…')}</p> : null}
+ {error ? <p role="alert">{error}</p> : null}
+ {imports.map(artifact => <details key={artifact.id}>
+ <summary>{l('本地导入', 'Local import')} · {String(artifact.metadata.fileName)} · {String(artifact.metadata.language)} · {String(artifact.metadata.cueCount)} {l('条字幕', 'cues')} · v{artifact.version}</summary>
+ <pre>{Array.isArray(artifact.metadata.cues) ? artifact.metadata.cues.map(cue => cue !== null && typeof cue === 'object' && !Array.isArray(cue) ? `${cue.start} → ${cue.end}\n${cue.text}` : '').join('\n\n') : ''}</pre>
+ </details>)}
+ </fieldset> : null}
+ </div>;
}
diff --git a/apps/web/src/features/dashboard/VideoTranslationWorkspace.control.test.tsx b/apps/web/src/features/dashboard/VideoTranslationWorkspace.control.test.tsx
index 644b92ae..9b135b45 100644
--- a/apps/web/src/features/dashboard/VideoTranslationWorkspace.control.test.tsx
+++ b/apps/web/src/features/dashboard/VideoTranslationWorkspace.control.test.tsx
@@ -27,6 +27,7 @@ describe('VideoTranslationWorkspace task controls', () => {
render(<LanguageProvider initialPreference="zh-CN"><CreatorSessionProvider initialJob={current} service={{ applyAction, runAgentTurn: vi.fn() } as never}>
<VideoTranslationWorkspace onBack={vi.fn()} />
</CreatorSessionProvider></LanguageProvider>);
+ fireEvent.click(screen.getByRole('switch', { name: '导入已有字幕' }));
fireEvent.change(screen.getByRole('combobox', { name: '字幕类型' }), { target: { value: 'target_subtitle' } });
fireEvent.change(screen.getByLabelText('UTF-8 SRT 文件'), { target: { files: [new File(['srt'], 'translated.srt')] } });
expect(await screen.findByText('本地导入 · translated.srt · zh_cn · 1 条字幕 · v1')).toBeInTheDocument();
@@ -45,6 +46,8 @@ describe('VideoTranslationWorkspace task controls', () => {
render(<LanguageProvider initialPreference="zh-CN"><CreatorSessionProvider initialJob={initial} service={{ applyAction, runAgentTurn: vi.fn() } as never}>
<VideoTranslationWorkspace onBack={vi.fn()} />
</CreatorSessionProvider></LanguageProvider>);
+ expect(screen.queryByRole('combobox', { name: '字幕类型' })).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole('switch', { name: '导入已有字幕' }));
fireEvent.change(screen.getByRole('combobox', { name: '字幕类型' }), { target: { value: kind } });
fireEvent.change(screen.getByLabelText('UTF-8 SRT 文件'), { target: { files: [new File(['invalid'], 'local.srt', { type: 'application/x-subrip' })] } });
await waitFor(() => expect(applyAction).toHaveBeenCalledWith('job_control', expect.objectContaining({ action: 'import-subtitle', input: {
diff --git a/apps/web/src/features/dashboard/creator-session-store.test.tsx b/apps/web/src/features/dashboard/creator-session-store.test.tsx
index 4100f870..f179673d 100644
--- a/apps/web/src/features/dashboard/creator-session-store.test.tsx
+++ b/apps/web/src/features/dashboard/creator-session-store.test.tsx
@@ -712,7 +712,8 @@ describe('CreatorSessionStore', () => {
);
await waitFor(() => expect(subscribeJobEvents).toHaveBeenCalledTimes(1));
- await waitFor(() => expect(getAgentTimeline).toHaveBeenCalledTimes(1));
+ await waitFor(() => expect(getAgentTimeline.mock.calls.length).toBeGreaterThanOrEqual(1));
+ const initialTimelineLoads = getAgentTimeline.mock.calls.length;
act(() => emit({
id: 'stage:1',
jobId: 'job_1',
@@ -744,7 +745,7 @@ describe('CreatorSessionStore', () => {
expect(screen.getByLabelText('stages')).toHaveTextContent('render-horizontal:running');
expect(getJob).toHaveBeenCalledTimes(1);
- expect(getAgentTimeline).toHaveBeenCalledTimes(1);
+ expect(getAgentTimeline).toHaveBeenCalledTimes(initialTimelineLoads);
act(() => emit({
id: 'agent:2',
@@ -754,7 +755,7 @@ describe('CreatorSessionStore', () => {
payload: {},
createdAt: '2026-08-21T00:00:03.000Z'
}));
- await waitFor(() => expect(getAgentTimeline).toHaveBeenCalledTimes(2));
+ await waitFor(() => expect(getAgentTimeline).toHaveBeenCalledTimes(initialTimelineLoads + 1));
expect(getJob).toHaveBeenCalledTimes(1);
act(() => emit({
@@ -768,6 +769,48 @@ describe('CreatorSessionStore', () => {
await waitFor(() => expect(getJob).toHaveBeenCalledTimes(2));
});
+ it('reconciles a completed Agent turn after the event stream reconnects', async () => {
+ let disconnect!: () => void;
+ let turnStatus: 'running' | 'completed' = 'running';
+ const getAgentTimeline = vi.fn(async () => timeline({
+ status: turnStatus,
+ content: turnStatus === 'running' ? '正在合成' : '横屏视频已合成完成'
+ }));
+ const subscribeJobEvents = vi.fn((
+ _jobId: string,
+ _onEvent: (event: CreatorEventEnvelope) => void,
+ onDisconnect: () => void
+ ) => {
+ disconnect = onDisconnect;
+ return { close: vi.fn() };
+ });
+ render(
+ <CreatorSessionProvider
+ initialJob={job(0, {})}
+ service={{
+ applyAction: vi.fn(),
+ runAgentTurn: vi.fn(),
+ getJob: vi.fn(async () => ({ job: job(0, {}) })),
+ getAgentTimeline,
+ subscribeJobEvents
+ } as never}
+ >
+ <Harness />
+ </CreatorSessionProvider>
+ );
+
+ await waitFor(() => expect(screen.getByLabelText('busy')).toHaveTextContent('true'));
+ turnStatus = 'completed';
+ act(() => disconnect());
+
+ await waitFor(
+ () => expect(screen.getByLabelText('busy')).toHaveTextContent('false'),
+ { timeout: 1_500 }
+ );
+ expect(screen.getByLabelText('turns')).toHaveTextContent('横屏视频已合成完成');
+ expect(subscribeJobEvents.mock.calls.length).toBeGreaterThanOrEqual(2);
+ });
+
it('does not add an optimistic local turn before the Runtime timeline confirms it', async () => {
let resolveStart!: (value: { turn: never }) => void;
const startAgentTurn = vi.fn(() => new Promise<{ turn: never }>(resolve => {
diff --git a/apps/web/src/features/dashboard/creator-session-store.tsx b/apps/web/src/features/dashboard/creator-session-store.tsx
index 0a6a2ff4..9f2481b2 100644
--- a/apps/web/src/features/dashboard/creator-session-store.tsx
+++ b/apps/web/src/features/dashboard/creator-session-store.tsx
@@ -311,7 +311,12 @@ export function CreatorSessionProvider(props: {
subscribe: (onEvent, onDisconnect) => (
props.service.subscribeJobEvents!(jobId, onEvent, onDisconnect)
),
- onSnapshot: applyRemoteSnapshot,
+ onSnapshot(snapshot) {
+ applyRemoteSnapshot(snapshot);
+ // A reconnect can miss the Agent event that completed the active turn.
+ // Reconcile the timeline whenever the authoritative job snapshot reloads.
+ void reloadAgentTimeline().catch(() => undefined);
+ },
onEvent(event) {
applyLiveEvent(event);
if (event.kind.startsWith('agent_')) {
diff --git a/apps/web/src/features/dashboard/dashboard.css b/apps/web/src/features/dashboard/dashboard.css
index 9f1a171c..f9600e46 100644
--- a/apps/web/src/features/dashboard/dashboard.css
+++ b/apps/web/src/features/dashboard/dashboard.css
@@ -814,6 +814,7 @@
}
.video-translation-toggle-row + .video-translation-toggle-row,
+.video-translation-subtitle-import + .video-translation-toggle-row,
.video-translation-inline-setting + .video-translation-toggle-row {
border-top: 1px solid var(--border-hairline);
}
@@ -839,6 +840,37 @@
opacity: 0.55;
}
+.video-translation-subtitle-import-fields {
+ gap: 12px;
+ margin: 0;
+ padding: 14px 14px 16px;
+ border: 1px solid var(--border-hairline);
+ border-radius: 7px;
+ background: color-mix(in srgb, var(--surface-2) 46%, transparent);
+}
+
+.video-translation-subtitle-import-fields label {
+ display: grid;
+ gap: 6px;
+}
+
+.video-translation-subtitle-import-fields label > span,
+.video-translation-subtitle-import-fields p {
+ margin: 0;
+ color: var(--muted);
+ font-size: 11px;
+ line-height: 1.4;
+}
+
+.video-translation-subtitle-import-fields select {
+ padding: 0 10px;
+}
+
+.video-translation-subtitle-import-fields details {
+ color: var(--muted);
+ font-size: 11px;
+}
+
.video-translation-switch {
width: 34px;
height: 20px;
diff --git a/apps/web/src/features/settings/CreatorServicesSettingsView.test.tsx b/apps/web/src/features/settings/CreatorServicesSettingsView.test.tsx
index cdf57c31..b677cb36 100644
--- a/apps/web/src/features/settings/CreatorServicesSettingsView.test.tsx
+++ b/apps/web/src/features/settings/CreatorServicesSettingsView.test.tsx
@@ -95,6 +95,19 @@ describe('CreatorServicesSettingsView', () => {
}));
});
+ it('does not report a custom provider ready from an unrelated API key login', async () => {
+ render(
+ <CreatorServicesSettingsView
+ connected
+ service={createService()}
+ modelService={createModelService({ apiKeyConfigured: false })}
+ />
+ );
+
+ expect(await screen.findByText('Agent 尚未配置')).toBeInTheDocument();
+ expect(screen.getByText('文本任务需要 API Key')).toBeInTheDocument();
+ });
+
it('defaults OpenAI to GPT-5.6 and keeps it in the Runtime model list', async () => {
const user = userEvent.setup();
render(
diff --git a/apps/web/src/features/settings/CreatorServicesSettingsView.tsx b/apps/web/src/features/settings/CreatorServicesSettingsView.tsx
index 2b14eb87..565e43a0 100644
--- a/apps/web/src/features/settings/CreatorServicesSettingsView.tsx
+++ b/apps/web/src/features/settings/CreatorServicesSettingsView.tsx
@@ -422,7 +422,9 @@ function TextModelSettings(props: SettingsGroupProps & {
&& props.configuredCredentials.has('llm.apiKey');
const providerApiKeyConfigured = props.provider?.apiKeyConfigured === true;
const apiKeyConfigured = providerApiKeyConfigured || legacyApiKeyConfigured;
- const agentAvailable = props.provider?.authentication !== 'none' || providerApiKeyConfigured;
+ const agentAvailable = props.provider?.baseUrl
+ ? providerApiKeyConfigured
+ : props.provider?.authentication !== 'none' || providerApiKeyConfigured;
const textTasksAvailable = apiKeyConfigured;
const AgentStatusIcon = agentAvailable ? Check : CircleAlert;
const TextTaskStatusIcon = textTasksAvailable ? Check : CircleAlert;