@aryacode/dsh-engineering 0.4.4 → 0.4.6

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 (122) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +11 -8
  3. package/cordis.patch.yml +3 -2
  4. package/package.json +3 -2
  5. package/vendor/l5x/cip-worker.mjs +181 -0
  6. package/vendor/l5x/lib/core/params.d.ts +3 -1
  7. package/vendor/l5x/lib/core/params.js +4 -0
  8. package/vendor/l5x/lib/engine/cip-request.d.ts +85 -0
  9. package/vendor/l5x/lib/engine/cip-request.js +134 -0
  10. package/vendor/l5x/lib/engine/cip-transaction.d.ts +115 -0
  11. package/vendor/l5x/lib/engine/cip-transaction.js +185 -0
  12. package/vendor/l5x/lib/live.d.ts +5 -0
  13. package/vendor/l5x/lib/live.js +13 -2
  14. package/vendor/l5x/lib/tools/live.d.ts +17 -6
  15. package/vendor/l5x/lib/tools/live.js +177 -15
  16. package/vendor/optix/bridge/LICENSE +35 -0
  17. package/vendor/optix/bridge/StudioMCPBridge.cs +7022 -0
  18. package/vendor/optix/bridge/source.json +10 -0
  19. package/vendor/optix/icon.svg +13 -0
  20. package/vendor/optix/lib/index.js +1531 -0
  21. package/vendor/optix/lib/types/bridge.d.ts +77 -0
  22. package/vendor/optix/lib/types/index.d.ts +52 -0
  23. package/vendor/optix/lib/types/ocr.d.ts +46 -0
  24. package/vendor/optix/lib/types/operations.d.ts +42 -0
  25. package/vendor/optix/lib/types/preview.d.ts +33 -0
  26. package/vendor/optix/lib/types/templates.d.ts +18 -0
  27. package/vendor/optix/locale/en.json +6 -0
  28. package/vendor/optix/locale/zh.json +6 -0
  29. package/vendor/optix/templates/arya-optix-ipc/manifest.json +260 -0
  30. package/vendor/optix/templates/arya-optix-ipc/project/AryaNewHMIProject_IPC.optix +81 -0
  31. package/vendor/optix/templates/arya-optix-ipc/project/AryaNewHMIProject_IPC.optix.design +38 -0
  32. package/vendor/optix/templates/arya-optix-ipc/project/IDEVersion.txt +1 -0
  33. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Alarms/Alarms.yaml +3 -0
  34. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/AryaNewHMIProject_IPC.yaml +67 -0
  35. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/CommDrivers/CommDrivers.yaml +2 -0
  36. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Converters/Converters.yaml +2 -0
  37. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/DataStores/DataStores.yaml +2 -0
  38. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Loggers/Loggers.yaml +2 -0
  39. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/MQTT/MQTT.yaml +2 -0
  40. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Model/Model.yaml +2 -0
  41. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/NetLogic/NetLogic.yaml +28 -0
  42. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/OPC-UA/OPC-UA.yaml +2 -0
  43. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Recipes/Recipes.yaml +2 -0
  44. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Reports/Reports.yaml +2 -0
  45. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Retentivity/Retentivity.yaml +57 -0
  46. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Security/Groups/Groups.yaml +3 -0
  47. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Security/Roles/Roles.yaml +3 -0
  48. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Security/Security.yaml +7 -0
  49. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Security/Users/Users.yaml +3 -0
  50. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/System/System.yaml +2 -0
  51. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/Translations/Translations.yaml +16 -0
  52. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/UI/Keyboards/Keyboards.yaml +2 -0
  53. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/UI/Screens/Screens.yaml +2 -0
  54. package/vendor/optix/templates/arya-optix-ipc/project/Nodes/UI/UI.yaml +306 -0
  55. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/.vscode/launch.json +19 -0
  56. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/AryaNewHMIProject_IPC.code-workspace +10 -0
  57. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/AryaNewHMIProject_IPC.csproj +19 -0
  58. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/AryaNewHMIProject_IPC.references +172 -0
  59. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/AryaNewHMIProject_IPC.sln +21 -0
  60. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/Private/TypeConstants.cs +20 -0
  61. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/Private/UITypeDefinitions.cs +11 -0
  62. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/NetSolution/StudioMCPBridge.cs +4555 -0
  63. package/vendor/optix/templates/arya-optix-ipc/project/ProjectFiles/UserDefinedModule.xml +26 -0
  64. package/vendor/optix/templates/arya-optix-panel/manifest.json +411 -0
  65. package/vendor/optix/templates/arya-optix-panel/project/AryaNewHMIProject_OptixPanel.optix +97 -0
  66. package/vendor/optix/templates/arya-optix-panel/project/AryaNewHMIProject_OptixPanel.optix.design +38 -0
  67. package/vendor/optix/templates/arya-optix-panel/project/IDEVersion.txt +1 -0
  68. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Alarms/Alarms.yaml +3 -0
  69. package/vendor/optix/templates/arya-optix-panel/project/Nodes/AryaNewHMIProject_OptixPanel.yaml +67 -0
  70. package/vendor/optix/templates/arya-optix-panel/project/Nodes/CommDrivers/CommDrivers.yaml +2 -0
  71. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Converters/Converters.yaml +2 -0
  72. package/vendor/optix/templates/arya-optix-panel/project/Nodes/DataStores/DataStores.yaml +2 -0
  73. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Loggers/Loggers.yaml +2 -0
  74. package/vendor/optix/templates/arya-optix-panel/project/Nodes/MQTT/MQTT.yaml +2 -0
  75. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Model/Model.yaml +2 -0
  76. package/vendor/optix/templates/arya-optix-panel/project/Nodes/NetLogic/NetLogic.yaml +28 -0
  77. package/vendor/optix/templates/arya-optix-panel/project/Nodes/OPC-UA/OPC-UA.yaml +2 -0
  78. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Recipes/Recipes.yaml +2 -0
  79. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Reports/Reports.yaml +2 -0
  80. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Retentivity/Retentivity.yaml +57 -0
  81. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Security/Groups/Groups.yaml +3 -0
  82. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Security/Roles/Roles.yaml +3 -0
  83. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Security/Security.yaml +7 -0
  84. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Security/Users/Users.yaml +3 -0
  85. package/vendor/optix/templates/arya-optix-panel/project/Nodes/System/System.yaml +444 -0
  86. package/vendor/optix/templates/arya-optix-panel/project/Nodes/Translations/Translations.yaml +81 -0
  87. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/Keyboards/Keyboards.yaml +2 -0
  88. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/Screens/Screens.yaml +2 -0
  89. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/DeviceSettingsWidget/DeviceSettingsWidget.yaml +163 -0
  90. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/DeviceSettingsWidget/DeviceSettingsWidgetComponents/DeviceSettingsWidgetComponents.yaml +1663 -0
  91. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/FactoryTalkRemoteAccessWidget/FTRemoteAccessWidgetComponents/FTRemoteAccessWidgetComponents.yaml +2471 -0
  92. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/FactoryTalkRemoteAccessWidget/FactoryTalkRemoteAccessWidget.yaml +218 -0
  93. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/NetworkSettingsWidget/NetworkSettingsWidget.yaml +524 -0
  94. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/NetworkSettingsWidget/NetworkSettingsWidgetComponents/NetworkSettingsWidgetComponents.yaml +690 -0
  95. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/SettingsWidgets/SettingsWidgets.yaml +1265 -0
  96. package/vendor/optix/templates/arya-optix-panel/project/Nodes/UI/UI.yaml +308 -0
  97. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/.vscode/launch.json +19 -0
  98. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/ApplicationNameLogic.cs +19 -0
  99. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/AryaNewHMIProject_OptixPanel.code-workspace +10 -0
  100. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/AryaNewHMIProject_OptixPanel.csproj +19 -0
  101. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/AryaNewHMIProject_OptixPanel.references +172 -0
  102. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/AryaNewHMIProject_OptixPanel.sln +21 -0
  103. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/ConnectionSwitchLogic.cs +74 -0
  104. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/DateAndTimeWidgetLogic.cs +420 -0
  105. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/DeviceSettingsWidgetLogic.cs +34 -0
  106. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/FTOptixStudioVersionLogic.cs +47 -0
  107. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/FTRemoteAccessWidgetSetupLogic.cs +153 -0
  108. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/IncomingConnectionApprovalLogic.cs +118 -0
  109. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/IncomingConnectionReceiverLogic.cs +166 -0
  110. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/NetworkConfiguratorEditModelsLogic.cs +56 -0
  111. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/NetworkInterfaceLogic.cs +138 -0
  112. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/NetworkInterfacesEditModelReaderLogic.cs +87 -0
  113. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/NetworkInterfacesEditModelToSystemWriterLogic.cs +139 -0
  114. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/NetworkSettingsLogic.cs +168 -0
  115. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/Private/FTRemoteAccessWidgetDataObject.cs +106 -0
  116. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/Private/TypeConstants.cs +37 -0
  117. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/Private/UITypeDefinitions.cs +91 -0
  118. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/RequestAssistanceSwitchLogic.cs +93 -0
  119. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/StudioMCPBridge.cs +4555 -0
  120. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/NetSolution/SystemToNetworkInterfacesEditModelWriterLogic.cs +77 -0
  121. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/UserDefinedModule.xml +111 -0
  122. package/vendor/optix/templates/arya-optix-panel/project/ProjectFiles/WarningIcon.svg +4 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.6] - 2026-10-25
