Skip to content

Commit 2aaf765

Browse files
edburnsCopilot
andcommitted
Move release profile to parent POM, add in-process docs, mark RuntimeConnection APIs as @CopilotExperimental
- Move GPG signing release profile from sdk/pom.xml to parent pom.xml so all reactor modules (sdk + copilot-native) are signed on publish. - Move README.md from java/sdk/ to java/ top level and fix relative paths. - Add in-process mode (experimental) section to README documenting the copilot-sdk-java-runtime classifier dependency and RuntimeConnection usage. - Annotate RuntimeConnection, StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, and CopilotClientOptions.get/setConnection() with @CopilotExperimental. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 35ff58dd-bfec-40bc-981d-d3c82174511d
1 parent 0bdb322 commit 2aaf765

8 files changed

Lines changed: 103 additions & 48 deletions

File tree

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,46 @@ Replace `${copilot.sdk.version}` with the latest release from Maven Central.
7070
implementation 'com.github:copilot-sdk-java:1.0.11-preview.0-SNAPSHOT'
7171
```
7272

73+
## In-process mode (experimental)
74+
75+
The SDK supports running the Copilot runtime **in-process** as a native library instead of spawning a separate CLI process. This eliminates process management overhead and simplifies deployment. In-process mode is currently experimental and only supported on **linux-x64**.
76+
77+
Because in-process mode is experimental, see the [Using experimental APIs](#using-experimental-apis) section for how to opt in.
78+
79+
### Additional dependency
80+
81+
Add both the SDK and the platform-specific native runtime to your project:
82+
83+
```xml
84+
<dependencies>
85+
<!-- Pure-Java SDK (~1.5 MB) -->
86+
<dependency>
87+
<groupId>com.github</groupId>
88+
<artifactId>copilot-sdk-java</artifactId>
89+
<version>${copilot.version}</version>
90+
</dependency>
91+
<!-- Native runtime for linux-x64 (~20-26 MB) -->
92+
<dependency>
93+
<groupId>com.github</groupId>
94+
<artifactId>copilot-sdk-java-runtime</artifactId>
95+
<version>${copilot.version}</version>
96+
<classifier>linux-x64</classifier>
97+
</dependency>
98+
</dependencies>
99+
```
100+
101+
### Usage
102+
103+
Configure the client to use the in-process connection:
104+
105+
```java
106+
CopilotClientOptions options = new CopilotClientOptions()
107+
.setConnection(RuntimeConnection.forInProcess());
108+
109+
CopilotClient client = new CopilotClient(options);
110+
client.start().get();
111+
```
112+
73113
## Quick Start
74114

75115
```java
@@ -156,7 +196,7 @@ PermissionHandler handler = (request, invocation) -> {
156196

157197
You can run the SDK without setting up a full Java project, by using [JBang](https://www.jbang.dev/).
158198

159-
See the full source of [`jbang-example.java`](jbang-example.java) for a complete example with more features like session idle handling and usage info events.
199+
See the full source of [`jbang-example.java`](sdk/jbang-example.java) for a complete example with more features like session idle handling and usage info events.
160200

161201
Or run it directly from the repository:
162202

@@ -262,7 +302,7 @@ Chain fluent modifiers to set tool options:
262302
- `.defer(ToolDefer)` — control deferred execution (`AUTO`, `NEVER`)
263303
- `.overridesBuiltInTool(boolean)` — shadow built-in tools
264304

265-
For design context and decision rationale, see [ADR-006](docs/adr/adr-006-tool-definition-inline.md).
305+
For design context and decision rationale, see [ADR-006](sdk/docs/adr/adr-006-tool-definition-inline.md).
266306

267307
## Session Store
268308

@@ -386,7 +426,7 @@ The processor uses standard JSR 269 annotation processing APIs for maximum porta
386426
| Local variable with experimental type (including `var` inference) || Move the usage into a declaration the processor can see, or use the compiler flag |
387427
| Cast to experimental type || Use the compiler flag for a whole-compilation opt-in |
388428

389-
In practice, these gaps rarely matter: any meaningful use of an experimental SDK type almost always appears in a field declaration, method signature, or type hierarchy — all of which are caught. A purely inline expression with no declaration footprint (e.g., `session.rpc().experimental.foo().join()`) is the only case that would slip through. See [ADR-004](docs/adr/adr-004-copilotexperimental.md) for the design rationale.
429+
In practice, these gaps rarely matter: any meaningful use of an experimental SDK type almost always appears in a field declaration, method signature, or type hierarchy — all of which are caught. A purely inline expression with no declaration footprint (e.g., `session.rpc().experimental.foo().join()`) is the only case that would slip through. See [ADR-004](sdk/docs/adr/adr-004-copilotexperimental.md) for the design rationale.
390430

391431
### Example
392432

@@ -443,4 +483,4 @@ mvn jacoco:prepare-agent@wire-up-coverage-instrumentation antrun:run@print-test-
443483

444484
## License
445485

446-
MIT — see [LICENSE](LICENSE) for details.
486+
MIT — see [LICENSE](sdk/LICENSE) for details.

java/pom.xml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,51 @@
169169
</plugins>
170170
</pluginManagement>
171171
</build>
172+
173+
<profiles>
174+
<profile>
175+
<id>release</id>
176+
<build>
177+
<plugins>
178+
<plugin>
179+
<groupId>org.apache.maven.plugins</groupId>
180+
<artifactId>maven-source-plugin</artifactId>
181+
<executions>
182+
<execution>
183+
<id>attach-sources</id>
184+
<goals>
185+
<goal>jar-no-fork</goal>
186+
</goals>
187+
</execution>
188+
</executions>
189+
</plugin>
190+
<plugin>
191+
<groupId>org.apache.maven.plugins</groupId>
192+
<artifactId>maven-javadoc-plugin</artifactId>
193+
<executions>
194+
<execution>
195+
<id>attach-javadocs</id>
196+
<goals>
197+
<goal>jar</goal>
198+
</goals>
199+
</execution>
200+
</executions>
201+
</plugin>
202+
<plugin>
203+
<groupId>org.apache.maven.plugins</groupId>
204+
<artifactId>maven-gpg-plugin</artifactId>
205+
<executions>
206+
<execution>
207+
<id>sign-artifacts</id>
208+
<phase>verify</phase>
209+
<goals>
210+
<goal>sign</goal>
211+
</goals>
212+
</execution>
213+
</executions>
214+
</plugin>
215+
</plugins>
216+
</build>
217+
</profile>
218+
</profiles>
172219
</project>

java/sdk/pom.xml

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -691,50 +691,6 @@ did not produce the multi-release output. Re-build on JDK 25+ and verify the
691691
</plugins>
692692
</build>
693693
</profile>
694-
<profile>
695-
<id>release</id>
696-
<build>
697-
<plugins>
698-
<plugin>
699-
<groupId>org.apache.maven.plugins</groupId>
700-
<artifactId>maven-source-plugin</artifactId>
701-
<executions>
702-
<execution>
703-
<id>attach-sources</id>
704-
<goals>
705-
<goal>jar-no-fork</goal>
706-
</goals>
707-
</execution>
708-
</executions>
709-
</plugin>
710-
<plugin>
711-
<groupId>org.apache.maven.plugins</groupId>
712-
<artifactId>maven-javadoc-plugin</artifactId>
713-
<executions>
714-
<execution>
715-
<id>attach-javadocs</id>
716-
<goals>
717-
<goal>jar</goal>
718-
</goals>
719-
</execution>
720-
</executions>
721-
</plugin>
722-
<plugin>
723-
<groupId>org.apache.maven.plugins</groupId>
724-
<artifactId>maven-gpg-plugin</artifactId>
725-
<executions>
726-
<execution>
727-
<id>sign-artifacts</id>
728-
<phase>verify</phase>
729-
<goals>
730-
<goal>sign</goal>
731-
</goals>
732-
</execution>
733-
</executions>
734-
</plugin>
735-
</plugins>
736-
</build>
737-
</profile>
738694
<!-- Update the @github/copilot npm schema package to a new version.
739695
Usage: mvn generate-sources -Pupdate-schemas-from-npm-artifact -Dcopilot.schema.version=1.0.25 -->
740696
<profile>

java/sdk/src/main/java/com/github/copilot/rpc/CopilotClientOptions.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ public CopilotClientOptions setCliUrl(String cliUrl) {
212212
* {@link #isUseStdio()}, {@link #getCliUrl()} and {@link #getCliPath()}
213213
*/
214214
@JsonIgnore
215+
@CopilotExperimental
215216
public RuntimeConnection getConnection() {
216217
return connection;
217218
}
@@ -233,6 +234,7 @@ public RuntimeConnection getConnection() {
233234
* individual transport options
234235
* @return this options instance for method chaining
235236
*/
237+
@CopilotExperimental
236238
public CopilotClientOptions setConnection(RuntimeConnection connection) {
237239
this.connection = connection;
238240
return this;

java/sdk/src/main/java/com/github/copilot/rpc/RuntimeConnection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*
2727
* @since 1.0.0
2828
*/
29+
@CopilotExperimental
2930
public abstract sealed class RuntimeConnection
3031
permits StdioRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, InProcessRuntimeConnection {
3132

java/sdk/src/main/java/com/github/copilot/rpc/StdioRuntimeConnection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
import java.util.ArrayList;
88
import java.util.List;
99

10+
import com.github.copilot.CopilotExperimental;
11+
1012
/**
1113
* Spawns a runtime child process and communicates over its stdin/stdout.
1214
* Construct with {@link RuntimeConnection#forStdio()} or
1315
* {@link RuntimeConnection#forStdio(String)}.
1416
*
1517
* @since 1.0.0
1618
*/
19+
@CopilotExperimental
1720
public final class StdioRuntimeConnection extends RuntimeConnection {
1821

1922
private String path;

java/sdk/src/main/java/com/github/copilot/rpc/TcpRuntimeConnection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
import java.util.ArrayList;
88
import java.util.List;
99

10+
import com.github.copilot.CopilotExperimental;
11+
1012
/**
1113
* Spawns a runtime child process listening on a TCP socket and connects to it.
1214
* Construct with {@link RuntimeConnection#forTcp()}.
1315
*
1416
* @since 1.0.0
1517
*/
18+
@CopilotExperimental
1619
public final class TcpRuntimeConnection extends RuntimeConnection {
1720

1821
private String path;

java/sdk/src/main/java/com/github/copilot/rpc/UriRuntimeConnection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44

55
package com.github.copilot.rpc;
66

7+
import com.github.copilot.CopilotExperimental;
8+
79
/**
810
* Connects to an already-running runtime at the configured URL. Construct with
911
* {@link RuntimeConnection#forUri(String)}.
1012
*
1113
* @since 1.0.0
1214
*/
15+
@CopilotExperimental
1316
public final class UriRuntimeConnection extends RuntimeConnection {
1417

1518
private final String url;

0 commit comments

Comments
 (0)