@bike4mind/cli 0.2.26-refactor-dry-credit-deduction.18613 → 0.2.26
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/bin/bike4mind-cli.mjs +1 -1
- package/dist/{artifactExtractor-VSHQYMJQ.js → artifactExtractor-75EEGBLM.js} +1 -1
- package/dist/{chunk-L42V7DCM.js → chunk-F3HPUK2I.js} +5 -3
- package/dist/{chunk-OHEBSPEW.js → chunk-HVF6LOKH.js} +2 -2
- package/dist/{chunk-I7ZMNVAN.js → chunk-MMAOFFE3.js} +224 -164
- package/dist/{chunk-3EQCYEKW.js → chunk-QD65IUNH.js} +2 -2
- package/dist/{chunk-Z7PQXS5G.js → chunk-UA7GLVP3.js} +2 -2
- package/dist/{create-UJLOXLQC.js → create-64AOQ36G.js} +3 -3
- package/dist/index.js +1167 -452
- package/dist/{llmMarkdownGenerator-PDEONFXK.js → llmMarkdownGenerator-CXBTJVHZ.js} +1 -1
- package/dist/{markdownGenerator-ODF3RWO6.js → markdownGenerator-P5HR3BBR.js} +1 -1
- package/dist/{mementoService-VYVPR6FI.js → mementoService-CGGNHR2A.js} +3 -3
- package/dist/{src-ZVULY6BY.js → src-VPA22RDR.js} +2 -2
- package/dist/{src-ET5ESBHL.js → src-ZA4LU3XB.js} +1 -1
- package/dist/{subtractCredits-3S7XTEHQ.js → subtractCredits-4CDISJCO.js} +3 -3
- package/package.json +6 -6
package/bin/bike4mind-cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CurationArtifactType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F3HPUK2I.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;
|
|
@@ -130,6 +130,7 @@ var ChatModels;
|
|
|
130
130
|
ChatModels2["CLAUDE_4_5_SONNET_BEDROCK"] = "us.anthropic.claude-sonnet-4-5-20250929-v1:0";
|
|
131
131
|
ChatModels2["CLAUDE_4_5_HAIKU_BEDROCK"] = "us.anthropic.claude-haiku-4-5-20251001-v1:0";
|
|
132
132
|
ChatModels2["CLAUDE_4_5_OPUS_BEDROCK"] = "global.anthropic.claude-opus-4-5-20251101-v1:0";
|
|
133
|
+
ChatModels2["CLAUDE_4_6_OPUS_BEDROCK"] = "global.anthropic.claude-opus-4-6-v1";
|
|
133
134
|
ChatModels2["CLAUDE_3_OPUS"] = "claude-3-opus-20240229";
|
|
134
135
|
ChatModels2["CLAUDE_3_5_HAIKU_ANTHROPIC"] = "claude-3-5-haiku-20241022";
|
|
135
136
|
ChatModels2["CLAUDE_3_5_SONNET_ANTHROPIC"] = "claude-3-5-sonnet-20241022";
|
|
@@ -140,6 +141,7 @@ var ChatModels;
|
|
|
140
141
|
ChatModels2["CLAUDE_4_5_SONNET"] = "claude-sonnet-4-5-20250929";
|
|
141
142
|
ChatModels2["CLAUDE_4_5_HAIKU"] = "claude-haiku-4-5-20251001";
|
|
142
143
|
ChatModels2["CLAUDE_4_5_OPUS"] = "claude-opus-4-5-20251101";
|
|
144
|
+
ChatModels2["CLAUDE_4_6_OPUS"] = "claude-opus-4-6";
|
|
143
145
|
ChatModels2["JURASSIC2_ULTRA"] = "ai21.j2-ultra-v1";
|
|
144
146
|
ChatModels2["JURASSIC2_MID"] = "ai21.j2-mid-v1";
|
|
145
147
|
ChatModels2["GEMINI_3_PRO_PREVIEW"] = "gemini-3-pro-preview";
|
|
@@ -4593,7 +4595,7 @@ var searchSchema = z26.object({
|
|
|
4593
4595
|
});
|
|
4594
4596
|
|
|
4595
4597
|
// ../../b4m-core/packages/common/dist/src/linkedin/api.js
|
|
4596
|
-
var API_VERSION = "
|
|
4598
|
+
var API_VERSION = "202504";
|
|
4597
4599
|
var LinkedInApi = class {
|
|
4598
4600
|
accessToken;
|
|
4599
4601
|
constructor(accessToken) {
|
|
@@ -4665,7 +4667,7 @@ var LinkedInApi = class {
|
|
|
4665
4667
|
return posts;
|
|
4666
4668
|
};
|
|
4667
4669
|
getSocialMetadata = async (postId) => {
|
|
4668
|
-
const statsResponse = await fetch(`https://api.linkedin.com/
|
|
4670
|
+
const statsResponse = await fetch(`https://api.linkedin.com/rest/socialMetadata/${encodeURIComponent(postId)}`, {
|
|
4669
4671
|
headers: {
|
|
4670
4672
|
Authorization: `Bearer ${this.accessToken}`,
|
|
4671
4673
|
"LinkedIn-Version": API_VERSION,
|
|
@@ -4680,7 +4682,7 @@ var LinkedInApi = class {
|
|
|
4680
4682
|
return stats;
|
|
4681
4683
|
};
|
|
4682
4684
|
batchGetSocialMetadata = async (postIds) => {
|
|
4683
|
-
const statsResponse = await fetch(`https://api.linkedin.com/
|
|
4685
|
+
const statsResponse = await fetch(`https://api.linkedin.com/rest/socialMetadata?ids=List(${postIds.map((id) => `${encodeURIComponent(id)}`).join(",")})`, {
|
|
4684
4686
|
headers: {
|
|
4685
4687
|
Authorization: `Bearer ${this.accessToken}`,
|
|
4686
4688
|
"LinkedIn-Version": API_VERSION,
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getSettingsByNames,
|
|
7
7
|
obfuscateApiKey,
|
|
8
8
|
secureParameters
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MMAOFFE3.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiKeyType,
|
|
12
12
|
MementoTier,
|
|
13
13
|
isSupportedEmbeddingModel
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-F3HPUK2I.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
dayjsConfig_default,
|
|
16
16
|
extractSnippetMeta,
|
|
17
17
|
settingsMap
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-F3HPUK2I.js";
|
|
19
19
|
import {
|
|
20
20
|
Logger
|
|
21
21
|
} from "./chunk-OCYRD7D6.js";
|
|
@@ -1999,7 +1999,8 @@ var TEMPERATURE_ONLY_MODELS = [
|
|
|
1999
1999
|
ChatModels.CLAUDE_4_5_SONNET,
|
|
2000
2000
|
ChatModels.CLAUDE_4_1_OPUS,
|
|
2001
2001
|
ChatModels.CLAUDE_4_5_HAIKU,
|
|
2002
|
-
ChatModels.CLAUDE_4_5_OPUS
|
|
2002
|
+
ChatModels.CLAUDE_4_5_OPUS,
|
|
2003
|
+
ChatModels.CLAUDE_4_6_OPUS
|
|
2003
2004
|
];
|
|
2004
2005
|
var INITIAL_TIMEOUT_MS = 3e4;
|
|
2005
2006
|
var DEFAULT_IDLE_TIMEOUT_MS = 9e4;
|
|
@@ -2332,7 +2333,29 @@ var AnthropicBackend = class {
|
|
|
2332
2333
|
supportsTools: true,
|
|
2333
2334
|
trainingCutoff: "2025-07-01",
|
|
2334
2335
|
releaseDate: "2025-11-25",
|
|
2335
|
-
description: "Claude 4.5 Opus with Anthropic.
|
|
2336
|
+
description: "Claude 4.5 Opus with Anthropic. Top-tier extended thinking model with excellent performance for complex reasoning, coding, and creative tasks."
|
|
2337
|
+
},
|
|
2338
|
+
{
|
|
2339
|
+
id: ChatModels.CLAUDE_4_6_OPUS,
|
|
2340
|
+
type: "text",
|
|
2341
|
+
name: "Claude 4.6 Opus",
|
|
2342
|
+
backend: ModelBackend.Anthropic,
|
|
2343
|
+
supportsImageVariation: false,
|
|
2344
|
+
contextWindow: 2e5,
|
|
2345
|
+
max_tokens: 64e3,
|
|
2346
|
+
can_stream: true,
|
|
2347
|
+
can_think: true,
|
|
2348
|
+
pricing: {
|
|
2349
|
+
2e5: { input: 5 / 1e6, output: 25 / 1e6 }
|
|
2350
|
+
// $5 / 1M Input tokens, $25 / 1M Output tokens
|
|
2351
|
+
},
|
|
2352
|
+
supportsVision: true,
|
|
2353
|
+
logoFile: "Anthropic_logo.png",
|
|
2354
|
+
rank: 0,
|
|
2355
|
+
supportsTools: true,
|
|
2356
|
+
trainingCutoff: "2025-08-01",
|
|
2357
|
+
releaseDate: "2026-02-06",
|
|
2358
|
+
description: "Anthropic's most powerful model. Claude 4.6 Opus delivers frontier intelligence with state-of-the-art extended thinking, coding, and agentic capabilities."
|
|
2336
2359
|
}
|
|
2337
2360
|
];
|
|
2338
2361
|
}
|
|
@@ -2463,7 +2486,7 @@ var AnthropicBackend = class {
|
|
|
2463
2486
|
try {
|
|
2464
2487
|
const func = [];
|
|
2465
2488
|
if (options.stream) {
|
|
2466
|
-
await new Promise(
|
|
2489
|
+
await new Promise((resolve, reject) => {
|
|
2467
2490
|
const enableRequestTimeout = options._internal?.enableRequestTimeout ?? false;
|
|
2468
2491
|
const requestAbortController = new AbortController();
|
|
2469
2492
|
let requestTimeout;
|
|
@@ -2483,176 +2506,178 @@ var AnthropicBackend = class {
|
|
|
2483
2506
|
const combinedSignal = enableRequestTimeout ? options.abortSignal ? AbortSignal.any([options.abortSignal, requestAbortController.signal]) : requestAbortController.signal : options.abortSignal;
|
|
2484
2507
|
let isIdleTimeout = false;
|
|
2485
2508
|
let idleTimeoutMsForError = 0;
|
|
2486
|
-
|
|
2487
|
-
const payloadForSize = { ...apiParams, stream: true };
|
|
2488
|
-
const payloadSizeBytes = Buffer.byteLength(JSON.stringify(payloadForSize), "utf8");
|
|
2489
|
-
const toolsSizeBytes = apiParams.tools ? Buffer.byteLength(JSON.stringify(apiParams.tools), "utf8") : 0;
|
|
2490
|
-
const messagesSizeBytes = apiParams.messages ? Buffer.byteLength(JSON.stringify(apiParams.messages), "utf8") : 0;
|
|
2491
|
-
this.logger.info("[AnthropicBackend] API request payload diagnostics", {
|
|
2492
|
-
model,
|
|
2493
|
-
totalPayloadSizeKB: Math.round(payloadSizeBytes / 1024),
|
|
2494
|
-
toolsSizeKB: Math.round(toolsSizeBytes / 1024),
|
|
2495
|
-
messagesSizeKB: Math.round(messagesSizeBytes / 1024),
|
|
2496
|
-
toolCount: apiParams.tools?.length || 0,
|
|
2497
|
-
messageCount: apiParams.messages?.length || 0,
|
|
2498
|
-
mcpToolCount: options.tools?.filter((t) => t._isMcpTool).length || 0,
|
|
2499
|
-
hasThinking: !!apiParams.thinking,
|
|
2500
|
-
thinkingBudget: apiParams.thinking?.budget_tokens
|
|
2501
|
-
});
|
|
2502
|
-
const stream = await this._api.messages.create({ ...apiParams, stream: true }, { signal: combinedSignal });
|
|
2503
|
-
if (requestTimeout)
|
|
2504
|
-
clearTimeout(requestTimeout);
|
|
2505
|
-
let isInThinkingBlock = false;
|
|
2506
|
-
const collectedContent = [];
|
|
2507
|
-
const enableIdleTimeout = options._internal?.enableIdleTimeout ?? false;
|
|
2508
|
-
const configuredIdleTimeoutMs = options._internal?.idleTimeoutMs;
|
|
2509
|
-
const idleTimeoutMs = this.isThinkingEnabled ? THINKING_IDLE_TIMEOUT_MS : configuredIdleTimeoutMs ?? DEFAULT_IDLE_TIMEOUT_MS;
|
|
2510
|
-
let idleTimer;
|
|
2511
|
-
let eventCount = 0;
|
|
2512
|
-
let lastEventType = "";
|
|
2513
|
-
const resetIdleTimer = () => {
|
|
2514
|
-
if (!enableIdleTimeout)
|
|
2515
|
-
return;
|
|
2516
|
-
if (idleTimer)
|
|
2517
|
-
clearTimeout(idleTimer);
|
|
2518
|
-
const timeoutMs = eventCount === 0 ? INITIAL_TIMEOUT_MS : idleTimeoutMs;
|
|
2519
|
-
idleTimer = setTimeout(() => {
|
|
2520
|
-
isIdleTimeout = true;
|
|
2521
|
-
idleTimeoutMsForError = timeoutMs;
|
|
2522
|
-
this.logger.error("[AnthropicBackend] Stream idle timeout - no events received", {
|
|
2523
|
-
model,
|
|
2524
|
-
eventCount,
|
|
2525
|
-
lastEventType,
|
|
2526
|
-
timeoutMs,
|
|
2527
|
-
toolCount: options.tools?.length || 0,
|
|
2528
|
-
mcpToolCount: options.tools?.filter((t) => t._isMcpTool).length || 0
|
|
2529
|
-
});
|
|
2530
|
-
this.emitIdleTimeoutMetric(model, options.tools?.length || 0, eventCount).catch(() => {
|
|
2531
|
-
});
|
|
2532
|
-
stream.controller?.abort?.();
|
|
2533
|
-
}, timeoutMs);
|
|
2534
|
-
};
|
|
2535
|
-
resetIdleTimer();
|
|
2509
|
+
(async () => {
|
|
2536
2510
|
try {
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2511
|
+
const payloadForSize = { ...apiParams, stream: true };
|
|
2512
|
+
const payloadSizeBytes = Buffer.byteLength(JSON.stringify(payloadForSize), "utf8");
|
|
2513
|
+
const toolsSizeBytes = apiParams.tools ? Buffer.byteLength(JSON.stringify(apiParams.tools), "utf8") : 0;
|
|
2514
|
+
const messagesSizeBytes = apiParams.messages ? Buffer.byteLength(JSON.stringify(apiParams.messages), "utf8") : 0;
|
|
2515
|
+
this.logger.info("[AnthropicBackend] API request payload diagnostics", {
|
|
2516
|
+
model,
|
|
2517
|
+
totalPayloadSizeKB: Math.round(payloadSizeBytes / 1024),
|
|
2518
|
+
toolsSizeKB: Math.round(toolsSizeBytes / 1024),
|
|
2519
|
+
messagesSizeKB: Math.round(messagesSizeBytes / 1024),
|
|
2520
|
+
toolCount: apiParams.tools?.length || 0,
|
|
2521
|
+
messageCount: apiParams.messages?.length || 0,
|
|
2522
|
+
mcpToolCount: options.tools?.filter((t) => t._isMcpTool).length || 0,
|
|
2523
|
+
hasThinking: !!apiParams.thinking,
|
|
2524
|
+
thinkingBudget: apiParams.thinking?.budget_tokens
|
|
2525
|
+
});
|
|
2526
|
+
const stream = await this._api.messages.create({ ...apiParams, stream: true }, { signal: combinedSignal });
|
|
2527
|
+
if (requestTimeout)
|
|
2528
|
+
clearTimeout(requestTimeout);
|
|
2529
|
+
let isInThinkingBlock = false;
|
|
2530
|
+
const collectedContent = [];
|
|
2531
|
+
const enableIdleTimeout = options._internal?.enableIdleTimeout ?? false;
|
|
2532
|
+
const configuredIdleTimeoutMs = options._internal?.idleTimeoutMs;
|
|
2533
|
+
const idleTimeoutMs = this.isThinkingEnabled ? THINKING_IDLE_TIMEOUT_MS : configuredIdleTimeoutMs ?? DEFAULT_IDLE_TIMEOUT_MS;
|
|
2534
|
+
let idleTimer;
|
|
2535
|
+
let eventCount = 0;
|
|
2536
|
+
let lastEventType = "";
|
|
2537
|
+
const resetIdleTimer = () => {
|
|
2538
|
+
if (!enableIdleTimeout)
|
|
2539
|
+
return;
|
|
2540
|
+
if (idleTimer)
|
|
2541
|
+
clearTimeout(idleTimer);
|
|
2542
|
+
const timeoutMs = eventCount === 0 ? INITIAL_TIMEOUT_MS : idleTimeoutMs;
|
|
2543
|
+
idleTimer = setTimeout(() => {
|
|
2544
|
+
isIdleTimeout = true;
|
|
2545
|
+
idleTimeoutMsForError = timeoutMs;
|
|
2546
|
+
this.logger.error("[AnthropicBackend] Stream idle timeout - no events received", {
|
|
2547
|
+
model,
|
|
2548
|
+
eventCount,
|
|
2549
|
+
lastEventType,
|
|
2550
|
+
timeoutMs,
|
|
2551
|
+
toolCount: options.tools?.length || 0,
|
|
2552
|
+
mcpToolCount: options.tools?.filter((t) => t._isMcpTool).length || 0
|
|
2553
|
+
});
|
|
2554
|
+
this.emitIdleTimeoutMetric(model, options.tools?.length || 0, eventCount).catch(() => {
|
|
2555
|
+
});
|
|
2556
|
+
stream.controller?.abort?.();
|
|
2557
|
+
}, timeoutMs);
|
|
2558
|
+
};
|
|
2559
|
+
resetIdleTimer();
|
|
2560
|
+
try {
|
|
2561
|
+
for await (const event of stream) {
|
|
2562
|
+
eventCount++;
|
|
2563
|
+
lastEventType = event.type;
|
|
2564
|
+
resetIdleTimer();
|
|
2565
|
+
const streamedText = [];
|
|
2566
|
+
if (event.type === "content_block_start") {
|
|
2567
|
+
if ("content_block" in event && event.content_block.type === "thinking") {
|
|
2568
|
+
isInThinkingBlock = true;
|
|
2569
|
+
collectedContent[event.index] = {
|
|
2570
|
+
type: "thinking",
|
|
2571
|
+
thinking: "",
|
|
2572
|
+
...event.content_block
|
|
2573
|
+
// Preserve all fields including signature
|
|
2574
|
+
};
|
|
2575
|
+
streamedText[event.index] = "<think>";
|
|
2576
|
+
await cb(streamedText, { toolsUsed });
|
|
2577
|
+
} else if ("content_block" in event && event.content_block.type === "tool_use") {
|
|
2578
|
+
const toolBlock = event.content_block;
|
|
2579
|
+
func[event.index] ||= {};
|
|
2580
|
+
func[event.index].name = toolBlock.name;
|
|
2581
|
+
func[event.index].id = toolBlock.id;
|
|
2582
|
+
func[event.index].parameters = "";
|
|
2583
|
+
collectedContent[event.index] = {
|
|
2584
|
+
type: "tool_use",
|
|
2585
|
+
id: toolBlock.id,
|
|
2586
|
+
name: toolBlock.name,
|
|
2587
|
+
input: {}
|
|
2588
|
+
};
|
|
2582
2589
|
}
|
|
2583
|
-
} else if (
|
|
2584
|
-
if (
|
|
2585
|
-
|
|
2590
|
+
} else if (event.type === "content_block_delta") {
|
|
2591
|
+
if ("delta" in event && event.delta.type === "thinking_delta") {
|
|
2592
|
+
const thinkingText = event.delta.thinking;
|
|
2593
|
+
if (collectedContent[event.index]) {
|
|
2594
|
+
collectedContent[event.index].thinking += thinkingText;
|
|
2595
|
+
}
|
|
2596
|
+
streamedText[event.index] = thinkingText;
|
|
2597
|
+
await cb(streamedText, { toolsUsed });
|
|
2598
|
+
} else if ("delta" in event && event.delta.type === "text_delta") {
|
|
2599
|
+
streamedText[event.index] = event.delta.text;
|
|
2600
|
+
await cb(streamedText, { toolsUsed });
|
|
2601
|
+
} else if ("delta" in event && event.delta.type === "input_json_delta") {
|
|
2602
|
+
if (func[event.index]) {
|
|
2603
|
+
func[event.index].parameters += event.delta.partial_json || "";
|
|
2604
|
+
}
|
|
2605
|
+
if (collectedContent[event.index] && collectedContent[event.index].type === "tool_use") {
|
|
2606
|
+
}
|
|
2607
|
+
} else if ("delta" in event && event.delta.type === "signature_delta") {
|
|
2608
|
+
if (collectedContent[event.index] && collectedContent[event.index].type === "thinking") {
|
|
2609
|
+
collectedContent[event.index].signature = event.delta.signature;
|
|
2610
|
+
}
|
|
2586
2611
|
}
|
|
2587
|
-
}
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2612
|
+
} else if (event.type === "content_block_stop") {
|
|
2613
|
+
if (isInThinkingBlock) {
|
|
2614
|
+
isInThinkingBlock = false;
|
|
2615
|
+
streamedText[event.index] = "</think>";
|
|
2616
|
+
await cb(streamedText, { toolsUsed });
|
|
2617
|
+
} else if (collectedContent[event.index] && collectedContent[event.index].type === "tool_use") {
|
|
2618
|
+
if (func[event.index] && func[event.index].parameters) {
|
|
2619
|
+
try {
|
|
2620
|
+
collectedContent[event.index].input = JSON.parse(func[event.index].parameters || "{}");
|
|
2621
|
+
} catch (e) {
|
|
2622
|
+
collectedContent[event.index].input = {};
|
|
2623
|
+
}
|
|
2599
2624
|
}
|
|
2600
2625
|
}
|
|
2626
|
+
} else if (this.isToolUseEvent(event)) {
|
|
2627
|
+
func[0] ||= {};
|
|
2628
|
+
const toolEvent = event;
|
|
2629
|
+
func[0].name = toolEvent.name;
|
|
2630
|
+
func[0].parameters = JSON.stringify(toolEvent.input);
|
|
2631
|
+
func[0].id = toolEvent.id;
|
|
2601
2632
|
}
|
|
2602
|
-
} else if (this.isToolUseEvent(event)) {
|
|
2603
|
-
func[0] ||= {};
|
|
2604
|
-
const toolEvent = event;
|
|
2605
|
-
func[0].name = toolEvent.name;
|
|
2606
|
-
func[0].parameters = JSON.stringify(toolEvent.input);
|
|
2607
|
-
func[0].id = toolEvent.id;
|
|
2608
2633
|
}
|
|
2634
|
+
} finally {
|
|
2635
|
+
if (idleTimer)
|
|
2636
|
+
clearTimeout(idleTimer);
|
|
2609
2637
|
}
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
const hasContent = collectedContent.some((c) => c?.type === "text" && c?.text?.trim());
|
|
2622
|
-
if (!hasContent && mcpToolCount > 0) {
|
|
2623
|
-
this.logger.warn(`\u26A0\uFE0F [AnthropicBackend] Model returned empty content with ${mcpToolCount} MCP tools available. Total tools: ${options.tools.length}. This may indicate tool overload or model confusion.`);
|
|
2638
|
+
if (this.isThinkingEnabled && collectedContent.length > 0) {
|
|
2639
|
+
this.lastAssistantContent = collectedContent.filter((c) => c != null);
|
|
2640
|
+
}
|
|
2641
|
+
const hasToolsToExecute = func.some((f) => f && f.name);
|
|
2642
|
+
if (!hasToolsToExecute) {
|
|
2643
|
+
if (options.tools && options.tools.length > 0) {
|
|
2644
|
+
const mcpToolCount = options.tools.filter((t) => t._isMcpTool).length;
|
|
2645
|
+
const hasContent = collectedContent.some((c) => c?.type === "text" && c?.text?.trim());
|
|
2646
|
+
if (!hasContent && mcpToolCount > 0) {
|
|
2647
|
+
this.logger.warn(`\u26A0\uFE0F [AnthropicBackend] Model returned empty content with ${mcpToolCount} MCP tools available. Total tools: ${options.tools.length}. This may indicate tool overload or model confusion.`);
|
|
2648
|
+
}
|
|
2624
2649
|
}
|
|
2650
|
+
await cb([], { toolsUsed });
|
|
2625
2651
|
}
|
|
2626
|
-
|
|
2627
|
-
}
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
})
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
}
|
|
2647
|
-
|
|
2652
|
+
resolve();
|
|
2653
|
+
} catch (error) {
|
|
2654
|
+
if (requestTimeout)
|
|
2655
|
+
clearTimeout(requestTimeout);
|
|
2656
|
+
const isAbortError = error instanceof Error && (error.message.includes("aborted") || error.message.includes("AbortError") || error.name === "AbortError");
|
|
2657
|
+
const isRequestTimeout = requestAbortController.signal.aborted;
|
|
2658
|
+
if (isAbortError) {
|
|
2659
|
+
if (isRequestTimeout) {
|
|
2660
|
+
this.logger.error("[AnthropicBackend] Request aborted due to timeout", {
|
|
2661
|
+
model,
|
|
2662
|
+
toolCount: options.tools?.length || 0
|
|
2663
|
+
});
|
|
2664
|
+
reject(new Error(`Anthropic API request timeout after ${REQUEST_TIMEOUT_MS}ms - no streaming response received`));
|
|
2665
|
+
} else if (isIdleTimeout) {
|
|
2666
|
+
this.logger.error("[AnthropicBackend] Stream aborted due to idle timeout", {
|
|
2667
|
+
model,
|
|
2668
|
+
toolCount: options.tools?.length || 0,
|
|
2669
|
+
idleTimeoutMs: idleTimeoutMsForError
|
|
2670
|
+
});
|
|
2671
|
+
reject(new Error(`Anthropic API stream timeout - no response received within ${idleTimeoutMsForError / 1e3} seconds. The model may be overloaded. Try simplifying your request or using fewer tools.`));
|
|
2672
|
+
} else {
|
|
2673
|
+
this.logger.debug("Anthropic request was aborted (likely client disconnect)");
|
|
2674
|
+
resolve();
|
|
2675
|
+
}
|
|
2648
2676
|
} else {
|
|
2649
|
-
|
|
2650
|
-
resolve();
|
|
2677
|
+
reject(error);
|
|
2651
2678
|
}
|
|
2652
|
-
} else {
|
|
2653
|
-
reject(error);
|
|
2654
2679
|
}
|
|
2655
|
-
}
|
|
2680
|
+
})();
|
|
2656
2681
|
});
|
|
2657
2682
|
if (func.some((f) => f && f.name)) {
|
|
2658
2683
|
const toolCallNames = func.filter((t) => t?.name).map((t) => t.name);
|
|
@@ -3421,7 +3446,8 @@ function isMessageStop(chunk) {
|
|
|
3421
3446
|
var TEMPERATURE_ONLY_MODELS2 = [
|
|
3422
3447
|
ChatModels.CLAUDE_4_5_SONNET_BEDROCK,
|
|
3423
3448
|
ChatModels.CLAUDE_4_5_HAIKU_BEDROCK,
|
|
3424
|
-
ChatModels.CLAUDE_4_5_OPUS_BEDROCK
|
|
3449
|
+
ChatModels.CLAUDE_4_5_OPUS_BEDROCK,
|
|
3450
|
+
ChatModels.CLAUDE_4_6_OPUS_BEDROCK
|
|
3425
3451
|
];
|
|
3426
3452
|
var AnthropicBedrockBackend = class extends BaseBedrockBackend {
|
|
3427
3453
|
// Track thinking block state
|
|
@@ -3668,7 +3694,29 @@ var AnthropicBedrockBackend = class extends BaseBedrockBackend {
|
|
|
3668
3694
|
supportsTools: true,
|
|
3669
3695
|
trainingCutoff: "2025-03-01",
|
|
3670
3696
|
releaseDate: "2025-11-25",
|
|
3671
|
-
description: "Claude 4.5 Opus via AWS Bedrock.
|
|
3697
|
+
description: "Claude 4.5 Opus via AWS Bedrock. Top-tier extended thinking model with excellent performance for complex reasoning, coding, and creative tasks."
|
|
3698
|
+
},
|
|
3699
|
+
{
|
|
3700
|
+
id: ChatModels.CLAUDE_4_6_OPUS_BEDROCK,
|
|
3701
|
+
type: "text",
|
|
3702
|
+
name: "Claude 4.6 Opus",
|
|
3703
|
+
backend: ModelBackend.Bedrock,
|
|
3704
|
+
supportsImageVariation: false,
|
|
3705
|
+
contextWindow: 2e5,
|
|
3706
|
+
max_tokens: 64e3,
|
|
3707
|
+
can_stream: true,
|
|
3708
|
+
can_think: true,
|
|
3709
|
+
pricing: {
|
|
3710
|
+
2e5: { input: 15 / 1e6, output: 75 / 1e6 }
|
|
3711
|
+
// $15 / 1M Input tokens, $75 / 1M Output tokens
|
|
3712
|
+
},
|
|
3713
|
+
supportsVision: true,
|
|
3714
|
+
logoFile: "Anthropic_logo.png",
|
|
3715
|
+
rank: 0,
|
|
3716
|
+
supportsTools: true,
|
|
3717
|
+
trainingCutoff: "2025-05-01",
|
|
3718
|
+
releaseDate: "2026-02-06",
|
|
3719
|
+
description: "Anthropic's most powerful model via AWS Bedrock. Claude 4.6 Opus delivers frontier intelligence with state-of-the-art extended thinking, coding, and agentic capabilities."
|
|
3672
3720
|
}
|
|
3673
3721
|
];
|
|
3674
3722
|
}
|
|
@@ -3703,7 +3751,8 @@ var AnthropicBedrockBackend = class extends BaseBedrockBackend {
|
|
|
3703
3751
|
}).filter((m) => m.content !== "" && (Array.isArray(m.content) ? m.content.length > 0 : true));
|
|
3704
3752
|
const systemMessage = messages.filter((m) => m.role === "system" && m.content).map((m) => typeof m.content === "string" ? m.content : JSON.stringify(m.content)).join("\n");
|
|
3705
3753
|
console.log(`[AnthropicBedrockBackend] Preparing payload for model: ${model}`);
|
|
3706
|
-
const
|
|
3754
|
+
const hasVendorPrefix = model.includes(":") || model.startsWith("global.") || model.startsWith("us.");
|
|
3755
|
+
const modelId = hasVendorPrefix ? model : `anthropic.${model}`;
|
|
3707
3756
|
console.log(`[AnthropicBedrockBackend] Using modelId: ${modelId}`);
|
|
3708
3757
|
const maxTokens = typeof options.maxTokens === "number" ? options.maxTokens : 4096;
|
|
3709
3758
|
console.log(`[AnthropicBedrockBackend] Using maxTokens: ${maxTokens}`);
|
|
@@ -7240,6 +7289,7 @@ function getLlmByModel(apiKeyTable, options) {
|
|
|
7240
7289
|
case ChatModels.CLAUDE_4_5_SONNET_BEDROCK:
|
|
7241
7290
|
case ChatModels.CLAUDE_4_5_HAIKU_BEDROCK:
|
|
7242
7291
|
case ChatModels.CLAUDE_4_5_OPUS_BEDROCK:
|
|
7292
|
+
case ChatModels.CLAUDE_4_6_OPUS_BEDROCK:
|
|
7243
7293
|
return new AnthropicBedrockBackend();
|
|
7244
7294
|
case ChatModels.LLAMA3_INSTRUCT_8B_V1:
|
|
7245
7295
|
case ChatModels.LLAMA3_INSTRUCT_70B_V1:
|
|
@@ -8178,6 +8228,16 @@ var SmartChunker = class {
|
|
|
8178
8228
|
case SupportedFabFileMimeTypes.GIF:
|
|
8179
8229
|
case SupportedFabFileMimeTypes.SVG:
|
|
8180
8230
|
return this.chunkImage(content);
|
|
8231
|
+
// Text-based application/* MIME types that should be chunked as plain text
|
|
8232
|
+
case SupportedFabFileMimeTypes.YAML:
|
|
8233
|
+
case SupportedFabFileMimeTypes.TOML:
|
|
8234
|
+
case SupportedFabFileMimeTypes.XML:
|
|
8235
|
+
case SupportedFabFileMimeTypes.JS:
|
|
8236
|
+
case SupportedFabFileMimeTypes.PHP:
|
|
8237
|
+
case SupportedFabFileMimeTypes.RUBY:
|
|
8238
|
+
case SupportedFabFileMimeTypes.SH:
|
|
8239
|
+
case SupportedFabFileMimeTypes.BASH:
|
|
8240
|
+
return this.chunkText(content.toString());
|
|
8181
8241
|
default:
|
|
8182
8242
|
if (mimeType && mimeType.startsWith("text/")) {
|
|
8183
8243
|
return this.chunkText(content.toString());
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getSettingsMap,
|
|
8
8
|
getSettingsValue,
|
|
9
9
|
secureParameters
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MMAOFFE3.js";
|
|
11
11
|
import {
|
|
12
12
|
KnowledgeType,
|
|
13
13
|
SupportedFabFileMimeTypes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-F3HPUK2I.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/fabFileService/create.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
4
|
secureParameters
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MMAOFFE3.js";
|
|
6
6
|
import {
|
|
7
7
|
CompletionApiUsageTransaction,
|
|
8
8
|
GenericCreditDeductTransaction,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
TextGenerationUsageTransaction,
|
|
13
13
|
TransferCreditTransaction,
|
|
14
14
|
VideoGenerationUsageTransaction
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-F3HPUK2I.js";
|
|
16
16
|
|
|
17
17
|
// ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
|
|
18
18
|
import { z } from "zod";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createFabFile,
|
|
4
4
|
createFabFileSchema
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-QD65IUNH.js";
|
|
6
|
+
import "./chunk-MMAOFFE3.js";
|
|
7
|
+
import "./chunk-F3HPUK2I.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
createFabFile,
|