@lichen-ai/lichen-sdk 0.1.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/LICENSE +21 -0
- package/dist/auth/error.d.ts +9 -0
- package/dist/auth/error.js +76 -0
- package/dist/auth/error.js.map +1 -0
- package/dist/auth/error.mjs +76 -0
- package/dist/auth/error.mjs.map +1 -0
- package/dist/auth/index.d.ts +18 -0
- package/dist/auth/index.js +35 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/index.mjs +35 -0
- package/dist/auth/index.mjs.map +1 -0
- package/dist/auth/types.d.ts +297 -0
- package/dist/auth/types.js +2 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/auth/types.mjs +2 -0
- package/dist/auth/types.mjs.map +1 -0
- package/dist/client.d.ts +773 -0
- package/dist/client.js +1544 -0
- package/dist/client.js.map +1 -0
- package/dist/client.mjs +1544 -0
- package/dist/client.mjs.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/dist/logging/index.d.ts +43 -0
- package/dist/logging/index.js +33 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/index.mjs +33 -0
- package/dist/logging/index.mjs.map +1 -0
- package/dist/schema.d.ts +661 -0
- package/dist/schema.js +30 -0
- package/dist/schema.js.map +1 -0
- package/dist/schema.mjs +30 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/singletons/fetch.d.ts +7 -0
- package/dist/singletons/fetch.js +24 -0
- package/dist/singletons/fetch.js.map +1 -0
- package/dist/singletons/fetch.mjs +24 -0
- package/dist/singletons/fetch.mjs.map +1 -0
- package/dist/tests/fetch.test.d.ts +1 -0
- package/dist/tests/fetch.test.js +460 -0
- package/dist/tests/fetch.test.js.map +1 -0
- package/dist/tests/fetch.test.mjs +460 -0
- package/dist/tests/fetch.test.mjs.map +1 -0
- package/dist/tests/sse.test.d.ts +1 -0
- package/dist/tests/sse.test.js +132 -0
- package/dist/tests/sse.test.js.map +1 -0
- package/dist/tests/sse.test.mjs +132 -0
- package/dist/tests/sse.test.mjs.map +1 -0
- package/dist/types.d.ts +178 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/types.messages.d.ts +86 -0
- package/dist/types.messages.js +2 -0
- package/dist/types.messages.js.map +1 -0
- package/dist/types.messages.mjs +2 -0
- package/dist/types.messages.mjs.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/dist/types.stream.d.ts +212 -0
- package/dist/types.stream.js +2 -0
- package/dist/types.stream.js.map +1 -0
- package/dist/types.stream.mjs +2 -0
- package/dist/types.stream.mjs.map +1 -0
- package/dist/ui/branching.d.ts +35 -0
- package/dist/ui/branching.js +143 -0
- package/dist/ui/branching.js.map +1 -0
- package/dist/ui/branching.mjs +143 -0
- package/dist/ui/branching.mjs.map +1 -0
- package/dist/ui/branching.test.d.ts +1 -0
- package/dist/ui/branching.test.js +369 -0
- package/dist/ui/branching.test.js.map +1 -0
- package/dist/ui/branching.test.mjs +369 -0
- package/dist/ui/branching.test.mjs.map +1 -0
- package/dist/ui/errors.d.ts +12 -0
- package/dist/ui/errors.js +10 -0
- package/dist/ui/errors.js.map +1 -0
- package/dist/ui/errors.mjs +10 -0
- package/dist/ui/errors.mjs.map +1 -0
- package/dist/ui/manager.d.ts +87 -0
- package/dist/ui/manager.js +158 -0
- package/dist/ui/manager.js.map +1 -0
- package/dist/ui/manager.mjs +158 -0
- package/dist/ui/manager.mjs.map +1 -0
- package/dist/ui/messages.d.ts +18 -0
- package/dist/ui/messages.js +64 -0
- package/dist/ui/messages.js.map +1 -0
- package/dist/ui/messages.mjs +64 -0
- package/dist/ui/messages.mjs.map +1 -0
- package/dist/ui/utils.d.ts +2 -0
- package/dist/ui/utils.js +11 -0
- package/dist/ui/utils.js.map +1 -0
- package/dist/ui/utils.mjs +11 -0
- package/dist/ui/utils.mjs.map +1 -0
- package/dist/utils/async_caller.d.ts +48 -0
- package/dist/utils/async_caller.js +153 -0
- package/dist/utils/async_caller.js.map +1 -0
- package/dist/utils/async_caller.mjs +153 -0
- package/dist/utils/async_caller.mjs.map +1 -0
- package/dist/utils/env.d.ts +1 -0
- package/dist/utils/env.js +13 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/env.mjs +13 -0
- package/dist/utils/env.mjs.map +1 -0
- package/dist/utils/signals.d.ts +1 -0
- package/dist/utils/signals.js +19 -0
- package/dist/utils/signals.js.map +1 -0
- package/dist/utils/signals.mjs +19 -0
- package/dist/utils/signals.mjs.map +1 -0
- package/dist/utils/sse.d.ts +8 -0
- package/dist/utils/sse.js +151 -0
- package/dist/utils/sse.js.map +1 -0
- package/dist/utils/sse.mjs +151 -0
- package/dist/utils/sse.mjs.map +1 -0
- package/dist/utils/stream.d.ts +13 -0
- package/dist/utils/stream.js +109 -0
- package/dist/utils/stream.js.map +1 -0
- package/dist/utils/stream.mjs +109 -0
- package/dist/utils/stream.mjs.map +1 -0
- package/package.json +63 -0
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
2
|
+
type Optional<T> = T | null | undefined;
|
|
3
|
+
export type RunStatus = 'pending' | 'running' | 'error' | 'success' | 'timeout' | 'interrupted';
|
|
4
|
+
export type ThreadStatus = 'idle' | 'busy' | 'interrupted' | 'error';
|
|
5
|
+
type MultitaskStrategy = 'reject' | 'interrupt' | 'rollback' | 'enqueue';
|
|
6
|
+
export type CancelAction = 'interrupt' | 'rollback';
|
|
7
|
+
export type Config = {
|
|
8
|
+
/**
|
|
9
|
+
* Tags for this call and any sub-calls (eg. a Chain calling an LLM).
|
|
10
|
+
* You can use these to filter calls.
|
|
11
|
+
*/
|
|
12
|
+
tags?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Maximum number of times a call can recurse.
|
|
15
|
+
* If not provided, defaults to 25.
|
|
16
|
+
*/
|
|
17
|
+
recursion_limit?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Runtime values for attributes previously made configurable on this Runnable.
|
|
20
|
+
*/
|
|
21
|
+
configurable?: {
|
|
22
|
+
/**
|
|
23
|
+
* ID of the thread
|
|
24
|
+
*/
|
|
25
|
+
thread_id?: Optional<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Timestamp of the state checkpoint
|
|
28
|
+
*/
|
|
29
|
+
checkpoint_id?: Optional<string>;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export interface GraphSchema {
|
|
34
|
+
/**
|
|
35
|
+
* The ID of the graph.
|
|
36
|
+
*/
|
|
37
|
+
graph_id: string;
|
|
38
|
+
/**
|
|
39
|
+
* The schema for the input state.
|
|
40
|
+
* Missing if unable to generate JSON schema from graph.
|
|
41
|
+
*/
|
|
42
|
+
input_schema?: JSONSchema7 | null | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The schema for the output state.
|
|
45
|
+
* Missing if unable to generate JSON schema from graph.
|
|
46
|
+
*/
|
|
47
|
+
output_schema?: JSONSchema7 | null | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* The schema for the graph state.
|
|
50
|
+
* Missing if unable to generate JSON schema from graph.
|
|
51
|
+
*/
|
|
52
|
+
state_schema?: JSONSchema7 | null | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* The schema for the graph config.
|
|
55
|
+
* Missing if unable to generate JSON schema from graph.
|
|
56
|
+
*/
|
|
57
|
+
config_schema?: JSONSchema7 | null | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* The schema for the graph context.
|
|
60
|
+
* Missing if unable to generate JSON schema from graph.
|
|
61
|
+
*/
|
|
62
|
+
context_schema?: JSONSchema7 | null | undefined;
|
|
63
|
+
}
|
|
64
|
+
export type Subgraphs = Record<string, GraphSchema>;
|
|
65
|
+
export type Metadata = Optional<{
|
|
66
|
+
source?: 'input' | 'loop' | 'update' | (string & {});
|
|
67
|
+
step?: number;
|
|
68
|
+
writes?: Record<string, unknown> | null;
|
|
69
|
+
parents?: Record<string, string>;
|
|
70
|
+
[key: string]: unknown;
|
|
71
|
+
}>;
|
|
72
|
+
export interface AssistantBase {
|
|
73
|
+
/** The ID of the assistant. */
|
|
74
|
+
assistant_id: string;
|
|
75
|
+
/** The ID of the graph. */
|
|
76
|
+
graph_id: string;
|
|
77
|
+
/** The assistant config. */
|
|
78
|
+
config: Config;
|
|
79
|
+
/** The assistant context. */
|
|
80
|
+
context: unknown;
|
|
81
|
+
/** The time the assistant was created. */
|
|
82
|
+
created_at: string;
|
|
83
|
+
/** The assistant metadata. */
|
|
84
|
+
metadata: Metadata;
|
|
85
|
+
/** The version of the assistant. */
|
|
86
|
+
version: number;
|
|
87
|
+
/** The name of the assistant */
|
|
88
|
+
name: string;
|
|
89
|
+
/** The description of the assistant */
|
|
90
|
+
description?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface AssistantVersion extends AssistantBase {
|
|
93
|
+
}
|
|
94
|
+
export interface Assistant extends AssistantBase {
|
|
95
|
+
/** The last time the assistant was updated. */
|
|
96
|
+
updated_at: string;
|
|
97
|
+
}
|
|
98
|
+
export interface AssistantGraph {
|
|
99
|
+
nodes: Array<{
|
|
100
|
+
id: string | number;
|
|
101
|
+
name?: string;
|
|
102
|
+
data?: Record<string, unknown> | string;
|
|
103
|
+
metadata?: unknown;
|
|
104
|
+
}>;
|
|
105
|
+
edges: Array<{
|
|
106
|
+
source: string;
|
|
107
|
+
target: string;
|
|
108
|
+
data?: string;
|
|
109
|
+
conditional?: boolean;
|
|
110
|
+
}>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* An interrupt thrown inside a thread.
|
|
114
|
+
*/
|
|
115
|
+
export interface Interrupt<TValue = unknown> {
|
|
116
|
+
/**
|
|
117
|
+
* The ID of the interrupt.
|
|
118
|
+
*/
|
|
119
|
+
id?: string;
|
|
120
|
+
/**
|
|
121
|
+
* The value of the interrupt.
|
|
122
|
+
*/
|
|
123
|
+
value?: TValue;
|
|
124
|
+
/**
|
|
125
|
+
* Will be deprecated in the future.
|
|
126
|
+
* @deprecated Will be removed in the future.
|
|
127
|
+
*/
|
|
128
|
+
when?: 'during' | (string & {});
|
|
129
|
+
/**
|
|
130
|
+
* Whether the interrupt can be resumed.
|
|
131
|
+
* @deprecated Will be removed in the future.
|
|
132
|
+
*/
|
|
133
|
+
resumable?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* The namespace of the interrupt.
|
|
136
|
+
* @deprecated Replaced by `interrupt_id`
|
|
137
|
+
*/
|
|
138
|
+
ns?: string[];
|
|
139
|
+
}
|
|
140
|
+
export interface Thread<ValuesType = DefaultValues> {
|
|
141
|
+
/** The ID of the thread. */
|
|
142
|
+
thread_id: string;
|
|
143
|
+
/** The time the thread was created. */
|
|
144
|
+
created_at: string;
|
|
145
|
+
/** The last time the thread was updated. */
|
|
146
|
+
updated_at: string;
|
|
147
|
+
/** The thread metadata. */
|
|
148
|
+
metadata: Metadata;
|
|
149
|
+
/** The status of the thread */
|
|
150
|
+
status: ThreadStatus;
|
|
151
|
+
/** The current state of the thread. */
|
|
152
|
+
values: ValuesType;
|
|
153
|
+
/** Interrupts which were thrown in this thread */
|
|
154
|
+
interrupts: Record<string, Array<Interrupt>>;
|
|
155
|
+
}
|
|
156
|
+
export interface ThreadContextUsage {
|
|
157
|
+
thread_id: string;
|
|
158
|
+
agent_key: string | null;
|
|
159
|
+
run_id: string | null;
|
|
160
|
+
updated_at: string | null;
|
|
161
|
+
usage: {
|
|
162
|
+
context_tokens: number;
|
|
163
|
+
input_tokens: number;
|
|
164
|
+
output_tokens: number;
|
|
165
|
+
total_tokens: number;
|
|
166
|
+
embed_tokens: number;
|
|
167
|
+
total_price: number;
|
|
168
|
+
currency: string | null;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export interface Cron {
|
|
172
|
+
/** The ID of the cron */
|
|
173
|
+
cron_id: string;
|
|
174
|
+
/** The ID of the assistant */
|
|
175
|
+
assistant_id: string;
|
|
176
|
+
/** The ID of the thread */
|
|
177
|
+
thread_id: Optional<string>;
|
|
178
|
+
/** The end date to stop running the cron. */
|
|
179
|
+
end_time: Optional<string>;
|
|
180
|
+
/** The schedule to run, cron format. */
|
|
181
|
+
schedule: string;
|
|
182
|
+
/** The time the cron was created. */
|
|
183
|
+
created_at: string;
|
|
184
|
+
/** The last time the cron was updated. */
|
|
185
|
+
updated_at: string;
|
|
186
|
+
/** The run payload to use for creating new run. */
|
|
187
|
+
payload: Record<string, unknown>;
|
|
188
|
+
/** The user ID of the cron */
|
|
189
|
+
user_id: Optional<string>;
|
|
190
|
+
/** The next run date of the cron */
|
|
191
|
+
next_run_date: Optional<string>;
|
|
192
|
+
/** The metadata of the cron */
|
|
193
|
+
metadata: Record<string, unknown>;
|
|
194
|
+
}
|
|
195
|
+
export type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;
|
|
196
|
+
export interface ThreadState<ValuesType = DefaultValues> {
|
|
197
|
+
/** The state values */
|
|
198
|
+
values: ValuesType;
|
|
199
|
+
/** The next nodes to execute. If empty, the thread is done until new input is received */
|
|
200
|
+
next: string[];
|
|
201
|
+
/** Checkpoint of the thread state */
|
|
202
|
+
checkpoint: Checkpoint;
|
|
203
|
+
/** Metadata for this state */
|
|
204
|
+
metadata: Metadata;
|
|
205
|
+
/** Time of state creation */
|
|
206
|
+
created_at: Optional<string>;
|
|
207
|
+
/** The parent checkpoint. If missing, this is the root checkpoint */
|
|
208
|
+
parent_checkpoint: Optional<Checkpoint>;
|
|
209
|
+
/** Tasks to execute in this step. If already attempted, may contain an error */
|
|
210
|
+
tasks: Array<ThreadTask>;
|
|
211
|
+
}
|
|
212
|
+
export interface ThreadTask {
|
|
213
|
+
id: string;
|
|
214
|
+
name: string;
|
|
215
|
+
result?: unknown;
|
|
216
|
+
error: Optional<string>;
|
|
217
|
+
interrupts: Array<Interrupt>;
|
|
218
|
+
checkpoint: Optional<Checkpoint>;
|
|
219
|
+
state: Optional<ThreadState>;
|
|
220
|
+
}
|
|
221
|
+
export interface Run {
|
|
222
|
+
/** The ID of the run */
|
|
223
|
+
run_id: string;
|
|
224
|
+
/** The ID of the thread */
|
|
225
|
+
thread_id: string;
|
|
226
|
+
/** The assistant that wwas used for this run */
|
|
227
|
+
assistant_id: string;
|
|
228
|
+
/** The time the run was created */
|
|
229
|
+
created_at: string;
|
|
230
|
+
/** The last time the run was updated */
|
|
231
|
+
updated_at: string;
|
|
232
|
+
/** The status of the run. */
|
|
233
|
+
status: RunStatus;
|
|
234
|
+
/** Run metadata */
|
|
235
|
+
metadata: Metadata;
|
|
236
|
+
/** Strategy to handle concurrent runs on the same thread */
|
|
237
|
+
multitask_strategy: Optional<MultitaskStrategy>;
|
|
238
|
+
}
|
|
239
|
+
export type Checkpoint = {
|
|
240
|
+
thread_id: string;
|
|
241
|
+
checkpoint_ns: string;
|
|
242
|
+
checkpoint_id: Optional<string>;
|
|
243
|
+
checkpoint_map: Optional<Record<string, unknown>>;
|
|
244
|
+
};
|
|
245
|
+
export interface ListNamespaceResponse {
|
|
246
|
+
namespaces: string[][];
|
|
247
|
+
}
|
|
248
|
+
export interface Item {
|
|
249
|
+
namespace: string[];
|
|
250
|
+
key: string;
|
|
251
|
+
value: Record<string, unknown>;
|
|
252
|
+
createdAt: string;
|
|
253
|
+
updatedAt: string;
|
|
254
|
+
}
|
|
255
|
+
export interface SearchItem extends Item {
|
|
256
|
+
score?: number;
|
|
257
|
+
}
|
|
258
|
+
export interface SearchItemsResponse {
|
|
259
|
+
items: SearchItem[];
|
|
260
|
+
}
|
|
261
|
+
export interface CronCreateResponse {
|
|
262
|
+
cron_id: string;
|
|
263
|
+
assistant_id: string;
|
|
264
|
+
thread_id: string | undefined;
|
|
265
|
+
user_id: string;
|
|
266
|
+
payload: Record<string, unknown>;
|
|
267
|
+
schedule: string;
|
|
268
|
+
next_run_date: string;
|
|
269
|
+
end_time: string | undefined;
|
|
270
|
+
created_at: string;
|
|
271
|
+
updated_at: string;
|
|
272
|
+
metadata: Metadata;
|
|
273
|
+
}
|
|
274
|
+
export interface CronCreateForThreadResponse extends Omit<CronCreateResponse, 'thread_id'> {
|
|
275
|
+
thread_id: string;
|
|
276
|
+
}
|
|
277
|
+
export type AssistantSortBy = 'assistant_id' | 'graph_id' | 'name' | 'created_at' | 'updated_at';
|
|
278
|
+
export type ThreadSortBy = 'thread_id' | 'status' | 'created_at' | 'updated_at';
|
|
279
|
+
export type CronSortBy = 'cron_id' | 'assistant_id' | 'thread_id' | 'created_at' | 'updated_at' | 'next_run_date';
|
|
280
|
+
export type SortOrder = 'asc' | 'desc';
|
|
281
|
+
export type AssistantSelectField = 'assistant_id' | 'graph_id' | 'name' | 'description' | 'config' | 'context' | 'created_at' | 'updated_at' | 'metadata' | 'version';
|
|
282
|
+
export type ThreadSelectField = 'thread_id' | 'created_at' | 'updated_at' | 'metadata' | 'config' | 'context' | 'status' | 'values' | 'interrupts';
|
|
283
|
+
export type RunSelectField = 'run_id' | 'thread_id' | 'assistant_id' | 'created_at' | 'updated_at' | 'status' | 'metadata' | 'kwargs' | 'multitask_strategy';
|
|
284
|
+
export type CronSelectField = 'cron_id' | 'assistant_id' | 'thread_id' | 'end_time' | 'schedule' | 'created_at' | 'updated_at' | 'user_id' | 'payload' | 'next_run_date' | 'metadata' | 'now';
|
|
285
|
+
export interface Knowledgebase {
|
|
286
|
+
workspaceId: string;
|
|
287
|
+
id: string;
|
|
288
|
+
name: string;
|
|
289
|
+
description?: string;
|
|
290
|
+
createdAt?: string;
|
|
291
|
+
updatedAt?: string;
|
|
292
|
+
permission?: KnowledgebasePermission;
|
|
293
|
+
recall?: TKBRecallParams;
|
|
294
|
+
copilotModel?: TCopilotModel;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Knowledgebase permission levels
|
|
298
|
+
*/
|
|
299
|
+
export declare enum KnowledgebasePermission {
|
|
300
|
+
/**
|
|
301
|
+
* Only visible to you
|
|
302
|
+
* @default
|
|
303
|
+
*/
|
|
304
|
+
Private = "private",
|
|
305
|
+
/**
|
|
306
|
+
* Visible to all members in the organization
|
|
307
|
+
*/
|
|
308
|
+
Organization = "organization",
|
|
309
|
+
/**
|
|
310
|
+
* Visible to all members in the tenant
|
|
311
|
+
*/
|
|
312
|
+
Public = "public"
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Recall parameters
|
|
316
|
+
*/
|
|
317
|
+
export type TKBRecallParams = {
|
|
318
|
+
/**
|
|
319
|
+
* Top K of result chunks
|
|
320
|
+
*/
|
|
321
|
+
topK?: number;
|
|
322
|
+
/**
|
|
323
|
+
* At least the similarity threshold
|
|
324
|
+
*/
|
|
325
|
+
score?: number;
|
|
326
|
+
/**
|
|
327
|
+
* Weight in EnsembleRetriever
|
|
328
|
+
*/
|
|
329
|
+
weight?: number;
|
|
330
|
+
};
|
|
331
|
+
export type TCopilotModel = {
|
|
332
|
+
copilotId?: string;
|
|
333
|
+
modelType?: AiModelTypeEnum;
|
|
334
|
+
model?: string;
|
|
335
|
+
/**
|
|
336
|
+
* Details config for ai model
|
|
337
|
+
*/
|
|
338
|
+
options?: TCopilotModelOptions;
|
|
339
|
+
};
|
|
340
|
+
export declare enum AiModelTypeEnum {
|
|
341
|
+
LLM = "llm",
|
|
342
|
+
TEXT_EMBEDDING = "text-embedding",
|
|
343
|
+
RERANK = "rerank",
|
|
344
|
+
SPEECH2TEXT = "speech2text",
|
|
345
|
+
MODERATION = "moderation",
|
|
346
|
+
TTS = "tts",
|
|
347
|
+
TEXT2IMG = "text2img"
|
|
348
|
+
}
|
|
349
|
+
export type TCopilotModelOptions = {
|
|
350
|
+
[key: string]: any;
|
|
351
|
+
};
|
|
352
|
+
export type RuntimeCapabilitySkill = {
|
|
353
|
+
id: string;
|
|
354
|
+
workspaceId: string;
|
|
355
|
+
label: string;
|
|
356
|
+
description?: string;
|
|
357
|
+
repositoryName?: string;
|
|
358
|
+
provider?: string;
|
|
359
|
+
meta?: RuntimeCapabilitySkillMeta;
|
|
360
|
+
default?: boolean;
|
|
361
|
+
};
|
|
362
|
+
export type IconDefinition = {
|
|
363
|
+
type: 'image' | 'svg' | 'font' | 'emoji' | 'lottie';
|
|
364
|
+
value: string;
|
|
365
|
+
color?: string;
|
|
366
|
+
size?: number;
|
|
367
|
+
alt?: string;
|
|
368
|
+
style?: Record<string, string>;
|
|
369
|
+
};
|
|
370
|
+
export type RuntimeCapabilityIcon = IconDefinition;
|
|
371
|
+
export type RuntimeCapabilitySkillMeta = {
|
|
372
|
+
icon?: IconDefinition;
|
|
373
|
+
[key: string]: unknown;
|
|
374
|
+
};
|
|
375
|
+
export type RuntimeCapabilityPluginMeta = {
|
|
376
|
+
icon?: IconDefinition;
|
|
377
|
+
[key: string]: unknown;
|
|
378
|
+
};
|
|
379
|
+
export type RuntimeCapabilityPlugin = {
|
|
380
|
+
nodeKey: string;
|
|
381
|
+
provider: string;
|
|
382
|
+
label: string;
|
|
383
|
+
description?: string;
|
|
384
|
+
meta?: RuntimeCapabilityPluginMeta;
|
|
385
|
+
toolNames?: string[];
|
|
386
|
+
};
|
|
387
|
+
export type RuntimeCapabilitySubAgent = {
|
|
388
|
+
nodeKey: string;
|
|
389
|
+
type: 'agent' | 'xpert';
|
|
390
|
+
label: string;
|
|
391
|
+
name?: string;
|
|
392
|
+
description?: string;
|
|
393
|
+
avatar?: Record<string, unknown> | string;
|
|
394
|
+
agentKey?: string;
|
|
395
|
+
xpertId?: string;
|
|
396
|
+
parameters?: unknown[];
|
|
397
|
+
toolNames?: string[];
|
|
398
|
+
toolsetNames?: string[];
|
|
399
|
+
knowledgebaseNames?: string[];
|
|
400
|
+
};
|
|
401
|
+
export type RuntimeCapabilitiesResponse = {
|
|
402
|
+
skills: RuntimeCapabilitySkill[];
|
|
403
|
+
plugins: RuntimeCapabilityPlugin[];
|
|
404
|
+
subAgents?: RuntimeCapabilitySubAgent[];
|
|
405
|
+
};
|
|
406
|
+
export type RuntimeCapabilitiesSelection = {
|
|
407
|
+
mode: 'allowlist';
|
|
408
|
+
skills: {
|
|
409
|
+
workspaceId?: string;
|
|
410
|
+
ids: string[];
|
|
411
|
+
};
|
|
412
|
+
plugins: {
|
|
413
|
+
nodeKeys: string[];
|
|
414
|
+
};
|
|
415
|
+
subAgents?: {
|
|
416
|
+
nodeKeys: string[];
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* Human input payload for a chat request.
|
|
421
|
+
*/
|
|
422
|
+
export interface ChatRequestHuman {
|
|
423
|
+
input?: string;
|
|
424
|
+
files?: Partial<{
|
|
425
|
+
id: string;
|
|
426
|
+
name: string;
|
|
427
|
+
url: string;
|
|
428
|
+
size: number;
|
|
429
|
+
type: string;
|
|
430
|
+
}>[];
|
|
431
|
+
runtimeCapabilities?: RuntimeCapabilitiesSelection;
|
|
432
|
+
[key: string]: unknown;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* State passed alongside a chat request.
|
|
436
|
+
*/
|
|
437
|
+
export type ChatState = {
|
|
438
|
+
human?: ChatRequestHuman;
|
|
439
|
+
} & Record<string, unknown>;
|
|
440
|
+
/**
|
|
441
|
+
* Target reference for resume/retry actions.
|
|
442
|
+
*/
|
|
443
|
+
export interface ChatTarget {
|
|
444
|
+
aiMessageId?: string;
|
|
445
|
+
executionId?: string;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Decision payload for resuming an interrupted chat.
|
|
449
|
+
*/
|
|
450
|
+
export interface ChatResumeDecision {
|
|
451
|
+
type: 'confirm' | 'reject';
|
|
452
|
+
payload?: unknown;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Patch payload for modifying an interrupted chat.
|
|
456
|
+
*/
|
|
457
|
+
export interface ChatInterruptPatch {
|
|
458
|
+
agentKey?: string;
|
|
459
|
+
toolCalls?: unknown[];
|
|
460
|
+
update?: unknown;
|
|
461
|
+
}
|
|
462
|
+
export type ChatFollowUpMode = 'queue' | 'steer';
|
|
463
|
+
/**
|
|
464
|
+
* Send a new message in a chat run.
|
|
465
|
+
*/
|
|
466
|
+
export interface ChatSendRequest {
|
|
467
|
+
action: 'send';
|
|
468
|
+
conversationId?: string;
|
|
469
|
+
projectId?: string;
|
|
470
|
+
environmentId?: string;
|
|
471
|
+
sandboxEnvironmentId?: string;
|
|
472
|
+
message: {
|
|
473
|
+
clientMessageId?: string;
|
|
474
|
+
input: ChatRequestHuman;
|
|
475
|
+
};
|
|
476
|
+
state?: ChatState;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Resume an interrupted chat run.
|
|
480
|
+
*/
|
|
481
|
+
export interface ChatResumeRequest {
|
|
482
|
+
action: 'resume';
|
|
483
|
+
conversationId: string;
|
|
484
|
+
target: ChatTarget;
|
|
485
|
+
decision: ChatResumeDecision;
|
|
486
|
+
patch?: ChatInterruptPatch;
|
|
487
|
+
state?: ChatState;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Retry a failed chat run.
|
|
491
|
+
*/
|
|
492
|
+
export interface ChatRetryRequest {
|
|
493
|
+
action: 'retry';
|
|
494
|
+
conversationId: string;
|
|
495
|
+
source: ChatTarget;
|
|
496
|
+
environmentId?: string;
|
|
497
|
+
sandboxEnvironmentId?: string;
|
|
498
|
+
checkpointId?: string;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Follow up while another chat run is active.
|
|
502
|
+
*/
|
|
503
|
+
export interface ChatFollowUpRequest {
|
|
504
|
+
action: 'follow_up';
|
|
505
|
+
conversationId: string;
|
|
506
|
+
mode: ChatFollowUpMode;
|
|
507
|
+
message: {
|
|
508
|
+
clientMessageId?: string;
|
|
509
|
+
input: ChatRequestHuman;
|
|
510
|
+
};
|
|
511
|
+
target?: ChatTarget;
|
|
512
|
+
state?: ChatState;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Discriminated union of all chat request actions.
|
|
516
|
+
* Maps to the server-side `TChatRequest` (v2) validated by `RunCreateStreamHandler`.
|
|
517
|
+
*/
|
|
518
|
+
export type ChatRequest = ChatSendRequest | ChatResumeRequest | ChatRetryRequest | ChatFollowUpRequest;
|
|
519
|
+
/**
|
|
520
|
+
* Legacy chat request format (v1).
|
|
521
|
+
* The server normalizes this into a v2 {@link ChatRequest} automatically.
|
|
522
|
+
* Prefer the v2 format for new code.
|
|
523
|
+
*/
|
|
524
|
+
export interface LegacyChatRequest {
|
|
525
|
+
input: ChatRequestHuman;
|
|
526
|
+
state?: ChatState;
|
|
527
|
+
agentKey?: string;
|
|
528
|
+
projectId?: string;
|
|
529
|
+
conversationId?: string;
|
|
530
|
+
environmentId?: string;
|
|
531
|
+
id?: string;
|
|
532
|
+
executionId?: string;
|
|
533
|
+
confirm?: boolean;
|
|
534
|
+
command?: {
|
|
535
|
+
resume?: unknown;
|
|
536
|
+
update?: unknown;
|
|
537
|
+
toolCalls?: unknown[];
|
|
538
|
+
agentKey?: string;
|
|
539
|
+
};
|
|
540
|
+
retry?: boolean;
|
|
541
|
+
sandboxEnvironmentId?: string;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* All accepted run input formats.
|
|
545
|
+
* The server accepts both v2 {@link ChatRequest} and {@link LegacyChatRequest}.
|
|
546
|
+
*/
|
|
547
|
+
export type RunInput = ChatRequest | LegacyChatRequest;
|
|
548
|
+
export type SandboxManagedServiceStatus = 'starting' | 'running' | 'stopping' | 'stopped' | 'failed' | 'lost';
|
|
549
|
+
export type SandboxManagedServiceTransportMode = 'none' | 'http';
|
|
550
|
+
export type SandboxManagedServiceEnvEntry = {
|
|
551
|
+
name: string;
|
|
552
|
+
value: string;
|
|
553
|
+
};
|
|
554
|
+
export type SandboxManagedServiceStartInput = {
|
|
555
|
+
name: string;
|
|
556
|
+
command: string;
|
|
557
|
+
cwd?: string | null;
|
|
558
|
+
port?: number | null;
|
|
559
|
+
previewPath?: string | null;
|
|
560
|
+
readyPattern?: string | null;
|
|
561
|
+
env?: SandboxManagedServiceEnvEntry[];
|
|
562
|
+
replaceExisting?: boolean;
|
|
563
|
+
};
|
|
564
|
+
export type SandboxManagedServiceLogs = {
|
|
565
|
+
stderr: string;
|
|
566
|
+
stdout: string;
|
|
567
|
+
};
|
|
568
|
+
export type SandboxManagedServicePreviewSession = {
|
|
569
|
+
expiresAt: string;
|
|
570
|
+
previewUrl: string;
|
|
571
|
+
};
|
|
572
|
+
export interface SandboxManagedService {
|
|
573
|
+
id?: string;
|
|
574
|
+
conversationId: string;
|
|
575
|
+
provider: string;
|
|
576
|
+
name: string;
|
|
577
|
+
command: string;
|
|
578
|
+
workingDirectory: string;
|
|
579
|
+
requestedPort?: number | null;
|
|
580
|
+
actualPort?: number | null;
|
|
581
|
+
previewPath?: string | null;
|
|
582
|
+
status: SandboxManagedServiceStatus;
|
|
583
|
+
runtimeRef?: unknown;
|
|
584
|
+
transportMode?: SandboxManagedServiceTransportMode | null;
|
|
585
|
+
ownerExecutionId?: string | null;
|
|
586
|
+
ownerAgentKey?: string | null;
|
|
587
|
+
startedAt?: string | null;
|
|
588
|
+
stoppedAt?: string | null;
|
|
589
|
+
exitCode?: number | null;
|
|
590
|
+
signal?: string | null;
|
|
591
|
+
metadata?: unknown;
|
|
592
|
+
previewUrl?: string | null;
|
|
593
|
+
}
|
|
594
|
+
export type Pagination<T> = {
|
|
595
|
+
items: T[];
|
|
596
|
+
total: number;
|
|
597
|
+
};
|
|
598
|
+
export type ChatConversationStatus = 'idle' | 'busy' | 'interrupted' | 'error';
|
|
599
|
+
export type ChatConversationFrom = 'platform' | 'webapp' | 'debugger' | 'knowledge' | 'job' | 'api' | 'feishu' | 'lark' | 'dingtalk' | 'wecom';
|
|
600
|
+
export interface ChatConversation {
|
|
601
|
+
id: string;
|
|
602
|
+
threadId: string;
|
|
603
|
+
title?: string;
|
|
604
|
+
status?: ChatConversationStatus;
|
|
605
|
+
from?: ChatConversationFrom;
|
|
606
|
+
fromEndUserId?: string;
|
|
607
|
+
options?: Record<string, unknown>;
|
|
608
|
+
error?: string;
|
|
609
|
+
operation?: Record<string, unknown>;
|
|
610
|
+
xpertId?: string;
|
|
611
|
+
projectId?: string;
|
|
612
|
+
taskId?: string;
|
|
613
|
+
createdAt?: string;
|
|
614
|
+
updatedAt?: string;
|
|
615
|
+
}
|
|
616
|
+
export interface ChatMessage {
|
|
617
|
+
id: string;
|
|
618
|
+
conversationId?: string;
|
|
619
|
+
role?: string;
|
|
620
|
+
content?: unknown;
|
|
621
|
+
reasoning?: unknown;
|
|
622
|
+
status?: string;
|
|
623
|
+
error?: string;
|
|
624
|
+
executionId?: string;
|
|
625
|
+
createdAt?: string;
|
|
626
|
+
updatedAt?: string;
|
|
627
|
+
}
|
|
628
|
+
export type ChatMessageFeedbackRating = 'like' | 'dislike';
|
|
629
|
+
export interface ChatMessageFeedback {
|
|
630
|
+
id: string;
|
|
631
|
+
conversationId?: string;
|
|
632
|
+
messageId?: string;
|
|
633
|
+
rating?: ChatMessageFeedbackRating;
|
|
634
|
+
content?: string;
|
|
635
|
+
createdAt?: string;
|
|
636
|
+
updatedAt?: string;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Represents a file stored on the server.
|
|
640
|
+
* Returned by the file upload API.
|
|
641
|
+
*/
|
|
642
|
+
export interface StorageFile {
|
|
643
|
+
id: string;
|
|
644
|
+
/** File storage path/key */
|
|
645
|
+
file: string;
|
|
646
|
+
/** File access URL */
|
|
647
|
+
url?: string;
|
|
648
|
+
/** Original filename */
|
|
649
|
+
originalName?: string;
|
|
650
|
+
/** File encoding */
|
|
651
|
+
encoding?: string;
|
|
652
|
+
/** File size in bytes */
|
|
653
|
+
size?: number;
|
|
654
|
+
/** MIME type */
|
|
655
|
+
mimetype?: string;
|
|
656
|
+
/** File storage provider (LOCAL, S3, OSS, etc.) */
|
|
657
|
+
storageProvider?: string;
|
|
658
|
+
createdAt?: string;
|
|
659
|
+
updatedAt?: string;
|
|
660
|
+
}
|
|
661
|
+
export {};
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledgebase permission levels
|
|
3
|
+
*/
|
|
4
|
+
export var KnowledgebasePermission;
|
|
5
|
+
(function (KnowledgebasePermission) {
|
|
6
|
+
/**
|
|
7
|
+
* Only visible to you
|
|
8
|
+
* @default
|
|
9
|
+
*/
|
|
10
|
+
KnowledgebasePermission["Private"] = "private";
|
|
11
|
+
/**
|
|
12
|
+
* Visible to all members in the organization
|
|
13
|
+
*/
|
|
14
|
+
KnowledgebasePermission["Organization"] = "organization";
|
|
15
|
+
/**
|
|
16
|
+
* Visible to all members in the tenant
|
|
17
|
+
*/
|
|
18
|
+
KnowledgebasePermission["Public"] = "public";
|
|
19
|
+
})(KnowledgebasePermission || (KnowledgebasePermission = {}));
|
|
20
|
+
export var AiModelTypeEnum;
|
|
21
|
+
(function (AiModelTypeEnum) {
|
|
22
|
+
AiModelTypeEnum["LLM"] = "llm";
|
|
23
|
+
AiModelTypeEnum["TEXT_EMBEDDING"] = "text-embedding";
|
|
24
|
+
AiModelTypeEnum["RERANK"] = "rerank";
|
|
25
|
+
AiModelTypeEnum["SPEECH2TEXT"] = "speech2text";
|
|
26
|
+
AiModelTypeEnum["MODERATION"] = "moderation";
|
|
27
|
+
AiModelTypeEnum["TTS"] = "tts";
|
|
28
|
+
AiModelTypeEnum["TEXT2IMG"] = "text2img";
|
|
29
|
+
})(AiModelTypeEnum || (AiModelTypeEnum = {}));
|
|
30
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AA+aA;;GAEG;AACH,MAAM,CAAN,IAAY,uBAcX;AAdD,WAAY,uBAAuB;IACjC;;;OAGG;IACH,8CAAmB,CAAA;IACnB;;OAEG;IACH,wDAA6B,CAAA;IAC7B;;OAEG;IACH,4CAAiB,CAAA;AACnB,CAAC,EAdW,uBAAuB,KAAvB,uBAAuB,QAclC;AA+BD,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,oDAAiC,CAAA;IACjC,oCAAiB,CAAA;IACjB,8CAA2B,CAAA;IAC3B,4CAAyB,CAAA;IACzB,8BAAW,CAAA;IACX,wCAAqB,CAAA;AACvB,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B"}
|