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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
EnvConfig.JSON_PROPERTY_PACKAGES,
EnvConfig.JSON_PROPERTY_ENV,
EnvConfig.JSON_PROPERTY_SETUP_SCRIPT,
EnvConfig.JSON_PROPERTY_ACTIVE_RECOVERY,
EnvConfig.JSON_PROPERTY_TOS
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0")
Expand All @@ -56,6 +57,10 @@ public class EnvConfig {
@javax.annotation.Nullable
private String setupScript;

public static final String JSON_PROPERTY_ACTIVE_RECOVERY = "active_recovery";
@javax.annotation.Nullable
private Boolean activeRecovery;

public static final String JSON_PROPERTY_TOS = "tos";
@javax.annotation.Nullable
private TosConfig tos;
Expand Down Expand Up @@ -196,6 +201,31 @@ public void setSetupScript(@javax.annotation.Nullable String setupScript) {
this.setupScript = setupScript;
}

public EnvConfig activeRecovery(@javax.annotation.Nullable Boolean activeRecovery) {

this.activeRecovery = activeRecovery;
return this;
}

/**
* 是否启用 Work 积极恢复;仅 self_hosted Environment 支持,省略时等同于 false。该配置 仅允许在 Environment 级设置,不允许通过 Session override/upgrade 覆盖。开启后,平台在 Work 已 stopped、仍有未闭合 agent.tool_use 且 recovery_count 少于 5 次时将 Work 重新排队, 不按 stop_reason 排除。只有 Worker 上报 completed 且全部 tool_use 已闭合后才会清零计数。
* @return activeRecovery
*/
@javax.annotation.Nullable
@JsonProperty(value = JSON_PROPERTY_ACTIVE_RECOVERY, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Boolean getActiveRecovery() {
return activeRecovery;
}


@JsonProperty(value = JSON_PROPERTY_ACTIVE_RECOVERY, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setActiveRecovery(@javax.annotation.Nullable Boolean activeRecovery) {
this.activeRecovery = activeRecovery;
}

public EnvConfig tos(@javax.annotation.Nullable TosConfig tos) {

this.tos = tos;
Expand Down Expand Up @@ -236,12 +266,13 @@ public boolean equals(Object o) {
Objects.equals(this.packages, envConfig.packages) &&
Objects.equals(this.env, envConfig.env) &&
Objects.equals(this.setupScript, envConfig.setupScript) &&
Objects.equals(this.activeRecovery, envConfig.activeRecovery) &&
Objects.equals(this.tos, envConfig.tos);
}

@Override
public int hashCode() {
return Objects.hash(type, networking, packages, env, setupScript, tos);
return Objects.hash(type, networking, packages, env, setupScript, activeRecovery, tos);
}

@Override
Expand All @@ -253,6 +284,7 @@ public String toString() {
sb.append(" packages: ").append(toIndentedString(packages)).append("\n");
sb.append(" env: ").append(toIndentedString(env)).append("\n");
sb.append(" setupScript: ").append(toIndentedString(setupScript)).append("\n");
sb.append(" activeRecovery: ").append(toIndentedString(activeRecovery)).append("\n");
sb.append(" tos: ").append(toIndentedString(tos)).append("\n");
sb.append("}");
return sb.toString();
Expand Down Expand Up @@ -298,6 +330,10 @@ public EnvConfig.Builder setupScript(String setupScript) {
this.instance.setupScript = setupScript;
return this;
}
public EnvConfig.Builder activeRecovery(Boolean activeRecovery) {
this.instance.activeRecovery = activeRecovery;
return this;
}
public EnvConfig.Builder tos(TosConfig tos) {
this.instance.tos = tos;
return this;
Expand Down Expand Up @@ -341,6 +377,7 @@ public EnvConfig.Builder toBuilder() {
.packages(getPackages())
.env(getEnv())
.setupScript(getSetupScript())
.activeRecovery(getActiveRecovery())
.tos(getTos());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
EnvironmentWorkPoll200Response.JSON_PROPERTY_STATE,
EnvironmentWorkPoll200Response.JSON_PROPERTY_STOP_REQUESTED_AT,
EnvironmentWorkPoll200Response.JSON_PROPERTY_STOPPED_AT,
EnvironmentWorkPoll200Response.JSON_PROPERTY_STOP_REASON,
EnvironmentWorkPoll200Response.JSON_PROPERTY_RECOVERY_COUNT,
EnvironmentWorkPoll200Response.JSON_PROPERTY_TYPE
})
@JsonTypeName("EnvironmentWork_poll_200_response")
Expand Down Expand Up @@ -95,6 +97,14 @@ public class EnvironmentWorkPoll200Response {
@javax.annotation.Nullable
private String stoppedAt;

public static final String JSON_PROPERTY_STOP_REASON = "stop_reason";
@javax.annotation.Nullable
private WorkStopReason stopReason;

public static final String JSON_PROPERTY_RECOVERY_COUNT = "recovery_count";
@javax.annotation.Nullable
private Integer recoveryCount;

/**
* 对象类型,固定为 `work`。
*/
Expand Down Expand Up @@ -443,6 +453,56 @@ public void setStoppedAt(@javax.annotation.Nullable String stoppedAt) {
this.stoppedAt = stoppedAt;
}

public EnvironmentWorkPoll200Response stopReason(@javax.annotation.Nullable WorkStopReason stopReason) {

this.stopReason = stopReason;
return this;
}

/**
* 最近一次停止原因。首次停止前省略;state 为 stopping / stopped 时返回本次停止原因; 自动恢复到 queued / starting / active 后仍保留上一次停止原因,当前生命周期状态以 `state` 为准。
* @return stopReason
*/
@javax.annotation.Nullable
@JsonProperty(value = JSON_PROPERTY_STOP_REASON, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public WorkStopReason getStopReason() {
return stopReason;
}


@JsonProperty(value = JSON_PROPERTY_STOP_REASON, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setStopReason(@javax.annotation.Nullable WorkStopReason stopReason) {
this.stopReason = stopReason;
}

public EnvironmentWorkPoll200Response recoveryCount(@javax.annotation.Nullable Integer recoveryCount) {

this.recoveryCount = recoveryCount;
return this;
}

/**
* 自上次成功完成且全部 tool_use 已闭合后,平台已自动将本 Work 重新排队的次数; 首次执行或字段省略时按 0 处理。手动 Ensure 不会清零该计数。
* @return recoveryCount
*/
@javax.annotation.Nullable
@JsonProperty(value = JSON_PROPERTY_RECOVERY_COUNT, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Integer getRecoveryCount() {
return recoveryCount;
}


@JsonProperty(value = JSON_PROPERTY_RECOVERY_COUNT, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setRecoveryCount(@javax.annotation.Nullable Integer recoveryCount) {
this.recoveryCount = recoveryCount;
}

public EnvironmentWorkPoll200Response type(@javax.annotation.Nonnull TypeEnum type) {

this.type = type;
Expand Down Expand Up @@ -490,12 +550,14 @@ public boolean equals(Object o) {
Objects.equals(this.state, environmentWorkPoll200Response.state) &&
Objects.equals(this.stopRequestedAt, environmentWorkPoll200Response.stopRequestedAt) &&
Objects.equals(this.stoppedAt, environmentWorkPoll200Response.stoppedAt) &&
Objects.equals(this.stopReason, environmentWorkPoll200Response.stopReason) &&
Objects.equals(this.recoveryCount, environmentWorkPoll200Response.recoveryCount) &&
Objects.equals(this.type, environmentWorkPoll200Response.type);
}

@Override
public int hashCode() {
return Objects.hash(id, acknowledgedAt, createdAt, data, environmentId, latestHeartbeatAt, tags, secret, startedAt, state, stopRequestedAt, stoppedAt, type);
return Objects.hash(id, acknowledgedAt, createdAt, data, environmentId, latestHeartbeatAt, tags, secret, startedAt, state, stopRequestedAt, stoppedAt, stopReason, recoveryCount, type);
}

@Override
Expand All @@ -514,6 +576,8 @@ public String toString() {
sb.append(" state: ").append(toIndentedString(state)).append("\n");
sb.append(" stopRequestedAt: ").append(toIndentedString(stopRequestedAt)).append("\n");
sb.append(" stoppedAt: ").append(toIndentedString(stoppedAt)).append("\n");
sb.append(" stopReason: ").append(toIndentedString(stopReason)).append("\n");
sb.append(" recoveryCount: ").append(toIndentedString(recoveryCount)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append("}");
return sb.toString();
Expand Down Expand Up @@ -587,6 +651,14 @@ public EnvironmentWorkPoll200Response.Builder stoppedAt(String stoppedAt) {
this.instance.stoppedAt = stoppedAt;
return this;
}
public EnvironmentWorkPoll200Response.Builder stopReason(WorkStopReason stopReason) {
this.instance.stopReason = stopReason;
return this;
}
public EnvironmentWorkPoll200Response.Builder recoveryCount(Integer recoveryCount) {
this.instance.recoveryCount = recoveryCount;
return this;
}
public EnvironmentWorkPoll200Response.Builder type(TypeEnum type) {
this.instance.type = type;
return this;
Expand Down Expand Up @@ -637,6 +709,8 @@ public EnvironmentWorkPoll200Response.Builder toBuilder() {
.state(getState())
.stopRequestedAt(getStopRequestedAt())
.stoppedAt(getStoppedAt())
.stopReason(getStopReason())
.recoveryCount(getRecoveryCount())
.type(getType());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@
* Stop work 的请求体。
*/
@JsonPropertyOrder({
StopWorkBody.JSON_PROPERTY_FORCE
StopWorkBody.JSON_PROPERTY_FORCE,
StopWorkBody.JSON_PROPERTY_REASON
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.21.0")
public class StopWorkBody {
public static final String JSON_PROPERTY_FORCE = "force";
@javax.annotation.Nullable
private Boolean force;

public static final String JSON_PROPERTY_REASON = "reason";
@javax.annotation.Nullable
private WorkStopReason reason;

public StopWorkBody() {
}

Expand Down Expand Up @@ -61,6 +66,31 @@ public void setForce(@javax.annotation.Nullable Boolean force) {
this.force = force;
}

public StopWorkBody reason(@javax.annotation.Nullable WorkStopReason reason) {

this.reason = reason;
return this;
}

/**
* 强制停止原因;仅允许与 `force=true` 一起提交,省略时按 `others` 记录。 Worker 正常完成时传 `completed`,异常退出时传 `worker_abnormal`;用户或管理员操作分别传 `user_cancelled` 或 `admin_stopped`,无法归类时传 `others`。`lease_expired` 仅由平台在租约 过期时写入,不应通过 StopWork 上报。该字段用于停止诊断,并在 Worker 上报 `completed` 且全部 tool_use 已闭合时作为清零恢复次数的信号;平台不会按停止原因排除积极恢复。
* @return reason
*/
@javax.annotation.Nullable
@JsonProperty(value = JSON_PROPERTY_REASON, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public WorkStopReason getReason() {
return reason;
}


@JsonProperty(value = JSON_PROPERTY_REASON, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setReason(@javax.annotation.Nullable WorkStopReason reason) {
this.reason = reason;
}


@Override
public boolean equals(Object o) {
Expand All @@ -71,19 +101,21 @@ public boolean equals(Object o) {
return false;
}
StopWorkBody stopWorkBody = (StopWorkBody) o;
return Objects.equals(this.force, stopWorkBody.force);
return Objects.equals(this.force, stopWorkBody.force) &&
Objects.equals(this.reason, stopWorkBody.reason);
}

@Override
public int hashCode() {
return Objects.hash(force);
return Objects.hash(force, reason);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StopWorkBody {\n");
sb.append(" force: ").append(toIndentedString(force)).append("\n");
sb.append(" reason: ").append(toIndentedString(reason)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down Expand Up @@ -112,6 +144,10 @@ public StopWorkBody.Builder force(Boolean force) {
this.instance.force = force;
return this;
}
public StopWorkBody.Builder reason(WorkStopReason reason) {
this.instance.reason = reason;
return this;
}


/**
Expand Down Expand Up @@ -146,7 +182,8 @@ public static StopWorkBody.Builder builder() {
*/
public StopWorkBody.Builder toBuilder() {
return new StopWorkBody.Builder()
.force(getForce());
.force(getForce())
.reason(getReason());
}


Expand Down
Loading
Loading