tassello 0.3.0 → 0.4.0
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/CHANGELOG.md +15 -0
- package/README.md +70 -7
- package/dist/server/networking.d.ts +41 -0
- package/dist/server/networking.js +508 -0
- package/dist/server/networking_format.d.ts +38 -0
- package/dist/server/networking_format.js +651 -0
- package/dist/server/server.js +5 -1
- package/dist/server/session.d.ts +4 -1
- package/dist/server/session.js +23 -2
- package/dist/shared/networking.d.ts +178 -0
- package/dist/shared/networking.js +248 -0
- package/dist/shared/protocol.d.ts +18 -2
- package/dist/types/client/connection.d.ts +9 -1
- package/dist/types/client/icons.d.ts +6 -0
- package/dist/types/client/sdk/index.d.ts +2 -1
- package/dist/types/shared/networking.d.ts +178 -0
- package/dist/types/shared/protocol.d.ts +18 -2
- package/dist/www/assets/Joystick.js +1 -1
- package/dist/www/assets/RobotModelView.js +2 -2
- package/dist/www/assets/TerminalView.js +2 -2
- package/dist/www/assets/icons.js +1 -1
- package/dist/www/assets/index.css +1 -1
- package/dist/www/assets/index.js +42 -42
- package/dist/www/assets/shared/tassello-sdk.js +1 -1
- package/docs/plugins.md +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
export type WifiSecurity = 'open' | 'owe' | 'wep' | 'wpa-psk' | 'sae' | 'wpa-eap';
|
|
2
|
+
export type ConnectionKind = 'wifi' | 'hotspot' | 'ethernet' | 'vpn' | 'other';
|
|
3
|
+
export type EditableKind = 'wifi' | 'hotspot' | 'ethernet';
|
|
4
|
+
export type Ipv4Method = 'auto' | 'manual' | 'shared' | 'disabled';
|
|
5
|
+
export declare const DEVICE_UNMANAGED = 10;
|
|
6
|
+
export declare const DEVICE_UNAVAILABLE = 20;
|
|
7
|
+
export declare const DEVICE_DISCONNECTED = 30;
|
|
8
|
+
export declare const DEVICE_ACTIVATED = 100;
|
|
9
|
+
export declare const DEVICE_DEACTIVATING = 110;
|
|
10
|
+
export declare const DEVICE_FAILED = 120;
|
|
11
|
+
export interface NetworkDevice {
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
state: number;
|
|
15
|
+
stateText: string;
|
|
16
|
+
reason: string;
|
|
17
|
+
connection: string | null;
|
|
18
|
+
connectionName: string;
|
|
19
|
+
external: boolean;
|
|
20
|
+
software: boolean;
|
|
21
|
+
hwaddr: string;
|
|
22
|
+
mtu: number | null;
|
|
23
|
+
carrier: boolean | null;
|
|
24
|
+
speed: string;
|
|
25
|
+
driver: string;
|
|
26
|
+
vendor: string;
|
|
27
|
+
product: string;
|
|
28
|
+
accessPoint: boolean;
|
|
29
|
+
band24: boolean;
|
|
30
|
+
band5: boolean;
|
|
31
|
+
ipv4: string[];
|
|
32
|
+
ipv6: string[];
|
|
33
|
+
gateway: string;
|
|
34
|
+
dns: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface NetworkConnection {
|
|
37
|
+
uuid: string;
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
kind: ConnectionKind;
|
|
41
|
+
interface: string;
|
|
42
|
+
autoconnect: boolean;
|
|
43
|
+
priority: number;
|
|
44
|
+
lastUsed: number | null;
|
|
45
|
+
readOnly: boolean;
|
|
46
|
+
file: string;
|
|
47
|
+
device: string | null;
|
|
48
|
+
activeState: string | null;
|
|
49
|
+
external: boolean;
|
|
50
|
+
ssid: string;
|
|
51
|
+
security: WifiSecurity | null;
|
|
52
|
+
hidden: boolean;
|
|
53
|
+
band: '' | 'a' | 'bg';
|
|
54
|
+
channel: number;
|
|
55
|
+
identity: string;
|
|
56
|
+
vpnService: string;
|
|
57
|
+
ipv4Method: string;
|
|
58
|
+
addresses: string[];
|
|
59
|
+
gateway: string;
|
|
60
|
+
dns: string[];
|
|
61
|
+
}
|
|
62
|
+
export interface WifiNetwork {
|
|
63
|
+
ssid: string;
|
|
64
|
+
device: string;
|
|
65
|
+
bssid: string;
|
|
66
|
+
signal: number;
|
|
67
|
+
frequency: number;
|
|
68
|
+
channel: number;
|
|
69
|
+
rate: string;
|
|
70
|
+
securityText: string;
|
|
71
|
+
security: WifiSecurity;
|
|
72
|
+
mode: string;
|
|
73
|
+
active: boolean;
|
|
74
|
+
points: number;
|
|
75
|
+
}
|
|
76
|
+
export interface NetworkActivity {
|
|
77
|
+
id: number;
|
|
78
|
+
action: NetworkRequest['action'];
|
|
79
|
+
label: string;
|
|
80
|
+
uuid: string | null;
|
|
81
|
+
ssid: string | null;
|
|
82
|
+
device: string | null;
|
|
83
|
+
started: number;
|
|
84
|
+
finished: number | null;
|
|
85
|
+
error: string | null;
|
|
86
|
+
}
|
|
87
|
+
export interface NetworkPermissions {
|
|
88
|
+
control: boolean;
|
|
89
|
+
modify: boolean;
|
|
90
|
+
wifi: boolean;
|
|
91
|
+
scan: boolean;
|
|
92
|
+
share: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface NetworkState {
|
|
95
|
+
error: string | null;
|
|
96
|
+
version: string;
|
|
97
|
+
state: string;
|
|
98
|
+
connectivity: string;
|
|
99
|
+
wifi: boolean;
|
|
100
|
+
wifiHardware: boolean;
|
|
101
|
+
permissions: NetworkPermissions;
|
|
102
|
+
devices: NetworkDevice[];
|
|
103
|
+
connections: NetworkConnection[];
|
|
104
|
+
networks: WifiNetwork[];
|
|
105
|
+
scanning: boolean;
|
|
106
|
+
activity: NetworkActivity[];
|
|
107
|
+
}
|
|
108
|
+
export interface NetworkSettings {
|
|
109
|
+
kind: EditableKind;
|
|
110
|
+
name: string;
|
|
111
|
+
interface: string;
|
|
112
|
+
autoconnect: boolean;
|
|
113
|
+
priority: number;
|
|
114
|
+
ssid: string;
|
|
115
|
+
hidden: boolean;
|
|
116
|
+
security: WifiSecurity;
|
|
117
|
+
password: string | null;
|
|
118
|
+
identity: string;
|
|
119
|
+
band: '' | 'a' | 'bg';
|
|
120
|
+
channel: number;
|
|
121
|
+
ipv4: Ipv4Method;
|
|
122
|
+
addresses: string[];
|
|
123
|
+
gateway: string;
|
|
124
|
+
dns: string[];
|
|
125
|
+
}
|
|
126
|
+
export type NetworkRequest = {
|
|
127
|
+
action: 'connect';
|
|
128
|
+
uuid: string;
|
|
129
|
+
device: string | null;
|
|
130
|
+
password: string | null;
|
|
131
|
+
} | {
|
|
132
|
+
action: 'disconnect';
|
|
133
|
+
uuid: string;
|
|
134
|
+
} | {
|
|
135
|
+
action: 'create';
|
|
136
|
+
settings: NetworkSettings;
|
|
137
|
+
connect: boolean;
|
|
138
|
+
device: string | null;
|
|
139
|
+
} | {
|
|
140
|
+
action: 'modify';
|
|
141
|
+
uuid: string;
|
|
142
|
+
settings: NetworkSettings;
|
|
143
|
+
} | {
|
|
144
|
+
action: 'delete';
|
|
145
|
+
uuid: string;
|
|
146
|
+
} | {
|
|
147
|
+
action: 'wifi';
|
|
148
|
+
enabled: boolean;
|
|
149
|
+
} | {
|
|
150
|
+
action: 'rescan';
|
|
151
|
+
device: string | null;
|
|
152
|
+
} | {
|
|
153
|
+
action: 'secrets';
|
|
154
|
+
uuid: string;
|
|
155
|
+
};
|
|
156
|
+
export interface NetworkSecrets {
|
|
157
|
+
ssid: string;
|
|
158
|
+
security: WifiSecurity | null;
|
|
159
|
+
password: string;
|
|
160
|
+
hidden: boolean;
|
|
161
|
+
}
|
|
162
|
+
export interface NetworkResult {
|
|
163
|
+
uuid: string | null;
|
|
164
|
+
message: string | null;
|
|
165
|
+
}
|
|
166
|
+
export declare const WRONG_PASSWORD = "Wrong password, or none given";
|
|
167
|
+
export declare const SECURITY_LABELS: Record<WifiSecurity, string>;
|
|
168
|
+
export declare function needsPassword(security: WifiSecurity): boolean;
|
|
169
|
+
export declare function isInterfaceName(name: string): boolean;
|
|
170
|
+
export declare function isUuid(uuid: string): boolean;
|
|
171
|
+
export declare function isIpv4(address: string): boolean;
|
|
172
|
+
export declare function isIpv6(address: string): boolean;
|
|
173
|
+
export declare function cidrProblem(cidr: string): string | null;
|
|
174
|
+
export declare function splitList(text: string): string[];
|
|
175
|
+
export declare function passwordProblem(security: WifiSecurity, password: string, hotspot?: boolean): string | null;
|
|
176
|
+
export declare function settingsProblems(settings: NetworkSettings, creating: boolean): Partial<Record<keyof NetworkSettings, string>>;
|
|
177
|
+
export declare function settingsOf(connection: NetworkConnection): NetworkSettings | null;
|
|
178
|
+
export declare function defaultSettings(kind: EditableKind): NetworkSettings;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BtNodeModel } from './bt_nodes.ts';
|
|
2
|
+
import type { NetworkRequest, NetworkState } from './networking.ts';
|
|
2
3
|
export type ImageTransport = 'auto' | 'raw' | 'compressed';
|
|
3
4
|
export type GridStyle = 'map' | 'costmap';
|
|
4
5
|
export interface TwistCommand {
|
|
@@ -229,7 +230,16 @@ export interface TerminalRestart {
|
|
|
229
230
|
type: 'terminal.restart';
|
|
230
231
|
id: number;
|
|
231
232
|
}
|
|
232
|
-
export
|
|
233
|
+
export interface NetworkSubscribe {
|
|
234
|
+
type: 'network.subscribe';
|
|
235
|
+
id: number;
|
|
236
|
+
}
|
|
237
|
+
export interface NetworkAction {
|
|
238
|
+
type: 'network.action';
|
|
239
|
+
id: number;
|
|
240
|
+
request: NetworkRequest;
|
|
241
|
+
}
|
|
242
|
+
export type ClientMessage = TwistCommand | ImageSubscribe | GridSubscribe | TfSubscribe | PathSubscribe | TopicSubscribe | ServicesSubscribe | ServiceAction | LogsSubscribe | Unsubscribe | FrameAck | PosePublish | CommandRun | CommandStop | ArmSubscribe | ArmJog | RosPublish | RosCall | PluginRequest | PluginSubscribe | BehaviorTreeSubscribe | BehaviorTreeRecord | BehaviorTreePlaybackSubscribe | BehaviorTreePlaybackControl | BehaviorTreeFileSubscribe | BehaviorTreeFileSave | RosoutSubscribe | DiagnosticsSubscribe | TerminalOpen | TerminalInput | TerminalResize | TerminalAck | TerminalRestart | NetworkSubscribe | NetworkAction;
|
|
233
243
|
export interface Hello {
|
|
234
244
|
type: 'hello';
|
|
235
245
|
clientId: string;
|
|
@@ -510,7 +520,13 @@ export interface TerminalExit {
|
|
|
510
520
|
started: number;
|
|
511
521
|
exitCode: number | null;
|
|
512
522
|
}
|
|
513
|
-
export
|
|
523
|
+
export interface NetworkUpdate extends NetworkState {
|
|
524
|
+
type: 'network';
|
|
525
|
+
id: number;
|
|
526
|
+
via: string | null;
|
|
527
|
+
canChange: boolean;
|
|
528
|
+
}
|
|
529
|
+
export type ServerMessage = Hello | CommandStates | CommandUpdate | StreamStatus | TfUpdate | PathUpdate | TopicMessage | ServicesUpdate | ServiceResult | LogsUpdate | ArmUpdate | Result | PluginData | BehaviorTreeInfo | BehaviorTreeUpdate | BehaviorTreeRecording | BehaviorTreePlaybackState | BehaviorTreeFile | BehaviorTreeModels | RosoutUpdate | DiagnosticsUpdate | TerminalOutput | TerminalExit | NetworkUpdate | PanelsChanged | ErrorMessage;
|
|
514
530
|
export declare const FRAME_HEADER_BYTES = 11;
|
|
515
531
|
export declare const IMAGE_FORMATS: readonly ['image/jpeg', 'image/png'];
|
|
516
532
|
export interface GridInfo {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime.js";import{t}from"./react.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime.js";import{t}from"./react.js";import{Ht as n,Lt as r}from"./icons.js";import{t as i}from"./jsx-runtime.js";var a=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function o(e,t,i){let o=await fetch(t,{method:e,headers:{"Content-Type":`application/json`,[n]:r.clientId??``},body:i===void 0?void 0:JSON.stringify(i)});if(!o.ok){let e=`${o.status} ${o.statusText}`;try{e=(await o.json()).error??e}catch{}throw new a(o.status,e)}return o.status===204?void 0:await o.json()}var s=e=>`/api/panels/${encodeURIComponent(e)}`;async function c(e){let t=await fetch(`/api/uploads`,{method:`POST`,body:e});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error??`${t.status} ${t.statusText}`)}return await t.json()}function l(e){let t=e.trim();if(t.startsWith(`uploads/`))return`/api/uploads/${encodeURIComponent(t.slice(8))}`;let n=/^package:\/\/([^/]+)\/(.+)$/.exec(t);return n?`/api/packages/${encodeURIComponent(n[1])}/${n[2].split(`/`).map(encodeURIComponent).join(`/`)}`:t.startsWith(`/`)||t.startsWith(`~/`)?`/api/files?path=${encodeURIComponent(t)}`:null}var u={listPanels:()=>o(`GET`,`/api/panels`),getPanel:e=>o(`GET`,s(e)),createPanel:e=>o(`POST`,`/api/panels`,e),savePanel:e=>o(`PUT`,s(e.id),e),deletePanel:e=>o(`DELETE`,s(e)),listTopics:()=>o(`GET`,`/api/topics`),listPlugins:()=>o(`GET`,`/api/plugins`),listFiles:(e,t=`image`)=>o(`GET`,`/api/files/list?dir=${encodeURIComponent(e)}&kind=${t}`),uploadFile:async e=>`uploads/${(await c(e)).name}`};function d(e,t={}){let n=new URLSearchParams;for(let[e,r]of Object.entries(t))for(let t of r==null?[]:[r].flat())n.append(e,t);let r=n.toString();return`/api/fs/${e}${r?`?${r}`:``}`}var f={places:()=>o(`GET`,d(`places`)),list:(e,t)=>o(`GET`,d(`list`,{path:e,known:t})),details:e=>o(`GET`,d(`details`,{path:e})),disks:()=>o(`GET`,d(`disks`)),analyze:e=>o(`GET`,d(`analysis`,{path:e})),readText:(e,t)=>o(`GET`,d(`text`,{path:e,stamp:t})),saveText:(e,t,n,r=!1)=>o(`PUT`,d(`text`),{path:e,text:t,base:n,create:r}),operate:e=>o(`POST`,d(`op`),e),downloadUrl:e=>d(`download`,{path:e}),viewUrl:(e,t)=>d(`view`,{path:e,v:t}),upload(e,t,i,a,o){let s=new XMLHttpRequest;return{result:new Promise((c,l)=>{s.open(`POST`,d(`upload`,{path:e,name:t,conflict:a})),s.setRequestHeader(n,r.clientId??``),s.upload.onprogress=e=>o(e.loaded),s.onload=()=>{let e=null;try{e=JSON.parse(s.responseText)}catch{}s.status>=200&&s.status<300&&e?c(e):l(Error(e?.error??`${s.status} ${s.statusText}`))},s.onerror=()=>l(Error(`Cannot reach the robot`)),s.onabort=()=>l(new DOMException(`Cancelled`,`AbortError`)),s.send(i)}),abort:()=>s.abort()}}},p=e(t(),1),m=e(i(),1),h=5e3,g=[],_=1,v=new Set;function y(e){g=e,v.forEach(e=>e())}function b(e){y(g.filter(t=>t.id!==e))}function x(e,t=`info`,n){let r=_++;y([...g.filter(t=>t.message!==e),{id:r,message:e,kind:t,action:n}].slice(-4)),setTimeout(()=>b(r),h)}function S(e){return v.add(e),()=>v.delete(e)}function C(){let e=(0,p.useSyncExternalStore)(S,()=>g);return(0,m.jsx)(`div`,{className:`notifications`,role:`status`,"aria-live":`polite`,children:e.map(e=>(0,m.jsxs)(`div`,{className:`notification ${e.kind}`,children:[(0,m.jsx)(`span`,{children:e.message}),e.action&&(0,m.jsx)(`button`,{type:`button`,className:`link-button`,onClick:()=>{e.action?.run(),b(e.id)},children:e.action.label}),(0,m.jsx)(`button`,{type:`button`,className:`notification-close`,"aria-label":`Dismiss`,onClick:()=>b(e.id),children:`×`})]},e.id))})}function w(e){return e}function T(e){return e}var E=34,D=.08;function O(e){let t=Math.abs(e);return t<D?0:Math.sign(e)*(t-D)/.92}function k({axes:e,onMove:t,disabled:n,label:r}){let i=(0,p.useRef)(null),a=(0,p.useRef)(null),[o,s]=(0,p.useState)({x:0,y:0}),[c,l]=(0,p.useState)(!1),u=(0,p.useRef)(t);u.current=t;let d=(e,t)=>{s({x:e,y:t}),u.current(O(e),O(t))},f=t=>{let n=i.current.getBoundingClientRect(),r=n.width*E/100,a=e===`y`?0:(t.clientX-(n.left+n.width/2))/r,o=e===`x`?0:-(t.clientY-(n.top+n.height/2))/r,s=Math.hypot(a,o);s>1&&(a/=s,o/=s),d(a,o)},h=e=>{a.current===null||e&&e.pointerId!==a.current||(a.current=null,l(!1),d(0,0))},g=(0,p.useRef)(h);return g.current=h,(0,p.useEffect)(()=>{let e=()=>document.hidden&&g.current();return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,p.useEffect)(()=>{n&&g.current()},[n]),(0,m.jsxs)(`div`,{className:`joystick-slot`,children:[(0,m.jsxs)(`div`,{ref:i,className:`joystick${e===`x`?` horizontal`:e===`y`?` vertical`:``}${c?` active`:``}${n?` disabled`:``}`,onPointerDown:e=>{n||a.current!==null||e.button!==0||(a.current=e.pointerId,l(!0),e.currentTarget.setPointerCapture(e.pointerId),f(e))},onPointerMove:e=>e.pointerId===a.current&&f(e),onPointerUp:h,onPointerCancel:h,onLostPointerCapture:h,children:[(0,m.jsx)(`div`,{className:`joystick-track`}),(0,m.jsx)(`div`,{className:`joystick-knob`,style:{left:`${50+o.x*E}%`,top:`${50-o.y*E}%`}})]}),(0,m.jsx)(`span`,{className:`joystick-label`,children:r})]})}export{x as a,f as c,C as i,l,T as n,a as o,w as r,u as s,k as t};
|