instar 0.12.21 → 0.12.22

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.
@@ -1283,9 +1283,11 @@ Tell the user:
1283
1283
 
1284
1284
  **Wait for confirmation.**
1285
1285
 
1286
- **Option A: Dashboard QR (preferred — no external browser needed)**
1286
+ **Option A: Dashboard QR (preferred)**
1287
1287
 
1288
- The agent's dashboard serves the QR code at `GET /whatsapp/qr`. Open this in the browser:
1288
+ The dashboard renders the WhatsApp QR code after PIN authentication. **Do NOT navigate directly to `/whatsapp/qr`** that API endpoint requires a Bearer auth header which browsers can't pass via URL. Instead, use the dashboard UI:
1289
+
1290
+ **Step 1: Navigate to dashboard**
1289
1291
 
1290
1292
  **If using Playwright:**
1291
1293
  ```
@@ -1297,22 +1299,53 @@ mcp__playwright__browser_navigate({ url: "http://localhost:<PORT>/dashboard" })
1297
1299
  mcp__claude-in-chrome__navigate({ url: "http://localhost:<PORT>/dashboard", tabId: <tab_id> })
1298
1300
  ```
1299
1301
 
1300
- Navigate to the WhatsApp section of the dashboard. The QR code should be visible.
1302
+ **Step 2: Authenticate with PIN**
1301
1303
 
1302
- Tell the user:
1304
+ The dashboard requires a PIN (the `authToken` from `.instar/config.json`). Read the PIN:
1305
+ ```bash
1306
+ jq -r '.authToken' <project_dir>/.instar/config.json
1307
+ ```
1308
+
1309
+ Take a snapshot to find the PIN input field, enter the PIN, and click Connect/Submit.
1310
+
1311
+ **Step 3: Open WhatsApp QR panel**
1312
+
1313
+ After authenticating, look for a "WhatsApp" button in the dashboard header. Click it to open the QR panel. The dashboard fetches `/whatsapp/qr` with the auth token internally and renders the QR code using the qrcode.js library.
1314
+
1315
+ **Step 4: Wait for QR to appear**
1316
+
1317
+ The WhatsApp adapter may take a few seconds to generate the first QR code after server start. If the QR panel shows "disconnected" or no QR:
1318
+ - Wait 5 seconds and refresh the panel (click the WhatsApp button again)
1319
+ - Retry up to 6 times (30 seconds total)
1320
+ - The Baileys adapter needs time to initialize and receive the first QR from WhatsApp servers
1321
+
1322
+ Once the QR is visible, tell the user:
1303
1323
 
1304
1324
  > A QR code should be visible in the browser window. On your phone:
1305
1325
  > 1. Open WhatsApp
1306
1326
  > 2. Go to **Settings → Linked Devices → Link a Device**
1307
1327
  > 3. Scan the QR code in the browser
