agentbase-web-sdk 2.9.0 → 2.12.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 +2 -2
- package/dist/cjs/sdk.js +2456 -664
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +2456 -665
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +2456 -664
- package/package.json +3 -3
- package/types/enums/data-api-catalog-data-source-database-type.d.ts +6 -0
- package/types/enums/data-api-catalog-data-source-visibility-source.d.ts +7 -0
- package/types/enums/data-api-catalog-database-availability.d.ts +5 -0
- package/types/enums/data-api-catalog-database-classification.d.ts +4 -0
- package/types/enums/data-api-catalog-database-status.d.ts +4 -0
- package/types/enums/data-api-catalog-database-visibility-source.d.ts +7 -0
- package/types/enums/data-api-filter-logic.d.ts +4 -0
- package/types/enums/data-api-owned-binding-principal-type.d.ts +4 -0
- package/types/enums/data-api-owned-binding-status.d.ts +4 -0
- package/types/enums/memory-pipeline-run-result-status.d.ts +4 -0
- package/types/enums/memory-pipeline-run-scenario.d.ts +6 -0
- package/types/enums/memory-pipeline-run-status.d.ts +6 -0
- package/types/enums/method.d.ts +9 -0
- package/types/enums/path-match.d.ts +4 -0
- package/types/enums/scenario.d.ts +6 -0
- package/types/enums/scene.d.ts +4 -0
- package/types/enums/status.d.ts +7 -1
- package/types/enums/timezone.d.ts +1 -0
- package/types/index.d.ts +19 -2
- package/types/models.d.ts +798 -4
- package/types/services/account.d.ts +85 -2
- package/types/services/ai-gateway.d.ts +90 -0
- package/types/services/data-api.d.ts +257 -0
- package/types/services/functions.d.ts +35 -7
- package/types/services/knowledge-bases.d.ts +186 -2
- package/types/services/llm-gateway.d.ts +8 -1
- package/types/services/memory.d.ts +600 -19
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Client } from '../client';
|
|
2
2
|
import type { Models } from '../models';
|
|
3
|
+
import { Status } from '../enums/status';
|
|
3
4
|
export declare class KnowledgeBases {
|
|
4
5
|
client: Client;
|
|
5
6
|
constructor(client: Client);
|
|
6
7
|
/**
|
|
7
|
-
* Import the current user's
|
|
8
|
+
* Import the current user's Ant Documents by URL through an authorized Yuque OAuth session. No team data source is required. Document ownership uses `source=yuque:personal` for compatibility.
|
|
8
9
|
*
|
|
9
10
|
* The service resolves the session's current-user credential from encrypted private storage before requesting the Yuque Open API. If the credential is missing, was locally cancelled, was revoked at Yuque, or Yuque returns 401/403, the request fails with `knowledge_base_yuque_oauth_reauth_required` (HTTP 401); authorize again before retrying.
|
|
10
11
|
*
|
|
@@ -27,7 +28,7 @@ export declare class KnowledgeBases {
|
|
|
27
28
|
versionId?: string;
|
|
28
29
|
}): Promise<Models.KnowledgeBaseDataSourceDocumentImportBatch>;
|
|
29
30
|
/**
|
|
30
|
-
* Import the current user's
|
|
31
|
+
* Import the current user's Ant Documents by URL through an authorized Yuque OAuth session. No team data source is required. Document ownership uses `source=yuque:personal` for compatibility.
|
|
31
32
|
*
|
|
32
33
|
* The service resolves the session's current-user credential from encrypted private storage before requesting the Yuque Open API. If the credential is missing, was locally cancelled, was revoked at Yuque, or Yuque returns 401/403, the request fails with `knowledge_base_yuque_oauth_reauth_required` (HTTP 401); authorize again before retrying.
|
|
33
34
|
*
|
|
@@ -117,4 +118,187 @@ export declare class KnowledgeBases {
|
|
|
117
118
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
118
119
|
*/
|
|
119
120
|
getYuqueOAuthSession(knowledgeBaseId: string, sessionId: string): Promise<{}>;
|
|
121
|
+
/**
|
|
122
|
+
* 列出当前登录用户在指定知识库中拥有的蚂蚁文档数据源(API 类型为 `yuque_personal`)。
|
|
123
|
+
*
|
|
124
|
+
* 此接口仅接受 `SESSION` 或 `JWT`,并要求 `knowledgebases.read`。它只返回当前用户的 `yuque_personal` 资源,供 Console 管理;不会返回其他成员的 OAuth 绑定。响应为 `KnowledgeBaseDataSourceList`,credentials 均已脱敏。
|
|
125
|
+
*
|
|
126
|
+
*
|
|
127
|
+
* @param {string} params.knowledgeBaseId - Knowledge base ID.
|
|
128
|
+
* @param {string} params.versionId - Optional Version ID.
|
|
129
|
+
* @throws {AgentbaseException}
|
|
130
|
+
* @returns {Promise<Models.KnowledgeBaseDataSourceList>}
|
|
131
|
+
*/
|
|
132
|
+
listYuquePersonalDataSources(params: {
|
|
133
|
+
knowledgeBaseId: string;
|
|
134
|
+
versionId?: string;
|
|
135
|
+
}): Promise<Models.KnowledgeBaseDataSourceList>;
|
|
136
|
+
/**
|
|
137
|
+
* 列出当前登录用户在指定知识库中拥有的蚂蚁文档数据源(API 类型为 `yuque_personal`)。
|
|
138
|
+
*
|
|
139
|
+
* 此接口仅接受 `SESSION` 或 `JWT`,并要求 `knowledgebases.read`。它只返回当前用户的 `yuque_personal` 资源,供 Console 管理;不会返回其他成员的 OAuth 绑定。响应为 `KnowledgeBaseDataSourceList`,credentials 均已脱敏。
|
|
140
|
+
*
|
|
141
|
+
*
|
|
142
|
+
* @param {string} knowledgeBaseId - Knowledge base ID.
|
|
143
|
+
* @param {string} versionId - Optional Version ID.
|
|
144
|
+
* @throws {AgentbaseException}
|
|
145
|
+
* @returns {Promise<Models.KnowledgeBaseDataSourceList>}
|
|
146
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
147
|
+
*/
|
|
148
|
+
listYuquePersonalDataSources(knowledgeBaseId: string, versionId?: string): Promise<Models.KnowledgeBaseDataSourceList>;
|
|
149
|
+
/**
|
|
150
|
+
* 创建当前登录用户拥有的蚂蚁文档定时数据源(API 类型为 `yuque_personal`)。
|
|
151
|
+
*
|
|
152
|
+
* 此接口仅接受 `SESSION` 或 `JWT`,并要求 `knowledgebases.write`。请求必须包含已授权且与当前 project、知识库和用户匹配的 `sessionId`、数据源 `name` 与 1–20 个 `urls`;可选 `syncSchedule` 为 cron 表达式,`triggerSync` 控制是否立即创建首次异步同步。
|
|
153
|
+
*
|
|
154
|
+
* 服务端从当前用户写入 owner reference,并只在 worker 运行时解析该用户的加密 OAuth credential。请求不能提供 `ownerUserId`、OAuth token、code 或 credentials;响应中的 credentials 也始终脱敏。Version DRAFT 不支持 `syncSchedule`。
|
|
155
|
+
*
|
|
156
|
+
*
|
|
157
|
+
* @param {string} params.knowledgeBaseId - Knowledge base ID.
|
|
158
|
+
* @param {string} params.sessionId - Authorized Yuque OAuth session ID.
|
|
159
|
+
* @param {string} params.name - Personal data source name.
|
|
160
|
+
* @param {string[]} params.urls - Personal Yuque document URLs.
|
|
161
|
+
* @param {string} params.versionId - Optional DRAFT Version ID. Required when Versioning is active.
|
|
162
|
+
* @param {string} params.syncSchedule - Optional cron schedule for automatic synchronization.
|
|
163
|
+
* @param {Status} params.status - Data source status.
|
|
164
|
+
* @param {boolean} params.triggerSync - Trigger an initial sync after creation.
|
|
165
|
+
* @throws {AgentbaseException}
|
|
166
|
+
* @returns {Promise<Models.KnowledgeBaseDataSource>}
|
|
167
|
+
*/
|
|
168
|
+
createYuquePersonalDataSource(params: {
|
|
169
|
+
knowledgeBaseId: string;
|
|
170
|
+
sessionId: string;
|
|
171
|
+
name: string;
|
|
172
|
+
urls: string[];
|
|
173
|
+
versionId?: string;
|
|
174
|
+
syncSchedule?: string;
|
|
175
|
+
status?: Status;
|
|
176
|
+
triggerSync?: boolean;
|
|
177
|
+
}): Promise<Models.KnowledgeBaseDataSource>;
|
|
178
|
+
/**
|
|
179
|
+
* 创建当前登录用户拥有的蚂蚁文档定时数据源(API 类型为 `yuque_personal`)。
|
|
180
|
+
*
|
|
181
|
+
* 此接口仅接受 `SESSION` 或 `JWT`,并要求 `knowledgebases.write`。请求必须包含已授权且与当前 project、知识库和用户匹配的 `sessionId`、数据源 `name` 与 1–20 个 `urls`;可选 `syncSchedule` 为 cron 表达式,`triggerSync` 控制是否立即创建首次异步同步。
|
|
182
|
+
*
|
|
183
|
+
* 服务端从当前用户写入 owner reference,并只在 worker 运行时解析该用户的加密 OAuth credential。请求不能提供 `ownerUserId`、OAuth token、code 或 credentials;响应中的 credentials 也始终脱敏。Version DRAFT 不支持 `syncSchedule`。
|
|
184
|
+
*
|
|
185
|
+
*
|
|
186
|
+
* @param {string} knowledgeBaseId - Knowledge base ID.
|
|
187
|
+
* @param {string} sessionId - Authorized Yuque OAuth session ID.
|
|
188
|
+
* @param {string} name - Personal data source name.
|
|
189
|
+
* @param {string[]} urls - Personal Yuque document URLs.
|
|
190
|
+
* @param {string} versionId - Optional DRAFT Version ID. Required when Versioning is active.
|
|
191
|
+
* @param {string} syncSchedule - Optional cron schedule for automatic synchronization.
|
|
192
|
+
* @param {Status} status - Data source status.
|
|
193
|
+
* @param {boolean} triggerSync - Trigger an initial sync after creation.
|
|
194
|
+
* @throws {AgentbaseException}
|
|
195
|
+
* @returns {Promise<Models.KnowledgeBaseDataSource>}
|
|
196
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
197
|
+
*/
|
|
198
|
+
createYuquePersonalDataSource(knowledgeBaseId: string, sessionId: string, name: string, urls: string[], versionId?: string, syncSchedule?: string, status?: Status, triggerSync?: boolean): Promise<Models.KnowledgeBaseDataSource>;
|
|
199
|
+
/**
|
|
200
|
+
* 读取当前登录用户拥有的一条蚂蚁文档数据源(API 类型为 `yuque_personal`)。
|
|
201
|
+
*
|
|
202
|
+
* 此接口仅接受 `SESSION` 或 `JWT`,并要求 `knowledgebases.read`。服务端会将 source owner 与当前用户比对;不匹配时拒绝访问,不通过数据源 ID、URL 或 credentials 推断 owner。响应复用 `KnowledgeBaseDataSource`,其中 credentials 均已脱敏。
|
|
203
|
+
*
|
|
204
|
+
*
|
|
205
|
+
* @param {string} params.knowledgeBaseId - Knowledge base ID.
|
|
206
|
+
* @param {string} params.dataSourceId - Data source ID.
|
|
207
|
+
* @param {string} params.versionId - Optional Version ID.
|
|
208
|
+
* @throws {AgentbaseException}
|
|
209
|
+
* @returns {Promise<Models.KnowledgeBaseDataSource>}
|
|
210
|
+
*/
|
|
211
|
+
getYuquePersonalDataSource(params: {
|
|
212
|
+
knowledgeBaseId: string;
|
|
213
|
+
dataSourceId: string;
|
|
214
|
+
versionId?: string;
|
|
215
|
+
}): Promise<Models.KnowledgeBaseDataSource>;
|
|
216
|
+
/**
|
|
217
|
+
* 读取当前登录用户拥有的一条蚂蚁文档数据源(API 类型为 `yuque_personal`)。
|
|
218
|
+
*
|
|
219
|
+
* 此接口仅接受 `SESSION` 或 `JWT`,并要求 `knowledgebases.read`。服务端会将 source owner 与当前用户比对;不匹配时拒绝访问,不通过数据源 ID、URL 或 credentials 推断 owner。响应复用 `KnowledgeBaseDataSource`,其中 credentials 均已脱敏。
|
|
220
|
+
*
|
|
221
|
+
*
|
|
222
|
+
* @param {string} knowledgeBaseId - Knowledge base ID.
|
|
223
|
+
* @param {string} dataSourceId - Data source ID.
|
|
224
|
+
* @param {string} versionId - Optional Version ID.
|
|
225
|
+
* @throws {AgentbaseException}
|
|
226
|
+
* @returns {Promise<Models.KnowledgeBaseDataSource>}
|
|
227
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
228
|
+
*/
|
|
229
|
+
getYuquePersonalDataSource(knowledgeBaseId: string, dataSourceId: string, versionId?: string): Promise<Models.KnowledgeBaseDataSource>;
|
|
230
|
+
/**
|
|
231
|
+
* 更新当前登录用户拥有的蚂蚁文档数据源(API 类型为 `yuque_personal`)。
|
|
232
|
+
*
|
|
233
|
+
* 此接口仅接受 `SESSION` 或 `JWT`,并要求 `knowledgebases.write`。可更新字段为 `name`、`urls`、`syncSchedule` 与 `status`;服务端验证 owner,且不允许修改 OAuth credential 或 owner reference。修改 cron、启停或清除 cron 后会同步创建、更新或移除既有 schedule。Version DRAFT 不支持 `syncSchedule`。
|
|
234
|
+
*
|
|
235
|
+
*
|
|
236
|
+
* @param {string} params.knowledgeBaseId - Knowledge base ID.
|
|
237
|
+
* @param {string} params.dataSourceId - Data source ID.
|
|
238
|
+
* @param {string} params.versionId - Optional DRAFT Version ID.
|
|
239
|
+
* @param {string} params.name - Personal data source name.
|
|
240
|
+
* @param {string[]} params.urls - Personal Yuque document URLs.
|
|
241
|
+
* @param {string} params.syncSchedule - Cron schedule for automatic synchronization.
|
|
242
|
+
* @param {Status} params.status - Data source status.
|
|
243
|
+
* @throws {AgentbaseException}
|
|
244
|
+
* @returns {Promise<Models.KnowledgeBaseDataSource>}
|
|
245
|
+
*/
|
|
246
|
+
updateYuquePersonalDataSource(params: {
|
|
247
|
+
knowledgeBaseId: string;
|
|
248
|
+
dataSourceId: string;
|
|
249
|
+
versionId?: string;
|
|
250
|
+
name?: string;
|
|
251
|
+
urls?: string[];
|
|
252
|
+
syncSchedule?: string;
|
|
253
|
+
status?: Status;
|
|
254
|
+
}): Promise<Models.KnowledgeBaseDataSource>;
|
|
255
|
+
/**
|
|
256
|
+
* 更新当前登录用户拥有的蚂蚁文档数据源(API 类型为 `yuque_personal`)。
|
|
257
|
+
*
|
|
258
|
+
* 此接口仅接受 `SESSION` 或 `JWT`,并要求 `knowledgebases.write`。可更新字段为 `name`、`urls`、`syncSchedule` 与 `status`;服务端验证 owner,且不允许修改 OAuth credential 或 owner reference。修改 cron、启停或清除 cron 后会同步创建、更新或移除既有 schedule。Version DRAFT 不支持 `syncSchedule`。
|
|
259
|
+
*
|
|
260
|
+
*
|
|
261
|
+
* @param {string} knowledgeBaseId - Knowledge base ID.
|
|
262
|
+
* @param {string} dataSourceId - Data source ID.
|
|
263
|
+
* @param {string} versionId - Optional DRAFT Version ID.
|
|
264
|
+
* @param {string} name - Personal data source name.
|
|
265
|
+
* @param {string[]} urls - Personal Yuque document URLs.
|
|
266
|
+
* @param {string} syncSchedule - Cron schedule for automatic synchronization.
|
|
267
|
+
* @param {Status} status - Data source status.
|
|
268
|
+
* @throws {AgentbaseException}
|
|
269
|
+
* @returns {Promise<Models.KnowledgeBaseDataSource>}
|
|
270
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
271
|
+
*/
|
|
272
|
+
updateYuquePersonalDataSource(knowledgeBaseId: string, dataSourceId: string, versionId?: string, name?: string, urls?: string[], syncSchedule?: string, status?: Status): Promise<Models.KnowledgeBaseDataSource>;
|
|
273
|
+
/**
|
|
274
|
+
* 删除当前登录用户拥有的蚂蚁文档数据源(API 类型为 `yuque_personal`)。
|
|
275
|
+
*
|
|
276
|
+
* 此接口仅接受 `SESSION` 或 `JWT`,并要求 `knowledgebases.write`。服务端验证 source owner 后删除数据源、同步历史及其定时 schedule;已经由该源导入的知识库文档不会被删除。删除操作不会删除用户的 OAuth credential。
|
|
277
|
+
*
|
|
278
|
+
*
|
|
279
|
+
* @param {string} params.knowledgeBaseId - Knowledge base ID.
|
|
280
|
+
* @param {string} params.dataSourceId - Data source ID.
|
|
281
|
+
* @param {string} params.versionId - Optional DRAFT Version ID.
|
|
282
|
+
* @throws {AgentbaseException}
|
|
283
|
+
* @returns {Promise<{}>}
|
|
284
|
+
*/
|
|
285
|
+
deleteYuquePersonalDataSource(params: {
|
|
286
|
+
knowledgeBaseId: string;
|
|
287
|
+
dataSourceId: string;
|
|
288
|
+
versionId?: string;
|
|
289
|
+
}): Promise<{}>;
|
|
290
|
+
/**
|
|
291
|
+
* 删除当前登录用户拥有的蚂蚁文档数据源(API 类型为 `yuque_personal`)。
|
|
292
|
+
*
|
|
293
|
+
* 此接口仅接受 `SESSION` 或 `JWT`,并要求 `knowledgebases.write`。服务端验证 source owner 后删除数据源、同步历史及其定时 schedule;已经由该源导入的知识库文档不会被删除。删除操作不会删除用户的 OAuth credential。
|
|
294
|
+
*
|
|
295
|
+
*
|
|
296
|
+
* @param {string} knowledgeBaseId - Knowledge base ID.
|
|
297
|
+
* @param {string} dataSourceId - Data source ID.
|
|
298
|
+
* @param {string} versionId - Optional DRAFT Version ID.
|
|
299
|
+
* @throws {AgentbaseException}
|
|
300
|
+
* @returns {Promise<{}>}
|
|
301
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
302
|
+
*/
|
|
303
|
+
deleteYuquePersonalDataSource(knowledgeBaseId: string, dataSourceId: string, versionId?: string): Promise<{}>;
|
|
120
304
|
}
|
|
@@ -167,12 +167,15 @@ export declare class LlmGateway {
|
|
|
167
167
|
*
|
|
168
168
|
* Pass an `x-provider-key` header to bring your own upstream API key (BYOK) instead of the provider's stored key. If the request is authenticated with a Gateway Key whose `allowedModels` doesn't include the requested model, the endpoint returns a 403 `GENERAL_ACCESS_FORBIDDEN` error.
|
|
169
169
|
*
|
|
170
|
+
* 可选字符串 `instruct` 为原生排序任务说明,最长 65536 UTF-8 字节,拒绝纯空白和非法控制字符。省略或传空字符串时不发送该参数,保持默认行为。支持百炼 DashScope 的 `qwen3.7-text-rerank`、`qwen3-rerank` 和 `qwen3-vl-rerank`;非空值使用原生 `parameters.instruct`,`input.query` 和 `input.documents` 保持原文。不支持的 Provider 或模型返回参数错误,不会静默忽略。说明会计入试用额度预估;不影响原有超时、限流及结果索引校验。
|
|
171
|
+
*
|
|
170
172
|
*
|
|
171
173
|
* @param {string} params.model - Rerank model ID.
|
|
172
174
|
* @param {string} params.query - Query text to rank documents against.
|
|
173
175
|
* @param {string[]} params.documents - Documents to rerank.
|
|
174
176
|
* @param {number} params.topN - Return only the top N results.
|
|
175
177
|
* @param {boolean} params.returnDocuments - Include document text in the response.
|
|
178
|
+
* @param {string} params.instruct - Optional native sorting instruction for supported DashScope rerank models. Empty omits the instruction.
|
|
176
179
|
* @throws {AgentbaseException}
|
|
177
180
|
* @returns {Promise<Models.LlmGatewayRerankResponse>}
|
|
178
181
|
*/
|
|
@@ -182,23 +185,27 @@ export declare class LlmGateway {
|
|
|
182
185
|
documents: string[];
|
|
183
186
|
topN?: number;
|
|
184
187
|
returnDocuments?: boolean;
|
|
188
|
+
instruct?: string;
|
|
185
189
|
}): Promise<Models.LlmGatewayRerankResponse>;
|
|
186
190
|
/**
|
|
187
191
|
* Rerank documents by relevance to a query through the LLM Gateway. The response returns ranked document indexes, relevance scores, optional document text, and token usage for the rerank request. Streaming is not supported.
|
|
188
192
|
*
|
|
189
193
|
* Pass an `x-provider-key` header to bring your own upstream API key (BYOK) instead of the provider's stored key. If the request is authenticated with a Gateway Key whose `allowedModels` doesn't include the requested model, the endpoint returns a 403 `GENERAL_ACCESS_FORBIDDEN` error.
|
|
190
194
|
*
|
|
195
|
+
* 可选字符串 `instruct` 为原生排序任务说明,最长 65536 UTF-8 字节,拒绝纯空白和非法控制字符。省略或传空字符串时不发送该参数,保持默认行为。支持百炼 DashScope 的 `qwen3.7-text-rerank`、`qwen3-rerank` 和 `qwen3-vl-rerank`;非空值使用原生 `parameters.instruct`,`input.query` 和 `input.documents` 保持原文。不支持的 Provider 或模型返回参数错误,不会静默忽略。说明会计入试用额度预估;不影响原有超时、限流及结果索引校验。
|
|
196
|
+
*
|
|
191
197
|
*
|
|
192
198
|
* @param {string} model - Rerank model ID.
|
|
193
199
|
* @param {string} query - Query text to rank documents against.
|
|
194
200
|
* @param {string[]} documents - Documents to rerank.
|
|
195
201
|
* @param {number} topN - Return only the top N results.
|
|
196
202
|
* @param {boolean} returnDocuments - Include document text in the response.
|
|
203
|
+
* @param {string} instruct - Optional native sorting instruction for supported DashScope rerank models. Empty omits the instruction.
|
|
197
204
|
* @throws {AgentbaseException}
|
|
198
205
|
* @returns {Promise<Models.LlmGatewayRerankResponse>}
|
|
199
206
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
200
207
|
*/
|
|
201
|
-
createRerank(model: string, query: string, documents: string[], topN?: number, returnDocuments?: boolean): Promise<Models.LlmGatewayRerankResponse>;
|
|
208
|
+
createRerank(model: string, query: string, documents: string[], topN?: number, returnDocuments?: boolean, instruct?: string): Promise<Models.LlmGatewayRerankResponse>;
|
|
202
209
|
/**
|
|
203
210
|
*
|
|
204
211
|
* @throws {AgentbaseException}
|