@bike4mind/cli 0.2.15 → 0.2.16-feat-6197-optimize-agent-system-prompt.17611
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/ImageStore-MMUOUPI2.js +0 -0
- package/dist/artifactExtractor-EEX5G4EB.js +0 -0
- package/dist/{chunk-M2CSCYOY.js → chunk-6UR5ULWL.js} +90 -12
- package/dist/{chunk-O7G3G3FD.js → chunk-6VJTAHNJ.js} +1 -1
- package/dist/{chunk-ECSELHYP.js → chunk-B7WECFBG.js} +1 -1
- package/dist/chunk-BDQBOLYG.js +0 -0
- package/dist/chunk-BPFEGDC7.js +0 -0
- package/dist/chunk-FFJX3FF3.js +0 -0
- package/dist/{chunk-I3CPL4SJ.js → chunk-J6H5XJHM.js} +1 -1
- package/dist/chunk-LL5J3SVB.js +0 -0
- package/dist/chunk-OCYRD7D6.js +0 -0
- package/dist/commands/mcpCommand.js +0 -0
- package/dist/{create-2DJZDMFQ.js → create-GQYWQ3G4.js} +2 -2
- package/dist/formatConverter-5QEJDW24.js +0 -0
- package/dist/index.js +141 -82
- package/dist/llmMarkdownGenerator-SRA436DB.js +0 -0
- package/dist/markdownGenerator-E7F5GFPO.js +0 -0
- package/dist/{mementoService-2WXW5352.js → mementoService-UOWGAUZB.js} +2 -2
- package/dist/notificationDeduplicator-UTHJHMSZ.js +0 -0
- package/dist/src-3MJEHI5W.js +0 -0
- package/dist/{src-K45DVAW4.js → src-EGOUGHOM.js} +5 -1
- package/dist/{subtractCredits-OHI7VBH3.js → subtractCredits-YHSHHC43.js} +2 -2
- package/dist/utils-JCHWDM4Z.js +0 -0
- package/package.json +22 -17
|
File without changes
|
|
File without changes
|
|
@@ -8732,8 +8732,20 @@ var QuestMaster = class {
|
|
|
8732
8732
|
* @param prompt - The user's request to break down into quests
|
|
8733
8733
|
* @returns The parsed quest plan result
|
|
8734
8734
|
*/
|
|
8735
|
-
async createQuestPlanWithFunctionCalling(model, prompt, retryCount = 0) {
|
|
8735
|
+
async createQuestPlanWithFunctionCalling(model, prompt, planOptions = {}, retryCount = 0) {
|
|
8736
8736
|
const MAX_RETRIES = 2;
|
|
8737
|
+
const { history = [] } = planOptions;
|
|
8738
|
+
const hasHistory = history.length > 0;
|
|
8739
|
+
const historyContext = hasHistory ? `
|
|
8740
|
+
|
|
8741
|
+
CONVERSATION CONTEXT:
|
|
8742
|
+
You have access to the user's conversation history. Use this context to:
|
|
8743
|
+
- Understand what the user has already discussed or learned
|
|
8744
|
+
- Reference previous decisions or preferences mentioned
|
|
8745
|
+
- Build upon prior context when creating quests
|
|
8746
|
+
- Avoid suggesting steps the user has already completed
|
|
8747
|
+
|
|
8748
|
+
The conversation history is included before the user's current request.` : "";
|
|
8737
8749
|
const messages = [
|
|
8738
8750
|
{
|
|
8739
8751
|
role: "system",
|
|
@@ -8759,8 +8771,10 @@ TITLE REQUIREMENTS (CRITICAL):
|
|
|
8759
8771
|
HANDLING VERBOSE INPUT:
|
|
8760
8772
|
- When given detailed or verbose input, extract the core objective and key requirements
|
|
8761
8773
|
- Do not try to incorporate every detail verbatim - summarize and structure appropriately
|
|
8762
|
-
- Focus on actionable steps rather than preserving all user context`
|
|
8774
|
+
- Focus on actionable steps rather than preserving all user context${historyContext}`
|
|
8763
8775
|
},
|
|
8776
|
+
// Include conversation history BEFORE the current user request
|
|
8777
|
+
...history,
|
|
8764
8778
|
{ role: "user", content: prompt }
|
|
8765
8779
|
];
|
|
8766
8780
|
const toolDef = {
|
|
@@ -8768,7 +8782,7 @@ HANDLING VERBOSE INPUT:
|
|
|
8768
8782
|
// Not executed, just captured
|
|
8769
8783
|
toolSchema: createQuestPlanToolSchema
|
|
8770
8784
|
};
|
|
8771
|
-
const
|
|
8785
|
+
const completionOptions = {
|
|
8772
8786
|
temperature: retryCount > 0 ? 0.5 : 0.7,
|
|
8773
8787
|
// Lower temperature for structured JSON outputs; even lower on retries
|
|
8774
8788
|
n: 1,
|
|
@@ -8784,7 +8798,7 @@ HANDLING VERBOSE INPUT:
|
|
|
8784
8798
|
let functionResult = null;
|
|
8785
8799
|
let lastError = null;
|
|
8786
8800
|
try {
|
|
8787
|
-
await this.llm.complete(model, messages,
|
|
8801
|
+
await this.llm.complete(model, messages, completionOptions, async (text, completionInfo) => {
|
|
8788
8802
|
if (completionInfo?.toolsUsed?.length) {
|
|
8789
8803
|
const toolCall = completionInfo.toolsUsed[0];
|
|
8790
8804
|
if (toolCall.name === "create_quest_plan" && toolCall.arguments) {
|
|
@@ -8805,7 +8819,7 @@ HANDLING VERBOSE INPUT:
|
|
|
8805
8819
|
if (!functionResult) {
|
|
8806
8820
|
if (retryCount < MAX_RETRIES) {
|
|
8807
8821
|
this.logger.warn(`GPT-5 did not return function call, retrying (attempt ${retryCount + 1}/${MAX_RETRIES})...`);
|
|
8808
|
-
return this.createQuestPlanWithFunctionCalling(model, prompt, retryCount + 1);
|
|
8822
|
+
return this.createQuestPlanWithFunctionCalling(model, prompt, planOptions, retryCount + 1);
|
|
8809
8823
|
}
|
|
8810
8824
|
throw lastError || new Error("GPT-5 did not call create_quest_plan function after retries");
|
|
8811
8825
|
}
|
|
@@ -8814,7 +8828,7 @@ HANDLING VERBOSE INPUT:
|
|
|
8814
8828
|
if (questsWithoutSubquests.length > 0) {
|
|
8815
8829
|
if (retryCount < MAX_RETRIES) {
|
|
8816
8830
|
this.logger.warn(`Some quests missing subquests: ${questsWithoutSubquests.map((q) => q.id).join(", ")}, retrying...`);
|
|
8817
|
-
return this.createQuestPlanWithFunctionCalling(model, prompt, retryCount + 1);
|
|
8831
|
+
return this.createQuestPlanWithFunctionCalling(model, prompt, planOptions, retryCount + 1);
|
|
8818
8832
|
} else {
|
|
8819
8833
|
this.logger.warn(`Returning quest plan with ${questsWithoutSubquests.length} quests missing subquests after max retries (${MAX_RETRIES}): ${questsWithoutSubquests.map((q) => q.id).join(", ")}`);
|
|
8820
8834
|
}
|
|
@@ -8826,22 +8840,35 @@ HANDLING VERBOSE INPUT:
|
|
|
8826
8840
|
});
|
|
8827
8841
|
return result;
|
|
8828
8842
|
}
|
|
8829
|
-
async createQuestPlan(model, prompt) {
|
|
8843
|
+
async createQuestPlan(model, prompt, options = {}) {
|
|
8830
8844
|
try {
|
|
8831
8845
|
if (!this.quest) {
|
|
8832
8846
|
throw new Error("No quest context available");
|
|
8833
8847
|
}
|
|
8848
|
+
const { history = [] } = options;
|
|
8849
|
+
this.logger.log(`Creating quest plan with ${history.length} history messages for context`);
|
|
8834
8850
|
await this.onStatusUpdate(this.quest, "Creating quest plan...");
|
|
8835
8851
|
if (isGPT5ModelWithToolSupport(model)) {
|
|
8836
8852
|
this.logger.log(`Using function calling approach for GPT-5 model: ${model}`);
|
|
8837
8853
|
try {
|
|
8838
|
-
const result = await this.createQuestPlanWithFunctionCalling(model, prompt);
|
|
8854
|
+
const result = await this.createQuestPlanWithFunctionCalling(model, prompt, options);
|
|
8839
8855
|
await this.processQuestPlan(result);
|
|
8840
8856
|
return;
|
|
8841
8857
|
} catch (functionCallError) {
|
|
8842
8858
|
this.logger.error("Function calling failed, falling back to HTML approach:", functionCallError);
|
|
8843
8859
|
}
|
|
8844
8860
|
}
|
|
8861
|
+
const hasHistory = history.length > 0;
|
|
8862
|
+
const historyContext = hasHistory ? `
|
|
8863
|
+
|
|
8864
|
+
CONVERSATION CONTEXT:
|
|
8865
|
+
You have access to the user's conversation history. Use this context to:
|
|
8866
|
+
- Understand what the user has already discussed or learned
|
|
8867
|
+
- Reference previous decisions or preferences mentioned
|
|
8868
|
+
- Build upon prior context when creating quests
|
|
8869
|
+
- Avoid suggesting steps the user has already completed
|
|
8870
|
+
|
|
8871
|
+
The conversation history is included before the user's current request.` : "";
|
|
8845
8872
|
const messages = [
|
|
8846
8873
|
{
|
|
8847
8874
|
role: "system",
|
|
@@ -8904,11 +8931,13 @@ Remember:
|
|
|
8904
8931
|
- Each quest and subquest must have a unique, descriptive ID
|
|
8905
8932
|
- Keep JSON properly formatted
|
|
8906
8933
|
- The client UI depends on this exact structure
|
|
8907
|
-
- Never return a response without proper subquests`
|
|
8934
|
+
- Never return a response without proper subquests${historyContext}`
|
|
8908
8935
|
},
|
|
8936
|
+
// Include conversation history BEFORE the current user request
|
|
8937
|
+
...history,
|
|
8909
8938
|
{ role: "user", content: prompt }
|
|
8910
8939
|
];
|
|
8911
|
-
const
|
|
8940
|
+
const completionOptions = {
|
|
8912
8941
|
temperature: 0.9,
|
|
8913
8942
|
n: 1,
|
|
8914
8943
|
stream: false
|
|
@@ -9007,7 +9036,7 @@ Remember:
|
|
|
9007
9036
|
return tryGenerateQuestPlan(retryMessages, retryOptions, retryCount + 1);
|
|
9008
9037
|
}
|
|
9009
9038
|
};
|
|
9010
|
-
return await tryGenerateQuestPlan(messages,
|
|
9039
|
+
return await tryGenerateQuestPlan(messages, completionOptions);
|
|
9011
9040
|
} catch (error) {
|
|
9012
9041
|
this.logger.error("Error in createQuestPlan:", error);
|
|
9013
9042
|
throw error;
|
|
@@ -10856,6 +10885,53 @@ async function withRetry(fn, options = {}) {
|
|
|
10856
10885
|
}
|
|
10857
10886
|
}
|
|
10858
10887
|
|
|
10888
|
+
// ../../b4m-core/packages/utils/dist/src/voiceHistory.js
|
|
10889
|
+
function truncateText(text, maxLength) {
|
|
10890
|
+
if (text.length <= maxLength)
|
|
10891
|
+
return text;
|
|
10892
|
+
return text.slice(0, maxLength - 3) + "...";
|
|
10893
|
+
}
|
|
10894
|
+
function formatMessage(role, content, maxChars) {
|
|
10895
|
+
const truncated = truncateText(content.trim(), maxChars);
|
|
10896
|
+
return `${role === "user" ? "User" : "Assistant"}: ${truncated}`;
|
|
10897
|
+
}
|
|
10898
|
+
function formatVoiceHistory(historyItems, options = {}) {
|
|
10899
|
+
const { maxChars = 3e3, recentMessageCount = 10, maxCharsPerMessage = 300 } = options;
|
|
10900
|
+
if (!historyItems || historyItems.length === 0) {
|
|
10901
|
+
return "";
|
|
10902
|
+
}
|
|
10903
|
+
const recentItems = historyItems.slice(-recentMessageCount);
|
|
10904
|
+
const lines = [
|
|
10905
|
+
"\n\nCONVERSATION CONTEXT:",
|
|
10906
|
+
"You are continuing a conversation with this user. Here is the recent chat history:",
|
|
10907
|
+
""
|
|
10908
|
+
];
|
|
10909
|
+
for (const item of recentItems) {
|
|
10910
|
+
if (item.prompt) {
|
|
10911
|
+
lines.push(formatMessage("user", item.prompt, maxCharsPerMessage));
|
|
10912
|
+
}
|
|
10913
|
+
if (item.replies && Array.isArray(item.replies)) {
|
|
10914
|
+
const validReply = item.replies.find((reply) => !reply.trim().startsWith("<think>"));
|
|
10915
|
+
if (validReply) {
|
|
10916
|
+
lines.push(formatMessage("assistant", validReply, maxCharsPerMessage));
|
|
10917
|
+
}
|
|
10918
|
+
}
|
|
10919
|
+
}
|
|
10920
|
+
lines.push("");
|
|
10921
|
+
lines.push("Use this context to maintain continuity. Reference previous topics naturally when relevant.");
|
|
10922
|
+
let result = lines.join("\n");
|
|
10923
|
+
if (result.length > maxChars) {
|
|
10924
|
+
result = truncateText(result, maxChars);
|
|
10925
|
+
}
|
|
10926
|
+
return result;
|
|
10927
|
+
}
|
|
10928
|
+
function buildVoiceInstructions(baseInstructions, historyContext) {
|
|
10929
|
+
if (!historyContext) {
|
|
10930
|
+
return baseInstructions;
|
|
10931
|
+
}
|
|
10932
|
+
return `${baseInstructions}${historyContext}`;
|
|
10933
|
+
}
|
|
10934
|
+
|
|
10859
10935
|
export {
|
|
10860
10936
|
BaseStorage,
|
|
10861
10937
|
S3Storage,
|
|
@@ -10983,5 +11059,7 @@ export {
|
|
|
10983
11059
|
isRetryableError,
|
|
10984
11060
|
getRetryAfterMs,
|
|
10985
11061
|
calculateRetryDelay,
|
|
10986
|
-
withRetry
|
|
11062
|
+
withRetry,
|
|
11063
|
+
formatVoiceHistory,
|
|
11064
|
+
buildVoiceInstructions
|
|
10987
11065
|
};
|
package/dist/chunk-BDQBOLYG.js
CHANGED
|
File without changes
|
package/dist/chunk-BPFEGDC7.js
CHANGED
|
File without changes
|
package/dist/chunk-FFJX3FF3.js
CHANGED
|
File without changes
|
package/dist/chunk-LL5J3SVB.js
CHANGED
|
File without changes
|
package/dist/chunk-OCYRD7D6.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-B7WECFBG.js";
|
|
8
8
|
import {
|
|
9
9
|
ConfigStore
|
|
10
10
|
} from "./chunk-FFJX3FF3.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-J6H5XJHM.js";
|
|
12
|
+
import "./chunk-6VJTAHNJ.js";
|
|
13
13
|
import {
|
|
14
14
|
BFLImageService,
|
|
15
15
|
BaseStorage,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
OpenAIBackend,
|
|
22
22
|
OpenAIImageService,
|
|
23
23
|
XAIImageService
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-6UR5ULWL.js";
|
|
25
25
|
import {
|
|
26
26
|
AiEvents,
|
|
27
27
|
ApiKeyEvents,
|
|
@@ -3022,6 +3022,39 @@ SUBAGENT DELEGATION:
|
|
|
3022
3022
|
- Subagents keep the main conversation clean and run faster with optimized models
|
|
3023
3023
|
- Delegate when you need to search extensively or analyze code structure
|
|
3024
3024
|
|
|
3025
|
+
CODE SEARCH BEST PRACTICES:
|
|
3026
|
+
When searching code, follow this hierarchy for speed and efficiency:
|
|
3027
|
+
|
|
3028
|
+
1. Start Narrow \u2192 Go Broad
|
|
3029
|
+
\u2705 Efficient: ${TOOL_GLOB_FILES}("src/**/*.test.ts") \u2192 ${TOOL_GREP_SEARCH}("test('user login'") \u2192 ${TOOL_FILE_READ}("src/auth/login.test.ts")
|
|
3030
|
+
\u274C Inefficient: ${TOOL_GREP_SEARCH}("login") \u2192 Read 50 files individually \u2192 Repeat with different term
|
|
3031
|
+
|
|
3032
|
+
2. Leverage Git Information
|
|
3033
|
+
Before searching, check recent changes:
|
|
3034
|
+
- ${TOOL_BASH_EXECUTE}("git log --name-only --oneline -20")
|
|
3035
|
+
- ${TOOL_BASH_EXECUTE}("git log --oneline -10 -- src/auth/")
|
|
3036
|
+
|
|
3037
|
+
3. File Patterns
|
|
3038
|
+
Use specific patterns instead of broad searches:
|
|
3039
|
+
\u2705 Good: ${TOOL_GLOB_FILES}("**/*.{ts,tsx}"), ${TOOL_GLOB_FILES}("src/components/**/Button*")
|
|
3040
|
+
\u274C Bad: ${TOOL_GLOB_FILES}("**/*"), ${TOOL_GREP_SEARCH}("auth")
|
|
3041
|
+
|
|
3042
|
+
4. Test Files as Documentation
|
|
3043
|
+
When learning about a feature, check tests first:
|
|
3044
|
+
${TOOL_GLOB_FILES}("**/*.test.{ts,tsx}") \u2192 ${TOOL_GREP_SEARCH}("describe('AuthProvider'") \u2192 ${TOOL_FILE_READ} test file \u2192 Read implementation
|
|
3045
|
+
|
|
3046
|
+
5. Batch Operations
|
|
3047
|
+
Prefer glob patterns over multiple calls:
|
|
3048
|
+
\u2705 ${TOOL_GLOB_FILES}("src/**/*.{ts,tsx,js,jsx}") (one call)
|
|
3049
|
+
\u274C 4 separate ${TOOL_GLOB_FILES} calls for each extension
|
|
3050
|
+
|
|
3051
|
+
6. Tool Selection Decision Tree
|
|
3052
|
+
Goal: Find where "AuthProvider" is defined
|
|
3053
|
+
\u2192 ${TOOL_GLOB_FILES}("**/*Auth*.{ts,tsx}") (narrow the search)
|
|
3054
|
+
\u2192 ${TOOL_GREP_SEARCH}("(class|interface|type) AuthProvider") (find exact location)
|
|
3055
|
+
\u2192 ${TOOL_FILE_READ}("src/auth/AuthProvider.tsx") (read only that file)
|
|
3056
|
+
Result: 3 tool calls instead of 10-15
|
|
3057
|
+
|
|
3025
3058
|
FOR GENERAL TASKS:
|
|
3026
3059
|
- Use available tools to get information (weather, web search, calculations, etc.)
|
|
3027
3060
|
- When user asks follow-up questions, use conversation context to understand what they're referring to
|
|
@@ -8509,34 +8542,21 @@ var globFilesTool = {
|
|
|
8509
8542
|
};
|
|
8510
8543
|
|
|
8511
8544
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/grepSearch/index.js
|
|
8512
|
-
import {
|
|
8513
|
-
import { readFile, stat as stat2 } from "fs/promises";
|
|
8545
|
+
import { stat as stat2 } from "fs/promises";
|
|
8514
8546
|
import path9 from "path";
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
"**/.next/**",
|
|
8522
|
-
"**/coverage/**",
|
|
8523
|
-
"**/*.min.js",
|
|
8524
|
-
"**/*.min.css",
|
|
8525
|
-
"**/package-lock.json",
|
|
8526
|
-
"**/pnpm-lock.yaml",
|
|
8527
|
-
"**/yarn.lock"
|
|
8528
|
-
];
|
|
8529
|
-
async function isBinaryFile2(filePath) {
|
|
8547
|
+
import { exec } from "child_process";
|
|
8548
|
+
import { promisify } from "util";
|
|
8549
|
+
import { createRequire } from "module";
|
|
8550
|
+
var execAsync = promisify(exec);
|
|
8551
|
+
var require2 = createRequire(import.meta.url);
|
|
8552
|
+
function getRipgrepPath() {
|
|
8530
8553
|
try {
|
|
8531
|
-
const
|
|
8532
|
-
const
|
|
8533
|
-
const
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
return chunk.includes(0);
|
|
8538
|
-
} catch {
|
|
8539
|
-
return true;
|
|
8554
|
+
const ripgrepPath = require2.resolve("@vscode/ripgrep");
|
|
8555
|
+
const ripgrepDir = path9.dirname(ripgrepPath);
|
|
8556
|
+
const rgBinary = path9.join(ripgrepDir, "..", "bin", "rg" + (process.platform === "win32" ? ".exe" : ""));
|
|
8557
|
+
return rgBinary;
|
|
8558
|
+
} catch (error) {
|
|
8559
|
+
throw new Error("ripgrep is not available. Please install @vscode/ripgrep: pnpm add @vscode/ripgrep --filter @bike4mind/services");
|
|
8540
8560
|
}
|
|
8541
8561
|
}
|
|
8542
8562
|
function isPathWithinWorkspace(targetPath, baseCwd) {
|
|
@@ -8544,6 +8564,17 @@ function isPathWithinWorkspace(targetPath, baseCwd) {
|
|
|
8544
8564
|
const resolvedBase = path9.resolve(baseCwd);
|
|
8545
8565
|
return resolvedTarget.startsWith(resolvedBase);
|
|
8546
8566
|
}
|
|
8567
|
+
function convertGlobToRipgrepGlobs(globPattern) {
|
|
8568
|
+
if (!globPattern || globPattern === "**/*") {
|
|
8569
|
+
return [];
|
|
8570
|
+
}
|
|
8571
|
+
const braceMatch = globPattern.match(/\*\.{([^}]+)}/);
|
|
8572
|
+
if (braceMatch) {
|
|
8573
|
+
const extensions = braceMatch[1].split(",");
|
|
8574
|
+
return extensions.map((ext) => `*.${ext.trim()}`);
|
|
8575
|
+
}
|
|
8576
|
+
return [globPattern];
|
|
8577
|
+
}
|
|
8547
8578
|
async function searchFiles2(params) {
|
|
8548
8579
|
const { pattern, dir_path, include } = params;
|
|
8549
8580
|
const baseCwd = process.cwd();
|
|
@@ -8562,59 +8593,76 @@ async function searchFiles2(params) {
|
|
|
8562
8593
|
}
|
|
8563
8594
|
throw error;
|
|
8564
8595
|
}
|
|
8565
|
-
|
|
8596
|
+
const rgPath = getRipgrepPath();
|
|
8597
|
+
const rgArgs = [
|
|
8598
|
+
"--json",
|
|
8599
|
+
// Machine-readable output
|
|
8600
|
+
"--max-count",
|
|
8601
|
+
"500",
|
|
8602
|
+
// Limit matches per file
|
|
8603
|
+
"--ignore-case",
|
|
8604
|
+
// Case-insensitive search
|
|
8605
|
+
"--max-filesize",
|
|
8606
|
+
"10M"
|
|
8607
|
+
// Skip files larger than 10MB
|
|
8608
|
+
];
|
|
8609
|
+
const globs = convertGlobToRipgrepGlobs(include || "");
|
|
8610
|
+
if (globs.length > 0) {
|
|
8611
|
+
globs.forEach((glob2) => {
|
|
8612
|
+
rgArgs.push("--glob", glob2);
|
|
8613
|
+
});
|
|
8614
|
+
}
|
|
8615
|
+
rgArgs.push(pattern, targetDir);
|
|
8616
|
+
const command = `"${rgPath}" ${rgArgs.map((arg, index) => {
|
|
8617
|
+
const isPattern = index === rgArgs.length - 2;
|
|
8618
|
+
const isPath = index === rgArgs.length - 1;
|
|
8619
|
+
if (isPattern || isPath || arg.includes(" ") || arg.includes("*") || arg.includes("{")) {
|
|
8620
|
+
return `"${arg.replace(/"/g, '\\"')}"`;
|
|
8621
|
+
}
|
|
8622
|
+
return arg;
|
|
8623
|
+
}).join(" ")}`;
|
|
8624
|
+
let stdout;
|
|
8566
8625
|
try {
|
|
8567
|
-
|
|
8626
|
+
const result2 = await execAsync(command, {
|
|
8627
|
+
maxBuffer: 50 * 1024 * 1024
|
|
8628
|
+
// 50MB buffer for large results
|
|
8629
|
+
});
|
|
8630
|
+
stdout = result2.stdout;
|
|
8568
8631
|
} catch (error) {
|
|
8569
|
-
|
|
8632
|
+
const execError = error;
|
|
8633
|
+
if (execError.code === 1 && execError.stdout) {
|
|
8634
|
+
stdout = execError.stdout;
|
|
8635
|
+
} else if (execError.code === 2) {
|
|
8636
|
+
throw new Error(`Invalid regex pattern: ${pattern}`);
|
|
8637
|
+
} else {
|
|
8638
|
+
throw error;
|
|
8639
|
+
}
|
|
8570
8640
|
}
|
|
8571
|
-
const
|
|
8572
|
-
const filesStream = globStream(globPattern, {
|
|
8573
|
-
cwd: targetDir,
|
|
8574
|
-
dot: false,
|
|
8575
|
-
// Skip hidden files
|
|
8576
|
-
ignore: DEFAULT_IGNORE_PATTERNS3,
|
|
8577
|
-
absolute: true,
|
|
8578
|
-
nodir: true
|
|
8579
|
-
// Only match files, not directories
|
|
8580
|
-
});
|
|
8641
|
+
const lines = stdout.split("\n").filter(Boolean);
|
|
8581
8642
|
const allMatches = [];
|
|
8582
8643
|
let filesSearched = 0;
|
|
8583
|
-
const
|
|
8584
|
-
for await (const filePath of filesStream) {
|
|
8585
|
-
if (allMatches.length >= maxMatches) {
|
|
8586
|
-
break;
|
|
8587
|
-
}
|
|
8588
|
-
const fileAbsPath = filePath;
|
|
8644
|
+
for (const line of lines) {
|
|
8589
8645
|
try {
|
|
8590
|
-
const
|
|
8591
|
-
if (
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
allMatches.push({
|
|
8603
|
-
filePath: path9.relative(targetDir, fileAbsPath) || path9.basename(fileAbsPath),
|
|
8604
|
-
lineNumber: index + 1,
|
|
8605
|
-
line
|
|
8606
|
-
});
|
|
8607
|
-
}
|
|
8608
|
-
});
|
|
8609
|
-
} catch (readError) {
|
|
8610
|
-
const errCode = readError.code;
|
|
8611
|
-
if (errCode !== "ENOENT" && errCode !== "EACCES") {
|
|
8612
|
-
console.debug(`Could not read ${fileAbsPath}: ${readError.message}`);
|
|
8646
|
+
const item = JSON.parse(line);
|
|
8647
|
+
if (item.type === "match") {
|
|
8648
|
+
const match = item;
|
|
8649
|
+
allMatches.push({
|
|
8650
|
+
filePath: path9.relative(targetDir, match.data.path.text) || path9.basename(match.data.path.text),
|
|
8651
|
+
lineNumber: match.data.line_number,
|
|
8652
|
+
line: match.data.lines.text.trimEnd()
|
|
8653
|
+
// Remove trailing newline
|
|
8654
|
+
});
|
|
8655
|
+
} else if (item.type === "summary") {
|
|
8656
|
+
const stats = item;
|
|
8657
|
+
filesSearched = stats.data.stats.searches || 0;
|
|
8613
8658
|
}
|
|
8659
|
+
} catch {
|
|
8660
|
+
continue;
|
|
8614
8661
|
}
|
|
8615
8662
|
}
|
|
8616
8663
|
const searchDirDisplay = dir_path || ".";
|
|
8617
8664
|
const filterInfo = include ? ` (filter: "${include}")` : "";
|
|
8665
|
+
const maxMatches = 500;
|
|
8618
8666
|
if (allMatches.length === 0) {
|
|
8619
8667
|
return `No matches found for pattern "${pattern}" in "${searchDirDisplay}"${filterInfo}.
|
|
8620
8668
|
Searched ${filesSearched} file(s).`;
|
|
@@ -8624,7 +8672,6 @@ Searched ${filesSearched} file(s).`;
|
|
|
8624
8672
|
acc[match.filePath] = [];
|
|
8625
8673
|
}
|
|
8626
8674
|
acc[match.filePath].push(match);
|
|
8627
|
-
acc[match.filePath].sort((a, b) => a.lineNumber - b.lineNumber);
|
|
8628
8675
|
return acc;
|
|
8629
8676
|
}, {});
|
|
8630
8677
|
const matchCount = allMatches.length;
|
|
@@ -9504,7 +9551,7 @@ var ToolErrorType;
|
|
|
9504
9551
|
|
|
9505
9552
|
// src/utils/diffPreview.ts
|
|
9506
9553
|
import * as Diff from "diff";
|
|
9507
|
-
import { readFile
|
|
9554
|
+
import { readFile } from "fs/promises";
|
|
9508
9555
|
import { existsSync as existsSync7 } from "fs";
|
|
9509
9556
|
async function generateFileDiffPreview(args) {
|
|
9510
9557
|
try {
|
|
@@ -9519,7 +9566,7 @@ ${preview}${hasMore ? `
|
|
|
9519
9566
|
|
|
9520
9567
|
... (${lines2.length - 20} more lines)` : ""}`;
|
|
9521
9568
|
}
|
|
9522
|
-
const currentContent = await
|
|
9569
|
+
const currentContent = await readFile(args.path, "utf-8");
|
|
9523
9570
|
const patch = Diff.createPatch(
|
|
9524
9571
|
args.path,
|
|
9525
9572
|
currentContent,
|
|
@@ -11430,7 +11477,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
11430
11477
|
// package.json
|
|
11431
11478
|
var package_default = {
|
|
11432
11479
|
name: "@bike4mind/cli",
|
|
11433
|
-
version: "0.2.
|
|
11480
|
+
version: "0.2.16-feat-6197-optimize-agent-system-prompt.17611+487ef8eb0",
|
|
11434
11481
|
type: "module",
|
|
11435
11482
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
11436
11483
|
license: "UNLICENSED",
|
|
@@ -11536,11 +11583,11 @@ var package_default = {
|
|
|
11536
11583
|
zustand: "^4.5.4"
|
|
11537
11584
|
},
|
|
11538
11585
|
devDependencies: {
|
|
11539
|
-
"@bike4mind/agents": "
|
|
11540
|
-
"@bike4mind/common": "
|
|
11541
|
-
"@bike4mind/mcp": "
|
|
11542
|
-
"@bike4mind/services": "
|
|
11543
|
-
"@bike4mind/utils": "
|
|
11586
|
+
"@bike4mind/agents": "0.1.0",
|
|
11587
|
+
"@bike4mind/common": "2.42.2-feat-6197-optimize-agent-system-prompt.17611+487ef8eb0",
|
|
11588
|
+
"@bike4mind/mcp": "1.22.2-feat-6197-optimize-agent-system-prompt.17611+487ef8eb0",
|
|
11589
|
+
"@bike4mind/services": "2.39.1-feat-6197-optimize-agent-system-prompt.17611+487ef8eb0",
|
|
11590
|
+
"@bike4mind/utils": "2.1.10-feat-6197-optimize-agent-system-prompt.17611+487ef8eb0",
|
|
11544
11591
|
"@types/better-sqlite3": "^7.6.13",
|
|
11545
11592
|
"@types/diff": "^5.0.9",
|
|
11546
11593
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -11553,7 +11600,11 @@ var package_default = {
|
|
|
11553
11600
|
tsx: "^4.21.0",
|
|
11554
11601
|
typescript: "^5.9.3",
|
|
11555
11602
|
vitest: "^3.2.4"
|
|
11556
|
-
}
|
|
11603
|
+
},
|
|
11604
|
+
optionalDependencies: {
|
|
11605
|
+
"@vscode/ripgrep": "^1.17.0"
|
|
11606
|
+
},
|
|
11607
|
+
gitHead: "487ef8eb04862f0bf13c6e4f079bbf15bc9ca515"
|
|
11557
11608
|
};
|
|
11558
11609
|
|
|
11559
11610
|
// src/config/constants.ts
|
|
@@ -11753,6 +11804,14 @@ Focus on:
|
|
|
11753
11804
|
|
|
11754
11805
|
You have read-only access. Use file_read, grep_search, and glob_files to explore.
|
|
11755
11806
|
|
|
11807
|
+
CODE SEARCH EFFICIENCY:
|
|
11808
|
+
1. Start narrow with glob_files using specific patterns (e.g., "**/*Auth*.ts")
|
|
11809
|
+
2. Then use grep_search with precise regex on narrowed results
|
|
11810
|
+
3. Finally use file_read only on relevant files
|
|
11811
|
+
4. Leverage git log to find recent changes
|
|
11812
|
+
5. Check test files first to understand feature usage
|
|
11813
|
+
6. Batch glob operations instead of multiple separate calls
|
|
11814
|
+
|
|
11756
11815
|
When you find what you're looking for, provide a clear summary including:
|
|
11757
11816
|
1. What you found (files, functions, patterns)
|
|
11758
11817
|
2. Key insights or observations
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/src-3MJEHI5W.js
CHANGED
|
File without changes
|
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
XAIImageService,
|
|
65
65
|
aiImageService,
|
|
66
66
|
buildAndSortMessages,
|
|
67
|
+
buildVoiceInstructions,
|
|
67
68
|
calculateRetryDelay,
|
|
68
69
|
calculateTotalTokenLength,
|
|
69
70
|
checkOrganizationStorageLimit,
|
|
@@ -82,6 +83,7 @@ import {
|
|
|
82
83
|
fetchAndConvertFabFiles,
|
|
83
84
|
fetchAndParseURL,
|
|
84
85
|
fetchAndProcessPreviousMessages,
|
|
86
|
+
formatVoiceHistory,
|
|
85
87
|
generateSafeEmbedding,
|
|
86
88
|
getAvailableModels,
|
|
87
89
|
getCachedSignedUrl,
|
|
@@ -127,7 +129,7 @@ import {
|
|
|
127
129
|
validateMermaidSyntax,
|
|
128
130
|
warmUpSettingsCache,
|
|
129
131
|
withRetry
|
|
130
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-6UR5ULWL.js";
|
|
131
133
|
import "./chunk-LL5J3SVB.js";
|
|
132
134
|
import {
|
|
133
135
|
Logger,
|
|
@@ -204,6 +206,7 @@ export {
|
|
|
204
206
|
XAIImageService,
|
|
205
207
|
aiImageService,
|
|
206
208
|
buildAndSortMessages,
|
|
209
|
+
buildVoiceInstructions,
|
|
207
210
|
calculateRetryDelay,
|
|
208
211
|
calculateTotalTokenLength,
|
|
209
212
|
checkOrganizationStorageLimit,
|
|
@@ -222,6 +225,7 @@ export {
|
|
|
222
225
|
fetchAndConvertFabFiles,
|
|
223
226
|
fetchAndParseURL,
|
|
224
227
|
fetchAndProcessPreviousMessages,
|
|
228
|
+
formatVoiceHistory,
|
|
225
229
|
generateSafeEmbedding,
|
|
226
230
|
getAvailableModels,
|
|
227
231
|
getCachedSignedUrl,
|
package/dist/utils-JCHWDM4Z.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bike4mind/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16-feat-6197-optimize-agent-system-prompt.17611+487ef8eb0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -30,6 +30,16 @@
|
|
|
30
30
|
"dist",
|
|
31
31
|
"bin"
|
|
32
32
|
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"dev": "tsx src/index.tsx",
|
|
35
|
+
"build": "tsup",
|
|
36
|
+
"typecheck": "tsc --noEmit",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"test:watch": "vitest",
|
|
39
|
+
"start": "node dist/index.js",
|
|
40
|
+
"prepublishOnly": "pnpm build",
|
|
41
|
+
"postinstall": "node -e \"try { require('better-sqlite3') } catch(e) { if(e.message.includes('bindings')) { console.log('\\n⚠️ Rebuilding better-sqlite3 native bindings...'); require('child_process').execSync('pnpm rebuild better-sqlite3', {stdio:'inherit'}) } }\""
|
|
42
|
+
},
|
|
33
43
|
"dependencies": {
|
|
34
44
|
"@anthropic-ai/sdk": "^0.22.0",
|
|
35
45
|
"@aws-sdk/client-apigatewaymanagementapi": "3.654.0",
|
|
@@ -96,6 +106,11 @@
|
|
|
96
106
|
"zustand": "^4.5.4"
|
|
97
107
|
},
|
|
98
108
|
"devDependencies": {
|
|
109
|
+
"@bike4mind/agents": "0.1.0",
|
|
110
|
+
"@bike4mind/common": "2.42.2-feat-6197-optimize-agent-system-prompt.17611+487ef8eb0",
|
|
111
|
+
"@bike4mind/mcp": "1.22.2-feat-6197-optimize-agent-system-prompt.17611+487ef8eb0",
|
|
112
|
+
"@bike4mind/services": "2.39.1-feat-6197-optimize-agent-system-prompt.17611+487ef8eb0",
|
|
113
|
+
"@bike4mind/utils": "2.1.10-feat-6197-optimize-agent-system-prompt.17611+487ef8eb0",
|
|
99
114
|
"@types/better-sqlite3": "^7.6.13",
|
|
100
115
|
"@types/diff": "^5.0.9",
|
|
101
116
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -107,20 +122,10 @@
|
|
|
107
122
|
"tsup": "^8.5.1",
|
|
108
123
|
"tsx": "^4.21.0",
|
|
109
124
|
"typescript": "^5.9.3",
|
|
110
|
-
"vitest": "^3.2.4"
|
|
111
|
-
"@bike4mind/agents": "0.1.0",
|
|
112
|
-
"@bike4mind/common": "2.42.1",
|
|
113
|
-
"@bike4mind/mcp": "1.22.1",
|
|
114
|
-
"@bike4mind/services": "2.39.0",
|
|
115
|
-
"@bike4mind/utils": "2.1.9"
|
|
125
|
+
"vitest": "^3.2.4"
|
|
116
126
|
},
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"test:watch": "vitest",
|
|
123
|
-
"start": "node dist/index.js",
|
|
124
|
-
"postinstall": "node -e \"try { require('better-sqlite3') } catch(e) { if(e.message.includes('bindings')) { console.log('\\n⚠️ Rebuilding better-sqlite3 native bindings...'); require('child_process').execSync('pnpm rebuild better-sqlite3', {stdio:'inherit'}) } }\""
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
+
"optionalDependencies": {
|
|
128
|
+
"@vscode/ripgrep": "^1.17.0"
|
|
129
|
+
},
|
|
130
|
+
"gitHead": "487ef8eb04862f0bf13c6e4f079bbf15bc9ca515"
|
|
131
|
+
}
|