---@meta

---Generated from the Hexis Lua v4 runtime registry.
---@class HexisActionHandle
---@class HexisEventSubscription
---@alias HexisActionCode 'aim_failed'|'arrival_unconfirmed'|'authority_lost'|'break_unconfirmed'|'busy'|'cancelled'|'component_too_large'|'denied'|'gui_precondition_failed'|'internal_error'|'invalid_argument'|'item_not_found'|'navigation_failed'|'ok'|'player_dead'|'player_low_health'|'screen_changed'|'screen_closed'|'search_node_limit'|'target_lost'|'terrain_incomplete'|'timeout'|'unreachable'|'world_changed'

---@class HexisActionResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data table Result payload.

---@class HexisBlockHighlight
---@field position HexisBlockPosition The block to outline.
---@field tone? 'neutral'|'good'|'warn'|'bad'|'highlight'|'muted' What the outline means. Defaults to highlight.
---@field alpha? number Fill opacity, 0 through 1. Defaults to 0.8.

---@class HexisBlockPosition
---@field x number Block X coordinate.
---@field y number Block Y coordinate.
---@field z number Block Z coordinate.

---@class HexisBlockSelector
---@field block_ids string[] 1 to 16 namespaced block IDs.

---@class HexisCatchCreatureResult
---@field species string Requested provider-neutral species key.
---@field caught boolean Whether the server confirmed the catch.

---@class HexisChatFilter
---@field contains_any string[] 1 to 8 substrings. A message matching any of them is delivered.
---@field case_sensitive? boolean Defaults to false.

---@class HexisCrosshairObservation
---@field world_generation number World generation.
---@field observed_tick number Tick the read ran.
---@field kind 'miss'|'block'|'entity' What the crosshair is on.
---@field hit_position? HexisPosition Exact hit point. Absent when kind is miss.
---@field distance? number Distance from the eye. Absent when kind is miss.
---@field block? {position: HexisBlockPosition, block_id: string, face: string} Present when kind is block.
---@field entity? HexisEntityObservation Present when kind is entity.

---@class HexisEntityArea
---@field kind 'radius'|'box' Which area shape follows.
---@field radius? number Radius area only: 0.5 through 256 blocks around the player. The client only tracks entities inside its own entity render distance, so a large radius bounds the request rather than promising reach.
---@field minimum? HexisPosition Box area only: lower corner.
---@field maximum? HexisPosition Box area only: upper corner, at most 128 blocks per axis from minimum.

---@class HexisEntityHighlight
---@field ref HexisEntityRef An entity reference from an observation.
---@field tone? 'neutral'|'good'|'warn'|'bad'|'highlight'|'muted' What the outline means. Defaults to highlight.
---@field alpha? number Outline opacity, 0 through 1. Defaults to 0.8.

---@class HexisEntityObservation
---@field ref HexisEntityRef Pass this back to an action to target it.
---@field type_id string Namespaced entity type ID.
---@field name string Display name at observation time.
---@field position HexisPosition World position.
---@field distance number Distance from the player in blocks.
---@field alive boolean False once the entity died or was removed. A living entity at zero health counts as dead, because some servers keep the body around for a moment after the kill.
---@field sneaking boolean Whether the entity is sneaking.
---@field visible boolean True when nothing solid stands between your eye and the entity's body. Targets without this are ones you would only fail to hit.
---@field view_angle number Degrees between where you are looking and the entity. Turning is the slow part of engaging anything, so score on this when choosing between targets.
---@field labels string[] Nearby armour-stand name text. Heuristic evidence, not ownership.
---@field labels_contain_self_name boolean True when a nearby label contains the local player's name.
---@field health? number Living entities only.
---@field max_health? number Living entities only.
---@field carried_block_id? string Endermen only: the block being carried.

---@class HexisEntityQuery
---@field area HexisEntityArea Where to look.
---@field selector HexisEntitySelector What counts as a match.
---@field limit number 1 through 32 results.

---@class HexisEntityRef
---@field id string Opaque entity identity from an observation.
---@field world_generation number World generation the reference was observed in.

---@class HexisEntitySelector
---@field type_ids string[] 1 to 8 namespaced entity type IDs, such as minecraft:enderman.
---@field exclude_self? boolean Skip the local player. Defaults to true.
---@field tablist_only? boolean Only match players present in the tab list. Defaults to false.

---@class HexisEntityTarget
---@field ref HexisEntityRef An entity reference from an observation.

---@class HexisFarmingCheckpoint
---@field version number Checkpoint format version, currently 1.
---@field recipe string Native recipe fingerprint.
---@field world_generation number Original world generation.
---@field position HexisPosition Stable feet position.
---@field section number One-based section.
---@field pass number One-based pass.
---@field floor string Loaded floor fingerprint.

---@class HexisFarmingRecipe
---@field crop {block_ids: string[], maturity?: {property: string, at_least: number}, keep_base?: boolean, target_height?: number} What to harvest.
---@field movement {pattern?: 'single_lane'|'alternating_rows', look?: {mode?: 'auto'|'fixed', yaw?: number, pitch?: number}, sections: ({name: string, passes: ('W'|'A'|'S'|'D'|'W+A'|'W+D'|'S+A'|'S+D'|'Auto')[]})[], initial_section?: number, remember_section?: boolean, reaction_delay_ms?: {minimum?: number, maximum?: number}} Physical movement recipe.
---@field tool {name_patterns: string[]} Tool selection.
---@field health? {zero_break_seconds?: number, critical?: {below_bps?: number, window_seconds?: number}, warning?: {below_bps?: number, for_seconds?: number}} Measured natively, independently of HUD polling.

---@class HexisFarmingSnapshot
---@field phase 'starting'|'harvesting'|'switching_row'|'changing_section'|'recovering'|'terminal' Current task phase.
---@field elapsed_seconds number Wall time of this action.
---@field world_generation? number World generation after startup.
---@field look? {yaw: number, pitch: number} Resolved once during startup.
---@field section? number One-based section.
---@field section_name? string Recipe section name.
---@field pass? number One-based active pass.
---@field bps number Rolling local predicted breaks per second.
---@field window_seconds? number Configured BPS averaging window; available after startup.
---@field session_bps number Average over observed active time.
---@field blocks number Matching local predicted breaks.
---@field complete boolean Whether a full continuous rate window is available.
---@field health? {severity: 'info'|'warning'|'critical', reason: string, message: string} Latest health observation.
---@field checkpoint? HexisFarmingCheckpoint Stable resume hint; absent until available.

---@class HexisFireTiming
---@field reaction_ms number Delay before engaging a new target, 0 through 750. Paid once per call, not once per shot.
---@field dwell_ms number Time held on target before firing, 50 through 500.
---@field cooldown_ms number Minimum time between shots, 250 through 2000.
---@field aim_speed? number How hard the camera drives toward the target, 0.5 through 8. Defaults to 2.5. Higher turns faster and looks less like a person.

---@class HexisGuiChangedFilter
---@field screen HexisGuiScreenGenerationRef The screen generation to watch.
---@field after_revision number Only deliver changes past this revision.
---@field slots? number[] Restrict delivery to these slot indexes.

---@class HexisGuiItem
---@field empty boolean True when the slot holds nothing.
---@field id string Namespaced item ID.
---@field name string Display name.
---@field count number Stack size.
---@field lore string[] Visible lore lines.
---@field lore_truncated boolean True when lore was cut to the line bound.

