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
docs: document client mode :empty + empty_mode example
- doc/reference/API.md: add :mode client option to constructor table,
add 4 new session-config flags (skip-custom-instructions,
custom-agents-local-only, coauthor-enabled, manage-schedule-enabled)
to the session-config table, and add two new sections under Advanced
Usage:
- 'Client Mode (Empty)' — runnable example, mode semantics, the 9
config defaults, system-message normalization, options.update
flags, and the always-emit tool-filter-precedence guarantee.
- 'Tool Sets' — github.copilot-sdk.tool-set API surface (builtin /
mcp / custom / builtins / isolated) with the bare-* rejection
rationale.
- CHANGELOG.md: new [Unreleased] section for upstream PR #1428,
remove the matching 'deferred from round 6' bullet (no longer
deferred — ported here).
- examples/empty_mode.clj: BYOK-based runnable example showing temp
copilot-home + in-memory session-fs + tool-set/isolated. Excluded
from run-all-examples.sh because empty mode disables the local
keychain and the example requires OPENAI_API_KEY or
ANTHROPIC_API_KEY.
- examples/README.md: example 20 entry, prerequisites note.
- doc/index.md: bump example count to 20.
Upstream: github/copilot-sdk#1428
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: doc/reference/API.md
+100Lines changed: 100 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,6 +134,7 @@ Get information about the current shared client state. Returns `nil` if no share
134
134
|`:on-list-models`| fn | nil | Zero-arg function returning model info maps. Bypasses `models.list` RPC; does not require `start!`. Results are cached the same way as RPC results |
135
135
|`:is-child-process?`| boolean |`false`| When `true`, connect via own stdio to a parent Copilot CLI process (no process spawning). Requires `:use-stdio?``true`; mutually exclusive with `:cli-url`|
136
136
|`:session-fs`| map | nil | Session filesystem provider config. Keys: `:initial-cwd` (string, required), `:session-state-path` (string, required), `:conventions` (`"windows"` or `"posix"`, required). When set, the client calls `sessionFs.setProvider` on connect and routes filesystem operations through per-session handlers. See [Session Filesystem](#session-filesystem)|
137
+
|`:mode`| keyword |`:copilot-cli`| Client multitenancy mode: `:copilot-cli` (default — preserve historical CLI behavior) or `:empty` (multi-tenant SaaS hosts that must isolate sessions from local machine state). In `:empty` mode the SDK requires at least one tenant-scoped storage root (`:copilot-home`, `:session-fs`, `:cli-url`, or `:is-child-process?`), sets `COPILOT_DISABLE_KEYTAR=1` on the spawned CLI, spreads 9 safe defaults under caller session config, forces `installedPlugins []`, and normalizes `:system-message` to strip `environment_context`. See [Client Mode](#client-mode-empty). (upstream PR #1428) |
137
138
138
139
### Methods
139
140
@@ -279,6 +280,10 @@ Create a client and session together, ensuring both are cleaned up on exit.
279
280
|`:plugin-directories`| vector | Extra plugin directories loaded even when `:enable-config-discovery` is `false`. Wire-encoded as `pluginDirectories`. (upstream PR #1482) |
280
281
|`:reasoning-summary`| string |`"none"` / `"concise"` / `"detailed"`. Controls inclusion/granularity of reasoning summaries on assistant turns. Wire-encoded as `reasoningSummary`. String-valued for consistency with `:reasoning-effort`. |
281
282
|`:context-tier`| keyword \|`nil`|`#{:default :long-context}` selects the long-context model variant; `nil` explicitly clears any prior tier (wire-encoded as JSON `null`). Omit the key entirely to leave the current setting untouched. Wire-encoded as `contextTier` with values `"default"` / `"long_context"`. |
283
+
|`:skip-custom-instructions`| boolean | Skip loading user-level custom instruction files. Forwarded via `session.options.update` (NOT `session.create`). Defaulted to `true` in `:empty` mode. (upstream PR #1428) |
284
+
|`:custom-agents-local-only`| boolean | Restrict custom-agent loading to caller-supplied configs only (no on-disk discovery). Forwarded via `session.options.update`. Defaulted to `true` in `:empty` mode. (upstream PR #1428) |
285
+
|`:coauthor-enabled`| boolean | Add a Copilot Co-authored-by trailer to commits made by the CLI. Forwarded via `session.options.update`. Defaulted to `false` in `:empty` mode. (upstream PR #1428) |
286
+
|`:manage-schedule-enabled`| boolean | Enable the built-in schedule-management tools. Forwarded via `session.options.update`. Defaulted to `false` in `:empty` mode. (upstream PR #1428) |
282
287
283
288
#### `resume-session`
284
289
@@ -1545,6 +1550,101 @@ When `:streaming? true`:
1545
1550
(copilot/stop! client)
1546
1551
```
1547
1552
1553
+
### Client Mode (Empty)
1554
+
1555
+
`:mode :empty` configures the client for multi-tenant SaaS hosts that must
1556
+
isolate sessions from the local machine — no on-disk state from a
1557
+
specific user account leaks into a session. The default `:copilot-cli`
> **Note:**`run-all-examples.sh` runs 16 examples that need only the Copilot CLI (examples 1–9, 12–16, 18, and 19).
96
-
> Examples 10 (BYOK) and 11 (MCP) require external dependencies (API keys, Node.js), and example 17 (ask-user-failure) is excluded for reliability. Run these manually.
99
+
> Examples 10 (BYOK), 11 (MCP), and 20 (empty-mode — uses BYOK) require external dependencies (API keys, Node.js), and example 17 (ask-user-failure) is excluded for reliability. Run these manually.
97
100
98
101
With a custom CLI path:
99
102
```bash
@@ -879,6 +882,39 @@ Commands are registered by passing them in the session config:
879
882
880
883
---
881
884
885
+
## Example 20: Empty (Multitenancy) Mode (`empty_mode.clj`)
886
+
887
+
**Description**: Run a session under `:mode :empty` — the hardened
888
+
posture for SaaS hosts that run sessions on behalf of multiple users.
889
+
890
+
**Features**: `:mode :empty`, `:copilot-home`, `:session-fs` with an
0 commit comments