@molecule/api-ai-tools 1.9.3 → 1.9.5

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.
@@ -124,6 +124,28 @@ export interface LocatedCommandSegment {
124
124
  * @returns One entry per statement or pipeline stage, in order.
125
125
  */
126
126
  export declare function locatedCommandSegments(command: string): LocatedCommandSegment[];
127
+ /**
128
+ * Where an option of a statement's program belongs: one past the statement's last ARGUMENT.
129
+ *
130
+ * A flag written "at the end of the command" is not the runner's: a statement can end on a
131
+ * redirection (`… 2>&1`), and a statement can sit inside a group whose closer belongs to the
132
+ * shell, not to the words (`( … )`, `{ …; }`). Appending after that closer is a different shell
133
+ * word that the group has already closed — `… --config=x 2>&1) --reporter=list` is
134
+ * `sh: Syntax error: word unexpected`, which killed a backgrounded walk at once and pushed the
135
+ * model off the platform's runner shape (xr-molecule-flash-m129 +34:29). Write the option where
136
+ * the program's own arguments end and the rest of the statement still parses:
137
+ * `… --config=x --reporter=list 2>&1)`.
138
+ *
139
+ * The statement must be one {@link locatedCommandSegments} placed in THIS command: a statement
140
+ * inside a nested `sh -c '<command>'` string has no offsets here (its positions are positions in
141
+ * that string), so null is returned rather than a splice into the outer text.
142
+ *
143
+ * @param command - The shell command.
144
+ * @param start - The statement's first character ({@link LocatedCommandSegment.start}).
145
+ * @param end - One past the statement's last character ({@link LocatedCommandSegment.end}).
146
+ * @returns The offset to write the option at, or null when the statement cannot be placed here.
147
+ */
148
+ export declare function statementArgumentEnd(command: string, start: number | null, end: number | null): number | null;
127
149
  /**
128
150
  * The bound a command puts on its own run: the largest `timeout <N>` any of its segments runs
129
151
  * under (`timeout 280 hurl --test …` → 280), or null when it carries none.
@@ -1 +1 @@
1
- {"version":3,"file":"command-position.d.ts","sourceRoot":"","sources":["../src/command-position.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,uFAAuF;AACvF,MAAM,WAAW,cAAc;IAC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,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAK/E"}
@@ -36,6 +36,14 @@
36
36
  const WORD = /"(?:\\.|[^"\\])*"|'[^']*'|\S+/g;
37
37
  /** Shell words that stand alone: grouping, never an argument. */
38
38
  const GROUPING = new Set(['(', ')', '{', '}']);
39
+ /**
40
+ * A redirection written as ONE word, its target attached: `2>&1`, `>out.log`, `&>/dev/null`,
41
+ * `<<'EOF'`. Matched against a word of the statement, so a redirect's target written as its own
42
+ * word is {@link REDIRECT_OPERATOR}'s case instead.
43
+ */
44
+ const REDIRECT_WORD = /^(?:\d*|&)(?:<<<|<<-?|>>?\|?|<>|>&|<&)(?:&?\d+|-|[^\s;&|()<>]*)?$/;
45
+ /** A redirection operator on its own, whose target is the word after it (`> out.log`). */
46
+ const REDIRECT_OPERATOR = /^(?:\d*|&)(?:<<<|<<-?|>>?\|?|<>|>&|<&)$/;
39
47
  /** How deep a `sh -c '<command>'` is opened before the parser leaves it alone. */
40
48
  const MAX_NESTING = 3;
41
49
  /** How many wrapper words one segment may carry before the parser gives up on it. */
@@ -744,6 +752,142 @@ function wordOffset(text, index) {
744
752
  export function locatedCommandSegments(command) {
745
753
  return locatedSegmentsOf(command, 0);
746
754
  }
755
+ /**
756
+ * How many `$( … )` and `${ … }` expansions a piece of shell text has open at its end.
757
+ *
758
+ * Quotes are honoured (a `'$('` expands nothing, and `"$("` opens one), and a backslash escapes
759
+ * the next character. Only `$(`/`${` are counted: a bare `(` or `{` opens a group whose closer is
760
+ * the statement's own punctuation and may be stepped over, while an expansion opened inside the
761
+ * statement is an argument in progress, and its closer must not be crossed.
762
+ *
763
+ * @param text - The statement's text, up to (not including) the position being asked about.
764
+ * @returns The open parentheses and braces.
765
+ */
766
+ function substitutionDepth(text) {
767
+ let parens = 0;
768
+ let braces = 0;
769
+ let quote = null;
770
+ for (let i = 0; i < text.length; i++) {
771
+ const char = text[i] ?? '';
772
+ if (quote === "'") {
773
+ if (char === "'")
774
+ quote = null;
775
+ continue;
776
+ }
777
+ if (char === '\\') {
778
+ i += 1;
779
+ continue;
780
+ }
781
+ if (char === "'" && quote === null) {
782
+ quote = "'";
783
+ continue;
784
+ }
785
+ if (char === '"') {
786
+ quote = quote === '"' ? null : '"';
787
+ continue;
788
+ }
789
+ if (char === '$' && text[i + 1] === '(') {
790
+ parens += 1;
791
+ i += 1;
792
+ continue;
793
+ }
794
+ if (char === '$' && text[i + 1] === '{') {
795
+ braces += 1;
796
+ i += 1;
797
+ continue;
798
+ }
799
+ if (char === ')' && parens > 0)
800
+ parens -= 1;
801
+ else if (char === '}' && braces > 0)
802
+ braces -= 1;
803
+ }
804
+ return { parens, braces };
805
+ }
806
+ /**
807
+ * Where an option of a statement's program belongs: one past the statement's last ARGUMENT.
808
+ *
809
+ * A flag written "at the end of the command" is not the runner's: a statement can end on a
810
+ * redirection (`… 2>&1`), and a statement can sit inside a group whose closer belongs to the
811
+ * shell, not to the words (`( … )`, `{ …; }`). Appending after that closer is a different shell
812
+ * word that the group has already closed — `… --config=x 2>&1) --reporter=list` is
813
+ * `sh: Syntax error: word unexpected`, which killed a backgrounded walk at once and pushed the
814
+ * model off the platform's runner shape (xr-molecule-flash-m129 +34:29). Write the option where
815
+ * the program's own arguments end and the rest of the statement still parses:
816
+ * `… --config=x --reporter=list 2>&1)`.
817
+ *
818
+ * The statement must be one {@link locatedCommandSegments} placed in THIS command: a statement
819
+ * inside a nested `sh -c '<command>'` string has no offsets here (its positions are positions in
820
+ * that string), so null is returned rather than a splice into the outer text.
821
+ *
822
+ * @param command - The shell command.
823
+ * @param start - The statement's first character ({@link LocatedCommandSegment.start}).
824
+ * @param end - One past the statement's last character ({@link LocatedCommandSegment.end}).
825
+ * @returns The offset to write the option at, or null when the statement cannot be placed here.
826
+ */
827
+ export function statementArgumentEnd(command, start, end) {
828
+ if (start === null || end === null)
829
+ return null;
830
+ if (!Number.isInteger(start) || !Number.isInteger(end))
831
+ return null;
832
+ if (start < 0 || end > command.length || end < start)
833
+ return null;
834
+ let at = end;
835
+ // Group closers are the shell's words, not the program's: `… 2>&1)` and `… ; }` end the
836
+ // statement with punctuation no option can follow. A `)` that closes a `$(` opened INSIDE the
837
+ // statement is not one of those — it is the last character of an argument
838
+ // (`… $(cat e2e/args.txt)`), and crossing it would write the option inside the substitution.
839
+ for (;;) {
840
+ let cursor = at;
841
+ while (cursor > start && /\s/.test(command[cursor - 1] ?? ''))
842
+ cursor -= 1;
843
+ const closer = command[cursor - 1];
844
+ if (closer !== ')' && closer !== '}') {
845
+ at = cursor;
846
+ break;
847
+ }
848
+ const open = substitutionDepth(command.slice(start, cursor - 1));
849
+ if ((closer === ')' && open.parens > 0) || (closer === '}' && open.braces > 0)) {
850
+ at = cursor;
851
+ break;
852
+ }
853
+ at = cursor - 1;
854
+ }
855
+ const words = [...command.slice(start, at).matchAll(new RegExp(WORD.source, 'g'))].map((m) => ({
856
+ text: m[0],
857
+ index: start + (m.index ?? 0),
858
+ }));
859
+ // A trailing redirection belongs to the statement but is not an argument of its program. An
860
+ // option written after it would still parse, but the option belongs with the program's own
861
+ // words (`… --flag 2>&1`, not `… 2>&1 --flag`), so every redirect suffix is stepped over.
862
+ while (words.length > 0) {
863
+ const last = words[words.length - 1];
864
+ if (last === undefined)
865
+ break;
866
+ if (GROUPING.has(last.text) || REDIRECT_WORD.test(last.text)) {
867
+ at = last.index;
868
+ words.pop();
869
+ continue;
870
+ }
871
+ const operator = words[words.length - 2];
872
+ if (operator !== undefined && REDIRECT_OPERATOR.test(operator.text)) {
873
+ at = operator.index;
874
+ words.pop();
875
+ words.pop();
876
+ // `2 > out.log` spells the same redirect as `2>out.log`: the descriptor is the word before
877
+ // the operator, and an option written between them would turn it into an argument.
878
+ const descriptor = words[words.length - 1];
879
+ if (descriptor !== undefined && /^\d+$/.test(descriptor.text)) {
880
+ at = descriptor.index;
881
+ words.pop();
882
+ }
883
+ continue;
884
+ }
885
+ break;
886
+ }
887
+ while (at > start && /\s/.test(command[at - 1] ?? ''))
888
+ at -= 1;
889
+ return at;
890
+ }
747
891
  /**
748
892
  * {@link locatedCommandSegments}'s recursion, so a `sh -c '<command>'` is opened as far as
749
893
  * {@link MAX_NESTING} allows. A nested statement's offsets are cleared: they are positions in
@@ -1 +1 @@
1
- {"version":3,"file":"trace-artifacts.d.ts","sourceRoot":"","sources":["../src/trace-artifacts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,iGAAiG;IACjG,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,yFAAyF;IACzF,GAAG,EAAE,MAAM,CAAA;IACX,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAA;IACb,kEAAkE;IAClE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CACnB;AAED,iGAAiG;AACjG,MAAM,WAAW,aAAa;IAC5B,0FAA0F;IAC1F,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAA;IACZ,6FAA6F;IAC7F,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB;;;;OAIG;IACH,OAAO,EAA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AAO,CAGhE;AA4ID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,MAAM,EAAE,MAAM,EACd,eAAe,GAAE,SAAS,MAAM,EAAO,GACtC,MAAM,GAAG,IAAI,CA2Gf;AAaD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAG9D;AAED,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAwG/D,oGAAoG;AACpG,MAAM,WAAW,qBAAqB;IACpC,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,4EAA4E;IAC5E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC5C,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA2BjC"}
@@ -26,7 +26,7 @@
26
26
  *
27
27
  * @module
28
28
  */
29
- import { locatedCommandSegments } from './command-position.js';
29
+ import { locatedCommandSegments, statementArgumentEnd } from './command-position.js';
30
30
  import { isDiagnosisRun } from './suite-overlap.js';
31
31
  import { isPlaywrightRunCommand, redactSecrets } from './utilities.js';
32
32
  /** How many traces one read reports, newest first. */
@@ -772,7 +772,7 @@ export function failureTraceNote(items, target, earlierFailures = []) {
772
772
  (transport.error === 'net::ERR_CONTENT_DECODING_FAILED'
773
773
  ? 'A body whose gzip `content-encoding` no longer matches its bytes does this; a ' +
774
774
  '`vite preview` over a build must be started with ' +
775
- '`MOL_E2E_PREVIEW_PLUGIN=0 npx vite preview --port 4173 --strictPort`. '
775
+ '`MOL_E2E_PREVIEW_PLUGIN=0 npx vite preview --host 127.0.0.1 --port 4173 --strictPort`. '
776
776
  : '') +
777
777
  'Fix the server before the app.\n\n';
778
778
  return (transportLead +
@@ -827,40 +827,36 @@ function namesTraceMode(command) {
827
827
  return /(?:^|[\s;&|(])--trace(?:=|\s)/.test(command);
828
828
  }
829
829
  /**
830
- * Where the `test` word of the command's Playwright run ends, or null when it has none that the
831
- * shell parse can place.
832
- *
833
- * The flag has to land INSIDE the Playwright step, not at the end of the whole command: a run
834
- * Flash sends almost every time ends `… 2>&1 | tail -60` or `… > log 2>&1; echo "exit=$?"; grep -c
835
- * "" log`, and a flag appended after those is an operand of `tail`/`grep` — GNU `tail` refuses it
836
- * outright (`tail: option used in invalid context -- 6`) and Playwright never sees it
837
- * (xr-molecule-flash-m102 +07:40 → +07:53).
838
- *
839
- * The step is found by the package's own shell parse ({@link locatedCommandSegments}), the one
840
- * every runner classifier reads: it answers which STATEMENT runs `playwright test` in command
841
- * position, and where that statement's program word sits in the command. The offset is the parse's
842
- * own token position, never a search for the re-joined text — that text drops grouping braces and
843
- * single-space-joins the words, so a command carrying a heredoc body or a `"quoted"` program found
844
- * nothing at all and the flag was not added.
830
+ * Where an option of the command's Playwright run belongs, or null when the shell parse cannot
831
+ * place the run or its arguments.
832
+ *
833
+ * The flag has to land INSIDE the Playwright step, in the run's own argument list — never at the
834
+ * end of the whole command: a run Flash sends almost every time ends `… 2>&1 | tail -60` or
835
+ * `… > log 2>&1; echo "exit=$?"; grep -c "" log`, and a flag appended after those is an operand of
836
+ * `tail`/`grep` — GNU `tail` refuses it outright (`tail: option used in invalid context -- 6`) and
837
+ * Playwright never sees it (xr-molecule-flash-m102 +07:40 → +07:53). A step inside a subshell
838
+ * (`( … playwright test … 2>&1)`) is the same rule the other way: a flag written after the `)`
839
+ * closes the group before the shell has read the flag at all
840
+ * (`sh: Syntax error: word unexpected`, xr-molecule-flash-m129 +34:29).
841
+ *
842
+ * The step and the offset are the package's own shell parse's answers
843
+ * ({@link locatedCommandSegments}, {@link statementArgumentEnd}): the parse says which STATEMENT
844
+ * runs `playwright test` in command position, and where that statement's own arguments end — before
845
+ * a trailing redirection and before any group closer. Never a search for the re-joined text: that
846
+ * text drops grouping braces and single-space-joins the words, so a command carrying a heredoc body
847
+ * or a `"quoted"` program found nothing at all and the flag was not added.
845
848
  *
846
849
  * @param command - The shell command.
847
- * @returns The offset just after `test`, or null.
850
+ * @returns The offset to write the flag at, or null.
848
851
  */
849
- function playwrightTestWordEnd(command) {
852
+ function playwrightOptionOffset(command) {
850
853
  for (const located of locatedCommandSegments(command)) {
851
854
  const segment = located.segment;
852
855
  if (!segment || located.programOffset === null)
853
856
  continue;
854
857
  if (!/^playwright\s+test\b/.test(segment.text))
855
858
  continue;
856
- // `playwright` and `test` are the statement's own first two words; the flag follows `test`.
857
- const words = new RegExp(/\S+/.source, 'g');
858
- words.lastIndex = located.programOffset;
859
- const program = words.exec(command);
860
- if (!program)
861
- continue;
862
- const second = words.exec(command);
863
- return second ? second.index + second[0].length : null;
859
+ return statementArgumentEnd(command, located.start, located.end);
864
860
  }
865
861
  return null;
866
862
  }
@@ -948,14 +944,16 @@ export async function diagnosisTraceCommand(args) {
948
944
  const config = await readRunConfig(args.command, args.cwd, args.readFile);
949
945
  if (suiteRecordsTraces(config))
950
946
  return unchanged;
951
- // The flag goes into the Playwright step, right after its `test` word — an option of the run
952
- // itself, whatever the command opens with and wherever it pipes or redirects its output. Appended
953
- // at the end of the whole command it belonged to the LAST pipeline stage instead (`tail`, `grep`),
954
- // which either refused it or silently ran without it (xr-molecule-flash-m102 +07:40 → +07:53). The
955
- // step's shape is untouched otherwise, so the rewrites that run on this command afterwards still
956
- // see what they expect: a trailing `| tail -60` is still trailing and is still dropped
947
+ // The flag goes into the Playwright step's own argument list, at the end of it — an option of
948
+ // the run itself, whatever the command opens with, whatever pipes or redirects its output, and
949
+ // before the `)` that may close a subshell around it. Appended at the end of the whole command
950
+ // it belonged to the LAST pipeline stage instead (`tail`, `grep`), which either refused it or
951
+ // silently ran without it (xr-molecule-flash-m102 +07:40 → +07:53); written after a subshell's
952
+ // `)` it was a shell syntax error (xr-molecule-flash-m129 +34:29). The step's shape is untouched
953
+ // otherwise, so the rewrites that run on this command afterwards still see what they expect: a
954
+ // trailing `| tail -60` is still trailing and is still dropped
957
955
  // (`streamingBackgroundCommand`).
958
- const at = playwrightTestWordEnd(args.command);
956
+ const at = playwrightOptionOffset(args.command);
959
957
  if (at === null)
960
958
  return unchanged;
961
959
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAW3E;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAS5C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,GAAG,MAAM,KAAG,MAEE,CAAA;AAuGhD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAKD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAsCzD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,CAUpF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAElE;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB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C,EAAE,MAAM,CAAA;KAAE,CAAA;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,GACA,MAAM,CA2GR;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAsCf;AAED,qEAAqE;AACrE,eAAO,MAAM,eAAe,QAA0C,CAAA;AAEtE;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgB7D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB,GAAG,MAAM,GAAG,IAAI,CAKhB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAgBvC"}
package/dist/utilities.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * @module
6
6
  */
7
7
  import { posix } from 'path';
8
- import { commandSegments, locatedCommandSegments } from './command-position.js';
8
+ import { commandSegments, locatedCommandSegments, statementArgumentEnd, } from './command-position.js';
9
9
  import { classifyRunFailure } from './failure-kind.js';
10
10
  import { commandRunsNoTests } from './no-test-run.js';
11
11
  import { isDiagnosisRun, scopedRerunCommand, suiteCommandTarget, suiteRunInTheWay, withoutHeredocs, withSuiteConfig, } from './suite-overlap.js';
@@ -422,7 +422,18 @@ export function streamingBackgroundCommand(command) {
422
422
  out = out.slice(0, head.index);
423
423
  changes.push(`Dropped the trailing \`${head[0].trim()}\`: Playwright prints its pass/fail count last, and it would be cut.`);
424
424
  }
425
- const lastStep = out.split(/&&|\|\||;/).at(-1) ?? '';
425
+ // The last step that RUNS something. A trailing group closer is punctuation, not a step: a
426
+ // brace group writes it after a `;` (`{ …; }`), so reading the split's last part literally
427
+ // made `}` the step and withheld every rewrite from a run inside a group.
428
+ const parts = out.split(/&&|\|\||;/);
429
+ let stepIndex = parts.length - 1;
430
+ while (stepIndex > 0 && /^[\s)}]*$/.test(parts[stepIndex] ?? ''))
431
+ stepIndex -= 1;
432
+ const rawLastStep = parts[stepIndex] ?? '';
433
+ // The step's own text, with the punctuation that closes the group it sits in taken off — the
434
+ // options are parsed and placed against this text, while the closer is kept in the command.
435
+ const lastStep = rawLastStep.replace(/[\s)}]+$/, '');
436
+ const stepStart = rawLastStep === '' ? out.length : Math.max(0, out.lastIndexOf(rawLastStep));
426
437
  // The last step runs Playwright — whether or not anything is piped from it. Keying this on
427
438
  // "nothing is piped out of the last step" withheld the reporter, the inline-failure switch and
428
439
  // `--retries=0` from exactly the runs whose output was filtered (xr-molecule-flash-m101
@@ -433,19 +444,27 @@ export function streamingBackgroundCommand(command) {
433
444
  /**
434
445
  * Add a word to the suite runner's own arguments; false when the runner could not be placed.
435
446
  *
436
- * A pipe this rewrite could not drop still follows the runner (`| tee run.log`), so appending at
437
- * the end of the whole command would make the word an operand of the filter — m102's dangling
438
- * `--trace` flag, in the same shape. A suite inside a nested `sh -c '<command>'` string has no
439
- * offsets in this command (they are positions in THAT string), so the command is left exactly as
440
- * written and the caller reports no rewrite: appending at the end would hand the flag to the
441
- * shell, outside the quotes.
447
+ * The word goes where the runner's own arguments end ({@link statementArgumentEnd}), never at
448
+ * the end of the command's text: a pipe this rewrite could not drop still follows the runner
449
+ * (`| tee run.log`), and a statement can end on a group closer (`( … )`, `{ …; }`) or a
450
+ * redirection (`… 2>&1`). Appending after the `)` of a subshell was a shell syntax error that
451
+ * killed the run at once (`sh: Syntax error: word unexpected`) and pushed the model off the
452
+ * platform's runner shape (xr-molecule-flash-m129 +34:29); appending after a pipe hands the
453
+ * word to the filter (m102's dangling `--trace` flag, in the same shape).
454
+ *
455
+ * A suite the parse could not place — one inside a nested `sh -c '<command>'` string, whose
456
+ * offsets are positions in THAT string, or a runner that is not the command's last step — is
457
+ * left exactly as written and the caller reports no rewrite. There is nowhere in this command
458
+ * the word belongs, and guessing at the text is what produced both failures above.
442
459
  */
443
460
  const addToRun = (flag) => {
444
461
  const pipeline = lastSuitePipeline(out);
445
462
  const runner = pipeline ? pipeline.located[pipeline.at] : undefined;
446
- if (runner && runner.end === null)
463
+ if (!runner)
464
+ return false;
465
+ const at = statementArgumentEnd(out, runner.start, runner.end);
466
+ if (at === null)
447
467
  return false;
448
- const at = runner?.end ?? out.trimEnd().length;
449
468
  out = `${out.slice(0, at)} ${flag}${out.slice(at)}`;
450
469
  return true;
451
470
  };
@@ -479,12 +498,15 @@ export function streamingBackgroundCommand(command) {
479
498
  return 'list';
480
499
  })
481
500
  .filter((v) => v !== null);
482
- // Only the last step is rewritten, and `lastStep` is a suffix of `out`.
501
+ // Only the last step is rewritten, and its offsets are the parse's own. The punctuation
502
+ // after the step (`; }`, or the `)` attached to it) is kept verbatim.
483
503
  out =
484
- out.slice(0, out.length - lastStep.length) +
504
+ out.slice(0, stepStart) +
485
505
  lastStep.slice(0, reporters.start) +
486
506
  `--reporter${reporters.separator}${kept.join(',')}` +
487
- lastStep.slice(reporters.end);
507
+ lastStep.slice(reporters.end) +
508
+ rawLastStep.slice(lastStep.length) +
509
+ out.slice(stepStart + rawLastStep.length);
488
510
  changes.push(
489
511
  // `list` was already there and a second printer sat beside it: that one is dropped. When
490
512
  // no `list` was named at all, the printer is SWITCHED to it (flash-m62's `line`).
@@ -2604,7 +2626,7 @@ export function failureCausesNote(log, excluded = [], run, pageErrors = []) {
2604
2626
  (networkError === 'net::ERR_CONTENT_DECODING_FAILED'
2605
2627
  ? ': a body whose gzip `content-encoding` no longer matches its bytes does this, and a ' +
2606
2628
  '`vite preview` over a build must be started with ' +
2607
- '`MOL_E2E_PREVIEW_PLUGIN=0 npx vite preview --port 4173 --strictPort`'
2629
+ '`MOL_E2E_PREVIEW_PLUGIN=0 npx vite preview --host 127.0.0.1 --port 4173 --strictPort`'
2608
2630
  : ' (what the run hit, and why it refused the connection)') +
2609
2631
  (rerun ? `. Then send exactly this: \`${rerun}\`` : '') +
2610
2632
  (locations.length > 0 ? `. Failing tests: ${locations.join(', ')}.` : ''));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-tools",
3
- "version": "1.9.3",
3
+ "version": "1.9.5",
4
4
  "description": "Shared AI agent tools with backend abstraction for sandbox and local execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",