Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac3d8cf54a | ||
|
|
e90da727d4 | ||
|
|
4dc2057d43 | ||
|
|
baf069854b | ||
|
|
6b2c0f199d | ||
|
|
bb873ec0e0 | ||
|
|
8380057548 |
No files matched your search
+8
-1
@@ -6,6 +6,9 @@ OPENAI_BASE_URL=https://api-n-cd.playones.com/v1
|
|||||||
OPENAI_MODEL=gpt-6-luna
|
OPENAI_MODEL=gpt-6-luna
|
||||||
# 单次模型 HTTP 请求超时(秒)
|
# 单次模型 HTTP 请求超时(秒)
|
||||||
OPENAI_TIMEOUT_SECONDS=300
|
OPENAI_TIMEOUT_SECONDS=300
|
||||||
|
# 模型请求和模型凭据检查默认直连;设为 true 才读取 Windows/HTTP(S)_PROXY/ALL_PROXY/NO_PROXY。
|
||||||
|
# 仅环境配置,不显示在网页中;修改后重启服务生效。TLS 校验及自定义 CA 不受影响。
|
||||||
|
OPENAI_USE_SYSTEM_PROXY=false
|
||||||
# 可选的后台步骤截图摘要单次超时,独立于上面的主模型请求超时。
|
# 可选的后台步骤截图摘要单次超时,独立于上面的主模型请求超时。
|
||||||
ARTEMIS_STEP_SUMMARIZER_TIMEOUT_SECONDS=120
|
ARTEMIS_STEP_SUMMARIZER_TIMEOUT_SECONDS=120
|
||||||
# 失败后最多重试 5 次,由 Artemis 统一管理,SDK 不叠加重试。
|
# 失败后最多重试 5 次,由 Artemis 统一管理,SDK 不叠加重试。
|
||||||
@@ -19,6 +22,10 @@ ARTEMIS_TOOL_FALLBACK_MAX_NO_PROGRESS_ATTEMPTS=3
|
|||||||
# default 表示不发送思考强度参数;接口不支持所选值时明确报错。
|
# default 表示不发送思考强度参数;接口不支持所选值时明确报错。
|
||||||
OPENAI_REASONING_EFFORT=high
|
OPENAI_REASONING_EFFORT=high
|
||||||
|
|
||||||
|
# 探索独立默认值;网页已保存的探索配置优先,已创建会话保留快照。
|
||||||
|
ARTEMIS_EXPLORATION_MODEL=gpt-6.1-terra
|
||||||
|
ARTEMIS_EXPLORATION_REASONING_EFFORT=high
|
||||||
|
|
||||||
# 1 跳过本次网页启动的 Codex MCP 与官方 artemis-use Skill 同步;默认自动安装/更新。
|
# 1 跳过本次网页启动的 Codex MCP 与官方 artemis-use Skill 同步;默认自动安装/更新。
|
||||||
ARTEMIS_SKIP_CODEX_SYNC=0
|
ARTEMIS_SKIP_CODEX_SYNC=0
|
||||||
|
|
||||||
@@ -85,7 +92,7 @@ ARTEMIS_BATCH_MAX_EXECUTIONS=10000
|
|||||||
ARTEMIS_IMPORT_MAX_BYTES=10485760
|
ARTEMIS_IMPORT_MAX_BYTES=10485760
|
||||||
|
|
||||||
# 插件连接与安装预算(修改后重启服务)
|
# 插件连接与安装预算(修改后重启服务)
|
||||||
ARTEMIS_PLUGIN_MARKETPLACE_URL=https://git.playones.com/chenmingxuan/Artemis-Plugins/raw/branch/main/catalog.json
|
ARTEMIS_PLUGIN_MARKETPLACE_URL=https://git.playones.com/chenmingxuan/Artemis-Plugins/raw/branch/main/catalog-v3.json
|
||||||
ARTEMIS_PLUGIN_START_TIMEOUT_SECONDS=30
|
ARTEMIS_PLUGIN_START_TIMEOUT_SECONDS=30
|
||||||
ARTEMIS_PLUGIN_TOOL_TIMEOUT_SECONDS=60
|
ARTEMIS_PLUGIN_TOOL_TIMEOUT_SECONDS=60
|
||||||
ARTEMIS_PLUGIN_SHUTDOWN_TIMEOUT_SECONDS=15
|
ARTEMIS_PLUGIN_SHUTDOWN_TIMEOUT_SECONDS=15
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Windows 首次安装使用 `start.bat`,国内镜像使用 `start-cn.bat`。启
|
|||||||
- 历史压缩、视觉摘要与工具上下文调整须保留关键文件回执和来源,维护稳定的多轮前缀;缓存率使用实际用量加权统计,不把缓存输入当作消失的 token,也不承诺固定收益。
|
- 历史压缩、视觉摘要与工具上下文调整须保留关键文件回执和来源,维护稳定的多轮前缀;缓存率使用实际用量加权统计,不把缓存输入当作消失的 token,也不承诺固定收益。
|
||||||
- 设备动作回放已移除;只读历史步骤、截图和上下文回忆仍保留,不因 replay 命名误删这些能力。
|
- 设备动作回放已移除;只读历史步骤、截图和上下文回忆仍保留,不因 replay 命名误删这些能力。
|
||||||
- 密钥仅通过网页或环境配置写入,读取配置不得回显;MCP 不接受密钥。全局配置修改影响后续任务,已保存配置优先于新安装默认值。
|
- 密钥仅通过网页或环境配置写入,读取配置不得回显;MCP 不接受密钥。全局配置修改影响后续任务,已保存配置优先于新安装默认值。
|
||||||
- 新安装普通任务默认 `gpt-6-luna / high`,探索默认 `gpt-6.1-sol / high`;请求超时 300 秒、失败后重试 5 次、间隔 10 秒,视频分析与普通录屏关闭。接口不支持思考强度时明确报错,不静默降级。
|
- 新安装普通任务默认 `gpt-6-luna / high`,探索默认 `gpt-6.1-terra / high`;请求超时 300 秒、失败后重试 5 次、间隔 10 秒,视频分析与普通录屏关闭。接口不支持思考强度时明确报错,不静默降级。
|
||||||
- 业务环境恢复由任务提示词提出,不新增默认业务回滚流程;连接、录像、子进程和资源锁的运行时收尾仍然必需。
|
- 业务环境恢复由任务提示词提出,不新增默认业务回滚流程;连接、录像、子进程和资源锁的运行时收尾仍然必需。
|
||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ ARTEMIS 面向使用自然语言执行、探索和复跑测试的人。当前产
|
|||||||
|
|
||||||
请求重试、业务执行与最终验收分别处理。提交使用稳定标识;创建批次或探索草稿不自动执行,查询不产生设备动作。执行准入和恢复遵守现有资源锁,任务固定所用插件版本,不能通过另建队列绕开互斥。
|
请求重试、业务执行与最终验收分别处理。提交使用稳定标识;创建批次或探索草稿不自动执行,查询不产生设备动作。执行准入和恢复遵守现有资源锁,任务固定所用插件版本,不能通过另建队列绕开互斥。
|
||||||
|
|
||||||
|
设备保活是辅助服务。保活所属锁或旧保活清理目录不可访问时记录警告,不使设备连接、恢复或监控退出;未取得保活所属锁时不发送保活动作,也不创建替代锁绕过所属权。执行资源锁、主服务注册锁和队列写锁仍须成功取得。
|
||||||
|
|
||||||
|
运行时准备阶段失败记录 `initialization_failed`,批次保留详细原因并暂停未开始项,修复环境后由用户继续,已失败项不自动重跑。模型请求导致的批次暂停单独标记;模型暂停结束后恢复既定调度及失败即停止策略。用户暂停、停止全部任务和服务重启后的恢复暂停均需用户继续,不被模型恢复覆盖。Flash 与 Pro/探索 Operator 的生成失败复用统一备用模型与重试预算;不完整输出不会成为动作,已有动作不因模型切换而重放。
|
||||||
|
|
||||||
最终验收有独立总预算,按请求超时、重试和剩余任务时间协调,保留取证结果;完整有效的结构化结论才更新正式裁定。`completed`、工具成功、探索通过、用例提炼和复跑通过各自表达自己的状态。
|
最终验收有独立总预算,按请求超时、重试和剩余任务时间协调,保留取证结果;完整有效的结构化结论才更新正式裁定。`completed`、工具成功、探索通过、用例提炼和复跑通过各自表达自己的状态。
|
||||||
|
|
||||||
Responses 消息交给工具、下游解析器或正式裁定前,必须具有服务端 `completed` 状态;工具参数的原始字符串必须是完整 JSON 对象,不能使用库自动补全的半截参数。流结束或库补出的 `last` 标记不能替代完成状态。缺少终止事件、明确未完成或失败的流丢弃预览,进入现有无效输出恢复策略,最多重新请求一次,配置为零次重试时不重试;恢复保留已有工具证据,不重新提交业务任务。非流式、结构化输出和串接解析器遵守同一检查。
|
Responses 消息交给工具、下游解析器或正式裁定前,必须具有服务端 `completed` 状态;工具参数的原始字符串必须是完整 JSON 对象,不能使用库自动补全的半截参数。流结束或库补出的 `last` 标记不能替代完成状态。缺少终止事件、明确未完成或失败的流丢弃预览,进入现有无效输出恢复策略,最多重新请求一次,配置为零次重试时不重试;恢复保留已有工具证据,不重新提交业务任务。非流式、结构化输出和串接解析器遵守同一检查。
|
||||||
@@ -84,6 +88,10 @@ Responses 消息交给工具、下游解析器或正式裁定前,必须具有
|
|||||||
|
|
||||||
执行平台与证据来源分别记录。报告和证据索引从执行记录汇总来源及实际 step_id/call_id/source_id;界面、接口、文件和终端各自只能支持其观察范围,业务后台名称或网址不能推断平台。最终复核明确事实、矛盾和未验证边界;来源清单不生成新结论,不覆盖 AI 原判、有效结论或人工复验。
|
执行平台与证据来源分别记录。报告和证据索引从执行记录汇总来源及实际 step_id/call_id/source_id;界面、接口、文件和终端各自只能支持其观察范围,业务后台名称或网址不能推断平台。最终复核明确事实、矛盾和未验证边界;来源清单不生成新结论,不覆盖 AI 原判、有效结论或人工复验。
|
||||||
|
|
||||||
|
原生安卓动作在派发时记录所选设备来源。安卓截图来源也可从已保存的成功截图回执读取设备、采集时间、文件路径和校验值,并引用实际 trace_id;兼容 Flash 与 Pro 的回执封装,不从模型参数补造来源。空步骤、笔记和结束声明不计入缺失动作来源;窗口枚举等无单一目标的操作保留未关联状态,该计数不等于截图丢失。未生成独立输出正文时,报告展示当前有效判定及依据,保留人工复验优先级,不把正文缺失写成验收结论缺失。
|
||||||
|
|
||||||
|
规划器的笔记工具与执行器的设备、插件工具分别绑定。规划器依据任务的实际授权插件清单制定计划,由执行器加载并验证能力;规划阶段没有绑定动作工具,不表示任务缺少这些能力,也不构成重新申请授权的依据。
|
||||||
|
|
||||||
MCP 与单任务 HTTP 入参拒绝未知字段,校验失败不调度任务。MCP JSON 结果保留兼容文本并提供 structuredContent;任务摘要分页明确总数与 next_offset,引用实际存储编号。跨端阶段先完整初始化,再按既有阶段 id 更新状态与依据;补丁保留其他阶段、范围、资源和顺序,合并后统一校验并保存,失败不更新内存状态。
|
MCP 与单任务 HTTP 入参拒绝未知字段,校验失败不调度任务。MCP JSON 结果保留兼容文本并提供 structuredContent;任务摘要分页明确总数与 next_offset,引用实际存储编号。跨端阶段先完整初始化,再按既有阶段 id 更新状态与依据;补丁保留其他阶段、范围、资源和顺序,合并后统一校验并保存,失败不更新内存状态。
|
||||||
|
|
||||||
Flash 的最终 AI 判定与分析独立配置,默认关闭;首页功能配置和 MCP 共用保存的全局设置。任务开始时固定设置,尚未开始的任务使用最新值;批量、精选及提炼用例的 Flash 复跑同样遵循。关闭时跳过最终 Checker,保留正常执行、步骤、截图、报告和人工复验;结果为“执行完成 · 未做 AI 判定”,不标记“AI确认”或测试通过。Pro 与主动探索的验收规则保持不变。
|
Flash 的最终 AI 判定与分析独立配置,默认关闭;首页功能配置和 MCP 共用保存的全局设置。任务开始时固定设置,尚未开始的任务使用最新值;批量、精选及提炼用例的 Flash 复跑同样遵循。关闭时跳过最终 Checker,保留正常执行、步骤、截图、报告和人工复验;结果为“执行完成 · 未做 AI 判定”,不标记“AI确认”或测试通过。Pro 与主动探索的验收规则保持不变。
|
||||||
@@ -94,7 +102,7 @@ Flash 的最终 AI 判定与分析独立配置,默认关闭;首页功能配
|
|||||||
|
|
||||||
收藏保存独立模板与执行配置,用例复跑固定版本;删除原任务不破坏已保存模板。历史与导出的有效结论合并人工复验,不能用新裁定改写旧证据。
|
收藏保存独立模板与执行配置,用例复跑固定版本;删除原任务不破坏已保存模板。历史与导出的有效结论合并人工复验,不能用新裁定改写旧证据。
|
||||||
|
|
||||||
普通任务新安装默认 `gpt-6-luna / high`,探索单独使用 `gpt-6.1-sol / high`,保留已有配置。上下文参照上限 300k、默认历史压缩预算 80k,均不表示整条任务累计 token 限额。优化稳定前缀时保留关键文件回执、路径、校验和来源;费用收益依实际网关用量及计价判断。
|
普通任务新安装默认 `gpt-6-luna / high`,探索单独使用 `gpt-6.1-terra / high`,保留已有配置。上下文参照上限 300k、默认历史压缩预算 80k,均不表示整条任务累计 token 限额。优化稳定前缀时保留关键文件回执、路径、校验和来源;费用收益依实际网关用量及计价判断。
|
||||||
|
|
||||||
普通 Pro 的计划全部完成后,执行循环返回既有收尾和最终验收流程,不要求额外设备动作;有新指导或验收反馈时先处理反馈,探索模式仍须交付完整报告。完成计划不等于测试通过。Operator 写入计划时拒绝新增或增加同名顶层里程碑,撤销该次写入并返回工具错误;局部替换不得夹带目标范围外的里程碑,已有重复项可继续整理,确需重复的阶段使用不同名称。
|
普通 Pro 的计划全部完成后,执行循环返回既有收尾和最终验收流程,不要求额外设备动作;有新指导或验收反馈时先处理反馈,探索模式仍须交付完整报告。完成计划不等于测试通过。Operator 写入计划时拒绝新增或增加同名顶层里程碑,撤销该次写入并返回工具错误;局部替换不得夹带目标范围外的里程碑,已有重复项可继续整理,确需重复的阶段使用不同名称。
|
||||||
|
|
||||||
@@ -183,3 +191,15 @@ Flash 的最终 AI 判定与分析独立配置,默认关闭;首页功能配
|
|||||||
- 保留可见焦点、禁用反馈和减少动画偏好;录制红点表示实际录制,等待或执行中使用各自文案。
|
- 保留可见焦点、禁用反馈和减少动画偏好;录制红点表示实际录制,等待或执行中使用各自文案。
|
||||||
- 源码已更新而页面仍旧时,先核对服务目录、构建与缓存;不通过反复增加样式覆盖掩盖旧构建问题。
|
- 源码已更新而页面仍旧时,先核对服务目录、构建与缓存;不通过反复增加样式覆盖掩盖旧构建问题。
|
||||||
- 视觉变化验证代表性宽度、长标题、加载、等待回答、错误与展开状态;文档格式检查不等于渲染验证。开发检查按[前端指南](apps/showcase_ui/AGENTS.md)执行。
|
- 视觉变化验证代表性宽度、长标题、加载、等待回答、错误与展开状态;文档格式检查不等于渲染验证。开发检查按[前端指南](apps/showcase_ui/AGENTS.md)执行。
|
||||||
|
|
||||||
|
## Workspace plugin extensions
|
||||||
|
|
||||||
|
工作区扩展使用声明式清单版本 3,宿主提供回放面板、人工表单、任务存储和报告接口;不运行插件页面脚本,不另建队列或结果库。纯工作区插件不加入模型执行选择。接口定义见 [工作区插件](docs/workspace-plugins.md)。
|
||||||
|
|
||||||
|
回放两侧面板默认收起、独立展开,普通浮窗和影院模式共用;插件声明期望/最小/最大宽度,宿主按视口收缩,窄屏一次展开一侧,始终保持面板位于回放的左侧或右侧。任务需求只展示本次运行最初的提示词,复用安全 Markdown 渲染。人工表单字段均可留空,不调用模型、不覆盖已有执行结论或人工复验。
|
||||||
|
|
||||||
|
评审按单次任务和插件 ID 保存版本历史;运行中只读,终态可编辑或清空。停用/卸载隐藏面板与新导出字段但保留记录,任务删除时同步清理。报告只采用已安装且启用的贡献,空值保持空白;修改记录或插件状态使后续报告缓存失效。
|
||||||
|
|
||||||
|
执行详情中的 Payload 默认折叠;其他超长字段也默认折叠,展开后保留完整可复制内容并限制显示高度。原始用例面板仅由启用的工作区插件声明,额外导入列不影响未启用插件的用户。评审支持所有执行模式和目标,用户修改评审后自动保存:结果选择立即保存,备注短暂防抖;切换任务前保存,失败时保留输入和当前任务。仅用户编辑触发写入,AI 不推断人工结论。
|
||||||
|
|
||||||
|
模型网络代理策略仅由环境项 `OPENAI_USE_SYSTEM_PROXY` 控制,默认 false。同步、异步模型客户端和模型凭据检查统一遵循;不出现在前端配置中,不改变 TLS 验证与自定义 CA 设置。
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
基于 [ARTEMIS](https://github.com/google/artemis) 扩展的 Android AI 自动化测试平台。用自然语言描述任务,即可通过简体中文网页或 MCP 驱动真机、模拟器执行操作并收集结果。模型统一使用 **OpenAI Responses API**。
|
基于 [ARTEMIS](https://github.com/google/artemis) 扩展的 Android AI 自动化测试平台。用自然语言描述任务,即可通过简体中文网页或 MCP 驱动真机、模拟器执行操作并收集结果。模型统一使用 **OpenAI Responses API**。
|
||||||
|
|
||||||
**2.2.0**:新增无需手机在线的仅 PC 测试、全局串行队列、暗色模式、Markdown 表格及可折叠复制的工具结果;修复安卓输入清空、观测恢复、排队状态与最终验收匹配。升级内容、验证范围与配套 Cua 插件见 [2.2.0 发行说明](docs/releases/2.2.0.md)。上一版本见 [2.1.0](docs/releases/2.1.0.md);Python 3.12 启动修复见 [2.0.1](docs/releases/2.0.1.md),探索、插件和精选任务等功能见 [2.0.0](docs/releases/2.0.0.md)。
|
**2.4.1**:修复全新安装时的 npm 校验失败,准确检查 Node.js 版本要求。人工评审插件继续使用 1.1.0,市场使用兼容旧宿主的独立索引。见 [2.4.1 发行说明](docs/releases/2.4.1.md);功能更新见 [2.4.0](docs/releases/2.4.0.md)。
|
||||||
|
|
||||||
## 主要功能
|
## 主要功能
|
||||||
|
|
||||||
- **自然语言任务**:Flash 适合明确的操作流程,Pro 适合需要计划、分支探索和验证的任务。
|
- **自然语言任务**:Flash 适合明确的操作流程,Pro 适合需要计划、分支探索和验证的任务。
|
||||||
- **交互探索**:边执行边交流,也可录制人工示范;探索成功后生成一个可编辑、复跑的用例。默认使用独立的 `gpt-6.1-sol / high` 配置,超时暂停并保留进度。见 [探索模式](docs/exploration-mode.md)。
|
- **交互探索**:边执行边交流,也可录制人工示范;探索成功后生成一个可编辑、复跑的用例。默认使用独立的 `gpt-6.1-terra / high` 配置,超时暂停并保留进度。见 [探索模式](docs/exploration-mode.md)。
|
||||||
- **插件扩展**:在插件市场安装并启用电脑控制等能力,AI 在安卓任务中按需使用;手机、电脑的步骤与证据统一留档。见 [插件与跨端任务](docs/plugins.md)。
|
- **插件扩展**:安装并启用电脑控制等执行能力,或使用工作区插件为回放和报告增加人工评审。手机、电脑的步骤与证据统一留档。见 [插件与跨端任务](docs/plugins.md)和[工作区插件接口](docs/workspace-plugins.md)。
|
||||||
- **可保存的模型配置**:支持自定义接口、模型、思考强度和超时重试,以及视频分析与录屏开关。
|
- **可保存的模型配置**:支持自定义接口、模型、思考强度和超时重试,以及视频分析与录屏开关。
|
||||||
- **批量测试**:按新版 Excel 模板导入提示词,每项可独立指定模型、模式和参数;任务可暂停、补充指导并继续。
|
- **批量测试**:按新版 Excel 模板导入提示词,每项可独立指定模型、模式和参数;任务可暂停、补充指导并继续。
|
||||||
- **精选任务**:收藏单任务、批次或探索用例,在首页一键复跑,默认沿用已保存的配置。
|
- **精选任务**:收藏单任务、批次或探索用例,在首页一键复跑,默认沿用已保存的配置。
|
||||||
@@ -57,7 +57,7 @@ cd Artemis-Eapil
|
|||||||
3. 输入任务目标,选择 Flash、Pro 或探索后执行;仅测试电脑时勾选输入区的“仅 PC”,无需手机或模拟器在线,但需已启用并授权的电脑观察插件。在工作区查看步骤、截图和结果。流程尚不明确时,选择探索并随时交流。
|
3. 输入任务目标,选择 Flash、Pro 或探索后执行;仅测试电脑时勾选输入区的“仅 PC”,无需手机或模拟器在线,但需已启用并授权的电脑观察插件。在工作区查看步骤、截图和结果。流程尚不明确时,选择探索并随时交流。
|
||||||
4. 通过“报告与批量”导出报告或导入 Excel 用例;任务队列支持历史搜索。
|
4. 通过“报告与批量”导出报告或导入 Excel 用例;任务队列支持历史搜索。
|
||||||
|
|
||||||
预设模型为 `gpt-6-luna`、`gpt-6.1-sol`、`gpt-6-astra`、`mimo-v2.6-pro`,主模型与兜底模型均可选择预设或填写自定义名称。新安装默认模型是 `gpt-6-luna`,思考强度默认 `high`(最高可选 `max`),单次请求超时 **300 秒**,失败后最多重试 **5 次**,间隔 **10 秒**。遇到 429 请求过多时改为每次等待 **60 秒**。连续 3 次没有有效工具调用时,本步骤改用 `gpt-6-luna`(high),兜底模型最多再尝试 3 次;下一步恢复首选模型。视频分析与录屏默认关闭。模型及思考参数是否可用取决于所配置网关;不支持时会明确报错。
|
预设模型为 `gpt-6-luna`、`gpt-6.1-terra`、`gpt-6.1-sol`、`gpt-6-astra`、`mimo-v2.6-pro`,主模型与兜底模型均可选择预设或填写自定义名称。新安装默认模型是 `gpt-6-luna`,思考强度默认 `high`(最高可选 `max`),单次请求超时 **300 秒**,失败后最多重试 **5 次**,间隔 **10 秒**。遇到 429 请求过多时改为每次等待 **60 秒**。连续 3 次没有有效工具调用时,本步骤改用 `gpt-6-luna`(high),兜底模型最多再尝试 3 次;下一步恢复首选模型。视频分析与录屏默认关闭。模型及思考参数是否可用取决于所配置网关;不支持时会明确报错。
|
||||||
|
|
||||||
也可在项目 `.env` 中设置 `OPENAI_API_KEY`、`OPENAI_BASE_URL` 和 `OPENAI_MODEL`,其他参数见 [.env.example](.env.example)。新安装默认接口地址为 `https://api-n-cd.playones.com/v1`;已保存的地址不变。直接编辑环境文件后需重启相应服务。不要提交自己的密钥。
|
也可在项目 `.env` 中设置 `OPENAI_API_KEY`、`OPENAI_BASE_URL` 和 `OPENAI_MODEL`,其他参数见 [.env.example](.env.example)。新安装默认接口地址为 `https://api-n-cd.playones.com/v1`;已保存的地址不变。直接编辑环境文件后需重启相应服务。不要提交自己的密钥。
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import time
|
import time
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@@ -235,6 +236,47 @@ class SessionRepository:
|
|||||||
rows = cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
return [r[0] for r in rows if r and r[0]]
|
return [r[0] for r in rows if r and r[0]]
|
||||||
|
|
||||||
|
def get_recorded_model_info_map(self, session_ids: list[str]) -> dict[str, dict[str, str]]:
|
||||||
|
"""Read each session's own requested model from its earliest diagnostics.
|
||||||
|
|
||||||
|
Prefer operator/Flash requests over auxiliary roles. Older sessions may
|
||||||
|
have no model diagnostics; do not replace their missing data with the
|
||||||
|
current global configuration.
|
||||||
|
"""
|
||||||
|
result: dict[str, dict[str, str]] = {}
|
||||||
|
safe_payload = "CASE WHEN json_valid(t.payload) THEN t.payload ELSE '{}' END"
|
||||||
|
valid_model = f"json_type({safe_payload}, '$.model') = 'text'"
|
||||||
|
role = f"lower(json_extract({safe_payload}, '$.role'))"
|
||||||
|
with db_session(self.db_path) as conn:
|
||||||
|
for offset in range(0, len(session_ids), 500):
|
||||||
|
batch = session_ids[offset : offset + 500]
|
||||||
|
placeholders = ",".join("?" for _ in batch)
|
||||||
|
rows = conn.execute(
|
||||||
|
"SELECT s.session_id, COALESCE("
|
||||||
|
" (SELECT t.payload FROM traces t WHERE t.session_id = s.session_id"
|
||||||
|
f" AND t.type = 'llm_diagnostic' AND {valid_model}"
|
||||||
|
f" AND {role} IN ('operator', 'flashrunner')"
|
||||||
|
" ORDER BY t.timestamp ASC LIMIT 1),"
|
||||||
|
" (SELECT t.payload FROM traces t WHERE t.session_id = s.session_id"
|
||||||
|
f" AND t.type = 'llm_diagnostic' AND {valid_model}"
|
||||||
|
" ORDER BY t.timestamp ASC LIMIT 1)"
|
||||||
|
") AS model_payload FROM sessions s"
|
||||||
|
f" WHERE s.session_id IN ({placeholders})",
|
||||||
|
batch,
|
||||||
|
).fetchall()
|
||||||
|
for row in rows:
|
||||||
|
if not row[1]:
|
||||||
|
continue
|
||||||
|
payload = json.loads(row[1])
|
||||||
|
model = payload.get("model")
|
||||||
|
if isinstance(model, str) and model.strip():
|
||||||
|
provider = payload.get("provider")
|
||||||
|
result[str(row[0])] = {
|
||||||
|
"id": model,
|
||||||
|
"provider": provider if isinstance(provider, str) else "",
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
|
||||||
def get_llm_traces_for_profiles_map(
|
def get_llm_traces_for_profiles_map(
|
||||||
self, session_ids: list[str] | None = None, limit: int = 3
|
self, session_ids: list[str] | None = None, limit: int = 3
|
||||||
) -> dict[str, list[str]]:
|
) -> dict[str, list[str]]:
|
||||||
@@ -349,7 +391,22 @@ class SessionRepository:
|
|||||||
total += t
|
total += t
|
||||||
cached += _int(payload.get("cached_tokens"))
|
cached += _int(payload.get("cached_tokens"))
|
||||||
node = str(payload.get("node") or "").strip().lower()
|
node = str(payload.get("node") or "").strip().lower()
|
||||||
model_name = str(payload.get("model") or "unknown")
|
model_name = payload.get("model")
|
||||||
|
if not model_name:
|
||||||
|
# Older gateway traces carry the model in their own endpoint key.
|
||||||
|
source = str(payload.get("source") or "")
|
||||||
|
source_parts = source.split(":", 2)
|
||||||
|
if len(source_parts) == 3 and source_parts[0] == "openai":
|
||||||
|
# Model aliases can contain colons. The HTTP(S) base URL
|
||||||
|
# marks the boundary; an ambiguous key stays unknown.
|
||||||
|
match = re.match(r"^openai:(.+?):https?://", source)
|
||||||
|
model_name = match[1] if match else None
|
||||||
|
elif len(source_parts) == 3 and source_parts[:2] in (
|
||||||
|
["lens", "visual_transition"],
|
||||||
|
["lens", "step_capsule"],
|
||||||
|
):
|
||||||
|
model_name = source_parts[2] if source_parts[2] != "fallback" else None
|
||||||
|
model_name = str(model_name or "unknown")
|
||||||
group = by_node_model.setdefault(
|
group = by_node_model.setdefault(
|
||||||
(node, model_name),
|
(node, model_name),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -220,6 +220,41 @@ class StepRepository:
|
|||||||
# recovering, waiting, completed, and terminal outcomes. Other tools
|
# recovering, waiting, completed, and terminal outcomes. Other tools
|
||||||
# retain the historical compact payload to avoid sending large blobs.
|
# retain the historical compact payload to avoid sending large blobs.
|
||||||
res = payload_obj.get("result")
|
res = payload_obj.get("result")
|
||||||
|
if trace_type == "tool" and trace_name == "android_file":
|
||||||
|
# Preserve host-written file receipts, not file contents. A file's
|
||||||
|
# checksum is not a screenshot-store image ID.
|
||||||
|
if isinstance(res, str):
|
||||||
|
try:
|
||||||
|
res = json.loads(res)
|
||||||
|
except ValueError:
|
||||||
|
res = None
|
||||||
|
if isinstance(res, dict) and "outcome" in res:
|
||||||
|
res = res["outcome"]
|
||||||
|
if isinstance(res, str):
|
||||||
|
try:
|
||||||
|
res = json.loads(res)
|
||||||
|
except ValueError:
|
||||||
|
res = None
|
||||||
|
if isinstance(res, dict):
|
||||||
|
result_payload["result"] = {
|
||||||
|
key: self._clean_value(res[key])
|
||||||
|
for key in (
|
||||||
|
"ok",
|
||||||
|
"action",
|
||||||
|
"path",
|
||||||
|
"trace_path",
|
||||||
|
"device_path",
|
||||||
|
"bytes",
|
||||||
|
"sha256",
|
||||||
|
"verified",
|
||||||
|
"width",
|
||||||
|
"height",
|
||||||
|
"captured_at",
|
||||||
|
"device_serial",
|
||||||
|
)
|
||||||
|
if key in res
|
||||||
|
}
|
||||||
|
return result_payload
|
||||||
is_video_analysis = str(trace_name or "").lower() in {
|
is_video_analysis = str(trace_name or "").lower() in {
|
||||||
"video_analysis",
|
"video_analysis",
|
||||||
"video_analyzer",
|
"video_analyzer",
|
||||||
|
|||||||
@@ -214,6 +214,9 @@ async def diagnose_plugin(plugin_id: str, request: DiagnoseRequest):
|
|||||||
try:
|
try:
|
||||||
store = get_store()
|
store = get_store()
|
||||||
manifest = PluginManifest.model_validate(store.get(plugin_id)["manifest"])
|
manifest = PluginManifest.model_validate(store.get(plugin_id)["manifest"])
|
||||||
|
if manifest.workspace and manifest.server is None and manifest.skill is None:
|
||||||
|
store.resolve(PluginSelection(id=plugin_id, profile=request.profile))
|
||||||
|
return {"ok": True, "tools": {}, "message": "工作区扩展已就绪"}
|
||||||
runtime = PluginRuntime(
|
runtime = PluginRuntime(
|
||||||
[PluginSelection(id=plugin_id, profile=request.profile)],
|
[PluginSelection(id=plugin_id, profile=request.profile)],
|
||||||
store=store,
|
store=store,
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ def _list_sessions_sync():
|
|||||||
with store.connection() as connection:
|
with store.connection() as connection:
|
||||||
exploration_runs = exploration_metadata(connection)
|
exploration_runs = exploration_metadata(connection)
|
||||||
jobs_by_id = store.jobs_for_sessions([str(row.get("session_id")) for row in rows])
|
jobs_by_id = store.jobs_for_sessions([str(row.get("session_id")) for row in rows])
|
||||||
|
recorded_models = session_repo.get_recorded_model_info_map(
|
||||||
|
[str(row.get("session_id")) for row in rows]
|
||||||
|
)
|
||||||
video_rec_map = session_repo.get_video_recordings_map()
|
video_rec_map = session_repo.get_video_recordings_map()
|
||||||
latest_recordings = session_repo.get_latest_video_recordings_map()
|
latest_recordings = session_repo.get_latest_video_recordings_map()
|
||||||
agent_names_by_session = session_repo.get_agent_trace_names_map()
|
agent_names_by_session = session_repo.get_agent_trace_names_map()
|
||||||
@@ -217,6 +220,13 @@ def _list_sessions_sync():
|
|||||||
print(f"[list_sessions] Failed to update orphaned sessions: {e}")
|
print(f"[list_sessions] Failed to update orphaned sessions: {e}")
|
||||||
|
|
||||||
for row in result:
|
for row in result:
|
||||||
|
# Session history must not inherit today's global model configuration.
|
||||||
|
row["model_info"] = {
|
||||||
|
**row["model_info"],
|
||||||
|
"id": "",
|
||||||
|
"provider": "",
|
||||||
|
**recorded_models.get(str(row.get("session_id")), {}),
|
||||||
|
}
|
||||||
if row.get("exploration_kind") == "validation" and row.get("exploration_case_name"):
|
if row.get("exploration_kind") == "validation" and row.get("exploration_case_name"):
|
||||||
row["display_name"] = row["exploration_case_name"]
|
row["display_name"] = row["exploration_case_name"]
|
||||||
model = row.pop("exploration_model", None)
|
model = row.pop("exploration_model", None)
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
"""Workspace UI extension API. No model or device actions are dispatched."""
|
||||||
|
|
||||||
|
from uuid import UUID
|
||||||
|
|
||||||
|
from fastapi import APIRouter, HTTPException
|
||||||
|
from pydantic import BaseModel, ConfigDict, Field
|
||||||
|
|
||||||
|
from apps.admin_console.services import batch_archive, report_export, task_extensions
|
||||||
|
from apps.admin_console.services.automation_store import store
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/api/task-extensions", tags=["task-extensions"])
|
||||||
|
|
||||||
|
|
||||||
|
class ExtensionUpdate(BaseModel):
|
||||||
|
model_config = ConfigDict(extra="forbid")
|
||||||
|
values: dict[str, str] = Field(max_length=20)
|
||||||
|
expected_revision: int = Field(ge=0)
|
||||||
|
request_id: UUID
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/{session_id}")
|
||||||
|
def read_extensions(session_id: str):
|
||||||
|
try:
|
||||||
|
return {
|
||||||
|
**task_extensions.task_context(session_id, store),
|
||||||
|
"plugins": task_extensions.contributions(session_id, store),
|
||||||
|
}
|
||||||
|
except ValueError as exc:
|
||||||
|
raise HTTPException(404, str(exc)) from exc
|
||||||
|
|
||||||
|
|
||||||
|
@router.put("/{session_id}/{plugin_id}")
|
||||||
|
def update_extension(session_id: str, plugin_id: str, value: ExtensionUpdate):
|
||||||
|
job = store.job(session_id) or {}
|
||||||
|
batch_id = job.get("batch_id")
|
||||||
|
if (
|
||||||
|
batch_id
|
||||||
|
and batch_archive.status(batch_id, store.get("batch", batch_id) or {})["status"]
|
||||||
|
== "preparing"
|
||||||
|
):
|
||||||
|
raise HTTPException(409, "报告正在打包,请稍后保存评审")
|
||||||
|
with (
|
||||||
|
report_export.export_lock(
|
||||||
|
*(["batch:" + batch_id] if batch_id else []), "session:" + session_id
|
||||||
|
),
|
||||||
|
task_extensions.plugin_store().mutation_lock,
|
||||||
|
):
|
||||||
|
context = read_extensions(session_id)
|
||||||
|
if not context["editable"]:
|
||||||
|
raise HTTPException(409, "请在任务结束后填写评审")
|
||||||
|
manifest = next((m for m in task_extensions.active_manifests() if m.id == plugin_id), None)
|
||||||
|
if manifest is None:
|
||||||
|
raise HTTPException(409, "插件未安装或未启用,请刷新页面")
|
||||||
|
try:
|
||||||
|
task_extensions.save_values(
|
||||||
|
store,
|
||||||
|
session_id,
|
||||||
|
manifest,
|
||||||
|
value.values,
|
||||||
|
value.expected_revision,
|
||||||
|
str(value.request_id),
|
||||||
|
)
|
||||||
|
except ValueError as exc:
|
||||||
|
raise HTTPException(409, str(exc)) from exc
|
||||||
|
if batch_id:
|
||||||
|
batch_archive.forget(batch_id)
|
||||||
|
return read_extensions(session_id)
|
||||||
@@ -441,6 +441,24 @@ async def get_status():
|
|||||||
)
|
)
|
||||||
|
|
||||||
model_info = model_service.get_active_model_info(active_profile)
|
model_info = model_service.get_active_model_info(active_profile)
|
||||||
|
model_sid = running_sid if is_running else latest_session_id
|
||||||
|
if model_info and model_sid:
|
||||||
|
recorded_model = session_repo.get_recorded_model_info_map([str(model_sid)]).get(
|
||||||
|
str(model_sid)
|
||||||
|
)
|
||||||
|
if not isinstance(recorded_model, dict):
|
||||||
|
matching_task = next(
|
||||||
|
(
|
||||||
|
item
|
||||||
|
for item in state.queue_items
|
||||||
|
if isinstance(item, dict) and str(item.get("session_id")) == str(model_sid)
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
override = (matching_task or {}).get("runtime_overrides") or {}
|
||||||
|
model = override.get("model")
|
||||||
|
recorded_model = {"id": model, "provider": "openai"} if model else {}
|
||||||
|
model_info = {**model_info, "id": "", "provider": "", **recorded_model}
|
||||||
|
|
||||||
# Unified Global Queue: merge web tasks and external SDK/CLI device queue tickets
|
# Unified Global Queue: merge web tasks and external SDK/CLI device queue tickets
|
||||||
global_queued = DeviceExecutionLock.get_queued_tasks()
|
global_queued = DeviceExecutionLock.get_queued_tasks()
|
||||||
@@ -508,6 +526,12 @@ async def get_status():
|
|||||||
is_paused = state.is_paused
|
is_paused = state.is_paused
|
||||||
conn_profile = conn_info.get("profile") or active_profile
|
conn_profile = conn_info.get("profile") or active_profile
|
||||||
conn_model_info = model_service.get_active_model_info(conn_profile)
|
conn_model_info = model_service.get_active_model_info(conn_profile)
|
||||||
|
if conn_model_info and model_info:
|
||||||
|
conn_model_info = {
|
||||||
|
**conn_model_info,
|
||||||
|
"id": model_info["id"],
|
||||||
|
"provider": model_info["provider"],
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
"status": "paused" if is_paused else "running",
|
"status": "paused" if is_paused else "running",
|
||||||
"paused_error": state.paused_error if is_paused else None,
|
"paused_error": state.paused_error if is_paused else None,
|
||||||
|
|||||||
@@ -284,6 +284,9 @@ app.include_router(favorites_router)
|
|||||||
from apps.admin_console.routers.plugins import router as plugins_router
|
from apps.admin_console.routers.plugins import router as plugins_router
|
||||||
|
|
||||||
app.include_router(plugins_router)
|
app.include_router(plugins_router)
|
||||||
|
from apps.admin_console.routers.task_extensions import router as task_extensions_router
|
||||||
|
|
||||||
|
app.include_router(task_extensions_router)
|
||||||
|
|
||||||
from apps.admin_console.routers.exploration import router as exploration_router
|
from apps.admin_console.routers.exploration import router as exploration_router
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ from artemis.runtime.task_limits import task_timeout
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
TERMINAL = {"completed", "failed", "cancelled", "skipped", "interrupted"}
|
TERMINAL = {"completed", "failed", "cancelled", "skipped", "interrupted"}
|
||||||
|
MODEL_PAUSE_REASON = "模型请求已暂停,请先恢复模型连接再继续批次"
|
||||||
background_tasks: set[asyncio.Task] = set()
|
background_tasks: set[asyncio.Task] = set()
|
||||||
|
|
||||||
|
|
||||||
@@ -123,7 +124,9 @@ def recover_batches():
|
|||||||
if any(str(job["session_id"]) in live_sessions for job in store.jobs(batch["id"])):
|
if any(str(job["session_id"]) in live_sessions for job in store.jobs(batch["id"])):
|
||||||
continue
|
continue
|
||||||
batch.update(
|
batch.update(
|
||||||
status="paused", reason="服务已重启;请检查中断任务,点击继续执行未开始任务"
|
status="paused",
|
||||||
|
reason="服务已重启;请检查中断任务,点击继续执行未开始任务",
|
||||||
|
pause_source="recovery",
|
||||||
)
|
)
|
||||||
for job in store.jobs(batch["id"]):
|
for job in store.jobs(batch["id"]):
|
||||||
if job["status"] in {"running", "queued", "finalizing", "task_paused", "resuming"}:
|
if job["status"] in {"running", "queued", "finalizing", "task_paused", "resuming"}:
|
||||||
@@ -164,9 +167,29 @@ async def on_terminal(item: dict, status: str):
|
|||||||
}
|
}
|
||||||
):
|
):
|
||||||
job["status"] = "failed"
|
job["status"] = "failed"
|
||||||
job["error"] = job.get("error") or "任务执行结束,但业务检查未通过"
|
job["error"] = (
|
||||||
|
job.get("error")
|
||||||
|
or report.get("error")
|
||||||
|
or (report.get("test_result") or {}).get("reason")
|
||||||
|
or "任务未完成或验证未通过,请查看报告中的具体原因"
|
||||||
|
)
|
||||||
elif job["status"] == "failed" and report.get("error") and not job.get("error"):
|
elif job["status"] == "failed" and report.get("error") and not job.get("error"):
|
||||||
job["error"] = report["error"]
|
job["error"] = report["error"]
|
||||||
|
if job["status"] == "failed" and report["outcome"].get("code") == "initialization_failed":
|
||||||
|
job["failure_code"] = "initialization_failed"
|
||||||
|
batch = store.get("batch", job.get("batch_id")) if job.get("batch_id") else None
|
||||||
|
if (
|
||||||
|
batch
|
||||||
|
and (batch["status"] == "running" or batch.get("pause_source") == "model")
|
||||||
|
and any(j["status"] == "pending" for j in store.jobs(batch["id"]))
|
||||||
|
):
|
||||||
|
batch.update(
|
||||||
|
status="paused",
|
||||||
|
pause_source="initialization",
|
||||||
|
reason="任务初始化失败;请处理环境问题后继续剩余用例:"
|
||||||
|
+ (job.get("error") or "请查看任务报告"),
|
||||||
|
)
|
||||||
|
store.put("batch", batch["id"], batch)
|
||||||
# Persist terminal classification before export, but the coordinator waits for finalization.
|
# Persist terminal classification before export, but the coordinator waits for finalization.
|
||||||
store.save_job({**job, "status": "finalizing", "terminal_status": job["status"]})
|
store.save_job({**job, "status": "finalizing", "terminal_status": job["status"]})
|
||||||
await asyncio.to_thread(export_session, sid, job["formats"])
|
await asyncio.to_thread(export_session, sid, job["formats"])
|
||||||
@@ -217,10 +240,18 @@ async def tick_batches():
|
|||||||
if batch["status"] not in {"running", "paused"}:
|
if batch["status"] not in {"running", "paused"}:
|
||||||
continue
|
continue
|
||||||
jobs = store.jobs(batch["id"])
|
jobs = store.jobs(batch["id"])
|
||||||
|
if (
|
||||||
|
batch["status"] == "paused"
|
||||||
|
and batch.get("pause_source") == "model"
|
||||||
|
and not state.is_paused
|
||||||
|
):
|
||||||
|
batch.update(status="running", reason="")
|
||||||
|
batch.pop("pause_source", None)
|
||||||
|
store.put("batch", batch["id"], batch)
|
||||||
active = [j for j in jobs if j["status"] in {"running", "queued", "finalizing"}]
|
active = [j for j in jobs if j["status"] in {"running", "queued", "finalizing"}]
|
||||||
if active:
|
if active:
|
||||||
if state.is_paused:
|
if state.is_paused and batch["status"] == "running":
|
||||||
batch.update(status="paused", reason="模型请求已暂停,请先恢复模型连接再继续批次")
|
batch.update(status="paused", reason=MODEL_PAUSE_REASON, pause_source="model")
|
||||||
store.put("batch", batch["id"], batch)
|
store.put("batch", batch["id"], batch)
|
||||||
for job in active:
|
for job in active:
|
||||||
# The queue records started_at at submission, then replaces it
|
# The queue records started_at at submission, then replaces it
|
||||||
@@ -284,7 +315,7 @@ async def tick_batches():
|
|||||||
store.put("batch", batch["id"], batch)
|
store.put("batch", batch["id"], batch)
|
||||||
continue
|
continue
|
||||||
if state.is_paused:
|
if state.is_paused:
|
||||||
batch.update(status="paused", reason="模型请求已暂停,请先恢复模型连接再继续批次")
|
batch.update(status="paused", reason=MODEL_PAUSE_REASON, pause_source="model")
|
||||||
store.put("batch", batch["id"], batch)
|
store.put("batch", batch["id"], batch)
|
||||||
continue
|
continue
|
||||||
job = pending[0]
|
job = pending[0]
|
||||||
@@ -438,11 +469,14 @@ def batch_action(batch_id: str, action: str) -> dict:
|
|||||||
if action == "pause":
|
if action == "pause":
|
||||||
if batch["status"] not in {"running", "paused"}:
|
if batch["status"] not in {"running", "paused"}:
|
||||||
raise ValueError("只能暂停正在执行的批次")
|
raise ValueError("只能暂停正在执行的批次")
|
||||||
batch.update(status="paused", reason="用户暂停;当前任务继续,后续任务等待")
|
batch.update(
|
||||||
|
status="paused", reason="用户暂停;当前任务继续,后续任务等待", pause_source="user"
|
||||||
|
)
|
||||||
elif action == "resume":
|
elif action == "resume":
|
||||||
if batch["status"] not in {"draft", "paused"}:
|
if batch["status"] not in {"draft", "paused"}:
|
||||||
raise ValueError("只能开始草稿或继续已暂停批次")
|
raise ValueError("只能开始草稿或继续已暂停批次")
|
||||||
batch.update(status="running", reason="")
|
batch.update(status="running", reason="")
|
||||||
|
batch.pop("pause_source", None)
|
||||||
elif action == "retry_failed":
|
elif action == "retry_failed":
|
||||||
if batch["status"] == "running":
|
if batch["status"] == "running":
|
||||||
raise ValueError("请先暂停批次")
|
raise ValueError("请先暂停批次")
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ class AutomationStore:
|
|||||||
if batch.get("status") != "deleting":
|
if batch.get("status") != "deleting":
|
||||||
raise ValueError("批次尚未准备删除")
|
raise ValueError("批次尚未准备删除")
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"DELETE FROM automation_records WHERE kind='case_review' AND id IN "
|
"DELETE FROM automation_records WHERE kind IN ('case_review','task_extensions') AND id IN "
|
||||||
"(SELECT session_id FROM automation_jobs WHERE batch_id=?)",
|
"(SELECT session_id FROM automation_jobs WHERE batch_id=?)",
|
||||||
(batch_id,),
|
(batch_id,),
|
||||||
)
|
)
|
||||||
@@ -312,13 +312,15 @@ class AutomationStore:
|
|||||||
if session_id:
|
if session_id:
|
||||||
conn.execute("DELETE FROM automation_jobs WHERE session_id=?", (session_id,))
|
conn.execute("DELETE FROM automation_jobs WHERE session_id=?", (session_id,))
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"DELETE FROM automation_records WHERE kind='case_review' AND id=?",
|
"DELETE FROM automation_records WHERE kind IN ('case_review','task_extensions') AND id=?",
|
||||||
(session_id,),
|
(session_id,),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
conn.execute("DELETE FROM automation_jobs")
|
conn.execute("DELETE FROM automation_jobs")
|
||||||
conn.execute("DELETE FROM automation_records WHERE kind='batch'")
|
conn.execute("DELETE FROM automation_records WHERE kind='batch'")
|
||||||
conn.execute("DELETE FROM automation_records WHERE kind='case_review'")
|
conn.execute(
|
||||||
|
"DELETE FROM automation_records WHERE kind IN ('case_review','task_extensions')"
|
||||||
|
)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ def archive_path(batch_id: str):
|
|||||||
|
|
||||||
def cached(batch_id: str, batch: dict) -> bool:
|
def cached(batch_id: str, batch: dict) -> bool:
|
||||||
return bool(batch.get("report_ready")) and report_export.reusable(
|
return bool(batch.get("report_ready")) and report_export.reusable(
|
||||||
archive_path(batch_id), report_export.BATCH_ARCHIVE_SIGNATURE, "completed"
|
archive_path(batch_id), report_export.batch_archive_signature(batch_id), "completed"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +41,13 @@ def _snapshot(state: dict) -> dict:
|
|||||||
def status(batch_id: str, batch: dict) -> dict:
|
def status(batch_id: str, batch: dict) -> dict:
|
||||||
with _lock:
|
with _lock:
|
||||||
state = _states.get(batch_id)
|
state = _states.get(batch_id)
|
||||||
if state:
|
if state and state["status"] != "ready":
|
||||||
|
return _snapshot(state)
|
||||||
|
if (
|
||||||
|
state
|
||||||
|
and state.get("signature") == report_export.batch_archive_signature(batch_id)
|
||||||
|
and archive_path(batch_id).is_file()
|
||||||
|
):
|
||||||
return _snapshot(state)
|
return _snapshot(state)
|
||||||
if cached(batch_id, batch):
|
if cached(batch_id, batch):
|
||||||
return {
|
return {
|
||||||
@@ -65,11 +71,12 @@ def status(batch_id: str, batch: dict) -> dict:
|
|||||||
|
|
||||||
|
|
||||||
def prepare(batch_id: str, batch: dict) -> dict:
|
def prepare(batch_id: str, batch: dict) -> dict:
|
||||||
|
cache_ready = cached(batch_id, batch)
|
||||||
with _lock:
|
with _lock:
|
||||||
current = _states.get(batch_id)
|
current = _states.get(batch_id)
|
||||||
if current and current["status"] == "preparing":
|
if current and current["status"] == "preparing":
|
||||||
return _snapshot(current)
|
return _snapshot(current)
|
||||||
if cached(batch_id, batch):
|
if cache_ready:
|
||||||
_states.pop(batch_id, None)
|
_states.pop(batch_id, None)
|
||||||
return status_from_cache()
|
return status_from_cache()
|
||||||
state = {
|
state = {
|
||||||
@@ -88,11 +95,17 @@ def prepare(batch_id: str, batch: dict) -> dict:
|
|||||||
def run() -> None:
|
def run() -> None:
|
||||||
try:
|
try:
|
||||||
with report_export.export_lock("batch:" + batch_id):
|
with report_export.export_lock("batch:" + batch_id):
|
||||||
|
signature = report_export.batch_archive_signature(batch_id)
|
||||||
latest = report_export.store.get("batch", batch_id)
|
latest = report_export.store.get("batch", batch_id)
|
||||||
if not (latest and cached(batch_id, latest)):
|
if not (latest and cached(batch_id, latest)):
|
||||||
report_export.export_batch(batch_id, progress=update)
|
report_export.export_batch(batch_id, progress=update)
|
||||||
with _lock:
|
with _lock:
|
||||||
state.update(status="ready", stage="报告包已就绪", finished_at=time.monotonic())
|
state.update(
|
||||||
|
status="ready",
|
||||||
|
stage="报告包已就绪",
|
||||||
|
finished_at=time.monotonic(),
|
||||||
|
signature=signature,
|
||||||
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
with _lock:
|
with _lock:
|
||||||
state.update(
|
state.update(
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class MediaService:
|
|||||||
return p
|
return p
|
||||||
|
|
||||||
LIVE_RECORDING_GRACE_SECONDS = 10.0
|
LIVE_RECORDING_GRACE_SECONDS = 10.0
|
||||||
TRACE_STATUS_SUFFIXES = ("_PASS_", "_FAIL_", "_TESTFAIL_")
|
TRACE_STATUS_SUFFIXES = ("_PASS_", "_FAIL_", "_TESTFAIL_", "_BLOCKED_", "_UNVERIFIED_")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_live_recording(cls, p: Path) -> bool:
|
def is_live_recording(cls, p: Path) -> bool:
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ def get_model_settings() -> dict:
|
|||||||
"reasoning_effort": settings.OPENAI_REASONING_EFFORT,
|
"reasoning_effort": settings.OPENAI_REASONING_EFFORT,
|
||||||
"model_presets": [
|
"model_presets": [
|
||||||
"gpt-6-luna",
|
"gpt-6-luna",
|
||||||
|
"gpt-6.1-terra",
|
||||||
"gpt-6.1-sol",
|
"gpt-6.1-sol",
|
||||||
"gpt-6-astra",
|
"gpt-6-astra",
|
||||||
"mimo-v2.6-pro",
|
"mimo-v2.6-pro",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ from apps.admin_console.services.export_cache import (
|
|||||||
)
|
)
|
||||||
from apps.admin_console.services.request_diagnostics import diagnostics_json
|
from apps.admin_console.services.request_diagnostics import diagnostics_json
|
||||||
from apps.admin_console.services.task_lifecycle import guidance_details
|
from apps.admin_console.services.task_lifecycle import guidance_details
|
||||||
|
from apps.admin_console.services import task_extensions
|
||||||
|
|
||||||
from docx import Document
|
from docx import Document
|
||||||
from docx.enum.table import WD_CELL_VERTICAL_ALIGNMENT
|
from docx.enum.table import WD_CELL_VERTICAL_ALIGNMENT
|
||||||
@@ -35,7 +36,32 @@ from artemis.runtime.case_result import RESULT_LABELS, resolve_case_result
|
|||||||
from apps.admin_console.services.case_review import reviewed_result
|
from apps.admin_console.services.case_review import reviewed_result
|
||||||
|
|
||||||
EXPORT_ROOT = WORKSPACE_ROOT / "artifacts" / "reports"
|
EXPORT_ROOT = WORKSPACE_ROOT / "artifacts" / "reports"
|
||||||
BATCH_ARCHIVE_SIGNATURE = "artemis-batch-layout-2"
|
BATCH_ARCHIVE_SIGNATURE = "artemis-batch-layout-3"
|
||||||
|
|
||||||
|
|
||||||
|
def batch_archive_signature(batch_id: str | None = None) -> str:
|
||||||
|
signature = task_extensions.installation_signature()
|
||||||
|
if batch_id:
|
||||||
|
with store.connection() as conn:
|
||||||
|
changes = conn.execute(
|
||||||
|
"SELECT r.id,r.updated_at FROM automation_records r "
|
||||||
|
"JOIN automation_jobs j ON j.session_id=r.id "
|
||||||
|
"WHERE r.kind='task_extensions' AND j.batch_id=? ORDER BY r.id",
|
||||||
|
(batch_id,),
|
||||||
|
).fetchall()
|
||||||
|
if changes:
|
||||||
|
signature += ":" + fingerprint({"reviews": [tuple(row) for row in changes]})
|
||||||
|
return BATCH_ARCHIVE_SIGNATURE + (":" + signature if signature else "")
|
||||||
|
|
||||||
|
|
||||||
|
def extension_rows(report: dict) -> list[tuple[str, str, str]]:
|
||||||
|
return [
|
||||||
|
(section["name"], field["label"], field["value"])
|
||||||
|
for section in report.get("task_extensions", [])
|
||||||
|
for field in section["fields"]
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
STATUS = {
|
STATUS = {
|
||||||
"completed": "执行完成",
|
"completed": "执行完成",
|
||||||
"success": "执行完成",
|
"success": "执行完成",
|
||||||
@@ -208,11 +234,14 @@ def session_report(session_id: str, db_path=None) -> dict:
|
|||||||
if status in {"failed", "interrupted"} and verification.startswith("未验证"):
|
if status in {"failed", "interrupted"} and verification.startswith("未验证"):
|
||||||
verification = "未验证(任务异常终止)"
|
verification = "未验证(任务异常终止)"
|
||||||
if not content:
|
if not content:
|
||||||
content = (
|
lines = ["本任务未保存独立输出正文。", f"当前有效判定:{verification}"]
|
||||||
"本任务未生成最终结论。请查看异常原因和已记录的执行步骤。"
|
if test_result:
|
||||||
if status in {"failed", "interrupted"}
|
if test_result.get("reason"):
|
||||||
else "本任务没有保存最终结论。以下内容仅来自已记录的执行状态和证据。"
|
lines.append(f"判定依据:{test_result['reason']}")
|
||||||
)
|
lines.extend(f"- {item}" for item in test_result.get("evidence") or [])
|
||||||
|
elif error:
|
||||||
|
lines.append(f"异常原因:{error}")
|
||||||
|
content = "\n\n".join(lines)
|
||||||
return {
|
return {
|
||||||
"id": session_id,
|
"id": session_id,
|
||||||
**guidance_details(session_id, db_path=repo.db_path),
|
**guidance_details(session_id, db_path=repo.db_path),
|
||||||
@@ -238,7 +267,9 @@ def session_report(session_id: str, db_path=None) -> dict:
|
|||||||
"category": case.get("category", ""),
|
"category": case.get("category", ""),
|
||||||
"subcategory": case.get("subcategory", ""),
|
"subcategory": case.get("subcategory", ""),
|
||||||
"preconditions": case.get("preconditions", ""),
|
"preconditions": case.get("preconditions", ""),
|
||||||
|
"original_case": case.get("original_case"),
|
||||||
"task_config": case.get("task_config") or {},
|
"task_config": case.get("task_config") or {},
|
||||||
|
"task_extensions": task_extensions.report_sections(session_id, store),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -303,17 +334,24 @@ def source_text(value: dict) -> str:
|
|||||||
for item in value.get("sources", []):
|
for item in value.get("sources", []):
|
||||||
references = ", ".join(
|
references = ", ".join(
|
||||||
" / ".join(
|
" / ".join(
|
||||||
f"{key}={ref[key]}" for key in ("step_id", "call_id", "source_id") if ref.get(key)
|
f"{key}={ref[key]}"
|
||||||
|
for key in ("step_id", "call_id", "source_id", "trace_id")
|
||||||
|
if ref.get(key)
|
||||||
)
|
)
|
||||||
or "编号未记录"
|
or "编号未记录"
|
||||||
for ref in item.get("references", [])
|
for ref in item.get("references", [])
|
||||||
)
|
)
|
||||||
|
variation = "(来源标签随步骤变化,详见原始步骤)" if item.get("label_varies") else ""
|
||||||
lines.append(
|
lines.append(
|
||||||
f"{labels.get(item['kind'], '其他')} · {item['label'] or item['target_id']} · {references}"
|
f"{labels.get(item['kind'], '其他')} · {item['label'] or item['target_id']}"
|
||||||
|
f"{variation} · {references}"
|
||||||
)
|
)
|
||||||
if value.get("sources_omitted"):
|
if value.get("sources_omitted"):
|
||||||
lines.append(f"另 {value['sources_omitted']} 个来源见原始步骤记录。")
|
lines.append(f"另 {value['sources_omitted']} 个来源见原始步骤记录。")
|
||||||
lines.append(f"来源未完整记录的步骤:{value.get('unattributed_step_count', '未知')}。")
|
lines.append(
|
||||||
|
f"未关联到单一来源的步骤:{value.get('unattributed_step_count', '未知')}。"
|
||||||
|
"窗口枚举等操作可能没有单一目标;此计数不表示截图丢失。"
|
||||||
|
)
|
||||||
lines.append(value.get("note") or "来源清单不代表断言已验证。")
|
lines.append(value.get("note") or "来源清单不代表断言已验证。")
|
||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
||||||
@@ -340,6 +378,15 @@ def metadata(report: dict) -> list[tuple]:
|
|||||||
("检测项目", report.get("category") or "—"),
|
("检测项目", report.get("category") or "—"),
|
||||||
("测试子项", report.get("subcategory") or "—"),
|
("测试子项", report.get("subcategory") or "—"),
|
||||||
("前置约束提取", report.get("preconditions") or "—"),
|
("前置约束提取", report.get("preconditions") or "—"),
|
||||||
|
*(
|
||||||
|
[
|
||||||
|
("原始用例 · 预置条件", report["original_case"].get("preconditions") or "未填写"),
|
||||||
|
("原始用例 · 操作步骤", report["original_case"].get("steps") or "未填写"),
|
||||||
|
("原始用例 · 预期结果", report["original_case"].get("expected") or "未填写"),
|
||||||
|
]
|
||||||
|
if report.get("original_case") is not None
|
||||||
|
else []
|
||||||
|
),
|
||||||
("任务配置", config_text(report.get("task_config"))),
|
("任务配置", config_text(report.get("task_config"))),
|
||||||
("任务目标", report["goal"]),
|
("任务目标", report["goal"]),
|
||||||
("预期结果", report["expected"] or "未指定"),
|
("预期结果", report["expected"] or "未指定"),
|
||||||
@@ -659,6 +706,11 @@ def word_report(report: dict, path: Path):
|
|||||||
doc.add_paragraph("任务配置:" + config_text(report["task_config"]))
|
doc.add_paragraph("任务配置:" + config_text(report["task_config"]))
|
||||||
doc.add_heading("结论与发现", 1)
|
doc.add_heading("结论与发现", 1)
|
||||||
add_markdown_content(doc, report["content"])
|
add_markdown_content(doc, report["content"])
|
||||||
|
if review_rows := extension_rows(report):
|
||||||
|
doc.add_heading("人工评审(插件)", 1)
|
||||||
|
word_table(
|
||||||
|
doc, [(f"{name} · {label}", value) for name, label, value in review_rows], (5.5, 11)
|
||||||
|
)
|
||||||
doc.add_heading("执行步骤与证据", 1)
|
doc.add_heading("执行步骤与证据", 1)
|
||||||
for step in report["steps"]:
|
for step in report["steps"]:
|
||||||
paragraph = doc.add_paragraph()
|
paragraph = doc.add_paragraph()
|
||||||
@@ -792,6 +844,10 @@ def excel_report(report: dict, path: Path):
|
|||||||
wb.active.title = "任务结果"
|
wb.active.title = "任务结果"
|
||||||
sheet_rows(wb.active, [("项目", "内容"), *metadata(report)], (22, 82))
|
sheet_rows(wb.active, [("项目", "内容"), *metadata(report)], (22, 82))
|
||||||
sheet_rows(wb.create_sheet("结论"), conclusion_rows(report["content"]), (15, 96))
|
sheet_rows(wb.create_sheet("结论"), conclusion_rows(report["content"]), (15, 96))
|
||||||
|
if review_rows := extension_rows(report):
|
||||||
|
sheet_rows(
|
||||||
|
wb.create_sheet("人工评审"), [("插件", "项目", "内容"), *review_rows], (24, 30, 82)
|
||||||
|
)
|
||||||
table_number = 0
|
table_number = 0
|
||||||
for kind, rows in markdown_blocks(report["content"]):
|
for kind, rows in markdown_blocks(report["content"]):
|
||||||
if kind == "table":
|
if kind == "table":
|
||||||
@@ -913,8 +969,7 @@ def session_videos(report: dict) -> list[tuple[Path, str]]:
|
|||||||
return []
|
return []
|
||||||
source = Path(str(candidate)).resolve()
|
source = Path(str(candidate)).resolve()
|
||||||
trace_root = TRACES_PATH.resolve()
|
trace_root = TRACES_PATH.resolve()
|
||||||
# Workers save recordings in their finalized web_<time>_<id>_PASS/FAIL
|
# The recording row already ties the finalized trace folder to this session.
|
||||||
# folder. The recording row already ties that path to this session.
|
|
||||||
if not source.is_relative_to(trace_root):
|
if not source.is_relative_to(trace_root):
|
||||||
return []
|
return []
|
||||||
# A resumed recording lives under resume_NNNN; the initial recording is
|
# A resumed recording lives under resume_NNNN; the initial recording is
|
||||||
@@ -1064,6 +1119,8 @@ def export_batch(batch_id: str, progress: Callable[[int, int, str], None] | None
|
|||||||
directory = EXPORT_ROOT / "batches" / batch_id
|
directory = EXPORT_ROOT / "batches" / batch_id
|
||||||
directory.mkdir(parents=True, exist_ok=True)
|
directory.mkdir(parents=True, exist_ok=True)
|
||||||
formats = batch["formats"]
|
formats = batch["formats"]
|
||||||
|
with task_extensions.plugin_store().mutation_lock:
|
||||||
|
signature = batch_archive_signature(batch_id)
|
||||||
records = [session_report(job["session_id"]) for job in store.jobs(batch_id)]
|
records = [session_report(job["session_id"]) for job in store.jobs(batch_id)]
|
||||||
if progress:
|
if progress:
|
||||||
progress(0, len(records), "正在生成批次汇总")
|
progress(0, len(records), "正在生成批次汇总")
|
||||||
@@ -1078,6 +1135,17 @@ def export_batch(batch_id: str, progress: Callable[[int, int, str], None] | None
|
|||||||
assert wb.active is not None
|
assert wb.active is not None
|
||||||
wb.active.title = "批次结果"
|
wb.active.title = "批次结果"
|
||||||
sheet_rows(wb.active, rows, (40, 48, 16, 28, 70))
|
sheet_rows(wb.active, rows, (40, 48, 16, 28, 70))
|
||||||
|
review_rows = [
|
||||||
|
(record["id"], record["name"], *row)
|
||||||
|
for record in records
|
||||||
|
for row in extension_rows(record)
|
||||||
|
]
|
||||||
|
if review_rows:
|
||||||
|
sheet_rows(
|
||||||
|
wb.create_sheet("人工评审"),
|
||||||
|
[("任务编号", "任务名称", "插件", "项目", "内容"), *review_rows],
|
||||||
|
(40, 40, 24, 30, 70),
|
||||||
|
)
|
||||||
path = directory / "批次结果.xlsx"
|
path = directory / "批次结果.xlsx"
|
||||||
wb.save(path)
|
wb.save(path)
|
||||||
outputs.append(path)
|
outputs.append(path)
|
||||||
@@ -1088,6 +1156,15 @@ def export_batch(batch_id: str, progress: Callable[[int, int, str], None] | None
|
|||||||
f"批次编号:{batch_id};共 {len(records)} 个任务。验证通过与执行完成分别统计。"
|
f"批次编号:{batch_id};共 {len(records)} 个任务。验证通过与执行完成分别统计。"
|
||||||
)
|
)
|
||||||
word_table(doc, rows, (3.5, 5.4, 2.5, 3.5, 7.3), header=True)
|
word_table(doc, rows, (3.5, 5.4, 2.5, 3.5, 7.3), header=True)
|
||||||
|
for record in records:
|
||||||
|
if review_rows := extension_rows(record):
|
||||||
|
doc.add_heading("人工评审 · " + record["name"], 1)
|
||||||
|
doc.add_paragraph("任务编号:" + record["id"])
|
||||||
|
word_table(
|
||||||
|
doc,
|
||||||
|
[(f"{name} · {label}", value) for name, label, value in review_rows],
|
||||||
|
(7, 15.2),
|
||||||
|
)
|
||||||
path = directory / "批次汇总.docx"
|
path = directory / "批次汇总.docx"
|
||||||
doc.save(str(path))
|
doc.save(str(path))
|
||||||
outputs.append(path)
|
outputs.append(path)
|
||||||
@@ -1146,5 +1223,5 @@ def export_batch(batch_id: str, progress: Callable[[int, int, str], None] | None
|
|||||||
if progress:
|
if progress:
|
||||||
progress(len(records), len(records), "正在完成压缩包")
|
progress(len(records), len(records), "正在完成压缩包")
|
||||||
temporary.replace(target)
|
temporary.replace(target)
|
||||||
remember(target, BATCH_ARCHIVE_SIGNATURE)
|
remember(target, signature)
|
||||||
return target
|
return target
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
"""Human-authored task metadata owned by the host, scoped to installed plugins."""
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import time
|
||||||
|
from functools import lru_cache
|
||||||
|
|
||||||
|
from apps.admin_console.services.automation_store import AutomationStore, identifier
|
||||||
|
from apps.admin_console.database.repositories.session_repository import SessionRepository
|
||||||
|
from artemis.plugins.models import PluginManifest
|
||||||
|
from artemis.plugins.store import PluginStore
|
||||||
|
from apps.admin_console.services.task_import import case_title
|
||||||
|
|
||||||
|
TERMINAL = {"completed", "success", "failed", "cancelled", "interrupted", "skipped"}
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache(maxsize=1)
|
||||||
|
def plugin_store() -> PluginStore:
|
||||||
|
return PluginStore()
|
||||||
|
|
||||||
|
|
||||||
|
def active_manifests() -> list[PluginManifest]:
|
||||||
|
return [
|
||||||
|
PluginManifest.model_validate(plugin["manifest"])
|
||||||
|
for plugin in plugin_store().list()
|
||||||
|
if plugin["enabled"] and plugin["manifest"].get("workspace")
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def installation_signature() -> str:
|
||||||
|
manifests = [manifest.model_dump(mode="json") for manifest in active_manifests()]
|
||||||
|
return (
|
||||||
|
hashlib.sha256(json.dumps(manifests, sort_keys=True).encode()).hexdigest()
|
||||||
|
if manifests
|
||||||
|
else ""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def task_context(session_id: str, store: AutomationStore) -> dict:
|
||||||
|
identifier(session_id)
|
||||||
|
session = SessionRepository(store.path).get_session_by_id(session_id) or {}
|
||||||
|
job = store.job(session_id) or {}
|
||||||
|
if not session and not job:
|
||||||
|
raise ValueError("任务记录不存在")
|
||||||
|
case = job.get("case") or {}
|
||||||
|
navigation = None
|
||||||
|
if batch_id := job.get("batch_id"):
|
||||||
|
jobs = [item for item in store.jobs(batch_id) if item.get("status") in TERMINAL]
|
||||||
|
ids = [item["session_id"] for item in jobs]
|
||||||
|
index = ids.index(session_id) if session_id in ids else -1
|
||||||
|
navigation = {
|
||||||
|
"scope": "batch",
|
||||||
|
"position": index + 1,
|
||||||
|
"total": len(ids),
|
||||||
|
"previous": ids[index - 1] if index > 0 else None,
|
||||||
|
"next": ids[index + 1] if 0 <= index < len(ids) - 1 else None,
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
"session_id": session_id,
|
||||||
|
"initial_prompt": session.get("initial_goal") or (job.get("case") or {}).get("goal", ""),
|
||||||
|
"editable": (job.get("status") or session.get("status")) in TERMINAL,
|
||||||
|
"case_title": case_title(case),
|
||||||
|
"original_case": case.get("original_case"),
|
||||||
|
"navigation": navigation,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def contributions(session_id: str, store: AutomationStore) -> list[dict]:
|
||||||
|
record = store.get("task_extensions", session_id) or {}
|
||||||
|
result = []
|
||||||
|
for manifest in active_manifests():
|
||||||
|
assert manifest.workspace is not None
|
||||||
|
saved = record.get(manifest.id) or {}
|
||||||
|
values = saved.get("values", {})
|
||||||
|
result.append(
|
||||||
|
{
|
||||||
|
"plugin_id": manifest.id,
|
||||||
|
"name": manifest.name,
|
||||||
|
"version": manifest.version,
|
||||||
|
"workspace": manifest.workspace.model_dump(),
|
||||||
|
"revision": saved.get("revision", 0),
|
||||||
|
"values": {
|
||||||
|
field.id: values.get(field.id, "") for field in manifest.workspace.fields
|
||||||
|
},
|
||||||
|
"history": saved.get("history", []),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def report_sections(session_id: str, store: AutomationStore) -> list[dict]:
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
"plugin_id": item["plugin_id"],
|
||||||
|
"name": item["name"],
|
||||||
|
"version": item["version"],
|
||||||
|
"revision": item["revision"],
|
||||||
|
"fields": [
|
||||||
|
{"id": field["id"], "label": field["label"], "value": item["values"][field["id"]]}
|
||||||
|
for field in item["workspace"]["fields"]
|
||||||
|
if field["report"]
|
||||||
|
],
|
||||||
|
}
|
||||||
|
for item in contributions(session_id, store)
|
||||||
|
if any(field["report"] for field in item["workspace"]["fields"])
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def save_values(
|
||||||
|
store: AutomationStore,
|
||||||
|
session_id: str,
|
||||||
|
manifest: PluginManifest,
|
||||||
|
values: dict[str, str],
|
||||||
|
expected_revision: int,
|
||||||
|
request_id: str,
|
||||||
|
) -> None:
|
||||||
|
"""CAS + request receipts prevent lost edits and repeated history entries."""
|
||||||
|
identifier(session_id)
|
||||||
|
assert manifest.workspace is not None
|
||||||
|
fields = {field.id: field for field in manifest.workspace.fields}
|
||||||
|
if values.keys() - fields.keys():
|
||||||
|
raise ValueError("包含未声明的扩展字段")
|
||||||
|
for key, value in values.items():
|
||||||
|
field = fields[key]
|
||||||
|
if len(value) > field.max_length or (
|
||||||
|
field.kind == "choice" and value and value not in field.options
|
||||||
|
):
|
||||||
|
raise ValueError(f"字段 {field.label} 的内容不符合插件声明")
|
||||||
|
now = time.time()
|
||||||
|
with store.connection() as conn:
|
||||||
|
conn.execute("BEGIN IMMEDIATE")
|
||||||
|
row = conn.execute(
|
||||||
|
"SELECT payload FROM automation_records WHERE kind='task_extensions' AND id=?",
|
||||||
|
(session_id,),
|
||||||
|
).fetchone()
|
||||||
|
record = json.loads(row[0]) if row else {}
|
||||||
|
saved = record.get(manifest.id, {"revision": 0, "values": {}, "history": []})
|
||||||
|
for entry in saved["history"]:
|
||||||
|
if entry["request_id"] == request_id:
|
||||||
|
if entry["patch"] != values:
|
||||||
|
raise ValueError("同一保存请求不能提交不同内容")
|
||||||
|
return
|
||||||
|
if saved["revision"] != expected_revision:
|
||||||
|
raise ValueError("评审已在其他页面修改,请重新加载后保存")
|
||||||
|
updated = {**saved["values"], **values}
|
||||||
|
revision = saved["revision"] + 1
|
||||||
|
saved["history"].append(
|
||||||
|
{
|
||||||
|
"revision": revision,
|
||||||
|
"saved_at": now,
|
||||||
|
"request_id": request_id,
|
||||||
|
"patch": values,
|
||||||
|
"values": updated,
|
||||||
|
"plugin_version": manifest.version,
|
||||||
|
"fields": [field.model_dump() for field in manifest.workspace.fields],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
record[manifest.id] = {**saved, "revision": revision, "values": updated}
|
||||||
|
conn.execute(
|
||||||
|
"INSERT INTO automation_records VALUES ('task_extensions',?,?,?) "
|
||||||
|
"ON CONFLICT(kind,id) DO UPDATE SET payload=excluded.payload,updated_at=excluded.updated_at",
|
||||||
|
(session_id, json.dumps(record, ensure_ascii=False), now),
|
||||||
|
)
|
||||||
|
job = conn.execute(
|
||||||
|
"SELECT batch_id FROM automation_jobs WHERE session_id=?", (session_id,)
|
||||||
|
).fetchone()
|
||||||
|
if job and job[0]:
|
||||||
|
batch = conn.execute(
|
||||||
|
"SELECT payload FROM automation_records WHERE kind='batch' AND id=?", (job[0],)
|
||||||
|
).fetchone()
|
||||||
|
if not batch or json.loads(batch[0]).get("status") == "deleting":
|
||||||
|
raise ValueError("批次正在删除,不能保存评审")
|
||||||
|
payload = json.loads(batch[0])
|
||||||
|
payload["report_ready"] = False
|
||||||
|
conn.execute(
|
||||||
|
"UPDATE automation_records SET payload=?,updated_at=? WHERE kind='batch' AND id=?",
|
||||||
|
(json.dumps(payload, ensure_ascii=False), now, job[0]),
|
||||||
|
)
|
||||||
|
conn.commit()
|
||||||
@@ -21,6 +21,7 @@ HEADERS = (
|
|||||||
"Artemis提示词",
|
"Artemis提示词",
|
||||||
"任务配置(JSON)",
|
"任务配置(JSON)",
|
||||||
)
|
)
|
||||||
|
CASE_HEADERS = ("预置条件", "操作步骤", "预期结果")
|
||||||
MAX_ROWS = int(os.getenv("ARTEMIS_IMPORT_MAX_ROWS", "1000"))
|
MAX_ROWS = int(os.getenv("ARTEMIS_IMPORT_MAX_ROWS", "1000"))
|
||||||
MAX_BYTES = int(os.getenv("ARTEMIS_IMPORT_MAX_BYTES", "10485760"))
|
MAX_BYTES = int(os.getenv("ARTEMIS_IMPORT_MAX_BYTES", "10485760"))
|
||||||
|
|
||||||
@@ -61,6 +62,15 @@ class TaskOptions(BaseModel):
|
|||||||
return value.model_dump(exclude_unset=True)
|
return value.model_dump(exclude_unset=True)
|
||||||
|
|
||||||
|
|
||||||
|
class OriginalCase(BaseModel):
|
||||||
|
"""Imported review material, never appended to the execution prompt."""
|
||||||
|
|
||||||
|
model_config = ConfigDict(extra="forbid")
|
||||||
|
preconditions: str = Field(default="", max_length=10000)
|
||||||
|
steps: str = Field(default="", max_length=10000)
|
||||||
|
expected: str = Field(default="", max_length=10000)
|
||||||
|
|
||||||
|
|
||||||
class TaskCase(BaseModel):
|
class TaskCase(BaseModel):
|
||||||
model_config = ConfigDict(extra="forbid")
|
model_config = ConfigDict(extra="forbid")
|
||||||
case_id: str = Field(default="", max_length=200)
|
case_id: str = Field(default="", max_length=200)
|
||||||
@@ -70,16 +80,29 @@ class TaskCase(BaseModel):
|
|||||||
preconditions: str = Field(default="", max_length=10000)
|
preconditions: str = Field(default="", max_length=10000)
|
||||||
goal: str = Field(min_length=1, max_length=10000)
|
goal: str = Field(min_length=1, max_length=10000)
|
||||||
task_config: TaskOptions = Field(default_factory=TaskOptions)
|
task_config: TaskOptions = Field(default_factory=TaskOptions)
|
||||||
|
original_case: OriginalCase | None = None
|
||||||
|
|
||||||
|
|
||||||
|
def original_case_enabled() -> bool:
|
||||||
|
from apps.admin_console.services.task_extensions import active_manifests
|
||||||
|
|
||||||
|
return any(
|
||||||
|
panel.kind == "original_case"
|
||||||
|
for manifest in active_manifests()
|
||||||
|
if manifest.workspace is not None
|
||||||
|
for panel in manifest.workspace.panels
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def template() -> bytes:
|
def template() -> bytes:
|
||||||
|
headers = (*HEADERS, *CASE_HEADERS) if original_case_enabled() else HEADERS
|
||||||
wb = Workbook()
|
wb = Workbook()
|
||||||
ws = wb.active
|
ws = wb.active
|
||||||
assert ws is not None
|
assert ws is not None
|
||||||
ws.title = "任务"
|
ws.title = "任务"
|
||||||
ws.append(HEADERS)
|
ws.append(headers)
|
||||||
ws.freeze_panes = "A2"
|
ws.freeze_panes = "A2"
|
||||||
ws.auto_filter.ref = "A1:G1"
|
ws.auto_filter.ref = f"A1:{get_column_letter(len(headers))}1"
|
||||||
for cell in ws[1]:
|
for cell in ws[1]:
|
||||||
cell.font = Font(bold=True, color="FFFFFF")
|
cell.font = Font(bold=True, color="FFFFFF")
|
||||||
cell.fill = PatternFill("solid", fgColor="245C78")
|
cell.fill = PatternFill("solid", fgColor="245C78")
|
||||||
@@ -93,7 +116,7 @@ def template() -> bytes:
|
|||||||
help_sheet.append(["前置约束提取及其他描述列仅作查看、搜索和报告元数据,不追加到提示词。"])
|
help_sheet.append(["前置约束提取及其他描述列仅作查看、搜索和报告元数据,不追加到提示词。"])
|
||||||
help_sheet.append(["任务配置(JSON)可留空,空字段继承批次或全局配置;禁止密钥与未知字段。"])
|
help_sheet.append(["任务配置(JSON)可留空,空字段继承批次或全局配置;禁止密钥与未知字段。"])
|
||||||
help_sheet.append(["示例仅供参考,不会导入执行。请在“任务”页填写自己的用例。"])
|
help_sheet.append(["示例仅供参考,不会导入执行。请在“任务”页填写自己的用例。"])
|
||||||
help_sheet.append(HEADERS)
|
help_sheet.append(headers)
|
||||||
help_sheet.append(
|
help_sheet.append(
|
||||||
[
|
[
|
||||||
"示例-001",
|
"示例-001",
|
||||||
@@ -130,7 +153,18 @@ def template() -> bytes:
|
|||||||
json.dumps({"profile": "flash", "execution_target": "computer"}, ensure_ascii=False),
|
json.dumps({"profile": "flash", "execution_target": "computer"}, ensure_ascii=False),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
for column in range(1, 8):
|
if len(headers) > len(HEADERS):
|
||||||
|
help_sheet.append(
|
||||||
|
[
|
||||||
|
"人工评审插件附加列:预置条件、操作步骤、预期结果。仅保存原始用例,均不追加到 AI 提示词。"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
for row_number in (6, 7):
|
||||||
|
for column, value in enumerate(
|
||||||
|
("填写原始用例的预置条件", "填写原始用例的操作步骤", "填写原始用例的预期结果"), 8
|
||||||
|
):
|
||||||
|
help_sheet.cell(row_number, column, value)
|
||||||
|
for column in range(1, len(headers) + 1):
|
||||||
help_sheet.column_dimensions[get_column_letter(column)].width = 70 if column > 5 else 26
|
help_sheet.column_dimensions[get_column_letter(column)].width = 70 if column > 5 else 26
|
||||||
for row in help_sheet:
|
for row in help_sheet:
|
||||||
for cell in row:
|
for cell in row:
|
||||||
@@ -164,7 +198,10 @@ def parse_workbook(data: bytes) -> dict:
|
|||||||
raise ValueError("缺少“任务”工作表,请使用下载的模板")
|
raise ValueError("缺少“任务”工作表,请使用下载的模板")
|
||||||
rows = iter(wb["任务"].iter_rows())
|
rows = iter(wb["任务"].iter_rows())
|
||||||
headers = [str(cell.value or "").strip() for cell in next(rows, [])]
|
headers = [str(cell.value or "").strip() for cell in next(rows, [])]
|
||||||
if headers != list(HEADERS):
|
supported_headers = [list(HEADERS)]
|
||||||
|
if original_case_enabled():
|
||||||
|
supported_headers.append([*HEADERS, *CASE_HEADERS])
|
||||||
|
if headers not in supported_headers:
|
||||||
raise ValueError("列名或顺序与新版模板不一致,请重新下载模板")
|
raise ValueError("列名或顺序与新版模板不一致,请重新下载模板")
|
||||||
tasks, errors = [], []
|
tasks, errors = [], []
|
||||||
for number, row in enumerate(rows, 2):
|
for number, row in enumerate(rows, 2):
|
||||||
@@ -190,9 +227,29 @@ def parse_workbook(data: bytes) -> dict:
|
|||||||
"preconditions": values[4],
|
"preconditions": values[4],
|
||||||
"goal": values[5],
|
"goal": values[5],
|
||||||
"task_config": config,
|
"task_config": config,
|
||||||
|
"original_case": (
|
||||||
|
dict(
|
||||||
|
zip(
|
||||||
|
("preconditions", "steps", "expected"),
|
||||||
|
(
|
||||||
|
str(cell.value if cell.value is not None else "").strip()
|
||||||
|
for cell in row[7:10]
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if len(headers) == 10
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
tasks.append(
|
||||||
|
{
|
||||||
|
"row": number,
|
||||||
|
**case.model_dump(
|
||||||
|
exclude={"original_case"} if case.original_case is None else None
|
||||||
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
tasks.append({"row": number, **case.model_dump()})
|
|
||||||
except (ValueError, TypeError) as exc:
|
except (ValueError, TypeError) as exc:
|
||||||
errors.append({"row": number, "message": str(exc)[:500]})
|
errors.append({"row": number, "message": str(exc)[:500]})
|
||||||
if not tasks and not errors:
|
if not tasks and not errors:
|
||||||
|
|||||||
@@ -1522,8 +1522,10 @@ class TaskQueueService:
|
|||||||
from artemis.plugins.store import PluginStore
|
from artemis.plugins.store import PluginStore
|
||||||
|
|
||||||
for batch in store.records("batch"):
|
for batch in store.records("batch"):
|
||||||
if batch["status"] == "running":
|
if batch["status"] in {"running", "paused"}:
|
||||||
batch.update(status="paused", reason="已停止全部任务,等待手动继续")
|
batch.update(
|
||||||
|
status="paused", reason="已停止全部任务,等待手动继续", pause_source="user"
|
||||||
|
)
|
||||||
store.put("batch", batch["id"], batch)
|
store.put("batch", batch["id"], batch)
|
||||||
# 1. Cancel local queue reservations
|
# 1. Cancel local queue reservations
|
||||||
for item in state.queue_items:
|
for item in state.queue_items:
|
||||||
|
|||||||
Generated
+1858
-2313
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "artemis-showcase-ui",
|
"name": "artemis-showcase-ui",
|
||||||
"version": "2.2.0",
|
"version": "2.4.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve --proxy-config proxy.conf.json",
|
"start": "ng serve --proxy-config proxy.conf.json",
|
||||||
@@ -9,24 +9,29 @@
|
|||||||
"test": "ng test"
|
"test": "ng test"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"overrides": {
|
||||||
|
"@angular/build": {
|
||||||
|
"vite": "8.3.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/cdk": "^22.1.5",
|
"@angular/cdk": "^22.2.4",
|
||||||
"@angular/common": "^22.1.4",
|
"@angular/common": "^22.2.3",
|
||||||
"@angular/compiler": "^22.1.4",
|
"@angular/compiler": "^22.2.3",
|
||||||
"@angular/core": "^22.1.4",
|
"@angular/core": "^22.2.3",
|
||||||
"@angular/forms": "^22.1.4",
|
"@angular/forms": "^22.2.3",
|
||||||
"@angular/platform-browser": "^22.1.4",
|
"@angular/platform-browser": "^22.2.3",
|
||||||
"@angular/platform-browser-dynamic": "^22.1.4",
|
"@angular/platform-browser-dynamic": "^22.2.3",
|
||||||
"@angular/router": "^22.1.4",
|
"@angular/router": "^22.2.3",
|
||||||
"marked": "18.1.1",
|
"marked": "18.1.1",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"zone.js": "~0.15.0"
|
"zone.js": "~0.15.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/build": "^22.1.6",
|
"@angular/build": "^22.2.4",
|
||||||
"@angular/cli": "^22.1.6",
|
"@angular/cli": "^22.2.4",
|
||||||
"@angular/compiler-cli": "^22.1.4",
|
"@angular/compiler-cli": "^22.2.3",
|
||||||
"@types/jasmine": "~5.1.0",
|
"@types/jasmine": "~5.1.0",
|
||||||
"istanbul-lib-instrument": "^6.0.3",
|
"istanbul-lib-instrument": "^6.0.3",
|
||||||
"jasmine-core": "~5.6.0",
|
"jasmine-core": "~5.6.0",
|
||||||
|
|||||||
@@ -695,13 +695,13 @@ limitations under the License.
|
|||||||
@if (getActionTargetText(item.data)) {
|
@if (getActionTargetText(item.data)) {
|
||||||
<div class="action-detail-row">
|
<div class="action-detail-row">
|
||||||
<span class="detail-label">目标:</span>
|
<span class="detail-label">目标:</span>
|
||||||
<span class="detail-value">"{{ getActionTargetText(item.data) }}"</span>
|
<app-expandable-value class="detail-value" label="目标" [value]="getActionTargetText(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getActionInputText(item.data)) {
|
@if (getActionInputText(item.data)) {
|
||||||
<div class="action-detail-row">
|
<div class="action-detail-row">
|
||||||
<span class="detail-label">{{ getActionInputLabel(item.data) }}:</span>
|
<span class="detail-label">{{ getActionInputLabel(item.data) }}:</span>
|
||||||
<span class="detail-value">"{{ getActionInputText(item.data) }}"</span>
|
<app-expandable-value class="detail-value" label="输入" [value]="getActionInputText(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getActionCoords(item.data)) {
|
@if (getActionCoords(item.data)) {
|
||||||
@@ -719,13 +719,13 @@ limitations under the License.
|
|||||||
@if (getActionTargetText(item.data)) {
|
@if (getActionTargetText(item.data)) {
|
||||||
<div class="grid-item">
|
<div class="grid-item">
|
||||||
<span class="grid-label">目标</span>
|
<span class="grid-label">目标</span>
|
||||||
<span class="grid-value">"{{ getActionTargetText(item.data) }}"</span>
|
<app-expandable-value label="目标" [value]="getActionTargetText(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getActionInputText(item.data)) {
|
@if (getActionInputText(item.data)) {
|
||||||
<div class="grid-item">
|
<div class="grid-item">
|
||||||
<span class="grid-label">{{ getActionInputLabel(item.data) }}</span>
|
<span class="grid-label">{{ getActionInputLabel(item.data) }}</span>
|
||||||
<span class="grid-value">"{{ getActionInputText(item.data) }}"</span>
|
<app-expandable-value label="输入" [value]="getActionInputText(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getActionCoords(item.data)) {
|
@if (getActionCoords(item.data)) {
|
||||||
@@ -749,19 +749,7 @@ limitations under the License.
|
|||||||
@for (param of getActionExtraParams(item.data); track trackParam($index, param)) {
|
@for (param of getActionExtraParams(item.data); track trackParam($index, param)) {
|
||||||
<div class="grid-item" [class.full-width]="param.key === 'Result'">
|
<div class="grid-item" [class.full-width]="param.key === 'Result'">
|
||||||
<span class="grid-label">{{ param.key }}</span>
|
<span class="grid-label">{{ param.key }}</span>
|
||||||
@if (param.key === 'Result') {
|
<app-expandable-value [label]="param.key" [value]="param.value" />
|
||||||
<div class="action-result-preview">{{ param.value | slice:0:180 }}{{ param.value.length > 180 ? '…' : '' }}</div>
|
|
||||||
<details class="action-result-detail">
|
|
||||||
<summary>
|
|
||||||
<span class="result-expand-label">展开完整结果</span>
|
|
||||||
<span class="result-collapse-label">收起结果</span>
|
|
||||||
<span class="result-length">{{ param.value.length }} 字符</span>
|
|
||||||
</summary>
|
|
||||||
<pre tabindex="0" aria-label="完整操作结果,可选择复制">{{ param.value }}</pre>
|
|
||||||
</details>
|
|
||||||
} @else {
|
|
||||||
<span class="grid-value code-pill">{{ param.value }}</span>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<!-- Fallback item if all detail fields are empty -->
|
<!-- Fallback item if all detail fields are empty -->
|
||||||
@@ -1008,7 +996,7 @@ limitations under the License.
|
|||||||
@if (getAdbCommandLine(item.data)) {
|
@if (getAdbCommandLine(item.data)) {
|
||||||
<div class="action-detail-row">
|
<div class="action-detail-row">
|
||||||
<span class="detail-label">命令:</span>
|
<span class="detail-label">命令:</span>
|
||||||
<span class="detail-value command-value"><code>{{ getAdbCommandLine(item.data) }}</code></span>
|
<app-expandable-value class="detail-value" label="命令" [value]="getAdbCommandLine(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getAdbCwd(item.data)) {
|
@if (getAdbCwd(item.data)) {
|
||||||
@@ -1029,13 +1017,13 @@ limitations under the License.
|
|||||||
@if (getToolTargetText(item.data)) {
|
@if (getToolTargetText(item.data)) {
|
||||||
<div class="action-detail-row">
|
<div class="action-detail-row">
|
||||||
<span class="detail-label">目标:</span>
|
<span class="detail-label">目标:</span>
|
||||||
<span class="detail-value">"{{ getToolTargetText(item.data) }}"</span>
|
<app-expandable-value class="detail-value" label="目标" [value]="getToolTargetText(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getToolInputText(item.data)) {
|
@if (getToolInputText(item.data)) {
|
||||||
<div class="action-detail-row">
|
<div class="action-detail-row">
|
||||||
<span class="detail-label">{{ getToolInputLabel(item.data) }}:</span>
|
<span class="detail-label">{{ getToolInputLabel(item.data) }}:</span>
|
||||||
<span class="detail-value">"{{ getToolInputText(item.data) }}"</span>
|
<app-expandable-value class="detail-value" label="输入" [value]="getToolInputText(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getToolCoords(item.data)) {
|
@if (getToolCoords(item.data)) {
|
||||||
@@ -1047,13 +1035,13 @@ limitations under the License.
|
|||||||
@if (getToolAnalysisText(item.data)) {
|
@if (getToolAnalysisText(item.data)) {
|
||||||
<div class="action-detail-row">
|
<div class="action-detail-row">
|
||||||
<span class="detail-label">分析:</span>
|
<span class="detail-label">分析:</span>
|
||||||
<span class="detail-value">"{{ getToolAnalysisText(item.data) }}"</span>
|
<app-expandable-value class="detail-value" label="分析" [value]="getToolAnalysisText(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getToolGenericDetails(item.data)) {
|
@if (getToolGenericDetails(item.data)) {
|
||||||
<div class="action-detail-row">
|
<div class="action-detail-row">
|
||||||
<span class="detail-label">详情:</span>
|
<span class="detail-label">详情:</span>
|
||||||
<span class="detail-value">"{{ getToolGenericDetails(item.data) }}"</span>
|
<app-expandable-value class="detail-value" label="详情" [value]="getToolGenericDetails(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1067,7 +1055,7 @@ limitations under the License.
|
|||||||
@if (getAdbCommandLine(item.data)) {
|
@if (getAdbCommandLine(item.data)) {
|
||||||
<div class="grid-item full-width">
|
<div class="grid-item full-width">
|
||||||
<span class="grid-label">命令</span>
|
<span class="grid-label">命令</span>
|
||||||
<span class="grid-value command-value"><code>{{ getAdbCommandLine(item.data) }}</code></span>
|
<app-expandable-value label="命令" [value]="getAdbCommandLine(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getAdbCwd(item.data)) {
|
@if (getAdbCwd(item.data)) {
|
||||||
@@ -1087,7 +1075,7 @@ limitations under the License.
|
|||||||
@for (param of plugin.args; track param.key) {
|
@for (param of plugin.args; track param.key) {
|
||||||
<div class="grid-item">
|
<div class="grid-item">
|
||||||
<span class="grid-label">{{ param.key }}</span>
|
<span class="grid-label">{{ param.key }}</span>
|
||||||
<span class="grid-value code-pill">{{ param.value }}</span>
|
<app-expandable-value [label]="param.key" [value]="param.value" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (plugin.result || plugin.rawResult || plugin.facts.length) {
|
@if (plugin.result || plugin.rawResult || plugin.facts.length) {
|
||||||
@@ -1101,13 +1089,13 @@ limitations under the License.
|
|||||||
@if (getToolTargetText(item.data)) {
|
@if (getToolTargetText(item.data)) {
|
||||||
<div class="grid-item">
|
<div class="grid-item">
|
||||||
<span class="grid-label">目标</span>
|
<span class="grid-label">目标</span>
|
||||||
<span class="grid-value">"{{ getToolTargetText(item.data) }}"</span>
|
<app-expandable-value label="目标" [value]="getToolTargetText(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getToolInputText(item.data)) {
|
@if (getToolInputText(item.data)) {
|
||||||
<div class="grid-item">
|
<div class="grid-item">
|
||||||
<span class="grid-label">{{ getToolInputLabel(item.data) }}</span>
|
<span class="grid-label">{{ getToolInputLabel(item.data) }}</span>
|
||||||
<span class="grid-value">"{{ getToolInputText(item.data) }}"</span>
|
<app-expandable-value label="输入" [value]="getToolInputText(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getToolCoords(item.data)) {
|
@if (getToolCoords(item.data)) {
|
||||||
@@ -1119,19 +1107,19 @@ limitations under the License.
|
|||||||
@if (getToolAnalysisText(item.data)) {
|
@if (getToolAnalysisText(item.data)) {
|
||||||
<div class="grid-item">
|
<div class="grid-item">
|
||||||
<span class="grid-label">分析</span>
|
<span class="grid-label">分析</span>
|
||||||
<span class="grid-value">"{{ getToolAnalysisText(item.data) }}"</span>
|
<app-expandable-value label="分析" [value]="getToolAnalysisText(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (getToolGenericDetails(item.data)) {
|
@if (getToolGenericDetails(item.data)) {
|
||||||
<div class="grid-item">
|
<div class="grid-item">
|
||||||
<span class="grid-label">详情</span>
|
<span class="grid-label">详情</span>
|
||||||
<span class="grid-value">"{{ getToolGenericDetails(item.data) }}"</span>
|
<app-expandable-value label="详情" [value]="getToolGenericDetails(item.data)" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@for (param of getToolExtraParams(item.data); track trackParam($index, param)) {
|
@for (param of getToolExtraParams(item.data); track trackParam($index, param)) {
|
||||||
<div class="grid-item">
|
<div class="grid-item">
|
||||||
<span class="grid-label">{{ param.key }}</span>
|
<span class="grid-label">{{ param.key }}</span>
|
||||||
<span class="grid-value code-pill">{{ param.value }}</span>
|
<app-expandable-value [label]="param.key" [value]="param.value" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { LlmRequestStatusComponent } from '../llm-request-status/llm-request-sta
|
|||||||
import { TaskLifecycleComponent } from '../task-lifecycle/task-lifecycle.component';
|
import { TaskLifecycleComponent } from '../task-lifecycle/task-lifecycle.component';
|
||||||
import { ReportMarkdownComponent } from '../report-markdown/report-markdown.component';
|
import { ReportMarkdownComponent } from '../report-markdown/report-markdown.component';
|
||||||
import { PluginToolResultComponent } from '../plugin-tool-result/plugin-tool-result.component';
|
import { PluginToolResultComponent } from '../plugin-tool-result/plugin-tool-result.component';
|
||||||
|
import { ExpandableValueComponent } from '../expandable-value/expandable-value.component';
|
||||||
import { AutomationPanelComponent } from '../automation-panel/automation-panel.component';
|
import { AutomationPanelComponent } from '../automation-panel/automation-panel.component';
|
||||||
import { UiLabelPipe } from '../../utils/ui-label.pipe';
|
import { UiLabelPipe } from '../../utils/ui-label.pipe';
|
||||||
/**
|
/**
|
||||||
@@ -250,7 +251,7 @@ export type { MarkdownSegment, MarkdownLine, NoteMilestone, ParsedNote, StreamRe
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-agent-stream',
|
selector: 'app-agent-stream',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [PluginToolResultComponent, ReportMarkdownComponent, LlmRequestStatusComponent, TaskLifecycleComponent, TaskIdCopyComponent, UiLabelPipe, CommonModule, FormsModule, OverlayModule, TaskHistoryComponent, AutomationPanelComponent, TestResultBadgeComponent, TestResultCardComponent, TaskBatchFilterComponent],
|
imports: [ExpandableValueComponent, PluginToolResultComponent, ReportMarkdownComponent, LlmRequestStatusComponent, TaskLifecycleComponent, TaskIdCopyComponent, UiLabelPipe, CommonModule, FormsModule, OverlayModule, TaskHistoryComponent, AutomationPanelComponent, TestResultBadgeComponent, TestResultCardComponent, TaskBatchFilterComponent],
|
||||||
templateUrl: './agent-stream.component.html',
|
templateUrl: './agent-stream.component.html',
|
||||||
styleUrl: './agent-stream.component.scss',
|
styleUrl: './agent-stream.component.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
|
|||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
import { ExpandableValueComponent } from './expandable-value.component';
|
||||||
|
|
||||||
|
describe('执行字段折叠', () => {
|
||||||
|
for (const [label, value] of [['Payload', '{"x":1}'], ['输入', '完整内容'.repeat(100)], ['输出', '行\n'.repeat(6)]]) {
|
||||||
|
it(`默认折叠 ${label} 并保留完整内容`, () => {
|
||||||
|
const fixture = TestBed.createComponent(ExpandableValueComponent);
|
||||||
|
fixture.componentRef.setInput('label', label);
|
||||||
|
fixture.componentRef.setInput('value', value);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const details: HTMLDetailsElement = fixture.nativeElement.querySelector('details');
|
||||||
|
expect(details.open).toBeFalse();
|
||||||
|
details.querySelector('summary')!.click();
|
||||||
|
expect(details.open).toBeTrue();
|
||||||
|
expect(details.querySelector('pre')!.textContent).toBe(value);
|
||||||
|
fixture.detectChanges();
|
||||||
|
expect(details.open).toBeTrue();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
it('直接显示普通短字段', () => {
|
||||||
|
const fixture = TestBed.createComponent(ExpandableValueComponent);
|
||||||
|
fixture.componentRef.setInput('value', '点击设置'); fixture.detectChanges();
|
||||||
|
expect(fixture.nativeElement.querySelector('details')).toBeNull();
|
||||||
|
expect(fixture.nativeElement.textContent).toContain('点击设置');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
||||||
|
|
||||||
|
/** Visual folding only: the full receipt remains selectable and unchanged. */
|
||||||
|
@Component({
|
||||||
|
selector: 'app-expandable-value', standalone: true,
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
|
template: `
|
||||||
|
@if (foldable()) {
|
||||||
|
<details>
|
||||||
|
<summary><span>{{ label() }} · {{ value().length }} 字符</span><span class="hint">展开查看</span></summary>
|
||||||
|
<pre tabindex="0" [attr.aria-label]="label() + '完整内容,可选择复制'">{{ value() }}</pre>
|
||||||
|
</details>
|
||||||
|
} @else { <span class="short-value">{{ value() }}</span> }
|
||||||
|
`,
|
||||||
|
styles: [`
|
||||||
|
:host { display:block; min-width:0; max-width:100%; }
|
||||||
|
details { border:1px solid var(--app-border, #e2e8f0); border-radius:8px; background:var(--app-surface-soft, #f8fafc); }
|
||||||
|
summary { cursor:pointer; padding:7px 10px; font-size:12px; color:var(--app-text-secondary, #475569); overflow-wrap:anywhere; }
|
||||||
|
.hint { margin-left:8px; color:var(--app-primary-text, #1a73e8); }
|
||||||
|
details[open] .hint { display:none; }
|
||||||
|
pre { margin:0; padding:10px; max-height:24rem; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; user-select:text; }
|
||||||
|
.short-value { white-space:pre-wrap; overflow-wrap:anywhere; }
|
||||||
|
summary:focus-visible, pre:focus-visible { outline:2px solid var(--app-focus, #a5b4fc); outline-offset:2px; }
|
||||||
|
`]
|
||||||
|
})
|
||||||
|
export class ExpandableValueComponent {
|
||||||
|
value = input('');
|
||||||
|
label = input('详情');
|
||||||
|
foldable = computed(() => /payload|原始|^result$/i.test(this.label())
|
||||||
|
|| this.value().length > 240 || this.value().split('\n').length > 4);
|
||||||
|
}
|
||||||
+1
-1
@@ -9,7 +9,7 @@ import { AgentStreamComponent } from '../agent-stream/agent-stream.component';
|
|||||||
@Component({selector:'app-agent-stream',standalone:true,template:'<ng-content></ng-content>'}) class StreamStub {conversationMessages=input<any[]>([]);demonstrations=input<any[]>([]);pendingQuestion=input('');useRecommendation=output<string>();}
|
@Component({selector:'app-agent-stream',standalone:true,template:'<ng-content></ng-content>'}) class StreamStub {conversationMessages=input<any[]>([]);demonstrations=input<any[]>([]);pendingQuestion=input('');useRecommendation=output<string>();}
|
||||||
|
|
||||||
describe('Exploration conversation', () => {
|
describe('Exploration conversation', () => {
|
||||||
const config = {model: 'gpt-6.1-sol', reasoning_effort: 'high', timeout_seconds: 1800, demonstration_timeout_seconds: 900, demonstration_warning_seconds: 60};
|
const config = {model: 'gpt-6.1-terra', reasoning_effort: 'high', timeout_seconds: 1800, demonstration_timeout_seconds: 900, demonstration_warning_seconds: 60};
|
||||||
let current: ExplorationSession;
|
let current: ExplorationSession;
|
||||||
let api: any;
|
let api: any;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ export class ExplorationPanelComponent {
|
|||||||
private followsLatest = true;
|
private followsLatest = true;
|
||||||
private requests = this.api.requests;
|
private requests = this.api.requests;
|
||||||
private displayedId: string | null = null;
|
private displayedId: string | null = null;
|
||||||
readonly models = ['gpt-6.1-sol', 'gpt-6-astra', 'gpt-6-luna', 'mimo-v2.6-pro', 'mimo-v2.6-flash'];
|
readonly models = ['gpt-6.1-terra', 'gpt-6.1-sol', 'gpt-6-astra', 'gpt-6-luna', 'mimo-v2.6-pro', 'mimo-v2.6-flash'];
|
||||||
readonly efforts = ['default', 'none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
readonly efforts = ['default', 'none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ describe('Featured tasks',()=>{
|
|||||||
expect(fixture.nativeElement.textContent).not.toContain('旧任务部分配置缺失');
|
expect(fixture.nativeElement.textContent).not.toContain('旧任务部分配置缺失');
|
||||||
fixture.nativeElement.querySelector('.configure').click();fixture.detectChanges();flushMicrotasks();
|
fixture.nativeElement.querySelector('.configure').click();fixture.detectChanges();flushMicrotasks();
|
||||||
const select:HTMLSelectElement=fixture.nativeElement.querySelector('app-model-selector select');
|
const select:HTMLSelectElement=fixture.nativeElement.querySelector('app-model-selector select');
|
||||||
expect(Array.from(select.options,option=>option.value)).toEqual(['gpt-6-luna','gpt-6.1-sol','gpt-6-astra','mimo-v2.6-pro','__custom__']);
|
expect(Array.from(select.options,option=>option.value)).toEqual(['gpt-6-luna','gpt-6.1-terra', 'gpt-6.1-sol','gpt-6-astra','mimo-v2.6-pro','__custom__']);
|
||||||
expect(select.value).toBe('__custom__');
|
expect(select.value).toBe('__custom__');
|
||||||
expect(fixture.nativeElement.querySelector('input[aria-label="复跑模型(自定义)"]').value).toBe('original-model');
|
expect(fixture.nativeElement.querySelector('input[aria-label="复跑模型(自定义)"]').value).toBe('original-model');
|
||||||
select.value='gpt-6-luna';select.dispatchEvent(new Event('change'));fixture.detectChanges();
|
select.value='gpt-6-luna';select.dispatchEvent(new Event('change'));fixture.detectChanges();
|
||||||
|
|||||||
+10
-1
@@ -27,7 +27,9 @@ limitations under the License.
|
|||||||
class="floating-video-wrapper"
|
class="floating-video-wrapper"
|
||||||
[class.minimized]="agentService.isVideoMinimized()"
|
[class.minimized]="agentService.isVideoMinimized()"
|
||||||
[class.theater]="isTheaterMode()"
|
[class.theater]="isTheaterMode()"
|
||||||
[style.left.px]="!isTheaterMode() ? posX() : null"
|
[style.--extension-width]="extensionWidth() + 'px'"
|
||||||
|
[style.left.px]="!isTheaterMode() ? windowLeft() : null"
|
||||||
|
[style.width.px]="isTheaterMode() || agentService.isVideoMinimized() ? null : 400 + extensionWidth()"
|
||||||
[style.top.px]="!isTheaterMode() ? posY() : null"
|
[style.top.px]="!isTheaterMode() ? posY() : null"
|
||||||
[style.--player-top]="posY() + 'px'"
|
[style.--player-top]="posY() + 'px'"
|
||||||
>
|
>
|
||||||
@@ -42,6 +44,9 @@ limitations under the License.
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-actions" (mousedown)="$event.stopPropagation()">
|
<div class="header-actions" (mousedown)="$event.stopPropagation()">
|
||||||
|
@if (extensionPanels(); as panels) {
|
||||||
|
<ng-container [ngTemplateOutlet]="panels.headerControls() || null" />
|
||||||
|
}
|
||||||
<!-- Mode Toggle Group: Video vs. Step Replay -->
|
<!-- Mode Toggle Group: Video vs. Step Replay -->
|
||||||
@if (agentService.recordingPlaybackStatus() === 'ready' && agentService.hasCurrentSessionStepFrames() && !agentService.isVideoMinimized()) {
|
@if (agentService.recordingPlaybackStatus() === 'ready' && agentService.hasCurrentSessionStepFrames() && !agentService.isVideoMinimized()) {
|
||||||
<div class="mode-toggle-group">
|
<div class="mode-toggle-group">
|
||||||
@@ -117,6 +122,9 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
<!-- Video Main Content Area -->
|
<!-- Video Main Content Area -->
|
||||||
@if (!agentService.isVideoMinimized()) {
|
@if (!agentService.isVideoMinimized()) {
|
||||||
|
<app-task-extension-panels [sessionId]="agentService.currentSessionId()" [enabled]="true"
|
||||||
|
[sessionIds]="reviewSessionIds()" (navigate)="agentService.selectSession($event, true)"
|
||||||
|
[taskStatus]="agentService.currentSession()?.status || ''" (expandedWidth)="extensionWidth.set($event)">
|
||||||
<div class="video-body">
|
<div class="video-body">
|
||||||
<!-- 1. LIVE SCREEN STREAM (AUTOMATICALLY ACTIVE DURING RUNNING TEST) -->
|
<!-- 1. LIVE SCREEN STREAM (AUTOMATICALLY ACTIVE DURING RUNNING TEST) -->
|
||||||
@if (agentService.recordingPlaybackStatus() === 'live') {
|
@if (agentService.recordingPlaybackStatus() === 'live') {
|
||||||
@@ -488,6 +496,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</app-task-extension-panels>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
+8
-2
@@ -28,6 +28,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.floating-video-wrapper {
|
.floating-video-wrapper {
|
||||||
|
container-type: inline-size;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
max-width: calc(100vw - 32px);
|
max-width: calc(100vw - 32px);
|
||||||
@@ -60,8 +61,8 @@
|
|||||||
left: 50% !important;
|
left: 50% !important;
|
||||||
top: 50% !important;
|
top: 50% !important;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
width: 85vw;
|
width: min(calc(85vw + var(--extension-width, 0px)), calc(100vw - 32px));
|
||||||
max-width: 960px;
|
max-width: calc(960px + var(--extension-width, 0px));
|
||||||
height: auto;
|
height: auto;
|
||||||
max-height: 88vh;
|
max-height: 88vh;
|
||||||
box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.35);
|
box-shadow: 0 24px 60px -12px rgba(15, 23, 42, 0.35);
|
||||||
@@ -805,16 +806,21 @@
|
|||||||
|
|
||||||
.controls-row {
|
.controls-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
.controls-left, .controls-right {
|
.controls-left, .controls-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
white-space: nowrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ctrl-btn {
|
.ctrl-btn {
|
||||||
|
flex-shrink: 0;
|
||||||
background: rgb(var(--app-surface-soft-rgb, 241 245 249) / 0.75);
|
background: rgb(var(--app-surface-soft-rgb, 241 245 249) / 0.75);
|
||||||
backdrop-filter: blur(12px);
|
backdrop-filter: blur(12px);
|
||||||
-webkit-backdrop-filter: blur(12px);
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
|||||||
+25
-1
@@ -1,3 +1,5 @@
|
|||||||
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
|
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { signal } from '@angular/core';
|
import { signal } from '@angular/core';
|
||||||
import { AgentService, RecordingSource, VideoSegment } from '../../services/agent.service';
|
import { AgentService, RecordingSource, VideoSegment } from '../../services/agent.service';
|
||||||
@@ -39,6 +41,8 @@ describe('FloatingVideoPlayerComponent video markers', () => {
|
|||||||
currentSessionStepFrames: signal([frame]),
|
currentSessionStepFrames: signal([frame]),
|
||||||
currentSession: signal({ session_id: 'test', start_time: start }),
|
currentSession: signal({ session_id: 'test', start_time: start }),
|
||||||
currentSessionId: signal('test'),
|
currentSessionId: signal('test'),
|
||||||
|
sessions: signal([{ session_id: 'test', status: 'completed' }]),
|
||||||
|
selectSession: jasmine.createSpy('selectSession'),
|
||||||
videoSeekRequest: signal<{ seconds: number; requestId: number; sourceId?: string } | null>(null),
|
videoSeekRequest: signal<{ seconds: number; requestId: number; sourceId?: string } | null>(null),
|
||||||
stepSeekRequest: signal(null),
|
stepSeekRequest: signal(null),
|
||||||
consumeVideoAutoplay: jasmine.createSpy('consumeVideoAutoplay').and.returnValue(false)
|
consumeVideoAutoplay: jasmine.createSpy('consumeVideoAutoplay').and.returnValue(false)
|
||||||
@@ -59,11 +63,14 @@ describe('FloatingVideoPlayerComponent video markers', () => {
|
|||||||
agentService = createAgentService();
|
agentService = createAgentService();
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [FloatingVideoPlayerComponent],
|
imports: [FloatingVideoPlayerComponent],
|
||||||
providers: [{ provide: AgentService, useValue: agentService }]
|
providers: [provideHttpClient(), provideHttpClientTesting(), { provide: AgentService, useValue: agentService }]
|
||||||
});
|
});
|
||||||
|
|
||||||
fixture = TestBed.createComponent(FloatingVideoPlayerComponent);
|
fixture = TestBed.createComponent(FloatingVideoPlayerComponent);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
TestBed.inject(HttpTestingController).expectOne('/api/task-extensions/test').flush({
|
||||||
|
session_id: 'test', initial_prompt: '', editable: true, plugins: []
|
||||||
|
});
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
video = component.videoRef!.nativeElement;
|
video = component.videoRef!.nativeElement;
|
||||||
paused = true;
|
paused = true;
|
||||||
@@ -98,6 +105,23 @@ describe('FloatingVideoPlayerComponent video markers', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const mode of ['video', 'steps']) {
|
||||||
|
it(`shows review controls in ${mode} mode even without a recording`, () => {
|
||||||
|
agentService.playerMode.set(mode);
|
||||||
|
agentService.recordingPlaybackStatus.set('unavailable');
|
||||||
|
component.extensionPanels()!.refresh(); fixture.detectChanges();
|
||||||
|
TestBed.inject(HttpTestingController).expectOne('/api/task-extensions/test').flush({
|
||||||
|
session_id: 'test', initial_prompt: '', editable: true, plugins: [{
|
||||||
|
plugin_id: 'review', name: '原始用例', version: '1.1.0', revision: 0, values: {}, history: [],
|
||||||
|
workspace: { fields: [], panels: [{ id: 'case', title: '原始用例', side: 'left', kind: 'original_case', width: {minimum: 240, preferred: 340, maximum: 480} }] }
|
||||||
|
}]
|
||||||
|
}); fixture.detectChanges();
|
||||||
|
const button: HTMLButtonElement = fixture.nativeElement.querySelector('button[aria-label="展开原始用例"]');
|
||||||
|
expect(button).not.toBeNull(); button.click(); fixture.detectChanges();
|
||||||
|
expect(fixture.nativeElement.querySelector('aside').textContent).toContain('未记录原始用例');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
it('removes the live image while hidden and reconnects it on return', () => {
|
it('removes the live image while hidden and reconnects it on return', () => {
|
||||||
const hidden = spyOnProperty(document, 'hidden', 'get').and.returnValue(false);
|
const hidden = spyOnProperty(document, 'hidden', 'get').and.returnValue(false);
|
||||||
agentService.recordingPlaybackStatus.set('live');
|
agentService.recordingPlaybackStatus.set('live');
|
||||||
|
|||||||
+15
-3
@@ -26,10 +26,13 @@ import {
|
|||||||
HostListener,
|
HostListener,
|
||||||
effect,
|
effect,
|
||||||
untracked,
|
untracked,
|
||||||
OnDestroy
|
OnDestroy,
|
||||||
|
viewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import { TaskExtensionPanelsComponent } from '../task-extension-panels/task-extension-panels.component';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { NgTemplateOutlet } from '@angular/common';
|
||||||
import { AgentService } from '../../services/agent.service';
|
import { AgentService } from '../../services/agent.service';
|
||||||
import { StepReplayFrame } from '../../core/models/stream.model';
|
import { StepReplayFrame } from '../../core/models/stream.model';
|
||||||
import { drawActionCoordinatesOnOverlay } from '../../utils/image-overlay.util';
|
import { drawActionCoordinatesOnOverlay } from '../../utils/image-overlay.util';
|
||||||
@@ -40,13 +43,22 @@ import { buildVideoStepMarkers, VideoStepMarker } from '../../utils/video-step-m
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-floating-video-player',
|
selector: 'app-floating-video-player',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [FormsModule],
|
imports: [FormsModule, NgTemplateOutlet, TaskExtensionPanelsComponent],
|
||||||
templateUrl: './floating-video-player.component.html',
|
templateUrl: './floating-video-player.component.html',
|
||||||
styleUrl: './floating-video-player.component.scss',
|
styleUrl: './floating-video-player.component.scss',
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
})
|
})
|
||||||
export class FloatingVideoPlayerComponent implements OnDestroy {
|
export class FloatingVideoPlayerComponent implements OnDestroy {
|
||||||
public agentService = inject(AgentService);
|
public agentService = inject(AgentService);
|
||||||
|
public extensionWidth = signal(0);
|
||||||
|
public reviewSessionIds = computed(() => this.agentService.sessions()
|
||||||
|
.filter(session => ['completed', 'success', 'failed', 'cancelled', 'interrupted', 'skipped'].includes(session.status || ''))
|
||||||
|
.map(session => session.session_id));
|
||||||
|
public extensionPanels = viewChild(TaskExtensionPanelsComponent);
|
||||||
|
public windowLeft(): number {
|
||||||
|
const width = this.agentService.isVideoMinimized() ? 280 : 400 + this.extensionWidth();
|
||||||
|
return Math.max(16, Math.min(this.posX(), window.innerWidth - Math.min(width, window.innerWidth - 32) - 16));
|
||||||
|
}
|
||||||
private zone = inject(NgZone);
|
private zone = inject(NgZone);
|
||||||
|
|
||||||
@ViewChild('videoRef') videoRef?: ElementRef<HTMLVideoElement>;
|
@ViewChild('videoRef') videoRef?: ElementRef<HTMLVideoElement>;
|
||||||
@@ -327,7 +339,7 @@ export class FloatingVideoPlayerComponent implements OnDestroy {
|
|||||||
this.isDragging = true;
|
this.isDragging = true;
|
||||||
this.dragStartX = event.clientX;
|
this.dragStartX = event.clientX;
|
||||||
this.dragStartY = event.clientY;
|
this.dragStartY = event.clientY;
|
||||||
this.initialPosX = this.posX();
|
this.initialPosX = this.windowLeft();
|
||||||
this.initialPosY = this.posY();
|
this.initialPosY = this.posY();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ describe('持久化模型与功能设置', () => {
|
|||||||
api_key_configured: true, timeout_seconds: 300, max_retries: 5, retry_interval_seconds: 10, reasoning_effort: 'high',
|
api_key_configured: true, timeout_seconds: 300, max_retries: 5, retry_interval_seconds: 10, reasoning_effort: 'high',
|
||||||
rate_limit_retry_seconds: 60, tool_fallback_model: 'gpt-6-luna', tool_fallback_reasoning_effort: 'high',
|
rate_limit_retry_seconds: 60, tool_fallback_model: 'gpt-6-luna', tool_fallback_reasoning_effort: 'high',
|
||||||
tool_fallback_max_retries: 3, tool_fallback_no_progress_attempts: 3,
|
tool_fallback_max_retries: 3, tool_fallback_no_progress_attempts: 3,
|
||||||
model_presets: ['gpt-6-luna', 'gpt-6.1-sol', 'gpt-6-astra', 'mimo-v2.6-pro'], env_path: '/app/.env' };
|
model_presets: ['gpt-6-luna', 'gpt-6.1-terra', 'gpt-6.1-sol', 'gpt-6-astra', 'mimo-v2.6-pro'], env_path: '/app/.env' };
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({ providers: [provideHttpClient(), provideHttpClientTesting()] });
|
TestBed.configureTestingModule({ providers: [provideHttpClient(), provideHttpClientTesting()] });
|
||||||
http = TestBed.inject(HttpTestingController);
|
http = TestBed.inject(HttpTestingController);
|
||||||
|
|||||||
+3
-1
@@ -1,15 +1,17 @@
|
|||||||
import { Component, computed, input } from '@angular/core';
|
import { Component, computed, input } from '@angular/core';
|
||||||
import { PluginToolView } from '../../utils/plugin-tool-view.util';
|
import { PluginToolView } from '../../utils/plugin-tool-view.util';
|
||||||
|
import { ExpandableValueComponent } from '../expandable-value/expandable-value.component';
|
||||||
|
|
||||||
/** Readable presentation only: the full receipt and model context stay intact. */
|
/** Readable presentation only: the full receipt and model context stay intact. */
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-plugin-tool-result',
|
selector: 'app-plugin-tool-result',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
imports: [ExpandableValueComponent],
|
||||||
template: `
|
template: `
|
||||||
@if (view().facts.length) {
|
@if (view().facts.length) {
|
||||||
<dl class="receipt-facts">
|
<dl class="receipt-facts">
|
||||||
@for (fact of view().facts; track fact.key) {
|
@for (fact of view().facts; track fact.key) {
|
||||||
<div><dt>{{ fact.key }}</dt><dd>{{ fact.value }}</dd></div>
|
<div><dt>{{ fact.key }}</dt><dd><app-expandable-value [label]="fact.key" [value]="fact.value" /></dd></div>
|
||||||
}
|
}
|
||||||
</dl>
|
</dl>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { renderMarkdownToHtml } from '../../utils/markdown-parser.util';
|
|||||||
li { margin: 4px 0; }
|
li { margin: 4px 0; }
|
||||||
blockquote { margin: 10px 0; padding: 6px 12px; border-left: 3px solid var(--app-primary-border, #93c5fd); background: var(--app-surface-soft, #f8fafc); }
|
blockquote { margin: 10px 0; padding: 6px 12px; border-left: 3px solid var(--app-primary-border, #93c5fd); background: var(--app-surface-soft, #f8fafc); }
|
||||||
code { font-family: Consolas, monospace; font-size: .92em; border-radius: 4px; padding: 1px 4px; background: var(--app-surface-soft, #f1f5f9); }
|
code { font-family: Consolas, monospace; font-size: .92em; border-radius: 4px; padding: 1px 4px; background: var(--app-surface-soft, #f1f5f9); }
|
||||||
pre { max-width: 100%; overflow: auto; padding: 10px 12px; border-radius: 6px; background: var(--app-surface-soft, #f1f5f9); white-space: pre; }
|
pre { box-sizing: border-box; max-width: 100%; overflow: auto; padding: 10px 12px; border-radius: 6px; background: var(--app-surface-soft, #f1f5f9); white-space: pre; }
|
||||||
pre code { padding: 0; background: none; }
|
pre code { padding: 0; background: none; }
|
||||||
.md-table-scroll { max-width: 100%; overflow-x: auto; }
|
.md-table-scroll { max-width: 100%; overflow-x: auto; }
|
||||||
table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
||||||
|
|||||||
+115
@@ -0,0 +1,115 @@
|
|||||||
|
@if (enabled() && error()) {
|
||||||
|
<div class="extension-notice" role="status">{{ error() }} <button type="button" (click)="refresh()">重试</button></div>
|
||||||
|
}
|
||||||
|
<ng-template #headerControls>
|
||||||
|
@if (data()?.plugins?.length) {
|
||||||
|
<nav class="panel-toggles" aria-label="任务扩展面板">
|
||||||
|
@for (side of ['left', 'right']; track side) {
|
||||||
|
@for (plugin of data()!.plugins; track plugin.plugin_id) {
|
||||||
|
@for (panel of plugin.workspace.panels; track panel.id) {
|
||||||
|
@if (panel.side === side) {
|
||||||
|
<button type="button" class="panel-toggle" [class.active]="opened()[key(plugin, panel)]" [attr.aria-expanded]="!!opened()[key(plugin, panel)]"
|
||||||
|
[attr.aria-label]="(opened()[key(plugin, panel)] ? '收起' : '展开') + panel.title"
|
||||||
|
[title]="(opened()[key(plugin, panel)] ? '收起' : '展开') + panel.title"
|
||||||
|
[attr.aria-controls]="'extension-' + key(plugin, panel)" (click)="toggle(plugin, panel)">
|
||||||
|
<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="2" y="3" width="16" height="14" rx="3" /><path [attr.d]="side === 'left' ? 'M7 3v14' : 'M13 3v14'" /></svg>
|
||||||
|
<span class="panel-toggle-label">{{ panel.title }}</span>
|
||||||
|
<span class="material-symbols-outlined" aria-hidden="true">{{ (side === 'left') !== !!opened()[key(plugin, panel)] ? 'chevron_left' : 'chevron_right' }}</span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</nav>
|
||||||
|
}
|
||||||
|
</ng-template>
|
||||||
|
<div class="extension-layout" [class.has-left]="panels('left').length" [class.has-right]="panels('right').length"
|
||||||
|
[style.--left-width]="width('left') + 'px'" [style.--right-width]="width('right') + 'px'">
|
||||||
|
@if (panels('left').length) {
|
||||||
|
<aside class="panel-column left-column" aria-label="任务左侧扩展">
|
||||||
|
@for (item of panels('left'); track key(item.plugin, item.panel)) {
|
||||||
|
<ng-container *ngTemplateOutlet="panelContent; context: { plugin: item.plugin, panel: item.panel }" />
|
||||||
|
}
|
||||||
|
</aside>
|
||||||
|
}
|
||||||
|
<div class="player-content"><ng-content /></div>
|
||||||
|
@if (panels('right').length) {
|
||||||
|
<aside class="panel-column right-column" aria-label="任务右侧扩展">
|
||||||
|
@for (item of panels('right'); track key(item.plugin, item.panel)) {
|
||||||
|
<ng-container *ngTemplateOutlet="panelContent; context: { plugin: item.plugin, panel: item.panel }" />
|
||||||
|
}
|
||||||
|
</aside>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ng-template #panelContent let-plugin="plugin" let-panel="panel">
|
||||||
|
<section [id]="'extension-' + key(plugin, panel)" [attr.aria-label]="panel.title">
|
||||||
|
<header><h3>{{ panel.kind === 'original_case' ? (data()?.case_title || panel.title) : panel.title }}</h3><span class="panel-kind">{{ panel.kind === 'original_case' ? '原始用例' : panel.kind === 'initial_prompt' ? '原始提示词' : '人工填写 · 选填' }}</span></header>
|
||||||
|
@if (panel.kind === 'original_case') {
|
||||||
|
@if (!data()?.original_case) {
|
||||||
|
<p class="muted">此任务未记录原始用例内容;旧任务不会从 AI 提示词推测补写。</p>
|
||||||
|
}
|
||||||
|
<div class="case-section"><h4>预置条件</h4><app-report-markdown [content]="data()?.original_case?.preconditions || '未填写'" /></div>
|
||||||
|
<div class="case-section"><h4>操作步骤</h4><app-report-markdown [content]="data()?.original_case?.steps || '未填写'" /></div>
|
||||||
|
<div class="case-section"><h4>预期结果</h4><app-report-markdown [content]="data()?.original_case?.expected || '未填写'" /></div>
|
||||||
|
} @else if (panel.kind === 'initial_prompt') {
|
||||||
|
@if (data()?.initial_prompt) {
|
||||||
|
<app-report-markdown [content]="data()!.initial_prompt" />
|
||||||
|
} @else { <p class="muted">该任务未记录初始需求提示词。</p> }
|
||||||
|
} @else {
|
||||||
|
@if (!data()?.editable) { <p class="muted">任务结束后可填写评审。</p> }
|
||||||
|
<fieldset [disabled]="!data()?.editable">
|
||||||
|
@for (field of plugin.workspace.fields; track field.id) {
|
||||||
|
<div class="field" [class.choice-field]="field.kind === 'choice'" [class.note-field]="field.kind === 'text'">
|
||||||
|
<span class="field-label">{{ field.label }}</span>
|
||||||
|
@if (field.description) { <span class="muted">{{ field.description }}</span> }
|
||||||
|
@if (field.kind === 'choice') {
|
||||||
|
<div class="choice-group" role="group" [attr.aria-label]="field.label">
|
||||||
|
@for (option of field.options; track option) {
|
||||||
|
<button type="button" class="choice-button" [class.selected]="drafts[plugin.plugin_id].values[field.id] === option"
|
||||||
|
[class.pass]="option === 'Pass' || option === '通过'" [class.failed]="option === 'Failed' || option === '失败'"
|
||||||
|
[attr.aria-pressed]="drafts[plugin.plugin_id].values[field.id] === option" title="再次点击已选项可清除"
|
||||||
|
(click)="choose(plugin.plugin_id, field.id, option)">
|
||||||
|
@if (option === 'Pass' || option === 'Failed' || option === '通过' || option === '失败') {
|
||||||
|
<svg class="choice-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
||||||
|
<path [attr.d]="option === 'Pass' || option === '通过' ? 'M5 12l4 4L19 6' : 'M6 6l12 12M18 6L6 18'" />
|
||||||
|
</svg>
|
||||||
|
}
|
||||||
|
<span class="choice-label">{{ option }}</span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<textarea rows="1" [attr.aria-label]="field.label" [maxLength]="field.max_length" placeholder="添加备注(选填)"
|
||||||
|
[ngModel]="drafts[plugin.plugin_id].values[field.id] || ''" (ngModelChange)="edit(plugin.plugin_id, field.id, $event)"></textarea>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<div class="form-actions">
|
||||||
|
<button type="button" class="save" [disabled]="!!saving()" (click)="save(plugin)">{{ saving() === plugin.plugin_id ? '正在保存…' : '保存评审' }}</button>
|
||||||
|
<button type="button" class="reload" [disabled]="!!saving()" (click)="reload(plugin)" title="放弃未保存内容,读取最新记录">重新加载</button>
|
||||||
|
<span class="muted unsaved">{{ saving() === plugin.plugin_id ? '正在保存…' : drafts[plugin.plugin_id].dirty ? '等待自动保存…' : '修改后自动保存' }}</span>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<nav class="review-navigation" aria-label="切换评审任务">
|
||||||
|
<div class="navigation-buttons">
|
||||||
|
<button type="button" [disabled]="!navigation().previous || !!saving() || moving()" (click)="move('previous')"><span aria-hidden="true">‹</span>上一条</button>
|
||||||
|
<span class="review-position">{{ navigation().position }} / {{ navigation().total }}</span>
|
||||||
|
<button type="button" [disabled]="!navigation().next || !!saving() || moving()" (click)="move('next')">下一条<span aria-hidden="true">›</span></button>
|
||||||
|
</div>
|
||||||
|
<span class="muted">{{ navigation().scope === 'batch' ? '同批次已结束任务 · 按执行顺序' : '当前历史列表' }}</span>
|
||||||
|
@if (drafts[plugin.plugin_id].dirty) { <span class="muted">有待保存的修改,切换前会先保存。</span> }
|
||||||
|
</nav>
|
||||||
|
@if (notice()) { <p class="notice" role="status">{{ notice() }}</p> }
|
||||||
|
@if (plugin.history.length) {
|
||||||
|
<details class="history"><summary>修改记录({{ plugin.history.length }})</summary>
|
||||||
|
@for (entry of plugin.history; track entry.revision) {
|
||||||
|
<div class="history-entry"><strong>第 {{ entry.revision }} 次 · {{ entry.saved_at * 1000 | date:'yyyy-MM-dd HH:mm:ss' }}</strong>
|
||||||
|
@for (field of entry.fields; track field.id) { <p>{{ field.label }}:{{ entry.values[field.id] || '未填写' }}</p> }
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</details>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
</ng-template>
|
||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
:host { display: block; width: 100%; min-width: 0; min-height: 0; overflow: auto; container-type: inline-size; color: var(--app-text-control, #1e293b); }
|
||||||
|
.panel-toggles { display: flex; gap: 4px; padding-right: 8px; margin-right: 4px; border-right: 1px solid var(--app-border, #e2e8f0); }
|
||||||
|
button { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 9px; border: 1px solid var(--app-border-control, #dbe3ec); border-radius: 8px; color: inherit; background: var(--app-surface, #fff); font: inherit; font-size: 12px; line-height: 20px; cursor: pointer; }
|
||||||
|
.panel-toggle { height: 28px; padding: 4px 7px; border-color: transparent; background: transparent; color: var(--app-text-secondary, #64748b); gap: 4px; }
|
||||||
|
.panel-toggle:hover { background: var(--app-surface-soft, #f1f5f9); }
|
||||||
|
.panel-toggle.active { background: var(--app-primary-soft, #eff6ff); color: var(--app-primary-text, #1a73e8); }
|
||||||
|
.panel-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.4; }
|
||||||
|
.panel-toggle .material-symbols-outlined { font-size: 15px; }
|
||||||
|
button.save { background: #1a73e8; border-color: #1a73e8; color: white; padding: 8px 16px; font-weight: 500; }
|
||||||
|
button:disabled { opacity: .6; cursor: default; }
|
||||||
|
button:focus-visible, textarea:focus-visible { outline: 2px solid var(--app-primary-text, #1a73e8); outline-offset: 2px; }
|
||||||
|
.material-symbols-outlined { font-size: 18px; }
|
||||||
|
.extension-layout { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
|
||||||
|
.has-left { grid-template-columns: minmax(0, min(var(--left-width), 55%)) minmax(0, 1fr); }
|
||||||
|
.has-right { grid-template-columns: minmax(0, 1fr) minmax(0, min(var(--right-width), 55%)); }
|
||||||
|
.has-left.has-right { grid-template-columns: minmax(0, min(var(--left-width), 32%)) minmax(0, 1fr) minmax(0, min(var(--right-width), 32%)); }
|
||||||
|
.player-content { min-width: 0; overflow: hidden; }
|
||||||
|
.panel-column { min-width: 0; max-height: min(70dvh, 680px); overflow: auto; padding: 20px; user-select: text; background: var(--app-surface, #fff); scrollbar-width: thin; scrollbar-color: var(--app-border-control, #cbd5e1) transparent; }
|
||||||
|
.left-column { border-right: 1px solid var(--app-border, #e2e8f0); }
|
||||||
|
.right-column { border-left: 1px solid var(--app-border, #e2e8f0); }
|
||||||
|
section + section { border-top: 1px solid var(--app-border, #e2e8f0); padding-top: 12px; margin-top: 12px; }
|
||||||
|
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 14px; overflow-wrap: anywhere; }
|
||||||
|
h3 { margin: 0; font-size: 14px; color: var(--app-text-strong, #0f172a); }
|
||||||
|
.panel-kind { flex-shrink: 0; font-size: 11px; color: var(--app-text-muted, #64748b); }
|
||||||
|
.case-section { margin: 18px 0; }
|
||||||
|
.case-section h4 { margin: 0 0 8px; font-size: 13px; color: var(--app-text-strong, #0f172a); }
|
||||||
|
.review-navigation { margin: 12px 0 0; padding: 12px 0 0; background: var(--app-surface, #fff); border-top: 1px solid var(--app-border, #e2e8f0); }
|
||||||
|
.navigation-buttons { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 4px; }
|
||||||
|
.navigation-buttons button { white-space: nowrap; }
|
||||||
|
.review-position { font-size: 11px; color: var(--app-text-muted, #64748b); white-space: nowrap; }
|
||||||
|
.muted { display: block; font-size: 12px; color: var(--app-text-secondary, #64748b); line-height: 1.6; }
|
||||||
|
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
|
||||||
|
.field { display: grid; gap: 8px; margin: 0 0 14px; }
|
||||||
|
.choice-field:not(:first-child) { border-top: 1px solid var(--app-border, #e2e8f0); padding-top: 14px; margin-top: 14px; }
|
||||||
|
.field-label { font-size: 13px; font-weight: 600; }
|
||||||
|
.note-field .field-label { font-size: 11px; font-weight: 400; color: var(--app-text-muted, #64748b); }
|
||||||
|
.choice-group { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin-top: 4px; border: 1px solid var(--app-border, #e2e8f0); border-radius: 10px; background: var(--app-surface-soft, #f8fafc); }
|
||||||
|
.choice-button { flex: 1; min-height: 34px; border-color: transparent; background: transparent; color: var(--app-text-secondary, #64748b); font-size: 13px; transition: background .15s, color .15s; }
|
||||||
|
.choice-icon { display: block; flex: 0 0 16px; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
|
||||||
|
.choice-label { display: block; line-height: 20px; }
|
||||||
|
.choice-button:hover { background: var(--app-surface-raised, #e2e8f0); }
|
||||||
|
.choice-button.selected { border-color: var(--app-primary-border, #93c5fd); background: var(--app-primary-soft, #eff6ff); color: var(--app-primary-text, #1a73e8); font-weight: 600; }
|
||||||
|
.choice-button.pass.selected { border-color: var(--app-success-border, #a7f3d0); background: var(--app-success-soft, #ecfdf5); color: var(--app-success-text, #047857); }
|
||||||
|
.choice-button.failed.selected { border-color: var(--app-error-border, #fecdd3); background: var(--app-error-soft, #fff1f2); color: var(--app-error-text, #be123c); }
|
||||||
|
textarea { box-sizing: border-box; width: 100%; min-width: 0; padding: 6px 10px; font: inherit; font-size: 12px; line-height: 1.6; color: inherit; border: 1px solid var(--app-border, #e2e8f0); border-radius: 8px; background: var(--app-surface-soft, #f8fafc); resize: vertical; min-height: 34px; max-height: 200px; }
|
||||||
|
textarea::placeholder { color: var(--app-text-muted, #94a3b8); }
|
||||||
|
.form-actions { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; gap: 8px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--app-border, #e2e8f0); }
|
||||||
|
.form-actions button { height: 36px; padding: 0 16px; white-space: nowrap; }
|
||||||
|
.unsaved { grid-column: 1 / -1; }
|
||||||
|
.reload { border-color: transparent; background: transparent; color: var(--app-text-muted, #64748b); }
|
||||||
|
.notice, .extension-notice { font-size: 12px; padding: 8px; overflow-wrap: anywhere; line-height: 1.6; }
|
||||||
|
.history { margin-top: 18px; font-size: 12px; color: var(--app-text-secondary, #64748b); }
|
||||||
|
summary { cursor: pointer; }
|
||||||
|
.history-entry { border-top: 1px solid var(--app-border, #e2e8f0); padding: 10px 0; overflow-wrap: anywhere; white-space: pre-wrap; }
|
||||||
|
@container (max-width: 640px) {
|
||||||
|
.panel-toggle-label { display: none; }
|
||||||
|
.panel-toggles { padding-right: 4px; margin-right: 0; gap: 2px; }
|
||||||
|
.panel-toggle { padding: 4px; }
|
||||||
|
.panel-column { padding: 16px; }
|
||||||
|
}
|
||||||
+221
@@ -0,0 +1,221 @@
|
|||||||
|
import { TestBed, ComponentFixture, fakeAsync, flushMicrotasks, tick } from '@angular/core/testing';
|
||||||
|
import { provideHttpClient } from '@angular/common/http';
|
||||||
|
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
||||||
|
import { TaskExtensionPanelsComponent } from './task-extension-panels.component';
|
||||||
|
import { TaskExtensions } from '../../services/task-extensions.service';
|
||||||
|
|
||||||
|
function snapshot(sessionId = 'task-one'): TaskExtensions {
|
||||||
|
return {
|
||||||
|
session_id: sessionId, initial_prompt: '# 原始需求\n\n| 项目 | 要求 |\n| --- | --- |\n| 页面 | 可见 |', editable: true,
|
||||||
|
plugins: [{
|
||||||
|
plugin_id: 'review', name: '人工评审', version: '1.0.0', revision: 0, values: { accuracy: '', note: '', correctness: '' }, history: [],
|
||||||
|
workspace: {
|
||||||
|
panels: [
|
||||||
|
{ id: 'prompt', title: '任务需求', side: 'left', kind: 'initial_prompt', width: { minimum: 240, preferred: 360, maximum: 480 } },
|
||||||
|
{ id: 'review', title: '人工评审', side: 'right', kind: 'form', width: { minimum: 260, preferred: 380, maximum: 520 } }
|
||||||
|
],
|
||||||
|
fields: [
|
||||||
|
{ id: 'accuracy', label: 'AI执行准确性', description: '人工核对步骤', kind: 'choice', options: ['Pass', 'Failed'], max_length: 100, report: true },
|
||||||
|
{ id: 'note', label: '执行备注', description: '', kind: 'text', options: [], max_length: 2000, report: true },
|
||||||
|
{ id: 'correctness', label: '测试结果正确性', description: '', kind: 'choice', options: ['Pass', 'Failed'], max_length: 100, report: true }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('步骤回放工作区扩展', () => {
|
||||||
|
let fixture: ComponentFixture<TaskExtensionPanelsComponent>;
|
||||||
|
let component: TaskExtensionPanelsComponent;
|
||||||
|
let http: HttpTestingController;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({ providers: [provideHttpClient(), provideHttpClientTesting()] });
|
||||||
|
fixture = TestBed.createComponent(TaskExtensionPanelsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
http = TestBed.inject(HttpTestingController);
|
||||||
|
});
|
||||||
|
afterEach(() => { http.verify(); fixture.destroy(); });
|
||||||
|
|
||||||
|
function open(data = snapshot()) {
|
||||||
|
fixture.componentRef.setInput('sessionId', data.session_id);
|
||||||
|
fixture.componentRef.setInput('enabled', true);
|
||||||
|
fixture.detectChanges();
|
||||||
|
http.expectOne(`/api/task-extensions/${data.session_id}`).flush(data);
|
||||||
|
fixture.detectChanges();
|
||||||
|
}
|
||||||
|
function toggle(side: 'left' | 'right') {
|
||||||
|
const plugin = component.data()!.plugins[0];
|
||||||
|
component.toggle(plugin, plugin.workspace.panels.find(panel => panel.side === side)!);
|
||||||
|
fixture.detectChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
it('does not request disabled extensions and shows no controls without a plugin', () => {
|
||||||
|
fixture.componentRef.setInput('sessionId', 'task-one');
|
||||||
|
fixture.detectChanges();
|
||||||
|
http.expectNone('/api/task-extensions/task-one');
|
||||||
|
open({ ...snapshot(), plugins: [] });
|
||||||
|
expect(fixture.nativeElement.querySelector('nav')).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('starts collapsed, renders the full initial Markdown prompt and honors declared widths', () => {
|
||||||
|
open();
|
||||||
|
expect(fixture.nativeElement.querySelector('aside')).toBeNull();
|
||||||
|
toggle('left');
|
||||||
|
expect(fixture.nativeElement.querySelector('h1').textContent).toBe('原始需求');
|
||||||
|
expect(fixture.nativeElement.querySelector('table td').textContent).toBe('页面');
|
||||||
|
expect(component.width('left')).toBe(360);
|
||||||
|
expect(fixture.nativeElement.querySelector('.report-prose.compact')).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('keeps either single panel beside playback below the former stacking breakpoint', () => {
|
||||||
|
open();
|
||||||
|
for (const width of [740, 600]) {
|
||||||
|
fixture.nativeElement.style.width = `${width}px`;
|
||||||
|
for (const side of ['left', 'right'] as const) {
|
||||||
|
toggle(side);
|
||||||
|
const panel = fixture.nativeElement.querySelector('aside').getBoundingClientRect();
|
||||||
|
const player = fixture.nativeElement.querySelector('.player-content').getBoundingClientRect();
|
||||||
|
const layout = fixture.nativeElement.querySelector('.extension-layout').getBoundingClientRect();
|
||||||
|
expect(panel.top).toBe(player.top);
|
||||||
|
expect(panel.width).toBeGreaterThan(0);
|
||||||
|
expect(player.width).toBeGreaterThan(0);
|
||||||
|
expect(side === 'left' ? panel.right : player.right).toBeCloseTo(side === 'left' ? player.left : panel.left, 0);
|
||||||
|
expect(Math.max(panel.right, player.right)).toBeLessThanOrEqual(layout.right + 1);
|
||||||
|
toggle(side);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('automatically saves choices and clears while keeping unfilled outcomes blank', fakeAsync(() => {
|
||||||
|
open(); toggle('right');
|
||||||
|
const pass: HTMLButtonElement = fixture.nativeElement.querySelector('.choice-button.pass');
|
||||||
|
pass.click(); fixture.detectChanges();
|
||||||
|
expect(saved().values).toEqual({ accuracy: 'Pass', note: '', correctness: '' });
|
||||||
|
pass.click(); fixture.detectChanges(); expect(saved(2).values.accuracy).toBe('');
|
||||||
|
expect(fixture.nativeElement.textContent).toContain('人工评审已自动保存');
|
||||||
|
}));
|
||||||
|
|
||||||
|
function saved(revision = 1, id = 'task-one') {
|
||||||
|
const request = http.expectOne(`/api/task-extensions/${id}/review`);
|
||||||
|
expect(request.request.method).toBe('PUT');
|
||||||
|
const body = request.request.body, data = snapshot(id);
|
||||||
|
data.plugins[0].revision = revision; data.plugins[0].values = body.values;
|
||||||
|
request.flush(data); flushMicrotasks(); fixture.detectChanges(); return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
it('debounces notes and never posts just from opening a task', fakeAsync(() => {
|
||||||
|
open(); toggle('right'); tick(700); http.expectNone('/api/task-extensions/task-one/review');
|
||||||
|
component.edit('review', 'note', '第一段'); tick(400);
|
||||||
|
component.edit('review', 'note', '完整备注'); tick(599);
|
||||||
|
http.expectNone('/api/task-extensions/task-one/review'); tick(1);
|
||||||
|
expect(saved().values.note).toBe('完整备注');
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('does not overwrite an automatic save with an older read response', fakeAsync(() => {
|
||||||
|
open(); component.edit('review', 'note', '已保存的新内容'); tick(600); saved(2);
|
||||||
|
component.refresh(); fixture.detectChanges();
|
||||||
|
http.expectOne('/api/task-extensions/task-one').flush(snapshot()); fixture.detectChanges();
|
||||||
|
expect(component.drafts['review'].values['note']).toBe('已保存的新内容');
|
||||||
|
expect(component.drafts['review'].revision).toBe(2);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('flushes a pending note when the review panel is closed', fakeAsync(() => {
|
||||||
|
open(); component.edit('review', 'note', '关闭前保存'); fixture.destroy();
|
||||||
|
const request = http.expectOne('/api/task-extensions/task-one/review');
|
||||||
|
expect(request.request.body.values.note).toBe('关闭前保存');
|
||||||
|
const response = snapshot(); response.plugins[0].revision = 1; response.plugins[0].values = request.request.body.values;
|
||||||
|
request.flush(response); flushMicrotasks();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('preserves draft and request receipt on failure, and retries only when requested', fakeAsync(() => {
|
||||||
|
open(); toggle('right'); const plugin = component.data()!.plugins[0];
|
||||||
|
component.edit('review', 'accuracy', 'Failed'); void component.save(plugin);
|
||||||
|
const first = http.expectOne('/api/task-extensions/task-one/review'), requestId = first.request.body.request_id;
|
||||||
|
first.flush({}, { status: 503, statusText: 'Unavailable' }); flushMicrotasks(); tick(700);
|
||||||
|
http.expectNone('/api/task-extensions/task-one/review'); void component.save(plugin);
|
||||||
|
const retry = http.expectOne('/api/task-extensions/task-one/review'); expect(retry.request.body.request_id).toBe(requestId);
|
||||||
|
retry.flush({}, { status: 409, statusText: 'Conflict' }); flushMicrotasks();
|
||||||
|
expect(component.drafts['review'].values['accuracy']).toBe('Failed');
|
||||||
|
component.edit('review', 'accuracy', ''); void component.save(plugin);
|
||||||
|
const clear = saved(); expect(clear.values.accuracy).toBe(''); expect(clear.request_id).not.toBe(requestId);
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('serializes rapid edits and saves the latest choice using the returned revision', fakeAsync(() => {
|
||||||
|
const data = snapshot(); data.plugins[0].workspace.fields[0].options = ['通过', '失败']; open(data); toggle('right');
|
||||||
|
const pass: HTMLButtonElement = fixture.nativeElement.querySelector('.choice-button.pass');
|
||||||
|
const failed: HTMLButtonElement = fixture.nativeElement.querySelector('.choice-button.failed');
|
||||||
|
pass.click(); failed.click(); fixture.detectChanges();
|
||||||
|
expect(component.drafts['review'].values['accuracy']).toBe('失败'); expect(saved().values.accuracy).toBe('通过');
|
||||||
|
const second = saved(2); expect(second.values.accuracy).toBe('失败'); expect(second.expected_revision).toBe(1);
|
||||||
|
expect(component.drafts['review'].dirty).toBeFalse();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('does not apply a delayed save response to the task now displayed', fakeAsync(() => {
|
||||||
|
open(); toggle('right'); component.edit('review', 'note', '只属于第一个任务'); void component.save(component.data()!.plugins[0]);
|
||||||
|
const oldSave = http.expectOne('/api/task-extensions/task-one/review');
|
||||||
|
fixture.componentRef.setInput('sessionId', 'task-two'); fixture.detectChanges();
|
||||||
|
http.expectOne('/api/task-extensions/task-two').flush(snapshot('task-two')); fixture.detectChanges();
|
||||||
|
oldSave.flush(snapshot('task-one')); flushMicrotasks(); fixture.detectChanges();
|
||||||
|
expect(component.data()!.session_id).toBe('task-two'); expect(component.drafts['review'].values['note']).toBe('');
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('flushes a pending note on direct task switches and hides disabled plugins', fakeAsync(() => {
|
||||||
|
open(); toggle('right'); component.edit('review', 'note', '自动保存草稿');
|
||||||
|
fixture.componentRef.setInput('sessionId', 'task-two'); fixture.detectChanges();
|
||||||
|
http.expectOne('/api/task-extensions/task-two').flush(snapshot('task-two'));
|
||||||
|
const body = saved(1, 'task-one'); expect(body.values.note).toBe('自动保存草稿');
|
||||||
|
fixture.componentRef.setInput('sessionId', 'task-one'); fixture.detectChanges();
|
||||||
|
const first = snapshot(); first.plugins[0].revision = 1; first.plugins[0].values = body.values;
|
||||||
|
http.expectOne('/api/task-extensions/task-one').flush(first); fixture.detectChanges();
|
||||||
|
expect(component.drafts['review'].values['note']).toBe('自动保存草稿');
|
||||||
|
window.dispatchEvent(new Event('artemis-plugin-change')); fixture.detectChanges();
|
||||||
|
http.expectOne('/api/task-extensions/task-one').flush({ ...first, plugins: [] }); fixture.detectChanges();
|
||||||
|
expect(fixture.nativeElement.querySelector('aside')).toBeNull();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('keeps running tasks read-only then enables editing when the task finishes', () => {
|
||||||
|
open({ ...snapshot(), editable: false }); toggle('right');
|
||||||
|
expect(fixture.nativeElement.querySelector('fieldset').disabled).toBeTrue();
|
||||||
|
component.save(component.data()!.plugins[0]); http.expectNone('/api/task-extensions/task-one/review');
|
||||||
|
fixture.componentRef.setInput('taskStatus', 'completed'); fixture.detectChanges();
|
||||||
|
http.expectOne('/api/task-extensions/task-one').flush(snapshot()); fixture.detectChanges();
|
||||||
|
expect(fixture.nativeElement.querySelector('fieldset').disabled).toBeFalse();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('collapses the opposite panel on narrow screens', () => {
|
||||||
|
const original = Object.getOwnPropertyDescriptor(window, 'innerWidth')!;
|
||||||
|
Object.defineProperty(window, 'innerWidth', { configurable: true, value: 600 });
|
||||||
|
try {
|
||||||
|
open(); toggle('left'); toggle('right');
|
||||||
|
expect(component.panels('left').length).toBe(0);
|
||||||
|
expect(component.panels('right').length).toBe(1);
|
||||||
|
} finally { Object.defineProperty(window, 'innerWidth', original); }
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows original case sections in order without substituting the AI prompt', () => {
|
||||||
|
const data = snapshot();
|
||||||
|
data.plugins[0].workspace.panels[0].kind = 'original_case';
|
||||||
|
data.case_title = 'CASE-001 检查设置';
|
||||||
|
data.original_case = { preconditions: '已登录', steps: '1. 打开设置\n2. 核对版本', expected: '版本可见' };
|
||||||
|
open(data); toggle('left');
|
||||||
|
const text = fixture.nativeElement.textContent;
|
||||||
|
expect(text).toContain('CASE-001 检查设置');
|
||||||
|
expect(text).toMatch(/预置条件[\s\S]*已登录[\s\S]*操作步骤[\s\S]*核对版本[\s\S]*预期结果[\s\S]*版本可见/);
|
||||||
|
expect(text).not.toContain('原始需求');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('saves before navigation and keeps the current task on save failure', fakeAsync(() => {
|
||||||
|
const first = snapshot(); first.navigation = { scope: 'batch', position: 1, total: 2, previous: null, next: 'task-two' };
|
||||||
|
open(first); toggle('right'); const emitted = jasmine.createSpy('navigate'); component.navigate.subscribe(emitted);
|
||||||
|
const saveButton = fixture.nativeElement.querySelector('button.save'), navigation = fixture.nativeElement.querySelector('.review-navigation');
|
||||||
|
expect(saveButton.compareDocumentPosition(navigation) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
||||||
|
component.edit('review', 'note', '切换前保存'); void component.move('next'); expect(emitted).not.toHaveBeenCalled();
|
||||||
|
http.expectOne('/api/task-extensions/task-one/review').flush({}, {status: 409, statusText: 'Conflict'});
|
||||||
|
flushMicrotasks(); expect(emitted).not.toHaveBeenCalled(); expect(component.drafts['review'].dirty).toBeTrue();
|
||||||
|
void component.move('next'); saved(); flushMicrotasks(); expect(emitted).toHaveBeenCalledOnceWith('task-two');
|
||||||
|
fixture.componentRef.setInput('sessionId', 'task-two'); fixture.detectChanges();
|
||||||
|
http.expectOne('/api/task-extensions/task-two').flush(snapshot('task-two')); fixture.detectChanges();
|
||||||
|
expect(component.panels('right').length).toBe(1);
|
||||||
|
}));
|
||||||
|
});
|
||||||
+201
@@ -0,0 +1,201 @@
|
|||||||
|
import { Component, ChangeDetectionStrategy, HostListener, TemplateRef, DestroyRef, computed, effect, inject, input, output, signal, viewChild } from '@angular/core';
|
||||||
|
import { DatePipe, NgTemplateOutlet } from '@angular/common';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
import { ReportMarkdownComponent } from '../report-markdown/report-markdown.component';
|
||||||
|
import { ExtensionDraft, ExtensionPanel, TaskExtension, TaskExtensions, TaskExtensionsService } from '../../services/task-extensions.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-task-extension-panels', standalone: true,
|
||||||
|
imports: [FormsModule, NgTemplateOutlet, DatePipe, ReportMarkdownComponent],
|
||||||
|
templateUrl: './task-extension-panels.component.html',
|
||||||
|
styleUrl: './task-extension-panels.component.scss',
|
||||||
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
|
})
|
||||||
|
export class TaskExtensionPanelsComponent {
|
||||||
|
private service = inject(TaskExtensionsService);
|
||||||
|
sessionId = input<string | null>(null);
|
||||||
|
enabled = input(false);
|
||||||
|
taskStatus = input('');
|
||||||
|
sessionIds = input<string[]>([]);
|
||||||
|
navigate = output<string>();
|
||||||
|
navigation = computed(() => {
|
||||||
|
if (this.data()?.navigation) return this.data()!.navigation!;
|
||||||
|
const ids = this.sessionIds(), index = ids.indexOf(this.sessionId() || '');
|
||||||
|
return { scope: 'history', position: index + 1, total: ids.length,
|
||||||
|
previous: index > 0 ? ids[index - 1] : null,
|
||||||
|
next: index >= 0 && index < ids.length - 1 ? ids[index + 1] : null };
|
||||||
|
});
|
||||||
|
expandedWidth = output<number>();
|
||||||
|
headerControls = viewChild<TemplateRef<unknown>>('headerControls');
|
||||||
|
data = signal<TaskExtensions | null>(null);
|
||||||
|
error = signal('');
|
||||||
|
private destroyRef = inject(DestroyRef);
|
||||||
|
private savingKeys = signal<string[]>([]);
|
||||||
|
saving = computed(() => this.savingKeys().find(key => key.startsWith(`${this.sessionId()}/`))?.split('/')[1] || null);
|
||||||
|
moving = signal(false);
|
||||||
|
private scheduled = new Map<string, { timer: ReturnType<typeof setTimeout>; run: () => Promise<boolean> }>();
|
||||||
|
private inFlight = new Map<string, Promise<boolean>>();
|
||||||
|
notice = signal('');
|
||||||
|
opened = signal<Record<string, boolean>>({});
|
||||||
|
private refreshToken = signal(0);
|
||||||
|
private identity = '';
|
||||||
|
private generation = 0;
|
||||||
|
drafts: Record<string, ExtensionDraft> = {};
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.destroyRef.onDestroy(() => this.flushScheduled());
|
||||||
|
effect(onCleanup => {
|
||||||
|
const id = this.sessionId();
|
||||||
|
const enabled = this.enabled();
|
||||||
|
this.refreshToken();
|
||||||
|
this.taskStatus();
|
||||||
|
this.generation++;
|
||||||
|
const identity = enabled ? id || '' : '';
|
||||||
|
if (identity !== this.identity) {
|
||||||
|
this.flushScheduled();
|
||||||
|
this.identity = identity;
|
||||||
|
this.data.set(null);
|
||||||
|
if (!identity) this.opened.set({});
|
||||||
|
this.expandedWidth.emit(0);
|
||||||
|
}
|
||||||
|
this.error.set('');
|
||||||
|
this.notice.set('');
|
||||||
|
if (!id || !enabled) return;
|
||||||
|
const subscription = this.service.read(id).subscribe({
|
||||||
|
next: data => {
|
||||||
|
this.drafts = Object.fromEntries(data.plugins.map(plugin => [plugin.plugin_id, this.service.draft(id, plugin)]));
|
||||||
|
this.data.set(data);
|
||||||
|
this.expandedWidth.emit(this.width('left') + this.width('right'));
|
||||||
|
},
|
||||||
|
error: () => this.error.set('暂时无法加载任务扩展,请重试')
|
||||||
|
});
|
||||||
|
onCleanup(() => subscription.unsubscribe());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@HostListener('window:artemis-plugin-change')
|
||||||
|
refresh(): void { this.refreshToken.update(value => value + 1); }
|
||||||
|
|
||||||
|
async move(direction: 'previous' | 'next'): Promise<void> {
|
||||||
|
const destination = this.navigation()[direction], id = this.sessionId();
|
||||||
|
if (!destination || !id || !this.data() || this.moving()) return;
|
||||||
|
this.moving.set(true);
|
||||||
|
try {
|
||||||
|
for (const plugin of this.data()!.plugins) {
|
||||||
|
if (this.drafts[plugin.plugin_id]?.dirty && !await this.save(plugin)) return;
|
||||||
|
}
|
||||||
|
if (id === this.sessionId() && !this.destroyRef.destroyed) this.navigate.emit(destination);
|
||||||
|
} finally { this.moving.set(false); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private cancelScheduled(key: string): void {
|
||||||
|
const pending = this.scheduled.get(key);
|
||||||
|
if (pending) clearTimeout(pending.timer);
|
||||||
|
this.scheduled.delete(key);
|
||||||
|
}
|
||||||
|
private flushScheduled(): void {
|
||||||
|
for (const pending of [...this.scheduled.values()]) void pending.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
key(plugin: TaskExtension, panel: ExtensionPanel): string { return `${plugin.plugin_id}/${panel.id}`; }
|
||||||
|
panels(side: 'left' | 'right') {
|
||||||
|
return (this.data()?.plugins || []).flatMap(plugin => plugin.workspace.panels
|
||||||
|
.filter(panel => panel.side === side && this.opened()[this.key(plugin, panel)])
|
||||||
|
.map(panel => ({ plugin, panel })));
|
||||||
|
}
|
||||||
|
width(side: 'left' | 'right'): number {
|
||||||
|
return Math.max(0, ...this.panels(side).map(({ panel }) =>
|
||||||
|
Math.max(panel.width.minimum, Math.min(panel.width.preferred, panel.width.maximum))));
|
||||||
|
}
|
||||||
|
toggle(plugin: TaskExtension, panel: ExtensionPanel): void {
|
||||||
|
const key = this.key(plugin, panel);
|
||||||
|
const next = { ...this.opened(), [key]: !this.opened()[key] };
|
||||||
|
if (next[key] && window.innerWidth < 1000) {
|
||||||
|
for (const other of this.data()?.plugins || []) {
|
||||||
|
for (const sibling of other.workspace.panels) {
|
||||||
|
if (sibling.side !== panel.side) next[this.key(other, sibling)] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.opened.set(next);
|
||||||
|
this.expandedWidth.emit(this.width('left') + this.width('right'));
|
||||||
|
}
|
||||||
|
@HostListener('window:resize')
|
||||||
|
resize(): void {
|
||||||
|
if (window.innerWidth < 1000 && this.panels('left').length && this.panels('right').length) {
|
||||||
|
const next = { ...this.opened() };
|
||||||
|
for (const { plugin, panel } of this.panels('left')) next[this.key(plugin, panel)] = false;
|
||||||
|
this.opened.set(next);
|
||||||
|
this.expandedWidth.emit(this.width('left') + this.width('right'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
edit(pluginId: string, field: string, value: string): void {
|
||||||
|
const id = this.sessionId(), draft = this.drafts[pluginId];
|
||||||
|
if (!id || !draft || !this.data()?.editable || draft.values[field] === value) return;
|
||||||
|
draft.values[field] = value;
|
||||||
|
draft.dirty = true;
|
||||||
|
draft.requestId = undefined;
|
||||||
|
this.notice.set('');
|
||||||
|
const key = `${id}/${pluginId}`;
|
||||||
|
this.cancelScheduled(key);
|
||||||
|
const run = () => this.saveFor(id, pluginId, draft);
|
||||||
|
this.scheduled.set(key, { run, timer: setTimeout(() => void run(), 600) });
|
||||||
|
}
|
||||||
|
choose(pluginId: string, field: string, value: string): void {
|
||||||
|
this.edit(pluginId, field, this.drafts[pluginId].values[field] === value ? '' : value);
|
||||||
|
const plugin = this.data()?.plugins.find(item => item.plugin_id === pluginId);
|
||||||
|
if (plugin) void this.save(plugin);
|
||||||
|
}
|
||||||
|
reload(plugin: TaskExtension): void {
|
||||||
|
const id = this.sessionId();
|
||||||
|
if (!id) return;
|
||||||
|
this.cancelScheduled(`${id}/${plugin.plugin_id}`);
|
||||||
|
this.service.discard(id, plugin.plugin_id);
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
|
save(plugin: TaskExtension): Promise<boolean> {
|
||||||
|
const id = this.sessionId();
|
||||||
|
if (!id || !this.data()?.editable) return Promise.resolve(false);
|
||||||
|
return this.saveFor(id, plugin.plugin_id, this.drafts[plugin.plugin_id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async saveFor(id: string, pluginId: string, draft: ExtensionDraft): Promise<boolean> {
|
||||||
|
const key = `${id}/${pluginId}`;
|
||||||
|
this.cancelScheduled(key);
|
||||||
|
const pending = this.inFlight.get(key);
|
||||||
|
if (pending) {
|
||||||
|
if (!await pending) return false;
|
||||||
|
return draft.dirty ? this.saveFor(id, pluginId, draft) : true;
|
||||||
|
}
|
||||||
|
if (!draft.dirty) return true;
|
||||||
|
const submitted = { ...draft.values }, generation = this.generation;
|
||||||
|
const visible = () => !this.destroyRef.destroyed && id === this.sessionId() && generation === this.generation;
|
||||||
|
this.savingKeys.update(keys => [...keys, key]);
|
||||||
|
const request = firstValueFrom(this.service.save(id, pluginId, draft)).then(data => {
|
||||||
|
const saved = data.plugins.find(plugin => plugin.plugin_id === pluginId);
|
||||||
|
if (!saved) throw new Error('未收到保存回执');
|
||||||
|
draft.revision = saved.revision;
|
||||||
|
draft.dirty = JSON.stringify(draft.values) !== JSON.stringify(submitted);
|
||||||
|
draft.requestId = undefined;
|
||||||
|
if (!draft.dirty) draft.values = { ...saved.values };
|
||||||
|
if (visible()) {
|
||||||
|
this.data.set(data);
|
||||||
|
this.notice.set(draft.dirty ? '正在保存后续修改…' : '人工评审已自动保存');
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}).catch(error => {
|
||||||
|
this.cancelScheduled(key);
|
||||||
|
if (visible()) this.notice.set(typeof error.error?.detail === 'string'
|
||||||
|
? `保存失败:${error.error.detail};输入已保留`
|
||||||
|
: '保存失败,输入已保留,请点击保存评审重试');
|
||||||
|
return false;
|
||||||
|
}).finally(() => {
|
||||||
|
this.inFlight.delete(key);
|
||||||
|
this.savingKeys.update(keys => keys.filter(item => item !== key));
|
||||||
|
});
|
||||||
|
this.inFlight.set(key, request);
|
||||||
|
const succeeded = await request;
|
||||||
|
return succeeded && draft.dirty ? this.saveFor(id, pluginId, draft) : succeeded;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ export class TaskPluginsComponent implements OnChanges {
|
|||||||
return this.automatic ? '自动' : Object.keys(this.selected).length ? `已选 ${Object.keys(this.selected).length} 个` : '本次停用';
|
return this.automatic ? '自动' : Object.keys(this.selected).length ? `已选 ${Object.keys(this.selected).length} 个` : '本次停用';
|
||||||
}
|
}
|
||||||
available() {
|
available() {
|
||||||
return this.plugins().filter(p => p.enabled && p.profiles.some(profile => profile.authorized) &&
|
return this.plugins().filter(p => p.enabled && (!p.manifest.workspace || !!p.manifest.server || !!p.manifest.skill) && p.profiles.some(profile => profile.authorized) &&
|
||||||
p.manifest.targets.some(target => target === this.target() || (this.target() === 'android' && target === 'mixed')));
|
p.manifest.targets.some(target => target === this.target() || (this.target() === 'android' && target === 'mixed')));
|
||||||
}
|
}
|
||||||
ngOnChanges() {
|
ngOnChanges() {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export const MODEL_PRESETS = ['gpt-6-luna', 'gpt-6.1-sol', 'gpt-6-astra', 'mimo-v2.6-pro'];
|
export const MODEL_PRESETS = ['gpt-6-luna', 'gpt-6.1-terra', 'gpt-6.1-sol', 'gpt-6-astra', 'mimo-v2.6-pro'];
|
||||||
@@ -1518,7 +1518,7 @@
|
|||||||
@if(explorationSettingsOpen()) {
|
@if(explorationSettingsOpen()) {
|
||||||
<div class="exploration-settings-body">
|
<div class="exploration-settings-body">
|
||||||
<label class="model-label">探索模型<input list="explore-models" [(ngModel)]="config.model" [disabled]="explorationSettingsBusy()" /></label>
|
<label class="model-label">探索模型<input list="explore-models" [(ngModel)]="config.model" [disabled]="explorationSettingsBusy()" /></label>
|
||||||
<datalist id="explore-models"><option value="gpt-6.1-sol"></option><option value="gpt-6-astra"></option><option value="gpt-6-luna"></option><option value="mimo-v2.6-pro"></option></datalist>
|
<datalist id="explore-models"><option value="gpt-6.1-terra"></option><option value="gpt-6.1-sol"></option><option value="gpt-6-astra"></option><option value="gpt-6-luna"></option><option value="mimo-v2.6-pro"></option></datalist>
|
||||||
<div class="exploration-fields">
|
<div class="exploration-fields">
|
||||||
<app-setting-slider label="思考强度" [(value)]="config.reasoning_effort" [values]="reasoningValues" [labels]="reasoningLabels" hint="越高越适合复杂推理,也可能等待更久。" [disabled]="explorationSettingsBusy()" />
|
<app-setting-slider label="思考强度" [(value)]="config.reasoning_effort" [values]="reasoningValues" [labels]="reasoningLabels" hint="越高越适合复杂推理,也可能等待更久。" [disabled]="explorationSettingsBusy()" />
|
||||||
<app-setting-slider label="每段执行时限" [(value)]="config.timeout_seconds" [values]="executionTimes" [labels]="executionTimeLabels" hint="到时暂停并保存进度,点击继续即可接着探索。" [disabled]="explorationSettingsBusy()" />
|
<app-setting-slider label="每段执行时限" [(value)]="config.timeout_seconds" [values]="executionTimes" [labels]="executionTimeLabels" hint="到时暂停并保存进度,点击继续即可接着探索。" [disabled]="explorationSettingsBusy()" />
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { TaskRecommendationService } from '../../core/services/task-recommendati
|
|||||||
|
|
||||||
describe('Homepage exploration entry',()=>{
|
describe('Homepage exploration entry',()=>{
|
||||||
let api:any,agent:any,router:any,system:any;
|
let api:any,agent:any,router:any,system:any;
|
||||||
const config={model:'gpt-6.1-sol',reasoning_effort:'high',timeout_seconds:1800,demonstration_timeout_seconds:900,demonstration_warning_seconds:60};
|
const config={model:'gpt-6.1-terra',reasoning_effort:'high',timeout_seconds:1800,demonstration_timeout_seconds:900,demonstration_warning_seconds:60};
|
||||||
beforeEach(()=>{
|
beforeEach(()=>{
|
||||||
api={settings:jasmine.createSpy().and.resolveTo(config),create:jasmine.createSpy().and.resolveTo({id:'conversation'}),act:jasmine.createSpy().and.resolveTo({run:{id:'run'}})};
|
api={settings:jasmine.createSpy().and.resolveTo(config),create:jasmine.createSpy().and.resolveTo({id:'conversation'}),act:jasmine.createSpy().and.resolveTo({run:{id:'run'}})};
|
||||||
agent={runTask:jasmine.createSpy(),selectSession:jasmine.createSpy(),fetchSessions:jasmine.createSpy(),fetchStatus:jasmine.createSpy()};router={navigate:jasmine.createSpy().and.resolveTo(true)};
|
agent={runTask:jasmine.createSpy(),selectSession:jasmine.createSpy(),fetchSessions:jasmine.createSpy(),fetchStatus:jasmine.createSpy()};router={navigate:jasmine.createSpy().and.resolveTo(true)};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<main class="plugins-page">
|
<main class="plugins-page">
|
||||||
<header><div><span class="eyebrow">ARTEMIS · 扩展能力</span><h1>插件</h1><p>为安卓测试扩展电脑等操作能力,AI 按任务需要自主调用。</p></div>
|
<header><div><span class="eyebrow">ARTEMIS · 扩展能力</span><h1>插件</h1><p>扩展任务操作能力,也可为回放界面和报告添加人工评审等功能。</p></div>
|
||||||
<button (click)="refresh(); refreshCatalog()" [disabled]="busy() || loading() || catalogLoading()">刷新</button></header>
|
<button (click)="refresh(); refreshCatalog()" [disabled]="busy() || loading() || catalogLoading()">刷新</button></header>
|
||||||
@if (error()) { <div class="message error" role="alert">{{error()}}</div> }
|
@if (error()) { <div class="message error" role="alert">{{error()}}</div> }
|
||||||
@if (notice()) { <div class="message success" role="status">{{notice()}}</div> }
|
@if (notice()) { <div class="message success" role="status">{{notice()}}</div> }
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { Injectable, inject } from '@angular/core';
|
import { Injectable, inject } from '@angular/core';
|
||||||
|
import { tap } from 'rxjs';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
export interface PluginManifest {
|
export interface PluginManifest {
|
||||||
id: string; name: string; version: string; description: string;
|
id: string; name: string; version: string; description: string;
|
||||||
artemis_version: string; platforms: string[]; source: string;
|
artemis_version: string; platforms: string[]; source: string;
|
||||||
config: Record<string, { label: string; description: string; secret: boolean; required: boolean; default: string }>;
|
config: Record<string, { label: string; description: string; secret: boolean; required: boolean; default: string }>;
|
||||||
|
workspace?: unknown; server?: unknown; skill?: string;
|
||||||
resources: string[];
|
resources: string[];
|
||||||
targets: ('android' | 'computer' | 'mixed')[];
|
targets: ('android' | 'computer' | 'mixed')[];
|
||||||
}
|
}
|
||||||
@@ -28,13 +30,13 @@ export class PluginService {
|
|||||||
install(payload: { plugin_id?: string; version?: string; local_path?: string }) {
|
install(payload: { plugin_id?: string; version?: string; local_path?: string }) {
|
||||||
return this.http.post<{ job_id: string }>('/api/plugins/install', payload);
|
return this.http.post<{ job_id: string }>('/api/plugins/install', payload);
|
||||||
}
|
}
|
||||||
progress(id: string) { return this.http.get<InstallProgress>(`/api/plugins/install/${encodeURIComponent(id)}`); }
|
progress(id: string) { return this.http.get<InstallProgress>(`/api/plugins/install/${encodeURIComponent(id)}`).pipe(tap(() => window.dispatchEvent(new Event('artemis-plugin-change')))); }
|
||||||
save(id: string, profile: PluginProfile) {
|
save(id: string, profile: PluginProfile) {
|
||||||
const { configured_secrets, ...payload } = profile;
|
const { configured_secrets, ...payload } = profile;
|
||||||
return this.http.put<InstalledPlugin>(`/api/plugins/${encodeURIComponent(id)}/profiles`, payload);
|
return this.http.put<InstalledPlugin>(`/api/plugins/${encodeURIComponent(id)}/profiles`, payload);
|
||||||
}
|
}
|
||||||
enable(id: string, enabled: boolean) { return this.http.put<InstalledPlugin>(`/api/plugins/${encodeURIComponent(id)}/enabled`, { enabled }); }
|
enable(id: string, enabled: boolean) { return this.http.put<InstalledPlugin>(`/api/plugins/${encodeURIComponent(id)}/enabled`, { enabled }).pipe(tap(() => window.dispatchEvent(new Event('artemis-plugin-change')))); }
|
||||||
diagnose(id: string, profile: string) { return this.http.post<{ ok: boolean; message: string }>(`/api/plugins/${encodeURIComponent(id)}/diagnose`, { profile }); }
|
diagnose(id: string, profile: string) { return this.http.post<{ ok: boolean; message: string }>(`/api/plugins/${encodeURIComponent(id)}/diagnose`, { profile }); }
|
||||||
uninstall(id: string) { return this.http.delete(`/api/plugins/${encodeURIComponent(id)}`); }
|
uninstall(id: string) { return this.http.delete(`/api/plugins/${encodeURIComponent(id)}`).pipe(tap(() => window.dispatchEvent(new Event('artemis-plugin-change')))); }
|
||||||
custom(manifest: unknown, skill_content: string) { return this.http.post('/api/plugins/custom', { manifest, skill_content }); }
|
custom(manifest: unknown, skill_content: string) { return this.http.post('/api/plugins/custom', { manifest, skill_content }); }
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import { Injectable, inject } from '@angular/core';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
|
||||||
|
export interface ExtensionField {
|
||||||
|
id: string; label: string; description: string; kind: 'choice' | 'text';
|
||||||
|
options: string[]; max_length: number; report: boolean;
|
||||||
|
}
|
||||||
|
export interface ExtensionPanel {
|
||||||
|
id: string; title: string; side: 'left' | 'right'; kind: 'initial_prompt' | 'original_case' | 'form';
|
||||||
|
width: { preferred: number; minimum: number; maximum: number };
|
||||||
|
}
|
||||||
|
export interface TaskExtension {
|
||||||
|
plugin_id: string; name: string; version: string; revision: number;
|
||||||
|
workspace: { panels: ExtensionPanel[]; fields: ExtensionField[] };
|
||||||
|
values: Record<string, string>;
|
||||||
|
history: { revision: number; saved_at: number; values: Record<string, string>; fields: ExtensionField[] }[];
|
||||||
|
}
|
||||||
|
export interface TaskExtensions {
|
||||||
|
session_id: string; initial_prompt: string; editable: boolean; plugins: TaskExtension[];
|
||||||
|
case_title?: string;
|
||||||
|
original_case?: { preconditions: string; steps: string; expected: string } | null;
|
||||||
|
navigation?: { scope: 'batch'; position: number; total: number; previous: string | null; next: string | null } | null;
|
||||||
|
}
|
||||||
|
export interface ExtensionDraft {
|
||||||
|
values: Record<string, string>; revision: number; dirty: boolean; requestId?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class TaskExtensionsService {
|
||||||
|
private http = inject(HttpClient);
|
||||||
|
private drafts = new Map<string, ExtensionDraft>();
|
||||||
|
read(sessionId: string) {
|
||||||
|
return this.http.get<TaskExtensions>(`/api/task-extensions/${encodeURIComponent(sessionId)}`);
|
||||||
|
}
|
||||||
|
draft(sessionId: string, plugin: TaskExtension): ExtensionDraft {
|
||||||
|
const key = `${sessionId}/${plugin.plugin_id}`;
|
||||||
|
let draft = this.drafts.get(key);
|
||||||
|
if (!draft || (!draft.dirty && plugin.revision >= draft.revision)) {
|
||||||
|
draft = { values: { ...plugin.values }, revision: plugin.revision, dirty: false };
|
||||||
|
this.drafts.set(key, draft);
|
||||||
|
}
|
||||||
|
return draft;
|
||||||
|
}
|
||||||
|
discard(sessionId: string, pluginId: string) { this.drafts.delete(`${sessionId}/${pluginId}`); }
|
||||||
|
save(sessionId: string, pluginId: string, draft: ExtensionDraft) {
|
||||||
|
draft.requestId ||= crypto.randomUUID();
|
||||||
|
return this.http.put<TaskExtensions>(`/api/task-extensions/${encodeURIComponent(sessionId)}/${encodeURIComponent(pluginId)}`, {
|
||||||
|
values: { ...draft.values }, expected_revision: draft.revision, request_id: draft.requestId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -96,6 +96,7 @@ from artemis.services.llm import (
|
|||||||
get_openai_llm,
|
get_openai_llm,
|
||||||
get_llm,
|
get_llm,
|
||||||
invoke_llm_with_timeout_message,
|
invoke_llm_with_timeout_message,
|
||||||
|
with_fallback,
|
||||||
)
|
)
|
||||||
from artemis.tools.history import history_tool_declarations
|
from artemis.tools.history import history_tool_declarations
|
||||||
from artemis.tools.android_files import android_file
|
from artemis.tools.android_files import android_file
|
||||||
@@ -780,7 +781,7 @@ class FlashRunner:
|
|||||||
action_dict["normalized_start_coordinates"] = norm_start
|
action_dict["normalized_start_coordinates"] = norm_start
|
||||||
action_dict["normalized_end_coordinates"] = norm_end
|
action_dict["normalized_end_coordinates"] = norm_end
|
||||||
action_dict.update(metadata.get("target_semantics") or {})
|
action_dict.update(metadata.get("target_semantics") or {})
|
||||||
for key in ("input_verification", "execution", "side_effect"):
|
for key in ("input_verification", "execution", "side_effect", "source"):
|
||||||
if key in metadata:
|
if key in metadata:
|
||||||
action_dict[key] = metadata[key]
|
action_dict[key] = metadata[key]
|
||||||
if metadata.get("plugin_id"):
|
if metadata.get("plugin_id"):
|
||||||
@@ -1506,20 +1507,32 @@ class FlashRunner:
|
|||||||
turn_base = len(messages) - 1
|
turn_base = len(messages) - 1
|
||||||
current_tools = report_only_tools if is_final else self._get_tools()
|
current_tools = report_only_tools if is_final else self._get_tools()
|
||||||
|
|
||||||
|
async def invoke_turn():
|
||||||
|
if using_tool_fallback:
|
||||||
|
return await self._invoke_model(fallback_llm, current_tools, messages)
|
||||||
|
|
||||||
|
async def invoke_fallback():
|
||||||
|
nonlocal fallback_llm
|
||||||
|
if fallback_llm is None:
|
||||||
|
fallback_llm = get_llm(self.ctx, name="operator", use_fallback=True)
|
||||||
|
return await self._invoke_model(fallback_llm, current_tools, messages)
|
||||||
|
|
||||||
|
return await with_fallback(
|
||||||
|
lambda: self._invoke_model(llm, current_tools, messages),
|
||||||
|
invoke_fallback,
|
||||||
|
none_should_fallback=False,
|
||||||
|
)
|
||||||
|
|
||||||
if isinstance(control, TaskControl):
|
if isinstance(control, TaskControl):
|
||||||
interrupted, response = await control.run_interruptibly(
|
interrupted, response = await control.run_interruptibly(
|
||||||
self._invoke_model(
|
invoke_turn(),
|
||||||
fallback_llm if using_tool_fallback else llm, current_tools, messages
|
|
||||||
),
|
|
||||||
on_pause=getattr(self.ctx, "on_task_pause", None),
|
on_pause=getattr(self.ctx, "on_task_pause", None),
|
||||||
on_resume=getattr(self.ctx, "on_task_resume", None),
|
on_resume=getattr(self.ctx, "on_task_resume", None),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
interrupted, response = (
|
interrupted, response = (
|
||||||
False,
|
False,
|
||||||
await self._invoke_model(
|
await invoke_turn(),
|
||||||
fallback_llm if using_tool_fallback else llm, current_tools, messages
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if interrupted or (
|
if interrupted or (
|
||||||
|
|||||||
@@ -412,6 +412,7 @@ class VisualStepSummarizer(StepMemoryService):
|
|||||||
engine,
|
engine,
|
||||||
response,
|
response,
|
||||||
source=f"lens:visual_transition:{self._model_name}",
|
source=f"lens:visual_transition:{self._model_name}",
|
||||||
|
model=self._model_name,
|
||||||
update_last_prompt=False,
|
update_last_prompt=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ from artemis.mcp.action_specs import OPERATOR_SHELL_ORDER, operator_shell_tool
|
|||||||
from artemis.llm.usage import usage_from_message
|
from artemis.llm.usage import usage_from_message
|
||||||
from artemis.llm.structured import content_to_text
|
from artemis.llm.structured import content_to_text
|
||||||
from artemis.runtime.task_control import TaskControl, has_pending_instruction
|
from artemis.runtime.task_control import TaskControl, has_pending_instruction
|
||||||
from artemis.services.llm import acomplete, get_llm, invoke_llm_with_timeout_message
|
from artemis.services.llm import acomplete, get_llm, invoke_llm_with_timeout_message, with_fallback
|
||||||
from artemis.tools.command_tool import (
|
from artemis.tools.command_tool import (
|
||||||
analyze_task_output_wrapper,
|
analyze_task_output_wrapper,
|
||||||
get_adb_task_registry,
|
get_adb_task_registry,
|
||||||
@@ -638,9 +638,19 @@ class OperatorNode:
|
|||||||
and t.name not in {"plugin_load", "plugin_read_file", "plugin_read_result"}
|
and t.name not in {"plugin_load", "plugin_read_file", "plugin_read_result"}
|
||||||
]
|
]
|
||||||
traced_tools.extend(plugins.langchain_tools())
|
traced_tools.extend(plugins.langchain_tools())
|
||||||
bound_llm = active_llm.bind_tools(tools=traced_tools)
|
|
||||||
|
async def invoke(model):
|
||||||
|
bound = model.bind_tools(tools=traced_tools)
|
||||||
|
return await invoke_llm_with_timeout_message(acomplete(bound, current_messages))
|
||||||
|
|
||||||
interrupted, response = await self._await_or_pause(
|
interrupted, response = await self._await_or_pause(
|
||||||
invoke_llm_with_timeout_message(acomplete(bound_llm, current_messages))
|
invoke(active_llm)
|
||||||
|
if using_tool_fallback
|
||||||
|
else with_fallback(
|
||||||
|
lambda: invoke(base_llm),
|
||||||
|
lambda: invoke(get_llm(ctx=self.ctx, name="operator", use_fallback=True)),
|
||||||
|
none_should_fallback=False,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
if interrupted:
|
if interrupted:
|
||||||
return None, None, None, False
|
return None, None, None, False
|
||||||
|
|||||||
@@ -303,8 +303,19 @@ class PlannerNode:
|
|||||||
screen = await UnifiedMobileController(self.ctx).get_screen_data()
|
screen = await UnifiedMobileController(self.ctx).get_screen_data()
|
||||||
human_message_content.append({"type": "text", "text": screen.observation_text})
|
human_message_content.append({"type": "text", "text": screen.observation_text})
|
||||||
plugins = getattr(self.ctx, "plugins", None)
|
plugins = getattr(self.ctx, "plugins", None)
|
||||||
if plugins:
|
plugin_catalog = plugins.prompt() if plugins else ""
|
||||||
human_message_content.append({"type": "text", "text": plugins.prompt()})
|
if plugin_catalog:
|
||||||
|
human_message_content.append(
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"text": "规划与执行的工具分工:规划器只使用本阶段绑定的笔记工具制定计划;"
|
||||||
|
"下列插件清单描述执行器获授权的能力。执行器可以调用 plugin_load 加载插件。"
|
||||||
|
"规划器当前工具列表里没有 plugin_load 或设备动作,不表示执行器缺少这些能力。"
|
||||||
|
"将需要的插件、待观察的目标和验收条件写入计划,由执行器根据实际加载与操作回执"
|
||||||
|
"确认可用性;未取得回执时保留待确认,不预先记录为插件不可用或要求用户补授权。",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
human_message_content.append({"type": "text", "text": plugin_catalog})
|
||||||
if screenshot_b64:
|
if screenshot_b64:
|
||||||
human_message_content.append(
|
human_message_content.append(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ async def exec_action(
|
|||||||
return False, str(e)
|
return False, str(e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
from artemis.data_engine.evidence_sources import android_action_source
|
||||||
|
|
||||||
|
source = android_action_source(getattr(getattr(ctx, "device", None), "device_id", None))
|
||||||
|
if source:
|
||||||
|
action_item["source"] = source
|
||||||
res = await session.call(tool_name, wire_args)
|
res = await session.call(tool_name, wire_args)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
action_item.update(execution="unknown", side_effect="possible")
|
action_item.update(execution="unknown", side_effect="possible")
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|||||||
class ExplorationConfig(BaseModel):
|
class ExplorationConfig(BaseModel):
|
||||||
model_config = ConfigDict(extra="forbid")
|
model_config = ConfigDict(extra="forbid")
|
||||||
|
|
||||||
model: str = Field(default="gpt-6.1-sol", min_length=1, max_length=200)
|
model: str = Field(default="gpt-6.1-terra", min_length=1, max_length=200)
|
||||||
reasoning_effort: Literal[
|
reasoning_effort: Literal[
|
||||||
"default", "none", "minimal", "low", "medium", "high", "xhigh", "max"
|
"default", "none", "minimal", "low", "medium", "high", "xhigh", "max"
|
||||||
] = "high"
|
] = "high"
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class Settings(BaseSettings):
|
|||||||
"""Centralized ARTEMIS runtime settings loaded from environment and .env files."""
|
"""Centralized ARTEMIS runtime settings loaded from environment and .env files."""
|
||||||
|
|
||||||
ARTEMIS_PLUGIN_MARKETPLACE_URL: str = (
|
ARTEMIS_PLUGIN_MARKETPLACE_URL: str = (
|
||||||
"https://git.playones.com/chenmingxuan/Artemis-Plugins/raw/branch/main/catalog.json"
|
"https://git.playones.com/chenmingxuan/Artemis-Plugins/raw/branch/main/catalog-v4.json"
|
||||||
)
|
)
|
||||||
ARTEMIS_PLUGIN_START_TIMEOUT_SECONDS: float = Field(default=30, gt=0, le=300)
|
ARTEMIS_PLUGIN_START_TIMEOUT_SECONDS: float = Field(default=30, gt=0, le=300)
|
||||||
ARTEMIS_PLUGIN_TOOL_TIMEOUT_SECONDS: float = Field(default=60, gt=0, le=3600)
|
ARTEMIS_PLUGIN_TOOL_TIMEOUT_SECONDS: float = Field(default=60, gt=0, le=3600)
|
||||||
@@ -109,6 +109,8 @@ class Settings(BaseSettings):
|
|||||||
OPENAI_BASE_URL: str | None = "https://api-n-cd.playones.com/v1"
|
OPENAI_BASE_URL: str | None = "https://api-n-cd.playones.com/v1"
|
||||||
OPENAI_MODEL: str = Field(default=DEFAULT_MODEL, min_length=1)
|
OPENAI_MODEL: str = Field(default=DEFAULT_MODEL, min_length=1)
|
||||||
OPENAI_TIMEOUT_SECONDS: float = Field(default=300.0, gt=0)
|
OPENAI_TIMEOUT_SECONDS: float = Field(default=300.0, gt=0)
|
||||||
|
# Environment only; deliberately absent from the saved UI/task configuration.
|
||||||
|
OPENAI_USE_SYSTEM_PROXY: bool = False
|
||||||
OPENAI_MAX_RETRIES: int = Field(default=5, ge=0, le=10)
|
OPENAI_MAX_RETRIES: int = Field(default=5, ge=0, le=10)
|
||||||
OPENAI_RETRY_INTERVAL_SECONDS: float = Field(default=10.0, ge=0, le=300)
|
OPENAI_RETRY_INTERVAL_SECONDS: float = Field(default=10.0, ge=0, le=300)
|
||||||
OPENAI_RATE_LIMIT_RETRY_SECONDS: float = Field(default=60.0, ge=0, le=3600)
|
OPENAI_RATE_LIMIT_RETRY_SECONDS: float = Field(default=60.0, ge=0, le=3600)
|
||||||
|
|||||||
@@ -8,6 +8,58 @@ import json
|
|||||||
SOURCE_KINDS = {"android", "computer", "terminal", "api", "file", "other"}
|
SOURCE_KINDS = {"android", "computer", "terminal", "api", "file", "other"}
|
||||||
|
|
||||||
|
|
||||||
|
def android_action_source(device_id: object) -> dict | None:
|
||||||
|
"""Stamp a native action at dispatch, using its actual selected device."""
|
||||||
|
if not isinstance(device_id, str) or not device_id or device_id == "computer:local":
|
||||||
|
return None
|
||||||
|
return {"kind": "android", "target_id": device_id, "label": "安卓屏幕"}
|
||||||
|
|
||||||
|
|
||||||
|
def _android_screenshot_records(step: dict) -> list[dict]:
|
||||||
|
"""Project explicit capture receipts; never infer provenance from tool args."""
|
||||||
|
records = []
|
||||||
|
seen = set()
|
||||||
|
for tool in step.get("generic_tools") or []:
|
||||||
|
if not isinstance(tool, dict) or (
|
||||||
|
tool.get("type"),
|
||||||
|
tool.get("name"),
|
||||||
|
tool.get("status"),
|
||||||
|
) != ("tool", "android_file", "success"):
|
||||||
|
continue
|
||||||
|
payload = tool.get("payload")
|
||||||
|
receipt = payload.get("result") if isinstance(payload, dict) else None
|
||||||
|
if not isinstance(receipt, dict) or (
|
||||||
|
receipt.get("ok") is not True
|
||||||
|
or receipt.get("verified") is not True
|
||||||
|
or receipt.get("action") != "screenshot"
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
serial, path, digest = (
|
||||||
|
receipt.get("device_serial"),
|
||||||
|
receipt.get("trace_path"),
|
||||||
|
receipt.get("sha256"),
|
||||||
|
)
|
||||||
|
if not all(isinstance(value, str) and value for value in (serial, path, digest)):
|
||||||
|
continue
|
||||||
|
captured_at = receipt.get("captured_at")
|
||||||
|
captured_at = captured_at if isinstance(captured_at, str) else None
|
||||||
|
key = (serial, path, digest, captured_at)
|
||||||
|
if key in seen:
|
||||||
|
# Nested tool decorators can record the same completed capture twice.
|
||||||
|
continue
|
||||||
|
seen.add(key)
|
||||||
|
records.append(
|
||||||
|
{
|
||||||
|
"source": {"kind": "android", "target_id": serial, "label": "安卓屏幕"},
|
||||||
|
"trace_id": tool.get("trace_id"),
|
||||||
|
"artifact_path": path,
|
||||||
|
"sha256": digest,
|
||||||
|
"captured_at": captured_at,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return records
|
||||||
|
|
||||||
|
|
||||||
def _step_reference(step: dict) -> dict:
|
def _step_reference(step: dict) -> dict:
|
||||||
value = step.get("step_id")
|
value = step.get("step_id")
|
||||||
return {
|
return {
|
||||||
@@ -16,6 +68,19 @@ def _step_reference(step: dict) -> dict:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _represented_capture(action: dict, captures: list[dict]) -> bool:
|
||||||
|
if action.get("action") != "android_file":
|
||||||
|
return False
|
||||||
|
args = action.get("args") or {}
|
||||||
|
if not isinstance(args, dict) or args.get("action") != "screenshot":
|
||||||
|
return False
|
||||||
|
filename = args.get("filename")
|
||||||
|
return any(
|
||||||
|
capture["artifact_path"].replace("\\", "/").rsplit("/", 1)[-1] == filename
|
||||||
|
for capture in captures
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def recorded_sources(steps: list[dict], *, limit: int = 100) -> dict:
|
def recorded_sources(steps: list[dict], *, limit: int = 100) -> dict:
|
||||||
sources = {}
|
sources = {}
|
||||||
unattributed = []
|
unattributed = []
|
||||||
@@ -23,7 +88,23 @@ def recorded_sources(steps: list[dict], *, limit: int = 100) -> dict:
|
|||||||
result = step.get("last_execution_result")
|
result = step.get("last_execution_result")
|
||||||
execution = result.get("execution") if isinstance(result, dict) else None
|
execution = result.get("execution") if isinstance(result, dict) else None
|
||||||
records = execution if isinstance(execution, list) else step.get("action_taken")
|
records = execution if isinstance(execution, list) else step.get("action_taken")
|
||||||
records = records if isinstance(records, list) else [records]
|
records = records if isinstance(records, list) else [records] if records else []
|
||||||
|
captures = _android_screenshot_records(step)
|
||||||
|
records = [
|
||||||
|
record
|
||||||
|
for record in records
|
||||||
|
if not isinstance(record, dict)
|
||||||
|
or (
|
||||||
|
record.get("action")
|
||||||
|
not in {"save_note", "read_note", "list_notes", "report_task_status"}
|
||||||
|
and not _represented_capture(record, captures)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
records = [*records, *captures]
|
||||||
|
if not records:
|
||||||
|
# A planning or completion turn with no recorded action is not a
|
||||||
|
# missing action source. Screenshots alone do not supply provenance.
|
||||||
|
continue
|
||||||
found = False
|
found = False
|
||||||
missing = False
|
missing = False
|
||||||
for record in records:
|
for record in records:
|
||||||
@@ -39,6 +120,7 @@ def recorded_sources(steps: list[dict], *, limit: int = 100) -> dict:
|
|||||||
continue
|
continue
|
||||||
found = True
|
found = True
|
||||||
plugin = str(record.get("plugin_id") or "")[:100]
|
plugin = str(record.get("plugin_id") or "")[:100]
|
||||||
|
label = str(source.get("label") or "")[:500]
|
||||||
key = (plugin, kind, target[:256])
|
key = (plugin, kind, target[:256])
|
||||||
if key not in sources:
|
if key not in sources:
|
||||||
sources[key] = {
|
sources[key] = {
|
||||||
@@ -46,18 +128,30 @@ def recorded_sources(steps: list[dict], *, limit: int = 100) -> dict:
|
|||||||
"kind": kind,
|
"kind": kind,
|
||||||
"plugin_id": plugin,
|
"plugin_id": plugin,
|
||||||
"target_id": target[:256],
|
"target_id": target[:256],
|
||||||
"label": str(source.get("label") or "")[:500],
|
"label": label,
|
||||||
"category": "interface" if kind in {"android", "computer"} else "auxiliary",
|
"category": "interface" if kind in {"android", "computer"} else "auxiliary",
|
||||||
"references": [],
|
"references": [],
|
||||||
"reference_count": 0,
|
"reference_count": 0,
|
||||||
}
|
}
|
||||||
reference = _step_reference(step)
|
reference = _step_reference(step)
|
||||||
for field in ("call_id", "source_id"):
|
for field in (
|
||||||
|
"call_id",
|
||||||
|
"source_id",
|
||||||
|
"trace_id",
|
||||||
|
"artifact_path",
|
||||||
|
"sha256",
|
||||||
|
"captured_at",
|
||||||
|
):
|
||||||
if isinstance(record.get(field), str) and record[field]:
|
if isinstance(record.get(field), str) and record[field]:
|
||||||
reference[field] = record[field][:256]
|
reference[field] = record[field][: 2048 if field == "artifact_path" else 256]
|
||||||
if isinstance(record.get("read_only"), bool):
|
if isinstance(record.get("read_only"), bool):
|
||||||
reference["read_only"] = record["read_only"]
|
reference["read_only"] = record["read_only"]
|
||||||
entry = sources[key]
|
entry = sources[key]
|
||||||
|
if not entry.get("label_varies") and entry["label"] != label:
|
||||||
|
# The same window can navigate between tabs/pages. Its first
|
||||||
|
# title is not a valid label for all later evidence.
|
||||||
|
entry["label"] = ""
|
||||||
|
entry["label_varies"] = True
|
||||||
entry["reference_count"] += 1
|
entry["reference_count"] += 1
|
||||||
if len(entry["references"]) < 8:
|
if len(entry["references"]) < 8:
|
||||||
entry["references"].append(reference)
|
entry["references"].append(reference)
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ async def execute_task(
|
|||||||
config.with_graph_config_callbacks(graph_config_callbacks)
|
config.with_graph_config_callbacks(graph_config_callbacks)
|
||||||
|
|
||||||
agent: Agent | None = None
|
agent: Agent | None = None
|
||||||
|
task_started = False
|
||||||
try:
|
try:
|
||||||
agent = Agent(config=config.build(), session_id=effective_sid)
|
agent = Agent(config=config.build(), session_id=effective_sid)
|
||||||
await agent.init(
|
await agent.init(
|
||||||
@@ -196,7 +197,14 @@ async def execute_task(
|
|||||||
request.plugins = plugins
|
request.plugins = plugins
|
||||||
elif plugin_choices is not None:
|
elif plugin_choices is not None:
|
||||||
request.plugins = TypeAdapter(list[PluginSelection]).validate_json(plugin_choices)
|
request.plugins = TypeAdapter(list[PluginSelection]).validate_json(plugin_choices)
|
||||||
|
task_started = True
|
||||||
await agent.run_task(request=request)
|
await agent.run_task(request=request)
|
||||||
|
except Exception as exc:
|
||||||
|
if not task_started and effective_sid:
|
||||||
|
from artemis.runtime.task_result import save_failure_result
|
||||||
|
|
||||||
|
save_failure_result(str(effective_sid), str(exc), code="initialization_failed")
|
||||||
|
raise
|
||||||
finally:
|
finally:
|
||||||
if agent is not None:
|
if agent is not None:
|
||||||
await agent.clean()
|
await agent.clean()
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
"""Environment-only network policy shared by model calls and credential checks."""
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from artemis.config.settings import settings
|
||||||
|
|
||||||
|
|
||||||
|
def model_http_options() -> dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"trust_env": settings.OPENAI_USE_SYSTEM_PROXY,
|
||||||
|
# Proxy opt-out must not disable configured CA certificates or TLS checks.
|
||||||
|
"verify": httpx.create_ssl_context(trust_env=True),
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import StrEnum
|
from enum import StrEnum
|
||||||
import random
|
import random
|
||||||
|
import re
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
@@ -124,6 +125,11 @@ def classify_failure(error: BaseException) -> Failure:
|
|||||||
# Programmer/request errors: retrying is useless and falling back only
|
# Programmer/request errors: retrying is useless and falling back only
|
||||||
# hides the bug inside a different model's output.
|
# hides the bug inside a different model's output.
|
||||||
return Failure(FailureCategory.BAD_REQUEST, False, False)
|
return Failure(FailureCategory.BAD_REQUEST, False, False)
|
||||||
|
# langchain-openai 1.7 raises this ValueError for a response.failed event
|
||||||
|
# without provider error details, before our completion guard sees it.
|
||||||
|
# Preserve the bounded invalid-output retry policy for these failed streams.
|
||||||
|
if isinstance(error, ValueError) and re.fullmatch(r"Response \S+ failed\.", str(error)):
|
||||||
|
return Failure(FailureCategory.INVALID_OUTPUT, True, True)
|
||||||
return Failure(FailureCategory.UNKNOWN, True, True)
|
return Failure(FailureCategory.UNKNOWN, True, True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class ModelEndpoint(BaseModel):
|
|||||||
self.reasoning_effort,
|
self.reasoning_effort,
|
||||||
self.enable_grounding,
|
self.enable_grounding,
|
||||||
self.api_base or settings.OPENAI_BASE_URL,
|
self.api_base or settings.OPENAI_BASE_URL,
|
||||||
|
settings.OPENAI_USE_SYSTEM_PROXY,
|
||||||
hashlib.sha256(key.encode()).hexdigest(),
|
hashlib.sha256(key.encode()).hexdigest(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -87,9 +88,10 @@ class ModelFactory:
|
|||||||
)
|
)
|
||||||
|
|
||||||
from langchain_openai import ChatOpenAI
|
from langchain_openai import ChatOpenAI
|
||||||
from openai import DefaultAsyncHttpxClient
|
from openai import DefaultAsyncHttpxClient, DefaultHttpxClient
|
||||||
|
|
||||||
from artemis.llm.diagnostics import observe_request_headers, observe_response_headers
|
from artemis.llm.diagnostics import observe_request_headers, observe_response_headers
|
||||||
|
from artemis.llm.http import model_http_options
|
||||||
|
|
||||||
api_key = endpoint.api_key or (
|
api_key = endpoint.api_key or (
|
||||||
settings.OPENAI_API_KEY.get_secret_value() if settings.OPENAI_API_KEY else None
|
settings.OPENAI_API_KEY.get_secret_value() if settings.OPENAI_API_KEY else None
|
||||||
@@ -112,8 +114,14 @@ class ModelFactory:
|
|||||||
"use_responses_api": True,
|
"use_responses_api": True,
|
||||||
"output_version": "responses/v1",
|
"output_version": "responses/v1",
|
||||||
"store": False,
|
"store": False,
|
||||||
|
# The explicit clients own proxy policy, including the synchronous path.
|
||||||
|
"openai_proxy": "",
|
||||||
|
"http_client": DefaultHttpxClient(
|
||||||
|
timeout=endpoint.timeout_seconds, **model_http_options()
|
||||||
|
),
|
||||||
"http_async_client": DefaultAsyncHttpxClient(
|
"http_async_client": DefaultAsyncHttpxClient(
|
||||||
timeout=endpoint.timeout_seconds,
|
timeout=endpoint.timeout_seconds,
|
||||||
|
**model_http_options(),
|
||||||
event_hooks={
|
event_hooks={
|
||||||
"request": [observe_request_headers],
|
"request": [observe_request_headers],
|
||||||
"response": [observe_response_headers],
|
"response": [observe_response_headers],
|
||||||
|
|||||||
@@ -280,6 +280,11 @@ class McpActionExecutor:
|
|||||||
) -> ToolExecutionResult:
|
) -> ToolExecutionResult:
|
||||||
span = TraceSpan(name=raw_name, trace_type="action", ctx=self.ctx)
|
span = TraceSpan(name=raw_name, trace_type="action", ctx=self.ctx)
|
||||||
span.payload = {"args": args}
|
span.payload = {"args": args}
|
||||||
|
from artemis.data_engine.evidence_sources import android_action_source
|
||||||
|
|
||||||
|
source = android_action_source(
|
||||||
|
getattr(getattr(self.ctx, "device", None), "device_id", None)
|
||||||
|
)
|
||||||
|
|
||||||
message = ""
|
message = ""
|
||||||
res: ActionResult | None = None
|
res: ActionResult | None = None
|
||||||
@@ -291,6 +296,7 @@ class McpActionExecutor:
|
|||||||
observation_settled: bool | None = None
|
observation_settled: bool | None = None
|
||||||
input_verification: str | None = None
|
input_verification: str | None = None
|
||||||
expected_input: str | None = None
|
expected_input: str | None = None
|
||||||
|
dispatched = False
|
||||||
with span:
|
with span:
|
||||||
try:
|
try:
|
||||||
session = await self._session_or_start()
|
session = await self._session_or_start()
|
||||||
@@ -315,6 +321,7 @@ class McpActionExecutor:
|
|||||||
or observation_anchor(state, index_elements)
|
or observation_anchor(state, index_elements)
|
||||||
)
|
)
|
||||||
extension = raw_name not in (REQUIRED_ACTIONS | OPTIONAL_ACTIONS)
|
extension = raw_name not in (REQUIRED_ACTIONS | OPTIONAL_ACTIONS)
|
||||||
|
dispatched = True
|
||||||
if extension:
|
if extension:
|
||||||
raw_result = await session.call_raw(wire_name, wire_args)
|
raw_result = await session.call_raw(wire_name, wire_args)
|
||||||
message = next(
|
message = next(
|
||||||
@@ -386,6 +393,7 @@ class McpActionExecutor:
|
|||||||
"post_image_name": post_image_name,
|
"post_image_name": post_image_name,
|
||||||
"has_xml": bool(xml_list),
|
"has_xml": bool(xml_list),
|
||||||
"status": status,
|
"status": status,
|
||||||
|
**({"source": source} if source and dispatched else {}),
|
||||||
}
|
}
|
||||||
if status == "error":
|
if status == "error":
|
||||||
span.status = "failed"
|
span.status = "failed"
|
||||||
@@ -400,6 +408,7 @@ class McpActionExecutor:
|
|||||||
screenshot_path=shot_path,
|
screenshot_path=shot_path,
|
||||||
ui_elements_text=xml_list,
|
ui_elements_text=xml_list,
|
||||||
metadata={
|
metadata={
|
||||||
|
**({"source": source} if source and dispatched else {}),
|
||||||
"code": res.code.value,
|
"code": res.code.value,
|
||||||
"normalized_coordinates": res.normalized_coordinates,
|
"normalized_coordinates": res.normalized_coordinates,
|
||||||
"target_semantics": target_semantics,
|
"target_semantics": target_semantics,
|
||||||
|
|||||||
@@ -532,6 +532,7 @@ class StepCapsuleLens(StepLens):
|
|||||||
engine,
|
engine,
|
||||||
response,
|
response,
|
||||||
source=f"lens:step_capsule:{model_label}",
|
source=f"lens:step_capsule:{model_label}",
|
||||||
|
model=model_label if model_label != "fallback" else None,
|
||||||
update_last_prompt=False,
|
update_last_prompt=False,
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
|||||||
@@ -43,7 +43,13 @@ def download(url: str, progress: Callable[[str, int], None]) -> bytes:
|
|||||||
|
|
||||||
|
|
||||||
def load_catalog() -> PluginCatalog:
|
def load_catalog() -> PluginCatalog:
|
||||||
data = download(settings.ARTEMIS_PLUGIN_MARKETPLACE_URL, lambda *_: None)
|
url = settings.ARTEMIS_PLUGIN_MARKETPLACE_URL
|
||||||
|
# Strict older hosts cannot parse newer panel kinds, even if incompatible.
|
||||||
|
# Preserve their indexes; upgrade only the exact official saved addresses.
|
||||||
|
official = "https://git.playones.com/chenmingxuan/Artemis-Plugins/raw/branch/main/"
|
||||||
|
if url in {official + "catalog.json", official + "catalog-v3.json"}:
|
||||||
|
url = official + "catalog-v4.json"
|
||||||
|
data = download(url, lambda *_: None)
|
||||||
if len(data) > 2 * 1024 * 1024:
|
if len(data) > 2 * 1024 * 1024:
|
||||||
raise ValueError("市场索引过大")
|
raise ValueError("市场索引过大")
|
||||||
return PluginCatalog.model_validate_json(data)
|
return PluginCatalog.model_validate_json(data)
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ from packaging.specifiers import SpecifierSet
|
|||||||
from packaging.version import Version
|
from packaging.version import Version
|
||||||
from pydantic import BaseModel, ConfigDict, Field, SecretStr, field_validator, model_validator
|
from pydantic import BaseModel, ConfigDict, Field, SecretStr, field_validator, model_validator
|
||||||
|
|
||||||
|
from artemis.plugins.workspace import WorkspaceContribution
|
||||||
|
|
||||||
Identifier = Annotated[str, Field(pattern=r"^[a-z][a-z0-9_-]{0,47}$")]
|
Identifier = Annotated[str, Field(pattern=r"^[a-z][a-z0-9_-]{0,47}$")]
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +96,7 @@ class EvidenceSource(PluginModel):
|
|||||||
|
|
||||||
|
|
||||||
class PluginManifest(PluginModel):
|
class PluginManifest(PluginModel):
|
||||||
schema_version: Literal[1, 2] = 1
|
schema_version: Literal[1, 2, 3] = 1
|
||||||
id: Identifier
|
id: Identifier
|
||||||
name: str = Field(min_length=1, max_length=100)
|
name: str = Field(min_length=1, max_length=100)
|
||||||
version: str
|
version: str
|
||||||
@@ -113,6 +115,7 @@ class PluginManifest(PluginModel):
|
|||||||
targets: list[ExecutionTarget] = Field(default_factory=lambda: ["mixed"])
|
targets: list[ExecutionTarget] = Field(default_factory=lambda: ["mixed"])
|
||||||
observation: PluginObservation | None = None
|
observation: PluginObservation | None = None
|
||||||
capabilities: PluginCapabilities | None = None
|
capabilities: PluginCapabilities | None = None
|
||||||
|
workspace: WorkspaceContribution | None = None
|
||||||
|
|
||||||
@field_validator("version")
|
@field_validator("version")
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -130,14 +133,16 @@ class PluginManifest(PluginModel):
|
|||||||
|
|
||||||
@model_validator(mode="after")
|
@model_validator(mode="after")
|
||||||
def has_capability(self):
|
def has_capability(self):
|
||||||
if self.server is None and self.skill is None:
|
if self.server is None and self.skill is None and self.workspace is None:
|
||||||
raise ValueError("插件至少需要 MCP 服务或 Skill")
|
raise ValueError("插件至少需要 MCP 服务、Skill 或工作区扩展")
|
||||||
|
if self.workspace is not None and self.schema_version != 3:
|
||||||
|
raise ValueError("工作区扩展需要 schema_version=3")
|
||||||
for name, field in self.config.items():
|
for name, field in self.config.items():
|
||||||
if field.secret and field.default:
|
if field.secret and field.default:
|
||||||
raise ValueError(f"密钥字段 {name} 不允许默认值")
|
raise ValueError(f"密钥字段 {name} 不允许默认值")
|
||||||
if self.schema_version == 1 and self.capabilities is not None:
|
if self.schema_version == 1 and self.capabilities is not None:
|
||||||
raise ValueError("能力契约需要 schema_version=2;旧清单保持兼容")
|
raise ValueError("能力契约需要 schema_version=2;旧清单保持兼容")
|
||||||
if self.schema_version == 2:
|
if self.schema_version >= 2:
|
||||||
if self.capabilities is None:
|
if self.capabilities is None:
|
||||||
raise ValueError("第二版插件必须声明 capabilities")
|
raise ValueError("第二版插件必须声明 capabilities")
|
||||||
if self.observation:
|
if self.observation:
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ class PluginStore:
|
|||||||
if not existing:
|
if not existing:
|
||||||
profile = PluginProfile(
|
profile = PluginProfile(
|
||||||
is_default=True,
|
is_default=True,
|
||||||
|
authorized=manifest.server is None and manifest.skill is None,
|
||||||
values={k: v.default for k, v in manifest.config.items() if not v.secret},
|
values={k: v.default for k, v in manifest.config.items() if not v.secret},
|
||||||
)
|
)
|
||||||
db.execute(
|
db.execute(
|
||||||
@@ -236,6 +237,8 @@ class PluginStore:
|
|||||||
def selections(self, target: str = "mixed") -> list[PluginSelection]:
|
def selections(self, target: str = "mixed") -> list[PluginSelection]:
|
||||||
selections = []
|
selections = []
|
||||||
for plugin in self.list():
|
for plugin in self.list():
|
||||||
|
if not plugin["manifest"].get("server") and not plugin["manifest"].get("skill"):
|
||||||
|
continue
|
||||||
if not plugin["enabled"] or not self._supports_task(
|
if not plugin["enabled"] or not self._supports_task(
|
||||||
plugin["manifest"].get("targets", ["mixed"]), target
|
plugin["manifest"].get("targets", ["mixed"]), target
|
||||||
):
|
):
|
||||||
@@ -264,6 +267,8 @@ class PluginStore:
|
|||||||
pinned = []
|
pinned = []
|
||||||
for choice in self.selections(target) if selections is None else selections:
|
for choice in self.selections(target) if selections is None else selections:
|
||||||
manifest, profile, _ = self.resolve(choice)
|
manifest, profile, _ = self.resolve(choice)
|
||||||
|
if manifest.server is None and manifest.skill is None:
|
||||||
|
raise ValueError(f"插件 {manifest.name} 是工作区扩展,无需加入执行任务")
|
||||||
if not self._supports_task(manifest.targets, target):
|
if not self._supports_task(manifest.targets, target):
|
||||||
raise ValueError(f"插件 {manifest.name} 不支持 {target} 任务")
|
raise ValueError(f"插件 {manifest.name} 不支持 {target} 任务")
|
||||||
pinned.append(
|
pinned.append(
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
"""Declarative workspace contributions; no plugin JavaScript or model execution."""
|
||||||
|
|
||||||
|
from typing import Literal
|
||||||
|
|
||||||
|
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
||||||
|
|
||||||
|
|
||||||
|
class WorkspaceModel(BaseModel):
|
||||||
|
model_config = ConfigDict(extra="forbid")
|
||||||
|
|
||||||
|
|
||||||
|
class PanelWidth(WorkspaceModel):
|
||||||
|
preferred: int = Field(default=340, ge=200, le=1000)
|
||||||
|
minimum: int = Field(default=240, ge=160, le=800)
|
||||||
|
maximum: int = Field(default=480, ge=200, le=1200)
|
||||||
|
|
||||||
|
@model_validator(mode="after")
|
||||||
|
def ordered(self):
|
||||||
|
if not self.minimum <= self.preferred <= self.maximum:
|
||||||
|
raise ValueError("面板宽度必须满足 minimum ≤ preferred ≤ maximum")
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
class WorkspaceField(WorkspaceModel):
|
||||||
|
id: str = Field(pattern=r"^[a-z][a-z0-9_]{0,47}$")
|
||||||
|
label: str = Field(min_length=1, max_length=100)
|
||||||
|
description: str = Field(default="", max_length=1000)
|
||||||
|
kind: Literal["choice", "text"]
|
||||||
|
options: list[str] = Field(default_factory=list, max_length=12)
|
||||||
|
max_length: int = Field(default=2000, ge=1, le=10000)
|
||||||
|
report: bool = True
|
||||||
|
|
||||||
|
@model_validator(mode="after")
|
||||||
|
def valid_options(self):
|
||||||
|
if self.kind == "choice" and not self.options:
|
||||||
|
raise ValueError("选择字段必须声明 options")
|
||||||
|
if self.kind == "text" and self.options:
|
||||||
|
raise ValueError("文本字段不接受 options")
|
||||||
|
if len(set(self.options)) != len(self.options) or any(
|
||||||
|
not option.strip() or len(option) > min(100, self.max_length) for option in self.options
|
||||||
|
):
|
||||||
|
raise ValueError("选项必须非空、唯一且不超过长度限制")
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
class WorkspacePanel(WorkspaceModel):
|
||||||
|
id: str = Field(pattern=r"^[a-z][a-z0-9_]{0,47}$")
|
||||||
|
title: str = Field(min_length=1, max_length=100)
|
||||||
|
side: Literal["left", "right"]
|
||||||
|
kind: Literal["initial_prompt", "original_case", "form"]
|
||||||
|
width: PanelWidth = Field(default_factory=PanelWidth)
|
||||||
|
|
||||||
|
|
||||||
|
class WorkspaceContribution(WorkspaceModel):
|
||||||
|
panels: list[WorkspacePanel] = Field(min_length=1, max_length=2)
|
||||||
|
fields: list[WorkspaceField] = Field(default_factory=list, max_length=20)
|
||||||
|
|
||||||
|
@model_validator(mode="after")
|
||||||
|
def unique_contributions(self):
|
||||||
|
if len({panel.id for panel in self.panels}) != len(self.panels) or len(
|
||||||
|
{panel.kind for panel in self.panels}
|
||||||
|
) != len(self.panels):
|
||||||
|
raise ValueError("面板 id 和 kind 不得重复")
|
||||||
|
if len({field.id for field in self.fields}) != len(self.fields):
|
||||||
|
raise ValueError("工作区字段 id 不得重复")
|
||||||
|
if bool(self.fields) != any(panel.kind == "form" for panel in self.panels):
|
||||||
|
raise ValueError("表单面板与 fields 必须同时声明")
|
||||||
|
return self
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
},
|
},
|
||||||
"agent": {
|
"agent": {
|
||||||
"exploration": {
|
"exploration": {
|
||||||
"model": "${env:ARTEMIS_EXPLORATION_MODEL:-gpt-6.1-sol}",
|
"model": "${env:ARTEMIS_EXPLORATION_MODEL:-gpt-6.1-terra}",
|
||||||
"reasoning_effort": "${env:ARTEMIS_EXPLORATION_REASONING_EFFORT:-high}",
|
"reasoning_effort": "${env:ARTEMIS_EXPLORATION_REASONING_EFFORT:-high}",
|
||||||
"timeout_seconds": "${env:ARTEMIS_EXPLORATION_TIMEOUT_SECONDS:-1800}",
|
"timeout_seconds": "${env:ARTEMIS_EXPLORATION_TIMEOUT_SECONDS:-1800}",
|
||||||
"demonstration_timeout_seconds": "${env:ARTEMIS_DEMONSTRATION_TIMEOUT_SECONDS:-900}",
|
"demonstration_timeout_seconds": "${env:ARTEMIS_DEMONSTRATION_TIMEOUT_SECONDS:-900}",
|
||||||
|
|||||||
@@ -101,7 +101,10 @@ def _configure_usb_stay_awake(device_id: str) -> str | None:
|
|||||||
# Migration cleanup belongs to the long-lived host. A queued task worker
|
# Migration cleanup belongs to the long-lived host. A queued task worker
|
||||||
# must not wait on another process's optional legacy wake-lock cleanup.
|
# must not wait on another process's optional legacy wake-lock cleanup.
|
||||||
if os.environ.get("ARTEMIS_TASK_WORKER") != "1":
|
if os.environ.get("ARTEMIS_TASK_WORKER") != "1":
|
||||||
|
try:
|
||||||
ScreenAwakeLease(device_id).cleanup_unowned_references()
|
ScreenAwakeLease(device_id).cleanup_unowned_references()
|
||||||
|
except OSError as exc:
|
||||||
|
logger.warning(f"Could not prepare optional legacy awake cleanup on {device_id}: {exc}")
|
||||||
|
|
||||||
commands = (
|
commands = (
|
||||||
(
|
(
|
||||||
@@ -209,6 +212,7 @@ class ScreenAwakeService:
|
|||||||
self._monitor_thread: threading.Thread | None = None
|
self._monitor_thread: threading.Thread | None = None
|
||||||
self._shutdown_requested = False
|
self._shutdown_requested = False
|
||||||
self._owners: dict[str, FileLock] = {}
|
self._owners: dict[str, FileLock] = {}
|
||||||
|
self._ownership_warnings: set[str] = set()
|
||||||
|
|
||||||
def start(self, device_ids: Iterable[str] | None = None) -> dict[str, str | None]:
|
def start(self, device_ids: Iterable[str] | None = None) -> dict[str, str | None]:
|
||||||
if self._shutdown_requested:
|
if self._shutdown_requested:
|
||||||
@@ -241,13 +245,24 @@ class ScreenAwakeService:
|
|||||||
existing = self._strategies.get(device_id)
|
existing = self._strategies.get(device_id)
|
||||||
if existing is not None:
|
if existing is not None:
|
||||||
return existing
|
return existing
|
||||||
owner = _owner_lock(device_id)
|
|
||||||
try:
|
try:
|
||||||
|
owner = _owner_lock(device_id)
|
||||||
owner.acquire(timeout=0)
|
owner.acquire(timeout=0)
|
||||||
except Timeout:
|
except Timeout:
|
||||||
# Do not cache a follower as owner: discovery can take over if
|
# Do not cache a follower as owner: discovery can take over if
|
||||||
# the process holding the OS lock exits or releases the device.
|
# the process holding the OS lock exits or releases the device.
|
||||||
return None
|
return None
|
||||||
|
except OSError as exc:
|
||||||
|
# Awake is optional. Never bypass ownership or let an ACL / I/O
|
||||||
|
# failure abort device connection, resume, or the host monitor.
|
||||||
|
if device_id not in self._ownership_warnings:
|
||||||
|
logger.warning(
|
||||||
|
f"Could not acquire awake ownership on {device_id}; skipping optional "
|
||||||
|
f"stay-awake policy: {exc}"
|
||||||
|
)
|
||||||
|
self._ownership_warnings.add(device_id)
|
||||||
|
return None
|
||||||
|
self._ownership_warnings.discard(device_id)
|
||||||
try:
|
try:
|
||||||
strategy = _configure_usb_stay_awake(device_id)
|
strategy = _configure_usb_stay_awake(device_id)
|
||||||
except BaseException:
|
except BaseException:
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ from typing import Any
|
|||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
|
from filelock import FileLock
|
||||||
|
|
||||||
from artemis.config.constants import ENV_ARTEMIS_HELPER_AUTO_INSTALL
|
from artemis.config.constants import ENV_ARTEMIS_HELPER_AUTO_INSTALL
|
||||||
from artemis.config.paths import get_temp_dir
|
from artemis.config.paths import get_temp_dir
|
||||||
from artemis.runtime.adb_endpoint import adb_command
|
from artemis.runtime.adb_endpoint import adb_command
|
||||||
@@ -323,7 +325,7 @@ class AccessibilityHelperManager:
|
|||||||
if re.fullmatch(r"[0-9a-f]{32,128}", text):
|
if re.fullmatch(r"[0-9a-f]{32,128}", text):
|
||||||
self._token = text
|
self._token = text
|
||||||
return text
|
return text
|
||||||
except OSError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
token = secrets.token_hex(24)
|
token = secrets.token_hex(24)
|
||||||
try:
|
try:
|
||||||
@@ -550,6 +552,15 @@ class AccessibilityHelperManager:
|
|||||||
root.mkdir(parents=True, exist_ok=True)
|
root.mkdir(parents=True, exist_ok=True)
|
||||||
digest = hashlib.sha256(serial.encode("utf-8")).hexdigest()[:16]
|
digest = hashlib.sha256(serial.encode("utf-8")).hexdigest()[:16]
|
||||||
path = root / f"{digest}.mutex"
|
path = root / f"{digest}.mutex"
|
||||||
|
# An age-based lease alone can be stolen from a live, delayed owner.
|
||||||
|
# Retain the legacy lease for coexistence with older Artemis processes,
|
||||||
|
# but serialize current processes with a kernel lock released on exit.
|
||||||
|
with FileLock(path.with_suffix(".guard"), timeout=_PROVISION_MUTEX_TIMEOUT_SECONDS):
|
||||||
|
with self._legacy_provision_mutex(path, serial):
|
||||||
|
yield
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def _legacy_provision_mutex(self, path: Path, serial: str):
|
||||||
started = time.monotonic()
|
started = time.monotonic()
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
|||||||
+20
-9
@@ -209,7 +209,10 @@ class Agent:
|
|||||||
raise ValueError("任务目标必须是 android、computer 或 mixed")
|
raise ValueError("任务目标必须是 android、computer 或 mixed")
|
||||||
self._execution_target = execution_target
|
self._execution_target = execution_target
|
||||||
if execution_target == "computer":
|
if execution_target == "computer":
|
||||||
|
from artemis.platform import platform as pal_platform
|
||||||
|
|
||||||
self._device_context = DeviceContext(
|
self._device_context = DeviceContext(
|
||||||
|
host_platform=pal_platform.os_type.name,
|
||||||
device_id="computer:local",
|
device_id="computer:local",
|
||||||
mobile_platform=DevicePlatform.COMPUTER,
|
mobile_platform=DevicePlatform.COMPUTER,
|
||||||
device_width=0,
|
device_width=0,
|
||||||
@@ -584,6 +587,7 @@ class Agent:
|
|||||||
or getattr(getattr(task, "request", None), "task_name", None)
|
or getattr(getattr(task, "request", None), "task_name", None)
|
||||||
)
|
)
|
||||||
device_lock = None
|
device_lock = None
|
||||||
|
execution_started = False
|
||||||
try:
|
try:
|
||||||
# Construct the runtime only inside the task's cleanup boundary. A
|
# Construct the runtime only inside the task's cleanup boundary. A
|
||||||
# cancelled queue wait or setup failure must not leave version pins.
|
# cancelled queue wait or setup failure must not leave version pins.
|
||||||
@@ -761,6 +765,7 @@ class Agent:
|
|||||||
publish_startup_progress(
|
publish_startup_progress(
|
||||||
"environment_ready", "Device environment is ready", session_id=str(sess_id)
|
"environment_ready", "Device environment is ready", session_id=str(sess_id)
|
||||||
)
|
)
|
||||||
|
execution_started = True
|
||||||
try:
|
try:
|
||||||
if request.profile and request.profile.lower() == "flash":
|
if request.profile and request.profile.lower() == "flash":
|
||||||
logger.info(f"[{task_name}] Invoking FlashRunner reactive loop...")
|
logger.info(f"[{task_name}] Invoking FlashRunner reactive loop...")
|
||||||
@@ -792,7 +797,7 @@ class Agent:
|
|||||||
|
|
||||||
status = flash_result.get("status")
|
status = flash_result.get("status")
|
||||||
if status == "completed":
|
if status == "completed":
|
||||||
logger.info(f"✅ Automation '{task_name}' is success ✅")
|
logger.info(f"Automation '{task_name}' execution completed.")
|
||||||
await task.finalize(content=output, state=last_state_snapshot)
|
await task.finalize(content=output, state=last_state_snapshot)
|
||||||
if context.data_engine:
|
if context.data_engine:
|
||||||
context.data_engine.end_session("completed")
|
context.data_engine.end_session("completed")
|
||||||
@@ -907,7 +912,7 @@ class Agent:
|
|||||||
" see the test summary."
|
" see the test summary."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.info(f"✅ Automation '{task_name}' is success ✅")
|
logger.info(f"Automation '{task_name}' execution completed.")
|
||||||
await task.finalize(content=output, state=last_state_snapshot)
|
await task.finalize(content=output, state=last_state_snapshot)
|
||||||
if context.data_engine:
|
if context.data_engine:
|
||||||
context.data_engine.end_session("completed")
|
context.data_engine.end_session("completed")
|
||||||
@@ -972,7 +977,11 @@ class Agent:
|
|||||||
from artemis.runtime.task_result import save_failure_result
|
from artemis.runtime.task_result import save_failure_result
|
||||||
|
|
||||||
if sess_id:
|
if sess_id:
|
||||||
save_failure_result(str(sess_id), err)
|
save_failure_result(
|
||||||
|
str(sess_id),
|
||||||
|
err,
|
||||||
|
code="execution_failed" if execution_started else "initialization_failed",
|
||||||
|
)
|
||||||
if context.data_engine:
|
if context.data_engine:
|
||||||
context.data_engine.end_session("failed")
|
context.data_engine.end_session("failed")
|
||||||
|
|
||||||
@@ -1681,13 +1690,15 @@ def attach_test_summary(output, run_outcome: dict | None):
|
|||||||
|
|
||||||
|
|
||||||
def resolve_trace_suffix(task_status: str, run_outcome: dict | None) -> str:
|
def resolve_trace_suffix(task_status: str, run_outcome: dict | None) -> str:
|
||||||
"""Trace naming: assertion failures must be distinguishable from _PASS."""
|
"""Keep execution and the independently verified test verdict distinct."""
|
||||||
if task_status != "completed":
|
if task_status != "completed":
|
||||||
return "_FAIL"
|
return "_FAIL"
|
||||||
tests = (run_outcome or {}).get("tests") or {}
|
tests = (run_outcome or {}).get("tests") or {}
|
||||||
if (
|
verdict = ((run_outcome or {}).get("test_result") or {}).get("status")
|
||||||
int(tests.get("failed", 0)) > 0
|
if verdict == "blocked":
|
||||||
or ((run_outcome or {}).get("test_result") or {}).get("status") == "failed"
|
return "_BLOCKED"
|
||||||
):
|
if verdict == "inconclusive":
|
||||||
|
return "_UNVERIFIED"
|
||||||
|
if verdict == "failed" or int(tests.get("failed", 0)) > 0:
|
||||||
return "_TESTFAIL"
|
return "_TESTFAIL"
|
||||||
return "_PASS"
|
return "_PASS" if verdict == "passed" else "_UNVERIFIED"
|
||||||
+26
-5
@@ -317,12 +317,32 @@ async def _wait_for_resume(pause_file: Path) -> bool:
|
|||||||
"""Wait for the pause file to be cleared. Returns False on deadline."""
|
"""Wait for the pause file to be cleared. Returns False on deadline."""
|
||||||
deadline = float(getattr(settings, "LLM_PAUSE_TIMEOUT_SECONDS", 0.0) or 0.0)
|
deadline = float(getattr(settings, "LLM_PAUSE_TIMEOUT_SECONDS", 0.0) or 0.0)
|
||||||
waited = 0.0
|
waited = 0.0
|
||||||
|
try:
|
||||||
|
owned = pause_file.stat()
|
||||||
|
except FileNotFoundError:
|
||||||
|
return True
|
||||||
|
try:
|
||||||
while pause_file.exists():
|
while pause_file.exists():
|
||||||
if deadline > 0 and waited >= deadline:
|
if deadline > 0 and waited >= deadline:
|
||||||
return False
|
return False
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
waited += 1
|
waited += 1
|
||||||
return True
|
return True
|
||||||
|
finally:
|
||||||
|
# Cancellation (stop, guidance, outer deadline) also ends this wait.
|
||||||
|
# Do not leave a global pause behind or remove a newer request's pause.
|
||||||
|
try:
|
||||||
|
current = pause_file.stat()
|
||||||
|
if (current.st_ino, current.st_mtime_ns, current.st_size) == (
|
||||||
|
owned.st_ino,
|
||||||
|
owned.st_mtime_ns,
|
||||||
|
owned.st_size,
|
||||||
|
):
|
||||||
|
pause_file.unlink(missing_ok=True)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
except OSError as exc:
|
||||||
|
llm_logger.warning("Could not clear finished LLM pause: %s", exc)
|
||||||
|
|
||||||
|
|
||||||
async def _wait_for_breaker(key: str) -> None:
|
async def _wait_for_breaker(key: str) -> None:
|
||||||
@@ -510,10 +530,6 @@ async def _run_with_recovery[T](
|
|||||||
"LLM pause deadline"
|
"LLM pause deadline"
|
||||||
f" ({settings.LLM_PAUSE_TIMEOUT_SECONDS:.0f}s) exceeded; giving up."
|
f" ({settings.LLM_PAUSE_TIMEOUT_SECONDS:.0f}s) exceeded; giving up."
|
||||||
)
|
)
|
||||||
try:
|
|
||||||
pause_file.unlink(missing_ok=True)
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
raise LLMExhaustedError(
|
raise LLMExhaustedError(
|
||||||
str(last_error), failure=last_failure, cause=last_error
|
str(last_error), failure=last_failure, cause=last_error
|
||||||
) from last_error
|
) from last_error
|
||||||
@@ -670,7 +686,12 @@ class RobustChatModelWrapper:
|
|||||||
engine = self.ctx.data_engine if self.ctx else None
|
engine = self.ctx.data_engine if self.ctx else None
|
||||||
if engine is None:
|
if engine is None:
|
||||||
engine = _get_current_data_engine()
|
engine = _get_current_data_engine()
|
||||||
record_llm_usage(engine, response, source=self._endpoint_key())
|
record_llm_usage(
|
||||||
|
engine,
|
||||||
|
response,
|
||||||
|
source=self._endpoint_key(),
|
||||||
|
model=self.endpoint.model_name if self.endpoint else None,
|
||||||
|
)
|
||||||
|
|
||||||
def _diagnostics(self, args, kwargs):
|
def _diagnostics(self, args, kwargs):
|
||||||
prefix = None
|
prefix = None
|
||||||
|
|||||||
@@ -224,6 +224,7 @@ def record_llm_usage(
|
|||||||
response: Any,
|
response: Any,
|
||||||
*,
|
*,
|
||||||
source: str | None = None,
|
source: str | None = None,
|
||||||
|
model: str | None = None,
|
||||||
update_last_prompt: bool = True,
|
update_last_prompt: bool = True,
|
||||||
) -> dict | None:
|
) -> dict | None:
|
||||||
"""Meters one LLM response and records an ``llm_usage`` trace, best-effort.
|
"""Meters one LLM response and records an ``llm_usage`` trace, best-effort.
|
||||||
@@ -251,6 +252,8 @@ def record_llm_usage(
|
|||||||
}
|
}
|
||||||
if source:
|
if source:
|
||||||
payload["source"] = source
|
payload["source"] = source
|
||||||
|
if model:
|
||||||
|
payload["model"] = model
|
||||||
node = CURRENT_NODE_NAME.get()
|
node = CURRENT_NODE_NAME.get()
|
||||||
if node:
|
if node:
|
||||||
payload["node"] = str(node)
|
payload["node"] = str(node)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
from artemis.config.settings import settings
|
from artemis.config.settings import settings
|
||||||
|
from artemis.llm.http import model_http_options
|
||||||
|
|
||||||
from artemis.utils.logger import get_logger
|
from artemis.utils.logger import get_logger
|
||||||
|
|
||||||
@@ -91,7 +92,8 @@ async def validate_api_key(
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient(
|
async with httpx.AsyncClient(
|
||||||
timeout=timeout if timeout is not None else settings.ARTEMIS_CREDENTIAL_TIMEOUT_SECONDS
|
timeout=timeout if timeout is not None else settings.ARTEMIS_CREDENTIAL_TIMEOUT_SECONDS,
|
||||||
|
**(model_http_options() if clean_provider == "openai" else {}),
|
||||||
) as client:
|
) as client:
|
||||||
if clean_provider in ("ocr", "vision", "google_vision"):
|
if clean_provider in ("ocr", "vision", "google_vision"):
|
||||||
# Test Google Cloud Vision OCR API
|
# Test Google Cloud Vision OCR API
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
},
|
},
|
||||||
"agent": {
|
"agent": {
|
||||||
"exploration": {
|
"exploration": {
|
||||||
"model": "${env:ARTEMIS_EXPLORATION_MODEL:-gpt-6.1-sol}",
|
"model": "${env:ARTEMIS_EXPLORATION_MODEL:-gpt-6.1-terra}",
|
||||||
"reasoning_effort": "${env:ARTEMIS_EXPLORATION_REASONING_EFFORT:-high}",
|
"reasoning_effort": "${env:ARTEMIS_EXPLORATION_REASONING_EFFORT:-high}",
|
||||||
"timeout_seconds": "${env:ARTEMIS_EXPLORATION_TIMEOUT_SECONDS:-1800}",
|
"timeout_seconds": "${env:ARTEMIS_EXPLORATION_TIMEOUT_SECONDS:-1800}",
|
||||||
"demonstration_timeout_seconds": "${env:ARTEMIS_DEMONSTRATION_TIMEOUT_SECONDS:-900}",
|
"demonstration_timeout_seconds": "${env:ARTEMIS_DEMONSTRATION_TIMEOUT_SECONDS:-900}",
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ MCP 同步仅检查 `$CODEX_HOME/config.toml`;未设置或为空时使用当
|
|||||||
|
|
||||||
报告按任务或批次归档到 `artifacts/mcp_exports/`,包含本地路径及服务下载链接;删除批次时会清理对应导出副本。运行中导出是快照;执行完成不等于验证通过,报告会保留未验证、失败、跳过与中断状态。
|
报告按任务或批次归档到 `artifacts/mcp_exports/`,包含本地路径及服务下载链接;删除批次时会清理对应导出副本。运行中导出是快照;执行完成不等于验证通过,报告会保留未验证、失败、跳过与中断状态。
|
||||||
|
|
||||||
新安装模型默认使用 `gpt-6-luna`,预设 `gpt-6-luna`、`gpt-6.1-sol`、`gpt-6-astra`、`mimo-v2.6-pro`;首页、兜底模型与精选任务使用统一选择控件,也支持自定义模型名称。已保存的模型配置保留。思考强度最高支持 `max`,默认 `high`,选“由模型默认”不发送该参数;接口不支持时明确报错。单次请求 300 秒,首次失败后最多再试 5 次,普通错误每次等待 10 秒,429 每次等待 60 秒,SDK 不叠加重试。首选模型连续 3 次没有有效工具调用时,当前步骤改用 `gpt-6-luna`(high),最多再试 3 次;下一步重新使用首选模型。兜底模型及次数可通过 `.env.example` 中的 `OPENAI_TOOL_FALLBACK_*` 和 `ARTEMIS_TOOL_FALLBACK_MAX_NO_PROGRESS_ATTEMPTS` 配置。请求耗尽后沿用任务暂停/恢复机制,鉴权或非法参数立即失败。视频分析与录屏是独立开关,默认均关闭。每项批量用例可覆盖模式、模型、设备、录屏和超时等配置,不影响其他任务。暂停先返回 `pausing`,确认状态为 `task_paused` 才表示设备已释放;Pro 等待模型回复或只读诊断时可及时中断,恢复后重新观察设备。AI 可用 `mobile_manage_task(action="inject_instruction")` 提交指导并恢复;指导由执行器在安全检查点领取,可能中断当前模型等待并重新观察设备;接收回执不保证任务结束前已消费,已经开始的设备动作会安全结束。用 `guidance_history` 核对指导是否被领取、在任务流程中核对实际执行情况,或用 `resume` 单独恢复。
|
新安装模型默认使用 `gpt-6-luna`,预设 `gpt-6-luna`、`gpt-6.1-terra`、`gpt-6.1-sol`、`gpt-6-astra`、`mimo-v2.6-pro`;首页、兜底模型与精选任务使用统一选择控件,也支持自定义模型名称。已保存的模型配置保留。思考强度最高支持 `max`,默认 `high`,选“由模型默认”不发送该参数;接口不支持时明确报错。单次请求 300 秒,首次失败后最多再试 5 次,普通错误每次等待 10 秒,429 每次等待 60 秒,SDK 不叠加重试。首选模型连续 3 次没有有效工具调用时,当前步骤改用 `gpt-6-luna`(high),最多再试 3 次;下一步重新使用首选模型。兜底模型及次数可通过 `.env.example` 中的 `OPENAI_TOOL_FALLBACK_*` 和 `ARTEMIS_TOOL_FALLBACK_MAX_NO_PROGRESS_ATTEMPTS` 配置。请求耗尽后沿用任务暂停/恢复机制,鉴权或非法参数立即失败。视频分析与录屏是独立开关,默认均关闭。每项批量用例可覆盖模式、模型、设备、录屏和超时等配置,不影响其他任务。暂停先返回 `pausing`,确认状态为 `task_paused` 才表示设备已释放;Pro 等待模型回复或只读诊断时可及时中断,恢复后重新观察设备。AI 可用 `mobile_manage_task(action="inject_instruction")` 提交指导并恢复;指导由执行器在安全检查点领取,可能中断当前模型等待并重新观察设备;接收回执不保证任务结束前已消费,已经开始的设备动作会安全结束。用 `guidance_history` 核对指导是否被领取、在任务流程中核对实际执行情况,或用 `resume` 单独恢复。
|
||||||
|
|
||||||
429 等待、兜底模型及次数也可在网页“模型配置 → 稳定性与兜底模型”或通过已授权的 `mobile_config(section="model")` 配置。批次 ZIP 还收录每项任务已保存的步骤截图和录屏。
|
429 等待、兜底模型及次数也可在网页“模型配置 → 稳定性与兜底模型”或通过已授权的 `mobile_config(section="model")` 配置。批次 ZIP 还收录每项任务已保存的步骤截图和录屏。
|
||||||
|
|
||||||
|
|||||||
@@ -112,3 +112,5 @@ Flash 跨端任务由模型通过内部 `update_task_progress` 记录短阶段
|
|||||||
批次保留原顺序、循环次数和失败停止策略,默认保留各项配置,也可明确选择统一模型和思考强度。探索用例固定收藏版本,首次无复跑配置时默认 Flash;“收藏为重新探索”会创建新的探索会话并沿用原探索配置。
|
批次保留原顺序、循环次数和失败停止策略,默认保留各项配置,也可明确选择统一模型和思考强度。探索用例固定收藏版本,首次无复跑配置时默认 Flash;“收藏为重新探索”会创建新的探索会话并沿用原探索配置。
|
||||||
|
|
||||||
单任务下载全部资料时,未变化的终态报告和资料包会复用;人工复验、结果和资料变化会重新生成。批次沿用已生成的报告包,人工复验后重新打包;旧目录格式的包首次下载时更新。运行中的下载是当前快照。录像分为“安卓”“电脑”“人工示范”目录,索引路径与实际文件一致。打包优先速度,对已压缩的图片、视频和 Office 文件直接存储,保持原画质。
|
单任务下载全部资料时,未变化的终态报告和资料包会复用;人工复验、结果和资料变化会重新生成。批次沿用已生成的报告包,人工复验后重新打包;旧目录格式的包首次下载时更新。运行中的下载是当前快照。录像分为“安卓”“电脑”“人工示范”目录,索引路径与实际文件一致。打包优先速度,对已压缩的图片、视频和 Office 文件直接存储,保持原画质。
|
||||||
|
|
||||||
|
安装并启用任务人工评审 1.1.0 后,批量模板在原七列之后增加“预置条件、操作步骤、预期结果”。三列独立保存原始用例,不追加到 Artemis 提示词;左侧按用例编号和标题展示,右侧可用上一条/下一条评审同批次已结束任务。未启用该插件时仍提供并校验原七列模板。
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
# 开发交接:2026-10-19
|
# 开发交接:2026-10-19
|
||||||
|
|
||||||
|
2026-10-28 发布主线整理为 **ARTEMIS 2.4.0**,配套人工评审插件 **1.1.0**。本轮改动、配置和验证边界见 [2.4.0 发行说明](releases/2.4.0.md);下方记录为各阶段历史快照。
|
||||||
|
|
||||||
|
2026-10-28 配套升级 OpenAI/LangChain 与安全依赖,审计范围、版本、验证及容器构建限制见[依赖安全更新记录](plans/2026-10-28-dependency-security.md)。
|
||||||
|
|
||||||
|
2026-10-28 会话已接续至 **ARTEMIS 2.3.0**,最新提交、插件发布状态、产品约定和待验证范围见[本次交接记录](plans/2026-10-28-session-handoff.md)及[2.3.0 发行说明](releases/2.3.0.md)。以下各日期内容保留为历史快照,不代表当前待办。
|
||||||
|
|
||||||
2026-10-27 发布主线已整理为 **ARTEMIS 2.2.0**,配套插件为 **Cua 0.38.0+artemis.1**,Helper 为 **1.2.3**。最新升级内容、验证与未测范围以[2.2.0 发行说明](releases/2.2.0.md)为准;下方“尚未发布”、分叉计数和候选版本均属于对应日期快照。插件从独立工作树发布,原插件主目录的 OCU 开发现场保留。
|
2026-10-27 发布主线已整理为 **ARTEMIS 2.2.0**,配套插件为 **Cua 0.38.0+artemis.1**,Helper 为 **1.2.3**。最新升级内容、验证与未测范围以[2.2.0 发行说明](releases/2.2.0.md)为准;下方“尚未发布”、分叉计数和候选版本均属于对应日期快照。插件从独立工作树发布,原插件主目录的 OCU 开发现场保留。
|
||||||
|
|
||||||
2026-10-26 已再次接续开发会话,当前基线为主程序本地提交 `fac4ccb`(2.2.0)。两个仓库现场、已撤回机制与后续验收范围见[本次接续记录](plans/2026-10-26-session-handoff.md)。以下继续保留原始交接快照。
|
2026-10-26 已再次接续开发会话,当前基线为主程序本地提交 `fac4ccb`(2.2.0)。两个仓库现场、已撤回机制与后续验收范围见[本次接续记录](plans/2026-10-26-session-handoff.md)。以下继续保留原始交接快照。
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
## 模型与超时
|
## 模型与超时
|
||||||
|
|
||||||
探索独立保存模型配置,默认 `gpt-6.1-sol / high`,预设也提供 `gpt-6-astra`,允许自定义模型。执行、人工示范分析、用例提炼和结束后的讨论使用这套配置。修改默认值仅影响新探索;已创建会话保留配置快照,Flash/Pro 默认值不变。
|
探索独立保存模型配置,默认 `gpt-6.1-terra / high`,预设也提供 `gpt-6-astra`,允许自定义模型。执行、人工示范分析、用例提炼和结束后的讨论使用这套配置。修改默认值仅影响新探索;已创建会话保留配置快照,Flash/Pro 默认值不变。
|
||||||
|
|
||||||
默认每段主动执行 1800 秒。模型调用、设备动作、录像分析计入;排队、等待回答和人工示范不计入。到时保存进度并暂停,可点击「继续探索」开启下一段;不会仅因超时把测试判成失败,累计主动耗时仍保留。
|
默认每段主动执行 1800 秒。模型调用、设备动作、录像分析计入;排队、等待回答和人工示范不计入。到时保存进度并暂停,可点击「继续探索」开启下一段;不会仅因超时把测试判成失败,累计主动耗时仍保留。
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
# 2026-10-28 依赖安全更新与兼容性验证
|
||||||
|
|
||||||
|
## 审计结果
|
||||||
|
|
||||||
|
范围为主仓库声明的 Python、前端 npm、后台原型依赖及可识别的构建依赖。使用当日 PyPI/pip-audit、npm audit、OSV 和上游安全公告;没有忽略漏洞或降低检查级别。
|
||||||
|
|
||||||
|
| 范围 | 更新前 | 更新后 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `uv.lock` 中全部 169 个 registry 包,含开发依赖及非 Windows 平台包 | 11 个包命中,97 条公告记录 | 0 条,未跳过包 |
|
||||||
|
| 前端 npm 锁文件 | 17 个受影响包:3 critical、11 high、3 moderate | 0 个受影响包 |
|
||||||
|
| `playground/backend_manager/requirements.txt` 当日解析结果 | 54 个包,2 个包命中、3 条记录 | 52 个包,0 条,未跳过包 |
|
||||||
|
| Python 构建工具的当日解析结果 | — | setuptools 84.2.1、Cython 3.3.0,0 条 |
|
||||||
|
| Android Gradle Plugin 8.5.0 | — | OSV 直接包查询未检出公告;未解析完整 Gradle 构建工具传递依赖 |
|
||||||
|
|
||||||
|
公告可能含重复 ID 或别名,97 条不代表 97 个独立 CVE;npm 受影响包数也包含依赖链上的父包。零结果仅表示本次数据库未检出已知漏洞,不代表没有未知风险或业务安全问题。
|
||||||
|
|
||||||
|
远程 Python SDK 不含第三方运行时依赖;Android Helper 使用系统 API,不含第三方运行时库。独立 `Artemis-Plugins` 仓库、用户安装的插件、系统软件包和完整容器镜像不在上述零漏洞结论内。
|
||||||
|
|
||||||
|
## 版本调整
|
||||||
|
|
||||||
|
| 包 | 原版本 | 更新后 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| openai | 3.3.0 | 3.40.0,沿用同日 SDK 更新 |
|
||||||
|
| langchain / langchain-core | 1.3.15 / 1.5.6 | 1.4.7 / 1.7.0 |
|
||||||
|
| langchain-openai | 1.5.2 | 1.7.3 |
|
||||||
|
| langgraph / langgraph-sdk | 1.2.11 / 0.4.2 | 1.2.18 / 0.4.10 |
|
||||||
|
| httpx | 0.28.1 | 保持 0.28.1,当日最新版 |
|
||||||
|
| httpx2 / httpcore2 | 2.12.0 | 2.16.0 |
|
||||||
|
| mcp | 1.29.0 | 1.30.0 |
|
||||||
|
| aiohttp | 3.14.3 | 3.14.5 |
|
||||||
|
| certifi | 2026.7.22 | 2026.10.23 |
|
||||||
|
| filelock | 3.32.3 | 4.2.4 |
|
||||||
|
| multidict | 6.7.1 | 7.2.1 |
|
||||||
|
| pillow | 12.3.0 | 13.0.0 |
|
||||||
|
| pyjwt | 2.13.0 | 2.15.1 |
|
||||||
|
| tornado | 6.5.8 | 6.6 |
|
||||||
|
| urllib3 | 2.7.0 | 2.8.0 |
|
||||||
|
| virtualenv | 21.7.4 | 21.15.1 |
|
||||||
|
| Angular framework / compiler-cli | 22.1.4 | 22.2.3 |
|
||||||
|
| Angular CLI / build | 22.1.6 | 22.2.4 |
|
||||||
|
| Angular CDK | 22.1.5 | 22.2.4 |
|
||||||
|
| Vite | 8.1.5 | 8.3.5 |
|
||||||
|
| Piscina | 5.2.0 | 5.3.2 |
|
||||||
|
| 原型 Nginx 基础镜像 | 1.27-alpine | 1.30.6-alpine |
|
||||||
|
|
||||||
|
`langchain-community 0.4.2` 和 `langchain-mcp-adapters 0.3.2` 保持不变。后者要求 MCP `<2`,因此主项目声明 `mcp>=1.30.0,<2.0.0`,使用兼容的 1.x 安全修复版本。其余联动升级见 `uv.lock`。
|
||||||
|
|
||||||
|
Angular build 22.2.4 仍精确依赖存在漏洞的 Vite 8.3.0,通过限定在 `@angular/build` 下的 npm override 使用 8.3.5,未使用 `--force` 或 `--legacy-peer-deps`。以后上游采用安全版本时可移除 override,重新审计并验证构建。
|
||||||
|
|
||||||
|
后台原型的 `python-jose 3.5.0` 和间接 `ecdsa 0.19.2` 没有可用修复版,改为 `PyJWT[crypto]>=2.15.1,<3.0.0`,保持算法白名单与 HTTP 401 错误处理。原型仍按 requirements 动态解析;该扫描结果不是所有旧镜像或旧安装环境的审计证明。
|
||||||
|
|
||||||
|
## 必要的适配
|
||||||
|
|
||||||
|
- `langchain-openai 1.7.x` 对没有错误详情的 `response.failed` 抛出 `ValueError("Response <id> failed.")`。补充精确分类,保留 `INVALID_OUTPUT` 的有限重试;未把所有 ValueError 当成无效模型输出。
|
||||||
|
- 补充失败流重试回归,验证不完整输出不会成为正式结论或工具动作,重试保留已有工具证据。
|
||||||
|
- Responses 模拟传输改用 OpenAI 默认使用的 httpx2,并修正测试夹具中 `request` 同名遮蔽,确保超过 1 MiB 的中文工具参数确实经过分块 SSE/UTF-8 传输。
|
||||||
|
- 原型 JWT 回归覆盖签发、声明、当前用户、过期、错误签名、算法不匹配、无签名、畸形 token 和缺失 subject。
|
||||||
|
- MCP 的 audience 漏洞需要服务端配置配合,单纯升级不自动开启校验。本仓库没有配置 `AuthSettings`/`token_verifier`,当前不使用该 bearer-auth 路径;未来接入时必须同时设置 `validate_token_resource` 并提供正确的 token resource。
|
||||||
|
|
||||||
|
## 验证
|
||||||
|
|
||||||
|
- 隔离环境完整默认 Python 测试:3207 通过、6 跳过、8 排除;102 条现有 Pillow `getdata()` 弃用警告,该接口计划在 Pillow 14 移除。
|
||||||
|
- 随后改用 httpx2 的模型流、失败分类和 JWT 专项测试:41 通过;同步原 `.venv` 后同一组 41 项再次通过。
|
||||||
|
- Ruff 格式/静态检查、质量基线、核心 Pyright 类型检查通过;Pyright 额外显式使用了升级后的解释器。
|
||||||
|
- 锁文件校验、升级环境 `uv pip check`、`git diff --check` 通过。
|
||||||
|
- 前端 ChromeHeadless:336 通过;生产构建通过,生成产物不纳入提交。
|
||||||
|
- 主 Python、原型 Python、Python 构建工具及前端更新后复扫无已知漏洞。
|
||||||
|
- Nginx 1.30.6 为当日官方稳定修复版本,Docker Hub 标签存在且 active。已尝试构建原型镜像,但 Docker Hub registry/auth 连接超时,尚未完成容器构建和运行验证,也未扫描完整镜像内的 OS 包。
|
||||||
|
- 未调用付费模型、执行设备业务测试、发布提交或修改用户任务配置。
|
||||||
|
|
||||||
|
原始审计 JSON、解析清单和测试日志保存在本地被 Git 忽略的 `artifacts/dependency-audit-20261028/`。
|
||||||
|
|
||||||
|
## 生效
|
||||||
|
|
||||||
|
初次同步受到运行中服务占用 Pillow DLL 的阻止,已恢复旧环境并通过依赖一致性检查。用户随后明确表示已停止服务,原 `.venv` 已成功执行 `uv sync --dev --locked` 并再次通过版本核对与兼容性测试。
|
||||||
|
|
||||||
|
随后通过 `artemis restart --no-open` 恢复后台服务;`/api/system/server-status` 返回 running,首页 HTTP 200 且引用本次新前端构建。原环境全部 165 个已安装 distribution 的版本均与锁文件匹配。
|
||||||
|
|
||||||
|
本次沿用 ARTEMIS 2.3.0,按用户要求提交源码和锁文件,不发布。用户已明确无需构建 Docker,本次不再继续容器构建;修改 Dockerfile 不会更新已有容器。
|
||||||
|
|
||||||
|
## 上游依据
|
||||||
|
|
||||||
|
- [Pillow 13.0.0 安全修复](https://pillow.readthedocs.io/en/stable/releasenotes/13.0.0.html)
|
||||||
|
- [MCP bearer token audience 公告](https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-w4fh-qvv9-3v23)
|
||||||
|
- [Vite/launch-editor Windows 命令执行公告](https://github.com/advisories/GHSA-587h-7wmj-h5pm)
|
||||||
|
- [Vite 8.3.5 发布说明](https://github.com/vitejs/vite/releases/tag/v8.3.5)
|
||||||
|
- [Nginx 安全公告](https://nginx.org/en/security_advisories.html)及[当前稳定版本](https://nginx.org/en/download.html)
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# OpenAI Python SDK 3.40.0 适配
|
||||||
|
|
||||||
|
本文保留 SDK 单独升级阶段的结果。同日后续的 LangChain、HTTPX2 与安全依赖升级,以及最终验证与生效状态,见[依赖安全更新记录](2026-10-28-dependency-security.md)。
|
||||||
|
|
||||||
|
## 范围
|
||||||
|
|
||||||
|
- `pyproject.toml` 显式声明 `openai>=3.40.0,<4.0.0`;项目直接使用 SDK 的 HTTP 客户端,不再仅依赖 `langchain-openai` 间接带入。
|
||||||
|
- `uv.lock` 将 SDK 从 3.3.0 升至 3.40.0,保留既有 `langchain-openai 1.5.2`、`httpx2 2.12.0` 及其他包版本。锁文件记录发行包和 SHA-256。
|
||||||
|
- 继续使用 Responses API、`store=False` 与 ARTEMIS 的重试预算;SDK `max_retries=0`,不叠加 SDK 重试。
|
||||||
|
- 没有修改模型默认值、已有用户配置、设备调度或插件协议,主程序版本仍为 2.3.0。
|
||||||
|
|
||||||
|
## 兼容性核对
|
||||||
|
|
||||||
|
从 3.3.0 到 3.40.0 的更新涉及 SSE 解码、异步流关闭、传输异常归一化、重试验证、Responses 类型及缓存元数据。现有 Responses 调用与已锁定的 LangChain 适配层在专项回归中兼容,无需新增业务兼容分支。
|
||||||
|
|
||||||
|
3.40.0 增加显式缓存断点 TTL 类型。此次只升级 SDK,不自动启用显式缓存断点或改变 TTL;以后接入产品配置时,需要同时处理服务端与模型支持、参数入口和用量展示,不能将 SDK 类型支持当作当前端点支持。
|
||||||
|
|
||||||
|
新增回归覆盖超过 1 MiB 的中文工具参数,在 SSE 帧和 UTF-8 字符跨网络块时完整还原;即使参数完整,缺少 `response.completed` 仍拒绝输出正式结论。
|
||||||
|
|
||||||
|
## 本次验证
|
||||||
|
|
||||||
|
- 在 OpenAI SDK 3.40.0 下,模型调用专项回归 97 项通过;完整默认回归 3198 项通过、6 项跳过、8 项排除,保留 102 条已有 Pillow 弃用警告。
|
||||||
|
- Ruff 格式与静态检查、质量基线、核心 Pyright 类型检查、`uv pip check`、`uv lock --check` 通过。
|
||||||
|
- 本次未改前端,未运行前端测试或构建;未执行真实模型或设备业务验收。
|
||||||
|
|
||||||
|
## 生效与边界
|
||||||
|
|
||||||
|
开发环境已通过 `uv sync --dev --locked` 同步。已有长驻服务需正常重启后完整加载新 SDK,本次不主动重启。验证使用本地模拟传输,不调用付费模型或真实设备。
|
||||||
|
|
||||||
|
## 来源
|
||||||
|
|
||||||
|
- [OpenAI Python SDK 3.40.0 发布说明](https://github.com/openai/openai-python/releases/tag/v3.40.0)
|
||||||
|
- [SDK 变更记录](https://github.com/openai/openai-python/blob/v3.40.0/CHANGELOG.md)
|
||||||
|
- [官方 Python SDK 文档](https://developers.openai.com/api/reference/python)
|
||||||
|
- [官方提示词缓存说明](https://developers.openai.com/api/docs/guides/prompt-caching)
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# 2026-10-28 运行时故障与批次恢复修复
|
||||||
|
|
||||||
|
## 已确认问题
|
||||||
|
|
||||||
|
- awake 所属锁的目录创建和获取只处理正常争用,`PermissionError` 可从 UIAutomator、无障碍连接、设备恢复和主程序监控的共享入口传播。
|
||||||
|
- 旧唤醒租约清理虽然处理了清理过程异常,构造时创建临时目录仍可能失败。
|
||||||
|
- Flash、Pro/探索 Operator 的工具无进展恢复有备用模型,但模型生成异常未进入该入口。
|
||||||
|
- 批次模型暂停与用户暂停未区分;模型等待超时后文件已清除,批次仍维持暂停。
|
||||||
|
- 模型等待被取消时可能残留暂停文件;终态报告的通用失败说明可能遮蔽真实初始化/模型错误。
|
||||||
|
|
||||||
|
## 修复范围
|
||||||
|
|
||||||
|
- 保活权限/I/O 异常降级为警告。未取得所属锁时不执行保活动作;后续可重新获取,不缓存为成功。同一设备持续获取失败只警告一次,成功后重置。
|
||||||
|
- 工作进程早期 Agent 准备及 SDK 运行时准备失败记录 `initialization_failed`。批次在报告导出前保存失败原因并暂停剩余项;导出失败不改变这一分类。
|
||||||
|
- Flash 和 Operator 接入现有 `with_fallback`。取消、永久请求错误和同端点重试预算仍遵守统一网关规则,不修改用户模型配置,不放宽工具参数/完整响应保护。
|
||||||
|
- 区分模型、初始化、用户、服务恢复暂停。模型恢复后按既定失败策略继续;停止全部任务覆盖自动恢复标记。重启后没有存活任务时仍要求人工继续。
|
||||||
|
- 模型等待结束或被取消时清理本次暂停;文件已被新请求改写时保留。
|
||||||
|
|
||||||
|
## 边界
|
||||||
|
|
||||||
|
- 不删除或改 ACL,不更换锁目录绕过互斥。设备执行锁、主程序注册锁和队列 I/O 锁保留失败即阻止执行的行为。
|
||||||
|
- 未重跑原批次、修改历史裁定或调用真实设备/付费模型;未构建 Docker。
|
||||||
|
- 原 Windows 锁文件的 ACL、占用者及异常发生时依赖版本尚无本机证据;本修复处理应用传播和恢复缺口,不宣称证明了操作系统拒绝访问的具体来源。
|
||||||
|
- 旧批次不自动迁移暂停原因,需用户显式继续;不会从历史零步骤数量推断并改写失败分类。
|
||||||
|
|
||||||
|
## 验证
|
||||||
|
|
||||||
|
针对性测试覆盖锁目录/文件权限拒绝后恢复、监控继续处理其他设备、旧保活清理、Flash/Operator 生成失败切换、暂停取消/超时、初始化错误保留与批次暂停、手动继续不重跑失败项、用户暂停与停止全部、服务重启恢复。
|
||||||
|
|
||||||
|
- 默认测试:3225 通过、6 跳过、8 按默认标记排除。102 条既有 Pillow `getdata()` 弃用警告。
|
||||||
|
- Ruff 格式检查与静态检查通过,质量基线通过,核心 Pyright 检查 0 错误、0 警告。
|
||||||
|
- 第一轮完整测试暴露新增 CLI 测试的环境变量隔离遗漏,影响两项录像测试;修正测试隔离后第二轮完整测试全部通过,未为此改变产品行为或放宽断言。
|
||||||
|
- 本次仅修改 Python 与文档,未运行前端构建、真实设备或付费模型测试。
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# ARTEMIS 开发主线交接:2026-10-28
|
||||||
|
|
||||||
|
本次依据用户提供的《ARTEMIS开发主线-1027》完整会话记录、仓库发行说明与本地 Git 状态接续开发。agentmemory 未返回匹配本项目目录的会话,因此不采用其他项目的记忆。此次未联网刷新远端、重跑测试、重启服务或操作设备;发布和实测结论来自上一会话记录,不能视为本次重新验证。
|
||||||
|
|
||||||
|
## 当前基线
|
||||||
|
|
||||||
|
| 范围 | 本次本地核对结果 |
|
||||||
|
| --- | --- |
|
||||||
|
| 主程序 | `main` 与本地 `eapil/main` 位于 `bb873ec`,版本 2.3.0;迁入前已跟踪文件无修改,只有未跟踪的 `.angular/` 缓存 |
|
||||||
|
| 人工评审插件工作树 | 插件仓库 `.tmp/task-review-extension`,分离 HEAD `386f108`,工作树干净;`7bcdb2a` 增加插件,`386f108` 上架市场 |
|
||||||
|
| Cua 工作树 | 插件仓库 `.tmp/cua-shell-observation`,分支 `codex/cua-shell-observation`,提交 `b780a60`,工作树干净 |
|
||||||
|
| 插件原主目录 | `main` 位于 `757b829`,相对本地 `origin/main` 领先 4、落后 10;仍有 OCU、Cua 和测试脚本等既有修改与未跟踪文件,必须保留 |
|
||||||
|
|
||||||
|
上一会话已完成 ARTEMIS 2.2.0、Cua `0.38.0+artemis.1`、ARTEMIS 2.3.0 和任务人工评审 1.0.0 的推送及发布;Cua 继续标注预览版。最后已核验远端提交、发行附件下载校验值,并完成线上市场隔离安装和启用验证。早期记录中的“2.2.0 尚未发布”“Cua 尚未提交”已经过时。
|
||||||
|
|
||||||
|
## 已完成的开发与约定
|
||||||
|
|
||||||
|
- 2.2.0 接入仅 PC 测试,网页、MCP、参数 JSON 和 Python SDK 使用 `execution_target="computer"`;PC、安卓和跨端任务统一全局串行。
|
||||||
|
- 已修复安卓缩放截图的校验坐标、观测恢复预算、输入首次清空与空值确认、Helper 聚焦目标选择、Pro 收尾空转和重复计划、MCP 排队及运行状态、笔记截图路径和验收项展示标签匹配。Helper 升级至 1.2.3。动作卡片文字可复制,长 RESULT 默认折叠。
|
||||||
|
- 模型选项增加 `gpt-6.1-terra`,新安装探索默认 `gpt-6.1-terra / high`;保存配置优先。
|
||||||
|
- 2.3.0 提供 `schema_version: 3` 的声明式 `workspace` 插件接口。独立「任务人工评审」插件从市场安装启用,主程序不默认安装启用。
|
||||||
|
- 回放标题栏控制左右侧栏,普通浮窗和影院模式均支持;单侧展开仍位于对应左右侧,窄屏一次展开一侧。
|
||||||
|
- 左侧只展示本次运行最初提交的需求提示词,支持 Markdown,不混入模型拆解步骤或后续指导。
|
||||||
|
- 右侧由人工填写「AI执行准确性」「测试结果正确性」,使用中文「通过 / 失败」,两项及备注均选填,可以修改或清空。结果正确性评价 ARTEMIS 判断是否准确,与业务用例是否通过区分。
|
||||||
|
- 评审不调用 AI,不覆盖原执行结论或既有人工复验;运行中只读,结束后可编辑,保留修改历史,并防止并发覆盖和重复写入。
|
||||||
|
- 评审绑定单次运行,复跑不继承;禁用或卸载保留数据但隐藏界面及新导出字段,重新安装启用后恢复,删除任务时清理。
|
||||||
|
- 已启用插件的字段进入单任务 Word/Excel、批次汇总及资料包报告,空项留空。重新导出反映最新评审,已下载旧文件不变。
|
||||||
|
- 插件 SDK、工作区接口文档及随程序分发的 Skill 已同步。2.3.0 使用 `catalog-v3.json`,旧 `catalog.json` 保持兼容 2.2.x;执行插件更新需兼顾两个索引,工作区插件只加入新版。
|
||||||
|
- 已撤回的次数配额、内容指纹和 AI 二次动作否决不恢复;已移除的设备动作回放不恢复,历史步骤和截图回看保留。
|
||||||
|
|
||||||
|
## 历史验证与仍待覆盖范围
|
||||||
|
|
||||||
|
- 2.2.0 发布前记录:后端 3189 项、前端 326 项、SDK 24 项通过,构建及质量检查通过。集中回归 9/9 正式实测通过;后续对排队状态、截图路径、验收项标签另有修复和实测证据。
|
||||||
|
- 2.3.0 发布前记录:后端默认回归 3197 项、插件针对性回归 49 项、前端 336 项通过,构建及静态检查通过;Windows 隔离示例验证主题、左右布局、中文评审保存与 Word/Excel 导出。该轮未执行真实设备业务或付费模型测试,macOS/Linux 未实测。
|
||||||
|
- Cua 真实鼠标跟随问题按用户此前要求暂缓;原任务不足以证明具体误点根因,不能因驱动已发布就标为已解决。
|
||||||
|
- 真实断线恢复、小时级稳定性、多显示器及多 DPI 等扩大兼容性场景仍缺完整验证。发布完成不等于这些场景全部通过。
|
||||||
|
- 素材准备句柄、跨次任务取代关系仍只是产品候选,尚未立项。
|
||||||
|
|
||||||
|
当前没有尚未完成的发布步骤或待回答的产品确认。本次仅迁移上下文;后续按用户新需求继续,修改前重新核对相关仓库和工作树,不自动恢复旧设备任务或重复发布。
|
||||||
|
|
||||||
|
## 参考
|
||||||
|
|
||||||
|
- [2.2.0 发行说明](../releases/2.2.0.md)
|
||||||
|
- [2.3.0 发行说明](../releases/2.3.0.md)
|
||||||
|
- [工作区插件接口](../workspace-plugins.md)
|
||||||
|
- [插件开发 SDK](../plugin-development.md)
|
||||||
|
- [上次会话接续记录](2026-10-26-session-handoff.md)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# 插件开发与证据协议(2.0.0)
|
# 插件开发 SDK 与证据协议(ARTEMIS 2.3.0)
|
||||||
|
|
||||||
新插件必须适配本文规则,再通过实测进入市场。旧 `schema_version: 1` 仍可读取;新包使用版本 2,并声明 `capabilities`。模型执行、任务队列、资源锁、超时和报告由 ARTEMIS 管理,插件不另建任务调度器,也不替用户决定用例通过。
|
新插件必须适配本文规则,再通过实测进入市场。旧 `schema_version: 1` 仍可读取;执行插件使用版本 2,并声明 `capabilities`。需要回放面板、人工表单和报告字段时使用版本 3,见[工作区插件接口](workspace-plugins.md)。模型执行、任务队列、资源锁、超时和报告由 ARTEMIS 管理,插件不另建任务调度器,也不替用户决定用例通过。
|
||||||
|
|
||||||
## 从可运行模板开始
|
## 从可运行模板开始
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -1,6 +1,8 @@
|
|||||||
# 插件与跨端任务(2.0.0)
|
# 插件与跨端任务(2.0.0)
|
||||||
|
|
||||||
插件开发请阅读 [能力、证据协议与验收规则](plugin-development.md),可运行模板位于 `examples/plugins/evidence-demo`。新插件使用清单版本 2;版本 1 仍兼容。
|
插件开发请阅读 [能力、证据协议与验收规则](plugin-development.md),可运行模板位于 `examples/plugins/evidence-demo`。执行插件使用清单版本 2;版本 1 仍兼容。回放面板、人工表单和报告扩展使用版本 3,见[工作区插件接口](workspace-plugins.md)。
|
||||||
|
|
||||||
|
安装并启用「任务人工评审」工作区插件后,步骤回放提供可折叠的任务需求和人工评审面板。需求展示最初提交的 Markdown 提示词;两项 通过/失败 和各自备注由人工选填,可修改、清空并查看历史。未填写仍可导出报告;停用或卸载后不显示面板,也不导出对应字段,重新安装启用可恢复原记录。纯工作区插件不需要在执行任务时选择。
|
||||||
|
|
||||||
步骤卡标明安卓、电脑等来源,可点击查看对应录像;同一步内保留实际工具调用。开启「保存录屏」后,已使用的安卓和电脑来源各自留档,通过播放器切换。电脑录屏需要插件提供版本 2 的来源回执和录像能力声明,当前配套插件为 `cua-driver` 0.36.0+artemis.4,上游版本固定为 0.36.0;旧 `open-computer-use` 适配包从 1.1.0 起支持,但已从市场下架;仅更新 ARTEMIS 源码不会升级已安装插件。旧任务缺失的电脑录像无法补录,播放器会提示查看已有步骤截图。
|
步骤卡标明安卓、电脑等来源,可点击查看对应录像;同一步内保留实际工具调用。开启「保存录屏」后,已使用的安卓和电脑来源各自留档,通过播放器切换。电脑录屏需要插件提供版本 2 的来源回执和录像能力声明,当前配套插件为 `cua-driver` 0.36.0+artemis.4,上游版本固定为 0.36.0;旧 `open-computer-use` 适配包从 1.1.0 起支持,但已从市场下架;仅更新 ARTEMIS 源码不会升级已安装插件。旧任务缺失的电脑录像无法补录,播放器会提示查看已有步骤截图。
|
||||||
|
|
||||||
@@ -117,7 +119,7 @@ HTTP 服务使用 `{"transport":"streamable_http","url":"https://example.com/mcp
|
|||||||
|
|
||||||
| 环境变量 | 默认值 |
|
| 环境变量 | 默认值 |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `ARTEMIS_PLUGIN_MARKETPLACE_URL` | Artemis-Plugins 仓库的 catalog.json |
|
| `ARTEMIS_PLUGIN_MARKETPLACE_URL` | Artemis-Plugins 仓库的 catalog-v3.json(2.3.0+;原官方地址自动兼容) |
|
||||||
| `ARTEMIS_PLUGIN_START_TIMEOUT_SECONDS` | 30 秒 |
|
| `ARTEMIS_PLUGIN_START_TIMEOUT_SECONDS` | 30 秒 |
|
||||||
| `ARTEMIS_PLUGIN_TOOL_TIMEOUT_SECONDS` | 60 秒 |
|
| `ARTEMIS_PLUGIN_TOOL_TIMEOUT_SECONDS` | 60 秒 |
|
||||||
| `ARTEMIS_PLUGIN_SHUTDOWN_TIMEOUT_SECONDS` | 15 秒 |
|
| `ARTEMIS_PLUGIN_SHUTDOWN_TIMEOUT_SECONDS` | 15 秒 |
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# ARTEMIS 2.3.0
|
||||||
|
|
||||||
|
本版增加工作区插件接口,并配套独立的「任务人工评审 1.0.0」。插件从市场安装并启用,主程序不默认安装或启用人工评审。
|
||||||
|
|
||||||
|
## 步骤回放与人工评审
|
||||||
|
|
||||||
|
- 标题栏提供左右侧栏开关,普通浮窗与影院模式均支持。单独展开仍位于对应一侧;窄屏按空间收缩,一次展开一侧。
|
||||||
|
- 左侧展示本次运行最初的任务需求提示词,支持 Markdown 表格、列表等格式。
|
||||||
|
- 右侧由用户独立评定「AI执行准确性」「测试结果正确性」,使用「通过 / 失败」按钮,两项均可留空、清空,并各自填写可选备注。
|
||||||
|
- 任务结束后可保存和修改,保留修改记录。修订校验防止多页面互相覆盖,重试不会重复追加记录。人工评审不调用模型,也不覆盖原有任务结论或人工复验。
|
||||||
|
|
||||||
|
## 报告与数据
|
||||||
|
|
||||||
|
已安装且启用的插件字段进入单任务 Word/Excel、批次汇总和资料包中的报告;未填字段留空,不阻止导出。未安装、禁用或卸载时,新导出不出现对应区块。保存后再次导出反映最新评审,旧下载文件保持原样。
|
||||||
|
|
||||||
|
评审绑定单次任务运行,复跑不继承。禁用和卸载保留已存评审,重新安装启用后恢复;删除任务同时清理该任务的评审。
|
||||||
|
|
||||||
|
## 插件开发
|
||||||
|
|
||||||
|
新增 `schema_version: 3` 的声明式 `workspace` 接口,支持左右面板、可配置宽度、人工选填字段及报告贡献。纯工作区插件无需 MCP、模型或设备,不参与执行插件选择。旧执行插件版本 1/2 继续兼容。
|
||||||
|
|
||||||
|
[插件开发 SDK](../plugin-development.md)、[工作区接口](../workspace-plugins.md)和随程序分发的 [artemis-use Skill](../../skills/artemis-use/SKILL.md)同步提供完整清单示例、HTTP 请求、冲突与幂等规则、数据生命周期及发布要求。
|
||||||
|
|
||||||
|
2.3.0 使用 `catalog-v3.json` 市场索引;原 `catalog.json` 继续服务 2.2.x。保存的原官方地址会在读取时路由到新版索引,自定义市场地址保持原样。
|
||||||
|
|
||||||
|
## 模型
|
||||||
|
|
||||||
|
模型列表新增 `gpt-6.1-terra`,新安装的探索模式默认使用该模型、思考强度 `high`。已有用户保存的配置保持优先。
|
||||||
|
|
||||||
|
## 安装与验证范围
|
||||||
|
|
||||||
|
先升级主程序到 2.3.0,再到「插件」市场安装并启用「任务人工评审」。插件最低要求 2.3.0,不能导入 2.2.x;可从独立插件发行页下载 ZIP 手动导入。
|
||||||
|
|
||||||
|
本次验证覆盖默认确定性后端回归、ChromeHeadless 前端回归、生产构建、Ruff、质量基线和核心类型检查;还在 Windows 隔离示例中检查亮暗主题、单侧/双侧展开、中文评分保存与 Word/Excel 导出。此次未调用付费模型或执行真实安卓、PC、跨设备业务测试;macOS/Linux 未实测。
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
# ARTEMIS 2.4.0
|
||||||
|
|
||||||
|
> 全新安装的 npm 校验失败已在 [2.4.1](2.4.1.md) 修复,请使用补丁版源码包或通过更新脚本升级。
|
||||||
|
|
||||||
|
本版改进批量用例人工评审与执行详情阅读,并包含 OpenAI SDK 适配、安全依赖更新、Windows 资源锁和报告证据修复。配套「任务人工评审」独立发布 **1.1.0**。
|
||||||
|
|
||||||
|
## 人工评审与原始用例
|
||||||
|
|
||||||
|
- 安装并启用人工评审 1.1.0 后,批量模板在原七列后增加「预置条件、操作步骤、预期结果」,仍接受七列旧模板。未启用插件时保持原有七列模板和校验;新增内容不进入 AI 提示词。
|
||||||
|
- 左侧标题为用例编号与用例标题,下面依次展示三项原始内容;历史任务未保存的内容显示缺失,不用 AI 提示词替代。
|
||||||
|
- 「AI执行准确性」改为「用例执行准确性」,保留字段 ID 和既有评审;备注框缩短,可自行拉高。
|
||||||
|
- 「上一条/下一条」放在保存评审下方。同批次按已结束任务顺序切换,独立任务使用当前历史列表。
|
||||||
|
- 选择结果立即保存,备注停止输入 600 毫秒后保存,切换前也先保存。失败时保留输入和当前用例,允许手动重试;连续修改不会被较早回执覆盖。打开任务不会自行填写或保存评审。
|
||||||
|
- Flash、Pro、探索以及安卓、电脑、跨端任务均可显示面板,步骤与视频视图均支持。
|
||||||
|
|
||||||
|
## 执行详情与报告
|
||||||
|
|
||||||
|
- Payload、原始结果及超长、多行调试字段默认折叠;展开后限高滚动,全文可读,不截断保存的证据。
|
||||||
|
- 修复正式验收通过但没有单独输出正文时出现「没有保存最终结论」的误导提示,报告按有效结论生成说明。
|
||||||
|
- 安卓截图的真实保存回执进入结构化来源汇总,保留路径与哈希;窗口枚举没有单一目标时说明原因,不误报截图丢失。
|
||||||
|
- 电脑任务记录真实宿主平台;来源窗口标题变化时提示查看原始步骤。结果目录区分通过、不通过、阻塞与未验证。
|
||||||
|
- 历史模型和思考强度优先读取任务自身诊断,用量统计保留实际请求模型,减少历史条目被当前配置误标;修复步骤、队列与录屏收尾相关读取问题。
|
||||||
|
|
||||||
|
## 模型、依赖与运行稳定性
|
||||||
|
|
||||||
|
- OpenAI Python 更新为 3.40.0,配套 LangChain 1.4.7、langchain-core 1.7.0、langchain-openai 1.7.3;httpx 保持兼容的 0.28.1。Python 与前端安全依赖更新写入锁文件。
|
||||||
|
- 新增仅环境配置 `OPENAI_USE_SYSTEM_PROXY=false`,模型请求默认不采用系统代理。需要代理时在 `.env` 设为 `true` 并重启;同步、异步请求和 OpenAI 连接检查一致,TLS 与自定义 CA 校验继续保留。
|
||||||
|
- 修复 Windows 临时目录 awake 锁访问失败及所有权恢复,检查同类资源锁和运行时收尾。持久权限错误仍保留实际原因,不跳过互斥保护。
|
||||||
|
- Helper 初始化增加操作系统互斥锁,防止仍在执行的操作仅因锁文件超龄而被抢占;已有宿主令牌无法读取时保留原文件和错误,不生成另一份令牌覆盖它。
|
||||||
|
- 规划器明确区分规划阶段与执行器的插件能力,避免因本阶段没有动作工具而误判插件不可用;批次模型失败保留明确诊断。
|
||||||
|
|
||||||
|
2.4.0 使用独立的 `catalog-v4.json` 市场索引;保留 2.3.x 与 2.2.x 的旧索引,防止旧宿主因新面板类型无法解析而导致市场加载失败。已有官方地址自动路由,自定义地址保持原样。
|
||||||
|
|
||||||
|
## 验证范围
|
||||||
|
|
||||||
|
发布前最终默认后端测试 **3267 通过、2 跳过、8 按标记排除**,前端 **347 项通过**;生产构建、Ruff 格式与静态检查、质量基线和核心类型检查通过。Windows 浏览器隔离夹具覆盖深浅色、宽窄布局、视频视图面板、自动保存与切换,以及长 Payload 折叠。未写入真实任务人工评审。
|
||||||
|
|
||||||
|
此前用户重启后的实际复测中,5 项正式用例通过 AI 验收,另有 1 项电脑路径探索通过,覆盖安卓、电脑与跨端;该样本没有发现 awake 锁访问失败。此结果不等于重跑原 192 项业务批次,未完成大批次压力及 macOS/Linux 实测。本次发版不构建 Docker,不重启用户服务。
|
||||||
|
|
||||||
|
## 升级与下载
|
||||||
|
|
||||||
|
等待当前任务结束后运行 `update.bat`(国内镜像用 `update-cn.bat`),完成后运行 `start.bat` / `start-cn.bat` 并刷新网页。需要人工评审新功能时,再从插件市场升级并启用 [任务人工评审 1.1.0](https://git.playones.com/chenmingxuan/Artemis-Plugins/releases/tag/task-review-v1.1.0)。插件要求 ARTEMIS 2.4.0+;升级主程序不会自动升级或授权已安装插件。
|
||||||
|
|
||||||
|
源码附件为 `artemis-2.4.0-source.zip` 和 `SHA256SUMS.txt`,保留浅层 Git 更新能力,不包含用户配置、凭据、历史任务、依赖目录或预构建网页。工作区扩展接口见 [插件文档](../workspace-plugins.md)。
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# ARTEMIS 2.4.1
|
||||||
|
|
||||||
|
本补丁修复 2.4.0 全新安装时的 `npm ci / EINTEGRITY`,适用于 `start.bat` 和 `start-cn.bat`。人工评审插件版本保持 **1.1.0**。
|
||||||
|
|
||||||
|
## 修复
|
||||||
|
|
||||||
|
- 2.4.0 发版时误将锁文件中的 MCP 间接依赖版本从 2.3.1 改为 2.4.0,仍保留 2.3.1 的 SHA-512。现在恢复 Angular CLI 22.2.4 官方声明的 `@modelcontextprotocol/server@2.3.1` 及其 `core@2.3.1`,使依赖关系、下载地址和校验值一致。未关闭 npm 完整性验证,也不要求用户清空全局缓存。
|
||||||
|
- Windows 启动脚本准确检查 Angular 支持的 Node.js 范围:22.x 至少 22.22.3,24.x 至少 24.15.0,或 26.0.0 及以上;提示文案同步修正。
|
||||||
|
- 保留最终 2.4.0 中的独立 v4 市场索引,提供人工评审 1.1.0;旧版宿主继续使用旧索引。曾用于发版准备的早期 2.4.0 候选包仍使用 v3 索引,会显示人工评审 1.0.0,不应继续分发。
|
||||||
|
|
||||||
|
## 验证
|
||||||
|
|
||||||
|
- Windows、Node.js 24.22.1、npm 11.19.1,独立源码目录及空 npm 缓存,使用国内镜像执行 `npm ci`:448 个包安装成功。实际依赖树与 Angular CLI 官方声明一致。
|
||||||
|
- 同一全新环境下,前端 ChromeHeadless 347 项通过,生产构建通过;官方 npm 审计未发现已知漏洞。
|
||||||
|
- 默认后端回归 3268 通过、2 跳过、8 按标记排除;包含 Node 22/24/26 兼容边界与启动脚本回归。Ruff、质量基线和核心类型检查通过。
|
||||||
|
- 未启动用户服务,未执行设备或真实业务验收;以上为安装、构建和确定性测试结果。
|
||||||
|
|
||||||
|
## 升级
|
||||||
|
|
||||||
|
已有安装请先等待任务结束,再运行 `update-cn.bat`(国内镜像)或 `update.bat`,随后重新启动。建议使用更新脚本保留已有配置与数据,不要直接用源码 ZIP 覆盖安装目录。
|
||||||
|
|
||||||
|
如果此前已手动修改 `package-lock.json`,更新脚本可能因本地修改而停止;先备份这份文件,确认只包含该安装问题的临时修正后再处理冲突,不要对整个仓库执行重置或清理。
|
||||||
|
|
||||||
|
新安装请下载本版 `artemis-2.4.1-source.zip`,按 `SHA256SUMS.txt` 校验后使用。插件仍需在市场中单独安装或更新并启用,升级主程序不会自动授权插件。
|
||||||
|
|
||||||
|
本次不构建 Docker,不启动或重启用户服务,不操作真实设备或业务任务。
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
# 工作区插件:侧栏、人工字段与报告
|
||||||
|
|
||||||
|
工作区扩展使用 `plugin.json` 的 `schema_version: 3` 和 `workspace` 声明。旧版 1/2 执行插件继续兼容。纯工作区插件无需 MCP、Skill、模型、设备或任务资源,不出现在任务执行插件选择器中;安装后手动启用即可在历史任务上使用。此接口从 ARTEMIS 2.3.0 起提供;插件必须声明 `artemis_version: ">=2.3.0,<3.0.0"`,2.2.x 不支持。`original_case` 面板从 2.4.0 起提供,使用它的插件须声明 `>=2.4.0,<3.0.0`。
|
||||||
|
|
||||||
|
## 声明接口
|
||||||
|
|
||||||
|
清单仍要求 `capabilities`。纯界面插件填写 `{"kind":"other","tools":{}}`,可将 `targets` 设为空数组。工作区声明完全由宿主渲染,不加载任意 JavaScript、HTML 或后端执行钩子。
|
||||||
|
|
||||||
|
以下是可直接保存为 `plugin.json` 的完整最小清单:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"schema_version": 3,
|
||||||
|
"id": "review-example",
|
||||||
|
"name": "评审扩展示例",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"artemis_version": ">=2.4.0,<3.0.0",
|
||||||
|
"platforms": ["win32", "linux", "darwin"],
|
||||||
|
"targets": [],
|
||||||
|
"capabilities": {"kind": "other", "tools": {}},
|
||||||
|
"workspace": {
|
||||||
|
"panels": [
|
||||||
|
{"id":"requirements","title":"原始用例","side":"left","kind":"original_case","width":{"preferred":340,"minimum":240,"maximum":480}},
|
||||||
|
{"id":"review","title":"人工评审","side":"right","kind":"form","width":{"preferred":360,"minimum":260,"maximum":520}}
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{"id":"execution_accuracy","label":"用例执行准确性","kind":"choice","options":["通过","失败"]},
|
||||||
|
{"id":"execution_note","label":"用例执行准确性备注","kind":"text","max_length":2000}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- `panels`:最多两个,`id` 和 `kind` 各自唯一;`side` 为 left/right。`initial_prompt` 展示该次运行最初收到的任务需求提示词,复用宿主 Markdown 渲染及 HTML 清理;不展示模型拆解步骤或后续指导。`original_case` 以用例编号与标题为标题,依次展示导入表中的预置条件、操作步骤、预期结果;缺失时明确提示,不从提示词推测。`form` 渲染本插件声明的字段。
|
||||||
|
- `width`:CSS 像素,满足 minimum ≤ preferred ≤ maximum。minimum 范围 160–800,preferred 200–1000,maximum 200–1200。宿主优先采用首选宽度,并根据播放器、窗口空间调整;窄屏可低于 minimum 防止溢出。开关位于回放标题栏,以左右方向表示展开与收起。Flash/Pro/探索以及安卓、电脑、跨端任务的步骤、视频或实时视图均可使用;普通浮窗、影院均支持,默认收起;宽屏左右独立展开,窄屏一次展开一侧;单侧也始终位于回放左侧或右侧,不切换为上下排列。
|
||||||
|
- `fields`:最多 20 个,`id` 唯一;`kind` 为 choice/text。choice 声明非空、不重复的 options,显示为互斥分段按钮,再次点击已选项可清空;text 使用多行输入。description 可选。max_length 默认 2000、最高 10000;report 默认 true。所有字段均选填,空字符串表示未填写,用户可清空。
|
||||||
|
- 两项人工评审的标签和说明由插件提供;宿主不推断结果、不调用模型、不覆盖执行状态、AI 原判或既有人工复验。
|
||||||
|
|
||||||
|
## 任务数据接口
|
||||||
|
|
||||||
|
`GET /api/task-extensions/{session_id}` 返回 `session_id`、`initial_prompt`、`case_title`、`original_case`、`navigation`、`editable` 和已安装且启用的插件贡献列表。每项包含 plugin_id/name/version/workspace/revision/values/history。无插件时列表为空。
|
||||||
|
|
||||||
|
`original_case` 为 `{preconditions, steps, expected}` 或 null。只有安装并启用声明 `original_case` 面板的插件时,批量模板才附加“预置条件、操作步骤、预期结果”三列并接受十列表格;否则仍只提供和接受原七列。三列不进入模型提示词。启用时也兼容七列表格,历史缺失字段不补写。
|
||||||
|
|
||||||
|
批次任务的 `navigation` 含 scope=batch、position、total、previous、next,按执行顺序在同批次已结束任务之间切换;独立任务使用当前历史列表。上一条/下一条位于保存评审按钮下方。用户选择结果后立即自动保存,备注停止输入 600 毫秒后保存;连续编辑按修订串行写入,旧回执不覆盖新输入。切换前先保存,失败或冲突时留在当前任务并保留输入;手动保存可重试,使用原 request_id 防止重复。切换保留面板展开状态。打开任务或读取已有记录不触发写入。
|
||||||
|
|
||||||
|
`PUT /api/task-extensions/{session_id}/{plugin_id}` 接收:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"values":{"execution_accuracy":"通过","execution_note":"人工核对"},"expected_revision":0,"request_id":"00000000-0000-4000-8000-000000000001"}
|
||||||
|
```
|
||||||
|
|
||||||
|
values 是本次提交的字段;未提交的字段保持原值。保存仅允许终态任务(完成、失败、取消、中断、跳过),运行中只读。宿主校验声明、长度和选项;expected_revision 防止多个页面互相覆盖。网络重试复用 request_id 和相同内容,不追加重复历史;修改内容使用新 request_id。保存冲突返回 409,并保留页面输入。
|
||||||
|
|
||||||
|
数据复用宿主 automation_records,以 task_extensions/session_id 保存各插件独立记录;历史包含字段声明、插件版本、保存时间、revision 和当时值。按单次运行绑定,复跑不继承评审。禁用/卸载隐藏界面与新导出的字段,但保留历史;重新安装启用同一插件 ID 后恢复。删除任务/批次时同步清理对应评审。
|
||||||
|
|
||||||
|
## 导出
|
||||||
|
|
||||||
|
已安装且启用的插件声明 report=true 的字段,进入单任务 Word/Excel、批次 Word/Excel 汇总和 ZIP 内报告。未填字段留空,不阻止导出。未安装、禁用或卸载时无对应报告区块;已下载文件保持原内容。
|
||||||
|
|
||||||
|
单任务导出指纹包含扩展快照,批次缓存包含插件安装/启用声明与任务扩展修订。保存使用既有导出锁并使批次报告失效,防止下载旧评审。导出不需要运行插件进程或调用模型。
|
||||||
|
|
||||||
|
## 独立人工评审插件
|
||||||
|
|
||||||
|
插件源代码位于独立 Artemis-Plugins 仓库的 `plugins/task-review/`,包名 task-review,1.1.0 要求宿主 2.4.0,可从插件市场安装,或通过高级接入导入发行 ZIP。它声明原始用例面板,以及「用例执行准确性」「测试结果正确性」两个 通过/失败 字段和各自可选备注。
|
||||||
|
|
||||||
|
在已更新宿主的环境,用 `uv run python scripts/check_plugin.py <插件目录>` 检查清单,再在「插件 → 高级接入」导入目录或 ZIP。安装、启用、填写、清空、导出、禁用、卸载和重新安装均应通过确定性测试;只检查清单不代表界面和导出已验证。
|
||||||
|
|
||||||
|
## 开发与兼容边界
|
||||||
|
|
||||||
|
这里的 SDK 是声明式清单协议与宿主 HTTP 接口,不要求编写插件运行进程。当前不支持自定义 JavaScript、HTML、上传控件、跨任务统计或任意报告模板钩子。执行插件可以在版本 3 清单中同时保留 MCP/Skill 和 workspace;原有工具、资源和证据约束仍适用。
|
||||||
|
|
||||||
|
面板及字段 id 使用小写字母开头的字母、数字、下划线,最长 48 字符;稳定 id 是历史数据的键,不应为了改显示名称而更换。更改选项或删除字段不会迁移历史;当前导出按当前声明取值,发行不兼容字段变更前须验证旧数据。字段没有必填模式,不能以校验拦截用户的空项。
|
||||||
|
|
||||||
|
GET 成功返回完整贡献快照;PUT 成功返回同样结构和新 revision。404 表示任务不存在,422 表示请求结构、UUID 或参数格式无效;409 包含运行中只读、插件未启用、报告正在打包、修订冲突、无效字段值或幂等请求冲突。冲突时保留本地输入,刷新并由用户决定如何合并,不能自动覆盖。
|
||||||
|
|
||||||
|
人工结果只能由用户填写;AI 不自行调用 PUT 生成或推断评审。此接口未加入模型 MCP 工具或远程 Python SDK 的人工写入方法。插件没有设备目标时,无需为安装验证提交安卓/PC 测试任务;用隔离终态示例验证保存、清空、重装、导出与旧缓存失效即可。
|
||||||
|
|
||||||
|
市场发布时保持清单、ZIP、版本标签与 catalog-v4.json 内嵌清单一致;先上传不可变 ZIP 与 SHA256SUMS.txt 并回读验证,再更新索引。仅静态清单校验通过不能宣称全部平台已实测。
|
||||||
|
|
||||||
|
官方市场为 2.4.0+ 提供 catalog-v4.json,catalog-v3.json 保留给 2.3.x,catalog.json 保留给 2.2.x,避免旧宿主严格解析新面板类型时导致整个市场加载失败。2.4.0 读取原官方 catalog.json 或 catalog-v3.json 地址时自动选择新版索引,不改写用户配置;自定义市场地址不会被替换。
|
||||||
@@ -61,7 +61,7 @@ The bridge discovers a live service from the same installation; `ARTEMIS_DAEMON_
|
|||||||
|
|
||||||
## 🛠️ MCP Tools Overview
|
## 🛠️ MCP Tools Overview
|
||||||
|
|
||||||
* **`mobile_exploration`**: Guided exploration using the same queue and conversation as the web workspace. Create/start, exchange messages, pause/continue, record and analyze demonstrations, save immutable case versions, rerun with Flash/Pro, or add a batch draft. Writes use stable request IDs; reads never launch work. Defaults are independent (`gpt-6.1-sol / high`) and timeouts pause without marking the test failed. See the [exploration workflow](../docs/exploration-mode.md).
|
* **`mobile_exploration`**: Guided exploration using the same queue and conversation as the web workspace. Create/start, exchange messages, pause/continue, record and analyze demonstrations, save immutable case versions, rerun with Flash/Pro, or add a batch draft. Writes use stable request IDs; reads never launch work. Defaults are independent (`gpt-6.1-terra / high`) and timeouts pause without marking the test failed. See the [exploration workflow](../docs/exploration-mode.md).
|
||||||
* **`mobile_run_task`**: Asynchronously launches an autonomous mobile automation task (`Flash` or `Pro` model) with optional `device_serial` targeting. Pro runs can be tuned with `verification_level` (`off` | `final` | `checkpoints` | `strict` — how much the Checker audits) and `explorer_mode` (`flash` | `pro` | `ultra` — the Operator's perception depth).
|
* **`mobile_run_task`**: Asynchronously launches an autonomous mobile automation task (`Flash` or `Pro` model) with optional `device_serial` targeting. Pro runs can be tuned with `verification_level` (`off` | `final` | `checkpoints` | `strict` — how much the Checker audits) and `explorer_mode` (`flash` | `pro` | `ultra` — the Operator's perception depth).
|
||||||
* **`mobile_manage_task`**: Manages task lifecycle (`status`, `stop`, `inject_instruction`), returning task state and assigned `device_serial`. Pass `release_loop=True` with `inject_instruction` to gracefully end a `[Loop:continuous]` monitoring task — this explicit signal (not "please stop" wording) is what unlocks the loop milestone's completion.
|
* **`mobile_manage_task`**: Manages task lifecycle (`status`, `stop`, `inject_instruction`), returning task state and assigned `device_serial`. Pass `release_loop=True` with `inject_instruction` to gracefully end a `[Loop:continuous]` monitoring task — this explicit signal (not "please stop" wording) is what unlocks the loop milestone's completion.
|
||||||
* **`mobile_get_device_state`**: Real-time observer (`screenshot` or OCR+XML `hierarchy`) with optional `device_serial`.
|
* **`mobile_get_device_state`**: Real-time observer (`screenshot` or OCR+XML `hierarchy`) with optional `device_serial`.
|
||||||
|
|||||||
@@ -437,7 +437,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mobile_config",
|
"name": "mobile_config",
|
||||||
"description": "Read configuration or explicitly save non-secret defaults for FUTURE tasks.\n\nOnly set persist_defaults=true when the user requests saved/global configuration.\nmodel changes: model (preset or custom), base_url, reasoning_effort\n(default/none/minimal/low/medium/high/xhigh/max), timeout_seconds, max_retries,\nretry_interval_seconds, rate_limit_retry_seconds, tool_fallback_model,\ntool_fallback_reasoning_effort, tool_fallback_max_retries,\ntool_fallback_no_progress_attempts. 'default' omits reasoning;\nunsupported values fail visibly.\ncapabilities: video_enabled and recording_enabled are independent; outputter_enabled,\nflash_final_check_enabled (false; Flash exit-only AI review),\nstep_summarizer_enabled, screenshot_limit_enabled, task_timeout_seconds (default 1800),\nobservation_timeout_seconds (60), observation_max_attempts (3),\ndevice_command_timeout_seconds (10), action_failure_attempts (3),\nworker_cleanup_timeout_seconds (30), adb_auto_connect (true),\nadb_discovery_interval_seconds (10), adb_discovery_timeout_seconds (5).\nreports: formats=['docx','xlsx'] (at least one).\nexploration: model (default gpt-6.1-sol), reasoning_effort (high), timeout_seconds\n(1800 active seconds), demonstration_timeout_seconds (900), demonstration_warning_seconds (60).\nAPI keys are never accepted or returned: use the Web UI or .env for credentials.\nSaving settings does not change an already running task. Flash/Pro are execution\nprofiles, not model names. Model retries do not repeat device test cases.\n",
|
"description": "Read configuration or explicitly save non-secret defaults for FUTURE tasks.\n\nOnly set persist_defaults=true when the user requests saved/global configuration.\nmodel changes: model (preset or custom), base_url, reasoning_effort\n(default/none/minimal/low/medium/high/xhigh/max), timeout_seconds, max_retries,\nretry_interval_seconds, rate_limit_retry_seconds, tool_fallback_model,\ntool_fallback_reasoning_effort, tool_fallback_max_retries,\ntool_fallback_no_progress_attempts. 'default' omits reasoning;\nunsupported values fail visibly.\ncapabilities: video_enabled and recording_enabled are independent; outputter_enabled,\nflash_final_check_enabled (false; Flash exit-only AI review),\nstep_summarizer_enabled, screenshot_limit_enabled, task_timeout_seconds (default 1800),\nobservation_timeout_seconds (60), observation_max_attempts (3),\ndevice_command_timeout_seconds (10), action_failure_attempts (3),\nworker_cleanup_timeout_seconds (30), adb_auto_connect (true),\nadb_discovery_interval_seconds (10), adb_discovery_timeout_seconds (5).\nreports: formats=['docx','xlsx'] (at least one).\nexploration: model (default gpt-6.1-terra), reasoning_effort (high), timeout_seconds\n(1800 active seconds), demonstration_timeout_seconds (900), demonstration_warning_seconds (60).\nAPI keys are never accepted or returned: use the Web UI or .env for credentials.\nSaving settings does not change an already running task. Flash/Pro are execution\nprofiles, not model names. Model retries do not repeat device test cases.\n",
|
||||||
"inputSchema": {
|
"inputSchema": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"section": {
|
"section": {
|
||||||
@@ -791,7 +791,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mobile_exploration",
|
"name": "mobile_exploration",
|
||||||
"description": "Explore ONE complex test with user guidance and produce a reusable case.\n\ndeletion_preview lists affected conversation runs; delete requires user_confirmed=true\nafter the user requests deletion. Independent validation runs are preserved.\nRead-only list/get/case never execute tasks. create stores {goal,config?,task_config?};\nstart/continue explicitly enqueue or resume Pro exploration. Independent defaults:\ngpt-6.1-sol/high, 1800 active seconds; timeout pauses, never fails by itself.\nmessage payload={text}; answer pending questions or guide without discarding history.\ndemonstrate payload={source:'android'|'computer'|'both'} pauses at a safe point and\nrecords while retaining the device/plugin lease. Wait for recording before the user\noperates. demo_finish analyzes the SAVED clip; demo_extend payload={seconds:900};\ndemo_cancel preserves evidence. Default 900s, warning 60s before expiry, auto-pause.\nsave_case payload={expected_version,case:{name,goal,preconditions?,evidence?}};\ngenerate payload={source_run_id,expected_version} starts evidence-based synthesis,\npoll get.generations for completion. validate payload={version,profile,task_config?}\nexplicitly runs the saved version in Flash/Pro; batch additionally accepts name and\ncreates a DRAFT batch, never starts it. Exploration pass and rerun pass are separate.\nUse stable request_id for every mutation except pause/stop/delete, reusing it on transport\nretries. No API keys; configure secrets in the Web UI. mobile_config(section='exploration')\ncontrols non-secret defaults. After errors call mobile_diagnose before resubmitting.\n",
|
"description": "Explore ONE complex test with user guidance and produce a reusable case.\n\ndeletion_preview lists affected conversation runs; delete requires user_confirmed=true\nafter the user requests deletion. Independent validation runs are preserved.\nRead-only list/get/case never execute tasks. create stores {goal,config?,task_config?};\nstart/continue explicitly enqueue or resume Pro exploration. Independent defaults:\ngpt-6.1-terra/high, 1800 active seconds; timeout pauses, never fails by itself.\nmessage payload={text}; answer pending questions or guide without discarding history.\ndemonstrate payload={source:'android'|'computer'|'both'} pauses at a safe point and\nrecords while retaining the device/plugin lease. Wait for recording before the user\noperates. demo_finish analyzes the SAVED clip; demo_extend payload={seconds:900};\ndemo_cancel preserves evidence. Default 900s, warning 60s before expiry, auto-pause.\nsave_case payload={expected_version,case:{name,goal,preconditions?,evidence?}};\ngenerate payload={source_run_id,expected_version} starts evidence-based synthesis,\npoll get.generations for completion. validate payload={version,profile,task_config?}\nexplicitly runs the saved version in Flash/Pro; batch additionally accepts name and\ncreates a DRAFT batch, never starts it. Exploration pass and rerun pass are separate.\nUse stable request_id for every mutation except pause/stop/delete, reusing it on transport\nretries. No API keys; configure secrets in the Web UI. mobile_config(section='exploration')\ncontrols non-secret defaults. After errors call mobile_diagnose before resubmitting.\n",
|
||||||
"inputSchema": {
|
"inputSchema": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"action": {
|
"action": {
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ async def mobile_config(
|
|||||||
worker_cleanup_timeout_seconds (30), adb_auto_connect (true),
|
worker_cleanup_timeout_seconds (30), adb_auto_connect (true),
|
||||||
adb_discovery_interval_seconds (10), adb_discovery_timeout_seconds (5).
|
adb_discovery_interval_seconds (10), adb_discovery_timeout_seconds (5).
|
||||||
reports: formats=['docx','xlsx'] (at least one).
|
reports: formats=['docx','xlsx'] (at least one).
|
||||||
exploration: model (default gpt-6.1-sol), reasoning_effort (high), timeout_seconds
|
exploration: model (default gpt-6.1-terra), reasoning_effort (high), timeout_seconds
|
||||||
(1800 active seconds), demonstration_timeout_seconds (900), demonstration_warning_seconds (60).
|
(1800 active seconds), demonstration_timeout_seconds (900), demonstration_warning_seconds (60).
|
||||||
API keys are never accepted or returned: use the Web UI or .env for credentials.
|
API keys are never accepted or returned: use the Web UI or .env for credentials.
|
||||||
Saving settings does not change an already running task. Flash/Pro are execution
|
Saving settings does not change an already running task. Flash/Pro are execution
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ async def mobile_exploration(
|
|||||||
after the user requests deletion. Independent validation runs are preserved.
|
after the user requests deletion. Independent validation runs are preserved.
|
||||||
Read-only list/get/case never execute tasks. create stores {goal,config?,task_config?};
|
Read-only list/get/case never execute tasks. create stores {goal,config?,task_config?};
|
||||||
start/continue explicitly enqueue or resume Pro exploration. Independent defaults:
|
start/continue explicitly enqueue or resume Pro exploration. Independent defaults:
|
||||||
gpt-6.1-sol/high, 1800 active seconds; timeout pauses, never fails by itself.
|
gpt-6.1-terra/high, 1800 active seconds; timeout pauses, never fails by itself.
|
||||||
message payload={text}; answer pending questions or guide without discarding history.
|
message payload={text}; answer pending questions or guide without discarding history.
|
||||||
demonstrate payload={source:'android'|'computer'|'both'} pauses at a safe point and
|
demonstrate payload={source:'android'|'computer'|'both'} pauses at a safe point and
|
||||||
records while retaining the device/plugin lease. Wait for recording before the user
|
records while retaining the device/plugin lease. Wait for recording before the user
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
from datetime import datetime, timedelta, timezone, UTC
|
from datetime import datetime, timedelta, timezone, UTC
|
||||||
from fastapi import Depends, HTTPException, Security, status
|
from fastapi import Depends, HTTPException, Security, status
|
||||||
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
||||||
from jose import JWTError, jwt
|
import jwt
|
||||||
|
from jwt import InvalidTokenError
|
||||||
from app.config import settings
|
from app.config import settings
|
||||||
|
|
||||||
security = HTTPBearer(auto_error=False)
|
security = HTTPBearer(auto_error=False)
|
||||||
@@ -40,7 +41,7 @@ def decode_access_token(token: str) -> dict:
|
|||||||
try:
|
try:
|
||||||
payload = jwt.decode(token, settings.JWT_SECRET_KEY, algorithms=[settings.JWT_ALGORITHM])
|
payload = jwt.decode(token, settings.JWT_SECRET_KEY, algorithms=[settings.JWT_ALGORITHM])
|
||||||
return payload
|
return payload
|
||||||
except JWTError as e:
|
except InvalidTokenError as e:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
detail=f"Invalid or expired credentials: {str(e)}",
|
detail=f"Invalid or expired credentials: {str(e)}",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ fastapi>=0.115.0
|
|||||||
uvicorn[standard]>=0.32.0
|
uvicorn[standard]>=0.32.0
|
||||||
pydantic>=2.9.0
|
pydantic>=2.9.0
|
||||||
pydantic-settings>=2.5.0
|
pydantic-settings>=2.5.0
|
||||||
python-jose[cryptography]>=3.3.0
|
PyJWT[crypto]>=2.15.1,<3.0.0
|
||||||
passlib[bcrypt]>=1.7.4
|
passlib[bcrypt]>=1.7.4
|
||||||
docker>=7.1.0
|
docker>=7.1.0
|
||||||
google-cloud-bigquery>=3.26.0
|
google-cloud-bigquery>=3.26.0
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
FROM nginx:1.27-alpine
|
FROM nginx:1.30.6-alpine
|
||||||
|
|
||||||
# Install openssl for auto-generating self-signed dev certificates and curl for healthchecks
|
# Install openssl for auto-generating self-signed dev certificates and curl for healthchecks
|
||||||
RUN apk add --no-cache openssl curl bash
|
RUN apk add --no-cache openssl curl bash
|
||||||
|
|||||||
+9
-8
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "artemis"
|
name = "artemis"
|
||||||
version = "2.2.0"
|
version = "2.4.1"
|
||||||
description = "Autonomous AI Assistant for Mobile Automation"
|
description = "Autonomous AI Assistant for Mobile Automation"
|
||||||
|
|
||||||
authors = [
|
authors = [
|
||||||
@@ -27,14 +27,15 @@ dependencies = [
|
|||||||
# Remote Python SDK (kept as a zero-dependency workspace package)
|
# Remote Python SDK (kept as a zero-dependency workspace package)
|
||||||
"artemis-client>=0.1.0",
|
"artemis-client>=0.1.0",
|
||||||
# Orchestration & Framework
|
# Orchestration & Framework
|
||||||
"langgraph>=1.0.2,<2.0.0",
|
"langgraph>=1.2.18,<2.0.0",
|
||||||
"langchain>=1.0.0",
|
"langchain>=1.4.7,<2.0.0",
|
||||||
"langchain-core>=1.0.0",
|
"langchain-core>=1.7.0,<2.0.0",
|
||||||
"langchain-community>=0.4.1",
|
"langchain-community>=0.4.1",
|
||||||
"langchain-mcp-adapters>=0.2.0",
|
"langchain-mcp-adapters>=0.2.0",
|
||||||
"mcp>=1.26.0",
|
"mcp>=1.30.0,<2.0.0",
|
||||||
# LLM Providers & GenAI SDKs
|
# LLM Providers & GenAI SDKs
|
||||||
"langchain-openai>=1.0.0",
|
"langchain-openai>=1.7.3,<2.0.0",
|
||||||
|
"openai>=3.40.0,<4.0.0",
|
||||||
# Configuration, Models & Validation
|
# Configuration, Models & Validation
|
||||||
"pydantic>=2.7.0",
|
"pydantic>=2.7.0",
|
||||||
"pydantic-settings>=2.10.1",
|
"pydantic-settings>=2.10.1",
|
||||||
@@ -59,7 +60,7 @@ dependencies = [
|
|||||||
"websockets>=12.0",
|
"websockets>=12.0",
|
||||||
"sseclient-py>=1.8.0",
|
"sseclient-py>=1.8.0",
|
||||||
# Image, Video & Multimodal Perception
|
# Image, Video & Multimodal Perception
|
||||||
"pillow>=10.0.0",
|
"pillow>=13.0.0",
|
||||||
"opencv-python>=4.9.0.80",
|
"opencv-python>=4.9.0.80",
|
||||||
"imageio-ffmpeg>=0.5.1",
|
"imageio-ffmpeg>=0.5.1",
|
||||||
"matplotlib>=3.8.0",
|
"matplotlib>=3.8.0",
|
||||||
@@ -67,7 +68,7 @@ dependencies = [
|
|||||||
"scipy>=1.13.0",
|
"scipy>=1.13.0",
|
||||||
# System, Utilities & Telemetry
|
# System, Utilities & Telemetry
|
||||||
"psutil>=5.9.0",
|
"psutil>=5.9.0",
|
||||||
"filelock>=3.20.0",
|
"filelock>=4.2.4",
|
||||||
"retry>=0.9.2",
|
"retry>=0.9.2",
|
||||||
"posthog>=3.5.0",
|
"posthog>=3.5.0",
|
||||||
"uuid-utils>=0.9.0",
|
"uuid-utils>=0.9.0",
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ async def check(directory: Path, live: bool, values: dict[str, str]) -> None:
|
|||||||
skill = contained_path(directory, manifest.skill)
|
skill = contained_path(directory, manifest.skill)
|
||||||
if not skill.is_file() or not skill.read_text("utf-8").strip():
|
if not skill.is_file() or not skill.read_text("utf-8").strip():
|
||||||
raise ValueError("缺少有效的 Skill")
|
raise ValueError("缺少有效的 Skill")
|
||||||
if manifest.schema_version != 2:
|
if manifest.schema_version not in {2, 3}:
|
||||||
raise ValueError("新市场插件必须适配 schema_version=2")
|
raise ValueError("新市场插件必须适配 schema_version=2 或 3")
|
||||||
if live and manifest.server:
|
if live and manifest.server:
|
||||||
server = resolve_server(manifest, PluginProfile(values=values), directory)
|
server = resolve_server(manifest, PluginProfile(values=values), directory)
|
||||||
session = await PluginSession(server, directory).start()
|
session = await PluginSession(server, directory).start()
|
||||||
@@ -29,7 +29,7 @@ async def check(directory: Path, live: bool, values: dict[str, str]) -> None:
|
|||||||
await session.aclose()
|
await session.aclose()
|
||||||
print(
|
print(
|
||||||
f"PASS {manifest.id} {manifest.version}: 清单/兼容性/Skill"
|
f"PASS {manifest.id} {manifest.version}: 清单/兼容性/Skill"
|
||||||
+ ("/MCP 工具声明" if live else "")
|
+ ("/MCP 工具声明" if live and manifest.server else "")
|
||||||
)
|
)
|
||||||
print("此检查不代替实际执行、超时取消、证据导出和视觉能力验收。")
|
print("此检查不代替实际执行、超时取消、证据导出和视觉能力验收。")
|
||||||
|
|
||||||
|
|||||||
+6
-10
@@ -218,14 +218,10 @@ function Test-NodeCompatible {
|
|||||||
$verRaw = (& node -v 2>$null)
|
$verRaw = (& node -v 2>$null)
|
||||||
if (-not $verRaw) { return $false }
|
if (-not $verRaw) { return $false }
|
||||||
$verStr = $verRaw.ToString().Trim().TrimStart('v')
|
$verStr = $verRaw.ToString().Trim().TrimStart('v')
|
||||||
$parts = $verStr.Split('.')
|
$version = [version]$verStr
|
||||||
if ($parts.Count -ge 2) {
|
if ($version.Major -ge 26) { return $true }
|
||||||
$major = [int]$parts[0]
|
if ($version.Major -eq 24 -and $version -ge [version]'24.15.0') { return $true }
|
||||||
$minor = [int]$parts[1]
|
if ($version.Major -eq 22 -and $version -ge [version]'22.22.3') { return $true }
|
||||||
if ($major -ge 26) { return $true }
|
|
||||||
if ($major -eq 24 -and $minor -ge 15) { return $true }
|
|
||||||
if ($major -eq 22 -and $minor -ge 22) { return $true }
|
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
@@ -383,7 +379,7 @@ if ($frontendChanged -or ((-not (Test-Path $ShowcaseIndex)) -and (-not (Test-Pat
|
|||||||
if (-not (Test-NodeCompatible)) {
|
if (-not (Test-NodeCompatible)) {
|
||||||
if (Test-CommandExists "node") {
|
if (Test-CommandExists "node") {
|
||||||
$curVer = (& node -v 2>$null)
|
$curVer = (& node -v 2>$null)
|
||||||
Write-Host (Get-LaunchText " [INFO] Detected Node.js $curVer, but Angular CLI requires Node.js >= v22.22.0." " [检查] 检测到 Node.js $curVer;前端需要 v22.22.0 或更新版本。") -ForegroundColor Yellow
|
Write-Host (Get-LaunchText " [INFO] Detected Node.js $curVer; Angular CLI requires 22.x >= 22.22.3, 24.x >= 24.15.0, or >= 26.0.0." " [检查] 检测到 Node.js $curVer;前端需要 22.x >= 22.22.3、24.x >= 24.15.0 或 >= 26.0.0。") -ForegroundColor Yellow
|
||||||
} else {
|
} else {
|
||||||
Write-Host (Get-LaunchText " [INFO] Node.js/npm not found (required for Showcase UI)." " [检查] 未找到 Node.js/npm,网页构建需要安装。") -ForegroundColor Cyan
|
Write-Host (Get-LaunchText " [INFO] Node.js/npm not found (required for Showcase UI)." " [检查] 未找到 Node.js/npm,网页构建需要安装。") -ForegroundColor Cyan
|
||||||
}
|
}
|
||||||
@@ -401,7 +397,7 @@ if ($frontendChanged -or ((-not (Test-Path $ShowcaseIndex)) -and (-not (Test-Pat
|
|||||||
$useWinGetNode = $false
|
$useWinGetNode = $false
|
||||||
if ($ArtemisDownloads.mode -ne 'China' -and (Test-CommandExists "winget")) {
|
if ($ArtemisDownloads.mode -ne 'China' -and (Test-CommandExists "winget")) {
|
||||||
if ([Console]::IsInputRedirected -eq $false) {
|
if ([Console]::IsInputRedirected -eq $false) {
|
||||||
Write-Host (Get-LaunchText " [INFO] Node.js >= v22.22.0 required for Showcase UI." " [检查] 网页需要 Node.js v22.22.0 或更新版本。") -ForegroundColor Cyan
|
Write-Host (Get-LaunchText " [INFO] Showcase UI requires Node.js 22.x >= 22.22.3, 24.x >= 24.15.0, or >= 26.0.0." " [检查] 网页需要 Node.js 22.x >= 22.22.3、24.x >= 24.15.0 或 >= 26.0.0。") -ForegroundColor Cyan
|
||||||
$ans = Read-Host (Get-LaunchText " Install/Upgrade Node.js via WinGet (may require Administrator)? [Y/n]" " 通过 WinGet 安装/升级 Node.js(可能需要管理员权限)?[Y/n]")
|
$ans = Read-Host (Get-LaunchText " Install/Upgrade Node.js via WinGet (may require Administrator)? [Y/n]" " 通过 WinGet 安装/升级 Node.js(可能需要管理员权限)?[Y/n]")
|
||||||
if ($ans -eq "" -or $ans -match "^[Yy]") {
|
if ($ans -eq "" -or $ans -match "^[Yy]") {
|
||||||
$useWinGetNode = $true
|
$useWinGetNode = $true
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ ARTEMIS 自己编排手机和已授权插件,共用网页的任务队列、历
|
|||||||
| 给出任务编号,问失败原因、token、缓存、录像或最终结论 | [诊断与复盘](references/diagnostics.md) |
|
| 给出任务编号,问失败原因、token、缓存、录像或最终结论 | [诊断与复盘](references/diagnostics.md) |
|
||||||
| 使用电脑、路由器、终端等已安装能力 | [插件任务参数](references/plugins.md) |
|
| 使用电脑、路由器、终端等已安装能力 | [插件任务参数](references/plugins.md) |
|
||||||
| 编写、适配、验证或发布 ARTEMIS 插件 | [插件开发规范](references/plugin-development.md),按需读取 [清单与市场协议](references/plugin-manifest.md) |
|
| 编写、适配、验证或发布 ARTEMIS 插件 | [插件开发规范](references/plugin-development.md),按需读取 [清单与市场协议](references/plugin-manifest.md) |
|
||||||
|
| 开发回放侧栏、人工表单或扩展报告字段 | [工作区插件接口(ARTEMIS 2.3.0+)](references/workspace-plugins.md) |
|
||||||
|
|
||||||
只读当前任务相关参考。普通执行不加载插件开发文档。
|
只读当前任务相关参考。普通执行不加载插件开发文档。
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## 模型与超时
|
## 模型与超时
|
||||||
|
|
||||||
探索独立保存模型配置,默认 `gpt-6.1-sol / high`,预设也提供 `gpt-6-astra`,允许自定义模型。执行、人工示范分析、用例提炼和结束后的讨论使用这套配置。修改默认值仅影响新探索;已创建会话保留配置快照,Flash/Pro 默认值不变。
|
探索独立保存模型配置,默认 `gpt-6.1-terra / high`,预设也提供 `gpt-6-astra`,允许自定义模型。执行、人工示范分析、用例提炼和结束后的讨论使用这套配置。修改默认值仅影响新探索;已创建会话保留配置快照,Flash/Pro 默认值不变。
|
||||||
|
|
||||||
默认每段主动执行 1800 秒。模型调用、设备动作、录像分析计入;排队、等待回答和人工示范不计入。到时保存进度并暂停,可点击「继续探索」开启下一段;不会仅因超时把测试判成失败,累计主动耗时仍保留。
|
默认每段主动执行 1800 秒。模型调用、设备动作、录像分析计入;排队、等待回答和人工示范不计入。到时保存进度并暂停,可点击「继续探索」开启下一段;不会仅因超时把测试判成失败,累计主动耗时仍保留。
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
## 模式、模型与配置
|
## 模式、模型与配置
|
||||||
|
|
||||||
- `mobile_run_task.model` 取 `Flash` / `Pro`。API 模型名放 `runtime_overrides.model`;思考强度放 `runtime_overrides.reasoning_effort`。批次使用 `task_config.profile` 选择模式,`task_config.model` 选择 API 模型。
|
- `mobile_run_task.model` 取 `Flash` / `Pro`。API 模型名放 `runtime_overrides.model`;思考强度放 `runtime_overrides.reasoning_effort`。批次使用 `task_config.profile` 选择模式,`task_config.model` 选择 API 模型。
|
||||||
- 探索独立配置,默认 `gpt-6.1-sol/high`,支持 `gpt-6-astra` 及已配置网关支持的自定义模型。执行、示范分析、提炼共用该探索配置;不改变 Flash/Pro 默认值。
|
- 探索独立配置,默认 `gpt-6.1-terra/high`,支持 `gpt-6-astra` 及已配置网关支持的自定义模型。执行、示范分析、提炼共用该探索配置;不改变 Flash/Pro 默认值。
|
||||||
- 默认 high、单次模型请求时限 300 秒。`default` 表示不发送思考强度,`none` 是显式关闭,不能混为一谈;接口不支持参数时如实报告,不擅自降级。
|
- 默认 high、单次模型请求时限 300 秒。`default` 表示不发送思考强度,`none` 是显式关闭,不能混为一谈;接口不支持参数时如实报告,不擅自降级。
|
||||||
- 请求时限与整任务主动执行时限不同。排队/用户暂停不计入任务主动执行;探索等待回答、人工示范也不计入。
|
- 请求时限与整任务主动执行时限不同。排队/用户暂停不计入任务主动执行;探索等待回答、人工示范也不计入。
|
||||||
- 录屏 `record_video` 和 AI 视频分析 `analyze_video` 独立,默认关闭。需要可下载录像时明确启用录屏。
|
- 录屏 `record_video` 和 AI 视频分析 `analyze_video` 独立,默认关闭。需要可下载录像时明确启用录屏。
|
||||||
|
|||||||
Loaded 100 of 136 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user