@toloka-platform/sdk 0.25.1 → 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.
- package/dist/cli/toloka.js +186 -165
- package/dist/cli/toloka.js.jsc +0 -0
- package/dist/cli/toloka.js.jsc.sha256 +1 -1
- package/dist/cli/toloka.js.sha256 +1 -1
- package/examples/app-crowdtesting/nodes/app-flow-test/node.ts +24 -0
- package/examples/egocentric-video-collection/nodes/record-activity/node.ts +24 -0
- package/examples/face-image-collection/nodes/annotate-faces/node.ts +16 -1
- package/examples/product-moderation/nodes/moderate-product/instruction.ts +4 -0
- package/examples/product-moderation/nodes/moderate-product/node.ts +19 -0
- package/examples/video-pair-rating/nodes/adjudicate/node.ts +18 -1
- package/examples/video-pair-rating/nodes/adjudicate_op/node.ts +18 -1
- package/examples/video-pair-rating/nodes/overall_preference_pick/node.ts +18 -1
- package/examples/video-pair-rating/nodes/rate_pair/node.ts +18 -1
- package/openapi/gen/api.schemas.ts +50 -42
- package/package.json +3 -3
- package/skills/catalog.json +6 -6
- package/skills/toloka-build/SKILL.md +6 -10
- package/skills/toloka-build/references/human-work.md +97 -8
- package/skills/toloka-build/references/workflow-and-cli.md +12 -9
- package/src/authoring/index.ts +13 -2
- package/src/checks/task-ui-typecheck.ts +1 -1
- package/src/cli/analytics.ts +1 -0
- package/src/cli/commands/schema.ts +27 -0
- package/src/cli/commands/source.ts +11 -2
- package/src/cli/format-error.ts +6 -0
- package/src/cli/help-all.ts +32 -0
- package/src/cli/index.ts +1 -0
- package/src/cli/program.ts +29 -1
- package/src/cli/project.ts +134 -15
- package/src/cli/schema.ts +633 -0
- package/src/graph-rules.json +3 -1
- package/src/importer.ts +39 -0
- package/src/index.ts +1 -0
- package/src/pipeline-graph-v1.contract.json +12 -4
- package/src/validate.ts +23 -2
package/src/index.ts
CHANGED
|
@@ -1384,6 +1384,9 @@
|
|
|
1384
1384
|
"instruction": {
|
|
1385
1385
|
"type": "string"
|
|
1386
1386
|
},
|
|
1387
|
+
"expectedExpertBehavior": {
|
|
1388
|
+
"type": "string"
|
|
1389
|
+
},
|
|
1387
1390
|
"ui": {
|
|
1388
1391
|
"type": "object",
|
|
1389
1392
|
"properties": {
|
|
@@ -1456,7 +1459,7 @@
|
|
|
1456
1459
|
"exclusiveMinimum": 0
|
|
1457
1460
|
},
|
|
1458
1461
|
"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).
|
|
1462
|
+
"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). `null` detaches the lists. Omitted when no lists are attached.",
|
|
1460
1463
|
"anyOf": [
|
|
1461
1464
|
{
|
|
1462
1465
|
"anyOf": [
|
|
@@ -1517,7 +1520,7 @@
|
|
|
1517
1520
|
"exclusiveMinimum": 0
|
|
1518
1521
|
},
|
|
1519
1522
|
"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).
|
|
1523
|
+
"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). `null` detaches the lists. Omitted when no lists are attached.",
|
|
1521
1524
|
"anyOf": [
|
|
1522
1525
|
{
|
|
1523
1526
|
"anyOf": [
|
|
@@ -1714,7 +1717,7 @@
|
|
|
1714
1717
|
"maximum": 50
|
|
1715
1718
|
},
|
|
1716
1719
|
"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).
|
|
1720
|
+
"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). `null` detaches the lists. Omitted when no lists are attached.",
|
|
1718
1721
|
"anyOf": [
|
|
1719
1722
|
{
|
|
1720
1723
|
"anyOf": [
|
|
@@ -2530,6 +2533,7 @@
|
|
|
2530
2533
|
"entities",
|
|
2531
2534
|
"qualityCriteria",
|
|
2532
2535
|
"instruction",
|
|
2536
|
+
"expectedExpertBehavior",
|
|
2533
2537
|
"ui",
|
|
2534
2538
|
"onboarding"
|
|
2535
2539
|
],
|
|
@@ -2844,7 +2848,7 @@
|
|
|
2844
2848
|
"maximum": 50
|
|
2845
2849
|
},
|
|
2846
2850
|
"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).
|
|
2851
|
+
"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). `null` detaches the lists. Omitted when no lists are attached.",
|
|
2848
2852
|
"anyOf": [
|
|
2849
2853
|
{
|
|
2850
2854
|
"anyOf": [
|
|
@@ -3559,6 +3563,9 @@
|
|
|
3559
3563
|
"instruction": {
|
|
3560
3564
|
"type": "string"
|
|
3561
3565
|
},
|
|
3566
|
+
"expectedExpertBehavior": {
|
|
3567
|
+
"type": "string"
|
|
3568
|
+
},
|
|
3562
3569
|
"ui": {
|
|
3563
3570
|
"type": "object",
|
|
3564
3571
|
"properties": {
|
|
@@ -4351,6 +4358,7 @@
|
|
|
4351
4358
|
"entities",
|
|
4352
4359
|
"qualityCriteria",
|
|
4353
4360
|
"instruction",
|
|
4361
|
+
"expectedExpertBehavior",
|
|
4354
4362
|
"ui",
|
|
4355
4363
|
"overlap",
|
|
4356
4364
|
"onboarding"
|
package/src/validate.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import Ajv2020, { type ErrorObject } from 'ajv/dist/2020.js';
|
|
2
1
|
import addFormats from 'ajv-formats';
|
|
2
|
+
import Ajv2020, { type ErrorObject } from 'ajv/dist/2020.js';
|
|
3
3
|
import { assert } from 'es-toolkit';
|
|
4
|
+
|
|
4
5
|
import type { PipelineGraphV1 } from '../openapi/gen/api.schemas';
|
|
5
6
|
import coreEntityTypes from './core-entity-types.json' with { type: 'json' };
|
|
6
7
|
import { PipelineGraphValidationError, type PipelineGraphValidationIssue } from './errors';
|
|
@@ -188,7 +189,26 @@ const humanAudienceIssues = (settings: HumanWorkSettings, prefix: string): Pipel
|
|
|
188
189
|
});
|
|
189
190
|
}
|
|
190
191
|
if (audienceAndPricing.pricePerTask <= 0) {
|
|
191
|
-
issues.push({
|
|
192
|
+
issues.push({
|
|
193
|
+
path: `${prefix}/audienceAndPricing/pricePerTask`,
|
|
194
|
+
reason: 'The price per task must be greater than 0',
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
return issues;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const expectedExpertBehaviorIssues = (settings: HumanWorkSettings, prefix: string): PipelineGraphValidationIssue[] => {
|
|
201
|
+
if (isSynthetic(settings)) return [];
|
|
202
|
+
const { expectedExpertBehavior } = settings;
|
|
203
|
+
const path = `${prefix}/expectedExpertBehavior`;
|
|
204
|
+
const issues: PipelineGraphValidationIssue[] = [];
|
|
205
|
+
if (expectedExpertBehavior.trim() === '') {
|
|
206
|
+
issues.push({ path, reason: graphRules.expectedExpertBehaviorRequiredMessage });
|
|
207
|
+
} else if (expectedExpertBehavior.length > graphRules.expectedExpertBehaviorMaxCharacters) {
|
|
208
|
+
issues.push({
|
|
209
|
+
path,
|
|
210
|
+
reason: `The expected expert behavior must be ${graphRules.expectedExpertBehaviorMaxCharacters} characters or fewer`,
|
|
211
|
+
});
|
|
192
212
|
}
|
|
193
213
|
return issues;
|
|
194
214
|
};
|
|
@@ -352,6 +372,7 @@ const humanWorkIssues = ({ settings }: HumanWorkNode, prefix: string): PipelineG
|
|
|
352
372
|
...qualityElementIssues(settings.qualityCriteria, prefix),
|
|
353
373
|
...humanQaIssues(settings, prefix),
|
|
354
374
|
...humanAudienceIssues(settings, prefix),
|
|
375
|
+
...expectedExpertBehaviorIssues(settings, prefix),
|
|
355
376
|
...examIssues(settings, prefix),
|
|
356
377
|
...trainingIssues(settings, prefix),
|
|
357
378
|
];
|