agentic-qe 3.7.6 → 3.7.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.
Files changed (63) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +20 -0
  3. package/dist/cli/bundle.js +1023 -40
  4. package/dist/domains/test-execution/services/e2e/adaptive-locator-service.d.ts +71 -0
  5. package/dist/domains/test-execution/services/e2e/adaptive-locator-service.d.ts.map +1 -0
  6. package/dist/domains/test-execution/services/e2e/adaptive-locator-service.js +456 -0
  7. package/dist/domains/test-execution/services/e2e/adaptive-locator-service.js.map +1 -0
  8. package/dist/domains/test-execution/services/e2e/adaptive-locator-types.d.ts +81 -0
  9. package/dist/domains/test-execution/services/e2e/adaptive-locator-types.d.ts.map +1 -0
  10. package/dist/domains/test-execution/services/e2e/adaptive-locator-types.js +20 -0
  11. package/dist/domains/test-execution/services/e2e/adaptive-locator-types.js.map +1 -0
  12. package/dist/domains/test-execution/services/e2e/browser-orchestrator.d.ts +19 -0
  13. package/dist/domains/test-execution/services/e2e/browser-orchestrator.d.ts.map +1 -1
  14. package/dist/domains/test-execution/services/e2e/browser-orchestrator.js +82 -0
  15. package/dist/domains/test-execution/services/e2e/browser-orchestrator.js.map +1 -1
  16. package/dist/domains/test-execution/services/e2e/index.d.ts +2 -0
  17. package/dist/domains/test-execution/services/e2e/index.d.ts.map +1 -1
  18. package/dist/domains/test-execution/services/e2e/index.js +5 -0
  19. package/dist/domains/test-execution/services/e2e/index.js.map +1 -1
  20. package/dist/domains/test-execution/services/e2e/step-executors.d.ts +6 -0
  21. package/dist/domains/test-execution/services/e2e/step-executors.d.ts.map +1 -1
  22. package/dist/domains/test-execution/services/e2e/step-executors.js +17 -2
  23. package/dist/domains/test-execution/services/e2e/step-executors.js.map +1 -1
  24. package/dist/domains/test-execution/services/e2e/types.d.ts +18 -1
  25. package/dist/domains/test-execution/services/e2e/types.d.ts.map +1 -1
  26. package/dist/domains/test-execution/services/e2e/types.js.map +1 -1
  27. package/dist/integrations/browser/client-factory.d.ts +6 -1
  28. package/dist/integrations/browser/client-factory.d.ts.map +1 -1
  29. package/dist/integrations/browser/client-factory.js +37 -2
  30. package/dist/integrations/browser/client-factory.js.map +1 -1
  31. package/dist/integrations/browser/index.d.ts +5 -1
  32. package/dist/integrations/browser/index.d.ts.map +1 -1
  33. package/dist/integrations/browser/index.js +8 -1
  34. package/dist/integrations/browser/index.js.map +1 -1
  35. package/dist/integrations/browser/page-pool-types.d.ts +70 -0
  36. package/dist/integrations/browser/page-pool-types.d.ts.map +1 -0
  37. package/dist/integrations/browser/page-pool-types.js +19 -0
  38. package/dist/integrations/browser/page-pool-types.js.map +1 -0
  39. package/dist/integrations/browser/page-pool.d.ts +79 -0
  40. package/dist/integrations/browser/page-pool.d.ts.map +1 -0
  41. package/dist/integrations/browser/page-pool.js +288 -0
  42. package/dist/integrations/browser/page-pool.js.map +1 -0
  43. package/dist/integrations/browser/resource-blocking.d.ts +47 -0
  44. package/dist/integrations/browser/resource-blocking.d.ts.map +1 -0
  45. package/dist/integrations/browser/resource-blocking.js +195 -0
  46. package/dist/integrations/browser/resource-blocking.js.map +1 -0
  47. package/dist/integrations/browser/stealth/index.d.ts +8 -0
  48. package/dist/integrations/browser/stealth/index.d.ts.map +1 -0
  49. package/dist/integrations/browser/stealth/index.js +7 -0
  50. package/dist/integrations/browser/stealth/index.js.map +1 -0
  51. package/dist/integrations/browser/stealth/stealth-client.d.ts +51 -0
  52. package/dist/integrations/browser/stealth/stealth-client.d.ts.map +1 -0
  53. package/dist/integrations/browser/stealth/stealth-client.js +359 -0
  54. package/dist/integrations/browser/stealth/stealth-client.js.map +1 -0
  55. package/dist/integrations/browser/stealth/stealth-types.d.ts +35 -0
  56. package/dist/integrations/browser/stealth/stealth-types.d.ts.map +1 -0
  57. package/dist/integrations/browser/stealth/stealth-types.js +17 -0
  58. package/dist/integrations/browser/stealth/stealth-types.js.map +1 -0
  59. package/dist/integrations/browser/types.d.ts +13 -10
  60. package/dist/integrations/browser/types.d.ts.map +1 -1
  61. package/dist/integrations/browser/types.js.map +1 -1
  62. package/dist/mcp/bundle.js +1114 -70
  63. package/package.json +1 -1
@@ -44957,6 +44957,499 @@ var init_client = __esm({
44957
44957
  }
44958
44958
  });
44959
44959
 
