@navsi.ai/shared 1.0.0

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,9 @@
1
+ /**
2
+ * @navsi/shared
3
+ *
4
+ * Shared types and protocol definitions for the AI Chatbot SDK Platform
5
+ */
6
+ export * from './types.js';
7
+ export * from './protocol.js';
8
+ export * from './logger.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,eAAe,CAAC;AAG9B,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @navsi/shared
3
+ *
4
+ * Shared types and protocol definitions for the AI Chatbot SDK Platform
5
+ */
6
+ // Export all types
7
+ export * from './types.js';
8
+ // Export all protocol definitions
9
+ export * from './protocol.js';
10
+ // Export logging utilities
11
+ export * from './logger.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mBAAmB;AACnB,cAAc,YAAY,CAAC;AAE3B,kCAAkC;AAClC,cAAc,eAAe,CAAC;AAE9B,2BAA2B;AAC3B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Simple logger with scoped prefixes and configurable levels.
3
+ */
4
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
5
+ export interface LoggerOptions {
6
+ /** Enable debug/info logging */
7
+ enabled?: boolean;
8
+ /** Minimum level to log when enabled */
9
+ level?: LogLevel;
10
+ /** Optional scope name shown in the prefix */
11
+ scope?: string;
12
+ }
13
+ export declare function createLogger(scope: string, options?: LoggerOptions): {
14
+ debug: (...args: unknown[]) => void;
15
+ info: (...args: unknown[]) => void;
16
+ warn: (...args: unknown[]) => void;
17
+ error: (...args: unknown[]) => void;
18
+ child: (childScope: string, childOptions?: LoggerOptions) => /*elided*/ any;
19
+ };
20
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC1B,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wCAAwC;IACxC,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAoDD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB;qBAgB9C,OAAO,EAAE;oBACV,OAAO,EAAE;oBACT,OAAO,EAAE;qBACR,OAAO,EAAE;wBACN,MAAM,iBAAiB,aAAa;EAG/D"}
package/dist/logger.js ADDED
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Simple logger with scoped prefixes and configurable levels.
3
+ */
4
+ const LEVEL_PRIORITY = {
5
+ debug: 10,
6
+ info: 20,
7
+ warn: 30,
8
+ error: 40,
9
+ };
10
+ function normalizeLevel(value) {
11
+ if (!value)
12
+ return null;
13
+ const lower = value.toLowerCase();
14
+ if (lower === 'debug' || lower === 'info' || lower === 'warn' || lower === 'error') {
15
+ return lower;
16
+ }
17
+ return null;
18
+ }
19
+ function readGlobalLevel() {
20
+ const globalAny = globalThis;
21
+ const fromGlobal = normalizeLevel(globalAny.NAVSI_LOG_LEVEL);
22
+ if (fromGlobal)
23
+ return fromGlobal;
24
+ const env = globalThis.process?.env;
25
+ return normalizeLevel(env?.NAVSI_LOG_LEVEL);
26
+ }
27
+ function readGlobalDebug() {
28
+ const globalAny = globalThis;
29
+ if (typeof globalAny.NAVSI_DEBUG === 'boolean')
30
+ return globalAny.NAVSI_DEBUG;
31
+ if (typeof globalAny.NAVSI_DEBUG === 'string') {
32
+ return ['1', 'true', 'yes', 'on'].includes(globalAny.NAVSI_DEBUG.toLowerCase());
33
+ }
34
+ const env = globalThis.process?.env;
35
+ const raw = env?.NAVSI_DEBUG;
36
+ if (!raw)
37
+ return null;
38
+ return ['1', 'true', 'yes', 'on'].includes(raw.toLowerCase());
39
+ }
40
+ function shouldLog(level, enabled, minLevel) {
41
+ if (!enabled)
42
+ return false;
43
+ return LEVEL_PRIORITY[level] >= LEVEL_PRIORITY[minLevel];
44
+ }
45
+ function getConsoleMethod(level) {
46
+ if (level === 'debug')
47
+ return console.debug ? console.debug.bind(console) : console.log.bind(console);
48
+ if (level === 'info')
49
+ return console.info ? console.info.bind(console) : console.log.bind(console);
50
+ if (level === 'warn')
51
+ return console.warn.bind(console);
52
+ return console.error.bind(console);
53
+ }
54
+ export function createLogger(scope, options = {}) {
55
+ const globalLevel = readGlobalLevel();
56
+ const globalDebug = readGlobalDebug();
57
+ const enabled = options.enabled ?? (globalLevel ? true : (globalDebug ?? false));
58
+ const level = options.level ?? globalLevel ?? (globalDebug ? 'debug' : 'info');
59
+ const prefix = scope ? `[Navsi ${scope}]` : '[Navsi]';
60
+ const logAt = (lvl, args) => {
61
+ if (!shouldLog(lvl, enabled, level))
62
+ return;
63
+ const consoleFn = getConsoleMethod(lvl);
64
+ consoleFn(prefix, new Date().toISOString(), ...args);
65
+ };
66
+ return {
67
+ debug: (...args) => logAt('debug', args),
68
+ info: (...args) => logAt('info', args),
69
+ warn: (...args) => logAt('warn', args),
70
+ error: (...args) => logAt('error', args),
71
+ child: (childScope, childOptions) => createLogger(`${scope}.${childScope}`, { ...options, ...childOptions }),
72
+ };
73
+ }
74
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AA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CAAC;IACjF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAE/E,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IAEtD,MAAM,KAAK,GAAG,CAAC,GAAa,EAAE,IAAe,EAAQ,EAAE;QACnD,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC;YAAE,OAAO;QAC5C,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACxC,SAAS,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IACzD,CAAC,CAAC;IAEF,OAAO;QACH,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;QACnD,IAAI,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC;QACjD,IAAI,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC;QACjD,KAAK,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;QACnD,KAAK,EAAE,CAAC,UAAkB,EAAE,YAA4B,EAAE,EAAE,CACxD,YAAY,CAAC,GAAG,KAAK,IAAI,UAAU,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;KAC9E,CAAC;AACN,CAAC"}
@@ -0,0 +1,277 @@
1
+ /**
2
+ * WebSocket Message Protocol for AI Chatbot SDK
3
+ *
4
+ * This file defines all message types exchanged between the SDK client
5
+ * and the backend server over WebSocket connections.
6
+ */
7
+ import type { PageContext, Command, ServerActionResult, ChatMode } from './types.js';
8
+ /**
9
+ * User sends a chat message
10
+ */
11
+ export interface ClientMessageMessage {
12
+ type: 'message';
13
+ /** The user's message content */
14
+ content: string;
15
+ /** Current page context */
16
+ context: PageContext;
17
+ /** Current chat mode */
18
+ mode: ChatMode;
19
+ /** Message ID for correlation */
20
+ messageId: string;
21
+ /** Optional BCP-47 locale for response language (e.g. 'hi-IN', 'en-US') */
22
+ locale?: string;
23
+ }
24
+ /**
25
+ * Context update (e.g., after navigation)
26
+ */
27
+ export interface ClientContextMessage {
28
+ type: 'context';
29
+ /** Updated page context */
30
+ context: PageContext;
31
+ }
32
+ /**
33
+ * Result of action execution
34
+ */
35
+ export interface ClientActionResultMessage {
36
+ type: 'action_result';
37
+ /** ID of the action that was executed */
38
+ actionId: string;
39
+ /** Whether the action succeeded */
40
+ success: boolean;
41
+ /** Result data if successful */
42
+ result?: unknown;
43
+ /** Error message if failed */
44
+ error?: string;
45
+ /** ID of the command that triggered this action */
46
+ commandId?: string;
47
+ }
48
+ /**
49
+ * Request to execute a server action (webhook mode)
50
+ */
51
+ export interface ClientServerActionRequestMessage {
52
+ type: 'server_action_request';
53
+ /** ID of the server action to execute */
54
+ actionId: string;
55
+ /** Parameters for the action */
56
+ params: Record<string, unknown>;
57
+ /** Request ID for correlation */
58
+ requestId: string;
59
+ }
60
+ /**
61
+ * Ping message for heartbeat
62
+ */
63
+ export interface ClientPingMessage {
64
+ type: 'ping';
65
+ timestamp: number;
66
+ }
67
+ /**
68
+ * Authentication message
69
+ */
70
+ export interface ClientAuthMessage {
71
+ type: 'auth';
72
+ /** API key */
73
+ apiKey: string;
74
+ /** Session ID (optional, for reconnection) */
75
+ sessionId?: string;
76
+ }
77
+ /**
78
+ * Token refresh request
79
+ */
80
+ export interface ClientTokenRefreshMessage {
81
+ type: 'token_refresh';
82
+ /** Refresh token */
83
+ refreshToken: string;
84
+ }
85
+ /**
86
+ * Union of all client-to-server message types
87
+ */
88
+ export type ClientMessage = ClientMessageMessage | ClientContextMessage | ClientActionResultMessage | ClientServerActionRequestMessage | ClientPingMessage | ClientAuthMessage | ClientTokenRefreshMessage;
89
+ /**
90
+ * AI text response
91
+ */
92
+ export interface ServerResponseMessage {
93
+ type: 'response';
94
+ /** The AI's response message */
95
+ message: string;
96
+ /** Message ID */
97
+ messageId: string;
98
+ /** Whether this is a final response or streaming chunk */
99
+ isFinal?: boolean;
100
+ }
101
+ /**
102
+ * Commands to execute (Navigate mode)
103
+ */
104
+ export interface ServerCommandMessage {
105
+ type: 'command';
106
+ /** List of commands to execute sequentially */
107
+ commands: Command[];
108
+ /** Accompanying message to display */
109
+ message?: string;
110
+ /** Command batch ID for correlation */
111
+ batchId: string;
112
+ }
113
+ /**
114
+ * Typing indicator
115
+ */
116
+ export interface ServerTypingMessage {
117
+ type: 'typing';
118
+ /** Whether the AI is typing */
119
+ isTyping: boolean;
120
+ }
121
+ /**
122
+ * Result of server action execution
123
+ */
124
+ export interface ServerActionResultMessage {
125
+ type: 'server_action_result';
126
+ /** ID of the action that was executed */
127
+ actionId: string;
128
+ /** Request ID for correlation */
129
+ requestId: string;
130
+ /** Execution result */
131
+ result: ServerActionResult;
132
+ }
133
+ /**
134
+ * Pong response to ping
135
+ */
136
+ export interface ServerPongMessage {
137
+ type: 'pong';
138
+ timestamp: number;
139
+ }
140
+ /**
141
+ * Authentication success
142
+ */
143
+ export interface ServerAuthSuccessMessage {
144
+ type: 'auth_success';
145
+ /** Session ID */
146
+ sessionId: string;
147
+ /** Access token */
148
+ accessToken: string;
149
+ /** Refresh token */
150
+ refreshToken: string;
151
+ /** Token expiry timestamp */
152
+ expiresAt: number;
153
+ }
154
+ /**
155
+ * Authentication failure
156
+ */
157
+ export interface ServerAuthErrorMessage {
158
+ type: 'auth_error';
159
+ /** Error message */
160
+ error: string;
161
+ /** Error code */
162
+ code: string;
163
+ }
164
+ /**
165
+ * Token refreshed
166
+ */
167
+ export interface ServerTokenRefreshedMessage {
168
+ type: 'token_refreshed';
169
+ /** New access token */
170
+ accessToken: string;
171
+ /** New refresh token */
172
+ refreshToken: string;
173
+ /** New expiry timestamp */
174
+ expiresAt: number;
175
+ }
176
+ /**
177
+ * Error message
178
+ */
179
+ export interface ServerErrorMessage {
180
+ type: 'error';
181
+ /** Error message */
182
+ error: string;
183
+ /** Error code */
184
+ code: string;
185
+ /** Related message ID if applicable */
186
+ messageId?: string;
187
+ /** Additional details */
188
+ details?: Record<string, unknown>;
189
+ }
190
+ /**
191
+ * Request context update (after navigation)
192
+ */
193
+ export interface ServerRequestContextMessage {
194
+ type: 'request_context';
195
+ /** Reason for the request */
196
+ reason: 'navigation_complete' | 'action_complete' | 'refresh';
197
+ }
198
+ /**
199
+ * Connection established
200
+ */
201
+ export interface ServerConnectedMessage {
202
+ type: 'connected';
203
+ /** Server version */
204
+ version: string;
205
+ /** Connection timestamp */
206
+ timestamp: number;
207
+ }
208
+ /**
209
+ * Union of all server-to-client message types
210
+ */
211
+ export type ServerMessage = ServerResponseMessage | ServerCommandMessage | ServerTypingMessage | ServerActionResultMessage | ServerPongMessage | ServerAuthSuccessMessage | ServerAuthErrorMessage | ServerTokenRefreshedMessage | ServerErrorMessage | ServerRequestContextMessage | ServerConnectedMessage;
212
+ /**
213
+ * Events emitted by the WebSocket client
214
+ */
215
+ export interface WebSocketEvents {
216
+ /** Connection established */
217
+ connected: {
218
+ sessionId: string;
219
+ };
220
+ /** Connection closed */
221
+ disconnected: {
222
+ reason: string;
223
+ code: number;
224
+ };
225
+ /** Reconnection attempt */
226
+ reconnecting: {
227
+ attempt: number;
228
+ maxAttempts: number;
229
+ };
230
+ /** Reconnection failed */
231
+ reconnect_failed: {
232
+ reason: string;
233
+ };
234
+ /** Message received */
235
+ message: ServerMessage;
236
+ /** Error occurred */
237
+ error: {
238
+ error: Error;
239
+ code?: string;
240
+ };
241
+ /** Authentication success */
242
+ authenticated: {
243
+ sessionId: string;
244
+ expiresAt: number;
245
+ };
246
+ /** Token refreshed */
247
+ token_refreshed: {
248
+ expiresAt: number;
249
+ };
250
+ }
251
+ /**
252
+ * Extract message type from union
253
+ */
254
+ export type ExtractMessageType<T, K> = T extends {
255
+ type: K;
256
+ } ? T : never;
257
+ /**
258
+ * Get client message by type
259
+ */
260
+ export type ClientMessageByType<T extends ClientMessage['type']> = ExtractMessageType<ClientMessage, T>;
261
+ /**
262
+ * Get server message by type
263
+ */
264
+ export type ServerMessageByType<T extends ServerMessage['type']> = ExtractMessageType<ServerMessage, T>;
265
+ /**
266
+ * Create a unique message ID
267
+ */
268
+ export declare function createMessageId(): string;
269
+ /**
270
+ * Create a unique request ID
271
+ */
272
+ export declare function createRequestId(): string;
273
+ /**
274
+ * Create a unique batch ID
275
+ */
276
+ export declare function createBatchId(): string;
277
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACR,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACX,MAAM,YAAY,CAAC;AAMpB;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,wBAAwB;IACxB,IAAI,EAAE,QAAQ,CAAC;IACf,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,2BAA2B;IAC3B,OAAO,EAAE,WAAW,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,eAAe,CAAC;IACtB,yCAAyC;IACzC,QAAQ,EAAE,MAAM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rC,uBAAuB;IACvB,OAAO,EAAE,aAAa,CAAC;IACvB,qBAAqB;IACrB,KAAK,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,6BAA6B;IAC7B,aAAa,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,sBAAsB;IACtB,eAAe,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1C;AAMD;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,IAAI,kBAAkB,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;AAExG;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,IAAI,kBAAkB,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;AAMxG;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * WebSocket Message Protocol for AI Chatbot SDK
3
+ *
4
+ * This file defines all message types exchanged between the SDK client
5
+ * and the backend server over WebSocket connections.
6
+ */
7
+ // ============================================================================
8
+ // Message Creators (Utility functions)
9
+ // ============================================================================
10
+ /**
11
+ * Create a unique message ID
12
+ */
13
+ export function createMessageId() {
14
+ return `msg_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
15
+ }
16
+ /**
17
+ * Create a unique request ID
18
+ */
19
+ export function createRequestId() {
20
+ return `req_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
21
+ }
22
+ /**
23
+ * Create a unique batch ID
24
+ */
25
+ export function createBatchId() {
26
+ return `batch_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
27
+ }
28
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgTH,+EAA+E;AAC/E,uCAAuC;AACvC,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,eAAe;IAC3B,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC7E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC3B,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC7E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IACzB,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,442 @@
1
+ /**
2
+ * Core type definitions for the AI Chatbot SDK Platform
3
+ */
4
+ /**
5
+ * Definition of a parameter for actions and server actions
6
+ */
7
+ export interface ParameterDefinition {
8
+ /** Unique name of the parameter */
9
+ name: string;
10
+ /** Type of the parameter value */
11
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object';
12
+ /** Whether the parameter is required */
13
+ required: boolean;
14
+ /** Human-readable description */
15
+ description?: string;
16
+ /** Default value if not provided */
17
+ defaultValue?: unknown;
18
+ /** Enum of allowed values */
19
+ enumValues?: string[];
20
+ }
21
+ /**
22
+ * Types of DOM interactions the chatbot can perform
23
+ */
24
+ export type ActionType = 'click' | 'type' | 'select' | 'scroll' | 'focus' | 'hover';
25
+ /**
26
+ * Definition of a client-side DOM action
27
+ */
28
+ export interface ActionDefinition {
29
+ /** Unique identifier for the action */
30
+ id: string;
31
+ /** Type of DOM interaction */
32
+ type: ActionType;
33
+ /** CSS selector to find the target element */
34
+ selector: string;
35
+ /** Human-readable label for the action */
36
+ label: string;
37
+ /** Route where this action is available */
38
+ route: string;
39
+ /** Optional parameters for the action (e.g., text to type) */
40
+ parameters?: ParameterDefinition[];
41
+ /** Priority for action matching (higher = preferred) */
42
+ priority?: number;
43
+ /** Whether this was auto-discovered or manually defined */
44
+ isAutoDiscovered?: boolean;
45
+ /** Additional metadata from data attributes */
46
+ metadata?: Record<string, string>;
47
+ }
48
+ /**
49
+ * Context provided to server action handlers
50
+ */
51
+ export interface ServerActionContext {
52
+ /** Current session ID */
53
+ sessionId: string;
54
+ /** User ID if authenticated */
55
+ userId?: string;
56
+ /** Authentication token */
57
+ authToken?: string;
58
+ /** Current route */
59
+ currentRoute: string;
60
+ /** Additional custom context */
61
+ custom?: Record<string, unknown>;
62
+ }
63
+ /**
64
+ * Result returned from server action execution
65
+ */
66
+ export interface ServerActionResult {
67
+ /** Whether the action succeeded */
68
+ success: boolean;
69
+ /** Result data on success */
70
+ data?: unknown;
71
+ /** Error message on failure */
72
+ error?: string;
73
+ /** Additional metadata */
74
+ metadata?: Record<string, unknown>;
75
+ }
76
+ /**
77
+ * Handler function type for server actions
78
+ */
79
+ export type ServerActionHandler = (params: Record<string, unknown>, context: ServerActionContext) => Promise<ServerActionResult>;
80
+ /**
81
+ * Definition of a server-side action
82
+ */
83
+ export interface ServerAction {
84
+ /** Unique identifier for the action */
85
+ id: string;
86
+ /** Human-readable name */
87
+ name: string;
88
+ /** Description of what the action does (used for AI understanding) */
89
+ description: string;
90
+ /** Parameters the action accepts */
91
+ parameters: ParameterDefinition[];
92
+ /** Handler function (for handler mode - runs in browser) */
93
+ handler?: ServerActionHandler;
94
+ /** Webhook URL (for webhook mode - backend-to-backend) */
95
+ webhookUrl?: string;
96
+ /** Secret for HMAC signing (webhook mode) */
97
+ webhookSecret?: string;
98
+ /** Timeout in milliseconds (default: 30000) */
99
+ timeout?: number;
100
+ /** Whether this action requires confirmation before executing */
101
+ requiresConfirmation?: boolean;
102
+ }
103
+ /**
104
+ * Abstract interface for navigation adapters
105
+ * Allows the SDK to work with any routing library
106
+ */
107
+ export interface NavigationAdapter {
108
+ /** Navigate to a path */
109
+ navigate(path: string): void;
110
+ /** Get the current path */
111
+ getCurrentPath(): string;
112
+ /** Subscribe to route changes, returns unsubscribe function */
113
+ onRouteChange(callback: (path: string) => void): () => void;
114
+ /** Wait for a specific route to become active */
115
+ waitForRoute(path: string, timeout?: number): Promise<boolean>;
116
+ }
117
+ /**
118
+ * Position options for the chat widget
119
+ */
120
+ export type WidgetPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
121
+ /**
122
+ * Theme configuration for the widget
123
+ */
124
+ export interface WidgetTheme {
125
+ /** Primary brand color */
126
+ primaryColor: string;
127
+ /** Secondary/accent color */
128
+ secondaryColor: string;
129
+ /** Widget position on screen */
130
+ position: WidgetPosition;
131
+ /** Background color */
132
+ backgroundColor?: string;
133
+ /** Text color */
134
+ textColor?: string;
135
+ /** Font family */
136
+ fontFamily?: string;
137
+ /** Border radius for rounded corners */
138
+ borderRadius?: number;
139
+ /** Enable dark mode */
140
+ darkMode?: boolean;
141
+ }
142
+ /**
143
+ * Full widget configuration
144
+ */
145
+ export interface WidgetConfig {
146
+ /** Theme settings */
147
+ theme: WidgetTheme;
148
+ /** Welcome message shown when chat opens */
149
+ welcomeMessage?: string;
150
+ /** Placeholder text for input field */
151
+ inputPlaceholder?: string;
152
+ /** Show mode toggle (Ask/Navigate) */
153
+ showModeToggle?: boolean;
154
+ /** Default mode when chat opens */
155
+ defaultMode?: ChatMode;
156
+ /** Whether the widget is open by default */
157
+ defaultOpen?: boolean;
158
+ /** Enable keyboard shortcuts */
159
+ enableKeyboardShortcuts?: boolean;
160
+ /** Custom CSS classes */
161
+ customClassName?: string;
162
+ /** Avatar URL for the bot */
163
+ botAvatarUrl?: string;
164
+ /** Header title */
165
+ headerTitle?: string;
166
+ /** BCP-47 language for voice input/output and AI response (e.g. 'hi-IN' for Hindi) */
167
+ voiceLanguage?: string;
168
+ /** Subtitle / hint text shown below title or in empty state */
169
+ subtitle?: string;
170
+ /** Placeholder for Ask mode input */
171
+ askPlaceholder?: string;
172
+ /** Placeholder for Navigate mode input */
173
+ navigatePlaceholder?: string;
174
+ /** Supported voice languages shown in language picker */
175
+ supportedLanguages?: Array<{
176
+ code: string;
177
+ label: string;
178
+ }>;
179
+ }
180
+ /**
181
+ * Flat widget config (API/Prisma shape). Use normalizeWidgetConfig() to convert to WidgetConfig.
182
+ */
183
+ export interface FlatWidgetConfig {
184
+ primaryColor?: string;
185
+ secondaryColor?: string;
186
+ position?: WidgetPosition;
187
+ backgroundColor?: string;
188
+ textColor?: string;
189
+ fontFamily?: string;
190
+ borderRadius?: number;
191
+ darkMode?: boolean;
192
+ welcomeMessage?: string;
193
+ inputPlaceholder?: string;
194
+ showModeToggle?: boolean;
195
+ defaultMode?: string;
196
+ headerTitle?: string;
197
+ botAvatarUrl?: string | null;
198
+ /** BCP-47 language for voice (e.g. 'hi-IN') */
199
+ voiceLanguage?: string;
200
+ }
201
+ /**
202
+ * Convert flat API config to WidgetConfig for the SDK.
203
+ */
204
+ export declare function normalizeWidgetConfig(flat?: FlatWidgetConfig | null): WidgetConfig;
205
+ /**
206
+ * Operating modes for the chatbot
207
+ */
208
+ export type ChatMode = 'ask' | 'navigate';
209
+ /**
210
+ * Context information about a form on the page
211
+ */
212
+ export interface FormContext {
213
+ /** Form ID or selector */
214
+ id: string;
215
+ /** Form name attribute */
216
+ name?: string;
217
+ /** Form action URL */
218
+ action?: string;
219
+ /** HTTP method */
220
+ method?: string;
221
+ /** Input fields in the form */
222
+ fields: Array<{
223
+ name: string;
224
+ type: string;
225
+ label?: string;
226
+ placeholder?: string;
227
+ required?: boolean;
228
+ value?: string;
229
+ }>;
230
+ }
231
+ /**
232
+ * Content extracted from the current page
233
+ */
234
+ export interface PageContent {
235
+ /** Heading elements text */
236
+ headings: string[];
237
+ /** Main content summary (truncated if too long) */
238
+ mainContent: string;
239
+ /** Forms on the page */
240
+ forms: FormContext[];
241
+ /** Meta description */
242
+ metaDescription?: string;
243
+ }
244
+ /**
245
+ * Complete context of the current page state
246
+ * Sent to the AI engine for understanding available actions
247
+ */
248
+ export interface PageContext {
249
+ /** Current route/path */
250
+ route: string;
251
+ /** Page title */
252
+ title: string;
253
+ /** Available DOM actions */
254
+ actions: ActionDefinition[];
255
+ /** Available server actions */
256
+ serverActions: ServerAction[];
257
+ /** Page content */
258
+ content: PageContent;
259
+ /** Timestamp when context was captured */
260
+ timestamp: number;
261
+ /** Optional list of all available routes in the application */
262
+ routes?: string[];
263
+ }
264
+ /**
265
+ * Role of the message sender
266
+ */
267
+ export type MessageRole = 'user' | 'assistant' | 'system';
268
+ /**
269
+ * Status of a chat message
270
+ */
271
+ export type MessageStatus = 'sending' | 'sent' | 'error';
272
+ /**
273
+ * A single chat message
274
+ */
275
+ export interface Message {
276
+ /** Unique message ID */
277
+ id: string;
278
+ /** Who sent the message */
279
+ role: MessageRole;
280
+ /** Message content */
281
+ content: string;
282
+ /** Timestamp */
283
+ timestamp: number;
284
+ /** Message status */
285
+ status?: MessageStatus;
286
+ /** Associated commands (for assistant messages in navigate mode) */
287
+ commands?: Command[];
288
+ /** Error if status is 'error' */
289
+ error?: string;
290
+ }
291
+ /**
292
+ * Types of commands the AI can generate
293
+ */
294
+ export type CommandType = 'navigate' | 'wait_for_route' | 'wait_for_dom_stable' | 'scan_context' | 'click' | 'type' | 'select' | 'scroll' | 'server_action' | 'report_result';
295
+ /**
296
+ * Base command interface
297
+ */
298
+ export interface BaseCommand {
299
+ /** Command type */
300
+ type: CommandType;
301
+ /** Optional timeout in milliseconds */
302
+ timeout?: number;
303
+ }
304
+ /**
305
+ * Navigate to a route
306
+ */
307
+ export interface NavigateCommand extends BaseCommand {
308
+ type: 'navigate';
309
+ target: string;
310
+ }
311
+ /**
312
+ * Wait for a route to become active
313
+ */
314
+ export interface WaitForRouteCommand extends BaseCommand {
315
+ type: 'wait_for_route';
316
+ target: string;
317
+ }
318
+ /**
319
+ * Wait for DOM to stabilize after navigation
320
+ */
321
+ export interface WaitForDomStableCommand extends BaseCommand {
322
+ type: 'wait_for_dom_stable';
323
+ }
324
+ /**
325
+ * Rescan the page context
326
+ */
327
+ export interface ScanContextCommand extends BaseCommand {
328
+ type: 'scan_context';
329
+ }
330
+ /**
331
+ * Click an element
332
+ */
333
+ export interface ClickCommand extends BaseCommand {
334
+ type: 'click';
335
+ /** CSS selector; omit when using text to resolve */
336
+ selector?: string;
337
+ /** Alternative text to find element by */
338
+ text?: string;
339
+ /** Disambiguate when multiple elements share the same label (e.g. product name for "remove") */
340
+ context?: string;
341
+ }
342
+ /**
343
+ * Type text into an input
344
+ */
345
+ export interface TypeCommand extends BaseCommand {
346
+ type: 'type';
347
+ /** CSS selector; omit when using text to resolve */
348
+ selector?: string;
349
+ value: string;
350
+ /** Clear existing content before typing */
351
+ clear?: boolean;
352
+ /** Label/placeholder to find the field when selector is ambiguous */
353
+ text?: string;
354
+ }
355
+ /**
356
+ * Select an option from a dropdown
357
+ */
358
+ export interface SelectCommand extends BaseCommand {
359
+ type: 'select';
360
+ /** CSS selector; omit when using text to resolve */
361
+ selector?: string;
362
+ value: string;
363
+ /** Label/placeholder to find the field when selector is ambiguous */
364
+ text?: string;
365
+ }
366
+ /**
367
+ * Scroll to an element or position
368
+ */
369
+ export interface ScrollCommand extends BaseCommand {
370
+ type: 'scroll';
371
+ selector?: string;
372
+ position?: {
373
+ x: number;
374
+ y: number;
375
+ };
376
+ }
377
+ /**
378
+ * Execute a server action
379
+ */
380
+ export interface ServerActionCommand extends BaseCommand {
381
+ type: 'server_action';
382
+ actionId: string;
383
+ params: Record<string, unknown>;
384
+ }
385
+ /**
386
+ * Report execution result
387
+ */
388
+ export interface ReportResultCommand extends BaseCommand {
389
+ type: 'report_result';
390
+ }
391
+ /**
392
+ * Union type of all commands
393
+ */
394
+ export type Command = NavigateCommand | WaitForRouteCommand | WaitForDomStableCommand | ScanContextCommand | ClickCommand | TypeCommand | SelectCommand | ScrollCommand | ServerActionCommand | ReportResultCommand;
395
+ /**
396
+ * WebSocket connection states
397
+ */
398
+ export type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting' | 'failed';
399
+ /**
400
+ * State of command execution
401
+ */
402
+ export interface ExecutionState {
403
+ /** Whether execution is in progress */
404
+ isExecuting: boolean;
405
+ /** Current command being executed */
406
+ currentCommand?: Command;
407
+ /** Index in the command queue */
408
+ currentIndex: number;
409
+ /** Total commands in queue */
410
+ totalCommands: number;
411
+ /** Error if execution failed */
412
+ error?: string;
413
+ /**
414
+ * Optional human-readable description of what is currently happening.
415
+ * e.g. "Clicking \"Checkout\" button" or "Typing into email field".
416
+ */
417
+ description?: string;
418
+ }
419
+ /**
420
+ * Main SDK configuration
421
+ */
422
+ export interface SDKConfig {
423
+ /** API key for authentication */
424
+ apiKey: string;
425
+ /** WebSocket server URL */
426
+ serverUrl: string;
427
+ /** Navigation adapter for routing */
428
+ navigationAdapter?: NavigationAdapter;
429
+ /** Server actions to register */
430
+ serverActions?: ServerAction[];
431
+ /** Widget configuration */
432
+ widget?: Partial<WidgetConfig>;
433
+ /** Enable debug mode */
434
+ debug?: boolean;
435
+ /** Auto-reconnect settings */
436
+ reconnect?: {
437
+ enabled: boolean;
438
+ maxAttempts: number;
439
+ delayMs: number;
440
+ };
441
+ }
442
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version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AY,GACZ,WAAW,GACX,aAAa,GACb,aAAa,GACb,mBAAmB,GACnB,mBAAmB,CAAC;AAM1B;;GAEG;AACH,MAAM,MAAM,eAAe,GACrB,cAAc,GACd,YAAY,GACZ,WAAW,GACX,cAAc,GACd,QAAQ,CAAC;AAMf;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,uCAAuC;IACvC,WAAW,EAAE,OAAO,CAAC;IACrB,qCAAqC;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,iCAAiC;IACjC,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,2BAA2B;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,wBAAwB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8BAA8B;IAC9B,SAAS,CAAC,EAAE;QACR,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;KACnB,CAAC;CACL"}
package/dist/types.js ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Core type definitions for the AI Chatbot SDK Platform
3
+ */
4
+ /** Default theme when no config is provided */
5
+ const DEFAULT_THEME = {
6
+ primaryColor: '#6366f1',
7
+ secondaryColor: '#8b5cf6',
8
+ position: 'bottom-right',
9
+ backgroundColor: '#ffffff',
10
+ textColor: '#1f2937',
11
+ fontFamily: 'Inter, system-ui, sans-serif',
12
+ borderRadius: 12,
13
+ darkMode: false,
14
+ };
15
+ /**
16
+ * Convert flat API config to WidgetConfig for the SDK.
17
+ */
18
+ export function normalizeWidgetConfig(flat) {
19
+ if (!flat) {
20
+ return { theme: { ...DEFAULT_THEME } };
21
+ }
22
+ const mode = (flat.defaultMode === 'navigate' ? 'navigate' : 'ask');
23
+ return {
24
+ theme: {
25
+ primaryColor: flat.primaryColor ?? DEFAULT_THEME.primaryColor,
26
+ secondaryColor: flat.secondaryColor ?? DEFAULT_THEME.secondaryColor,
27
+ position: flat.position ?? DEFAULT_THEME.position,
28
+ backgroundColor: flat.backgroundColor ?? DEFAULT_THEME.backgroundColor,
29
+ textColor: flat.textColor ?? DEFAULT_THEME.textColor,
30
+ fontFamily: flat.fontFamily ?? DEFAULT_THEME.fontFamily,
31
+ borderRadius: flat.borderRadius ?? DEFAULT_THEME.borderRadius,
32
+ darkMode: flat.darkMode ?? DEFAULT_THEME.darkMode,
33
+ },
34
+ welcomeMessage: flat.welcomeMessage,
35
+ inputPlaceholder: flat.inputPlaceholder,
36
+ showModeToggle: flat.showModeToggle,
37
+ defaultMode: mode,
38
+ headerTitle: flat.headerTitle,
39
+ botAvatarUrl: flat.botAvatarUrl ?? undefined,
40
+ voiceLanguage: flat.voiceLanguage,
41
+ };
42
+ }
43
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAuOH,+CAA+C;AAC/C,MAAM,aAAa,GAAgB;IAC/B,YAAY,EAAE,SAAS;IACvB,cAAc,EAAE,SAAS;IACzB,QAAQ,EAAE,cAAc;IACxB,eAAe,EAAE,SAAS;IAC1B,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,8BAA8B;IAC1C,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,KAAK;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAA8B;IAChE,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAO,EAAE,KAAK,EAAE,EAAE,GAAG,aAAa,EAAE,EAAE,CAAC;IAC3C,CAAC;IACD,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAa,CAAC;IAChF,OAAO;QACH,KAAK,EAAE;YACH,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,aAAa,CAAC,YAAY;YAC7D,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,aAAa,CAAC,cAAc;YACnE,QAAQ,EAAG,IAAI,CAAC,QAA2B,IAAI,aAAa,CAAC,QAAQ;YACrE,eAAe,EAAE,IAAI,CAAC,eAAe,IAAI,aAAa,CAAC,eAAe;YACtE,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS;YACpD,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,aAAa,CAAC,UAAU;YACvD,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,aAAa,CAAC,YAAY;YAC7D,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,aAAa,CAAC,QAAQ;SACpD;QACD,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,SAAS;QAC5C,aAAa,EAAE,IAAI,CAAC,aAAa;KACpC,CAAC;AACN,CAAC"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@navsi.ai/shared",
3
+ "version": "1.0.0",
4
+ "description": "Shared types, protocols and utilities for Navsi AI chatbot platform",
5
+ "author": "Kushagra Tiwari",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/Bolona-ai/bolona-integrated.git",
11
+ "directory": "packages/shared"
12
+ },
13
+ "keywords": [
14
+ "navsi",
15
+ "chatbot",
16
+ "ai",
17
+ "sdk",
18
+ "types",
19
+ "protocol"
20
+ ],
21
+ "main": "./dist/index.js",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ },
29
+ "./types": {
30
+ "types": "./dist/types.d.ts",
31
+ "import": "./dist/types.js"
32
+ },
33
+ "./protocol": {
34
+ "types": "./dist/protocol.d.ts",
35
+ "import": "./dist/protocol.js"
36
+ }
37
+ },
38
+ "files": ["dist"],
39
+ "scripts": {
40
+ "build": "tsc",
41
+ "dev": "tsc --watch",
42
+ "clean": "rm -rf dist",
43
+ "lint": "eslint \"src/**/*.{ts,tsx}\"",
44
+ "typecheck": "tsc --noEmit",
45
+ "test": "pnpm build && node --test test/*.test.js"
46
+ },
47
+ "devDependencies": {
48
+ "@navsi/eslint-config": "1.0.0",
49
+ "typescript": "^5.3.0"
50
+ }
51
+ }