@pluno/product-agent-web 0.1.203 → 0.1.204

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.
@@ -0,0 +1,99 @@
1
+ import type { ProductAgentSessionEngine } from "../index";
2
+ import type { ProductAgentRuntimeClient } from "../runtimeClient";
3
+ import type { ProductAgentWidgetHandle } from "../widget";
4
+ export type PACompatibilityOperationRoute = "engine_command" | "engine_query" | "projection" | "platform_shell";
5
+ type PAFunctionKey<T> = {
6
+ [TKey in keyof T]-?: T[TKey] extends (...args: never[]) => unknown ? TKey : never;
7
+ }[keyof T] & string;
8
+ type PAPrefixedOperation<TPrefix extends string, TOperation extends string> = `${TPrefix}.${TOperation}`;
9
+ type PASessionEngineOperation = PAPrefixedOperation<"sessionEngine", PAFunctionKey<ProductAgentSessionEngine>>;
10
+ type PARuntimeClientOperation = PAPrefixedOperation<"runtimeClient", PAFunctionKey<ProductAgentRuntimeClient>>;
11
+ type PAWidgetHandleOperation = PAPrefixedOperation<"widgetHandle", PAFunctionKey<ProductAgentWidgetHandle>>;
12
+ export type PAPublicFacadeOperation = PASessionEngineOperation | PARuntimeClientOperation | PAWidgetHandleOperation | "sdk.init" | "sdk.createProductAgentRuntime" | "widget.createProductAgentPreviewBridgeWebSocketFactory" | "widget.mountPlunoProductAgentWidget";
13
+ export declare const PA_COMPATIBILITY_OPERATION_ROUTES: {
14
+ readonly "sdk.init": "platform_shell";
15
+ readonly "sdk.createProductAgentRuntime": "platform_shell";
16
+ readonly "widget.createProductAgentPreviewBridgeWebSocketFactory": "platform_shell";
17
+ readonly "widget.mountPlunoProductAgentWidget": "platform_shell";
18
+ readonly "widgetHandle.startNewChat": "engine_command";
19
+ readonly "widgetHandle.updateAppearance": "platform_shell";
20
+ readonly "widgetHandle.openPanel": "platform_shell";
21
+ readonly "widgetHandle.closePanel": "platform_shell";
22
+ readonly "widgetHandle.updateDisplayState": "platform_shell";
23
+ readonly "widgetHandle.destroy": "platform_shell";
24
+ readonly "runtimeClient.on": "projection";
25
+ readonly "runtimeClient.getState": "projection";
26
+ readonly "runtimeClient.connect": "engine_command";
27
+ readonly "runtimeClient.destroy": "platform_shell";
28
+ readonly "runtimeClient.warmup": "engine_command";
29
+ readonly "runtimeClient.recordWidgetLifecycle": "platform_shell";
30
+ readonly "runtimeClient.sendMessage": "engine_command";
31
+ readonly "runtimeClient.getModel": "projection";
32
+ readonly "runtimeClient.setModel": "engine_command";
33
+ readonly "runtimeClient.retryLastMessage": "engine_command";
34
+ readonly "runtimeClient.createLocalAttachment": "platform_shell";
35
+ readonly "runtimeClient.stop": "engine_command";
36
+ readonly "runtimeClient.startNewSession": "engine_command";
37
+ readonly "runtimeClient.listSessions": "engine_query";
38
+ readonly "runtimeClient.getSessionHistoryState": "projection";
39
+ readonly "runtimeClient.subscribeSessionHistory": "projection";
40
+ readonly "runtimeClient.refreshSessionHistory": "engine_query";
41
+ readonly "runtimeClient.loadMoreSessionHistory": "engine_query";
42
+ readonly "runtimeClient.setSessionPinned": "engine_command";
43
+ readonly "runtimeClient.renameSession": "engine_command";
44
+ readonly "runtimeClient.getInteractions": "projection";
45
+ readonly "runtimeClient.subscribeInteractions": "projection";
46
+ readonly "runtimeClient.actOnInteraction": "engine_command";
47
+ readonly "runtimeClient.getAccount": "projection";
48
+ readonly "runtimeClient.subscribeAccount": "projection";
49
+ readonly "runtimeClient.refreshAccount": "engine_query";
50
+ readonly "runtimeClient.loadSession": "engine_command";
51
+ readonly "runtimeClient.stageProactiveSuggestionQuestion": "engine_command";
52
+ readonly "sessionEngine.on": "projection";
53
+ readonly "sessionEngine.getState": "projection";
54
+ readonly "sessionEngine.stageProactiveSuggestionQuestion": "engine_command";
55
+ readonly "sessionEngine.connect": "engine_command";
56
+ readonly "sessionEngine.disconnect": "engine_command";
57
+ readonly "sessionEngine.destroy": "platform_shell";
58
+ readonly "sessionEngine.warmup": "engine_command";
59
+ readonly "sessionEngine.recordWidgetLifecycle": "platform_shell";
60
+ readonly "sessionEngine.sendMessage": "engine_command";
61
+ readonly "sessionEngine.getModel": "projection";
62
+ readonly "sessionEngine.setModel": "engine_command";
63
+ readonly "sessionEngine.retryLastMessage": "engine_command";
64
+ readonly "sessionEngine.createLocalAttachment": "platform_shell";
65
+ readonly "sessionEngine.uploadAttachment": "platform_shell";
66
+ readonly "sessionEngine.stop": "engine_command";
67
+ readonly "sessionEngine.startNewSession": "engine_command";
68
+ readonly "sessionEngine.listSessions": "engine_query";
69
+ readonly "sessionEngine.getSessionHistoryState": "projection";
70
+ readonly "sessionEngine.subscribeSessionHistory": "projection";
71
+ readonly "sessionEngine.refreshSessionHistory": "engine_query";
72
+ readonly "sessionEngine.loadMoreSessionHistory": "engine_query";
73
+ readonly "sessionEngine.setSessionPinned": "engine_command";
74
+ readonly "sessionEngine.renameSession": "engine_command";
75
+ readonly "sessionEngine.getInteractions": "projection";
76
+ readonly "sessionEngine.subscribeInteractions": "projection";
77
+ readonly "sessionEngine.actOnInteraction": "engine_command";
78
+ readonly "sessionEngine.getAccount": "projection";
79
+ readonly "sessionEngine.subscribeAccount": "projection";
80
+ readonly "sessionEngine.refreshAccount": "engine_query";
81
+ readonly "sessionEngine.loadSession": "engine_command";
82
+ readonly "runtime.connect": "engine_command";
83
+ readonly "runtime.warmup": "engine_command";
84
+ readonly "runtime.widget_lifecycle": "platform_shell";
85
+ readonly "session.new": "engine_command";
86
+ readonly "session.load": "engine_command";
87
+ readonly "session.list": "engine_query";
88
+ readonly "session.set_model": "engine_command";
89
+ readonly "session.pin": "engine_command";
90
+ readonly "session.rename": "engine_command";
91
+ readonly "run.stop": "engine_command";
92
+ readonly "run.retry": "engine_command";
93
+ readonly "interaction.act": "engine_command";
94
+ readonly "conversation.stage_proactive_suggestion": "engine_command";
95
+ readonly "conversation.stage": "engine_command";
96
+ readonly "conversation.fail_staged": "engine_command";
97
+ readonly "conversation.send": "engine_command";
98
+ };
99
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { PAEffect, PAEffectHandlers, PAEffectMapShape, PAEffectResultEvent } from "../core/kernel/effects";
2
+ import type { PATransportedError } from "../core/protocol/errors";
3
+ export type PAInternalError = Readonly<{
4
+ code: string;
5
+ message: string;
6
+ retryable: boolean;
7
+ cause?: unknown;
8
+ }>;
9
+ export type PAEffectErrorAdapter = (error: unknown) => PATransportedError;
10
+ export declare class PAEffectRunner<TEffectMap extends PAEffectMapShape<TEffectMap>> {
11
+ private readonly handlers;
12
+ private readonly accept;
13
+ private readonly errorAdapter;
14
+ private disposed;
15
+ constructor(handlers: PAEffectHandlers<TEffectMap>, accept: (event: PAEffectResultEvent<TEffectMap>) => void, errorAdapter: PAEffectErrorAdapter);
16
+ run(effects: readonly PAEffect<TEffectMap>[]): void;
17
+ dispose(): void;
18
+ private runEffect;
19
+ }
@@ -0,0 +1,33 @@
1
+ import type { PACommand } from "../core/kernel/commands";
2
+ import type { PAEffectHandlers, PAEffectMapShape } from "../core/kernel/effects";
3
+ import type { PADomainEvent, PAEngineEvent } from "../core/kernel/events";
4
+ import type { PAReducer } from "../core/kernel/reducer";
5
+ import type { PAProjectionListener, PASelector, PAUnsubscribe } from "../core/kernel/selectors";
6
+ import { type PAEffectErrorAdapter } from "./effectRunner";
7
+ export type PAEngineOptions<TState, TCommand extends PACommand, TDomainEvent extends PADomainEvent, TEffectMap extends PAEffectMapShape<TEffectMap>, TProjection> = Readonly<{
8
+ initialState: TState;
9
+ reducer: PAReducer<TState, TCommand, PAEngineEvent<TDomainEvent, TEffectMap>, TEffectMap>;
10
+ selector: PASelector<TState, TProjection>;
11
+ effectHandlers: PAEffectHandlers<TEffectMap>;
12
+ errorAdapter: PAEffectErrorAdapter;
13
+ }>;
14
+ export declare class PAEngine<TState, TCommand extends PACommand, TDomainEvent extends PADomainEvent, TEffectMap extends PAEffectMapShape<TEffectMap>, TProjection> {
15
+ private state;
16
+ private readonly reducer;
17
+ private readonly selector;
18
+ private readonly effectRunner;
19
+ private readonly listeners;
20
+ private readonly queue;
21
+ private draining;
22
+ private disposed;
23
+ constructor(options: PAEngineOptions<TState, TCommand, TDomainEvent, TEffectMap, TProjection>);
24
+ dispatch(command: TCommand): Promise<void>;
25
+ accept(event: TDomainEvent): void;
26
+ getState(): TState;
27
+ getProjection(): TProjection;
28
+ subscribe(listener: PAProjectionListener<TProjection>): PAUnsubscribe;
29
+ dispose(): void;
30
+ private acceptEffectResult;
31
+ private drain;
32
+ private publish;
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluno/product-agent-web",
3
- "version": "0.1.203",
3
+ "version": "0.1.204",
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",
@@ -25,9 +25,12 @@
25
25
  ],
26
26
  "scripts": {
27
27
  "build": "vite build --mode sdk && vite build --mode widget && vite build --mode runtime && tsc --emitDeclarationOnly",
28
- "check": "tsc --noEmit",
28
+ "check": "tsc --noEmit && npm run check:core && npm run check:architecture-reference",
29
+ "check:core": "tsc -p tsconfig.core.json && node scripts/check-core-boundaries.mjs",
30
+ "check:architecture-reference": "tsc --noEmit --strict --target ES2020 --module ESNext --moduleResolution Bundler --lib ES2020,DOM ../spec/product-agent/client-core-architecture-reference.d.ts",
31
+ "check:public-api": "node scripts/check-public-api-compatibility.mjs",
29
32
  "test": "vitest run",
30
- "verify:package": "node scripts/verify-package-contents.mjs",
33
+ "verify:package": "node scripts/verify-package-contents.mjs && node scripts/verify-declaration-freshness.mjs",
31
34
  "prepack": "npm run verify:package"
32
35
  },
33
36
  "publishConfig": {