import { APIResource } from "../../core/resource.js"; import * as ItemsAPI from "./items.js"; import { APIPromise } from "../../core/api-promise.js"; import { ItemsCursorGetPagination, type ItemsCursorGetPaginationParams, PagePromise } from "../../core/pagination.js"; import { RequestOptions } from "../../internal/request-options.js"; export declare class Items extends APIResource { /** * Add RUN or THREAD items to a single annotation queue. RUN items require run_id * unless they are created from a suggested example. THREAD items require thread_id * and project_id. */ create(queueID: string, params: ItemCreateParams, options?: RequestOptions): APIPromise; /** * Partially update mutable timestamps (added_at, last_reviewed_time) for a RUN or * THREAD annotation queue item. Omit a field, or pass JSON null, to leave it * unchanged. */ update(itemID: string, params: ItemUpdateParams, options?: RequestOptions): APIPromise; /** * List RUN and THREAD items in a single annotation queue for one review status * section, with opaque cursor pagination. Optional item_type=RUN|THREAD filters * the page. Optional min_start_time/max_start_time bound the item's trace start * time; items with no start time are excluded when either bound is set. * direction=backward returns items before the supplied cursor. The response * contains item metadata only, not expanded run or thread payloads. * status=archived returns items whose queue review requirements have been * satisfied, not merely items the caller personally marked completed. */ list(queueID: string, query: ItemListParams, options?: RequestOptions): PagePromise; /** * Remove the final for one rubric key. The key's answer goes back to the * reviewers' majority, or null when they disagreed. Clearing a key that has no * final succeeds. */ clearFinal(key: string, params: ItemClearFinalParams, options?: RequestOptions): APIPromise; /** * Log the caller's reviewer status for a RUN or THREAD annotation queue item. A * null status re-shows the item for this reviewer. */ createStatus(queueItemID: string, body: ItemCreateStatusParams, options?: RequestOptions): APIPromise; /** * Remove RUN or THREAD items from a single annotation queue by item ID. Both * active and completed items can be removed. */ deleteAll(queueID: string, body: ItemDeleteAllParams, options?: RequestOptions): APIPromise; /** * Returns the number of annotation queue items in one status bucket. The two time * windows are independent: start_time/end_time bound when an item was archived, * min_start_time/max_start_time bound when its trace ran. Items with no trace * start time are excluded when either of the latter is set. */ retrieveCount(queueID: string, query: ItemRetrieveCountParams, options?: RequestOptions): APIPromise; /** * Resolve a RUN or THREAD item to its current review section and zero-based * position for deep linking. The returned cursor counts RUN and THREAD items * together, so it is only valid for a list request with no item_type or start-time * filter. */ retrievePlacement(itemID: string, params: ItemRetrievePlacementParams, options?: RequestOptions): APIPromise; /** * For each rubric key: whether the reviewers agreed, the final if one is set, and * each reviewer's answer. Reviewers are listed in the order they completed the * item. Their name and email are empty when the caller cannot see other workspace * members. Returns 404 unless the item is completed. */ retrieveReviews(itemID: string, params: ItemRetrieveReviewsParams, options?: RequestOptions): APIPromise; /** * Set the answer downstream uses for one rubric key when the item's reviewers * disagreed. A key that already has a final can be changed even after reviewers * come to agree. Multi-select keys take a list of category labels in values. * final_set_by is empty for API key callers. */ setFinal(key: string, params: ItemSetFinalParams, options?: RequestOptions): APIPromise; /** * Replace your own answer on one rubric key and update the item's agreement. Only * a reviewer who completed the item can edit their answer. Multi-select keys take * a list of category labels in values; free-text keys take text in value. An empty * body clears your answer. */ setReview(key: string, params: ItemSetReviewParams, options?: RequestOptions): APIPromise; } export type ItemListResponsesItemsCursorGetPagination = ItemsCursorGetPagination; export type AnnotationQueueItemAgreementState = 'agreed' | 'disagreed' | 'none'; export interface AnnotationQueueItemAnswer { score?: number; scores?: Array; value?: string; values?: Array; } export interface AnnotationQueueItemKeyReviews { answer?: AnnotationQueueItemAnswer; final?: AnnotationQueueItemAnswer; final_set_at?: string; final_set_by?: string; has_final?: boolean; key?: string; reviews?: Array; state?: AnnotationQueueItemAgreementState; } export declare namespace AnnotationQueueItemKeyReviews { interface Review { answer?: ItemsAPI.AnnotationQueueItemAnswer; ls_user_id?: string; } } export interface ItemCreateResponse { items?: Array; } export declare namespace ItemCreateResponse { interface Item { id?: string; added_at?: string; item_type?: 'RUN' | 'THREAD'; /** * LastReviewedTime is always present on the wire (null until reviewed). */ last_reviewed_time?: string; project_id?: string; queue_id?: string; run_id?: string; source_proposed_example_id?: string; start_time?: string; thread_id?: string; } } export interface ItemUpdateResponse { id?: string; added_at?: string; item_type?: 'RUN' | 'THREAD'; /** * LastReviewedTime is always present on the wire (null until reviewed). */ last_reviewed_time?: string; project_id?: string; queue_id?: string; run_id?: string; source_proposed_example_id?: string; start_time?: string; thread_id?: string; } export interface ItemListResponse { id?: string; added_at?: string; /** * Whether the item's reviewers agreed across its rubric keys. */ agreement_state?: AnnotationQueueItemAgreementState; assigned_to?: Array; completed_by?: Array; effective_added_at?: string; /** * True while a key the reviewers disagreed on has no final answer. */ has_unresolved_keys?: boolean; item_type?: 'RUN' | 'THREAD'; /** * The reviewers' result for each rubric key. */ key_agreements?: { [key: string]: ItemListResponse.KeyAgreements; }; /** * LastReviewedTime is always present on the wire (null until reviewed). */ last_reviewed_time?: string; project_id?: string; queue_id?: string; reserved_by?: Array; run_id?: string; source_proposed_example_id?: string; start_time?: string; thread_id?: string; } export declare namespace ItemListResponse { interface KeyAgreements { answer?: ItemsAPI.AnnotationQueueItemAnswer; has_final?: boolean; state?: ItemsAPI.AnnotationQueueItemAgreementState; } } export interface ItemCreateStatusResponse { is_archived?: boolean; override_added_at?: string; queue_item_id?: string; status?: 'viewed' | 'completed'; } export type ItemDeleteAllResponse = { [key: string]: string; }; export interface ItemRetrieveCountResponse { count?: number; } export interface ItemRetrievePlacementResponse { cursor?: string; item_type?: 'RUN' | 'THREAD'; position?: number; section?: 'needs_my_review' | 'needs_others_review' | 'archived'; } export interface ItemRetrieveReviewsResponse { keys?: Array; reviewers?: Array; } export declare namespace ItemRetrieveReviewsResponse { interface Reviewer { completed_at?: string; email?: string; identity_id?: string; ls_user_id?: string; name?: string; } } export interface ItemSetFinalResponse { answer?: AnnotationQueueItemAnswer; final?: AnnotationQueueItemAnswer; final_set_at?: string; final_set_by?: string; has_final?: boolean; key?: string; state?: AnnotationQueueItemAgreementState; } export interface ItemCreateParams { /** * Query param: Defaults to false. When true, upgrade the traces of added runs from * base to extended retention. Thread items are not upgraded. */ extend_trace_retention?: boolean; /** * Body param */ items?: Array; } export declare namespace ItemCreateParams { interface Item { item_type?: 'RUN' | 'THREAD'; project_id?: string; /** * RUN fields */ run_id?: string; /** * SessionID is an alias for project_id. */ session_id?: string; /** * SourceProposedExampleID links the queue item to the suggested example it was * created from, when applicable. */ source_proposed_example_id?: string; start_time?: string; thread_id?: string; } } export interface ItemUpdateParams { /** * Path param: Annotation queue ID */ queue_id: string; /** * Body param */ added_at?: string; /** * Body param */ last_reviewed_time?: string; } export interface ItemListParams extends ItemsCursorGetPaginationParams { /** * Review section: needs_my_review, needs_others_review, or archived */ status: 'needs_my_review' | 'needs_others_review' | 'archived'; /** * Only completed items whose reviewers disagreed on at least one rubric key. * Returns 501 unless multi-reviewer queues are on for the workspace. Requires * status=archived */ agreement?: 'disagreed'; /** * Pagination direction. backward requires cursor */ direction?: 'forward' | 'backward'; /** * Only completed items that do (true) or do not (false) still have a disagreed * rubric key with no final answer. Items with no agreement result match neither * value. Returns 501 unless multi-reviewer queues are on for the workspace. * Requires status=archived */ has_unresolved_keys?: boolean; /** * Filter to RUN or THREAD */ item_type?: 'RUN' | 'THREAD'; /** * Only items whose trace start time is at or before this timestamp. Omit or send * the zero time for no bound */ max_start_time?: string; /** * Only items whose trace start time is at or after this timestamp. Omit or send * the zero time for no bound */ min_start_time?: string; } export interface ItemClearFinalParams { /** * Annotation queue ID */ queue_id: string; /** * Annotation queue item ID */ item_id: string; } export interface ItemCreateStatusParams { override_added_at?: string; status?: 'viewed' | 'completed'; } export interface ItemDeleteAllParams { item_ids?: Array; } export interface ItemRetrieveCountParams { /** * Count bucket: all, needs_my_review, needs_others_review, or archived. */ status: string; /** * Count only completed items whose reviewers disagreed on at least one rubric key. * Returns 501 unless multi-reviewer queues are on for the workspace. Requires * status=archived */ agreement?: 'disagreed'; /** * Archived strictly before this time. Only used when status=archived */ end_time?: string; /** * Count only completed items that do (true) or do not (false) still have a * disagreed rubric key with no final answer. Items with no agreement result match * neither value. Returns 501 unless multi-reviewer queues are on for the * workspace. Requires status=archived */ has_unresolved_keys?: boolean; /** * Trace started at or before this time */ max_start_time?: string; /** * Trace started at or after this time */ min_start_time?: string; /** * Archived strictly after this time. Only used when status=archived */ start_time?: string; } export interface ItemRetrievePlacementParams { /** * Annotation queue ID */ queue_id: string; } export interface ItemRetrieveReviewsParams { /** * Annotation queue ID */ queue_id: string; } export interface ItemSetFinalParams { /** * Path param: Annotation queue ID */ queue_id: string; /** * Path param: Annotation queue item ID */ item_id: string; /** * Body param */ score?: number; /** * Body param */ value?: string; /** * Body param */ values?: Array; } export interface ItemSetReviewParams { /** * Path param: Annotation queue ID */ queue_id: string; /** * Path param: Annotation queue item ID */ item_id: string; /** * Body param */ score?: number; /** * Body param */ value?: string; /** * Body param */ values?: Array; } export declare namespace Items { export { type AnnotationQueueItemAgreementState as AnnotationQueueItemAgreementState, type AnnotationQueueItemAnswer as AnnotationQueueItemAnswer, type AnnotationQueueItemKeyReviews as AnnotationQueueItemKeyReviews, type ItemCreateResponse as ItemCreateResponse, type ItemUpdateResponse as ItemUpdateResponse, type ItemListResponse as ItemListResponse, type ItemCreateStatusResponse as ItemCreateStatusResponse, type ItemDeleteAllResponse as ItemDeleteAllResponse, type ItemRetrieveCountResponse as ItemRetrieveCountResponse, type ItemRetrievePlacementResponse as ItemRetrievePlacementResponse, type ItemRetrieveReviewsResponse as ItemRetrieveReviewsResponse, type ItemSetFinalResponse as ItemSetFinalResponse, type ItemListResponsesItemsCursorGetPagination as ItemListResponsesItemsCursorGetPagination, type ItemCreateParams as ItemCreateParams, type ItemUpdateParams as ItemUpdateParams, type ItemListParams as ItemListParams, type ItemClearFinalParams as ItemClearFinalParams, type ItemCreateStatusParams as ItemCreateStatusParams, type ItemDeleteAllParams as ItemDeleteAllParams, type ItemRetrieveCountParams as ItemRetrieveCountParams, type ItemRetrievePlacementParams as ItemRetrievePlacementParams, type ItemRetrieveReviewsParams as ItemRetrieveReviewsParams, type ItemSetFinalParams as ItemSetFinalParams, type ItemSetReviewParams as ItemSetReviewParams, }; }