@toloka-platform/sdk 0.2.0-preview.2 → 0.2.0-preview.3

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.
Files changed (79) hide show
  1. package/README.md +10 -4
  2. package/dist/cli/toloka.js +159 -151
  3. package/dist/cli/toloka.js.jsc +0 -0
  4. package/dist/cli/toloka.js.jsc.sha256 +1 -1
  5. package/dist/cli/toloka.js.sha256 +1 -1
  6. package/docs/authoring.md +18 -1
  7. package/docs/cli-v2.md +4 -3
  8. package/docs/cli.md +29 -10
  9. package/docs/getting-started.md +3 -3
  10. package/docs/limitations.md +1 -1
  11. package/docs/testing.md +1 -1
  12. package/docs/troubleshooting.md +1 -1
  13. package/examples/face-image-collection/README.md +2 -2
  14. package/openapi/gen/api.ts +78 -0
  15. package/openapi/gen/models/checkReport.ts +2 -1
  16. package/openapi/gen/models/checkReportAnyOfTwoseven.ts +5 -0
  17. package/openapi/gen/models/checkReportAnyOfTwosevenResultsItem.ts +6 -0
  18. package/openapi/gen/models/checkReportAnyOfTwosevenResultsItemVerdict.ts +2 -0
  19. package/openapi/gen/models/currentUser.ts +1 -0
  20. package/openapi/gen/models/deliveryOrder.ts +9 -0
  21. package/openapi/gen/models/deliveryOrderClientName.ts +2 -0
  22. package/openapi/gen/models/getTrainingRunMetricHistoryParams.ts +4 -0
  23. package/openapi/gen/models/index.ts +19 -0
  24. package/openapi/gen/models/listDeliveryOrders200.ts +5 -0
  25. package/openapi/gen/models/trainingRunMetricHistory.ts +9 -0
  26. package/openapi/gen/models/trainingRunMetricHistoryMetric.ts +2 -0
  27. package/openapi/gen/models/trainingRunMetricHistoryPointsItem.ts +9 -0
  28. package/openapi/gen/models/trainingRunMetricHistoryPointsItemNonFinite.ts +2 -0
  29. package/openapi/gen/models/trainingRunMetricHistoryPointsItemValue.ts +2 -0
  30. package/openapi/gen/models/trainingRunMetrics.ts +9 -0
  31. package/openapi/gen/models/trainingRunMetricsMetricsItem.ts +8 -0
  32. package/openapi/gen/models/trainingRunMetricsMetricsItemLatest.ts +9 -0
  33. package/openapi/gen/models/trainingRunMetricsMetricsItemLatestNonFinite.ts +2 -0
  34. package/openapi/gen/models/trainingRunMetricsMetricsItemLatestValue.ts +2 -0
  35. package/openapi/gen/models/trainingRunMetricsMetricsItemMetric.ts +2 -0
  36. package/openapi/gen/models/trainingRunMetricsUnavailableReason.ts +2 -0
  37. package/package.json +2 -2
  38. package/skills/catalog.json +55 -7
  39. package/skills/toloka-build/SKILL.md +10 -7
  40. package/skills/toloka-build/references/node-semantics.md +6 -4
  41. package/skills/toloka-build/references/workflow-and-cli.md +21 -13
  42. package/skills/toloka-fine-tuning/SKILL.md +72 -0
  43. package/skills/toloka-get-started/SKILL.md +55 -0
  44. package/skills/toloka-gisting/SKILL.md +76 -0
  45. package/skills/toloka-report-issue/references/report-template.md +1 -1
  46. package/src/authoring/index.ts +14 -0
  47. package/src/checks/task-ui-typecheck.ts +12 -10
  48. package/src/cli/analytics.ts +52 -6
  49. package/src/cli/auth.ts +69 -16
  50. package/src/cli/auto-update.ts +24 -33
  51. package/src/cli/check.ts +12 -10
  52. package/src/cli/commands/auth.ts +89 -0
  53. package/src/cli/commands/config.ts +28 -0
  54. package/src/cli/commands/dataset.ts +75 -0
  55. package/src/cli/commands/delivery-order.ts +18 -0
  56. package/src/cli/commands/models.ts +122 -0
  57. package/src/cli/commands/pipeline.ts +132 -0
  58. package/src/cli/commands/project.ts +175 -0
  59. package/src/cli/commands/report.ts +39 -0
  60. package/src/cli/commands/secret.ts +39 -0
  61. package/src/cli/commands/skill.ts +36 -0
  62. package/src/cli/commands/source.ts +204 -0
  63. package/src/cli/commands/status.ts +18 -0
  64. package/src/cli/commands/training.ts +228 -0
  65. package/src/cli/commands/version.ts +14 -0
  66. package/src/cli/config.ts +5 -6
  67. package/src/cli/context.ts +213 -0
  68. package/src/cli/delivery-orders.ts +30 -0
  69. package/src/cli/environment.ts +26 -0
  70. package/src/cli/init.ts +1 -4
  71. package/src/cli/program.ts +168 -1344
  72. package/src/cli/project-context.ts +9 -11
  73. package/src/cli/sdk-version.ts +38 -0
  74. package/src/cli/skill.ts +6 -2
  75. package/src/cli/terminal-io.ts +103 -0
  76. package/src/cli/trainings.ts +118 -27
  77. package/src/cli/version.ts +1 -1
  78. package/src/client.ts +18 -0
  79. package/src/importer.ts +32 -2
Binary file
@@ -1 +1 @@
1
- 4bc560d638ddf49386ccbb12f7eeaaa0922fd26ab13c69065cbb8540c27cbe50 toloka.js.jsc
1
+ 9ad43de333dbe074807e30a8c4dcac3218b8da3d35dcb5b9f73de5a828e0e1a5 toloka.js.jsc
@@ -1 +1 @@
1
- e7e688bae427a1230ea0cbcacf81224527dc592f0e9087d584462d5ab3ec2059 toloka.js
1
+ d94c96d189b79c2a18acad2d61fe57da2c580dc0219094434e1e44e822bcd7f0 toloka.js
package/docs/authoring.md CHANGED
@@ -86,6 +86,21 @@ Register authored code behavior with `test.code(pipeline, node, name, callback)`
86
86
 
