@ukiahinsure/a2ui-react-adapter 0.1.21 → 0.1.22
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/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as A2UIClientAdapter, a as A2UISurfaceMetadata, b as A2UISessionController, c as A2UIRoomLike } from './session-
|
|
2
|
-
export { d as A2UIActionDeliveryStatus, e as A2UIActionResult, f as A2UIActionState, g as A2UICapabilityEnvelope, h as A2UIClientActionEnvelope, i as A2UIClientAdapterOptions, j as A2UIClientErrorEnvelope, k as A2UIClientErrorEvent, l as A2UIEditingSnapshot, m as A2UIFieldControl, n as A2UIFieldDescriptor, o as A2UIFieldInteractionField, p as A2UIFieldInteractionGroup, q as A2UIFieldUpdateEvent, r as A2UIFieldValue, s as A2UIPendingAction, t as A2UIRendererActionEvent, u as A2UIServerEnvelope, v as A2UISessionControllerOptions, w as A2UISessionSnapshot, x as A2UISessionStatus, y as A2UIStreamParticipant, z as A2UISurfaceStructure, B as A2UITabDescriptor, C as A2UITrustedServerParticipant, D as A2UI_CAPABILITIES_TOPIC, E as A2UI_CLIENT_TOPIC, F as A2UI_PROTOCOL_VERSION, G as A2UI_SERVER_TOPIC, H as AckEnvelope, I as AckFieldError, J as AdapterSurface, K as CLIENT_ACTIONS, L as CLIENT_ERROR_CODES, M as ClientAction, N as ClientErrorCode, O as ENVELOPE_VERSION, P as MAX_ENVELOPE_BYTES, Q as ParticipantRole, S as SectionNavigation, R as SnapshotEnvelope, T as SurfaceUpdateEnvelope } from './session-
|
|
1
|
+
import { A as A2UIClientAdapter, a as A2UISurfaceMetadata, b as A2UISessionController, c as A2UIRoomLike } from './session-BU8eDAkA.js';
|
|
2
|
+
export { d as A2UIActionDeliveryStatus, e as A2UIActionResult, f as A2UIActionState, g as A2UICapabilityEnvelope, h as A2UIClientActionEnvelope, i as A2UIClientAdapterOptions, j as A2UIClientErrorEnvelope, k as A2UIClientErrorEvent, l as A2UIEditingSnapshot, m as A2UIFieldControl, n as A2UIFieldDescriptor, o as A2UIFieldInteractionField, p as A2UIFieldInteractionGroup, q as A2UIFieldUpdateEvent, r as A2UIFieldValue, s as A2UIPendingAction, t as A2UIRendererActionEvent, u as A2UIServerEnvelope, v as A2UISessionControllerOptions, w as A2UISessionSnapshot, x as A2UISessionStatus, y as A2UIStreamParticipant, z as A2UISurfaceStructure, B as A2UITabDescriptor, C as A2UITrustedServerParticipant, D as A2UI_CAPABILITIES_TOPIC, E as A2UI_CLIENT_TOPIC, F as A2UI_PROTOCOL_VERSION, G as A2UI_SERVER_TOPIC, H as AckEnvelope, I as AckFieldError, J as AdapterSurface, K as CLIENT_ACTIONS, L as CLIENT_ERROR_CODES, M as ClientAction, N as ClientErrorCode, O as ENVELOPE_VERSION, P as MAX_ENVELOPE_BYTES, Q as ParticipantRole, S as SectionNavigation, R as SnapshotEnvelope, T as SurfaceUpdateEnvelope } from './session-BU8eDAkA.js';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
/** Accessible host around the official A2UI v0.9.1 React surface. */
|
package/dist/index.js
CHANGED
|
@@ -3598,6 +3598,7 @@ import { A2uiMessageListSchema as A2uiMessageListSchema2 } from "@a2ui/web_core/
|
|
|
3598
3598
|
|
|
3599
3599
|
// src/actions.ts
|
|
3600
3600
|
var DEFAULT_ACK_TIMEOUT_MS = 1e4;
|
|
3601
|
+
var MIN_STALL_MS = 2e4;
|
|
3601
3602
|
var SAFE_DETAIL = /^[A-Za-z0-9_.:-]{1,96}$/;
|
|
3602
3603
|
var MAX_IDENTIFIER_LENGTH = 256;
|
|
3603
3604
|
var EMPTY_ACTION_STATE = {
|
|
@@ -3901,11 +3902,25 @@ var A2UIClientActionBridge = class {
|
|
|
3901
3902
|
pending.timeoutId = void 0;
|
|
3902
3903
|
pending.deliveryStatus = "retryable";
|
|
3903
3904
|
this.#notify();
|
|
3905
|
+
this.#watchForStall(pending, generation);
|
|
3904
3906
|
}
|
|
3905
3907
|
}, this.#ackTimeoutMs());
|
|
3906
3908
|
this.#notify();
|
|
3907
3909
|
});
|
|
3908
3910
|
}
|
|
3911
|
+
/** A retried action that times out again is stalled; so is one left unretried. */
|
|
3912
|
+
#watchForStall(pending, generation) {
|
|
3913
|
+
if (pending.attemptCount >= 2) {
|
|
3914
|
+
this.#options.onStalled?.();
|
|
3915
|
+
return;
|
|
3916
|
+
}
|
|
3917
|
+
pending.timeoutId = globalThis.setTimeout(() => {
|
|
3918
|
+
if (this.#isCurrent(pending, generation) && pending.deliveryStatus === "retryable") {
|
|
3919
|
+
pending.timeoutId = void 0;
|
|
3920
|
+
this.#options.onStalled?.();
|
|
3921
|
+
}
|
|
3922
|
+
}, Math.max(this.#ackTimeoutMs() * 2, MIN_STALL_MS));
|
|
3923
|
+
}
|
|
3909
3924
|
#enqueue(operation) {
|
|
3910
3925
|
this.#publishQueue = this.#publishQueue.then(operation).catch(() => void 0);
|
|
3911
3926
|
}
|
|
@@ -4173,7 +4188,8 @@ var A2UISessionController = class {
|
|
|
4173
4188
|
reportClientError: (errorCode, surfaceId, detail) => this.#adapter.reportClientError(errorCode, surfaceId, detail),
|
|
4174
4189
|
onStateChange: (actions) => this.#handleActionStateChange(actions),
|
|
4175
4190
|
participantRole: this.#participantRole,
|
|
4176
|
-
ackTimeoutMs: options.actionAckTimeoutMs
|
|
4191
|
+
ackTimeoutMs: options.actionAckTimeoutMs,
|
|
4192
|
+
onStalled: () => this.resync()
|
|
4177
4193
|
});
|
|
4178
4194
|
}
|
|
4179
4195
|
get status() {
|
|
@@ -4189,6 +4205,18 @@ var A2UISessionController = class {
|
|
|
4189
4205
|
return this.#sessionSnapshot.actions;
|
|
4190
4206
|
}
|
|
4191
4207
|
/** Retry one or every delivery-failed/timed-out request with its original id. */
|
|
4208
|
+
/**
|
|
4209
|
+
* Drop pending actions and request an authoritative snapshot, as after a
|
|
4210
|
+
* reconnect. Used when an action is never acknowledged: the server's state
|
|
4211
|
+
* is the truth, and the form must not stay locked waiting for it.
|
|
4212
|
+
*/
|
|
4213
|
+
resync() {
|
|
4214
|
+
if (this.#closed || this.status !== "connected" || this.restoring) {
|
|
4215
|
+
return;
|
|
4216
|
+
}
|
|
4217
|
+
this.#actionBridge.discardPending();
|
|
4218
|
+
void this.#beginReconnectRestore();
|
|
4219
|
+
}
|
|
4192
4220
|
retryPendingAction(requestId) {
|
|
4193
4221
|
return this.#actionBridge.retryPendingAction(requestId);
|
|
4194
4222
|
}
|