@pluno/product-agent-web 0.1.220 → 0.1.221

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/README.md +8 -0
  2. package/dist/activeUsersCounter.d.ts +0 -7
  3. package/dist/adapters/web/activeUsers.d.ts +4 -0
  4. package/dist/adapters/web/backendHttp.d.ts +12 -0
  5. package/dist/adapters/web/backendTransport.d.ts +54 -0
  6. package/dist/adapters/web/directoryAdapters.d.ts +85 -0
  7. package/dist/adapters/web/directoryScope.d.ts +42 -0
  8. package/dist/adapters/web/modelScope.d.ts +3 -0
  9. package/dist/adapters/web/socketIOTransport.d.ts +72 -0
  10. package/dist/chatPresentation.d.ts +2 -0
  11. package/dist/core/active-users/reducer.d.ts +47 -0
  12. package/dist/core/index.d.ts +5 -0
  13. package/dist/core/model-selection/commands.d.ts +22 -0
  14. package/dist/core/model-selection/contracts.d.ts +3 -1
  15. package/dist/core/model-selection/events.d.ts +15 -0
  16. package/dist/core/model-selection/reducer.d.ts +4 -0
  17. package/dist/core/model-selection/selectors.d.ts +10 -0
  18. package/dist/core/model-selection/state.d.ts +22 -0
  19. package/dist/core/protocol/modelRouting.d.ts +2 -0
  20. package/dist/core/session-directory/contracts.d.ts +202 -0
  21. package/dist/core/session-directory/membership.d.ts +4 -0
  22. package/dist/core/session-directory/reducer.d.ts +4 -0
  23. package/dist/core/session-directory/selectors.d.ts +2 -0
  24. package/dist/core/session-directory/state.d.ts +6 -0
  25. package/dist/index.d.ts +28 -16
  26. package/dist/interruptState.d.ts +2 -0
  27. package/dist/product-agent-runtime.cjs +1 -1
  28. package/dist/product-agent-runtime.js +384 -315
  29. package/dist/product-agent-sdk.js +7611 -3447
  30. package/dist/product-agent-widget.js +8794 -4769
  31. package/dist/public/operationRoutes.d.ts +1 -0
  32. package/dist/runtime/composition.d.ts +27 -7
  33. package/dist/runtime/modelSelection.d.ts +14 -0
  34. package/dist/runtimeClient.d.ts +10 -0
  35. package/dist/sessionRecoveryPolling.d.ts +3 -0
  36. package/dist/timelineReconciliation.d.ts +1 -0
  37. package/dist/uiInvariants.d.ts +6 -0
  38. package/dist/widget.d.ts +1 -0
  39. package/package.json +4 -1
