abb-rws-client 0.2.0 → 0.7.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +171 -0
  2. package/README.md +364 -143
  3. package/dist/HttpSession.d.ts.map +1 -1
  4. package/dist/HttpSession.js +18 -1
  5. package/dist/HttpSession.js.map +1 -1
  6. package/dist/IRWSAdapter.d.ts +421 -0
  7. package/dist/IRWSAdapter.d.ts.map +1 -0
  8. package/dist/IRWSAdapter.js +2 -0
  9. package/dist/IRWSAdapter.js.map +1 -0
  10. package/dist/Logger.d.ts +35 -0
  11. package/dist/Logger.d.ts.map +1 -0
  12. package/dist/Logger.js +24 -0
  13. package/dist/Logger.js.map +1 -0
  14. package/dist/MultiRobotManager.d.ts +56 -0
  15. package/dist/MultiRobotManager.d.ts.map +1 -0
  16. package/dist/MultiRobotManager.js +129 -0
  17. package/dist/MultiRobotManager.js.map +1 -0
  18. package/dist/RWS1Adapter.d.ts +297 -0
  19. package/dist/RWS1Adapter.d.ts.map +1 -0
  20. package/dist/RWS1Adapter.js +870 -0
  21. package/dist/RWS1Adapter.js.map +1 -0
  22. package/dist/RWS2Adapter.d.ts +20 -0
  23. package/dist/RWS2Adapter.d.ts.map +1 -0
  24. package/dist/RWS2Adapter.js +19 -0
  25. package/dist/RWS2Adapter.js.map +1 -0
  26. package/dist/ResourceMapper.d.ts +226 -2
  27. package/dist/ResourceMapper.d.ts.map +1 -1
  28. package/dist/ResourceMapper.js +286 -3
  29. package/dist/ResourceMapper.js.map +1 -1
  30. package/dist/ResponseParser.d.ts +81 -2
  31. package/dist/ResponseParser.d.ts.map +1 -1
  32. package/dist/ResponseParser.js +309 -3
  33. package/dist/ResponseParser.js.map +1 -1
  34. package/dist/RobotManager.d.ts +536 -0
  35. package/dist/RobotManager.d.ts.map +1 -0
  36. package/dist/RobotManager.js +1523 -0
  37. package/dist/RobotManager.js.map +1 -0
  38. package/dist/RwsClient.d.ts +280 -4
  39. package/dist/RwsClient.d.ts.map +1 -1
  40. package/dist/RwsClient.js +698 -10
  41. package/dist/RwsClient.js.map +1 -1
  42. package/dist/RwsClient2.d.ts +438 -0
  43. package/dist/RwsClient2.d.ts.map +1 -0
  44. package/dist/RwsClient2.js +1672 -0
  45. package/dist/RwsClient2.js.map +1 -0
  46. package/dist/WsSubscriber.d.ts.map +1 -1
  47. package/dist/WsSubscriber.js +18 -11
  48. package/dist/WsSubscriber.js.map +1 -1
  49. package/dist/XhtmlParser.d.ts +24 -0
  50. package/dist/XhtmlParser.d.ts.map +1 -0
  51. package/dist/XhtmlParser.js +56 -0
  52. package/dist/XhtmlParser.js.map +1 -0
  53. package/dist/detect.d.ts +54 -0
  54. package/dist/detect.d.ts.map +1 -0
  55. package/dist/detect.js +187 -0
  56. package/dist/detect.js.map +1 -0
  57. package/dist/index.d.ts +30 -3
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +30 -2
  60. package/dist/index.js.map +1 -1
  61. package/dist/types.d.ts +190 -3
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/types.js +1 -0
  64. package/dist/types.js.map +1 -1
  65. package/examples/01-quickstart-auto.mjs +20 -0
  66. package/examples/02-rws1-explicit.mjs +30 -0
  67. package/examples/03-rws2-explicit.mjs +26 -0
  68. package/examples/04-multi-robot.mjs +35 -0
  69. package/examples/05-remote-control-rmmp.mjs +52 -0
  70. package/examples/06-pull-module-source.mjs +38 -0
  71. package/package.json +31 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,171 @@
