@worktango/ai-assistant 0.0.123 → 0.0.124
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/backendTypes.ts +268 -0
- package/generated/apiHooks.tsx +5618 -0
- package/generated/sdk.ts +5093 -0
- package/generated/stitchedSdk.ts +1174 -0
- package/package.json +3 -1
package/backendTypes.ts
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
// Don't import from the generated folder, as it is removed when we build and publish the package.
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
AppendMessageInput,
|
|
5
|
+
AppendMessageToConversationMutation,
|
|
6
|
+
ConversationInput,
|
|
7
|
+
CreateConversationInput,
|
|
8
|
+
DeleteConversationInput,
|
|
9
|
+
UpdateConversationTitleInput,
|
|
10
|
+
GetAConversationQuery,
|
|
11
|
+
GetAllConversationsQuery,
|
|
12
|
+
DeleteAiDocumentMutation,
|
|
13
|
+
UpdateAiDocumentMutation,
|
|
14
|
+
UploadAiDocumentMutation,
|
|
15
|
+
UpdateAiSettingsMutation,
|
|
16
|
+
GetAiSettingsQuery,
|
|
17
|
+
} from "./generated/apiHooks";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Context passed to callbacks containing both request and response data
|
|
21
|
+
*/
|
|
22
|
+
export interface CallbackContext<TRequest, TResponse> {
|
|
23
|
+
/**
|
|
24
|
+
* The original request details
|
|
25
|
+
*/
|
|
26
|
+
request: {
|
|
27
|
+
/**
|
|
28
|
+
* The full path of the request (e.g., "/ai-assistant?targetPath=/api")
|
|
29
|
+
*/
|
|
30
|
+
path: string;
|
|
31
|
+
/**
|
|
32
|
+
* The HTTP method (POST, GET, etc.)
|
|
33
|
+
*/
|
|
34
|
+
method: string;
|
|
35
|
+
/**
|
|
36
|
+
* The parsed request body
|
|
37
|
+
*/
|
|
38
|
+
body: TRequest;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The parsed response body from the proxied request
|
|
42
|
+
*/
|
|
43
|
+
response: TResponse;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* REST endpoint request/response types
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
export interface ChatRequest {
|
|
51
|
+
model?: "large" | "medium" | "small";
|
|
52
|
+
temperature?: number;
|
|
53
|
+
stream?: boolean;
|
|
54
|
+
maxTokens?: number;
|
|
55
|
+
messages: Array<{
|
|
56
|
+
role: "user" | "model" | "tool";
|
|
57
|
+
parts: Array<
|
|
58
|
+
| {
|
|
59
|
+
type: "text";
|
|
60
|
+
text: string;
|
|
61
|
+
}
|
|
62
|
+
| {
|
|
63
|
+
type: "toolCall";
|
|
64
|
+
toolName: string;
|
|
65
|
+
args: Record<string, unknown>;
|
|
66
|
+
}
|
|
67
|
+
| {
|
|
68
|
+
type: "toolResult";
|
|
69
|
+
toolName: string;
|
|
70
|
+
result: unknown;
|
|
71
|
+
}
|
|
72
|
+
>;
|
|
73
|
+
name?: string;
|
|
74
|
+
}>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface ChatResponse {
|
|
78
|
+
role: "user" | "model" | "tool";
|
|
79
|
+
parts: Array<
|
|
80
|
+
| {
|
|
81
|
+
type: "text";
|
|
82
|
+
text: string;
|
|
83
|
+
}
|
|
84
|
+
| {
|
|
85
|
+
type: "toolCall";
|
|
86
|
+
toolName: string;
|
|
87
|
+
args: Record<string, unknown>;
|
|
88
|
+
}
|
|
89
|
+
| {
|
|
90
|
+
type: "toolResult";
|
|
91
|
+
toolName: string;
|
|
92
|
+
result: unknown;
|
|
93
|
+
}
|
|
94
|
+
>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface StructuredResponseRequest {
|
|
98
|
+
model?: "large" | "medium" | "small";
|
|
99
|
+
prompt: string;
|
|
100
|
+
schema: unknown;
|
|
101
|
+
temperature?: number;
|
|
102
|
+
maxTokens?: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type StructuredResponseResponse = unknown;
|
|
106
|
+
|
|
107
|
+
export interface TTSRequest {
|
|
108
|
+
text: string;
|
|
109
|
+
voice?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface TTSResponse {
|
|
113
|
+
synthesis: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface STTRequest {
|
|
117
|
+
audio: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface STTResponse {
|
|
121
|
+
transcription: Array<{
|
|
122
|
+
transcript: string;
|
|
123
|
+
confidence: number;
|
|
124
|
+
}>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* GraphQL request wrapper
|
|
129
|
+
*/
|
|
130
|
+
export interface GraphQLRequest<TVariables = unknown> {
|
|
131
|
+
operationName?: string;
|
|
132
|
+
query: string;
|
|
133
|
+
variables?: TVariables;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* GraphQL response wrapper with potential errors
|
|
138
|
+
*/
|
|
139
|
+
export interface GraphQLResponse<TData = unknown> {
|
|
140
|
+
data?: TData;
|
|
141
|
+
errors?: Array<{
|
|
142
|
+
message: string;
|
|
143
|
+
extensions?: Record<string, unknown>;
|
|
144
|
+
}>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Callbacks for REST endpoints
|
|
149
|
+
* Note: Keys are URL paths, not following camelCase convention intentionally
|
|
150
|
+
*/
|
|
151
|
+
export interface RestEndpointCallbacks {
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
153
|
+
"/api/api-ai-assistant/v1/chat"?: (
|
|
154
|
+
context: CallbackContext<ChatRequest, ChatResponse>
|
|
155
|
+
) => void | Promise<void>;
|
|
156
|
+
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
158
|
+
"/api/api-ai-assistant/v1/structured-response"?: (
|
|
159
|
+
context: CallbackContext<
|
|
160
|
+
StructuredResponseRequest,
|
|
161
|
+
StructuredResponseResponse
|
|
162
|
+
>
|
|
163
|
+
) => void | Promise<void>;
|
|
164
|
+
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
166
|
+
"/api/api-ai-assistant/v1/tts"?: (
|
|
167
|
+
context: CallbackContext<TTSRequest, TTSResponse>
|
|
168
|
+
) => void | Promise<void>;
|
|
169
|
+
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
171
|
+
"/api/api-ai-assistant/v1/stt"?: (
|
|
172
|
+
context: CallbackContext<STTRequest, STTResponse>
|
|
173
|
+
) => void | Promise<void>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Callbacks for GraphQL operations
|
|
178
|
+
* Note: Keys match the GraphQL operation names (PascalCase), not the field names
|
|
179
|
+
*/
|
|
180
|
+
export interface GraphQLOperationCallbacks {
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
182
|
+
AppendMessageToConversation?: (
|
|
183
|
+
context: CallbackContext<
|
|
184
|
+
GraphQLRequest<{ input: AppendMessageInput }>,
|
|
185
|
+
GraphQLResponse<AppendMessageToConversationMutation>
|
|
186
|
+
>
|
|
187
|
+
) => void | Promise<void>;
|
|
188
|
+
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
190
|
+
GetAConversation?: (
|
|
191
|
+
context: CallbackContext<
|
|
192
|
+
GraphQLRequest<{ input: ConversationInput }>,
|
|
193
|
+
GraphQLResponse<GetAConversationQuery>
|
|
194
|
+
>
|
|
195
|
+
) => void | Promise<void>;
|
|
196
|
+
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
198
|
+
GetAllConversations?: (
|
|
199
|
+
context: CallbackContext<
|
|
200
|
+
GraphQLRequest<Record<string, never>>,
|
|
201
|
+
GraphQLResponse<GetAllConversationsQuery>
|
|
202
|
+
>
|
|
203
|
+
) => void | Promise<void>;
|
|
204
|
+
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
206
|
+
CreateConversation?: (
|
|
207
|
+
context: CallbackContext<
|
|
208
|
+
GraphQLRequest<{ input: CreateConversationInput }>,
|
|
209
|
+
GraphQLResponse
|
|
210
|
+
>
|
|
211
|
+
) => void | Promise<void>;
|
|
212
|
+
|
|
213
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
214
|
+
DeleteConversation?: (
|
|
215
|
+
context: CallbackContext<
|
|
216
|
+
GraphQLRequest<{ input: DeleteConversationInput }>,
|
|
217
|
+
GraphQLResponse
|
|
218
|
+
>
|
|
219
|
+
) => void | Promise<void>;
|
|
220
|
+
|
|
221
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
222
|
+
UpdateConversationTitle?: (
|
|
223
|
+
context: CallbackContext<
|
|
224
|
+
GraphQLRequest<{ input: UpdateConversationTitleInput }>,
|
|
225
|
+
GraphQLResponse
|
|
226
|
+
>
|
|
227
|
+
) => void | Promise<void>;
|
|
228
|
+
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
230
|
+
DeleteAiDocument?: (
|
|
231
|
+
context: CallbackContext<
|
|
232
|
+
GraphQLRequest<unknown>,
|
|
233
|
+
GraphQLResponse<DeleteAiDocumentMutation>
|
|
234
|
+
>
|
|
235
|
+
) => void | Promise<void>;
|
|
236
|
+
|
|
237
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
238
|
+
UpdateAiDocument?: (
|
|
239
|
+
context: CallbackContext<
|
|
240
|
+
GraphQLRequest<unknown>,
|
|
241
|
+
GraphQLResponse<UpdateAiDocumentMutation>
|
|
242
|
+
>
|
|
243
|
+
) => void | Promise<void>;
|
|
244
|
+
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
246
|
+
UploadAiDocument?: (
|
|
247
|
+
context: CallbackContext<
|
|
248
|
+
GraphQLRequest<unknown>,
|
|
249
|
+
GraphQLResponse<UploadAiDocumentMutation>
|
|
250
|
+
>
|
|
251
|
+
) => void | Promise<void>;
|
|
252
|
+
|
|
253
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
254
|
+
UpdateAiSettings?: (
|
|
255
|
+
context: CallbackContext<
|
|
256
|
+
GraphQLRequest<unknown>,
|
|
257
|
+
GraphQLResponse<UpdateAiSettingsMutation>
|
|
258
|
+
>
|
|
259
|
+
) => void | Promise<void>;
|
|
260
|
+
|
|
261
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
262
|
+
GetAiSettings?: (
|
|
263
|
+
context: CallbackContext<
|
|
264
|
+
GraphQLRequest<Record<string, never>>,
|
|
265
|
+
GraphQLResponse<GetAiSettingsQuery>
|
|
266
|
+
>
|
|
267
|
+
) => void | Promise<void>;
|
|
268
|
+
}
|