Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

88.7 KB
Raw Blame
/**
 * Auto-generated Zod validation schemas from the Django backend OpenAPI schema.
 * To modify these schemas, update the Django serializers or views, then run:
 *   hogli build:openapi
 * Questions or issues? #team-devex on Slack
 *
 * PostHog API - generated
 * OpenAPI spec version: 1.0.0
 */
import * as zod from 'zod'

export const visionAlertsCreateBodyNameDefault = `Untitled alert`
export const visionAlertsCreateBodyNameMax = 255

export const visionAlertsCreateBodyEnabledDefault = true
export const visionAlertsCreateBodySelectionOneVerdictItemMax = 100

export const visionAlertsCreateBodySelectionOneVerdictMax = 10

export const visionAlertsCreateBodySelectionOneTagsItemMax = 200

export const visionAlertsCreateBodySelectionOneTagsMax = 20

export const visionAlertsCreateBodyCheckIntervalMinutesMin = 15

export const visionAlertsCreateBodyEvaluationPeriodsMax = 10

export const visionAlertsCreateBodyDatapointsToAlarmMax = 10

export const visionAlertsCreateBodyCooldownMinutesMin = 0

export const VisionAlertsCreateBody = /* @__PURE__ */ zod.object({
    scanner_id: zod.uuid().describe('Scanner whose observations this alert watches. Immutable after creation.'),
    name: zod
        .string()
        .max(visionAlertsCreateBodyNameMax)
        .default(visionAlertsCreateBodyNameDefault)
        .describe("Human-readable name for this alert. Defaults to 'Untitled alert' on create when omitted."),
    enabled: zod
        .boolean()
        .default(visionAlertsCreateBodyEnabledDefault)
        .describe('Whether the alert is active. Disabling a metric alert resets its state to not_firing.'),
    kind: zod
        .enum(['metric', 'match'])
        .describe('\* `metric` - Metric\n\* `match` - Match')
        .describe(
            "'metric' fires when a metric crosses a threshold over a rolling window; 'match' fires on every observation that matches the selection. Immutable after creation.\n\n\* `metric` - Metric\n\* `match` - Match"
        ),
    selection: zod
        .object({
            verdict: zod
                .array(zod.string().max(visionAlertsCreateBodySelectionOneVerdictItemMax))
                .max(visionAlertsCreateBodySelectionOneVerdictMax)
                .optional()
                .describe("Monitor verdicts to match, e.g. ['yes']."),
            tags: zod
                .array(zod.string().max(visionAlertsCreateBodySelectionOneTagsItemMax))
                .max(visionAlertsCreateBodySelectionOneTagsMax)
                .optional()
                .describe('Classifier tags to match; an observation matches when it carries any of them.'),
            min_score: zod.number().optional().describe('Minimum scorer score (inclusive).'),
            max_score: zod.number().optional().describe('Maximum scorer score (inclusive).'),
        })
        .optional()
        .describe('Which observations count. Empty matches every observation of the scanner.'),
    metric: zod
        .enum(['count', 'avg_score'])
        .describe('\* `count` - Count matching observations\n\* `avg_score` - Average score')
        .optional()
        .describe(
            "Metric alerts only: what to measure over the window. 'avg_score' requires a scorer scanner.\n\n\* `count` - Count matching observations\n\* `avg_score` - Average score"
        ),
    direction: zod
        .enum(['above', 'below'])
        .describe('\* `above` - At or above\n\* `below` - At or below')
        .optional()
        .describe(
            'Metric alerts only: whether the alert fires at or above, or at or below, the threshold.\n\n\* `above` - At or above\n\* `below` - At or below'
        ),
    threshold: zod
        .number()
        .nullish()
        .describe(
            'Metric alerts only: the threshold value. Required for metric alerts, must be omitted for match alerts.'
        ),
    window_days: zod
        .number()
        .optional()
        .describe('Metric alerts only: rolling window in days. Allowed values: [1, 3, 7, 14, 30].'),
    check_interval_minutes: zod
        .number()
        .min(visionAlertsCreateBodyCheckIntervalMinutesMin)
        .optional()
        .describe('Metric alerts only: evaluation cadence in minutes, at least 15.'),
    evaluation_periods: zod
        .number()
        .min(1)
        .max(visionAlertsCreateBodyEvaluationPeriodsMax)
        .optional()
        .describe('Metric alerts only: total check periods in the sliding evaluation window (M in N-of-M).'),
    datapoints_to_alarm: zod
        .number()
        .min(1)
        .max(visionAlertsCreateBodyDatapointsToAlarmMax)
        .optional()
        .describe('Metric alerts only: how many periods must breach to fire (N in N-of-M).'),
    cooldown_minutes: zod
        .number()
        .min(visionAlertsCreateBodyCooldownMinutesMin)
        .optional()
        .describe('Metric alerts only: minimum minutes between repeated notifications. 0 means no cooldown.'),
    schedule_restriction: zod
        .union([
            zod.object({
                blocked_windows: zod
                    .array(
                        zod.object({
                            start: zod
                                .string()
                                .describe(
                                    'Start time HH:MM (24-hour, project timezone). Inclusive. Each window must span ≥ 30 minutes on the local daily timeline (half-open [start, end)).'
                                ),
                            end: zod
                                .string()
                                .describe(
                                    'End time HH:MM (24-hour). Exclusive (half-open interval). Each window must span ≥ 30 minutes locally.'
                                ),
                        })
                    )
                    .describe(
                        'Blocked local time windows when the alert must not run. Overlapping or identical windows are merged when saved. At most five windows before normalization; empty array clears quiet hours.'
                    ),
            }),
            zod.null(),
        ])
        .optional()
        .describe(
            'Blocked local time windows when the alert must not notify. Times use the project timezone. Null disables quiet hours.'
        ),
    snooze_until: zod.iso
        .datetime({ offset: true })
        .nullish()
        .describe('ISO 8601 timestamp until which the alert is snoozed. Set to null to unsnooze.'),
})

export const visionAlertsUpdateBodyNameDefault = `Untitled alert`
export const visionAlertsUpdateBodyNameMax = 255

export const visionAlertsUpdateBodyEnabledDefault = true
export const visionAlertsUpdateBodySelectionOneVerdictItemMax = 100

export const visionAlertsUpdateBodySelectionOneVerdictMax = 10

export const visionAlertsUpdateBodySelectionOneTagsItemMax = 200

export const visionAlertsUpdateBodySelectionOneTagsMax = 20

export const visionAlertsUpdateBodyCheckIntervalMinutesMin = 15

export const visionAlertsUpdateBodyEvaluationPeriodsMax = 10

export const visionAlertsUpdateBodyDatapointsToAlarmMax = 10

export const visionAlertsUpdateBodyCooldownMinutesMin = 0

export const VisionAlertsUpdateBody = /* @__PURE__ */ zod.object({
    scanner_id: zod.uuid().describe('Scanner whose observations this alert watches. Immutable after creation.'),
    name: zod
        .string()
        .max(visionAlertsUpdateBodyNameMax)
        .default(visionAlertsUpdateBodyNameDefault)
        .describe("Human-readable name for this alert. Defaults to 'Untitled alert' on create when omitted."),
    enabled: zod
        .boolean()
        .default(visionAlertsUpdateBodyEnabledDefault)
        .describe('Whether the alert is active. Disabling a metric alert resets its state to not_firing.'),
    kind: zod
        .enum(['metric', 'match'])
        .describe('\* `metric` - Metric\n\* `match` - Match')
        .describe(
            "'metric' fires when a metric crosses a threshold over a rolling window; 'match' fires on every observation that matches the selection. Immutable after creation.\n\n\* `metric` - Metric\n\* `match` - Match"
        ),
    selection: zod
        .object({
            verdict: zod
                .array(zod.string().max(visionAlertsUpdateBodySelectionOneVerdictItemMax))
                .max(visionAlertsUpdateBodySelectionOneVerdictMax)
                .optional()
                .describe("Monitor verdicts to match, e.g. ['yes']."),
            tags: zod
                .array(zod.string().max(visionAlertsUpdateBodySelectionOneTagsItemMax))
                .max(visionAlertsUpdateBodySelectionOneTagsMax)
                .optional()
                .describe('Classifier tags to match; an observation matches when it carries any of them.'),
            min_score: zod.number().optional().describe('Minimum scorer score (inclusive).'),
            max_score: zod.number().optional().describe('Maximum scorer score (inclusive).'),
        })
        .optional()
        .describe('Which observations count. Empty matches every observation of the scanner.'),
    metric: zod
        .enum(['count', 'avg_score'])
        .describe('\* `count` - Count matching observations\n\* `avg_score` - Average score')
        .optional()
        .describe(
            "Metric alerts only: what to measure over the window. 'avg_score' requires a scorer scanner.\n\n\* `count` - Count matching observations\n\* `avg_score` - Average score"
        ),
    direction: zod
        .enum(['above', 'below'])
        .describe('\* `above` - At or above\n\* `below` - At or below')
        .optional()
        .describe(
            'Metric alerts only: whether the alert fires at or above, or at or below, the threshold.\n\n\* `above` - At or above\n\* `below` - At or below'
        ),
    threshold: zod
        .number()
        .nullish()
        .describe(
            'Metric alerts only: the threshold value. Required for metric alerts, must be omitted for match alerts.'
        ),
    window_days: zod
        .number()
        .optional()
        .describe('Metric alerts only: rolling window in days. Allowed values: [1, 3, 7, 14, 30].'),
    check_interval_minutes: zod
        .number()
        .min(visionAlertsUpdateBodyCheckIntervalMinutesMin)
        .optional()
        .describe('Metric alerts only: evaluation cadence in minutes, at least 15.'),
    evaluation_periods: zod
        .number()
        .min(1)
        .max(visionAlertsUpdateBodyEvaluationPeriodsMax)
        .optional()
        .describe('Metric alerts only: total check periods in the sliding evaluation window (M in N-of-M).'),
    datapoints_to_alarm: zod
        .number()
        .min(1)
        .max(visionAlertsUpdateBodyDatapointsToAlarmMax)
        .optional()
        .describe('Metric alerts only: how many periods must breach to fire (N in N-of-M).'),
    cooldown_minutes: zod
        .number()
        .min(visionAlertsUpdateBodyCooldownMinutesMin)
        .optional()
        .describe('Metric alerts only: minimum minutes between repeated notifications. 0 means no cooldown.'),
    schedule_restriction: zod
        .union([
            zod.object({
                blocked_windows: zod
                    .array(
                        zod.object({
                            start: zod
                                .string()
                                .describe(
                                    'Start time HH:MM (24-hour, project timezone). Inclusive. Each window must span ≥ 30 minutes on the local daily timeline (half-open [start, end)).'
                                ),
                            end: zod
                                .string()
                                .describe(
                                    'End time HH:MM (24-hour). Exclusive (half-open interval). Each window must span ≥ 30 minutes locally.'
                                ),
                        })
                    )
                    .describe(
                        'Blocked local time windows when the alert must not run. Overlapping or identical windows are merged when saved. At most five windows before normalization; empty array clears quiet hours.'
                    ),
            }),
            zod.null(),
        ])
        .optional()
        .describe(
            'Blocked local time windows when the alert must not notify. Times use the project timezone. Null disables quiet hours.'
        ),
    snooze_until: zod.iso
        .datetime({ offset: true })
        .nullish()
        .describe('ISO 8601 timestamp until which the alert is snoozed. Set to null to unsnooze.'),
})

