@toloka-platform/sdk 0.21.3 → 0.23.0

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
- 4d777427276ecb990abe437dfeb38bbd923aa6e0aae8e05fbc8975d0a5e63e7a toloka.js.jsc
1
+ c5012f32fc01c4901e856151c3988c06ba055bc67126828288b41df408c0bfa2 toloka.js.jsc
@@ -1 +1 @@
1
- b18a8a48f38fb93af7699c55ec3a43a195d0b18ad5d5c52cfa9d07672840d2f1 toloka.js
1
+ 8d0987bbcc4d440af1d6d49038a15a7bd4c0b0128a7920a4a1a3efe1b52a39b0 toloka.js
@@ -882,6 +882,20 @@ export interface UploadJob {
882
882
  result: UploadJobResult;
883
883
  }
884
884
 
885
+ export type ExpertListPredicateOperator = 'list_in' | 'list_nin';
886
+ export interface ExpertListPredicate {
887
+ operator: ExpertListPredicateOperator;
888
+ expertListId: string;
889
+ }
890
+
891
+ export type ExpertListConditionGroupLogic = 'and' | 'or';
892
+ export interface ExpertListConditionGroup {
893
+ logic: ExpertListConditionGroupLogic;
894
+ predicates: ExpertListCondition[];
895
+ }
896
+
897
+ export type ExpertListCondition = ExpertListPredicate | ExpertListConditionGroup;
898
+
885
899
  export type PipelineGraphVersion = string;
886
900
 
887
901
  export type CostBreakdownLineLineId = 'expert_task' | 'llm_qa' | 'video_tool' | 'human_qa_task' | 'onboarding_task' | 'exam_task' | 'synthetic_generation_input_tokens' | 'synthetic_generation_cached_tokens' | 'synthetic_generation_output_tokens';
@@ -1327,7 +1341,7 @@ export interface HumanAudienceAndPricing {
1327
1341
  timeForTask: number;
1328
1342
  perExpertCapEnabled?: boolean;
1329
1343
  perExpertCapValue?: number;
1330
- expertListId?: string | null;
1344
+ expertListCondition?: ExpertListCondition | null;
1331
1345
  audienceType: 'human';
1332
1346
  }
1333
1347
 
@@ -1463,7 +1477,6 @@ export interface QualificationExam {
1463
1477
  passThreshold: number;
1464
1478
  }
1465
1479
 