44960
+ // src/integrations/browser/stealth/stealth-types.ts
44961
+ var DEFAULT_STEALTH_CONFIG;
44962
+ var init_stealth_types = __esm({
44963
+ "src/integrations/browser/stealth/stealth-types.ts"() {
44964
+ "use strict";
44965
+ DEFAULT_STEALTH_CONFIG = {
44966
+ persistentContext: true,
44967
+ cloudflareWaitSeconds: 0,
44968
+ resourceBlocking: "functional"
44969
+ };
44970
+ }
44971
+ });
44972
+
44973
+ // src/integrations/browser/resource-blocking.ts
44974
+ function shouldBlockRequest(url, resourceType, config) {
44975
+ if (!config.enabled) {
44976
+ return false;
44977
+ }
44978
+ if (config.allowPatterns?.length) {
44979
+ for (const pattern of config.allowPatterns) {
44980
+ if (urlMatchesPattern(url, pattern)) {
44981
+ return false;
44982
+ }
44983
+ }
44984
+ }
44985
+ if (config.blockPatterns?.length) {
44986
+ for (const pattern of config.blockPatterns) {
44987
+ if (urlMatchesPattern(url, pattern)) {
44988
+ return true;
44989
+ }
44990
+ }
44991
+ }
44992
+ const category = RESOURCE_TYPE_TO_CATEGORY[resourceType];
44993
+ if (category && config.blockedCategories.includes(category)) {
44994
+ return true;
44995
+ }
44996
+ if (config.blockedCategories.includes("tracking") && isDomainInSet(url, TRACKING_DOMAINS)) {
44997
+ return true;
44998
+ }
44999
+ if (config.blockedCategories.includes("advertising") && isDomainInSet(url, ADVERTISING_DOMAINS)) {
45000
+ return true;
45001
+ }
45002
+ return false;
45003
+ }
45004
+ function getResourceBlockingPreset(name) {
45005
+ if (typeof name === "object") {
45006
+ return name;
45007
+ }
45008
+ const preset = PRESETS[name];
45009
+ if (!preset) {
45010
+ return PRESETS.visual;
45011
+ }
45012
+ return { ...preset, blockedCategories: [...preset.blockedCategories] };
45013
+ }
45014
+ function urlMatchesPattern(url, pattern) {
45015
+ let regex = patternCache.get(pattern);
45016
+ if (!regex) {
45017
+ const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
45018
+ regex = new RegExp(escaped, "i");
45019
+ patternCache.set(pattern, regex);
45020
+ }
45021
+ return regex.test(url);
45022
+ }
45023
+ function isDomainInSet(url, domains) {
45024
+ try {
45025
+ const hostname = new URL(url).hostname;
45026
+ for (const domain of domains) {
45027
+ if (hostname === domain || hostname.endsWith(`.${domain}`)) {
45028
+ return true;
45029
+ }
45030
+ }
45031
+ } catch {
45032
+ }
45033
+ return false;
45034
+ }
45035
+ var TRACKING_DOMAINS, ADVERTISING_DOMAINS, RESOURCE_TYPE_TO_CATEGORY, PRESETS, patternCache;
45036
+ var init_resource_blocking = __esm({
45037
+ "src/integrations/browser/resource-blocking.ts"() {
45038
+ "use strict";
45039
+ TRACKING_DOMAINS = /* @__PURE__ */ new Set([
45040
+ "google-analytics.com",
45041
+ "googletagmanager.com",
45042
+ "analytics.google.com",
45043
+ "hotjar.com",
45044
+ "fullstory.com",
45045
+ "segment.io",
45046
+ "segment.com",
45047
+ "mixpanel.com",
45048
+ "heap.io",
45049
+ "heapanalytics.com",
45050
+ "amplitude.com",
45051
+ "mouseflow.com",
45052
+ "crazyegg.com",
45053
+ "optimizely.com",
45054
+ "newrelic.com",
45055
+ "nr-data.net",
45056
+ "sentry.io",
45057
+ "bugsnag.com",
45058
+ "logrocket.com",
45059
+ "clarity.ms",
45060
+ "facebook.net",
45061
+ "connect.facebook.net"
45062
+ ]);
45063
+ ADVERTISING_DOMAINS = /* @__PURE__ */ new Set([
45064
+ "doubleclick.net",
45065
+ "googlesyndication.com",
45066
+ "googleadservices.com",
45067
+ "google-analytics.com",
45068
+ "adservice.google.com",
45069
+ "pagead2.googlesyndication.com",
45070
+ "ads.twitter.com",
45071
+ "ads-api.twitter.com",
45072
+ "adsserver.com",
45073
+ "adnxs.com",
45074
+ "amazon-adsystem.com",
45075
+ "criteo.com",
45076
+ "moatads.com",
45077
+ "outbrain.com",
45078
+ "taboola.com",
45079
+ "bidswitch.net",
45080
+ "rubiconproject.com"
45081
+ ]);
45082
+ RESOURCE_TYPE_TO_CATEGORY = {
45083
+ image: "image",
45084
+ font: "font",
45085
+ media: "media",
45086
+ stylesheet: "stylesheet",
45087
+ websocket: "websocket"
45088
+ };
45089
+ PRESETS = {
45090
+ /**
45091
+ * Functional preset: block everything non-essential for functional testing.
45092
+ * Fastest page loads — only HTML, JS, and XHR/fetch are allowed.
45093
+ */
45094
+ functional: {
45095
+ enabled: true,
45096
+ blockedCategories: ["image", "font", "media", "stylesheet", "tracking", "advertising"]
45097
+ },
45098
+ /**
45099
+ * Visual preset: block nothing — needed for visual regression testing.
45100
+ */
45101
+ visual: {
45102
+ enabled: false,
45103
+ blockedCategories: []
45104
+ },
45105
+ /**
45106
+ * Performance preset: block heavy resources and tracking only.
45107
+ * Keeps stylesheets for layout accuracy but drops images/fonts/media.
45108
+ */
45109
+ performance: {
45110
+ enabled: true,
45111
+ blockedCategories: ["image", "font", "media", "tracking", "advertising"]
45112
+ }
45113
+ };
45114
+ patternCache = /* @__PURE__ */ new Map();
45115
+ }
45116
+ });
45117
+
45118
+ // src/integrations/browser/stealth/stealth-client.ts
45119
+ import { randomUUID as randomUUID6 } from "crypto";
45120
+ function getPatchright() {
45121
+ if (patchrightChecked) return patchrightModule;
45122
+ patchrightChecked = true;
45123
+ try {
45124
+ patchrightModule = __require("patchright");
45125
+ } catch {
45126
+ patchrightModule = null;
45127
+ }
45128
+ return patchrightModule;
45129
+ }
45130
+ var patchrightModule, patchrightChecked, StealthBrowserClient;
45131
+ var init_stealth_client = __esm({
45132
+ "src/integrations/browser/stealth/stealth-client.ts"() {
45133
+ "use strict";
45134
+ init_types5();
45135
+ init_stealth_types();
45136
+ init_resource_blocking();
45137
+ patchrightModule = null;
45138
+ patchrightChecked = false;
45139
+ StealthBrowserClient = class {
45140
+ tool = "stealth";
45141
+ stealthConfig;
45142
+ page = null;
45143
+ context = null;
45144
+ browser = null;
45145
+ sessionId = null;
45146
+ constructor(config) {
45147
+ this.stealthConfig = { ...DEFAULT_STEALTH_CONFIG, ...config };
45148
+ }
45149
+ // ========================================================================
45150
+ // Lifecycle
45151
+ // ========================================================================
45152
+ async isAvailable() {
45153
+ return getPatchright() !== null;
45154
+ }
45155
+ async launch(options) {
45156
+ const pr3 = getPatchright();
45157
+ if (!pr3) {
45158
+ return {
45159
+ success: false,
45160
+ error: new BrowserUnavailableError(
45161
+ "stealth",
45162
+ "Patchright is not installed. Install with: npm install patchright"
45163
+ )
45164
+ };
45165
+ }
45166
+ try {
45167
+ const launchOptions = {
45168
+ headless: options?.headless ?? true
45169
+ };
45170
+ if (options?.viewport) {
45171
+ launchOptions.viewport = options.viewport;
45172
+ }
45173
+ if (options?.args) {
45174
+ launchOptions.args = options.args;
45175
+ }
45176
+ if (this.stealthConfig.userAgent) {
45177
+ launchOptions.userAgent = this.stealthConfig.userAgent;
45178
+ }
45179
+ if (this.stealthConfig.proxy) {
45180
+ launchOptions.proxy = this.stealthConfig.proxy;
45181
+ }
45182
+ if (this.stealthConfig.persistentContext) {
45183
+ const userDataDir = this.stealthConfig.userDataDir || `/tmp/stealth-browser-${randomUUID6()}`;
45184
+ this.context = await pr3.chromium.launchPersistentContext(userDataDir, launchOptions);
45185
+ const pages = this.context.pages();
45186
+ this.page = pages.length > 0 ? pages[0] : await this.context.newPage();
45187
+ } else {
45188
+ this.browser = await pr3.chromium.launch(launchOptions);
45189
+ this.page = await this.browser.newPage();
45190
+ }
45191
+ await this.applyResourceBlocking();
45192
+ this.sessionId = randomUUID6();
45193
+ return {
45194
+ success: true,
45195
+ value: {
45196
+ id: this.sessionId,
45197
+ tool: "stealth",
45198
+ status: "active",
45199
+ createdAt: /* @__PURE__ */ new Date()
45200
+ }
45201
+ };
45202
+ } catch (err4) {
45203
+ return {
45204
+ success: false,
45205
+ error: new BrowserError(
45206
+ `Failed to launch stealth browser: ${err4 instanceof Error ? err4.message : String(err4)}`,
45207
+ "LAUNCH_FAILED",
45208
+ "stealth",
45209
+ err4 instanceof Error ? err4 : void 0
45210
+ )
45211
+ };
45212
+ }
45213
+ }
45214
+ async quit() {
45215
+ try {
45216
+ if (this.context) {
45217
+ await this.context.close();
45218
+ this.context = null;
45219
+ }
45220
+ if (this.browser) {
45221
+ await this.browser.close();
45222
+ this.browser = null;
45223
+ }
45224
+ this.page = null;
45225
+ this.sessionId = null;
45226
+ return { success: true, value: void 0 };
45227
+ } catch (err4) {
45228
+ return {
45229
+ success: false,
45230
+ error: new BrowserError(
45231
+ "Failed to quit stealth browser",
45232
+ "QUIT_FAILED",
45233
+ "stealth",
45234
+ err4 instanceof Error ? err4 : void 0
45235
+ )
45236
+ };
45237
+ }
45238
+ }
45239
+ // ========================================================================
45240
+ // Navigation
45241
+ // ========================================================================
45242
+ async navigate(url) {
45243
+ if (!this.page) return this.notLaunched();
45244
+ try {
45245
+ const start = Date.now();
45246
+ const response = await this.page.goto(url, { waitUntil: "domcontentloaded" });
45247
+ const statusCode = response?.status() ?? void 0;
45248
+ if (this.stealthConfig.cloudflareWaitSeconds > 0) {
45249
+ await this.waitForCloudflare();
45250
+ }
45251
+ const title = await this.page.title();
45252
+ return {
45253
+ success: true,
45254
+ value: {
45255
+ url: this.page.url(),
45256
+ title,
45257
+ success: true,
45258
+ durationMs: Date.now() - start,
45259
+ statusCode: statusCode ?? void 0
45260
+ }
45261
+ };
45262
+ } catch (err4) {
45263
+ return this.wrapError("navigate", err4);
45264
+ }
45265
+ }
45266
+ async reload() {
45267
+ if (!this.page) return this.notLaunched();
45268
+ try {
45269
+ await this.page.reload();
45270
+ return { success: true, value: void 0 };
45271
+ } catch (err4) {
45272
+ return this.wrapError("reload", err4);
45273
+ }
45274
+ }
45275
+ async goBack() {
45276
+ if (!this.page) return this.notLaunched();
45277
+ try {
45278
+ await this.page.goBack();
45279
+ return { success: true, value: void 0 };
45280
+ } catch (err4) {
45281
+ return this.wrapError("goBack", err4);
45282
+ }
45283
+ }
45284
+ async goForward() {
45285
+ if (!this.page) return this.notLaunched();
45286
+ try {
45287
+ await this.page.goForward();
45288
+ return { success: true, value: void 0 };
45289
+ } catch (err4) {
45290
+ return this.wrapError("goForward", err4);
45291
+ }
45292
+ }
45293
+ // ========================================================================
45294
+ // Element Interaction
45295
+ // ========================================================================
45296
+ async click(target) {
45297
+ if (!this.page) return this.notLaunched();
45298
+ try {
45299
+ const selector = this.resolveSelector(target);
45300
+ await this.page.click(selector);
45301
+ return { success: true, value: void 0 };
45302
+ } catch (err4) {
45303
+ return this.wrapError("click", err4);
45304
+ }
45305
+ }
45306
+ async fill(target, text2) {
45307
+ if (!this.page) return this.notLaunched();
45308
+ try {
45309
+ const selector = this.resolveSelector(target);
45310
+ await this.page.fill(selector, text2);
45311
+ return { success: true, value: void 0 };
45312
+ } catch (err4) {
45313
+ return this.wrapError("fill", err4);
45314
+ }
45315
+ }
45316
+ async getText(target) {
45317
+ if (!this.page) return this.notLaunched();
45318
+ try {
45319
+ const selector = this.resolveSelector(target);
45320
+ const text2 = await this.page.textContent(selector);
45321
+ return { success: true, value: text2 ?? "" };
45322
+ } catch (err4) {
45323
+ return this.wrapError("getText", err4);
45324
+ }
45325
+ }
45326
+ async isVisible(target) {
45327
+ if (!this.page) return this.notLaunched();
45328
+ try {
45329
+ const selector = this.resolveSelector(target);
45330
+ const visible = await this.page.isVisible(selector);
45331
+ return { success: true, value: visible };
45332
+ } catch (err4) {
45333
+ return this.wrapError("isVisible", err4);
45334
+ }
45335
+ }
45336
+ // ========================================================================
45337
+ // Screenshots
45338
+ // ========================================================================
45339
+ async screenshot(options) {
45340
+ if (!this.page) return this.notLaunched();
45341
+ try {
45342
+ const buffer = await this.page.screenshot({
45343
+ path: options?.path,
45344
+ fullPage: options?.fullPage,
45345
+ type: "png"
45346
+ });
45347
+ return {
45348
+ success: true,
45349
+ value: {
45350
+ base64: buffer.toString("base64"),
45351
+ path: options?.path,
45352
+ format: "png",
45353
+ dimensions: { width: 0, height: 0 }
45354
+ // Patchright doesn't expose dimensions directly
45355
+ }
45356
+ };
45357
+ } catch (err4) {
45358
+ return this.wrapError("screenshot", err4);
45359
+ }
45360
+ }
45361
+ // ========================================================================
45362
+ // Evaluate
45363
+ // ========================================================================
45364
+ async evaluate(script) {
45365
+ if (!this.page) return this.notLaunched();
45366
+ try {
45367
+ const result = await this.page.evaluate(script);
45368
+ return { success: true, value: result };
45369
+ } catch (err4) {
45370
+ return this.wrapError("evaluate", err4);
45371
+ }
45372
+ }
45373
+ // ========================================================================
45374
+ // Cleanup
45375
+ // ========================================================================
45376
+ async dispose() {
45377
+ await this.quit();
45378
+ }
45379
+ // ========================================================================
45380
+ // Private Helpers
45381
+ // ========================================================================
45382
+ resolveSelector(target) {
45383
+ if (typeof target === "string") return target;
45384
+ switch (target.type) {
45385
+ case "css":
45386
+ return target.value;
45387
+ case "xpath":
45388
+ return `xpath=${target.value}`;
45389
+ case "text":
45390
+ return `text=${target.value}`;
45391
+ case "ref":
45392
+ return target.value;
45393
+ default:
45394
+ return target.value;
45395
+ }
45396
+ }
45397
+ async applyResourceBlocking() {
45398
+ if (!this.page || !this.stealthConfig.resourceBlocking) return;
45399
+ const config = typeof this.stealthConfig.resourceBlocking === "string" ? getResourceBlockingPreset(this.stealthConfig.resourceBlocking) : this.stealthConfig.resourceBlocking;
45400
+ if (!config.enabled) return;
45401
+ await this.page.route("**/*", (route) => {
45402
+ const url = route.request().url();
45403
+ const resourceType = route.request().resourceType();
45404
+ if (shouldBlockRequest(url, resourceType, config)) {
45405
+ route.abort().catch(() => {
45406
+ });
45407
+ } else {
45408
+ route.continue().catch(() => {
45409
+ });
45410
+ }
45411
+ });
45412
+ }
45413
+ async waitForCloudflare() {
45414
+ if (!this.page || this.stealthConfig.cloudflareWaitSeconds <= 0) return;
45415
+ const ms = this.stealthConfig.cloudflareWaitSeconds * 1e3;
45416
+ const start = Date.now();
45417
+ while (Date.now() - start < ms) {
45418
+ try {
45419
+ const title = await this.page.title();
45420
+ if (!title.includes("Just a moment") && !title.includes("Checking your browser")) {
45421
+ return;
45422
+ }
45423
+ } catch {
45424
+ }
45425
+ await new Promise((resolve10) => setTimeout(resolve10, 500));
45426
+ }
45427
+ }
45428
+ notLaunched() {
45429
+ return {
45430
+ success: false,
45431
+ error: new BrowserError(
45432
+ "Stealth browser not launched. Call launch() first.",
45433
+ "NOT_LAUNCHED",
45434
+ "stealth"
45435
+ )
45436
+ };
45437
+ }
45438
+ wrapError(operation, err4) {
45439
+ return {
45440
+ success: false,
45441
+ error: new BrowserError(
45442
+ `Stealth ${operation} failed: ${err4 instanceof Error ? err4.message : String(err4)}`,
45443
+ "OPERATION_FAILED",
45444
+ "stealth",
45445
+ err4 instanceof Error ? err4 : void 0
45446
+ )
45447
+ };
45448
+ }
45449
+ };
45450
+ }
45451
+ });
45452
+
44960
45453
  // src/integrations/browser/client-factory.ts