export const visionAlertsPartialUpdateBodyNameDefault = `Untitled alert`
export const visionAlertsPartialUpdateBodyNameMax = 255

export const visionAlertsPartialUpdateBodyEnabledDefault = true
export const visionAlertsPartialUpdateBodySelectionOneVerdictItemMax = 100

export const visionAlertsPartialUpdateBodySelectionOneVerdictMax = 10

export const visionAlertsPartialUpdateBodySelectionOneTagsItemMax = 200

export const visionAlertsPartialUpdateBodySelectionOneTagsMax = 20

export const visionAlertsPartialUpdateBodyCheckIntervalMinutesMin = 15

export const visionAlertsPartialUpdateBodyEvaluationPeriodsMax = 10

export const visionAlertsPartialUpdateBodyDatapointsToAlarmMax = 10

export const visionAlertsPartialUpdateBodyCooldownMinutesMin = 0

export const VisionAlertsPartialUpdateBody = /* @__PURE__ */ zod.object({
    scanner_id: zod
        .uuid()
        .optional()
        .describe('Scanner whose observations this alert watches. Immutable after creation.'),
    name: zod
        .string()
        .max(visionAlertsPartialUpdateBodyNameMax)
        .default(visionAlertsPartialUpdateBodyNameDefault)
        .describe("Human-readable name for this alert. Defaults to 'Untitled alert' on create when omitted."),
    enabled: zod
        .boolean()
        .default(visionAlertsPartialUpdateBodyEnabledDefault)
        .describe('Whether the alert is active. Disabling a metric alert resets its state to not_firing.'),
    kind: zod
        .enum(['metric', 'match'])
        .describe('\* `metric` - Metric\n\* `match` - Match')
        .optional()
        .describe(
            "'metric' fires when a metric crosses a threshold over a rolling window; 'match' fires on every observation that matches the selection. Immutable after creation.\n\n\* `metric` - Metric\n\* `match` - Match"
        ),
    selection: zod
        .object({
            verdict: zod
                .array(zod.string().max(visionAlertsPartialUpdateBodySelectionOneVerdictItemMax))
                .max(visionAlertsPartialUpdateBodySelectionOneVerdictMax)
                .optional()
                .describe("Monitor verdicts to match, e.g. ['yes']."),
            tags: zod
                .array(zod.string().max(visionAlertsPartialUpdateBodySelectionOneTagsItemMax))
                .max(visionAlertsPartialUpdateBodySelectionOneTagsMax)
                .optional()
                .describe('Classifier tags to match; an observation matches when it carries any of them.'),
            min_score: zod.number().optional().describe('Minimum scorer score (inclusive).'),
            max_score: zod.number().optional().describe('Maximum scorer score (inclusive).'),
        })
        .optional()
        .describe('Which observations count. Empty matches every observation of the scanner.'),
    metric: zod
        .enum(['count', 'avg_score'])
        .describe('\* `count` - Count matching observations\n\* `avg_score` - Average score')
        .optional()
        .describe(
            "Metric alerts only: what to measure over the window. 'avg_score' requires a scorer scanner.\n\n\* `count` - Count matching observations\n\* `avg_score` - Average score"
        ),
    direction: zod
        .enum(['above', 'below'])
        .describe('\* `above` - At or above\n\* `below` - At or below')
        .optional()
        .describe(
            'Metric alerts only: whether the alert fires at or above, or at or below, the threshold.\n\n\* `above` - At or above\n\* `below` - At or below'
        ),
    threshold: zod
        .number()
        .nullish()
        .describe(
            'Metric alerts only: the threshold value. Required for metric alerts, must be omitted for match alerts.'
        ),
    window_days: zod
        .number()
        .optional()
        .describe('Metric alerts only: rolling window in days. Allowed values: [1, 3, 7, 14, 30].'),
    check_interval_minutes: zod
        .number()
        .min(visionAlertsPartialUpdateBodyCheckIntervalMinutesMin)
        .optional()
        .describe('Metric alerts only: evaluation cadence in minutes, at least 15.'),
    evaluation_periods: zod
        .number()
        .min(1)
        .max(visionAlertsPartialUpdateBodyEvaluationPeriodsMax)
        .optional()
        .describe('Metric alerts only: total check periods in the sliding evaluation window (M in N-of-M).'),
    datapoints_to_alarm: zod
        .number()
        .min(1)
        .max(visionAlertsPartialUpdateBodyDatapointsToAlarmMax)
        .optional()
        .describe('Metric alerts only: how many periods must breach to fire (N in N-of-M).'),
    cooldown_minutes: zod
        .number()
        .min(visionAlertsPartialUpdateBodyCooldownMinutesMin)
        .optional()
        .describe('Metric alerts only: minimum minutes between repeated notifications. 0 means no cooldown.'),
    schedule_restriction: zod
        .union([
            zod.object({
                blocked_windows: zod
                    .array(
                        zod.object({
                            start: zod
                                .string()
                                .describe(
                                    'Start time HH:MM (24-hour, project timezone). Inclusive. Each window must span ≥ 30 minutes on the local daily timeline (half-open [start, end)).'
                                ),
                            end: zod
                                .string()
                                .describe(
                                    'End time HH:MM (24-hour). Exclusive (half-open interval). Each window must span ≥ 30 minutes locally.'
                                ),
                        })
                    )
                    .describe(
                        'Blocked local time windows when the alert must not run. Overlapping or identical windows are merged when saved. At most five windows before normalization; empty array clears quiet hours.'
                    ),
            }),
            zod.null(),
        ])
        .optional()
        .describe(
            'Blocked local time windows when the alert must not notify. Times use the project timezone. Null disables quiet hours.'
        ),
    snooze_until: zod.iso
        .datetime({ offset: true })
        .nullish()
        .describe('ISO 8601 timestamp until which the alert is snoozed. Set to null to unsnooze.'),
})

/**
 * Create a notification destination for this alert. One HogFunction is created per alert event kind atomically.
 */
export const VisionAlertsDestinationsCreateBody = /* @__PURE__ */ zod.object({
    type: zod
        .enum(['slack', 'webhook'])
        .describe('\* `slack` - slack\n\* `webhook` - webhook')
        .describe('Notification destination type.\n\n\* `slack` - slack\n\* `webhook` - webhook'),
    slack_workspace_id: zod
        .number()
        .optional()
        .describe('Integration ID for the Slack workspace. Required when type=slack.'),
    slack_channel_id: zod.string().optional().describe('Slack channel ID. Required when type=slack.'),
    slack_channel_name: zod.string().optional().describe('Human-readable channel name for display.'),
    webhook_url: zod.url().optional().describe('HTTPS endpoint to post to. Required when type=webhook.'),
})

/**
 * Delete a notification destination by deleting its HogFunction group atomically.
 */
export const visionAlertsDestinationsDeleteCreateBodyHogFunctionIdsMax = 5

export const VisionAlertsDestinationsDeleteCreateBody = /* @__PURE__ */ zod.object({
    hog_function_ids: zod
        .array(zod.uuid())
        .min(1)
        .max(visionAlertsDestinationsDeleteCreateBodyHogFunctionIdsMax)
        .describe('HogFunction IDs to delete as one atomic destination group.'),
})

/**
 * Mark this observation not useful for the calling user, with an optional reason. The Highlights feed stops showing it to that user. Sending it again replaces the reason.
 */
export const VisionObservationsFeedDismissalCreateBody = /* @__PURE__ */ zod
    .object({
        reason: zod
            .union([
                zod
                    .enum(['not_a_real_problem', 'already_known', 'not_my_area', 'other'])
                    .describe(
                        '\* `not_a_real_problem` - Not a real problem\n\* `already_known` - Already known\n\* `not_my_area` - Not my area\n\* `other` - Other'
                    ),
                zod.null(),
            ])
            .optional()
            .describe(
                'Optional reason the observation was not useful. Omit or send null when the user gave none.\n\n\* `not_a_real_problem` - Not a real problem\n\* `already_known` - Already known\n\* `not_my_area` - Not my area\n\* `other` - Other'
            ),
    })
    .describe('Why the calling user marked an observation not useful in the Highlights feed.')

/**
 * Set or update the observation's shared label: whether the scanner scored the session correctly, plus optional feedback on what it got wrong. One label per observation, shared across the team; these labels feed prompt improvement. Requires editor access to the scanner.
 */
export const visionObservationsLabelCreateBodyFeedbackDefault = ``
export const visionObservationsLabelCreateBodyFeedbackMax = 5000

export const VisionObservationsLabelCreateBody = /* @__PURE__ */ zod
    .object({
        is_correct: zod.boolean().describe('True if the scanner scored this session correctly, false if not.'),
        feedback: zod
            .string()
            .max(visionObservationsLabelCreateBodyFeedbackMax)
            .default(visionObservationsLabelCreateBodyFeedbackDefault)
            .describe(
                'Optional written context on the rating, for thumbs-up and thumbs-down alike: what the scanner got right or wrong, or what it should have concluded.'
            ),
    })
    .describe("The team's shared judgement on whether the scanner scored this session correctly.")

/**
 * Warm the query vectors for the suggestions the Search tab showed, so a click on one searches at once.
 * It embeds text, so it is a POST rather than part of the read.
 */
export const VisionObservationsSearchViewedCreateBody = /* @__PURE__ */ zod.object({
    scanner_id: zod
        .uuid()
        .optional()
        .describe("Scope to a single scanner's observations. Defaults to every scanner you can read."),
})

/**
 * Scan sessions with a saved scanner or an inline question. Poll the returned request for results.
 */
export const visionRequestsCreateBodySessionIdsItemMax = 128

export const visionRequestsCreateBodySessionIdsMax = 200

export const visionRequestsCreateBodyInlineOnePromptMax = 20000

export const visionRequestsCreateBodyInlineOneModelDefault = `gemini-3-flash-preview`
export const visionRequestsCreateBodyIdempotencyKeyMax = 200

export const visionRequestsCreateBodyReferenceDefault = ``
export const visionRequestsCreateBodyReferenceMax = 200

export const visionRequestsCreateBodyWaitForSessionEndDefault = false

export const VisionRequestsCreateBody = /* @__PURE__ */ zod
    .object({
        session_ids: zod
            .array(zod.string().max(visionRequestsCreateBodySessionIdsItemMax))
            .max(visionRequestsCreateBodySessionIdsMax)
            .describe(
                'Session recording IDs to scan, at most 200 per request. Scans start until the in-flight limit or monthly credit quota is reached; the rest are reported as skipped rather than failing the whole request. Duplicates are dropped.'
            ),
        scanner_id: zod
            .uuid()
            .optional()
            .describe('A saved scanner to apply to the sessions. Pass this or `inline`, not both.'),
        inline: zod
            .object({
                built_in: zod
                    .enum(['summarize_recording'])
                    .describe('\* `summarize_recording` - Summarize recording')
                    .optional()
                    .describe(
                        'Run a scan PostHog defines instead of your own prompt. `summarize_recording` is the AI summary the Summarize button in the replay player runs, so its results are shared with that button. Leave out `prompt`, `scanner_type` and `scanner_config` when this is set.\n\n\* `summarize_recording` - Summarize recording'
                    ),
                prompt: zod
                    .string()
                    .max(visionRequestsCreateBodyInlineOnePromptMax)
                    .optional()
                    .describe(
                        'What to look for in these sessions, in plain language. The same instruction a saved scanner carries. Required unless `built_in` is set.'
                    ),
                scanner_type: zod
                    .enum(['monitor', 'classifier', 'scorer', 'summarizer', 'experiment'])
                    .describe(
                        '\* `monitor` - Monitor\n\* `classifier` - Classifier\n\* `scorer` - Scorer\n\* `summarizer` - Summarizer\n\* `experiment` - Experiment'
                    )
                    .optional()
                    .describe(
                        "What the scan produces. Defaults to monitor, an open-ended observation against the prompt. Use `summarizer` for a summary in your own words; use `built_in: summarize_recording` for the Summarize button's summary. An inline scan is keyed by its whole config, so asking the same question again reuses its answers.\n\n\* `monitor` - Monitor\n\* `classifier` - Classifier\n\* `scorer` - Scorer\n\* `summarizer` - Summarizer\n\* `experiment` - Experiment"
                    ),
                scanner_config: zod
                    .unknown()
                    .optional()
                    .describe(
                        'Type-specific configuration beyond the prompt: `tags` for a classifier, `scale` for a scorer, optional `length` for a summarizer. Omit it for a monitor. `prompt` belongs in the `prompt` field and is rejected here.'
                    ),
                model: zod
                    .enum(['gemini-3.5-flash-lite', 'gemini-3-flash-preview', 'gemini-3.8-flash'])
                    .describe(
                        '\* `gemini-3.5-flash-lite` - Gemini 3.5 Flash Lite\n\* `gemini-3-flash-preview` - Gemini 3 Flash\n\* `gemini-3.8-flash` - Gemini 3.8 Flash'
                    )
                    .default(visionRequestsCreateBodyInlineOneModelDefault)
                    .describe(
                        'Model to scan with. Determines what each observation costs in credits.\n\n\* `gemini-3.5-flash-lite` - Gemini 3.5 Flash Lite\n\* `gemini-3-flash-preview` - Gemini 3 Flash\n\* `gemini-3.8-flash` - Gemini 3.8 Flash'
                    ),
            })
            .describe('A question asked inline, without saving a scanner first.')
            .optional()
            .describe(
                'A question to ask without saving a scanner first. Asking the same question again reuses the answers already given for the same sessions. Pass this or `scanner_id`, not both.'
            ),
        idempotency_key: zod
            .string()
            .max(visionRequestsCreateBodyIdempotencyKeyMax)
            .optional()
            .describe(
                'Any unique string per logical request, such as a UUID. Sending the same key again returns the first request instead of starting new scans, so a retry after a timeout never charges twice.'
            ),
        reference: zod
            .string()
            .max(visionRequestsCreateBodyReferenceMax)
            .default(visionRequestsCreateBodyReferenceDefault)
            .describe('Your own id for this request, such as a ticket or job id. Returned unchanged.'),
        wait_for_session_end: zod
            .boolean()
            .default(visionRequestsCreateBodyWaitForSessionEndDefault)
            .describe(
                "Hold the scans until every session has been quiet for 35 minutes, so each one is scanned whole. Use it when the sessions may still be recording. A scan of a live session sees only part of it, and its observation can't be replaced later. Sessions still active after 6 hours are scanned as they are."
            ),
    })
    .describe('Body of POST \/vision\/requests\/ - the sessions plus a saved scanner or an inline question.')

/**
 * CRUD for Replay Vision scanners.
 */
export const visionScannersCreateBodyNameMax = 255

export const visionScannersCreateBodyDescriptionMax = 1000

export const visionScannersCreateBodyTagsItemMax = 255

export const visionScannersCreateBodyTagsMax = 32

export const visionScannersCreateBodyGoalMax = 2000

export const visionScannersCreateBodyEntryPointRegExp = new RegExp('^[a-z0-9_]{1,64}$')
export const visionScannersCreateBodySamplingRateMin = 0
export const visionScannersCreateBodySamplingRateMax = 1

export const visionScannersCreateBodyCreditLimitMax = 2147483647

export const visionScannersCreateBodyExperimentTargetingOneVariantMax = 400

