Would it be possible to make the "update session" pattern easier? This is the only way to change properties about a session after it's been created (archive, rename, or change worktree), which requires directly using the "patch" method on Opencode/AsyncOpencode, or the _patch method on the corresponding SessionResource.
from pathlib import Path
from opencode_ai import Opencode
from opencode_ai.types.session import Session
OPENCODE_EXPERIMENTS_DIR = Path(__file__).parent.parent.absolute()
if __name__ == "__main__":
opencode = Opencode(base_url="http://localhost:9000")
session = opencode.session.create(
extra_query={"directory": str(OPENCODE_EXPERIMENTS_DIR)},
extra_body={"title": "my session ID is (tmp)"},
)
opencode.patch(
"/session/" + session.id,
cast_to=Session,
options={
"params": {"directory": str(OPENCODE_EXPERIMENTS_DIR)},
"extra_json": {"title": f"my session ID is {session.id}"},
},
)
Would it be possible to make the "update session" pattern easier? This is the only way to change properties about a session after it's been created (archive, rename, or change worktree), which requires directly using the "patch" method on Opencode/AsyncOpencode, or the _patch method on the corresponding SessionResource.