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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/moss-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Test experiment storage and preview resources
run: node --import tsx/esm --test internal/experiment/tests/workflow.test.mjs internal/experiment/tests/agent-tools.test.mjs internal/experiment/tests/preview-resources.test.mjs internal/experiment/tests/robot-status-plugin.test.mjs internal/experiment/tests/robot-control.test.mjs internal/xiaozhi/*.test.mjs
- name: Test plugin lock, recovery and download resources
run: node --import tsx/esm --test internal/experiment/tests/plugin-runtime.test.mjs internal/experiment/tests/preview-recovery.test.mjs internal/experiment/tests/install-readiness.test.mjs
run: node --import tsx/esm --test internal/experiment/tests/plugin-runtime.test.mjs internal/experiment/tests/preview-recovery.test.mjs internal/experiment/tests/install-readiness.test.mjs internal/experiment/tests/labscriptai-tools.test.mjs
- uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: labscriptai-ot.lock.json
Expand Down
8 changes: 6 additions & 2 deletions MOSS-LAB.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ node moss-start.mjs

`.dsh-local/` 保存网页会话、实验数据库、插件安装和产物。升级前停止旧服务并备份此目录与 `.env`;保留已有数据库,不要用空目录覆盖。旧 `labscriptai-ot/.venv` 不再使用,确认没有独立用途后可自行删除。模拟及动画不代表机器人就绪;状态查询不会执行机器人动作。

要在真机运行,在 `.env` 中配置 `OPENTRONS_URL` 和 `MOSS_ALLOW_LIVE_ROBOT=1`。在「实验助手」中分析当前协议后,明确要求运行,再在网页核对设备、实验版本和实体台面并确认。暂停和继续需要网页确认。可以直接停止当前会话的运行。断线后先查询原运行状态,再决定是否继续。
「实验助手」读取 LabscriptAI 发布的工具和实验指引。在网页打开小智当前的实验会话,即可继续同一个实验。说“看台面”可按需调用插件拍照和识别。若识别缺依赖,可用 `MOSS_VISION_PYTHON` 指向装有插件视觉依赖的 Python。照片通过工作台的通用图片附件显示,取决于当前模型是否支持图片输入。

要在真机运行,在 `.env` 中配置 `OPENTRONS_URL` 和 `MOSS_ALLOW_LIVE_ROBOT=1`。分析当前协议,明确要求运行,再在网页核对设备、实验版本和实体台面。一次确认覆盖本次运行及 LabscriptAI 支持的小故障自动恢复。暂停和继续需要网页确认。可以直接停止当前会话的运行。断线后先查询原运行状态,再决定是否继续。

网页 CI 使用 `MOSS web` 工作流检查构建、类型、实验存储与预览资源,以及网页客户端启动。该工作流不部署网站或操作真实机器人;Windows 安装任务使用受限模型凭据验证已安装程序与两机型本地仿真。

Expand Down Expand Up @@ -60,7 +62,9 @@ New tasks default to the experiment assistant, which is also available in the mo

`.dsh-local/` stores web sessions, experiments, plugin installations, and artifacts. Stop the old service and back up this directory and `.env` before upgrading; preserve the existing database. The old `labscriptai-ot/.venv` is no longer used; remove it only after checking for independent uses. Simulation and animation do not establish robot readiness; status queries do not move the robot.

For physical operation, set `OPENTRONS_URL` and `MOSS_ALLOW_LIVE_ROBOT=1` in `.env`. Analyze the current protocol in the experiment assistant, explicitly request a live run, then confirm the device, revision, and physical deck in the workbench. Pause and resume require confirmation. Stop is available for a run owned by the current conversation. Read the original run status after a lost connection before sending further actions.
The experiment assistant discovers the tools and instructions published by LabscriptAI. Open the active Xiaozhi conversation in the workbench to continue its experiment by text. Ask to see the deck to invoke the plugin's camera and recognition on demand. If recognition dependencies are missing, set `MOSS_VISION_PYTHON` to a Python interpreter with the plugin's vision dependencies. The workbench uses its shared image attachment path when the selected model supports image input.

For physical operation, set `OPENTRONS_URL` and `MOSS_ALLOW_LIVE_ROBOT=1` in `.env`. Analyze the current protocol, request a live run, and confirm the device, revision, and physical deck in the workbench. This approval covers the run and LabscriptAI automatic recovery for supported minor faults. Pause and resume require confirmation. Stop is available for a run owned by the current conversation. Read the original run status after a lost connection before sending further actions.

The `MOSS web` workflow checks the build, types, experiment storage and preview resources, and web client boot. It does not deploy the site or operate a physical robot. The Windows installer job uses bounded model credentials to verify the installed workbench and both local robot simulations.

Expand Down
4 changes: 2 additions & 2 deletions internal/experiment/README.i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
en: 0ed09a3887f5793f
zh: 751c1e95eb15436f
/internal-experiment-storage/preview-components:
en: 7cad7f93de39c12c
zh: 3672094237841e16
en: f1a59d901d38188c
zh: d92b2cb054a16292
/internal-experiment-storage/known-limitations:
en: aa9ffe6c5947fe96
zh: efd1f266f9f1d178
2 changes: 2 additions & 0 deletions internal/experiment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Run the declaration and tool tests with `node --import tsx/esm --test internal/e

`PreviewResources` rechecks the owner and current task before serving `animation`, `setup`, or manifest-listed downloads. The version-locked MCP adapter confines each plugin process's writes to a private directory. Interrupted invocations retain that directory because child-process termination is uncertain. See [MOSS setup](../../MOSS-LAB.md).

The experiment preset registers the pinned server's published MCP schemas and loads the plugin's experiment instructions. The adapter binds requests to the executing conversation and configured robot, keeps the plugin's conversation data across calls, and publishes returned camera images through the shared MCP attachment adapter. Physical actions outside an approved run require a device confirmation. LabscriptAI `runtime_watch` can send recovery actions even when passed `self_fix_mode=observe`, so the preset reserves that tool for an active run with recorded recovery approval. Read-only run status uses history or the recovery monitor with execution disabled.

A passed `protocol-analysis` check stores the full analysis bytes (`analysisBase64`) next to its SHA-256. `get_experiment` omits those bytes from its check results; they remain available internally for preview recovery. Published previews and per-session selection live only in process memory; when a session's status is polled after a restart and no preview is selected, the status route rebuilds the scene from the persisted analysis of the latest passed check for that session's newest experiment, verifies its digest, and reports `checking` until the rebuild finishes. Each process attempts recovery at most once per completed check; polling before a check passes does not consume that attempt. A stored check recorded before analysis persistence began cannot recover.

The authenticated `/api/robot-status` route reads `OPENTRONS_URL` at startup and queries only the robot's health and instruments endpoints on demand. It returns available model, health status, instruments and query time; an unconfigured, unreachable or partially responding robot is reported separately. This snapshot is not a device-readiness or safety assessment.
Expand Down
2 changes: 2 additions & 0 deletions internal/experiment/README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Agent 工具要求完整 Python 源码。可选的 `parameters.initialVolumeUl`

`PreviewResources` 在提供 `animation`、`setup` 或清单内的下载文件前,核对归属和当前任务。锁定版本的 MCP 适配器将每次插件调用的写入限制在私有目录内。调用中断后保留该目录,因为无法确认子进程已经退出。见 [MOSS 安装](../../MOSS-LAB.md)。

实验助手预设注册固定版本服务公开的 MCP 工具定义,并加载插件的实验指引。适配器绑定当前会话和已配置的机器人,跨调用保留插件会话数据,并通过通用 MCP 附件适配器提供拍摄的图片。已批准运行范围以外的真机操作需要设备确认。LabscriptAI 的 `runtime_watch` 即使收到 `self_fix_mode=observe` 也可能发送恢复动作,因此预设只允许它监看已记录恢复授权的活动运行。只读查询可使用运行历史,或使用禁用执行的恢复监控。

通过的 `protocol-analysis` 检查在 SHA-256 之外保存完整分析数据(`analysisBase64`)。`get_experiment` 的检查结果不返回这些数据;内部仍可使用它们恢复预览。已发布预览和会话内选择仅保存在进程内存中;重启后轮询某会话状态且没有已选预览时,状态路由会用该会话最新实验的最新通过检查所保存的分析数据重建场景,校验其摘要,并在重建完成前返回 `checking`。每个进程对每项已完成检查最多尝试一次恢复;检查通过前的轮询不会消耗这次尝试。分析持久化开始之前记录的检查无法恢复。

认证路由 `/api/robot-status` 在启动时读取 `OPENTRONS_URL`,仅在用户请求时查询机器人的健康及移液器接口。结果包含可用的型号、健康状态、移液器和查询时间;未配置、不可达或部分响应分别报告。此快照不代表设备已就绪或实验安全。
Expand Down
16 changes: 12 additions & 4 deletions internal/experiment/agent-tools.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,23 @@ export function apply(ctx) {
}), 'experiment-agent-tools.guidance')
ctx.tools.register(defineTool({
name: 'request_experiment_input',
description: 'Ask one concise question for essential experiment details, then wait for the operator to answer.',
parameters: { question: { type: 'string', required: true, description: 'Question in the operator’s language.' } },
description: 'Ask one concise question for essential experiment details, then wait for the operator to answer. When the message came from 小智, also pass voice_progress: one short spoken sentence summarizing what is already decided (at most 30 characters), and voice_question: one short spoken line naming only the missing facts (at most 30 characters), for example voice_progress 我按默认参数先做了 and voice_question 还需要:目标板孔位、每孔体积。',
parameters: {
question: { type: 'string', required: true, description: 'Question in the operator’s language.' },
voice_progress: { type: 'string', description: 'Optional spoken one-sentence summary of what is already decided, at most 30 characters.' },
voice_question: { type: 'string', description: 'Optional spoken one-liner for the voice device: only the missing facts, at most 30 characters.' },
},
output,
async execute(args, exec) {
if (!args.question.trim() || Buffer.byteLength(args.question) > 2000) throw new Error('A concise nonempty question is required.')
const voice = typeof args.voice_question === 'string' ? args.voice_question.trim() : ''
if (voice && [...voice].length > 40) throw new Error('voice_question must be at most 40 characters.')
const progress = typeof args.voice_progress === 'string' ? args.voice_progress.trim() : ''
if (progress && [...progress].length > 40) throw new Error('voice_progress must be at most 40 characters.')
const intent = ctx.get('mossVoiceIntent')?.captureIntent(sessionId(exec))
intent?.assertCurrent()
intent?.needsInput(args.question)
return { status: 'needs_input', question: args.question }
intent?.needsInput(args.question, voice || undefined, progress || undefined)
return { status: 'needs_input', question: args.question, ...(voice ? { voice_question: voice } : {}), ...(progress ? { voice_progress: progress } : {}) }
},
}))

Expand Down
Loading
Loading