---@class HexisGuiOpenedFilter
---@field title_contains_any? string[] 1 to 8 substrings matched against the screen title. Absent matches any screen.
---@field case_sensitive? boolean Defaults to false.
---@field slot_count? number Only deliver screens with exactly this many slots.

---@class HexisGuiOperation
---@field kind 'activate'|'close' What to do with the screen.
---@field target? HexisGuiSlotRef activate only: the slot to click.
---@field guards? HexisGuiSlotRef[] activate only: slots that must be unchanged for the click to apply.

---@class HexisGuiScreen
---@field generation number Increments when the screen is replaced.
---@field revision number Increments on every observed slot change.
---@field title string Screen title text.
---@field slot_count number Number of slots in the screen.
---@field hovered_slot number Zero-based slot under the cursor, or -1 when none is.
---@field slots HexisGuiSlot[] Every slot in index order.

---@class HexisGuiScreenGenerationRef
---@field generation number Screen generation from gui.snapshot.

---@class HexisGuiScreenRef
---@field generation number Screen generation from gui.snapshot.
---@field revision number Screen revision the script reasoned about.

---@class HexisGuiSlot
---@field ref HexisGuiSlotRef Pass this to gui.transact.
---@field index number Zero-based slot index.
---@field item HexisGuiItem Slot contents.

---@class HexisGuiSlotRef
---@field screen_generation number Generation the slot was observed in.
---@field observed_revision number Revision the slot was observed in.
---@field index number Zero-based slot index.
---@field fingerprint string Slot content fingerprint at observation time.

---@class HexisHarvestPatchResult
---@field blocks_confirmed number Server-confirmed patch changes.
---@field idle_complete boolean The patch stayed empty through its idle bound.
---@field residual_targets HexisBlockPosition[] Bounded remaining patch targets.
---@field source_incomplete boolean Patch evidence was incomplete.

---@class HexisHarvestTreeResult
---@field blocks_confirmed number Server-confirmed component changes.
---@field component_complete boolean No selected-component work remains.
---@field selected_seed table Seed anchoring the selected component.
---@field residual_targets HexisBlockPosition[] Bounded crown residuals inside the selected component.
---@field excluded_seeds HexisBlockPosition[] Component seeds rejected by the tree policy.
---@field source_incomplete boolean Component evidence was incomplete.

---@class HexisHudReading
---@field label? string Label, at most 26 characters.
---@field value? string Reading, at most 32 characters.
---@field detail? string Status, at most 32 characters.
---@field tone? 'neutral'|'good'|'warn'|'bad'|'highlight'|'muted' Semantic color; default neutral.
---@field unit? string Suffix, at most 8 characters.

---@class HexisHudRow
---@field kind 'value'|'meter'|'note'|'metric'|'chart' value is a reading, meter adds a bar, note is text, metric is a prominent reading, chart plots evenly spaced samples.
---@field label? string value and meter: left column, at most 26 characters.
---@field value? string value and meter: right column, at most 32 characters.
---@field detail? string value and meter: a dimmer second line under the row, at most 32 characters.
---@field text? string note only: the line to show, at most 48 characters.
---@field tone? 'neutral'|'good'|'warn'|'bad'|'highlight'|'muted' What the reading means. The client owns the palette. Defaults to neutral.
---@field progress? number meter only: 0 through 1.
---@field secondary? HexisHudReading metric or value only: a second reading beside the first.
---@field samples? number[] chart only: at most 60 equally spaced finite nonnegative values, at most 1e12 each. Gaps require starting a new series.
---@field reference? {value: number, label?: string} chart only: dotted comparison line included in the vertical scale.
---@field icon? string Namespaced item ID drawn before the label, such as minecraft:writable_book.
---@field format? 'text'|'coordinates' coordinates splits three numbers and tints one per axis.
---@field unit? string A dimmed suffix such as m or /hr, at most 8 characters.

---@class HexisHudSection
---@field title? string Section heading, at most 28 characters. Omit for rows without a heading.
---@field rows HexisHudRow[] At most 8 rows.
---@field accent? 'neutral'|'good'|'warn'|'bad'|'highlight'|'muted' Colours this section's rail or heading. Defaults to highlight.
---@field style? 'rail'|'spaced'|'hairline' Overrides the panel style for this section alone.

---@class HexisHudStatus
---@field uptime? boolean Show a running clock beside the name. Defaults to false.
---@field phase? string The script's own word for what it is doing, at most 32 characters.

---@class HexisInteractTarget
---@field kind 'air'|'block'|'entity' What is being used on.
---@field position? HexisBlockPosition block only: the block to use on.
---@field toward? HexisBlockPosition air only: aim here first, then press. For abilities that act at a distance; vanilla decides what the press does, exactly as for a player.
---@field ref? HexisEntityRef entity only: the entity to use on.

---@class HexisInventoryMatch
---@field name string Display name of the matched stack.
---@field id string Namespaced item ID.
---@field count number Total items across every matching stack.
---@field stacks number How many stacks matched.
---@field matched_pattern string Which requested pattern matched.

---@class HexisInventorySelector
---@field name_patterns string[] 1 to 8 case-insensitive substrings matched against item display names.
---@field include_hotbar? boolean Defaults to true.
---@field include_main? boolean Defaults to true.

---@class HexisItemPrice
---@field id string The SkyBlock item id that was looked up.
---@field instant_sell? number Bazaar sell price.
---@field sell_order? number Bazaar buy price, what a sell order fetches.
---@field npc? number NPC counter price.
---@field bin? number Lowest BIN on the auction house.
---@field best? number The price the user's own preference resolves to. Absent when nothing quotes this item, which is not the same as it being worthless.
---@field source? 'instant_sell'|'sell_order'|'npc'|'bin' Which one best came from.
---@field age_seconds? number How stale the table is.

---@class HexisItemSelector
---@field name_patterns string[] Case-insensitive substrings; the first held match wins.

---@class HexisMeleeKite
---@field kind 'melee_kite' The only supported behaviour today.
---@field attack_range number Distance at which attacks are attempted.
---@field minimum_distance number Back off below this distance.
---@field preferred_distance number Distance the controller settles at.
---@field maximum_distance number Close in beyond this distance.
---@field maximum_pursuit_distance number Give a target up past this distance.
---@field attacks_per_second number Attack key presses per second.

---@class HexisMineralPolicy
---@field accepted_ids string[] Exact accepted block IDs.
---@field priorities? table<string, number> Optional complete 1-through-1000 ranking; higher wins.
---@field preference? {kind: 'always'|'density', preferred_ids: string[], threshold?: number} Optional preferred-resource admission.

---@class HexisMiningBreakingPolicy
---@field kind? 'server_timed'|'vanilla' Defaults to vanilla client progress.
---@field mining_speed? number Effective mining speed stat. Defaults to 500.
---@field lag_compensation_ticks? number Extra ticks to hold before release.
---@field strengths? table<string, number> Per-block strength overrides.
---@field block_ticks? table<string, number> Per-block fixed break time, 1 through 12000 ticks.
---@field hold_until_break? boolean Keep the attack key held until the server confirms the break.
---@field target_timeout_multiplier? number Retarget when a still-present block exceeds its predicted break time by this multiplier. Defaults to 2.

