Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
Expand All @@ -38,9 +38,10 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
distribution: temurin
# Avoid the repeatedly invalid Temurin 8 release-asset downloads.
distribution: ${{ matrix.java == '8' && 'zulu' || 'temurin' }}
java-version: ${{ matrix.java }}
cache: maven
- name: Build, test and install locally
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,24 @@

## [Unreleased]

### Added

- Add Forward Session creation `autoTitle`, Session update `config.multiagent`, Template A2A configuration and authenticated `retrieveAgentCard` discovery for A2A 0.3 and 1.0.
- Add typed Forward OSS storage requests and masked response credentials. Credential omission on update preserves saved credentials; mounting requires the OSS Beta header and server-side authorization.
- Add Managed Thread `eventDeltas` selectors that survive reconnects, OAuth refresh `resource`, expiry and redacted refresh accessors, and top-level MCP `Tool.permissionPolicy` for the default governing unlisted tools.

### Breaking changes

- Forward `SessionUpdateParams.config` now uses `SessionUpdateConfig`, separate from the creation `SessionConfig`. `MultiagentEntry` now implements `JsonSerializable` rather than extending `JsonObject`, so it can preserve string references as well as objects.

### Migration

- Use `SessionUpdateConfig.builder()` for Session update model/environment variables and multiagent settings. Continue using `SessionConfig.builder()` for creation; multiagent is update-only. Replace any `JsonObject` variable holding a `MultiagentEntry` with `MultiagentEntry` or `JsonSerializable`.

### Fixed

- Cancel active Skill and File downloads before releasing their response bodies, and defer body closure until in-flight reads exit. Closing a client during a blocked download read now raises the SDK abort error instead of an Okio `Unbalanced enter/exit` exception.
- Preserve Forward multiagent string references when decoding a Template or Session override; typed roster access no longer rejects valid string entries.
- Send the required `scope: by_schedule_ids` in Forward `schedules().archiveMany(...)`. Earlier releases sent only `schedule_ids`, so every batch archive request was rejected with HTTP 400 `invalid_request`; existing calls work without code changes.

## [0.3.0]
Expand Down
19 changes: 19 additions & 0 deletions docs/environments-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ Environment update metadata is a **server-side merge**; this differs from Memory

Environment responses also expose archived time, Identity ownership, icon URL and typed Template binding counts. Archive is separate from deletion. Delete does not silently archive or unbind a referenced Environment. Both Environment and File delete methods return typed JSON deletion results; a legacy HTTP 204/205 returns null data and retains status/headers in `withResponse()`.

## OSS buckets (Beta)

```java
EnvironmentStorageBucketParams bucket = EnvironmentStorageBucketParams.builder()
.name("datasets").provider("aliyun-oss").region("cn-hangzhou")
.bucket("your-bucket").access("read_only")
.credential(EnvironmentStorageCredentialParams.builder().type("ram_role")
.roleArn(System.getenv("QODER_OSS_ROLE_ARN")).build()).build();
EnvironmentConfig config = EnvironmentConfig.builder().type("cloud")
.storage(EnvironmentStorageParams.builder().buckets(Collections.singletonList(bucket)).build())
.build();
client.environments().create(EnvironmentCreateParams.builder().name("OSS data").config(config).build(),
RequestOptions.builder().header("X-Qoder-Beta", "oss-bucket-2026-09-23").build());
```

Forward supports at most seven cloud bucket mounts at `/mnt/buckets/<name>`. RAM roles use `roleArn`; access-key requests use `accessKeyId` and `accessKeySecret` from a protected configuration source. Do not log raw request JSON. The service verifies Beta eligibility, bucket authorization and read/write permissions; the SDK does not execute permission changes.