export const VisionScannersCreateBody = /* @__PURE__ */ zod
    .object({
        name: zod
            .string()
            .max(visionScannersCreateBodyNameMax)
            .describe('Human-readable scanner name. Unique within the team.'),
        description: zod
            .string()
            .max(visionScannersCreateBodyDescriptionMax)
            .optional()
            .describe('Free-form description shown in the scanner management UI.'),
        tags: zod
            .array(zod.string().max(visionScannersCreateBodyTagsItemMax))
            .max(visionScannersCreateBodyTagsMax)
            .optional()
            .describe(
                "Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas."
            ),
        scanner_type: zod
            .enum(['monitor', 'classifier', 'scorer', 'summarizer', 'experiment'])
            .describe(
                '\* `monitor` - Monitor\n\* `classifier` - Classifier\n\* `scorer` - Scorer\n\* `summarizer` - Summarizer\n\* `experiment` - Experiment'
            )
            .describe(
                'What the scanner does: monitor, classifier, scorer, or summarizer.\n\n\* `monitor` - Monitor\n\* `classifier` - Classifier\n\* `scorer` - Scorer\n\* `summarizer` - Summarizer\n\* `experiment` - Experiment'
            ),
        goal: zod
            .string()
            .max(visionScannersCreateBodyGoalMax)
            .nullish()
            .describe(
                "The goal an AI draft was built from, in the creator's own words, so the scanner keeps what it was meant to find. Set on create only and ignored on update."
            ),
        creation_method: zod
            .union([
                zod
                    .enum(['ai', 'template', 'scratch'])
                    .describe('\* `ai` - AI draft\n\* `template` - Template\n\* `scratch` - From scratch'),
                zod.null(),
            ])
            .optional()
            .describe(
                'How the creator built this scanner: from an AI draft, from a template, or from scratch. Reported to product analytics at creation and not stored on the scanner. Independent of any experiment the creator is in, since a person offered the AI flow can still fill the form by hand. Only the app can answer this, so a request from anywhere else reports the calling surface instead of whatever it sends here. Ignored on update.\n\n\* `ai` - AI draft\n\* `template` - Template\n\* `scratch` - From scratch'
            ),
        entry_point: zod
            .string()
            .regex(visionScannersCreateBodyEntryPointRegExp)
            .nullish()
            .describe(
                "The app surface the creator started from, such as `replay_filters`. Reported to product analytics at creation so a scanner can be attributed to its entry point, and not stored on the scanner. Only the app's value is kept: any other caller is reported as its own source, such as `mcp`. Ignored on update."
            ),
        take_over_as_creator: zod
            .boolean()
            .optional()
            .describe(
                "Set with `enabled: true` to turn on a scanner whose creator can no longer view recordings. The caller becomes the scanner's creator, and scheduled scans then run as the caller. Without it, that request fails with code `scanner_creator_lost_access`."
            ),
        scanner_config: zod
            .unknown()
            .describe(
                'Type-specific configuration. All scanner types require `prompt`; monitors add optional `allow_inconclusive`, classifiers add `tags`, scorers add `scale`, summarizers add optional `length`.'
            ),
        query: zod
            .unknown()
            .optional()
            .describe(
                'Persisted `RecordingsQuery` shape used to pick candidate sessions. `date_from`\/`date_to` are stripped on save — the schedule controls time, not the user.'
            ),
        sampling_rate: zod
            .number()
            .min(visionScannersCreateBodySamplingRateMin)
            .max(visionScannersCreateBodySamplingRateMax)
            .optional()
            .describe(
                '0..1 random downsample applied after the query matches. Defaults to 1.0 (no downsampling). Use exactly 0 to pause scanning; non-zero rates below 0.0001 (0.01%) are rejected as below the sampling precision.'
            ),
        sampling_mode: zod
            .enum(['focused', 'balanced', 'comprehensive'])
            .describe('\* `focused` - Focused\n\* `balanced` - Balanced\n\* `comprehensive` - Comprehensive')
            .optional()
            .describe(
                'Quality pre-filter applied before random sampling. focused = top sessions only, balanced = drops the lowest-quality, comprehensive = no filter (default).\n\n\* `focused` - Focused\n\* `balanced` - Balanced\n\* `comprehensive` - Comprehensive'
            ),
        credit_limit: zod
            .number()
            .min(1)
            .max(visionScannersCreateBodyCreditLimitMax)
            .nullish()
            .describe(
                "Optional cap on this scanner's own credit spend per billing period. Null means no scanner-level cap. When reached, this scanner stops scanning until the period resets. It stays enabled and does not scan the sessions it skipped."
            ),
        free_only: zod
            .boolean()
            .optional()
            .describe(
                'Run only while the organization has free credits left this billing period, so the scanner never adds spend.'
            ),
        provider: zod
            .enum(['google'])
            .describe('\* `google` - Google')
            .optional()
            .describe('LLM provider. v1 is Google-only.\n\n\* `google` - Google'),
        model: zod
            .enum(['gemini-3.5-flash-lite', 'gemini-3-flash-preview', 'gemini-3.8-flash'])
            .describe(
                '\* `gemini-3.5-flash-lite` - Gemini 3.5 Flash Lite\n\* `gemini-3-flash-preview` - Gemini 3 Flash\n\* `gemini-3.8-flash` - Gemini 3.8 Flash'
            )
            .describe(
                'Concrete model to use for this scanner.\n\n\* `gemini-3.5-flash-lite` - Gemini 3.5 Flash Lite\n\* `gemini-3-flash-preview` - Gemini 3 Flash\n\* `gemini-3.8-flash` - Gemini 3.8 Flash'
            ),
        enabled: zod
            .boolean()
            .optional()
            .describe(
                "When false, the reconciler removes the scanner's Temporal schedule. On-demand triggers still work."
            ),
        emits_signals: zod
            .boolean()
            .optional()
            .describe(
                'When true, the prompt is augmented with the Signal side mission and the scanner emits PostHog Signals.'
            ),
        experiment_targeting: zod
            .union([
                zod
                    .object({
                        experiment_id: zod.number().min(1).describe('The experiment the scanner watches.'),
                        variant: zod
                            .string()
                            .max(visionScannersCreateBodyExperimentTargetingOneVariantMax)
                            .nullish()
                            .describe(
                                'Narrow to sessions of people exposed to this variant. Null means every variant.'
                            ),
                    })
                    .describe(
                        "The experiment a scanner watches. Scans derive their person-scoped exposure filter from\nthis blob at query time, so it is the only place an experiment can enter a scanner's\ntargeting — which is what lets the write-side access check and read-side redaction cover it."
                    ),
                zod.null(),
                zod.null(),
            ])
            .optional()
            .describe(
                "The experiment this scanner's targeting watches, if any. Set null when the experiment targeting is removed."
            ),
    })
    .describe('A Replay Vision scanner: its type, targeting query, and AI configuration.')

/**
 * CRUD for Replay Vision scanners.
 */
export const visionScannersPartialUpdateBodyNameMax = 255

export const visionScannersPartialUpdateBodyDescriptionMax = 1000

export const visionScannersPartialUpdateBodyTagsItemMax = 255

export const visionScannersPartialUpdateBodyTagsMax = 32

export const visionScannersPartialUpdateBodyGoalMax = 2000

export const visionScannersPartialUpdateBodyEntryPointRegExp = new RegExp('^[a-z0-9_]{1,64}$')
export const visionScannersPartialUpdateBodySamplingRateMin = 0
export const visionScannersPartialUpdateBodySamplingRateMax = 1

export const visionScannersPartialUpdateBodyCreditLimitMax = 2147483647

export const visionScannersPartialUpdateBodyExperimentTargetingOneVariantMax = 400

export const VisionScannersPartialUpdateBody = /* @__PURE__ */ zod
    .object({
        name: zod
            .string()
            .max(visionScannersPartialUpdateBodyNameMax)
            .optional()
            .describe('Human-readable scanner name. Unique within the team.'),
        description: zod
            .string()
            .max(visionScannersPartialUpdateBodyDescriptionMax)
            .optional()
            .describe('Free-form description shown in the scanner management UI.'),
        tags: zod
            .array(zod.string().max(visionScannersPartialUpdateBodyTagsItemMax))
            .max(visionScannersPartialUpdateBodyTagsMax)
            .optional()
            .describe(
                "Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas."
            ),
        scanner_type: zod
            .enum(['monitor', 'classifier', 'scorer', 'summarizer', 'experiment'])
            .describe(
                '\* `monitor` - Monitor\n\* `classifier` - Classifier\n\* `scorer` - Scorer\n\* `summarizer` - Summarizer\n\* `experiment` - Experiment'
            )
            .optional()
            .describe(
                'What the scanner does: monitor, classifier, scorer, or summarizer.\n\n\* `monitor` - Monitor\n\* `classifier` - Classifier\n\* `scorer` - Scorer\n\* `summarizer` - Summarizer\n\* `experiment` - Experiment'
            ),
        goal: zod
            .string()
            .max(visionScannersPartialUpdateBodyGoalMax)
            .nullish()
            .describe(
                "The goal an AI draft was built from, in the creator's own words, so the scanner keeps what it was meant to find. Set on create only and ignored on update."
            ),
        creation_method: zod
            .union([
                zod
                    .enum(['ai', 'template', 'scratch'])
                    .describe('\* `ai` - AI draft\n\* `template` - Template\n\* `scratch` - From scratch'),
                zod.null(),
            ])
            .optional()
            .describe(
                'How the creator built this scanner: from an AI draft, from a template, or from scratch. Reported to product analytics at creation and not stored on the scanner. Independent of any experiment the creator is in, since a person offered the AI flow can still fill the form by hand. Only the app can answer this, so a request from anywhere else reports the calling surface instead of whatever it sends here. Ignored on update.\n\n\* `ai` - AI draft\n\* `template` - Template\n\* `scratch` - From scratch'
            ),
        entry_point: zod
            .string()
            .regex(visionScannersPartialUpdateBodyEntryPointRegExp)
            .nullish()
            .describe(
                "The app surface the creator started from, such as `replay_filters`. Reported to product analytics at creation so a scanner can be attributed to its entry point, and not stored on the scanner. Only the app's value is kept: any other caller is reported as its own source, such as `mcp`. Ignored on update."
            ),
        take_over_as_creator: zod
            .boolean()
            .optional()
            .describe(
                "Set with `enabled: true` to turn on a scanner whose creator can no longer view recordings. The caller becomes the scanner's creator, and scheduled scans then run as the caller. Without it, that request fails with code `scanner_creator_lost_access`."
            ),
        scanner_config: zod
            .unknown()
            .optional()
            .describe(
                'Type-specific configuration. All scanner types require `prompt`; monitors add optional `allow_inconclusive`, classifiers add `tags`, scorers add `scale`, summarizers add optional `length`.'
            ),
        query: zod
            .unknown()
            .optional()
            .describe(
                'Persisted `RecordingsQuery` shape used to pick candidate sessions. `date_from`\/`date_to` are stripped on save — the schedule controls time, not the user.'
            ),
        sampling_rate: zod
            .number()
            .min(visionScannersPartialUpdateBodySamplingRateMin)
            .max(visionScannersPartialUpdateBodySamplingRateMax)
            .optional()
            .describe(
                '0..1 random downsample applied after the query matches. Defaults to 1.0 (no downsampling). Use exactly 0 to pause scanning; non-zero rates below 0.0001 (0.01%) are rejected as below the sampling precision.'
            ),
        sampling_mode: zod
            .enum(['focused', 'balanced', 'comprehensive'])
            .describe('\* `focused` - Focused\n\* `balanced` - Balanced\n\* `comprehensive` - Comprehensive')
            .optional()
            .describe(
                'Quality pre-filter applied before random sampling. focused = top sessions only, balanced = drops the lowest-quality, comprehensive = no filter (default).\n\n\* `focused` - Focused\n\* `balanced` - Balanced\n\* `comprehensive` - Comprehensive'
            ),
        credit_limit: zod
            .number()
            .min(1)
            .max(visionScannersPartialUpdateBodyCreditLimitMax)
            .nullish()
            .describe(
                "Optional cap on this scanner's own credit spend per billing period. Null means no scanner-level cap. When reached, this scanner stops scanning until the period resets. It stays enabled and does not scan the sessions it skipped."
            ),
        free_only: zod
            .boolean()
            .optional()
            .describe(
                'Run only while the organization has free credits left this billing period, so the scanner never adds spend.'
            ),
        provider: zod
            .enum(['google'])
            .describe('\* `google` - Google')
            .optional()
            .describe('LLM provider. v1 is Google-only.\n\n\* `google` - Google'),
        model: zod
            .enum(['gemini-3.5-flash-lite', 'gemini-3-flash-preview', 'gemini-3.8-flash'])
            .describe(
                '\* `gemini-3.5-flash-lite` - Gemini 3.5 Flash Lite\n\* `gemini-3-flash-preview` - Gemini 3 Flash\n\* `gemini-3.8-flash` - Gemini 3.8 Flash'
            )
            .optional()
            .describe(
                'Concrete model to use for this scanner.\n\n\* `gemini-3.5-flash-lite` - Gemini 3.5 Flash Lite\n\* `gemini-3-flash-preview` - Gemini 3 Flash\n\* `gemini-3.8-flash` - Gemini 3.8 Flash'
            ),
        enabled: zod
            .boolean()
            .optional()
            .describe(
                "When false, the reconciler removes the scanner's Temporal schedule. On-demand triggers still work."
            ),
        emits_signals: zod
            .boolean()
            .optional()
            .describe(
                'When true, the prompt is augmented with the Signal side mission and the scanner emits PostHog Signals.'
            ),
        experiment_targeting: zod
            .union([
                zod
                    .object({
                        experiment_id: zod.number().min(1).describe('The experiment the scanner watches.'),
                        variant: zod
                            .string()
                            .max(visionScannersPartialUpdateBodyExperimentTargetingOneVariantMax)
                            .nullish()
                            .describe(
                                'Narrow to sessions of people exposed to this variant. Null means every variant.'
                            ),
                    })
                    .describe(
                        "The experiment a scanner watches. Scans derive their person-scoped exposure filter from\nthis blob at query time, so it is the only place an experiment can enter a scanner's\ntargeting — which is what lets the write-side access check and read-side redaction cover it."
                    ),
                zod.null(),
                zod.null(),
            ])
            .optional()
            .describe(
                "The experiment this scanner's targeting watches, if any. Set null when the experiment targeting is removed."
            ),
    })
    .describe('A Replay Vision scanner: its type, targeting query, and AI configuration.')

