ipaper
Agent 与会话 活跃维护

ipaper

ai4paper/ipaper

Claude Agent SDK开发的全栈AI应用,支持多步骤完成论文撰写、润色、编辑全流程,提供智能辅助写作能力,可高效处理学术论文创作需求。

0
Stars 标星
1
Forks 分支
0
Watchers 关注
0
Open Issues
TypeScript
主要语言
None
开源协议
3 MB
仓库大小
4 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:ai4paper/ipaper
git clone https://github.com/ai4paper/ipaper.git
git clone git@github.com:ai4paper/ipaper.git
README.md main

IPaper

A full-stack AI agent application for intelligent paper writing and editing, powered by the Claude Agent SDK. Run multi-step AI agents in your browser — desktop, tablet, and mobile PWA ready.

This repository is the IPaper monorepo. The published web package lives in packages/web as @ai4paper/ipaper.

Monorepo Structure

ipaper/
├── packages/
│   ├── web/        # React + Vite frontend (published as @ai4paper/ipaper)
│   └── server/     # Bun HTTP + WebSocket server + Claude agent runtime
├── package.json    # Bun workspace root
└── bun.lock

Tech Stack

Frontend — packages/web

Concern Technology
Runtime & tooling Bun
Language TypeScript (strict)
Framework React 19 + Vite
UI components shadcn/ui + Tailwind CSS v4
Routing TanStack Router
Server state TanStack Query
Agent streaming Native WebSocket (auto-reconnecting singleton)

Backend — packages/server

Concern Technology
Runtime Bun (Bun.serve upgrades to WebSocket)
HTTP framework Hono for REST routes
Language TypeScript (strict)
Agent runtime @anthropic-ai/claude-agent-sdk
Streaming WebSocket frames (one connection per browser session)
Validation Zod

Agent Streaming Architecture

Each chat has a long-lived Session on the server that owns one Claude query() call. Subsequent user prompts are pushed onto the agent's input queue, so context, prompt cache, and tool state survive across turns. Events fan out to one or more browser WebSocket subscribers.

Browser WebSocket  ⇄  /ws  ⇄  Bun.serve
                              │
   {type:"subscribe",chatId}  ▶ SessionManager.getOrCreate(chatId)
                              │      └── AgentSession (long-lived query())
   {type:"chat",chatId,...}   ▶ session.sendMessage(content)
                              ◀ {type:"user_message", ...}
                              ◀ {type:"tool_use", toolName, toolInput}
                              ◀ {type:"assistant_message", ...}
                              ◀ {type:"result", success, cost, duration}

Persistent state — chats and message history — is served via REST:

  • GET /api/chats — list chats
  • POST /api/chats — create a chat
  • GET /api/chats/:id — chat metadata
  • DELETE /api/chats/:id — delete chat & close its agent session
  • GET /api/chats/:id/messages — message history

No authentication is required — the Anthropic API key lives in packages/server/.env.

In development, Vite proxies /api/* and /ws to the Bun server.

License

MIT