---@class HexisMiningSelectionCosts
---@field camera_focus_degrees? number Camera-turn tolerance with no penalty inside it, 1 through 180 degrees. Defaults to 25.
---@field camera_penalty_min_multiplier? number Minimum multiplier for camera cost outside the tolerance, 0 through 5. Defaults to 1.
---@field camera_penalty_max_multiplier? number Maximum multiplier for camera cost at a 180-degree turn, 0 through 5. Defaults to 2.
---@field distance_weight? number Nearby-target utility weight, 0 through 2. Defaults to 0.25.
---@field continuity_bonus? number Utility added for blocks within two Manhattan steps of the last mined block, 0 through 2. Defaults to 0.15.
---@field center_distance_penalty? number Displayed cost points added per Euclidean block from the retained work center, 0 through 2. Defaults to 1.
---@field creep_penalty? number Displayed cost points added when a crouch-walk nudge is required. Defaults to 15.
---@field pathfinding_penalty? number Displayed cost points added when pathfinding relocation is required. Defaults to 100.
---@field failure_penalty? number Utility removed per failed attempt, 0 through 2. Defaults to 0.30.

---@class HexisPosition
---@field x number World X coordinate.
---@field y number World Y coordinate.
---@field z number World Z coordinate.

---@class HexisProfitEstimate
---@field priced boolean Every credited quantity has this exact market price. No fallback across markets.
---@field value? number Acquisition-time estimated sale value; absent when unpriced. Selected sale form can be fractional.
---@field per_hour? number Active-duration estimated rate, absent during warmup or without prices.
---@field per_hour_current? number Rate over the latest 60 active seconds, absent during the first 30 seconds or without prices.

---@class HexisProfitHistory
---@field valuations HexisProfitHistoryValuations Separate duration-weighted market comparisons.
---@field runs HexisProfitHistoryRun[] Newest first; 64 per script, 256 device-wide. Scoped by native server/account/dimension and declared context/sale forms. Current run excluded; scheduler resumes are separate runs.
---@field available boolean False if local history could not be read or saved. Existing unreadable files are preserved.
---@field included_runs number Tracked runs lasting at least 60 active seconds with complete legacy-basis prices; known zero-yield runs are included.
---@field excluded_runs number Retained comparable runs omitted because prices, tracking or a full minute of active duration are missing.
---@field active_seconds number Combined active duration of included runs.
---@field value number Combined acquisition-time estimated item value of included runs; coins stay separate.
---@field per_hour? number Duration-weighted legacy item estimate for eligible comparable runs. Absent without an eligible run. Use valuations for explicit Bazaar and NPC estimates.

---@class HexisProfitHistoryEstimate
---@field priced boolean At least one comparable run has this market price.
---@field value? number Combined acquisition-time value of eligible runs for this market.
---@field per_hour? number Duration-weighted estimate across eligible runs, each at least 60 active seconds.
---@field included_runs number Eligible runs for this market, including tracked zero-yield runs.
---@field excluded_runs number Retained comparable runs omitted for short duration, missing prices or missing tracking.

---@class HexisProfitHistoryRun
---@field eligible boolean Tracking was observed for this run and it lasted at least 60 active seconds; prices are checked per market.
---@field valuations HexisProfitValuations Acquisition-time market estimates; per_hour is absent for ineligible runs.
---@field id string Unique local run identifier.
---@field bundle_digest string Bundle digest when this run ended.
---@field started_at number Start time in Unix seconds.
---@field ended_at number Stop time in Unix seconds.
---@field active_seconds number Active run duration, excluding scheduler breaks.
---@field coins number Self-reported coins, excluded from the history item average.
---@field priced boolean Whether every recorded item had an acquisition-time price.
---@field value? number Estimated item value, absent if any item was unpriced.
---@field items HexisProfitItem[] Recorded quantities and their evidence sources.

---@class HexisProfitHistoryValuations
---@field bazaar HexisProfitHistoryEstimate Bazaar baseline.
---@field npc HexisProfitHistoryEstimate NPC baseline.

---@class HexisProfitItem
---@field id string The SkyBlock item id.
---@field count number How many the ledger has recorded.
---@field priced boolean True only when every recorded quantity had a price at acquisition. False indicates missing or partial value; counts remain available.
---@field source 'observed'|'asserted' observed means the runtime saw it. One asserted entry makes the whole line asserted, because nothing can tell the halves apart later.
---@field value? number Coins, present only when priced.

---@class HexisProfitSummary
---@field valuations HexisProfitValuations Independent explicit sale estimates, excluding self-reported coins.
---@field sale_items table<string, string> Explicit estimated sale forms selected by this script.
---@field value number Coins from item entries, fixed as each landed.
---@field coins number Self-reported coins, kept separate on purpose.
---@field active_seconds number Seconds this script has actually been running. A break freezes it; resuming inside two hours continues the same ledger.
---@field items HexisProfitItem[] Highest value first.
---@field per_hour? number Absent until the ledger has 30 seconds of work in it, because a rate over four seconds is a number that looks precise and means nothing.
---@field per_hour_current? number Estimated hourly rate over the latest 60 active seconds, absent during the first 30 seconds.
---@field per_hour_recent? number The same over the last 15 minutes of active time, so a dry spell shows without the session figure lurching.
---@field price_age_seconds? number How stale the prices behind these values are.

---@class HexisProfitValuations
---@field bazaar HexisProfitEstimate Selected sale-form Bazaar instant-sell estimate.
---@field npc HexisProfitEstimate Selected sale-form NPC estimate.

---@class HexisSoundFilter
---@field id_contains_any string[] 1 to 8 substrings matched against the sound ID.
---@field minimum_pitch? number Drop sounds below this pitch.
---@field maximum_pitch? number Drop sounds above this pitch.
---@field maximum_distance? number Drop sounds played further than this many blocks from the player.

---@class HexisTargetHighlight
---@field range number How far to look, 1 through 100 blocks.
---@field color? 'red'|'green'|'blue'|'yellow'|'cyan'|'magenta'|'white'|'gold'|'orange'|'purple' Outline colour. Defaults to cyan.

---@class HexisTypedMiningOptions
---@field debug? boolean Publish read-only diagnostics.
---@field allow_ether_transmission? boolean Permit ether transmission during approach.
---@field breaking? HexisMiningBreakingPolicy Vanilla or server-timed break behavior.
---@field selection? {preference_reason?: 'task_required'|'user_setting'|'task_and_setting'|'density_threshold'|'always_mode', closest_camera_chance?: number, snake_far_targets?: boolean, render_costs?: boolean, costs?: HexisMiningSelectionCosts} Selection behavior and diagnostics.

---@class HexisTypedMiningResult
---@field blocks_confirmed number Server-confirmed block changes.
---@field candidates_examined number Candidates observed by discovery.
---@field source_exhausted boolean Finite source was proven exhausted.
---@field remaining_targets HexisBlockPosition[] Bounded residual target evidence.
---@field source_incomplete boolean Discovery hit an evidence bound.

---@class HexisTypedToolPreference
---@field selector? HexisItemSelector Preferred tool selector.
---@field required? boolean Fail when the selector cannot be satisfied.

---@class HexisAreaEnterRequest
---@field destination string A destination ID from the bundle's area catalog pack.
---@field rejoin? boolean Send the warp even when already there, and require a new world to confirm it. This is how a script leaves a server it cannot work on, such as one refusing abilities for lag.

---@class HexisAreaEnterResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {destination: string, attempts: number, outcome?: 'already_present'|'arrived'|'not_applicable', world_generation?: number, command_dispatched?: boolean, expected_area_lines?: string[], observed_area?: string, expected_server?: string, observed_server?: string} Result payload.

---@class HexisAwaitRequest
---@field handle HexisActionHandle A handle returned by an action.
---@field timeout? number Seconds to wait before giving up.

---@class HexisAwaitResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data table Result payload.

