@axsdk/core 0.1.6 → 0.2.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.
- package/dist/apiclient.d.ts +5 -3
- package/dist/axapi.d.ts +4 -2
- package/dist/axsdk.d.ts +3 -1
- package/dist/chattransform.d.ts +2 -0
- package/dist/config.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/lib.cjs +10 -10
- package/dist/lib.cjs.map +15 -15
- package/dist/lib.js +10 -10
- package/dist/lib.js.map +15 -15
- package/dist/store.d.ts +23 -0
- package/dist/types/axsdk.d.ts +2 -0
- package/dist/types/chat.d.ts +35 -0
- package/package.json +3 -3
package/dist/store.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { type StoreApi } from 'zustand/vanilla';
|
|
2
2
|
import type { ChatSession, ChatMessage, AXSDKTranslationsSchema } from './types/index';
|
|
3
|
+
import type { QuestionData } from './types/chat';
|
|
4
|
+
export interface ApiError {
|
|
5
|
+
id: string;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
url: string;
|
|
8
|
+
method: string;
|
|
9
|
+
status: number;
|
|
10
|
+
statusText: string;
|
|
11
|
+
message: string;
|
|
12
|
+
requestBody?: unknown;
|
|
13
|
+
responseBody?: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface ErrorState {
|
|
16
|
+
errors: ApiError[];
|
|
17
|
+
addError: (error: Omit<ApiError, 'id' | 'timestamp'>) => void;
|
|
18
|
+
removeError: (id: string) => void;
|
|
19
|
+
clearErrors: () => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const errorStore: StoreApi<ErrorState>;
|
|
3
22
|
export interface AppState {
|
|
4
23
|
isLoading: boolean;
|
|
5
24
|
apiKey: string | undefined;
|
|
@@ -30,14 +49,18 @@ export declare const appStore: Omit<StoreApi<AppState>, "setState" | "persist">
|
|
|
30
49
|
export interface ChatState {
|
|
31
50
|
isLoading: boolean;
|
|
32
51
|
isOpen: boolean;
|
|
52
|
+
chatWasEverOpened: boolean;
|
|
33
53
|
session: ChatSession | null;
|
|
34
54
|
setSession: (session: ChatSession | null) => void;
|
|
35
55
|
messages: ChatMessage[];
|
|
36
56
|
setMessages: (messages: ChatMessage[]) => void;
|
|
37
57
|
updateMessage: (message: ChatMessage) => void;
|
|
38
58
|
setIsOpen: (isOpen: boolean) => void;
|
|
59
|
+
setChatWasEverOpened: (value: boolean) => void;
|
|
39
60
|
translations: Record<string, AXSDKTranslationsSchema>;
|
|
40
61
|
setTranslations: (translations: Record<string, AXSDKTranslationsSchema>) => void;
|
|
62
|
+
questions: QuestionData | null;
|
|
63
|
+
setQuestions: (question: QuestionData | null) => void;
|
|
41
64
|
}
|
|
42
65
|
export declare const chatStore: Omit<StoreApi<ChatState>, "setState" | "persist"> & {
|
|
43
66
|
setState(partial: ChatState | Partial<ChatState> | ((state: ChatState) => ChatState | Partial<ChatState>), replace?: false | undefined): unknown;
|
package/dist/types/axsdk.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export type AXHandler = (command: string, args: Record<string, unknown>) => Prom
|
|
|
3
3
|
export declare const AXSDKTranslationsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
4
4
|
export type AXSDKTranslationsSchema = z.infer<typeof AXSDKTranslationsSchema>;
|
|
5
5
|
export declare const AXSDKConfigSchema: z.ZodObject<{
|
|
6
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
7
|
+
basePath: z.ZodOptional<z.ZodString>;
|
|
6
8
|
apiKey: z.ZodString;
|
|
7
9
|
appId: z.ZodString;
|
|
8
10
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
package/dist/types/chat.d.ts
CHANGED
|
@@ -85,9 +85,24 @@ export interface ToolPart extends BasePart {
|
|
|
85
85
|
metadata?: Record<string, unknown>;
|
|
86
86
|
}
|
|
87
87
|
export type MessagePart = TextPart | ReasoningPart | StepStartPart | StepFinishPart | ToolPart;
|
|
88
|
+
export interface MessageErrorData {
|
|
89
|
+
message: string;
|
|
90
|
+
statusCode: number;
|
|
91
|
+
isRetryable: boolean;
|
|
92
|
+
responseHeaders: Record<string, string>;
|
|
93
|
+
responseBody: string;
|
|
94
|
+
metadata: {
|
|
95
|
+
url: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export interface MessageError {
|
|
99
|
+
name: string;
|
|
100
|
+
data: MessageErrorData;
|
|
101
|
+
}
|
|
88
102
|
export interface UserMessageInfo {
|
|
89
103
|
role: "user";
|
|
90
104
|
time: MessageTime;
|
|
105
|
+
error?: MessageError;
|
|
91
106
|
agent: string;
|
|
92
107
|
model: MessageModel;
|
|
93
108
|
id: string;
|
|
@@ -97,6 +112,7 @@ export interface UserMessageInfo {
|
|
|
97
112
|
export interface AssistantMessageInfo {
|
|
98
113
|
role: "assistant";
|
|
99
114
|
time: MessageTime;
|
|
115
|
+
error?: MessageError;
|
|
100
116
|
agent: string;
|
|
101
117
|
parentID?: string;
|
|
102
118
|
modelID?: string;
|
|
@@ -120,3 +136,22 @@ export interface ChatMessage {
|
|
|
120
136
|
timestamp?: Date | string | number;
|
|
121
137
|
finish?: string;
|
|
122
138
|
}
|
|
139
|
+
export interface QuestionOption {
|
|
140
|
+
label: string;
|
|
141
|
+
description: string;
|
|
142
|
+
}
|
|
143
|
+
export interface Question {
|
|
144
|
+
question: string;
|
|
145
|
+
header: string;
|
|
146
|
+
options: QuestionOption[];
|
|
147
|
+
}
|
|
148
|
+
export interface QuestionTool {
|
|
149
|
+
messageID: string;
|
|
150
|
+
callID: string;
|
|
151
|
+
}
|
|
152
|
+
export interface QuestionData {
|
|
153
|
+
id: string;
|
|
154
|
+
sessionID: string;
|
|
155
|
+
questions: Question[];
|
|
156
|
+
tool: QuestionTool;
|
|
157
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axsdk/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "axsdk core",
|
|
6
6
|
"keywords": [],
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "git+https://github.com/layorixinc/axsdk-sdk-js.git"
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
|
-
"author": "layorixinc
|
|
16
|
+
"author": "lordkeios@layorixinc.com",
|
|
17
17
|
"type": "module",
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dev": "bun ./src/index.ts",
|
|
34
34
|
"build": "bun ./build.ts && bun build:types",
|
|
35
35
|
"build:types": "bunx tsc --emitDeclarationOnly",
|
|
36
|
-
"publish": "npm publish --access public"
|
|
36
|
+
"publish": "bun run build && npm publish --access public"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"eventemitter3": "^5.0.4",
|