77Maintains a ** persistent background session** on glance.sh. Paste an image anytime — the agent receives it instantly.
88
99- ** Background listener** — starts when OpenCode launches, reconnects automatically, refreshes sessions before they expire.
10- - ** ` glance ` tool** — the LLM calls it when it needs to see something visual. Surfaces the session URL and waits for the next paste.
10+ - ** ` glance ` tool** — the LLM calls it when it needs to see something visual. Surfaces the session URL.
11+ - ** ` glance_wait ` tool** — waits for the next paste and returns the image URL.
1112- ** Multiple images** — paste as many images as you want during a session.
1213
1314## Install
1415
15- Symlink or copy ` glance.ts ` into your OpenCode plugins directory:
16+ Recommended (npm package):
17+
18+ Add the plugin to your global ` ~/.config/opencode/opencode.json ` or project ` opencode.json ` :
19+
20+ ``` json
21+ {
22+ "$schema" : " https://opencode.ai/config.json" ,
23+ "plugin" : [" @modemdev/glance-opencode" ]
24+ }
25+ ```
26+
27+ Restart OpenCode. The background session starts automatically.
28+
29+ Optional: pin a specific version:
30+
31+ ``` json
32+ {
33+ "$schema" : " https://opencode.ai/config.json" ,
34+ "plugin" : [" @modemdev/glance-opencode@0.1.0" ]
35+ }
36+ ```
37+
38+ ## Verify
39+
40+ Ask the agent to call the ` glance ` tool. You should get a session URL like ` https://glance.sh/s/<id> ` .
41+
42+ Then call ` glance_wait ` and paste an image in the browser tab — it should return a ` Screenshot: https://glance.sh/<token>.<ext> ` URL.
43+
44+ ## Update / remove
45+
46+ - If you use ` @modemdev/glance-opencode ` without pinning, OpenCode checks for newer versions at startup.
47+ - If you pin a version, bump it in your ` plugin ` list when you want to upgrade.
48+ - To remove, delete the package from your ` plugin ` list and restart OpenCode.
49+
50+ ## Publishing (maintainers)
51+
52+ Releases are automated via GitHub Actions.
53+
54+ Prerequisite: configure ` NPM_TOKEN ` in the ` glance-agent-plugins ` repository with publish access to ` @modemdev/glance-opencode ` .
55+
56+ 1 . Bump ` version ` in ` opencode/package.json ` .
57+ 2 . Commit and push to ` main ` .
58+ 3 . Create and push a matching tag:
59+
60+ ``` bash
61+ git tag opencode-v0.1.0
62+ git push origin opencode-v0.1.0
63+ ```
64+
65+ The ` Release opencode package ` workflow validates the tag/version match and publishes with npm provenance.
66+ You can also run the workflow manually in dry-run mode from Actions.
67+
68+ ## Manual install (legacy)
69+
70+ If you prefer local file management, symlink or copy ` glance.ts ` into your OpenCode plugins directory:
1671
1772``` bash
1873# symlink (recommended — stays up to date with git pulls)
@@ -22,22 +77,22 @@ ln -s "$(pwd)/glance.ts" ~/.config/opencode/plugins/glance.ts
2277ln -s " $( pwd) /glance.ts" .opencode/plugins/glance.ts
2378```
2479
25- Restart OpenCode. The background session starts automatically.
26-
2780## How it works
2881
29- ```
82+ ``` text
3083opencode starts
3184 └─▶ plugin creates session on glance.sh
3285 └─▶ connects SSE (background, auto-reconnect)
3386
3487LLM calls glance tool
3588 └─▶ surfaces session URL
89+
90+ LLM calls glance_wait tool
3691 └─▶ waits for image paste
3792
3893user pastes image at /s/<id>
3994 └─▶ SSE emits "image" event
40- └─▶ tool returns image URL to LLM
95+ └─▶ glance_wait returns image URL to LLM
4196
4297session expires (~10 min)
4398 └─▶ plugin creates new session, reconnects
0 commit comments