assistme 0.3.1 → 0.3.2
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/PLAN.md +14 -3
- package/dist/{chunk-UWE5WVQI.js → chunk-KX7ITO55.js} +20 -11
- package/dist/index.js +1771 -496
- package/dist/{job-runner-N4XAAWLJ.js → job-runner-P2L6MOOX.js} +1 -1
- package/package.json +5 -3
- package/src/agent/job-runner.ts +9 -13
- package/src/agent/mcp-servers.ts +6 -952
- package/src/agent/memory.ts +2 -11
- package/src/agent/processor.ts +17 -107
- package/src/agent/scheduler.ts +2 -3
- package/src/agent/session.ts +20 -36
- package/src/agent/skills.ts +167 -61
- package/src/agent/system-prompt.ts +126 -0
- package/src/browser/chrome-launcher.ts +555 -0
- package/src/browser/controller.ts +1386 -0
- package/src/browser/types.ts +70 -0
- package/src/commands/credential.ts +190 -0
- package/src/commands/job.ts +14 -45
- package/src/commands/memory.ts +16 -29
- package/src/commands/schedule.ts +15 -37
- package/src/commands/start.ts +11 -43
- package/src/credentials/credential-store.test.ts +162 -0
- package/src/credentials/credential-store.ts +266 -0
- package/src/credentials/encryption.test.ts +98 -0
- package/src/credentials/encryption.ts +82 -0
- package/src/credentials/index.ts +15 -0
- package/src/credentials/local-store.ts +89 -0
- package/src/db/action.ts +19 -0
- package/src/db/api-client.ts +3 -32
- package/src/db/auth-store.ts +41 -0
- package/src/db/auth.ts +38 -0
- package/src/db/conversation.ts +39 -0
- package/src/db/event.ts +52 -0
- package/src/db/job-poll.ts +18 -0
- package/src/db/session.ts +60 -0
- package/src/db/supabase.ts +40 -383
- package/src/db/task.ts +69 -0
- package/src/db/types.ts +54 -0
- package/src/index.ts +2 -0
- package/src/mcp/agent-tools-server.ts +1047 -0
- package/src/mcp/browser-server.ts +258 -0
- package/src/tools/browser.ts +28 -1208
- package/src/tools/index.ts +32 -263
- package/src/tools/web.ts +0 -73
package/PLAN.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# AssistMe CLI Agent - Implementation Plan
|
|
2
2
|
|
|
3
3
|
## Vision
|
|
4
|
+
|
|
4
5
|
Build a CLI tool under `packages/assistme` based on Claude Agent SDK that:
|
|
6
|
+
|
|
5
7
|
- Runs as a local daemon, listening for tasks from the web UI
|
|
6
8
|
- Processes messages using Claude Agent SDK with full agentic capabilities (tool use, multi-turn)
|
|
7
9
|
- Streams real-time events (thinking, tool calls, text output) back to the web UI
|
|
@@ -31,9 +33,10 @@ Flow:
|
|
|
31
33
|
### New Tables Needed
|
|
32
34
|
|
|
33
35
|
#### 1. `agent_sessions` - Track running CLI agent instances
|
|
36
|
+
|
|
34
37
|
```sql
|
|
35
38
|
- id: UUID PK
|
|
36
|
-
- user_id: UUID FK →
|
|
39
|
+
- user_id: UUID FK → users
|
|
37
40
|
- session_name: VARCHAR(100) -- e.g., "My Workspace"
|
|
38
41
|
- status: VARCHAR(20) -- 'online', 'offline', 'busy'
|
|
39
42
|
- workspace_path: TEXT -- local filesystem path the agent operates in
|
|
@@ -46,10 +49,11 @@ Flow:
|
|
|
46
49
|
```
|
|
47
50
|
|
|
48
51
|
#### 2. `agent_tasks` - Commands/tasks from web to CLI
|
|
52
|
+
|
|
49
53
|
```sql
|
|
50
54
|
- id: UUID PK
|
|
51
55
|
- session_id: UUID FK → agent_sessions
|
|
52
|
-
- user_id: UUID FK →
|
|
56
|
+
- user_id: UUID FK → users
|
|
53
57
|
- conversation_id: UUID FK → conversations (nullable, for context threading)
|
|
54
58
|
- prompt: TEXT -- the user's message/command
|
|
55
59
|
- status: VARCHAR(20) -- 'pending', 'running', 'completed', 'failed', 'cancelled'
|
|
@@ -63,6 +67,7 @@ Flow:
|
|
|
63
67
|
```
|
|
64
68
|
|
|
65
69
|
#### 3. `agent_task_events` - Streaming events from CLI
|
|
70
|
+
|
|
66
71
|
```sql
|
|
67
72
|
- id: UUID PK
|
|
68
73
|
- task_id: UUID FK → agent_tasks
|
|
@@ -73,9 +78,10 @@ Flow:
|
|
|
73
78
|
```
|
|
74
79
|
|
|
75
80
|
### Existing Tables - No Changes Needed
|
|
81
|
+
|
|
76
82
|
- `conversations` - Can be reused for threading agent task history
|
|
77
83
|
- `chat_messages` - Not used directly (agent_tasks + agent_task_events replace this)
|
|
78
|
-
- `
|
|
84
|
+
- `users` - No changes needed
|
|
79
85
|
- `user_credits` / `llm_token_usage` - Reused for billing
|
|
80
86
|
|
|
81
87
|
## Package Structure
|
|
@@ -106,6 +112,7 @@ packages/assistme/
|
|
|
106
112
|
## Web UI Addition (web/src/)
|
|
107
113
|
|
|
108
114
|
New page: `/agent` - Agent chat interface
|
|
115
|
+
|
|
109
116
|
- Message input with send button
|
|
110
117
|
- Streaming output display (text, tool calls, results)
|
|
111
118
|
- Session status indicator (online/offline)
|
|
@@ -114,10 +121,12 @@ New page: `/agent` - Agent chat interface
|
|
|
114
121
|
## Implementation Steps
|
|
115
122
|
|
|
116
123
|
### Phase 1: Database (Migration)
|
|
124
|
+
|
|
117
125
|
1. Create migration for agent_sessions, agent_tasks, agent_task_events
|
|
118
126
|
2. Add RLS policies and indexes
|
|
119
127
|
|
|
120
128
|
### Phase 2: CLI Package
|
|
129
|
+
|
|
121
130
|
1. Set up package.json with dependencies
|
|
122
131
|
2. Implement Supabase client for DB communication
|
|
123
132
|
3. Implement session management (start/stop/heartbeat)
|
|
@@ -126,10 +135,12 @@ New page: `/agent` - Agent chat interface
|
|
|
126
135
|
6. Wire up CLI commands (assistme start, assistme login, assistme status)
|
|
127
136
|
|
|
128
137
|
### Phase 3: Web UI
|
|
138
|
+
|
|
129
139
|
1. Create /agent page with chat interface
|
|
130
140
|
2. Implement task submission (insert into agent_tasks)
|
|
131
141
|
3. Implement event polling (poll agent_task_events)
|
|
132
142
|
4. Render streaming events (text, tool use, thinking)
|
|
133
143
|
|
|
134
144
|
### Phase 4: Edge Function
|
|
145
|
+
|
|
135
146
|
1. Create agent-submit-task edge function for mobile clients
|
|
@@ -2,12 +2,17 @@ import {
|
|
|
2
2
|
getConfig
|
|
3
3
|
} from "./chunk-TTEGHE2E.js";
|
|
4
4
|
|
|
5
|
-
// src/db/
|
|
6
|
-
import { existsSync, readFileSync } from "fs";
|
|
5
|
+
// src/db/auth-store.ts
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
7
7
|
import { join } from "path";
|
|
8
8
|
import { homedir } from "os";
|
|
9
9
|
var AUTH_DIR = join(homedir(), ".config", "assistme");
|
|
10
10
|
var AUTH_FILE = join(AUTH_DIR, "auth.json");
|
|
11
|
+
function ensureAuthDir() {
|
|
12
|
+
if (!existsSync(AUTH_DIR)) {
|
|
13
|
+
mkdirSync(AUTH_DIR, { recursive: true, mode: 448 });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
11
16
|
function readAuthStore() {
|
|
12
17
|
try {
|
|
13
18
|
if (existsSync(AUTH_FILE)) {
|
|
@@ -17,6 +22,10 @@ function readAuthStore() {
|
|
|
17
22
|
}
|
|
18
23
|
return {};
|
|
19
24
|
}
|
|
25
|
+
function writeAuthStore(data) {
|
|
26
|
+
ensureAuthDir();
|
|
27
|
+
writeFileSync(AUTH_FILE, JSON.stringify(data, null, 2), { mode: 384 });
|
|
28
|
+
}
|
|
20
29
|
function getRawToken() {
|
|
21
30
|
const store = readAuthStore();
|
|
22
31
|
const token = store["mcp_token"];
|
|
@@ -25,6 +34,8 @@ function getRawToken() {
|
|
|
25
34
|
}
|
|
26
35
|
return token;
|
|
27
36
|
}
|
|
37
|
+
|
|
38
|
+
// src/db/api-client.ts
|
|
28
39
|
async function callMcpHandler(action, params = {}, overrideToken) {
|
|
29
40
|
const config = getConfig();
|
|
30
41
|
const token = overrideToken || getRawToken();
|
|
@@ -116,8 +127,6 @@ var log = {
|
|
|
116
127
|
|
|
117
128
|
// src/agent/job-runner.ts
|
|
118
129
|
var JobRunner = class {
|
|
119
|
-
constructor(_userId) {
|
|
120
|
-
}
|
|
121
130
|
/**
|
|
122
131
|
* Load a job and its linked skills from the database.
|
|
123
132
|
* Skills are the agent's *capabilities* — not a fixed execution plan.
|
|
@@ -155,9 +164,7 @@ var JobRunner = class {
|
|
|
155
164
|
*/
|
|
156
165
|
async listJobs() {
|
|
157
166
|
try {
|
|
158
|
-
const data = await callMcpHandler(
|
|
159
|
-
"job.list"
|
|
160
|
-
);
|
|
167
|
+
const data = await callMcpHandler("job.list");
|
|
161
168
|
return (data || []).map((row) => ({
|
|
162
169
|
id: row.id,
|
|
163
170
|
name: row.name,
|
|
@@ -204,10 +211,10 @@ var JobRunner = class {
|
|
|
204
211
|
*/
|
|
205
212
|
async getRunHistory(jobName, limit = 10) {
|
|
206
213
|
try {
|
|
207
|
-
const data = await callMcpHandler(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
);
|
|
214
|
+
const data = await callMcpHandler("job.get_runs", {
|
|
215
|
+
job_name: jobName || null,
|
|
216
|
+
limit
|
|
217
|
+
});
|
|
211
218
|
return (data || []).map((row) => ({
|
|
212
219
|
runId: row.run_id,
|
|
213
220
|
jobName: row.job_name,
|
|
@@ -280,6 +287,8 @@ var JobRunner = class {
|
|
|
280
287
|
};
|
|
281
288
|
|
|
282
289
|
export {
|
|
290
|
+
readAuthStore,
|
|
291
|
+
writeAuthStore,
|
|
283
292
|
callMcpHandler,
|
|
284
293
|
setLogLevel,
|
|
285
294
|
setCorrelationId,
|