@bike4mind/cli 0.2.30-feat-cli-websocket-streaming.19209 → 0.2.30-feat-cli-websocket-streaming.19243

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.
@@ -2493,7 +2493,13 @@ var AnthropicBackend = class {
2493
2493
  const rawTools = options.tools;
2494
2494
  const normalizedTools = Array.isArray(rawTools) ? rawTools : rawTools ? [rawTools] : void 0;
2495
2495
  options.tools = normalizedTools;
2496
- const system = this.consolidateSystemMessages(messages);
2496
+ let system = this.consolidateSystemMessages(messages);
2497
+ if (system) {
2498
+ system += `
2499
+ IMPORTANT! Only when someone asks, remember that you are specifically the ${model} model.`;
2500
+ } else {
2501
+ system = `IMPORTANT! Only when someone asks, remember that you are specifically the ${model} model.`;
2502
+ }
2497
2503
  let filteredMessages = ensureToolPairingIntegrity(this.filterRelevantMessages(messages), this.logger);
2498
2504
  const countToolBlocks = (msgs) => {
2499
2505
  let useCount = 0;
@@ -3852,7 +3858,10 @@ var AnthropicBedrockBackend = class extends BaseBedrockBackend {
3852
3858
  }
3853
3859
  return { ...m, content: "" };
3854
3860
  }).filter((m) => m.content !== "" && (Array.isArray(m.content) ? m.content.length > 0 : true));
3855
- const systemMessage = messages.filter((m) => m.role === "system" && m.content).map((m) => typeof m.content === "string" ? m.content : JSON.stringify(m.content)).join("\n");
3861
+ let systemMessage = messages.filter((m) => m.role === "system" && m.content).map((m) => typeof m.content === "string" ? m.content : JSON.stringify(m.content)).join("\n");
3862
+ const modelIdentity = `IMPORTANT! Only when someone asks, remember that you are specifically the ${model} model.`;
3863
+ systemMessage = systemMessage ? `${systemMessage}
3864
+ ${modelIdentity}` : modelIdentity;
3856
3865
  console.log(`[AnthropicBedrockBackend] Preparing payload for model: ${model}`);
3857
3866
  const hasVendorPrefix = model.includes(":") || model.startsWith("global.") || model.startsWith("us.");
3858
3867
  const modelId = hasVendorPrefix ? model : `anthropic.${model}`;
@@ -49,7 +49,16 @@ var useCliStore = create((set) => ({
49
49
  // Input state (for Ctrl+C clearing)
50
50
  inputValue: "",
51
51
  setInputValue: (value) => set({ inputValue: value }),
52
- clearInput: () => set({ inputValue: "" }),
52
+ clearInput: () => set({ inputValue: "", pastedContent: null, pastedLineCount: 0 }),
53
+ // Paste state
54
+ pastedContent: null,
55
+ pastedLineCount: 0,
56
+ setPastedContent: (content, lineCount) => set({
57
+ pastedContent: content,
58
+ pastedLineCount: lineCount,
59
+ inputValue: content
60
+ }),
61
+ clearPaste: () => set({ pastedContent: null, pastedLineCount: 0, inputValue: "" }),
53
62
  // Permission prompt queue
54
63
  permissionPrompt: null,
55
64
  permissionQueue: [],
@@ -7,7 +7,7 @@ import {
7
7
  getSettingsMap,
8
8
  getSettingsValue,
9
9
  secureParameters
10
- } from "./chunk-PIJR5GZP.js";
10
+ } from "./chunk-7EEPLDUG.js";
11
11
  import {
12
12
  KnowledgeType,
13
13
  SupportedFabFileMimeTypes
@@ -6,7 +6,7 @@ import {
6
6
  getSettingsByNames,
7
7
  obfuscateApiKey,
8
8
  secureParameters
9
- } from "./chunk-PIJR5GZP.js";
9
+ } from "./chunk-7EEPLDUG.js";
10
10
  import {
11
11
  ApiKeyType,
12
12
  MementoTier,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BadRequestError,
4
4
  secureParameters
5
- } from "./chunk-PIJR5GZP.js";
5
+ } from "./chunk-7EEPLDUG.js";
6
6
  import {
7
7
  CompletionApiUsageTransaction,
8
8
  GenericCreditDeductTransaction,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  createFabFile,
4
4
  createFabFileSchema
5
- } from "./chunk-PD5RFLGO.js";
6
- import "./chunk-PIJR5GZP.js";
5
+ } from "./chunk-K5IURWQT.js";
6
+ import "./chunk-7EEPLDUG.js";
7
7
  import "./chunk-55ZDRTGQ.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  getEffectiveApiKey,
