instar 0.7.1 → 0.7.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/.claude/skills/setup-wizard/skill.md +176 -103
- package/.vercel/README.txt +11 -0
- package/.vercel/project.json +1 -0
- package/dist/cli.js +0 -0
- package/dist/commands/setup.js +6 -0
- package/package.json +1 -1
|
@@ -254,9 +254,24 @@ This project uses instar for persistent agent capabilities.
|
|
|
254
254
|
|
|
255
255
|
**Telegram comes BEFORE technical configuration.** It's the whole point — everything else supports getting the user onto Telegram.
|
|
256
256
|
|
|
257
|
+
### Step 3-pre: Brief Telegram Introduction
|
|
258
|
+
|
|
259
|
+
Not everyone knows what Telegram is. Before asking about setup, give a one-paragraph intro:
|
|
260
|
+
|
|
261
|
+
> **Telegram** is a free messaging app — like iMessage or WhatsApp, but with features that make it perfect for talking to an AI agent. It supports topic threads (like Slack channels), works on phone and desktop, and has a great bot API.
|
|
262
|
+
>
|
|
263
|
+
> If you don't have it yet, install it on your phone first: https://telegram.org/apps
|
|
264
|
+
> You'll need your phone to log in on the web too.
|
|
265
|
+
|
|
266
|
+
Then ask: "Do you have Telegram installed? If not, take a minute to set it up and come back."
|
|
267
|
+
|
|
268
|
+
Wait for confirmation before proceeding. If they say no or want to skip, accept in one sentence and move on.
|
|
269
|
+
|
|
270
|
+
### Why Telegram
|
|
271
|
+
|
|
257
272
|
Frame it clearly:
|
|
258
273
|
|
|
259
|
-
>
|
|
274
|
+
> Once connected, Telegram is where your agent lives:
|
|
260
275
|
> - **Just talk** — no commands, no terminal, just conversation
|
|
261
276
|
> - **Topic threads** — organized channels for different concerns
|
|
262
277
|
> - **Mobile access** — your agent is always reachable
|
|
@@ -268,123 +283,181 @@ For **Project Agents**: Telegram is strongly recommended. Frame it as: "Your age
|
|
|
268
283
|
|
|
269
284
|
If the user declines, accept it in one sentence and move on — but they should understand they're choosing the terminal-only experience.
|
|
270
285
|
|
|
271
|
-
|
|
286
|
+
### Browser Automation Strategy
|
|
272
287
|
|
|
273
|
-
**
|
|
288
|
+
**Use Playwright (mcp__playwright__*) as the primary browser automation tool.** It is more reliable than the Chrome extension. The Chrome extension (mcp__claude-in-chrome__*) is a fallback only.
|
|
274
289
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
**
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
- **CRITICAL: Store the token** — you'll need it for config.json
|
|
306
|
-
|
|
307
|
-
3. **Create a group**:
|
|
308
|
-
- Take a snapshot of the main Telegram screen
|
|
309
|
-
- Find and click the "New Message" / compose / pencil button (usually bottom-left area of chat list)
|
|
310
|
-
- Take a snapshot, find "New Group" option, click it
|
|
311
|
-
- In the "Add Members" search, type the bot username you just created
|
|
312
|
-
- Take a snapshot, find the bot in results, click to select it
|
|
313
|
-
- Find and click the "Next" / arrow button to proceed
|
|
314
|
-
- Type the group name (use the project name, e.g., "My Project")
|
|
315
|
-
- Find and click "Create" / checkmark button
|
|
316
|
-
- Wait 2 seconds for the group to be created
|
|
317
|
-
|
|
318
|
-
4. **Enable Topics**:
|
|
319
|
-
- Take a snapshot of the new group chat
|
|
320
|
-
- Click on the group name/header at the top to open group info
|
|
321
|
-
- Take a snapshot, find the Edit / pencil button, click it
|
|
322
|
-
- Take a snapshot, look for "Topics" toggle and enable it
|
|
323
|
-
- If you don't see Topics directly, look for "Group Type" or "Chat Type" first — changing this may reveal the Topics toggle
|
|
324
|
-
- Find and click Save / checkmark
|
|
325
|
-
- Wait 2 seconds
|
|
326
|
-
|
|
327
|
-
5. **Make bot admin**:
|
|
328
|
-
- Take a snapshot of the group info or edit screen
|
|
329
|
-
- Navigate to Administrators section (may need to click group name first, then Edit)
|
|
330
|
-
- Click "Add Admin" or "Add Administrator"
|
|
331
|
-
- Search for your bot username
|
|
332
|
-
- Take a snapshot, find the bot, click to select
|
|
333
|
-
- Click Save / Done to confirm admin rights
|
|
334
|
-
- Wait 2 seconds
|
|
335
|
-
|
|
336
|
-
6. **Detect chat ID**:
|
|
337
|
-
- Type "hello" in the group chat and send it (this triggers the bot to see the group)
|
|
338
|
-
- Wait 3 seconds for the message to propagate to the bot
|
|
339
|
-
- Use Bash to call the Telegram Bot API:
|
|
340
|
-
```bash
|
|
341
|
-
curl -s "https://api.telegram.org/bot${TOKEN}/getUpdates?offset=-1" > /dev/null
|
|
342
|
-
curl -s "https://api.telegram.org/bot${TOKEN}/getUpdates?timeout=5"
|
|
343
|
-
```
|
|
344
|
-
- Parse the response to find `chat.id` where `chat.type` is "supergroup" or "group"
|
|
345
|
-
- If auto-detection fails, try once more (send another message, wait, call API again)
|
|
346
|
-
|
|
347
|
-
**Browser automation tips:**
|
|
348
|
-
- **Always take a snapshot** before interacting. Telegram Web's UI changes frequently.
|
|
349
|
-
- **Use `mcp__playwright__browser_snapshot`** to see the accessibility tree (more reliable than screenshots for finding elements).
|
|
350
|
-
- **Use `mcp__playwright__browser_click`** with element refs from the snapshot.
|
|
351
|
-
- **Use `mcp__playwright__browser_type`** to type text into inputs. For the Telegram message input, you may need to find the message input ref and use `submit: true` to send.
|
|
352
|
-
- **Wait 2-3 seconds** after each action for Telegram to process. Use `mcp__playwright__browser_wait_for({ time: 2 })`.
|
|
353
|
-
- **If an element isn't found**, take a fresh snapshot — Telegram may have changed the view.
|
|
354
|
-
- **Telegram Web uses version "a"** (web.telegram.org/a/) — this is the React-based client.
|
|
355
|
-
- **If something goes wrong**, tell the user what happened and offer to retry that step or fall back to manual instructions.
|
|
290
|
+
**CRITICAL UX RULE: Never silently attempt browser automation.** The user must know what's happening at every step. If something fails, explain what happened — don't just report "it didn't work."
|
|
291
|
+
|
|
292
|
+
#### Step 3a: Detect Available Browser Tools
|
|
293
|
+
|
|
294
|
+
Before telling the user anything about browser automation, silently check what tools you have:
|
|
295
|
+
|
|
296
|
+
1. Try calling `mcp__playwright__browser_snapshot` — if it succeeds or returns a meaningful error (like "no page open"), Playwright is available.
|
|
297
|
+
2. If Playwright is NOT available, check for `mcp__claude-in-chrome__tabs_context_mcp`.
|
|
298
|
+
3. If NEITHER is available, go directly to **Manual Fallback** (Step 3g below).
|
|
299
|
+
|
|
300
|
+
Do NOT tell the user about tools that don't work. Only present the path you can actually execute.
|
|
301
|
+
|
|
302
|
+
#### Step 3b: Announce What's About to Happen
|
|
303
|
+
|
|
304
|
+
**Always warn the user before opening a browser.** Say exactly this:
|
|
305
|
+
|
|
306
|
+
> "I'm going to open a browser window to set up Telegram automatically. I'll create a bot, set up a group, and configure everything."
|
|
307
|
+
>
|
|
308
|
+
> "A browser window will appear — you'll need to log into Telegram there if you're not already logged in."
|
|
309
|
+
>
|
|
310
|
+
> "Ready? Say OK and I'll open it."
|
|
311
|
+
|
|
312
|
+
**Wait for the user to confirm before proceeding.** Do NOT open the browser until they say OK/yes/go/ready.
|
|
313
|
+
|
|
314
|
+
#### Step 3c: Open Browser and Navigate
|
|
315
|
+
|
|
316
|
+
**Using Playwright (preferred):**
|
|
317
|
+
```
|
|
318
|
+
mcp__playwright__browser_navigate({ url: "https://web.telegram.org/a/" })
|
|
319
|
+
```
|
|
356
320
|
|
|
357
|
-
|
|
321
|
+
**Using Chrome extension (fallback):**
|
|
322
|
+
```
|
|
323
|
+
mcp__claude-in-chrome__tabs_context_mcp({ createIfEmpty: true })
|
|
324
|
+
# Then create a new tab and navigate
|
|
325
|
+
mcp__claude-in-chrome__tabs_create_mcp()
|
|
326
|
+
mcp__claude-in-chrome__navigate({ url: "https://web.telegram.org/a/", tabId: TAB_ID })
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
After navigating, take a snapshot to check the page state:
|
|
330
|
+
```
|
|
331
|
+
mcp__playwright__browser_snapshot()
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### Step 3d: Handle Login
|
|
335
|
+
|
|
336
|
+
Check the snapshot for login indicators (QR code screen, "Log in" text, phone number input). Two possible states:
|
|
337
|
+
|
|
338
|
+
**If already logged in** (you see a chat list, search bar, contacts):
|
|
339
|
+
> "You're logged in. Starting the setup now."
|
|
340
|
+
|
|
341
|
+
Proceed to Step 3e.
|
|
342
|
+
|
|
343
|
+
**If NOT logged in** (you see QR code or login screen):
|
|
358
344
|
|
|
359
|
-
|
|
345
|
+
Tell the user:
|
|
346
|
+
> "I see the Telegram login screen in the browser window I just opened."
|
|
347
|
+
>
|
|
348
|
+
> "Please log in now — you can scan the QR code with your phone's Telegram app (Settings > Devices > Link Desktop Device)."
|
|
349
|
+
>
|
|
350
|
+
> "Let me know when you're logged in and I'll continue."
|
|
351
|
+
|
|
352
|
+
**Wait for the user to confirm they've logged in.** Then take another snapshot to verify. If still not logged in, tell them what you see and ask again. Do NOT proceed until login is confirmed by snapshot.
|
|
353
|
+
|
|
354
|
+
#### Step 3e: Automated Telegram Setup
|
|
355
|
+
|
|
356
|
+
Once the user is logged in, automate the entire setup. **Take a snapshot before EVERY interaction** — Telegram Web's UI changes frequently and elements shift.
|
|
357
|
+
|
|
358
|
+
**Step 3e-i: Create a bot via @BotFather**
|
|
359
|
+
|
|
360
|
+
1. Take a snapshot, find the search input, click it
|
|
361
|
+
2. Type "BotFather" in the search bar
|
|
362
|
+
3. Take a snapshot, find @BotFather in the results (has blue checkmark), click it
|
|
363
|
+
4. Take a snapshot, find the message input area
|
|
364
|
+
5. If you see a "Start" button, click it. Otherwise type `/start` and submit
|
|
365
|
+
6. Wait 2-3 seconds, take a snapshot to see BotFather's response
|
|
366
|
+
7. Type `/newbot` and submit
|
|
367
|
+
8. Wait 2-3 seconds, take a snapshot — BotFather asks for a display name
|
|
368
|
+
9. Type the bot display name (e.g., "My Project Agent") and submit
|
|
369
|
+
10. Wait 2-3 seconds, take a snapshot — BotFather asks for a username
|
|
370
|
+
11. Type the bot username (e.g., `myproject_agent_bot` — must end in "bot", lowercase + underscores) and submit
|
|
371
|
+
12. Wait 3-4 seconds, take a snapshot — BotFather responds with the token
|
|
372
|
+
13. **Extract the bot token** from the response. It looks like `7123456789:AAHn3-xYz_example` — a number, colon, then alphanumeric string. Read the page text if needed.
|
|
373
|
+
14. **CRITICAL: Store the token** — you'll need it for config.json
|
|
374
|
+
|
|
375
|
+
If the username is taken, BotFather will say so. Try a variation (add random digits) and retry.
|
|
376
|
+
|
|
377
|
+
Tell the user: "Bot created! Moving on to the group setup."
|
|
378
|
+
|
|
379
|
+
**Step 3e-ii: Create a group**
|
|
380
|
+
|
|
381
|
+
1. Navigate back to the main chat list (click the back arrow or Telegram logo)
|
|
382
|
+
2. Take a snapshot, find the "New Message" / compose / pencil button (usually bottom-left of chat list)
|
|
383
|
+
3. Click it, take a snapshot, find "New Group" option, click it
|
|
384
|
+
4. In "Add Members" search, type the bot username you just created
|
|
385
|
+
5. Take a snapshot, find the bot in results, click to select it
|
|
386
|
+
6. Find and click the "Next" / arrow button to proceed
|
|
387
|
+
7. Type the group name (e.g., "My Project")
|
|
388
|
+
8. Find and click "Create" / checkmark button
|
|
389
|
+
9. Wait 2-3 seconds for the group to be created
|
|
390
|
+
|
|
391
|
+
**Step 3e-iii: Enable Topics**
|
|
392
|
+
|
|
393
|
+
1. Take a snapshot of the new group chat
|
|
394
|
+
2. Click on the group name/header at the top to open group info
|
|
395
|
+
3. Take a snapshot, find the Edit / pencil button, click it
|
|
396
|
+
4. Take a snapshot, look for "Topics" toggle and enable it
|
|
397
|
+
5. If you don't see Topics directly, look for "Group Type" or "Chat Type" first — changing this may reveal the Topics toggle
|
|
398
|
+
6. Find and click Save / checkmark
|
|
399
|
+
7. Wait 2 seconds
|
|
400
|
+
|
|
401
|
+
**Step 3e-iv: Make bot admin**
|
|
402
|
+
|
|
403
|
+
1. Take a snapshot of the group info/edit screen
|
|
404
|
+
2. Navigate to Administrators section (may need to click group name first, then Edit)
|
|
405
|
+
3. Click "Add Admin" or "Add Administrator"
|
|
406
|
+
4. Search for your bot username
|
|
407
|
+
5. Take a snapshot, find the bot, click to select
|
|
408
|
+
6. Click Save / Done to confirm admin rights
|
|
409
|
+
7. Wait 2 seconds
|
|
410
|
+
|
|
411
|
+
**Step 3e-v: Detect chat ID**
|
|
412
|
+
|
|
413
|
+
1. Navigate back to the group chat
|
|
414
|
+
2. Type "hello" in the message input and send it
|
|
415
|
+
3. Wait 3 seconds for the message to reach the bot
|
|
416
|
+
4. Use Bash to call the Telegram Bot API:
|
|
417
|
+
```bash
|
|
418
|
+
curl -s "https://api.telegram.org/bot${TOKEN}/getUpdates?offset=-1" > /dev/null
|
|
419
|
+
sleep 1
|
|
420
|
+
curl -s "https://api.telegram.org/bot${TOKEN}/getUpdates?timeout=5"
|
|
421
|
+
```
|
|
422
|
+
5. Parse the response to find `chat.id` where `chat.type` is "supergroup" or "group"
|
|
423
|
+
6. If auto-detection fails, send another message, wait, and retry once
|
|
424
|
+
7. If still failing, ask the user for the chat ID manually (look at the URL in Telegram Web — prepend `-100` to the number)
|
|
360
425
|
|
|
361
|
-
|
|
362
|
-
- Open https://web.telegram.org
|
|
363
|
-
- Search for @BotFather, send `/newbot`
|
|
364
|
-
- Choose a name and username (must end in "bot")
|
|
365
|
-
- Copy the bot token (looks like `7123456789:AAHn3-xYz...`)
|
|
426
|
+
#### Step 3f: Confirm Success
|
|
366
427
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
- Give the group a name
|
|
428
|
+
After all steps succeed, tell the user:
|
|
429
|
+
> "Telegram is set up! Bot token and chat ID saved."
|
|
370
430
|
|
|
371
|
-
|
|
372
|
-
|
|
431
|
+
Close the browser if using Playwright:
|
|
432
|
+
```
|
|
433
|
+
mcp__playwright__browser_close()
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
#### Step 3g: Manual Fallback
|
|
373
437
|
|
|
374
|
-
|
|
375
|
-
- Group info, Edit, Administrators, Add your bot
|
|
438
|
+
**Only use this if NO browser automation tools are available.** If you tried browser automation and it failed partway, tell the user exactly what succeeded and what still needs doing — don't restart from scratch.
|
|
376
439
|
|
|
377
|
-
|
|
378
|
-
- Ask the user to send any message in the group
|
|
379
|
-
- Call the Telegram Bot API to detect:
|
|
440
|
+
Walk the user through each step with clear instructions:
|
|
380
441
|
|
|
442
|
+
1. **Create a bot** — Open https://web.telegram.org, search for @BotFather, send `/newbot`, follow prompts, copy the token
|
|
443
|
+
2. **Create a group** — New Group, add the bot, give it a name
|
|
444
|
+
3. **Enable Topics** — Group info > Edit > turn on Topics
|
|
445
|
+
4. **Make bot admin** — Group info > Edit > Administrators > Add bot
|
|
446
|
+
5. **Detect chat ID** — Ask user to send a message in the group, then call Bot API:
|
|
381
447
|
```bash
|
|
382
448
|
curl -s "https://api.telegram.org/bot${TOKEN}/getUpdates?offset=-1" > /dev/null
|
|
383
449
|
curl -s "https://api.telegram.org/bot${TOKEN}/getUpdates?timeout=5"
|
|
384
450
|
```
|
|
385
451
|
|
|
386
|
-
|
|
387
|
-
|
|
452
|
+
### Browser Automation Tips
|
|
453
|
+
|
|
454
|
+
- **Always take a snapshot before interacting.** Telegram Web's UI changes frequently.
|
|
455
|
+
- **Use `browser_snapshot`** (accessibility tree) over screenshots for finding elements — more reliable.
|
|
456
|
+
- **Wait 2-3 seconds** after each action for Telegram to process.
|
|
457
|
+
- **If an element isn't found**, take a fresh snapshot — the view may have changed.
|
|
458
|
+
- **Telegram Web uses version "a"** (web.telegram.org/a/) — this is the React-based client.
|
|
459
|
+
- **If something goes wrong**, tell the user exactly what happened and what you see. Offer to retry that specific step or fall back to manual for just the remaining steps.
|
|
460
|
+
- **NEVER silently fail.** If a browser action doesn't work, say "I tried to click X but it didn't respond. Here's what I see on screen: [describe]. Let me try another approach."
|
|
388
461
|
|
|
389
462
|
## Phase 4: Technical Configuration
|
|
390
463
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
> Why do I have a folder named ".vercel" in my project?
|
|
2
|
+
The ".vercel" folder is created when you link a directory to a Vercel project.
|
|
3
|
+
|
|
4
|
+
> What does the "project.json" file contain?
|
|
5
|
+
The "project.json" file contains:
|
|
6
|
+
- The ID of the Vercel project that you linked ("projectId")
|
|
7
|
+
- The ID of the user or team your Vercel project is owned by ("orgId")
|
|
8
|
+
|
|
9
|
+
> Should I commit the ".vercel" folder?
|
|
10
|
+
No, you should not share the ".vercel" folder with anyone.
|
|
11
|
+
Upon creation, it will be automatically added to your ".gitignore" file.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"projectId":"prj_evM5LcItYL3IAmw8zNvEPGrHeaya","orgId":"team_dHctwIDcV3X9ydapQlCPHFGI","projectName":"claude-agent-kit"}
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/commands/setup.js
CHANGED
|
@@ -237,6 +237,9 @@ async function runClassicSetup() {
|
|
|
237
237
|
console.log();
|
|
238
238
|
console.log(pc.bold(' Telegram — How You Talk to Your Agent'));
|
|
239
239
|
console.log();
|
|
240
|
+
console.log(pc.dim(' Telegram is a free messaging app (like iMessage or WhatsApp) with'));
|
|
241
|
+
console.log(pc.dim(' features perfect for AI agents: topic threads, bot API, mobile + desktop.'));
|
|
242
|
+
console.log();
|
|
240
243
|
console.log(pc.dim(' Once connected, you just talk — no commands, no terminal.'));
|
|
241
244
|
console.log(pc.dim(' Topic threads, message history, mobile access, proactive notifications.'));
|
|
242
245
|
if (!isProjectAgent) {
|
|
@@ -244,6 +247,9 @@ async function runClassicSetup() {
|
|
|
244
247
|
console.log(pc.dim(' For a personal agent, Telegram IS the interface.'));
|
|
245
248
|
}
|
|
246
249
|
console.log();
|
|
250
|
+
console.log(pc.dim(` If you don't have Telegram yet: ${pc.cyan('https://telegram.org/apps')}`));
|
|
251
|
+
console.log(pc.dim(' Install it on your phone first — you\'ll need it to log in on the web.'));
|
|
252
|
+
console.log();
|
|
247
253
|
const telegramConfig = await promptForTelegram();
|
|
248
254
|
// ── Step 3: Server config (sensible defaults) ──────────────────
|
|
249
255
|
const port = await number({
|