Skip to content

Commit f1e6d47

Browse files
Merge pull request anomalyco#320 from different-ai/feat/browser-entry-button
Add browser setup entry command
2 parents 8168709 + 401b60c commit f1e6d47

9 files changed

Lines changed: 513 additions & 3 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: browser-setup
3+
description: Guide user through Chrome browser automation setup
4+
---
5+
6+
Help the user set up browser automation.
7+
8+
Use the `browser-setup-devtools` skill and follow it strictly (Chrome DevTools MCP first, extension only as fallback).
9+
Keep the user prompt minimal and let the skill drive the setup dance.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: browser-setup-devtools
3+
description: Guide users through browser automation setup using Chrome DevTools MCP as the primary path and the OpenCode browser extension as a fallback. Use when the user asks to set up browser automation, Chrome DevTools MCP, browser MCP, browser extension, or runs the browser-setup command.
4+
---
5+
6+
# Browser automation setup (DevTools MCP first)
7+
8+
## Principles
9+
10+
- Keep prompts minimal; do as much as possible with tools and commands.
11+
- Always attempt Chrome DevTools MCP first; only fall back to the browser extension when DevTools MCP cannot be used.
12+
13+
## Workflow
14+
15+
1. Ask: "Do you have Chrome installed on this computer?"
16+
2. If no or unsure:
17+
- Offer to open the download page yourself and do it if possible.
18+
- Provide a clickable link: https://www.google.com/chrome/
19+
- Continue after installation is confirmed.
20+
3. Check DevTools MCP availability:
21+
- Call `chrome-devtools_list_pages`.
22+
- If pages exist, select one with `chrome-devtools_select_page`.
23+
- If no pages, create one with `chrome-devtools_new_page` (use https://example.com) and then select it.
24+
4. If DevTools MCP calls fail:
25+
- Ask the user to open Chrome and keep it running.
26+
- Retry `chrome-devtools_list_pages`.
27+
- If it still fails, ensure `opencode.jsonc` includes `mcp.chrome-devtools` with command `['npx','-y','chrome-devtools-mcp@latest']` and ask the user to restart OpenWork/OpenCode.
28+
- Retry the DevTools MCP check.
29+
5. If DevTools MCP is ready:
30+
- Offer a first task ("Let's try opening a webpage").
31+
- If yes, use `chrome-devtools_navigate_page` or `chrome-devtools_new_page` to open the URL and confirm completion.
32+
6. Fallback only if DevTools MCP cannot be used:
33+
- Check availability with `browser_version` or `browser_status`.
34+
- If missing, run `npx @different-ai/opencode-browser install` yourself.
35+
- Open the Extensions page yourself when possible:
36+
- macOS: `open -a "Google Chrome" "chrome://extensions"`
37+
- Windows: `start chrome://extensions`
38+
- Linux: `xdg-open "chrome://extensions"`
39+
- Tell the user to enable Developer mode, click "Load unpacked", and select `~/.opencode-browser/extension`, then pin the extension.
40+
- Re-check availability with `browser_version`.
41+
- Offer a first task and use `browser_open_tab`.
42+
43+
## Response rules
44+
45+
- Keep each user prompt to one short sentence when possible.
46+
- Use direct offers like "I can open Chrome now" and follow with tool actions.
47+
- Always present links as clickable URLs.

‎packages/app/pr/OpenCode Server.md‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# OpenCode Server
2+
Run tasks from a shared runtime
3+
---
4+
## Summarize
5+
- Define a local OpenCode server that OpenWork can discover, connect to, and use for task execution across devices
6+
---
7+
## Define problem
8+
- OpenWork needs a reliable way to run tasks without bundling a full CLI per device while keeping setup simple and transparent
9+
---
10+
## Set goals
11+
- Enable a host machine to run tasks for multiple OpenWork clients with clear status, fast connect, and predictable behavior
12+
- Keep setup minimal and align with least-privilege, mobile-first usage
13+
---
14+
## Exclude scope
15+
- Building a hosted SaaS, multi-tenant cloud, or marketplace for remote agents
16+
- Supporting non-OpenWork clients beyond a basic compatibility layer
17+
---
18+
## Describe personas
19+
- Mobile user who wants to run tasks from a phone against a home or work machine
20+
- Power user who wants a stable local runtime for repeated workflows
21+
- Admin who needs simple setup and clear permission prompts
22+
---
23+
## Define requirements
24+
- Functional: discover host on LAN, connect via pairing, run tasks, stream logs, and handle reconnects gracefully
25+
- UX: show connection status, explain permissions, and expose a clear health panel with actionable errors
26+
---
27+
## Detail integration
28+
- Lifecycle: start server on host, advertise via local discovery, accept pairing, and serve OpenCode APIs over a secured channel
29+
- Host/client: host runs OpenCode runtime and permission gates while clients send tasks, receive progress, and read logs
30+
---
31+
## Set permissions
32+
- Require explicit pairing approval, scoped runtime permissions, and per-task confirmation for sensitive tools
33+
---
34+
## Cover telemetry
35+
- Optional local metrics for uptime, connection failures, and task success, stored on host and never uploaded by default
36+
---
37+
## Map flow
38+
- Onboarding: guide install, start server, and generate pairing code
39+
- Connect: discover host, enter code, and validate permissions summary
40+
- Health: show server uptime, last task status, and recovery actions
41+
---
42+
## Note risks
43+
- Network discovery inconsistencies across platforms and routers
44+
- Trust confusion if pairing and permission prompts are unclear
45+
---
46+
## Ask questions
47+
- Should remote access beyond LAN be supported in this phase, and if so, which transport is acceptable
48+
---
49+
## Measure success
50+
- 90%+ successful first-time pairing on supported platforms with fewer than two manual retries
51+
- Stable task execution with <1% disconnect-related failures over 7 days
52+
---
53+
## Plan rollout
54+
- Phase 1: local discovery and pairing on desktop host with basic status UI
55+
- Phase 2: mobile client support, health panel, and reconnect logic
56+
- Phase 3: permission refinements, metrics, and troubleshooting guide
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Browser Entry Button
2+
3+
**Branch:** `feat/browser-entry-button`
4+
**Priority:** P1
5+
6+
---
7+
8+
## Goal
9+
10+
Add a single entry button in the empty chat state that triggers browser automation setup via OpenCode command.
11+
12+
---
13+
14+
## Implementation
15+
16+
### Location
17+
`packages/app/src/app/pages/session.tsx` L1025-1037
18+
19+
### Code references
20+
- Empty state render: `packages/app/src/app/pages/session.tsx:1039-1049`
21+
- Command runner used by slash commands: `packages/app/src/app/pages/session.tsx:645-663` (`runOpenCodeCommand`)
22+
- Command registry wiring: `packages/app/src/app/pages/session.tsx:881-892`
23+
- Programmatic command execution: `packages/app/src/app/command-state.ts:293-313`
24+
- `.opencode/commands` loader: `packages/app/src/app/command-state.ts:334`
25+
- Existing button pattern: `packages/app/src/app/pages/dashboard.tsx:557` (`onClick={() => props.runCommand(command)}`)
26+
- Command write API (desktop): `packages/app/src/app/lib/tauri.ts:223` (`opencodeCommandWrite`)
27+
- Frontmatter parser: `packages/app/src/app/utils/index.ts:271` (`parseTemplateFrontmatter`)
28+
29+
### Current empty state
30+
```tsx
31+
<Show when={props.messages.length === 0}>
32+
<div class="text-center py-16 px-6 space-y-6">
33+
<h3 class="text-xl font-medium">Start a conversation</h3>
34+
<p class="text-gray-10 text-sm">Describe what you want to do...</p>
35+
</div>
36+
</Show>
37+
```
38+
39+
### Add button
40+
```tsx
41+
<Show when={props.messages.length === 0}>
42+
<div class="text-center py-16 px-6 space-y-6">
43+
<div class="w-16 h-16 bg-gray-2 rounded-3xl mx-auto flex items-center justify-center border border-gray-6">
44+
<Zap class="text-gray-7" />
45+
</div>
46+
<div class="space-y-2">
47+
<h3 class="text-xl font-medium">What do you want to do?</h3>
48+
<p class="text-gray-10 text-sm max-w-sm mx-auto">
49+
Pick a starting point or just type below.
50+
</p>
51+
</div>
52+
<div class="flex justify-center">
53+
<button
54+
type="button"
55+
class="px-4 py-2.5 rounded-xl border border-gray-6 bg-gray-2 text-sm text-gray-12 hover:bg-gray-3 hover:border-gray-7 transition-all"
56+
onClick={() => {
57+
void (async () => {
58+
const command = await ensureBrowserSetupCommand();
59+
if (command) {
60+
runOpenCodeCommand(command);
61+
}
62+
})();
63+
}}
64+
>
65+
Automate your browser
66+
</button>
67+
</div>
68+
</div>
69+
</Show>
70+
```
71+
72+
**Why `runOpenCodeCommand`**
73+
- It handles `$ARGUMENTS` and opens the command run modal when needed (`session.tsx:645-663`)
74+
- Keeps behavior identical to slash commands
75+
76+
### Create OpenCode command
77+
File: `.opencode/commands/browser-setup.md`
78+
79+
**App template source:** `packages/app/src/app/data/commands/browser-setup.md`
80+
81+
If the command is missing in the active workspace, the button auto-writes it via `opencodeCommandWrite` (desktop only) before running.
82+
83+
```markdown
84+
---
85+
name: browser-setup
86+
description: Guide user through Chrome browser automation setup
87+
---
88+
89+
Help the user set up browser automation.
90+
91+
1. Ask: "Do you have Chrome installed on this computer?"
92+
2. If they say no or are unsure, guide them to install Chrome
93+
3. If yes, check if browser MCP/plugin is available
94+
4. If not available, guide them to install the OpenCode browser extension
95+
5. Once setup is complete, offer to run a simple first task (e.g., "Let's try opening a webpage")
96+
```
97+
98+
---
99+
100+
## Flow (handled by LLM)
101+
102+
1. User clicks "Automate your browser"
103+
2. Command triggers, LLM asks: "Do you have Chrome installed?"
104+
3. User answers Yes/No
105+
4. LLM guides through extension install if needed
106+
5. LLM offers first browser task
107+
108+
---
109+
110+
## NOT doing
111+
112+
- Custom guided prompts in the UI
113+
- Multiple entry buttons (start with one)
114+
- Hardcoded installation scripts
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
title: Workspaces
3+
description: Share settings across projects with minimal friction
4+
---
5+
6+
## Summarize
7+
Enable multiple workspace profiles with quick switching and safe config sharing. The experience should feel native to the current dashboard, sessions list, and onboarding flow.
8+
9+
---
10+
11+
## Define problem
12+
Teams need separate workspace contexts while keeping a few trusted defaults consistent. Today, users duplicate setup steps and lose track of which config applies where.
13+
14+
---
15+
16+
## Set goals
17+
- Add workspace profiles without disrupting existing single-workspace users
18+
- Keep switching fast and visible from the dashboard and sessions list
19+
- Allow config export/import with clear scope and safe defaults
20+
21+
---
22+
23+
## Set non-goals
24+
- No cross-device sync in this phase
25+
- No multi-user permissions or ACL management
26+
- No changes to OpenCode runtime config precedence
27+
28+
---
29+
30+
## Describe personas
31+
- Solo builder who toggles between client projects
32+
- Team lead who shares a baseline setup across projects
33+
- New user who wants a guided first-time flow
34+
35+
---
36+
37+
## Map UX flow
38+
Onboarding: choose a starter workspace or import a shared config, then land on the dashboard. Show a simple selector next to the existing project entry.
39+
40+
Switching: use the dashboard workspace picker with search and recent items, then reload the sessions list for that workspace. Show a toast confirming the active context.
41+
42+
Sessions list: group sessions by active workspace with a small badge and reuse the current list layout. Provide a filter toggle to show all or current only.
43+
44+
---
45+
46+
## Define export/import
47+
Scope: export workspace-level config, model defaults, and skill selection. Keep project-specific file paths relative when possible.
48+
49+
Exclusions: omit secrets, tokens, local cache, and device-specific paths. Skip any files flagged as private in config metadata.
50+
51+
Security: show a review screen before export, and confirm before import applies changes. Validate manifest schema and warn on unknown keys.
52+
53+
---
54+
55+
## List requirements
56+
Functional: create, rename, delete, and switch workspace profiles. Export and import configs as a single archive with a manifest.
57+
58+
UX: fit within existing dashboard cards and onboarding panels. Keep the active workspace visible on sessions list and session detail.
59+
60+
---
61+
62+
## Specify data
63+
Manifest: JSON with workspace name, version, createdAt, config scope, and file map. Include a checksum per file entry.
64+
65+
Archive: zip containing `manifest.json` plus normalized config files. Preserve relative paths and strip secrets on export.
66+
67+
---
68+
69+
## Assess risks
70+
- Users might assume config syncs across devices
71+
- Imports could overwrite local preferences unexpectedly
72+
- Large configs may slow onboarding or switching
73+
74+
---
75+
76+
## Raise questions
77+
- Should imports create a new workspace by default or merge into active
78+
- How should we surface config precedence conflicts in UI
79+
- Do we need a dry-run view for imports in v1
80+
81+
---
82+
83+
## Measure success
84+
- 30% of active users create a second workspace
85+
- 70% of imports complete without rollback
86+
- Switching time stays under 1 second on median devices
87+
88+
---
89+
90+
## Plan rollout
91+
Phase 1: local profiles with switching and sessions filtering. Phase 2: export and import with manifest validation and review.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: browser-setup
3+
description: Guide user through Chrome browser automation setup
4+
---
5+
6+
Help the user set up browser automation.
7+
8+
Use the `browser-setup-devtools` skill and follow it strictly (Chrome DevTools MCP first, extension only as fallback).
9+
Keep the user prompt minimal and let the skill drive the setup dance.

0 commit comments

Comments
 (0)