@heysalad/cheri-cli 1.2.1 โ 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/README.md +53 -13
- package/package.json +2 -2
- package/src/commands/agent.js +6 -0
- package/src/commands/login.js +10 -0
- package/src/lib/api-client.js +38 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,59 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to Cheri CLI will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.3.0] - 2026-02-17
|
|
6
|
+
|
|
7
|
+
### ๐ฏ Major Feature - Token-Tracked Sessions with Predictable Costs
|
|
8
|
+
|
|
9
|
+
#### Durable Objects Backend
|
|
10
|
+
- **Automatic Workspace Creation**: Workspaces are automatically initialized on login
|
|
11
|
+
- **Session Management**: Each chat is tracked as a separate session with token limits
|
|
12
|
+
- **Token Tracking**: Real-time tracking of input and output tokens
|
|
13
|
+
- **Cost Calculation**: Automatic cost estimation based on AWS Bedrock pricing
|
|
14
|
+
- Claude Sonnet 4: $3/M input, $15/M output
|
|
15
|
+
- Max ~$9 per 1M token session
|
|
16
|
+
- **Auto-Compaction**: Sessions automatically compact at 90% of 1M token limit
|
|
17
|
+
- **Force Compaction**: Sessions force compact at 100% to maintain limits
|
|
18
|
+
|
|
19
|
+
#### New Cloud Tools
|
|
20
|
+
- `get_workspace_stats` - View monthly token usage, limits, and costs
|
|
21
|
+
- `list_sessions` - List all chat sessions with token tracking
|
|
22
|
+
- `get_session_cost` - Get detailed cost breakdown for a specific session
|
|
23
|
+
|
|
24
|
+
#### Backend Architecture
|
|
25
|
+
- **WorkspaceDO**: One Durable Object per user managing all sessions
|
|
26
|
+
- **SessionDO**: One Durable Object per chat tracking messages and tokens
|
|
27
|
+
- **Persistent State**: Automatic state management with Cloudflare Durable Objects
|
|
28
|
+
- **Scalable**: Handles unlimited users with per-user isolation
|
|
29
|
+
|
|
30
|
+
#### API Enhancements
|
|
31
|
+
- `POST /api/workspace/init` - Initialize user workspace
|
|
32
|
+
- `POST /api/workspace/session/create` - Create new tracked session
|
|
33
|
+
- `GET /api/workspace/sessions` - List recent sessions
|
|
34
|
+
- `GET /api/workspace/session/:id` - Get specific session details
|
|
35
|
+
- `GET /api/workspace/stats` - Get workspace statistics
|
|
36
|
+
- `POST /api/session/:id/message` - Add message with token tracking
|
|
37
|
+
- `GET /api/session/:id/cost` - Get session cost estimate
|
|
38
|
+
- `POST /api/session/:id/compact` - Manual session compaction
|
|
39
|
+
|
|
40
|
+
### โจ Improved
|
|
41
|
+
- **Login Flow**: Now automatically initializes workspace with token tracking
|
|
42
|
+
- **Cost Visibility**: Users can see token usage and costs at any time
|
|
43
|
+
- **Predictable Billing**: 1M token limit per chat ensures known maximum costs
|
|
44
|
+
|
|
45
|
+
### ๐ Documentation
|
|
46
|
+
- Added `ARCHITECTURE_PLAN.md` with complete system design
|
|
47
|
+
- Added `DURABLE_OBJECTS_STARTER.ts` with implementation reference
|
|
48
|
+
- Added `wrangler.toml` for Cloudflare Workers configuration
|
|
49
|
+
|
|
50
|
+
### ๐ง Technical Details
|
|
51
|
+
- Integrated Durable Objects into existing Cloudflare Workers backend
|
|
52
|
+
- Added TypeScript interfaces for Workspace and Session types
|
|
53
|
+
- Implemented token estimation based on character count (~4 chars/token)
|
|
54
|
+
- Added pricing constants for multiple AI models (Claude, Nova)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
5
58
|
## [1.1.0] - 2026-02-17
|
|
6
59
|
|
|
7
60
|
### โจ Added - Beautiful UI & Animations
|
package/README.md
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
CLI for [Cheri](https://cheri.heysalad.app) โ the AI-powered cloud IDE that never forgets.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Features:**
|
|
6
|
+
- ๐ค AI-powered coding agent with tool execution
|
|
7
|
+
- ๐ Token-tracked sessions with predictable costs
|
|
8
|
+
- โ๏ธ Cloud workspace management
|
|
9
|
+
- ๐พ Persistent memory system
|
|
10
|
+
- ๐ง Automatic workspace initialization
|
|
6
11
|
|
|
7
12
|
## Install
|
|
8
13
|
|
|
@@ -15,14 +20,14 @@ Requires Node.js 18+.
|
|
|
15
20
|
## Quick Start
|
|
16
21
|
|
|
17
22
|
```bash
|
|
18
|
-
# Authenticate with your Cheri account
|
|
23
|
+
# Authenticate with your Cheri account (auto-initializes workspace)
|
|
19
24
|
cheri login
|
|
20
25
|
|
|
21
|
-
#
|
|
22
|
-
cheri
|
|
26
|
+
# Start coding with AI agent
|
|
27
|
+
cheri agent "create a todo list app"
|
|
23
28
|
|
|
24
|
-
# Check
|
|
25
|
-
cheri
|
|
29
|
+
# Check token usage and costs
|
|
30
|
+
cheri stats
|
|
26
31
|
|
|
27
32
|
# View API usage and rate limits
|
|
28
33
|
cheri usage
|
|
@@ -30,19 +35,40 @@ cheri usage
|
|
|
30
35
|
|
|
31
36
|
## Commands
|
|
32
37
|
|
|
38
|
+
### AI Agent
|
|
33
39
|
| Command | Description |
|
|
34
40
|
|---|---|
|
|
35
|
-
| `cheri
|
|
41
|
+
| `cheri agent <task>` | Start AI coding agent for a task |
|
|
42
|
+
| `cheri agent -i` | Interactive agent mode |
|
|
43
|
+
| `cheri agent -r <session-id>` | Resume a previous session |
|
|
44
|
+
|
|
45
|
+
### Account & Authentication
|
|
46
|
+
| Command | Description |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `cheri login` | Authenticate with GitHub (auto-initializes workspace) |
|
|
36
49
|
| `cheri status` | Show account and workspace status |
|
|
37
50
|
| `cheri usage` | Show API usage and rate limit status |
|
|
51
|
+
| `cheri stats` | Show token usage statistics and costs |
|
|
52
|
+
|
|
53
|
+
### Workspaces
|
|
54
|
+
| Command | Description |
|
|
55
|
+
|---|---|
|
|
38
56
|
| `cheri workspace launch <repo>` | Launch a new cloud workspace |
|
|
39
57
|
| `cheri workspace list` | List all workspaces |
|
|
40
58
|
| `cheri workspace stop <id>` | Stop a running workspace |
|
|
41
59
|
| `cheri workspace status <id>` | Get workspace status |
|
|
60
|
+
|
|
61
|
+
### Memory
|
|
62
|
+
| Command | Description |
|
|
63
|
+
|---|---|
|
|
42
64
|
| `cheri memory show` | Show current memory entries |
|
|
43
65
|
| `cheri memory add <text>` | Add a memory entry |
|
|
44
66
|
| `cheri memory clear` | Clear all memory |
|
|
45
67
|
| `cheri memory export` | Export memory to JSON |
|
|
68
|
+
|
|
69
|
+
### Configuration
|
|
70
|
+
| Command | Description |
|
|
71
|
+
|---|---|
|
|
46
72
|
| `cheri config list` | Show all configuration |
|
|
47
73
|
| `cheri config get <key>` | Get a config value |
|
|
48
74
|
| `cheri config set <key> <value>` | Set a config value |
|
|
@@ -60,6 +86,26 @@ $ cheri
|
|
|
60
86
|
๐ cheri > exit
|
|
61
87
|
```
|
|
62
88
|
|
|
89
|
+
## Token Limits & Costs
|
|
90
|
+
|
|
91
|
+
### Per Session (Chat)
|
|
92
|
+
- **Max Tokens**: 1,000,000 tokens per chat
|
|
93
|
+
- **Auto-Compact**: Triggers at 900K tokens (90%)
|
|
94
|
+
- **Force Compact**: Triggers at 1M tokens (100%)
|
|
95
|
+
|
|
96
|
+
### Monthly Limits
|
|
97
|
+
| Plan | Sessions | Tokens/Month | Max Cost/Month |
|
|
98
|
+
|---|---|---|---|
|
|
99
|
+
| Free | 10 | 10M tokens | ~$90 |
|
|
100
|
+
| Pro | 100 | 100M tokens | ~$900 |
|
|
101
|
+
|
|
102
|
+
### Pricing (AWS Bedrock Claude Sonnet 4)
|
|
103
|
+
- **Input**: $3.00 per 1M tokens
|
|
104
|
+
- **Output**: $15.00 per 1M tokens
|
|
105
|
+
- **Max per chat**: ~$9.00 (at 1M tokens, 50/50 split)
|
|
106
|
+
|
|
107
|
+
Use `cheri stats` to check your current token usage and costs.
|
|
108
|
+
|
|
63
109
|
## Rate Limits
|
|
64
110
|
|
|
65
111
|
| Plan | Limit |
|
|
@@ -77,12 +123,6 @@ Config is stored in `~/.cheri/`. Set the API URL if self-hosting:
|
|
|
77
123
|
cheri config set apiUrl https://your-instance.example.com
|
|
78
124
|
```
|
|
79
125
|
|
|
80
|
-
## Links
|
|
81
|
-
|
|
82
|
-
- [Cheri Cloud IDE](https://cheri.heysalad.app)
|
|
83
|
-
- [Dashboard](https://cheri.heysalad.app/dashboard)
|
|
84
|
-
- [GitHub](https://github.com/chilu18/cloud-ide)
|
|
85
|
-
|
|
86
126
|
## ๐ Links
|
|
87
127
|
|
|
88
128
|
- **Homepage**: [cheri.heysalad.app](https://cheri.heysalad.app)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heysalad/cheri-cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Cheri CLI - AI-powered cloud IDE by HeySaladยฎ.
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Cheri CLI - AI-powered cloud IDE by HeySaladยฎ. With token-tracked sessions, predictable AI costs, and automatic workspace management.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cheri": "./bin/cheri.js"
|
package/src/commands/agent.js
CHANGED
|
@@ -50,6 +50,9 @@ const CLOUD_TOOLS = [
|
|
|
50
50
|
{ name: "get_usage", description: "Get the user's API usage and rate limit statistics", parameters: { type: "object", properties: {}, required: [] } },
|
|
51
51
|
{ name: "get_config", description: "Get a configuration value by key (dot notation supported)", parameters: { type: "object", properties: { key: { type: "string", description: "Config key, e.g. 'ai.provider'" } }, required: ["key"] } },
|
|
52
52
|
{ name: "set_config", description: "Set a configuration value", parameters: { type: "object", properties: { key: { type: "string", description: "Config key" }, value: { type: "string", description: "Value to set" } }, required: ["key", "value"] } },
|
|
53
|
+
{ name: "get_workspace_stats", description: "Get token usage statistics for your workspace (monthly usage, limits, costs)", parameters: { type: "object", properties: {}, required: [] } },
|
|
54
|
+
{ name: "list_sessions", description: "List recent chat sessions with token tracking", parameters: { type: "object", properties: {}, required: [] } },
|
|
55
|
+
{ name: "get_session_cost", description: "Get detailed token usage and cost estimate for a specific session", parameters: { type: "object", properties: { sessionId: { type: "string", description: "Session ID to query" } }, required: ["sessionId"] } },
|
|
53
56
|
];
|
|
54
57
|
|
|
55
58
|
// โโ Agent meta-tools โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
@@ -99,6 +102,9 @@ async function executeCloudTool(name, args) {
|
|
|
99
102
|
setConfigValue(args.key, args.value);
|
|
100
103
|
return { key: args.key, value: args.value, status: "updated" };
|
|
101
104
|
}
|
|
105
|
+
case "get_workspace_stats": return await apiClient.getWorkspaceStats();
|
|
106
|
+
case "list_sessions": return await apiClient.listSessions();
|
|
107
|
+
case "get_session_cost": return await apiClient.getSessionCost(args.sessionId);
|
|
102
108
|
default: return { error: `Unknown cloud tool: ${name}` };
|
|
103
109
|
}
|
|
104
110
|
} catch (err) {
|
package/src/commands/login.js
CHANGED
|
@@ -63,6 +63,16 @@ export async function loginFlow() {
|
|
|
63
63
|
log.blank();
|
|
64
64
|
log.success(`Logged in as ${chalk.cyan(me.ghLogin || me.userId)}`);
|
|
65
65
|
log.keyValue("Plan", me.plan === "pro" ? chalk.green("Pro") : "Free");
|
|
66
|
+
|
|
67
|
+
// Initialize workspace for token tracking
|
|
68
|
+
try {
|
|
69
|
+
await apiClient.initWorkspace();
|
|
70
|
+
log.dim("โ Workspace initialized with token tracking");
|
|
71
|
+
} catch (workspaceErr) {
|
|
72
|
+
// Workspace init is non-critical, just log it
|
|
73
|
+
log.dim(`โ Workspace init skipped: ${workspaceErr.message}`);
|
|
74
|
+
}
|
|
75
|
+
|
|
66
76
|
log.blank();
|
|
67
77
|
log.tip("Using Cheri cloud service (AWS Bedrock). Run 'cheri agent' to start coding!");
|
|
68
78
|
} catch (err) {
|
package/src/lib/api-client.js
CHANGED
|
@@ -128,4 +128,42 @@ export const apiClient = {
|
|
|
128
128
|
async getModels() {
|
|
129
129
|
return request("/api/chat/models");
|
|
130
130
|
},
|
|
131
|
+
|
|
132
|
+
// Token-Tracked Workspaces & Sessions
|
|
133
|
+
async initWorkspace() {
|
|
134
|
+
return request("/api/workspace/init", { method: "POST" });
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
async createSession() {
|
|
138
|
+
return request("/api/workspace/session/create", { method: "POST" });
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
async listSessions() {
|
|
142
|
+
return request("/api/workspace/sessions");
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
async getSession(sessionId) {
|
|
146
|
+
return request(`/api/workspace/session/${encodeURIComponent(sessionId)}`);
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
async getWorkspaceStats() {
|
|
150
|
+
return request("/api/workspace/stats");
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
async addSessionMessage(sessionId, role, content, tokens = null) {
|
|
154
|
+
return request(`/api/session/${encodeURIComponent(sessionId)}/message`, {
|
|
155
|
+
method: "POST",
|
|
156
|
+
body: JSON.stringify({ role, content, tokens }),
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
async getSessionCost(sessionId) {
|
|
161
|
+
return request(`/api/session/${encodeURIComponent(sessionId)}/cost`);
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
async compactSession(sessionId) {
|
|
165
|
+
return request(`/api/session/${encodeURIComponent(sessionId)}/compact`, {
|
|
166
|
+
method: "POST",
|
|
167
|
+
});
|
|
168
|
+
},
|
|
131
169
|
};
|