@vostride/agent-qa-dashboard 0.1.8 → 0.1.10

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.
@@ -5694,6 +5694,7 @@ var ConfigManager = class {
5694
5694
  // src/execution/appium-manager.ts
5695
5695
  var import_node_http = require("http");
5696
5696
  var import_node_child_process2 = require("child_process");
5697
+ var import_agent_qa_core7 = require("@vostride/agent-qa-core");
5697
5698
  var import_tree_kill2 = __toESM(require("tree-kill"), 1);
5698
5699
  var import_picocolors = __toESM(require("picocolors"), 1);
5699
5700
  var APPIUM_PREFIX = import_picocolors.default.magenta("[appium]");
@@ -5708,11 +5709,13 @@ var AppiumManager = class {
5708
5709
  anonymousRefCount = 0;
5709
5710
  leases = /* @__PURE__ */ new Map();
5710
5711
  logLevel;
5712
+ appiumResolver;
5711
5713
  constructor(opts) {
5712
5714
  this.port = opts?.port ?? 4723;
5713
5715
  this.startupTimeoutMs = opts?.startupTimeoutMs ?? 3e4;
5714
5716
  this.pollIntervalMs = opts?.pollIntervalMs ?? 500;
5715
5717
  this.logLevel = opts?.logLevel ?? "normal";
5718
+ this.appiumResolver = opts?.appiumResolver ?? import_agent_qa_core7.resolveAppiumExecutable;
5716
5719
  }
5717
5720
  async acquire() {
5718
5721
  await this.ensureRunning();
@@ -5807,14 +5810,15 @@ var AppiumManager = class {
5807
5810
  });
5808
5811
  }
5809
5812
  async startAndWait() {
5810
- const child = (0, import_node_child_process2.spawn)("appium", ["-p", String(this.port), "--relaxed-security", "--log-no-colors"], {
5813
+ const appium = this.appiumResolver();
5814
+ const child = (0, import_node_child_process2.spawn)(appium.command, ["-p", String(this.port), "--relaxed-security", "--log-no-colors"], {
5811
5815
  stdio: ["ignore", "pipe", "pipe"]
5812
5816
  });
5813
5817
  this.process = child;
5814
5818
  this.managed = true;
5815
5819
  child.on("error", (err) => {
5816
5820
  if (err.code === "ENOENT") {
5817
- console.error(`${APPIUM_PREFIX} Appium not found. Run \`npm install -g appium\` to install it.`);
5821
+ console.error(`${APPIUM_PREFIX} Appium not found. ${(0, import_agent_qa_core7.formatAppiumInstallGuidance)()}`);
5818
5822
  } else {
5819
5823
  console.error(`${APPIUM_PREFIX} Error: ${err.message}`);
5820
5824
  }
@@ -5910,13 +5914,13 @@ var import_node_crypto3 = require("crypto");
5910
5914
 
5911
5915
  // src/live-editor/live-session.ts
5912
5916
  var import_node_crypto2 = require("crypto");
5913
- var import_agent_qa_core8 = require("@vostride/agent-qa-core");
5917
+ var import_agent_qa_core9 = require("@vostride/agent-qa-core");
5914
5918
 
5915
5919
  // src/live-editor/mobile-bootstrap.ts
5916
5920
  var import_promises8 = require("fs/promises");
5917
5921
  var import_node_path8 = require("path");
5918
5922
  var import_yaml8 = require("yaml");
5919
- var import_agent_qa_core7 = require("@vostride/agent-qa-core");
5923
+ var import_agent_qa_core8 = require("@vostride/agent-qa-core");
5920
5924
  async function loadLocalBindings(configPath) {
5921
5925
  const filePath = (0, import_node_path8.join)((0, import_node_path8.dirname)(configPath), "agent-qa.local.yaml");
5922
5926
  try {
@@ -5934,8 +5938,8 @@ async function loadLocalBindings(configPath) {
5934
5938
  }
5935
5939
  }
5936
5940
  function asMobileSetupError(err, category, message, input) {
5937
- if (err instanceof import_agent_qa_core7.MobileSetupError) return err;
5938
- return new import_agent_qa_core7.MobileSetupError({
5941
+ if (err instanceof import_agent_qa_core8.MobileSetupError) return err;
5942
+ return new import_agent_qa_core8.MobileSetupError({
5939
5943
  category,
5940
5944
  message: `${message}: ${err instanceof Error ? err.message : String(err)}`,
5941
5945
  platform: input.platform,
@@ -5945,7 +5949,7 @@ function asMobileSetupError(err, category, message, input) {
5945
5949
  }
5946
5950
  async function prepareMobileLiveSession(input) {
5947
5951
  if (!input.targetName) {
5948
- throw new import_agent_qa_core7.MobileSetupError({
5952
+ throw new import_agent_qa_core8.MobileSetupError({
5949
5953
  category: "device-resolution",
5950
5954
  message: `No targetName provided for ${input.platform} live session`,
5951
5955
  platform: input.platform
@@ -5961,7 +5965,7 @@ async function prepareMobileLiveSession(input) {
5961
5965
  const configuredAppState = config.use?.mobile?.appState;
5962
5966
  let resolved;
5963
5967
  try {
5964
- resolved = (0, import_agent_qa_core7.resolveMobileRunConfig)({
5968
+ resolved = (0, import_agent_qa_core8.resolveMobileRunConfig)({
5965
5969
  config,
5966
5970
  targetName: input.targetName,
5967
5971
  platform: input.platform,
@@ -5977,7 +5981,7 @@ async function prepareMobileLiveSession(input) {
5977
5981
  try {
5978
5982
  await input.appiumManager.acquireLease({ runId: input.sessionId, platform: input.platform });
5979
5983
  } catch (err) {
5980
- throw new import_agent_qa_core7.MobileSetupError({
5984
+ throw new import_agent_qa_core8.MobileSetupError({
5981
5985
  category: "appium-startup",
5982
5986
  message: `Failed to acquire Appium for ${input.platform} live session: ${err instanceof Error ? err.message : String(err)}`,
5983
5987
  platform: input.platform,
@@ -6093,9 +6097,9 @@ function classifyAdapterSetupError(err) {
6093
6097
  return "device-readiness";
6094
6098
  }
6095
6099
  function wrapAdapterSetupError(err, platform, config) {
6096
- if (err instanceof import_agent_qa_core8.MobileSetupError) return err;
6100
+ if (err instanceof import_agent_qa_core9.MobileSetupError) return err;
6097
6101
  const appId = platform === "android" ? config.appPackage : config.bundleId;
6098
- return new import_agent_qa_core8.MobileSetupError({
6102
+ return new import_agent_qa_core9.MobileSetupError({
6099
6103
  category: classifyAdapterSetupError(err),
6100
6104
  message: `Failed to create ${platform} adapter session: ${err instanceof Error ? err.message : String(err)}`,
6101
6105
  platform,
@@ -6175,10 +6179,10 @@ var LiveSession = class {
6175
6179
  this.pendingMessages.push(message);
6176
6180
  }
6177
6181
  redact(value) {
6178
- return (0, import_agent_qa_core8.redactSecretValue)(value, this.secretRedactor);
6182
+ return (0, import_agent_qa_core9.redactSecretValue)(value, this.secretRedactor);
6179
6183
  }
6180
6184
  resolveSecrets(value) {
6181
- return (0, import_agent_qa_core8.resolveSecretTemplatesInValue)(value, this.secretStore);
6185
+ return (0, import_agent_qa_core9.resolveSecretTemplatesInValue)(value, this.secretStore);
6182
6186
  }
6183
6187
  emitHookStart(hookDef, phase, owner = { scope: "suite" }) {
6184
6188
  const hook = {
@@ -6265,7 +6269,7 @@ var LiveSession = class {
6265
6269
  }
6266
6270
  continue;
6267
6271
  }
6268
- const result = await (0, import_agent_qa_core8.runHooks)([hookDef], {
6272
+ const result = await (0, import_agent_qa_core9.runHooks)([hookDef], {
6269
6273
  envVars: this.getHookEnvVars(),
6270
6274
  secretStore: this.secretStore,
6271
6275
  secretRedactor: this.secretRedactor
@@ -6375,7 +6379,7 @@ var LiveSession = class {
6375
6379
  adapter = new IOSPlatformAdapter();
6376
6380
  }
6377
6381
  } catch (err) {
6378
- throw new import_agent_qa_core8.MobileSetupError({
6382
+ throw new import_agent_qa_core9.MobileSetupError({
6379
6383
  category: "adapter-load",
6380
6384
  message: `Failed to load ${platformLabel} adapter (@vostride/agent-qa-${platform}). Is the package installed? ${err instanceof Error ? err.message : String(err)}`,
6381
6385
  platform,
@@ -6397,7 +6401,7 @@ var LiveSession = class {
6397
6401
  } catch {
6398
6402
  }
6399
6403
  this.releaseMobileAppiumLease("setup-failed");
6400
- if (err instanceof import_agent_qa_core8.MobileSetupError) {
6404
+ if (err instanceof import_agent_qa_core9.MobileSetupError) {
6401
6405
  throw new Error(mobileSetupMessage(err));
6402
6406
  }
6403
6407
  throw err;
@@ -6406,7 +6410,7 @@ var LiveSession = class {
6406
6410
  async initialize(config) {
6407
6411
  this.platform = config.platform;
6408
6412
  this._modelName = config.llmConfig.model ?? "unknown";
6409
- this.variableStore = new import_agent_qa_core8.VariableStore();
6413
+ this.variableStore = new import_agent_qa_core9.VariableStore();
6410
6414
  this.secretStore = config.secretStore;
6411
6415
  this.secretRedactor = config.secretRedactor;
6412
6416
  if (config.envVars) {
@@ -6450,10 +6454,10 @@ var LiveSession = class {
6450
6454
  ...config.llmConfig,
6451
6455
  ...config.authFetch ? { fetch: config.authFetch } : {}
6452
6456
  };
6453
- this.model = await (0, import_agent_qa_core8.createModel)(modelConfig);
6454
- const providerOptions = (0, import_agent_qa_core8.getProviderOptions)(modelConfig);
6455
- this.planner = new import_agent_qa_core8.LLMPlanner(this.model, config.platform, providerOptions, void 0, config.agentRules);
6456
- this.verifier = new import_agent_qa_core8.LLMVerifier(this.model, providerOptions);
6457
+ this.model = await (0, import_agent_qa_core9.createModel)(modelConfig);
6458
+ const providerOptions = (0, import_agent_qa_core9.getProviderOptions)(modelConfig);
6459
+ this.planner = new import_agent_qa_core9.LLMPlanner(this.model, config.platform, providerOptions, void 0, config.agentRules);
6460
+ this.verifier = new import_agent_qa_core9.LLMVerifier(this.model, providerOptions);
6457
6461
  this.status = "idle";
6458
6462
  this.createdAt = Date.now();
6459
6463
  this.readyForInteraction = true;
@@ -6463,7 +6467,7 @@ var LiveSession = class {
6463
6467
  let instruction = stepInstruction;
6464
6468
  let hasTemplateVars = false;
6465
6469
  const executionLogs = [];
6466
- const inlineHookCalls = (0, import_agent_qa_core8.parseHookInline)(stepInstruction);
6470
+ const inlineHookCalls = (0, import_agent_qa_core9.parseHookInline)(stepInstruction);
6467
6471
  if (inlineHookCalls.length > 0) {
6468
6472
  let inlineHookFailed = false;
6469
6473
  for (const call of inlineHookCalls) {
@@ -6478,7 +6482,7 @@ var LiveSession = class {
6478
6482
  }
6479
6483
  const startedAt = performance.now();
6480
6484
  try {
6481
- const result = await (0, import_agent_qa_core8.runHookInSandbox)(hookDef, {
6485
+ const result = await (0, import_agent_qa_core9.runHookInSandbox)(hookDef, {
6482
6486
  envVars: this.getHookEnvVars(),
6483
6487
  secretStore: this.secretStore,
6484
6488
  secretRedactor: this.secretRedactor
@@ -6524,7 +6528,7 @@ var LiveSession = class {
6524
6528
  break;
6525
6529
  }
6526
6530
  }
6527
- instruction = (0, import_agent_qa_core8.stripHookInline)(stepInstruction);
6531
+ instruction = (0, import_agent_qa_core9.stripHookInline)(stepInstruction);
6528
6532
  hasTemplateVars = true;
6529
6533
  if (inlineHookFailed) {
6530
6534
  return {
@@ -6535,7 +6539,7 @@ var LiveSession = class {
6535
6539
  };
6536
6540
  }
6537
6541
  }
6538
- instruction = (0, import_agent_qa_core8.interpolateVariables)(instruction, this.variableStore);
6542
+ instruction = (0, import_agent_qa_core9.interpolateVariables)(instruction, this.variableStore);
6539
6543
  hasTemplateVars = hasTemplateVars || originalStepName !== instruction;
6540
6544
  const runJSMatches = parseRunJSInline(instruction);
6541
6545
  if (runJSMatches.length > 0) {
@@ -6662,7 +6666,7 @@ var LiveSession = class {
6662
6666
  this.stepsExecuted++;
6663
6667
  return result2;
6664
6668
  }
6665
- const unresolvedTemplates = (0, import_agent_qa_core8.findUnresolvedTemplates)(prepared.instruction);
6669
+ const unresolvedTemplates = (0, import_agent_qa_core9.findUnresolvedTemplates)(prepared.instruction);
6666
6670
  if (unresolvedTemplates.length > 0) {
6667
6671
  const errorLines = unresolvedTemplates.map((template) => ` - ${template.pattern}: ${template.message}`);
6668
6672
  const error = `Unresolved template variable(s):
@@ -6704,7 +6708,7 @@ ${errorLines.join("\n")}`;
6704
6708
  healingConfig: { maxAttempts: 3 },
6705
6709
  variables: this.redact(variables)
6706
6710
  };
6707
- let result = await (0, import_agent_qa_core8.executeStep)(prepared.instruction, loopConfig, stepContext);
6711
+ let result = await (0, import_agent_qa_core9.executeStep)(prepared.instruction, loopConfig, stepContext);
6708
6712
  result.originalStepName = prepared.originalStepName;
6709
6713
  result.variableSnapshot = this.variableStore.snapshot();
6710
6714
  result.executionLogs = this.redact(prepared.executionLogs);
@@ -7059,7 +7063,7 @@ var SessionManager = class {
7059
7063
  };
7060
7064
 
7061
7065
  // src/live-editor/ws-handler.ts
7062
- var import_agent_qa_core9 = require("@vostride/agent-qa-core");
7066
+ var import_agent_qa_core10 = require("@vostride/agent-qa-core");
7063
7067
  function send(ws, msg) {
7064
7068
  if (ws.readyState === ws.OPEN) {
7065
7069
  ws.send(JSON.stringify(msg));
@@ -7227,7 +7231,7 @@ function createSessionHandler(session, onTerminate, onTokenUsage, testFileManage
7227
7231
  console.error(`[ws-handler] execute-test: read failed for path=${msg.path}`, readErr);
7228
7232
  throw new Error(`Cannot read test file "${msg.path}": ${readErr?.message ?? String(readErr)}`);
7229
7233
  }
7230
- const parsed = (0, import_agent_qa_core9.parseTestFile)(raw, msg.path);
7234
+ const parsed = (0, import_agent_qa_core10.parseTestFile)(raw, msg.path);
7231
7235
  if (parsed.errors.length > 0) {
7232
7236
  console.error(`[ws-handler] execute-test: parse errors for ${msg.path}`, parsed.errors);
7233
7237
  throw new Error(`Parse error in ${msg.path}: ${parsed.errors[0].message}`);
@@ -7407,7 +7411,7 @@ function createSessionHandler(session, onTerminate, onTokenUsage, testFileManage
7407
7411
  }
7408
7412
 
7409
7413
  // src/server/server.ts
7410
- var import_agent_qa_core10 = require("@vostride/agent-qa-core");
7414
+ var import_agent_qa_core11 = require("@vostride/agent-qa-core");
7411
7415
  var import_agent_qa_mcp = require("@vostride/agent-qa-mcp");
7412
7416
  var MIME_TYPES = {
7413
7417
  ".html": "text/html; charset=utf-8",
@@ -7826,8 +7830,8 @@ async function startServer(opts) {
7826
7830
  const captureMcpLifecycle = async (properties) => {
7827
7831
  if (isAnalyticsPrivacyEnabled(config)) return;
7828
7832
  try {
7829
- const standardProperties = await (0, import_agent_qa_core10.resolveAnalyticsStandardProperties)({ surface: "dashboard-server" });
7830
- await (0, import_agent_qa_core10.captureAnalytics)((0, import_agent_qa_core10.buildAnalyticsEvent)({
7833
+ const standardProperties = await (0, import_agent_qa_core11.resolveAnalyticsStandardProperties)({ surface: "dashboard-server" });
7834
+ await (0, import_agent_qa_core11.captureAnalytics)((0, import_agent_qa_core11.buildAnalyticsEvent)({
7831
7835
  name: "agent-qa.mcp.server.lifecycle",
7832
7836
  properties: {
7833
7837
  ...standardProperties,