@pluno/product-agent-web 0.1.230 → 0.1.233

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.
Files changed (39) hide show
  1. package/dist/adapters/web/backendHttp.d.ts +16 -2
  2. package/dist/adapters/web/backendTransport.d.ts +3 -0
  3. package/dist/adapters/web/conversationAdapters.d.ts +59 -0
  4. package/dist/adapters/web/conversationCheckpoint.d.ts +16 -0
  5. package/dist/adapters/web/conversationInteractionAdapter.d.ts +11 -0
  6. package/dist/adapters/web/conversationPresentation.d.ts +4 -0
  7. package/dist/adapters/web/directoryAdapters.d.ts +2 -2
  8. package/dist/adapters/web/socketIOTransport.d.ts +4 -0
  9. package/dist/chatPresentation.d.ts +7 -0
  10. package/dist/core/conversation/contracts.d.ts +181 -1
  11. package/dist/core/conversation/delivery.d.ts +22 -0
  12. package/dist/core/conversation/deliveryContracts.d.ts +100 -0
  13. package/dist/core/conversation/display.d.ts +134 -0
  14. package/dist/core/conversation/reducer.d.ts +8 -0
  15. package/dist/core/conversation/selectors.d.ts +59 -0
  16. package/dist/core/conversation/state.d.ts +6 -0
  17. package/dist/core/index.d.ts +6 -0
  18. package/dist/core/model-selection/commands.d.ts +1 -1
  19. package/dist/displayedErrors.d.ts +1 -1
  20. package/dist/entrySurface.d.ts +2 -0
  21. package/dist/index.d.ts +48 -115
  22. package/dist/interactionManager.d.ts +3 -0
  23. package/dist/interruptState.d.ts +1 -1
  24. package/dist/operationTiming.d.ts +21 -0
  25. package/dist/product-agent-runtime.cjs +1 -1
  26. package/dist/product-agent-runtime.js +454 -266
  27. package/dist/product-agent-sdk.js +4197 -4655
  28. package/dist/product-agent-widget.js +8722 -9179
  29. package/dist/protocolTrace.d.ts +3 -0
  30. package/dist/public/operationRoutes.d.ts +2 -0
  31. package/dist/renderDiagnostics.d.ts +31 -0
  32. package/dist/responseDiagnostics.d.ts +1 -0
  33. package/dist/runtime/composition.d.ts +13 -5
  34. package/dist/runtime/modelSelection.d.ts +1 -1
  35. package/dist/runtimeClient.d.ts +20 -6
  36. package/dist/shareCard.d.ts +1 -0
  37. package/dist/uiFlightRecorder.d.ts +4 -1
  38. package/dist/uiInvariants.d.ts +1 -0
  39. package/package.json +1 -1
