乐于分享
好东西不私藏

OpenCode 源码-Tool 工具注册与执行——LLM 的"手"与"眼"

OpenCode 源码-Tool 工具注册与执行——LLM 的"手"与"眼"

OpenCode 源码解析

第 6 讲:Tool 工具注册与执行——LLM 的"手"与"眼"

基于 dev 分支源码 · 2026-07-12

一、工具系统:LLM 的能力边界

前五讲我们覆盖了 OpenCode 的整体架构、CLI 入口、Session 核心、Server 网络层和 Plugin 插件系统。这一讲进入Tool 工具注册与执行系统——这是 LLM 与外部世界交互的核心通道,也是 OpenCode 最关键的运行时组件之一。

📦 本讲核心文件

packages/opencode/src/tool/tool.ts(183 行)— 工具定义抽象

packages/opencode/src/tool/registry.ts(420 行)— 工具注册表服务

packages/opencode/src/tool/truncate.ts(156 行)— 输出截断与持久化

packages/core/src/tool/tool.ts(162 行)— V2 工具定义与结算

packages/core/src/tool/registry.ts(147 行)— V2 Location 作用域注册表

packages/core/src/tool/builtins.ts(48 行)— 内置工具集合

工具实现文件 28 个,总计约 4825 行

二、工具系统的双层架构

OpenCode 的工具系统分为两层:V1 层(packages/opencode/src/tool/)面向当前运行时,V2 层(packages/core/src/tool/)面向下一代 Location 作用域架构。两层并行存在,V2 正在逐步接管核心能力。

V2 Core 层 (packages/core/src/tool/)

⬇️ 提供基础抽象

Tool.make() — 不透明工具值

⬇️

ApplicationTools — 进程级注册

⬇️

ToolRegistry — Location 级注册 + 结算

⬇️

Materialization — 定义导出 + 执行结算

V1 Opencode 层 (packages/opencode/src/tool/)

⬇️ 当前活跃运行时

Tool.define() — 工具定义

⬇️

ToolRegistry — 内置 + 插件 + 自定义工具

⬇️

Truncate — 输出截断与持久化

三、V1 工具定义抽象

tool.ts 定义了工具的核心抽象,包括 Def(工具定义)、Info(工具信息)、Context(执行上下文)和 ExecuteResult(执行结果)。

1. 工具定义接口

📄 tool.ts (第 55-65 行)

export interface Def<
  Parameters extends Schema.Decoder<unknown> = Schema.Decoder<unknown>,
  M extends Metadata = Metadata,
> {
  id: string
  description: string
  parameters: Parameters
  jsonSchema?: JSONSchema7
  execute(args: Schema.Schema.Type<Parameters>, ctx: Context): Effect.Effect<ExecuteResult<M>>
  formatValidationError?(error: unknown): string
}

设计要点:每个工具声明 Parameters(Effect Schema 解码器)定义输入参数类型,execute 返回 Effect.Effect 而非 Promise,使工具执行天然嵌入 Effect 错误处理与追踪管线。

2. Tool.define() 工厂函数

📄 tool.ts (第 151-169 行)

export function define<
  Parameters extends Schema.Decoder<unknown>,
  Result extends Metadata,
  R,
  ID extends string = string,
>(
  id: ID,
  init: Effect.Effect<Init<Parameters, Result>, never, R>,
): Effect.Effect<Info<Parameters, Result>, never, R | Truncate.Service | Agent.Service> & { id: ID } {
  return Object.assign(
    Effect.gen(function* () {
      const resolved = yield* init
      const truncate = yield* Truncate.Service
      const agents = yield* Agent.Service
      return { id, init: wrap(id, resolved, truncate, agents) }
    }),
    { id },
  )
}

关键机制:define()Truncate.ServiceAgent.Service 注入到工具初始化中,所有工具自动获得输出截断和 Agent 信息的能力。工具 ID 同时附加到 Effect 对象上(Object.assign(..., { id })),方便静态引用。

3. wrap() — 参数解码与输出截断管线

📄 tool.ts (第 99-149 行)

