@bike4mind/cli 0.2.5-feat-cli-dynamic-model-fetching.17090 → 0.2.5-feat-server-side-tool-execution.17093

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.
Files changed (2) hide show
  1. package/dist/index.js +104 -172
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -685,128 +685,103 @@ var EXPORT_FORMAT_OPTIONS = [
685
685
  { label: "markdown", value: "markdown" },
686
686
  { label: "json", value: "json" }
687
687
  ];
688
- function buildConfigItems(availableModels) {
689
- const modelOptions = availableModels.map((model) => ({
690
- label: model.name,
691
- value: model.id
692
- }));
693
- const items = [];
694
- if (modelOptions.length > 0) {
695
- items.push({
696
- key: "model",
697
- label: "Model",
698
- type: "select",
699
- options: modelOptions,
700
- getValue: (config) => {
701
- const modelExists = modelOptions.some((opt) => opt.value === config.defaultModel);
702
- return modelExists ? config.defaultModel : modelOptions[0]?.value ?? config.defaultModel;
703
- },
704
- setValue: (config, value) => ({
705
- ...config,
706
- defaultModel: value
707
- })
708
- });
688
+ var CONFIG_ITEMS = [
689
+ {
690
+ key: "maxIterations",
691
+ label: "Max Iterations",
692
+ type: "select",
693
+ options: MAX_ITERATIONS_OPTIONS,
694
+ getValue: (config) => config.preferences.maxIterations,
695
+ setValue: (config, value) => ({
696
+ ...config,
697
+ preferences: {
698
+ ...config.preferences,
699
+ maxIterations: value
700
+ }
701
+ })
702
+ },
703
+ {
704
+ key: "maxTokens",
705
+ label: "Max Tokens",
706
+ type: "number",
707
+ min: 256,
708
+ max: 128e3,
709
+ step: 256,
710
+ getValue: (config) => config.preferences.maxTokens,
711
+ setValue: (config, value) => ({
712
+ ...config,
713
+ preferences: {
714
+ ...config.preferences,
715
+ maxTokens: value
716
+ }
717
+ })
718
+ },
719
+ {
720
+ key: "temperature",
721
+ label: "Temperature",
722
+ type: "number",
723
+ min: 0,
724
+ max: 2,
725
+ step: 0.1,
726
+ getValue: (config) => config.preferences.temperature,
727
+ setValue: (config, value) => ({
728
+ ...config,
729
+ preferences: {
730
+ ...config.preferences,
731
+ temperature: value
732
+ }
733
+ })
734
+ },
735
+ {
736
+ key: "autoSave",
737
+ label: "Auto Save",
738
+ type: "boolean",
739
+ getValue: (config) => config.preferences.autoSave,
740
+ setValue: (config, value) => ({
741
+ ...config,
742
+ preferences: {
743
+ ...config.preferences,
744
+ autoSave: value
745
+ }
746
+ })
747
+ },
748
+ {
749
+ key: "theme",
750
+ label: "Theme",
751
+ type: "select",
752
+ options: THEME_OPTIONS,
753
+ getValue: (config) => config.preferences.theme,
754
+ setValue: (config, value) => ({
755
+ ...config,
756
+ preferences: {
757
+ ...config.preferences,
758
+ theme: value
759
+ }
760
+ })
761
+ },
762
+ {
763
+ key: "exportFormat",
764
+ label: "Export Format",
765
+ type: "select",
766
+ options: EXPORT_FORMAT_OPTIONS,
767
+ getValue: (config) => config.preferences.exportFormat,
768
+ setValue: (config, value) => ({
769
+ ...config,
770
+ preferences: {
771
+ ...config.preferences,
772
+ exportFormat: value
773
+ }
774
+ })
709
775
  }
710
- items.push(
711
- {
712
- key: "maxIterations",
713
- label: "Max Iterations",
714
- type: "select",
715
- options: MAX_ITERATIONS_OPTIONS,
716
- getValue: (config) => config.preferences.maxIterations,
717
- setValue: (config, value) => ({
718
- ...config,
719
- preferences: {
720
- ...config.preferences,
721
- maxIterations: value
722
- }
723
- })
724
- },
725
- {
726
- key: "maxTokens",
727
- label: "Max Tokens",
728
- type: "number",
729
- min: 256,
730
- max: 128e3,
731
- step: 256,
732
- getValue: (config) => config.preferences.maxTokens,
733
- setValue: (config, value) => ({
734
- ...config,
735
- preferences: {
736
- ...config.preferences,
737
- maxTokens: value
738
- }
739
- })
740
- },
741
- {
742
- key: "temperature",
743
- label: "Temperature",
744
- type: "number",
745
- min: 0,
746
- max: 2,
747
- step: 0.1,
748
- getValue: (config) => config.preferences.temperature,
749
- setValue: (config, value) => ({
750
- ...config,
751
- preferences: {
752
- ...config.preferences,
753
- temperature: value
754
- }
755
- })
756
- },
757
- {
758
- key: "autoSave",
759
- label: "Auto Save",
760
- type: "boolean",
761
- getValue: (config) => config.preferences.autoSave,
762
- setValue: (config, value) => ({
763
- ...config,
764
- preferences: {
765
- ...config.preferences,
766
- autoSave: value
767
- }
768
- })
769
- },
770
- {
771
- key: "theme",
772
- label: "Theme",
773
- type: "select",
774
- options: THEME_OPTIONS,
775
- getValue: (config) => config.preferences.theme,
776
- setValue: (config, value) => ({
777
- ...config,
778
- preferences: {
779
- ...config.preferences,
780
- theme: value
781
- }
782
- })
783
- },
784
- {
785
- key: "exportFormat",
786
- label: "Export Format",
787
- type: "select",
788
- options: EXPORT_FORMAT_OPTIONS,
789
- getValue: (config) => config.preferences.exportFormat,
790
- setValue: (config, value) => ({
791
- ...config,
792
- preferences: {
793
- ...config.preferences,
794
- exportFormat: value
795
- }
796
- })
797
- }
798
- );
799
- return items;
800
- }
801
- function ConfigEditor({ config, availableModels, onSave, onClose }) {
776
+ ];
777
+ function ConfigEditor({ config, onSave, onClose }) {
802
778
  const [selectedIndex, setSelectedIndex] = useState2(0);
803
779
  const [editedConfig, setEditedConfig] = useState2(config);
804
780
  const [saveError, setSaveError] = useState2(null);
805
781
  const [isSaving, setIsSaving] = useState2(false);
806
- const configItems = useMemo2(() => buildConfigItems(availableModels), [availableModels]);
807
782
  const hasChanges = useMemo2(() => {
808
- return JSON.stringify(config.preferences) !== JSON.stringify(editedConfig.preferences) || config.defaultModel !== editedConfig.defaultModel;
809
- }, [config.preferences, editedConfig.preferences, config.defaultModel, editedConfig.defaultModel]);
783
+ return JSON.stringify(config.preferences) !== JSON.stringify(editedConfig.preferences);
784
+ }, [config.preferences, editedConfig.preferences]);
810
785
  const handleSaveAndClose = async () => {
811
786
  if (hasChanges) {
812
787
  try {
@@ -823,13 +798,13 @@ function ConfigEditor({ config, availableModels, onSave, onClose }) {
823
798
  onClose();
824
799
  };
825
800
  useInput2((input, key) => {
826
- const currentItem = configItems[selectedIndex];
801
+ const currentItem = CONFIG_ITEMS[selectedIndex];
827
802
  if (key.upArrow) {
828
- setSelectedIndex((prev) => prev > 0 ? prev - 1 : configItems.length - 1);
803
+ setSelectedIndex((prev) => prev > 0 ? prev - 1 : CONFIG_ITEMS.length - 1);
829
804
  return;
830
805
  }
831
806
  if (key.downArrow) {
832
- setSelectedIndex((prev) => prev < configItems.length - 1 ? prev + 1 : 0);
807
+ setSelectedIndex((prev) => prev < CONFIG_ITEMS.length - 1 ? prev + 1 : 0);
833
808
  return;
834
809
  }
835
810
  if ((key.escape || input === "q") && !isSaving) {
@@ -887,7 +862,7 @@ function ConfigEditor({ config, availableModels, onSave, onClose }) {
887
862
  }
888
863
  return String(value);
889
864
  };
890
- return /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1, marginY: 1 }, /* @__PURE__ */ React8.createElement(Box8, { justifyContent: "space-between", marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Text7, { bold: true, color: "cyan" }, "Settings"), isSaving ? /* @__PURE__ */ React8.createElement(Text7, { color: "yellow" }, "Saving...") : hasChanges ? /* @__PURE__ */ React8.createElement(Text7, { dimColor: true, color: "yellow" }, "(unsaved changes)") : null), saveError && /* @__PURE__ */ React8.createElement(Box8, { marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Text7, { color: "red" }, "Error: ", saveError)), /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column", marginBottom: 1 }, configItems.map((item, index) => {
865
+ return /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1, marginY: 1 }, /* @__PURE__ */ React8.createElement(Box8, { justifyContent: "space-between", marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Text7, { bold: true, color: "cyan" }, "Settings"), isSaving ? /* @__PURE__ */ React8.createElement(Text7, { color: "yellow" }, "Saving...") : hasChanges ? /* @__PURE__ */ React8.createElement(Text7, { dimColor: true, color: "yellow" }, "(unsaved changes)") : null), saveError && /* @__PURE__ */ React8.createElement(Box8, { marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Text7, { color: "red" }, "Error: ", saveError)), /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column", marginBottom: 1 }, CONFIG_ITEMS.map((item, index) => {
891
866
  const isSelected = index === selectedIndex;
892
867
  const value = item.getValue(editedConfig);
893
868
  const displayValue = formatValue(item, value);
@@ -1017,7 +992,6 @@ function App({
1017
992
  onPermissionResponse,
1018
993
  commandHistory = [],
1019
994
  config,
1020
- availableModels = [],
1021
995
  onSaveConfig
1022
996
  }) {
1023
997
  const messages = useCliStore((state) => state.session?.messages || []);
@@ -1059,15 +1033,7 @@ ${errorBlock}`;
1059
1033
  },
1060
1034
  [onMessage, onCommand, setIsThinking]
1061
1035
  );
1062
- return /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column" }, /* @__PURE__ */ React9.createElement(StatusBar, { sessionName, model: currentModel, tokenUsage: totalTokens }), showConfigEditor && config && onSaveConfig ? /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React9.createElement(
1063
- ConfigEditor,
1064
- {
1065
- config,
1066
- availableModels,
1067
- onSave: onSaveConfig,
1068
- onClose: () => setShowConfigEditor(false)
1069
- }
1070
- )) : permissionPrompt ? /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React9.createElement(
1036
+ return /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column" }, /* @__PURE__ */ React9.createElement(StatusBar, { sessionName, model: currentModel, tokenUsage: totalTokens }), showConfigEditor && config && onSaveConfig ? /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React9.createElement(ConfigEditor, { config, onSave: onSaveConfig, onClose: () => setShowConfigEditor(false) })) : permissionPrompt ? /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React9.createElement(
1071
1037
  PermissionPrompt,
1072
1038
  {
1073
1039
  toolName: permissionPrompt.toolName,
@@ -9249,40 +9215,9 @@ var ServerLlmBackend = class {
9249
9215
  }
9250
9216
  /**
9251
9217
  * Get available models from server
9252
- * Fetches from /api/models and filters for CLI-compatible models
9253
- * Falls back to hardcoded list if API fails
9218
+ * For now, returns hardcoded list of supported models
9254
9219
  */
9255
9220
  async getModelInfo() {
9256
- try {
9257
- logger.debug("[ServerLlmBackend] Fetching models from /api/models");
9258
- const response = await this.apiClient.get("/api/models");
9259
- if (!response || typeof response !== "object" || !Array.isArray(response.models)) {
9260
- logger.warn("[ServerLlmBackend] Invalid API response format, using fallback models");
9261
- logger.info("\u26A0\uFE0F Using fallback model list (API returned invalid format)");
9262
- return this.getFallbackModels();
9263
- }
9264
- const filteredModels = response.models.filter((model) => model.type === "text" && model.supportsTools === true);
9265
- logger.debug(`[ServerLlmBackend] Fetched ${filteredModels.length} CLI-compatible models`);
9266
- if (filteredModels.length === 0) {
9267
- logger.warn("[ServerLlmBackend] No CLI-compatible models found from API, using fallback");
9268
- logger.info("\u26A0\uFE0F Using fallback model list (no CLI-compatible models available)");
9269
- return this.getFallbackModels();
9270
- }
9271
- logger.info(`\u{1F4CB} Loaded ${filteredModels.length} models from server`);
9272
- return filteredModels;
9273
- } catch (error) {
9274
- logger.warn(
9275
- `[ServerLlmBackend] Failed to fetch models from API, using fallback: ${error instanceof Error ? error.message : String(error)}`
9276
- );
9277
- logger.info("\u26A0\uFE0F Using fallback model list (API unavailable)");
9278
- return this.getFallbackModels();
9279
- }
9280
- }
9281
- /**
9282
- * Fallback models when API is unavailable
9283
- * Returns hardcoded list of commonly supported models
9284
- */
9285
- getFallbackModels() {
9286
9221
  return [
9287
9222
  {
9288
9223
  id: "claude-sonnet-4-5-20250929",
@@ -9467,7 +9402,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
9467
9402
  // package.json
9468
9403
  var package_default = {
9469
9404
  name: "@bike4mind/cli",
9470
- version: "0.2.5-feat-cli-dynamic-model-fetching.17090+9a474f275",
9405
+ version: "0.2.5-feat-server-side-tool-execution.17093+db1662b89",
9471
9406
  type: "module",
9472
9407
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
9473
9408
  license: "UNLICENSED",
@@ -9569,10 +9504,10 @@ var package_default = {
9569
9504
  },
9570
9505
  devDependencies: {
9571
9506
  "@bike4mind/agents": "0.1.0",
9572
- "@bike4mind/common": "2.37.1-feat-cli-dynamic-model-fetching.17090+9a474f275",
9573
- "@bike4mind/mcp": "1.19.6-feat-cli-dynamic-model-fetching.17090+9a474f275",
9574
- "@bike4mind/services": "2.32.2-feat-cli-dynamic-model-fetching.17090+9a474f275",
9575
- "@bike4mind/utils": "2.1.1-feat-cli-dynamic-model-fetching.17090+9a474f275",
9507
+ "@bike4mind/common": "2.37.1-feat-server-side-tool-execution.17093+db1662b89",
9508
+ "@bike4mind/mcp": "1.19.6-feat-server-side-tool-execution.17093+db1662b89",
9509
+ "@bike4mind/services": "2.32.2-feat-server-side-tool-execution.17093+db1662b89",
9510
+ "@bike4mind/utils": "2.1.1-feat-server-side-tool-execution.17093+db1662b89",
9576
9511
  "@types/diff": "^5.0.9",
9577
9512
  "@types/jsonwebtoken": "^9.0.4",
9578
9513
  "@types/node": "^22.9.0",
@@ -9584,7 +9519,7 @@ var package_default = {
9584
9519
  typescript: "^5.9.3",
9585
9520
  vitest: "^3.2.4"
9586
9521
  },
9587
- gitHead: "9a474f27597e2e7625a73e2dc0436ae1e4f5d84e"
9522
+ gitHead: "db1662b8926451c7fdba8eb99245b75f6fae6693"
9588
9523
  };
9589
9524
 
9590
9525
  // src/config/constants.ts
@@ -9867,10 +9802,8 @@ Remember: Use context from previous messages to understand follow-up questions.`
9867
9802
  agent,
9868
9803
  mcpManager,
9869
9804
  permissionManager,
9870
- config,
9805
+ config
9871
9806
  // Store config for synchronous access
9872
- availableModels: models
9873
- // Store models for ConfigEditor
9874
9807
  }));
9875
9808
  setStoreSession(newSession);
9876
9809
  setIsInitialized(true);
@@ -10306,7 +10239,6 @@ No usage data available for the last ${USAGE_DAYS} days.`);
10306
10239
  onCommand: handleCommand,
10307
10240
  commandHistory,
10308
10241
  config: state.config,
10309
- availableModels: state.availableModels,
10310
10242
  onSaveConfig: handleSaveConfig,
10311
10243
  onPermissionResponse: (response) => {
10312
10244
  if (state.permissionPrompt) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.5-feat-cli-dynamic-model-fetching.17090+9a474f275",
3
+ "version": "0.2.5-feat-server-side-tool-execution.17093+db1662b89",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -102,10 +102,10 @@
102
102
  },
103
103
  "devDependencies": {
104
104
  "@bike4mind/agents": "0.1.0",
105
- "@bike4mind/common": "2.37.1-feat-cli-dynamic-model-fetching.17090+9a474f275",
106
- "@bike4mind/mcp": "1.19.6-feat-cli-dynamic-model-fetching.17090+9a474f275",
107
- "@bike4mind/services": "2.32.2-feat-cli-dynamic-model-fetching.17090+9a474f275",
108
- "@bike4mind/utils": "2.1.1-feat-cli-dynamic-model-fetching.17090+9a474f275",
105
+ "@bike4mind/common": "2.37.1-feat-server-side-tool-execution.17093+db1662b89",
106
+ "@bike4mind/mcp": "1.19.6-feat-server-side-tool-execution.17093+db1662b89",
107
+ "@bike4mind/services": "2.32.2-feat-server-side-tool-execution.17093+db1662b89",
108
+ "@bike4mind/utils": "2.1.1-feat-server-side-tool-execution.17093+db1662b89",
109
109
  "@types/diff": "^5.0.9",
110
110
  "@types/jsonwebtoken": "^9.0.4",
111
111
  "@types/node": "^22.9.0",
@@ -117,5 +117,5 @@
117
117
  "typescript": "^5.9.3",
118
118
  "vitest": "^3.2.4"
119
119
  },
120
- "gitHead": "9a474f27597e2e7625a73e2dc0436ae1e4f5d84e"
120
+ "gitHead": "db1662b8926451c7fdba8eb99245b75f6fae6693"
121
121
  }