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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,32 @@ existing `0.1.0` release; earlier development prereleases are not listed.

## [Unreleased]

### Added

- Add nullable Forward Session multiagent updates and response snapshots, plus create-only `auto_title`. Title conflicts remain server-validated; Session creation does not accept multiagent overrides.
- Add independent Template A2A configuration and `Templates.GetAgentCard`, with Identity query scope, A2A version headers and unknown-preserving 0.3/1.0 Agent Cards.
- Add typed Forward Environment packages, setup/startup scripts and OSS bucket storage, with write credentials separated from masked response views. Credential omission preserves stored credentials on update.
- Add Managed `always_deny` policies across built-in tools, default configurations and MCP; canonical-name ImageGen, ImageSearch, VideoGen and DeliverArtifacts configurations; and type-only `ManagedBrowserToolset20260714` across Agent and Session/Thread tool unions.

### Fixed

- Decode Managed tool configurations using case-insensitive canonical names and snake_case aliases, preserving the authored name when round-tripping request parameters.
- Preserve unknown fields, malformed members, explicit nulls and authored empty objects when decoding typed Forward Environment and Template A2A parameters. Typed edits replace automatically retained raw values; explicit caller overrides retain precedence. Invalid values reach server validation rather than disappearing from a configuration update.
- Clear stale null metadata when reusing a decoded Forward Session multiagent update parameter, so a subsequent roster is sent instead of an unintended clearing request.
- Expose the top-level Managed MCP toolset `permission_policy` for wildcard governance, including `always_deny`. Legacy `default_config.permission_policy` remains unchanged on the wire and does not set the wildcard policy.
- Send no request body from Forward `Dreams.Cancel` and `Dreams.Archive`. Earlier releases sent `{}`, which the service rejects with HTTP 400 `invalid_request_body`.
- Omit an empty Forward `ModelConfigParam.ID`, so an Identity Config update can change `effort`, `speed` or `context_window` while inheriting the stored model ID. Other endpoints still require the ID.
- Decode Managed Agent multiagent roster child versions saved as `"latest"`, and accept `"latest"` or positive integer strings in roster requests. Session and Deployment Agent references keep numeric versions.

### Breaking changes

- Forward `EnvironmentNewParams.Config` and `EnvironmentUpdateParams.Config` now use `EnvironmentConfigParams` instead of `map[string]any`.
- `ManagedAgentsMultiagentAgentUnion.Version` is now `ManagedAgentsMultiagentAgentVersionUnion`, and `AsAgent()` returns `ManagedAgentsMultiagentAgentReference`. Roster entries use `ManagedAgentsMultiagentAgentParams`, whose `Version` is a `ManagedAgentsMultiagentAgentVersionUnionParam`.

### Migration

- Replace `Config: map[string]any{"type": "cloud"}` with `Config: forward.EnvironmentConfigParams{Type: forward.String("cloud")}`. Use `EnvironmentConfigPackagesParam`, `EnvironmentStorageParam` and `EnvironmentStorageBucketParam` for nested configuration. Omit the entire Config on update to preserve it. A supplied Config replaces it, so resend buckets to retain mounts. Set `EnvironmentStorageCredentialParam` only when creating or replacing credentials; omit it on a bucket with the same Name to retain that bucket's credentials. Request OSS access with `option.WithHeader("X-Qoder-Beta", "oss-bucket-2026-09-23")`; Forward permits at most seven buckets.
- Clear a Session multiagent override with `param.NullStruct[forward.MultiagentConfigParam]()`, not a create-time Config field. Omit Template A2A (or send `{}`) to preserve it, use `param.NullStruct[forward.TemplateA2AConfigParam]()` to disable and clear it, and `Skills: []forward.TemplateA2ASkillParam{}` to replace the advertised skills with an empty list. A2A member nulls are rejected by the service.
- Read a saved numeric version from `Version.OfInt` and `"latest"` from `Version.OfString`; check `Version.JSON.OfInt.Valid()` first.
- Replace roster `&managed.ManagedAgentsAgentParams{ID: id, Type: "agent", Version: managed.Int(3)}` with `&managed.ManagedAgentsMultiagentAgentParams{ID: id, Type: "agent", Version: managed.ManagedAgentsMultiagentAgentVersionUnionParam{OfInt: managed.Int(3)}}`; use `OfString: managed.String("latest")` to follow the latest version.