/**
 * Save the users this scanner matched as a static cohort, for surveys, funnels, and retention analysis.
 */
export const visionScannersAffectedCohortCreateBodyWindowDaysDefault = 30
export const visionScannersAffectedCohortCreateBodyWindowDaysMax = 90

export const visionScannersAffectedCohortCreateBodyTagMax = 100

export const VisionScannersAffectedCohortCreateBody = /* @__PURE__ */ zod
    .object({
        window_days: zod
            .number()
            .min(1)
            .max(visionScannersAffectedCohortCreateBodyWindowDaysMax)
            .default(visionScannersAffectedCohortCreateBodyWindowDaysDefault)
            .describe('Trailing window of observations to count. Defaults to 30 days.'),
        verdict: zod
            .union([
                zod
                    .enum(['yes', 'no', 'inconclusive'])
                    .describe('\* `yes` - Yes\n\* `no` - No\n\* `inconclusive` - Inconclusive'),
                zod.null(),
            ])
            .optional()
            .describe(
                'Monitor scanners only: count sessions with this verdict. Defaults to `yes`. Not applicable to other scanner types.\n\n\* `yes` - Yes\n\* `no` - No\n\* `inconclusive` - Inconclusive'
            ),
        tag: zod
            .string()
            .max(visionScannersAffectedCohortCreateBodyTagMax)
            .nullish()
            .describe(
                'Classifier scanners only, required for them: count sessions carrying this tag (fixed or freeform). Not applicable to other scanner types.'
            ),
        min_score: zod
            .number()
            .nullish()
            .describe(
                'Scorer scanners only: count sessions scoring at or above this value. Scorers require `min_score` and\/or `max_score`. Not applicable to other scanner types.'
            ),
        max_score: zod
            .number()
            .nullish()
            .describe('Scorer scanners only: count sessions scoring at or below this value.'),
    })
    .describe('Body of POST \/vision\/scanners\/:id\/affected_cohort\/. Same qualifiers as the impact GET.')

/**
 * Apply this scanner to many sessions on demand. Starts as many as fit under the in-flight
 * caps and monthly credit quota, reporting the rest as skipped rather than failing the batch.
 */
export const visionScannersBulkObserveCreateBodySessionIdsItemMax = 128

export const visionScannersBulkObserveCreateBodySessionIdsMax = 200

export const VisionScannersBulkObserveCreateBody = /* @__PURE__ */ zod
    .object({
        session_ids: zod
            .array(zod.string().max(visionScannersBulkObserveCreateBodySessionIdsItemMax))
            .max(visionScannersBulkObserveCreateBodySessionIdsMax)
            .describe(
                'Session recording IDs to scan on demand, at most 200 per request. Scans start until the in-flight limit or monthly credit quota is reached; the rest are reported as skipped rather than failing the whole batch. Already-running sessions are a no-op.'
            ),
    })
    .describe('Body of POST \/vision\/scanners\/{id}\/bulk_observe\/.')

/**
 * Apply this scanner to one specific session, on demand. Returns 202 with the workflow handle.
 */
export const visionScannersObserveCreateBodySessionIdMax = 128

export const VisionScannersObserveCreateBody = /* @__PURE__ */ zod
    .object({
        session_id: zod
            .string()
            .max(visionScannersObserveCreateBodySessionIdMax)
            .describe('ID of the session recording to apply the scanner to.'),
    })
    .describe('Body of POST \/vision\/scanners\/{id}\/observe\/.')

/**
 * Create a backfill: freeze the scanner config, enumerate the exact candidate set, start the tick schedule.
 *
 * The enumeration reruns here rather than trusting the client-confirmed estimate: the count is
 * billing-relevant, so the authoritative value is computed server-side at creation time. New
 * settled sessions between estimate and confirm can nudge total_count slightly.
 */
export const visionScannersBackfillsCreateBodyMaxTotalCreditsMin = 0

export const VisionScannersBackfillsCreateBody = /* @__PURE__ */ zod.object({
    window_start: zod.iso
        .datetime({ offset: true })
        .describe('Inclusive lower bound of the historical window to scan.'),
    window_end: zod.iso
        .datetime({ offset: true })
        .describe(
            "Exclusive upper bound of the window; clamped server-side to now, and for an experiment scanner to the experiment's end date."
        ),
    max_total_credits: zod
        .number()
        .min(visionScannersBackfillsCreateBodyMaxTotalCreditsMin)
        .describe(
            'The most this backfill may cost, in credits (1 credit = $0.01): pass the `total_credits` from the estimate the person agreed to. The create is rejected if the window now costs more.'
        ),
})

/**
 * Stop an active backfill; already-dispatched observations finish, nothing new dispatches.
 */
export const VisionScannersBackfillsCancelCreateBody = /* @__PURE__ */ zod.looseObject({})

/**
 * Restart a backfill that paused when the monthly quota ran out.
 */
export const VisionScannersBackfillsResumeCreateBody = /* @__PURE__ */ zod.looseObject({})

/**
 * Exactly enumerate what a backfill over the given window would dispatch and cost.
 */
export const VisionScannersBackfillsEstimateCreateBody = /* @__PURE__ */ zod.object({
    window_start: zod.iso
        .datetime({ offset: true })
        .describe('Inclusive lower bound of the historical window to scan.'),
    window_end: zod.iso
        .datetime({ offset: true })
        .describe(
            "Exclusive upper bound of the window; clamped server-side to now, and for an experiment scanner to the experiment's end date."
        ),
})

/**
 * Mark this observation not useful for the calling user, with an optional reason. The Highlights feed stops showing it to that user. Sending it again replaces the reason.
 */
export const VisionScannersObservationsFeedDismissalCreateBody = /* @__PURE__ */ zod
    .object({
        reason: zod
            .union([
                zod
                    .enum(['not_a_real_problem', 'already_known', 'not_my_area', 'other'])
                    .describe(
                        '\* `not_a_real_problem` - Not a real problem\n\* `already_known` - Already known\n\* `not_my_area` - Not my area\n\* `other` - Other'
                    ),
                zod.null(),
            ])
            .optional()
            .describe(
                'Optional reason the observation was not useful. Omit or send null when the user gave none.\n\n\* `not_a_real_problem` - Not a real problem\n\* `already_known` - Already known\n\* `not_my_area` - Not my area\n\* `other` - Other'
            ),
    })
    .describe('Why the calling user marked an observation not useful in the Highlights feed.')

/**
 * Set or update the observation's shared label: whether the scanner scored the session correctly, plus optional feedback on what it got wrong. One label per observation, shared across the team; these labels feed prompt improvement. Requires editor access to the scanner.
 */
export const visionScannersObservationsLabelCreateBodyFeedbackDefault = ``
export const visionScannersObservationsLabelCreateBodyFeedbackMax = 5000

