bitfab 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-6UJ3E3H5.js → chunk-NMNVPON4.js} +8 -7
- package/dist/{chunk-6UJ3E3H5.js.map → chunk-NMNVPON4.js.map} +1 -1
- package/dist/{chunk-A7K5JOBV.js → chunk-YZZO475T.js} +7 -4
- package/dist/chunk-YZZO475T.js.map +1 -0
- package/dist/index.cjs +11 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -31
- package/dist/index.d.ts +42 -31
- package/dist/index.js +2 -2
- package/dist/node.cjs +11 -7
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/{replay-JVURNX5Y.js → replay-DJWVOJUR.js} +2 -2
- package/package.json +5 -4
- package/dist/chunk-A7K5JOBV.js.map +0 -1
- /package/dist/{replay-JVURNX5Y.js.map → replay-DJWVOJUR.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -629,6 +629,10 @@ declare class BitfabOpenAIAgentHandler {
|
|
|
629
629
|
* `env.databaseUrl` (and friends) to pick up the per-trace branch URL the
|
|
630
630
|
* Bitfab service resolved from the source trace's snapshot reference.
|
|
631
631
|
*
|
|
632
|
+
* The constructor takes how each branch should be sized and warmed. That lives
|
|
633
|
+
* here rather than on the replay options because the settings only mean
|
|
634
|
+
* anything for a replay that has an environment.
|
|
635
|
+
*
|
|
632
636
|
* Outside replay, accessing `env.databaseUrl` throws. Customer code uses
|
|
633
637
|
* the env only on the replay path; live request code keeps reading
|
|
634
638
|
* `process.env.DATABASE_URL` the normal way.
|
|
@@ -649,7 +653,42 @@ interface ReplayEnvironmentSnapshot {
|
|
|
649
653
|
region?: string;
|
|
650
654
|
traceId: string;
|
|
651
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* Per-lease settings for the DB-snapshot branch a replay item runs against.
|
|
658
|
+
* Passed to the `ReplayEnvironment` constructor, since branching only happens
|
|
659
|
+
* for a replay that has an environment.
|
|
660
|
+
*/
|
|
661
|
+
interface DbBranchOptions {
|
|
662
|
+
/**
|
|
663
|
+
* Autoscaling floor for the branch's compute, in Neon Compute Units (0.25 to
|
|
664
|
+
* 56). Omit to keep the mirror project's own default. Raise it when the
|
|
665
|
+
* mirror is provisioned smaller than the database it stands in for, so
|
|
666
|
+
* replay latency reflects your code rather than a cold, undersized branch.
|
|
667
|
+
*/
|
|
668
|
+
minCu?: number;
|
|
669
|
+
/**
|
|
670
|
+
* Autoscaling ceiling for the branch's compute, in Neon Compute Units.
|
|
671
|
+
* Setting it equal to `minCu` pins the size, which keeps items comparable:
|
|
672
|
+
* otherwise a later item can run against an endpoint that has already
|
|
673
|
+
* scaled up and post a better number for the same code.
|
|
674
|
+
*/
|
|
675
|
+
maxCu?: number;
|
|
676
|
+
/**
|
|
677
|
+
* SQL that warms the branch's cache. The server appends it to the branch's
|
|
678
|
+
* readiness check, so it runs BEFORE your function sees the lease and its
|
|
679
|
+
* time is not charged to the replayed call. Invalid SQL fails the lease
|
|
680
|
+
* rather than silently leaving the branch cold.
|
|
681
|
+
*/
|
|
682
|
+
warmupSql?: string;
|
|
683
|
+
}
|
|
652
684
|
declare class ReplayEnvironment {
|
|
685
|
+
/**
|
|
686
|
+
* The branch settings this environment was constructed with, readable
|
|
687
|
+
* anywhere. Every other accessor reports the lease the server resolved and
|
|
688
|
+
* is therefore replay-only.
|
|
689
|
+
*/
|
|
690
|
+
readonly dbBranch: DbBranchOptions;
|
|
691
|
+
constructor(options?: DbBranchOptions);
|
|
653
692
|
/**
|
|
654
693
|
* The per-trace branch URL for the item currently being replayed.
|
|
655
694
|
* Throws if read outside a replay item.
|
|
@@ -698,33 +737,6 @@ declare class ReplayEnvironment {
|
|
|
698
737
|
*/
|
|
699
738
|
|
|
700
739
|
type MockStrategy = "none" | "all" | "marked";
|
|
701
|
-
/**
|
|
702
|
-
* Per-lease settings for the DB-snapshot branch a replay item runs against.
|
|
703
|
-
* Only read when `environment` is set, since that is what turns branching on.
|
|
704
|
-
*/
|
|
705
|
-
interface DbBranchOptions {
|
|
706
|
-
/**
|
|
707
|
-
* Autoscaling floor for the branch's compute, in Neon Compute Units (0.25 to
|
|
708
|
-
* 56). Omit to keep the mirror project's own default. Raise it when the
|
|
709
|
-
* mirror is provisioned smaller than the database it stands in for, so
|
|
710
|
-
* replay latency reflects your code rather than a cold, undersized branch.
|
|
711
|
-
*/
|
|
712
|
-
minCu?: number;
|
|
713
|
-
/**
|
|
714
|
-
* Autoscaling ceiling for the branch's compute, in Neon Compute Units.
|
|
715
|
-
* Setting it equal to `minCu` pins the size, which keeps items comparable:
|
|
716
|
-
* otherwise a later item can run against an endpoint that has already
|
|
717
|
-
* scaled up and post a better number for the same code.
|
|
718
|
-
*/
|
|
719
|
-
maxCu?: number;
|
|
720
|
-
/**
|
|
721
|
-
* SQL that warms the branch's cache. The server appends it to the branch's
|
|
722
|
-
* readiness check, so it runs BEFORE your function sees the lease and its
|
|
723
|
-
* time is not charged to the replayed call. Invalid SQL fails the lease
|
|
724
|
-
* rather than silently leaving the branch cold.
|
|
725
|
-
*/
|
|
726
|
-
warmupSql?: string;
|
|
727
|
-
}
|
|
728
740
|
interface ReplayOptions {
|
|
729
741
|
/**
|
|
730
742
|
* Maximum number of traces to replay (1-100, default 5). Ignored when
|
|
@@ -770,11 +782,10 @@ interface ReplayOptions {
|
|
|
770
782
|
* Per-trace environment. When the source trace carries a DB branching
|
|
771
783
|
* snapshot, the SDK populates `environment.databaseUrl` before invoking
|
|
772
784
|
* `fn` for that item and resets it after. Customer code reads from the
|
|
773
|
-
* environment to pick up the per-trace branch URL.
|
|
785
|
+
* environment to pick up the per-trace branch URL. Compute size and cache
|
|
786
|
+
* warm-up for each branch are configured on the environment's constructor.
|
|
774
787
|
*/
|
|
775
788
|
environment?: ReplayEnvironment;
|
|
776
|
-
/** Compute size and cache warm-up for the per-item DB snapshot branch. */
|
|
777
|
-
dbBranch?: DbBranchOptions;
|
|
778
789
|
/** Group ID to associate this replay with an experiment group for live streaming in Studio. */
|
|
779
790
|
experimentGroupId?: string;
|
|
780
791
|
/**
|
|
@@ -1843,7 +1854,7 @@ declare class BitfabFunction {
|
|
|
1843
1854
|
/**
|
|
1844
1855
|
* SDK version from package.json (injected at build time)
|
|
1845
1856
|
*/
|
|
1846
|
-
declare const __version__ = "0.
|
|
1857
|
+
declare const __version__ = "0.32.0";
|
|
1847
1858
|
|
|
1848
1859
|
/**
|
|
1849
1860
|
* Constants for the Bitfab SDK.
|
package/dist/index.d.ts
CHANGED
|
@@ -629,6 +629,10 @@ declare class BitfabOpenAIAgentHandler {
|
|
|
629
629
|
* `env.databaseUrl` (and friends) to pick up the per-trace branch URL the
|
|
630
630
|
* Bitfab service resolved from the source trace's snapshot reference.
|
|
631
631
|
*
|
|
632
|
+
* The constructor takes how each branch should be sized and warmed. That lives
|
|
633
|
+
* here rather than on the replay options because the settings only mean
|
|
634
|
+
* anything for a replay that has an environment.
|
|
635
|
+
*
|
|
632
636
|
* Outside replay, accessing `env.databaseUrl` throws. Customer code uses
|
|
633
637
|
* the env only on the replay path; live request code keeps reading
|
|
634
638
|
* `process.env.DATABASE_URL` the normal way.
|
|
@@ -649,7 +653,42 @@ interface ReplayEnvironmentSnapshot {
|
|
|
649
653
|
region?: string;
|
|
650
654
|
traceId: string;
|
|
651
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* Per-lease settings for the DB-snapshot branch a replay item runs against.
|
|
658
|
+
* Passed to the `ReplayEnvironment` constructor, since branching only happens
|
|
659
|
+
* for a replay that has an environment.
|
|
660
|
+
*/
|
|
661
|
+
interface DbBranchOptions {
|
|
662
|
+
/**
|
|
663
|
+
* Autoscaling floor for the branch's compute, in Neon Compute Units (0.25 to
|
|
664
|
+
* 56). Omit to keep the mirror project's own default. Raise it when the
|
|
665
|
+
* mirror is provisioned smaller than the database it stands in for, so
|
|
666
|
+
* replay latency reflects your code rather than a cold, undersized branch.
|
|
667
|
+
*/
|
|
668
|
+
minCu?: number;
|
|
669
|
+
/**
|
|
670
|
+
* Autoscaling ceiling for the branch's compute, in Neon Compute Units.
|
|
671
|
+
* Setting it equal to `minCu` pins the size, which keeps items comparable:
|
|
672
|
+
* otherwise a later item can run against an endpoint that has already
|
|
673
|
+
* scaled up and post a better number for the same code.
|
|
674
|
+
*/
|
|
675
|
+
maxCu?: number;
|
|
676
|
+
/**
|
|
677
|
+
* SQL that warms the branch's cache. The server appends it to the branch's
|
|
678
|
+
* readiness check, so it runs BEFORE your function sees the lease and its
|
|
679
|
+
* time is not charged to the replayed call. Invalid SQL fails the lease
|
|
680
|
+
* rather than silently leaving the branch cold.
|
|
681
|
+
*/
|
|
682
|
+
warmupSql?: string;
|
|
683
|
+
}
|
|
652
684
|
declare class ReplayEnvironment {
|
|
685
|
+
/**
|
|
686
|
+
* The branch settings this environment was constructed with, readable
|
|
687
|
+
* anywhere. Every other accessor reports the lease the server resolved and
|
|
688
|
+
* is therefore replay-only.
|
|
689
|
+
*/
|
|
690
|
+
readonly dbBranch: DbBranchOptions;
|
|
691
|
+
constructor(options?: DbBranchOptions);
|
|
653
692
|
/**
|
|
654
693
|
* The per-trace branch URL for the item currently being replayed.
|
|
655
694
|
* Throws if read outside a replay item.
|
|
@@ -698,33 +737,6 @@ declare class ReplayEnvironment {
|
|
|
698
737
|
*/
|
|
699
738
|
|
|
700
739
|
type MockStrategy = "none" | "all" | "marked";
|
|
701
|
-
/**
|
|
702
|
-
* Per-lease settings for the DB-snapshot branch a replay item runs against.
|
|
703
|
-
* Only read when `environment` is set, since that is what turns branching on.
|
|
704
|
-
*/
|
|
705
|
-
interface DbBranchOptions {
|
|
706
|
-
/**
|
|
707
|
-
* Autoscaling floor for the branch's compute, in Neon Compute Units (0.25 to
|
|
708
|
-
* 56). Omit to keep the mirror project's own default. Raise it when the
|
|
709
|
-
* mirror is provisioned smaller than the database it stands in for, so
|
|
710
|
-
* replay latency reflects your code rather than a cold, undersized branch.
|
|
711
|
-
*/
|
|
712
|
-
minCu?: number;
|
|
713
|
-
/**
|
|
714
|
-
* Autoscaling ceiling for the branch's compute, in Neon Compute Units.
|
|
715
|
-
* Setting it equal to `minCu` pins the size, which keeps items comparable:
|
|
716
|
-
* otherwise a later item can run against an endpoint that has already
|
|
717
|
-
* scaled up and post a better number for the same code.
|
|
718
|
-
*/
|
|
719
|
-
maxCu?: number;
|
|
720
|
-
/**
|
|
721
|
-
* SQL that warms the branch's cache. The server appends it to the branch's
|
|
722
|
-
* readiness check, so it runs BEFORE your function sees the lease and its
|
|
723
|
-
* time is not charged to the replayed call. Invalid SQL fails the lease
|
|
724
|
-
* rather than silently leaving the branch cold.
|
|
725
|
-
*/
|
|
726
|
-
warmupSql?: string;
|
|
727
|
-
}
|
|
728
740
|
interface ReplayOptions {
|
|
729
741
|
/**
|
|
730
742
|
* Maximum number of traces to replay (1-100, default 5). Ignored when
|
|
@@ -770,11 +782,10 @@ interface ReplayOptions {
|
|
|
770
782
|
* Per-trace environment. When the source trace carries a DB branching
|
|
771
783
|
* snapshot, the SDK populates `environment.databaseUrl` before invoking
|
|
772
784
|
* `fn` for that item and resets it after. Customer code reads from the
|
|
773
|
-
* environment to pick up the per-trace branch URL.
|
|
785
|
+
* environment to pick up the per-trace branch URL. Compute size and cache
|
|
786
|
+
* warm-up for each branch are configured on the environment's constructor.
|
|
774
787
|
*/
|
|
775
788
|
environment?: ReplayEnvironment;
|
|
776
|
-
/** Compute size and cache warm-up for the per-item DB snapshot branch. */
|
|
777
|
-
dbBranch?: DbBranchOptions;
|
|
778
789
|
/** Group ID to associate this replay with an experiment group for live streaming in Studio. */
|
|
779
790
|
experimentGroupId?: string;
|
|
780
791
|
/**
|
|
@@ -1843,7 +1854,7 @@ declare class BitfabFunction {
|
|
|
1843
1854
|
/**
|
|
1844
1855
|
* SDK version from package.json (injected at build time)
|
|
1845
1856
|
*/
|
|
1846
|
-
declare const __version__ = "0.
|
|
1857
|
+
declare const __version__ = "0.32.0";
|
|
1847
1858
|
|
|
1848
1859
|
/**
|
|
1849
1860
|
* Constants for the Bitfab SDK.
|
package/dist/index.js
CHANGED
|
@@ -23,12 +23,12 @@ import {
|
|
|
23
23
|
flushTraces,
|
|
24
24
|
getCurrentSpan,
|
|
25
25
|
getCurrentTrace
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-YZZO475T.js";
|
|
27
27
|
import {
|
|
28
28
|
BITFAB_PROGRESS_PREFIX,
|
|
29
29
|
BitfabError,
|
|
30
30
|
reportReplayProgress
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-NMNVPON4.js";
|
|
32
32
|
export {
|
|
33
33
|
BITFAB_PROGRESS_PREFIX,
|
|
34
34
|
Bitfab,
|
package/dist/node.cjs
CHANGED
|
@@ -540,14 +540,15 @@ __export(replay_exports, {
|
|
|
540
540
|
replay: () => replay,
|
|
541
541
|
reportReplayProgress: () => reportReplayProgress
|
|
542
542
|
});
|
|
543
|
-
function resolveDbBranchSettings(
|
|
544
|
-
if (!
|
|
543
|
+
function resolveDbBranchSettings(environment) {
|
|
544
|
+
if (!environment) {
|
|
545
545
|
return void 0;
|
|
546
546
|
}
|
|
547
|
+
const { minCu, maxCu, warmupSql } = environment.dbBranch;
|
|
547
548
|
const settings = {
|
|
548
|
-
...
|
|
549
|
-
...
|
|
550
|
-
...
|
|
549
|
+
...minCu === void 0 ? {} : { minCu },
|
|
550
|
+
...maxCu === void 0 ? {} : { maxCu },
|
|
551
|
+
...warmupSql === void 0 ? {} : { warmupSql }
|
|
551
552
|
};
|
|
552
553
|
return Object.keys(settings).length === 0 ? void 0 : settings;
|
|
553
554
|
}
|
|
@@ -801,7 +802,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
|
|
|
801
802
|
options?.experimentGroupId,
|
|
802
803
|
options?.datasetId,
|
|
803
804
|
options?.graderIds,
|
|
804
|
-
resolveDbBranchSettings(options?.
|
|
805
|
+
resolveDbBranchSettings(options?.environment)
|
|
805
806
|
);
|
|
806
807
|
const mockStrategy = options?.mock ?? "marked";
|
|
807
808
|
const maxConcurrency = options?.maxConcurrency ?? 10;
|
|
@@ -995,7 +996,7 @@ registerAsyncLocalStorageClass(
|
|
|
995
996
|
);
|
|
996
997
|
|
|
997
998
|
// src/version.generated.ts
|
|
998
|
-
var __version__ = "0.
|
|
999
|
+
var __version__ = "0.32.0";
|
|
999
1000
|
|
|
1000
1001
|
// src/constants.ts
|
|
1001
1002
|
var DEFAULT_SERVICE_URL = "https://bitfab.ai";
|
|
@@ -3091,6 +3092,9 @@ init_replayContext();
|
|
|
3091
3092
|
// src/replayEnvironment.ts
|
|
3092
3093
|
init_replayContext();
|
|
3093
3094
|
var ReplayEnvironment = class {
|
|
3095
|
+
constructor(options = {}) {
|
|
3096
|
+
this.dbBranch = { ...options };
|
|
3097
|
+
}
|
|
3094
3098
|
/**
|
|
3095
3099
|
* The per-trace branch URL for the item currently being replayed.
|
|
3096
3100
|
* Throws if read outside a replay item.
|