@molecule/api-ai-tools 1.13.0 → 1.14.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/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-22T00:38:26.332Z
6
+ Generated: 2026-10-23T00:59:47.543Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-ai-tools
@@ -140,6 +140,13 @@ still names the deployed host (xr-molecule-flash-m103 +28:08).
140
140
 
141
141
  ```typescript
142
142
  interface LocatedCommandSegment {
143
+ /**
144
+ * Directory-scope ancestry supplied by the existing shell parse, outermost first.
145
+ * Parenthesized groups and nested `sh -c` strings have their own shell directory;
146
+ * braces share their parent's. Identities are opaque and local to this invocation.
147
+ * Absent for ordinary statements in the outer shell, preserving their existing shape.
148
+ */
149
+ shellScope?: readonly string[]
143
150
  /**
144
151
  * What the statement runs, or null when it only sets variables (`BASE=http://…` on its own):
145
152
  * that shape persists in the shell, so a caller following assignments across `;`/`&&` has to
@@ -148,6 +155,13 @@ interface LocatedCommandSegment {
148
155
  segment: CommandSegment | null
149
156
  /** The statement's own leading `NAME=value` words, as written (`TEST_MODE=fullstack`). */
150
157
  assignments: readonly string[]
158
+ /**
159
+ * Assignments whose values expand at this source statement, when different from
160
+ * inherited environment bindings. A nested `sh -c` carries outer bindings into
161
+ * every entry, but expands its caller's assignment values only before its first
162
+ * command. Absent when the ordinary `assignments` list is also the source list.
163
+ */
164
+ sourceAssignments?: readonly string[]
151
165
  /**
152
166
  * The offset in the command of the statement's first word, or null for a segment inside a
153
167
  * nested `sh -c '<command>'` string — its positions are offsets in THAT string, not in this
@@ -1491,6 +1505,19 @@ interface SuiteRunPipelinePlacement {
1491
1505
  }
1492
1506
  ```
1493
1507
 
1508
+ #### `RunningLogRead`
1509
+
1510
+ A bounded, contiguous read of a running task's own log.
1511
+
1512
+ ```typescript
1513
+ interface RunningLogRead {
1514
+ /** The log's last {@link RUNNING_LOG_READ_BYTES} bytes, contiguous, as one string. */
1515
+ text: string
1516
+ /** How many bytes the WHOLE log holds, or null when the read did not answer its size. */
1517
+ bytes: number | null
1518
+ }
1519
+ ```
1520
+
1494
1521
  #### `FailedTest`
1495
1522
 
1496
1523
  One failed test, as a running suite's log names it.
@@ -1845,6 +1872,23 @@ function commandSegments(command: string): CommandSegment[]
1845
1872
 
1846
1873
  **Returns:** One entry per statement or pipeline stage that runs something, in order.
1847
1874
 
1875
+ #### `commandSubstitutions(command)`
1876
+
1877
+ The direct executable command-substitution bodies in shell text, in source order.
1878
+
1879
+ Uses the same quote, comment and heredoc boundaries as {@link executedCommands}.
1880
+ Single-quoted and escaped text is inert. Nested substitutions stay inside their
1881
+ parent's body so a caller can recurse with a separate working-directory scope
1882
+ for each body; a `cd` inside one must not affect its sibling or the outer shell.
1883
+
1884
+ ```typescript
1885
+ function commandSubstitutions(command: string): string[]
1886
+ ```
1887
+
1888
+ - `command` — The shell text to read, including any leading assignments.
1889
+
1890
+ **Returns:** Each direct `$(…)` or backtick body, without its delimiters.
1891
+
1848
1892
  #### `executedCommands(command)`
1849
1893
 
1850
1894
  Every command a shell command actually executes, at any depth — the statements themselves, the
@@ -2683,13 +2727,17 @@ function withSuiteConfig(command: string, config: string | null | undefined): st
2683
2727
  #### `scopedRerunCommand(command, locations, excluded, config, cwd, env)`
2684
2728
 
2685
2729
  The whole-suite command made scoped to the tests it should re-run instead: the same
2686
- invocation — same directory, same settings — with the named `file:line`s in place of the whole
2687
- suite, `--last-failed` dropped (it re-runs the tests that never ran too, X1 flash-m60) and
2730
+ invocation — same launcher, same settings — with the named `file:line`s in place of every
2731
+ positional selection the run carried (a spec file, a suite directory or a regex filter),
2732
+ `--last-failed` dropped (it re-runs the tests that never ran too, X1 flash-m60) and
2688
2733
  `--retries=0` set (a re-run of a known failure does not need to pay for retries).
2689
2734
 
2690
2735
  The re-run keeps the run's `> <file>` redirect only in the sense of keeping its OUTPUT there:
2691
- the target is rewritten to a fresh sibling ({@link redirectToFreshFile}), so a re-run never
2692
- overwrites the log the run itself is the evidence for (xr-molecule-flash-m173).
2736
+ the target is rewritten to a fresh sibling ({@link redirectRunnerOutputsToFreshFiles}), so a
2737
+ re-run never overwrites the log the run itself is the evidence for (xr-molecule-flash-m173) —
2738
+ and the setup around the run keeps its own file writes untouched (xr-molecule-flash-m429). A
2739
+ `tail`/`head`/`cat`/`grep` chained after the run that reads that exact log is shown the fresh
2740
+ sibling instead, so the re-run displays the run it performed (xr-molecule-flash-o03).
2693
2741
 
2694
2742
  `config` is the config the run was measured under ({@link withSuiteConfig}): the narrowed re-run
2695
2743
  carries it whenever the command itself does not, so a run that dropped `--config` cannot be
@@ -2888,6 +2936,26 @@ function moleculeDistReadNote(path: string): string | null
2888
2936
 
2889
2937
  **Returns:** The note, or null when the path is not inside a package's `dist`.
2890
2938
 
2939
+ #### `registeredTaskLogCommand(taskId)`
2940
+
2941
+ The command that reads a REGISTERED background task's own log as one bounded contiguous window
2942
+ ({@link runningLogReadCommand}), with the file its launch redirects to when the launch recorded
2943
+ one.
2944
+
2945
+ The task id is the ownership: it is the handle `wait_for_task` returned, `/tmp/${taskId}.log` is
2946
+ the log this platform's launcher writes for it, and the redirect target is the file this
2947
+ process's own launch registered for that id — never a path parsed out of a command by the
2948
+ caller. A diagnosis that reads a running walk must not build a `/tmp` path of its own
2949
+ (xr-molecule-flash-l07: the wait's DISPLAY was diagnosed as if it were the log).
2950
+
2951
+ ```typescript
2952
+ function registeredTaskLogCommand(taskId: string): string | null
2953
+ ```
2954
+
2955
+ - `taskId` — The `mol-bg-…` handle the wait returned.
2956
+
2957
+ **Returns:** The read command, or null when the handle is not a task id this platform minted.
2958
+
2891
2959
  #### `shellInstalledPackageProbe(run)`
2892
2960
 
2893
2961
  Build an {@link InstalledPackageProbe} from a shell runner (a backend's
@@ -4211,6 +4279,42 @@ function runningCauseCommand(log: string, own?: string): string
4211
4279
 
4212
4280
  **Returns:** The shell command, safe to hand to the execution backend as-is.
4213
4281
 
4282
+ #### `runningLogReadCommand(log, own)`
4283
+
4284
+ The shell command whose stdout is a bounded CONTIGUOUS read of a running task's own log: the
4285
+ log's byte size, then its last {@link RUNNING_LOG_READ_BYTES} bytes.
4286
+
4287
+ {@link runningOutputSliceCommand} is the wrong read for a diagnosis, and l07 is the finding: it
4288
+ stitches the first 40 grep-selected failure lines to the last 1 000 bytes with a blank line
4289
+ between, so the tail is DISJOINT from the headers above it. Read as one log, the last numbered
4290
+ header absorbs whatever the tail starts with — a clipped skipped-test title became the cause of
4291
+ a genuine failure (xr-molecule-flash-l07). A contiguous window can only ever hold real
4292
+ neighbouring lines of one log.
4293
+
4294
+ The size rides along so a caller can say when the window is only the log's end
4295
+ ({@link parseRunningLogRead}); without it a tail reads as the whole run.
4296
+
4297
+ ```typescript
4298
+ function runningLogReadCommand(log: string, own?: string): string
4299
+ ```
4300
+
4301
+ - `log` — The task log path.
4302
+ - `own` — A file the command redirects its own output to, if any.
4303
+
4304
+ **Returns:** The shell command, safe to hand to the execution backend as-is.
4305
+
4306
+ #### `parseRunningLogRead(stdout)`
4307
+
4308
+ The two parts of {@link runningLogReadCommand}'s answer.
4309
+
4310
+ ```typescript
4311
+ function parseRunningLogRead(stdout: string): RunningLogRead | null
4312
+ ```
4313
+
4314
+ - `stdout` — The command's stdout.
4315
+
4316
+ **Returns:** The window and the whole log's byte size, or null when the size line is absent (the read did not run, so nothing may be said about the log).
4317
+
4214
4318
  #### `repeatingFailure(log)`
4215
4319
 
4216
4320
  The cause repeating among a running suite's failures, or null.
@@ -4614,7 +4718,9 @@ function whitespaceTolerantReplace(
4614
4718
 
4615
4719
  The shell command that parses one file and exits non-zero with the error
4616
4720
  when it does not parse: `node --check` for JavaScript, `JSON.parse` for
4617
- JSON, esbuild's transform (present wherever Vite is) for TypeScript.
4721
+ ordinary JSON, TypeScript's config parser for `tsconfig`/`jsconfig` files
4722
+ (which are JSONC), esbuild's transform (present wherever Vite is) for
4723
+ TypeScript.
4618
4724
 
4619
4725
  ```typescript