export const VisionScannersObservationsLabelCreateBody = /* @__PURE__ */ zod
    .object({
        is_correct: zod.boolean().describe('True if the scanner scored this session correctly, false if not.'),
        feedback: zod
            .string()
            .max(visionScannersObservationsLabelCreateBodyFeedbackMax)
            .default(visionScannersObservationsLabelCreateBodyFeedbackDefault)
            .describe(
                'Optional written context on the rating, for thumbs-up and thumbs-down alike: what the scanner got right or wrong, or what it should have concluded.'
            ),
    })
    .describe("The team's shared judgement on whether the scanner scored this session correctly.")

/**
 * Create a scout that watches this scanner, recorded as belonging to it.
 */
export const visionScannersScoutsCreateBodyDisplayNameMax = 200

export const visionScannersScoutsCreateBodyNameMax = 64

export const visionScannersScoutsCreateBodyDescriptionMax = 1024

export const visionScannersScoutsCreateBodyConfigOneModelMax = 200

export const visionScannersScoutsCreateBodyConfigOneTagsMax = 10

export const visionScannersScoutsCreateBodyConfigOneMcpGatewayServerIdsMax = 100

export const visionScannersScoutsCreateBodyConfigOneRepositoriesItemMax = 255

export const visionScannersScoutsCreateBodyConfigOneRepositoriesMax = 10

export const visionScannersScoutsCreateBodyConfigOneWriteScopesMax = 15

export const visionScannersScoutsCreateBodyConfigOnePrecheckQueryMax = 10000

export const visionScannersScoutsCreateBodyConfigOneRunIntervalMinutesMin = 30
export const visionScannersScoutsCreateBodyConfigOneRunIntervalMinutesMax = 43200

export const visionScannersScoutsCreateBodyConfigOneOutputDestinationsOneSlackOneChannelMax = 255

export const visionScannersScoutsCreateBodyConfigOneOutputDestinationsOneSlackOneUsersItemMax = 255

export const visionScannersScoutsCreateBodyConfigOneOutputDestinationsOneSlackOneUsersItemRegExp = new RegExp(
    '^[UW][A-Z0-9]{4,}\\s\*(\\|.\*)?$'
)
export const visionScannersScoutsCreateBodyConfigOneOutputDestinationsOneSlackOneUsersMax = 5

export const visionScannersScoutsCreateBodyConfigOneOutputDestinationsOneSlackOneThreadReportsDefault = true
export const visionScannersScoutsCreateBodyConfigOneRunCronScheduleMax = 100

export const visionScannersScoutsCreateBodyVariantAnalysisDefault = false

export const VisionScannersScoutsCreateBody = /* @__PURE__ */ zod
    .object({
        display_name: zod
            .string()
            .max(visionScannersScoutsCreateBodyDisplayNameMax)
            .optional()
            .describe(
                "Name shown wherever people identify this scout, written however you want it — spaces, capitalization, and acronyms are kept as typed, and two scouts may share one. It does not change the scout's skill name, which stays its identity, so renaming a scout keeps its schedule, run history, notes, memory, and links. At most 200 characters; blank means the scout has no name of its own and is labelled from its skill name instead."
            ),
        name: zod
            .string()
            .max(visionScannersScoutsCreateBodyNameMax)
            .optional()
            .describe(
                'Optional skill name for the scout — its permanent identifier, containing only lowercase letters, numbers, and hyphens. Omit it and one is generated from `display_name` (`My APM scout` becomes `my-apm-scout`), with a numeric suffix when that name is taken. Pass it to pick the identifier yourself, or to keep a client written before display names working unchanged. The `signals-scout-` prefix is optional.'
            ),
        description: zod
            .string()
            .max(visionScannersScoutsCreateBodyDescriptionMax)
            .describe('Short description of the signal or behavior this scout investigates.'),
        body: zod
            .string()
            .describe(
                'Complete markdown prompt executed on every scout run. Include any project-specific signal names, thresholds, investigation steps, and report criteria here.'
            ),
        config: zod
            .object({
                model: zod
                    .string()
                    .max(visionScannersScoutsCreateBodyConfigOneModelMax)
                    .nullish()
                    .describe(
                        "Optional model id this scout's runs are pinned to, e.g. `claude-opus-4-5`. Must be one of the platform's agent models; an invalid id is rejected with the available ones listed. Null keeps the default model, chosen by the platform. Early access: the pin can only be set on projects enrolled in the scout model preview, and only takes effect there. Set null to clear it."
                    ),
                tags: zod
                    .array(zod.string())
                    .max(visionScannersScoutsCreateBodyConfigOneTagsMax)
                    .optional()
                    .describe(
                        'Free-form labels for grouping the fleet, e.g. `[\"revenue\", \"on-call\"]`. Normalized to lowercase kebab-case (`On Call` and `on_call` both become `on-call`), deduped, and stored sorted; at most 10 tags, each at most 50 characters once normalized. Pass the full desired set — a write replaces the existing tags rather than merging into them. Filter the config list with the `tags` query parameter.'
                    ),
                structured_output_schema: zod
                    .record(zod.string(), zod.unknown())
                    .nullish()
                    .describe(
                        'Optional JSON Schema (draft 2020-12) describing ONE structured record this scout produces via `scout-record-output` — e.g. a per-report quality judgment (`{\"type\": \"object\", \"properties\": {\"verdict\": {\"enum\": [\"good\", \"bad\", \"unsure\"]}, \"reason\": {\"type\": \"string\"}}, \"required\": [\"verdict\", \"reason\"]}`). The root must be `\"type\": \"object\"`. Setting a schema turns the structured-output channel on: the run prompt renders the schema and every submitted record is validated against it and recorded in the project as a `$scout_structured_output` event, queryable like any event. The channel also requires emit — a dry-run scout has nowhere to record to. Cardinality is the scout\'s call (one record per run, one per judged entity, ...). Null = channel off. Setting a schema requires skill-authoring authorization (the `llm_skill:write` scope and skill editor access) since the scout reads it verbatim in its prompt; clearing it needs only the config write. Records validate against the schema in force when the run was dispatched.'
                    ),
                mcp_gateway_server_ids: zod
                    .array(zod.uuid())
                    .max(visionScannersScoutsCreateBodyConfigOneMcpGatewayServerIdsMax)
                    .optional()
                    .describe(
                        "MCP gateway servers (by id) this scout's runs may use, chosen from the connections members shared to the whole team. Selection is per scout: an empty list gives the scout no MCP servers. Applies from the scout's next run."
                    ),
                repositories: zod
                    .array(zod.string().max(visionScannersScoutsCreateBodyConfigOneRepositoriesItemMax))
                    .max(visionScannersScoutsCreateBodyConfigOneRepositoriesMax)
                    .optional()
                    .describe(
                        "GitHub repositories this scout clones into its sandbox, each in `organization\/repo` format. Set them for a scout that reads code, so it can search the tree and run the project's own tests instead of reading files one API call at a time. Empty (the default) leaves the sandbox without a checkout. The scout's GitHub access stays read-only either way, so a repository listed here is never writable from a run. At most 10, each reachable through the project's GitHub connection. Applies from the scout's next run."
                    ),
                write_scopes: zod
                    .array(zod.string())
                    .max(visionScannersScoutsCreateBodyConfigOneWriteScopesMax)
                    .optional()
                    .describe(
                        "Write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `canvas:write`, `customer_task:write`, `dashboard:write`, `event_definition:write`, `experiment:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `notebook:write`, `replay_scanner:write`, `ticket:write`, `warehouse_table:write`, `warehouse_view:write`. A new scout starts with `notebook:write` when this field is omitted. Empty means the scout reads the project and writes only its findings and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. `ticket:write` lets the scout update tickets, manage saved views, and add private notes. Scouts cannot send public replies, compose emails, change existing notes, or change customer identity fields. Ticket changes can start workflows that message customers. `event_definition:write` lets the scout change the tags on event definitions and nothing else. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant, and a run that acts as a project member other than the author holds only the default scopes. Applies from the scout's next run."
                    ),
                lifecycle_locked: zod
                    .boolean()
                    .optional()
                    .describe(
                        "Opt-in guard on this scout's lifecycle. Off by default, so anyone with scout write access may pause, resume, switch the scout to dry run, or delete it. On, only the person the scout's runs act as or a project admin may do any of those, or change this flag. Use it on a scout whose output people depend on: `signal_scout:write` is a project-wide scope held by people and by unattended agents alike, and a resume has to pass the project's enabled-scout maximum that a pause does not, so a bulk pause is not undone in one step. The lock never stops an automatic pause, such as the inactivity sweep or the repeated-failure breaker."
                    ),
                allowed_mcp_tools: zod
                    .array(zod.string())
                    .nullish()
                    .describe(
                        'Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.'
                    ),
                tool_preset: zod
                    .enum(['read_only', 'support_notes'])
                    .describe('\* `read_only` - Read only\n\* `support_notes` - Support notes')
                    .optional()
                    .describe(
                        'Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n\* `read_only` - Read only\n\* `support_notes` - Support notes'
                    ),
                precheck_query: zod
                    .string()
                    .max(visionScannersScoutsCreateBodyConfigOnePrecheckQueryMax)
                    .nullish()
                    .describe(
                        "Optional HogQL `SELECT` a scheduled run evaluates before it starts. When it returns no rows, or one row with one false value (`false`, `0`, null or empty), the run is skipped: no sandbox, no model call, and no run row. Any other result starts the run, and the scout reads the rows. A query error also starts the run. Use `{since}` (the start of the last run that ran, or when the scout was created) and `{now}` to look only at what is new, e.g. `SELECT count() FROM events WHERE event = '$exception' AND timestamp > {since}`. To run at least once a week however quiet it is, add `OR {since} < {now} - INTERVAL 7 DAY` to the condition. Only scheduled runs evaluate it: a manual or workflow run always starts. `{interval_minutes}` is the gap between two scheduled runs, so a backstop can follow the schedule: `{since} < {now} - toIntervalMinute(greatest(1440, 2 \* {interval_minutes}))` runs at least daily and never more often than every two intervals. The query stops after 10 seconds and reads at most 50 rows. Try a query with `scout-config-precheck-test` before you save it. Null or blank uses the default pre-check the scout's skill ships, if any. To turn every pre-check off, set `precheck_disabled`."
                    ),
                enabled: zod
                    .boolean()
                    .optional()
                    .describe('Whether this scout runs on its schedule. Defaults to true.'),
                emit: zod
                    .boolean()
                    .optional()
                    .describe(
                        'Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. Defaults to true.'
                    ),
                run_interval_minutes: zod
                    .number()
                    .min(visionScannersScoutsCreateBodyConfigOneRunIntervalMinutesMin)
                    .max(visionScannersScoutsCreateBodyConfigOneRunIntervalMinutesMax)
                    .optional()
                    .describe('Minutes between runs (30–43200). Defaults to 1440 (every 24 hours).'),
                output_destinations: zod
                    .object({
                        slack: zod
                            .union([
                                zod.object({
                                    integration_id: zod
                                        .number()
                                        .min(1)
                                        .describe(
                                            "ID of the Slack integration whose bot posts this scout's findings and reports."
                                        ),
                                    channel: zod
                                        .string()
                                        .max(
                                            visionScannersScoutsCreateBodyConfigOneOutputDestinationsOneSlackOneChannelMax
                                        )
                                        .nullish()
                                        .describe(
                                            "Slack channel target in the channel picker's `channel_id|#channel-name` format. Null while choosing a channel; no messages are sent until a channel or user is set."
                                        ),
                                    users: zod
                                        .array(
                                            zod
                                                .string()
                                                .max(
                                                    visionScannersScoutsCreateBodyConfigOneOutputDestinationsOneSlackOneUsersItemMax
                                                )
                                                .regex(
                                                    visionScannersScoutsCreateBodyConfigOneOutputDestinationsOneSlackOneUsersItemRegExp
                                                )
                                        )
                                        .min(1)
                                        .max(
                                            visionScannersScoutsCreateBodyConfigOneOutputDestinationsOneSlackOneUsersMax
                                        )
                                        .nullish()
                                        .describe(
                                            'Slack members to send output to as direct messages, each in `member_id|@display-name` format (a bare member ID like `U0123ABC456` also works). Each member gets their own DM from the PostHog app; at most 5. Set either this or `channel`, not both. Useful for personal scouts where a DM beats a channel.'
                                        ),
                                    thread_reports: zod
                                        .boolean()
                                        .default(
                                            visionScannersScoutsCreateBodyConfigOneOutputDestinationsOneSlackOneThreadReportsDefault
                                        )
                                        .describe(
                                            "When true, post a report as a thread: a short lead in the channel and the rest split into replies at the summary's section labels, which can be Markdown headings or bold labels. Keeps a long summary from being clipped at Slack's section limit. On by default; set it false to post a single message, which can truncate a long summary. It does not change how findings post."
                                        ),
                                }),
                                zod.null(),
                            ])
                            .optional()
                            .describe(
                                'Slack destination for each emitted scout finding or report. Null or omitted disables Slack delivery.'
                            ),
                        webhook: zod
                            .union([
                                zod.object({
                                    hog_function_id: zod
                                        .string()
                                        .describe(
                                            "Id of the CDP destination delivering this scout's reports. Set by the product that provisioned it, so it can find that destination again to update or remove it."
                                        ),
                                }),
                                zod.null(),
                            ])
                            .optional()
                            .describe(
                                "The CDP destination another product provisioned for this scout's reports. Null or omitted means no webhook. Unlike Slack, Signals does not deliver this itself: the reference lives here so the owning product can manage the destination's lifecycle."
                            ),
                        inbox: zod
                            .boolean()
                            .optional()
                            .describe(
                                "Whether this scout's reports appear in the shared inbox. Defaults to true. Set false to keep the reports this scout authors out of the inbox and its Slack notifications, for example for a digest scout read in Slack. Reports this scout only edits are not affected. An update that omits this key keeps the stored value."
                            ),
                    })
                    .optional()
                    .describe('Destinations that receive each finding or report this scout emits. Empty by default.'),
                network_access: zod
                    .enum(['trusted', 'full'])
                    .describe('\* `trusted` - Trusted domains only\n\* `full` - Full')
                    .optional()
                    .describe(
                        "What the scout's sandbox can reach over the network while it runs. Defaults to `trusted`, the platform's trusted-domain allowlist (PostHog, GitHub, common package registries). Set `full` to let this scout reach any site, for skills that read external sources such as documentation or papers.\n\n\* `trusted` - Trusted domains only\n\* `full` - Full"
                    ),
                auto_pause_exempt: zod
                    .boolean()
                    .optional()
                    .describe(
                        'Exempt this scout from the inactivity pause, which otherwise switches off a scout that goes a fortnight without surfacing anything anyone engages with. Set it on watchdog scouts whose value is staying quiet. Defaults to false.'
                    ),
                run_cron_schedule: zod
                    .string()
                    .max(visionScannersScoutsCreateBodyConfigOneRunCronScheduleMax)
                    .nullish()
                    .describe(
                        "Optional five-field cron expression, e.g. '30 9 \* \* \*' (daily at 09:30), '0 9,17 \* \* \*' (twice daily), or '0 9 \* \* 1-5' (weekday mornings). Evaluated in the project timezone. Takes precedence over `run_interval_minutes`; occurrences must be at least 30 minutes apart."
                    ),
            })
            .describe('Schedule, enablement, and delivery options accepted while creating a scout.')
            .optional()
            .describe(
                'Optional schedule, enablement, dry-run posture, and delivery settings. Defaults to an enabled, emitting scout on the daily interval with no external destination.'
            ),
        variant_analysis: zod
            .boolean()
            .default(visionScannersScoutsCreateBodyVariantAnalysisDefault)
            .describe(
                "Make this the experiment scanner's variant analysis scout: its runs record a structured comparison of the variants, which the scanner's variants readout shows. Experiment scanners only."
            ),
        template_key: zod
            .enum([
                'variant-analysis',
                'daily-digest',
                'root-cause',
                'weekly-themes',
                'trend-watch',
                'new-issues',
                'scratch',
            ])
            .describe(
                '\* `variant-analysis` - Variant analysis\n\* `daily-digest` - Daily digest\n\* `root-cause` - Root cause\n\* `weekly-themes` - Weekly themes\n\* `trend-watch` - Trend watch\n\* `new-issues` - New issue watch\n\* `scratch` - Start from scratch'
            )
            .optional()
            .describe(
                'The template the body came from. A body left exactly as the template rendered it keeps following later edits to that template; an edited body stays as written.\n\n\* `variant-analysis` - Variant analysis\n\* `daily-digest` - Daily digest\n\* `root-cause` - Root cause\n\* `weekly-themes` - Weekly themes\n\* `trend-watch` - Trend watch\n\* `new-issues` - New issue watch\n\* `scratch` - Start from scratch'
            ),
    })
    .describe(
        "A scout to stand up for this scanner. The scanner comes from the URL, never the body: it is\nwhat the caller's access is checked against, and what the scout is recorded as belonging to.\n\nInherits the Signals scout definition so a scout created here clears the same name and prompt-size\nbars as one created through the generic endpoint."
    )

