@bike4mind/cli 0.2.30-subagent-delegation.19187 → 0.2.30

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/index.js CHANGED
@@ -5,8 +5,8 @@ import {
5
5
  getEffectiveApiKey,
6
6
  getOpenWeatherKey,
7
7
  getSerperKey
8
- } from "./chunk-KQZZPB3W.js";
9
- import "./chunk-GQGOWACU.js";
8
+ } from "./chunk-WIB75EEX.js";
9
+ import "./chunk-RUI6HNLO.js";
10
10
  import {
11
11
  ConfigStore,
12
12
  logger
@@ -14,9 +14,9 @@ import {
14
14
  import {
15
15
  selectActiveBackgroundAgents,
16
16
  useCliStore
17
- } from "./chunk-TVW4ZESU.js";
18
- import "./chunk-GOOE52BP.js";
19
- import "./chunk-SKXKWSBL.js";
17
+ } from "./chunk-BYXFQJYT.js";
18
+ import "./chunk-LLA44SW7.js";
19
+ import "./chunk-U63VANTQ.js";
20
20
  import {
21
21
  BFLImageService,
22
22
  BaseStorage,
@@ -28,7 +28,7 @@ import {
28
28
  OpenAIBackend,
29
29
  OpenAIImageService,
30
30
  XAIImageService
31
- } from "./chunk-LCUAB2XL.js";
31
+ } from "./chunk-BQAPZP5Y.js";
32
32
  import {
33
33
  AiEvents,
34
34
  ApiKeyEvents,
@@ -84,7 +84,7 @@ import {
84
84
  XAI_IMAGE_MODELS,
85
85
  b4mLLMTools,
86
86
  getMcpProviderMetadata
87
- } from "./chunk-HHCCCOKK.js";
87
+ } from "./chunk-T4VPCTBM.js";
88
88
  import {
89
89
  Logger
90
90
  } from "./chunk-OCYRD7D6.js";
@@ -120,10 +120,22 @@ import { Box as Box4, Text as Text5, useInput as useInput2 } from "ink";
120
120
  // src/components/CustomTextInput.tsx
121
121
  import React2, { useEffect, useRef, useState } from "react";
122
122
  import { Text as Text2, useInput } from "ink";
123
+
124
+ // src/config/constants.ts
125
+ var USAGE_DAYS = 30;
126
+ var MODEL_NAME_COLUMN_WIDTH = 18;
127
+ var USAGE_CACHE_TTL = 5 * 60 * 1e3;
128
+ var PASTE_LINE_THRESHOLD = 5;
129
+ var MAX_PASTE_SIZE = 5e5;
130
+ var IMAGE_DETECTION_MAX_LENGTH = 500;
131
+
132
+ // src/components/CustomTextInput.tsx
123
133
  function CustomTextInput({
124
134
  value,
125
135
  onChange,
126
136
  onSubmit,
137
+ onPaste,
138
+ pasteIndicator,
127
139
  placeholder = "",
128
140
  showCursor = true,
129
141
  disabled = false
@@ -275,6 +287,11 @@ function CustomTextInput({
275
287
  }
276
288
  }
277
289
  if (key.backspace || key.delete) {
290
+ if (pasteIndicator) {
291
+ onChange("");
292
+ setCursorOffset(0);
293
+ return;
294
+ }
278
295
  if (cursorOffset > 0) {
279
296
  const newValue = value.slice(0, cursorOffset - 1) + value.slice(cursorOffset);
280
297
  onChange(newValue);
@@ -291,6 +308,20 @@ function CustomTextInput({
291
308
  return;
292
309
  }
293
310
  if (!key.ctrl && !key.meta && input.length > 0) {
311
+ if (input.length > 1 && onPaste) {
312
+ const normalized = input.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
313
+ const lineCount = normalized.split("\n").length;
314
+ if (lineCount >= PASTE_LINE_THRESHOLD) {
315
+ onPaste(normalized);
316
+ return;
317
+ }
318
+ }
319
+ if (pasteIndicator) {
320
+ const sanitizedInput2 = input === "\r" ? "\n" : input;
321
+ onChange(sanitizedInput2);
322
+ setCursorOffset(sanitizedInput2.length);
323
+ return;
324
+ }
294
325
  const sanitizedInput = input === "\r" ? "\n" : input;
295
326
  const newValue = value.slice(0, cursorOffset) + sanitizedInput + value.slice(cursorOffset);
296
327
  onChange(newValue);
@@ -299,6 +330,9 @@ function CustomTextInput({
299
330
  },
300
331
  { isActive: !disabled }
301
332
  );
333
+ if (pasteIndicator) {
334
+ return /* @__PURE__ */ React2.createElement(Text2, null, /* @__PURE__ */ React2.createElement(Text2, { color: "yellow" }, pasteIndicator), showCursor && /* @__PURE__ */ React2.createElement(Text2, { inverse: true }, " "));
335
+ }
302
336
  const hasValue = value.length > 0;
303
337
  if (!hasValue) {
304
338
  return /* @__PURE__ */ React2.createElement(Text2, null, showCursor ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Text2, { inverse: true }, " "), /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, placeholder)) : /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, placeholder));
@@ -1041,8 +1075,11 @@ function InputPrompt({
1041
1075
  onBashModeChange
1042
1076
  }) {
1043
1077
  const value = useCliStore((state) => state.inputValue);
1044
- const setInputValue = useCliStore((state) => state.setInputValue);
1045
- const setValue = setInputValue;
1078
+ const setValue = useCliStore((state) => state.setInputValue);
1079
+ const pastedContent = useCliStore((state) => state.pastedContent);
1080
+ const pastedLineCount = useCliStore((state) => state.pastedLineCount);
1081
+ const setPastedContent = useCliStore((state) => state.setPastedContent);
1082
+ const clearPaste = useCliStore((state) => state.clearPaste);
1046
1083
  const [selectedIndex, setSelectedIndex] = useState3(0);
1047
1084
  const [historyIndex, setHistoryIndex] = useState3(-1);
1048
1085
  const [tempInput, setTempInput] = useState3("");
@@ -1059,7 +1096,7 @@ function InputPrompt({
1059
1096
  useEffect3(() => {
1060
1097
  onBashModeChange?.(isBashMode);
1061
1098
  }, [isBashMode, onBashModeChange]);
1062
- const shouldShowCommandAutocomplete = value.startsWith("/") && !disabled && !fileAutocomplete?.active && !looksLikeFilePath(value);
1099
+ const shouldShowCommandAutocomplete = value.startsWith("/") && !disabled && !fileAutocomplete?.active && !looksLikeFilePath(value) && !pastedContent;
1063
1100
  const commandQuery = shouldShowCommandAutocomplete ? value.slice(1) : "";
1064
1101
  const filteredCommands = useMemo(() => {
1065
1102
  if (!shouldShowCommandAutocomplete) return [];
@@ -1166,7 +1203,14 @@ function InputPrompt({
1166
1203
  }
1167
1204
  };
1168
1205
  const handleSubmit = (input) => {
1169
- if (disabled || !input.trim()) return;
1206
+ if (disabled) return;
1207
+ if (pastedContent) {
1208
+ const fullContent = pastedContent;
1209
+ clearPaste();
1210
+ onSubmit(fullContent);
1211
+ return;
1212
+ }
1213
+ if (!input.trim()) return;
1170
1214
  if (fileAutocomplete?.active && filteredFiles.length > 0) {
1171
1215
  const selectedFile = filteredFiles[fileSelectedIndex];
1172
1216
  if (selectedFile) {
@@ -1202,13 +1246,23 @@ function InputPrompt({
1202
1246
  setHistoryIndex(-1);
1203
1247
  setFileAutocomplete(null);
1204
1248
  };
1249
+ const handlePaste = (content) => {
1250
+ const truncated = content.length > MAX_PASTE_SIZE ? content.slice(0, MAX_PASTE_SIZE) : content;
1251
+ const lineCount = truncated.split("\n").length;
1252
+ setPastedContent(truncated, lineCount);
1253
+ };
1205
1254
  const handleChange = async (newValue) => {
1206
- if (ImageInputDetector.containsImageData(newValue)) {
1207
- const imageEvent = ImageInputDetector.extractImageData(newValue);
1208
- if (imageEvent && onImageDetected) {
1209
- const placeholder = await onImageDetected(imageEvent.data);
1210
- setValue(`${placeholder} `);
1211
- return;
1255
+ if (pastedContent) {
1256
+ clearPaste();
1257
+ }
1258
+ if (newValue.length <= IMAGE_DETECTION_MAX_LENGTH) {
1259
+ if (ImageInputDetector.containsImageData(newValue)) {
1260
+ const imageEvent = ImageInputDetector.extractImageData(newValue);
1261
+ if (imageEvent && onImageDetected) {
1262
+ const placeholder = await onImageDetected(imageEvent.data);
1263
+ setValue(`${placeholder} `);
1264
+ return;
1265
+ }
1212
1266
  }
1213
1267
  }
1214
1268
  setValue(newValue);
@@ -1239,6 +1293,8 @@ function InputPrompt({
1239
1293
  value,
1240
1294
  onChange: handleChange,
1241
1295
  onSubmit: handleSubmit,
1296
+ onPaste: handlePaste,
1297
+ pasteIndicator: pastedContent ? `[pasted +${pastedLineCount} lines]` : null,
1242
1298
  placeholder: getPlaceholder(),
1243
1299
  showCursor: !disabled,
1244
1300
  disabled
@@ -3332,8 +3388,7 @@ ${options.context}` : this.getSystemPrompt()
3332
3388
  maxTokens,
3333
3389
  temperature,
3334
3390
  abortSignal: options.signal,
3335
- tool_choice: this.context.toolChoice,
3336
- executeTools: false
3391
+ tool_choice: this.context.toolChoice
3337
3392
  },
3338
3393
  async (texts, completionInfo) => {
3339
3394
  for (const text of texts) {
@@ -11653,6 +11708,20 @@ var generateTools = (userId, user, logger2, { db }, storage, imageGenerateStorag
11653
11708
  [key]: tool.implementation(context, config[key])
11654
11709
  }), {});
11655
11710
  };
11711
+ function normalizeToolParameters(rest) {
11712
+ const rawParameters = rest?.input_schema ?? rest?.inputSchema ?? rest?.parameters;
11713
+ if (rawParameters && typeof rawParameters === "object") {
11714
+ return {
11715
+ ...rawParameters,
11716
+ properties: rawParameters.properties ?? {}
11717
+ };
11718
+ }
11719
+ return {
11720
+ type: "object",
11721
+ properties: {},
11722
+ additionalProperties: true
11723
+ };
11724
+ }
11656
11725
  var ATLASSIAN_RECONNECT_MESSAGE = "\u26A0\uFE0F Your Atlassian connection has expired.\n\nPlease reconnect your Atlassian account in Settings > Connected Apps to continue using Confluence and Jira tools.";
11657
11726
  var generateMcpTools = async (mcpData) => {
11658
11727
  let tools;
@@ -11679,12 +11748,7 @@ var generateMcpTools = async (mcpData) => {
11679
11748
  const namespacedToolName = `${serverName}__${originalToolName}`;
11680
11749
  const providerMetadata = getMcpProviderMetadata(serverName);
11681
11750
  const fallbackDescription = providerMetadata?.defaultToolDescriptions?.[originalToolName] ?? "";
11682
- const rawParameters = rest?.input_schema ?? rest?.inputSchema ?? rest?.parameters;
11683
- const parameters = rawParameters && typeof rawParameters === "object" ? rawParameters : {
11684
- type: "object",
11685
- properties: {},
11686
- additionalProperties: true
11687
- };
11751
+ const parameters = normalizeToolParameters(rest);
11688
11752
  const optionTools = {
11689
11753
  toolFn: async (args) => {
11690
11754
  Logger.debug(`Calling ${originalToolName} tool via ${mcpData.serverName}`, args);
@@ -11737,282 +11801,6 @@ var generateMcpTools = async (mcpData) => {
11737
11801
  return result;
11738
11802
  };
11739
11803
 
11740
- // ../../b4m-core/packages/services/dist/src/llm/agents/ExploreAgent.js
11741
- var ExploreAgent = (config) => ({
11742
- name: "explore",
11743
- description: "Fast research, exploration, and information search",
11744
- model: config?.model ?? "claude-3-5-haiku-20241022",
11745
- defaultThoroughness: config?.defaultThoroughness ?? "medium",
11746
- maxIterations: { quick: 2, medium: 5, very_thorough: 10 },
11747
- deniedTools: [
11748
- "image_generation",
11749
- "edit_image",
11750
- "deep_research",
11751
- "delegate_to_agent",
11752
- ...config?.extraDeniedTools ?? []
11753
- ],
11754
- allowedTools: config?.extraAllowedTools,
11755
- systemPrompt: `You are a research and exploration specialist. Your job is to search and analyze information efficiently.
11756
-
11757
- ## Focus Areas
11758
- - Finding relevant information across knowledge bases and the web
11759
- - Understanding context and patterns
11760
- - Providing clear, concise summaries
11761
-
11762
- ## Tool Usage
11763
- Use these tools strategically:
11764
- - \`web_search\` - Search the web for information
11765
- - \`web_fetch\` - Fetch and read full webpage content
11766
- - \`search_knowledge_base\` - Search the user's knowledge bases
11767
- - \`current_datetime\` - Get the current date and time
11768
-
11769
- ## Search Strategy
11770
- 1. Start with targeted searches using specific keywords
11771
- 2. Use web_fetch to read full content from promising results
11772
- 3. Cross-reference findings from multiple sources
11773
- 4. Check knowledge bases for relevant internal information
11774
-
11775
- ## Output Format
11776
- Provide a clear summary including:
11777
- 1. What you found (key facts, sources, patterns)
11778
- 2. Key insights or observations
11779
- 3. Relevant source references
11780
-
11781
- Be thorough but concise. Your summary will be used by the main agent.`
11782
- });
11783
-
11784
- // ../../b4m-core/packages/services/dist/src/llm/agents/PlanAgent.js
11785
- var PlanAgent = (config) => ({
11786
- name: "plan",
11787
- description: "Task breakdown and implementation planning",
11788
- model: config?.model ?? "claude-3-5-haiku-20241022",
11789
- defaultThoroughness: config?.defaultThoroughness ?? "medium",
11790
- maxIterations: { quick: 3, medium: 7, very_thorough: 12 },
11791
- deniedTools: [
11792
- "image_generation",
11793
- "edit_image",
11794
- "deep_research",
11795
- "delegate_to_agent",
11796
- ...config?.extraDeniedTools ?? []
11797
- ],
11798
- allowedTools: config?.extraAllowedTools,
11799
- systemPrompt: `You are a task planning specialist. Your job is to break down complex tasks into clear, actionable steps.
11800
-
11801
- ## Focus Areas
11802
- - Identifying dependencies and blockers
11803
- - Creating logical sequence of steps
11804
- - Researching context before planning
11805
-
11806
- ## Process
11807
- 1. First, research the topic to understand the current landscape
11808
- 2. Identify what already exists vs. what needs to be done
11809
- 3. Break down work into discrete, actionable steps
11810
- 4. Order steps by dependencies
11811
-
11812
- ## Output Format
11813
- Provide a structured plan:
11814
-
11815
- ### Prerequisites
11816
- - What must exist before starting
11817
-
11818
- ### Steps
11819
- 1. Step with clear deliverable
11820
- 2. Next step (depends on: Step 1)
11821
- ...
11822
-
11823
- ### Risks & Considerations
11824
- - Potential issues to watch for
11825
-
11826
- Be specific and actionable. Your plan will be used by the main agent.`
11827
- });
11828
-
11829
- // ../../b4m-core/packages/services/dist/src/llm/agents/CodeReviewAgent.js
11830
- var CodeReviewAgent = (config) => ({
11831
- name: "code_review",
11832
- description: "Code review specialist for analyzing code quality, bugs, and improvements",
11833
- model: config?.model ?? "claude-sonnet-4-5-20250929",
11834
- defaultThoroughness: config?.defaultThoroughness ?? "medium",
11835
- maxIterations: { quick: 3, medium: 8, very_thorough: 15 },
11836
- deniedTools: ["image_generation", "edit_image", "delegate_to_agent", ...config?.extraDeniedTools ?? []],
11837
- allowedTools: config?.extraAllowedTools,
11838
- systemPrompt: `You are a code review specialist. Your job is to analyze code for quality, correctness, security, and maintainability.
11839
-
11840
- ## Focus Areas
11841
- - Bugs, logic errors, and edge cases
11842
- - Security vulnerabilities (injection, auth issues, data exposure)
11843
- - Code quality and readability
11844
- - Performance concerns
11845
- - Adherence to project patterns and conventions
11846
-
11847
- ## Review Process
11848
- 1. Understand the context and intent of the code changes
11849
- 2. Check for bugs, logic errors, and unhandled edge cases
11850
- 3. Identify security vulnerabilities and data handling issues
11851
- 4. Evaluate code clarity, naming, and structure
11852
- 5. Look for performance problems or unnecessary complexity
11853
-
11854
- ## Output Format
11855
- Provide actionable feedback:
11856
-
11857
- ### Critical Issues
11858
- - Bugs, security vulnerabilities, or correctness problems that must be fixed
11859
-
11860
- ### Suggestions
11861
- - Code quality improvements with rationale
11862
-
11863
- ### Positive Observations
11864
- - Well-implemented patterns worth noting (optional)
11865
-
11866
- Focus on actionable, specific feedback referencing exact code locations. Your review will be used by the main agent.`
11867
- });
11868
-
11869
- // ../../b4m-core/packages/services/dist/src/llm/agents/ProjectManagerAgent.js
11870
- var ProjectManagerAgent = (config) => ({
11871
- name: "project_manager",
11872
- description: "Project management via Jira and Confluence (create issues, search, update status, write docs). ALWAYS delegate Jira/Confluence requests to this agent \u2014 you do not have direct access to these tools",
11873
- model: config?.model ?? "claude-sonnet-4-5-20250929",
11874
- defaultThoroughness: config?.defaultThoroughness ?? "medium",
11875
- maxIterations: { quick: 3, medium: 8, very_thorough: 15 },
11876
- allowedTools: [...config?.extraAllowedTools ?? []],
11877
- deniedTools: [...config?.extraDeniedTools ?? []],
11878
- exclusiveMcpServers: ["atlassian"],
11879
- systemPrompt: `You are a project management specialist with access to Jira and Confluence. Your job is to help manage projects, issues, documentation, and team workflows.
11880
-
11881
- ## Capabilities
11882
-
11883
- ### Jira
11884
- - Search for issues using JQL
11885
- - Create, update, and transition issues
11886
- - Add comments and manage watchers
11887
- - List projects and issue types
11888
-
11889
- ### Confluence
11890
- - Search for documentation
11891
- - Create and update pages
11892
- - Browse spaces and page hierarchies
11893
-
11894
- ## Best Practices
11895
- 1. When searching Jira, use precise JQL queries (e.g., \`project = PROJ AND status = "In Progress"\`)
11896
- 2. When creating issues, always check available issue types first with \`atlassian__jira_list_issue_types\`
11897
- 3. When updating issue status, use \`atlassian__jira_update_issue_transition\` with the target status name
11898
- 4. When creating Confluence pages, use the user's personal space if no space is specified
11899
- 5. Always confirm destructive operations (delete) with the user before proceeding
11900
-
11901
- ## Output Format
11902
- Provide a clear summary of actions taken:
11903
- 1. What was done (created, updated, searched, etc.)
11904
- 2. Links or keys to relevant items (e.g., PROJ-123)
11905
- 3. Any issues or warnings encountered
11906
-
11907
- Be precise with issue keys and project names. Your results will be used by the main agent.`
11908
- });
11909
-
11910
- // ../../b4m-core/packages/services/dist/src/llm/agents/GithubManagerAgent.js
11911
- var GithubManagerAgent = (config) => ({
11912
- name: "github_manager",
11913
- description: "GitHub operations (issues, pull requests, code search, branches, workflows, reviews). ALWAYS delegate GitHub requests to this agent \u2014 you do not have direct access to these tools",
11914
- model: config?.model ?? "claude-sonnet-4-5-20250929",
11915
- defaultThoroughness: config?.defaultThoroughness ?? "medium",
11916
- maxIterations: { quick: 3, medium: 8, very_thorough: 15 },
11917
- allowedTools: [...config?.extraAllowedTools ?? []],
11918
- deniedTools: [...config?.extraDeniedTools ?? []],
11919
- exclusiveMcpServers: ["github"],
11920
- systemPrompt: `You are a GitHub specialist with access to GitHub's API. Your job is to help manage repositories, issues, pull requests, code search, branches, and CI/CD workflows.
11921
-
11922
- ## First Step: Resolve Repository Context
11923
- ALWAYS start by calling the \`github__current_user\` tool. The response includes:
11924
- - **selected_repositories**: The list of repositories the user has enabled for AI access (in \`owner/repo\` format)
11925
- - **user**: The authenticated user's profile (login, name, etc.)
11926
-
11927
- Use this to resolve the owner and repo name when the user does not specify them. If only one repository is selected, default to that repository. If multiple are selected and the user's request is ambiguous, mention the available repositories and ask for clarification via your response.
11928
-
11929
- ## Capabilities
11930
-
11931
- ### Issues
11932
- - Create, update, and search issues
11933
- - Add comments and manage labels
11934
- - List and filter issues by state, assignee, labels
11935
-
11936
- ### Pull Requests
11937
- - Create, update, and list pull requests
11938
- - Get PR diffs, files changed, and review status
11939
- - Merge pull requests and manage reviews
11940
- - Request reviews from team members
11941
-
11942
- ### Code & Repository
11943
- - Search code across repositories
11944
- - Get file contents and commit history
11945
- - Create and list branches and tags
11946
- - Fork repositories
11947
-
11948
- ### CI/CD & Workflows
11949
- - List and monitor workflow runs
11950
- - Get job logs for debugging failures
11951
- - Re-run failed jobs or entire workflows
11952
- - Download workflow artifacts
11953
-
11954
- ### Notifications
11955
- - List and manage GitHub notifications
11956
- - Mark notifications as read/done
11957
-
11958
- ## Best Practices
11959
- 1. When searching issues or PRs, use GitHub search syntax (e.g., \`is:open label:bug assignee:username\`)
11960
- 2. When creating PRs, always include a clear title and description
11961
- 3. When reviewing PR changes, use \`get_pull_request_diff\` or \`get_pull_request_files\` for context
11962
- 4. For CI/CD debugging, use \`get_job_logs\` with \`failed_only=true\` to focus on failures
11963
- 5. Always include links to issues/PRs in your responses (e.g., owner/repo#123)
11964
-
11965
- ## Output Format
11966
- Provide a clear summary of actions taken:
11967
- 1. What was done (created, searched, merged, etc.)
11968
- 2. Links to relevant items (e.g., owner/repo#123, PR URLs)
11969
- 3. Any issues or warnings encountered
11970
-
11971
- Be precise with repository names, issue numbers, and PR numbers. Your results will be used by the main agent.`
11972
- });
11973
-
11974
- // ../../b4m-core/packages/services/dist/src/llm/agents/ServerAgentStore.js
11975
- var ServerAgentStore = class {
11976
- constructor() {
11977
- const builtInAgents = [
11978
- ExploreAgent(),
11979
- PlanAgent(),
11980
- CodeReviewAgent(),
11981
- ProjectManagerAgent(),
11982
- GithubManagerAgent()
11983
- ];
11984
- this.agents = new Map(builtInAgents.map((a) => [a.name, a]));
11985
- }
11986
- getAgent(name) {
11987
- return this.agents.get(name);
11988
- }
11989
- getAllAgents() {
11990
- return Array.from(this.agents.values());
11991
- }
11992
- getAgentNames() {
11993
- return Array.from(this.agents.keys());
11994
- }
11995
- hasAgent(name) {
11996
- return this.agents.has(name);
11997
- }
11998
- /**
11999
- * Get the deduplicated list of MCP server names that are exclusive to agents.
12000
- * Derived from each agent's `exclusiveMcpServers` field.
12001
- */
12002
- getExclusiveMcpServers() {
12003
- const servers = /* @__PURE__ */ new Set();
12004
- for (const agent of this.agents.values()) {
12005
- if (agent.exclusiveMcpServers) {
12006
- for (const s of agent.exclusiveMcpServers) {
12007
- servers.add(s);
12008
- }
12009
- }
12010
- }
12011
- return Array.from(servers);
12012
- }
12013
- };
12014
- var serverAgentStore = new ServerAgentStore();
12015
-
12016
11804
  // ../../b4m-core/packages/services/dist/src/llm/ChatCompletionProcess.js
12017
11805
  import throttle2 from "lodash/throttle.js";
12018
11806
 
@@ -12878,7 +12666,7 @@ async function executeCommandHook(hook, context) {
12878
12666
  }
12879
12667
  }
12880
12668
  var MAX_PATTERN_LENGTH = 200;
12881
- function matchesToolPattern2(toolName, pattern) {
12669
+ function matchesToolPattern(toolName, pattern) {
12882
12670
  if (pattern.length > MAX_PATTERN_LENGTH) {
12883
12671
  console.warn(`Hook pattern exceeds max length (${MAX_PATTERN_LENGTH}), skipping: ${pattern.slice(0, 50)}...`);
12884
12672
  return false;
@@ -12896,7 +12684,7 @@ async function executeHooks(hooks, context) {
12896
12684
  }
12897
12685
  const matchingHooks = [];
12898
12686
  for (const matcher of hooks) {
12899
- const shouldMatch = !matcher.matcher || !context.tool_name || matchesToolPattern2(context.tool_name, matcher.matcher);
12687
+ const shouldMatch = !matcher.matcher || !context.tool_name || matchesToolPattern(context.tool_name, matcher.matcher);
12900
12688
  if (shouldMatch) {
12901
12689
  matchingHooks.push(...matcher.hooks);
12902
12690
  }
@@ -13041,7 +12829,7 @@ function wrapToolWithPermission(tool, permissionManager, showPermissionPrompt, a
13041
12829
  agentContext.observationQueue.push({ toolName, result: result2 });
13042
12830
  return result2;
13043
12831
  }
13044
- const { useCliStore: useCliStore2 } = await import("./store-FU6NDC2W.js");
12832
+ const { useCliStore: useCliStore2 } = await import("./store-K5MB3SE7.js");
13045
12833
  if (useCliStore2.getState().autoAcceptEdits) {
13046
12834
  const result2 = await executeTool(toolName, args, apiClient, originalFn);
13047
12835
  agentContext.observationQueue.push({ toolName, result: result2 });
@@ -14913,7 +14701,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
14913
14701
  // package.json
14914
14702
  var package_default = {
14915
14703
  name: "@bike4mind/cli",
14916
- version: "0.2.30-subagent-delegation.19187+ecf85d412",
14704
+ version: "0.2.30",
14917
14705
  type: "module",
14918
14706
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
14919
14707
  license: "UNLICENSED",
@@ -14984,13 +14772,10 @@ var package_default = {
14984
14772
  diff: "^8.0.2",
14985
14773
  dotenv: "^16.3.1",
14986
14774
  "eventsource-parser": "^3.0.6",
14987
- fdir: "^6.5.0",
14988
14775
  "file-type": "^18.7.0",
14989
14776
  "fuse.js": "^7.1.0",
14990
- fzf: "^0.5.2",
14991
14777
  glob: "^13.0.0",
14992
14778
  "gray-matter": "^4.0.3",
14993
- ignore: "^7.0.5",
14994
14779
  ink: "^6.5.1",
14995
14780
  "ink-select-input": "^6.2.0",
14996
14781
  "ink-spinner": "^5.0.0",
@@ -15027,10 +14812,10 @@ var package_default = {
15027
14812
  },
15028
14813
  devDependencies: {
15029
14814
  "@bike4mind/agents": "0.1.0",
15030
- "@bike4mind/common": "2.51.1-subagent-delegation.19187+ecf85d412",
15031
- "@bike4mind/mcp": "1.30.1-subagent-delegation.19187+ecf85d412",
15032
- "@bike4mind/services": "2.49.1-subagent-delegation.19187+ecf85d412",
15033
- "@bike4mind/utils": "2.6.1-subagent-delegation.19187+ecf85d412",
14815
+ "@bike4mind/common": "2.52.0",
14816
+ "@bike4mind/mcp": "1.31.0",
14817
+ "@bike4mind/services": "2.50.0",
14818
+ "@bike4mind/utils": "2.7.0",
15034
14819
  "@types/better-sqlite3": "^7.6.13",
15035
14820
  "@types/diff": "^5.0.9",
15036
14821
  "@types/jsonwebtoken": "^9.0.4",
@@ -15039,6 +14824,9 @@ var package_default = {
15039
14824
  "@types/react": "^19.2.7",
15040
14825
  "@types/uuid": "^9.0.7",
15041
14826
  "@types/yargs": "^17.0.32",
14827
+ fdir: "^6.5.0",
14828
+ fzf: "^0.5.2",
14829
+ ignore: "^7.0.5",
15042
14830
  "ink-testing-library": "^4.0.0",
15043
14831
  tsup: "^8.5.1",
15044
14832
  tsx: "^4.21.0",
@@ -15048,34 +14836,29 @@ var package_default = {
15048
14836
  optionalDependencies: {
15049
14837
  "@vscode/ripgrep": "^1.17.0"
15050
14838
  },
15051
- gitHead: "ecf85d41288dcde8661ce267f88ff583aa044b79"
14839
+ gitHead: "e18c60eb7133cb85a538c4d87ccfafc6c95fc211"
15052
14840
  };
15053
14841
 
15054
- // src/config/constants.ts
15055
- var USAGE_DAYS = 30;
15056
- var MODEL_NAME_COLUMN_WIDTH = 18;
15057
- var USAGE_CACHE_TTL = 5 * 60 * 1e3;
15058
-
15059
14842
  // src/agents/toolFilter.ts
15060
- function matchesToolPattern3(toolName, pattern) {
14843
+ function matchesToolPattern2(toolName, pattern) {
15061
14844
  const regexPattern = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
15062
14845
  return new RegExp(`^${regexPattern}$`).test(toolName);
15063
14846
  }
15064
- function matchesAnyPattern2(toolName, patterns) {
15065
- return patterns.some((pattern) => matchesToolPattern3(toolName, pattern));
14847
+ function matchesAnyPattern(toolName, patterns) {
14848
+ return patterns.some((pattern) => matchesToolPattern2(toolName, pattern));
15066
14849
  }
15067
- function filterToolsByPatterns2(allTools, allowedPatterns, deniedPatterns) {
14850
+ function filterToolsByPatterns(allTools, allowedPatterns, deniedPatterns) {
15068
14851
  return allTools.filter((tool) => {
15069
14852
  const toolName = tool.toolSchema.name;
15070
14853
  if (deniedPatterns && deniedPatterns.length > 0) {
15071
- if (matchesAnyPattern2(toolName, deniedPatterns)) {
14854
+ if (matchesAnyPattern(toolName, deniedPatterns)) {
15072
14855
  return false;
15073
14856
  }
15074
14857
  }
15075
14858
  if (!allowedPatterns || allowedPatterns.length === 0) {
15076
14859
  return true;
15077
14860
  }
15078
- return matchesAnyPattern2(toolName, allowedPatterns);
14861
+ return matchesAnyPattern(toolName, allowedPatterns);
15079
14862
  });
15080
14863
  }
15081
14864
 
@@ -15346,7 +15129,7 @@ var SubagentOrchestrator = class {
15346
15129
  this.deps.configStore,
15347
15130
  this.deps.apiClient
15348
15131
  );
15349
- const filteredTools = filterToolsByPatterns2(allTools, toolFilter.allowedTools, toolFilter.deniedTools);
15132
+ const filteredTools = filterToolsByPatterns(allTools, toolFilter.allowedTools, toolFilter.deniedTools);
15350
15133
  if (this.deps.customCommandStore) {
15351
15134
  const skillTool = createSkillTool({
15352
15135
  customCommandStore: this.deps.customCommandStore,
@@ -16876,6 +16659,11 @@ function CliApp() {
16876
16659
  }, [state.session, state.sessionStore, state.mcpManager, state.agent, state.imageStore]);
16877
16660
  useInput9((input, key) => {
16878
16661
  if (key.escape) {
16662
+ const store = useCliStore.getState();
16663
+ if (store.pastedContent) {
16664
+ store.clearPaste();
16665
+ return;
16666
+ }
16879
16667
  if (state.abortController) {
16880
16668
  logger.debug("[ABORT] ESC pressed - aborting current operation...");
16881
16669
  state.abortController.abort();
@@ -16893,9 +16681,9 @@ function CliApp() {
16893
16681
  });
16894
16682
  } else {
16895
16683
  logger.debug("[EXIT] First Ctrl+C - press again to exit");
16896
- const currentInput = useCliStore.getState().inputValue;
16897
- if (currentInput.length > 0) {
16898
- useCliStore.getState().clearInput();
16684
+ const store = useCliStore.getState();
16685
+ if (store.inputValue.length > 0 || store.pastedContent) {
16686
+ store.clearInput();
16899
16687
  }
16900
16688
  exitTimestamp = now;
16901
16689
  setExitRequested(true);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-HHCCCOKK.js";
4
+ } from "./chunk-T4VPCTBM.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/llmMarkdownGenerator.js
7
7
  var DEFAULT_OPTIONS = {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-HHCCCOKK.js";
4
+ } from "./chunk-T4VPCTBM.js";
5
5
 
6
6
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/markdownGenerator.js
7
7
  var DEFAULT_OPTIONS = {
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  findMostSimilarMemento,
4
4
  getRelevantMementos
5
- } from "./chunk-KQZZPB3W.js";
6
- import "./chunk-LCUAB2XL.js";
7
- import "./chunk-HHCCCOKK.js";
5
+ } from "./chunk-WIB75EEX.js";
6
+ import "./chunk-BQAPZP5Y.js";
7
+ import "./chunk-T4VPCTBM.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
10
10
  findMostSimilarMemento,