@molecule/api-ai-tools 1.9.16 → 1.9.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +270 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/output-filter.d.ts +5 -1
- package/dist/output-filter.d.ts.map +1 -1
- package/dist/output-filter.js +12 -3
- package/dist/server-command.d.ts +73 -0
- package/dist/server-command.d.ts.map +1 -0
- package/dist/server-command.js +180 -0
- package/dist/suite-overlap.d.ts +20 -1
- package/dist/suite-overlap.d.ts.map +1 -1
- package/dist/suite-overlap.js +48 -3
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +88 -7
- package/dist/trace-artifacts.d.ts +57 -5
- package/dist/trace-artifacts.d.ts.map +1 -1
- package/dist/trace-artifacts.js +336 -26
- package/dist/types.d.ts +39 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utilities.d.ts +52 -1
- package/dist/utilities.d.ts.map +1 -1
- package/dist/utilities.js +143 -23
- package/package.json +1 -1
package/dist/utilities.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
7
|
import { type RunFailureKind } from './failure-kind.js';
|
|
8
|
+
import { type DiagnosisRunContext } from './suite-overlap.js';
|
|
8
9
|
/**
|
|
9
10
|
* Shell-safe quoting using single quotes. Unlike JSON.stringify (double quotes),
|
|
10
11
|
* single-quoted strings prevent command substitution ($(), backticks) and variable expansion.
|
|
@@ -184,10 +185,14 @@ export declare const PLAYWRIGHT_FAILURES_INLINE_ENV = "PLAYWRIGHT_LIST_PRINT_FAI
|
|
|
184
185
|
* this function rewrites a run), and nothing is launched.
|
|
185
186
|
*
|
|
186
187
|
* @param command - The command as the executor sent it.
|
|
188
|
+
* @param context - What the caller knows beyond the command: the tests the person's request
|
|
189
|
+
* excludes by name ({@link DiagnosisRunContext}). A `--grep-invert` of exactly those is the
|
|
190
|
+
* request's own scope, not a diagnosis, so it keeps the suite's retries on a deployed proof
|
|
191
|
+
* (xr-molecule-flash-m170 +33:16).
|
|
187
192
|
* @returns The command to run and one sentence per change made (empty when none), or `error` when
|
|
188
193
|
* the command starts the suite more than once.
|
|
189
194
|
*/
|
|
190
|
-
export declare function streamingBackgroundCommand(command: string): {
|
|
195
|
+
export declare function streamingBackgroundCommand(command: string, context?: DiagnosisRunContext): {
|
|
191
196
|
command: string;
|
|
192
197
|
changes: string[];
|
|
193
198
|
error?: string;
|
|
@@ -216,6 +221,52 @@ export declare function suiteRunStatements(command: string): string[];
|
|
|
216
221
|
* @returns True when the command starts one of those runners.
|
|
217
222
|
*/
|
|
218
223
|
export declare function isSuiteRunCommand(command: string): boolean;
|
|
224
|
+
/**
|
|
225
|
+
* The refusal for a command that starts the suite MORE THAN ONCE — the ONE reading every launch
|
|
226
|
+
* site asks, foreground and background alike.
|
|
227
|
+
*
|
|
228
|
+
* Each statement is a whole walk of the same suite against the same app, and only the last of them
|
|
229
|
+
* is rewritten, so the earlier ones measure nothing the first did. X1 xr-molecule-flash-m157
|
|
230
|
+
* (+14:02) chained two whole walks of one 138-test suite with `;` (4.5 minutes each) and the
|
|
231
|
+
* background launcher refused it; X1 xr-molecule-flash-m170 (+06:02) chained two invocations of the
|
|
232
|
+
* suite's own runner script in the foreground, where nothing counted them, and the note reported
|
|
233
|
+
* the passing second walk as the first walk's 13 failures.
|
|
234
|
+
*
|
|
235
|
+
* The one run handed back is the LAST suite statement, rewritten exactly as
|
|
236
|
+
* {@link streamingBackgroundCommand} rewrites a run (a filter or `| tail` after the runner is
|
|
237
|
+
* dropped, and a Playwright run gets the reporter that prints failures). Its own count is one —
|
|
238
|
+
* guarded, so this cannot recurse.
|
|
239
|
+
*
|
|
240
|
+
* @param command - The shell command as the executor sent it.
|
|
241
|
+
* @returns The refusal sentence, or null when the command starts the suite zero or one time.
|
|
242
|
+
*/
|
|
243
|
+
export declare function repeatedSuiteRunError(command: string): string | null;
|
|
244
|
+
/**
|
|
245
|
+
* A command with the supplied suite's own settings written back onto its runner as Playwright
|
|
246
|
+
* flags, and the flags that could not be placed.
|
|
247
|
+
*
|
|
248
|
+
* The grader walks the suite under its OWN budget, so a run whose runner config sets a different
|
|
249
|
+
* timeout or worker count measures a run the grader never sees (xr-molecule-flash-m169: a 60 s
|
|
250
|
+
* wrapper config produced a green local proof the official 15 s grader then failed). Playwright
|
|
251
|
+
* lets a command-line flag win over every config file, so the suite's values are put on the
|
|
252
|
+
* runner's own arguments — written where {@link statementArgumentEnd} places them, never after a
|
|
253
|
+
* pipe, redirect or group closer. Only the command's LAST suite step is touched: that is the run
|
|
254
|
+
* every launch site measures.
|
|
255
|
+
*
|
|
256
|
+
* A flag the command already carries is REWRITTEN in place (last occurrence wins, as it does for
|
|
257
|
+
* Playwright); a flag it does not carry is inserted at the end of the runner's arguments. A
|
|
258
|
+
* command whose runner cannot be placed is returned exactly as written, with every flag reported
|
|
259
|
+
* as unplaced, so the caller states the fact instead of claiming a pin it did not make.
|
|
260
|
+
*
|
|
261
|
+
* @param command - The shell command about to run.
|
|
262
|
+
* @param flags - The flags to put on it, each as `--name=value`.
|
|
263
|
+
* @returns The command to run, the flags placed on it, and the ones it could not carry.
|
|
264
|
+
*/
|
|
265
|
+
export declare function suiteRunBudgetCommand(command: string, flags: readonly string[]): {
|
|
266
|
+
command: string;
|
|
267
|
+
placed: string[];
|
|
268
|
+
unplaced: string[];
|
|
269
|
+
};
|
|
219
270
|
/**
|
|
220
271
|
* The command with the `timeout <N>` wrapper lifted off the statement that runs the suite, and the
|
|
221
272
|
* bound that was lifted.
|
package/dist/utilities.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version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GED
|
@@ -398,10 +398,14 @@ export const PLAYWRIGHT_FAILURES_INLINE_ENV = 'PLAYWRIGHT_LIST_PRINT_FAILURES_IN
|
|
|
398
398
|
* this function rewrites a run), and nothing is launched.
|
|
399
399
|
*
|
|
400
400
|
* @param command - The command as the executor sent it.
|
|
401
|
+
* @param context - What the caller knows beyond the command: the tests the person's request
|
|
402
|
+
* excludes by name ({@link DiagnosisRunContext}). A `--grep-invert` of exactly those is the
|
|
403
|
+
* request's own scope, not a diagnosis, so it keeps the suite's retries on a deployed proof
|
|
404
|
+
* (xr-molecule-flash-m170 +33:16).
|
|
401
405
|
* @returns The command to run and one sentence per change made (empty when none), or `error` when
|
|
402
406
|
* the command starts the suite more than once.
|
|
403
407
|
*/
|
|
404
|
-
export function streamingBackgroundCommand(command) {
|
|
408
|
+
export function streamingBackgroundCommand(command, context) {
|
|
405
409
|
// A command that runs no test is not a run to keep a growing log for: nothing about it is
|
|
406
410
|
// rewritten (flash-m79's `--list` was read as a whole-suite run end to end, and got a ~4 KB
|
|
407
411
|
// refusal to send itself again with `--max-failures=15`).
|
|
@@ -456,26 +460,11 @@ export function streamingBackgroundCommand(command) {
|
|
|
456
460
|
// of the same suite against the same app, only the last of them is rewritten, and the earlier
|
|
457
461
|
// ones measure nothing the first did. X1 xr-molecule-flash-m157 (+14:02) chained two whole walks
|
|
458
462
|
// of one 138-test suite with `;` (4.5 minutes each); the platform already refuses a second
|
|
459
|
-
// CONCURRENT run against one app, and this is the same hazard inside one command.
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
const lastSuitePart = [...parts]
|
|
465
|
-
.reverse()
|
|
466
|
-
.map((p) => p.trim())
|
|
467
|
-
.find((p) => isSuiteRunCommand(p));
|
|
468
|
-
const single = lastSuitePart && suiteRunStatements(lastSuitePart).length === 1
|
|
469
|
-
? streamingBackgroundCommand(lastSuitePart).command
|
|
470
|
-
: (lastSuitePart ?? '');
|
|
471
|
-
return {
|
|
472
|
-
command: out,
|
|
473
|
-
changes: [],
|
|
474
|
-
error: `This command runs the suite ${suiteSteps.length === 2 ? 'twice' : `${suiteSteps.length} times`} ` +
|
|
475
|
-
`(${suiteSteps.map((s, i) => `step ${i + 1}: \`${s}\``).join(', ')}). One walk is the ` +
|
|
476
|
-
`measurement; run exactly one: \`${single}\``,
|
|
477
|
-
};
|
|
478
|
-
}
|
|
463
|
+
// CONCURRENT run against one app, and this is the same hazard inside one command. The reading is
|
|
464
|
+
// {@link repeatedSuiteRunError}'s, so a foreground `exec_command` refuses the same commands.
|
|
465
|
+
const repeated = repeatedSuiteRunError(out);
|
|
466
|
+
if (repeated)
|
|
467
|
+
return { command: out, changes: [], error: repeated };
|
|
479
468
|
// The last step runs Playwright — whether or not anything is piped from it. Keying this on
|
|
480
469
|
// "nothing is piped out of the last step" withheld the reporter, the inline-failure switch and
|
|
481
470
|
// `--retries=0` from exactly the runs whose output was filtered (xr-molecule-flash-m101
|
|
@@ -522,7 +511,7 @@ export function streamingBackgroundCommand(command) {
|
|
|
522
511
|
// {@link isDiagnosisRun}'s answer and nobody else's: the platform's notes ask the same
|
|
523
512
|
// function, so a run cannot be a diagnosis to one of them and the whole suite to the other.
|
|
524
513
|
// Which targets are local is {@link suiteCommandTarget}'s answer.
|
|
525
|
-
const diagnosis = isDiagnosisRun(lastStep);
|
|
514
|
+
const diagnosis = isDiagnosisRun(lastStep, context);
|
|
526
515
|
const localTarget = suiteCommandTarget(lastStep) === 'local';
|
|
527
516
|
// The last step's reporters: one printer, and it is `list`. Every branch below only ever moves
|
|
528
517
|
// the command TO that shape — a reporter set is never left with two printers in it.
|
|
@@ -590,8 +579,14 @@ export function streamingBackgroundCommand(command) {
|
|
|
590
579
|
'and you need not wait for it to end to start on them.');
|
|
591
580
|
}
|
|
592
581
|
if (finalPlaywrightRun && (diagnosis || localTarget) && !/--retries\b/.test(lastStep)) {
|
|
582
|
+
// The reason named is the one that fired: a narrowed diagnosis against a DEPLOYED URL is not a
|
|
583
|
+
// local run, and calling it one (xr-molecule-flash-m170's note did) reads as the platform having
|
|
584
|
+
// misread the target.
|
|
585
|
+
const why = diagnosis
|
|
586
|
+
? 'a diagnosis or re-run walks each failure once; the suite’s retries apply on the deployed proof run'
|
|
587
|
+
: 'a local run walks each failure once; the suite’s retries apply on the deployed proof run';
|
|
593
588
|
if (addToRun('--retries=0'))
|
|
594
|
-
changes.push(
|
|
589
|
+
changes.push(`Added \`--retries=0\`: ${why}.`);
|
|
595
590
|
}
|
|
596
591
|
return { command: out, changes };
|
|
597
592
|
}
|
|
@@ -613,6 +608,15 @@ const SUITE_RUN_COMMANDS = [
|
|
|
613
608
|
/^vitest\b/,
|
|
614
609
|
// `hurl --test …` or `hurl … x.hurl`.
|
|
615
610
|
/^hurl\s+[^|\n]*(?:--test|\.hurl)/,
|
|
611
|
+
// The suite's own runner SCRIPT, whoever wrote it: the supplied trees ship
|
|
612
|
+
// `run-api-tests-hurl.sh` and `run-hurl-tests.sh`, and the command-position parser puts the
|
|
613
|
+
// script's own NAME where the program goes (`bash fixtures/…/run-api-tests-hurl.sh` →
|
|
614
|
+
// `run-api-tests-hurl.sh`). xr-molecule-flash-m170 (+06:02) chained two invocations of one such
|
|
615
|
+
// script in the FOREGROUND, which no launch site counted: the first walk's tally was the only
|
|
616
|
+
// evidence the note had, and it reported a passing run as 13 failures. A script named for the
|
|
617
|
+
// suite is a whole walk of it; `head -30 run-api-tests-hurl.sh` is not in command position and
|
|
618
|
+
// stays a read ({@link commandSegments}).
|
|
619
|
+
/^run-(?:api-)?(?:hurl-)?tests?[\w-]*\.sh\b/,
|
|
616
620
|
];
|
|
617
621
|
/**
|
|
618
622
|
* Every statement of a command that starts a whole test suite, in command order.
|
|
@@ -649,6 +653,122 @@ export function suiteRunStatements(command) {
|
|
|
649
653
|
export function isSuiteRunCommand(command) {
|
|
650
654
|
return suiteRunStatements(command).length > 0;
|
|
651
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* The refusal for a command that starts the suite MORE THAN ONCE — the ONE reading every launch
|
|
658
|
+
* site asks, foreground and background alike.
|
|
659
|
+
*
|
|
660
|
+
* Each statement is a whole walk of the same suite against the same app, and only the last of them
|
|
661
|
+
* is rewritten, so the earlier ones measure nothing the first did. X1 xr-molecule-flash-m157
|
|
662
|
+
* (+14:02) chained two whole walks of one 138-test suite with `;` (4.5 minutes each) and the
|
|
663
|
+
* background launcher refused it; X1 xr-molecule-flash-m170 (+06:02) chained two invocations of the
|
|
664
|
+
* suite's own runner script in the foreground, where nothing counted them, and the note reported
|
|
665
|
+
* the passing second walk as the first walk's 13 failures.
|
|
666
|
+
*
|
|
667
|
+
* The one run handed back is the LAST suite statement, rewritten exactly as
|
|
668
|
+
* {@link streamingBackgroundCommand} rewrites a run (a filter or `| tail` after the runner is
|
|
669
|
+
* dropped, and a Playwright run gets the reporter that prints failures). Its own count is one —
|
|
670
|
+
* guarded, so this cannot recurse.
|
|
671
|
+
*
|
|
672
|
+
* @param command - The shell command as the executor sent it.
|
|
673
|
+
* @returns The refusal sentence, or null when the command starts the suite zero or one time.
|
|
674
|
+
*/
|
|
675
|
+
export function repeatedSuiteRunError(command) {
|
|
676
|
+
if (commandRunsNoTests(command))
|
|
677
|
+
return null;
|
|
678
|
+
const suiteSteps = suiteRunStatements(command);
|
|
679
|
+
if (suiteSteps.length <= 1)
|
|
680
|
+
return null;
|
|
681
|
+
const lastSuitePart = command
|
|
682
|
+
.split(/&&|\|\||;/)
|
|
683
|
+
.reverse()
|
|
684
|
+
.map((p) => p.trim())
|
|
685
|
+
.find((p) => isSuiteRunCommand(p));
|
|
686
|
+
const single = lastSuitePart && suiteRunStatements(lastSuitePart).length === 1
|
|
687
|
+
? streamingBackgroundCommand(lastSuitePart).command
|
|
688
|
+
: (lastSuitePart ?? '');
|
|
689
|
+
return (`This command runs the suite ${suiteSteps.length === 2 ? 'twice' : `${suiteSteps.length} times`} ` +
|
|
690
|
+
`(${suiteSteps.map((s, i) => `step ${i + 1}: \`${s}\``).join(', ')}). One walk is the ` +
|
|
691
|
+
`measurement; run exactly one: \`${single}\``);
|
|
692
|
+
}
|
|
693
|
+
/** A flag with its value, as {@link suiteRunBudgetCommand} writes it: `--timeout=15000`. */
|
|
694
|
+
const BUDGET_FLAG = /^(--[A-Za-z][\w-]*)=(\S+)$/;
|
|
695
|
+
/**
|
|
696
|
+
* The statement the suite runner occupies, and where its own arguments end.
|
|
697
|
+
*
|
|
698
|
+
* The LAST suite statement, wherever it sits: unlike a reporter or `--retries=0` (which only make
|
|
699
|
+
* sense on the run a launcher measures), the suite's budget belongs on the run itself even when
|
|
700
|
+
* another command follows it (`… ; npm run build`).
|
|
701
|
+
*/
|
|
702
|
+
function suiteRunnerArguments(command) {
|
|
703
|
+
const pipeline = lastSuiteRun(command);
|
|
704
|
+
const runner = pipeline ? pipeline.located[pipeline.at] : undefined;
|
|
705
|
+
if (!runner || runner.start === null || runner.end === null)
|
|
706
|
+
return null;
|
|
707
|
+
const start = runner.start;
|
|
708
|
+
const end = runner.end;
|
|
709
|
+
const at = statementArgumentEnd(command, start, end);
|
|
710
|
+
if (at === null)
|
|
711
|
+
return null;
|
|
712
|
+
return { start, end, at };
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* A command with the supplied suite's own settings written back onto its runner as Playwright
|
|
716
|
+
* flags, and the flags that could not be placed.
|
|
717
|
+
*
|
|
718
|
+
* The grader walks the suite under its OWN budget, so a run whose runner config sets a different
|
|
719
|
+
* timeout or worker count measures a run the grader never sees (xr-molecule-flash-m169: a 60 s
|
|
720
|
+
* wrapper config produced a green local proof the official 15 s grader then failed). Playwright
|
|
721
|
+
* lets a command-line flag win over every config file, so the suite's values are put on the
|
|
722
|
+
* runner's own arguments — written where {@link statementArgumentEnd} places them, never after a
|
|
723
|
+
* pipe, redirect or group closer. Only the command's LAST suite step is touched: that is the run
|
|
724
|
+
* every launch site measures.
|
|
725
|
+
*
|
|
726
|
+
* A flag the command already carries is REWRITTEN in place (last occurrence wins, as it does for
|
|
727
|
+
* Playwright); a flag it does not carry is inserted at the end of the runner's arguments. A
|
|
728
|
+
* command whose runner cannot be placed is returned exactly as written, with every flag reported
|
|
729
|
+
* as unplaced, so the caller states the fact instead of claiming a pin it did not make.
|
|
730
|
+
*
|
|
731
|
+
* @param command - The shell command about to run.
|
|
732
|
+
* @param flags - The flags to put on it, each as `--name=value`.
|
|
733
|
+
* @returns The command to run, the flags placed on it, and the ones it could not carry.
|
|
734
|
+
*/
|
|
735
|
+
export function suiteRunBudgetCommand(command, flags) {
|
|
736
|
+
const placed = [];
|
|
737
|
+
const unplaced = [];
|
|
738
|
+
let out = command;
|
|
739
|
+
for (const flag of flags) {
|
|
740
|
+
const parts = BUDGET_FLAG.exec(flag);
|
|
741
|
+
if (parts === null) {
|
|
742
|
+
unplaced.push(flag);
|
|
743
|
+
continue;
|
|
744
|
+
}
|
|
745
|
+
const name = parts[1] ?? '';
|
|
746
|
+
const value = parts[2] ?? '';
|
|
747
|
+
const run = suiteRunnerArguments(out);
|
|
748
|
+
if (run === null) {
|
|
749
|
+
unplaced.push(flag);
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
// `--name=value` and `--name value` alike; the last occurrence is the one Playwright uses.
|
|
753
|
+
// The value is digits (milliseconds, worker counts), so a percentage or an expression is
|
|
754
|
+
// left alone rather than half-rewritten.
|
|
755
|
+
const written = new RegExp(`(?:^|[\\s;&|(])${name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?:=|\\s+)(['"]?)(\\d[\\d_]*)(?![\\w%.])`, 'g');
|
|
756
|
+
const text = out.slice(run.start, run.at);
|
|
757
|
+
let last = null;
|
|
758
|
+
for (let m = written.exec(text); m !== null; m = written.exec(text))
|
|
759
|
+
last = m;
|
|
760
|
+
if (last !== null) {
|
|
761
|
+
const digits = last[2] ?? '';
|
|
762
|
+
const at = run.start + last.index + last[0].length - digits.length;
|
|
763
|
+
out = `${out.slice(0, at)}${value}${out.slice(at + digits.length)}`;
|
|
764
|
+
placed.push(`${name}=${value}`);
|
|
765
|
+
continue;
|
|
766
|
+
}
|
|
767
|
+
out = `${out.slice(0, run.at)} ${flag}${out.slice(run.at)}`;
|
|
768
|
+
placed.push(flag);
|
|
769
|
+
}
|
|
770
|
+
return { command: out, placed, unplaced };
|
|
771
|
+
}
|
|
652
772
|
/**
|
|
653
773
|
* The command with the `timeout <N>` wrapper lifted off the statement that runs the suite, and the
|
|
654
774
|
* bound that was lifted.
|