diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.json index b320f25..f9923f6 100644 --- a/.agents/plugins/marketplace.json +++ b/.agents/plugins/marketplace.json @@ -23,7 +23,7 @@ "authentication": "ON_INSTALL" }, "description": "Drive Geenee, the Aiden Lab's genome workspace (igv genome browser, Juicebox Hi-C contact maps, Spacewalk 3D chromatin), by chatting: search ENCODE/4DN, load maps, tracks and ensembles, navigate loci, and share views.", - "version": "1.1.0", + "version": "1.2.0", "category": "science", "keywords": [ "geenee", diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index ed80641..c0286d9 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -13,7 +13,7 @@ "name": "geenee", "source": "./plugins/geenee", "description": "Drive Geenee, the Aiden Lab's genome workspace (igv genome browser, Juicebox Hi-C contact maps, Spacewalk 3D chromatin), by chatting: search ENCODE/4DN, load maps, tracks and ensembles, navigate loci, and share views.", - "version": "1.1.0", + "version": "1.2.0", "category": "science", "keywords": [ "geenee", diff --git a/plugins/geenee/.claude-plugin/plugin.json b/plugins/geenee/.claude-plugin/plugin.json index 3faa125..d33ada5 100644 --- a/plugins/geenee/.claude-plugin/plugin.json +++ b/plugins/geenee/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "geenee", "displayName": "Geenee", - "version": "1.1.0", + "version": "1.2.0", "description": "Geenee: drive a genome workspace by chatting. One page beside the conversation holds the igv genome browser, the Juicebox Hi-C contact-map viewer and the Spacewalk 3D chromatin viewer. Search ENCODE/4DN, load maps, tracks and 3D ensembles, navigate genes and loci, compare, share. Connects to the Aiden Lab's hosted MCP server; nothing runs locally.", "author": { "name": "The Aiden Lab", diff --git a/plugins/geenee/plugin.json b/plugins/geenee/plugin.json index 67404b5..3dacc16 100644 --- a/plugins/geenee/plugin.json +++ b/plugins/geenee/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json", "name": "geenee", - "version": "1.1.0", + "version": "1.2.0", "description": "Geenee: drive a genome workspace by chatting. One page beside the conversation holds the igv genome browser, the Juicebox Hi-C contact-map viewer and the Spacewalk 3D chromatin viewer. Search ENCODE/4DN, load maps, tracks and 3D ensembles, navigate genes and loci, compare, share. Connects to the Aiden Lab's hosted MCP server; nothing runs locally.", "author": { "name": "The Aiden Lab", diff --git a/plugins/geenee/skills/geenee/SKILL.md b/plugins/geenee/skills/geenee/SKILL.md index 69b0047..dc2975e 100644 --- a/plugins/geenee/skills/geenee/SKILL.md +++ b/plugins/geenee/skills/geenee/SKILL.md @@ -29,13 +29,13 @@ Chain calls that do not depend on each other into one `call`, so the user waits ## Session start: one Room per conversation 1. Call `open_geenee` first (or `$G open`), before any other geenee tool and before replying, even when the user only greets geenee or one of its viewers ("hello geenee", "hi igv"). Its reply gives the Workspace link and the **Room id**. Keep the Room id for the whole conversation and pass it as `room` on every later tool call, for all three viewers (the CLI does this itself). Call it first again, without `room`, when a tool replies that the Room has expired; call it when a tool replies that there is no Room, then repeat the refused call. - - To show the Card again so others can join ("show the QR code again", "share geenee", "how do others join", "someone just arrived"): call `share_geenee` with the `room`. It opens no new Room; everyone keeps their link. + - To show the Card again so others can join ("show the QR code again", "share geenee", "how do others join", "someone just arrived"): call `share_geenee` with the `room` (`$G share`, which prints the Room link to give the user). It opens no new Room; everyone keeps their link. - To get the Workspace back beside the conversation: call `open_geenee` with the same `room`. 2. If a browser pane inside this app is available (Claude's built-in browser), open the link in it right away so Geenee sits beside the conversation. Do not drive the user's own browser with it. 3. Through the MCP tools, the host shows the user a Card with an **Open geenee** button, the link and a QR code; do not repeat the link in your reply. Through the CLI there is no Card: give the user the link as a plain clickable URL, not in a code block, and ask them to open it. 4. Do not send viewer commands until the page is connected: the user confirms, or `$G status` (or `juicebox_get_server_status` showing `Browser Connected: Yes`, `igv_read_session_summary` answering without error, `spacewalk_read_viewer_state` showing `Viewers connected:` above 0) says so. 5. If the user pastes a Workspace link they already have (`…?room=ID` or `…/r/ID`, theirs or a colleague's), call `open_geenee` with that `room` instead of opening a new one (`$G room `). Everyone in a Room sees the same Workspace, which is also how a group looks at one view together. -6. "No page is connected" / "no Viewer is in Room" means the tab is closed, still loading, or on another Room: show the Workspace link again (`share_geenee`, or `$G open`). A Room that has expired stays expired: open a new one and tell the user the link changed. +6. "No page is connected" / "no Viewer is in Room" means the tab is closed, still loading, or on another Room: show the Workspace link again (`share_geenee`, or `$G share`). A Room that has expired stays expired: open a new one and tell the user the link changed. ## Which viewer diff --git a/plugins/geenee/skills/geenee/references/cli.md b/plugins/geenee/skills/geenee/references/cli.md index 4c3d08d..219cff7 100644 --- a/plugins/geenee/skills/geenee/references/cli.md +++ b/plugins/geenee/skills/geenee/references/cli.md @@ -15,6 +15,7 @@ The CLI is an MCP client over plain HTTPS. The Geenee server is stateless Stream ``` geenee.py open Workspace link for this shell's Room (opens a new Room if none) +geenee.py share Room link for others to join this Room (opens a new Room if none) geenee.py status whether each viewer (Juicebox, IGV, Spacewalk) is connected in the Room geenee.py tools tool names with one-line descriptions geenee.py call TOOL [JSON] [TOOL [JSON] ...] one or more tool calls in one process, in order; room filled in @@ -50,6 +51,7 @@ Use `python3` when present, else `node`. Nothing to install either way. - The first command calls `open_geenee`, which mints a Room id (10 letters and digits) and returns the Workspace link `https:///?room=`; the CLI saves `{url, room}` to `~/.local/state/geenee/room.json` (`GEENEE_STATE` overrides). Later commands, in any shell, reuse it, so the Workspace stays the same for the whole conversation. - A `call` that had to open a new Room prints the Workspace link first, before the tool results: the user has to open it before anything shows. - `open` returns the link for the current Room (calling `open_geenee` with that Room, which gives the same Workspace back). `status` reports each viewer's connection from `juicebox_get_server_status`, `igv_read_session_summary` and `spacewalk_read_viewer_state`; exit 2 when none is connected. +- `share` gives the Room link (`https:///r/`) for Guests to join the same Room, through `share_geenee`: it opens no new Room, everyone keeps their link, and the Room's day starts again. Use it when someone missed the link or just arrived; give the user the link as a plain URL. There is no QR code through the CLI. With `--json` it prints `{"room", "roomUrl"}`. For an expired Room it prints the expired message and exits 2, keeping the saved Room; `reset` then opens a new one. With no Room yet it opens one first, like every other command. - `room ` switches to a Room a page already shows or a colleague shared; `room` alone prints the current id. - A Room expires after a long idle. The server then reports no page or no viewer for it; `reset` (or `open_geenee` without `room`) starts a new one, and the user must open the new link. diff --git a/plugins/geenee/skills/geenee/scripts/geenee.mjs b/plugins/geenee/skills/geenee/scripts/geenee.mjs index 6797cd7..f051f70 100755 --- a/plugins/geenee/skills/geenee/scripts/geenee.mjs +++ b/plugins/geenee/skills/geenee/scripts/geenee.mjs @@ -2,7 +2,7 @@ // geenee.mjs - call the Geenee MCP server without an MCP connector. // Node 18+, no dependencies. Same commands and output as geenee.py: // -// geenee.mjs open | status | tools | call TOOL [JSON] [TOOL [JSON] ...] | room [ID_OR_LINK] | reset +// geenee.mjs open | share | status | tools | call TOOL [JSON] [TOOL [JSON] ...] | room [ID_OR_LINK] | reset // options: --json --room ID --server URL env: GEENEE_URL, GEENEE_STATE // exit codes: 0 ok; 2 the tool reported an error (usually: no viewer connected); 1 transport/usage error // @@ -37,6 +37,7 @@ const USER_AGENT = 'geenee-cli/1.0 (+https://github.com/aidenlab/plugins)'; // Viewer acks take up to 15 s and catalogue searches can be slow. const TIMEOUT_MS = 60_000; const OPEN_TOOL = 'open_geenee'; +const SHARE_TOOL = 'share_geenee'; const ROOM_ID = /^[0-9A-HJKMNP-TV-Z]{10}$/; const STATE_PATH = process.env.GEENEE_STATE || join(process.env.XDG_STATE_HOME || join(homedir(), '.local', 'state'), 'geenee', 'room.json'); @@ -150,6 +151,21 @@ function printOpened(s, asJson) { else console.log(`Geenee link: ${workspaceUrl}\nRoom id: ${room}`); } +// The Room link from share_geenee, without the text meant for a Host that draws the Card. +async function share(s, asJson) { + const result = await s.call(SHARE_TOOL, {}); + if (result.isError) { + console.log(asJson ? JSON.stringify(result) : textOf(result)); + return 2; + } + const sc = result.structuredContent || {}; + const link = sc.roomUrl || sc.workspaceUrl; + const room = sc.room || s.room; + if (asJson) console.log(JSON.stringify({ room, roomUrl: link })); + else console.log(`Room link: ${link}\nRoom id: ${room}`); + return 0; +} + // Connection state of the three viewers, from the tools that change nothing. async function status(s, asJson) { const jb = await s.call('juicebox_get_server_status', {}); @@ -192,6 +208,7 @@ function parseArgs(argv) { const HELP = `geenee.mjs - call the Geenee MCP server without an MCP connector. geenee.mjs open Workspace link for this shell's Room (opens a new Room if none) + geenee.mjs share Room link for others to join this Room (opens a new Room if none) geenee.mjs status whether each viewer is connected in the Room geenee.mjs tools tool names with one-line descriptions geenee.mjs call TOOL [JSON] [TOOL [JSON] ...] call one or more tools in one process, in order; room is filled in @@ -230,6 +247,7 @@ async function main(argv) { for (const t of await s.tools()) console.log(t.name.padEnd(34) + ' ' + (t.description || '').split('. ')[0].slice(0, 100)); return 0; } + if (cmd === 'share') return share(s, opts.json); if (cmd === 'status') return status(s, opts.json); if (cmd === 'call') { if (!rest.length) throw new Transport('call needs at least one tool name'); diff --git a/plugins/geenee/skills/geenee/scripts/geenee.py b/plugins/geenee/skills/geenee/scripts/geenee.py index 1f9047a..4cd983f 100755 --- a/plugins/geenee/skills/geenee/scripts/geenee.py +++ b/plugins/geenee/skills/geenee/scripts/geenee.py @@ -11,6 +11,7 @@ Usage: geenee.py open Workspace link for this shell's Room (opens a new Room if none) + geenee.py share Room link for others to join this Room (opens a new Room if none) geenee.py status whether each viewer is connected in the Room geenee.py tools tool names with one-line descriptions geenee.py call TOOL [JSON] [TOOL [JSON] ...] @@ -48,6 +49,7 @@ # Viewer acks take up to 15 s and catalogue searches can be slow; 60 s leaves headroom. TIMEOUT_SECONDS = 60 OPEN_TOOL = "open_geenee" +SHARE_TOOL = "share_geenee" ROOM_ID = re.compile(r"^[0-9A-HJKMNP-TV-Z]{10}$") STATE_PATH = os.environ.get("GEENEE_STATE") or os.path.join( @@ -197,6 +199,25 @@ def print_opened(s, as_json): print("Geenee link: %s\nRoom id: %s" % (sc["workspaceUrl"], sc["room"])) +def share(s, as_json): + """The Room link from share_geenee, without the text meant for a Host that draws the Card.""" + result = s.call(SHARE_TOOL, {}) + if result.get("isError"): + if as_json: + print(json.dumps(result)) + else: + print(text_of(result)) + return 2 + sc = result.get("structuredContent") or {} + link = sc.get("roomUrl") or sc.get("workspaceUrl") + room = sc.get("room") or s.room + if as_json: + print(json.dumps({"room": room, "roomUrl": link})) + else: + print("Room link: %s\nRoom id: %s" % (link, room)) + return 0 + + def status(s, as_json): """Connection state of the three viewers, from the tools that change nothing.""" jb = s.call("juicebox_get_server_status", {}) @@ -283,6 +304,8 @@ def main(argv): first = t.get("description", "").split(". ")[0] print("%-34s %s" % (t["name"], first[:100])) return 0 + if cmd == "share": + return share(s, opts["json"]) if cmd == "status": return status(s, opts["json"]) if cmd == "call": diff --git a/scripts/test-cli.sh b/scripts/test-cli.sh index 6cc8208..8395e20 100755 --- a/scripts/test-cli.sh +++ b/scripts/test-cli.sh @@ -23,6 +23,13 @@ for cli in "python3 geenee.py" "node geenee.mjs"; do $cli room "$room" | grep -q "$room" || { echo "FAIL: room switch"; fail=1; } [ "$($cli room)" = "$room" ] || { echo "FAIL: room switch persisted"; fail=1; } $cli --room "$room" room | grep -q "$room" || { echo "FAIL: --room"; fail=1; } + out="$($cli share)"; code=$? + [ $code -eq 0 ] && echo "$out" | grep -q "^Room link: https://.*/r/$room\$" && echo "$out" | grep -q "^Room id: $room\$" || { echo "FAIL: share"; fail=1; } + echo "$out" | grep -qi "card" && { echo "FAIL: share printed the Card text"; fail=1; } + [ "$($cli room)" = "$room" ] || { echo "FAIL: share changed the Room"; fail=1; } + $cli --json share | python3 -c 'import json,sys; r=json.load(sys.stdin); assert set(r)=={"room","roomUrl"} and r["room"]=="'"$room"'"' || { echo "FAIL: share --json"; fail=1; } + $cli --room 0000000000 share 2>&1 | grep -q "expired"; [ "${PIPESTATUS[0]}" -eq 2 ] || { echo "FAIL: share on an expired Room"; fail=1; } + [ "$($cli room)" = "$room" ] || { echo "FAIL: share on an expired Room changed the saved Room"; fail=1; } done rm -f "$GEENEE_STATE" [ $fail -eq 0 ] && echo "all passed" || exit 1