44961
45454
  async function isVibiumAvailable() {
44962
45455
  return false;
@@ -44974,12 +45467,23 @@ function requiresAgentBrowser(useCase) {
44974
45467
  }
44975
45468
  async function createBrowserClient(options = {}) {
44976
45469
  const { preference = "auto", useCase } = options;
45470
+ if (useCase && STEALTH_PREFERRED_USE_CASES.includes(useCase)) {
45471
+ if (await isStealthAvailable()) {
45472
+ return new StealthBrowserClient();
45473
+ }
45474
+ }
44977
45475
  if (useCase && requiresAgentBrowser(useCase)) {
44978
45476
  return createAgentBrowserClient();
44979
45477
  }
44980
45478
  if (preference === "agent-browser") {
44981
45479
  return createAgentBrowserClient();
44982
45480
  }
45481
+ if (preference === "stealth") {
45482
+ if (await isStealthAvailable()) {
45483
+ return new StealthBrowserClient();
45484
+ }
45485
+ throw new BrowserUnavailableError("stealth", "Patchright is not installed");
45486
+ }
44983
45487
  if (preference === "vibium") {
44984
45488
  const available = await isVibiumAvailable();
44985
45489
  if (available) {
@@ -45003,12 +45507,21 @@ async function createAgentBrowserClient() {
45003
45507
  async function getBrowserClientForUseCase(useCase) {
45004
45508
  return createBrowserClient({ useCase });
45005
45509
  }
45006
- var AGENT_BROWSER_REQUIRED_USE_CASES, VibiumClientStub;
45510
+ async function isStealthAvailable() {
45511
+ try {
45512
+ const client = new StealthBrowserClient();
45513
+ return await client.isAvailable();
45514
+ } catch {
45515
+ return false;
45516
+ }
45517
+ }
45518
+ var AGENT_BROWSER_REQUIRED_USE_CASES, STEALTH_PREFERRED_USE_CASES, VibiumClientStub;
45007
45519
  var init_client_factory = __esm({
45008
45520
  "src/integrations/browser/client-factory.ts"() {
45009
45521
  "use strict";
45010
45522
  init_types5();
45011
45523
  init_client();
45524
+ init_stealth_client();
45012
45525
  AGENT_BROWSER_REQUIRED_USE_CASES = [
45013
45526
  "e2e-testing",
45014
45527
  // Requires refs and sessions
@@ -45019,6 +45532,10 @@ var init_client_factory = __esm({
45019
45532
  "auth-testing"
45020
45533
  // Requires state persistence
45021
45534
  ];
45535
+ STEALTH_PREFERRED_USE_CASES = [
45536
+ "stealth-testing"
45537
+ // Bot-protected environments
45538
+ ];
45022
45539
  VibiumClientStub = class {
45023
45540
  tool = "vibium";
45024
45541
  async isAvailable() {
@@ -45102,6 +45619,30 @@ var init_client_factory = __esm({
45102
45619
  }
45103
45620
  });
45104
45621
 
45622
+ // src/integrations/browser/page-pool-types.ts
45623
+ var init_page_pool_types = __esm({
45624
+ "src/integrations/browser/page-pool-types.ts"() {
45625
+ "use strict";
45626
+ }
45627
+ });
45628
+
45629
+ // src/integrations/browser/page-pool.ts
45630
+ var init_page_pool = __esm({
45631
+ "src/integrations/browser/page-pool.ts"() {
45632
+ "use strict";
45633
+ init_page_pool_types();
45634
+ }
45635
+ });
45636
+
45637
+ // src/integrations/browser/stealth/index.ts
45638
+ var init_stealth = __esm({
45639
+ "src/integrations/browser/stealth/index.ts"() {
45640
+ "use strict";
45641
+ init_stealth_client();
45642
+ init_stealth_types();
45643
+ }
45644
+ });
45645
+
45105
45646
  // src/integrations/browser/web-content-fetcher.ts
45106
45647
  import { exec, execSync as execSync2 } from "child_process";
45107
45648
  import { promisify } from "util";
@@ -45123,10 +45664,402 @@ var init_browser = __esm({
45123
45664
  init_types5();
45124
45665
  init_client_factory();
45125
45666
  init_client();
45667
+ init_resource_blocking();
45668
+ init_page_pool();
45669
+ init_page_pool_types();
45670
+ init_stealth();
45126
45671
  init_web_content_fetcher();
45127
45672
  }
45128
45673
  });
45129
45674
 
45675
+ // src/domains/test-execution/services/e2e/adaptive-locator-types.ts
45676
+ var DEFAULT_ADAPTIVE_LOCATOR_CONFIG;
45677
+ var init_adaptive_locator_types = __esm({
45678
+ "src/domains/test-execution/services/e2e/adaptive-locator-types.ts"() {
45679
+ "use strict";
45680
+ DEFAULT_ADAPTIVE_LOCATOR_CONFIG = {
45681
+ enabled: true,
45682
+ similarityThreshold: 0.6,
45683
+ maxFingerprintsPerPage: 200,
45684
+ namespace: "aqe/adaptive-locators",
45685
+ fallbackChain: ["text", "aria", "fingerprint"]
45686
+ };
45687
+ }
45688
+ });
45689
+
45690
+ // src/domains/test-execution/services/e2e/adaptive-locator-service.ts
45691
+ function buildCaptureScript(cssSelector) {
45692
+ return `
45693
+ (() => {
45694
+ const el = document.querySelector(${JSON.stringify(cssSelector)});
45695
+ if (!el) return null;
45696
+ const parent = el.parentElement;
45697
+ const siblings = parent ? parent.children : [];
45698
+ let childIndex = 0;
45699
+ for (let i = 0; i < siblings.length; i++) {
45700
+ if (siblings[i] === el) { childIndex = i; break; }
45701
+ }
45702
+ return {
45703
+ tagName: el.tagName.toLowerCase(),
45704
+ classes: Array.from(el.classList),
45705
+ ariaRole: el.getAttribute('role') || undefined,
45706
+ ariaLabel: el.getAttribute('aria-label') || undefined,
45707
+ textContent: (el.textContent || '').trim().slice(0, 200) || undefined,
45708
+ attributes: {
45709
+ id: el.id || undefined,
45710
+ name: el.getAttribute('name') || undefined,
45711
+ 'data-testid': el.getAttribute('data-testid') || undefined,
45712
+ type: el.getAttribute('type') || undefined,
45713
+ placeholder: el.getAttribute('placeholder') || undefined,
45714
+ href: el.getAttribute('href') || undefined,
45715
+ },
45716
+ positionHints: {
45717
+ parentTag: parent ? parent.tagName.toLowerCase() : undefined,
45718
+ childIndex,
45719
+ siblingCount: siblings.length,
45720
+ },
45721
+ matchCount: 0,
45722
+ lastMatchedAt: new Date().toISOString(),
45723
+ };
45724
+ })()
45725
+ `;
45726
+ }
45727
+ function buildCandidatesScript() {
45728
+ return `
45729
+ (() => {
45730
+ const interactiveTags = 'a,button,input,select,textarea,[role],[data-testid],[aria-label]';
45731
+ const elements = document.querySelectorAll(interactiveTags);
45732
+ const results = [];
45733
+ for (let i = 0; i < Math.min(elements.length, 300); i++) {
45734
+ const el = elements[i];
45735
+ const parent = el.parentElement;
45736
+ const siblings = parent ? parent.children : [];
45737
+ let childIndex = 0;
45738
+ for (let j = 0; j < siblings.length; j++) {
45739
+ if (siblings[j] === el) { childIndex = j; break; }
45740
+ }
45741
+ results.push({
45742
+ tagName: el.tagName.toLowerCase(),
45743
+ classes: Array.from(el.classList),
45744
+ ariaRole: el.getAttribute('role') || undefined,
45745
+ ariaLabel: el.getAttribute('aria-label') || undefined,
45746
+ textContent: (el.textContent || '').trim().slice(0, 200) || undefined,
45747
+ attributes: {
45748
+ id: el.id || undefined,
45749
+ name: el.getAttribute('name') || undefined,
45750
+ 'data-testid': el.getAttribute('data-testid') || undefined,
45751
+ type: el.getAttribute('type') || undefined,
45752
+ placeholder: el.getAttribute('placeholder') || undefined,
45753
+ href: el.getAttribute('href') || undefined,
45754
+ },
45755
+ positionHints: {
45756
+ parentTag: parent ? parent.tagName.toLowerCase() : undefined,
45757
+ childIndex,
45758
+ siblingCount: siblings.length,
45759
+ },
45760
+ // Build a unique-enough CSS selector for this element
45761
+ selector: buildSelector(el),
45762
+ });
45763
+ }
45764
+
45765
+ function buildSelector(el) {
45766
+ if (el.id) return '#' + CSS.escape(el.id);
45767
+ if (el.getAttribute('data-testid')) return '[data-testid="' + el.getAttribute('data-testid') + '"]';
45768
+ if (el.getAttribute('name')) return el.tagName.toLowerCase() + '[name="' + el.getAttribute('name') + '"]';
45769
+ // Fallback: tag + nth-child
45770
+ const parent = el.parentElement;
45771
+ if (!parent) return el.tagName.toLowerCase();
45772
+ const siblings = Array.from(parent.children).filter(s => s.tagName === el.tagName);
45773
+ const idx = siblings.indexOf(el) + 1;
45774
+ return el.tagName.toLowerCase() + ':nth-of-type(' + idx + ')';
45775
+ }
45776
+
45777
+ return results;
45778
+ })()
45779
+ `;
45780
+ }
45781
+ function jaccardSimilarity(a37, b68) {
45782
+ if (a37.length === 0 && b68.length === 0) return 1;
45783
+ const setA = new Set(a37);
45784
+ const setB = new Set(b68);
45785
+ let intersection = 0;
45786
+ for (const item of setA) {
45787
+ if (setB.has(item)) intersection++;
45788
+ }
45789
+ const union = (/* @__PURE__ */ new Set([...setA, ...setB])).size;
45790
+ return union === 0 ? 0 : intersection / union;
45791
+ }
45792
+ function textSimilarity(a37, b68) {
45793
+ if (!a37 && !b68) return 1;
45794
+ if (!a37 || !b68) return 0;
45795
+ const la13 = a37.toLowerCase();
45796
+ const lb = b68.toLowerCase();
45797
+ if (la13 === lb) return 1;
45798
+ if (la13.includes(lb) || lb.includes(la13)) return 0.8;
45799
+ const setA = new Set(la13);
45800
+ const setB = new Set(lb);
45801
+ let common = 0;
45802
+ for (const c70 of setA) {
45803
+ if (setB.has(c70)) common++;
45804
+ }
45805
+ const total = (/* @__PURE__ */ new Set([...setA, ...setB])).size;
45806
+ return total === 0 ? 0 : common / total * 0.6;
45807
+ }
45808
+ function computeSimilarity(stored, candidate) {
45809
+ let score = 0;
45810
+ score += (stored.tagName === candidate.tagName ? 1 : 0) * WEIGHTS.tagName;
45811
+ if (stored.ariaRole || candidate.ariaRole) {
45812
+ score += (stored.ariaRole === candidate.ariaRole ? 1 : 0) * WEIGHTS.ariaRole;
45813
+ } else {
45814
+ score += WEIGHTS.ariaRole;
45815
+ }
45816
+ score += jaccardSimilarity(stored.classes, candidate.classes) * WEIGHTS.classes;
45817
+ score += textSimilarity(stored.textContent, candidate.textContent) * WEIGHTS.textContent;
45818
+ const storedAttrs = Object.entries(stored.attributes).filter(([, v62]) => v62);
45819
+ const candidateAttrs = Object.entries(candidate.attributes).filter(([, v62]) => v62);
45820
+ if (storedAttrs.length === 0 && candidateAttrs.length === 0) {
45821
+ score += WEIGHTS.attributes;
45822
+ } else {
45823
+ let matches = 0;
45824
+ for (const [key, val] of storedAttrs) {
45825
+ const candidateVal = candidate.attributes[key];
45826
+ if (candidateVal === val) matches++;
45827
+ }
45828
+ const total = Math.max(storedAttrs.length, candidateAttrs.length, 1);
45829
+ score += matches / total * WEIGHTS.attributes;
45830
+ }
45831
+ const posScore = computePositionScore(stored.positionHints, candidate.positionHints);
45832
+ score += posScore * WEIGHTS.positionHints;
45833
+ return Math.min(1, Math.max(0, score));
45834
+ }
45835
+ function computePositionScore(a37, b68) {
45836
+ let total = 0;
45837
+ let matches = 0;
45838
+ total++;
45839
+ if (a37.parentTag === b68.parentTag) matches++;
45840
+ total++;
45841
+ const indexDiff = Math.abs(a37.childIndex - b68.childIndex);
45842
+ matches += Math.max(0, 1 - indexDiff / 10);
45843
+ total++;
45844
+ const sibDiff = Math.abs(a37.siblingCount - b68.siblingCount);
45845
+ matches += Math.max(0, 1 - sibDiff / 10);
45846
+ return matches / total;
45847
+ }
45848
+ var WEIGHTS, FingerprintStore, AdaptiveLocatorService;
45849
+ var init_adaptive_locator_service = __esm({
45850
+ "src/domains/test-execution/services/e2e/adaptive-locator-service.ts"() {
45851
+ "use strict";
45852
+ init_adaptive_locator_types();
45853
+ WEIGHTS = {
45854
+ tagName: 0.2,
45855
+ ariaRole: 0.15,
45856
+ classes: 0.15,
45857
+ textContent: 0.2,
45858
+ attributes: 0.15,
45859
+ positionHints: 0.15
45860
+ };
45861
+ FingerprintStore = class {
45862
+ store = /* @__PURE__ */ new Map();
45863
+ maxPerPage;
45864
+ constructor(maxPerPage = 200) {
45865
+ this.maxPerPage = maxPerPage;
45866
+ }
45867
+ key(pageUrl, selector) {
45868
+ return `${pageUrl}::${selector}`;
45869
+ }
45870
+ get(pageUrl, selector) {
45871
+ return this.store.get(this.key(pageUrl, selector));
45872
+ }
45873
+ set(pageUrl, selector, fp) {
45874
+ const k68 = this.key(pageUrl, selector);
45875
+ this.store.set(k68, fp);
45876
+ const prefix = `${pageUrl}::`;
45877
+ const pageKeys = [...this.store.keys()].filter((key) => key.startsWith(prefix));
45878
+ if (pageKeys.length > this.maxPerPage) {
45879
+ const toRemove = pageKeys.length - this.maxPerPage;
45880
+ for (let i58 = 0; i58 < toRemove; i58++) {
45881
+ this.store.delete(pageKeys[i58]);
45882
+ }
45883
+ }
45884
+ }
45885
+ size() {
45886
+ return this.store.size;
45887
+ }
45888
+ clear() {
45889
+ this.store.clear();
45890
+ }
45891
+ };
45892
+ AdaptiveLocatorService = class {
45893
+ config;
45894
+ fingerprintStore;
45895
+ constructor(config) {
45896
+ this.config = { ...DEFAULT_ADAPTIVE_LOCATOR_CONFIG, ...config };
45897
+ this.fingerprintStore = new FingerprintStore(this.config.maxFingerprintsPerPage);
45898
+ }
45899
+ /**
45900
+ * Capture and store a fingerprint for a successfully-interacted element
45901
+ */
45902
+ async captureFingerprint(selector, client, pageUrl) {
45903
+ if (!this.config.enabled) return null;
45904
+ try {
45905
+ const cssSelector = this.toCssForCapture(selector);
45906
+ if (!cssSelector) return null;
45907
+ const result = await client.evaluate(
45908
+ buildCaptureScript(cssSelector)
45909
+ );
45910
+ if (!result.success || !result.value) return null;
45911
+ const fingerprint = result.value;
45912
+ fingerprint.matchCount = (this.fingerprintStore.get(pageUrl, selector)?.matchCount ?? 0) + 1;
45913
+ fingerprint.lastMatchedAt = (/* @__PURE__ */ new Date()).toISOString();
45914
+ this.fingerprintStore.set(pageUrl, selector, fingerprint);
45915
+ return fingerprint;
45916
+ } catch {
45917
+ return null;
45918
+ }
45919
+ }
45920
+ /**
45921
+ * Resolve an element target with adaptive fallback chain.
45922
+ *
45923
+ * 1. Try primary selector
45924
+ * 2. Text-based match
45925
+ * 3. ARIA-based match
45926
+ * 4. Fingerprint similarity matching
45927
+ */
45928
+ async resolveWithFallback(selector, client, pageUrl) {
45929
+ if (!this.config.enabled) return null;
45930
+ const storedFingerprint = this.fingerprintStore.get(pageUrl, selector);
45931
+ if (!storedFingerprint) return null;
45932
+ for (const method of this.config.fallbackChain) {
45933
+ const result = await this.tryFallbackMethod(method, storedFingerprint, client);
45934
+ if (result) return result;
45935
+ }
45936
+ return null;
45937
+ }
45938
+ /**
45939
+ * Get the fingerprint store size (for diagnostics)
45940
+ */
45941
+ getStoreSize() {
45942
+ return this.fingerprintStore.size();
45943
+ }
45944
+ /**
45945
+ * Clear all stored fingerprints
45946
+ */
45947
+ clearFingerprints() {
45948
+ this.fingerprintStore.clear();
45949
+ }
45950
+ // ==========================================================================
45951
+ // Private Helpers
45952
+ // ==========================================================================
45953
+ async tryFallbackMethod(method, stored, client) {
45954
+ switch (method) {
45955
+ case "text":
45956
+ return this.tryTextMatch(stored, client);
45957
+ case "aria":
45958
+ return this.tryAriaMatch(stored, client);
45959
+ case "fingerprint":
45960
+ return this.tryFingerprintMatch(stored, client);
45961
+ default:
45962
+ return null;
45963
+ }
45964
+ }
45965
+ async tryTextMatch(stored, client) {
45966
+ if (!stored.textContent) return null;
45967
+ const safeText = JSON.stringify(stored.textContent);
45968
+ const script = `
45969
+ (() => {
45970
+ const target = ${safeText};
45971
+ const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT);
45972
+ while (walker.nextNode()) {
45973
+ const el = walker.currentNode;
45974
+ const text = (el.textContent || '').trim().slice(0, 200);
45975
+ if (text === target) {
45976
+ if (el.id) return '#' + CSS.escape(el.id);
45977
+ if (el.getAttribute('data-testid')) return '[data-testid="' + el.getAttribute('data-testid') + '"]';
45978
+ return null;
45979
+ }
45980
+ }
45981
+ return null;
45982
+ })()
45983
+ `;
45984
+ try {
45985
+ const result = await client.evaluate(script);
45986
+ if (result.success && result.value) {
45987
+ return {
45988
+ resolvedSelector: result.value,
45989
+ method: "text",
45990
+ similarityScore: 0.9,
45991
+ fingerprintUpdated: false
45992
+ };
45993
+ }
45994
+ } catch {
45995
+ }
45996
+ return null;
45997
+ }
45998
+ async tryAriaMatch(stored, client) {
45999
+ if (!stored.ariaRole && !stored.ariaLabel) return null;
46000
+ let ariaSelector = "";
46001
+ if (stored.ariaRole && stored.ariaLabel) {
46002
+ ariaSelector = `[role="${stored.ariaRole}"][aria-label="${stored.ariaLabel}"]`;
46003
+ } else if (stored.ariaLabel) {
46004
+ ariaSelector = `[aria-label="${stored.ariaLabel}"]`;
46005
+ } else if (stored.ariaRole) {
46006
+ ariaSelector = `[role="${stored.ariaRole}"]`;
46007
+ }
46008
+ if (!ariaSelector) return null;
46009
+ try {
46010
+ const checkScript = `!!document.querySelector(${JSON.stringify(ariaSelector)})`;
46011
+ const result = await client.evaluate(checkScript);
46012
+ if (result.success && result.value) {
46013
+ return {
46014
+ resolvedSelector: ariaSelector,
46015
+ method: "aria",
46016
+ similarityScore: 0.85,
46017
+ fingerprintUpdated: false
46018
+ };
46019
+ }
46020
+ } catch {
46021
+ }
46022
+ return null;
46023
+ }
46024
+ async tryFingerprintMatch(stored, client) {
46025
+ try {
46026
+ const result = await client.evaluate(buildCandidatesScript());
46027
+ if (!result.success || !result.value?.length) return null;
46028
+ let bestScore = 0;
46029
+ let bestSelector = "";
46030
+ for (const candidate of result.value) {
46031
+ const score = computeSimilarity(stored, candidate);
46032
+ if (score > bestScore) {
46033
+ bestScore = score;
46034
+ bestSelector = candidate.selector;
46035
+ }
46036
+ }
46037
+ if (bestScore >= this.config.similarityThreshold && bestSelector) {
46038
+ return {
46039
+ resolvedSelector: bestSelector,
46040
+ method: "fingerprint",
46041
+ similarityScore: bestScore,
46042
+ fingerprintUpdated: false
46043
+ };
46044
+ }
46045
+ } catch {
46046
+ }
46047
+ return null;
46048
+ }
46049
+ /**
46050
+ * Convert a selector string to a CSS selector suitable for capture.
46051
+ * Returns null for non-CSS selectors that can't be used with querySelector.
46052
+ */
46053
+ toCssForCapture(selector) {
46054
+ if (selector.startsWith("//") || selector.startsWith("xpath=")) return null;
46055
+ if (/^@?e\d+$/.test(selector)) return null;
46056
+ if (selector.startsWith("text=")) return null;
46057
+ return selector;
46058
+ }
46059
+ };
46060
+ }
46061
+ });
46062
+
45130
46063
  // src/domains/test-execution/services/e2e/browser-orchestrator.ts
45131
46064
  function isAgentBrowserClient(client) {
45132
46065
  return "tool" in client && client.tool === "agent-browser";
@@ -45196,18 +46129,24 @@ var init_browser_orchestrator = __esm({
45196
46129
  "src/domains/test-execution/services/e2e/browser-orchestrator.ts"() {
45197
46130
  "use strict";
45198
46131
  init_error_utils();
46132
+ init_adaptive_locator_service();
46133
+ init_browser();
45199
46134
  BrowserOrchestrator = class {
45200
46135
  client;
45201
46136
  unifiedClient;
45202
46137
  useAgentBrowser;
45203
46138
  config;
45204
46139
  log;
46140
+ adaptiveLocator = null;
45205
46141
  constructor(client, config, logger22) {
45206
46142
  this.client = client;
45207
46143
  this.config = config;
45208
46144
  this.log = logger22;
45209
46145
  this.unifiedClient = config.browserClient ?? client;
45210
46146
  this.useAgentBrowser = isAgentBrowserClient(this.unifiedClient);
46147
+ if (config.adaptiveLocator?.enabled) {
46148
+ this.adaptiveLocator = new AdaptiveLocatorService(config.adaptiveLocator);
46149
+ }
45211
46150
  }
45212
46151
  /**
45213
46152
  * Get the unified browser client
@@ -45235,6 +46174,9 @@ var init_browser_orchestrator = __esm({
45235
46174
  if (!launchResult.success) {
45236
46175
  return `Failed to launch browser: ${launchResult.error.message}`;
45237
46176
  }
46177
+ if (this.config.resourceBlocking) {
46178
+ await this.applyResourceBlocking(this.unifiedClient, this.config.resourceBlocking);
46179
+ }
45238
46180
  return null;
45239
46181
  } else if (isVibiumClient(this.client)) {
45240
46182
  const session = await this.client.getSession();
@@ -45379,6 +46321,88 @@ var init_browser_orchestrator = __esm({
45379
46321
  await this.client.findElement({ selector, visible: true });
45380
46322
  }
45381
46323
  }
46324
+ /**
46325
+ * Resolve an element target with adaptive fallback.
46326
+ * If the primary selector fails and adaptive locator is configured,
46327
+ * attempts fallback matching via text, ARIA, and fingerprint similarity.
46328
+ */
46329
+ async resolveElementTarget(selector, pageUrl) {
46330
+ const primaryTarget = toElementTarget(selector);
46331
+ if (!this.adaptiveLocator || isVibiumClient(this.unifiedClient)) {
46332
+ return primaryTarget;
46333
+ }
46334
+ const browserClient = this.unifiedClient;
46335
+ try {
46336
+ const result = await browserClient.isVisible(primaryTarget);
46337
+ if (result.success && result.value) {
46338
+ await this.adaptiveLocator.captureFingerprint(selector, browserClient, pageUrl);
46339
+ return primaryTarget;
46340
+ }
46341
+ } catch {
46342
+ }
46343
+ const resolution = await this.adaptiveLocator.resolveWithFallback(
46344
+ selector,
46345
+ browserClient,
46346
+ pageUrl
46347
+ );
46348
+ if (resolution) {
46349
+ this.log(
46350
+ `Adaptive locator: resolved "${selector}" via ${resolution.method} (score: ${resolution.similarityScore.toFixed(2)})`
46351
+ );
46352
+ return toElementTarget(resolution.resolvedSelector);
46353
+ }
46354
+ return primaryTarget;
46355
+ }
46356
+ /**
46357
+ * Apply resource blocking to a browser client's page via evaluate-based interception.
46358
+ * Injects a PerformanceObserver that aborts blocked resource loads.
46359
+ * For full route-level blocking, use StealthBrowserClient which has native page.route().
46360
+ */
46361
+ async applyResourceBlocking(client, config) {
46362
+ const blockingConfig = typeof config === "string" ? getResourceBlockingPreset(config) : config;
46363
+ if (!blockingConfig.enabled) return;
46364
+ this.log(`Resource blocking enabled: ${blockingConfig.blockedCategories.join(", ")}`);
46365
+ if (isAgentBrowserClient(this.unifiedClient)) {
46366
+ const agentClient = this.unifiedClient;
46367
+ const patterns = [];
46368
+ if (blockingConfig.blockedCategories.includes("tracking")) {
46369
+ patterns.push(
46370
+ "*google-analytics.com*",
46371
+ "*googletagmanager.com*",
46372
+ "*hotjar.com*",
46373
+ "*segment.com*",
46374
+ "*mixpanel.com*",
46375
+ "*amplitude.com*",
46376
+ "*fullstory.com*",
46377
+ "*clarity.ms*",
46378
+ "*facebook.net*"
46379
+ );
46380
+ }
46381
+ if (blockingConfig.blockedCategories.includes("advertising")) {
46382
+ patterns.push(
46383
+ "*doubleclick.net*",
46384
+ "*googlesyndication.com*",
46385
+ "*googleadservices.com*",
46386
+ "*adnxs.com*",
46387
+ "*criteo.com*",
46388
+ "*taboola.com*",
46389
+ "*outbrain.com*"
46390
+ );
46391
+ }
46392
+ if (blockingConfig.blockPatterns) {
46393
+ patterns.push(...blockingConfig.blockPatterns);
46394
+ }
46395
+ for (const pattern of patterns) {
46396
+ await agentClient.abortRoute(pattern);
46397
+ }
46398
+ }
46399
+ }
46400
+ /**
46401
+ * Get the adaptive locator service (for external fingerprint capture)
46402
+ */
46403
+ getAdaptiveLocator() {
46404
+ return this.adaptiveLocator;
46405
+ }
45382
46406
  /**
45383
46407
  * Get browser context options from test case
45384
46408
  */
@@ -46042,7 +47066,10 @@ var init_step_executors = __esm({
46042
47066
  async executeClickStep(step, client, context) {
46043
47067
  if (!isVibiumClient(client)) {
46044
47068
  const browserClient = client;
46045
- const target = toElementTarget(step.target);
47069
+ const target = await this.orchestrator.resolveElementTarget(
47070
+ step.target,
47071
+ this.getCurrentPageUrl(context)
47072
+ );
46046
47073
  if (context.useAgentBrowser && isAgentBrowserClient(browserClient)) {
46047
47074
  const waitResult = await browserClient.waitForElement(target, step.timeout);
46048
47075
  if (!waitResult.success) {
@@ -46105,7 +47132,10 @@ var init_step_executors = __esm({
46105
47132
  async executeTypeStep(step, client, context) {
46106
47133
  if (!isVibiumClient(client)) {
46107
47134
  const browserClient = client;
46108
- const target = toElementTarget(step.target);
47135
+ const target = await this.orchestrator.resolveElementTarget(
47136
+ step.target,
47137
+ this.getCurrentPageUrl(context)
47138
+ );
46109
47139
  if (context.useAgentBrowser && isAgentBrowserClient(browserClient)) {
46110
47140
  const waitResult = await browserClient.waitForElement(target, step.timeout);
46111
47141
  if (!waitResult.success) {
@@ -46362,6 +47392,20 @@ var init_step_executors = __esm({
46362
47392
  // ==========================================================================
46363
47393
  // Utility Methods
46364
47394
  // ==========================================================================
47395
+ /**
47396
+ * Get the current page URL from context, falling back to baseUrl.
47397
+ * Uses the last navigate step's URL if available, so adaptive locator
47398
+ * fingerprints are keyed to the actual page, not just the base URL.
47399
+ */
47400
+ getCurrentPageUrl(context) {
47401
+ for (let i58 = context.previousResults.length - 1; i58 >= 0; i58--) {
47402
+ const result = context.previousResults[i58];
47403
+ if (result.data?.url && typeof result.data.url === "string") {
47404
+ return result.data.url;
47405
+ }
47406
+ }
47407
+ return context.baseUrl;
47408
+ }
46365
47409
  resolveUrl(url, baseUrl) {
46366
47410
  if (url.startsWith("http://") || url.startsWith("https://")) {
46367
47411
  return url;
@@ -99952,7 +100996,7 @@ var init_spreading_activation = __esm({
99952
100996
  });
99953
100997
 
99954
100998
  // src/learning/dream/insight-generator.ts
99955
- import { randomUUID as randomUUID6 } from "crypto";
100999
+ import { randomUUID as randomUUID7 } from "crypto";
99956
101000
  var DEFAULT_INSIGHT_CONFIG, InsightGenerator;
99957
101001
  var init_insight_generator = __esm({
99958
101002
  "src/learning/dream/insight-generator.ts"() {
@@ -100475,7 +101519,7 @@ var init_insight_generator = __esm({
100475
101519
  */
100476
101520
  generateId() {
100477
101521
  const timestamp = Date.now();
100478
- const random = randomUUID6().slice(0, 8);
101522
+ const random = randomUUID7().slice(0, 8);
100479
101523
  return `insight-${timestamp}-${random}`;
100480
101524
  }
100481
101525
  /**
@@ -106839,7 +107883,7 @@ var init_plugin14 = __esm({
106839
107883
  });
106840
107884
 
106841
107885
  // src/kernel/kernel.ts
106842
- import { randomUUID as randomUUID7 } from "crypto";
107886
+ import { randomUUID as randomUUID8 } from "crypto";
106843
107887
  import * as path14 from "path";
106844
107888
  import * as fs13 from "fs";
106845
107889
  var DOMAIN_FACTORIES, DEFAULT_CONFIG64, QEKernelImpl;
@@ -106944,7 +107988,7 @@ var init_kernel = __esm({
106944
107988
  if (this._config.memoryBackend === "memory") {
106945
107989
  const tmpDbPath = path14.join(
106946
107990
  __require("os").tmpdir(),
106947
- `aqe-test-${Date.now()}-${randomUUID7().slice(0, 12)}.db`
107991
+ `aqe-test-${Date.now()}-${randomUUID8().slice(0, 12)}.db`
106948
107992
  );
106949
107993
  await initializeUnifiedPersistence({ dbPath: tmpDbPath });
106950
107994
  } else {
@@ -110082,7 +111126,7 @@ var init_mailbox = __esm({
110082
111126
  });
110083
111127
 
110084
111128
  // src/coordination/agent-teams/tracing.ts
110085
- import { randomUUID as randomUUID8 } from "node:crypto";
111129
+ import { randomUUID as randomUUID9 } from "node:crypto";
110086
111130
  function encodeTraceContext(context) {
110087
111131
  return `${TRACE_PREFIX}${JSON.stringify({
110088
111132
  traceId: context.traceId,
@@ -110115,8 +111159,8 @@ var init_tracing = __esm({
110115
111159
  * @returns The new trace context and root span
110116
111160
  */
110117
111161
  startTrace(options) {
110118
- const traceId = randomUUID8();
110119
- const spanId = randomUUID8();
111162
+ const traceId = randomUUID9();
111163
+ const spanId = randomUUID9();
110120
111164
  const context = { traceId, spanId };
110121
111165
  const span = this.createSpan(context, options);
110122
111166
  return { context, span };
@@ -110132,8 +111176,8 @@ var init_tracing = __esm({
110132
111176
  */
110133
111177
  startSpan(options) {
110134
111178
  const parentContext = options.parentContext;
110135
- const traceId = parentContext?.traceId ?? randomUUID8();
110136
- const spanId = randomUUID8();
111179
+ const traceId = parentContext?.traceId ?? randomUUID9();
111180
+ const spanId = randomUUID9();
110137
111181
  const context = {
110138
111182
  traceId,
110139
111183
  spanId,
@@ -110292,7 +111336,7 @@ var init_tracing = __esm({
110292
111336
  });
110293
111337
 
110294
111338
  // src/coordination/agent-teams/adapter.ts
110295
- import { randomUUID as randomUUID9 } from "node:crypto";
111339
+ import { randomUUID as randomUUID10 } from "node:crypto";
110296
111340
  function createAgentTeamsAdapter(config) {
110297
111341
  return new AgentTeamsAdapter(void 0, config);
110298
111342
  }
@@ -110436,7 +111480,7 @@ var init_adapter = __esm({
110436
111480
  const senderDomain = this.agentDomains.get(from);
110437
111481
  const correlationId = options?.traceContext ? encodeTraceContext(options.traceContext) : options?.correlationId;
110438
111482
  const message = {
110439
- id: randomUUID9(),
111483
+ id: randomUUID10(),
110440
111484
  from,
110441
111485
  to: to2,
110442
111486
  domain: options?.domain ?? senderDomain,
@@ -110462,7 +111506,7 @@ var init_adapter = __esm({
110462
111506
  }
110463
111507
  const correlationId = options?.traceContext ? encodeTraceContext(options.traceContext) : options?.correlationId;
110464
111508
  const message = {
110465
- id: randomUUID9(),
111509
+ id: randomUUID10(),
110466
111510
  from,
110467
111511
  to: "broadcast",
110468
111512
  domain,
@@ -112653,7 +113697,7 @@ var init_types11 = __esm({
112653
113697
  });
112654
113698
 
112655
113699
  // src/coordination/competing-hypotheses/hypothesis-manager.ts
112656
- import { randomUUID as randomUUID10 } from "node:crypto";
113700
+ import { randomUUID as randomUUID11 } from "node:crypto";
112657
113701
  function createHypothesisManager(config) {
112658
113702
  return new HypothesisManager(config);
112659
113703
  }
@@ -112680,7 +113724,7 @@ var init_hypothesis_manager = __esm({
112680
113724
  * @returns Immutable snapshot of the created investigation
112681
113725
  */
112682
113726
  createInvestigation(taskId, domain, description) {
112683
- const id = `inv-${randomUUID10().slice(0, 8)}`;
113727
+ const id = `inv-${randomUUID11().slice(0, 8)}`;
112684
113728
  const now = Date.now();
112685
113729
  const investigation = {
112686
113730
  id,
@@ -112718,7 +113762,7 @@ var init_hypothesis_manager = __esm({
112718
113762
  );
112719
113763
  }
112720
113764
  const hypothesis = {
112721
- id: `hyp-${randomUUID10().slice(0, 8)}`,
113765
+ id: `hyp-${randomUUID11().slice(0, 8)}`,
112722
113766
  description,
112723
113767
  investigatorAgentId: agentId,
112724
113768
  strategy,
@@ -112786,7 +113830,7 @@ var init_hypothesis_manager = __esm({
112786
113830
  const hyp = this.findHypothesis(inv, hypothesisId);
112787
113831
  const fullEvidence = {
112788
113832
  ...evidence,
112789
- id: `evi-${randomUUID10().slice(0, 8)}`,
113833
+ id: `evi-${randomUUID11().slice(0, 8)}`,
112790
113834
  hypothesisId,
112791
113835
  timestamp: Date.now()
112792
113836
  };
@@ -112997,7 +114041,7 @@ var init_types12 = __esm({
112997
114041
  });
112998
114042
 
112999
114043
  // src/coordination/federation/federation-mailbox.ts
113000
- import { randomUUID as randomUUID11 } from "node:crypto";
114044
+ import { randomUUID as randomUUID12 } from "node:crypto";
113001
114045
  function toServiceSnapshot(service) {
113002
114046
  return {
113003
114047
  fleetId: service.fleetId,
@@ -113176,7 +114220,7 @@ var init_federation_mailbox = __esm({
113176
114220
  throw new Error(`No route found for ${sourceDomain} -> ${targetDomain}`);
113177
114221
  }
113178
114222
  const message = {
113179
- id: randomUUID11(),
114223
+ id: randomUUID12(),
113180
114224
  sourceFleetId: this.config.localFleetId,
113181
114225
  targetFleetId: resolvedTarget,
113182
114226
  sourceDomain,
@@ -113400,7 +114444,7 @@ var init_types13 = __esm({
113400
114444
  });
113401
114445
 
113402
114446
  // src/coordination/dynamic-scaling/dynamic-scaler.ts
113403
- import { randomUUID as randomUUID12 } from "node:crypto";
114447
+ import { randomUUID as randomUUID13 } from "node:crypto";
113404
114448
  function createDynamicScaler(initialAgents, config) {
113405
114449
  return new DynamicScaler(initialAgents, config);
113406
114450
  }
@@ -113555,7 +114599,7 @@ var init_dynamic_scaler = __esm({
113555
114599
  */
113556
114600
  async execute(decision, executor2) {
113557
114601
  const event = {
113558
- id: `scale-${randomUUID12().slice(0, 8)}`,
114602
+ id: `scale-${randomUUID13().slice(0, 8)}`,
113559
114603
  decision,
113560
114604
  executedAt: Date.now(),
113561
114605
  success: true
@@ -113848,10 +114892,10 @@ var init_queen_types = __esm({
113848
114892
  });
113849
114893
 
113850
114894
  // src/types/cross-phase-signals.ts
113851
- import { randomUUID as randomUUID13 } from "crypto";
114895
+ import { randomUUID as randomUUID14 } from "crypto";
113852
114896
  function createSignalId(loopType, prefix) {
113853
114897
  const timestamp = Date.now();
113854
- const random = randomUUID13().split("-")[0];
114898
+ const random = randomUUID14().split("-")[0];
113855
114899
  return `${prefix || loopType}-signal-${timestamp}-${random}`;
113856
114900
  }
113857
114901
  function calculateExpiry(ttlMs) {
@@ -125924,7 +126968,7 @@ var init_hyperbolic_ops = __esm({
125924
126968
  });
125925
126969
 
125926
126970
  // src/integrations/agentic-flow/onnx-embeddings/adapter.ts
125927
- import { randomUUID as randomUUID14 } from "crypto";
126971
+ import { randomUUID as randomUUID15 } from "crypto";
125928
126972
  function createONNXEmbeddingsAdapter(config) {
125929
126973
  return new ONNXEmbeddingsAdapter(config);
125930
126974
  }
@@ -126231,7 +127275,7 @@ var init_adapter3 = __esm({
126231
127275
  * Generate unique ID for stored embeddings
126232
127276
  */
126233
127277
  generateId() {
126234
- return `emb_${Date.now()}_${randomUUID14().slice(0, 9)}`;
127278
+ return `emb_${Date.now()}_${randomUUID15().slice(0, 9)}`;
126235
127279
  }
126236
127280
  /**
126237
127281
  * Check if adapter is ready
@@ -129597,7 +130641,7 @@ var init_test_outcome_tracker = __esm({
129597
130641
  });
129598
130642
 
129599
130643
  // src/feedback/coverage-learner.ts
129600
- import { randomUUID as randomUUID15 } from "crypto";
130644
+ import { randomUUID as randomUUID16 } from "crypto";
129601
130645
  function createCoverageLearner(config) {
129602
130646
  return new CoverageLearner(config);
129603
130647
  }
@@ -129846,7 +130890,7 @@ var init_coverage_learner = __esm({
129846
130890
  };
129847
130891
  } else {
129848
130892
  strategy = {
129849
- id: `strategy-${Date.now()}-${randomUUID15().slice(0, 8)}`,
130893
+ id: `strategy-${Date.now()}-${randomUUID16().slice(0, 8)}`,
129850
130894
  description: this.generateStrategyDescription(session, improvement),
129851
130895
  technique: session.technique,
129852
130896
  filePatterns: [filePattern],
@@ -131600,7 +132644,7 @@ var init_qe_agent_registry = __esm({
131600
132644
  });
131601
132645
 
131602
132646
  // src/routing/routing-feedback.ts
131603
- import { randomUUID as randomUUID16 } from "crypto";
132647
+ import { randomUUID as randomUUID17 } from "crypto";
131604
132648
  function createRoutingFeedbackCollector(maxOutcomes = 1e4) {
131605
132649
  return new RoutingFeedbackCollector(maxOutcomes);
131606
132650
  }
@@ -131755,7 +132799,7 @@ var init_routing_feedback = __esm({
131755
132799
  */
131756
132800
  recordOutcome(task, decision, usedAgent, outcome) {
131757
132801
  const routingOutcome = {
131758
- id: `outcome-${Date.now()}-${randomUUID16().slice(0, 8)}`,
132802
+ id: `outcome-${Date.now()}-${randomUUID17().slice(0, 8)}`,
131759
132803
  task,
131760
132804
  decision,
131761
132805
  usedAgent,
@@ -134444,7 +135488,7 @@ var init_detect = __esm({
134444
135488
  });
134445
135489
 
134446
135490
  // src/adapters/claude-flow/trajectory-bridge.ts
134447
- import { randomUUID as randomUUID17 } from "node:crypto";
135491
+ import { randomUUID as randomUUID18 } from "node:crypto";
134448
135492
  var TrajectoryBridge;
134449
135493
  var init_trajectory_bridge = __esm({
134450
135494
  "src/adapters/claude-flow/trajectory-bridge.ts"() {
@@ -134472,7 +135516,7 @@ var init_trajectory_bridge = __esm({
134472
135516
  * Start a new trajectory
134473
135517
  */
134474
135518
  async startTrajectory(task, agent) {
134475
- const id = `trajectory-${randomUUID17()}`;
135519
+ const id = `trajectory-${randomUUID18()}`;
134476
135520
  if (this.claudeFlowAvailable) {
134477
135521
  try {
134478
135522
  const { execSync: execSync6 } = await import("child_process");
@@ -140233,7 +141277,7 @@ __export(aqe_learning_engine_exports, {
140233
141277
  createAQELearningEngine: () => createAQELearningEngine,
140234
141278
  createDefaultLearningEngine: () => createDefaultLearningEngine
140235
141279
  });
140236
- import { randomUUID as randomUUID18 } from "crypto";
141280
+ import { randomUUID as randomUUID19 } from "crypto";
140237
141281
  function createAQELearningEngine(memory, config, eventBus) {
140238
141282
  return new AQELearningEngine(memory, config, eventBus);
140239
141283
  }
@@ -140519,7 +141563,7 @@ var init_aqe_learning_engine = __esm({
140519
141563
  avgSimilarity: results.length > 0 ? results.reduce((sum, r54) => sum + r54.similarity, 0) / results.length : 0
140520
141564
  };
140521
141565
  try {
140522
- const key = `pattern-usage:search:${Date.now()}-${randomUUID18().slice(0, 8)}`;
141566
+ const key = `pattern-usage:search:${Date.now()}-${randomUUID19().slice(0, 8)}`;
140523
141567
  await this.memory.set(key, searchEvent, {
140524
141568
  persist: true,
140525
141569
  ttl: 7 * 24 * 60 * 60 * 1e3
@@ -140677,7 +141721,7 @@ var init_aqe_learning_engine = __esm({
140677
141721
  * Also starts experience capture for pattern learning.
140678
141722
  */
140679
141723
  async startTask(task, agent, domain) {
140680
- const id = `task-${Date.now()}-${randomUUID18().slice(0, 8)}`;
141724
+ const id = `task-${Date.now()}-${randomUUID19().slice(0, 8)}`;
140681
141725
  let trajectoryId = id;
140682
141726
  if (this.claudeFlowBridge?.trajectory.isClaudeFlowAvailable()) {
140683
141727
  try {
@@ -140972,12 +142016,12 @@ var init_aqe_learning_engine = __esm({
140972
142016
  });
140973
142017
 
140974
142018
  // src/mcp/handlers/handler-factory.ts
140975
- import { randomUUID as randomUUID19 } from "crypto";
142019
+ import { randomUUID as randomUUID20 } from "crypto";
140976
142020
  function generateTestId() {
140977
- return `test-${randomUUID19()}`;
142021
+ return `test-${randomUUID20()}`;
140978
142022
  }
140979
142023
  function generateAgentId(type) {
140980
- return `${type}-${randomUUID19()}`;
142024
+ return `${type}-${randomUUID20()}`;
140981
142025
  }
140982
142026
  function generateV2LearningFeedback(agentType) {
140983
142027
  return {
@@ -142734,7 +143778,7 @@ var init_early_exit_token_optimizer = __esm({
142734
143778
  });
142735
143779
 
142736
143780
  // src/learning/token-tracker.ts
142737
- import { randomUUID as randomUUID20 } from "crypto";
143781
+ import { randomUUID as randomUUID21 } from "crypto";
142738
143782
  function formatWithCommas(n61) {
142739
143783
  return n61.toLocaleString("en-US");
142740
143784
  }
@@ -142831,7 +143875,7 @@ var init_token_tracker = __esm({
142831
143875
  static KV_PERSIST_INTERVAL = 10;
142832
143876
  // every 10 operations
142833
143877
  constructor() {
142834
- this.sessionId = `session-${Date.now()}-${randomUUID20().substring(0, 8)}`;
143878
+ this.sessionId = `session-${Date.now()}-${randomUUID21().substring(0, 8)}`;
142835
143879
  this.sessionStartTime = Date.now();
142836
143880
  this.costConfig = DEFAULT_COST_CONFIG;
142837
143881
  }
@@ -143121,7 +144165,7 @@ var init_token_tracker = __esm({
143121
144165
  this.taskMetrics = [];
143122
144166
  this.agentMetrics.clear();
143123
144167
  this.domainMetrics.clear();
143124
- this.sessionId = `session-${Date.now()}-${randomUUID20().substring(0, 8)}`;
144168
+ this.sessionId = `session-${Date.now()}-${randomUUID21().substring(0, 8)}`;
143125
144169
  this.sessionStartTime = Date.now();
143126
144170
  this.cacheHits = 0;
143127
144171
  this.earlyExits = 0;
@@ -143481,7 +144525,7 @@ var init_token_tracker = __esm({
143481
144525
  });
143482
144526
 
143483
144527
  // src/optimization/token-optimizer-service.ts
143484
- import { randomUUID as randomUUID21 } from "crypto";
144528
+ import { randomUUID as randomUUID22 } from "crypto";
143485
144529
  async function initializeTokenOptimizer(memoryBackend2, config) {
143486
144530
  await TokenOptimizerService.initialize(memoryBackend2, config);
143487
144531
  }
@@ -143594,7 +144638,7 @@ var init_token_optimizer_service = __esm({
143594
144638
  try {
143595
144639
  const result = await this.patternStore.store({
143596
144640
  ...pattern,
143597
- id: `pattern-${Date.now()}-${randomUUID21().slice(0, 8)}`,
144641
+ id: `pattern-${Date.now()}-${randomUUID22().slice(0, 8)}`,
143598
144642
  createdAt: /* @__PURE__ */ new Date(),
143599
144643
  lastUsedAt: /* @__PURE__ */ new Date()
143600
144644
  });
@@ -151142,7 +152186,7 @@ var init_qe_action_library = __esm({
151142
152186
  });
151143
152187
 
151144
152188
  // src/planning/goap-planner.ts
151145
- import { randomUUID as randomUUID22 } from "crypto";
152189
+ import { randomUUID as randomUUID23 } from "crypto";
151146
152190
  function getSharedGOAPPlanner() {
151147
152191
  if (!sharedPlanner) {
151148
152192
  sharedPlanner = new GOAPPlanner();
@@ -151266,7 +152310,7 @@ var init_goap_planner = __esm({
151266
152310
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
151267
152311
  `);
151268
152312
  for (const action of allActions) {
151269
- const id = `action-${Date.now()}-${randomUUID22().slice(0, 8)}`;
152313
+ const id = `action-${Date.now()}-${randomUUID23().slice(0, 8)}`;
151270
152314
  insertAction.run(
151271
152315
  id,
151272
152316
  action.name,
@@ -151284,7 +152328,7 @@ var init_goap_planner = __esm({
151284
152328
  VALUES (?, ?, ?, ?, ?, ?)
151285
152329
  `);
151286
152330
  for (const goal of QE_GOALS) {
151287
- const id = `goal-${Date.now()}-${randomUUID22().slice(0, 8)}`;
152331
+ const id = `goal-${Date.now()}-${randomUUID23().slice(0, 8)}`;
151288
152332
  insertGoal.run(
151289
152333
  id,
151290
152334
  goal.name,
@@ -151316,7 +152360,7 @@ var init_goap_planner = __esm({
151316
152360
  this.recordPlanReuse(reusedPlan.id, true);
151317
152361
  return {
151318
152362
  ...reusedPlan,
151319
- id: `plan-${Date.now()}-${randomUUID22().slice(0, 8)}`,
152363
+ id: `plan-${Date.now()}-${randomUUID23().slice(0, 8)}`,
151320
152364
  initialState: this.cloneState(currentState),
151321
152365
  reusedFrom: reusedPlan.id,
151322
152366
  status: "pending"
@@ -151334,7 +152378,7 @@ var init_goap_planner = __esm({
151334
152378
  return null;
151335
152379
  }
151336
152380
  const plan = {
151337
- id: `plan-${Date.now()}-${randomUUID22().slice(0, 8)}`,
152381
+ id: `plan-${Date.now()}-${randomUUID23().slice(0, 8)}`,
151338
152382
  initialState: this.cloneState(currentState),
151339
152383
  goalState: goal,
151340
152384
  actions: actionSequence,
@@ -151703,7 +152747,7 @@ var init_goap_planner = __esm({
151703
152747
  */
151704
152748
  async addAction(action) {
151705
152749
  await this.initialize();
151706
- const id = `action-${Date.now()}-${randomUUID22().slice(0, 8)}`;
152750
+ const id = `action-${Date.now()}-${randomUUID23().slice(0, 8)}`;
151707
152751
  this.ensureDb().prepare(
151708
152752
  `
151709
152753
  INSERT INTO goap_actions (
@@ -151865,7 +152909,7 @@ var init_goap_planner = __esm({
151865
152909
  ) VALUES (?, ?, ?, ?, ?, ?)
151866
152910
  `
151867
152911
  ).run(
151868
- `sig-${Date.now()}-${randomUUID22().slice(0, 8)}`,
152912
+ `sig-${Date.now()}-${randomUUID23().slice(0, 8)}`,
151869
152913
  plan.id,
151870
152914
  goalHash,
151871
152915
  JSON.stringify(stateVector),
@@ -151949,7 +152993,7 @@ var init_goap_planner = __esm({
151949
152993
  */
151950
152994
  async addGoal(goal) {
151951
152995
  await this.initialize();
151952
- const id = `goal-${Date.now()}-${randomUUID22().slice(0, 8)}`;
152996
+ const id = `goal-${Date.now()}-${randomUUID23().slice(0, 8)}`;
151953
152997
  this.ensureDb().prepare(
151954
152998
  `
151955
152999
  INSERT INTO goap_goals (id, name, description, conditions, priority, qe_domain)
@@ -152033,7 +153077,7 @@ var init_goap_planner = __esm({
152033
153077
  });
152034
153078
 
152035
153079
  // src/planning/plan-executor.ts
152036
- import { randomUUID as randomUUID23 } from "crypto";
153080
+ import { randomUUID as randomUUID24 } from "crypto";
152037
153081
  function createMockExecutor(planner, options) {
152038
153082
  const spawner = new MockAgentSpawner({
152039
153083
  successRate: options?.successRate ?? 1
@@ -152185,7 +153229,7 @@ var init_plan_executor = __esm({
152185
153229
  async executeWithCallbacks(plan, onStepStart, onStepComplete, initialState) {
152186
153230
  await this.initialize();
152187
153231
  const startTime = Date.now();
152188
- const executionId = `exec-${Date.now()}-${randomUUID23().slice(0, 8)}`;
153232
+ const executionId = `exec-${Date.now()}-${randomUUID24().slice(0, 8)}`;
152189
153233
  this.currentExecution = { planId: plan.id, cancelled: false };
152190
153234
  const result = {
152191
153235
  planId: plan.id,
@@ -152197,7 +153241,7 @@ var init_plan_executor = __esm({
152197
153241
  };
152198
153242
  let currentState = initialState ? this.cloneState(initialState) : this.cloneState(plan.initialState);
152199
153243
  const steps = plan.actions.map((action, index) => ({
152200
- id: `step-${Date.now()}-${randomUUID23().slice(0, 8)}`,
153244
+ id: `step-${Date.now()}-${randomUUID24().slice(0, 8)}`,
152201
153245
  planId: plan.id,
152202
153246
  action,
152203
153247
  stepOrder: index,
@@ -152720,7 +153764,7 @@ Expected effects:`;
152720
153764
  async spawn(agentType, task) {
152721
153765
  await new Promise((resolve10) => setTimeout(resolve10, this.executionDelay));
152722
153766
  const success = secureRandom() < this.successRate;
152723
- const agentId = `mock-agent-${randomUUID23().slice(0, 8)}`;
153767
+ const agentId = `mock-agent-${randomUUID24().slice(0, 8)}`;
152724
153768
  if (success) {
152725
153769
  return {
152726
153770
  agentId,
@@ -154266,7 +155310,7 @@ var init_causal_verifier = __esm({
154266
155310
  });
154267
155311
 
154268
155312
  // src/learning/memory-auditor.ts
154269
- import { randomUUID as randomUUID24 } from "crypto";
155313
+ import { randomUUID as randomUUID25 } from "crypto";
154270
155314
  function createMemoryAuditor(coherenceService, eventBus, config) {
154271
155315
  return new MemoryCoherenceAuditor(
154272
155316
  coherenceService,
@@ -154596,7 +155640,7 @@ var init_memory_auditor = __esm({
154596
155640
  if (!this.eventBus) return;
154597
155641
  try {
154598
155642
  await this.eventBus.publish({
154599
- id: `memory-audit-${Date.now()}-${randomUUID24().split("-")[0]}`,
155643
+ id: `memory-audit-${Date.now()}-${randomUUID25().split("-")[0]}`,
154600
155644
  type: eventType,
154601
155645
  source: "learning-optimization",
154602
155646
  timestamp: /* @__PURE__ */ new Date(),
@@ -162733,7 +163777,7 @@ async function handleAQEHealth() {
162733
163777
  success: true,
162734
163778
  data: {
162735
163779
  status: healthStatus,
162736
- version: true ? "3.7.6" : "3.7.2",
163780
+ version: true ? "3.7.7" : "3.7.2",
162737
163781
  loadedDomains: domainCount,
162738
163782
  memory: memoryStats,
162739
163783
  hnsw: hnswStats,
@@ -168140,7 +169184,7 @@ function registerMissingQETools(registerFn) {
168140
169184
  }
168141
169185
 
168142
169186
  // src/mcp/connection-pool.ts
168143
- import { randomUUID as randomUUID25 } from "crypto";
169187
+ import { randomUUID as randomUUID26 } from "crypto";
168144
169188
  var DEFAULT_POOL_CONFIG = {
168145
169189
  maxConnections: 50,
168146
169190
  minConnections: 5,
@@ -168376,7 +169420,7 @@ var ConnectionPoolImpl = class {
168376
169420
  // Private Methods
168377
169421
  // ============================================================================
168378
169422
  async createConnection() {
168379
- const id = `conn-${Date.now()}-${randomUUID25().split("-")[0]}`;
169423
+ const id = `conn-${Date.now()}-${randomUUID26().split("-")[0]}`;
168380
169424
  const now = Date.now();
168381
169425
  const connection = {
168382
169426
  id,
@@ -168399,7 +169443,7 @@ var ConnectionPoolImpl = class {
168399
169443
  if (this.connections.size >= this.config.maxConnections) {
168400
169444
  return null;
168401
169445
  }
168402
- const id = `conn-${Date.now()}-${randomUUID25().split("-")[0]}`;
169446
+ const id = `conn-${Date.now()}-${randomUUID26().split("-")[0]}`;
168403
169447
  const now = Date.now();
168404
169448
  const connection = {
168405
169449
  id,
@@ -170709,7 +171753,7 @@ function createTaskStore(config = {}) {
170709
171753
 
170710
171754
  // src/adapters/a2a/tasks/task-manager.ts
170711
171755
  import { EventEmitter as EventEmitter5 } from "events";
170712
- import { randomUUID as randomUUID26 } from "crypto";
171756
+ import { randomUUID as randomUUID27 } from "crypto";
170713
171757
  var VALID_TRANSITIONS = {
170714
171758
  submitted: ["working", "rejected", "canceled"],
170715
171759
  working: ["completed", "failed", "input_required", "auth_required", "canceled"],
@@ -170735,8 +171779,8 @@ var DEFAULT_TASK_MANAGER_CONFIG = {
170735
171779
  storeConfig: {},
170736
171780
  defaultAgentId: "default-agent",
170737
171781
  autoGenerateContextId: true,
170738
- idGenerator: () => `task-${Date.now()}-${randomUUID26().split("-")[0]}`,
170739
- contextIdGenerator: () => `ctx-${Date.now()}-${randomUUID26().split("-")[0]}`,
171782
+ idGenerator: () => `task-${Date.now()}-${randomUUID27().split("-")[0]}`,
171783
+ contextIdGenerator: () => `ctx-${Date.now()}-${randomUUID27().split("-")[0]}`,
170740
171784
  timestampGenerator: () => /* @__PURE__ */ new Date()
170741
171785
  };
170742
171786
  var TaskManager = class extends EventEmitter5 {
@@ -171038,7 +172082,7 @@ var TaskManager = class extends EventEmitter5 {
171038
172082
  */
171039
172083
  createArtifactFromMessage(message, name = "Message", description) {
171040
172084
  return {
171041
- id: `artifact-${Date.now()}-${randomUUID26().split("-")[0]}`,
172085
+ id: `artifact-${Date.now()}-${randomUUID27().split("-")[0]}`,
171042
172086
  name,
171043
172087
  description,
171044
172088
  parts: message.parts
@@ -171303,7 +172347,7 @@ function generateSignatureHeader(payload, secret, timestamp) {
171303
172347
  }
171304
172348
 
171305
172349
  // src/adapters/a2a/notifications/subscription-store.ts
171306
- import { randomUUID as randomUUID27 } from "crypto";
172350
+ import { randomUUID as randomUUID28 } from "crypto";
171307
172351
  var DEFAULT_SUBSCRIPTION_STORE_CONFIG = {
171308
172352
  maxSubscriptionsPerTask: 10,
171309
172353
  maxTotalSubscriptions: 1e4,
@@ -171684,7 +172728,7 @@ var SubscriptionStore = class {
171684
172728
  // Private Helpers
171685
172729
  // ============================================================================
171686
172730
  generateId() {
171687
- return `sub-${Date.now()}-${randomUUID27().split("-")[0]}`;
172731
+ return `sub-${Date.now()}-${randomUUID28().split("-")[0]}`;
171688
172732
  }
171689
172733
  addToTaskIndex(taskId, subscriptionId) {
171690
172734
  let taskSubs = this.taskIndex.get(taskId);
@@ -171742,7 +172786,7 @@ function createSubscriptionStore(config = {}) {
171742
172786
  // src/adapters/a2a/notifications/retry-queue.ts
171743
172787
  init_crypto_random();
171744
172788
  import { EventEmitter as EventEmitter6 } from "events";
171745
- import { randomUUID as randomUUID28 } from "crypto";
172789
+ import { randomUUID as randomUUID29 } from "crypto";
171746
172790
  var DEFAULT_RETRY_CONFIG2 = {
171747
172791
  maxAttempts: 5,
171748
172792
  baseDelayMs: 1e3,
@@ -171810,7 +172854,7 @@ var RetryQueue = class extends EventEmitter6 {
171810
172854
  */
171811
172855
  enqueueNew(params) {
171812
172856
  const now = /* @__PURE__ */ new Date();
171813
- const id = `retry-${Date.now()}-${randomUUID28().split("-")[0]}`;
172857
+ const id = `retry-${Date.now()}-${randomUUID29().split("-")[0]}`;
171814
172858
  const delivery = {
171815
172859
  id,
171816
172860
  subscriptionId: params.subscriptionId,