@alwith/module-device 0.0.0-stage → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +94 -0
- package/README.md +13 -2
- package/THIRD_PARTY_NOTICES.md +4 -0
- package/dist/chunk-6acejx53.js +2 -0
- package/dist/chunk-brbw9wqh.js +2 -0
- package/dist/chunk-ek1jm29t.js +2 -0
- package/dist/chunk-fj7w5b36.js +2 -0
- package/dist/chunk-m6q76fpn.js +2 -0
- package/dist/chunk-wfcd0qt8.js +2 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +1 -0
- package/dist/preview/bezel.d.ts +31 -0
- package/dist/preview/bezel.js +1 -0
- package/dist/preview/device-panel.d.ts +2 -0
- package/dist/preview/device-panel.js +1 -0
- package/dist/preview/gestures.d.ts +41 -0
- package/dist/preview/gestures.js +1 -0
- package/dist/preview/index.d.ts +9 -0
- package/dist/preview/index.js +1 -0
- package/dist/preview/locales.d.ts +69 -0
- package/dist/preview/locales.js +1 -0
- package/dist/preview/menu.d.ts +27 -0
- package/dist/preview/menu.js +1 -0
- package/dist/preview/screens.d.ts +19 -0
- package/dist/preview/screens.js +1 -0
- package/dist/preview/types.d.ts +118 -0
- package/dist/preview/types.js +0 -0
- package/licenses/base64-LICENSE-MIT +21 -0
- package/package.json +53 -4
- package/proxy/stdio.mjs +19 -0
- package/rust/Cargo.toml +15 -0
- package/rust/src/lib.rs +199 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
ALwith Developer and Redistribution License, Version 1.0
|
|
2
|
+
Copyright 2026 ALWITHAI PTE. LTD. All rights reserved, except as expressly granted below.
|
|
3
|
+
|
|
4
|
+
1. Scope
|
|
5
|
+
This license applies only to ALWITHAI PTE. LTD.'s ("ALwith") own material in
|
|
6
|
+
the npm package accompanying this license (the "Software"). It is a proprietary
|
|
7
|
+
license, not an open-source license. Third-party material is governed by its
|
|
8
|
+
respective licenses, as described in THIRD_PARTY_NOTICES.md. No restriction here
|
|
9
|
+
reduces rights granted by those licenses or by mandatory applicable law.
|
|
10
|
+
|
|
11
|
+
2. Permission to develop and distribute applications
|
|
12
|
+
Subject to this license, ALwith grants you a worldwide, non-exclusive, royalty-free
|
|
13
|
+
copyright license to use, reproduce, integrate and modify the supplied Software
|
|
14
|
+
to develop, test, host and operate your own applications, for personal,
|
|
15
|
+
internal business or commercial use. You may brand,
|
|
16
|
+
sell and distribute those applications, including the Software embedded in them,
|
|
17
|
+
to your customers and end users. No per-application registration, approval or
|
|
18
|
+
royalty is required by this software license.
|
|
19
|
+
|
|
20
|
+
You may bundle, minify, transform and otherwise adapt the supplied JavaScript,
|
|
21
|
+
styles and declarations for those applications. You may include the supplied
|
|
22
|
+
Software in an application source distribution when necessary to build or use
|
|
23
|
+
that application, provided it remains separately identified under this license.
|
|
24
|
+
You may combine it with separately licensed application code, including MPL-2.0
|
|
25
|
+
code, while complying with both licenses. Your own independent code remains yours;
|
|
26
|
+
this license does not require disclosure of your application source code.
|
|
27
|
+
|
|
28
|
+
Recipients may use the embedded Software to run the application and exercise the
|
|
29
|
+
permissions above under this same license. You may allow your contractors and
|
|
30
|
+
hosting providers to use it for those purposes. You must supply this license and
|
|
31
|
+
all applicable third-party notices with each redistribution (for example in an
|
|
32
|
+
included licenses directory or an accessible legal-notices page), identify your
|
|
33
|
+
modifications, and not impose terms that purport to change ALwith's license.
|
|
34
|
+
|
|
35
|
+
3. Rights reserved
|
|
36
|
+
No right to ALwith's unpublished source code, private repositories, trademarks,
|
|
37
|
+
or separately distributed Runtime binaries, modules or services is granted here.
|
|
38
|
+
You may not relicense the Software as your own framework or redistribute it as
|
|
39
|
+
a standalone SDK/package for others, except for private development/build caches
|
|
40
|
+
used for applications permitted by Section 2. No restriction is imposed on
|
|
41
|
+
independently developed competing applications or on third-party licensed code.
|
|
42
|
+
You must not misrepresent authorship or imply ALwith endorses your application.
|
|
43
|
+
|
|
44
|
+
4. Accounts and services
|
|
45
|
+
This license does not supply platform credentials, paid entitlements, hosting,
|
|
46
|
+
support, updates or a service-availability guarantee. Use of ALwith accounts,
|
|
47
|
+
pets, relay or other hosted services is separately subject to the applicable
|
|
48
|
+
service terms and authorization. Do not bypass service access controls or use
|
|
49
|
+
another person's credentials without authorization. Choosing or replacing an
|
|
50
|
+
authentication provider for your own application is not prohibited by this
|
|
51
|
+
software license. Distributing an Auth client does not authorize its recipients
|
|
52
|
+
to access another user's account, data or entitlements.
|
|
53
|
+
|
|
54
|
+
5. Lawful use and independent responsibility
|
|
55
|
+
You must not use the Software to commit or knowingly facilitate unlawful acts.
|
|
56
|
+
You are responsible for your application's operation, permissions, business
|
|
57
|
+
practices, data processing, content and compliance with applicable law. You must
|
|
58
|
+
not make warranties or commitments on ALwith's behalf. ALwith does not endorse
|
|
59
|
+
your application merely because it uses the Software or connects to ALwith.
|
|
60
|
+
These allocations do not remove either party's own mandatory legal obligations.
|
|
61
|
+
|
|
62
|
+
6. Disclaimer and limitation of liability
|
|
63
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE IS PROVIDED
|
|
64
|
+
"AS IS" AND "AS AVAILABLE", WITHOUT EXPRESS OR IMPLIED WARRANTIES, INCLUDING
|
|
65
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ACCURACY,
|
|
66
|
+
SECURITY OR UNINTERRUPTED OPERATION. AI OUTPUTS AND AUTOMATED ACTIONS MAY BE
|
|
67
|
+
INCORRECT OR HARMFUL; YOU MUST DETERMINE APPROPRIATE REVIEW AND SAFEGUARDS.
|
|
68
|
+
|
|
69
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, ALWITH AND ITS CONTRIBUTORS
|
|
70
|
+
ARE NOT LIABLE FOR DAMAGES ARISING FROM USE, MODIFICATION OR DISTRIBUTION OF
|
|
71
|
+
THE SOFTWARE, INCLUDING LOST PROFITS, LOST DATA, BUSINESS INTERRUPTION AND
|
|
72
|
+
INDIRECT OR CONSEQUENTIAL LOSS. NOTHING EXCLUDES OR LIMITS LIABILITY THAT
|
|
73
|
+
CANNOT LAWFULLY BE EXCLUDED OR LIMITED, INCLUDING APPLICABLE MANDATORY CONSUMER
|
|
74
|
+
RIGHTS AND LIABILITY FOR FRAUD, WILLFUL MISCONDUCT OR GROSS NEGLIGENCE WHERE
|
|
75
|
+
SUCH EXCLUSION OR LIMITATION IS PROHIBITED. THIS LICENSE DOES NOT EXCLUDE
|
|
76
|
+
CRIMINAL OR REGULATORY RESPONSIBILITY IMPOSED BY LAW.
|
|
77
|
+
|
|
78
|
+
7. Duration and termination
|
|
79
|
+
The grant for this version continues while you comply with this license. If
|
|
80
|
+
ALwith gives written notice of a material breach, your rights terminate if you
|
|
81
|
+
do not cure it within 30 days; no cure period authorizes continuing unlawful
|
|
82
|
+
conduct. On termination, cease new use and distribution of ALwith's proprietary
|
|
83
|
+
Software except as required by law. Independently compliant recipients retain
|
|
84
|
+
their own grants. Sections concerning reserved rights, notices, disclaimers and
|
|
85
|
+
mandatory-law exceptions survive as applicable. Third-party licenses are not
|
|
86
|
+
terminated by this provision.
|
|
87
|
+
|
|
88
|
+
8. Versions and severability
|
|
89
|
+
This license governs the accompanying version. A later license or publication
|
|
90
|
+
of source code does not retroactively replace this grant or revoke rights in
|
|
91
|
+
earlier lawfully obtained versions. Any additional open-source license must be
|
|
92
|
+
expressly identified by ALwith. If a provision is unenforceable, the remaining
|
|
93
|
+
provisions continue to the extent permitted by law. A separate written agreement
|
|
94
|
+
signed by you and ALwith may expressly override these terms for its stated scope.
|
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Device module
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Managed iOS simulators (Android emulators follow) for every ALwith application. The native host owns
|
|
4
|
+
device discovery, leases, app launch, log capture and crash reports; agents reach it through the private
|
|
5
|
+
MCP server `alwith_device` with the tools `control` and `logs`. Development sessions and QA runs are two
|
|
6
|
+
owner kinds of the same lease table.
|
|
7
|
+
|
|
8
|
+
The TypeScript entry composes the MCP descriptor from a registration (gateway address and one-time
|
|
9
|
+
token) and the host's JavaScript runtime. `./preview` provides the shared device panel: device picker,
|
|
10
|
+
bezel, frame display and gesture mapping. Hosts supply a `DeviceBridge` and own panel placement,
|
|
11
|
+
session binding and explicit take-over.
|
|
12
|
+
|
|
13
|
+
`rust/` is the public thin client over `alwith-native-client`; the implementation ships as
|
|
14
|
+
`@alwith/native-device`.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Button as C}from"@nyssance/shadcn/vega/components/ui/button";import{DropdownMenu as E,DropdownMenuCheckboxItem as y,DropdownMenuContent as G,DropdownMenuGroup as c,DropdownMenuItem as N,DropdownMenuLabel as S,DropdownMenuSeparator as v,DropdownMenuShortcut as m,DropdownMenuTrigger as I}from"@nyssance/shadcn/vega/components/ui/dropdown-menu";import{ChevronDown as x}from"lucide-react";import{jsx as o,jsxs as i}from"react/jsx-runtime";function t({label:l,ariaLabel:r,entries:n,disabled:a,caret:b=!0,align:k="start",variant:h="ghost",size:M="sm",className:w,children:g,onOpenChange:D}){let f=typeof n==="function"?n():n;return i(E,{onOpenChange:D,children:[i(I,{render:o(C,{variant:h,size:M,className:w,"aria-label":r,disabled:a}),children:[g??l,b&&o(x,{"data-icon":"inline-end",className:"opacity-60","aria-hidden":!0})]}),o(G,{align:k,className:"min-w-48",children:L(f).map((d,u)=>{if(d.kind==="separator")return o(v,{},u);let s=d.items.map((e,p)=>e.checked!==void 0?i(y,{checked:e.checked,disabled:e.disabled,onClick:e.onSelect,children:[e.label,e.hint&&o(m,{children:e.hint})]},p):i(N,{disabled:e.disabled,onClick:e.onSelect,children:[e.label,e.hint&&o(m,{children:e.hint})]},p));return d.label===void 0?o(c,{children:s},u):i(c,{children:[o(S,{children:d.label}),s]},u)})})]})}function L(l){let r=[],n=null;for(let a of l)if(a.kind==="separator")n=null,r.push({kind:"separator"});else if(a.kind==="section")n={kind:"group",label:a.label,items:[]},r.push(n);else{if(n===null)n={kind:"group",items:[]},r.push(n);n.items.push(a)}return r}
|
|
2
|
+
export{t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var i={menuEdit:"Edit",menuDevice:"Device",menuView:"View",undo:"Undo",redo:"Redo",cut:"Cut",copy:"Copy",paste:"Paste",selectAll:"Select all",delete:"Delete",inputUnavailable:"Input is not available until the simulator helper ships",appearance:"Appearance",light:"Light",dark:"Dark",statusBar:"Status bar",statusLive:"Live",statusShowcase:"9:41, full signal and battery",shutdown:"Shut down",restart:"Restart",detach:"Detach simulator",chooseDevice:"Choose simulator",booted:"Booted",willBoot:"Available (will boot)",noSimulators:"No simulators found. Install one in Xcode.",loadingDevices:"Loading devices…",zoomIn:"Zoom in",zoomOut:"Zoom out",zoomFit:"Zoom to fit",actualSize:"Actual size",frameRate:"Frame rate",fpsIdle:"FPS: idle",fpsValue:"FPS: {fps}",expand:"Expand",collapse:"Collapse",close:"Close",attachTitle:"Attach a simulator so {agent} can see your app",attachBody:"{agent} will control this simulator and take screenshots of its entire screen.",xcodeInstalled:"Xcode and Simulator installed",unavailable:"{device} isn’t available anymore. Choose another simulator.",attach:"Attach simulator",attaching:"Attaching…",booting:"Booting…",trademark:"Xcode is a trademark of Apple Inc., registered in the U.S. and other countries.",consentTitle:"Let {agent} use this simulator?",consentBody:"{agent} will view this device’s screen through screenshots and control it by tapping and typing.",consentRetention:"Screenshots are sent to your model provider and follow your conversation retention settings.",consentScreen:"Anything on the screen, including notifications and other open apps, can end up in your conversation.",consentAccounts:"Don’t sign in to real accounts. Use test accounts and test data instead.",consentSettings:"You can detach the simulator at any time.",cancel:"Cancel",continue:"Continue",home:"Home",rotate:"Rotate right",screenshot:"Save screenshot",record:"Record video",logs:"Show logs",touchSurface:"Simulator touch surface. Click to focus, then type to send keystrokes.",liveStream:"Live view of {device}",takeOver:"You are operating this device",logsTitle:"Simulator logs",logsEmpty:"No log lines yet. Logs start when the agent launches the app or reads them.",closeLogs:"Close logs",screenshotSaved:"Screenshot saved to {path}",notYetAvailable:"Not available in this version"},s={menuEdit:"编辑",menuDevice:"设备",menuView:"视图",undo:"撤销",redo:"重做",cut:"剪切",copy:"复制",paste:"粘贴",selectAll:"全选",delete:"删除",inputUnavailable:"模拟器 helper 发布前暂不支持输入",appearance:"外观",light:"浅色",dark:"深色",statusBar:"状态栏",statusLive:"实时",statusShowcase:"9:41,满信号满电量",shutdown:"关机",restart:"重新启动",detach:"分离模拟器",chooseDevice:"选择模拟器",booted:"已启动",willBoot:"可用(将启动)",noSimulators:"没有找到模拟器,请在 Xcode 中安装。",loadingDevices:"正在加载设备…",zoomIn:"放大",zoomOut:"缩小",zoomFit:"适应窗口",actualSize:"实际大小",frameRate:"帧率",fpsIdle:"FPS:空闲",fpsValue:"FPS:{fps}",expand:"放大面板",collapse:"还原面板",close:"关闭",attachTitle:"连接模拟器,让 {agent} 能查看您的应用",attachBody:"{agent} 将控制此模拟器并对其整个屏幕进行截图。",xcodeInstalled:"已安装 Xcode 和 Simulator",unavailable:"{device} 已不可用。请选择其他模拟器。",attach:"附加模拟器",attaching:"正在附加…",booting:"正在启动…",trademark:"Xcode 是 Apple Inc. 在美国和其他国家和地区注册的商标。",consentTitle:"允许 {agent} 使用此模拟器?",consentBody:"{agent} 将通过屏幕截图查看此设备的屏幕,并通过点按和输入来控制该设备。",consentRetention:"截图将发送至您的模型服务商,并遵循您的对话保留设置。",consentScreen:"屏幕上的任何内容,包括通知和其他已打开的应用,都可能出现在您的对话中。",consentAccounts:"请勿登录真实账户。请改用测试账户和测试数据。",consentSettings:"您可以随时分离模拟器。",cancel:"取消",continue:"继续",home:"主屏幕",rotate:"向右旋转",screenshot:"保存截图",record:"录制视频",logs:"显示日志",touchSurface:"模拟器触摸区。点击聚焦后可输入按键。",liveStream:"{device} 的实时画面",takeOver:"您正在操作这台设备",logsTitle:"模拟器日志",logsEmpty:"还没有日志。智能体启动应用或读取日志后开始记录。",closeLogs:"关闭日志",screenshotSaved:"截图已保存至 {path}",notYetAvailable:"此版本暂不可用"},l={...s,menuEdit:"編輯",menuDevice:"裝置",menuView:"檢視",undo:"復原",redo:"重做",cut:"剪下",copy:"複製",paste:"貼上",selectAll:"全選",delete:"刪除",inputUnavailable:"模擬器 helper 發佈前暫不支援輸入",appearance:"外觀",light:"淺色",dark:"深色",statusBar:"狀態列",statusLive:"即時",statusShowcase:"9:41,滿訊號滿電量",shutdown:"關機",restart:"重新啟動",detach:"分離模擬器",chooseDevice:"選擇模擬器",booted:"已啟動",willBoot:"可用(將啟動)",noSimulators:"找不到模擬器,請在 Xcode 中安裝。",loadingDevices:"正在載入裝置…",zoomIn:"放大",zoomOut:"縮小",zoomFit:"符合視窗",actualSize:"實際大小",frameRate:"影格率",fpsIdle:"FPS:閒置",expand:"放大面板",collapse:"還原面板",close:"關閉",attachTitle:"連接模擬器,讓 {agent} 能查看您的應用程式",attachBody:"{agent} 將控制此模擬器並擷取其整個螢幕。",xcodeInstalled:"已安裝 Xcode 和 Simulator",unavailable:"{device} 已無法使用。請選擇其他模擬器。",attach:"附加模擬器",attaching:"正在附加…",booting:"正在啟動…",trademark:"Xcode 是 Apple Inc. 在美國和其他國家/地區註冊的商標。",consentTitle:"允許 {agent} 使用此模擬器?",consentBody:"{agent} 將透過螢幕擷圖查看此裝置的螢幕,並透過點按和輸入來控制它。",consentRetention:"擷圖將傳送至您的模型服務商,並遵循您的對話保留設定。",consentScreen:"螢幕上的任何內容,包括通知和其他已開啟的應用程式,都可能出現在您的對話中。",consentAccounts:"請勿登入真實帳戶。請改用測試帳戶和測試資料。",consentSettings:"您可以隨時分離模擬器。",cancel:"取消",continue:"繼續",home:"主畫面",rotate:"向右旋轉",screenshot:"儲存擷圖",record:"錄製影片",logs:"顯示記錄",touchSurface:"模擬器觸控區。點一下聚焦後即可輸入按鍵。",liveStream:"{device} 的即時畫面",takeOver:"您正在操作這台裝置",logsTitle:"模擬器記錄",logsEmpty:"尚無記錄。代理程式啟動應用程式或讀取記錄後開始記錄。",closeLogs:"關閉記錄",screenshotSaved:"擷圖已儲存至 {path}",notYetAvailable:"此版本暫不可用"},d={menuEdit:"編集",menuDevice:"デバイス",menuView:"表示",undo:"取り消す",redo:"やり直す",cut:"カット",copy:"コピー",paste:"ペースト",selectAll:"すべてを選択",delete:"削除",inputUnavailable:"シミュレータヘルパーの提供まで入力は利用できません",appearance:"外観",light:"ライト",dark:"ダーク",statusBar:"ステータスバー",statusLive:"ライブ",statusShowcase:"9:41、電波とバッテリー満タン",shutdown:"システム終了",restart:"再起動",detach:"シミュレータを切り離す",chooseDevice:"シミュレータを選択",booted:"起動済み",willBoot:"利用可能(起動します)",noSimulators:"シミュレータが見つかりません。Xcode でインストールしてください。",loadingDevices:"デバイスを読み込み中…",zoomIn:"拡大",zoomOut:"縮小",zoomFit:"ウインドウに合わせる",actualSize:"実際のサイズ",frameRate:"フレームレート",fpsIdle:"FPS: アイドル",fpsValue:"FPS: {fps}",expand:"パネルを拡大",collapse:"パネルを戻す",close:"閉じる",attachTitle:"シミュレータを接続して {agent} にアプリを見せる",attachBody:"{agent} はこのシミュレータを操作し、画面全体のスクリーンショットを撮影します。",xcodeInstalled:"Xcode と Simulator がインストール済み",unavailable:"{device} は利用できなくなりました。別のシミュレータを選択してください。",attach:"シミュレータを接続",attaching:"接続中…",booting:"起動中…",trademark:"Xcode は米国およびその他の国で登録された Apple Inc. の商標です。",consentTitle:"{agent} にこのシミュレータの使用を許可しますか?",consentBody:"{agent} はスクリーンショットで画面を確認し、タップと入力で操作します。",consentRetention:"スクリーンショットはモデル提供者に送信され、会話の保持設定に従います。",consentScreen:"通知や開いている他のアプリなど、画面上のあらゆる内容が会話に含まれる可能性があります。",consentAccounts:"実際のアカウントでサインインしないでください。テスト用のアカウントとデータを使ってください。",consentSettings:"シミュレータはいつでも切り離せます。",cancel:"キャンセル",continue:"続ける",home:"ホーム",rotate:"右に回転",screenshot:"スクリーンショットを保存",record:"ビデオを録画",logs:"ログを表示",touchSurface:"シミュレータのタッチ領域。クリックしてフォーカスし、キー入力を送ります。",liveStream:"{device} のライブ表示",takeOver:"このデバイスを操作中です",logsTitle:"シミュレータのログ",logsEmpty:"ログはまだありません。エージェントがアプリを起動するかログを読むと記録が始まります。",closeLogs:"ログを閉じる",screenshotSaved:"スクリーンショットを {path} に保存しました",notYetAvailable:"このバージョンでは利用できません"},p={menuEdit:"편집",menuDevice:"기기",menuView:"보기",undo:"실행 취소",redo:"다시 실행",cut:"오려두기",copy:"복사",paste:"붙여넣기",selectAll:"모두 선택",delete:"삭제",inputUnavailable:"시뮬레이터 헬퍼가 출시되기 전에는 입력할 수 없습니다",appearance:"화면 모드",light:"라이트",dark:"다크",statusBar:"상태 막대",statusLive:"실시간",statusShowcase:"9:41, 신호와 배터리 가득",shutdown:"시스템 종료",restart:"재시동",detach:"시뮬레이터 분리",chooseDevice:"시뮬레이터 선택",booted:"실행 중",willBoot:"사용 가능(실행됨)",noSimulators:"시뮬레이터가 없습니다. Xcode에서 설치하세요.",loadingDevices:"기기 불러오는 중…",zoomIn:"확대",zoomOut:"축소",zoomFit:"창에 맞추기",actualSize:"실제 크기",frameRate:"프레임 속도",fpsIdle:"FPS: 대기",fpsValue:"FPS: {fps}",expand:"패널 확대",collapse:"패널 복원",close:"닫기",attachTitle:"시뮬레이터를 연결해 {agent}이(가) 앱을 보게 하세요",attachBody:"{agent}이(가) 이 시뮬레이터를 제어하고 전체 화면을 캡처합니다.",xcodeInstalled:"Xcode와 Simulator 설치됨",unavailable:"{device}을(를) 더 이상 사용할 수 없습니다. 다른 시뮬레이터를 선택하세요.",attach:"시뮬레이터 연결",attaching:"연결 중…",booting:"시동 중…",trademark:"Xcode는 미국 및 기타 국가에 등록된 Apple Inc.의 상표입니다.",consentTitle:"{agent}이(가) 이 시뮬레이터를 사용하도록 허용할까요?",consentBody:"{agent}은(는) 스크린샷으로 화면을 보고 탭과 입력으로 기기를 제어합니다.",consentRetention:"스크린샷은 모델 제공자에게 전송되며 대화 보관 설정을 따릅니다.",consentScreen:"알림과 열린 다른 앱을 포함해 화면의 모든 내용이 대화에 포함될 수 있습니다.",consentAccounts:"실제 계정으로 로그인하지 마세요. 테스트 계정과 테스트 데이터를 사용하세요.",consentSettings:"언제든지 시뮬레이터를 분리할 수 있습니다.",cancel:"취소",continue:"계속",home:"홈",rotate:"오른쪽으로 회전",screenshot:"스크린샷 저장",record:"비디오 녹화",logs:"로그 보기",touchSurface:"시뮬레이터 터치 영역입니다. 클릭해 포커스한 뒤 키를 입력하세요.",liveStream:"{device} 실시간 화면",takeOver:"이 기기를 직접 조작 중입니다",logsTitle:"시뮬레이터 로그",logsEmpty:"아직 로그가 없습니다. 에이전트가 앱을 실행하거나 로그를 읽으면 기록이 시작됩니다.",closeLogs:"로그 닫기",screenshotSaved:"스크린샷을 {path}에 저장했습니다",notYetAvailable:"이 버전에서는 사용할 수 없습니다"},g={menuEdit:"Bearbeiten",menuDevice:"Gerät",menuView:"Ansicht",undo:"Widerrufen",redo:"Wiederholen",cut:"Ausschneiden",copy:"Kopieren",paste:"Einsetzen",selectAll:"Alles auswählen",delete:"Löschen",inputUnavailable:"Eingaben sind erst mit dem Simulator-Helfer verfügbar",appearance:"Erscheinungsbild",light:"Hell",dark:"Dunkel",statusBar:"Statusleiste",statusLive:"Live",statusShowcase:"9:41, volles Signal und voller Akku",shutdown:"Ausschalten",restart:"Neu starten",detach:"Simulator trennen",chooseDevice:"Simulator wählen",booted:"Gestartet",willBoot:"Verfügbar (wird gestartet)",noSimulators:"Keine Simulatoren gefunden. Installiere einen in Xcode.",loadingDevices:"Geräte werden geladen …",zoomIn:"Vergrößern",zoomOut:"Verkleinern",zoomFit:"An Fenster anpassen",actualSize:"Originalgröße",frameRate:"Bildrate",fpsIdle:"FPS: inaktiv",fpsValue:"FPS: {fps}",expand:"Bereich vergrößern",collapse:"Bereich verkleinern",close:"Schließen",attachTitle:"Simulator verbinden, damit {agent} deine App sieht",attachBody:"{agent} steuert diesen Simulator und macht Bildschirmfotos des gesamten Bildschirms.",xcodeInstalled:"Xcode und Simulator installiert",unavailable:"{device} ist nicht mehr verfügbar. Wähle einen anderen Simulator.",attach:"Simulator verbinden",attaching:"Wird verbunden …",booting:"Wird gestartet …",trademark:"Xcode ist eine in den USA und anderen Ländern eingetragene Marke von Apple Inc.",consentTitle:"{agent} diesen Simulator verwenden lassen?",consentBody:"{agent} sieht den Bildschirm über Bildschirmfotos und steuert das Gerät durch Tippen und Eingaben.",consentRetention:"Bildschirmfotos gehen an deinen Modellanbieter und folgen deinen Aufbewahrungseinstellungen.",consentScreen:"Alles auf dem Bildschirm, auch Mitteilungen und andere offene Apps, kann in der Unterhaltung landen.",consentAccounts:"Melde dich nicht mit echten Konten an. Verwende Testkonten und Testdaten.",consentSettings:"Du kannst den Simulator jederzeit trennen.",cancel:"Abbrechen",continue:"Fortfahren",home:"Home",rotate:"Nach rechts drehen",screenshot:"Bildschirmfoto sichern",record:"Video aufnehmen",logs:"Protokoll anzeigen",touchSurface:"Touch-Fläche des Simulators. Klicke zum Fokussieren und tippe dann.",liveStream:"Liveansicht von {device}",takeOver:"Du bedienst dieses Gerät",logsTitle:"Simulator-Protokoll",logsEmpty:"Noch keine Protokollzeilen. Sie beginnen, sobald der Agent die App startet oder das Protokoll liest.",closeLogs:"Protokoll schließen",screenshotSaved:"Bildschirmfoto gesichert unter {path}",notYetAvailable:"In dieser Version nicht verfügbar"},m={menuEdit:"Édition",menuDevice:"Appareil",menuView:"Présentation",undo:"Annuler",redo:"Rétablir",cut:"Couper",copy:"Copier",paste:"Coller",selectAll:"Tout sélectionner",delete:"Supprimer",inputUnavailable:"La saisie sera disponible avec l’assistant du simulateur",appearance:"Apparence",light:"Clair",dark:"Sombre",statusBar:"Barre d’état",statusLive:"En direct",statusShowcase:"9:41, signal et batterie au maximum",shutdown:"Éteindre",restart:"Redémarrer",detach:"Détacher le simulateur",chooseDevice:"Choisir un simulateur",booted:"Démarré",willBoot:"Disponible (démarrera)",noSimulators:"Aucun simulateur trouvé. Installez-en un dans Xcode.",loadingDevices:"Chargement des appareils…",zoomIn:"Zoom avant",zoomOut:"Zoom arrière",zoomFit:"Ajuster à la fenêtre",actualSize:"Taille réelle",frameRate:"Fréquence d’images",fpsIdle:"FPS : inactif",fpsValue:"FPS : {fps}",expand:"Agrandir le panneau",collapse:"Réduire le panneau",close:"Fermer",attachTitle:"Attachez un simulateur pour que {agent} voie votre app",attachBody:"{agent} contrôlera ce simulateur et prendra des captures de tout l’écran.",xcodeInstalled:"Xcode et Simulator installés",unavailable:"{device} n’est plus disponible. Choisissez un autre simulateur.",attach:"Attacher le simulateur",attaching:"Attachement…",booting:"Démarrage…",trademark:"Xcode est une marque d’Apple Inc., déposée aux États-Unis et dans d’autres pays.",consentTitle:"Autoriser {agent} à utiliser ce simulateur ?",consentBody:"{agent} verra l’écran via des captures et contrôlera l’appareil par touchers et saisie.",consentRetention:"Les captures sont envoyées à votre fournisseur de modèle et suivent vos réglages de conservation.",consentScreen:"Tout ce qui est à l’écran, notifications et autres apps ouvertes comprises, peut apparaître dans la conversation.",consentAccounts:"Ne vous connectez pas à de vrais comptes. Utilisez des comptes et des données de test.",consentSettings:"Vous pouvez détacher le simulateur à tout moment.",cancel:"Annuler",continue:"Continuer",home:"Accueil",rotate:"Pivoter à droite",screenshot:"Enregistrer la capture",record:"Enregistrer une vidéo",logs:"Afficher le journal",touchSurface:"Surface tactile du simulateur. Cliquez pour activer, puis saisissez.",liveStream:"Vue en direct de {device}",takeOver:"Vous pilotez cet appareil",logsTitle:"Journal du simulateur",logsEmpty:"Aucune ligne pour l’instant. Le journal commence quand l’agent lance l’app ou le lit.",closeLogs:"Fermer le journal",screenshotSaved:"Capture enregistrée dans {path}",notYetAvailable:"Indisponible dans cette version"},h={menuEdit:"Edición",menuDevice:"Dispositivo",menuView:"Visualización",undo:"Deshacer",redo:"Rehacer",cut:"Cortar",copy:"Copiar",paste:"Pegar",selectAll:"Seleccionar todo",delete:"Eliminar",inputUnavailable:"La entrada estará disponible con el asistente del simulador",appearance:"Apariencia",light:"Claro",dark:"Oscuro",statusBar:"Barra de estado",statusLive:"En vivo",statusShowcase:"9:41, señal y batería al máximo",shutdown:"Apagar",restart:"Reiniciar",detach:"Desvincular simulador",chooseDevice:"Elegir simulador",booted:"Iniciado",willBoot:"Disponible (se iniciará)",noSimulators:"No se encontraron simuladores. Instala uno en Xcode.",loadingDevices:"Cargando dispositivos…",zoomIn:"Acercar",zoomOut:"Alejar",zoomFit:"Ajustar a la ventana",actualSize:"Tamaño real",frameRate:"Fotogramas por segundo",fpsIdle:"FPS: inactivo",fpsValue:"FPS: {fps}",expand:"Ampliar panel",collapse:"Restaurar panel",close:"Cerrar",attachTitle:"Vincula un simulador para que {agent} vea tu app",attachBody:"{agent} controlará este simulador y capturará toda su pantalla.",xcodeInstalled:"Xcode y Simulator instalados",unavailable:"{device} ya no está disponible. Elige otro simulador.",attach:"Vincular simulador",attaching:"Vinculando…",booting:"Iniciando…",trademark:"Xcode es una marca de Apple Inc., registrada en EE. UU. y otros países.",consentTitle:"¿Permitir que {agent} use este simulador?",consentBody:"{agent} verá la pantalla mediante capturas y controlará el dispositivo tocando y escribiendo.",consentRetention:"Las capturas se envían a tu proveedor de modelos y siguen tus ajustes de conservación.",consentScreen:"Todo lo que haya en pantalla, incluidas notificaciones y otras apps abiertas, puede acabar en la conversación.",consentAccounts:"No inicies sesión con cuentas reales. Usa cuentas y datos de prueba.",consentSettings:"Puedes desvincular el simulador en cualquier momento.",cancel:"Cancelar",continue:"Continuar",home:"Inicio",rotate:"Girar a la derecha",screenshot:"Guardar captura",record:"Grabar vídeo",logs:"Mostrar registro",touchSurface:"Superficie táctil del simulador. Haz clic para enfocar y escribe.",liveStream:"Vista en vivo de {device}",takeOver:"Estás manejando este dispositivo",logsTitle:"Registro del simulador",logsEmpty:"Aún no hay líneas. El registro empieza cuando el agente abre la app o lo lee.",closeLogs:"Cerrar registro",screenshotSaved:"Captura guardada en {path}",notYetAvailable:"No disponible en esta versión"},c={menuEdit:"Editar",menuDevice:"Dispositivo",menuView:"Visualizar",undo:"Desfazer",redo:"Refazer",cut:"Recortar",copy:"Copiar",paste:"Colar",selectAll:"Selecionar tudo",delete:"Apagar",inputUnavailable:"A entrada ficará disponível com o auxiliar do simulador",appearance:"Aparência",light:"Claro",dark:"Escuro",statusBar:"Barra de status",statusLive:"Ao vivo",statusShowcase:"9:41, sinal e bateria cheios",shutdown:"Desligar",restart:"Reiniciar",detach:"Desvincular simulador",chooseDevice:"Escolher simulador",booted:"Iniciado",willBoot:"Disponível (será iniciado)",noSimulators:"Nenhum simulador encontrado. Instale um no Xcode.",loadingDevices:"Carregando dispositivos…",zoomIn:"Ampliar",zoomOut:"Reduzir",zoomFit:"Ajustar à janela",actualSize:"Tamanho real",frameRate:"Taxa de quadros",fpsIdle:"FPS: ocioso",fpsValue:"FPS: {fps}",expand:"Ampliar painel",collapse:"Restaurar painel",close:"Fechar",attachTitle:"Vincule um simulador para que {agent} veja seu app",attachBody:"{agent} controlará este simulador e capturará a tela inteira.",xcodeInstalled:"Xcode e Simulator instalados",unavailable:"{device} não está mais disponível. Escolha outro simulador.",attach:"Vincular simulador",attaching:"Vinculando…",booting:"Iniciando…",trademark:"Xcode é uma marca da Apple Inc., registrada nos EUA e em outros países.",consentTitle:"Permitir que {agent} use este simulador?",consentBody:"{agent} verá a tela por capturas e controlará o dispositivo tocando e digitando.",consentRetention:"As capturas são enviadas ao seu provedor de modelo e seguem suas configurações de retenção.",consentScreen:"Tudo na tela, inclusive notificações e outros apps abertos, pode aparecer na conversa.",consentAccounts:"Não entre com contas reais. Use contas e dados de teste.",consentSettings:"Você pode desvincular o simulador a qualquer momento.",cancel:"Cancelar",continue:"Continuar",home:"Início",rotate:"Girar para a direita",screenshot:"Salvar captura",record:"Gravar vídeo",logs:"Mostrar registros",touchSurface:"Área de toque do simulador. Clique para focar e digite.",liveStream:"Visualização ao vivo de {device}",takeOver:"Você está operando este dispositivo",logsTitle:"Registros do simulador",logsEmpty:"Ainda não há linhas. Os registros começam quando o agente abre o app ou os lê.",closeLogs:"Fechar registros",screenshotSaved:"Captura salva em {path}",notYetAvailable:"Indisponível nesta versão"},v={menuEdit:"Modifica",menuDevice:"Dispositivo",menuView:"Vista",undo:"Annulla",redo:"Ripeti",cut:"Taglia",copy:"Copia",paste:"Incolla",selectAll:"Seleziona tutto",delete:"Elimina",inputUnavailable:"L’input sarà disponibile con l’helper del simulatore",appearance:"Aspetto",light:"Chiaro",dark:"Scuro",statusBar:"Barra di stato",statusLive:"In diretta",statusShowcase:"9:41, segnale e batteria al massimo",shutdown:"Spegni",restart:"Riavvia",detach:"Scollega simulatore",chooseDevice:"Scegli simulatore",booted:"Avviato",willBoot:"Disponibile (verrà avviato)",noSimulators:"Nessun simulatore trovato. Installane uno in Xcode.",loadingDevices:"Caricamento dispositivi…",zoomIn:"Ingrandisci",zoomOut:"Riduci",zoomFit:"Adatta alla finestra",actualSize:"Dimensione reale",frameRate:"Frequenza fotogrammi",fpsIdle:"FPS: inattivo",fpsValue:"FPS: {fps}",expand:"Espandi pannello",collapse:"Ripristina pannello",close:"Chiudi",attachTitle:"Collega un simulatore così {agent} può vedere la tua app",attachBody:"{agent} controllerà questo simulatore e catturerà l’intero schermo.",xcodeInstalled:"Xcode e Simulator installati",unavailable:"{device} non è più disponibile. Scegli un altro simulatore.",attach:"Collega simulatore",attaching:"Collegamento…",booting:"Avvio…",trademark:"Xcode è un marchio di Apple Inc., registrato negli Stati Uniti e in altri paesi.",consentTitle:"Consentire a {agent} di usare questo simulatore?",consentBody:"{agent} vedrà lo schermo tramite screenshot e controllerà il dispositivo toccando e digitando.",consentRetention:"Gli screenshot vengono inviati al tuo fornitore del modello e seguono le impostazioni di conservazione.",consentScreen:"Tutto ciò che è sullo schermo, notifiche e altre app aperte comprese, può finire nella conversazione.",consentAccounts:"Non accedere con account reali. Usa account e dati di prova.",consentSettings:"Puoi scollegare il simulatore in qualsiasi momento.",cancel:"Annulla",continue:"Continua",home:"Home",rotate:"Ruota a destra",screenshot:"Salva screenshot",record:"Registra video",logs:"Mostra log",touchSurface:"Superficie touch del simulatore. Fai clic per attivarla, poi digita.",liveStream:"Vista in diretta di {device}",takeOver:"Stai usando questo dispositivo",logsTitle:"Log del simulatore",logsEmpty:"Ancora nessuna riga. Il log inizia quando l’agente avvia l’app o lo legge.",closeLogs:"Chiudi log",screenshotSaved:"Screenshot salvato in {path}",notYetAvailable:"Non disponibile in questa versione"},S={menuEdit:"Правка",menuDevice:"Устройство",menuView:"Вид",undo:"Отменить",redo:"Повторить",cut:"Вырезать",copy:"Скопировать",paste:"Вставить",selectAll:"Выбрать все",delete:"Удалить",inputUnavailable:"Ввод появится вместе с помощником симулятора",appearance:"Оформление",light:"Светлое",dark:"Темное",statusBar:"Строка состояния",statusLive:"В реальном времени",statusShowcase:"9:41, полный сигнал и заряд",shutdown:"Выключить",restart:"Перезапустить",detach:"Отключить симулятор",chooseDevice:"Выбрать симулятор",booted:"Запущен",willBoot:"Доступен (будет запущен)",noSimulators:"Симуляторы не найдены. Установите один в Xcode.",loadingDevices:"Загрузка устройств…",zoomIn:"Увеличить",zoomOut:"Уменьшить",zoomFit:"По размеру окна",actualSize:"Реальный размер",frameRate:"Частота кадров",fpsIdle:"FPS: простой",fpsValue:"FPS: {fps}",expand:"Развернуть панель",collapse:"Свернуть панель",close:"Закрыть",attachTitle:"Подключите симулятор, чтобы {agent} видел ваше приложение",attachBody:"{agent} будет управлять этим симулятором и делать снимки всего экрана.",xcodeInstalled:"Xcode и Simulator установлены",unavailable:"{device} больше недоступен. Выберите другой симулятор.",attach:"Подключить симулятор",attaching:"Подключение…",booting:"Запуск…",trademark:"Xcode — товарный знак Apple Inc., зарегистрированный в США и других странах.",consentTitle:"Разрешить {agent} использовать этот симулятор?",consentBody:"{agent} будет видеть экран через снимки и управлять устройством касаниями и вводом.",consentRetention:"Снимки отправляются поставщику модели и подчиняются настройкам хранения беседы.",consentScreen:"Все на экране, включая уведомления и другие открытые приложения, может попасть в беседу.",consentAccounts:"Не входите в настоящие учетные записи. Используйте тестовые аккаунты и данные.",consentSettings:"Симулятор можно отключить в любой момент.",cancel:"Отменить",continue:"Продолжить",home:"Домой",rotate:"Повернуть вправо",screenshot:"Сохранить снимок",record:"Записать видео",logs:"Показать журнал",touchSurface:"Сенсорная область симулятора. Нажмите, чтобы сфокусироваться, затем вводите.",liveStream:"Живой экран {device}",takeOver:"Вы управляете этим устройством",logsTitle:"Журнал симулятора",logsEmpty:"Записей пока нет. Журнал начнется, когда агент запустит приложение или прочитает его.",closeLogs:"Закрыть журнал",screenshotSaved:"Снимок сохранен в {path}",notYetAvailable:"Недоступно в этой версии"},b={menuEdit:"تحرير",menuDevice:"الجهاز",menuView:"عرض",undo:"تراجع",redo:"إعادة",cut:"قص",copy:"نسخ",paste:"لصق",selectAll:"تحديد الكل",delete:"حذف",inputUnavailable:"الإدخال غير متاح حتى صدور مساعد المحاكي",appearance:"المظهر",light:"فاتح",dark:"داكن",statusBar:"شريط الحالة",statusLive:"مباشر",statusShowcase:"9:41، إشارة وبطارية ممتلئتان",shutdown:"إيقاف التشغيل",restart:"إعادة التشغيل",detach:"فصل المحاكي",chooseDevice:"اختيار المحاكي",booted:"قيد التشغيل",willBoot:"متاح (سيتم تشغيله)",noSimulators:"لم يُعثر على محاكيات. ثبّت واحدًا في Xcode.",loadingDevices:"جارٍ تحميل الأجهزة…",zoomIn:"تكبير",zoomOut:"تصغير",zoomFit:"ملاءمة النافذة",actualSize:"الحجم الفعلي",frameRate:"معدل الإطارات",fpsIdle:"FPS: خامل",fpsValue:"FPS: {fps}",expand:"توسيع اللوحة",collapse:"استعادة اللوحة",close:"إغلاق",attachTitle:"اربط محاكيًا ليتمكن {agent} من رؤية تطبيقك",attachBody:"سيتحكم {agent} في هذا المحاكي ويلتقط صورًا لشاشته بالكامل.",xcodeInstalled:"Xcode وSimulator مثبّتان",unavailable:"{device} لم يعد متاحًا. اختر محاكيًا آخر.",attach:"ربط المحاكي",attaching:"جارٍ الربط…",booting:"جارٍ التشغيل…",trademark:"Xcode علامة تجارية لشركة Apple Inc. مسجلة في الولايات المتحدة ودول أخرى.",consentTitle:"السماح لـ {agent} باستخدام هذا المحاكي؟",consentBody:"سيرى {agent} الشاشة عبر لقطات الشاشة ويتحكم في الجهاز بالنقر والكتابة.",consentRetention:"تُرسل لقطات الشاشة إلى مزوّد النموذج وتتبع إعدادات الاحتفاظ بالمحادثة.",consentScreen:"أي شيء على الشاشة، بما فيه الإشعارات والتطبيقات المفتوحة الأخرى، قد يظهر في محادثتك.",consentAccounts:"لا تسجّل الدخول بحسابات حقيقية. استخدم حسابات وبيانات اختبارية.",consentSettings:"يمكنك فصل المحاكي في أي وقت.",cancel:"إلغاء",continue:"متابعة",home:"الرئيسية",rotate:"تدوير لليمين",screenshot:"حفظ لقطة الشاشة",record:"تسجيل فيديو",logs:"إظهار السجل",touchSurface:"سطح اللمس للمحاكي. انقر للتركيز ثم اكتب.",liveStream:"عرض مباشر لـ {device}",takeOver:"أنت تتحكم في هذا الجهاز",logsTitle:"سجل المحاكي",logsEmpty:"لا توجد سطور بعد. يبدأ السجل عندما يشغّل الوكيل التطبيق أو يقرأه.",closeLogs:"إغلاق السجل",screenshotSaved:"حُفظت لقطة الشاشة في {path}",notYetAvailable:"غير متاح في هذا الإصدار"},k={menuEdit:"संपादन",menuDevice:"डिवाइस",menuView:"दृश्य",undo:"पूर्ववत करें",redo:"फिर से करें",cut:"काटें",copy:"कॉपी करें",paste:"पेस्ट करें",selectAll:"सभी चुनें",delete:"हटाएँ",inputUnavailable:"सिम्युलेटर हेल्पर आने तक इनपुट उपलब्ध नहीं है",appearance:"रूप",light:"लाइट",dark:"डार्क",statusBar:"स्टेटस बार",statusLive:"लाइव",statusShowcase:"9:41, पूरा सिग्नल और बैटरी",shutdown:"बंद करें",restart:"पुनः आरंभ करें",detach:"सिम्युलेटर अलग करें",chooseDevice:"सिम्युलेटर चुनें",booted:"चालू",willBoot:"उपलब्ध (चालू होगा)",noSimulators:"कोई सिम्युलेटर नहीं मिला। Xcode में एक इंस्टॉल करें।",loadingDevices:"डिवाइस लोड हो रहे हैं…",zoomIn:"ज़ूम इन",zoomOut:"ज़ूम आउट",zoomFit:"विंडो में फ़िट करें",actualSize:"वास्तविक आकार",frameRate:"फ़्रेम दर",fpsIdle:"FPS: निष्क्रिय",fpsValue:"FPS: {fps}",expand:"पैनल बड़ा करें",collapse:"पैनल वापस लाएँ",close:"बंद करें",attachTitle:"सिम्युलेटर जोड़ें ताकि {agent} आपका ऐप देख सके",attachBody:"{agent} इस सिम्युलेटर को नियंत्रित करेगा और इसकी पूरी स्क्रीन के स्क्रीनशॉट लेगा।",xcodeInstalled:"Xcode और Simulator इंस्टॉल हैं",unavailable:"{device} अब उपलब्ध नहीं है। दूसरा सिम्युलेटर चुनें।",attach:"सिम्युलेटर जोड़ें",attaching:"जोड़ा जा रहा है…",booting:"चालू हो रहा है…",trademark:"Xcode, Apple Inc. का ट्रेडमार्क है, जो अमेरिका और अन्य देशों में पंजीकृत है।",consentTitle:"{agent} को यह सिम्युलेटर इस्तेमाल करने दें?",consentBody:"{agent} स्क्रीनशॉट से स्क्रीन देखेगा और टैप व टाइपिंग से डिवाइस नियंत्रित करेगा।",consentRetention:"स्क्रीनशॉट आपके मॉडल प्रदाता को भेजे जाते हैं और बातचीत की प्रतिधारण सेटिंग का पालन करते हैं।",consentScreen:"स्क्रीन पर मौजूद कुछ भी, सूचनाएँ और खुले ऐप्स सहित, आपकी बातचीत में आ सकता है।",consentAccounts:"असली खातों में साइन इन न करें। टेस्ट खाते और टेस्ट डेटा इस्तेमाल करें।",consentSettings:"आप कभी भी सिम्युलेटर अलग कर सकते हैं।",cancel:"रद्द करें",continue:"जारी रखें",home:"होम",rotate:"दाएँ घुमाएँ",screenshot:"स्क्रीनशॉट सहेजें",record:"वीडियो रिकॉर्ड करें",logs:"लॉग दिखाएँ",touchSurface:"सिम्युलेटर की टच सतह। फ़ोकस के लिए क्लिक करें, फिर टाइप करें।",liveStream:"{device} का लाइव दृश्य",takeOver:"आप यह डिवाइस चला रहे हैं",logsTitle:"सिम्युलेटर लॉग",logsEmpty:"अभी कोई लॉग पंक्ति नहीं। एजेंट के ऐप चलाने या लॉग पढ़ने पर लॉग शुरू होता है।",closeLogs:"लॉग बंद करें",screenshotSaved:"स्क्रीनशॉट {path} में सहेजा गया",notYetAvailable:"इस संस्करण में उपलब्ध नहीं"},f={menuEdit:"Edit",menuDevice:"Perangkat",menuView:"Tampilan",undo:"Urungkan",redo:"Ulangi",cut:"Potong",copy:"Salin",paste:"Tempel",selectAll:"Pilih semua",delete:"Hapus",inputUnavailable:"Input belum tersedia sampai pembantu simulator dirilis",appearance:"Tampilan",light:"Terang",dark:"Gelap",statusBar:"Bilah status",statusLive:"Langsung",statusShowcase:"9:41, sinyal dan baterai penuh",shutdown:"Matikan",restart:"Mulai ulang",detach:"Lepaskan simulator",chooseDevice:"Pilih simulator",booted:"Berjalan",willBoot:"Tersedia (akan dijalankan)",noSimulators:"Simulator tidak ditemukan. Pasang di Xcode.",loadingDevices:"Memuat perangkat…",zoomIn:"Perbesar",zoomOut:"Perkecil",zoomFit:"Sesuaikan jendela",actualSize:"Ukuran sebenarnya",frameRate:"Laju bingkai",fpsIdle:"FPS: diam",fpsValue:"FPS: {fps}",expand:"Perbesar panel",collapse:"Pulihkan panel",close:"Tutup",attachTitle:"Hubungkan simulator agar {agent} bisa melihat aplikasi Anda",attachBody:"{agent} akan mengendalikan simulator ini dan mengambil tangkapan seluruh layarnya.",xcodeInstalled:"Xcode dan Simulator terpasang",unavailable:"{device} tidak tersedia lagi. Pilih simulator lain.",attach:"Hubungkan simulator",attaching:"Menghubungkan…",booting:"Menjalankan…",trademark:"Xcode adalah merek dagang Apple Inc. yang terdaftar di AS dan negara lain.",consentTitle:"Izinkan {agent} menggunakan simulator ini?",consentBody:"{agent} akan melihat layar lewat tangkapan layar dan mengendalikan perangkat dengan ketukan dan ketikan.",consentRetention:"Tangkapan layar dikirim ke penyedia model Anda dan mengikuti pengaturan penyimpanan percakapan.",consentScreen:"Apa pun di layar, termasuk notifikasi dan aplikasi lain yang terbuka, bisa masuk ke percakapan.",consentAccounts:"Jangan masuk dengan akun sungguhan. Gunakan akun dan data uji.",consentSettings:"Anda bisa melepaskan simulator kapan saja.",cancel:"Batal",continue:"Lanjutkan",home:"Beranda",rotate:"Putar ke kanan",screenshot:"Simpan tangkapan layar",record:"Rekam video",logs:"Tampilkan log",touchSurface:"Area sentuh simulator. Klik untuk fokus, lalu ketik.",liveStream:"Tampilan langsung {device}",takeOver:"Anda sedang mengoperasikan perangkat ini",logsTitle:"Log simulator",logsEmpty:"Belum ada baris log. Log dimulai saat agen menjalankan aplikasi atau membacanya.",closeLogs:"Tutup log",screenshotSaved:"Tangkapan layar disimpan di {path}",notYetAvailable:"Tidak tersedia di versi ini"},n={en:i,"zh-CN":s,"zh-TW":l,ja:d,ko:p,de:g,fr:m,es:h,"pt-BR":c,it:v,ru:S,ar:b,hi:k,id:f};function a(t){if(!t)return i;if(n[t])return n[t];let o=t.split(/[-_]/)[0]?.toLowerCase()??"";if(o==="zh")return/tw|hk|hant/i.test(t)?l:s;if(o==="pt")return c;return n[o]??i}function e(t,o){return t.replace(/\{(\w+)\}/g,(u,r)=>(r in o)?String(o[r]):u)}
|
|
2
|
+
export{n,a,e};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-brbw9wqh.js";import{Button as r}from"@nyssance/shadcn/vega/components/ui/button";import{CircleCheck as u,Eye as f,Info as v,Settings2 as h,Smartphone as N,UserRound as b}from"lucide-react";import{jsx as t,jsxs as a}from"react/jsx-runtime";function p({labels:n,agent:i,unavailableDevice:o,busy:s,error:l,onAttach:c,picker:d}){return a("div",{"data-device-attach-screen":!0,className:"bg-background text-foreground flex h-full min-h-0 flex-col text-center",children:[a("div",{className:"flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-5 pt-[22%]",children:[t("h2",{className:"text-[22px] leading-tight font-semibold text-balance",children:e(n.attachTitle,{agent:i})}),t("p",{className:"text-muted-foreground mt-3 text-sm text-balance",children:e(n.attachBody,{agent:i})}),a("div",{className:"bg-muted mt-6 flex w-full items-center gap-3 rounded-xl px-4 py-3 text-left text-sm",children:[t(u,{className:"size-5 shrink-0 text-emerald-500","aria-hidden":!0}),t("span",{children:n.xcodeInstalled})]}),o&&a("div",{className:"border-border mt-3 flex w-full items-start gap-3 rounded-xl border px-4 py-3 text-left text-sm",children:[t(v,{className:"text-muted-foreground mt-0.5 size-5 shrink-0","aria-hidden":!0}),t("span",{children:e(n.unavailable,{device:o})})]}),l&&t("p",{role:"alert",className:"text-destructive mt-3 w-full text-left text-xs",children:l})]}),a("div",{className:"w-full shrink-0 px-5 pb-6",children:[t("p",{className:"text-muted-foreground mb-4 text-[11px]",children:n.trademark}),a("div",{className:"flex w-full","data-slot":"button-group",children:[t(r,{size:"lg",className:"flex-1 rounded-e-none",disabled:s!==null,onClick:c,children:s==="booting"?n.booting:s==="attaching"?n.attaching:n.attach}),d]})]})]})}function g({labels:n,agent:i,deviceName:o,systemVersion:s,onCancel:l,onContinue:c}){let d=[{icon:f,text:n.consentScreen},{icon:b,text:n.consentAccounts},{icon:h,text:n.consentSettings}];return a("div",{"data-device-consent-screen":!0,className:"bg-background text-foreground flex h-full min-h-0 flex-col text-center",children:[a("div",{className:"flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-5 pt-[10%]",children:[t("h2",{className:"text-[22px] leading-tight font-semibold text-balance",children:e(n.consentTitle,{agent:i})}),a("span",{className:"bg-muted mt-4 inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm font-medium",children:[t(N,{className:"size-4","aria-hidden":!0}),o," · ",s]}),t("p",{className:"text-muted-foreground mt-5 text-sm text-balance",children:e(n.consentBody,{agent:i})}),t("p",{className:"text-muted-foreground mt-3 text-sm text-balance",children:n.consentRetention}),t("div",{className:"mt-4 flex w-full flex-col gap-2 pb-4",children:d.map(({icon:x,text:m})=>a("div",{className:"bg-muted flex items-start gap-3 rounded-xl px-3 py-3 text-left text-[13px] leading-snug",children:[t(x,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),t("span",{children:m})]},m))})]}),a("div",{className:"flex w-full shrink-0 gap-3 px-5 pt-2 pb-6",children:[t(r,{variant:"outline",size:"lg",className:"flex-1",onClick:l,children:n.cancel}),t(r,{size:"lg",className:"flex-1",onClick:c,children:n.continue})]})]})}
|
|
2
|
+
export{p,g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var h={Enter:40,Backspace:42,ArrowRight:79,ArrowLeft:80,ArrowDown:81,ArrowUp:82,Delete:76,Home:74,End:77,PageUp:75,PageDown:78},l={"meta+shift+h":{type:"button",name:"HOME"},"meta+l":{type:"button",name:"LOCK"},"ctrl+meta+z":{type:"shake"},"meta+shift+a":{type:"toggleAppearance"}},c={"meta+shift+h":{type:"button",name:"HOME"},"meta+shift+b":{type:"button",name:"BACK"},"meta+shift+r":{type:"button",name:"RECENTS"},"meta+l":{type:"button",name:"LOCK"},"meta+shift+a":{type:"toggleAppearance"}};function d(e,t){let n=t.t-e.t;if(Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY)<6)return n>=500?{type:"longPress",x:e.x,y:e.y,duration:n/1000}:{type:"tap",x:e.x,y:e.y};return{type:"swipe",x1:e.x,y1:e.y,x2:t.x,y2:t.y,duration:Math.max(0.1,n/1000)}}function v(e){return[e.altKey&&"alt",e.ctrlKey&&"ctrl",e.metaKey&&"meta",e.shiftKey&&"shift",e.key.toLowerCase()].filter(Boolean).join("+")}function u(e,t){if(e.metaKey||e.ctrlKey)return t[v(e)]??null;let n=h[e.key];if(n!==void 0)return{type:"key",code:n};return e.key.length===1?{type:"text",value:e.key}:null}function i(e,t,n,r,o){if(e.width===0||e.height===0)return null;return{x:Math.round((t-e.left)/e.width*r),y:Math.round((n-e.top)/e.height*o)}}
|
|
2
|
+
export{h,l,c,d,v,u,i};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o,s,r}from"./chunk-wfcd0qt8.js";import{l,c,d,u,i}from"./chunk-fj7w5b36.js";import{a,e}from"./chunk-brbw9wqh.js";import{t}from"./chunk-6acejx53.js";import{p,g}from"./chunk-ek1jm29t.js";import{Button as be}from"@nyssance/shadcn/vega/components/ui/button";import{Tooltip as Pe,TooltipContent as ze,TooltipProvider as Te,TooltipTrigger as Ee}from"@nyssance/shadcn/vega/components/ui/tooltip";import{Camera as Me,ChevronDown as fe,Home as Ce,Maximize2 as Le,Minimize2 as Be,RotateCw as Fe,Scan as Ie,SquareTerminal as Re,Video as Oe,X as ke,ZoomIn as Ae,ZoomOut as He}from"lucide-react";import{useCallback as X,useEffect as ee,useMemo as me,useRef as ce,useState as E}from"react";import{jsx as h,jsxs as H}from"react/jsx-runtime";var Q=[25,33,50,66,75,100,125,150,200];function Ze(n,x){if(n==="android")return 1;return x.toLowerCase().includes("ipad")?2:3}var he=(n)=>`alwith-device:consent:${n}`,$e={read:(n)=>Promise.resolve(ge(()=>localStorage.getItem(he(n))==="granted")??!1),write:(n,x)=>Promise.resolve(ge(()=>localStorage.setItem(he(n),x?"granted":"denied"))??void 0)};function ge(n){try{return n()}catch{return null}}function pe(n){return n instanceof Error?n.message:String(n)}function f({bridge:n,platform:x="ios",udid:N,language:z,agentName:B="AI",pollFps:Z=4,maximized:M=!1,onMaximize:S,onClose:P,className:F}){let m=me(()=>a(z),[z]),[R,q]=E([]);ee(()=>n.subscribe(q),[n]);let k=me(()=>N?R.find((v)=>v.udid===N):R[0],[R,N]),[T,C]=E("fit"),[O,L]=E(Z),[se,te]=E(0),[U,Y]=E(!1),[K,I]=E(null),[ne,G]=E(null),[j,b]=E(null),[D,A]=E(null),[ie,_]=E(null),[ae,oe]=E("live"),de=n.consent??$e,J=X((v)=>{I(null),v().catch((w)=>I(pe(w)))},[]),le=X(async(v)=>{G(v&&!v.running?"booting":"attaching"),I(null);try{await n.attach(v?.id,x),A(null)}catch(w){let y=pe(w);if(v&&/no simulator|not available|不可用|No device/i.test(y))A(v.name);I(y)}finally{G(null)}},[n,x]),ue=X(async(v)=>{let w=v;if(!w){let y=await n.listDevices(x).catch(()=>[]);if(w=y.find((W)=>W.running)??y[0],!w){I(m.noSimulators);return}}if(await de.read(w.id))await le(w);else b(w)},[n,x,de,le,m.noSimulators]);ee(()=>{if(!k||!n.appearance)return;let v=!1;return n.appearance(k.udid).then((w)=>{if(!v)_(w)}).catch(()=>{return}),()=>{v=!0}},[n,k]);let xe=h(ve,{bridge:n,platform:x,labels:m,current:k?.udid,disabled:ne!==null,onPick:(v)=>{if(k&&v.id!==k.udid)J(async()=>{await le(v),await n.detach(k.udid)});else if(!k)ue(v)}}),ye=[{kind:"item",label:m.undo,disabled:!0,hint:m.inputUnavailable},{kind:"item",label:m.redo,disabled:!0},{kind:"separator"},{kind:"item",label:m.cut,disabled:!0},{kind:"item",label:m.copy,disabled:!0},{kind:"item",label:m.paste,disabled:!0},{kind:"item",label:m.selectAll,disabled:!0},{kind:"item",label:m.delete,disabled:!0}],Se=()=>{let v=k,w=(y)=>()=>{if(v)J(()=>y(v))};return[{kind:"section",label:m.appearance},{kind:"item",label:m.light,checked:ie==="light",disabled:!v||!n.setAppearance,onSelect:w(async(y)=>{await n.setAppearance?.(y.udid,"light"),_("light")})},{kind:"item",label:m.dark,checked:ie==="dark",disabled:!v||!n.setAppearance,onSelect:w(async(y)=>{await n.setAppearance?.(y.udid,"dark"),_("dark")})},{kind:"section",label:m.statusBar},{kind:"item",label:m.statusLive,checked:ae==="live",disabled:!v||!n.setStatusBar,onSelect:w(async(y)=>{await n.setStatusBar?.(y.udid,"live"),oe("live")})},{kind:"item",label:m.statusShowcase,checked:ae==="showcase",disabled:!v||!n.setStatusBar,onSelect:w(async(y)=>{await n.setStatusBar?.(y.udid,"showcase"),oe("showcase")})},{kind:"separator"},{kind:"item",label:m.restart,disabled:!v||!n.restart,onSelect:w(async(y)=>{G("booting");try{await n.restart?.(y.udid),await n.attach(y.udid,x)}finally{G(null)}})},{kind:"item",label:m.shutdown,disabled:!v||!n.shutdown,onSelect:w((y)=>n.shutdown(y.udid))},{kind:"separator"},{kind:"item",label:m.detach,disabled:!v,onSelect:w((y)=>n.detach(y.udid))}]},re=(v)=>C((w)=>{let y=w==="fit"?100:w,W=Q.findIndex((De)=>De>=y);return(v>0?Q[Math.min(Q.length-1,(W===-1?Q.length-1:W)+1)]:Q[Math.max(0,(W===-1?Q.length:W)-1)])??w}),Ne=()=>[{kind:"item",label:m.zoomIn,onSelect:()=>re(1),hint:"⌘+"},{kind:"item",label:m.zoomOut,onSelect:()=>re(-1),hint:"⌘−"},{kind:"item",label:m.zoomFit,checked:T==="fit",onSelect:()=>C("fit")},{kind:"item",label:m.actualSize,checked:T===100,onSelect:()=>C(100),hint:"⌘0"},{kind:"section",label:m.frameRate},...[1,2,4,8].map((v)=>({kind:"item",label:`${v} FPS`,checked:O===v,onSelect:()=>L(v)}))],V=(v,w,y,W)=>H(Pe,{children:[h(Ee,{render:h(be,{variant:"ghost",size:"icon-sm","aria-label":v,"aria-pressed":W?.pressed,disabled:W?.disabled,onClick:y,className:"aria-pressed:bg-muted"}),children:w}),h(ze,{children:v})]});return h(Te,{children:H("div",{"data-device-panel":!0,className:`bg-background text-foreground flex h-full min-h-0 flex-col ${F??""}`,children:[H("div",{"data-device-menubar":!0,className:"border-border flex h-10 shrink-0 items-center gap-0.5 border-b px-2",children:[h(t,{label:m.menuEdit,entries:ye}),h(t,{label:m.menuDevice,entries:Se}),h(t,{label:m.menuView,entries:Ne}),h("span",{className:"flex-1"}),S&&V(M?m.collapse:m.expand,M?h(Be,{className:"size-4"}):h(Le,{className:"size-4"}),S,{pressed:M}),P&&V(m.close,h(ke,{className:"size-4"}),P)]}),H("div",{"data-device-devicebar":!0,className:"border-border flex h-12 shrink-0 items-center gap-1 border-b px-2",children:[xe,h("span",{className:"flex-1"}),k&&h("span",{className:"text-muted-foreground mr-1 text-xs tabular-nums",children:se>0?e(m.fpsValue,{fps:se}):m.fpsIdle}),V(m.zoomOut,h(He,{className:"size-4"}),()=>re(-1)),V(m.zoomFit,h(Ie,{className:"size-4"}),()=>C("fit"),{pressed:T==="fit"}),V(m.actualSize,h("span",{className:"inline-flex size-4 items-center justify-center rounded-full border border-current text-[10px] leading-none font-semibold",children:"1"}),()=>C(100),{pressed:T===100}),V(m.zoomIn,h(Ae,{className:"size-4"}),()=>re(1))]}),K&&h("p",{role:"alert",className:"border-border text-destructive shrink-0 border-b px-3 py-1.5 text-xs",children:K}),h("div",{"data-device-stage":!0,className:`[container-type:size] flex min-h-0 flex-1 items-center justify-center p-4 ${T==="fit"?"overflow-hidden":"overflow-auto"}`,children:k?h(qe,{bridge:n,attachment:k,labels:m,fps:O,zoom:T,onError:I,onFps:te}):h(we,{kind:o(x,j?.name??"iPhone"),zoom:T,children:j?h(g,{labels:m,agent:B,deviceName:j.name,systemVersion:j.systemVersion,onCancel:()=>b(null),onContinue:()=>{let v=j;b(null),J(async()=>{await de.write(v.id,!0),await le(v)})}}):h(p,{labels:m,agent:B,unavailableDevice:D,busy:ne,error:null,onAttach:()=>void ue(void 0),picker:h(ve,{bridge:n,platform:x,labels:m,disabled:ne!==null,compact:!0,onPick:(v)=>void ue(v)})})})}),h("div",{"data-device-toolbar":!0,className:"flex shrink-0 justify-center py-3",children:H("div",{className:"border-border bg-muted/40 inline-flex items-center gap-0.5 rounded-full border p-1",children:[V(m.home,h(Ce,{className:"size-4"}),()=>k&&J(()=>n.gesture(k.udid,{type:"button",name:"HOME"})),{disabled:!k}),V(m.rotate,h(Fe,{className:"size-4"}),()=>k&&J(()=>n.gesture(k.udid,{type:"rotate",direction:"right"})),{disabled:!k}),V(m.screenshot,h(Me,{className:"size-4"}),()=>k&&J(async()=>{let v=await n.captureFrame(k.udid);if(!v)return;if(n.saveScreenshot){if(await n.saveScreenshot(k.udid,v))I(null)}else{let w=document.createElement("a");w.href=v,w.download=`${k.deviceName}-${Date.now()}.png`,w.click()}}),{disabled:!k}),V(m.record,h(Oe,{className:"size-4"}),void 0,{disabled:!0}),V(m.logs,h(Re,{className:"size-4"}),()=>Y((v)=>!v),{disabled:!k||!n.readLogs,pressed:U})]})}),U&&k&&n.readLogs&&h(Ve,{bridge:n,udid:k.udid,labels:m,onClose:()=>Y(!1)})]})})}function ve({bridge:n,platform:x,labels:N,current:z,disabled:B,compact:Z,onPick:M}){let[S,P]=E(null),F=X(()=>{P(null),n.listDevices(x).then(P).catch(()=>P([]))},[n,x]),[m,R]=E(null);ee(()=>{if(!z)return;n.listDevices(x).then((T)=>{let C=T.find((O)=>O.id===z);if(C)R({name:C.name,version:C.systemVersion})}).catch(()=>{return})},[n,x,z]);let q=()=>{if(S===null)return[{kind:"item",label:N.loadingDevices,disabled:!0}];if(S.length===0)return[{kind:"item",label:N.noSimulators,disabled:!0}];let T=S.filter((L)=>L.running),C=S.filter((L)=>!L.running),O=(L)=>({kind:"item",label:L.name,hint:L.systemVersion,checked:z===void 0?void 0:L.id===z,onSelect:()=>M(L)});return[...T.length>0?[{kind:"section",label:N.booted},...T.map(O)]:[],...C.length>0?[{kind:"section",label:N.willBoot},...C.map(O)]:[]]},k=(T)=>{if(T)F()};if(Z)return h(t,{ariaLabel:N.chooseDevice,entries:q,disabled:B,caret:!1,align:"end",variant:"default",size:"lg",className:"border-s-primary-foreground/20 rounded-s-none border-s px-3",onOpenChange:k,children:h(fe,{className:"size-4","aria-hidden":!0})});return H(t,{ariaLabel:N.chooseDevice,entries:q,disabled:B,caret:!1,size:"default",className:"h-10 max-w-full justify-start px-2 text-left",onOpenChange:k,children:[H("span",{className:"flex min-w-0 flex-col leading-tight",children:[h("span",{className:"truncate text-[15px] font-medium",children:m?.name??N.chooseDevice}),m&&H("span",{className:"text-muted-foreground truncate text-xs",children:[x==="ios"?"iOS":"Android"," ",m.version]})]}),h(fe,{className:"size-4 shrink-0 opacity-60","aria-hidden":!0})]})}function we({kind:n,zoom:x,pixelWidth:N,pixelHeight:z,scale:B=3,children:Z,overlay:M}){let S=me(()=>s(n,N,z),[n,N,z]),P=x==="fit"?{height:`min(100cqh, calc(100cqw / ${S.aspect}))`,aspectRatio:S.aspect}:(()=>{let F=(100-2*parseFloat(S.style.top))/100;return{height:`${(z??2622)/B*x/100/F}px`,aspectRatio:S.aspect,flexShrink:0}})();return H("div",{"data-device-screen-stage":!0,className:"relative",style:P,children:[h("div",{className:"bg-background absolute z-0 overflow-hidden",style:S.style,children:Z}),h(r,{kind:n,pixelWidth:N,pixelHeight:z,style:{position:"absolute",inset:0,zIndex:10,width:"100%",height:"100%",pointerEvents:"none",userSelect:"none",filter:"drop-shadow(0 2px 6px rgb(0 0 0 / 0.2)) drop-shadow(0 12px 32px rgb(0 0 0 / 0.25))"}}),M&&h("div",{className:"absolute z-20",style:S.style,children:M})]})}function qe({bridge:n,attachment:x,labels:N,fps:z,zoom:B,onError:Z,onFps:M}){let{udid:S,deviceName:P,platform:F}=x,[m,R]=E(null),[q,k]=E(x.pixelWidth&&x.pixelHeight?{width:x.pixelWidth,height:x.pixelHeight}:null),[T,C]=E(!1),O=ce(null),L=ce([]);ee(()=>{if(z<=0)return;let b=!1,D,A=async()=>{if(b)return;let ie=performance.now();try{let _=await n.captureFrame(S);if(!b&&_){R(_);let ae=performance.now();L.current=[...L.current.filter((oe)=>ae-oe<2000),ae],M(Math.round(L.current.length/2))}}catch{}if(b)return;D=setTimeout(A,Math.max(0,1000/z-(performance.now()-ie)))};return A(),()=>{if(b=!0,M(0),D!==void 0)clearTimeout(D)}},[n,S,z,M]);let se=o(F,P),te=Ze(F,P),U=(q?.width??0)/te,Y=(q?.height??0)/te,K=X((b)=>{n.gesture(S,b).then(()=>Z(null),(D)=>Z(pe(D)))},[n,S,Z]),I=X(()=>{if(T)return;C(!0),n.takeOver?.(S).catch(()=>{return})},[n,S,T]),ne=X((b)=>{if(b.button!==0)return;I(),b.currentTarget.setPointerCapture(b.pointerId),b.currentTarget.focus({preventScroll:!0});let D=i(b.currentTarget.getBoundingClientRect(),b.clientX,b.clientY,U,Y);if(D)O.current={...D,clientX:b.clientX,clientY:b.clientY,t:performance.now()}},[I,U,Y]),G=X((b)=>{if(b.button!==0)return;let D=O.current;if(O.current=null,!D)return;let A=i(b.currentTarget.getBoundingClientRect(),b.clientX,b.clientY,U,Y);if(!A)return;K(d(D,{...A,clientX:b.clientX,clientY:b.clientY,t:performance.now()}))},[K,U,Y]),j=X((b)=>{if(b.nativeEvent.isComposing)return;let D=u(b,F==="android"?c:l);if(!D)return;b.preventDefault(),b.stopPropagation(),I(),K(D)},[F,K,I]);return h(we,{kind:se,zoom:B,pixelWidth:q?.width,pixelHeight:q?.height,scale:te,overlay:h("div",{role:"application",tabIndex:0,"aria-label":N.touchSurface,"data-device-touch-surface":!0,"data-controlling":T||void 0,title:T?N.takeOver:void 0,className:"h-full w-full cursor-pointer touch-none outline-none",onPointerDown:ne,onPointerUp:G,onPointerCancel:()=>O.current=null,onKeyDown:j,onCompositionEnd:(b)=>b.data&&(I(),K({type:"text",value:b.data}))}),children:m?h("img",{src:m,alt:e(N.liveStream,{device:P}),draggable:!1,onLoad:(b)=>{let D=b.currentTarget;if(D.naturalWidth&&D.naturalHeight)k((A)=>A?.width===D.naturalWidth&&A.height===D.naturalHeight?A:{width:D.naturalWidth,height:D.naturalHeight})},className:"block h-full w-full bg-black object-cover select-none"}):h("div",{className:"h-full w-full bg-black"})})}function Ve({bridge:n,udid:x,labels:N,onClose:z}){let[B,Z]=E([]),M=ce(0),S=ce(null);return ee(()=>{let P=!1,F=async()=>{try{let R=await n.readLogs(x,{sinceSeq:M.current||void 0,tail:200});if(P)return;if(R.entries.length>0)M.current=R.lastSeq,Z((q)=>[...q,...R.entries].slice(-500))}catch{}};F();let m=setInterval(F,2000);return()=>{P=!0,clearInterval(m)}},[n,x]),ee(()=>{S.current?.scrollTo({top:S.current.scrollHeight})},[B]),H("div",{"data-device-logs":!0,className:"border-border flex h-[40%] shrink-0 flex-col border-t",children:[H("div",{className:"text-muted-foreground flex h-8 shrink-0 items-center gap-2 px-3 text-xs",children:[h("span",{className:"flex-1",children:N.logsTitle}),h(be,{variant:"ghost",size:"icon-xs","aria-label":N.closeLogs,title:N.closeLogs,onClick:z,children:h(ke,{})})]}),h("div",{ref:S,className:"min-h-0 flex-1 overflow-auto px-3 pb-2 font-mono text-[11px] leading-4",children:B.length===0?h("p",{className:"text-muted-foreground py-4 text-center",children:N.logsEmpty}):B.map((P)=>H("div",{className:"flex gap-2 break-all whitespace-pre-wrap",children:[h("span",{className:"text-muted-foreground shrink-0",children:P.timestamp.slice(11,23)}),h("span",{className:`shrink-0 ${P.level==="error"||P.level==="fault"?"text-destructive":"text-muted-foreground"}`,children:P.level}),h("span",{children:P.message})]},P.seq))})]})}
|
|
2
|
+
export{f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{memo as L,useId as Q,useMemo as S}from"react";import{jsx as v,jsxs as z}from"react/jsx-runtime";var m={iPhone:{pixelW:1206,pixelH:2622,screenRadius:186,frame:34,silver:8,grey:12,nubProtrude:27,nubs:[["left",507,102],["left",690,192],["left",927,192],["right",813,303]]},androidPhone:{pixelW:1080,pixelH:2400,screenRadius:100,frame:22,silver:6,grey:8,nubProtrude:18,nubs:[["right",480,130],["right",670,240]]},iPad:{pixelW:1668,pixelH:2420,screenRadius:58,frame:64,silver:12,grey:16,nubProtrude:20,nubs:[["right",202,104],["right",328,104],["top",-148,126]]}};function o(t,e){if(t==="android")return"androidPhone";return e.toLowerCase().includes("ipad")?"iPad":"iPhone"}function C(t,e,R){let p=m[t],F=p.frame+p.silver+p.grey,g=F+p.nubProtrude,b=e??p.pixelW,c=R??p.pixelH;return{p,edge:F,margin:g,W:b+2*g,H:c+2*g,width:b,height:c}}function s(t,e,R){let{p,margin:F,W:g,H:b,width:c,height:l}=C(t,e,R),f=100*F/g,d=100*F/b;return{aspect:g/b,style:{left:`${f}%`,top:`${d}%`,width:`${100-2*f}%`,height:`${100-2*d}%`,borderRadius:`${100*p.screenRadius/c}% / ${100*p.screenRadius/l}%`}}}function w(t,e,R,p,F){let g=Math.min(F,Math.min(R,p)/3.06),b=1.528665*g,c=1.088311*g,l=0.868407*g,f=0.631494*g,d=0.372375*g,H=0.16906*g,P=0.066987*g,n=t+R,a=e+p,i=(h)=>+h.toFixed(3),u=(h,M,W,k,E,K)=>`C${i(h)} ${i(M)} ${i(W)} ${i(k)} ${i(E)} ${i(K)}`;return[`M${i(t+b)} ${i(e)}`,`L${i(n-b)} ${i(e)}`,u(n-c,e,n-l,e,n-f,e+P),u(n-d,e+H,n-H,e+d,n-P,e+f),u(n,e+l,n,e+c,n,e+b),`L${i(n)} ${i(a-b)}`,u(n,a-c,n,a-l,n-P,a-f),u(n-H,a-d,n-d,a-H,n-f,a-P),u(n-l,a,n-c,a,n-b,a),`L${i(t+b)} ${i(a)}`,u(t+c,a,t+l,a,t+f,a-P),u(t+d,a-H,t+H,a-d,t+P,a-f),u(t,a-l,t,a-c,t,a-b),`L${i(t)} ${i(e+b)}`,u(t,e+c,t,e+l,t+P,e+f),u(t+H,e+d,t+d,e+H,t+f,e+P),u(t+l,e,t+c,e,t+b,e),"Z"].join("")}var r=L(function({kind:e="iPhone",pixelWidth:R,pixelHeight:p,className:F,style:g}){let b=Q(),c=S(()=>{let{p:l,edge:f,W:d,H}=C(e,R,p),P=(i)=>w(l.nubProtrude+i,l.nubProtrude+i,d-2*(l.nubProtrude+i),H-2*(l.nubProtrude+i),l.screenRadius+(f-i)),n=l.nubProtrude,a=l.nubs.map(([i,u,h])=>{let M=u+6,W=u+h-6;switch(i){case"left":return{fill:`M0 ${u}h${n}v${h}H0z`,edge:`M${n} ${u}H6Q0 ${u} 0 ${M}V${W}Q0 ${u+h} 6 ${u+h}H${n}`};case"right":return{fill:`M${d-n} ${u}H${d}v${h}H${d-n}z`,edge:`M${d-n} ${u}H${d-6}Q${d} ${u} ${d} ${M}V${W}Q${d} ${u+h} ${d-6} ${u+h}H${d-n}`};default:{let k=u>=0?u:d+u-h;return{fill:`M${k} 0v${n}h${h}V0z`,edge:`M${k} ${n}V6Q${k} 0 ${k+6} 0H${k+h-6}Q${k+h} 0 ${k+h} 6V${n}`}}}});return{W:d,H,outer:P(0),grey:P(l.silver),black:P(l.silver+l.grey),cutout:P(f),nubFill:a.map((i)=>i.fill).join(""),nubEdge:a.map((i)=>i.edge).join("")}},[e,R,p]);return z("svg",{viewBox:`0 0 ${c.W} ${c.H}`,className:F,style:g,"aria-hidden":!0,focusable:!1,children:[v("defs",{children:z("linearGradient",{id:b,x1:"0",y1:"0",x2:"1",y2:"1",children:[v("stop",{offset:"0%",stopColor:"#e8e8ec"}),v("stop",{offset:"45%",stopColor:"#bcbcc0"}),v("stop",{offset:"55%",stopColor:"#b4b4b8"}),v("stop",{offset:"100%",stopColor:"#e2e2e6"})]})}),v("path",{d:`${c.outer} ${c.cutout}`,fill:`url(#${b})`,fillRule:"evenodd"}),v("path",{d:`${c.grey} ${c.cutout}`,fill:"#4a4a4e",fillRule:"evenodd"}),v("path",{d:`${c.black} ${c.cutout}`,fill:"#0b0b0c",fillRule:"evenodd"}),v("path",{d:c.cutout,fill:"none",stroke:"#2a2a2c",strokeWidth:3}),v("path",{d:c.outer,fill:"none",stroke:"#000",strokeWidth:1.5,vectorEffect:"non-scaling-stroke"}),v("path",{d:c.nubFill,fill:"#4a4a4e"}),v("path",{d:c.nubEdge,fill:"none",stroke:"#000",strokeWidth:1.5,strokeLinecap:"round",vectorEffect:"non-scaling-stroke"})]})});
|
|
2
|
+
export{m,o,s,r};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface DeviceRegistration {
|
|
2
|
+
address: string;
|
|
3
|
+
token: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DeviceCarrier {
|
|
6
|
+
command: string;
|
|
7
|
+
args: string[];
|
|
8
|
+
proxy: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DeviceMcpServer {
|
|
11
|
+
type: "stdio";
|
|
12
|
+
name: string;
|
|
13
|
+
command: string;
|
|
14
|
+
args: string[];
|
|
15
|
+
env: Array<{
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare const DEVICE_SERVER_NAME = "alwith_device";
|
|
21
|
+
export declare const DEVICE_INSTRUCTIONS = "Simulators are driven through the private MCP server named alwith_device; never fall back to xcrun simctl or shell automation for a device this server manages. Attach a device as soon as the user wants to see the app, before building or launching. Launching captures the app's unified log; read it with the logs tool instead of guessing. The user watches the attached device in the application's device panel and may operate it; re-read the screen after the user acts.";
|
|
22
|
+
export declare function deviceContext(resolve: () => Promise<DeviceRegistration | null>, carrier: DeviceCarrier): Promise<{
|
|
23
|
+
mcpServers: DeviceMcpServer[];
|
|
24
|
+
appendSystemPrompt?: string;
|
|
25
|
+
revision: string;
|
|
26
|
+
}>;
|
|
27
|
+
export type { AttachmentInfo, DeviceBridge, DeviceGesture, DevicePanelProps, ManagedDevice } from "./preview/types";
|
|
28
|
+
export { deviceLocales, resolveDeviceLabels } from "./preview/locales";
|
|
29
|
+
export type { PanelLabels } from "./preview/locales";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n,a}from"./chunk-brbw9wqh.js";var i="alwith_device",s="Simulators are driven through the private MCP server named alwith_device; never fall back to xcrun simctl or shell automation for a device this server manages. Attach a device as soon as the user wants to see the app, before building or launching. Launching captures the app's unified log; read it with the logs tool instead of guessing. The user watches the attached device in the application's device panel and may operate it; re-read the screen after the user acts.";async function o(t,r){let e=await t();if(!e)return{mcpServers:[],revision:"disabled"};return{mcpServers:[{type:"stdio",name:i,command:r.command,args:[...r.args,r.proxy,e.address,e.token],env:[]}],revision:e.address,appendSystemPrompt:s}}export{s as DEVICE_INSTRUCTIONS,i as DEVICE_SERVER_NAME,o as deviceContext,n as deviceLocales,a as resolveDeviceLabels};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface FrameSpec {
|
|
2
|
+
pixelW: number;
|
|
3
|
+
pixelH: number;
|
|
4
|
+
screenRadius: number;
|
|
5
|
+
frame: number;
|
|
6
|
+
silver: number;
|
|
7
|
+
grey: number;
|
|
8
|
+
nubProtrude: number;
|
|
9
|
+
nubs: Array<["left" | "right" | "top", number, number]>;
|
|
10
|
+
}
|
|
11
|
+
export declare const FRAMES: Record<"iPhone" | "iPad" | "androidPhone", FrameSpec>;
|
|
12
|
+
export type FrameKind = keyof typeof FRAMES;
|
|
13
|
+
export declare function frameKindFor(platform: string, deviceName: string): FrameKind;
|
|
14
|
+
export declare function screenPlacement(kind: FrameKind, pixelW?: number, pixelH?: number): {
|
|
15
|
+
aspect: number;
|
|
16
|
+
style: {
|
|
17
|
+
left: string;
|
|
18
|
+
top: string;
|
|
19
|
+
width: string;
|
|
20
|
+
height: string;
|
|
21
|
+
borderRadius: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export interface BezelProps {
|
|
25
|
+
kind?: FrameKind;
|
|
26
|
+
pixelWidth?: number;
|
|
27
|
+
pixelHeight?: number;
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: React.CSSProperties;
|
|
30
|
+
}
|
|
31
|
+
export declare const Bezel: import("react").MemoExoticComponent<({ kind, pixelWidth, pixelHeight, className, style }: BezelProps) => import("react").JSX.Element>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m,o,s,r}from"../chunk-wfcd0qt8.js";export{r as Bezel,m as FRAMES,o as frameKindFor,s as screenPlacement};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f}from"../chunk-m6q76fpn.js";import"../chunk-wfcd0qt8.js";import"../chunk-ek1jm29t.js";import"../chunk-brbw9wqh.js";import"../chunk-fj7w5b36.js";import"../chunk-6acejx53.js";export{f as DevicePanel};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { DeviceGesture } from "./types";
|
|
2
|
+
export declare const KEY_CODES: Record<string, number>;
|
|
3
|
+
export declare const IOS_SHORTCUTS: Record<string, DeviceGesture>;
|
|
4
|
+
export declare const ANDROID_SHORTCUTS: Record<string, DeviceGesture>;
|
|
5
|
+
export interface PressStart {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
clientX: number;
|
|
9
|
+
clientY: number;
|
|
10
|
+
t: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function releaseGesture(start: PressStart, end: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
clientX: number;
|
|
16
|
+
clientY: number;
|
|
17
|
+
t: number;
|
|
18
|
+
}): DeviceGesture;
|
|
19
|
+
export declare function shortcutKey(event: {
|
|
20
|
+
altKey: boolean;
|
|
21
|
+
ctrlKey: boolean;
|
|
22
|
+
metaKey: boolean;
|
|
23
|
+
shiftKey: boolean;
|
|
24
|
+
key: string;
|
|
25
|
+
}): string;
|
|
26
|
+
export declare function keyGesture(event: {
|
|
27
|
+
altKey: boolean;
|
|
28
|
+
ctrlKey: boolean;
|
|
29
|
+
metaKey: boolean;
|
|
30
|
+
shiftKey: boolean;
|
|
31
|
+
key: string;
|
|
32
|
+
}, shortcuts: Record<string, DeviceGesture>): DeviceGesture | null;
|
|
33
|
+
export declare function pointFor(rect: {
|
|
34
|
+
left: number;
|
|
35
|
+
top: number;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
}, clientX: number, clientY: number, pointWidth: number, pointHeight: number): {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
} | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h,l,c,d,v,u,i}from"../chunk-fj7w5b36.js";export{c as ANDROID_SHORTCUTS,l as IOS_SHORTCUTS,h as KEY_CODES,u as keyGesture,i as pointFor,d as releaseGesture,v as shortcutKey};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Bezel, FRAMES, frameKindFor, screenPlacement } from "./bezel";
|
|
2
|
+
export type { BezelProps, FrameKind, FrameSpec } from "./bezel";
|
|
3
|
+
export { DevicePanel } from "./device-panel";
|
|
4
|
+
export { ANDROID_SHORTCUTS, IOS_SHORTCUTS, KEY_CODES, keyGesture, pointFor, releaseGesture, shortcutKey } from "./gestures";
|
|
5
|
+
export { deviceLocales, fill, resolveDeviceLabels } from "./locales";
|
|
6
|
+
export type { PanelLabels } from "./locales";
|
|
7
|
+
export { MenuButton } from "./menu";
|
|
8
|
+
export type { MenuEntry } from "./menu";
|
|
9
|
+
export type { AttachmentInfo, DeviceBridge, DeviceGesture, DeviceOwner, DevicePanelProps, LaunchedApp, LogEntry, LogPage, ManagedDevice } from "./types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m,o,s,r}from"../chunk-wfcd0qt8.js";import{h,l,c,d,v,u,i}from"../chunk-fj7w5b36.js";import{n,a,e}from"../chunk-brbw9wqh.js";import{t}from"../chunk-6acejx53.js";import"../chunk-ek1jm29t.js";import{f}from"../chunk-m6q76fpn.js";export{c as ANDROID_SHORTCUTS,r as Bezel,f as DevicePanel,m as FRAMES,l as IOS_SHORTCUTS,h as KEY_CODES,t as MenuButton,n as deviceLocales,e as fill,o as frameKindFor,u as keyGesture,i as pointFor,d as releaseGesture,a as resolveDeviceLabels,s as screenPlacement,v as shortcutKey};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface PanelLabels {
|
|
2
|
+
menuEdit: string;
|
|
3
|
+
menuDevice: string;
|
|
4
|
+
menuView: string;
|
|
5
|
+
undo: string;
|
|
6
|
+
redo: string;
|
|
7
|
+
cut: string;
|
|
8
|
+
copy: string;
|
|
9
|
+
paste: string;
|
|
10
|
+
selectAll: string;
|
|
11
|
+
delete: string;
|
|
12
|
+
inputUnavailable: string;
|
|
13
|
+
appearance: string;
|
|
14
|
+
light: string;
|
|
15
|
+
dark: string;
|
|
16
|
+
statusBar: string;
|
|
17
|
+
statusLive: string;
|
|
18
|
+
statusShowcase: string;
|
|
19
|
+
shutdown: string;
|
|
20
|
+
restart: string;
|
|
21
|
+
detach: string;
|
|
22
|
+
chooseDevice: string;
|
|
23
|
+
booted: string;
|
|
24
|
+
willBoot: string;
|
|
25
|
+
noSimulators: string;
|
|
26
|
+
loadingDevices: string;
|
|
27
|
+
zoomIn: string;
|
|
28
|
+
zoomOut: string;
|
|
29
|
+
zoomFit: string;
|
|
30
|
+
actualSize: string;
|
|
31
|
+
frameRate: string;
|
|
32
|
+
fpsIdle: string;
|
|
33
|
+
fpsValue: string;
|
|
34
|
+
expand: string;
|
|
35
|
+
collapse: string;
|
|
36
|
+
close: string;
|
|
37
|
+
attachTitle: string;
|
|
38
|
+
attachBody: string;
|
|
39
|
+
xcodeInstalled: string;
|
|
40
|
+
unavailable: string;
|
|
41
|
+
attach: string;
|
|
42
|
+
attaching: string;
|
|
43
|
+
booting: string;
|
|
44
|
+
trademark: string;
|
|
45
|
+
consentTitle: string;
|
|
46
|
+
consentBody: string;
|
|
47
|
+
consentRetention: string;
|
|
48
|
+
consentScreen: string;
|
|
49
|
+
consentAccounts: string;
|
|
50
|
+
consentSettings: string;
|
|
51
|
+
cancel: string;
|
|
52
|
+
continue: string;
|
|
53
|
+
home: string;
|
|
54
|
+
rotate: string;
|
|
55
|
+
screenshot: string;
|
|
56
|
+
record: string;
|
|
57
|
+
logs: string;
|
|
58
|
+
touchSurface: string;
|
|
59
|
+
liveStream: string;
|
|
60
|
+
takeOver: string;
|
|
61
|
+
logsTitle: string;
|
|
62
|
+
logsEmpty: string;
|
|
63
|
+
closeLogs: string;
|
|
64
|
+
screenshotSaved: string;
|
|
65
|
+
notYetAvailable: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const deviceLocales: Record<string, PanelLabels>;
|
|
68
|
+
export declare function resolveDeviceLabels(language: string | undefined): PanelLabels;
|
|
69
|
+
export declare function fill(template: string, values: Record<string, string | number>): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n,a,e}from"../chunk-brbw9wqh.js";export{n as deviceLocales,e as fill,a as resolveDeviceLabels};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type MenuEntry = {
|
|
3
|
+
kind: "item";
|
|
4
|
+
label: string;
|
|
5
|
+
onSelect?: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
hint?: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "section";
|
|
11
|
+
label: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "separator";
|
|
14
|
+
};
|
|
15
|
+
export declare function MenuButton({ label, ariaLabel, entries, disabled, caret, align, variant, size, className, children, onOpenChange }: {
|
|
16
|
+
label?: ReactNode;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
entries: MenuEntry[] | (() => MenuEntry[]);
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
caret?: boolean;
|
|
21
|
+
align?: "start" | "end" | "center";
|
|
22
|
+
variant?: "ghost" | "outline" | "default" | "secondary";
|
|
23
|
+
size?: "sm" | "xs" | "default" | "lg" | "icon-sm" | "icon-xs";
|
|
24
|
+
className?: string;
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
onOpenChange?: (open: boolean) => void;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t}from"../chunk-6acejx53.js";export{t as MenuButton};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type PanelLabels } from "./locales";
|
|
3
|
+
export declare function AttachScreen({ labels, agent, unavailableDevice, busy, error, onAttach, picker }: {
|
|
4
|
+
labels: PanelLabels;
|
|
5
|
+
agent: string;
|
|
6
|
+
unavailableDevice: string | null;
|
|
7
|
+
busy: "attaching" | "booting" | null;
|
|
8
|
+
error: string | null;
|
|
9
|
+
onAttach: () => void;
|
|
10
|
+
picker: ReactNode;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
export declare function ConsentScreen({ labels, agent, deviceName, systemVersion, onCancel, onContinue }: {
|
|
13
|
+
labels: PanelLabels;
|
|
14
|
+
agent: string;
|
|
15
|
+
deviceName: string;
|
|
16
|
+
systemVersion: string;
|
|
17
|
+
onCancel: () => void;
|
|
18
|
+
onContinue: () => void;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p,g}from"../chunk-ek1jm29t.js";import"../chunk-brbw9wqh.js";export{p as AttachScreen,g as ConsentScreen};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export interface ManagedDevice {
|
|
2
|
+
id: string;
|
|
3
|
+
platform: string;
|
|
4
|
+
name: string;
|
|
5
|
+
systemVersion: string;
|
|
6
|
+
running: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type DeviceOwner = {
|
|
9
|
+
type: "development_session";
|
|
10
|
+
id: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: "qa_run";
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
15
|
+
export interface LaunchedApp {
|
|
16
|
+
bundleId: string;
|
|
17
|
+
executable: string;
|
|
18
|
+
pid: number;
|
|
19
|
+
launchedAt: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AttachmentInfo {
|
|
22
|
+
udid: string;
|
|
23
|
+
platform: string;
|
|
24
|
+
deviceName: string;
|
|
25
|
+
systemVersion: string;
|
|
26
|
+
owner: DeviceOwner;
|
|
27
|
+
attachedAt: string;
|
|
28
|
+
pixelWidth: number | null;
|
|
29
|
+
pixelHeight: number | null;
|
|
30
|
+
app: LaunchedApp | null;
|
|
31
|
+
}
|
|
32
|
+
export interface LogEntry {
|
|
33
|
+
seq: number;
|
|
34
|
+
timestamp: string;
|
|
35
|
+
level: string;
|
|
36
|
+
process: string;
|
|
37
|
+
pid: number;
|
|
38
|
+
subsystem: string;
|
|
39
|
+
category: string;
|
|
40
|
+
message: string;
|
|
41
|
+
}
|
|
42
|
+
export interface LogPage {
|
|
43
|
+
entries: LogEntry[];
|
|
44
|
+
dropped: number;
|
|
45
|
+
total: number;
|
|
46
|
+
lastSeq: number;
|
|
47
|
+
captureStartedAt: string;
|
|
48
|
+
}
|
|
49
|
+
export type DeviceGesture = {
|
|
50
|
+
type: "tap";
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
} | {
|
|
54
|
+
type: "longPress";
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
duration: number;
|
|
58
|
+
} | {
|
|
59
|
+
type: "swipe";
|
|
60
|
+
x1: number;
|
|
61
|
+
y1: number;
|
|
62
|
+
x2: number;
|
|
63
|
+
y2: number;
|
|
64
|
+
duration: number;
|
|
65
|
+
} | {
|
|
66
|
+
type: "text";
|
|
67
|
+
value: string;
|
|
68
|
+
} | {
|
|
69
|
+
type: "key";
|
|
70
|
+
code: number;
|
|
71
|
+
} | {
|
|
72
|
+
type: "button";
|
|
73
|
+
name: "HOME" | "LOCK" | "SIRI" | "BACK" | "RECENTS";
|
|
74
|
+
} | {
|
|
75
|
+
type: "shake";
|
|
76
|
+
} | {
|
|
77
|
+
type: "toggleAppearance";
|
|
78
|
+
} | {
|
|
79
|
+
type: "rotate";
|
|
80
|
+
direction: "left" | "right";
|
|
81
|
+
};
|
|
82
|
+
export interface DeviceBridge {
|
|
83
|
+
listDevices(platform: string): Promise<ManagedDevice[]>;
|
|
84
|
+
attach(udid: string | undefined, platform: string): Promise<AttachmentInfo>;
|
|
85
|
+
detach(udid: string): Promise<void>;
|
|
86
|
+
captureFrame(udid: string): Promise<string | null>;
|
|
87
|
+
gesture(udid: string, gesture: DeviceGesture): Promise<void>;
|
|
88
|
+
subscribe(listener: (attachments: AttachmentInfo[]) => void): () => void;
|
|
89
|
+
takeOver?(udid: string): Promise<void>;
|
|
90
|
+
appearance?(udid: string): Promise<string>;
|
|
91
|
+
setAppearance?(udid: string, mode: "light" | "dark"): Promise<void>;
|
|
92
|
+
setStatusBar?(udid: string, look: "showcase" | "live"): Promise<void>;
|
|
93
|
+
shutdown?(udid: string): Promise<void>;
|
|
94
|
+
restart?(udid: string): Promise<void>;
|
|
95
|
+
readLogs?(udid: string, query: {
|
|
96
|
+
sinceSeq?: number;
|
|
97
|
+
tail?: number;
|
|
98
|
+
minLevel?: string;
|
|
99
|
+
filter?: string;
|
|
100
|
+
}): Promise<LogPage>;
|
|
101
|
+
saveScreenshot?(udid: string, dataUrl: string): Promise<string | null>;
|
|
102
|
+
consent?: {
|
|
103
|
+
read(udid: string): Promise<boolean>;
|
|
104
|
+
write(udid: string, granted: boolean): Promise<void>;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export interface DevicePanelProps {
|
|
108
|
+
bridge: DeviceBridge;
|
|
109
|
+
platform?: "ios" | "android";
|
|
110
|
+
udid?: string;
|
|
111
|
+
language?: string;
|
|
112
|
+
agentName?: string;
|
|
113
|
+
pollFps?: number;
|
|
114
|
+
maximized?: boolean;
|
|
115
|
+
onMaximize?: () => void;
|
|
116
|
+
onClose?: () => void;
|
|
117
|
+
className?: string;
|
|
118
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Alice Maz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwith/module-device",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"LICENSE",
|
|
9
|
+
"THIRD_PARTY_NOTICES.md",
|
|
10
|
+
"README.md",
|
|
11
|
+
"licenses",
|
|
12
|
+
"proxy",
|
|
13
|
+
"rust/Cargo.toml",
|
|
14
|
+
"rust/src"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./preview": {
|
|
22
|
+
"types": "./dist/preview/index.d.ts",
|
|
23
|
+
"import": "./dist/preview/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "bun ../../scripts/build-npm.ts",
|
|
28
|
+
"prepack": "bun run build && bun ../../scripts/verify-module-package.ts device",
|
|
29
|
+
"test": "bun test src",
|
|
30
|
+
"test:rust": "cargo test --manifest-path ../../Cargo.toml -p alwith-device-impl --lib"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@alwith/native-kit": "0.5.0",
|
|
34
|
+
"@nyssance/shadcn": "^4.23.2",
|
|
35
|
+
"lucide-react": "^1.66.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "^19.3.1",
|
|
39
|
+
"react-dom": "^19.3.1"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@happy-dom/global-registrator": "^21.0.4",
|
|
43
|
+
"@testing-library/react": "^16.3.3",
|
|
44
|
+
"@types/react": "^19.3.0",
|
|
45
|
+
"@types/react-dom": "^19.3.0",
|
|
46
|
+
"react": "^19.3.1",
|
|
47
|
+
"react-dom": "^19.3.1",
|
|
48
|
+
"typescript": "^7.0.2"
|
|
49
|
+
},
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/ALwith-ai/alwith-modules.git",
|
|
53
|
+
"directory": "packages/device"
|
|
54
|
+
}
|
|
55
|
+
}
|
package/proxy/stdio.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// A byte-only stdio carrier. Authentication and all scheduling live in the native host.
|
|
2
|
+
import { connect } from "node:net"
|
|
3
|
+
const [address, token] = process.argv.slice(2)
|
|
4
|
+
if (!address || !token || !/^127\.0\.0\.1:\d+$/.test(address)) throw new Error("Invalid device gateway address")
|
|
5
|
+
const socket = connect({ host: "127.0.0.1", port: Number(address.split(":")[1]) })
|
|
6
|
+
socket.on("connect", () => {
|
|
7
|
+
socket.write(`${token}\n`)
|
|
8
|
+
process.stdin.pipe(socket)
|
|
9
|
+
socket.pipe(process.stdout)
|
|
10
|
+
})
|
|
11
|
+
socket.on("error", () => {
|
|
12
|
+
process.exitCode = 1
|
|
13
|
+
process.stdin.destroy()
|
|
14
|
+
})
|
|
15
|
+
socket.on("close", () => {
|
|
16
|
+
process.stdin.destroy()
|
|
17
|
+
})
|
|
18
|
+
process.stdin.on("end", () => socket.destroy())
|
|
19
|
+
process.stdout.on("error", () => socket.destroy())
|
package/rust/Cargo.toml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
autobins = false
|
|
3
|
+
autotests = false
|
|
4
|
+
name = "alwith-device"
|
|
5
|
+
version = "0.5.0"
|
|
6
|
+
edition = "2024"
|
|
7
|
+
publish = false
|
|
8
|
+
[workspace]
|
|
9
|
+
[dependencies]
|
|
10
|
+
alwith-native-client = { path = "../../native-kit/rust" }
|
|
11
|
+
serde = { version = "1", features = ["derive"] }
|
|
12
|
+
serde_json = "1"
|
|
13
|
+
specta = { version = "2.0.0-rc.27", features = ["derive"] }
|
|
14
|
+
[dev-dependencies]
|
|
15
|
+
tokio = { version = "1", features = ["rt-multi-thread"] }
|
package/rust/src/lib.rs
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
//! Managed device types and ABI transport. The implementation lives in `@alwith/native-device`.
|
|
2
|
+
use alwith_native_client::Handle;
|
|
3
|
+
use serde::{Deserialize, Serialize};
|
|
4
|
+
use serde_json::{Value, json};
|
|
5
|
+
|
|
6
|
+
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, specta::Type)]
|
|
7
|
+
#[serde(rename_all = "camelCase")]
|
|
8
|
+
pub struct ManagedDevice {
|
|
9
|
+
pub id: String,
|
|
10
|
+
pub platform: String,
|
|
11
|
+
pub name: String,
|
|
12
|
+
pub system_version: String,
|
|
13
|
+
pub running: bool,
|
|
14
|
+
}
|
|
15
|
+
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, specta::Type)]
|
|
16
|
+
#[serde(tag = "type", content = "id", rename_all = "snake_case")]
|
|
17
|
+
pub enum Owner {
|
|
18
|
+
DevelopmentSession(String),
|
|
19
|
+
QaRun(String),
|
|
20
|
+
}
|
|
21
|
+
#[derive(Clone, Debug, Serialize, Deserialize, specta::Type)]
|
|
22
|
+
#[serde(rename_all = "camelCase")]
|
|
23
|
+
pub struct LaunchedApp {
|
|
24
|
+
pub bundle_id: String,
|
|
25
|
+
pub executable: String,
|
|
26
|
+
pub pid: u32,
|
|
27
|
+
pub launched_at: String,
|
|
28
|
+
}
|
|
29
|
+
#[derive(Clone, Debug, Serialize, Deserialize, specta::Type)]
|
|
30
|
+
#[serde(rename_all = "camelCase")]
|
|
31
|
+
pub struct AttachmentInfo {
|
|
32
|
+
pub udid: String,
|
|
33
|
+
pub platform: String,
|
|
34
|
+
pub device_name: String,
|
|
35
|
+
pub system_version: String,
|
|
36
|
+
pub owner: Owner,
|
|
37
|
+
pub attached_at: String,
|
|
38
|
+
pub pixel_width: Option<u32>,
|
|
39
|
+
pub pixel_height: Option<u32>,
|
|
40
|
+
pub app: Option<LaunchedApp>,
|
|
41
|
+
}
|
|
42
|
+
#[derive(Clone, Debug, Serialize, Deserialize, specta::Type)]
|
|
43
|
+
#[serde(rename_all = "camelCase")]
|
|
44
|
+
pub struct Registration {
|
|
45
|
+
pub address: String,
|
|
46
|
+
pub token: String,
|
|
47
|
+
}
|
|
48
|
+
#[derive(Clone, Debug, Default, Serialize, Deserialize, specta::Type)]
|
|
49
|
+
#[serde(rename_all = "camelCase")]
|
|
50
|
+
pub struct LogQuery {
|
|
51
|
+
pub since_seq: Option<u64>,
|
|
52
|
+
pub tail: Option<usize>,
|
|
53
|
+
pub min_level: Option<String>,
|
|
54
|
+
pub filter: Option<String>,
|
|
55
|
+
}
|
|
56
|
+
#[derive(Clone, Debug, Serialize, Deserialize, specta::Type)]
|
|
57
|
+
#[serde(rename_all = "camelCase")]
|
|
58
|
+
pub struct LogEntry {
|
|
59
|
+
pub seq: u64,
|
|
60
|
+
pub timestamp: String,
|
|
61
|
+
pub level: String,
|
|
62
|
+
pub process: String,
|
|
63
|
+
pub pid: u64,
|
|
64
|
+
pub subsystem: String,
|
|
65
|
+
pub category: String,
|
|
66
|
+
pub message: String,
|
|
67
|
+
}
|
|
68
|
+
#[derive(Clone, Debug, Serialize, Deserialize, specta::Type)]
|
|
69
|
+
#[serde(rename_all = "camelCase")]
|
|
70
|
+
pub struct LogPage {
|
|
71
|
+
pub entries: Vec<LogEntry>,
|
|
72
|
+
pub dropped: u64,
|
|
73
|
+
pub total: u64,
|
|
74
|
+
pub last_seq: u64,
|
|
75
|
+
pub capture_started_at: String,
|
|
76
|
+
}
|
|
77
|
+
#[derive(Clone, Debug, Serialize, Deserialize, specta::Type)]
|
|
78
|
+
#[serde(rename_all = "camelCase")]
|
|
79
|
+
pub struct CrashReport {
|
|
80
|
+
pub path: String,
|
|
81
|
+
pub process: String,
|
|
82
|
+
pub timestamp: String,
|
|
83
|
+
pub summary: String,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/// Devices available on this machine, without a host instance.
|
|
87
|
+
pub fn list(platform: &str) -> Result<Vec<ManagedDevice>, String> {
|
|
88
|
+
alwith_native_client::Library::module("device")?.call("device.list", json!({"platform": platform}))
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/// One host instance: its gateway, attachments and operations.
|
|
92
|
+
pub struct DeviceHost(Handle);
|
|
93
|
+
impl Default for DeviceHost {
|
|
94
|
+
fn default() -> Self {
|
|
95
|
+
Self::open().expect("Native device module is required")
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
impl DeviceHost {
|
|
99
|
+
/// None when the device module is not staged; hosts then run without simulators.
|
|
100
|
+
pub fn open() -> Option<Self> {
|
|
101
|
+
Handle::open("device", json!({})).ok().map(Self)
|
|
102
|
+
}
|
|
103
|
+
pub async fn listen(&self) -> Result<String, String> {
|
|
104
|
+
self.0.call_async("gateway_listen", json!({})).await
|
|
105
|
+
}
|
|
106
|
+
pub fn register(&self) -> Result<Registration, String> {
|
|
107
|
+
self.0.call("gateway_register", json!({}))
|
|
108
|
+
}
|
|
109
|
+
pub fn bind(&self, token: &str, session: &str) -> Result<(), String> {
|
|
110
|
+
self.0.call("gateway_bind", json!({"token": token, "session": session}))
|
|
111
|
+
}
|
|
112
|
+
pub async fn stop_session(&self, session: &str) -> Result<(), String> {
|
|
113
|
+
self.0.call_async("gateway_stop_session", json!({"session": session})).await
|
|
114
|
+
}
|
|
115
|
+
pub fn revision(&self) -> Result<u64, String> {
|
|
116
|
+
self.0.call("revision", json!({}))
|
|
117
|
+
}
|
|
118
|
+
/// Blocks up to 25 seconds until the attachments change past `revision`.
|
|
119
|
+
pub async fn changed_since(&self, revision: u64) -> Result<u64, String> {
|
|
120
|
+
self.0.call_async("changed_since", json!({"revision": revision})).await
|
|
121
|
+
}
|
|
122
|
+
pub fn attachments(&self) -> Result<Vec<AttachmentInfo>, String> {
|
|
123
|
+
self.0.call("attachments", json!({}))
|
|
124
|
+
}
|
|
125
|
+
pub async fn list(&self, platform: &str) -> Result<Vec<ManagedDevice>, String> {
|
|
126
|
+
let platform = platform.to_string();
|
|
127
|
+
tokio_free_blocking(move || list(&platform)).await
|
|
128
|
+
}
|
|
129
|
+
pub async fn attach(
|
|
130
|
+
&self, owner: Owner, platform: &str, udid: Option<&str>, auto_boot: bool,
|
|
131
|
+
) -> Result<AttachmentInfo, String> {
|
|
132
|
+
self.0
|
|
133
|
+
.call_async("attach", json!({"owner": owner, "platform": platform, "udid": udid, "auto_boot": auto_boot}))
|
|
134
|
+
.await
|
|
135
|
+
}
|
|
136
|
+
pub async fn detach(&self, udid: &str, owner: Option<Owner>) -> Result<(), String> {
|
|
137
|
+
self.0.call_async("detach", json!({"udid": udid, "owner": owner})).await
|
|
138
|
+
}
|
|
139
|
+
pub async fn launch(
|
|
140
|
+
&self, udid: &str, bundle_id: &str, app_path: Option<&str>, arguments: Vec<String>,
|
|
141
|
+
) -> Result<LaunchedApp, String> {
|
|
142
|
+
self.0
|
|
143
|
+
.call_async(
|
|
144
|
+
"launch",
|
|
145
|
+
json!({"udid": udid, "bundle_id": bundle_id, "app_path": app_path, "arguments": arguments}),
|
|
146
|
+
)
|
|
147
|
+
.await
|
|
148
|
+
}
|
|
149
|
+
pub async fn terminate(&self, udid: &str, bundle_id: &str) -> Result<(), String> {
|
|
150
|
+
self.0.call_async("terminate", json!({"udid": udid, "bundle_id": bundle_id})).await
|
|
151
|
+
}
|
|
152
|
+
/// Base64 PNG of the current screen.
|
|
153
|
+
pub async fn screenshot(&self, udid: &str) -> Result<String, String> {
|
|
154
|
+
self.0.call_async("screenshot", json!({"udid": udid})).await
|
|
155
|
+
}
|
|
156
|
+
pub async fn open_url(&self, udid: &str, url: &str) -> Result<(), String> {
|
|
157
|
+
self.0.call_async("open_url", json!({"udid": udid, "url": url})).await
|
|
158
|
+
}
|
|
159
|
+
pub async fn appearance(&self, udid: &str) -> Result<String, String> {
|
|
160
|
+
self.0.call_async("appearance", json!({"udid": udid})).await
|
|
161
|
+
}
|
|
162
|
+
pub async fn set_appearance(&self, udid: &str, mode: &str) -> Result<(), String> {
|
|
163
|
+
self.0.call_async("set_appearance", json!({"udid": udid, "mode": mode})).await
|
|
164
|
+
}
|
|
165
|
+
pub async fn shutdown_device(&self, udid: &str) -> Result<(), String> {
|
|
166
|
+
self.0.call_async("shutdown_device", json!({"udid": udid})).await
|
|
167
|
+
}
|
|
168
|
+
pub async fn restart_device(&self, udid: &str) -> Result<(), String> {
|
|
169
|
+
self.0.call_async("restart_device", json!({"udid": udid})).await
|
|
170
|
+
}
|
|
171
|
+
pub async fn set_status_bar(&self, udid: &str, look: &str) -> Result<(), String> {
|
|
172
|
+
self.0.call_async("set_status_bar", json!({"udid": udid, "look": look})).await
|
|
173
|
+
}
|
|
174
|
+
pub async fn read_logs(&self, udid: &str, query: LogQuery) -> Result<LogPage, String> {
|
|
175
|
+
self.0.call_async("logs_read", json!({"udid": udid, "query": query})).await
|
|
176
|
+
}
|
|
177
|
+
pub fn crash_report(&self, udid: &str, bundle_id: Option<&str>) -> Result<Option<CrashReport>, String> {
|
|
178
|
+
self.0.call("crash_report", json!({"udid": udid, "bundle_id": bundle_id}))
|
|
179
|
+
}
|
|
180
|
+
pub fn call_value(&self, operation: &str, params: Value) -> Result<Value, Value> {
|
|
181
|
+
self.0.call_value(operation, params)
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async fn tokio_free_blocking<T: Send + 'static>(
|
|
185
|
+
work: impl FnOnce() -> Result<T, String> + Send + 'static,
|
|
186
|
+
) -> Result<T, String> {
|
|
187
|
+
let (sender, receiver) = std::sync::mpsc::channel();
|
|
188
|
+
std::thread::spawn(move || {
|
|
189
|
+
let _ = sender.send(work());
|
|
190
|
+
});
|
|
191
|
+
// The native call is short; poll the channel without holding an async runtime dependency.
|
|
192
|
+
loop {
|
|
193
|
+
match receiver.try_recv() {
|
|
194
|
+
Ok(result) => return result,
|
|
195
|
+
Err(std::sync::mpsc::TryRecvError::Empty) => std::thread::sleep(std::time::Duration::from_millis(10)),
|
|
196
|
+
Err(std::sync::mpsc::TryRecvError::Disconnected) => return Err("device listing thread exited".into()),
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|