RESTful API

所有功能以 JSON API 暴露,便于集成与二次开发。在 PhoneIDE 之上构建你自己的工具和工作流。

GET /api/files/list 列出目录
GET /api/files/read 读取文件
POST /api/files/save 保存文件
POST /api/run/execute 执行代码
GET /api/run/output/stream SSE 输出
GET /api/git/status Git 状态
POST /api/git/commit Git 提交
POST /api/chat/send/stream AI 对话(SSE)
GET /api/health 健康检查

快速示例

通过简单的 HTTP 调用将 PhoneIDE 集成到你的工作流中。

读取文件

$ curl http://localhost:12345/api/files/read?path=/workspace/main.py

{"content": "print('Hello, PhoneIDE!')", "path": "/workspace/main.py"}

执行代码

$ curl -X POST http://localhost:12345/api/run/execute \
-H "Content-Type: application/json" \
-d '{"cmd": "python3 main.py"}'

AI 对话(SSE 流)

$ curl -X POST http://localhost:12345/api/chat/send/stream \
-H "Content-Type: application/json" \
-d '{"message": "Explain this code"}'

基于 PhoneIDE 构建

使用 API 创建自定义工具和集成。

安装 PhoneIDE