@toloka-platform/sdk 0.11.2 → 0.11.4
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 +158 -154
- 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/docs/authoring.md +6 -4
- package/docs/cli.md +30 -11
- package/docs/limitations.md +2 -2
- package/docs/testing.md +4 -2
- package/examples/README.md +11 -0
- package/examples/app-crowdtesting/README.md +41 -0
- package/examples/app-crowdtesting/fields.ts +6 -0
- package/examples/app-crowdtesting/nodes/app-flow-test/node.ts +381 -0
- package/examples/app-crowdtesting/nodes/collection/node.ts +8 -0
- package/examples/app-crowdtesting/pipeline.browser.integration.spec.ts +77 -0
- package/examples/app-crowdtesting/pipeline.ts +17 -0
- package/examples/egocentric-video-collection/README.md +35 -0
- package/examples/egocentric-video-collection/fields.ts +24 -0
- package/examples/egocentric-video-collection/nodes/collection/node.ts +5 -0
- package/examples/egocentric-video-collection/nodes/record-activity/node.ts +760 -0
- package/examples/egocentric-video-collection/pipeline.browser.integration.spec.ts +65 -0
- package/examples/egocentric-video-collection/pipeline.ts +17 -0
- package/examples/product-moderation/README.md +49 -0
- package/examples/product-moderation/fields.ts +37 -0
- package/examples/product-moderation/nodes/collection/node.ts +16 -0
- package/examples/product-moderation/nodes/moderate-product/instruction.ts +77 -0
- package/examples/product-moderation/nodes/moderate-product/node.ts +368 -0
- package/examples/product-moderation/pipeline.browser.integration.spec.ts +48 -0
- package/examples/product-moderation/pipeline.ts +33 -0
- package/examples/video-pair-rating/fields.ts +16 -4
- package/examples/video-pair-rating/nodes/adjudicate/node.ts +78 -3
- package/examples/video-pair-rating/nodes/adjudicate_op/node.ts +28 -3
- package/examples/video-pair-rating/nodes/overall_preference_pick/node.ts +28 -3
- package/examples/video-pair-rating/nodes/rate_pair/node.ts +65 -2
- package/openapi/gen/api.ts +22 -0
- package/openapi/gen/models/generationBudget.ts +8 -0
- package/openapi/gen/models/generationBudgetReasoningEffort.ts +2 -0
- package/openapi/gen/models/generationModel.ts +12 -0
- package/openapi/gen/models/generationModelDefaultReasoningEffort.ts +2 -0
- package/openapi/gen/models/generationModelId.ts +2 -0
- package/openapi/gen/models/index.ts +8 -0
- package/openapi/gen/models/invalidFieldSchema.ts +6 -0
- package/openapi/gen/models/listGenerationModels200.ts +7 -0
- package/openapi/gen/models/listGenerationModels200DefaultGenerationModelId.ts +2 -0
- package/openapi/gen/models/pipelineGraphSnapshot.ts +2 -0
- package/package.json +2 -2
- package/skills/catalog.json +16 -12
- package/skills/toloka-build/SKILL.md +44 -58
- package/skills/toloka-build/references/human-work.md +156 -0
- package/skills/toloka-build/references/local-setup.md +136 -0
- package/skills/toloka-build/references/node-checks.md +11 -0
- package/skills/toloka-build/references/node-semantics.md +22 -213
- package/skills/toloka-build/references/task-ui.md +61 -0
- package/skills/toloka-build/references/workflow-and-cli.md +34 -228
- package/skills/toloka-fine-tuning/SKILL.md +1 -1
- package/skills/toloka-get-started/SKILL.md +1 -1
- package/skills/toloka-gisting/SKILL.md +1 -1
- package/src/authoring/index.ts +26 -7
- package/src/checks/task-ui-typecheck.ts +3 -3
- package/src/cli/analytics.ts +1 -0
- package/src/cli/check.ts +83 -12
- package/src/cli/commands/generation-model.ts +18 -0
- package/src/cli/commands/pipeline.ts +1 -1
- package/src/cli/commands/source.ts +14 -3
- package/src/cli/data.ts +5 -2
- package/src/cli/format-error.ts +3 -0
- package/src/cli/generation-models.ts +46 -0
- package/src/cli/program.ts +2 -0
- package/src/cli/project.ts +288 -138
- package/src/cli/trainings.ts +12 -0
- package/src/cli/ui.ts +3 -1
- package/src/client.ts +5 -0
- package/src/graph-rules.json +11 -0
- package/src/importer.ts +46 -40
- package/src/index.ts +4 -0
- package/src/transport.ts +23 -5
- package/src/validate.ts +183 -0
|
@@ -24,231 +24,53 @@ Treat the three layers differently:
|
|
|
24
24
|
- `toloka.json` is CLI-managed identity state. Read it for orientation; let import and apply write it.
|
|
25
25
|
- Dataset rows and secret values are operational data. Keep them outside committed source.
|
|
26
26
|
|
|
27
|
-
## Initialize the source root
|
|
28
|
-
|
|
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
|
-
|
|
31
|
-
Bun is the recommended runtime and package manager for pipeline authoring. In an existing source root, install its declared dependencies:
|
|
32
|
-
|
|
33
|
-
```sh
|
|
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
|
|
48
|
-
```
|
|
49
|
-
|
|
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.
|
|
51
|
-
|
|
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.
|
|
53
|
-
|
|
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.
|
|
55
|
-
|
|
56
|
-
## Sign in once
|
|
57
|
-
|
|
58
|
-
```sh
|
|
59
|
-
toloka login
|
|
60
|
-
```
|
|
61
|
-
|
|
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_SCOPED_TOKEN`, then `TOLOKA_API_KEY`, then the stored API key,
|
|
77
|
-
then the browser session; CI can use an environment variable without running login. A scoped token is
|
|
78
|
-
minted by the platform for one user and one project (agent sandboxes receive it in `TOLOKA_SCOPED_TOKEN`);
|
|
79
|
-
it cannot issue further tokens and expires on its own. The base URL defaults to the platform.
|
|
80
|
-
|
|
81
|
-
```sh
|
|
82
|
-
toloka auth-status # or toloka whoami
|
|
83
|
-
toloka logout
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
`auth-status` reports which platform and login are in effect and where each came from and exits
|
|
87
|
-
non-zero on failure — use it to check a setup rather than guessing. It masks the credential; `--show-token`
|
|
88
|
-
prints the full API key or the browser session's live access token, so pass it only when a command
|
|
89
|
-
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
|
|
90
|
-
(run `toloka login` again); `Not reachable:` means the platform did not answer, so the login was not
|
|
91
|
-
evaluated (fix network access, do not ask for a new login); `Platform error:` means the platform
|
|
92
|
-
failed (retry later). `logout` ends every stored browser session and deletes the stored files; it does not
|
|
93
|
-
revoke an API key.
|
|
94
|
-
|
|
95
|
-
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.
|
|
96
|
-
|
|
97
|
-
## Hand out a project-scoped token
|
|
98
|
-
|
|
99
|
-
`toloka project token` mints a token that acts as the signed-in user inside the selected project only (`--projects` adds more projects of the same team), with the permissions of `--preset` (default `write`) or an explicit `--permissions` list, for at most six hours. It is printed once and never stored; pass it to another agent or script as `TOLOKA_API_KEY`. `toloka project tokens` lists the live tokens of the project; `toloka project revoke-token <tokenId>` ends one and `toloka project revoke-tokens` ends every live token of the project at once, for example when a run finished or a token leaked. One user may hold at most 1000 live tokens per project; when `token` fails with `429 … revoke unused tokens first`, run `revoke-tokens`.
|
|
100
|
-
|
|
101
|
-
A scoped token downloads project files in two steps: a request to `ProjectFile.url` with the token answers `200 {"url": "<storage URL>"}` instead of the redirect a human credential gets. Fetch that `url` as a plain request without the `X-Scoped-Token` header; HTTP clients replay custom headers across redirects, and the token must never reach the storage host.
|
|
102
|
-
|
|
103
|
-
## Configure the CLI
|
|
104
|
-
|
|
105
|
-
Provide the credential and base URL on networked workflows through `TOLOKA_SCOPED_TOKEN` or
|
|
106
|
-
`TOLOKA_API_KEY` and `TOLOKA_BASE_URL`, or with `--api-key` and `--base-url`. A base URL with a path (a gateway such as
|
|
107
|
-
`https://gateway.example/ss/pp.1`) keeps that path on every request, with or without a trailing
|
|
108
|
-
slash; use the given URL unchanged. The registry-mutating commands
|
|
109
|
-
`toloka project add`, `toloka project switch`, `toloka project remove`, and `toloka project create`
|
|
110
|
-
require `toloka login` first because they read and write the credentials file. When flags or
|
|
111
|
-
`TOLOKA_*` variables are also present, they must identify the same stored key and platform. Resolve
|
|
112
|
-
project ID in this order: `--project-id`, `TOLOKA_PROJECT_ID`, `toloka.json`,
|
|
113
|
-
then the machine registry `current`.
|
|
114
|
-
|
|
115
|
-
Anonymous command telemetry is on by default (`sdk_cli_command_completed` / `sdk_cli_command_failed`). Failed commands with exceptions also emit a sanitized PostHog Error Tracking `$exception`; API failures include the status code and server request ID when available. Raw arguments, messages, stacks, response bodies, and paths are excluded. `toloka report` uses the same PostHog client to send explicitly approved Markdown in `sdk_cli_issue_report_submitted`. Set `TOLOKA_TELEMETRY=0` or `DO_NOT_TRACK=1` to disable all capture; CI is off unless `TOLOKA_TELEMETRY=1`.
|
|
116
|
-
|
|
117
27
|
All commands accept `--source-root <directory>`. Prefer running from the source root so paths and diffs stay obvious. `init` does not walk up: it binds the working directory or `--source-root` only.
|
|
118
28
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
```text
|
|
122
|
-
toloka version [--json]
|
|
123
|
-
toloka -v
|
|
124
|
-
toloka --version
|
|
125
|
-
toloka login [--browser] [--no-browser] [--api-key-stdin]
|
|
126
|
-
toloka logout
|
|
127
|
-
toloka auth-status
|
|
128
|
-
toloka config
|
|
129
|
-
toloka config get [name]
|
|
130
|
-
toloka config set <name> <value>
|
|
131
|
-
toloka project list [--limit <n>]
|
|
132
|
-
toloka project add [alias] [projectId]
|
|
133
|
-
toloka project switch <alias>
|
|
134
|
-
toloka project current
|
|
135
|
-
toloka project url
|
|
136
|
-
toloka project remove <alias>
|
|
137
|
-
toloka project create [alias] [--name <name>] [--team-id <id>] [--delivery-order-id <id>]
|
|
138
|
-
toloka project untrack <pipeline|dataset> <name> [--confirm]
|
|
139
|
-
toloka project token [--preset <name>] [--permissions <list>] [--expires-in <seconds>] [--projects <list>]
|
|
140
|
-
toloka project tokens
|
|
141
|
-
toloka project revoke-token <tokenId>
|
|
142
|
-
toloka project revoke-tokens
|
|
143
|
-
toloka delivery-order list
|
|
144
|
-
toloka audience specialization list [--json]
|
|
145
|
-
toloka init
|
|
146
|
-
toloka import [projectId]
|
|
147
|
-
toloka check [pipeline] [--node <name-or-id>] [--json] [--watch]
|
|
148
|
-
toloka validate
|
|
149
|
-
toloka plan
|
|
150
|
-
toloka apply
|
|
151
|
-
toloka status
|
|
152
|
-
toloka secret set <name> [--from-env <variable>]
|
|
153
|
-
toloka dataset list
|
|
154
|
-
toloka dataset create <name>
|
|
155
|
-
toloka dataset fields <name>
|
|
156
|
-
toloka dataset load <name> --out <file> [--limit <n>] [--timeout <ms>]
|
|
157
|
-
toloka dataset upload <name> <file>
|
|
158
|
-
toloka pipeline list [--limit <n>]
|
|
159
|
-
toloka pipeline run [name] [--wait] [--timeout <ms>]
|
|
160
|
-
toloka pipeline status [name]
|
|
161
|
-
toloka pipeline runs [name] [--limit <n>]
|
|
162
|
-
toloka pipeline cost [name] [--item-limit <n>]
|
|
163
|
-
toloka pipeline results <runId> [--limit <n>] [--failed]
|
|
164
|
-
toloka pipeline cancel <runId>
|
|
165
|
-
toloka base-model list [--json]
|
|
166
|
-
toloka base-model get <id> [--json]
|
|
167
|
-
toloka model list [--json]
|
|
168
|
-
toloka model get <name-or-id> [--json]
|
|
169
|
-
toloka model versions <name-or-id> [--json]
|
|
170
|
-
toloka model create <name> --base <base-model-id> [--description <text>] [--json]
|
|
171
|
-
toloka model archive <name-or-id> [--json]
|
|
172
|
-
toloka training list [--json]
|
|
173
|
-
toloka training get <name-or-id> [--json]
|
|
174
|
-
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]
|
|
175
|
-
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]
|
|
176
|
-
toloka training cost <name-or-id> [--idempotency-key <key>] [--json]
|
|
177
|
-
toloka training run <name-or-id> [--estimate-file <path>] [--version-name <name>] [--idempotency-key <key>] [--json]
|
|
178
|
-
toloka training runs <name-or-id> [--json]
|
|
179
|
-
toloka training status <training-run-id> [--json]
|
|
180
|
-
toloka training resume <training-run-id> [--json]
|
|
181
|
-
toloka training cancel <training-run-id> [--json]
|
|
182
|
-
toloka training logs <training-run-id> [--follow]
|
|
183
|
-
toloka training metrics <training-run-id> [--key <metric>] [--resolution <n>] [--json]
|
|
184
|
-
toloka skill list [--json]
|
|
185
|
-
toloka skill search <query> [--json]
|
|
186
|
-
toloka skill install <skill-id> [--force]
|
|
187
|
-
toloka report <markdown> [--authored-by human|agent] [--confirm]
|
|
188
|
-
```
|
|
29
|
+
## Find commands and catalogs
|
|
189
30
|
|
|
190
|
-
|
|
31
|
+
Run `toloka --help` and `toloka <command> --help` for the exact commands and options of the installed version. The commands fall into these groups:
|
|
191
32
|
|
|
192
|
-
|
|
33
|
+
- sign-in and settings: `login`, `logout`, `auth-status` (`whoami`), `config`, `version`;
|
|
34
|
+
- projects and tokens: `project` (`list`, `add`, `switch`, `current`, `url`, `remove`, `create`, `untrack`, `token`, `tokens`, `revoke-token`, `revoke-tokens`), `delivery-order list`;
|
|
35
|
+
- source reconciliation: `init`, `import`, `check`, `validate`, `plan`, `apply`, `status`, `secret set`;
|
|
36
|
+
- catalogs: `audience specialization list`, `generation-model list`, `ui components`;
|
|
37
|
+
- data and runs: `dataset` (`list`, `create`, `fields`, `load`, `upload`), `pipeline` (`list`, `run`, `status`, `runs`, `cost`, `results`, `cancel`);
|
|
38
|
+
- models and training: `base-model`, `model` (including `model version download`), `training`;
|
|
39
|
+
- skills and reports: `skill` (`list`, `search`, `install`), `report`.
|
|
193
40
|
|
|
194
|
-
`toloka
|
|
41
|
+
`toloka audience specialization list` prints the global specialization catalog: `ID`, `NAME`, and `EXPERTS` columns (`--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.
|
|
195
42
|
|
|
196
|
-
`toloka
|
|
43
|
+
`toloka generation-model list` prints the synthetic generation models: `ID`, `NAME`, the supported `REASONING EFFORT` values with the default marked, and the `TYPICAL`, `MIN` and `MAX` cost of one attempt, followed by `Default model:` and, when there are any, `Recommended:` lines (`--json` adds descriptions). Run it before configuring a synthetic node.
|
|
197
44
|
|
|
198
45
|
`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. If the output lists warnings, include them when you present the forecast.
|
|
199
46
|
|
|
200
47
|
## Manage model checkpoints
|
|
201
48
|
|
|
202
|
-
The global Base Model Catalog is read-only and uses `toloka base-model`. `base-model list` prints aligned ID, name, provider, upstream-model, revision (first 12 characters) and upstream-snapshot URL columns by default; `base-model get` prints the full pinned revision and the `https://huggingface.co/<model>/tree/<revision>` snapshot URL, which is the exact base every Training Run trains on. `toloka model` manages project-owned lineages; creation requires one catalog `baseModelId` and creates metadata without a Model Version. Every Base Model and Model command accepts `--json` for machine-readable output.
|
|
49
|
+
The global Base Model Catalog is read-only and uses `toloka base-model`. `base-model list` prints aligned ID, name, provider, upstream-model, revision (first 12 characters) and upstream-snapshot URL columns by default; `base-model get` prints the full pinned revision and the `https://huggingface.co/<model>/tree/<revision>` snapshot URL, which is the exact base every Training Run trains on. `toloka model` manages project-owned lineages; creation requires one catalog `baseModelId` and creates metadata without a Model Version. Every Base Model and Model command accepts `--json` for machine-readable output. `toloka model version download <model-version> --out <directory>` downloads and verifies a Model Version's content; uploading and validating a Model Version have no command yet.
|
|
203
50
|
|
|
204
51
|
## Train a model
|
|
205
52
|
|
|
206
53
|
`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.
|
|
207
54
|
|
|
208
|
-
Hyperparameters are optional flags on `training create` and `training update
|
|
55
|
+
Hyperparameters are optional flags on `training create` and `training update`; the `toloka-fine-tuning` and `toloka-gisting` skills list their ranges and defaults. `--lora-rank` is SFT-only and `--gist-tokens` gisting-only: passing one to the other method fails before any request. `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.
|
|
209
56
|
|
|
210
57
|
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. `training cancel` before training starts is free; on a run that is already training it stops the GPU job, and the run is charged only for the GPU seconds used until then and produces no Model Version.
|
|
211
58
|
|
|
212
|
-
## Adopt an existing live project
|
|
213
|
-
|
|
214
|
-
1. Install `@toloka-platform/sdk` in the intended source root.
|
|
215
|
-
2. Run `toloka project add <alias> <projectId>`, or `toloka project switch <alias>` when the project is already registered.
|
|
216
|
-
3. Run `toloka import` into the empty source root.
|
|
217
|
-
4. Run `toloka init` to install or refresh the agent entry points without rebinding project identity.
|
|
218
|
-
5. Confirm `toloka.json.projectId` equals `toloka project current`, then run `toloka plan` before editing and require `No changes.`. A non-empty baseline is importer or live-state drift to understand separately from your change.
|
|
219
|
-
6. Inspect every generated `pipelines/**/pipeline.ts` dependency, preserve constructor `id` options that bind source to the existing graph, and make the smallest source change.
|
|
220
|
-
7. Validate offline, plan, apply, and plan again. Never copy imported IDs to unrelated declarations or invent replacements.
|
|
221
|
-
|
|
222
|
-
Import refuses an existing `pipelines/` directory. Pass `--force` to replace it with the live graph as TypeScript. Never use `--force` as a harmless refresh over uncommitted source work.
|
|
223
|
-
|
|
224
|
-
## Author against a project from scratch
|
|
225
|
-
|
|
226
|
-
1. Run `toloka project create <alias>` for a new project, or `toloka project add <alias> <projectId>` for an existing empty project.
|
|
227
|
-
2. Run `toloka init` after creation. For an existing empty project, run `toloka --project-id <projectId> init`. Then require `toloka project current` and `toloka.json` to name the same project.
|
|
228
|
-
3. Create `pipelines/<name>/pipeline.ts` and its imported modules.
|
|
229
|
-
4. Default-export `definePipeline({ dataset, fields, nodes, connections })`.
|
|
230
|
-
5. Add typed node and pipeline-flow tests, then run `toloka check`.
|
|
231
|
-
6. Run `toloka validate`; a not-yet-created pipeline is reported as skipped, not server-validated.
|
|
232
|
-
7. Run `toloka plan` and resolve missing secrets or immutable-field conflicts.
|
|
233
|
-
8. Run `toloka apply`; it reruns `toloka check` before any platform write.
|
|
234
|
-
9. Require a final `toloka plan` to print `No changes.`
|
|
235
|
-
|
|
236
|
-
On first apply, the CLI creates each missing named dataset, adds fields required by the authored graphs, creates each missing pipeline, attaches its dataset, and records the resolved IDs. Two pipelines that name the same dataset contribute the union of their required fields.
|
|
237
|
-
|
|
238
59
|
## Check locally and validate against the platform
|
|
239
60
|
|
|
240
61
|
Run the complete local gate first, then validate every bound pipeline remotely:
|
|
241
62
|
|
|
242
63
|
```sh
|
|
243
64
|
toloka check
|
|
244
|
-
toloka validate
|
|
65
|
+
toloka validate # before apply
|
|
66
|
+
toloka validate --wait # after apply: waits for the platform's lints
|
|
245
67
|
```
|
|
246
68
|
|
|
247
|
-
`toloka check` requires no credentials or live pipeline.
|
|
69
|
+
`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.
|
|
248
70
|
|
|
249
71
|
With `--watch --json`, each completed rerun writes one JSON line. Do not start another watcher while one is active.
|
|
250
72
|
|
|
251
|
-
`toloka validate` posts each authored graph to the platform
|
|
73
|
+
`toloka validate` posts each authored graph to the platform without writing it; the status table in SKILL.md lists what each result means and when to use `--wait`. Distinguish source/spec errors, which require source changes, from check state and warnings. When plan adds a dataset field used by an already-live pipeline, pre-apply validation can report that exact field as `misconfigured_node_form_component` because the column is not live yet. Treat it as expected only when the reviewed plan adds the same field, then require post-apply validation to clear the source/spec error.
|
|
252
74
|
|
|
253
75
|
The authored API still supplies extra local safety:
|
|
254
76
|
|
|
@@ -257,11 +79,11 @@ The authored API still supplies extra local safety:
|
|
|
257
79
|
- It rejects a `connect()` endpoint whose node is absent from `nodes`.
|
|
258
80
|
- Typed ports prevent reversing input and output handles.
|
|
259
81
|
|
|
260
|
-
`toloka apply` runs the full
|
|
82
|
+
`toloka apply` runs the full local gate, `toloka check`, again before resolving credentials or writing platform state. Plan compares source with live resources but does not submit the desired graph for acceptance. Apply can still expose graph-wide references, layout identity, or concurrent-version assumptions that only the backend owns.
|
|
261
83
|
|
|
262
84
|
## Read and apply a plan
|
|
263
85
|
|
|
264
|
-
Treat every plan line as evidence of what apply will attempt.
|
|
86
|
+
Treat every plan line as evidence of what apply will attempt. `toloka plan --json` prints the same plan as `{ "changes": [...], "missingSecrets": [...] }`, where each change has `kind`, `action`, `label`, and, when they apply, `pipeline`, `dataset`, and `id`.
|
|
265
87
|
|
|
266
88
|
- Confirm additions and changes match the request.
|
|
267
89
|
- Stop on an unexpected removal. Apply refuses to delete tracked pipelines or datasets merely because their source entry disappeared.
|
|
@@ -269,21 +91,9 @@ Treat every plan line as evidence of what apply will attempt.
|
|
|
269
91
|
- Set every secret listed as missing before apply.
|
|
270
92
|
- If imported source contains live IDs, preserve them while editing around them.
|
|
271
93
|
|
|
272
|
-
Apply preserves existing
|
|
273
|
-
|
|
274
|
-
## Test pipeline nodes locally
|
|
275
|
-
|
|
276
|
-
Register every code-node behavior with `test.code(pipeline, node, name, callback)`. Its callback receives a bound `run(inputs, options?)` helper with the same Python execution contract as `runCodeNode`; the test counts only after the bound executor runs, an assertion executes, and the callback passes.
|
|
94
|
+
Apply preserves the canvas position of existing nodes and the root's live item filter. Do not add either to authored source; SKILL.md says where the server places new nodes. For graph replacement, apply reads the live graph version and sends it as `expectedVersion`; never put a version in source or state yourself.
|
|
277
95
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
Register representative connected flows with `test.pipeline(pipeline, name, callback)`. Choose fixtures from available data that exercise the task, redacting sensitive values while preserving field names, nesting, optionality, and media/value shapes. Use synthetic cases for privacy or boundaries absent from the sample. Use the callback's bound `runCode` and `renderUi` helpers, merge only declared node outputs, and assert the final `root.completed` fields. Cover meaningful match branches, optional routes, and failures as well as the happy path.
|
|
281
|
-
|
|
282
|
-
```sh
|
|
283
|
-
toloka check
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
Plain Vitest tests still run and can fail the command, but only typed Toloka wrappers satisfy required node and pipeline coverage. Use synthetic or redacted data. `preprocess` and `postprocess` remain runtime JavaScript function bodies, not TypeScript.
|
|
96
|
+
On first apply, the CLI creates each missing named dataset, adds fields required by the authored graphs, creates each missing pipeline, attaches its dataset, and records the resolved IDs. Two pipelines that name the same dataset contribute the union of their required fields.
|
|
287
97
|
|
|
288
98
|
## Add dataset rows
|
|
289
99
|
|
|
@@ -295,7 +105,9 @@ toloka dataset upload <dataset> <file>
|
|
|
295
105
|
|
|
296
106
|
The upload file path resolves from the command process's working directory, not from `--source-root`. Use an absolute path when the command runs elsewhere.
|
|
297
107
|
|
|
298
|
-
The CLI infers the input format from its extension and uploads the original bytes without conversion: `.json` is an array of row objects, `.jsonl` has one object per non-empty line, and `.csv` uses its header row as field names with every value ingested as a string. JSONL is validated locally before upload. If transfer or finalization fails, the CLI cancels the started upload before returning the error, so another upload can start immediately and may reuse the same filename. The dataset does not have to exist yet: when a pipeline in source binds it, upload creates it and declares that pipeline's columns, so rows land in real columns rather than in the raw `uploaded` blob.
|
|
108
|
+
The CLI infers the input format from its extension and uploads the original bytes without conversion: `.json` is an array of row objects, `.jsonl` has one object per non-empty line, and `.csv` uses its header row as field names with every value ingested as a string. JSONL is validated locally before upload. If transfer or finalization fails, the CLI cancels the started upload before returning the error, so another upload can start immediately and may reuse the same filename. The dataset does not have to exist yet: when a pipeline in source binds it, upload creates it and declares that pipeline's columns, so rows land in real columns rather than in the raw `uploaded` blob. When the dataset does not exist and no pipeline in source declares it, upload refuses, because it would have no column names to map onto; an existing dataset accepts the upload either way. An id-shaped argument is never created; upload fails when that dataset id does not exist in the project. Upload appends items; applying source never deletes them.
|
|
109
|
+
|
|
110
|
+
After the upload the CLI prints the field types it inferred from the rows. They describe the rows, not the dataset's columns: inference omits enum, length, range, and format constraints, while the columns keep the schemas declared in source. Never edit `field()` declarations to match that list; `toloka plan` is what compares source with the live columns.
|
|
299
111
|
|
|
300
112
|
If a later upload fails with a schema-incompatibility error, inspect the inferred schema from the first successful upload:
|
|
301
113
|
|
|
@@ -303,7 +115,7 @@ If a later upload fails with a schema-incompatibility error, inspect the inferre
|
|
|
303
115
|
toloka dataset fields <dataset>
|
|
304
116
|
```
|
|
305
117
|
|
|
306
|
-
That prints `field()` declarations for the top-level
|
|
118
|
+
That prints the same inferred types as `field()` declarations for the top-level columns. Use them to recover stored names and base types, never to replace stricter source schemas. The command does not write source or mutate the dataset.
|
|
307
119
|
|
|
308
120
|
Keep item files outside the source tree or gitignored. Never embed sample or production rows in `pipeline.ts` to make reconciliation create them.
|
|
309
121
|
|
|
@@ -311,7 +123,7 @@ Pull live rows with `toloka dataset load <name> --out <file> [--limit <n>]`. `--
|
|
|
311
123
|
|
|
312
124
|
## Run a pipeline and report results
|
|
313
125
|
|
|
314
|
-
A run needs
|
|
126
|
+
A run needs an applied pipeline. Apply any requested source changes and verify convergence first; an already-applied unchanged pipeline does not need another apply. SKILL.md covers cost approval, exit codes, and bounded monitoring. The commands below are available operations, not a sequence that requires starting or canceling a run.
|
|
315
127
|
|
|
316
128
|
```sh
|
|
317
129
|
toloka pipeline run <name> --wait --timeout 900000
|
|
@@ -322,20 +134,10 @@ toloka pipeline results <runId> --failed
|
|
|
322
134
|
toloka pipeline cancel <runId>
|
|
323
135
|
```
|
|
324
136
|
|
|
325
|
-
Read the exit code, not just the text. `toloka pipeline run --wait` exits `0` when the run reaches a successful terminal state, `1` when it reaches a failed one, and `2` when the wait window elapses while the run is still going. Without `--wait` the command returns as soon as the run is accepted, and exit `0` means "accepted", not "succeeded".
|
|
326
|
-
|
|
327
|
-
A started run is not a finished one. Choose a bounded monitoring window appropriate to the task, then report observed counts and states even if work is still in progress. Continue with another bounded check when useful; do not promise an automatic later update unless a reporting mechanism actually exists.
|
|
328
|
-
|
|
329
137
|
`toloka pipeline runs` lists ids and timestamps. `toloka pipeline status` reports the latest run. `toloka status` (no prefix) is project health. When a listing is capped it says so; report the cap rather than presenting a page as the whole picture.
|
|
330
138
|
|
|
331
139
|
A failed item carries an error, so `toloka pipeline results <runId> --failed` is the fastest path to why a run failed. Report counts and states from that output rather than inferring them from the run having started.
|
|
332
140
|
|
|
333
|
-
## Work on more than one project
|
|
334
|
-
|
|
335
|
-
`toloka.json` records exactly one `projectId`, so one checkout targets one project. To drive a second project from the same source — a copy for another customer, or a staging and a production instance — do not overwrite the state file in place. Use a separate checkout, or pass `--project-id` explicitly and keep the state files apart. Overwriting the recorded id silently repoints every later `plan` and `apply` at the wrong project.
|
|
336
|
-
|
|
337
|
-
Create a second live project with `toloka project create <alias>` or register an existing one with `toloka project add <alias> <projectId>`. After a copy, prove the original is untouched by planning against it and seeing no changes.
|
|
338
|
-
|
|
339
141
|
## Set a secret
|
|
340
142
|
|
|
341
143
|
Reference a secret name from a code node's `envVars`, then provide its value separately:
|
|
@@ -352,13 +154,17 @@ Without `--from-env`, `toloka secret set <name>` reads the value from stdin. Nev
|
|
|
352
154
|
|
|
353
155
|
### Field schema conflict
|
|
354
156
|
|
|
355
|
-
Do not rename the live field in place, delete it, or retry apply. Keep the existing field untouched and either:
|
|
157
|
+
Dataset fields are immutable after creation: they can be added, never altered or removed. Do not rename the live field in place, delete it, or retry apply. Keep the existing field untouched and either:
|
|
356
158
|
|
|
357
159
|
1. declare a differently named `field()` with the new schema and migrate downstream node references, or
|
|
358
160
|
2. change `definePipeline({ dataset })` to a new dataset name.
|
|
359
161
|
|
|
360
162
|
Plan again and inspect the full rebind or new-column diff before applying.
|
|
361
163
|
|
|
164
|
+
### Unreadable field schema
|
|
165
|
+
|
|
166
|
+
`toloka import` writes a field whose stored JSON Schema is not valid JSON or not a supported schema as `invalidJsonSchema({ field, reason, text })`, and every command that loads the source fails on it. Replace the call with a valid JSON Schema object, keeping what the stored `text` meant when it is clear and asking the user when it is not, then plan and apply: the apply writes the schema and repairs the field.
|
|
167
|
+
|
|
362
168
|
### Missing secret
|
|
363
169
|
|
|
364
170
|
Use the exact name reported by plan. Set it with `toloka secret set`, rerun plan, and apply only when no secret is marked missing.
|
|
@@ -373,8 +179,8 @@ Object settings preserve omitted live keys, but list-valued settings such as con
|
|
|
373
179
|
|
|
374
180
|
### Server 400 after a clean validate
|
|
375
181
|
|
|
376
|
-
A new pipeline is skipped by `toloka validate` until it exists remotely, and apply can create its dataset and fields before pipeline import returns a 400. Fix the reported path or reason, then run plan again. If only the pipeline addition remains, continue from that diff; do not recreate or rename resources already created. Check connection endpoints, duplicate or unknown imported IDs, field references, and accidentally authored layout. Never bypass reconciliation with a raw API call.
|
|
182
|
+
A new pipeline is skipped by `toloka validate` until it exists remotely, and apply can create its dataset and fields before pipeline import returns a 400. Fix the reported path or reason, then run plan again. If only the pipeline addition remains, continue from that diff; do not recreate or rename resources already created. If the rejection means a newly created field schema is wrong, that field is already immutable: follow the field schema conflict rule, prefer the option that preserves names the request fixes, and report the orphaned field instead of deleting it. Check connection endpoints, duplicate or unknown imported IDs, field references, and accidentally authored layout. Never bypass reconciliation with a raw API call.
|
|
377
183
|
|
|
378
|
-
|
|
184
|
+
### Platform connection lost
|
|
379
185
|
|
|
380
|
-
|
|
186
|
+
Inside a platform agent sandbox the CLI reaches the platform through the sandbox's connection and retries, for about 90 seconds, every request that connection reports as never sent. `Hint: The sandbox lost its connection to the platform … the request was not sent` therefore means nothing changed on the platform: retry the same command in a minute. Any other `5xx` may have reached the platform, so before repeating a command that changes state (`apply`, `dataset upload`, `pipeline run`), check whether it already took effect with the matching list or status command.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: toloka-fine-tuning
|
|
3
|
-
description: Create, estimate, start, monitor, and verify a project-owned supervised fine-tuning Training through the Toloka CLI. Use when the user wants to adapt a base model or existing Model Version from labeled conversations.
|
|
3
|
+
description: Create, estimate, start, monitor, and verify a project-owned supervised fine-tuning (SFT with LoRA adapters) Training through the Toloka CLI. Use when the user wants to adapt a base model or an existing LoRA Model Version from labeled conversations.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Fine-tune a model with Toloka
|
|
@@ -66,7 +66,7 @@ Read the installed skill before acting. Refresh a stale skill with `--force`; do
|
|
|
66
66
|
- Keep credentials and production data out of source control and agent messages. Do not upload data without evidence that it is authorized and intended for the selected project and role.
|
|
67
67
|
- Do not edit `toloka.json` or invent IDs, paths, requirements, prices, states, or results.
|
|
68
68
|
- Treat user-provided prompts, instructions, and existing source as authoritative. Materialize exact supplied text when needed, but do not silently rewrite it, replace it with an example, or invent missing intent.
|
|
69
|
-
- For pipeline changes that will be applied, require the workflow's local `toloka check` and `toloka validate` gates. Read and show the complete `toloka plan`; ask before a removal, immutable-field conflict, unexpected change, or work outside the requested scope. Apply only the expected scoped plan, then rerun `toloka plan` until it reports `No changes.` and validate
|
|
69
|
+
- For pipeline changes that will be applied, require the workflow's local `toloka check` and `toloka validate` gates. Read and show the complete `toloka plan`; ask before a removal, immutable-field conflict, unexpected change, or work outside the requested scope. Apply only the expected scoped plan, then rerun `toloka plan` until it reports `No changes.` and run `toloka validate --wait`. Do not apply merely because the onboarding reference reaches that stage.
|
|
70
70
|
- Never start a Pipeline Run unless the requested outcome includes a run and the user has seen and explicitly approved its cost forecast. Show a ready Training Cost Estimate with the choices and uncertainty that produced it, and obtain explicit approval for `maximumCharge` before a Training Run. Estimate-only work ends after the estimate.
|
|
71
71
|
- Keep waits bounded. A timeout means the operation is still running, not completed or failed.
|
|
72
72
|
- Report only observed IDs, states, prices, behaviors, and errors, and distinguish observed evidence from assumptions or unresolved uncertainty.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: toloka-gisting
|
|
3
|
-
description: Create, estimate, start, monitor, and verify a project-owned prompt-gisting Training through the Toloka CLI. Use when the user wants a compact prompt
|
|
3
|
+
description: Create, estimate, start, monitor, and verify a project-owned prompt-gisting Training through the Toloka CLI, which learns soft prompt tokens that stand in for a long static system prompt. Use when the user wants a compact or cheaper replacement for a fixed prompt, learned from example conversations and the prompt file.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Compress a prompt with gisting
|
package/src/authoring/index.ts
CHANGED
|
@@ -240,20 +240,20 @@ export type UnboundPipelineGraphV1 = {
|
|
|
240
240
|
};
|
|
241
241
|
|
|
242
242
|
export type PipelineDefinitionInput<DatasetName extends string = string> = {
|
|
243
|
-
readonly dataset
|
|
243
|
+
readonly dataset?: DatasetName;
|
|
244
244
|
readonly fields: ReadonlyArray<Field>;
|
|
245
245
|
readonly nodes: ReadonlyArray<PipelineNode>;
|
|
246
246
|
readonly connections: ReadonlyArray<Connection>;
|
|
247
247
|
};
|
|
248
248
|
|
|
249
249
|
export type PipelineDefinition<DatasetName extends string = string> = {
|
|
250
|
-
readonly dataset
|
|
250
|
+
readonly dataset?: DatasetName;
|
|
251
251
|
readonly graph: UnboundPipelineGraphV1;
|
|
252
252
|
readonly [PIPELINE_DEFINITION]: true;
|
|
253
253
|
};
|
|
254
254
|
|
|
255
255
|
export type PipelineDefinitionBindings = {
|
|
256
|
-
readonly datasetId
|
|
256
|
+
readonly datasetId?: string;
|
|
257
257
|
};
|
|
258
258
|
|
|
259
259
|
function hash(value: string): string {
|
|
@@ -447,6 +447,18 @@ export function field<const Name extends string>(
|
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
449
|
|
|
450
|
+
export type InvalidJsonSchemaSource = {
|
|
451
|
+
readonly field: string;
|
|
452
|
+
readonly reason: string;
|
|
453
|
+
readonly text: string;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
export function invalidJsonSchema(source: InvalidJsonSchemaSource): never {
|
|
457
|
+
throw new Error(
|
|
458
|
+
`Field "${source.field}" has an unreadable JSON Schema on the platform. ${source.reason} Its stored text is in fields.ts as invalidJsonSchema({ text }); replace that call with a valid JSON Schema object for the field.`,
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
|
|
450
462
|
export function optional(referencedField: Field): OptionalFieldBinding {
|
|
451
463
|
return { field: referencedField, optional: true };
|
|
452
464
|
}
|
|
@@ -547,6 +559,7 @@ export function match(
|
|
|
547
559
|
...wireSettings,
|
|
548
560
|
conditions: conditions.map((condition) => ({
|
|
549
561
|
...condition,
|
|
562
|
+
logic: condition.logic ?? "and",
|
|
550
563
|
predicates: condition.predicates.map(({ field: referencedField, ...predicate }) => ({
|
|
551
564
|
...predicate,
|
|
552
565
|
fieldProxyId: referencedField.id,
|
|
@@ -610,7 +623,7 @@ export function connect(
|
|
|
610
623
|
export function definePipeline<const DatasetName extends string>(
|
|
611
624
|
definition: PipelineDefinitionInput<DatasetName>,
|
|
612
625
|
): PipelineDefinition<DatasetName> {
|
|
613
|
-
assert(definition.dataset
|
|
626
|
+
assert(definition.dataset !== "", "Dataset name must not be empty");
|
|
614
627
|
const declaredFields = new Set(definition.fields);
|
|
615
628
|
const declaredFieldIds = new Set<string>();
|
|
616
629
|
for (const declaredField of definition.fields) {
|
|
@@ -645,7 +658,7 @@ export function definePipeline<const DatasetName extends string>(
|
|
|
645
658
|
}
|
|
646
659
|
|
|
647
660
|
return {
|
|
648
|
-
dataset: definition.dataset,
|
|
661
|
+
...(definition.dataset === undefined ? {} : { dataset: definition.dataset }),
|
|
649
662
|
[PIPELINE_DEFINITION]: true,
|
|
650
663
|
graph: {
|
|
651
664
|
version: 1,
|
|
@@ -682,7 +695,7 @@ export function validatePipelineDefinition(value: unknown): asserts value is Pip
|
|
|
682
695
|
isPipelineDefinition(value),
|
|
683
696
|
"Invalid pipeline definition: expected a value returned by definePipeline",
|
|
684
697
|
);
|
|
685
|
-
assert(value.dataset
|
|
698
|
+
assert(value.dataset !== "", "Dataset name must not be empty");
|
|
686
699
|
for (const node of value.graph.nodes) {
|
|
687
700
|
if (node.type !== "root") continue;
|
|
688
701
|
assert(
|
|
@@ -706,7 +719,13 @@ export function resolvePipelineDefinition(
|
|
|
706
719
|
fields: definition.graph.fields.map((fieldDefinition) => ({ ...fieldDefinition })),
|
|
707
720
|
nodes: definition.graph.nodes.map((node) =>
|
|
708
721
|
node.type === "root"
|
|
709
|
-
? {
|
|
722
|
+
? {
|
|
723
|
+
...node,
|
|
724
|
+
settings: {
|
|
725
|
+
...node.settings,
|
|
726
|
+
...(bindings.datasetId === undefined ? {} : { datasetId: bindings.datasetId }),
|
|
727
|
+
},
|
|
728
|
+
}
|
|
710
729
|
: node,
|
|
711
730
|
),
|
|
712
731
|
connections: definition.graph.connections.map((connection) => ({
|
|
@@ -70,7 +70,7 @@ ${input.data}
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
declare global {
|
|
73
|
-
const
|
|
73
|
+
const taskUiConstantsForCodeOnly: /* CONST_INJECTION_START */
|
|
74
74
|
(
|
|
75
75
|
${input.constants}
|
|
76
76
|
)
|
|
@@ -89,11 +89,11 @@ ${input.postprocess}
|
|
|
89
89
|
}
|
|
90
90
|
/* POSTPROCESS_INJECTION_END */ )()
|
|
91
91
|
|
|
92
|
-
/* CODE_INJECTION_START */
|
|
92
|
+
((CONST: typeof taskUiConstantsForCodeOnly) => /* CODE_INJECTION_START */
|
|
93
93
|
(
|
|
94
94
|
${input.code}
|
|
95
95
|
)
|
|
96
|
-
/* CODE_INJECTION_END */
|
|
96
|
+
/* CODE_INJECTION_END */ )
|
|
97
97
|
|
|
98
98
|
export {}`;
|
|
99
99
|
|