@toloka-platform/sdk 0.2.0 → 0.3.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.
Files changed (62) hide show
  1. package/README.md +12 -6
  2. package/dist/cli/toloka.js +269 -142
  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 +2 -0
  7. package/docs/cli.md +86 -23
  8. package/docs/getting-started.md +11 -9
  9. package/docs/limitations.md +6 -0
  10. package/docs/testing-examples.md +2 -2
  11. package/docs/testing.md +10 -2
  12. package/docs/troubleshooting.md +16 -4
  13. package/openapi/gen/api.ts +30 -0
  14. package/openapi/gen/models/gistingTrainingConfigurationGistTokens.ts +1 -1
  15. package/openapi/gen/models/gistingTrainingConfigurationInputGistTokens.ts +1 -1
  16. package/openapi/gen/models/index.ts +3 -0
  17. package/openapi/gen/models/listAudienceSpecializations200.ts +7 -0
  18. package/openapi/gen/models/listAudienceSpecializationsParams.ts +5 -0
  19. package/openapi/gen/models/specialization.ts +6 -0
  20. package/openapi/gen/models/trainingCostEstimateOneOfTwoseven.ts +0 -2
  21. package/openapi/gen/models/trainingRunQuote.ts +0 -2
  22. package/package.json +1 -1
  23. package/skills/catalog.json +10 -10
  24. package/skills/toloka-build/SKILL.md +8 -5
  25. package/skills/toloka-build/references/node-semantics.md +2 -2
  26. package/skills/toloka-build/references/workflow-and-cli.md +50 -25
  27. package/skills/toloka-fine-tuning/SKILL.md +3 -2
  28. package/skills/toloka-get-started/SKILL.md +4 -3
  29. package/skills/toloka-gisting/SKILL.md +4 -3
  30. package/skills/toloka-report-issue/references/report-template.md +1 -1
  31. package/src/checks/task-ui-typecheck.ts +4 -1
  32. package/src/cli/analytics.ts +1 -0
  33. package/src/cli/audience.ts +31 -0
  34. package/src/cli/auth.ts +382 -81
  35. package/src/cli/auto-update.ts +363 -24
  36. package/src/cli/browser-login.ts +265 -0
  37. package/src/cli/browser-session.ts +244 -0
  38. package/src/cli/check.ts +51 -52
  39. package/src/cli/cli-entry.ts +31 -0
  40. package/src/cli/commands/audience.ts +22 -0
  41. package/src/cli/commands/auth.ts +22 -15
  42. package/src/cli/commands/project.ts +3 -3
  43. package/src/cli/commands/training.ts +10 -2
  44. package/src/cli/config.ts +41 -14
  45. package/src/cli/context.ts +45 -9
  46. package/src/cli/credentials.ts +13 -13
  47. package/src/cli/init.ts +7 -2
  48. package/src/cli/keycloak.ts +189 -0
  49. package/src/cli/models.ts +1 -21
  50. package/src/cli/native-runtime.ts +7 -0
  51. package/src/cli/program.ts +5 -0
  52. package/src/cli/sign-in-page.ts +153 -0
  53. package/src/cli/skill.ts +34 -26
  54. package/src/cli/style.ts +37 -0
  55. package/src/cli/table.ts +21 -0
  56. package/src/cli/terminal-io.ts +9 -2
  57. package/src/cli/trainings.ts +1 -22
  58. package/src/cli/version.ts +12 -1
  59. package/src/client.ts +20 -3
  60. package/src/index.ts +1 -0
  61. package/src/pipeline-graph-v1.contract.json +47 -24
  62. package/src/transport.ts +19 -11
@@ -28,47 +28,69 @@ Treat the three layers differently:
28
28
 
29
29
  For a first-time guided session, consult `https://platform.toloka.ai/agents/data-labeling.md` for orientation. Adapt the journey to the user's goal and already-complete setup while preserving dependencies, cost approval, and identity/source protection; use this reference for command details.
30
30
 
31
- Install the SDK before invoking project commands:
31
+ Bun is the recommended runtime and package manager for pipeline authoring. In an existing source root, install its declared dependencies:
32
32
 