4
+
5
+ ### Added
6
+
7
+ The EtherNet/IP surface now uses the driver rather than one corner of it. Five new tools, all under the
8
+ L5X product row's `live` switch:
9
+
10
+ - `read_live_tags` — up to 64 declared scalars in **one** request (CIP tag group) instead of one
11
+ connection-and-read per tag.
12
+ - `read_controller_clock` — controller identity plus the wall clock beside the workstation clock and the
13
+ offset between them; reports "unsupported" on non-L8x models instead of guessing.
14
+ - `discover_controllers` — bounded UDP broadcast discovery: address, product, revision, serial, status.
15
+ Needs no address and no export.
16
+ - `write_live_tag` — one declared scalar, **approval-gated**, then read back over CIP so the result is
17
+ the controller's own value.
18
+ - `write_controller_clock` — set the wall clock (L8x), approval-gated, read back.
19
+
20
+ ### Safety
21
+
22
+ - Writes need **two** independent switches: the row's new `allowWrites` config (off by default) **and** a
23
+ human approving that exact operation. With `allowWrites` on and a `never` approval policy the tool
24
+ refuses with `APPROVAL_UNAVAILABLE`; a declined prompt is `APPROVAL_DENIED`. Nothing reaches a
25
+ controller before both pass.
26
+ - Every write validates against the open export first: declared, not an alias, no array dimensions,
27
+ `ExternalAccess` not `None`, value inside the declared type and range (BOOL boolean; INT/DINT integer
28
+ within range; REAL finite).
29
+ - A write whose readback differs from the requested value fails with `WRITE_NOT_VERIFIED` rather than
30
+ reporting success.
31
+ - `test/live.spec.ts` covers the gating: switch off, policy `never`, declined prompt, wrong value type,
32
+ and a UDT tag refused as non-scalar — 70 tests in the package.
33
+
34
+ ## [0.4.5] - 2026-10-25
35
+
36
+ ### Changed
37
+
38
+ - **FactoryTalk Optix is vendored, so `dependencies` carries no plugin at all.** The Optix tree
39
+ (`lib/`, `bridge/StudioMCPBridge.cs`, `templates/`, `locale/`, `icon.svg`) now lives in
40
+ `packages/optix` and ships under `vendor/optix`; the `optix` row names
41
+ `@aryacode/dsh-engineering/optix`. `@aryacode/dsh-tool-ft-optix` is gone from the manifest, which
42
+ leaves one plugin to install and no component package to publish, keep in sync, or retire.
43
+ - The last dependency that remains is Optix's own runtime library, `playwright-core@1.61.1`, declared
44
+ as a plain registry dependency.
45
+
46
+ One plugin now covers all four products: 5 rows, 79 tools, both previews, no component packages.
47
+
3
48
  ## [0.4.4] - 2026-10-25
