@band-ai/band-sdk-core 1.2.0 → 2.0.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/band_sdk_core.js CHANGED
@@ -727,6 +727,13 @@ class SessionPolicy {
727
727
  const ptr = this.__destroy_into_raw();
728
728
  wasm.__wbg_sessionpolicy_free(ptr, 0);
729
729
  }
730
+ /**
731
+ * @returns {number}
732
+ */
733
+ get deadThresholdS() {
734
+ const ret = wasm.sessionpolicy_deadThresholdS(this.__wbg_ptr);
735
+ return ret;
736
+ }
730
737
  /**
731
738
  * A recommended, not final, default.
732
739
  * @returns {SessionPolicy}
@@ -735,6 +742,13 @@ class SessionPolicy {
735
742
  const ret = wasm.sessionpolicy_default();
736
743
  return SessionPolicy.__wrap(ret);
737
744
  }
745
+ /**
746
+ * @returns {number}
747
+ */
748
+ get heartbeatIntervalS() {
749
+ const ret = wasm.sessionpolicy_heartbeatIntervalS(this.__wbg_ptr);
750
+ return ret;
751
+ }
738
752
  /**
739
753
  * `config` is any plain object with the fields declared in
740
754
  * `index.d.ts`'s `SessionPolicyConfig`; grouped into one value rather
@@ -791,6 +805,13 @@ class SubscriptionTracker {
791
805
  }
792
806
  return ret[0] !== 0;
793
807
  }
808
+ /**
809
+ * @returns {Array<any>}
810
+ */
811
+ agentTopicRejoinCandidates() {
812
+ const ret = wasm.subscriptiontracker_agentTopicRejoinCandidates(this.__wbg_ptr);
813
+ return ret;
814
+ }
794
815
  /**
795
816
  * @param {any} topic
796
817
  * @returns {string}
@@ -908,10 +929,11 @@ class SubscriptionTracker {
908
929
  }
909
930
  /**
910
931
  * @param {any} topic
932
+ * @param {bigint} ticket
911
933
  * @returns {boolean}
912
934
  */