@@ -0,0 +1,3 @@
1
+ type TraceData = Record<string, string | number | boolean | null>;
2
+ export declare function summarizeCanonicalDisplayEvent(event: Record<string, unknown>): TraceData;
3
+ export {};
@@ -57,6 +57,7 @@ export declare const PA_COMPATIBILITY_OPERATION_ROUTES: {
57
57
  readonly "sessionEngine.destroy": "platform_shell";
58
58
  readonly "sessionEngine.warmup": "engine_command";
59
59
  readonly "sessionEngine.recordWidgetLifecycle": "platform_shell";
60
+ readonly "sessionEngine.reportOperationTiming": "platform_shell";
60
61
  readonly "sessionEngine.reportResponseVisibility": "platform_shell";
61
62
  readonly "sessionEngine.reportDisplayedError": "platform_shell";
62
63
  readonly "sessionEngine.reportInvalidStateTransition": "platform_shell";
@@ -85,6 +86,7 @@ export declare const PA_COMPATIBILITY_OPERATION_ROUTES: {
85
86
  readonly "runtime.connect": "engine_command";
86
87
  readonly "runtime.warmup": "engine_command";
87
88
  readonly "runtime.widget_lifecycle": "platform_shell";
89
+ readonly "runtime.report_operation_timing": "platform_shell";
88
90
  readonly "runtime.report_response_visibility": "platform_shell";
89
91
  readonly "runtime.report_displayed_error": "platform_shell";
90
92
  readonly "runtime.report_invalid_state_transition": "platform_shell";
@@ -0,0 +1,31 @@
1
+ import type { ProductAgentState } from "./index";
2
+ import type { UiInvariantSnapshot } from "./uiInvariants";
3
+ export type RenderedErrorEvidence = {
4
+ sessionId: string | null;
5
+ itemId: string;
6
+ userMessageId: string | null;
7
+ createdAt: string | null;
8
+ runId: string | null;
9
+ retryable?: boolean;
10
+ };
11
+ export type UiStructureEvidence = {
12
+ sessionId: string | null;
13
+ messageKeys: string[];
14
+ canonicalItemKeys: string[];
15
+ terminalResponseKeys: string[];
16
+ toolCallKeys: string[];
17
+ activeResponseKeys: string[];
18
+ thinkingSequence?: ("user" | "thinking")[];
19
+ runtimeItemCount: number;
20
+ welcome: boolean;
21
+ truncated: boolean;
22
+ };
23
+ export type UiInvariantEvidence = {
24
+ before: UiStructureEvidence | null;
25
+ current: UiStructureEvidence;
26
+ };
27
+ export declare function isRenderedErrorEvidence(value: unknown): value is RenderedErrorEvidence;
28
+ export declare function renderedErrorEvidence(state: ProductAgentState, itemId?: string): RenderedErrorEvidence | undefined;
29
+ export declare function uiInvariantEvidence(current: UiInvariantSnapshot, before?: UiInvariantSnapshot): UiInvariantEvidence;
30
+ export declare function captureUiStructure(root: HTMLElement, state: Pick<ProductAgentState, "sessionId" | "messages">): UiStructureEvidence;
31
+ export declare function isUiInvariantEvidence(value: unknown): value is UiInvariantEvidence;
@@ -5,6 +5,7 @@ export declare function getResponseVisibility(owner: object, surface: string, se
5
5
  export declare function buildResponseDiagnostics(owner: object, surface: string, sessionId: string | null, clientMessageId: string | undefined, authenticated: boolean, activeClientMessageId: string | null, pendingClientMessageId: string | null, items: ReadonlyArray<{
6
6
  id: string;
7
7
  role?: string;
8
+ dataType?: string;
8
9
  clientMessageId?: string;
9
10
  respondsToUserMessageId?: string;
10
11
  }>, draftRespondsToUserMessageId?: string | null, hasDraft?: boolean): ResponseDiagnostics;
@@ -6,12 +6,14 @@ import type { PAModelEvent } from "../core/model-selection/events";
6
6
  import type { PAEngineState } from "../core/kernel/state";
7
7
  import type { PADirectoryCommand, PADirectoryEffects, PADirectoryEvent, PADirectoryPorts, PADirectoryState, PADirectoryProjection } from "../core/session-directory/contracts";
8
8
  import { PAEngine } from "./engine";
9
+ import type { PAConversationCommand, PAConversationEffects, PAConversationEvent, PAConversationPorts, PAConversationState } from "../core/conversation/contracts";
10
+ import { selectConversation } from "../core/conversation/selectors";
9
11
  export type PASliceOwner = "legacy" | "core";
10
12
  export declare const PA_SLICE_OWNERSHIP: Readonly<{
11
13
  readonly modelSelection: "core";
12
14
  readonly directory: "core";
13
15
  readonly activeUsers: "core";
14
- readonly conversation: "legacy";
16
+ readonly conversation: "core";
15
17
  readonly account: "legacy";
16
18
  readonly interactions: "legacy";
17
19
  readonly browserExecution: "legacy";
@@ -25,23 +27,29 @@ export declare function selectPAOwner<T>(slice: PAProductSlice, sources: PAOwner
25
27
  export type PAClientSlices = Readonly<{
26
28
  modelSelection: PAModelSelectionState;
27
29
  directory: PADirectoryState;
30
+ conversation: PAConversationState;
28
31
  activeUsers: PAActiveUsersState;
29
32
  }>;
30
- export type PAClientCommand = PAModelCommand | PADirectoryCommand | PAActiveUsersCommand;
31
- export type PAClientEvent = PAModelEvent | PADirectoryEvent;
33
+ export type PAClientCommand = PAModelCommand | PADirectoryCommand | PAConversationCommand | PAActiveUsersCommand;
34
+ export type PAClientEvent = PAModelEvent | PADirectoryEvent | PAConversationEvent;
35
+ type PAClientEffects = PADirectoryEffects & PAConversationEffects & PAActiveUsersEffects;
32
36
  export type PAClientProjection = Readonly<{
33
37
  modelSelection: PAModelSelectionState;
34
38
  directory: PADirectoryProjection;
39
+ conversation: ReturnType<typeof selectConversation>;
35
40
  activeUsers: PAActiveUsersState;
36
41
  }>;
37
42
  export declare class PAClientRuntime {
38
- readonly engine: PAEngine<PAEngineState<PAClientSlices>, PAClientCommand, PAClientEvent, PADirectoryEffects & PAActiveUsersEffects, PAClientProjection>;
43
+ readonly engine: PAEngine<PAEngineState<PAClientSlices>, PAClientCommand, PAClientEvent, PAClientEffects, PAClientProjection>;
39
44
  private readonly disposeListeners;
40
- constructor(directoryPorts?: PADirectoryPorts, activeUsersPorts?: PAEffectHandlers<PAActiveUsersEffects>);
45
+ private conversationPorts;
46
+ constructor(directoryPorts?: PADirectoryPorts, conversationPorts?: Partial<PAConversationPorts>, activeUsersPorts?: PAEffectHandlers<PAActiveUsersEffects>);
41
47
  private disposed;
48
+ installConversationPorts(ports: PAConversationPorts): void;
42
49
  get isDisposed(): boolean;
43
50
  route<T>(slice: PAProductSlice, sources: PAOwnerSources<T>): T;
44
51
  project<T>(slice: PAProductSlice, sources: PAOwnerSources<T>): T;
45
52
  onDispose(listener: () => void): () => void;
46
53
  dispose(): void;
47
54
  }
55
+ export {};
@@ -9,6 +9,6 @@ export declare const getRuntimeModelScope: (runtime: PAClientRuntime, clientScop
9
9
  submissions: Readonly<Record<string, import("../core/model-selection/state").PAModelSubmission>>;
10
10
  }>;
11
11
  export declare const getRuntimeModel: (runtime: PAClientRuntime, clientScopeId: PAClientScopeId) => "anthropic/claude-opus-5" | "anthropic/claude-sonnet-5" | "deepseek/deepseek-chat-v3.1" | "deepseek/deepseek-v4-flash" | "gpt-5.4-nano" | "gpt-5.4-mini" | "gpt-5.4" | "gpt-5.6-luna" | "gpt-5.6-terra" | "gpt-5.6-sol" | undefined;
12
- export declare function captureRequestedModel(runtime: PAClientRuntime, clientScopeId: PAClientScopeId, clientMessageId: string, requestedModel?: PAProductAgentModel): PAProductAgentModel | undefined;
12
+ export declare function captureRequestedModel(runtime: PAClientRuntime, clientScopeId: PAClientScopeId, clientMessageId: string, requestedModel?: PAProductAgentModel | null): PAProductAgentModel | undefined;
13
13
  export declare function acceptModelRouting(runtime: PAClientRuntime, clientScopeId: PAClientScopeId, sessionId: string, clientMessageId: string, value: unknown, updatedAt?: string): void;
14
14
  export declare function hydrateModelRouting(runtime: PAClientRuntime, clientScopeId: PAClientScopeId, sessionId: string, turns: unknown): void;
@@ -1,9 +1,14 @@
1
+ import { type OperationTiming } from "./operationTiming";
2
+ import { type RenderedErrorEvidence, type UiInvariantEvidence } from "./renderDiagnostics";
1
3
  import type { ResponseVisibilityObservation, ProductAgentAttachment, ProductAgentEventMap, ProductAgentInvocation, ProductAgentModel, ProductAgentSessionHistoryPage, ProductAgentSessionHistoryEntry, ProductAgentState, ProductAgentWidgetLifecycleAction, ProductAgentWidgetLifecycleTrigger } from "./index";
2
4
  import type { ProductAgentAccountProjection, ProductAgentInteraction, ProductAgentInteractionAction } from "./runtimeState";
3
5
  import { type ProductAgentEntityQueryData, type ProductAgentQueryState } from "./runtimeState";
4
6
  export type ProductAgentRuntimeEventName = keyof ProductAgentEventMap;
5
7
  export type ProductAgentRuntimeCommand = {
6
8
  type: "runtime.connect";
9
+ } | {
10
+ type: "runtime.report_operation_timing";
11
+ timing: OperationTiming;
7
12
  } | {
8
13
  type: "runtime.report_response_visibility";
9
14
  observation: ResponseVisibilityObservation;
@@ -12,8 +17,10 @@ export type ProductAgentRuntimeCommand = {
12
17
  reason: string;
13
18
  errorFingerprint: string;
14
19
  displayedMessage?: string;
20
+ renderedError?: RenderedErrorEvidence;
15
21
  } | {
16
22
  type: "runtime.report_invalid_state_transition";
23
+ uiInvariant?: UiInvariantEvidence;
17
24
  reason: string;
18
25
  clientMessageId?: string;
19
26
  } | {
@@ -65,6 +72,9 @@ export type ProductAgentRuntimeCommand = {
65
72
  clientMessageId: string;
66
73
  } | {
67
74
  type: "conversation.stage";
75
+ initiatedBy?: "pluno";
76
+ invocation?: ProductAgentInvocation | "pluno";
77
+ automationOnboarding?: boolean;
68
78
  requestedModel?: ProductAgentModel;
69
79
  content: string;
70
80
  clientMessageId: string;
@@ -104,9 +114,10 @@ export type ProductAgentRuntimeClient = {
104
114
  getState(): ProductAgentState;
105
115
  connect(): Promise<void>;
106
116
  destroy(): void;
117
+ reportOperationTiming?(timing: OperationTiming): void;
107
118
  reportResponseVisibility?(observation: ResponseVisibilityObservation): void;
108
- reportInvalidStateTransition?(reason: string, clientMessageId?: string): void;
109
- reportDisplayedError?(reason: string, errorFingerprint: string, displayedMessage?: string): void;
119
+ reportInvalidStateTransition?(reason: string, clientMessageId?: string, uiInvariant?: UiInvariantEvidence): void;
120
+ reportDisplayedError?(reason: string, errorFingerprint: string, displayedMessage?: string, renderedError?: RenderedErrorEvidence): void;
110
121
  warmup(reason?: "panel_open" | "extension_install" | "composer_input"): void;
111
122
  recordWidgetLifecycle(action: ProductAgentWidgetLifecycleAction, trigger: ProductAgentWidgetLifecycleTrigger): void;
112
123
  sendMessage(content: string, options?: {
@@ -162,9 +173,11 @@ export declare class ProductAgentRemoteRuntimeClient implements ProductAgentRunt
162
173
  private interactions;
163
174
  private account;
164
175
  private stagedProactiveSuggestionClientMessageId;
165
- private readonly unacknowledgedSubmissions;
176
+ private readonly pendingTransfers;
177
+ private readonly submissionPreviews;
166
178
  private submissionGeneration;
167
- private stoppedProjection;
179
+ private pendingStop;
180
+ private stopError;
168
181
  private operationQueue;
169
182
  private destroyed;
170
183
  constructor(initialState: ProductAgentState, adapter: ProductAgentRuntimeClientAdapter, model?: ProductAgentModel);
@@ -175,9 +188,10 @@ export declare class ProductAgentRemoteRuntimeClient implements ProductAgentRunt
175
188
  destroy(): void;
176
189
  warmup(reason?: "panel_open" | "extension_install" | "composer_input"): Promise<void>;
177
190
  recordWidgetLifecycle(action: ProductAgentWidgetLifecycleAction, trigger: ProductAgentWidgetLifecycleTrigger): void;
191
+ reportOperationTiming(timing: OperationTiming): void;
178
192
  reportResponseVisibility(observation: ResponseVisibilityObservation): void;
179
- reportInvalidStateTransition(reason: string, clientMessageId?: string): void;
180
- reportDisplayedError(reason: string, errorFingerprint: string, displayedMessage?: string): void;
193
+ reportInvalidStateTransition(reason: string, clientMessageId?: string, uiInvariant?: UiInvariantEvidence): void;
194
+ reportDisplayedError(reason: string, errorFingerprint: string, displayedMessage?: string, renderedError?: RenderedErrorEvidence): void;
181
195
  sendMessage(content: string, options?: {
182
196
  attachments?: ProductAgentAttachment[];
183
197
  clientMessageId?: string;
@@ -11,6 +11,7 @@ export type ProductAgentShareSessionItem = {
11
11
  data: unknown;
12
12
  };
13
13
  export type ProductAgentShareCandidate = {
14
+ variant?: ProductAgentSharePromptVariant;
14
15
  id: string;
15
16
  userPrompt: string;
16
17
  assistantAnswer: string;
@@ -1,3 +1,5 @@
1
+ import { type OperationTiming } from "./operationTiming";
2
+ import { type UiInvariantEvidence } from "./renderDiagnostics";
1
3
  import type { ResponseVisibilityObservation } from "./index";
2
4
  import type { ProductAgentState } from "./index";
3
5
  export type UiFlightRecord = {
@@ -39,6 +41,7 @@ export type UiFlightRecorderHost = HTMLElement & {
39
41
  export declare function startUiFlightRecorder(host: UiFlightRecorderHost, root: HTMLElement, surface: UiFlightEvidence["surface"], runtime: {
40
42
  getState(): ProductAgentState;
41
43
  on(event: "state", listener: (state: ProductAgentState) => void): () => void;
44
+ reportOperationTiming?(timing: OperationTiming): void;
42
45
  reportResponseVisibility?(observation: ResponseVisibilityObservation): void;
43
- reportInvalidStateTransition?(reason: string, clientMessageId?: string): void;
46
+ reportInvalidStateTransition?(reason: string, clientMessageId?: string, evidence?: UiInvariantEvidence): void;
44
47
  }): UiFlightRecorder;
@@ -18,6 +18,7 @@ export type UiInvariantSnapshot = {
18
18
  stopPendingMs?: number;
19
19
  };
20
20
  declare const INVARIANT_MESSAGES: {
21
+ readonly "stop-without-rendered-message": "Stop is enabled while no message is rendered or the welcome screen is still visible.";
21
22
  readonly "in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.";
22
23
  readonly "stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.";
23
24
  readonly "duplicate-message-item": "A canonical message rendered more than once.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluno/product-agent-web",
3
- "version": "0.1.230",
3
+ "version": "0.1.233",
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",