mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-10 01:43:16 +08:00
Call netx REST from native netx__* tools.
Drop the local python -m netx_mcp / mcp-client path so terminal users only need API URL + token. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
5179eb74b1
commit
ed219842d3
22 changed files with 1431 additions and 179 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Netx Ops Plugins settings card — apiUrl / lang / python + credential token.
|
||||
* Netx Ops Plugins settings card — apiUrl / lang + credential token.
|
||||
*/
|
||||
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
|
|
@ -147,18 +147,6 @@ export function NetxopsCard(props: NetxopsCardProps) {
|
|||
onEdit={(text) => { props.edit('lang', text) }}
|
||||
onReset={() => { props.resetField('lang') }}
|
||||
/>
|
||||
<ValueField
|
||||
id="netxops-python"
|
||||
label={t('pythonCommand')}
|
||||
hint={t('pythonCommandHint')}
|
||||
field={state.pythonCommand}
|
||||
overriddenLabel={t('overridden')}
|
||||
resetLabel={t('reset')}
|
||||
invalidLabel={t('invalid')}
|
||||
disabled={disabled}
|
||||
onEdit={(text) => { props.edit('pythonCommand', text) }}
|
||||
onReset={() => { props.resetField('pythonCommand') }}
|
||||
/>
|
||||
<div className="dsh-nx-footer">
|
||||
{state.failed ? <p className="dsh-nx-failed" role="status">{t('saveFailed')}</p> : null}
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ const API_TOKEN_FIELD = 'apiToken'
|
|||
export interface NetxopsSettings {
|
||||
apiUrl?: string
|
||||
lang?: string
|
||||
pythonCommand?: string
|
||||
tokenCredentialRef?: string
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +31,6 @@ interface CredentialState {
|
|||
export interface NetxopsCardState extends CardShell {
|
||||
apiUrl: CardFieldState
|
||||
lang: CardFieldState
|
||||
pythonCommand: CardFieldState
|
||||
apiToken: CardFieldState
|
||||
apiTokenConfigured: boolean
|
||||
apiTokenWritable: boolean
|
||||
|
|
@ -66,7 +64,7 @@ export class NetxopsCardController {
|
|||
) {
|
||||
this.form = new CardForm(
|
||||
scope,
|
||||
[textField('apiUrl'), textField('lang'), textField('pythonCommand')],
|
||||
[textField('apiUrl'), textField('lang')],
|
||||
[{ field: API_TOKEN_FIELD, write: text => this.writeToken(text) }],
|
||||
)
|
||||
this.store = this.form.bind(() => this.projection())
|
||||
|
|
@ -91,7 +89,6 @@ export class NetxopsCardController {
|
|||
...this.form.shell(),
|
||||
apiUrl: this.form.field('apiUrl'),
|
||||
lang: this.form.field('lang'),
|
||||
pythonCommand: this.form.field('pythonCommand'),
|
||||
apiToken: this.form.field(API_TOKEN_FIELD),
|
||||
apiTokenConfigured: this.credential.configured,
|
||||
apiTokenWritable: this.credential.remoteReady && this.credential.writable,
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ export type NetxopsLocaleKey =
|
|||
| 'apiUrlHint'
|
||||
| 'lang'
|
||||
| 'langHint'
|
||||
| 'pythonCommand'
|
||||
| 'pythonCommandHint'
|
||||
| 'apiToken'
|
||||
| 'apiTokenHint'
|
||||
| 'apiTokenUnavailable'
|
||||
|
|
@ -28,13 +26,11 @@ export type NetxopsLocaleKey =
|
|||
|
||||
export const en: Record<NetxopsLocaleKey, string> = {
|
||||
title: 'Netx Ops',
|
||||
description: 'UME API endpoint and bearer token for mcp__netx__* tools.',
|
||||
description: 'UME API endpoint and bearer token for netx__* tools.',
|
||||
apiUrl: 'API URL',
|
||||
apiUrlHint: 'netx REST root, e.g. http://127.0.0.1:8890',
|
||||
lang: 'Language',
|
||||
langHint: 'Passed as NETX_LANG (zh / en).',
|
||||
pythonCommand: 'Python command',
|
||||
pythonCommandHint: 'Executable that can run `python -m netx_mcp`.',
|
||||
langHint: 'Response language hint (zh / en).',
|
||||
apiToken: 'API token',
|
||||
apiTokenHint: 'Stored as credential NETX_API_TOKEN (never written into settings). Leave blank to keep the current token.',
|
||||
apiTokenUnavailable: 'This DSH build does not expose remote.credentials. Set the token with scripts/set-netx-token.ps1 (or .sh), then restart is not required if credentials are watched.',
|
||||
|
|
@ -55,13 +51,11 @@ export const en: Record<NetxopsLocaleKey, string> = {
|
|||
|
||||
export const zh: Record<NetxopsLocaleKey, string> = {
|
||||
title: 'Netx Ops',
|
||||
description: 'UME API 地址与 Bearer Token,供 mcp__netx__* 工具使用。',
|
||||
description: 'UME API 地址与 Bearer Token,供 netx__* 工具使用。',
|
||||
apiUrl: 'API 地址',
|
||||
apiUrlHint: 'netx REST 根地址,例如 http://127.0.0.1:8890',
|
||||
lang: '语言',
|
||||
langHint: '传给 MCP 的 NETX_LANG(zh / en)。',
|
||||
pythonCommand: 'Python 命令',
|
||||
pythonCommandHint: '能执行 `python -m netx_mcp` 的解释器。',
|
||||
langHint: '响应语言提示(zh / en)。',
|
||||
apiToken: 'API Token',
|
||||
apiTokenHint: '写入凭据 NETX_API_TOKEN(不会进 settings)。留空表示保留已有 token。',
|
||||
apiTokenUnavailable: '当前 DSH 未提供 remote.credentials。请用 scripts/set-netx-token.ps1(或 .sh)写入 token;若 harness 在监视凭据文件则无需重启。',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue