yggio 0.0.6 → 0.0.14
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/benchmarks/fix.js +3 -3
- package/benchmarks/types.js +3 -3
- package/binding.d.ts +37 -18
- package/binding.js +5 -5
- package/index.d.ts +1131 -63
- package/index.js +28 -4
- package/package.json +8 -4
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
|
|
1606
|
-
*
|
|
1607
|
-
*
|
|
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.
|
|
1611
|
-
* `
|
|
1612
|
-
*
|
|
1613
|
-
*
|
|
1614
|
-
*
|
|
1615
|
-
*
|
|
1616
|
-
*
|
|
1617
|
-
*
|
|
1618
|
-
*
|
|
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
|
/**
|
|
@@ -1902,6 +1929,20 @@ export declare class FixCodec {
|
|
|
1902
1929
|
* dictionary's sources catalog; `null` where none was named.
|
|
1903
1930
|
*/
|
|
1904
1931
|
get source(): string | null
|
|
1932
|
+
/**
|
|
1933
|
+
* This codec sharing `underlyings` across its parses and lifecycles
|
|
1934
|
+
* (`MarketMessagesOptions::with_underlyings`): a parse resolves each
|
|
1935
|
+
* message against it in stream order, creates the rows it names and
|
|
1936
|
+
* the table holds none of, and fills the message from them - its
|
|
1937
|
+
* `undcode` among them - so a search through the same table finds
|
|
1938
|
+
* what the parse wrote.
|
|
1939
|
+
*/
|
|
1940
|
+
withUnderlyings(underlyings: JsUnderlyings): FixCodec
|
|
1941
|
+
/**
|
|
1942
|
+
* The underlyings this codec resolves against, sharing them; `null`
|
|
1943
|
+
* where none was given and each walk starts from the seed.
|
|
1944
|
+
*/
|
|
1945
|
+
get underlyings(): JsUnderlyings | null
|
|
1905
1946
|
/**
|
|
1906
1947
|
* The raw bytes one Arrow batch targets.
|
|
1907
1948
|
*
|
|
@@ -2181,11 +2222,13 @@ export declare class FixRegistry {
|
|
|
2181
2222
|
* The registry the process environment names, loaded on the first call.
|
|
2182
2223
|
*
|
|
2183
2224
|
* The order is the core's: a registry installed by `installEnv`, then the
|
|
2184
|
-
* folder `YGGIO_FIX_REGISTRY` names, then `~/.config/fix
|
|
2185
|
-
*
|
|
2186
|
-
*
|
|
2187
|
-
*
|
|
2188
|
-
*
|
|
2225
|
+
* folder `YGGIO_FIX_REGISTRY` names, then `~/.config/fix`, then the
|
|
2226
|
+
* dictionary the crate ships, its embedded FIX Latest seed
|
|
2227
|
+
* (`config/seeds/fix.parquet`). A folder of the second or third step that
|
|
2228
|
+
* does not exist answers that seed too and writes nothing; one that
|
|
2229
|
+
* exists loads as a store, an empty one as the empty registry. Every
|
|
2230
|
+
* other failure throws with the native message and the default stays
|
|
2231
|
+
* unresolved, so the next call retries.
|
|
2189
2232
|
*/
|
|
2190
2233
|
static fromEnv(): FixRegistry
|
|
2191
2234
|
/**
|
|
@@ -2205,8 +2248,13 @@ export declare class FixRegistry {
|
|
|
2205
2248
|
/**
|
|
2206
2249
|
* Load the fields, components, and groups categories.
|
|
2207
2250
|
*
|
|
2208
|
-
* `location` is an `IOBase` handle, a `Url`, or the string naming one,
|
|
2209
|
-
*
|
|
2251
|
+
* `location` is an `IOBase` handle, a `Url`, or the string naming one,
|
|
2252
|
+
* built as every located door builds it: the core's `LocalPath` decides
|
|
2253
|
+
* leaf or folder, so a file on this machine that is there is read as the
|
|
2254
|
+
* one table of dictionary rows it holds - the shipped seed,
|
|
2255
|
+
* `config/seeds/fix.parquet`, is one - and a folder that is there, or a
|
|
2256
|
+
* path that is not, is the folder of a store; an `http(s)` URL answers a
|
|
2257
|
+
* leaf, so an HTTP store is not loaded from a bare URL. A folder that
|
|
2210
2258
|
* is not there loads as a new registry - the crate's own fields and the
|
|
2211
2259
|
* two seeded clocks, nothing else - and is not created; a stored copy of
|
|
2212
2260
|
* one of the crate's own fields, in its tag block from 65000, is read
|
|
@@ -2829,11 +2877,11 @@ export declare class IcebergOptions {
|
|
|
2829
2877
|
* Throws the core's typed error for a value it refuses, naming it.
|
|
2830
2878
|
*/
|
|
2831
2879
|
constructor(options?: IcebergOptionsInput | undefined | null)
|
|
2832
|
-
/** How many beaten commit attempts are retried. Default:
|
|
2880
|
+
/** How many beaten commit attempts are retried. Default: 20. */
|
|
2833
2881
|
get commitRetries(): number
|
|
2834
2882
|
/** Set how many beaten commit attempts are retried. */
|
|
2835
2883
|
set commitRetries(retries: number)
|
|
2836
|
-
/** The first commit retry wait, in milliseconds. Default:
|
|
2884
|
+
/** The first commit retry wait, in milliseconds. Default: 200. */
|
|
2837
2885
|
get commitMinBackoffMs(): number
|
|
2838
2886
|
/**
|
|
2839
2887
|
* Set the first commit retry wait, in milliseconds.
|
|
@@ -2843,7 +2891,7 @@ export declare class IcebergOptions {
|
|
|
2843
2891
|
* Throws when the wait is not a whole non-negative number of at most 2^53.
|
|
2844
2892
|
*/
|
|
2845
2893
|
set commitMinBackoffMs(waitMs: number)
|
|
2846
|
-
/** The largest commit retry wait, in milliseconds. Default:
|
|
2894
|
+
/** The largest commit retry wait, in milliseconds. Default: 4000. */
|
|
2847
2895
|
get commitMaxBackoffMs(): number
|
|
2848
2896
|
/**
|
|
2849
2897
|
* Set the largest commit retry wait, in milliseconds.
|
|
@@ -2853,7 +2901,7 @@ export declare class IcebergOptions {
|
|
|
2853
2901
|
* Throws when the wait is not a whole non-negative number of at most 2^53.
|
|
2854
2902
|
*/
|
|
2855
2903
|
set commitMaxBackoffMs(waitMs: number)
|
|
2856
|
-
/** The total commit retry-delay budget, in milliseconds. Default:
|
|
2904
|
+
/** The total commit retry-delay budget, in milliseconds. Default: 60000. */
|
|
2857
2905
|
get commitTotalTimeoutMs(): number
|
|
2858
2906
|
/**
|
|
2859
2907
|
* Set the total commit retry-delay budget, in milliseconds.
|
|
@@ -2895,9 +2943,10 @@ export declare class IcebergOptions {
|
|
|
2895
2943
|
set readParallelMinFiles(files: number)
|
|
2896
2944
|
/**
|
|
2897
2945
|
* How many partition groups a commit writes at once. Default: the
|
|
2898
|
-
* resolved `readParallelism
|
|
2899
|
-
*
|
|
2900
|
-
*
|
|
2946
|
+
* resolved `readParallelism` capped at the writers the process memory
|
|
2947
|
+
* budget holds, 288 MiB each; a stated count is never capped; 1 writes
|
|
2948
|
+
* them one after another. The manifest lists a commit's files in
|
|
2949
|
+
* partition-group order whatever the value.
|
|
2901
2950
|
*/
|
|
2902
2951
|
get writeParallelism(): number
|
|
2903
2952
|
/**
|
|
@@ -2911,7 +2960,7 @@ export declare class IcebergOptions {
|
|
|
2911
2960
|
set writeParallelism(threads: number)
|
|
2912
2961
|
/**
|
|
2913
2962
|
* How many partitions an append, an overwrite or a compaction holds
|
|
2914
|
-
* open at once. Default:
|
|
2963
|
+
* open at once. Default: 8. Past it, the open partition of the
|
|
2915
2964
|
* lowest tuple closes and its files are written while the source is
|
|
2916
2965
|
* still read, so a source in partition order is written as it arrives
|
|
2917
2966
|
* and never held whole; a partition arriving again after it closed is
|
|
@@ -2930,8 +2979,11 @@ export declare class IcebergOptions {
|
|
|
2930
2979
|
set maxOpenPartitions(partitions: number)
|
|
2931
2980
|
/**
|
|
2932
2981
|
* Where a commit stages its files before uploading them: `"off"`, or
|
|
2933
|
-
* a local folder URL. `null` - the default - is the table's own
|
|
2934
|
-
*
|
|
2982
|
+
* a local folder URL. `null` - the default - is the table's own,
|
|
2983
|
+
* decided per file: off for a file of bare local storage, the temporary
|
|
2984
|
+
* folder for any other - an object store's, a bridged filesystem's, an
|
|
2985
|
+
* HTTP origin's - but a data file whose handle streams its own whole
|
|
2986
|
+
* write, as a bridged filesystem's does.
|
|
2935
2987
|
*/
|
|
2936
2988
|
get writeStaging(): string | null
|
|
2937
2989
|
/**
|
|
@@ -4313,9 +4365,9 @@ export declare class MarketMessage {
|
|
|
4313
4365
|
/**
|
|
4314
4366
|
* The one message row, `fixmsg`: the element, event, market,
|
|
4315
4367
|
* operation, source and session columns, the two holders
|
|
4316
|
-
* `trdregtimestamps` and `parties`,
|
|
4317
|
-
*
|
|
4318
|
-
*
|
|
4368
|
+
* `trdregtimestamps` and `parties`, then `metadata` and `entries` -
|
|
4369
|
+
* every stated entry no column of the row holds, an identifier's
|
|
4370
|
+
* statement among them.
|
|
4319
4371
|
*/
|
|
4320
4372
|
static field(): Field
|
|
4321
4373
|
/** The registry this message's entries were typed by, sharing it. */
|
|
@@ -4356,16 +4408,17 @@ export declare class MarketMessage {
|
|
|
4356
4408
|
get metadata(): Record<string, string>
|
|
4357
4409
|
/**
|
|
4358
4410
|
* The business category the message's type files under, as the
|
|
4359
|
-
* `marketdatakind` member's stored name - `
|
|
4360
|
-
* `TRAD`, `BOOK` -
|
|
4411
|
+
* `marketdatakind` member's stored name - `OPER` (an order, a quote or
|
|
4412
|
+
* an execution, which `marketdatatype` tells apart), `TRAD`, `BOOK` -
|
|
4413
|
+
* and `UKNW` where it files none.
|
|
4361
4414
|
*/
|
|
4362
4415
|
get marketdatakind(): string
|
|
4363
4416
|
/**
|
|
4364
4417
|
* The strike price of the option the message identifies - its market
|
|
4365
|
-
* fact `
|
|
4418
|
+
* fact `strikeprice`, derived from `StrikePrice(202)` - as decimal text, or
|
|
4366
4419
|
* `null`.
|
|
4367
4420
|
*/
|
|
4368
|
-
get
|
|
4421
|
+
get strikeprice(): string | null
|
|
4369
4422
|
/**
|
|
4370
4423
|
* This message's own `UUIDv7` identity, ordered by millisecond and
|
|
4371
4424
|
* sequence with a content payload seeded by its cross hash, as
|
|
@@ -4379,9 +4432,10 @@ export declare class MarketMessage {
|
|
|
4379
4432
|
get crossuuid(): string
|
|
4380
4433
|
/**
|
|
4381
4434
|
* The code the chain is named by, stored as `{kind}:{side}:{base}` - the
|
|
4382
|
-
* `MarketDataKind` code, the `Side` code of a sided
|
|
4383
|
-
*
|
|
4384
|
-
* `10:1:O-1`
|
|
4435
|
+
* `MarketDataKind` code, the `Side` code of a sided message - an
|
|
4436
|
+
* operation its type makes no quote - (`0` for any other) and the
|
|
4437
|
+
* identifier the message names, so a buy order `O-1` is `10:1:O-1` and
|
|
4438
|
+
* a quote `Q-1` `10:0:Q-1` - or empty where it names none.
|
|
4385
4439
|
*/
|
|
4386
4440
|
get crosscode(): string
|
|
4387
4441
|
/** The XXH3-64 over everything this message says. */
|
|
@@ -4494,7 +4548,7 @@ export declare class MarketMessage {
|
|
|
4494
4548
|
* The bid size the message states, `BidSize(134)`, as decimal text, or
|
|
4495
4549
|
* `null`.
|
|
4496
4550
|
*/
|
|
4497
|
-
get
|
|
4551
|
+
get bidsize(): string | null
|
|
4498
4552
|
/**
|
|
4499
4553
|
* The currency the bid is stated in: a stated `BidCurrency`, else the
|
|
4500
4554
|
* message's currency where it states a bid; `null` otherwise.
|
|
@@ -4504,18 +4558,18 @@ export declare class MarketMessage {
|
|
|
4504
4558
|
* The offer price the message states, `OfferPx(133)`, as decimal text, or
|
|
4505
4559
|
* `null`.
|
|
4506
4560
|
*/
|
|
4507
|
-
get
|
|
4561
|
+
get offerpx(): string | null
|
|
4508
4562
|
/**
|
|
4509
4563
|
* The offer size the message states, `OfferSize(135)`, as decimal text,
|
|
4510
4564
|
* or `null`.
|
|
4511
4565
|
*/
|
|
4512
|
-
get
|
|
4566
|
+
get offersize(): string | null
|
|
4513
4567
|
/**
|
|
4514
4568
|
* The currency the offer is stated in: a stated `AskCurrency` or
|
|
4515
4569
|
* `OfferCurrency`, else the message's currency where it states an offer;
|
|
4516
4570
|
* `null` otherwise.
|
|
4517
4571
|
*/
|
|
4518
|
-
get
|
|
4572
|
+
get offerccy(): string | null
|
|
4519
4573
|
/**
|
|
4520
4574
|
* The names the operation goes by, each typed by the field that
|
|
4521
4575
|
* stated it - `orderid`, `clordid`, `execid`, `quoteid`, `tradeid` and
|
|
@@ -4549,13 +4603,13 @@ export declare class MarketMessage {
|
|
|
4549
4603
|
* The unit the quantity is counted in, `UnitOfMeasure(996)`; empty
|
|
4550
4604
|
* where none is stated.
|
|
4551
4605
|
*/
|
|
4552
|
-
get
|
|
4606
|
+
get unitofmeasure(): string
|
|
4553
4607
|
/**
|
|
4554
4608
|
* The instrument's minimum tradable quantity - its board lot - where the
|
|
4555
4609
|
* message (`RoundLot(561)`) or its product row states one, as decimal
|
|
4556
4610
|
* text; `null` where neither does, never a multiplier.
|
|
4557
4611
|
*/
|
|
4558
|
-
get
|
|
4612
|
+
get roundlot(): string | null
|
|
4559
4613
|
/**
|
|
4560
4614
|
* The type of its kind the message is, as the `marketdatatype` member's
|
|
4561
4615
|
* stored name: `UKNW` where none.
|
|
@@ -4586,18 +4640,14 @@ export declare class MarketMessage {
|
|
|
4586
4640
|
get lastpx(): string | null
|
|
4587
4641
|
/** The quantity it last traded, `LastQty(32)`, or `null`. */
|
|
4588
4642
|
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
4643
|
/** The bid leg's spot rate, `BidSpotRate(188)`, as decimal text, or `null`. */
|
|
4594
4644
|
get bidspotrate(): string | null
|
|
4595
4645
|
/** The bid leg's forward points, `BidForwardPoints(189)`, as decimal text, or `null`. */
|
|
4596
4646
|
get bidforwardpoints(): string | null
|
|
4597
4647
|
/** The ask leg's spot rate, `OfferSpotRate(190)`, as decimal text, or `null`. */
|
|
4598
|
-
get
|
|
4648
|
+
get offerspotrate(): string | null
|
|
4599
4649
|
/** The ask leg's forward points, `OfferForwardPoints(191)`, as decimal text, or `null`. */
|
|
4600
|
-
get
|
|
4650
|
+
get offerforwardpoints(): string | null
|
|
4601
4651
|
/** The price it averaged, `AvgPx(6)`, or `null`. */
|
|
4602
4652
|
get avgpx(): string | null
|
|
4603
4653
|
/** How much of its quantity is done, `CumQty(14)`, or `null`. */
|
|
@@ -4612,12 +4662,12 @@ export declare class MarketMessage {
|
|
|
4612
4662
|
/** The quantity that statement settled on, or `null`. */
|
|
4613
4663
|
get prevqty(): string | null
|
|
4614
4664
|
/** The spot part of an FX forward price, as decimal text, or `null`. */
|
|
4615
|
-
get
|
|
4665
|
+
get lastspotrate(): string | null
|
|
4616
4666
|
/**
|
|
4617
4667
|
* The forward points of an FX forward price, as decimal text, or
|
|
4618
4668
|
* `null`.
|
|
4619
4669
|
*/
|
|
4620
|
-
get
|
|
4670
|
+
get lastforwardpoints(): string | null
|
|
4621
4671
|
/**
|
|
4622
4672
|
* How long the message stands, `TimeInForce(59)`, as the `timeinforce`
|
|
4623
4673
|
* member's stored name - `DAY`, `GTC`, a venue's own value `OTHER` -
|
|
@@ -4628,7 +4678,7 @@ export declare class MarketMessage {
|
|
|
4628
4678
|
* The quantity the order asked for, as decimal text, or `null` where
|
|
4629
4679
|
* none is stated.
|
|
4630
4680
|
*/
|
|
4631
|
-
get
|
|
4681
|
+
get orderqty(): string | null
|
|
4632
4682
|
/**
|
|
4633
4683
|
* Whether the product could be traded when the message was sent, or
|
|
4634
4684
|
* `null` where the market said nothing either way - which is not the
|
|
@@ -4639,7 +4689,7 @@ export declare class MarketMessage {
|
|
|
4639
4689
|
* The instrument's classification, read off `CFICode(461)` and what
|
|
4640
4690
|
* the message says about the security, or `null` where nothing does.
|
|
4641
4691
|
*/
|
|
4642
|
-
get
|
|
4692
|
+
get cficode(): string | null
|
|
4643
4693
|
/**
|
|
4644
4694
|
* The market, read off `SecurityExchange(207)`, `ExDestination(100)` or
|
|
4645
4695
|
* `LastMkt(30)`, the first that names an ISO 10383 MIC.
|
|
@@ -5865,8 +5915,9 @@ export declare class RecordOptions {
|
|
|
5865
5915
|
* The parts are an Iceberg commit's partition groups, written side by
|
|
5866
5916
|
* side; a leaf of one file reads it as the bound on its encoding's
|
|
5867
5917
|
* threads. `null` is the destination's own answer: an Iceberg table's
|
|
5868
|
-
* `write.parallelism`, else its `read.parallelism
|
|
5869
|
-
* the
|
|
5918
|
+
* `write.parallelism`, else its `read.parallelism` (the process's
|
|
5919
|
+
* threads where nothing states it) capped at the writers the process
|
|
5920
|
+
* memory budget holds at 288 MiB each.
|
|
5870
5921
|
*/
|
|
5871
5922
|
get numThreads(): number | null
|
|
5872
5923
|
/**
|
|
@@ -6469,6 +6520,11 @@ export declare class Scalar {
|
|
|
6469
6520
|
intoJsonBytes(): Buffer
|
|
6470
6521
|
/** Encode this value as natural compact JSON UTF-8. */
|
|
6471
6522
|
intoJson(): string
|
|
6523
|
+
/**
|
|
6524
|
+
* The natural JSON document `intoJson` encodes, decoded: what
|
|
6525
|
+
* `JSON.stringify` writes for this value.
|
|
6526
|
+
*/
|
|
6527
|
+
toJSON(): any
|
|
6472
6528
|
/** Natural compact JSON for the standard JavaScript string protocol. */
|
|
6473
6529
|
toString(): string
|
|
6474
6530
|
/**
|
|
@@ -6685,6 +6741,13 @@ export declare class Serie {
|
|
|
6685
6741
|
at(index: number): Scalar | null
|
|
6686
6742
|
/** Every row, each built once and kept by the array alone. */
|
|
6687
6743
|
rows(): Array<Scalar>
|
|
6744
|
+
/**
|
|
6745
|
+
* Every row of a record column as a plain object keyed by column name:
|
|
6746
|
+
* each cell its natural JSON (`Scalar.intoJson`), a 64-bit integer the
|
|
6747
|
+
* exact `bigint` and a null cell `null`. A nested cell is its natural
|
|
6748
|
+
* JSON document whole, so a 64-bit integer inside one is a number.
|
|
6749
|
+
*/
|
|
6750
|
+
toRecords(): Array<Record<string, unknown>>
|
|
6688
6751
|
/** This serie as the one value a `Scalar` sequence holds. */
|
|
6689
6752
|
intoScalar(): Scalar
|
|
6690
6753
|
/** Remove row `index` and answer it. */
|
|
@@ -7805,8 +7868,9 @@ export declare class TextOptions {
|
|
|
7805
7868
|
* The parts are an Iceberg commit's partition groups, written side by
|
|
7806
7869
|
* side; a leaf of one file reads it as the bound on its encoding's
|
|
7807
7870
|
* threads. `null` is the destination's own answer: an Iceberg table's
|
|
7808
|
-
* `write.parallelism`, else its `read.parallelism
|
|
7809
|
-
* the
|
|
7871
|
+
* `write.parallelism`, else its `read.parallelism` (the process's
|
|
7872
|
+
* threads where nothing states it) capped at the writers the process
|
|
7873
|
+
* memory budget holds at 288 MiB each.
|
|
7810
7874
|
*/
|
|
7811
7875
|
get numThreads(): number | null
|
|
7812
7876
|
/**
|
|
@@ -8205,6 +8269,37 @@ export declare class TxHasher {
|
|
|
8205
8269
|
}
|
|
8206
8270
|
export type JsTxHasher = TxHasher
|
|
8207
8271
|
|
|
8272
|
+
/**
|
|
8273
|
+
* The table of underlyings (`yggio_market::Underlyings`), its essential
|
|
8274
|
+
* doors: the seed, a row by code, a search. Rows cross as a `Serie` under
|
|
8275
|
+
* `fixUnderlyingField()`, the field the seed's rows are read under. The
|
|
8276
|
+
* table is shared: a codec it is given to (`FixCodec.withUnderlyings`)
|
|
8277
|
+
* resolves its messages against it and creates the rows they name.
|
|
8278
|
+
*/
|
|
8279
|
+
export declare class Underlyings {
|
|
8280
|
+
/**
|
|
8281
|
+
* The embedded seed: its instruments and the default rows of every
|
|
8282
|
+
* register kind (`Underlyings::seeded`).
|
|
8283
|
+
*/
|
|
8284
|
+
static seeded(): Underlyings
|
|
8285
|
+
/**
|
|
8286
|
+
* The row `code` names (`Underlyings::get`): a code, an instrument key,
|
|
8287
|
+
* an index key `{key}={value}` or a bare identity value, as a one-row
|
|
8288
|
+
* `Serie` under `fixUnderlyingField()`; `null` where none.
|
|
8289
|
+
*/
|
|
8290
|
+
get(code: string): JsSerie | null
|
|
8291
|
+
/**
|
|
8292
|
+
* The rows `text` names, strongest first, each once, at most `limit`
|
|
8293
|
+
* (20 by default) (`Underlyings::search`): the exact code, an
|
|
8294
|
+
* identifier the key index answers, then a ticker, a name or an alias;
|
|
8295
|
+
* a `Serie` under `fixUnderlyingField()`, empty for a blank text.
|
|
8296
|
+
*/
|
|
8297
|
+
search(text: string, limit?: number | undefined | null): JsSerie
|
|
8298
|
+
/** How many rows the table holds (`Underlyings::len`). */
|
|
8299
|
+
get length(): number
|
|
8300
|
+
}
|
|
8301
|
+
export type JsUnderlyings = Underlyings
|
|
8302
|
+
|
|
8208
8303
|
/** A normalized URI backed by the validated Rust core. */
|
|
8209
8304
|
export declare class Uri {
|
|
8210
8305
|
/** Parse a URI expression or cheaply clone another native `Uri`. */
|
|
@@ -9151,19 +9246,19 @@ export interface FixCaptureView {
|
|
|
9151
9246
|
/**
|
|
9152
9247
|
* The bridge header's event key, `{session}:{context}:{sequence}` -
|
|
9153
9248
|
* `7896a78:a0204ec340:8d8` - captured whole: what one session event's
|
|
9154
|
-
* observations share; also `byTag(
|
|
9249
|
+
* observations share; also `byTag(65062)`.
|
|
9155
9250
|
*/
|
|
9156
9251
|
msgeventkey: string | null
|
|
9157
9252
|
/**
|
|
9158
9253
|
* The plugin the message came into a bridge through, as the bridge's
|
|
9159
9254
|
* log line names it - `OMS_X1_OrderOut` in `Message received: ... from
|
|
9160
|
-
* (OMS_X1_OrderOut as CL000000382)`; also `byTag(
|
|
9255
|
+
* (OMS_X1_OrderOut as CL000000382)`; also `byTag(65033)`.
|
|
9161
9256
|
*/
|
|
9162
9257
|
msgoriginator: string | null
|
|
9163
9258
|
/**
|
|
9164
9259
|
* The conversation a bridge filed the message under - a
|
|
9165
9260
|
* `CONVERSATIONID` the message stated, else the `{conversationId: ..}`
|
|
9166
|
-
* of its log line; also `byTag(
|
|
9261
|
+
* of its log line; also `byTag(65034)`.
|
|
9167
9262
|
*/
|
|
9168
9263
|
conversationid: string | null
|
|
9169
9264
|
}
|
|
@@ -9328,7 +9423,7 @@ export interface FixCommitReport {
|
|
|
9328
9423
|
* FIX dictionary publishes, at the datatype its graph column names,
|
|
9329
9424
|
* numbered from `65001` in the block's order, a retired tag's gap never
|
|
9330
9425
|
* refilled. The strike
|
|
9331
|
-
* price is the derived market fact `
|
|
9426
|
+
* price is the derived market fact `strikeprice` over `StrikePrice(202)`, and a
|
|
9332
9427
|
* bridge's own identifier keys are no crate field either: they arrive as
|
|
9333
9428
|
* unmapped entries and are read for the identifier name they end with.
|
|
9334
9429
|
*
|
|
@@ -9513,6 +9608,16 @@ export declare function fixPluginField(): Field
|
|
|
9513
9608
|
*/
|
|
9514
9609
|
export declare function fixPluginSide(pluginType: string): string
|
|
9515
9610
|
|
|
9611
|
+
/**
|
|
9612
|
+
* The row a FIX dictionary is laid out as, `fixdefinition`: one per scalar
|
|
9613
|
+
* field, named definition, code set and source, and one for the plugin
|
|
9614
|
+
* dictionary - `category`, `shard`, `tag`, `name`, `nullable`, `dtype`,
|
|
9615
|
+
* `metadata`, `children` and `members` - keyed by `category`, `tag` and
|
|
9616
|
+
* `name`, declaring `SORT:by` the three and `PARTITION:by`
|
|
9617
|
+
* `["category", "shard"]` (`FixRegistry`'s `Registry::row_field`).
|
|
9618
|
+
*/
|
|
9619
|
+
export declare function fixRegistryField(): Field
|
|
9620
|
+
|
|
9516
9621
|
/** What `addSource` records beside the id: each left out states nothing. */
|
|
9517
9622
|
export interface FixSourceOptions {
|
|
9518
9623
|
/**
|
|
@@ -10263,3 +10368,966 @@ export interface TimezoneAlias {
|
|
|
10263
10368
|
/** The canonical name it resolves to. */
|
|
10264
10369
|
canonical: string
|
|
10265
10370
|
}
|
|
10371
|
+
|
|
10372
|
+
export declare namespace ai {
|
|
10373
|
+
/**
|
|
10374
|
+
* An agent: a model, a system prompt and tools, run in a loop until the
|
|
10375
|
+
* model ends its turn.
|
|
10376
|
+
*/
|
|
10377
|
+
export class Agent {
|
|
10378
|
+
/**
|
|
10379
|
+
* An agent of the caller's own: `{ llm, system?, tools?, call(toolUse),
|
|
10380
|
+
* maxTurns? }`, `call` answering each tool call, `{ id, name, input }`,
|
|
10381
|
+
* with a text or `{ content, is_error }`. `call` is called on this thread during the
|
|
10382
|
+
* run; what it throws is rethrown from the run.
|
|
10383
|
+
*/
|
|
10384
|
+
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
|
|
10385
|
+
/**
|
|
10386
|
+
* Run the conversation until the model ends its turn: the final
|
|
10387
|
+
* `Reply`, every turn appended to `messages` in place.
|
|
10388
|
+
*/
|
|
10389
|
+
run(messages: Array<object>): ai.Reply
|
|
10390
|
+
/** `run`, each step reported to `onEvent` as it happens. */
|
|
10391
|
+
runWith(messages: Array<object>, onEvent: (event: AgentEvent) => void): ai.Reply
|
|
10392
|
+
}
|
|
10393
|
+
export type JsAgent = Agent
|
|
10394
|
+
/**
|
|
10395
|
+
* Where a model is called: Anthropic's API, Amazon Bedrock, Moonshot's API
|
|
10396
|
+
* or this machine.
|
|
10397
|
+
*/
|
|
10398
|
+
export class Backend {
|
|
10399
|
+
/** Anthropic's API under `apiKey`. */
|
|
10400
|
+
static anthropic(apiKey: string): Backend
|
|
10401
|
+
/**
|
|
10402
|
+
* Amazon Bedrock: Claude in Amazon Bedrock for a model it serves,
|
|
10403
|
+
* Converse for any other.
|
|
10404
|
+
*/
|
|
10405
|
+
static bedrock(options?: ai.BedrockInit | undefined | null): Backend
|
|
10406
|
+
/** Moonshot's Anthropic-compatible API under `apiKey`. */
|
|
10407
|
+
static moonshot(apiKey: string): Backend
|
|
10408
|
+
/**
|
|
10409
|
+
* Anthropic's API when `ANTHROPIC_API_KEY` is set and not blank, else
|
|
10410
|
+
* Amazon Bedrock from the default AWS chain.
|
|
10411
|
+
*/
|
|
10412
|
+
static fromEnv(): Backend
|
|
10413
|
+
/** `model` - a `Model` or any spelling of one - as an `Llm` here. */
|
|
10414
|
+
llm(model: ai.Model | string): ai.Llm
|
|
10415
|
+
/** The backend with no credential in it: `Anthropic(<redacted>)`. */
|
|
10416
|
+
toString(): string
|
|
10417
|
+
}
|
|
10418
|
+
export type JsBackend = Backend
|
|
10419
|
+
/** How a `Task`'s reply is scored: 1 when it holds, else 0. */
|
|
10420
|
+
export class Check {
|
|
10421
|
+
/** The reply's text, trimmed, is `text` exactly. */
|
|
10422
|
+
static exact(text: string): Check
|
|
10423
|
+
/** The reply's text holds every one of `needles`, case ignored. */
|
|
10424
|
+
static contains(needles: Array<string>): Check
|
|
10425
|
+
/**
|
|
10426
|
+
* The reply's text, trimmed and a final `.` or `!` dropped, is one of
|
|
10427
|
+
* `accepted`, case ignored.
|
|
10428
|
+
*/
|
|
10429
|
+
static oneOf(accepted: Array<string>): Check
|
|
10430
|
+
/**
|
|
10431
|
+
* The last number the reply's text writes is `expected`, within a
|
|
10432
|
+
* relative 1e-6.
|
|
10433
|
+
*/
|
|
10434
|
+
static number(expected: number): Check
|
|
10435
|
+
/**
|
|
10436
|
+
* The reply's text holds a JSON object - bare or in a code fence -
|
|
10437
|
+
* with every one of `keys`.
|
|
10438
|
+
*/
|
|
10439
|
+
static json(keys: Array<string>): Check
|
|
10440
|
+
/**
|
|
10441
|
+
* The reply's text matches `pattern` (the `regex` crate's syntax); a
|
|
10442
|
+
* pattern that does not compile matches nothing.
|
|
10443
|
+
*/
|
|
10444
|
+
static regex(pattern: string): Check
|
|
10445
|
+
/** The reply calls the tool `name`. */
|
|
10446
|
+
static toolCall(name: string): Check
|
|
10447
|
+
}
|
|
10448
|
+
export type JsCheck = Check
|
|
10449
|
+
/**
|
|
10450
|
+
* The coding agent: a model working in a workspace through a toolkit, told
|
|
10451
|
+
* `CODER_PROMPT` and the workspace root.
|
|
10452
|
+
*/
|
|
10453
|
+
export class Coder {
|
|
10454
|
+
/** `llm` working through `toolkit`, which the coder takes. */
|
|
10455
|
+
constructor(llm: ai.Llm, toolkit: ai.Toolkit, options?: ai.CoderInit | undefined | null)
|
|
10456
|
+
/**
|
|
10457
|
+
* Run the conversation until the model ends its turn: the final
|
|
10458
|
+
* `Reply`, every turn appended to `messages` in place. The call blocks
|
|
10459
|
+
* while the model and the tools run.
|
|
10460
|
+
*/
|
|
10461
|
+
run(messages: Array<object>): ai.Reply
|
|
10462
|
+
/** `run`, each step reported to `onEvent` as it happens. */
|
|
10463
|
+
runWith(messages: Array<object>, onEvent: (event: AgentEvent) => void): ai.Reply
|
|
10464
|
+
/** The tools it answers through. */
|
|
10465
|
+
get tools(): Array<{ name: string; description: string; input_schema: object }>
|
|
10466
|
+
/** The permissions its toolkit runs calls under. */
|
|
10467
|
+
get permissions(): string
|
|
10468
|
+
/** Run every later call under `permissions`. */
|
|
10469
|
+
set permissions(permissions: string)
|
|
10470
|
+
}
|
|
10471
|
+
export type JsCoder = Coder
|
|
10472
|
+
/** A teacher model refining a student model. */
|
|
10473
|
+
export class Distiller {
|
|
10474
|
+
/** `student` taught by `teacher`; both stay usable by the caller. */
|
|
10475
|
+
constructor(teacher: JsLlm, student: JsLlm, options?: ai.DistillerOptions | undefined | null)
|
|
10476
|
+
/** The teacher's answer to each of `prompts`, in order. */
|
|
10477
|
+
examples(prompts: Array<string>): Array<ai.Example>
|
|
10478
|
+
/**
|
|
10479
|
+
* The student's answer to each example under `system` (none when not
|
|
10480
|
+
* given), graded against the teacher's.
|
|
10481
|
+
*/
|
|
10482
|
+
evaluate(examples: Array<ai.Example>, system?: string | undefined | null): ai.Report
|
|
10483
|
+
/**
|
|
10484
|
+
* Up to `rounds` rounds of system-prompt optimization, each kept when
|
|
10485
|
+
* the student scores better under it.
|
|
10486
|
+
*/
|
|
10487
|
+
refine(examples: Array<ai.Example>, rounds: number): ai.Refinement
|
|
10488
|
+
}
|
|
10489
|
+
export type JsDistiller = Distiller
|
|
10490
|
+
/** A prompt and the teacher's answer to it. */
|
|
10491
|
+
export class Example {
|
|
10492
|
+
/** The example asking `prompt`, answered `answer`. */
|
|
10493
|
+
constructor(prompt: string, answer: string)
|
|
10494
|
+
/** What was asked. */
|
|
10495
|
+
get prompt(): string
|
|
10496
|
+
/** What the teacher answered. */
|
|
10497
|
+
get answer(): string
|
|
10498
|
+
}
|
|
10499
|
+
export type JsExample = Example
|
|
10500
|
+
/**
|
|
10501
|
+
* The Hugging Face Hub: what a repository holds, and its files fetched
|
|
10502
|
+
* once into a cache.
|
|
10503
|
+
*/
|
|
10504
|
+
export class Hub {
|
|
10505
|
+
/**
|
|
10506
|
+
* The Hub the environment names, each knob `options` states in its
|
|
10507
|
+
* place.
|
|
10508
|
+
*/
|
|
10509
|
+
constructor(options?: ai.HubOptions | undefined | null)
|
|
10510
|
+
/** The cache folder. */
|
|
10511
|
+
get cache(): string
|
|
10512
|
+
/** What the Hub states about `repo`: one request. */
|
|
10513
|
+
info(repo: string): ai.RepoInfo
|
|
10514
|
+
/**
|
|
10515
|
+
* The local path of `file` of `repo` at its default revision, fetched
|
|
10516
|
+
* into the cache unless it is there.
|
|
10517
|
+
*/
|
|
10518
|
+
file(repo: string, file: string): string
|
|
10519
|
+
/**
|
|
10520
|
+
* The local path of `file` of `repo` at `revision`, fetched into the
|
|
10521
|
+
* cache unless it is there.
|
|
10522
|
+
*/
|
|
10523
|
+
fileAt(repo: string, revision: string, file: string): string
|
|
10524
|
+
/**
|
|
10525
|
+
* The cached path of `file` of `repo` at `revision`; `null` when the
|
|
10526
|
+
* cache does not hold it. Fetches nothing.
|
|
10527
|
+
*/
|
|
10528
|
+
cached(repo: string, revision: string, file: string): string | null
|
|
10529
|
+
}
|
|
10530
|
+
export type JsHub = Hub
|
|
10531
|
+
/** The key performance indicators of a run of calls. Times are in seconds. */
|
|
10532
|
+
export class Kpis {
|
|
10533
|
+
/** Calls made, failed ones included. */
|
|
10534
|
+
get requests(): number
|
|
10535
|
+
/** Calls that failed. */
|
|
10536
|
+
get failures(): number
|
|
10537
|
+
/** Input tokens read uncached. */
|
|
10538
|
+
get inputTokens(): number
|
|
10539
|
+
/** Output tokens written. */
|
|
10540
|
+
get outputTokens(): number
|
|
10541
|
+
/** Input tokens read from the prompt cache. */
|
|
10542
|
+
get cacheReadInputTokens(): number
|
|
10543
|
+
/** Input tokens written to the prompt cache. */
|
|
10544
|
+
get cacheCreationInputTokens(): number
|
|
10545
|
+
/** What someone bills for the calls, in US dollars. */
|
|
10546
|
+
get cost(): number
|
|
10547
|
+
/** What the calls of a simulated price - a local model's - would cost. */
|
|
10548
|
+
get simulatedCost(): number
|
|
10549
|
+
/** Calls of a model that states no price. */
|
|
10550
|
+
get unpriced(): number
|
|
10551
|
+
/** The calls' time summed, in seconds. */
|
|
10552
|
+
get elapsed(): number
|
|
10553
|
+
/**
|
|
10554
|
+
* The delay to the first streamed text, summed over the calls that
|
|
10555
|
+
* streamed any, in seconds.
|
|
10556
|
+
*/
|
|
10557
|
+
get firstText(): number
|
|
10558
|
+
/** The billed and the simulated cost together. */
|
|
10559
|
+
totalCost(): number
|
|
10560
|
+
/** Output tokens per second of call time. */
|
|
10561
|
+
outputTokensPerSecond(): number
|
|
10562
|
+
/** The mean time of a call, in seconds. */
|
|
10563
|
+
meanLatency(): number
|
|
10564
|
+
/** `3 calls · 1.2k in · 340 out · $0.0123 · 2.3s · 148 tok/s`. */
|
|
10565
|
+
toString(): string
|
|
10566
|
+
}
|
|
10567
|
+
export type JsKpis = Kpis
|
|
10568
|
+
/**
|
|
10569
|
+
* A language model behind one call: Claude, Converse, a local model, a
|
|
10570
|
+
* monitored or routed model, or a caller's own.
|
|
10571
|
+
*/
|
|
10572
|
+
export class Llm {
|
|
10573
|
+
/** Claude from Anthropic's API under `apiKey`. */
|
|
10574
|
+
static claude(apiKey: string, options?: ai.ClaudeInit | undefined | null): Llm
|
|
10575
|
+
/**
|
|
10576
|
+
* `model` on Amazon Bedrock - Claude in Amazon Bedrock where it serves
|
|
10577
|
+
* the model, Converse otherwise - under the identity `options` states;
|
|
10578
|
+
* Claude's default model when left out.
|
|
10579
|
+
*/
|
|
10580
|
+
static bedrock(model?: JsModel | string | undefined | null, options?: BedrockInit | undefined | null): Llm
|
|
10581
|
+
/** Kimi from Moonshot's Anthropic-compatible API under `apiKey`. */
|
|
10582
|
+
static moonshot(apiKey: string, options?: ai.MoonshotInit | undefined | null): Llm
|
|
10583
|
+
/**
|
|
10584
|
+
* A model of the caller's own: `{ model, complete(request) }`, where
|
|
10585
|
+
* `model` is a `Model` or a model name and `complete` answers an
|
|
10586
|
+
* `LlmRequest` with a `Reply`, a text, or a Messages API message object.
|
|
10587
|
+
* `complete` is called on this thread during the door that asks the
|
|
10588
|
+
* model; what it throws is rethrown from that door. A value with no
|
|
10589
|
+
* `model` is refused with a `TypeError` naming the member.
|
|
10590
|
+
*/
|
|
10591
|
+
static fromValue(value: { model: Model | string; complete(request: LlmRequest): Reply | string | object }): Llm
|
|
10592
|
+
/**
|
|
10593
|
+
* `fallback`, every request taking one of `routes` - `[Route, Llm]`
|
|
10594
|
+
* pairs, the first that takes it - sent to that route's model instead.
|
|
10595
|
+
*/
|
|
10596
|
+
static router(fallback: Llm, routes?: Array<[Route, Llm]>): Llm
|
|
10597
|
+
/** The same model, every call counted by `meter`. */
|
|
10598
|
+
monitored(meter: JsMeter): ai.Llm
|
|
10599
|
+
/** The model it asks. */
|
|
10600
|
+
get model(): JsModel
|
|
10601
|
+
/**
|
|
10602
|
+
* Answer `request` - an `LlmRequest`, or a text as one user message -
|
|
10603
|
+
* whole. The call blocks until the model answers.
|
|
10604
|
+
*/
|
|
10605
|
+
complete(request: JsRequest | string): JsReply
|
|
10606
|
+
/**
|
|
10607
|
+
* Answer `request`, calling `onText` with each piece of text as the
|
|
10608
|
+
* model writes it; the same accumulated `Reply` as `complete`.
|
|
10609
|
+
*/
|
|
10610
|
+
stream(request: JsRequest | string, onText: (arg: string) => void): JsReply
|
|
10611
|
+
/**
|
|
10612
|
+
* The variant and the model's identifier, never a credential:
|
|
10613
|
+
* `Claude("claude-opus-5-5")`.
|
|
10614
|
+
*/
|
|
10615
|
+
toString(): string
|
|
10616
|
+
}
|
|
10617
|
+
export type JsLlm = Llm
|
|
10618
|
+
/**
|
|
10619
|
+
* One call of a model: a system prompt, the conversation, the tools, the
|
|
10620
|
+
* reply's bound, the effort and the stop sequences.
|
|
10621
|
+
*/
|
|
10622
|
+
export class LlmRequest {
|
|
10623
|
+
/**
|
|
10624
|
+
* A request of `user`, one user message after the options' messages,
|
|
10625
|
+
* the rest as `options` states.
|
|
10626
|
+
*/
|
|
10627
|
+
constructor(user?: string | undefined | null, options?: ai.RequestInit | undefined | null)
|
|
10628
|
+
/** The system prompt; `null` where none is set. */
|
|
10629
|
+
get system(): string | null
|
|
10630
|
+
/** The conversation, as Messages API messages. */
|
|
10631
|
+
get messages(): Array<{ role: 'user' | 'assistant'; content: Array<object> }>
|
|
10632
|
+
/** The tools the model may call. */
|
|
10633
|
+
get tools(): Array<{ name: string; description: string; input_schema: object }>
|
|
10634
|
+
/** The most tokens the reply may hold. */
|
|
10635
|
+
get maxTokens(): number
|
|
10636
|
+
/** The effort; `null` for the model's default. */
|
|
10637
|
+
get effort(): string | null
|
|
10638
|
+
/** Texts that end the reply. */
|
|
10639
|
+
get stopSequences(): Array<string>
|
|
10640
|
+
/**
|
|
10641
|
+
* A model-neutral estimate of the input tokens this request sends:
|
|
10642
|
+
* its bytes divided by four, rounded up.
|
|
10643
|
+
*/
|
|
10644
|
+
estimatedInputTokens(): number
|
|
10645
|
+
}
|
|
10646
|
+
export type JsRequest = LlmRequest
|
|
10647
|
+
/** What one model's folder holds, as its `manifest.json` states it. */
|
|
10648
|
+
export class Manifest {
|
|
10649
|
+
/** The model's identifier. */
|
|
10650
|
+
get model(): string
|
|
10651
|
+
/** What the files came from: the model's `local` identifier. */
|
|
10652
|
+
get source(): string
|
|
10653
|
+
/** The Hub commit the files are at; empty for a folder on disk. */
|
|
10654
|
+
get revision(): string
|
|
10655
|
+
/** The Hub repository the tokenizer came from; `null` where none did. */
|
|
10656
|
+
get tokenizer(): string | null
|
|
10657
|
+
/** Every stored file. */
|
|
10658
|
+
get files(): Array<ai.StoredFile>
|
|
10659
|
+
/** When this version was stored, in seconds since the Unix epoch. */
|
|
10660
|
+
get storedUnix(): number
|
|
10661
|
+
}
|
|
10662
|
+
export type JsManifest = Manifest
|
|
10663
|
+
/**
|
|
10664
|
+
* The totals of every call a monitored model makes, overall and per model
|
|
10665
|
+
* identifier. Every `Llm` monitored by one meter adds to the same totals.
|
|
10666
|
+
*/
|
|
10667
|
+
export class Meter {
|
|
10668
|
+
/** A meter that has seen no call. */
|
|
10669
|
+
constructor()
|
|
10670
|
+
/** The totals of every call. */
|
|
10671
|
+
total(): JsKpis
|
|
10672
|
+
/** The totals per model identifier, as a plain object. */
|
|
10673
|
+
byModel(): Record<string, Kpis>
|
|
10674
|
+
/** Forget every call seen. */
|
|
10675
|
+
reset(): void
|
|
10676
|
+
}
|
|
10677
|
+
export type JsMeter = Meter
|
|
10678
|
+
/**
|
|
10679
|
+
* A language model: its identity, the identifier each API names it by, the
|
|
10680
|
+
* other names it goes by, its limits and its price.
|
|
10681
|
+
*/
|
|
10682
|
+
export class Model {
|
|
10683
|
+
/**
|
|
10684
|
+
* The model `name` spells: a name the standard catalog holds
|
|
10685
|
+
* (`"sonnet"`, `"anthropic.claude-opus-5-5"`) is its model, any other
|
|
10686
|
+
* the card of itself, served where its spelling says.
|
|
10687
|
+
*/
|
|
10688
|
+
constructor(name: string)
|
|
10689
|
+
/**
|
|
10690
|
+
* A model stated by its facts: `id`, served under it by every API the
|
|
10691
|
+
* options do not switch, its limits as stated.
|
|
10692
|
+
*/
|
|
10693
|
+
static card(id: string, options?: ai.ModelCardInit | undefined | null): Model
|
|
10694
|
+
/** The canonical identifier: Anthropic's, for a Claude model. */
|
|
10695
|
+
get id(): string
|
|
10696
|
+
/** The other names it goes by. */
|
|
10697
|
+
get aliases(): Array<string>
|
|
10698
|
+
/** The most tokens a request's input may hold; `null` where unknown. */
|
|
10699
|
+
get maxInputTokens(): number | null
|
|
10700
|
+
/** The most tokens a reply may hold; `null` where unknown. */
|
|
10701
|
+
get maxOutputTokens(): number | null
|
|
10702
|
+
/** Whether a request may state an effort. */
|
|
10703
|
+
get effort(): boolean
|
|
10704
|
+
/** Whether Anthropic's API re-runs a declined request on another model. */
|
|
10705
|
+
get fallbacks(): boolean
|
|
10706
|
+
/** What its tokens cost; `null` where unknown. */
|
|
10707
|
+
get price(): JsPrice | null
|
|
10708
|
+
/**
|
|
10709
|
+
* The identifier `api` names the model by; `null` where `api` does not
|
|
10710
|
+
* serve it. `api` is one of `anthropic`, `bedrock`, `converse`,
|
|
10711
|
+
* `local`, `moonshot`.
|
|
10712
|
+
*/
|
|
10713
|
+
apiId(api: string): string | null
|
|
10714
|
+
/**
|
|
10715
|
+
* The `max_tokens` a request asking `asked` sends: `asked`, at most
|
|
10716
|
+
* what the model writes.
|
|
10717
|
+
*/
|
|
10718
|
+
replyTokens(asked: number): number
|
|
10719
|
+
/** Whether `other` is this very model, or one of the same identifier. */
|
|
10720
|
+
equals(other: ai.Model): boolean
|
|
10721
|
+
/** `Model(<id>)`. */
|
|
10722
|
+
toString(): string
|
|
10723
|
+
}
|
|
10724
|
+
export type JsModel = Model
|
|
10725
|
+
/**
|
|
10726
|
+
* The registry that finds a model by any of its names - its identifier,
|
|
10727
|
+
* an alias, an API's identifier, in any ASCII case.
|
|
10728
|
+
*/
|
|
10729
|
+
export class Models {
|
|
10730
|
+
/** An empty registry. */
|
|
10731
|
+
constructor()
|
|
10732
|
+
/**
|
|
10733
|
+
* A copy of the standard catalog: the Claude models, Kimi and the small
|
|
10734
|
+
* local models.
|
|
10735
|
+
*/
|
|
10736
|
+
static standard(): Models
|
|
10737
|
+
/** The model `name` finds; `null` where none does. */
|
|
10738
|
+
get(name: string): ai.Model | null
|
|
10739
|
+
/**
|
|
10740
|
+
* Register `model`, found from now on by every one of its names; a
|
|
10741
|
+
* model of the same identifier is replaced, a name another model holds
|
|
10742
|
+
* refused naming both.
|
|
10743
|
+
*/
|
|
10744
|
+
register(model: ai.Model | string): ai.Model
|
|
10745
|
+
/** How many models it holds. */
|
|
10746
|
+
get length(): number
|
|
10747
|
+
/** The models, in the order they were registered. */
|
|
10748
|
+
toArray(): Array<ai.Model>
|
|
10749
|
+
/** The model `name` finds, as an `Llm` on `backend`. */
|
|
10750
|
+
llm(name: string, backend: JsBackend): ai.Llm
|
|
10751
|
+
}
|
|
10752
|
+
export type JsModels = Models
|
|
10753
|
+
/**
|
|
10754
|
+
* Where model files are kept: each model under `{root}/{folder}/`, its
|
|
10755
|
+
* files beside a `manifest.json`.
|
|
10756
|
+
*/
|
|
10757
|
+
export class ModelStore {
|
|
10758
|
+
/**
|
|
10759
|
+
* The store at `location` - a local path, a `file:` URL, an
|
|
10760
|
+
* `s3://bucket/prefix` - opened with `properties`, a plain object of
|
|
10761
|
+
* the store's properties, each value text, a number or a boolean.
|
|
10762
|
+
*/
|
|
10763
|
+
constructor(location: string, properties?: object | undefined | null)
|
|
10764
|
+
/** The folder remote files are materialized in. */
|
|
10765
|
+
get cache(): string
|
|
10766
|
+
/**
|
|
10767
|
+
* The manifest of `model` (a `Model` or any name of one); `null` where
|
|
10768
|
+
* the store does not hold it.
|
|
10769
|
+
*/
|
|
10770
|
+
manifest(model: ai.Model | string): ai.Manifest | null
|
|
10771
|
+
/**
|
|
10772
|
+
* Store `files` - each a name in the model's folder and the local path
|
|
10773
|
+
* it is read from, as `[name, path]` entries or a plain object - as
|
|
10774
|
+
* `model` from `source` at `revision`: only what differs is copied, the
|
|
10775
|
+
* manifest written last. Answers `[stored, manifest]`, `stored` one of
|
|
10776
|
+
* `"created"`, `"updated"` or `"unchanged"`.
|
|
10777
|
+
*/
|
|
10778
|
+
put(model: ai.Model | string, source: string, revision: string, files: Array<[string, string]> | Record<string, string>, tokenizer?: string | undefined | null): ["created" | "updated" | "unchanged", Manifest]
|
|
10779
|
+
/**
|
|
10780
|
+
* The local folder `model`'s files are read from: the stored folder
|
|
10781
|
+
* itself on a local root, else a cache copy brought up to the
|
|
10782
|
+
* manifest; `null` where the store does not hold it.
|
|
10783
|
+
*/
|
|
10784
|
+
local(model: ai.Model | string): string | null
|
|
10785
|
+
/**
|
|
10786
|
+
* Remove `model`'s folder and its cache copy; a model not stored is no
|
|
10787
|
+
* error.
|
|
10788
|
+
*/
|
|
10789
|
+
remove(model: ai.Model | string): void
|
|
10790
|
+
/** Every model the store holds, sorted by model. */
|
|
10791
|
+
manifests(): Array<ai.Manifest>
|
|
10792
|
+
}
|
|
10793
|
+
export type JsModelStore = ModelStore
|
|
10794
|
+
/** What a model's tokens cost, in US dollars per million tokens. */
|
|
10795
|
+
export class Price {
|
|
10796
|
+
/**
|
|
10797
|
+
* `input` and `output` dollars per million tokens, the rest as `options`
|
|
10798
|
+
* states.
|
|
10799
|
+
*/
|
|
10800
|
+
constructor(input: number, output: number, options?: ai.PriceInit | undefined | null)
|
|
10801
|
+
/** Per million input tokens. */
|
|
10802
|
+
get input(): number
|
|
10803
|
+
/** Per million output tokens. */
|
|
10804
|
+
get output(): number
|
|
10805
|
+
/** Per million cache-read tokens; `null` where the input rate applies. */
|
|
10806
|
+
get cacheRead(): number | null
|
|
10807
|
+
/** Per million cache-write tokens; `null` where the input rate applies. */
|
|
10808
|
+
get cacheWrite(): number | null
|
|
10809
|
+
/** `[threshold, input, output]`, or `null`. */
|
|
10810
|
+
get longContext(): [number, number, number] | null
|
|
10811
|
+
/** Whether it is an estimate no one bills. */
|
|
10812
|
+
get simulated(): boolean
|
|
10813
|
+
/** What `usage` costs at this price, in US dollars. */
|
|
10814
|
+
cost(usage: ai.Usage): number
|
|
10815
|
+
}
|
|
10816
|
+
export type JsPrice = Price
|
|
10817
|
+
/** A model's answer: its blocks, why it stopped and what it cost. */
|
|
10818
|
+
export class Reply {
|
|
10819
|
+
/** The message's identifier. */
|
|
10820
|
+
get id(): string
|
|
10821
|
+
/** The model that answered, as the service names it. */
|
|
10822
|
+
get model(): string
|
|
10823
|
+
/** The answer's blocks, as Messages API content blocks. */
|
|
10824
|
+
get content(): Array<object>
|
|
10825
|
+
/**
|
|
10826
|
+
* Why it stopped: `end_turn`, `tool_use`, `max_tokens`,
|
|
10827
|
+
* `stop_sequence`, `refusal`, `pause_turn`, or the wire's own text.
|
|
10828
|
+
*/
|
|
10829
|
+
get stop(): string
|
|
10830
|
+
/** What it cost. */
|
|
10831
|
+
get usage(): JsUsage
|
|
10832
|
+
/** The text blocks joined, in order. */
|
|
10833
|
+
text(): string
|
|
10834
|
+
/** The tool calls, in order, as `{ id, name, input }`. */
|
|
10835
|
+
toolUses(): Array<{ id: string; name: string; input: any }>
|
|
10836
|
+
}
|
|
10837
|
+
export type JsReply = Reply
|
|
10838
|
+
/** What a request must be for a router to send it down a route. */
|
|
10839
|
+
export class Route {
|
|
10840
|
+
/** Its estimated input is under `tokens`. */
|
|
10841
|
+
static inputUnder(tokens: number): Route
|
|
10842
|
+
/** It offers no tool. */
|
|
10843
|
+
static noTools(): Route
|
|
10844
|
+
/**
|
|
10845
|
+
* Its effort is at most `effort` (`low`, `medium`, `high`, `xhigh`,
|
|
10846
|
+
* `max`); a request stating none matches.
|
|
10847
|
+
*/
|
|
10848
|
+
static effortAtMost(effort: string): Route
|
|
10849
|
+
/** Every one of `routes` matches. */
|
|
10850
|
+
static all(routes: Array<ai.Route>): Route
|
|
10851
|
+
/**
|
|
10852
|
+
* `predicate(request)` holds. It is called on this thread during the
|
|
10853
|
+
* door that routes the request; what it throws is rethrown from there.
|
|
10854
|
+
*/
|
|
10855
|
+
static when(predicate: (arg: JsRequest) => boolean): Route
|
|
10856
|
+
/** Whether `request` takes this route. */
|
|
10857
|
+
matches(request: JsRequest | string): boolean
|
|
10858
|
+
/** The route, a predicate as `When(..)`. */
|
|
10859
|
+
toString(): string
|
|
10860
|
+
}
|
|
10861
|
+
export type JsRoute = Route
|
|
10862
|
+
/** Tasks any `Llm` runs, each once. */
|
|
10863
|
+
export class Suite {
|
|
10864
|
+
/** The suite of `tasks`, in the order they run. */
|
|
10865
|
+
constructor(tasks: Array<ai.Task>)
|
|
10866
|
+
/** The core's standard suite of smart-usage tasks. */
|
|
10867
|
+
static smart(): Suite
|
|
10868
|
+
/** How many tasks it holds. */
|
|
10869
|
+
get length(): number
|
|
10870
|
+
/**
|
|
10871
|
+
* Ask `llm` each task once, in order, streamed and timed: a call that
|
|
10872
|
+
* fails is an outcome scoring 0 with its error, and the run goes on.
|
|
10873
|
+
* A caller's own `complete` that throws is such a call: its message is
|
|
10874
|
+
* the outcome's error, never rethrown. Blocks until the last task is
|
|
10875
|
+
* answered.
|
|
10876
|
+
*/
|
|
10877
|
+
run(llm: JsLlm): ai.SuiteReport
|
|
10878
|
+
/**
|
|
10879
|
+
* Per kind of task, the model of `reports` scoring at least `floor` on
|
|
10880
|
+
* it that cost least over its whole run, the lower mean latency
|
|
10881
|
+
* breaking a tie; a kind no model passes is absent.
|
|
10882
|
+
*/
|
|
10883
|
+
static recommend(reports: Array<ai.SuiteReport>, floor: number): Record<string, string>
|
|
10884
|
+
}
|
|
10885
|
+
export type JsSuite = Suite
|
|
10886
|
+
/** One model's run of a `Suite`. */
|
|
10887
|
+
export class SuiteReport {
|
|
10888
|
+
/** The model's identifier. */
|
|
10889
|
+
get model(): string
|
|
10890
|
+
/** Each task's outcome, in the suite's order. */
|
|
10891
|
+
get outcomes(): Array<ai.Outcome>
|
|
10892
|
+
/** Every call's tokens, time and cost, priced by the model's price. */
|
|
10893
|
+
get kpis(): JsKpis
|
|
10894
|
+
/** The mean score over every task; 0 for no task. */
|
|
10895
|
+
score(): number
|
|
10896
|
+
/** The mean score per kind of task. */
|
|
10897
|
+
byKind(): Record<string, number>
|
|
10898
|
+
/** Output tokens per second of call time. */
|
|
10899
|
+
tokensPerSecond(): number
|
|
10900
|
+
}
|
|
10901
|
+
export type JsSuiteReport = SuiteReport
|
|
10902
|
+
/** One request of a `Suite` and how its reply is scored. */
|
|
10903
|
+
export class Task {
|
|
10904
|
+
/**
|
|
10905
|
+
* The task `name` of `kind` asking `request` (a `Request`, or a user's
|
|
10906
|
+
* text), its reply scored by `check`.
|
|
10907
|
+
*/
|
|
10908
|
+
constructor(name: string, kind: string, request: JsRequest | string, check: ai.Check)
|
|
10909
|
+
/** Its name, unique in its suite. */
|
|
10910
|
+
get name(): string
|
|
10911
|
+
/** The kind of work it measures, such as `arithmetic`. */
|
|
10912
|
+
get kind(): string
|
|
10913
|
+
}
|
|
10914
|
+
export type JsTask = Task
|
|
10915
|
+
/**
|
|
10916
|
+
* The tools an agent answers, behind one permissions gate. A `Coder`
|
|
10917
|
+
* takes the toolkit it is given: the handle is empty after.
|
|
10918
|
+
*/
|
|
10919
|
+
export class Toolkit {
|
|
10920
|
+
/** No tools, `ask` permissions, every call that needs asking refused. */
|
|
10921
|
+
constructor()
|
|
10922
|
+
/**
|
|
10923
|
+
* The tools over the workspace at `root` - `read_file`, `write_file`,
|
|
10924
|
+
* `edit_file`, `list_files`, `grep`, `shell`, and unless `web` is
|
|
10925
|
+
* `false` `web_search` and `web_fetch` - every path resolved under
|
|
10926
|
+
* `root`.
|
|
10927
|
+
*/
|
|
10928
|
+
static workspace(root: string, options?: ai.WorkspaceInit | undefined | null): Toolkit
|
|
10929
|
+
/** The tools the model may call, as `{ name, description, input_schema }`. */
|
|
10930
|
+
get tools(): Array<{ name: string; description: string; input_schema: object }>
|
|
10931
|
+
/**
|
|
10932
|
+
* Answer `toolUse` - a tool call, `{ id, name, input }`, a `type` key
|
|
10933
|
+
* ignored - by the
|
|
10934
|
+
* action of its name, when the permissions allow it; a refused call, an
|
|
10935
|
+
* unknown tool or a bad input is an error result naming why.
|
|
10936
|
+
*/
|
|
10937
|
+
call(toolUse: { id: string; name: string; input: any }): ai.ToolResult
|
|
10938
|
+
/** The permissions calls run under: `read-only`, `ask` or `auto`. */
|
|
10939
|
+
get permissions(): string
|
|
10940
|
+
/** Run every later call under `permissions`. */
|
|
10941
|
+
set permissions(permissions: string)
|
|
10942
|
+
}
|
|
10943
|
+
export type JsToolkit = Toolkit
|
|
10944
|
+
/** What a call cost in tokens. */
|
|
10945
|
+
export class Usage {
|
|
10946
|
+
/** A usage of the counts `counts` states. */
|
|
10947
|
+
constructor(counts?: ai.UsageInit | undefined | null)
|
|
10948
|
+
/** Input tokens read uncached. */
|
|
10949
|
+
get inputTokens(): number
|
|
10950
|
+
/** Output tokens written. */
|
|
10951
|
+
get outputTokens(): number
|
|
10952
|
+
/** Input tokens read from the prompt cache. */
|
|
10953
|
+
get cacheReadInputTokens(): number
|
|
10954
|
+
/** Input tokens written to the prompt cache. */
|
|
10955
|
+
get cacheCreationInputTokens(): number
|
|
10956
|
+
}
|
|
10957
|
+
export type JsUsage = Usage
|
|
10958
|
+
/** The internet: a page fetched as text, a query searched. */
|
|
10959
|
+
export class Web {
|
|
10960
|
+
/**
|
|
10961
|
+
* The engine the environment names (Brave when `BRAVE_SEARCH_API_KEY`
|
|
10962
|
+
* is set, else `SearXNG` when `SEARXNG_URL` is, else `DuckDuckGo`) unless
|
|
10963
|
+
* `options` names one, a fetched body read up to 2 MiB.
|
|
10964
|
+
*/
|
|
10965
|
+
constructor(options?: ai.WebOptions | undefined | null)
|
|
10966
|
+
/** The engine a search asks: `"duckduckgo"`, `"brave"` or `"searxng"`. */
|
|
10967
|
+
get engine(): string
|
|
10968
|
+
/**
|
|
10969
|
+
* The page at `url`, redirects followed: HTML read as `htmlToText`
|
|
10970
|
+
* reads it against the final URL, text and JSON as they are, the body
|
|
10971
|
+
* cut at the most bytes read. Blocks until the exchange ends.
|
|
10972
|
+
*/
|
|
10973
|
+
fetch(url: string): ai.Page
|
|
10974
|
+
/**
|
|
10975
|
+
* At most `limit` (10 when not given) results the engine answers for
|
|
10976
|
+
* `query`, in its order. Blocks until the exchange ends.
|
|
10977
|
+
*/
|
|
10978
|
+
search(query: string, limit?: number | undefined | null): Array<ai.Hit>
|
|
10979
|
+
}
|
|
10980
|
+
export type JsWeb = Web
|
|
10981
|
+
/**
|
|
10982
|
+
* One step of an agent's run, as `runWith` reports it: `text` (a piece of
|
|
10983
|
+
* the turn's text), `reply` (the turn's whole reply), `tool_call` (a call,
|
|
10984
|
+
* before it is answered) and `tool_result` (the call and its answer).
|
|
10985
|
+
*/
|
|
10986
|
+
export interface AgentEvent {
|
|
10987
|
+
/** `text`, `reply`, `tool_call` or `tool_result`. */
|
|
10988
|
+
type: 'text' | 'reply' | 'tool_call' | 'tool_result'
|
|
10989
|
+
/** The text written, for `text`. */
|
|
10990
|
+
text?: string
|
|
10991
|
+
/** The turn's reply, for `reply`. */
|
|
10992
|
+
reply?: ai.Reply
|
|
10993
|
+
/**
|
|
10994
|
+
* The tool call, `{ id, name, input }`, for `tool_call` and
|
|
10995
|
+
* `tool_result`.
|
|
10996
|
+
*/
|
|
10997
|
+
call?: { id: string; name: string; input: any }
|
|
10998
|
+
/** What the call answered, for `tool_result`. */
|
|
10999
|
+
output?: ai.ToolResult
|
|
11000
|
+
}
|
|
11001
|
+
/**
|
|
11002
|
+
* Amazon Bedrock's identity, each slot the default AWS chain's when left
|
|
11003
|
+
* out.
|
|
11004
|
+
*/
|
|
11005
|
+
export interface BedrockInit {
|
|
11006
|
+
/** The AWS region. */
|
|
11007
|
+
region?: string | null
|
|
11008
|
+
/** The AWS profile. */
|
|
11009
|
+
profile?: string | null
|
|
11010
|
+
/** A Bedrock API key, sent as a bearer token. */
|
|
11011
|
+
token?: string | null
|
|
11012
|
+
}
|
|
11013
|
+
/** Anthropic's API, as `Llm.claude` takes it. */
|
|
11014
|
+
export interface ClaudeInit {
|
|
11015
|
+
/**
|
|
11016
|
+
* The model asked: a `Model` or any spelling of one; Claude's default
|
|
11017
|
+
* when left out.
|
|
11018
|
+
*/
|
|
11019
|
+
model?: JsModel | string | null
|
|
11020
|
+
/** The API's root, `/v1/messages` appended - a proxy or a test server. */
|
|
11021
|
+
baseUrl?: string | null
|
|
11022
|
+
/**
|
|
11023
|
+
* Whether Anthropic re-runs a declined request on another model; on
|
|
11024
|
+
* when left out.
|
|
11025
|
+
*/
|
|
11026
|
+
fallbacks?: boolean | null
|
|
11027
|
+
}
|
|
11028
|
+
/** The prompt a `Coder` tells its model unless told another. */
|
|
11029
|
+
export const CODER_PROMPT: string
|
|
11030
|
+
/** What a coder is built with. */
|
|
11031
|
+
export interface CoderInit {
|
|
11032
|
+
/** The system prompt, instead of `CODER_PROMPT` and the workspace root. */
|
|
11033
|
+
system?: string | null
|
|
11034
|
+
/** The most model turns a run takes; 64 when left out. */
|
|
11035
|
+
maxTurns?: number | null
|
|
11036
|
+
}
|
|
11037
|
+
/**
|
|
11038
|
+
* What a `Distiller` is built with; a knob not given (or `null`) keeps the
|
|
11039
|
+
* core's default.
|
|
11040
|
+
*/
|
|
11041
|
+
export interface DistillerOptions {
|
|
11042
|
+
/**
|
|
11043
|
+
* How a student's answer is graded against the teacher's: `"exact"`,
|
|
11044
|
+
* `"contains"` or `"judge"` (the default: the teacher scores it).
|
|
11045
|
+
*/
|
|
11046
|
+
grade?: string | null
|
|
11047
|
+
/** The most tokens every answer and system prompt is written in. */
|
|
11048
|
+
maxTokens?: number | null
|
|
11049
|
+
}
|
|
11050
|
+
/** One search result. */
|
|
11051
|
+
export interface Hit {
|
|
11052
|
+
/** The result's title. */
|
|
11053
|
+
title: string
|
|
11054
|
+
/** The page it names. */
|
|
11055
|
+
url: string
|
|
11056
|
+
/** The engine's excerpt of it, as plain text; empty when it gave none. */
|
|
11057
|
+
snippet: string
|
|
11058
|
+
}
|
|
11059
|
+
/**
|
|
11060
|
+
* `html` as the page a model reads: lines with `#`-headings, `- ` items
|
|
11061
|
+
* and `[text](url)` links, each link resolved against `base` when given.
|
|
11062
|
+
*/
|
|
11063
|
+
export function htmlToText(html: string, base?: string | undefined | null): ai.Page
|
|
11064
|
+
/**
|
|
11065
|
+
* What a `Hub` is built with; a knob not given (or `null`) keeps what the
|
|
11066
|
+
* environment names, as `huggingface_hub` reads it.
|
|
11067
|
+
*/
|
|
11068
|
+
export interface HubOptions {
|
|
11069
|
+
/**
|
|
11070
|
+
* The Hub's root URL, a mirror or a fake one; `HF_ENDPOINT`, else
|
|
11071
|
+
* `https://huggingface.co`.
|
|
11072
|
+
*/
|
|
11073
|
+
endpoint?: string | null
|
|
11074
|
+
/**
|
|
11075
|
+
* The bearer token sent; `HF_TOKEN`, `HUGGING_FACE_HUB_TOKEN` or
|
|
11076
|
+
* `$HF_HOME/token`.
|
|
11077
|
+
*/
|
|
11078
|
+
token?: string | null
|
|
11079
|
+
/** The cache folder; `HF_HUB_CACHE`, else `$HF_HOME/hub`. */
|
|
11080
|
+
cache?: string | null
|
|
11081
|
+
/**
|
|
11082
|
+
* Whether a file not cached is refused rather than fetched;
|
|
11083
|
+
* `HF_HUB_OFFLINE`.
|
|
11084
|
+
*/
|
|
11085
|
+
offline?: boolean | null
|
|
11086
|
+
}
|
|
11087
|
+
/** One link of a `Page`. */
|
|
11088
|
+
export interface Link {
|
|
11089
|
+
/**
|
|
11090
|
+
* The link's text, whitespace collapsed; empty for a link around an
|
|
11091
|
+
* image alone.
|
|
11092
|
+
*/
|
|
11093
|
+
text: string
|
|
11094
|
+
/** Where it points, resolved against the page's URL. */
|
|
11095
|
+
url: string
|
|
11096
|
+
}
|
|
11097
|
+
/**
|
|
11098
|
+
* What a model card states beyond its identifier. An API given a string
|
|
11099
|
+
* serves the model under it, given `null` does not serve it, and left out
|
|
11100
|
+
* serves it under the identifier.
|
|
11101
|
+
*/
|
|
11102
|
+
export interface ModelCardInit {
|
|
11103
|
+
/** Anthropic's identifier, or `null` where Anthropic's API does not serve it. */
|
|
11104
|
+
anthropic?: string | null
|
|
11105
|
+
/** Claude in Amazon Bedrock's identifier, or `null`. */
|
|
11106
|
+
bedrock?: string | null
|
|
11107
|
+
/** Bedrock Converse's identifier, or `null`. */
|
|
11108
|
+
converse?: string | null
|
|
11109
|
+
/** This machine's Hub reference, or `null`. */
|
|
11110
|
+
local?: string | null
|
|
11111
|
+
/** Moonshot's identifier, or `null`. */
|
|
11112
|
+
moonshot?: string | null
|
|
11113
|
+
/** The other names it goes by. */
|
|
11114
|
+
aliases?: Array<string> | null
|
|
11115
|
+
/** The most tokens a request's input may hold. */
|
|
11116
|
+
maxInputTokens?: number | null
|
|
11117
|
+
/** The most tokens a reply may hold. */
|
|
11118
|
+
maxOutputTokens?: number | null
|
|
11119
|
+
/** Whether a request may state an effort; `true` when left out. */
|
|
11120
|
+
effort?: boolean | null
|
|
11121
|
+
/**
|
|
11122
|
+
* Whether Anthropic's API re-runs a declined request on another model;
|
|
11123
|
+
* `false` when left out.
|
|
11124
|
+
*/
|
|
11125
|
+
fallbacks?: boolean | null
|
|
11126
|
+
/** What its tokens cost. */
|
|
11127
|
+
price?: JsPrice | null
|
|
11128
|
+
}
|
|
11129
|
+
/** Moonshot's API, as `Llm.moonshot` takes it. */
|
|
11130
|
+
export interface MoonshotInit {
|
|
11131
|
+
/** The model asked; `kimi-k3` when left out. */
|
|
11132
|
+
model?: JsModel | string | null
|
|
11133
|
+
/** The API's root, `/v1/messages` appended. */
|
|
11134
|
+
baseUrl?: string | null
|
|
11135
|
+
}
|
|
11136
|
+
/** How one model did on one `Task`. */
|
|
11137
|
+
export interface Outcome {
|
|
11138
|
+
/** The task's name. */
|
|
11139
|
+
task: string
|
|
11140
|
+
/** The task's kind. */
|
|
11141
|
+
kind: string
|
|
11142
|
+
/** 0 to 1; 0 for a call that failed. */
|
|
11143
|
+
score: number
|
|
11144
|
+
/** What the reply states it cost; zero for a call that failed. */
|
|
11145
|
+
usage: JsUsage
|
|
11146
|
+
/**
|
|
11147
|
+
* From the request sent to the reply read, or to the failure, in
|
|
11148
|
+
* seconds.
|
|
11149
|
+
*/
|
|
11150
|
+
elapsed: number
|
|
11151
|
+
/** The reply's text. */
|
|
11152
|
+
answer: string
|
|
11153
|
+
/** Why the call failed; `null` when it did not. */
|
|
11154
|
+
error: string | null
|
|
11155
|
+
}
|
|
11156
|
+
/** A page as a model reads it. */
|
|
11157
|
+
export interface Page {
|
|
11158
|
+
/**
|
|
11159
|
+
* Where it was read from, after redirects; empty when it was not read
|
|
11160
|
+
* from anywhere.
|
|
11161
|
+
*/
|
|
11162
|
+
url: string
|
|
11163
|
+
/** Its `<title>`; `null` when it states none. */
|
|
11164
|
+
title: string | null
|
|
11165
|
+
/**
|
|
11166
|
+
* Its text: HTML as lines with `#`-headings, `- ` items and
|
|
11167
|
+
* `[text](url)` links; text and JSON as they are.
|
|
11168
|
+
*/
|
|
11169
|
+
text: string
|
|
11170
|
+
/** Every link it holds, in order. */
|
|
11171
|
+
links: Array<ai.Link>
|
|
11172
|
+
}
|
|
11173
|
+
/** A price's rates beyond input and output. */
|
|
11174
|
+
export interface PriceInit {
|
|
11175
|
+
/**
|
|
11176
|
+
* Per million tokens read from the prompt cache; the input rate when
|
|
11177
|
+
* left out.
|
|
11178
|
+
*/
|
|
11179
|
+
cacheRead?: number | null
|
|
11180
|
+
/**
|
|
11181
|
+
* Per million tokens written to the prompt cache; the input rate when
|
|
11182
|
+
* left out.
|
|
11183
|
+
*/
|
|
11184
|
+
cacheWrite?: number | null
|
|
11185
|
+
/**
|
|
11186
|
+
* `[threshold, input, output]`: the input and output rates once a
|
|
11187
|
+
* request's prompt passes `threshold` tokens.
|
|
11188
|
+
*/
|
|
11189
|
+
longContext?: [number, number, number] | null
|
|
11190
|
+
/** Whether it is an estimate no one bills, a local model's. */
|
|
11191
|
+
simulated?: boolean | null
|
|
11192
|
+
}
|
|
11193
|
+
/**
|
|
11194
|
+
* The examples of the JSON Lines chat set at `path`, as `writeJsonl`
|
|
11195
|
+
* writes it.
|
|
11196
|
+
*/
|
|
11197
|
+
export function readJsonl(path: string): Array<ai.Example>
|
|
11198
|
+
/** What `Distiller.refine` found. */
|
|
11199
|
+
export interface Refinement {
|
|
11200
|
+
/**
|
|
11201
|
+
* The best system prompt found; empty when none beat the student with
|
|
11202
|
+
* no system prompt.
|
|
11203
|
+
*/
|
|
11204
|
+
system: string
|
|
11205
|
+
/** The student with no system prompt. */
|
|
11206
|
+
before: ai.Report
|
|
11207
|
+
/** The student under `system`. */
|
|
11208
|
+
after: ai.Report
|
|
11209
|
+
/** Each round's candidate system prompt and its mean grade, in order. */
|
|
11210
|
+
rounds: Array<[string, number]>
|
|
11211
|
+
}
|
|
11212
|
+
/** What the Hub states about one model repository. */
|
|
11213
|
+
export interface RepoInfo {
|
|
11214
|
+
/**
|
|
11215
|
+
* The repository's identifier, such as
|
|
11216
|
+
* `HuggingFaceTB/SmolLM2-135M-Instruct`.
|
|
11217
|
+
*/
|
|
11218
|
+
id: string
|
|
11219
|
+
/** The commit sha of its default revision. */
|
|
11220
|
+
sha: string
|
|
11221
|
+
/** Every file it holds, by its path within it. */
|
|
11222
|
+
files: Array<string>
|
|
11223
|
+
/**
|
|
11224
|
+
* The model it was derived from, as its card states it; `null` when
|
|
11225
|
+
* it states none.
|
|
11226
|
+
*/
|
|
11227
|
+
baseModel: string | null
|
|
11228
|
+
/** Whether a download needs an accepted licence and a token. */
|
|
11229
|
+
gated: boolean
|
|
11230
|
+
}
|
|
11231
|
+
/** How the student did on a set of `Example`s. */
|
|
11232
|
+
export interface Report {
|
|
11233
|
+
/** Each example's grade, 0 to 1, in order. */
|
|
11234
|
+
scores: Array<number>
|
|
11235
|
+
/** The mean grade; 0 for no example. */
|
|
11236
|
+
mean: number
|
|
11237
|
+
/** The student's answers, in order. */
|
|
11238
|
+
answers: Array<string>
|
|
11239
|
+
}
|
|
11240
|
+
/** What a request states beyond its user text; `null` clears a slot. */
|
|
11241
|
+
export interface RequestInit {
|
|
11242
|
+
/** The system prompt. */
|
|
11243
|
+
system?: string | null
|
|
11244
|
+
/**
|
|
11245
|
+
* The conversation so far, Messages API messages oldest first; the
|
|
11246
|
+
* user text, when given, is appended after them.
|
|
11247
|
+
*/
|
|
11248
|
+
messages?: Array<{ role: 'user' | 'assistant'; content: string | Array<object> }> | null
|
|
11249
|
+
/** The tools the model may call: `{ name, description, input_schema }`. */
|
|
11250
|
+
tools?: Array<{ name: string; description: string; input_schema: object }> | null
|
|
11251
|
+
/** The most tokens the reply may hold; 16000 when left out. */
|
|
11252
|
+
maxTokens?: number | null
|
|
11253
|
+
/**
|
|
11254
|
+
* The effort: `low`, `medium`, `high`, `xhigh` or `max`; the model's
|
|
11255
|
+
* default when left out.
|
|
11256
|
+
*/
|
|
11257
|
+
effort?: string | null
|
|
11258
|
+
/** Texts that end the reply where the model writes one. */
|
|
11259
|
+
stopSequences?: Array<string> | null
|
|
11260
|
+
}
|
|
11261
|
+
/**
|
|
11262
|
+
* One stored file: its name in the model's folder, its length and its
|
|
11263
|
+
* digest.
|
|
11264
|
+
*/
|
|
11265
|
+
export interface StoredFile {
|
|
11266
|
+
/** Its path within the model's folder, `/`-separated. */
|
|
11267
|
+
name: string
|
|
11268
|
+
/** Its length in bytes. */
|
|
11269
|
+
size: number
|
|
11270
|
+
/** Its xxh3-128 digest, `xxh3-128:{hex}`. */
|
|
11271
|
+
digest: string
|
|
11272
|
+
}
|
|
11273
|
+
/** What a tool answered. */
|
|
11274
|
+
export interface ToolResult {
|
|
11275
|
+
/** The answer as text; the reason, for a failure. */
|
|
11276
|
+
content: string
|
|
11277
|
+
/** Whether the tool failed. */
|
|
11278
|
+
is_error: boolean
|
|
11279
|
+
}
|
|
11280
|
+
/** The four counts of a usage, each zero when left out. */
|
|
11281
|
+
export interface UsageInit {
|
|
11282
|
+
/** Input tokens read uncached. */
|
|
11283
|
+
inputTokens?: number
|
|
11284
|
+
/** Output tokens written. */
|
|
11285
|
+
outputTokens?: number
|
|
11286
|
+
/** Input tokens read from the prompt cache. */
|
|
11287
|
+
cacheReadInputTokens?: number
|
|
11288
|
+
/** Input tokens written to the prompt cache. */
|
|
11289
|
+
cacheCreationInputTokens?: number
|
|
11290
|
+
}
|
|
11291
|
+
/**
|
|
11292
|
+
* What a `Web` is built with; a knob not given keeps the core's default,
|
|
11293
|
+
* and `null` is the same as not given.
|
|
11294
|
+
*/
|
|
11295
|
+
export interface WebOptions {
|
|
11296
|
+
/**
|
|
11297
|
+
* The search engine asked: `"duckduckgo"`, `"brave:<key>"` (its
|
|
11298
|
+
* subscription token) or `"searxng:<url>"` (its instance root); the one
|
|
11299
|
+
* the environment names when not given.
|
|
11300
|
+
*/
|
|
11301
|
+
engine?: string | null
|
|
11302
|
+
/**
|
|
11303
|
+
* Where a search is sent in place of the engine's own endpoint - a
|
|
11304
|
+
* mirror, a proxy, a test server - its query appended.
|
|
11305
|
+
*/
|
|
11306
|
+
searchUrl?: string | null
|
|
11307
|
+
/** The most bytes of a fetched body read; 2 MiB when not given. */
|
|
11308
|
+
maxBytes?: number | null
|
|
11309
|
+
}
|
|
11310
|
+
/** What a workspace toolkit is built with. */
|
|
11311
|
+
export interface WorkspaceInit {
|
|
11312
|
+
/** `read-only`, `ask` or `auto`; `ask` when left out. */
|
|
11313
|
+
permissions?: string | null
|
|
11314
|
+
/**
|
|
11315
|
+
* Whether `web_search` and `web_fetch` are offered too; `true` when
|
|
11316
|
+
* left out.
|
|
11317
|
+
*/
|
|
11318
|
+
web?: boolean | null
|
|
11319
|
+
/**
|
|
11320
|
+
* Asked what `ask` does not allow by itself: `approver(toolUse,
|
|
11321
|
+
* access)`, `access` one of `read`, `write`, `execute`, `network`,
|
|
11322
|
+
* answering whether the call runs. Called on this thread during the
|
|
11323
|
+
* door that runs the call; what it throws is rethrown from there.
|
|
11324
|
+
* Every such call is refused when left out.
|
|
11325
|
+
*/
|
|
11326
|
+
approver?: ((toolUse: { id: string; name: string; input: any }, access: 'read' | 'write' | 'execute' | 'network') => boolean) | null
|
|
11327
|
+
}
|
|
11328
|
+
/**
|
|
11329
|
+
* Write `examples` to the file at `path` as JSON Lines, one chat per line,
|
|
11330
|
+
* the supervised fine-tuning set any trainer reads; the file is replaced.
|
|
11331
|
+
*/
|
|
11332
|
+
export function writeJsonl(examples: Array<ai.Example>, path: string): void
|
|
11333
|
+
}
|