function wrap<Parameters extends Schema.Decoder<unknown>, Result extends Metadata>(
  id: string,
  init: Init<Parameters, Result>,
  truncate: Truncate.Interface,
  agents: Agent.Interface,
) {
  return () =>
    Effect.gen(function* () {
      const toolInfo = typeof init === "function" ? { ...(yield* init()) } : { ...init }
      // 编译一次解析器闭包,避免每次调用重新分配
      const decode = Schema.decodeUnknownEffect(toolInfo.parameters)
      const execute = toolInfo.execute
      toolInfo.execute = (args, ctx) => {
        return Effect.gen(function* () {
          const decoded = yield* decode(args).pipe(
            Effect.mapError((error) =>
              new InvalidArgumentsError({
                tool: id,
                detail: toolInfo.formatValidationError
                  ? toolInfo.formatValidationError(error)
                  : String(error),
              }),
            ),
          )
          const result = yield* execute(decoded, ctx)
          // 自动截断输出
          const agent = yield* agents.get(ctx.agent)
          const truncated = yield* truncate.output(result.output, {}, agent)
          return {
            ...result,
            output: truncated.content,
            metadata: { ...result.metadata, truncated: truncated.truncated,
              ...(truncated.truncated && { outputPath: truncated.outputPath }),
            },
          }
        }).pipe(Effect.orDie, Effect.withSpan("Tool.execute", { attributes: attrs }))
      }
      return toolInfo
    })
}

执行管线:LLM 调用工具时,参数首先经过 Schema.decodeUnknownEffect 解码,解码失败抛出 InvalidArgumentsError(包含友好的模型可读错误信息)。执行成功后,输出自动经过 Truncate.output() 截断管线,超出 2000 行或 50KB 的结果被保存到临时文件。

四、工具注册表 ToolRegistry

registry.ts 是工具系统的调度中心,负责收集、过滤和提供所有可用工具。它维护三类工具:内置工具(15 个)、插件工具、自定义脚本工具。

1. 内置工具清单

工具 ID 文件 功能
shell shell.ts (645 行) 终端命令执行
read read.ts (386 行) 读取文件/目录
edit edit.ts (737 行) 精确字符串替换编辑
write write.ts (104 行) 文件写入
apply_patch apply_patch.ts (313 行) 统一补丁应用(GPT 专属)
glob glob.ts (76 行) 文件模式匹配
grep grep.ts (112 行) 正则内容搜索
task task.ts (346 行) 子代理任务委托
todowrite todo.ts (46 行) 任务清单管理
websearch websearch.ts (143 行) 网络搜索(Exa/Parallel)
fetch webfetch.ts 网页抓取
skill skill.ts (70 行) 技能加载
question question.ts 向用户提问
lsp lsp.ts LSP 诊断查询
plan plan.ts 计划模式退出

条件注册:部分工具根据运行时标志动态启用:question 仅在 app/cli/desktop 客户端可用,lsp 需要 experimentalLspTool 标志,plan 需要 experimentalPlanMode 且仅 CLI 可用。

2. 工具过滤策略

注册表根据模型 ID 和 Provider 动态过滤工具列表:

📄 registry.ts (第 266-278 行)

const tools: Interface["tools"] = Effect.fn("ToolRegistry.tools")(function* (input) {
  const filtered = (yield* all()).filter((tool) => {
    // WebSearch 仅在 OpenCode 内置 Provider 或 Exa/Parallel 标志开启时可用
    if (tool.id === WebSearchTool.id) {
      return webSearchEnabled(input.providerID, { exa: flags.enableExa, parallel: flags.enableParallel })
    }
    // GPT 模型使用 apply_patch 而非 edit/write(非 GPT-4)
    const usePatch =
      input.modelID.includes("gpt-") && !input.modelID.includes("oss") && !input.modelID.includes("gpt-4")
    if (tool.id === ApplyPatchTool.id) return usePatch
    if (tool.id === EditTool.id || tool.id === WriteTool.id) return !usePatch
    return true
  })
  // ...
})

