Run opencode web as an optio task; local subprocess or remote via SSH.
Project description
optio-opencode
Run opencode web as an optio task — local subprocess or remote over SSH — with opencode's UI reachable through optio's UI components.
What it does
Given an OpencodeTaskConfig (workdir contents, prompt, deliverable callback), optio-opencode:
- Provisions a fresh workdir on the chosen host (local or remote).
- Writes
AGENTS.md(base prompt + your instructions) andopencode.json(your config) into it. - Installs the opencode binary if missing (remote mode only).
- Launches
opencode webwith a random auth password. - Registers the opencode UI as a widget that optio's UI components can embed via the widget proxy — SSH tunnel hidden from optio-api.
- Tails a log file the LLM writes to and translates structured lines into optio events:
STATUS: …→ctx.report_progress(percent, message)DELIVERABLE: <path>→ fetches the file, invokes youron_deliverablecallbackDONE [summary]→ clean completionERROR [message]→ failure
- Cleans up workdir and SSH connection on teardown.
The same OpencodeTaskConfig works for local and remote modes; only SSHConfig differs.
When to use it
You want an opencode-driven assistant session as a managed optio task — surfaced through optio's UI, with progress reporting and file deliverables — without writing the host management, log parsing, or widget plumbing yourself.
Installation
pip install optio-opencode
Python 3.11+. Depends on optio-core, optio-host, and asyncssh.
Minimal example
from optio_opencode import create_opencode_task, OpencodeTaskConfig
from optio_host import SSHConfig
config = OpencodeTaskConfig(
workdir_files={"AGENTS.md": "Do the thing.", "opencode.json": "{...}"},
on_deliverable=lambda ctx, path, text: print(f"got {path}: {len(text)} bytes"),
ssh=SSHConfig(host="worker-1", user="optio", key_path="~/.ssh/id_optio"),
)
task = create_opencode_task(config)
# Schedule / run via optio-core as usual.
Set ssh=None for local subprocess mode.
License
Apache-2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file optio_opencode-0.1.1.tar.gz.
File metadata
- Download URL: optio_opencode-0.1.1.tar.gz
- Upload date:
- Size: 43.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
746f905c4ac95496cc2a231e7fab2d5c1794ec0be7e5afc674686874c8b5668b
|
|
| MD5 |
eaec98a23bde016fbdf927c9b1d58325
|
|
| BLAKE2b-256 |
b36aedd3ffb0c47bb71aa9e7809c7041ec3012403bf2f64f76322fb948b716da
|
File details
Details for the file optio_opencode-0.1.1-py3-none-any.whl.
File metadata
- Download URL: optio_opencode-0.1.1-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcdbdd4b988b9bac4cf6c589be3f404cc4e8b19ff51f1c08e259fe5f8a401df3
|
|
| MD5 |
2ca688a1c0f4441c42292dfa75677dd3
|
|
| BLAKE2b-256 |
22348ade23c596f5e433885905d75556ec016563fa71b4fb7393ada07a9317ed
|