1
+ # Changelog
2
+
3
+ All notable changes to `abb-rws-client` are documented here.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.7.1] — 2026-05-07
8
+
9
+ ### Added
10
+
11
+ - **RMMP (Remote Mastership Privilege)** is now part of the public `RobotManager`
12
+ surface — `getRmmpPrivilege()` and `requestRmmp(level)`. The `withMastership()`
13
+ helper now also gates on RMMP, so any modify operation in AUTO mode will
14
+ automatically request RMMP and surface an actionable error ("approve the
15
+ popup on the FlexPendant") when the operator hasn't granted remote control
16
+ yet. This matches RobotStudio Online's behaviour and removes the most common
17
+ cause of mastership-acquired-but-403 failures.
18
+ - **Service-routine / arbitrary PROC call** — `callServiceRoutine(task, name,
19
+ args?)` lets a remote client kick off a service routine (calibration, brake
20
+ check, custom service procs) without going through the FlexPendant's
21
+ Service Routine menu.
22
+ - **Tool / Work-object activation** — `setActiveTool(mechunit, name)` and
23
+ `setActiveWobj(mechunit, name)` switch the active persistent tooldata /
24
+ wobjdata mid-session.
25
+ - **Module metadata** — `getModuleInfo(task, module)` exposed publicly (was
26
+ adapter-only). Returns path, attributes, type, line count.
27
+ - **Backup restore** — `restoreBackup(name)` exposed publicly (was adapter-only).
28
+ - **Backup status** type-narrowed — `getBackupStatus()` now returns the full
29
+ `{ active; progress?; phase? }` shape on every code path (no more union
30
+ with bare `{ active }`).
31
+ - **CFG write surface** exposed publicly with mastership wrapping —
32
+ `setCfgInstance`, `createCfgInstance`, `removeCfgInstance`, `loadCfgFile`,
33
+ `saveCfgFile`. Each acquires `'edit'` mastership for the duration of the
34
+ call.
35
+ - **DIPC public API** — `listDipcQueues`, `createDipcQueue`, `sendDipcMessage`,
36
+ `readDipcMessage`, `removeDipcQueue` exposed on `RobotManager`.
37
+ - **File volumes** — `listFileVolumes()` returns the controller's available
38
+ volumes (HOME, BACKUP, DATA, ADDINDATA, PRODUCTS, RAMDISK, TEMP).
39
+ - **Compress** — `compressPath(source, destination)` for archiving controller
40
+ files in-place.
41
+ - **Mastership status** — `getMastershipStatus(domain)` returns
42
+ `{ mastership; uid?; application? }`. Useful for diagnosing 403s ("which
43
+ client / FlexPendant is currently holding the lock?").
44
+
45
+ ### Improved
46
+
47
+ - `getRobotType`, `getProgramPointer`, `getMotionPointer` now have explicit
48
+ return-type annotations on the `RobotManager` wrappers — TypeScript no
49
+ longer collapses the empty-default into a property-less union.
50
+
51
+ ### No breaking changes
52
+
53
+ - All additions are new methods or default-no-op widening. Existing callers
54
+ using `RobotManager` keep working without any changes.
55
+
56
+ ## [0.7.0] — 2026-05-06
57
+
58
+ This release adds RWS 2.0 (OmniCore / RobotWare 7) support, multi-robot
59
+ management, auto-detection helpers, and a full set of higher-level building
60
+ blocks. The package now legitimately covers BOTH RWS protocols ABB ships,
61
+ including the long-tail endpoints (devices, all-IO-devices, mastership
62
+ extras, forward kinematics) that were missing from prior versions.
63
+
64
+ ### Added
65
+
66
+ - **`RwsClient2`** — RWS 2.0 protocol client for OmniCore controllers.
67
+ HTTP Basic auth, XHTML responses (`Accept: application/xhtml+xml;v=2.0`),
68
+ path-based actions (`/rw/rapid/execution/stop`), `'edit'` mastership
69
+ domain, `HOME` file-service prefix, self-signed-TLS tolerance for VCs,
70
+ WebSocket subscriptions via `robapi2_subscription` subprotocol.
71
+
72
+ - **`IRWSAdapter`** — common interface implemented by both RWS 1.0 and 2.0
73
+ adapters. ~140 methods covering panel, RAPID exec, modules, variables,
74
+ motion, system, event log, I/O, file service, CFG database, mastership,
75
+ backup, DIPC, vision, safety, virtual time, certs, registry, jog, IK/FK.
76
+
77
+ - **`RWS1Adapter`** / **`RWS2Adapter`** — wrappers that satisfy `IRWSAdapter`
78
+ on top of `RwsClient` and `RwsClient2` respectively. Use these when you
79
+ want a single typed handle that works across both protocols.
80
+
81
+ - **`RobotManager`** — high-level connection lifecycle: auto port discovery,
82
+ protocol auto-detection, polling, WebSocket subscriptions with polling
83
+ fallback, reconnect-on-failure, state events. `onError` listener lets the
84
+ host (CLI / UI) decide how to surface failures.
85
+
86
+ - **`MultiRobotManager`** — orchestrates several `RobotManager` instances.
87
+ Tracks an "active" robot for UIs that show one at a time, while polling
88
+ state for all. `onError` cascades to every existing and future robot.
89
+
90
+ - **`createClient(opts)`** / **`createAdapter(opts)`** — auto-detect helpers
91
+ that probe the WWW-Authenticate header and return the matching client
92
+ (or `IRWSAdapter`) already connected. Probes common RWS ports if `port`
93
+ is omitted (5466, 9403, 443, 80, 11811).
94
+
95
+ - **`probeProtocol(host, port, https)`** / **`probeHost(host)`** — lower-level
96
+ protocol detection for callers that want explicit control.
97
+
98
+ - **Mastership extras** (RWS 2.0 + partial RWS 1.0):
99
+ - `requestMastershipAll()` / `releaseMastershipAll()` — all-domains in one call
100
+ - `requestMastershipWithId(domain)` / `releaseMastershipWithId(domain, id)` —
101
+ token-based mastership that survives session loss; useful for clients
102
+ that periodically reconnect (RWS 2.0 only)
103
+ - `resetMastershipWatchdog()` — heartbeat for RobotWare 7.8+ during long
104
+ RAPID runs
105
+ - `getMastershipStatus(domain)` / `listMastershipDomains()` — read state
106
+
107
+ - **Devices** — both `/rw/devices` (system hardware/software inventory) and
108
+ `/rw/iosystem/devices` (all configured I/O devices across networks):
109
+ - `listSystemDevices()` — top-level groupings (HW_DEVICES, SW_RESOURCES)
110
+ - `getDeviceTree(group)` — drill into a group
111
+ - `listAllIoDevices()` — flat list of every I/O device with state
112
+
113
+ - **Forward Kinematics** — `calcCartesianFromJoints(joints, mechunit?, tool?, wobj?)`,
114
+ the missing mirror of `calcJointsFromCartesian`. Same VC-license caveat as IK:
115
+ virtual controllers without PC Interface 616-1 reject the call (clean error
116
+ message; no NaN leakage).
117
+
118
+ - **`XhtmlParser`** — exported for advanced users parsing RWS 2.0 responses
119
+ manually. Handles span / li / state extraction with regex.
120
+
121
+ - **`setLogger(impl)`** — pluggable logging interface. The lib ships with a
122
+ no-op default; hosts (e.g. the VS Code extension) install their own
123
+ backend (output channel, console, file, etc.).
124
+
125
+ - **`RwsErrorCode`**: new value `'PROTOCOL_DETECT_FAILED'` for cases where
126
+ no RWS endpoint answers on the probed port(s).
127
+
128
+ - `examples/` directory with four scripts: quickstart-auto, rws1-explicit,
129
+ rws2-explicit, multi-robot.
130
+
131
+ ### Changed
132
+
133
+ - **README** rewritten for dual-protocol support. Quick Start now uses
134
+ `createClient` for the typical case; explicit-protocol usage documented.
135
+
136
+ - **`RwsClient.disconnect()`** now calls `GET /logout` server-side before
137
+ clearing the local session. Without this, the controller-side session
138
+ lingered for several minutes, holding any acquired mastership and
139
+ filling the controller's session pool. Live-verified.
140
+
141
+ - **`RwsClient` createDirectory**: params now in body (`fs-action=create`
142
+ in body, not URL query). Live-verified — RWS 1.0 fileservice returns
143
+ HTTP 400 "Invalid/No Query Parameter" for the URL-query form.
144
+
145
+ - **`RwsClient` copyFile**: `fs-newname` now sends only the basename of the
146
+ destination path. RWS 1.0 fileservice copy operates within the source's
147
+ directory — passing a full path returns 400 "Invalid". Cross-directory
148
+ copy must use read+upload.
149
+
150
+ - `package.json`: added `description`, `keywords`, `homepage`, `repository`,
151
+ `engines.node`, `prepublishOnly` script. Removed invalid self-reference
152
+ in `dependencies`. Added `@types/ws` to devDependencies.
153
+
154
+ ### Compatibility
155
+
156
+ - **Node.js 18+** required (matches existing minimum).
157
+ - **No breaking changes for existing RWS 1.0 users.** `RwsClient` and its
158
+ type exports are unchanged in behavior except for the bug fixes above.
159
+ - New names (`RwsClient2`, `RobotManager`, etc.) sit alongside the old API.
160
+
161
+ ## [0.6.0] — 2026-04-30
162
+
163
+ - WebSocket subscriptions via `subscribe(resources, handler)`.
164
+ - Generic `request(method, path, body?)` escape hatch for RWS endpoints
165
+ not covered by typed methods.
166
+ - ~57 typed RWS 1.0 methods.
167
+
168
+ ## [0.5.0] and earlier
169
+
170
+ - Initial RWS 1.0 client: HTTP Digest auth, session cookie management,
171
+ request rate limiting, automatic re-authentication, typed `RwsError`.