智能路由:GPT 模型(非 GPT-4)使用 apply_patch 统一补丁工具,其他模型使用 edit/write 精确编辑工具。这种区分是因为 GPT 系列在统一 diff 格式上表现更好。

3. 插件工具与自定义工具

除了 15 个内置工具,注册表还支持两类扩展工具:

1. 插件工具:通过 Plugin 系统注册的 npm 插件工具,支持 Zod Schema 和 JSON Schema 两种参数格式

2. 自定义脚本工具:自动扫描项目 {tool,tools}/*.{js,ts} 目录,动态加载用户编写的工具脚本

📄 registry.ts (第 171-185 行)

const matches = dirs.flatMap((dir) =>
  Glob.scanSync("{tool,tools}/*.{js,ts}", { cwd: dir, absolute: true, dot: true, symlink: true }),
)
for (const match of matches) {
  const namespace = path.basename(match, path.extname(match))
  const mod = yield* Effect.promise(() => import(pathToFileURL(match).href))
  for (const [id, def] of Object.entries(mod)) {
    if (!isPluginTool(def)) continue
    custom.push(fromPlugin(id === "default" ? namespace : `${namespace}_${id}`, def))
  }
}

五、V2 工具架构:Location 作用域与结算

V2 工具系统(packages/core/src/tool/)采用了更严格的抽象设计,核心变化是不透明工具值结算(settlement)机制。

1. Tool.make() — 不透明工具值

📄 core/src/tool/tool.ts (第 71-132 行)

export function make<
  Input extends SchemaType<any>,
  Output extends SchemaType<any>,
  Structured extends SchemaType<any> = Output,
>(config: Config<Input, Output, Structured>): Definition<Input, Structured> {
  const tool = Object.freeze({}) as Definition<Input, Structured>
  const definitions = new Map<string, ToolDefinition>()
  runtimes.set(tool, {
    definition: (name) => {
      const cached = definitions.get(name)
      if (cached) return cached
      return new ToolDefinition({
        name,
        description: config.description,
        inputSchema: toJsonSchema(config.input),
        outputSchema: toJsonSchema(config.structured ?? config.output),
      })
    },
    settle: (call, context) =>
      Schema.decodeUnknownEffect(config.input)(call.input).pipe(
        Effect.flatMap((input) => config.execute(input, context).pipe(
          Effect.flatMap((output) =>
            Schema.encodeEffect(config.output)(output)),
        )),
      ),
  })
  return tool
}

设计亮点:工具值本身是冻结的空对象 Object.freeze({}),真正的运行时逻辑存储在 WeakMap 中。这种"不透明值"设计防止外部代码直接访问工具内部实现,只能通过 definition()settle() 等受控接口交互。

2. 结算管线 (Settlement)

V2 的 settle 方法封装了完整的工具执行管线:

LLM 工具调用

⬇️

① Schema.decodeUnknownEffect — 参数解码

⬇️

② config.execute(input, context) — 工具执行

⬇️

③ Schema.encodeEffect(output) — 输出编码

⬇️

④ toModelOutput — 内容格式转换

⬇️

ToolOutput — 返回给 LLM

3. V2 注册表与 Location 作用域

V2 注册表(core/src/tool/registry.ts)是 Location 作用域的,与 V1 的进程全局注册表不同:

📄 core/src/tool/registry.ts (第 42-125 行)

const registryLayer = Layer.effect(
  Service,
  Effect.gen(function* () {
    const applications = yield* ApplicationTools.Service
    const resources = yield* ToolOutputStore.Service
    type Registration = { readonly identity: object; readonly tool: AnyTool }
    const local = new Map<string, Array<{ readonly token: object; readonly registration: Registration }>>()

    const settleWith = Effect.fn("ToolRegistry.settle")(function* (input, advertised?) {
      const registration =
        local.get(input.call.name)?.at(-1)?.registration
        ?? applications.entries().get(input.call.name)
      if (!registration)
        return { result: { type: "error", value: `Unknown tool: ${input.call.name}` } }
      // 执行结算 + 输出边界管理
      const pending = yield* settle(registration.tool, input.call, {
        sessionID: input.sessionID, agent: input.agent,
        assistantMessageID: input.assistantMessageID, toolCallID: input.call.id,
      })
      const bounded = yield* resources.bound({ sessionID, toolCallID, output })
      return { result, output: bounded.output, outputPaths: bounded.outputPaths }
    })
    // ...
  }),
)

优先级链:Location 级注册(local Map)优先于应用级注册(ApplicationTools),最新注册覆盖同名旧工具。结算时自动绑定 ToolOutputStore 管理输出路径。

六、核心工具实现分析

1. Shell 工具 — 命令执行引擎

shell.ts(645 行)是最复杂的工具,支持多行命令执行、文件操作检测、权限请求和输出截断。关键设计:

1. 文件操作自动检测:内置 FILESCMD_FILESFLAGSSWITCHES 集合,自动识别 rm/cp/mv/mkdir 等文件操作命令并触发权限请求

2. Shell 解析:使用 ShellPrompt(基于 tree-sitter)解析命令,支持 Bash 和 PowerShell 两种语法

3. 工作空间安全containsPath 检查确保命令操作在工作空间范围内

2. Edit 工具 — 精确字符串替换

edit.ts(737 行)实现了精确的 oldString/newString 替换编辑:

📄 edit.ts (第 47-56 行)

export const Parameters = Schema.Struct({
  filePath: Schema.String.annotate({ description: "The absolute path to the file to modify" }),
  oldString: Schema.String.annotate({ description: "The text to replace" }),
  newString: Schema.String.annotate({
    description: "The text to replace it with (must be different from oldString)",
  }),
  replaceAll: Schema.optional(Schema.Boolean).annotate({
    description: "Replace all occurrences of oldString (default false)",
  }),
})

设计要点:使用文件级 Semaphore 锁防止并发编辑冲突,支持 BOM 检测与保留,编辑后自动触发 LSP 诊断检查和代码格式化。

3. Task 工具 — 子代理委托

task.ts(346 行)支持将任务委托给子代理,支持前台和后台两种模式:

1. 前台模式(默认):等待子代理完成并返回结果

2. 后台模式:异步启动子代理,完成后自动通知

3. 任务恢复:通过 task_id 参数恢复之前的子代理会话

七、输出截断系统

truncate.ts(156 行)管理工具输出的截断与持久化,防止过大的输出占用 LLM 上下文窗口:

参数 默认值 说明
MAX_LINES 2000 最大行数限制
MAX_BYTES 50 KB 最大字节数限制
RETENTION 7 天 截断文件保留期
direction "head" 截断方向(保留头部/尾部)

截断文件存储在 TRUNCATION_DIR 目录,每 1 小时自动清理超过 7 天的过期文件。截断时生成友好提示,引导 LLM 使用 GrepRead(带 offset/limit)访问完整内容。

八、工具执行流程图

LLM 生成工具调用

⬇️

ToolRegistry.tools() — 获取工具列表

⬇️

wrap().execute() — 参数解码 + Schema 校验

⬇️

ctx.ask() — 权限请求(如需)

⬇️

工具实际执行(文件操作/命令/网络等)

⬇️

Truncate.output() — 输出截断与持久化

⬇️

ExecuteResult — 返回给 LLM 继续对话

九、架构设计总结

OpenCode 工具系统的核心设计原则:

🔹 Effect 原生:所有工具执行返回 Effect.Effect,天然支持错误处理、追踪和组合

🔹 Schema 驱动:参数和输出通过 Effect Schema 定义,编译时类型安全 + 运行时校验

🔹 自动截断:输出截断透明嵌入工具管线,开发者无需手动处理

🔹 动态过滤:根据模型能力和 Provider 特性智能选择可用工具集

🔹 双层架构:V1 面向当前运行时,V2 面向 Location 作用域的未来架构

🔹 扩展友好:插件工具和自定义脚本工具通过相同的注册表管线集成

📖 系列导航

← 第 5 讲:Plugin 插件系统

→ 第 7 讲:Provider 模型抽象层

关注公众号获取更多技术干货 · 源码地址:https://github.com/opencode-ai/opencode

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-13 07:59:04 HTTP/1.1 GET : https://www.yeyulingfeng.com/a/856580.html
  2. 运行时间 : 0.147596s [ 吞吐率:6.78req/s ] 内存消耗:4,659.26kb 文件加载:145
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=834cb4d0fc6d7cf7cbf2cf99f61076e7
  1. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/autoload_static.php ( 6.05 KB )
  7. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/ralouphie/getallheaders/src/getallheaders.php ( 1.60 KB )
  10. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  11. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  12. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  13. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  14. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  15. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  16. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  17. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  18. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  19. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/guzzlehttp/guzzle/src/functions_include.php ( 0.16 KB )
  21. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/guzzlehttp/guzzle/src/functions.php ( 5.54 KB )
  22. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  23. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  24. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  25. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/provider.php ( 0.19 KB )
  26. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  27. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  28. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  29. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/common.php ( 0.03 KB )
  30. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  32. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/alipay.php ( 3.59 KB )
  33. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  34. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/app.php ( 0.95 KB )
  35. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/cache.php ( 0.78 KB )
  36. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/console.php ( 0.23 KB )
  37. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/cookie.php ( 0.56 KB )
  38. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/database.php ( 2.48 KB )
  39. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/filesystem.php ( 0.61 KB )
  40. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/lang.php ( 0.91 KB )
  41. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/log.php ( 1.35 KB )
  42. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/middleware.php ( 0.19 KB )
  43. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/route.php ( 1.89 KB )
  44. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/session.php ( 0.57 KB )
  45. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/trace.php ( 0.34 KB )
  46. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/view.php ( 0.82 KB )
  47. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/event.php ( 0.25 KB )
  48. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  49. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/service.php ( 0.13 KB )
  50. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/AppService.php ( 0.26 KB )
  51. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  52. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  53. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  54. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  55. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  56. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/services.php ( 0.14 KB )
  57. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  58. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  59. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  60. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  61. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  62. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  63. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  64. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  65. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  66. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  67. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  68. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  69. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  70. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  71. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  72. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  73. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  74. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  75. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  76. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  77. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  78. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  79. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  80. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  81. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  82. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  83. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  84. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  85. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  86. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  87. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/Request.php ( 0.09 KB )
  88. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  89. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/middleware.php ( 0.25 KB )
  90. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  91. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  92. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  93. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  94. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  95. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  96. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  97. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  98. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  99. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  100. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  101. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  102. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  103. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/route/app.php ( 3.94 KB )
  104. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  105. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  106. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/controller/Index.php ( 9.87 KB )
  108. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/BaseController.php ( 2.05 KB )
  109. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  110. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  111. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  112. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  113. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  114. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  115. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  116. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  117. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  118. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  119. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  120. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  121. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  122. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  123. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  124. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  125. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  126. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  127. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  128. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  129. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  130. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  131. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  132. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  133. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  134. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  135. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/controller/Es.php ( 3.30 KB )
  136. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  137. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  138. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  139. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  140. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  141. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  142. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  143. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  144. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/runtime/temp/c935550e3e8a3a4c27dd94e439343fdf.php ( 31.50 KB )
  145. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.001066s ] mysql:host=127.0.0.1;port=3306;dbname=wenku;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001630s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000721s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000663s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001458s ]
  6. SELECT * FROM `set` [ RunTime:0.000629s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001481s ]
  8. SELECT * FROM `article` WHERE `id` = 856580 LIMIT 1 [ RunTime:0.004515s ]
  9. UPDATE `article` SET `lasttime` = 1783900744 WHERE `id` = 856580 [ RunTime:0.016088s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 64 LIMIT 1 [ RunTime:0.000299s ]
  11. SELECT * FROM `article` WHERE `id` < 856580 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000670s ]
  12. SELECT * FROM `article` WHERE `id` > 856580 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000503s ]
  13. SELECT * FROM `article` WHERE `id` < 856580 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.005870s ]
  14. SELECT * FROM `article` WHERE `id` < 856580 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.004110s ]
  15. SELECT * FROM `article` WHERE `id` < 856580 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002230s ]
0.149268s