sap-ui-automation 0.0.0-stage → 0.1.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.
Files changed (292) hide show
  1. package/CHANGELOG.md +250 -0
  2. package/LICENSE +21 -0
  3. package/README.md +167 -2
  4. package/dist/batch.d.ts +130 -0
  5. package/dist/batch.js +312 -0
  6. package/dist/browser/chrome.d.ts +94 -0
  7. package/dist/browser/chrome.js +534 -0
  8. package/dist/browser/classify.d.ts +54 -0
  9. package/dist/browser/classify.js +93 -0
  10. package/dist/browser/extension/index.d.ts +46 -0
  11. package/dist/browser/extension/index.js +236 -0
  12. package/dist/browser/extension/native.d.ts +73 -0
  13. package/dist/browser/extension/native.js +219 -0
  14. package/dist/browser/extension/pairing.d.ts +51 -0
  15. package/dist/browser/extension/pairing.js +136 -0
  16. package/dist/browser/extension/relay.d.ts +155 -0
  17. package/dist/browser/extension/relay.js +662 -0
  18. package/dist/browser/extension/ws.d.ts +47 -0
  19. package/dist/browser/extension/ws.js +21 -0
  20. package/dist/browser/launch.d.ts +85 -0
  21. package/dist/browser/launch.js +288 -0
  22. package/dist/browser/tab.d.ts +32 -0
  23. package/dist/browser/tab.js +64 -0
  24. package/dist/cli/agent.d.ts +41 -0
  25. package/dist/cli/agent.js +528 -0
  26. package/dist/cli/daemon.d.ts +108 -0
  27. package/dist/cli/daemon.js +442 -0
  28. package/dist/cli/doctor.d.ts +12 -0
  29. package/dist/cli/doctor.js +61 -0
  30. package/dist/cli/extension.d.ts +10 -0
  31. package/dist/cli/extension.js +153 -0
  32. package/dist/cli/init.d.ts +38 -0
  33. package/dist/cli/init.js +147 -0
  34. package/dist/cli/setup.d.ts +43 -0
  35. package/dist/cli/setup.js +295 -0
  36. package/dist/cli/skills.d.ts +37 -0
  37. package/dist/cli/skills.js +115 -0
  38. package/dist/cli.d.ts +2 -0
  39. package/dist/cli.js +198 -0
  40. package/dist/core/action.d.ts +64 -0
  41. package/dist/core/action.js +203 -0
  42. package/dist/core/compact.d.ts +54 -0
  43. package/dist/core/compact.js +650 -0
  44. package/dist/core/diff.d.ts +52 -0
  45. package/dist/core/diff.js +236 -0
  46. package/dist/core/guard.d.ts +101 -0
  47. package/dist/core/guard.js +216 -0
  48. package/dist/core/ids.d.ts +61 -0
  49. package/dist/core/ids.js +226 -0
  50. package/dist/core/notation.d.ts +63 -0
  51. package/dist/core/notation.js +168 -0
  52. package/dist/core/queue.d.ts +26 -0
  53. package/dist/core/queue.js +45 -0
  54. package/dist/core/registry.d.ts +68 -0
  55. package/dist/core/registry.js +210 -0
  56. package/dist/core/rows.d.ts +92 -0
  57. package/dist/core/rows.js +537 -0
  58. package/dist/core/types.d.ts +173 -0
  59. package/dist/core/types.js +19 -0
  60. package/dist/core/views.d.ts +40 -0
  61. package/dist/core/views.js +173 -0
  62. package/dist/core/words.d.ts +200 -0
  63. package/dist/core/words.js +908 -0
  64. package/dist/diag/classic.d.ts +199 -0
  65. package/dist/diag/classic.js +826 -0
  66. package/dist/diag/controls.d.ts +115 -0
  67. package/dist/diag/controls.js +578 -0
  68. package/dist/diag/decoder.d.ts +48 -0
  69. package/dist/diag/decoder.js +431 -0
  70. package/dist/diag/index.d.ts +11 -0
  71. package/dist/diag/index.js +10 -0
  72. package/dist/diag/lzh.d.ts +20 -0
  73. package/dist/diag/lzh.js +92 -0
  74. package/dist/diag/rfc.d.ts +28 -0
  75. package/dist/diag/rfc.js +109 -0
  76. package/dist/diag/screen.d.ts +355 -0
  77. package/dist/diag/screen.js +11 -0
  78. package/dist/diag/text.d.ts +23 -0
  79. package/dist/diag/text.js +60 -0
  80. package/dist/diag/view.d.ts +67 -0
  81. package/dist/diag/view.js +258 -0
  82. package/dist/diag/wire.d.ts +141 -0
  83. package/dist/diag/wire.js +445 -0
  84. package/dist/fiori/driver.d.ts +152 -0
  85. package/dist/fiori/driver.js +699 -0
  86. package/dist/fiori/index.d.ts +6 -0
  87. package/dist/fiori/index.js +132 -0
  88. package/dist/fiori/pending.d.ts +36 -0
  89. package/dist/fiori/pending.js +116 -0
  90. package/dist/fiori/risk.d.ts +79 -0
  91. package/dist/fiori/risk.js +268 -0
  92. package/dist/fiori/ui5.d.ts +150 -0
  93. package/dist/fiori/ui5.js +1864 -0
  94. package/dist/index.d.ts +12 -0
  95. package/dist/index.js +12 -0
  96. package/dist/record/checks.d.ts +17 -0
  97. package/dist/record/checks.js +64 -0
  98. package/dist/record/cli.d.ts +5 -0
  99. package/dist/record/cli.js +106 -0
  100. package/dist/record/code-tools.d.ts +48 -0
  101. package/dist/record/code-tools.js +499 -0
  102. package/dist/record/diag-screen.d.ts +7 -0
  103. package/dist/record/diag-screen.js +322 -0
  104. package/dist/record/export/calm.d.ts +28 -0
  105. package/dist/record/export/calm.js +47 -0
  106. package/dist/record/export/gherkin.d.ts +3 -0
  107. package/dist/record/export/gherkin.js +24 -0
  108. package/dist/record/export/index.d.ts +48 -0
  109. package/dist/record/export/index.js +25 -0
  110. package/dist/record/export/playwright.d.ts +29 -0
  111. package/dist/record/export/playwright.js +272 -0
  112. package/dist/record/export/sap-ts-tidy.d.ts +11 -0
  113. package/dist/record/export/sap-ts-tidy.js +135 -0
  114. package/dist/record/export/sap-ts.d.ts +32 -0
  115. package/dist/record/export/sap-ts.js +160 -0
  116. package/dist/record/export/vbs.d.ts +19 -0
  117. package/dist/record/export/vbs.js +210 -0
  118. package/dist/record/export/words.d.ts +15 -0
  119. package/dist/record/export/words.js +101 -0
  120. package/dist/record/format.d.ts +240 -0
  121. package/dist/record/format.js +214 -0
  122. package/dist/record/recorder.d.ts +87 -0
  123. package/dist/record/recorder.js +373 -0
  124. package/dist/record/repair.d.ts +137 -0
  125. package/dist/record/repair.js +338 -0
  126. package/dist/record/replay.d.ts +156 -0
  127. package/dist/record/replay.js +577 -0
  128. package/dist/record/screen.d.ts +87 -0
  129. package/dist/record/screen.js +182 -0
  130. package/dist/record/tidy.d.ts +59 -0
  131. package/dist/record/tidy.js +361 -0
  132. package/dist/record/tools.d.ts +19 -0
  133. package/dist/record/tools.js +205 -0
  134. package/dist/runner/cli.d.ts +24 -0
  135. package/dist/runner/cli.js +125 -0
  136. package/dist/runner/collect.d.ts +114 -0
  137. package/dist/runner/collect.js +104 -0
  138. package/dist/runner/config.d.ts +91 -0
  139. package/dist/runner/config.js +123 -0
  140. package/dist/runner/esm.d.ts +2 -0
  141. package/dist/runner/esm.js +37 -0
  142. package/dist/runner/index.d.ts +13 -0
  143. package/dist/runner/index.js +13 -0
  144. package/dist/runner/reporters.d.ts +28 -0
  145. package/dist/runner/reporters.js +165 -0
  146. package/dist/runner/run.d.ts +116 -0
  147. package/dist/runner/run.js +338 -0
  148. package/dist/sapgui/assess.d.ts +32 -0
  149. package/dist/sapgui/assess.js +391 -0
  150. package/dist/sapgui/facts.d.ts +144 -0
  151. package/dist/sapgui/facts.js +5 -0
  152. package/dist/sapgui/format.d.ts +21 -0
  153. package/dist/sapgui/format.js +117 -0
  154. package/dist/sapgui/host.d.ts +63 -0
  155. package/dist/sapgui/host.js +211 -0
  156. package/dist/sapgui/index.d.ts +31 -0
  157. package/dist/sapgui/index.js +590 -0
  158. package/dist/sapgui/keys.d.ts +9 -0
  159. package/dist/sapgui/keys.js +48 -0
  160. package/dist/sapgui/ps/host-lib.ps1 +744 -0
  161. package/dist/sapgui/ps/host.ps1 +8 -0
  162. package/dist/sapgui/resolve.d.ts +17 -0
  163. package/dist/sapgui/resolve.js +76 -0
  164. package/dist/sapgui/table.d.ts +33 -0
  165. package/dist/sapgui/table.js +127 -0
  166. package/dist/sapgui-diag/geometry.d.ts +96 -0
  167. package/dist/sapgui-diag/geometry.js +128 -0
  168. package/dist/sapgui-diag/index.d.ts +235 -0
  169. package/dist/sapgui-diag/index.js +1219 -0
  170. package/dist/sapgui-diag/plan.d.ts +283 -0
  171. package/dist/sapgui-diag/plan.js +644 -0
  172. package/dist/sapgui-diag/ps/input-host.ps1 +7 -0
  173. package/dist/sapgui-diag/ps/input-lib.ps1 +483 -0
  174. package/dist/sapgui-diag/router.d.ts +69 -0
  175. package/dist/sapgui-diag/router.js +252 -0
  176. package/dist/sapgui-diag/rows.d.ts +26 -0
  177. package/dist/sapgui-diag/rows.js +163 -0
  178. package/dist/sapgui-diag/traffic.d.ts +103 -0
  179. package/dist/sapgui-diag/traffic.js +288 -0
  180. package/dist/sdk/cached.d.ts +90 -0
  181. package/dist/sdk/cached.js +182 -0
  182. package/dist/sdk/code.d.ts +28 -0
  183. package/dist/sdk/code.js +68 -0
  184. package/dist/sdk/expect.d.ts +115 -0
  185. package/dist/sdk/expect.js +243 -0
  186. package/dist/sdk/index.d.ts +8 -0
  187. package/dist/sdk/index.js +8 -0
  188. package/dist/sdk/locators.d.ts +123 -0
  189. package/dist/sdk/locators.js +261 -0
  190. package/dist/sdk/lock.d.ts +238 -0
  191. package/dist/sdk/lock.js +190 -0
  192. package/dist/sdk/session.d.ts +248 -0
  193. package/dist/sdk/session.js +475 -0
  194. package/dist/sdk/verify.d.ts +185 -0
  195. package/dist/sdk/verify.js +473 -0
  196. package/dist/server.d.ts +119 -0
  197. package/dist/server.js +1189 -0
  198. package/dist/stdio.d.ts +2 -0
  199. package/dist/stdio.js +41 -0
  200. package/dist/structured.d.ts +112 -0
  201. package/dist/structured.js +67 -0
  202. package/dist/surfaces.d.ts +3 -0
  203. package/dist/surfaces.js +25 -0
  204. package/dist/trace/cli.d.ts +11 -0
  205. package/dist/trace/cli.js +70 -0
  206. package/dist/trace/html.d.ts +16 -0
  207. package/dist/trace/html.js +134 -0
  208. package/dist/trace/index.d.ts +3 -0
  209. package/dist/trace/index.js +3 -0
  210. package/dist/trace/summary.d.ts +37 -0
  211. package/dist/trace/summary.js +60 -0
  212. package/dist/webgui/assess.d.ts +83 -0
  213. package/dist/webgui/assess.js +785 -0
  214. package/dist/webgui/controls.d.ts +166 -0
  215. package/dist/webgui/controls.js +415 -0
  216. package/dist/webgui/field-labels.d.ts +27 -0
  217. package/dist/webgui/field-labels.js +107 -0
  218. package/dist/webgui/files.d.ts +45 -0
  219. package/dist/webgui/files.js +255 -0
  220. package/dist/webgui/index.d.ts +30 -0
  221. package/dist/webgui/index.js +175 -0
  222. package/dist/webgui/keys.d.ts +26 -0
  223. package/dist/webgui/keys.js +87 -0
  224. package/dist/webgui/labels.d.ts +32 -0
  225. package/dist/webgui/labels.js +103 -0
  226. package/dist/webgui/lists.d.ts +112 -0
  227. package/dist/webgui/lists.js +408 -0
  228. package/dist/webgui/page.d.ts +265 -0
  229. package/dist/webgui/page.js +1918 -0
  230. package/dist/webgui/popups.d.ts +45 -0
  231. package/dist/webgui/popups.js +111 -0
  232. package/dist/webgui/reader.d.ts +34 -0
  233. package/dist/webgui/reader.js +1096 -0
  234. package/dist/webgui/running.d.ts +14 -0
  235. package/dist/webgui/running.js +29 -0
  236. package/dist/webgui/screen.d.ts +110 -0
  237. package/dist/webgui/screen.js +387 -0
  238. package/dist/webgui/session.d.ts +306 -0
  239. package/dist/webgui/session.js +777 -0
  240. package/dist/webgui/unsaved.d.ts +35 -0
  241. package/dist/webgui/unsaved.js +60 -0
  242. package/docs/benchmarks.md +37 -0
  243. package/docs/comparison.md +108 -0
  244. package/docs/concepts/actions.md +155 -0
  245. package/docs/concepts/confirm-mode.md +101 -0
  246. package/docs/concepts/ids.md +69 -0
  247. package/docs/concepts/safety.md +187 -0
  248. package/docs/concepts/screen-view.md +146 -0
  249. package/docs/concepts/surfaces.md +70 -0
  250. package/docs/faq.md +337 -0
  251. package/docs/getting-started/first-session.md +96 -0
  252. package/docs/getting-started/index.md +81 -0
  253. package/docs/getting-started/installation.md +335 -0
  254. package/docs/getting-started/setup-prompt.md +28 -0
  255. package/docs/guides/chrome.md +221 -0
  256. package/docs/guides/cli-for-agents.md +84 -0
  257. package/docs/guides/network-reader.md +250 -0
  258. package/docs/guides/record-replay.md +890 -0
  259. package/docs/guides/sap-gui-windows.md +118 -0
  260. package/docs/guides/sdk-tests.md +265 -0
  261. package/docs/guides/trace-viewer.md +43 -0
  262. package/docs/index.md +30 -0
  263. package/docs/reference/actions.md +413 -0
  264. package/docs/reference/cli.md +164 -0
  265. package/docs/reference/configuration.md +113 -0
  266. package/docs/reference/tools.md +518 -0
  267. package/docs/security.md +212 -0
  268. package/extension/LICENSE +21 -0
  269. package/extension/PRIVACY.md +53 -0
  270. package/extension/PROTOCOL.md +382 -0
  271. package/extension/README.md +267 -0
  272. package/extension/REVIEW.md +153 -0
  273. package/extension/STORE.md +91 -0
  274. package/extension/background.js +2126 -0
  275. package/extension/code.js +18 -0
  276. package/extension/icons/128.png +0 -0
  277. package/extension/icons/16.png +0 -0
  278. package/extension/icons/32.png +0 -0
  279. package/extension/icons/48.png +0 -0
  280. package/extension/icons/mark-16.svg +1 -0
  281. package/extension/icons/mark.svg +1 -0
  282. package/extension/icons.js +44 -0
  283. package/extension/managed_schema.json +25 -0
  284. package/extension/manifest.json +44 -0
  285. package/extension/policy.js +337 -0
  286. package/extension/popup.css +450 -0
  287. package/extension/popup.html +165 -0
  288. package/extension/popup.js +732 -0
  289. package/native-host/host.mjs +195 -0
  290. package/package.json +91 -4
  291. package/skills/sap-gui-cli/SKILL.md +137 -0
  292. package/skills/sap-gui-drive/SKILL.md +101 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,250 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are listed here. The project follows
