@molecule/api-ai-tools 1.9.10 → 1.9.11

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 CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-18T06:52:09.924Z
6
+ Generated: 2026-10-18T07:24:21.171Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-ai-tools
@@ -455,7 +455,7 @@ interface TraceAction {
455
455
 
456
456
  #### `TraceArtifact`
457
457
 
458
- What one trace says: the test it belongs to, the requests it made, and its console errors.
458
+ What one trace says: the test it belongs to, the requests it made, and its console lines.
459
459
 
460
460
  ```typescript
461
461
  interface TraceArtifact {
@@ -477,7 +477,11 @@ interface TraceArtifact {
477
477
  * Absent when the trace recorded neither, and on traces read before this field existed.
478
478
  */
479
479
  lead?: TraceRequest
480
- /** The console errors and page errors the page raised. */
480
+ /**
481
+ * The console lines and page errors the page raised: its errors first, then a line that names a
482
+ * session decision or comes from a molecule package, then any other warning, then the browser's
483
+ * own resource error ({@link traceArtifactsScript}).
484
+ */
481
485
  console: string[]
482
486
  /**
483
487
  * The test's LAST user action before the failing assertion and the requests it caused — what the
@@ -1819,7 +1823,7 @@ function buildTools(backend: ExecutionBackend, config?: ToolBuildConfig): AITool
1819
1823
 
1820
1824
  The Node program the sandbox runs to read a failed run's traces: `node <script> <dir>` prints one
1821
1825
  `TRACE <json>` line per `trace.zip` under `<dir>` (newest first, {@link MAX_TRACE_ARTIFACTS} of
1822
- them), each with the test it belongs to, the requests its page made and its console errors.
1826
+ them), each with the test it belongs to, the requests its page made and its console lines.
1823
1827
 
1824
1828
  It is a standalone program, not an import, for the reason `@molecule/api-code-sandbox` runs it:
1825
1829
  Playwright's own zip reader is not reachable from a project's `node_modules`, and a dependency
@@ -3221,7 +3225,8 @@ const MAX_TRACED_REQUESTS: 6
3221
3225
 
3222
3226
  #### `MAX_TRACED_CONSOLE`
3223
3227
 
3224
- How many console errors one test's trace contributes.
3228
+ How many console lines one test's trace contributes: errors ahead of a session or molecule-package
3229
+ line, both ahead of a plain warning and of the browser's own resource error.
3225
3230
 
3226
3231
  ```typescript
3227
3232
  const MAX_TRACED_CONSOLE: 4
@@ -104,7 +104,7 @@ export interface TraceAction {
104
104
  /** When it finished, or null when the run ended before it did. */
105
105
  end: number | null;
106
106
  }
107
- /** What one trace says: the test it belongs to, the requests it made, and its console errors. */
107
+ /** What one trace says: the test it belongs to, the requests it made, and its console lines. */
108
108
  export interface TraceArtifact {
109
109
  /** The failure's spec file, relative to the run's directory, when the trace names one. */
110
110
  spec: string | null;
@@ -124,7 +124,11 @@ export interface TraceArtifact {
124
124
  * Absent when the trace recorded neither, and on traces read before this field existed.
125
125
  */
126
126
  lead?: TraceRequest;
127
- /** The console errors and page errors the page raised. */
127
+ /**
128
+ * The console lines and page errors the page raised: its errors first, then a line that names a
129
+ * session decision or comes from a molecule package, then any other warning, then the browser's
130
+ * own resource error ({@link traceArtifactsScript}).
131
+ */
128
132
  console: string[];
129
133
  /**
130
134
  * The test's LAST user action before the failing assertion and the requests it caused — what the
@@ -145,7 +149,10 @@ export interface TraceArtifact {
145
149
  export declare const MAX_TRACE_ARTIFACTS = 12;
146
150
  /** How many requests one test's trace contributes. */
147
151
  export declare const MAX_TRACED_REQUESTS = 6;
148
- /** How many console errors one test's trace contributes. */
152
+ /**
153
+ * How many console lines one test's trace contributes: errors ahead of a session or molecule-package
154
+ * line, both ahead of a plain warning and of the browser's own resource error.
155
+ */
149
156
  export declare const MAX_TRACED_CONSOLE = 4;
150
157
  /** How many of the page's own actions one test's trace contributes, the LAST ones. */
151
158
  export declare const MAX_TRACED_ACTIONS = 40;
@@ -170,7 +177,7 @@ export declare const TRACE_NOTE_LEAD_GOT_CHARS = 200;
170
177
  /**
171
178
  * The Node program the sandbox runs to read a failed run's traces: `node <script> <dir>` prints one
172
179
  * `TRACE <json>` line per `trace.zip` under `<dir>` (newest first, {@link MAX_TRACE_ARTIFACTS} of
173
- * them), each with the test it belongs to, the requests its page made and its console errors.
180
+ * them), each with the test it belongs to, the requests its page made and its console lines.
174
181
  *
175
182
  * It is a standalone program, not an import, for the reason `@molecule/api-code-sandbox` runs it:
176
183
  * Playwright's own zip reader is not reachable from a project's `node_modules`, and a dependency
@@ -282,7 +289,7 @@ export declare function stalledDocumentSubresource(request: TraceRequest): boole
282
289
  * row falls back to {@link TraceArtifact.lead}: the page's last answered fetch/xhr.
283
290
  *
284
291
  * WHICH rows it spends is evidence, not artifact order (xr-molecule-flash-m112 +53:46): a row
285
- * needs a recorded response, a real failure or a console error ({@link traceRowEvidence}), rows are
292
+ * needs a recorded response, a real failure or a console line ({@link traceRowEvidence}), rows are
286
293
  * deduplicated by the test's location, and they are ordered real failure → repeated from an
287
294
  * earlier walk → the rest ({@link traceRowTier}). Without that the note spent all five rows on four
288
295
  * traces of one `afterEach` line whose every request was `-1`, and left the favorite cause — the
@@ -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,C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aG;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"}
@@ -33,7 +33,10 @@ import { isPlaywrightRunCommand, redactSecrets } from './utilities.js';
33
33
  export const MAX_TRACE_ARTIFACTS = 12;
34
34
  /** How many requests one test's trace contributes. */
35
35
  export const MAX_TRACED_REQUESTS = 6;
36
- /** How many console errors one test's trace contributes. */
36
+ /**
37
+ * How many console lines one test's trace contributes: errors ahead of a session or molecule-package
38
+ * line, both ahead of a plain warning and of the browser's own resource error.
39
+ */
37
40
  export const MAX_TRACED_CONSOLE = 4;
38
41
  /** How many of the page's own actions one test's trace contributes, the LAST ones. */
39
42
  export const MAX_TRACED_ACTIONS = 40;
@@ -60,7 +63,7 @@ const TRACE_NOTE_FAILURE_CHARS = 120;
60
63
  /**
61
64
  * The Node program the sandbox runs to read a failed run's traces: `node <script> <dir>` prints one
62
65
  * `TRACE <json>` line per `trace.zip` under `<dir>` (newest first, {@link MAX_TRACE_ARTIFACTS} of
63
- * them), each with the test it belongs to, the requests its page made and its console errors.
66
+ * them), each with the test it belongs to, the requests its page made and its console lines.
64
67
  *
65
68
  * It is a standalone program, not an import, for the reason `@molecule/api-code-sandbox` runs it:
66
69
  * Playwright's own zip reader is not reachable from a project's `node_modules`, and a dependency
@@ -95,6 +98,20 @@ const MAX_CONSOLE = ${MAX_TRACED_CONSOLE}
95
98
  const MAX_ACTIONS = ${MAX_TRACED_ACTIONS}
96
99
  const MAX_BODY = ${MAX_TRACED_BODY_CHARS}
97
100
  const MAX_URL = 200
101
+ // A console line that is not an error but still has to reach the note (m148): one a molecule
102
+ // package wrote — it names the package, the \`[molecule/…]\` prefix, or the \`[scope]\` prefix
103
+ // molecule's own logger writes for a named module ([auth], [http], [i18n]) — or one that names a
104
+ // session decision in the page's own words. \`@molecule/app-auth\` logged "Token refresh failed,
105
+ // logging out" at WARNING level, and this reader kept error entries only, so every trace note
106
+ // carried the browser's generic "Failed to load resource: 401" while the platform's own package was
107
+ // saying, in words, that it had signed the user out.
108
+ const MOLECULE_CONSOLE = /@molecule\\/|\\[molecule[:\\/][^\\]]*\\]|^\\s*\\[[a-z][a-z0-9-]*\\]/
109
+ const SESSION_CONSOLE = /\\b(?:auth(?:entication|enticated|orization|orized)?|session|token|sign(?:ed|ing)?[\\s-]?out|log(?:ged|ging)?[\\s-]?out|refresh(?:ed|ing)?\\s+failed|no\\s+provider)\\b/i
110
+
111
+ // Whether a console line belongs in the note even though it is not at error level.
112
+ function consoleSignal(text) {
113
+ return MOLECULE_CONSOLE.test(text) || SESSION_CONSOLE.test(text)
114
+ }
98
115
 
99
116
  function walk(dir, depth, out) {
100
117
  if (depth < 0) return
@@ -508,13 +525,18 @@ for (const one of found.slice(0, MAX_TRACES)) {
508
525
  chosen.push(wire(r))
509
526
  }
510
527
  const consoleErrors = []
528
+ const consoleSignals = []
529
+ const consoleWarnings = []
511
530
  let spec = null
512
531
  let line = 0
513
532
  for (const entry of trace) {
514
533
  if (!entry) continue
515
- if (entry.type === 'console' && entry.messageType === 'error' && typeof entry.text === 'string')
516
- consoleErrors.push(entry.text)
517
- else if (entry.type === 'event' && entry.method === 'pageError') {
534
+ if (entry.type === 'console' && typeof entry.text === 'string') {
535
+ if (entry.messageType === 'error') consoleErrors.push(entry.text)
536
+ else if (consoleSignal(entry.text)) consoleSignals.push(entry.text)
537
+ else if (entry.messageType === 'warning' || entry.messageType === 'warn')
538
+ consoleWarnings.push(entry.text)
539
+ } else if (entry.type === 'event' && entry.method === 'pageError') {
518
540
  const message = messageOf(entry.params)
519
541
  if (message) consoleErrors.push(message)
520
542
  } else if (entry.type === 'before' && Array.isArray(entry.stack) && entry.stack.length) {
@@ -526,9 +548,13 @@ for (const one of found.slice(0, MAX_TRACES)) {
526
548
  }
527
549
  }
528
550
  // Chromium reports every failed request as a console error too; where the page logged something
529
- // of its own about it, that is the line worth reading.
551
+ // of its own about it, that is the line worth reading. Errors lead, then the lines that name a
552
+ // session decision or come from a molecule package (m148), then any other warning — the browser's
553
+ // resource error is last, because it is evidence of a failed request, not of a cause, and the
554
+ // platform's own package saying "logging out" must not be ranked below it.
530
555
  const specific = consoleErrors.filter(function (text) { return !/^Failed to load resource/.test(text) })
531
- const keptConsole = specific.length > 0 ? specific : consoleErrors
556
+ const keptConsole = specific.concat(consoleSignals, consoleWarnings)
557
+ if (specific.length === 0) keptConsole.push.apply(keptConsole, consoleErrors)
532
558
  if (chosen.length === 0 && keptConsole.length === 0 && actions.length === 0) continue
533
559
  process.stdout.write('TRACE ' + JSON.stringify({
534
560
  dir: path.relative(ROOT, path.dirname(one.file)),
@@ -910,7 +936,7 @@ function repeatsEarlierFailure(item, earlier) {
910
936
  }
911
937
  /**
912
938
  * Whether a trace holds evidence the note can explain: a request that got a RECORDED response, a
913
- * real failure (4xx/5xx or a network error), or a console error. A request with no response is
939
+ * real failure (4xx/5xx or a network error), or a console line. A request with no response is
914
940
  * not evidence (m112 +53:46): four of the note's five rows were traces of one `afterEach` line
915
941
  * whose every request was `-1`, so the favorite cause — repeated in all three walks — stayed
916
942
  * hidden in "… and 7 more traced failures".
@@ -921,7 +947,7 @@ function repeatsEarlierFailure(item, earlier) {
921
947
  * `page.goto` timed out ({@link stalledDocumentSubresource}).
922
948
  *
923
949
  * @param item - One traced failure.
924
- * @returns True when the trace holds a request or console error worth a row.
950
+ * @returns True when the trace holds a request or console line worth a row.
925
951
  */
926
952
  function traceRowEvidence(item) {
927
953
  return (item.console.length > 0 ||
@@ -1112,7 +1138,7 @@ function missingApiPrefixSentence(request) {
1112
1138
  * row falls back to {@link TraceArtifact.lead}: the page's last answered fetch/xhr.
1113
1139
  *
1114
1140
  * WHICH rows it spends is evidence, not artifact order (xr-molecule-flash-m112 +53:46): a row
1115
- * needs a recorded response, a real failure or a console error ({@link traceRowEvidence}), rows are
1141
+ * needs a recorded response, a real failure or a console line ({@link traceRowEvidence}), rows are
1116
1142
  * deduplicated by the test's location, and they are ordered real failure → repeated from an
1117
1143
  * earlier walk → the rest ({@link traceRowTier}). Without that the note spent all five rows on four
1118
1144
  * traces of one `afterEach` line whose every request was `-1`, and left the favorite cause — the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-tools",
3
- "version": "1.9.10",
3
+ "version": "1.9.11",
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",