33
33
  ```sh
34
- bun add --dev @toloka-platform/sdk@latest
34
+ bun i
35
+ ```
36
+
37
+ For a new pipeline project, add the SDK, TypeScript, and Vitest:
38
+
39
+ ```sh
40
+ bun add -d @toloka-platform/sdk@latest typescript vitest
41
+ ```
42
+
43
+ These are project authoring and test dependencies, not prerequisites for running the standalone CLI or a Training-only workflow. Task UI scenarios additionally require Playwright and Chromium:
44
+
45
+ ```sh
46
+ bun add -d playwright
47
+ bunx playwright install chromium
35
48
  ```
36
49
 
37
50
  Select or create the intended platform project before `toloka init` when the checkout should be bound immediately; follow the adoption or scratch recipe below. Running `init` without explicit or checkout-local project identity installs only the agent entry points and never adopts the machine registry's current project.
38
51
 
39
- `toloka init` checks that `@toloka-platform/sdk` is declared in `dependencies` or `devDependencies`, then maintains one `<toloka>` Agent Bootstrap block in `AGENTS.md` and writes minimal pointers to it: a Claude skill at `.claude/skills/toloka-bootstrap/SKILL.md` when `.claude/` exists (or when no agent configuration exists at all) and an always-applied Cursor rule at `.cursor/rules/toloka-bootstrap.mdc` when `.cursor/rules/` exists. It writes `toloka.json` only from an explicit project flag/environment value or an existing checkout binding.
52
+ `toloka init` warns when `@toloka-platform/sdk` is not declared in `dependencies` or `devDependencies`, then maintains one `<toloka>` Agent Bootstrap block in `AGENTS.md` and writes minimal pointers to it: a Claude skill at `.claude/skills/toloka-bootstrap/SKILL.md` when `.claude/` exists (or when no agent configuration exists at all) and an always-applied Cursor rule at `.cursor/rules/toloka-bootstrap.mdc` when `.cursor/rules/` exists. The dependency warning applies to pipeline authoring; Training commands do not require the SDK dependency. `init` writes `toloka.json` only from an explicit project flag/environment value or an existing checkout binding.
40
53
 
41
- The bootstrap is small: it tells an agent to run `toloka --help`, search the bundled Skill Catalog with `toloka skill search <query>`, install the match with `toloka skill install <skill-id>`, and read `.agents/skills/<skill-id>/SKILL.md`. This skill is that installed copy. Commands warn on stderr when a generated legacy entry point is still present or the recorded bootstrap version differs from the installed SDK. Help, `init`, `report`, `project url`, `config`, and version invocations skip this checkout-dependent warning. The warning never blocks a command; re-run `toloka init` to refresh the bootstrap and its pointers.
54
+ The bootstrap is small: it tells an agent to run `toloka --help`, search the bundled Skill Catalog with `toloka skill search <query>`, install the match with `toloka skill install <skill-id>`, and read `.agents/skills/<skill-id>/SKILL.md`. This skill is that installed copy. Commands warn on stderr when a generated legacy entry point is still present or the recorded bootstrap version differs from the running CLI's bundled version, independently of any project SDK dependency. Help, `init`, `report`, `project url`, `config`, and version invocations skip this checkout-dependent warning. The warning never blocks a command; after updating the standalone CLI, re-run `toloka init` to refresh the bootstrap and its pointers.
42
55
 
43
- ## Store credentials once
56
+ ## Sign in once
44
57
 
45
58
  ```sh
46
59
  toloka login
47
60
  ```
48
61
 
