connectbase-client 0.10.5 → 0.10.7
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/dist/cli.js +22 -8
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ var crypto = __toESM(require("crypto"));
|
|
|
30
30
|
var https = __toESM(require("https"));
|
|
31
31
|
var http = __toESM(require("http"));
|
|
32
32
|
var readline = __toESM(require("readline"));
|
|
33
|
-
var VERSION = "0.6
|
|
33
|
+
var VERSION = "0.10.6";
|
|
34
34
|
var DEFAULT_BASE_URL = "https://api.connectbase.world";
|
|
35
35
|
var colors = {
|
|
36
36
|
reset: "\x1B[0m",
|
|
@@ -373,7 +373,9 @@ async function browserAuthFlow() {
|
|
|
373
373
|
{}
|
|
374
374
|
);
|
|
375
375
|
if (startRes.status !== 200) {
|
|
376
|
-
|
|
376
|
+
const errData = startRes.data;
|
|
377
|
+
const detail = errData?.error || errData?.message || `HTTP ${startRes.status}`;
|
|
378
|
+
error(`\uC778\uC99D \uC138\uC158 \uC2DC\uC791\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4: ${detail}`);
|
|
377
379
|
process.exit(1);
|
|
378
380
|
}
|
|
379
381
|
const { session_id } = startRes.data;
|
|
@@ -383,9 +385,11 @@ ${colors.cyan}\uBE0C\uB77C\uC6B0\uC800\uC5D0\uC11C \uB85C\uADF8\uC778\uD558\uC13
|
|
|
383
385
|
log(`${colors.dim}${authUrl}${colors.reset}
|
|
384
386
|
`);
|
|
385
387
|
openBrowser(authUrl);
|
|
386
|
-
const pollInterval =
|
|
387
|
-
const maxAttempts =
|
|
388
|
+
const pollInterval = 3e3;
|
|
389
|
+
const maxAttempts = 100;
|
|
388
390
|
let attempts = 0;
|
|
391
|
+
let consecutive404 = 0;
|
|
392
|
+
const max404Retries = 5;
|
|
389
393
|
const spinnerFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
390
394
|
while (attempts < maxAttempts) {
|
|
391
395
|
const frame = spinnerFrames[attempts % spinnerFrames.length];
|
|
@@ -398,6 +402,7 @@ ${colors.cyan}\uBE0C\uB77C\uC6B0\uC800\uC5D0\uC11C \uB85C\uADF8\uC778\uD558\uC13
|
|
|
398
402
|
{}
|
|
399
403
|
);
|
|
400
404
|
if (pollRes.status === 200) {
|
|
405
|
+
consecutive404 = 0;
|
|
401
406
|
const data = pollRes.data;
|
|
402
407
|
if (data.status === "approved" && data.secret_key) {
|
|
403
408
|
process.stdout.write("\r \r");
|
|
@@ -416,9 +421,12 @@ ${colors.cyan}\uBE0C\uB77C\uC6B0\uC800\uC5D0\uC11C \uB85C\uADF8\uC778\uD558\uC13
|
|
|
416
421
|
}
|
|
417
422
|
}
|
|
418
423
|
if (pollRes.status === 404) {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
424
|
+
consecutive404++;
|
|
425
|
+
if (consecutive404 >= max404Retries) {
|
|
426
|
+
process.stdout.write("\r \r");
|
|
427
|
+
error("\uC778\uC99D \uC138\uC158\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694.");
|
|
428
|
+
process.exit(1);
|
|
429
|
+
}
|
|
422
430
|
}
|
|
423
431
|
} catch {
|
|
424
432
|
}
|
|
@@ -455,7 +463,13 @@ ${colors.dim}\uC778\uC99D \uBC29\uC2DD\uC744 \uC120\uD0DD\uD558\uC138\uC694:${co
|
|
|
455
463
|
const authChoice = await prompt(`${colors.blue}?${colors.reset} \uC120\uD0DD (1/2): `);
|
|
456
464
|
let secretKey = "";
|
|
457
465
|
if (authChoice === "2") {
|
|
458
|
-
|
|
466
|
+
try {
|
|
467
|
+
secretKey = await browserAuthFlow();
|
|
468
|
+
} catch (err) {
|
|
469
|
+
error(`\uB124\uD2B8\uC6CC\uD06C \uC624\uB958: ${err instanceof Error ? err.message : err}`);
|
|
470
|
+
info("\uC778\uD130\uB137 \uC5F0\uACB0\uC744 \uD655\uC778\uD558\uAC70\uB098, Secret Key \uC9C1\uC811 \uC785\uB825(\uC635\uC158 1)\uC744 \uC2DC\uB3C4\uD558\uC138\uC694");
|
|
471
|
+
process.exit(1);
|
|
472
|
+
}
|
|
459
473
|
} else {
|
|
460
474
|
log(`${colors.dim}Secret Key (cb_sk_): \uCF58\uC194 > \uD504\uB85C\uD544 > \uC2DC\uD06C\uB9BF \uD0A4 \uD0ED\uC5D0\uC11C \uBC1C\uAE09${colors.reset}
|
|
461
475
|
`);
|
package/dist/index.d.mts
CHANGED
|
@@ -5441,6 +5441,7 @@ interface ListDocumentsResponse {
|
|
|
5441
5441
|
interface KnowledgeSearchRequest {
|
|
5442
5442
|
query: string;
|
|
5443
5443
|
top_k?: number;
|
|
5444
|
+
agentic?: boolean;
|
|
5444
5445
|
}
|
|
5445
5446
|
interface KnowledgeSearchResult {
|
|
5446
5447
|
chunk_id: string;
|
|
@@ -5591,6 +5592,7 @@ interface AIChatRequest {
|
|
|
5591
5592
|
appId?: string;
|
|
5592
5593
|
knowledgeBaseId?: string;
|
|
5593
5594
|
topK?: number;
|
|
5595
|
+
agentic?: boolean;
|
|
5594
5596
|
}
|
|
5595
5597
|
interface AISource {
|
|
5596
5598
|
chunkId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -5441,6 +5441,7 @@ interface ListDocumentsResponse {
|
|
|
5441
5441
|
interface KnowledgeSearchRequest {
|
|
5442
5442
|
query: string;
|
|
5443
5443
|
top_k?: number;
|
|
5444
|
+
agentic?: boolean;
|
|
5444
5445
|
}
|
|
5445
5446
|
interface KnowledgeSearchResult {
|
|
5446
5447
|
chunk_id: string;
|
|
@@ -5591,6 +5592,7 @@ interface AIChatRequest {
|
|
|
5591
5592
|
appId?: string;
|
|
5592
5593
|
knowledgeBaseId?: string;
|
|
5593
5594
|
topK?: number;
|
|
5595
|
+
agentic?: boolean;
|
|
5594
5596
|
}
|
|
5595
5597
|
interface AISource {
|
|
5596
5598
|
chunkId: string;
|