@bike4mind/cli 0.2.10-slack-metrics-admin-dashboard.17277 → 0.2.11-fix-number-option-recorded.17312

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-6EQ62KRQ.js";
4
+ } from "./chunk-DJPXSSP4.js";
5
5
  import "./chunk-PDX44BCA.js";
6
6
 
7
7
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/artifactExtractor.js
@@ -7,11 +7,11 @@ import {
7
7
  getSettingsMap,
8
8
  getSettingsValue,
9
9
  secureParameters
10
- } from "./chunk-23GLLYOT.js";
10
+ } from "./chunk-GCVIRGIN.js";
11
11
  import {
12
12
  KnowledgeType,
13
13
  SupportedFabFileMimeTypes
14
- } from "./chunk-6EQ62KRQ.js";
14
+ } from "./chunk-DJPXSSP4.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/fabFileService/create.js
17
17
  import { z } from "zod";
@@ -4047,13 +4047,6 @@ var SlackEvents;
4047
4047
  SlackEvents2["SLACK_COMMAND_COMPLETED"] = "Slack Command Completed";
4048
4048
  SlackEvents2["SLACK_MCP_TOOL_INVOKED"] = "Slack MCP Tool Invoked";
4049
4049
  SlackEvents2["SLACK_BULK_OPERATION"] = "Slack Bulk Operation Executed";
4050
- SlackEvents2["COMMAND_PROCESSED"] = "Slack Command Processed";
4051
- SlackEvents2["COMMAND_FAILED"] = "Slack Command Failed";
4052
- SlackEvents2["APP_CREATED"] = "Slack App Created";
4053
- SlackEvents2["WORKSPACE_DEACTIVATED"] = "Slack Workspace Deactivated";
4054
- SlackEvents2["CHANNEL_EXPORT_STARTED"] = "Slack Channel Export Started";
4055
- SlackEvents2["CHANNEL_EXPORT_COMPLETED"] = "Slack Channel Export Completed";
4056
- SlackEvents2["CHANNEL_EXPORT_FAILED"] = "Slack Channel Export Failed";
4057
4050
  })(SlackEvents || (SlackEvents = {}));
4058
4051
 
4059
4052
  // ../../b4m-core/packages/common/dist/src/schemas/team.js
@@ -16,7 +16,7 @@ import {
16
16
  dayjsConfig_default,
17
17
  extractSnippetMeta,
18
18
  settingsMap
19
- } from "./chunk-6EQ62KRQ.js";
19
+ } from "./chunk-DJPXSSP4.js";
20
20
 
21
21
  // ../../b4m-core/packages/utils/dist/src/storage/S3Storage.js
22
22
  import { S3Client, PutObjectCommand, DeleteObjectCommand, GetObjectCommand, HeadObjectCommand } from "@aws-sdk/client-s3";
@@ -6,12 +6,12 @@ import {
6
6
  getSettingsByNames,
7
7
  obfuscateApiKey,
8
8
  secureParameters
9
- } from "./chunk-23GLLYOT.js";
9
+ } from "./chunk-GCVIRGIN.js";
10
10
  import {
11
11
  ApiKeyType,
12
12
  MementoTier,
13
13
  isSupportedEmbeddingModel
14
- } from "./chunk-6EQ62KRQ.js";
14
+ } from "./chunk-DJPXSSP4.js";
15
15
 
16
16
  // ../../b4m-core/packages/services/dist/src/apiKeyService/get.js
17
17
  import { z } from "zod";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BadRequestError,
4
4
  secureParameters
5
- } from "./chunk-23GLLYOT.js";
5
+ } from "./chunk-GCVIRGIN.js";
6
6
  import {
7
7
  GenericCreditDeductTransaction,
8
8
  ImageEditUsageTransaction,
@@ -10,7 +10,7 @@ import {
10
10
  RealtimeVoiceUsageTransaction,
11
11
  TextGenerationUsageTransaction,
12
12
  TransferCreditTransaction
13
- } from "./chunk-6EQ62KRQ.js";
13
+ } from "./chunk-DJPXSSP4.js";
14
14
 
15
15
  // ../../b4m-core/packages/services/dist/src/creditService/subtractCredits.js
16
16
  import { z } from "zod";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  createFabFile,
4
4
  createFabFileSchema
5
- } from "./chunk-E2VXQGEM.js";
6
- import "./chunk-23GLLYOT.js";
5
+ } from "./chunk-AQBZVAYO.js";
6
+ import "./chunk-GCVIRGIN.js";
7
7
  import "./chunk-AMDXHL6S.js";
8
- import "./chunk-6EQ62KRQ.js";
8
+ import "./chunk-DJPXSSP4.js";
9
9
  import "./chunk-PDX44BCA.js";
10
10
  export {
11
11
  createFabFile,
package/dist/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  getEffectiveApiKey,
5
5
  getOpenWeatherKey,
6
6
  getSerperKey
7
- } from "./chunk-TFXE7AI6.js";
8
- import "./chunk-VOOM6DLV.js";
9
- import "./chunk-E2VXQGEM.js";
7
+ } from "./chunk-GO75FMLY.js";
8
+ import "./chunk-VZU4Z7WI.js";
9
+ import "./chunk-AQBZVAYO.js";
10
10
  import {
11
11
  BFLImageService,
12
12
  BaseStorage,
@@ -15,7 +15,7 @@ import {
15
15
  OpenAIBackend,
16
16
  OpenAIImageService,
17
17
  XAIImageService
18
- } from "./chunk-23GLLYOT.js";
18
+ } from "./chunk-GCVIRGIN.js";
19
19
  import {
20
20
  Logger
21
21
  } from "./chunk-AMDXHL6S.js";
@@ -73,7 +73,7 @@ import {
73
73
  XAI_IMAGE_MODELS,
74
74
  b4mLLMTools,
75
75
  getMcpProviderMetadata
76
- } from "./chunk-6EQ62KRQ.js";
76
+ } from "./chunk-DJPXSSP4.js";
77
77
  import {
78
78
  __require
79
79
  } from "./chunk-PDX44BCA.js";