913
- markAgentTopicRejoinFailed(topic) {
914
- const ret = wasm.subscriptiontracker_markAgentTopicRejoinFailed(this.__wbg_ptr, topic);
935
+ markAgentTopicRejoinFailed(topic, ticket) {
936
+ const ret = wasm.subscriptiontracker_markAgentTopicRejoinFailed(this.__wbg_ptr, topic, ticket);
915
937
  if (ret[2]) {
916
938
  throw takeFromExternrefTable0(ret[1]);
917
939
  }
@@ -932,10 +954,11 @@ class SubscriptionTracker {
932
954
  }
933
955
  /**
934
956
  * @param {any} room_id
957
+ * @param {bigint} ticket
935
958
  * @returns {boolean}
936
959
  */
937
- markRoomRejoinFailed(room_id) {
938
- const ret = wasm.subscriptiontracker_markRoomRejoinFailed(this.__wbg_ptr, room_id);
960
+ markRoomRejoinFailed(room_id, ticket) {
961
+ const ret = wasm.subscriptiontracker_markRoomRejoinFailed(this.__wbg_ptr, room_id, ticket);
939
962
  if (ret[2]) {
940
963
  throw takeFromExternrefTable0(ret[1]);
941
964
  }
@@ -963,6 +986,18 @@ class SubscriptionTracker {
963
986
  }
964
987
  return ret[0] !== 0;
965
988
  }
989
+ /**
990
+ * @param {any} topic
991
+ * @param {bigint} ticket
992
+ * @returns {boolean}
993
+ */
994
+ recordAgentTopicJoinAmbiguous(topic, ticket) {
995
+ const ret = wasm.subscriptiontracker_recordAgentTopicJoinAmbiguous(this.__wbg_ptr, topic, ticket);
996
+ if (ret[2]) {
997
+ throw takeFromExternrefTable0(ret[1]);
998
+ }
999
+ return ret[0] !== 0;
1000
+ }
966
1001
  /**
967
1002
  * @param {any} room_id
968
1003
  * @param {bigint} ticket
@@ -1000,6 +1035,13 @@ class SubscriptionTracker {
1000
1035
  }
1001
1036
  return getStringFromWasm0(ret[0], ret[1]);
1002
1037
  }
1038
+ /**
1039
+ * @returns {Array<any>}
1040
+ */
1041
+ roomRejoinCandidates() {
1042
+ const ret = wasm.subscriptiontracker_roomRejoinCandidates(this.__wbg_ptr);
1043
+ return ret;
1044
+ }
1003
1045
  /**
1004
1046
  * @param {any} room_id
1005
1047
  * @returns {string}
Binary file
package/index.d.ts CHANGED
@@ -240,21 +240,26 @@ export interface SessionPolicyConfig {
240
240
  rapidCooldownStepS: number;
241
241
  rapidCooldownMaxS: number;
242
242
  rapidThreshold: number;
243
+ heartbeatIntervalS: number;
244
+ deadThresholdS: number;
243
245
  }
244
246
 
245
247
  /**
246
248
  * Reconnect backoff/jitter policy, plus the graduated rapid-disconnect
247
249
  * cooldown ladder. A recommended, not final, starting design.
248
250
  *
249
- * Throws a native `Error` with `.issues`/`.traceContext` if `factor < 1.0`
250
- * or `baseDelayS > maxDelayS`. Throws a plain `Error` if `config` is
251
- * missing a field or a field is not a finite, non-negative number
252
- * (`rapidThreshold` must also be an integer).
251
+ * Throws a native `Error` with `.issues`/`.traceContext` if `factor < 1.0`,
252
+ * `baseDelayS > maxDelayS`, `heartbeatIntervalS == 0`, or
253
+ * `deadThresholdS <= heartbeatIntervalS`. Throws a plain `Error` if
254
+ * `config` is missing a field or a field is not a finite, non-negative
255
+ * number (`rapidThreshold` must also be an integer).
253
256
  */
254
257
  export class SessionPolicy {
255
258
  constructor(config: SessionPolicyConfig, traceContext?: string | null);
256
259
  /** A recommended, not final, default. */
257
260
  static default(): SessionPolicy;
261
+ readonly heartbeatIntervalS: number;
262
+ readonly deadThresholdS: number;
258
263
  }
259
264
 
260
265
  /**
@@ -309,19 +314,22 @@ export class SubscriptionTracker {
309
314
  unsubscribeRoom(roomId: string): bigint | undefined;
310
315
  markRoomLeaveComplete(roomId: string, ticket: bigint, outcome: LeaveOutcome): boolean;
311
316
  acknowledgeRoomReconciled(roomId: string): boolean;
312
- markRoomRejoinFailed(roomId: string): boolean;
317
+ roomRejoinCandidates(): Array<[string, bigint]>;
318
+ markRoomRejoinFailed(roomId: string, ticket: bigint): boolean;
313
319
  subscribedRoomIds(): string[];
314
320
  onReconnected(): void;
315
321
  endSession(): void;
316
322
  beginAgentTopicJoin(topic: string): bigint | undefined;
317
323
  recordAgentTopicJoin(topic: string, ticket: bigint, joined: boolean): boolean;
324
+ recordAgentTopicJoinAmbiguous(topic: string, ticket: bigint): boolean;
318
325
  isAgentTopicJoined(topic: string): boolean;
319
326
  isAgentTopicClaimCurrent(topic: string, ticket: bigint): boolean;
320
327
  agentTopicStatus(topic: string): AgentTopicStatus;
321
328
  leaveAgentTopic(topic: string): bigint | undefined;
322
329
  markAgentTopicLeaveComplete(topic: string, ticket: bigint, outcome: LeaveOutcome): boolean;
323
330
  acknowledgeAgentTopicReconciled(topic: string): boolean;
324
- markAgentTopicRejoinFailed(topic: string): boolean;
331
+ agentTopicRejoinCandidates(): Array<[string, bigint]>;
332
+ markAgentTopicRejoinFailed(topic: string, ticket: bigint): boolean;
325
333
  joinedAgentTopics(): string[];
326
334
  }
327
335
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@band-ai/band-sdk-core",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "Shared Band event-payload validation",
5
5
  "license": "MIT",
6
6
  "repository": {