@pluno/product-agent-web 0.1.233 → 0.1.235

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.
@@ -1,5 +1,24 @@
1
1
  import type { ProductAgentState } from "./index";
2
2
  import type { UiInvariantSnapshot } from "./uiInvariants";
3
+ import { type OwnerDiagnostics } from "./runtime/transitionDiagnostics";
4
+ export type UiTransitionContext = {
5
+ capturedAt: number;
6
+ selectionKey: string | null;
7
+ userId: string | null;
8
+ loading: boolean;
9
+ draft: boolean;
10
+ thinking: boolean;
11
+ connected: boolean;
12
+ hasError: boolean;
13
+ phase: string | null;
14
+ queryStatus: string | null;
15
+ queryRequestId: string | null;
16
+ queryUpdatedAt: number | null;
17
+ renderSource: "state" | "account" | "interactions" | "local" | "sidepanel_layout";
18
+ selectionFencePending: boolean;
19
+ guardCreatedAt: number | null;
20
+ owner?: OwnerDiagnostics;
21
+ };
3
22
  export type RenderedErrorEvidence = {
4
23
  sessionId: string | null;
5
24
  itemId: string;
@@ -9,6 +28,7 @@ export type RenderedErrorEvidence = {
9
28
  retryable?: boolean;
10
29
  };
11
30
  export type UiStructureEvidence = {
31
+ context?: UiTransitionContext;
12
32
  sessionId: string | null;
13
33
  messageKeys: string[];
14
34
  canonicalItemKeys: string[];
@@ -27,5 +47,5 @@ export type UiInvariantEvidence = {
27
47
  export declare function isRenderedErrorEvidence(value: unknown): value is RenderedErrorEvidence;
28
48
  export declare function renderedErrorEvidence(state: ProductAgentState, itemId?: string): RenderedErrorEvidence | undefined;
29
49
  export declare function uiInvariantEvidence(current: UiInvariantSnapshot, before?: UiInvariantSnapshot): UiInvariantEvidence;
30
- export declare function captureUiStructure(root: HTMLElement, state: Pick<ProductAgentState, "sessionId" | "messages">): UiStructureEvidence;
50
+ export declare function captureUiStructure(root: HTMLElement, state: Pick<ProductAgentState, "sessionId" | "messages"> & Partial<ProductAgentState>, render?: Partial<Pick<UiTransitionContext, "renderSource" | "selectionFencePending" | "guardCreatedAt">>): UiStructureEvidence;
31
51
  export declare function isUiInvariantEvidence(value: unknown): value is UiInvariantEvidence;
@@ -1,4 +1,5 @@
1
1
  import type { PACommand } from "../core/kernel/commands";
2
+ import { type OwnerDiagnostics } from "./transitionDiagnostics";
2
3
  import type { PAEffectHandlers, PAEffectMapShape } from "../core/kernel/effects";
3
4
  import type { PADomainEvent, PAEngineEvent } from "../core/kernel/events";
4
5
  import type { PAReducer } from "../core/kernel/reducer";
@@ -20,10 +21,19 @@ export declare class PAEngine<TState, TCommand extends PACommand, TDomainEvent e
20
21
  private readonly queue;
21
22
  private draining;
22
23
  private disposed;
24
+ private diagnosticEffects;
25
+ private scopedDiagnostics;
26
+ private diagnostics;
23
27
  constructor(options: PAEngineOptions<TState, TCommand, TDomainEvent, TEffectMap, TProjection>);
24
28
  dispatch(command: TCommand): Promise<void>;
25
29
  accept(event: TDomainEvent): void;
26
30
  getState(): TState;
31
+ recordDiagnosticTransition(value: object, changed?: boolean): void;
32
+ getDiagnostics(scope?: {
33
+ clientScopeId: string;
34
+ scopeId?: string | null;
35
+ sessionId?: string | null;
36
+ }): OwnerDiagnostics;
27
37
  getProjection(): TProjection;
28
38
  subscribe(listener: PAProjectionListener<TProjection>): PAUnsubscribe;
29
39
  dispose(): void;
@@ -0,0 +1,35 @@
1
+ export type OwnerTransition = {
2
+ sequence: number;
3
+ at: number;
4
+ type: string;
5
+ changed: boolean;
6
+ generation: number | null;
7
+ sessionId: string | null;
8
+ scopeId: string | null;
9
+ requestId: string | null;
10
+ effectId: string | null;
11
+ clientScopeId: string | null;
12
+ reason: string | null;
13
+ effectKind: string | null;
14
+ eventType: string | null;
15
+ itemCount: number | null;
16
+ removedCount: number | null;
17
+ projectionReady: boolean | null;
18
+ };
19
+ export type OwnerDiagnostics = {
20
+ ownerId: string;
21
+ revision: number;
22
+ dropped: number;
23
+ lastIntent?: OwnerTransition | null;
24
+ lastSelection: OwnerTransition | null;
25
+ transitions: OwnerTransition[];
26
+ };
27
+ export type ConversationDiagnostics = {
28
+ owner?: OwnerDiagnostics;
29
+ queryStatus: string | null;
30
+ queryRequestId: string | null;
31
+ queryUpdatedAt: number | null;
32
+ };
33
+ export declare const diagnosticId: (value: unknown) => string | null;
34
+ export declare function isOwnerDiagnostics(value: unknown): value is OwnerDiagnostics;
35
+ export declare function ownerTransition(value: object, sequence: number, changed: boolean): OwnerTransition | null;
@@ -1,4 +1,5 @@
1
1
  export type UiInvariantSnapshot = {
2
+ executionKey?: string;
2
3
  messageKeys: string[];
3
4
  canonicalItemKeys: string[];
4
5
  toolCallKeys: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluno/product-agent-web",
3
- "version": "0.1.233",
3
+ "version": "0.1.235",
4
4
  "description": "Browser SDK and default widget for embedding Pluno Product Agent into customer web apps.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -59,5 +59,8 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "socket.io-client": "4.8.3"
62
+ },
63
+ "overrides": {
64
+ "es-module-lexer": "^3.0.2"
62
65
  }
63
66
  }