@bike4mind/cli 0.2.29-feat-cli-websocket-streaming.18880 → 0.2.29-feat-quantum-optimize-architecture.18849
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-SNWW3EVH.js → artifactExtractor-SFCPAZAP.js} +1 -1
- package/dist/{chunk-QQL3OBKL.js → chunk-3334LDVW.js} +2 -2
- package/dist/{chunk-KPOK6V6E.js → chunk-4J5T2O4F.js} +17 -69
- package/dist/{chunk-BXCARBUQ.js → chunk-EBBAA665.js} +2 -2
- package/dist/{chunk-TY6Z2UV2.js → chunk-KQHTB3MR.js} +1 -1
- package/dist/{chunk-EC2VEDD2.js → chunk-QAGMWODZ.js} +2 -2
- package/dist/{create-QOJPAIOR.js → create-V2YLSLAI.js} +3 -3
- package/dist/index.js +101 -615
- package/dist/{llmMarkdownGenerator-JPDNDGE4.js → llmMarkdownGenerator-VWSE6HUO.js} +1 -1
- package/dist/{markdownGenerator-NHN4MNEA.js → markdownGenerator-SVMAEM74.js} +1 -1
- package/dist/{mementoService-EN7FZK7B.js → mementoService-AK7PUIEB.js} +3 -3
- package/dist/{src-JZN5O6F3.js → src-BVM4ALF6.js} +2 -2
- package/dist/{src-36AL3BJR.js → src-KXJNQBMF.js} +1 -13
- package/dist/{subtractCredits-FCBMFPIP.js → subtractCredits-XPS7VUGI.js} +3 -3
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CurationArtifactType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4J5T2O4F.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;
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getSettingsByNames,
|
|
7
7
|
obfuscateApiKey,
|
|
8
8
|
secureParameters
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-KQHTB3MR.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiKeyType,
|
|
12
12
|
MementoTier,
|
|
13
13
|
isSupportedEmbeddingModel
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4J5T2O4F.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
|
|
17
17
|
import { z } from "zod";
|
|
@@ -1012,29 +1012,6 @@ var VoiceSessionSendTranscriptAction = z10.object({
|
|
|
1012
1012
|
conversationItemId: z10.string(),
|
|
1013
1013
|
timestamp: z10.coerce.date().optional()
|
|
1014
1014
|
});
|
|
1015
|
-
var CliCompletionRequestAction = z10.object({
|
|
1016
|
-
action: z10.literal("cli_completion_request"),
|
|
1017
|
-
accessToken: z10.string(),
|
|
1018
|
-
requestId: z10.string().uuid(),
|
|
1019
|
-
model: z10.string(),
|
|
1020
|
-
messages: z10.array(z10.object({
|
|
1021
|
-
role: z10.enum(["user", "assistant", "system"]),
|
|
1022
|
-
content: z10.union([z10.string(), z10.array(z10.unknown())])
|
|
1023
|
-
})),
|
|
1024
|
-
options: z10.object({
|
|
1025
|
-
temperature: z10.number().optional(),
|
|
1026
|
-
maxTokens: z10.number().optional(),
|
|
1027
|
-
stream: z10.boolean().optional(),
|
|
1028
|
-
tools: z10.array(z10.unknown()).optional()
|
|
1029
|
-
}).optional()
|
|
1030
|
-
});
|
|
1031
|
-
var CliToolRequestAction = z10.object({
|
|
1032
|
-
action: z10.literal("cli_tool_request"),
|
|
1033
|
-
accessToken: z10.string(),
|
|
1034
|
-
requestId: z10.string().uuid(),
|
|
1035
|
-
toolName: z10.string(),
|
|
1036
|
-
input: z10.record(z10.unknown())
|
|
1037
|
-
});
|
|
1038
1015
|
var VoiceSessionEndedAction = z10.object({
|
|
1039
1016
|
action: z10.literal("voice_session_ended"),
|
|
1040
1017
|
userId: z10.string(),
|
|
@@ -1281,36 +1258,6 @@ var ResearchModeStreamAction = z10.object({
|
|
|
1281
1258
|
completionInfo: z10.any().optional()
|
|
1282
1259
|
}).optional()
|
|
1283
1260
|
});
|
|
1284
|
-
var CliCompletionChunkAction = z10.object({
|
|
1285
|
-
action: z10.literal("cli_completion_chunk"),
|
|
1286
|
-
requestId: z10.string(),
|
|
1287
|
-
chunk: z10.object({
|
|
1288
|
-
type: z10.enum(["content", "tool_use"]),
|
|
1289
|
-
text: z10.string(),
|
|
1290
|
-
tools: z10.array(z10.unknown()).optional(),
|
|
1291
|
-
usage: z10.object({
|
|
1292
|
-
inputTokens: z10.number().optional(),
|
|
1293
|
-
outputTokens: z10.number().optional()
|
|
1294
|
-
}).optional(),
|
|
1295
|
-
thinking: z10.array(z10.unknown()).optional()
|
|
1296
|
-
})
|
|
1297
|
-
});
|
|
1298
|
-
var CliCompletionDoneAction = z10.object({
|
|
1299
|
-
action: z10.literal("cli_completion_done"),
|
|
1300
|
-
requestId: z10.string()
|
|
1301
|
-
});
|
|
1302
|
-
var CliCompletionErrorAction = z10.object({
|
|
1303
|
-
action: z10.literal("cli_completion_error"),
|
|
1304
|
-
requestId: z10.string(),
|
|
1305
|
-
error: z10.string()
|
|
1306
|
-
});
|
|
1307
|
-
var CliToolResponseAction = z10.object({
|
|
1308
|
-
action: z10.literal("cli_tool_response"),
|
|
1309
|
-
requestId: z10.string(),
|
|
1310
|
-
success: z10.boolean(),
|
|
1311
|
-
content: z10.unknown().optional(),
|
|
1312
|
-
error: z10.string().optional()
|
|
1313
|
-
});
|
|
1314
1261
|
var SessionCreatedAction = shareableDocumentSchema.extend({
|
|
1315
1262
|
action: z10.literal("session.created"),
|
|
1316
1263
|
id: z10.string(),
|
|
@@ -1345,9 +1292,7 @@ var MessageDataToServer = z10.discriminatedUnion("action", [
|
|
|
1345
1292
|
DataUnsubscribeRequestAction,
|
|
1346
1293
|
HeartbeatAction,
|
|
1347
1294
|
VoiceSessionSendTranscriptAction,
|
|
1348
|
-
VoiceSessionEndedAction
|
|
1349
|
-
CliCompletionRequestAction,
|
|
1350
|
-
CliToolRequestAction
|
|
1295
|
+
VoiceSessionEndedAction
|
|
1351
1296
|
]);
|
|
1352
1297
|
var MessageDataToClient = z10.discriminatedUnion("action", [
|
|
1353
1298
|
DataSubscriptionUpdateAction,
|
|
@@ -1369,11 +1314,7 @@ var MessageDataToClient = z10.discriminatedUnion("action", [
|
|
|
1369
1314
|
SpiderProgressUpdateAction,
|
|
1370
1315
|
SpiderCompleteAction,
|
|
1371
1316
|
SpiderErrorAction,
|
|
1372
|
-
SessionCreatedAction
|
|
1373
|
-
CliCompletionChunkAction,
|
|
1374
|
-
CliCompletionDoneAction,
|
|
1375
|
-
CliCompletionErrorAction,
|
|
1376
|
-
CliToolResponseAction
|
|
1317
|
+
SessionCreatedAction
|
|
1377
1318
|
]);
|
|
1378
1319
|
|
|
1379
1320
|
// ../../b4m-core/packages/common/dist/src/schemas/cliCompletions.js
|
|
@@ -2322,7 +2263,9 @@ var SettingKeySchema = z21.enum([
|
|
|
2322
2263
|
// LIVEOPS TRIAGE AUTOMATION SETTINGS
|
|
2323
2264
|
"liveopsTriageConfig",
|
|
2324
2265
|
// HELP CENTER SETTINGS
|
|
2325
|
-
"EnableHelpChat"
|
|
2266
|
+
"EnableHelpChat",
|
|
2267
|
+
// QUANTUM CANVASSER SETTINGS
|
|
2268
|
+
"EnableQuantumCanvasser"
|
|
2326
2269
|
]);
|
|
2327
2270
|
var CategoryOrder = [
|
|
2328
2271
|
"AI",
|
|
@@ -2742,7 +2685,8 @@ var API_SERVICE_GROUPS = {
|
|
|
2742
2685
|
{ key: "EnableMcpToolFiltering", order: 14 },
|
|
2743
2686
|
{ key: "McpToolFilteringMaxTools", order: 15 },
|
|
2744
2687
|
{ key: "EnableParallelToolExecution", order: 16 },
|
|
2745
|
-
{ key: "EnableHelpChat", order: 17 }
|
|
2688
|
+
{ key: "EnableHelpChat", order: 17 },
|
|
2689
|
+
{ key: "EnableQuantumCanvasser", order: 18 }
|
|
2746
2690
|
]
|
|
2747
2691
|
},
|
|
2748
2692
|
NOTEBOOK: {
|
|
@@ -3923,6 +3867,16 @@ var settingsMap = {
|
|
|
3923
3867
|
category: "Experimental",
|
|
3924
3868
|
group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
|
|
3925
3869
|
order: 17
|
|
3870
|
+
}),
|
|
3871
|
+
// Quantum Canvasser Settings
|
|
3872
|
+
EnableQuantumCanvasser: makeBooleanSetting({
|
|
3873
|
+
key: "EnableQuantumCanvasser",
|
|
3874
|
+
name: "Enable Quantum Canvasser",
|
|
3875
|
+
defaultValue: false,
|
|
3876
|
+
description: "Enable the Quantum Canvasser module for job-shop scheduling optimization using classical and quantum-inspired solvers.",
|
|
3877
|
+
category: "Experimental",
|
|
3878
|
+
group: API_SERVICE_GROUPS.EXPERIMENTAL.id,
|
|
3879
|
+
order: 18
|
|
3926
3880
|
})
|
|
3927
3881
|
// Add more settings as needed
|
|
3928
3882
|
};
|
|
@@ -7985,8 +7939,6 @@ export {
|
|
|
7985
7939
|
DataUnsubscribeRequestAction,
|
|
7986
7940
|
HeartbeatAction,
|
|
7987
7941
|
VoiceSessionSendTranscriptAction,
|
|
7988
|
-
CliCompletionRequestAction,
|
|
7989
|
-
CliToolRequestAction,
|
|
7990
7942
|
VoiceSessionEndedAction,
|
|
7991
7943
|
DataSubscriptionUpdateAction,
|
|
7992
7944
|
LLMStatusUpdateAction,
|
|
@@ -8007,10 +7959,6 @@ export {
|
|
|
8007
7959
|
UpdateResearchTaskStatusAction,
|
|
8008
7960
|
ImportHistoryJobProgressUpdateAction,
|
|
8009
7961
|
ResearchModeStreamAction,
|
|
8010
|
-
CliCompletionChunkAction,
|
|
8011
|
-
CliCompletionDoneAction,
|
|
8012
|
-
CliCompletionErrorAction,
|
|
8013
|
-
CliToolResponseAction,
|
|
8014
7962
|
SessionCreatedAction,
|
|
8015
7963
|
MessageDataToServer,
|
|
8016
7964
|
MessageDataToClient,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BadRequestError,
|
|
4
4
|
secureParameters
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KQHTB3MR.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-4J5T2O4F.js";
|
|
16
16
|
|
|
17
17
|
// ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
|
|
18
18
|
import { z } from "zod";
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
getSettingsMap,
|
|
8
8
|
getSettingsValue,
|
|
9
9
|
secureParameters
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KQHTB3MR.js";
|
|
11
11
|
import {
|
|
12
12
|
KnowledgeType,
|
|
13
13
|
SupportedFabFileMimeTypes
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-4J5T2O4F.js";
|
|
15
15
|
|
|
16
16
|
// ../../b4m-core/packages/services/dist/src/fabFileService/create.js
|
|
17
17
|
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-QAGMWODZ.js";
|
|
6
|
+
import "./chunk-KQHTB3MR.js";
|
|
7
|
+
import "./chunk-4J5T2O4F.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
createFabFile,
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getEffectiveApiKey,
|
|
6
6
|
getOpenWeatherKey,
|
|
7
7
|
getSerperKey
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3334LDVW.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigStore,
|
|
11
11
|
logger
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
selectActiveBackgroundAgents,
|
|
15
15
|
useCliStore
|
|
16
16
|
} from "./chunk-TVW4ZESU.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-EBBAA665.js";
|
|
18
|
+
import "./chunk-QAGMWODZ.js";
|
|
19
19
|
import {
|
|
20
20
|
BFLImageService,
|
|
21
21
|
BaseStorage,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
OpenAIBackend,
|
|
28
28
|
OpenAIImageService,
|
|
29
29
|
XAIImageService
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-KQHTB3MR.js";
|
|
31
31
|
import {
|
|
32
32
|
AiEvents,
|
|
33
33
|
ApiKeyEvents,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
XAI_IMAGE_MODELS,
|
|
84
84
|
b4mLLMTools,
|
|
85
85
|
getMcpProviderMetadata
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-4J5T2O4F.js";
|
|
87
87
|
import {
|
|
88
88
|
Logger
|
|
89
89
|
} from "./chunk-OCYRD7D6.js";
|
|
@@ -93,7 +93,7 @@ import React21, { useState as useState9, useEffect as useEffect6, useCallback as
|
|
|
93
93
|
import { render, Box as Box20, Text as Text20, useApp, useInput as useInput9 } from "ink";
|
|
94
94
|
import { execSync } from "child_process";
|
|
95
95
|
import { randomBytes as randomBytes5 } from "crypto";
|
|
96
|
-
import { v4 as
|
|
96
|
+
import { v4 as uuidv411 } from "uuid";
|
|
97
97
|
|
|
98
98
|
// src/components/App.tsx
|
|
99
99
|
import React15, { useState as useState5, useEffect as useEffect4 } from "react";
|
|
@@ -3587,50 +3587,6 @@ function isReadOnlyTool(toolName, customCategories) {
|
|
|
3587
3587
|
return getToolCategory(toolName, customCategories) !== "prompt_always";
|
|
3588
3588
|
}
|
|
3589
3589
|
|
|
3590
|
-
// src/core/skillsPrompt.ts
|
|
3591
|
-
function getSkillDisplayName(cmd) {
|
|
3592
|
-
return cmd.displayName || cmd.name;
|
|
3593
|
-
}
|
|
3594
|
-
function formatSkillEntry(cmd) {
|
|
3595
|
-
const displayName = getSkillDisplayName(cmd);
|
|
3596
|
-
const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
|
|
3597
|
-
const nameDisplay = cmd.displayName && cmd.displayName !== cmd.name ? `**${displayName}** (\`${cmd.name}\`)` : `**${cmd.name}**`;
|
|
3598
|
-
return `- ${nameDisplay}${argHint}: ${cmd.description}
|
|
3599
|
-
`;
|
|
3600
|
-
}
|
|
3601
|
-
function formatSkillGroup(heading, commands) {
|
|
3602
|
-
if (commands.length === 0) {
|
|
3603
|
-
return "";
|
|
3604
|
-
}
|
|
3605
|
-
return `
|
|
3606
|
-
### ${heading}
|
|
3607
|
-
${commands.map(formatSkillEntry).join("")}`;
|
|
3608
|
-
}
|
|
3609
|
-
function filterAIVisibleSkills(commands) {
|
|
3610
|
-
return commands.filter((cmd) => !cmd.disableModelInvocation);
|
|
3611
|
-
}
|
|
3612
|
-
function filterSkillsByAllowedList(commands, allowedSkills) {
|
|
3613
|
-
if (!allowedSkills || allowedSkills.length === 0) {
|
|
3614
|
-
return commands;
|
|
3615
|
-
}
|
|
3616
|
-
return commands.filter((cmd) => allowedSkills.includes(cmd.name));
|
|
3617
|
-
}
|
|
3618
|
-
function buildSkillsPromptSection(commands, allowedSkills) {
|
|
3619
|
-
const filteredByAllowed = filterSkillsByAllowedList(commands, allowedSkills);
|
|
3620
|
-
const visibleCommands = filterAIVisibleSkills(filteredByAllowed);
|
|
3621
|
-
if (visibleCommands.length === 0) {
|
|
3622
|
-
return "";
|
|
3623
|
-
}
|
|
3624
|
-
const projectSkills = visibleCommands.filter((c) => c.source === "project");
|
|
3625
|
-
const globalSkills = visibleCommands.filter((c) => c.source === "global");
|
|
3626
|
-
return `
|
|
3627
|
-
|
|
3628
|
-
## Available Skills
|
|
3629
|
-
|
|
3630
|
-
Use the \`skill\` tool to invoke these. Example: skill({ skill: "commit" })
|
|
3631
|
-
` + formatSkillGroup("Project Skills", projectSkills) + formatSkillGroup("Global Skills", globalSkills);
|
|
3632
|
-
}
|
|
3633
|
-
|
|
3634
3590
|
// src/core/prompts.ts
|
|
3635
3591
|
var TOOL_GREP_SEARCH = "grep_search";
|
|
3636
3592
|
var TOOL_GLOB_FILES = "glob_files";
|
|
@@ -3641,38 +3597,7 @@ var TOOL_BASH_EXECUTE = "bash_execute";
|
|
|
3641
3597
|
var TOOL_SUBAGENT_DELEGATE = "subagent_delegate";
|
|
3642
3598
|
var TOOL_WRITE_TODOS = "write_todos";
|
|
3643
3599
|
var EXPLORE_SUBAGENT_TYPE = "explore";
|
|
3644
|
-
function buildCoreSystemPrompt(contextSection
|
|
3645
|
-
let projectContextSection = "";
|
|
3646
|
-
let agentDirectoryContext = "";
|
|
3647
|
-
let skillsSection = "";
|
|
3648
|
-
if (typeof contextSection === "string") {
|
|
3649
|
-
projectContextSection = contextSection;
|
|
3650
|
-
if (config) {
|
|
3651
|
-
if (config.enableSkillTool !== false && config.customCommands && config.customCommands.length > 0) {
|
|
3652
|
-
skillsSection = buildSkillsPromptSection(config.customCommands);
|
|
3653
|
-
}
|
|
3654
|
-
if (config.agentStore) {
|
|
3655
|
-
agentDirectoryContext = config.agentStore.getDirectoryContext();
|
|
3656
|
-
}
|
|
3657
|
-
}
|
|
3658
|
-
} else if (contextSection && typeof contextSection === "object") {
|
|
3659
|
-
config = contextSection;
|
|
3660
|
-
if (config.contextContent) {
|
|
3661
|
-
projectContextSection = `
|
|
3662
|
-
|
|
3663
|
-
## Project Context
|
|
3664
|
-
|
|
3665
|
-
Follow these project-specific instructions:
|
|
3666
|
-
|
|
3667
|
-
${config.contextContent}`;
|
|
3668
|
-
}
|
|
3669
|
-
if (config.enableSkillTool !== false && config.customCommands && config.customCommands.length > 0) {
|
|
3670
|
-
skillsSection = buildSkillsPromptSection(config.customCommands);
|
|
3671
|
-
}
|
|
3672
|
-
if (config.agentStore) {
|
|
3673
|
-
agentDirectoryContext = config.agentStore.getDirectoryContext();
|
|
3674
|
-
}
|
|
3675
|
-
}
|
|
3600
|
+
function buildCoreSystemPrompt(contextSection = "") {
|
|
3676
3601
|
return `You are an autonomous AI assistant with access to tools. Your job is to help users by taking action and solving problems proactively.
|
|
3677
3602
|
|
|
3678
3603
|
CORE BEHAVIOR:
|
|
@@ -3702,8 +3627,12 @@ When requested to perform tasks like fixing bugs, adding features, refactoring,
|
|
|
3702
3627
|
|
|
3703
3628
|
SUBAGENT DELEGATION:
|
|
3704
3629
|
- You have access to specialized subagents via the ${TOOL_SUBAGENT_DELEGATE} tool
|
|
3705
|
-
-
|
|
3630
|
+
- Use subagents for focused exploration, planning, or review tasks:
|
|
3631
|
+
* explore: Fast read-only codebase search (e.g., "find all auth files", "locate API endpoints")
|
|
3632
|
+
* plan: Break down complex tasks into actionable steps
|
|
3633
|
+
* review: Analyze code quality and identify issues
|
|
3706
3634
|
- Subagents keep the main conversation clean and run faster with optimized models
|
|
3635
|
+
- Delegate when you need to search extensively or analyze code structure
|
|
3707
3636
|
|
|
3708
3637
|
CODE SEARCH BEST PRACTICES:
|
|
3709
3638
|
When searching code, follow this hierarchy for speed and efficiency:
|
|
@@ -3760,7 +3689,7 @@ EXAMPLES:
|
|
|
3760
3689
|
- "what packages installed?" \u2192 ${TOOL_GLOB_FILES} "**/package.json" \u2192 ${TOOL_FILE_READ}
|
|
3761
3690
|
- "find all components using React hooks" \u2192 ${TOOL_SUBAGENT_DELEGATE}(task="find all components using React hooks", type="explore")
|
|
3762
3691
|
|
|
3763
|
-
Remember: Use context from previous messages to understand follow-up questions.${
|
|
3692
|
+
Remember: Use context from previous messages to understand follow-up questions.${contextSection}`;
|
|
3764
3693
|
}
|
|
3765
3694
|
|
|
3766
3695
|
// ../../b4m-core/packages/services/dist/src/referService/generateCodes.js
|
|
@@ -11509,10 +11438,6 @@ var ServerToolExecutor = class {
|
|
|
11509
11438
|
};
|
|
11510
11439
|
|
|
11511
11440
|
// src/llm/ToolRouter.ts
|
|
11512
|
-
var wsToolExecutor = null;
|
|
11513
|
-
function setWebSocketToolExecutor(executor) {
|
|
11514
|
-
wsToolExecutor = executor;
|
|
11515
|
-
}
|
|
11516
11441
|
var SERVER_TOOLS = ["weather_info", "web_search", "web_fetch"];
|
|
11517
11442
|
var LOCAL_TOOLS = [
|
|
11518
11443
|
"file_read",
|
|
@@ -11535,15 +11460,7 @@ function isLocalTool(toolName) {
|
|
|
11535
11460
|
}
|
|
11536
11461
|
async function executeTool(toolName, input, apiClient, localToolFn) {
|
|
11537
11462
|
if (isServerTool(toolName)) {
|
|
11538
|
-
|
|
11539
|
-
logger.debug(`[ToolRouter] Routing ${toolName} to server via WebSocket`);
|
|
11540
|
-
const result = await wsToolExecutor.execute(toolName, input);
|
|
11541
|
-
if (!result.success) {
|
|
11542
|
-
return `Error executing ${toolName}: ${result.error || "Tool execution failed"}`;
|
|
11543
|
-
}
|
|
11544
|
-
return typeof result.content === "string" ? result.content : JSON.stringify(result.content ?? "");
|
|
11545
|
-
}
|
|
11546
|
-
logger.debug(`[ToolRouter] Routing ${toolName} to server via HTTP`);
|
|
11463
|
+
logger.debug(`[ToolRouter] Routing ${toolName} to server`);
|
|
11547
11464
|
const executor = new ServerToolExecutor(apiClient);
|
|
11548
11465
|
return await executor.executeTool(toolName, input);
|
|
11549
11466
|
} else if (isLocalTool(toolName)) {
|
|
@@ -13473,173 +13390,6 @@ var ServerLlmBackend = class {
|
|
|
13473
13390
|
}
|
|
13474
13391
|
};
|
|
13475
13392
|
|
|
13476
|
-
// src/llm/WebSocketLlmBackend.ts
|
|
13477
|
-
import { v4 as uuidv411 } from "uuid";
|
|
13478
|
-
function stripThinkingBlocks2(text) {
|
|
13479
|
-
return text.replace(/<think>[\s\S]*?<\/think>/g, "").trim();
|
|
13480
|
-
}
|
|
13481
|
-
var WebSocketLlmBackend = class {
|
|
13482
|
-
constructor(options) {
|
|
13483
|
-
this.wsManager = options.wsManager;
|
|
13484
|
-
this.apiClient = options.apiClient;
|
|
13485
|
-
this.currentModel = options.model;
|
|
13486
|
-
this.tokenGetter = options.tokenGetter;
|
|
13487
|
-
this.wsCompletionUrl = options.wsCompletionUrl;
|
|
13488
|
-
}
|
|
13489
|
-
/**
|
|
13490
|
-
* Send completion request via HTTP POST, receive streaming response via WebSocket.
|
|
13491
|
-
* Collects all streamed chunks, then calls callback once at completion
|
|
13492
|
-
* with the full accumulated content.
|
|
13493
|
-
*/
|
|
13494
|
-
async complete(model, messages, options, callback) {
|
|
13495
|
-
logger.debug(`[WebSocketLlmBackend] Starting complete() with model: ${model}`);
|
|
13496
|
-
if (options.abortSignal?.aborted) {
|
|
13497
|
-
logger.debug("[WebSocketLlmBackend] Request aborted before start");
|
|
13498
|
-
return;
|
|
13499
|
-
}
|
|
13500
|
-
if (!this.wsManager.isConnected) {
|
|
13501
|
-
throw new Error("WebSocket is not connected");
|
|
13502
|
-
}
|
|
13503
|
-
const requestId = uuidv411();
|
|
13504
|
-
return new Promise((resolve3, reject) => {
|
|
13505
|
-
const isVerbose = process.env.B4M_VERBOSE === "1";
|
|
13506
|
-
const isUltraVerbose = process.env.B4M_DEBUG_STREAM === "1";
|
|
13507
|
-
const streamLogger = new StreamLogger(logger, "WebSocketLlmBackend", isVerbose, isUltraVerbose);
|
|
13508
|
-
streamLogger.streamStart();
|
|
13509
|
-
let eventCount = 0;
|
|
13510
|
-
let accumulatedText = "";
|
|
13511
|
-
let lastUsageInfo = {};
|
|
13512
|
-
let toolsUsed = [];
|
|
13513
|
-
let thinkingBlocks = [];
|
|
13514
|
-
let settled = false;
|
|
13515
|
-
const settle = (action) => {
|
|
13516
|
-
if (settled) return;
|
|
13517
|
-
settled = true;
|
|
13518
|
-
this.wsManager.offRequest(requestId);
|
|
13519
|
-
this.wsManager.offDisconnect(onDisconnect);
|
|
13520
|
-
action();
|
|
13521
|
-
};
|
|
13522
|
-
const settleResolve = () => settle(() => resolve3());
|
|
13523
|
-
const settleReject = (err) => settle(() => reject(err));
|
|
13524
|
-
const onDisconnect = () => {
|
|
13525
|
-
logger.debug("[WebSocketLlmBackend] Connection dropped during completion");
|
|
13526
|
-
settleReject(new Error("WebSocket connection lost during completion"));
|
|
13527
|
-
};
|
|
13528
|
-
this.wsManager.onDisconnect(onDisconnect);
|
|
13529
|
-
if (options.abortSignal) {
|
|
13530
|
-
if (options.abortSignal.aborted) {
|
|
13531
|
-
settleResolve();
|
|
13532
|
-
return;
|
|
13533
|
-
}
|
|
13534
|
-
options.abortSignal.addEventListener(
|
|
13535
|
-
"abort",
|
|
13536
|
-
() => {
|
|
13537
|
-
logger.debug("[WebSocketLlmBackend] Abort signal received");
|
|
13538
|
-
settleResolve();
|
|
13539
|
-
},
|
|
13540
|
-
{ once: true }
|
|
13541
|
-
);
|
|
13542
|
-
}
|
|
13543
|
-
const updateUsage = (usage) => {
|
|
13544
|
-
if (usage) {
|
|
13545
|
-
lastUsageInfo = { inputTokens: usage.inputTokens, outputTokens: usage.outputTokens };
|
|
13546
|
-
}
|
|
13547
|
-
};
|
|
13548
|
-
this.wsManager.onRequest(requestId, (message) => {
|
|
13549
|
-
if (options.abortSignal?.aborted) return;
|
|
13550
|
-
const action = message.action;
|
|
13551
|
-
if (action === "cli_completion_chunk") {
|
|
13552
|
-
eventCount++;
|
|
13553
|
-
const chunk = message.chunk;
|
|
13554
|
-
streamLogger.onEvent(eventCount, JSON.stringify(chunk));
|
|
13555
|
-
const textChunk = chunk.text || "";
|
|
13556
|
-
if (textChunk) accumulatedText += textChunk;
|
|
13557
|
-
updateUsage(chunk.usage);
|
|
13558
|
-
if (chunk.type === "content") {
|
|
13559
|
-
streamLogger.onContent(eventCount, textChunk, accumulatedText);
|
|
13560
|
-
} else if (chunk.type === "tool_use") {
|
|
13561
|
-
streamLogger.onCriticalEvent(eventCount, "TOOL_USE", `tools: ${chunk.tools?.length}`);
|
|
13562
|
-
if (chunk.tools && chunk.tools.length > 0) toolsUsed = chunk.tools;
|
|
13563
|
-
if (chunk.thinking && chunk.thinking.length > 0) thinkingBlocks = chunk.thinking;
|
|
13564
|
-
}
|
|
13565
|
-
} else if (action === "cli_completion_done") {
|
|
13566
|
-
streamLogger.streamComplete(accumulatedText);
|
|
13567
|
-
const cleanedText = stripThinkingBlocks2(accumulatedText);
|
|
13568
|
-
if (!cleanedText && toolsUsed.length === 0) {
|
|
13569
|
-
settleResolve();
|
|
13570
|
-
return;
|
|
13571
|
-
}
|
|
13572
|
-
const info = {
|
|
13573
|
-
...lastUsageInfo,
|
|
13574
|
-
...toolsUsed.length > 0 && { toolsUsed },
|
|
13575
|
-
...thinkingBlocks.length > 0 && { thinking: thinkingBlocks }
|
|
13576
|
-
};
|
|
13577
|
-
callback([cleanedText], info).then(() => settleResolve()).catch((err) => settleReject(err));
|
|
13578
|
-
} else if (action === "cli_completion_error") {
|
|
13579
|
-
const errorMsg = message.error || "Server error";
|
|
13580
|
-
streamLogger.onCriticalEvent(eventCount, "ERROR", errorMsg);
|
|
13581
|
-
settleReject(new Error(errorMsg));
|
|
13582
|
-
}
|
|
13583
|
-
});
|
|
13584
|
-
const axiosInstance = this.apiClient.getAxiosInstance();
|
|
13585
|
-
axiosInstance.post(
|
|
13586
|
-
this.wsCompletionUrl,
|
|
13587
|
-
{
|
|
13588
|
-
requestId,
|
|
13589
|
-
model,
|
|
13590
|
-
messages,
|
|
13591
|
-
options: {
|
|
13592
|
-
temperature: options.temperature,
|
|
13593
|
-
maxTokens: options.maxTokens,
|
|
13594
|
-
stream: true,
|
|
13595
|
-
tools: options.tools || []
|
|
13596
|
-
}
|
|
13597
|
-
},
|
|
13598
|
-
{ signal: options.abortSignal }
|
|
13599
|
-
).catch((err) => {
|
|
13600
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
13601
|
-
settleReject(new Error(`HTTP request failed: ${msg}`));
|
|
13602
|
-
});
|
|
13603
|
-
});
|
|
13604
|
-
}
|
|
13605
|
-
/**
|
|
13606
|
-
* Get available models from server (REST call, not streaming).
|
|
13607
|
-
* Delegates to ApiClient -- same as ServerLlmBackend.
|
|
13608
|
-
*/
|
|
13609
|
-
async getModelInfo() {
|
|
13610
|
-
try {
|
|
13611
|
-
logger.debug("[WebSocketLlmBackend] Fetching models from /api/models");
|
|
13612
|
-
const response = await this.apiClient.get("/api/models");
|
|
13613
|
-
if (!response || typeof response !== "object" || !Array.isArray(response.models)) {
|
|
13614
|
-
logger.warn("[WebSocketLlmBackend] Invalid API response format, using fallback models");
|
|
13615
|
-
return this.getFallbackModels();
|
|
13616
|
-
}
|
|
13617
|
-
const filteredModels = response.models.filter(
|
|
13618
|
-
(model) => model.type === "text" && model.supportsTools === true
|
|
13619
|
-
);
|
|
13620
|
-
if (filteredModels.length === 0) {
|
|
13621
|
-
logger.warn("[WebSocketLlmBackend] No CLI-compatible models found, using fallback");
|
|
13622
|
-
return this.getFallbackModels();
|
|
13623
|
-
}
|
|
13624
|
-
logger.debug(`[WebSocketLlmBackend] Loaded ${filteredModels.length} models`);
|
|
13625
|
-
return filteredModels;
|
|
13626
|
-
} catch (error) {
|
|
13627
|
-
logger.warn(
|
|
13628
|
-
`[WebSocketLlmBackend] Failed to fetch models: ${error instanceof Error ? error.message : String(error)}`
|
|
13629
|
-
);
|
|
13630
|
-
return this.getFallbackModels();
|
|
13631
|
-
}
|
|
13632
|
-
}
|
|
13633
|
-
getFallbackModels() {
|
|
13634
|
-
return [
|
|
13635
|
-
{ id: "claude-sonnet-4-5-20250929", name: "Claude 4.5 Sonnet" },
|
|
13636
|
-
{ id: "claude-3-5-haiku-20241022", name: "Claude 3.5 Haiku" },
|
|
13637
|
-
{ id: "gpt-4o", name: "GPT-4o" },
|
|
13638
|
-
{ id: "gpt-4o-mini", name: "GPT-4o Mini" }
|
|
13639
|
-
];
|
|
13640
|
-
}
|
|
13641
|
-
};
|
|
13642
|
-
|
|
13643
13393
|
// src/llm/NotifyingLlmBackend.ts
|
|
13644
13394
|
var NotifyingLlmBackend = class {
|
|
13645
13395
|
constructor(inner, backgroundManager) {
|
|
@@ -13674,248 +13424,6 @@ Please acknowledge these background agent results and incorporate them into your
|
|
|
13674
13424
|
}
|
|
13675
13425
|
};
|
|
13676
13426
|
|
|
13677
|
-
// src/ws/WebSocketConnectionManager.ts
|
|
13678
|
-
var WebSocketConnectionManager = class {
|
|
13679
|
-
constructor(wsUrl, getToken) {
|
|
13680
|
-
this.ws = null;
|
|
13681
|
-
this.heartbeatInterval = null;
|
|
13682
|
-
this.reconnectAttempts = 0;
|
|
13683
|
-
this.maxReconnectDelay = 3e4;
|
|
13684
|
-
this.handlers = /* @__PURE__ */ new Map();
|
|
13685
|
-
this.disconnectHandlers = /* @__PURE__ */ new Set();
|
|
13686
|
-
this.connected = false;
|
|
13687
|
-
this.connecting = false;
|
|
13688
|
-
this.closed = false;
|
|
13689
|
-
this.wsUrl = wsUrl;
|
|
13690
|
-
this.getToken = getToken;
|
|
13691
|
-
}
|
|
13692
|
-
/**
|
|
13693
|
-
* Connect to the WebSocket server.
|
|
13694
|
-
* Resolves when connection is established, rejects on failure.
|
|
13695
|
-
*/
|
|
13696
|
-
async connect() {
|
|
13697
|
-
if (this.connected || this.connecting) return;
|
|
13698
|
-
this.connecting = true;
|
|
13699
|
-
const token = await this.getToken();
|
|
13700
|
-
if (!token) {
|
|
13701
|
-
this.connecting = false;
|
|
13702
|
-
throw new Error("No access token available for WebSocket connection");
|
|
13703
|
-
}
|
|
13704
|
-
return new Promise((resolve3, reject) => {
|
|
13705
|
-
const url = `${this.wsUrl}?token=${token}`;
|
|
13706
|
-
logger.debug(`[WS] Connecting to ${this.wsUrl}...`);
|
|
13707
|
-
this.ws = new WebSocket(url);
|
|
13708
|
-
this.ws.onopen = () => {
|
|
13709
|
-
logger.debug("[WS] Connected");
|
|
13710
|
-
this.connected = true;
|
|
13711
|
-
this.connecting = false;
|
|
13712
|
-
this.reconnectAttempts = 0;
|
|
13713
|
-
this.startHeartbeat();
|
|
13714
|
-
resolve3();
|
|
13715
|
-
};
|
|
13716
|
-
this.ws.onmessage = (event) => {
|
|
13717
|
-
try {
|
|
13718
|
-
const data = typeof event.data === "string" ? event.data : event.data.toString();
|
|
13719
|
-
const message = JSON.parse(data);
|
|
13720
|
-
const requestId = message.requestId;
|
|
13721
|
-
if (requestId && this.handlers.has(requestId)) {
|
|
13722
|
-
this.handlers.get(requestId)(message);
|
|
13723
|
-
} else {
|
|
13724
|
-
logger.debug(`[WS] Unhandled message: ${message.action || "unknown"}`);
|
|
13725
|
-
}
|
|
13726
|
-
} catch (err) {
|
|
13727
|
-
logger.debug(`[WS] Failed to parse message: ${err}`);
|
|
13728
|
-
}
|
|
13729
|
-
};
|
|
13730
|
-
this.ws.onclose = () => {
|
|
13731
|
-
logger.debug("[WS] Connection closed");
|
|
13732
|
-
this.cleanup();
|
|
13733
|
-
this.notifyDisconnect();
|
|
13734
|
-
if (!this.closed) {
|
|
13735
|
-
this.scheduleReconnect();
|
|
13736
|
-
}
|
|
13737
|
-
};
|
|
13738
|
-
this.ws.onerror = (err) => {
|
|
13739
|
-
logger.debug(`[WS] Error: ${err}`);
|
|
13740
|
-
if (this.connecting) {
|
|
13741
|
-
this.connecting = false;
|
|
13742
|
-
this.connected = false;
|
|
13743
|
-
reject(new Error("WebSocket connection failed"));
|
|
13744
|
-
}
|
|
13745
|
-
};
|
|
13746
|
-
});
|
|
13747
|
-
}
|
|
13748
|
-
/** Whether the connection is currently established */
|
|
13749
|
-
get isConnected() {
|
|
13750
|
-
return this.connected;
|
|
13751
|
-
}
|
|
13752
|
-
/**
|
|
13753
|
-
* Send a JSON message over the WebSocket connection.
|
|
13754
|
-
*/
|
|
13755
|
-
send(data) {
|
|
13756
|
-
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
13757
|
-
throw new Error("WebSocket is not connected");
|
|
13758
|
-
}
|
|
13759
|
-
const payload = JSON.stringify(data);
|
|
13760
|
-
const sizeKB = (payload.length / 1024).toFixed(1);
|
|
13761
|
-
logger.debug(`[WS] Sending ${sizeKB} KB (action: ${data.action})`);
|
|
13762
|
-
if (payload.length > 32e3) {
|
|
13763
|
-
logger.warn(`[WS] Payload ${sizeKB} KB exceeds API Gateway 32 KB frame limit \u2014 connection will be closed`);
|
|
13764
|
-
}
|
|
13765
|
-
this.ws.send(payload);
|
|
13766
|
-
}
|
|
13767
|
-
/**
|
|
13768
|
-
* Register a handler for messages matching a specific requestId.
|
|
13769
|
-
*/
|
|
13770
|
-
onRequest(requestId, handler) {
|
|
13771
|
-
this.handlers.set(requestId, handler);
|
|
13772
|
-
}
|
|
13773
|
-
/**
|
|
13774
|
-
* Remove a handler for a specific requestId.
|
|
13775
|
-
*/
|
|
13776
|
-
offRequest(requestId) {
|
|
13777
|
-
this.handlers.delete(requestId);
|
|
13778
|
-
}
|
|
13779
|
-
/**
|
|
13780
|
-
* Register a handler that fires when the connection drops.
|
|
13781
|
-
*/
|
|
13782
|
-
onDisconnect(handler) {
|
|
13783
|
-
this.disconnectHandlers.add(handler);
|
|
13784
|
-
}
|
|
13785
|
-
/**
|
|
13786
|
-
* Remove a disconnect handler.
|
|
13787
|
-
*/
|
|
13788
|
-
offDisconnect(handler) {
|
|
13789
|
-
this.disconnectHandlers.delete(handler);
|
|
13790
|
-
}
|
|
13791
|
-
/**
|
|
13792
|
-
* Close the connection and stop all heartbeat/reconnect logic.
|
|
13793
|
-
*/
|
|
13794
|
-
disconnect() {
|
|
13795
|
-
this.closed = true;
|
|
13796
|
-
this.cleanup();
|
|
13797
|
-
if (this.ws) {
|
|
13798
|
-
this.ws.close();
|
|
13799
|
-
this.ws = null;
|
|
13800
|
-
}
|
|
13801
|
-
this.handlers.clear();
|
|
13802
|
-
this.disconnectHandlers.clear();
|
|
13803
|
-
}
|
|
13804
|
-
startHeartbeat() {
|
|
13805
|
-
this.stopHeartbeat();
|
|
13806
|
-
this.heartbeatInterval = setInterval(
|
|
13807
|
-
() => {
|
|
13808
|
-
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
13809
|
-
this.ws.send(JSON.stringify({ action: "heartbeat" }));
|
|
13810
|
-
logger.debug("[WS] Heartbeat sent");
|
|
13811
|
-
}
|
|
13812
|
-
},
|
|
13813
|
-
5 * 60 * 1e3
|
|
13814
|
-
);
|
|
13815
|
-
}
|
|
13816
|
-
stopHeartbeat() {
|
|
13817
|
-
if (this.heartbeatInterval) {
|
|
13818
|
-
clearInterval(this.heartbeatInterval);
|
|
13819
|
-
this.heartbeatInterval = null;
|
|
13820
|
-
}
|
|
13821
|
-
}
|
|
13822
|
-
cleanup() {
|
|
13823
|
-
this.connected = false;
|
|
13824
|
-
this.connecting = false;
|
|
13825
|
-
this.stopHeartbeat();
|
|
13826
|
-
}
|
|
13827
|
-
notifyDisconnect() {
|
|
13828
|
-
for (const handler of this.disconnectHandlers) {
|
|
13829
|
-
try {
|
|
13830
|
-
handler();
|
|
13831
|
-
} catch {
|
|
13832
|
-
}
|
|
13833
|
-
}
|
|
13834
|
-
}
|
|
13835
|
-
scheduleReconnect() {
|
|
13836
|
-
if (this.closed) return;
|
|
13837
|
-
this.reconnectAttempts++;
|
|
13838
|
-
const delay = Math.min(1e3 * Math.pow(2, this.reconnectAttempts - 1), this.maxReconnectDelay);
|
|
13839
|
-
logger.debug(`[WS] Reconnecting in ${delay}ms (attempt ${this.reconnectAttempts})`);
|
|
13840
|
-
setTimeout(async () => {
|
|
13841
|
-
if (this.closed) return;
|
|
13842
|
-
try {
|
|
13843
|
-
await this.connect();
|
|
13844
|
-
} catch {
|
|
13845
|
-
logger.debug("[WS] Reconnection failed");
|
|
13846
|
-
}
|
|
13847
|
-
}, delay);
|
|
13848
|
-
}
|
|
13849
|
-
};
|
|
13850
|
-
|
|
13851
|
-
// src/ws/WebSocketToolExecutor.ts
|
|
13852
|
-
import { v4 as uuidv412 } from "uuid";
|
|
13853
|
-
var WebSocketToolExecutor = class {
|
|
13854
|
-
constructor(wsManager, tokenGetter) {
|
|
13855
|
-
this.wsManager = wsManager;
|
|
13856
|
-
this.tokenGetter = tokenGetter;
|
|
13857
|
-
}
|
|
13858
|
-
/**
|
|
13859
|
-
* Execute a server-side tool via WebSocket.
|
|
13860
|
-
* Returns the tool result or throws on error.
|
|
13861
|
-
*/
|
|
13862
|
-
async execute(toolName, input, abortSignal) {
|
|
13863
|
-
if (!this.wsManager.isConnected) {
|
|
13864
|
-
throw new Error("WebSocket is not connected");
|
|
13865
|
-
}
|
|
13866
|
-
const token = await this.tokenGetter();
|
|
13867
|
-
if (!token) {
|
|
13868
|
-
throw new Error("No access token available");
|
|
13869
|
-
}
|
|
13870
|
-
const requestId = uuidv412();
|
|
13871
|
-
return new Promise((resolve3, reject) => {
|
|
13872
|
-
let settled = false;
|
|
13873
|
-
const settle = (action) => {
|
|
13874
|
-
if (settled) return;
|
|
13875
|
-
settled = true;
|
|
13876
|
-
this.wsManager.offRequest(requestId);
|
|
13877
|
-
this.wsManager.offDisconnect(onDisconnect);
|
|
13878
|
-
action();
|
|
13879
|
-
};
|
|
13880
|
-
const settleResolve = (result) => settle(() => resolve3(result));
|
|
13881
|
-
const settleReject = (err) => settle(() => reject(err));
|
|
13882
|
-
const onDisconnect = () => {
|
|
13883
|
-
settleReject(new Error("WebSocket connection lost during tool execution"));
|
|
13884
|
-
};
|
|
13885
|
-
this.wsManager.onDisconnect(onDisconnect);
|
|
13886
|
-
if (abortSignal) {
|
|
13887
|
-
if (abortSignal.aborted) {
|
|
13888
|
-
settleReject(new Error("Tool execution aborted"));
|
|
13889
|
-
return;
|
|
13890
|
-
}
|
|
13891
|
-
abortSignal.addEventListener("abort", () => settleReject(new Error("Tool execution aborted")), {
|
|
13892
|
-
once: true
|
|
13893
|
-
});
|
|
13894
|
-
}
|
|
13895
|
-
this.wsManager.onRequest(requestId, (message) => {
|
|
13896
|
-
if (message.action === "cli_tool_response") {
|
|
13897
|
-
settleResolve({
|
|
13898
|
-
success: message.success,
|
|
13899
|
-
content: message.content,
|
|
13900
|
-
error: message.error
|
|
13901
|
-
});
|
|
13902
|
-
}
|
|
13903
|
-
});
|
|
13904
|
-
try {
|
|
13905
|
-
this.wsManager.send({
|
|
13906
|
-
action: "cli_tool_request",
|
|
13907
|
-
accessToken: token,
|
|
13908
|
-
requestId,
|
|
13909
|
-
toolName,
|
|
13910
|
-
input
|
|
13911
|
-
});
|
|
13912
|
-
} catch (err) {
|
|
13913
|
-
settleReject(err instanceof Error ? err : new Error(String(err)));
|
|
13914
|
-
}
|
|
13915
|
-
});
|
|
13916
|
-
}
|
|
13917
|
-
};
|
|
13918
|
-
|
|
13919
13427
|
// src/auth/ApiClient.ts
|
|
13920
13428
|
import axios11 from "axios";
|
|
13921
13429
|
var ApiClient = class {
|
|
@@ -14053,7 +13561,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
14053
13561
|
// package.json
|
|
14054
13562
|
var package_default = {
|
|
14055
13563
|
name: "@bike4mind/cli",
|
|
14056
|
-
version: "0.2.29-feat-
|
|
13564
|
+
version: "0.2.29-feat-quantum-optimize-architecture.18849+769ef9f35",
|
|
14057
13565
|
type: "module",
|
|
14058
13566
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
14059
13567
|
license: "UNLICENSED",
|
|
@@ -14163,10 +13671,10 @@ var package_default = {
|
|
|
14163
13671
|
},
|
|
14164
13672
|
devDependencies: {
|
|
14165
13673
|
"@bike4mind/agents": "0.1.0",
|
|
14166
|
-
"@bike4mind/common": "2.50.1-feat-
|
|
14167
|
-
"@bike4mind/mcp": "1.29.1-feat-
|
|
14168
|
-
"@bike4mind/services": "2.48.1-feat-
|
|
14169
|
-
"@bike4mind/utils": "2.5.1-feat-
|
|
13674
|
+
"@bike4mind/common": "2.50.1-feat-quantum-optimize-architecture.18849+769ef9f35",
|
|
13675
|
+
"@bike4mind/mcp": "1.29.1-feat-quantum-optimize-architecture.18849+769ef9f35",
|
|
13676
|
+
"@bike4mind/services": "2.48.1-feat-quantum-optimize-architecture.18849+769ef9f35",
|
|
13677
|
+
"@bike4mind/utils": "2.5.1-feat-quantum-optimize-architecture.18849+769ef9f35",
|
|
14170
13678
|
"@types/better-sqlite3": "^7.6.13",
|
|
14171
13679
|
"@types/diff": "^5.0.9",
|
|
14172
13680
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -14183,7 +13691,7 @@ var package_default = {
|
|
|
14183
13691
|
optionalDependencies: {
|
|
14184
13692
|
"@vscode/ripgrep": "^1.17.0"
|
|
14185
13693
|
},
|
|
14186
|
-
gitHead: "
|
|
13694
|
+
gitHead: "769ef9f353f35d3cb28ab88b2a1149309549ca18"
|
|
14187
13695
|
};
|
|
14188
13696
|
|
|
14189
13697
|
// src/config/constants.ts
|
|
@@ -14420,6 +13928,50 @@ ${expandedBody}
|
|
|
14420
13928
|
};
|
|
14421
13929
|
}
|
|
14422
13930
|
|
|
13931
|
+
// src/core/skillsPrompt.ts
|
|
13932
|
+
function getSkillDisplayName(cmd) {
|
|
13933
|
+
return cmd.displayName || cmd.name;
|
|
13934
|
+
}
|
|
13935
|
+
function formatSkillEntry(cmd) {
|
|
13936
|
+
const displayName = getSkillDisplayName(cmd);
|
|
13937
|
+
const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
|
|
13938
|
+
const nameDisplay = cmd.displayName && cmd.displayName !== cmd.name ? `**${displayName}** (\`${cmd.name}\`)` : `**${cmd.name}**`;
|
|
13939
|
+
return `- ${nameDisplay}${argHint}: ${cmd.description}
|
|
13940
|
+
`;
|
|
13941
|
+
}
|
|
13942
|
+
function formatSkillGroup(heading, commands) {
|
|
13943
|
+
if (commands.length === 0) {
|
|
13944
|
+
return "";
|
|
13945
|
+
}
|
|
13946
|
+
return `
|
|
13947
|
+
### ${heading}
|
|
13948
|
+
${commands.map(formatSkillEntry).join("")}`;
|
|
13949
|
+
}
|
|
13950
|
+
function filterAIVisibleSkills(commands) {
|
|
13951
|
+
return commands.filter((cmd) => !cmd.disableModelInvocation);
|
|
13952
|
+
}
|
|
13953
|
+
function filterSkillsByAllowedList(commands, allowedSkills) {
|
|
13954
|
+
if (!allowedSkills || allowedSkills.length === 0) {
|
|
13955
|
+
return commands;
|
|
13956
|
+
}
|
|
13957
|
+
return commands.filter((cmd) => allowedSkills.includes(cmd.name));
|
|
13958
|
+
}
|
|
13959
|
+
function buildSkillsPromptSection(commands, allowedSkills) {
|
|
13960
|
+
const filteredByAllowed = filterSkillsByAllowedList(commands, allowedSkills);
|
|
13961
|
+
const visibleCommands = filterAIVisibleSkills(filteredByAllowed);
|
|
13962
|
+
if (visibleCommands.length === 0) {
|
|
13963
|
+
return "";
|
|
13964
|
+
}
|
|
13965
|
+
const projectSkills = visibleCommands.filter((c) => c.source === "project");
|
|
13966
|
+
const globalSkills = visibleCommands.filter((c) => c.source === "global");
|
|
13967
|
+
return `
|
|
13968
|
+
|
|
13969
|
+
## Available Skills
|
|
13970
|
+
|
|
13971
|
+
Use the \`skill\` tool to invoke these. Example: skill({ skill: "commit" })
|
|
13972
|
+
` + formatSkillGroup("Project Skills", projectSkills) + formatSkillGroup("Global Skills", globalSkills);
|
|
13973
|
+
}
|
|
13974
|
+
|
|
14423
13975
|
// src/agents/SubagentOrchestrator.ts
|
|
14424
13976
|
var SubagentOrchestrator = class {
|
|
14425
13977
|
constructor(deps) {
|
|
@@ -15000,21 +14552,6 @@ Describe the expected output format here.
|
|
|
15000
14552
|
}
|
|
15001
14553
|
return { builtin, global, project, total: this.agents.size };
|
|
15002
14554
|
}
|
|
15003
|
-
/**
|
|
15004
|
-
* Generates a markdown "Phone Book" of available agents and their schemas.
|
|
15005
|
-
* This MUST be injected into the System Prompt of the parent agent.
|
|
15006
|
-
*/
|
|
15007
|
-
getDirectoryContext() {
|
|
15008
|
-
if (this.agents.size === 0) {
|
|
15009
|
-
return "No sub-agents are currently available.";
|
|
15010
|
-
}
|
|
15011
|
-
let context = "Use `subagent_delegate` for complex tasks requiring specialized analysis.\n";
|
|
15012
|
-
for (const [name, def] of this.agents) {
|
|
15013
|
-
context += ` - **${name}**: ${def.description}
|
|
15014
|
-
`;
|
|
15015
|
-
}
|
|
15016
|
-
return context;
|
|
15017
|
-
}
|
|
15018
14555
|
};
|
|
15019
14556
|
|
|
15020
14557
|
// src/agents/delegateTool.ts
|
|
@@ -15962,8 +15499,7 @@ function CliApp() {
|
|
|
15962
15499
|
agentStore: null,
|
|
15963
15500
|
abortController: null,
|
|
15964
15501
|
contextContent: "",
|
|
15965
|
-
backgroundManager: null
|
|
15966
|
-
wsManager: null
|
|
15502
|
+
backgroundManager: null
|
|
15967
15503
|
});
|
|
15968
15504
|
const [isInitialized, setIsInitialized] = useState9(false);
|
|
15969
15505
|
const [initError, setInitError] = useState9(null);
|
|
@@ -15991,10 +15527,6 @@ function CliApp() {
|
|
|
15991
15527
|
})
|
|
15992
15528
|
);
|
|
15993
15529
|
}
|
|
15994
|
-
if (state.wsManager) {
|
|
15995
|
-
state.wsManager.disconnect();
|
|
15996
|
-
setWebSocketToolExecutor(null);
|
|
15997
|
-
}
|
|
15998
15530
|
if (state.agent) {
|
|
15999
15531
|
state.agent.removeAllListeners();
|
|
16000
15532
|
}
|
|
@@ -16013,7 +15545,7 @@ function CliApp() {
|
|
|
16013
15545
|
setTimeout(() => {
|
|
16014
15546
|
process.exit(0);
|
|
16015
15547
|
}, 100);
|
|
16016
|
-
}, [state.session, state.sessionStore, state.mcpManager, state.agent, state.imageStore
|
|
15548
|
+
}, [state.session, state.sessionStore, state.mcpManager, state.agent, state.imageStore]);
|
|
16017
15549
|
useInput9((input, key) => {
|
|
16018
15550
|
if (key.escape) {
|
|
16019
15551
|
if (state.abortController) {
|
|
@@ -16083,7 +15615,7 @@ function CliApp() {
|
|
|
16083
15615
|
if (!isAuthenticated) {
|
|
16084
15616
|
console.log("\u2139\uFE0F AI features disabled. Available commands: /login, /help, /config\n");
|
|
16085
15617
|
const minimalSession = {
|
|
16086
|
-
id:
|
|
15618
|
+
id: uuidv411(),
|
|
16087
15619
|
name: `Session ${(/* @__PURE__ */ new Date()).toLocaleString()}`,
|
|
16088
15620
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16089
15621
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -16111,45 +15643,10 @@ function CliApp() {
|
|
|
16111
15643
|
console.log(`\u{1F30D} API Environment: ${envName} (${apiBaseURL})`);
|
|
16112
15644
|
}
|
|
16113
15645
|
const apiClient = new ApiClient(apiBaseURL, state.configStore);
|
|
16114
|
-
const
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
};
|
|
16118
|
-
let wsManager = null;
|
|
16119
|
-
let llm;
|
|
16120
|
-
try {
|
|
16121
|
-
const serverConfig = await apiClient.get(
|
|
16122
|
-
"/api/settings/serverConfig"
|
|
16123
|
-
);
|
|
16124
|
-
const wsUrl = serverConfig?.websocketUrl;
|
|
16125
|
-
const wsCompletionUrl = serverConfig?.wsCompletionUrl;
|
|
16126
|
-
if (wsUrl && wsCompletionUrl) {
|
|
16127
|
-
wsManager = new WebSocketConnectionManager(wsUrl, tokenGetter);
|
|
16128
|
-
await wsManager.connect();
|
|
16129
|
-
const wsToolExecutor2 = new WebSocketToolExecutor(wsManager, tokenGetter);
|
|
16130
|
-
setWebSocketToolExecutor(wsToolExecutor2);
|
|
16131
|
-
llm = new WebSocketLlmBackend({
|
|
16132
|
-
wsManager,
|
|
16133
|
-
apiClient,
|
|
16134
|
-
model: config.defaultModel,
|
|
16135
|
-
tokenGetter,
|
|
16136
|
-
wsCompletionUrl
|
|
16137
|
-
});
|
|
16138
|
-
logger.debug("\u{1F50C} Using WebSocket transport (bypasses CloudFront timeout)");
|
|
16139
|
-
} else {
|
|
16140
|
-
throw new Error("No websocketUrl or wsCompletionUrl in server config");
|
|
16141
|
-
}
|
|
16142
|
-
} catch (wsError) {
|
|
16143
|
-
logger.debug(
|
|
16144
|
-
`[WS] WebSocket unavailable, using SSE fallback: ${wsError instanceof Error ? wsError.message : String(wsError)}`
|
|
16145
|
-
);
|
|
16146
|
-
wsManager = null;
|
|
16147
|
-
setWebSocketToolExecutor(null);
|
|
16148
|
-
llm = new ServerLlmBackend({
|
|
16149
|
-
apiClient,
|
|
16150
|
-
model: config.defaultModel
|
|
16151
|
-
});
|
|
16152
|
-
}
|
|
15646
|
+
const llm = new ServerLlmBackend({
|
|
15647
|
+
apiClient,
|
|
15648
|
+
model: config.defaultModel
|
|
15649
|
+
});
|
|
16153
15650
|
const models = await llm.getModelInfo();
|
|
16154
15651
|
if (models.length === 0) {
|
|
16155
15652
|
throw new Error("No models available from server.");
|
|
@@ -16162,7 +15659,7 @@ function CliApp() {
|
|
|
16162
15659
|
}
|
|
16163
15660
|
llm.currentModel = modelInfo.id;
|
|
16164
15661
|
const newSession = {
|
|
16165
|
-
id:
|
|
15662
|
+
id: uuidv411(),
|
|
16166
15663
|
name: `Session ${(/* @__PURE__ */ new Date()).toLocaleString()}`,
|
|
16167
15664
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16168
15665
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -16312,12 +15809,18 @@ function CliApp() {
|
|
|
16312
15809
|
for (const error of contextResult.errors) {
|
|
16313
15810
|
startupLog.push(`\u26A0\uFE0F Context file error: ${error}`);
|
|
16314
15811
|
}
|
|
16315
|
-
|
|
16316
|
-
|
|
16317
|
-
|
|
16318
|
-
|
|
16319
|
-
|
|
16320
|
-
|
|
15812
|
+
let contextSection = contextResult.mergedContent ? `
|
|
15813
|
+
|
|
15814
|
+
## Project Context
|
|
15815
|
+
|
|
15816
|
+
Follow these project-specific instructions:
|
|
15817
|
+
|
|
15818
|
+
${contextResult.mergedContent}` : "";
|
|
15819
|
+
if (enableSkillTool) {
|
|
15820
|
+
const commands = state.customCommandStore.getAllCommands();
|
|
15821
|
+
contextSection += buildSkillsPromptSection(commands);
|
|
15822
|
+
}
|
|
15823
|
+
const cliSystemPrompt = buildCoreSystemPrompt(contextSection);
|
|
16321
15824
|
const maxIterations = config.preferences.maxIterations === null ? 999999 : config.preferences.maxIterations;
|
|
16322
15825
|
const agent = new ReActAgent({
|
|
16323
15826
|
userId: config.userId,
|
|
@@ -16376,10 +15879,8 @@ function CliApp() {
|
|
|
16376
15879
|
// Store agent store for agent management commands
|
|
16377
15880
|
contextContent: contextResult.mergedContent,
|
|
16378
15881
|
// Store raw context for compact instructions
|
|
16379
|
-
backgroundManager
|
|
15882
|
+
backgroundManager
|
|
16380
15883
|
// Store for grouped notification turn tracking
|
|
16381
|
-
wsManager
|
|
16382
|
-
// WebSocket connection manager (null if using SSE fallback)
|
|
16383
15884
|
}));
|
|
16384
15885
|
setStoreSession(newSession);
|
|
16385
15886
|
const bannerLines = [
|
|
@@ -16474,13 +15975,13 @@ function CliApp() {
|
|
|
16474
15975
|
messageContent = multimodalMessage.content;
|
|
16475
15976
|
}
|
|
16476
15977
|
const userMessage = {
|
|
16477
|
-
id:
|
|
15978
|
+
id: uuidv411(),
|
|
16478
15979
|
role: "user",
|
|
16479
15980
|
content: userMessageContent,
|
|
16480
15981
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
16481
15982
|
};
|
|
16482
15983
|
const pendingAssistantMessage = {
|
|
16483
|
-
id:
|
|
15984
|
+
id: uuidv411(),
|
|
16484
15985
|
role: "assistant",
|
|
16485
15986
|
content: "...",
|
|
16486
15987
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -16649,12 +16150,7 @@ function CliApp() {
|
|
|
16649
16150
|
const tokenCounter2 = getTokenCounter();
|
|
16650
16151
|
const contextWindow = tokenCounter2.getContextWindow(activeSession.model, state.availableModels);
|
|
16651
16152
|
const threshold = contextWindow * 0.8;
|
|
16652
|
-
const systemPrompt = buildCoreSystemPrompt(
|
|
16653
|
-
contextContent: state.contextContent,
|
|
16654
|
-
agentStore: state.agentStore || void 0,
|
|
16655
|
-
customCommands: state.customCommandStore.getAllCommands(),
|
|
16656
|
-
enableSkillTool: config?.preferences.enableSkillTool !== false
|
|
16657
|
-
});
|
|
16153
|
+
const systemPrompt = buildCoreSystemPrompt(state.contextContent || "");
|
|
16658
16154
|
const contextUsage = tokenCounter2.countSessionTokens(activeSession, systemPrompt);
|
|
16659
16155
|
if (contextUsage.totalTokens >= threshold) {
|
|
16660
16156
|
console.log("\n\u26A0\uFE0F Context window 80% full. Auto-compacting...\n");
|
|
@@ -16691,13 +16187,13 @@ function CliApp() {
|
|
|
16691
16187
|
userMessageContent = message;
|
|
16692
16188
|
}
|
|
16693
16189
|
const userMessage = {
|
|
16694
|
-
id:
|
|
16190
|
+
id: uuidv411(),
|
|
16695
16191
|
role: "user",
|
|
16696
16192
|
content: userMessageContent,
|
|
16697
16193
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
16698
16194
|
};
|
|
16699
16195
|
const pendingAssistantMessage = {
|
|
16700
|
-
id:
|
|
16196
|
+
id: uuidv411(),
|
|
16701
16197
|
role: "assistant",
|
|
16702
16198
|
content: "...",
|
|
16703
16199
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -16775,7 +16271,7 @@ function CliApp() {
|
|
|
16775
16271
|
const currentSession = useCliStore.getState().session;
|
|
16776
16272
|
if (currentSession) {
|
|
16777
16273
|
const cancelMessage = {
|
|
16778
|
-
id:
|
|
16274
|
+
id: uuidv411(),
|
|
16779
16275
|
role: "assistant",
|
|
16780
16276
|
content: "\u26A0\uFE0F Operation cancelled by user",
|
|
16781
16277
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -16820,7 +16316,7 @@ function CliApp() {
|
|
|
16820
16316
|
setState((prev) => ({ ...prev, abortController }));
|
|
16821
16317
|
try {
|
|
16822
16318
|
const pendingAssistantMessage = {
|
|
16823
|
-
id:
|
|
16319
|
+
id: uuidv411(),
|
|
16824
16320
|
role: "assistant",
|
|
16825
16321
|
content: "...",
|
|
16826
16322
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -16848,7 +16344,7 @@ function CliApp() {
|
|
|
16848
16344
|
const currentSession = useCliStore.getState().session;
|
|
16849
16345
|
if (!currentSession) return;
|
|
16850
16346
|
const continuationMessage = {
|
|
16851
|
-
id:
|
|
16347
|
+
id: uuidv411(),
|
|
16852
16348
|
role: "assistant",
|
|
16853
16349
|
content: "---\n\n**Background Agent Results:**\n\n" + result.finalAnswer,
|
|
16854
16350
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -16907,13 +16403,13 @@ function CliApp() {
|
|
|
16907
16403
|
isError = true;
|
|
16908
16404
|
}
|
|
16909
16405
|
const userMessage = {
|
|
16910
|
-
id:
|
|
16406
|
+
id: uuidv411(),
|
|
16911
16407
|
role: "user",
|
|
16912
16408
|
content: `$ ${command}`,
|
|
16913
16409
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
16914
16410
|
};
|
|
16915
16411
|
const assistantMessage = {
|
|
16916
|
-
id:
|
|
16412
|
+
id: uuidv411(),
|
|
16917
16413
|
role: "assistant",
|
|
16918
16414
|
content: isError ? `\u274C Error:
|
|
16919
16415
|
${output}` : output.trim() || "(no output)",
|
|
@@ -17382,7 +16878,7 @@ Keyboard Shortcuts:
|
|
|
17382
16878
|
console.clear();
|
|
17383
16879
|
const model = state.session?.model || state.config?.defaultModel || "claude-sonnet";
|
|
17384
16880
|
const newSession = {
|
|
17385
|
-
id:
|
|
16881
|
+
id: uuidv411(),
|
|
17386
16882
|
name: `Session ${(/* @__PURE__ */ new Date()).toLocaleString()}`,
|
|
17387
16883
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
17388
16884
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -17572,21 +17068,15 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
17572
17068
|
}
|
|
17573
17069
|
const tokenCounter2 = getTokenCounter();
|
|
17574
17070
|
const contextWindow = tokenCounter2.getContextWindow(state.session.model, state.availableModels);
|
|
17575
|
-
const corePromptTokens = tokenCounter2.countTokens(buildCoreSystemPrompt());
|
|
17071
|
+
const corePromptTokens = tokenCounter2.countTokens(buildCoreSystemPrompt(""));
|
|
17576
17072
|
const projectContextTokens = state.contextContent ? tokenCounter2.countTokens(state.contextContent) : 0;
|
|
17577
17073
|
const commands = state.customCommandStore.getAllCommands();
|
|
17578
17074
|
const skillsSection = buildSkillsPromptSection(commands);
|
|
17579
17075
|
const skillsTokens = skillsSection ? tokenCounter2.countTokens(skillsSection) : 0;
|
|
17580
|
-
const agentDirectoryTokens = state.agentStore ? tokenCounter2.countTokens(state.agentStore.getDirectoryContext()) : 0;
|
|
17581
17076
|
const mcpTools = state.mcpManager?.getTools() || [];
|
|
17582
17077
|
const mcpToolsTokens = tokenCounter2.countToolSchemaTokens(mcpTools);
|
|
17583
17078
|
const mcpToolCount = state.mcpManager?.getToolCount() || [];
|
|
17584
|
-
const systemPrompt = buildCoreSystemPrompt(
|
|
17585
|
-
contextContent: state.contextContent,
|
|
17586
|
-
agentStore: state.agentStore || void 0,
|
|
17587
|
-
customCommands: commands,
|
|
17588
|
-
enableSkillTool: state.config?.preferences.enableSkillTool !== false
|
|
17589
|
-
});
|
|
17079
|
+
const systemPrompt = buildCoreSystemPrompt(state.contextContent || "");
|
|
17590
17080
|
const usage = tokenCounter2.countSessionTokens(state.session, systemPrompt);
|
|
17591
17081
|
const totalWithTools = usage.totalTokens + mcpToolsTokens;
|
|
17592
17082
|
const usagePercent = totalWithTools / contextWindow * 100;
|
|
@@ -17605,10 +17095,6 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
17605
17095
|
if (commands.length > 0) {
|
|
17606
17096
|
console.log(` Skills Section: ${skillsTokens.toLocaleString()} tokens (${commands.length} skills)`);
|
|
17607
17097
|
}
|
|
17608
|
-
if (agentDirectoryTokens > 0) {
|
|
17609
|
-
const agentCount = state.agentStore?.getAgentCount() || 0;
|
|
17610
|
-
console.log(` Agent Directory: ${agentDirectoryTokens.toLocaleString()} tokens (${agentCount} agents)`);
|
|
17611
|
-
}
|
|
17612
17098
|
if (mcpTools.length > 0) {
|
|
17613
17099
|
console.log("\nMCP Tools:");
|
|
17614
17100
|
console.log(` Total: ${mcpToolsTokens.toLocaleString()} tokens (${mcpTools.length} tools)`);
|
|
@@ -17887,9 +17373,9 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
17887
17373
|
return { ...prev, config: updatedConfig };
|
|
17888
17374
|
});
|
|
17889
17375
|
if (modelChanged && state.agent) {
|
|
17890
|
-
const
|
|
17891
|
-
if (
|
|
17892
|
-
|
|
17376
|
+
const llm = state.agent.context.llm;
|
|
17377
|
+
if (llm) {
|
|
17378
|
+
llm.currentModel = updatedConfig.defaultModel;
|
|
17893
17379
|
}
|
|
17894
17380
|
}
|
|
17895
17381
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
findMostSimilarMemento,
|
|
4
4
|
getRelevantMementos
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-3334LDVW.js";
|
|
6
|
+
import "./chunk-KQHTB3MR.js";
|
|
7
|
+
import "./chunk-4J5T2O4F.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
findMostSimilarMemento,
|
|
@@ -134,8 +134,8 @@ import {
|
|
|
134
134
|
validateMermaidSyntax,
|
|
135
135
|
warmUpSettingsCache,
|
|
136
136
|
withRetry
|
|
137
|
-
} from "./chunk-
|
|
138
|
-
import "./chunk-
|
|
137
|
+
} from "./chunk-KQHTB3MR.js";
|
|
138
|
+
import "./chunk-4J5T2O4F.js";
|
|
139
139
|
import {
|
|
140
140
|
Logger,
|
|
141
141
|
NotificationDeduplicator,
|
|
@@ -41,12 +41,6 @@ import {
|
|
|
41
41
|
ChatModels,
|
|
42
42
|
CitableSourceSchema,
|
|
43
43
|
ClaudeArtifactMimeTypes,
|
|
44
|
-
CliCompletionChunkAction,
|
|
45
|
-
CliCompletionDoneAction,
|
|
46
|
-
CliCompletionErrorAction,
|
|
47
|
-
CliCompletionRequestAction,
|
|
48
|
-
CliToolRequestAction,
|
|
49
|
-
CliToolResponseAction,
|
|
50
44
|
CollectionType,
|
|
51
45
|
CompletionApiUsageTransaction,
|
|
52
46
|
CompletionRequestSchema,
|
|
@@ -346,7 +340,7 @@ import {
|
|
|
346
340
|
validateReactArtifactV2,
|
|
347
341
|
validateSvgArtifactV2,
|
|
348
342
|
wikiMarkupToAdf
|
|
349
|
-
} from "./chunk-
|
|
343
|
+
} from "./chunk-4J5T2O4F.js";
|
|
350
344
|
export {
|
|
351
345
|
ALL_IMAGE_MODELS,
|
|
352
346
|
ALL_IMAGE_SIZES,
|
|
@@ -390,12 +384,6 @@ export {
|
|
|
390
384
|
ChatModels,
|
|
391
385
|
CitableSourceSchema,
|
|
392
386
|
ClaudeArtifactMimeTypes,
|
|
393
|
-
CliCompletionChunkAction,
|
|
394
|
-
CliCompletionDoneAction,
|
|
395
|
-
CliCompletionErrorAction,
|
|
396
|
-
CliCompletionRequestAction,
|
|
397
|
-
CliToolRequestAction,
|
|
398
|
-
CliToolResponseAction,
|
|
399
387
|
CollectionType,
|
|
400
388
|
CompletionApiUsageTransaction,
|
|
401
389
|
CompletionRequestSchema,
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
SubtractCreditsSchema,
|
|
4
4
|
subtractCredits
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-EBBAA665.js";
|
|
6
|
+
import "./chunk-KQHTB3MR.js";
|
|
7
|
+
import "./chunk-4J5T2O4F.js";
|
|
8
8
|
import "./chunk-OCYRD7D6.js";
|
|
9
9
|
export {
|
|
10
10
|
SubtractCreditsSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.29-feat-
|
|
3
|
+
"version": "0.2.29-feat-quantum-optimize-architecture.18849+769ef9f35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -110,10 +110,10 @@
|
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@bike4mind/agents": "0.1.0",
|
|
113
|
-
"@bike4mind/common": "2.50.1-feat-
|
|
114
|
-
"@bike4mind/mcp": "1.29.1-feat-
|
|
115
|
-
"@bike4mind/services": "2.48.1-feat-
|
|
116
|
-
"@bike4mind/utils": "2.5.1-feat-
|
|
113
|
+
"@bike4mind/common": "2.50.1-feat-quantum-optimize-architecture.18849+769ef9f35",
|
|
114
|
+
"@bike4mind/mcp": "1.29.1-feat-quantum-optimize-architecture.18849+769ef9f35",
|
|
115
|
+
"@bike4mind/services": "2.48.1-feat-quantum-optimize-architecture.18849+769ef9f35",
|
|
116
|
+
"@bike4mind/utils": "2.5.1-feat-quantum-optimize-architecture.18849+769ef9f35",
|
|
117
117
|
"@types/better-sqlite3": "^7.6.13",
|
|
118
118
|
"@types/diff": "^5.0.9",
|
|
119
119
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -130,5 +130,5 @@
|
|
|
130
130
|
"optionalDependencies": {
|
|
131
131
|
"@vscode/ripgrep": "^1.17.0"
|
|
132
132
|
},
|
|
133
|
-
"gitHead": "
|
|
133
|
+
"gitHead": "769ef9f353f35d3cb28ab88b2a1149309549ca18"
|
|
134
134
|
}
|