dc2d2acc82
Scaffold an MVP of the natural-language ops terminal: inventory + intent template registry, SSH/WinRM/local connectors, risk-gated executor with SQLite audit log, Claude-driven agent layer using Function Calling, plus a Typer CLI and FastAPI surface. Includes 10 cross-OS intents (disk/system/service) and example inventory. Verified end-to-end on the local Windows host: hosts/intents listing, check_disk_usage execution, and WRITE-class confirmation gating. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
54 lines
1.8 KiB
YAML
54 lines
1.8 KiB
YAML
# 系统资源与进程相关意图
|
|
intents:
|
|
- intent: check_os_info
|
|
description: 查看操作系统版本与内核信息(用于 facts 探测和人工核对)
|
|
risk_level: READ
|
|
params: []
|
|
implementations:
|
|
linux:
|
|
command: "uname -a && cat /etc/os-release 2>/dev/null || true"
|
|
darwin:
|
|
command: "uname -a && sw_vers"
|
|
windows:
|
|
command: "Get-CimInstance Win32_OperatingSystem | Select-Object Caption,Version,BuildNumber,OSArchitecture | ConvertTo-Json"
|
|
|
|
- intent: check_memory
|
|
description: 查看内存使用情况
|
|
risk_level: READ
|
|
params: []
|
|
implementations:
|
|
linux:
|
|
command: "free -h"
|
|
darwin:
|
|
command: "vm_stat"
|
|
windows:
|
|
command: "Get-CimInstance Win32_OperatingSystem | Select-Object @{N='TotalGB';E={[math]::Round($_.TotalVisibleMemorySize/1MB,2)}},@{N='FreeGB';E={[math]::Round($_.FreePhysicalMemory/1MB,2)}} | ConvertTo-Json"
|
|
|
|
- intent: top_cpu_processes
|
|
description: 查看 CPU 占用最高的 N 个进程
|
|
risk_level: READ
|
|
params:
|
|
- name: top_n
|
|
type: integer
|
|
required: false
|
|
default: 10
|
|
implementations:
|
|
linux:
|
|
command: "ps -eo pid,user,%cpu,%mem,comm --sort=-%cpu | head -n {{top_n + 1}}"
|
|
darwin:
|
|
command: "ps -eo pid,user,%cpu,%mem,comm -r | head -n {{top_n + 1}}"
|
|
windows:
|
|
command: "Get-Process | Sort-Object CPU -Descending | Select-Object -First {{top_n}} Id,ProcessName,CPU,WorkingSet | ConvertTo-Json"
|
|
|
|
- intent: check_uptime
|
|
description: 查看主机已运行时间
|
|
risk_level: READ
|
|
params: []
|
|
implementations:
|
|
linux:
|
|
command: "uptime"
|
|
darwin:
|
|
command: "uptime"
|
|
windows:
|
|
command: "(Get-CimInstance Win32_OperatingSystem).LastBootUpTime"
|