@qawolf/cli 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +129 -47
- package/dist/investigation-parser.js +34 -14
- package/dist/runner-sdk.js +75 -8
- package/package.json +1 -1
- package/skills/qawolf-cli/SKILL.md +6 -0
- package/skills/qawolf-cli/references/runner.md +298 -48
|
@@ -9507,7 +9507,21 @@ function inspectExecutionLogs(request) {
|
|
|
9507
9507
|
}
|
|
9508
9508
|
function summarizeExecutionLogs(input) {
|
|
9509
9509
|
const parsed = parseExecutionLogs(input);
|
|
9510
|
-
const
|
|
9510
|
+
const errors = parsed.items.filter((record) => record.severity === "error").slice(-5);
|
|
9511
|
+
const traceCollection = parsed.items.findLast((record) => record.source === "qawolfTraceCollection");
|
|
9512
|
+
const selectedIds = new Set([
|
|
9513
|
+
...errors.map((record) => record.evidenceId),
|
|
9514
|
+
...traceCollection ? [traceCollection.evidenceId] : []
|
|
9515
|
+
]);
|
|
9516
|
+
const selected = parsed.items.filter((record) => selectedIds.has(record.evidenceId));
|
|
9517
|
+
const summaries = selected.map((record) => {
|
|
9518
|
+
const message = redactAndBoundAttemptEvidenceResult(record.message, 1024);
|
|
9519
|
+
return {
|
|
9520
|
+
...record,
|
|
9521
|
+
message: message.text,
|
|
9522
|
+
...message.truncated && { evidenceTruncated: true }
|
|
9523
|
+
};
|
|
9524
|
+
});
|
|
9511
9525
|
return {
|
|
9512
9526
|
artifactState: parsed.status,
|
|
9513
9527
|
evidence: {
|
|
@@ -9515,9 +9529,9 @@ function summarizeExecutionLogs(input) {
|
|
|
9515
9529
|
...parsed.coverage,
|
|
9516
9530
|
returned: selected.length,
|
|
9517
9531
|
total: parsed.items.length,
|
|
9518
|
-
truncated: parsed.coverage.truncated || selected.length < parsed.items.length
|
|
9532
|
+
truncated: parsed.coverage.truncated || selected.length < parsed.items.length || summaries.some((record) => record.evidenceTruncated)
|
|
9519
9533
|
},
|
|
9520
|
-
items:
|
|
9534
|
+
items: summaries
|
|
9521
9535
|
}
|
|
9522
9536
|
};
|
|
9523
9537
|
}
|
|
@@ -11170,6 +11184,7 @@ function summarizeAttemptWaitingLogs(logs, actionId) {
|
|
|
11170
11184
|
|
|
11171
11185
|
// src/domains/investigation/parser/projection/summarizeAttemptTrace.ts
|
|
11172
11186
|
var evidenceLimit3 = 10;
|
|
11187
|
+
var consoleLimit = 5;
|
|
11173
11188
|
var maxActionEvidenceBytes2 = 512;
|
|
11174
11189
|
var maxSnapshotReconstructionBytes2 = 256 * 1024;
|
|
11175
11190
|
function normalizedFailure(value) {
|
|
@@ -11185,7 +11200,7 @@ async function summarizeAttemptTrace(trace, attemptError) {
|
|
|
11185
11200
|
const traceError = failure?.errorMessage ? normalizedFailure(failure.errorMessage) : undefined;
|
|
11186
11201
|
const metadataError = attemptError ? normalizedFailure(attemptError) : undefined;
|
|
11187
11202
|
const errorMatches = Boolean(traceError && metadataError && (metadataError.includes(traceError) || traceError.includes(metadataError)));
|
|
11188
|
-
const toAction = (action) => {
|
|
11203
|
+
const toAction = (action, includeDetails) => {
|
|
11189
11204
|
const stack = action.errorMessage === undefined ? [] : readTraceActionStack(trace, action).map((frame) => `${frame.file}:${frame.compiledLine}`);
|
|
11190
11205
|
const error = action.errorMessage === undefined ? undefined : redactAndBoundAttemptEvidenceResult(action.errorMessage, maxActionEvidenceBytes2);
|
|
11191
11206
|
const selector = action.selector === undefined ? undefined : redactAndBoundAttemptEvidenceResult(action.selector, maxActionEvidenceBytes2);
|
|
@@ -11203,9 +11218,11 @@ async function summarizeAttemptTrace(trace, attemptError) {
|
|
|
11203
11218
|
...action.startTime !== undefined && {
|
|
11204
11219
|
startedAtMilliseconds: action.startTime
|
|
11205
11220
|
},
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11221
|
+
...includeDetails && {
|
|
11222
|
+
stack: stack.slice(0, 20),
|
|
11223
|
+
stackTruncated: stack.length > 20,
|
|
11224
|
+
...summarizeAttemptWaitingLogs(logs, action.id)
|
|
11225
|
+
}
|
|
11209
11226
|
};
|
|
11210
11227
|
};
|
|
11211
11228
|
const completed = chronologicallySortActions(actions.items.filter((action) => action.endTime !== undefined));
|
|
@@ -11215,10 +11232,10 @@ async function summarizeAttemptTrace(trace, attemptError) {
|
|
|
11215
11232
|
limit: Number.MAX_SAFE_INTEGER,
|
|
11216
11233
|
maxTextBytes: Number.MAX_SAFE_INTEGER
|
|
11217
11234
|
});
|
|
11218
|
-
const consoleItems = allConsoleEntries.items.slice(-
|
|
11235
|
+
const consoleItems = allConsoleEntries.items.slice(-consoleLimit);
|
|
11219
11236
|
const consoleSummaries = consoleItems.map((entry) => ({
|
|
11220
11237
|
entry,
|
|
11221
|
-
message: redactAndBoundAttemptEvidenceResult(entry.message,
|
|
11238
|
+
message: redactAndBoundAttemptEvidenceResult(entry.message, 256)
|
|
11222
11239
|
}));
|
|
11223
11240
|
const network = await listTraceNetwork(trace, {
|
|
11224
11241
|
limit: Number.MAX_SAFE_INTEGER
|
|
@@ -11239,7 +11256,7 @@ async function summarizeAttemptTrace(trace, attemptError) {
|
|
|
11239
11256
|
maxBytes: maxSnapshotReconstructionBytes2
|
|
11240
11257
|
}) : undefined;
|
|
11241
11258
|
const screenshot = pageSnapshot ? nearestScreenshotForSnapshot(trace, pageSnapshot.id) : undefined;
|
|
11242
|
-
const projectedPage = page?.truncated ? { text: "", truncated: true } : page ?
|
|
11259
|
+
const projectedPage = page?.truncated ? { text: "", truncated: true } : page ? redactAndBoundAttemptEvidenceResult(projectToText(resolveSnapshot([page.html], 0), Number.MAX_SAFE_INTEGER), 2 * 1024) : undefined;
|
|
11243
11260
|
return {
|
|
11244
11261
|
actions: {
|
|
11245
11262
|
coverage: {
|
|
@@ -11247,7 +11264,7 @@ async function summarizeAttemptTrace(trace, attemptError) {
|
|
|
11247
11264
|
returned: selectedActions.length,
|
|
11248
11265
|
truncated: actions.coverage.total > selectedActions.length
|
|
11249
11266
|
},
|
|
11250
|
-
items: selectedActions.map(toAction)
|
|
11267
|
+
items: selectedActions.map((action) => toAction(action, false))
|
|
11251
11268
|
},
|
|
11252
11269
|
browserConsole: {
|
|
11253
11270
|
coverage: {
|
|
@@ -11258,14 +11275,17 @@ async function summarizeAttemptTrace(trace, attemptError) {
|
|
|
11258
11275
|
items: consoleSummaries.map(({ entry, message }) => ({
|
|
11259
11276
|
evidenceId: entry.id,
|
|
11260
11277
|
message: message.text,
|
|
11278
|
+
...message.truncated && { evidenceTruncated: true },
|
|
11261
11279
|
type: entry.type
|
|
11262
11280
|
}))
|
|
11263
11281
|
},
|
|
11264
11282
|
...errorMatches && failure && {
|
|
11265
|
-
failedBrowserAction: toAction(failure.action)
|
|
11283
|
+
failedBrowserAction: toAction(failure.action, true)
|
|
11266
11284
|
},
|
|
11267
11285
|
failedBrowserActionAttribution: errorMatches ? "trace-error-matches-attempt" : "none",
|
|
11268
|
-
...!errorMatches && lastCompleted && {
|
|
11286
|
+
...!errorMatches && lastCompleted && {
|
|
11287
|
+
lastCompletedBrowserAction: toAction(lastCompleted, true)
|
|
11288
|
+
},
|
|
11269
11289
|
networkErrors,
|
|
11270
11290
|
...page && projectedPage && pageSnapshot && {
|
|
11271
11291
|
pageState: {
|
|
@@ -11420,4 +11440,4 @@ export {
|
|
|
11420
11440
|
investigate
|
|
11421
11441
|
};
|
|
11422
11442
|
|
|
11423
|
-
//# debugId=
|
|
11443
|
+
//# debugId=DDB8DC8EF65337B664756E2164756E21
|
package/dist/runner-sdk.js
CHANGED
|
@@ -11459,7 +11459,8 @@ var authErrorMessages = {
|
|
|
11459
11459
|
notFound404Record: (noun, id) => `QA Wolf has no ${noun} ${id} (HTTP 404).`,
|
|
11460
11460
|
notFound404: (noun) => noun === undefined ? "QA Wolf found nothing matching the request (HTTP 404)." : `QA Wolf found nothing matching the ${noun} request (HTTP 404).`,
|
|
11461
11461
|
failedWithStatus: (status, noun) => `QA Wolf API${noun ? ` ${noun}` : ""} request failed (HTTP ${status}).`,
|
|
11462
|
-
|
|
11462
|
+
notSent: "Nothing was sent, so this request did not take effect.",
|
|
11463
|
+
networkUnreachable: (options) => `Could not reach the QA Wolf API at ${options.baseUrl}${options.noun ? ` to fetch ${options.noun}` : ""}${options.cause ? ` (${options.cause})` : ""}. Check your network connection and QAWOLF_HOST_URL.`,
|
|
11463
11464
|
timedOut: (timeoutMs, noun) => `The QA Wolf API${noun ? ` ${noun}` : ""} request timed out after ${formatSeconds(timeoutMs)}. The work may still be finishing on the platform.`,
|
|
11464
11465
|
unexpectedResponse: (noun) => `Unexpected${noun ? ` ${noun}` : ""} response from the QA Wolf API.`
|
|
11465
11466
|
},
|
|
@@ -11901,6 +11902,7 @@ var runMessages = {
|
|
|
11901
11902
|
unknownStream: (stream, known) => `"${stream}" is not a stream QA Wolf writes, so this read has nothing to return. QA Wolf writes ${known.join(", ")}.`,
|
|
11902
11903
|
unsearchedHistory: (stream) => `This read of ${stream} stopped before searching all of the runner's history, so older entries may exist that it did not look at. Page forwards with --since to reach them.`,
|
|
11903
11904
|
submitMayHaveStarted: "The runner did not answer, which does not mean the run did not start. Read qawolf runner events run-status before running the flow again, and use the newest run id there if one appeared.",
|
|
11905
|
+
submitLostMayHaveStarted: "The run may have started before the connection failed. Read qawolf runner events run-status before running the flow again, and use the newest run id there if one appeared.",
|
|
11904
11906
|
targetMismatch: (runnerName, requiredRunnerName) => `This flow needs a ${requiredRunnerName} runner and ${runnerName} is running. Launch one with --name ${requiredRunnerName}.`
|
|
11905
11907
|
};
|
|
11906
11908
|
|
|
@@ -12001,9 +12003,9 @@ async function requestWithRetry(args) {
|
|
|
12001
12003
|
const unreachable = result.error.kind === "network" || result.error.kind === "timeout";
|
|
12002
12004
|
return {
|
|
12003
12005
|
ok: false,
|
|
12004
|
-
...args.describe(result.error),
|
|
12005
12006
|
...mayHaveArrived ? { mayHaveArrived } : {},
|
|
12006
|
-
...unreachable ? { unreachable } : {}
|
|
12007
|
+
...unreachable ? { unreachable } : {},
|
|
12008
|
+
...args.describe(result.error)
|
|
12007
12009
|
};
|
|
12008
12010
|
}
|
|
12009
12011
|
await sleep2(backoff);
|
|
@@ -13652,6 +13654,37 @@ function applyWorkspaceId(inputSchema, input, workspaceId) {
|
|
|
13652
13654
|
return { ...input, workspaceId };
|
|
13653
13655
|
}
|
|
13654
13656
|
|
|
13657
|
+
// src/core/fetchCause.ts
|
|
13658
|
+
var maxCauseDepth = 5;
|
|
13659
|
+
var maxCauseMessageLength = 120;
|
|
13660
|
+
var codePattern = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
13661
|
+
var urlPattern = /\bhttps?:\/\/\S+/g;
|
|
13662
|
+
function causeChain(options) {
|
|
13663
|
+
const { error, remainingDepth } = options;
|
|
13664
|
+
const { cause } = error;
|
|
13665
|
+
if (!(cause instanceof Error) || remainingDepth === 0)
|
|
13666
|
+
return [error];
|
|
13667
|
+
return [
|
|
13668
|
+
error,
|
|
13669
|
+
...causeChain({ error: cause, remainingDepth: remainingDepth - 1 })
|
|
13670
|
+
];
|
|
13671
|
+
}
|
|
13672
|
+
function shortMessage(message) {
|
|
13673
|
+
const withoutUrls = message.replace(urlPattern, "<url>").trim();
|
|
13674
|
+
return withoutUrls.length > maxCauseMessageLength ? `${withoutUrls.slice(0, maxCauseMessageLength)}…` : withoutUrls;
|
|
13675
|
+
}
|
|
13676
|
+
function describeFetchCause(error) {
|
|
13677
|
+
const chain = causeChain({ error, remainingDepth: maxCauseDepth });
|
|
13678
|
+
const root = chain.at(-1);
|
|
13679
|
+
const code = chain.map((link) => errorCode(link)).reverse().find((candidate) => candidate !== undefined && codePattern.test(candidate));
|
|
13680
|
+
const message = root === undefined ? "" : shortMessage(root.message);
|
|
13681
|
+
if (code === undefined)
|
|
13682
|
+
return message || undefined;
|
|
13683
|
+
if (!message || message.includes(code))
|
|
13684
|
+
return message || code;
|
|
13685
|
+
return `${code}: ${message}`;
|
|
13686
|
+
}
|
|
13687
|
+
|
|
13655
13688
|
// src/shell/platform/describeNotFound.ts
|
|
13656
13689
|
var m = authMessages.errors.request;
|
|
13657
13690
|
var saysNothingMore = (reason) => /^(\w+ )*not ?found\.?$/i.test(reason.trim());
|
|
@@ -13775,7 +13808,13 @@ function describeRequestError(err, baseUrl, noun, notFound) {
|
|
|
13775
13808
|
return { error: m2.request.failedWithStatus(err.status, noun), ...body };
|
|
13776
13809
|
}
|
|
13777
13810
|
if (err.kind === "network") {
|
|
13778
|
-
return {
|
|
13811
|
+
return {
|
|
13812
|
+
error: m2.request.networkUnreachable({
|
|
13813
|
+
baseUrl,
|
|
13814
|
+
cause: describeFetchCause(err.cause),
|
|
13815
|
+
noun
|
|
13816
|
+
})
|
|
13817
|
+
};
|
|
13779
13818
|
}
|
|
13780
13819
|
if (err.kind === "timeout") {
|
|
13781
13820
|
return { error: m2.request.timedOut(err.timeoutMs, noun) };
|
|
@@ -13818,6 +13857,13 @@ function callPublicApi(trpc, contract, input, options) {
|
|
|
13818
13857
|
}
|
|
13819
13858
|
return trpc.mutation(path, input, contract.output, options);
|
|
13820
13859
|
}
|
|
13860
|
+
var notSentCodes = new Set([
|
|
13861
|
+
"ConnectionRefused",
|
|
13862
|
+
"EAI_AGAIN",
|
|
13863
|
+
"ECONNREFUSED",
|
|
13864
|
+
"ENOTFOUND",
|
|
13865
|
+
"UND_ERR_CONNECT_TIMEOUT"
|
|
13866
|
+
]);
|
|
13821
13867
|
function makeCallPublicApiMethod(trpc, deps, readBackoffMs) {
|
|
13822
13868
|
return async (contract, input, options) => {
|
|
13823
13869
|
const sent = applyWorkspaceId(contract.input, input, deps.workspaceId);
|
|
@@ -13825,7 +13871,17 @@ function makeCallPublicApiMethod(trpc, deps, readBackoffMs) {
|
|
|
13825
13871
|
return requestWithRetry({
|
|
13826
13872
|
call: () => callPublicApi(trpc, contract, sent, options),
|
|
13827
13873
|
backoffMs: contract.kind === "read" ? readBackoffMs : [],
|
|
13828
|
-
describe: (err) =>
|
|
13874
|
+
describe: (err) => {
|
|
13875
|
+
const failure = describeRequestError(err, deps.baseUrl, contract.name, subject);
|
|
13876
|
+
const code = err.kind === "network" ? errorCode(err.cause.cause) ?? errorCode(err.cause) : undefined;
|
|
13877
|
+
if (contract.kind !== "write" || !code || !notSentCodes.has(code))
|
|
13878
|
+
return failure;
|
|
13879
|
+
return {
|
|
13880
|
+
...failure,
|
|
13881
|
+
error: `${failure.error} ${authMessages.errors.request.notSent}`,
|
|
13882
|
+
mayHaveArrived: false
|
|
13883
|
+
};
|
|
13884
|
+
},
|
|
13829
13885
|
sleep: deps.sleep
|
|
13830
13886
|
});
|
|
13831
13887
|
};
|
|
@@ -14708,7 +14764,8 @@ function createTrpcClient(apiKey, deps) {
|
|
|
14708
14764
|
return withLogging(path, () => sendWireRequest(deps.fetch, url, {
|
|
14709
14765
|
body,
|
|
14710
14766
|
headers: { ...authHeader, "content-type": "application/json" },
|
|
14711
|
-
method: "POST"
|
|
14767
|
+
method: "POST",
|
|
14768
|
+
redirect: "error"
|
|
14712
14769
|
}, schema, options?.timeoutMs ?? defaultTimeoutMs));
|
|
14713
14770
|
}
|
|
14714
14771
|
};
|
|
@@ -15830,6 +15887,12 @@ function buildRunFileDelta(options) {
|
|
|
15830
15887
|
return Object.keys(unchangedFiles).length === 0 ? { files: options.files, unchangedFiles: undefined } : { files, unchangedFiles };
|
|
15831
15888
|
}
|
|
15832
15889
|
|
|
15890
|
+
// src/core/sentences.ts
|
|
15891
|
+
function appendSentence(text, sentence) {
|
|
15892
|
+
const punctuated = /[.!?]$/.test(text.trimEnd()) ? text.trimEnd() : `${text.trimEnd()}.`;
|
|
15893
|
+
return `${punctuated} ${sentence}`;
|
|
15894
|
+
}
|
|
15895
|
+
|
|
15833
15896
|
// src/domains/interactiveRunner/runSubmitFailure.ts
|
|
15834
15897
|
function describeRunSubmitFailure(failure) {
|
|
15835
15898
|
const { failureReason } = failure;
|
|
@@ -15870,8 +15933,12 @@ async function sendRunFlowRequest(ctx, options, delta) {
|
|
|
15870
15933
|
...delta.unchangedFiles === undefined ? {} : { unchangedFiles: delta.unchangedFiles }
|
|
15871
15934
|
}, runnerCallOptions);
|
|
15872
15935
|
if (!result.ok) {
|
|
15936
|
+
const failure = runnerRequestFailure(result, options.resolved);
|
|
15873
15937
|
return {
|
|
15874
|
-
failure:
|
|
15938
|
+
failure: result.mayHaveArrived ? {
|
|
15939
|
+
...failure,
|
|
15940
|
+
error: appendSentence(failure.error, interactiveRunnerMessages.submitLostMayHaveStarted)
|
|
15941
|
+
} : failure,
|
|
15875
15942
|
type: "failed"
|
|
15876
15943
|
};
|
|
15877
15944
|
}
|
|
@@ -16075,4 +16142,4 @@ export {
|
|
|
16075
16142
|
createRunnerSdk
|
|
16076
16143
|
};
|
|
16077
16144
|
|
|
16078
|
-
//# debugId=
|
|
16145
|
+
//# debugId=6228F1BDD956959964756E2164756E21
|
package/package.json
CHANGED
|
@@ -62,6 +62,12 @@ rather than leaving it to time out.
|
|
|
62
62
|
commands that follow need no `--runner`. Override that default for one command
|
|
63
63
|
with `--runner <id>`, or for a whole session with `QAWOLF_RUNNER_ID`.
|
|
64
64
|
|
|
65
|
+
Runner commands work in the workspace `qawolf auth switch` saved, which is
|
|
66
|
+
shared by every session on the machine. When more than one session may be
|
|
67
|
+
working in different workspaces, pass `--workspace-id <id>` to every runner
|
|
68
|
+
command instead of switching; it applies to that command only and is never
|
|
69
|
+
saved.
|
|
70
|
+
|
|
65
71
|
## Output
|
|
66
72
|
|
|
67
73
|
When consuming output programmatically, always pass `--json` (or `--agent`).
|