/**
 * Draft a full scanner configuration from a natural-language goal and a monthly credit budget.
 */
export const visionScannersDraftCreateBodyGoalMax = 2000

export const visionScannersDraftCreateBodyMonthlyCreditBudgetMax = 100000000

export const visionScannersDraftCreateBodyFreeOnlyDefault = false
export const visionScannersDraftCreateBodyExperimentIdMax = 2147483647

export const VisionScannersDraftCreateBody = /* @__PURE__ */ zod
    .object({
        goal: zod
            .string()
            .max(visionScannersDraftCreateBodyGoalMax)
            .describe("What the user wants to accomplish, e.g. 'find out where users get stuck during onboarding'."),
        monthly_credit_budget: zod
            .number()
            .min(1)
            .max(visionScannersDraftCreateBodyMonthlyCreditBudgetMax)
            .optional()
            .describe(
                'Credits a month to spend (1 credit = $0.01). The draft picks the `model`, then solves `sampling_mode` and `sampling_rate` so the projected spend lands on this number, and sets `credit_limit` to it as a hard cap. Ask the person for it rather than guessing. Required unless `free_only` is true, and not allowed with it.'
            ),
        free_only: zod
            .boolean()
            .default(visionScannersDraftCreateBodyFreeOnlyDefault)
            .describe(
                "Draft a scanner that runs only on the organization's free monthly credits, so it never adds to the bill and pauses when they run out. The draft is sized to those free credits and comes back with `free_only` true and no `credit_limit`. Use instead of `monthly_credit_budget`."
            ),
        experiment_id: zod
            .number()
            .min(1)
            .max(visionScannersDraftCreateBodyExperimentIdMax)
            .optional()
            .describe(
                'A launched experiment the person picked for the scanner to watch. The draft is then an `experiment` scanner on it.'
            ),
        query: zod
            .unknown()
            .optional()
            .describe(
                "A `RecordingsQuery` the person already chose, as the replay list holds it. The draft starts from it and never removes or widens it. When the goal asks for narrower recordings, the draft can AND its own page, event, action or cohort filters onto it. It keeps them only when the combined filter still matches recent recordings, returns them in `query_additions`, and sizes the sampling dials against the combined `query`. `experiment_exposure` becomes the scanner's experiment and variants, which the draft keeps as they are. `date_from`\/`date_to` are dropped, because a scanner's schedule owns time. `comment_text`, `hide_viewed_recordings` and in-session exposure are refused, because a scanner cannot apply them. A query with no filters starts from every new recording. Omit to let the draft pick the sessions."
            ),
    })
    .describe("Body of POST \/vision\/scanners\/draft\/ — the user's goal, stated in their own words.")

