You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dotnet/src/build/GitHub.Copilot.SDK.targets
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@
9
9
<_CopilotOsCondition="'$(RuntimeIdentifier)' != '' And $(RuntimeIdentifier.StartsWith('win'))">win</_CopilotOs>
10
10
<_CopilotOsCondition="'$(_CopilotOs)' == '' And '$(RuntimeIdentifier)' != '' And $(RuntimeIdentifier.StartsWith('osx'))">osx</_CopilotOs>
11
11
<_CopilotOsCondition="'$(_CopilotOs)' == '' And '$(RuntimeIdentifier)' != '' And $(RuntimeIdentifier.StartsWith('maccatalyst'))">osx</_CopilotOs>
12
+
<_CopilotOsCondition="'$(_CopilotOs)' == '' And '$(RuntimeIdentifier)' != '' And $(RuntimeIdentifier.StartsWith('linux-musl'))">linux-musl</_CopilotOs>
12
13
<_CopilotOsCondition="'$(_CopilotOs)' == '' And '$(RuntimeIdentifier)' != ''">linux</_CopilotOs>
13
14
14
15
<!-- Determine arch: from RID suffix if set, otherwise from build host -->
@@ -22,7 +23,7 @@
22
23
23
24
<!-- Fail if we couldn't determine a portable RID from the given RuntimeIdentifier -->
24
25
<TargetName="_ValidateCopilotRid"BeforeTargets="BeforeBuild"Condition="'$(RuntimeIdentifier)' != '' And '$(_CopilotRid)' == ''">
25
-
<ErrorText="Could not determine a supported portable RID from RuntimeIdentifier '$(RuntimeIdentifier)'. Supported RIDs: win-x64, win-arm64, linux-x64, linux-arm64, osx-x64, osx-arm64." />
26
+
<ErrorText="Could not determine a supported portable RID from RuntimeIdentifier '$(RuntimeIdentifier)'. Supported RIDs: win-x64, win-arm64, linux-x64, linux-arm64, linux-musl-x64, linux-musl-arm64, osx-x64, osx-arm64." />
26
27
</Target>
27
28
28
29
<!-- Map RID to platform name used in npm packages -->
Copy file name to clipboardExpand all lines: go/README.md
+48-2Lines changed: 48 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,6 +101,49 @@ Follow these steps to embed the CLI:
101
101
102
102
That's it! When your application calls `copilot.NewClient` without a `Connection` field (or with an empty `StdioConnection{}`) and no `COPILOT_CLI_PATH` environment variable, the SDK will automatically install the embedded CLI to a cache directory and use it for all operations.
103
103
104
+
The bundler prepares the native runtime library required by the [in-process transport](#in-process-transport-experimental). It is included in the application only when building with the `copilot_inprocess` build tag.
105
+
106
+
## In-process transport (Experimental)
107
+
108
+
> **Experimental:** the in-process API may change in a future release.
109
+
110
+
By default the SDK starts the runtime as a child process and talks JSON-RPC over stdio or TCP. The **in-process** transport instead loads a native runtime library directly into your process.
111
+
112
+
Build your application with the `copilot_inprocess` build tag:
- The application must be built with the `copilot_inprocess` build tag.
131
+
- Set `COPILOT_SDK_DEFAULT_CONNECTION=inprocess` to select the in-process
132
+
transport when `ClientOptions.Connection` is nil. An explicit connection
133
+
always takes precedence.
134
+
- Set `COPILOT_CLI_PATH` only when using an externally provisioned compatible runtime package; otherwise the bundled runtime is used. No `PATH` lookup is performed.
135
+
- Embedded runtime versions are isolated in separate cache directories. Start fails loudly if the native runtime is unavailable.
136
+
- Linux in-process bundles include both glibc and musl runtime packages and select the matching package automatically at startup.
137
+
- Only one native runtime version may be loaded per process.
138
+
139
+
The in-process transport rejects options that cannot be honored by a runtime hosted in your shared process (each panics at `NewClient`):
140
+
141
+
-`Env` — the host process has a single environment block. Set variables on the host process environment instead.
142
+
-`WorkingDirectory` — the runtime shares the host process's working directory. Change the process working directory before creating the client.
143
+
-`Telemetry` — per-client telemetry is lowered to native-runtime environment variables. Use a child-process transport for per-client telemetry.
144
+
145
+
Implemented with pure-Go FFI (via [purego](https://github.com/ebitengine/purego)), so `CGO_ENABLED=0` and cross-compilation are preserved; no C toolchain is required.
-`Connection` (RuntimeConnection): How the SDK connects to the runtime. Construct via one of:
145
-
-`StdioConnection{Path, Args}` — spawn a runtime over stdio (the default if `Connection` is nil)
146
-
-`TCPConnection{Port, ConnectionToken, Path, Args}` — spawn a runtime that listens on TCP
188
+
-`StdioConnection{Path, Args, Env}` — spawn a runtime over stdio (the default if `Connection` is nil)
189
+
-`TCPConnection{Port, ConnectionToken, Path, Args, Env}` — spawn a runtime that listens on TCP
147
190
-`URIConnection{URL, ConnectionToken}` — connect to an already-running runtime (no process spawned)
191
+
-`InProcessConnection{}` — **Experimental.** Host the runtime in-process via the native FFI library instead of spawning a child process. See [In-process transport](#in-process-transport-experimental) below.
148
192
149
193
When `Path` is empty for stdio/tcp, the SDK uses the bundled CLI (or `COPILOT_CLI_PATH` env var).
194
+
195
+
`StdioConnection` and `TCPConnection` accept an optional connection-level `Env`. Set environment variables via **either** the client-level `Env` option or the connection's `Env`, not both (setting both panics); prefer the connection-level `Env`.
150
196
-`WorkingDirectory` (string): Working directory for the runtime process
151
197
-`BaseDirectory` (string): Base directory for Copilot data (session state, config, etc.). Sets `COPILOT_HOME` on the spawned runtime. When empty, the runtime defaults to `~/.copilot`. Ignored with `URIConnection`. This does **not** affect where the Go SDK extracts the embedded CLI binary; use `embeddedcli.Config.Dir` for the extraction/cache location.
152
198
-`LogLevel` (string): Log level. When empty (default), the runtime uses its own default level (the SDK does not pass `--log-level`).
0 commit comments