4
49
 
5
50
  ### Changed
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  MotionWorks IEC and FactoryTalk Optix sit behind a single install, one row per surface. A row is the
5
5
  switch: disable it and that plugin unloads, so its tool schemas leave the request.
6
6
 
7
- `@aryacode/dsh-engineering` · 79 tools · 5 rows · 4 products · MIT
7
+ `@aryacode/dsh-engineering` · 84 tools · 5 rows · 4 products · MIT
8
8
 
9
9
  ---
10
10
 
@@ -21,7 +21,8 @@ the row, off by default, so a read-only profile pays for the read tools and noth
21
21
  |---|---|---|---|
22
22
  | `l5x` | `editing` | off | the nine `draft_*` schemas |
23
23
  | `l5x` | `studio` | off | the Logix Designer SDK and supervised controller schemas |
24
- | `l5x` | `live` | off | the EtherNet/IP polling and trend schemas |
24
+ | `l5x` | `live` | off | the EtherNet/IP read, batch, discovery, clock and trend schemas |
25
+ | `l5x` | `allowWrites` | off | the two approval-gated writes (tag, wall clock) |
25
26
  | `ftview` | `edit`, `studio` | on | staged ME edits and the Studio handoff |
26
27
  | `mwi` | `edit` | off | the seven MotionWorks edit schemas |
27
28
 
@@ -33,7 +34,7 @@ bundle.
33
34
 
34
35
  | Product | Tools | Default | Needs |
35
36
  |---|---|---|---|
36
- | **Studio 5000 L5X** | 35 | read on; edit, Studio, live **off** | Node for offline reads; Studio 5000 + Logix Designer SDK for SDK work; a controller for live |
37
+ | **Studio 5000 L5X** | 40 | read on; edit, Studio, live **off** | Node for offline reads; Studio 5000 + Logix Designer SDK for SDK work; a controller for live |
37
38
  | **FactoryTalk View ME** | 14 | all on | Node for an export folder; FactoryTalk View Studio ME for discovery and the handoff |
38
39
  | **MotionWorks IEC** | 24 | session, read, verify on; edit **off** | MotionWorks IEC 3 Pro installed; verified against 1.19 |
39
40
  | **FactoryTalk Optix** | 6 | on | Optix Studio installed |
@@ -41,7 +42,7 @@ bundle.
41
42
  Tool groups, by product:
42
43
 
43
44
  - **L5X** — 11 read (`open_project` … `compare_projects`), 9 staged drafts (`draft_*`), 6 Logix
44
- Designer SDK, 7 supervised controller, 2 live EtherNet/IP
45
+ Designer SDK, 7 supervised controller, 7 live EtherNet/IP (2 reads, 2 identity/discovery, 1 batch read, 2 approval-gated writes)
45
46
  - **FactoryTalk View** — 6 read, 5 staged edits, 3 Studio handoff
46
47
  - **MotionWorks IEC** — 7 session, 7 saved-project reads, 3 verify, 7 staged edits
47
48
  - **Optix** — 6 tools, unlinked to a skill until one exists
@@ -55,7 +56,7 @@ down:
55
56
 
56
57
  | Row | Mounts | Config options (default) |
57
58
  |---|---|---|
58
- | `l5x` | offline reads, checks, comparison and the `rockwell-l5x` guidance; optionally drafts, SDK, live | `editing` (off), `studio` (off), `live` (off) |
59
+ | `l5x` | offline reads, checks, comparison and the `rockwell-l5x` guidance; optionally drafts, SDK, live (reads, batch, discovery, clock) and supervised writes | `editing` (off), `studio` (off), `live` (off), `allowWrites` (off) |
59
60
  | `ftview` | FactoryTalk View ME read, guidance and edits; optionally the Studio handoff | `edit` (on), `studio` (on) |
60
61
  | `mwi` | MotionWorks IEC session, reads, verify and guidance; optionally the edits | `edit` (off) |
61
62
  | `viewers` | ladder + ME display previews | — |
