yggio 0.0.6 → 0.0.15

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/index.d.ts CHANGED
@@ -941,6 +941,26 @@ export declare class DataType {
941
941
  * are held to.
942
942
  */
943
943
  get codeWidth(): number | null
944
+ /**
945
+ * The digits a decimal states, whichever width holds them (`decimal` 38,
946
+ * `bigdecimal` 76), `null` for every other datatype.
947
+ */
948
+ get precision(): number | null
949
+ /**
950
+ * The scale a decimal states, whichever width holds it, `null` for every
951
+ * other datatype.
952
+ */
953
+ get scale(): number | null
954
+ /**
955
+ * The resolution a temporal states - `d`, `s`, `ms`, `us`, `ns`, or an
956
+ * interval's layout - `null` for every other datatype.
957
+ */
958
+ get unit(): string | null
959
+ /**
960
+ * The zone a datetime states - `UTC`, `Europe/Paris`, or `NAIVE` for a
961
+ * wall clock with none - `null` for every other datatype.
962
+ */
963
+ get timezone(): string | null
944
964
  /**
945
965
  * The integer an ASCII value packs into: its bytes padded with trailing
946
966
  * NUL to the width, big-endian.
@@ -1602,20 +1622,27 @@ export declare class Field {
1602
1622
  withPartitionFields(names: Array<string>): Field
1603
1623
  /**
1604
1624
  * Return this struct root partitioned by `entries`, each a projection
1605
- * of the expression grammar: the declaration stored as `PARTITION:by`,
1606
- * every identity entry's column marked, every derived entry
1607
- * materialized as a marked column computed from the rows.
1625
+ * of the expression grammar read as a `PARTITION:by` entry, which also
1626
+ * reads Iceberg's transform spellings - `bucket(16, id)` and
1627
+ * `bucket[16](id)`, `truncate[4](name)` as `truncate(name, 4)`,
1628
+ * `identity(venue)` as `venue`: the declaration stored as
1629
+ * `PARTITION:by`, every identity entry's column marked.
1608
1630
  *
1609
1631
  * A bare column - `venue` - is an identity partition on a column the
1610
- * struct has. Any other entry - `years(ts)`, `minutes(ts, 15)`,
1611
- * `truncate(name, 4) as prefix` - is a derived partition: a child named
1612
- * by the alias, else `{source}_{function}` with the function in
1613
- * Iceberg's singular (`ts_year`, `ts_minutes`, `name_truncate`), typed
1614
- * by the term and carrying it as its `TRANSFORM:` declaration. A column
1615
- * marked before and no longer declared is unmarked; an empty array
1616
- * removes the declaration. Refused, naming the entry, when an entry
1617
- * does not parse, names a column the struct lacks, publishes a name
1618
- * another entry publishes, or cannot be typed against the struct.
1632
+ * struct has. An Iceberg transform - `year(ts)`, `month(ts)`,
1633
+ * `day(ts)`, `hour(ts)` and their plurals, whole periods since the
1634
+ * epoch, `truncate(name, 4)`, `bucket(16, id)` - names a partition and
1635
+ * no column: it is named by the alias, else `{source}_{transform}`
1636
+ * (`ts_hour`, `name_truncate`, `id_bucket`), and a folder's path and an
1637
+ * Iceberg manifest compute its value from the source. Any other derived
1638
+ * entry - `weeks(ts)`, `minutes(ts, 15)`, `lower(name)` - adds a
1639
+ * marked `TRANSFORM:` column named by the alias, else
1640
+ * `{source}_{function}` (`ts_week`, `ts_minutes`), typed by the term.
1641
+ * A column marked before and no longer declared is unmarked; an empty
1642
+ * array removes the declaration. Refused, naming the entry, when an
1643
+ * entry does not parse, names a column the struct lacks, publishes a
1644
+ * name another entry publishes, reads a source its transform does not
1645
+ * read, or cannot be typed against the struct.
1619
1646
  */
1620
1647
  withPartitionBy(entries: Array<string>): Field
1621
1648
  /**
@@ -1799,290 +1826,6 @@ export declare class Filter {
1799
1826
  }
1800
1827
  export type JsFilter = Filter
1801
1828
 
1802
- /**
1803
- * One dictionary, reading captured lines into messages, with the Arrow twins.
1804
- *
1805
- * The codec is the whole parse surface: a captured line with a verb in front
1806
- * of it, a bare frame, a numeric frame with a stated separator, a bridge's
1807
- * name/value text, a configuration document, pairs a caller already split,
1808
- * a record a text reader answered. Each redirects to the core method of the
1809
- * same name, so nothing here decides a version or a separator - it only
1810
- * carries what JavaScript said across. A stage is a call: the
1811
- * stream methods take any iterable and answer a lazy `FixMessages`, the
1812
- * Arrow methods take and answer a `BatchReader`, one batch at a time.
1813
- *
1814
- * Every message it builds is settled as it is parsed: the typed facts are
1815
- * lifted off the line, a nested `XmlData` is exploded into the message,
1816
- * deprecated fields are restated to their latest aliases, the dictionary's
1817
- * native derivations run, the identifier maps and the security identifiers
1818
- * fill, and
1819
- * the identity is derived. `SendingTime` is the message's valid tag 52,
1820
- * else a row cell reaching that tag, else the `mtime` of the `TextLine` it
1821
- * was read out of - on `parseTextArrowReader`, the row's `transunix` cell -
1822
- * else `defaultSendingTime`, else the Unix epoch, the same on every read,
1823
- * and it goes back on the wire only when the message stated it: a clock
1824
- * the parse supplied is never the message's own, so the row's `sendingtime`
1825
- * column states none either. The raw-byte doors read no line, so parsing
1826
- * undated bytes there without a default sending time is deliberately not
1827
- * deterministic. A message reporting an execution that states no execution
1828
- * clock executed at its instant: its `execunix` is its `transunix`.
1829
- */
1830
- export declare class FixCodec {
1831
- /**
1832
- * Open a codec over one dictionary, or over the process default.
1833
- *
1834
- * Every pin is the core's, spelled once here. `separator` is the byte a
1835
- * numeric frame splits on where
1836
- * the line does not say; `payloadColumn` names the batch column a line
1837
- * is read from; `captureNames` are what a run's row-header captures are
1838
- * called, in the order a line answers them, which is what lets
1839
- * `parseTextLine` read a capture by position rather than by name;
1840
- * `nullValues` are the spellings that mean nothing was
1841
- * sent; `direction` is the code of tag 385's set an unmarked line
1842
- * takes on the batch door, any spelling of one - `"S"`, `"Send"`,
1843
- * `"R"` - the core's `Send` code when unstated and no pin at all when
1844
- * empty; `batchByteSize` and `batchRowSize` are the raw bytes and the
1845
- * rows one Arrow batch targets, the core's 128 MiB and 65,536 rows when
1846
- * unstated, whichever the batch reaches first; `threads` is how many
1847
- * workers parsing and row conversion use, the available CPUs when
1848
- * unstated. Arrow capture parsing keeps at most one input batch per
1849
- * worker and yields in order; line doors use bounded row chunks.
1850
- * One thread reads lazily without a pool; zero reads as one;
1851
- * `includeMsgtypes` and
1852
- * `excludeMsgtypes` are the message types a parse keeps and refuses,
1853
- * each read before a frame is built and spelled as a code or a name -
1854
- * `"0"`, `"Heartbeat"`, `"unknown"` for a line stating no type - the
1855
- * core refusing `Heartbeat`, `TestRequest` and the untyped line when
1856
- * unstated and an empty `excludeMsgtypes` keeping every type;
1857
- * `defaultSendingTime` is the
1858
- * `SendingTime` an undated message takes when nothing it was read with
1859
- * dates it either, neither a capture reaching tag 52 nor the `mtime` of
1860
- * the line it was read out of - a `Scalar` crosses as it is and must
1861
- * already be `DateTime64(ns, UTC)`, a `Date` is its UTC millisecond
1862
- * instant restated in nanoseconds, and `null` or absence reads the Unix epoch
1863
- * per new message.
1864
- * `snapshotNs` is an epoch-aligned lifecycle snapshot width in exact
1865
- * nanoseconds; `null`, zero and a negative width disable snapshots;
1866
- * `sortedLifecycle` states that the messages `lifecycle` is handed
1867
- * arrive in instant order, so the walk reads them as they come one
1868
- * epoch hour at a time rather than collecting and sorting the whole
1869
- * capture, off when unstated;
1870
- * `officialTimeDelayMs` is how far off a whole hour of its log line's
1871
- * clock a stated clock may stand before it is `clock_skew` - the core's
1872
- * half second when unstated - and dates nothing;
1873
- * `marketMetadata` is whether a market operation carries its message's
1874
- * unmapped fields - its parties, `Account(1)` and regulatory trade
1875
- * identifiers stay its `partyids` and `identifiers` - and lifts the
1876
- * identifiers among them into the set their type belongs to, on when
1877
- * unstated; `source` is the id of the dictionary's source the codec
1878
- * reads under, resolved once and refused when the catalog holds no
1879
- * such id.
1880
- */
1881
- constructor(registry?: FixRegistry | undefined | null, options?: FixCodecOptions | undefined | null)
1882
- /**
1883
- * A codec over the registry the process environment names,
1884
- * `FixRegistry.fromEnv()`, pinned by the options the constructor takes.
1885
- */
1886
- static fromEnv(options?: FixCodecOptions | undefined | null): FixCodec
1887
- /** The dictionary this codec resolves against, sharing it. */
1888
- get registry(): FixRegistry
1889
- /** The byte a numeric frame splits on, or `null` where the line decides. */
1890
- get separator(): number | null
1891
- /** The record column a line is read from. */
1892
- get payloadColumn(): string
1893
- /** The spellings that mean nothing was sent. */
1894
- get nullValues(): Array<string>
1895
- /**
1896
- * The code of tag 385's set an unmarked line takes on the batch door,
1897
- * or `null` where no pin fills silence.
1898
- */
1899
- get direction(): string | null
1900
- /**
1901
- * The source this codec reads under, folded: an entry of the
1902
- * dictionary's sources catalog; `null` where none was named.
1903
- */
1904
- get source(): string | null
1905
- /**
1906
- * The raw bytes one Arrow batch targets.
1907
- *
1908
- * A byte count is a JavaScript number, exact to 2^53, as every count
1909
- * at this boundary is.
1910
- */
1911
- get batchByteSize(): number
1912
- /** The rows one Arrow batch targets. */
1913
- get batchRowSize(): number
1914
- /** The workers parsing and row conversion use; available CPUs by default. */
1915
- get threads(): number
1916
- /**
1917
- * The epoch-aligned lifecycle snapshot width in nanoseconds, or `null`
1918
- * where snapshots are disabled.
1919
- */
1920
- get snapshotNs(): bigint | null
1921
- /**
1922
- * This codec with its lifecycle snapshot grid set to `snapshotNs`, an
1923
- * epoch-aligned width in exact nanoseconds: `null`, zero and a negative
1924
- * width disable snapshots. Every other setting, the dictionary included,
1925
- * is this codec's, so a caller's codec gains a grid without its options
1926
- * being listed again.
1927
- */
1928
- withSnapshotNs(snapshotNs: bigint | null): FixCodec
1929
- /**
1930
- * Whether `lifecycle` reads its messages as they come, in instant
1931
- * order, one epoch hour at a time.
1932
- */
1933
- get sortedLifecycle(): boolean
1934
- /**
1935
- * This codec with its lifecycle pinned to messages arriving in instant
1936
- * order - a table read hour partition by hour partition, sorted by
1937
- * `transunix` - when `sorted`: the walk then holds one epoch hour at a
1938
- * time, sorts within it exactly as a whole capture is sorted, and walks
1939
- * an hour once a message two hours past it is read; a message dated
1940
- * before an hour already walked is walked where it arrives. `false`
1941
- * collects and sorts the whole capture. Every other setting is this
1942
- * codec's.
1943
- */
1944
- withSortedLifecycle(sorted: boolean): FixCodec
1945
- /**
1946
- * How far off a whole hour of its log line's clock a stated clock may
1947
- * stand before it is `clock_skew`, in milliseconds; it dates nothing.
1948
- *
1949
- * A millisecond count is a JavaScript number, exact to 2^53, as every
1950
- * count at this boundary is.
1951
- */
1952
- get officialTimeDelayMs(): number
1953
- /**
1954
- * The message types a parse keeps, empty where it keeps every type the
1955
- * refusals leave.
1956
- */
1957
- get includeMsgtypes(): Array<string>
1958
- /** The message types a parse refuses before it builds a frame. */
1959
- get excludeMsgtypes(): Array<string>
1960
- /**
1961
- * Whether a market operation this codec builds carries, in its
1962
- * metadata, what its message states that no typed column reads and no
1963
- * identifier map of the leaf holds, and lifts the identifiers among
1964
- * them into the set their type belongs to.
1965
- */
1966
- get marketMetadata(): boolean
1967
- /**
1968
- * The `SendingTime` an undated message takes - one neither its row nor
1969
- * its line dates - `DateTime64(ns, UTC)`, or `null` where each new
1970
- * undated message reads the Unix epoch.
1971
- */
1972
- get defaultSendingTime(): JsScalar | null
1973
- /** The complete raw message code declared by captured bytes. */
1974
- static inferMsgtypeBytes(body: Buffer): Buffer | null
1975
- /** The complete raw message code declared by captured text. */
1976
- static inferMsgtypeText(body: string): string | null
1977
- /** One captured line, whatever it is wrapped in: its messages. */
1978
- parseLine(row: Buffer): FixMessages
1979
- /** One numeric frame, read by the pairs it states. */
1980
- parseFixLine(body: Buffer): MarketMessage
1981
- /** One bridge frame, whose keys are names rather than tags. */
1982
- parseUllinkLine(body: Buffer): MarketMessage
1983
- /** One FIXML row, whose fields are XML attributes. */
1984
- parseFixmlLine(body: Buffer): MarketMessage
1985
- /** Pairs a caller already holds, in the order they arrived. */
1986
- parsePairs(pairs: Array<[string, string]>): MarketMessage
1987
- /**
1988
- * One line a text reader answered: its messages.
1989
- *
1990
- * The line's body is the bytes read, and its row-header captures state
1991
- * the rest - the plugin that logged it, the version, and every field a
1992
- * capture's name reaches. A `timestamp` capture is context and stamps
1993
- * nothing; the line's own clock does. Its `mtime` - an `mtime` capture,
1994
- * else its handle's modification time - is the message's `techunix`,
1995
- * and the sending clock of a message stating none: `SendingTime` is the
1996
- * message's own, else a capture reaching that field, else the line's
1997
- * `mtime`, else the codec's `defaultSendingTime`, else the Unix epoch, and the
1998
- * instant `transunix` is the stated one, else the first plausible of
1999
- * its evidence clocks, its stated `SendingTime` and its log line's
2000
- * clock, within the codec's one-day skew bound of the log line.
2001
- * A clock the parse supplied is never the message's own: neither the
2002
- * wire nor the row's `sendingtime` column states it.
2003
- * `withCaptureNames` is what decides which capture is which, once for
2004
- * the whole run, because a line answers its captures by position.
2005
- *
2006
- * A `direction` capture is named so it cannot silently fill a field of
2007
- * that name, and is not otherwise read: only `parseTextArrowReader` has
2008
- * a column to put a direction in.
2009
- */
2010
- parseTextLine(line: TextLine): FixMessages
2011
- /**
2012
- * A stream of Arrow batches of capture rows as batches of FIX rows.
2013
- *
2014
- * The schema is decided before the first row: the capture's own columns
2015
- * lead and the fixed FIX columns follow. Every row is parsed as the
2016
- * line door parses one - a row's `transunix` cell is its line's clock,
2017
- * so it is the messages' `techunix` and the sending clock of one
2018
- * stating none - and batches close on the bytes each row lands as
2019
- * against `batchByteSize`. The source is consumed.
2020
- *
2021
- * The capture's own columns fill nothing: they are read off the source
2022
- * row and written straight into the row this answers. This is the one door
2023
- * that can state them, and it is why they survive a parse without a
2024
- * message holding one.
2025
- */
2026
- parseTextArrowReader(source: JsBatchReader): JsBatchReader
2027
- /**
2028
- * A stream of batches of FIX rows walked through one lifecycle.
2029
- *
2030
- * `lifecycle` over batches: each row is a message through
2031
- * `MarketMessage.fromRow`, stated as the one after the live message it follows,
2032
- * and written back under the **same** schema, so a carried column
2033
- * returns to its place. Nothing is parsed again. The source is consumed.
2034
- *
2035
- * A carried column returns to its place because the message carries
2036
- * it: each row's own cells are read into the message it made, under
2037
- * their names, and stated again where that message lands. The pairing
2038
- * is by message and never by position - a walk answers messages
2039
- * in their own order, which a capture's lines are routinely not in.
2040
- */
2041
- lifecycleArrowReader(source: JsBatchReader): JsBatchReader
2042
- /**
2043
- * A stream of batches of FIX rows as the stream of messages it holds.
2044
- *
2045
- * Each row is one message through `MarketMessage.fromRow` under the source's
2046
- * schema, lazily, one batch held at a time: a batch
2047
- * `parseTextArrowReader` wrote comes back as the messages that made it
2048
- * without a parse. One half of what the Arrow twins compose;
2049
- * `arrowReader` is the other. The source is consumed.
2050
- *
2051
- * The capture's own columns are carried: each row's own cells are read
2052
- * into the message it makes, so `arrowReader(schema, messages(reader))`
2053
- * states them again exactly as `lifecycleArrowReader(reader)` does.
2054
- */
2055
- messages(source: JsBatchReader): FixMessages
2056
- /**
2057
- * A stream of batches of FIX rows as batches under one message field.
2058
- *
2059
- * The Arrow twin of `formatMessages`, and the last stage of the pipeline
2060
- * a capture runs. Each row is read back as the message it holds and laid
2061
- * under `field` by the one column rule, so a capture's own column
2062
- * `field` names is stated from the cell each message carries. The
2063
- * source is consumed.
2064
- */
2065
- formatArrowReader(source: JsBatchReader, field: Field): JsBatchReader
2066
- /**
2067
- * Writes a stream of batches of FIX rows back to the wire, answering the
2068
- * count of lines.
2069
- *
2070
- * The encode direction of the same exchange: each row is the message
2071
- * `messages` reads out of it, written as `intoBytes` with the codec's
2072
- * `separator` - `SOH` when none is pinned - then a newline, into `sink`,
2073
- * anything with `write(chunk: Uint8Array)`. Each message renders what it
2074
- * holds: the wire the row's `entries` restores, the facts' statements
2075
- * at their places, and a message stating no `MsgType(35)` laid out by its
2076
- * category. One batch is held at a time, and the source is consumed.
2077
- */
2078
- writeArrowReader(source: BatchReader, sink: { write(chunk: Uint8Array): unknown }): number
2079
- /** A cheap clone: the dictionary and the pins are shared. */
2080
- clone(): FixCodec
2081
- /** How this codec renders: the dictionary it reads against. */
2082
- toString(): string
2083
- }
2084
- export type JsFixCodec = FixCodec
2085
-
2086
1829
  /**
2087
1830
  * The fields of a registry: the scalars in ascending identifier order, then
2088
1831
  * the components and the groups.
@@ -2108,30 +1851,6 @@ export declare class FixFieldIterator {
2108
1851
  }
2109
1852
  export type JsFixFieldIterator = FixFieldIterator
2110
1853
 
2111
- /**
2112
- * A stream of messages, one at a time: the core's `MarketMessages`.
2113
- *
2114
- * Every stage of the codec answers one of these - one line's messages, a
2115
- * stream of lines parsed, records parsed, messages walked, a batch read
2116
- * back - so a message stream has one shape at this boundary whatever made
2117
- * it. Nothing is collected: the core stream is the stream, and a
2118
- * JavaScript iterable behind it is pulled one item at a time. What a
2119
- * line or a message states that cannot stand is passed over with a warning
2120
- * on standard error, never thrown; a failure in the iterable behind the
2121
- * stream throws and ends it. The loader supplies `Symbol.iterator` over
2122
- * `next`.
2123
- */
2124
- export declare class FixMessages {
2125
- /**
2126
- * Advance the stream: the next message, or `null` at its end.
2127
- *
2128
- * A line the reader passed over is no item; a failure behind the stream
2129
- * throws once, in place of the end.
2130
- */
2131
- next(): IteratorResult<MarketMessage>
2132
- }
2133
- export type JsFixMessages = FixMessages
2134
-
2135
1854
  /**
2136
1855
  * FIX field definitions resolved by identifier, by tag, by name, or by dotted
2137
1856
  * path.
@@ -2181,11 +1900,13 @@ export declare class FixRegistry {
2181
1900
  * The registry the process environment names, loaded on the first call.
2182
1901
  *
2183
1902
  * The order is the core's: a registry installed by `installEnv`, then the
2184
- * folder `YGGIO_FIX_REGISTRY` names, then `~/.config/fix` when it
2185
- * exists, then a new registry holding the crate's own definitions and the
2186
- * two seeded clocks alone. Only the third step treats absence as that
2187
- * default; every other failure throws with the native message and the
2188
- * default stays unresolved, so the next call retries.
1903
+ * folder `YGGIO_FIX_REGISTRY` names, then `~/.config/fix`, then the
1904
+ * dictionary the crate ships, its embedded FIX Latest seed
1905
+ * (`config/seeds/fix.parquet`). A folder of the second or third step that
1906
+ * does not exist answers that seed too and writes nothing; one that
1907
+ * exists loads as a store, an empty one as the empty registry. Every
1908
+ * other failure throws with the native message and the default stays
1909
+ * unresolved, so the next call retries.
2189
1910
  */
2190
1911
  static fromEnv(): FixRegistry
2191
1912
  /**
@@ -2205,8 +1926,13 @@ export declare class FixRegistry {
2205
1926
  /**
2206
1927
  * Load the fields, components, and groups categories.
2207
1928
  *
2208
- * `location` is an `IOBase` handle, a `Url`, or the string naming one, run
2209
- * through the coercion every folder-shaped entry point uses. A folder that
1929
+ * `location` is an `IOBase` handle, a `Url`, or the string naming one,
1930
+ * built as every located door builds it: the core's `LocalPath` decides
1931
+ * leaf or folder, so a file on this machine that is there is read as the
1932
+ * one table of dictionary rows it holds - the shipped seed,
1933
+ * `config/seeds/fix.parquet`, is one - and a folder that is there, or a
1934
+ * path that is not, is the folder of a store; an `http(s)` URL answers a
1935
+ * leaf, so an HTTP store is not loaded from a bare URL. A folder that
2210
1936
  * is not there loads as a new registry - the crate's own fields and the
2211
1937
  * two seeded clocks, nothing else - and is not created; a stored copy of
2212
1938
  * one of the crate's own fields, in its tag block from 65000, is read
@@ -2534,6 +2260,20 @@ export declare class FixRegistry {
2534
2260
  * under a cursor into them. The loader wires `Symbol.iterator` over this.
2535
2261
  */
2536
2262
  keys(): Generator<Field>
2263
+ /**
2264
+ * The plugin dictionary's rows (`FixPlugins::into_serie`): one `Serie`
2265
+ * under `fixPluginField()`, in id order - what a store keeps as
2266
+ * `plugins.json`. A copy: a later mutation of the registry leaves it
2267
+ * as it was answered.
2268
+ */
2269
+ plugins(): JsSerie
2270
+ /**
2271
+ * The row of the plugin `code` names (`FixPlugins::rows_of`): its
2272
+ * name, an alias or its cross code (`plugincode`), as a one-row `Serie`
2273
+ * under `fixPluginField()`; `null` where the dictionary holds none. A
2274
+ * direct lookup, not a walk of `plugins()`.
2275
+ */
2276
+ plugin(code: string): JsSerie | null
2537
2277
  /** Whether two registries hold the same fields, in identifier order. */
2538
2278
  equals(other: FixRegistry): boolean
2539
2279
  /** Deterministic hash bits over all categories. */
@@ -2829,11 +2569,11 @@ export declare class IcebergOptions {
2829
2569
  * Throws the core's typed error for a value it refuses, naming it.
2830
2570
  */
2831
2571
  constructor(options?: IcebergOptionsInput | undefined | null)
2832
- /** How many beaten commit attempts are retried. Default: 4. */
2572
+ /** How many beaten commit attempts are retried. Default: 20. */
2833
2573
  get commitRetries(): number
2834
2574
  /** Set how many beaten commit attempts are retried. */
2835
2575
  set commitRetries(retries: number)
2836
- /** The first commit retry wait, in milliseconds. Default: 100. */
2576
+ /** The first commit retry wait, in milliseconds. Default: 200. */
2837
2577
  get commitMinBackoffMs(): number
2838
2578
  /**
2839
2579
  * Set the first commit retry wait, in milliseconds.
@@ -2843,7 +2583,7 @@ export declare class IcebergOptions {
2843
2583
  * Throws when the wait is not a whole non-negative number of at most 2^53.
2844
2584
  */
2845
2585
  set commitMinBackoffMs(waitMs: number)
2846
- /** The largest commit retry wait, in milliseconds. Default: 60000. */
2586
+ /** The largest commit retry wait, in milliseconds. Default: 4000. */
2847
2587
  get commitMaxBackoffMs(): number
2848
2588
  /**
2849
2589
  * Set the largest commit retry wait, in milliseconds.
@@ -2853,7 +2593,7 @@ export declare class IcebergOptions {
2853
2593
  * Throws when the wait is not a whole non-negative number of at most 2^53.
2854
2594
  */
2855
2595
  set commitMaxBackoffMs(waitMs: number)
2856
- /** The total commit retry-delay budget, in milliseconds. Default: 1800000. */
2596
+ /** The total commit retry-delay budget, in milliseconds. Default: 60000. */
2857
2597
  get commitTotalTimeoutMs(): number
2858
2598
  /**
2859
2599
  * Set the total commit retry-delay budget, in milliseconds.
@@ -2895,9 +2635,10 @@ export declare class IcebergOptions {
2895
2635
  set readParallelMinFiles(files: number)
2896
2636
  /**
2897
2637
  * How many partition groups a commit writes at once. Default: the
2898
- * resolved `readParallelism`; 1 writes them one after another. The
2899
- * manifest lists a commit's files in partition-group order whatever the
2900
- * value.
2638
+ * resolved `readParallelism` capped at the writers the process memory
2639
+ * budget holds, 288 MiB each; a stated count is never capped; 1 writes
2640
+ * them one after another. The manifest lists a commit's files in
2641
+ * partition-group order whatever the value.
2901
2642
  */
2902
2643
  get writeParallelism(): number
2903
2644
  /**
@@ -2911,7 +2652,7 @@ export declare class IcebergOptions {
2911
2652
  set writeParallelism(threads: number)
2912
2653
  /**
2913
2654
  * How many partitions an append, an overwrite or a compaction holds
2914
- * open at once. Default: 128. Past it, the open partition of the
2655
+ * open at once. Default: 8. Past it, the open partition of the
2915
2656
  * lowest tuple closes and its files are written while the source is
2916
2657
  * still read, so a source in partition order is written as it arrives
2917
2658
  * and never held whole; a partition arriving again after it closed is
@@ -2930,8 +2671,11 @@ export declare class IcebergOptions {
2930
2671
  set maxOpenPartitions(partitions: number)
2931
2672
  /**
2932
2673
  * Where a commit stages its files before uploading them: `"off"`, or
2933
- * a local folder URL. `null` - the default - is the table's own: the
2934
- * temporary folder for a remote root, off for a local one.
2674
+ * a local folder URL. `null` - the default - is the table's own,
2675
+ * decided per file: off for a file of bare local storage, the temporary
2676
+ * folder for any other - an object store's, a bridged filesystem's, an
2677
+ * HTTP origin's - but a data file whose handle streams its own whole
2678
+ * write, as a bridged filesystem's does.
2935
2679
  */
2936
2680
  get writeStaging(): string | null
2937
2681
  /**
@@ -4277,7 +4021,8 @@ export type JsManifestFile = ManifestFile
4277
4021
  export declare class MarketMessage {
4278
4022
  /**
4279
4023
  * A FIX record - a struct root and its row - read as the parse reads
4280
- * one, under `registry`, the process default when none is named.
4024
+ * one, under `options`, `MarketMessagesOptions.fromEnv()` when none
4025
+ * are given.
4281
4026
  *
4282
4027
  * The loader widens `value`: anything `Scalar.fromJs` reads becomes the
4283
4028
  * native value first, and the core alone validates and canonicalizes it
@@ -4293,29 +4038,80 @@ export declare class MarketMessage {
4293
4038
  * no execution clock that instant too. What `OrigSendingTime(122)` says
4294
4039
  * is the lifecycle's to read. The identity is then settled.
4295
4040
  */
4296
- static fromFixRecord(field: Field, value: JsScalar, registry?: FixRegistry | undefined | null): MarketMessage
4041
+ static fromFixRecord(field: Field, value: JsScalar, options?: JsMarketMessagesOptions | undefined | null): MarketMessage
4297
4042
  /**
4298
4043
  * The message a row holds: the inverse of `intoRow`.
4299
4044
  *
4300
4045
  * `schema` is the row's root - the message row `MarketMessage.field()`
4301
4046
  * lays out, or a batch reader's `field` - and `row` the row under it,
4302
4047
  * which the loader widens from whatever `Scalar.fromJs` reads. The row
4303
- * is one row of `FixCodec.messages`: each column binds as a lookup
4048
+ * is one row of `MarketMessages.fromArrowReader`: each column binds as a lookup
4304
4049
  * binds its name - a fact, a statement, an entry - the content is
4305
4050
  * rebuilt from the `entries` column, each entry typed through the
4306
4051
  * dictionary exactly
4307
4052
  * as the parse types a pair, so `intoBytes` re-emits the line the row
4308
4053
  * was read from, and every column nothing binds is carried under its
4309
4054
  * name, as `carried` answers. Nothing is parsed again and no clock is
4310
- * read. The process default is the registry when none is named.
4055
+ * read. The row is read under `options`,
4056
+ * `MarketMessagesOptions.fromEnv()` when none are given.
4311
4057
  */
4312
- static fromRow(schema: Field, row: JsScalar, registry?: FixRegistry | undefined | null): MarketMessage
4058
+ static fromRow(schema: Field, row: JsScalar, options?: JsMarketMessagesOptions | undefined | null): MarketMessage
4059
+ /**
4060
+ * The one message a captured line states, whatever it is wrapped in -
4061
+ * its format sniffed - under `options`, `MarketMessagesOptions.fromEnv()`
4062
+ * when none are given. A line stating no message, and a line carrying
4063
+ * a second frame, throws: `MarketMessages.fromLines` reads a line's
4064
+ * every message.
4065
+ */
4066
+ static fromLine(row: Buffer, options?: JsMarketMessagesOptions | undefined | null): MarketMessage
4067
+ /**
4068
+ * The one message a line a text reader answered states, under
4069
+ * `options`, `MarketMessagesOptions.fromEnv()` when none are given.
4070
+ *
4071
+ * The line's body is the bytes read, and its row-header captures state
4072
+ * the rest - the plugin that logged it, the version, and every field a
4073
+ * capture's name reaches. A `timestamp` capture is context and stamps
4074
+ * nothing; the line's own clock does. Its `mtime` - an `mtime` capture,
4075
+ * else its handle's modification time - is the message's `technicaltimestamp`,
4076
+ * and the sending clock of a message stating none: `SendingTime` is the
4077
+ * message's own, else a capture reaching that field, else the line's
4078
+ * `mtime`, else the options' `defaultSendingTime`, else the Unix epoch,
4079
+ * and the instant `markettimestamp` is the stated one, else the first
4080
+ * plausible of its evidence clocks, its stated `SendingTime` and its log
4081
+ * line's clock, within the one-day skew bound of the log line. A clock
4082
+ * the parse supplied is never the message's own: neither the wire nor
4083
+ * the row's `sendingtime` column states it. The options' `captureNames`
4084
+ * decide which capture is which, once for the whole run, because a
4085
+ * line answers its captures by position. A line carrying a second
4086
+ * frame throws.
4087
+ */
4088
+ static fromTextLine(line: TextLine, options?: MarketMessagesOptions | undefined | null): MarketMessage
4089
+ /**
4090
+ * One numeric FIX frame, read by the pairs it states, under `options`,
4091
+ * `MarketMessagesOptions.fromEnv()` when none are given.
4092
+ */
4093
+ static fromFixMessage(body: Buffer, options?: JsMarketMessagesOptions | undefined | null): MarketMessage
4094
+ /**
4095
+ * One bridge frame, whose keys are names rather than tags, under
4096
+ * `options`, `MarketMessagesOptions.fromEnv()` when none are given.
4097
+ */
4098
+ static fromUllinkLine(body: Buffer, options?: JsMarketMessagesOptions | undefined | null): MarketMessage
4099
+ /**
4100
+ * One FIXML message, whose fields are XML attributes, under `options`,
4101
+ * `MarketMessagesOptions.fromEnv()` when none are given.
4102
+ */
4103
+ static fromFixmlMessage(body: Buffer, options?: JsMarketMessagesOptions | undefined | null): MarketMessage
4104
+ /**
4105
+ * Pairs a caller already holds, in the order they arrived, under
4106
+ * `options`, `MarketMessagesOptions.fromEnv()` when none are given.
4107
+ */
4108
+ static fromPairs(pairs: Array<[string, string]>, options?: MarketMessagesOptions | undefined | null): MarketMessage
4313
4109
  /**
4314
4110
  * The one message row, `fixmsg`: the element, event, market,
4315
4111
  * operation, source and session columns, the two holders
4316
- * `trdregtimestamps` and `parties`, the identifier columns, then
4317
- * `metadata` and `entries` - every stated entry no column of the row
4318
- * holds.
4112
+ * `trdregtimestamps` and `parties`, then `metadata` and `entries` -
4113
+ * every stated entry no column of the row holds, an identifier's
4114
+ * statement among them.
4319
4115
  */
4320
4116
  static field(): Field
4321
4117
  /** The registry this message's entries were typed by, sharing it. */
@@ -4356,16 +4152,17 @@ export declare class MarketMessage {
4356
4152
  get metadata(): Record<string, string>
4357
4153
  /**
4358
4154
  * The business category the message's type files under, as the
4359
- * `marketdatakind` member's stored name - `ORDR`, `QUOT`, `EXEC`,
4360
- * `TRAD`, `BOOK` - and `UKNW` where it files none.
4155
+ * `marketdatakind` member's stored name - `OPER` (an order, a quote or
4156
+ * an execution, which `marketdatatype` tells apart), `TRAD`, `BOOK` -
4157
+ * and `UKNW` where it files none.
4361
4158
  */
4362
4159
  get marketdatakind(): string
4363
4160
  /**
4364
4161
  * The strike price of the option the message identifies - its market
4365
- * fact `strikepx`, derived from `StrikePrice(202)` - as decimal text, or
4162
+ * fact `strikeprice`, derived from `StrikePrice(202)` - as decimal text, or
4366
4163
  * `null`.
4367
4164
  */
4368
- get strikepx(): string | null
4165
+ get strikeprice(): string | null
4369
4166
  /**
4370
4167
  * This message's own `UUIDv7` identity, ordered by millisecond and
4371
4168
  * sequence with a content payload seeded by its cross hash, as
@@ -4379,9 +4176,10 @@ export declare class MarketMessage {
4379
4176
  get crossuuid(): string
4380
4177
  /**
4381
4178
  * The code the chain is named by, stored as `{kind}:{side}:{base}` - the
4382
- * `MarketDataKind` code, the `Side` code of a sided kind (`0` for any
4383
- * other) and the identifier the message names, so a buy order `O-1` is
4384
- * `10:1:O-1` - or empty where it names none.
4179
+ * `MarketDataKind` code, the `Side` code of a sided message - an
4180
+ * operation its type makes no quote - (`0` for any other) and the
4181
+ * identifier the message names, so a buy order `O-1` is `10:1:O-1` and
4182
+ * a quote `Q-1` `10:0:Q-1` - or empty where it names none.
4385
4183
  */
4386
4184
  get crosscode(): string
4387
4185
  /** The XXH3-64 over everything this message says. */
@@ -4392,7 +4190,7 @@ export declare class MarketMessage {
4392
4190
  * When the operation the message states happened - its transaction
4393
4191
  * instant: nanoseconds since the Unix epoch, UTC.
4394
4192
  */
4395
- get transunix(): bigint
4193
+ get markettimestamp(): bigint
4396
4194
  /**
4397
4195
  * The order state the message reached, ranked: `UNKNOWN` where it
4398
4196
  * states none.
@@ -4404,11 +4202,11 @@ export declare class MarketMessage {
4404
4202
  * instant between, one more for each next; once walked, the place its
4405
4203
  * content took there.
4406
4204
  */
4407
- get seqnum(): number
4205
+ get sequencenumber(): number
4408
4206
  /** The identity of the message this one follows, or `null`. */
4409
- get prevuuid(): string | null
4207
+ get previousuuid(): string | null
4410
4208
  /** When the order this message belongs to was created, where known. */
4411
- get creaunix(): bigint | null
4209
+ get creationtimestamp(): bigint | null
4412
4210
  /**
4413
4211
  * The digits after the second `TransactTime(60)` was stated with - 0,
4414
4212
  * 3, 6 or 9 - the row's `clockprecision`; `null` where it states none.
@@ -4435,28 +4233,28 @@ export declare class MarketMessage {
4435
4233
  /** The earliest `LastTrade` stamp. */
4436
4234
  get lasttradetime(): bigint | null
4437
4235
  /** The latest execution instant the lifecycle reached, where known. */
4438
- get execunix(): bigint | null
4236
+ get lastexecutiontimestamp(): bigint | null
4439
4237
  /**
4440
4238
  * When the message crossed the wire - its carrier's clock, else its
4441
4239
  * stated `SendingTime` - where stated.
4442
4240
  */
4443
- get techunix(): bigint | null
4241
+ get technicaltimestamp(): bigint | null
4444
4242
  /** When the order expires, where it has an expiry. */
4445
- get exprunix(): bigint | null
4243
+ get expirytimestamp(): bigint | null
4446
4244
  /** When the message this one follows happened, where it follows one. */
4447
- get prevtransunix(): bigint | null
4245
+ get previousmarkettimestamp(): bigint | null
4448
4246
  /**
4449
4247
  * The grid step a walk read this message as the snapshot of, where one
4450
4248
  * did.
4451
4249
  */
4452
- get snapunix(): bigint | null
4250
+ get snapshottimestamp(): bigint | null
4453
4251
  /**
4454
4252
  * The sorted unique identities of the elements this one was read from:
4455
4253
  * the text line it was parsed out of, and for a message split off
4456
4254
  * another that message's identity beside its sources; none for one
4457
4255
  * parsed from raw bytes. Provenance, never its chain: no walk moves it.
4458
4256
  */
4459
- get srcuuids(): Array<string>
4257
+ get sourceuuids(): Array<string>
4460
4258
  /**
4461
4259
  * The capture's own cells the message carries, each under the column
4462
4260
  * it was read from: where the line was read from, its place in the
@@ -4494,28 +4292,28 @@ export declare class MarketMessage {
4494
4292
  * The bid size the message states, `BidSize(134)`, as decimal text, or
4495
4293
  * `null`.
4496
4294
  */
4497
- get bidqty(): string | null
4295
+ get bidsize(): string | null
4498
4296
  /**
4499
4297
  * The currency the bid is stated in: a stated `BidCurrency`, else the
4500
4298
  * message's currency where it states a bid; `null` otherwise.
4501
4299
  */
4502
- get bidccy(): string | null
4300
+ get bidcurrency(): string | null
4503
4301
  /**
4504
4302
  * The offer price the message states, `OfferPx(133)`, as decimal text, or
4505
4303
  * `null`.
4506
4304
  */
4507
- get askpx(): string | null
4305
+ get offerpx(): string | null
4508
4306
  /**
4509
4307
  * The offer size the message states, `OfferSize(135)`, as decimal text,
4510
4308
  * or `null`.
4511
4309
  */
4512
- get askqty(): string | null
4310
+ get offersize(): string | null
4513
4311
  /**
4514
4312
  * The currency the offer is stated in: a stated `AskCurrency` or
4515
4313
  * `OfferCurrency`, else the message's currency where it states an offer;
4516
4314
  * `null` otherwise.
4517
4315
  */
4518
- get askccy(): string | null
4316
+ get offercurrency(): string | null
4519
4317
  /**
4520
4318
  * The names the operation goes by, each typed by the field that
4521
4319
  * stated it - `orderid`, `clordid`, `execid`, `quoteid`, `tradeid` and
@@ -4549,13 +4347,13 @@ export declare class MarketMessage {
4549
4347
  * The unit the quantity is counted in, `UnitOfMeasure(996)`; empty
4550
4348
  * where none is stated.
4551
4349
  */
4552
- get unit(): string
4350
+ get unitofmeasure(): string
4553
4351
  /**
4554
4352
  * The instrument's minimum tradable quantity - its board lot - where the
4555
4353
  * message (`RoundLot(561)`) or its product row states one, as decimal
4556
4354
  * text; `null` where neither does, never a multiplier.
4557
4355
  */
4558
- get lotsize(): string | null
4356
+ get roundlot(): string | null
4559
4357
  /**
4560
4358
  * The type of its kind the message is, as the `marketdatatype` member's
4561
4359
  * stored name: `UKNW` where none.
@@ -4570,15 +4368,15 @@ export declare class MarketMessage {
4570
4368
  get currency(): string
4571
4369
  /**
4572
4370
  * The currency the product originates in, as the `ccy` code it is:
4573
- * the crate field `origccy` the message states, or what a registry
4371
+ * the crate field `origincurrency` the message states, or what a registry
4574
4372
  * filled; `null` where neither did, never defaulted.
4575
4373
  */
4576
- get origccy(): string | null
4374
+ get origincurrency(): string | null
4577
4375
  /**
4578
- * The origin currency read with its default: `origccy` where held,
4376
+ * The origin currency read with its default: `origincurrency` where held,
4579
4377
  * else `currency` - `XXX` only where neither is stated.
4580
4378
  */
4581
- get originCurrency(): string
4379
+ get originOrCurrency(): string
4582
4380
  /**
4583
4381
  * The price the message last traded at, as decimal text, or `null`.
4584
4382
  * FIX's own `LastPx(31)`.
@@ -4586,18 +4384,14 @@ export declare class MarketMessage {
4586
4384
  get lastpx(): string | null
4587
4385
  /** The quantity it last traded, `LastQty(32)`, or `null`. */
4588
4386
  get lastqty(): string | null
4589
- /** FIX's own `LastSpotRate(194)`, the spot rate of the last price, as decimal text, or `null`. */
4590
- get lastspotrate(): string | null
4591
- /** FIX's own `LastForwardPoints(195)`, the forward points of the last price, as decimal text, or `null`. */
4592
- get lastforwardpoints(): string | null
4593
4387
  /** The bid leg's spot rate, `BidSpotRate(188)`, as decimal text, or `null`. */
4594
4388
  get bidspotrate(): string | null
4595
4389
  /** The bid leg's forward points, `BidForwardPoints(189)`, as decimal text, or `null`. */
4596
4390
  get bidforwardpoints(): string | null
4597
4391
  /** The ask leg's spot rate, `OfferSpotRate(190)`, as decimal text, or `null`. */
4598
- get askspotrate(): string | null
4392
+ get offerspotrate(): string | null
4599
4393
  /** The ask leg's forward points, `OfferForwardPoints(191)`, as decimal text, or `null`. */
4600
- get askforwardpoints(): string | null
4394
+ get offerforwardpoints(): string | null
4601
4395
  /** The price it averaged, `AvgPx(6)`, or `null`. */
4602
4396
  get avgpx(): string | null
4603
4397
  /** How much of its quantity is done, `CumQty(14)`, or `null`. */
@@ -4608,16 +4402,16 @@ export declare class MarketMessage {
4608
4402
  * The price stated before this message - its own closing price, else
4609
4403
  * what the statement it follows settled on, which a walk fills.
4610
4404
  */
4611
- get prevpx(): string | null
4405
+ get previousprice(): string | null
4612
4406
  /** The quantity that statement settled on, or `null`. */
4613
- get prevqty(): string | null
4407
+ get previousquantity(): string | null
4614
4408
  /** The spot part of an FX forward price, as decimal text, or `null`. */
4615
- get spotrate(): string | null
4409
+ get lastspotrate(): string | null
4616
4410
  /**
4617
4411
  * The forward points of an FX forward price, as decimal text, or
4618
4412
  * `null`.
4619
4413
  */
4620
- get forwardpoints(): string | null
4414
+ get lastforwardpoints(): string | null
4621
4415
  /**
4622
4416
  * How long the message stands, `TimeInForce(59)`, as the `timeinforce`
4623
4417
  * member's stored name - `DAY`, `GTC`, a venue's own value `OTHER` -
@@ -4628,7 +4422,7 @@ export declare class MarketMessage {
4628
4422
  * The quantity the order asked for, as decimal text, or `null` where
4629
4423
  * none is stated.
4630
4424
  */
4631
- get ordqty(): string | null
4425
+ get orderqty(): string | null
4632
4426
  /**
4633
4427
  * Whether the product could be traded when the message was sent, or
4634
4428
  * `null` where the market said nothing either way - which is not the
@@ -4639,7 +4433,7 @@ export declare class MarketMessage {
4639
4433
  * The instrument's classification, read off `CFICode(461)` and what
4640
4434
  * the message says about the security, or `null` where nothing does.
4641
4435
  */
4642
- get cfi(): string | null
4436
+ get cficode(): string | null
4643
4437
  /**
4644
4438
  * The market, read off `SecurityExchange(207)`, `ExDestination(100)` or
4645
4439
  * `LastMkt(30)`, the first that names an ISO 10383 MIC.
@@ -4756,13 +4550,27 @@ export declare class MarketMessage {
4756
4550
  * nothing at a column answers null there rather than shifting its
4757
4551
  * neighbours; `entries` closes the row with the entries no other
4758
4552
  * column holds, and the capture's own columns state the cells the
4759
- * message carries. The row is the one `FixCodec.formatMessages` lays.
4553
+ * message carries. The row is the one `MarketMessages.intoSerie` lays.
4760
4554
  *
4761
4555
  * A value a column will not hold is that column's null and stays in
4762
4556
  * `entries`; a column that cannot be null and that nothing binds
4763
4557
  * throws, naming it. No clock is read.
4764
4558
  */
4765
4559
  intoRow(schema: Field): JsScalar
4560
+ /**
4561
+ * Where each value this message holds came from, as rows under the
4562
+ * explanation row - `fact`, `source`, `rule`, `from`, `note` - in the
4563
+ * row's column order, computed on demand off what the message holds:
4564
+ * its `markettimestamp` beside the clock that dated it; every fact and its
4565
+ * metadata whose source is not unset - stated, a FIX derivation or
4566
+ * default by the tag the fact binds (`der.<tag>`, `def.<tag>`), a fill
4567
+ * by the underlying row or the rates, a carry from its previous
4568
+ * statement, an implication, a plugin version's stamp - each by the
4569
+ * rule id that filled it; every entry by its origin; then every
4570
+ * anomaly, its reason as the note. A message read back off its row
4571
+ * explains each fact its `factsources` names as the live message did.
4572
+ */
4573
+ explain(): JsSerie
4766
4574
  /**
4767
4575
  * Re-emit this message on the wire, separated by `separator`: the
4768
4576
  * header, the facts' statements and the entries, each at its place,
@@ -4780,22 +4588,328 @@ export declare class MarketMessage {
4780
4588
  * A separator that is no byte, and a value holding a control byte,
4781
4589
  * throw.
4782
4590
  */
4783
- intoText(separator?: string | undefined | null): string
4784
- /** Whether two messages carry the same facts and entries. */
4785
- equals(other: MarketMessage): boolean
4786
- /** Deterministic hash bits over the facts and the entries. */
4787
- stableHash(): bigint
4788
- /** A cheap clone: the entries are shared, the registry link kept. */
4789
- clone(): MarketMessage
4591
+ intoText(separator?: string | undefined | null): string
4592
+ /** Whether two messages carry the same facts and entries. */
4593
+ equals(other: MarketMessage): boolean
4594
+ /** Deterministic hash bits over the facts and the entries. */
4595
+ stableHash(): bigint
4596
+ /** A cheap clone: the entries are shared, the registry link kept. */
4597
+ clone(): MarketMessage
4598
+ /**
4599
+ * A one-line summary naming the message type its `MsgType(35)` entry
4600
+ * states and how many entries it holds.
4601
+ */
4602
+ toString(): string
4603
+ /** The entries' root schema document and row document. */
4604
+ toJSON(): any
4605
+ }
4606
+ export type JsMarketMessage = MarketMessage
4607
+
4608
+ /**
4609
+ * A handler over a stream of messages: the core's `MarketMessages`.
4610
+ *
4611
+ * `new MarketMessages(options?)` is the idle handler: the options it reads
4612
+ * under - `options`, else `MarketMessagesOptions.fromEnv()` - over no
4613
+ * stream. A source answers a new handler over its stream and leaves this
4614
+ * one idle, so one handler opens many: `fromLines`, `fromTextLines`,
4615
+ * `fromItems`, `fromArrowReader`, `fromTextArrowReader`. A stage answers
4616
+ * the handler over what it makes of the stream - `intoLifecycle`,
4617
+ * `intoLineage` - and a sink drains it - `intoArrowReader`, `intoSerie`,
4618
+ * `intoWriter`; each takes the stream once, and a second take throws
4619
+ * naming the first. Nothing is collected unless a stage says so: the core
4620
+ * stream is the stream, and a JavaScript iterable behind it is pulled one
4621
+ * item at a time. What a line or a message states that cannot stand is
4622
+ * passed over with a warning on standard error, never thrown; a failure
4623
+ * of the iterable behind a source ends the stream after the messages
4624
+ * before it, and `next` throws it as itself. The loader supplies
4625
+ * `Symbol.iterator` over `next`.
4626
+ */
4627
+ export declare class MarketMessages {
4628
+ /**
4629
+ * An idle handler over `options`, else over
4630
+ * `MarketMessagesOptions.fromEnv()`: what every source opens from.
4631
+ */
4632
+ constructor(options?: JsMarketMessagesOptions | undefined | null)
4633
+ /**
4634
+ * The messages a stream of batches of rows holds, lazily, one batch
4635
+ * held at a time: the rows landed under `field`, else under the
4636
+ * reader's own root, each row one message rebuilt with no line parsed
4637
+ * again - its own cells carried, so a column no fact, statement or
4638
+ * entry reads travels with the message it made and a sink states it
4639
+ * again at its place. The source is consumed.
4640
+ */
4641
+ fromArrowReader(source: JsBatchReader, field?: Field | undefined | null): MarketMessages
4642
+ /**
4643
+ * The messages a stream of batches of capture rows states: each row
4644
+ * read as a line, its body the payload column and its `markettimestamp`
4645
+ * cell the line's clock - the messages' `technicaltimestamp` and the sending
4646
+ * clock of one stating none - and the capture's own columns carried
4647
+ * beside the fixed FIX columns, so a sink states them again. The
4648
+ * source is consumed.
4649
+ */
4650
+ fromTextArrowReader(source: JsBatchReader): MarketMessages
4651
+ /**
4652
+ * The one walk over events, as a stage: the messages collected and
4653
+ * sorted by instant - read as they come, one epoch hour held at a
4654
+ * time, where the options' `sortedLifecycle` states they arrive in
4655
+ * instant order - every one but a batch container and the session
4656
+ * administration stated through `withPrevious` as the one after the
4657
+ * version its chain - its market data kind and cross hash code -
4658
+ * holds, carrying the predecessor's `previousuuid`, `previousmarkettimestamp` and
4659
+ * `previousstate`, and yielded only where its content code or state moved:
4660
+ * a copy folds into the held version. A message no held version
4661
+ * precedes is answered as it came. One whose sending clock the parse
4662
+ * supplied rather than read is dated by the `TransactTime(60)` it
4663
+ * states. Takes the stream.
4664
+ */
4665
+ intoLifecycle(): MarketMessages
4666
+ /**
4667
+ * The path each event took, as a stage: the observations grouped by
4668
+ * event - `msgeventkey`, else the observation's own `crossuuid` - and
4669
+ * ordered by `technicaltimestamp`, else `markettimestamp`, then stream order; one hop
4670
+ * per observation, a message row whose `lastplugincode` is the node it
4671
+ * came from, `plugincode` the node it reached, `previousuuid` the hop
4672
+ * before it, `sequencenumber` its index and `crossuuid` the event. A node is
4673
+ * the observation's plugin, else its session, else its
4674
+ * `SenderCompID`; a plain FIX message is `SenderCompID` to
4675
+ * `TargetCompID`. Collects the stream. Takes the stream.
4676
+ */
4677
+ intoLineage(): MarketMessages
4678
+ /**
4679
+ * The stream as batches of rows under `field`, else under the stream's
4680
+ * own root: each message one row, every column read by its fact, its
4681
+ * tag or its name, batches closing on the options' `batchRowSize`
4682
+ * rows or `batchByteSize` laid bytes, whichever a batch reaches first.
4683
+ * A failure behind the stream is the reader's error, thrown by the
4684
+ * batch it would have landed in. Takes the stream.
4685
+ */
4686
+ intoArrowReader(field?: Field | undefined | null): JsBatchReader
4687
+ /**
4688
+ * The stream's messages as rows, as a `Serie` read lazily: with no
4689
+ * `field`, each message one row of the stream's own root; with one -
4690
+ * a venue's own message type, `MarketMessage.field()`, any Struct root
4691
+ * a caller built - each laid under it by the one column rule, so a
4692
+ * column the message does not state is null. A message a row will
4693
+ * not hold is passed over with a warning. Takes the stream.
4694
+ */
4695
+ intoSerie(field?: Field | undefined | null): JsSerie
4696
+ /**
4697
+ * Writes each message back to the wire into `sink` - anything with
4698
+ * `write(chunk: Uint8Array)` - one per line: `intoBytes` with the
4699
+ * options' `separator`, `SOH` when none is pinned, then a newline.
4700
+ * Each message renders what it holds: the wire a row's `entries`
4701
+ * restores, the facts' statements at their places, and a message
4702
+ * stating no `MsgType(35)` laid out by its category. Answers the count
4703
+ * of lines. One message is held at a time. Takes the stream.
4704
+ */
4705
+ intoWriter(sink: { write(chunk: Uint8Array): unknown }): number
4706
+ /** The options every message is read under, shared. */
4707
+ get options(): JsMarketMessagesOptions
4708
+ /**
4709
+ * Advance the stream: the next message, or `null` at its end.
4710
+ *
4711
+ * A line the reader passed over is no item; a failure behind the
4712
+ * stream throws once, in place of the end. A stream a stage or a sink
4713
+ * took throws naming it.
4714
+ */
4715
+ next(): IteratorResult<MarketMessage>
4716
+ }
4717
+ export type JsMarketMessages = MarketMessages
4718
+
4719
+ /**
4720
+ * The options a market message stream reads under: one dictionary and
4721
+ * every pin a parse, a walk and a sink read - the core's
4722
+ * `MarketMessagesOptions`, shared.
4723
+ *
4724
+ * Options hold no stream: `new MarketMessages(options)` is the handler that
4725
+ * reads under them, and the one-message parses are `MarketMessage` statics
4726
+ * taking them - `fromLine`, `fromTextLine`, `fromFixMessage`,
4727
+ * `fromUllinkLine`, `fromFixmlMessage`, `fromPairs`. Nothing here decides a
4728
+ * version or a separator - it only carries what JavaScript said across.
4729
+ *
4730
+ * Every message read under them is settled as it is parsed: the typed
4731
+ * facts are lifted off the line, a nested `XmlData` is exploded into the
4732
+ * message, deprecated fields are restated to their latest aliases, the
4733
+ * dictionary's native derivations run, the identifier maps and the
4734
+ * security identifiers fill, and the identity is derived. `SendingTime` is
4735
+ * the message's valid tag 52, else a row cell reaching that tag, else the
4736
+ * `mtime` of the `TextLine` it was read out of - on
4737
+ * `MarketMessages.fromTextArrowReader`, the row's `markettimestamp` cell - else
4738
+ * `defaultSendingTime`, else the Unix epoch, the same on every read, and it
4739
+ * goes back on the wire only when the message stated it: a clock the parse
4740
+ * supplied is never the message's own, so the row's `sendingtime` column
4741
+ * states none either. The raw-byte doors read no line, so parsing undated
4742
+ * bytes there without a default sending time is deliberately not
4743
+ * deterministic. A message reporting an execution that states no execution
4744
+ * clock executed at its instant: its `lastexecutiontimestamp` is its `markettimestamp`.
4745
+ */
4746
+ export declare class MarketMessagesOptions {
4747
+ /**
4748
+ * The options over one dictionary, or over the process default.
4749
+ *
4750
+ * Every pin is the core's, spelled once here. `separator` is the byte a
4751
+ * numeric frame splits on where
4752
+ * the line does not say; `payloadColumn` names the batch column a line
4753
+ * is read from; `captureNames` are what a run's row-header captures are
4754
+ * called, in the order a line answers them, which is what lets
4755
+ * `MarketMessage.fromTextLine` read a capture by position rather than by name;
4756
+ * `nullValues` are the spellings that mean nothing was
4757
+ * sent; `direction` is the code of tag 385's set an unmarked line
4758
+ * takes on the batch door, any spelling of one - `"S"`, `"Send"`,
4759
+ * `"R"` - the core's `Send` code when unstated and no pin at all when
4760
+ * empty; `batchByteSize` and `batchRowSize` are the raw bytes and the
4761
+ * rows one Arrow batch targets, the core's 128 MiB and 65,536 rows when
4762
+ * unstated, whichever the batch reaches first; `threads` is how many
4763
+ * workers parsing and row conversion use, the available CPUs when
4764
+ * unstated. Arrow capture parsing keeps at most one input batch per
4765
+ * worker and yields in order; line doors use bounded row chunks.
4766
+ * One thread reads lazily without a pool; zero reads as one;
4767
+ * `includeMsgtypes` and
4768
+ * `excludeMsgtypes` are the message types a parse keeps and refuses,
4769
+ * each read before a frame is built and spelled as a code or a name -
4770
+ * `"0"`, `"Heartbeat"`, `"unknown"` for a line stating no type - the
4771
+ * core refusing `Heartbeat`, `TestRequest` and the untyped line when
4772
+ * unstated and an empty `excludeMsgtypes` keeping every type;
4773
+ * `defaultSendingTime` is the
4774
+ * `SendingTime` an undated message takes when nothing it was read with
4775
+ * dates it either, neither a capture reaching tag 52 nor the `mtime` of
4776
+ * the line it was read out of - a `Scalar` crosses as it is and must
4777
+ * already be `DateTime64(ns, UTC)`, a `Date` is its UTC millisecond
4778
+ * instant restated in nanoseconds, and `null` or absence reads the Unix epoch
4779
+ * per new message.
4780
+ * `snapshotNs` is an epoch-aligned lifecycle snapshot width in exact
4781
+ * nanoseconds; `null`, zero and a negative width disable snapshots;
4782
+ * `sortedLifecycle` states that the messages `intoLifecycle` walks
4783
+ * arrive in instant order, so the walk reads them as they come one
4784
+ * epoch hour at a time rather than collecting and sorting the whole
4785
+ * capture, off when unstated;
4786
+ * `officialTimeDelayMs` is how far off a whole hour of its log line's
4787
+ * clock a stated clock may stand before it is `clock_skew` - the core's
4788
+ * half second when unstated - and dates nothing;
4789
+ * `marketMetadata` is whether a market operation carries its message's
4790
+ * unmapped fields - its parties, `Account(1)` and regulatory trade
4791
+ * identifiers stay its `partyids` and `identifiers` - and lifts the
4792
+ * identifiers among them into the set their type belongs to, on when
4793
+ * unstated; `source` is the id of the dictionary's source the options
4794
+ * read under, resolved once and refused when the catalog holds no
4795
+ * such id.
4796
+ */
4797
+ constructor(registry?: FixRegistry | undefined | null, options?: MarketMessagesOptionsInit | undefined | null)
4798
+ /**
4799
+ * The options over the registry the process environment names,
4800
+ * `FixRegistry.fromEnv()`, pinned by the init the constructor takes.
4801
+ */
4802
+ static fromEnv(options?: MarketMessagesOptionsInit | undefined | null): MarketMessagesOptions
4803
+ /** The dictionary these options resolve against, sharing it. */
4804
+ get registry(): FixRegistry
4805
+ /** The byte a numeric frame splits on, or `null` where the line decides. */
4806
+ get separator(): number | null
4807
+ /** The record column a line is read from. */
4808
+ get payloadColumn(): string
4809
+ /** The spellings that mean nothing was sent. */
4810
+ get nullValues(): Array<string>
4811
+ /**
4812
+ * The code of tag 385's set an unmarked line takes on the batch door,
4813
+ * or `null` where no pin fills silence.
4814
+ */
4815
+ get direction(): string | null
4816
+ /**
4817
+ * The source these options read under, folded: an entry of the
4818
+ * dictionary's sources catalog; `null` where none was named.
4819
+ */
4820
+ get source(): string | null
4821
+ /**
4822
+ * These options sharing `underlyings` across their parses and lifecycles
4823
+ * (`MarketMessagesOptions::with_underlyings`): a parse resolves each
4824
+ * message against it in stream order, creates the rows it names and
4825
+ * the table holds none of, and fills the message from them - its
4826
+ * `underlyingcode` among them - so a search through the same table finds
4827
+ * what the parse wrote.
4828
+ */
4829
+ withUnderlyings(underlyings: JsUnderlyings): MarketMessagesOptions
4830
+ /**
4831
+ * The underlyings these options resolve against, sharing them; `null`
4832
+ * where none was given and each walk starts from the seed.
4833
+ */
4834
+ get underlyings(): JsUnderlyings | null
4835
+ /**
4836
+ * The raw bytes one Arrow batch targets.
4837
+ *
4838
+ * A byte count is a JavaScript number, exact to 2^53, as every count
4839
+ * at this boundary is.
4840
+ */
4841
+ get batchByteSize(): number
4842
+ /** The rows one Arrow batch targets. */
4843
+ get batchRowSize(): number
4844
+ /** The workers parsing and row conversion use; available CPUs by default. */
4845
+ get threads(): number
4846
+ /**
4847
+ * The epoch-aligned lifecycle snapshot width in nanoseconds, or `null`
4848
+ * where snapshots are disabled.
4849
+ */
4850
+ get snapshotNs(): bigint | null
4851
+ /**
4852
+ * These options with their lifecycle snapshot grid set to `snapshotNs`, an
4853
+ * epoch-aligned width in exact nanoseconds: `null`, zero and a negative
4854
+ * width disable snapshots. Every other setting, the dictionary included,
4855
+ * is these options', so a caller's options gain a grid without being
4856
+ * listed again.
4857
+ */
4858
+ withSnapshotNs(snapshotNs: bigint | null): MarketMessagesOptions
4859
+ /**
4860
+ * Whether `intoLifecycle` reads its messages as they come, in instant
4861
+ * order, one epoch hour at a time.
4862
+ */
4863
+ get sortedLifecycle(): boolean
4864
+ /**
4865
+ * These options with their lifecycle pinned to messages arriving in instant
4866
+ * order - a table read hour partition by hour partition, sorted by
4867
+ * `markettimestamp` - when `sorted`: the walk then holds one epoch hour at a
4868
+ * time, sorts within it exactly as a whole capture is sorted, and walks
4869
+ * an hour once a message two hours past it is read; a message dated
4870
+ * before an hour already walked is walked where it arrives. `false`
4871
+ * collects and sorts the whole capture. Every other setting is these
4872
+ * options'.
4873
+ */
4874
+ withSortedLifecycle(sorted: boolean): MarketMessagesOptions
4875
+ /**
4876
+ * How far off a whole hour of its log line's clock a stated clock may
4877
+ * stand before it is `clock_skew`, in milliseconds; it dates nothing.
4878
+ *
4879
+ * A millisecond count is a JavaScript number, exact to 2^53, as every
4880
+ * count at this boundary is.
4881
+ */
4882
+ get officialTimeDelayMs(): number
4883
+ /**
4884
+ * The message types a parse keeps, empty where it keeps every type the
4885
+ * refusals leave.
4886
+ */
4887
+ get includeMsgtypes(): Array<string>
4888
+ /** The message types a parse refuses before it builds a frame. */
4889
+ get excludeMsgtypes(): Array<string>
4890
+ /**
4891
+ * Whether a market operation these options build carries, in its
4892
+ * metadata, what its message states that no typed column reads and no
4893
+ * identifier map of the leaf holds, and lifts the identifiers among
4894
+ * them into the set their type belongs to.
4895
+ */
4896
+ get marketMetadata(): boolean
4790
4897
  /**
4791
- * A one-line summary naming the message type its `MsgType(35)` entry
4792
- * states and how many entries it holds.
4898
+ * The `SendingTime` an undated message takes - one neither its row nor
4899
+ * its line dates - `DateTime64(ns, UTC)`, or `null` where each new
4900
+ * undated message reads the Unix epoch.
4793
4901
  */
4902
+ get defaultSendingTime(): JsScalar | null
4903
+ /** The complete raw message code declared by captured bytes. */
4904
+ static inferMsgtypeBytes(body: Buffer): Buffer | null
4905
+ /** The complete raw message code declared by captured text. */
4906
+ static inferMsgtypeText(body: string): string | null
4907
+ /** A cheap clone: the dictionary and the pins are shared. */
4908
+ clone(): MarketMessagesOptions
4909
+ /** How these options render: the dictionary they read against. */
4794
4910
  toString(): string
4795
- /** The entries' root schema document and row document. */
4796
- toJSON(): any
4797
4911
  }
4798
- export type JsMarketMessage = MarketMessage
4912
+ export type JsMarketMessagesOptions = MarketMessagesOptions
4799
4913
 
4800
4914
  /** A base MIME type plus ordered transparent encodings. */
4801
4915
  export declare class MediaType {
@@ -5413,7 +5527,10 @@ export declare class Plan {
5413
5527
  get columns(): Array<string>
5414
5528
  /** The stored columns a read has to decode, or `null` for all of them. */
5415
5529
  get readColumns(): Array<string> | null
5416
- /** Every parameter this plan names, in first-seen order. */
5530
+ /**
5531
+ * Every parameter a run of this plan binds - its own sections' and
5532
+ * every plan it holds - in the order its text writes them.
5533
+ */
5417
5534
  get parameters(): Array<string>
5418
5535
  /**
5419
5536
  * The sections that shape a read - `select`, `where`, `order by`,
@@ -5865,8 +5982,9 @@ export declare class RecordOptions {
5865
5982
  * The parts are an Iceberg commit's partition groups, written side by
5866
5983
  * side; a leaf of one file reads it as the bound on its encoding's
5867
5984
  * threads. `null` is the destination's own answer: an Iceberg table's
5868
- * `write.parallelism`, else its `read.parallelism`, else every thread
5869
- * the host offers.
5985
+ * `write.parallelism`, else its `read.parallelism` (the process's
5986
+ * threads where nothing states it) capped at the writers the process
5987
+ * memory budget holds at 288 MiB each.
5870
5988
  */
5871
5989
  get numThreads(): number | null
5872
5990
  /**
@@ -6469,6 +6587,11 @@ export declare class Scalar {
6469
6587
  intoJsonBytes(): Buffer
6470
6588
  /** Encode this value as natural compact JSON UTF-8. */
6471
6589
  intoJson(): string
6590
+ /**
6591
+ * The natural JSON document `intoJson` encodes, decoded: what
6592
+ * `JSON.stringify` writes for this value.
6593
+ */
6594
+ toJSON(): any
6472
6595
  /** Natural compact JSON for the standard JavaScript string protocol. */
6473
6596
  toString(): string
6474
6597
  /**
@@ -6685,6 +6808,13 @@ export declare class Serie {
6685
6808
  at(index: number): Scalar | null
6686
6809
  /** Every row, each built once and kept by the array alone. */
6687
6810
  rows(): Array<Scalar>
6811
+ /**
6812
+ * Every row of a record column as a plain object keyed by column name:
6813
+ * each cell its natural JSON (`Scalar.intoJson`), a 64-bit integer the
6814
+ * exact `bigint` and a null cell `null`. A nested cell is its natural
6815
+ * JSON document whole, so a 64-bit integer inside one is a number.
6816
+ */
6817
+ toRecords(): Array<Record<string, unknown>>
6688
6818
  /** This serie as the one value a `Scalar` sequence holds. */
6689
6819
  intoScalar(): Scalar
6690
6820
  /** Remove row `index` and answer it. */
@@ -7621,8 +7751,9 @@ export declare class TextLine {
7621
7751
  * A capture states what a row header matched about the line, in the
7622
7752
  * order the header declares them, and `null` is a capture it declared
7623
7753
  * and this line did not match; stated, the captures are the line's word
7624
- * over its own header. The codec reads them by position, so the order
7625
- * is the contract and `FixCodec`'s `captureNames` is what names it.
7754
+ * over its own header. A parse reads them by position, so the order
7755
+ * is the contract and `MarketMessagesOptions`' `captureNames` is what
7756
+ * names it.
7626
7757
  *
7627
7758
  * The body is copied into a page this line owns, once: every key and
7628
7759
  * value a message read from it records is a range of that page. A
@@ -7684,7 +7815,7 @@ export declare class TextLine {
7684
7815
  * The line's identity, as its hyphenated text: `UUIDv7` ordered by its
7685
7816
  * millisecond and row number, with a seeded payload over its content. A
7686
7817
  * line is an event of the
7687
- * graph, and a message parsed out of it states this among its `srcuuids`.
7818
+ * graph, and a message parsed out of it states this among its `sourceuuids`.
7688
7819
  */
7689
7820
  get uuid(): string
7690
7821
  /**
@@ -7705,12 +7836,12 @@ export declare class TextLine {
7705
7836
  * When the line happened, nanoseconds since the Unix epoch, UTC: the
7706
7837
  * stated instant, else `mtime`, else `0n`.
7707
7838
  */
7708
- get transunix(): bigint
7839
+ get markettimestamp(): bigint
7709
7840
  /**
7710
7841
  * Where the line stands in its source: the row number under
7711
7842
  * `startRownum`, else its zero-based physical `index`.
7712
7843
  */
7713
- get seqnum(): bigint
7844
+ get sequencenumber(): bigint
7714
7845
  /**
7715
7846
  * The row header's named captures, in the order the expression declares
7716
7847
  * them; resolved on the first ask where none were stated.
@@ -7805,8 +7936,9 @@ export declare class TextOptions {
7805
7936
  * The parts are an Iceberg commit's partition groups, written side by
7806
7937
  * side; a leaf of one file reads it as the bound on its encoding's
7807
7938
  * threads. `null` is the destination's own answer: an Iceberg table's
7808
- * `write.parallelism`, else its `read.parallelism`, else every thread
7809
- * the host offers.
7939
+ * `write.parallelism`, else its `read.parallelism` (the process's
7940
+ * threads where nothing states it) capped at the writers the process
7941
+ * memory budget holds at 288 MiB each.
7810
7942
  */
7811
7943
  get numThreads(): number | null
7812
7944
  /**
@@ -8205,6 +8337,58 @@ export declare class TxHasher {
8205
8337
  }
8206
8338
  export type JsTxHasher = TxHasher
8207
8339
 
8340
+ /**
8341
+ * The table of underlyings (`yggio_market::Underlyings`), its essential
8342
+ * doors: the seed, a row by code, a search. Rows cross as a `Serie` under
8343
+ * `fixUnderlyingField()`, the field the seed's rows are read under. The
8344
+ * table is shared: options it is given to
8345
+ * (`MarketMessagesOptions.withUnderlyings`)
8346
+ * resolves its messages against it and creates the rows they name.
8347
+ */
8348
+ export declare class Underlyings {
8349
+ /**
8350
+ * The embedded seed: its instruments and the default rows of every
8351
+ * register kind (`Underlyings::seeded`).
8352
+ */
8353
+ static seeded(): Underlyings
8354
+ /**
8355
+ * The row `code` names (`Underlyings::get`): a code, an instrument key,
8356
+ * an index key `{key}={value}` or a bare identity value, as a one-row
8357
+ * `Serie` under `fixUnderlyingField()`; `null` where none.
8358
+ */
8359
+ get(code: string): JsSerie | null
8360
+ /**
8361
+ * Every row the table holds now, in the registry's code order
8362
+ * (`Registry::into_serie`): the seed's and every row a parse given the
8363
+ * table filled or created - a disputed code's dispute rows beside its
8364
+ * row - as one `Serie` under `fixUnderlyingField()`.
8365
+ */
8366
+ rows(): JsSerie
8367
+ /**
8368
+ * The rows `text` names, strongest first, each once, at most `limit`
8369
+ * (20 by default) (`Underlyings::search`): the exact code, an
8370
+ * identifier the key index answers, then a ticker, a name or an alias;
8371
+ * a `Serie` under `fixUnderlyingField()`, empty for a blank text.
8372
+ */
8373
+ search(text: string, limit?: number | undefined | null): JsSerie
8374
+ /**
8375
+ * The one message search (`MessageSearch::plan`): `text` read against
8376
+ * this table, the plugins of `options.registry` where one is given and
8377
+ * the root `field` into one plan over the message rows - a UUID the
8378
+ * `uuid` column reads alone; else the underlying, plugin and identifier
8379
+ * branches OR-ed, each carrying its own pruning, the like fallback only
8380
+ * where nothing resolved - the window `[since, until)` on `markettimestamp`,
8381
+ * each nanoseconds since the epoch, at the top, newest first; `null`
8382
+ * for a blank text. `limit` bounds the underlying rows a branch names,
8383
+ * 20 when unstated. A root holding none of the columns the search reads
8384
+ * throws at `$.search`.
8385
+ */
8386
+ messageSearch(text: string, field: Field, options?: MessageSearchOptions): Plan | null
8387
+ /** How many rows the table holds (`Underlyings::len`). */
8388
+ get length(): number
8389
+ }
8390
+ export type JsUnderlyings = Underlyings
8391
+
8208
8392
  /** A normalized URI backed by the validated Rust core. */
8209
8393
  export declare class Uri {
8210
8394
  /** Parse a URI expression or cheaply clone another native `Uri`. */
@@ -9151,19 +9335,19 @@ export interface FixCaptureView {
9151
9335
  /**
9152
9336
  * The bridge header's event key, `{session}:{context}:{sequence}` -
9153
9337
  * `7896a78:a0204ec340:8d8` - captured whole: what one session event's
9154
- * observations share; also `byTag(65069)`.
9338
+ * observations share; also `byTag(65062)`.
9155
9339
  */
9156
9340
  msgeventkey: string | null
9157
9341
  /**
9158
9342
  * The plugin the message came into a bridge through, as the bridge's
9159
9343
  * log line names it - `OMS_X1_OrderOut` in `Message received: ... from
9160
- * (OMS_X1_OrderOut as CL000000382)`; also `byTag(65040)`.
9344
+ * (OMS_X1_OrderOut as CL000000382)`; also `byTag(65033)`.
9161
9345
  */
9162
9346
  msgoriginator: string | null
9163
9347
  /**
9164
9348
  * The conversation a bridge filed the message under - a
9165
9349
  * `CONVERSATIONID` the message stated, else the `{conversationId: ..}`
9166
- * of its log line; also `byTag(65041)`.
9350
+ * of its log line; also `byTag(65034)`.
9167
9351
  */
9168
9352
  conversationid: string | null
9169
9353
  }
@@ -9196,91 +9380,6 @@ export interface FixCode {
9196
9380
  sources?: Array<string>
9197
9381
  }
9198
9382
 
9199
- /** How a codec is pinned, where a caller pins it at all. */
9200
- export interface FixCodecOptions {
9201
- /** The byte a numeric frame splits on where the line does not say. */
9202
- separator?: number
9203
- /** The batch column a line is read from; `body` when unstated. */
9204
- payloadColumn?: string
9205
- /**
9206
- * What a run's row-header captures are called, in the order a line
9207
- * answers them.
9208
- */
9209
- captureNames?: Array<string>
9210
- /** The spellings that mean "nothing was sent". */
9211
- nullValues?: Array<string>
9212
- /**
9213
- * The code of tag 385's set an unmarked line takes on the batch door,
9214
- * any spelling of one; the core's `Send` code when unstated, no pin
9215
- * when empty.
9216
- */
9217
- direction?: string
9218
- /** The raw bytes one Arrow batch targets; the core's 128 MiB when unstated. */
9219
- batchByteSize?: number
9220
- /**
9221
- * The rows one Arrow batch targets; the core's 65,536 when unstated.
9222
- * A batch closes on whichever bound it reaches first.
9223
- */
9224
- batchRowSize?: number
9225
- /**
9226
- * The workers parsing and row conversion use; available CPUs when unstated.
9227
- * Arrow capture parsing holds at most one input batch per worker and
9228
- * yields in order; line doors use bounded row chunks. One reads lazily
9229
- * without a pool, and zero reads as one.
9230
- */
9231
- threads?: number
9232
- /**
9233
- * The epoch-aligned lifecycle snapshot width in exact nanoseconds.
9234
- * `null`, zero and a negative width disable snapshots.
9235
- */
9236
- snapshotNs?: bigint | null
9237
- /**
9238
- * Whether the messages `lifecycle` is handed arrive in instant order,
9239
- * so the walk holds one epoch hour at a time rather than collecting and
9240
- * sorting the whole capture; `false` when unstated.
9241
- */
9242
- sortedLifecycle?: boolean
9243
- /**
9244
- * How far off a whole hour of its log line's clock a stated clock may
9245
- * stand before it is `clock_skew`, in milliseconds; the core's half
9246
- * second when unstated. It dates nothing.
9247
- */
9248
- officialTimeDelayMs?: number
9249
- /**
9250
- * The message types a parse keeps, spelled as codes or as names -
9251
- * `"0"`, `"Heartbeat"`, `"unknown"` for a line stating no type. Empty
9252
- * or unstated keeps every type the refusals leave.
9253
- */
9254
- includeMsgtypes?: Array<string>
9255
- /**
9256
- * The message types a parse refuses before it builds a frame; the
9257
- * core's `Heartbeat`, `TestRequest` and untyped line when unstated, and
9258
- * an empty list keeps every type.
9259
- */
9260
- excludeMsgtypes?: Array<string>
9261
- /**
9262
- * The `SendingTime` an undated message takes when neither it, its row
9263
- * nor its line dates it: a `DateTime64(ns, UTC)` `Scalar`, or a `Date`
9264
- * restated in nanoseconds. The Unix epoch per new message when unstated or
9265
- * `null`.
9266
- */
9267
- defaultSendingTime?: Scalar | Date | null
9268
- /**
9269
- * Whether a market operation this codec builds carries, in its
9270
- * metadata, what its message states that no typed column reads and no
9271
- * identifier map of the leaf holds, lifting the identifiers among them
9272
- * into the set their type belongs to - part of the leaf's identity; the
9273
- * core's `true` when unstated.
9274
- */
9275
- marketMetadata?: boolean
9276
- /**
9277
- * The id of the dictionary's source this codec reads under, folded:
9278
- * an entry of its sources catalog (`FixRegistry.sources()`), resolved
9279
- * once here and refused when the catalog holds no such id.
9280
- */
9281
- source?: string
9282
- }
9283
-
9284
9383
  /**
9285
9384
  * One named FIX code set, as the plain object JavaScript reads.
9286
9385
  *
@@ -9315,11 +9414,11 @@ export interface FixCommitReport {
9315
9414
  * The definitions this crate owns, in tag order, above every tag FIX or a
9316
9415
  * venue publishes.
9317
9416
  *
9318
- * The event's instant `transunix` and the chain's `creaunix`, `execunix`,
9319
- * `techunix`, `prevtransunix`, `snapunix` and `exprunix`; the identities
9320
- * `hashcode`, `crosshashcode`, `uuid`, `crossuuid` and `prevuuid`;
9321
- * the `srcuuids` list of the lines it was read from; the `crosscode`, the
9322
- * `seqnum`, the `state` reached and the `prevstate` it followed; the
9417
+ * The event's instant `markettimestamp` and the chain's `creationtimestamp`, `lastexecutiontimestamp`,
9418
+ * `technicaltimestamp`, `previousmarkettimestamp`, `snapshottimestamp` and `expirytimestamp`; the identities
9419
+ * `hashcode`, `crosshashcode`, `uuid`, `crossuuid` and `previousuuid`;
9420
+ * the `sourceuuids` list of the lines it was read from; the `crosscode`, the
9421
+ * `sequencenumber`, the `state` reached and the `previousstate` it followed; the
9323
9422
  * `metadata` Map group; what a bridge's capture states - `msgoriginator`,
9324
9423
  * `msgeventkey`, the three session names and their kin - and the plugins
9325
9424
  * and sessions the message travelled through; the `marketdatakind` the
@@ -9328,11 +9427,11 @@ export interface FixCommitReport {
9328
9427
  * FIX dictionary publishes, at the datatype its graph column names,
9329
9428
  * numbered from `65001` in the block's order, a retired tag's gap never
9330
9429
  * refilled. The strike
9331
- * price is the derived market fact `strikepx` over `StrikePrice(202)`, and a
9430
+ * price is the derived market fact `strikeprice` over `StrikePrice(202)`, and a
9332
9431
  * bridge's own identifier keys are no crate field either: they arrive as
9333
9432
  * unmapped entries and are read for the identifier name they end with.
9334
9433
  *
9335
- * `transunix`, `creaunix`, `hashcode`, `crosshashcode`, `uuid` and
9434
+ * `markettimestamp`, `creationtimestamp`, `hashcode`, `crosshashcode`, `uuid` and
9336
9435
  * `crossuuid` are non-null; `state` is written on every row a message
9337
9436
  * writes and stays nullable, a state having no neutral member. Every
9338
9437
  * registry already holds them, so this is the listing a schema or a
@@ -9374,9 +9473,8 @@ export interface FixEntryView {
9374
9473
 
9375
9474
  /**
9376
9475
  * The row a rate table stores, `fxrate`: the element and event columns,
9377
- * `buy`, `sell`, `rate` and the partition column `partunix`, declaring
9378
- * `SORT:by` `["crosscode", "transunix"]` and `PARTITION:by`
9379
- * `["partunix"]`.
9476
+ * `buy`, `sell` and `rate`, declaring `SORT:by` `["crosscode", "markettimestamp"]`
9477
+ * and `PARTITION:by` `["months(markettimestamp)"]` - no column of its own.
9380
9478
  */
9381
9479
  export declare function fixFxRateField(): Field
9382
9480
 
@@ -9500,7 +9598,7 @@ export interface FixParentSource {
9500
9598
  /**
9501
9599
  * The row of the plugin dictionary, `plugin`: `pluginid`, `name`, `kind`,
9502
9600
  * `side` (the side kind's code), `beginstring`, `role`, `hasbackup`,
9503
- * `parent`, `aliases`, `confighash`, `firstunix`, `lastunix` and
9601
+ * `parent`, `aliases`, `confighash`, `firsttimestamp`, `lasttimestamp` and
9504
9602
  * `messages`, which `FixPlugins` lays its rows out under.
9505
9603
  */
9506
9604
  export declare function fixPluginField(): Field
@@ -9513,6 +9611,97 @@ export declare function fixPluginField(): Field
9513
9611
  */
9514
9612
  export declare function fixPluginSide(pluginType: string): string
9515
9613
 
9614
+ /**
9615
+ * The row a FIX dictionary is laid out as, `fixdefinition`: one per scalar
9616
+ * field, named definition, code set and source, and one for the plugin
9617
+ * dictionary - `category`, `tag`, `name`, `nullable`, `dtype`, `metadata`,
9618
+ * `children` and `document` - keyed by `category`, `tag` and `name`,
9619
+ * declaring `SORT:by` the three and `PARTITION:by` `["category"]`
9620
+ * (`FixRegistry`'s `Registry::row_field`).
9621
+ */
9622
+ export declare function fixRegistryField(): Field
9623
+
9624
+ /**
9625
+ * One audit report `yggio_market::reports` lists, as the plain object
9626
+ * JavaScript reads: a named plan over the message root, naming no
9627
+ * location.
9628
+ */
9629
+ export interface FixReport {
9630
+ /** The name a caller asks for the report by. */
9631
+ name: string
9632
+ /** The title a page heads the report with. */
9633
+ title: string
9634
+ /** What the report answers and the regulation it serves. */
9635
+ description: string
9636
+ /**
9637
+ * The plan, naming no location: the engine opens it over the table it
9638
+ * is asked of.
9639
+ */
9640
+ plan: string
9641
+ /** The parameters the plan binds, in the order its text writes them. */
9642
+ parameters: Array<FixReportParameter>
9643
+ /**
9644
+ * The column holding, per row, the uuids of the messages the row
9645
+ * stands on; absent where the rows name none.
9646
+ */
9647
+ messages?: string
9648
+ }
9649
+
9650
+ /**
9651
+ * One `:name` parameter an audit report's plan binds, as the plain object
9652
+ * JavaScript reads.
9653
+ */
9654
+ export interface FixReportParameter {
9655
+ /** The name the plan writes after `:`. */
9656
+ name: string
9657
+ /** What the value is. */
9658
+ description: string
9659
+ /**
9660
+ * The value's text a page binds where the caller states none; absent
9661
+ * where the caller must state it.
9662
+ */
9663
+ default?: string
9664
+ }
9665
+
9666
+ /**
9667
+ * Every audit report, in the order a page lists them - `otr`, `cancels`,
9668
+ * `rate`, `concentration`, `execution`, `completeness`, `trail` - each a
9669
+ * fresh object: the core's one list, crossing as it is.
9670
+ */
9671
+ export declare function fixReports(): Array<FixReport>
9672
+
9673
+ /**
9674
+ * One rule `yggio_market::fix::rules` lists, as the plain object
9675
+ * JavaScript reads.
9676
+ */
9677
+ export interface FixRule {
9678
+ /**
9679
+ * `retired.<tag>`, `der.<tag>`, `def.<tag>`, `read.<fact>`,
9680
+ * `lift.<tag>`, `check.<what>`, `practice.<tag>`, or `der.<name>` for
9681
+ * an audit measure.
9682
+ */
9683
+ id: string
9684
+ /** What the rule is: its class word. */
9685
+ class: string
9686
+ /** Whose word it is: `spec` or `crate`. */
9687
+ authority: string
9688
+ /** What that authority names. */
9689
+ reference: string
9690
+ /** The tags it reads. */
9691
+ sources: Array<number>
9692
+ /** The tags it fills. */
9693
+ targets: Array<number>
9694
+ /** A `|`-separated FIX line it applies to; `""` where none is kept. */
9695
+ example: string
9696
+ }
9697
+
9698
+ /**
9699
+ * Every rule the crate applies to a FIX message, in the order
9700
+ * `yggio_market::fix::rules` lists them, each a fresh object: the core's
9701
+ * one list, crossing as it is.
9702
+ */
9703
+ export declare function fixRules(): Array<FixRule>
9704
+
9516
9705
  /** What `addSource` records beside the id: each left out states nothing. */
9517
9706
  export interface FixSourceOptions {
9518
9707
  /**
@@ -9567,9 +9756,10 @@ export interface FixTimeInForce {
9567
9756
  /**
9568
9757
  * The row an `Underlyings` table stores, `underlying`: one instrument on
9569
9758
  * one market, or across every market - the element columns, `code`, `mic`,
9570
- * `securityids`, the instrument facts, `undcode`, `category`, `timezone`,
9571
- * `maturityrule`, `issuer` and the partition column `partunix`, declaring
9572
- * `PARTITION:by` `["partunix"]` and `SORT:by` `["code"]`.
9759
+ * `securityids`, the instrument facts, `underlyingcode`, `category`, `timezone`,
9760
+ * `maturityrule`, `issuer`, `aliascodes`, `validtimestamp` and `register`, declaring
9761
+ * `PARTITION:by` `["months(endtimestamp)"]` - a row with no end in the null
9762
+ * partition, no column of its own - and `SORT:by` `["code"]`.
9573
9763
  */
9574
9764
  export declare function fixUnderlyingField(): Field
9575
9765
 
@@ -9985,6 +10175,115 @@ export interface MarketDataTypeMember {
9985
10175
  description: string
9986
10176
  }
9987
10177
 
10178
+ /** How `MarketMessagesOptions` are pinned, where a caller pins them at all. */
10179
+ export interface MarketMessagesOptionsInit {
10180
+ /** The byte a numeric frame splits on where the line does not say. */
10181
+ separator?: number
10182
+ /** The batch column a line is read from; `body` when unstated. */
10183
+ payloadColumn?: string
10184
+ /**
10185
+ * What a run's row-header captures are called, in the order a line
10186
+ * answers them.
10187
+ */
10188
+ captureNames?: Array<string>
10189
+ /** The spellings that mean "nothing was sent". */
10190
+ nullValues?: Array<string>
10191
+ /**
10192
+ * The code of tag 385's set an unmarked line takes on the batch door,
10193
+ * any spelling of one; the core's `Send` code when unstated, no pin
10194
+ * when empty.
10195
+ */
10196
+ direction?: string
10197
+ /** The raw bytes one Arrow batch targets; the core's 128 MiB when unstated. */
10198
+ batchByteSize?: number
10199
+ /**
10200
+ * The rows one Arrow batch targets; the core's 65,536 when unstated.
10201
+ * A batch closes on whichever bound it reaches first.
10202
+ */
10203
+ batchRowSize?: number
10204
+ /**
10205
+ * The workers parsing and row conversion use; available CPUs when unstated.
10206
+ * Arrow capture parsing holds at most one input batch per worker and
10207
+ * yields in order; line doors use bounded row chunks. One reads lazily
10208
+ * without a pool, and zero reads as one.
10209
+ */
10210
+ threads?: number
10211
+ /**
10212
+ * The epoch-aligned lifecycle snapshot width in exact nanoseconds.
10213
+ * `null`, zero and a negative width disable snapshots.
10214
+ */
10215
+ snapshotNs?: bigint | null
10216
+ /**
10217
+ * Whether the messages `intoLifecycle` walks arrive in instant order,
10218
+ * so the walk holds one epoch hour at a time rather than collecting and
10219
+ * sorting the whole capture; `false` when unstated.
10220
+ */
10221
+ sortedLifecycle?: boolean
10222
+ /**
10223
+ * How far off a whole hour of its log line's clock a stated clock may
10224
+ * stand before it is `clock_skew`, in milliseconds; the core's half
10225
+ * second when unstated. It dates nothing.
10226
+ */
10227
+ officialTimeDelayMs?: number
10228
+ /**
10229
+ * The message types a parse keeps, spelled as codes or as names -
10230
+ * `"0"`, `"Heartbeat"`, `"unknown"` for a line stating no type. Empty
10231
+ * or unstated keeps every type the refusals leave.
10232
+ */
10233
+ includeMsgtypes?: Array<string>
10234
+ /**
10235
+ * The message types a parse refuses before it builds a frame; the
10236
+ * core's `Heartbeat`, `TestRequest` and untyped line when unstated, and
10237
+ * an empty list keeps every type.
10238
+ */
10239
+ excludeMsgtypes?: Array<string>
10240
+ /**
10241
+ * The `SendingTime` an undated message takes when neither it, its row
10242
+ * nor its line dates it: a `DateTime64(ns, UTC)` `Scalar`, or a `Date`
10243
+ * restated in nanoseconds. The Unix epoch per new message when unstated or
10244
+ * `null`.
10245
+ */
10246
+ defaultSendingTime?: Scalar | Date | null
10247
+ /**
10248
+ * Whether a market operation these options build carries, in its
10249
+ * metadata, what its message states that no typed column reads and no
10250
+ * identifier map of the leaf holds, lifting the identifiers among them
10251
+ * into the set their type belongs to - part of the leaf's identity; the
10252
+ * core's `true` when unstated.
10253
+ */
10254
+ marketMetadata?: boolean
10255
+ /**
10256
+ * The id of the dictionary's source these options read under, folded:
10257
+ * an entry of its sources catalog (`FixRegistry.sources()`), resolved
10258
+ * once here and refused when the catalog holds no such id.
10259
+ */
10260
+ source?: string
10261
+ }
10262
+
10263
+ /** How `Underlyings.messageSearch` is bounded, where a caller bounds it. */
10264
+ export interface MessageSearchOptions {
10265
+ /**
10266
+ * The dictionary whose plugins give the plugin branch; no plugin
10267
+ * branch when unstated.
10268
+ */
10269
+ registry?: FixRegistry
10270
+ /**
10271
+ * How many underlying rows the underlying branch names; 20 when
10272
+ * unstated.
10273
+ */
10274
+ limit?: number
10275
+ /**
10276
+ * The window's first instant on `markettimestamp`, nanoseconds since the
10277
+ * epoch, inclusive.
10278
+ */
10279
+ since?: bigint | number
10280
+ /**
10281
+ * The window's end on `markettimestamp`, nanoseconds since the epoch,
10282
+ * exclusive.
10283
+ */
10284
+ until?: bigint | number
10285
+ }
10286
+
9988
10287
  /** One field-metadata key/value pair. */
9989
10288
  export interface MetadataEntry {
9990
10289
  /** Metadata key. */
@@ -10263,3 +10562,1268 @@ export interface TimezoneAlias {
10263
10562
  /** The canonical name it resolves to. */
10264
10563
  canonical: string
10265
10564
  }
10565
+
10566
+ export declare namespace ai {
10567
+ /**
10568
+ * An agent: a model, a system prompt and tools, run in a loop until the
10569
+ * model ends its turn.
10570
+ */
10571
+ export class Agent {
10572
+ /**
10573
+ * An agent of the caller's own: `{ llm, system?, tools?, call(toolUse),
10574
+ * maxTurns? }`, `call` answering each tool call, `{ id, name, input }`,
10575
+ * with a text or `{ content, is_error }`. `call` is called on this
10576
+ * thread while the run waits for it; what it throws rejects the run.
10577
+ */
10578
+ static fromValue(value: { llm: Llm; system?: string; tools?: Array<{ name: string; description: string; input_schema: object }>; call(toolUse: { id: string; name: string; input: any }): string | { content: string; is_error?: boolean }; maxTurns?: number }): Agent
10579
+ /**
10580
+ * The promise of the run of the conversation until the model ends its
10581
+ * turn, on a worker thread: the final `Reply`, every turn appended to
10582
+ * `messages` in place once it settles. A second run waits for this one.
10583
+ */
10584
+ run(messages: Array<object>): Promise<Reply>
10585
+ /**
10586
+ * `run`, each step reported to `onEvent` as it happens, every step
10587
+ * before the promise settles; what `onEvent` throws rejects it.
10588
+ */
10589
+ runWith(messages: Array<object>, onEvent: (event: AgentEvent) => void): Promise<Reply>
10590
+ }
10591
+ export type JsAgent = Agent
10592
+ /**
10593
+ * Where a model is called: Anthropic's API, Amazon Bedrock, Moonshot's API,
10594
+ * an OpenAI-compatible API or this machine.
10595
+ */
10596
+ export class Backend {
10597
+ /** Anthropic's API under `apiKey`. */
10598
+ static anthropic(apiKey: string): Backend
10599
+ /**
10600
+ * Amazon Bedrock: Claude in Amazon Bedrock for a model it serves,
10601
+ * Converse for any other.
10602
+ */
10603
+ static bedrock(options?: ai.BedrockInit | undefined | null): Backend
10604
+ /** Moonshot's Anthropic-compatible API under `apiKey`. */
10605
+ static moonshot(apiKey: string): Backend
10606
+ /**
10607
+ * An OpenAI-compatible Chat Completions API at `baseUrl` (its root,
10608
+ * `/chat/completions` appended; `OPENAI_BASE_URL`'s value when left
10609
+ * out): `https://api.openai.com/v1`, the Hugging Face router
10610
+ * (`HUGGINGFACE_BASE_URL`), Ollama (`OLLAMA_BASE_URL`), vLLM,
10611
+ * llama.cpp; under `apiKey`, none for a server that takes none.
10612
+ */
10613
+ static openai(baseUrl?: string | undefined | null, apiKey?: string | undefined | null): Backend
10614
+ /**
10615
+ * Anthropic's API when `ANTHROPIC_API_KEY` is set and not blank, else
10616
+ * Amazon Bedrock from the default AWS chain.
10617
+ */
10618
+ static fromEnv(): Backend
10619
+ /**
10620
+ * Where `model` - a `Model` or any spelling of one - is called when no
10621
+ * backend is chosen: the API `model.defaultApi()` picks, its key from
10622
+ * the API's variable, Bedrock from the default AWS chain, this machine
10623
+ * from the environment's Hub. An API needing a key the environment
10624
+ * does not hold is refused naming its variable.
10625
+ */
10626
+ static defaultFor(model: ai.Model | string): Backend
10627
+ /**
10628
+ * The API it calls: `"bedrock"` for Amazon Bedrock, whichever of its
10629
+ * APIs a model then takes.
10630
+ */
10631
+ get api(): string
10632
+ /** `model` - a `Model` or any spelling of one - as an `Llm` here. */
10633
+ llm(model: ai.Model | string): ai.Llm
10634
+ /**
10635
+ * The backend with no credential in it: `Anthropic(<redacted>)`,
10636
+ * `OpenAi { base_url: "...", key: Some("<redacted>") }`.
10637
+ */
10638
+ toString(): string
10639
+ }
10640
+ export type JsBackend = Backend
10641
+ /** How a `Task`'s reply is scored: 1 when it holds, else 0. */
10642
+ export class Check {
10643
+ /** The reply's text, trimmed, is `text` exactly. */
10644
+ static exact(text: string): Check
10645
+ /** The reply's text holds every one of `needles`, case ignored. */
10646
+ static contains(needles: Array<string>): Check
10647
+ /**
10648
+ * The reply's text, trimmed and a final `.` or `!` dropped, is one of
10649
+ * `accepted`, case ignored.
10650
+ */
10651
+ static oneOf(accepted: Array<string>): Check
10652
+ /**
10653
+ * The last number the reply's text writes is `expected`, within a
10654
+ * relative 1e-6.
10655
+ */
10656
+ static number(expected: number): Check
10657
+ /**
10658
+ * The reply's text holds a JSON object - bare or in a code fence -
10659
+ * with every one of `keys`.
10660
+ */
10661
+ static json(keys: Array<string>): Check
10662
+ /**
10663
+ * The reply's text matches `pattern` (the `regex` crate's syntax); a
10664
+ * pattern that does not compile matches nothing.
10665
+ */
10666
+ static regex(pattern: string): Check
10667
+ /** The reply calls the tool `name`. */
10668
+ static toolCall(name: string): Check
10669
+ }
10670
+ export type JsCheck = Check
10671
+ /**
10672
+ * The coding agent: a model working in a workspace through a toolkit, told
10673
+ * `CODER_PROMPT` and the workspace root.
10674
+ */
10675
+ export class Coder {
10676
+ /** `llm` working through `toolkit`, which the coder takes. */
10677
+ constructor(llm: ai.Llm, toolkit: ai.Toolkit, options?: ai.CoderInit | undefined | null)
10678
+ /**
10679
+ * The promise of the run of the conversation until the model ends its
10680
+ * turn, on a worker thread: the final `Reply`, every turn appended to
10681
+ * `messages` in place once it settles. A second run waits for this one.
10682
+ */
10683
+ run(messages: Array<object>): Promise<Reply>
10684
+ /**
10685
+ * `run`, each step reported to `onEvent` as it happens, every step
10686
+ * before the promise settles; what `onEvent` throws rejects it.
10687
+ */
10688
+ runWith(messages: Array<object>, onEvent: (event: AgentEvent) => void): Promise<Reply>
10689
+ /** The tools it answers through; refused while a run holds the coder. */
10690
+ get tools(): Array<{ name: string; description: string; input_schema: object }>
10691
+ /**
10692
+ * The permissions its toolkit runs calls under; refused while a run
10693
+ * holds the coder.
10694
+ */
10695
+ get permissions(): string
10696
+ /**
10697
+ * Run every later call under `permissions`; refused while a run holds
10698
+ * the coder.
10699
+ */
10700
+ set permissions(permissions: string)
10701
+ }
10702
+ export type JsCoder = Coder
10703
+ /** A teacher model refining a student model. */
10704
+ export class Distiller {
10705
+ /** `student` taught by `teacher`; both stay usable by the caller. */
10706
+ constructor(teacher: JsLlm, student: JsLlm, options?: ai.DistillerOptions | undefined | null)
10707
+ /**
10708
+ * The promise of the teacher's answer to each of `prompts`, in order,
10709
+ * asked on a worker thread.
10710
+ */
10711
+ examples(prompts: Array<string>): Promise<Array<Example>>
10712
+ /**
10713
+ * The promise of the student's answer to each example under `system`
10714
+ * (none when not given), graded against the teacher's, on a worker
10715
+ * thread.
10716
+ */
10717
+ evaluate(examples: Array<ai.Example>, system?: string | undefined | null): Promise<Report>
10718
+ /**
10719
+ * The promise of up to `rounds` rounds of system-prompt optimization,
10720
+ * each kept when the student scores better under it, on a worker
10721
+ * thread.
10722
+ */
10723
+ refine(examples: Array<ai.Example>, rounds: number): Promise<Refinement>
10724
+ }
10725
+ export type JsDistiller = Distiller
10726
+ /** A prompt and the teacher's answer to it. */
10727
+ export class Example {
10728
+ /** The example asking `prompt`, answered `answer`. */
10729
+ constructor(prompt: string, answer: string)
10730
+ /** What was asked. */
10731
+ get prompt(): string
10732
+ /** What the teacher answered. */
10733
+ get answer(): string
10734
+ }
10735
+ export type JsExample = Example
10736
+ /**
10737
+ * The Hugging Face Hub: what a repository holds, and its files fetched
10738
+ * once into a cache.
10739
+ */
10740
+ export class Hub {
10741
+ /**
10742
+ * The Hub the environment names, each knob `options` states in its
10743
+ * place.
10744
+ */
10745
+ constructor(options?: ai.HubOptions | undefined | null)
10746
+ /** The cache folder. */
10747
+ get cache(): string
10748
+ /** The promise of what the Hub states about `repo`: one request. */
10749
+ info(repo: string): Promise<RepoInfo>
10750
+ /**
10751
+ * The promise of the local path of `file` of `repo` at its default
10752
+ * revision, fetched into the cache unless it is there.
10753
+ */
10754
+ file(repo: string, file: string): Promise<string>
10755
+ /**
10756
+ * The promise of the local path of `file` of `repo` at `revision`,
10757
+ * fetched into the cache unless it is there.
10758
+ */
10759
+ fileAt(repo: string, revision: string, file: string): Promise<string>
10760
+ /**
10761
+ * The cached path of `file` of `repo` at `revision`; `null` when the
10762
+ * cache does not hold it. Fetches nothing.
10763
+ */
10764
+ cached(repo: string, revision: string, file: string): string | null
10765
+ }
10766
+ export type JsHub = Hub
10767
+ /** The key performance indicators of a run of calls. Times are in seconds. */
10768
+ export class Kpis {
10769
+ /** Calls made, failed ones included. */
10770
+ get requests(): number
10771
+ /** Calls that failed. */
10772
+ get failures(): number
10773
+ /** Input tokens read uncached. */
10774
+ get inputTokens(): number
10775
+ /** Output tokens written. */
10776
+ get outputTokens(): number
10777
+ /** Input tokens read from the prompt cache. */
10778
+ get cacheReadInputTokens(): number
10779
+ /** Input tokens written to the prompt cache. */
10780
+ get cacheCreationInputTokens(): number
10781
+ /** What someone bills for the calls, in US dollars. */
10782
+ get cost(): number
10783
+ /** What the calls of a simulated price - a local model's - would cost. */
10784
+ get simulatedCost(): number
10785
+ /** Calls of a model that states no price. */
10786
+ get unpriced(): number
10787
+ /** The calls' time summed, in seconds. */
10788
+ get elapsed(): number
10789
+ /**
10790
+ * The delay to the first streamed text, summed over the calls that
10791
+ * streamed any, in seconds.
10792
+ */
10793
+ get firstText(): number
10794
+ /** The billed and the simulated cost together. */
10795
+ totalCost(): number
10796
+ /** Output tokens per second of call time. */
10797
+ outputTokensPerSecond(): number
10798
+ /** The mean time of a call, in seconds. */
10799
+ meanLatency(): number
10800
+ /** `3 calls · 1.2k in · 340 out · $0.0123 · 2.3s · 148 tok/s`. */
10801
+ toString(): string
10802
+ }
10803
+ export type JsKpis = Kpis
10804
+ /**
10805
+ * A language model behind one call: Claude, Converse, a local model, a
10806
+ * monitored or routed model, or a caller's own.
10807
+ */
10808
+ export class Llm {
10809
+ /** Claude from Anthropic's API under `apiKey`. */
10810
+ static claude(apiKey: string, options?: ai.ClaudeInit | undefined | null): Llm
10811
+ /**
10812
+ * `model` on Amazon Bedrock - Claude in Amazon Bedrock where it serves
10813
+ * the model, Converse otherwise - under the identity `options` states;
10814
+ * Claude's default model when left out.
10815
+ */
10816
+ static bedrock(model?: JsModel | string | undefined | null, options?: BedrockInit | undefined | null): Llm
10817
+ /** Kimi from Moonshot's Anthropic-compatible API under `apiKey`. */
10818
+ static moonshot(apiKey: string, options?: ai.MoonshotInit | undefined | null): Llm
10819
+ /**
10820
+ * `model` on an OpenAI-compatible Chat Completions API: the one at
10821
+ * `https://api.openai.com/v1` unless `options` names another root,
10822
+ * under the key it states.
10823
+ */
10824
+ static openai(model: JsModel | string, options?: ai.OpenAiInit | undefined | null): Llm
10825
+ /**
10826
+ * `model` on the Hugging Face inference router
10827
+ * (`HUGGINGFACE_BASE_URL`) under the Hub token `token`.
10828
+ */
10829
+ static huggingface(token: string, model: JsModel | string): Llm
10830
+ /**
10831
+ * `model` on the Ollama server on this machine (`OLLAMA_BASE_URL`),
10832
+ * which takes no key.
10833
+ */
10834
+ static ollama(model: JsModel | string): Llm
10835
+ /**
10836
+ * A model of the caller's own: `{ model, complete(request) }`, where
10837
+ * `model` is a `Model` or a model name and `complete` answers an
10838
+ * `LlmRequest` with a `Reply`, a text, or a Messages API message object.
10839
+ * `complete` is called on this thread, while the door that asks the
10840
+ * model waits for it; what it throws rejects that door. A value with no
10841
+ * `model` is refused with a `TypeError` naming the member.
10842
+ */
10843
+ static fromValue(value: { model: Model | string; complete(request: LlmRequest): Reply | string | object }): Llm
10844
+ /**
10845
+ * `fallback`, every request taking one of `routes` - `[Route, Llm]`
10846
+ * pairs, the first that takes it - sent to that route's model instead.
10847
+ */
10848
+ static router(fallback: Llm, routes?: Array<[Route, Llm]>): Llm
10849
+ /** The same model, every call counted by `meter`. */
10850
+ monitored(meter: JsMeter): ai.Llm
10851
+ /** The model it asks. */
10852
+ get model(): JsModel
10853
+ /**
10854
+ * The promise of the whole answer to `request` - an `LlmRequest`, or a
10855
+ * text as one user message - the model asked on a worker thread.
10856
+ */
10857
+ complete(request: JsRequest | string): Promise<Reply>
10858
+ /**
10859
+ * `complete`, calling `onText` with each piece of text as the model
10860
+ * writes it, every piece before the promise settles; the same
10861
+ * accumulated `Reply`. What `onText` throws rejects the promise, the
10862
+ * later pieces not reported.
10863
+ */
10864
+ stream(request: JsRequest | string, onText: (arg: string) => void): Promise<Reply>
10865
+ /**
10866
+ * The variant and the model's identifier, never a credential:
10867
+ * `Claude("claude-opus-5-5")`.
10868
+ */
10869
+ toString(): string
10870
+ }
10871
+ export type JsLlm = Llm
10872
+ /**
10873
+ * One call of a model: a system prompt, the conversation, the tools, the
10874
+ * reply's bound, the effort and the stop sequences.
10875
+ */
10876
+ export class LlmRequest {
10877
+ /**
10878
+ * A request of `user`, one user message after the options' messages,
10879
+ * the rest as `options` states.
10880
+ */
10881
+ constructor(user?: string | undefined | null, options?: ai.RequestInit | undefined | null)
10882
+ /** The system prompt; `null` where none is set. */
10883
+ get system(): string | null
10884
+ /** The conversation, as Messages API messages. */
10885
+ get messages(): Array<{ role: 'user' | 'assistant'; content: Array<object> }>
10886
+ /** The tools the model may call. */
10887
+ get tools(): Array<{ name: string; description: string; input_schema: object }>
10888
+ /** The most tokens the reply may hold. */
10889
+ get maxTokens(): number
10890
+ /** The effort; `null` for the model's default. */
10891
+ get effort(): string | null
10892
+ /** Texts that end the reply. */
10893
+ get stopSequences(): Array<string>
10894
+ /**
10895
+ * A model-neutral estimate of the input tokens this request sends:
10896
+ * its bytes divided by four, rounded up.
10897
+ */
10898
+ estimatedInputTokens(): number
10899
+ }
10900
+ export type JsRequest = LlmRequest
10901
+ /** What one model's folder holds, as its `manifest.json` states it. */
10902
+ export class Manifest {
10903
+ /** The model's identifier. */
10904
+ get model(): string
10905
+ /** What the files came from: the model's `local` identifier. */
10906
+ get source(): string
10907
+ /** The Hub commit the files are at; empty for a folder on disk. */
10908
+ get revision(): string
10909
+ /** The Hub repository the tokenizer came from; `null` where none did. */
10910
+ get tokenizer(): string | null
10911
+ /** Every stored file. */
10912
+ get files(): Array<ai.StoredFile>
10913
+ /** When this version was stored, in seconds since the Unix epoch. */
10914
+ get storedUnix(): number
10915
+ }
10916
+ export type JsManifest = Manifest
10917
+ /**
10918
+ * The totals of every call a monitored model makes, overall and per model
10919
+ * identifier. Every `Llm` monitored by one meter adds to the same totals.
10920
+ */
10921
+ export class Meter {
10922
+ /** A meter that has seen no call. */
10923
+ constructor()
10924
+ /** The totals of every call. */
10925
+ total(): JsKpis
10926
+ /** The totals per model identifier, as a plain object. */
10927
+ byModel(): Record<string, Kpis>
10928
+ /** Forget every call seen. */
10929
+ reset(): void
10930
+ }
10931
+ export type JsMeter = Meter
10932
+ /**
10933
+ * A language model: its identity, the identifier each API names it by, the
10934
+ * other names it goes by, its limits and its price.
10935
+ */
10936
+ export class Model {
10937
+ /**
10938
+ * The model `name` spells: a name the standard catalog holds
10939
+ * (`"sonnet"`, `"anthropic.claude-opus-5-5"`) is its model, any other
10940
+ * the card of itself, served where its spelling says.
10941
+ */
10942
+ constructor(name: string)
10943
+ /**
10944
+ * A model stated by its facts: `id`, served under it by every API the
10945
+ * options do not switch, its limits as stated.
10946
+ */
10947
+ static card(id: string, options?: ai.ModelCardInit | undefined | null): Model
10948
+ /** The canonical identifier: Anthropic's, for a Claude model. */
10949
+ get id(): string
10950
+ /** The other names it goes by. */
10951
+ get aliases(): Array<string>
10952
+ /** The most tokens a request's input may hold; `null` where unknown. */
10953
+ get maxInputTokens(): number | null
10954
+ /** The most tokens a reply may hold; `null` where unknown. */
10955
+ get maxOutputTokens(): number | null
10956
+ /** Whether a request may state an effort. */
10957
+ get effort(): boolean
10958
+ /** Whether Anthropic's API re-runs a declined request on another model. */
10959
+ get fallbacks(): boolean
10960
+ /** What its tokens cost; `null` where unknown. */
10961
+ get price(): JsPrice | null
10962
+ /**
10963
+ * The identifier `api` names the model by; `null` where `api` does not
10964
+ * serve it. `api` is one of `anthropic`, `bedrock`, `converse`,
10965
+ * `local`, `moonshot`, `openai`.
10966
+ */
10967
+ apiId(api: string): string | null
10968
+ /**
10969
+ * The API the model is called on when none is chosen (`Api::default_for`):
10970
+ * `"local"` where this build and the model have it, else Anthropic's
10971
+ * or Moonshot's where the environment holds its key, else `"bedrock"`
10972
+ * where Bedrock serves it, else the first API serving it; never
10973
+ * `"openai"`, which is only ever chosen.
10974
+ */
10975
+ defaultApi(): string
10976
+ /**
10977
+ * The `max_tokens` a request asking `asked` sends: `asked`, at most
10978
+ * what the model writes.
10979
+ */
10980
+ replyTokens(asked: number): number
10981
+ /** Whether `other` is this very model, or one of the same identifier. */
10982
+ equals(other: ai.Model): boolean
10983
+ /** `Model(<id>)`. */
10984
+ toString(): string
10985
+ }
10986
+ export type JsModel = Model
10987
+ /**
10988
+ * The registry that finds a model by any of its names - its identifier,
10989
+ * an alias, an API's identifier, in any ASCII case.
10990
+ */
10991
+ export class Models {
10992
+ /** An empty registry. */
10993
+ constructor()
10994
+ /**
10995
+ * A copy of the standard catalog: the Claude models, Kimi and the small
10996
+ * local models.
10997
+ */
10998
+ static standard(): Models
10999
+ /** The model `name` finds; `null` where none does. */
11000
+ get(name: string): ai.Model | null
11001
+ /**
11002
+ * Register `model`, found from now on by every one of its names; a
11003
+ * model of the same identifier is replaced, a name another model holds
11004
+ * refused naming both.
11005
+ */
11006
+ register(model: ai.Model | string): ai.Model
11007
+ /** How many models it holds. */
11008
+ get length(): number
11009
+ /** The models, in the order they were registered. */
11010
+ toArray(): Array<ai.Model>
11011
+ /** The model `name` finds, as an `Llm` on `backend`. */
11012
+ llm(name: string, backend: JsBackend): ai.Llm
11013
+ }
11014
+ export type JsModels = Models
11015
+ /**
11016
+ * Where model files are kept: each model under `{root}/{folder}/`, its
11017
+ * files beside a `manifest.json`.
11018
+ */
11019
+ export class ModelStore {
11020
+ /**
11021
+ * The store at `location` - a local path, a `file:` URL, an
11022
+ * `s3://bucket/prefix` - opened with `properties`, a plain object of
11023
+ * the store's properties, each value text, a number or a boolean.
11024
+ */
11025
+ constructor(location: string, properties?: object | undefined | null)
11026
+ /**
11027
+ * The location a store is kept at when none is named:
11028
+ * `$YGGIO_AI_STORE`, else `~/.cache/yggio/models`.
11029
+ */
11030
+ static defaultRoot(): string
11031
+ /** The folder remote files are materialized in. */
11032
+ get cache(): string
11033
+ /**
11034
+ * The manifest of `model` (a `Model` or any name of one); `null` where
11035
+ * the store does not hold it.
11036
+ */
11037
+ manifest(model: ai.Model | string): ai.Manifest | null
11038
+ /**
11039
+ * Store `files` - each a name in the model's folder and the local path
11040
+ * it is read from, as `[name, path]` entries or a plain object - as
11041
+ * `model` from `source` at `revision`: only what differs is copied, the
11042
+ * manifest written last. Answers `[stored, manifest]`, `stored` one of
11043
+ * `"created"`, `"updated"` or `"unchanged"`.
11044
+ */
11045
+ put(model: ai.Model | string, source: string, revision: string, files: Array<[string, string]> | Record<string, string>, tokenizer?: string | undefined | null): ["created" | "updated" | "unchanged", Manifest]
11046
+ /**
11047
+ * The local folder `model`'s files are read from: the stored folder
11048
+ * itself on a local root, else a cache copy brought up to the
11049
+ * manifest; `null` where the store does not hold it.
11050
+ */
11051
+ local(model: ai.Model | string): string | null
11052
+ /**
11053
+ * Remove `model`'s folder and its cache copy; a model not stored is no
11054
+ * error.
11055
+ */
11056
+ remove(model: ai.Model | string): void
11057
+ /** Every model the store holds, sorted by model. */
11058
+ manifests(): Array<ai.Manifest>
11059
+ }
11060
+ export type JsModelStore = ModelStore
11061
+ /** What a model's tokens cost, in US dollars per million tokens. */
11062
+ export class Price {
11063
+ /**
11064
+ * `input` and `output` dollars per million tokens, the rest as `options`
11065
+ * states.
11066
+ */
11067
+ constructor(input: number, output: number, options?: ai.PriceInit | undefined | null)
11068
+ /** Per million input tokens. */
11069
+ get input(): number
11070
+ /** Per million output tokens. */
11071
+ get output(): number
11072
+ /** Per million cache-read tokens; `null` where the input rate applies. */
11073
+ get cacheRead(): number | null
11074
+ /** Per million cache-write tokens; `null` where the input rate applies. */
11075
+ get cacheWrite(): number | null
11076
+ /** `[threshold, input, output]`, or `null`. */
11077
+ get longContext(): [number, number, number] | null
11078
+ /** Whether it is an estimate no one bills. */
11079
+ get simulated(): boolean
11080
+ /** What `usage` costs at this price, in US dollars. */
11081
+ cost(usage: ai.Usage): number
11082
+ }
11083
+ export type JsPrice = Price
11084
+ /** A model's answer: its blocks, why it stopped and what it cost. */
11085
+ export class Reply {
11086
+ /** The message's identifier. */
11087
+ get id(): string
11088
+ /** The model that answered, as the service names it. */
11089
+ get model(): string
11090
+ /** The answer's blocks, as Messages API content blocks. */
11091
+ get content(): Array<object>
11092
+ /**
11093
+ * Why it stopped: `end_turn`, `tool_use`, `max_tokens`,
11094
+ * `stop_sequence`, `refusal`, `pause_turn`, or the wire's own text.
11095
+ */
11096
+ get stop(): string
11097
+ /** What it cost. */
11098
+ get usage(): JsUsage
11099
+ /** The text blocks joined, in order. */
11100
+ text(): string
11101
+ /** The tool calls, in order, as `{ id, name, input }`. */
11102
+ toolUses(): Array<{ id: string; name: string; input: any }>
11103
+ }
11104
+ export type JsReply = Reply
11105
+ /** What a request must be for a router to send it down a route. */
11106
+ export class Route {
11107
+ /** Its estimated input is under `tokens`. */
11108
+ static inputUnder(tokens: number): Route
11109
+ /** It offers no tool. */
11110
+ static noTools(): Route
11111
+ /**
11112
+ * Its effort is at most `effort` (`low`, `medium`, `high`, `xhigh`,
11113
+ * `max`); a request stating none matches.
11114
+ */
11115
+ static effortAtMost(effort: string): Route
11116
+ /** Every one of `routes` matches. */
11117
+ static all(routes: Array<ai.Route>): Route
11118
+ /**
11119
+ * `predicate(request)` holds. It is called on this thread, while the
11120
+ * door that routes the request waits for it; what it throws is
11121
+ * rethrown - or rejects - from there.
11122
+ */
11123
+ static when(predicate: (arg: JsRequest) => boolean): Route
11124
+ /** Whether `request` takes this route. */
11125
+ matches(request: JsRequest | string): boolean
11126
+ /** The route, a predicate as `When(..)`. */
11127
+ toString(): string
11128
+ }
11129
+ export type JsRoute = Route
11130
+ /**
11131
+ * What the `ai` namespace is pointed at: the API and model, where the API
11132
+ * answers and under which variable's key, Bedrock's region and profile, the
11133
+ * model store and the Hub.
11134
+ *
11135
+ * `new Settings()` is the defaults - `api` `"local"`, `model`
11136
+ * `"smollm2-135m"`; `Settings.load()` the file at `Settings.path()`.
11137
+ * `set(key, value)` changes one setting from its text, each key read by its
11138
+ * own reader; a refused value leaves the settings as they were.
11139
+ */
11140
+ export class Settings {
11141
+ /**
11142
+ * The defaults: this machine (`"local"`) and its smallest model
11143
+ * (`"smollm2-135m"`), every other setting the environment's.
11144
+ */
11145
+ constructor()
11146
+ /**
11147
+ * Where the settings are kept: `$YGGIO_AI_SETTINGS`, else
11148
+ * `$XDG_CONFIG_HOME/yggio/ai.json`, else `~/.config/yggio/ai.json`.
11149
+ */
11150
+ static path(): string
11151
+ /** The settings at `Settings.path()`; no file there is the defaults. */
11152
+ static load(): Settings
11153
+ /**
11154
+ * The settings in the file at `path`; no file there is the defaults. A
11155
+ * file that is not a settings object - an unknown key, a value of the
11156
+ * wrong kind, a key stored where a variable's name belongs - is refused
11157
+ * naming its path and place.
11158
+ */
11159
+ static loadFrom(path: string): Settings
11160
+ /** Write the settings to `Settings.path()`, its folder created. */
11161
+ save(): void
11162
+ /**
11163
+ * Write the settings to `path`, its folder created, so a reader sees
11164
+ * the old file or the new one whole.
11165
+ */
11166
+ saveTo(path: string): void
11167
+ /**
11168
+ * Set the setting `key` - `api`, `model`, `base_url`, `api_key_env`,
11169
+ * `region`, `profile`, `store`, `hub.endpoint`, `hub.cache`,
11170
+ * `hub.offline`, `hub.token_env` - from its text, a boolean as its
11171
+ * text; `null` or an empty text clears an optional one. An unknown key
11172
+ * is refused listing those it holds, a value its reader cannot read is
11173
+ * refused, and the settings are then as they were.
11174
+ */
11175
+ set(key: string, value: string | boolean | null): void
11176
+ /**
11177
+ * The APIs this build serves: every API, `"local"` only in a build with
11178
+ * feature `local`.
11179
+ */
11180
+ static available(): Array<string>
11181
+ /** The API models are called on. */
11182
+ get api(): string
11183
+ /** The model, as it was named. */
11184
+ get model(): string
11185
+ /** The API's root, where it is not its own; `null` where none is stated. */
11186
+ get baseUrl(): string | null
11187
+ /**
11188
+ * The name of the environment variable holding the API's key, never
11189
+ * the key; `null` for the API's own.
11190
+ */
11191
+ get apiKeyEnv(): string | null
11192
+ /** Amazon Bedrock's region, where it is not the AWS session's. */
11193
+ get region(): string | null
11194
+ /** The AWS shared-configuration profile Bedrock signs in under. */
11195
+ get profile(): string | null
11196
+ /** Where local models are kept, as stated; `null` for the default root. */
11197
+ get store(): string | null
11198
+ /** The Hub's root, a mirror; `null` for `HF_ENDPOINT`'s. */
11199
+ get hubEndpoint(): string | null
11200
+ /** The folder Hub files are cached in; `null` for `HF_HUB_CACHE`'s. */
11201
+ get hubCache(): string | null
11202
+ /** Never fetch from the Hub; `false` leaves `HF_HUB_OFFLINE` to decide. */
11203
+ get hubOffline(): boolean
11204
+ /**
11205
+ * The name of the environment variable holding the Hub token; `null`
11206
+ * for `HF_TOKEN`.
11207
+ */
11208
+ get hubTokenEnv(): string | null
11209
+ /**
11210
+ * The model store's location: `store`, else
11211
+ * `ModelStore.defaultRoot()`.
11212
+ */
11213
+ get storeLocation(): string
11214
+ /**
11215
+ * The Hub the settings state, the environment's for what they leave
11216
+ * out, reporting each download's `HubProgress` to `onProgress` where
11217
+ * one is given (as `new Hub({ onProgress })` does); nothing is reported
11218
+ * when it is left out or `null`.
11219
+ */
11220
+ hub(onProgress?: ((progress: HubProgress) => void) | null): ai.Hub
11221
+ /** The model store at `storeLocation`. */
11222
+ modelStore(): JsModelStore
11223
+ /**
11224
+ * Where the model is called: on `api`, except that `"local"` calls a
11225
+ * model this machine cannot run where `Model.defaultApi()` finds it.
11226
+ * An API whose key variable holds none is refused naming the variable,
11227
+ * and `"local"` in a build without it naming what the build serves.
11228
+ */
11229
+ backend(): ai.Backend
11230
+ /**
11231
+ * The model as an `Llm` on `backend()`, sent to the stated root and on
11232
+ * this machine kept in the stated store. Nothing is called yet.
11233
+ */
11234
+ llm(): ai.Llm
11235
+ /** Whether `other` states every setting this one does. */
11236
+ equals(other: ai.Settings): boolean
11237
+ /**
11238
+ * The API and the model, never a key: `Settings(api=local,
11239
+ * model=smollm2-135m)`.
11240
+ */
11241
+ toString(): string
11242
+ }
11243
+ export type JsSettings = Settings
11244
+ /** Tasks any `Llm` runs, each once. */
11245
+ export class Suite {
11246
+ /** The suite of `tasks`, in the order they run. */
11247
+ constructor(tasks: Array<ai.Task>)
11248
+ /** The core's standard suite of smart-usage tasks. */
11249
+ static smart(): Suite
11250
+ /** How many tasks it holds. */
11251
+ get length(): number
11252
+ /**
11253
+ * The promise of `llm` asked each task once, in order, streamed and
11254
+ * timed, on a worker thread: a call that fails is an outcome scoring 0
11255
+ * with its error, and the run goes on. A caller's own `complete` that
11256
+ * throws is such a call: its message is the outcome's error, never
11257
+ * rethrown.
11258
+ */
11259
+ run(llm: JsLlm): Promise<SuiteReport>
11260
+ /**
11261
+ * Per kind of task, the model of `reports` scoring at least `floor` on
11262
+ * it that cost least over its whole run, the lower mean latency
11263
+ * breaking a tie; a kind no model passes is absent.
11264
+ */
11265
+ static recommend(reports: Array<ai.SuiteReport>, floor: number): Record<string, string>
11266
+ }
11267
+ export type JsSuite = Suite
11268
+ /** One model's run of a `Suite`. */
11269
+ export class SuiteReport {
11270
+ /** The model's identifier. */
11271
+ get model(): string
11272
+ /** Each task's outcome, in the suite's order. */
11273
+ get outcomes(): Array<ai.Outcome>
11274
+ /** Every call's tokens, time and cost, priced by the model's price. */
11275
+ get kpis(): JsKpis
11276
+ /** The mean score over every task; 0 for no task. */
11277
+ score(): number
11278
+ /** The mean score per kind of task. */
11279
+ byKind(): Record<string, number>
11280
+ /** Output tokens per second of call time. */
11281
+ tokensPerSecond(): number
11282
+ }
11283
+ export type JsSuiteReport = SuiteReport
11284
+ /** One request of a `Suite` and how its reply is scored. */
11285
+ export class Task {
11286
+ /**
11287
+ * The task `name` of `kind` asking `request` (a `Request`, or a user's
11288
+ * text), its reply scored by `check`.
11289
+ */
11290
+ constructor(name: string, kind: string, request: JsRequest | string, check: ai.Check)
11291
+ /** Its name, unique in its suite. */
11292
+ get name(): string
11293
+ /** The kind of work it measures, such as `arithmetic`. */
11294
+ get kind(): string
11295
+ }
11296
+ export type JsTask = Task
11297
+ /**
11298
+ * The tools an agent answers, behind one permissions gate. A `Coder`
11299
+ * takes the toolkit it is given: the handle is empty after.
11300
+ */
11301
+ export class Toolkit {
11302
+ /** No tools, `ask` permissions, every call that needs asking refused. */
11303
+ constructor()
11304
+ /**
11305
+ * The tools over the workspace at `root` - `read_file`, `write_file`,
11306
+ * `edit_file`, `list_files`, `grep`, `shell`, and unless `web` is
11307
+ * `false` `web_search` and `web_fetch` - every path resolved under
11308
+ * `root`.
11309
+ */
11310
+ static workspace(root: string, options?: ai.WorkspaceInit | undefined | null): Toolkit
11311
+ /** The tools the model may call, as `{ name, description, input_schema }`. */
11312
+ get tools(): Array<{ name: string; description: string; input_schema: object }>
11313
+ /**
11314
+ * The promise of the answer to `toolUse` - a tool call, `{ id, name,
11315
+ * input }`, a `type` key ignored - by the action of its name, when the
11316
+ * permissions allow it, run on a worker thread; a refused call, an
11317
+ * unknown tool or a bad input is an error result naming why.
11318
+ */
11319
+ call(toolUse: { id: string; name: string; input: any }): Promise<ToolResult>
11320
+ /** The permissions calls run under: `read-only`, `ask` or `auto`. */
11321
+ get permissions(): string
11322
+ /** Run every later call under `permissions`. */
11323
+ set permissions(permissions: string)
11324
+ }
11325
+ export type JsToolkit = Toolkit
11326
+ /** What a call cost in tokens. */
11327
+ export class Usage {
11328
+ /** A usage of the counts `counts` states. */
11329
+ constructor(counts?: ai.UsageInit | undefined | null)
11330
+ /** Input tokens read uncached. */
11331
+ get inputTokens(): number
11332
+ /** Output tokens written. */
11333
+ get outputTokens(): number
11334
+ /** Input tokens read from the prompt cache. */
11335
+ get cacheReadInputTokens(): number
11336
+ /** Input tokens written to the prompt cache. */
11337
+ get cacheCreationInputTokens(): number
11338
+ }
11339
+ export type JsUsage = Usage
11340
+ /** The internet: a page fetched as text, a query searched. */
11341
+ export class Web {
11342
+ /**
11343
+ * The engine the environment names (Brave when `BRAVE_SEARCH_API_KEY`
11344
+ * is set, else `SearXNG` when `SEARXNG_URL` is, else `DuckDuckGo`) unless
11345
+ * `options` names one, a fetched body read up to 2 MiB.
11346
+ */
11347
+ constructor(options?: ai.WebOptions | undefined | null)
11348
+ /** The engine a search asks: `"duckduckgo"`, `"brave"` or `"searxng"`. */
11349
+ get engine(): string
11350
+ /**
11351
+ * The promise of the page at `url`, redirects followed, fetched on a
11352
+ * worker thread: HTML read as `htmlToText` reads it against the final
11353
+ * URL, text and JSON as they are, the body cut at the most bytes read.
11354
+ */
11355
+ fetch(url: string): Promise<Page>
11356
+ /**
11357
+ * The promise of at most `limit` (10 when not given) results the
11358
+ * engine answers for `query`, in its order, asked on a worker thread.
11359
+ */
11360
+ search(query: string, limit?: number | undefined | null): Promise<Array<Hit>>
11361
+ }
11362
+ export type JsWeb = Web
11363
+ /**
11364
+ * One step of an agent's run, as `runWith` reports it: `text` (a piece of
11365
+ * the turn's text), `reply` (the turn's whole reply), `tool_call` (a call,
11366
+ * before it is answered) and `tool_result` (the call and its answer).
11367
+ */
11368
+ export interface AgentEvent {
11369
+ /** `text`, `reply`, `tool_call` or `tool_result`. */
11370
+ type: 'text' | 'reply' | 'tool_call' | 'tool_result'
11371
+ /** The text written, for `text`. */
11372
+ text?: string
11373
+ /** The turn's reply, for `reply`. */
11374
+ reply?: ai.Reply
11375
+ /**
11376
+ * The tool call, `{ id, name, input }`, for `tool_call` and
11377
+ * `tool_result`.
11378
+ */
11379
+ call?: { id: string; name: string; input: any }
11380
+ /** What the call answered, for `tool_result`. */
11381
+ output?: ai.ToolResult
11382
+ }
11383
+ /**
11384
+ * Amazon Bedrock's identity, each slot the default AWS chain's when left
11385
+ * out.
11386
+ */
11387
+ export interface BedrockInit {
11388
+ /** The AWS region. */
11389
+ region?: string | null
11390
+ /** The AWS profile. */
11391
+ profile?: string | null
11392
+ /** A Bedrock API key, sent as a bearer token. */
11393
+ token?: string | null
11394
+ }
11395
+ /** Anthropic's API, as `Llm.claude` takes it. */
11396
+ export interface ClaudeInit {
11397
+ /**
11398
+ * The model asked: a `Model` or any spelling of one; Claude's default
11399
+ * when left out.
11400
+ */
11401
+ model?: JsModel | string | null
11402
+ /** The API's root, `/v1/messages` appended - a proxy or a test server. */
11403
+ baseUrl?: string | null
11404
+ /**
11405
+ * Whether Anthropic re-runs a declined request on another model; on
11406
+ * when left out.
11407
+ */
11408
+ fallbacks?: boolean | null
11409
+ }
11410
+ /** The prompt a `Coder` tells its model unless told another. */
11411
+ export const CODER_PROMPT: string
11412
+ /** What a coder is built with. */
11413
+ export interface CoderInit {
11414
+ /** The system prompt, instead of `CODER_PROMPT` and the workspace root. */
11415
+ system?: string | null
11416
+ /** The most model turns a run takes; 64 when left out. */
11417
+ maxTurns?: number | null
11418
+ }
11419
+ /**
11420
+ * The model `new Settings()` asks: the smallest of the catalog's local
11421
+ * models, `smollm2-135m`.
11422
+ */
11423
+ export const DEFAULT_LOCAL_MODEL: string
11424
+ /**
11425
+ * What a `Distiller` is built with; a knob not given (or `null`) keeps the
11426
+ * core's default.
11427
+ */
11428
+ export interface DistillerOptions {
11429
+ /**
11430
+ * How a student's answer is graded against the teacher's: `"exact"`,
11431
+ * `"contains"` or `"judge"` (the default: the teacher scores it).
11432
+ */
11433
+ grade?: string | null
11434
+ /** The most tokens every answer and system prompt is written in. */
11435
+ maxTokens?: number | null
11436
+ }
11437
+ /** One search result. */
11438
+ export interface Hit {
11439
+ /** The result's title. */
11440
+ title: string
11441
+ /** The page it names. */
11442
+ url: string
11443
+ /** The engine's excerpt of it, as plain text; empty when it gave none. */
11444
+ snippet: string
11445
+ }
11446
+ /**
11447
+ * `html` as the page a model reads: lines with `#`-headings, `- ` items
11448
+ * and `[text](url)` links, each link resolved against `base` when given.
11449
+ */
11450
+ export function htmlToText(html: string, base?: string | undefined | null): ai.Page
11451
+ /**
11452
+ * What a `Hub` is built with; a knob not given (or `null`) keeps what the
11453
+ * environment names, as `huggingface_hub` reads it.
11454
+ */
11455
+ export interface HubOptions {
11456
+ /**
11457
+ * The Hub's root URL, a mirror or a fake one; `HF_ENDPOINT`, else
11458
+ * `https://huggingface.co`.
11459
+ */
11460
+ endpoint?: string | null
11461
+ /**
11462
+ * The bearer token sent; `HF_TOKEN`, `HUGGING_FACE_HUB_TOKEN` or
11463
+ * `$HF_HOME/token`.
11464
+ */
11465
+ token?: string | null
11466
+ /** The cache folder; `HF_HUB_CACHE`, else `$HF_HOME/hub`. */
11467
+ cache?: string | null
11468
+ /**
11469
+ * Whether a file not cached is refused rather than fetched;
11470
+ * `HF_HUB_OFFLINE`.
11471
+ */
11472
+ offline?: boolean | null
11473
+ /**
11474
+ * Called with a download's `HubProgress` as its bytes land, on this
11475
+ * thread while the fetch waits for it; what it throws rejects the
11476
+ * fetch. Nothing is reported when left out.
11477
+ */
11478
+ onProgress?: ((progress: HubProgress) => void) | null
11479
+ }
11480
+ /** What a download reports as its bytes land. */
11481
+ export interface HubProgress {
11482
+ /** The repository, such as `Qwen/Qwen2.5-0.5B-Instruct-GGUF`. */
11483
+ repo: string
11484
+ /** The file within it. */
11485
+ file: string
11486
+ /** Bytes on disk so far, a resumed prefix included. */
11487
+ done: number
11488
+ /** The file's whole length; `null` when the Hub stated none. */
11489
+ total: number | null
11490
+ }
11491
+ /** The Hugging Face inference router's OpenAI-compatible root. */
11492
+ export const HUGGINGFACE_BASE_URL: string
11493
+ /** One link of a `Page`. */
11494
+ export interface Link {
11495
+ /**
11496
+ * The link's text, whitespace collapsed; empty for a link around an
11497
+ * image alone.
11498
+ */
11499
+ text: string
11500
+ /** Where it points, resolved against the page's URL. */
11501
+ url: string
11502
+ }
11503
+ /**
11504
+ * What a model card states beyond its identifier. An API given a string
11505
+ * serves the model under it, given `null` does not serve it, and left out
11506
+ * serves it under the identifier.
11507
+ */
11508
+ export interface ModelCardInit {
11509
+ /** Anthropic's identifier, or `null` where Anthropic's API does not serve it. */
11510
+ anthropic?: string | null
11511
+ /** Claude in Amazon Bedrock's identifier, or `null`. */
11512
+ bedrock?: string | null
11513
+ /** Bedrock Converse's identifier, or `null`. */
11514
+ converse?: string | null
11515
+ /** This machine's Hub reference, or `null`. */
11516
+ local?: string | null
11517
+ /** Moonshot's identifier, or `null`. */
11518
+ moonshot?: string | null
11519
+ /** An OpenAI-compatible API's identifier, or `null`. */
11520
+ openai?: string | null
11521
+ /** The other names it goes by. */
11522
+ aliases?: Array<string> | null
11523
+ /** The most tokens a request's input may hold. */
11524
+ maxInputTokens?: number | null
11525
+ /** The most tokens a reply may hold. */
11526
+ maxOutputTokens?: number | null
11527
+ /** Whether a request may state an effort; `true` when left out. */
11528
+ effort?: boolean | null
11529
+ /**
11530
+ * Whether Anthropic's API re-runs a declined request on another model;
11531
+ * `false` when left out.
11532
+ */
11533
+ fallbacks?: boolean | null
11534
+ /** What its tokens cost. */
11535
+ price?: JsPrice | null
11536
+ }
11537
+ /** Moonshot's API, as `Llm.moonshot` takes it. */
11538
+ export interface MoonshotInit {
11539
+ /** The model asked; `kimi-k3` when left out. */
11540
+ model?: JsModel | string | null
11541
+ /** The API's root, `/v1/messages` appended. */
11542
+ baseUrl?: string | null
11543
+ }
11544
+ /** The OpenAI-compatible root of the Ollama server on this machine. */
11545
+ export const OLLAMA_BASE_URL: string
11546
+ /** `https://api.openai.com/v1`, `Backend.openai`'s and `Llm.openai`'s default root. */
11547
+ export const OPENAI_BASE_URL: string
11548
+ /** An OpenAI-compatible API, as `Llm.openai` takes it. */
11549
+ export interface OpenAiInit {
11550
+ /**
11551
+ * The API's root, `/chat/completions` appended: a self-hosted server,
11552
+ * vLLM, llama.cpp; `OPENAI_BASE_URL`'s value when left out.
11553
+ */
11554
+ baseUrl?: string | null
11555
+ /**
11556
+ * The API key, sent as a bearer token; none when left out, for a
11557
+ * server that takes none.
11558
+ */
11559
+ apiKey?: string | null
11560
+ }
11561
+ /** How one model did on one `Task`. */
11562
+ export interface Outcome {
11563
+ /** The task's name. */
11564
+ task: string
11565
+ /** The task's kind. */
11566
+ kind: string
11567
+ /** 0 to 1; 0 for a call that failed. */
11568
+ score: number
11569
+ /** What the reply states it cost; zero for a call that failed. */
11570
+ usage: JsUsage
11571
+ /**
11572
+ * From the request sent to the reply read, or to the failure, in
11573
+ * seconds.
11574
+ */
11575
+ elapsed: number
11576
+ /** The reply's text. */
11577
+ answer: string
11578
+ /** Why the call failed; `null` when it did not. */
11579
+ error: string | null
11580
+ }
11581
+ /** A page as a model reads it. */
11582
+ export interface Page {
11583
+ /**
11584
+ * Where it was read from, after redirects; empty when it was not read
11585
+ * from anywhere.
11586
+ */
11587
+ url: string
11588
+ /** Its `<title>`; `null` when it states none. */
11589
+ title: string | null
11590
+ /**
11591
+ * Its text: HTML as lines with `#`-headings, `- ` items and
11592
+ * `[text](url)` links; text and JSON as they are.
11593
+ */
11594
+ text: string
11595
+ /** Every link it holds, in order. */
11596
+ links: Array<ai.Link>
11597
+ }
11598
+ /** A price's rates beyond input and output. */
11599
+ export interface PriceInit {
11600
+ /**
11601
+ * Per million tokens read from the prompt cache; the input rate when
11602
+ * left out.
11603
+ */
11604
+ cacheRead?: number | null
11605
+ /**
11606
+ * Per million tokens written to the prompt cache; the input rate when
11607
+ * left out.
11608
+ */
11609
+ cacheWrite?: number | null
11610
+ /**
11611
+ * `[threshold, input, output]`: the input and output rates once a
11612
+ * request's prompt passes `threshold` tokens.
11613
+ */
11614
+ longContext?: [number, number, number] | null
11615
+ /** Whether it is an estimate no one bills, a local model's. */
11616
+ simulated?: boolean | null
11617
+ }
11618
+ /**
11619
+ * The examples of the JSON Lines chat set at `path`, as `writeJsonl`
11620
+ * writes it.
11621
+ */
11622
+ export function readJsonl(path: string): Array<ai.Example>
11623
+ /** What `Distiller.refine` found. */
11624
+ export interface Refinement {
11625
+ /**
11626
+ * The best system prompt found; empty when none beat the student with
11627
+ * no system prompt.
11628
+ */
11629
+ system: string
11630
+ /** The student with no system prompt. */
11631
+ before: ai.Report
11632
+ /** The student under `system`. */
11633
+ after: ai.Report
11634
+ /** Each round's candidate system prompt and its mean grade, in order. */
11635
+ rounds: Array<[string, number]>
11636
+ }
11637
+ /** What the Hub states about one model repository. */
11638
+ export interface RepoInfo {
11639
+ /**
11640
+ * The repository's identifier, such as
11641
+ * `HuggingFaceTB/SmolLM2-135M-Instruct`.
11642
+ */
11643
+ id: string
11644
+ /** The commit sha of its default revision. */
11645
+ sha: string
11646
+ /** Every file it holds, by its path within it. */
11647
+ files: Array<string>
11648
+ /**
11649
+ * The model it was derived from, as its card states it; `null` when
11650
+ * it states none.
11651
+ */
11652
+ baseModel: string | null
11653
+ /** Whether a download needs an accepted licence and a token. */
11654
+ gated: boolean
11655
+ }
11656
+ /** How the student did on a set of `Example`s. */
11657
+ export interface Report {
11658
+ /** Each example's grade, 0 to 1, in order. */
11659
+ scores: Array<number>
11660
+ /** The mean grade; 0 for no example. */
11661
+ mean: number
11662
+ /** The student's answers, in order. */
11663
+ answers: Array<string>
11664
+ }
11665
+ /** What a request states beyond its user text; `null` clears a slot. */
11666
+ export interface RequestInit {
11667
+ /** The system prompt. */
11668
+ system?: string | null
11669
+ /**
11670
+ * The conversation so far, Messages API messages oldest first; the
11671
+ * user text, when given, is appended after them.
11672
+ */
11673
+ messages?: Array<{ role: 'user' | 'assistant'; content: string | Array<object> }> | null
11674
+ /** The tools the model may call: `{ name, description, input_schema }`. */
11675
+ tools?: Array<{ name: string; description: string; input_schema: object }> | null
11676
+ /** The most tokens the reply may hold; 16000 when left out. */
11677
+ maxTokens?: number | null
11678
+ /**
11679
+ * The effort: `low`, `medium`, `high`, `xhigh` or `max`; the model's
11680
+ * default when left out.
11681
+ */
11682
+ effort?: string | null
11683
+ /** Texts that end the reply where the model writes one. */
11684
+ stopSequences?: Array<string> | null
11685
+ }
11686
+ /**
11687
+ * One stored file: its name in the model's folder, its length and its
11688
+ * digest.
11689
+ */
11690
+ export interface StoredFile {
11691
+ /** Its path within the model's folder, `/`-separated. */
11692
+ name: string
11693
+ /** Its length in bytes. */
11694
+ size: number
11695
+ /** Its xxh3-128 digest, `xxh3-128:{hex}`. */
11696
+ digest: string
11697
+ }
11698
+ /** What a tool answered. */
11699
+ export interface ToolResult {
11700
+ /** The answer as text; the reason, for a failure. */
11701
+ content: string
11702
+ /** Whether the tool failed. */
11703
+ is_error: boolean
11704
+ }
11705
+ /** The four counts of a usage, each zero when left out. */
11706
+ export interface UsageInit {
11707
+ /** Input tokens read uncached. */
11708
+ inputTokens?: number
11709
+ /** Output tokens written. */
11710
+ outputTokens?: number
11711
+ /** Input tokens read from the prompt cache. */
11712
+ cacheReadInputTokens?: number
11713
+ /** Input tokens written to the prompt cache. */
11714
+ cacheCreationInputTokens?: number
11715
+ }
11716
+ /**
11717
+ * What a `Web` is built with; a knob not given keeps the core's default,
11718
+ * and `null` is the same as not given.
11719
+ */
11720
+ export interface WebOptions {
11721
+ /**
11722
+ * The search engine asked: `"duckduckgo"`, `"brave:<key>"` (its
11723
+ * subscription token) or `"searxng:<url>"` (its instance root); the one
11724
+ * the environment names when not given.
11725
+ */
11726
+ engine?: string | null
11727
+ /**
11728
+ * Where a search is sent in place of the engine's own endpoint - a
11729
+ * mirror, a proxy, a test server - its query appended.
11730
+ */
11731
+ searchUrl?: string | null
11732
+ /** The most bytes of a fetched body read; 2 MiB when not given. */
11733
+ maxBytes?: number | null
11734
+ }
11735
+ /** What a workspace toolkit is built with. */
11736
+ export interface WorkspaceInit {
11737
+ /** `read-only`, `ask` or `auto`; `ask` when left out. */
11738
+ permissions?: string | null
11739
+ /**
11740
+ * Whether `web_search` and `web_fetch` are offered too; `true` when
11741
+ * left out.
11742
+ */
11743
+ web?: boolean | null
11744
+ /**
11745
+ * Asked what `ask` does not allow by itself: `approver(toolUse,
11746
+ * access)`, `access` one of `read`, `write`, `execute`, `network`,
11747
+ * answering whether the call runs. Called on this thread while the
11748
+ * door that runs the call waits for it; what it throws rejects that
11749
+ * door. Every such call is refused when left out.
11750
+ */
11751
+ approver?: ((toolUse: { id: string; name: string; input: any }, access: 'read' | 'write' | 'execute' | 'network') => boolean) | null
11752
+ }
11753
+ /**
11754
+ * Write `examples` to the file at `path` as JSON Lines, one chat per line,
11755
+ * the supervised fine-tuning set any trainer reads; the file is replaced.
11756
+ */
11757
+ export function writeJsonl(examples: Array<ai.Example>, path: string): void
11758
+ }
11759
+
11760
+ export declare namespace distance {
11761
+ /**
11762
+ * The unrestricted Damerau-Levenshtein distance: Levenshtein's edits plus
11763
+ * the transposition of two adjacent characters.
11764
+ */
11765
+ export function damerauLevenshtein(left: string, right: string): number
11766
+ /** The similarity `matches` takes by default: one edit in four characters. */
11767
+ export const DEFAULT_SIMILARITY: number
11768
+ /** The Jaro similarity, from `0` to `1`. */
11769
+ export function jaroSimilarity(left: string, right: string): number
11770
+ /** The Jaro-Winkler similarity, from `0` to `1`. */
11771
+ export function jaroWinklerSimilarity(left: string, right: string): number
11772
+ /**
11773
+ * The fewest single-character insertions, deletions and substitutions that
11774
+ * turn `left` into `right`, counted over characters, never bytes.
11775
+ */
11776
+ export function levenshtein(left: string, right: string): number
11777
+ /**
11778
+ * The Levenshtein distance where it is at most `max`, else `null`; `max`
11779
+ * is a non-negative whole number.
11780
+ */
11781
+ export function levenshteinWithin(left: string, right: string, max: number): number | null
11782
+ /**
11783
+ * One candidate `matches` kept: the text as it was given, its Levenshtein
11784
+ * distance from the needle and its similarity to it, both over the two
11785
+ * normalized forms.
11786
+ */
11787
+ export interface Matched {
11788
+ /** The candidate, as it was given. */
11789
+ text: string
11790
+ /** The edits between the normalized needle and the normalized candidate. */
11791
+ distance: number
11792
+ /** One less the distance over the longer normalized form's characters. */
11793
+ similarity: number
11794
+ /** Whether the candidate's normalized form is the needle's. */
11795
+ exact: boolean
11796
+ }
11797
+ /**
11798
+ * The candidates at least `threshold` similar to `needle`, both
11799
+ * normalized, at most `limit` of them: exact ones first, then by distance
11800
+ * ascending, similarity descending and input order.
11801
+ */
11802
+ export function matches(needle: string, candidates: Array<string>, options?: distance.MatchesOptions | undefined | null): Array<distance.Matched>
11803
+ /**
11804
+ * How `matches` ranks: `threshold` the least similarity a candidate keeps
11805
+ * (`DEFAULT_SIMILARITY` when left out), `limit` the most candidates kept
11806
+ * (20 when left out).
11807
+ */
11808
+ export interface MatchesOptions {
11809
+ /**
11810
+ * The least similarity a candidate keeps; `DEFAULT_SIMILARITY` when
11811
+ * left out or `null`.
11812
+ */
11813
+ threshold?: number | null
11814
+ /**
11815
+ * The most candidates kept, a non-negative whole number; 20 when left
11816
+ * out or `null`.
11817
+ */
11818
+ limit?: number | null
11819
+ }
11820
+ /**
11821
+ * The one form a fuzzy comparison reads: trimmed, lowercased, accents
11822
+ * stripped, every run of whitespace or ASCII punctuation one space.
11823
+ */
11824
+ export function normalized(text: string): string
11825
+ /** One less the Levenshtein distance over the longer text's characters. */
11826
+ export function similarity(left: string, right: string): number
11827
+ /** `text` with its accents stripped and its case kept. */
11828
+ export function stripAccents(text: string): string
11829
+ }