@@ -40,7 +40,7 @@ public class OpenCodeRunOptions {
4040 private boolean continueLast ;
4141 private String sessionId ;
4242 private boolean fork ;
43- private String share ;
43+ private boolean share ;
4444 private String model ;
4545 private String agent ;
4646 private List <String > files ;
@@ -76,7 +76,14 @@ public OpenCodeRunOptions(String message) {
7676 public OpenCodeRunOptions fork (boolean v ) { this .fork = v ; return this ; }
7777
7878 /** Sets the {@code --share} flag — share the session after the run. */
79- public OpenCodeRunOptions share (String v ) { this .share = v ; return this ; }
79+ public OpenCodeRunOptions share (boolean v ) { this .share = v ; return this ; }
80+
81+ /**
82+ * @deprecated OpenCode models {@code --share} as a boolean switch. Any non-null legacy
83+ * value enables the switch and the value itself is ignored.
84+ */
85+ @ Deprecated
86+ public OpenCodeRunOptions share (String v ) { this .share = v != null ; return this ; }
8087
8188 /** Sets the {@code --model/-m} flag — provider/model identifier. */
8289 public OpenCodeRunOptions model (String v ) { this .model = v ; return this ; }
@@ -130,7 +137,7 @@ public String[] toArgs() {
130137 if (continueLast ) { args .add ("--continue" ); }
131138 if (sessionId != null ) { args .add ("--session" ); args .add (sessionId ); }
132139 if (fork ) { args .add ("--fork" ); }
133- if (share != null ) { args .add ("--share" ); args . add ( share ); }
140+ if (share ) { args .add ("--share" ); }
134141 if (model != null ) { args .add ("--model" ); args .add (model ); }
135142 if (agent != null ) { args .add ("--agent" ); args .add (agent ); }
136143 if (files != null ) {
0 commit comments