instar 0.24.15 → 0.24.17
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 +281 -5
- package/dashboard/index.html +385 -145
- package/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +165 -19
- package/dist/commands/server.js.map +1 -1
- package/dist/lifeline/TelegramLifeline.d.ts +5 -0
- package/dist/lifeline/TelegramLifeline.d.ts.map +1 -1
- package/dist/lifeline/TelegramLifeline.js +57 -3
- package/dist/lifeline/TelegramLifeline.js.map +1 -1
- package/dist/messaging/TelegramAdapter.d.ts +6 -0
- package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
- package/dist/messaging/TelegramAdapter.js +21 -10
- package/dist/messaging/TelegramAdapter.js.map +1 -1
- package/dist/messaging/slack/SlackAdapter.d.ts +42 -0
- package/dist/messaging/slack/SlackAdapter.d.ts.map +1 -1
- package/dist/messaging/slack/SlackAdapter.js +220 -5
- package/dist/messaging/slack/SlackAdapter.js.map +1 -1
- package/dist/monitoring/PresenceProxy.d.ts.map +1 -1
- package/dist/monitoring/PresenceProxy.js +2 -11
- package/dist/monitoring/PresenceProxy.js.map +1 -1
- package/dist/monitoring/PromptGate.d.ts +17 -0
- package/dist/monitoring/PromptGate.d.ts.map +1 -1
- package/dist/monitoring/PromptGate.js +166 -49
- package/dist/monitoring/PromptGate.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +533 -86
- package/dist/server/routes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +48 -48
- package/upgrades/0.24.16.md +48 -0
- package/upgrades/0.24.17.md +40 -0
|
@@ -511,9 +511,9 @@ This handles directory creation, registry entry, port allocation, and gitignore
|
|
|
511
511
|
|
|
512
512
|
Regardless of project or personal agent, **a messaging platform is how you talk to your agent**. This should be clear from the very first message. Don't present it as an optional add-on — it's the destination of this entire setup.
|
|
513
513
|
|
|
514
|
-
The terminal session is the on-ramp. Messaging (Telegram or WhatsApp) is where the agent experience lives.
|
|
514
|
+
The terminal session is the on-ramp. Messaging (Telegram, Slack, or WhatsApp) is where the agent experience lives.
|
|
515
515
|
|
|
516
|
-
**Telegram is recommended** for its topic threads, bot API, and forum-style organization — but WhatsApp
|
|
516
|
+
**Telegram is recommended** for its topic threads, bot API, and forum-style organization — but Slack and WhatsApp are fully supported alternatives for users who prefer them or already live there.
|
|
517
517
|
|
|
518
518
|
## Phase 2: Identity Bootstrap — The Birth Conversation
|
|
519
519
|
|
|
@@ -788,7 +788,8 @@ Frame messaging as the core of the experience, then let the user choose their pl
|
|
|
788
788
|
> This is how you'll actually talk to your agent day-to-day. Not the terminal — just messaging on your phone or desktop.
|
|
789
789
|
>
|
|
790
790
|
> 1. **Telegram** (recommended) — Topic threads for organized conversations, powerful bot API, forum-style groups. Best for power users who want structured channels.
|
|
791
|
-
> 2. **
|
|
791
|
+
> 2. **Slack** — Your agent lives in Slack alongside your team. Channels, threads, reactions, Block Kit interactions. Great for professional workflows.
|
|
792
|
+
> 3. **WhatsApp** — Talk to your agent from the messaging app you already use. Simple, familiar, works everywhere.
|
|
792
793
|
>
|
|
793
794
|
> Which do you prefer? (You can always add the other one later.)
|
|
794
795
|
|
|
@@ -796,12 +797,16 @@ Frame messaging as the core of the experience, then let the user choose their pl
|
|
|
796
797
|
|
|
797
798
|
> "Without a messaging platform, you'll only be able to talk to [agent name] by opening a terminal and running `instar chat`. No mobile access, no proactive messages, no organized threads. Most of what makes an Instar agent useful requires messaging."
|
|
798
799
|
>
|
|
799
|
-
> "You can set it up later with `instar telegram setup` or `instar whatsapp connect`."
|
|
800
|
+
> "You can set it up later with `instar telegram setup`, `instar add slack`, or `instar whatsapp connect`."
|
|
800
801
|
|
|
801
802
|
### If User Chooses Telegram
|
|
802
803
|
|
|
803
804
|
Proceed with the Telegram setup flow below (Step 3b onward).
|
|
804
805
|
|
|
806
|
+
### If User Chooses Slack
|
|
807
|
+
|
|
808
|
+
Jump to **Phase 4h: Slack Setup**. Slack is a first-class option — treat it with the same energy and completeness as Telegram setup.
|
|
809
|
+
|
|
805
810
|
### If User Chooses WhatsApp
|
|
806
811
|
|
|
807
812
|
Jump to **Phase 4g: WhatsApp Setup**. WhatsApp is a first-class option — treat it with the same energy and completeness as Telegram setup.
|
|
@@ -1520,7 +1525,278 @@ If both Telegram and WhatsApp are configured, mention:
|
|
|
1520
1525
|
|
|
1521
1526
|
No additional config needed — CrossPlatformAlerts wires automatically in `server.ts` when both adapters are present.
|
|
1522
1527
|
|
|
1523
|
-
### 4h.
|
|
1528
|
+
### 4h. Slack Setup
|
|
1529
|
+
|
|
1530
|
+
Slack is a **first-class messaging option**. The user may arrive here either:
|
|
1531
|
+
- **As their primary choice** from Phase 3 (chose Slack over Telegram/WhatsApp)
|
|
1532
|
+
- **As an additional channel** after Telegram or WhatsApp is already configured
|
|
1533
|
+
|
|
1534
|
+
**If arriving as primary choice from Phase 3**, skip the "want to add" prompt — they already chose this. Go straight to Step 4h-1.
|
|
1535
|
+
|
|
1536
|
+
**If arriving after Telegram/WhatsApp setup**, present:
|
|
1537
|
+
|
|
1538
|
+
> **Want to add Slack as an additional channel?**
|
|
1539
|
+
>
|
|
1540
|
+
> Slack lets you talk to your agent from Slack — channels, threads, reactions, and interactive buttons. It works alongside your other messaging platforms.
|
|
1541
|
+
>
|
|
1542
|
+
> 1. Yes, set up Slack
|
|
1543
|
+
> 2. Skip for now
|
|
1544
|
+
>
|
|
1545
|
+
> Type a number.
|
|
1546
|
+
|
|
1547
|
+
If they choose to skip, move to Phase 4i.
|
|
1548
|
+
|
|
1549
|
+
#### Step 4h-1: Browser Automation for Slack
|
|
1550
|
+
|
|
1551
|
+
**Use the same browser automation detection from Step 3a.** Playwright preferred, Chrome extension as fallback, manual as last resort.
|
|
1552
|
+
|
|
1553
|
+
Tell the user:
|
|
1554
|
+
|
|
1555
|
+
> I'm going to open a browser to set up Slack automatically. I'll create a workspace, configure an app, and set everything up.
|
|
1556
|
+
>
|
|
1557
|
+
> You'll need to log into Slack in the browser window. Ready?
|
|
1558
|
+
|
|
1559
|
+
Wait for confirmation before proceeding.
|
|
1560
|
+
|
|
1561
|
+
#### Step 4h-2: Navigate to Slack and Handle Login
|
|
1562
|
+
|
|
1563
|
+
Navigate to `https://slack.com/signin`. Take a snapshot.
|
|
1564
|
+
|
|
1565
|
+
**If already logged in** (redirected to a workspace or shows user avatar): Skip to Step 4h-3.
|
|
1566
|
+
|
|
1567
|
+
**If not logged in** (sign-in form visible):
|
|
1568
|
+
> "Please log into your Slack account in the browser window. You can use email, Google, or Apple sign-in. Let me know when you're logged in."
|
|
1569
|
+
|
|
1570
|
+
Wait for user confirmation. Take a snapshot to verify.
|
|
1571
|
+
|
|
1572
|
+
**If no Slack account:**
|
|
1573
|
+
> "You'll need a Slack account. Click 'Create an account' in the browser and follow the steps. Let me know when you're logged in."
|
|
1574
|
+
|
|
1575
|
+
#### Step 4h-3: Workspace Setup
|
|
1576
|
+
|
|
1577
|
+
Ask the user:
|
|
1578
|
+
|
|
1579
|
+
> I recommend creating a dedicated workspace for your agent — it keeps things clean and avoids privacy concerns with colleagues. Would you like me to create a dedicated workspace, or install into an existing one?
|
|
1580
|
+
|
|
1581
|
+
**If creating a new workspace:**
|
|
1582
|
+
|
|
1583
|
+
1. Navigate to `https://slack.com/get-started#/createnew`
|
|
1584
|
+
2. Take snapshot, find email field
|
|
1585
|
+
3. Type user's email (from USER.md or ask)
|
|
1586
|
+
4. Click "Continue"
|
|
1587
|
+
5. **WAIT** — user must enter 6-digit email verification code from their inbox
|
|
1588
|
+
> "Check your email for a 6-digit code from Slack and enter it in the browser."
|
|
1589
|
+
Wait for user confirmation.
|
|
1590
|
+
6. Take snapshot — workspace name field
|
|
1591
|
+
7. Type workspace name: `{agent-name}-agent` (e.g., "echo-agent")
|
|
1592
|
+
8. Click "Next"
|
|
1593
|
+
9. Take snapshot — project/channel name field
|
|
1594
|
+
10. Type "general"
|
|
1595
|
+
11. Click "Next"
|
|
1596
|
+
12. Take snapshot — invite page
|
|
1597
|
+
13. Click "Skip" or skip link
|
|
1598
|
+
14. Wait for workspace to load
|
|
1599
|
+
|
|
1600
|
+
**If using existing workspace:**
|
|
1601
|
+
1. Ask which workspace to use
|
|
1602
|
+
2. Navigate to the workspace URL
|
|
1603
|
+
3. Take snapshot to confirm workspace loaded
|
|
1604
|
+
|
|
1605
|
+
#### Step 4h-4: Create Slack App via Manifest
|
|
1606
|
+
|
|
1607
|
+
Build the app manifest JSON with minimal Phase 1 scopes:
|
|
1608
|
+
|
|
1609
|
+
```json
|
|
1610
|
+
{
|
|
1611
|
+
"display_information": {
|
|
1612
|
+
"name": "{agent-name}",
|
|
1613
|
+
"description": "Instar agent"
|
|
1614
|
+
},
|
|
1615
|
+
"features": {
|
|
1616
|
+
"bot_user": {
|
|
1617
|
+
"display_name": "{agent-name}",
|
|
1618
|
+
"always_online": true
|
|
1619
|
+
}
|
|
1620
|
+
},
|
|
1621
|
+
"oauth_config": {
|
|
1622
|
+
"scopes": {
|
|
1623
|
+
"bot": [
|
|
1624
|
+
"channels:history", "channels:manage", "channels:read",
|
|
1625
|
+
"chat:write", "im:history", "im:read", "im:write",
|
|
1626
|
+
"pins:write", "reactions:read", "reactions:write", "users:read"
|
|
1627
|
+
]
|
|
1628
|
+
}
|
|
1629
|
+
},
|
|
1630
|
+
"settings": {
|
|
1631
|
+
"event_subscriptions": {
|
|
1632
|
+
"bot_events": [
|
|
1633
|
+
"message.channels", "message.groups", "message.im",
|
|
1634
|
+
"file_shared", "reaction_added", "app_mention"
|
|
1635
|
+
]
|
|
1636
|
+
},
|
|
1637
|
+
"socket_mode_enabled": true,
|
|
1638
|
+
"org_deploy_enabled": false
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
```
|
|
1642
|
+
|
|
1643
|
+
1. URL-encode the manifest JSON
|
|
1644
|
+
2. Navigate to: `https://api.slack.com/apps?new_app=1&manifest_json={ENCODED_JSON}`
|
|
1645
|
+
3. Take snapshot — workspace picker dropdown
|
|
1646
|
+
4. Select the target workspace from dropdown
|
|
1647
|
+
5. Click "Next"
|
|
1648
|
+
6. Take snapshot — manifest review/summary page
|
|
1649
|
+
7. Click "Create" button
|
|
1650
|
+
8. Wait 2-3 seconds for app creation
|
|
1651
|
+
9. Take snapshot — should be on app's Basic Information page
|
|
1652
|
+
10. Extract App ID from the URL (`api.slack.com/apps/A{APP_ID}/...`)
|
|
1653
|
+
|
|
1654
|
+
#### Step 4h-5: Install App to Workspace
|
|
1655
|
+
|
|
1656
|
+
1. Navigate to: `https://api.slack.com/apps/{APP_ID}/install-on-team`
|
|
1657
|
+
2. Take snapshot — "Install to Workspace" button
|
|
1658
|
+
3. Click "Install to Workspace"
|
|
1659
|
+
4. Take snapshot — OAuth authorization page
|
|
1660
|
+
5. Click "Allow"
|
|
1661
|
+
6. Wait for redirect back to app settings
|
|
1662
|
+
7. Take snapshot — OAuth & Permissions page
|
|
1663
|
+
8. **CRITICAL: DO NOT take screenshots/snapshots on this page** — it shows the bot token
|
|
1664
|
+
9. Extract Bot User OAuth Token (`xoxb-...`) from the page using regex. Pattern: `xoxb-\d+-\d+-[A-Za-z0-9]+`
|
|
1665
|
+
10. Store token in memory — do NOT log it
|
|
1666
|
+
|
|
1667
|
+
#### Step 4h-6: Enable Socket Mode & Generate App Token
|
|
1668
|
+
|
|
1669
|
+
1. Navigate to: `https://api.slack.com/apps/{APP_ID}/socket-mode`
|
|
1670
|
+
2. Take snapshot — Socket Mode toggle
|
|
1671
|
+
3. If toggle is OFF, click to enable it
|
|
1672
|
+
4. Navigate to: `https://api.slack.com/apps/{APP_ID}/general`
|
|
1673
|
+
5. Scroll to "App-Level Tokens" section
|
|
1674
|
+
6. Take snapshot — find "Generate Token and Scopes" button
|
|
1675
|
+
7. Click "Generate Token and Scopes"
|
|
1676
|
+
8. Take snapshot — token creation dialog
|
|
1677
|
+
9. Type token name: "socket-mode" in the name field
|
|
1678
|
+
10. Click "Add Scope"
|
|
1679
|
+
11. Select "connections:write" scope
|
|
1680
|
+
12. Click "Generate"
|
|
1681
|
+
13. **CRITICAL: DO NOT take screenshots/snapshots** — token is displayed
|
|
1682
|
+
14. Extract app-level token (`xapp-...`) from the dialog. Pattern: `xapp-\d+-[A-Za-z0-9]+-\d+-[A-Za-z0-9]+`
|
|
1683
|
+
15. Click "Done"
|
|
1684
|
+
|
|
1685
|
+
#### Step 4h-7: Validate Tokens
|
|
1686
|
+
|
|
1687
|
+
Validate both tokens via API (NOT browser):
|
|
1688
|
+
|
|
1689
|
+
```bash
|
|
1690
|
+
# Validate bot token and extract workspace info
|
|
1691
|
+
BOT_RESULT=$(curl -s -X POST https://slack.com/api/auth.test \
|
|
1692
|
+
-H "Authorization: Bearer ${BOT_TOKEN}" \
|
|
1693
|
+
-H "Content-Type: application/json")
|
|
1694
|
+
|
|
1695
|
+
# Expected: {"ok": true, "team_id": "T...", "user_id": "U...", "team": "workspace-name"}
|
|
1696
|
+
|
|
1697
|
+
# Validate app token
|
|
1698
|
+
APP_RESULT=$(curl -s -X POST https://slack.com/api/apps.connections.open \
|
|
1699
|
+
-H "Authorization: Bearer ${APP_TOKEN}" \
|
|
1700
|
+
-H "Content-Type: application/json")
|
|
1701
|
+
|
|
1702
|
+
# Expected: {"ok": true, "url": "wss://..."}
|
|
1703
|
+
```
|
|
1704
|
+
|
|
1705
|
+
If either fails, tell the user and offer to retry the extraction step.
|
|
1706
|
+
|
|
1707
|
+
Extract from `BOT_RESULT`:
|
|
1708
|
+
- `team_id` → `workspaceId`
|
|
1709
|
+
- `team` → `workspaceName`
|
|
1710
|
+
- `user_id` → add to `authorizedUserIds` (this is the installing user)
|
|
1711
|
+
|
|
1712
|
+
#### Step 4h-8: Create System Channels
|
|
1713
|
+
|
|
1714
|
+
```bash
|
|
1715
|
+
# Create lifeline channel
|
|
1716
|
+
LIFELINE=$(curl -s -X POST https://slack.com/api/conversations.create \
|
|
1717
|
+
-H "Authorization: Bearer ${BOT_TOKEN}" \
|
|
1718
|
+
-H "Content-Type: application/json" \
|
|
1719
|
+
-d '{"name": "{agent}-sys-lifeline"}')
|
|
1720
|
+
|
|
1721
|
+
# Create dashboard channel
|
|
1722
|
+
DASHBOARD=$(curl -s -X POST https://slack.com/api/conversations.create \
|
|
1723
|
+
-H "Authorization: Bearer ${BOT_TOKEN}" \
|
|
1724
|
+
-H "Content-Type: application/json" \
|
|
1725
|
+
-d '{"name": "{agent}-sys-dashboard"}')
|
|
1726
|
+
|
|
1727
|
+
# Pin a welcome message in lifeline
|
|
1728
|
+
curl -s -X POST https://slack.com/api/chat.postMessage \
|
|
1729
|
+
-H "Authorization: Bearer ${BOT_TOKEN}" \
|
|
1730
|
+
-H "Content-Type: application/json" \
|
|
1731
|
+
-d '{"channel": "LIFELINE_ID", "text": "Lifeline channel active. This is where I send critical system messages."}'
|
|
1732
|
+
```
|
|
1733
|
+
|
|
1734
|
+
#### Step 4h-9: Write Configuration
|
|
1735
|
+
|
|
1736
|
+
Write Slack config to `.instar/config.json`:
|
|
1737
|
+
|
|
1738
|
+
```javascript
|
|
1739
|
+
node -e "
|
|
1740
|
+
const fs = require('fs');
|
|
1741
|
+
const p = '<project_dir>/.instar/config.json';
|
|
1742
|
+
const c = JSON.parse(fs.readFileSync(p, 'utf-8'));
|
|
1743
|
+
c.messaging = c.messaging || [];
|
|
1744
|
+
// Remove existing slack config if any
|
|
1745
|
+
c.messaging = c.messaging.filter(m => m.type !== 'slack');
|
|
1746
|
+
c.messaging.push({
|
|
1747
|
+
type: 'slack',
|
|
1748
|
+
enabled: true,
|
|
1749
|
+
config: {
|
|
1750
|
+
botToken: '${BOT_TOKEN}',
|
|
1751
|
+
appToken: '${APP_TOKEN}',
|
|
1752
|
+
workspaceId: '${WORKSPACE_ID}',
|
|
1753
|
+
workspaceName: '${WORKSPACE_NAME}',
|
|
1754
|
+
authorizedUserIds: ['${USER_ID}'],
|
|
1755
|
+
stallTimeoutMinutes: 5,
|
|
1756
|
+
logRetentionDays: 90,
|
|
1757
|
+
lifelineChannelId: '${LIFELINE_CHANNEL_ID}',
|
|
1758
|
+
dashboardChannelId: '${DASHBOARD_CHANNEL_ID}'
|
|
1759
|
+
}
|
|
1760
|
+
});
|
|
1761
|
+
fs.writeFileSync(p, JSON.stringify(c, null, 2));
|
|
1762
|
+
fs.chmodSync(p, 0o600);
|
|
1763
|
+
"
|
|
1764
|
+
```
|
|
1765
|
+
|
|
1766
|
+
#### Step 4h-10: Confirm Success and Close Browser
|
|
1767
|
+
|
|
1768
|
+
Close the browser (Playwright: `browser_close()`).
|
|
1769
|
+
|
|
1770
|
+
Tell the user:
|
|
1771
|
+
|
|
1772
|
+
> Slack is set up! Your workspace '{workspaceName}' is ready.
|
|
1773
|
+
> I've created your system channels and configured everything.
|
|
1774
|
+
>
|
|
1775
|
+
> Important: Your bot tokens provide full access to your Slack workspace — treat them like passwords. They don't expire, so if you suspect compromise, revoke them at api.slack.com/apps.
|
|
1776
|
+
>
|
|
1777
|
+
> Would you like me to store your tokens in Bitwarden for extra security? (recommended)
|
|
1778
|
+
|
|
1779
|
+
If they accept Bitwarden, trigger the `secret-setup` skill.
|
|
1780
|
+
|
|
1781
|
+
#### Slack Manual Fallback
|
|
1782
|
+
|
|
1783
|
+
**Only use this if NO browser automation tools are available.** If automation failed partway, tell the user exactly what succeeded.
|
|
1784
|
+
|
|
1785
|
+
Walk the user through:
|
|
1786
|
+
|
|
1787
|
+
1. Go to `https://slack.com/get-started#/createnew` and create a workspace (or use existing)
|
|
1788
|
+
2. Go to `https://api.slack.com/apps?new_app=1` → click "From a manifest"
|
|
1789
|
+
3. Select your workspace
|
|
1790
|
+
4. Paste this manifest: [provide the JSON from Step 4h-4]
|
|
1791
|
+
5. Click Create, then Install to Workspace, then Allow
|
|
1792
|
+
6. Go to Basic Information → App-Level Tokens → Generate Token and Scopes
|
|
1793
|
+
7. Name: "socket-mode", Scope: "connections:write", click Generate
|
|
1794
|
+
8. Copy both tokens (bot token from OAuth page, app token from Basic Info)
|
|
1795
|
+
9. Run: `instar add slack` and paste the tokens when prompted
|
|
1796
|
+
|
|
1797
|
+
Even in manual mode, system channel creation (Step 4h-8) and config writing (Step 4h-9) are done by the wizard, not the user.
|
|
1798
|
+
|
|
1799
|
+
### 4i. Agent Network
|
|
1524
1800
|
|
|
1525
1801
|
Your agent can join a secure network to communicate with other AI agents. Present this as an optional but recommended step:
|
|
1526
1802
|
|