@get-bb/plugin-sdk 0.4.20 → 0.4.21

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.
@@ -4715,7 +4715,10 @@ interface ReplayRecordingOptions {
4715
4715
  * alone lands before them, at a point the recording never had.
4716
4716
  */
4717
4717
  orderTimeoutMs?: number;
4718
- /** Quiet period after the last request before the bridge is closed. */
4718
+ /**
4719
+ * Quiet period after the last request before a non-exact replay is closed.
4720
+ * An exact current-lane replay waits for every planned event instead.
4721
+ */
4719
4722
  settleMs?: number;
4720
4723
  /**
4721
4724
  * Quiet period a request waits for once the gates are met. The replay child
@@ -6939,10 +6939,13 @@ async function replayRecording(options) {
6939
6939
  const liveAssembler = options.createAssembler(providerId);
6940
6940
  const planAssembler = (options.createPlanAssembler ?? options.createAssembler)(providerId);
6941
6941
  const exactPlan = options.planFromCurrentLane === true;
6942
- const steps = planRuntimeSteps(
6943
- exactPlan ? withCurrentBridgeLane(recording) : recording,
6944
- planAssembler
6945
- );
6942
+ const planRecording = exactPlan ? withCurrentBridgeLane(recording) : recording;
6943
+ const steps = planRuntimeSteps(planRecording, planAssembler);
6944
+ const plannedEventCount = exactPlan ? assembleRecordedEvents(
6945
+ planRecording,
6946
+ options.createPlanAssembler ?? options.createAssembler,
6947
+ providerId
6948
+ ).events.length : null;
6946
6949
  const answeredIds = /* @__PURE__ */ new Set();
6947
6950
  const pendingBridgeRequests = [];
6948
6951
  const recordedAnswers = /* @__PURE__ */ new Map();
@@ -7103,7 +7106,14 @@ async function replayRecording(options) {
7103
7106
  }
7104
7107
  setCursor("end");
7105
7108
  await waitFor("the last responses", () => sentRequestIds.every((id) => answeredIds.has(id)));
7106
- await waitFor("the stream to settle", () => Date.now() - lastOutputAt >= settleMs);
7109
+ if (plannedEventCount !== null) {
7110
+ await waitFor(
7111
+ `all ${plannedEventCount} planned events before closing the bridge`,
7112
+ () => events.length >= plannedEventCount
7113
+ );
7114
+ } else {
7115
+ await waitFor("the stream to settle", () => Date.now() - lastOutputAt >= settleMs);
7116
+ }
7107
7117
  child.stdin?.end();
7108
7118
  const exitCode = await Promise.race([
7109
7119
  exited,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-bb/plugin-sdk",
3
- "version": "0.4.20",
3
+ "version": "0.4.21",
4
4
  "homepage": "https://github.com/get-bb/bb#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/get-bb/bb/issues"