@pluno/product-agent-web 0.1.259 → 0.1.262

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 (44) hide show
  1. package/dist/adapters/web/accountPresentation.d.ts +4 -0
  2. package/dist/adapters/web/contextHttpError.d.ts +1 -0
  3. package/dist/adapters/web/conversationAdapters.d.ts +3 -1
  4. package/dist/adapters/web/deviceHints.d.ts +2 -0
  5. package/dist/adapters/web/featureHttp.d.ts +30 -0
  6. package/dist/adapters/web/featureLifecycle.d.ts +18 -0
  7. package/dist/adapters/web/featureOwner.d.ts +15 -0
  8. package/dist/adapters/web/featurePresentation.d.ts +5 -0
  9. package/dist/core/account/contracts.d.ts +56 -0
  10. package/dist/core/account/presentation.d.ts +49 -0
  11. package/dist/core/account/reducer.d.ts +2 -0
  12. package/dist/core/account/selectors.d.ts +3 -0
  13. package/dist/core/account/state.d.ts +2 -0
  14. package/dist/core/conversation/contracts.d.ts +1 -5
  15. package/dist/core/conversation/delivery.d.ts +1 -0
  16. package/dist/core/conversation/reducer.d.ts +4 -2
  17. package/dist/core/features/appearance.d.ts +10 -0
  18. package/dist/core/features/contracts.d.ts +492 -0
  19. package/dist/core/features/reducer.d.ts +16 -0
  20. package/dist/core/features/selectors.d.ts +15 -0
  21. package/dist/core/features/state.d.ts +2 -0
  22. package/dist/core/features/uiFlightEvidence.d.ts +29 -0
  23. package/dist/core/index.d.ts +11 -0
  24. package/dist/core/interactions/actions.d.ts +12 -0
  25. package/dist/core/interactions/contracts.d.ts +139 -0
  26. package/dist/core/interactions/preferenceOpenings.d.ts +22 -0
  27. package/dist/core/interactions/reducer.d.ts +6 -0
  28. package/dist/core/interactions/selectors.d.ts +25 -0
  29. package/dist/core/interactions/state.d.ts +2 -0
  30. package/dist/core/session-directory/membership.d.ts +3 -2
  31. package/dist/core/session-directory/reducer.d.ts +2 -1
  32. package/dist/index.d.ts +28 -16
  33. package/dist/product-agent-runtime.cjs +1 -1
  34. package/dist/product-agent-runtime.js +34 -26
  35. package/dist/product-agent-sdk.js +6711 -5098
  36. package/dist/product-agent-widget.js +6804 -5403
  37. package/dist/public/operationRoutes.d.ts +4 -1
  38. package/dist/runtime/composition.d.ts +10 -7
  39. package/dist/runtimeClient.d.ts +15 -0
  40. package/dist/runtimeState.d.ts +7 -51
  41. package/dist/themeColors.d.ts +7 -0
  42. package/dist/uiFlightRecorder.d.ts +2 -29
  43. package/package.json +1 -1
  44. package/dist/adapters/web/conversationInteractionAdapter.d.ts +0 -11
@@ -7,7 +7,7 @@ type PAFunctionKey<T> = {
7
7
  }[keyof T] & string;
8
8
  type PAPrefixedOperation<TPrefix extends string, TOperation extends string> = `${TPrefix}.${TOperation}`;
9
9
  type PASessionEngineOperation = PAPrefixedOperation<"sessionEngine", PAFunctionKey<ProductAgentSessionEngine>>;
10
- type PARuntimeClientOperation = PAPrefixedOperation<"runtimeClient", PAFunctionKey<ProductAgentRuntimeClient>>;
10
+ type PARuntimeClientOperation = PAPrefixedOperation<"runtimeClient", PAFunctionKey<ProductAgentRuntimeClient> | Extract<keyof ProductAgentRuntimeClient, "recordPromptPresented">>;
11
11
  type PAWidgetHandleOperation = PAPrefixedOperation<"widgetHandle", PAFunctionKey<ProductAgentWidgetHandle>>;
12
12
  export type PAPublicFacadeOperation = PASessionEngineOperation | PARuntimeClientOperation | PAWidgetHandleOperation | "sdk.init" | "sdk.createProductAgentRuntime" | "widget.createProductAgentPreviewBridgeWebSocketFactory" | "widget.mountPlunoProductAgentWidget";
