@apify/actors-mcp-server 0.18.4-beta.4 → 0.18.5-beta.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.
- package/README.md +5 -2
- package/dist/const.d.ts +7 -4
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +8 -4
- package/dist/const.js.map +1 -1
- package/dist/index_internals.d.ts +2 -0
- package/dist/index_internals.d.ts.map +1 -1
- package/dist/test_kit/cases/versions.cases.d.ts +3 -0
- package/dist/test_kit/cases/versions.cases.d.ts.map +1 -0
- package/dist/test_kit/cases/versions.cases.js +509 -0
- package/dist/test_kit/cases/versions.cases.js.map +1 -0
- package/dist/test_kit/helpers.d.ts +1 -1
- package/dist/test_kit/helpers.d.ts.map +1 -1
- package/dist/test_kit/helpers.js +1 -1
- package/dist/test_kit/helpers.js.map +1 -1
- package/dist/test_kit/index.d.ts +1 -0
- package/dist/test_kit/index.d.ts.map +1 -1
- package/dist/test_kit/index.js +3 -0
- package/dist/test_kit/index.js.map +1 -1
- package/dist/test_kit/tsconfig.tsbuildinfo +1 -1
- package/dist/tools/builds/build_actor.d.ts.map +1 -1
- package/dist/tools/builds/build_actor.js +9 -4
- package/dist/tools/builds/build_actor.js.map +1 -1
- package/dist/tools/builds/get_actor_build_list.d.ts.map +1 -1
- package/dist/tools/builds/get_actor_build_list.js +5 -3
- package/dist/tools/builds/get_actor_build_list.js.map +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +4 -2
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/runs/get_actor_run_list.d.ts.map +1 -1
- package/dist/tools/runs/get_actor_run_list.js +5 -3
- package/dist/tools/runs/get_actor_run_list.js.map +1 -1
- package/dist/tools/schedules/schedule_helpers.d.ts.map +1 -1
- package/dist/tools/schedules/schedule_helpers.js +2 -1
- package/dist/tools/schedules/schedule_helpers.js.map +1 -1
- package/dist/tools/schedules/update_schedule.js +1 -1
- package/dist/tools/schedules/update_schedule.js.map +1 -1
- package/dist/tools/structured_output_schemas.d.ts +180 -0
- package/dist/tools/structured_output_schemas.d.ts.map +1 -1
- package/dist/tools/structured_output_schemas.js +59 -0
- package/dist/tools/structured_output_schemas.js.map +1 -1
- package/dist/tools/tasks/create_actor_task.d.ts.map +1 -1
- package/dist/tools/tasks/create_actor_task.js +2 -1
- package/dist/tools/tasks/create_actor_task.js.map +1 -1
- package/dist/tools/tasks/task_helpers.d.ts +0 -16
- package/dist/tools/tasks/task_helpers.d.ts.map +1 -1
- package/dist/tools/tasks/task_helpers.js +1 -31
- package/dist/tools/tasks/task_helpers.js.map +1 -1
- package/dist/tools/tasks/update_actor_task.d.ts.map +1 -1
- package/dist/tools/tasks/update_actor_task.js +2 -1
- package/dist/tools/tasks/update_actor_task.js.map +1 -1
- package/dist/tools/versions/create_actor.d.ts +11 -0
- package/dist/tools/versions/create_actor.d.ts.map +1 -0
- package/dist/tools/versions/create_actor.js +171 -0
- package/dist/tools/versions/create_actor.js.map +1 -0
- package/dist/tools/versions/get_actor_version.d.ts.map +1 -0
- package/dist/tools/{source → versions}/get_actor_version.js +5 -88
- package/dist/tools/versions/get_actor_version.js.map +1 -0
- package/dist/tools/{source → versions}/source_files.d.ts +6 -2
- package/dist/tools/versions/source_files.d.ts.map +1 -0
- package/dist/tools/{source → versions}/source_files.js +7 -7
- package/dist/tools/versions/source_files.js.map +1 -0
- package/dist/tools/versions/source_helpers.d.ts +107 -0
- package/dist/tools/versions/source_helpers.d.ts.map +1 -0
- package/dist/tools/versions/source_helpers.js +350 -0
- package/dist/tools/versions/source_helpers.js.map +1 -0
- package/dist/tools/versions/update_actor_version.d.ts +15 -0
- package/dist/tools/versions/update_actor_version.d.ts.map +1 -0
- package/dist/tools/versions/update_actor_version.js +447 -0
- package/dist/tools/versions/update_actor_version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/apify_resource_id.d.ts +18 -0
- package/dist/utils/apify_resource_id.d.ts.map +1 -0
- package/dist/utils/apify_resource_id.js +33 -0
- package/dist/utils/apify_resource_id.js.map +1 -0
- package/dist/utils/tools_loader.d.ts +2 -1
- package/dist/utils/tools_loader.d.ts.map +1 -1
- package/dist/utils/tools_loader.js +3 -2
- package/dist/utils/tools_loader.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/server.json +1 -1
- package/dist/tools/source/get_actor_version.d.ts.map +0 -1
- package/dist/tools/source/get_actor_version.js.map +0 -1
- package/dist/tools/source/source_files.d.ts.map +0 -1
- package/dist/tools/source/source_files.js.map +0 -1
- /package/dist/tools/{source → versions}/get_actor_version.d.ts +0 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
import { ActorSourceType, ApifyApiError } from 'apify-client';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { UserInputError } from '../../errors.js';
|
|
5
|
+
import { REDACTED } from '../../resources/api_resources.js';
|
|
6
|
+
import { getResourceByIdOrName } from '../../utils/apify_resource_id.js';
|
|
7
|
+
import { getConsoleLinkContext } from '../../utils/console_link.js';
|
|
8
|
+
import { logHttpError } from '../../utils/logging.js';
|
|
9
|
+
import { respondAborted, respondUserError } from '../../utils/mcp.js';
|
|
10
|
+
import { isRecord } from '../api/apify_api_spec.js';
|
|
11
|
+
import { buildNextStepForBuild, listVersionNumbers, respondWithBuild, toBuildResult } from '../builds/build_helpers.js';
|
|
12
|
+
import { hasBinaryExtension } from './source_files.js';
|
|
13
|
+
/** The input shape of one file sent whole. */
|
|
14
|
+
export const sourceFileArgs = z.object({
|
|
15
|
+
path: z.string().min(1).describe('Path relative to the Actor root, for example src/main.js.'),
|
|
16
|
+
content: z.string().describe('The whole file content: text as is, or base64 when encoding is base64.'),
|
|
17
|
+
encoding: z
|
|
18
|
+
.enum(['utf8', 'base64'])
|
|
19
|
+
.optional()
|
|
20
|
+
.describe('utf8 for text, base64 for binary files. Defaults to base64 for binary extensions such as .png and to utf8 otherwise.'),
|
|
21
|
+
});
|
|
22
|
+
/** `keys` of `record` that are set: a string, number, or boolean as is, any other value as `REDACTED`. */
|
|
23
|
+
function pickLoggedValues(record, keys) {
|
|
24
|
+
return Object.fromEntries(keys.flatMap((key) => {
|
|
25
|
+
const value = record[key];
|
|
26
|
+
if (value === undefined)
|
|
27
|
+
return [];
|
|
28
|
+
return [[key, ['string', 'number', 'boolean'].includes(typeof value) ? value : REDACTED]];
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
/** `keys` of `record` that are set, each as `REDACTED`. */
|
|
32
|
+
function maskLoggedValues(record, keys) {
|
|
33
|
+
return Object.fromEntries(keys.filter((key) => record[key] !== undefined).map((key) => [key, REDACTED]));
|
|
34
|
+
}
|
|
35
|
+
/** The logged copy of an entry's edits, each with its oldText and newText as `REDACTED`. */
|
|
36
|
+
function redactEdits(edits) {
|
|
37
|
+
if (!Array.isArray(edits))
|
|
38
|
+
return REDACTED;
|
|
39
|
+
return edits.map((textEdit) => isRecord(textEdit) ? maskLoggedValues(textEdit, ['oldText', 'newText']) : REDACTED);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The logged copy of a source tool's arguments (`redactArgs`), built as an allowlist: `keys`, and each entry of the
|
|
43
|
+
* list under `listKey` with its `entryKeys`, and with its content and its edits' oldText and newText as `REDACTED`.
|
|
44
|
+
* File content can hold secrets, such as an API key written into the code.
|
|
45
|
+
*/
|
|
46
|
+
export function redactSourceToolArgs(args, fields) {
|
|
47
|
+
const { keys, listKey, entryKeys } = fields;
|
|
48
|
+
const redactEntry = (entry) => {
|
|
49
|
+
if (!isRecord(entry))
|
|
50
|
+
return REDACTED;
|
|
51
|
+
const { edits } = entry;
|
|
52
|
+
return {
|
|
53
|
+
...pickLoggedValues(entry, entryKeys),
|
|
54
|
+
...maskLoggedValues(entry, ['content']),
|
|
55
|
+
...(edits !== undefined && { edits: redactEdits(edits) }),
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const list = args[listKey];
|
|
59
|
+
return {
|
|
60
|
+
...pickLoggedValues(args, keys),
|
|
61
|
+
...(list !== undefined && { [listKey]: Array.isArray(list) ? list.map(redactEntry) : REDACTED }),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The Actor by its ID, its name (resolved against the token's own Actors), or its full name, `username/name` or
|
|
66
|
+
* `username~name` (apify-client turns username/name into the API's username~name); throws `UserInputError` when there
|
|
67
|
+
* is none.
|
|
68
|
+
*/
|
|
69
|
+
export async function fetchActor(client, actorSelector) {
|
|
70
|
+
const actor = await getResourceByIdOrName(actorSelector, async (safeId) => client.actor(safeId).get());
|
|
71
|
+
// Extra path segments, such as username/name/runs/last, reach a sub-resource that is not an Actor.
|
|
72
|
+
if (!actor || typeof actor.name !== 'string' || typeof actor.username !== 'string') {
|
|
73
|
+
throw new UserInputError(`Actor '${actorSelector}' not found. The actor argument takes an ID, a name (resolved against your own Actors), or a full name as username/name.`);
|
|
74
|
+
}
|
|
75
|
+
return { actor, fullName: `${actor.username}/${actor.name}` };
|
|
76
|
+
}
|
|
77
|
+
/** The requested version, or the only one when none is requested; throws `UserInputError` otherwise. */
|
|
78
|
+
export function resolveVersion(actor, requestedVersionNumber, actorSelector) {
|
|
79
|
+
const versionNumbers = listVersionNumbers(actor);
|
|
80
|
+
// AJV turns a null versionNumber into an empty string, which no version has, so it counts as not given.
|
|
81
|
+
const requested = requestedVersionNumber || undefined;
|
|
82
|
+
if (requested === undefined && versionNumbers.length !== 1) {
|
|
83
|
+
// The source type and build tag tell the caller which version holds the code it is after.
|
|
84
|
+
const versions = actor.versions
|
|
85
|
+
.filter((version) => version.versionNumber !== undefined)
|
|
86
|
+
.map(({ versionNumber, sourceType, buildTag }) => {
|
|
87
|
+
const tag = buildTag ? `, build tag ${buildTag}` : '';
|
|
88
|
+
return `${versionNumber} (${sourceType}${tag})`;
|
|
89
|
+
});
|
|
90
|
+
throw new UserInputError(`Specify versionNumber; this Actor has versions: ${versions.join(', ')}.`);
|
|
91
|
+
}
|
|
92
|
+
const versionNumber = requested !== null && requested !== void 0 ? requested : versionNumbers[0];
|
|
93
|
+
const version = actor.versions.find((candidate) => candidate.versionNumber === versionNumber);
|
|
94
|
+
if (!version) {
|
|
95
|
+
throw new UserInputError(`Actor '${actorSelector}' has no version ${versionNumber}; available versions: ${versionNumbers.join(', ')}.`);
|
|
96
|
+
}
|
|
97
|
+
return { ...version, versionNumber };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The URL without what can grant access to it: the query string, the password, and, for http and https, the user. An
|
|
101
|
+
* SSH user such as `git@` is not a secret and stays. A URL the parser cannot read, such as
|
|
102
|
+
* `git@github.com:user/repo.git`, loses only its query string.
|
|
103
|
+
*/
|
|
104
|
+
function formatUrlWithoutSecrets(url) {
|
|
105
|
+
if (URL.canParse(url)) {
|
|
106
|
+
const parsed = new URL(url);
|
|
107
|
+
parsed.search = '';
|
|
108
|
+
parsed.password = '';
|
|
109
|
+
if (parsed.protocol === 'http:' || parsed.protocol === 'https:') {
|
|
110
|
+
parsed.username = '';
|
|
111
|
+
}
|
|
112
|
+
return parsed.href;
|
|
113
|
+
}
|
|
114
|
+
const queryIndex = url.indexOf('?');
|
|
115
|
+
if (queryIndex === -1)
|
|
116
|
+
return url;
|
|
117
|
+
const hashIndex = url.indexOf('#', queryIndex);
|
|
118
|
+
return url.slice(0, queryIndex) + (hashIndex === -1 ? '' : url.slice(hashIndex));
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Why a version not stored as files is refused, and what to use instead. A version keeps the URL fields of a source
|
|
122
|
+
* type it used before, so only the URL of its current type is named.
|
|
123
|
+
*/
|
|
124
|
+
function formatSourceTypeRefusal(version, versionLabel) {
|
|
125
|
+
if (version.sourceType === ActorSourceType.GitRepo) {
|
|
126
|
+
const url = version.gitRepoUrl ? ` ${formatUrlWithoutSecrets(version.gitRepoUrl)}` : '';
|
|
127
|
+
return `${versionLabel} has its files in the Git repository${url}, not stored on Apify, so this tool cannot work on them; use the repository.`;
|
|
128
|
+
}
|
|
129
|
+
if (version.sourceType === ActorSourceType.GitHubGist) {
|
|
130
|
+
const url = version.gitHubGistUrl ? ` ${formatUrlWithoutSecrets(version.gitHubGistUrl)}` : '';
|
|
131
|
+
return `${versionLabel} has its files in the GitHub gist${url}, not stored on Apify, so this tool cannot work on them; use the gist.`;
|
|
132
|
+
}
|
|
133
|
+
// TODO(#1452): Read and write zip-stored (TARBALL) versions with adm-zip 0.6.1 or later, within the download and
|
|
134
|
+
// unpacking limits the issue lists.
|
|
135
|
+
if (version.sourceType === ActorSourceType.Tarball) {
|
|
136
|
+
return `${versionLabel} is stored as a zip archive (apify push does this for sources over 3 MiB), and this tool cannot work on zip-stored versions yet.`;
|
|
137
|
+
}
|
|
138
|
+
// The API's legacy SOURCE_CODE type and any type added later are not in apify-client's enum.
|
|
139
|
+
const { sourceType } = version;
|
|
140
|
+
return `${versionLabel} has source type ${sourceType}, which this tool cannot work on; only versions stored as files are supported.`;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The version's stored entries, folders included. Throws `UserInputError` for a version not stored as files and for
|
|
144
|
+
* one whose source the API hides.
|
|
145
|
+
*/
|
|
146
|
+
export function extractSourceFiles(version, versionLabel) {
|
|
147
|
+
if (version.sourceType !== ActorSourceType.SourceFiles) {
|
|
148
|
+
throw new UserInputError(formatSourceTypeRefusal(version, versionLabel));
|
|
149
|
+
}
|
|
150
|
+
// The API returns only the number, type, and build tag of a version whose source it hides from this account.
|
|
151
|
+
if (!version.sourceFiles) {
|
|
152
|
+
throw new UserInputError(`${versionLabel} came back without its source: the API hides it from accounts that cannot modify the Actor. Ask the Actor's owner for the source.`);
|
|
153
|
+
}
|
|
154
|
+
return version.sourceFiles;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The entry to store for a file sent whole: TEXT for utf8, BASE64 for base64, where no encoding means base64 for a
|
|
158
|
+
* binary extension, the rule get-actor-version reads by. The path is normalized the way get-actor-version lists it.
|
|
159
|
+
*/
|
|
160
|
+
export function buildSourceFileEntry({ path, content, encoding, }) {
|
|
161
|
+
const isBase64 = (encoding !== null && encoding !== void 0 ? encoding : (hasBinaryExtension(path) ? 'base64' : 'utf8')) === 'base64';
|
|
162
|
+
return { name: posix.normalize(path), format: isBase64 ? 'BASE64' : 'TEXT', content };
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Base64 that decodes to its bytes without loss: Node and the build worker skip characters they cannot decode and stop
|
|
166
|
+
* at padding, so text sent as base64 would be stored as other bytes. Line breaks, missing padding, and the URL-safe
|
|
167
|
+
* alphabet decode without loss.
|
|
168
|
+
*/
|
|
169
|
+
function isBase64(content) {
|
|
170
|
+
const compact = content.replace(/\s/g, '').replace(/-/g, '+').replace(/_/g, '/');
|
|
171
|
+
return Buffer.from(compact, 'base64').toString('base64').replace(/=+$/, '') === compact.replace(/=+$/, '');
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Throws `UserInputError` for content the stored file would not hold as sent: base64 that does not decode without
|
|
175
|
+
* loss, and text with a lone UTF-16 surrogate, which UTF-8 stores as U+FFFD.
|
|
176
|
+
*/
|
|
177
|
+
export function validateFileContent({ format, content }, label) {
|
|
178
|
+
if (format === 'BASE64' && !isBase64(content)) {
|
|
179
|
+
throw new UserInputError(`${label} has content that is not valid base64; encoding base64 takes binary content as base64, and text takes encoding utf8.`);
|
|
180
|
+
}
|
|
181
|
+
if (format === 'TEXT' && !content.isWellFormed()) {
|
|
182
|
+
throw new UserInputError(`${label} has text with a lone UTF-16 surrogate, which UTF-8 cannot store.`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Throws `UserInputError` for a path with a control character, U+0000 to U+001F or U+007F, or with a lone UTF-16
|
|
187
|
+
* surrogate. The build writes the files to disk, where a file name cannot hold NUL, and UTF-8 stores a lone surrogate
|
|
188
|
+
* as U+FFFD.
|
|
189
|
+
*/
|
|
190
|
+
export function validatePathCharacters(path, label) {
|
|
191
|
+
if (!path.isWellFormed()) {
|
|
192
|
+
throw new UserInputError(`${label} has a lone UTF-16 surrogate in its path, which UTF-8 cannot store.`);
|
|
193
|
+
}
|
|
194
|
+
const character = [...path].find((char) => char <= '\u001f' || char === '\u007f');
|
|
195
|
+
if (character === undefined)
|
|
196
|
+
return;
|
|
197
|
+
const codePoint = `U+${character.charCodeAt(0).toString(16).toUpperCase().padStart(4, '0')}`;
|
|
198
|
+
throw new UserInputError(`${label} has the control character ${codePoint} in its path; a path cannot hold characters U+0000 to U+001F or U+007F.`);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Throws `UserInputError` for a normalized path no file can be written at. The build worker refuses a version with a
|
|
202
|
+
* path outside the Actor root, so every build of it would fail; `.` and a path ending in a slash name a folder. A
|
|
203
|
+
* backslash is refused too: the build takes it as part of the file name, so src\main.js would land in the Actor root.
|
|
204
|
+
*/
|
|
205
|
+
export function validateFilePath(path, label) {
|
|
206
|
+
if (path.includes('\\')) {
|
|
207
|
+
throw new UserInputError(`${label} has a backslash in its path; paths use / as the separator.`);
|
|
208
|
+
}
|
|
209
|
+
if (path.startsWith('/') || path === '..' || path.startsWith('../')) {
|
|
210
|
+
throw new UserInputError(`${label} has a path outside the Actor root; paths are relative to it, such as src/main.js.`);
|
|
211
|
+
}
|
|
212
|
+
if (path === '.' || path.endsWith('/')) {
|
|
213
|
+
throw new UserInputError(`${label} has a path that names a folder, not a file.`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/** The folders above a file, outermost first: `a` and `a/b` for `a/b/c.js`. */
|
|
217
|
+
function listFolders(path) {
|
|
218
|
+
const folders = [];
|
|
219
|
+
for (let slashIndex = path.indexOf('/'); slashIndex !== -1; slashIndex = path.indexOf('/', slashIndex + 1)) {
|
|
220
|
+
folders.push(path.slice(0, slashIndex));
|
|
221
|
+
}
|
|
222
|
+
return folders;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The paths of a version's files and folder entries, to check where a new file can go: one path cannot be both a file
|
|
226
|
+
* and a folder, and the build worker fails to write such a file. Each check and change looks up only the folders of
|
|
227
|
+
* its path, since comparing each file with every other took 8 s for 20,000 files.
|
|
228
|
+
*/
|
|
229
|
+
export class SourcePathIndex {
|
|
230
|
+
constructor(filePaths, folderPaths = []) {
|
|
231
|
+
Object.defineProperty(this, "filePaths", {
|
|
232
|
+
enumerable: true,
|
|
233
|
+
configurable: true,
|
|
234
|
+
writable: true,
|
|
235
|
+
value: new Set()
|
|
236
|
+
});
|
|
237
|
+
/** The files under each folder, at any depth, in the order they were added. */
|
|
238
|
+
Object.defineProperty(this, "filePathsByFolder", {
|
|
239
|
+
enumerable: true,
|
|
240
|
+
configurable: true,
|
|
241
|
+
writable: true,
|
|
242
|
+
value: new Map()
|
|
243
|
+
});
|
|
244
|
+
Object.defineProperty(this, "folderPaths", {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
configurable: true,
|
|
247
|
+
writable: true,
|
|
248
|
+
value: void 0
|
|
249
|
+
});
|
|
250
|
+
this.folderPaths = folderPaths;
|
|
251
|
+
for (const path of filePaths)
|
|
252
|
+
this.addFile(path);
|
|
253
|
+
}
|
|
254
|
+
hasFile(path) {
|
|
255
|
+
return this.filePaths.has(path);
|
|
256
|
+
}
|
|
257
|
+
/** A file added again keeps its place in the order. */
|
|
258
|
+
addFile(path) {
|
|
259
|
+
var _a;
|
|
260
|
+
this.filePaths.add(path);
|
|
261
|
+
for (const folder of listFolders(path)) {
|
|
262
|
+
this.filePathsByFolder.set(folder, ((_a = this.filePathsByFolder.get(folder)) !== null && _a !== void 0 ? _a : new Set()).add(path));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
deleteFile(path) {
|
|
266
|
+
var _a;
|
|
267
|
+
this.filePaths.delete(path);
|
|
268
|
+
for (const folder of listFolders(path))
|
|
269
|
+
(_a = this.filePathsByFolder.get(folder)) === null || _a === void 0 ? void 0 : _a.delete(path);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Throws `UserInputError` when a new file at `path` collides with another file or folder: a file at a folder of
|
|
273
|
+
* `path`, or else the first file added under `path`, or else the first folder entry at or under `path`. A file at
|
|
274
|
+
* `path` itself is for the caller to check.
|
|
275
|
+
*/
|
|
276
|
+
validateNewFilePath(path, label) {
|
|
277
|
+
var _a, _b, _c;
|
|
278
|
+
const collision = (_c = (_a = listFolders(path).find((folder) => this.filePaths.has(folder))) !== null && _a !== void 0 ? _a : (_b = this.filePathsByFolder.get(path)) === null || _b === void 0 ? void 0 : _b.values().next().value) !== null && _c !== void 0 ? _c : this.folderPaths.find((folderPath) => folderPath === path || folderPath.startsWith(`${path}/`));
|
|
279
|
+
if (collision === undefined)
|
|
280
|
+
return;
|
|
281
|
+
throw new UserInputError(`${label} collides with ${collision}; one path cannot be both a file and a folder.`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/** The build worker skips a file whose content is empty, so the caller hears of such files. */
|
|
285
|
+
export function buildEmptyFilesWarnings(paths) {
|
|
286
|
+
if (paths.length === 0)
|
|
287
|
+
return {};
|
|
288
|
+
const warning = `These files are empty, and the build skips empty files, so they will not exist in the build: ${paths.join(', ')}.`;
|
|
289
|
+
return { warnings: [warning] };
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Starts a build of the version after a committed write, with no tag so the version's buildTag applies, and does not
|
|
293
|
+
* wait for it. The write stands either way, so a failed start is returned as `buildError` rather than thrown: a caller
|
|
294
|
+
* told the call failed would retry writes that were saved. A cancel that arrives before the start starts no build.
|
|
295
|
+
*/
|
|
296
|
+
async function startBuildAfterWrite(toolArgs, target) {
|
|
297
|
+
const { apifyClient: client, apifyToken, signal } = toolArgs;
|
|
298
|
+
try {
|
|
299
|
+
// Resolved before the start, so a failed lookup leaves no build behind.
|
|
300
|
+
const linkContext = await getConsoleLinkContext(apifyToken, client);
|
|
301
|
+
// Per the MCP spec a cancelled request gets no response; the write stands.
|
|
302
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted)
|
|
303
|
+
return { aborted: true };
|
|
304
|
+
// Started without the request's signal: a committed write never aborts the build it started.
|
|
305
|
+
const build = await client.actor(target.actorId).build(target.versionNumber, { useCache: true });
|
|
306
|
+
return { build, linkContext };
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
// The API's refusal is the caller's to read; anything else, such as a network failure, is logged too.
|
|
310
|
+
if (!(error instanceof ApifyApiError))
|
|
311
|
+
logHttpError(error, 'Failed to start a build after a source write', target);
|
|
312
|
+
return { buildError: error instanceof Error ? error.message : String(error) };
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* The response to a committed write. With autoBuild, a build of the version starts first; a cancel that arrives before
|
|
317
|
+
* the start gets the cancelled-call response.
|
|
318
|
+
*/
|
|
319
|
+
export async function respondAfterWrite(params) {
|
|
320
|
+
const { toolArgs, autoBuild, target, structuredContent, summary } = params;
|
|
321
|
+
if (!autoBuild) {
|
|
322
|
+
return respondWithBuild({
|
|
323
|
+
structuredContent,
|
|
324
|
+
summary,
|
|
325
|
+
nextStep: 'No build was started; runs use these files only after the version is built.',
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
const started = await startBuildAfterWrite(toolArgs, target);
|
|
329
|
+
if ('aborted' in started)
|
|
330
|
+
return respondAborted();
|
|
331
|
+
if ('buildError' in started) {
|
|
332
|
+
return respondWithBuild({
|
|
333
|
+
structuredContent: { ...structuredContent, buildError: started.buildError },
|
|
334
|
+
summary,
|
|
335
|
+
nextStep: 'The build could not be started; runs use these files only after the version is built.',
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
return respondWithBuild({
|
|
339
|
+
structuredContent: { ...structuredContent, build: toBuildResult(started.build, started.linkContext) },
|
|
340
|
+
summary,
|
|
341
|
+
nextStep: buildNextStepForBuild(started.build, { loadedToolNames: toolArgs.loadedToolNames }),
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/** A `UserInputError` as a soft failure; anything else is rethrown for the tool-call engine to report. */
|
|
345
|
+
export function respondToSourceToolError(error) {
|
|
346
|
+
if (error instanceof UserInputError)
|
|
347
|
+
return respondUserError(error.message);
|
|
348
|
+
throw error;
|
|
349
|
+
}
|
|
350
|
+
//# sourceMappingURL=source_helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source_helpers.js","sourceRoot":"","sources":["../../../src/tools/versions/source_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACxH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,2DAA2D,CAAC;IAC7F,O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AAC;IACD,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7D,IAAI,SAAS,IAAI,OAAO;QAAE,OAAO,cAAc,EAAE,CAAC;IAClD,IAAI,YAAY,IAAI,OAAO,EAAE,CAAC;QAC1B,OAAO,gBAAgB,CAAC;YACpB,iBAAiB,EAAE,EAAE,GAAG,iBAAiB,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;YAC3E,OAAO;YACP,QAAQ,EAAE,uFAAuF;SACpG,CAAC,CAAC;IACP,CAAC;IACD,OAAO,gBAAgB,CAAC;QACpB,iBAAiB,EAAE,EAAE,GAAG,iBAAiB,EAAE,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE;QACrG,OAAO;QACP,QAAQ,EAAE,qBAAqB,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,CAAC,eAAe,EAAE,CAAC;KAChG,CAAC,CAAC;AACP,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACnD,IAAI,KAAK,YAAY,cAAc;QAAE,OAAO,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5E,MAAM,KAAK,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ToolEntry } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* https://docs.apify.com/api/v2/actor-get
|
|
4
|
+
* /v2/actors/{actorId}
|
|
5
|
+
* https://docs.apify.com/api/v2/actor-version-put
|
|
6
|
+
* /v2/actors/{actorId}/versions/{versionNumber}
|
|
7
|
+
*
|
|
8
|
+
* The operations apply to the version as read in this call, and the result is stored with one version PUT that
|
|
9
|
+
* carries only the source keys, never envVars or buildTag. Conflicts are caught by each operation's check and by
|
|
10
|
+
* expectedRevision. A save from Apify Console, `apify push`, or another MCP server that lands between this call's read
|
|
11
|
+
* and its PUT is not detected: the platform's version PUT takes no precondition, and this stays so until it gets a
|
|
12
|
+
* conditional one.
|
|
13
|
+
*/
|
|
14
|
+
export declare const updateActorVersion: ToolEntry;
|
|
15
|
+
//# sourceMappingURL=update_actor_version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update_actor_version.d.ts","sourceRoot":"","sources":["../../../src/tools/versions/update_actor_version.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAgYnF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAoHtB,CAAC"}
|