Add session metadata: creator tracking, descriptions, timestamps, and sorting
Sessions now track who created them (Human vs Agent with name), optional descriptions, and creation timestamps. Agents can create and update sessions via WebSocket and MCP. ListSessions supports sorting by name, created_at, created_by, or element_count. New MCP tools: create_session, update_session. Updated list_sessions with sort_by/sort_order params. Tab bar shows robot icon for agent-created sessions with hover tooltips.
This commit is contained in:
38
README.md
38
README.md
@@ -33,7 +33,7 @@ agcanvas bridges the gap between visual design and code generation. It's a **col
|
||||
- **Shape Drawing** — Rectangles, ellipses, lines, arrows, text directly on canvas
|
||||
- **Selection & Editing** — Select, move, resize shapes with corner handles
|
||||
- **Mermaid Diagrams** — Write Mermaid syntax, render as SVG on canvas
|
||||
- **Sessions/Tabs** — Multiple canvases in tabs, each with independent state
|
||||
- **Sessions/Tabs** — Multiple canvases in tabs, each with independent state, creator tracking (human vs agent), descriptions, and timestamps
|
||||
- **Pan/Zoom** — Smooth canvas navigation
|
||||
|
||||
### AI Agent Integration
|
||||
@@ -179,7 +179,9 @@ Same MCP config format — add the `agcanvas` entry to your Codex MCP configurat
|
||||
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `list_sessions` | List all open tabs/sessions in agcanvas |
|
||||
| `list_sessions` | List all open tabs/sessions with creator info, descriptions, timestamps. Supports sorting by name, created_at, created_by, element_count |
|
||||
| `create_session` | Create a new session/tab from an agent, with name, description, and creator identity |
|
||||
| `update_session` | Update an existing session's name or description |
|
||||
| `get_element_tree` | Get the full parsed SVG element tree (structured JSON) |
|
||||
| `describe_canvas` | Get a human-readable description of the canvas |
|
||||
| `get_element_by_id` | Look up a specific element by ID |
|
||||
@@ -214,20 +216,45 @@ All requests support an optional `session_id` parameter. If omitted, the active
|
||||
|
||||
```json
|
||||
{"type": "ListSessions"}
|
||||
{"type": "ListSessions", "sort_by": "created_at", "sort_order": "desc"}
|
||||
```
|
||||
|
||||
Sort fields: `name`, `created_at` (default), `created_by`, `element_count`. Order: `asc` (default), `desc`.
|
||||
|
||||
Response:
|
||||
```json
|
||||
{
|
||||
"type": "Sessions",
|
||||
"sessions": [
|
||||
{"id": "session-1", "name": "Tab 1", "has_svg": true, "element_count": 15},
|
||||
{"id": "session-2", "name": "Tab 2", "has_svg": false, "element_count": null}
|
||||
{"id": "session-1", "name": "Tab 1", "has_svg": true, "element_count": 15, "description": null, "created_by": {"type": "Human"}, "created_at": 1707500000},
|
||||
{"id": "session-2", "name": "Agent Work", "has_svg": false, "element_count": null, "description": "Architecture diagram", "created_by": {"type": "Agent", "name": "Claude"}, "created_at": 1707500100}
|
||||
],
|
||||
"active_session": "session-1"
|
||||
}
|
||||
```
|
||||
|
||||
#### Create session (agent)
|
||||
|
||||
```json
|
||||
{"type": "CreateSession", "name": "My Session", "description": "Working on auth flow", "created_by_name": "Claude"}
|
||||
```
|
||||
|
||||
Response:
|
||||
```json
|
||||
{"type": "SessionCreated", "session": {"id": "session-3", "name": "My Session", ...}}
|
||||
```
|
||||
|
||||
#### Update session
|
||||
|
||||
```json
|
||||
{"type": "UpdateSession", "session_id": "session-1", "name": "Renamed", "description": "Updated description"}
|
||||
```
|
||||
|
||||
Response:
|
||||
```json
|
||||
{"type": "SessionUpdated", "session": {"id": "session-1", "name": "Renamed", ...}}
|
||||
```
|
||||
|
||||
#### Get full element tree
|
||||
|
||||
```json
|
||||
@@ -354,8 +381,9 @@ crates/
|
||||
- [x] Selection, move, resize with handles
|
||||
- [x] Mermaid diagram rendering
|
||||
- [x] MCP server bridge for AI coding tools
|
||||
- [x] Agent draw commands (modify canvas from agent)
|
||||
- [x] Session metadata (creator tracking, descriptions, timestamps, sorting)
|
||||
- [ ] Real code generation (not just stubs)
|
||||
- [ ] Agent draw commands (modify canvas from agent)
|
||||
- [ ] Export to file
|
||||
- [ ] Diff view (before/after agent changes)
|
||||
- [ ] Plugin system for code generators
|
||||
|
||||
Reference in New Issue
Block a user