@toloka-platform/sdk 0.25.2 → 0.26.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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Read this before writing or changing a `generation` or `quorum` node. Before writing its `ui`, also read [Task UI](task-ui.md); for its stored test cases, read [node checks](node-checks.md).
4
4
 
5
- Distinguish server requirements from optional design choices; not every constraint below is checked when the source loads. Optional settings such as an Exam, non-default QA, audience reuse, and smart search should serve the task: add them when the requirements call for them, and omit blocks that add no value rather than copying placeholders, because an empty disabled block is still authored state. Preserve imported choices unless changing them is part of the task, and explain additions that affect cost or expert eligibility.
5
+ Distinguish server requirements from optional design choices; not every constraint below is checked when the source loads. Optional settings such as an Exam and non-default QA should serve the task: add them when the requirements call for them, and omit blocks that add no value rather than copying placeholders, because an empty disabled block is still authored state. Preserve imported choices unless changing them is part of the task, and explain additions that affect cost or expert eligibility.
6
6
 
7
7
  ## `generation`
8
8
 
@@ -19,12 +19,15 @@ Use `about.projectType: 'data_collection'` only when experts upload or record me
19
19
  - `entities.input` and `.output`: map declared fields into the labeler data model.
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
+ - `expectedExpertBehavior`: required text on a human node that describes how experts complete the task (see [Expected expert behavior](#expected-expert-behavior)).
22
23
  - `ui`: `{ code, data, preprocess, postprocess?, constants }` for the task interface.
23
24
  - `qualityAssurance`: `llm_only`, `hybrid`, or `human_only`, and for some teams `customer_review` (see [Customer review](#customer-review)).
24
25
  - `audienceAndPricing`: either a human audience or synthetic generation.
25
26
  - `onboarding`: built-in Training stage.
26
27
  - `exam`: optional built-in qualification gate.
27
- - `reuseAudienceWithNodeId`, `smartSearch`, and `checks`: source-representable advanced settings; `checks` holds stored test cases (see [node checks](node-checks.md)).
28
+ - `checks`: stored test cases (see [node checks](node-checks.md)). `reuseAudienceWithNodeId` and `smartSearch` are still accepted but deploy ignores them.
29
+
30
+ This file says when and why to use each setting. For its exact shape (fields, optionality, allowed values, defaults and bounds), run `toloka schema generation` or `toloka schema quorum`, or the type name such as `Onboarding` or `GenerationExam`, before writing a setting the example you borrow from does not show.
28
31
 
29
32
  #### Entities
30
33
 
@@ -49,12 +52,100 @@ Write at least one criterion for every output entity. Each criterion needs an au
49
52
 
50
53
  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
54
 
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.
55
+ 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. 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. QA mode applies to the whole node, not individual criteria. The redo cap is platform-controlled and is not an SDK setting.
53
56
 
54
57
  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
58
 
56
59
  Keep `instruction` actionable and in English. Include the workflow, concepts, quality rules, and at least one pass and fail example grounded in the task. Do not mention project schedules, dataset volume, workforce requirements, or compensation in labeler instructions.
57
60
 
61
+ #### Expected expert behavior
62
+
63
+ `expectedExpertBehavior` is required on every human node, not on a synthetic one, and holds up to 10,000 characters. It says how an expert completes the task; answers that break it are rejected. Experts do not see it, so the `instruction` repeats its rules. `toloka check` and `toloka apply` fail without it.
64
+
65
+ ##### Ask the user about AI use
66
+
67
+ This is the only question you ask about this setting. Ask it before you write the `instruction` (in Plan mode, before the plan), in the same `ask_user` form as your other questions (up to three):
68
+
69
+ > Can experts use AI tools like ChatGPT, Claude, Gemini, or AI browser agents for this task, for example to look up facts, fix grammar, translate, or draft an answer?
70
+
71
+ - **Not allowed (recommended)**: experts write every answer themselves, without AI in any form, not even for grammar. The default.
72
+ - **For research only**: to look up facts or explain terms; the expert writes the answer.
73
+ - **For research and polishing**: also to fix grammar, rephrase, or translate the expert's own draft.
74
+ - **Any use**: AI may draft the answer; the expert reviews it and is responsible for it.
75
+
76
+ - The brief or the guideline already states the rule: restate it and offer Yes / Change the rules. The chat answer wins over the guideline; update both.
77
+ - The user skips: use Not allowed, do not ask again, and say in your final message that AI is not allowed by default and can be changed in Expected Expert Behavior in the node settings.
78
+ - Any use: say once that experts must review the AI output and that unchanged AI output is rejected. On a `generation` node, offer Switch to synthetic generation / Keep human experts in your next form.
79
+ - An answer produced entirely by AI or an AI agent is never accepted, whatever the user picks.
80
+ - The user asks why: so experts know which tools they may use. Never say how violations are found.
81
+ - The task looks impossible without AI, such as translating from a language the audience may not know: ask about the audience's language instead of weakening the rule.
82
+
83
+ ##### Settle the rest yourself
84
+
85
+ Decide from the brief, the guideline, the inputs, the outputs, and the UI: which outside sources are allowed, whether media must be opened in full, what may be pasted into each text field, and which other tools (machine translation, speech-to-text, running code, autocomplete) are allowed.
86
+
87
+ | Task type | Usual answer |
88
+ |---|---|
89
+ | Writing or rewriting text | written by the expert, no paste |
90
+ | Fact-checking or web-grounded answers | web search is part of the task; the source URL is pasted |
91
+ | Rating or comparison | media watched or heard in full |
92
+ | Transcription or audio/video annotation | media heard in full |
93
+ | Translation or localization | no machine translation |
94
+ | Code | documentation and running code are fine |
95
+ | Media collection | only the expert's own recording; nothing downloaded, generated, or edited |
96
+ | Classification | nothing outside the task |
97
+
98
+ Ask the user only when the material is silent and the answer changes the description, for example whether machine translation may start a translation. Put it in the same form as the AI question.
99
+
100
+ ##### Write it
101
+
102
+ Plain English, one section label per line, in this order. Use dashes or numbers for lists, no Markdown headings.
103
+
104
+ - `Task:` what the expert does, in one or two sentences.
105
+ - `Process:` the steps in order: what the expert opens, reads, watches or listens to, and fills in.
106
+ - `Outside the task page:` which pages, sites, or apps the expert must or may open. If none: "the task does not require leaving the task page."
107
+ - `Media:` only when there is video, audio, linked images, or an external page: what to open, in full or only the relevant part.
108
+ - `Answer fields:` for each output field: what it asks for, the kind of content (a choice, a value, a URL, an ID, a quote, or the expert's own text), its format, and what exactly may be pasted.
109
+ - `AI tools:` the AI rule.
110
+ - `Built-in tools:` only when the UI has checkers, suggestions, or hints: what they are for.
111
+ - `Expected behavior:` a normal completion as actions: when the expert leaves the page and why, what is pasted where, what is typed, what media is played. Mention time only when the material implies it, such as a video that must be watched in full.
112
+ - `Not allowed:` what breaks the rules. Always "letting an AI agent fill in the task", and, unless the rule is Any use, an answer written entirely by AI.
113
+
114
+ The AI rule:
115
+
116
+ - Write an allowed use as an action and a step ("may ask an AI tool to find sources"), never as a level ("limited AI use").
117
+ - Name the fields the expert writes personally and what AI text may appear in them: none, corrections of the expert's own draft, or a whole draft.
118
+ - Write a ban as "in any form, including research, translation, editing, and grammar checks".
119
+ - Quote the client's rule when there is one.
120
+ - Nothing is known: "AI tools: experts may not use AI tools in any form for this task, including chatbots, AI assistants, AI browser agents, and AI translation or editing tools."
121
+
122
+ | AI rule | Expected behavior | Not allowed |
123
+ |---|---|---|
124
+ | Not allowed | answers typed in the fields | AI in any form |
125
+ | Research only | leaving the page for search or an AI tool; answers typed in the fields | any AI text in the fields |
126
+ | Research and polishing | the expert's own draft, corrected by AI, pasted back into the same field | pasting an answer AI wrote from scratch |
127
+ | Any use | an AI draft pasted, then edited | AI output pasted without changes |
128
+
129
+ For sources, media, and pasting, `Not allowed` is the reverse of what you allowed: other sites, answering without watching, pasting anything you did not name. Name what may be pasted into which field, never "paste is allowed". Do not invent rules the material does not state or copy long parts of the guideline.
130
+
131
+ ##### Give experts the same rules
132
+
133
+ Add or update a "Rules for this task" section in the `instruction`, in words for experts: what to do ("Watch the whole video before you rate it."), which tools are allowed and for what, in the same terms as `AI tools:`, what to paste where ("Paste the URL of your source into Source."), and the consequence ("Answers that break these rules are rejected; repeated violations lead to removal from the project.").
134
+
135
+ Never tell experts how violations are found, such as tracking, AI detection, or thresholds: write "complete the task on this page", not "do not switch tabs". Keep `Expected behavior:` out of the guideline.
136
+
137
+ ##### Fix what the lint finds
138
+
139
+ After every apply the platform lints this text. `toloka validate --wait` shows each finding as a warning on the node, prefixed with its flag, and with "Expert Guideline:" when it is about the guideline. Warnings do not block the deploy; a failed or unfinished lint does. Fix every finding in the source and apply again:
140
+
141
+ - `section_missing`: add the section (`Media:` when the task has media).
142
+ - `not_in_ui`: remove or correct what the task does not have.
143
+ - `field_not_described`: describe the field in `Answer fields:`.
144
+ - `guideline_conflict`: make the guideline state the same rules as the description.
145
+ - `ai_use_ambiguous`: write the AI rule as an action and name the fields the expert writes.
146
+ - `paste_unspecified`: name what is pasted into which field.
147
+ - `reveals_detection`: remove from the guideline how violations are found.
148
+
58
149
  #### Audience and pricing
59
150
 
60
151
  For humans, set `audienceType: 'human'`, `verifiedExperts`, all three audience filters, `pricePerTask`, and `timeForTask`. Set `verifiedExperts: true` unless the task explicitly asks for the broad unverified crowd. The public shapes differ by filter: languages use `{ type: 'and' | 'or', values: [{ value: 'English' }] }`; specializations use `{ type: 'and' | 'or', values: [{ value, qualificationId }] }`; countries use ISO 3166-1 alpha-2 codes, for example `{ type: 'or', values: ['US'] }`. Apply rejects a country code, language, or specialization that is not in the audience catalog, and an audience that matches no experts. Derive languages and expertise from the task and its inputs, leaving specialization and country filters unrestricted unless needed. English is a reasonable starting language for an English-language task, not a universal audience default. Ask when an unresolved audience requirement changes who can do the work. Do not put specializations on an unverified audience. A specialization's `qualificationId` is platform identity: preserve an imported value, and discover new ones with `toloka audience specialization list`, copying `ID` into `qualificationId` and `NAME` into `value`; never invent one.
@@ -67,7 +158,7 @@ Use `audienceType: 'synthetic'` only when the user explicitly asks for model-gen
67
158
 
68
159
  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
160
 
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.
161
+ - 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. `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
162
  - 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
163
  - 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
164
  - 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.
@@ -127,7 +218,7 @@ Treat `exam` as the optional one-attempt pass/fail gate after Training and befor
127
218
 
128
219
  The `ui` strings are authored directly. Build one expert's task view, ensure component value shapes match entity schemas, read inputs as [Task UI](task-ui.md) describes, and use `postprocess` when a component's native value needs reshaping. Hardware-backed upload and recording controls require real UI verification.
129
220
 
130
- Use `reuseAudienceWithNodeId` only with real imported `{ pipelineId, nodeId }` values from a compatible deployed task in another pipeline; never invent IDs. `smartSearch` can hold the public sourcing profile, but `sourceFingerprint` is server-derived. Preserve an imported fingerprint; do not invent one for new source.
221
+ Deploy ignores `reuseAudienceWithNodeId` and `smartSearch`: every deploy sources experts through the node's own audience. Don't add them to new source; an imported value can stay.
131
222
 
132
223
  ### Traps
133
224
 
@@ -147,7 +238,7 @@ Use `reuseAudienceWithNodeId` only with real imported `{ pipelineId, nodeId }` v
147
238
 
148
239
  `quorum(name, settings)` accepts `QuorumAuthoringSettings`, derived from `QuorumNodeSettings`:
149
240
 
150
- - `about`, `publicName`, `entities`, `qualityCriteria`, `instruction`, `ui`, `audienceAndPricing`, `onboarding`, `exam`, `reuseAudienceWithNodeId`, `smartSearch`, and `checks` follow the human-node rules above.
241
+ - `about`, `publicName`, `entities`, `qualityCriteria`, `instruction`, `expectedExpertBehavior`, `ui`, `audienceAndPricing`, `onboarding`, `exam`, `reuseAudienceWithNodeId`, `smartSearch`, and `checks` follow the human-node rules above. A quorum task can be as complex as a generation task, so settle its expected expert behavior the same way.
151
242
  - `overlap` is the fixed number of independent labelers per item: 1–100, though below 2 validation warns that one annotation per item calls for a `generation` node instead. Default to 3 when the user does not specify it; 3 gives a majority, 5 gives stronger consensus, and cost grows linearly.
152
243
  - `qualityAssurance` is either `llm_only` or `none`.
153
244
  - `offboardingRules` supports majority-vote agreement rules in No-QA mode.
@@ -203,8 +294,6 @@ The authoring helper does not translate `offboardingRules.agreementScale` from `
203
294
  When a requirement depends on one of these capabilities, state the gap instead of inventing source syntax:
204
295
 
205
296
  - Audience discovery beyond specializations has no SDK or CLI path: valid-language/country suggestions, audience-size statistics for a composed filter, and recommended-rate calculation. `toloka validate` does report an audience that matches no experts, and states the allowed range when `pricePerTask` falls outside it. Specializations and their expert counts come from `toloka audience specialization list`.
206
- - Audience-reuse candidate discovery has no SDK or CLI path. Source can store a known cross-pipeline pointer, but cannot search candidates.
207
- - Smart Search rendering, source-fingerprint computation, and stale-profile diagnosis have no SDK or CLI path. Source can carry the public profile; it cannot generate the server-owned fingerprint or preview rendered sourcing documents.
208
297
  - Training's examples playbooks and automatic course authoring have no SDK/CLI path. Source can set `onboarding`, but cannot request geometry/numeric check templates or run hands-on examples against the task UI locally; `toloka check` validates only their structure.
209
298
  - Exam golden-dataset discovery, creation by symbolic dataset name, dataset lint execution, and generated-golden confirmation flow have no high-level SDK authoring path. `exam.goldenDatasetId` requires a real ID.
210
299
  - Generation's platform-controlled redo cap, appeal behavior, payment retry, and exact terminal handling are intentionally not configurable SDK settings.
@@ -33,7 +33,7 @@ Run `toloka help --all` once for the usage and every option of all commands of t
33
33
  - sign-in and settings: `login`, `logout`, `auth-status` (`whoami`), `config`, `version`;
34
34
  - projects and tokens: `project` (`list`, `add`, `switch`, `current`, `url`, `remove`, `create`, `untrack`, `token`, `tokens`, `revoke-token`, `revoke-tokens`), `delivery-order list`;
35
35
  - source reconciliation: `init`, `import`, `check`, `validate`, `plan`, `apply`, `status`, `secret set`;
36
- - catalogs: `audience specialization list`, `generation-model list`, `ui components`;
36
+ - catalogs: `audience specialization list`, `generation-model list`, `ui components`, `schema` (the SDK authoring and testing functions and types of the installed version);
37
37
  - data and runs: `dataset` (`list`, `create`, `fields`, `fields add`, `columns`, `load`, `upload`, `split`, `slice`), `pipeline` (`list`, `run`, `status`, `runs`, `cost`, `results`, `cancel`, `lint`);
38
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`);
@@ -74,7 +74,7 @@ toloka apply && toloka validate --wait # runs the unfiltered toloka check
74
74
  toloka pipeline lint <name> --wait # after dataset changes or a failed lint: reruns the lints
75
75
  ```
76
76
 
77
- Run the unfiltered `toloka check` on its own only when you are not about to apply, since apply would run it again. `toloka check` requires no credentials or live pipeline; SKILL.md describes what it runs and what its statuses mean. Use `toloka check <pipeline> --node <name-or-id>` for a focused edit loop, `--watch` for serialized reruns, and `--json` for automation.
77
+ Run the unfiltered `toloka check` on its own only when you are not about to apply, since apply would run it again. `toloka check` requires no credentials or live pipeline; SKILL.md describes what it runs and what its statuses mean. Use `toloka check <pipeline> --node <name-or-id>` for a focused edit loop, `--watch` for serialized reruns, and `--json` for automation. When it reports an unknown property or a type mismatch on an SDK type, run `toloka schema <that type>` before the next edit instead of trying another shape.
78
78
 
79
79
  With `--watch --json`, each completed rerun writes one JSON line. Do not start another watcher while one is active.
80
80
 
@@ -148,7 +148,14 @@ export type CodeAuthoringSettings = Pick<
148
148
 
149
149
  export type GenerationAuthoringSettings = Omit<
150
150
  GenerationNodeSettings,
151
- "about" | "entities" | "qualityCriteria" | "instruction" | "ui" | "onboarding" | "exam"
151
+ | "about"
152
+ | "entities"
153
+ | "qualityCriteria"
154
+ | "instruction"
155
+ | "expectedExpertBehavior"
156
+ | "ui"
157
+ | "onboarding"
158
+ | "exam"
152
159
  > & {
153
160
  readonly about?: Omit<GenerationNodeSettings["about"], "name"> & { readonly name?: string };
154
161
  readonly entities: {
@@ -157,6 +164,7 @@ export type GenerationAuthoringSettings = Omit<
157
164
  };
158
165
  readonly qualityCriteria?: ReadonlyArray<GenerationQualityCriterion>;
159
166
  readonly instruction?: string;
167
+ readonly expectedExpertBehavior?: string;
160
168
  readonly ui?: GenerationNodeSettings["ui"];
161
169
  readonly onboarding?: GenerationNodeSettings["onboarding"];
162
170
  readonly exam?: GenerationExam;
@@ -173,13 +181,14 @@ export type MatchAuthoringSettings = Pick<MatchNodeSettings, "about"> & {
173
181
 
174
182
  export type QuorumAuthoringSettings = Omit<
175
183
  QuorumNodeSettings,
176
- "entities" | "qualityCriteria" | "exam"
184
+ "entities" | "qualityCriteria" | "expectedExpertBehavior" | "exam"
177
185
  > & {
178
186
  readonly entities: {
179
187
  readonly input: ReadonlyArray<QuorumInputEntity>;
180
188
  readonly output: ReadonlyArray<QuorumOutputEntity>;
181
189
  };
182
190
  readonly qualityCriteria: ReadonlyArray<QuorumQualityCriterion>;
191
+ readonly expectedExpertBehavior?: string;
183
192
  readonly exam?: QuorumExam;
184
193
  };
185
194
 
@@ -392,6 +401,7 @@ function compileGenerationSettings(
392
401
  targetEntity: criterion.targetEntity.id,
393
402
  })),
394
403
  instruction: settings.instruction ?? "",
404
+ expectedExpertBehavior: settings.expectedExpertBehavior ?? "",
395
405
  ui: settings.ui ?? {
396
406
  code: "<></>",
397
407
  data: "{}",
@@ -594,6 +604,7 @@ export function quorum(
594
604
  ...criterion,
595
605
  targetEntity: criterion.targetEntity.id,
596
606
  })),
607
+ expectedExpertBehavior: settings.expectedExpertBehavior ?? "",
597
608
  ...(exam === undefined
598
609
  ? {}
599
610
  : {
@@ -10,7 +10,7 @@ import {
10
10
  createVirtualTypeScriptEnvironment,
11
11
  } from "./typescript-vfs.js";
12
12
 
13
- const tsLibDirectory =
13
+ export const tsLibDirectory =
14
14
  Reflect.get(globalThis, "Bun")?.isStandaloneExecutable === true
15
15
  ? path.join(path.dirname(process.argv[1]!), "typescript-lib")
16
16
  : path.dirname(ts.getDefaultLibFilePath({ target: ts.ScriptTarget.Latest }));
@@ -145,6 +145,7 @@ const ROOT_COMMANDS: Readonly<Record<string, true>> = {
145
145
  status: true,
146
146
  validate: true,
147
147
  report: true,
148
+ schema: true,
148
149
  version: true,
149
150
  whoami: true,
150
151
  };
@@ -0,0 +1,27 @@
1
+ import type { Command } from "commander";
2
+ import { resolveSourceRoot, type CommandHost } from "../context";
3
+ import { schemaCommand } from "../schema";
4
+
5
+ export const registerSchemaCommand = (program: Command, host: CommandHost): void => {
6
+ const { context, globals } = host;
7
+ program
8
+ .command("schema")
9
+ .argument(
10
+ "[names...]",
11
+ "functions or types such as quorum, QuorumExam or TaskUiSession; omit to list every name",
12
+ )
13
+ .description(
14
+ "list the SDK authoring and testing functions and types, or print the full shape of the named ones from the installed SDK",
15
+ )
16
+ .addHelpText(
17
+ "after",
18
+ "\nRead from the types of the @toloka-platform/sdk installed in the project: fields, optionality, allowed values, defaults and bounds.",
19
+ )
20
+ .action(async (names: string[]) => {
21
+ schemaCommand({
22
+ sourceRoot: await resolveSourceRoot(globals(), context.io),
23
+ names,
24
+ io: context.io,
25
+ });
26
+ });
27
+ };
@@ -20,6 +20,7 @@ import { registerReportCommand } from "./commands/report";
20
20
  import { registerExpertBanListCommands } from "./commands/expert-ban-list";
21
21
  import { registerExpertListCommands } from "./commands/expert-list";
22
22
  import { registerReviewCommands } from "./commands/review";
23
+ import { registerSchemaCommand } from "./commands/schema";
23
24
  import { registerSecretCommands } from "./commands/secret";
24
25
  import { registerSkillCommands } from "./commands/skill";
25
26
  import { registerSourceCommands } from "./commands/source";
@@ -119,6 +120,7 @@ export function createProgram(context: ProgramContext): CreatedProgram {
119
120
  registerReportCommand(program, host);
120
121
  registerSkillCommands(program, host);
121
122
  registerUiCommands(program, host);
123
+ registerSchemaCommand(program, host);
122
124
 
123
125
  program
124
126
  .command("help")