87
87
  One human-work task type. The node owns the entire expert journey: instruction, UI, entity schemas, quality criteria, quality assurance, audience, pricing, Training, and Exam.
88
88
 
89
+ Choose entity cardinality from the task, not from the component's JavaScript value shape. If one labeler produces one logical result, keep the entity static: omit `dynamic` and `maxEntities`, and use a path without `[*]`.
90
+
91
+ ```ts
92
+ {
93
+ field: caption,
94
+ entityType: "SHORT_ANSWER",
95
+ jsonPath: "$.caption",
96
+ description: "The one caption written for this image.",
97
+ }
98
+ ```
99
+
100
+ Use `dynamic: true` only when one labeler produces multiple independent entities. Set `maxEntities` to a task-grounded upper bound rather than a generic default. A component may expose an array while still producing one logical entity; for a single upload or recording, keep a scalar field and static entity and select the completed first value with a path such as `$.video_file[0].downloadLink`.
101
+
102
+ The following task is legitimately dynamic because the labeler can draw one independent box for every visible face:
103
+
89
104
  ```ts
90
105
  import { generation } from "@toloka-platform/sdk";
91
106
 
@@ -209,7 +224,7 @@ export const routeDisputed = match("route_disputed", {
209
224
  about: { name: "route_disputed" },
210
225
  conditions: [
211
226
  {
212
- name: "is disputed",
227
+ name: "is_disputed",
213
228
  predicates: [{ field: verdict, jsonPath: "$", operator: "text_eq", value: "disputed" }],
214
229
  },
215
230
  ],
@@ -217,6 +232,8 @@ export const routeDisputed = match("route_disputed", {
217
232
  });
218
233
  ```
219
234
 
235
+ Each condition name must be unique within the Match node and contain 2–32 characters. Start with a lowercase letter, use only lowercase letters, digits, and underscores, and end with a letter or digit. `match()` rejects invalid or duplicate names locally before any platform request.
236
+
220
237
  ## Connect ports
221
238
 
222
239
  `connect(from, to)` is the only way to create an edge. Ports are typed, so a wrong direction is a compile error.
