cmdop-diagnostics 1.0.0__tar.gz
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.
- cmdop_diagnostics-1.0.0/LICENSE +21 -0
- cmdop_diagnostics-1.0.0/PKG-INFO +113 -0
- cmdop_diagnostics-1.0.0/README.md +100 -0
- cmdop_diagnostics-1.0.0/pyproject.toml +26 -0
- cmdop_diagnostics-1.0.0/setup.cfg +4 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics/__init__.py +1 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics/catalog/remote-diagnostics.json +105 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics/runtime/__init__.py +1 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics/runtime/python/__init__.py +1 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics/runtime/python/remote_agent_environment.py +39 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics/runtime/python/remote_diagnostics.py +191 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics/runtime/python/remote_flowise_health.py +21 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics/runtime/python/remote_product_version.py +52 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics/runtime/python/remote_toolhive_version.py +26 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics/runtime/python/remote_version.py +80 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics.egg-info/PKG-INFO +113 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics.egg-info/SOURCES.txt +18 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics.egg-info/dependency_links.txt +1 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics.egg-info/entry_points.txt +2 -0
- cmdop_diagnostics-1.0.0/src/cmdop_diagnostics.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CMDOP
|
|
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.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cmdop-diagnostics
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Explicit CMDOP diagnostics for authorized machines and known installations
|
|
5
|
+
Author: CMDOP
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Documentation, https://github.com/commandoperator/cmdop-sdk
|
|
8
|
+
Project-URL: Homepage, https://cmdop.ai
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# CMDOP Diagnostics
|
|
15
|
+
|
|
16
|
+
First-party CMDOP utilities for inspecting explicitly selected, already
|
|
17
|
+
installed software on authorized CMDOP machines. These utilities are not
|
|
18
|
+
the software products named in their diagnostic profiles. No affiliation
|
|
19
|
+
or upstream endorsement is implied.
|
|
20
|
+
|
|
21
|
+
The Python distribution is `cmdop-diagnostics`; the Node.js distribution
|
|
22
|
+
is `@cmdop/diagnostics`. Both expose the same eleven diagnostic profiles.
|
|
23
|
+
Requires Python 3.10+ or Node.js 20+, respectively. The separately installed
|
|
24
|
+
official CMDOP SDK 3.6.1 is the reviewed compatibility baseline.
|
|
25
|
+
|
|
26
|
+
## Install in a separate tools environment
|
|
27
|
+
|
|
28
|
+
Python (a fresh virtual environment, not the private local diagnostics environment):
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
python -m pip install cmdop==3.6.1 cmdop-diagnostics==1.0.0
|
|
32
|
+
cmdop-diagnostics list
|
|
33
|
+
cmdop-diagnostics --help
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Node.js (from a dedicated tools project):
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npm install --save-exact @cmdop/sdk@3.6.1 @cmdop/diagnostics@1.0.0
|
|
40
|
+
npx --no-install cmdop-diagnostics-node list
|
|
41
|
+
npx --no-install cmdop-diagnostics-node --help
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Configure the existing SDK using your own authorized environment and the
|
|
45
|
+
[official SDK documentation](https://github.com/commandoperator/cmdop-sdk).
|
|
46
|
+
The utilities do not install SDKs, obtain credentials, run install hooks,
|
|
47
|
+
or perform any remote operation on import. Help, list and invalid input
|
|
48
|
+
do not connect.
|
|
49
|
+
|
|
50
|
+
## Operations
|
|
51
|
+
|
|
52
|
+
| Profile | Explicit input | Operation |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| gitnexus, agent-device, openclaw, nanoclaw, trustclaw | Original absolute package.json path | Bounded remote manifest read and identity/version check |
|
|
55
|
+
| picoclaw, zeroclaw, mcpjungle | Original absolute executable path | Documented version command |
|
|
56
|
+
| toolhive | Original absolute thv executable path | Version command, with update check and usage metrics disabled |
|
|
57
|
+
| am-i-vibing | Original absolute Node binary and CLI paths | Documented environment detector JSON |
|
|
58
|
+
| flowiseai | Local service port, default 3000 | Bounded loopback ping |
|
|
59
|
+
|
|
60
|
+
For example:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
cmdop-diagnostics gitnexus MY_MACHINE /actual/gitnexus/package.json
|
|
64
|
+
cmdop-diagnostics flowiseai MY_MACHINE 3000
|
|
65
|
+
cmdop-diagnostics-node toolhive MY_MACHINE /actual/thv
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Manifest reads require the relevant file-read grant. The other six profiles
|
|
69
|
+
require the remote exec grant and trusted original binaries/scripts.
|
|
70
|
+
Version flags are not a sandbox for untrusted executables. The Flowise
|
|
71
|
+
operation checks only endpoint reachability. TrustClaw refers only to the
|
|
72
|
+
ComposioHQ self-hosted application manifest, not a public CLI. NanoClaw
|
|
73
|
+
manifest identity is not repository-verified; compare a trusted SHA-256
|
|
74
|
+
digest for exact-byte evidence.
|
|
75
|
+
|
|
76
|
+
## Batch manifest checks
|
|
77
|
+
|
|
78
|
+
Create a local JSON file with an explicit list of 1–16 known installations:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"schema_version": 1,
|
|
83
|
+
"checks": [
|
|
84
|
+
{
|
|
85
|
+
"id": "gitnexus-main",
|
|
86
|
+
"profile": "gitnexus",
|
|
87
|
+
"path": "/actual/gitnexus/package.json",
|
|
88
|
+
"expected_version": "1.6.12"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The optional `sha256` field must be independently obtained from trusted
|
|
95
|
+
original bytes. Do not include credentials. Use the same file with either
|
|
96
|
+
CLI:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
cmdop-diagnostics manifest-batch MY_MACHINE manifest-plan.json
|
|
100
|
+
cmdop-diagnostics-node manifest-batch MY_MACHINE manifest-plan.json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
All entries are validated before connecting. Results are JSON with
|
|
104
|
+
individual outcomes. Exit 0 means all requested checks passed, 2 invalid
|
|
105
|
+
input, 3 SDK or single-operation failure, and 4 a batch with failed or
|
|
106
|
+
mismatched entries. A metadata match is not a service authentication,
|
|
107
|
+
signature or runtime integrity guarantee.
|
|
108
|
+
|
|
109
|
+
No general shell, automatic discovery, installer, bundled SDK, upstream
|
|
110
|
+
implementation, telemetry collection, or automatic package updates are
|
|
111
|
+
provided. Use only authorized machines and trusted original installations.
|
|
112
|
+
Installed-entry acceptance uses isolated SDK transport fixtures, not live
|
|
113
|
+
partner-service verification. MIT applies to the CMDOP diagnostic code.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# CMDOP Diagnostics
|
|
2
|
+
|
|
3
|
+
First-party CMDOP utilities for inspecting explicitly selected, already
|
|
4
|
+
installed software on authorized CMDOP machines. These utilities are not
|
|
5
|
+
the software products named in their diagnostic profiles. No affiliation
|
|
6
|
+
or upstream endorsement is implied.
|
|
7
|
+
|
|
8
|
+
The Python distribution is `cmdop-diagnostics`; the Node.js distribution
|
|
9
|
+
is `@cmdop/diagnostics`. Both expose the same eleven diagnostic profiles.
|
|
10
|
+
Requires Python 3.10+ or Node.js 20+, respectively. The separately installed
|
|
11
|
+
official CMDOP SDK 3.6.1 is the reviewed compatibility baseline.
|
|
12
|
+
|
|
13
|
+
## Install in a separate tools environment
|
|
14
|
+
|
|
15
|
+
Python (a fresh virtual environment, not the private local diagnostics environment):
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
python -m pip install cmdop==3.6.1 cmdop-diagnostics==1.0.0
|
|
19
|
+
cmdop-diagnostics list
|
|
20
|
+
cmdop-diagnostics --help
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Node.js (from a dedicated tools project):
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm install --save-exact @cmdop/sdk@3.6.1 @cmdop/diagnostics@1.0.0
|
|
27
|
+
npx --no-install cmdop-diagnostics-node list
|
|
28
|
+
npx --no-install cmdop-diagnostics-node --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Configure the existing SDK using your own authorized environment and the
|
|
32
|
+
[official SDK documentation](https://github.com/commandoperator/cmdop-sdk).
|
|
33
|
+
The utilities do not install SDKs, obtain credentials, run install hooks,
|
|
34
|
+
or perform any remote operation on import. Help, list and invalid input
|
|
35
|
+
do not connect.
|
|
36
|
+
|
|
37
|
+
## Operations
|
|
38
|
+
|
|
39
|
+
| Profile | Explicit input | Operation |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| gitnexus, agent-device, openclaw, nanoclaw, trustclaw | Original absolute package.json path | Bounded remote manifest read and identity/version check |
|
|
42
|
+
| picoclaw, zeroclaw, mcpjungle | Original absolute executable path | Documented version command |
|
|
43
|
+
| toolhive | Original absolute thv executable path | Version command, with update check and usage metrics disabled |
|
|
44
|
+
| am-i-vibing | Original absolute Node binary and CLI paths | Documented environment detector JSON |
|
|
45
|
+
| flowiseai | Local service port, default 3000 | Bounded loopback ping |
|
|
46
|
+
|
|
47
|
+
For example:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
cmdop-diagnostics gitnexus MY_MACHINE /actual/gitnexus/package.json
|
|
51
|
+
cmdop-diagnostics flowiseai MY_MACHINE 3000
|
|
52
|
+
cmdop-diagnostics-node toolhive MY_MACHINE /actual/thv
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Manifest reads require the relevant file-read grant. The other six profiles
|
|
56
|
+
require the remote exec grant and trusted original binaries/scripts.
|
|
57
|
+
Version flags are not a sandbox for untrusted executables. The Flowise
|
|
58
|
+
operation checks only endpoint reachability. TrustClaw refers only to the
|
|
59
|
+
ComposioHQ self-hosted application manifest, not a public CLI. NanoClaw
|
|
60
|
+
manifest identity is not repository-verified; compare a trusted SHA-256
|
|
61
|
+
digest for exact-byte evidence.
|
|
62
|
+
|
|
63
|
+
## Batch manifest checks
|
|
64
|
+
|
|
65
|
+
Create a local JSON file with an explicit list of 1–16 known installations:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"schema_version": 1,
|
|
70
|
+
"checks": [
|
|
71
|
+
{
|
|
72
|
+
"id": "gitnexus-main",
|
|
73
|
+
"profile": "gitnexus",
|
|
74
|
+
"path": "/actual/gitnexus/package.json",
|
|
75
|
+
"expected_version": "1.6.12"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The optional `sha256` field must be independently obtained from trusted
|
|
82
|
+
original bytes. Do not include credentials. Use the same file with either
|
|
83
|
+
CLI:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
cmdop-diagnostics manifest-batch MY_MACHINE manifest-plan.json
|
|
87
|
+
cmdop-diagnostics-node manifest-batch MY_MACHINE manifest-plan.json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
All entries are validated before connecting. Results are JSON with
|
|
91
|
+
individual outcomes. Exit 0 means all requested checks passed, 2 invalid
|
|
92
|
+
input, 3 SDK or single-operation failure, and 4 a batch with failed or
|
|
93
|
+
mismatched entries. A metadata match is not a service authentication,
|
|
94
|
+
signature or runtime integrity guarantee.
|
|
95
|
+
|
|
96
|
+
No general shell, automatic discovery, installer, bundled SDK, upstream
|
|
97
|
+
implementation, telemetry collection, or automatic package updates are
|
|
98
|
+
provided. Use only authorized machines and trusted original installations.
|
|
99
|
+
Installed-entry acceptance uses isolated SDK transport fixtures, not live
|
|
100
|
+
partner-service verification. MIT applies to the CMDOP diagnostic code.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=80", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cmdop-diagnostics"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Explicit CMDOP diagnostics for authorized machines and known installations"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{name = "CMDOP"}]
|
|
14
|
+
|
|
15
|
+
[project.urls]
|
|
16
|
+
Documentation = "https://github.com/commandoperator/cmdop-sdk"
|
|
17
|
+
Homepage = "https://cmdop.ai"
|
|
18
|
+
|
|
19
|
+
[project.scripts]
|
|
20
|
+
cmdop-diagnostics = "cmdop_diagnostics.runtime.python.remote_diagnostics:main"
|
|
21
|
+
|
|
22
|
+
[tool.setuptools.packages.find]
|
|
23
|
+
where = ["src"]
|
|
24
|
+
|
|
25
|
+
[tool.setuptools.package-data]
|
|
26
|
+
"cmdop_diagnostics" = ["catalog/*.json"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""CMDOP diagnostics; no import-time operation."""
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": 1,
|
|
3
|
+
"profiles": [
|
|
4
|
+
{
|
|
5
|
+
"id": "gitnexus",
|
|
6
|
+
"operation": "version",
|
|
7
|
+
"input": "manifest",
|
|
8
|
+
"languages": [
|
|
9
|
+
"python",
|
|
10
|
+
"node"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "agent-device",
|
|
15
|
+
"operation": "version",
|
|
16
|
+
"input": "manifest",
|
|
17
|
+
"languages": [
|
|
18
|
+
"python",
|
|
19
|
+
"node"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "openclaw",
|
|
24
|
+
"operation": "version",
|
|
25
|
+
"input": "manifest",
|
|
26
|
+
"languages": [
|
|
27
|
+
"python",
|
|
28
|
+
"node"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "picoclaw",
|
|
33
|
+
"operation": "version",
|
|
34
|
+
"input": "binary",
|
|
35
|
+
"languages": [
|
|
36
|
+
"python",
|
|
37
|
+
"node"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "zeroclaw",
|
|
42
|
+
"operation": "version",
|
|
43
|
+
"input": "binary",
|
|
44
|
+
"languages": [
|
|
45
|
+
"python",
|
|
46
|
+
"node"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "nanoclaw",
|
|
51
|
+
"operation": "version",
|
|
52
|
+
"input": "manifest",
|
|
53
|
+
"languages": [
|
|
54
|
+
"python",
|
|
55
|
+
"node"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "mcpjungle",
|
|
60
|
+
"operation": "version",
|
|
61
|
+
"input": "binary",
|
|
62
|
+
"languages": [
|
|
63
|
+
"python",
|
|
64
|
+
"node"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "trustclaw",
|
|
69
|
+
"operation": "version",
|
|
70
|
+
"input": "manifest",
|
|
71
|
+
"languages": [
|
|
72
|
+
"python",
|
|
73
|
+
"node"
|
|
74
|
+
],
|
|
75
|
+
"scope": "ComposioHQ/trustclaw self-hosted application manifest only"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "am-i-vibing",
|
|
79
|
+
"operation": "agent-environment",
|
|
80
|
+
"input": "node-and-cli",
|
|
81
|
+
"languages": [
|
|
82
|
+
"python",
|
|
83
|
+
"node"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "flowiseai",
|
|
88
|
+
"operation": "health",
|
|
89
|
+
"input": "port",
|
|
90
|
+
"languages": [
|
|
91
|
+
"python",
|
|
92
|
+
"node"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "toolhive",
|
|
97
|
+
"operation": "version",
|
|
98
|
+
"input": "binary",
|
|
99
|
+
"languages": [
|
|
100
|
+
"python",
|
|
101
|
+
"node"
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""CMDOP diagnostics; no import-time operation."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""CMDOP diagnostics; no import-time operation."""
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""CMDOP diagnostic for an explicitly selected, trusted upstream am-i-vibing CLI."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import PurePosixPath
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def detect_agent_environment(client, machine, node_path, cli_path):
|
|
8
|
+
"""Run only the documented JSON detection command, without shell or installation."""
|
|
9
|
+
if not isinstance(machine, str) or not machine.strip():
|
|
10
|
+
raise ValueError("Select an authorized machine")
|
|
11
|
+
node = PurePosixPath(node_path)
|
|
12
|
+
cli = PurePosixPath(cli_path)
|
|
13
|
+
if not node.is_absolute() or node.name != "node":
|
|
14
|
+
raise ValueError("Select a trusted absolute Node executable")
|
|
15
|
+
if not cli.is_absolute() or cli.parts[-4:] != ("node_modules", "am-i-vibing", "dist", "cli.mjs"):
|
|
16
|
+
raise ValueError("Select the trusted original am-i-vibing CLI")
|
|
17
|
+
if ".." in node.parts or ".." in cli.parts:
|
|
18
|
+
raise ValueError("Use explicit installation paths")
|
|
19
|
+
result = client.machine(machine).exec.run(
|
|
20
|
+
argv=[node_path, cli_path, "--format", "json"],
|
|
21
|
+
timeout_secs=10, deadline=15,
|
|
22
|
+
)
|
|
23
|
+
if (result.cancelled or result.timed_out or result.truncated
|
|
24
|
+
or result.exit_code not in (0, 1) or len(result.stdout) > 4096):
|
|
25
|
+
raise ValueError("Environment detection failed")
|
|
26
|
+
data = json.loads(result.stdout)
|
|
27
|
+
if not isinstance(data, dict) or set(data) != {"isAgentic", "id", "name", "type"}:
|
|
28
|
+
raise ValueError("Unexpected detection output")
|
|
29
|
+
if type(data["isAgentic"]) is not bool or data["isAgentic"] != (result.exit_code == 0):
|
|
30
|
+
raise ValueError("Unexpected detection status")
|
|
31
|
+
if data["isAgentic"]:
|
|
32
|
+
if data["type"] not in ("agent", "interactive", "hybrid") or not all(
|
|
33
|
+
isinstance(data[key], str) and 0 < len(data[key]) <= 128
|
|
34
|
+
and data[key].isprintable() for key in ("id", "name")
|
|
35
|
+
):
|
|
36
|
+
raise ValueError("Unexpected detected environment")
|
|
37
|
+
elif any(data[key] is not None for key in ("id", "name", "type")):
|
|
38
|
+
raise ValueError("Unexpected negative result")
|
|
39
|
+
return data
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"""Explicit CLI entry for the accepted CMDOP diagnostic source helpers.
|
|
2
|
+
|
|
3
|
+
No installation, discovery, credential handling or service startup.
|
|
4
|
+
"""
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import stat
|
|
8
|
+
from pathlib import Path, PurePosixPath
|
|
9
|
+
import re
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
if __package__:
|
|
13
|
+
from .remote_product_version import product_version
|
|
14
|
+
from .remote_agent_environment import detect_agent_environment
|
|
15
|
+
from .remote_flowise_health import flowise_health
|
|
16
|
+
from .remote_toolhive_version import toolhive_version
|
|
17
|
+
else:
|
|
18
|
+
from remote_product_version import product_version
|
|
19
|
+
from remote_agent_environment import detect_agent_environment
|
|
20
|
+
from remote_flowise_health import flowise_health
|
|
21
|
+
from remote_toolhive_version import toolhive_version
|
|
22
|
+
|
|
23
|
+
CATALOG = Path(__file__).resolve().parents[2] / "catalog/remote-diagnostics.json"
|
|
24
|
+
USAGE = """Usage: python3 remote_diagnostics.py list
|
|
25
|
+
python3 remote_diagnostics.py PROFILE MACHINE [INPUTS]
|
|
26
|
+
python3 remote_diagnostics.py MANIFEST_PROFILE MACHINE PATH --sha256 HEX_DIGEST
|
|
27
|
+
python3 remote_diagnostics.py manifest-batch MACHINE PLAN.json
|
|
28
|
+
Use list for supported profiles and inputs. Select an authorized machine and
|
|
29
|
+
trusted original product paths; no SDK or product is installed by this CLI."""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def profiles():
|
|
33
|
+
data = json.loads(CATALOG.read_text(encoding="utf-8"))
|
|
34
|
+
return {p["id"]: p for p in data["profiles"] if "python" in p["languages"]}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def absolute(value, name=None):
|
|
38
|
+
p = PurePosixPath(value)
|
|
39
|
+
if not p.is_absolute() or ".." in p.parts or (name and p.name != name):
|
|
40
|
+
raise ValueError("Use an absolute trusted original product path")
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
MAX_PLAN_BYTES = 32768
|
|
45
|
+
MAX_MANIFEST_CHECKS = 16
|
|
46
|
+
SAFE_FAILURE_CODES = frozenset({"denied", "permission_missing", "not_found", "offline",
|
|
47
|
+
"timed_out", "unauthorized", "unknown_tool", "tool_refused"})
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def load_manifest_plan(filename):
|
|
51
|
+
"""Read one explicit local JSON plan and validate every entry before connecting."""
|
|
52
|
+
try:
|
|
53
|
+
fd = os.open(filename, os.O_RDONLY | getattr(os, "O_NONBLOCK", 0))
|
|
54
|
+
with os.fdopen(fd, "rb") as stream:
|
|
55
|
+
if not stat.S_ISREG(os.fstat(stream.fileno()).st_mode):
|
|
56
|
+
raise ValueError("Not a regular plan file")
|
|
57
|
+
raw = stream.read(MAX_PLAN_BYTES + 1)
|
|
58
|
+
if len(raw) > MAX_PLAN_BYTES:
|
|
59
|
+
raise ValueError("Plan exceeds size limit")
|
|
60
|
+
plan = json.loads(raw.decode("utf-8"))
|
|
61
|
+
except (OSError, ValueError, RecursionError):
|
|
62
|
+
raise ValueError("Cannot read a valid local manifest plan (maximum 32 KiB)") from None
|
|
63
|
+
return validate_manifest_plan(plan)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def validate_manifest_plan(plan):
|
|
67
|
+
"""Validate an in-memory plan with the same rules as the local file reader."""
|
|
68
|
+
if (not isinstance(plan, dict) or set(plan) != {"schema_version", "checks"}
|
|
69
|
+
or isinstance(plan["schema_version"], bool) or plan["schema_version"] != 1
|
|
70
|
+
or not isinstance(plan["checks"], list)
|
|
71
|
+
or not 1 <= len(plan["checks"]) <= MAX_MANIFEST_CHECKS):
|
|
72
|
+
raise ValueError("Expected schema_version 1 and 1–16 manifest checks")
|
|
73
|
+
allowed = {name for name, profile in profiles().items() if profile["input"] == "manifest"}
|
|
74
|
+
ids, paths, checks = set(), set(), []
|
|
75
|
+
required = {"id", "profile", "path", "expected_version"}
|
|
76
|
+
for row in plan["checks"]:
|
|
77
|
+
if (not isinstance(row, dict) or not required <= set(row)
|
|
78
|
+
or set(row) - required - {"sha256"}):
|
|
79
|
+
raise ValueError("Invalid manifest check fields")
|
|
80
|
+
ident, profile, path, version = (row[k] for k in ("id", "profile", "path", "expected_version"))
|
|
81
|
+
if not isinstance(ident, str) or not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9._-]{0,63}", ident):
|
|
82
|
+
raise ValueError("Invalid manifest check ID")
|
|
83
|
+
if not isinstance(profile, str) or profile not in allowed:
|
|
84
|
+
raise ValueError("Only supported manifest profiles are permitted")
|
|
85
|
+
if (not isinstance(path, str) or len(path) > 4096 or path.startswith("//")
|
|
86
|
+
or "\\" in path or re.search(r"[\x00-\x1f\x7f]", path)
|
|
87
|
+
or str(PurePosixPath(path)) != path):
|
|
88
|
+
raise ValueError("Use a normalized absolute original manifest path")
|
|
89
|
+
absolute(path, "package.json")
|
|
90
|
+
if not isinstance(version, str) or not re.fullmatch(r"[0-9A-Za-z][0-9A-Za-z.+!_-]{0,127}", version):
|
|
91
|
+
raise ValueError("Invalid expected manifest version")
|
|
92
|
+
if "sha256" in row and (not isinstance(row["sha256"], str)
|
|
93
|
+
or not re.fullmatch(r"[0-9a-fA-F]{64}", row["sha256"])):
|
|
94
|
+
raise ValueError("Expected a 64-character SHA-256 digest")
|
|
95
|
+
if ident in ids or path in paths:
|
|
96
|
+
raise ValueError("Duplicate manifest check ID or path")
|
|
97
|
+
ids.add(ident)
|
|
98
|
+
paths.add(path)
|
|
99
|
+
checks.append({**row, **({"sha256": row["sha256"].lower()} if "sha256" in row else {})})
|
|
100
|
+
return checks
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def manifest_batch(client, machine, checks):
|
|
104
|
+
"""One read per validated manifest; no native command or automatic discovery."""
|
|
105
|
+
results = []
|
|
106
|
+
for row in checks:
|
|
107
|
+
item = {"id": row["id"], "profile": row["profile"], "expected_version": row["expected_version"]}
|
|
108
|
+
try:
|
|
109
|
+
observed = product_version(client, machine, row["profile"], row["path"], row.get("sha256"))
|
|
110
|
+
item["version"] = observed["version"]
|
|
111
|
+
for field in ("manifest_sha256", "manifest_sha256_verified"):
|
|
112
|
+
if field in observed:
|
|
113
|
+
item[field] = observed[field]
|
|
114
|
+
item["status"] = "passed" if observed["version"] == row["expected_version"] else "version_mismatch"
|
|
115
|
+
except Exception as error:
|
|
116
|
+
code = getattr(error, "code", None)
|
|
117
|
+
item.update(status="failed", reason=code if isinstance(code, str) and code in SAFE_FAILURE_CODES else "check_failed")
|
|
118
|
+
results.append(item)
|
|
119
|
+
passed = sum(row["status"] == "passed" for row in results)
|
|
120
|
+
return {"scope": "manifest-batch", "machine": machine, "total": len(results),
|
|
121
|
+
"passed": passed, "results": results}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def parse(argv):
|
|
125
|
+
if len(argv) < 2 or not all(isinstance(x, str) and x.strip() for x in argv):
|
|
126
|
+
raise ValueError("Select PROFILE, MACHINE and required inputs")
|
|
127
|
+
name, machine, *args = argv
|
|
128
|
+
if name == "manifest-batch":
|
|
129
|
+
if len(args) != 1:
|
|
130
|
+
raise ValueError("Select one local JSON manifest plan")
|
|
131
|
+
return manifest_batch, (machine, load_manifest_plan(args[0]))
|
|
132
|
+
profile = profiles().get(name)
|
|
133
|
+
if profile is None:
|
|
134
|
+
raise ValueError("Unsupported diagnostic profile; use list")
|
|
135
|
+
kind = profile["input"]
|
|
136
|
+
if kind == "port":
|
|
137
|
+
if len(args) > 1 or (args and not re.fullmatch(r"[0-9]{1,5}", args[0])):
|
|
138
|
+
raise ValueError("Select an optional local service port")
|
|
139
|
+
port = int(args[0]) if args else 3000
|
|
140
|
+
if not 1 <= port <= 65535:
|
|
141
|
+
raise ValueError("Port must be between 1 and 65535")
|
|
142
|
+
return flowise_health, (machine, port)
|
|
143
|
+
if kind == "node-and-cli":
|
|
144
|
+
if len(args) != 2:
|
|
145
|
+
raise ValueError("Select original Node and am-i-vibing CLI paths")
|
|
146
|
+
node, cli = args
|
|
147
|
+
absolute(node, "node")
|
|
148
|
+
absolute(cli, "cli.mjs")
|
|
149
|
+
if PurePosixPath(cli).parts[-4:] != ("node_modules", "am-i-vibing", "dist", "cli.mjs"):
|
|
150
|
+
raise ValueError("Select the trusted original am-i-vibing CLI")
|
|
151
|
+
return detect_agent_environment, (machine, node, cli)
|
|
152
|
+
if kind == "manifest" and len(args) == 3 and args[1] == "--sha256":
|
|
153
|
+
path = absolute(args[0], "package.json")
|
|
154
|
+
if not re.fullmatch(r"[0-9a-fA-F]{64}", args[2]):
|
|
155
|
+
raise ValueError("Expected a 64-character SHA-256 digest")
|
|
156
|
+
return product_version, (machine, name, path, args[2])
|
|
157
|
+
if kind not in {"manifest", "binary"} or len(args) != 1:
|
|
158
|
+
raise ValueError("Select one original manifest or binary path")
|
|
159
|
+
path = absolute(args[0], "package.json" if kind == "manifest" else ("thv" if name == "toolhive" else name))
|
|
160
|
+
if name == "toolhive":
|
|
161
|
+
return toolhive_version, (machine, path)
|
|
162
|
+
return product_version, (machine, name, path)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def main(argv=None, connect=None):
|
|
166
|
+
argv = list(sys.argv[1:] if argv is None else argv)
|
|
167
|
+
if argv in ([], ["--help"], ["-h"]):
|
|
168
|
+
print(USAGE)
|
|
169
|
+
return 0
|
|
170
|
+
if argv == ["list"]:
|
|
171
|
+
print(json.dumps(list(profiles().values())))
|
|
172
|
+
return 0
|
|
173
|
+
try:
|
|
174
|
+
handler, args = parse(argv)
|
|
175
|
+
except ValueError as exc:
|
|
176
|
+
print(str(exc), file=sys.stderr)
|
|
177
|
+
return 2
|
|
178
|
+
try:
|
|
179
|
+
if connect is None:
|
|
180
|
+
from cmdop import connect
|
|
181
|
+
with connect() as client:
|
|
182
|
+
result = handler(client, *args)
|
|
183
|
+
print(json.dumps(result, ensure_ascii=False))
|
|
184
|
+
return 4 if handler is manifest_batch and result["passed"] != result["total"] else 0
|
|
185
|
+
except Exception:
|
|
186
|
+
print("Diagnostic failed. Check SDK configuration, machine permissions, original product inputs and any expected manifest digest.", file=sys.stderr)
|
|
187
|
+
return 3
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
if __name__ == "__main__":
|
|
191
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Check the documented Flowise liveness endpoint on an authorized machine."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def flowise_health(client, machine, port=3000):
|
|
5
|
+
"""One bounded HTTP GET on the selected machine; no credentials or writes."""
|
|
6
|
+
if not isinstance(machine, str) or not machine.strip():
|
|
7
|
+
raise ValueError("Select an authorized machine")
|
|
8
|
+
if type(port) is not int or not 1 <= port <= 65535:
|
|
9
|
+
raise ValueError("Select the local Flowise HTTP port")
|
|
10
|
+
result = client.machine(machine).exec.run(
|
|
11
|
+
argv=["curl", "-q", "--noproxy", "*", "--proto", "=http",
|
|
12
|
+
"--silent", "--show-error", "--fail", "--connect-timeout", "2",
|
|
13
|
+
"--max-time", "5", "--max-filesize", "64", "--write-out",
|
|
14
|
+
"\n%{http_code}", f"http://127.0.0.1:{port}/api/v1/ping"],
|
|
15
|
+
timeout_secs=8, deadline=10,
|
|
16
|
+
)
|
|
17
|
+
if result.cancelled or result.timed_out or result.truncated or result.exit_code != 0:
|
|
18
|
+
raise ValueError("Flowise ping did not complete successfully")
|
|
19
|
+
if result.stdout not in ("pong\n200", "pong\n\n200"):
|
|
20
|
+
raise ValueError("Unexpected Flowise ping response")
|
|
21
|
+
return {"machine": machine, "service": "flowise", "status": "reachable"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Read version metadata or invoke a trusted original product's version command."""
|
|
2
|
+
|
|
3
|
+
from pathlib import PurePosixPath
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
if __package__:
|
|
7
|
+
from .remote_version import remote_version
|
|
8
|
+
else:
|
|
9
|
+
from remote_version import remote_version
|
|
10
|
+
|
|
11
|
+
NPM_PRODUCTS = {
|
|
12
|
+
"gitnexus": "abhigyanpatwari/GitNexus",
|
|
13
|
+
"agent-device": "callstack/agent-device",
|
|
14
|
+
"openclaw": "openclaw/openclaw",
|
|
15
|
+
"nanoclaw": None, # Original source manifest has no repository field.
|
|
16
|
+
"trustclaw": "ComposioHQ/trustclaw",
|
|
17
|
+
}
|
|
18
|
+
NATIVE_PRODUCTS = {
|
|
19
|
+
"picoclaw": ("version", r"^(?:🦞[ \t]*)?picoclaw[ \t]+v?({version})(?:[ \t]+\(git: [0-9a-f]+\))?[ \t]*$"),
|
|
20
|
+
"zeroclaw": ("--version", r"^zeroclaw[ \t]+v?({version})[ \t]*$"),
|
|
21
|
+
"mcpjungle": ("--version", r"^MCPJungle[ \t]+v?({version})[ \t]*$"),
|
|
22
|
+
}
|
|
23
|
+
VERSION = r"[0-9]+\.[0-9]+\.[0-9]+(?:[-+][0-9A-Za-z.+-]{1,100})?"
|
|
24
|
+
ANSI = re.compile(r"\x1b\[[0-9;]*m")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def product_version(client, machine, product, path, expected_sha256=None):
|
|
28
|
+
"""One SDK call for a caller-selected original manifest or trusted binary."""
|
|
29
|
+
if not all(isinstance(x, str) and x.strip() for x in (machine, product, path)):
|
|
30
|
+
raise ValueError("Select machine, product and original installation path")
|
|
31
|
+
target = PurePosixPath(path)
|
|
32
|
+
if not target.is_absolute() or ".." in target.parts:
|
|
33
|
+
raise ValueError("Use an absolute original installation path")
|
|
34
|
+
if product in NPM_PRODUCTS:
|
|
35
|
+
if target.name != "package.json":
|
|
36
|
+
raise ValueError("Select the original npm manifest")
|
|
37
|
+
return remote_version(client, machine, product, path, repository=NPM_PRODUCTS[product],
|
|
38
|
+
expected_sha256=expected_sha256)
|
|
39
|
+
if expected_sha256 is not None:
|
|
40
|
+
raise ValueError("SHA-256 pinning is supported only for manifest diagnostics")
|
|
41
|
+
if product not in NATIVE_PRODUCTS or target.name != product:
|
|
42
|
+
raise ValueError("Select a supported product's trusted original binary")
|
|
43
|
+
arg, pattern = NATIVE_PRODUCTS[product]
|
|
44
|
+
result = client.machine(machine).exec.run(argv=[path, arg], timeout_secs=10, deadline=15)
|
|
45
|
+
if (result.cancelled or result.timed_out or result.truncated or result.exit_code != 0
|
|
46
|
+
or len(result.stdout) > 8192):
|
|
47
|
+
raise ValueError("Product version command failed")
|
|
48
|
+
text = ANSI.sub("", result.stdout).replace("\r\n", "\n")
|
|
49
|
+
versions = re.findall(pattern.format(version=VERSION), text, re.MULTILINE | re.IGNORECASE)
|
|
50
|
+
if len(versions) != 1:
|
|
51
|
+
raise ValueError("Unexpected product version output")
|
|
52
|
+
return {"machine": machine, "name": product, "version": versions[0]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Query an explicitly selected trusted original ToolHive executable via CMDOP."""
|
|
2
|
+
|
|
3
|
+
from pathlib import PurePosixPath
|
|
4
|
+
import re
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def toolhive_version(client, machine, binary_path):
|
|
8
|
+
"""Execute the documented version command, with update checks and metrics disabled."""
|
|
9
|
+
if not isinstance(machine, str) or not machine.strip():
|
|
10
|
+
raise ValueError("Select an authorized machine")
|
|
11
|
+
binary = PurePosixPath(binary_path)
|
|
12
|
+
if not binary.is_absolute() or binary.name != "thv" or ".." in binary.parts:
|
|
13
|
+
raise ValueError("Select the trusted absolute ToolHive CLI path")
|
|
14
|
+
result = client.machine(machine).exec.run(
|
|
15
|
+
argv=[binary_path, "version"],
|
|
16
|
+
env={"TOOLHIVE_SKIP_UPDATE_CHECK": "true", "TOOLHIVE_USAGE_METRICS_ENABLED": "false"},
|
|
17
|
+
timeout_secs=10, deadline=15,
|
|
18
|
+
)
|
|
19
|
+
if (result.cancelled or result.timed_out or result.truncated
|
|
20
|
+
or result.exit_code != 0 or len(result.stdout) > 4096):
|
|
21
|
+
raise ValueError("ToolHive version command failed")
|
|
22
|
+
matches = re.findall(r"^ToolHive v?([0-9]+\.[0-9]+\.[0-9]+(?:[-+][0-9A-Za-z.+-]{1,100})?)\s*$",
|
|
23
|
+
result.stdout, re.MULTILINE)
|
|
24
|
+
if len(matches) != 1:
|
|
25
|
+
raise ValueError("Unexpected or unknown ToolHive release version")
|
|
26
|
+
return {"machine": machine, "service": "toolhive", "version": matches[0]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Read the version of a specifically selected installed package through CMDOP."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import hashlib
|
|
5
|
+
from email.parser import Parser
|
|
6
|
+
import json
|
|
7
|
+
import re
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
MAX_BYTES = 256 * 1024
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def remote_version(client, machine, name, path, *, repository=None, expected_sha256=None):
|
|
14
|
+
"""One bounded read; optionally compare exact manifest bytes with a caller-pinned digest."""
|
|
15
|
+
if not all(isinstance(x, str) and x.strip() for x in (machine, name, path)):
|
|
16
|
+
raise ValueError("Select machine, expected package name and manifest path")
|
|
17
|
+
if expected_sha256 is not None and (not isinstance(expected_sha256, str)
|
|
18
|
+
or not re.fullmatch(r"[0-9a-fA-F]{64}", expected_sha256)):
|
|
19
|
+
raise ValueError("Expected a 64-character SHA-256 digest")
|
|
20
|
+
parts = path.replace("\\", "/").split("/")
|
|
21
|
+
is_python = len(parts) > 1 and parts[-1] == "METADATA" and parts[-2].endswith(".dist-info")
|
|
22
|
+
if parts[-1] != "package.json" and not is_python:
|
|
23
|
+
raise ValueError("Select package.json or .dist-info/METADATA")
|
|
24
|
+
if repository is not None and is_python:
|
|
25
|
+
raise ValueError("Repository checks require npm metadata")
|
|
26
|
+
data = client.machine(machine).fs.read(path=path, max_bytes=MAX_BYTES, deadline=10)
|
|
27
|
+
if (data.truncated or data.encoding != "utf8" or data.offset != 0
|
|
28
|
+
or not 0 < data.size <= MAX_BYTES or len(data.data.encode("utf-8")) != data.size):
|
|
29
|
+
raise ValueError("Incomplete or invalid package metadata")
|
|
30
|
+
manifest_sha256 = None
|
|
31
|
+
if expected_sha256 is not None:
|
|
32
|
+
manifest_sha256 = hashlib.sha256(data.data.encode("utf-8")).hexdigest()
|
|
33
|
+
if manifest_sha256 != expected_sha256.lower():
|
|
34
|
+
raise ValueError("Original manifest SHA-256 mismatch")
|
|
35
|
+
if is_python:
|
|
36
|
+
metadata = Parser().parsestr(data.data, headersonly=True)
|
|
37
|
+
names, versions = metadata.get_all("Name", []), metadata.get_all("Version", [])
|
|
38
|
+
if len(names) != 1 or len(versions) != 1:
|
|
39
|
+
raise ValueError("Invalid distribution metadata")
|
|
40
|
+
actual, version = names[0], versions[0]
|
|
41
|
+
normalize = lambda value: re.sub(r"[-_.]+", "-", value).lower()
|
|
42
|
+
matches = normalize(actual) == normalize(name)
|
|
43
|
+
else:
|
|
44
|
+
metadata = json.loads(data.data)
|
|
45
|
+
actual, version = metadata["name"], metadata["version"]
|
|
46
|
+
matches = actual == name
|
|
47
|
+
if repository is not None:
|
|
48
|
+
repo = metadata.get("repository")
|
|
49
|
+
repo = repo.get("url") if isinstance(repo, dict) else repo
|
|
50
|
+
expected = "https://github.com/" + repository.lower()
|
|
51
|
+
if not isinstance(repo, str) or repo.lower().removeprefix("git+").rstrip("/").removesuffix(".git") != expected:
|
|
52
|
+
raise ValueError("Unexpected upstream repository")
|
|
53
|
+
if not matches or not isinstance(version, str) or not re.fullmatch(r"[0-9A-Za-z][0-9A-Za-z.+!_-]{0,127}", version):
|
|
54
|
+
raise ValueError("Unexpected package identity or version")
|
|
55
|
+
result = {"machine": machine, "name": actual, "version": version}
|
|
56
|
+
if manifest_sha256 is not None:
|
|
57
|
+
result["manifest_sha256"] = manifest_sha256
|
|
58
|
+
result["manifest_sha256_verified"] = True
|
|
59
|
+
return result
|
|
60
|
+
|
|
61
|
+
def main(argv=None, connect=None):
|
|
62
|
+
parser = argparse.ArgumentParser(description="Read an installed package version on an authorized CMDOP machine.")
|
|
63
|
+
parser.add_argument("machine", help="CMDOP machine name or ID")
|
|
64
|
+
parser.add_argument("name", help="Expected original package name")
|
|
65
|
+
parser.add_argument("path", help="Path to package.json or installed .dist-info/METADATA")
|
|
66
|
+
args = parser.parse_args(argv)
|
|
67
|
+
try:
|
|
68
|
+
if connect is None:
|
|
69
|
+
from cmdop import connect
|
|
70
|
+
with connect() as client:
|
|
71
|
+
result = remote_version(client, args.machine, args.name, args.path)
|
|
72
|
+
except Exception:
|
|
73
|
+
print("Version check failed. Check SDK configuration, machine access and the package manifest.", file=sys.stderr)
|
|
74
|
+
return 3
|
|
75
|
+
print(json.dumps(result))
|
|
76
|
+
return 0
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cmdop-diagnostics
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Explicit CMDOP diagnostics for authorized machines and known installations
|
|
5
|
+
Author: CMDOP
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Documentation, https://github.com/commandoperator/cmdop-sdk
|
|
8
|
+
Project-URL: Homepage, https://cmdop.ai
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# CMDOP Diagnostics
|
|
15
|
+
|
|
16
|
+
First-party CMDOP utilities for inspecting explicitly selected, already
|
|
17
|
+
installed software on authorized CMDOP machines. These utilities are not
|
|
18
|
+
the software products named in their diagnostic profiles. No affiliation
|
|
19
|
+
or upstream endorsement is implied.
|
|
20
|
+
|
|
21
|
+
The Python distribution is `cmdop-diagnostics`; the Node.js distribution
|
|
22
|
+
is `@cmdop/diagnostics`. Both expose the same eleven diagnostic profiles.
|
|
23
|
+
Requires Python 3.10+ or Node.js 20+, respectively. The separately installed
|
|
24
|
+
official CMDOP SDK 3.6.1 is the reviewed compatibility baseline.
|
|
25
|
+
|
|
26
|
+
## Install in a separate tools environment
|
|
27
|
+
|
|
28
|
+
Python (a fresh virtual environment, not the private local diagnostics environment):
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
python -m pip install cmdop==3.6.1 cmdop-diagnostics==1.0.0
|
|
32
|
+
cmdop-diagnostics list
|
|
33
|
+
cmdop-diagnostics --help
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Node.js (from a dedicated tools project):
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npm install --save-exact @cmdop/sdk@3.6.1 @cmdop/diagnostics@1.0.0
|
|
40
|
+
npx --no-install cmdop-diagnostics-node list
|
|
41
|
+
npx --no-install cmdop-diagnostics-node --help
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Configure the existing SDK using your own authorized environment and the
|
|
45
|
+
[official SDK documentation](https://github.com/commandoperator/cmdop-sdk).
|
|
46
|
+
The utilities do not install SDKs, obtain credentials, run install hooks,
|
|
47
|
+
or perform any remote operation on import. Help, list and invalid input
|
|
48
|
+
do not connect.
|
|
49
|
+
|
|
50
|
+
## Operations
|
|
51
|
+
|
|
52
|
+
| Profile | Explicit input | Operation |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| gitnexus, agent-device, openclaw, nanoclaw, trustclaw | Original absolute package.json path | Bounded remote manifest read and identity/version check |
|
|
55
|
+
| picoclaw, zeroclaw, mcpjungle | Original absolute executable path | Documented version command |
|
|
56
|
+
| toolhive | Original absolute thv executable path | Version command, with update check and usage metrics disabled |
|
|
57
|
+
| am-i-vibing | Original absolute Node binary and CLI paths | Documented environment detector JSON |
|
|
58
|
+
| flowiseai | Local service port, default 3000 | Bounded loopback ping |
|
|
59
|
+
|
|
60
|
+
For example:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
cmdop-diagnostics gitnexus MY_MACHINE /actual/gitnexus/package.json
|
|
64
|
+
cmdop-diagnostics flowiseai MY_MACHINE 3000
|
|
65
|
+
cmdop-diagnostics-node toolhive MY_MACHINE /actual/thv
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Manifest reads require the relevant file-read grant. The other six profiles
|
|
69
|
+
require the remote exec grant and trusted original binaries/scripts.
|
|
70
|
+
Version flags are not a sandbox for untrusted executables. The Flowise
|
|
71
|
+
operation checks only endpoint reachability. TrustClaw refers only to the
|
|
72
|
+
ComposioHQ self-hosted application manifest, not a public CLI. NanoClaw
|
|
73
|
+
manifest identity is not repository-verified; compare a trusted SHA-256
|
|
74
|
+
digest for exact-byte evidence.
|
|
75
|
+
|
|
76
|
+
## Batch manifest checks
|
|
77
|
+
|
|
78
|
+
Create a local JSON file with an explicit list of 1–16 known installations:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"schema_version": 1,
|
|
83
|
+
"checks": [
|
|
84
|
+
{
|
|
85
|
+
"id": "gitnexus-main",
|
|
86
|
+
"profile": "gitnexus",
|
|
87
|
+
"path": "/actual/gitnexus/package.json",
|
|
88
|
+
"expected_version": "1.6.12"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The optional `sha256` field must be independently obtained from trusted
|
|
95
|
+
original bytes. Do not include credentials. Use the same file with either
|
|
96
|
+
CLI:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
cmdop-diagnostics manifest-batch MY_MACHINE manifest-plan.json
|
|
100
|
+
cmdop-diagnostics-node manifest-batch MY_MACHINE manifest-plan.json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
All entries are validated before connecting. Results are JSON with
|
|
104
|
+
individual outcomes. Exit 0 means all requested checks passed, 2 invalid
|
|
105
|
+
input, 3 SDK or single-operation failure, and 4 a batch with failed or
|
|
106
|
+
mismatched entries. A metadata match is not a service authentication,
|
|
107
|
+
signature or runtime integrity guarantee.
|
|
108
|
+
|
|
109
|
+
No general shell, automatic discovery, installer, bundled SDK, upstream
|
|
110
|
+
implementation, telemetry collection, or automatic package updates are
|
|
111
|
+
provided. Use only authorized machines and trusted original installations.
|
|
112
|
+
Installed-entry acceptance uses isolated SDK transport fixtures, not live
|
|
113
|
+
partner-service verification. MIT applies to the CMDOP diagnostic code.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/cmdop_diagnostics/__init__.py
|
|
5
|
+
src/cmdop_diagnostics.egg-info/PKG-INFO
|
|
6
|
+
src/cmdop_diagnostics.egg-info/SOURCES.txt
|
|
7
|
+
src/cmdop_diagnostics.egg-info/dependency_links.txt
|
|
8
|
+
src/cmdop_diagnostics.egg-info/entry_points.txt
|
|
9
|
+
src/cmdop_diagnostics.egg-info/top_level.txt
|
|
10
|
+
src/cmdop_diagnostics/catalog/remote-diagnostics.json
|
|
11
|
+
src/cmdop_diagnostics/runtime/__init__.py
|
|
12
|
+
src/cmdop_diagnostics/runtime/python/__init__.py
|
|
13
|
+
src/cmdop_diagnostics/runtime/python/remote_agent_environment.py
|
|
14
|
+
src/cmdop_diagnostics/runtime/python/remote_diagnostics.py
|
|
15
|
+
src/cmdop_diagnostics/runtime/python/remote_flowise_health.py
|
|
16
|
+
src/cmdop_diagnostics/runtime/python/remote_product_version.py
|
|
17
|
+
src/cmdop_diagnostics/runtime/python/remote_toolhive_version.py
|
|
18
|
+
src/cmdop_diagnostics/runtime/python/remote_version.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cmdop_diagnostics
|