Files
materials/project/ai-agent-scafford-go/tools/outline.json

381 lines
22 KiB
JSON
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.
{
"site": {
"id": "ai-agent-scaffold-go",
"logo": "AG",
"name": "AI Agent 脚手架项目学习",
"title": "AI Agent 脚手架项目学习 · Go 智能体框架源码拆解",
"sub": "Go + Agent · 源码拆解 / 装配链 / 面试模拟",
"desc": "围绕 ai-agent-scaffold-go 这套配置驱动的 Go AI Agent 脚手架的学习站:六个篇章、二十二章,从项目全景、前置知识、源码拆解,到缺陷清单、面试追问与故障场景还原。",
"repo": "ai-agent-scaffold-go",
"repoUrl": "",
"themeKey": "ai-agent-scaffold-go:theme",
"progressKey": "ai-agent-scaffold-go:progress"
},
"levels": [
{ "id": "L1", "name": "能跑能演示", "goal": "起服务、列出 Agent、建会话、发一条消息、看到流式输出" },
{ "id": "L2", "name": "面试级理解", "goal": "讲清三层配置、责任链装配、工具调用循环、SSE 流与 MCP 发现" },
{ "id": "L3", "name": "抗追问能力", "goal": "答得住重名工具、会话不持久、并发安全、无鉴权与超时取舍" },
{ "id": "L4", "name": "可独立复刻", "goal": "关掉文档复刻核心链路:配置加载、Armory 装配、Agent 运行、HTTP 层" },
{ "id": "L5", "name": "抽象成方法论", "goal": "上升为 Agent 脚手架通用框架:配置驱动、端口适配、编排与演进" }
],
"parts": [
{
"no": "0",
"name": "前言 · 先建立地图",
"note": "先确认这个脚手架到底是什么、能演示什么、按什么节奏读,再决定读到多深。",
"chapters": [
{
"file": "01-overview.html",
"title": "项目全景:这个 Agent 脚手架是什么",
"desc": "从一句定位、功能地图、技术栈与工程规模出发,交代一次对话的完整旅程、三层装配结构,以及这个项目有意保留的短板。",
"keywords": "AI Agent,脚手架,Go,Gin,ADK,Eino,MCP,项目概览",
"level": "L1",
"sections": [
{ "id": "sec-1-1", "title": "1.1 一句话定位:它解决什么问题" },
{ "id": "sec-1-2", "title": "1.2 功能地图:能演示的五类能力" },
{ "id": "sec-1-3", "title": "1.3 技术栈与工程规模:先看真实数字" },
{ "id": "sec-1-4", "title": "1.4 一次对话的完整旅程" },
{ "id": "sec-1-5", "title": "1.5 三层装配:配置、Armory、运行时" },
{ "id": "sec-1-6", "title": "1.6 这个项目的边界:已知短板与刻意取舍" }
]
},
{
"file": "02-roadmap.html",
"title": "学习路线:五级目标、阅读节奏与产出",
"desc": "把项目学习拆成五级目标与三种节奏,给出每一级的达标标准、证明方式,以及学完之后应该拿得出的产出清单。",
"keywords": "学习路线,项目学习,节奏表,成熟度,产出清单",
"level": "L1",
"sections": [
{ "id": "sec-2-1", "title": "2.1 五级目标:从能跑能演示到方法论" },
{ "id": "sec-2-2", "title": "2.2 每一级的达标标准与证明方式" },
{ "id": "sec-2-3", "title": "2.3 三种节奏:半天、三天与一周" },
{ "id": "sec-2-4", "title": "2.4 目录地图:先看哪几个文件" },
{ "id": "sec-2-5", "title": "2.5 三份事实源:源码、完善报告、待实现清单" },
{ "id": "sec-2-6", "title": "2.6 先把项目跑起来:最小启动路径" }
]
}
]
},
{
"no": "1",
"name": "知识学习 · 补齐前置",
"note": "读源码之前先把会用到的语言、Web 与 Agent 协议基础补齐,避免边读边查。",
"chapters": [
{
"file": "03-basics-go.html",
"title": "Go 与 Web 基础:Gin、YAML、SSE 与泛型",
"desc": "只讲这个项目真正用到的部分:Gin 的请求生命周期、结构体标签与 YAML 映射、依赖倒置、四个并发原语、SSE 与泛型。",
"keywords": "Go,Gin,YAML,接口,并发,SSE,泛型",
"level": "L1",
"sections": [
{ "id": "sec-3-1", "title": "3.1 一个 HTTP 请求在 Gin 里的生命周期" },
{ "id": "sec-3-2", "title": "3.2 结构体标签与 YAML 映射" },
{ "id": "sec-3-3", "title": "3.3 接口与依赖倒置:端口-适配器" },
{ "id": "sec-3-4", "title": "3.4 四个并发原语:goroutine、channel、atomic、sync" },
{ "id": "sec-3-5", "title": "3.5 SSE:服务端单向推送怎么工作" },
{ "id": "sec-3-6", "title": "3.6 泛型:Handler 与响应信封里的类型参数" }
]
},
{
"file": "04-basics-agent.html",
"title": "AI Agent 前置:模型协议、工具调用与 MCP",
"desc": "把 Chat Completions、Function Calling、MCP、Skill 这四件事讲到能直接对上代码的程度,重点讲清一轮工具调用的闭环。",
"keywords": "LLM,Chat Completions,Function Calling,MCP,JSON-RPC,Skill,流式",
"level": "L1",
"sections": [
{ "id": "sec-4-1", "title": "4.1 Chat Completions 协议:消息角色与字段" },
{ "id": "sec-4-2", "title": "4.2 工具调用闭环:模型说要用什么,谁来执行" },
{ "id": "sec-4-3", "title": "4.3 MCP:一个标准化的工具协议" },
{ "id": "sec-4-4", "title": "4.4 MCP 的 SSE 传输与 JSON-RPC 2.0" },
{ "id": "sec-4-5", "title": "4.5 Skill:把长提示词拆成可复用目录" },
{ "id": "sec-4-6", "title": "4.6 流式输出与增量拼接的两个难点" }
]
}
]
},
{
"no": "2",
"name": "项目拆解 · 追源码",
"note": "本站主体:按「配置 → 装配 → 运行时 → 接口 → 前端 → 部署」的顺序把源码读完,每个模块都落到文件、函数与结构体。",
"chapters": [
{
"file": "05-bootstrap.html",
"title": "启动与装配:main → bootstrap → Gin",
"desc": "从 main.go 的六个步骤到 bootstrap.Build 的手工装配清单,解释这个项目为什么没有 DI 容器,以及中间件与启动失败的排查顺序。",
"keywords": "main,bootstrap,依赖注入,Gin,中间件,CORS",
"level": "L2",
"sections": [
{ "id": "sec-5-1", "title": "5.1 main.go 的六个步骤" },
{ "id": "sec-5-2", "title": "5.2 bootstrap.Build 的手工装配清单" },
{ "id": "sec-5-3", "title": "5.3 为什么不用 DI 容器" },
{ "id": "sec-5-4", "title": "5.4 路由、中间件与 CORS" },
{ "id": "sec-5-5", "title": "5.5 启动失败的五个常见原因" }
]
},
{
"file": "06-config.html",
"title": "配置体系:三层配置怎么生效",
"desc": "讲清 .env、application.yaml、agent YAML 三层的优先级,${VAR:-default} 展开的实现细节,默认值注入与校验规则,以及配置层的已知缺口。",
"keywords": "配置,dotenv,application.yaml,环境变量,校验,默认值",
"level": "L2",
"sections": [
{ "id": "sec-6-1", "title": "6.1 三层优先级:.env、application.yaml、agent YAML" },
{ "id": "sec-6-2", "title": "6.2 ${VAR:-default} 展开的实现细节" },
{ "id": "sec-6-3", "title": "6.3 默认值注入与校验规则" },
{ "id": "sec-6-4", "title": "6.4 为什么 application.yaml 不做变量替换" },
{ "id": "sec-6-5", "title": "6.5 多文件 agent 表的合并逻辑" }
]
},
{
"file": "07-domain-ports.html",
"title": "领域模型与端口:接口清单",
"desc": "逐个过 model 包的结构体与 ports 包的 14 个接口,说明内存实现为什么够用、端口设计有哪些取舍,以及领域层为什么不含 HTTP。",
"keywords": "领域模型,端口,ports,接口,内存实现,六边形",
"level": "L2",
"sections": [
{ "id": "sec-7-1", "title": "7.1 领域模型全景:三个文件的职责划分" },
{ "id": "sec-7-2", "title": "7.2 配置模型:一张表怎么描述一个 Agent" },
{ "id": "sec-7-3", "title": "7.3 运行时模型:ChatCommand、ChatContent 与 RegisteredAgent" },
{ "id": "sec-7-4", "title": "7.4 端口清单:14 个接口逐个看" },
{ "id": "sec-7-5", "title": "7.5 两个内存实现:Registry 与 SessionStore" },
{ "id": "sec-7-6", "title": "7.6 接口设计的三处争议:空接口、缺 context、无人实现的 ToolDescriptor" }
]
},
{
"file": "08-armory.html",
"title": "Armory 装配链:责任链把 YAML 变成 Agent",
"desc": "拆解 Root → AiAPI → ChatModel → Agent → AgentWorkflow → Runner 六节点责任链,讲清 DynamicContext 的职责与一次装配的完整轨迹。",
"keywords": "Armory,责任链,泛型,装配,DynamicContext,注册表",
"level": "L2",
"sections": [
{ "id": "sec-8-1", "title": "8.1 责任链模式与泛型 Handler" },
{ "id": "sec-8-2", "title": "8.2 六个节点的职责与顺序" },
{ "id": "sec-8-3", "title": "8.3 DynamicContext:一次装配的上下文" },
{ "id": "sec-8-4", "title": "8.4 从 YAML 表到注册表的完整轨迹" },
{ "id": "sec-8-5", "title": "8.5 递归改循环:一条待实现的改造" }
]
},
{
"file": "09-workflow.html",
"title": "工作流编排:sequential / parallel / loop",
"desc": "讲清三种工作流的配置写法、顺序执行的变量作用域与 {output-key} 模板替换,并如实交代并行与循环目前的真实行为。",
"keywords": "工作流,sequential,parallel,loop,模板替换,子 Agent",
"level": "L2",
"sections": [
{ "id": "sec-9-1", "title": "9.1 三种工作流的 YAML 写法" },
{ "id": "sec-9-2", "title": "9.2 顺序执行与 scope 变量传递" },
{ "id": "sec-9-3", "title": "9.3 {output-key} 模板替换" },
{ "id": "sec-9-4", "title": "9.4 并行与循环的真实现状" },
{ "id": "sec-9-5", "title": "9.5 子 Agent 名称解析与装配顺序的坑" }
]
},
{
"file": "10-runtime.html",
"title": "Agent 运行时:工具调用循环与流式",
"desc": "拆 runLLM 的四步循环与 streamLLM 的 Done 语义,讲清 Runner 的会话、插件生命周期,以及会话 ID 生成方式的缺陷。",
"keywords": "Agent运行时,工具调用循环,流式,Runner,插件,会话",
"level": "L3",
"sections": [
{ "id": "sec-10-1", "title": "10.1 ADK 包在这里承担什么" },
{ "id": "sec-10-2", "title": "10.2 runLLM:四步循环怎么收敛" },
{ "id": "sec-10-3", "title": "10.3 streamLLM 与 Done 语义" },
{ "id": "sec-10-4", "title": "10.4 Runner:会话、插件与生命周期" },
{ "id": "sec-10-5", "title": "10.5 会话 ID 的生成方式与缺陷" }
]
},
{
"file": "11-model-client.html",
"title": "模型层:OpenAI 兼容客户端",
"desc": "从请求体构造、消息编码、工具 schema 的简化,到 SSE 增量解析与 tool_call 分片拼接,再到超时与错误处理的缺口。",
"keywords": "OpenAI,chat completions,SSE,流式,tool_calls,超时",
"level": "L3",
"sections": [
{ "id": "sec-11-1", "title": "11.1 请求体构造与消息编码" },
{ "id": "sec-11-2", "title": "11.2 工具 schema 的简化:只有 query 参数" },
{ "id": "sec-11-3", "title": "11.3 SSE 流解析与 tool_call 拼接" },
{ "id": "sec-11-4", "title": "11.4 超时、错误处理与重试缺口" },
{ "id": "sec-11-5", "title": "11.5 为什么叫 Eino 适配器却不是 Eino" }
]
},
{
"file": "12-mcp.html",
"title": "MCP 工具:SSE 客户端与全局路由",
"desc": "讲清 GET /sse 建连、endpoint 事件、JSON-RPC 请求-响应匹配与 tools/list 自动发现,并复现全局 router 下同名工具冲突的故障。",
"keywords": "MCP,SSE,JSON-RPC,tools/list,工具路由,发现",
"level": "L3",
"sections": [
{ "id": "sec-12-1", "title": "12.1 连接建立:GET /sse 与 endpoint 事件" },
{ "id": "sec-12-2", "title": "12.2 JSON-RPC 请求-响应匹配" },
{ "id": "sec-12-3", "title": "12.3 tools/list 自动发现与展开" },
{ "id": "sec-12-4", "title": "12.4 全局 router 与同名工具的冲突" },
{ "id": "sec-12-5", "title": "12.5 stdio 与 local:配置能写、运行不通" }
]
},
{
"file": "13-skills.html",
"title": "Skill 机制:SKILL.md 扫描与命名",
"desc": "讲清技能目录约定、front matter 解析、相对路径的四类候选解析与工具命名规则,并说明技能目前只出现在工具列表里这件事。",
"keywords": "Skill,SKILL.md,front matter,路径解析,工具命名",
"level": "L2",
"sections": [
{ "id": "sec-13-1", "title": "13.1 目录约定与 front matter" },
{ "id": "sec-13-2", "title": "13.2 路径解析的四类候选" },
{ "id": "sec-13-3", "title": "13.3 工具命名、清洗与冲突" },
{ "id": "sec-13-4", "title": "13.4 技能在对话中的真实作用" },
{ "id": "sec-13-5", "title": "13.5 与 MCP 工具的分工" }
]
},
{
"file": "14-http-api.html",
"title": "HTTP 接口层:五个端点",
"desc": "过一遍路由注册、统一响应信封与错误码、四个业务接口的请求响应、SSE 流式写法,以及这一层最要命的安全缺口。",
"keywords": "HTTP,API,Gin,响应信封,错误码,SSE,鉴权",
"level": "L2",
"sections": [
{ "id": "sec-14-1", "title": "14.1 路由注册与分组" },
{ "id": "sec-14-2", "title": "14.2 统一响应信封与错误码" },
{ "id": "sec-14-3", "title": "14.3 四个业务接口的请求与响应" },
{ "id": "sec-14-4", "title": "14.4 SSE 流式接口的实现与局限" },
{ "id": "sec-14-5", "title": "14.5 安全缺口:没有鉴权与租户隔离" }
]
},
{
"file": "15-frontend.html",
"title": "前端:Next.js + draw.io 交互绘图",
"desc": "从前端三栏布局与会话持久化,到画布上下文注入、XML 识别与后端交互时序,最后列出前端的已知问题。",
"keywords": "前端,Next.js,draw.io,会话,localStorage,上下文注入",
"level": "L2",
"sections": [
{ "id": "sec-15-1", "title": "15.1 三栏布局:历史、画布、对话" },
{ "id": "sec-15-2", "title": "15.2 会话模型与 localStorage 持久化" },
{ "id": "sec-15-3", "title": "15.3 画布上下文注入与 XML 识别" },
{ "id": "sec-15-4", "title": "15.4 与后端的完整交互时序" },
{ "id": "sec-15-5", "title": "15.5 前端的已知问题与改进点" }
]
},
{
"file": "16-infra-deploy.html",
"title": "基础设施与部署",
"desc": "交代 MySQL / Redis 适配器与未接线的现状、Compose 的端口与依赖、日志与探针,最后给一份从脚手架到服务的生产化清单。",
"keywords": "MySQL,Redis,Docker Compose,日志,探针,部署",
"level": "L2",
"sections": [
{ "id": "sec-16-1", "title": "16.1 MySQL / Redis 适配器与未接线现状" },
{ "id": "sec-16-2", "title": "16.2 docker compose:端口与依赖" },
{ "id": "sec-16-3", "title": "16.3 日志、探针与启动参数" },
{ "id": "sec-16-4", "title": "16.4 生产化清单:从脚手架到服务" }
]
}
]
},
{
"no": "3",
"name": "缺陷与演进",
"note": "把项目完善报告里的缺陷按级别读一遍,再给出可验收的改造顺序与扩展姿势。",
"chapters": [
{
"file": "17-defects-p0.html",
"title": "缺陷清单:P0 级问题逐条拆",
"desc": "按装配期、运行期、安全三类拆开 P0 缺陷:重名 MCP 导致占位工具、会话不持久、并发安全、无鉴权与明文密钥,并给出复现步骤。",
"keywords": "缺陷,P0,重名工具,并发安全,鉴权,复现",
"level": "L3",
"sections": [
{ "id": "sec-17-1", "title": "17.1 缺陷分级方法与资料来源" },
{ "id": "sec-17-2", "title": "17.2 装配期:重名 MCP 与占位工具" },
{ "id": "sec-17-3", "title": "17.3 运行期:会话不持久与并发安全" },
{ "id": "sec-17-4", "title": "17.4 安全:无鉴权、Key 明文与 CORS 全开" },
{ "id": "sec-17-5", "title": "17.5 复现步骤与验证方式" }
]
},
{
"file": "18-defects-p1.html",
"title": "P1 / P2 问题与工程化改造",
"desc": "把 P1 的正确性与健壮性问题、P2 的可维护性与扩展性问题分层列出,给出改造顺序、收益判断与一份可验收修复方案的结构。",
"keywords": "P1,P2,健壮性,可维护性,改造顺序,验收",
"level": "L3",
"sections": [
{ "id": "sec-18-1", "title": "18.1 P1:正确性与健壮性" },
{ "id": "sec-18-2", "title": "18.2 P2:可维护性与扩展性" },
{ "id": "sec-18-3", "title": "18.3 建议的改造顺序与收益" },
{ "id": "sec-18-4", "title": "18.4 怎么写一份可验收的修复方案" }
]
},
{
"file": "19-extension.html",
"title": "扩展指南:加 Agent、工具与插件",
"desc": "六种最常见的扩展动作:只改 YAML 加 Agent、接新 MCP 服务、写本地工具、写 RunnerPlugin、加工作流类型、加 HTTP 端点。",
"keywords": "扩展,新增Agent,MCP,本地工具,插件,工作流,端点",
"level": "L4",
"sections": [
{ "id": "sec-19-1", "title": "19.1 只改 YAML 加一个 Agent" },
{ "id": "sec-19-2", "title": "19.2 接入一个新的 MCP 服务" },
{ "id": "sec-19-3", "title": "19.3 写一个本地工具与路由" },
{ "id": "sec-19-4", "title": "19.4 写一个 RunnerPlugin" },
{ "id": "sec-19-5", "title": "19.5 新增一种工作流类型" },
{ "id": "sec-19-6", "title": "19.6 新增一个 HTTP 端点" }
]
}
]
},
{
"no": "4",
"name": "场景还原 · 端到端",
"note": "把前面读到的碎片串成五条链路,再逐个制造故障看系统怎么表现,最后练表达。",
"chapters": [
{
"file": "20-flows.html",
"title": "五条核心链路的端到端还原",
"desc": "从 YAML 到可对话 Agent、一次带工具调用的对话、一段流式输出的字节流、一次前端绘图请求、一条会断的 Skill 调用链,五条链路逐跳走过,并给出三类故障现场与日志串链方法。",
"keywords": "端到端,链路,工具调用,流式,前端,Skill,故障,排查",
"level": "L3",
"sections": [
{ "id": "sec-20-1", "title": "20.1 链路一:YAML 到可对话 Agent" },
{ "id": "sec-20-2", "title": "20.2 链路二:一次带工具调用的对话" },
{ "id": "sec-20-3", "title": "20.3 链路三:流式输出的字节流" },
{ "id": "sec-20-4", "title": "20.4 链路四:前端一次绘图请求" },
{ "id": "sec-20-5", "title": "20.5 链路五:一条会断的 Skill 调用链" },
{ "id": "sec-20-6", "title": "20.6 故障现场:启动失败、工具 404、流中断" },
{ "id": "sec-20-7", "title": "20.7 用日志把链路串起来" }
]
},
{
"file": "21-interview.html",
"title": "面试模拟:把项目讲出来",
"desc": "30 秒与 3 分钟两个讲述版本、十五个高频追问、主动抛出深水区的技巧、与 LangChain / Dify 的横向对比,以及配套题库怎么用。",
"keywords": "面试,项目讲述,追问,横向对比,题库",
"level": "L3",
"sections": [
{ "id": "sec-21-1", "title": "21.1 30 秒版本与 3 分钟版本" },
{ "id": "sec-21-2", "title": "21.2 高频追问十五问" },
{ "id": "sec-21-3", "title": "21.3 追问引导:主动抛出深水区" },
{ "id": "sec-21-4", "title": "21.4 横向对比:脚手架与 LangChain / Dify" },
{ "id": "sec-21-5", "title": "21.5 配套题库:289 道题怎么用" }
]
}
]
},
{
"no": "5",
"name": "收尾 · 速查与自测",
"note": "所有需要背下来的常量级事实集中在这里,配一份自测清单。",
"chapters": [
{
"file": "22-cheatsheet.html",
"title": "速查与自测",
"desc": "接口、配置项、代码地图三张速查表,加一份二十题的自测清单,用来在面试前半小时快速过一遍。",
"keywords": "速查,接口,配置,代码地图,自测",
"level": "L4",
"sections": [
{ "id": "sec-22-1", "title": "22.1 接口速查:五个端点" },
{ "id": "sec-22-2", "title": "22.2 配置项速查" },
{ "id": "sec-22-3", "title": "22.3 代码地图:文件到职责" },
{ "id": "sec-22-4", "title": "22.4 自测二十题" }
]
}
]
}
]
}