@@ -82,7 +82,7 @@ import {
82
82
  import React17, { useState as useState8, useEffect as useEffect3, useCallback, useRef as useRef2 } from "react";
83
83
  import { render, Box as Box16, Text as Text16, useApp, useInput as useInput6 } from "ink";
84
84
  import { execSync } from "child_process";
85
- import { v4 as uuidv49 } from "uuid";
85
+ import { v4 as uuidv410 } from "uuid";
86
86
 
87
87
  // src/components/App.tsx
88
88
  import React11, { useState as useState4 } from "react";
@@ -107,7 +107,8 @@ function CustomTextInput({
107
107
  onChange,
108
108
  onSubmit,
109
109
  placeholder = "",
110
- showCursor = true
110
+ showCursor = true,
111
+ disabled = false
111
112
  }) {
112
113
  const [cursorOffset, setCursorOffset] = useState(value.length);
113
114
  useInput(
@@ -188,7 +189,7 @@ function CustomTextInput({
188
189
  setCursorOffset(cursorOffset + 1);
189
190
  }
190
191
  },
191
- { isActive: true }
192
+ { isActive: !disabled }
192
193
  );
193
194
  const hasValue = value.length > 0;
194
195
  if (!hasValue) {
@@ -827,56 +828,59 @@ function InputPrompt({
827
828
  useEffect(() => {
828
829
  setFileSelectedIndex(0);
829
830
  }, [filteredFiles]);
830
- useInput2((_input, key) => {
831
- if (fileAutocomplete?.active && filteredFiles.length > 0) {
832
- if (key.upArrow) {
833
- setFileSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredFiles.length - 1);
834
- return;
835
- } else if (key.downArrow) {
836
- setFileSelectedIndex((prev) => prev < filteredFiles.length - 1 ? prev + 1 : 0);
837
- return;
838
- } else if (key.tab) {
839
- const selectedFile = filteredFiles[fileSelectedIndex];
840
- if (selectedFile) {
841
- insertSelectedFile(selectedFile);
831
+ useInput2(
832
+ (_input, key) => {
833
+ if (fileAutocomplete?.active && filteredFiles.length > 0) {
834
+ if (key.upArrow) {
835
+ setFileSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredFiles.length - 1);
836
+ return;
837
+ } else if (key.downArrow) {
838
+ setFileSelectedIndex((prev) => prev < filteredFiles.length - 1 ? prev + 1 : 0);
839
+ return;
840
+ } else if (key.tab) {
841
+ const selectedFile = filteredFiles[fileSelectedIndex];
842
+ if (selectedFile) {
843
+ insertSelectedFile(selectedFile);
844
+ }
845
+ return;
846
+ } else if (key.escape) {
847
+ setFileAutocomplete(null);
848
+ return;
842
849
  }
843
- return;
844
- } else if (key.escape) {
845
- setFileAutocomplete(null);
846
- return;
847
- }
848
- }
849
- if (shouldShowCommandAutocomplete && filteredCommands.length > 0) {
850
- if (key.upArrow) {
851
- setSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredCommands.length - 1);
852
- } else if (key.downArrow) {
853
- setSelectedIndex((prev) => prev < filteredCommands.length - 1 ? prev + 1 : 0);
854
850
  }
855
- return;
856
- }
857
- if (!shouldShowCommandAutocomplete && !fileAutocomplete?.active && history.length > 0) {
858
- if (key.upArrow) {
859
- if (historyIndex === -1) {
860
- setTempInput(value);
861
- setHistoryIndex(0);
862
- setValue(history[0]);
863
- } else if (historyIndex < history.length - 1) {
864
- const newIndex = historyIndex + 1;
865
- setHistoryIndex(newIndex);
866
- setValue(history[newIndex]);
851
+ if (shouldShowCommandAutocomplete && filteredCommands.length > 0) {
852
+ if (key.upArrow) {
853
+ setSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredCommands.length - 1);
854
+ } else if (key.downArrow) {
855
+ setSelectedIndex((prev) => prev < filteredCommands.length - 1 ? prev + 1 : 0);
867
856
  }
868
- } else if (key.downArrow) {
869
- if (historyIndex > 0) {
870
- const newIndex = historyIndex - 1;
871
- setHistoryIndex(newIndex);
872
- setValue(history[newIndex]);
873
- } else if (historyIndex === 0) {
874
- setHistoryIndex(-1);
875
- setValue(tempInput);
857
+ return;
858
+ }
859
+ if (!shouldShowCommandAutocomplete && !fileAutocomplete?.active && history.length > 0) {
860
+ if (key.upArrow) {
861
+ if (historyIndex === -1) {
862
+ setTempInput(value);
863
+ setHistoryIndex(0);
864
+ setValue(history[0]);
865
+ } else if (historyIndex < history.length - 1) {
866
+ const newIndex = historyIndex + 1;
867
+ setHistoryIndex(newIndex);
868
+ setValue(history[newIndex]);
869
+ }
870
+ } else if (key.downArrow) {
871
+ if (historyIndex > 0) {
872
+ const newIndex = historyIndex - 1;
873
+ setHistoryIndex(newIndex);
874
+ setValue(history[newIndex]);
875
+ } else if (historyIndex === 0) {
876
+ setHistoryIndex(-1);
877
+ setValue(tempInput);
878
+ }
876
879
  }
877
880
  }
878
- }
879
- });
881
+ },
882
+ { isActive: !disabled }
883
+ );
880
884
  const insertSelectedFile = (file) => {
881
885
  if (!fileAutocomplete) return;
882
886
  const beforeAt = value.slice(0, fileAutocomplete.startIndex);
@@ -970,7 +974,8 @@ function InputPrompt({
970
974
  onChange: handleChange,
971
975
  onSubmit: handleSubmit,
972
976
  placeholder: getPlaceholder(),
973
- showCursor: !disabled
977
+ showCursor: !disabled,
978
+ disabled
974
979
  }
975
980
  )), shouldShowCommandAutocomplete && /* @__PURE__ */ React5.createElement(CommandAutocomplete, { commands: filteredCommands, selectedIndex }), fileAutocomplete?.active && /* @__PURE__ */ React5.createElement(FileAutocomplete, { files: filteredFiles, selectedIndex: fileSelectedIndex, query: fileAutocomplete.query }));
976
981
  }
@@ -1523,7 +1528,7 @@ ${errorBlock}`;
1523
1528
  onSave: onSaveConfig,
1524
1529
  onClose: () => setShowConfigEditor(false)
1525
1530
  }
1526
- )) : permissionPrompt ? /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React11.createElement(
1531
+ )) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Static, { items: messages }, (message) => /* @__PURE__ */ React11.createElement(Box10, { key: message.id, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React11.createElement(MessageItem, { message }))), /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column" }, pendingMessages.map((message) => /* @__PURE__ */ React11.createElement(Box10, { key: message.id, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React11.createElement(MessageItem, { message })))), permissionPrompt && /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React11.createElement(
1527
1532
  PermissionPrompt,
1528
1533
  {
1529
1534
  toolName: permissionPrompt.toolName,
@@ -1532,13 +1537,13 @@ ${errorBlock}`;
1532
1537
  canBeTrusted: permissionPrompt.canBeTrusted,
1533
1538
  onResponse: onPermissionResponse
1534
1539
  }
1535
- )) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Static, { items: messages }, (message, index) => /* @__PURE__ */ React11.createElement(Box10, { key: `${message.timestamp}-${message.role}-${index}`, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React11.createElement(MessageItem, { message }))), /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column" }, pendingMessages.map((message, index) => /* @__PURE__ */ React11.createElement(Box10, { key: `pending-${message.timestamp}-${index}`, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React11.createElement(MessageItem, { message })))), /* @__PURE__ */ React11.createElement(AgentThinking, null), exitRequested && /* @__PURE__ */ React11.createElement(Box10, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React11.createElement(Text10, { color: "yellow", bold: true }, "Press Ctrl+C again to exit")), /* @__PURE__ */ React11.createElement(Box10, { borderStyle: "single", borderColor: isBashMode ? "yellow" : "cyan", paddingX: 1 }, /* @__PURE__ */ React11.createElement(
1540
+ )), !permissionPrompt && /* @__PURE__ */ React11.createElement(AgentThinking, null), exitRequested && /* @__PURE__ */ React11.createElement(Box10, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React11.createElement(Text10, { color: "yellow", bold: true }, "Press Ctrl+C again to exit")), /* @__PURE__ */ React11.createElement(Box10, { borderStyle: "single", borderColor: isBashMode ? "yellow" : "cyan", paddingX: 1 }, /* @__PURE__ */ React11.createElement(
1536
1541
  InputPrompt,
1537
1542
  {
1538
1543
  onSubmit: handleSubmit,
1539
1544
  onBashCommand,
1540
1545
  onImageDetected,
1541
- disabled: isThinking,
1546
+ disabled: isThinking || !!permissionPrompt,
1542
1547
  history: commandHistory,
1543
1548
  commands,
1544
1549
  prefillInput,
@@ -1932,6 +1937,7 @@ function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, o
1932
1937
  import { promises as fs3 } from "fs";
1933
1938
  import path3 from "path";
1934
1939
  import { homedir } from "os";
1940
+ import { v4 as uuidv4 } from "uuid";
1935
1941
  var SessionStore = class {
1936
1942
  constructor(basePath) {
1937
1943
  this.basePath = basePath || path3.join(homedir(), ".bike4mind", "sessions");
@@ -1967,7 +1973,14 @@ var SessionStore = class {
1967
1973
  const filePath = path3.join(this.basePath, `${id}.json`);
1968
1974
  try {
1969
1975
  const data = await fs3.readFile(filePath, "utf-8");
1970
- return JSON.parse(data);
1976
+ const session = JSON.parse(data);
1977
+ session.messages = session.messages.map((msg) => {
1978
+ if (!msg.id) {
1979
+ return { ...msg, id: uuidv4() };
1980
+ }
1981
+ return msg;
1982
+ });
1983
+ return session;
1971
1984
  } catch (error) {
1972
1985
  if (error.code === "ENOENT") {
1973
1986
  return null;
@@ -1996,7 +2009,14 @@ var SessionStore = class {
1996
2009
  jsonFiles.map(async (file) => {
1997
2010
  const filePath = path3.join(this.basePath, file);
1998
2011
  const data = await fs3.readFile(filePath, "utf-8");
1999
- return JSON.parse(data);
2012
+ const session = JSON.parse(data);
2013
+ session.messages = session.messages.map((msg) => {
2014
+ if (!msg.id) {
2015
+ return { ...msg, id: uuidv4() };
2016
+ }
2017
+ return msg;
2018
+ });
2019
+ return session;
2000
2020
  })
2001
2021
  );
2002
2022
  return sessions.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
@@ -2050,7 +2070,7 @@ var SessionStore = class {
2050
2070
  import { promises as fs4, existsSync as existsSync3 } from "fs";
2051
2071
  import path4 from "path";
2052
2072
  import { homedir as homedir2 } from "os";
2053
- import { v4 as uuidv4 } from "uuid";
2073
+ import { v4 as uuidv42 } from "uuid";
2054
2074
  import { z } from "zod";
2055
2075
  var AuthTokensSchema = z.object({
2056
2076
  accessToken: z.string(),
@@ -2144,7 +2164,7 @@ var ProjectLocalConfigSchema = z.object({
2144
2164
  });
2145
2165
  var DEFAULT_CONFIG = {
2146
2166
  version: "0.1.0",
2147
- userId: uuidv4(),
2167
+ userId: uuidv42(),
2148
2168
  defaultModel: "claude-sonnet-4-5-20250929",
2149
2169
  toolApiKeys: {
2150
2170
  openweather: void 0,
@@ -2426,7 +2446,7 @@ var ConfigStore = class {
2426
2446
  * Reset configuration to defaults
2427
2447
  */
2428
2448
  async reset() {
2429
- this.config = { ...DEFAULT_CONFIG, userId: uuidv4() };
2449
+ this.config = { ...DEFAULT_CONFIG, userId: uuidv42() };
2430
2450
  await this.save();
2431
2451
  return this.config;
2432
2452
  }
@@ -4336,7 +4356,7 @@ var listFabFilesSchema = z86.object({
4336
4356
 
4337
4357
  // ../../b4m-core/packages/services/dist/src/fabFileService/update.js
4338
4358
  import mime from "mime-types";
4339
- import { v4 as uuidv42 } from "uuid";
4359
+ import { v4 as uuidv43 } from "uuid";
4340
4360
  import { z as z87 } from "zod";
4341
4361
  var updateFabFileSchema = z87.object({
4342
4362
  id: z87.string(),
@@ -4457,7 +4477,7 @@ var editFabFileSchema = z98.object({
4457
4477
 
4458
4478
  // ../../b4m-core/packages/services/dist/src/fabFileService/applyEdit.js
4459
4479
  import mime2 from "mime-types";
4460
- import { v4 as uuidv43 } from "uuid";
4480
+ import { v4 as uuidv44 } from "uuid";
4461
4481
  import { z as z99 } from "zod";
4462
4482
  var applyEditSchema = z99.object({
4463
4483
  id: z99.string(),
@@ -5285,7 +5305,7 @@ import { toFile } from "openai/uploads";
5285
5305
  import { Readable } from "stream";
5286
5306
  import { TranscribeClient, StartTranscriptionJobCommand, GetTranscriptionJobCommand, LanguageCode, MediaFormat } from "@aws-sdk/client-transcribe";
5287
5307
  import { S3Client, PutObjectCommand, GetObjectCommand, DeleteObjectCommand } from "@aws-sdk/client-s3";
5288
- import { v4 as uuidv44 } from "uuid";
5308
+ import { v4 as uuidv45 } from "uuid";
5289
5309
 
5290
5310
  // ../../b4m-core/packages/services/dist/src/emailIngestionService/processIngestedEmail.js
5291
5311
  import { randomUUID as randomUUID5 } from "crypto";
@@ -5446,7 +5466,7 @@ var weatherTool = {
5446
5466
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/imageGeneration/index.js
5447
5467
  import axios6 from "axios";
5448
5468
  import { fileTypeFromBuffer as fileTypeFromBuffer2 } from "file-type";
5449
- import { v4 as uuidv45 } from "uuid";
5469
+ import { v4 as uuidv46 } from "uuid";
5450
5470
  async function downloadImage(url) {
5451
5471
  if (url.startsWith("data:image/")) {
5452
5472
  const base64Data = url.split(",")[1];
@@ -5460,7 +5480,7 @@ async function processAndStoreImages(images, context) {
5460
5480
  return Promise.all(images.map(async (image) => {
5461
5481
  const buffer = await downloadImage(image);
5462
5482
  const fileType = await fileTypeFromBuffer2(buffer);
5463
- const filename = `${uuidv45()}.${fileType?.ext}`;
5483
+ const filename = `${uuidv46()}.${fileType?.ext}`;
5464
5484
  const path16 = await context.imageGenerateStorage.upload(buffer, filename, {});
5465
5485
  return path16;
5466
5486
  }));
@@ -6629,7 +6649,7 @@ Return only the edited content without any markdown code blocks or explanations.
6629
6649
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/imageEdit/index.js
6630
6650
  import axios7 from "axios";
6631
6651
  import { fileTypeFromBuffer as fileTypeFromBuffer3 } from "file-type";
6632
- import { v4 as uuidv46 } from "uuid";
6652
+ import { v4 as uuidv47 } from "uuid";
6633
6653
  async function downloadImage2(url) {
6634
6654
  if (url.startsWith("data:image/")) {
6635
6655
  const base64Data = url.split(",")[1];
@@ -6673,7 +6693,7 @@ async function getImageFromFileId(fileId, context) {
6673
6693
  async function processAndStoreImage(imageUrl, context) {
6674
6694
  const buffer = await downloadImage2(imageUrl);
6675
6695
  const fileType = await fileTypeFromBuffer3(buffer);
6676
- const filename = `${uuidv46()}.${fileType?.ext}`;
6696
+ const filename = `${uuidv47()}.${fileType?.ext}`;
6677
6697
  const path16 = await context.imageGenerateStorage.upload(buffer, filename, {});
6678
6698
  return path16;
6679
6699
  }
@@ -8579,7 +8599,8 @@ var fileReadTool = {
8579
8599
  return content;
8580
8600
  } catch (error) {
8581
8601
  context.logger.error("\u274C FileRead: Failed", error);
8582
- throw error;
8602
+ const errorMessage = error instanceof Error ? error.message : String(error);
8603
+ return `Error reading file: ${errorMessage}`;
8583
8604
  }
8584
8605
  },
8585
8606
  toolSchema: {
@@ -9649,7 +9670,7 @@ var QuestStartBodySchema = z139.object({
9649
9670
  // ../../b4m-core/packages/services/dist/src/llm/ImageGeneration.js
9650
9671
  import axios8 from "axios";
9651
9672
  import { fileTypeFromBuffer as fileTypeFromBuffer4 } from "file-type";
9652
- import { v4 as uuidv47 } from "uuid";
9673
+ import { v4 as uuidv48 } from "uuid";
9653
9674
  import { z as z140 } from "zod";
9654
9675
  import { fromZodError as fromZodError2 } from "zod-validation-error";
9655
9676
  var ImageGenerationBodySchema = OpenAIImageGenerationInput.extend({
@@ -9670,7 +9691,7 @@ var ImageGenerationBodySchema = OpenAIImageGenerationInput.extend({
9670
9691
  // ../../b4m-core/packages/services/dist/src/llm/ImageEdit.js
9671
9692
  import axios9 from "axios";
9672
9693
  import { fileTypeFromBuffer as fileTypeFromBuffer5 } from "file-type";
9673
- import { v4 as uuidv48 } from "uuid";
9694
+ import { v4 as uuidv49 } from "uuid";
9674
9695
  import { z as z141 } from "zod";
9675
9696
  import { fromZodError as fromZodError3 } from "zod-validation-error";
9676
9697
  var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
@@ -10224,7 +10245,31 @@ function wrapToolWithPermission(tool, permissionManager, showPermissionPrompt, a
10224
10245
  }
10225
10246
  };
10226
10247
  }
10227
- function generateCliTools(userId, llm, model, permissionManager, showPermissionPrompt, agentContext, configStore, apiClient) {
10248
+ var TOOL_NAME_MAPPING = {
10249
+ // Claude Code -> B4M
10250
+ read: "file_read",
10251
+ write: "create_file",
10252
+ edit: "edit_file",
10253
+ delete: "delete_file",
10254
+ glob: "glob_files",
10255
+ grep: "grep_search",
10256
+ bash: "bash_execute",
10257
+ // B4M -> Claude Code (reverse mapping)
10258
+ file_read: "read",
10259
+ create_file: "write",
10260
+ edit_file: "edit",
10261
+ delete_file: "delete",
10262
+ glob_files: "glob",
10263
+ grep_search: "grep",
10264
+ bash_execute: "bash"
10265
+ };
10266
+ function normalizeToolName(toolName) {
10267
+ if (toolName.includes("_")) {
10268
+ return toolName;
10269
+ }
10270
+ return TOOL_NAME_MAPPING[toolName] || toolName;
10271
+ }
10272
+ function generateCliTools(userId, llm, model, permissionManager, showPermissionPrompt, agentContext, configStore, apiClient, toolFilter) {
10228
10273
  const logger2 = new CliLogger();
10229
10274
  const storage = new NoOpStorage();
10230
10275
  const user = {
@@ -10294,9 +10339,24 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
10294
10339
  toolConfig,
10295
10340
  model
10296
10341
  );
10297
- const tools2 = Object.entries(toolsMap).filter(([key]) => toolConfig[key] !== void 0).map(
10342
+ let tools2 = Object.entries(toolsMap).filter(([key]) => toolConfig[key] !== void 0).map(
10298
10343
  ([_, tool]) => wrapToolWithPermission(tool, permissionManager, showPermissionPrompt, agentContext, configStore, apiClient)
10299
10344
  );
10345
+ if (toolFilter) {
10346
+ const { allowedTools, deniedTools } = toolFilter;
10347
+ const normalizedAllowed = allowedTools?.map(normalizeToolName);
10348
+ const normalizedDenied = deniedTools?.map(normalizeToolName);
10349
+ tools2 = tools2.filter((tool) => {
10350
+ const toolName = tool.toolSchema.name;
10351
+ if (normalizedDenied && normalizedDenied.includes(toolName)) {
10352
+ return false;
10353
+ }
10354
+ if (normalizedAllowed && normalizedAllowed.length > 0) {
10355
+ return normalizedAllowed.includes(toolName);
10356
+ }
10357
+ return true;
10358
+ });
10359
+ }
10300
10360
  return { tools: tools2, agentContext };
10301
10361
  }
10302
10362
 
@@ -11472,7 +11532,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
11472
11532
  // package.json
11473
11533
  var package_default = {
11474
11534
  name: "@bike4mind/cli",
11475
- version: "0.2.10-slack-metrics-admin-dashboard.17277+8887342ab",
11535
+ version: "0.2.11-fix-number-option-recorded.17312+3ca5a7c3c",
11476
11536
  type: "module",
11477
11537
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
11478
11538
  license: "UNLICENSED",
@@ -11576,10 +11636,10 @@ var package_default = {
11576
11636
  },
11577
11637
  devDependencies: {
11578
11638
  "@bike4mind/agents": "0.1.0",
11579
- "@bike4mind/common": "2.39.1-slack-metrics-admin-dashboard.17277+8887342ab",
11580
- "@bike4mind/mcp": "1.20.4-slack-metrics-admin-dashboard.17277+8887342ab",
11581
- "@bike4mind/services": "2.34.2-slack-metrics-admin-dashboard.17277+8887342ab",
11582
- "@bike4mind/utils": "2.1.4-slack-metrics-admin-dashboard.17277+8887342ab",
11639
+ "@bike4mind/common": "2.40.1-fix-number-option-recorded.17312+3ca5a7c3c",
11640
+ "@bike4mind/mcp": "1.20.5-fix-number-option-recorded.17312+3ca5a7c3c",
11641
+ "@bike4mind/services": "2.35.1-fix-number-option-recorded.17312+3ca5a7c3c",
11642
+ "@bike4mind/utils": "2.1.5-fix-number-option-recorded.17312+3ca5a7c3c",
11583
11643
  "@types/better-sqlite3": "^7.6.13",
11584
11644
  "@types/diff": "^5.0.9",
11585
11645
  "@types/jsonwebtoken": "^9.0.4",
@@ -11592,7 +11652,7 @@ var package_default = {
11592
11652
  typescript: "^5.9.3",
11593
11653
  vitest: "^3.2.4"
11594
11654
  },
11595
- gitHead: "8887342ab75fec0c6122cc7ddae61f5da01dc164"
11655
+ gitHead: "3ca5a7c3ca52c4cf2a785e465726baaf81bb9669"
11596
11656
  };
11597
11657
 
11598
11658
  // src/config/constants.ts
@@ -11600,6 +11660,353 @@ var USAGE_DAYS = 30;
11600
11660
  var MODEL_NAME_COLUMN_WIDTH = 18;
11601
11661
  var USAGE_CACHE_TTL = 5 * 60 * 1e3;
11602
11662
 
11663
+ // src/agents/SubagentOrchestrator.ts
11664
+ var SubagentOrchestrator = class {
11665
+ constructor(deps) {
11666
+ this.beforeRunCallback = null;
11667
+ this.afterRunCallback = null;
11668
+ this.deps = deps;
11669
+ }
11670
+ /**
11671
+ * Set a callback to be invoked before each subagent.run()
11672
+ * Use this to subscribe to agent events (e.g., subagent.on('action', handler))
11673
+ */
11674
+ setBeforeRunCallback(callback) {
11675
+ this.beforeRunCallback = callback;
11676
+ }
11677
+ /**
11678
+ * Set a callback to be invoked after each subagent.run()
11679
+ * Use this to unsubscribe from agent events (e.g., subagent.off('action', handler))
11680
+ */
11681
+ setAfterRunCallback(callback) {
11682
+ this.afterRunCallback = callback;
11683
+ }
11684
+ /**
11685
+ * Delegate a task to a specialized subagent
11686
+ *
11687
+ * @param options - Configuration for subagent execution
11688
+ * @returns Subagent result with summary
11689
+ */
11690
+ async delegateToSubagent(options) {
11691
+ const { task, type, thoroughness, parentSessionId, config: configOverride } = options;
11692
+ const baseConfig = this.deps.subagentConfigs.get(type);
11693
+ if (!baseConfig) {
11694
+ throw new Error(`No configuration found for subagent type: ${type}`);
11695
+ }
11696
+ const config = {
11697
+ ...baseConfig,
11698
+ ...configOverride,
11699
+ type
11700
+ };
11701
+ const model = config.model || "claude-3-5-haiku-20241022";
11702
+ const maxIterations = this.getMaxIterations(config, thoroughness);
11703
+ const toolFilter = {
11704
+ allowedTools: config.allowedTools,
11705
+ deniedTools: config.deniedTools
11706
+ };
11707
+ const agentContext = {
11708
+ currentAgent: null,
11709
+ observationQueue: []
11710
+ };
11711
+ const { tools: tools2, agentContext: updatedContext } = generateCliTools(
11712
+ this.deps.userId,
11713
+ this.deps.llm,
11714
+ model,
11715
+ this.deps.permissionManager,
11716
+ this.deps.showPermissionPrompt,
11717
+ agentContext,
11718
+ this.deps.configStore,
11719
+ this.deps.apiClient,
11720
+ toolFilter
11721
+ );
11722
+ this.deps.logger.debug(`Spawning ${type} subagent with ${tools2.length} tools, thoroughness: ${thoroughness}`);
11723
+ const subagent = new ReActAgent({
11724
+ userId: this.deps.userId,
11725
+ logger: this.deps.logger,
11726
+ llm: this.deps.llm,
11727
+ model,
11728
+ tools: tools2,
11729
+ maxIterations,
11730
+ systemPrompt: config.systemPrompt || this.getDefaultSystemPrompt(type)
11731
+ });
11732
+ updatedContext.currentAgent = subagent;
11733
+ if (this.beforeRunCallback) {
11734
+ this.beforeRunCallback(subagent, type);
11735
+ }
11736
+ const startTime = Date.now();
11737
+ const result = await subagent.run(task, {
11738
+ maxIterations
11739
+ });
11740
+ const duration = Date.now() - startTime;
11741
+ if (this.afterRunCallback) {
11742
+ this.afterRunCallback(subagent, type);
11743
+ }
11744
+ this.deps.logger.debug(
11745
+ `Subagent completed in ${duration}ms, ${result.completionInfo.iterations} iterations, ${result.completionInfo.totalTokens} tokens`
11746
+ );
11747
+ const summary = this.summarizeResult(result, type);
11748
+ const subagentResult = {
11749
+ ...result,
11750
+ subagentType: type,
11751
+ thoroughness,
11752
+ summary,
11753
+ parentSessionId
11754
+ };
11755
+ return subagentResult;
11756
+ }
11757
+ /**
11758
+ * Get max iterations based on thoroughness and config
11759
+ */
11760
+ getMaxIterations(config, thoroughness) {
11761
+ const defaults = {
11762
+ quick: 2,
11763
+ medium: 5,
11764
+ very_thorough: 10
11765
+ };
11766
+ const configIterations = config.maxIterations || defaults;
11767
+ return configIterations[thoroughness];
11768
+ }
11769
+ /**
11770
+ * Get default system prompt for subagent type
11771
+ */
11772
+ getDefaultSystemPrompt(type) {
11773
+ switch (type) {
11774
+ case "explore":
11775
+ return `You are a code exploration specialist. Your job is to search and analyze codebases efficiently.
11776
+
11777
+ Focus on:
11778
+ - Finding relevant files and functions
11779
+ - Understanding code structure and patterns
11780
+ - Providing clear, concise summaries
11781
+
11782
+ You have read-only access. Use file_read, grep_search, and glob_files to explore.
11783
+
11784
+ When you find what you're looking for, provide a clear summary including:
11785
+ 1. What you found (files, functions, patterns)
11786
+ 2. Key insights or observations
11787
+ 3. Relevant code locations
11788
+
11789
+ Be thorough but concise. Your summary will be used by the main agent.`;
11790
+ case "plan":
11791
+ return `You are a task planning specialist. Your job is to break down complex tasks into clear, actionable steps.
11792
+
11793
+ Focus on:
11794
+ - Identifying dependencies and blockers
11795
+ - Creating logical sequence of steps
11796
+ - Estimating scope and priorities
11797
+
11798
+ Provide a structured plan that the main agent can execute.`;
11799
+ case "review":
11800
+ return `You are a code review specialist. Your job is to analyze code quality and identify issues.
11801
+
11802
+ Focus on:
11803
+ - Code quality and best practices
11804
+ - Potential bugs and edge cases
11805
+ - Performance and security considerations
11806
+
11807
+ Provide actionable feedback with specific file and line references.`;
11808
+ default:
11809
+ return "You are a helpful AI assistant.";
11810
+ }
11811
+ }
11812
+ /**
11813
+ * Summarize subagent result for parent agent
11814
+ */
11815
+ summarizeResult(result, type) {
11816
+ const { finalAnswer, steps, completionInfo } = result;
11817
+ const toolCalls = steps.filter((s) => s.type === "action");
11818
+ const filesRead = toolCalls.filter((s) => s.metadata?.toolName === "file_read").length;
11819
+ const searches = toolCalls.filter((s) => s.metadata?.toolName === "grep_search").length;
11820
+ const globs = toolCalls.filter((s) => s.metadata?.toolName === "glob_files").length;
11821
+ let summary = `**${type.charAt(0).toUpperCase() + type.slice(1)} Subagent Results**
11822
+
11823
+ `;
11824
+ summary += `*Execution: ${completionInfo.iterations} iterations, ${completionInfo.toolCalls} tool calls*
11825
+
11826
+ `;
11827
+ if (type === "explore") {
11828
+ summary += `*Exploration: ${filesRead} files read, ${searches} searches, ${globs} glob patterns*
11829
+
11830
+ `;
11831
+ }
11832
+ const maxLength = 1e3;
11833
+ if (finalAnswer.length > maxLength) {
11834
+ summary += finalAnswer.slice(0, maxLength) + "\n\n...(truncated)";
11835
+ } else {
11836
+ summary += finalAnswer;
11837
+ }
11838
+ return summary;
11839
+ }
11840
+ };
11841
+
11842
+ // src/agents/configs.ts
11843
+ var EXPLORE_CONFIG = {
11844
+ type: "explore",
11845
+ model: "claude-3-5-haiku-20241022",
11846
+ systemPrompt: `You are a code exploration specialist. Your job is to search and analyze codebases efficiently.
11847
+
11848
+ Focus on:
11849
+ - Finding relevant files and functions
11850
+ - Understanding code structure and patterns
11851
+ - Providing clear, concise summaries
11852
+
11853
+ You have read-only access. Use file_read, grep_search, and glob_files to explore.
11854
+
11855
+ When you find what you're looking for, provide a clear summary including:
11856
+ 1. What you found (files, functions, patterns)
11857
+ 2. Key insights or observations
11858
+ 3. Relevant code locations
11859
+
11860
+ Be thorough but concise. Your summary will be used by the main agent.`,
11861
+ allowedTools: [
11862
+ "file_read",
11863
+ "grep_search",
11864
+ "glob_files",
11865
+ "bash_execute",
11866
+ // Only for read-only commands like ls, cat, find
11867
+ "current_datetime",
11868
+ "math_evaluate"
11869
+ ],
11870
+ deniedTools: [
11871
+ "create_file",
11872
+ "edit_file",
11873
+ "delete_file",
11874
+ "web_search",
11875
+ "weather_info",
11876
+ "blog_publish",
11877
+ "blog_edit",
11878
+ "blog_draft"
11879
+ ],
11880
+ maxIterations: {
11881
+ quick: 2,
11882
+ medium: 5,
11883
+ very_thorough: 10
11884
+ },
11885
+ defaultThoroughness: "medium"
11886
+ };
11887
+ var PLAN_CONFIG = {
11888
+ type: "plan",
11889
+ model: "claude-3-5-haiku-20241022",
11890
+ systemPrompt: `You are a task planning specialist. Your job is to break down complex tasks into clear, actionable steps.
11891
+
11892
+ Focus on:
11893
+ - Identifying dependencies and blockers
11894
+ - Creating logical sequence of steps
11895
+ - Estimating scope and priorities
11896
+
11897
+ You can explore the codebase to understand the current architecture before planning.
11898
+
11899
+ Provide a structured plan that the main agent can execute.`,
11900
+ allowedTools: ["file_read", "grep_search", "glob_files", "bash_execute", "current_datetime", "math_evaluate"],
11901
+ deniedTools: ["create_file", "edit_file", "delete_file", "web_search", "weather_info"],
11902
+ maxIterations: {
11903
+ quick: 3,
11904
+ medium: 7,
11905
+ very_thorough: 12
11906
+ },
11907
+ defaultThoroughness: "medium"
11908
+ };
11909
+ var REVIEW_CONFIG = {
11910
+ type: "review",
11911
+ model: "claude-sonnet-4-5-20250929",
11912
+ // Use latest Sonnet for better reasoning
11913
+ systemPrompt: `You are a code review specialist. Your job is to analyze code quality and identify issues.
11914
+
11915
+ Focus on:
11916
+ - Code quality and best practices
11917
+ - Potential bugs and edge cases
11918
+ - Performance and security considerations
11919
+
11920
+ You have read-only access to analyze code.
11921
+
11922
+ Provide actionable feedback with specific file and line references.`,
11923
+ allowedTools: ["file_read", "grep_search", "glob_files", "bash_execute", "current_datetime"],
11924
+ deniedTools: ["create_file", "edit_file", "delete_file", "web_search", "weather_info"],
11925
+ maxIterations: {
11926
+ quick: 3,
11927
+ medium: 8,
11928
+ very_thorough: 15
11929
+ },
11930
+ defaultThoroughness: "medium"
11931
+ };
11932
+ function getDefaultSubagentConfigs() {
11933
+ return /* @__PURE__ */ new Map([
11934
+ ["explore", EXPLORE_CONFIG],
11935
+ ["plan", PLAN_CONFIG],
11936
+ ["review", REVIEW_CONFIG]
11937
+ ]);
11938
+ }
11939
+
11940
+ // src/agents/delegateTool.ts
11941
+ function createSubagentDelegateTool(orchestrator, parentSessionId) {
11942
+ return {
11943
+ toolFn: async (args) => {
11944
+ const params = args;
11945
+ if (!params.task) {
11946
+ throw new Error("subagent_delegate: task parameter is required");
11947
+ }
11948
+ if (!params.type) {
11949
+ throw new Error("subagent_delegate: type parameter is required");
11950
+ }
11951
+ const thoroughness = params.thoroughness || "medium";
11952
+ const type = params.type;
11953
+ const result = await orchestrator.delegateToSubagent({
11954
+ task: params.task,
11955
+ type,
11956
+ thoroughness,
11957
+ parentSessionId
11958
+ });
11959
+ return result.summary;
11960
+ },
11961
+ toolSchema: {
11962
+ name: "subagent_delegate",
11963
+ description: `Delegate a task to a specialized subagent for focused work.
11964
+
11965
+ **When to use this tool:**
11966
+ - **Explore**: When you need to search through the codebase, find files, or understand code structure (read-only)
11967
+ - **Plan**: When you need to break down a complex task into actionable steps
11968
+ - **Review**: When you need to analyze code quality and identify potential issues
11969
+
11970
+ **Benefits:**
11971
+ - Keeps main conversation focused and clean
11972
+ - Uses specialized prompts optimized for each task type
11973
+ - Faster execution with appropriate models (Haiku for explore/plan, Sonnet for review)
11974
+
11975
+ **Example uses:**
11976
+ - "Find all files that use the authentication system" \u2192 explore
11977
+ - "Search for components that handle user input" \u2192 explore
11978
+ - "Break down implementing a new feature into steps" \u2192 plan
11979
+ - "Review this module for potential bugs" \u2192 review`,
11980
+ parameters: {
11981
+ type: "object",
11982
+ properties: {
11983
+ task: {
11984
+ type: "string",
11985
+ description: "Clear description of what you want the subagent to do. Be specific about what you're looking for or what needs to be accomplished."
11986
+ },
11987
+ type: {
11988
+ type: "string",
11989
+ enum: ["explore", "plan", "review"],
11990
+ description: `Type of subagent to use:
11991
+ - explore: Read-only codebase exploration and search (fast, uses Haiku)
11992
+ - plan: Task breakdown and planning (uses Haiku)
11993
+ - review: Code quality analysis and review (uses Sonnet for better reasoning)`
11994
+ },
11995
+ thoroughness: {
11996
+ type: "string",
11997
+ enum: ["quick", "medium", "very_thorough"],
11998
+ description: `How thoroughly to execute:
11999
+ - quick: Fast lookup, 1-2 iterations
12000
+ - medium: Balanced exploration, 3-5 iterations (default)
12001
+ - very_thorough: Comprehensive analysis, 8-10 iterations`
12002
+ }
12003
+ },
12004
+ required: ["task", "type"]
12005
+ }
12006
+ }
12007
+ };
12008
+ }
12009
+
11603
12010
  // src/index.tsx
11604
12011
  process.removeAllListeners("warning");
11605
12012
  process.on("warning", (warning) => {
@@ -11730,7 +12137,7 @@ function CliApp() {
11730
12137
  if (!isAuthenticated) {
11731
12138
  console.log("\u2139\uFE0F AI features disabled. Available commands: /login, /help, /config\n");
11732
12139
  const minimalSession = {
11733
- id: uuidv49(),
12140
+ id: uuidv410(),
11734
12141
  name: `Session ${(/* @__PURE__ */ new Date()).toLocaleString()}`,
11735
12142
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
11736
12143
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -11774,7 +12181,7 @@ function CliApp() {
11774
12181
  }
11775
12182
  llm.currentModel = modelInfo.id;
11776
12183
  const newSession = {
11777
- id: uuidv49(),
12184
+ id: uuidv410(),
11778
12185
  name: `Session ${(/* @__PURE__ */ new Date()).toLocaleString()}`,
11779
12186
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
11780
12187
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -11847,7 +12254,34 @@ function CliApp() {
11847
12254
  console.log(` \u{1F4E1} ${serverName}: ${count} tool(s)`);
11848
12255
  });
11849
12256
  }
11850
- const allTools = [...b4mTools, ...mcpTools];
12257
+ const subagentConfigs = getDefaultSubagentConfigs();
12258
+ if (config.subagents) {
12259
+ if (config.subagents.explore) {
12260
+ const currentConfig = subagentConfigs.get("explore");
12261
+ subagentConfigs.set("explore", { ...currentConfig, ...config.subagents.explore });
12262
+ }
12263
+ if (config.subagents.plan) {
12264
+ const currentConfig = subagentConfigs.get("plan");
12265
+ subagentConfigs.set("plan", { ...currentConfig, ...config.subagents.plan });
12266
+ }
12267
+ if (config.subagents.review) {
12268
+ const currentConfig = subagentConfigs.get("review");
12269
+ subagentConfigs.set("review", { ...currentConfig, ...config.subagents.review });
12270
+ }
12271
+ }
12272
+ const orchestrator = new SubagentOrchestrator({
12273
+ userId: config.userId,
12274
+ llm,
12275
+ logger: silentLogger,
12276
+ permissionManager,
12277
+ showPermissionPrompt: promptFn,
12278
+ configStore: state.configStore,
12279
+ apiClient,
12280
+ subagentConfigs
12281
+ });
12282
+ const subagentDelegateTool = createSubagentDelegateTool(orchestrator, newSession.id);
12283
+ const allTools = [...b4mTools, ...mcpTools, subagentDelegateTool];
12284
+ console.log(`\u{1F916} Subagent delegation enabled (explore, plan, review)`);
11851
12285
  const projectDir = state.configStore.getProjectConfigDir();
11852
12286
  const contextResult = await loadContextFiles(projectDir);
11853
12287
  if (contextResult.globalContext) {
@@ -11884,6 +12318,15 @@ FOR CODING TASKS:
11884
12318
  - When searching for code: Use grep_search or glob_files to find relevant files
11885
12319
  - Permission system will ask for approval before any file writes
11886
12320
 
12321
+ SUBAGENT DELEGATION:
12322
+ - You have access to specialized subagents via the subagent_delegate tool
12323
+ - Use subagents for focused exploration, planning, or review tasks:
12324
+ * explore: Fast read-only codebase search (e.g., "find all auth files", "locate API endpoints")
12325
+ * plan: Break down complex tasks into actionable steps
12326
+ * review: Analyze code quality and identify issues
12327
+ - Subagents keep the main conversation clean and run faster with optimized models
12328
+ - Delegate when you need to search extensively or analyze code structure
12329
+
11887
12330
  FOR GENERAL TASKS:
11888
12331
  - Use available tools to get information (weather, web search, calculations, etc.)
11889
12332
  - When user asks follow-up questions, use conversation context to understand what they're referring to
@@ -11894,6 +12337,7 @@ EXAMPLES:
11894
12337
  - "how about Japan?" \u2192 use weather tool for Japan (applying same question from context)
11895
12338
  - "enhance README" \u2192 file_read \u2192 generate \u2192 create_file
11896
12339
  - "what packages installed?" \u2192 glob_files "**/package.json" \u2192 file_read
12340
+ - "find all components using React hooks" \u2192 subagent_delegate(task="find all components using React hooks", type="explore")
11897
12341
 
11898
12342
  Remember: Use context from previous messages to understand follow-up questions.${contextSection}`;
11899
12343
  const maxIterations = config.preferences.maxIterations === null ? 999999 : config.preferences.maxIterations;
@@ -11910,6 +12354,27 @@ Remember: Use context from previous messages to understand follow-up questions.$
11910
12354
  });
11911
12355
  agentContext.currentAgent = agent;
11912
12356
  agent.observationQueue = agentContext.observationQueue;
12357
+ const stepHandler = (step) => {
12358
+ const { pendingMessages, updatePendingMessage } = useCliStore.getState();
12359
+ const lastIdx = pendingMessages.length - 1;
12360
+ if (lastIdx >= 0 && pendingMessages[lastIdx].role === "assistant") {
12361
+ const existingSteps = pendingMessages[lastIdx].metadata?.steps || [];
12362
+ updatePendingMessage(lastIdx, {
12363
+ ...pendingMessages[lastIdx],
12364
+ metadata: {
12365
+ ...pendingMessages[lastIdx].metadata,
12366
+ steps: [...existingSteps, step]
12367
+ }
12368
+ });
12369
+ }
12370
+ };
12371
+ agent.on("action", stepHandler);
12372
+ orchestrator.setBeforeRunCallback((subagent, _subagentType) => {
12373
+ subagent.on("action", stepHandler);
12374
+ });
12375
+ orchestrator.setAfterRunCallback((subagent, _subagentType) => {
12376
+ subagent.off("action", stepHandler);
12377
+ });
11913
12378
  setState((prev) => ({
11914
12379
  ...prev,
11915
12380
  session: newSession,
@@ -11983,11 +12448,13 @@ Remember: Use context from previous messages to understand follow-up questions.$
11983
12448
  messageContent = multimodalMessage.content;
11984
12449
  }
11985
12450
  const userMessage = {
12451
+ id: uuidv410(),
11986
12452
  role: "user",
11987
12453
  content: userMessageContent,
11988
12454
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
11989
12455
  };
11990
12456
  const pendingAssistantMessage = {
12457
+ id: uuidv410(),
11991
12458
  role: "assistant",
11992
12459
  content: "...",
11993
12460
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -12018,7 +12485,10 @@ Remember: Use context from previous messages to understand follow-up questions.$
12018
12485
  const currentSession = useCliStore.getState().session;
12019
12486
  if (!currentSession) return;
12020
12487
  const updatedMessages = [...currentSession.messages];
12488
+ const lastMessage = updatedMessages[updatedMessages.length - 1];
12021
12489
  updatedMessages[updatedMessages.length - 1] = {
12490
+ id: lastMessage.id,
12491
+ // Preserve the original message ID
12022
12492
  role: "assistant",
12023
12493
  content: result.finalAnswer,
12024
12494
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -12108,22 +12578,6 @@ Remember: Use context from previous messages to understand follow-up questions.$
12108
12578
  return;
12109
12579
  }
12110
12580
  useCliStore.getState().setIsThinking(true);
12111
- const currentSteps = [];
12112
- const stepHandler = (step) => {
12113
- currentSteps.push(step);
12114
- const { pendingMessages, updatePendingMessage } = useCliStore.getState();
12115
- const lastIdx = pendingMessages.length - 1;
12116
- if (lastIdx >= 0 && pendingMessages[lastIdx].role === "assistant") {
12117
- updatePendingMessage(lastIdx, {
12118
- ...pendingMessages[lastIdx],
12119
- metadata: {
12120
- ...pendingMessages[lastIdx].metadata,
12121
- steps: [...currentSteps]
12122
- }
12123
- });
12124
- }
12125
- };
12126
- state.agent.on("action", stepHandler);
12127
12581
  try {
12128
12582
  let messageContent = message;
12129
12583
  let userMessageContent = message;
@@ -12133,11 +12587,13 @@ Remember: Use context from previous messages to understand follow-up questions.$
12133
12587
  userMessageContent = message;
12134
12588
  }
12135
12589
  const userMessage = {
12590
+ id: uuidv410(),
12136
12591
  role: "user",
12137
12592
  content: userMessageContent,
12138
12593
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
12139
12594
  };
12140
12595
  const pendingAssistantMessage = {
12596
+ id: uuidv410(),
12141
12597
  role: "assistant",
12142
12598
  content: "...",
12143
12599
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -12167,6 +12623,8 @@ Remember: Use context from previous messages to understand follow-up questions.$
12167
12623
  }
12168
12624
  const successfulToolCalls = result.steps.filter((s) => s.type === "observation").length;
12169
12625
  const finalAssistantMessage = {
12626
+ id: pendingAssistantMessage.id,
12627
+ // Preserve the original message ID
12170
12628
  role: "assistant",
12171
12629
  content: result.finalAnswer,
12172
12630
  timestamp: pendingAssistantMessage.timestamp,
@@ -12205,8 +12663,6 @@ Remember: Use context from previous messages to understand follow-up questions.$
12205
12663
  }
12206
12664
  }
12207
12665
  console.error("Error processing message:", error);
12208
- } finally {
12209
- state.agent.off("action", stepHandler);
12210
12666
  }
12211
12667
  };
12212
12668
  const handleBashCommand = useCallback(
@@ -12228,11 +12684,13 @@ Remember: Use context from previous messages to understand follow-up questions.$
12228
12684
  isError = true;
12229
12685
  }
12230
12686
  const userMessage = {
12687
+ id: uuidv410(),
12231
12688
  role: "user",
12232
12689
  content: `$ ${command}`,
12233
12690
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
12234
12691
  };
12235
12692
  const assistantMessage = {
12693
+ id: uuidv410(),
12236
12694
  role: "assistant",
12237
12695
  content: isError ? `\u274C Error:
12238
12696
  ${output}` : output.trim() || "(no output)",
@@ -12643,7 +13101,7 @@ Custom Commands:
12643
13101
  console.clear();
12644
13102
  const model = state.session?.model || state.config?.defaultModel || "claude-sonnet";
12645
13103
  const newSession = {
12646
- id: uuidv49(),
13104
+ id: uuidv410(),
12647
13105
  name: `Session ${(/* @__PURE__ */ new Date()).toLocaleString()}`,
12648
13106
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
12649
13107
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-6EQ62KRQ.js";
4
+ } from "./chunk-DJPXSSP4.js";
5
5
  import "./chunk-PDX44BCA.js";
6
6
 
7
7
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/llmMarkdownGenerator.js
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CurationArtifactType
4
- } from "./chunk-6EQ62KRQ.js";
4
+ } from "./chunk-DJPXSSP4.js";
5
5
  import "./chunk-PDX44BCA.js";
6
6
 
7
7
  // ../../b4m-core/packages/services/dist/src/notebookCurationService/markdownGenerator.js
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  findMostSimilarMemento,
4
4
  getRelevantMementos
5
- } from "./chunk-TFXE7AI6.js";
6
- import "./chunk-23GLLYOT.js";
5
+ } from "./chunk-GO75FMLY.js";
6
+ import "./chunk-GCVIRGIN.js";
7
7
  import "./chunk-AMDXHL6S.js";
8
- import "./chunk-6EQ62KRQ.js";
8
+ import "./chunk-DJPXSSP4.js";
9
9
  import "./chunk-PDX44BCA.js";
10
10
  export {
11
11
  findMostSimilarMemento,
@@ -120,7 +120,7 @@ import {
120
120
  validateMermaidSyntax,
121
121
  warmUpSettingsCache,
122
122
  withRetry
123
- } from "./chunk-23GLLYOT.js";
123
+ } from "./chunk-GCVIRGIN.js";
124
124
  import {
125
125
  Logger,
126
126
  NotificationDeduplicator,
@@ -129,7 +129,7 @@ import {
129
129
  postLowCreditsNotificationToSlack,
130
130
  postMessageToSlack
131
131
  } from "./chunk-AMDXHL6S.js";
132
- import "./chunk-6EQ62KRQ.js";
132
+ import "./chunk-DJPXSSP4.js";
133
133
  import "./chunk-PDX44BCA.js";
134
134
  export {
135
135
  AWSBackend,
@@ -293,7 +293,7 @@ import {
293
293
  validateQuestMasterArtifactV2,
294
294
  validateReactArtifactV2,
295
295
  validateSvgArtifactV2
296
- } from "./chunk-6EQ62KRQ.js";
296
+ } from "./chunk-DJPXSSP4.js";
297
297
  import "./chunk-PDX44BCA.js";
298
298
  export {
299
299
  ALL_IMAGE_MODELS,
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  SubtractCreditsSchema,
4
4
  subtractCredits
5
- } from "./chunk-VOOM6DLV.js";
6
- import "./chunk-23GLLYOT.js";
5
+ } from "./chunk-VZU4Z7WI.js";
6
+ import "./chunk-GCVIRGIN.js";
7
7
  import "./chunk-AMDXHL6S.js";
8
- import "./chunk-6EQ62KRQ.js";
8
+ import "./chunk-DJPXSSP4.js";
9
9
  import "./chunk-PDX44BCA.js";
10
10
  export {
11
11
  SubtractCreditsSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.10-slack-metrics-admin-dashboard.17277+8887342ab",
3
+ "version": "0.2.11-fix-number-option-recorded.17312+3ca5a7c3c",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -104,10 +104,10 @@
104
104
  },
105
105
  "devDependencies": {
106
106
  "@bike4mind/agents": "0.1.0",
107
- "@bike4mind/common": "2.39.1-slack-metrics-admin-dashboard.17277+8887342ab",
108
- "@bike4mind/mcp": "1.20.4-slack-metrics-admin-dashboard.17277+8887342ab",
109
- "@bike4mind/services": "2.34.2-slack-metrics-admin-dashboard.17277+8887342ab",
110
- "@bike4mind/utils": "2.1.4-slack-metrics-admin-dashboard.17277+8887342ab",
107
+ "@bike4mind/common": "2.40.1-fix-number-option-recorded.17312+3ca5a7c3c",
108
+ "@bike4mind/mcp": "1.20.5-fix-number-option-recorded.17312+3ca5a7c3c",
109
+ "@bike4mind/services": "2.35.1-fix-number-option-recorded.17312+3ca5a7c3c",
110
+ "@bike4mind/utils": "2.1.5-fix-number-option-recorded.17312+3ca5a7c3c",
111
111
  "@types/better-sqlite3": "^7.6.13",
112
112
  "@types/diff": "^5.0.9",
113
113
  "@types/jsonwebtoken": "^9.0.4",
@@ -120,5 +120,5 @@
120
120
  "typescript": "^5.9.3",
121
121
  "vitest": "^3.2.4"
122
122
  },
123
- "gitHead": "8887342ab75fec0c6122cc7ddae61f5da01dc164"
123
+ "gitHead": "3ca5a7c3ca52c4cf2a785e465726baaf81bb9669"
124
124
  }