- apps/api: FastAPI backend with Dockerfile - apps/web: Next.js frontend with Dockerfile - apps/sensor: Signal collection agent - packages: shared packages Co-Authored-By: Claude <noreply@anthropic.com>
78 lines
1.3 KiB
TypeScript
78 lines
1.3 KiB
TypeScript
/**
|
|
* ACTION 積木 - 執行器介面
|
|
* 用途: K8s, SSH, Docker, API Call
|
|
*/
|
|
|
|
import type { LeWOOOgoPlugin } from './plugin'
|
|
|
|
/**
|
|
* 操作請求
|
|
*/
|
|
export interface ActionRequest {
|
|
operation: string
|
|
parameters: Record<string, unknown>
|
|
timeout?: number
|
|
dryRun?: boolean
|
|
}
|
|
|
|
/**
|
|
* 操作結果
|
|
*/
|
|
export interface ActionResult {
|
|
success: boolean
|
|
executionId: string
|
|
output?: unknown
|
|
error?: string
|
|
duration: number
|
|
timestamp: Date
|
|
}
|
|
|
|
/**
|
|
* Dry-Run 結果
|
|
*/
|
|
export interface DryRunResult {
|
|
wouldSucceed: boolean
|
|
estimatedChanges: string[]
|
|
warnings?: string[]
|
|
riskAssessment: {
|
|
level: 'low' | 'medium' | 'high' | 'critical'
|
|
reasons: string[]
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Rollback 結果
|
|
*/
|
|
export interface RollbackResult {
|
|
success: boolean
|
|
restoredState?: unknown
|
|
error?: string
|
|
}
|
|
|
|
/**
|
|
* ACTION 執行器 Plugin
|
|
*/
|
|
export interface ActionExecutor extends LeWOOOgoPlugin {
|
|
category: 'ACTION'
|
|
|
|
/**
|
|
* 執行操作
|
|
*/
|
|
execute(action: ActionRequest): Promise<ActionResult>
|
|
|
|
/**
|
|
* 預演 (不實際執行)
|
|
*/
|
|
dryRun(action: ActionRequest): Promise<DryRunResult>
|
|
|
|
/**
|
|
* 回滾操作
|
|
*/
|
|
rollback(executionId: string): Promise<RollbackResult>
|
|
|
|
/**
|
|
* 取得支援的操作列表
|
|
*/
|
|
getSupportedOperations(): string[]
|
|
}
|