@@ -92,6 +92,7 @@ export declare const PA_COMPATIBILITY_OPERATION_ROUTES: {
92
92
  readonly "session.load": "engine_command";
93
93
  readonly "session.list": "engine_query";
94
94
  readonly "session.set_model": "engine_command";
95
+ readonly "composer.select_model": "engine_command";
95
96
  readonly "session.pin": "engine_command";
96
97
  readonly "session.rename": "engine_command";
97
98
  readonly "run.stop": "engine_command";
@@ -1,8 +1,16 @@
1
+ import { type PAActiveUsersState, type PAActiveUsersCommand, type PAActiveUsersEffects } from "../core/active-users/reducer";
2
+ import type { PAEffectHandlers } from "../core/kernel/effects";
3
+ import { type PAModelSelectionState } from "../core/model-selection/state";
4
+ import type { PAModelCommand } from "../core/model-selection/commands";
5
+ import type { PAModelEvent } from "../core/model-selection/events";
6
+ import type { PAEngineState } from "../core/kernel/state";
7
+ import type { PADirectoryCommand, PADirectoryEffects, PADirectoryEvent, PADirectoryPorts, PADirectoryState, PADirectoryProjection } from "../core/session-directory/contracts";
1
8
  import { PAEngine } from "./engine";
2
9
  export type PASliceOwner = "legacy" | "core";
3
10
  export declare const PA_SLICE_OWNERSHIP: Readonly<{
4
- readonly modelSelection: "legacy";
5
- readonly directory: "legacy";
11
+ readonly modelSelection: "core";
12
+ readonly directory: "core";
13
+ readonly activeUsers: "core";
6
14
  readonly conversation: "legacy";
7
15
  readonly account: "legacy";
8
16
  readonly interactions: "legacy";
@@ -10,18 +18,30 @@ export declare const PA_SLICE_OWNERSHIP: Readonly<{
10
18
  }>;
11
19
  export type PAProductSlice = keyof typeof PA_SLICE_OWNERSHIP;
12
20
  export type PAOwnerSources<T> = Readonly<{
13
- legacy: () => T;
21
+ legacy?: () => T;
14
22
  core?: () => T;
15
23
  }>;
16
24
  export declare function selectPAOwner<T>(slice: PAProductSlice, sources: PAOwnerSources<T>): T;
25
+ export type PAClientSlices = Readonly<{
26
+ modelSelection: PAModelSelectionState;
27
+ directory: PADirectoryState;
28
+ activeUsers: PAActiveUsersState;
29
+ }>;
30
+ export type PAClientCommand = PAModelCommand | PADirectoryCommand | PAActiveUsersCommand;
31
+ export type PAClientEvent = PAModelEvent | PADirectoryEvent;
32
+ export type PAClientProjection = Readonly<{
33
+ modelSelection: PAModelSelectionState;
34
+ directory: PADirectoryProjection;
35
+ activeUsers: PAActiveUsersState;
36
+ }>;
17
37
  export declare class PAClientRuntime {
18
- readonly engine: PAEngine<Readonly<{
19
- revision: number;
20
- slices: Readonly<object>;
21
- }>, never, never, {}, object>;
38
+ readonly engine: PAEngine<PAEngineState<PAClientSlices>, PAClientCommand, PAClientEvent, PADirectoryEffects & PAActiveUsersEffects, PAClientProjection>;
39
+ private readonly disposeListeners;
40
+ constructor(directoryPorts?: PADirectoryPorts, activeUsersPorts?: PAEffectHandlers<PAActiveUsersEffects>);
22
41
  private disposed;
23
42
  get isDisposed(): boolean;
24
43
  route<T>(slice: PAProductSlice, sources: PAOwnerSources<T>): T;
25
44
  project<T>(slice: PAProductSlice, sources: PAOwnerSources<T>): T;
45
+ onDispose(listener: () => void): () => void;
26
46
  dispose(): void;
27
47
  }
@@ -0,0 +1,14 @@
1
+ import type { PAClientScopeId } from "../core/kernel/state";
2
+ import type { PAProductAgentModel } from "../core/model-selection/contracts";
3
+ import type { PAClientRuntime } from "./composition";
4
+ export declare const getRuntimeModelScope: (runtime: PAClientRuntime, clientScopeId: PAClientScopeId) => Readonly<{
5
+ sessionId: string | null;
6
+ defaultModel: PAProductAgentModel | undefined;
7
+ historyModel?: PAProductAgentModel;
8
+ selectedModel?: PAProductAgentModel;
9
+ submissions: Readonly<Record<string, import("../core/model-selection/state").PAModelSubmission>>;
10
+ }>;
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;
13
+ export declare function acceptModelRouting(runtime: PAClientRuntime, clientScopeId: PAClientScopeId, sessionId: string, clientMessageId: string, value: unknown, updatedAt?: string): void;
14
+ export declare function hydrateModelRouting(runtime: PAClientRuntime, clientScopeId: PAClientScopeId, sessionId: string, turns: unknown): void;
@@ -36,6 +36,9 @@ export type ProductAgentRuntimeCommand = {
36
36
  } | {
37
37
  type: "session.set_model";
38
38
  model: ProductAgentModel;
39
+ } | {
40
+ type: "composer.select_model";
41
+ model: ProductAgentModel;
39
42
  } | {
40
43
  type: "session.pin";
41
44
  sessionId: string;
@@ -46,6 +49,7 @@ export type ProductAgentRuntimeCommand = {
46
49
  title: string;
47
50
  } | {
48
51
  type: "run.stop";
52
+ clientMessageIds?: string[];
49
53
  } | {
50
54
  type: "run.retry";
51
55
  } | {
@@ -61,6 +65,7 @@ export type ProductAgentRuntimeCommand = {
61
65
  clientMessageId: string;
62
66
  } | {
63
67
  type: "conversation.stage";
68
+ requestedModel?: ProductAgentModel;
64
69
  content: string;
65
70
  clientMessageId: string;
66
71
  submittedAt?: number;
@@ -72,6 +77,7 @@ export type ProductAgentRuntimeCommand = {
72
77
  message: string;
73
78
  } | {
74
79
  type: "conversation.send";
80
+ requestedModel?: ProductAgentModel;
75
81
  content: string;
76
82
  clientMessageId: string;
77
83
  initiatedBy?: "pluno";
@@ -83,6 +89,7 @@ export type ProductAgentRuntimeCommand = {
83
89
  };
84
90
  export type ProductAgentRuntimeCommandResult = {
85
91
  clientMessageId?: string | null;
92
+ sessionHistoryPage?: ProductAgentSessionHistoryPage;
86
93
  };
87
94
  export type ProductAgentRuntimeClientAdapter = {
88
95
  dispatch(command: ProductAgentRuntimeCommand): Promise<ProductAgentRuntimeCommandResult | void>;
@@ -156,6 +163,8 @@ export declare class ProductAgentRemoteRuntimeClient implements ProductAgentRunt
156
163
  private account;
157
164
  private stagedProactiveSuggestionClientMessageId;
158
165
  private readonly unacknowledgedSubmissions;
166
+ private submissionGeneration;
167
+ private stoppedProjection;
159
168
  private operationQueue;
160
169
  private destroyed;
161
170
  constructor(initialState: ProductAgentState, adapter: ProductAgentRuntimeClientAdapter, model?: ProductAgentModel);
@@ -184,6 +193,7 @@ export declare class ProductAgentRemoteRuntimeClient implements ProductAgentRunt
184
193
  retryLastMessage(): boolean;
185
194
  createLocalAttachment(file: File): ProductAgentAttachment;
186
195
  stop(): Promise<void>;
196
+ private cancelPendingSubmissions;
187
197
  startNewSession(options?: {
188
198
  notifyTransport?: boolean;
189
199
  }): Promise<void>;
@@ -16,8 +16,11 @@ export declare class ProductAgentSessionRecoveryPoller<Result = void> {
16
16
  private context;
17
17
  private generation;
18
18
  private failureCount;
19
+ private runningGeneration;
20
+ private refreshRequested;
19
21
  constructor(options: ProductAgentSessionRecoveryPollerOptions<Result>);
20
22
  start(sessionId: string, identityScope: string): void;
23
+ refresh(): void;
21
24
  stop(): void;
22
25
  private schedule;
23
26
  private run;
@@ -6,6 +6,7 @@ export type CausalTimelineIdentity = {
6
6
  respondsToUserMessageId?: string;
7
7
  runId?: string;
8
8
  isOptimistic?: boolean;
9
+ isUserMessage?: boolean;
9
10
  isAssistantDraft?: boolean;
10
11
  isActivity?: boolean;
11
12
  isTransient?: boolean;
@@ -11,8 +11,14 @@ export type UiInvariantSnapshot = {
11
11
  runtimeItemCount?: number;
12
12
  thinkingSequence?: ("user" | "thinking")[];
13
13
  thinkingIdleMs?: number;
14
+ inProgress?: boolean;
15
+ hasComposerText?: boolean;
16
+ enabledStopControlCount?: number;
17
+ stopPendingMs?: number;
14
18
  };
15
19
  declare const INVARIANT_MESSAGES: {
20
+ readonly "in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.";
21
+ readonly "stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.";
16
22
  readonly "duplicate-message-item": "A canonical message rendered more than once.";
17
23
  readonly "duplicate-canonical-item": "A canonical session item rendered more than once.";
18
24
  readonly "duplicate-tool-call": "A tool call rendered more than once.";
package/dist/widget.d.ts CHANGED
@@ -30,6 +30,7 @@ export type ProductAgentWidgetOptions = {
30
30
  restorePersistedState?: boolean;
31
31
  expectedPersistedSessionId?: string | null;
32
32
  runtimeCommunityId?: string;
33
+ localRuntimeClientId?: string | null;
33
34
  automationRunId?: string;
34
35
  keepRunsActiveOnSessionNavigation?: boolean;
35
36
  capturePageContent?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluno/product-agent-web",
3
- "version": "0.1.220",
3
+ "version": "0.1.221",
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",
@@ -56,5 +56,8 @@
56
56
  "typescript": "^5.9.2",
57
57
  "vite": "^7.3.6",
58
58
  "vitest": "^3.2.7"
59
+ },
60
+ "dependencies": {
61
+ "socket.io-client": "4.8.3"
59
62
  }
60
63
  }