@browserstack/mcp-server 1.5.0-beta.20 → 1.5.0-beta.21

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.
Files changed (95) hide show
  1. package/README.md +48 -32
  2. package/dist/config.d.ts +4 -1
  3. package/dist/config.js +23 -2
  4. package/dist/index.d.ts +2 -1
  5. package/dist/index.js +7 -3
  6. package/dist/lib/constants.d.ts +3 -0
  7. package/dist/lib/constants.js +3 -0
  8. package/dist/lib/instrumentation.d.ts +14 -2
  9. package/dist/lib/instrumentation.js +104 -29
  10. package/dist/lib/node-version-notice.d.ts +1 -0
  11. package/dist/lib/node-version-notice.js +9 -0
  12. package/dist/lib/tool-latency.d.ts +4 -0
  13. package/dist/lib/tool-latency.js +16 -0
  14. package/dist/lib/untrusted-content.d.ts +15 -0
  15. package/dist/lib/untrusted-content.js +24 -0
  16. package/dist/lib/upload-validator.d.ts +3 -2
  17. package/dist/lib/upload-validator.js +18 -15
  18. package/dist/lib/utils.js +10 -3
  19. package/dist/lib/version-resolver.d.ts +0 -5
  20. package/dist/lib/version-resolver.js +8 -2
  21. package/dist/logger.js +1 -10
  22. package/dist/server-factory.js +10 -6
  23. package/dist/tools/accessibility.js +9 -5
  24. package/dist/tools/accessiblity-utils/accessibility-rag.js +3 -1
  25. package/dist/tools/appautomate-utils/native-execution/constants.js +4 -2
  26. package/dist/tools/appautomate.js +3 -1
  27. package/dist/tools/applive.js +1 -1
  28. package/dist/tools/ask-browserstack/central-oauth.d.ts +120 -0
  29. package/dist/tools/ask-browserstack/central-oauth.js +277 -0
  30. package/dist/tools/ask-browserstack/config.d.ts +102 -0
  31. package/dist/tools/ask-browserstack/config.js +140 -0
  32. package/dist/tools/ask-browserstack/egress.d.ts +34 -0
  33. package/dist/tools/ask-browserstack/egress.js +31 -0
  34. package/dist/tools/ask-browserstack/register.d.ts +61 -0
  35. package/dist/tools/ask-browserstack/register.js +416 -0
  36. package/dist/tools/ask-browserstack/relay.d.ts +201 -0
  37. package/dist/tools/ask-browserstack/relay.js +577 -0
  38. package/dist/tools/ask-browserstack/stream.d.ts +116 -0
  39. package/dist/tools/ask-browserstack/stream.js +236 -0
  40. package/dist/tools/ask-browserstack/types.d.ts +196 -0
  41. package/dist/tools/ask-browserstack/types.js +14 -0
  42. package/dist/tools/automate-utils/list-session-ids.d.ts +28 -0
  43. package/dist/tools/automate-utils/list-session-ids.js +87 -0
  44. package/dist/tools/automate-utils/resolve-hashed-build-id.d.ts +30 -0
  45. package/dist/tools/automate-utils/resolve-hashed-build-id.js +124 -0
  46. package/dist/tools/automate.d.ts +7 -0
  47. package/dist/tools/automate.js +104 -1
  48. package/dist/tools/bstack-sdk.js +2 -2
  49. package/dist/tools/build-insights.js +41 -2
  50. package/dist/tools/failurelogs-utils/app-automate.js +4 -3
  51. package/dist/tools/failurelogs-utils/automate.js +5 -4
  52. package/dist/tools/failurelogs-utils/resolve-app-build-id.d.ts +2 -0
  53. package/dist/tools/failurelogs-utils/resolve-app-build-id.js +5 -0
  54. package/dist/tools/failurelogs-utils/video.d.ts +3 -0
  55. package/dist/tools/failurelogs-utils/video.js +25 -0
  56. package/dist/tools/get-failure-logs.js +30 -11
  57. package/dist/tools/observability.js +3 -1
  58. package/dist/tools/percy-sdk.js +9 -9
  59. package/dist/tools/rca-agent-utils/format-rca.js +5 -4
  60. package/dist/tools/rca-agent-utils/get-failed-test-id.js +12 -0
  61. package/dist/tools/rca-agent-utils/types.d.ts +1 -0
  62. package/dist/tools/rca-agent.js +5 -2
  63. package/dist/tools/review-agent.js +2 -1
  64. package/dist/tools/sdk-utils/common/constants.d.ts +1 -1
  65. package/dist/tools/sdk-utils/common/constants.js +2 -1
  66. package/dist/tools/selfheal.js +6 -3
  67. package/dist/tools/testmanagement-utils/TCG-utils/api.js +26 -7
  68. package/dist/tools/testmanagement-utils/TCG-utils/config.d.ts +2 -0
  69. package/dist/tools/testmanagement-utils/TCG-utils/config.js +5 -0
  70. package/dist/tools/testmanagement-utils/testcase-from-file.js +2 -1
  71. package/dist/tools/testmanagement-utils/upload-file.js +16 -2
  72. package/dist/tools/testmanagement.js +39 -17
  73. package/dist/tools/tool-handoff.d.ts +66 -0
  74. package/dist/tools/tool-handoff.js +78 -0
  75. package/package.json +5 -11
  76. package/capability/loadtesting.capability-index.json +0 -1870
  77. package/capability/tm.capability-index.json +0 -50104
  78. package/dist/tools/capability-registry/bind.d.ts +0 -29
  79. package/dist/tools/capability-registry/bind.js +0 -329
  80. package/dist/tools/capability-registry/config.d.ts +0 -62
  81. package/dist/tools/capability-registry/config.js +0 -218
  82. package/dist/tools/capability-registry/discovery.d.ts +0 -44
  83. package/dist/tools/capability-registry/discovery.js +0 -99
  84. package/dist/tools/capability-registry/egress.d.ts +0 -44
  85. package/dist/tools/capability-registry/egress.js +0 -174
  86. package/dist/tools/capability-registry/index-loader.d.ts +0 -133
  87. package/dist/tools/capability-registry/index-loader.js +0 -404
  88. package/dist/tools/capability-registry/register.d.ts +0 -48
  89. package/dist/tools/capability-registry/register.js +0 -604
  90. package/dist/tools/capability-registry/resolve.d.ts +0 -38
  91. package/dist/tools/capability-registry/resolve.js +0 -45
  92. package/dist/tools/capability-registry/search.d.ts +0 -170
  93. package/dist/tools/capability-registry/search.js +0 -709
  94. package/dist/tools/capability-registry/types.d.ts +0 -282
  95. package/dist/tools/capability-registry/types.js +0 -33
