digital-ai-testing-mcp 1.2.8 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -46
- package/dist/api/browser-inspection.d.ts.map +1 -1
- package/dist/api/browser-inspection.js +14 -15
- package/dist/api/browser-inspection.js.map +1 -1
- package/dist/api/client.d.ts +7 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +9 -0
- package/dist/api/client.js.map +1 -1
- package/dist/api/projects.d.ts +16 -3
- package/dist/api/projects.d.ts.map +1 -1
- package/dist/api/projects.js +60 -18
- package/dist/api/projects.js.map +1 -1
- package/dist/api/reporting.d.ts +91 -0
- package/dist/api/reporting.d.ts.map +1 -1
- package/dist/api/reporting.js +182 -8
- package/dist/api/reporting.js.map +1 -1
- package/dist/api/test-orchestrator.d.ts +59 -0
- package/dist/api/test-orchestrator.d.ts.map +1 -0
- package/dist/api/test-orchestrator.js +126 -0
- package/dist/api/test-orchestrator.js.map +1 -0
- package/dist/api/test-runs.d.ts +80 -0
- package/dist/api/test-runs.d.ts.map +1 -0
- package/dist/api/test-runs.js +209 -0
- package/dist/api/test-runs.js.map +1 -0
- package/dist/api/test-views.d.ts.map +1 -1
- package/dist/api/test-views.js +5 -1
- package/dist/api/test-views.js.map +1 -1
- package/dist/api/transactions.d.ts +6 -0
- package/dist/api/transactions.d.ts.map +1 -1
- package/dist/api/transactions.js +19 -3
- package/dist/api/transactions.js.map +1 -1
- package/dist/api/usage-reports.d.ts.map +1 -1
- package/dist/api/usage-reports.js +3 -3
- package/dist/api/usage-reports.js.map +1 -1
- package/dist/api/webdriver.d.ts +44 -1
- package/dist/api/webdriver.d.ts.map +1 -1
- package/dist/api/webdriver.js +194 -67
- package/dist/api/webdriver.js.map +1 -1
- package/dist/index.js +80 -32
- package/dist/index.js.map +1 -1
- package/dist/tools/agent-tools.js +2 -2
- package/dist/tools/agent-tools.js.map +1 -1
- package/dist/tools/application-tools.d.ts.map +1 -1
- package/dist/tools/application-tools.js +5 -4
- package/dist/tools/application-tools.js.map +1 -1
- package/dist/tools/boilerplate-tools.d.ts +3 -0
- package/dist/tools/boilerplate-tools.d.ts.map +1 -1
- package/dist/tools/boilerplate-tools.js +301 -20
- package/dist/tools/boilerplate-tools.js.map +1 -1
- package/dist/tools/browser-tools.d.ts.map +1 -1
- package/dist/tools/browser-tools.js +8 -5
- package/dist/tools/browser-tools.js.map +1 -1
- package/dist/tools/device-group-tools.js +5 -5
- package/dist/tools/device-group-tools.js.map +1 -1
- package/dist/tools/device-tools.d.ts.map +1 -1
- package/dist/tools/device-tools.js +5 -4
- package/dist/tools/device-tools.js.map +1 -1
- package/dist/tools/health-tools.d.ts.map +1 -1
- package/dist/tools/health-tools.js +5 -4
- package/dist/tools/health-tools.js.map +1 -1
- package/dist/tools/inspection-tools.d.ts.map +1 -1
- package/dist/tools/inspection-tools.js +112 -10
- package/dist/tools/inspection-tools.js.map +1 -1
- package/dist/tools/meta-tools.d.ts +4 -1
- package/dist/tools/meta-tools.d.ts.map +1 -1
- package/dist/tools/meta-tools.js +62 -36
- package/dist/tools/meta-tools.js.map +1 -1
- package/dist/tools/performance-tools.d.ts.map +1 -1
- package/dist/tools/performance-tools.js +1 -7
- package/dist/tools/performance-tools.js.map +1 -1
- package/dist/tools/project-tools.d.ts.map +1 -1
- package/dist/tools/project-tools.js +38 -19
- package/dist/tools/project-tools.js.map +1 -1
- package/dist/tools/provisioning-profile-tools.d.ts.map +1 -1
- package/dist/tools/provisioning-profile-tools.js +5 -4
- package/dist/tools/provisioning-profile-tools.js.map +1 -1
- package/dist/tools/remediation-tools.d.ts +7 -0
- package/dist/tools/remediation-tools.d.ts.map +1 -0
- package/dist/tools/remediation-tools.js +50 -0
- package/dist/tools/remediation-tools.js.map +1 -0
- package/dist/tools/reporting-tools.d.ts.map +1 -1
- package/dist/tools/reporting-tools.js +369 -136
- package/dist/tools/reporting-tools.js.map +1 -1
- package/dist/tools/repository-tools.d.ts.map +1 -1
- package/dist/tools/repository-tools.js +5 -4
- package/dist/tools/repository-tools.js.map +1 -1
- package/dist/tools/reservation-tools.js +2 -2
- package/dist/tools/reservation-tools.js.map +1 -1
- package/dist/tools/test-run-tools.d.ts +3 -0
- package/dist/tools/test-run-tools.d.ts.map +1 -0
- package/dist/tools/test-run-tools.js +284 -0
- package/dist/tools/test-run-tools.js.map +1 -0
- package/dist/tools/test-view-tools.d.ts.map +1 -1
- package/dist/tools/test-view-tools.js +11 -11
- package/dist/tools/test-view-tools.js.map +1 -1
- package/dist/tools/toolset-tools.d.ts +8 -0
- package/dist/tools/toolset-tools.d.ts.map +1 -0
- package/dist/tools/toolset-tools.js +40 -0
- package/dist/tools/toolset-tools.js.map +1 -0
- package/dist/tools/transaction-tools.d.ts.map +1 -1
- package/dist/tools/transaction-tools.js +17 -7
- package/dist/tools/transaction-tools.js.map +1 -1
- package/dist/tools/usage-report-tools.d.ts.map +1 -1
- package/dist/tools/usage-report-tools.js +43 -15
- package/dist/tools/usage-report-tools.js.map +1 -1
- package/dist/tools/user-tools.js +2 -2
- package/dist/tools/user-tools.js.map +1 -1
- package/dist/tools/web-inspection-tools.d.ts.map +1 -1
- package/dist/tools/web-inspection-tools.js +39 -26
- package/dist/tools/web-inspection-tools.js.map +1 -1
- package/dist/tools/workflow-tools.js +1 -1
- package/dist/types/digital-ai.d.ts +18 -3
- package/dist/types/digital-ai.d.ts.map +1 -1
- package/dist/utils/browser-name.d.ts +2 -0
- package/dist/utils/browser-name.d.ts.map +1 -0
- package/dist/utils/browser-name.js +19 -0
- package/dist/utils/browser-name.js.map +1 -0
- package/dist/utils/command-payload.d.ts +19 -0
- package/dist/utils/command-payload.d.ts.map +1 -0
- package/dist/utils/command-payload.js +13 -0
- package/dist/utils/command-payload.js.map +1 -0
- package/dist/utils/csv.d.ts +6 -0
- package/dist/utils/csv.d.ts.map +1 -1
- package/dist/utils/csv.js +28 -2
- package/dist/utils/csv.js.map +1 -1
- package/dist/utils/locality.d.ts +7 -0
- package/dist/utils/locality.d.ts.map +1 -1
- package/dist/utils/locality.js +19 -0
- package/dist/utils/locality.js.map +1 -1
- package/dist/utils/maestro-flow.d.ts +38 -0
- package/dist/utils/maestro-flow.d.ts.map +1 -0
- package/dist/utils/maestro-flow.js +114 -0
- package/dist/utils/maestro-flow.js.map +1 -0
- package/dist/utils/metric-semantics.d.ts +22 -0
- package/dist/utils/metric-semantics.d.ts.map +1 -0
- package/dist/utils/metric-semantics.js +24 -0
- package/dist/utils/metric-semantics.js.map +1 -0
- package/dist/utils/pagination.d.ts +11 -0
- package/dist/utils/pagination.d.ts.map +1 -1
- package/dist/utils/pagination.js +16 -0
- package/dist/utils/pagination.js.map +1 -1
- package/dist/utils/remediation.d.ts +130 -0
- package/dist/utils/remediation.d.ts.map +1 -0
- package/dist/utils/remediation.js +424 -0
- package/dist/utils/remediation.js.map +1 -0
- package/dist/utils/report-ref.d.ts +23 -0
- package/dist/utils/report-ref.d.ts.map +1 -0
- package/dist/utils/report-ref.js +31 -0
- package/dist/utils/report-ref.js.map +1 -0
- package/dist/utils/response-formatter.d.ts +2 -1
- package/dist/utils/response-formatter.d.ts.map +1 -1
- package/dist/utils/response-formatter.js +32 -21
- package/dist/utils/response-formatter.js.map +1 -1
- package/dist/utils/test-orchestrator.d.ts +102 -0
- package/dist/utils/test-orchestrator.d.ts.map +1 -0
- package/dist/utils/test-orchestrator.js +236 -0
- package/dist/utils/test-orchestrator.js.map +1 -0
- package/dist/utils/test-status.d.ts +48 -0
- package/dist/utils/test-status.d.ts.map +1 -0
- package/dist/utils/test-status.js +92 -0
- package/dist/utils/test-status.js.map +1 -0
- package/dist/utils/tool-catalog.d.ts +6 -0
- package/dist/utils/tool-catalog.d.ts.map +1 -0
- package/dist/utils/tool-catalog.js +15 -0
- package/dist/utils/tool-catalog.js.map +1 -0
- package/dist/utils/toolsets.d.ts +79 -0
- package/dist/utils/toolsets.d.ts.map +1 -0
- package/dist/utils/toolsets.js +156 -0
- package/dist/utils/toolsets.js.map +1 -0
- package/dist/utils/usage-report-guard.d.ts +7 -0
- package/dist/utils/usage-report-guard.d.ts.map +1 -1
- package/dist/utils/usage-report-guard.js +18 -1
- package/dist/utils/usage-report-guard.js.map +1 -1
- package/dist/utils/usage-report-summary.d.ts +12 -0
- package/dist/utils/usage-report-summary.d.ts.map +1 -1
- package/dist/utils/usage-report-summary.js +25 -6
- package/dist/utils/usage-report-summary.js.map +1 -1
- package/package.json +41 -4
- package/resources/boilerplate/Android-Native/Java JUnit5/gradle +6 -1
- package/resources/boilerplate/Android-Native/Java JUnit5/gradle-oss +6 -1
- package/resources/boilerplate/Android-Native/java TestNG/AndroidNative-oss.java +2 -2
- package/resources/boilerplate/Android-Native/java TestNG/AndroidNative.java +2 -2
- package/resources/boilerplate/Android-Native/java TestNG/gradle +1 -1
- package/resources/boilerplate/Android-Native/java TestNG/gradle-oss +1 -1
- package/resources/boilerplate/iOS-Native/java-JUnit5/gradle +6 -1
- package/resources/boilerplate/iOS-Native/java-JUnit5/gradle-oss +6 -1
- package/resources/boilerplate/iOS-Native/java-TestNG/gradle +1 -1
- package/resources/boilerplate/iOS-Native/java-TestNG/gradle-oss +1 -1
- package/resources/boilerplate/iOS-Native/java-TestNG/iOSNative-oss.java +2 -2
- package/resources/boilerplate/iOS-Native/java-TestNG/iOSNative.java +2 -2
- package/resources/test-orchestrator/agent.json +19 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Digital.ai Test Orchestrator ("Smart Agent") — pure generation helpers for get_test_boilerplate.
|
|
3
|
+
*
|
|
4
|
+
* The orchestrator is a JVM agent attached with `-javaagent:<jar>=<config.yml>`. It hooks the test runner
|
|
5
|
+
* (JUnit 5 / TestNG) and the Appium driver: automatic retries, Reporter status sync, test selection, fail-fast,
|
|
6
|
+
* Build/Run IDs. Test code does not change. Release notes (26.9): "Available for Appium Server tests with JUnit
|
|
7
|
+
* and TestNG" — so it applies ONLY to the Java templates on Appium Server (OSS) projects.
|
|
8
|
+
*
|
|
9
|
+
* Verified live (2026-10-08, uscloud, java-client 8.6.0 + UiAutomator2Options/XCUITestOptions, TestNG and JUnit 5,
|
|
10
|
+
* Gradle and Maven): the agent injected digitalai:testCaseId / runId / retryAttempt, retried a failed test in a fresh
|
|
11
|
+
* session, and stamped buildId/runId on the Reporter records. Its status-sync calls use java.net.http and need a JDK
|
|
12
|
+
* whose truststore holds "SSL.com TLS RSA Root CA 2022" (uscloud's chain root): JDK 21.0.2 lacks it and the sync
|
|
13
|
+
* fails silently, leaving Reporter with the Appium session's status; JDK 25.0.1 has it.
|
|
14
|
+
*
|
|
15
|
+
* Generated wiring is "orchestration-ready": the agent is attached — and the Java 17 compile level applied — only
|
|
16
|
+
* when lib/smart-agent.jar exists AND DIGITAL_AI_ACCESS_KEY is set (the agent's YAML requires cloud.accessKey; it is
|
|
17
|
+
* rendered from that env var at build time into orchestrator/rendered/, which is git-ignored by a file we own, so the
|
|
18
|
+
* key never lands in a tracked file and no root .gitignore has to be touched). Otherwise tests run exactly as the
|
|
19
|
+
* classic boilerplate does.
|
|
20
|
+
*
|
|
21
|
+
* Pure: no filesystem, no network — unit-tested in tests/test-orchestrator.test.ts.
|
|
22
|
+
*/
|
|
23
|
+
export const AGENT_PROJECT_PATH = 'lib/smart-agent.jar';
|
|
24
|
+
export const CONFIG_TEMPLATE_PATH = 'orchestrator/config.template.yml';
|
|
25
|
+
/** Rendered (key-bearing) copies land here; ORCHESTRATOR_GITIGNORE keeps them out of git regardless of the root .gitignore. */
|
|
26
|
+
export const RENDERED_CONFIG_DIR = 'orchestrator/rendered';
|
|
27
|
+
export const ORCHESTRATOR_GITIGNORE_PATH = 'orchestrator/.gitignore';
|
|
28
|
+
export const ORCHESTRATOR_GITIGNORE = '# Rendered agent config — contains the access key. Never commit.\nrendered/\n';
|
|
29
|
+
export const LIB_GITIGNORE_PATH = 'lib/.gitignore';
|
|
30
|
+
export const LIB_GITIGNORE = '# Test Orchestrator agent (~12 MB binary) — install with install_test_orchestrator_agent, do not commit.\nsmart-agent.jar\n';
|
|
31
|
+
export const GITIGNORE_ADVICE = 'No root .gitignore is generated (it would overwrite yours). The key-bearing rendered config and the agent JAR are ' +
|
|
32
|
+
'already covered by orchestrator/.gitignore and lib/.gitignore. Add `smart-agent/` (per-run agent logs) and, if not ' +
|
|
33
|
+
'already present, `build/` / `target/` / `.gradle/` to your own .gitignore.';
|
|
34
|
+
export const DEFAULT_MAX_RETRY_ATTEMPTS = 2;
|
|
35
|
+
export function decideOrchestration(opts) {
|
|
36
|
+
const { mode, language, isAppiumOss } = opts;
|
|
37
|
+
if (mode === 'off') {
|
|
38
|
+
return { enabled: false, reason: 'Disabled by request (orchestration: "off") — classic non-orchestrated boilerplate.', requestedButNotApplied: false };
|
|
39
|
+
}
|
|
40
|
+
const notApplied = (reason) => ({ enabled: false, reason, requestedButNotApplied: mode === 'on' });
|
|
41
|
+
if (language !== 'java-junit5' && language !== 'java-testng') {
|
|
42
|
+
return notApplied('Test Orchestrator is a Java agent — it supports JUnit 5 and TestNG only, not ' + (language === 'python' ? 'Python' : 'NodeJS/WebdriverIO') + '.');
|
|
43
|
+
}
|
|
44
|
+
if (isAppiumOss === undefined) {
|
|
45
|
+
return notApplied('The project\'s server mode (Appium Server vs Appium Grid) could not be determined because the account lookup failed, ' +
|
|
46
|
+
'so orchestration was not applied. Retry, or pass orchestration: "on" once the lookup succeeds.');
|
|
47
|
+
}
|
|
48
|
+
if (!isAppiumOss) {
|
|
49
|
+
return notApplied('This project runs on Appium Grid; Test Orchestrator supports Appium Server (OSS) projects only.');
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
enabled: true,
|
|
53
|
+
reason: mode === 'on'
|
|
54
|
+
? 'Enabled by request (Java + Appium Server project).'
|
|
55
|
+
: 'Enabled by default for Java (JUnit 5 / TestNG) on an Appium Server project. Pass orchestration: "off" for the classic boilerplate.',
|
|
56
|
+
requestedButNotApplied: false,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Retries default to 2, but a test that is DESIGNED to fail (the placeholder scaffold) or one whose samples feed a
|
|
61
|
+
* performance comparison must not be re-run: retries would multiply failed reports / skew transaction sample counts.
|
|
62
|
+
*/
|
|
63
|
+
export function resolveMaxRetryAttempts(opts) {
|
|
64
|
+
if (opts.requested !== undefined)
|
|
65
|
+
return { value: opts.requested };
|
|
66
|
+
if (opts.placeholderBody) {
|
|
67
|
+
return { value: 0, note: 'maxRetryAttempts set to 0: the test body is a placeholder that fails by design — retries would only multiply failed reports. Raise it once real steps are in place.' };
|
|
68
|
+
}
|
|
69
|
+
if (opts.performanceTransactions) {
|
|
70
|
+
return { value: 0, note: 'maxRetryAttempts set to 0: retried attempts would add extra performance transactions and skew comparison sample counts.' };
|
|
71
|
+
}
|
|
72
|
+
return { value: DEFAULT_MAX_RETRY_ATTEMPTS };
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* YAML for the agent. Only cloud + run settings — device query, app and region stay in code (one source of truth).
|
|
76
|
+
* The access-key placeholder appears EXACTLY once (the accessKey line): both Gradle's ReplaceTokens and Maven's
|
|
77
|
+
* resource filtering substitute every occurrence of the delimited token, so the comments must not spell it out.
|
|
78
|
+
*/
|
|
79
|
+
export function buildConfigTemplate(opts) {
|
|
80
|
+
const hub = opts.instanceUrl.replace(/\/+$/, '').replace(/\/wd\/hub$/, '') + '/wd/hub';
|
|
81
|
+
return [
|
|
82
|
+
'# Digital.ai Test Orchestrator (Smart Agent) configuration — generated by digital-ai-testing-mcp.',
|
|
83
|
+
'#',
|
|
84
|
+
`# This is a TEMPLATE. The build renders it into ${RENDERED_CONFIG_DIR}/ (git-ignored), replacing the`,
|
|
85
|
+
'# access-key token below with the DIGITAL_AI_ACCESS_KEY environment variable — so the key never lands in a',
|
|
86
|
+
'# file under source control. Do not paste the key here.',
|
|
87
|
+
'#',
|
|
88
|
+
'# Capabilities set in your test code still apply. Anything ALSO set in this file overrides the code value;',
|
|
89
|
+
'# device query, app and region are deliberately left in code. Indent with spaces only.',
|
|
90
|
+
'',
|
|
91
|
+
'cloud:',
|
|
92
|
+
` url: ${hub}`,
|
|
93
|
+
' accessKey: @DIGITAL_AI_ACCESS_KEY@',
|
|
94
|
+
'',
|
|
95
|
+
'run:',
|
|
96
|
+
' # Retry each FAILED test up to N more times. Every attempt is reported separately in Reporter.',
|
|
97
|
+
` maxRetryAttempts: ${opts.maxRetryAttempts}`,
|
|
98
|
+
'',
|
|
99
|
+
' # Run only some tests (empty = all): ClassName or ClassName#methodName',
|
|
100
|
+
' # testSelection:',
|
|
101
|
+
' # - LocalAndroidTest#quickStartAndroidNativeDemo',
|
|
102
|
+
'',
|
|
103
|
+
' # Fail fast: if a critical test still fails after its retries, remaining queued tests are Skipped.',
|
|
104
|
+
' # criticalTests:',
|
|
105
|
+
' # - LocalAndroidTest#quickStartAndroidNativeDemo',
|
|
106
|
+
'',
|
|
107
|
+
].join('\n');
|
|
108
|
+
}
|
|
109
|
+
const GRADLE_BLOCK = `
|
|
110
|
+
// ── Digital.ai Test Orchestrator ───────────────────────────────────────────────
|
|
111
|
+
// Attaches ${AGENT_PROJECT_PATH} to the test JVM when the JAR is present AND DIGITAL_AI_ACCESS_KEY is set; otherwise
|
|
112
|
+
// tests run exactly as without orchestration (a warning says why). Install the agent with the MCP tool
|
|
113
|
+
// install_test_orchestrator_agent. Requires a Java 17/21 JDK whose truststore includes your cloud's root CA.
|
|
114
|
+
def orchestratorJar = file('${AGENT_PROJECT_PATH}')
|
|
115
|
+
def orchestratorKey = System.getenv('DIGITAL_AI_ACCESS_KEY')
|
|
116
|
+
def orchestratorActive = orchestratorJar.exists() && orchestratorKey
|
|
117
|
+
|
|
118
|
+
if (orchestratorActive) {
|
|
119
|
+
// The agent needs a Java 17+ JVM — raised only when it is actually attached, so a JDK 11 build
|
|
120
|
+
// without the agent keeps working.
|
|
121
|
+
java {
|
|
122
|
+
sourceCompatibility = JavaVersion.VERSION_17
|
|
123
|
+
targetCompatibility = JavaVersion.VERSION_17
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
tasks.register('renderOrchestratorConfig', Copy) {
|
|
128
|
+
from '${CONFIG_TEMPLATE_PATH}'
|
|
129
|
+
into '${RENDERED_CONFIG_DIR}'
|
|
130
|
+
rename { 'config.yml' }
|
|
131
|
+
// The key is a real input: a rotated key must re-render. Hashed, so the credential never lands in task metadata.
|
|
132
|
+
inputs.property('orchestratorKeyFingerprint', (orchestratorKey ?: '').digest('SHA-256'))
|
|
133
|
+
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [DIGITAL_AI_ACCESS_KEY: orchestratorKey ?: ''])
|
|
134
|
+
}
|
|
135
|
+
clean { delete '${RENDERED_CONFIG_DIR}' }
|
|
136
|
+
|
|
137
|
+
test {
|
|
138
|
+
if (orchestratorActive) {
|
|
139
|
+
dependsOn 'renderOrchestratorConfig'
|
|
140
|
+
jvmArgs "-javaagent:\${orchestratorJar.absolutePath}=\${file('${RENDERED_CONFIG_DIR}/config.yml').absolutePath}",
|
|
141
|
+
"-Dbuild.id=\${System.getenv('BUILD_ID') ?: 'local'}"
|
|
142
|
+
} else {
|
|
143
|
+
def why = orchestratorJar.exists() ? 'DIGITAL_AI_ACCESS_KEY is not set' : '${AGENT_PROJECT_PATH} not found'
|
|
144
|
+
doFirst { logger.warn("Digital.ai Test Orchestrator NOT attached (\${why}) — running without retries or Reporter status sync.") }
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
/** Append the conditional agent wiring to a generated build.gradle. */
|
|
149
|
+
export function addOrchestrationToGradle(buildGradle) {
|
|
150
|
+
return buildGradle.replace(/\s*$/, '\n') + GRADLE_BLOCK;
|
|
151
|
+
}
|
|
152
|
+
const MAVEN_PROFILES = `
|
|
153
|
+
<!--
|
|
154
|
+
Digital.ai Test Orchestrator: these profiles activate only when ${AGENT_PROJECT_PATH} exists AND the
|
|
155
|
+
DIGITAL_AI_ACCESS_KEY environment variable is set (Maven ANDs activation conditions). Otherwise tests run
|
|
156
|
+
exactly as without orchestration. Install the agent with the MCP tool install_test_orchestrator_agent.
|
|
157
|
+
Requires a Java 17/21 JDK whose truststore includes your cloud's root CA.
|
|
158
|
+
-->
|
|
159
|
+
<profiles>
|
|
160
|
+
<profile>
|
|
161
|
+
<id>digitalai-test-orchestrator</id>
|
|
162
|
+
<activation>
|
|
163
|
+
<file><exists>\${basedir}/${AGENT_PROJECT_PATH}</exists></file>
|
|
164
|
+
<property><name>env.DIGITAL_AI_ACCESS_KEY</name></property>
|
|
165
|
+
</activation>
|
|
166
|
+
<properties>
|
|
167
|
+
<DIGITAL_AI_ACCESS_KEY>\${env.DIGITAL_AI_ACCESS_KEY}</DIGITAL_AI_ACCESS_KEY>
|
|
168
|
+
</properties>
|
|
169
|
+
<build>
|
|
170
|
+
<plugins>
|
|
171
|
+
<!-- The agent needs a Java 17+ JVM — raised only inside this profile, i.e. only when it is attached. -->
|
|
172
|
+
<plugin>
|
|
173
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
174
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
|
175
|
+
<configuration>
|
|
176
|
+
<release>17</release>
|
|
177
|
+
</configuration>
|
|
178
|
+
</plugin>
|
|
179
|
+
<plugin>
|
|
180
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
181
|
+
<artifactId>maven-resources-plugin</artifactId>
|
|
182
|
+
<version>3.3.1</version>
|
|
183
|
+
<executions>
|
|
184
|
+
<execution>
|
|
185
|
+
<id>render-orchestrator-config</id>
|
|
186
|
+
<phase>process-test-resources</phase>
|
|
187
|
+
<goals><goal>copy-resources</goal></goals>
|
|
188
|
+
<configuration>
|
|
189
|
+
<outputDirectory>\${basedir}/${RENDERED_CONFIG_DIR}</outputDirectory>
|
|
190
|
+
<resources>
|
|
191
|
+
<resource>
|
|
192
|
+
<directory>\${basedir}/orchestrator</directory>
|
|
193
|
+
<includes><include>config.template.yml</include></includes>
|
|
194
|
+
<filtering>true</filtering>
|
|
195
|
+
</resource>
|
|
196
|
+
</resources>
|
|
197
|
+
</configuration>
|
|
198
|
+
</execution>
|
|
199
|
+
</executions>
|
|
200
|
+
</plugin>
|
|
201
|
+
<plugin>
|
|
202
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
203
|
+
<artifactId>maven-surefire-plugin</artifactId>
|
|
204
|
+
<configuration>
|
|
205
|
+
<!-- Quoted: Surefire splits argLine on whitespace, so unquoted paths with spaces would break the JVM start. -->
|
|
206
|
+
<argLine>"-javaagent:\${basedir}/${AGENT_PROJECT_PATH}=\${basedir}/${RENDERED_CONFIG_DIR}/config.template.yml" -Dbuild.id=\${orchestrator.buildId}</argLine>
|
|
207
|
+
</configuration>
|
|
208
|
+
</plugin>
|
|
209
|
+
</plugins>
|
|
210
|
+
</build>
|
|
211
|
+
</profile>
|
|
212
|
+
<!-- Build ID groups a CI build's results in Reporter: BUILD_ID when CI provides it, else "local". -->
|
|
213
|
+
<profile>
|
|
214
|
+
<id>digitalai-test-orchestrator-build-id</id>
|
|
215
|
+
<activation><property><name>env.BUILD_ID</name></property></activation>
|
|
216
|
+
<properties><orchestrator.buildId>\${env.BUILD_ID}</orchestrator.buildId></properties>
|
|
217
|
+
</profile>
|
|
218
|
+
</profiles>
|
|
219
|
+
`;
|
|
220
|
+
/**
|
|
221
|
+
* Wire the agent into a generated pom.xml: a default Build ID property plus the activation profiles. The base compile
|
|
222
|
+
* level is left untouched — Java 17 is required only inside the agent profile.
|
|
223
|
+
*/
|
|
224
|
+
export function addOrchestrationToMaven(pom) {
|
|
225
|
+
const props = ' <properties>\n <orchestrator.buildId>local</orchestrator.buildId>\n </properties>\n';
|
|
226
|
+
let out = /<properties>/.test(pom)
|
|
227
|
+
? pom.replace('<properties>', '<properties>\n <orchestrator.buildId>local</orchestrator.buildId>')
|
|
228
|
+
: pom.replace(/(\n\s*<build>)/, `\n${props}$1`);
|
|
229
|
+
out = out.replace(/\s*<\/project>\s*$/, `\n${MAVEN_PROFILES}</project>\n`);
|
|
230
|
+
return out;
|
|
231
|
+
}
|
|
232
|
+
export const JDK_TRUST_NOTE = 'The agent reports retries and final status to Reporter over HTTPS using the JDK\'s own truststore. ' +
|
|
233
|
+
'Use a current Java 17/21 update: the cloud\'s certificate chains to "SSL.com TLS RSA Root CA 2022", which older ' +
|
|
234
|
+
'JDK builds (e.g. 21.0.2) do not include — there the sync fails silently and Reporter keeps the Appium session\'s ' +
|
|
235
|
+
'status instead of the test\'s real result. Look for "Async cloud API call failed" in smart-agent/<run-id>/*.log.';
|
|
236
|
+
//# sourceMappingURL=test-orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-orchestrator.js","sourceRoot":"","sources":["../../src/utils/test-orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,MAAM,CAAC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AACxD,MAAM,CAAC,MAAM,oBAAoB,GAAG,kCAAkC,CAAC;AACvE,+HAA+H;AAC/H,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,CAAC,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AACrE,MAAM,CAAC,MAAM,sBAAsB,GAAG,+EAA+E,CAAC;AACtH,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG,6HAA6H,CAAC;AAC3J,MAAM,CAAC,MAAM,gBAAgB,GAC3B,oHAAoH;IACpH,qHAAqH;IACrH,4EAA4E,CAAC;AAC/E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAU5C,MAAM,UAAU,mBAAmB,CAAC,IAKnC;IACC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IAC7C,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,OAAO,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BAAgB,mBAAmB;;;;;;;;;;;;;CAanH,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,MAAM,KAAK,GAAG,mGAAmG,CAAC;IAClH,IAAI,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;QAChC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,0EAA0E,CAAC;QACzG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC;IAClD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,KAAK,cAAc,cAAc,CAAC,CAAC;IAC3E,OAAO,GAAG,CAAC;AACb,CAAC;AAwBD,MAAM,CAAC,MAAM,cAAc,GACzB,qGAAqG;IACrG,kHAAkH;IAClH,mHAAmH;IACnH,kHAAkH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reporter test statuses — one definition of the status set, how each counts, and the pass rate.
|
|
3
|
+
*
|
|
4
|
+
* Verified live (2026-10-09) on POST /reporter/api/tests/grouped with pivotBy ["status"]: the reporter has SIX statuses,
|
|
5
|
+
* not three. Tools that hardcoded Passed/Failed/Incomplete silently dropped the rest — on the dev tenant ~27k Error
|
|
6
|
+
* records (the second-largest failure bucket) never appeared in any summary. Platform 26.9 made this worse: tests
|
|
7
|
+
* interrupted by a client crash or an infrastructure problem now end as Error ("Device Session ended before test
|
|
8
|
+
* completion") instead of Incomplete.
|
|
9
|
+
*
|
|
10
|
+
* status_code values observed live: Healed=5, Error=4, Skipped=3. `success` is FALSE for Healed (and for Error and
|
|
11
|
+
* Skipped), so `success` alone is not a reliable "passed" signal — classify by status.
|
|
12
|
+
*/
|
|
13
|
+
export declare const TEST_STATUSES: readonly ["Passed", "Failed", "Error", "Incomplete", "Skipped", "Healed"];
|
|
14
|
+
export type TestStatus = (typeof TEST_STATUSES)[number];
|
|
15
|
+
/** Passed outright, or passed after self-healing a locator. */
|
|
16
|
+
export declare const PASSING_STATUSES: readonly TestStatus[];
|
|
17
|
+
/** Failed an assertion (Failed) or ended abnormally — crash, infrastructure, session ended early (Error). */
|
|
18
|
+
export declare const FAILING_STATUSES: readonly TestStatus[];
|
|
19
|
+
export declare const PASS_RATE_BASIS = "(Passed + Healed) / (Passed + Healed + Failed + Error). Incomplete (still running, or ended without a verdict) and Skipped are excluded.";
|
|
20
|
+
export type StatusOutcome = 'pass' | 'fail' | 'other';
|
|
21
|
+
export declare function statusOutcome(status: string | null | undefined): StatusOutcome;
|
|
22
|
+
export interface StatusCounts {
|
|
23
|
+
passed: number;
|
|
24
|
+
failed: number;
|
|
25
|
+
error: number;
|
|
26
|
+
incomplete: number;
|
|
27
|
+
skipped: number;
|
|
28
|
+
healed: number;
|
|
29
|
+
/** Every record, including any status this code does not know yet. */
|
|
30
|
+
total: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function emptyStatusCounts(): StatusCounts;
|
|
33
|
+
/**
|
|
34
|
+
* Counts from a reporter pivot row — the shape returned by both POST /reporter/api/tests/grouped (pivotBy ["status"])
|
|
35
|
+
* and GET /reporter/api/testView/{id}/summary: { passedCount, failedCount, incompleteCount, skippedCount, errorCount,
|
|
36
|
+
* healedCount, _count_ }. Missing columns count as 0; `total` prefers the server's `_count_` so a status added later
|
|
37
|
+
* still shows up in the total even before this code learns its name.
|
|
38
|
+
*/
|
|
39
|
+
export declare function countsFromPivotRow(row: Record<string, unknown> | null | undefined): StatusCounts;
|
|
40
|
+
/** Tally a list of records (each with a `status`) — for client-side buckets over list results. */
|
|
41
|
+
export declare function tallyStatuses(records: Array<{
|
|
42
|
+
status?: string | null;
|
|
43
|
+
}>): StatusCounts;
|
|
44
|
+
/** Pass rate in percent (1 decimal) over decided outcomes — see PASS_RATE_BASIS. null when nothing has a verdict. */
|
|
45
|
+
export declare function passRate(c: StatusCounts): number | null;
|
|
46
|
+
/** Records not covered by the six known statuses (non-zero only if the platform adds a status). */
|
|
47
|
+
export declare function unknownStatusCount(c: StatusCounts): number;
|
|
48
|
+
//# sourceMappingURL=test-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-status.d.ts","sourceRoot":"","sources":["../../src/utils/test-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,aAAa,2EAA4E,CAAC;AACvG,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,EAAE,SAAS,UAAU,EAAyB,CAAC;AAC5E,6GAA6G;AAC7G,eAAO,MAAM,gBAAgB,EAAE,SAAS,UAAU,EAAwB,CAAC;AAE3E,eAAO,MAAM,eAAe,6IACgH,CAAC;AAE7I,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEtD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,CAI9E;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,iBAAiB,IAAI,YAAY,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,CAiBhG;AAED,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,GAAG,YAAY,CAetF;AAED,qHAAqH;AACrH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAIvD;AAED,mGAAmG;AACnG,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,CAE1D"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reporter test statuses — one definition of the status set, how each counts, and the pass rate.
|
|
3
|
+
*
|
|
4
|
+
* Verified live (2026-10-09) on POST /reporter/api/tests/grouped with pivotBy ["status"]: the reporter has SIX statuses,
|
|
5
|
+
* not three. Tools that hardcoded Passed/Failed/Incomplete silently dropped the rest — on the dev tenant ~27k Error
|
|
6
|
+
* records (the second-largest failure bucket) never appeared in any summary. Platform 26.9 made this worse: tests
|
|
7
|
+
* interrupted by a client crash or an infrastructure problem now end as Error ("Device Session ended before test
|
|
8
|
+
* completion") instead of Incomplete.
|
|
9
|
+
*
|
|
10
|
+
* status_code values observed live: Healed=5, Error=4, Skipped=3. `success` is FALSE for Healed (and for Error and
|
|
11
|
+
* Skipped), so `success` alone is not a reliable "passed" signal — classify by status.
|
|
12
|
+
*/
|
|
13
|
+
export const TEST_STATUSES = ['Passed', 'Failed', 'Error', 'Incomplete', 'Skipped', 'Healed'];
|
|
14
|
+
/** Passed outright, or passed after self-healing a locator. */
|
|
15
|
+
export const PASSING_STATUSES = ['Passed', 'Healed'];
|
|
16
|
+
/** Failed an assertion (Failed) or ended abnormally — crash, infrastructure, session ended early (Error). */
|
|
17
|
+
export const FAILING_STATUSES = ['Failed', 'Error'];
|
|
18
|
+
export const PASS_RATE_BASIS = '(Passed + Healed) / (Passed + Healed + Failed + Error). Incomplete (still running, or ended without a verdict) and Skipped are excluded.';
|
|
19
|
+
export function statusOutcome(status) {
|
|
20
|
+
if (PASSING_STATUSES.includes(status ?? ''))
|
|
21
|
+
return 'pass';
|
|
22
|
+
if (FAILING_STATUSES.includes(status ?? ''))
|
|
23
|
+
return 'fail';
|
|
24
|
+
return 'other';
|
|
25
|
+
}
|
|
26
|
+
export function emptyStatusCounts() {
|
|
27
|
+
return { passed: 0, failed: 0, error: 0, incomplete: 0, skipped: 0, healed: 0, total: 0 };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Counts from a reporter pivot row — the shape returned by both POST /reporter/api/tests/grouped (pivotBy ["status"])
|
|
31
|
+
* and GET /reporter/api/testView/{id}/summary: { passedCount, failedCount, incompleteCount, skippedCount, errorCount,
|
|
32
|
+
* healedCount, _count_ }. Missing columns count as 0; `total` prefers the server's `_count_` so a status added later
|
|
33
|
+
* still shows up in the total even before this code learns its name.
|
|
34
|
+
*/
|
|
35
|
+
export function countsFromPivotRow(row) {
|
|
36
|
+
const n = (k) => {
|
|
37
|
+
const v = Number(row?.[k] ?? 0);
|
|
38
|
+
return Number.isFinite(v) ? v : 0;
|
|
39
|
+
};
|
|
40
|
+
const c = {
|
|
41
|
+
passed: n('passedCount'),
|
|
42
|
+
failed: n('failedCount'),
|
|
43
|
+
error: n('errorCount'),
|
|
44
|
+
incomplete: n('incompleteCount'),
|
|
45
|
+
skipped: n('skippedCount'),
|
|
46
|
+
healed: n('healedCount'),
|
|
47
|
+
total: 0,
|
|
48
|
+
};
|
|
49
|
+
const known = c.passed + c.failed + c.error + c.incomplete + c.skipped + c.healed;
|
|
50
|
+
c.total = row?.['_count_'] != null ? Math.max(n('_count_'), known) : known;
|
|
51
|
+
return c;
|
|
52
|
+
}
|
|
53
|
+
/** Tally a list of records (each with a `status`) — for client-side buckets over list results. */
|
|
54
|
+
export function tallyStatuses(records) {
|
|
55
|
+
const c = emptyStatusCounts();
|
|
56
|
+
for (const r of records) {
|
|
57
|
+
c.total++;
|
|
58
|
+
switch (r.status) {
|
|
59
|
+
case 'Passed':
|
|
60
|
+
c.passed++;
|
|
61
|
+
break;
|
|
62
|
+
case 'Failed':
|
|
63
|
+
c.failed++;
|
|
64
|
+
break;
|
|
65
|
+
case 'Error':
|
|
66
|
+
c.error++;
|
|
67
|
+
break;
|
|
68
|
+
case 'Incomplete':
|
|
69
|
+
c.incomplete++;
|
|
70
|
+
break;
|
|
71
|
+
case 'Skipped':
|
|
72
|
+
c.skipped++;
|
|
73
|
+
break;
|
|
74
|
+
case 'Healed':
|
|
75
|
+
c.healed++;
|
|
76
|
+
break;
|
|
77
|
+
default: break; // unknown status: in total only
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return c;
|
|
81
|
+
}
|
|
82
|
+
/** Pass rate in percent (1 decimal) over decided outcomes — see PASS_RATE_BASIS. null when nothing has a verdict. */
|
|
83
|
+
export function passRate(c) {
|
|
84
|
+
const pass = c.passed + c.healed;
|
|
85
|
+
const decided = pass + c.failed + c.error;
|
|
86
|
+
return decided > 0 ? Math.round((pass / decided) * 1000) / 10 : null;
|
|
87
|
+
}
|
|
88
|
+
/** Records not covered by the six known statuses (non-zero only if the platform adds a status). */
|
|
89
|
+
export function unknownStatusCount(c) {
|
|
90
|
+
return Math.max(0, c.total - (c.passed + c.failed + c.error + c.incomplete + c.skipped + c.healed));
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=test-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-status.js","sourceRoot":"","sources":["../../src/utils/test-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAGvG,+DAA+D;AAC/D,MAAM,CAAC,MAAM,gBAAgB,GAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC5E,6GAA6G;AAC7G,MAAM,CAAC,MAAM,gBAAgB,GAA0B,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,eAAe,GAC1B,0IAA0I,CAAC;AAI7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,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,kBAAkB,CAAC,CAAe;IAChD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACtG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-catalog.d.ts","sourceRoot":"","sources":["../../src/utils/tool-catalog.ts"],"names":[],"mappings":"AAOA,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,IAAI,CAG3F;AAED,wBAAgB,cAAc,IAAI,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAEvE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which tools each module registered — filled once at startup from the captured registrations (src/index.ts), so
|
|
3
|
+
* get_server_info reports real per-area counts instead of hand-maintained numbers that drift (they had: "Reporting —
|
|
4
|
+
* 17 tools" while 23 were registered, and whole areas such as test runs were missing).
|
|
5
|
+
*/
|
|
6
|
+
const catalog = new Map();
|
|
7
|
+
export function setToolCatalog(tools) {
|
|
8
|
+
catalog.clear();
|
|
9
|
+
for (const { module, name } of tools)
|
|
10
|
+
catalog.set(module, [...(catalog.get(module) ?? []), name]);
|
|
11
|
+
}
|
|
12
|
+
export function getToolCatalog() {
|
|
13
|
+
return catalog;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=tool-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-catalog.js","sourceRoot":"","sources":["../../src/utils/tool-catalog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoB,CAAC;AAE5C,MAAM,UAAU,cAAc,CAAC,KAAsD;IACnF,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK;QAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACpG,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in toolsets (MCP_TOOLSETS) — cut the context cost of 200 tool definitions WITHOUT weakening the guidance that
|
|
3
|
+
* keeps agents using them correctly.
|
|
4
|
+
*
|
|
5
|
+
* Design constraint (the fidelity concern): many past misuse fixes live in tool descriptions, and descriptions
|
|
6
|
+
* cross-reference each other densely ("install_application first", "then start_inspection_session", prompts that walk
|
|
7
|
+
* five tools). Measured 2026-10-09: a transitive closure over those references pulls 69–79% of all tools into ANY
|
|
8
|
+
* single toolset, so "load only these tools" either saves nothing or leaves guidance pointing at tools that do not exist.
|
|
9
|
+
*
|
|
10
|
+
* So nothing is ever removed. Every tool stays registered under its real name:
|
|
11
|
+
* - tools in a selected toolset (and the core) keep their full description and parameters;
|
|
12
|
+
* - every other tool becomes a SELF-LOADING PLACEHOLDER: a one-line description, no parameters. Calling it loads its
|
|
13
|
+
* whole toolset on the spot (full definitions restored; clients that support tools/list_changed refresh) and returns
|
|
14
|
+
* the tool's FULL description and parameter guidance in the response, asking the agent to call it again — so the
|
|
15
|
+
* guidance arrives at the moment of use, before the real call runs.
|
|
16
|
+
* - Server instructions and prompts are unchanged; every name they mention exists.
|
|
17
|
+
* Unset / "all" registers everything in full — zero behaviour change for existing installs.
|
|
18
|
+
*/
|
|
19
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
20
|
+
export type RegisterFn = (server: McpServer) => void;
|
|
21
|
+
export interface CapturedTool {
|
|
22
|
+
name: string;
|
|
23
|
+
module: string;
|
|
24
|
+
description: string;
|
|
25
|
+
shape: Record<string, unknown>;
|
|
26
|
+
callback: (...a: unknown[]) => unknown;
|
|
27
|
+
args: unknown[];
|
|
28
|
+
}
|
|
29
|
+
export interface CapturedOther {
|
|
30
|
+
module: string;
|
|
31
|
+
args: unknown[];
|
|
32
|
+
}
|
|
33
|
+
export interface Captured {
|
|
34
|
+
tools: CapturedTool[];
|
|
35
|
+
prompts: CapturedOther[];
|
|
36
|
+
resources: CapturedOther[];
|
|
37
|
+
}
|
|
38
|
+
/** Run every register function against a recorder; nothing reaches a real server. */
|
|
39
|
+
export declare function captureRegistrations(modules: Array<[string, RegisterFn]>): Captured;
|
|
40
|
+
/** User-facing toolsets → tool modules. Every tool module except the core belongs to exactly one toolset. */
|
|
41
|
+
export declare const TOOLSETS: Record<string, {
|
|
42
|
+
modules: string[];
|
|
43
|
+
description: string;
|
|
44
|
+
}>;
|
|
45
|
+
/** Always loaded in full: connection/environment basics, toolset control, and the test-delivery backstop. */
|
|
46
|
+
export declare const CORE_MODULES: string[];
|
|
47
|
+
export declare const CORE_TOOLS: string[];
|
|
48
|
+
export declare function toolsetOfModule(module: string): string | null;
|
|
49
|
+
export interface Selection {
|
|
50
|
+
all: boolean;
|
|
51
|
+
toolsets: Set<string>;
|
|
52
|
+
unknown: string[];
|
|
53
|
+
}
|
|
54
|
+
export declare function parseToolsetSelection(raw: string | undefined): Selection;
|
|
55
|
+
/** "name (required): description" lines for a zod raw shape — the parameter guidance a placeholder hands back. */
|
|
56
|
+
export declare function describeShape(shape: Record<string, unknown>): string[];
|
|
57
|
+
/** Kept short — it repeats for every unloaded tool. enable_toolset's description explains the mechanism in full. */
|
|
58
|
+
export declare function placeholderDescription(tool: CapturedTool, toolset: string): string;
|
|
59
|
+
export interface ToolsetController {
|
|
60
|
+
/** Toolsets currently loaded in full (all toolsets when selection.all). */
|
|
61
|
+
loaded(): string[];
|
|
62
|
+
/** Load toolsets in full. Returns the tool names that changed from placeholder to full. */
|
|
63
|
+
enable(toolsets: string[]): string[];
|
|
64
|
+
/** Per-toolset summary for get_server_info / enable_toolset. */
|
|
65
|
+
summary(): Array<{
|
|
66
|
+
toolset: string;
|
|
67
|
+
description: string;
|
|
68
|
+
loaded: boolean;
|
|
69
|
+
tools: number;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Register every captured tool (full or placeholder), then prompts and resources, onto the real server.
|
|
74
|
+
* Placeholder-to-full restores use RegisteredTool.update(), which emits notifications/tools/list_changed.
|
|
75
|
+
*/
|
|
76
|
+
/** Optional callback wrapper (debug mode instruments every tool and placeholder through this). */
|
|
77
|
+
export type ToolWrapper = (name: string, callback: (...a: unknown[]) => unknown, placeholder: boolean) => (...a: unknown[]) => unknown;
|
|
78
|
+
export declare function registerWithToolsets(server: McpServer, captured: Captured, selection: Selection, wrap?: ToolWrapper): ToolsetController;
|
|
79
|
+
//# sourceMappingURL=toolsets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolsets.d.ts","sourceRoot":"","sources":["../../src/utils/toolsets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,yCAAyC,CAAC;AAEzF,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;AAErD,MAAM,WAAW,YAAY;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,M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