@vinaverse/client 0.1.0-alpha.8 → 0.1.0-alpha.9

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.
@@ -2616,6 +2616,16 @@ function createAgentRuntime(options) {
2616
2616
  const listeners = /* @__PURE__ */ new Set();
2617
2617
  let status = null;
2618
2618
  let reading = null;
2619
+ const NO_STATUS = {
2620
+ status: null,
2621
+ reading: false,
2622
+ failed: false
2623
+ };
2624
+ let statusState = NO_STATUS;
2625
+ const setStatusState = (next) => {
2626
+ statusState = { status: status?.value ?? null, ...next };
2627
+ changed();
2628
+ };
2619
2629
  let sessionName = null;
2620
2630
  let generation = 0;
2621
2631
  const keyOf = (key) => agentKey(key, options.agent ?? null);
@@ -2795,6 +2805,7 @@ function createAgentRuntime(options) {
2795
2805
  sessionName = null;
2796
2806
  status = null;
2797
2807
  reading = null;
2808
+ statusState = NO_STATUS;
2798
2809
  changed();
2799
2810
  const pairs = [];
2800
2811
  await Promise.all([
@@ -3098,18 +3109,23 @@ function createAgentRuntime(options) {
3098
3109
  if (asked !== generation) return value;
3099
3110
  reading = null;
3100
3111
  status = { value, at: clock.now() };
3101
- changed();
3112
+ setStatusState({ reading: false, failed: false });
3102
3113
  return value;
3103
3114
  },
3104
3115
  (error) => {
3105
- if (asked === generation) reading = null;
3116
+ if (asked === generation) {
3117
+ reading = null;
3118
+ setStatusState({ reading: false, failed: true });
3119
+ }
3106
3120
  throw error;
3107
3121
  }
3108
3122
  );
3109
3123
  reading = read;
3124
+ setStatusState({ reading: true, failed: statusState.failed });
3110
3125
  return read;
3111
3126
  },
3112
3127
  getStatus: () => status?.value ?? null,
3128
+ getStatusState: () => statusState,
3113
3129
  getName: () => sessionName ?? status?.value.displayName ?? null,
3114
3130
  subscribe(listener) {
3115
3131
  listeners.add(listener);