@toloka-platform/sdk 0.21.0 → 0.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1 +1 @@
1
- c5879d0f45c0624ea34b9facc2d9b17e70c476bee73145288e23677277d9ba51 toloka.js.jsc
1
+ 831181f7121aa508b8e3df667735289e1f38f74a621f2b7356c50867184934ea toloka.js.jsc
@@ -1 +1 @@
1
- 0846e33c9b7a59d2a6339f0225f27e8e0e0f62b6ae18c4dba0d1cfb622eed464 toloka.js
1
+ 055b19591a1c69328511377f8564c8b052d6510771d13860cc2f1e9b9c63c378 toloka.js
@@ -590,6 +590,101 @@ export interface GenerationModel {
590
590
  budgets: GenerationBudget[];
591
591
  }
592
592
 
593
+ export type RunId = string;
594
+
595
+ export type ReviewId = string;
596
+
597
+ export type RunItemId = string;
598
+
599
+ export type ReviewStatus = 'needs_review' | 'returned' | 'checking' | 'accepted' | 'rejected' | 'expired';
600
+ export interface ReviewSummary {
601
+ id: ReviewId;
602
+ runId: RunId;
603
+ itemId: RunItemId;
604
+ nodeId: string;
605
+ nodeName: string;
606
+ status: ReviewStatus;
607
+ submittedAt: string;
608
+ deadlineAt: string;
609
+ closedAt: string | null;
610
+ }
611
+
612
+ export interface AcceptReviewsBody {
613
+ nodeId?: string;
614
+ expectedCount: number;
615
+ }
616
+
617
+ export interface AcceptReviewsResult {
618
+ count: number;
619
+ }
620
+
621
+ export interface ReviewQualityCriterion {
622
+ id: string;
623
+ qualityElement: string;
624
+ pass: string;
625
+ fail: string;
626
+ }
627
+
628
+ export type ReviewVerdictDecision = 'accept' | 'reject';
629
+ export type ReviewVerdictSource = 'ui' | 'api';
630
+ export type ReviewVerdictLlmQaCheckVerdict = 'agree' | 'disagree' | 'inconclusive';
631
+ export type ReviewVerdictLlmQaCheck = {
632
+ verdict: ReviewVerdictLlmQaCheckVerdict;
633
+ reason: string;
634
+ checkedAt: string;
635
+ } | null;
636
+
637
+ export interface ReviewVerdict {
638
+ id: string;
639
+ decision: ReviewVerdictDecision;
640
+ forced: boolean;
641
+ criteria: string[];
642
+ comment: string;
643
+ source: ReviewVerdictSource;
644
+ userId: string;
645
+ scopedTokenId: string | null;
646
+ llmQaCheck: ReviewVerdictLlmQaCheck;
647
+ createdAt: string;
648
+ }
649
+
650
+ export type ReviewPerformerType = 'expert' | 'synthetic';
651
+ export type ReviewPerformer = {
652
+ type: ReviewPerformerType;
653
+ expertId: string | null;
654
+ };
655
+
656
+ export type ReviewTaskContentInput = {[key: string]: unknown};
657
+
658
+ export type ReviewTaskContentOutput = {[key: string]: unknown};
659
+
660
+ export type ReviewTaskContent = {
661
+ input: ReviewTaskContentInput;
662
+ output: ReviewTaskContentOutput;
663
+ };
664
+
665
+ export interface Review {
666
+ id: ReviewId;
667
+ runId: RunId;
668
+ itemId: RunItemId;
669
+ nodeId: string;
670
+ nodeName: string;
671
+ status: ReviewStatus;
672
+ submittedAt: string;
673
+ deadlineAt: string;
674
+ closedAt: string | null;
675
+ performer: ReviewPerformer;
676
+ taskContent: ReviewTaskContent;
677
+ qualityCriteria: ReviewQualityCriterion[];
678
+ verdicts: ReviewVerdict[];
679
+ checkedRejectsLeft: number;
680
+ }
681
+
682
+ export interface RejectReviewBody {
683
+ criteria: string[];
684
+ comment: string;
685
+ force?: boolean;
686
+ }
687
+
593
688
  export type CurrentUserTeamsItem = {
594
689
  id: string;
595
690
  writable: boolean;
@@ -872,8 +967,6 @@ export interface PipelineCostEstimate {
872
967
  graphVersion: PipelineGraphVersion;
873
968
  }
874
969
 
875
- export type RunId = string;
876
-
877
970
  export interface RunStats {
878
971
  total: number;
879
972
  completed: number;
@@ -1396,6 +1489,8 @@ export type GenerationNodeSettingsQualityAssurance = {
1396
1489
  humanQaTimeForTask?: number;
1397
1490
  expertListId?: string | null;
1398
1491
  llmQaModelId?: 'gpt-5.6-terra' | 'gpt-5.6-luna' | 'gpt-5.4' | 'gpt-5.4-mini' | 'gpt-5' | 'gpt-5-mini' | 'claude-sonnet-4-6';
1492
+ } | {
1493
+ qaMode: 'customer_review';
1399
1494
  };
1400
1495
 
1401
1496
  export type GenerationNodeSettingsAudienceAndPricing = HumanAudienceAndPricing | {
@@ -1582,6 +1677,9 @@ export type CheckReport = {
1582
1677
  } | {
1583
1678
  type: 'no_items_matched';
1584
1679
  explanation: string;
1680
+ } | {
1681
+ type: 'no_dataset_selected';
1682
+ explanation: string;
1585
1683
  })[];
1586
1684
  checkedItemCount: number;
1587
1685
  } | {
@@ -1639,6 +1737,9 @@ export type CheckReport = {
1639
1737
  type: 'golden_values_too_large';
1640
1738
  totalValueBytes: number;
1641
1739
  explanation: string;
1740
+ } | {
1741
+ type: 'exam_not_checkable';
1742
+ explanation: string;
1642
1743
  })[];
1643
1744
  checkedItemCount: number;
1644
1745
  } | {
@@ -1736,8 +1837,6 @@ export interface ProjectFile {
1736
1837
  url: string;
1737
1838
  }
1738
1839
 
1739
- export type RunItemId = string;
1740
-
1741
1840
  export type RunItemStateStatus = 'idle' | 'in_progress' | 'completed' | 'failed' | 'canceled' | 'paused';
1742
1841
  export type RunItemStateInputFieldProxyRevisions = {[key: string]: string};
1743
1842
 
@@ -2050,6 +2149,19 @@ export type ListGenerationModels200 = {
2050
2149
  generationModels: GenerationModel[];
2051
2150
  };
2052
2151
 
2152
+ export type ListPipelineRunReviewsParams = {
2153
+ limit?: number;
2154
+ offset?: number;
2155
+ status?: ListPipelineRunReviewsStatus;
2156
+ nodeId?: string;
2157
+ };
2158
+
2159
+ export type ListPipelineRunReviewsStatus = 'awaiting' | 'checking' | 'closed';
2160
+ export type ListPipelineRunReviews200 = {
2161
+ reviews: ReviewSummary[];
2162
+ pagination: Pagination;
2163
+ };
2164
+
2053
2165
  export type ListDeliveryOrders200 = {
2054
2166
  deliveryOrders: DeliveryOrder[];
2055
2167
  };
@@ -1,4 +1,6 @@
1
1
  import type {
2
+ AcceptReviewsBody,
3
+ AcceptReviewsResult,
2
4
  AddDatasetItems200,
3
5
  AddDatasetItemsBody,
4
6
  AddExpertBanListExpertsBody,
@@ -71,6 +73,8 @@ import type {
71
73
  ListPipelineChecks200,
72
74
  ListPipelineRunItems200,
73
75
  ListPipelineRunItemsParams,
76
+ ListPipelineRunReviews200,
77
+ ListPipelineRunReviewsParams,
74
78
  ListPipelineRuns200,
75
79
  ListPipelineRunsParams,
76
80
  ListProjectDatasets200,
@@ -107,10 +111,13 @@ import type {
107
111
  ProjectId,
108
112
  ProjectSecret,
109
113
  ProjectSecretName,
114
+ RejectReviewBody,
110
115
  RemoveExpertBanListExpertsBody,
111
116
  RemoveExpertListExpertsBody,
112
117
  ReplacePipelineGraphBody,
113
118
  ReplaceTrainingConfigurationBody,
119
+ Review,
120
+ ReviewId,
114
121
  RevokedScopedTokens,
115
122
  RunCost,
116
123
  RunId,
@@ -1203,6 +1210,150 @@ export const listGenerationModels = async ( options?: Parameters<typeof potatoFe
1203
1210
 
1204
1211
 
1205
1212
 
1213
+ export const getListPipelineRunReviewsUrl = (runId: RunId,
1214
+ params?: ListPipelineRunReviewsParams,) => {
1215
+ const normalizedParams = new URLSearchParams();
1216
+
1217
+ Object.entries(params || {}).forEach(([key, value]) => {
1218
+
1219
+ if (value !== undefined) {
1220
+ normalizedParams.append(key, value === null ? 'null' : String(value))
1221
+ }
1222
+ });
1223
+
1224
+ const stringifiedParams = normalizedParams.toString();
1225
+
1226
+ return stringifiedParams.length > 0 ? `/api/v2-beta/runs/${runId}/reviews?${stringifiedParams}` : `/api/v2-beta/runs/${runId}/reviews`
1227
+ }
1228
+
1229
+ export const listPipelineRunReviews = async (runId: RunId,
1230
+ params?: ListPipelineRunReviewsParams, options?: Parameters<typeof potatoFetch>[1]): Promise<ListPipelineRunReviews200> => {
1231
+
1232
+ return potatoFetch<ListPipelineRunReviews200>(getListPipelineRunReviewsUrl(runId,params),
1233
+ {
1234
+ ...options,
1235
+ method: 'GET'
1236
+
1237
+
1238
+ }
1239
+ );}
1240
+
1241
+
1242
+
1243
+ export const getAcceptPipelineRunReviewsUrl = (runId: RunId,) => {
1244
+
1245
+
1246
+
1247
+
1248
+ return `/api/v2-beta/runs/${runId}/reviews/accept`
1249
+ }
1250
+
1251
+ export const acceptPipelineRunReviews = async (runId: RunId,
1252
+ acceptReviewsBody: AcceptReviewsBody, options?: Parameters<typeof potatoFetch>[1]): Promise<AcceptReviewsResult> => {
1253
+
1254
+ const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
1255
+ if (!h) return {};
1256
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1257
+ if (Symbol.iterator in h) {
1258
+ return Object.fromEntries(
1259
+ Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
1260
+ );
1261
+ }
1262
+ const headers: Record<string, string | readonly string[]> = {};
1263
+ for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
1264
+ if (value !== undefined) headers[name] = value;
1265
+ }
1266
+ return headers;
1267
+ };
1268
+ return potatoFetch<AcceptReviewsResult>(getAcceptPipelineRunReviewsUrl(runId),
1269
+ {
1270
+ ...options,
1271
+ method: 'POST',
1272
+ headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
1273
+ body: JSON.stringify(acceptReviewsBody)
1274
+ }
1275
+ );}
1276
+
1277
+
1278
+
1279
+ export const getGetReviewUrl = (reviewId: ReviewId,) => {
1280
+
1281
+
1282
+
1283
+
1284
+ return `/api/v2-beta/reviews/${reviewId}`
1285
+ }
1286
+
1287
+ export const getReview = async (reviewId: ReviewId, options?: Parameters<typeof potatoFetch>[1]): Promise<Review> => {
1288
+
1289
+ return potatoFetch<Review>(getGetReviewUrl(reviewId),
1290
+ {
1291
+ ...options,
1292
+ method: 'GET'
1293
+
1294
+
1295
+ }
1296
+ );}
1297
+
1298
+
1299
+
1300
+ export const getAcceptReviewUrl = (reviewId: ReviewId,) => {
1301
+
1302
+
1303
+
1304
+
1305
+ return `/api/v2-beta/reviews/${reviewId}/accept`
1306
+ }
1307
+
1308
+ export const acceptReview = async (reviewId: ReviewId, options?: Parameters<typeof potatoFetch>[1]): Promise<Review> => {
1309
+
1310
+ return potatoFetch<Review>(getAcceptReviewUrl(reviewId),
1311
+ {
1312
+ ...options,
1313
+ method: 'POST'
1314
+
1315
+
1316
+ }
1317
+ );}
1318
+
1319
+
1320
+
1321
+ export const getRejectReviewUrl = (reviewId: ReviewId,) => {
1322
+
1323
+
1324
+
1325
+
1326
+ return `/api/v2-beta/reviews/${reviewId}/reject`
1327
+ }
1328
+
1329
+ export const rejectReview = async (reviewId: ReviewId,
1330
+ rejectReviewBody: RejectReviewBody, options?: Parameters<typeof potatoFetch>[1]): Promise<Review> => {
1331
+
1332
+ const getHeaders = (h?: NonNullable<RequestInit['headers']>): Record<string, string | readonly string[]> => {
1333
+ if (!h) return {};
1334
+ if (h instanceof Headers) return Object.fromEntries(h.entries());
1335
+ if (Symbol.iterator in h) {
1336
+ return Object.fromEntries(
1337
+ Array.from(h as Iterable<Iterable<string>>, (entry) => Array.from(entry) as [string, string]),
1338
+ );
1339
+ }
1340
+ const headers: Record<string, string | readonly string[]> = {};
1341
+ for (const [name, value] of Object.entries<string | readonly string[] | undefined>(h)) {
1342
+ if (value !== undefined) headers[name] = value;
1343
+ }
1344
+ return headers;
1345
+ };
1346
+ return potatoFetch<Review>(getRejectReviewUrl(reviewId),
1347
+ {
1348
+ ...options,
1349
+ method: 'POST',
1350
+ headers: { 'Content-Type': 'application/json', ...getHeaders(options?.headers) },
1351
+ body: JSON.stringify(rejectReviewBody)
1352
+ }
1353
+ );}
1354
+
1355
+
1356
+
1206
1357
  export const getGetCurrentUserUrl = () => {
1207
1358
 
1208
1359
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toloka-platform/sdk",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "private": false,
5
5
  "description": "Build, inspect, and operate Toloka pipeline projects as TypeScript source. The public API may change between minor versions before 1.0.",
6
6
  "license": "Apache-2.0",
@@ -78,6 +78,6 @@
78
78
  "bun": ">=1.4.0"
79
79
  },
80
80
  "tolokaBuild": {
81
- "commit": "ebb44d001f2d81bea3c678bebfa24afaee273bd8"
81
+ "commit": "50d4d1f68bd1e23aedee5a962a96674d1883964b"
82
82
  }
83
83
  }
@@ -11,8 +11,8 @@
11
11
  "testing",
12
12
  "checks"
13
13
  ],
14
- "version": "0.21.0",
15
- "digest": "77d79baf90674ec502155aab57d3a80bc9e9a2f5679d0269c8bd160c8c64f9ee",
14
+ "version": "0.21.2",
15
+ "digest": "6e2a18f123c3559953e2ce21bf7a154a0793c6663150fde0e7a531bd89c34ff8",
16
16
  "files": [
17
17
  "SKILL.md",
18
18
  "references/human-work.md",
@@ -33,7 +33,7 @@
33
33
  "bug",
34
34
  "report"
35
35
  ],
36
- "version": "0.21.0",
36
+ "version": "0.21.2",
37
37
  "digest": "70f0bd2c80b32f87896aeb27c363b8a2d37f40e22424f57fe1aad142e125ad67",
38
38
  "files": [
39
39
  "SKILL.md",
@@ -50,7 +50,7 @@
50
50
  "getting-started",
51
51
  "agent"
52
52
  ],
53
- "version": "0.21.0",
53
+ "version": "0.21.2",
54
54
  "digest": "2278adeb46a792356579395fcf73c42322cb23bcd0c61e20856ccabdad6762d1",
55
55
  "files": [
56
56
  "SKILL.md"
@@ -67,7 +67,7 @@
67
67
  "sft",
68
68
  "models"
69
69
  ],
70
- "version": "0.21.0",
70
+ "version": "0.21.2",
71
71
  "digest": "3ce10dee5d3c283d8b5fdea15134a58fc738c7af2c1bb19eb5a0bf70ea0bca13",
72
72
  "files": [
73
73
  "SKILL.md"
@@ -84,7 +84,7 @@
84
84
  "prompt",
85
85
  "models"
86
86
  ],
87
- "version": "0.21.0",
87
+ "version": "0.21.2",
88
88
  "digest": "be8bce8d9cf7241ccb60d2b2a9b7cc07d7755a76e8ff8ec1b0847c49efbb3469",
89
89
  "files": [
90
90
  "SKILL.md"
@@ -20,7 +20,7 @@ Use `about.projectType: 'data_collection'` only when experts upload or record me
20
20
  - `qualityCriteria`: semantic pass/fail rubrics targeting output `Field` objects.
21
21
  - `instruction`: English labeler guidance reflecting the actual entities, UI, and criteria.
22
22
  - `ui`: `{ code, data, preprocess, postprocess?, constants }` for the task interface.
23
- - `qualityAssurance`: `llm_only`, `hybrid`, or `human_only`.
23
+ - `qualityAssurance`: `llm_only`, `hybrid`, or `human_only`; some teams can also use `customer_review`, where their own team accepts or rejects every task. For a team without it, validation answers `The "customerReview" feature is not enabled for this team`: then the mode is not available, so offer another one. Keep `customer_review` when a node already has it, and read the toloka-customer-review skill before setting it or touching its reviews.
24
24
  - `audienceAndPricing`: either a human audience or synthetic generation.
25
25
  - `onboarding`: built-in Training stage.
26
26
  - `exam`: optional built-in qualification gate.
@@ -131,6 +131,6 @@ Create a second live project with `toloka project create <alias>` or register an
131
131
 
132
132
  ## Hand out a project-scoped token
133
133
 
134
- `toloka project token` mints a token that acts as the signed-in user inside the selected project only (`--projects` adds more projects of the same team), with the permissions of `--preset` (default `write`) or an explicit `--permissions` list, for at most six hours. It is printed once and never stored; pass it to another agent or script as `TOLOKA_SCOPED_TOKEN`, as the command says. `toloka project tokens` lists the live tokens of the project; `toloka project revoke-token <tokenId>` ends one and `toloka project revoke-tokens` ends every live token of the project at once, for example when a run finished or a token leaked. One user may hold at most 1000 live tokens per project; when `token` fails with `429 … revoke unused tokens first`, run `revoke-tokens`.
134
+ `toloka project token` mints a token that acts as the signed-in user inside the selected project only (`--projects` adds more projects of the same team), with the permissions of `--preset` (default `write`) or an explicit `--permissions` list, for at most six hours. Only the `deploy` and `labeling-deploy` presets can spend money: they launch runs. Every preset except `read` and `labeling-read` can decide customer reviews (`review:write`). It is printed once and never stored; pass it to another agent or script as `TOLOKA_SCOPED_TOKEN`, as the command says. `toloka project tokens` lists the live tokens of the project; `toloka project revoke-token <tokenId>` ends one and `toloka project revoke-tokens` ends every live token of the project at once, for example when a run finished or a token leaked. One user may hold at most 1000 live tokens per project; when `token` fails with `429 … revoke unused tokens first`, run `revoke-tokens`.
135
135
 
136
136
  A scoped token downloads project files in two steps: a request to `ProjectFile.url` with the token answers `200 {"url": "<storage URL>"}` instead of the redirect a human credential gets. Fetch that `url` as a plain request without the `X-Scoped-Token` header; HTTP clients replay custom headers across redirects, and the token must never reach the storage host.
@@ -35,6 +35,7 @@ Run `toloka --help` and `toloka <command> --help` for the exact commands and opt
35
35
  - source reconciliation: `init`, `import`, `check`, `validate`, `plan`, `apply`, `status`, `secret set`;
36
36
  - catalogs: `audience specialization list`, `generation-model list`, `ui components`;
37
37
  - data and runs: `dataset` (`list`, `create`, `fields`, `fields add`, `columns`, `load`, `upload`, `split`, `slice`), `pipeline` (`list`, `run`, `status`, `runs`, `cost`, `results`, `cancel`);
38
+ - customer review, only for teams that have it (other teams get a 403): `review` (`list`, `get`, `accept`, `reject`), described in the toloka-customer-review skill;
38
39
  - models and training: `base-model`, `model` (including `model version download`), `training`, `batch-inference` (`run`, `list`, `status`, `confirm`, `resume`, `cancel`);
39
40
  - skills and reports: `skill` (`list`, `search`, `install`), `report`.
40
41
 
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: toloka-customer-review
3
+ description: Set up customer review on Toloka generation nodes and work through the review queue of a run with the toloka CLI, accepting or rejecting tasks with evidence. Only for teams with customer review enabled. Use when the user wants their own team to approve each generation result, asks which tasks wait for their decision, or asks to accept or reject reviewed tasks.
4
+ ---
5
+
6
+ # Customer review
7
+
8
+ Customer review is a quality assurance mode of generation nodes for teams that have it enabled: the customer's own team accepts or rejects every task the node produces.
9
+
10
+ Customer review is available only to some teams, and nothing shows in advance whether a team has it. For a team without it, validation, deploy, and every review command answer `403 The "customerReview" feature is not enabled for this team`. Treat that answer as "customer review is not available for this team": stop, tell the user, do not offer the mode again, and if a node of theirs already has it, offer another QA mode.
11
+
12
+ ## What the mode does
13
+
14
+ - It is set on a generation node as `qualityAssurance: { qaMode: 'customer_review' }`, with no other settings. Quorum nodes do not support it.
15
+ - Each item gets one task, nothing is redone, and the team's decision on that task is final for the item.
16
+ - Automatic grading is off on such a node: no LLM QA grades its tasks, and no Human QA reviews them. The one automated step left is the **LLM QA check**: every reject that is not forced goes to an LLM, which reads the task, the quality criteria the reject names, and its comment, and answers whether that evidence holds.
17
+ - It works with every workforce a generation node supports, including synthetic generation, and with Training and Exam.
18
+ - Quality criteria are still required: a reject names the criteria the task fails, and the LLM QA check reads them.
19
+
20
+ ## When to suggest it
21
+
22
+ Suggest it only when the user wants their own team to approve each result, for example a sign-off, acceptance against their own standard, or a contract that requires it. Never suggest it by default, and never infer it from the quality criteria.
23
+
24
+ Before switching a node to it, explain the trade-offs:
25
+
26
+ - someone on the team has to decide every task before its deadline, or the task is accepted automatically and billed;
27
+ - throughput follows the team's review speed;
28
+ - items wait at the node, and the run finishes only after its last review closes.
29
+
30
+ ## How a review goes
31
+
32
+ - When a task is submitted, its review opens with a deadline for a decision (`deadlineAt`).
33
+ - **Accept** is final at once: the expert is paid, the task is billed, and the item moves on to the next node.
34
+ - **Reject** names at least one of the review's quality criteria (the IDs that `toloka review get` prints) and explains in a non-empty comment what is wrong. The review then waits for the LLM QA check (`checking`) and refuses decisions until the check answers:
35
+ - `agree`: the reject is final. The item fails at this node and is not redone; nothing is billed for the task, and the expert is not paid.
36
+ - `disagree`: the evidence does not hold. The review returns (`returned`) with the check's reason; accept the task, or reject again with better evidence.
37
+ - `inconclusive`: the check could not decide, for example because its run failed repeatedly or gave no readable answer. The review also returns.
38
+ - Each review allows a limited number of checked rejects (`checkedRejectsLeft`). When none are left, accept the task or send a forced reject: the check has returned a reject by then, so the forced reject is allowed.
39
+ - **Forced reject** (`--force`) works only through the API and the CLI, never in the UI, and only after the LLM QA check has returned a reject of the same review. A forced reject on a review that has no returned check is a conflict: reject without `--force` first. It still needs criteria and a comment, skips the LLM QA check, is final at once, and does not use up a checked reject.
40
+ - Canceling a run does not close its open reviews: they keep waiting for the team's decision and expire at their deadline as usual.
41
+
42
+ ## Deadline and expiry
43
+
44
+ - From `deadlineAt` on, the review takes no more decisions.
45
+ - A review that waits for a decision at its deadline (`needs_review` or `returned`) expires: the task is accepted automatically, the expert is paid, the task is billed, and the item moves on.
46
+ - A review that is `checking` at its deadline stays open until the LLM QA check answers. If the check agrees, the reject is final. Otherwise the review expires as above, and nobody can decide it again.
47
+ - So `deadlineAt` is when decisions stop, not the exact moment the review closes: an expiry takes effect shortly after the deadline, and a review that is checking closes when the check answers.
48
+
49
+ ## Statuses
50
+
51
+ - `needs_review`: waits for the first decision.
52
+ - `returned`: the LLM QA check did not confirm the last reject (`disagree` or `inconclusive`), so the review waits for a new decision.
53
+ - `checking`: the LLM QA check is checking a reject; decisions are refused until it answers.
54
+ - `accepted`: the team accepted the task.
55
+ - `rejected`: the reject is final, either forced or confirmed by the LLM QA check, and the item failed at this node.
56
+ - `expired`: the deadline passed while the review was open, whether it waited for a first decision, was returned, or was checking a reject that the check then did not confirm. The task was accepted automatically.
57
+
58
+ ## Billing
59
+
60
+ - An accepted task, whether the team accepted it or its review expired, bills the node's per-task price, plus the Training and Exam bonuses when it is the expert's first accepted task. For synthetic generation, it bills that task's generation tokens.
61
+ - A finally rejected task bills nothing.
62
+ - The LLM QA check is not billed. The cost forecast has no QA line for the node, and its maximum assumes every task is accepted.
63
+
64
+ ## Work through the queue
65
+
66
+ The team decides in the platform UI (the run's Items tab: open an item, then Review), through the API, or with these commands:
67
+
68
+ 1. `toloka review list --run <run-id>` lists the reviews that still take a decision (`needs_review` and `returned` before their deadline), soonest deadline first. `--status checking` and `--status closed` show the other views, `--node <node-id>` keeps one node, and `--json` prints JSON.
69
+ 2. `toloka review get <review-id>` shows the review's status and deadline, the quality criteria with their IDs, the decisions so far with the answers of the LLM QA check, and the task content. Project files in the task content appear as file proxy URLs. The output is cut to at most 20 quality criteria, 20 criteria in each decision, 1,000 characters of each text, and 8,000 characters of task content, and it says what it cut. `--out <file>` saves the whole review as JSON; read that file in parts. `--json` prints the same cut view, with the task content as JSON text in `taskContentJson` and a `truncated` summary that is `null` when nothing was cut and otherwise has:
70
+ - `taskContentCharacters`: the full length of the task content when it was cut, otherwise `null`;
71
+ - `truncatedQualityCriterionCount`: how many quality criteria were left out;
72
+ - `truncatedVerdictCriteria`: each decision whose criteria were cut (`field`), with how many were left out (`truncatedCount`);
73
+ - `cutTexts`: each cut text (`field`), with its full length (`characters`);
74
+ - `hint`: the command that saves the full review.
75
+ 3. Decide with `toloka review accept <review-id>`, or `toloka review reject <review-id> --criterion <criterion-id> --comment "<what is wrong>"`. Repeat `--criterion` for each failed criterion. With `--json`, both print the review after the decision in the same cut view as `toloka review get --json`.
76
+ 4. A decision moves the review out of the awaiting list, so list again from the start instead of paging forward with `--offset`.
77
+
78
+ To accept every review that awaits a decision in a run, or in one node, send one bulk accept instead of a command per review: `toloka review accept --run <run-id> [--node <node-id>] --expected <n>`, where `<n>` is the number of awaiting reviews the user confirmed (the total that `toloka review list` prints). When a different number awaits a decision now, it accepts nothing and says the current number; confirm again with the user. The accepts run in the background, each like a single accept. A review that is decided, rejected, or past its deadline before its turn is skipped, and reviews that open later are not included. Follow the progress with `toloka review list`: accepted reviews leave the awaiting list. There is no bulk reject: reject one review at a time, each with its own evidence.
79
+
80
+ When a command fails:
81
+
82
+ - `The "customerReview" feature is not enabled for this team`: the team does not have customer review. Stop and tell the user.
83
+ - `Scoped token does not allow review:write`: the token can read reviews but not decide them. Every preset except `read` and `labeling-read` includes `review:write`. Tell the user instead of looking for another way to decide.
84
+ - A conflict (HTTP 409): the review cannot take the decision now, because the LLM QA check is still checking, the checked rejects are used up, a forced reject came before any returned check, or the review is closed or past its deadline. Run `toloka review get <review-id>` and act on its status.
85
+
86
+ ## Decide only when asked
87
+
88
+ - Accept or reject only on the user's explicit instruction that names the reviews, or an exact filter such as "the awaiting reviews of node X in run Y". Accepting pays the expert and bills the task at once, and a final reject fails the item; neither can be undone.
89
+ - Before a bulk accept or more than one decision, tell the user how many reviews you are about to decide and how, show at most 5 of them as a sample with the decision for each, and get their confirmation. Send a confirmed accept of all of them as one bulk accept with that number as `--expected`.
90
+ - Send a forced reject only when the user explicitly asks for one.
91
+ - Never decide reviews just to let a run finish.
92
+
93
+ ## In pipeline source
94
+
95
+ A generation node with customer review has `qualityAssurance: { qaMode: 'customer_review' }`. Keep it as imported unless the user asks to change it.