From ee2d2deec62801b0a5a24ae040df3a8629813c01 Mon Sep 17 00:00:00 2001 From: "ark-hand[bot]" <315378070+ark-hand[bot]@users.noreply.github.com> Date: Wed, 9 Sep 2026 12:11:48 +0800 Subject: [PATCH] chore: sync from ark-apis d20f0d68da Auto-generated SDK sync from ark-apis at d20f0d68da2100d87a660921aedc9b72d75c6a34. Generated files are overwritten by the sync pipeline and should not be edited by hand. Sync-Source-Commit: b36dda2f68695b1f440c6cc4950c26f00d6d5b6f Ark-APIs-Commit: d20f0d68da2100d87a660921aedc9b72d75c6a34 Release-Version: 0.6.0 --- README.md | 4 +- VERSION | 2 +- pom.xml | 2 +- .../ark/runtime/models/images/Background.java | 57 ++ .../images/CreateImageGenerationRequest.java | 81 ++- .../CreateImageGenerationRequestImage.java | 120 ++++ .../models/session/AgentWithUpgrades.java | 557 ++++++++++++++++++ .../session/CreateSessionUpgradeRequest.java | 282 +++++++++ .../session/EnvironmentWithUpgrades.java | 262 ++++++++ .../models/session/ModelOverrides.java | 86 ++- .../runtime/models/session/ModelUpgrades.java | 301 ++++++++++ .../runtime/models/session/SessionStatus.java | 8 +- 12 files changed, 1725 insertions(+), 37 deletions(-) create mode 100644 src/main/java/com/volcengine/ark/runtime/models/images/Background.java create mode 100644 src/main/java/com/volcengine/ark/runtime/models/images/CreateImageGenerationRequestImage.java create mode 100644 src/main/java/com/volcengine/ark/runtime/models/session/AgentWithUpgrades.java create mode 100644 src/main/java/com/volcengine/ark/runtime/models/session/CreateSessionUpgradeRequest.java create mode 100644 src/main/java/com/volcengine/ark/runtime/models/session/EnvironmentWithUpgrades.java create mode 100644 src/main/java/com/volcengine/ark/runtime/models/session/ModelUpgrades.java diff --git a/README.md b/README.md index d2f28da..6bb978a 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,14 @@ The official Java library for accessing ModelArk on Volcengine and BytePlus. It com.volcengine ark-runtime - 0.5.0 + 0.6.0 ``` ### Gradle ```groovy -implementation 'com.volcengine:ark-runtime:0.5.0' +implementation 'com.volcengine:ark-runtime:0.6.0' ``` ## Choose Volcengine or BytePlus diff --git a/VERSION b/VERSION index 8f0916f..a918a2a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.0 +0.6.0 diff --git a/pom.xml b/pom.xml index 9530796..c0f8c8a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.volcengine ark-runtime - 0.5.0 + 0.6.0 jar ark-runtime diff --git a/src/main/java/com/volcengine/ark/runtime/models/images/Background.java b/src/main/java/com/volcengine/ark/runtime/models/images/Background.java new file mode 100644 index 0000000..5f40c9a --- /dev/null +++ b/src/main/java/com/volcengine/ark/runtime/models/images/Background.java @@ -0,0 +1,57 @@ +// Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. +// SPDX-License-Identifier: Apache-2.0 + +/* + * Ark Image Generation API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.volcengine.ark.runtime.models.images; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Background of the generated image. + */ +public enum Background { + + OPAQUE("opaque"), + + TRANSPARENT("transparent"); + + private String value; + + Background(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static Background fromValue(String value) { + for (Background b : Background.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} diff --git a/src/main/java/com/volcengine/ark/runtime/models/images/CreateImageGenerationRequest.java b/src/main/java/com/volcengine/ark/runtime/models/images/CreateImageGenerationRequest.java index ea22756..c8b654d 100644 --- a/src/main/java/com/volcengine/ark/runtime/models/images/CreateImageGenerationRequest.java +++ b/src/main/java/com/volcengine/ark/runtime/models/images/CreateImageGenerationRequest.java @@ -42,6 +42,7 @@ CreateImageGenerationRequest.JSON_PROPERTY_OPTIMIZE_PROMPT_OPTIONS, CreateImageGenerationRequest.JSON_PROPERTY_TOOLS, CreateImageGenerationRequest.JSON_PROPERTY_OUTPUT_FORMAT, + CreateImageGenerationRequest.JSON_PROPERTY_BACKGROUND, CreateImageGenerationRequest.JSON_PROPERTY_LAYER_DECOMPOSITION }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0") @@ -51,12 +52,12 @@ public class CreateImageGenerationRequest { private String model; public static final String JSON_PROPERTY_PROMPT = "prompt"; - @javax.annotation.Nonnull + @javax.annotation.Nullable private String prompt; public static final String JSON_PROPERTY_IMAGE = "image"; @javax.annotation.Nullable - private List image; + private CreateImageGenerationRequestImage image; public static final String JSON_PROPERTY_STREAM = "stream"; @javax.annotation.Nullable @@ -106,6 +107,10 @@ public class CreateImageGenerationRequest { @javax.annotation.Nullable private OutputFormat outputFormat; + public static final String JSON_PROPERTY_BACKGROUND = "background"; + @javax.annotation.Nullable + private Background background; + public static final String JSON_PROPERTY_LAYER_DECOMPOSITION = "layer_decomposition"; @javax.annotation.Nullable private Boolean layerDecomposition; @@ -138,61 +143,53 @@ public void setModel(@javax.annotation.Nonnull String model) { this.model = model; } - public CreateImageGenerationRequest prompt(@javax.annotation.Nonnull String prompt) { + public CreateImageGenerationRequest prompt(@javax.annotation.Nullable String prompt) { this.prompt = prompt; return this; } /** - * Text prompt describing the desired image. + * Text prompt describing the desired image. Required for standard generation; may be omitted for automatic layer decomposition when `layer_decomposition=true`. * @return prompt */ - @javax.annotation.Nonnull - @JsonProperty(value = JSON_PROPERTY_PROMPT, required = true) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PROMPT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getPrompt() { return prompt; } - @JsonProperty(value = JSON_PROPERTY_PROMPT, required = true) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setPrompt(@javax.annotation.Nonnull String prompt) { + @JsonProperty(value = JSON_PROPERTY_PROMPT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPrompt(@javax.annotation.Nullable String prompt) { this.prompt = prompt; } - public CreateImageGenerationRequest image(@javax.annotation.Nullable List image) { + public CreateImageGenerationRequest image(@javax.annotation.Nullable CreateImageGenerationRequestImage image) { this.image = image; return this; } - public CreateImageGenerationRequest addImageItem(String imageItem) { - if (this.image == null) { - this.image = new ArrayList<>(); - } - this.image.add(imageItem); - return this; - } - /** - * Reference / edit images. Each entry is a URL or a `data:` URI. + * Get image * @return image */ @javax.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_IMAGE, required = false) - @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public List getImage() { + public CreateImageGenerationRequestImage getImage() { return image; } @JsonProperty(value = JSON_PROPERTY_IMAGE, required = false) - @JsonInclude(value = JsonInclude.Include.NON_EMPTY) - public void setImage(@javax.annotation.Nullable List image) { + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setImage(@javax.annotation.Nullable CreateImageGenerationRequestImage image) { this.image = image; } @@ -504,6 +501,31 @@ public void setOutputFormat(@javax.annotation.Nullable OutputFormat outputFormat this.outputFormat = outputFormat; } + public CreateImageGenerationRequest background(@javax.annotation.Nullable Background background) { + + this.background = background; + return this; + } + + /** + * Output background. Defaults to `opaque`. `transparent` requires exactly one PNG reference image with an alpha channel and PNG output. + * @return background + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_BACKGROUND, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Background getBackground() { + return background; + } + + + @JsonProperty(value = JSON_PROPERTY_BACKGROUND, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setBackground(@javax.annotation.Nullable Background background) { + this.background = background; + } + public CreateImageGenerationRequest layerDecomposition(@javax.annotation.Nullable Boolean layerDecomposition) { this.layerDecomposition = layerDecomposition; @@ -554,12 +576,13 @@ public boolean equals(Object o) { Objects.equals(this.optimizePromptOptions, createImageGenerationRequest.optimizePromptOptions) && Objects.equals(this.tools, createImageGenerationRequest.tools) && Objects.equals(this.outputFormat, createImageGenerationRequest.outputFormat) && + Objects.equals(this.background, createImageGenerationRequest.background) && Objects.equals(this.layerDecomposition, createImageGenerationRequest.layerDecomposition); } @Override public int hashCode() { - return Objects.hash(model, prompt, image, stream, responseFormat, seed, guidanceScale, imageGuidanceScale, size, watermark, sequentialImageGeneration, sequentialImageGenerationOptions, optimizePromptOptions, tools, outputFormat, layerDecomposition); + return Objects.hash(model, prompt, image, stream, responseFormat, seed, guidanceScale, imageGuidanceScale, size, watermark, sequentialImageGeneration, sequentialImageGenerationOptions, optimizePromptOptions, tools, outputFormat, background, layerDecomposition); } @Override @@ -581,6 +604,7 @@ public String toString() { sb.append(" optimizePromptOptions: ").append(toIndentedString(optimizePromptOptions)).append("\n"); sb.append(" tools: ").append(toIndentedString(tools)).append("\n"); sb.append(" outputFormat: ").append(toIndentedString(outputFormat)).append("\n"); + sb.append(" background: ").append(toIndentedString(background)).append("\n"); sb.append(" layerDecomposition: ").append(toIndentedString(layerDecomposition)).append("\n"); sb.append("}"); return sb.toString(); @@ -614,7 +638,7 @@ public CreateImageGenerationRequest.Builder prompt(String prompt) { this.instance.prompt = prompt; return this; } - public CreateImageGenerationRequest.Builder image(List image) { + public CreateImageGenerationRequest.Builder image(CreateImageGenerationRequestImage image) { this.instance.image = image; return this; } @@ -666,6 +690,10 @@ public CreateImageGenerationRequest.Builder outputFormat(OutputFormat outputForm this.instance.outputFormat = outputFormat; return this; } + public CreateImageGenerationRequest.Builder background(Background background) { + this.instance.background = background; + return this; + } public CreateImageGenerationRequest.Builder layerDecomposition(Boolean layerDecomposition) { this.instance.layerDecomposition = layerDecomposition; return this; @@ -719,6 +747,7 @@ public CreateImageGenerationRequest.Builder toBuilder() { .optimizePromptOptions(getOptimizePromptOptions()) .tools(getTools()) .outputFormat(getOutputFormat()) + .background(getBackground()) .layerDecomposition(getLayerDecomposition()); } diff --git a/src/main/java/com/volcengine/ark/runtime/models/images/CreateImageGenerationRequestImage.java b/src/main/java/com/volcengine/ark/runtime/models/images/CreateImageGenerationRequestImage.java new file mode 100644 index 0000000..ddfb6ed --- /dev/null +++ b/src/main/java/com/volcengine/ark/runtime/models/images/CreateImageGenerationRequestImage.java @@ -0,0 +1,120 @@ +// Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. +// SPDX-License-Identifier: Apache-2.0 + +/* + * Ark Image Generation API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.volcengine.ark.runtime.models.images; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.io.IOException; +import java.util.Objects; + +/** + * CreateImageGenerationRequestImage + * + * Naked-union holder generated by gen/java/postprocess.py from the openapi + * anyOf schema (variants: String, java.util.List). + * + * The Jackson apache-httpclient template openapi-generator runs against + * does not support non-discriminated anyOf/oneOf — it either drops to a + * degenerate empty shell or flattens one variant's fields onto the class, + * losing the others. This postprocess rewrite replaces the parent with a + * @JsonValue holder + typed static factories for write-side, plus a custom + * @JsonDeserialize that dispatches by JsonNode shape on the read-side so + * round-trips preserve variant types (string -> typed primitive/enum, + * object -> typed model, array -> typed List). + */ +@JsonDeserialize(using = CreateImageGenerationRequestImage.Deserializer.class) +public class CreateImageGenerationRequestImage { + + private final Object value; + + @JsonCreator + public CreateImageGenerationRequestImage(Object value) { + this.value = value; + } + + public CreateImageGenerationRequestImage() { + this.value = null; + } + + public static CreateImageGenerationRequestImage ofString(String value) { + return new CreateImageGenerationRequestImage(value); + } + + public static CreateImageGenerationRequestImage ofList(java.util.List value) { + return new CreateImageGenerationRequestImage(value); + } + + @JsonValue + public Object getValue() { + return this.value; + } + + public static class Deserializer extends JsonDeserializer { + @Override + public CreateImageGenerationRequestImage deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + ObjectMapper mapper = (ObjectMapper) p.getCodec(); + JsonNode node = mapper.readTree(p); + if (node.isTextual()) { + return new CreateImageGenerationRequestImage(mapper.treeToValue(node, String.class)); + } + if (node.isArray()) { + return new CreateImageGenerationRequestImage( + mapper.convertValue(node, new com.fasterxml.jackson.core.type.TypeReference>() {})); + } + throw ctxt.weirdStringException( + node == null ? "null" : node.toString(), + CreateImageGenerationRequestImage.class, + "no CreateImageGenerationRequestImage variant matched JSON node shape"); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CreateImageGenerationRequestImage other = (CreateImageGenerationRequestImage) o; + return Objects.equals(this.value, other.value); + } + + @Override + public int hashCode() { + return Objects.hash(this.value); + } + + @Override + public String toString() { + return "class CreateImageGenerationRequestImage {" + Objects.toString(value) + "}"; + } + + public static class Builder { + private Object value; + public Builder() {} + public Builder value(Object value) { this.value = value; return this; } + public CreateImageGenerationRequestImage build() { return new CreateImageGenerationRequestImage(this.value); } + } + + public static CreateImageGenerationRequestImage.Builder builder() { return new CreateImageGenerationRequestImage.Builder(); } + + public CreateImageGenerationRequestImage.Builder toBuilder() { + return new CreateImageGenerationRequestImage.Builder().value(this.value); + } +} diff --git a/src/main/java/com/volcengine/ark/runtime/models/session/AgentWithUpgrades.java b/src/main/java/com/volcengine/ark/runtime/models/session/AgentWithUpgrades.java new file mode 100644 index 0000000..c9dff13 --- /dev/null +++ b/src/main/java/com/volcengine/ark/runtime/models/session/AgentWithUpgrades.java @@ -0,0 +1,557 @@ +// Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. +// SPDX-License-Identifier: Apache-2.0 + +/* + * Ark Managed Agents Session API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.volcengine.ark.runtime.models.session; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * Session upgrade 的目标 Agent 运行配置。 `id` 必须等于当前 Session 的 Agent ID —— upgrade 不支持换绑到另一个 Agent,不一致返回 403 `AgentMismatch`。 数组字段(`tools` / `mcp_servers` / `skills`)是**整组替换**语义:省略 表示保留原值,显式传 `[]` 表示清空。两者在 wire 上必须可区分,SDK 不能 把空数组优化成省略字段。 + */ +@JsonPropertyOrder({ + AgentWithUpgrades.JSON_PROPERTY_TYPE, + AgentWithUpgrades.JSON_PROPERTY_ID, + AgentWithUpgrades.JSON_PROPERTY_VERSION, + AgentWithUpgrades.JSON_PROPERTY_MODEL, + AgentWithUpgrades.JSON_PROPERTY_SYSTEM, + AgentWithUpgrades.JSON_PROPERTY_TOOLS, + AgentWithUpgrades.JSON_PROPERTY_MCP_SERVERS, + AgentWithUpgrades.JSON_PROPERTY_SKILLS, + AgentWithUpgrades.JSON_PROPERTY_MULTIAGENT, + AgentWithUpgrades.JSON_PROPERTY_DISPLAY_NAME +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0") +public class AgentWithUpgrades { + /** + * 固定 `\"agent_with_upgrades\"`。 + */ + public enum TypeEnum { + AGENT_WITH_UPGRADES(String.valueOf("agent_with_upgrades")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nonnull + private String id; + + public static final String JSON_PROPERTY_VERSION = "version"; + @javax.annotation.Nullable + private Integer version; + + public static final String JSON_PROPERTY_MODEL = "model"; + @javax.annotation.Nullable + private ModelUpgrades model; + + public static final String JSON_PROPERTY_SYSTEM = "system"; + @javax.annotation.Nullable + private String system; + + public static final String JSON_PROPERTY_TOOLS = "tools"; + @javax.annotation.Nullable + private List> tools; + + public static final String JSON_PROPERTY_MCP_SERVERS = "mcp_servers"; + @javax.annotation.Nullable + private List> mcpServers; + + public static final String JSON_PROPERTY_SKILLS = "skills"; + @javax.annotation.Nullable + private List> skills; + + public static final String JSON_PROPERTY_MULTIAGENT = "multiagent"; + @javax.annotation.Nullable + private Map multiagent; + + public static final String JSON_PROPERTY_DISPLAY_NAME = "display_name"; + @javax.annotation.Nullable + private String displayName; + + public AgentWithUpgrades() { + } + + public AgentWithUpgrades type(@javax.annotation.Nonnull TypeEnum type) { + + this.type = type; + return this; + } + + /** + * 固定 `\"agent_with_upgrades\"`。 + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + public AgentWithUpgrades id(@javax.annotation.Nonnull String id) { + + this.id = id; + return this; + } + + /** + * Agent ID;必须与当前 Session 的 Agent ID 一致。 + * @return id + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + public AgentWithUpgrades version(@javax.annotation.Nullable Integer version) { + + this.version = version; + return this; + } + + /** + * 目标 Agent 版本号。 省略或传 `0` 表示**不锁版本、沿用 Session 当前的 Agent 快照**(注意与创建 期不同:这里不是\"走最新版\")。传正整数则以该版本的 payload 为基线物化 ——`system` / `tools` / `mcp_servers` / `skills` / `multiagent` / `model` 整组跟着版本走,本次请求里的同名字段再叠加其上;版本不存在返回 404。 传负数返回 400。 + * @return version + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_VERSION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getVersion() { + return version; + } + + + @JsonProperty(value = JSON_PROPERTY_VERSION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setVersion(@javax.annotation.Nullable Integer version) { + this.version = version; + } + + public AgentWithUpgrades model(@javax.annotation.Nullable ModelUpgrades model) { + + this.model = model; + return this; + } + + /** + * 模型运行参数升级。 + * @return model + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MODEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ModelUpgrades getModel() { + return model; + } + + + @JsonProperty(value = JSON_PROPERTY_MODEL, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setModel(@javax.annotation.Nullable ModelUpgrades model) { + this.model = model; + } + + public AgentWithUpgrades system(@javax.annotation.Nullable String system) { + + this.system = system; + return this; + } + + /** + * System prompt。 + * @return system + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SYSTEM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSystem() { + return system; + } + + + @JsonProperty(value = JSON_PROPERTY_SYSTEM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSystem(@javax.annotation.Nullable String system) { + this.system = system; + } + + public AgentWithUpgrades tools(@javax.annotation.Nullable List> tools) { + + this.tools = tools; + return this; + } + + public AgentWithUpgrades addToolsItem(Map toolsItem) { + if (this.tools == null) { + this.tools = new ArrayList<>(); + } + this.tools.add(toolsItem); + return this; + } + + /** + * 工具配置(整组替换)。 + * @return tools + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TOOLS, required = false) + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + + public List> getTools() { + return tools; + } + + + @JsonProperty(value = JSON_PROPERTY_TOOLS, required = false) + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + public void setTools(@javax.annotation.Nullable List> tools) { + this.tools = tools; + } + + public AgentWithUpgrades mcpServers(@javax.annotation.Nullable List> mcpServers) { + + this.mcpServers = mcpServers; + return this; + } + + public AgentWithUpgrades addMcpServersItem(Map mcpServersItem) { + if (this.mcpServers == null) { + this.mcpServers = new ArrayList<>(); + } + this.mcpServers.add(mcpServersItem); + return this; + } + + /** + * MCP server 配置(整组替换)。 + * @return mcpServers + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MCP_SERVERS, required = false) + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + + public List> getMcpServers() { + return mcpServers; + } + + + @JsonProperty(value = JSON_PROPERTY_MCP_SERVERS, required = false) + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + public void setMcpServers(@javax.annotation.Nullable List> mcpServers) { + this.mcpServers = mcpServers; + } + + public AgentWithUpgrades skills(@javax.annotation.Nullable List> skills) { + + this.skills = skills; + return this; + } + + public AgentWithUpgrades addSkillsItem(Map skillsItem) { + if (this.skills == null) { + this.skills = new ArrayList<>(); + } + this.skills.add(skillsItem); + return this; + } + + /** + * Skill 配置(整组替换)。 + * @return skills + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SKILLS, required = false) + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + + public List> getSkills() { + return skills; + } + + + @JsonProperty(value = JSON_PROPERTY_SKILLS, required = false) + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + public void setSkills(@javax.annotation.Nullable List> skills) { + this.skills = skills; + } + + public AgentWithUpgrades multiagent(@javax.annotation.Nullable Map multiagent) { + + this.multiagent = multiagent; + return this; + } + + public AgentWithUpgrades putMultiagentItem(String key, Object multiagentItem) { + if (this.multiagent == null) { + this.multiagent = new HashMap<>(); + } + this.multiagent.put(key, multiagentItem); + return this; + } + + /** + * 多 Agent 配置。 + * @return multiagent + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MULTIAGENT, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.NON_EMPTY) + + public Map getMultiagent() { + return multiagent; + } + + + @JsonProperty(value = JSON_PROPERTY_MULTIAGENT, required = false) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.NON_EMPTY) + public void setMultiagent(@javax.annotation.Nullable Map multiagent) { + this.multiagent = multiagent; + } + + public AgentWithUpgrades displayName(@javax.annotation.Nullable String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * Agent 展示名。 + * @return displayName + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DISPLAY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getDisplayName() { + return displayName; + } + + + @JsonProperty(value = JSON_PROPERTY_DISPLAY_NAME, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDisplayName(@javax.annotation.Nullable String displayName) { + this.displayName = displayName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AgentWithUpgrades agentWithUpgrades = (AgentWithUpgrades) o; + return Objects.equals(this.type, agentWithUpgrades.type) && + Objects.equals(this.id, agentWithUpgrades.id) && + Objects.equals(this.version, agentWithUpgrades.version) && + Objects.equals(this.model, agentWithUpgrades.model) && + Objects.equals(this.system, agentWithUpgrades.system) && + Objects.equals(this.tools, agentWithUpgrades.tools) && + Objects.equals(this.mcpServers, agentWithUpgrades.mcpServers) && + Objects.equals(this.skills, agentWithUpgrades.skills) && + Objects.equals(this.multiagent, agentWithUpgrades.multiagent) && + Objects.equals(this.displayName, agentWithUpgrades.displayName); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, version, model, system, tools, mcpServers, skills, multiagent, displayName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentWithUpgrades {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" system: ").append(toIndentedString(system)).append("\n"); + sb.append(" tools: ").append(toIndentedString(tools)).append("\n"); + sb.append(" mcpServers: ").append(toIndentedString(mcpServers)).append("\n"); + sb.append(" skills: ").append(toIndentedString(skills)).append("\n"); + sb.append(" multiagent: ").append(toIndentedString(multiagent)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private AgentWithUpgrades instance; + + public Builder() { + this(new AgentWithUpgrades()); + } + + protected Builder(AgentWithUpgrades instance) { + this.instance = instance; + } + + public AgentWithUpgrades.Builder type(TypeEnum type) { + this.instance.type = type; + return this; + } + public AgentWithUpgrades.Builder id(String id) { + this.instance.id = id; + return this; + } + public AgentWithUpgrades.Builder version(Integer version) { + this.instance.version = version; + return this; + } + public AgentWithUpgrades.Builder model(ModelUpgrades model) { + this.instance.model = model; + return this; + } + public AgentWithUpgrades.Builder system(String system) { + this.instance.system = system; + return this; + } + public AgentWithUpgrades.Builder tools(List> tools) { + this.instance.tools = tools; + return this; + } + public AgentWithUpgrades.Builder mcpServers(List> mcpServers) { + this.instance.mcpServers = mcpServers; + return this; + } + public AgentWithUpgrades.Builder skills(List> skills) { + this.instance.skills = skills; + return this; + } + public AgentWithUpgrades.Builder multiagent(Map multiagent) { + this.instance.multiagent = multiagent; + return this; + } + public AgentWithUpgrades.Builder displayName(String displayName) { + this.instance.displayName = displayName; + return this; + } + + + /** + * returns a built AgentWithUpgrades instance. + * + * The builder is not reusable. + */ + public AgentWithUpgrades build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static AgentWithUpgrades.Builder builder() { + return new AgentWithUpgrades.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public AgentWithUpgrades.Builder toBuilder() { + return new AgentWithUpgrades.Builder() + .type(getType()) + .id(getId()) + .version(getVersion()) + .model(getModel()) + .system(getSystem()) + .tools(getTools()) + .mcpServers(getMcpServers()) + .skills(getSkills()) + .multiagent(getMultiagent()) + .displayName(getDisplayName()); + } + + +} diff --git a/src/main/java/com/volcengine/ark/runtime/models/session/CreateSessionUpgradeRequest.java b/src/main/java/com/volcengine/ark/runtime/models/session/CreateSessionUpgradeRequest.java new file mode 100644 index 0000000..6fafa1f --- /dev/null +++ b/src/main/java/com/volcengine/ark/runtime/models/session/CreateSessionUpgradeRequest.java @@ -0,0 +1,282 @@ +// Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. +// SPDX-License-Identifier: Apache-2.0 + +/* + * Ark Managed Agents Session API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.volcengine.ark.runtime.models.session; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * 发起一次已有 Session 的运行配置升级。 `agent` / `environment` / `vault_ids` 至少提供一个作为升级目标,全部省略 返回 400 `MissingUpgradeTarget`(只传 `initial_events` 不算升级目标)。 Session 必须处于 `idle` 且上一轮 turn 以 `end_turn` 收尾,否则返回 403 `SessionNotIdle` / `SessionNotEndTurn`;同一 Session 上一次升级尚未收敛时 返回 403 `UpgradeInProgress`。 + */ +@JsonPropertyOrder({ + CreateSessionUpgradeRequest.JSON_PROPERTY_AGENT, + CreateSessionUpgradeRequest.JSON_PROPERTY_ENVIRONMENT, + CreateSessionUpgradeRequest.JSON_PROPERTY_VAULT_IDS, + CreateSessionUpgradeRequest.JSON_PROPERTY_INITIAL_EVENTS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0") +public class CreateSessionUpgradeRequest { + public static final String JSON_PROPERTY_AGENT = "agent"; + @javax.annotation.Nullable + private AgentWithUpgrades agent; + + public static final String JSON_PROPERTY_ENVIRONMENT = "environment"; + @javax.annotation.Nullable + private EnvironmentWithUpgrades environment; + + public static final String JSON_PROPERTY_VAULT_IDS = "vault_ids"; + @javax.annotation.Nullable + private List vaultIds; + + public static final String JSON_PROPERTY_INITIAL_EVENTS = "initial_events"; + @javax.annotation.Nullable + private List initialEvents; + + public CreateSessionUpgradeRequest() { + } + + public CreateSessionUpgradeRequest agent(@javax.annotation.Nullable AgentWithUpgrades agent) { + + this.agent = agent; + return this; + } + + /** + * 目标 Agent 运行配置。 + * @return agent + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_AGENT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public AgentWithUpgrades getAgent() { + return agent; + } + + + @JsonProperty(value = JSON_PROPERTY_AGENT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setAgent(@javax.annotation.Nullable AgentWithUpgrades agent) { + this.agent = agent; + } + + public CreateSessionUpgradeRequest environment(@javax.annotation.Nullable EnvironmentWithUpgrades environment) { + + this.environment = environment; + return this; + } + + /** + * 目标 Environment 运行配置。 + * @return environment + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ENVIRONMENT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnvironmentWithUpgrades getEnvironment() { + return environment; + } + + + @JsonProperty(value = JSON_PROPERTY_ENVIRONMENT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setEnvironment(@javax.annotation.Nullable EnvironmentWithUpgrades environment) { + this.environment = environment; + } + + public CreateSessionUpgradeRequest vaultIds(@javax.annotation.Nullable List vaultIds) { + + this.vaultIds = vaultIds; + return this; + } + + public CreateSessionUpgradeRequest addVaultIdsItem(String vaultIdsItem) { + if (this.vaultIds == null) { + this.vaultIds = new ArrayList<>(); + } + this.vaultIds.add(vaultIdsItem); + return this; + } + + /** + * Session 绑定的 Vault 列表。 只能用来**刷新已绑定 Vault 的内容**,不能改变绑定集合:传入集合必须与 当前 Session 的 `vault_ids` 相等(忽略顺序与重复),否则返回 403 `VaultMismatch`。显式传 `[]` 表示声明空集,仅当当前 Session 本身没有 Vault 绑定时通过 —— 因此省略与 `[]` 在 wire 上必须可区分,SDK 不能把 空数组优化成省略字段。 + * @return vaultIds + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_VAULT_IDS, required = false) + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + + public List getVaultIds() { + return vaultIds; + } + + + @JsonProperty(value = JSON_PROPERTY_VAULT_IDS, required = false) + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + public void setVaultIds(@javax.annotation.Nullable List vaultIds) { + this.vaultIds = vaultIds; + } + + public CreateSessionUpgradeRequest initialEvents(@javax.annotation.Nullable List initialEvents) { + + this.initialEvents = initialEvents; + return this; + } + + public CreateSessionUpgradeRequest addInitialEventsItem(ManagedAgentsEventParams initialEventsItem) { + if (this.initialEvents == null) { + this.initialEvents = new ArrayList<>(); + } + this.initialEvents.add(initialEventsItem); + return this; + } + + /** + * 配置切换收敛后由服务端补投的事件。当前只接受**恰好一个** `user.message` 事件,且 content 为单个 text block、内容是 `/compact` 命令 XML;不满足 返回 400 `InvalidInitialEvents` / `InvalidCompactCommand`。省略或传 `[]` 表示本次不投递事件。 + * @return initialEvents + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_INITIAL_EVENTS, required = false) + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + + public List getInitialEvents() { + return initialEvents; + } + + + @JsonProperty(value = JSON_PROPERTY_INITIAL_EVENTS, required = false) + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + public void setInitialEvents(@javax.annotation.Nullable List initialEvents) { + this.initialEvents = initialEvents; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSessionUpgradeRequest createSessionUpgradeRequest = (CreateSessionUpgradeRequest) o; + return Objects.equals(this.agent, createSessionUpgradeRequest.agent) && + Objects.equals(this.environment, createSessionUpgradeRequest.environment) && + Objects.equals(this.vaultIds, createSessionUpgradeRequest.vaultIds) && + Objects.equals(this.initialEvents, createSessionUpgradeRequest.initialEvents); + } + + @Override + public int hashCode() { + return Objects.hash(agent, environment, vaultIds, initialEvents); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSessionUpgradeRequest {\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); + sb.append(" vaultIds: ").append(toIndentedString(vaultIds)).append("\n"); + sb.append(" initialEvents: ").append(toIndentedString(initialEvents)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private CreateSessionUpgradeRequest instance; + + public Builder() { + this(new CreateSessionUpgradeRequest()); + } + + protected Builder(CreateSessionUpgradeRequest instance) { + this.instance = instance; + } + + public CreateSessionUpgradeRequest.Builder agent(AgentWithUpgrades agent) { + this.instance.agent = agent; + return this; + } + public CreateSessionUpgradeRequest.Builder environment(EnvironmentWithUpgrades environment) { + this.instance.environment = environment; + return this; + } + public CreateSessionUpgradeRequest.Builder vaultIds(List vaultIds) { + this.instance.vaultIds = vaultIds; + return this; + } + public CreateSessionUpgradeRequest.Builder initialEvents(List initialEvents) { + this.instance.initialEvents = initialEvents; + return this; + } + + + /** + * returns a built CreateSessionUpgradeRequest instance. + * + * The builder is not reusable. + */ + public CreateSessionUpgradeRequest build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static CreateSessionUpgradeRequest.Builder builder() { + return new CreateSessionUpgradeRequest.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public CreateSessionUpgradeRequest.Builder toBuilder() { + return new CreateSessionUpgradeRequest.Builder() + .agent(getAgent()) + .environment(getEnvironment()) + .vaultIds(getVaultIds()) + .initialEvents(getInitialEvents()); + } + + +} diff --git a/src/main/java/com/volcengine/ark/runtime/models/session/EnvironmentWithUpgrades.java b/src/main/java/com/volcengine/ark/runtime/models/session/EnvironmentWithUpgrades.java new file mode 100644 index 0000000..2b2733c --- /dev/null +++ b/src/main/java/com/volcengine/ark/runtime/models/session/EnvironmentWithUpgrades.java @@ -0,0 +1,262 @@ +// Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. +// SPDX-License-Identifier: Apache-2.0 + +/* + * Ark Managed Agents Session API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.volcengine.ark.runtime.models.session; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; + +/** + * Session upgrade 的目标 Environment 运行配置。 `id` 必须等于当前 Session 的 Environment ID —— upgrade 不支持换绑到另一个 Environment,不一致返回 403 `EnvironmentMismatch`;`config.type` 也必须与 当前 Session 的环境类型一致(不支持 cloud ↔ self_hosted 互切),不一致 返回 403 `EnvironmentTypeMismatch`。 cloud 环境开放 `networking` / `packages` / `env` / `setup_script` 升级, 在当前 Sandbox 上原地生效,不更换 Sandbox 实例。self_hosted 沙箱由用户 自建,除 `config.type` 外不接受任何运行时字段(这类 Session 仍可升级 agent 并投递 `initial_events`);`tos` 一律拒绝,返回 400 `TosUpgradeNotSupported`。 + */ +@JsonPropertyOrder({ + EnvironmentWithUpgrades.JSON_PROPERTY_TYPE, + EnvironmentWithUpgrades.JSON_PROPERTY_ID, + EnvironmentWithUpgrades.JSON_PROPERTY_CONFIG +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0") +public class EnvironmentWithUpgrades { + /** + * 固定 `\"environment_with_upgrades\"`。 + */ + public enum TypeEnum { + ENVIRONMENT_WITH_UPGRADES(String.valueOf("environment_with_upgrades")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equalsIgnoreCase(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nonnull + private String id; + + public static final String JSON_PROPERTY_CONFIG = "config"; + @javax.annotation.Nullable + private EnvironmentConfigOverride config; + + public EnvironmentWithUpgrades() { + } + + public EnvironmentWithUpgrades type(@javax.annotation.Nonnull TypeEnum type) { + + this.type = type; + return this; + } + + /** + * 固定 `\"environment_with_upgrades\"`。 + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + public EnvironmentWithUpgrades id(@javax.annotation.Nonnull String id) { + + this.id = id; + return this; + } + + /** + * Environment ID;必须与当前 Session 的 Environment ID 一致。 + * @return id + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setId(@javax.annotation.Nonnull String id) { + this.id = id; + } + + public EnvironmentWithUpgrades config(@javax.annotation.Nullable EnvironmentConfigOverride config) { + + this.config = config; + return this; + } + + /** + * 运行时配置升级。 + * @return config + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CONFIG, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnvironmentConfigOverride getConfig() { + return config; + } + + + @JsonProperty(value = JSON_PROPERTY_CONFIG, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setConfig(@javax.annotation.Nullable EnvironmentConfigOverride config) { + this.config = config; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnvironmentWithUpgrades environmentWithUpgrades = (EnvironmentWithUpgrades) o; + return Objects.equals(this.type, environmentWithUpgrades.type) && + Objects.equals(this.id, environmentWithUpgrades.id) && + Objects.equals(this.config, environmentWithUpgrades.config); + } + + @Override + public int hashCode() { + return Objects.hash(type, id, config); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnvironmentWithUpgrades {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private EnvironmentWithUpgrades instance; + + public Builder() { + this(new EnvironmentWithUpgrades()); + } + + protected Builder(EnvironmentWithUpgrades instance) { + this.instance = instance; + } + + public EnvironmentWithUpgrades.Builder type(TypeEnum type) { + this.instance.type = type; + return this; + } + public EnvironmentWithUpgrades.Builder id(String id) { + this.instance.id = id; + return this; + } + public EnvironmentWithUpgrades.Builder config(EnvironmentConfigOverride config) { + this.instance.config = config; + return this; + } + + + /** + * returns a built EnvironmentWithUpgrades instance. + * + * The builder is not reusable. + */ + public EnvironmentWithUpgrades build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static EnvironmentWithUpgrades.Builder builder() { + return new EnvironmentWithUpgrades.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public EnvironmentWithUpgrades.Builder toBuilder() { + return new EnvironmentWithUpgrades.Builder() + .type(getType()) + .id(getId()) + .config(getConfig()); + } + + +} diff --git a/src/main/java/com/volcengine/ark/runtime/models/session/ModelOverrides.java b/src/main/java/com/volcengine/ark/runtime/models/session/ModelOverrides.java index 556744c..d14f1c5 100644 --- a/src/main/java/com/volcengine/ark/runtime/models/session/ModelOverrides.java +++ b/src/main/java/com/volcengine/ark/runtime/models/session/ModelOverrides.java @@ -22,15 +22,21 @@ import java.util.Objects; /** - * Session 创建时允许临时覆写的模型运行参数。 + * Session 创建时允许临时覆写的模型运行参数。 内部字段省略表示继承 base Agent 的对应值。 */ @JsonPropertyOrder({ + ModelOverrides.JSON_PROPERTY_ID, ModelOverrides.JSON_PROPERTY_SPEED, ModelOverrides.JSON_PROPERTY_THINKING, - ModelOverrides.JSON_PROPERTY_REASONING_EFFORT + ModelOverrides.JSON_PROPERTY_REASONING_EFFORT, + ModelOverrides.JSON_PROPERTY_SERVICE_TIER }) @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0") public class ModelOverrides { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private String id; + public static final String JSON_PROPERTY_SPEED = "speed"; @javax.annotation.Nullable private String speed; @@ -43,9 +49,38 @@ public class ModelOverrides { @javax.annotation.Nullable private String reasoningEffort; + public static final String JSON_PROPERTY_SERVICE_TIER = "service_tier"; + @javax.annotation.Nullable + private String serviceTier; + public ModelOverrides() { } + public ModelOverrides id(@javax.annotation.Nullable String id) { + + this.id = id; + return this; + } + + /** + * 模型 semantic 覆写,形如 `\"doubao-seed-2-0-pro-260215\"`;服务端按最右 侧一个 `-` 拆成 (name, version) 冻结进本 Session 的 Agent 快照,不回写 base Agent。解析失败返回 400,模型未开通返回 403 `ModelNotOpen`。 + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + public ModelOverrides speed(@javax.annotation.Nullable String speed) { this.speed = speed; @@ -121,6 +156,31 @@ public void setReasoningEffort(@javax.annotation.Nullable String reasoningEffort this.reasoningEffort = reasoningEffort; } + public ModelOverrides serviceTier(@javax.annotation.Nullable String serviceTier) { + + this.serviceTier = serviceTier; + return this; + } + + /** + * 服务档位。 + * @return serviceTier + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SERVICE_TIER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getServiceTier() { + return serviceTier; + } + + + @JsonProperty(value = JSON_PROPERTY_SERVICE_TIER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setServiceTier(@javax.annotation.Nullable String serviceTier) { + this.serviceTier = serviceTier; + } + @Override public boolean equals(Object o) { @@ -131,23 +191,27 @@ public boolean equals(Object o) { return false; } ModelOverrides modelOverrides = (ModelOverrides) o; - return Objects.equals(this.speed, modelOverrides.speed) && + return Objects.equals(this.id, modelOverrides.id) && + Objects.equals(this.speed, modelOverrides.speed) && Objects.equals(this.thinking, modelOverrides.thinking) && - Objects.equals(this.reasoningEffort, modelOverrides.reasoningEffort); + Objects.equals(this.reasoningEffort, modelOverrides.reasoningEffort) && + Objects.equals(this.serviceTier, modelOverrides.serviceTier); } @Override public int hashCode() { - return Objects.hash(speed, thinking, reasoningEffort); + return Objects.hash(id, speed, thinking, reasoningEffort, serviceTier); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ModelOverrides {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" speed: ").append(toIndentedString(speed)).append("\n"); sb.append(" thinking: ").append(toIndentedString(thinking)).append("\n"); sb.append(" reasoningEffort: ").append(toIndentedString(reasoningEffort)).append("\n"); + sb.append(" serviceTier: ").append(toIndentedString(serviceTier)).append("\n"); sb.append("}"); return sb.toString(); } @@ -172,6 +236,10 @@ protected Builder(ModelOverrides instance) { this.instance = instance; } + public ModelOverrides.Builder id(String id) { + this.instance.id = id; + return this; + } public ModelOverrides.Builder speed(String speed) { this.instance.speed = speed; return this; @@ -184,6 +252,10 @@ public ModelOverrides.Builder reasoningEffort(String reasoningEffort) { this.instance.reasoningEffort = reasoningEffort; return this; } + public ModelOverrides.Builder serviceTier(String serviceTier) { + this.instance.serviceTier = serviceTier; + return this; + } /** @@ -218,9 +290,11 @@ public static ModelOverrides.Builder builder() { */ public ModelOverrides.Builder toBuilder() { return new ModelOverrides.Builder() + .id(getId()) .speed(getSpeed()) .thinking(getThinking()) - .reasoningEffort(getReasoningEffort()); + .reasoningEffort(getReasoningEffort()) + .serviceTier(getServiceTier()); } diff --git a/src/main/java/com/volcengine/ark/runtime/models/session/ModelUpgrades.java b/src/main/java/com/volcengine/ark/runtime/models/session/ModelUpgrades.java new file mode 100644 index 0000000..a637c06 --- /dev/null +++ b/src/main/java/com/volcengine/ark/runtime/models/session/ModelUpgrades.java @@ -0,0 +1,301 @@ +// Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. +// SPDX-License-Identifier: Apache-2.0 + +/* + * Ark Managed Agents Session API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.volcengine.ark.runtime.models.session; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + +/** + * Session upgrade 中允许调整的模型配置子集。 与创建期的 `ModelOverrides` 的差别在于 `id`:upgrade 允许改模型身份, 服务端把它解析成完整 provider / protocol / endpoint 后冻结进 Session 的 Agent 快照。 + */ +@JsonPropertyOrder({ + ModelUpgrades.JSON_PROPERTY_ID, + ModelUpgrades.JSON_PROPERTY_SPEED, + ModelUpgrades.JSON_PROPERTY_THINKING, + ModelUpgrades.JSON_PROPERTY_REASONING_EFFORT, + ModelUpgrades.JSON_PROPERTY_SERVICE_TIER +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0") +public class ModelUpgrades { + public static final String JSON_PROPERTY_ID = "id"; + @javax.annotation.Nullable + private String id; + + public static final String JSON_PROPERTY_SPEED = "speed"; + @javax.annotation.Nullable + private String speed; + + public static final String JSON_PROPERTY_THINKING = "thinking"; + @javax.annotation.Nullable + private String thinking; + + public static final String JSON_PROPERTY_REASONING_EFFORT = "reasoning_effort"; + @javax.annotation.Nullable + private String reasoningEffort; + + public static final String JSON_PROPERTY_SERVICE_TIER = "service_tier"; + @javax.annotation.Nullable + private String serviceTier; + + public ModelUpgrades() { + } + + public ModelUpgrades id(@javax.annotation.Nullable String id) { + + this.id = id; + return this; + } + + /** + * 目标模型标识,形如 `\"doubao-seed-2-0-pro-260215\"`。 与创建期 `ModelOverrides.id` 的**解析路径不同**:此处服务端拿它当 endpoint 反查元数据来得到 (name, version),而不是按字符串拆分。因此 endpoint 不存在 / 已关闭 / 元信息缺失均返回 400;显式传空串也返回 400 (upgrade 不支持卸载底模)。模型未开通返回 403 `ModelNotOpen`;底模不支持 作为 Agent 使用返回 400。 换 `id` 时 `speed` / `thinking` / `reasoning_effort` / `service_tier` 会按 **新**底模重新校验取值:本次未显式提供的,沿用升级前的值参与校验,落在新 底模白名单外返回 400。 + * @return id + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@javax.annotation.Nullable String id) { + this.id = id; + } + + public ModelUpgrades speed(@javax.annotation.Nullable String speed) { + + this.speed = speed; + return this; + } + + /** + * 模型速度档位。 + * @return speed + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SPEED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getSpeed() { + return speed; + } + + + @JsonProperty(value = JSON_PROPERTY_SPEED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSpeed(@javax.annotation.Nullable String speed) { + this.speed = speed; + } + + public ModelUpgrades thinking(@javax.annotation.Nullable String thinking) { + + this.thinking = thinking; + return this; + } + + /** + * thinking 配置。 + * @return thinking + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_THINKING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getThinking() { + return thinking; + } + + + @JsonProperty(value = JSON_PROPERTY_THINKING, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setThinking(@javax.annotation.Nullable String thinking) { + this.thinking = thinking; + } + + public ModelUpgrades reasoningEffort(@javax.annotation.Nullable String reasoningEffort) { + + this.reasoningEffort = reasoningEffort; + return this; + } + + /** + * 推理努力程度。 + * @return reasoningEffort + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_REASONING_EFFORT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getReasoningEffort() { + return reasoningEffort; + } + + + @JsonProperty(value = JSON_PROPERTY_REASONING_EFFORT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReasoningEffort(@javax.annotation.Nullable String reasoningEffort) { + this.reasoningEffort = reasoningEffort; + } + + public ModelUpgrades serviceTier(@javax.annotation.Nullable String serviceTier) { + + this.serviceTier = serviceTier; + return this; + } + + /** + * 服务档位。 + * @return serviceTier + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SERVICE_TIER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getServiceTier() { + return serviceTier; + } + + + @JsonProperty(value = JSON_PROPERTY_SERVICE_TIER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setServiceTier(@javax.annotation.Nullable String serviceTier) { + this.serviceTier = serviceTier; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelUpgrades modelUpgrades = (ModelUpgrades) o; + return Objects.equals(this.id, modelUpgrades.id) && + Objects.equals(this.speed, modelUpgrades.speed) && + Objects.equals(this.thinking, modelUpgrades.thinking) && + Objects.equals(this.reasoningEffort, modelUpgrades.reasoningEffort) && + Objects.equals(this.serviceTier, modelUpgrades.serviceTier); + } + + @Override + public int hashCode() { + return Objects.hash(id, speed, thinking, reasoningEffort, serviceTier); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelUpgrades {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" speed: ").append(toIndentedString(speed)).append("\n"); + sb.append(" thinking: ").append(toIndentedString(thinking)).append("\n"); + sb.append(" reasoningEffort: ").append(toIndentedString(reasoningEffort)).append("\n"); + sb.append(" serviceTier: ").append(toIndentedString(serviceTier)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private ModelUpgrades instance; + + public Builder() { + this(new ModelUpgrades()); + } + + protected Builder(ModelUpgrades instance) { + this.instance = instance; + } + + public ModelUpgrades.Builder id(String id) { + this.instance.id = id; + return this; + } + public ModelUpgrades.Builder speed(String speed) { + this.instance.speed = speed; + return this; + } + public ModelUpgrades.Builder thinking(String thinking) { + this.instance.thinking = thinking; + return this; + } + public ModelUpgrades.Builder reasoningEffort(String reasoningEffort) { + this.instance.reasoningEffort = reasoningEffort; + return this; + } + public ModelUpgrades.Builder serviceTier(String serviceTier) { + this.instance.serviceTier = serviceTier; + return this; + } + + + /** + * returns a built ModelUpgrades instance. + * + * The builder is not reusable. + */ + public ModelUpgrades build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field. + */ + public static ModelUpgrades.Builder builder() { + return new ModelUpgrades.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public ModelUpgrades.Builder toBuilder() { + return new ModelUpgrades.Builder() + .id(getId()) + .speed(getSpeed()) + .thinking(getThinking()) + .reasoningEffort(getReasoningEffort()) + .serviceTier(getServiceTier()); + } + + +} diff --git a/src/main/java/com/volcengine/ark/runtime/models/session/SessionStatus.java b/src/main/java/com/volcengine/ark/runtime/models/session/SessionStatus.java index e886fc7..82d09a0 100644 --- a/src/main/java/com/volcengine/ark/runtime/models/session/SessionStatus.java +++ b/src/main/java/com/volcengine/ark/runtime/models/session/SessionStatus.java @@ -31,7 +31,13 @@ public enum SessionStatus { TERMINATED("terminated"), - RESCHEDULING("rescheduling"); + RESCHEDULING("rescheduling"), + + INITIALIZING("initializing"), + + FAILED("failed"), + + UPGRADING("upgrading"); private String value;