jerob 1.0.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/CLI/cli.ts +42 -0
- package/README.md +137 -0
- package/SETUP.md +584 -0
- package/agent/action-tracker.ts +45 -0
- package/agent/agent-tools.ts +111 -0
- package/agent/approval.ts +137 -0
- package/agent/diff-view.ts +26 -0
- package/agent/orchestrator.ts +186 -0
- package/agent/tool-executor.ts +463 -0
- package/agent/types.ts +69 -0
- package/ask/orchestrator.ts +244 -0
- package/auth/auth.ts +567 -0
- package/auth/config-store.ts +77 -0
- package/auth/crypto.ts +51 -0
- package/auth/env-writer.ts +82 -0
- package/bin/jerob.js +28 -0
- package/config/ai.config.ts +163 -0
- package/email_ops/email-tools.ts +178 -0
- package/email_ops/email_functions.ts +443 -0
- package/email_ops/email_init.ts +92 -0
- package/email_ops/email_pass_store.ts +61 -0
- package/email_ops/email_server.ts +29 -0
- package/email_ops/types.ts +88 -0
- package/index.ts +176 -0
- package/package.json +88 -0
- package/plan/browser-agent/README.md +118 -0
- package/plan/browser-agent/USAGE.md +308 -0
- package/plan/browser-agent/evaluator.ts +353 -0
- package/plan/browser-agent/executor.ts +372 -0
- package/plan/browser-agent/index.ts +13 -0
- package/plan/browser-agent/orchestrator.ts +323 -0
- package/plan/browser-agent/planner.ts +200 -0
- package/plan/browser-agent/types.ts +62 -0
- package/plan/browser-tool.ts +128 -0
- package/plan/index.ts +12 -0
- package/plan/orchestrator.ts +214 -0
- package/plan/planner.ts +183 -0
- package/plan/selection.ts +50 -0
- package/plan/types.ts +13 -0
- package/plan/web-tools.ts +119 -0
- package/scheduler/ARCHITECTURE.md +263 -0
- package/scheduler/README.md +200 -0
- package/scheduler/SETUP-READY.sql +84 -0
- package/scheduler/check-status.sql +124 -0
- package/scheduler/config-sync.ts +91 -0
- package/scheduler/db-migrate.ts +271 -0
- package/scheduler/db.ts +162 -0
- package/scheduler/debug.ts +184 -0
- package/scheduler/orchestrator.ts +438 -0
- package/scheduler/planner.ts +170 -0
- package/scheduler/update-task-email.ts +70 -0
- package/supabase/.temp/cli-latest +1 -0
- package/supabase/.temp/gotrue-version +1 -0
- package/supabase/.temp/linked-project.json +1 -0
- package/supabase/.temp/pooler-url +1 -0
- package/supabase/.temp/postgres-version +1 -0
- package/supabase/.temp/project-ref +1 -0
- package/supabase/.temp/rest-version +1 -0
- package/supabase/.temp/storage-migration +1 -0
- package/supabase/.temp/storage-version +1 -0
- package/supabase/deploy.ps1 +50 -0
- package/supabase/functions/scheduler-tick/index.ts +496 -0
- package/supabase/supabase/.temp/linked-project.json +1 -0
- package/tsconfig.json +33 -0
- package/tui/spinner.ts +33 -0
- package/tui/spinup.ts +67 -0
- package/tui/terminal-render.ts +16 -0
- package/utils/llm-error.ts +185 -0
- package/utils/model-validator.ts +247 -0
package/SETUP.md
ADDED
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
# Jerob — Complete Setup Guide
|
|
2
|
+
|
|
3
|
+
Everything a new user needs to get Jerob fully working, from zero to all five modes running.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
1. [Prerequisites](#1-prerequisites)
|
|
10
|
+
2. [Installation](#2-installation)
|
|
11
|
+
3. [First Run — Setup Wizard](#3-first-run--setup-wizard)
|
|
12
|
+
4. [Agent Mode](#4-agent-mode)
|
|
13
|
+
5. [Plan Mode](#5-plan-mode)
|
|
14
|
+
6. [Ask Mode](#6-ask-mode)
|
|
15
|
+
7. [Browser Agent Mode](#7-browser-agent-mode)
|
|
16
|
+
8. [Gmail / Email Setup](#8-gmail--email-setup)
|
|
17
|
+
9. [Scheduler Mode](#9-scheduler-mode)
|
|
18
|
+
10. [Telegram Bot Setup](#10-telegram-bot-setup)
|
|
19
|
+
11. [Managing Keys & Models](#11-managing-keys--models)
|
|
20
|
+
12. [CLI Reference](#12-cli-reference)
|
|
21
|
+
13. [Troubleshooting](#13-troubleshooting)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 1. Prerequisites
|
|
26
|
+
|
|
27
|
+
| Tool | Required for | Install |
|
|
28
|
+
|------|-------------|---------|
|
|
29
|
+
| **Bun** runtime | Everything | https://bun.sh |
|
|
30
|
+
| **Git** | Installation | https://git-scm.com |
|
|
31
|
+
| **Supabase CLI** | Scheduler (Edge Function deploy) | `npm i -g supabase` |
|
|
32
|
+
| Brave or Chrome | Browser Agent | https://brave.com |
|
|
33
|
+
| Supabase account | Scheduler | https://supabase.com (free tier works) |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/your-username/jerob
|
|
41
|
+
cd jerob
|
|
42
|
+
bun install
|
|
43
|
+
bun link
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`bun link` installs `jerob` as a global command so you can run it from anywhere.
|
|
47
|
+
|
|
48
|
+
If you skip `bun link`, use `bun run index.ts` instead of `jerob` in all commands below.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 3. First Run — Setup Wizard
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
jerob jet
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The first time you run this, the setup wizard starts automatically. It walks you through everything in one session.
|
|
59
|
+
|
|
60
|
+
### Step 1 — Create your account
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Create username: your-name
|
|
64
|
+
Create password: (min 6 chars — this encrypts ALL your API keys)
|
|
65
|
+
Confirm password:
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Your password is never stored. It's used to AES-256 encrypt your keys. If you forget it, run `jerob reset-auth` and re-enter everything.
|
|
69
|
+
|
|
70
|
+
### Step 2 — API Keys
|
|
71
|
+
|
|
72
|
+
Keys are asked in sections. **Press Enter to skip** anything you don't have yet — you can add keys later with `jerob set-key`.
|
|
73
|
+
|
|
74
|
+
**Required for any AI feature:**
|
|
75
|
+
|
|
76
|
+
| Key | Where to get it |
|
|
77
|
+
|-----|----------------|
|
|
78
|
+
| OpenRouter API key | https://openrouter.ai/keys — `sk-or-v1-...` |
|
|
79
|
+
| Groq API key | https://console.groq.com — free, `gsk_...` |
|
|
80
|
+
|
|
81
|
+
**Integrations (optional):**
|
|
82
|
+
|
|
83
|
+
| Key | Where to get it |
|
|
84
|
+
|-----|----------------|
|
|
85
|
+
| Telegram Bot Token | `@BotFather` on Telegram |
|
|
86
|
+
| Telegram Owner Chat ID | See [Section 10](#10-telegram-bot-setup) |
|
|
87
|
+
|
|
88
|
+
**Supabase (required for Scheduler):**
|
|
89
|
+
|
|
90
|
+
| Key | Where to get it |
|
|
91
|
+
|-----|----------------|
|
|
92
|
+
| Supabase project URL | Supabase Dashboard → Settings → API → Project URL |
|
|
93
|
+
| Supabase service role key | Supabase Dashboard → Settings → API → service_role (secret) |
|
|
94
|
+
| Supabase personal access token | https://supabase.com/dashboard/account/tokens → New token |
|
|
95
|
+
|
|
96
|
+
The personal access token is used **once** to auto-deploy the scheduler. You won't be asked for it again after setup.
|
|
97
|
+
|
|
98
|
+
**Gmail OAuth (required for email features):**
|
|
99
|
+
|
|
100
|
+
| Key | Where to get it |
|
|
101
|
+
|-----|----------------|
|
|
102
|
+
| Google OAuth Client ID | Google Cloud Console — see [Section 8](#8-gmail--email-setup) |
|
|
103
|
+
| Google OAuth Client Secret | Google Cloud Console — see [Section 8](#8-gmail--email-setup) |
|
|
104
|
+
|
|
105
|
+
**Web / Browser Agent (optional):**
|
|
106
|
+
|
|
107
|
+
| Key | Where to get it |
|
|
108
|
+
|-----|----------------|
|
|
109
|
+
| Firecrawl API key | https://firecrawl.dev — `fc-...` |
|
|
110
|
+
| Apify API key | https://apify.com |
|
|
111
|
+
| Browserbase API key | https://browserbase.com |
|
|
112
|
+
| Browserbase Project ID | https://browserbase.com |
|
|
113
|
+
|
|
114
|
+
### Step 3 — Model configuration
|
|
115
|
+
|
|
116
|
+
First, choose your OpenRouter tier:
|
|
117
|
+
```
|
|
118
|
+
● Paid — access claude-3.5-sonnet, gpt-4o, etc.
|
|
119
|
+
○ Free — openrouter/free (no credits needed)
|
|
120
|
+
○ Skip — don't use OpenRouter
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Then pick your **primary model provider** (used for Agent, Plan, Ask, Browser Agent):
|
|
124
|
+
```
|
|
125
|
+
● Anthropic Claude (default: claude-3-5-sonnet-20241022)
|
|
126
|
+
○ OpenAI (default: gpt-4o-mini)
|
|
127
|
+
○ Google Gemini (default: gemini-2.5-flash)
|
|
128
|
+
○ Skip
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
You'll be asked for that provider's API key, then optionally choose a custom model ID.
|
|
132
|
+
|
|
133
|
+
Then pick **optional fallback providers** from the remaining two — these activate if the primary fails.
|
|
134
|
+
|
|
135
|
+
Groq is always included as the last-resort fallback (uses the key you entered in Step 2).
|
|
136
|
+
|
|
137
|
+
### What happens after setup
|
|
138
|
+
|
|
139
|
+
- All keys encrypted → `~/.cccontrol/config.json`
|
|
140
|
+
- `.env` written at the project root with all keys
|
|
141
|
+
- If Supabase credentials + personal access token were provided:
|
|
142
|
+
- Tables created automatically (`scheduler_tasks`, `scheduler_runs`, `user_config`)
|
|
143
|
+
- Edge Function deployed to Supabase
|
|
144
|
+
- pg_cron scheduled to fire every minute
|
|
145
|
+
- API keys synced to Supabase `user_config`
|
|
146
|
+
- Every subsequent `jerob jet` just asks for username + password
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 4. Agent Mode
|
|
151
|
+
|
|
152
|
+
Works immediately once you have any LLM key.
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
jerob jet → CLI → Agent Mode
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Describe your goal in plain English:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Create a REST API with Express, TypeScript, and CRUD endpoints for a users table
|
|
162
|
+
Refactor the auth module to use JWT instead of sessions
|
|
163
|
+
Add input validation to all route handlers
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The agent plans each step, stages the changes, shows you a diff, and asks for approval before writing anything. You can approve, reject, or abort at any step.
|
|
167
|
+
|
|
168
|
+
**No additional setup needed.**
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 5. Plan Mode
|
|
173
|
+
|
|
174
|
+
Same requirements as Agent Mode.
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
jerob jet → CLI → Plan Mode
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Enter your goal → optionally scan your workspace → review the generated plan → toggle individual steps → optionally hand off to Agent Mode for execution.
|
|
181
|
+
|
|
182
|
+
**No additional setup needed.**
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 6. Ask Mode
|
|
187
|
+
|
|
188
|
+
Needs an LLM key. Web search/crawl requires Firecrawl. Email tools require Gmail OAuth.
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
jerob jet → CLI → Ask Mode
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Examples:
|
|
195
|
+
```
|
|
196
|
+
What does the auth module do?
|
|
197
|
+
Search the web for the latest Claude API pricing
|
|
198
|
+
Read my last 5 emails and summarize them
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Session history is maintained within a single run.
|
|
202
|
+
|
|
203
|
+
**No additional setup beyond LLM + optional Firecrawl/Gmail.**
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 7. Browser Agent Mode
|
|
208
|
+
|
|
209
|
+
Requires a **Google Gemini API key** — Stagehand uses Gemini for DOM understanding.
|
|
210
|
+
|
|
211
|
+
### Step 1 — Gemini API key
|
|
212
|
+
|
|
213
|
+
1. Go to https://aistudio.google.com
|
|
214
|
+
2. Click "Get API key" → Create API key
|
|
215
|
+
3. Add it: `jerob set-key` → select Gemini → enter key
|
|
216
|
+
|
|
217
|
+
### Step 2 — Set your browser path
|
|
218
|
+
|
|
219
|
+
Open `plan/browser-agent/executor.ts` and set your browser's executable path:
|
|
220
|
+
|
|
221
|
+
**Windows (Brave):**
|
|
222
|
+
```ts
|
|
223
|
+
executablePath: "C:\\Program Files\\BraveSoftware\\Brave-Browser\\Application\\brave.exe",
|
|
224
|
+
args: [
|
|
225
|
+
'--user-data-dir=C:\\Users\\YOUR_USERNAME\\AppData\\Local\\BraveSoftware\\Brave-Browser\\User Data',
|
|
226
|
+
'--profile-directory=Default',
|
|
227
|
+
],
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**macOS (Brave):**
|
|
231
|
+
```ts
|
|
232
|
+
executablePath: "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser",
|
|
233
|
+
args: [
|
|
234
|
+
'--user-data-dir=/Users/YOUR_USERNAME/Library/Application Support/BraveSoftware/Brave-Browser',
|
|
235
|
+
'--profile-directory=Default',
|
|
236
|
+
],
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Replace `YOUR_USERNAME` with your OS username. Using your real browser profile means you're already signed into sites — no credentials needed in the automation.
|
|
240
|
+
|
|
241
|
+
### Step 3 — Use it
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
jerob jet → CLI → Browser Agent Mode
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Type your goal and watch the browser work.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 8. Gmail / Email Setup
|
|
252
|
+
|
|
253
|
+
Gmail uses OAuth2. You need a Google Cloud project with the Gmail API enabled.
|
|
254
|
+
|
|
255
|
+
### Step 1 — Create a Google Cloud project
|
|
256
|
+
|
|
257
|
+
1. Go to https://console.cloud.google.com
|
|
258
|
+
2. "New Project" → name it → Create
|
|
259
|
+
|
|
260
|
+
### Step 2 — Enable Gmail API
|
|
261
|
+
|
|
262
|
+
1. APIs & Services → Library
|
|
263
|
+
2. Search "Gmail API" → Enable
|
|
264
|
+
|
|
265
|
+
### Step 3 — Create OAuth credentials
|
|
266
|
+
|
|
267
|
+
1. APIs & Services → Credentials
|
|
268
|
+
2. "Create Credentials" → "OAuth client ID"
|
|
269
|
+
3. Application type: **Desktop app**
|
|
270
|
+
4. Copy the **Client ID** and **Client Secret**
|
|
271
|
+
|
|
272
|
+
### Step 4 — Configure OAuth consent screen
|
|
273
|
+
|
|
274
|
+
1. OAuth consent screen → User Type: **External**
|
|
275
|
+
2. App name + your email
|
|
276
|
+
3. Scopes: add `https://mail.google.com/`
|
|
277
|
+
4. Test users: add your Gmail address
|
|
278
|
+
|
|
279
|
+
### Step 5 — Add credentials to Jerob
|
|
280
|
+
|
|
281
|
+
During initial setup, or later:
|
|
282
|
+
```bash
|
|
283
|
+
jerob set-key
|
|
284
|
+
# Choose: Google OAuth credentials
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Enter:
|
|
288
|
+
```
|
|
289
|
+
Google OAuth Client ID → xxxx.apps.googleusercontent.com
|
|
290
|
+
Google OAuth Client Secret → GOCSPX-...
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
`PORT=8787` is automatically set in your `.env` — the OAuth callback server uses this port.
|
|
294
|
+
|
|
295
|
+
### Step 6 — First Gmail authentication
|
|
296
|
+
|
|
297
|
+
The first time any email operation runs:
|
|
298
|
+
1. Browser opens to `http://localhost:8787/auth/google`
|
|
299
|
+
2. Sign in with Google → grant permissions
|
|
300
|
+
3. Window closes — authenticated
|
|
301
|
+
|
|
302
|
+
The refresh token is stored in `~/.cccontrol/googleAuth/` and automatically synced to Supabase.
|
|
303
|
+
|
|
304
|
+
> If you're in **Google Cloud testing mode** (unverified app), tokens expire every 7 days. Push your app to production in the OAuth consent screen to get non-expiring tokens.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## 9. Scheduler Mode
|
|
309
|
+
|
|
310
|
+
The scheduler runs 24/7 in Supabase. Tasks execute every minute via `pg_cron` + Edge Functions — your machine doesn't need to be on.
|
|
311
|
+
|
|
312
|
+
### Step 1 — Create a Supabase project
|
|
313
|
+
|
|
314
|
+
1. https://supabase.com → New project
|
|
315
|
+
2. Settings → API → copy:
|
|
316
|
+
- **Project URL** (`https://xxxx.supabase.co`)
|
|
317
|
+
- **service_role** key (secret)
|
|
318
|
+
3. Settings → account tokens → create a **Personal Access Token**
|
|
319
|
+
|
|
320
|
+
### Step 2 — Enable required extensions
|
|
321
|
+
|
|
322
|
+
Supabase Dashboard → Database → Extensions:
|
|
323
|
+
- Enable **pg_cron**
|
|
324
|
+
- Enable **pg_net**
|
|
325
|
+
|
|
326
|
+
> `pg_net` is required. Without it, the cron job runs but `net.http_post()` silently does nothing.
|
|
327
|
+
|
|
328
|
+
### Step 3 — Auto-setup (recommended)
|
|
329
|
+
|
|
330
|
+
If you provided all three Supabase credentials during `jerob jet` setup (URL + service role key + personal access token), **everything below was done automatically**:
|
|
331
|
+
|
|
332
|
+
- Tables created
|
|
333
|
+
- RLS policies applied
|
|
334
|
+
- Edge Function deployed
|
|
335
|
+
- Secrets set on the Edge Function
|
|
336
|
+
- pg_cron scheduled
|
|
337
|
+
|
|
338
|
+
Skip to Step 6 to verify.
|
|
339
|
+
|
|
340
|
+
If you skipped the personal access token during setup, run:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
jerob setup-db
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
You'll be prompted for the token once. It handles everything.
|
|
347
|
+
|
|
348
|
+
### Step 4 — Manual setup (if auto-setup failed)
|
|
349
|
+
|
|
350
|
+
Install and link the Supabase CLI:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
npm i -g supabase
|
|
354
|
+
supabase login
|
|
355
|
+
supabase link --project-ref YOUR_PROJECT_REF
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Run the SQL manually:
|
|
359
|
+
1. Open Supabase Dashboard → SQL Editor
|
|
360
|
+
2. Open `scheduler/SETUP-READY.sql`
|
|
361
|
+
3. Replace `YOUR_PROJECT_REF` and `YOUR_SERVICE_ROLE_KEY` placeholders at the bottom
|
|
362
|
+
4. Paste and click **RUN**
|
|
363
|
+
|
|
364
|
+
Deploy the Edge Function:
|
|
365
|
+
```bash
|
|
366
|
+
supabase functions deploy scheduler-tick --no-verify-jwt
|
|
367
|
+
supabase secrets set SUPABASE_URL=https://xxxx.supabase.co
|
|
368
|
+
supabase secrets set SUPABASE_SERVICE_ROLE_KEY=eyJ...
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### Step 5 — Sync API keys to Supabase
|
|
372
|
+
|
|
373
|
+
API keys are synced automatically every time you run `jerob jet`. To force a sync:
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
jerob sync-credentials
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Run this any time you update a key that the scheduler needs (OpenRouter, Groq, Gemini, Firecrawl, Gmail).
|
|
380
|
+
|
|
381
|
+
### Step 6 — Verify everything
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
jerob scheduler-debug
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Expected output:
|
|
388
|
+
```
|
|
389
|
+
✓ Supabase connected
|
|
390
|
+
✓ Credentials in user_config
|
|
391
|
+
✓ Edge Function responds: { ran: 0, message: "No tasks due" }
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Step 7 — Create your first task
|
|
395
|
+
|
|
396
|
+
```
|
|
397
|
+
jerob jet → CLI → Scheduler → Add new task
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Describe in plain English:
|
|
401
|
+
```
|
|
402
|
+
Every morning at 9am, search for the top AI news and email me a summary at me@gmail.com
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
The AI plans the steps and suggests a cron. You can edit the schedule — type a time like `9:00am` and it converts to UTC automatically.
|
|
406
|
+
|
|
407
|
+
### Task time reference (IST example)
|
|
408
|
+
|
|
409
|
+
| You type | Stored (UTC) | Fires at |
|
|
410
|
+
|----------|-------------|----------|
|
|
411
|
+
| `9:00am` | `30 3 * * *` | 9:00 AM IST |
|
|
412
|
+
| `8:30pm` | `0 15 * * *` | 8:30 PM IST |
|
|
413
|
+
| `11:00pm` | `30 17 * * *` | 11:00 PM IST |
|
|
414
|
+
|
|
415
|
+
Formula: `your local time - local UTC offset = UTC`
|
|
416
|
+
|
|
417
|
+
### View task run history + errors
|
|
418
|
+
|
|
419
|
+
```
|
|
420
|
+
jerob jet → CLI → Scheduler → Manage → View run history
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Failed runs show the error category and a fix hint:
|
|
424
|
+
- **LLM API Key Error** → run `jerob set-key` then `jerob sync-credentials`
|
|
425
|
+
- **No LLM Keys Configured** → run `jerob sync-credentials`
|
|
426
|
+
- **Gmail Auth Error** → re-authenticate via any email operation in Ask Mode
|
|
427
|
+
- **Rate Limit / Quota** → switch provider or wait
|
|
428
|
+
|
|
429
|
+
### Debug SQL (run in Supabase SQL Editor)
|
|
430
|
+
|
|
431
|
+
```sql
|
|
432
|
+
-- Check cron job exists
|
|
433
|
+
SELECT jobname, schedule, active FROM cron.job;
|
|
434
|
+
|
|
435
|
+
-- Check task schedule
|
|
436
|
+
SELECT name, cron, next_run_at, last_run_at, enabled FROM scheduler_tasks;
|
|
437
|
+
|
|
438
|
+
-- Check recent runs
|
|
439
|
+
SELECT task_id, status, error, started_at
|
|
440
|
+
FROM scheduler_runs
|
|
441
|
+
ORDER BY started_at DESC LIMIT 10;
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## 10. Telegram Bot Setup
|
|
447
|
+
|
|
448
|
+
Control Jerob from your phone.
|
|
449
|
+
|
|
450
|
+
### Step 1 — Create a bot
|
|
451
|
+
|
|
452
|
+
1. Open Telegram → `@BotFather` → `/newbot`
|
|
453
|
+
2. Follow prompts → get a token: `123456:ABC-DEF...`
|
|
454
|
+
|
|
455
|
+
### Step 2 — Get your chat ID
|
|
456
|
+
|
|
457
|
+
1. Send any message to your new bot
|
|
458
|
+
2. Open: `https://api.telegram.org/bot<TOKEN>/getUpdates`
|
|
459
|
+
3. Find `"chat":{"id":XXXXXXX}` — that's your owner ID
|
|
460
|
+
|
|
461
|
+
### Step 3 — Add to Jerob
|
|
462
|
+
|
|
463
|
+
During setup or via `jerob set-key`:
|
|
464
|
+
```
|
|
465
|
+
Telegram Bot Token → 123456:ABC-...
|
|
466
|
+
Telegram Owner Chat ID → 1234567890
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### Step 4 — Start Telegram mode
|
|
470
|
+
|
|
471
|
+
```
|
|
472
|
+
jerob jet → Telegram
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
From your phone:
|
|
476
|
+
```
|
|
477
|
+
/agent <goal> — run Agent Mode
|
|
478
|
+
/ask <question> — chat with AI
|
|
479
|
+
/plan <goal> — generate a plan
|
|
480
|
+
/email <op> — email operations
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
Only your owner ID can send commands — all other users are ignored.
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
## 11. Managing Keys & Models
|
|
488
|
+
|
|
489
|
+
### Update any API key
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
jerob set-key
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Switch active model for a provider
|
|
496
|
+
|
|
497
|
+
```bash
|
|
498
|
+
jerob switch-model
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
Shows the current model per provider. Reset to default or enter a custom model ID.
|
|
502
|
+
|
|
503
|
+
**Available models:**
|
|
504
|
+
|
|
505
|
+
| Provider | Default | Examples |
|
|
506
|
+
|----------|---------|---------|
|
|
507
|
+
| OpenRouter (paid) | `anthropic/claude-3.5-sonnet` | `openai/gpt-4o`, `google/gemini-pro-1.5` |
|
|
508
|
+
| OpenRouter (free) | `openrouter/free` | `meta-llama/llama-3.1-8b-instruct:free` |
|
|
509
|
+
| Gemini | `gemini-2.5-flash` | `gemini-1.5-pro`, `gemini-2.0-flash` |
|
|
510
|
+
| Claude | `claude-3-5-sonnet-20241022` | `claude-3-haiku-20240307` |
|
|
511
|
+
| OpenAI | `gpt-4o-mini` | `gpt-4o`, `o1-mini` |
|
|
512
|
+
| Groq | `llama-3.3-70b-versatile` | `mixtral-8x7b-32768`, `gemma2-9b-it` |
|
|
513
|
+
|
|
514
|
+
### Reset everything
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
jerob reset-auth
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
Wipes `~/.cccontrol/config.json`. Next `jerob jet` starts fresh.
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
## 12. CLI Reference
|
|
525
|
+
|
|
526
|
+
| Command | Description |
|
|
527
|
+
|---------|-------------|
|
|
528
|
+
| `jerob jet` | Launch Jerob — login or setup on first run |
|
|
529
|
+
| `jerob set-key` | Update any stored API key |
|
|
530
|
+
| `jerob switch-model` | Switch the active model for any provider |
|
|
531
|
+
| `jerob reset-auth` | Wipe all credentials and start fresh |
|
|
532
|
+
| `jerob sync-credentials` | Force-push API keys to Supabase `user_config` |
|
|
533
|
+
| `jerob setup-db` | Re-run Supabase schema + Edge Function deploy |
|
|
534
|
+
| `jerob scheduler-debug` | Diagnose scheduler connectivity and credentials |
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
## 13. Troubleshooting
|
|
539
|
+
|
|
540
|
+
### "No AI model available"
|
|
541
|
+
|
|
542
|
+
No LLM key is configured or the key format is wrong. Run `jerob set-key` and add at least one provider (Groq is free and a good starting point).
|
|
543
|
+
|
|
544
|
+
### "Failed to decrypt keys — wrong password?"
|
|
545
|
+
|
|
546
|
+
Wrong password at login. Run `jerob reset-auth` and re-enter all keys from scratch.
|
|
547
|
+
|
|
548
|
+
### `.env` file is missing
|
|
549
|
+
|
|
550
|
+
Expected — `.env` is never committed to git. Run `jerob jet` and complete setup. `.env` is written automatically.
|
|
551
|
+
|
|
552
|
+
### Scheduler tasks don't run automatically
|
|
553
|
+
|
|
554
|
+
Check in order:
|
|
555
|
+
1. `pg_net` enabled → Supabase Dashboard → Database → Extensions
|
|
556
|
+
2. Cron job URL is correct → `SELECT jobname, command FROM cron.job;` in SQL Editor
|
|
557
|
+
3. API keys in `user_config` → run `jerob sync-credentials`
|
|
558
|
+
4. Edge Function deployed → `jerob scheduler-debug`
|
|
559
|
+
|
|
560
|
+
### "All LLM providers failed"
|
|
561
|
+
|
|
562
|
+
Keys are not in Supabase. Run `jerob sync-credentials`. Then check `user_config` table has entries.
|
|
563
|
+
|
|
564
|
+
### "Gmail token refresh failed" / Gmail Auth Error
|
|
565
|
+
|
|
566
|
+
Refresh token revoked or expired. Re-authenticate: use any email operation in Ask Mode — the OAuth flow opens automatically.
|
|
567
|
+
|
|
568
|
+
If you're in Google Cloud **testing mode**, tokens expire every 7 days. Fix: OAuth consent screen → publish the app to production.
|
|
569
|
+
|
|
570
|
+
### Browser Agent doesn't open
|
|
571
|
+
|
|
572
|
+
Gemini API key missing, or browser path wrong. Check `plan/browser-agent/executor.ts` has your correct browser executable path.
|
|
573
|
+
|
|
574
|
+
### Port 8787 in use (OAuth fails)
|
|
575
|
+
|
|
576
|
+
Something else is using port 8787. Stop it, or change `PORT=8787` in `.env` and update `email_ops/email_server.ts` to match.
|
|
577
|
+
|
|
578
|
+
### "Supabase is not configured"
|
|
579
|
+
|
|
580
|
+
`SUPABASE_URL` or `SUPABASE_SERVICE_ROLE_KEY` missing from `.env`. Run `jerob set-key` to add them, then restart with `jerob jet`.
|
|
581
|
+
|
|
582
|
+
### Auto-setup failed during first run
|
|
583
|
+
|
|
584
|
+
Run `jerob setup-db` — it will prompt for your personal access token and retry the full setup. Or set up manually following [Section 9 Step 4](#step-4--manual-setup-if-auto-setup-failed).
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type {ActionLog,ActionStatus} from "./types";
|
|
2
|
+
import {isMutationType} from "./types";
|
|
3
|
+
export class ActionTracker{
|
|
4
|
+
|
|
5
|
+
private actions:ActionLog[]=[];
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
log(
|
|
10
|
+
entry: Omit<ActionLog,'id'|'timestamp'> & {
|
|
11
|
+
'id'?:string,
|
|
12
|
+
'timestamp'?:Date
|
|
13
|
+
}
|
|
14
|
+
):ActionLog {
|
|
15
|
+
|
|
16
|
+
const action={
|
|
17
|
+
id:entry.id ?? `action_${this.actions.length}`,
|
|
18
|
+
timestamp:entry.timestamp ?? new Date(),
|
|
19
|
+
type:entry.type,
|
|
20
|
+
path:entry.path,
|
|
21
|
+
details:{...entry.details},
|
|
22
|
+
status:entry.status,
|
|
23
|
+
userApproved:entry.userApproved,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
this.actions.push(action)
|
|
27
|
+
|
|
28
|
+
return action
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getActions(): readonly ActionLog[]{
|
|
32
|
+
return this.actions
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getPendingMutations(): ActionLog[]{
|
|
36
|
+
return this.actions.filter((e)=>isMutationType(e.type) && e.status === 'pending')
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
updateStatus(id: string,status: ActionStatus,userApproved?:boolean){
|
|
40
|
+
const ac=this.actions.find((e)=>e.id==id)
|
|
41
|
+
if(!ac) return;
|
|
42
|
+
ac.status=status
|
|
43
|
+
if(userApproved!==undefined) ac.userApproved=userApproved
|
|
44
|
+
}
|
|
45
|
+
}
|