---@class HexisCameraLookRequest
---@field at? HexisBlockPosition Block center; choose one target.
---@field point? HexisPosition Exact world point.
---@field angles? {yaw: number, pitch: number} Fixed heading.
---@field timeout_seconds? number 0.2 through 10 seconds.

---@class HexisCameraLookResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {settled: boolean, reason: string} Result payload.

---@class HexisCameraScanRequest
---@field seconds number How long to look around, 0.1 through 30.

---@class HexisCameraScanResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {completed: boolean, reason: string} Result payload.

---@class HexisCancelRequest
---@field handle HexisActionHandle A handle returned by an action.

---@class HexisCancelResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data table Result payload.

---@class HexisChatCommandRequest
---@field command string The command without its leading slash, such as "warp end".

---@class HexisChatCommandResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {command: string, sent: boolean, verb?: string, retry_after_ms?: number} Result payload.

---@class HexisCheckpointClearResult
---@field saved boolean Whether the checkpoint was removed or already absent.
---@field reason? 'unavailable'|'storage_error'|'rate_limited' Why the mutation was not saved.

---@class HexisCheckpointGetResult
---@field available boolean False when native context or local storage is unavailable.
---@field value? table Saved value for this script and native server/account.
---@field updated_at? number Last save time in Unix seconds.

---@class HexisCheckpointSetRequest
---@field value table Replace this script's checkpoint.

---@class HexisCheckpointSetResult
---@field saved boolean Whether the value was saved or already identical.
---@field reason? 'unavailable'|'storage_error'|'rate_limited' Why the mutation was not saved. At most one change per second.

---@class HexisCombatEngageRequest
---@field target? HexisEntityTarget One fixed target. Exactly one target source is required.
---@field targets? HexisEntityTarget[] A fixed list of targets.
---@field target_query? HexisEntityQuery A live query re-evaluated as the fight proceeds.
---@field held? HexisItemSelector Weapon to hold.
---@field behavior HexisMeleeKite How to fight.
---@field timeout_seconds number Give up after this long.
---@field stop_below_health_percent? number Disengage when the player drops below this health percent.
---@field perception_aware? boolean Account for nearby players when choosing movement.

---@class HexisCombatEngageResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {outcome: 'defeated'|'not_defeated', target_source: 'fixed'|'query', attacks: number, targets_defeated: number, elapsed_ms: number} Result payload.

---@class HexisCombatFireRequest
---@field target HexisEntityTarget Who to shoot.
---@field held HexisItemSelector Weapon to hold.
---@field projectile 'direct'|'arrow' direct leads nothing, arrow leads for drop and travel.
---@field timing HexisFireTiming Human-paced shot timing.
---@field shots? number How many shots to put into this target before returning, 1 through 5. Defaults to 1. A volley holds its controls once instead of reacquiring them per click, and stops the moment the target dies.

---@class HexisCombatFireResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {outcome: 'fired'|'not_fired', target: HexisEntityTarget, projectile: string, shots_fired: number, elapsed_ms: number, fired_tick: number} Result payload.

---@class HexisContentPackRequest
---@field name string A pack name declared by the bundle manifest.

---@class HexisDiagnosticsRecordRequest
---@field data table Evidence record; no file path.

---@class HexisDiagnosticsRecordResult
---@field file string Capture filename.

---@class HexisEventsNextRequest
---@field subscription HexisEventSubscription A subscription handle.
---@field timeout? number Seconds to wait before giving up.

---@class HexisEventsNextResult
---@field kind 'event'|'timeout'|'closed' What ended the wait.
---@field event? table Present when kind is event.
---@field code? string Present when kind is closed.
---@field message? string Present when kind is closed.

---@class HexisEventsSubscribeRequest
---@field type 'chat.received'|'gui.changed'|'gui.opened'|'sound.played'|'entity.spawned'|'schedule.break_soon'|'safety.alert' Which event source to open. entity.spawned filters by exact type_ids and maximum_distance; schedule.break_soon takes finish_seconds, the run's wind-down budget; safety.alert has no filter.
---@field filter? table The bounded filter for sources that accept one.

---@class HexisEventsSubscribeResult
---@field subscription HexisEventSubscription Pass this to events.next, hexis.select, or events.unsubscribe.

---@class HexisEventsUnsubscribeRequest
---@field subscription HexisEventSubscription The subscription to close.

---@class HexisEventsUnsubscribeResult
---@field closed boolean False when the subscription was already closed.

---@class HexisFarmingCropHarvestRequest
---@field world_generation number Current world generation.
---@field recipe HexisFarmingRecipe Farm definition.
---@field checkpoint? HexisFarmingCheckpoint Previous stable checkpoint, validated before use.
---@field require_checkpoint? boolean True when returning from an activity: reject stale or missing checkpoints before taking input.

---@class HexisFarmingCropHarvestResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {reason?: string, diagnostic_file?: string, diagnostic_error?: string, snapshot?: HexisFarmingSnapshot} Result payload.

---@class HexisFarmingCropSurveyRequest
---@field world_generation number Current world generation.
---@field recipe HexisFarmingRecipe Farm to inspect without moving.

---@class HexisFarmingCropSurveyResult
---@field world_generation number Observed world.
---@field complete boolean Nearby chunks loaded.
---@field matching_crops number Matching nearby targets.
---@field section number Suggested one-based section.
---@field pass number Suggested one-based pass.
---@field suitable boolean Loaded crops and a grounded or water starting position.
---@field look {yaw: number, pitch: number} Resolved aim.

---@class HexisFarmingSessionObserveRequest
---@field action HexisActionHandle Active harvest handle owned by this run.

---@class HexisFarmingSessionObserveResult
---@field phase 'starting'|'harvesting'|'switching_row'|'changing_section'|'recovering'|'terminal' Current task phase.
---@field elapsed_seconds number Wall time of this action.
---@field world_generation? number World generation after startup.
---@field look? {yaw: number, pitch: number} Resolved once during startup.
---@field section? number One-based section.
---@field section_name? string Recipe section name.
---@field pass? number One-based active pass.
---@field bps number Rolling local predicted breaks per second.
---@field window_seconds? number Configured BPS averaging window; available after startup.
---@field session_bps number Average over observed active time.
---@field blocks number Matching local predicted breaks.
---@field complete boolean Whether a full continuous rate window is available.
---@field health? {severity: 'info'|'warning'|'critical', reason: string, message: string} Latest health observation.
---@field checkpoint? HexisFarmingCheckpoint Stable resume hint; absent until available.

---@class HexisFarmingSessionPauseRequest
---@field action HexisActionHandle Request a stable pause, then await this action; timeout stops after 10 seconds.

---@class HexisFarmingSessionPauseResult
---@field accepted boolean Pause request accepted; this is not permission to take controls yet.
---@field reason string requested or inactive.

---@class HexisForagingCreatureCatchRequest
---@field species string Provider-neutral species key.
---@field target HexisEntityRef Observed entity reference.
---@field tool HexisTypedToolPreference Required catching tool selector.

---@class HexisForagingCreatureCatchResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data HexisCatchCreatureResult Result payload.

---@class HexisForagingPatchHarvestRequest
---@field world_generation number Must match current world evidence.
---@field source {kind: 'seeds', positions: HexisBlockPosition[]} Scattered patch source.
---@field plants {block_ids: string[]} Plant definition.
---@field completion {kind: 'quota_or_idle', maximum_blocks?: number, idle_timeout_ms?: number, empty_backoff_ms?: number} Patch quota and idle policy.
---@field tool? HexisTypedToolPreference Best-effort or required tool.
---@field debug? boolean Publish read-only diagnostics.

---@class HexisForagingPatchHarvestResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data HexisHarvestPatchResult Result payload.

---@class HexisForagingTreeHarvestRequest
---@field world_generation number Must match current world evidence.
---@field candidates {seeds: HexisBlockPosition[]} Tree candidates.
---@field tree {block_ids: string[], connectivity?: 'faces'|'faces_edges_corners', maximum_component_radius?: number, reject_when_touching?: string[]} Tree component definition.
---@field strategy {reach?: 'ground_only'|'ground_then_jump', order?: 'bottom_up'|'top_down'} Tree-specific harvest strategy.
---@field limit? {maximum_blocks?: number} Bounded work limit.
---@field tool? HexisTypedToolPreference Best-effort or required tool.
---@field debug? boolean Publish read-only diagnostics.

---@class HexisForagingTreeHarvestResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data HexisHarvestTreeResult Result payload.

---@class HexisGuiSnapshotResult
---@field status 'open'|'closed' Whether a container screen is open.
---@field observed_tick number Tick the snapshot was taken.
---@field screen? HexisGuiScreen Present when status is open.

---@class HexisGuiTransactRequest
---@field screen HexisGuiScreenRef The screen the script reasoned about.
---@field operation HexisGuiOperation What to do.

---@class HexisGuiTransactResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {kind: string, applied: boolean} Result payload.

---@class HexisHttpGetJsonRequest
---@field url string An https URL on an allowed host. Reading anywhere else is denied, and the list is owned by the runtime, not by your bundle.
---@field timeout_seconds? number 1 through 30. Defaults to 10.

---@class HexisHttpGetJsonResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {status: number, body: table} Result payload.

---@class HexisHudPanelRequest
---@field icon? string Namespaced item ID beside the script title.
---@field sections HexisHudSection[] At most 4 sections. Replaces the whole script panel.
---@field style? 'rail'|'spaced'|'hairline' How sections are separated. rail draws a short coloured edge, spaced uses room alone, hairline underlines each heading. Defaults to rail.
---@field status? HexisHudStatus The line beside the script name. Absent shows nothing, which suits a script with no state or session worth reporting.
---@field profit_footer? boolean Show the automatic profit footer. Defaults to true; false allows a script to provide its own profit rows.
---@field over_screens? boolean Keep the panel visible while a container screen is open. Defaults to false, because a HUD over an inventory is usually in the way; a script that automates a screen wants it.

---@class HexisInputHoldRequest
---@field world_generation number Generation from a current observation.
---@field keys {forward?: boolean, back?: boolean, left?: boolean, right?: boolean, jump?: boolean, sprint?: boolean, sneak?: boolean, attack?: boolean, use?: boolean} Complete state; omitted keys release.
---@field look {at?: HexisBlockPosition, point?: HexisPosition, angles?: {yaw: number, pitch: number}} Exactly one target.
---@field bounds {min: HexisPosition, max: HexisPosition} Permitted feet-position box; allow stopping margin.
---@field stop_at? {point: HexisPosition, normal: HexisPosition} Finish on reaching or crossing the plane.
---@field progress? {window_seconds: number, min_distance: number} Stop on stalled forward progress.
---@field held_item? {name_patterns: string[]} Required for attack/use; does not select a tool.
---@field attack_target? {block_ids: string[], properties?: table<string, string>, below_block_ids?: string[]} Gate held attack against the native crosshair each tick. Misses and entities do not match.
---@field duration_seconds number 0.1 through 60, including aim acquisition.

---@class HexisInputHoldResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {reason: string, position?: HexisPosition, sequence?: number, observed_tick?: number, world_generation?: number} Result payload.

---@class HexisInputUpdateRequest
---@field action HexisActionHandle Active input.hold handle owned by this run.
---@field request {world_generation: number, keys: {forward?: boolean, back?: boolean, left?: boolean, right?: boolean, jump?: boolean, sprint?: boolean, sneak?: boolean, attack?: boolean, use?: boolean}, look: {at?: HexisBlockPosition, point?: HexisPosition, angles?: {yaw: number, pitch: number}}, bounds: {min: HexisPosition, max: HexisPosition}, stop_at?: {point: HexisPosition, normal: HexisPosition}, progress?: {window_seconds: number, min_distance: number}, held_item?: {name_patterns: string[]}, attack_target?: {block_ids: string[], properties?: table<string, string>, below_block_ids?: string[]}, duration_seconds: number} Complete replacement input request. Preserve world, camera target and tool. Duration renews the bounded deadline; no controls are released.

---@class HexisInputUpdateResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data table Result payload.

---@class HexisInteractUseRequest
---@field target HexisInteractTarget What to use on.
---@field held? HexisItemSelector Item to hold first.

---@class HexisInteractUseResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {kind: string} Result payload.

---@class HexisInventoryEnsureHeldRequest
---@field selector HexisItemSelector What to hold.

---@class HexisInventoryEnsureHeldResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {slot: number, name: string} Result payload.

---@class HexisInventoryObserveRequest
---@field selector HexisInventorySelector What to count.

---@class HexisInventoryObserveResult
---@field world_generation number World generation the count was taken in.
---@field observed_tick number Tick the count was taken.
---@field total number Total matching items across every counted slot.
---@field free_slots number Empty slots in the counted region.
---@field full boolean True when no counted slot is empty.
---@field matches HexisInventoryMatch[] One entry per distinct matching item.

---@class HexisMiningBlockMineRequest
---@field world_generation number Must match current world evidence.
---@field target HexisBlockPosition Exact block target.
---@field minerals HexisMineralPolicy Accepted and preferred mineral policy.
---@field tool? HexisTypedToolPreference Tool preference.
---@field options? HexisTypedMiningOptions Execution options.

---@class HexisMiningBlockMineResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data HexisTypedMiningResult Result payload.

---@class HexisMiningFieldMineRequest
---@field world_generation number Must match current world evidence.
---@field area table Persistent mining region.
---@field minerals HexisMineralPolicy Mineral policy.
---@field objective? 'fast_blocks'|'balanced'|'raw_material' Mining objective.
---@field completion table Persistent-field termination.
---@field tool? HexisTypedToolPreference Tool preference.
---@field options? HexisTypedMiningOptions Execution options.

---@class HexisMiningFieldMineResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data HexisTypedMiningResult Result payload.

---@class HexisMiningTargetMineRequest
---@field world_generation number Must match current world evidence.
---@field source table Where one target is selected.
---@field minerals HexisMineralPolicy Mineral policy.
---@field objective? 'fast_blocks'|'balanced'|'raw_material' Mining objective.
---@field tool? HexisTypedToolPreference Tool preference.
---@field options? HexisTypedMiningOptions Execution options.

---@class HexisMiningTargetMineResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data HexisTypedMiningResult Result payload.

---@class HexisMiningVeinMineRequest
---@field world_generation number Must match current world evidence.
---@field seeds HexisBlockPosition[] One or more connected-component anchors.
---@field connectivity? 'faces'|'faces_edges_corners' Component connectivity.
---@field minerals HexisMineralPolicy Mineral policy.
---@field limit? {maximum_blocks?: number} Finite work limit.
---@field tool? HexisTypedToolPreference Tool preference.
---@field options? HexisTypedMiningOptions Execution options.

---@class HexisMiningVeinMineResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data HexisTypedMiningResult Result payload.

---@class HexisNavigateEtherwarpRequest
---@field destination HexisBlockPosition The block to land on.
---@field arrive_within? number Arrival tolerance in blocks, 0.5 through 8. Defaults to 2.
---@field timeout_seconds? number 1 through 60. Defaults to 15.

---@class HexisNavigateEtherwarpResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {arrived: boolean, distance: number, outcome?: 'already_there'|'transmitted'} Result payload.

---@class HexisNavigateToRequest
---@field destination HexisBlockPosition Where to walk.
---@field arrive_within? number Arrival tolerance in blocks, 0.5 through 8. Defaults to 2.
---@field allow_ether_transmission? boolean Permit ether transmission. Requires the etherwarp capability.
---@field allow_drops? boolean Permit falling as a way down. Without it a route that only exists by dropping is not a route, and the search reports terrain_incomplete after exhausting everything walkable.
---@field allow_parkour? boolean Permit certified sprint-jumps across unsupported gaps. Defaults to false.
---@field allow_sneak? boolean Permit crawling through 1.5-block spaces while sneaking. Defaults to false.

---@class HexisNavigateToResult
---@field status 'succeeded'|'failed'|'cancelled' Terminal disposition of the action.
---@field ok boolean True only when status is succeeded.
---@field code string Action code. See the action code list.
---@field retryable boolean True when the same request could succeed if tried again.
---@field message string Human-readable detail. Never parse this.
---@field data {arrived: boolean, distance: number} Result payload.

---@class HexisPriceOfRequest
---@field item string A SkyBlock item id.

---@class HexisPriceOfResult
---@field id string The SkyBlock item id that was looked up.
---@field instant_sell? number Bazaar sell price.
---@field sell_order? number Bazaar buy price, what a sell order fetches.
---@field npc? number NPC counter price.
---@field bin? number Lowest BIN on the auction house.
---@field best? number The price the user's own preference resolves to. Absent when nothing quotes this item, which is not the same as it being worthless.
---@field source? 'instant_sell'|'sell_order'|'npc'|'bin' Which one best came from.
---@field age_seconds? number How stale the table is.

---@class HexisProfitCoinsRequest
---@field amount number Coins the script worked out itself, for a value no price table can carry. Kept apart from item value everywhere and labelled self-reported, because nothing can check it.

---@class HexisProfitHistoryResult
---@field valuations HexisProfitHistoryValuations Separate duration-weighted market comparisons.
---@field runs HexisProfitHistoryRun[] Newest first; 64 per script, 256 device-wide. Scoped by native server/account/dimension and declared context/sale forms. Current run excluded; scheduler resumes are separate runs.
---@field available boolean False if local history could not be read or saved. Existing unreadable files are preserved.
---@field included_runs number Tracked runs lasting at least 60 active seconds with complete legacy-basis prices; known zero-yield runs are included.
---@field excluded_runs number Retained comparable runs omitted because prices, tracking or a full minute of active duration are missing.
---@field active_seconds number Combined active duration of included runs.
---@field value number Combined acquisition-time estimated item value of included runs; coins stay separate.
---@field per_hour? number Duration-weighted legacy item estimate for eligible comparable runs. Absent without an eligible run. Use valuations for explicit Bazaar and NPC estimates.

---@class HexisProfitItemRequest
---@field item string A SkyBlock item id such as SUMMONING_EYE. Not a display name: two items may share one.
---@field count? number How many. Defaults to 1. Negative is a cost, and is valued at what buying costs rather than at what selling fetches.

---@class HexisProfitSummaryResult
---@field valuations HexisProfitValuations Independent explicit sale estimates, excluding self-reported coins.
---@field sale_items table<string, string> Explicit estimated sale forms selected by this script.
---@field value number Coins from item entries, fixed as each landed.
---@field coins number Self-reported coins, kept separate on purpose.
---@field active_seconds number Seconds this script has actually been running. A break freezes it; resuming inside two hours continues the same ledger.
---@field items HexisProfitItem[] Highest value first.
---@field per_hour? number Absent until the ledger has 30 seconds of work in it, because a rate over four seconds is a number that looks precise and means nothing.
---@field per_hour_current? number Estimated hourly rate over the latest 60 active seconds, absent during the first 30 seconds.
---@field per_hour_recent? number The same over the last 15 minutes of active time, so a dry spell shows without the session figure lurching.
---@field price_age_seconds? number How stale the prices behind these values are.

---@class HexisProfitTrackInventoryRequest
---@field items string[] 1 to 32 SkyBlock item ids. The runtime counts positive stack deltas each tick, so a sale is not a negative drop.
---@field groups? table<string, table<string, number>> Up to 8 disjoint groups of 1 to 16 forms; canonical quantity is 1. Split compaction settles after 40 ticks at first-observation prices. Quantities are inventory estimates.
---@field sale_items? table<string, string> Estimated sale form per tracked item; must be in its quantity group. Defaults to canonical raw. Does not assert actual compaction or selling.
---@field context? string Stable farm/settings fingerprint up to 512 characters. Combined with native account, server and dimension for comparable history; set before reading history.

---@class HexisProfitWatchChatRequest
---@field pattern string A regular expression over the plain text of a chat line. The runtime matches it, which is what makes the entry observed rather than asserted.
---@field item string The SkyBlock item id a match awards.
---@field count_group? number Capture group holding the count. Absent or 0 means every match counts one.

---@class HexisRoutesSeedsRequest
---@field route string Route key, such as official:Galatea_Foraging.
---@field kind string Which entry kind to read, such as mineable_blocks.
---@field entry_block_types? string[] Restrict to entries recorded with these block types.

---@class HexisRoutesSeedsResult
---@field seeds HexisBlockPosition[] Recorded positions in route order.
---@field world_generation number World generation the route resolved in.
---@field zones? table[] Zones declared by the route.

---@class HexisSafetyObserveResult
---@field last_alert? table The last conductor decision in this client session.
---@field recent_count number Persisted safety history rows, bounded to 200.

---@class HexisSafetyReportRequest
---@field reason string General script problem identifier: [a-z][a-z0-9_.:-]{0,63}.
---@field message? string Explanation displayed in failsafe notifications and history: 1 to 256 plain-text characters, without control or Minecraft formatting codes. Defaults to reason.
---@field severity? string info, warning or critical (default). Each has its own user-configured trigger response; default Log, Alert and Stop respectively.
---@field evidence? table Observed facts only. The host supplies script and run identity; scripts cannot choose the response or clear alerts.

---@class HexisSafetyReportResult
---@field accepted boolean Whether the conductor queued the report. The severity's configured response applies on the client tick without another delay. Reporting does not itself release controls.
---@field reason string accepted, duplicate (same run, severity and reason within 10s), rate_limited (8 reports per run in 10s), unavailable, or disabled. A warning does not suppress escalation.

---@class HexisScheduleObserveResult
---@field enabled boolean False when the user has breaks switched off, in which case nothing else here moves.
---@field phase string running, heads_up, winding_down, resting, reconnecting, recovering, or resuming.
---@field kind 'shift'|'short_break'|'long_break'|'sleep' What the current or pending window is.
---@field policy 'stay'|'island'|'disconnect' What the client will do with the player for it.
---@field break_pending boolean True between the heads-up and the scripts being stopped. Poll this instead of subscribing when all you need is whether to start another unit of work.
---@field changes_in number Seconds until the next transition, or -1 when nothing is scheduled.
---@field resumes_in number Seconds until a break ends, or -1 outside one.

---@class HexisScheduleRequestRequest
---@field minutes number How long to rest, clamped to the user's own break range.
---@field reason? string One line the player reads, such as "inventory full".

