Support configured child sessions
Some checks failed
Test / test (3.3) (push) Failing after 9m35s
Test / test (3.4) (push) Failing after 9m37s
Test / test (3.2) (push) Failing after 9m37s

This commit is contained in:
2026-07-15 20:18:58 -07:00
parent 2e866a618b
commit de14d57634
5 changed files with 105 additions and 4 deletions

View File

@@ -25,8 +25,24 @@ module Opencode
@workspace = workspace
end
def create_session(title: nil, permissions: nil)
body = { title: title, permission: permissions }.compact
def create_session(
title: nil,
permissions: nil,
parent_id: nil,
agent: nil,
model: nil,
metadata: nil,
workspace_id: nil
)
body = {
title: title,
permission: permissions,
parentID: parent_id,
agent: agent,
model: format_session_model(model),
metadata: metadata,
workspaceID: workspace_id
}.compact
post("/session", body)
end
@@ -476,6 +492,14 @@ module Opencode
{ providerID: provider, modelID: model_id }
end
def format_session_model(model)
return nil unless model
return model if model.is_a?(Hash)
provider, model_id = model.split("/", 2)
{ providerID: provider, id: model_id }
end
def post(path, body)
uri = build_uri(path)
request = Net::HTTP::Post.new(uri)

View File

@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Opencode
VERSION = "0.0.1.alpha4"
VERSION = "0.0.1.alpha5"
end