@toloka-platform/sdk 0.11.0 → 0.11.1
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/README.md +2 -0
- package/dist/cli/toloka.js +68 -68
- 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/package.json +2 -2
- package/skills/catalog.json +6 -6
- package/skills/toloka-build/references/workflow-and-cli.md +3 -1
- package/src/transport.ts +10 -1
package/dist/cli/toloka.js.jsc
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
6a0f8dbdd98f49a9c663bb3051960c4f168961bc4ebd8b428ae75fd5f07ba994 toloka.js.jsc
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
20b4b75534617c8aed19bf129f8b78fe18d43a5a91221f1aa4bf2fbc0f792175 toloka.js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toloka-platform/sdk",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Build, inspect, and operate Toloka pipeline projects as TypeScript source. The public API may change between minor versions before 1.0.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -77,6 +77,6 @@
|
|
|
77
77
|
"bun": ">=1.4.0"
|
|
78
78
|
},
|
|
79
79
|
"tolokaBuild": {
|
|
80
|
-
"commit": "
|
|
80
|
+
"commit": "62d9c4558758f7409b65de7c849c8a2e8d15ba9a"
|
|
81
81
|
}
|
|
82
82
|
}
|
package/skills/catalog.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"testing",
|
|
12
12
|
"checks"
|
|
13
13
|
],
|
|
14
|
-
"version": "0.11.
|
|
15
|
-
"digest": "
|
|
14
|
+
"version": "0.11.1",
|
|
15
|
+
"digest": "79283e8ca89ddafa3d6206be108db32046f6941fb52d4b622aec72c20b791de7",
|
|
16
16
|
"files": [
|
|
17
17
|
"SKILL.md",
|
|
18
18
|
"references/node-semantics.md",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"bug",
|
|
30
30
|
"report"
|
|
31
31
|
],
|
|
32
|
-
"version": "0.11.
|
|
32
|
+
"version": "0.11.1",
|
|
33
33
|
"digest": "70f0bd2c80b32f87896aeb27c363b8a2d37f40e22424f57fe1aad142e125ad67",
|
|
34
34
|
"files": [
|
|
35
35
|
"SKILL.md",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"getting-started",
|
|
47
47
|
"agent"
|
|
48
48
|
],
|
|
49
|
-
"version": "0.11.
|
|
49
|
+
"version": "0.11.1",
|
|
50
50
|
"digest": "ccf148c682de4e452bb031db95d3933257899006b1766f0fdbc3d15265a63bb9",
|
|
51
51
|
"files": [
|
|
52
52
|
"SKILL.md"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"sft",
|
|
64
64
|
"models"
|
|
65
65
|
],
|
|
66
|
-
"version": "0.11.
|
|
66
|
+
"version": "0.11.1",
|
|
67
67
|
"digest": "279c69977eef170dada20b664ee0c30858681e84a2cabb2fdff18b8bb1bdc055",
|
|
68
68
|
"files": [
|
|
69
69
|
"SKILL.md"
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"prompt",
|
|
81
81
|
"models"
|
|
82
82
|
],
|
|
83
|
-
"version": "0.11.
|
|
83
|
+
"version": "0.11.1",
|
|
84
84
|
"digest": "b9f314eb6b39754bc8d2ae79aca3dc680fced5f14948c975d1e084a83c2e0a8c",
|
|
85
85
|
"files": [
|
|
86
86
|
"SKILL.md"
|
|
@@ -101,7 +101,9 @@ A scoped token downloads project files in two steps: a request to `ProjectFile.u
|
|
|
101
101
|
## Configure the CLI
|
|
102
102
|
|
|
103
103
|
Provide the API key and base URL on networked workflows through `TOLOKA_API_KEY` and
|
|
104
|
-
`TOLOKA_BASE_URL`, or with `--api-key` and `--base-url`.
|
|
104
|
+
`TOLOKA_BASE_URL`, or with `--api-key` and `--base-url`. A base URL with a path (a gateway such as
|
|
105
|
+
`https://gateway.example/ss/pp.1`) keeps that path on every request, with or without a trailing
|
|
106
|
+
slash; use the given URL unchanged. The registry-mutating commands
|
|
105
107
|
`toloka project add`, `toloka project switch`, `toloka project remove`, and `toloka project create`
|
|
106
108
|
require `toloka login` first because they read and write the credentials file. When flags or
|
|
107
109
|
`TOLOKA_*` variables are also present, they must identify the same stored key and platform. Resolve
|
package/src/transport.ts
CHANGED
|
@@ -47,6 +47,15 @@ const prepareRequestInit = (requestOptions: RequestInit, headers: Headers): Requ
|
|
|
47
47
|
return { ...requestOptions, headers, body: "{}" };
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
+
// The generated client passes absolute paths (`/api/v2-beta/...`), and `new URL(path, base)` resolves
|
|
51
|
+
// those against the base's origin, dropping its path. Join them instead, so a base URL served under a
|
|
52
|
+
// path prefix (a gateway in front of the platform) keeps that prefix.
|
|
53
|
+
const resolveRequestUrl = (url: string, baseUrl: string): URL => {
|
|
54
|
+
if (!url.startsWith("/") || url.startsWith("//")) return new URL(url, baseUrl);
|
|
55
|
+
const base = new URL(baseUrl);
|
|
56
|
+
return new URL(`${base.pathname.replace(/\/+$/, "")}${url}`, base.origin);
|
|
57
|
+
};
|
|
58
|
+
|
|
50
59
|
export function potatoFetch<T>(url: string, options: TransportRequestInit): Promise<T>;
|
|
51
60
|
export async function potatoFetch(url: string, options: TransportRequestInit): Promise<unknown> {
|
|
52
61
|
const { fetch: fetchImplementation = globalThis.fetch, authorization, ...requestOptions } = options;
|
|
@@ -57,7 +66,7 @@ export async function potatoFetch(url: string, options: TransportRequestInit): P
|
|
|
57
66
|
if (authorization !== undefined) headers.set("Authorization", await authorization());
|
|
58
67
|
|
|
59
68
|
const response = await fetchImplementation(
|
|
60
|
-
|
|
69
|
+
resolveRequestUrl(url, baseUrl),
|
|
61
70
|
prepareRequestInit(requestOptions, headers),
|
|
62
71
|
);
|
|
63
72
|
const text = await response.text();
|