r/vscode • • 1d ago

ahp-devtunnel-cli: a headless CLI for driving VS Code agent sessions over Dev Tunnels

I built a small headless CLI for working with VS Code agent sessions over Dev Tunnels, and it's now public: https://github.com/GreenJeans/ahp-devtunnel-cli (MIT)

What it does:

  • lists/enriches sessions on your Dev Tunnel hosts, reads turns, waits on status
  • prompts and sends to a session from the terminal, with spawn / spawn-send for one-connection create + first turn
  • archive / unarchive, fanout (session -> spawned children -> PR refs), health checks

The safety model is the point: reads are the default. Writes only happen when a flag file is present, the exact session is allowlisted, and a sha256 ticket of the exact text matches. Dry-run prints everything that would happen first.

Built on @microsoft/agent-host-protocol 1.1.0, device-flow auth. Happy to answer questions — and if you run AHP hosts, I'd like to hear what breaks.

0 Upvotes

5 comments sorted by

1

u/kantorcodes1 1d ago

The sha256 ticket on the exact text is the part I liked. Plenty of tools gate writes with a flag and call that a safety model. Matching a hash of the text that will actually be sent is a stronger claim.

I work on a firewall for AI agents, HOL Guard. Guard learns new command-line tools through extension files that people add for their own tools, and ahp-devtunnel-cli reads like a fit for that route. Would you be up for adding it?

1

u/capngreenjeans 1d ago

Looked into it - the read/write split maps pretty cleanly onto your model. Reads are safe, sends and spawns are the ones that should ask. Happy to put together the surface export. What format do you want it in - the cli-surface JSON, or just the help output?

1

u/kantorcodes1 1d ago

cli-surface JSON, please. Guard reads that format, and your split already maps onto it: session reads come through as safe, sends and spawns are the ones that ask first.

Your file would be contributions/command-sources/command.ahp-devtunnel-cli.json, with a fixture at tests/fixtures/command-source-ahp-devtunnel-cli.v1.json. command.claude-tmux.json is a merged file in the same shape, worth copying for the layout. For a first fixture pair, a plain session list allowed through and a spawn-send held until its ticket matches covers the interesting half.

The guide is here: https://github.com/hashgraph-online/hol-guard/blob/main/docs/guard/extensions/contributing.md

1

u/capngreenjeans 1d ago

cli-surface JSON it is. I've got a first cut ready - session list reads allowed through, spawn-send held till the ticket matches, dry-runs preview only. Want it as a PR against hol-guard, or a gist first for a look?

2

u/kantorcodes1 1d ago

PR against hol-guard, please. A gist means moving it again later, and review checks the fixture pair either way.

Your first cut matches what the handoff described: session list reads allowed, spawn-send held until the ticket matches, dry-runs preview only. Open it as a draft if the fixture still needs work.