Skip to main content

fp-terminal — FP 终端 REPL

PyPI Python License

简介

fp-terminal 是FPAgent 框架的交互式命令行界面。它基于 prompt-toolkit 构建,提供了语法高亮、自动补全、多行编辑、历史记录等现代终端体验。

通常通过主包 fp 安装,无需单独安装。


特性

  • REPL 交互模式 — 实时与 Agent 对话,流式输出响应
  • 命令系统 — 内置 / 命令用于控制会话、加载插件、切换模型等
  • 语法高亮 — 代码块自动识别并着色
  • 自动补全 — 命令与参数 Tab 补全
  • 多行编辑 — 支持粘贴多行文本或代码
  • 会话历史 — 对话历史持久化存储,跨会话可回溯
  • 多彩输出 — 基于 rich 的渲染引擎

安装

pip install fp-terminal

要求 Python >= 3.11。

Windows 用户:推荐安装 Git for Windows(安装时勾选"Git Bash"并添加到 PATH),以获得完整的 Unix 命令支持。未安装时会自动降级到 cmd.exe,仅支持 Windows 原生命令。


快速使用

启动 REPL

fp

或显式调用:

python -m fp_cli

启动后进入交互模式:

╭─ FP ───────────────────────────╮
│ 输入 /help 查看可用命令                   │
│ 按 Ctrl+D 或输入 /exit 退出               │
╰──────────────────────────────────────────╯

🤖 你好!我是 FP,请告诉我你的问题。

开始对话

>> 请用 Python 写一个快速排序
# 直接输入即发送消息,Agent 会流式输出回复

>> /save session-quicksort
# 保存当前会话

>> /load session-quicksort
# 恢复历史会话

命令列表

命令 别名 说明
/help /h 显示帮助信息
/exit /q, /quit 退出 REPL
/clear /c 清屏
/save <name> — 保存当前会话
/load <name> — 加载指定会话
/list /ls 列出所有会话
/delete <name> /rm 删除指定会话
/model <name> — 切换 LLM 模型
/plugin list — 列出已加载的插件
/plugin load <name> — 动态加载插件
/tool list — 列出可用工具
/env — 查看当前环境配置
/config <key>=<value> — 动态修改配置
/reset — 重置当前会话上下文
/export <format> — 导出会话(json/md)

快捷键

快捷键 功能
Tab 自动补全命令/参数
Ctrl+C 中断当前输出
Ctrl+D 退出 REPL
Ctrl+L 清屏
Ctrl+R 反向搜索历史
Up/Down 浏览历史命令
Shift+Enter 换行(多行输入)
Ctrl+W 删除前一个词
Ctrl+U 删除整行
Ctrl+K 删除光标至行尾

配置

通过命令行标志自定义启动行为:

# 指定配置文件
fp --config ./my-config.yaml

# 指定初始模型
fp --model claude-3-opus

# 静默模式(跳过启动横幅)
fp --quiet

# 调试模式
fp --debug

配置文件示例(YAML):

cli:
  theme: dark          # dark / light
  multi_line: true     # 启用多行编辑
  max_history: 1000    # 历史记录条数
  stream: true         # 流式输出

依赖

依赖 版本 用途
fp-core >= 0.1.0 Agent 核心引擎
prompt-toolkit >= 3.0.40 终端交互框架

许可

MIT © zpb

Metadata

Release files for fp-terminal 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fp-terminal 0.2.0
File Size Uploaded
fp_terminal-0.2.0.tar.gz 23.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fp-terminal 0.2.0
File Interpreter ABI Platform
fp_terminal-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 45.6 kB

Release files / fp_terminal-0.2.0.tar.gz

Download URL fp_terminal-0.2.0.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ef6a3effb3646c667f196478f3032c23ea7a750464f3a84ac14ca4813b6419da
BLAKE2b-256 checksum
How to use checksums
ff2ab2cb0e8c7a1f6e5b71d0389f462460cbbd41d38a2adda30fcd90634f0ee4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / fp_terminal-0.2.0-py3-none-any.whl

Download URL fp_terminal-0.2.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2821c825ea8a2fb2c11f0be40fd468bb44931a2dc50ed986e18badfe2fe49514
BLAKE2b-256 checksum
How to use checksums
6fb959c9b5b7e234a1d60ca4f58b7debc65e76f18650474ea5f4656f5b884f66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.14

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page