13
13
  export declare const PA_COMPATIBILITY_OPERATION_ROUTES: {
@@ -27,6 +27,7 @@ export declare const PA_COMPATIBILITY_OPERATION_ROUTES: {
27
27
  readonly "runtimeClient.destroy": "platform_shell";
28
28
  readonly "runtimeClient.warmup": "engine_command";
29
29
  readonly "runtimeClient.recordWidgetLifecycle": "platform_shell";
30
+ readonly "runtimeClient.recordPromptPresented": "engine_command";
30
31
  readonly "runtimeClient.sendMessage": "engine_command";
31
32
  readonly "runtimeClient.getModel": "projection";
32
33
  readonly "runtimeClient.setModel": "engine_command";
@@ -57,6 +58,7 @@ export declare const PA_COMPATIBILITY_OPERATION_ROUTES: {
57
58
  readonly "sessionEngine.destroy": "platform_shell";
58
59
  readonly "sessionEngine.warmup": "engine_command";
59
60
  readonly "sessionEngine.recordWidgetLifecycle": "platform_shell";
61
+ readonly "sessionEngine.recordPromptPresented": "engine_command";
60
62
  readonly "sessionEngine.reportOperationTiming": "platform_shell";
61
63
  readonly "sessionEngine.reportResponseVisibility": "platform_shell";
62
64
  readonly "sessionEngine.reportDisplayedError": "platform_shell";
@@ -86,6 +88,7 @@ export declare const PA_COMPATIBILITY_OPERATION_ROUTES: {
86
88
  readonly "runtime.connect": "engine_command";
87
89
  readonly "runtime.warmup": "engine_command";
88
90
  readonly "runtime.widget_lifecycle": "platform_shell";
91
+ readonly "runtime.prompt_presented": "engine_command";
89
92
  readonly "runtime.report_operation_timing": "platform_shell";
90
93
  readonly "runtime.report_response_visibility": "platform_shell";
91
94
  readonly "runtime.report_displayed_error": "platform_shell";
@@ -1,3 +1,4 @@
1
+ import type { PAStage7Slices, PAStage7Command, PAStage7Effects, PAStage7Ports } from '../core/features/contracts';
1
2
  import { type PAActiveUsersState, type PAActiveUsersCommand, type PAActiveUsersEffects } from "../core/active-users/reducer";
2
3
  import type { PAEffectHandlers } from "../core/kernel/effects";
3
4
  import { type PAModelSelectionState } from "../core/model-selection/state";
@@ -14,8 +15,8 @@ export declare const PA_SLICE_OWNERSHIP: Readonly<{
14
15
  readonly directory: "core";
15
16
  readonly activeUsers: "core";
16
17
  readonly conversation: "core";
17
- readonly account: "legacy";
18
- readonly interactions: "legacy";
18
+ readonly account: "core";
19
+ readonly interactions: "core";
19
20
  readonly browserExecution: "legacy";
20
21
  }>;
21
22
  export type PAProductSlice = keyof typeof PA_SLICE_OWNERSHIP;
@@ -24,16 +25,16 @@ export type PAOwnerSources<T> = Readonly<{
24
25
  core?: () => T;
25
26
  }>;
26
27
  export declare function selectPAOwner<T>(slice: PAProductSlice, sources: PAOwnerSources<T>): T;
27
- export type PAClientSlices = Readonly<{
28
+ export type PAClientSlices = PAStage7Slices & Readonly<{
28
29
  modelSelection: PAModelSelectionState;
29
30
  directory: PADirectoryState;
30
31
  conversation: PAConversationState;
31
32
  activeUsers: PAActiveUsersState;
32
33
  }>;
33
- export type PAClientCommand = PAModelCommand | PADirectoryCommand | PAConversationCommand | PAActiveUsersCommand;
34
+ export type PAClientCommand = PAStage7Command | PAModelCommand | PADirectoryCommand | PAConversationCommand | PAActiveUsersCommand;
34
35
  export type PAClientEvent = PAModelEvent | PADirectoryEvent | PAConversationEvent;
35
- type PAClientEffects = PADirectoryEffects & PAConversationEffects & PAActiveUsersEffects;
36
- export type PAClientProjection = Readonly<{
36
+ type PAClientEffects = PAStage7Effects & PADirectoryEffects & PAConversationEffects & PAActiveUsersEffects;
37
+ export type PAClientProjection = PAStage7Slices & Readonly<{
37
38
  modelSelection: PAModelSelectionState;
38
39
  directory: PADirectoryProjection;
39
40
  conversation: ReturnType<typeof selectConversation>;
@@ -43,9 +44,11 @@ export declare class PAClientRuntime {
43
44
  readonly engine: PAEngine<PAEngineState<PAClientSlices>, PAClientCommand, PAClientEvent, PAClientEffects, PAClientProjection>;
44
45
  private readonly disposeListeners;
45
46
  private conversationPorts;
46
- constructor(directoryPorts?: PADirectoryPorts, conversationPorts?: Partial<PAConversationPorts>, activeUsersPorts?: PAEffectHandlers<PAActiveUsersEffects>);
47
+ private featurePorts;
48
+ constructor(directoryPorts?: PADirectoryPorts, conversationPorts?: Partial<PAConversationPorts>, activeUsersPorts?: PAEffectHandlers<PAActiveUsersEffects>, stage7Ports?: Partial<PAStage7Ports>);
47
49
  private disposed;
48
50
  installConversationPorts(ports: PAConversationPorts): void;
51
+ installFeaturePorts(ports: Partial<PAStage7Ports>): void;
49
52
  get isDisposed(): boolean;
50
53
  route<T>(slice: PAProductSlice, sources: PAOwnerSources<T>): T;
51
54
  project<T>(slice: PAProductSlice, sources: PAOwnerSources<T>): T;
@@ -9,6 +9,10 @@ import { type ProductAgentEntityQueryData, type ProductAgentQueryState } from ".
9
9
  export type ProductAgentRuntimeEventName = keyof ProductAgentEventMap;
10
10
  export type ProductAgentRuntimeCommand = {
11
11
  type: "runtime.connect";
12
+ } | {
13
+ type: "runtime.prompt_presented";
14
+ feature: "notifications" | "tab_grouping";
15
+ openingGeneration: number;
12
16
  } | {
13
17
  type: "runtime.report_operation_timing";
14
18
  timing: OperationTiming;
@@ -71,8 +75,11 @@ export type ProductAgentRuntimeCommand = {
71
75
  interactionId: string;
72
76
  action: ProductAgentInteractionAction;
73
77
  expectedRevision: number;
78
+ expectedSourceVersion?: number | null;
74
79
  snoozeUntil?: string;
75
80
  feedback?: string;
81
+ taskIndex?: number;
82
+ sharePlatform?: "linkedin" | "x" | "instagram";
76
83
  } | {
77
84
  type: "conversation.stage_proactive_suggestion";
78
85
  question: string;
@@ -127,6 +134,7 @@ export type ProductAgentRuntimeClient = {
127
134
  reportInvalidStateTransition?(reason: string, clientMessageId?: string, uiInvariant?: UiInvariantEvidence): void;
128
135
  reportDisplayedError?(reason: string, errorFingerprint: string, displayedMessage?: string, renderedError?: RenderedErrorEvidence, historyRefreshFailure?: HistoryRefreshFailure): void;
129
136
  warmup(reason?: "panel_open" | "extension_install" | "composer_input"): void;
137
+ recordPromptPresented?(feature: "notifications" | "tab_grouping", openingGeneration: number): void;
130
138
  recordWidgetLifecycle(action: ProductAgentWidgetLifecycleAction, trigger: ProductAgentWidgetLifecycleTrigger): void;
131
139
  sendMessage(content: string, options?: {
132
140
  attachments?: ProductAgentAttachment[];
@@ -161,6 +169,9 @@ export type ProductAgentRuntimeClient = {
161
169
  actOnInteraction(interactionId: string, action: ProductAgentInteractionAction, expectedRevision: number, input?: {
162
170
  feedback?: string;
163
171
  snoozeUntil?: string;
172
+ expectedSourceVersion?: number | null;
173
+ taskIndex?: number;
174
+ sharePlatform?: 'linkedin' | 'x' | 'instagram';
164
175
  }): Promise<void>;
165
176
  getAccount(): ProductAgentAccountProjection | null;
166
177
  subscribeAccount(listener: (account: ProductAgentAccountProjection | null) => void): () => void;
@@ -196,6 +207,7 @@ export declare class ProductAgentRemoteRuntimeClient implements ProductAgentRunt
196
207
  connect(): Promise<void>;
197
208
  destroy(): void;
198
209
  warmup(reason?: "panel_open" | "extension_install" | "composer_input"): Promise<void>;
210
+ recordPromptPresented(feature: "notifications" | "tab_grouping", openingGeneration: number): void;
199
211
  recordWidgetLifecycle(action: ProductAgentWidgetLifecycleAction, trigger: ProductAgentWidgetLifecycleTrigger): void;
200
212
  reportOperationTiming(timing: OperationTiming): void;
201
213
  reportResponseVisibility(observation: ResponseVisibilityObservation): void;
@@ -236,6 +248,9 @@ export declare class ProductAgentRemoteRuntimeClient implements ProductAgentRunt
236
248
  actOnInteraction(interactionId: string, action: ProductAgentInteractionAction, expectedRevision: number, input?: {
237
249
  feedback?: string;
238
250
  snoozeUntil?: string;
251
+ expectedSourceVersion?: number | null;
252
+ taskIndex?: number;
253
+ sharePlatform?: 'linkedin' | 'x' | 'instagram';
239
254
  }): Promise<void>;
240
255
  getAccount(): ProductAgentAccountProjection | null;
241
256
  subscribeAccount(listener: (account: ProductAgentAccountProjection | null) => void): () => void;
@@ -1,3 +1,5 @@
1
+ import type { ProductAgentSubmissionGate, ProductAgentAccountProjection } from "./core/account/presentation";
2
+ export type { ProductAgentSafeUser, ProductAgentSafeWorkspace, ProductAgentAuthProjection, ProductAgentSubmissionGate, ProductAgentAccountProjection } from "./core/account/presentation";
1
3
  export type ProductAgentQueryStatus = "not_requested" | "loading" | "ready" | "refreshing" | "loading_more" | "error";
2
4
  export type ProductAgentQueryState<T> = {
3
5
  key: string;
@@ -62,7 +64,7 @@ export type ProductAgentInteractionScope = {
62
64
  key: string;
63
65
  };
64
66
  export type ProductAgentInteractionStatus = "scheduled" | "presentable" | "pending" | "snoozed" | "resolved" | "suppressed" | "expired" | "error";
65
- export type ProductAgentInteractionAction = ProductAgentPromptAction | "enable" | "run" | "edit" | "connect" | "submit_feedback";
67
+ export type ProductAgentInteractionAction = ProductAgentPromptAction | "enable" | "run" | "edit" | "connect" | "submit_feedback" | "not_now" | "dont_enable" | "allow" | "pair" | "copy" | "share" | "feedback";
66
68
  export type ProductAgentInteractionPresentation = {
67
69
  title: string | null;
68
70
  body: string;
@@ -74,6 +76,9 @@ export type ProductAgentInteraction<TKind extends string = string, TPayload = un
74
76
  category: string;
75
77
  scope: ProductAgentInteractionScope;
76
78
  payload: TPayload;
79
+ placement?: "turn" | "bottom_overlay" | "welcome";
80
+ userMessageId?: string | null;
81
+ sourceVersion?: number | null;
77
82
  presentation: ProductAgentInteractionPresentation;
78
83
  eligible: boolean;
79
84
  status: ProductAgentInteractionStatus;
@@ -97,55 +102,7 @@ export declare function resolveProductAgentWidgetPresentation(input: {
97
102
  minimized: boolean;
98
103
  open: boolean;
99
104
  }): ProductAgentWidgetPresentation;
100
- export type ProductAgentSafeUser = {
101
- id: string;
102
- email: string | null;
103
- name: string | null;
104
- };
105
- export type ProductAgentSafeWorkspace = {
106
- id: string;
107
- name: string | null;
108
- };
109
- export type ProductAgentAuthProjection = {
110
- status: "anonymous" | "checking";
111
- user: null;
112
- workspace: null;
113
- } | {
114
- status: "refreshing";
115
- user: ProductAgentSafeUser;
116
- workspace: ProductAgentSafeWorkspace | null;
117
- } | {
118
- status: "authenticated";
119
- user: ProductAgentSafeUser;
120
- workspace: ProductAgentSafeWorkspace | null;
121
- } | {
122
- status: "error";
123
- user: null;
124
- workspace: null;
125
- errorCode: string;
126
- message: string;
127
- };
128
- export type ProductAgentSubmissionGate = {
129
- allowed: boolean;
130
- reason: "allowed" | "authentication_required" | "workspace_required" | "connection_required" | "onboarding_required" | "credits_exhausted" | "payment_issue" | "update_required";
131
- actions: readonly ("login" | "create_workspace" | "complete_onboarding" | "earn_credits" | "upgrade" | "update")[];
132
- };
133
- export type ProductAgentAccountProjection = {
134
- auth?: ProductAgentAuthProjection;
135
- actionUrls?: Partial<Record<ProductAgentSubmissionGate["actions"][number], string>>;
136
- creditsUsed: number | null;
137
- creditLimit: number | null;
138
- creditsRemaining: number | null;
139
- limitExceeded: boolean;
140
- paymentIssue: string | null;
141
- pricingUrl: string;
142
- earnCreditsUrl: string;
143
- onboardingIncomplete?: boolean;
144
- onboardingUrl?: string;
145
- usingPaidCreditFallback?: boolean;
146
- submissionGate?: ProductAgentSubmissionGate;
147
- };
148
- export declare function reconcileProductAgentSubmissionGate(gate: ProductAgentSubmissionGate | undefined, errorCode: string | null | undefined): ProductAgentSubmissionGate;
105
+ export { reconcileProductAgentSubmissionGate } from './core/account/presentation';
149
106
  export declare function hasProductAgentPaidCreditFallback(metadata: unknown): boolean;
150
107
  export type ProductAgentBillingPresentation = {
151
108
  state: "hidden";
@@ -186,4 +143,3 @@ export declare function resolveProductAgentComposerAction(input: {
186
143
  }): ProductAgentComposerAction;
187
144
  export declare const PRODUCT_AGENT_AUTH_RECONNECTING_ERROR_MESSAGE = "Pluno is reconnecting. Try again in a moment.";
188
145
  export declare function isProductAgentAuthReconnectError(error: unknown): boolean;
189
- export {};
@@ -0,0 +1,7 @@
1
+ export type Rgb = [number, number, number];
2
+ export declare function hexToRgb(hex: string): Rgb;
3
+ export declare function rgbToHex([r, g, b]: Rgb): string;
4
+ export declare function mix(a: Rgb, b: Rgb, weightB: number): Rgb;
5
+ export declare function rgba([r, g, b]: Rgb, alpha: number): string;
6
+ export declare function ensureAccentContrast(accent: Rgb, bg: Rgb, colorScheme: "light" | "dark", fg: Rgb): Rgb;
7
+ export declare function readableOn(color: Rgb): Rgb;
@@ -2,35 +2,8 @@ import { type OperationTiming } from "./operationTiming";
2
2
  import { type UiInvariantEvidence } from "./renderDiagnostics";
3
3
  import type { ResponseVisibilityObservation } from "./index";
4
4
  import type { ProductAgentState } from "./index";
5
- export type UiFlightRecord = {
6
- sequence: number;
7
- occurred_at: string;
8
- monotonic_ms: number;
9
- kind: "runtime" | "paint" | "click" | "submit" | "focus";
10
- action: "new_chat" | "send" | "stop" | "retry" | null;
11
- session_id: string | null;
12
- run_id: string | null;
13
- item_keys: string[];
14
- item_count: number;
15
- items_truncated: boolean;
16
- thinking: boolean;
17
- loading: boolean;
18
- welcome: boolean;
19
- error: boolean;
20
- connected: boolean;
21
- visible: boolean;
22
- output_length: number;
23
- active_count: number;
24
- terminal_count: number;
25
- };
26
- export type UiFlightEvidence = {
27
- schema_version: 1;
28
- surface: "extension_sidepanel" | "extension_widget" | "main_web_chat" | "embedded_widget";
29
- recorder_id: string;
30
- sdk_version: string;
31
- dropped_records: number;
32
- records: UiFlightRecord[];
33
- };
5
+ import type { UiFlightEvidence } from "./core/features/uiFlightEvidence";
6
+ export type { UiFlightRecord, UiFlightEvidence } from "./core/features/uiFlightEvidence";
34
7
  export type UiFlightRecorder = {
35
8
  snapshot(): UiFlightEvidence;
36
9
  dispose(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluno/product-agent-web",
3
- "version": "0.1.259",
3
+ "version": "0.1.262",
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",
@@ -1,11 +0,0 @@
1
- import type { PAConversationPorts } from "../../core/conversation/contracts";
2
- import type { PADirectoryAuthority } from "../../core/session-directory/contracts";
3
- import type { ProductAgentInteractionManager } from "../../interactionManager";
4
- import type { PAClientRuntime } from "../../runtime/composition";
5
- export declare function createConversationInteractionPort(options: {
6
- authority: PADirectoryAuthority;
7
- runtime: () => PAClientRuntime;
8
- manager: ProductAgentInteractionManager;
9
- invalidateAuth: (requestId: string) => void;
10
- notify: () => void;
11
- }): PAConversationPorts["conversation.interactions"];