1328
+ >
1329
+ > Note: The QR code refreshes every ~20 seconds — that's normal. Just scan the current one.
1330
+
1331
+ **Option B: Fetch QR via API and display (fallback if dashboard doesn't render)**
1308
1332
 
1309
- **Option B: WhatsApp Web direct (fallback if dashboard QR isn't rendering)**
1333
+ If the dashboard QR panel isn't working, fetch the QR data via API and display it:
1334
+
1335
+ ```bash
1336
+ QR_DATA=$(curl -s -H "Authorization: Bearer <AUTH_TOKEN>" http://localhost:<PORT>/whatsapp/qr | jq -r '.qr')
1337
+ ```
1338
+
1339
+ If `QR_DATA` is not null, you can render it in the browser using JavaScript:
1340
+ ```
1341
+ mcp__playwright__browser_evaluate({ expression: "document.body.innerHTML = '<div id=\"qr\"></div><script src=\"https://cdn.jsdelivr.net/npm/qrcode@1.5.4/build/qrcode.min.js\"></' + 'script><script>QRCode.toCanvas(document.createElement(\"canvas\"), \"QR_DATA_HERE\", {width:300}, (e,c) => document.getElementById(\"qr\").appendChild(c))</' + 'script>'" })
1342
+ ```
1310
1343
 
1311
- Navigate to `https://web.whatsapp.com` in the browser. The QR code there works the same way scan it with WhatsApp on your phone.
1344
+ Or simply relay the QR data to the user and suggest they use the pairing code method instead (Option C fallback).
1312
1345
 
1313
- > If you don't see a QR code in the dashboard, I've opened WhatsApp Web instead. Scan the QR code there with your phone.
1346
+ **Option C: Do NOT use WhatsApp Web (web.whatsapp.com) directly**
1314
1347
 
1315
- **Note:** This approach requires the Baileys session to NOT be simultaneously connected. If the server's Baileys adapter already took the QR, WhatsApp Web won't show one. In that case, use the dashboard QR endpoint or the pairing code fallback.
1348
+ WhatsApp Web connects as its own linked device. The Baileys adapter is ALSO a linked device. WhatsApp only allows one web session at a time, so opening WhatsApp Web would conflict with the Baileys connection. Always use the dashboard QR or API QR — these are the Baileys adapter's QR, not a separate session.
1316
1349
 
1317
1350
  **Step 4: Wait for connection**
1318
1351
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "0.12.21",
3
+ "version": "0.12.22",
4
4
  "description": "Persistent autonomy infrastructure for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "./builtin-manifest.schema.json",
3
3
  "schemaVersion": 1,
4
- "generatedAt": "2026-03-07T19:14:02.219Z",
5
- "instarVersion": "0.12.21",
4
+ "generatedAt": "2026-03-07T19:36:23.999Z",
5
+ "instarVersion": "0.12.22",
6
6
  "entryCount": 166,
7
7
  "entries": {
8
8
  "hook:session-start": {
@@ -295,7 +295,7 @@
295
295
  "type": "skill",
296
296
  "domain": "skills",
297
297
  "sourcePath": ".claude/skills/setup-wizard/skill.md",
298
- "contentHash": "b21b0c7e57c0fb346ad444912a1842139aed902fc3a91c76fe2d3242917d77e2",
298
+ "contentHash": "0984ec7e26e751b5068c7735e53fcfc1c6296e8fe41d9bfbf9bc25414afd7650",
299
299
  "since": "2025-01-01"
300
300
  },
301
301
  "route-group:health": {
@@ -0,0 +1,23 @@
1
+ # Upgrade Guide — v0.12.22
2
+
3
+ <!-- bump: patch -->
4
+
5
+ ## What Changed
6
+
7
+ Fixed WhatsApp QR pairing flow in the setup wizard:
8
+
9
+ - **Dashboard-first approach**: The wizard now navigates to the dashboard UI, authenticates with the PIN, and clicks the WhatsApp button to render the QR — instead of trying to hit `/whatsapp/qr` directly in the browser (which fails because that API requires Bearer auth headers that browsers can't pass via URL).
10
+ - **QR initialization retry**: Added retry loop (up to 30 seconds) for when the WhatsApp adapter hasn't generated its first QR code yet after server start.
11
+ - **Removed WhatsApp Web fallback**: WhatsApp Web creates a competing linked device session that conflicts with the Baileys adapter. The wizard no longer suggests opening web.whatsapp.com.
12
+ - **API QR fallback**: If dashboard rendering fails, the wizard fetches QR data via curl with auth and renders it in the browser via JavaScript.
13
+
14
+ ## What to Tell Your User
15
+
16
+ - **Smoother WhatsApp setup**: "The QR code pairing flow is more reliable now — it properly uses the dashboard to display the QR code."
17
+
18
+ ## Summary of New Capabilities
19
+
20
+ | Capability | How to Use |
21
+ |-----------|-----------|
22
+ | Dashboard-based QR pairing | Automatic during setup — navigates to dashboard, authenticates, opens QR panel |
23
+ | QR initialization retry | Automatic — waits up to 30s for adapter to generate first QR |