---@class HexisScheduleRequestResult
---@field accepted boolean False when the user has breaks switched off or one is already starting.
---@field resumes_in? number Seconds until the scripts start again. Present when accepted.
---@field refused_because? string breaks_off, break_already_starting, or schedule_unavailable. Present when not accepted.

---@class HexisScriptStopRequest
---@field reason string What to tell the player, in one line. Shown as "<script> stopped: <reason>".

---@class HexisSelectRequest
---@field candidates (HexisActionHandle|HexisEventSubscription)[] Action handles and subscription handles to race.
---@field timeout? number Seconds to wait before giving up.

---@class HexisSelectResult
---@field kind 'action'|'event'|'timeout'|'closed' What won the race.
---@field index? number One-based index of the winning candidate.
---@field result? HexisActionResult Present when kind is action.
---@field event? table Present when kind is event.
---@field code? string Present when kind is closed.
---@field message? string Present when kind is closed.

---@class HexisSleepRequest
---@field seconds number How long to pause the script worker.

---@class HexisTimeMonotonicResult
---@field seconds number Monotonic seconds. Only differences are meaningful.

---@class HexisWorldActionBarObserveRequest
---@field after_sequence? number Return up to 64 newer action-bar writes; sequence distinguishes messages in the same game tick.

---@class HexisWorldActionBarObserveResult
---@field world_generation number World generation.
---@field observed_tick number Tick the line was last written. Compare it to know whether the server has said anything since.
---@field text string The line above the hotbar, formatting stripped. Empty when the server has written none.
---@field sequence number Monotonic action-bar write sequence.
---@field truncated? boolean Some requested messages have left the bounded history.
---@field updates? ({text: string, observed_tick: number, sequence: number})[] Writes newer than after_sequence.

---@class HexisWorldBlocksBreakProgressRequest
---@field world_generation number Must match current world evidence.
---@field position HexisBlockPosition Block whose vanilla progress is requested.

---@class HexisWorldBlocksBreakProgressResult
---@field world_generation number World generation.
---@field observed_tick number Tick the read ran.
---@field active boolean True when vanilla is currently destroying this block.
---@field target HexisBlockPosition Requested block position.
---@field remaining number 0 when gone, 1 before cracks, otherwise fractional health.

---@class HexisWorldBlocksBreaksRequest
---@field after? {world_generation: number, sequence: number} Omit to establish a baseline. Pass the previous cursor as after when polling.

---@class HexisWorldBlocksBreaksResult
---@field world_generation number Current world generation.
---@field observed_tick number Tick this observation ran.
---@field observed_seconds number Client monotonic seconds, same clock as hexis.time.monotonic.
---@field cursor {world_generation: number, sequence: number} Pass unchanged as after on the next poll.
---@field complete boolean False if history overflowed or the world changed; reset rate windows then.
---@field overflow boolean Requested events exceeded the 512-event retained history.
---@field reset boolean Cursor belongs to another world. No old-world events are returned.
---@field evidence 'local_prediction' Successful vanilla local destructions, not server-confirmed harvests. Corrections are not subtracted; breaking a restored block counts again.
---@field breaks ({sequence: number, observed_tick: number, observed_seconds: number, position: HexisBlockPosition, block_id: string})[] Direct local-player successes, including manual input. Excludes failed attacks, crosshair changes, cascade breaks, item drops and other players. Empty when after is omitted.

---@class HexisWorldBlocksFindRequest
---@field center? HexisBlockPosition Defaults to the player's position.
---@field radius number 1 through 15 blocks.
---@field selector HexisBlockSelector What to match.
---@field limit number 1 through 32 results.

---@class HexisWorldBlocksFindResult
---@field world_generation number World generation.
---@field observed_tick number Tick the scan ran.
---@field complete boolean False when some chunks in range were not loaded.
---@field truncated boolean The result hit the limit.
---@field matches ({position: HexisBlockPosition, block_id: string, distance: number})[] Matching blocks, nearest first.

---@class HexisWorldBlocksObserveRequest
---@field positions HexisBlockPosition[] 1 through 128 positions to read.

---@class HexisWorldBlocksObserveResult
---@field world_generation number World generation.
---@field observed_tick number Tick the read ran.
---@field complete boolean False when some positions were not loaded.
---@field observations ({position: HexisBlockPosition, block_id?: string, properties?: table, collision_boxes?: ({min: HexisPosition, max: HexisPosition})[], loaded: boolean})[] One entry per requested position, in order.

---@class HexisWorldBlocksReachRequest
---@field positions HexisBlockPosition[] 1 through 128 positions to test.

---@class HexisWorldBlocksReachResult
---@field world_generation number World generation.
---@field observed_tick number Tick the test ran.
---@field blocks ({position: HexisBlockPosition, present: boolean, reachable: boolean, visible: boolean})[] One entry per requested position, in order.

---@class HexisWorldCrosshairObserveRequest
---@field range? number How far to look, 1 through 100 blocks. Absent uses the player's own interaction reach.

---@class HexisWorldCrosshairObserveResult
---@field world_generation number World generation.
---@field observed_tick number Tick the read ran.
---@field kind 'miss'|'block'|'entity' What the crosshair is on.
---@field hit_position? HexisPosition Exact hit point. Absent when kind is miss.
---@field distance? number Distance from the eye. Absent when kind is miss.
---@field block? {position: HexisBlockPosition, block_id: string, face: string} Present when kind is block.
---@field entity? HexisEntityObservation Present when kind is entity.

---@class HexisWorldEntitiesFindRequest
---@field area HexisEntityArea Where to look.
---@field selector HexisEntitySelector What counts as a match.
---@field limit number 1 through 32 results.

---@class HexisWorldEntitiesFindResult
---@field world_generation number World generation.
---@field observed_tick number Tick the scan ran.
---@field matched_count number Matches found before the limit was applied.
---@field truncated boolean The result hit the limit.
---@field entities HexisEntityObservation[] Matching entities, nearest first.

---@class HexisWorldHighlightRequest
---@field blocks? HexisBlockHighlight[] At most 64 blocks to outline.
---@field entities? HexisEntityHighlight[] At most 32 entities to outline.
---@field target? HexisTargetHighlight Outline whatever the crosshair is on, block or entity, with the client gliding the box between targets. Absent turns it off.

---@class HexisWorldHighlightResult
---@field target? HexisCrosshairObservation Exactly what the outline locked on to. Describe this rather than observing again: a second raycast is a different instant, and while the player is turning it answers differently.

---@class HexisWorldSelfObserveResult
---@field correction_sequence number Latest positional server update sequence, initially 0. Rotation-only and no-op updates do not advance it.
---@field world_generation number World generation.
---@field observed_tick number Tick the read ran.
---@field position HexisPosition Feet position.
---@field eye HexisPosition Eye position.
---@field yaw number Degrees, as the player is facing.
---@field pitch number Degrees, negative is up.
---@field on_ground boolean Standing on something.
---@field velocity HexisPosition Vanilla velocity in blocks per game tick; use position changes on distinct ticks to measure actual progress.
---@field horizontal_collision boolean Vanilla reported a horizontal collision. Wall sliding can still make progress.
---@field in_water boolean The player is touching water.
---@field sneaking boolean Holding sneak.

---@class HexisWorldTabObserveResult
---@field world_generation number World generation.
---@field observed_tick number Tick the read ran.
---@field lines string[] Visible tab list text, one entry per player slot.

---@param request HexisAreaEnterRequest
---@return HexisActionHandle
function hexis.area.enter(request) end

---@param handle HexisActionHandle
---@param options? {timeout?: number}
---@return HexisAwaitResult
function hexis.await(handle, options) end