Response `config().storage().buckets()` uses separate `EnvironmentStorageBucket` and `EnvironmentStorageCredential` models. Credentials expose only their type and optional masked key ID, never role ARN or secret getters. During update, omitting a bucket credential preserves its saved credential by name. The entire config replaces the previous config; keep required package/script fields when updating. Removing a bucket or sending an empty bucket list affects new Sessions, not existing mounts. See the [public schema](https://docs.qoder.com/cloud-agents/api/forward/environments/schemas.md).

## Identity ownership and pagination

For PAT access to an Identity-owned resource, use:
Expand Down
2 changes: 2 additions & 0 deletions docs/forward-api-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ HTTP BaseURL 为 CN `https://api.qoder.com.cn/api/v1/forward` 或 Global `https:

0.2.0 已按 Go `a996a88`、Python `2f8c625`、TypeScript `f4e3a4f` 的 main 补齐 ImageSource `file_id`、创建 Memory Store 时的 mount `access`、Schedule/Run `initial_events_version` 和 ChannelPairing 时间戳。这些字段不新增协议操作;客户端 HTTP 扩展、通用 JSON 请求和配置复制见[客户端配置](client-configuration.md)。

开发中能力补齐(2026-11-21):新增 `GET /templates/{template_id}/a2a/agent-card.json`,方法 `templates().retrieveAgentCard(...)`,同步/异步及 withResponse 均支持;其余变更补齐 Session 更新多智能体、创建自动标题、A2A 配置和 OSS 模型,不新增这些资源的 HTTP 路由。新增测试见 `CapabilityParityTest`;真实环境未在本轮执行。

## 使用指南

- [客户端认证、超时、重试与取消](client-configuration.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/maintaining.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ make test

GitHub CI has six required-check names: `quality`, `check (Java 8)`, `check (Java 11)`, `check (Java 17)`, `check (Java 21)` and `check (Java 25)`. The [main ruleset payload](../.github/config/main-ruleset.json) must keep those names aligned with the workflow. Adding the JSON file does not activate GitHub protection.

CI uses Azul Zulu for Java 8 and Eclipse Temurin for Java 11/17/21/25. Java 8 uses Azul's download source after repeated non-gzip responses from the Temurin GitHub release-asset URL. Every runtime still runs the full SDK tests, independent consumer and package checks; installation failures fail the job.

The GitHub `quality` job also exercises the Central bundle profile with a temporary source copy and disposable signing key. It verifies reproducible artifact bytes and signatures without uploading a package or requiring publishing credentials.

CODEOWNERS assigns the same maintainer as the other SDK repositories. The prepared protection policy follows the Go baseline: a PR, resolved discussions, required checks, linear history, and no force pushes or branch deletion. It does not add a mandatory review count or mandatory CODEOWNER approval. Use the PR template to record cross-SDK impact, validation, skipped checks and candidate source evidence.
Expand Down
2 changes: 2 additions & 0 deletions docs/managed-api-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

Base URL:CN `https://api.qoder.com.cn/api/v1/cloud`,Global `https://api.qoder.com/api/v1/cloud`。使用方法见 [Managed 指南](managed.md);验收范围见 [真实环境测试](managed-live-testing.md)。接口存在与离线通过不等于线上权限或执行结果已验证。

开发中能力补齐(2026-11-21):Managed Thread 支持 `event_deltas[]`,允许 `agent.message` / `agent.thinking`;更新模型 `VaultCredentialOAuthRefresh.resource` 和凭据响应的到期时间、脱敏刷新信息。`VaultCredentialOAuthRefreshInfo` / `VaultCredentialTokenEndpointAuthInfo` 不提供刷新令牌或客户端密钥访问器。新增测试见 `CapabilityParityTest`,未新增 Managed HTTP 路由、未执行真实环境测试。

OAuth 的浏览器重定向快捷入口 `/oauth/authorize` 不是 SDK JSON 方法;SDK 使用 `/oauth/start` 返回授权 URL。Forward 专用 Webhook、Identity、Channel 等不属于 Managed API。已弃用的 `PUT /skills/{skill_id}` 不提供 SDK 方法;更新 Skill 内容请使用 `skills().versions().create(...)`,该方法不替代 Skill metadata 更新。

| # | Java 资源方法 | HTTP | 相对路径 | 官方文档 |
Expand Down
11 changes: 10 additions & 1 deletion docs/managed.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ Budget values are positive decimal strings with up to 12 integer and two fractio

Session environment variables use `Map<String,String>`. Deployment environment variables use a string of `KEY=VALUE` lines. Session metadata updates are merge patches; null values remove keys, while top-level null is a service no-op. Deployment metadata has its own merge-patch rules. The SDK preserves the submitted representation.

## MCP default policies

```java
Tool mcp = Tool.builder().type("mcp_toolset").mcpServerName("server")
.permissionPolicy(PermissionPolicy.builder().type("always_deny").build()).build();
```

MCP tools not listed in `configs` use the toolset's top-level `permission_policy`. The `default_config.permission_policy` metadata does not control this MCP default. Set per-tool overrides with `ToolConfig.permissionPolicy(...)`; use `tool.permissionPolicy()` to read the top-level policy. Built-in tools use their separate default-config and per-tool policies. Policy declarations are sent to the service, not enforced by the SDK.

## Events, resources and pagination

`SessionEventParam` and `EventContent.text(...)` build user events as content-block arrays. List events with `SessionEventListParams.types(...)`, which sends the Managed `types` query key; Session lifecycle filters use `statuses`. Date comparisons use `createdAtGt/Gte/Lt/Lte` where supported.
Expand All @@ -76,7 +85,7 @@ try (com.qoder.cloudagents.streaming.EventStream<SessionEvent> stream =
}
```

Session streams accept repeated `event_deltas[]` selectors; thread streams accept no query selectors and use `/sessions/{session}/threads/{thread}/stream`. Both put the resume cursor in `Last-Event-ID`. Per-call headers override parameter/default cursors. `resumableStream(...)` is explicit and never resends user messages. Closing a stream cancels the subscription, not the Session.
Session streams accept repeated `event_deltas[]` selectors; Thread streams accept the same query key for `agent.message` and `agent.thinking` previews and use `/sessions/{session}/threads/{thread}/stream`. Use `SessionThreadEventStreamParams.builder().eventDeltas(...)`; Thread thinking remains event-start-only, and Session-only filters are rejected. Both put the resume cursor in `Last-Event-ID`. Per-call headers override parameter/default cursors. `resumableStream(...)` is explicit and never resends user messages. Closing a stream cancels the subscription, not the Session.

Create-time resources support File, GitHub, generic Git and Memory Store attachments. `SessionResourceSpec` includes checkout, credentials, mount path and memory access as applicable. Existing Sessions can add File resources through `sessions().resources().create(...)`; resource updates rotate repository credentials. Credentials are request fields; responses do not expose them.

Expand Down
2 changes: 1 addition & 1 deletion docs/session-streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ try (EventStream<SessionEvent> stream = client.sessions().threads().events()
}
```

Thread SSE uses `/sessions/{session_id}/threads/{thread_id}/stream`, not the Thread history `/events` path. It does not accept Session query filters; the Java entry point rejects query overrides. The caller must use a cursor valid for this Thread. A terminated/archived Thread that cannot reopen is surfaced as the service's HTTP error; no automatic re-creation occurs.
Thread SSE uses `/sessions/{session_id}/threads/{thread_id}/stream`, not the Thread history `/events` path. Managed `SessionThreadEventStreamParams.eventDeltas(Arrays.asList("agent.message", "agent.thinking"))` enables previews through repeated `event_deltas[]` query entries; thinking is event-start-only on this surface. The copied selector list survives reconnects, while the header-only `Last-Event-ID` advances independently. Managed Thread query overrides accept only `event_deltas[]`, not Session filters; Forward Thread query selectors remain unsupported. The caller must use a cursor valid for this Thread. A terminated/archived Thread that cannot reopen is surfaced as the service's HTTP error; no automatic re-creation occurs.

## Asynchronous callbacks and cancellation

Expand Down
22 changes: 19 additions & 3 deletions docs/sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,32 @@ Session session = client.sessions().create(

Creation requires an Identity and Template accessible to the credential. The service compiles the Template and Identity configuration and applies the Session's environment variables. The SDK does not supply source type, resolve ownership or merge configuration locally.

Session update allows title, metadata and `config.environment_variables`. The environment-variable map **replaces the whole Session-level map**, then overlays the Template/Identity base. An empty map clears the Session override; an omitted field leaves it unchanged. The service rejects null config/environment-variable maps. Builders preserve explicit null for wire fidelity; they do not silently turn it into omission or an empty map.
Session update allows title, metadata, budget and `config.model`, `config.environment_variables` and `config.multiagent`. The environment-variable map **replaces the whole Session-level map**, then overlays the Template/Identity base. An empty map clears the Session override; an omitted field leaves it unchanged. The service rejects null config/environment-variable maps. Builders preserve explicit null for wire fidelity; they do not silently turn it into omission or an empty map.

```java
client.sessions().update(session.id(), SessionUpdateParams.builder()
.config(SessionConfig.builder().environmentVariables(Collections.emptyMap()).build())
.config(SessionUpdateConfig.builder().environmentVariables(Collections.emptyMap()).build())
.build());
```

Metadata follows the endpoint's merge behavior. File resources can be supplied on creation with `SessionResourceSpec`; later additions use `sessions().resources().add(...)`, not Session update.

## Automatic titles and multiagent updates

```java
Session automaticallyNamed = client.sessions().create(SessionCreateParams.builder()
.identityId("idn_example").templateId("tmpl_example").autoTitle(true).build());
MultiagentConfig roster = MultiagentConfig.builder().type("coordinator")
.agents(java.util.Arrays.asList(MultiagentEntry.of("tmpl_child"),
MultiagentEntry.builder().type("advisor").model("ultimate").build())).build();
client.sessions().update(automaticallyNamed.id(), SessionUpdateParams.builder()
.config(SessionUpdateConfig.builder().multiagent(roster).build()).build());
```

`autoTitle(true)` is creation-only and cannot be combined with any supplied `title`, including empty or null. The initial title is empty; the first user message starts automatic naming. The response exposes `title`, not an auto-title flag. Manual title updates take over naming.

Initial multiagent configuration is inherited; creation does not accept `config.multiagent`. Updates use `SessionUpdateConfig`, not the creation `SessionConfig`. A supplied roster replaces the entire override; omission preserves it, `multiagent(null)` persistently disables it rather than restoring inheritance, and empty rosters are rejected by the service. The response's `config().multiagent()` contains the authored override. Re-submitting a roster refreshes the pinned child versions; the SDK does not select historical child versions or resolve them locally. Strings, Agent objects (`templateId` or `id`), Self and one Advisor are supported; strings remain strings through `MultiagentEntry.of(...)` and `isString()`.

## Send and read events

```java
Expand Down Expand Up @@ -161,7 +177,7 @@ SessionCreateParams create = SessionCreateParams.builder()
.id("ultimate").speed("high").build()).build())
.build();
SessionUpdateParams clear = SessionUpdateParams.builder().budget(null)
.config(SessionConfig.builder().model(null).build()).build();
.config(SessionUpdateConfig.builder().model(null).build()).build();
```

Omitting `budget` keeps the current limit on update; `null` clears it and an object replaces it. It limits cumulative model and sandbox Credits; an active turn can finish, but the server rejects the next user message once the budget is exhausted. A Session model override accepts a model ID string (`ModelConfig.of`) or an object. Omit it on create to inherit; `null` is only valid on update to restore inheritance. Query model capabilities before selecting speed or context windows.
Expand Down
21 changes: 19 additions & 2 deletions docs/templates.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Template API

Implemented: list, retrieve, create, update, archive and clone. These six operations share the same request engine and credential handling in synchronous and asynchronous clients.
Implemented: list, retrieve, create, update, archive, clone and authenticated Agent Card retrieval. These seven operations share the same request engine and credential handling in synchronous and asynchronous clients.

## Methods

Expand Down Expand Up @@ -53,7 +53,8 @@ Use values supported by the selected environment and model; the SDK does not inf
| `managed_tool_config` | `ManagedToolConfig` |
| `mcp_servers` | `List<MCPServer>` |
| `skills` | `List<SkillBinding>` |
| `multiagent` | `MultiagentConfig`, `MultiagentEntry` (including Advisor model) |
| `multiagent` | `MultiagentConfig`, `MultiagentEntry` (string reference, Agent, Self or Advisor) |
| `a2a` | `TemplateA2AConfig`, `TemplateA2ASkill` (Agent Card capabilities, not resource Skill bindings) |
| `vaults`, `files` | `Map<String, ResourceBinding>` |
| `github_repositories` | Request: `GitHubRepositoryConfig`; response: `GitHubRepository` |
| `environment_variables` | `EnvironmentVariables`: object or string |
Expand Down Expand Up @@ -134,6 +135,22 @@ if (page.hasNextPage()) {

Forward pagination uses `last_id` as the next `after_id`; a request using `before_id` continues with `first_id`. These two request cursors are mutually exclusive, including request-option overrides. A false `has_more`, empty data or absent cursor ends iteration. Calling next on an exhausted page raises `PaginationException`, as does a repeated cursor that would cause a loop. Async consumers use explicit page futures; no whole-result buffering or async stream API is provided.

## A2A publication and discovery

```java
TemplateA2AConfig a2a = TemplateA2AConfig.builder().enabled(true)
.skills(Collections.singletonList(TemplateA2ASkill.builder()
.id("summary").name("Summarize").description("Summarize supplied text")
.build())).build();
client.templates().update("tmpl_example", TemplateUpdateParams.builder().a2a(a2a).build());
TemplateAgentCard card = client.templates().retrieveAgentCard("tmpl_example",
TemplateAgentCardParams.builder().identityId("idn_example").a2aVersion("1.0").build());
```

A2A is separate from multiagent orchestration. Updating A2A patches supplied object fields; omitted fields and `{}` preserve configuration, `skills: []` clears capabilities, and `a2a: null` clears and disables publication. Members do not accept null. These skills describe Card capabilities, not mounted Qoder Skills.

PAT callers select runtime `identityId`; identity-bound SAT callers omit it. Card retrieval uses the same authentication and request options as other APIs and sends `A2A-Version` as a header. Version 0.3 exposes `card.url()`, while 1.0 exposes `card.supportedInterfaces()`. Read the invocation URL from the Card and pass it to a compatible A2A client; this SDK does not follow that URL or replay A2A tasks. See the [official integration guide](https://docs.qoder.com/cloud-agents/a2a-integration.md).

## Contract sources and validation boundary

Routes and baseline fields follow the pinned Go/Python/TypeScript SDK commits in [coverage](forward-api-coverage.md). Template parameters also expose `speed`, `max_tool_rounds` and Advisor configuration. Java exposes these fields without imposing new defaults.
Expand Down
Loading
Loading