/**
 * Estimate the observation volume a proposed scanner would generate, for the pre-save cost preview.
 */
export const visionScannersEstimateCreateBodySamplingRateDefault = 1
export const visionScannersEstimateCreateBodySamplingRateMin = 0
export const visionScannersEstimateCreateBodySamplingRateMax = 1

export const visionScannersEstimateCreateBodySamplingModeDefault = `comprehensive`
export const visionScannersEstimateCreateBodyModelDefault = `gemini-3-flash-preview`
export const visionScannersEstimateCreateBodyExperimentTargetingOneVariantMax = 400

export const visionScannersEstimateCreateBodyExperimentOneVariantsItemMax = 400

export const VisionScannersEstimateCreateBody = /* @__PURE__ */ zod
    .object({
        query: zod
            .unknown()
            .optional()
            .describe(
                'Proposed `RecordingsQuery` for the candidate filter. `date_from`\/`date_to` are ignored — the estimate scans a recent window (`window_days` in the response) and scales it to 30 days. Omit to estimate against all recordings.'
            ),
        sampling_rate: zod
            .number()
            .min(visionScannersEstimateCreateBodySamplingRateMin)
            .max(visionScannersEstimateCreateBodySamplingRateMax)
            .default(visionScannersEstimateCreateBodySamplingRateDefault)
            .describe('0..1 downsample applied to matched sessions. Defaults to 1.0 (no downsampling).'),
        sampling_mode: zod
            .enum(['focused', 'balanced', 'comprehensive'])
            .describe('\* `focused` - Focused\n\* `balanced` - Balanced\n\* `comprehensive` - Comprehensive')
            .default(visionScannersEstimateCreateBodySamplingModeDefault)
            .describe(
                "Quality pre-filter applied to the matched-session count, mirroring the sweep's candidate query. Defaults to comprehensive (no filter).\n\n\* `focused` - Focused\n\* `balanced` - Balanced\n\* `comprehensive` - Comprehensive"
            ),
        scanner_id: zod
            .uuid()
            .nullish()
            .describe(
                "The scanner being edited, excluded from `other_enabled_scanners_monthly_credits` so its stored estimate isn't double-counted in the forecast. Omit (or null) when estimating a brand-new scanner."
            ),
        model: zod
            .enum(['gemini-3.5-flash-lite', 'gemini-3-flash-preview', 'gemini-3.8-flash'])
            .describe(
                '\* `gemini-3.5-flash-lite` - Gemini 3.5 Flash Lite\n\* `gemini-3-flash-preview` - Gemini 3 Flash\n\* `gemini-3.8-flash` - Gemini 3.8 Flash'
            )
            .default(visionScannersEstimateCreateBodyModelDefault)
            .describe(
                'Proposed model; determines `credits_per_observation` in the response.\n\n\* `gemini-3.5-flash-lite` - Gemini 3.5 Flash Lite\n\* `gemini-3-flash-preview` - Gemini 3 Flash\n\* `gemini-3.8-flash` - Gemini 3.8 Flash'
            ),
        experiment_targeting: zod
            .union([
                zod
                    .object({
                        experiment_id: zod.number().min(1).describe('The experiment the scanner watches.'),
                        variant: zod
                            .string()
                            .max(visionScannersEstimateCreateBodyExperimentTargetingOneVariantMax)
                            .nullish()
                            .describe(
                                'Narrow to sessions of people exposed to this variant. Null means every variant.'
                            ),
                    })
                    .describe(
                        "The experiment a scanner watches. Scans derive their person-scoped exposure filter from\nthis blob at query time, so it is the only place an experiment can enter a scanner's\ntargeting — which is what lets the write-side access check and read-side redaction cover it."
                    ),
                zod.null(),
                zod.null(),
            ])
            .optional()
            .describe(
                'Proposed experiment targeting, merged into the query as its exposure filter the same way a saved scanner derives it. The estimate then runs as the requesting user.'
            ),
        experiment: zod
            .union([
                zod.object({
                    experiment_id: zod.number().min(1).describe('The experiment an experiment scanner watches.'),
                    variants: zod
                        .array(zod.string().max(visionScannersEstimateCreateBodyExperimentOneVariantsItemMax))
                        .min(1)
                        .nullish()
                        .describe('The variant keys it watches. Null or omitted means every variant.'),
                }),
                zod.null(),
            ])
            .optional()
            .describe(
                'For an experiment scanner: the `experiment_id` and `variants` it will keep in its config, merged into the query as its exposure filter so the estimate counts only exposed sessions. Not combined with `experiment_targeting`.'
            ),
    })
    .describe('Body of POST \/vision\/scanners\/estimate\/ — a proposed, unsaved scanner config.')

/**
 * Record that the calling user saw these cards in the Highlights feed, so the feed ranks them lower next time.
 */
export const visionScannersHighlightFeedImpressionsCreateBodyObservationIdsMax = 100

export const VisionScannersHighlightFeedImpressionsCreateBody = /* @__PURE__ */ zod
    .object({
        feed_load_id: zod
            .uuid()
            .describe("The client's id for the feed load that showed these cards. One load counts each card once."),
        observation_ids: zod
            .array(zod.uuid())
            .min(1)
            .max(visionScannersHighlightFeedImpressionsCreateBodyObservationIdsMax)
            .describe(
                'Observations the calling user saw in the Highlights feed, at most 100. Ids the user cannot read are ignored.'
            ),
    })
    .describe('Body of POST \/vision\/scanners\/highlight_feed_impressions\/.')

/**
 * Scan named sessions against a prompt without saving a scanner first, for one-off questions.
 *
 * The config resolves to a scanner minted on first use, so asking the same question twice reuses
 * the observations it already has, while a different question about the same session gets its own.
 *
 * With `scanner_type` set to `summarizer`, this is how you get PostHog's own AI summary for a
 * recording ID. It resolves to the Summarize button's own scanner only when the prompt and
 * `scanner_config` match what the button sends, since the config is what the key fingerprints.
 */
export const visionScannersInlineScanCreateBodyPromptMax = 20000

export const visionScannersInlineScanCreateBodyModelDefault = `gemini-3-flash-preview`
export const visionScannersInlineScanCreateBodySessionIdsItemMax = 128

export const visionScannersInlineScanCreateBodySessionIdsMax = 200

export const VisionScannersInlineScanCreateBody = /* @__PURE__ */ zod
    .object({
        built_in: zod
            .enum(['summarize_recording'])
            .describe('\* `summarize_recording` - Summarize recording')
            .optional()
            .describe(
                'Run a scan PostHog defines instead of your own prompt. `summarize_recording` is the AI summary the Summarize button in the replay player runs, so its results are shared with that button. Leave out `prompt`, `scanner_type` and `scanner_config` when this is set.\n\n\* `summarize_recording` - Summarize recording'
            ),
        prompt: zod
            .string()
            .max(visionScannersInlineScanCreateBodyPromptMax)
            .optional()
            .describe(
                'What to look for in these sessions, in plain language. The same instruction a saved scanner carries. Required unless `built_in` is set.'
            ),
        scanner_type: zod
            .enum(['monitor', 'classifier', 'scorer', 'summarizer', 'experiment'])
            .describe(
                '\* `monitor` - Monitor\n\* `classifier` - Classifier\n\* `scorer` - Scorer\n\* `summarizer` - Summarizer\n\* `experiment` - Experiment'
            )
            .optional()
            .describe(
                "What the scan produces. Defaults to monitor, an open-ended observation against the prompt. Use `summarizer` for a summary in your own words; use `built_in: summarize_recording` for the Summarize button's summary. An inline scan is keyed by its whole config, so asking the same question again reuses its answers.\n\n\* `monitor` - Monitor\n\* `classifier` - Classifier\n\* `scorer` - Scorer\n\* `summarizer` - Summarizer\n\* `experiment` - Experiment"
            ),
        scanner_config: zod
            .unknown()
            .optional()
            .describe(
                'Type-specific configuration beyond the prompt: `tags` for a classifier, `scale` for a scorer, optional `length` for a summarizer. Omit it for a monitor. `prompt` belongs in the `prompt` field and is rejected here.'
            ),
        model: zod
            .enum(['gemini-3.5-flash-lite', 'gemini-3-flash-preview', 'gemini-3.8-flash'])
            .describe(
                '\* `gemini-3.5-flash-lite` - Gemini 3.5 Flash Lite\n\* `gemini-3-flash-preview` - Gemini 3 Flash\n\* `gemini-3.8-flash` - Gemini 3.8 Flash'
            )
            .default(visionScannersInlineScanCreateBodyModelDefault)
            .describe(
                'Model to scan with. Determines what each observation costs in credits.\n\n\* `gemini-3.5-flash-lite` - Gemini 3.5 Flash Lite\n\* `gemini-3-flash-preview` - Gemini 3 Flash\n\* `gemini-3.8-flash` - Gemini 3.8 Flash'
            ),
        session_ids: zod
            .array(zod.string().max(visionScannersInlineScanCreateBodySessionIdsItemMax))
            .max(visionScannersInlineScanCreateBodySessionIdsMax)
            .describe(
                'Session recording IDs to scan, at most 200 per request. Scans start until the in-flight limit or monthly credit quota is reached; the rest are reported as skipped rather than failing the whole batch.'
            ),
    })
    .describe(
        'Body of POST \/vision\/scanners\/inline_scan\/ - a prompt or built-in scan plus the sessions to point it at.'
    )