@aryacode/dsh-engineering 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +115 -0
- package/LICENSE +21 -0
- package/README.md +228 -2
- package/cordis.patch.yml +122 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +77 -3
- package/vendor/ftview/README.md +55 -0
- package/vendor/ftview/SKILL.md +74 -0
- package/vendor/ftview/lib/checks.d.ts +27 -0
- package/vendor/ftview/lib/checks.js +39 -0
- package/vendor/ftview/lib/core.d.ts +208 -0
- package/vendor/ftview/lib/core.js +160 -0
- package/vendor/ftview/lib/edit/drafts.d.ts +49 -0
- package/vendor/ftview/lib/edit/drafts.js +84 -0
- package/vendor/ftview/lib/edit/operations.d.ts +62 -0
- package/vendor/ftview/lib/edit/operations.js +126 -0
- package/vendor/ftview/lib/edit/prepare.d.ts +38 -0
- package/vendor/ftview/lib/edit/prepare.js +133 -0
- package/vendor/ftview/lib/edit/tools.d.ts +25 -0
- package/vendor/ftview/lib/edit/tools.js +198 -0
- package/vendor/ftview/lib/edit.d.ts +30 -0
- package/vendor/ftview/lib/edit.js +38 -0
- package/vendor/ftview/lib/index.d.ts +31 -0
- package/vendor/ftview/lib/index.js +36 -0
- package/vendor/ftview/lib/model.d.ts +80 -0
- package/vendor/ftview/lib/model.js +267 -0
- package/vendor/ftview/lib/session.d.ts +48 -0
- package/vendor/ftview/lib/session.js +98 -0
- package/vendor/ftview/lib/skill.d.ts +29 -0
- package/vendor/ftview/lib/skill.js +43 -0
- package/vendor/ftview/lib/studio/discover.d.ts +36 -0
- package/vendor/ftview/lib/studio/discover.js +87 -0
- package/vendor/ftview/lib/studio/preflight.d.ts +51 -0
- package/vendor/ftview/lib/studio/preflight.js +64 -0
- package/vendor/ftview/lib/studio/tools.d.ts +15 -0
- package/vendor/ftview/lib/studio/tools.js +83 -0
- package/vendor/ftview/lib/studio.d.ts +30 -0
- package/vendor/ftview/lib/studio.js +37 -0
- package/vendor/ftview/lib/tools.d.ts +14 -0
- package/vendor/ftview/lib/tools.js +202 -0
- package/vendor/l5x/README.md +62 -0
- package/vendor/l5x/SKILL.md +81 -0
- package/vendor/l5x/lib/approvals.d.ts +50 -0
- package/vendor/l5x/lib/approvals.js +93 -0
- package/vendor/l5x/lib/client.js +412 -0
- package/vendor/l5x/lib/client.js.map +1 -0
- package/vendor/l5x/lib/core/errors.d.ts +38 -0
- package/vendor/l5x/lib/core/errors.js +48 -0
- package/vendor/l5x/lib/core/params.d.ts +49 -0
- package/vendor/l5x/lib/core/params.js +39 -0
- package/vendor/l5x/lib/core/result.d.ts +46 -0
- package/vendor/l5x/lib/core/result.js +21 -0
- package/vendor/l5x/lib/core/tool.d.ts +102 -0
- package/vendor/l5x/lib/core/tool.js +19 -0
- package/vendor/l5x/lib/drafts.d.ts +66 -0
- package/vendor/l5x/lib/drafts.js +98 -0
- package/vendor/l5x/lib/editing.d.ts +30 -0
- package/vendor/l5x/lib/editing.js +42 -0
- package/vendor/l5x/lib/engine/acd-edit.d.ts +13 -0
- package/vendor/l5x/lib/engine/acd-edit.js +115 -0
- package/vendor/l5x/lib/engine/analysis.d.ts +22 -0
- package/vendor/l5x/lib/engine/analysis.js +258 -0
- package/vendor/l5x/lib/engine/capabilities.d.ts +9 -0
- package/vendor/l5x/lib/engine/capabilities.js +40 -0
- package/vendor/l5x/lib/engine/change-set.d.ts +122 -0
- package/vendor/l5x/lib/engine/change-set.js +446 -0
- package/vendor/l5x/lib/engine/configuration.d.ts +21 -0
- package/vendor/l5x/lib/engine/configuration.js +42 -0
- package/vendor/l5x/lib/engine/details.d.ts +47 -0
- package/vendor/l5x/lib/engine/details.js +173 -0
- package/vendor/l5x/lib/engine/direct-polling.d.ts +91 -0
- package/vendor/l5x/lib/engine/direct-polling.js +193 -0
- package/vendor/l5x/lib/engine/download-review.d.ts +15 -0
- package/vendor/l5x/lib/engine/download-review.js +63 -0
- package/vendor/l5x/lib/engine/logic-syntax.d.ts +60 -0
- package/vendor/l5x/lib/engine/logic-syntax.js +237 -0
- package/vendor/l5x/lib/engine/observations.d.ts +41 -0
- package/vendor/l5x/lib/engine/observations.js +67 -0
- package/vendor/l5x/lib/engine/project-analysis.d.ts +131 -0
- package/vendor/l5x/lib/engine/project-analysis.js +314 -0
- package/vendor/l5x/lib/engine/review-evidence.d.ts +8 -0
- package/vendor/l5x/lib/engine/review-evidence.js +49 -0
- package/vendor/l5x/lib/engine/review.d.ts +18 -0
- package/vendor/l5x/lib/engine/review.js +123 -0
- package/vendor/l5x/lib/engine/studio-sdk.d.ts +101 -0
- package/vendor/l5x/lib/engine/studio-sdk.js +571 -0
- package/vendor/l5x/lib/engine/tag-resolution.d.ts +20 -0
- package/vendor/l5x/lib/engine/tag-resolution.js +169 -0
- package/vendor/l5x/lib/engine/usage.d.ts +16 -0
- package/vendor/l5x/lib/engine/usage.js +92 -0
- package/vendor/l5x/lib/engine/xml-regions.d.ts +23 -0
- package/vendor/l5x/lib/engine/xml-regions.js +77 -0
- package/vendor/l5x/lib/fs.d.ts +17 -0
- package/vendor/l5x/lib/fs.js +36 -0
- package/vendor/l5x/lib/index.d.ts +36 -0
- package/vendor/l5x/lib/index.js +42 -0
- package/vendor/l5x/lib/live.d.ts +48 -0
- package/vendor/l5x/lib/live.js +48 -0
- package/vendor/l5x/lib/model/aois.d.ts +39 -0
- package/vendor/l5x/lib/model/aois.js +112 -0
- package/vendor/l5x/lib/model/errors.d.ts +15 -0
- package/vendor/l5x/lib/model/errors.js +18 -0
- package/vendor/l5x/lib/model/index.d.ts +20 -0
- package/vendor/l5x/lib/model/index.js +19 -0
- package/vendor/l5x/lib/model/module.d.ts +37 -0
- package/vendor/l5x/lib/model/module.js +54 -0
- package/vendor/l5x/lib/model/modules.d.ts +24 -0
- package/vendor/l5x/lib/model/modules.js +55 -0
- package/vendor/l5x/lib/model/parse.d.ts +32 -0
- package/vendor/l5x/lib/model/parse.js +116 -0
- package/vendor/l5x/lib/model/project.d.ts +15 -0
- package/vendor/l5x/lib/model/project.js +31 -0
- package/vendor/l5x/lib/model/routines.d.ts +71 -0
- package/vendor/l5x/lib/model/routines.js +183 -0
- package/vendor/l5x/lib/model/tags.d.ts +51 -0
- package/vendor/l5x/lib/model/tags.js +119 -0
- package/vendor/l5x/lib/model/types.d.ts +304 -0
- package/vendor/l5x/lib/model/types.js +12 -0
- package/vendor/l5x/lib/model/udts.d.ts +34 -0
- package/vendor/l5x/lib/model/udts.js +81 -0
- package/vendor/l5x/lib/model/xml.d.ts +139 -0
- package/vendor/l5x/lib/model/xml.js +291 -0
- package/vendor/l5x/lib/model/xref.d.ts +28 -0
- package/vendor/l5x/lib/model/xref.js +154 -0
- package/vendor/l5x/lib/session.d.ts +119 -0
- package/vendor/l5x/lib/session.js +236 -0
- package/vendor/l5x/lib/skill.d.ts +30 -0
- package/vendor/l5x/lib/skill.js +44 -0
- package/vendor/l5x/lib/studio-state.d.ts +77 -0
- package/vendor/l5x/lib/studio-state.js +79 -0
- package/vendor/l5x/lib/studio.d.ts +29 -0
- package/vendor/l5x/lib/studio.js +40 -0
- package/vendor/l5x/lib/tools/checks.d.ts +19 -0
- package/vendor/l5x/lib/tools/checks.js +140 -0
- package/vendor/l5x/lib/tools/common.d.ts +41 -0
- package/vendor/l5x/lib/tools/common.js +84 -0
- package/vendor/l5x/lib/tools/controller.d.ts +21 -0
- package/vendor/l5x/lib/tools/controller.js +170 -0
- package/vendor/l5x/lib/tools/drafts.d.ts +23 -0
- package/vendor/l5x/lib/tools/drafts.js +270 -0
- package/vendor/l5x/lib/tools/live.d.ts +21 -0
- package/vendor/l5x/lib/tools/live.js +175 -0
- package/vendor/l5x/lib/tools/read.d.ts +19 -0
- package/vendor/l5x/lib/tools/read.js +245 -0
- package/vendor/l5x/lib/tools/references.d.ts +20 -0
- package/vendor/l5x/lib/tools/references.js +269 -0
- package/vendor/l5x/lib/tools/studio.d.ts +21 -0
- package/vendor/l5x/lib/tools/studio.js +193 -0
- package/vendor/l5x/poll-worker.mjs +77 -0
- package/vendor/l5x/studio-bridge/NuGet.Config +1 -0
- package/vendor/l5x/studio-bridge/Program.cs +304 -0
- package/vendor/l5x/studio-bridge/StudioBridge.csproj +11 -0
- package/vendor/mwi/README.md +60 -0
- package/vendor/mwi/SKILL.md +87 -0
- package/vendor/mwi/bridge/README.md +8 -0
- package/vendor/mwi/bridge/mw_bridge.ps1 +2763 -0
- package/vendor/mwi/bridge/sdk-interop-importer.cs +30 -0
- package/vendor/mwi/bridge/sdk-variable-reader.cs +22 -0
- package/vendor/mwi/bridge/start_bridge.cmd +21 -0
- package/vendor/mwi/bridge/watch_dialogs.cmd +13 -0
- package/vendor/mwi/bridge/watch_dialogs.ps1 +153 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__init__.py +14 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/__init__.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/block_interfaces.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/cfb.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/datatypes.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/declarations.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/errors.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/graphical_listing.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/grid.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/knowledge.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/mwt_bind.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/navigation.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/program_checks.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/project.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/staging.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/structure.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/task_bindings.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/tasks.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/tree.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/validation.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/variable_edit.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/variables.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/__pycache__/workflow.cpython-312.pyc +0 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/block_interfaces.py +275 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/build.py +339 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/capture.py +448 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/cfb.py +765 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/com.py +268 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/datatypes.py +204 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/declarations.py +399 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/descriptions.py +30 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/eip.py +292 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/errors.py +36 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/graphical_listing.py +208 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/grid.py +227 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/ide.py +317 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/iec.py +317 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/installed_help.py +151 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/knowledge.py +218 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/libraries.py +250 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/manuals.py +520 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/mwt_bind.py +133 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/navigation.py +44 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/pou_writer.py +1547 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/program_checks.py +360 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/project.py +704 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/reference_data/catalog.json +672 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/reference_data/patterns.json +86 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/restore.py +208 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/server.py +1913 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/snapshot.py +138 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/st_comments.py +25 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/staging.py +179 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/stlint.py +676 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/structure.py +98 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/task_bindings.py +68 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/tasks.py +162 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/transaction.py +157 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/tree.py +563 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/tree_writer.py +790 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/uia.py +465 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/validation.py +41 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/variable_edit.py +183 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/variables.py +472 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/workflow.py +130 -0
- package/vendor/mwi/code/engine/motionworks_iec_mcp/writer.py +666 -0
- package/vendor/mwi/code/mw_code.py +1258 -0
- package/vendor/mwi/legacy/edit-session.js +50 -0
- package/vendor/mwi/legacy/fb-insertion.js +74 -0
- package/vendor/mwi/legacy/native-code.js +83 -0
- package/vendor/mwi/legacy/native-groups.js +75 -0
- package/vendor/mwi/legacy/native-structure.js +143 -0
- package/vendor/mwi/legacy/native-variables.js +77 -0
- package/vendor/mwi/legacy/pou-conversion.js +47 -0
- package/vendor/mwi/legacy/pou-package.js +66 -0
- package/vendor/mwi/lib/core/bridge.d.ts +71 -0
- package/vendor/mwi/lib/core/bridge.js +53 -0
- package/vendor/mwi/lib/core/code-engine.d.ts +47 -0
- package/vendor/mwi/lib/core/code-engine.js +109 -0
- package/vendor/mwi/lib/core/errors.d.ts +37 -0
- package/vendor/mwi/lib/core/errors.js +47 -0
- package/vendor/mwi/lib/core/params.d.ts +52 -0
- package/vendor/mwi/lib/core/params.js +46 -0
- package/vendor/mwi/lib/core/ps-bridge.d.ts +62 -0
- package/vendor/mwi/lib/core/ps-bridge.js +127 -0
- package/vendor/mwi/lib/core/result.d.ts +45 -0
- package/vendor/mwi/lib/core/result.js +20 -0
- package/vendor/mwi/lib/core/tool.d.ts +80 -0
- package/vendor/mwi/lib/core/tool.js +55 -0
- package/vendor/mwi/lib/edit/compare.d.ts +33 -0
- package/vendor/mwi/lib/edit/compare.js +70 -0
- package/vendor/mwi/lib/edit.d.ts +20 -0
- package/vendor/mwi/lib/edit.js +32 -0
- package/vendor/mwi/lib/index.d.ts +21 -0
- package/vendor/mwi/lib/index.js +33 -0
- package/vendor/mwi/lib/read/service.d.ts +117 -0
- package/vendor/mwi/lib/read/service.js +229 -0
- package/vendor/mwi/lib/read.d.ts +21 -0
- package/vendor/mwi/lib/read.js +33 -0
- package/vendor/mwi/lib/session/project.d.ts +34 -0
- package/vendor/mwi/lib/session/project.js +54 -0
- package/vendor/mwi/lib/session/service.d.ts +167 -0
- package/vendor/mwi/lib/session/service.js +566 -0
- package/vendor/mwi/lib/session/stage.d.ts +84 -0
- package/vendor/mwi/lib/session/stage.js +187 -0
- package/vendor/mwi/lib/session/workspace.d.ts +52 -0
- package/vendor/mwi/lib/session/workspace.js +90 -0
- package/vendor/mwi/lib/skill.d.ts +36 -0
- package/vendor/mwi/lib/skill.js +56 -0
- package/vendor/mwi/lib/tools/edit.d.ts +20 -0
- package/vendor/mwi/lib/tools/edit.js +286 -0
- package/vendor/mwi/lib/tools/read.d.ts +19 -0
- package/vendor/mwi/lib/tools/read.js +161 -0
- package/vendor/mwi/lib/tools/session.d.ts +20 -0
- package/vendor/mwi/lib/tools/session.js +166 -0
- package/vendor/mwi/lib/tools/verify.d.ts +19 -0
- package/vendor/mwi/lib/tools/verify.js +85 -0
- package/vendor/mwi/lib/verify.d.ts +17 -0
- package/vendor/mwi/lib/verify.js +29 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the saved project through the code engine.
|
|
3
|
+
*
|
|
4
|
+
* These reads describe the saved project, not the loaded IDE instance. Anything
|
|
5
|
+
* that needs the live object model says so in its coverage.
|
|
6
|
+
*
|
|
7
|
+
* @module dsh-engineering-mwi/read/service
|
|
8
|
+
*/
|
|
9
|
+
import { MwiError } from "../core/errors.js";
|
|
10
|
+
/** Kinds `mw_list` can enumerate. */
|
|
11
|
+
export const LIST_KINDS = ['pou', 'variable', 'global', 'type', 'task', 'library'];
|
|
12
|
+
/** Kinds `mw_get` can read. */
|
|
13
|
+
export const GET_KINDS = ['pou', 'type', 'task', 'block', 'eip'];
|
|
14
|
+
/** The saved-project read service. */
|
|
15
|
+
export class ReadService {
|
|
16
|
+
engine;
|
|
17
|
+
/**
|
|
18
|
+
* @param engine - Code engine over the project files.
|
|
19
|
+
*/
|
|
20
|
+
constructor(engine) {
|
|
21
|
+
this.engine = engine;
|
|
22
|
+
}
|
|
23
|
+
/** Confirm the engine can read one project. */
|
|
24
|
+
async workflow(project) {
|
|
25
|
+
return await this.engine.run('workflow_check', { project: project.directory }, 120_000);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* List one kind.
|
|
29
|
+
*
|
|
30
|
+
* @param project - Project to read.
|
|
31
|
+
* @param kind - Listing kind.
|
|
32
|
+
* @param options - Filter, paging and the POU for variable reads.
|
|
33
|
+
* @returns Rows and the total before paging.
|
|
34
|
+
*/
|
|
35
|
+
async list(project, kind, options = {}) {
|
|
36
|
+
const rows = await this.rows(project, kind, options.pou);
|
|
37
|
+
const filter = options.filter?.toLowerCase();
|
|
38
|
+
const filtered = filter === undefined ? rows : rows.filter(row => JSON.stringify(row).toLowerCase().includes(filter));
|
|
39
|
+
const offset = options.offset ?? 0;
|
|
40
|
+
const limit = options.limit ?? 50;
|
|
41
|
+
return { rows: filtered.slice(offset, offset + limit), total: filtered.length };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Read one component by name.
|
|
45
|
+
*
|
|
46
|
+
* @param project - Project to read.
|
|
47
|
+
* @param kind - Component kind.
|
|
48
|
+
* @param name - Exact name.
|
|
49
|
+
* @param library - Library name for a block interface.
|
|
50
|
+
* @returns The component document.
|
|
51
|
+
*/
|
|
52
|
+
async get(project, kind, name, library) {
|
|
53
|
+
if (kind === 'pou') {
|
|
54
|
+
const text = await this.engine.run('read_text', { project: project.directory, pou: name }, 60_000);
|
|
55
|
+
return { ...text, project: project.directory };
|
|
56
|
+
}
|
|
57
|
+
if (kind === 'block') {
|
|
58
|
+
return await this.engine.run('block_interface', {
|
|
59
|
+
project: project.directory,
|
|
60
|
+
name,
|
|
61
|
+
...(library === undefined ? {} : { library }),
|
|
62
|
+
}, 60_000);
|
|
63
|
+
}
|
|
64
|
+
if (kind === 'eip')
|
|
65
|
+
return await this.engine.run('eip_map', { project: project.directory }, 60_000);
|
|
66
|
+
const rows = await this.rows(project, kind === 'type' ? 'type' : 'task');
|
|
67
|
+
const found = rows.find(row => String(row.name).toLowerCase() === name.toLowerCase());
|
|
68
|
+
if (found === undefined) {
|
|
69
|
+
throw new MwiError('COMPONENT_NOT_FOUND', `No ${kind} named ${name} exists in ${project.name}.`, 'Call mw_list for the exact names.', rows.slice(0, 20).map(row => String(row.name)));
|
|
70
|
+
}
|
|
71
|
+
return { found };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Search POU bodies for literal text.
|
|
75
|
+
*
|
|
76
|
+
* @param project - Project to read.
|
|
77
|
+
* @param query - Case-insensitive literal text.
|
|
78
|
+
* @param limit - Most matches.
|
|
79
|
+
* @returns Matches in project order.
|
|
80
|
+
*/
|
|
81
|
+
async search(project, query, limit = 50) {
|
|
82
|
+
const bodies = await this.bodies(project, 100);
|
|
83
|
+
const matches = [];
|
|
84
|
+
let truncated = false;
|
|
85
|
+
for (const body of bodies) {
|
|
86
|
+
for (const [index, line] of body.lines.entries()) {
|
|
87
|
+
if (!line.toLowerCase().includes(query.toLowerCase()))
|
|
88
|
+
continue;
|
|
89
|
+
if (matches.length >= limit) {
|
|
90
|
+
truncated = true;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
matches.push({ pou: body.pou, line: index + 1, text: line.trim() });
|
|
94
|
+
}
|
|
95
|
+
if (truncated)
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
return { matches, truncated, scanned: bodies.length };
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Find a symbol in POU bodies.
|
|
102
|
+
*
|
|
103
|
+
* @param project - Project to read.
|
|
104
|
+
* @param symbol - Declared or written symbol name.
|
|
105
|
+
* @param limit - Most matches.
|
|
106
|
+
* @returns Matches with the line that contains them.
|
|
107
|
+
*/
|
|
108
|
+
async references(project, symbol, limit = 50) {
|
|
109
|
+
const pattern = new RegExp(`(?<![\\w.])${symbol.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&')}(?![\\w])`, 'iu');
|
|
110
|
+
const bodies = await this.bodies(project, 100);
|
|
111
|
+
const matches = [];
|
|
112
|
+
let truncated = false;
|
|
113
|
+
for (const body of bodies) {
|
|
114
|
+
for (const [index, line] of body.lines.entries()) {
|
|
115
|
+
if (!pattern.test(line))
|
|
116
|
+
continue;
|
|
117
|
+
if (matches.length >= limit) {
|
|
118
|
+
truncated = true;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
matches.push({ pou: body.pou, line: index + 1, text: line.trim() });
|
|
122
|
+
}
|
|
123
|
+
if (truncated)
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
return { matches, truncated, scanned: bodies.length };
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Run the static review surface.
|
|
130
|
+
*
|
|
131
|
+
* @param project - Project to read.
|
|
132
|
+
* @param options - Optional POU and proposed body.
|
|
133
|
+
* @returns Workflow, validation, unsupported-construct and program-review results.
|
|
134
|
+
*/
|
|
135
|
+
async review(project, options = {}) {
|
|
136
|
+
const workflow = await this.engine.run('workflow_check', { project: project.directory }, 120_000);
|
|
137
|
+
const validate = await this.engine.run('validate', { project: project.directory }, 120_000);
|
|
138
|
+
const unsupported = await this.engine.run('unsupported', { project: project.directory }, 60_000);
|
|
139
|
+
const review = options.pou === undefined && options.body === undefined
|
|
140
|
+
? undefined
|
|
141
|
+
: await this.engine.run('check_program', {
|
|
142
|
+
project: project.directory,
|
|
143
|
+
...(options.pou === undefined ? {} : { pou: options.pou }),
|
|
144
|
+
...(options.body === undefined ? {} : { body: options.body }),
|
|
145
|
+
}, 180_000);
|
|
146
|
+
return { workflow, validate, unsupported, ...(review === undefined ? {} : { review }) };
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Search help and reviewed references.
|
|
150
|
+
*
|
|
151
|
+
* @param project - Project used for the workspace cache.
|
|
152
|
+
* @param source - Help source: help, manual, reference or pattern.
|
|
153
|
+
* @param query - Search term; omitted lists what is available.
|
|
154
|
+
* @param limit - Most rows.
|
|
155
|
+
* @returns The engine document with its source named.
|
|
156
|
+
*/
|
|
157
|
+
async help(project, source, query, limit = 10) {
|
|
158
|
+
if (source === 'help') {
|
|
159
|
+
return await this.engine.run('installed_help', {
|
|
160
|
+
...(query === undefined ? {} : { query }),
|
|
161
|
+
limit,
|
|
162
|
+
}, 120_000);
|
|
163
|
+
}
|
|
164
|
+
if (source === 'manual') {
|
|
165
|
+
return await this.engine.run('manual', { ...(query === undefined ? {} : { term: query }) }, 120_000);
|
|
166
|
+
}
|
|
167
|
+
if (source === 'reference') {
|
|
168
|
+
return await this.engine.run('reference', { ...(query === undefined ? {} : { query }) }, 120_000);
|
|
169
|
+
}
|
|
170
|
+
return await this.engine.run('pattern', { ...(query === undefined ? {} : { name: query }) }, 60_000);
|
|
171
|
+
}
|
|
172
|
+
/** Read every POU body, capped. */
|
|
173
|
+
async bodies(project, cap) {
|
|
174
|
+
const listed = await this.engine.run('pous', { project: project.directory }, 120_000);
|
|
175
|
+
const pous = listed.pous ?? [];
|
|
176
|
+
const readable = pous.filter(pou => pou.has_st_body !== false && (pou.stream_language ?? 'ST') !== 'LD' && (pou.stream_language ?? 'ST') !== 'FBD').slice(0, cap);
|
|
177
|
+
const bodies = [];
|
|
178
|
+
for (const pou of readable) {
|
|
179
|
+
try {
|
|
180
|
+
const text = await this.engine.run('read_text', { project: project.directory, pou: pou.name }, 60_000);
|
|
181
|
+
const body = typeof text.text === 'string' ? text.text : typeof text.body === 'string' ? text.body : '';
|
|
182
|
+
bodies.push({ pou: pou.name, lines: body.split(/\r?\n/u) });
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
// A graphical or protected POU has no text body; it is skipped and the
|
|
186
|
+
// coverage names the gap.
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return bodies;
|
|
190
|
+
}
|
|
191
|
+
/** Map one kind to rows. */
|
|
192
|
+
async rows(project, kind, pou) {
|
|
193
|
+
if (kind === 'pou') {
|
|
194
|
+
const listed = await this.engine.run('pous', { project: project.directory }, 120_000);
|
|
195
|
+
return (listed.pous ?? []).map(row => ({
|
|
196
|
+
name: String(row.name), language: row.language, has_st_body: row.has_st_body,
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
if (kind === 'global') {
|
|
200
|
+
const globals = await this.engine.run('globals', { project: project.directory }, 120_000);
|
|
201
|
+
return (globals.variables ?? []).map(row => ({ ...row, name: String(row.name) }));
|
|
202
|
+
}
|
|
203
|
+
if (kind === 'variable') {
|
|
204
|
+
if (pou === undefined)
|
|
205
|
+
throw new MwiError('POU_REQUIRED', 'Listing variables needs a POU.', 'Pass pou, or use kind global for resource globals.');
|
|
206
|
+
const text = await this.engine.run('read_text', { project: project.directory, pou }, 60_000);
|
|
207
|
+
return (text.variables ?? []).map(row => ({ ...row, name: String(row.name) }));
|
|
208
|
+
}
|
|
209
|
+
if (kind === 'type') {
|
|
210
|
+
const types = await this.engine.run('types', { project: project.directory }, 120_000);
|
|
211
|
+
return (types.types ?? []).map(row => ({ ...row, name: String(row.name) }));
|
|
212
|
+
}
|
|
213
|
+
if (kind === 'task') {
|
|
214
|
+
const tasks = await this.engine.run('tasks', { project: project.directory }, 120_000);
|
|
215
|
+
const bindings = tasks.bindings ?? [];
|
|
216
|
+
const unassigned = tasks.unassigned ?? [];
|
|
217
|
+
return [
|
|
218
|
+
...bindings.map(row => ({ ...row, name: String(row.name) })),
|
|
219
|
+
...unassigned.map(name => ({ name, kind: 'UNASSIGNED' })),
|
|
220
|
+
];
|
|
221
|
+
}
|
|
222
|
+
if (kind === 'library') {
|
|
223
|
+
const library = await this.engine.run('library', { project: project.directory }, 120_000);
|
|
224
|
+
const blocks = library.blocks ?? library.libraries ?? [];
|
|
225
|
+
return blocks.map(row => ({ ...row, name: String(row.name ?? row.library ?? '') }));
|
|
226
|
+
}
|
|
227
|
+
throw new MwiError('UNKNOWN_KIND', `Unknown listing kind ${kind}.`, `Use one of: ${LIST_KINDS.join(', ')}.`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `mwi-read` entry: the saved project model, code, help and review evidence.
|
|
3
|
+
*
|
|
4
|
+
* The row registers on Windows only, like the session row: the engine reads a
|
|
5
|
+
* MotionWorks project and the bridge covers the same installation.
|
|
6
|
+
*
|
|
7
|
+
* @module dsh-engineering-mwi/read
|
|
8
|
+
*/
|
|
9
|
+
import type { PluginContext } from './core/tool.ts';
|
|
10
|
+
/** Plugin name in a composition. */
|
|
11
|
+
export declare const name = "mwi-read";
|
|
12
|
+
/** Services this plugin cannot register without. */
|
|
13
|
+
export declare const inject: readonly ["tools"];
|
|
14
|
+
/**
|
|
15
|
+
* Register the read tools.
|
|
16
|
+
*
|
|
17
|
+
* @param ctx - Plugin context with the tool registry.
|
|
18
|
+
*/
|
|
19
|
+
export declare function apply(ctx: PluginContext): void;
|
|
20
|
+
export { readTools } from './tools/read.ts';
|
|
21
|
+
export { ReadService } from './read/service.ts';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `mwi-read` entry: the saved project model, code, help and review evidence.
|
|
3
|
+
*
|
|
4
|
+
* The row registers on Windows only, like the session row: the engine reads a
|
|
5
|
+
* MotionWorks project and the bridge covers the same installation.
|
|
6
|
+
*
|
|
7
|
+
* @module dsh-engineering-mwi/read
|
|
8
|
+
*/
|
|
9
|
+
import { readTools } from "./tools/read.js";
|
|
10
|
+
/** Plugin name in a composition. */
|
|
11
|
+
export const name = 'mwi-read';
|
|
12
|
+
/** Services this plugin cannot register without. */
|
|
13
|
+
export const inject = ['tools'];
|
|
14
|
+
/**
|
|
15
|
+
* Register the read tools.
|
|
16
|
+
*
|
|
17
|
+
* @param ctx - Plugin context with the tool registry.
|
|
18
|
+
*/
|
|
19
|
+
export function apply(ctx) {
|
|
20
|
+
if (process.platform !== 'win32') {
|
|
21
|
+
try {
|
|
22
|
+
ctx.logger?.info?.(`mwi-read: skipped because this host is ${process.platform}; MotionWorks IEC requires Windows.`);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// A logger that refuses must not turn an unsupported host into a crash.
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
for (const definition of readTools())
|
|
30
|
+
ctx.tools.register(definition);
|
|
31
|
+
}
|
|
32
|
+
export { readTools } from "./tools/read.js";
|
|
33
|
+
export { ReadService } from "./read/service.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the project a read applies to.
|
|
3
|
+
*
|
|
4
|
+
* A read never stages or opens anything: it uses an explicit project inside the
|
|
5
|
+
* workspace, or the single staged project when no project is named.
|
|
6
|
+
*
|
|
7
|
+
* @module dsh-engineering-mwi/session/project
|
|
8
|
+
*/
|
|
9
|
+
/** One project a read can address. */
|
|
10
|
+
export interface ProjectRef {
|
|
11
|
+
/** Project name. */
|
|
12
|
+
readonly name: string;
|
|
13
|
+
/** Expanded project directory. */
|
|
14
|
+
readonly directory: string;
|
|
15
|
+
/** The `.mwt` wrapper. */
|
|
16
|
+
readonly mwt: string;
|
|
17
|
+
/** Whether the project is a staged copy. */
|
|
18
|
+
readonly staged: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve one project path.
|
|
22
|
+
*
|
|
23
|
+
* @param workspace - Absolute workspace root.
|
|
24
|
+
* @param requested - Project directory `.mwt` or name, relative to the workspace.
|
|
25
|
+
* @returns The resolved project.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveProject(workspace: string, requested: string): ProjectRef;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the project a call means when it names none.
|
|
30
|
+
*
|
|
31
|
+
* @param workspace - Absolute workspace root.
|
|
32
|
+
* @returns The single staged project.
|
|
33
|
+
*/
|
|
34
|
+
export declare function defaultProject(workspace: string): ProjectRef;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the project a read applies to.
|
|
3
|
+
*
|
|
4
|
+
* A read never stages or opens anything: it uses an explicit project inside the
|
|
5
|
+
* workspace, or the single staged project when no project is named.
|
|
6
|
+
*
|
|
7
|
+
* @module dsh-engineering-mwi/session/project
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
10
|
+
import { basename, join, resolve } from 'node:path';
|
|
11
|
+
import { MwiError } from "../core/errors.js";
|
|
12
|
+
import { isInside, stageRootOf } from "./workspace.js";
|
|
13
|
+
/**
|
|
14
|
+
* Resolve one project path.
|
|
15
|
+
*
|
|
16
|
+
* @param workspace - Absolute workspace root.
|
|
17
|
+
* @param requested - Project directory `.mwt` or name, relative to the workspace.
|
|
18
|
+
* @returns The resolved project.
|
|
19
|
+
*/
|
|
20
|
+
export function resolveProject(workspace, requested) {
|
|
21
|
+
const asked = resolve(workspace, requested);
|
|
22
|
+
const isMwt = asked.toLowerCase().endsWith('.mwt');
|
|
23
|
+
const mwt = isMwt ? asked : `${asked}.mwt`;
|
|
24
|
+
const directory = isMwt ? asked.slice(0, -4) : asked;
|
|
25
|
+
if (!isInside(workspace, directory)) {
|
|
26
|
+
throw new MwiError('OUTSIDE_WORKSPACE', `${directory} is outside the workspace ${workspace}.`, 'Read a project inside the workspace.');
|
|
27
|
+
}
|
|
28
|
+
if (!existsSync(directory) || !existsSync(mwt)) {
|
|
29
|
+
throw new MwiError('PROJECT_NOT_FOUND', `No project exists at ${directory}.`, 'Call mw_project_find for the workspace projects.');
|
|
30
|
+
}
|
|
31
|
+
return { name: basename(directory), directory, mwt, staged: isInside(stageRootOf(workspace), directory) };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the project a call means when it names none.
|
|
35
|
+
*
|
|
36
|
+
* @param workspace - Absolute workspace root.
|
|
37
|
+
* @returns The single staged project.
|
|
38
|
+
*/
|
|
39
|
+
export function defaultProject(workspace) {
|
|
40
|
+
let names = [];
|
|
41
|
+
try {
|
|
42
|
+
names = readdirSync(stageRootOf(workspace)).filter(name => name.toLowerCase().endsWith('.mwt'));
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
names = [];
|
|
46
|
+
}
|
|
47
|
+
if (names.length === 0) {
|
|
48
|
+
throw new MwiError('NO_PROJECT', 'No project is staged in this workspace.', 'Call mw_project_find, then mw_project_stage, or pass project explicitly.');
|
|
49
|
+
}
|
|
50
|
+
if (names.length > 1) {
|
|
51
|
+
throw new MwiError('AMBIGUOUS_PROJECT', `${names.length} projects are staged.`, 'Pass project: the project directory or .mwt.', names.map(name => name.replace(/\.mwt$/iu, '')));
|
|
52
|
+
}
|
|
53
|
+
return resolveProject(workspace, join(stageRootOf(workspace), names[0]));
|
|
54
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One workspace's MotionWorks runtime: bridge, code engine, stage and the rows
|
|
3
|
+
* that need them.
|
|
4
|
+
*
|
|
5
|
+
* Runtimes are cached per workspace so one chat reuses the bridge it started and
|
|
6
|
+
* one workspace's mailbox never answers another's request.
|
|
7
|
+
*
|
|
8
|
+
* @module dsh-engineering-mwi/session/service
|
|
9
|
+
*/
|
|
10
|
+
import { type StageOptions, type StageRecord } from './stage.ts';
|
|
11
|
+
import { ReadService } from '../read/service.ts';
|
|
12
|
+
/** The bridge directory shipped with this package. */
|
|
13
|
+
export declare const BRIDGE_DIR: string;
|
|
14
|
+
/** The code engine directory shipped with this package. */
|
|
15
|
+
export declare const CODE_DIR: string;
|
|
16
|
+
/** Vendored proven mutation helpers. */
|
|
17
|
+
export declare const LEGACY_DIR: string;
|
|
18
|
+
/** One open worksheet request. */
|
|
19
|
+
export interface WorksheetRequest {
|
|
20
|
+
/** `code` or `variables`. */
|
|
21
|
+
readonly kind: 'code' | 'variables';
|
|
22
|
+
/** POU name for a code worksheet; omit for globals. */
|
|
23
|
+
readonly pou?: string;
|
|
24
|
+
/** Inspect the current editor instead of opening one. */
|
|
25
|
+
readonly inspectOnly?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** What the session tools need from a workspace runtime. */
|
|
28
|
+
export interface SessionRuntime {
|
|
29
|
+
/** IDE status from the bridge. */
|
|
30
|
+
status(): Promise<Record<string, unknown>>;
|
|
31
|
+
/** Live IDE state, including window and dialog state. */
|
|
32
|
+
ideState(): Promise<Record<string, unknown>>;
|
|
33
|
+
/** Stage one workspace project. */
|
|
34
|
+
stage(source: string, options?: StageOptions): Promise<StageRecord>;
|
|
35
|
+
/** Open a staged project. */
|
|
36
|
+
open(path: string, options: {
|
|
37
|
+
userApproved?: boolean;
|
|
38
|
+
expectedProject?: string;
|
|
39
|
+
}): Promise<Record<string, unknown>>;
|
|
40
|
+
/** Start the IDE with a staged project. */
|
|
41
|
+
start(project?: string): Promise<Record<string, unknown>>;
|
|
42
|
+
/** Open one worksheet in the open project. */
|
|
43
|
+
worksheet(request: WorksheetRequest): Promise<Record<string, unknown>>;
|
|
44
|
+
/** Close the IDE project with consent. */
|
|
45
|
+
close(options: {
|
|
46
|
+
userApproved: boolean;
|
|
47
|
+
expectedProject?: string;
|
|
48
|
+
}): Promise<Record<string, unknown>>;
|
|
49
|
+
/** The stage record for a path, when it is staged. */
|
|
50
|
+
stagedAt(path: string): StageRecord | undefined;
|
|
51
|
+
/** Saved-project reads over the code engine. */
|
|
52
|
+
readonly reads: ReadService;
|
|
53
|
+
/** Run Make, Build or read compile state for the open staged project. */
|
|
54
|
+
compile(mode: 'make' | 'build' | 'state'): Promise<Record<string, unknown>>;
|
|
55
|
+
/** Read one IDE output pane, with the compile verdict when available. */
|
|
56
|
+
diagnostics(pane: string, limit: number): Promise<Record<string, unknown>>;
|
|
57
|
+
/** Capture or compare one saved-source baseline. */
|
|
58
|
+
verify(mode: 'baseline' | 'compare', baselineId?: string): Promise<Record<string, unknown>>;
|
|
59
|
+
/** Replace one ST/IL body through the native ChangeCodeWS path. */
|
|
60
|
+
editCode(input: {
|
|
61
|
+
pou: string;
|
|
62
|
+
changes?: readonly Record<string, unknown>[];
|
|
63
|
+
body?: string;
|
|
64
|
+
expectedBody?: string;
|
|
65
|
+
expectedHash?: string;
|
|
66
|
+
}): Promise<Record<string, unknown>>;
|
|
67
|
+
/** Validate the current saved project before or after an edit. */
|
|
68
|
+
validate(options: {
|
|
69
|
+
pou?: string;
|
|
70
|
+
body?: string;
|
|
71
|
+
}): Promise<Record<string, unknown>>;
|
|
72
|
+
/** Save the open staged project through the IDE. */
|
|
73
|
+
apply(): Promise<Record<string, unknown>>;
|
|
74
|
+
/** Insert one FB instance and its ST call into a POU. */
|
|
75
|
+
insertBlock(input: Readonly<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
76
|
+
/** Export one POU to a workspace package, or import it into this project. */
|
|
77
|
+
transferPou(input: Readonly<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
78
|
+
/** Add, edit or delete one native declaration. */
|
|
79
|
+
editVariable(input: Readonly<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
80
|
+
/** Create, copy, rename, delete or assign one POU or task. */
|
|
81
|
+
editStructure(input: Readonly<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
82
|
+
/** Insert one FB instance and its ST call into a POU. */
|
|
83
|
+
insertBlock(input: Readonly<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
84
|
+
}
|
|
85
|
+
/** A workspace runtime over the real bridge and engine. */
|
|
86
|
+
export declare class PowerShellSessionRuntime implements SessionRuntime {
|
|
87
|
+
readonly workspace: string;
|
|
88
|
+
private readonly bridge;
|
|
89
|
+
private readonly engine;
|
|
90
|
+
private readonly stages;
|
|
91
|
+
/** Saved-project reads. */
|
|
92
|
+
readonly reads: ReadService;
|
|
93
|
+
/** Live POU-package receipts, bound to this runtime. */
|
|
94
|
+
private readonly packages;
|
|
95
|
+
/**
|
|
96
|
+
* @param workspace - Absolute workspace root.
|
|
97
|
+
*/
|
|
98
|
+
constructor(workspace: string);
|
|
99
|
+
/** @returns The bridge's status document. */
|
|
100
|
+
status(): Promise<Record<string, unknown>>;
|
|
101
|
+
/** @returns The bridge's live state document. */
|
|
102
|
+
ideState(): Promise<Record<string, unknown>>;
|
|
103
|
+
/** @returns The written stage record. */
|
|
104
|
+
stage(source: string, options?: StageOptions): Promise<StageRecord>;
|
|
105
|
+
/** @returns The bridge's open result. */
|
|
106
|
+
open(path: string, options: {
|
|
107
|
+
userApproved?: boolean;
|
|
108
|
+
expectedProject?: string;
|
|
109
|
+
}): Promise<Record<string, unknown>>;
|
|
110
|
+
/** @returns The bridge's start result. */
|
|
111
|
+
start(project?: string): Promise<Record<string, unknown>>;
|
|
112
|
+
/** @returns The bridge's worksheet result. */
|
|
113
|
+
worksheet(request: WorksheetRequest): Promise<Record<string, unknown>>;
|
|
114
|
+
/** @returns The bridge's close result. */
|
|
115
|
+
close(options: {
|
|
116
|
+
userApproved: boolean;
|
|
117
|
+
expectedProject?: string;
|
|
118
|
+
}): Promise<Record<string, unknown>>;
|
|
119
|
+
/** @returns The stage record for a path. */
|
|
120
|
+
stagedAt(path: string): StageRecord | undefined;
|
|
121
|
+
/** @returns The bridge's compile result. */
|
|
122
|
+
compile(mode: 'make' | 'build' | 'state'): Promise<Record<string, unknown>>;
|
|
123
|
+
/** @returns The output pane and the compile verdict when readable. */
|
|
124
|
+
diagnostics(pane: string, limit: number): Promise<Record<string, unknown>>;
|
|
125
|
+
/** @returns A baseline receipt or a comparison against one. */
|
|
126
|
+
verify(mode: 'baseline' | 'compare', baselineId?: string): Promise<Record<string, unknown>>;
|
|
127
|
+
/** Export one POU to a workspace package, or import it into this project. */
|
|
128
|
+
transferPou(input: Readonly<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
129
|
+
/** Insert one FB instance and its ST call into a POU. */
|
|
130
|
+
insertBlock(input: Readonly<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
131
|
+
/** Add, edit or delete one native declaration. */
|
|
132
|
+
editVariable(input: Readonly<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
133
|
+
/** Create, copy, rename, delete or assign one POU or task. */
|
|
134
|
+
editStructure(input: Readonly<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
135
|
+
/** Validate the current saved project. */
|
|
136
|
+
validate(options: {
|
|
137
|
+
pou?: string;
|
|
138
|
+
body?: string;
|
|
139
|
+
}): Promise<Record<string, unknown>>;
|
|
140
|
+
/** Save the open staged project through the IDE. */
|
|
141
|
+
apply(): Promise<Record<string, unknown>>;
|
|
142
|
+
/** Replace one ST/IL body through the proven native ChangeCodeWS path. */
|
|
143
|
+
editCode(input: {
|
|
144
|
+
pou: string;
|
|
145
|
+
changes?: readonly Record<string, unknown>[];
|
|
146
|
+
body?: string;
|
|
147
|
+
expectedBody?: string;
|
|
148
|
+
expectedHash?: string;
|
|
149
|
+
}): Promise<Record<string, unknown>>;
|
|
150
|
+
/** The open project must be a proven stage; every compile and verify depends on it. */
|
|
151
|
+
private openStagedRecord;
|
|
152
|
+
/** The only staged project, or a refusal that explains the choice. */
|
|
153
|
+
private singleStage;
|
|
154
|
+
/** Resolve a requested staged project. */
|
|
155
|
+
private stageMwt;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Resolve the runtime for one workspace.
|
|
159
|
+
*
|
|
160
|
+
* @param workspace - Absolute workspace root.
|
|
161
|
+
* @returns The cached runtime.
|
|
162
|
+
*/
|
|
163
|
+
export declare function runtimeFor(workspace: string): PowerShellSessionRuntime;
|
|
164
|
+
/** Resolve a tool call's workspace. */
|
|
165
|
+
export declare function workspaceFrom(exec: {
|
|
166
|
+
cwd?: string;
|
|
167
|
+
}): string;
|