diff --git a/go.mod b/go.mod index 8d260b6..8220e8a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/flashcatcloud/flashduty-cli go 1.26.0 require ( - github.com/flashcatcloud/go-flashduty v0.15.18-0.20261015103612-f84d9ddaca1a + github.com/flashcatcloud/go-flashduty v0.15.18-0.20261016025836-93c9482173b5 github.com/mattn/go-runewidth v0.0.30 github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 diff --git a/go.sum b/go.sum index c952806..6b580fa 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,10 @@ github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY= github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/flashcatcloud/go-flashduty v0.15.18-0.20261015103612-f84d9ddaca1a h1:+oqnFVWaZlC7yGMu+wl0QpBwEOGdOG+a6hFagXSHYuM= -github.com/flashcatcloud/go-flashduty v0.15.18-0.20261015103612-f84d9ddaca1a/go.mod h1:YpHiTYXR5NXBI/rGRZfUy537XMkhdCkwA8NW1QoRHwk= +github.com/flashcatcloud/go-flashduty v0.15.17-0.20261014102327-2f2d5497df53 h1:v6tVZmttBD67/gcdQym1SmY1TavYXd95WU3AQAog9VQ= +github.com/flashcatcloud/go-flashduty v0.15.17-0.20261014102327-2f2d5497df53/go.mod h1:YpHiTYXR5NXBI/rGRZfUy537XMkhdCkwA8NW1QoRHwk= +github.com/flashcatcloud/go-flashduty v0.15.18-0.20261016025836-93c9482173b5 h1:e5ApVt+44vsgUvakvkDn51tjIBC53hRqHiw863O9iTw= +github.com/flashcatcloud/go-flashduty v0.15.18-0.20261016025836-93c9482173b5/go.mod h1:YpHiTYXR5NXBI/rGRZfUy537XMkhdCkwA8NW1QoRHwk= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/mattn/go-runewidth v0.0.30 h1:+KUuiDA4fF0R1p5FeueHefjDm+GIM+kWfFnDjybOPgk= diff --git a/internal/cli/automation.go b/internal/cli/automation.go index 27925c3..b7d8178 100644 --- a/internal/cli/automation.go +++ b/internal/cli/automation.go @@ -49,6 +49,7 @@ func newAutomationCreateCmd() *cobra.Command { promptFile string environmentKind string environmentID string + runIn string timezone string ) @@ -58,8 +59,21 @@ func newAutomationCreateCmd() *cobra.Command { Long: curatedLong(`Create an AI SRE Automation. By default the rule is enabled. Use --disabled only when the user explicitly -asks to create it disabled. team_id=0 means personal scope; --team-id >0 creates -the rule under that team. The scope is immutable after creation. +asks to create it disabled. Omit --team-id to let the server inherit the live +IM conversation scope when available; --team-id 0 explicitly selects personal +scope and --team-id >0 selects that team. The scope is immutable after creation. + + When this command is invoked from a live IM conversation, omitting --run-in +lets the server bind the Automation to that current chat. Use --run-in web to +run it in the web console instead. Do not supply chat, platform, integration, +or session identifiers: the server resolves and authorizes the current chat. + Each ordinary current-chat run starts a fresh execution session and, where the + IM integration creates threads, a fresh IM thread. It remains bound to the + original chat and its immutable scope, rather than an old session or thread. + Write the task prompt with the needed chat context; do not refer to an earlier + session or say "above". A retry of the same run reuses that run's execution + identity. If the bound chat's scope no longer matches the rule, the run is + skipped. War-room Automations keep their existing behavior. Schedule helpers build a 5-field cron expression evaluated in the rule's timezone. Pass --timezone when the user names one. When --timezone is @@ -67,6 +81,9 @@ the rule under that team. The scope is immutable after creation. then the account timezone, then Asia/Shanghai. Do not send a timezone default from the CLI. Pass the user's local wall-clock time to --at or --cron-expr; do not convert it to UTC first. + Custom cron uses five fields, but its minute must be one fixed integer from + 0 through 59. The fastest supported schedule is once per hour; minute + wildcards, ranges, lists, and steps are unsupported. For HTTP POST-only rules, pass --http-post-trigger without a schedule; the CLI sends a valid placeholder cron and disables the schedule trigger.`, "Automations", "RuleWriteCreate"), @@ -86,6 +103,12 @@ the rule under that team. The scope is immutable after creation. if strings.TrimSpace(taskPrompt) == "" { return fmt.Errorf("one of --prompt or --prompt-file is required") } + if cmd.Flags().Changed("run-in") { + runIn = strings.TrimSpace(runIn) + if runIn != "current-chat" && runIn != "web" { + return fmt.Errorf("--run-in must be current-chat or web") + } + } effectiveScheduleEnabled := scheduleEnabled cron, err := resolveAutomationCreateCron(cmd, schedule, at, weekday, cronExpr, httpPostTrigger, &effectiveScheduleEnabled) @@ -95,7 +118,6 @@ the rule under that team. The scope is immutable after creation. req := &flashduty.AutomationRuleCreateRequest{ Name: name, - TeamID: teamID, CronExpr: cron, Enabled: !disabled, ScheduleTriggerEnabled: flashduty.Bool(effectiveScheduleEnabled), @@ -104,6 +126,12 @@ the rule under that team. The scope is immutable after creation. EnvironmentKind: strings.TrimSpace(environmentKind), EnvironmentID: strings.TrimSpace(environmentID), } + if cmd.Flags().Changed("team-id") { + req.TeamID = flashduty.Int64(teamID) + } + if cmd.Flags().Changed("run-in") { + req.RunIn = flashduty.String(runIn) + } if cmd.Flags().Changed("timezone") { req.Timezone = strings.TrimSpace(timezone) } @@ -117,21 +145,23 @@ the rule under that team. The scope is immutable after creation. } cmd.Flags().StringVar(&name, "name", "", "Automation name") - cmd.Flags().Int64Var(&teamID, "team-id", 0, "Scope team ID; 0 means personal scope") + cmd.Flags().Int64Var(&teamID, "team-id", 0, "Scope team ID; omit to inherit IM scope when available, or pass 0 for personal scope") + cmd.Flags().StringVar(&runIn, "run-in", "", "Execution destination: current-chat or web; omit for the server default") cmd.Flags().StringVar(&schedule, "schedule", "", "Schedule helper: hourly, daily, weekly, or cron") cmd.Flags().StringVar(&at, "at", "", "Local time in HH:MM (rule's timezone); for hourly schedules, only the minute is used. "+automationTimezoneNote) cmd.Flags().StringVar(&weekday, "weekday", "", "Weekday for weekly schedules: sun, mon, tue, wed, thu, fri, sat, or 0-7") - cmd.Flags().StringVar(&cronExpr, "cron-expr", "", "Exact 5-field cron expression in the rule's timezone; overrides --schedule helpers. "+automationTimezoneNote) + cmd.Flags().StringVar(&cronExpr, "cron-expr", "", "Supported 5-field cron expression in the rule's timezone. The minute must be a fixed 0-59 integer, so the fastest schedule is hourly; overrides --schedule helpers. "+automationTimezoneNote) cmd.Flags().StringVar(&timezone, "timezone", "", "IANA timezone name cron_expr is evaluated in, for example Asia/Shanghai. The server must be able to load it; an invalid value is rejected. Omit to use the caller's member timezone, then the account timezone, then Asia/Shanghai.") cmd.Flags().BoolVar(&disabled, "disabled", false, "Create the Automation disabled") cmd.Flags().BoolVar(&scheduleEnabled, "schedule-enabled", true, "Whether the schedule trigger is enabled") cmd.Flags().BoolVar(&httpPostTrigger, "http-post-trigger", false, "Create and enable an HTTP POST trigger") - cmd.Flags().StringVar(&prompt, "prompt", "", "Task prompt sent to the AI SRE agent") + cmd.Flags().StringVar(&prompt, "prompt", "", "Self-contained task prompt for the fresh AI SRE execution; include needed chat context and do not refer to earlier messages or 'above'") cmd.Flags().StringVar(&promptFile, "prompt-file", "", "Read task prompt from a file, or - for stdin") cmd.Flags().StringVar(&environmentKind, "environment-kind", "", "Runtime environment kind: cloud or byoc; empty means automatic") cmd.Flags().StringVar(&environmentID, "environment-id", "", "BYOC Runner ID when --environment-kind=byoc") registerEnumFlag(cmd, "schedule", "hourly", "daily", "weekly", "cron") registerEnumFlag(cmd, "environment-kind", "cloud", "byoc") + registerEnumFlag(cmd, "run-in", "current-chat", "web") return cmd } @@ -336,7 +366,7 @@ func newAutomationUpdateCmd() *cobra.Command { cmd.Flags().StringVar(&schedule, "schedule", "", "Schedule helper: hourly, daily, weekly, or cron") cmd.Flags().StringVar(&at, "at", "", "Local time in HH:MM (rule's timezone); for hourly schedules, only the minute is used. "+automationTimezoneNote) cmd.Flags().StringVar(&weekday, "weekday", "", "Weekday for weekly schedules: sun, mon, tue, wed, thu, fri, sat, or 0-7") - cmd.Flags().StringVar(&cronExpr, "cron-expr", "", "Exact 5-field cron expression in the rule's timezone; overrides --schedule helpers. "+automationTimezoneNote) + cmd.Flags().StringVar(&cronExpr, "cron-expr", "", "Supported 5-field cron expression in the rule's timezone. The minute must be a fixed 0-59 integer, so the fastest schedule is hourly; overrides --schedule helpers. "+automationTimezoneNote) cmd.Flags().StringVar(&timezone, "timezone", "", "IANA timezone name cron_expr is evaluated in. The server must be able to load it; an invalid value is rejected. Omit to leave the stored timezone unchanged, including a legacy empty string. An explicit empty string is stored as UTC, not the account default.") cmd.Flags().BoolVar(&enableRule, "enable", false, "Enable the Automation") cmd.Flags().BoolVar(&disableRule, "disable", false, "Disable the Automation") diff --git a/internal/cli/automation_test.go b/internal/cli/automation_test.go index 5d55449..79c8d58 100644 --- a/internal/cli/automation_test.go +++ b/internal/cli/automation_test.go @@ -34,6 +34,65 @@ func TestAutomationCreateDailyDefaultsEnabled(t *testing.T) { assertBody(t, stub.lastBody, "prompt", "Summarize yesterday's incidents") } +func TestAutomationCreateExecutionDestinationWireContract(t *testing.T) { + t.Run("omits server selected destination", func(t *testing.T) { + saveAndResetGlobals(t) + stub := newGFStub(t) + + _, err := execCommand( + "automation", "create", + "--name", "Daily SRE brief", + "--prompt", "Summarize yesterday's incidents", + "--json", + ) + if err != nil { + t.Fatalf("[automation-create-omitted-destination] unexpected error: %v", err) + } + for _, field := range []string{"run_in", "team_id"} { + if _, ok := stub.lastBody[field]; ok { + t.Fatalf("[automation-create-omitted-destination] %s must be omitted, body=%#v", field, stub.lastBody) + } + } + }) + + t.Run("sends explicit chat and personal scope", func(t *testing.T) { + saveAndResetGlobals(t) + stub := newGFStub(t) + + _, err := execCommand( + "automation", "create", + "--name", "Daily SRE brief", + "--prompt", "Summarize yesterday's incidents", + "--run-in", "current-chat", + "--team-id", "0", + "--json", + ) + if err != nil { + t.Fatalf("[automation-create-current-chat] unexpected error: %v", err) + } + assertBody(t, stub.lastBody, "run_in", "current-chat") + assertBody(t, stub.lastBody, "team_id", float64(0)) + }) + + t.Run("rejects invalid destination before request", func(t *testing.T) { + saveAndResetGlobals(t) + stub := newGFStub(t) + + _, err := execCommand( + "automation", "create", + "--name", "Daily SRE brief", + "--prompt", "Summarize yesterday's incidents", + "--run-in", "other-chat", + ) + if err == nil || !strings.Contains(err.Error(), "--run-in must be current-chat or web") { + t.Fatalf("[automation-create-invalid-destination] err = %v", err) + } + if stub.requests != 0 { + t.Fatalf("[automation-create-invalid-destination] request must not reach API, requests=%d", stub.requests) + } + }) +} + func TestAutomationScheduleHelpDocumentsTimezone(t *testing.T) { saveAndResetGlobals(t) @@ -60,6 +119,30 @@ func TestAutomationScheduleHelpDocumentsTimezone(t *testing.T) { } } +func TestAutomationCreateHelpDocumentsFreshIMExecutionAndScheduleLimit(t *testing.T) { + saveAndResetGlobals(t) + + out, err := execCommand("automation", "create", "--help") + if err != nil { + t.Fatalf("[automation-create-help] unexpected error: %v", err) + } + for _, want := range []string{ + "fresh execution session", + "fresh IM thread", + "Write the task prompt with the needed chat context", + "say \"above\"", + "scope no longer matches the rule", + "skipped. War-room Automations keep their existing behavior", + "The fastest supported schedule is once per hour", + "wildcards, ranges, lists, and steps are unsupported", + "Self-contained task prompt for the fresh AI SRE execution", + } { + if !strings.Contains(out, want) { + t.Fatalf("[automation-create-help] missing %q\n%s", want, out) + } + } +} + func TestAutomationCreateTimezone(t *testing.T) { saveAndResetGlobals(t) stub := newGFStub(t) @@ -279,6 +362,18 @@ func TestAutomationUpdateDoesNotExposeScopeFlag(t *testing.T) { } } +func TestSafariAutomationRuleUpdateDoesNotExposeExecutionTargetFlags(t *testing.T) { + saveAndResetGlobals(t) + newGFStub(t) + + for _, flag := range []string{"--team-id", "--run-in"} { + _, err := execCommand("safari", "automation-rule-update", "auto_123", flag, "0") + if err == nil || !strings.Contains(err.Error(), "unknown flag") { + t.Fatalf("[safari-automation-update-target] %s err = %v", flag, err) + } + } +} + func TestAutomationFireSendsBearerToken(t *testing.T) { saveAndResetGlobals(t) stub := newGFStub(t) diff --git a/internal/cli/zz_generated_automations.go b/internal/cli/zz_generated_automations.go index c65a500..53e299d 100644 --- a/internal/cli/zz_generated_automations.go +++ b/internal/cli/zz_generated_automations.go @@ -31,6 +31,15 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le - enabled (boolean) (required) — Whether the rule is enabled. - environment_id (string) (required) — BYOC Runner ID. - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: 'cloud' (platform-hosted cloud sandbox), 'byoc' (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc] + - execution_location (object) — Read-only Automation execution destination. It never includes a chat, integration, or session identifier. + - chat_name (string) — Display name of the bound IM conversation when available. + - conversation_mode (string) — Bound IM conversation mode when execution place is 'im'. + - description (string) (required) — Human-readable destination description. + - place (string) (required) — Execution destination: 'im' or 'web_console'. [im, web_console] + - platform (string) — IM platform when execution place is 'im'. + - run_scope (string) (required) — Pinned execution scope: 'person' or 'team'. [person, team] + - team_id (integer) (required) — Pinned scope team ID. 0 means personal scope. + - execution_place (string) (required) — Configured execution destination for ordinary triggers. War-room triggers resolve their event war room at execution time. [im, web_console] - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately. - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled. - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger. @@ -122,6 +131,15 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le - enabled (boolean) (required) — Whether the rule is enabled. - environment_id (string) (required) — BYOC Runner ID. - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: 'cloud' (platform-hosted cloud sandbox), 'byoc' (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc] + - execution_location (object) — Read-only Automation execution destination. It never includes a chat, integration, or session identifier. + - chat_name (string) — Display name of the bound IM conversation when available. + - conversation_mode (string) — Bound IM conversation mode when execution place is 'im'. + - description (string) (required) — Human-readable destination description. + - place (string) (required) — Execution destination: 'im' or 'web_console'. [im, web_console] + - platform (string) — IM platform when execution place is 'im'. + - run_scope (string) (required) — Pinned execution scope: 'person' or 'team'. [person, team] + - team_id (integer) (required) — Pinned scope team ID. 0 means personal scope. + - execution_place (string) (required) — Configured execution destination for ordinary triggers. War-room triggers resolve their event war room at execution time. [im, web_console] - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately. - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled. - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger. @@ -212,6 +230,7 @@ func genAutomationsRuleWriteCreateCmd() *cobra.Command { var fOncallIncidentSeverities []string var fOncallIncidentTriggerEnabled bool var fPrompt string + var fRunIn string var fScheduleTriggerEnabled bool var fTeamID int64 var fTimezone string @@ -235,8 +254,9 @@ Request fields: --oncall-incident-severities []string — Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. [Critical, Warning, Info] --oncall-incident-trigger-enabled bool — Whether the On-call incident trigger is enabled. --prompt string (required) — Task prompt sent to the AI SRE agent on each run. (≥1 chars) + --run-in string — Execution destination. 'current-chat' binds the rule to the authenticated live IM conversation; 'web' runs in the web console. Omit it so the server selects 'current-chat' for an authenticated IM invocation and 'web' otherwise. The server rejects 'current-chat' outside a live IM conversation. [current-chat, web] --schedule-trigger-enabled bool — Whether the schedule trigger is enabled. Defaults to true when omitted; HTTP-POST-only rules should send false. - --team-id int — Scope team ID. 0 or omitted means a personal rule; >0 means a team in the account. Can be reassigned later via update (converting a team rule to personal is owner-only; moving into a team requires the caller to belong to it). (min 0) + --team-id int — Scope team ID. Explicit 0 means personal scope; >0 means a team in the account. Omit it to inherit the authenticated IM conversation scope when one is available, otherwise let the server select the normal default. A current-chat rule must match that conversation's scope. (min 0) --timezone string — 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. Response fields ('data' envelope is unwrapped — these fields are at the top level): @@ -247,6 +267,15 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le - enabled (boolean) (required) — Whether the rule is enabled. - environment_id (string) (required) — BYOC Runner ID. - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: 'cloud' (platform-hosted cloud sandbox), 'byoc' (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc] + - execution_location (object) — Read-only Automation execution destination. It never includes a chat, integration, or session identifier. + - chat_name (string) — Display name of the bound IM conversation when available. + - conversation_mode (string) — Bound IM conversation mode when execution place is 'im'. + - description (string) (required) — Human-readable destination description. + - place (string) (required) — Execution destination: 'im' or 'web_console'. [im, web_console] + - platform (string) — IM platform when execution place is 'im'. + - run_scope (string) (required) — Pinned execution scope: 'person' or 'team'. [person, team] + - team_id (integer) (required) — Pinned scope team ID. 0 means personal scope. + - execution_place (string) (required) — Configured execution destination for ordinary triggers. War-room triggers resolve their event war room at execution time. [im, web_console] - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately. - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled. - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger. @@ -301,6 +330,9 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if cmd.Flags().Changed("prompt") { body["prompt"] = fPrompt } + if cmd.Flags().Changed("run-in") { + body["run_in"] = fRunIn + } if cmd.Flags().Changed("schedule-trigger-enabled") { body["schedule_trigger_enabled"] = fScheduleTriggerEnabled } @@ -337,8 +369,9 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le cmd.Flags().StringSliceVar(&fOncallIncidentSeverities, "oncall-incident-severities", nil, "Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. [Critical, Warning, Info]") cmd.Flags().BoolVar(&fOncallIncidentTriggerEnabled, "oncall-incident-trigger-enabled", false, "Whether the On-call incident trigger is enabled.") cmd.Flags().StringVar(&fPrompt, "prompt", "", "Task prompt sent to the AI SRE agent on each run. (required) (≥1 chars)") + cmd.Flags().StringVar(&fRunIn, "run-in", "", "Execution destination. 'current-chat' binds the rule to the authenticated live IM conversation; 'web' runs in the web console. Omit it so the server selects 'current-chat' for an authenticated IM invocation and 'web' otherwise. The server rejects 'current-chat' outside a live IM conversation. [current-chat, web]") cmd.Flags().BoolVar(&fScheduleTriggerEnabled, "schedule-trigger-enabled", false, "Whether the schedule trigger is enabled. Defaults to true when omitted; HTTP-POST-only rules should send false.") - cmd.Flags().Int64Var(&fTeamID, "team-id", 0, "Scope team ID. 0 or omitted means a personal rule; >0 means a team in the account. Can be reassigned later via update (converting a team rule to personal is owner-only; moving into a team requires the caller to belong to it). (min 0)") + cmd.Flags().Int64Var(&fTeamID, "team-id", 0, "Scope team ID. Explicit 0 means personal scope; >0 means a team in the account. Omit it to inherit the authenticated IM conversation scope when one is available, otherwise let the server select the normal default. A current-chat rule must match that conversation's scope. (min 0)") cmd.Flags().StringVar(&fTimezone, "timezone", "", "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.") cmd.Flags().StringVar(&dataJSON, "data", "", "Full request body as JSON; positional arguments and typed flags override its fields. Accepts inline JSON, or - to read stdin.") return cmd @@ -459,7 +492,6 @@ func genAutomationsRuleWriteUpdateCmd() *cobra.Command { var dataJSON string var fRuleID string var fName string - var fTeamID int64 var fEnabled bool var fCronExpr string var fTimezone string @@ -484,7 +516,6 @@ API: POST /safari/automation/rule/update (automation-rule-write-update) Request fields: --rule-id string (required) — Target rule ID, from the list returned by 'POST /safari/automation/rule/list'. --name string — New rule name. (≤255 chars) - --team-id int — Reassign the rule's scope: 0 converts to a personal rule (only the rule owner may convert a team rule); >0 moves it into a team the caller belongs to. Omit to leave unchanged. (min 0) --enabled bool — Whether the rule is enabled. --cron-expr string — Run cadence. Supports 4 fields ('hour day month weekday', minute defaults to 0) and 5 fields ('minute hour day month weekday'). The minute must be one fixed integer; 6-field seconds are not supported. --timezone string — New IANA timezone for evaluating 'cron_expr'. Omit or send null to leave the current timezone unchanged. @@ -506,6 +537,15 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le - enabled (boolean) (required) — Whether the rule is enabled. - environment_id (string) (required) — BYOC Runner ID. - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: 'cloud' (platform-hosted cloud sandbox), 'byoc' (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc] + - execution_location (object) — Read-only Automation execution destination. It never includes a chat, integration, or session identifier. + - chat_name (string) — Display name of the bound IM conversation when available. + - conversation_mode (string) — Bound IM conversation mode when execution place is 'im'. + - description (string) (required) — Human-readable destination description. + - place (string) (required) — Execution destination: 'im' or 'web_console'. [im, web_console] + - platform (string) — IM platform when execution place is 'im'. + - run_scope (string) (required) — Pinned execution scope: 'person' or 'team'. [person, team] + - team_id (integer) (required) — Pinned scope team ID. 0 means personal scope. + - execution_place (string) (required) — Configured execution destination for ordinary triggers. War-room triggers resolve their event war room at execution time. [im, web_console] - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately. - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled. - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger. @@ -540,9 +580,6 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le if cmd.Flags().Changed("name") { body["name"] = fName } - if cmd.Flags().Changed("team-id") { - body["team_id"] = fTeamID - } if cmd.Flags().Changed("enabled") { body["enabled"] = fEnabled } @@ -598,7 +635,6 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le } cmd.Flags().StringVar(&fRuleID, "rule-id", "", "Target rule ID, from the list returned by 'POST /safari/automation/rule/list'. (required)") cmd.Flags().StringVar(&fName, "name", "", "New rule name. (≤255 chars)") - cmd.Flags().Int64Var(&fTeamID, "team-id", 0, "Reassign the rule's scope: 0 converts to a personal rule (only the rule owner may convert a team rule); >0 moves it into a team the caller belongs to. Omit to leave unchanged. (min 0)") cmd.Flags().BoolVar(&fEnabled, "enabled", false, "Whether the rule is enabled.") cmd.Flags().StringVar(&fCronExpr, "cron-expr", "", "Run cadence. Supports 4 fields ('hour day month weekday', minute defaults to 0) and 5 fields ('minute hour day month weekday'). The minute must be one fixed integer; 6-field seconds are not supported.") cmd.Flags().StringVar(&fTimezone, "timezone", "", "New IANA timezone for evaluating 'cron_expr'. Omit or send null to leave the current timezone unchanged.") @@ -653,6 +689,7 @@ Response fields ('data' envelope is unwrapped — these fields are at the top le - duration_ms (integer) (required) — Duration in milliseconds. - error_code (string) (required) — Error code; empty when the run did not fail. - error_message (string) (required) — Error message; empty when the run did not fail. + - execution_place (string) (required) — Actual execution destination: 'im' or 'web_console'. IM runs omit session details and deep links. [im, web_console] - kind (string) (required) — Run kind; runs listed for a rule are always 'automation_rule'. [automation_rule] - occurrence_key (string) (required) — Idempotency key for this occurrence. - result_json (object) (required) — Raw run result JSON (carries the run's 'session_id' once started); null when empty. diff --git a/internal/cli/zz_generated_response_help.go b/internal/cli/zz_generated_response_help.go index e8d0859..7cd75ff 100644 --- a/internal/cli/zz_generated_response_help.go +++ b/internal/cli/zz_generated_response_help.go @@ -66,12 +66,12 @@ var responseHelpBySDKMethod = map[string]string{ "Artifacts.WriteUpdate": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - artifact_id (string) (required) — Artifact ID (`art_` prefix). Also the key of the public-share link.\n - can_edit (boolean) (required) — Whether the caller may manage this artifact (rename, transfer, delete, share): the creator, any member of the owning team, or a manager of the source session.\n - content_type (string) (required) — MIME type of the file.\n - created_at (string) (required) — Unix timestamp in milliseconds when the artifact was published. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - creator_name (string) (required) — Creator's display name.\n - file_id (string) (required) — Presented-file ID (`pf_` prefix) currently holding the artifact's bytes. Changes on every republish.\n - is_mine (boolean) (required) — Whether the caller is the creator.\n - name (string) (required) — Underlying file name including extension.\n - person_id (integer) (required) — Person (member) ID of the creator.\n - public_url (string) — Anonymous public link — a console `/share/artifact/` page served entirely from CDN. Present only while shared; anyone with the link can view it, no login required.\n - session_id (string) (required) — Source session ID (`sess_` prefix) that produced the file.\n - session_title (string) — Source session's title. Omitted when the session has been deleted.\n - share_enabled (boolean) — Whether anonymous public sharing is on. Omitted when false.\n - share_file_id (string) — Presented-file ID the public snapshot was materialized from. When `share_enabled` is true and `file_id` differs from `share_file_id`, the public snapshot is stale — call `/safari/artifact/gallery/share/sync` to refresh it.\n - shared_at (string) — Unix timestamp in milliseconds of the last share enable or snapshot sync. Present only while shared. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - shared_by (integer) — Person ID of the member who enabled sharing. Present only while shared.\n - size (integer) (required) — File size in bytes.\n - team_id (integer) (required) — Owning team ID. `0` means a personal artifact (creator-only management); a positive value means team-owned.\n - team_name (string) — Owning team's display name. Omitted for personal artifacts.\n - title (string) (required) — Display title in the gallery.\n - updated_at (string) (required) — Unix timestamp in milliseconds when the artifact was last updated (rename, transfer, or republish). CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n", "AuditLogs.OperationList": "Response fields (this command's `--json` is a TOP-LEVEL array of these row objects — pipe `jq '.[]'`, NOT `.items[]`):\n - name (string) (required) — Stable machine-readable operation name for use as a filter.\n - name_cn (string) (required) — Human-readable Chinese label shown in the console.\n", "AuditLogs.Search": "Response fields (this command's `--json` is a TOP-LEVEL array of these row objects — pipe `jq '.[]'`, NOT `.items[]`):\n - account_id (integer) (required) — ID of the account.\n - body (string) (required) — JSON-encoded request body. Bodies containing sensitive fields are base64url-encoded instead; bodies over 10 KB are replaced by a truncation placeholder.\n - created_at (string) (required) — Timestamp of the operation in Unix epoch milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - credential_id (integer) (required) — ID of the credential (the app key ID) when `credential_type` is `app_key`; 0 otherwise.\n - credential_type (string) (required) — Credential type used for the call. `app_key` for a long-lived console app key, `ephemeral_app_key` for a short-lived key issued to AI SRE, and an empty string for member sessions.\n - ip (string) (required) — Client IP address of the caller.\n - is_dangerous (boolean) (required) — True if this is flagged as a high-risk operation.\n - is_write (boolean) (required) — True for mutating operations; false for read-only ones.\n - member_id (integer) (required) — ID of the member who performed the action. 0 when the action was performed by the account principal itself.\n - member_name (string) (required) — Display name of the member. Empty when `member_id` is 0.\n - operation (string) (required) — Stable machine-readable operation name, e.g. `template:write:create`.\n - operation_name (string) (required) — Human-readable Chinese label of the operation (e.g. `创建模板`).\n - params (array) (required) — URL path parameters as an array of key-value pairs, or an empty array when none.\n - Key (string) — Name of a URL path parameter (the `:xxx` placeholder in the route).\n - Value (string) — The actual value of that path parameter in this request.\n - principal_kind (string) (required) — Kind of the caller. `member` — an interactive member session; `service` — an app key credential. [member, service]\n - request_id (string) (required) — Unique request ID for correlation.\n", - "Automations.RuleReadGet": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - account_id (integer) (required) — Account ID.\n - can_edit (boolean) (required) — True when the caller can manage this rule: the personal rule owner; for team rules, an account admin or a member of the rule's team.\n - created_at (string) (required) — Creation time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - cron_expr (string) (required) — Normalized 5-field cron expression.\n - enabled (boolean) (required) — Whether the rule is enabled.\n - environment_id (string) (required) — BYOC Runner ID.\n - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: `cloud` (platform-hosted cloud sandbox), `byoc` (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc]\n - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately.\n - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled.\n - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger.\n - http_post_trigger_url (string) — HTTP POST trigger path. Omitted when the rule has no HTTP POST trigger.\n - name (string) (required) — Rule name.\n - oncall_incident_channel_ids (array) — On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID. Omitted when no On-call incident trigger is configured.\n - oncall_incident_severities (array) — Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. Omitted when no On-call incident trigger is configured. [Critical, Warning, Info]\n - oncall_incident_trigger_enabled (boolean) (required) — Whether the On-call incident trigger is enabled.\n - oncall_incident_trigger_id (string) — On-call incident trigger ID. Omitted when the rule has no On-call incident trigger.\n - owner_id (integer) (required) — Creator person ID.\n - prompt (string) (required) — Task prompt.\n - rule_id (string) (required) — Rule ID.\n - run_scope (string) (required) — Hidden session run scope. One of: `person` (personal rule, team_id=0, runs as the creator; disabled when the creator leaves the account), `team` (team rule, team_id>0, owned by the team and shared with its members; survives the creator leaving). Derived from the rule's team_id. [person, team]\n - schedule_next_fire_at_ms (string) (required) — Next scheduled fire time, Unix milliseconds. 0 means no future scheduled fire is available. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - schedule_trigger_enabled (boolean) (required) — Whether the schedule trigger is enabled.\n - schedule_trigger_id (string) — Schedule trigger ID. Omitted if the rule has no schedule trigger.\n - team_id (integer) (required) — Scope team ID; 0 means personal rule.\n - timezone (string) (required) — IANA timezone `cron_expr` is evaluated in. Always populated for rules created after this field shipped; empty on legacy rows created before it, which still resolve to UTC when scheduled.\n - updated_at (string) (required) — Last update time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n", - "Automations.RuleReadList": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - rules (array) (required) — Array of automation rules for the current page, used with `total` for pagination.\n - account_id (integer) (required) — Account ID.\n - can_edit (boolean) (required) — True when the caller can manage this rule: the personal rule owner; for team rules, an account admin or a member of the rule's team.\n - created_at (string) (required) — Creation time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - cron_expr (string) (required) — Normalized 5-field cron expression.\n - enabled (boolean) (required) — Whether the rule is enabled.\n - environment_id (string) (required) — BYOC Runner ID.\n - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: `cloud` (platform-hosted cloud sandbox), `byoc` (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc]\n - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately.\n - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled.\n - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger.\n - http_post_trigger_url (string) — HTTP POST trigger path. Omitted when the rule has no HTTP POST trigger.\n - name (string) (required) — Rule name.\n - oncall_incident_channel_ids (array) — On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID. Omitted when no On-call incident trigger is configured.\n - oncall_incident_severities (array) — Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. Omitted when no On-call incident trigger is configured. [Critical, Warning, Info]\n - oncall_incident_trigger_enabled (boolean) (required) — Whether the On-call incident trigger is enabled.\n - oncall_incident_trigger_id (string) — On-call incident trigger ID. Omitted when the rule has no On-call incident trigger.\n - owner_id (integer) (required) — Creator person ID.\n - prompt (string) (required) — Task prompt.\n - rule_id (string) (required) — Rule ID.\n - run_scope (string) (required) — Hidden session run scope. One of: `person` (personal rule, team_id=0, runs as the creator; disabled when the creator leaves the account), `team` (team rule, team_id>0, owned by the team and shared with its members; survives the creator leaving). Derived from the rule's team_id. [person, team]\n - schedule_next_fire_at_ms (string) (required) — Next scheduled fire time, Unix milliseconds. 0 means no future scheduled fire is available. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - schedule_trigger_enabled (boolean) (required) — Whether the schedule trigger is enabled.\n - schedule_trigger_id (string) — Schedule trigger ID. Omitted if the rule has no schedule trigger.\n - team_id (integer) (required) — Scope team ID; 0 means personal rule.\n - timezone (string) (required) — IANA timezone `cron_expr` is evaluated in. Always populated for rules created after this field shipped; empty on legacy rows created before it, which still resolve to UTC when scheduled.\n - updated_at (string) (required) — Last update time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - total (integer) (required) — Total count.\n", - "Automations.RuleWriteCreate": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - account_id (integer) (required) — Account ID.\n - can_edit (boolean) (required) — True when the caller can manage this rule: the personal rule owner; for team rules, an account admin or a member of the rule's team.\n - created_at (string) (required) — Creation time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - cron_expr (string) (required) — Normalized 5-field cron expression.\n - enabled (boolean) (required) — Whether the rule is enabled.\n - environment_id (string) (required) — BYOC Runner ID.\n - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: `cloud` (platform-hosted cloud sandbox), `byoc` (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc]\n - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately.\n - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled.\n - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger.\n - http_post_trigger_url (string) — HTTP POST trigger path. Omitted when the rule has no HTTP POST trigger.\n - name (string) (required) — Rule name.\n - oncall_incident_channel_ids (array) — On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID. Omitted when no On-call incident trigger is configured.\n - oncall_incident_severities (array) — Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. Omitted when no On-call incident trigger is configured. [Critical, Warning, Info]\n - oncall_incident_trigger_enabled (boolean) (required) — Whether the On-call incident trigger is enabled.\n - oncall_incident_trigger_id (string) — On-call incident trigger ID. Omitted when the rule has no On-call incident trigger.\n - owner_id (integer) (required) — Creator person ID.\n - prompt (string) (required) — Task prompt.\n - rule_id (string) (required) — Rule ID.\n - run_scope (string) (required) — Hidden session run scope. One of: `person` (personal rule, team_id=0, runs as the creator; disabled when the creator leaves the account), `team` (team rule, team_id>0, owned by the team and shared with its members; survives the creator leaving). Derived from the rule's team_id. [person, team]\n - schedule_next_fire_at_ms (string) (required) — Next scheduled fire time, Unix milliseconds. 0 means no future scheduled fire is available. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - schedule_trigger_enabled (boolean) (required) — Whether the schedule trigger is enabled.\n - schedule_trigger_id (string) — Schedule trigger ID. Omitted if the rule has no schedule trigger.\n - team_id (integer) (required) — Scope team ID; 0 means personal rule.\n - timezone (string) (required) — IANA timezone `cron_expr` is evaluated in. Always populated for rules created after this field shipped; empty on legacy rows created before it, which still resolve to UTC when scheduled.\n - updated_at (string) (required) — Last update time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n", + "Automations.RuleReadGet": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - account_id (integer) (required) — Account ID.\n - can_edit (boolean) (required) — True when the caller can manage this rule: the personal rule owner; for team rules, an account admin or a member of the rule's team.\n - created_at (string) (required) — Creation time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - cron_expr (string) (required) — Normalized 5-field cron expression.\n - enabled (boolean) (required) — Whether the rule is enabled.\n - environment_id (string) (required) — BYOC Runner ID.\n - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: `cloud` (platform-hosted cloud sandbox), `byoc` (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc]\n - execution_location (object) — Read-only Automation execution destination. It never includes a chat, integration, or session identifier.\n - chat_name (string) — Display name of the bound IM conversation when available.\n - conversation_mode (string) — Bound IM conversation mode when execution place is `im`.\n - description (string) (required) — Human-readable destination description.\n - place (string) (required) — Execution destination: `im` or `web_console`. [im, web_console]\n - platform (string) — IM platform when execution place is `im`.\n - run_scope (string) (required) — Pinned execution scope: `person` or `team`. [person, team]\n - team_id (integer) (required) — Pinned scope team ID. 0 means personal scope.\n - execution_place (string) (required) — Configured execution destination for ordinary triggers. War-room triggers resolve their event war room at execution time. [im, web_console]\n - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately.\n - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled.\n - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger.\n - http_post_trigger_url (string) — HTTP POST trigger path. Omitted when the rule has no HTTP POST trigger.\n - name (string) (required) — Rule name.\n - oncall_incident_channel_ids (array) — On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID. Omitted when no On-call incident trigger is configured.\n - oncall_incident_severities (array) — Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. Omitted when no On-call incident trigger is configured. [Critical, Warning, Info]\n - oncall_incident_trigger_enabled (boolean) (required) — Whether the On-call incident trigger is enabled.\n - oncall_incident_trigger_id (string) — On-call incident trigger ID. Omitted when the rule has no On-call incident trigger.\n - owner_id (integer) (required) — Creator person ID.\n - prompt (string) (required) — Task prompt.\n - rule_id (string) (required) — Rule ID.\n - run_scope (string) (required) — Hidden session run scope. One of: `person` (personal rule, team_id=0, runs as the creator; disabled when the creator leaves the account), `team` (team rule, team_id>0, owned by the team and shared with its members; survives the creator leaving). Derived from the rule's team_id. [person, team]\n - schedule_next_fire_at_ms (string) (required) — Next scheduled fire time, Unix milliseconds. 0 means no future scheduled fire is available. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - schedule_trigger_enabled (boolean) (required) — Whether the schedule trigger is enabled.\n - schedule_trigger_id (string) — Schedule trigger ID. Omitted if the rule has no schedule trigger.\n - team_id (integer) (required) — Scope team ID; 0 means personal rule.\n - timezone (string) (required) — IANA timezone `cron_expr` is evaluated in. Always populated for rules created after this field shipped; empty on legacy rows created before it, which still resolve to UTC when scheduled.\n - updated_at (string) (required) — Last update time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n", + "Automations.RuleReadList": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - rules (array) (required) — Array of automation rules for the current page, used with `total` for pagination.\n - account_id (integer) (required) — Account ID.\n - can_edit (boolean) (required) — True when the caller can manage this rule: the personal rule owner; for team rules, an account admin or a member of the rule's team.\n - created_at (string) (required) — Creation time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - cron_expr (string) (required) — Normalized 5-field cron expression.\n - enabled (boolean) (required) — Whether the rule is enabled.\n - environment_id (string) (required) — BYOC Runner ID.\n - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: `cloud` (platform-hosted cloud sandbox), `byoc` (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc]\n - execution_location (object) — Read-only Automation execution destination. It never includes a chat, integration, or session identifier.\n - chat_name (string) — Display name of the bound IM conversation when available.\n - conversation_mode (string) — Bound IM conversation mode when execution place is `im`.\n - description (string) (required) — Human-readable destination description.\n - place (string) (required) — Execution destination: `im` or `web_console`. [im, web_console]\n - platform (string) — IM platform when execution place is `im`.\n - run_scope (string) (required) — Pinned execution scope: `person` or `team`. [person, team]\n - team_id (integer) (required) — Pinned scope team ID. 0 means personal scope.\n - execution_place (string) (required) — Configured execution destination for ordinary triggers. War-room triggers resolve their event war room at execution time. [im, web_console]\n - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately.\n - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled.\n - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger.\n - http_post_trigger_url (string) — HTTP POST trigger path. Omitted when the rule has no HTTP POST trigger.\n - name (string) (required) — Rule name.\n - oncall_incident_channel_ids (array) — On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID. Omitted when no On-call incident trigger is configured.\n - oncall_incident_severities (array) — Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. Omitted when no On-call incident trigger is configured. [Critical, Warning, Info]\n - oncall_incident_trigger_enabled (boolean) (required) — Whether the On-call incident trigger is enabled.\n - oncall_incident_trigger_id (string) — On-call incident trigger ID. Omitted when the rule has no On-call incident trigger.\n - owner_id (integer) (required) — Creator person ID.\n - prompt (string) (required) — Task prompt.\n - rule_id (string) (required) — Rule ID.\n - run_scope (string) (required) — Hidden session run scope. One of: `person` (personal rule, team_id=0, runs as the creator; disabled when the creator leaves the account), `team` (team rule, team_id>0, owned by the team and shared with its members; survives the creator leaving). Derived from the rule's team_id. [person, team]\n - schedule_next_fire_at_ms (string) (required) — Next scheduled fire time, Unix milliseconds. 0 means no future scheduled fire is available. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - schedule_trigger_enabled (boolean) (required) — Whether the schedule trigger is enabled.\n - schedule_trigger_id (string) — Schedule trigger ID. Omitted if the rule has no schedule trigger.\n - team_id (integer) (required) — Scope team ID; 0 means personal rule.\n - timezone (string) (required) — IANA timezone `cron_expr` is evaluated in. Always populated for rules created after this field shipped; empty on legacy rows created before it, which still resolve to UTC when scheduled.\n - updated_at (string) (required) — Last update time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - total (integer) (required) — Total count.\n", + "Automations.RuleWriteCreate": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - account_id (integer) (required) — Account ID.\n - can_edit (boolean) (required) — True when the caller can manage this rule: the personal rule owner; for team rules, an account admin or a member of the rule's team.\n - created_at (string) (required) — Creation time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - cron_expr (string) (required) — Normalized 5-field cron expression.\n - enabled (boolean) (required) — Whether the rule is enabled.\n - environment_id (string) (required) — BYOC Runner ID.\n - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: `cloud` (platform-hosted cloud sandbox), `byoc` (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc]\n - execution_location (object) — Read-only Automation execution destination. It never includes a chat, integration, or session identifier.\n - chat_name (string) — Display name of the bound IM conversation when available.\n - conversation_mode (string) — Bound IM conversation mode when execution place is `im`.\n - description (string) (required) — Human-readable destination description.\n - place (string) (required) — Execution destination: `im` or `web_console`. [im, web_console]\n - platform (string) — IM platform when execution place is `im`.\n - run_scope (string) (required) — Pinned execution scope: `person` or `team`. [person, team]\n - team_id (integer) (required) — Pinned scope team ID. 0 means personal scope.\n - execution_place (string) (required) — Configured execution destination for ordinary triggers. War-room triggers resolve their event war room at execution time. [im, web_console]\n - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately.\n - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled.\n - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger.\n - http_post_trigger_url (string) — HTTP POST trigger path. Omitted when the rule has no HTTP POST trigger.\n - name (string) (required) — Rule name.\n - oncall_incident_channel_ids (array) — On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID. Omitted when no On-call incident trigger is configured.\n - oncall_incident_severities (array) — Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. Omitted when no On-call incident trigger is configured. [Critical, Warning, Info]\n - oncall_incident_trigger_enabled (boolean) (required) — Whether the On-call incident trigger is enabled.\n - oncall_incident_trigger_id (string) — On-call incident trigger ID. Omitted when the rule has no On-call incident trigger.\n - owner_id (integer) (required) — Creator person ID.\n - prompt (string) (required) — Task prompt.\n - rule_id (string) (required) — Rule ID.\n - run_scope (string) (required) — Hidden session run scope. One of: `person` (personal rule, team_id=0, runs as the creator; disabled when the creator leaves the account), `team` (team rule, team_id>0, owned by the team and shared with its members; survives the creator leaving). Derived from the rule's team_id. [person, team]\n - schedule_next_fire_at_ms (string) (required) — Next scheduled fire time, Unix milliseconds. 0 means no future scheduled fire is available. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - schedule_trigger_enabled (boolean) (required) — Whether the schedule trigger is enabled.\n - schedule_trigger_id (string) — Schedule trigger ID. Omitted if the rule has no schedule trigger.\n - team_id (integer) (required) — Scope team ID; 0 means personal rule.\n - timezone (string) (required) — IANA timezone `cron_expr` is evaluated in. Always populated for rules created after this field shipped; empty on legacy rows created before it, which still resolve to UTC when scheduled.\n - updated_at (string) (required) — Last update time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n", "Automations.RuleWriteRun": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - preflight (object) (required) — Readiness checks computed before a manual run is allowed to start.\n - app_name (string) (required) — App the rule is scoped to. Currently always ai-sre; manual runs are only supported for that app.\n - checks (array) (required) — Names of the readiness checks performed, in order. Current fixed set: rule_loaded, actor_authorized, app_allowed, runtime_scope_resolved, rule_config_valid.\n - ok (boolean) (required) — Whether all readiness checks passed. Always true in a response that reaches the caller — a failed preflight returns a 400/403 error instead of a payload with ok=false.\n - owner_id (integer) (required) — Rule owner person ID.\n - scope (string) (required) — Resolved run scope for this run; mirrors the rule's run_scope. One of: `person` (personal rule, runs as its creator), `team` (team rule, runs under the owning team). [person, team]\n - team_id (integer) (required) — Rule's scope team ID; 0 means a personal rule.\n - warnings (array) — Non-fatal warnings surfaced during preflight. Omitted or empty when there are none.\n - rule_id (string) (required) — Rule ID that was run.\n - run (object) — Reference to the run started by a manual trigger.\n - run_id (string) (required) — Run ID, always populated once a run is created.\n - session_id (string) — AI SRE session ID for this run. Always populated in a 200 response, since the call only returns after the session has started.\n - trigger_kind (string) (required) — Always manual for this operation. [manual]\n", - "Automations.RuleWriteUpdate": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - account_id (integer) (required) — Account ID.\n - can_edit (boolean) (required) — True when the caller can manage this rule: the personal rule owner; for team rules, an account admin or a member of the rule's team.\n - created_at (string) (required) — Creation time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - cron_expr (string) (required) — Normalized 5-field cron expression.\n - enabled (boolean) (required) — Whether the rule is enabled.\n - environment_id (string) (required) — BYOC Runner ID.\n - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: `cloud` (platform-hosted cloud sandbox), `byoc` (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc]\n - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately.\n - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled.\n - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger.\n - http_post_trigger_url (string) — HTTP POST trigger path. Omitted when the rule has no HTTP POST trigger.\n - name (string) (required) — Rule name.\n - oncall_incident_channel_ids (array) — On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID. Omitted when no On-call incident trigger is configured.\n - oncall_incident_severities (array) — Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. Omitted when no On-call incident trigger is configured. [Critical, Warning, Info]\n - oncall_incident_trigger_enabled (boolean) (required) — Whether the On-call incident trigger is enabled.\n - oncall_incident_trigger_id (string) — On-call incident trigger ID. Omitted when the rule has no On-call incident trigger.\n - owner_id (integer) (required) — Creator person ID.\n - prompt (string) (required) — Task prompt.\n - rule_id (string) (required) — Rule ID.\n - run_scope (string) (required) — Hidden session run scope. One of: `person` (personal rule, team_id=0, runs as the creator; disabled when the creator leaves the account), `team` (team rule, team_id>0, owned by the team and shared with its members; survives the creator leaving). Derived from the rule's team_id. [person, team]\n - schedule_next_fire_at_ms (string) (required) — Next scheduled fire time, Unix milliseconds. 0 means no future scheduled fire is available. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - schedule_trigger_enabled (boolean) (required) — Whether the schedule trigger is enabled.\n - schedule_trigger_id (string) — Schedule trigger ID. Omitted if the rule has no schedule trigger.\n - team_id (integer) (required) — Scope team ID; 0 means personal rule.\n - timezone (string) (required) — IANA timezone `cron_expr` is evaluated in. Always populated for rules created after this field shipped; empty on legacy rows created before it, which still resolve to UTC when scheduled.\n - updated_at (string) (required) — Last update time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n", - "Automations.RunReadList": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - runs (array) (required) — Array of run records for the given `rule_id`, filtered by the request's status/trigger-kind/time-range and paginated.\n - account_id (integer) (required) — Account ID.\n - attempts (integer) (required) — Attempt count.\n - completed_at (string) (required) — Completion time, Unix milliseconds. 0 means not completed. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - created_at (string) (required) — Creation time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - duration_ms (integer) (required) — Duration in milliseconds.\n - error_code (string) (required) — Error code; empty when the run did not fail.\n - error_message (string) (required) — Error message; empty when the run did not fail.\n - kind (string) (required) — Run kind; runs listed for a rule are always `automation_rule`. [automation_rule]\n - occurrence_key (string) (required) — Idempotency key for this occurrence.\n - result_json (object) (required) — Raw run result JSON (carries the run's `session_id` once started); null when empty.\n - rule_id (string) (required) — Rule ID.\n - run_id (string) (required) — Run ID.\n - session_id (string) — Session created for this run, extracted from `result_json`. Omitted when the run has not (yet) started a session.\n - session_name (string) — Display name of the run's session, stamped via a batch lookup. Omitted when empty or when the lookup fails.\n - started_at (string) (required) — Start time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - stats_json (object) (required) — Raw run statistics JSON; null when empty.\n - status (string) (required) — Run status. One of (the first three are in-flight, the rest terminal): | Value | Meaning | | --- | --- | | `queued` | Enqueued, waiting for a worker | | `running` | Executing | | `retrying` | An attempt failed and a retry is scheduled | | `succeeded` | Completed successfully | | `partial` | Partially succeeded (currently only produced by memory-consolidation runs; rule runs never reach it) | | `failed` | Terminal failure, no further retries | | `skipped` | Not executed (e.g. grace period expired, trigger or rule invalid); the reason is kept on the run record | | `abandoned` | Still in-flight past the stale threshold and swept as never-completed (e.g. worker died) | | `blocked` | Terminal: the run produced output but ended with a connector waiting on a human to complete authorization (distinct from `failed`) | [queued, running, retrying, succeeded, partial, failed, skipped, abandoned, blocked]\n - trigger_kind (string) (required) — Trigger kind. One of: | Value | Meaning | | --- | --- | | `schedule` | Fired by the rule's schedule trigger | | `debug` | Debug run (reserved; current rule runs never carry this kind) | | `manual` | Triggered manually by a user | | `http_post` | Fired via the rule's HTTP POST webhook | | `oncall_incident` | Fired by an on-call incident event | [schedule, debug, manual, http_post, oncall_incident]\n - updated_at (string) (required) — Last update time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - total (integer) (required) — Total count.\n", + "Automations.RuleWriteUpdate": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - account_id (integer) (required) — Account ID.\n - can_edit (boolean) (required) — True when the caller can manage this rule: the personal rule owner; for team rules, an account admin or a member of the rule's team.\n - created_at (string) (required) — Creation time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - cron_expr (string) (required) — Normalized 5-field cron expression.\n - enabled (boolean) (required) — Whether the rule is enabled.\n - environment_id (string) (required) — BYOC Runner ID.\n - environment_kind (string) (required) — Runtime environment kind. Omit or send an empty value for automatic selection. One of: `cloud` (platform-hosted cloud sandbox), `byoc` (self-hosted BYOC runner in the account); an empty value means automatic selection (prefers an online BYOC runner, falls back to the cloud sandbox). [cloud, byoc]\n - execution_location (object) — Read-only Automation execution destination. It never includes a chat, integration, or session identifier.\n - chat_name (string) — Display name of the bound IM conversation when available.\n - conversation_mode (string) — Bound IM conversation mode when execution place is `im`.\n - description (string) (required) — Human-readable destination description.\n - place (string) (required) — Execution destination: `im` or `web_console`. [im, web_console]\n - platform (string) — IM platform when execution place is `im`.\n - run_scope (string) (required) — Pinned execution scope: `person` or `team`. [person, team]\n - team_id (integer) (required) — Pinned scope team ID. 0 means personal scope.\n - execution_place (string) (required) — Configured execution destination for ordinary triggers. War-room triggers resolve their event war room at execution time. [im, web_console]\n - http_post_token (string) — HTTP POST trigger token. Returned only on create or token rotation; save it immediately.\n - http_post_trigger_enabled (boolean) (required) — Whether the HTTP POST trigger is enabled.\n - http_post_trigger_id (string) — HTTP POST trigger ID. Omitted when the rule has no HTTP POST trigger.\n - http_post_trigger_url (string) — HTTP POST trigger path. Omitted when the rule has no HTTP POST trigger.\n - name (string) (required) — Rule name.\n - oncall_incident_channel_ids (array) — On-call integration IDs to watch. Creating or enabling this trigger requires at least one valid ID. Omitted when no On-call incident trigger is configured.\n - oncall_incident_severities (array) — Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. Omitted when no On-call incident trigger is configured. [Critical, Warning, Info]\n - oncall_incident_trigger_enabled (boolean) (required) — Whether the On-call incident trigger is enabled.\n - oncall_incident_trigger_id (string) — On-call incident trigger ID. Omitted when the rule has no On-call incident trigger.\n - owner_id (integer) (required) — Creator person ID.\n - prompt (string) (required) — Task prompt.\n - rule_id (string) (required) — Rule ID.\n - run_scope (string) (required) — Hidden session run scope. One of: `person` (personal rule, team_id=0, runs as the creator; disabled when the creator leaves the account), `team` (team rule, team_id>0, owned by the team and shared with its members; survives the creator leaving). Derived from the rule's team_id. [person, team]\n - schedule_next_fire_at_ms (string) (required) — Next scheduled fire time, Unix milliseconds. 0 means no future scheduled fire is available. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - schedule_trigger_enabled (boolean) (required) — Whether the schedule trigger is enabled.\n - schedule_trigger_id (string) — Schedule trigger ID. Omitted if the rule has no schedule trigger.\n - team_id (integer) (required) — Scope team ID; 0 means personal rule.\n - timezone (string) (required) — IANA timezone `cron_expr` is evaluated in. Always populated for rules created after this field shipped; empty on legacy rows created before it, which still resolve to UTC when scheduled.\n - updated_at (string) (required) — Last update time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n", + "Automations.RunReadList": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - runs (array) (required) — Array of run records for the given `rule_id`, filtered by the request's status/trigger-kind/time-range and paginated.\n - account_id (integer) (required) — Account ID.\n - attempts (integer) (required) — Attempt count.\n - completed_at (string) (required) — Completion time, Unix milliseconds. 0 means not completed. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - created_at (string) (required) — Creation time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - duration_ms (integer) (required) — Duration in milliseconds.\n - error_code (string) (required) — Error code; empty when the run did not fail.\n - error_message (string) (required) — Error message; empty when the run did not fail.\n - execution_place (string) (required) — Actual execution destination: `im` or `web_console`. IM runs omit session details and deep links. [im, web_console]\n - kind (string) (required) — Run kind; runs listed for a rule are always `automation_rule`. [automation_rule]\n - occurrence_key (string) (required) — Idempotency key for this occurrence.\n - result_json (object) (required) — Raw run result JSON (carries the run's `session_id` once started); null when empty.\n - rule_id (string) (required) — Rule ID.\n - run_id (string) (required) — Run ID.\n - session_id (string) — Session created for this run, extracted from `result_json`. Omitted when the run has not (yet) started a session.\n - session_name (string) — Display name of the run's session, stamped via a batch lookup. Omitted when empty or when the lookup fails.\n - started_at (string) (required) — Start time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - stats_json (object) (required) — Raw run statistics JSON; null when empty.\n - status (string) (required) — Run status. One of (the first three are in-flight, the rest terminal): | Value | Meaning | | --- | --- | | `queued` | Enqueued, waiting for a worker | | `running` | Executing | | `retrying` | An attempt failed and a retry is scheduled | | `succeeded` | Completed successfully | | `partial` | Partially succeeded (currently only produced by memory-consolidation runs; rule runs never reach it) | | `failed` | Terminal failure, no further retries | | `skipped` | Not executed (e.g. grace period expired, trigger or rule invalid); the reason is kept on the run record | | `abandoned` | Still in-flight past the stale threshold and swept as never-completed (e.g. worker died) | | `blocked` | Terminal: the run produced output but ended with a connector waiting on a human to complete authorization (distinct from `failed`) | [queued, running, retrying, succeeded, partial, failed, skipped, abandoned, blocked]\n - trigger_kind (string) (required) — Trigger kind. One of: | Value | Meaning | | --- | --- | | `schedule` | Fired by the rule's schedule trigger | | `debug` | Debug run (reserved; current rule runs never carry this kind) | | `manual` | Triggered manually by a user | | `http_post` | Fired via the rule's HTTP POST webhook | | `oncall_incident` | Fired by an on-call incident event | [schedule, debug, manual, http_post, oncall_incident]\n - updated_at (string) (required) — Last update time, Unix milliseconds. CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - total (integer) (required) — Total count.\n", "Automations.TemplateReadList": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - templates (array) (required) — Array of built-in automation templates, with display text localized by the request `locale` (falling back to request headers).\n - description (string) (required) — Template description.\n - enabled (boolean) (required) — Whether a rule created from this template starts out enabled (prefill value).\n - icon (string) (required) — Icon identifier.\n - name (string) (required) — Template name.\n - prompt (string) (required) — Template prompt.\n", "Calendars.CalEventList": "Response fields (this command's `--json` is a TOP-LEVEL array of these row objects — pipe `jq '.[]'`, NOT `.items[]`):\n - account_id (integer) — Account ID. Only present for private events.\n - cal_id (string) (required) — Calendar ID. For public events this is a locale key such as zh-cn.china.official.\n - created_at (string) (required) — Creation timestamp (Unix seconds). CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n - creator_id (integer) — Creator person ID. Only present for private events.\n - description (string) (required) — Event description.\n - end_at (string) (required) — Event end date (YYYY-MM-DD, exclusive).\n - event_id (string) (required) — Event ID.\n - is_off (boolean) (required) — Whether the event marks a non-working day.\n - start_at (string) (required) — Event start date (YYYY-MM-DD).\n - summary (string) (required) — Event summary.\n - updated_at (string) (required) — Last update timestamp (Unix seconds). CLI `--json` renders this as an RFC3339 string in the process's local timezone (NOT UTC, and NOT the wire integer); an unset value renders as null.\n", "Calendars.CalEventUpsert": "Response fields (`data` envelope is unwrapped — these fields are at the top level):\n - cal_id (string) (required) — Calendar ID.\n - event_id (string) (required) — Event ID (existing or newly generated).\n - summary (string) (required) — Event summary.\n", diff --git a/skills/flashduty/reference/automation.md b/skills/flashduty/reference/automation.md index d33ea60..b902fbd 100644 --- a/skills/flashduty/reference/automation.md +++ b/skills/flashduty/reference/automation.md @@ -1,6 +1,19 @@ # flashduty automation - command card -Prereq: `SKILL.md` read. Automations create AI SRE sessions on a schedule or through an HTTP POST trigger. `create`, `update`, `delete`, and `fire` mutate or start work. If the user directly asks for that action and provides enough detail, treat it as confirmation and do not ask again. +Prereq: `SKILL.md` read. Automations run AI SRE work on a schedule or through an HTTP POST trigger. A web Automation starts a fresh web-console execution session. An ordinary Automation bound to the current IM chat starts a fresh execution session on each run and, when the IM integration creates threads, starts a new IM thread. It remains bound to the chat and scope captured at creation, not to an old session or thread. Same-run retries reuse that run's execution identity. War-room Automations keep their existing behavior. `create`, `update`, `delete`, and `fire` mutate or start work. If the user directly asks for that action and provides enough detail, treat it as confirmation and do not ask again. + +When this command runs from a live IM conversation, `create` without `--run-in` +lets the server bind the Automation to that current conversation and inherit its +scope. Use `--run-in web` only when the user asks to run in the web console. +Do not invent or pass a chat, platform, integration, or session ID: the server +is the only authority that resolves the current chat. Omit `--team-id` to +inherit the IM scope; pass `--team-id 0` only for an explicit personal scope. +With `--run-in current-chat`, an explicitly supplied `--team-id` must equal +the current conversation's scope; it cannot switch that conversation to a +different personal or team scope. +If that bound chat's scope no longer matches the rule when it runs, the run is +skipped; it never moves the rule or runs in another chat. +The execution destination and pinned scope cannot be changed with `update`. ## Route here when @@ -22,7 +35,7 @@ Prereq: `SKILL.md` read. Automations create AI SRE sessions on a schedule or thr ## Scope and visibility -- `--team-id 0` or omitted means personal scope. `--team-id ` means the Automation runs as that team and creates sessions scoped to that team. +- `--team-id 0` explicitly selects personal scope. Omit it to inherit the authenticated IM conversation scope when available; otherwise the server applies its normal default. For `--run-in current-chat`, an explicit team ID must equal that conversation's scope; it cannot switch the chat's scope. For web execution, `--team-id ` selects that team. - Creation can target personal scope or any team in the account. Do not block on local team membership guesses; let the API enforce account boundaries. - Scope is immutable after creation. The friendly `update` command intentionally has no `--team-id`; create a new Automation if the target scope must change. - List visibility follows the backend: the caller sees Automations they created and Automations belonging to teams they can see. @@ -40,7 +53,7 @@ Prereq: `SKILL.md` read. Automations create AI SRE sessions on a schedule or thr - `--schedule hourly --at 00:15` -> minute 15 of every hour. - `--schedule daily --at 01:30` -> every day at 01:30. - `--schedule weekly --weekday mon --at 02:00` -> every Monday at 02:00. -- For exact minute-level control, use `--cron-expr ' '` in that same local time. +- Custom cron uses `--cron-expr ' '` in that same local time. The minute must be one fixed integer from `0` through `59`; minute wildcards, ranges, lists, and steps are unsupported. The fastest supported schedule is once per hour. - HTTP POST-only rule: pass `--http-post-trigger` without schedule flags. The CLI sends a placeholder cron and disables the schedule trigger. ## Hot flow - create from chat @@ -48,14 +61,20 @@ Prereq: `SKILL.md` read. Automations create AI SRE sessions on a schedule or thr ```bash flashduty automation create \ --name "Daily SRE brief" \ - --team-id \ --schedule daily \ --at 01:30 \ --prompt "Summarize yesterday's incidents, noisy alerts, and follow-up risks." \ --output-format toon ``` -If the user did not specify a team, omit `--team-id` for personal scope. If the user gives a long task prompt, put it in a temp file and pass `--prompt-file ` to avoid shell quoting issues. +To keep an IM-originated Automation in the web console, add `--run-in web`. + +If the user did not specify a team, omit `--team-id` so the server can inherit the IM scope. If the user gives a long task prompt, put it in a temp file and pass `--prompt-file ` to avoid shell quoting issues. + +Every ordinary current-chat run starts fresh, so the task prompt must state the +goal, relevant chat context (such as the service, team, and delivery target), +and required inputs directly. Do not say "continue the discussion above" or +rely on an old session or thread. ## Hot flow - create an HTTP POST trigger @@ -119,12 +138,13 @@ Create an Automation - `--name` string - `--prompt` string - `--prompt-file` string +- `--run-in` string - `--schedule` string - `--schedule-enabled` bool - `--team-id` int64 - `--timezone` string - `--weekday` string -- response: single object (`data` unwrapped to the top level) — fields: account_id (integer); can_edit (boolean); created_at (string); cron_expr (string); enabled (boolean); environment_id (string); environment_kind (string); http_post_token (string); http_post_trigger_enabled (boolean); http_post_trigger_id (string); http_post_trigger_url (string); name (string); oncall_incident_channel_ids (array); oncall_incident_severities (array); oncall_incident_trigger_enabled (boolean); oncall_incident_trigger_id (string); owner_id (integer); prompt (string); rule_id (string); run_scope (string); schedule_next_fire_at_ms (string); schedule_trigger_enabled (boolean); schedule_trigger_id (string); team_id (integer); timezone (string); updated_at (string) +- response: single object (`data` unwrapped to the top level) — fields: account_id (integer); can_edit (boolean); created_at (string); cron_expr (string); enabled (boolean); environment_id (string); environment_kind (string); execution_location (object); execution_place (string); http_post_token (string); http_post_trigger_enabled (boolean); http_post_trigger_id (string); http_post_trigger_url (string); name (string); oncall_incident_channel_ids (array); oncall_incident_severities (array); oncall_incident_trigger_enabled (boolean); oncall_incident_trigger_id (string); owner_id (integer); prompt (string); rule_id (string); run_scope (string); schedule_next_fire_at_ms (string); schedule_trigger_enabled (boolean); schedule_trigger_id (string); team_id (integer); timezone (string); updated_at (string) ### delete Delete an Automation diff --git a/skills/flashduty/reference/safari.md b/skills/flashduty/reference/safari.md index 48c7f24..56eb78a 100644 --- a/skills/flashduty/reference/safari.md +++ b/skills/flashduty/reference/safari.md @@ -180,10 +180,11 @@ Create Automation rule - `--oncall-incident-severities` stringSlice — Incident severities to watch. Supported values are Critical, Warning, and Info; creating or enabling this trigger requires at least one value. · enum: Critical | Warning | Info - `--oncall-incident-trigger-enabled` bool — Whether the On-call incident trigger is enabled. - `--prompt` string (required) — Task prompt sent to the AI SRE agent on each run. (≥1 chars) +- `--run-in` string — Execution destination. 'current-chat' binds the rule to the authenticated live IM conversation; 'web' runs in the web console. Omit it so the server selects 'current-chat' for an authenticated IM invocation and 'web' otherwise. The server rejects 'current-chat' outside a live IM conversation. · enum: current-chat | web - `--schedule-trigger-enabled` bool — Whether the schedule trigger is enabled. Defaults to true when omitted; HTTP-POST-only rules should send false. -- `--team-id` int64 — Scope team ID. 0 or omitted means a personal rule; >0 means a team in the account. Can be reassigned later via update (converting a team rule to personal is owner-only; moving into a team requires the caller to belong to it). (min 0) +- `--team-id` int64 — Scope team ID. Explicit 0 means personal scope; >0 means a team in the account. Omit it to inherit the authenticated IM conversation scope when one is available, otherwise let the server select the normal default. A current-chat rule must match that conversation's scope. (min 0) - `--timezone` string — 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. -- response: single object (`data` unwrapped to the top level) — fields: account_id (integer); can_edit (boolean); created_at (string); cron_expr (string); enabled (boolean); environment_id (string); environment_kind (string); http_post_token (string); http_post_trigger_enabled (boolean); http_post_trigger_id (string); http_post_trigger_url (string); name (string); oncall_incident_channel_ids (array); oncall_incident_severities (array); oncall_incident_trigger_enabled (boolean); oncall_incident_trigger_id (string); owner_id (integer); prompt (string); rule_id (string); run_scope (string); schedule_next_fire_at_ms (string); schedule_trigger_enabled (boolean); schedule_trigger_id (string); team_id (integer); timezone (string); updated_at (string) +- response: single object (`data` unwrapped to the top level) — fields: account_id (integer); can_edit (boolean); created_at (string); cron_expr (string); enabled (boolean); environment_id (string); environment_kind (string); execution_location (object); execution_place (string); http_post_token (string); http_post_trigger_enabled (boolean); http_post_trigger_id (string); http_post_trigger_url (string); name (string); oncall_incident_channel_ids (array); oncall_incident_severities (array); oncall_incident_trigger_enabled (boolean); oncall_incident_trigger_id (string); owner_id (integer); prompt (string); rule_id (string); run_scope (string); schedule_next_fire_at_ms (string); schedule_trigger_enabled (boolean); schedule_trigger_id (string); team_id (integer); timezone (string); updated_at (string) ### automation-rule-delete Delete Automation rule @@ -226,7 +227,6 @@ Update Automation rule - `--rotate-http-post-trigger-token` bool — Whether to rotate the HTTP POST trigger token. The new token is returned only in this response. - `` (positional, required) string — Target rule ID, from the list returned by 'POST /safari/automation/rule/list'. - `--schedule-trigger-enabled` bool — Whether the schedule trigger is enabled. -- `--team-id` int64 — Reassign the rule's scope: 0 converts to a personal rule (only the rule owner may convert a team rule); >0 moves it into a team the caller belongs to. Omit to leave unchanged. (min 0) - `--timezone` string — New IANA timezone for evaluating 'cron_expr'. Omit or send null to leave the current timezone unchanged. - response: same shape as `automation-rule-create` above