49
- It explains where to generate an API key — `console.toloka.ai` → Company → API Keys → Generate API Key
50
- — reads the key without echoing it, verifies it by listing one project, and only then saves the
51
- credentials file with mode `0600`. Nothing is written when the key does not authenticate.
52
-
53
- Most later commands read that file, so `--api-key` becomes optional. For networked commands that do
54
- not mutate the machine project registry, key precedence is flag, then `TOLOKA_API_KEY`, then the
55
- stored file; CI can use an environment variable without running login. Non-interactive callers can
56
- skip the login prompt by piping the key to `toloka login --api-key-stdin`; `toloka login --api-key <key>`
57
- also works but leaves the key in shell history. The base URL defaults to the platform.
62
+ It asks whether to sign in through the browser or with an API key. The browser choice opens a page in
63
+ the browser where the user continues with Google or Microsoft (testing environments also offer email
64
+ and password and the testing users), hands them to the Toloka login page, waits for the sign-in to finish, verifies access by
65
+ listing one project, and only then saves the browser session under `~/.toloka/cli/credentials/` with
66
+ mode `0600`. Nothing is written when the platform does not accept the account. The session renews
67
+ itself for up to 14 days; after that `toloka login` is needed again. Run `toloka login --browser` yourself
68
+ by default: it skips the question, opens the sign-in page in the user's browser, and waits for them to
69
+ finish; without a terminal it fails fast when no browser can be opened. `toloka login --no-browser` prints
70
+ the link instead of opening a browser.
71
+
72
+ The API key choice does not expire: the key works until it is deleted in the Business Console, which
73
+ suits scripts, CI, and coding agents. Type it at the masked prompt, or pipe it to `toloka login --api-key-stdin`.
74
+ `toloka login --api-key <key>` also works but leaves the key in shell history. Most later commands read the stored login, so
75
+ `--api-key` becomes optional. For networked commands that do not mutate the machine project registry,
76
+ credential precedence is flag, then `TOLOKA_API_KEY`, then the stored API key, then the browser
77
+ session; CI can use an environment variable without running login. The base URL defaults to the platform.
58
78
 
59
79
  ```sh
60
80
  toloka auth-status # or toloka whoami
61
81
  toloka logout
62
82
  ```
63
83
 
64
- `auth-status` reports which platform and key are in effect and where each came from, masks the key
65
- unless you pass `--show-token`, and exits non-zero on failure — use it to check a setup rather than
66
- guessing. Its last lines say which failure it was: `Rejected:` means the platform refused the key
67
- (run `toloka login` with a working one); `Not reachable:` means the platform did not answer, so the
68
- key was not evaluated (fix network access, do not ask for a new key); `Platform error:` means the
69
- platform failed (retry later). `logout` deletes the stored file; it does not revoke the key.
84
+ `auth-status` reports which platform and login are in effect and where each came from and exits
85
+ non-zero on failure — use it to check a setup rather than guessing. It masks the credential; `--show-token`
86
+ prints the full API key or the browser session's live access token, so pass it only when a command
87
+ genuinely needs the raw value and never paste the output into chat. Its last lines say which failure it was: `Rejected:` means the platform refused the login
88
+ (run `toloka login` again); `Not reachable:` means the platform did not answer, so the login was not
89
+ evaluated (fix network access, do not ask for a new login); `Platform error:` means the platform
90
+ failed (retry later). `logout` ends every stored browser session and deletes the stored files; it does not
91
+ revoke an API key.
70
92
 
71
- A globally installed `toloka` auto-updates by default. It checks npm at most once per day and installs a newer `@toloka-platform/sdk` only after that version has been published for at least 24 hours, then re-runs the original command. `config`, `version`, and `help` never trigger a check. Project-local installs and CI skip it. Turn it off with `toloka config set auto-update false`.
93
+ Standalone and Bun-global `toloka` installations check the public npm registry at most once per day and install eligible releases at least 24 hours old before rerunning the command. Project-local installs, CI, and `config`, `version`, and `help` skip the check. Turn it off with `toloka config set auto-update false`. For manual standalone updates, rerun `curl -fsSL https://platform.toloka.ai/cli/install.sh | sh -s -- --native`; Bun-global updates should use `--bun` instead. Preserve the mode and put any original `TOLOKA_CLI_INSTALL_DIR`, `TOLOKA_CLI_CHANNEL`, `TOLOKA_CLI_PACKAGE`, and `TOLOKA_CLI_REGISTRY` overrides on the `sh` side of the pipe again. A package version pin does not disable automatic updates, which always use the public npm registry.
72
94
 
73
95
  ## Configure the CLI
74
96
 
@@ -90,7 +112,7 @@ The real command surface is:
90
112
  toloka version [--json]
91
113
  toloka -v
92
114
  toloka --version
93
- toloka login
115
+ toloka login [--browser] [--no-browser] [--api-key-stdin]
94
116
  toloka logout
95
117
  toloka auth-status
96
118
  toloka config
@@ -105,6 +127,7 @@ toloka project remove <alias>
105
127
  toloka project create [alias] [--name <name>] [--team-id <id>] [--delivery-order-id <id>]
106
128
  toloka project untrack <pipeline|dataset> <name> [--confirm]
107
129
  toloka delivery-order list
130
+ toloka audience specialization list [--json]
108
131
  toloka init
