@dmall-inc/wd-cli 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +401 -2
- package/bin/wd-cli.js +106 -0
- package/docs/design-references.md +75 -0
- package/lib/args.js +299 -0
- package/lib/auth.js +77 -0
- package/lib/commands/agent.js +784 -0
- package/lib/commands/api.js +122 -0
- package/lib/commands/auth.js +314 -0
- package/lib/commands/automation.js +92 -0
- package/lib/commands/completion.js +141 -0
- package/lib/commands/config.js +120 -0
- package/lib/commands/credential.js +108 -0
- package/lib/commands/dataset.js +144 -0
- package/lib/commands/evaluate.js +170 -0
- package/lib/commands/help.js +81 -0
- package/lib/commands/index.js +46 -0
- package/lib/commands/kb.js +449 -0
- package/lib/commands/observability.js +381 -0
- package/lib/commands/session.js +189 -0
- package/lib/commands/skill.js +463 -0
- package/lib/commands/workspace.js +110 -0
- package/lib/config.js +269 -0
- package/lib/data.js +128 -0
- package/lib/http.js +402 -0
- package/lib/jq.js +342 -0
- package/lib/keyring.js +125 -0
- package/lib/oidc.js +344 -0
- package/lib/output.js +249 -0
- package/package.json +22 -4
package/lib/http.js
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* HTTP 层:鉴权头、工作空间头、超时、Result 解包、令牌刷新重放、二进制下载、SSE、multipart。
|
|
5
|
+
* 全部用 Node 18+ 内置能力(fetch / AbortController / FormData / Blob),零运行时依赖。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('node:fs');
|
|
9
|
+
const path = require('node:path');
|
|
10
|
+
|
|
11
|
+
const { CliError, EXIT } = require('./output');
|
|
12
|
+
const config = require('./config');
|
|
13
|
+
const oidc = require('./oidc');
|
|
14
|
+
|
|
15
|
+
/** Result 的成功码(见 common 的 Result.ok:固定 200,不是 0)。 */
|
|
16
|
+
const RESULT_OK = 200;
|
|
17
|
+
|
|
18
|
+
/** 令牌剩余不足这个时长就先刷新,避免请求发到一半过期。 */
|
|
19
|
+
const REFRESH_SKEW_MS = 60_000;
|
|
20
|
+
|
|
21
|
+
/** 流式对话这类长连接的缺省超时(10 分钟)。 */
|
|
22
|
+
const STREAM_TIMEOUT_MS = 600_000;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 一次命令执行的上下文:命令实现只跟它打交道。
|
|
26
|
+
*/
|
|
27
|
+
class Context {
|
|
28
|
+
constructor({ runtime, principal, flags, env }) {
|
|
29
|
+
this.runtime = runtime;
|
|
30
|
+
this.principal = principal;
|
|
31
|
+
this.flags = flags || {};
|
|
32
|
+
this.env = env || process.env;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get timeoutMs() {
|
|
36
|
+
return this.flags.timeoutMs || this.runtime.timeoutMs;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Open API 基址(相对 /api/open)。 */
|
|
40
|
+
apiBase() {
|
|
41
|
+
if (!this.runtime.baseUrl) {
|
|
42
|
+
throw new CliError('未配置平台基址', EXIT.USAGE, {
|
|
43
|
+
hint: '执行 wd-cli auth login --base-url <url>,或设置 WD_CLI_BASE_URL',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return `${this.runtime.baseUrl}/api/open`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** 对话端点基址:部署拆分时可用 profile 的 chatBaseUrl 指向 server/gateway。 */
|
|
50
|
+
chatBase() {
|
|
51
|
+
const base = this.runtime.chatBaseUrl || this.runtime.baseUrl;
|
|
52
|
+
if (!base) {
|
|
53
|
+
throw new CliError('未配置平台基址', EXIT.USAGE, {
|
|
54
|
+
hint: '执行 wd-cli auth login --base-url <url>,或设置 WD_CLI_BASE_URL',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return `${base}/api/open`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** 当前有效的 access token;登录态临近过期时先刷新。 */
|
|
61
|
+
async token() {
|
|
62
|
+
if (this.runtime.directToken) return this.runtime.directToken;
|
|
63
|
+
await this.ensureFreshToken();
|
|
64
|
+
if (!this.runtime.auth || !this.runtime.auth.accessToken) {
|
|
65
|
+
throw new CliError('未登录', EXIT.USAGE, { hint: '先执行 wd-cli auth login' });
|
|
66
|
+
}
|
|
67
|
+
return this.runtime.auth.accessToken;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** 令牌快过期就静默换新(gcloud 同款体验),并把轮转后的 refresh token 落盘。 */
|
|
71
|
+
async ensureFreshToken(force = false) {
|
|
72
|
+
const auth = this.runtime.auth;
|
|
73
|
+
if (!auth || !auth.refreshToken) return false;
|
|
74
|
+
const expiring = auth.expiresAt && auth.expiresAt - Date.now() < REFRESH_SKEW_MS;
|
|
75
|
+
if (!force && !expiring) return false;
|
|
76
|
+
|
|
77
|
+
const endpoints = this.authEndpoints();
|
|
78
|
+
const tokens = await oidc.refreshTokens(
|
|
79
|
+
{
|
|
80
|
+
tokenEndpoint: endpoints.tokenEndpoint,
|
|
81
|
+
clientId: endpoints.clientId,
|
|
82
|
+
refreshToken: auth.refreshToken,
|
|
83
|
+
},
|
|
84
|
+
this.timeoutMs
|
|
85
|
+
);
|
|
86
|
+
const next = {
|
|
87
|
+
...auth,
|
|
88
|
+
accessToken: tokens.accessToken,
|
|
89
|
+
refreshToken: tokens.refreshToken || auth.refreshToken,
|
|
90
|
+
expiresAt: tokens.expiresAt,
|
|
91
|
+
};
|
|
92
|
+
this.runtime.auth = next;
|
|
93
|
+
config.updateHostEntry(this.runtime.profileName, { auth: next }, this.env);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** 认证中心端点:登录时写入 profile,缺失说明还没登录过。 */
|
|
98
|
+
authEndpoints() {
|
|
99
|
+
const authBaseUrl = this.runtime.authBaseUrl;
|
|
100
|
+
const clientId = this.runtime.clientId;
|
|
101
|
+
if (!authBaseUrl || !clientId) {
|
|
102
|
+
throw new CliError('本地缺少认证中心配置', EXIT.USAGE, {
|
|
103
|
+
hint: '重新执行 wd-cli auth login 即可写入',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
authBaseUrl,
|
|
108
|
+
clientId,
|
|
109
|
+
authorizeEndpoint: `${authBaseUrl}/oauth2/authorize`,
|
|
110
|
+
tokenEndpoint: `${authBaseUrl}/oauth2/token`,
|
|
111
|
+
revokeEndpoint: `${authBaseUrl}/oauth2/revoke`,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** 组装请求头:Bearer + 用户主体的工作空间头。 */
|
|
116
|
+
async headers(extra = {}) {
|
|
117
|
+
const headers = { Accept: 'application/json', ...extra };
|
|
118
|
+
headers.Authorization = `Bearer ${await this.token()}`;
|
|
119
|
+
if (this.principal === 'user' && this.runtime.workspaceId) {
|
|
120
|
+
headers['X-Workspace-Id'] = String(this.runtime.workspaceId);
|
|
121
|
+
}
|
|
122
|
+
return headers;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
log(message) {
|
|
126
|
+
if (this.flags.verbose) process.stderr.write(`[wd-cli] ${message}\n`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function buildUrl(base, pathname, query) {
|
|
131
|
+
// pathname 本身就是完整 URL 时直接用(wd-cli api 的逃生口支持绝对地址,
|
|
132
|
+
// 例如对话端点在 server/gateway、与其余 Open API 不同域名的部署)
|
|
133
|
+
const absolute = /^https?:\/\//i.test(pathname);
|
|
134
|
+
const url = absolute
|
|
135
|
+
? new URL(pathname)
|
|
136
|
+
: new URL(`${base}${pathname.startsWith('/') ? pathname : `/${pathname}`}`);
|
|
137
|
+
for (const [key, value] of Object.entries(query || {})) {
|
|
138
|
+
if (value === undefined || value === null || value === '') continue;
|
|
139
|
+
if (Array.isArray(value)) {
|
|
140
|
+
for (const v of value) url.searchParams.append(key, String(v));
|
|
141
|
+
} else {
|
|
142
|
+
url.searchParams.set(key, String(value));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return url.toString();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async function fetchWithTimeout(url, init, timeoutMs, ctx) {
|
|
149
|
+
const controller = new AbortController();
|
|
150
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
151
|
+
try {
|
|
152
|
+
if (ctx) ctx.log(`${init.method || 'GET'} ${url}`);
|
|
153
|
+
return await fetch(url, { ...init, signal: controller.signal });
|
|
154
|
+
} catch (error) {
|
|
155
|
+
if (error && error.name === 'AbortError') {
|
|
156
|
+
throw new CliError(`请求超时(${timeoutMs}ms):${url}`, EXIT.NETWORK, {
|
|
157
|
+
hint: '可用 --timeout-ms 调大,或检查网络与平台基址',
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
throw new CliError(`请求失败:${error.message}`, EXIT.NETWORK);
|
|
161
|
+
} finally {
|
|
162
|
+
clearTimeout(timer);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** 把 HTTP / Result 的失败翻译成带退出码的 CliError。 */
|
|
167
|
+
function toCliError(status, json, text, url) {
|
|
168
|
+
if (status === 401 || status === 403) {
|
|
169
|
+
const message = (json && json.message) || `鉴权失败(HTTP ${status})`;
|
|
170
|
+
return new CliError(message, EXIT.AUTH, {
|
|
171
|
+
code: json && json.code,
|
|
172
|
+
errorCode: json && json.errorCode,
|
|
173
|
+
hint: '令牌可能已失效或无权访问;重新执行 wd-cli auth login,或确认当前工作空间选对了',
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if (json && typeof json.code === 'number') {
|
|
177
|
+
const authLike = json.code === 401 || json.code === 403;
|
|
178
|
+
return new CliError(json.message || '请求失败', authLike ? EXIT.AUTH : EXIT.BUSINESS, {
|
|
179
|
+
code: json.code,
|
|
180
|
+
errorCode: json.errorCode,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
const preview = (text || '').replace(/\s+/g, ' ').slice(0, 200);
|
|
184
|
+
return new CliError(`请求失败(HTTP ${status}):${url}${preview ? ` ${preview}` : ''}`, EXIT.BUSINESS);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 发一次 JSON 请求并解包 Result。
|
|
189
|
+
* 401 时最多刷新一次令牌再重放(登录态才有意义)。
|
|
190
|
+
*/
|
|
191
|
+
async function request(ctx, { method = 'GET', base, path: pathname, query, body, form, headers: extraHeaders, raw }) {
|
|
192
|
+
// 用 ?? 而非 ||:调用方传空串表示「path 已是完整 URL,别再拼 base」,不是「没给 base」
|
|
193
|
+
const target = base ?? ctx.apiBase();
|
|
194
|
+
const url = buildUrl(target, pathname, query);
|
|
195
|
+
|
|
196
|
+
const send = async () => {
|
|
197
|
+
const headers = await ctx.headers(extraHeaders);
|
|
198
|
+
const init = { method, headers };
|
|
199
|
+
if (form) {
|
|
200
|
+
init.body = form; // FormData:让 fetch 自己带 boundary
|
|
201
|
+
} else if (body !== undefined && body !== null) {
|
|
202
|
+
headers['Content-Type'] = headers['Content-Type'] || 'application/json';
|
|
203
|
+
init.body = typeof body === 'string' ? body : JSON.stringify(body);
|
|
204
|
+
}
|
|
205
|
+
return fetchWithTimeout(url, init, ctx.timeoutMs, ctx);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
let response = await send();
|
|
209
|
+
if (response.status === 401 && !ctx.runtime.directToken) {
|
|
210
|
+
const refreshed = await ctx.ensureFreshToken(true).catch(() => false);
|
|
211
|
+
if (refreshed) response = await send();
|
|
212
|
+
}
|
|
213
|
+
if (typeof onResponse === 'function') {
|
|
214
|
+
try { onResponse(response); } catch {}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const text = await response.text();
|
|
218
|
+
if (raw) {
|
|
219
|
+
if (!response.ok) throw toCliError(response.status, safeJson(text), text, url);
|
|
220
|
+
return text;
|
|
221
|
+
}
|
|
222
|
+
const json = safeJson(text);
|
|
223
|
+
if (!response.ok) throw toCliError(response.status, json, text, url);
|
|
224
|
+
if (!json) {
|
|
225
|
+
throw new CliError(`响应不是合法 JSON:${(text || '').slice(0, 200)}`, EXIT.NETWORK);
|
|
226
|
+
}
|
|
227
|
+
if (typeof json.code === 'number' && json.code !== RESULT_OK) {
|
|
228
|
+
throw toCliError(response.status, json, text, url);
|
|
229
|
+
}
|
|
230
|
+
if (ctx.flags.envelope) return json;
|
|
231
|
+
// 平台 REST 统一是 Result<T>({code, data}),但对话端点直接回裸对象({type, content})。
|
|
232
|
+
// 无条件取 json.data 会让这类响应恒为 undefined(agent chat 输出空白),故按形态判别。
|
|
233
|
+
const enveloped =
|
|
234
|
+
typeof json.code === 'number' || Object.prototype.hasOwnProperty.call(json, 'data');
|
|
235
|
+
return enveloped ? json.data : json;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function safeJson(text) {
|
|
239
|
+
try {
|
|
240
|
+
return JSON.parse(text);
|
|
241
|
+
} catch {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* 自动翻页:对 PageResult 形态(data.list / data.total)逐页取回并合并。
|
|
248
|
+
* 命名与 gh api --paginate 一致。
|
|
249
|
+
*/
|
|
250
|
+
async function requestAllPages(ctx, options, pageSize = 100) {
|
|
251
|
+
const merged = [];
|
|
252
|
+
let pageNum = 1;
|
|
253
|
+
for (;;) {
|
|
254
|
+
const data = await request(ctx, {
|
|
255
|
+
...options,
|
|
256
|
+
query: { ...(options.query || {}), pageNum, pageSize },
|
|
257
|
+
});
|
|
258
|
+
const list = Array.isArray(data) ? data : data && Array.isArray(data.list) ? data.list : null;
|
|
259
|
+
if (list === null) return data; // 不是分页形态:原样返回
|
|
260
|
+
merged.push(...list);
|
|
261
|
+
const total = data && typeof data.total === 'number' ? data.total : merged.length;
|
|
262
|
+
if (Array.isArray(data) || merged.length >= total || list.length === 0) break;
|
|
263
|
+
pageNum += 1;
|
|
264
|
+
}
|
|
265
|
+
return merged;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** 下载二进制到文件或标准输出;文件名优先取 Content-Disposition。 */
|
|
269
|
+
async function download(ctx, { base, path: pathname, query, outPath, defaultName }) {
|
|
270
|
+
const url = buildUrl(base || ctx.apiBase(), pathname, query);
|
|
271
|
+
const headers = await ctx.headers({ Accept: '*/*' });
|
|
272
|
+
const response = await fetchWithTimeout(url, { method: 'GET', headers }, ctx.timeoutMs, ctx);
|
|
273
|
+
if (!response.ok) {
|
|
274
|
+
const text = await response.text();
|
|
275
|
+
throw toCliError(response.status, safeJson(text), text, url);
|
|
276
|
+
}
|
|
277
|
+
const buffer = Buffer.from(await response.arrayBuffer());
|
|
278
|
+
if (outPath === '-') {
|
|
279
|
+
process.stdout.write(buffer);
|
|
280
|
+
return { path: '-', bytes: buffer.length };
|
|
281
|
+
}
|
|
282
|
+
const disposition = response.headers.get('content-disposition') || '';
|
|
283
|
+
const fromHeader = parseFilename(disposition);
|
|
284
|
+
let target = outPath || fromHeader || defaultName || 'download.bin';
|
|
285
|
+
if (outPath && fs.existsSync(outPath) && fs.statSync(outPath).isDirectory()) {
|
|
286
|
+
target = path.join(outPath, fromHeader || defaultName || 'download.bin');
|
|
287
|
+
}
|
|
288
|
+
fs.mkdirSync(path.dirname(path.resolve(target)), { recursive: true });
|
|
289
|
+
fs.writeFileSync(target, buffer);
|
|
290
|
+
return { path: target, bytes: buffer.length };
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function parseFilename(disposition) {
|
|
294
|
+
const star = disposition.match(/filename\*=UTF-8''([^;]+)/i);
|
|
295
|
+
if (star) {
|
|
296
|
+
try {
|
|
297
|
+
return decodeURIComponent(star[1].trim().replace(/"/g, ''));
|
|
298
|
+
} catch {
|
|
299
|
+
// 落到下面的普通 filename
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
const plain = disposition.match(/filename="?([^";]+)"?/i);
|
|
303
|
+
return plain ? plain[1].trim() : null;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* 消费 SSE 流。onEvent 收到 { event, data }(data 为已 JSON.parse 的对象,解析失败给原始串)。
|
|
308
|
+
* 用于 AG-UI 事件流:文本增量、结束、错误。
|
|
309
|
+
*/
|
|
310
|
+
async function stream(ctx, { method = 'POST', base, path: pathname, query, body, onEvent, onResponse, timeoutMs }) {
|
|
311
|
+
const url = buildUrl(base ?? ctx.chatBase(), pathname, query);
|
|
312
|
+
const headers = await ctx.headers({ Accept: 'text/event-stream', 'Content-Type': 'application/json' });
|
|
313
|
+
const controller = new AbortController();
|
|
314
|
+
const limit = timeoutMs || STREAM_TIMEOUT_MS;
|
|
315
|
+
const timer = setTimeout(() => controller.abort(), limit);
|
|
316
|
+
try {
|
|
317
|
+
ctx.log(`${method} ${url} (stream)`);
|
|
318
|
+
const response = await fetch(url, {
|
|
319
|
+
method,
|
|
320
|
+
headers,
|
|
321
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
322
|
+
signal: controller.signal,
|
|
323
|
+
});
|
|
324
|
+
if (!response.ok || !response.body) {
|
|
325
|
+
const text = await response.text().catch(() => '');
|
|
326
|
+
throw toCliError(response.status, safeJson(text), text, url);
|
|
327
|
+
}
|
|
328
|
+
if (typeof onResponse === 'function') {
|
|
329
|
+
try { onResponse(response); } catch {}
|
|
330
|
+
}
|
|
331
|
+
const decoder = new TextDecoder();
|
|
332
|
+
let buffer = '';
|
|
333
|
+
for await (const chunk of response.body) {
|
|
334
|
+
buffer += decoder.decode(chunk, { stream: true });
|
|
335
|
+
let sep;
|
|
336
|
+
while ((sep = buffer.indexOf('\n\n')) >= 0) {
|
|
337
|
+
const rawEvent = buffer.slice(0, sep);
|
|
338
|
+
buffer = buffer.slice(sep + 2);
|
|
339
|
+
const parsed = parseSseBlock(rawEvent);
|
|
340
|
+
if (parsed) onEvent(parsed);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
const tail = parseSseBlock(buffer);
|
|
344
|
+
if (tail) onEvent(tail);
|
|
345
|
+
} catch (error) {
|
|
346
|
+
if (error && error.name === 'AbortError') {
|
|
347
|
+
throw new CliError(`流式响应超时(${limit}ms)`, EXIT.NETWORK);
|
|
348
|
+
}
|
|
349
|
+
if (error instanceof CliError) throw error;
|
|
350
|
+
throw new CliError(`流式请求失败:${error.message}`, EXIT.NETWORK);
|
|
351
|
+
} finally {
|
|
352
|
+
clearTimeout(timer);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function parseSseBlock(block) {
|
|
357
|
+
const lines = String(block).split('\n');
|
|
358
|
+
let event = null;
|
|
359
|
+
const dataLines = [];
|
|
360
|
+
for (const line of lines) {
|
|
361
|
+
if (line.startsWith(':')) continue; // 心跳注释帧
|
|
362
|
+
if (line.startsWith('event:')) event = line.slice(6).trim();
|
|
363
|
+
else if (line.startsWith('data:')) dataLines.push(line.slice(5).trim());
|
|
364
|
+
}
|
|
365
|
+
if (!dataLines.length && !event) return null;
|
|
366
|
+
const raw = dataLines.join('\n');
|
|
367
|
+
return { event, data: safeJson(raw) ?? raw };
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/** 构造 multipart 表单:fields 为普通字段,files 为 [{name, path}]。 */
|
|
371
|
+
function buildFormData(fields = {}, files = []) {
|
|
372
|
+
const form = new FormData();
|
|
373
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
374
|
+
if (value === undefined || value === null || value === '') continue;
|
|
375
|
+
form.append(key, String(value));
|
|
376
|
+
}
|
|
377
|
+
for (const file of files) {
|
|
378
|
+
if (!fs.existsSync(file.path)) {
|
|
379
|
+
throw new CliError(`文件不存在:${file.path}`, EXIT.USAGE);
|
|
380
|
+
}
|
|
381
|
+
const buffer = fs.readFileSync(file.path);
|
|
382
|
+
form.append(file.name, new Blob([buffer]), path.basename(file.path));
|
|
383
|
+
}
|
|
384
|
+
return form;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
module.exports = {
|
|
388
|
+
Context,
|
|
389
|
+
RESULT_OK,
|
|
390
|
+
REFRESH_SKEW_MS,
|
|
391
|
+
STREAM_TIMEOUT_MS,
|
|
392
|
+
buildUrl,
|
|
393
|
+
request,
|
|
394
|
+
requestAllPages,
|
|
395
|
+
download,
|
|
396
|
+
stream,
|
|
397
|
+
buildFormData,
|
|
398
|
+
parseSseBlock,
|
|
399
|
+
parseFilename,
|
|
400
|
+
toCliError,
|
|
401
|
+
fetchWithTimeout,
|
|
402
|
+
};
|