From 0a992f8e28f4cd71abe0698eb6e424000580e14c Mon Sep 17 00:00:00 2001 From: ysyneu Date: Fri, 23 Oct 2026 02:19:35 -0700 Subject: [PATCH] feat(automations): add war room trigger fields to automation rule models --- automations_models.go | 6 +++++ models_gen.go | 14 +++++++++++ openapi/openapi.en.json | 54 +++++++++++++++++++++++++++++++++++++++++ openapi/openapi.zh.json | 54 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+) diff --git a/automations_models.go b/automations_models.go index d47d082..b243bb3 100644 --- a/automations_models.go +++ b/automations_models.go @@ -35,4 +35,10 @@ type AutomationRuleUpdateRequest struct { OncallIncidentChannelIDs *[]int64 `json:"oncall_incident_channel_ids,omitempty" toon:"oncall_incident_channel_ids,omitempty"` // Incident severities that can trigger this rule. OncallIncidentSeverities *[]string `json:"oncall_incident_severities,omitempty" toon:"oncall_incident_severities,omitempty"` + // Whether the AI SRE war room trigger is enabled. Sending true creates it when missing and channel/severity filters are provided. + WarRoomTriggerEnabled *bool `json:"war_room_trigger_enabled,omitempty" toon:"war_room_trigger_enabled,omitempty"` + // Channel (collaboration space) IDs whose new AI SRE war rooms can trigger this rule. + WarRoomChannelIDs *[]int64 `json:"war_room_channel_ids,omitempty" toon:"war_room_channel_ids,omitempty"` + // War room severities that can trigger this rule. + WarRoomSeverities *[]string `json:"war_room_severities,omitempty" toon:"war_room_severities,omitempty"` } diff --git a/models_gen.go b/models_gen.go index 67a8dcf..89423b8 100644 --- a/models_gen.go +++ b/models_gen.go @@ -1452,6 +1452,12 @@ type AutomationRuleCreateRequest struct { TeamID *int64 `json:"team_id,omitempty" toon:"team_id,omitempty"` // IANA timezone `cron_expr` is evaluated in, e.g. `Asia/Shanghai`. Must be a timezone name loadable by the server; an invalid value is rejected. Defaults to the caller's member timezone, then the account timezone, then the server default (Asia/Shanghai) when omitted. Timezone string `json:"timezone,omitempty" toon:"timezone,omitempty"` + // Channel IDs whose war rooms start a run. Each ID must be positive. + WarRoomChannelIDs []int64 `json:"war_room_channel_ids,omitempty" toon:"war_room_channel_ids,omitempty"` + // Incident severities that start a run when their war room is created: `Critical` (most severe), `Warning`, or `Info` (least severe) — the On-call incident severity levels. + WarRoomSeverities []string `json:"war_room_severities,omitempty" toon:"war_room_severities,omitempty"` + // Whether the war room trigger is enabled. It fires when a war room (IM group chat) is created for an incident in one of `war_room_channel_ids` with a severity in `war_room_severities`; the agent then runs inside that group chat. When the trigger is created (this is `true`, or `war_room_channel_ids` is sent), both lists must be non-empty. + WarRoomTriggerEnabled bool `json:"war_room_trigger_enabled,omitempty" toon:"war_room_trigger_enabled,omitempty"` } // AutomationRuleIDRequest is generated from the Flashduty OpenAPI schema. @@ -1517,6 +1523,14 @@ type AutomationRuleItem struct { Timezone string `json:"timezone" toon:"timezone"` // Last update time, Unix milliseconds. UpdatedAt TimestampMilli `json:"updated_at" toon:"updated_at"` + // Channel IDs whose war rooms start a run. Omitted when the rule has no war room trigger. + WarRoomChannelIDs []int64 `json:"war_room_channel_ids" toon:"war_room_channel_ids"` + // Incident severities whose war rooms start a run: `Critical` (most severe), `Warning`, or `Info` (least severe) — the On-call incident severity levels. Omitted when the rule has no war room trigger. + WarRoomSeverities []string `json:"war_room_severities" toon:"war_room_severities"` + // Whether the war room trigger is enabled. + WarRoomTriggerEnabled bool `json:"war_room_trigger_enabled" toon:"war_room_trigger_enabled"` + // War room trigger ID. Omitted when the rule has no war room trigger. + WarRoomTriggerID string `json:"war_room_trigger_id" toon:"war_room_trigger_id"` } // AutomationRuleListRequest is generated from the Flashduty OpenAPI schema. diff --git a/openapi/openapi.en.json b/openapi/openapi.en.json index c9600cf..34eb8cb 100644 --- a/openapi/openapi.en.json +++ b/openapi/openapi.en.json @@ -3311,6 +3311,31 @@ "timezone": { "description": "IANA timezone `cron_expr` is evaluated in, e.g. `Asia/Shanghai`. Must be a timezone name loadable by the server; an invalid value is rejected. Defaults to the caller's member timezone, then the account timezone, then the server default (Asia/Shanghai) when omitted.", "type": "string" + }, + "war_room_trigger_enabled": { + "type": "boolean", + "description": "Whether the war room trigger is enabled. It fires when a war room (IM group chat) is created for an incident in one of `war_room_channel_ids` with a severity in `war_room_severities`; the agent then runs inside that group chat. When the trigger is created (this is `true`, or `war_room_channel_ids` is sent), both lists must be non-empty." + }, + "war_room_channel_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int64", + "minimum": 1 + }, + "description": "Channel IDs whose war rooms start a run. Each ID must be positive." + }, + "war_room_severities": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "Critical", + "Warning", + "Info" + ] + }, + "description": "Incident severities that start a run when their war room is created: `Critical` (most severe), `Warning`, or `Info` (least severe) — the On-call incident severity levels." } }, "required": [ @@ -3526,6 +3551,35 @@ "description": "Last update time, Unix milliseconds.", "format": "int64", "type": "integer" + }, + "war_room_trigger_id": { + "type": "string", + "description": "War room trigger ID. Omitted when the rule has no war room trigger." + }, + "war_room_trigger_enabled": { + "type": "boolean", + "description": "Whether the war room trigger is enabled." + }, + "war_room_channel_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int64", + "minimum": 1 + }, + "description": "Channel IDs whose war rooms start a run. Omitted when the rule has no war room trigger." + }, + "war_room_severities": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "Critical", + "Warning", + "Info" + ] + }, + "description": "Incident severities whose war rooms start a run: `Critical` (most severe), `Warning`, or `Info` (least severe) — the On-call incident severity levels. Omitted when the rule has no war room trigger." } }, "required": [ diff --git a/openapi/openapi.zh.json b/openapi/openapi.zh.json index 690726b..7401c4e 100644 --- a/openapi/openapi.zh.json +++ b/openapi/openapi.zh.json @@ -3311,6 +3311,31 @@ "timezone": { "description": "`cron_expr` 计算所用的 IANA 时区,例如 `Asia/Shanghai`。必须是服务端可加载的合法时区名,非法值会被拒绝。省略时依次回退到调用者的成员时区、账户时区,最后是服务端默认时区(Asia/Shanghai)。", "type": "string" + }, + "war_room_trigger_enabled": { + "type": "boolean", + "description": "是否启用作战室触发器。当 `war_room_channel_ids` 中某个协作空间的故障(严重程度在 `war_room_severities` 中)创建作战室(IM 群聊)时触发,Agent 会直接在该群聊中运行。创建该触发器时(本字段为 `true`,或传了 `war_room_channel_ids`),两个列表都必须非空。" + }, + "war_room_channel_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int64", + "minimum": 1 + }, + "description": "创建作战室时会发起运行的协作空间 ID。每个 ID 必须为正数。" + }, + "war_room_severities": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "Critical", + "Warning", + "Info" + ] + }, + "description": "故障创建作战室时会发起运行的严重程度:`Critical`(最严重)、`Warning` 或 `Info`(最轻)——即 On-call 故障的严重程度。" } }, "required": [ @@ -3526,6 +3551,35 @@ "description": "更新时间,Unix 毫秒。", "format": "int64", "type": "integer" + }, + "war_room_trigger_id": { + "type": "string", + "description": "作战室触发器 ID。规则没有作战室触发器时省略。" + }, + "war_room_trigger_enabled": { + "type": "boolean", + "description": "作战室触发器是否启用。" + }, + "war_room_channel_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "int64", + "minimum": 1 + }, + "description": "创建作战室时会发起运行的协作空间 ID。规则没有作战室触发器时省略。" + }, + "war_room_severities": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "Critical", + "Warning", + "Info" + ] + }, + "description": "创建作战室时会发起运行的严重程度:`Critical`(最严重)、`Warning` 或 `Info`(最轻)——即 On-call 故障的严重程度。规则没有作战室触发器时省略。" } }, "required": [