package/docs/cli-v2.md CHANGED
@@ -9,7 +9,7 @@ The platform object is a **project** (`pp.…`, today's pipeline project). Windm
9
9
  Today the checkout is a pipeline tree that happens to mention a project.
10
10
 
11
11
  - A directory is a project root if it has `toloka.json` **or** a `pipelines/` folder. No pipelines, no root.
12
- - `init` writes agent skills before a project exists. It writes `toloka.json` only from an explicit `--project-id`, `TOLOKA_PROJECT_ID` / `POTATO_PROJECT_ID`, or an existing checkout; it never binds a new checkout from the machine registry.
12
+ - `init` writes agent skills before a project exists. It writes `toloka.json` only from an explicit `--project-id`, `TOLOKA_PROJECT_ID`, or an existing checkout; it never binds a new checkout from the machine registry.
13
13
  - A checkout attaches when `project create` or `import` writes `toloka.json`, or when `init` receives explicit project identity.
14
14
  - `run`, `status`, `runs`, and `cost` pick a pipeline from `toloka.json`. Zero pipelines is an error. Several pipelines opens a picker. The command names pretend there is "the" pipeline.
15
15
  - `status` means "latest run of some pipeline", not "this project".
@@ -61,7 +61,7 @@ A checkout can later grow other folders (`datasets/`, `files/`, whatever we auth
61
61
  Highest wins:
62
62
 
63
63
  1. `--project-id`
64
- 2. `TOLOKA_PROJECT_ID` (keep accepting `POTATO_PROJECT_ID` until we rename the rest of the env surface)
64
+ 2. `TOLOKA_PROJECT_ID` (the legacy `POTATO_*` names are still read for one preview cycle with a deprecation warning)
65
65
  3. `toloka.json` in the discovered checkout (walk up from cwd, or `--source-root`)
66
66
  4. `current` in the machine registry
67
67
  5. Fail: `No project selected. Run toloka project create for a new project, toloka project add for an existing project, or cd into a checkout.`
@@ -86,10 +86,11 @@ toloka project remove cat-labeling # local unbind only
86
86
 
87
87
  `project add` with no arguments prompts for alias and id, like `wmill workspace add`. The new alias becomes `current`.
88
88
 
89
- Create a live project and bind it in one step:
89
+ Create a live project and bind it in one step. External teams omit `--delivery-order-id`. Internal users (`whoami` prints `Internal: true`) must pass an active id from `toloka delivery-order list`:
90
90
 
91
91
  ```sh
92
92
  toloka project create cat-labeling --team-id <teamId>
93
+ toloka project create cat-labeling --team-id <teamId> --delivery-order-id <orderId>
93
94
  ```
94
95
 
95
96
  `POST /projects` requires `teamId`. There is no public team-list endpoint today, so `--team-id` is required unless every visible project shares one team, in which case we reuse that id. If teams differ, refuse and ask.
package/docs/cli.md CHANGED
@@ -4,7 +4,7 @@ The `toloka` CLI reads TypeScript source as the desired state, compares it with
4
4
 
5
5
  This CLI is Beta software. Commands, flags, and output can change before general availability.
6
6
 
7
- `toloka` requires Bun 1.4.0. The published package ships matching CLI bytecode; the launcher falls back to TypeScript source in a development checkout when the bytecode is absent.
7
+ `toloka` requires Bun 1.4.0 or newer. The published package ships CLI bytecode built with Bun 1.4.0; another Bun version runs the same bundled JavaScript without that cache and starts slower. The launcher falls back to TypeScript source in a development checkout when the bytecode is absent.
8
8
 
9
9
  ## Configuration
10
10
 
@@ -13,28 +13,30 @@ Credentials and the platform base URL resolve from the same precedence order, hi
13
13
  | Precedence | API key source |
14
14
  | ----------- | ------------------------------------------ |
15
15
  | 1 (highest) | `--api-key` flag |
16
- | 2 | `POTATO_API_KEY` environment variable |
16
+ | 2 | `TOLOKA_API_KEY` environment variable |
17
17
  | 3 (lowest) | credentials file written by `toloka login` |
18
18
 
19
19
  | Precedence | Base URL source |
20
20
  | ----------- | --------------------------------------- |
21
21
  | 1 (highest) | `--base-url` flag |
22
- | 2 | `POTATO_BASE_URL` environment variable |
22
+ | 2 | `TOLOKA_BASE_URL` environment variable |
23
23
  | 3 | base URL stored in the credentials file |
24
24
  | 4 (default) | `https://platform.toloka.ai` |
25
25
 
26
26
  | Precedence | Project id source |
27
27
  | ----------- | --------------------------------------------- |
28
28
  | 1 (highest) | `--project-id` flag |
29
- | 2 | `TOLOKA_PROJECT_ID`, then `POTATO_PROJECT_ID` |
29
+ | 2 | `TOLOKA_PROJECT_ID` |
30
30
  | 3 | `projectId` in `toloka.json` |
31
31
  | 4 (lowest) | `current` alias in the credentials file |
32
32
 
33
+ Earlier releases named these variables `POTATO_API_KEY`, `POTATO_BASE_URL`, and `POTATO_PROJECT_ID`. The CLI still reads each legacy name when its `TOLOKA_*` counterpart is unset, prefers the `TOLOKA_*` value when both are set, and prints `POTATO_API_KEY is deprecated and will stop being read; set TOLOKA_API_KEY instead.` (and the same line for the other two) on stderr once per command. The legacy names stop being read in the first stable `0.2.0` release; rename them now to silence the warning.
34
+
33
35
  `toloka login` verifies the key against the platform before saving anything. It writes `$XDG_CONFIG_HOME/toloka/credentials.json`, which defaults to `~/.config/toloka/credentials.json`, with file mode `0600` and a parent directory with mode `0700`. The file may also store local project aliases. The legacy `~/.toloka/credentials.json` is still read when the new path has no file. `toloka logout` deletes the stored file but does not revoke the key.
34
36
 
35
37
  Machine settings live next to that credentials file in `settings.json` and default `auto-update` to `true`. A globally installed `toloka` checks `https://registry.npmjs.org/` at most once per day and, when a newer `@toloka-platform/sdk` version has been published for at least 24 hours, installs it with `bun add --global` and re-runs the original command. The check is pinned to that registry; a checkout `.env` cannot retarget it. `config`, `version`, and `help` never trigger a check. Project-local installs, CI, and `TOLOKA_SKIP_AUTO_UPDATE=1` also skip it. `TOLOKA_AUTO_UPDATE=0` turns it off for one command; `TOLOKA_AUTO_UPDATE=1` turns it on even when the setting is false.
36
38
 
37
- Ordinary usage events (`sdk_cli_command_completed` / `sdk_cli_command_failed`) go to Toloka's PostHog project so we can see which commands run and which error classes they hit. Their payloads contain only an allowlisted command classifier, duration, exit code, outcome or error code, SDK and Bun versions, actor, and channel. Raw arguments, flag values, environment variables, API keys, secret names, base URLs and hosts, local paths, project ids, error messages, stack traces, and source context are not sent. GeoIP enrichment is disabled. Distinct id starts as a random UUID stored next to the credentials file. After a successful authenticated command, the CLI calls `GET /me` and aliases that UUID onto the platform user id without setting person properties. Set `TOLOKA_TELEMETRY=0` or `DO_NOT_TRACK=1` to disable capture. CI environments are disabled unless `TOLOKA_TELEMETRY=1`. The explicitly approved full-text `report` event is documented in [report](#report).
39
+ Ordinary usage events (`sdk_cli_command_completed` / `sdk_cli_command_failed`) go to Toloka's PostHog project so we can see which commands run and which error classes they hit. Every failed command with an exception also emits a sanitized PostHog Error Tracking `$exception`; usage errors such as unknown commands or invalid flags do not. Command events contain only an allowlisted command classifier, duration, exit code, outcome or error code, optional HTTP status and server request ID, SDK and Bun versions, actor, and channel. Error Tracking receives the same bounded metadata plus a synthetic exception; raw arguments, flag values, environment variables, API keys, secret names, base URLs and hosts, local paths, project ids, error messages, stack traces, response bodies, and source context are not sent. GeoIP enrichment is disabled. Distinct id starts as a random UUID stored next to the credentials file. After a successful authenticated command, the CLI calls `GET /me` and aliases that UUID onto the platform user id without setting person properties. Set `TOLOKA_TELEMETRY=0` or `DO_NOT_TRACK=1` to disable capture. CI environments are disabled unless `TOLOKA_TELEMETRY=1`. The explicitly approved full-text `report` event is documented in [report](#report).
38
40
 
39
41
  The root program accepts these flags before any command:
40
42
 
@@ -80,11 +82,11 @@ toloka project switch <alias>
80
82
  toloka project current
81
83
  toloka project url
82
84
  toloka project remove <alias>
83
- toloka project create [alias] [--name <name>] [--team-id <id>]
85
+ toloka project create [alias] [--name <name>] [--team-id <id>] [--delivery-order-id <id>]
84
86
  toloka project untrack <pipeline|dataset> <name> [--confirm]
85
87
  ```
86
88
 
87
- `add`, `switch`, `remove`, and `create` write the machine registry in the credentials file. They refuse `--api-key` / `--base-url` / `POTATO_*` when those would select a different key or platform than the stored file. `project list` prints project id, name, and team id. `create` reuses the only visible team when every listed project shares one; otherwise pass `--team-id`.
89
+ `add`, `switch`, `remove`, and `create` write the machine registry in the credentials file. They refuse `--api-key` / `--base-url` / `TOLOKA_*` when those would select a different key or platform than the stored file. `project list` prints project id, name, and team id. `create` reuses the only visible team when every listed project shares one; otherwise pass `--team-id`. Internal users (`whoami` prints `Internal: true`) also see `--delivery-order-id` and `toloka delivery-order list`.
88
90
 
89
91
  `project untrack` removes one pipeline or dataset binding from `toloka.json` without deleting the live resource. It previews the name and id in a terminal; outside a terminal, pass `--confirm` after reviewing the state file.
90
92
 
@@ -92,16 +94,29 @@ toloka project untrack <pipeline|dataset> <name> [--confirm]
92
94
 
93
95
  `url` fetches the selected project to resolve its team and prints only its platform UI URL to stdout, making the output safe to capture in scripts and agent workflows.
94
96
 
97
+ ## delivery-order
98
+
99
+ Internal users only. Listed in `toloka --help` and available as a command when `whoami` prints `Internal: true`.
100
+
101
+ ```sh
102
+ toloka delivery-order list
103
+ ```
104
+
105
+ Prints `ID`, `NAME`, `STATUS`, and `CLIENT` columns. Empty output is `No delivery orders visible.`
106
+
95
107
  ## login
96
108
 
97
109
  Stores an API key for this machine after verifying it.
98
110
 
99
111
  ```sh
100
112
  toloka login
113
+ toloka login --api-key-stdin < key.txt
101
114
  ```
102
115
 
103
116
  The command explains how to generate an API key, prompts for it with masked input, and verifies it against the platform before saving. On success it prints `Authenticated against <base-url>: N project(s) visible.` and `Saved credentials to <path>.`
104
117
 
118
+ Without a terminal there is no prompt. `--api-key-stdin` reads the key from standard input, so it never appears in shell history or the process list; `--api-key <key>` and `TOLOKA_API_KEY` also work but expose the key to both.
119
+
105
120
  ## logout
106
121
 
107
122
  Removes stored credentials from this machine.
@@ -120,7 +135,7 @@ Shows which platform and key the CLI would use. Alias: `whoami`.
120
135
  toloka auth-status [--show-token]
121
136
  ```
122
137
 
123
- On success it prints the platform URL with its source, the API key masked unless `--show-token` is passed, the selected project, and `Reachable: N project(s) visible.` The project line is printed even when no key is in effect or the platform is not reachable. It exits `1` when no key is in effect or the platform is not reachable.
138
+ On success it prints the platform URL with its source, the API key masked unless `--show-token` is passed, the selected project, `Reachable: N project(s) visible.`, and `Internal: true` or `Internal: false`. The project line is printed even when the probe fails. It exits `1` when no key is in effect, when the platform rejects the key (`Rejected: …`, followed by the advice to run `toloka login`), when the platform does not answer (`Not reachable: …`; the key was not evaluated), or when the platform fails (`Platform error: …`).
124
139
 
125
140
  ## config
126
141
 
@@ -143,7 +158,7 @@ Initializes the current project directory and installs the Agent Bootstrap entry
143
158
  toloka init
144
159
  ```
145
160
 
146
- `init` does not require a selected platform project. It always maintains one `<toloka>` … `</toloka>` Agent Bootstrap block in `AGENTS.md` and writes minimal pointers to it: `.claude/skills/toloka-bootstrap/SKILL.md` when `.claude/` exists (or when no agent configuration exists at all) and `.cursor/rules/toloka-bootstrap.mdc` with `alwaysApply: true` when `.cursor/rules/` exists. The bootstrap tells an agent to run `toloka --help`, search the bundled Skill Catalog with `toloka skill search`, install a matching skill with `toloka skill install`, and read `.agents/skills/<skill-id>/SKILL.md`; it does not embed the build workflow. Bytes outside the block are preserved, and re-running `init` refreshes the block and both pointers in place without adding duplicates. When a project is already selected through `--project-id`, `TOLOKA_PROJECT_ID` / `POTATO_PROJECT_ID`, `toloka.json`, or the machine registry, it also writes `toloka.json` when missing. It does not walk up to a parent checkout.
161
+ `init` does not require a selected platform project. It always maintains one `<toloka>` … `</toloka>` Agent Bootstrap block in `AGENTS.md` and writes minimal pointers to it: `.claude/skills/toloka-bootstrap/SKILL.md` when `.claude/` exists (or when no agent configuration exists at all) and `.cursor/rules/toloka-bootstrap.mdc` with `alwaysApply: true` when `.cursor/rules/` exists. The bootstrap tells an agent to run `toloka --help`, search the bundled Skill Catalog with `toloka skill search`, install a matching skill with `toloka skill install`, and read `.agents/skills/<skill-id>/SKILL.md`; it does not embed the build workflow. Bytes outside the block are preserved, and re-running `init` refreshes the block and both pointers in place without adding duplicates. When a project is already selected through `--project-id`, `TOLOKA_PROJECT_ID`, `toloka.json`, or the machine registry, it also writes `toloka.json` when missing. It does not walk up to a parent checkout.
147
162
 
148
163
  `init` removes only Toloka-generated legacy entry points that still carry the `<!-- toloka:sdk-version … -->` marker: the full `toloka-build` and `toloka-pipeline-as-code` Claude skills and Cursor rules, plus the `<!-- toloka:begin -->` … `<!-- toloka:end -->` block in `AGENTS.md`, which is replaced by the `<toloka>` block in place. Files without that marker, other skills and rules, and installed skills under `.agents/skills/` are left untouched. An `AGENTS.md` whose current or legacy block is unterminated, reversed, or duplicated is refused with the file's full path before anything, including `toloka.json`, is written.
149
164
 
@@ -313,12 +328,14 @@ toloka skill install <skillId> [--force]
313
328
 
314
329
  `list` prints every skill in the catalog with its installation status: `not-installed` when `.agents/skills/<skillId>` is absent, `current` when the installed files match the catalog digest, and `stale` when they differ. Each skill line (`id`, status, name) is followed by one indented description line. `--json` prints the Skill Descriptors (`id`, `name`, `description`, `tags`, `version`, `digest`, `files`) plus `status` and never includes file contents.
315
330
 
316
- `search` matches `<query>` case-insensitively against each skill's id, name, description, and tags and prints the matches in the same format. When nothing matches it says so (or prints `[]` with `--json`), exits 0, and installs nothing.
331
+ `search` matches `<query>` case-insensitively against each skill's id, name, description, and tags and prints the matches in the same format. When nothing matches it prints `No skills match "<query>" in the catalog bundled with @toloka-platform/sdk <version>. …` (or `[]` with `--json`), exits 0, and installs nothing.
317
332
 
318
333
  `install` copies the complete skill — its `SKILL.md` entry point and every reference — from the package into `.agents/skills/<skillId>/` under the project root and prints the destination. Every path is confined to that directory and the command refuses to write through symbolic links. An existing `.agents/skills/<skillId>` is refused unless `--force` is passed. With `--force` the new copy is written to a temporary sibling directory and verified against the catalog digest, the existing directory is renamed to a backup, the verified copy is moved into place, and the backup is removed; a failed swap restores the backup, so the directory never holds a mixed version. A malformed catalog, an unsafe path, or a digest mismatch fails before any existing file changes.
319
334
 
320
335
  After an SDK upgrade `list` reports installed skills whose catalog digest changed as `stale` until they are refreshed with `install --force`. Local edits to an installed skill also make it `stale`; `list` and `search` never modify local files.
321
336
 
337
+ The catalog is bound to the installed package version, so a skill that a newer release ships is simply absent from an older CLI. `install` then exits 1 with `Skill "<skillId>" is not in the catalog bundled with @toloka-platform/sdk <version>. Run toloka skill list to see the available skills; a newer release may ship it (bun add --global @toloka-platform/sdk@<channel>).` and creates nothing. `<channel>` is the channel of the installed version (`preview` for a `-preview.N` version, otherwise `latest`); reinstall from it and retry.
338
+
322
339
  ## Exit codes
323
340
 
324
341
  `toloka pipeline run --wait` maps the run outcome to the process exit code.
@@ -331,6 +348,8 @@ After an SDK upgrade `list` reports installed skills whose catalog digest change
331
348
 
332
349
  Every other failure exits non-zero with a message on stderr: missing project identity, a rejected login, an unauthenticated `auth-status`, or a failed `secret set`.
333
350
 
351
+ An unknown command exits 1 before anything else runs, even when `--help` is present: `toloka training --help` on a build without `training` prints `error: unknown command 'training'` followed by `toloka <version> does not have it. Run toloka --help to list its commands; a runbook that uses it may need a newer release.` on stderr, and does not print the root help. Only a command the installed version defines exits 0 with `--help`.
352
+
334
353
  ## The reconcile loop
335
354
 
336
355
  Treat the TypeScript source as authoritative. The canonical sequence is: run the complete local gate, validate against the platform, plan, apply, then plan again to confirm convergence.
@@ -11,7 +11,7 @@ curl -fsSL https://platform.toloka.ai/cli/install.sh | sh
11
11
  bun add @toloka-platform/sdk@latest
12
12
  ```
13
13
 
14
- The installer requires Bun 1.4.0, installs `@toloka-platform/sdk` globally, and exposes `toloka` through Bun's global binary directory. The published CLI includes matching precompiled bytecode. The project install makes SDK imports resolvable.
14
+ The installer requires Bun 1.4.0 or newer, installs `@toloka-platform/sdk` globally, and exposes `toloka` through Bun's global binary directory. The published CLI includes bytecode built with Bun 1.4.0; another Bun version runs the same bundled JavaScript without that cache and starts slower. The project install makes SDK imports resolvable.
15
15
 
16
16
  ## Sign in
17
17
 
@@ -33,11 +33,11 @@ Check what the CLI will use at any time:
33
33
  toloka whoami
34
34
  ```
35
35
 
36
- CI does not need `login`. Set `POTATO_API_KEY` and the stored file is ignored. See the precedence table in the [CLI reference](./cli.md).
36
+ CI does not need `login`. Set `TOLOKA_API_KEY` and the stored file is ignored. See the precedence table in the [CLI reference](./cli.md).
37
37
 
38
38
  ## Start with an agent
39
39
 
40
- For a guided first run, start a fresh coding-agent session and ask it to follow `https://platform.toloka.ai/agents/data-labeling.md`. The guide takes the agent through installation, credentials, project selection, local tests, plan approval, apply, cost review, and a bounded sample run.
40
+ For a guided first run, start a fresh coding-agent session and ask it to follow the [Toloka agent bootstrap](https://platform.toloka.ai/agents/SKILL.md). It routes to the data-labeling, fine-tuning, or gisting runbook and the matching packaged skill.
41
41
 
42
42
  Initialize the current directory and install the Agent Bootstrap. No platform project needs to be selected yet.
43
43
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  What this Beta SDK does not do yet, stated plainly so you can decide what to depend on.
4
4
 
5
- `@toloka-platform/sdk` is `0.2.0-preview.2`. This is a Beta: the authoring API, the CLI surface, and the generated source layout can change before general availability. Pin an exact version. Do not depend on this in production yet.
5
+ `@toloka-platform/sdk` is `0.2.0-preview.3`. This is a Beta: the authoring API, the CLI surface, and the generated source layout can change before general availability. Pin an exact version. Do not depend on this in production yet.
6
6
 
7
7
  ## Local checks do not certify deployability
8
8
 
package/docs/testing.md CHANGED
@@ -94,7 +94,7 @@ For a structured or array-valued Field, derive the dataset field schema from the
94
94
 
95
95
  ## Runtime rules
96
96
 
97
- `ui.code` must parse as one JSX root. Every identifier must be a component returned by `componentDocumentation()` or a documented `actions` API. `toloka check` applies full TypeScript semantic checking with declarations bundled in the SDK; the real launcher then renders the same JSX in browser scenarios. Treat a component's `propsType` and `example` together as its contract.
97
+ `ui.code` must parse as one TSX root. Every identifier must be a component returned by `componentDocumentation()` or a documented `actions` API. `toloka check` applies full TypeScript semantic checking with declarations bundled in the SDK; the real launcher then renders the same TSX in browser scenarios. Treat a component's `propsType` and `example` together as its contract.
98
98
 
99
99
  `preprocess` and `postprocess` are JavaScript function bodies, not TypeScript:
100
100
 
@@ -92,7 +92,7 @@ toloka pipeline results <runId> --failed
92
92
  Missing API key. Run toloka login once to store credentials for this machine.
93
93
  ```
94
94
 
95
- Run `toloka login`, or set `POTATO_API_KEY` in an environment where interactive login is not possible. `toloka whoami` reports which platform and which key source is in effect, and exits non-zero when the platform is unreachable.
95
+ Run `toloka login`. Where interactive login is not possible, pipe the key to `toloka login --api-key-stdin` or set `TOLOKA_API_KEY`. `toloka whoami` reports which platform and which key source is in effect, and exits non-zero when the platform is unreachable.
96
96
 
97
97
  ## Authentication fails with a key you just generated
98
98
 
@@ -11,8 +11,8 @@ toloka init
11
11
  Then configure the API and import an existing project:
12
12
 
13
13
  ```sh
14
- export POTATO_API_KEY=api-key
15
- export POTATO_BASE_URL=https://potato.example.com
14
+ export TOLOKA_API_KEY=api-key
15
+ export TOLOKA_BASE_URL=https://potato.example.com
16
16
  toloka import pp.0190abcd-abcd-7abc-8abc-abcdefabcdef
17
17
  # Imported project pp.0190abcd-abcd-7abc-8abc-abcdefabcdef with 1 pipeline and 1 dataset into ...
18
18
  ```
@@ -30,12 +30,14 @@ import type {
30
30
  ExportPipeline200,
31
31
  GetDatasetInferredFields200,
32
32
  GetTrainingRunLogsParams,
33
+ GetTrainingRunMetricHistoryParams,
33
34
  ImportPipelineBody,
34
35
  ListBaseModels200,
35
36
  ListDatasetFields200,
36
37
  ListDatasetFieldsParams,
37
38
  ListDatasetItems200,
38
39
  ListDatasetItemsParams,
40
+ ListDeliveryOrders200,
39
41
  ListModelVersions200,
40
42
  ListModelVersionsParams,
41
43
  ListPipelineChecks200,
@@ -93,6 +95,8 @@ import type {
93
95
  TrainingRun,
94
96
  TrainingRunId,
95
97
  TrainingRunLogs,
98
+ TrainingRunMetricHistory,
99
+ TrainingRunMetrics,
96
100
  UpdatePipelineBody,
97
101
  UpdateProjectBody,
98
102
  UpdateTrainingMetadataBody,
@@ -587,6 +591,59 @@ export const getTrainingRunLogs = async (trainingRunId: TrainingRunId,
587
591
 
588
592
 
589
593
 
594
+ export const getGetTrainingRunMetricsUrl = (trainingRunId: TrainingRunId,) => {
595
+
596
+
597
+
598
+
599
+ return `/api/v2-beta/training-runs/${trainingRunId}/metrics`
600
+ }
601
+
602
+ export const getTrainingRunMetrics = async (trainingRunId: TrainingRunId, options?: RequestInit): Promise<TrainingRunMetrics> => {
603
+
604
+ return potatoFetch<TrainingRunMetrics>(getGetTrainingRunMetricsUrl(trainingRunId),
605
+ {
606
+ ...options,
607
+ method: 'GET'
608
+
609
+
610
+ }
611
+ );}
612
+
613
+
614
+
615
+ export const getGetTrainingRunMetricHistoryUrl = (trainingRunId: TrainingRunId,
616
+ metricKey: string,
617
+ params?: GetTrainingRunMetricHistoryParams,) => {
618
+ const normalizedParams = new URLSearchParams();
619
+
620
+ Object.entries(params || {}).forEach(([key, value]) => {
621
+
622
+ if (value !== undefined) {
623
+ normalizedParams.append(key, value === null ? 'null' : value.toString())
624
+ }
625
+ });
626
+
627
+ const stringifiedParams = normalizedParams.toString();
628
+
629
+ return stringifiedParams.length > 0 ? `/api/v2-beta/training-runs/${trainingRunId}/metrics/${metricKey}?${stringifiedParams}` : `/api/v2-beta/training-runs/${trainingRunId}/metrics/${metricKey}`
630
+ }
631
+
632
+ export const getTrainingRunMetricHistory = async (trainingRunId: TrainingRunId,
633
+ metricKey: string,
634
+ params?: GetTrainingRunMetricHistoryParams, options?: RequestInit): Promise<TrainingRunMetricHistory> => {
635
+
636
+ return potatoFetch<TrainingRunMetricHistory>(getGetTrainingRunMetricHistoryUrl(trainingRunId,metricKey,params),
637
+ {
638
+ ...options,
639
+ method: 'GET'
640
+
641
+
642
+ }
643
+ );}
644
+
645
+
646
+
590
647
  export const getResumeTrainingRunUrl = (trainingRunId: TrainingRunId,) => {
591
648
 
592
649
 
@@ -650,6 +707,27 @@ export const getCurrentUser = async ( options?: RequestInit): Promise<CurrentUse
650
707
 
651
708
 
652
709
 
710
+ export const getListDeliveryOrdersUrl = () => {
711
+
712
+
713
+
714
+
715
+ return `/api/v2-beta/delivery-orders`
716
+ }
717
+
718
+ export const listDeliveryOrders = async ( options?: RequestInit): Promise<ListDeliveryOrders200> => {
719
+
720
+ return potatoFetch<ListDeliveryOrders200>(getListDeliveryOrdersUrl(),
721
+ {
722
+ ...options,
723
+ method: 'GET'
724
+
725
+
726
+ }
727
+ );}
728
+
729
+
730
+
653
731
  export const getListProjectsUrl = (params?: ListProjectsParams,) => {
654
732
  const normalizedParams = new URLSearchParams();
655
733
 
@@ -3,5 +3,6 @@ import type { CheckReportAnyOfSix } from './checkReportAnyOfSix';
3
3
  import type { CheckReportAnyOfOnezero } from './checkReportAnyOfOnezero';
4
4
  import type { CheckReportAnyOfTwoone } from './checkReportAnyOfTwoone';
5
5
  import type { CheckReportAnyOfTwofive } from './checkReportAnyOfTwofive';
6
+ import type { CheckReportAnyOfTwoseven } from './checkReportAnyOfTwoseven';
6
7
 
7
- export type CheckReport = CheckReportAnyOf | CheckReportAnyOfSix | CheckReportAnyOfOnezero | CheckReportAnyOfTwoone | CheckReportAnyOfTwofive;
8
+ export type CheckReport = CheckReportAnyOf | CheckReportAnyOfSix | CheckReportAnyOfOnezero | CheckReportAnyOfTwoone | CheckReportAnyOfTwofive | CheckReportAnyOfTwoseven;
@@ -0,0 +1,5 @@
1
+ import type { CheckReportAnyOfTwosevenResultsItem } from './checkReportAnyOfTwosevenResultsItem';
2
+
3
+ export type CheckReportAnyOfTwoseven = {
4
+ results: CheckReportAnyOfTwosevenResultsItem[];
5
+ };
@@ -0,0 +1,6 @@
1
+ import type { CheckReportAnyOfTwosevenResultsItemVerdict } from './checkReportAnyOfTwosevenResultsItemVerdict';
2
+
3
+ export type CheckReportAnyOfTwosevenResultsItem = {
4
+ criterionId: string;
5
+ verdict: CheckReportAnyOfTwosevenResultsItemVerdict;
6
+ };
@@ -0,0 +1,2 @@
1
+
2
+ export type CheckReportAnyOfTwosevenResultsItemVerdict = 'pass' | 'fail' | 'unable_to_process' | 'incorrect_data' | 'jsonpath_error' | 'error' | 'skipped';
@@ -3,4 +3,5 @@ import type { CurrentUserEmail } from './currentUserEmail';
3
3
  export interface CurrentUser {
4
4
  id: string;
5
5
  email: CurrentUserEmail;
6
+ internal: boolean;
6
7
  }
@@ -0,0 +1,9 @@
1
+ import type { DeliveryOrderClientName } from './deliveryOrderClientName';
2
+
3
+ export interface DeliveryOrder {
4
+ id: string;
5
+ name: string;
6
+ mondayId: string;
7
+ status: string;
8
+ clientName: DeliveryOrderClientName;
9
+ }
@@ -0,0 +1,2 @@
1
+
2
+ export type DeliveryOrderClientName = string | null;
@@ -0,0 +1,4 @@
1
+
2
+ export type GetTrainingRunMetricHistoryParams = {
3
+ resolution?: number;
4
+ };
@@ -55,6 +55,9 @@ export * from './checkReportAnyOfTwoone';
55
55
  export * from './checkReportAnyOfTwooneFindingsItem';
56
56
  export * from './checkReportAnyOfTwooneFindingsItemFlag';
57
57
  export * from './checkReportAnyOfTwooneFindingsItemSettingName';
58
+ export * from './checkReportAnyOfTwoseven';
59
+ export * from './checkReportAnyOfTwosevenResultsItem';
60
+ export * from './checkReportAnyOfTwosevenResultsItemVerdict';
58
61
  export * from './checkRunId';
59
62
  export * from './codeNode';
60
63
  export * from './codeNodeSettings';
@@ -127,6 +130,8 @@ export * from './datasetItemId';
127
130
  export * from './datasetProfile';
128
131
  export * from './datasetProfileStamp';
129
132
  export * from './datasetProfileStampName';
133
+ export * from './deliveryOrder';
134
+ export * from './deliveryOrderClientName';
130
135
  export * from './estimatePipelineCostBody';
131
136
  export * from './estimatePipelineCostBodyItemFilter';
132
137
  export * from './estimatePipelineCostBodyItemFilterFieldSourcesItem';
@@ -257,6 +262,7 @@ export * from './generationNodeSettingsSmartSearchAnyOfProjectDescription';
257
262
  export * from './generationNodeSettingsUi';
258
263
  export * from './getDatasetInferredFields200';
259
264
  export * from './getTrainingRunLogsParams';
265
+ export * from './getTrainingRunMetricHistoryParams';
260
266
  export * from './gistingTrainingConfiguration';
261
267
  export * from './gistingTrainingConfigurationInput';
262
268
  export * from './gistingTrainingConfigurationInputRegime';
@@ -276,6 +282,7 @@ export * from './listDatasetFields200';
276
282
  export * from './listDatasetFieldsParams';
277
283
  export * from './listDatasetItems200';
278
284
  export * from './listDatasetItemsParams';
285
+ export * from './listDeliveryOrders200';
279
286
  export * from './listModelVersions200';
280
287
  export * from './listModelVersionsParams';
281
288
  export * from './listPipelineChecks200';
@@ -961,6 +968,18 @@ export * from './trainingRunLogsEntriesItem';
961
968
  export * from './trainingRunLogsEntriesItemLevel';
962
969
  export * from './trainingRunLogsNextCursor';
963
970
  export * from './trainingRunMessage';
971
+ export * from './trainingRunMetricHistory';
972
+ export * from './trainingRunMetricHistoryMetric';
973
+ export * from './trainingRunMetricHistoryPointsItem';
974
+ export * from './trainingRunMetricHistoryPointsItemNonFinite';
975
+ export * from './trainingRunMetricHistoryPointsItemValue';
976
+ export * from './trainingRunMetrics';
977
+ export * from './trainingRunMetricsMetricsItem';
978
+ export * from './trainingRunMetricsMetricsItemLatest';
979
+ export * from './trainingRunMetricsMetricsItemLatestNonFinite';
980
+ export * from './trainingRunMetricsMetricsItemLatestValue';
981
+ export * from './trainingRunMetricsMetricsItemMetric';
982
+ export * from './trainingRunMetricsUnavailableReason';
964
983
  export * from './trainingRunOutputModelVersionRevision';
965
984
  export * from './trainingRunProgress';
966
985
  export * from './trainingRunProgressAnyOf';
@@ -0,0 +1,5 @@
1
+ import type { DeliveryOrder } from './deliveryOrder';
2
+
3
+ export type ListDeliveryOrders200 = {
4
+ deliveryOrders: DeliveryOrder[];
5
+ };
@@ -0,0 +1,9 @@
1
+ import type { TrainingRunMetricHistoryMetric } from './trainingRunMetricHistoryMetric';
2
+ import type { TrainingRunMetricHistoryPointsItem } from './trainingRunMetricHistoryPointsItem';
3
+
4
+ export interface TrainingRunMetricHistory {
5
+ key: string;
6
+ metric: TrainingRunMetricHistoryMetric;
7
+ points: TrainingRunMetricHistoryPointsItem[];
8
+ truncated: boolean;
9
+ }
@@ -0,0 +1,2 @@
1
+
2
+ export type TrainingRunMetricHistoryMetric = 'training_loss' | 'validation_loss' | 'learning_rate' | 'training_token_accuracy' | 'validation_token_accuracy' | null;
@@ -0,0 +1,9 @@
1
+ import type { TrainingRunMetricHistoryPointsItemValue } from './trainingRunMetricHistoryPointsItemValue';
2
+ import type { TrainingRunMetricHistoryPointsItemNonFinite } from './trainingRunMetricHistoryPointsItemNonFinite';
3
+
4
+ export type TrainingRunMetricHistoryPointsItem = {
5
+ step: number;
6
+ timestamp: number;
7
+ value: TrainingRunMetricHistoryPointsItemValue;
8
+ nonFinite: TrainingRunMetricHistoryPointsItemNonFinite;
9
+ };
@@ -0,0 +1,2 @@
1
+
2
+ export type TrainingRunMetricHistoryPointsItemNonFinite = 'nan' | 'positive_infinity' | 'negative_infinity' | null;
@@ -0,0 +1,2 @@
1
+
2
+ export type TrainingRunMetricHistoryPointsItemValue = number | null;
@@ -0,0 +1,9 @@
1
+ import type { TrainingRunMetricsUnavailableReason } from './trainingRunMetricsUnavailableReason';
2
+ import type { TrainingRunMetricsMetricsItem } from './trainingRunMetricsMetricsItem';
3
+
4
+ export interface TrainingRunMetrics {
5
+ available: boolean;
6
+ unavailableReason: TrainingRunMetricsUnavailableReason;
7
+ truncated: boolean;
8
+ metrics: TrainingRunMetricsMetricsItem[];
9
+ }
@@ -0,0 +1,8 @@
1
+ import type { TrainingRunMetricsMetricsItemMetric } from './trainingRunMetricsMetricsItemMetric';
2
+ import type { TrainingRunMetricsMetricsItemLatest } from './trainingRunMetricsMetricsItemLatest';
3
+
4
+ export type TrainingRunMetricsMetricsItem = {
5
+ key: string;
6
+ metric: TrainingRunMetricsMetricsItemMetric;
7
+ latest: TrainingRunMetricsMetricsItemLatest;
8
+ };
@@ -0,0 +1,9 @@
1
+ import type { TrainingRunMetricsMetricsItemLatestValue } from './trainingRunMetricsMetricsItemLatestValue';
2
+ import type { TrainingRunMetricsMetricsItemLatestNonFinite } from './trainingRunMetricsMetricsItemLatestNonFinite';
3
+
4
+ export type TrainingRunMetricsMetricsItemLatest = {
5
+ step: number;
6
+ timestamp: number;
7
+ value: TrainingRunMetricsMetricsItemLatestValue;
8
+ nonFinite: TrainingRunMetricsMetricsItemLatestNonFinite;
9
+ };
@@ -0,0 +1,2 @@
1
+
2
+ export type TrainingRunMetricsMetricsItemLatestNonFinite = 'nan' | 'positive_infinity' | 'negative_infinity' | null;
@@ -0,0 +1,2 @@
1
+
2
+ export type TrainingRunMetricsMetricsItemLatestValue = number | null;
@@ -0,0 +1,2 @@
1
+
2
+ export type TrainingRunMetricsMetricsItemMetric = 'training_loss' | 'validation_loss' | 'learning_rate' | 'training_token_accuracy' | 'validation_token_accuracy' | null;
@@ -0,0 +1,2 @@
1
+
2
+ export type TrainingRunMetricsUnavailableReason = 'not_configured' | 'unresolved' | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toloka-platform/sdk",
3
- "version": "0.2.0-preview.2",
3
+ "version": "0.2.0-preview.3",
4
4
  "private": false,
5
5
  "description": "Beta. Build, inspect, and operate Toloka pipeline projects as TypeScript source. The public API may change.",
6
6
  "license": "Apache-2.0",
@@ -73,6 +73,6 @@
73
73
  }
74
74
  },
75
75
  "engines": {
76
- "bun": "1.4.0"
76
+ "bun": ">=1.4.0"
77
77
  }
78
78
  }