@pluno/product-agent-web 0.1.246 → 0.1.248

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/INTEGRATION.md CHANGED
@@ -32,6 +32,11 @@ Content-Type: application/json
32
32
  }
33
33
  ```
34
34
 
35
+ Set `metadata.user_id` from the authenticated user on your server. Strings and integers are accepted;
36
+ `24207` and `"24207"` identify the same customer within this integration. Keep the value stable across
37
+ browsers and token refreshes. Omit it only for anonymous chat. Null, booleans, floats, empty strings,
38
+ arrays, and objects are rejected with HTTP 422. Browser widget metadata cannot override this identity.
39
+
35
40
  Pluno returns:
36
41
 
37
42
  ```json
@@ -135,3 +140,15 @@ the hosted module explicitly own the returned widget handle and should call `des
135
140
  - The runtime validates the browser WebSocket `Origin` header against the token origin.
136
141
  - Network capture is always installed by the SDK/widget, shared across instances, and removed after final teardown. There is intentionally no configuration or opt-out for now.
137
142
  - Browser-side redaction runs before network events and tool results are sent to Pluno.
143
+
144
+ ## Connection recovery
145
+
146
+ Use `tokenEndpoint` with the widget, or `tokenProvider` with the SDK, so expired tokens can refresh.
147
+ Temporary failures retry automatically for up to two minutes. The widget preserves the current conversation
148
+ and unsent draft, then offers **Try again** if recovery cannot complete. Setup/access refusals stop retries
149
+ and explain whether the user should sign in again or contact their app administrator. After fixing the cause,
150
+ click **Try again**; remounting the widget is unnecessary.
151
+
152
+ Diagnostics include SDK version, connection attempt, failure stage, HTTP status/classification, and recovery
153
+ outcome. Pending startup diagnostics are bounded and delivered after authenticated recovery. They do not
154
+ include token endpoint response bodies, credentials, draft text, or conversation content.
@@ -41,6 +41,7 @@ export type PADirectoryRecoveryHandles = {
41
41
  export declare class ProductAgentDirectoryObservationAdapter {
42
42
  private readonly options;
43
43
  private readonly queryRequests;
44
+ private readonly queryRetries;
44
45
  private readonly queryWaiters;
45
46
  private readonly refreshAfterRequest;
46
47
  private readonly observations;
@@ -40,7 +40,7 @@ export type PADirectoryAuthority = Readonly<{
40
40
  generation: number;
41
41
  }>;
42
42
  export type PADirectoryQuery = Readonly<{
43
- kind: "recent" | "pinned";
43
+ kind: "recent" | "pinned" | "all";
44
44
  origin: string | null;
45
45
  limit: number;
46
46
  }>;
@@ -52,6 +52,7 @@ export type PADirectoryQueryState = PAQueryState<string, readonly PASessionId[]>
52
52
  startedAtMetadataRevision: number;
53
53
  startedAtActivityRevisionBySessionId: Readonly<Record<string, number>>;
54
54
  pageData: readonly PASessionId[];
55
+ consecutiveFailures: number;
55
56
  }>;
56
57
  export type PADirectoryPatch = Readonly<{
57
58
  title?: string;
@@ -135,6 +136,7 @@ export type PADirectoryCommand = PADirectoryAuthority & (Readonly<{
135
136
  requestId: PARequestId;
136
137
  mode: "replace" | "append";
137
138
  cursor?: string | null;
139
+ resetRecovery?: boolean;
138
140
  }> | Readonly<{
139
141
  type: "directory.invalidate";
140
142
  }> | Readonly<{
@@ -4,3 +4,5 @@ export declare function createDirectoryState(): PADirectoryState;
4
4
  export declare function directoryQueryKey(query: PADirectoryQuery): string;
5
5
  export declare function selectDirectoryPagesForOrigin(queries: Readonly<Record<string, PADirectoryQueryState>>, origin: string | null): readonly PADirectoryQueryState[];
6
6
  export declare function selectCombinedDirectoryPage(pages: readonly PADirectoryQueryState[]): PADirectoryQueryState | undefined;
7
+ export declare function selectDirectorySessionIds(pages: readonly PADirectoryQueryState[]): import("..").PASessionId[];
8
+ export declare function canRetryDirectoryQuery(query: PADirectoryQueryState): boolean;
package/dist/index.d.ts CHANGED
@@ -318,6 +318,10 @@ export declare class ProductAgentSessionEngine {
318
318
  private socketConnectTimer;
319
319
  private socketAuthTimer;
320
320
  private reconnectAttempts;
321
+ private embeddedRecoveryTimer;
322
+ private recoveryDiagnosticId;
323
+ private rejectedDiagnosticsToken;
324
+ private lastRecoveryStage;
321
325
  private connectionAttemptId;
322
326
  private connectionInProgress;
323
327
  private token;
@@ -474,6 +478,9 @@ export declare class ProductAgentSessionEngine {
474
478
  private executeRuntimeHelper;
475
479
  private enableNetworkCapture;
476
480
  private enqueueNetworkEvent;
481
+ private startEmbeddedRecoveryBudget;
482
+ private clearEmbeddedRecoveryBudget;
483
+ private connectionFailureDiagnostic;
477
484
  private scheduleReconnect;
478
485
  private replaceDefaultTransportCredentials;
479
486
  private stopAuthentication;