@applitools/mcp 0.10.5 → 0.10.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/CHANGELOG.md +51 -0
- package/README.md +4 -4
- package/dist/docs/README.md +4 -4
- package/dist/index.js +92 -37
- package/dist/index.js.map +1 -1
- package/docs/README.md +4 -4
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,57 @@ All notable changes to the Applitools Eyes MCP will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.10.7](https://github.com/Applitools-Dev/sdk/compare/js/mcp@0.10.6...js/mcp@0.10.7) (2026-11-25)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* default review tools to inspect mode when no write key is set | AD-18097 ([#4477](https://github.com/Applitools-Dev/sdk/issues/4477)) ([d012bd2](https://github.com/Applitools-Dev/sdk/commit/d012bd2ec6c7459f60d81af3ebbfaeee8c507cfc))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* @applitools/utils bumped to 1.16.0
|
|
19
|
+
#### Features
|
|
20
|
+
|
|
21
|
+
* stitch iOS full pages without NML from the accessibility tree | AD-16309 ([#4202](https://github.com/Applitools-Dev/sdk/issues/4202)) ([123cbc8](https://github.com/Applitools-Dev/sdk/commit/123cbc85179d3179c5a8400bb3c1b9927561f8d9))
|
|
22
|
+
* @applitools/eyes-results bumped to 0.2.12
|
|
23
|
+
|
|
24
|
+
* @applitools/logger bumped to 2.3.5
|
|
25
|
+
|
|
26
|
+
* @applitools/req bumped to 1.11.10
|
|
27
|
+
|
|
28
|
+
* @applitools/image bumped to 1.3.7
|
|
29
|
+
|
|
30
|
+
* @applitools/core-base bumped to 1.44.2
|
|
31
|
+
#### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* return the pdf match's session, not the old sync verdict ([#4525](https://github.com/Applitools-Dev/sdk/issues/4525)) ([3f67a03](https://github.com/Applitools-Dev/sdk/commit/3f67a033354b0f436308daec92cd860e4961669d))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
* @applitools/test-server bumped to 1.4.12
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## [0.10.6](https://github.com/Applitools-Dev/sdk/compare/js/mcp@0.10.5...js/mcp@0.10.6) (2026-11-18)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* report key sources in tool telemetry | AD-17993 ([#4468](https://github.com/Applitools-Dev/sdk/issues/4468)) ([80a46b7](https://github.com/Applitools-Dev/sdk/commit/80a46b761b7fa42a1f29d84dd5229a5f62afe9df))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Dependencies
|
|
49
|
+
|
|
50
|
+
* @applitools/eyes-results bumped to 0.2.11
|
|
51
|
+
|
|
52
|
+
* @applitools/req bumped to 1.11.9
|
|
53
|
+
|
|
54
|
+
* @applitools/core-base bumped to 1.44.1
|
|
55
|
+
|
|
56
|
+
* @applitools/test-server bumped to 1.4.11
|
|
57
|
+
|
|
58
|
+
|
|
8
59
|
## [0.10.5](https://github.com/Applitools-Dev/sdk/compare/js/mcp@0.10.4...js/mcp@0.10.5) (2026-11-16)
|
|
9
60
|
|
|
10
61
|
|
package/README.md
CHANGED
|
@@ -154,7 +154,7 @@ Three keys control what the server can do, set as global environment variables,
|
|
|
154
154
|
* APPLITOOLS_API_KEY: Used for test execution (unchanged; this is the key you already use to run Eyes visual tests). See [our documentation](https://applitools.com/docs/eyes/getting-started/retrieve-api-key) on retrieving your execution key.
|
|
155
155
|
* Note: The MCP server will look in additional places for this key. See the `eyes_verify_api_key` tool for details.
|
|
156
156
|
* APPLITOOLS_READ_KEY: A read-only key. Required for all Inspection tools, for all Resolution tools, and for Review tools running in either mode.
|
|
157
|
-
* APPLITOOLS_WRITE_KEY: A write-only key. Required for all Resolution tools and for Review tools running in resolve mode
|
|
157
|
+
* APPLITOOLS_WRITE_KEY: A write-only key. Required for all Resolution tools and for Review tools running in resolve mode. When it is set, Review defaults to resolve mode; without it, Review defaults to inspect mode.
|
|
158
158
|
|
|
159
159
|
How to get read-only and write-only API keys:
|
|
160
160
|
|
|
@@ -273,7 +273,7 @@ Returns the match regions currently in effect for a step, combining regions defi
|
|
|
273
273
|
Returns a DOM node's diff history across prior runs, used as evidence that a change is recurring/dynamic content rather than a one-time real change.
|
|
274
274
|
|
|
275
275
|
### Review (orchestration)
|
|
276
|
-
Requires APPLITOOLS_READ_KEY always, and additionally APPLITOOLS_WRITE_KEY when running in resolve mode
|
|
276
|
+
Requires APPLITOOLS_READ_KEY always, and additionally APPLITOOLS_WRITE_KEY when running in resolve mode. This is the primary way to use these tools day-to-day: ask your assistant to review a batch, scenario, session, or step, and it drives the full investigation for you.
|
|
277
277
|
|
|
278
278
|
Supported Eyes SDKs: All
|
|
279
279
|
|
|
@@ -288,8 +288,8 @@ Summarizes and finalizes the investigation at the given scope, deduplicating eve
|
|
|
288
288
|
|
|
289
289
|
Two Review modes:
|
|
290
290
|
|
|
291
|
-
* inspect: read-only. Produces a summary of what changed with no mutation. Good for a first look, or when you want to see findings before deciding what to do.
|
|
292
|
-
* resolve (the default): additionally applies masks for confirmed-dynamic diffs and decides each step's accept/reject/unresolved outcome automatically, as findings come in. Your assistant never has to call the Resolution tools independently to make this happen.
|
|
291
|
+
* inspect (the default when APPLITOOLS_WRITE_KEY is not set): read-only. Produces a summary of what changed with no mutation. Good for a first look, or when you want to see findings before deciding what to do.
|
|
292
|
+
* resolve (the default when APPLITOOLS_WRITE_KEY is set): additionally applies masks for confirmed-dynamic diffs and decides each step's accept/reject/unresolved outcome automatically, as findings come in. Your assistant never has to call the Resolution tools independently to make this happen.
|
|
293
293
|
|
|
294
294
|
Either mode can be scoped to a whole batch or narrowed to a single scenario, session, or step. A completed inspect-mode review can later be promoted to resolve mode without redoing the investigation; its cached findings are simply replayed through the resolve-mode decision logic. Saving changes to the baseline, or resetting it, is never part of Review itself; ask separately for `eyes_resolve_save` (or `eyes_resolve_reset`), each of which still requires your explicit approval.
|
|
295
295
|
|
package/dist/docs/README.md
CHANGED
|
@@ -154,7 +154,7 @@ Three keys control what the server can do, set as global environment variables,
|
|
|
154
154
|
* APPLITOOLS_API_KEY: Used for test execution (unchanged; this is the key you already use to run Eyes visual tests). See [our documentation](https://applitools.com/docs/eyes/getting-started/retrieve-api-key) on retrieving your execution key.
|
|
155
155
|
* Note: The MCP server will look in additional places for this key. See the `eyes_verify_api_key` tool for details.
|
|
156
156
|
* APPLITOOLS_READ_KEY: A read-only key. Required for all Inspection tools, for all Resolution tools, and for Review tools running in either mode.
|
|
157
|
-
* APPLITOOLS_WRITE_KEY: A write-only key. Required for all Resolution tools and for Review tools running in resolve mode
|
|
157
|
+
* APPLITOOLS_WRITE_KEY: A write-only key. Required for all Resolution tools and for Review tools running in resolve mode. When it is set, Review defaults to resolve mode; without it, Review defaults to inspect mode.
|
|
158
158
|
|
|
159
159
|
How to get read-only and write-only API keys:
|
|
160
160
|
|
|
@@ -273,7 +273,7 @@ Returns the match regions currently in effect for a step, combining regions defi
|
|
|
273
273
|
Returns a DOM node's diff history across prior runs, used as evidence that a change is recurring/dynamic content rather than a one-time real change.
|
|
274
274
|
|
|
275
275
|
### Review (orchestration)
|
|
276
|
-
Requires APPLITOOLS_READ_KEY always, and additionally APPLITOOLS_WRITE_KEY when running in resolve mode
|
|
276
|
+
Requires APPLITOOLS_READ_KEY always, and additionally APPLITOOLS_WRITE_KEY when running in resolve mode. This is the primary way to use these tools day-to-day: ask your assistant to review a batch, scenario, session, or step, and it drives the full investigation for you.
|
|
277
277
|
|
|
278
278
|
Supported Eyes SDKs: All
|
|
279
279
|
|
|
@@ -288,8 +288,8 @@ Summarizes and finalizes the investigation at the given scope, deduplicating eve
|
|
|
288
288
|
|
|
289
289
|
Two Review modes:
|
|
290
290
|
|
|
291
|
-
* inspect: read-only. Produces a summary of what changed with no mutation. Good for a first look, or when you want to see findings before deciding what to do.
|
|
292
|
-
* resolve (the default): additionally applies masks for confirmed-dynamic diffs and decides each step's accept/reject/unresolved outcome automatically, as findings come in. Your assistant never has to call the Resolution tools independently to make this happen.
|
|
291
|
+
* inspect (the default when APPLITOOLS_WRITE_KEY is not set): read-only. Produces a summary of what changed with no mutation. Good for a first look, or when you want to see findings before deciding what to do.
|
|
292
|
+
* resolve (the default when APPLITOOLS_WRITE_KEY is set): additionally applies masks for confirmed-dynamic diffs and decides each step's accept/reject/unresolved outcome automatically, as findings come in. Your assistant never has to call the Resolution tools independently to make this happen.
|
|
293
293
|
|
|
294
294
|
Either mode can be scoped to a whole batch or narrowed to a single scenario, session, or step. A completed inspect-mode review can later be promoted to resolve mode without redoing the investigation; its cached findings are simply replayed through the resolve-mode decision logic. Saving changes to the baseline, or resetting it, is never part of Review itself; ask separately for `eyes_resolve_save` (or `eyes_resolve_reset`), each of which still requires your explicit approval.
|
|
295
295
|
|
package/dist/index.js
CHANGED
|
@@ -3924,7 +3924,7 @@ function loadEnvFile(workingDirectory) {
|
|
|
3924
3924
|
}
|
|
3925
3925
|
}
|
|
3926
3926
|
if (apiKey) {
|
|
3927
|
-
return { apiKey, serverUrl, foundIn: '.env' };
|
|
3927
|
+
return { apiKey, serverUrl, foundIn: '.env', keyFrom: 'env_file' };
|
|
3928
3928
|
}
|
|
3929
3929
|
}
|
|
3930
3930
|
catch {
|
|
@@ -3970,6 +3970,7 @@ function loadConfigFile(configPath, fileName, workingDirectory) {
|
|
|
3970
3970
|
// Search for apiKey and serverUrl in the file content
|
|
3971
3971
|
let apiKey;
|
|
3972
3972
|
let serverUrl;
|
|
3973
|
+
let keyFrom = 'config';
|
|
3973
3974
|
// Pattern 1: apiKey: 'value' or apiKey: "value" (hardcoded values)
|
|
3974
3975
|
const apiKeyMatch = content.match(/apiKey\s*:\s*['"]([^'"]+)['"]/i);
|
|
3975
3976
|
if (apiKeyMatch) {
|
|
@@ -3983,12 +3984,14 @@ function loadConfigFile(configPath, fileName, workingDirectory) {
|
|
|
3983
3984
|
// Pattern 3: Resolve environment variable references in config file
|
|
3984
3985
|
if (!apiKey) {
|
|
3985
3986
|
apiKey = resolveEnvVarFromContent(content, 'APPLITOOLS_API_KEY', workingDirectory);
|
|
3987
|
+
// The same check resolveEnvVarFromContent makes before falling back to this directory's .env.
|
|
3988
|
+
keyFrom = process.env.APPLITOOLS_API_KEY ? 'environment' : 'env_file';
|
|
3986
3989
|
}
|
|
3987
3990
|
if (!serverUrl) {
|
|
3988
3991
|
serverUrl = resolveEnvVarFromContent(content, 'APPLITOOLS_SERVER_URL', workingDirectory);
|
|
3989
3992
|
}
|
|
3990
3993
|
if (apiKey) {
|
|
3991
|
-
return { apiKey, serverUrl, foundIn: fileName };
|
|
3994
|
+
return { apiKey, serverUrl, foundIn: fileName, keyFrom };
|
|
3992
3995
|
}
|
|
3993
3996
|
}
|
|
3994
3997
|
catch {
|
|
@@ -4030,12 +4033,22 @@ function findApiKey(workingDirectory = process.cwd()) {
|
|
|
4030
4033
|
apiKey: envApiKey,
|
|
4031
4034
|
serverUrl: envServerUrl,
|
|
4032
4035
|
foundIn: 'environment variable',
|
|
4036
|
+
keyFrom: 'environment',
|
|
4033
4037
|
};
|
|
4034
4038
|
}
|
|
4035
4039
|
// Not found
|
|
4036
4040
|
return {};
|
|
4037
4041
|
}
|
|
4038
4042
|
|
|
4043
|
+
// Saved the first time a .env overrides a workspace name, so the launch value comes back once no
|
|
4044
|
+
// chosen .env defines it. Kept here so credential loading can read it without importing env-loader.
|
|
4045
|
+
const workspaceLaunchValues = new Map();
|
|
4046
|
+
/** Whether a workspace name's current value is the chosen `.env`'s override, the launch value, or absent. */
|
|
4047
|
+
function workspaceValueSource(name) {
|
|
4048
|
+
if (!process.env[name])
|
|
4049
|
+
return 'unset';
|
|
4050
|
+
return workspaceLaunchValues.has(name) ? 'env_file' : 'process_env';
|
|
4051
|
+
}
|
|
4039
4052
|
let currentClientInfo = undefined;
|
|
4040
4053
|
let currentCredentials = undefined;
|
|
4041
4054
|
let ide = undefined;
|
|
@@ -4075,6 +4088,7 @@ function loadCredentials(workingDirectory) {
|
|
|
4075
4088
|
apiKey: storedCredentials.apiKey,
|
|
4076
4089
|
serverUrl: storedCredentials.serverUrl,
|
|
4077
4090
|
source: 'server-context',
|
|
4091
|
+
keySource: storedCredentials.keySource,
|
|
4078
4092
|
};
|
|
4079
4093
|
}
|
|
4080
4094
|
const workingDir = workingDirectory || process.cwd();
|
|
@@ -4082,7 +4096,14 @@ function loadCredentials(workingDirectory) {
|
|
|
4082
4096
|
const apiKey = configResult.apiKey;
|
|
4083
4097
|
const serverUrl = configResult.serverUrl || process.env.APPLITOOLS_SERVER_URL || DEFAULT_SERVER_URL;
|
|
4084
4098
|
const source = configResult.foundIn;
|
|
4085
|
-
return { apiKey, serverUrl, source };
|
|
4099
|
+
return { apiKey, serverUrl, source, keySource: apiKey ? keySourceOf(configResult) : undefined };
|
|
4100
|
+
}
|
|
4101
|
+
function keySourceOf({ keyFrom, foundIn }) {
|
|
4102
|
+
if (keyFrom === 'environment')
|
|
4103
|
+
return workspaceValueSource('APPLITOOLS_API_KEY');
|
|
4104
|
+
if (keyFrom === 'env_file')
|
|
4105
|
+
return 'env_file';
|
|
4106
|
+
return (foundIn === null || foundIn === void 0 ? void 0 : foundIn.startsWith('playwright.config')) ? 'playwright_config' : 'applitools_config';
|
|
4086
4107
|
}
|
|
4087
4108
|
/** Load and store credentials in server context */
|
|
4088
4109
|
function loadAndStoreCredentials(workingDirectory) {
|
|
@@ -4091,6 +4112,7 @@ function loadAndStoreCredentials(workingDirectory) {
|
|
|
4091
4112
|
setCredentials({
|
|
4092
4113
|
apiKey: result.apiKey,
|
|
4093
4114
|
serverUrl: result.serverUrl,
|
|
4115
|
+
keySource: result.keySource,
|
|
4094
4116
|
});
|
|
4095
4117
|
return true;
|
|
4096
4118
|
}
|
|
@@ -4242,23 +4264,21 @@ const loadEnvOnce = utils__namespace.general.cachify((startDir, source) => {
|
|
|
4242
4264
|
}
|
|
4243
4265
|
return loaded;
|
|
4244
4266
|
}, ([startDir]) => startDir, 30000);
|
|
4245
|
-
// Saved the first time a .env overrides a name, so the launch value comes back once no chosen .env defines it.
|
|
4246
|
-
const launchValues = new Map();
|
|
4247
4267
|
function syncWorkspaceKeys(workspaceRoot, source) {
|
|
4248
4268
|
const loaded = loadEnvOnce(workspaceRoot, source);
|
|
4249
4269
|
for (const name of WORKSPACE_ENV_NAMES) {
|
|
4250
4270
|
const value = loaded === null || loaded === void 0 ? void 0 : loaded.parsed[name];
|
|
4251
4271
|
if (loaded && value) {
|
|
4252
|
-
if (!
|
|
4253
|
-
|
|
4272
|
+
if (!workspaceLaunchValues.has(name))
|
|
4273
|
+
workspaceLaunchValues.set(name, process.env[name]);
|
|
4254
4274
|
if (process.env[name] === value)
|
|
4255
4275
|
continue;
|
|
4256
4276
|
process.env[name] = value;
|
|
4257
4277
|
log$1('info', `[MCP Server] ${name} set from ${loaded.path} (triggered by ${source})`);
|
|
4258
4278
|
}
|
|
4259
|
-
else if (
|
|
4260
|
-
const launchValue =
|
|
4261
|
-
|
|
4279
|
+
else if (workspaceLaunchValues.has(name)) {
|
|
4280
|
+
const launchValue = workspaceLaunchValues.get(name);
|
|
4281
|
+
workspaceLaunchValues.delete(name);
|
|
4262
4282
|
if (launchValue === undefined)
|
|
4263
4283
|
delete process.env[name];
|
|
4264
4284
|
else
|
|
@@ -4589,11 +4609,20 @@ function countGateRejection() {
|
|
|
4589
4609
|
function gateRejectionCount() {
|
|
4590
4610
|
return gateRejections;
|
|
4591
4611
|
}
|
|
4612
|
+
/** Where each key setting in use came from, as fixed enum values only — never a path, file name or key. */
|
|
4613
|
+
function keySources() {
|
|
4614
|
+
var _a;
|
|
4615
|
+
return {
|
|
4616
|
+
api_key_source: (_a = loadCredentials().keySource) !== null && _a !== void 0 ? _a : 'unset',
|
|
4617
|
+
read_key_source: workspaceValueSource('APPLITOOLS_READ_KEY'),
|
|
4618
|
+
write_key_source: workspaceValueSource('APPLITOOLS_WRITE_KEY'),
|
|
4619
|
+
};
|
|
4620
|
+
}
|
|
4592
4621
|
|
|
4593
4622
|
var name = "@applitools/mcp";
|
|
4594
4623
|
var mcpName = "io.github.applitools/applitools";
|
|
4595
|
-
var mcpRegistryVersion = "1.0.
|
|
4596
|
-
var version = "0.10.
|
|
4624
|
+
var mcpRegistryVersion = "1.0.19";
|
|
4625
|
+
var version = "0.10.7";
|
|
4597
4626
|
var description = "Applitools MCP server for AI coding assistants";
|
|
4598
4627
|
var main = "./dist/index.js";
|
|
4599
4628
|
var bin = "./dist/index.js";
|
|
@@ -4842,6 +4871,8 @@ const createToolHandler = (toolDef, logic) => {
|
|
|
4842
4871
|
const safeParams = params !== null && params !== void 0 ? params : {};
|
|
4843
4872
|
const workspaceRoot = safeParams.workspaceRoot || getWorkspaceRoot() || process.cwd();
|
|
4844
4873
|
syncWorkspaceKeys(workspaceRoot, toolDef.name);
|
|
4874
|
+
// Read before any await, while the process-wide key slot still holds this call's keys.
|
|
4875
|
+
const sources = keySources();
|
|
4845
4876
|
const { selected: frameworkSelected, detected: detectedFrameworks } = getAutomationFramework(workspaceRoot, safeParams.activeFile);
|
|
4846
4877
|
const { name: automationFramework, version: automationFrameworkVersion } = frameworkSelected;
|
|
4847
4878
|
const { selected: sdkLanguage, detected: detectedLanguages } = getSdkLanguage(workspaceRoot);
|
|
@@ -4853,7 +4884,7 @@ const createToolHandler = (toolDef, logic) => {
|
|
|
4853
4884
|
sdkLanguage,
|
|
4854
4885
|
};
|
|
4855
4886
|
const { batchId, sessionId } = extractScopeIds(safeParams);
|
|
4856
|
-
const telemetry = {};
|
|
4887
|
+
const telemetry = { ...sources };
|
|
4857
4888
|
const callInputs = reportedInputs(safeParams);
|
|
4858
4889
|
const outcomeJsonParams = () => jsonParams({ ...telemetry, gate_rejections: gateRejectionCount() }, callInputs);
|
|
4859
4890
|
externalLog('mcp_tool_invoked', {
|
|
@@ -4867,7 +4898,7 @@ const createToolHandler = (toolDef, logic) => {
|
|
|
4867
4898
|
session_id: sessionId,
|
|
4868
4899
|
// The backend attributes every event to the authenticating key's account, so no key goes out here.
|
|
4869
4900
|
params: JSON.stringify({ ...params, apiKey: undefined }, null, 2).slice(0, 1024),
|
|
4870
|
-
json_params: jsonParams(
|
|
4901
|
+
json_params: jsonParams(sources, callInputs),
|
|
4871
4902
|
automation_framework: automationFramework,
|
|
4872
4903
|
automation_framework_version: automationFrameworkVersion,
|
|
4873
4904
|
sdk_language: sdkLanguage,
|
|
@@ -5189,9 +5220,12 @@ const VerifyApiKeyInputSchema = zod.z.object({
|
|
|
5189
5220
|
.describe('If true, save the validated API key and server URL as the default configuration in cache'),
|
|
5190
5221
|
});
|
|
5191
5222
|
// A key that fails validation is the one telemetry case where a key is reported, masked so that
|
|
5192
|
-
// a short value is never shown.
|
|
5193
|
-
function reportUnvalidatedKey(apiKey) {
|
|
5194
|
-
recordToolTelemetry({
|
|
5223
|
+
// a short value is never shown; its source replaces the pinned key's so both fields describe it.
|
|
5224
|
+
function reportUnvalidatedKey(apiKey, keySource) {
|
|
5225
|
+
recordToolTelemetry({
|
|
5226
|
+
api_key_source: keySource,
|
|
5227
|
+
api_key_masked: apiKey.length <= 7 ? '***' : `${apiKey.slice(0, 3)}***${apiKey.slice(-3)}`,
|
|
5228
|
+
});
|
|
5195
5229
|
}
|
|
5196
5230
|
/** Verify API key handler function */
|
|
5197
5231
|
async function verifyApiKey(input = {}) {
|
|
@@ -5203,12 +5237,14 @@ async function verifyApiKey(input = {}) {
|
|
|
5203
5237
|
let apiKey = input.apiKey;
|
|
5204
5238
|
let serverUrl = input.serverUrl;
|
|
5205
5239
|
let foundIn;
|
|
5240
|
+
let keySource = input.apiKey ? 'tool_argument' : undefined;
|
|
5206
5241
|
// Load credentials if not provided as input
|
|
5207
5242
|
if (!apiKey || !serverUrl) {
|
|
5208
5243
|
const credentialResult = loadCredentials(workingDirectory);
|
|
5209
5244
|
apiKey = apiKey || credentialResult.apiKey;
|
|
5210
5245
|
serverUrl = serverUrl || credentialResult.serverUrl; // loadCredentials always provides serverUrl (with default)
|
|
5211
5246
|
foundIn = credentialResult.source;
|
|
5247
|
+
keySource !== null && keySource !== void 0 ? keySource : (keySource = credentialResult.keySource);
|
|
5212
5248
|
}
|
|
5213
5249
|
// Validate API key presence
|
|
5214
5250
|
if (!apiKey || apiKey.trim() === '') {
|
|
@@ -5223,7 +5259,7 @@ async function verifyApiKey(input = {}) {
|
|
|
5223
5259
|
new URL(finalServerUrl);
|
|
5224
5260
|
}
|
|
5225
5261
|
catch {
|
|
5226
|
-
reportUnvalidatedKey(apiKey);
|
|
5262
|
+
reportUnvalidatedKey(apiKey, keySource);
|
|
5227
5263
|
return {
|
|
5228
5264
|
message: wrapText('Eyes authentication failed. Invalid server URL format. Please verify that your server URL is correct.', 'suffix'),
|
|
5229
5265
|
};
|
|
@@ -5232,7 +5268,7 @@ async function verifyApiKey(input = {}) {
|
|
|
5232
5268
|
assertTrustedEyesUrl(finalServerUrl);
|
|
5233
5269
|
}
|
|
5234
5270
|
catch (error) {
|
|
5235
|
-
reportUnvalidatedKey(apiKey);
|
|
5271
|
+
reportUnvalidatedKey(apiKey, keySource);
|
|
5236
5272
|
return {
|
|
5237
5273
|
message: wrapText(`Eyes authentication failed: ${error.message}. ` +
|
|
5238
5274
|
'Correct the server URL where it is set: the serverUrl argument, APPLITOOLS_SERVER_URL or the project config file.', 'suffix'),
|
|
@@ -5244,7 +5280,9 @@ async function verifyApiKey(input = {}) {
|
|
|
5244
5280
|
// Mark as validated in session memory
|
|
5245
5281
|
markApiKeyAsValidated(apiKey, finalServerUrl);
|
|
5246
5282
|
// Store credentials in server context for external logging
|
|
5247
|
-
setCredentials({ apiKey, serverUrl: finalServerUrl });
|
|
5283
|
+
setCredentials({ apiKey, serverUrl: finalServerUrl, keySource });
|
|
5284
|
+
// This call's events were seeded before the key was pinned; report the pinned key's source instead.
|
|
5285
|
+
recordToolTelemetry({ api_key_source: keySource });
|
|
5248
5286
|
const successMessage = foundIn
|
|
5249
5287
|
? `Eyes authentication successful! API key found in ${foundIn}`
|
|
5250
5288
|
: 'Eyes authentication successful!';
|
|
@@ -5254,7 +5292,7 @@ async function verifyApiKey(input = {}) {
|
|
|
5254
5292
|
}
|
|
5255
5293
|
catch {
|
|
5256
5294
|
// Return invalid for any error (401, network, etc.)
|
|
5257
|
-
reportUnvalidatedKey(apiKey);
|
|
5295
|
+
reportUnvalidatedKey(apiKey, keySource);
|
|
5258
5296
|
return {
|
|
5259
5297
|
message: wrapText('Eyes authentication failed. Please verify that your API Key or server URL is correct. Visit our documentation to learn how to retrieve these values: https://applitools.com/docs/eyes/playwright#set-your-applitools-api-key', 'suffix'),
|
|
5260
5298
|
};
|
|
@@ -6911,6 +6949,10 @@ function getWriteApiKey(urlForAccountHint) {
|
|
|
6911
6949
|
note: 'Note: this must be a write-capable key — different from APPLITOOLS_READ_KEY, used by eyes_inspect_* tools.',
|
|
6912
6950
|
}, urlForAccountHint);
|
|
6913
6951
|
}
|
|
6952
|
+
/** Whether `APPLITOOLS_WRITE_KEY` is configured — decides the review tools' default `mode`. */
|
|
6953
|
+
function hasWriteApiKey() {
|
|
6954
|
+
return Boolean(process.env.APPLITOOLS_WRITE_KEY);
|
|
6955
|
+
}
|
|
6914
6956
|
/** Every `eyes_inspect_*` tool's own `ApiKeyProvider` — read access only, never a write key. */
|
|
6915
6957
|
function readOnlyApiKeyProvider(urlForAccountHint) {
|
|
6916
6958
|
return new StaticApiKeyProvider({ readKey: getReadApiKey(urlForAccountHint) });
|
|
@@ -8130,9 +8172,9 @@ function hasReachedRootScope(level, rootScope) {
|
|
|
8130
8172
|
return level === rootScope;
|
|
8131
8173
|
}
|
|
8132
8174
|
const MODES = ['inspect', 'resolve'];
|
|
8133
|
-
/** `mode`, defaulted
|
|
8134
|
-
function resolveMode(mode) {
|
|
8135
|
-
return mode !== null && mode !== void 0 ? mode : 'resolve';
|
|
8175
|
+
/** `mode`, defaulted when the caller omits it to `'resolve'` if a write key is configured, else to `'inspect'` so a read-only setup can still review. */
|
|
8176
|
+
function resolveMode(mode, hasWriteKey) {
|
|
8177
|
+
return mode !== null && mode !== void 0 ? mode : (hasWriteKey ? 'resolve' : 'inspect');
|
|
8136
8178
|
}
|
|
8137
8179
|
/**
|
|
8138
8180
|
* The only way to build a `NextCall` — `rootScope` and `mode` are required parameters, not something
|
|
@@ -8682,17 +8724,17 @@ const RootScopeShape = zod.z
|
|
|
8682
8724
|
const ModeShape = zod.z
|
|
8683
8725
|
.enum(MODES)
|
|
8684
8726
|
.optional()
|
|
8685
|
-
.describe('What this investigation is for.
|
|
8686
|
-
'
|
|
8727
|
+
.describe('What this investigation is for. Leave it unspecified for a plain "review"/"check"/"look at" request: the server ' +
|
|
8728
|
+
'then uses "resolve" when a write key is configured and "inspect" when it is not. "inspect" only reads and ' +
|
|
8729
|
+
'reports, with no mutation at all. "resolve" additionally acts on what it finds: ' +
|
|
8687
8730
|
"each diff's dynamic content is masked with a match region as it is reported, and each step is deterministically " +
|
|
8688
8731
|
'accepted/rejected/left-unresolved from its own findings. These are pending, undoable decisions, not a commit — ' +
|
|
8689
8732
|
'eyes_resolve_save (a separate, later call requiring its own explicit user approval) is what actually writes ' +
|
|
8690
|
-
'them to the baseline, and eyes_resolve_reset can discard them before that. So do not
|
|
8691
|
-
'
|
|
8692
|
-
'
|
|
8693
|
-
'
|
|
8694
|
-
'or
|
|
8695
|
-
'batch" does not qualify and should use the resolve default. Only specify it at the top of a traversal, or when ' +
|
|
8733
|
+
'them to the baseline, and eyes_resolve_reset can discard them before that. So do not pick "inspect" out of ' +
|
|
8734
|
+
'general caution about mutating actions — that caution belongs at the eyes_resolve_save step. Pass "inspect" ' +
|
|
8735
|
+
'only when the user explicitly asks to just describe the differences or not to resolve anything (e.g. "just ' +
|
|
8736
|
+
'tell me what changed", "don\'t resolve anything yet"), and "resolve" only when the user explicitly asks to ' +
|
|
8737
|
+
'accept/reject steps or mask differences. Only specify it at the top of a traversal, or when ' +
|
|
8696
8738
|
"a prior call's `next` output already indicated one — and then pass that value through as given, never omitted " +
|
|
8697
8739
|
'or modified.');
|
|
8698
8740
|
const RestartShape = zod.z
|
|
@@ -9693,6 +9735,15 @@ async function decideOrCreditStepAction(params) {
|
|
|
9693
9735
|
resolution: { accepted: live === 'accepted' ? 1 : 0, rejected: live === 'rejected' ? 1 : 0, unresolved: 0 },
|
|
9694
9736
|
};
|
|
9695
9737
|
}
|
|
9738
|
+
// An inspect walk offers structural steps as ordinary children; promoting one must still follow §5's rules.
|
|
9739
|
+
const structural = classifyStructuralSteps(session).find(s => s.stepIndex === stepIndex);
|
|
9740
|
+
if ((structural === null || structural === void 0 ? void 0 : structural.kind) === 'new-no-baseline') {
|
|
9741
|
+
return { action: null, resolution: { accepted: 0, rejected: 0, unresolved: 1 } };
|
|
9742
|
+
}
|
|
9743
|
+
if ((structural === null || structural === void 0 ? void 0 : structural.kind) === 'aborted-missing-checkpoint') {
|
|
9744
|
+
await resolveStep(sessionUrl, stepIndex, 'reject', keys, null);
|
|
9745
|
+
return { action: 'reject', resolution: { accepted: 0, rejected: 1, unresolved: 0 } };
|
|
9746
|
+
}
|
|
9696
9747
|
const action = decideStepAction(findings, stepRegions);
|
|
9697
9748
|
const resolution = await resolveStepForAction({ sessionUrl, stepIndex, action, keys, deps });
|
|
9698
9749
|
return { action, resolution };
|
|
@@ -9720,6 +9771,10 @@ function promoteSubtreeToResolve(rootLevel, ctx, keys, deps) {
|
|
|
9720
9771
|
return walkSubtree(rootLevel, ctx, async (level, nodeCtx, scopeId) => {
|
|
9721
9772
|
if (getScopeMode(scopeId, deps) !== 'inspect')
|
|
9722
9773
|
return;
|
|
9774
|
+
// Unfinished: nothing to replay yet. Switching its mode keeps the parent-mode gate from sending the
|
|
9775
|
+
// resumed walk back to inspect; its own `_end` decides it.
|
|
9776
|
+
if (!isCompleted(scopeId, deps))
|
|
9777
|
+
return recordScopeMode(scopeId, 'resolve', deps);
|
|
9723
9778
|
if (level === 'diff') {
|
|
9724
9779
|
const findings = getCompletion(scopeId, deps).payload;
|
|
9725
9780
|
const promoted = await applyRegionMasking({
|
|
@@ -10349,13 +10404,13 @@ async function maybeDiscard(restart, level, ctx, deps) {
|
|
|
10349
10404
|
// ---------------------------------------------------------------------------
|
|
10350
10405
|
// Transparent inspect→resolve promotion (see `resolution.ts`'s own §7 doc comment for the full
|
|
10351
10406
|
// mechanics) — triggered here, at the top of every command function, whenever this exact call's
|
|
10352
|
-
// own scope is
|
|
10407
|
+
// own scope is cached under `mode: 'inspect'`, finished or not, but `mode: 'resolve'` is now wanted.
|
|
10353
10408
|
// A `restart` call never promotes — it just discarded this rootScope, so there's nothing cached left
|
|
10354
10409
|
// to promote.
|
|
10355
10410
|
// ---------------------------------------------------------------------------
|
|
10356
10411
|
async function promoteIfNeeded(params) {
|
|
10357
10412
|
const { level, scopeId, ctx, mode, restart, keys, deps } = params;
|
|
10358
|
-
if (restart || mode !== 'resolve' ||
|
|
10413
|
+
if (restart || mode !== 'resolve' || getScopeMode(scopeId, deps) !== 'inspect')
|
|
10359
10414
|
return;
|
|
10360
10415
|
await promoteSubtreeToResolve(level, ctx, keys, deps);
|
|
10361
10416
|
}
|
|
@@ -11376,7 +11431,7 @@ function registerReviewTools(server, deps = defaultPhaseTrackerDeps) {
|
|
|
11376
11431
|
}, async ({ scope, batchUrl, scenarioName, sessionUrl, stepIndex, rootScope: rawRootScope, mode: rawMode, restart }) => {
|
|
11377
11432
|
const rootScope = resolveRootScope(scope, rawRootScope);
|
|
11378
11433
|
const rootScopeOmitted = rawRootScope === undefined;
|
|
11379
|
-
const mode = resolveMode(rawMode);
|
|
11434
|
+
const mode = resolveMode(rawMode, hasWriteApiKey());
|
|
11380
11435
|
recordReviewCall(scope, mode);
|
|
11381
11436
|
const result = await (async () => {
|
|
11382
11437
|
switch (scope) {
|
|
@@ -11426,7 +11481,7 @@ function registerReviewTools(server, deps = defaultPhaseTrackerDeps) {
|
|
|
11426
11481
|
}, async ({ scope, batchUrl, scenarioName, sessionUrl, stepIndex, findings: rawFindingsArg, rootScope: rawRootScope, mode: rawMode, restart, }) => {
|
|
11427
11482
|
const rootScope = resolveRootScope(scope, rawRootScope);
|
|
11428
11483
|
const rootScopeOmitted = rawRootScope === undefined;
|
|
11429
|
-
const mode = resolveMode(rawMode);
|
|
11484
|
+
const mode = resolveMode(rawMode, hasWriteApiKey());
|
|
11430
11485
|
recordReviewCall(scope, mode);
|
|
11431
11486
|
const rawFindings = await resolveJsonArg(rawFindingsArg, 'findings');
|
|
11432
11487
|
const summaryFindings = () => findingsFor(SummaryExampleShape, rawFindings, scope);
|
|
@@ -11487,7 +11542,7 @@ function registerReviewTools(server, deps = defaultPhaseTrackerDeps) {
|
|
|
11487
11542
|
}, async ({ sessionUrl, stepIndex, reports: rawReportsArg, rootScope: rawRootScope, mode: rawMode, restart }) => {
|
|
11488
11543
|
const rootScope = resolveRootScope('diff', rawRootScope);
|
|
11489
11544
|
const rootScopeOmitted = rawRootScope === undefined;
|
|
11490
|
-
const mode = resolveMode(rawMode);
|
|
11545
|
+
const mode = resolveMode(rawMode, hasWriteApiKey());
|
|
11491
11546
|
recordReviewCall('diff', mode);
|
|
11492
11547
|
const keys = reviewApiKeyProvider(sessionUrl, mode);
|
|
11493
11548
|
const rawReports = await resolveJsonArg(rawReportsArg, 'reports');
|