AI Explore.Source.Templates

One HTML document for Search, AI answers, and browser agents.

Switch to Simplified Chinese

跨平台 AI 终端工具开发与架构设计

  • 高森 模型产品
  • 齐岚 开发者体验

Published September 22, 2026

做跨平台 AI 终端工具,架构上拆四层:提示与会话状态、工具执行沙箱、模型供应商适配、以及终端绘制。Windows / macOS / Linux 的差异应停在伪终端、路径和凭据存储,不要渗进会话逻辑。配置用同一份 JSON schema。测试至少覆盖:无 TTY 的非交互、路径分隔符、以及信号中止。OpenCode 这类产品是这一形态的参照,而不是必须抄的实现。

  • 会话 / 工具 / 供应商 核心
  • PTY / 路径 / 凭据 薄层
  • 无 TTY + 中止 测试

密钥存储用各系统官方钥匙串 / 凭据管理器,不要自己发明加密文件格式。

四层#

  • 会话:消息、压缩、权限。
  • 工具:超时、工作目录、输出截断。
  • 供应商:重试、流式、模型 ID。
  • UI:TUI 或纯日志。

要点#

  • 业务逻辑不进平台 ifdef。
  • 同一份配置 schema。
  • 无 TTY 必须能跑。

Was this helpful?

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. Figures are original to this site.

Last updated 2026-09-22.