Repository navigation
Conversation
Describe a device in one .mjs file (screenshot + input primitives + custom actions), run `midscene-connect serve` to expose it with an OpenAPI/Swagger documented HTTP protocol, then drive it via agentOverConnectProtocol, the generated CLI commands, or the Playground.
4 of 5 tasks
Deploying midscene with
|
| Latest commit: |
be04e92
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://72de40e0.midscene.pages.dev |
| Branch Preview URL: | https://feat-connect.midscene.pages.dev |
await-ovo
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
@midscene/connect(midscene-connectCLI), which replaces the Universal Device stack inmidscene-test-everythingwith a much smaller design that lives in the main repo..mjsdefault-exports{ name, description, pointerType, options, connect(options) }.connect()returnsscreenshot()plus a flatactionsmap. Keys that match coreInputPrimitivesnames (tap,swipe,typeText,homeButton, …) are plain functions. Any other key is a custom action{ description, params, call }. Primitive group rules are checked at startup: the keyboard trio must come together, andswipeneedspointerType.x-midscene-locatemarks AI-located elements. The client converts the subset to zod for core planning.midscene-connect serve <device.mjs> [--port --host --token --<device options>]: one process holds one device instance. Actions run one at a time, with no sessions or leases. The server ships Swagger at/api/docs/and OpenAPI at/api/openapi.json. A token is required on non-loopback hosts and is auto-generated if not given.@midscene/connect/server:createConnectHandler(device, { basePath, token })for embedding into existing servers (e.g. iOS AirLink, which serves many phones).agentOverConnectProtocol({ url, token }):RemoteDevicerebuilds the action space withdefineActionsFromInputPrimitivesand adds the remote custom actions.BaseMidsceneToolsandrunToolsCLI.midscene-connect playground.README.md/README.zh.md, andintegrate-with-any-interface(en/zh) on the site has a new "Connect a device without writing a class" section.Validation
cd packages/connect && npx rstest: 19 tests pass. They cover the schema subset, device validation, and a realserveDevicedriven byRemoteDevice: primitives, custom actions, 400/401/404, OpenAPI, agent context.cd packages/connect && npx tsc --noEmit -p tsconfig.jsonnpx nx build connectpnpm run lintpnpm install --frozen-lockfiletests/fixtures/mock-device.mjs, then ran:curlagainst every endpoint--help,take_screenshot,homebutton,input, and the custom actionmidscene-connect playground --no-open: page loads and the action space is exposedact/assertagainst a real model.Follow-ups