4620
4726
  function parseCheckCommand(path: string): string | null
@@ -5181,6 +5287,14 @@ Bytes of a running log a repeating-cause look reads back.
5181
5287
  const REPEATING_CAUSE_TAIL_BYTES: 40000
5182
5288
  ```
5183
5289
 
5290
+ #### `RUNNING_LOG_READ_BYTES`
5291
+
5292
+ Bytes of a running log a diagnostic note reads back: one {@link REPEATING_CAUSE_TAIL_BYTES} window.
5293
+
5294
+ ```typescript
5295
+ const RUNNING_LOG_READ_BYTES: 40000
5296
+ ```
5297
+
5184
5298
  #### `REPEATING_FAILURE_MIN`
5185
5299
 
5186
5300
  DISTINCT tests that must share one signature before a running suite's repeating cause is named.
@@ -90,6 +90,18 @@ export interface ExecutedCommand {
90
90
  /** The program and its arguments as one line, what a pattern anchored at the program matches. */
91
91
  text: string;
92
92
  }
93
+ /**
94
+ * The direct executable command-substitution bodies in shell text, in source order.
95
+ *
96
+ * Uses the same quote, comment and heredoc boundaries as {@link executedCommands}.
97
+ * Single-quoted and escaped text is inert. Nested substitutions stay inside their
98
+ * parent's body so a caller can recurse with a separate working-directory scope
99
+ * for each body; a `cd` inside one must not affect its sibling or the outer shell.
100
+ *
101
+ * @param command - The shell text to read, including any leading assignments.
102
+ * @returns Each direct `$(…)` or backtick body, without its delimiters.
103
+ */
104
+ export declare function commandSubstitutions(command: string): string[];
93
105
  /**
94
106
  * Every command a shell command actually executes, at any depth — the statements themselves, the
95
107
  * body of a `sh -c '<command>'`, and the body of every command substitution (`$(…)`, backticks).
@@ -122,6 +134,13 @@ export declare function executedCommands(command: string): ExecutedCommand[];
122
134
  * still names the deployed host (xr-molecule-flash-m103 +28:08).
123
135
  */
124
136
  export interface LocatedCommandSegment {
137
+ /**
138
+ * Directory-scope ancestry supplied by the existing shell parse, outermost first.
139
+ * Parenthesized groups and nested `sh -c` strings have their own shell directory;
140
+ * braces share their parent's. Identities are opaque and local to this invocation.
141
+ * Absent for ordinary statements in the outer shell, preserving their existing shape.
142
+ */
143
+ shellScope?: readonly string[];
125
144
  /**
126
145
  * What the statement runs, or null when it only sets variables (`BASE=http://…` on its own):
127
146
  * that shape persists in the shell, so a caller following assignments across `;`/`&&` has to
@@ -130,6 +149,13 @@ export interface LocatedCommandSegment {
130
149
  segment: CommandSegment | null;
131
150
  /** The statement's own leading `NAME=value` words, as written (`TEST_MODE=fullstack`). */
132
151
  assignments: readonly string[];
152
+ /**
153
+ * Assignments whose values expand at this source statement, when different from
154
+ * inherited environment bindings. A nested `sh -c` carries outer bindings into
155
+ * every entry, but expands its caller's assignment values only before its first
156
+ * command. Absent when the ordinary `assignments` list is also the source list.
157
+ */
158
+ sourceAssignments?: readonly string[];
133
159
  /**
134
160
  * The offset in the command of the statement's first word, or null for a segment inside a
135
161
  * nested `sh -c '<command>'` string — its positions are offsets in THAT string, not in this
@@ -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;IAC7B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,qFAAqF;IACrF,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,4FAA4F;IAC5F,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAgSD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM3D;AAynBD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEzD;AA8GD;;;;;;GAMG;AAC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