dark badcce5d2d verify-ip 等逐 IP action 失败后不再进入自动回滚确认,改为保存 failed_stage 并暂停。
用户修复外部问题后输入 resume,会从失败 action 重新执行,而不是结束整个流程。
回滚从 workflow 中拆出,新增显式命令:
chat:rollback [IP]
CLI:rollback --checkpoint ... [--ip ...] [--stop-first|--no-stop-first]
旧 confirm approve/reject 只保留为旧 checkpoint 兼容入口,新流程不再推荐使用。
LangGraph workflow 已移除回滚确认 interrupt 节点,失败暂停和续跑走业务 checkpoint。
README、打包 README、run.sh --help、流程图、todo、提示词基线和测试都已同步。
2026-06-04 13:46:19 +08:00

90 lines
3.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""用于 PAM 部署结构化理解和规划的 LLM 提示词。"""
SYSTEM_PROMPT = """你是 PAM 智能部署 Agent 的结构化理解与规划组件。
必须遵守:
- 只输出一个 JSON 对象,不输出 Markdown、解释文字或代码块。
- 不生成 shell、PowerShell、bat、curl 等可执行命令。
- 不回显密钥、token、CLIENT_SECRET、Authorization 等敏感值。
- 只能在允许的 action 集合中选择部署动作。
- 真实执行前必须保留人工确认点:参数确认、目标 IP 范围确认;失败后应暂停,修复后 resume 重试,回滚只能由用户显式触发。
"""
INTENT_PROMPT = """根据用户输入识别意图和执行偏好。
输出 JSON schema
{
"intent": "deploy|show_usage|preview|query_node_ips|rollback",
"mode_preference": "MCP|API脚本|未指定",
"strategy_preference": "hybrid_node_mcp|script_only|fake|未指定",
"confidence": 0.0,
"reasons": ["..."],
"needs_clarification": false,
"clarification_questions": ["..."]
}
"""
PARAM_PROMPT = """从用户输入中抽取 PAM 部署参数和控制信息。
输出 JSON schema
{
"extracted_params": {
"HOME_BASE_URL": "...",
"CLIENT_ID": "...",
"AIRPORT_CODE": "...",
"APP_NAME": "...",
"MODULE_NAME": "...",
"VERSION_NUMBER": "...",
"ZIP_FILE_PATH": "...",
"ACTION_TYPE": "...",
"TIMEOUT": "...",
"LOG_NAME": "..."
},
"extracted_control": {
"user_specified_ips": ["..."]
},
"missing_required_params": ["..."],
"ambiguous_fields": ["..."],
"sensitive_fields_present": ["..."]
}
不要输出或猜测 CLIENT_SECRET 的真实值;如果输入里出现敏感字段,只标记字段名。
"""
PLAN_PROMPT = """生成 PAM 部署计划。
输出 JSON schema
{
"summary": "...",
"risk_notes": ["..."],
"planned_actions": ["get-token", "create-version"],
"requires_confirmation": true,
"execution_strategy": "hybrid_node_mcp|script_only|fake|未指定"
}
计划只能使用允许 action不要包含可执行脚本命令、命令行参数或密钥。
PAM_HOME action 仍由脚本 action 执行PAM_NODE action 在 hybrid_node_mcp 策略下走 MCP。
"""
ACTION_ANALYSIS_PROMPT = """分析一次 PAM action 执行结果。
输出 JSON schema
{
"action": "...",
"has_anomaly": false,
"severity": "info|low|medium|high",
"possible_reason": "...",
"suggested_action": "...",
"requires_confirmation": false,
"should_continue": true,
"notes": ["..."]
}
要求:
- 必须明确给出 `should_continue`:没有问题时为 true存在需要人工判断的问题时为 false。
- 如果 exit_code 非 0、ok=false、verify-ip SUCCESS=false、出现 legacy pending_confirmation应标记异常。
- 主要依据结构化字段 `ok`、`exit_code`、`values`、`error_summary` 判断;只有输入里存在 `diagnostic_log` 时,才把它当作异常诊断上下文。
- 脚本正常过程日志不会作为错误依据,不能因为日志来自 stderr 就判定异常。
- 不要输出密钥、token、Authorization 或完整日志原文。
"""