@toloka-platform/sdk 0.1.0-preview.8 → 0.1.0-preview.9
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 +115 -115
- 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/limitations.md +1 -1
- package/package.json +1 -1
- package/skills/catalog.json +3 -3
- package/skills/toloka-report-issue/references/report-template.md +1 -1
- package/src/checks/task-ui-typecheck.ts +1 -2
- package/src/cli/auto-update.ts +2 -2
- package/src/cli/check.ts +3 -4
- package/src/cli/cli-entry.ts +41 -0
- package/src/cli/skill.ts +4 -5
package/dist/cli/toloka.js.jsc
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
92bbe68b3e86c7e0a8d7d66dfc8277f682402c5513db4a58844ba6173975afd1 toloka.js.jsc
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
16b1b42414dbde194d20e05efb359538bae80906bba75e1af3e0b8638a82ec43 toloka.js
|
package/docs/limitations.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
What this Preview SDK does not do yet, stated plainly so you can decide what to depend on.
|
|
4
4
|
|
|
5
|
-
`@toloka-platform/sdk` is `0.1.0-preview.
|
|
5
|
+
`@toloka-platform/sdk` is `0.1.0-preview.9`. This is a Preview: the authoring API, the CLI surface, and the generated source layout can change without a major version bump. 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toloka-platform/sdk",
|
|
3
|
-
"version": "0.1.0-preview.
|
|
3
|
+
"version": "0.1.0-preview.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Preview. Build, inspect, and operate Toloka pipeline projects as TypeScript source. The public API may change.",
|
|
6
6
|
"license": "Apache-2.0",
|
package/skills/catalog.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"testing",
|
|
14
14
|
"checks"
|
|
15
15
|
],
|
|
16
|
-
"version": "0.1.0-preview.
|
|
16
|
+
"version": "0.1.0-preview.9",
|
|
17
17
|
"digest": "87dca7b1cc0cf3d61f54ab27703ea4b60622355ec07e289ce1242bb3c2233482",
|
|
18
18
|
"files": ["SKILL.md", "references/node-semantics.md", "references/workflow-and-cli.md"]
|
|
19
19
|
},
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"name": "Report a Toloka problem",
|
|
23
23
|
"description": "Report a problem with the Toloka platform, CLI, or SDK as a redacted Markdown issue report sent through the toloka CLI only after explicit approval. Use when the user hits unexpected behavior, an error, or a bug and wants Toloka engineers to investigate.",
|
|
24
24
|
"tags": ["support", "issue", "bug", "report"],
|
|
25
|
-
"version": "0.1.0-preview.
|
|
26
|
-
"digest": "
|
|
25
|
+
"version": "0.1.0-preview.9",
|
|
26
|
+
"digest": "6fb8ccf80b346de0745bb7d9192e4e3998cb8f06c8b30f7eb6dcc5b326f4646d",
|
|
27
27
|
"files": ["SKILL.md", "references/report-template.md"]
|
|
28
28
|
}
|
|
29
29
|
]
|
|
@@ -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.1.0-preview.
|
|
29
|
+
- toloka CLI 0.1.0-preview.9 (`toloka --version`), Bun 1.4.0, macOS 15
|
|
30
30
|
- Platform: https://platform.toloka.ai
|
|
31
31
|
|
|
32
32
|
## Redactions
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
|
|
4
3
|
import { assert } from "es-toolkit";
|
|
@@ -11,7 +10,7 @@ import {
|
|
|
11
10
|
createVirtualTypeScriptEnvironment,
|
|
12
11
|
} from "./typescript-vfs.js";
|
|
13
12
|
|
|
14
|
-
const tsLibDirectory = path.dirname(
|
|
13
|
+
const tsLibDirectory = path.dirname(ts.getDefaultLibFilePath({ target: ts.ScriptTarget.Latest }));
|
|
15
14
|
|
|
16
15
|
const BLOCK_MARKERS = {
|
|
17
16
|
data: "DATA_INJECTION",
|
package/src/cli/auto-update.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { once } from "node:events";
|
|
|
3
3
|
import { realpathSync } from "node:fs";
|
|
4
4
|
import { chmod, readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
import { join, sep } from "node:path";
|
|
6
|
-
import {
|
|
6
|
+
import { findCliEntry } from "./cli-entry";
|
|
7
7
|
import type { CliEnvironment } from "./credentials";
|
|
8
8
|
import { configDirectory, preparePrivateFilePath } from "./credentials";
|
|
9
9
|
import { SDK_VERSION } from "./init";
|
|
@@ -172,7 +172,7 @@ const BUN_GLOBAL_MARKER = `${sep}install${sep}global${sep}`;
|
|
|
172
172
|
|
|
173
173
|
export const isGlobalCliInstall = (
|
|
174
174
|
entry = process.argv[1],
|
|
175
|
-
runtimePath =
|
|
175
|
+
runtimePath = findCliEntry(),
|
|
176
176
|
): boolean =>
|
|
177
177
|
[entry, runtimePath].some((path) => {
|
|
178
178
|
if (typeof path !== "string") return false;
|
package/src/cli/check.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { watch } from "node:fs";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { once } from "node:events";
|
|
5
5
|
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
7
7
|
import { dirname, join } from "node:path";
|
|
8
|
-
import { fileURLToPath } from "node:url";
|
|
9
8
|
|
|
10
9
|
import { assert } from "es-toolkit";
|
|
11
10
|
import {
|
|
@@ -25,6 +24,7 @@ import {
|
|
|
25
24
|
type TestEvidence,
|
|
26
25
|
type TestEvidenceKind,
|
|
27
26
|
} from "../testing/test-evidence";
|
|
27
|
+
import { resolveCliEntry } from "./cli-entry";
|
|
28
28
|
import { loadProjectSource, type ProjectSource } from "./source";
|
|
29
29
|
|
|
30
30
|
export type CheckStatus = "passed" | "failed" | "missing" | "partial" | "infrastructure_error";
|
|
@@ -866,8 +866,7 @@ const parseFreshCheckResult = (value: unknown, json: boolean): CheckProjectResul
|
|
|
866
866
|
};
|
|
867
867
|
};
|
|
868
868
|
export const runFreshCheck = async (options: CheckProjectOptions): Promise<CheckProjectResult> => {
|
|
869
|
-
const
|
|
870
|
-
const entry = existsSync(sourceEntry) ? sourceEntry : fileURLToPath(import.meta.url);
|
|
869
|
+
const entry = resolveCliEntry();
|
|
871
870
|
const resultDirectory = await mkdtemp(join(tmpdir(), "toloka-check-watch-result-"));
|
|
872
871
|
const resultPath = join(resultDirectory, "result.json");
|
|
873
872
|
let run: ToolRunResult | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { assert } from "es-toolkit";
|
|
2
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
|
|
5
|
+
const CLI_ENTRY = join("bin", "toloka.js");
|
|
6
|
+
|
|
7
|
+
const runtimePath = (entry: string): string => {
|
|
8
|
+
try {
|
|
9
|
+
return realpathSync(entry);
|
|
10
|
+
} catch {
|
|
11
|
+
return entry;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const findCliEntryAbove = (directory: string): string | undefined => {
|
|
16
|
+
const candidate = join(directory, CLI_ENTRY);
|
|
17
|
+
if (existsSync(candidate)) return candidate;
|
|
18
|
+
const parent = dirname(directory);
|
|
19
|
+
return parent === directory ? undefined : findCliEntryAbove(parent);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const findCliEntry = (
|
|
23
|
+
runtimeEntry: string | undefined = process.argv[1],
|
|
24
|
+
): string | undefined => {
|
|
25
|
+
const fromRuntimeEntry =
|
|
26
|
+
runtimeEntry === undefined ? undefined : findCliEntryAbove(dirname(runtimePath(runtimeEntry)));
|
|
27
|
+
return fromRuntimeEntry ?? findCliEntryAbove(process.cwd());
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const resolveCliEntry = (runtimeEntry: string | undefined = process.argv[1]): string => {
|
|
31
|
+
const entry = runtimeEntry === undefined ? undefined : runtimePath(runtimeEntry);
|
|
32
|
+
if (entry !== undefined && existsSync(entry) && findCliEntryAbove(dirname(entry)) !== undefined) {
|
|
33
|
+
return entry;
|
|
34
|
+
}
|
|
35
|
+
const workingDirectoryEntry = findCliEntryAbove(process.cwd());
|
|
36
|
+
assert(
|
|
37
|
+
workingDirectoryEntry !== undefined,
|
|
38
|
+
`Cannot locate the toloka CLI entry point. An installed @toloka-platform/sdk ships ${CLI_ENTRY} in a directory above its runtime entry, but none exists above ${runtimeEntry ?? "the unset process.argv[1]"} or above ${process.cwd()}. Reinstall @toloka-platform/sdk.`,
|
|
39
|
+
);
|
|
40
|
+
return workingDirectoryEntry;
|
|
41
|
+
};
|
package/src/cli/skill.ts
CHANGED
|
@@ -2,11 +2,9 @@ import { assert } from "es-toolkit";
|
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { copyFile, mkdir, mkdtemp, readFile, realpath, rename, rm, stat } from "node:fs/promises";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
5
|
import { assertSafeDestination, entryStats, hasErrorCode } from "./file-system";
|
|
7
6
|
import { formatCliError } from "./format-error";
|
|
8
7
|
|
|
9
|
-
export const BUNDLED_SKILL_CATALOG_ROOT = fileURLToPath(new URL("../../skills", import.meta.url));
|
|
10
8
|
export const SKILL_CATALOG_MANIFEST = "catalog.json";
|
|
11
9
|
export const SKILL_INSTALL_ROOT = ".agents/skills";
|
|
12
10
|
export const SKILL_ENTRY_POINT = "SKILL.md";
|
|
@@ -133,15 +131,16 @@ export async function resolveBundledSkillCatalogRoot(
|
|
|
133
131
|
const runtimeRoot =
|
|
134
132
|
entry === undefined ? undefined : await findSkillCatalogRootAbove(dirname(entry));
|
|
135
133
|
if (runtimeRoot !== undefined) return runtimeRoot;
|
|
134
|
+
const workingDirectoryRoot = await findSkillCatalogRootAbove(process.cwd());
|
|
136
135
|
const searched =
|
|
137
136
|
entry === undefined
|
|
138
137
|
? "process.argv[1] names no runtime entry"
|
|
139
138
|
: `none exists between ${entry} and the filesystem root`;
|
|
140
139
|
assert(
|
|
141
|
-
|
|
142
|
-
`Cannot locate the bundled skill catalog. An installed @toloka-platform/sdk must ship ${SKILL_CATALOG_DIRECTORY}/${SKILL_CATALOG_MANIFEST} in a directory above its runtime entry, but ${searched}, and
|
|
140
|
+
workingDirectoryRoot !== undefined,
|
|
141
|
+
`Cannot locate the bundled skill catalog. An installed @toloka-platform/sdk must ship ${SKILL_CATALOG_DIRECTORY}/${SKILL_CATALOG_MANIFEST} in a directory above its runtime entry, but ${searched}, and no ${SKILL_CATALOG_DIRECTORY}/${SKILL_CATALOG_MANIFEST} exists above ${process.cwd()} either. Reinstall @toloka-platform/sdk.`,
|
|
143
142
|
);
|
|
144
|
-
return
|
|
143
|
+
return workingDirectoryRoot;
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
const loadBundledSkillCatalog = async (): Promise<SkillCatalog> =>
|