Expand Down
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,43 @@ See the official [Forward](https://docs.qoder.com/cloud-agents/api/forward/envir
and [Managed](https://docs.qoder.com/cloud-agents/api/environments/schemas#environment-startup-script)
contracts.

Forward Environment create/update Config is typed (formerly `map[string]any`):

```go
func cloudEnvironmentParams(roleARN string) forward.EnvironmentNewParams {
return forward.EnvironmentNewParams{
Name: "cloud-with-storage",
Config: forward.EnvironmentConfigParams{
Type: forward.String("cloud"),
Packages: forward.EnvironmentConfigPackagesParam{Apt: []string{"curl"}},
SetupScript: forward.String("mkdir -p /workspace/cache"),
StartupScript: forward.String("test -d /workspace/cache"),
Storage: forward.EnvironmentStorageParam{
Buckets: []forward.EnvironmentStorageBucketParam{{
Name: "data", Provider: "aliyun-oss",
Region: "cn-hangzhou", Bucket: "your-bucket",
Access: forward.String("read_only"),
Credential: forward.EnvironmentStorageCredentialParam{
Type: "ram_role", RoleARN: forward.String(roleARN),
},
}},
},
},
}
}
```

Pass `option.WithHeader("X-Qoder-Beta", "oss-bucket-2026-09-23")` to the
Environment request. Forward supports at most seven buckets, only on cloud
Environments. For access-key writes use credential `Type: "access_key"` with
`AccessKeyID` and `AccessKeySecret`. Responses expose only credential Type and an
optional masked AccessKeyID, never typed secret or RoleARN fields. Omit the entire
Config on update to preserve the configuration and mounts. Supplying Config
replaces the whole configuration: resend the buckets you want to retain. Only
omitting Credential on a bucket with the same Name preserves its stored
credential; explicit credential null is not omission. Send
`Buckets: []forward.EnvironmentStorageBucketParam{}` to clear the mounts.

## Streaming

Streaming responses are consumed incrementally. Close the stream when finished and handle interruption explicitly; closing a local stream does not cancel server-side work.
Expand Down Expand Up @@ -226,6 +263,49 @@ func configuredModel(modelID string) forward.ModelConfigUnionParam {

Options such as `Effort` must match what the selected model supports. To send only the ID, use `forward.ModelConfigUnionParam{OfString: forward.String(modelID)}`.

Managed media tool configs use canonical names (ImageGen, ImageSearch, VideoGen,
DeliverArtifacts); their zero-value request structs supply those names and omit
Type. Policies can select `OfAlwaysDeny: &managed.ManagedAgentsAlwaysDenyPolicyParam{}`
on built-in tools, default configs and MCP. For MCP default-deny, set the
**top-level** `ManagedAgentsMCPToolsetParams.PermissionPolicy`:

```go
func denyMCPTools(serverName string) managed.ManagedAgentsMCPToolsetParams {
return managed.ManagedAgentsMCPToolsetParams{
Type: "mcp_toolset", MCPServerName: serverName,
PermissionPolicy: managed.ManagedAgentsMCPToolConfigParamsPermissionPolicyUnion{
OfAlwaysDeny: &managed.ManagedAgentsAlwaysDenyPolicyParam{},
},
}
}
```

The top-level policy also supports `OfAlwaysAllow` and `OfAlwaysAsk`; omission
allows by default. Legacy `DefaultConfig.PermissionPolicy` remains in
`default_config.permission_policy` for wire compatibility, but does not set the
MCP wildcard policy. The SDK does not move it to the top level automatically.
This example constructs parameters only; it does not execute any tools.

Browser tool unions select
`OfBrowserToolset20260714: &managed.ManagedBrowserToolset20260714Param{}`; the
request has only Type. Enable its beta through existing Betas parameters or
`option.WithHeader("X-Qoder-Beta", "browser-use-2026-07-14")`.

Forward Session updates accept nullable `Config.Multiagent`; omission preserves
it and `param.NullStruct[forward.MultiagentConfigParam]()` clears it. Session
creation intentionally has no Multiagent Config field. Create-only AutoTitle
uses `forward.Bool(true)`; the service rejects any simultaneously present Title,
including an empty string or null. Main Agent reference versions remain numeric.

Template A2A config is independent of resource Skill bindings. Omission and `{}`
preserve it, whole-object null disables and clears it, and an empty Skills slice
replaces the advertised skills. Null members are server-rejected. Retrieve its
public Agent Card with `client.Templates.GetAgentCard(ctx, templateID,
forward.TemplateGetAgentCardParams{IdentityID: forward.String(identityID),
A2AVersion: forward.String("1.0")})`. PAT callers supply the runtime Identity;
SAT callers omit IdentityID. Version `"0.3"` is also supported. The typed Card
preserves unknown JSON and does not trigger a request to its returned URL.

### Extra fields

`SetExtraFields` adds fields that the server already accepts but the SDK does not model yet. An extra field overrides the struct field of the same name, so restrict it to names and values your application controls.
Expand Down
20 changes: 20 additions & 0 deletions convention/constant/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@ func ValueOf[T Constant[T]]() T {
return t.Default()
}

type AlwaysDeny string
type BrowserToolset20260714 string
type ImageGen string
type ImageSearch string
type VideoGen string
type DeliverArtifacts string

func (c AlwaysDeny) Default() AlwaysDeny { return "always_deny" }
func (c BrowserToolset20260714) Default() BrowserToolset20260714 { return "browser_toolset_20260714" }
func (c ImageGen) Default() ImageGen { return "ImageGen" }
func (c ImageSearch) Default() ImageSearch { return "ImageSearch" }
func (c VideoGen) Default() VideoGen { return "VideoGen" }
func (c DeliverArtifacts) Default() DeliverArtifacts { return "DeliverArtifacts" }
func (c AlwaysDeny) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c BrowserToolset20260714) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ImageGen) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ImageSearch) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c VideoGen) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c DeliverArtifacts) MarshalJSON() ([]byte, error) { return marshalString(c) }

type Adaptive string // Always "adaptive"
type Advisor string // Always "advisor"
type Advisor20260301 string // Always "advisor_20260301"
Expand Down
Loading
Loading