6
6
  getOpenWeatherKey,
7
7
  getSerperKey
8
- } from "./chunk-NRQSEF3E.js";
8
+ } from "./chunk-KBRR7H2K.js";
9
9
  import "./chunk-RUI6HNLO.js";
10
10
  import {
11
11
  ConfigStore,
@@ -14,9 +14,9 @@ import {
14
14
  import {
15
15
  selectActiveBackgroundAgents,
16
16
  useCliStore
17
- } from "./chunk-TVW4ZESU.js";
18
- import "./chunk-EAFOBAEJ.js";
19
- import "./chunk-PD5RFLGO.js";
17
+ } from "./chunk-BYXFQJYT.js";
18
+ import "./chunk-XXYKIX5X.js";
19
+ import "./chunk-K5IURWQT.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-PIJR5GZP.js";
31
+ } from "./chunk-7EEPLDUG.js";
32
32
  import {
33
33
  AiEvents,
34
34
  ApiKeyEvents,
@@ -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
@@ -12776,7 +12832,7 @@ function wrapToolWithPermission(tool, permissionManager, showPermissionPrompt, a
12776
12832
  agentContext.observationQueue.push({ toolName, result: result2 });
12777
12833
  return result2;
12778
12834
  }
12779
- const { useCliStore: useCliStore2 } = await import("./store-FU6NDC2W.js");
12835
+ const { useCliStore: useCliStore2 } = await import("./store-K5MB3SE7.js");
12780
12836
  if (useCliStore2.getState().autoAcceptEdits) {
12781
12837
  const result2 = await executeTool(toolName, args, apiClient, originalFn);
12782
12838
  agentContext.observationQueue.push({ toolName, result: result2 });
@@ -15062,7 +15118,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
15062
15118
  // package.json
15063
15119
  var package_default = {
15064
15120
  name: "@bike4mind/cli",
15065
- version: "0.2.30-feat-cli-websocket-streaming.19209+64d4459aa",
15121
+ version: "0.2.30-feat-cli-websocket-streaming.19243+6a95a9d10",
15066
15122
  type: "module",
15067
15123
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
15068
15124
  license: "UNLICENSED",
@@ -15173,10 +15229,10 @@ var package_default = {
15173
15229
  },
15174
15230
  devDependencies: {
15175
15231
  "@bike4mind/agents": "0.1.0",
15176
- "@bike4mind/common": "2.51.1-feat-cli-websocket-streaming.19209+64d4459aa",
15177
- "@bike4mind/mcp": "1.30.1-feat-cli-websocket-streaming.19209+64d4459aa",
15178
- "@bike4mind/services": "2.49.1-feat-cli-websocket-streaming.19209+64d4459aa",
15179
- "@bike4mind/utils": "2.6.1-feat-cli-websocket-streaming.19209+64d4459aa",
15232
+ "@bike4mind/common": "2.51.1-feat-cli-websocket-streaming.19243+6a95a9d10",
15233
+ "@bike4mind/mcp": "1.30.1-feat-cli-websocket-streaming.19243+6a95a9d10",
15234
+ "@bike4mind/services": "2.49.1-feat-cli-websocket-streaming.19243+6a95a9d10",
15235
+ "@bike4mind/utils": "2.6.1-feat-cli-websocket-streaming.19243+6a95a9d10",
15180
15236
  "@types/better-sqlite3": "^7.6.13",
15181
15237
  "@types/diff": "^5.0.9",
15182
15238
  "@types/jsonwebtoken": "^9.0.4",
@@ -15197,14 +15253,9 @@ var package_default = {
15197
15253
  optionalDependencies: {
15198
15254
  "@vscode/ripgrep": "^1.17.0"
15199
15255
  },
15200
- gitHead: "64d4459aaf9c9ba124dac6513d470113295bd1d1"
15256
+ gitHead: "6a95a9d108b3eb161ebb1fe503ed9fb63585be72"
15201
15257
  };
15202
15258
 
15203
- // src/config/constants.ts
15204
- var USAGE_DAYS = 30;
15205
- var MODEL_NAME_COLUMN_WIDTH = 18;
15206
- var USAGE_CACHE_TTL = 5 * 60 * 1e3;
15207
-
15208
15259
  // src/agents/toolFilter.ts
15209
15260
  function matchesToolPattern2(toolName, pattern) {
15210
15261
  const regexPattern = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
@@ -17030,6 +17081,11 @@ function CliApp() {
17030
17081
  }, [state.session, state.sessionStore, state.mcpManager, state.agent, state.imageStore, state.wsManager]);
17031
17082
  useInput9((input, key) => {
17032
17083
  if (key.escape) {
17084
+ const store = useCliStore.getState();
17085
+ if (store.pastedContent) {
17086
+ store.clearPaste();
17087
+ return;
17088
+ }
17033
17089
  if (state.abortController) {
17034
17090
  logger.debug("[ABORT] ESC pressed - aborting current operation...");
17035
17091
  state.abortController.abort();
@@ -17047,9 +17103,9 @@ function CliApp() {
17047
17103
  });
17048
17104
  } else {
17049
17105
  logger.debug("[EXIT] First Ctrl+C - press again to exit");
17050
- const currentInput = useCliStore.getState().inputValue;
17051
- if (currentInput.length > 0) {
17052
- useCliStore.getState().clearInput();
17106
+ const store = useCliStore.getState();
17107
+ if (store.inputValue.length > 0 || store.pastedContent) {
17108
+ store.clearInput();
17053
17109
  }
17054
17110
  exitTimestamp = now;
17055
17111
  setExitRequested(true);
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  findMostSimilarMemento,
4
4
  getRelevantMementos
5
- } from "./chunk-NRQSEF3E.js";
6
- import "./chunk-PIJR5GZP.js";
5
+ } from "./chunk-KBRR7H2K.js";
6
+ import "./chunk-7EEPLDUG.js";
7
7
  import "./chunk-55ZDRTGQ.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
@@ -134,7 +134,7 @@ import {
134
134
  validateMermaidSyntax,
135
135
  warmUpSettingsCache,
136
136
  withRetry
137
- } from "./chunk-PIJR5GZP.js";
137
+ } from "./chunk-7EEPLDUG.js";
138
138
  import {
139
139
  buildRateLimitLogEntry,
140
140
  isNearLimit,
@@ -3,7 +3,7 @@ import {
3
3
  selectActiveBackgroundAgents,
4
4
  selectCompletedBackgroundAgents,
5
5
  useCliStore
6
- } from "./chunk-TVW4ZESU.js";
6
+ } from "./chunk-BYXFQJYT.js";
7
7
  export {
8
8
  selectActiveBackgroundAgents,
9
9
  selectCompletedBackgroundAgents,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  SubtractCreditsSchema,
4
4
  subtractCredits
5
- } from "./chunk-EAFOBAEJ.js";
6
- import "./chunk-PIJR5GZP.js";
5
+ } from "./chunk-XXYKIX5X.js";
6
+ import "./chunk-7EEPLDUG.js";
7
7
  import "./chunk-55ZDRTGQ.js";
8
8
  import "./chunk-OCYRD7D6.js";
9
9
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.30-feat-cli-websocket-streaming.19209+64d4459aa",
3
+ "version": "0.2.30-feat-cli-websocket-streaming.19243+6a95a9d10",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -111,10 +111,10 @@
111
111
  },
112
112
  "devDependencies": {
113
113
  "@bike4mind/agents": "0.1.0",
114
- "@bike4mind/common": "2.51.1-feat-cli-websocket-streaming.19209+64d4459aa",
115
- "@bike4mind/mcp": "1.30.1-feat-cli-websocket-streaming.19209+64d4459aa",
116
- "@bike4mind/services": "2.49.1-feat-cli-websocket-streaming.19209+64d4459aa",
117
- "@bike4mind/utils": "2.6.1-feat-cli-websocket-streaming.19209+64d4459aa",
114
+ "@bike4mind/common": "2.51.1-feat-cli-websocket-streaming.19243+6a95a9d10",
115
+ "@bike4mind/mcp": "1.30.1-feat-cli-websocket-streaming.19243+6a95a9d10",
116
+ "@bike4mind/services": "2.49.1-feat-cli-websocket-streaming.19243+6a95a9d10",
117
+ "@bike4mind/utils": "2.6.1-feat-cli-websocket-streaming.19243+6a95a9d10",
118
118
  "@types/better-sqlite3": "^7.6.13",
119
119
  "@types/diff": "^5.0.9",
120
120
  "@types/jsonwebtoken": "^9.0.4",
@@ -135,5 +135,5 @@
135
135
  "optionalDependencies": {
136
136
  "@vscode/ripgrep": "^1.17.0"
137
137
  },
138
- "gitHead": "64d4459aaf9c9ba124dac6513d470113295bd1d1"
138
+ "gitHead": "6a95a9d108b3eb161ebb1fe503ed9fb63585be72"
139
139
  }