Add Netx Ops Plugins settings card for URL and token.

Ship the browser half so Settings → Plugins can configure apiUrl/lang/python and NETX_API_TOKEN without OS env vars.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-04 22:16:14 +08:00
parent 45922ffd29
commit fd1a86ec2f
14 changed files with 1492 additions and 57 deletions

View file

@ -11,9 +11,9 @@ pip install "git+https://github.com/hansjone/netx.git#subdirectory=packages/netx
python -c "import netx_mcp; print('ok')"
```
You do **not** need to export `NETX_API_URL` / `NETX_API_TOKEN` in the OS environment for normal use.
You do **not** need OS environment variables for `NETX_API_URL` / `NETX_API_TOKEN`.
## 1) Install host bridge (URL + token + MCP tools)
## 1) Install host bridge + Plugins settings card
```bash
dsh plugin --profile <name> add github:hansjone/netxops
@ -21,43 +21,25 @@ dsh plugin --profile <name> add github:hansjone/netxops
dsh plugin --profile <name> add /path/to/netxops
```
This applies `cordis.patch.yml`, which mounts package `dsh-netxops`. That plugin:
This mounts `dsh-netxops` (host + browser halves):
- Registers settings namespace **`netxops`** (`apiUrl`, `lang`, `pythonCommand`, …)
- Reads bearer token from credentials reference **`NETX_API_TOKEN`** (same store as model keys: `~/.dsh/.credentials.yaml`)
- Spawns `python -m netx_mcp` and registers `mcp__netx__*` on the **host** tool registry
- Host: settings namespace **`netxops`**, credential **`NETX_API_TOKEN`**, spawns `mcp__netx__*`
- Browser: **Settings → Plugins → Netx Ops** card (API URL / lang / python + token)
### Fill API URL / language
### Fill in the UI (recommended)
**Target UX:** Settings → **Plugins** → **Netx Ops** card (settings `apiUrl` / `lang`).
The Host settings namespace is already registered; a dedicated Plugins settings card (browser half) follows the [DSH settings-card cookbook](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/cookbook/adding-a-settings-card.md) and will land in a follow-up.
1. Open `dsh web` → **Settings** → **Plugins** → **Plugin configuration**
2. Expand **Netx Ops**
3. Paste **API token** (stored as credential `NETX_API_TOKEN`, never in settings JSON)
4. Set **API URL** (e.g. `http://127.0.0.1:8890`), optional lang / python command
5. **Save** — MCP remounts with the new values
**Until the card ships**, change composition defaults in the profile patch / plugin config:
```yaml
# ~/.dsh/profiles/<name>/… or override the dsh-netxops row
config:
apiUrl: http://10.0.0.5:8890
lang: zh
pythonCommand: python
```
Or edit the installed bundle row after `dsh plugin add`.
### Fill netx API token (secret)
Same credential store as DeepSeek API keys — **not** a process env var:
### Optional CLI for token only
```powershell
powershell -File .\scripts\set-netx-token.ps1 -Token "nxt_…"
```
```bash
./scripts/set-netx-token.sh 'nxt_…'
```
This writes / updates `refs.NETX_API_TOKEN` under `%USERPROFILE%\.dsh\.credentials.yaml` (or `$DSH_HOME`). Restart is not required if DSH is watching credentials; otherwise restart `dsh web`.
## 2) Install the agent preset (persona + skills)
```powershell
@ -72,12 +54,18 @@ Open `dsh web`, new session → preset **Netx Ops**.
## Verify
1. Tools include `mcp__netx__queryUmeAlarms` (and siblings).
2. “Critical Top by host” → aggregate + Result/Evidence shell.
3. Single `host_name` alarm query → host-scoped tools only.
1. Settings → Plugins shows **Netx Ops** card; token badge becomes “Configured” after save.
2. Tools include `mcp__netx__queryUmeAlarms` (and siblings).
3. “Critical Top by host” / single `host_name` alarm query work.
See [TOOL_MAP.md](TOOL_MAP.md).
## Local debug (DeepSeekHarness checkout)
See [examples/local-debug/README.md](../examples/local-debug/README.md).
Rebuild the Plugins card after editing `src/client/`:
```powershell
bun run bundle
```

View file

@ -11,7 +11,7 @@
Adaptations: removed oclaw Admin / WhatsApp / `ume_alarm_xlsx_report` / wiki capture / skill_auto_install; fiber/offline recipes use Raw/aggregate MCP only.
**Config UX:** not OS env. Token via DSH credentials (same as model keys); `apiUrl` via settings / composition config. Plugins settings **card** (browser half) TBD per DSH cookbook.
**Config UX:** Settings → Plugins → **Netx Ops** card (`src/client/` → `lib/client.js`). Token via credentials `NETX_API_TOKEN`; `apiUrl` / `lang` / `pythonCommand` via settings namespace `netxops`.
## Stay in oclaw
@ -19,7 +19,6 @@ Gateway, WhatsApp/Weixin, Admin MCP UI, specialist router, memory-wiki, ops-ai H
## Phase 2 candidates
- Plugins settings card (`dsh.client`) for apiUrl + token on Settings → Plugins
- `ume_alarm_xlsx_report` + thin HTTP client as a DSH tool plugin
- UME sync context inject
- `ops-ip-knowledge-playbook` + KB content