109
132
  toloka import [projectId]
110
133
  toloka check [pipeline] [--node <name-or-id>] [--json] [--watch]
@@ -134,8 +157,8 @@ toloka model create <name> --base <base-model-id> [--description <text>] [--json
134
157
  toloka model archive <name-or-id> [--json]
135
158
  toloka training list [--json]
136
159
  toloka training get <name-or-id> [--json]
137
- toloka training create <name> [--method sft|gisting] (--base-model <id> | --model-version <id>) --dataset <id> [--train-filter field=value] [--validation-dataset <id> [--validation-filter field=value]] [--prompt-file <path>] [--lora-rank 8|16|32 | --gist-tokens 8|32|64] [--epochs 1..5] [--learning-rate <rate>] [--batch-size 8|16|32|64] [--max-sequence-length <tokens>] [--json]
138
- toloka training update <name-or-id> [--base-model <id> | --model-version <id>] [--dataset <id>] [--train-filter field=value] [--validation-dataset <id> [--validation-filter field=value]] [--prompt-file <path>] [--lora-rank 8|16|32 | --gist-tokens 8|32|64] [--epochs 1..5] [--learning-rate <rate>] [--batch-size 8|16|32|64] [--max-sequence-length <tokens>] [--json]
160
+ toloka training create <name> [--method sft|gisting] (--base-model <id> | --model-version <id>) --dataset <id> [--train-filter field=value] [--validation-dataset <id> [--validation-filter field=value]] [--prompt-file <path>] [--lora-rank 8|16|32 | --gist-tokens 8|32|64|1/4|1/8|1/16|1/32] [--epochs 1..5] [--learning-rate <rate>] [--batch-size 8|16|32|64] [--max-sequence-length <tokens>] [--json]
161
+ toloka training update <name-or-id> [--base-model <id> | --model-version <id>] [--dataset <id>] [--train-filter field=value] [--validation-dataset <id> [--validation-filter field=value]] [--prompt-file <path>] [--lora-rank 8|16|32 | --gist-tokens 8|32|64|1/4|1/8|1/16|1/32] [--epochs 1..5] [--learning-rate <rate>] [--batch-size 8|16|32|64] [--max-sequence-length <tokens>] [--json]
139
162
  toloka training cost <name-or-id> [--idempotency-key <key>] [--json]
140
163
  toloka training run <name-or-id> [--estimate-file <path>] [--version-name <name>] [--idempotency-key <key>] [--json]
141
164
  toloka training runs <name-or-id> [--json]
@@ -156,6 +179,8 @@ Resolve the intended platform project before `import`, `plan`, or `apply`; use a
156
179
 
157
180
  `toloka project url` prints only the selected project's platform UI URL. Use it when the user needs a working link to inspect the live project.
158
181
 
182
+ `toloka audience specialization list` prints the global specialization catalog: `ID`, `NAME`, and `EXPERTS` columns sorted by name (`--json` for the array). Run it before setting `audience.specializations` on a node, pick entries by name, and copy `ID` into `qualificationId` and `NAME` into `value`; never invent a `qualificationId`. `EXPERTS` counts ID-verified experts currently eligible for tasks; a `0` means the id is valid but nobody currently qualifies, so prefer another specialization or widen the audience.
183
+
159
184
  `toloka pipeline cost [name] [--item-limit <n>]` forecasts what a run of a live, validated pipeline would bill. It does not start a run or change the graph. If any billed node is marked `skipped`, the displayed total is incomplete and must not be presented as the pipeline price. Compute and label a labor floor for each skipped billed node as `items × pricePerTask × annotations per item`, using `1` for generation and `overlap` for quorum. Also report `maxEntities`, quality-criteria count, and only exclusions applicable to the authored QA and workflow. Apply accepting a rate does not prove its final billed value.
160
185
 
161
186
  ## Manage model checkpoints
@@ -166,7 +191,7 @@ The global Base Model Catalog is read-only and uses `toloka base-model`. `base-m
166
191
 
167
192
  `toloka training create` requires one source (`--base-model` or `--model-version`) and a training Dataset. A `--model-version` source must be a LoRA adapter Model Version (one produced by fine-tuning) and works for both methods — SFT continues the adapter, gisting merges it and trains gist tokens over it; a full-weights version is rejected with "Training from a Model Version requires a LoRA adapter source". The first Training Run creates a new output Model named after the Training; a source Model Version is only the training parent, never the output binding.
168
193
 
169
- Hyperparameters are optional flags on `training create` and `training update`: `--epochs 1..5` (default 3), `--learning-rate` (SFT 0.00001–0.001, default 0.00015; gisting 0.001–0.3, default 0.03), `--batch-size 8|16|32|64` (default 8; sequences per optimizer step across all GPUs) and `--max-sequence-length 64..16384` (default 12288 for SFT, 3072 for gisting) apply to both methods; `--lora-rank 8|16|32` (default 16) is SFT-only and `--gist-tokens 8|32|64` (default 32) is gisting-only — passing one to the other method fails before any request. `--regime` and `--eval-steps` no longer exist. `training update` has no `--method` flag: the method stays as created, and every flag you omit keeps its current value. `training cost` is blocked when the longest example exceeds `--max-sequence-length` or when the training selection leaves fewer rows than `--batch-size` after the 10% holdout.
194
+ Hyperparameters are optional flags on `training create` and `training update`: `--epochs 1..5` (default 3), `--learning-rate` (SFT 0.00001–0.001, default 0.00015; gisting 0.001–0.3, default 0.03), `--batch-size 8|16|32|64` (default 8; sequences per optimizer step across all GPUs) and `--max-sequence-length 64..16384` (default 12288 for SFT, 3072 for gisting) apply to both methods; `--lora-rank 8|16|32` (default 16) is SFT-only and `--gist-tokens` (default 32) is gisting-only — passing one to the other method fails before any request. `--gist-tokens` takes an absolute count `8|32|64` or a fraction of the prompt being compressed (`1/4`, `1/8`, `1/16`, `1/32`), which the run resolves to `ceil(prompt tokens / N)` clamped to 8..256. `--regime` and `--eval-steps` no longer exist. `training update` has no `--method` flag: the method stays as created, and every flag you omit keeps its current value. `training cost` is blocked when the longest example exceeds `--max-sequence-length` or when the training selection leaves fewer rows than `--batch-size` after the 10% holdout.
170
195
 
171
196
  Use `training cost` to validate inputs and show the maximum charge before `training run`. A blocked estimate exits 1 and lists the issues on stderr instead of printing the estimate; fix them and recalculate. `training run` accepts that ready estimate JSON through `--estimate-file`; without it, the command calculates a fresh ready estimate itself before creating the run. `--version-name` defaults to the Training name; pass it when a Model Version with that name already exists. Use `training status`, `training logs`, `training metrics`, `training resume`, and `training cancel` with the returned Training Run ID. `training metrics` lists each metric's latest value while the run is still training; `--key` prints one metric's point history instead.
172
197
 
@@ -39,10 +39,9 @@ For first-time setup details, read `https://platform.toloka.ai/agents/fine-tunin
39
39
 
40
40
  ### 1. Establish only the context the goal needs
41
41
 
42
- When runtime, authentication, or binding is unknown, inspect it:
42
+ When the CLI, authentication, or binding is unknown, inspect it. The runtime-inclusive standalone CLI is sufficient for Training-only work; no separate Bun or Node.js installation, SDK, TypeScript, or test packages are needed:
43
43
 
44
44
  ```sh
45
- bun --version
46
45
  toloka --version
47
46
  toloka whoami
48
47
  toloka project current
@@ -145,6 +144,8 @@ toloka training metrics <training-run-id> --json
145
144
 
146
145
  Resume only after the user confirms a billing block is resolved. Cancel only on explicit request.
147
146
 
147
+ A run can train longer than the estimate predicted. It stays `running`, the charge stays capped at the approved `maximumCharge`, and the Model Version publishes when training finishes; treat a slow run as still running, not as failed, and do not start a duplicate run for it. A run that ends `failed` with error code `provider_failed` or `provider_timeout` is a platform-side failure: it is charged nothing and the whole hold returns to the team balance, while its reported GPU seconds stay visible; a run the user cancels during training is charged for the GPU seconds used.
148
+
148
149
  For a completed run, verify the observed output and download only when requested:
149
150
 
150
151
  ```sh
@@ -19,10 +19,11 @@ The workflow sequence preserves important dependencies and gates, but it is not
19
19
 
20
20
  ## Prepare missing prerequisites
21
21
 
22
- Check the runtime or CLI only when its state is not already known:
22
+ Check the CLI only when its state is not already known. The installer prefers stable Bun 1.4.0 or newer matching the host architecture; otherwise it installs a standalone executable with its runtime included. Use `sh -s -- --native` or `sh -s -- --bun` on the installer pipe to force a mode. For custom packages or directories, choose the matching mode explicitly. Training-only workflows need no project SDK or test dependencies. For pipeline authoring, Bun is recommended: run `bun i` in an existing project and use `bun add -d` for missing packages.
23
+
24
+ The shell installer supports macOS and Linux on ARM64/x64. The native path requires glibc on Linux, plus `curl`, `tar`, `mktemp`, and either `shasum` or `sha256sum`; compatible Bun can be used on musl. Native Windows packages are not available.
23
25
 
24
26
  ```sh
25
- bun --version
26
27
  toloka --version
27
28
  toloka dataset --help
28
29
  ```
@@ -39,7 +40,7 @@ Never request an API key in chat. Inspect the active identity with:
39
40
  toloka whoami
40
41
  ```
41
42
 
42
- If the reachable account is evidently the intended identity from the request, project, team, or established checkout, continue and report it. Ask a focused question when the identity conflicts with that context or more than one material choice remains. For a missing or rejected key, ask the user to run `toloka login`, then verify `toloka whoami` again. `Rejected:` means the key was refused; `Not reachable:` means the platform did not answer and the key was not evaluated, so fix network access rather than requesting another key; `Platform error:` means the platform failed, so retry later.
43
+ If the reachable account is evidently the intended identity from the request, project, team, or established checkout, continue and report it. Ask a focused question when the identity conflicts with that context or more than one material choice remains. For a missing, expired, or rejected login, run `toloka login --browser` yourself: it opens the sign-in page in the user's browser and waits, so ask the user to finish signing in there, then verify `toloka whoami` again. `Rejected:` means the login was refused; `Not reachable:` means the platform did not answer and the login was not evaluated, so fix network access rather than requesting another sign-in; `Platform error:` means the platform failed, so retry later.
43
44
 
44
45
  Pipeline work needs a source root. Reuse a suitable initialized root when one exists. In a new root, or when the Agent Bootstrap or installed skills genuinely need initialization or refresh, use:
45
46
 
@@ -40,10 +40,9 @@ For first-time setup details, read `https://platform.toloka.ai/agents/gisting.md
40
40
 
41
41
  ### 1. Establish only the context the goal needs
42
42
 
43
- When runtime, authentication, or binding is unknown, inspect it:
43
+ When the CLI, authentication, or binding is unknown, inspect it. The runtime-inclusive standalone CLI is sufficient for Training-only work; no separate Bun or Node.js installation, SDK, TypeScript, or test packages are needed:
44
44
 
45
45
  ```sh
46
- bun --version
47
46
  toloka --version
48
47
  toloka whoami
49
48
  toloka project current
@@ -115,7 +114,7 @@ toloka training create "<training-name>" \
115
114
 
116
115
  Omit `--validation-dataset` when no separate validation selection exists so the provider uses its 10% holdout. For disjoint selections in a Dataset with top-level fields, add `--train-filter <field>=<value>` and `--validation-filter <field>=<value>`.
117
116
 
118
- Preserve requested hyperparameters. The current CLI uses `--gist-tokens 8|32|64` (default 32), `--epochs 1..5` (default 3), `--learning-rate` within 0.001–0.3 (default 0.03), `--batch-size 8|16|32|64` (default 8), and `--max-sequence-length 64..16384` (default 3072), rather than `regime`. Use defaults when suitable; 8 gist tokens favor compression for simple prompts, while 64 may help when 32 loses holdout accuracy. Choose sequence length from actual examples within the supported limit. `--lora-rank` is rejected for gisting. `training update <name-or-id>` takes the same flags except `--method`; omitted flags retain current values.
117
+ Preserve requested hyperparameters. The current CLI uses `--gist-tokens` (default 32), `--epochs 1..5` (default 3), `--learning-rate` within 0.001–0.3 (default 0.03), `--batch-size 8|16|32|64` (default 8), and `--max-sequence-length 64..16384` (default 3072), rather than `regime`. Use defaults when suitable. `--gist-tokens` takes an absolute count `8|32|64` or a fraction of the prompt being compressed — `1/4`, `1/8`, `1/16`, `1/32`. An absolute count fixes the soft-prompt size: 8 favors compression for simple prompts, while 64 may help when 32 loses holdout accuracy. A fraction fixes the compression ratio instead — the run resolves it to `ceil(prompt tokens / N)` and clamps it to 8..256 — so prefer one for a long prompt or a prompt whose length changes between drafts, starting at `1/32`. `training get` reports the fraction you set, not the count it resolved to. Choose sequence length from actual examples within the supported limit. `--lora-rank` is rejected for gisting. `training update <name-or-id>` takes the same flags except `--method`; omitted flags retain current values.
119
118
 
120
119
  Verify the saved method, exact source, prompt file, selections, filters, and configuration with `toloka training get <training-id> --json`.
121
120
 
@@ -154,6 +153,8 @@ toloka training metrics <training-run-id> --json
154
153
 
155
154
  Resume only after the user confirms a billing block is resolved. Cancel only on explicit request.
156
155
 
156
+ A run can train longer than the estimate predicted. It stays `running`, the charge stays capped at the approved `maximumCharge`, and the Model Version publishes when training finishes; treat a slow run as still running, not as failed, and do not start a duplicate run for it. A run that ends `failed` with error code `provider_failed` or `provider_timeout` is a platform-side failure: it is charged nothing and the whole hold returns to the team balance, while its reported GPU seconds stay visible; a run the user cancels during training is charged for the GPU seconds used.
157
+
157
158
  For a completed run, verify the observed output and download only when requested:
158
159
 
159
160
  ```sh
@@ -26,7 +26,7 @@ The CLI exits 1 with `Potato API request failed with status 500`. The same comma
26
26
 
27
27
  ## Environment
28
28
 
29
- - toloka CLI 0.2.0 (`toloka --version`), Bun 1.4.0, macOS 15
29
+ - Toloka CLI: native 0.2.0, build a1b2c3d4e5f6 (`toloka version --json`); macOS 15
30
30
  - Platform: https://platform.toloka.ai
31
31
 
32
32
  ## Redactions
@@ -10,7 +10,10 @@ import {
10
10
  createVirtualTypeScriptEnvironment,
11
11
  } from "./typescript-vfs.js";
12
12
 
13
- const tsLibDirectory = path.dirname(ts.getDefaultLibFilePath({ target: ts.ScriptTarget.Latest }));
13
+ const tsLibDirectory =
14
+ Reflect.get(globalThis, "Bun")?.isStandaloneExecutable === true
15
+ ? path.join(path.dirname(process.argv[1]!), "typescript-lib")
16
+ : path.dirname(ts.getDefaultLibFilePath({ target: ts.ScriptTarget.Latest }));
14
17
 
15
18
  const BLOCK_MARKERS = {
16
19
  data: "DATA_INJECTION",
@@ -93,6 +93,7 @@ const COMMAND_GROUPS: Readonly<Record<string, CommandGroup>> = {
93
93
  },
94
94
  dataset: { list: true, create: true, fields: true, load: true, upload: true },
95
95
  "delivery-order": { list: true },
96
+ audience: { specialization: { list: true } },
96
97
  training: {
97
98
  list: true,
98
99
  get: true,
@@ -0,0 +1,31 @@
1
+ import type { PotatoClient } from "../client";
2
+ import type { Specialization } from "../../openapi/gen/models";
3
+ import { formatTable, type TableIo, writeOutput } from "./table";
4
+
5
+ type AudienceApi = Pick<PotatoClient, "audience">;
6
+
7
+ export const listSpecializations = async (
8
+ client: AudienceApi,
9
+ input: { json: boolean },
10
+ io: TableIo,
11
+ ): Promise<void> => {
12
+ const specializations: Specialization[] = [];
13
+ for await (const specialization of client.audience.specializations.listAll()) {
14
+ specializations.push(specialization);
15
+ }
16
+ writeOutput(
17
+ io,
18
+ input.json,
19
+ specializations,
20
+ specializations.length === 0
21
+ ? "No specializations available."
22
+ : formatTable([
23
+ ["ID", "NAME", "EXPERTS"],
24
+ ...specializations.map((specialization) => [
25
+ specialization.id,
26
+ specialization.name,
27
+ String(specialization.expertsCount),
28
+ ]),
29
+ ]),
30
+ );
31
+ };