@@ -86,19 +87,20 @@ Where each surface actually stands, based on what has been exercised.
86
87
  - Logix Designer SDK: a real ACD exported to a 3.0 MB L5X against SDK v37
87
88
  - Supervised controller access — upload, mode change and download behind per-call approval, with
88
89
  downloads accepting only a verification id produced by a passed build
89
- - Live EtherNet/IP reads and a bounded PLC trend
90
+ - Live EtherNet/IP: polling, one-request batch reads of up to 64 tags, controller identity and clock, LAN discovery, and a bounded trend
91
+ - Supervised live writes: `write_live_tag` and `write_controller_clock` need the row's `allowWrites` switch **and** per-call human approval, and report the value the controller reads back
90
92
  - FactoryTalk View ME: export reads, structural checks, comparison, staged display and HMI tag edits
91
93
  - MotionWorks IEC: verified live against 3 Pro 1.19 — stage, start, worksheet, close, saved-project
92
94
  reads, compile diagnostics, code replacement, declaration add, POU create/delete, block insertion
93
95
  and a POU package export/delete/import round trip
94
96
  - Ladder viewer and FactoryTalk View display preview
95
97
 
96
- **Deliberately off by default** — enabled per profile: `l5x-editing`, `l5x-studio`, `l5x-live`,
98
+ **Deliberately off by default** — enabled per profile: `l5x-editing`, `l5x-studio`, `l5x-live`, `allowWrites`,
97
99
  `mwi-edit`. A read-only profile should not pay for nine draft schemas or a controller surface.
98
100
 
99
101
  **Known limits** — stated in the bundle, not hidden:
100
102
 
101
- - Live reads and SDK builds cannot establish that online logic matches the export; every result says
103
+ - Live reads, SDK builds and live writes cannot establish that online logic matches the export; every result says
102
104
  so in `coverage`
103
105
  - FBD/SFC semantics are not exercised
104
106
  - FactoryTalk View Studio work is a **manual handoff**: the bundle plans the import and preflights
@@ -113,6 +115,7 @@ Where each surface actually stands, based on what has been exercised.
113
115
  |---|---|
114
116
  | **0.4.4** | One row per product: five rows, optional surfaces moved into each row's config |
115
117
  | **0.4.0** | Both previews fold into the bundle's own client face — one package, one browser bundle, 16 rows |
118
+ | **0.4.6** | Full EtherNet/IP surface: batch reads, discovery, controller clock, and approval-gated tag and clock writes; 84 tools |
116
119
  | **0.3.0** | FactoryTalk Optix becomes a bundle component; 79 tools total |
117
120
  | **0.2.0** | MotionWorks IEC ports into the bundle — 24 tools over the COM bridge and saved-model engine, verified live; edit off by default |
118
121
  | **0.1.2** | Harness filesystem contract fixed across L5X and FactoryTalk View; every L5X tool linked to its capability by name; generated tool reference, examples and architecture docs |
package/cordis.patch.yml CHANGED
@@ -37,6 +37,7 @@
37
37
  # context, so this row is independent of every product row above.
38
38
  - id: viewers
39
39
  name: '@aryacode/dsh-engineering'
40
- # FactoryTalk Optix stays a separate package, mounted as a component row.
40
+ # FactoryTalk Optix: vendored like the other three products, so one install
41
+ # carries every surface and no component package is a dependency.
41
42
  - id: optix
42
- name: '@aryacode/dsh-tool-ft-optix'
43
+ name: '@aryacode/dsh-engineering/optix'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aryacode/dsh-engineering",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "AryaCode engineering bundle: one install surface for the Studio 5000 L5X, FactoryTalk View ME, MotionWorks IEC and FactoryTalk Optix surfaces, one row per product, with the ladder and display previews.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -56,9 +56,9 @@
56
56
  }
57
57
  },
58
58
  "dependencies": {
59
- "@aryacode/dsh-tool-ft-optix": "0.2.1-rc.3",
60
59
  "fast-xml-parser": "5.11.1",
61
60
  "fast-xml-validator": "1.4.2",
61
+ "playwright-core": "1.61.1",
62
62
  "st-ethernet-ip": "2.7.5"
63
63
  },
