@lingya-ai/agents-sdk 0.1.2 → 0.4.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/README.md CHANGED
@@ -1,45 +1,70 @@
1
1
  # 灵涯 Agents TypeScript SDK
2
2
  Lingya Agents SDK for TypeScript
3
3
 
4
- 这是面向可信 Node.js 服务端的灵涯 Agents OpenAPI 强类型 SDK;契约包含 46 个公共接口,并生成全部请求、响应、事件与工具扩展类型。
5
- This strongly typed Lingya Agents OpenAPI SDK is designed for trusted Node.js servers. Its contract covers 46 public operations and generates every request, response, event, and tool-extension type.
4
+ 用于在 Node.js 可信服务端调用灵涯 Agents OpenAPI。
5
+ Use this SDK to call Lingya Agents OpenAPI from a trusted Node.js server.
6
6
 
7
7
  ## 安装
8
8
  Installation
9
9
 
10
10
  ```bash
11
- npm install @lingya-ai/agents-sdk
11
+ npm install @lingya-ai/agents-sdk@0.4.0
12
12
  ```
13
13
 
14
- 包同时支持 CommonJS `require`、ES module `import` 与 TypeScript 类型声明,运行时要求 Node.js 20 或更高版本。
15
- The package supports CommonJS `require`, ES module `import`, and TypeScript declarations, and requires Node.js 20 or later.
14
+ 运行环境需要 Node.js 20 或更高版本。
15
+ The runtime requires Node.js 20 or later.
16
16
 
17
- ## 调用与 SSE
18
- Calls and SSE
17
+ ## 快速开始
18
+ Quick start
19
19
 
20
- ```ts
21
- import { LingyaAgentsClient } from '@lingya-ai/agents-sdk';
20
+ ```typescript
21
+ import { AgentsClient } from '@lingya-ai/agents-sdk';
22
22
 
23
- const user = new LingyaAgentsClient('https://lingtong.lingya.tech/', channelId, {
24
- accessKey: process.env.OPENAPI_AK!,
25
- secretKey: process.env.OPENAPI_SK!,
26
- }).forUser('external-user-id');
23
+ const user = new AgentsClient(
24
+ 'https://lingtong.lingya.tech/',
25
+ process.env.OPENAPI_CHANNEL_ID!,
26
+ {
27
+ accessKey: process.env.OPENAPI_AK!,
28
+ secretKey: process.env.OPENAPI_SK!,
29
+ },
30
+ ).forUser('external-user-id');
27
31
 
28
- const submission = await user.chat.createChat({
29
- channelId,
30
- aiChatInput: { query: '你好' },
31
- });
32
+ const submission = await user.chat.createChat({ query: '你好' });
33
+ ```
34
+
35
+ `channelId` 只在创建 `AgentsClient` 时提供,业务方法不再接收它。
36
+ Provide `channelId` only when creating `AgentsClient`; business methods do not accept it.
32
37
 
33
- for await (const event of user.streamChatEvents(submission.conversationId, submission.messageId)) {
34
- if (event.type === 'end') break;
38
+ ## SSE 事件流
39
+ SSE event stream
40
+
41
+ ```typescript
42
+ for await (const event of user.chat.streamChatEvents(
43
+ submission.conversationId,
44
+ { messageId: submission.messageId },
45
+ )) {
46
+ console.log(event.type);
35
47
  }