@@ -1,282 +0,0 @@
1
- /**
2
- * The shape of the index artifact, which is the contract with the export pipeline.
3
- *
4
- * The artifact is generated by the capability-registry build and transformed into its
5
- * released envelope by the export pipeline's merge step. It contains ONLY data that has
6
- * already passed that side's outbound boundary. Nothing here is parsed from an OpenAPI spec
7
- * at runtime: if this half parsed specs it would become the boundary, and every gate (route
8
- * lint, vocabulary rule, intent lint, discovery denylist) would have to be reimplemented and
9
- * re-tested here. Reading a pre-projected index means the internal data is not in the
10
- * package at all.
11
- *
12
- * ONE FILE PER PRODUCT. The released artifact is `capability/<product>.capability-index.json`,
13
- * with the
14
- * product object at the top level under its own name. The plural `products` wrapper belonged
15
- * to the pre-release shape and implied multi-product files that never existed.
16
- */
17
- /**
18
- * The envelope's format marker, for FUTURE shape changes.
19
- *
20
- * BOTH the released and the pre-release shapes claim 1, so this number cannot distinguish
21
- * them — `readIndexFile` shape-detects on the `products` wrapper instead. The check is still
22
- * worth keeping: it is what refuses a shape the generator has announced but this build does
23
- * not read.
24
- */
25
- export declare const SUPPORTED_SCHEMA_VERSION = 1;
26
- /** Envelope keys, i.e. everything at the top level that is NOT the product object. */
27
- export declare const ENVELOPE_KEYS: readonly ["schema_version", "version", "build_id", "harness_commit", "products"];
28
- export type Mode = "read" | "write" | "destructive";
29
- /** One parameter, under the name the OpenAPI spec itself gives it. */
30
- /**
31
- * The constraints a parameter may declare beyond its type.
32
- *
33
- * ALL OPTIONAL, and absent means unchecked. The released artifact carries none of these
34
- * yet — tm's spec holds 59 `format`, 50 `default`, 23 `minimum`, 12 `maximum`, 10
35
- * `minItems`, 7 `maxItems`, 4 `minLength`, 3 `pattern` and 2 `maxLength` that the export
36
- * currently drops — so this ships inert and starts working the moment the export carries
37
- * them. An older index must keep binding exactly as it does today.
38
- */
39
- export interface WireConstraints {
40
- /** Numbers. `multipleOf` is checked on the coerced number, not the raw string. */
41
- minimum?: number;
42
- maximum?: number;
43
- multipleOf?: number;
44
- /** Strings. `pattern` is an unanchored regex, compiled with `u` for `\p{…}` classes. */
45
- minLength?: number;
46
- maxLength?: number;
47
- pattern?: string;
48
- format?: string;
49
- /** Arrays. */
50
- minItems?: number;
51
- maxItems?: number;
52
- uniqueItems?: boolean;
53
- /**
54
- * The value the product uses when the field is omitted.
55
- *
56
- * PUBLISHED, NOT INJECTED. Telling a caller the default is what stops the redundant send;
57
- * filling it in here would put a value on the wire that the caller never chose, and pin
58
- * a server-side default that is free to change. Omission and "explicitly the default" are
59
- * different requests, and only the product knows whether that difference matters.
60
- */
61
- default?: unknown;
62
- }
63
- /** One field inside an array item or a nested object — same constraints, one level down. */
64
- export interface WireField extends WireConstraints {
65
- name: string;
66
- type: string;
67
- required?: true;
68
- values?: unknown[];
69
- }
70
- export interface WireParam extends WireConstraints {
71
- name: string;
72
- type: string;
73
- required?: true;
74
- values?: unknown[];
75
- example?: unknown;
76
- description?: string;
77
- /** Field names/types one level inside an array item or nested object. */
78
- fields?: WireField[];
79
- /**
80
- * Where a body field sits in the JSON, when that differs from its name. Published
81
- * because the nesting is not guessable and getting it wrong fails silently — tm's folder
82
- * create really wants `{folder: {name}}` while the spec's flat `{name}` is what a reader
83
- * would assume.
84
- */
85
- json_path?: string;
86
- }
87
- /**
88
- * A reference into a product-level lookup table.
89
- *
90
- * Named components are stored ONCE, already dereferenced and allOf-flattened at build time,
91
- * so resolution is a single dict lookup rather than a recursive $ref walk at runtime.
92
- */
93
- export interface ComponentRef {
94
- $response?: string;
95
- $schema?: string;
96
- }
97
- /** A JSON Schema fragment, or a reference to a named one. */
98
- export type SchemaNode = ComponentRef & Record<string, unknown>;
99
- /** One declared response, or a reference to a named one. */
100
- export interface ResponseDoc extends ComponentRef {
101
- description?: string;
102
- schema?: SchemaNode;
103
- }
104
- /** A capability, keyed by the endpoint it exposes. There is deliberately no name. */
105
- export interface Capability {
106
- /**
107
- * The caller-facing handle — the snake-cased `operationId`, unique within its product.
108
- *
109
- * This is what `invokeCapability` takes, and what `entities[*].capabilities[]` lists. It
110
- * is stable where a route is not: `/edit` becoming `/edit-v2` must not break a caller
111
- * holding a handle.
112
- *
113
- * OPTIONAL because not every product publishes it yet — loadtesting's index carries none.
114
- * For those, the endpoint remains the handle, so nothing may assume this is present.
115
- */
116
- name?: string;
117
- method: string;
118
- path: string;
119
- mode: Mode;
120
- entity: string;
121
- path_params?: WireParam[];
122
- query?: WireParam[];
123
- body?: WireParam[];
124
- intent?: string;
125
- /**
126
- * How to call the endpoint correctly.
127
- *
128
- * ABSENT from the released artifact — the export dropped it, and the shape-change note
129
- * does not say whether that was intended. Kept optional and still scored by search so the
130
- * server works either way; nothing may depend on it being present.
131
- */
132
- guidance?: string[];
133
- /** Allowlisted row fields. Absent when `shape` is "discovered". */
134
- returns?: string[];
135
- /** "discovered" when the product declares no response schema for this operation. */
136
- shape?: "discovered";
137
- requires?: string[];
138
- paginated?: boolean;
139
- /** The largest page the operation declares. */
140
- max_page_size?: number;
141
- /**
142
- * Declared responses by status code, values possibly `{$response: "Name"}` references.
143
- *
144
- * ADDITIVE and not yet emitted: no capability in the current export carries it. Absence
145
- * means "no response schema available", never an error. Resolve with `resolveComponent`.
146
- */
147
- responses?: Record<string, ResponseDoc>;
148
- }
149
- export interface EntityDoc {
150
- title?: string;
151
- /**
152
- * One line saying what this entity IS. Rides on `listProducts`, next to the aliases.
153
- *
154
- * Aliases route; they do not define. `version -> history, revision, version-history`
155
- * tells a caller which words land here and nothing about whether that is the versioning
156
- * of a test case or of a project. Without this line the only way to find out is
157
- * `describeEntity`, once per entity — 19 calls at ~1.4KB for tm, against ~1.6KB to
158
- * answer it for all of them at once.
159
- *
160
- * Capped at 140 characters by the build, and dropped rather than truncated when longer.
161
- * Often absent: a product that has not authored these emits none (loadtesting has 0 of
162
- * 9 today), and absence means "unwritten", never an error.
163
- */
164
- description?: string;
165
- aliases?: string[];
166
- id_convention?: string;
167
- parents?: string[];
168
- relations?: {
169
- entity?: string;
170
- via?: string;
171
- }[];
172
- /**
173
- * What a caller gets wrong about this ENTITY, as opposed to one operation.
174
- *
175
- * The entity-wide half of guidance: "a run's `id` is the display string, take `uuid`"
176
- * holds for every capability returning a run, so it is stated once here rather than
177
- * copied onto each capability's `guidance` — which would repeat across ~20 records and,
178
- * since guidance is a search haystack, dilute ranking with boilerplate.
179
- *
180
- * Filtered at build time and often absent: of tm's 155 authored facts, 73 are publishable
181
- * as written and the rest name routes, HTTP verbs or wire-shaped parameters. Absent means
182
- * "none passed", never an error.
183
- */
184
- key_facts?: string[];
185
- [key: string]: unknown;
186
- }
187
- /**
188
- * Paging controls, keyed "METHOD /path".
189
- *
190
- * NOT USED BY THIS SERVER: it performs one request and returns the response, so paging
191
- * belongs to the caller and the page parameters are published with the endpoint's other
192
- * query parameters. The field is still emitted by the build, so it stays described here
193
- * rather than silently ignored — a consumer that DOES page can use it.
194
- */
195
- export interface PagingRule {
196
- page?: string;
197
- size?: string;
198
- /** The largest page the operation declares. Absent when the spec states no maximum. */
199
- max?: number;
200
- }
201
- /**
202
- * How a product wants the caller's credentials presented.
203
- *
204
- * The OpenAPI `securityScheme` vocabulary, verbatim — `type` / `in` / `name` / `scheme` —
205
- * because the spec already describes this and inventing a parallel taxonomy would mean
206
- * translating between two of them forever. ONE scheme per product, not OpenAPI's list of
207
- * alternatives: this server holds a username and an access key and nothing else, so
208
- * "the first alternative we can satisfy" only ever had one answer.
209
- *
210
- * `template` is what makes it a contract rather than a guess — a product taking
211
- * `{username}_{access_key}` is expressible instead of being a special case in the server.
212
- * It names placeholders, never values: the credential itself stays in config, and the
213
- * harness's `{ env: … }` value sources must NOT cross the boundary into the artifact.
214
- */
215
- export interface AuthScheme {
216
- /** "apiKey" puts the rendered template in a header; "http" with scheme "basic" encodes it. */
217
- type: "apiKey" | "http";
218
- /** apiKey only. Header is the sole supported location — see `egress.authHeaders`. */
219
- in?: "header" | "cookie" | "query";
220
- /** apiKey only: the header name, e.g. "Api-Token". */
221
- name?: string;
222
- /** http only. */
223
- scheme?: string;
224
- /** Defaults to `{username}:{access_key}`. */
225
- template?: string;
226
- }
227
- export interface ProductIndex {
228
- summary: string;
229
- /**
230
- * How to authenticate to this product. Absent means the historical default: the caller's
231
- * credentials as `Api-Token: {username}:{access_key}`, which is what every shipped index
232
- * relies on today.
233
- */
234
- auth?: AuthScheme;
235
- /**
236
- * The single host this product is served from, when it has one.
237
- *
238
- * A default, not the last word: config overrides it, and for a region-sharded product
239
- * (one declaring `base_urls`) account discovery outranks it and this is the fallback.
240
- */
241
- base_url?: string;
242
- /**
243
- * Candidate regional hosts, in probe order, for a product whose host depends on the
244
- * ACCOUNT rather than the deployment.
245
- *
246
- * Declaring these makes the product region-sharded: the server asks each in turn with the
247
- * caller's credentials and keeps the one that answers. A single fixed `base_url` cannot
248
- * express this — it would send every account outside the default region to the wrong host,
249
- * a failure invisible to anyone testing from inside that region.
250
- */
251
- base_urls?: string[];
252
- /**
253
- * The endpoint to probe the candidates with. Derived from the capabilities when absent
254
- * (see `discovery.probePath`); declare it when the derived choice would be wrong.
255
- */
256
- probe_path?: string;
257
- capabilities: Capability[];
258
- entities: Record<string, EntityDoc>;
259
- paging?: Record<string, PagingRule>;
260
- /** Named responses, referenced as `{$response: "Name"}`. Additive; not yet emitted. */
261
- responses?: Record<string, ResponseDoc>;
262
- /** Named schemas, referenced as `{$schema: "Name"}`. Additive; not yet emitted. */
263
- schemas?: Record<string, SchemaNode>;
264
- }
265
- /** Where one product's data came from. Logging and cache-busting only. */
266
- export interface Provenance {
267
- /** `<commit>_<UTC timestamp>` in the released shape. */
268
- build_id: string;
269
- /** Dotted content-generation counter, e.g. "1.2". Absent in the pre-release shape. */
270
- version?: string;
271
- }
272
- /**
273
- * The merged, in-memory model: every loaded file's product under its own name.
274
- *
275
- * This is the server's own structure, not the file format — one file carries one product,
276
- * and the registry holds all of them so a caller can search across products.
277
- */
278
- export interface RegistryIndex {
279
- schema_version: number;
280
- build_id: string;
281
- products: Record<string, ProductIndex>;
282
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * The shape of the index artifact, which is the contract with the export pipeline.
3
- *
4
- * The artifact is generated by the capability-registry build and transformed into its
5
- * released envelope by the export pipeline's merge step. It contains ONLY data that has
6
- * already passed that side's outbound boundary. Nothing here is parsed from an OpenAPI spec
7
- * at runtime: if this half parsed specs it would become the boundary, and every gate (route
8
- * lint, vocabulary rule, intent lint, discovery denylist) would have to be reimplemented and
9
- * re-tested here. Reading a pre-projected index means the internal data is not in the
10
- * package at all.
11
- *
12
- * ONE FILE PER PRODUCT. The released artifact is `capability/<product>.capability-index.json`,
13
- * with the
14
- * product object at the top level under its own name. The plural `products` wrapper belonged
15
- * to the pre-release shape and implied multi-product files that never existed.
16
- */
17
- /**
18
- * The envelope's format marker, for FUTURE shape changes.
19
- *
20
- * BOTH the released and the pre-release shapes claim 1, so this number cannot distinguish
21
- * them — `readIndexFile` shape-detects on the `products` wrapper instead. The check is still
22
- * worth keeping: it is what refuses a shape the generator has announced but this build does
23
- * not read.
24
- */
25
- export const SUPPORTED_SCHEMA_VERSION = 1;
26
- /** Envelope keys, i.e. everything at the top level that is NOT the product object. */
27
- export const ENVELOPE_KEYS = [
28
- "schema_version",
29
- "version",
30
- "build_id",
31
- "harness_commit",
32
- "products",
33
- ];