---@param request HexisCameraLookRequest
---@return HexisActionHandle
function hexis.camera.look(request) end

---@param request HexisCameraScanRequest
---@return HexisActionHandle
function hexis.camera.scan(request) end

---@param handle HexisActionHandle
---@return HexisCancelResult
function hexis.cancel(handle) end

---@param request HexisChatCommandRequest
---@return HexisActionHandle
function hexis.chat.command(request) end

---@param request table
---@return HexisCheckpointClearResult
function hexis.checkpoint.clear(request) end

---@param request table
---@return HexisCheckpointGetResult
function hexis.checkpoint.get(request) end

---@param request HexisCheckpointSetRequest
---@return HexisCheckpointSetResult
function hexis.checkpoint.set(request) end

---@param request HexisCombatEngageRequest
---@return HexisActionHandle
function hexis.combat.engage(request) end

---@param request HexisCombatFireRequest
---@return HexisActionHandle
function hexis.combat.fire(request) end

---@return table
function hexis.config.snapshot() end

---@param request HexisContentPackRequest
---@return table
function hexis.content.pack(request) end

---@param request HexisDiagnosticsRecordRequest
---@return HexisDiagnosticsRecordResult
function hexis.diagnostics.record(request) end

---@param subscription HexisEventSubscription
---@param options? {timeout?: number}
---@return HexisEventsNextResult
function hexis.events.next(subscription, options) end

---@param request HexisEventsSubscribeRequest
---@return HexisEventsSubscribeResult
function hexis.events.subscribe(request) end

---@param subscription HexisEventSubscription
---@return HexisEventsUnsubscribeResult
function hexis.events.unsubscribe(subscription) end

---@param request HexisFarmingCropHarvestRequest
---@return HexisActionHandle
function hexis.farming.crop.harvest(request) end

---@param request HexisFarmingCropSurveyRequest
---@return HexisFarmingCropSurveyResult
function hexis.farming.crop.survey(request) end

---@param request HexisFarmingSessionObserveRequest
---@return HexisFarmingSessionObserveResult
function hexis.farming.session.observe(request) end

---@param request HexisFarmingSessionPauseRequest
---@return HexisFarmingSessionPauseResult
function hexis.farming.session.pause(request) end

---@param request HexisForagingCreatureCatchRequest
---@return HexisActionHandle
function hexis.foraging.creature.catch(request) end

---@param request HexisForagingPatchHarvestRequest
---@return HexisActionHandle
function hexis.foraging.patch.harvest(request) end

---@param request HexisForagingTreeHarvestRequest
---@return HexisActionHandle
function hexis.foraging.tree.harvest(request) end

---@param request table
---@return HexisGuiSnapshotResult
function hexis.gui.snapshot(request) end

---@param request HexisGuiTransactRequest
---@return HexisActionHandle
function hexis.gui.transact(request) end

---@param request HexisHttpGetJsonRequest
---@return HexisActionHandle
function hexis.http.get_json(request) end

---@param request HexisHudPanelRequest
---@return table
function hexis.hud.panel(request) end

---@param request HexisInputHoldRequest
---@return HexisActionHandle
function hexis.input.hold(request) end

---@param request HexisInputUpdateRequest
---@return HexisInputUpdateResult
function hexis.input.update(request) end

---@param request HexisInteractUseRequest
---@return HexisActionHandle
function hexis.interact.use(request) end

---@param request HexisInventoryEnsureHeldRequest
---@return HexisActionHandle
function hexis.inventory.ensure_held(request) end

---@param request HexisInventoryObserveRequest
---@return HexisInventoryObserveResult
function hexis.inventory.observe(request) end

---@param request HexisMiningBlockMineRequest
---@return HexisActionHandle
function hexis.mining.block.mine(request) end

---@param request HexisMiningFieldMineRequest
---@return HexisActionHandle
function hexis.mining.field.mine(request) end

---@param request HexisMiningTargetMineRequest
---@return HexisActionHandle
function hexis.mining.target.mine(request) end

---@param request HexisMiningVeinMineRequest
---@return HexisActionHandle
function hexis.mining.vein.mine(request) end

---@param request HexisNavigateEtherwarpRequest
---@return HexisActionHandle
function hexis.navigate.etherwarp(request) end

---@param request HexisNavigateToRequest
---@return HexisActionHandle
function hexis.navigate.to(request) end

---@param request HexisPriceOfRequest
---@return HexisPriceOfResult
function hexis.price.of(request) end

---@param request HexisProfitCoinsRequest
---@return table
function hexis.profit.coins(request) end

---@param request table
---@return HexisProfitHistoryResult
function hexis.profit.history(request) end

---@param request HexisProfitItemRequest
---@return table
function hexis.profit.item(request) end

---@param request table
---@return HexisProfitSummaryResult
function hexis.profit.summary(request) end

---@param request HexisProfitTrackInventoryRequest
---@return table
function hexis.profit.track_inventory(request) end

---@param request table
---@return table
function hexis.profit.track_purse(request) end

---@param request HexisProfitWatchChatRequest
---@return table
function hexis.profit.watch_chat(request) end

---@param request HexisRoutesSeedsRequest
---@return HexisRoutesSeedsResult
function hexis.routes.seeds(request) end

---@return HexisSafetyObserveResult
function hexis.safety.observe() end

---@param request HexisSafetyReportRequest
---@return HexisSafetyReportResult
function hexis.safety.report(request) end

---@return HexisScheduleObserveResult
function hexis.schedule.observe() end

function hexis.schedule.ready() end

---@param request HexisScheduleRequestRequest
---@return HexisScheduleRequestResult
function hexis.schedule.request(request) end

---@param request HexisScriptStopRequest
---@return table
function hexis.script.stop(request) end

---@param candidates (HexisActionHandle|HexisEventSubscription)[]
---@param options? {timeout?: number}
---@return HexisSelectResult
function hexis.select(candidates, options) end

---@param seconds number
function hexis.sleep(seconds) end

---@return HexisTimeMonotonicResult
function hexis.time.monotonic() end

---@param request HexisWorldActionBarObserveRequest
---@return HexisWorldActionBarObserveResult
function hexis.world.action_bar.observe(request) end

---@param request HexisWorldBlocksBreakProgressRequest
---@return HexisWorldBlocksBreakProgressResult
function hexis.world.blocks.break_progress(request) end

---@param request HexisWorldBlocksBreaksRequest
---@return HexisWorldBlocksBreaksResult
function hexis.world.blocks.breaks(request) end

---@param request HexisWorldBlocksFindRequest
---@return HexisWorldBlocksFindResult
function hexis.world.blocks.find(request) end

---@param request HexisWorldBlocksObserveRequest
---@return HexisWorldBlocksObserveResult
function hexis.world.blocks.observe(request) end

---@param request HexisWorldBlocksReachRequest
---@return HexisWorldBlocksReachResult
function hexis.world.blocks.reach(request) end

---@param request HexisWorldCrosshairObserveRequest
---@return HexisWorldCrosshairObserveResult
function hexis.world.crosshair.observe(request) end

---@param request HexisWorldEntitiesFindRequest
---@return HexisWorldEntitiesFindResult
function hexis.world.entities.find(request) end

---@param request HexisWorldHighlightRequest
---@return HexisWorldHighlightResult
function hexis.world.highlight(request) end

---@param request table
---@return HexisWorldSelfObserveResult
function hexis.world.self.observe(request) end

---@param request table
---@return HexisWorldTabObserveResult
function hexis.world.tab.observe(request) end