4
+ [Semantic Versioning](https://semver.org); before 1.0, a minor version may
5
+ change the tools or the view format.
6
+
7
+ ## Unreleased
8
+
9
+ Preparing the first public release.
10
+
11
+ ### Security
12
+
13
+ - A Fiori app sent as an okcode (`#SalesOrder-manage`,
14
+ `/n#SalesOrder-manage`) now meets `SAP_ALLOW_TCODES` and
15
+ `SAP_BLOCK_TCODES`, as `open` does.
16
+ - The active session stays where it is when its surface fails one
17
+ discovery; before, the next call without a session named could run in
18
+ another tab, on another system.
19
+ - Code tools refuse `\u` escapes outside strings, and `test.use` can no
20
+ longer set `onConfirm`, `allowLogoff`, `allowSystems` or `env`.
21
+ - The extension relay answers a malformed request path with 400 instead
22
+ of ending the server, and takes only small frames before pairing.
23
+ - The DIAG router no longer ends the server when SAP GUI resets its
24
+ connection while the onward one is being dialled.
25
+ - `SAP_ALLOW_TCODES`, `SAP_BLOCK_TCODES` and `SAP_ALLOW_SYSTEMS` refuse
26
+ entries that match nothing (`SE*`, `/nSE38`) when the server starts.
27
+ - A session reference such as `ABA` that fits several sessions is an
28
+ error listing them, unless the active session is one of them.
29
+ - A confirmed write does not run when another call acted in the session
30
+ while the user was asked; a queued `sap_act` keeps to its session when
31
+ `sap_use` runs meanwhile; a new logon in the same SAP GUI session slot
32
+ starts without what the server kept for the old one.
33
+
34
+ ### For agents
35
+
36
+ - The server names itself (title, description, website) when a client
37
+ connects.
38
+ - `destructiveHint` on `sap_act`, `sap_replay` and `sap_code_test` is
39
+ false with `SAP_WRITE=off` and `SAP_ALLOW_LOGOFF` off, so clients that
40
+ ask before every destructive call stop asking on each navigation.
41
+ - Arguments that do not fit a tool's schema are answered in plain words;
42
+ `sap_record` accepts `do` for `op`; `sap_look` and `sap_act` are marked
43
+ to load up front in Claude Code.
44
+ - A batch reports progress per action and stops when the client cancels.
45
+ - Batch-step fields (`expect`, `show`, `unseen`) on a single action are
46
+ refused instead of ignored.
47
+ - `AGENTS.md`; the docs add the server under one name,
48
+ `sap-ui-automation`, everywhere.
49
+
50
+ ### Documentation
51
+
52
+ - A documentation site in `docs/` (VitePress): getting started, concepts,
53
+ guides per surface, reference, security and data handling. It loads
54
+ nothing from other sites. The same markdown ships in the npm package, so
55
+ agents can read it offline.
56
+ - `CONTRIBUTING.md` describes the surface abstraction and how to add a
57
+ surface; `SECURITY.md` has a threat model and a data-handling statement.
58
+ - `examples/`: MCP client configurations, prompts for common tasks, and a
59
+ synthetic recorded test to replay and export.
60
+
61
+ ### Install
62
+
63
+ - A Claude Desktop extension (`.mcpb`), built with `bun run build:mcpb` and
64
+ attached to each release.
65
+ - Install docs with copy-paste snippets and install links for Cursor,
66
+ VS Code, Windsurf and Codex.
67
+
68
+ ### Fixes
69
+
70
+ - `sap-gui test` loads `sap.config.ts` and `*.sap.ts` as ES modules in a
71
+ project whose `package.json` says `"type": "commonjs"` (what `npm init`
72
+ writes). It used to fail with "Cannot use import statement outside a
73
+ module".
74
+ - `init` creates a `.gitignore` in a git project that has none, so traces
75
+ and results, which hold screens of business data, are not committed.
76
+ - zod 4.6.7 (GHSA-mrhx-c7xc-m3w5).
77
+ - With `SAP_WRITE=off`, changing or choosing a list layout (`&OL0`, `&OAD`,
78
+ Settings > Layout) and further selection criteria or dynamic selections
79
+ navigate instead of being refused. Saving or deleting a layout is still a
80
+ write.
81
+ - A classic list's row range (`look` with `rows`) no longer reads a row twice
82
+ or loses one at a page boundary.
83
+ - With `SAP_WRITE=off`, BP's Open BP and the locator's Start, and OK in
84
+ Fiori's Adapt Filters dialog, navigate instead of being refused.
85
+ - Web GUI on S/4HANA reads dropdown cells of a table control (the Tax Code
86
+ column in MIRO).
87
+
88
+ ### Project
89
+
90
+ - CI runs on Linux, Windows and macOS with Node 22 and 24, checks what the
91
+ npm package holds, runs the built command on plain Node, sets up a fresh
92
+ project from the packed tarball (`init --yes`, `test --list`), and builds
93
+ the docs site.
94
+ - CodeQL and Dependabot.
95
+ - Releases are published from a tag only, by a workflow, with npm
96
+ provenance.
97
+ - Issue templates for bugs, features and new surfaces or transactions, each
98
+ asking that business data be removed first.
99
+
100
+ ## 0.1.0 (unreleased)
101
+
102
+ The first public version.
103
+
104
+ ### Surfaces
105
+
106
+ - **SAP GUI for Windows**, through SAP GUI scripting, driven from Windows
107
+ PowerShell (nothing else to install).
108
+ - **SAP GUI for HTML (Web GUI)** and **SAP Fiori** in Chrome. The server
109
+ starts the installed Google Chrome itself, with a profile of its own (the
110
+ SAP window), the first time the agent needs SAP: you log on there once,
111
+ and nothing has to be set up in Chrome. The window stays open between
112
+ agent sessions and is found again; `sap-ui-automation browser` opens it
113
+ by hand; `doctor` says whether it runs. `SAP_CHROME_PATH` names the
114
+ Chrome to start, `SAP_START_URL` the address a new window opens on.
115
+ - `SAP_BROWSER=attach` uses the browser you already work in instead
116
+ (Chrome or Edge, once remote debugging is allowed at `chrome://inspect`).
117
+ A DevTools endpoint named in `SAP_CHROME_CDP` wins over both.
118
+ - `SAP_BROWSER=extension` reaches your everyday Chrome through the **Agent
119
+ Connector for SAP Systems** extension (`extension/`) instead: no remote
120
+ debugging switch, only the tabs of the SAP systems registered in the
121
+ extension are shared. The extension is a list of your systems (name, Web
122
+ GUI or launchpad address, client, language, user) in SAP Fiori's Horizon
123
+ look, with its own mark (no SAP artwork): *Add This SAP Page* fills one in
124
+ from the current tab, *Log On* (or *Open*, *Show Tab*) opens it, and the
125
+ More menu edits, forgets the password or removes it. With a saved password
126
+ it logs on by itself, filling SAP's logon page like a password manager in
127
+ a new private tab, from an isolated script world, on the system's own host
128
+ only: the server and the agent never see the password. The agent gets
129
+ `sap_systems` and `sap_logon`; `sap_logon` answers each outcome with what
130
+ to ask the user (wrong password, locked user, new password needed, SAP's
131
+ question about other logons, an identity provider, SAP's error page,
132
+ paused, not registered, Chrome closed), never retries a refused password,
133
+ and never ends the user's other logons (only `otherLogons: "keep"`, after
134
+ the user said so). A tab that shows a password field is never shared with
135
+ the server. On macOS and Windows the server starts Chrome when it is
136
+ closed. `sap-ui-automation extension install` copies the extension and
137
+ installs its helper (a native messaging host): the extension pairs in one
138
+ click and keeps passwords only in the macOS Keychain, the Secret Service
139
+ or Windows DPAPI; `extension uninstall` removes it all. The link to the
140
+ server is a local WebSocket, paired with a code and encrypted (AES-GCM).
141
+ See `extension/PROTOCOL.md`, `extension/PRIVACY.md` and the design and
142
+ security review in `extension/REVIEW.md`.
143
+ - **SAP GUI without scripting (experimental)**: `SAP_GUI_METHOD=diag` reads
144
+ the screen from SAP GUI's DIAG traffic through a local SAProuter, and acts
145
+ with the keyboard and mouse (see below).
146
+ - Sessions are found by themselves; `sap_use` switches between them.
147
+
148
+ ### Tools
149
+
150
+ - `sap_sessions`, `sap_use`, `sap_look`, `sap_act`, `sap_screenshot`,
151
+ `sap_record`, `sap_replay`.
152
+ - One set of JSON actions on every surface: `set`, `press`, `key`,
153
+ `select`, `check`, `combo`, `okcode`, `f4`, `focus`, `dblclick`, `tree`,
154
+ `grid`, `toolbar`, `scroll` (and `click` on Fiori).
155
+
156
+ ### The view
157
+
158
+ - A compact text view with one line per control, SAP's ids shortened to
159
+ unique handles, labels paired with values, checkbox states, tree nodes,
160
+ ALV grid cells, table controls, classic lists and popups.
161
+ - After an action that leaves the session on the same screen, only what
162
+ changed (`SAP_VIEW=full` for the whole screen each time).
163
+ - Long lists: `scroll`, and `sap_look` with `id` and `rows` to read a range.
164
+ - An id that names several controls, or none, is refused with what the
165
+ screen holds; the server never picks the nearest match.
166
+
167
+ ### Safety
168
+
169
+ - Writes are off by default (`SAP_WRITE=off`); `confirm` asks the user
170
+ for each one through MCP elicitation, and refuses it when the client
171
+ cannot ask.
172
+ - Every action is classified as read, navigate or commit, failing closed.
173
+ - Allow and block lists for systems, transactions and browser origins.
174
+ - Never logs on, never types into password fields, never acts on a logon
175
+ screen.
176
+
177
+ ### Record and replay (prototype)
178
+
179
+ - `sap_replay` can resume at a failed step with a repair for that one step
180
+ (`from`, `repair`, `"format":"json"`): a few actions or a capture, carried
181
+ out under fixed rules (no added write, no leaving, no invented data, the
182
+ recorded checks still judge), with a proposed change to the test in the
183
+ result. The server calls no model.
184
+ - `sap_record` keeps a run as a test file; `sap_replay` and
185
+ `sap-ui-automation replay` run it again with no model.
186
+ - `export` writes a SAP Cloud ALM manual test case, a SAP GUI script (VBS),
187
+ a Playwright spec, or a Gherkin feature.
188
+
189
+ ### SAP GUI without scripting (DIAG method, experimental)
190
+
191
+ - **Reading.** The decoder is our own (MIT), its item types, ids and sizes
192
+ established from captured traffic. On the ECC screens captured while it
193
+ was built, the view held nearly all the texts and values that SAP GUI
194
+ scripting reads of the same screens, including ALV cells, tree nodes,
195
+ table-control columns and popup entries. Controls of an ended
196
+ transaction no longer show on the next one.
197
+ - **The view, as on the other surfaces.** The status bar is the `sbar` line,
198
+ so errors and warnings come first in an answer; greyed-out buttons, keys,
199
+ menus and tree nodes are marked, and `sap_look` with `id "mbar"` lists
200
+ every menu entry; empty read-only fields show as `NAME@col=""`; a value
201
+ typed with `set` shows as typed until SAP gets it with the next Enter,
202
+ and a field that then shows something else is reported.
203
+ - **Ids.** A field name, `{FCODE}` of a push button or tab, a toolbar
204
+ button or key by its text, `FIELD[n]` (the table's own row number, as the
205
+ view prints it; a row not on show is scrolled to, and nothing is done if
206
+ it does not come) or `@row,col`. Scripting cell ids `FIELD[col,row]`
207
+ count the row from the first row on show. Toolbar buttons and function
208
+ keys carry no function code in the traffic, so `{CODE}` does not name
209
+ them: the refusal lists the screen's keys.
210
+ - **Actions.** `okcode`, `key`, `set`, `press`, `click`, `dblclick`,
211
+ `select`, `check`, `focus` (fields), `f4` (fields), `combo`, vertical
212
+ `scroll`, `tree`, `grid`, `toolbar`, and `sap_look` with `id`, `rows` and
213
+ `cols`. Refused, with what to do instead: `focus`, `f4`, `set` or
214
+ `check` where their first click would press, tick or open something;
215
+ scrolling or reading other rows while typed values have not reached SAP;
216
+ sideways scrolling; a grid toolbar button named by part of its name;
217
+ input to a window that cannot be told apart without doubt from another
218
+ SAP GUI window. The guard judges the input sent: a click on a push button
219
+ or a box with a function code is rated as pressing it, a click on an
220
+ element the reader cannot classify as a write.
221
+ - **Waits.** An action ends when SAP has answered the request of its last
222
+ input, read from the traffic, not after a timer; `timing` says where the
223
+ time went. A lost or unreadable answer ends the wait with "session state
224
+ unknown", and the next `sap_look` recovers.
225
+ - **Record and replay.** Tests name controls the way the actions do and
226
+ record the method (a `diag` test is not replayed through scripting, nor
227
+ exported to VBS). Information popups are passed with their Enter key; a
228
+ recorded Enter on a popup that only informed is not sent when SAP does
229
+ not show it; the answer to a question is never skipped (the step fails);
230
+ a screen damaged in transit is never judged.
231
+ - **Robustness.** Lost or garbled bytes no longer blind the connection: the
232
+ decoder finds its place again (in linear time), and the view says when a
233
+ screen may miss parts or holds something it cannot read yet. Compressed
234
+ blocks over 64 MB are refused. The relay outlives a failing reader or
235
+ capture, closed connections are let go, router messages go to stderr,
236
+ and `doctor` reports what was lost or not read, and SNC (not readable).
237
+ - **Not verified live yet:** the actions, waits, cell sizes, window
238
+ matching and record/replay ran against synthetic traffic and captures
239
+ only, not against SAP GUI.
240
+
241
+ ### Command line
242
+
243
+ - `setup` adds the server to Claude Code, Codex and Claude Desktop;
244
+ `doctor` checks what the server can reach and says what to change;
245
+ `sessions` lists the SAP sessions found.
246
+
247
+ ### Also in the repository
248
+
249
+ - `skills/sap-gui-drive`, a skill for agents working in SAP screens, also
250
+ shipped in the npm package and as a Claude Code plugin.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Didro
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 all
13
+ 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 THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,168 @@
1
- # Temporary Holding Version
1
+ # SAP UI Automation
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Let an agent **see and drive the SAP screens you already have open**: SAP
4
+ GUI for Windows, SAP GUI for HTML (Web GUI) and SAP Fiori. An
5
+ [MCP](https://modelcontextprotocol.io) server for Claude, Codex, Cursor,
6
+ VS Code and any other MCP client.
7
+
8
+ - **Compact and complete.** One line per control, with SAP's own ids,
9
+ labels, values and whether they can be edited: about 0.5–4.5k tokens per
10
+ screen on real ECC and S/4 screens. After an action on the same screen,
11
+ only what changed.
12
+ - **Writes off by default.** Actions that may save to SAP are refused
13
+ unless you allow them, or asked about in your client first.
14
+ - **Your sessions, your authorisations.** It finds the sessions you have
15
+ open and works in them as you. The server never logs on by itself and
16
+ never sees a password: with the optional Chrome extension, the extension
17
+ logs on to the systems you registered in it and keeps their passwords to
18
+ itself ([Chrome](docs/guides/chrome.md#use-your-everyday-chrome-with-the-extension)).
19
+ - **Runs on your machine.** No telemetry, no hosted service. Screen content
20
+ goes only to your MCP client, and from there to the model provider you
21
+ chose.
22
+ - **Runs become tests.** Record what the agent did, replay it with no
23
+ model, export it.
24
+
25
+
26
+ ```
27
+ TRANSACTION VA01 PROGRAM SAPMV45A SCREEN 101 SYSTEM ABA (800)
28
+ WINDOW wnd[0] "Create Sales Order: Initial Screen"
29
+ btn[8] button Create with Reference (F8)
30
+ ctxtVBAK-AUART field Order Type = "OR" (edit)
31
+ ctxtVBAK-VKORG field Sales Organization = "" (edit)
32
+ ctxtVBAK-VTWEG field Distribution Channel = "" (edit)
33
+ ```
34
+
35
+ ## Install
36
+
37
+ [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=sap-ui-automation&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInNhcC11aS1hdXRvbWF0aW9uIl19%3D%3D)
38
+ [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_sap--ui--automation-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522sap-ui-automation%2522%252C%2522type%2522%253A%2522stdio%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522sap-ui-automation%2522%255D%257D)
39
+ [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_sap--ui--automation-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522sap-ui-automation%2522%252C%2522type%2522%253A%2522stdio%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522sap-ui-automation%2522%255D%257D)
40
+ [![Claude Desktop extension](https://img.shields.io/badge/Claude_Desktop-Download_.mcpb-D97757?style=flat-square&logo=claude&logoColor=white)](https://github.com/DidroAI/sap-ui-automation/releases/latest/download/sap-ui-automation.mcpb)
41
+
42
+ You need Node.js 22 or later (22.18 or later for TypeScript tests). Pick
43
+ your client:
44
+
45
+ **Claude Code**
46
+
47
+ ```sh
48
+ claude mcp add sap-ui-automation --scope user -- npx -y sap-ui-automation
49
+ ```
50
+
51
+ or, with the skill, as a plugin: `/plugin marketplace add DidroAI/sap-ui-automation`
52
+ then `/plugin install sap-ui-automation@sap-ui-automation`.
53
+
54
+ **Claude Desktop**: download `sap-ui-automation-<version>.mcpb` from the
55
+ [latest release](https://github.com/DidroAI/sap-ui-automation/releases/latest)
56
+ and open it, or add the JSON below to `claude_desktop_config.json`.
57
+
58
+ **Cursor** (`~/.cursor/mcp.json`), **Windsurf** and most other clients:
59
+
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "sap-ui-automation": { "command": "npx", "args": ["-y", "sap-ui-automation"] }
64
+ }
65
+ }
66
+ ```
67
+
68
+ **VS Code**
69
+
70
+ ```sh
71
+ code --add-mcp '{"name":"sap-ui-automation","type":"stdio","command":"npx","args":["-y","sap-ui-automation"]}'
72
+ ```
73
+
74
+ **Codex**: `codex mcp add sap-ui-automation -- npx -y sap-ui-automation`, or in `~/.codex/config.toml`:
75
+
76
+ ```toml
77
+ [mcp_servers.sap-ui-automation]
78
+ command = "npx"
79
+ args = ["-y", "sap-ui-automation"]
80
+ ```
81
+
82
+ Or let it configure the clients it finds (Claude Code, Codex, Claude
83
+ Desktop, Cursor, Windsurf, VS Code), then check what it can reach:
84
+
85
+ ```sh
86
+ npx -y sap-ui-automation setup
87
+ npx -y sap-ui-automation doctor
88
+ ```
89
+
90
+ **Gemini CLI, Copilot CLI, opencode, Goose, Cline and other MCP clients**:
91
+ the same command, `npx -y sap-ui-automation`, as a stdio server in the
92
+ client's MCP settings.
93
+
94
+ **Agents with a shell, without MCP**: the `sap-gui` CLI does the same work
95
+ from the command line (`sap-gui look`, `sap-gui act ...`), and skills teach
96
+ the agent to use it:
97
+
98
+ ```sh
99
+ npm install -g sap-ui-automation
100
+ sap-ui-automation install --skills --target all
101
+ ```
102
+
103
+ `sap-ui-automation init` sets a project up for tests: a config, an example
104
+ test, the skills and the MCP clients.
105
+
106
+ On Windows, some clients cannot start `npx` directly: use
107
+ `"command": "cmd", "args": ["/c", "npx", "-y", "sap-ui-automation"]`
108
+ (`setup` does this for you). One-click buttons, the Claude Code plugin and
109
+ every client: [Installation](docs/getting-started/installation.md).
110
+
111
+ These snippets are read-only: writes are refused. With `SAP_WRITE=confirm`
112
+ in the server's environment, Claude Code, VS Code and Codex ask you before
113
+ each write; other clients may not be able to ask, and then refuse the
114
+ write ([which clients can ask](docs/concepts/confirm-mode.md#which-clients-can-ask)).
115
+
116
+ Then open SAP and ask: *"Look at my SAP screen and tell me which fields are
117
+ required."*
118
+
119
+ ## What you need on the SAP side
120
+
121
+ | Surface | You need |
122
+ | --- | --- |
123
+ | SAP GUI for Windows | SAP GUI scripting enabled in SAP GUI and allowed on the system ([guide](docs/guides/sap-gui-windows.md)) |
124
+ | SAP GUI without scripting | Experimental network reader ([guide](docs/guides/network-reader.md)) |
125
+ | Web GUI and Fiori | Chrome or Edge with remote debugging allowed, logged on ([guide](docs/guides/chrome.md)) |
126
+
127
+ Web GUI and Fiori work from Windows, macOS and Linux.
128
+
129
+ ## Documentation
130
+
131
+ - [Getting started](docs/getting-started/index.md) and
132
+ [your first session](docs/getting-started/first-session.md)
133
+ - Concepts: [surfaces](docs/concepts/surfaces.md),
134
+ [the screen view](docs/concepts/screen-view.md),
135
+ [actions](docs/concepts/actions.md),
136
+ [safety model](docs/concepts/safety.md)
137
+ - Guides: [recording and replay](docs/guides/record-replay.md),
138
+ [writing tests](docs/guides/sdk-tests.md),
139
+ [CLI for coding agents](docs/guides/cli-for-agents.md)
140
+ - Reference: [tools](docs/reference/tools.md),
141
+ [actions](docs/reference/actions.md),
142
+ [configuration](docs/reference/configuration.md),
143
+ [CLI](docs/reference/cli.md)
144
+ - [Security and data handling](docs/security.md) ·
145
+ [FAQ and troubleshooting](docs/faq.md) ·
146
+ [Comparison](docs/comparison.md) ·
147
+ [Benchmarks](docs/benchmarks.md)
148
+
149
+ The same pages ship in the npm package under `docs/`, so an agent can read
150
+ them offline. The [`sap-gui-drive` skill](skills/sap-gui-drive/SKILL.md)
151
+ teaches an agent how SAP screens behave.
152
+
153
+ ## Status
154
+
155
+ 0.1.0, the first public version. It works on real systems, but parts are
156
+ young; each guide lists its limits. Contributions are welcome: see
157
+ [CONTRIBUTING.md](CONTRIBUTING.md) (the tests run without an SAP system).
158
+ Report security issues as described in [SECURITY.md](SECURITY.md).
159
+
160
+ ## Licence and trademarks
161
+
162
+ MIT, see [LICENSE](LICENSE).
163
+
164
+ This project is not affiliated with, endorsed by or sponsored by SAP SE.
165
+ SAP, SAP GUI, SAP Fiori, SAPUI5, SAP S/4HANA, ABAP and other SAP products
166
+ and services mentioned here are trademarks or registered trademarks of SAP
167
+ SE (or an SAP affiliate company) in Germany and other countries. All other
168
+ names are the property of their owners.
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Several actions in one `sap_act` call: `{"actions":[...]}`.
3
+ *
4
+ * An agent that sees a screen with six fields knows the six `set`s and the
5
+ * Enter that sends them. One call per action costs a model turn each; a batch
6
+ * costs one. What a batch must not do is go on blind: the ids the agent sent
7
+ * are the ids of the screen it saw. So after each action the server reads the
8
+ * screen and ends the batch, before the next action, when
9
+ *
10
+ * - a popup opened (it asks something the agent has not read), unless the
11
+ * next action's id is in that popup and it does not write (`goesOnAfter`);
12
+ * - the status bar shows an error, a warning or a termination;
13
+ * - the screen is another one (transaction, program or screen number), and
14
+ * the next action is not sure to belong there (`goesOnAfter` in server.ts:
15
+ * it goes on when the next action's id is on the new screen and it does
16
+ * not write);
17
+ * - the step's `expect` is not met;
18
+ * - SAP is still working on the step.
19
+ *
20
+ * A step says what it knows will happen with `expect`, and the batch goes on
21
+ * through it: `{"screen":"4001"}` (also `transaction`, `title`),
22
+ * `{"popup":true}`, `{"status":"W"}`; `{"screen":"*"}` is any screen. The server ends the batch too when an
23
+ * action fails, is refused or waits for the user's yes (server.ts): each
24
+ * action of a batch has its own guard decision, as if it were sent alone.
25
+ *
26
+ * This file is the part without a session: reading the batch, and the rules.
27
+ */
28
+ import { type NormalizedAction } from "./core/action.js";
29
+ import { type ParsedScreen } from "./record/screen.js";
30
+ /** The most actions one call runs. */
31
+ export declare const MAX_BATCH = 20;
32
+ /** What a step says the screen is like after it. */
33
+ export interface Expect {
34
+ /** The screen (dynpro) number, "4001"; leading zeros do not count. */
35
+ screen?: string;
36
+ transaction?: string;
37
+ /** Text the title of the window in front contains. */
38
+ title?: string;
39
+ /** A message type (S, I, W, E, A), or text the status bar's message contains. */
40
+ status?: string;
41
+ /** true: this step opens a popup. false: no popup is open after it. */
42
+ popup?: boolean;
43
+ }
44
+ export interface BatchStep {
45
+ /** The action's number in the list the agent sent, from 1 (a step that is not run leaves a gap). */
46
+ n: number;
47
+ action: NormalizedAction;
48
+ /** Said after the step's own line in the answer: the action after it did not run, and why. */
49
+ note?: string;
50
+ expect?: Expect;
51
+ /** The answer shows the screen after this step too, not only the last one. */
52
+ show: boolean;
53
+ /** This step may write on a screen the agent has not seen in this batch (see `unseenWrite`). */
54
+ unseen: boolean;
55
+ }
56
+ /** `expect` "*": any screen, transaction or title. */
57
+ export declare const ANY = "*";
58
+ /** What the answer says in place of an Enter that came right after an okcode. */
59
+ export declare const SKIPPED_ENTER = "(skipped Enter: okcode already submits)";
60
+ /** `{"do":"look"}`: not an action; agents send it for the screen after the step before it. */
61
+ export declare function isLook(raw: unknown): boolean;
62
+ /**
63
+ * The steps of a batch, each action normalised as `sap_act` normalises one.
64
+ * Any step that is not a valid action refuses the whole batch: nothing runs.
65
+ * An empty list is no steps: the server answers with the screen.
66
+ *
67
+ * Two habits of agents are taken as meant rather than refused:
68
+ * - `{"do":"look"}` asks for the screen after the step before it (`show`);
69
+ * - a bare Enter right after an okcode does not run: the okcode already
70
+ * submitted. Live, 110 batches sent both; 42 then hit an error status, and
71
+ * once the extra Enter went past VF01's first screen and billed the wrong
72
+ * document. The okcode's line says it was skipped.
73
+ */
74
+ export declare function parseBatch(input: unknown): BatchStep[];
75
+ /** Why a batch ends after a step. */
76
+ export interface Stop {
77
+ why: "popup" | "status" | "screen" | "expect" | "busy";
78
+ text: string;
79
+ }
80
+ /**
81
+ * Why the batch ends after this step, given the screen before and after it;
82
+ * undefined when the next action may run.
83
+ */
84
+ export declare function stopAfter(action: NormalizedAction, before: ParsedScreen, after: ParsedScreen, expect?: Expect): Stop | undefined;
85
+ /**
86
+ * An action's note with each id of a control in a window's user area cut to
87
+ * its last part, as the compact view names it: "set wnd[0]/usr/tabsTAXI/
88
+ * tabpT\01/ssubBODY:SAPMV45A:4400/.../ctxtRV45A-MABNR[1,0]" is "set
89
+ * ctxtRV45A-MABNR[1,0]" (ME21N: 7 such lines of 200 characters in one batch).
90
+ * A shell keeps the control it belongs to: "cntlGRID1/shell".
91
+ */
92
+ export declare function shortNote(note: string): string;
93
+ /**
94
+ * Is the control `id` on the screen `view` shows (compact or full)? A line's
95
+ * id is it, or ends with it after a "/"; a table cell counts by its column
96
+ * (any row). A Fiori control counts where its id stands in a line, as the
97
+ * compact view writes it ("#tail") or the full one ("id=<full id>"), sent
98
+ * with or without "#", as that tail or as a longer one (the driver finds a
99
+ * control by any tail of its id cut at "--" or "::"). Live 2026-11-23: a
100
+ * batch stopped after a tile press opened the app, though the next id
101
+ * ("SalesOrder-inner", sent without "#") was on it.
102
+ */
103
+ export declare function idOn(view: string, id: string): boolean;
104
+ /**
105
+ * The lines of the popup in front (from the last `WINDOW wnd[N]` line, N > 0),
106
+ * "" when no popup is open: where the next action of a batch must be for the
107
+ * batch to go on through a popup the step before opened (ME23N "Other
108
+ * Document" then the document number in its popup, live 2026-11-23).
109
+ */
110
+ export declare function popupPart(view: string): string;
111
+ /**
112
+ * Why a write must not run here, in a batch: the screen it would write on is
113
+ * not the one the agent saw when it sent the batch (a step's `expect` let the
114
+ * batch go on through a new screen or a popup). SAP raises no message for
115
+ * wrong but valid data (another customer, a zero price), so the stop rules
116
+ * cannot catch it: the agent sees the screen first, then sends the write, or
117
+ * says it knows that screen with "unseen": true on the step. Undefined when
118
+ * the write may run.
119
+ */
120
+ export declare function unseenWrite(step: BatchStep, start: ParsedScreen, now: ParsedScreen): string | undefined;
121
+ /**
122
+ * Why a write must not run: SAP is not on the screen the agent was last shown
123
+ * (another transaction, program or screen, or another number of popups). A
124
+ * step that ended "nothing was sent" while SAP moved on, a timer, another
125
+ * user of the session: the agent would write on a screen it decided nothing
126
+ * about (live 2026-11-20, a stale Web GUI answer led a press into VD03).
127
+ * Undefined when the write may run. The answer shows the screen, so sending
128
+ * the same action again after reading it runs.
129
+ */
130
+ export declare function staleWrite(seen: ParsedScreen, now: ParsedScreen): string | undefined;