@bike4mind/cli 0.2.42 → 0.2.43-docs-clawdbot-comparison-analysis.20555
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/{artifactExtractor-35BJBKKL.js → artifactExtractor-MANDHXUQ.js} +1 -1
- package/dist/{chunk-M7WWYJKD.js → chunk-72IBWES7.js} +8 -6
- package/dist/{chunk-6DIDLC5R.js → chunk-E7GZ7B3A.js} +193 -134
- package/dist/{chunk-BDUHALFT.js → chunk-IPX2RZCM.js} +2 -2
- package/dist/{chunk-XFH3RPVU.js → chunk-MT4FJGUE.js} +2 -2
- package/dist/{chunk-XO4KZXR3.js → chunk-MYHJRMFR.js} +91 -2
- package/dist/{chunk-F33RP5VW.js → chunk-PFUH3PJW.js} +2 -2
- package/dist/{chunk-LSGK2ME7.js → chunk-TZVHC4LV.js} +1 -1
- package/dist/{chunk-LIRZ74HT.js → chunk-V4ZPYJ7V.js} +41 -10
- package/dist/commands/doctorCommand.js +1 -1
- package/dist/commands/headlessCommand.js +7 -7
- package/dist/commands/mcpCommand.js +2 -2
- package/dist/commands/updateCommand.js +1 -1
- package/dist/{create-JFS6T2CD.js → create-3Y6VAPG4.js} +3 -3
- package/dist/index.js +61 -10
- package/dist/{llmMarkdownGenerator-U4MPDJOF.js → llmMarkdownGenerator-DXJLV46C.js} +1 -1
- package/dist/{markdownGenerator-2VXZR3NZ.js → markdownGenerator-EGUVGELS.js} +1 -1
- package/dist/{mementoService-KISKEAWK.js → mementoService-F7BYS3TG.js} +3 -3
- package/dist/{src-WUPDSI4P.js → src-7WPKPQ66.js} +13 -1
- package/dist/{src-SE25E3PT.js → src-Z2NQ33Z7.js} +4 -2
- package/dist/{subtractCredits-D23MKI6N.js → subtractCredits-6JTTH5RH.js} +3 -3
- package/package.json +8 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CurationArtifactType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MYHJRMFR.js";
|
|
5
5
|
|
|
6
6
|
// ../../b4m-core/packages/services/dist/src/notebookCurationService/artifactExtractor.js
|
|
7
7
|
var ARTIFACT_TAG_REGEX = /<artifact\s+(.*?)>([\s\S]*?)<\/artifact>/gi;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "@bike4mind/cli",
|
|
6
|
-
version: "0.2.
|
|
6
|
+
version: "0.2.43-docs-clawdbot-comparison-analysis.20555+07323408b",
|
|
7
7
|
type: "module",
|
|
8
8
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
9
9
|
license: "UNLICENSED",
|
|
@@ -108,6 +108,7 @@ var package_default = {
|
|
|
108
108
|
uuid: "^9.0.1",
|
|
109
109
|
voyageai: "^0.0.4",
|
|
110
110
|
"web-tree-sitter": "0.25.10",
|
|
111
|
+
ws: "^8.19.0",
|
|
111
112
|
xlsx: "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
112
113
|
yargs: "^17.7.2",
|
|
113
114
|
yauzl: "^3.1.3",
|
|
@@ -117,10 +118,10 @@ var package_default = {
|
|
|
117
118
|
},
|
|
118
119
|
devDependencies: {
|
|
119
120
|
"@bike4mind/agents": "0.1.0",
|
|
120
|
-
"@bike4mind/common": "2.62.
|
|
121
|
-
"@bike4mind/mcp": "1.33.
|
|
122
|
-
"@bike4mind/services": "2.58.
|
|
123
|
-
"@bike4mind/utils": "2.13.
|
|
121
|
+
"@bike4mind/common": "2.62.1-docs-clawdbot-comparison-analysis.20555+07323408b",
|
|
122
|
+
"@bike4mind/mcp": "1.33.5-docs-clawdbot-comparison-analysis.20555+07323408b",
|
|
123
|
+
"@bike4mind/services": "2.58.1-docs-clawdbot-comparison-analysis.20555+07323408b",
|
|
124
|
+
"@bike4mind/utils": "2.13.1-docs-clawdbot-comparison-analysis.20555+07323408b",
|
|
124
125
|
"@types/better-sqlite3": "^7.6.13",
|
|
125
126
|
"@types/diff": "^5.0.9",
|
|
126
127
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -128,6 +129,7 @@ var package_default = {
|
|
|
128
129
|
"@types/picomatch": "^4.0.2",
|
|
129
130
|
"@types/react": "^19.2.7",
|
|
130
131
|
"@types/uuid": "^9.0.7",
|
|
132
|
+
"@types/ws": "^8.18.1",
|
|
131
133
|
"@types/yargs": "^17.0.32",
|
|
132
134
|
"ink-testing-library": "^4.0.0",
|
|
133
135
|
tsup: "^8.5.1",
|
|
@@ -138,7 +140,7 @@ var package_default = {
|
|
|
138
140
|
optionalDependencies: {
|
|
139
141
|
"@vscode/ripgrep": "^1.17.0"
|
|
140
142
|
},
|
|
141
|
-
gitHead: "
|
|
143
|
+
gitHead: "07323408b6ba76c4841e86ae5429f3a96ed09ba7"
|
|
142
144
|
};
|
|
143
145
|
|
|
144
146
|
// src/utils/updateChecker.ts
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
extractSnippetMeta,
|
|
21
21
|
isGPTImageModel,
|
|
22
22
|
settingsMap
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-MYHJRMFR.js";
|
|
24
24
|
|
|
25
25
|
// ../../b4m-core/packages/utils/dist/src/storage/S3Storage.js
|
|
26
26
|
import { S3Client, PutObjectCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand } from "@aws-sdk/client-s3";
|
|
@@ -2492,6 +2492,162 @@ function getCachingAdapter(backend) {
|
|
|
2492
2492
|
return ADAPTERS[backend] || new NoOpCachingAdapter();
|
|
2493
2493
|
}
|
|
2494
2494
|
|
|
2495
|
+
// ../../b4m-core/packages/utils/dist/src/retry.js
|
|
2496
|
+
import { isAxiosError as isAxiosError2 } from "axios";
|
|
2497
|
+
function isRetryableError(error) {
|
|
2498
|
+
const message = error.message.toLowerCase();
|
|
2499
|
+
if (isAxiosError2(error)) {
|
|
2500
|
+
const status = error.response?.status;
|
|
2501
|
+
if (status === 429) {
|
|
2502
|
+
return true;
|
|
2503
|
+
}
|
|
2504
|
+
if (status === 502 || status === 503 || status === 504) {
|
|
2505
|
+
return true;
|
|
2506
|
+
}
|
|
2507
|
+
if (error.code === "ECONNRESET" || error.code === "ETIMEDOUT" || error.code === "ECONNREFUSED") {
|
|
2508
|
+
return true;
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
if ("code" in error && (error.code === "ECONNRESET" || error.code === "ETIMEDOUT")) {
|
|
2512
|
+
return true;
|
|
2513
|
+
}
|
|
2514
|
+
const undiciCodes = ["UND_ERR_SOCKET", "UND_ERR_CONNECT_TIMEOUT", "UND_ERR_BODY_TIMEOUT"];
|
|
2515
|
+
if ("code" in error && undiciCodes.includes(String(error.code))) {
|
|
2516
|
+
return true;
|
|
2517
|
+
}
|
|
2518
|
+
if ("code" in error && (error.code === "ENOTFOUND" || error.code === "EAI_AGAIN")) {
|
|
2519
|
+
return true;
|
|
2520
|
+
}
|
|
2521
|
+
if (error.name === "TypeError" && message.includes("terminated")) {
|
|
2522
|
+
return true;
|
|
2523
|
+
}
|
|
2524
|
+
const retryablePatterns = [
|
|
2525
|
+
"econnreset",
|
|
2526
|
+
"etimedout",
|
|
2527
|
+
"connection reset",
|
|
2528
|
+
"connection refused",
|
|
2529
|
+
"socket hang up",
|
|
2530
|
+
"terminated",
|
|
2531
|
+
"network error",
|
|
2532
|
+
"timeout",
|
|
2533
|
+
"rate limit",
|
|
2534
|
+
"too many requests",
|
|
2535
|
+
"service unavailable",
|
|
2536
|
+
"bad gateway",
|
|
2537
|
+
"gateway timeout",
|
|
2538
|
+
"overloaded",
|
|
2539
|
+
// Additional patterns for TLS/socket errors (#6936, #6892)
|
|
2540
|
+
"aborted",
|
|
2541
|
+
// TLS socket close
|
|
2542
|
+
"socket closed",
|
|
2543
|
+
// Generic socket termination
|
|
2544
|
+
"connection closed",
|
|
2545
|
+
// Connection termination
|
|
2546
|
+
"enotfound",
|
|
2547
|
+
// DNS lookup failure
|
|
2548
|
+
"eai_again",
|
|
2549
|
+
// Temporary DNS failure
|
|
2550
|
+
"und_err_socket",
|
|
2551
|
+
// Undici socket error
|
|
2552
|
+
"und_err_connect_timeout",
|
|
2553
|
+
// Undici connection timeout
|
|
2554
|
+
"fetch failed"
|
|
2555
|
+
// Generic fetch failure
|
|
2556
|
+
];
|
|
2557
|
+
return retryablePatterns.some((pattern) => message.includes(pattern));
|
|
2558
|
+
}
|
|
2559
|
+
function isUserInitiatedAbort(error, userSignal) {
|
|
2560
|
+
if (userSignal?.aborted) {
|
|
2561
|
+
return true;
|
|
2562
|
+
}
|
|
2563
|
+
const isAbortError = error.name === "AbortError" || error.name === "Error" && error.message === "aborted";
|
|
2564
|
+
if (isAbortError && userSignal && !userSignal.aborted) {
|
|
2565
|
+
return false;
|
|
2566
|
+
}
|
|
2567
|
+
return isAbortError && !userSignal;
|
|
2568
|
+
}
|
|
2569
|
+
function getRetryAfterMs(error) {
|
|
2570
|
+
if (!isAxiosError2(error)) {
|
|
2571
|
+
return null;
|
|
2572
|
+
}
|
|
2573
|
+
const retryAfter = error.response?.headers?.["retry-after"];
|
|
2574
|
+
if (!retryAfter) {
|
|
2575
|
+
return null;
|
|
2576
|
+
}
|
|
2577
|
+
const seconds = parseInt(retryAfter, 10);
|
|
2578
|
+
if (!isNaN(seconds)) {
|
|
2579
|
+
return seconds * 1e3;
|
|
2580
|
+
}
|
|
2581
|
+
const date = Date.parse(retryAfter);
|
|
2582
|
+
if (!isNaN(date)) {
|
|
2583
|
+
return Math.max(0, date - Date.now());
|
|
2584
|
+
}
|
|
2585
|
+
return null;
|
|
2586
|
+
}
|
|
2587
|
+
function calculateRetryDelay(attempt, initialDelayMs, maxDelayMs, jitterFactor) {
|
|
2588
|
+
const exponentialDelay = initialDelayMs * Math.pow(2, attempt);
|
|
2589
|
+
const cappedDelay = Math.min(exponentialDelay, maxDelayMs);
|
|
2590
|
+
const jitter = cappedDelay * jitterFactor * (Math.random() * 2 - 1);
|
|
2591
|
+
return Math.max(0, Math.round(cappedDelay + jitter));
|
|
2592
|
+
}
|
|
2593
|
+
async function sleep(ms, abortSignal) {
|
|
2594
|
+
return new Promise((resolve, reject) => {
|
|
2595
|
+
if (abortSignal?.aborted) {
|
|
2596
|
+
reject(new Error("Aborted"));
|
|
2597
|
+
return;
|
|
2598
|
+
}
|
|
2599
|
+
const timeout = setTimeout(resolve, ms);
|
|
2600
|
+
abortSignal?.addEventListener("abort", () => {
|
|
2601
|
+
clearTimeout(timeout);
|
|
2602
|
+
reject(new Error("Aborted"));
|
|
2603
|
+
});
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2606
|
+
async function withRetry(fn, options = {}) {
|
|
2607
|
+
const { maxRetries = 3, initialDelayMs = 100, maxDelayMs = 5e3, jitterFactor = 0.1, isRetryable = isRetryableError, logger, abortSignal } = options;
|
|
2608
|
+
let attempts = 0;
|
|
2609
|
+
let totalDelayMs = 0;
|
|
2610
|
+
while (true) {
|
|
2611
|
+
try {
|
|
2612
|
+
if (abortSignal?.aborted) {
|
|
2613
|
+
throw new Error("Aborted");
|
|
2614
|
+
}
|
|
2615
|
+
const result = await fn();
|
|
2616
|
+
return { result, attempts, totalDelayMs };
|
|
2617
|
+
} catch (error) {
|
|
2618
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
2619
|
+
if (attempts >= maxRetries || !isRetryable(err)) {
|
|
2620
|
+
throw error;
|
|
2621
|
+
}
|
|
2622
|
+
if (abortSignal?.aborted) {
|
|
2623
|
+
throw error;
|
|
2624
|
+
}
|
|
2625
|
+
let delayMs = calculateRetryDelay(attempts, initialDelayMs, maxDelayMs, jitterFactor);
|
|
2626
|
+
const retryAfterMs = getRetryAfterMs(err);
|
|
2627
|
+
if (retryAfterMs !== null) {
|
|
2628
|
+
delayMs = Math.min(retryAfterMs, maxDelayMs);
|
|
2629
|
+
logger?.info(`Rate limited, using Retry-After delay`, {
|
|
2630
|
+
retryAfterMs,
|
|
2631
|
+
actualDelayMs: delayMs
|
|
2632
|
+
});
|
|
2633
|
+
}
|
|
2634
|
+
attempts++;
|
|
2635
|
+
totalDelayMs += delayMs;
|
|
2636
|
+
logger?.warn(`Retry attempt ${attempts}/${maxRetries} after ${delayMs}ms`, {
|
|
2637
|
+
error: err.message,
|
|
2638
|
+
errorCode: "code" in err ? err.code : void 0,
|
|
2639
|
+
attempt: attempts,
|
|
2640
|
+
delayMs
|
|
2641
|
+
});
|
|
2642
|
+
try {
|
|
2643
|
+
await sleep(delayMs, abortSignal);
|
|
2644
|
+
} catch {
|
|
2645
|
+
throw error;
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2495
2651
|
// ../../b4m-core/packages/utils/dist/src/llm/anthropicBackend.js
|
|
2496
2652
|
var TEMPERATURE_ONLY_MODELS = [
|
|
2497
2653
|
ChatModels.CLAUDE_4_5_SONNET,
|
|
@@ -3078,7 +3234,15 @@ IMPORTANT! Only when someone asks, remember that you are specifically the ${mode
|
|
|
3078
3234
|
hasThinking: !!apiParams.thinking,
|
|
3079
3235
|
thinkingBudget: apiParams.thinking?.budget_tokens
|
|
3080
3236
|
});
|
|
3081
|
-
const stream = await this._api.messages.create({ ...apiParams, stream: true }, { signal: combinedSignal })
|
|
3237
|
+
const stream = await withRetry(() => this._api.messages.create({ ...apiParams, stream: true }, { signal: combinedSignal }), {
|
|
3238
|
+
maxRetries: 3,
|
|
3239
|
+
initialDelayMs: 500,
|
|
3240
|
+
maxDelayMs: 1e4,
|
|
3241
|
+
jitterFactor: 0.25,
|
|
3242
|
+
isRetryable: (err) => isRetryableError(err) && !isUserInitiatedAbort(err, options.abortSignal),
|
|
3243
|
+
logger: this.logger,
|
|
3244
|
+
abortSignal: combinedSignal
|
|
3245
|
+
}).then((r) => r.result);
|
|
3082
3246
|
if (requestTimeout)
|
|
3083
3247
|
clearTimeout(requestTimeout);
|
|
3084
3248
|
let isInThinkingBlock = false;
|
|
@@ -3354,7 +3518,15 @@ IMPORTANT! Only when someone asks, remember that you are specifically the ${mode
|
|
|
3354
3518
|
return;
|
|
3355
3519
|
}
|
|
3356
3520
|
} else {
|
|
3357
|
-
const response = await this._api.messages.create(apiParams, { signal: options.abortSignal })
|
|
3521
|
+
const response = await withRetry(() => this._api.messages.create(apiParams, { signal: options.abortSignal }), {
|
|
3522
|
+
maxRetries: 3,
|
|
3523
|
+
initialDelayMs: 500,
|
|
3524
|
+
maxDelayMs: 1e4,
|
|
3525
|
+
jitterFactor: 0.25,
|
|
3526
|
+
isRetryable: (err) => isRetryableError(err) && !isUserInitiatedAbort(err, options.abortSignal),
|
|
3527
|
+
logger: this.logger,
|
|
3528
|
+
abortSignal: options.abortSignal
|
|
3529
|
+
}).then((r) => r.result);
|
|
3358
3530
|
const streamedText = [];
|
|
3359
3531
|
if ("content" in response && Array.isArray(response.content)) {
|
|
3360
3532
|
if (this.isThinkingEnabled) {
|
|
@@ -7256,9 +7428,17 @@ var OpenAIBackend = class {
|
|
|
7256
7428
|
parameters.parallel_tool_calls = options.parallel_tool_calls;
|
|
7257
7429
|
}
|
|
7258
7430
|
}
|
|
7259
|
-
const response = await this._api.chat.completions.create(parameters, {
|
|
7431
|
+
const response = await withRetry(() => this._api.chat.completions.create(parameters, {
|
|
7260
7432
|
signal: options.abortSignal
|
|
7261
|
-
})
|
|
7433
|
+
}), {
|
|
7434
|
+
maxRetries: 3,
|
|
7435
|
+
initialDelayMs: 500,
|
|
7436
|
+
maxDelayMs: 1e4,
|
|
7437
|
+
jitterFactor: 0.25,
|
|
7438
|
+
isRetryable: (err) => isRetryableError(err) && !isUserInitiatedAbort(err, options.abortSignal),
|
|
7439
|
+
logger: this.logger,
|
|
7440
|
+
abortSignal: options.abortSignal
|
|
7441
|
+
}).then((r) => r.result);
|
|
7262
7442
|
let inputTokens = 0;
|
|
7263
7443
|
let outputTokens = 0;
|
|
7264
7444
|
if (!(response instanceof Stream)) {
|
|
@@ -12228,10 +12408,10 @@ function isMermaidSyntax(line) {
|
|
|
12228
12408
|
}
|
|
12229
12409
|
|
|
12230
12410
|
// ../../b4m-core/packages/utils/dist/src/adminSettings/fallback.js
|
|
12231
|
-
import { isAxiosError as
|
|
12411
|
+
import { isAxiosError as isAxiosError3 } from "axios";
|
|
12232
12412
|
function shouldTriggerFallback(error) {
|
|
12233
12413
|
const message = error.message.toLowerCase();
|
|
12234
|
-
if (
|
|
12414
|
+
if (isAxiosError3(error)) {
|
|
12235
12415
|
const status = error.response?.status;
|
|
12236
12416
|
if (status === 429 || status === 502 || status === 503 || status === 504) {
|
|
12237
12417
|
return true;
|
|
@@ -12270,7 +12450,7 @@ function shouldTriggerFallback(error) {
|
|
|
12270
12450
|
}
|
|
12271
12451
|
function isOverloadedError(error) {
|
|
12272
12452
|
const message = error.message.toLowerCase();
|
|
12273
|
-
if (
|
|
12453
|
+
if (isAxiosError3(error)) {
|
|
12274
12454
|
const status = error.response?.status;
|
|
12275
12455
|
if (status === 429 || status === 529 || status === 503) {
|
|
12276
12456
|
return true;
|
|
@@ -12560,128 +12740,6 @@ function extractFilename(input) {
|
|
|
12560
12740
|
}
|
|
12561
12741
|
}
|
|
12562
12742
|
|
|
12563
|
-
// ../../b4m-core/packages/utils/dist/src/retry.js
|
|
12564
|
-
import { isAxiosError as isAxiosError3 } from "axios";
|
|
12565
|
-
function isRetryableError(error) {
|
|
12566
|
-
const message = error.message.toLowerCase();
|
|
12567
|
-
if (isAxiosError3(error)) {
|
|
12568
|
-
const status = error.response?.status;
|
|
12569
|
-
if (status === 429) {
|
|
12570
|
-
return true;
|
|
12571
|
-
}
|
|
12572
|
-
if (status === 502 || status === 503 || status === 504) {
|
|
12573
|
-
return true;
|
|
12574
|
-
}
|
|
12575
|
-
if (error.code === "ECONNRESET" || error.code === "ETIMEDOUT" || error.code === "ECONNREFUSED") {
|
|
12576
|
-
return true;
|
|
12577
|
-
}
|
|
12578
|
-
}
|
|
12579
|
-
if ("code" in error && (error.code === "ECONNRESET" || error.code === "ETIMEDOUT")) {
|
|
12580
|
-
return true;
|
|
12581
|
-
}
|
|
12582
|
-
if (error.name === "TypeError" && message.includes("terminated")) {
|
|
12583
|
-
return true;
|
|
12584
|
-
}
|
|
12585
|
-
const retryablePatterns = [
|
|
12586
|
-
"econnreset",
|
|
12587
|
-
"etimedout",
|
|
12588
|
-
"connection reset",
|
|
12589
|
-
"connection refused",
|
|
12590
|
-
"socket hang up",
|
|
12591
|
-
"terminated",
|
|
12592
|
-
"network error",
|
|
12593
|
-
"timeout",
|
|
12594
|
-
"rate limit",
|
|
12595
|
-
"too many requests",
|
|
12596
|
-
"service unavailable",
|
|
12597
|
-
"bad gateway",
|
|
12598
|
-
"gateway timeout",
|
|
12599
|
-
"overloaded"
|
|
12600
|
-
];
|
|
12601
|
-
return retryablePatterns.some((pattern) => message.includes(pattern));
|
|
12602
|
-
}
|
|
12603
|
-
function getRetryAfterMs(error) {
|
|
12604
|
-
if (!isAxiosError3(error)) {
|
|
12605
|
-
return null;
|
|
12606
|
-
}
|
|
12607
|
-
const retryAfter = error.response?.headers?.["retry-after"];
|
|
12608
|
-
if (!retryAfter) {
|
|
12609
|
-
return null;
|
|
12610
|
-
}
|
|
12611
|
-
const seconds = parseInt(retryAfter, 10);
|
|
12612
|
-
if (!isNaN(seconds)) {
|
|
12613
|
-
return seconds * 1e3;
|
|
12614
|
-
}
|
|
12615
|
-
const date = Date.parse(retryAfter);
|
|
12616
|
-
if (!isNaN(date)) {
|
|
12617
|
-
return Math.max(0, date - Date.now());
|
|
12618
|
-
}
|
|
12619
|
-
return null;
|
|
12620
|
-
}
|
|
12621
|
-
function calculateRetryDelay(attempt, initialDelayMs, maxDelayMs, jitterFactor) {
|
|
12622
|
-
const exponentialDelay = initialDelayMs * Math.pow(2, attempt);
|
|
12623
|
-
const cappedDelay = Math.min(exponentialDelay, maxDelayMs);
|
|
12624
|
-
const jitter = cappedDelay * jitterFactor * (Math.random() * 2 - 1);
|
|
12625
|
-
return Math.max(0, Math.round(cappedDelay + jitter));
|
|
12626
|
-
}
|
|
12627
|
-
async function sleep(ms, abortSignal) {
|
|
12628
|
-
return new Promise((resolve, reject) => {
|
|
12629
|
-
if (abortSignal?.aborted) {
|
|
12630
|
-
reject(new Error("Aborted"));
|
|
12631
|
-
return;
|
|
12632
|
-
}
|
|
12633
|
-
const timeout = setTimeout(resolve, ms);
|
|
12634
|
-
abortSignal?.addEventListener("abort", () => {
|
|
12635
|
-
clearTimeout(timeout);
|
|
12636
|
-
reject(new Error("Aborted"));
|
|
12637
|
-
});
|
|
12638
|
-
});
|
|
12639
|
-
}
|
|
12640
|
-
async function withRetry(fn, options = {}) {
|
|
12641
|
-
const { maxRetries = 3, initialDelayMs = 100, maxDelayMs = 5e3, jitterFactor = 0.1, isRetryable = isRetryableError, logger, abortSignal } = options;
|
|
12642
|
-
let attempts = 0;
|
|
12643
|
-
let totalDelayMs = 0;
|
|
12644
|
-
while (true) {
|
|
12645
|
-
try {
|
|
12646
|
-
if (abortSignal?.aborted) {
|
|
12647
|
-
throw new Error("Aborted");
|
|
12648
|
-
}
|
|
12649
|
-
const result = await fn();
|
|
12650
|
-
return { result, attempts, totalDelayMs };
|
|
12651
|
-
} catch (error) {
|
|
12652
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
12653
|
-
if (attempts >= maxRetries || !isRetryable(err)) {
|
|
12654
|
-
throw error;
|
|
12655
|
-
}
|
|
12656
|
-
if (abortSignal?.aborted) {
|
|
12657
|
-
throw error;
|
|
12658
|
-
}
|
|
12659
|
-
let delayMs = calculateRetryDelay(attempts, initialDelayMs, maxDelayMs, jitterFactor);
|
|
12660
|
-
const retryAfterMs = getRetryAfterMs(err);
|
|
12661
|
-
if (retryAfterMs !== null) {
|
|
12662
|
-
delayMs = Math.min(retryAfterMs, maxDelayMs);
|
|
12663
|
-
logger?.info(`Rate limited, using Retry-After delay`, {
|
|
12664
|
-
retryAfterMs,
|
|
12665
|
-
actualDelayMs: delayMs
|
|
12666
|
-
});
|
|
12667
|
-
}
|
|
12668
|
-
attempts++;
|
|
12669
|
-
totalDelayMs += delayMs;
|
|
12670
|
-
logger?.warn(`Retry attempt ${attempts}/${maxRetries} after ${delayMs}ms`, {
|
|
12671
|
-
error: err.message,
|
|
12672
|
-
errorCode: "code" in err ? err.code : void 0,
|
|
12673
|
-
attempt: attempts,
|
|
12674
|
-
delayMs
|
|
12675
|
-
});
|
|
12676
|
-
try {
|
|
12677
|
-
await sleep(delayMs, abortSignal);
|
|
12678
|
-
} catch {
|
|
12679
|
-
throw error;
|
|
12680
|
-
}
|
|
12681
|
-
}
|
|
12682
|
-
}
|
|
12683
|
-
}
|
|
12684
|
-
|
|
12685
12743
|
// ../../b4m-core/packages/utils/dist/src/voiceHistory.js
|
|
12686
12744
|
function truncateText(text, maxLength) {
|
|
12687
12745
|
if (text.length <= maxLength)
|
|
@@ -12839,6 +12897,11 @@ export {
|
|
|
12839
12897
|
stripAllToolBlocks,
|
|
12840
12898
|
buildAndSortMessages,
|
|
12841
12899
|
getLastBuildDebugInfo,
|
|
12900
|
+
isRetryableError,
|
|
12901
|
+
isUserInitiatedAbort,
|
|
12902
|
+
getRetryAfterMs,
|
|
12903
|
+
calculateRetryDelay,
|
|
12904
|
+
withRetry,
|
|
12842
12905
|
AnthropicBackend,
|
|
12843
12906
|
extractThinkContent,
|
|
12844
12907
|
AWSBackend,
|
|
@@ -12915,10 +12978,6 @@ export {
|
|
|
12915
12978
|
TiktokenTokenizer,
|
|
12916
12979
|
createTokenizer,
|
|
12917
12980
|
extractFilename,
|
|
12918
|
-
isRetryableError,
|
|
12919
|
-
getRetryAfterMs,
|
|
12920
|
-
calculateRetryDelay,
|
|
12921
|
-
withRetry,
|
|
12922
12981
|
formatVoiceHistory,
|
|
12923
12982
|
buildVoiceInstructions,
|
|
12924
12983
|
registerLambdaErrorHandlers,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
4
|
secureParameters
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-E7GZ7B3A.js";
|
|
6
6
|
import {
|
|
7
7
|
CompletionApiUsageTransaction,
|
|
8
8
|
GenericCreditDeductTransaction,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
ToolUsageTransaction,
|
|
14
14
|
TransferCreditTransaction,
|
|
15
15
|
VideoGenerationUsageTransaction
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MYHJRMFR.js";
|
|
17
17
|
|
|
18
18
|
// ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
|
|
19
19
|
import { z } from "zod";
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getSettingsByNames,
|
|
7
7
|
obfuscateApiKey,
|
|
8
8
|
secureParameters
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-E7GZ7B3A.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiKeyType,
|
|
12
12
|
MementoTier,
|
|
13
13
|
isSupportedEmbeddingModel
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MYHJRMFR.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -1677,6 +1677,83 @@ var CliToolResponseAction = z10.object({
|
|
|
1677
1677
|
content: z10.unknown().optional(),
|
|
1678
1678
|
error: z10.string().optional()
|
|
1679
1679
|
});
|
|
1680
|
+
var KeepCommandRequestAction = z10.object({
|
|
1681
|
+
action: z10.literal("keep_command_request"),
|
|
1682
|
+
accessToken: z10.string().optional(),
|
|
1683
|
+
commandType: z10.enum(["read_file", "list_directory", "run_tool"]),
|
|
1684
|
+
params: z10.record(z10.string(), z10.unknown()),
|
|
1685
|
+
requestId: z10.string()
|
|
1686
|
+
});
|
|
1687
|
+
var KeepCommandAction = z10.object({
|
|
1688
|
+
action: z10.literal("keep_command"),
|
|
1689
|
+
commandType: z10.enum(["read_file", "list_directory", "run_tool"]),
|
|
1690
|
+
params: z10.record(z10.string(), z10.unknown()),
|
|
1691
|
+
requestId: z10.string(),
|
|
1692
|
+
originConnectionId: z10.string()
|
|
1693
|
+
});
|
|
1694
|
+
var KeepCommandResponseAction = z10.object({
|
|
1695
|
+
action: z10.literal("keep_command_response"),
|
|
1696
|
+
requestId: z10.string(),
|
|
1697
|
+
originConnectionId: z10.string(),
|
|
1698
|
+
success: z10.boolean(),
|
|
1699
|
+
result: z10.unknown().optional(),
|
|
1700
|
+
error: z10.string().optional()
|
|
1701
|
+
});
|
|
1702
|
+
var KeepCommandResultAction = z10.object({
|
|
1703
|
+
action: z10.literal("keep_command_result"),
|
|
1704
|
+
requestId: z10.string(),
|
|
1705
|
+
success: z10.boolean(),
|
|
1706
|
+
result: z10.unknown().optional(),
|
|
1707
|
+
error: z10.string().optional()
|
|
1708
|
+
});
|
|
1709
|
+
var TilePositionSchema = z10.object({ x: z10.number(), y: z10.number() });
|
|
1710
|
+
var SceneCommandSchema = z10.discriminatedUnion("type", [
|
|
1711
|
+
z10.object({
|
|
1712
|
+
type: z10.literal("add_entity"),
|
|
1713
|
+
params: z10.object({
|
|
1714
|
+
id: z10.string(),
|
|
1715
|
+
spriteSheetId: z10.string(),
|
|
1716
|
+
position: TilePositionSchema,
|
|
1717
|
+
facing: z10.enum(["left", "right"]).optional(),
|
|
1718
|
+
animation: z10.string().optional(),
|
|
1719
|
+
visible: z10.boolean().optional(),
|
|
1720
|
+
zIndex: z10.number().optional(),
|
|
1721
|
+
metadata: z10.record(z10.string(), z10.unknown()).optional()
|
|
1722
|
+
})
|
|
1723
|
+
}),
|
|
1724
|
+
z10.object({ type: z10.literal("remove_entity"), id: z10.string() }),
|
|
1725
|
+
z10.object({
|
|
1726
|
+
type: z10.literal("walk_to"),
|
|
1727
|
+
id: z10.string(),
|
|
1728
|
+
target: TilePositionSchema,
|
|
1729
|
+
options: z10.object({ speed: z10.number().optional() }).optional()
|
|
1730
|
+
}),
|
|
1731
|
+
z10.object({ type: z10.literal("teleport"), id: z10.string(), position: TilePositionSchema }),
|
|
1732
|
+
z10.object({ type: z10.literal("play_animation"), id: z10.string(), animation: z10.string(), loop: z10.boolean().optional() }),
|
|
1733
|
+
z10.object({
|
|
1734
|
+
type: z10.literal("show_speech"),
|
|
1735
|
+
id: z10.string(),
|
|
1736
|
+
text: z10.string(),
|
|
1737
|
+
options: z10.object({
|
|
1738
|
+
duration: z10.number().optional(),
|
|
1739
|
+
style: z10.enum(["speech", "thought", "shout"]).optional()
|
|
1740
|
+
}).optional()
|
|
1741
|
+
}),
|
|
1742
|
+
z10.object({ type: z10.literal("clear_speech"), id: z10.string() }),
|
|
1743
|
+
z10.object({ type: z10.literal("set_visible"), id: z10.string(), visible: z10.boolean() }),
|
|
1744
|
+
z10.object({ type: z10.literal("set_facing"), id: z10.string(), facing: z10.enum(["left", "right"]) })
|
|
1745
|
+
]);
|
|
1746
|
+
var TavernSceneCommandRequestAction = z10.object({
|
|
1747
|
+
action: z10.literal("tavern_scene_command"),
|
|
1748
|
+
accessToken: z10.string().optional(),
|
|
1749
|
+
commands: z10.array(SceneCommandSchema),
|
|
1750
|
+
requestId: z10.string().optional()
|
|
1751
|
+
});
|
|
1752
|
+
var TavernSceneBroadcastAction = z10.object({
|
|
1753
|
+
action: z10.literal("tavern_scene_broadcast"),
|
|
1754
|
+
commands: z10.array(SceneCommandSchema),
|
|
1755
|
+
clientId: z10.string().optional()
|
|
1756
|
+
});
|
|
1680
1757
|
var SessionCreatedAction = shareableDocumentSchema.extend({
|
|
1681
1758
|
action: z10.literal("session.created"),
|
|
1682
1759
|
id: z10.string(),
|
|
@@ -1713,7 +1790,10 @@ var MessageDataToServer = z10.discriminatedUnion("action", [
|
|
|
1713
1790
|
VoiceSessionSendTranscriptAction,
|
|
1714
1791
|
VoiceSessionEndedAction,
|
|
1715
1792
|
CliCompletionRequestAction,
|
|
1716
|
-
CliToolRequestAction
|
|
1793
|
+
CliToolRequestAction,
|
|
1794
|
+
KeepCommandRequestAction,
|
|
1795
|
+
KeepCommandResponseAction,
|
|
1796
|
+
TavernSceneCommandRequestAction
|
|
1717
1797
|
]);
|
|
1718
1798
|
var MessageDataToClient = z10.discriminatedUnion("action", [
|
|
1719
1799
|
DataSubscriptionUpdateAction,
|
|
@@ -1743,7 +1823,10 @@ var MessageDataToClient = z10.discriminatedUnion("action", [
|
|
|
1743
1823
|
CliCompletionChunkAction,
|
|
1744
1824
|
CliCompletionDoneAction,
|
|
1745
1825
|
CliCompletionErrorAction,
|
|
1746
|
-
CliToolResponseAction
|
|
1826
|
+
CliToolResponseAction,
|
|
1827
|
+
KeepCommandAction,
|
|
1828
|
+
KeepCommandResultAction,
|
|
1829
|
+
TavernSceneBroadcastAction
|
|
1747
1830
|
]);
|
|
1748
1831
|
|
|
1749
1832
|
// ../../b4m-core/packages/common/dist/src/schemas/cliCompletions.js
|
|
@@ -11422,6 +11505,12 @@ export {
|
|
|
11422
11505
|
CliCompletionDoneAction,
|
|
11423
11506
|
CliCompletionErrorAction,
|
|
11424
11507
|
CliToolResponseAction,
|
|
11508
|
+
KeepCommandRequestAction,
|
|
11509
|
+
KeepCommandAction,
|
|
11510
|
+
KeepCommandResponseAction,
|
|
11511
|
+
KeepCommandResultAction,
|
|
11512
|
+
TavernSceneCommandRequestAction,
|
|
11513
|
+
TavernSceneBroadcastAction,
|
|
11425
11514
|
SessionCreatedAction,
|
|
11426
11515
|
MessageDataToServer,
|
|
11427
11516
|
MessageDataToClient,
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getSettingsMap,
|
|
8
8
|
getSettingsValue,
|
|
9
9
|
secureParameters
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-E7GZ7B3A.js";
|
|
11
11
|
import {
|
|
12
12
|
KnowledgeType,
|
|
13
13
|
SupportedFabFileMimeTypes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MYHJRMFR.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/fabFileService/create.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
getOpenWeatherKey,
|
|
5
5
|
getSerperKey,
|
|
6
6
|
getWolframAlphaKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MT4FJGUE.js";
|
|
8
8
|
import {
|
|
9
9
|
BFLImageService,
|
|
10
10
|
BaseStorage,
|
|
@@ -16,14 +16,14 @@ import {
|
|
|
16
16
|
OpenAIBackend,
|
|
17
17
|
OpenAIImageService,
|
|
18
18
|
XAIImageService
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-E7GZ7B3A.js";
|
|
20
20
|
import {
|
|
21
21
|
Logger
|
|
22
22
|
} from "./chunk-PFBYGCOW.js";
|
|
23
23
|
import {
|
|
24
24
|
ConfigStore,
|
|
25
25
|
logger
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-TZVHC4LV.js";
|
|
27
27
|
import {
|
|
28
28
|
ALERT_THRESHOLDS,
|
|
29
29
|
AiEvents,
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
getViewById,
|
|
85
85
|
resolveNavigationIntents,
|
|
86
86
|
sanitizeTelemetryError
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-MYHJRMFR.js";
|
|
88
88
|
|
|
89
89
|
// src/utils/fileSearch.ts
|
|
90
90
|
import * as fs from "fs";
|
|
@@ -16572,6 +16572,9 @@ var WebSocketLlmBackend = class {
|
|
|
16572
16572
|
};
|
|
16573
16573
|
|
|
16574
16574
|
// src/ws/WebSocketConnectionManager.ts
|
|
16575
|
+
import WsWebSocket from "ws";
|
|
16576
|
+
var useWsPolyfill = typeof globalThis.WebSocket === "undefined";
|
|
16577
|
+
var WS = useWsPolyfill ? WsWebSocket : globalThis.WebSocket;
|
|
16575
16578
|
var WebSocketConnectionManager = class {
|
|
16576
16579
|
constructor(wsUrl, getToken) {
|
|
16577
16580
|
this.ws = null;
|
|
@@ -16579,6 +16582,7 @@ var WebSocketConnectionManager = class {
|
|
|
16579
16582
|
this.reconnectAttempts = 0;
|
|
16580
16583
|
this.maxReconnectDelay = 3e4;
|
|
16581
16584
|
this.handlers = /* @__PURE__ */ new Map();
|
|
16585
|
+
this.actionHandlers = /* @__PURE__ */ new Map();
|
|
16582
16586
|
this.disconnectHandlers = /* @__PURE__ */ new Set();
|
|
16583
16587
|
this.reconnectTimer = null;
|
|
16584
16588
|
this.connected = false;
|
|
@@ -16601,7 +16605,13 @@ var WebSocketConnectionManager = class {
|
|
|
16601
16605
|
}
|
|
16602
16606
|
return new Promise((resolve3, reject) => {
|
|
16603
16607
|
logger.debug(`[WS] Connecting to ${this.wsUrl}...`);
|
|
16604
|
-
|
|
16608
|
+
if (useWsPolyfill) {
|
|
16609
|
+
this.ws = new WsWebSocket(this.wsUrl, {
|
|
16610
|
+
headers: { "Sec-WebSocket-Protocol": `access_token.${token}` }
|
|
16611
|
+
});
|
|
16612
|
+
} else {
|
|
16613
|
+
this.ws = new WS(this.wsUrl, [`access_token.${token}`]);
|
|
16614
|
+
}
|
|
16605
16615
|
this.ws.onopen = () => {
|
|
16606
16616
|
logger.debug("[WS] Connected");
|
|
16607
16617
|
this.connected = true;
|
|
@@ -16618,7 +16628,12 @@ var WebSocketConnectionManager = class {
|
|
|
16618
16628
|
if (requestId && this.handlers.has(requestId)) {
|
|
16619
16629
|
this.handlers.get(requestId)(message);
|
|
16620
16630
|
} else {
|
|
16621
|
-
|
|
16631
|
+
const action = message.action;
|
|
16632
|
+
if (action && this.actionHandlers.has(action)) {
|
|
16633
|
+
this.actionHandlers.get(action)(message);
|
|
16634
|
+
} else {
|
|
16635
|
+
logger.debug(`[WS] Unhandled message: ${action || "unknown"}`);
|
|
16636
|
+
}
|
|
16622
16637
|
}
|
|
16623
16638
|
} catch (err) {
|
|
16624
16639
|
logger.debug(`[WS] Failed to parse message: ${err}`);
|
|
@@ -16633,11 +16648,13 @@ var WebSocketConnectionManager = class {
|
|
|
16633
16648
|
}
|
|
16634
16649
|
};
|
|
16635
16650
|
this.ws.onerror = (err) => {
|
|
16636
|
-
|
|
16651
|
+
const underlying = err.error;
|
|
16652
|
+
const detail = underlying?.message || String(err);
|
|
16653
|
+
logger.debug(`[WS] Error: ${detail}`);
|
|
16637
16654
|
if (this.connecting) {
|
|
16638
16655
|
this.connecting = false;
|
|
16639
16656
|
this.connected = false;
|
|
16640
|
-
reject(new Error(
|
|
16657
|
+
reject(new Error(`WebSocket connection failed: ${detail}`));
|
|
16641
16658
|
}
|
|
16642
16659
|
};
|
|
16643
16660
|
});
|
|
@@ -16650,7 +16667,7 @@ var WebSocketConnectionManager = class {
|
|
|
16650
16667
|
* Send a JSON message over the WebSocket connection.
|
|
16651
16668
|
*/
|
|
16652
16669
|
send(data) {
|
|
16653
|
-
if (!this.ws || this.ws.readyState !==
|
|
16670
|
+
if (!this.ws || this.ws.readyState !== WS.OPEN) {
|
|
16654
16671
|
throw new Error("WebSocket is not connected");
|
|
16655
16672
|
}
|
|
16656
16673
|
const payload = JSON.stringify(data);
|
|
@@ -16673,6 +16690,19 @@ var WebSocketConnectionManager = class {
|
|
|
16673
16690
|
offRequest(requestId) {
|
|
16674
16691
|
this.handlers.delete(requestId);
|
|
16675
16692
|
}
|
|
16693
|
+
/**
|
|
16694
|
+
* Register a handler for messages matching a specific action type.
|
|
16695
|
+
* Used for server-pushed commands like keep_command.
|
|
16696
|
+
*/
|
|
16697
|
+
onAction(action, handler) {
|
|
16698
|
+
this.actionHandlers.set(action, handler);
|
|
16699
|
+
}
|
|
16700
|
+
/**
|
|
16701
|
+
* Remove a handler for a specific action type.
|
|
16702
|
+
*/
|
|
16703
|
+
offAction(action) {
|
|
16704
|
+
this.actionHandlers.delete(action);
|
|
16705
|
+
}
|
|
16676
16706
|
/**
|
|
16677
16707
|
* Register a handler that fires when the connection drops.
|
|
16678
16708
|
*/
|
|
@@ -16696,13 +16726,14 @@ var WebSocketConnectionManager = class {
|
|
|
16696
16726
|
this.ws = null;
|
|
16697
16727
|
}
|
|
16698
16728
|
this.handlers.clear();
|
|
16729
|
+
this.actionHandlers.clear();
|
|
16699
16730
|
this.disconnectHandlers.clear();
|
|
16700
16731
|
}
|
|
16701
16732
|
startHeartbeat() {
|
|
16702
16733
|
this.stopHeartbeat();
|
|
16703
16734
|
this.heartbeatInterval = setInterval(
|
|
16704
16735
|
() => {
|
|
16705
|
-
if (this.ws && this.ws.readyState ===
|
|
16736
|
+
if (this.ws && this.ws.readyState === WS.OPEN) {
|
|
16706
16737
|
this.ws.send(JSON.stringify({ action: "heartbeat" }));
|
|
16707
16738
|
logger.debug("[WS] Heartbeat sent");
|
|
16708
16739
|
}
|
|
@@ -36,20 +36,20 @@ import {
|
|
|
36
36
|
isReadOnlyTool,
|
|
37
37
|
loadContextFiles,
|
|
38
38
|
setWebSocketToolExecutor
|
|
39
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-V4ZPYJ7V.js";
|
|
40
40
|
import "../chunk-BDQBOLYG.js";
|
|
41
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-MT4FJGUE.js";
|
|
42
42
|
import "../chunk-GQGOWACU.js";
|
|
43
|
-
import "../chunk-
|
|
44
|
-
import "../chunk-
|
|
45
|
-
import "../chunk-
|
|
43
|
+
import "../chunk-IPX2RZCM.js";
|
|
44
|
+
import "../chunk-PFUH3PJW.js";
|
|
45
|
+
import "../chunk-E7GZ7B3A.js";
|
|
46
46
|
import "../chunk-PFBYGCOW.js";
|
|
47
47
|
import "../chunk-BPFEGDC7.js";
|
|
48
48
|
import {
|
|
49
49
|
ConfigStore,
|
|
50
50
|
logger
|
|
51
|
-
} from "../chunk-
|
|
52
|
-
import "../chunk-
|
|
51
|
+
} from "../chunk-TZVHC4LV.js";
|
|
52
|
+
import "../chunk-MYHJRMFR.js";
|
|
53
53
|
import {
|
|
54
54
|
DEFAULT_SANDBOX_CONFIG
|
|
55
55
|
} from "../chunk-4BIBE3J7.js";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFabFile,
|
|
4
4
|
createFabFileSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-PFUH3PJW.js";
|
|
6
|
+
import "./chunk-E7GZ7B3A.js";
|
|
7
7
|
import "./chunk-PFBYGCOW.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-MYHJRMFR.js";
|
|
9
9
|
export {
|
|
10
10
|
createFabFile,
|
|
11
11
|
createFabFileSchema
|
package/dist/index.js
CHANGED
|
@@ -46,23 +46,23 @@ import {
|
|
|
46
46
|
setWebSocketToolExecutor,
|
|
47
47
|
substituteArguments,
|
|
48
48
|
warmFileCache
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-V4ZPYJ7V.js";
|
|
50
50
|
import "./chunk-BDQBOLYG.js";
|
|
51
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-MT4FJGUE.js";
|
|
52
52
|
import "./chunk-GQGOWACU.js";
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import "./chunk-
|
|
55
|
-
import "./chunk-
|
|
53
|
+
import "./chunk-IPX2RZCM.js";
|
|
54
|
+
import "./chunk-PFUH3PJW.js";
|
|
55
|
+
import "./chunk-E7GZ7B3A.js";
|
|
56
56
|
import "./chunk-PFBYGCOW.js";
|
|
57
57
|
import "./chunk-BPFEGDC7.js";
|
|
58
58
|
import {
|
|
59
59
|
ConfigStore,
|
|
60
60
|
logger
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-TZVHC4LV.js";
|
|
62
62
|
import {
|
|
63
63
|
checkForUpdate,
|
|
64
64
|
package_default
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-72IBWES7.js";
|
|
66
66
|
import {
|
|
67
67
|
selectActiveBackgroundAgents,
|
|
68
68
|
useCliStore
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
import {
|
|
71
71
|
CREDIT_DEDUCT_TRANSACTION_TYPES,
|
|
72
72
|
ChatModels
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-MYHJRMFR.js";
|
|
74
74
|
import "./chunk-4BIBE3J7.js";
|
|
75
75
|
|
|
76
76
|
// src/index.tsx
|
|
@@ -2825,14 +2825,65 @@ function CliApp() {
|
|
|
2825
2825
|
tokenGetter,
|
|
2826
2826
|
wsCompletionUrl
|
|
2827
2827
|
});
|
|
2828
|
+
wsManager.onAction("keep_command", async (message) => {
|
|
2829
|
+
const { commandType, params, requestId, originConnectionId } = message;
|
|
2830
|
+
let result;
|
|
2831
|
+
let success = true;
|
|
2832
|
+
let error;
|
|
2833
|
+
try {
|
|
2834
|
+
switch (commandType) {
|
|
2835
|
+
case "read_file": {
|
|
2836
|
+
const filePath = params.path;
|
|
2837
|
+
if (!filePath) throw new Error("Missing required param: path");
|
|
2838
|
+
logger.info(`[Keep] Reading file: ${filePath}`);
|
|
2839
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
2840
|
+
result = { content, path: filePath };
|
|
2841
|
+
break;
|
|
2842
|
+
}
|
|
2843
|
+
case "list_directory": {
|
|
2844
|
+
const dirPath = params.path || ".";
|
|
2845
|
+
logger.info(`[Keep] Listing directory: ${dirPath}`);
|
|
2846
|
+
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
2847
|
+
result = entries.map((e) => ({ name: e.name, isDirectory: e.isDirectory() }));
|
|
2848
|
+
break;
|
|
2849
|
+
}
|
|
2850
|
+
default:
|
|
2851
|
+
throw new Error(`Unknown command type: ${commandType}`);
|
|
2852
|
+
}
|
|
2853
|
+
} catch (err) {
|
|
2854
|
+
success = false;
|
|
2855
|
+
error = err instanceof Error ? err.message : String(err);
|
|
2856
|
+
}
|
|
2857
|
+
logger.info(
|
|
2858
|
+
`[Keep] Sending response: success=${success}, originConnectionId=${originConnectionId?.slice(0, 12)}..., resultSize=${JSON.stringify(result)?.length ?? 0}`
|
|
2859
|
+
);
|
|
2860
|
+
try {
|
|
2861
|
+
wsManager.send({
|
|
2862
|
+
action: "keep_command_response",
|
|
2863
|
+
requestId,
|
|
2864
|
+
originConnectionId,
|
|
2865
|
+
success,
|
|
2866
|
+
result,
|
|
2867
|
+
error
|
|
2868
|
+
});
|
|
2869
|
+
logger.info("[Keep] Response sent successfully");
|
|
2870
|
+
} catch (sendErr) {
|
|
2871
|
+
logger.info(
|
|
2872
|
+
`[Keep] Failed to send response: ${sendErr instanceof Error ? sendErr.message : String(sendErr)}`
|
|
2873
|
+
);
|
|
2874
|
+
}
|
|
2875
|
+
});
|
|
2828
2876
|
logger.debug("\u{1F50C} Using WebSocket transport (bypasses CloudFront timeout)");
|
|
2829
2877
|
} else {
|
|
2830
2878
|
throw new Error("No websocketUrl or wsCompletionUrl in server config");
|
|
2831
2879
|
}
|
|
2832
2880
|
} catch (wsError) {
|
|
2833
|
-
|
|
2834
|
-
|
|
2881
|
+
console.error(
|
|
2882
|
+
`\u26A0\uFE0F WebSocket unavailable, using SSE fallback: ${wsError instanceof Error ? wsError.message : String(wsError)}`
|
|
2835
2883
|
);
|
|
2884
|
+
if (wsError instanceof Error && wsError.stack) {
|
|
2885
|
+
console.error(wsError.stack);
|
|
2886
|
+
}
|
|
2836
2887
|
wsManager = null;
|
|
2837
2888
|
setWebSocketToolExecutor(null);
|
|
2838
2889
|
llm = new ServerLlmBackend({
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
findMostSimilarMemento,
|
|
4
4
|
getRelevantMementos
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-MT4FJGUE.js";
|
|
6
|
+
import "./chunk-E7GZ7B3A.js";
|
|
7
7
|
import "./chunk-PFBYGCOW.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-MYHJRMFR.js";
|
|
9
9
|
export {
|
|
10
10
|
findMostSimilarMemento,
|
|
11
11
|
getRelevantMementos
|
|
@@ -149,6 +149,10 @@ import {
|
|
|
149
149
|
JIRA_MAX_ATTACHMENT_SIZE,
|
|
150
150
|
JiraApi,
|
|
151
151
|
JiraWebhookDeliveryStatus,
|
|
152
|
+
KeepCommandAction,
|
|
153
|
+
KeepCommandRequestAction,
|
|
154
|
+
KeepCommandResponseAction,
|
|
155
|
+
KeepCommandResultAction,
|
|
152
156
|
KnowledgeType,
|
|
153
157
|
LEGACY_IMAGE_MODEL_MAP,
|
|
154
158
|
LIVEOPS_TRIAGE_RESULT_VALIDATION_LIMITS,
|
|
@@ -334,6 +338,8 @@ import {
|
|
|
334
338
|
TagType,
|
|
335
339
|
TaskScheduleHandler,
|
|
336
340
|
TaskScheduleStatus,
|
|
341
|
+
TavernSceneBroadcastAction,
|
|
342
|
+
TavernSceneCommandRequestAction,
|
|
337
343
|
TextGenerationUsageTransaction,
|
|
338
344
|
TokensBySourceSchema,
|
|
339
345
|
ToolErrorCategorySchema,
|
|
@@ -512,7 +518,7 @@ import {
|
|
|
512
518
|
validateReactArtifactV2,
|
|
513
519
|
validateSvgArtifactV2,
|
|
514
520
|
wikiMarkupToAdf
|
|
515
|
-
} from "./chunk-
|
|
521
|
+
} from "./chunk-MYHJRMFR.js";
|
|
516
522
|
export {
|
|
517
523
|
ALERT_THRESHOLDS,
|
|
518
524
|
ALL_IMAGE_MODELS,
|
|
@@ -664,6 +670,10 @@ export {
|
|
|
664
670
|
JIRA_MAX_ATTACHMENT_SIZE,
|
|
665
671
|
JiraApi,
|
|
666
672
|
JiraWebhookDeliveryStatus,
|
|
673
|
+
KeepCommandAction,
|
|
674
|
+
KeepCommandRequestAction,
|
|
675
|
+
KeepCommandResponseAction,
|
|
676
|
+
KeepCommandResultAction,
|
|
667
677
|
KnowledgeType,
|
|
668
678
|
LEGACY_IMAGE_MODEL_MAP,
|
|
669
679
|
LIVEOPS_TRIAGE_RESULT_VALIDATION_LIMITS,
|
|
@@ -849,6 +859,8 @@ export {
|
|
|
849
859
|
TagType,
|
|
850
860
|
TaskScheduleHandler,
|
|
851
861
|
TaskScheduleStatus,
|
|
862
|
+
TavernSceneBroadcastAction,
|
|
863
|
+
TavernSceneCommandRequestAction,
|
|
852
864
|
TextGenerationUsageTransaction,
|
|
853
865
|
TokensBySourceSchema,
|
|
854
866
|
ToolErrorCategorySchema,
|
|
@@ -120,6 +120,7 @@ import {
|
|
|
120
120
|
isPrivateIP,
|
|
121
121
|
isPrivateOrInternalHostname,
|
|
122
122
|
isRetryableError,
|
|
123
|
+
isUserInitiatedAbort,
|
|
123
124
|
isValidEnumValue,
|
|
124
125
|
isZodError,
|
|
125
126
|
obfuscateApiKey,
|
|
@@ -140,7 +141,7 @@ import {
|
|
|
140
141
|
validateUrlForFetch,
|
|
141
142
|
warmUpSettingsCache,
|
|
142
143
|
withRetry
|
|
143
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-E7GZ7B3A.js";
|
|
144
145
|
import {
|
|
145
146
|
Logger,
|
|
146
147
|
NotificationDeduplicator,
|
|
@@ -153,7 +154,7 @@ import {
|
|
|
153
154
|
buildRateLimitLogEntry,
|
|
154
155
|
isNearLimit,
|
|
155
156
|
parseRateLimitHeaders
|
|
156
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-MYHJRMFR.js";
|
|
157
158
|
export {
|
|
158
159
|
AIVideoService,
|
|
159
160
|
AWSBackend,
|
|
@@ -279,6 +280,7 @@ export {
|
|
|
279
280
|
isPrivateIP,
|
|
280
281
|
isPrivateOrInternalHostname,
|
|
281
282
|
isRetryableError,
|
|
283
|
+
isUserInitiatedAbort,
|
|
282
284
|
isValidEnumValue,
|
|
283
285
|
isZodError,
|
|
284
286
|
notificationDeduplicator,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SubtractCreditsSchema,
|
|
4
4
|
subtractCredits
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-IPX2RZCM.js";
|
|
6
|
+
import "./chunk-E7GZ7B3A.js";
|
|
7
7
|
import "./chunk-PFBYGCOW.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-MYHJRMFR.js";
|
|
9
9
|
export {
|
|
10
10
|
SubtractCreditsSchema,
|
|
11
11
|
subtractCredits
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.43-docs-clawdbot-comparison-analysis.20555+07323408b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
"uuid": "^9.0.1",
|
|
106
106
|
"voyageai": "^0.0.4",
|
|
107
107
|
"web-tree-sitter": "0.25.10",
|
|
108
|
+
"ws": "^8.19.0",
|
|
108
109
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
109
110
|
"yargs": "^17.7.2",
|
|
110
111
|
"yauzl": "^3.1.3",
|
|
@@ -114,10 +115,10 @@
|
|
|
114
115
|
},
|
|
115
116
|
"devDependencies": {
|
|
116
117
|
"@bike4mind/agents": "0.1.0",
|
|
117
|
-
"@bike4mind/common": "2.62.
|
|
118
|
-
"@bike4mind/mcp": "1.33.
|
|
119
|
-
"@bike4mind/services": "2.58.
|
|
120
|
-
"@bike4mind/utils": "2.13.
|
|
118
|
+
"@bike4mind/common": "2.62.1-docs-clawdbot-comparison-analysis.20555+07323408b",
|
|
119
|
+
"@bike4mind/mcp": "1.33.5-docs-clawdbot-comparison-analysis.20555+07323408b",
|
|
120
|
+
"@bike4mind/services": "2.58.1-docs-clawdbot-comparison-analysis.20555+07323408b",
|
|
121
|
+
"@bike4mind/utils": "2.13.1-docs-clawdbot-comparison-analysis.20555+07323408b",
|
|
121
122
|
"@types/better-sqlite3": "^7.6.13",
|
|
122
123
|
"@types/diff": "^5.0.9",
|
|
123
124
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -125,6 +126,7 @@
|
|
|
125
126
|
"@types/picomatch": "^4.0.2",
|
|
126
127
|
"@types/react": "^19.2.7",
|
|
127
128
|
"@types/uuid": "^9.0.7",
|
|
129
|
+
"@types/ws": "^8.18.1",
|
|
128
130
|
"@types/yargs": "^17.0.32",
|
|
129
131
|
"ink-testing-library": "^4.0.0",
|
|
130
132
|
"tsup": "^8.5.1",
|
|
@@ -135,5 +137,5 @@
|
|
|
135
137
|
"optionalDependencies": {
|
|
136
138
|
"@vscode/ripgrep": "^1.17.0"
|
|
137
139
|
},
|
|
138
|
-
"gitHead": "
|
|
140
|
+
"gitHead": "07323408b6ba76c4841e86ae5429f3a96ed09ba7"
|
|
139
141
|
}
|