64
64
  "peerDependencies": {
@@ -79,6 +79,7 @@
79
79
  "./l5x": "./entries/l5x.js",
80
80
  "./ftview": "./entries/ftview.js",
81
81
  "./mwi": "./entries/mwi.js",
82
+ "./optix": "./vendor/optix/lib/index.js",
82
83
  "./l5x/read": "./vendor/l5x/lib/index.js",
83
84
  "./l5x/skill": "./vendor/l5x/lib/skill.js",
84
85
  "./l5x/editing": "./vendor/l5x/lib/editing.js",
@@ -0,0 +1,181 @@
1
+ /** Isolated one-shot EtherNet/IP transactions. The parent owns deadlines, approval and validation. */
2
+ import { isMainThread, parentPort, workerData } from 'node:worker_threads'
3
+ import { setTimeout as delay } from 'node:timers/promises'
4
+ import ethernetIp from 'st-ethernet-ip'
5
+ import { isIPv4 } from 'node:net'
6
+
7
+ /** Shape one tag address for output. */
8
+ function addressOf(entry) {
9
+ return entry.program === undefined ? entry.name : `Program:${entry.program}.${entry.name}`
10
+ }
11
+
12
+ /** One observed value, quality included. */
13
+ function readValue(entry, tag) {
14
+ const typeMatches = tag.type === entry.data_type
15
+ const scalar = typeof tag.value === 'boolean' || (typeof tag.value === 'number' && Number.isFinite(tag.value))
16
+ return {
17
+ tag: addressOf(entry),
18
+ data_type: entry.data_type,
19
+ actual_data_type: tag.type,
20
+ value: typeMatches && scalar ? tag.value : null,
21
+ quality: typeMatches && scalar ? 'good' : 'bad',
22
+ ...typeMatches && scalar ? {} : { error: 'Live type or value differs from the export declaration' },
23
+ }
24
+ }
25
+
26
+ /**
27
+ * Open a controller, run one operation, and always close the connection.
28
+ *
29
+ * @param {object} spec Validated worker request.
30
+ * @returns {Promise<object>} The operation's result value.
31
+ */
32
+ async function connectAndRun(spec, run) {
33
+ if (!spec || typeof spec.ip !== 'string' || !isIPv4(spec.ip) || !Number.isInteger(spec.slot) || spec.slot < 0 || spec.slot > 31
34
+ || !Number.isInteger(spec.timeout) || spec.timeout < 1)
35
+ throw new Error('Invalid CIP worker request')
36
+ const plc = new ethernetIp.Controller(false)
37
+ plc.timeout_sp = spec.timeout
38
+ // Driver transport failures are reported per request; keep the socket event handled.
39
+ plc.on('error', error => { void error })
40
+ try {
41
+ await plc.connect(spec.ip, spec.slot, false)
42
+ await plc.readControllerProps()
43
+ const controller = {
44
+ product_name: plc.properties.name,
45
+ serial_number: plc.properties.serial_number,
46
+ revision: plc.properties.version,
47
+ status: plc.properties.status,
48
+ }
49
+ return await run(plc, controller)
50
+ } finally {
51
+ // Unconnected explicit messaging needs no Forward Close request.
52
+ const closed = new Promise(resolve => plc.once('close', resolve))
53
+ if (!plc.closed) { if (!plc.destroyed) plc.destroy(); await closed }
54
+ }
55
+ }
56
+
57
+ /** Batch read: one explicit request carries every tag in the group. */
58
+ async function read(spec) {
59
+ return await connectAndRun(spec, async (plc, controller) => {
60
+ const group = new ethernetIp.TagGroup()
61
+ const tags = spec.tags.map(entry => {
62
+ if (!entry || typeof entry.name !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/u.test(entry.name)
63
+ || !['BOOL', 'INT', 'DINT', 'REAL'].includes(entry.data_type)
64
+ || (entry.program !== undefined && (typeof entry.program !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/u.test(entry.program))))
65
+ throw new Error('Invalid CIP worker tag')
66
+ const tag = new ethernetIp.Tag(entry.name, entry.program)
67
+ group.add(tag)
68
+ return { entry, tag }
69
+ })
70
+ await plc.readTagGroup(group)
71
+ return {
72
+ controller,
73
+ request_count: 1,
74
+ observed_at: new Date().toISOString(),
75
+ values: tags.map(({ entry, tag }) => ({ ...readValue(entry, tag), observed_at: new Date().toISOString() })),
76
+ }
77
+ })
78
+ }
79
+
80
+ /** Identity and wall clock; the clock exists only on L8x controllers. */
81
+ async function clock(spec) {
82
+ return await connectAndRun(spec, async (plc, controller) => {
83
+ try {
84
+ await plc.readWallClock()
85
+ return {
86
+ controller,
87
+ supported: true,
88
+ controller_time: plc.properties.time instanceof Date ? plc.properties.time.toISOString() : String(plc.properties.time),
89
+ host_time: new Date().toISOString(),
90
+ }
91
+ } catch (error) {
92
+ return {
93
+ controller,
94
+ supported: false,
95
+ host_time: new Date().toISOString(),
96
+ reason: error instanceof Error ? error.message : 'Wall clock is unavailable on this controller',
97
+ }
98
+ }
99
+ })
100
+ }
101
+
102
+ /** One tag write, read back over CIP so the result is the controller's answer. */
103
+ async function write(spec) {
104
+ return await connectAndRun(spec, async (plc) => {
105
+ const entry = spec.tag
106
+ const tag = new ethernetIp.Tag(entry.name, entry.program)
107
+ // Read first: the driver needs the controller's own type to encode the write.
108
+ await plc.readTag(tag)
109
+ const before = tag.value
110
+ const actualType = tag.type
111
+ tag.value = spec.value
112
+ await plc.writeTag(tag)
113
+ await plc.readTag(tag)
114
+ const readback = tag.value
115
+ return {
116
+ tag: addressOf(entry),
117
+ declared_data_type: entry.data_type,
118
+ actual_data_type: actualType,
119
+ previous_value: before,
120
+ requested_value: spec.value,
121
+ readback,
122
+ verified: Object.is(readback, spec.value) || (typeof readback === 'number' && typeof spec.value === 'number' && Math.abs(readback - spec.value) < 1e-6),
123
+ written_at: new Date().toISOString(),
124
+ }
125
+ })
126
+ }
127
+
128
+ /** Set the wall clock; L8x only, and read back to prove it landed. */
129
+ async function writeClock(spec) {
130
+ return await connectAndRun(spec, async (plc) => {
131
+ const target = new Date(spec.iso)
132
+ if (Number.isNaN(target.getTime())) throw new Error('Invalid wall clock timestamp')
133
+ await plc.writeWallClock(target)
134
+ await plc.readWallClock()
135
+ const readback = plc.properties.time instanceof Date ? plc.properties.time.toISOString() : String(plc.properties.time)
136
+ return { requested_time: target.toISOString(), readback, verified: Math.abs(Date.parse(readback) - target.getTime()) < 2000 }
137
+ })
138
+ }
139
+
140
+ /** UDP broadcast discovery: where are the controllers on this LAN. */
141
+ async function discover(spec) {
142
+ const browser = new ethernetIp.Browser()
143
+ const devices = new Map()
144
+ browser.on('Device List Updated', list => {
145
+ for (const device of list) {
146
+ const address = device?.socketAddress?.sin_addr
147
+ if (typeof address === 'string') devices.set(address, device)
148
+ }
149
+ })
150
+ browser.on('error', error => { void error })
151
+ try {
152
+ browser.start()
153
+ await delay(spec.duration)
154
+ } finally {
155
+ browser.stop()
156
+ }
157
+ return {
158
+ seconds: spec.duration / 1000,
159
+ devices: [...devices.entries()].map(([ip, device]) => ({
160
+ ip_address: ip,
161
+ product_name: String(device.productName ?? ''),
162
+ revision: String(device.revision ?? ''),
163
+ serial_number: String(device.serialNumber ?? ''),
164
+ vendor_id: Number(device.vendorID ?? 0),
165
+ device_type: Number(device.deviceType ?? 0),
166
+ status: Number(device.status ?? 0),
167
+ })),
168
+ }
169
+ }
170
+
171
+ const OPERATIONS = { read, clock, write, 'write-clock': writeClock, discover }
172
+
173
+ if (!isMainThread) {
174
+ try {
175
+ const operation = OPERATIONS[workerData?.op]
176
+ if (operation === undefined) throw new Error('Unknown CIP worker operation')
177
+ parentPort.postMessage({ ok: true, value: await operation(workerData) })
178
+ } catch (error) {
179
+ parentPort.postMessage({ ok: false, message: error instanceof Error ? error.message : 'Controller transaction failed' })
180
+ } finally { parentPort.close() }
181
+ }
@@ -9,7 +9,7 @@
9
9
  */
10
10
  /** One JSON Schema property, with the description that is mandatory here. */
11
11
  export interface ParameterSchema {
12
- readonly type: 'string' | 'integer' | 'number' | 'boolean' | 'array' | 'object';
12
+ readonly type: 'string' | 'integer' | 'number' | 'boolean' | 'array' | 'object' | readonly ('string' | 'integer' | 'number' | 'boolean')[];
13
13
  readonly description: string;
14
14
  readonly enum?: readonly string[];
15
15
  readonly items?: ParameterSchema;
@@ -28,6 +28,8 @@ export declare function string(description: string, extra?: Partial<ParameterSch
28
28
  export declare function integer(description: string, extra?: Partial<ParameterSchema>): ParameterSchema;
29
29
  /** A string parameter restricted to a known set. */
30
30
  export declare function choice(description: string, values: readonly string[], extra?: Partial<ParameterSchema>): ParameterSchema;
31
+ /** A boolean-or-number parameter, for a value whose real type comes from the project. */
32
+ export declare function scalar(description: string, extra?: Partial<ParameterSchema>): ParameterSchema;
31
33
  /** An array of one parameter type. */
32
34
  export declare function list(description: string, items: ParameterSchema, extra?: Partial<ParameterSchema>): ParameterSchema;
33
35
  /** One object element of an array parameter. */
@@ -19,6 +19,10 @@ export function integer(description, extra = {}) {
19
19
  export function choice(description, values, extra = {}) {
20
20
  return { type: 'string', description, enum: values, ...extra };
21
21
  }
22
+ /** A boolean-or-number parameter, for a value whose real type comes from the project. */
23
+ export function scalar(description, extra = {}) {
24
+ return { type: ['boolean', 'number'], description, ...extra };
25
+ }
22
26
  /** An array of one parameter type. */
23
27
  export function list(description, items, extra = {}) {
24
28
  return { type: 'array', description, items, ...extra };
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Validation for one-shot controller transactions.
3
+ *
4
+ * Nothing here opens a socket. Every argument is resolved against the open
5
+ * export first, so a mistyped tag, an alias, an array or a type-mismatched write
6
+ * is refused before the controller is contacted.
7
+ *
8
+ * @module dsh-engineering-l5x/engine/cip-request
9
+ */
10
+ import { type ProjectSnapshot } from '../session.ts';
11
+ import type { PollingConfig } from './direct-polling.ts';
12
+ /** Scalar types this surface can read and write. */
13
+ declare const SCALARS: readonly ["BOOL", "INT", "DINT", "REAL"];
14
+ type Scalar = (typeof SCALARS)[number];
15
+ /** One resolved scalar address. */
16
+ export interface ScalarTag {
17
+ name: string;
18
+ program?: string;
19
+ data_type: Scalar;
20
+ }
21
+ /**
22
+ * Resolve the controller address and slot both read and write share.
23
+ * @param input - Tool arguments.
24
+ * @param config - Resolved deployment limits.
25
+ * @returns The validated target.
26
+ */
27
+ export declare function controllerTarget(input: Readonly<Record<string, unknown>>, config: PollingConfig): {
28
+ ip: string;
29
+ slot: number;
30
+ timeout: number;
31
+ };
32
+ /**
33
+ * Resolve declared scalar tags for a batch read, then bound the batch.
34
+ * @param project - Fresh export snapshot.
35
+ * @param input - Tool arguments carrying `tags`.
36
+ * @param config - Resolved deployment limits.
37
+ * @param maxBatch - Largest accepted batch.
38
+ * @returns Worker request and operand evidence.
39
+ */
40
+ export declare function batchReadRequest(project: ProjectSnapshot, input: Readonly<Record<string, unknown>>, config: PollingConfig, maxBatch: number): {
41
+ request: {
42
+ tags: ScalarTag[];
43
+ ip: string;
44
+ slot: number;
45
+ timeout: number;
46
+ op: string;
47
+ };
48
+ evidence: {
49
+ tag: string;
50
+ scope: string;
51
+ references: import("./analysis.ts").Evidence[];
52
+ reference_completeness: string;
53
+ }[];
54
+ };
55
+ /**
56
+ * Resolve one writable scalar and check the value against its declared type.
57
+ * @param project - Fresh export snapshot.
58
+ * @param input - Tool arguments carrying `name`, optional `program`, and `value`.
59
+ * @param config - Resolved deployment limits.
60
+ * @returns The validated worker request.
61
+ */
62
+ export declare function writableTagRequest(project: ProjectSnapshot, input: Readonly<Record<string, unknown>>, config: PollingConfig): {
63
+ request: {
64
+ tag: ScalarTag;
65
+ value: number | boolean;
66
+ ip: string;
67
+ slot: number;
68
+ timeout: number;
69
+ op: string;
70
+ };
71
+ };
72
+ /**
73
+ * Bound a discovery window.
74
+ * @param input - Tool arguments carrying optional `duration_seconds`.
75
+ * @param config - Resolved deployment limits.
76
+ * @returns Worker request with the window in milliseconds.
77
+ */
78
+ export declare function discoverRequest(input: Readonly<Record<string, unknown>>, config: PollingConfig): {
79
+ request: {
80
+ op: string;
81
+ duration: number;
82
+ timeout: number;
83
+ };
84
+ };
85
+ export {};
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Validation for one-shot controller transactions.
3
+ *
4
+ * Nothing here opens a socket. Every argument is resolved against the open
5
+ * export first, so a mistyped tag, an alias, an array or a type-mismatched write
6
+ * is refused before the controller is contacted.
7
+ *
8
+ * @module dsh-engineering-l5x/engine/cip-request
9
+ */
10
+ import { isIPv4 } from 'node:net';
11
+ import { EngineeringError } from "../session.js";
12
+ import { aliasesOf } from "./configuration.js";
13
+ import { findReferences } from "./analysis.js";
14
+ import { controllerElementOf } from "../model/parse.js";
15
+ import { elementChildren, firstChild } from "../model/xml.js";
16
+ /** Scalar types this surface can read and write. */
17
+ const SCALARS = ['BOOL', 'INT', 'DINT', 'REAL'];
18
+ /** Integer ranges enforced before a write leaves the machine. */
19
+ const RANGES = { INT: [-32768, 32767], DINT: [-2147483648, 2147483647] };
20
+ const isScalar = (value) => typeof value === 'string' && SCALARS.includes(value);
21
+ /**
22
+ * Resolve the controller address and slot both read and write share.
23
+ * @param input - Tool arguments.
24
+ * @param config - Resolved deployment limits.
25
+ * @returns The validated target.
26
+ */
27
+ export function controllerTarget(input, config) {
28
+ if (!config.enabled)
29
+ throw new EngineeringError('DIRECT_POLLING_DISABLED', 'Enable directPollingEnabled to use SDK-independent reads');
30
+ const ip = input.ip_address;
31
+ if (typeof ip !== 'string' || !isIPv4(ip) || (config.allowedAddresses.length > 0 && !config.allowedAddresses.includes(ip)))
32
+ throw new EngineeringError('INVALID_CONTROLLER', 'Select an explicit IPv4 address allowed by this profile');
33
+ const slot = input.slot ?? 0;
34
+ if (typeof slot !== 'number' || !Number.isInteger(slot) || slot < 0 || slot > 31)
35
+ throw new EngineeringError('INVALID_POLL', 'slot must be an integer between 0 and 31');
36
+ return { ip, slot, timeout: config.requestTimeoutMs };
37
+ }
38
+ /**
39
+ * Resolve declared scalar tags for a batch read, then bound the batch.
40
+ * @param project - Fresh export snapshot.
41
+ * @param input - Tool arguments carrying `tags`.
42
+ * @param config - Resolved deployment limits.
43
+ * @param maxBatch - Largest accepted batch.
44
+ * @returns Worker request and operand evidence.
45
+ */
46
+ export function batchReadRequest(project, input, config, maxBatch) {
47
+ const target = controllerTarget(input, config);
48
+ const raw = typeof input.tags_json === 'string' ? JSON.parse(input.tags_json) : null;
49
+ if (!Array.isArray(raw) || raw.length < 1 || raw.length > maxBatch)
50
+ throw new EngineeringError('INVALID_POLL', `tags must contain 1 through ${String(maxBatch)} declared scalar tags`);
51
+ const tags = raw.map((entry) => resolveScalar(project, entry));
52
+ const seen = new Set();
53
+ for (const tag of tags) {
54
+ const key = `${tag.program ?? 'controller'}::${tag.name}`.toLowerCase();
55
+ if (seen.has(key))
56
+ throw new EngineeringError('INVALID_POLL', 'Duplicate tag in the batch');
57
+ seen.add(key);
58
+ }
59
+ return {
60
+ request: { op: 'read', ...target, tags },
61
+ evidence: tags.map(tag => ({
62
+ tag: tag.name,
63
+ scope: tag.program ?? 'controller',
64
+ references: findReferences(project, tag.name)
65
+ .filter(reference => reference.resolved?.toLowerCase() === `${tag.program ?? 'controller'}::${tag.name}`.toLowerCase()),
66
+ reference_completeness: 'static_partial',
67
+ })),
68
+ };
69
+ }
70
+ /**
71
+ * Resolve one writable scalar and check the value against its declared type.
72
+ * @param project - Fresh export snapshot.
73
+ * @param input - Tool arguments carrying `name`, optional `program`, and `value`.
74
+ * @param config - Resolved deployment limits.
75
+ * @returns The validated worker request.
76
+ */
77
+ export function writableTagRequest(project, input, config) {
78
+ const target = controllerTarget(input, config);
79
+ const name = input.name;
80
+ const program = input.program;
81
+ const tag = resolveScalar(project, { name, ...(program === undefined ? {} : { scope: program }) });
82
+ const value = input.value;
83
+ if (tag.data_type === 'BOOL') {
84
+ if (typeof value !== 'boolean')
85
+ throw new EngineeringError('INVALID_WRITE', `${tag.name} is BOOL; value must be true or false`, 'Pass value: true or value: false.');
86
+ }
87
+ else if (typeof value !== 'number' || !Number.isFinite(value)) {
88
+ throw new EngineeringError('INVALID_WRITE', `${tag.name} is ${tag.data_type}; value must be a finite number`, 'Pass a number for INT, DINT or REAL.');
89
+ }
90
+ else if (tag.data_type !== 'REAL') {
91
+ const [min, max] = RANGES[tag.data_type];
92
+ if (!Number.isInteger(value) || value < min || value > max)
93
+ throw new EngineeringError('INVALID_WRITE', `${tag.name} is ${tag.data_type}; value must be an integer between ${String(min)} and ${String(max)}`, 'Use whole numbers inside the declared range.');
94
+ }
95
+ return { request: { op: 'write', ...target, tag, value } };
96
+ }
97
+ /**
98
+ * Bound a discovery window.
99
+ * @param input - Tool arguments carrying optional `duration_seconds`.
100
+ * @param config - Resolved deployment limits.
101
+ * @returns Worker request with the window in milliseconds.
102
+ */
103
+ export function discoverRequest(input, config) {
104
+ if (!config.enabled)
105
+ throw new EngineeringError('DIRECT_POLLING_DISABLED', 'Enable directPollingEnabled to use controller discovery');
106
+ const seconds = input.duration_seconds ?? 3;
107
+ if (typeof seconds !== 'number' || !Number.isInteger(seconds) || seconds < 1 || seconds > 15)
108
+ throw new EngineeringError('INVALID_POLL', 'duration_seconds must be an integer between 1 and 15');
109
+ return { request: { op: 'discover', duration: seconds * 1000, timeout: config.requestTimeoutMs } };
110
+ }
111
+ /** Resolve one declared scalar (never an alias, array or unknown tag). */
112
+ function resolveScalar(project, entry) {
113
+ if (!entry || typeof entry !== 'object' || !('name' in entry) || typeof entry.name !== 'string'
114
+ || !/^[A-Za-z_][A-Za-z0-9_]*$/u.test(entry.name)
115
+ || !Object.keys(entry).every(key => key === 'name' || key === 'scope'))
116
+ throw new EngineeringError('UNSUPPORTED_WRITE_TAG', 'Each tag needs an exact scalar name and optional scope only');
117
+ const scope = 'scope' in entry ? entry.scope : 'controller';
118
+ if (typeof scope !== 'string' || (scope !== 'controller' && !/^[A-Za-z_][A-Za-z0-9_]*$/u.test(scope)))
119
+ throw new EngineeringError('INVALID_POLL', 'scope must be controller or an exact program name');
120
+ const declared = project.document.tags.find(tag => tag.name === entry.name && tag.scope === scope);
121
+ const controller = controllerElementOf(project.document);
122
+ const programs = firstChild(controller, 'Programs');
123
+ const container = scope === 'controller' ? controller : programs === undefined ? undefined
124
+ : elementChildren(programs, 'Program').find(program => program.attrs.Name === scope);
125
+ const tagContainer = container === undefined ? undefined : firstChild(container, 'Tags');
126
+ const declaration = tagContainer === undefined ? undefined : elementChildren(tagContainer, 'Tag').find(tag => tag.attrs.Name === entry.name);
127
+ const dimensions = declaration?.attrs.Dimensions ?? declaration?.attrs.Dimension ?? '';
128
+ if (!declared || aliasesOf(project.document).has(`${scope}::${declared.name}`)
129
+ || !isScalar(declared.dataType)
130
+ || (dimensions !== '' && dimensions !== '0')
131
+ || declaration?.attrs.ExternalAccess === 'None')
132
+ throw new EngineeringError('UNSUPPORTED_WRITE_TAG', `${String(entry.name)} is not a writable declared scalar BOOL, INT, DINT or REAL`, 'Reads accept the same tags; writes additionally need ExternalAccess and no array dimensions.');
133
+ return { name: declared.name, ...(scope === 'controller' ? {} : { program: scope }), data_type: declared.dataType };
134
+ }