1466
- export type GenerationNodeSettingsAudienceMode = 'legacy' | 'service';
1467
1480
  export type SmartSearch = {
1468
1481
  briefDescription: string;
1469
1482
  projectDescription: string | null;
@@ -1482,12 +1495,12 @@ export type GenerationNodeSettingsQualityAssurance = {
1482
1495
  qaMode: 'human_only';
1483
1496
  smartSamplingPercent?: number;
1484
1497
  humanQaTimeForTask?: number;
1485
- expertListId?: string | null;
1498
+ expertListCondition?: ExpertListCondition | null;
1486
1499
  } | {
1487
1500
  qaMode: 'hybrid';
1488
1501
  smartSamplingPercent?: number;
1489
1502
  humanQaTimeForTask?: number;
1490
- expertListId?: string | null;
1503
+ expertListCondition?: ExpertListCondition | null;
1491
1504
  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
1505
  } | {
1493
1506
  qaMode: 'customer_review';
@@ -1518,7 +1531,6 @@ export interface GenerationNodeSettings {
1518
1531
  onboarding: Onboarding;
1519
1532
  exam?: QualificationExam;
1520
1533
  reuseAudienceWithNodeId?: GenerationNodeSettingsReuseAudienceWithNodeId;
1521
- audienceMode?: GenerationNodeSettingsAudienceMode;
1522
1534
  smartSearch?: SmartSearch | null;
1523
1535
  checks?: Partial<Record<'ui' | 'llmqa' | 'annotation_qa' | 'qc_lint' | 'ui_types_lint' | 'exam_dataset' | 'synthgen', CheckTestCases>>;
1524
1536
  }
@@ -1566,7 +1578,6 @@ export interface MatchNode {
1566
1578
  }
1567
1579
 
1568
1580
  export type QuorumNodeSettingsOffboardingRulesItemType = 'mv_agreement';
1569
- export type QuorumNodeSettingsAudienceMode = 'legacy' | 'service';
1570
1581
  export type QuorumNodeSettingsOffboardingRulesItem = {
1571
1582
  id: string;
1572
1583
  type?: QuorumNodeSettingsOffboardingRulesItemType;
@@ -1599,7 +1610,6 @@ export interface QuorumNodeSettings {
1599
1610
  onboarding: Onboarding;
1600
1611
  exam?: QualificationExam;
1601
1612
  reuseAudienceWithNodeId?: QuorumNodeSettingsReuseAudienceWithNodeId;
1602
- audienceMode?: QuorumNodeSettingsAudienceMode;
1603
1613
  smartSearch?: SmartSearch | null;
1604
1614
  checks?: Partial<Record<'ui' | 'llmqa' | 'annotation_qa' | 'qc_lint' | 'ui_types_lint' | 'exam_dataset', CheckTestCases>>;
1605
1615
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toloka-platform/sdk",
3
- "version": "0.21.3",
3
+ "version": "0.23.0",
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": "88e23ffa3c482d093126db04d5289e4832a123f6"
81
+ "commit": "b584929fbb752fb3bb033d38c307b2a4caa35534"
82
82
  }
83
83
  }
@@ -11,8 +11,8 @@
11
11
  "testing",
12
12
  "checks"
13
13
  ],
14
- "version": "0.21.3",
15
- "digest": "6e2a18f123c3559953e2ce21bf7a154a0793c6663150fde0e7a531bd89c34ff8",
14
+ "version": "0.23.0",
15
+ "digest": "e6c10fe9f723173939aae4ec4fdf68cb2a76dcec2d2a8a39ea669305dd4ffd8b",
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.3",
36
+ "version": "0.23.0",
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.3",
53
+ "version": "0.23.0",
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.3",
70
+ "version": "0.23.0",
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.3",
87
+ "version": "0.23.0",
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`; 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.
23
+ - `qualityAssurance`: `llm_only`, `hybrid`, or `human_only`, and for some teams `customer_review` (see [Customer review](#customer-review)).
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.
@@ -49,7 +49,7 @@ Write at least one criterion for every output entity. Each criterion needs an au
49
49
 
50
50
  Use `llmQaInstruction` only when the evaluator needs a specific verification method, authoritative source, tool, or pinned edge case beyond the thresholds. It is evaluator guidance, not labeler guidance, and has no effect in `human_only` mode.
51
51
 
52
- Default QA is `qualityAssurance: { qaMode: 'llm_only' }`. Keep it when it fits the task. `hybrid` adds sampled Human QA while retaining LLM review; `human_only` is appropriate when LLM grading is prohibited or human review alone is required. Recommend a mode based on the user's quality and privacy requirements, explaining cost and turnaround implications before changing it. Human-bearing modes require `humanQaTimeForTask` in whole seconds: at least 30 and at least 3 per quality criterion of the node, whichever is larger, and at most 359,999 (99:59:59). A reviewer keeps a Human QA task for `humanQaTimeForTask` plus 1 hour, and for at least 8 hours. A dropped task stays with that reviewer until this time ends, then another reviewer can take it; `smartSamplingPercent` defaults to 30 for hybrid and 100 for human-only. Use those defaults unless the task justifies a different rate. Human QA on a node is capped at the Maximum of its Human QA line in the frozen estimate: 3 reviews for each item of the run. The cap counts every item of the run, so a branch behind a `match` that receives more than its even share still gets Human QA. Before deploy, the platform counts the QA pool: experts who match the node's audience and hold the platform QA qualification and were active in the last 14 days, or have recent QA experience (at least 1 completed QA task and a recent visit; Smart Search invites these at deploy, except on a node that reuses an earlier audience or keeps its workforce request closed). The data is rebuilt once a day. With none, validation returns a blocking error and the deploy is rejected. The reviewers come from the node's own audience, because a node has no separate reviewer audience. So for that error, offer to widen the audience (drop specializations first, then countries) or to switch to `llm_only`; do not suggest waiting, because the count is refreshed once a day and nothing shows whether more reviewers will become active. When the count is too small for the node's expected reviews (the platform assumes that 1 of 10 of these experts reviews, for up to 12 hours each), `toloka validate` returns a `severity: 'warning'` issue on the node whose message starts with `Human QA on "<node name>" may stall`. The warning does not block the deploy. Tell the user the numbers in the message and offer its remedies: widen the audience or switch to `llm_only` (or to `hybrid` when the node is `human_only`); change none of them without the user's approval. A node that reuses the human reviewers of an earlier deployment skips this count. QA mode applies to the whole node, not individual criteria. The redo cap is platform-controlled and is not an SDK setting.
52
+ Default QA is `qualityAssurance: { qaMode: 'llm_only' }`. Keep it when it fits the task. `hybrid` adds sampled Human QA while retaining LLM review; `human_only` is appropriate when LLM grading is prohibited or human review alone is required. Suggest `customer_review` only when the user wants their own team to approve each result, such as a sign-off, acceptance against their own standard, or a contract that requires it; never suggest it by default or infer it from the quality criteria. Only some teams have it; see [Customer review](#customer-review). Recommend a mode based on the user's quality and privacy requirements, explaining cost and turnaround implications before changing it. Human-bearing modes require `humanQaTimeForTask` in whole seconds: at least 30 and at least 3 per quality criterion of the node, whichever is larger, and at most 359,999 (99:59:59). A reviewer keeps a Human QA task for `humanQaTimeForTask` plus 1 hour, and for at least 8 hours. A dropped task stays with that reviewer until this time ends, then another reviewer can take it; `smartSamplingPercent` defaults to 30 for hybrid and 100 for human-only. Use those defaults unless the task justifies a different rate. Human QA on a node is capped at the Maximum of its Human QA line in the frozen estimate: 3 reviews for each item of the run. The cap counts every item of the run, so a branch behind a `match` that receives more than its even share still gets Human QA. Before deploy, the platform counts the QA pool: experts who match the node's audience and hold the platform QA qualification and were active in the last 14 days, or have recent QA experience (at least 1 completed QA task and a recent visit; Smart Search invites these at deploy, except on a node that reuses an earlier audience). The data is rebuilt once a day. With none, validation returns a blocking error and the deploy is rejected. The reviewers come from the node's own audience, because a node has no separate reviewer audience. So for that error, offer to widen the audience (drop specializations first, then countries) or to switch to `llm_only`; do not suggest waiting, because the count is refreshed once a day and nothing shows whether more reviewers will become active. When the count is too small for the node's expected reviews (the platform assumes that 1 of 10 of these experts reviews, for up to 12 hours each), `toloka validate` returns a `severity: 'warning'` issue on the node whose message starts with `Human QA on "<node name>" may stall`. The warning does not block the deploy. Tell the user the numbers in the message and offer its remedies: widen the audience or switch to `llm_only` (or to `hybrid` when the node is `human_only`); change none of them without the user's approval. A node that reuses the human reviewers of an earlier deployment skips this count. QA mode applies to the whole node, not individual criteria. The redo cap is platform-controlled and is not an SDK setting.
53
53
 
54
54
  The platform also writes annotator fields on human-expert generation nodes. `<snake_cased node name>_annotator_id` is an optional string: the ID of the expert whose answer was accepted, not of earlier rejected attempts. `<snake_cased node name>_qa_annotator_id` exists only in `human_only` and `hybrid` modes: the ID of the expert who made the last human review decision, missing when sampling skipped human review. Both are missing on canceled items and on items completed before they existed; synthetic nodes have neither. The platform also writes one `*_evaluation_result` field per quality criterion with LLM or Human QA verdicts, `<snake_cased node name>_qa_metadata`, and, on a synthetic node with LLM QA, `<snake_cased node name>_evaluation_summary`. Never declare any of these with `field()`: the platform owns them, and an authored field with that name collides with it. Read them from the dataset with `toloka dataset load`.
55
55
 
@@ -65,15 +65,48 @@ Use `audienceType: 'synthetic'` only when the user explicitly asks for model-gen
65
65
 
66
66
  #### Expert lists and bans
67
67
 
68
- Expert lists and expert bans are enabled for a team together, and only on top of the audience service: `toloka expert-list` and `toloka expert-ban-list` work only for teams with expert lists enabled, and apply rejects `audienceMode: 'service'` unless the team has the audience service enabled. Use them only when the user asks for a fixed set of experts or a ban.
68
+ Expert lists and expert bans are enabled for a team together: `toloka expert-list` and `toloka expert-ban-list` work only for teams with expert lists enabled. Use them only when the user asks for a fixed set of experts or a ban.
69
69
 
70
- - `audienceMode: 'service'` on a `generation` or `quorum` node switches it to the audience service; `'legacy'` (or omitting it on a new node) keeps audience filters and smart search. With the service, `audienceAndPricing.expertListId` takes the labeling experts from an expert list, and on `generation` `qualityAssurance.expertListId` does the same for human QA (`human_only` or `hybrid`). The audience filters then stop deciding who gets tasks; `pricePerTask`, `timeForTask`, and the per-expert cap still apply.
71
- - Keep the settings `toloka import` wrote. Leaving a field out never detaches a list: plan shows no change for it, but apply rejects the whole graph while any node leaves out a setting the platform has, even when you only changed another node. Run `toloka import` to bring the settings into the source. To remove them, set `audienceMode: 'legacy'` and `expertListId: null` explicitly.
72
- - Manage lists with `toloka expert-list`: `list`, `create <name>`, `add <list> --file ids.txt` (one expert ID per line), `remove`, `show <list>`, `experts <list>`, `rename`, `hide`, `unhide`. `<list>` is the `exl.` ID or the list name. Pass large ID sets with `--file`, never as thousands of arguments. Copy the `exl.` ID from `toloka expert-list list` into `expertListId`; an ID from another project is rejected.
70
+ - The platform decides how a `generation` or `quorum` node finds experts; there is no setting for it, and apply rejects an `audienceMode` left in an older source, so delete it. A few teams stay on the legacy audience (audience filters and smart search) and can't use expert lists. `audienceAndPricing.expertListCondition` takes the labeling experts from expert lists, and on `generation` `qualityAssurance.expertListCondition` does the same for human QA (`human_only` or `hybrid`). One list is `{ operator: "list_in", expertListId: "exl.…" }`; experts in any of several lists are `{ logic: "or", predicates: [list_in…] }`; to leave out experts who are also in other lists, wrap it as `{ logic: "and", predicates: [<the list_in part>, { operator: "list_nin", expertListId: "exl.…" }…] }`. Other combinations are rejected, and a list can't be both included and excluded. The audience filters then stop deciding who gets tasks; `pricePerTask`, `timeForTask`, and the per-expert cap still apply.
71
+ - Keep the settings `toloka import` wrote. Leaving a field out never detaches a list: plan shows no change for it, but apply rejects the whole graph while any node leaves out a setting the platform has, even when you only changed another node. Run `toloka import` to bring the settings into the source. To detach the lists, set `expertListCondition: null` explicitly.
72
+ - Manage lists with `toloka expert-list`: `list`, `create <name>`, `add <list> --file ids.txt` (one expert ID per line), `remove`, `show <list>`, `experts <list>`, `rename`, `hide`, `unhide`. `<list>` is the `exl.` ID or the list name. Pass large ID sets with `--file`, never as thousands of arguments. Copy the `exl.` ID from `toloka expert-list list` into `expertListCondition.expertListId`; an ID from another project is rejected.
73
73
  - After adding experts, run `toloka expert-list show <list>` and report `AVAILABLE`. Availability is checked in the background, so `PENDING` drops over a few minutes. Apply rejects a node whose list has no available experts yet; wait until `AVAILABLE` is above 0, then apply. If few experts are available for the number of items, say so, and mention the per-expert cap when it is on. A hidden list keeps working in runs, but experts can't be added to or removed from it until it is unhidden.
74
- - Don't use the same list for labeling and human QA: experts would review their own work, and validation warns about it.
74
+ - Don't use the same list for labeling and human QA: experts would review their own work, and validation warns about it. To keep them apart while the lists overlap, exclude the labeling lists from the QA condition with `list_nin`.
75
75
  - Ban experts from the project with `toloka expert-ban-list add <expertIds...> --reason <text>` (or `--file`), lift bans with `toloka expert-ban-list remove`, and see them with `toloka expert-ban-list show` and `toloka expert-ban-list experts`. Banned experts can't be invited and are removed from the work they are in, so confirm the expert IDs with the user before banning. Team-wide bans are managed in the platform UI only.
76
76
 
77
+ #### Customer review
78
+
79
+ Customer review is a QA mode of `generation` nodes, not `quorum`, in which the user's own team accepts or rejects every task. Only some teams have it, and nothing shows in advance which. For a team without it, validation, deploy, and the API answer `403 The "customerReview" feature is not enabled for this team`, and `toloka review` prints `Customer review is not enabled for this team.`: tell the user customer review is not available for their team, do not offer it again, and offer another QA mode. Keep `customer_review` on a node that already has it.
80
+
81
+ - Set `qualityAssurance: { qaMode: 'customer_review' }` with no other settings. It works with synthetic generation, Training, and Exam. Quality criteria are still required: a reject names the criteria the task fails.
82
+ - No LLM QA or Human QA grades the node's tasks, so it writes no `*_evaluation_result` fields. Each item gets one task, and nothing is redone.
83
+ - Before switching a node to it, explain the trade-offs: someone on the team must decide every task before its deadline (7 days after submission by default), or the task is accepted automatically, the expert is paid, and the task is billed; throughput follows the team's review speed; the run finishes only after its last review closes; a final reject fails the item at this node.
84
+
85
+ How a review goes:
86
+
87
+ - **Accept** is final at once: the expert is paid, the task is billed, and the item moves on.
88
+ - **Reject** names at least one of the review's quality criteria by ID and explains in a non-empty comment what is wrong. The review is then `checking` and refuses decisions until a check, which reads the task, the named criteria, and the comment, answers: `agree` makes the reject final (`rejected`: the item fails, the expert is not paid, nothing is billed); `disagree` or `inconclusive` sends the review back (`returned`) with the check's reason for a new decision.
89
+ - A review allows at most 10 checked rejects (`checkedRejectsLeft`). A forced reject (`--force`, API and CLI only, never the UI) skips the check and is final at once, but is accepted only after the check has returned a reject of the same review; it still needs criteria and a comment.
90
+ - Statuses: `needs_review` (awaits the first decision), `returned`, `checking`, `accepted`, `rejected`, and `expired`.
91
+ - From the deadline on, a review takes no decisions. One that awaits a decision expires: the task is accepted automatically and billed. One that is `checking` closes when the check answers: `rejected` on `agree`, otherwise `expired`.
92
+ - Billing: an accepted or expired task bills the node's per-task price, plus the Training and Exam bonuses on the expert's first accepted task; on a synthetic node, its generation tokens. A finally rejected task bills nothing. 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.
93
+
94
+ Work through the queue with `toloka review` (the team can also decide in the run's Items tab):
95
+
96
+ - `toloka review list --run <run-id> [--node <node-id>]` lists the reviews that await a decision, soonest deadline first; `--status checking` and `--status closed` show the others. A decision moves a review out of the list, so list again from the start instead of paging with `--offset`.
97
+ - `toloka review get <review-id>` shows the status, deadline, quality criteria with their IDs, decisions with the check's answers, and the task content. Long content is cut; `toloka review get --help` says how, and `--out <file>` saves the whole review as JSON.
98
+ - `toloka review accept <review-id>`, or `toloka review reject <review-id> --criterion <criterion-id> --comment "<what is wrong>"`, repeating `--criterion` for each failed criterion.
99
+ - `toloka review accept --run <run-id> [--node <node-id>] --expected <n>` accepts every awaiting review in the background, where `<n>` is the count the user confirmed (the total `toloka review list` prints). When a different number awaits, it accepts nothing and says the current number; confirm again. Reviews that open later are not included. Follow it with `toloka review list`. There is no bulk reject.
100
+
101
+ Decide only when asked:
102
+
103
+ - 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". Neither an accept nor a final reject can be undone.
104
+ - Before a bulk accept or more than one decision, tell the user how many reviews you will decide and how, show at most 5 of them with the decision for each, and get confirmation. Send a confirmed accept of all of them as one bulk accept.
105
+ - Send a forced reject only when the user explicitly asks for one.
106
+ - Never decide reviews just to let a run finish.
107
+
108
+ When a command fails with `Scoped token does not allow review:write`, the token can read reviews but not decide them; every preset except `read` and `labeling-read` includes it. Tell the user instead of looking for another way. A 409 means the review cannot take the decision now: the check is still running, 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.
109
+
77
110
  #### Training, Exam, UI, and advanced settings
78
111
 
79
112
  Treat `onboarding` as the node's Training course. It has `enabled`, `steps`, and `info` (`estimatedTime`, `role`, `goal`, `successCriteria`). Give every new human node a real course built from the instruction, criteria, UI, edge cases, and verified examples; the constructor's placeholder, one text step without a quiz, is not one and fails the rules below. While it is enabled, validation requires non-empty `info.role`, `info.goal`, and `info.successCriteria`, three to six steps, and at least one quiz block; a course uses either a practice block or an examples block, not both, and an examples block needs a built UI. A practice block together with an enabled Exam draws a warning, because the Exam already tests experts on real tasks. Preserve an explicit `enabled: false`. Never invent golden answers or media URLs. Training teaches with retries; it is not an admission gate.
@@ -35,7 +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
+ - customer review, only for teams that have it (other teams get a 403): `review` (`list`, `get`, `accept`, `reject`), described in [Customer review](human-work.md#customer-review);
39
39
  - models and training: `base-model`, `model` (including `model version download`), `training`, `batch-inference` (`run`, `list`, `status`, `confirm`, `resume`, `cancel`);
40
40
  - skills and reports: `skill` (`list`, `search`, `install`), `report`.
41
41
 
@@ -166,7 +166,7 @@ toloka pipeline results <runId> --failed
166
166
  toloka pipeline cancel <runId> [--accept-without-review]
167
167
  ```
168
168
 
169
- By default, `toloka pipeline cancel` keeps the items that wait for Human QA in Human QA, and they end with the review result; after 14 days on the node, they are accepted without review. Add `--accept-without-review` only when the user asks to end these items now without review; the user pays for them as for completed items. A cancel does not refund work already done: each canceled item pays for the work recorded until it ends on its node, such as the LLM QA calls of a rejected item, and the rest of its reserved cost returns to the balance.
169
+ By default, `toloka pipeline cancel` keeps the items that wait for Human QA in Human QA, and they end with the review result; after 14 days on the node, they are accepted without review. Add `--accept-without-review` only when the user asks to end these items now without review; the user pays for them as for completed items. A cancel does not refund work already done: each canceled item pays for the work recorded until it ends on its node, such as the LLM QA calls of a rejected item, and the rest of its reserved cost returns to the balance. Canceling a run does not close its open customer reviews: they keep waiting for a decision, and one left undecided expires at its deadline, so its task is accepted and billed.
170
170
 
171
171
  `toloka pipeline runs` lists ids and timestamps. `toloka pipeline status` reports the latest run. `toloka status` (no prefix) is project health. When a listing is capped it says so; report the cap rather than presenting a page as the whole picture.
172
172
 
@@ -25,7 +25,7 @@ export const registerExpertListCommands = (program: Command, host: CommandHost):
25
25
 
26
26
  const expertList = program
27
27
  .command("expert-list")
28
- .description("manage the project's expert lists, which nodes with audienceMode service take experts from");
28
+ .description("manage the project's expert lists, which nodes can take their experts from");
29
29
 
30
30
  expertList
31
31
  .command("list")
@@ -171,6 +171,42 @@ const isHumanQa = (qualityAssurance: unknown): qualityAssurance is Record<string
171
171
  isPlainObject(qualityAssurance) &&
172
172
  (qualityAssurance.qaMode === "human_only" || qualityAssurance.qaMode === "hybrid");
173
173
 
174
+ const canonicalExpertListCondition = (condition: unknown): unknown => {
175
+ if (!isPlainObject(condition) || !Array.isArray(condition.predicates)) return condition;
176
+
177
+ const predicates = [
178
+ ...new Map(
179
+ condition.predicates
180
+ .map(canonicalExpertListCondition)
181
+ .flatMap((child) =>
182
+ isPlainObject(child) && child.logic === condition.logic && Array.isArray(child.predicates)
183
+ ? child.predicates
184
+ : [child],
185
+ )
186
+ .map((child) => [valueKey(child), child]),
187
+ ),
188
+ ]
189
+ .toSorted(([left], [right]) => left.localeCompare(right))
190
+ .map(([, child]) => child);
191
+
192
+ return predicates.length === 1 ? predicates[0] : { logic: condition.logic, predicates };
193
+ };
194
+
195
+ const withCanonicalExpertListCondition = (setting: unknown): unknown =>
196
+ isPlainObject(setting) && "expertListCondition" in setting
197
+ ? { ...setting, expertListCondition: canonicalExpertListCondition(setting.expertListCondition) }
198
+ : setting;
199
+
200
+ const withCanonicalExpertListConditions = (node: unknown): unknown =>
201
+ isPlainObject(node) && isPlainObject(node.settings)
202
+ ? {
203
+ ...node,
204
+ settings: Object.fromEntries(
205
+ Object.entries(node.settings).map(([key, value]) => [key, withCanonicalExpertListCondition(value)]),
206
+ ),
207
+ }
208
+ : node;
209
+
174
210
  const withAudienceSourcingDefaults = (node: PipelineGraphV1["nodes"][number]): unknown => {
175
211
  if (node.type !== "generation" && node.type !== "quorum") return node;
176
212
 
@@ -180,13 +216,12 @@ const withAudienceSourcingDefaults = (node: PipelineGraphV1["nodes"][number]): u
180
216
  return {
181
217
  ...node,
182
218
  settings: {
183
- audienceMode: "legacy",
184
219
  ...node.settings,
185
220
  ...(isPlainObject(audienceAndPricing) && audienceAndPricing.audienceType === "human"
186
- ? { audienceAndPricing: { expertListId: null, ...audienceAndPricing } }
221
+ ? { audienceAndPricing: { expertListCondition: null, ...audienceAndPricing } }
187
222
  : {}),
188
223
  ...(isHumanQa(qualityAssurance)
189
- ? { qualityAssurance: { expertListId: null, ...qualityAssurance } }
224
+ ? { qualityAssurance: { expertListCondition: null, ...qualityAssurance } }
190
225
  : {}),
191
226
  },
192
227
  };
@@ -271,7 +306,11 @@ export function diffPipelineGraphs(
271
306
  ...diffKeyed(
272
307
  authoredNodes,
273
308
  liveNodes,
274
- (authored, live) => matchesAuthored(authored, withAudienceSourcingDefaults(live)),
309
+ (authored, live) =>
310
+ matchesAuthored(
311
+ withCanonicalExpertListConditions(authored),
312
+ withCanonicalExpertListConditions(withAudienceSourcingDefaults(live)),
313
+ ),
275
314
  (node, action) => ({
276
315
  kind: "node",
277
316
  action,
@@ -1455,12 +1455,38 @@
1455
1455
  "type": "number",
1456
1456
  "exclusiveMinimum": 0
1457
1457
  },
1458
- "expertListId": {
1459
- "description": "Expert list the experts come from, with prefix `exl.`. Requires `audienceMode: service`. `null` detaches the list. Omitted when no list is attached.",
1458
+ "expertListCondition": {
1459
+ "description": "The expert lists the node takes its experts from: experts in any of the `list_in` lists, but not in any of the `list_nin` lists. One list is `{ operator: \"list_in\", expertListId }` with an `exl.` id; several are `{ logic: \"or\", predicates: [list_in…] }`; excluding lists wraps that in `{ logic: \"and\", predicates: [<the list_in part>, { operator: \"list_nin\", expertListId }…] }`. Other combinations (intersections, nested exclusions) are rejected. The platform stores the condition in canonical form (groups flattened, predicates deduplicated and sorted). Not available to teams on the older team ban list. `null` detaches the lists. Omitted when no lists are attached.",
1460
1460
  "anyOf": [
1461
1461
  {
1462
- "type": "string",
1463
- "pattern": "^exl\\.[0-9a-f]{8}-[0-9a-f]{4}-[7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
1462
+ "anyOf": [
1463
+ {
1464
+ "type": "object",
1465
+ "properties": {
1466
+ "operator": {
1467
+ "type": "string",
1468
+ "enum": [
1469
+ "list_in",
1470
+ "list_nin"
1471
+ ]
1472
+ },
1473
+ "expertListId": {
1474
+ "type": "string",
1475
+ "pattern": "^exl\\.[0-9a-f]{8}-[0-9a-f]{4}-[7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
1476
+ }
1477
+ },
1478
+ "required": [
1479
+ "operator",
1480
+ "expertListId"
1481
+ ],
1482
+ "additionalProperties": false,
1483
+ "ref": "ExpertListPredicate"
1484
+ },
1485
+ {
1486
+ "$ref": "#/$defs/__schema3"
1487
+ }
1488
+ ],
1489
+ "ref": "ExpertListCondition"
1464
1490
  },
1465
1491
  {
1466
1492
  "type": "null"
@@ -1490,12 +1516,38 @@
1490
1516
  "type": "number",
1491
1517
  "exclusiveMinimum": 0
1492
1518
  },
1493
- "expertListId": {
1494
- "description": "Expert list the experts come from, with prefix `exl.`. Requires `audienceMode: service`. `null` detaches the list. Omitted when no list is attached.",
1519
+ "expertListCondition": {
1520
+ "description": "The expert lists the node takes its experts from: experts in any of the `list_in` lists, but not in any of the `list_nin` lists. One list is `{ operator: \"list_in\", expertListId }` with an `exl.` id; several are `{ logic: \"or\", predicates: [list_in…] }`; excluding lists wraps that in `{ logic: \"and\", predicates: [<the list_in part>, { operator: \"list_nin\", expertListId }…] }`. Other combinations (intersections, nested exclusions) are rejected. The platform stores the condition in canonical form (groups flattened, predicates deduplicated and sorted). Not available to teams on the older team ban list. `null` detaches the lists. Omitted when no lists are attached.",
1495
1521
  "anyOf": [
1496
1522
  {
1497
- "type": "string",
1498
- "pattern": "^exl\\.[0-9a-f]{8}-[0-9a-f]{4}-[7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
1523
+ "anyOf": [
1524
+ {
1525
+ "type": "object",
1526
+ "properties": {
1527
+ "operator": {
1528
+ "type": "string",
1529
+ "enum": [
1530
+ "list_in",
1531
+ "list_nin"
1532
+ ]
1533
+ },
1534
+ "expertListId": {
1535
+ "type": "string",
1536
+ "pattern": "^exl\\.[0-9a-f]{8}-[0-9a-f]{4}-[7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
1537
+ }
1538
+ },
1539
+ "required": [
1540
+ "operator",
1541
+ "expertListId"
1542
+ ],
1543
+ "additionalProperties": false,
1544
+ "ref": "ExpertListPredicate"
1545
+ },
1546
+ {
1547
+ "$ref": "#/$defs/__schema3"
1548
+ }
1549
+ ],
1550
+ "ref": "ExpertListCondition"
1499
1551
  },
1500
1552
  {
1501
1553
  "type": "null"
@@ -1661,12 +1713,38 @@
1661
1713
  "exclusiveMinimum": 0,
1662
1714
  "maximum": 50
1663
1715
  },
1664
- "expertListId": {
1665
- "description": "Expert list the experts come from, with prefix `exl.`. Requires `audienceMode: service`. `null` detaches the list. Omitted when no list is attached.",
1716
+ "expertListCondition": {
1717
+ "description": "The expert lists the node takes its experts from: experts in any of the `list_in` lists, but not in any of the `list_nin` lists. One list is `{ operator: \"list_in\", expertListId }` with an `exl.` id; several are `{ logic: \"or\", predicates: [list_in…] }`; excluding lists wraps that in `{ logic: \"and\", predicates: [<the list_in part>, { operator: \"list_nin\", expertListId }…] }`. Other combinations (intersections, nested exclusions) are rejected. The platform stores the condition in canonical form (groups flattened, predicates deduplicated and sorted). Not available to teams on the older team ban list. `null` detaches the lists. Omitted when no lists are attached.",
1666
1718
  "anyOf": [
1667
1719
  {
1668
- "type": "string",
1669
- "pattern": "^exl\\.[0-9a-f]{8}-[0-9a-f]{4}-[7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
1720
+ "anyOf": [
1721
+ {
1722
+ "type": "object",
1723
+ "properties": {
1724
+ "operator": {
1725
+ "type": "string",
1726
+ "enum": [
1727
+ "list_in",
1728
+ "list_nin"
1729
+ ]
1730
+ },
1731
+ "expertListId": {
1732
+ "type": "string",
1733
+ "pattern": "^exl\\.[0-9a-f]{8}-[0-9a-f]{4}-[7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
1734
+ }
1735
+ },
1736
+ "required": [
1737
+ "operator",
1738
+ "expertListId"
1739
+ ],
1740
+ "additionalProperties": false,
1741
+ "ref": "ExpertListPredicate"
1742
+ },
1743
+ {
1744
+ "$ref": "#/$defs/__schema3"
1745
+ }
1746
+ ],
1747
+ "ref": "ExpertListCondition"
1670
1748
  },
1671
1749
  {
1672
1750
  "type": "null"
@@ -2333,14 +2411,6 @@
2333
2411
  }
2334
2412
  ]
2335
2413
  },
2336
- "audienceMode": {
2337
- "description": "How the node finds experts. `legacy`: audience filters and smart search. `service`: the audience service, which can also take experts from an expert list. Only teams with the audience service enabled can use `service`. Omitted when `legacy`.",
2338
- "type": "string",
2339
- "enum": [
2340
- "legacy",
2341
- "service"
2342
- ]
2343
- },
2344
2414
  "smartSearch": {
2345
2415
  "default": null,
2346
2416
  "anyOf": [
@@ -2773,12 +2843,38 @@
2773
2843
  "exclusiveMinimum": 0,
2774
2844
  "maximum": 50
2775
2845
  },
2776
- "expertListId": {
2777
- "description": "Expert list the experts come from, with prefix `exl.`. Requires `audienceMode: service`. `null` detaches the list. Omitted when no list is attached.",
2846
+ "expertListCondition": {
2847
+ "description": "The expert lists the node takes its experts from: experts in any of the `list_in` lists, but not in any of the `list_nin` lists. One list is `{ operator: \"list_in\", expertListId }` with an `exl.` id; several are `{ logic: \"or\", predicates: [list_in…] }`; excluding lists wraps that in `{ logic: \"and\", predicates: [<the list_in part>, { operator: \"list_nin\", expertListId }…] }`. Other combinations (intersections, nested exclusions) are rejected. The platform stores the condition in canonical form (groups flattened, predicates deduplicated and sorted). Not available to teams on the older team ban list. `null` detaches the lists. Omitted when no lists are attached.",
2778
2848
  "anyOf": [
2779
2849
  {
2780
- "type": "string",
2781
- "pattern": "^exl\\.[0-9a-f]{8}-[0-9a-f]{4}-[7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
2850
+ "anyOf": [
2851
+ {
2852
+ "type": "object",
2853
+ "properties": {
2854
+ "operator": {
2855
+ "type": "string",
2856
+ "enum": [
2857
+ "list_in",
2858
+ "list_nin"
2859
+ ]
2860
+ },
2861
+ "expertListId": {
2862
+ "type": "string",
2863
+ "pattern": "^exl\\.[0-9a-f]{8}-[0-9a-f]{4}-[7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
2864
+ }
2865
+ },
2866
+ "required": [
2867
+ "operator",
2868
+ "expertListId"
2869
+ ],
2870
+ "additionalProperties": false,
2871
+ "ref": "ExpertListPredicate"
2872
+ },
2873
+ {
2874
+ "$ref": "#/$defs/__schema3"
2875
+ }
2876
+ ],
2877
+ "ref": "ExpertListCondition"
2782
2878
  },
2783
2879
  {
2784
2880
  "type": "null"
@@ -4137,14 +4233,6 @@
4137
4233
  }
4138
4234
  ]
4139
4235
  },
4140
- "audienceMode": {
4141
- "description": "How the node finds experts. `legacy`: audience filters and smart search. `service`: the audience service, which can also take experts from an expert list. Only teams with the audience service enabled can use `service`. Omitted when `legacy`.",
4142
- "type": "string",
4143
- "enum": [
4144
- "legacy",
4145
- "service"
4146
- ]
4147
- },
4148
4236
  "smartSearch": {
4149
4237
  "default": null,
4150
4238
  "anyOf": [
@@ -4566,6 +4654,58 @@
4566
4654
  }
4567
4655
  }
4568
4656
  ]
4657
+ },
4658
+ "__schema3": {
4659
+ "type": "object",
4660
+ "properties": {
4661
+ "logic": {
4662
+ "type": "string",
4663
+ "enum": [
4664
+ "and",
4665
+ "or"
4666
+ ]
4667
+ },
4668
+ "predicates": {
4669
+ "minItems": 1,
4670
+ "type": "array",
4671
+ "items": {
4672
+ "anyOf": [
4673
+ {
4674
+ "type": "object",
4675
+ "properties": {
4676
+ "operator": {
4677
+ "type": "string",
4678
+ "enum": [
4679
+ "list_in",
4680
+ "list_nin"
4681
+ ]
4682
+ },
4683
+ "expertListId": {
4684
+ "type": "string",
4685
+ "pattern": "^exl\\.[0-9a-f]{8}-[0-9a-f]{4}-[7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
4686
+ }
4687
+ },
4688
+ "required": [
4689
+ "operator",
4690
+ "expertListId"
4691
+ ],
4692
+ "additionalProperties": false,
4693
+ "ref": "ExpertListPredicate"
4694
+ },
4695
+ {
4696
+ "$ref": "#/$defs/__schema3"
4697
+ }
4698
+ ],
4699
+ "ref": "ExpertListCondition"
4700
+ }
4701
+ }
4702
+ },
4703
+ "required": [
4704
+ "logic",
4705
+ "predicates"
4706
+ ],
4707
+ "additionalProperties": false,
4708
+ "ref": "ExpertListConditionGroup"
4569
4709
  }
4570
4710
  }
4571
4711
  }