Commit 86df7e5
SDK: add optional memory configuration to session create and resume (#1617)
* Add optional memory configuration to session create and resume
Add a `MemoryConfiguration` type and a `memory` option on `SessionConfig`
and `ResumeSessionConfig`, with `with_memory` builders. The configuration
serializes as an optional `memory` object on the `session.create` /
`session.resume` requests and is omitted when unset, so the runtime applies
its own default for the memory feature.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Trim memory runtime-default note to the type doc
Keep the runtime-default note only on the MemoryConfiguration type
comment; drop it from the field and builder docs. In the README, drop
the runtime-default note (no sibling feature section mentions runtime
defaults), fix the trailing colon so the code block reads as a usage
example, and remove the extensibility aside.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Drop usage example from with_memory doc comment
No other SessionConfig / ResumeSessionConfig builder method carries a
usage-example doctest; keep with_memory consistent with its siblings.
The README retains a usage example.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove Default derive from MemoryConfiguration
MemoryConfiguration exposes explicit enabled()/disabled() constructors, so a
Default impl is redundant. SessionConfig and ResumeSessionConfig hold memory as
Option<MemoryConfiguration>, which defaults to None without requiring
MemoryConfiguration: Default.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add memory configuration API to Go, Node, Python, .NET, and Java SDKs
Mirror the Rust session memory surface across the remaining SDK
languages: session create and resume accept an optional memory
configuration carrying a required `enabled` flag, omitted from the
wire when unset. Adds the type, the create/resume wiring, clone and
serialization coverage, and README docs per language.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Default session memory to disabled in empty client mode
Apply the empty-mode SDK default for the `memory` session option across all
language SDKs: in `empty` client mode `memory` defaults to disabled unless the
app supplies a value, while in the default `copilot-cli` mode `memory` is left
unset so the runtime applies its own default. Caller-supplied configuration
always wins. Adds unit tests (Rust, Go, Node, Python) and a README note per
language.
Also break a module-level cyclic import in the Python client by importing
`MemoryConfiguration` under `TYPE_CHECKING` (it is only referenced in
annotations, which are lazy via `from __future__ import annotations`).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Test: avoid deprecated buildCreateRequest signature in java tests
* Fix python cyclic imports for CodeQL
* Address review comments on SDK PR 1617
- Fix Python payload keys for ModelCapabilitiesOverride serialization to match wire format (camelCase instead of snake_case)
- Update Rust README example to include SessionConfig import
* Re-trigger CI for flaky Windows model-switch e2e
The Node.js SDK Tests (windows-latest) leg failed on an unrelated, flaky
end-to-end test (test/e2e/rpc_session_state.e2e.test.ts, model switchTo:
expected claude-sonnet-4.5, received gpt-4.1). This PR only changes the
memory configuration RPC surface and does not touch model switching or
session-state code. The same base commit (Update @github/copilot to 1.0.62)
passes this leg on main.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Tighten _memory_default typing to MemoryConfiguration
Type _memory_default's supplied parameter and return value as
MemoryConfiguration | None instead of Any, matching the type specificity of
the other mode-default helpers and recovering the benefit of the
MemoryConfiguration TypedDict. The type is imported under TYPE_CHECKING (with
the module's existing 'from __future__ import annotations') so no runtime
import edge is added between _mode and session.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 8e2d6f8 commit 86df7e5
37 files changed
Lines changed: 1064 additions & 74 deletions
File tree
- dotnet
- src
- test/Unit
- go
- java/src
- main/java/com/github/copilot
- rpc
- test/java/com/github/copilot
- nodejs
- src
- test
- python
- copilot
- rust
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
413 | 427 | | |
414 | 428 | | |
415 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
| 675 | + | |
675 | 676 | | |
676 | 677 | | |
677 | 678 | | |
| |||
935 | 936 | | |
936 | 937 | | |
937 | 938 | | |
| 939 | + | |
938 | 940 | | |
939 | 941 | | |
940 | 942 | | |
| |||
1131 | 1133 | | |
1132 | 1134 | | |
1133 | 1135 | | |
| 1136 | + | |
1134 | 1137 | | |
1135 | 1138 | | |
1136 | 1139 | | |
| |||
2322 | 2325 | | |
2323 | 2326 | | |
2324 | 2327 | | |
| 2328 | + | |
2325 | 2329 | | |
2326 | 2330 | | |
2327 | 2331 | | |
| |||
2412 | 2416 | | |
2413 | 2417 | | |
2414 | 2418 | | |
| 2419 | + | |
2415 | 2420 | | |
2416 | 2421 | | |
2417 | 2422 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2364 | 2364 | | |
2365 | 2365 | | |
2366 | 2366 | | |
| 2367 | + | |
| 2368 | + | |
| 2369 | + | |
| 2370 | + | |
| 2371 | + | |
| 2372 | + | |
| 2373 | + | |
| 2374 | + | |
| 2375 | + | |
| 2376 | + | |
| 2377 | + | |
| 2378 | + | |
2367 | 2379 | | |
2368 | 2380 | | |
2369 | 2381 | | |
| |||
2458 | 2470 | | |
2459 | 2471 | | |
2460 | 2472 | | |
| 2473 | + | |
2461 | 2474 | | |
2462 | 2475 | | |
2463 | 2476 | | |
| |||
2805 | 2818 | | |
2806 | 2819 | | |
2807 | 2820 | | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
2808 | 2827 | | |
2809 | 2828 | | |
2810 | 2829 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| |||
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| |||
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
| 407 | + | |
405 | 408 | | |
406 | 409 | | |
407 | 410 | | |
408 | 411 | | |
409 | 412 | | |
410 | 413 | | |
| 414 | + | |
411 | 415 | | |
412 | 416 | | |
413 | 417 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
270 | 322 | | |
271 | 323 | | |
272 | 324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
500 | 526 | | |
501 | 527 | | |
502 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| 650 | + | |
650 | 651 | | |
651 | 652 | | |
652 | 653 | | |
| |||
983 | 984 | | |
984 | 985 | | |
985 | 986 | | |
| 987 | + | |
986 | 988 | | |
987 | 989 | | |
988 | 990 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
608 | 672 | | |
609 | 673 | | |
610 | 674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
157 | 160 | | |
158 | 161 | | |
159 | 162 | | |
| |||
195 | 198 | | |
196 | 199 | | |
197 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
198 | 204 | | |
199 | 205 | | |
200 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
276 | 279 | | |
277 | 280 | | |
278 | 281 | | |
| |||
287 | 290 | | |
288 | 291 | | |
289 | 292 | | |
| 293 | + | |
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
| |||
310 | 314 | | |
311 | 315 | | |
312 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
313 | 320 | | |
314 | 321 | | |
315 | 322 | | |
| |||
334 | 341 | | |
335 | 342 | | |
336 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
337 | 347 | | |
338 | 348 | | |
339 | 349 | | |
| |||
0 commit comments