@apify/actors-mcp-server 0.10.5-beta.5 → 0.10.5-beta.7
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/mcp/server.d.ts +0 -2
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +12 -20
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/utils.d.ts +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/tools/actor_executor.d.ts +10 -0
- package/dist/tools/actor_executor.d.ts.map +1 -0
- package/dist/tools/actor_executor.js +79 -0
- package/dist/tools/actor_executor.js.map +1 -0
- package/dist/tools/apps/call_actor.d.ts +0 -1
- package/dist/tools/apps/call_actor.d.ts.map +1 -1
- package/dist/tools/apps/call_actor.js +8 -54
- package/dist/tools/apps/call_actor.js.map +1 -1
- package/dist/tools/apps/call_actor_widget.d.ts.map +1 -1
- package/dist/tools/apps/call_actor_widget.js +8 -52
- package/dist/tools/apps/call_actor_widget.js.map +1 -1
- package/dist/tools/apps/get_actor_run_widget.d.ts.map +1 -1
- package/dist/tools/apps/get_actor_run_widget.js +15 -9
- package/dist/tools/apps/get_actor_run_widget.js.map +1 -1
- package/dist/tools/categories.d.ts +6 -0
- package/dist/tools/categories.d.ts.map +1 -1
- package/dist/tools/categories.js +7 -1
- package/dist/tools/categories.js.map +1 -1
- package/dist/tools/core/actor_run_response.d.ts +127 -0
- package/dist/tools/core/actor_run_response.d.ts.map +1 -0
- package/dist/tools/core/actor_run_response.js +551 -0
- package/dist/tools/core/actor_run_response.js.map +1 -0
- package/dist/tools/core/actor_tools_factory.d.ts +8 -3
- package/dist/tools/core/actor_tools_factory.d.ts.map +1 -1
- package/dist/tools/core/actor_tools_factory.js +40 -11
- package/dist/tools/core/actor_tools_factory.js.map +1 -1
- package/dist/tools/core/call_actor_common.d.ts +16 -39
- package/dist/tools/core/call_actor_common.d.ts.map +1 -1
- package/dist/tools/core/call_actor_common.js +171 -140
- package/dist/tools/core/call_actor_common.js.map +1 -1
- package/dist/tools/core/get_actor_run_common.d.ts +10 -49
- package/dist/tools/core/get_actor_run_common.d.ts.map +1 -1
- package/dist/tools/core/get_actor_run_common.js +51 -86
- package/dist/tools/core/get_actor_run_common.js.map +1 -1
- package/dist/tools/default/call_actor.d.ts +0 -2
- package/dist/tools/default/call_actor.d.ts.map +1 -1
- package/dist/tools/default/call_actor.js +5 -85
- package/dist/tools/default/call_actor.js.map +1 -1
- package/dist/tools/default/get_actor_run.d.ts +1 -2
- package/dist/tools/default/get_actor_run.d.ts.map +1 -1
- package/dist/tools/default/get_actor_run.js +12 -6
- package/dist/tools/default/get_actor_run.js.map +1 -1
- package/dist/tools/index.d.ts +1 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/structured_output_schemas.d.ts +254 -51
- package/dist/tools/structured_output_schemas.d.ts.map +1 -1
- package/dist/tools/structured_output_schemas.js +124 -68
- package/dist/tools/structured_output_schemas.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/progress.d.ts +1 -0
- package/dist/utils/progress.d.ts.map +1 -1
- package/dist/utils/progress.js +1 -1
- package/dist/utils/progress.js.map +1 -1
- package/dist/utils/server-instructions/index.d.ts.map +1 -1
- package/dist/utils/server-instructions/index.js +6 -7
- package/dist/utils/server-instructions/index.js.map +1 -1
- package/dist/utils/tools_loader.d.ts.map +1 -1
- package/dist/utils/tools_loader.js +9 -3
- package/dist/utils/tools_loader.js.map +1 -1
- package/dist/web/dist/actor-detail-widget.js +3 -0
- package/dist/web/dist/actor-run-widget.js +219 -216
- package/dist/web/dist/search-actors-widget.js +3 -0
- package/package.json +7 -7
- package/dist/tools/apps/actor_executor.d.ts +0 -8
- package/dist/tools/apps/actor_executor.d.ts.map +0 -1
- package/dist/tools/apps/actor_executor.js +0 -29
- package/dist/tools/apps/actor_executor.js.map +0 -1
- package/dist/tools/core/actor_execution.d.ts +0 -39
- package/dist/tools/core/actor_execution.d.ts.map +0 -1
- package/dist/tools/core/actor_execution.js +0 -135
- package/dist/tools/core/actor_execution.js.map +0 -1
- package/dist/tools/core/actor_response.d.ts +0 -37
- package/dist/tools/core/actor_response.d.ts.map +0 -1
- package/dist/tools/core/actor_response.js +0 -94
- package/dist/tools/core/actor_response.js.map +0 -1
- package/dist/tools/default/actor_executor.d.ts +0 -7
- package/dist/tools/default/actor_executor.d.ts.map +0 -1
- package/dist/tools/default/actor_executor.js +0 -31
- package/dist/tools/default/actor_executor.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/actors-mcp-server",
|
|
3
|
-
"version": "0.10.5-beta.
|
|
3
|
+
"version": "0.10.5-beta.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Apify MCP Server",
|
|
6
6
|
"mcpName": "com.apify/apify-mcp-server",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@ai-sdk/openai": "^3.0.52",
|
|
63
|
-
"@apify/eslint-config": "^1.1.0",
|
|
64
63
|
"@apify/mcpc": "^0.2.0",
|
|
65
|
-
"@apify/
|
|
64
|
+
"@apify/oxlint-config": "^0.2.10",
|
|
65
|
+
"@apify/tsconfig": "^0.1.2",
|
|
66
66
|
"@arizeai/phoenix-client": "^6.6.0",
|
|
67
67
|
"@arizeai/phoenix-evals": "^1.0.2",
|
|
68
68
|
"@sentry/cli": "^3.2.0",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
"@types/to-json-schema": "^0.2.4",
|
|
71
71
|
"@types/yargs": "^17.0.33",
|
|
72
72
|
"@types/yargs-parser": "^21.0.3",
|
|
73
|
-
"eslint": "^9.19.0",
|
|
74
73
|
"eventsource": "^3.0.2",
|
|
75
74
|
"openai": "^6.10.0",
|
|
75
|
+
"oxlint": "^1.64.0",
|
|
76
|
+
"oxlint-tsgolint": "0.22.1",
|
|
76
77
|
"p-limit": "^7.3.0",
|
|
77
78
|
"tsx": "^4.20.6",
|
|
78
79
|
"typescript": "^5.3.3",
|
|
79
|
-
"typescript-eslint": "^8.23.0",
|
|
80
80
|
"vitest": "^3.0.8"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"build:web": "npm --prefix src/web install && npm --prefix src/web run build",
|
|
89
89
|
"postbuild": "mkdir -p dist/web && (cp -r src/web/dist dist/web/ 2>/dev/null || :)",
|
|
90
90
|
"clean": "tsc -b src --clean && rm -rf dist/web",
|
|
91
|
-
"lint": "
|
|
92
|
-
"lint:fix": "
|
|
91
|
+
"lint": "oxlint .",
|
|
92
|
+
"lint:fix": "oxlint . --fix",
|
|
93
93
|
"type-check": "tsc -p tsconfig.json --noEmit",
|
|
94
94
|
"typecheck": "npm run type-check",
|
|
95
95
|
"check": "npm run type-check && npm run lint",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ActorExecutor } from '../../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Apps-mode actor executor.
|
|
4
|
-
* Runs actors asynchronously — starts the run and returns immediately with widget metadata.
|
|
5
|
-
* The widget automatically tracks progress and updates the UI.
|
|
6
|
-
*/
|
|
7
|
-
export declare const appsActorExecutor: ActorExecutor;
|
|
8
|
-
//# sourceMappingURL=actor_executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actor_executor.d.ts","sourceRoot":"","sources":["../../../src/tools/apps/actor_executor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA8C,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGhG;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,aAsB/B,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import log from '@apify/log';
|
|
2
|
-
import { buildStartAsyncResponse } from '../core/call_actor_common.js';
|
|
3
|
-
/**
|
|
4
|
-
* Apps-mode actor executor.
|
|
5
|
-
* Runs actors asynchronously — starts the run and returns immediately with widget metadata.
|
|
6
|
-
* The widget automatically tracks progress and updates the UI.
|
|
7
|
-
*/
|
|
8
|
-
export const appsActorExecutor = {
|
|
9
|
-
async executeActorTool(params) {
|
|
10
|
-
var _a;
|
|
11
|
-
if ((_a = params.abortSignal) === null || _a === void 0 ? void 0 : _a.aborted) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
const actorClient = params.apifyClient.actor(params.actorFullName);
|
|
15
|
-
const actorRun = await actorClient.start(params.input, params.callOptions);
|
|
16
|
-
log.debug('Started Actor run (async, direct actor tool)', {
|
|
17
|
-
actorName: params.actorFullName,
|
|
18
|
-
runId: actorRun.id,
|
|
19
|
-
mcpSessionId: params.mcpSessionId,
|
|
20
|
-
});
|
|
21
|
-
return buildStartAsyncResponse({
|
|
22
|
-
actorName: params.actorFullName,
|
|
23
|
-
actorRun,
|
|
24
|
-
input: params.input,
|
|
25
|
-
widget: true,
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=actor_executor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actor_executor.js","sourceRoot":"","sources":["../../../src/tools/apps/actor_executor.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,YAAY,CAAC;AAG7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAkB;IAC5C,KAAK,CAAC,gBAAgB,CAAC,MAA4B;;QAC/C,IAAI,MAAA,MAAM,CAAC,WAAW,0CAAE,OAAO,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACnE,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAE3E,GAAG,CAAC,KAAK,CAAC,8CAA8C,EAAE;YACtD,SAAS,EAAE,MAAM,CAAC,aAAa;YAC/B,KAAK,EAAE,QAAQ,CAAC,EAAE;YAClB,YAAY,EAAE,MAAM,CAAC,YAAY;SACpC,CAAC,CAAC;QAEH,OAAO,uBAAuB,CAAC;YAC3B,SAAS,EAAE,MAAM,CAAC,aAAa;YAC/B,QAAQ;YACR,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,IAAI;SACf,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { ActorCallOptions } from 'apify-client';
|
|
2
|
-
import type { ApifyClient } from '../../apify_client.js';
|
|
3
|
-
import type { DatasetItem } from '../../types.js';
|
|
4
|
-
import { type ProgressTracker } from '../../utils/progress.js';
|
|
5
|
-
import type { JsonSchemaProperty } from '../../utils/schema_generation.js';
|
|
6
|
-
export type CallActorGetDatasetResult = {
|
|
7
|
-
runId: string;
|
|
8
|
-
datasetId: string;
|
|
9
|
-
totalItemCount: number;
|
|
10
|
-
previewItemCount: number;
|
|
11
|
-
schema: JsonSchemaProperty;
|
|
12
|
-
previewItems: DatasetItem[];
|
|
13
|
-
usageTotalUsd?: number;
|
|
14
|
-
usageUsd?: Record<string, number>;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Calls an Apify Actor and retrieves metadata about the dataset results.
|
|
18
|
-
*
|
|
19
|
-
* This function executes an Actor and returns summary information instead with a result items preview of the full dataset
|
|
20
|
-
* to prevent overwhelming responses. The actual data can be retrieved using the get-actor-output tool.
|
|
21
|
-
*
|
|
22
|
-
* It requires the `APIFY_TOKEN` environment variable to be set.
|
|
23
|
-
* If the `APIFY_IS_AT_HOME` the dataset items are pushed to the Apify dataset.
|
|
24
|
-
*
|
|
25
|
-
* @returns {Promise<CallActorGetDatasetResult | null>} - A promise that resolves to an object containing the actor run and dataset items.
|
|
26
|
-
* @throws {Error} - Throws an error if the `APIFY_TOKEN` is not set
|
|
27
|
-
* @param options
|
|
28
|
-
*/
|
|
29
|
-
export declare function callActorGetDataset(options: {
|
|
30
|
-
actorName: string;
|
|
31
|
-
input: unknown;
|
|
32
|
-
apifyClient: ApifyClient;
|
|
33
|
-
callOptions?: ActorCallOptions;
|
|
34
|
-
progressTracker?: ProgressTracker | null;
|
|
35
|
-
abortSignal?: AbortSignal;
|
|
36
|
-
previewOutput?: boolean;
|
|
37
|
-
mcpSessionId?: string;
|
|
38
|
-
}): Promise<CallActorGetDatasetResult | null>;
|
|
39
|
-
//# sourceMappingURL=actor_execution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actor_execution.d.ts","sourceRoot":"","sources":["../../../src/tools/core/actor_execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAY,MAAM,cAAc,CAAC;AAI/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAA0B,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG1E,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAI3E,MAAM,MAAM,yBAAyB,GAAG;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,eAAe,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CA2I5C"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import log from '@apify/log';
|
|
2
|
-
import { TOOL_MAX_OUTPUT_CHARS } from '../../const.js';
|
|
3
|
-
import { ensureOutputWithinCharLimit, getActorDefinitionStorageFieldNames } from '../../utils/actor.js';
|
|
4
|
-
import { logHttpError, redactSkyfirePayId } from '../../utils/logging.js';
|
|
5
|
-
import { formatRunStatusMessage } from '../../utils/progress.js';
|
|
6
|
-
import { generateSchemaFromItems } from '../../utils/schema_generation.js';
|
|
7
|
-
/**
|
|
8
|
-
* Calls an Apify Actor and retrieves metadata about the dataset results.
|
|
9
|
-
*
|
|
10
|
-
* This function executes an Actor and returns summary information instead with a result items preview of the full dataset
|
|
11
|
-
* to prevent overwhelming responses. The actual data can be retrieved using the get-actor-output tool.
|
|
12
|
-
*
|
|
13
|
-
* It requires the `APIFY_TOKEN` environment variable to be set.
|
|
14
|
-
* If the `APIFY_IS_AT_HOME` the dataset items are pushed to the Apify dataset.
|
|
15
|
-
*
|
|
16
|
-
* @returns {Promise<CallActorGetDatasetResult | null>} - A promise that resolves to an object containing the actor run and dataset items.
|
|
17
|
-
* @throws {Error} - Throws an error if the `APIFY_TOKEN` is not set
|
|
18
|
-
* @param options
|
|
19
|
-
*/
|
|
20
|
-
export async function callActorGetDataset(options) {
|
|
21
|
-
var _a, _b;
|
|
22
|
-
const { actorName, input, apifyClient, callOptions, progressTracker, abortSignal, previewOutput = true, mcpSessionId, } = options;
|
|
23
|
-
const CLIENT_ABORT = Symbol('CLIENT_ABORT'); // Just an internal symbol to identify client abort
|
|
24
|
-
const actorClient = apifyClient.actor(actorName);
|
|
25
|
-
const abortActorRun = async (runId) => {
|
|
26
|
-
try {
|
|
27
|
-
await apifyClient.run(runId).abort({ gracefully: false });
|
|
28
|
-
}
|
|
29
|
-
catch (e) {
|
|
30
|
-
logHttpError(e, 'Error aborting Actor run', { runId });
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
// The Actor start request itself is not tied to our AbortSignal, so a client can cancel
|
|
34
|
-
// before we even create the run. In that case we should exit without starting follow-up work.
|
|
35
|
-
if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {
|
|
36
|
-
log.info('Actor run aborted by client before start', { actorName, mcpSessionId, input: redactSkyfirePayId(input) });
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
// Start the actor run
|
|
40
|
-
const actorRun = await actorClient.start(input, callOptions);
|
|
41
|
-
// Cancellation can also arrive while actorClient.start() is still in flight. Once start()
|
|
42
|
-
// returns we finally have a run ID, so we must immediately check again and abort that run
|
|
43
|
-
// ourselves; otherwise the abort event is missed and the run continues in the background.
|
|
44
|
-
if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {
|
|
45
|
-
await abortActorRun(actorRun.id);
|
|
46
|
-
log.info('Actor run aborted by client', { actorName, mcpSessionId, input: redactSkyfirePayId(input) });
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
// Resolve the race immediately on cancellation so waitForFinish() cannot win after the
|
|
50
|
-
// client cancelled the request. Keep the abort promise so the run is actually aborted
|
|
51
|
-
// before this function returns.
|
|
52
|
-
let abortListener;
|
|
53
|
-
let abortRequestPromise;
|
|
54
|
-
const abortPromise = new Promise((resolve) => {
|
|
55
|
-
abortListener = () => {
|
|
56
|
-
abortRequestPromise = abortActorRun(actorRun.id);
|
|
57
|
-
resolve(CLIENT_ABORT);
|
|
58
|
-
};
|
|
59
|
-
abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.addEventListener('abort', abortListener, { once: true });
|
|
60
|
-
});
|
|
61
|
-
// Start progress tracking if a tracker is provided
|
|
62
|
-
if (progressTracker) {
|
|
63
|
-
await progressTracker.updateProgress(formatRunStatusMessage(actorName, actorRun));
|
|
64
|
-
progressTracker.startActorRunUpdates(actorRun.id, apifyClient, actorName, actorRun);
|
|
65
|
-
}
|
|
66
|
-
// Wait for completion or cancellation
|
|
67
|
-
const potentialAbortedRun = await Promise.race([
|
|
68
|
-
apifyClient.run(actorRun.id).waitForFinish(),
|
|
69
|
-
...(abortSignal ? [abortPromise] : []),
|
|
70
|
-
]);
|
|
71
|
-
// Clean up the abort listener if waitForFinish() won the race, so a later signal
|
|
72
|
-
// doesn't try to abort an already-completed run.
|
|
73
|
-
if (abortListener) {
|
|
74
|
-
abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener('abort', abortListener);
|
|
75
|
-
}
|
|
76
|
-
if (potentialAbortedRun === CLIENT_ABORT) {
|
|
77
|
-
progressTracker === null || progressTracker === void 0 ? void 0 : progressTracker.stop();
|
|
78
|
-
await abortRequestPromise;
|
|
79
|
-
log.info('Actor run aborted by client', { actorName, mcpSessionId, input: redactSkyfirePayId(input) });
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
const completedRun = potentialAbortedRun;
|
|
83
|
-
// Stop the polling tracker before any final emit so a late tick can't duplicate it.
|
|
84
|
-
progressTracker === null || progressTracker === void 0 ? void 0 : progressTracker.stop();
|
|
85
|
-
// The platform may write the actor's final statusMessage just after the status
|
|
86
|
-
// flips, so the snapshot from waitForFinish() can be stale. Re-fetch in parallel
|
|
87
|
-
// with the dataset/build fetches to keep it off the critical path.
|
|
88
|
-
const dataset = apifyClient.dataset(completedRun.defaultDatasetId);
|
|
89
|
-
const [datasetItems, defaultBuild, finalRunStatus] = await Promise.all([
|
|
90
|
-
dataset.listItems(),
|
|
91
|
-
(await actorClient.defaultBuild()).get(),
|
|
92
|
-
// Catch-and-coerce so a 404/transient API failure on the re-fetch can't fail the
|
|
93
|
-
// whole tool call; the formatter falls back to the waitForFinish snapshot.
|
|
94
|
-
progressTracker
|
|
95
|
-
? apifyClient.run(completedRun.id).get().catch(() => undefined)
|
|
96
|
-
: Promise.resolve(undefined),
|
|
97
|
-
]);
|
|
98
|
-
if (progressTracker) {
|
|
99
|
-
// Fall back to the waitForFinish snapshot only if the re-fetch 404s (very rare).
|
|
100
|
-
await progressTracker.updateProgress(formatRunStatusMessage(actorName, finalRunStatus !== null && finalRunStatus !== void 0 ? finalRunStatus : completedRun));
|
|
101
|
-
}
|
|
102
|
-
// Generate schema using the shared utility
|
|
103
|
-
const generatedSchema = generateSchemaFromItems(datasetItems.items, {
|
|
104
|
-
clean: true,
|
|
105
|
-
arrayMode: 'all',
|
|
106
|
-
});
|
|
107
|
-
const schema = generatedSchema || { type: 'object', properties: {} };
|
|
108
|
-
/**
|
|
109
|
-
* Get important fields that are using in any dataset view as they MAY be used in filtering to ensure the output fits
|
|
110
|
-
* the tool output limits. Client has to use the get-actor-output tool to retrieve the full dataset or filtered out fields.
|
|
111
|
-
*/
|
|
112
|
-
const storageDefinition = (_b = (_a = defaultBuild === null || defaultBuild === void 0 ? void 0 : defaultBuild.actorDefinition) === null || _a === void 0 ? void 0 : _a.storages) === null || _b === void 0 ? void 0 : _b.dataset;
|
|
113
|
-
const importantProperties = getActorDefinitionStorageFieldNames(storageDefinition || {});
|
|
114
|
-
const previewItems = previewOutput
|
|
115
|
-
? ensureOutputWithinCharLimit(datasetItems.items, importantProperties, TOOL_MAX_OUTPUT_CHARS)
|
|
116
|
-
: [];
|
|
117
|
-
return {
|
|
118
|
-
runId: actorRun.id,
|
|
119
|
-
datasetId: completedRun.defaultDatasetId,
|
|
120
|
-
// `datasetItems.total` comes from the X-Apify-Pagination-Total header, which is backed
|
|
121
|
-
// by the dataset's cached `itemCount` counter. Per the API docs, this counter may lag
|
|
122
|
-
// up to 5 seconds after items are written (eventual consistency). When called immediately
|
|
123
|
-
// after a run finishes it can return 0 even though items are already stored.
|
|
124
|
-
// Fall back to `items.length`: safe here because listItems() has no limit, so all items
|
|
125
|
-
// are fetched and the length always reflects the true count.
|
|
126
|
-
// See: https://docs.apify.com/api/v2/dataset-get (itemCount note)
|
|
127
|
-
totalItemCount: datasetItems.total || datasetItems.items.length,
|
|
128
|
-
previewItemCount: previewItems.length,
|
|
129
|
-
schema,
|
|
130
|
-
previewItems,
|
|
131
|
-
usageTotalUsd: completedRun.usageTotalUsd,
|
|
132
|
-
usageUsd: completedRun.usageUsd,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
//# sourceMappingURL=actor_execution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actor_execution.js","sourceRoot":"","sources":["../../../src/tools/core/actor_execution.ts"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,YAAY,CAAC;AAG7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,2BAA2B,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAwB,MAAM,yBAAyB,CAAC;AAEvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAc3E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OASzC;;IACG,MAAM,EACF,SAAS,EACT,KAAK,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,WAAW,EACX,aAAa,GAAG,IAAI,EACpB,YAAY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;IAErE;;;OAGG;IACH,MAAM,iBAAiB,GAAG,MAAA,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,eAAe,0CAAE,QAAQ,0CAAE,OAA6C,CAAC;IACjH,MAAM,mBAAmB,GAAG,mCAAmC,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IACzF,MAAM,YAAY,GAAG,aAAa;QAC9B,CAAC,CAAC,2BAA2B,CAAC,YAAY,CAAC,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,CAAC;QAC7F,CAAC,CAAC,EAAE,CAAC;IAET,OAAO;QACH,KAAK,EAAE,QAAQ,CAAC,EAAE;QAClB,SAAS,EAAE,YAAY,CAAC,gBAAgB;QACxC,uFAAuF;QACvF,sFAAsF;QACtF,0FAA0F;QAC1F,6EAA6E;QAC7E,wFAAwF;QACxF,6DAA6D;QAC7D,kEAAkE;QAClE,cAAc,EAAE,YAAY,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,CAAC,MAAM;QAC/D,gBAAgB,EAAE,YAAY,CAAC,MAAM;QACrC,MAAM;QACN,YAAY;QACZ,aAAa,EAAE,YAAY,CAAC,aAAa;QACzC,QAAQ,EAAE,YAAY,CAAC,QAA8C;KACxE,CAAC;AACN,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { DatasetItem } from '../../types.js';
|
|
2
|
-
import type { CallActorGetDatasetResult } from './actor_execution.js';
|
|
3
|
-
/**
|
|
4
|
-
* Result from buildActorResponseContent function.
|
|
5
|
-
* Contains both text content and structured content.
|
|
6
|
-
*/
|
|
7
|
-
export type ActorResponseResult = {
|
|
8
|
-
content: ({
|
|
9
|
-
type: 'text';
|
|
10
|
-
text: string;
|
|
11
|
-
})[];
|
|
12
|
-
structuredContent: {
|
|
13
|
-
runId: string;
|
|
14
|
-
datasetId: string;
|
|
15
|
-
totalItemCount: number;
|
|
16
|
-
items: DatasetItem[];
|
|
17
|
-
instructions: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Builds the response content for Actor tool calls.
|
|
22
|
-
* Includes Actor run metadata, output schema, and a preview of output items.
|
|
23
|
-
*
|
|
24
|
-
* The response starts with a preview of Actor output items, if available.
|
|
25
|
-
* This must come first. Metadata and instructions for the LLM are provided last.
|
|
26
|
-
* The LLM may ignore metadata and instructions if it is not at the end of the response.
|
|
27
|
-
*
|
|
28
|
-
* If the preview is limited and does not show all items, the response informs the LLM.
|
|
29
|
-
* This is important because the LLM may assume it has all data and hallucinate missing items.
|
|
30
|
-
*
|
|
31
|
-
* @param actorName - The name of the actor.
|
|
32
|
-
* @param result - The result from callActorGetDataset.
|
|
33
|
-
* @param previewOutput - Whether to include preview items (default: true).
|
|
34
|
-
* @returns The content array and structured content for the tool response.
|
|
35
|
-
*/
|
|
36
|
-
export declare function buildActorResponseContent(actorName: string, result: CallActorGetDatasetResult, previewOutput?: boolean): ActorResponseResult;
|
|
37
|
-
//# sourceMappingURL=actor_response.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actor_response.d.ts","sourceRoot":"","sources":["../../../src/tools/core/actor_response.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAC5C,iBAAiB,EAAE;QACf,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,WAAW,EAAE,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;KACxB,CAAC;CACL,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,yBAAyB,EACjC,aAAa,UAAO,GACrB,mBAAmB,CAmFrB"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import dedent from 'dedent';
|
|
2
|
-
/**
|
|
3
|
-
* Builds the response content for Actor tool calls.
|
|
4
|
-
* Includes Actor run metadata, output schema, and a preview of output items.
|
|
5
|
-
*
|
|
6
|
-
* The response starts with a preview of Actor output items, if available.
|
|
7
|
-
* This must come first. Metadata and instructions for the LLM are provided last.
|
|
8
|
-
* The LLM may ignore metadata and instructions if it is not at the end of the response.
|
|
9
|
-
*
|
|
10
|
-
* If the preview is limited and does not show all items, the response informs the LLM.
|
|
11
|
-
* This is important because the LLM may assume it has all data and hallucinate missing items.
|
|
12
|
-
*
|
|
13
|
-
* @param actorName - The name of the actor.
|
|
14
|
-
* @param result - The result from callActorGetDataset.
|
|
15
|
-
* @param previewOutput - Whether to include preview items (default: true).
|
|
16
|
-
* @returns The content array and structured content for the tool response.
|
|
17
|
-
*/
|
|
18
|
-
export function buildActorResponseContent(actorName, result, previewOutput = true) {
|
|
19
|
-
const { runId, datasetId, totalItemCount, schema } = result;
|
|
20
|
-
// Extract item schema if schema is an array
|
|
21
|
-
let displaySchema = schema;
|
|
22
|
-
if (schema && schema.type === 'array' && typeof schema.items === 'object' && schema.items !== null) {
|
|
23
|
-
displaySchema = schema.items;
|
|
24
|
-
}
|
|
25
|
-
// Build instructions for retrieving additional data
|
|
26
|
-
const isPreviewLimited = totalItemCount !== result.previewItems.length;
|
|
27
|
-
const previewNote = isPreviewLimited
|
|
28
|
-
? dedent `
|
|
29
|
-
Note: You have access only to a limited preview
|
|
30
|
-
(${result.previewItems.length} of ${totalItemCount} items). Do not present this as the full output.
|
|
31
|
-
`
|
|
32
|
-
: '';
|
|
33
|
-
const previewLimitNote = isPreviewLimited
|
|
34
|
-
? dedent `
|
|
35
|
-
You have access only to a limited preview of the Actor output.
|
|
36
|
-
Do not present this as the full output, as you have only ${result.previewItems.length} item(s) available instead of the full ${totalItemCount} item(s).
|
|
37
|
-
Be aware of this and inform users about the currently loaded count and the total available output items count.
|
|
38
|
-
`
|
|
39
|
-
: '';
|
|
40
|
-
const instructions = dedent `
|
|
41
|
-
If you need to retrieve additional data, use the "get-actor-output" tool with datasetId: "${datasetId}".${previewNote}
|
|
42
|
-
Be sure to limit the number of results when using the "get-actor-output" tool, since you never know how large the items may be, and they might exceed the output limits.
|
|
43
|
-
`;
|
|
44
|
-
// Construct text content
|
|
45
|
-
const textContent = dedent `
|
|
46
|
-
Actor "${actorName}" completed successfully!
|
|
47
|
-
|
|
48
|
-
Results summary:
|
|
49
|
-
• Run ID: ${runId}
|
|
50
|
-
• Dataset ID: ${datasetId}
|
|
51
|
-
• Total items: ${totalItemCount}
|
|
52
|
-
|
|
53
|
-
Actor output data schema:
|
|
54
|
-
* You can use this schema to understand the structure of the output data and, for example, retrieve specific fields based on your current task.
|
|
55
|
-
\`\`\`json
|
|
56
|
-
${JSON.stringify(displaySchema)}
|
|
57
|
-
\`\`\`
|
|
58
|
-
|
|
59
|
-
Above this text block is a preview of the Actor output containing ${result.previewItems.length} item(s).${previewLimitNote}
|
|
60
|
-
|
|
61
|
-
${instructions}
|
|
62
|
-
`;
|
|
63
|
-
const getEmptyPreviewMessage = () => {
|
|
64
|
-
if (previewOutput) {
|
|
65
|
-
return dedent `
|
|
66
|
-
No items available for preview—either the Actor did not return any items or they are too large for preview.
|
|
67
|
-
Use the "get-actor-output" tool with datasetId: "${result.datasetId}" to retrieve results.
|
|
68
|
-
`;
|
|
69
|
-
}
|
|
70
|
-
return dedent `
|
|
71
|
-
Preview skipped (previewOutput: false).
|
|
72
|
-
Use the "get-actor-output" tool with datasetId: "${result.datasetId}" to retrieve results or specific fields.
|
|
73
|
-
`;
|
|
74
|
-
};
|
|
75
|
-
const itemsPreviewText = result.previewItems.length > 0
|
|
76
|
-
? JSON.stringify(result.previewItems)
|
|
77
|
-
: getEmptyPreviewMessage();
|
|
78
|
-
// Build content array
|
|
79
|
-
const content = [
|
|
80
|
-
{ type: 'text', text: itemsPreviewText },
|
|
81
|
-
// The metadata and instructions text must be at the end, otherwise the LLM does not acknowledge it.
|
|
82
|
-
{ type: 'text', text: textContent },
|
|
83
|
-
];
|
|
84
|
-
// Build structured content
|
|
85
|
-
const structuredContent = {
|
|
86
|
-
runId: result.runId,
|
|
87
|
-
datasetId: result.datasetId,
|
|
88
|
-
totalItemCount: result.totalItemCount,
|
|
89
|
-
items: result.previewItems,
|
|
90
|
-
instructions,
|
|
91
|
-
};
|
|
92
|
-
return { content, structuredContent };
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=actor_response.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actor_response.js","sourceRoot":"","sources":["../../../src/tools/core/actor_response.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAoB5B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,yBAAyB,CACrC,SAAiB,EACjB,MAAiC,EACjC,aAAa,GAAG,IAAI;IAEpB,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE5D,4CAA4C;IAC5C,IAAI,aAAa,GAAG,MAAM,CAAC;IAC3B,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QACjG,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC;IACjC,CAAC;IAED,oDAAoD;IACpD,MAAM,gBAAgB,GAAG,cAAc,KAAK,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC;IACvE,MAAM,WAAW,GAAG,gBAAgB;QAChC,CAAC,CAAC,MAAM,CAAA;;eAED,MAAM,CAAC,YAAY,CAAC,MAAM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M,CAAC,cAAc;QACrC,KAAK,EAAE,MAAM,CAAC,YAAY;QAC1B,YAAY;KACf,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ActorExecutor } from '../../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Default actor executor for normal (non-UI) mode.
|
|
4
|
-
* Runs actors synchronously — waits for completion, returns dataset results.
|
|
5
|
-
*/
|
|
6
|
-
export declare const defaultActorExecutor: ActorExecutor;
|
|
7
|
-
//# sourceMappingURL=actor_executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actor_executor.d.ts","sourceRoot":"","sources":["../../../src/tools/default/actor_executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8C,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKhG;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAwBlC,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { buildUsageMeta } from '../../utils/mcp.js';
|
|
2
|
-
import { callActorGetDataset } from '../core/actor_execution.js';
|
|
3
|
-
import { buildActorResponseContent } from '../core/actor_response.js';
|
|
4
|
-
/**
|
|
5
|
-
* Default actor executor for normal (non-UI) mode.
|
|
6
|
-
* Runs actors synchronously — waits for completion, returns dataset results.
|
|
7
|
-
*/
|
|
8
|
-
export const defaultActorExecutor = {
|
|
9
|
-
async executeActorTool(params) {
|
|
10
|
-
const callResult = await callActorGetDataset({
|
|
11
|
-
actorName: params.actorFullName,
|
|
12
|
-
input: params.input,
|
|
13
|
-
apifyClient: params.apifyClient,
|
|
14
|
-
callOptions: params.callOptions,
|
|
15
|
-
progressTracker: params.progressTracker,
|
|
16
|
-
abortSignal: params.abortSignal,
|
|
17
|
-
mcpSessionId: params.mcpSessionId,
|
|
18
|
-
});
|
|
19
|
-
if (!callResult) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
const { content, structuredContent } = buildActorResponseContent(params.actorFullName, callResult);
|
|
23
|
-
const _meta = buildUsageMeta(callResult);
|
|
24
|
-
return {
|
|
25
|
-
content,
|
|
26
|
-
structuredContent,
|
|
27
|
-
...(_meta && { _meta }),
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=actor_executor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actor_executor.js","sourceRoot":"","sources":["../../../src/tools/default/actor_executor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAkB;IAC/C,KAAK,CAAC,gBAAgB,CAAC,MAA4B;QAC/C,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC;YACzC,SAAS,EAAE,MAAM,CAAC,aAAa;YAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,YAAY,EAAE,MAAM,CAAC,YAAY;SACpC,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,yBAAyB,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;QACnG,MAAM,KAAK,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;QACzC,OAAO;YACH,OAAO;YACP,iBAAiB;YACjB,GAAG,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;SAC1B,CAAC;IACN,CAAC;CACJ,CAAC"}
|