36
48
  ```
37
49
 
38
- SDK 会在最终 URL、查询串、`Content-Type` 与正文(body)字节确定后签名;每次请求独立生成 nonce,secret 不会进入请求、日志或异常。
39
- The SDK signs only after the final URL, query string, `Content-Type`, and body bytes are fixed. Every request receives a fresh nonce, and the secret is never included in requests, logs, or exceptions.
50
+ ## API 分组
51
+ API groups
52
+
53
+ 可用分组为 `chat`、`configuration`、`conversations`、`events`、`files`、`interactions`、`knowledge`、`messages`、`sql` 和 `workspace`。
54
+ Available groups are `chat`, `configuration`, `conversations`, `events`, `files`, `interactions`, `knowledge`, `messages`, `sql`, and `workspace`.
40
55
 
41
- 未知事件与工具扩展会分别保留为带 `rawJson` 的明确后备类型,已知结构不会退化为动态对象。
42
- Unknown events and tool extensions are retained in explicit fallback types with `rawJson`; known structures never degrade into dynamic objects.
56
+ ## 错误处理
57
+ Error handling
58
+
59
+ ```typescript
60
+ import { ApiError } from '@lingya-ai/agents-sdk';
61
+
62
+ try {
63
+ await user.conversations.getConversationTitle('conversation-id');
64
+ } catch (error) {
65
+ if (error instanceof ApiError) console.error(error.status, error.responseBody);
66
+ }
67
+ ```
43
68
 
44
- 本 SDK 仅适用于可信服务端,不得在浏览器、桌面或移动客户端中分发 secret。
45
- This SDK is for trusted servers only. Never distribute the secret in browser, desktop, or mobile applications.
69
+ 请只在可信服务端保存 `secretKey`,不要将其放入浏览器、移动端、桌面端或日志。
70
+ Keep `secretKey` on trusted servers only; never put it in browsers, mobile apps, desktop apps, or logs.
@@ -0,0 +1,472 @@
1
+ import { ConfigurationApi as GeneratedConfigurationApi, ChatApi as GeneratedChatApi, ConversationsApi as GeneratedConversationsApi, SQLApi as GeneratedSQLApi, MessagesApi as GeneratedMessagesApi, EventsApi as GeneratedEventsApi, InteractionsApi as GeneratedInteractionsApi, FilesApi as GeneratedFilesApi, KnowledgeApi as GeneratedKnowledgeApi, WorkspaceApi as GeneratedWorkspaceApi, type GetConversationConfigRequest, type CreateChatRequest, type ContinueChatRequest, type DeleteConversationRequest, type StreamChatEventsRequest, type ProbeEventStreamRequest, type InterruptConversationRequest, type CompactConversationRequest, type GetConversationContextUsageRequest, type ListConversationsRequest, type QueryConversationActivitiesRequest, type MarkConversationReadRequest, type GetConversationTitleRequest, type UpdateConversationTitleRequest, type UpdateConversationStatusRequest, type GetSqlQueryResultRequest, type GetSqlQueryChartDataRequest, type ExportSqlQueryResultRequest, type ListConversationMessagesRequest, type GetConversationMessageRequest, type ListConversationAsyncTasksRequest, type GetConversationAsyncTaskRequest, type CancelQueuedMessageRequest, type GetChatEventsRequest, type GetChatEventsBatchRequest, type ListConversationSharesRequest, type CreateConversationShareRequest, type RevokeConversationShareRequest, type ApprovePlanRequest, type GetPlanStatusRequest, type GetUserInputStatusRequest, type AnswerUserInputRequest, type CreatePreSignedUploadRequest, type ConfirmPreSignedUploadRequest, type CreateFileByContentMd5Request, type FileExistsByContentMd5Request, type GetConversationFilePreviewRequest, type GetPlanIntermediateFilePreviewRequest, type GetCitationMetadataBatchRequest, type GetCitationMetadataRequest, type ListWorkspaceArtifactsRequest, type GetWorkspaceFilePreviewRequest } from './apis';
2
+ import { type ChatStreamProbeEvent } from './models/ChatStreamProbeEvent';
3
+ import { type AiChatBriefEvent } from './events';
4
+ type BoundRawRequest = (method: string, suffix: string, bodyJson: string | undefined, query: URLSearchParams | undefined, accept: string, requestId?: string) => Promise<Response>;
5
+ /** Query values and optional request headers that are not bound by the client. */
6
+ export type StreamChatEventsOptions = Omit<StreamChatEventsRequest, 'channelId' | 'conversationId' | 'aiChatStreamInput'>;
7
+ /** Query values and optional request headers that are not bound by the client. */
8
+ export type ProbeEventStreamOptions = Omit<ProbeEventStreamRequest, 'channelId' | 'chatStreamProbeInput'>;
9
+ /** Query values and optional request headers that are not bound by the client. */
10
+ export type CompactConversationOptions = Omit<CompactConversationRequest, 'channelId' | 'conversationId'>;
11
+ /** Query values and optional request headers that are not bound by the client. */
12
+ export type ListConversationsOptions = Omit<ListConversationsRequest, 'channelId'>;
13
+ /** Query values and optional request headers that are not bound by the client. */
14
+ export type GetSqlQueryResultOptions = Omit<GetSqlQueryResultRequest, 'channelId' | 'conversationId' | 'resultId'>;
15
+ /** Query values and optional request headers that are not bound by the client. */
16
+ export type ExportSqlQueryResultOptions = Omit<ExportSqlQueryResultRequest, 'channelId' | 'conversationId' | 'resultId'>;
17
+ /** Query values and optional request headers that are not bound by the client. */
18
+ export type ListConversationMessagesOptions = Omit<ListConversationMessagesRequest, 'channelId' | 'conversationId'>;
19
+ /** Query values and optional request headers that are not bound by the client. */
20
+ export type ListConversationAsyncTasksOptions = Omit<ListConversationAsyncTasksRequest, 'channelId' | 'conversationId'>;
21
+ /** Query values and optional request headers that are not bound by the client. */
22
+ export type GetChatEventsOptions = Omit<GetChatEventsRequest, 'channelId'>;
23
+ /** Query values and optional request headers that are not bound by the client. */
24
+ export type GetUserInputStatusOptions = Omit<GetUserInputStatusRequest, 'channelId' | 'questionId'>;
25
+ /** Query values and optional request headers that are not bound by the client. */
26
+ export type FileExistsByContentMd5Options = Omit<FileExistsByContentMd5Request, 'channelId'>;
27
+ /** Query values and optional request headers that are not bound by the client. */
28
+ export type ListWorkspaceArtifactsOptions = Omit<ListWorkspaceArtifactsRequest, 'channelId' | 'conversationId'>;
29
+ /** Query values and optional request headers that are not bound by the client. */
30
+ export type GetWorkspaceFilePreviewOptions = Omit<GetWorkspaceFilePreviewRequest, 'channelId' | 'conversationId'>;
31
+ /** Generated APIs retained as an explicit compatibility escape hatch until 1.0. */
32
+ export declare class AgentsLowLevelApis {
33
+ readonly configuration: GeneratedConfigurationApi;
34
+ readonly chat: GeneratedChatApi;
35
+ readonly conversations: GeneratedConversationsApi;
36
+ readonly sql: GeneratedSQLApi;
37
+ readonly messages: GeneratedMessagesApi;
38
+ readonly events: GeneratedEventsApi;
39
+ readonly interactions: GeneratedInteractionsApi;
40
+ readonly files: GeneratedFilesApi;
41
+ readonly knowledge: GeneratedKnowledgeApi;
42
+ readonly workspace: GeneratedWorkspaceApi;
43
+ constructor(configuration: GeneratedConfigurationApi, chat: GeneratedChatApi, conversations: GeneratedConversationsApi, sql: GeneratedSQLApi, messages: GeneratedMessagesApi, events: GeneratedEventsApi, interactions: GeneratedInteractionsApi, files: GeneratedFilesApi, knowledge: GeneratedKnowledgeApi, workspace: GeneratedWorkspaceApi);
44
+ }
45
+ /** Channel-bound configuration operations for one external user. */
46
+ export declare class ConfigurationApi {
47
+ private readonly channelId;
48
+ private readonly delegate;
49
+ constructor(channelId: string, delegate: GeneratedConfigurationApi);
50
+ /**
51
+ * 读取 Agent 配置 / Get Agent configuration
52
+ *
53
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
54
+ */
55
+ getAgentsConfig(): ReturnType<GeneratedConfigurationApi['getAgentsConfig']>;
56
+ /**
57
+ * 读取会话配置 / Get conversation configuration
58
+ *
59
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
60
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
61
+ */
62
+ getConversationConfig(conversationId: GetConversationConfigRequest['conversationId']): ReturnType<GeneratedConfigurationApi['getConversationConfig']>;
63
+ }
64
+ /** Channel-bound chat operations for one external user. */
65
+ export declare class ChatApi {
66
+ private readonly channelId;
67
+ private readonly delegate;
68
+ private readonly rawRequest;
69
+ constructor(channelId: string, delegate: GeneratedChatApi, rawRequest: BoundRawRequest);
70
+ /**
71
+ * 创建会话并提交消息 / Create a conversation and submit a message
72
+ *
73
+ * @param input - 创建会话并提交消息 / Create a conversation and submit a message 的强类型请求体。 / Typed request body for createChat.
74
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
75
+ */
76
+ createChat(input: CreateChatRequest['aiChatInput']): ReturnType<GeneratedChatApi['createChat']>;
77
+ /**
78
+ * 向已有会话提交消息 / Submit a message to an existing conversation
79
+ *
80
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
81
+ * @param input - 向已有会话提交消息 / Submit a message to an existing conversation 的强类型请求体。 / Typed request body for continueChat.
82
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
83
+ */
84
+ continueChat(conversationId: ContinueChatRequest['conversationId'], input: ContinueChatRequest['aiChatInput']): ReturnType<GeneratedChatApi['continueChat']>;
85
+ /**
86
+ * 订阅消息事件流 / Stream message events
87
+ *
88
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
89
+ * @param input - 订阅消息事件流 / Stream message events 的强类型请求体。 / Typed request body for streamChatEvents.
90
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
91
+ * @returns 可取消的强类型事件序列。 / A cancellable typed event sequence.
92
+ */
93
+ streamChatEvents(conversationId: StreamChatEventsRequest['conversationId'], input: StreamChatEventsRequest['aiChatStreamInput'], options?: StreamChatEventsOptions): AsyncGenerator<AiChatBriefEvent>;
94
+ /**
95
+ * 探测 SSE 连接 / Probe the SSE connection
96
+ *
97
+ * @param input - 探测 SSE 连接 / Probe the SSE connection 的强类型请求体。 / Typed request body for probeEventStream.
98
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
99
+ * @returns 可取消的强类型事件序列。 / A cancellable typed event sequence.
100
+ */
101
+ probeEventStream(input: ProbeEventStreamRequest['chatStreamProbeInput'], options?: ProbeEventStreamOptions): AsyncGenerator<ChatStreamProbeEvent>;
102
+ /**
103
+ * 中断会话执行 / Interrupt conversation execution
104
+ *
105
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
106
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
107
+ */
108
+ interruptConversation(conversationId: InterruptConversationRequest['conversationId']): ReturnType<GeneratedChatApi['interruptConversation']>;
109
+ /**
110
+ * 压缩会话上下文 / Compact conversation context
111
+ *
112
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
113
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
114
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
115
+ */
116
+ compactConversation(conversationId: CompactConversationRequest['conversationId'], options?: CompactConversationOptions): ReturnType<GeneratedChatApi['compactConversation']>;
117
+ }
118
+ /** Channel-bound conversations operations for one external user. */
119
+ export declare class ConversationsApi {
120
+ private readonly channelId;
121
+ private readonly delegate;
122
+ constructor(channelId: string, delegate: GeneratedConversationsApi);
123
+ /**
124
+ * 删除会话 / Delete a conversation
125
+ *
126
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
127
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
128
+ */
129
+ deleteConversation(conversationId: DeleteConversationRequest['conversationId']): ReturnType<GeneratedConversationsApi['deleteConversation']>;
130
+ /**
131
+ * 读取上下文占用 / Get context usage
132
+ *
133
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
134
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
135
+ */
136
+ getConversationContextUsage(conversationId: GetConversationContextUsageRequest['conversationId']): ReturnType<GeneratedConversationsApi['getConversationContextUsage']>;
137
+ /**
138
+ * 分页查询会话 / List conversations
139
+ *
140
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
141
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
142
+ */
143
+ listConversations(options?: ListConversationsOptions): ReturnType<GeneratedConversationsApi['listConversations']>;
144
+ /**
145
+ * 查询活动会话 / List active conversations
146
+ *
147
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
148
+ */
149
+ listActiveConversations(): ReturnType<GeneratedConversationsApi['listActiveConversations']>;
150
+ /**
151
+ * 查询未读会话 / List unread conversations
152
+ *
153
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
154
+ */
155
+ listUnreadConversations(): ReturnType<GeneratedConversationsApi['listUnreadConversations']>;
156
+ /**
157
+ * 批量查询会话活动 / Query conversation activities
158
+ *
159
+ * @param input - 批量查询会话活动 / Query conversation activities 的强类型请求体。 / Typed request body for queryConversationActivities.
160
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
161
+ */
162
+ queryConversationActivities(input: QueryConversationActivitiesRequest['conversationActivityBatchInput']): ReturnType<GeneratedConversationsApi['queryConversationActivities']>;
163
+ /**
164
+ * 推进会话已读游标 / Mark a conversation as read
165
+ *
166
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
167
+ * @param input - 推进会话已读游标 / Mark a conversation as read 的强类型请求体。 / Typed request body for markConversationRead.
168
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
169
+ */
170
+ markConversationRead(conversationId: MarkConversationReadRequest['conversationId'], input: MarkConversationReadRequest['conversationReadReceiptInput']): ReturnType<GeneratedConversationsApi['markConversationRead']>;
171
+ /**
172
+ * 读取会话统计 / Get conversation statistics
173
+ *
174
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
175
+ */
176
+ getConversationStats(): ReturnType<GeneratedConversationsApi['getConversationStats']>;
177
+ /**
178
+ * 读取会话标题 / Get conversation title
179
+ *
180
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
181
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
182
+ */
183
+ getConversationTitle(conversationId: GetConversationTitleRequest['conversationId']): ReturnType<GeneratedConversationsApi['getConversationTitle']>;
184
+ /**
185
+ * 更新会话标题 / Update conversation title
186
+ *
187
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
188
+ * @param input - 更新会话标题 / Update conversation title 的强类型请求体。 / Typed request body for updateConversationTitle.
189
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
190
+ */
191
+ updateConversationTitle(conversationId: UpdateConversationTitleRequest['conversationId'], input: UpdateConversationTitleRequest['conversationTitleInput']): ReturnType<GeneratedConversationsApi['updateConversationTitle']>;
192
+ /**
193
+ * 更新会话状态 / Update conversation status
194
+ *
195
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
196
+ * @param input - 更新会话状态 / Update conversation status 的强类型请求体。 / Typed request body for updateConversationStatus.
197
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
198
+ */
199
+ updateConversationStatus(conversationId: UpdateConversationStatusRequest['conversationId'], input: UpdateConversationStatusRequest['conversationStatusInput']): ReturnType<GeneratedConversationsApi['updateConversationStatus']>;
200
+ /**
201
+ * 查询会话分享 / List conversation shares
202
+ *
203
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
204
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
205
+ */
206
+ listConversationShares(conversationId: ListConversationSharesRequest['conversationId']): ReturnType<GeneratedConversationsApi['listConversationShares']>;
207
+ /**
208
+ * 创建会话分享 / Create a conversation share
209
+ *
210
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
211
+ * @param input - 创建会话分享 / Create a conversation share 的强类型请求体。 / Typed request body for createConversationShare.
212
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
213
+ */
214
+ createConversationShare(conversationId: CreateConversationShareRequest['conversationId'], input: CreateConversationShareRequest['conversationShareInput']): ReturnType<GeneratedConversationsApi['createConversationShare']>;
215
+ /**
216
+ * 撤销会话分享 / Revoke a conversation share
217
+ *
218
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
219
+ * @param shareId - 会话分享记录 ID。 / Conversation-share record ID.
220
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
221
+ */
222
+ revokeConversationShare(conversationId: RevokeConversationShareRequest['conversationId'], shareId: RevokeConversationShareRequest['shareId']): ReturnType<GeneratedConversationsApi['revokeConversationShare']>;
223
+ }
224
+ /** Channel-bound sql operations for one external user. */
225
+ export declare class SqlApi {
226
+ private readonly channelId;
227
+ private readonly delegate;
228
+ constructor(channelId: string, delegate: GeneratedSQLApi);
229
+ /**
230
+ * 分页读取 SQL 结果 / Get paged SQL results
231
+ *
232
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
233
+ * @param resultId - SQL 查询结果 ID。 / SQL query-result ID.
234
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
235
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
236
+ */
237
+ getSqlQueryResult(conversationId: GetSqlQueryResultRequest['conversationId'], resultId: GetSqlQueryResultRequest['resultId'], options?: GetSqlQueryResultOptions): ReturnType<GeneratedSQLApi['getSqlQueryResult']>;
238
+ /**
239
+ * 读取 SQL 图表数据 / Get SQL chart data
240
+ *
241
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
242
+ * @param resultId - SQL 查询结果 ID。 / SQL query-result ID.
243
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
244
+ */
245
+ getSqlQueryChartData(conversationId: GetSqlQueryChartDataRequest['conversationId'], resultId: GetSqlQueryChartDataRequest['resultId']): ReturnType<GeneratedSQLApi['getSqlQueryChartData']>;
246
+ /**
247
+ * 导出 SQL 结果 / Export SQL results
248
+ *
249
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
250
+ * @param resultId - SQL 查询结果 ID。 / SQL query-result ID.
251
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
252
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
253
+ */
254
+ exportSqlQueryResult(conversationId: ExportSqlQueryResultRequest['conversationId'], resultId: ExportSqlQueryResultRequest['resultId'], options: ExportSqlQueryResultOptions): Promise<Uint8Array>;
255
+ }
256
+ /** Channel-bound messages operations for one external user. */
257
+ export declare class MessagesApi {
258
+ private readonly channelId;
259
+ private readonly delegate;
260
+ constructor(channelId: string, delegate: GeneratedMessagesApi);
261
+ /**
262
+ * 分页查询会话消息 / List conversation messages
263
+ *
264
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
265
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
266
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
267
+ */
268
+ listConversationMessages(conversationId: ListConversationMessagesRequest['conversationId'], options?: ListConversationMessagesOptions): ReturnType<GeneratedMessagesApi['listConversationMessages']>;
269
+ /**
270
+ * 读取单条会话消息 / Get a conversation message
271
+ *
272
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
273
+ * @param messageId - 用户消息 ID;必须属于指定会话。 / User-message ID owned by the specified conversation.
274
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
275
+ */
276
+ getConversationMessage(conversationId: GetConversationMessageRequest['conversationId'], messageId: GetConversationMessageRequest['messageId']): ReturnType<GeneratedMessagesApi['getConversationMessage']>;
277
+ /**
278
+ * 分页查询异步任务 / List asynchronous tasks
279
+ *
280
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
281
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
282
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
283
+ */
284
+ listConversationAsyncTasks(conversationId: ListConversationAsyncTasksRequest['conversationId'], options?: ListConversationAsyncTasksOptions): ReturnType<GeneratedMessagesApi['listConversationAsyncTasks']>;
285
+ /**
286
+ * 读取异步任务 / Get an asynchronous task
287
+ *
288
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
289
+ * @param asyncTaskId - 异步任务 ID。 / Asynchronous task ID.
290
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
291
+ */
292
+ getConversationAsyncTask(conversationId: GetConversationAsyncTaskRequest['conversationId'], asyncTaskId: GetConversationAsyncTaskRequest['asyncTaskId']): ReturnType<GeneratedMessagesApi['getConversationAsyncTask']>;
293
+ /**
294
+ * 取消排队消息 / Cancel a queued message
295
+ *
296
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
297
+ * @param messageId - 用户消息 ID;必须属于指定会话。 / User-message ID owned by the specified conversation.
298
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
299
+ */
300
+ cancelQueuedMessage(conversationId: CancelQueuedMessageRequest['conversationId'], messageId: CancelQueuedMessageRequest['messageId']): ReturnType<GeneratedMessagesApi['cancelQueuedMessage']>;
301
+ }
302
+ /** Channel-bound events operations for one external user. */
303
+ export declare class EventsApi {
304
+ private readonly channelId;
305
+ private readonly delegate;
306
+ constructor(channelId: string, delegate: GeneratedEventsApi);
307
+ /**
308
+ * 读取消息事件 / Get message events
309
+ *
310
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
311
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
312
+ */
313
+ getChatEvents(options: GetChatEventsOptions): ReturnType<GeneratedEventsApi['getChatEvents']>;
314
+ /**
315
+ * 批量读取消息事件 / Get message events in batch
316
+ *
317
+ * @param input - 批量读取消息事件 / Get message events in batch 的强类型请求体。 / Typed request body for getChatEventsBatch.
318
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
319
+ */
320
+ getChatEventsBatch(input: GetChatEventsBatchRequest['aiChatEventsBatchInput']): ReturnType<GeneratedEventsApi['getChatEventsBatch']>;
321
+ }
322
+ /** Channel-bound interactions operations for one external user. */
323
+ export declare class InteractionsApi {
324
+ private readonly channelId;
325
+ private readonly delegate;
326
+ constructor(channelId: string, delegate: GeneratedInteractionsApi);
327
+ /**
328
+ * 提交计划审批 / Submit plan approval
329
+ *
330
+ * @param input - 提交计划审批 / Submit plan approval 的强类型请求体。 / Typed request body for approvePlan.
331
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
332
+ */
333
+ approvePlan(input: ApprovePlanRequest['planApprovalInput']): ReturnType<GeneratedInteractionsApi['approvePlan']>;
334
+ /**
335
+ * 查询计划审批状态 / Get plan approval status
336
+ *
337
+ * @param planId - 等待审批的计划 ID。 / Pending plan-approval ID.
338
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
339
+ */
340
+ getPlanStatus(planId: GetPlanStatusRequest['planId']): ReturnType<GeneratedInteractionsApi['getPlanStatus']>;
341
+ /**
342
+ * 查询用户问答状态 / Get user-input status
343
+ *
344
+ * @param questionId - 等待回答的问题 ID。 / Pending question ID.
345
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
346
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
347
+ */
348
+ getUserInputStatus(questionId: GetUserInputStatusRequest['questionId'], options: GetUserInputStatusOptions): ReturnType<GeneratedInteractionsApi['getUserInputStatus']>;
349
+ /**
350
+ * 提交用户回答 / Submit a user answer
351
+ *
352
+ * @param input - 提交用户回答 / Submit a user answer 的强类型请求体。 / Typed request body for answerUserInput.
353
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
354
+ */
355
+ answerUserInput(input: AnswerUserInputRequest['userInputAnswerInput']): ReturnType<GeneratedInteractionsApi['answerUserInput']>;
356
+ }
357
+ /** Channel-bound files operations for one external user. */
358
+ export declare class FilesApi {
359
+ private readonly channelId;
360
+ private readonly delegate;
361
+ constructor(channelId: string, delegate: GeneratedFilesApi);
362
+ /**
363
+ * 创建预签名上传地址 / Create a presigned upload URL
364
+ *
365
+ * @param input - 创建预签名上传地址 / Create a presigned upload URL 的强类型请求体。 / Typed request body for createPreSignedUpload.
366
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
367
+ */
368
+ createPreSignedUpload(input: CreatePreSignedUploadRequest['generatePreSignedUrlInput']): ReturnType<GeneratedFilesApi['createPreSignedUpload']>;
369
+ /**
370
+ * 确认预签名上传 / Confirm a presigned upload
371
+ *
372
+ * @param input - 确认预签名上传 / Confirm a presigned upload 的强类型请求体。 / Typed request body for confirmPreSignedUpload.
373
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
374
+ */
375
+ confirmPreSignedUpload(input: ConfirmPreSignedUploadRequest['confirmUploadInput']): ReturnType<GeneratedFilesApi['confirmPreSignedUpload']>;
376
+ /**
377
+ * 按 MD5 复用文件 / Reuse a file by MD5
378
+ *
379
+ * @param input - 按 MD5 复用文件 / Reuse a file by MD5 的强类型请求体。 / Typed request body for createFileByContentMd5.
380
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
381
+ */
382
+ createFileByContentMd5(input: CreateFileByContentMd5Request['createFileInput']): ReturnType<GeneratedFilesApi['createFileByContentMd5']>;
383
+ /**
384
+ * 检查 MD5 文件是否存在 / Check file existence by MD5
385
+ *
386
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
387
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
388
+ */
389
+ fileExistsByContentMd5(options: FileExistsByContentMd5Options): ReturnType<GeneratedFilesApi['fileExistsByContentMd5']>;
390
+ /**
391
+ * 创建会话文件预览地址 / Create a conversation file preview URL
392
+ *
393
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
394
+ * @param fileId - 文件记录 ID。 / File record ID.
395
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
396
+ */
397
+ getConversationFilePreview(conversationId: GetConversationFilePreviewRequest['conversationId'], fileId: GetConversationFilePreviewRequest['fileId']): ReturnType<GeneratedFilesApi['getConversationFilePreview']>;
398
+ /**
399
+ * 创建计划快照预览地址 / Create a plan snapshot preview URL
400
+ *
401
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
402
+ * @param messageId - 用户消息 ID;必须属于指定会话。 / User-message ID owned by the specified conversation.
403
+ * @param fileId - 文件记录 ID。 / File record ID.
404
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
405
+ */
406
+ getPlanIntermediateFilePreview(conversationId: GetPlanIntermediateFilePreviewRequest['conversationId'], messageId: GetPlanIntermediateFilePreviewRequest['messageId'], fileId: GetPlanIntermediateFilePreviewRequest['fileId']): ReturnType<GeneratedFilesApi['getPlanIntermediateFilePreview']>;
407
+ }
408
+ /** Channel-bound knowledge operations for one external user. */
409
+ export declare class KnowledgeApi {
410
+ private readonly channelId;
411
+ private readonly delegate;
412
+ constructor(channelId: string, delegate: GeneratedKnowledgeApi);
413
+ /**
414
+ * 批量读取引用元数据 / Get citation metadata in batch
415
+ *
416
+ * @param input - 批量读取引用元数据 / Get citation metadata in batch 的强类型请求体。 / Typed request body for getCitationMetadataBatch.
417
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
418
+ */
419
+ getCitationMetadataBatch(input: GetCitationMetadataBatchRequest['returnedReference']): ReturnType<GeneratedKnowledgeApi['getCitationMetadataBatch']>;
420
+ /**
421
+ * 读取引用元数据 / Get citation metadata
422
+ *
423
+ * @param citationType - 知识引用类型。 / Knowledge citation type.
424
+ * @param referenceId - 知识引用记录 ID。 / Knowledge-reference record ID.
425
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
426
+ */
427
+ getCitationMetadata(citationType: GetCitationMetadataRequest['citationType'], referenceId: GetCitationMetadataRequest['referenceId']): ReturnType<GeneratedKnowledgeApi['getCitationMetadata']>;
428
+ }
429
+ /** Channel-bound workspace operations for one external user. */
430
+ export declare class WorkspaceApi {
431
+ private readonly channelId;
432
+ private readonly delegate;
433
+ constructor(channelId: string, delegate: GeneratedWorkspaceApi);
434
+ /**
435
+ * 分页查询工作区制品 / List workspace artifacts
436
+ *
437
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
438
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
439
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
440
+ */
441
+ listWorkspaceArtifacts(conversationId: ListWorkspaceArtifactsRequest['conversationId'], options?: ListWorkspaceArtifactsOptions): ReturnType<GeneratedWorkspaceApi['listWorkspaceArtifacts']>;
442
+ /**
443
+ * 创建工作区文件预览地址 / Create a workspace file preview URL
444
+ *
445
+ * @param conversationId - 会话 ID;必须属于当前外部用户。 / Conversation ID owned by the current external user.
446
+ * @param options - 查询参数与可选请求头。 / Query parameters and optional request headers.
447
+ * @returns 契约定义的强类型响应。 / The typed response defined by the contract.
448
+ */
449
+ getWorkspaceFilePreview(conversationId: GetWorkspaceFilePreviewRequest['conversationId'], options: GetWorkspaceFilePreviewOptions): ReturnType<GeneratedWorkspaceApi['getWorkspaceFilePreview']>;
450
+ }
451
+ /** @deprecated Use AgentsLowLevelApis. */
452
+ export { AgentsLowLevelApis as LingyaAgentsLowLevelApis };
453
+ /** @deprecated Use ConfigurationApi. */
454
+ export { ConfigurationApi as LingyaConfigurationApi };
455
+ /** @deprecated Use ChatApi. */
456
+ export { ChatApi as LingyaChatApi };
457
+ /** @deprecated Use ConversationsApi. */
458
+ export { ConversationsApi as LingyaConversationsApi };
459
+ /** @deprecated Use SqlApi. */
460
+ export { SqlApi as LingyaSqlApi };
461
+ /** @deprecated Use MessagesApi. */
462
+ export { MessagesApi as LingyaMessagesApi };
463
+ /** @deprecated Use EventsApi. */
464
+ export { EventsApi as LingyaEventsApi };
465
+ /** @deprecated Use InteractionsApi. */
466
+ export { InteractionsApi as LingyaInteractionsApi };
467
+ /** @deprecated Use FilesApi. */
468
+ export { FilesApi as LingyaFilesApi };
469
+ /** @deprecated Use KnowledgeApi. */
470
+ export { KnowledgeApi as LingyaKnowledgeApi };
471
+ /** @deprecated Use WorkspaceApi. */
472
+ export { WorkspaceApi as LingyaWorkspaceApi };