Skip to content

Commit d5a99e0

Browse files
authored
feat(api): align official contracts and mark SDK-created sessions (#34)
* feat(api): align SDK with current official contracts * feat(sessions): identify SDK-created sessions without overwriting metadata
1 parent b70025a commit d5a99e0

63 files changed

Lines changed: 3257 additions & 290 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@ existing `0.1.0` release; earlier development prereleases are not listed.
55

66
## [Unreleased]
77

8+
### Added
9+
10+
- Automatically mark direct Forward and Managed Session creation with `__qca_sdk_created`, `__qca_sdk_language`, and the actual `__qca_sdk_version`, preserving caller metadata.
11+
- Add Forward Dreams (create, list, retrieve, cancel, archive), channel pairing list/retrieve/update, and Managed OAuth start with typed requests and responses.
12+
- Add Identity automatic memory-store control, mount access and cursor pagination, sparse managed-capability overrides, and full tools-array replacement.
13+
- Support string Template references and Advisor model entries in Forward Multiagent rosters, Schedule file resources, and optional Run input snapshots.
14+
- Add typed Managed OSS bucket storage with separate write credentials/read views, and Memory Store ID cursor parameters.
15+
16+
### Fixed
17+
18+
- Align Forward Outcome rubric objects and Managed Agent/Dream model configuration with the official API. Dream model defaults to `auto` when omitted; object configuration supports `effort` and `context_window`.
19+
20+
### Breaking changes
21+
22+
- Session creation rejects conflicting values for the three reserved SDK metadata keys before sending; matching string values remain accepted. Missing or null metadata now contains the markers, which count toward API metadata limits.
23+
- Forward event `rubric` is a text/content or file/file_id object instead of a string.
24+
- Managed Agent `effort` is a level string instead of an object; Agent and Dream model configuration no longer declares the unsupported `speed` field.
25+
- Identity mount lists now return standard pages (and an `AsyncPaginator` for the async client). Existing awaited calls still yield a page; use normal or async iteration to traverse all pages.
26+
27+
### Migration
28+
29+
- Rename business fields that collide with the three `__qca_sdk_` keys and leave space for automatic markers. See “SDK-created Session metadata” in the README.
30+
- Send `rubric={"type": "text", "content": "..."}` and `model={"id": "ultimate", "effort": "high"}`; remove Managed `speed` arguments. See the README's “Official contract alignment” section.
31+
832
## [0.12.0]
933

1034
### Added

‎README.md‎

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,32 @@ Under the hood these run `pydoc-markdown` via `uv` on a pinned Python 3.12:
4141
uv run --python 3.12 --extra dev --locked pydoc-markdown pydoc-markdown.yml
4242
```
4343

44+
## SDK-created Session metadata
45+
46+
Direct Forward and Managed Session creation automatically adds these string-valued
47+
metadata fields (Python includes both sync and async clients):
48+
49+
| Field | Value |
50+
| --- | --- |
51+
| `__qca_sdk_created` | `"true"` |
52+
| `__qca_sdk_language` | `"python"` |
53+
| `__qca_sdk_version` | The installed SDK's version |
54+
55+
Reserve the `__qca_sdk_` prefix for SDK provenance. Business metadata is preserved,
56+
and the caller's metadata object is not mutated. Omitted or null metadata becomes
57+
an object containing the markers. Passing an existing marker with the exact same
58+
string value is accepted; a different value or type (including null) fails locally
59+
before any HTTP request. This also applies after `extra_body` overrides are merged.
60+
61+
Session updates, reads and event operations do not inject or repair these fields.
62+
Sessions created indirectly through Schedules, Batches or Realtime are outside this
63+
behavior. These markers describe the creating SDK; they are client-supplied metadata,
64+
not an authentication or authorization mechanism.
65+
66+
Migration: rename any business fields that already use these three keys before
67+
upgrading. Automatic markers count toward API metadata limits; the SDK never drops
68+
business fields to make room. No additional parameters or opt-in are required.
69+
4470
## Usage
4571

4672
```python
@@ -868,3 +894,67 @@ Synchronous searches return `SyncPage`; asynchronous searches can be awaited for
868894
an `AsyncPage` or directly iterated with `async for`. Use `get_next_page()` for
869895
manual pagination (await it on an async page). `*SearchParams` TypedDicts are
870896
exported from `qca.forward.types` and `qca.managed.types`.
897+
898+
## Official contract alignment
899+
900+
The next release aligns these public types with the official API documentation
901+
retrieved on 2026-10-27. It introduces source changes relative to 0.12.0:
902+
Outcome `rubric` is an object; Managed Agent `effort` is a string; Managed Agent
903+
and Dream model objects do not accept `speed`. Managed Dream `model` is optional
904+
and defaults to `auto`. Discover model IDs and supported efforts/context windows
905+
with List models. These Managed model changes do not remove Forward model features.
906+
907+
```python
908+
from qca import Forward, Managed
909+
910+
client = Forward(pat="...")
911+
rubric = {"type": "text", "content": "report exists"}
912+
model = {"id": "ultimate", "effort": "high"}
913+
dream = client.dreams.create(inputs=[{
914+
"type": "identity_template", "identity_id": "idn_...", "template_id": "tmpl_...",
915+
}]) # model defaults to auto
916+
917+
for mount in client.identities.memory_stores.list(
918+
"tmpl_...", identity_id="idn_...", limit=20,
919+
):
920+
print(mount.memory_store_id)
921+
```
922+
923+
The async mount list returns an `AsyncPaginator`: use `async for` directly, or
924+
`await` it to obtain the first `AsyncPage`. Sync lists return `SyncPage`.
925+
Identity `tools=[]` replaces all tools with no tools; `tools=None` clears that
926+
override. Pass `managed_tool_config={"schedule": {"enabled": False}, "drive": None}`
927+
to disable Schedule tools and restore inherited Drive settings. Omitted values
928+
remain unchanged. Multiagent `agents` accepts Template ID strings and
929+
`{"type": "advisor", "model": "ultimate"}` objects.
930+
931+
New Forward Dream calls require a PAT or an admin SAT; an Identity SAT is not
932+
supported. Inputs contain exactly one primary Memory Store or Identity/Template
933+
source, optionally plus Session sources. Pairing `update` changes an active
934+
binding; supply at least one nonempty Identity or Template ID. Use pairing
935+
`create` to complete a pending pairing. Pending records preserve empty
936+
`identity_id`, `template_id`, and `paired_at` strings.
937+
938+
Identity `auto_memory_store=false` disables automatic default-store creation.
939+
Independent mounts now accept `access="read_write"`; omit access for a new
940+
read-only mount, or to preserve an existing mount's permission. Schedule
941+
`resources` accepts file entries and `[]` clears them; Run retrieval supports
942+
`include_initial_events=true` to return the saved input snapshot.
943+
944+
Managed cloud Environment `config.storage.buckets` supports up to eight OSS
945+
mounts. When the resulting configuration has buckets, explicitly include beta
946+
`oss-bucket-2026-09-23` (`Betas` in Go, `betas` in Python/TS). Send credentials
947+
only when creating or replacing them; omit `credential` on an existing named
948+
bucket to keep it. Responses expose a read view without role ARN or AccessKey
949+
secret. `storage: {buckets: []}` clears mounts.
950+
951+
Managed `OAuth.Start` (Go) / `oauth.start` (Python/TS) returns `authorization_url`,
952+
`state`, and `callback_origin`; the user completes authorization in a browser.
953+
Client secrets go in the POST body, never in a URL. This method does not open a
954+
browser or complete consent automatically.
955+
956+
See the official [Outcome contract](https://docs.qoder.com/cloud-agents/api/forward/sessions/send-events),
957+
[Identity overrides](https://docs.qoder.com/cloud-agents/api/forward/identities/upsert-config),
958+
[Dream inputs](https://docs.qoder.com/cloud-agents/api/forward/dreams/create),
959+
[OSS storage](https://docs.qoder.com/cloud-agents/api/environments/storage-buckets),
960+
and [OAuth flow](https://docs.qoder.com/cloud-agents/api/vaults/start-oauth).

0 commit comments

Comments
 (0)