@bike4mind/cli 0.2.10-ja-fix-confluence-table-data-5752.17252 → 0.2.10-slack-message-validated-length.17267
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/{artifactExtractor-WFUONETP.js → artifactExtractor-JAGU7QRL.js} +1 -1
- package/dist/{chunk-Y7TWJGN7.js → chunk-AQBZVAYO.js} +2 -2
- package/dist/{chunk-THQIBKD4.js → chunk-DJPXSSP4.js} +30 -115
- package/dist/{chunk-3I4UTS5N.js → chunk-GCVIRGIN.js} +1 -1
- package/dist/{chunk-BFYTGKUM.js → chunk-GO75FMLY.js} +2 -2
- package/dist/{chunk-KPZSR7LA.js → chunk-VZU4Z7WI.js} +2 -2
- package/dist/{create-QKBTX2SB.js → create-ZDOTF7XD.js} +3 -3
- package/dist/index.js +1871 -1146
- package/dist/{llmMarkdownGenerator-NALGM3SY.js → llmMarkdownGenerator-LXUGJ7QH.js} +1 -1
- package/dist/{markdownGenerator-GUZ3H2KM.js → markdownGenerator-IMDG6OX6.js} +1 -1
- package/dist/{mementoService-DVN7VNSJ.js → mementoService-TURUS3OH.js} +3 -3
- package/dist/{src-Q25OMI3Y.js → src-6ZRXGE5J.js} +2 -2
- package/dist/{src-KKM67YED.js → src-YNY32ELR.js} +3 -7
- package/dist/{subtractCredits-YCAHUW6W.js → subtractCredits-GOVKM3IR.js} +3 -3
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
getEffectiveApiKey,
|
|
5
5
|
getOpenWeatherKey,
|
|
6
6
|
getSerperKey
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
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-
|
|
18
|
+
} from "./chunk-GCVIRGIN.js";
|
|
19
19
|
import {
|
|
20
20
|
Logger
|
|
21
21
|
} from "./chunk-AMDXHL6S.js";
|
|
@@ -73,29 +73,30 @@ import {
|
|
|
73
73
|
XAI_IMAGE_MODELS,
|
|
74
74
|
b4mLLMTools,
|
|
75
75
|
getMcpProviderMetadata
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-DJPXSSP4.js";
|
|
77
77
|
import {
|
|
78
78
|
__require
|
|
79
79
|
} from "./chunk-PDX44BCA.js";
|
|
80
80
|
|
|
81
81
|
// src/index.tsx
|
|
82
|
-
import
|
|
83
|
-
import { render, Box as
|
|
82
|
+
import React17, { useState as useState8, useEffect as useEffect3, useCallback, useRef as useRef2 } from "react";
|
|
83
|
+
import { render, Box as Box16, Text as Text16, useApp, useInput as useInput6 } from "ink";
|
|
84
|
+
import { execSync } from "child_process";
|
|
84
85
|
import { v4 as uuidv49 } from "uuid";
|
|
85
86
|
|
|
86
87
|
// src/components/App.tsx
|
|
87
|
-
import
|
|
88
|
-
import { Box as
|
|
88
|
+
import React11, { useState as useState4 } from "react";
|
|
89
|
+
import { Box as Box10, Text as Text10, Static } from "ink";
|
|
89
90
|
|
|
90
91
|
// src/components/StatusBar.tsx
|
|
91
92
|
import React from "react";
|
|
92
93
|
import { Box, Text } from "ink";
|
|
93
94
|
var StatusBar = React.memo(function StatusBar2({ sessionName, model, tokenUsage }) {
|
|
94
|
-
return /* @__PURE__ */ React.createElement(Box, {
|
|
95
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "row", justifyContent: "space-between", width: "100%", paddingX: 1 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, sessionName), /* @__PURE__ */ React.createElement(Box, { gap: 2 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, tokenUsage.toLocaleString(), " tokens"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, model)));
|
|
95
96
|
});
|
|
96
97
|
|
|
97
98
|
// src/components/InputPrompt.tsx
|
|
98
|
-
import React5, { useState as useState2, useMemo, useEffect } from "react";
|
|
99
|
+
import React5, { useState as useState2, useMemo, useEffect, useRef } from "react";
|
|
99
100
|
import { Box as Box4, Text as Text5, useInput as useInput2 } from "ink";
|
|
100
101
|
|
|
101
102
|
// src/components/CustomTextInput.tsx
|
|
@@ -209,7 +210,8 @@ function CommandAutocomplete({ commands, selectedIndex }) {
|
|
|
209
210
|
return /* @__PURE__ */ React3.createElement(Box2, { flexDirection: "column", marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React3.createElement(Box2, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, commands.length === 1 ? "1 command" : `${commands.length} commands`, " \u2022 Use \u2191\u2193 to navigate, Enter to select")), commands.map((cmd, index) => {
|
|
210
211
|
const args = cmd.args ? ` ${cmd.args}` : "";
|
|
211
212
|
const isSelected = index === selectedIndex;
|
|
212
|
-
|
|
213
|
+
const sourceIcon = cmd.source === "global" ? "\u{1F3E0} " : cmd.source === "project" ? "\u{1F4C1} " : cmd.source === "built-in" ? "\u{1F527} " : "";
|
|
214
|
+
return /* @__PURE__ */ React3.createElement(Box2, { key: cmd.name, marginLeft: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: isSelected ? "cyan" : void 0, bold: isSelected }, isSelected ? "\u25B8 " : " ", sourceIcon, "/", cmd.name, args, " - ", cmd.description));
|
|
213
215
|
}));
|
|
214
216
|
}
|
|
215
217
|
|
|
@@ -310,7 +312,7 @@ function searchFiles(query) {
|
|
|
310
312
|
searchPool = files;
|
|
311
313
|
}
|
|
312
314
|
}
|
|
313
|
-
const
|
|
315
|
+
const fuse = new Fuse(searchPool, {
|
|
314
316
|
keys: [{ name: "path", weight: 1 }],
|
|
315
317
|
threshold: 0.4,
|
|
316
318
|
// Allow some fuzzy matching
|
|
@@ -319,7 +321,7 @@ function searchFiles(query) {
|
|
|
319
321
|
// Use extended search for better path matching
|
|
320
322
|
useExtendedSearch: false
|
|
321
323
|
});
|
|
322
|
-
const results =
|
|
324
|
+
const results = fuse.search(query);
|
|
323
325
|
return results.slice(0, 20).map((result) => result.item);
|
|
324
326
|
}
|
|
325
327
|
function isPathWithinCwd(filePath) {
|
|
@@ -494,11 +496,61 @@ var COMMANDS = [
|
|
|
494
496
|
name: "rewind",
|
|
495
497
|
description: "Rewind conversation to a previous point",
|
|
496
498
|
aliases: ["undo"]
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
name: "project-config",
|
|
502
|
+
description: "Show merged project configuration"
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
name: "commands",
|
|
506
|
+
description: "List all custom commands"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
name: "commands:new",
|
|
510
|
+
description: "Create a new custom command",
|
|
511
|
+
args: "<name>"
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
name: "commands:reload",
|
|
515
|
+
description: "Reload custom commands from disk"
|
|
497
516
|
}
|
|
498
517
|
];
|
|
518
|
+
function getAllCommandNames() {
|
|
519
|
+
const names = [];
|
|
520
|
+
for (const cmd of COMMANDS) {
|
|
521
|
+
names.push(cmd.name);
|
|
522
|
+
if (cmd.aliases) {
|
|
523
|
+
names.push(...cmd.aliases);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return names;
|
|
527
|
+
}
|
|
528
|
+
function isBuiltInCommand(name) {
|
|
529
|
+
return getAllCommandNames().includes(name);
|
|
530
|
+
}
|
|
531
|
+
function customCommandToDefinition(customCommand) {
|
|
532
|
+
return {
|
|
533
|
+
name: customCommand.name,
|
|
534
|
+
description: customCommand.description,
|
|
535
|
+
args: customCommand.argumentHint,
|
|
536
|
+
source: customCommand.source
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
function mergeCommands(customCommands) {
|
|
540
|
+
const builtInCommands = COMMANDS.map((cmd) => ({ ...cmd, source: "built-in" }));
|
|
541
|
+
const customDefinitions = customCommands.filter((cmd) => !isBuiltInCommand(cmd.name)).map(customCommandToDefinition);
|
|
542
|
+
const conflicts = customCommands.filter((cmd) => isBuiltInCommand(cmd.name));
|
|
543
|
+
if (conflicts.length > 0) {
|
|
544
|
+
console.warn(
|
|
545
|
+
"Warning: The following custom commands have names that conflict with built-in commands and will be ignored:",
|
|
546
|
+
conflicts.map((cmd) => cmd.name).join(", ")
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
return [...builtInCommands, ...customDefinitions];
|
|
550
|
+
}
|
|
499
551
|
|
|
500
552
|
// src/utils/fuzzySearch.ts
|
|
501
|
-
var
|
|
553
|
+
var fuseOptions = {
|
|
502
554
|
keys: [
|
|
503
555
|
{ name: "name", weight: 0.7 },
|
|
504
556
|
// Prioritize command name
|
|
@@ -509,11 +561,12 @@ var fuse = new Fuse2(COMMANDS, {
|
|
|
509
561
|
// 0 = perfect match, 1 = match anything
|
|
510
562
|
includeScore: true,
|
|
511
563
|
minMatchCharLength: 1
|
|
512
|
-
}
|
|
513
|
-
function searchCommands(query) {
|
|
564
|
+
};
|
|
565
|
+
function searchCommands(query, commands = COMMANDS) {
|
|
514
566
|
if (!query || query.trim() === "") {
|
|
515
|
-
return
|
|
567
|
+
return commands;
|
|
516
568
|
}
|
|
569
|
+
const fuse = new Fuse2(commands, fuseOptions);
|
|
517
570
|
const results = fuse.search(query);
|
|
518
571
|
return results.map((result) => result.item);
|
|
519
572
|
}
|
|
@@ -732,17 +785,20 @@ function findAtTrigger(value) {
|
|
|
732
785
|
}
|
|
733
786
|
function InputPrompt({
|
|
734
787
|
onSubmit,
|
|
788
|
+
onBashCommand,
|
|
735
789
|
onImageDetected,
|
|
736
790
|
disabled = false,
|
|
737
791
|
history = [],
|
|
792
|
+
commands = [],
|
|
738
793
|
prefillInput,
|
|
739
|
-
onPrefillConsumed
|
|
794
|
+
onPrefillConsumed,
|
|
795
|
+
onBashModeChange
|
|
740
796
|
}) {
|
|
741
797
|
const [value, setValue] = useState2("");
|
|
742
798
|
const [selectedIndex, setSelectedIndex] = useState2(0);
|
|
743
799
|
const [historyIndex, setHistoryIndex] = useState2(-1);
|
|
744
800
|
const [tempInput, setTempInput] = useState2("");
|
|
745
|
-
const
|
|
801
|
+
const inputKey = useRef(0);
|
|
746
802
|
useEffect(() => {
|
|
747
803
|
if (prefillInput) {
|
|
748
804
|
setValue(prefillInput);
|
|
@@ -751,12 +807,16 @@ function InputPrompt({
|
|
|
751
807
|
}, [prefillInput, onPrefillConsumed]);
|
|
752
808
|
const [fileAutocomplete, setFileAutocomplete] = useState2(null);
|
|
753
809
|
const [fileSelectedIndex, setFileSelectedIndex] = useState2(0);
|
|
810
|
+
const isBashMode = value.startsWith("!");
|
|
811
|
+
useEffect(() => {
|
|
812
|
+
onBashModeChange?.(isBashMode);
|
|
813
|
+
}, [isBashMode, onBashModeChange]);
|
|
754
814
|
const shouldShowCommandAutocomplete = value.startsWith("/") && !disabled && !fileAutocomplete?.active;
|
|
755
815
|
const commandQuery = shouldShowCommandAutocomplete ? value.slice(1) : "";
|
|
756
816
|
const filteredCommands = useMemo(() => {
|
|
757
817
|
if (!shouldShowCommandAutocomplete) return [];
|
|
758
|
-
return searchCommands(commandQuery);
|
|
759
|
-
}, [shouldShowCommandAutocomplete, commandQuery]);
|
|
818
|
+
return searchCommands(commandQuery, commands);
|
|
819
|
+
}, [shouldShowCommandAutocomplete, commandQuery, commands]);
|
|
760
820
|
const filteredFiles = useMemo(() => {
|
|
761
821
|
if (!fileAutocomplete?.active) return [];
|
|
762
822
|
return searchFiles(fileAutocomplete.query);
|
|
@@ -857,6 +917,16 @@ function InputPrompt({
|
|
|
857
917
|
onSubmit(commandText);
|
|
858
918
|
return;
|
|
859
919
|
}
|
|
920
|
+
if (isBashMode && onBashCommand) {
|
|
921
|
+
const command = input.slice(1).trim();
|
|
922
|
+
if (command) {
|
|
923
|
+
onBashCommand(command);
|
|
924
|
+
setValue("");
|
|
925
|
+
setHistoryIndex(-1);
|
|
926
|
+
setFileAutocomplete(null);
|
|
927
|
+
}
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
860
930
|
onSubmit(input);
|
|
861
931
|
setValue("");
|
|
862
932
|
setHistoryIndex(-1);
|
|
@@ -887,14 +957,19 @@ function InputPrompt({
|
|
|
887
957
|
setFileAutocomplete(null);
|
|
888
958
|
}
|
|
889
959
|
};
|
|
890
|
-
|
|
960
|
+
const getPlaceholder = () => {
|
|
961
|
+
if (disabled) return "Thinking...";
|
|
962
|
+
if (isBashMode) return "Enter shell command to execute...";
|
|
963
|
+
return "Type your message, /help for commands, @file to reference, or ! for bash";
|
|
964
|
+
};
|
|
965
|
+
return /* @__PURE__ */ React5.createElement(Box4, { flexDirection: "column" }, /* @__PURE__ */ React5.createElement(Box4, null, /* @__PURE__ */ React5.createElement(Text5, { bold: true, color: isBashMode ? "yellow" : "cyan" }, isBashMode ? "$ " : "> "), /* @__PURE__ */ React5.createElement(
|
|
891
966
|
CustomTextInput,
|
|
892
967
|
{
|
|
893
|
-
key: inputKey,
|
|
968
|
+
key: inputKey.current,
|
|
894
969
|
value,
|
|
895
970
|
onChange: handleChange,
|
|
896
971
|
onSubmit: handleSubmit,
|
|
897
|
-
placeholder:
|
|
972
|
+
placeholder: getPlaceholder(),
|
|
898
973
|
showCursor: !disabled
|
|
899
974
|
}
|
|
900
975
|
)), shouldShowCommandAutocomplete && /* @__PURE__ */ React5.createElement(CommandAutocomplete, { commands: filteredCommands, selectedIndex }), fileAutocomplete?.active && /* @__PURE__ */ React5.createElement(FileAutocomplete, { files: filteredFiles, selectedIndex: fileSelectedIndex, query: fileAutocomplete.query }));
|
|
@@ -918,6 +993,39 @@ var useCliStore = create((set) => ({
|
|
|
918
993
|
// Session state
|
|
919
994
|
session: null,
|
|
920
995
|
setSession: (session) => set({ session }),
|
|
996
|
+
addMessage: (message) => set((state) => {
|
|
997
|
+
if (!state.session) return state;
|
|
998
|
+
return {
|
|
999
|
+
session: {
|
|
1000
|
+
...state.session,
|
|
1001
|
+
messages: [...state.session.messages, message],
|
|
1002
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
}),
|
|
1006
|
+
// Pending messages
|
|
1007
|
+
pendingMessages: [],
|
|
1008
|
+
addPendingMessage: (message) => set((state) => ({ pendingMessages: [...state.pendingMessages, message] })),
|
|
1009
|
+
updatePendingMessage: (index, message) => set((state) => {
|
|
1010
|
+
const updated = [...state.pendingMessages];
|
|
1011
|
+
updated[index] = message;
|
|
1012
|
+
return { pendingMessages: updated };
|
|
1013
|
+
}),
|
|
1014
|
+
clearPendingMessages: () => set({ pendingMessages: [] }),
|
|
1015
|
+
completePendingMessage: (index, finalMessage) => set((state) => {
|
|
1016
|
+
const pending = [...state.pendingMessages];
|
|
1017
|
+
pending.splice(index, 1);
|
|
1018
|
+
const session = state.session;
|
|
1019
|
+
if (!session) return { pendingMessages: pending };
|
|
1020
|
+
return {
|
|
1021
|
+
pendingMessages: pending,
|
|
1022
|
+
session: {
|
|
1023
|
+
...session,
|
|
1024
|
+
messages: [...session.messages, finalMessage],
|
|
1025
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
}),
|
|
921
1029
|
// UI state
|
|
922
1030
|
isThinking: false,
|
|
923
1031
|
setIsThinking: (thinking) => set({ isThinking: thinking }),
|
|
@@ -1217,6 +1325,26 @@ function ConfigEditor({ config, availableModels, onSave, onClose }) {
|
|
|
1217
1325
|
})), /* @__PURE__ */ React9.createElement(Box8, { borderStyle: "single", borderColor: "gray", paddingX: 1 }, /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, "\u2191/\u2193: Navigate | Space/\u2190/\u2192: Change | q/Esc: Save & Exit")));
|
|
1218
1326
|
}
|
|
1219
1327
|
|
|
1328
|
+
// src/components/MessageItem.tsx
|
|
1329
|
+
import React10 from "react";
|
|
1330
|
+
import { Box as Box9, Text as Text9 } from "ink";
|
|
1331
|
+
function MessageItem({ message }) {
|
|
1332
|
+
const isUser = message.role === "user";
|
|
1333
|
+
return /* @__PURE__ */ React10.createElement(Box9, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Box9, null, /* @__PURE__ */ React10.createElement(Text9, { bold: true, color: isUser ? "cyan" : "green" }, isUser ? "\u{1F464} You" : "\u{1F916} Assistant"), isUser && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), isUser && message.content && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { backgroundColor: "whiteBright", color: "black" }, " ", message.content, " ")), !isUser && message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " ", "tools used, ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
|
|
1334
|
+
if (step.type === "thought") {
|
|
1335
|
+
return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` ${step.content.slice(0, 200)}${step.content.length > 200 ? "..." : ""}`));
|
|
1336
|
+
}
|
|
1337
|
+
if (step.type === "action") {
|
|
1338
|
+
const toolName = step.metadata?.toolName || "unknown";
|
|
1339
|
+
const toolInput = step.metadata?.toolInput;
|
|
1340
|
+
const observationStep = message.metadata.steps[idx + 1];
|
|
1341
|
+
const result = observationStep?.type === "observation" ? observationStep.content : null;
|
|
1342
|
+
return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
|
|
1343
|
+
}
|
|
1344
|
+
return null;
|
|
1345
|
+
}).filter(Boolean)), !isUser && message.content !== "..." && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2, marginTop: message.metadata?.steps?.length ? 1 : 0 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React10.createElement(Text9, { color: "yellow" }, "\u26A0\uFE0F ", message.content) : /* @__PURE__ */ React10.createElement(Text9, null, message.content)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)));
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1220
1348
|
// src/utils/processFileReferences.ts
|
|
1221
1349
|
import * as fs2 from "fs";
|
|
1222
1350
|
import * as path2 from "path";
|
|
@@ -1335,9 +1463,11 @@ function hasFileReferences(message) {
|
|
|
1335
1463
|
function App({
|
|
1336
1464
|
onMessage,
|
|
1337
1465
|
onCommand,
|
|
1466
|
+
onBashCommand,
|
|
1338
1467
|
onPermissionResponse,
|
|
1339
1468
|
onImageDetected,
|
|
1340
1469
|
commandHistory = [],
|
|
1470
|
+
commands = [],
|
|
1341
1471
|
config,
|
|
1342
1472
|
availableModels = [],
|
|
1343
1473
|
onSaveConfig,
|
|
@@ -1345,6 +1475,7 @@ function App({
|
|
|
1345
1475
|
onPrefillConsumed
|
|
1346
1476
|
}) {
|
|
1347
1477
|
const messages = useCliStore((state) => state.session?.messages || []);
|
|
1478
|
+
const pendingMessages = useCliStore((state) => state.pendingMessages);
|
|
1348
1479
|
const sessionName = useCliStore((state) => state.session?.name || "New Session");
|
|
1349
1480
|
const currentModel = useCliStore((state) => state.session?.model || "claude-sonnet-4-5-20250929");
|
|
1350
1481
|
const totalTokens = useCliStore((state) => state.session?.metadata.totalTokens || 0);
|
|
@@ -1354,7 +1485,8 @@ function App({
|
|
|
1354
1485
|
const setShowConfigEditor = useCliStore((state) => state.setShowConfigEditor);
|
|
1355
1486
|
const exitRequested = useCliStore((state) => state.exitRequested);
|
|
1356
1487
|
const setIsThinking = useCliStore((state) => state.setIsThinking);
|
|
1357
|
-
const
|
|
1488
|
+
const [isBashMode, setIsBashMode] = useState4(false);
|
|
1489
|
+
const handleSubmit = React11.useCallback(
|
|
1358
1490
|
async (input) => {
|
|
1359
1491
|
const trimmed = input.trim();
|
|
1360
1492
|
if (!trimmed) return;
|
|
@@ -1383,7 +1515,7 @@ ${errorBlock}`;
|
|
|
1383
1515
|
},
|
|
1384
1516
|
[onMessage, onCommand, setIsThinking]
|
|
1385
1517
|
);
|
|
1386
|
-
return /* @__PURE__ */
|
|
1518
|
+
return /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column" }, showConfigEditor && config && onSaveConfig ? /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React11.createElement(
|
|
1387
1519
|
ConfigEditor,
|
|
1388
1520
|
{
|
|
1389
1521
|
config,
|
|
@@ -1391,7 +1523,7 @@ ${errorBlock}`;
|
|
|
1391
1523
|
onSave: onSaveConfig,
|
|
1392
1524
|
onClose: () => setShowConfigEditor(false)
|
|
1393
1525
|
}
|
|
1394
|
-
)) : permissionPrompt ? /* @__PURE__ */
|
|
1526
|
+
)) : permissionPrompt ? /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React11.createElement(
|
|
1395
1527
|
PermissionPrompt,
|
|
1396
1528
|
{
|
|
1397
1529
|
toolName: permissionPrompt.toolName,
|
|
@@ -1400,50 +1532,37 @@ ${errorBlock}`;
|
|
|
1400
1532
|
canBeTrusted: permissionPrompt.canBeTrusted,
|
|
1401
1533
|
onResponse: onPermissionResponse
|
|
1402
1534
|
}
|
|
1403
|
-
)) : /* @__PURE__ */
|
|
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(
|
|
1404
1536
|
InputPrompt,
|
|
1405
1537
|
{
|
|
1406
1538
|
onSubmit: handleSubmit,
|
|
1539
|
+
onBashCommand,
|
|
1407
1540
|
onImageDetected,
|
|
1408
1541
|
disabled: isThinking,
|
|
1409
1542
|
history: commandHistory,
|
|
1543
|
+
commands,
|
|
1410
1544
|
prefillInput,
|
|
1411
|
-
onPrefillConsumed
|
|
1412
|
-
|
|
1413
|
-
))));
|
|
1414
|
-
}
|
|
1415
|
-
function MessageItem({ message }) {
|
|
1416
|
-
const isUser = message.role === "user";
|
|
1417
|
-
return /* @__PURE__ */ React10.createElement(Box9, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Box9, null, /* @__PURE__ */ React10.createElement(Text9, { bold: true, color: isUser ? "cyan" : "green" }, isUser ? "\u{1F464} You" : "\u{1F916} Assistant"), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), isUser && message.content && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { backgroundColor: "whiteBright", color: "black" }, " ", message.content, " ")), !isUser && message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " ", "tools used, ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
|
|
1418
|
-
if (step.type === "thought") {
|
|
1419
|
-
return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` ${step.content.slice(0, 200)}${step.content.length > 200 ? "..." : ""}`));
|
|
1420
|
-
}
|
|
1421
|
-
if (step.type === "action") {
|
|
1422
|
-
const toolName = step.metadata?.toolName || "unknown";
|
|
1423
|
-
const toolInput = step.metadata?.toolInput;
|
|
1424
|
-
const observationStep = message.metadata.steps[idx + 1];
|
|
1425
|
-
const result = observationStep?.type === "observation" ? observationStep.content : null;
|
|
1426
|
-
return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
|
|
1545
|
+
onPrefillConsumed,
|
|
1546
|
+
onBashModeChange: setIsBashMode
|
|
1427
1547
|
}
|
|
1428
|
-
|
|
1429
|
-
}).filter(Boolean)), !isUser && message.content !== "..." && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2, marginTop: message.metadata?.steps?.length ? 1 : 0 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React10.createElement(Text9, { color: "yellow" }, "\u26A0\uFE0F ", message.content) : /* @__PURE__ */ React10.createElement(Text9, null, message.content)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)));
|
|
1548
|
+
)), /* @__PURE__ */ React11.createElement(StatusBar, { sessionName, model: currentModel, tokenUsage: totalTokens })));
|
|
1430
1549
|
}
|
|
1431
1550
|
|
|
1432
1551
|
// src/components/MessageList.tsx
|
|
1433
|
-
import
|
|
1434
|
-
import { Box as
|
|
1552
|
+
import React12 from "react";
|
|
1553
|
+
import { Box as Box11, Text as Text11 } from "ink";
|
|
1435
1554
|
function stripThinkingTags(content) {
|
|
1436
1555
|
return content.replace(/<think>[\s\S]*?<\/think>/g, "").trim();
|
|
1437
1556
|
}
|
|
1438
|
-
var MessageList =
|
|
1557
|
+
var MessageList = React12.memo(
|
|
1439
1558
|
function MessageList2({ messages }) {
|
|
1440
1559
|
if (messages.length === 0) {
|
|
1441
|
-
return /* @__PURE__ */
|
|
1560
|
+
return /* @__PURE__ */ React12.createElement(Box11, { paddingY: 1 }, /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, "No messages yet. Type a message to start!"));
|
|
1442
1561
|
}
|
|
1443
|
-
return /* @__PURE__ */
|
|
1562
|
+
return /* @__PURE__ */ React12.createElement(Box11, { flexDirection: "column", gap: 1, paddingY: 1 }, messages.map((message, index) => /* @__PURE__ */ React12.createElement(Box11, { key: index, flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React12.createElement(Box11, null, /* @__PURE__ */ React12.createElement(Text11, { bold: true, color: message.role === "user" ? "cyan" : "green" }, message.role === "user" ? "\u{1F464} You" : "\u{1F916} Assistant"), /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), /* @__PURE__ */ React12.createElement(Box11, { paddingLeft: 2 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React12.createElement(Text11, { color: "yellow" }, "\u26A0\uFE0F ", stripThinkingTags(message.content)) : /* @__PURE__ */ React12.createElement(Text11, null, stripThinkingTags(message.content))), message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React12.createElement(Box11, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React12.createElement(Text11, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " tools used,", " ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
|
|
1444
1563
|
if (step.type === "thought") {
|
|
1445
|
-
return /* @__PURE__ */
|
|
1446
|
-
|
|
1564
|
+
return /* @__PURE__ */ React12.createElement(Box11, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React12.createElement(Text11, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React12.createElement(
|
|
1565
|
+
Text11,
|
|
1447
1566
|
{
|
|
1448
1567
|
dimColor: true
|
|
1449
1568
|
},
|
|
@@ -1455,10 +1574,10 @@ var MessageList = React11.memo(
|
|
|
1455
1574
|
const toolInput = step.metadata?.toolInput;
|
|
1456
1575
|
const observationStep = message.metadata.steps[idx + 1];
|
|
1457
1576
|
const result = observationStep?.type === "observation" ? observationStep.content : null;
|
|
1458
|
-
return /* @__PURE__ */
|
|
1577
|
+
return /* @__PURE__ */ React12.createElement(Box11, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React12.createElement(Text11, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
|
|
1459
1578
|
}
|
|
1460
1579
|
return null;
|
|
1461
|
-
}).filter(Boolean)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */
|
|
1580
|
+
}).filter(Boolean)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React12.createElement(Box11, { paddingLeft: 2 }, /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)))));
|
|
1462
1581
|
},
|
|
1463
1582
|
(prevProps, nextProps) => {
|
|
1464
1583
|
if (prevProps.messages.length !== nextProps.messages.length) {
|
|
@@ -1469,8 +1588,8 @@ var MessageList = React11.memo(
|
|
|
1469
1588
|
);
|
|
1470
1589
|
|
|
1471
1590
|
// src/components/TrustLocationSelector.tsx
|
|
1472
|
-
import
|
|
1473
|
-
import { Box as
|
|
1591
|
+
import React13 from "react";
|
|
1592
|
+
import { Box as Box12, Text as Text12 } from "ink";
|
|
1474
1593
|
import SelectInput2 from "ink-select-input";
|
|
1475
1594
|
function TrustLocationSelector({ inProject, onSelect, onCancel }) {
|
|
1476
1595
|
const items = [];
|
|
@@ -1491,23 +1610,23 @@ function TrustLocationSelector({ inProject, onSelect, onCancel }) {
|
|
|
1491
1610
|
const handleSelect = (item) => {
|
|
1492
1611
|
onSelect(item.value);
|
|
1493
1612
|
};
|
|
1494
|
-
return /* @__PURE__ */
|
|
1613
|
+
return /* @__PURE__ */ React13.createElement(Box12, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React13.createElement(Box12, { marginBottom: 1 }, /* @__PURE__ */ React13.createElement(Text12, { bold: true }, "Where should this rule be saved?")), /* @__PURE__ */ React13.createElement(
|
|
1495
1614
|
SelectInput2,
|
|
1496
1615
|
{
|
|
1497
1616
|
items,
|
|
1498
1617
|
onSelect: handleSelect,
|
|
1499
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1618
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React13.createElement(Box12, null, /* @__PURE__ */ React13.createElement(Text12, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1500
1619
|
}
|
|
1501
|
-
), /* @__PURE__ */
|
|
1620
|
+
), /* @__PURE__ */ React13.createElement(Box12, { marginTop: 1 }, /* @__PURE__ */ React13.createElement(Text12, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Ctrl+C to cancel")));
|
|
1502
1621
|
}
|
|
1503
1622
|
|
|
1504
1623
|
// src/components/RewindSelector.tsx
|
|
1505
|
-
import
|
|
1506
|
-
import { Box as
|
|
1624
|
+
import React14, { useState as useState5 } from "react";
|
|
1625
|
+
import { Box as Box13, Text as Text13, useInput as useInput4 } from "ink";
|
|
1507
1626
|
import SelectInput3 from "ink-select-input";
|
|
1508
1627
|
function RewindSelector({ messages, onSelect, onCancel }) {
|
|
1509
|
-
const [step, setStep] =
|
|
1510
|
-
const [selectedMessageIndex, setSelectedMessageIndex] =
|
|
1628
|
+
const [step, setStep] = useState5("selection");
|
|
1629
|
+
const [selectedMessageIndex, setSelectedMessageIndex] = useState5(null);
|
|
1511
1630
|
useInput4((input, key) => {
|
|
1512
1631
|
if (key.escape) {
|
|
1513
1632
|
if (step === "confirmation") {
|
|
@@ -1545,14 +1664,14 @@ function RewindSelector({ messages, onSelect, onCancel }) {
|
|
|
1545
1664
|
return sum2 + (msg.metadata?.tokenUsage?.total || 0);
|
|
1546
1665
|
}, 0);
|
|
1547
1666
|
if (step === "selection") {
|
|
1548
|
-
return /* @__PURE__ */
|
|
1667
|
+
return /* @__PURE__ */ React14.createElement(Box13, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React14.createElement(Box13, { marginBottom: 1 }, /* @__PURE__ */ React14.createElement(Text13, { bold: true }, "Select a point to rewind to:")), /* @__PURE__ */ React14.createElement(
|
|
1549
1668
|
SelectInput3,
|
|
1550
1669
|
{
|
|
1551
1670
|
items,
|
|
1552
1671
|
onSelect: handleSelectionSelect,
|
|
1553
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1672
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React14.createElement(Box13, null, /* @__PURE__ */ React14.createElement(Text13, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1554
1673
|
}
|
|
1555
|
-
), /* @__PURE__ */
|
|
1674
|
+
), /* @__PURE__ */ React14.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to cancel")));
|
|
1556
1675
|
}
|
|
1557
1676
|
const confirmationItems = [
|
|
1558
1677
|
{ label: "Yes, rewind to this point", value: "confirm" },
|
|
@@ -1560,23 +1679,23 @@ function RewindSelector({ messages, onSelect, onCancel }) {
|
|
|
1560
1679
|
];
|
|
1561
1680
|
const selectedMessage = selectedMessageIndex !== null && selectedMessageIndex >= 0 && selectedMessageIndex < messages.length ? messages[selectedMessageIndex] : null;
|
|
1562
1681
|
const selectedPreview = selectedMessage ? selectedMessage.content.length > 50 ? selectedMessage.content.substring(0, 50) + "..." : selectedMessage.content : "";
|
|
1563
|
-
return /* @__PURE__ */
|
|
1682
|
+
return /* @__PURE__ */ React14.createElement(Box13, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React14.createElement(Box13, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React14.createElement(Text13, { bold: true }, "Confirm rewind operation:"), /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, "Message: ", selectedPreview), /* @__PURE__ */ React14.createElement(Text13, { color: "yellow" }, "This will remove ", messagesToRemove.length, " message(s) (", tokensToRemove.toLocaleString(), " tokens)"), /* @__PURE__ */ React14.createElement(Text13, { color: "cyan" }, "The selected message will be placed in your input for editing.")), /* @__PURE__ */ React14.createElement(
|
|
1564
1683
|
SelectInput3,
|
|
1565
1684
|
{
|
|
1566
1685
|
items: confirmationItems,
|
|
1567
1686
|
onSelect: handleConfirmationSelect,
|
|
1568
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1687
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React14.createElement(Box13, null, /* @__PURE__ */ React14.createElement(Text13, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1569
1688
|
}
|
|
1570
|
-
), /* @__PURE__ */
|
|
1689
|
+
), /* @__PURE__ */ React14.createElement(Box13, { marginTop: 1 }, /* @__PURE__ */ React14.createElement(Text13, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to go back")));
|
|
1571
1690
|
}
|
|
1572
1691
|
|
|
1573
1692
|
// src/components/SessionSelector.tsx
|
|
1574
|
-
import
|
|
1575
|
-
import { Box as
|
|
1693
|
+
import React15, { useState as useState6 } from "react";
|
|
1694
|
+
import { Box as Box14, Text as Text14, useInput as useInput5 } from "ink";
|
|
1576
1695
|
import SelectInput4 from "ink-select-input";
|
|
1577
1696
|
function SessionSelector({ sessions, currentSession, onSelect, onCancel }) {
|
|
1578
|
-
const [step, setStep] =
|
|
1579
|
-
const [selectedSession, setSelectedSession] =
|
|
1697
|
+
const [step, setStep] = useState6("selection");
|
|
1698
|
+
const [selectedSession, setSelectedSession] = useState6(null);
|
|
1580
1699
|
useInput5((input, key) => {
|
|
1581
1700
|
if (key.escape) {
|
|
1582
1701
|
if (step === "confirmation") {
|
|
@@ -1610,32 +1729,32 @@ function SessionSelector({ sessions, currentSession, onSelect, onCancel }) {
|
|
|
1610
1729
|
}
|
|
1611
1730
|
};
|
|
1612
1731
|
if (step === "selection") {
|
|
1613
|
-
return /* @__PURE__ */
|
|
1732
|
+
return /* @__PURE__ */ React15.createElement(Box14, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React15.createElement(Box14, { marginBottom: 1 }, /* @__PURE__ */ React15.createElement(Text14, { bold: true }, "Select a session to resume:")), /* @__PURE__ */ React15.createElement(
|
|
1614
1733
|
SelectInput4,
|
|
1615
1734
|
{
|
|
1616
1735
|
items,
|
|
1617
1736
|
onSelect: handleSelectionSelect,
|
|
1618
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1737
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React15.createElement(Box14, null, /* @__PURE__ */ React15.createElement(Text14, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1619
1738
|
}
|
|
1620
|
-
), /* @__PURE__ */
|
|
1739
|
+
), /* @__PURE__ */ React15.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React15.createElement(Text14, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to cancel")));
|
|
1621
1740
|
}
|
|
1622
1741
|
const confirmationItems = [
|
|
1623
1742
|
{ label: "Yes, resume this session", value: "confirm" },
|
|
1624
1743
|
{ label: "No, go back to selection", value: "cancel" }
|
|
1625
1744
|
];
|
|
1626
|
-
return /* @__PURE__ */
|
|
1745
|
+
return /* @__PURE__ */ React15.createElement(Box14, { flexDirection: "column", marginY: 1 }, /* @__PURE__ */ React15.createElement(Box14, { marginBottom: 1, flexDirection: "column" }, /* @__PURE__ */ React15.createElement(Text14, { bold: true }, 'Resume session: "', selectedSession?.name, '"'), /* @__PURE__ */ React15.createElement(Text14, { dimColor: true }, selectedSession?.messages.length, " messages | ", selectedSession?.model, " |", " ", selectedSession?.metadata?.totalTokens?.toLocaleString() ?? 0, " tokens"), hasUnsavedWork && /* @__PURE__ */ React15.createElement(Text14, { color: "yellow" }, "Warning: Your current session has unsaved messages. Use /save first if needed.")), /* @__PURE__ */ React15.createElement(
|
|
1627
1746
|
SelectInput4,
|
|
1628
1747
|
{
|
|
1629
1748
|
items: confirmationItems,
|
|
1630
1749
|
onSelect: handleConfirmationSelect,
|
|
1631
|
-
itemComponent: ({ isSelected, label }) => /* @__PURE__ */
|
|
1750
|
+
itemComponent: ({ isSelected, label }) => /* @__PURE__ */ React15.createElement(Box14, null, /* @__PURE__ */ React15.createElement(Text14, { color: isSelected ? "cyan" : void 0 }, isSelected ? "\u276F " : " ", label))
|
|
1632
1751
|
}
|
|
1633
|
-
), /* @__PURE__ */
|
|
1752
|
+
), /* @__PURE__ */ React15.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React15.createElement(Text14, { dimColor: true }, "Use \u2191\u2193 arrows to navigate, Enter to select, Esc to go back")));
|
|
1634
1753
|
}
|
|
1635
1754
|
|
|
1636
1755
|
// src/components/LoginFlow.tsx
|
|
1637
|
-
import
|
|
1638
|
-
import { Box as
|
|
1756
|
+
import React16, { useState as useState7, useEffect as useEffect2 } from "react";
|
|
1757
|
+
import { Box as Box15, Text as Text15 } from "ink";
|
|
1639
1758
|
import Spinner2 from "ink-spinner";
|
|
1640
1759
|
import jwt from "jsonwebtoken";
|
|
1641
1760
|
import open from "open";
|
|
@@ -1751,10 +1870,10 @@ var OAuthClient = class {
|
|
|
1751
1870
|
|
|
1752
1871
|
// src/components/LoginFlow.tsx
|
|
1753
1872
|
function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, onError }) {
|
|
1754
|
-
const [status, setStatus] =
|
|
1755
|
-
const [deviceFlow, setDeviceFlow] =
|
|
1756
|
-
const [statusMessage, setStatusMessage] =
|
|
1757
|
-
const [error, setError] =
|
|
1873
|
+
const [status, setStatus] = useState7("initiating");
|
|
1874
|
+
const [deviceFlow, setDeviceFlow] = useState7(null);
|
|
1875
|
+
const [statusMessage, setStatusMessage] = useState7("Initiating device authorization...");
|
|
1876
|
+
const [error, setError] = useState7(null);
|
|
1758
1877
|
useEffect2(() => {
|
|
1759
1878
|
const runLoginFlow = async () => {
|
|
1760
1879
|
const oauth = new OAuthClient(apiUrl);
|
|
@@ -1798,15 +1917,15 @@ function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, o
|
|
|
1798
1917
|
}
|
|
1799
1918
|
}, [deviceFlow, status]);
|
|
1800
1919
|
if (status === "initiating") {
|
|
1801
|
-
return /* @__PURE__ */
|
|
1920
|
+
return /* @__PURE__ */ React16.createElement(Box15, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React16.createElement(Box15, null, /* @__PURE__ */ React16.createElement(Text15, { color: "cyan" }, /* @__PURE__ */ React16.createElement(Spinner2, { type: "dots" }), " Initiating device authorization...")));
|
|
1802
1921
|
}
|
|
1803
1922
|
if (status === "error") {
|
|
1804
|
-
return /* @__PURE__ */
|
|
1923
|
+
return /* @__PURE__ */ React16.createElement(Box15, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React16.createElement(Box15, { marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text15, { color: "red", bold: true }, "\u2716 Authentication Failed")), /* @__PURE__ */ React16.createElement(Box15, null, /* @__PURE__ */ React16.createElement(Text15, { color: "red" }, error)));
|
|
1805
1924
|
}
|
|
1806
1925
|
if (status === "success") {
|
|
1807
|
-
return /* @__PURE__ */
|
|
1926
|
+
return /* @__PURE__ */ React16.createElement(Box15, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React16.createElement(Box15, { marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text15, { color: "green", bold: true }, "\u2714 Successfully authenticated!")), /* @__PURE__ */ React16.createElement(Box15, null, /* @__PURE__ */ React16.createElement(Text15, { dimColor: true }, "You can now use B4M CLI with your account.")));
|
|
1808
1927
|
}
|
|
1809
|
-
return /* @__PURE__ */
|
|
1928
|
+
return /* @__PURE__ */ React16.createElement(Box15, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "cyan" }, /* @__PURE__ */ React16.createElement(Box15, { marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text15, { color: "cyan", bold: true }, "\u{1F510} Device Authorization")), /* @__PURE__ */ React16.createElement(Box15, { marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text15, null, "Opening browser automatically... If it doesn't open, please visit:")), /* @__PURE__ */ React16.createElement(Box15, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React16.createElement(Text15, { color: "blue", bold: true }, deviceFlow?.verification_uri)), /* @__PURE__ */ React16.createElement(Box15, { marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text15, null, "And enter this code when prompted:")), /* @__PURE__ */ React16.createElement(Box15, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React16.createElement(Text15, { color: "yellow", bold: true }, deviceFlow?.user_code)), /* @__PURE__ */ React16.createElement(Box15, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text15, { color: "cyan" }, /* @__PURE__ */ React16.createElement(Spinner2, { type: "dots" }), " ", statusMessage)), /* @__PURE__ */ React16.createElement(Box15, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text15, { dimColor: true }, "Expires in ", deviceFlow ? Math.floor(deviceFlow.expires_in / 60) : 0, " minutes")));
|
|
1810
1929
|
}
|
|
1811
1930
|
|
|
1812
1931
|
// src/storage/SessionStore.ts
|
|
@@ -2644,6 +2763,261 @@ var CommandHistoryStore = class {
|
|
|
2644
2763
|
}
|
|
2645
2764
|
};
|
|
2646
2765
|
|
|
2766
|
+
// src/storage/CustomCommandStore.ts
|
|
2767
|
+
import fs6 from "fs/promises";
|
|
2768
|
+
import path6 from "path";
|
|
2769
|
+
import os from "os";
|
|
2770
|
+
|
|
2771
|
+
// src/utils/commandParser.ts
|
|
2772
|
+
import matter from "gray-matter";
|
|
2773
|
+
import { z as z2 } from "zod";
|
|
2774
|
+
var FrontmatterSchema = z2.object({
|
|
2775
|
+
description: z2.string().optional(),
|
|
2776
|
+
"argument-hint": z2.string().optional(),
|
|
2777
|
+
model: z2.string().optional(),
|
|
2778
|
+
// Future fields (ignored for now):
|
|
2779
|
+
"allowed-tools": z2.any().optional(),
|
|
2780
|
+
context: z2.any().optional(),
|
|
2781
|
+
agent: z2.any().optional(),
|
|
2782
|
+
"disable-model-invocation": z2.any().optional(),
|
|
2783
|
+
hooks: z2.any().optional()
|
|
2784
|
+
});
|
|
2785
|
+
function extractDescriptionFromBody(body) {
|
|
2786
|
+
const lines = body.trim().split("\n");
|
|
2787
|
+
for (const line of lines) {
|
|
2788
|
+
const trimmed = line.trim();
|
|
2789
|
+
if (trimmed && !trimmed.startsWith("#")) {
|
|
2790
|
+
return trimmed.length > 100 ? trimmed.substring(0, 97) + "..." : trimmed;
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
return "Custom command";
|
|
2794
|
+
}
|
|
2795
|
+
function parseCommandFile(fileContent, filePath, commandName, source) {
|
|
2796
|
+
try {
|
|
2797
|
+
const { data: frontmatter, content: body } = matter(fileContent);
|
|
2798
|
+
const validationResult = FrontmatterSchema.safeParse(frontmatter);
|
|
2799
|
+
if (!validationResult.success) {
|
|
2800
|
+
console.warn(
|
|
2801
|
+
`Warning: Invalid frontmatter in ${filePath}:`,
|
|
2802
|
+
validationResult.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join(", ")
|
|
2803
|
+
);
|
|
2804
|
+
}
|
|
2805
|
+
const validFrontmatter = validationResult.success ? validationResult.data : {};
|
|
2806
|
+
const description = validFrontmatter.description || extractDescriptionFromBody(body) || "Custom command";
|
|
2807
|
+
return {
|
|
2808
|
+
name: commandName,
|
|
2809
|
+
description,
|
|
2810
|
+
argumentHint: validFrontmatter["argument-hint"],
|
|
2811
|
+
model: validFrontmatter.model,
|
|
2812
|
+
body: body.trim(),
|
|
2813
|
+
source,
|
|
2814
|
+
filePath
|
|
2815
|
+
};
|
|
2816
|
+
} catch (error) {
|
|
2817
|
+
throw new Error(
|
|
2818
|
+
`Failed to parse command file ${filePath}: ${error instanceof Error ? error.message : String(error)}`
|
|
2819
|
+
);
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
function isValidCommandName(name) {
|
|
2823
|
+
if (!name || name.trim().length === 0) {
|
|
2824
|
+
return false;
|
|
2825
|
+
}
|
|
2826
|
+
const validPattern = /^[a-z0-9-_:]+$/i;
|
|
2827
|
+
return validPattern.test(name);
|
|
2828
|
+
}
|
|
2829
|
+
function extractCommandName(filename) {
|
|
2830
|
+
if (!filename.endsWith(".md")) {
|
|
2831
|
+
return null;
|
|
2832
|
+
}
|
|
2833
|
+
const name = filename.slice(0, -3);
|
|
2834
|
+
if (!isValidCommandName(name)) {
|
|
2835
|
+
return null;
|
|
2836
|
+
}
|
|
2837
|
+
return name;
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
// src/storage/CustomCommandStore.ts
|
|
2841
|
+
var CustomCommandStore = class {
|
|
2842
|
+
constructor(projectRoot) {
|
|
2843
|
+
this.commands = /* @__PURE__ */ new Map();
|
|
2844
|
+
this.globalCommandsDir = path6.join(os.homedir(), ".bike4mind", "commands");
|
|
2845
|
+
this.projectCommandsDir = path6.join(projectRoot || process.cwd(), ".bike4mind", "commands");
|
|
2846
|
+
}
|
|
2847
|
+
/**
|
|
2848
|
+
* Loads all custom commands from both global and project directories
|
|
2849
|
+
* Project commands override global commands with the same name
|
|
2850
|
+
*/
|
|
2851
|
+
async loadCommands() {
|
|
2852
|
+
this.commands.clear();
|
|
2853
|
+
await this.loadCommandsFromDirectory(this.globalCommandsDir, "global");
|
|
2854
|
+
await this.loadCommandsFromDirectory(this.projectCommandsDir, "project");
|
|
2855
|
+
}
|
|
2856
|
+
/**
|
|
2857
|
+
* Recursively scans a directory for .md files and loads them as commands
|
|
2858
|
+
*
|
|
2859
|
+
* @param directory - Directory to scan
|
|
2860
|
+
* @param source - Source identifier ('global' or 'project')
|
|
2861
|
+
*/
|
|
2862
|
+
async loadCommandsFromDirectory(directory, source) {
|
|
2863
|
+
try {
|
|
2864
|
+
const stats = await fs6.stat(directory);
|
|
2865
|
+
if (!stats.isDirectory()) {
|
|
2866
|
+
return;
|
|
2867
|
+
}
|
|
2868
|
+
const commandFiles = await this.findCommandFiles(directory);
|
|
2869
|
+
for (const filePath of commandFiles) {
|
|
2870
|
+
try {
|
|
2871
|
+
await this.loadCommandFile(filePath, source);
|
|
2872
|
+
} catch (error) {
|
|
2873
|
+
console.warn(
|
|
2874
|
+
`Failed to load command from ${filePath}:`,
|
|
2875
|
+
error instanceof Error ? error.message : String(error)
|
|
2876
|
+
);
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
} catch (error) {
|
|
2880
|
+
if (error.code !== "ENOENT") {
|
|
2881
|
+
console.warn(
|
|
2882
|
+
`Error accessing ${source} commands directory ${directory}:`,
|
|
2883
|
+
error instanceof Error ? error.message : String(error)
|
|
2884
|
+
);
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
/**
|
|
2889
|
+
* Recursively finds all .md files in a directory
|
|
2890
|
+
*
|
|
2891
|
+
* @param directory - Directory to search
|
|
2892
|
+
* @returns Array of full file paths to .md files
|
|
2893
|
+
*/
|
|
2894
|
+
async findCommandFiles(directory) {
|
|
2895
|
+
const files = [];
|
|
2896
|
+
try {
|
|
2897
|
+
const entries = await fs6.readdir(directory, { withFileTypes: true });
|
|
2898
|
+
for (const entry of entries) {
|
|
2899
|
+
const fullPath = path6.join(directory, entry.name);
|
|
2900
|
+
if (entry.isDirectory()) {
|
|
2901
|
+
const subFiles = await this.findCommandFiles(fullPath);
|
|
2902
|
+
files.push(...subFiles);
|
|
2903
|
+
} else if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
2904
|
+
files.push(fullPath);
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
} catch (error) {
|
|
2908
|
+
console.warn(`Error reading directory ${directory}:`, error instanceof Error ? error.message : String(error));
|
|
2909
|
+
}
|
|
2910
|
+
return files;
|
|
2911
|
+
}
|
|
2912
|
+
/**
|
|
2913
|
+
* Loads a single command file
|
|
2914
|
+
*
|
|
2915
|
+
* @param filePath - Full path to the command file
|
|
2916
|
+
* @param source - Source identifier ('global' or 'project')
|
|
2917
|
+
*/
|
|
2918
|
+
async loadCommandFile(filePath, source) {
|
|
2919
|
+
const filename = path6.basename(filePath);
|
|
2920
|
+
const commandName = extractCommandName(filename);
|
|
2921
|
+
if (!commandName) {
|
|
2922
|
+
console.warn(`Invalid command filename: ${filename} (must end with .md and have valid name)`);
|
|
2923
|
+
return;
|
|
2924
|
+
}
|
|
2925
|
+
const fileContent = await fs6.readFile(filePath, "utf-8");
|
|
2926
|
+
const command = parseCommandFile(fileContent, filePath, commandName, source);
|
|
2927
|
+
const existing = this.commands.get(commandName);
|
|
2928
|
+
if (existing && existing.source === "project" && source === "global") {
|
|
2929
|
+
return;
|
|
2930
|
+
}
|
|
2931
|
+
this.commands.set(commandName, command);
|
|
2932
|
+
}
|
|
2933
|
+
/**
|
|
2934
|
+
* Gets a command by name
|
|
2935
|
+
*
|
|
2936
|
+
* @param name - Command name
|
|
2937
|
+
* @returns CustomCommand if found, undefined otherwise
|
|
2938
|
+
*/
|
|
2939
|
+
getCommand(name) {
|
|
2940
|
+
return this.commands.get(name);
|
|
2941
|
+
}
|
|
2942
|
+
/**
|
|
2943
|
+
* Gets all loaded commands
|
|
2944
|
+
*
|
|
2945
|
+
* @returns Array of all custom commands
|
|
2946
|
+
*/
|
|
2947
|
+
getAllCommands() {
|
|
2948
|
+
return Array.from(this.commands.values());
|
|
2949
|
+
}
|
|
2950
|
+
/**
|
|
2951
|
+
* Gets commands filtered by source
|
|
2952
|
+
*
|
|
2953
|
+
* @param source - Filter by 'global' or 'project'
|
|
2954
|
+
* @returns Array of commands from the specified source
|
|
2955
|
+
*/
|
|
2956
|
+
getCommandsBySource(source) {
|
|
2957
|
+
return this.getAllCommands().filter((cmd) => cmd.source === source);
|
|
2958
|
+
}
|
|
2959
|
+
/**
|
|
2960
|
+
* Checks if a command name exists
|
|
2961
|
+
*
|
|
2962
|
+
* @param name - Command name to check
|
|
2963
|
+
* @returns true if command exists
|
|
2964
|
+
*/
|
|
2965
|
+
hasCommand(name) {
|
|
2966
|
+
return this.commands.has(name);
|
|
2967
|
+
}
|
|
2968
|
+
/**
|
|
2969
|
+
* Gets the number of loaded commands
|
|
2970
|
+
*
|
|
2971
|
+
* @returns Number of custom commands
|
|
2972
|
+
*/
|
|
2973
|
+
getCommandCount() {
|
|
2974
|
+
return this.commands.size;
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Reloads all commands from directories
|
|
2978
|
+
* Useful for the /commands:reload command
|
|
2979
|
+
*/
|
|
2980
|
+
async reloadCommands() {
|
|
2981
|
+
await this.loadCommands();
|
|
2982
|
+
}
|
|
2983
|
+
/**
|
|
2984
|
+
* Creates a new command file from a template
|
|
2985
|
+
*
|
|
2986
|
+
* @param name - Command name
|
|
2987
|
+
* @param isGlobal - If true, creates in global directory, otherwise project directory
|
|
2988
|
+
* @returns Path to the created file
|
|
2989
|
+
*/
|
|
2990
|
+
async createCommandFile(name, isGlobal = false) {
|
|
2991
|
+
const targetDir = isGlobal ? this.globalCommandsDir : this.projectCommandsDir;
|
|
2992
|
+
const filePath = path6.join(targetDir, `${name}.md`);
|
|
2993
|
+
try {
|
|
2994
|
+
await fs6.access(filePath);
|
|
2995
|
+
throw new Error(`Command file already exists: ${filePath}`);
|
|
2996
|
+
} catch (error) {
|
|
2997
|
+
if (error.code !== "ENOENT") {
|
|
2998
|
+
throw error;
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
await fs6.mkdir(targetDir, { recursive: true });
|
|
3002
|
+
const template = `---
|
|
3003
|
+
description: ${name} command
|
|
3004
|
+
argument-hint: [args]
|
|
3005
|
+
---
|
|
3006
|
+
|
|
3007
|
+
# ${name}
|
|
3008
|
+
|
|
3009
|
+
Replace this with your command template.
|
|
3010
|
+
|
|
3011
|
+
You can use:
|
|
3012
|
+
- $ARGUMENTS for all arguments
|
|
3013
|
+
- $1, $2, etc. for positional arguments
|
|
3014
|
+
- @filename for file references
|
|
3015
|
+
`;
|
|
3016
|
+
await fs6.writeFile(filePath, template, "utf-8");
|
|
3017
|
+
return filePath;
|
|
3018
|
+
}
|
|
3019
|
+
};
|
|
3020
|
+
|
|
2647
3021
|
// ../../b4m-core/packages/agents/src/ReActAgent.ts
|
|
2648
3022
|
import { EventEmitter } from "events";
|
|
2649
3023
|
var ReActAgent = class extends EventEmitter {
|
|
@@ -2957,38 +3331,38 @@ Remember: You are an autonomous AGENT. Act independently and solve problems proa
|
|
|
2957
3331
|
// ../../b4m-core/packages/services/dist/src/referService/generateCodes.js
|
|
2958
3332
|
import { randomBytes } from "crypto";
|
|
2959
3333
|
import range from "lodash/range.js";
|
|
2960
|
-
import { z as
|
|
2961
|
-
var generateReferralCodesSchema =
|
|
2962
|
-
count:
|
|
2963
|
-
unlimitedUse:
|
|
2964
|
-
expiresAt:
|
|
3334
|
+
import { z as z3 } from "zod";
|
|
3335
|
+
var generateReferralCodesSchema = z3.object({
|
|
3336
|
+
count: z3.number().optional(),
|
|
3337
|
+
unlimitedUse: z3.boolean().optional(),
|
|
3338
|
+
expiresAt: z3.date().optional()
|
|
2965
3339
|
});
|
|
2966
3340
|
|
|
2967
3341
|
// ../../b4m-core/packages/services/dist/src/referService/delete.js
|
|
2968
|
-
import { z as
|
|
2969
|
-
var deleteInviteCodesSchema =
|
|
2970
|
-
ids:
|
|
3342
|
+
import { z as z4 } from "zod";
|
|
3343
|
+
var deleteInviteCodesSchema = z4.object({
|
|
3344
|
+
ids: z4.array(z4.string())
|
|
2971
3345
|
});
|
|
2972
3346
|
|
|
2973
3347
|
// ../../b4m-core/packages/services/dist/src/userService/login.js
|
|
2974
|
-
import { z as
|
|
3348
|
+
import { z as z5 } from "zod";
|
|
2975
3349
|
import bcrypt from "bcryptjs";
|
|
2976
|
-
var loginUserSchema =
|
|
2977
|
-
usernameOrEmail:
|
|
2978
|
-
password:
|
|
2979
|
-
metadata:
|
|
2980
|
-
loginTime:
|
|
2981
|
-
userAgent:
|
|
2982
|
-
browser:
|
|
2983
|
-
operatingSystem:
|
|
2984
|
-
deviceType:
|
|
2985
|
-
screenResolution:
|
|
2986
|
-
viewportSize:
|
|
2987
|
-
colorDepth:
|
|
2988
|
-
pixelDepth:
|
|
2989
|
-
devicePixelRatio:
|
|
2990
|
-
ip:
|
|
2991
|
-
location:
|
|
3350
|
+
var loginUserSchema = z5.object({
|
|
3351
|
+
usernameOrEmail: z5.string(),
|
|
3352
|
+
password: z5.string(),
|
|
3353
|
+
metadata: z5.object({
|
|
3354
|
+
loginTime: z5.date(),
|
|
3355
|
+
userAgent: z5.string(),
|
|
3356
|
+
browser: z5.string(),
|
|
3357
|
+
operatingSystem: z5.string(),
|
|
3358
|
+
deviceType: z5.string(),
|
|
3359
|
+
screenResolution: z5.string(),
|
|
3360
|
+
viewportSize: z5.string(),
|
|
3361
|
+
colorDepth: z5.number(),
|
|
3362
|
+
pixelDepth: z5.number(),
|
|
3363
|
+
devicePixelRatio: z5.number(),
|
|
3364
|
+
ip: z5.string().optional().default(""),
|
|
3365
|
+
location: z5.string().optional()
|
|
2992
3366
|
}).optional()
|
|
2993
3367
|
});
|
|
2994
3368
|
|
|
@@ -2998,78 +3372,78 @@ import escapeRegExp from "lodash/escapeRegExp.js";
|
|
|
2998
3372
|
|
|
2999
3373
|
// ../../b4m-core/packages/services/dist/src/userService/forgotPassword.js
|
|
3000
3374
|
import { randomUUID } from "crypto";
|
|
3001
|
-
import { z as
|
|
3002
|
-
var forgotPasswordUserSchema =
|
|
3003
|
-
email:
|
|
3375
|
+
import { z as z6 } from "zod";
|
|
3376
|
+
var forgotPasswordUserSchema = z6.object({
|
|
3377
|
+
email: z6.string().email()
|
|
3004
3378
|
});
|
|
3005
3379
|
|
|
3006
3380
|
// ../../b4m-core/packages/services/dist/src/userService/update.js
|
|
3007
3381
|
import bcrypt3 from "bcryptjs";
|
|
3008
|
-
import { z as
|
|
3009
|
-
var updateUserSchema =
|
|
3010
|
-
name:
|
|
3011
|
-
username:
|
|
3382
|
+
import { z as z7 } from "zod";
|
|
3383
|
+
var updateUserSchema = z7.object({
|
|
3384
|
+
name: z7.string().optional(),
|
|
3385
|
+
username: z7.string().optional(),
|
|
3012
3386
|
// email field removed - users must use the secure email change verification flow
|
|
3013
3387
|
// See requestEmailChange and verifyEmailChange in userService
|
|
3014
|
-
password:
|
|
3015
|
-
team:
|
|
3016
|
-
role:
|
|
3017
|
-
phone:
|
|
3018
|
-
preferredLanguage:
|
|
3019
|
-
preferredContact:
|
|
3020
|
-
preferredVoice:
|
|
3021
|
-
tshirtSize:
|
|
3022
|
-
geoLocation:
|
|
3023
|
-
lastNotebookId:
|
|
3024
|
-
tags:
|
|
3025
|
-
lastCreditsPurchasedAt:
|
|
3026
|
-
systemFiles:
|
|
3027
|
-
fileId:
|
|
3028
|
-
enabled:
|
|
3388
|
+
password: z7.string().nullable().optional(),
|
|
3389
|
+
team: z7.string().nullable().optional(),
|
|
3390
|
+
role: z7.string().nullable().optional(),
|
|
3391
|
+
phone: z7.string().nullable().optional(),
|
|
3392
|
+
preferredLanguage: z7.string().nullable().optional(),
|
|
3393
|
+
preferredContact: z7.string().nullable().optional(),
|
|
3394
|
+
preferredVoice: z7.string().nullable().optional(),
|
|
3395
|
+
tshirtSize: z7.string().nullable().optional(),
|
|
3396
|
+
geoLocation: z7.string().nullable().optional(),
|
|
3397
|
+
lastNotebookId: z7.string().nullable().optional(),
|
|
3398
|
+
tags: z7.array(z7.string()).nullable().optional(),
|
|
3399
|
+
lastCreditsPurchasedAt: z7.date().nullable().optional(),
|
|
3400
|
+
systemFiles: z7.array(z7.object({
|
|
3401
|
+
fileId: z7.string(),
|
|
3402
|
+
enabled: z7.boolean()
|
|
3029
3403
|
})).nullable().optional(),
|
|
3030
|
-
securityQuestions:
|
|
3031
|
-
photoUrl:
|
|
3032
|
-
showCreditsUsed:
|
|
3404
|
+
securityQuestions: z7.array(z7.object({ question: z7.string(), answer: z7.string() })).nullable().optional(),
|
|
3405
|
+
photoUrl: z7.string().nullable().optional(),
|
|
3406
|
+
showCreditsUsed: z7.boolean().optional()
|
|
3033
3407
|
});
|
|
3034
3408
|
|
|
3035
3409
|
// ../../b4m-core/packages/services/dist/src/userService/adminUpdate.js
|
|
3036
|
-
import { z as
|
|
3410
|
+
import { z as z9 } from "zod";
|
|
3037
3411
|
|
|
3038
3412
|
// ../../b4m-core/packages/services/dist/src/friendshipService/sendFriendRequest.js
|
|
3039
|
-
import { z as
|
|
3040
|
-
var sendFriendRequestSchema =
|
|
3041
|
-
requesterId:
|
|
3042
|
-
recipientId:
|
|
3043
|
-
message:
|
|
3413
|
+
import { z as z8 } from "zod";
|
|
3414
|
+
var sendFriendRequestSchema = z8.object({
|
|
3415
|
+
requesterId: z8.string(),
|
|
3416
|
+
recipientId: z8.string(),
|
|
3417
|
+
message: z8.string().optional()
|
|
3044
3418
|
});
|
|
3045
3419
|
|
|
3046
3420
|
// ../../b4m-core/packages/services/dist/src/userService/adminUpdate.js
|
|
3047
3421
|
var adminUpdateUserSchema = updateUserSchema.extend({
|
|
3048
|
-
id:
|
|
3422
|
+
id: z9.string(),
|
|
3049
3423
|
// Admins can directly update email addresses without verification
|
|
3050
|
-
email:
|
|
3051
|
-
role:
|
|
3052
|
-
isAdmin:
|
|
3053
|
-
organizationId:
|
|
3054
|
-
storageLimit:
|
|
3055
|
-
currentCredits:
|
|
3056
|
-
isBanned:
|
|
3057
|
-
isModerated:
|
|
3058
|
-
subscribedUntil:
|
|
3059
|
-
systemFiles:
|
|
3060
|
-
level:
|
|
3061
|
-
lastNotebookId:
|
|
3062
|
-
userNotes:
|
|
3063
|
-
numReferralsAvailable:
|
|
3424
|
+
email: z9.string().email().optional(),
|
|
3425
|
+
role: z9.string().optional().nullable(),
|
|
3426
|
+
isAdmin: z9.boolean().optional(),
|
|
3427
|
+
organizationId: z9.string().optional().nullable(),
|
|
3428
|
+
storageLimit: z9.number().optional(),
|
|
3429
|
+
currentCredits: z9.number().optional(),
|
|
3430
|
+
isBanned: z9.boolean().optional(),
|
|
3431
|
+
isModerated: z9.boolean().optional(),
|
|
3432
|
+
subscribedUntil: z9.string().optional().nullable(),
|
|
3433
|
+
systemFiles: z9.array(z9.object({ fileId: z9.string(), enabled: z9.boolean() })).optional(),
|
|
3434
|
+
level: z9.enum(["DemoUser", "PaidUser", "VIPUser", "ManagerUser", "AdminUser"]).optional(),
|
|
3435
|
+
lastNotebookId: z9.string().optional().nullable(),
|
|
3436
|
+
userNotes: z9.array(z9.object({ timestamp: z9.string(), note: z9.string(), userName: z9.string() })).optional(),
|
|
3437
|
+
numReferralsAvailable: z9.number().optional()
|
|
3064
3438
|
});
|
|
3065
3439
|
|
|
3066
3440
|
// ../../b4m-core/packages/services/dist/src/userService/register.js
|
|
3067
|
-
import { z as
|
|
3441
|
+
import { z as z11 } from "zod";
|
|
3068
3442
|
import bcrypt4 from "bcryptjs";
|
|
3069
3443
|
|
|
3070
3444
|
// ../../b4m-core/packages/services/dist/src/creditService/addCredits.js
|
|
3071
|
-
import { z as
|
|
3072
|
-
var AddCreditsSchema =
|
|
3445
|
+
import { z as z10 } from "zod";
|
|
3446
|
+
var AddCreditsSchema = z10.discriminatedUnion("type", [
|
|
3073
3447
|
PurchaseTransaction.omit({ createdAt: true, updatedAt: true }),
|
|
3074
3448
|
SubscriptionCreditTransaction.omit({ createdAt: true, updatedAt: true }),
|
|
3075
3449
|
GenericCreditAddTransaction.omit({ createdAt: true, updatedAt: true }),
|
|
@@ -3077,57 +3451,57 @@ var AddCreditsSchema = z9.discriminatedUnion("type", [
|
|
|
3077
3451
|
]);
|
|
3078
3452
|
|
|
3079
3453
|
// ../../b4m-core/packages/services/dist/src/userService/register.js
|
|
3080
|
-
var registerUserSchema =
|
|
3081
|
-
username:
|
|
3082
|
-
email:
|
|
3083
|
-
name:
|
|
3084
|
-
inviteCode:
|
|
3085
|
-
password:
|
|
3086
|
-
metadata:
|
|
3087
|
-
loginTime:
|
|
3088
|
-
userAgent:
|
|
3089
|
-
browser:
|
|
3090
|
-
operatingSystem:
|
|
3091
|
-
deviceType:
|
|
3092
|
-
screenResolution:
|
|
3093
|
-
viewportSize:
|
|
3094
|
-
colorDepth:
|
|
3095
|
-
pixelDepth:
|
|
3096
|
-
devicePixelRatio:
|
|
3097
|
-
ip:
|
|
3098
|
-
location:
|
|
3454
|
+
var registerUserSchema = z11.object({
|
|
3455
|
+
username: z11.string(),
|
|
3456
|
+
email: z11.string(),
|
|
3457
|
+
name: z11.string(),
|
|
3458
|
+
inviteCode: z11.string(),
|
|
3459
|
+
password: z11.string(),
|
|
3460
|
+
metadata: z11.object({
|
|
3461
|
+
loginTime: z11.date(),
|
|
3462
|
+
userAgent: z11.string(),
|
|
3463
|
+
browser: z11.string(),
|
|
3464
|
+
operatingSystem: z11.string(),
|
|
3465
|
+
deviceType: z11.string(),
|
|
3466
|
+
screenResolution: z11.string(),
|
|
3467
|
+
viewportSize: z11.string(),
|
|
3468
|
+
colorDepth: z11.number(),
|
|
3469
|
+
pixelDepth: z11.number(),
|
|
3470
|
+
devicePixelRatio: z11.number(),
|
|
3471
|
+
ip: z11.string().optional().default(""),
|
|
3472
|
+
location: z11.string().optional()
|
|
3099
3473
|
}).optional()
|
|
3100
3474
|
});
|
|
3101
3475
|
|
|
3102
3476
|
// ../../b4m-core/packages/services/dist/src/userService/adminDelete.js
|
|
3103
|
-
import { z as
|
|
3104
|
-
var adminDeleteUserSchema =
|
|
3105
|
-
id:
|
|
3477
|
+
import { z as z12 } from "zod";
|
|
3478
|
+
var adminDeleteUserSchema = z12.object({
|
|
3479
|
+
id: z12.string()
|
|
3106
3480
|
});
|
|
3107
3481
|
|
|
3108
3482
|
// ../../b4m-core/packages/services/dist/src/userService/searchUserCollection.js
|
|
3109
|
-
import { z as
|
|
3110
|
-
var searchUserCollectionSchema =
|
|
3111
|
-
userId:
|
|
3112
|
-
page:
|
|
3113
|
-
limit:
|
|
3114
|
-
search:
|
|
3115
|
-
type:
|
|
3483
|
+
import { z as z13 } from "zod";
|
|
3484
|
+
var searchUserCollectionSchema = z13.object({
|
|
3485
|
+
userId: z13.string(),
|
|
3486
|
+
page: z13.coerce.number().optional().default(1),
|
|
3487
|
+
limit: z13.coerce.number().optional().default(10),
|
|
3488
|
+
search: z13.string().optional().default(""),
|
|
3489
|
+
type: z13.nativeEnum(CollectionType).optional()
|
|
3116
3490
|
});
|
|
3117
3491
|
|
|
3118
3492
|
// ../../b4m-core/packages/services/dist/src/userService/recalculateUserStorage.js
|
|
3119
|
-
import { z as
|
|
3120
|
-
var recalculateUserStorageSchema =
|
|
3493
|
+
import { z as z14 } from "zod";
|
|
3494
|
+
var recalculateUserStorageSchema = z14.object({
|
|
3121
3495
|
/**
|
|
3122
3496
|
* The user to recalculate the storage for
|
|
3123
3497
|
*/
|
|
3124
|
-
userId:
|
|
3498
|
+
userId: z14.string()
|
|
3125
3499
|
});
|
|
3126
3500
|
|
|
3127
3501
|
// ../../b4m-core/packages/services/dist/src/userService/listRecentActivities.js
|
|
3128
|
-
import { z as
|
|
3129
|
-
var listRecentActivitiesSchema =
|
|
3130
|
-
coverage:
|
|
3502
|
+
import { z as z15 } from "zod";
|
|
3503
|
+
var listRecentActivitiesSchema = z15.object({
|
|
3504
|
+
coverage: z15.enum(["all", "important"]).default("important")
|
|
3131
3505
|
});
|
|
3132
3506
|
var IMPORTANT_COUNTER_NAMES = [
|
|
3133
3507
|
SessionEvents.CREATE_SESSION,
|
|
@@ -3141,82 +3515,82 @@ var IMPORTANT_COUNTER_NAMES = [
|
|
|
3141
3515
|
|
|
3142
3516
|
// ../../b4m-core/packages/services/dist/src/userService/sendEmailVerification.js
|
|
3143
3517
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
3144
|
-
import { z as
|
|
3145
|
-
var sendEmailVerificationSchema =
|
|
3146
|
-
userId:
|
|
3518
|
+
import { z as z16 } from "zod";
|
|
3519
|
+
var sendEmailVerificationSchema = z16.object({
|
|
3520
|
+
userId: z16.string()
|
|
3147
3521
|
});
|
|
3148
3522
|
|
|
3149
3523
|
// ../../b4m-core/packages/services/dist/src/userService/verifyEmailToken.js
|
|
3150
|
-
import { z as
|
|
3524
|
+
import { z as z17 } from "zod";
|
|
3151
3525
|
|
|
3152
3526
|
// ../../b4m-core/packages/services/dist/src/utils/crypto.js
|
|
3153
3527
|
import crypto from "crypto";
|
|
3154
3528
|
|
|
3155
3529
|
// ../../b4m-core/packages/services/dist/src/userService/verifyEmailToken.js
|
|
3156
|
-
var verifyEmailTokenSchema =
|
|
3157
|
-
token:
|
|
3530
|
+
var verifyEmailTokenSchema = z17.object({
|
|
3531
|
+
token: z17.string()
|
|
3158
3532
|
});
|
|
3159
3533
|
|
|
3160
3534
|
// ../../b4m-core/packages/services/dist/src/userService/resendEmailVerification.js
|
|
3161
3535
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
3162
|
-
import { z as
|
|
3163
|
-
var resendEmailVerificationSchema =
|
|
3164
|
-
userId:
|
|
3536
|
+
import { z as z18 } from "zod";
|
|
3537
|
+
var resendEmailVerificationSchema = z18.object({
|
|
3538
|
+
userId: z18.string()
|
|
3165
3539
|
});
|
|
3166
3540
|
|
|
3167
3541
|
// ../../b4m-core/packages/services/dist/src/userService/requestEmailChange.js
|
|
3168
3542
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
3169
|
-
import { z as
|
|
3170
|
-
var requestEmailChangeSchema =
|
|
3171
|
-
userId:
|
|
3172
|
-
newEmail:
|
|
3173
|
-
password:
|
|
3543
|
+
import { z as z19 } from "zod";
|
|
3544
|
+
var requestEmailChangeSchema = z19.object({
|
|
3545
|
+
userId: z19.string(),
|
|
3546
|
+
newEmail: z19.string().email(),
|
|
3547
|
+
password: z19.string()
|
|
3174
3548
|
});
|
|
3175
3549
|
|
|
3176
3550
|
// ../../b4m-core/packages/services/dist/src/userService/verifyEmailChange.js
|
|
3177
|
-
import { z as
|
|
3178
|
-
var verifyEmailChangeSchema =
|
|
3179
|
-
token:
|
|
3551
|
+
import { z as z20 } from "zod";
|
|
3552
|
+
var verifyEmailChangeSchema = z20.object({
|
|
3553
|
+
token: z20.string()
|
|
3180
3554
|
});
|
|
3181
3555
|
|
|
3182
3556
|
// ../../b4m-core/packages/services/dist/src/userService/cancelEmailChange.js
|
|
3183
|
-
import { z as
|
|
3184
|
-
var cancelEmailChangeSchema =
|
|
3185
|
-
userId:
|
|
3557
|
+
import { z as z21 } from "zod";
|
|
3558
|
+
var cancelEmailChangeSchema = z21.object({
|
|
3559
|
+
userId: z21.string()
|
|
3186
3560
|
});
|
|
3187
3561
|
|
|
3188
3562
|
// ../../b4m-core/packages/services/dist/src/userApiKeyService/create.js
|
|
3189
3563
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
3190
3564
|
import bcrypt5 from "bcryptjs";
|
|
3191
|
-
import { z as
|
|
3192
|
-
var createUserApiKeySchema =
|
|
3193
|
-
name:
|
|
3194
|
-
scopes:
|
|
3195
|
-
expiresAt:
|
|
3196
|
-
rateLimit:
|
|
3197
|
-
requestsPerMinute:
|
|
3198
|
-
requestsPerDay:
|
|
3565
|
+
import { z as z22 } from "zod";
|
|
3566
|
+
var createUserApiKeySchema = z22.object({
|
|
3567
|
+
name: z22.string().min(1).max(100),
|
|
3568
|
+
scopes: z22.array(z22.nativeEnum(ApiKeyScope)).min(1),
|
|
3569
|
+
expiresAt: z22.date().optional(),
|
|
3570
|
+
rateLimit: z22.object({
|
|
3571
|
+
requestsPerMinute: z22.number().min(1).max(1e3).default(60),
|
|
3572
|
+
requestsPerDay: z22.number().min(1).max(1e4).default(1e3)
|
|
3199
3573
|
}).optional(),
|
|
3200
|
-
metadata:
|
|
3201
|
-
clientIP:
|
|
3202
|
-
userAgent:
|
|
3203
|
-
createdFrom:
|
|
3574
|
+
metadata: z22.object({
|
|
3575
|
+
clientIP: z22.string().optional(),
|
|
3576
|
+
userAgent: z22.string().optional(),
|
|
3577
|
+
createdFrom: z22.enum(["dashboard", "cli", "api"])
|
|
3204
3578
|
})
|
|
3205
3579
|
});
|
|
3206
3580
|
|
|
3207
3581
|
// ../../b4m-core/packages/services/dist/src/userApiKeyService/revoke.js
|
|
3208
|
-
import { z as
|
|
3209
|
-
var revokeUserApiKeySchema =
|
|
3210
|
-
keyId:
|
|
3211
|
-
reason:
|
|
3582
|
+
import { z as z23 } from "zod";
|
|
3583
|
+
var revokeUserApiKeySchema = z23.object({
|
|
3584
|
+
keyId: z23.string(),
|
|
3585
|
+
reason: z23.string().optional()
|
|
3212
3586
|
});
|
|
3213
3587
|
|
|
3214
3588
|
// ../../b4m-core/packages/services/dist/src/userApiKeyService/rotate.js
|
|
3215
3589
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
3216
3590
|
import bcrypt6 from "bcryptjs";
|
|
3217
|
-
import { z as
|
|
3218
|
-
var rotateUserApiKeySchema =
|
|
3219
|
-
keyId:
|
|
3591
|
+
import { z as z24 } from "zod";
|
|
3592
|
+
var rotateUserApiKeySchema = z24.object({
|
|
3593
|
+
keyId: z24.string()
|
|
3220
3594
|
});
|
|
3221
3595
|
|
|
3222
3596
|
// ../../b4m-core/packages/services/dist/src/userApiKeyService/validate.js
|
|
@@ -3363,29 +3737,29 @@ var EVENT_GROUPS = [
|
|
|
3363
3737
|
];
|
|
3364
3738
|
|
|
3365
3739
|
// ../../b4m-core/packages/services/dist/src/countersService/generateReport.js
|
|
3366
|
-
import { z as
|
|
3740
|
+
import { z as z26 } from "zod";
|
|
3367
3741
|
|
|
3368
3742
|
// ../../b4m-core/packages/services/dist/src/countersService/getAllCounterFrom24Hours.js
|
|
3369
|
-
import { z as
|
|
3743
|
+
import { z as z25 } from "zod";
|
|
3370
3744
|
import dayjs2 from "dayjs";
|
|
3371
|
-
var getCounterTotalsForLast24HoursSchema =
|
|
3372
|
-
date:
|
|
3373
|
-
endDate:
|
|
3745
|
+
var getCounterTotalsForLast24HoursSchema = z25.object({
|
|
3746
|
+
date: z25.string(),
|
|
3747
|
+
endDate: z25.string().optional()
|
|
3374
3748
|
});
|
|
3375
3749
|
|
|
3376
3750
|
// ../../b4m-core/packages/services/dist/src/countersService/generateReport.js
|
|
3377
|
-
var generateDailyReportSchema =
|
|
3378
|
-
date:
|
|
3379
|
-
startDate:
|
|
3380
|
-
endDate:
|
|
3751
|
+
var generateDailyReportSchema = z26.object({
|
|
3752
|
+
date: z26.string(),
|
|
3753
|
+
startDate: z26.string().optional(),
|
|
3754
|
+
endDate: z26.string().optional()
|
|
3381
3755
|
});
|
|
3382
3756
|
|
|
3383
3757
|
// ../../b4m-core/packages/services/dist/src/countersService/incrementUserCounter.js
|
|
3384
|
-
import { z as
|
|
3385
|
-
var incrementUserCounterSchema =
|
|
3386
|
-
action:
|
|
3387
|
-
increment:
|
|
3388
|
-
metadata:
|
|
3758
|
+
import { z as z27 } from "zod";
|
|
3759
|
+
var incrementUserCounterSchema = z27.object({
|
|
3760
|
+
action: z27.string(),
|
|
3761
|
+
increment: z27.coerce.number().default(1).optional(),
|
|
3762
|
+
metadata: z27.record(z27.unknown()).optional()
|
|
3389
3763
|
});
|
|
3390
3764
|
|
|
3391
3765
|
// ../../b4m-core/packages/services/dist/src/countersService/sendSlackReport.js
|
|
@@ -3401,47 +3775,47 @@ import { GoogleGenerativeAI } from "@google/generative-ai";
|
|
|
3401
3775
|
import OpenAI2 from "openai";
|
|
3402
3776
|
|
|
3403
3777
|
// ../../b4m-core/packages/services/dist/src/importHistoryService/index.js
|
|
3404
|
-
import
|
|
3778
|
+
import fs7, { unlinkSync } from "fs";
|
|
3405
3779
|
import yauzl from "yauzl";
|
|
3406
3780
|
import axios3 from "axios";
|
|
3407
3781
|
|
|
3408
3782
|
// ../../b4m-core/packages/services/dist/src/importHistoryService/importOpenaiHistory.js
|
|
3409
|
-
import { z as
|
|
3783
|
+
import { z as z28 } from "zod";
|
|
3410
3784
|
import last from "lodash/last.js";
|
|
3411
|
-
var epochDate = () =>
|
|
3412
|
-
var openaiConversationSchema =
|
|
3413
|
-
id:
|
|
3414
|
-
title:
|
|
3785
|
+
var epochDate = () => z28.preprocess((val) => new Date(Number(val) * 1e3), z28.date());
|
|
3786
|
+
var openaiConversationSchema = z28.object({
|
|
3787
|
+
id: z28.string(),
|
|
3788
|
+
title: z28.string(),
|
|
3415
3789
|
create_time: epochDate(),
|
|
3416
3790
|
update_time: epochDate().nullable(),
|
|
3417
|
-
mapping:
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
id:
|
|
3421
|
-
parent:
|
|
3422
|
-
children:
|
|
3423
|
-
message:
|
|
3424
|
-
id:
|
|
3791
|
+
mapping: z28.record(
|
|
3792
|
+
z28.string(),
|
|
3793
|
+
z28.object({
|
|
3794
|
+
id: z28.string(),
|
|
3795
|
+
parent: z28.string().nullable(),
|
|
3796
|
+
children: z28.array(z28.string()),
|
|
3797
|
+
message: z28.object({
|
|
3798
|
+
id: z28.string(),
|
|
3425
3799
|
create_time: epochDate(),
|
|
3426
3800
|
update_time: epochDate().nullable(),
|
|
3427
|
-
author:
|
|
3428
|
-
role:
|
|
3429
|
-
name:
|
|
3430
|
-
metadata:
|
|
3801
|
+
author: z28.object({
|
|
3802
|
+
role: z28.string(),
|
|
3803
|
+
name: z28.string().nullable(),
|
|
3804
|
+
metadata: z28.any()
|
|
3431
3805
|
// Accept any metadata structure
|
|
3432
3806
|
}).passthrough(),
|
|
3433
3807
|
// Allow extra fields in author
|
|
3434
|
-
content:
|
|
3435
|
-
content_type:
|
|
3436
|
-
parts:
|
|
3808
|
+
content: z28.object({
|
|
3809
|
+
content_type: z28.string(),
|
|
3810
|
+
parts: z28.array(z28.any()).optional()
|
|
3437
3811
|
// Accept any type in parts array (strings, objects, etc.)
|
|
3438
3812
|
}).passthrough(),
|
|
3439
3813
|
// Allow extra fields in content
|
|
3440
|
-
status:
|
|
3441
|
-
end_turn:
|
|
3442
|
-
metadata:
|
|
3814
|
+
status: z28.string(),
|
|
3815
|
+
end_turn: z28.boolean().nullable(),
|
|
3816
|
+
metadata: z28.any(),
|
|
3443
3817
|
// Accept any metadata structure since it varies widely
|
|
3444
|
-
recipient:
|
|
3818
|
+
recipient: z28.string()
|
|
3445
3819
|
}).passthrough().nullable()
|
|
3446
3820
|
}).passthrough()
|
|
3447
3821
|
// Allow extra fields in mapping node
|
|
@@ -3449,38 +3823,38 @@ var openaiConversationSchema = z27.object({
|
|
|
3449
3823
|
}).passthrough();
|
|
3450
3824
|
|
|
3451
3825
|
// ../../b4m-core/packages/services/dist/src/importHistoryService/importClaudeHistory.js
|
|
3452
|
-
import { z as
|
|
3453
|
-
var claudeChatMessageSchema =
|
|
3454
|
-
uuid:
|
|
3455
|
-
text:
|
|
3456
|
-
content:
|
|
3457
|
-
|
|
3458
|
-
type:
|
|
3826
|
+
import { z as z29 } from "zod";
|
|
3827
|
+
var claudeChatMessageSchema = z29.object({
|
|
3828
|
+
uuid: z29.string().uuid(),
|
|
3829
|
+
text: z29.string(),
|
|
3830
|
+
content: z29.array(
|
|
3831
|
+
z29.object({
|
|
3832
|
+
type: z29.string(),
|
|
3459
3833
|
// Accept any type: "text", "image", "tool_result", etc.
|
|
3460
|
-
text:
|
|
3834
|
+
text: z29.string().optional()
|
|
3461
3835
|
// Make text optional since tool_result may not have it
|
|
3462
3836
|
}).passthrough()
|
|
3463
3837
|
// Allow all other fields
|
|
3464
3838
|
),
|
|
3465
|
-
sender:
|
|
3466
|
-
created_at:
|
|
3467
|
-
updated_at:
|
|
3468
|
-
attachments:
|
|
3839
|
+
sender: z29.enum(["human", "assistant"]),
|
|
3840
|
+
created_at: z29.coerce.date(),
|
|
3841
|
+
updated_at: z29.coerce.date(),
|
|
3842
|
+
attachments: z29.array(z29.any()),
|
|
3469
3843
|
// Accept any attachment structure
|
|
3470
|
-
files:
|
|
3844
|
+
files: z29.array(z29.any())
|
|
3471
3845
|
// Accept any file structure
|
|
3472
3846
|
}).passthrough();
|
|
3473
|
-
var claudeConversationSchema =
|
|
3474
|
-
uuid:
|
|
3475
|
-
name:
|
|
3476
|
-
summary:
|
|
3847
|
+
var claudeConversationSchema = z29.object({
|
|
3848
|
+
uuid: z29.string().uuid(),
|
|
3849
|
+
name: z29.string(),
|
|
3850
|
+
summary: z29.string().optional(),
|
|
3477
3851
|
// Summary field is optional
|
|
3478
|
-
created_at:
|
|
3479
|
-
updated_at:
|
|
3480
|
-
account:
|
|
3481
|
-
uuid:
|
|
3852
|
+
created_at: z29.coerce.date(),
|
|
3853
|
+
updated_at: z29.coerce.date(),
|
|
3854
|
+
account: z29.object({
|
|
3855
|
+
uuid: z29.string().uuid()
|
|
3482
3856
|
}),
|
|
3483
|
-
chat_messages:
|
|
3857
|
+
chat_messages: z29.array(claudeChatMessageSchema)
|
|
3484
3858
|
}).passthrough();
|
|
3485
3859
|
|
|
3486
3860
|
// ../../b4m-core/packages/services/dist/src/importHistoryService/index.js
|
|
@@ -3491,357 +3865,357 @@ var ImportSource;
|
|
|
3491
3865
|
})(ImportSource || (ImportSource = {}));
|
|
3492
3866
|
|
|
3493
3867
|
// ../../b4m-core/packages/services/dist/src/sessionService/create.js
|
|
3494
|
-
import { z as
|
|
3495
|
-
var createSessionParametersSchema =
|
|
3496
|
-
name:
|
|
3497
|
-
knowledgeIds:
|
|
3498
|
-
artifactIds:
|
|
3499
|
-
agentIds:
|
|
3500
|
-
tags:
|
|
3501
|
-
summary:
|
|
3502
|
-
summaryAt:
|
|
3503
|
-
clonedSourceId:
|
|
3504
|
-
forkedSourceId:
|
|
3505
|
-
projectId:
|
|
3506
|
-
lastUsedModel:
|
|
3868
|
+
import { z as z30 } from "zod";
|
|
3869
|
+
var createSessionParametersSchema = z30.object({
|
|
3870
|
+
name: z30.string(),
|
|
3871
|
+
knowledgeIds: z30.array(z30.string()).optional(),
|
|
3872
|
+
artifactIds: z30.array(z30.string()).optional(),
|
|
3873
|
+
agentIds: z30.array(z30.string()).optional(),
|
|
3874
|
+
tags: z30.array(z30.object({ name: z30.string(), strength: z30.number() })).optional(),
|
|
3875
|
+
summary: z30.string().optional(),
|
|
3876
|
+
summaryAt: z30.date().optional(),
|
|
3877
|
+
clonedSourceId: z30.string().optional().nullable(),
|
|
3878
|
+
forkedSourceId: z30.string().optional().nullable(),
|
|
3879
|
+
projectId: z30.string().optional(),
|
|
3880
|
+
lastUsedModel: z30.string().optional().nullable()
|
|
3507
3881
|
});
|
|
3508
3882
|
|
|
3509
3883
|
// ../../b4m-core/packages/services/dist/src/sessionService/delete.js
|
|
3510
|
-
import { z as
|
|
3511
|
-
var deleteSessionSchema =
|
|
3512
|
-
id:
|
|
3884
|
+
import { z as z31 } from "zod";
|
|
3885
|
+
var deleteSessionSchema = z31.object({
|
|
3886
|
+
id: z31.string()
|
|
3513
3887
|
});
|
|
3514
3888
|
|
|
3515
3889
|
// ../../b4m-core/packages/services/dist/src/sessionService/sumarize.js
|
|
3516
|
-
import { z as
|
|
3517
|
-
var sumarizeSessionSchema =
|
|
3518
|
-
id:
|
|
3890
|
+
import { z as z32 } from "zod";
|
|
3891
|
+
var sumarizeSessionSchema = z32.object({
|
|
3892
|
+
id: z32.string()
|
|
3519
3893
|
});
|
|
3520
3894
|
|
|
3521
3895
|
// ../../b4m-core/packages/services/dist/src/projectService/create.js
|
|
3522
|
-
import { z as
|
|
3523
|
-
var createProjectSchema =
|
|
3524
|
-
name:
|
|
3525
|
-
description:
|
|
3526
|
-
sessionIds:
|
|
3527
|
-
fileIds:
|
|
3896
|
+
import { z as z33 } from "zod";
|
|
3897
|
+
var createProjectSchema = z33.object({
|
|
3898
|
+
name: z33.string().min(1),
|
|
3899
|
+
description: z33.string().min(1),
|
|
3900
|
+
sessionIds: z33.array(z33.string()).optional(),
|
|
3901
|
+
fileIds: z33.array(z33.string()).optional()
|
|
3528
3902
|
});
|
|
3529
3903
|
|
|
3530
3904
|
// ../../b4m-core/packages/services/dist/src/projectService/search.js
|
|
3531
|
-
import { z as
|
|
3532
|
-
var searchProjectsSchema =
|
|
3533
|
-
search:
|
|
3534
|
-
filters:
|
|
3535
|
-
favorite:
|
|
3536
|
-
scope:
|
|
3905
|
+
import { z as z34 } from "zod";
|
|
3906
|
+
var searchProjectsSchema = z34.object({
|
|
3907
|
+
search: z34.string().optional(),
|
|
3908
|
+
filters: z34.object({
|
|
3909
|
+
favorite: z34.coerce.boolean().optional(),
|
|
3910
|
+
scope: z34.record(z34.any()).optional()
|
|
3537
3911
|
}).optional(),
|
|
3538
|
-
pagination:
|
|
3539
|
-
page:
|
|
3540
|
-
limit:
|
|
3912
|
+
pagination: z34.object({
|
|
3913
|
+
page: z34.coerce.number().optional(),
|
|
3914
|
+
limit: z34.coerce.number().optional()
|
|
3541
3915
|
}).optional(),
|
|
3542
|
-
orderBy:
|
|
3543
|
-
by:
|
|
3544
|
-
direction:
|
|
3916
|
+
orderBy: z34.object({
|
|
3917
|
+
by: z34.enum(["createdAt", "updatedAt"]).optional(),
|
|
3918
|
+
direction: z34.enum(["asc", "desc"]).optional()
|
|
3545
3919
|
}).optional()
|
|
3546
3920
|
});
|
|
3547
3921
|
|
|
3548
3922
|
// ../../b4m-core/packages/services/dist/src/projectService/addSessions.js
|
|
3549
|
-
import { z as
|
|
3923
|
+
import { z as z45 } from "zod";
|
|
3550
3924
|
import uniq2 from "lodash/uniq.js";
|
|
3551
3925
|
|
|
3552
3926
|
// ../../b4m-core/packages/services/dist/src/sharingService/accept.js
|
|
3553
|
-
import { z as
|
|
3554
|
-
var acceptInviteSchema =
|
|
3555
|
-
id:
|
|
3927
|
+
import { z as z35 } from "zod";
|
|
3928
|
+
var acceptInviteSchema = z35.object({
|
|
3929
|
+
id: z35.string()
|
|
3556
3930
|
});
|
|
3557
3931
|
|
|
3558
3932
|
// ../../b4m-core/packages/services/dist/src/sharingService/cancel.js
|
|
3559
|
-
import { z as
|
|
3560
|
-
var cancelInviteSchema =
|
|
3561
|
-
id:
|
|
3562
|
-
type:
|
|
3563
|
-
email:
|
|
3933
|
+
import { z as z36 } from "zod";
|
|
3934
|
+
var cancelInviteSchema = z36.object({
|
|
3935
|
+
id: z36.string(),
|
|
3936
|
+
type: z36.nativeEnum(InviteType),
|
|
3937
|
+
email: z36.string().email().optional()
|
|
3564
3938
|
});
|
|
3565
3939
|
|
|
3566
3940
|
// ../../b4m-core/packages/services/dist/src/sharingService/cancelOwnDocument.js
|
|
3567
|
-
import { z as
|
|
3568
|
-
var cancelOwnDocumentInvitesSchema =
|
|
3569
|
-
documentId:
|
|
3570
|
-
type:
|
|
3941
|
+
import { z as z37 } from "zod";
|
|
3942
|
+
var cancelOwnDocumentInvitesSchema = z37.object({
|
|
3943
|
+
documentId: z37.string(),
|
|
3944
|
+
type: z37.nativeEnum(InviteType)
|
|
3571
3945
|
});
|
|
3572
3946
|
|
|
3573
3947
|
// ../../b4m-core/packages/services/dist/src/sharingService/create.js
|
|
3574
|
-
import { z as
|
|
3948
|
+
import { z as z38 } from "zod";
|
|
3575
3949
|
var defaultExpiration = () => new Date((/* @__PURE__ */ new Date()).getFullYear() + 100, (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate());
|
|
3576
3950
|
var DEFAULT_AVAILABLE = 1;
|
|
3577
|
-
var createInviteSchema =
|
|
3578
|
-
id:
|
|
3579
|
-
type:
|
|
3580
|
-
permissions:
|
|
3581
|
-
recipients:
|
|
3582
|
-
description:
|
|
3583
|
-
expiresAt:
|
|
3584
|
-
available:
|
|
3951
|
+
var createInviteSchema = z38.object({
|
|
3952
|
+
id: z38.string(),
|
|
3953
|
+
type: z38.nativeEnum(InviteType),
|
|
3954
|
+
permissions: z38.array(z38.nativeEnum(Permission)),
|
|
3955
|
+
recipients: z38.string().array().optional(),
|
|
3956
|
+
description: z38.string().optional(),
|
|
3957
|
+
expiresAt: z38.date().optional().default(defaultExpiration()),
|
|
3958
|
+
available: z38.number().optional().default(DEFAULT_AVAILABLE)
|
|
3585
3959
|
});
|
|
3586
3960
|
|
|
3587
3961
|
// ../../b4m-core/packages/services/dist/src/sharingService/get.js
|
|
3588
|
-
import { z as
|
|
3589
|
-
var getInviteSchema =
|
|
3590
|
-
id:
|
|
3591
|
-
withUsername:
|
|
3962
|
+
import { z as z39 } from "zod";
|
|
3963
|
+
var getInviteSchema = z39.object({
|
|
3964
|
+
id: z39.string(),
|
|
3965
|
+
withUsername: z39.boolean().optional()
|
|
3592
3966
|
});
|
|
3593
3967
|
|
|
3594
3968
|
// ../../b4m-core/packages/services/dist/src/sharingService/listByDocumentIdAndType.js
|
|
3595
|
-
import { z as
|
|
3596
|
-
var listInviteByDocumentIdAndTypeSchema =
|
|
3597
|
-
documentId:
|
|
3598
|
-
type:
|
|
3969
|
+
import { z as z40 } from "zod";
|
|
3970
|
+
var listInviteByDocumentIdAndTypeSchema = z40.object({
|
|
3971
|
+
documentId: z40.string(),
|
|
3972
|
+
type: z40.nativeEnum(InviteType)
|
|
3599
3973
|
});
|
|
3600
3974
|
|
|
3601
3975
|
// ../../b4m-core/packages/services/dist/src/sharingService/listOwnPending.js
|
|
3602
|
-
import { z as
|
|
3603
|
-
var listOwnPendingInvitesSchema =
|
|
3604
|
-
limit:
|
|
3605
|
-
page:
|
|
3976
|
+
import { z as z41 } from "zod";
|
|
3977
|
+
var listOwnPendingInvitesSchema = z41.object({
|
|
3978
|
+
limit: z41.number().min(1).max(100).default(20),
|
|
3979
|
+
page: z41.number().min(1).default(1)
|
|
3606
3980
|
});
|
|
3607
3981
|
|
|
3608
3982
|
// ../../b4m-core/packages/services/dist/src/sharingService/refuse.js
|
|
3609
|
-
import { z as
|
|
3610
|
-
var refuseInviteSchema =
|
|
3611
|
-
id:
|
|
3983
|
+
import { z as z42 } from "zod";
|
|
3984
|
+
var refuseInviteSchema = z42.object({
|
|
3985
|
+
id: z42.string()
|
|
3612
3986
|
});
|
|
3613
3987
|
|
|
3614
3988
|
// ../../b4m-core/packages/services/dist/src/sharingService/revoke.js
|
|
3615
|
-
import { z as
|
|
3616
|
-
var revokeSharingSchema =
|
|
3617
|
-
id:
|
|
3618
|
-
type:
|
|
3619
|
-
userId:
|
|
3620
|
-
projectId:
|
|
3989
|
+
import { z as z43 } from "zod";
|
|
3990
|
+
var revokeSharingSchema = z43.object({
|
|
3991
|
+
id: z43.string(),
|
|
3992
|
+
type: z43.enum(["files", "sessions", "projects"]),
|
|
3993
|
+
userId: z43.string(),
|
|
3994
|
+
projectId: z43.string().optional()
|
|
3621
3995
|
});
|
|
3622
3996
|
|
|
3623
3997
|
// ../../b4m-core/packages/services/dist/src/projectService/addFiles.js
|
|
3624
|
-
import { z as
|
|
3998
|
+
import { z as z44 } from "zod";
|
|
3625
3999
|
import uniq from "lodash/uniq.js";
|
|
3626
|
-
var addFilesProjectSchema =
|
|
3627
|
-
projectId:
|
|
3628
|
-
fileIds:
|
|
4000
|
+
var addFilesProjectSchema = z44.object({
|
|
4001
|
+
projectId: z44.string().nonempty(),
|
|
4002
|
+
fileIds: z44.array(z44.string().nonempty())
|
|
3629
4003
|
});
|
|
3630
4004
|
|
|
3631
4005
|
// ../../b4m-core/packages/services/dist/src/projectService/addSessions.js
|
|
3632
|
-
var addSessionsProjectSchema =
|
|
3633
|
-
projectId:
|
|
3634
|
-
sessionIds:
|
|
4006
|
+
var addSessionsProjectSchema = z45.object({
|
|
4007
|
+
projectId: z45.string().nonempty(),
|
|
4008
|
+
sessionIds: z45.array(z45.string().nonempty())
|
|
3635
4009
|
});
|
|
3636
4010
|
|
|
3637
4011
|
// ../../b4m-core/packages/services/dist/src/projectService/get.js
|
|
3638
|
-
import { z as z45 } from "zod";
|
|
3639
|
-
var getProjectSchema = z45.object({
|
|
3640
|
-
id: z45.string()
|
|
3641
|
-
});
|
|
3642
|
-
|
|
3643
|
-
// ../../b4m-core/packages/services/dist/src/projectService/update.js
|
|
3644
4012
|
import { z as z46 } from "zod";
|
|
3645
|
-
var
|
|
3646
|
-
id: z46.string()
|
|
3647
|
-
name: z46.string().optional(),
|
|
3648
|
-
description: z46.string().optional()
|
|
4013
|
+
var getProjectSchema = z46.object({
|
|
4014
|
+
id: z46.string()
|
|
3649
4015
|
});
|
|
3650
4016
|
|
|
3651
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4017
|
+
// ../../b4m-core/packages/services/dist/src/projectService/update.js
|
|
3652
4018
|
import { z as z47 } from "zod";
|
|
3653
|
-
var
|
|
3654
|
-
id: z47.string()
|
|
4019
|
+
var updateProjectSchema = z47.object({
|
|
4020
|
+
id: z47.string(),
|
|
4021
|
+
name: z47.string().optional(),
|
|
4022
|
+
description: z47.string().optional()
|
|
3655
4023
|
});
|
|
3656
4024
|
|
|
3657
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4025
|
+
// ../../b4m-core/packages/services/dist/src/projectService/delete.js
|
|
3658
4026
|
import { z as z48 } from "zod";
|
|
3659
|
-
var
|
|
3660
|
-
|
|
3661
|
-
fileIds: z48.array(z48.string())
|
|
4027
|
+
var deleteProjectSchema = z48.object({
|
|
4028
|
+
id: z48.string()
|
|
3662
4029
|
});
|
|
3663
4030
|
|
|
3664
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4031
|
+
// ../../b4m-core/packages/services/dist/src/projectService/removeFiles.js
|
|
3665
4032
|
import { z as z49 } from "zod";
|
|
3666
|
-
var
|
|
4033
|
+
var removeProjectFilesSchema = z49.object({
|
|
3667
4034
|
projectId: z49.string(),
|
|
3668
|
-
|
|
4035
|
+
fileIds: z49.array(z49.string())
|
|
3669
4036
|
});
|
|
3670
4037
|
|
|
3671
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4038
|
+
// ../../b4m-core/packages/services/dist/src/projectService/removeSessions.js
|
|
3672
4039
|
import { z as z50 } from "zod";
|
|
3673
|
-
var
|
|
3674
|
-
projectId: z50.string()
|
|
4040
|
+
var removeProjectSessionsSchema = z50.object({
|
|
4041
|
+
projectId: z50.string(),
|
|
4042
|
+
sessionIds: z50.array(z50.string())
|
|
3675
4043
|
});
|
|
3676
4044
|
|
|
3677
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4045
|
+
// ../../b4m-core/packages/services/dist/src/projectService/listSessions.js
|
|
3678
4046
|
import { z as z51 } from "zod";
|
|
3679
|
-
var
|
|
4047
|
+
var listProjectSessionsSchema = z51.object({
|
|
3680
4048
|
projectId: z51.string()
|
|
3681
4049
|
});
|
|
3682
4050
|
|
|
3683
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4051
|
+
// ../../b4m-core/packages/services/dist/src/projectService/listFiles.js
|
|
3684
4052
|
import { z as z52 } from "zod";
|
|
3685
|
-
var
|
|
3686
|
-
|
|
3687
|
-
statuses: z52.string().optional().default(""),
|
|
3688
|
-
limit: z52.coerce.number().optional().default(10),
|
|
3689
|
-
page: z52.coerce.number().optional().default(1)
|
|
4053
|
+
var listProjectFilesSchema = z52.object({
|
|
4054
|
+
projectId: z52.string()
|
|
3690
4055
|
});
|
|
3691
4056
|
|
|
3692
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4057
|
+
// ../../b4m-core/packages/services/dist/src/projectService/listInvites.js
|
|
3693
4058
|
import { z as z53 } from "zod";
|
|
3694
|
-
var
|
|
3695
|
-
|
|
3696
|
-
|
|
4059
|
+
var listProjectInvitesParamsSchema = z53.object({
|
|
4060
|
+
id: z53.string(),
|
|
4061
|
+
statuses: z53.string().optional().default(""),
|
|
4062
|
+
limit: z53.coerce.number().optional().default(10),
|
|
4063
|
+
page: z53.coerce.number().optional().default(1)
|
|
3697
4064
|
});
|
|
3698
4065
|
|
|
3699
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4066
|
+
// ../../b4m-core/packages/services/dist/src/projectService/addSystemPrompts.js
|
|
3700
4067
|
import { z as z54 } from "zod";
|
|
3701
|
-
var
|
|
4068
|
+
var addSystemPromptsSchema = z54.object({
|
|
3702
4069
|
projectId: z54.string(),
|
|
3703
|
-
|
|
4070
|
+
fileIds: z54.array(z54.string())
|
|
3704
4071
|
});
|
|
3705
4072
|
|
|
3706
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4073
|
+
// ../../b4m-core/packages/services/dist/src/projectService/toggleSystemPrompt.js
|
|
3707
4074
|
import { z as z55 } from "zod";
|
|
3708
|
-
var
|
|
4075
|
+
var toggleSystemPromptSchema = z55.object({
|
|
3709
4076
|
projectId: z55.string(),
|
|
3710
4077
|
fileId: z55.string()
|
|
3711
4078
|
});
|
|
3712
4079
|
|
|
3713
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
3714
|
-
import { z as z58 } from "zod";
|
|
3715
|
-
|
|
3716
|
-
// ../../b4m-core/packages/services/dist/src/favoriteService/create.js
|
|
4080
|
+
// ../../b4m-core/packages/services/dist/src/projectService/removeSystemPrompt.js
|
|
3717
4081
|
import { z as z56 } from "zod";
|
|
3718
|
-
var
|
|
3719
|
-
|
|
3720
|
-
|
|
4082
|
+
var removeSystemPromptSchema = z56.object({
|
|
4083
|
+
projectId: z56.string(),
|
|
4084
|
+
fileId: z56.string()
|
|
3721
4085
|
});
|
|
3722
4086
|
|
|
3723
|
-
// ../../b4m-core/packages/services/dist/src/
|
|
4087
|
+
// ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
|
|
4088
|
+
import { z as z59 } from "zod";
|
|
4089
|
+
|
|
4090
|
+
// ../../b4m-core/packages/services/dist/src/favoriteService/create.js
|
|
3724
4091
|
import { z as z57 } from "zod";
|
|
3725
|
-
var
|
|
4092
|
+
var createFavoriteParametersSchema = z57.object({
|
|
3726
4093
|
documentId: z57.string(),
|
|
3727
4094
|
documentType: z57.nativeEnum(FavoriteDocumentType)
|
|
3728
4095
|
});
|
|
3729
4096
|
|
|
3730
|
-
// ../../b4m-core/packages/services/dist/src/
|
|
3731
|
-
|
|
3732
|
-
|
|
4097
|
+
// ../../b4m-core/packages/services/dist/src/favoriteService/delete.js
|
|
4098
|
+
import { z as z58 } from "zod";
|
|
4099
|
+
var deleteFavoriteParametersSchema = z58.object({
|
|
4100
|
+
documentId: z58.string(),
|
|
4101
|
+
documentType: z58.nativeEnum(FavoriteDocumentType)
|
|
3733
4102
|
});
|
|
3734
4103
|
|
|
3735
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
3736
|
-
|
|
3737
|
-
var deleteFavoriteParametersSchema2 = z59.object({
|
|
4104
|
+
// ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
|
|
4105
|
+
var addFavoriteParametersSchema = z59.object({
|
|
3738
4106
|
projectId: z59.string()
|
|
3739
4107
|
});
|
|
3740
4108
|
|
|
3741
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4109
|
+
// ../../b4m-core/packages/services/dist/src/projectService/deleteFavorite.js
|
|
3742
4110
|
import { z as z60 } from "zod";
|
|
3743
|
-
var
|
|
4111
|
+
var deleteFavoriteParametersSchema2 = z60.object({
|
|
3744
4112
|
projectId: z60.string()
|
|
3745
4113
|
});
|
|
3746
4114
|
|
|
3747
|
-
// ../../b4m-core/packages/services/dist/src/projectService/
|
|
4115
|
+
// ../../b4m-core/packages/services/dist/src/projectService/removeNonExistentFiles.js
|
|
3748
4116
|
import { z as z61 } from "zod";
|
|
3749
|
-
var
|
|
3750
|
-
|
|
3751
|
-
userIdToRemove: z61.string().optional()
|
|
3752
|
-
// Optional: if provided, this is a removal by owner
|
|
4117
|
+
var removeNonExistentFilesSchema = z61.object({
|
|
4118
|
+
projectId: z61.string()
|
|
3753
4119
|
});
|
|
3754
4120
|
|
|
3755
|
-
// ../../b4m-core/packages/services/dist/src/
|
|
3756
|
-
import uniq3 from "lodash/uniq.js";
|
|
3757
|
-
import isEqual from "lodash/isEqual.js";
|
|
4121
|
+
// ../../b4m-core/packages/services/dist/src/projectService/leaveProject.js
|
|
3758
4122
|
import { z as z62 } from "zod";
|
|
3759
|
-
var
|
|
4123
|
+
var leaveProjectParamsSchema = z62.object({
|
|
3760
4124
|
id: z62.string(),
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
artifactIds: z62.array(z62.string()).optional(),
|
|
3764
|
-
tags: z62.array(z62.object({ name: z62.string(), strength: z62.number() })).optional(),
|
|
3765
|
-
lastUsedModel: z62.string().optional()
|
|
4125
|
+
userIdToRemove: z62.string().optional()
|
|
4126
|
+
// Optional: if provided, this is a removal by owner
|
|
3766
4127
|
});
|
|
3767
4128
|
|
|
3768
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4129
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/update.js
|
|
4130
|
+
import uniq3 from "lodash/uniq.js";
|
|
4131
|
+
import isEqual from "lodash/isEqual.js";
|
|
3769
4132
|
import { z as z63 } from "zod";
|
|
3770
|
-
var
|
|
3771
|
-
id: z63.string()
|
|
4133
|
+
var updateSessionParamtersSchema = z63.object({
|
|
4134
|
+
id: z63.string(),
|
|
4135
|
+
name: z63.string().optional(),
|
|
4136
|
+
knowledgeIds: z63.array(z63.string()).optional(),
|
|
4137
|
+
artifactIds: z63.array(z63.string()).optional(),
|
|
4138
|
+
tags: z63.array(z63.object({ name: z63.string(), strength: z63.number() })).optional(),
|
|
4139
|
+
lastUsedModel: z63.string().optional()
|
|
3772
4140
|
});
|
|
3773
4141
|
|
|
3774
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4142
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/clone.js
|
|
3775
4143
|
import { z as z64 } from "zod";
|
|
3776
|
-
var
|
|
3777
|
-
|
|
3778
|
-
messageId: z64.string()
|
|
4144
|
+
var cloneSessionSchema = z64.object({
|
|
4145
|
+
id: z64.string()
|
|
3779
4146
|
});
|
|
3780
4147
|
|
|
3781
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4148
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/fork.js
|
|
3782
4149
|
import { z as z65 } from "zod";
|
|
3783
|
-
var
|
|
4150
|
+
var forkSessionSchema = z65.object({
|
|
3784
4151
|
sessionId: z65.string(),
|
|
3785
4152
|
messageId: z65.string()
|
|
3786
4153
|
});
|
|
3787
4154
|
|
|
3788
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4155
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/snip.js
|
|
3789
4156
|
import { z as z66 } from "zod";
|
|
3790
|
-
var
|
|
3791
|
-
|
|
4157
|
+
var snipSessionSchema = z66.object({
|
|
4158
|
+
sessionId: z66.string(),
|
|
4159
|
+
messageId: z66.string()
|
|
3792
4160
|
});
|
|
3793
4161
|
|
|
3794
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4162
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/get.js
|
|
3795
4163
|
import { z as z67 } from "zod";
|
|
3796
|
-
var
|
|
3797
|
-
|
|
3798
|
-
messageId: z67.string()
|
|
4164
|
+
var getSessionSchema = z67.object({
|
|
4165
|
+
id: z67.string()
|
|
3799
4166
|
});
|
|
3800
4167
|
|
|
3801
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4168
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/deleteMessage.js
|
|
3802
4169
|
import { z as z68 } from "zod";
|
|
3803
|
-
var
|
|
3804
|
-
sessionId: z68.string()
|
|
4170
|
+
var deleteSessionMessageSchema = z68.object({
|
|
4171
|
+
sessionId: z68.string(),
|
|
4172
|
+
messageId: z68.string()
|
|
3805
4173
|
});
|
|
3806
4174
|
|
|
3807
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4175
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/addFavorite.js
|
|
3808
4176
|
import { z as z69 } from "zod";
|
|
3809
|
-
var
|
|
4177
|
+
var addFavoriteParametersSchema2 = z69.object({
|
|
3810
4178
|
sessionId: z69.string()
|
|
3811
4179
|
});
|
|
3812
4180
|
|
|
3813
|
-
// ../../b4m-core/packages/services/dist/src/sessionService/
|
|
4181
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/deleteFavorite.js
|
|
3814
4182
|
import { z as z70 } from "zod";
|
|
3815
|
-
var
|
|
3816
|
-
sessionId: z70.string()
|
|
4183
|
+
var deleteFavoriteParametersSchema3 = z70.object({
|
|
4184
|
+
sessionId: z70.string()
|
|
4185
|
+
});
|
|
4186
|
+
|
|
4187
|
+
// ../../b4m-core/packages/services/dist/src/sessionService/autoName.js
|
|
4188
|
+
import { z as z71 } from "zod";
|
|
4189
|
+
var autoNameParameterSchema = z71.object({
|
|
4190
|
+
sessionId: z71.string(),
|
|
3817
4191
|
/** The maximum number of words to include in the title */
|
|
3818
|
-
maxWords:
|
|
4192
|
+
maxWords: z71.number().optional()
|
|
3819
4193
|
});
|
|
3820
4194
|
|
|
3821
4195
|
// ../../b4m-core/packages/services/dist/src/organizationService/search.js
|
|
3822
|
-
import { z as
|
|
3823
|
-
var searchSchema2 =
|
|
4196
|
+
import { z as z72 } from "zod";
|
|
4197
|
+
var searchSchema2 = z72.object({
|
|
3824
4198
|
/**
|
|
3825
4199
|
* Text search query (searches in name and description)
|
|
3826
4200
|
*/
|
|
3827
|
-
query:
|
|
4201
|
+
query: z72.string().optional(),
|
|
3828
4202
|
/**
|
|
3829
4203
|
* Filter by personal organizations
|
|
3830
4204
|
*/
|
|
3831
|
-
filters:
|
|
3832
|
-
personal:
|
|
3833
|
-
userId:
|
|
4205
|
+
filters: z72.object({
|
|
4206
|
+
personal: z72.union([z72.enum(["true", "false"]).transform((val) => val === "true"), z72.boolean()]).optional(),
|
|
4207
|
+
userId: z72.string().optional()
|
|
3834
4208
|
}).default({}),
|
|
3835
|
-
pagination:
|
|
3836
|
-
page:
|
|
3837
|
-
limit:
|
|
4209
|
+
pagination: z72.object({
|
|
4210
|
+
page: z72.coerce.number().int().positive().default(1),
|
|
4211
|
+
limit: z72.coerce.number().int().positive().max(100).default(10)
|
|
3838
4212
|
}).default({
|
|
3839
4213
|
page: 1,
|
|
3840
4214
|
limit: 10
|
|
3841
4215
|
}),
|
|
3842
|
-
orderBy:
|
|
3843
|
-
field:
|
|
3844
|
-
direction:
|
|
4216
|
+
orderBy: z72.object({
|
|
4217
|
+
field: z72.enum(["name", "createdAt", "updatedAt"]).default("name"),
|
|
4218
|
+
direction: z72.enum(["asc", "desc"]).default("asc")
|
|
3845
4219
|
}).default({
|
|
3846
4220
|
field: "name",
|
|
3847
4221
|
direction: "asc"
|
|
@@ -3849,355 +4223,355 @@ var searchSchema2 = z71.object({
|
|
|
3849
4223
|
});
|
|
3850
4224
|
|
|
3851
4225
|
// ../../b4m-core/packages/services/dist/src/organizationService/get.js
|
|
3852
|
-
import { z as
|
|
3853
|
-
var getSchema =
|
|
4226
|
+
import { z as z73 } from "zod";
|
|
4227
|
+
var getSchema = z73.object({
|
|
3854
4228
|
/**
|
|
3855
4229
|
* Organization ID
|
|
3856
4230
|
*/
|
|
3857
|
-
id:
|
|
4231
|
+
id: z73.string().min(1)
|
|
3858
4232
|
});
|
|
3859
4233
|
|
|
3860
4234
|
// ../../b4m-core/packages/services/dist/src/organizationService/addMember.js
|
|
3861
|
-
import { z as
|
|
3862
|
-
var addMemberSchema =
|
|
3863
|
-
userId:
|
|
3864
|
-
email:
|
|
3865
|
-
organizationId:
|
|
3866
|
-
force:
|
|
4235
|
+
import { z as z74 } from "zod";
|
|
4236
|
+
var addMemberSchema = z74.object({
|
|
4237
|
+
userId: z74.string().optional(),
|
|
4238
|
+
email: z74.string().optional(),
|
|
4239
|
+
organizationId: z74.string(),
|
|
4240
|
+
force: z74.boolean().optional()
|
|
3867
4241
|
// If true, add the user to the organization even if it's at full capacity
|
|
3868
4242
|
});
|
|
3869
4243
|
|
|
3870
4244
|
// ../../b4m-core/packages/services/dist/src/organizationService/getUsers.js
|
|
3871
|
-
import { z as
|
|
3872
|
-
var getUsersSchema =
|
|
3873
|
-
id:
|
|
4245
|
+
import { z as z75 } from "zod";
|
|
4246
|
+
var getUsersSchema = z75.object({
|
|
4247
|
+
id: z75.string()
|
|
3874
4248
|
});
|
|
3875
4249
|
|
|
3876
4250
|
// ../../b4m-core/packages/services/dist/src/organizationService/create.js
|
|
3877
|
-
import { z as
|
|
3878
|
-
var createSchema =
|
|
3879
|
-
name:
|
|
3880
|
-
personal:
|
|
3881
|
-
seats:
|
|
3882
|
-
stripeCustomerId:
|
|
3883
|
-
billingOwnerId:
|
|
4251
|
+
import { z as z76 } from "zod";
|
|
4252
|
+
var createSchema = z76.object({
|
|
4253
|
+
name: z76.string(),
|
|
4254
|
+
personal: z76.boolean().default(false),
|
|
4255
|
+
seats: z76.number().default(1),
|
|
4256
|
+
stripeCustomerId: z76.string().nullable(),
|
|
4257
|
+
billingOwnerId: z76.string().optional(),
|
|
3884
4258
|
// Optional billing owner (defaults to user if not provided)
|
|
3885
|
-
managerId:
|
|
4259
|
+
managerId: z76.string().optional()
|
|
3886
4260
|
// Optional team manager
|
|
3887
4261
|
});
|
|
3888
4262
|
|
|
3889
4263
|
// ../../b4m-core/packages/services/dist/src/organizationService/update.js
|
|
3890
|
-
import { z as
|
|
3891
|
-
var updateSchema =
|
|
3892
|
-
id:
|
|
3893
|
-
name:
|
|
3894
|
-
description:
|
|
3895
|
-
billingContact:
|
|
3896
|
-
currentCredits:
|
|
4264
|
+
import { z as z77 } from "zod";
|
|
4265
|
+
var updateSchema = z77.object({
|
|
4266
|
+
id: z77.string(),
|
|
4267
|
+
name: z77.string().optional(),
|
|
4268
|
+
description: z77.string().optional(),
|
|
4269
|
+
billingContact: z77.string().optional(),
|
|
4270
|
+
currentCredits: z77.coerce.number().optional()
|
|
3897
4271
|
});
|
|
3898
4272
|
|
|
3899
4273
|
// ../../b4m-core/packages/services/dist/src/organizationService/delete.js
|
|
3900
|
-
import { z as
|
|
3901
|
-
var deleteSchema =
|
|
4274
|
+
import { z as z78 } from "zod";
|
|
4275
|
+
var deleteSchema = z78.object({
|
|
3902
4276
|
/**
|
|
3903
4277
|
* Organization ID
|
|
3904
4278
|
*/
|
|
3905
|
-
id:
|
|
4279
|
+
id: z78.string().min(1)
|
|
3906
4280
|
});
|
|
3907
4281
|
|
|
3908
4282
|
// ../../b4m-core/packages/services/dist/src/organizationService/listPendingUsers.js
|
|
3909
|
-
import { z as
|
|
3910
|
-
var listPendingUsersSchema =
|
|
3911
|
-
organizationId:
|
|
4283
|
+
import { z as z79 } from "zod";
|
|
4284
|
+
var listPendingUsersSchema = z79.object({
|
|
4285
|
+
organizationId: z79.string()
|
|
3912
4286
|
});
|
|
3913
4287
|
|
|
3914
4288
|
// ../../b4m-core/packages/services/dist/src/organizationService/revokeAccess.js
|
|
3915
|
-
import { z as
|
|
3916
|
-
var revokeAccessSchema =
|
|
3917
|
-
id:
|
|
3918
|
-
userId:
|
|
4289
|
+
import { z as z80 } from "zod";
|
|
4290
|
+
var revokeAccessSchema = z80.object({
|
|
4291
|
+
id: z80.string(),
|
|
4292
|
+
userId: z80.string()
|
|
3919
4293
|
});
|
|
3920
4294
|
|
|
3921
4295
|
// ../../b4m-core/packages/services/dist/src/organizationService/leave.js
|
|
3922
|
-
import { z as
|
|
3923
|
-
var organizationLeaveSchema =
|
|
3924
|
-
id:
|
|
4296
|
+
import { z as z81 } from "zod";
|
|
4297
|
+
var organizationLeaveSchema = z81.object({
|
|
4298
|
+
id: z81.string()
|
|
3925
4299
|
});
|
|
3926
4300
|
|
|
3927
4301
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/create.js
|
|
3928
|
-
import { z as
|
|
3929
|
-
var createApiKeySchema =
|
|
3930
|
-
apiKey:
|
|
3931
|
-
description:
|
|
3932
|
-
isActive:
|
|
3933
|
-
type:
|
|
3934
|
-
expireDays:
|
|
4302
|
+
import { z as z82 } from "zod";
|
|
4303
|
+
var createApiKeySchema = z82.object({
|
|
4304
|
+
apiKey: z82.string().min(6),
|
|
4305
|
+
description: z82.string().optional().default(""),
|
|
4306
|
+
isActive: z82.boolean().optional().default(true),
|
|
4307
|
+
type: z82.nativeEnum(ApiKeyType),
|
|
4308
|
+
expireDays: z82.number().min(1).max(365).default(90)
|
|
3935
4309
|
// Default 90-day expiration
|
|
3936
4310
|
});
|
|
3937
4311
|
|
|
3938
4312
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/set.js
|
|
3939
|
-
import { z as
|
|
3940
|
-
var setApiKeySchema =
|
|
3941
|
-
id:
|
|
3942
|
-
type:
|
|
4313
|
+
import { z as z83 } from "zod";
|
|
4314
|
+
var setApiKeySchema = z83.object({
|
|
4315
|
+
id: z83.string(),
|
|
4316
|
+
type: z83.nativeEnum(ApiKeyType)
|
|
3943
4317
|
});
|
|
3944
4318
|
|
|
3945
4319
|
// ../../b4m-core/packages/services/dist/src/apiKeyService/delete.js
|
|
3946
|
-
import { z as
|
|
3947
|
-
var deleteApiKeySchema =
|
|
3948
|
-
id:
|
|
4320
|
+
import { z as z84 } from "zod";
|
|
4321
|
+
var deleteApiKeySchema = z84.object({
|
|
4322
|
+
id: z84.string()
|
|
3949
4323
|
});
|
|
3950
4324
|
|
|
3951
4325
|
// ../../b4m-core/packages/services/dist/src/fabFileService/get.js
|
|
3952
|
-
import { z as
|
|
3953
|
-
var getFabFileSchema =
|
|
3954
|
-
id:
|
|
4326
|
+
import { z as z85 } from "zod";
|
|
4327
|
+
var getFabFileSchema = z85.object({
|
|
4328
|
+
id: z85.string()
|
|
3955
4329
|
});
|
|
3956
4330
|
|
|
3957
4331
|
// ../../b4m-core/packages/services/dist/src/fabFileService/list.js
|
|
3958
|
-
import { z as
|
|
3959
|
-
var listFabFilesSchema =
|
|
3960
|
-
ids:
|
|
4332
|
+
import { z as z86 } from "zod";
|
|
4333
|
+
var listFabFilesSchema = z86.object({
|
|
4334
|
+
ids: z86.array(z86.string()).optional()
|
|
3961
4335
|
});
|
|
3962
4336
|
|
|
3963
4337
|
// ../../b4m-core/packages/services/dist/src/fabFileService/update.js
|
|
3964
4338
|
import mime from "mime-types";
|
|
3965
4339
|
import { v4 as uuidv42 } from "uuid";
|
|
3966
|
-
import { z as
|
|
3967
|
-
var updateFabFileSchema =
|
|
3968
|
-
id:
|
|
3969
|
-
fileName:
|
|
3970
|
-
mimeType:
|
|
3971
|
-
fileContent:
|
|
3972
|
-
type:
|
|
3973
|
-
system:
|
|
3974
|
-
systemPriority:
|
|
3975
|
-
sessionId:
|
|
3976
|
-
notes:
|
|
3977
|
-
primaryTag:
|
|
3978
|
-
tags:
|
|
3979
|
-
name:
|
|
3980
|
-
strength:
|
|
4340
|
+
import { z as z87 } from "zod";
|
|
4341
|
+
var updateFabFileSchema = z87.object({
|
|
4342
|
+
id: z87.string(),
|
|
4343
|
+
fileName: z87.string(),
|
|
4344
|
+
mimeType: z87.string(),
|
|
4345
|
+
fileContent: z87.string().optional(),
|
|
4346
|
+
type: z87.nativeEnum(KnowledgeType),
|
|
4347
|
+
system: z87.boolean().optional(),
|
|
4348
|
+
systemPriority: z87.number().min(0).max(999).optional(),
|
|
4349
|
+
sessionId: z87.string().optional(),
|
|
4350
|
+
notes: z87.string().optional(),
|
|
4351
|
+
primaryTag: z87.string().optional(),
|
|
4352
|
+
tags: z87.array(z87.object({
|
|
4353
|
+
name: z87.string(),
|
|
4354
|
+
strength: z87.number()
|
|
3981
4355
|
})).optional(),
|
|
3982
|
-
error:
|
|
4356
|
+
error: z87.string().nullable().optional()
|
|
3983
4357
|
});
|
|
3984
4358
|
|
|
3985
4359
|
// ../../b4m-core/packages/services/dist/src/fabFileService/delete.js
|
|
3986
|
-
import { z as
|
|
3987
|
-
var deleteFabFileSchema =
|
|
3988
|
-
id:
|
|
4360
|
+
import { z as z88 } from "zod";
|
|
4361
|
+
var deleteFabFileSchema = z88.object({
|
|
4362
|
+
id: z88.string()
|
|
3989
4363
|
});
|
|
3990
4364
|
|
|
3991
4365
|
// ../../b4m-core/packages/services/dist/src/fabFileService/chunk.js
|
|
3992
|
-
import { z as
|
|
3993
|
-
var chunkFileSchema =
|
|
3994
|
-
fabFileId:
|
|
3995
|
-
embeddingModel:
|
|
4366
|
+
import { z as z89 } from "zod";
|
|
4367
|
+
var chunkFileSchema = z89.object({
|
|
4368
|
+
fabFileId: z89.string(),
|
|
4369
|
+
embeddingModel: z89.string()
|
|
3996
4370
|
});
|
|
3997
4371
|
|
|
3998
4372
|
// ../../b4m-core/packages/services/dist/src/fabFileService/vectorize.js
|
|
3999
|
-
import { z as
|
|
4000
|
-
var vectorizeFabFileChunkSchema =
|
|
4001
|
-
fabFileId:
|
|
4002
|
-
chunkId:
|
|
4373
|
+
import { z as z90 } from "zod";
|
|
4374
|
+
var vectorizeFabFileChunkSchema = z90.object({
|
|
4375
|
+
fabFileId: z90.string(),
|
|
4376
|
+
chunkId: z90.string()
|
|
4003
4377
|
});
|
|
4004
4378
|
|
|
4005
4379
|
// ../../b4m-core/packages/services/dist/src/fabFileService/listBySession.js
|
|
4006
|
-
import { z as
|
|
4007
|
-
var listFabFilesBySessionSchema =
|
|
4008
|
-
sessionId:
|
|
4380
|
+
import { z as z91 } from "zod";
|
|
4381
|
+
var listFabFilesBySessionSchema = z91.object({
|
|
4382
|
+
sessionId: z91.string()
|
|
4009
4383
|
});
|
|
4010
4384
|
|
|
4011
4385
|
// ../../b4m-core/packages/services/dist/src/fabFileService/listByQuest.js
|
|
4012
|
-
import { z as
|
|
4013
|
-
var listFabFilesByQuestSchema =
|
|
4014
|
-
questId:
|
|
4386
|
+
import { z as z92 } from "zod";
|
|
4387
|
+
var listFabFilesByQuestSchema = z92.object({
|
|
4388
|
+
questId: z92.string()
|
|
4015
4389
|
});
|
|
4016
4390
|
|
|
4017
4391
|
// ../../b4m-core/packages/services/dist/src/fabFileService/createByUrl.js
|
|
4018
|
-
import { z as
|
|
4019
|
-
var createFabFileByUrlSchema =
|
|
4020
|
-
url:
|
|
4392
|
+
import { z as z93 } from "zod";
|
|
4393
|
+
var createFabFileByUrlSchema = z93.object({
|
|
4394
|
+
url: z93.string().regex(/^(?!https?:\/\/(drive|docs)\.google\.com\/(?:file\/d\/|open\?id=|uc\?id=|document\/d\/|spreadsheets\/d\/|presentation\/d\/|forms\/d\/|drive\/folders\/)([a-zA-Z0-9_-]{10,})).+/)
|
|
4021
4395
|
});
|
|
4022
4396
|
|
|
4023
4397
|
// ../../b4m-core/packages/services/dist/src/fabFileService/search.js
|
|
4024
|
-
import { z as
|
|
4025
|
-
var searchFabFilesSchema =
|
|
4026
|
-
search:
|
|
4027
|
-
filters:
|
|
4028
|
-
tags:
|
|
4029
|
-
type:
|
|
4030
|
-
shared:
|
|
4398
|
+
import { z as z94 } from "zod";
|
|
4399
|
+
var searchFabFilesSchema = z94.object({
|
|
4400
|
+
search: z94.string().optional(),
|
|
4401
|
+
filters: z94.object({
|
|
4402
|
+
tags: z94.array(z94.string()).optional(),
|
|
4403
|
+
type: z94.enum(["text", "pdf", "url", "image", "excel", "word", "json", "csv", "markdown", "code"]).optional(),
|
|
4404
|
+
shared: z94.coerce.boolean().optional(),
|
|
4031
4405
|
// Indicates if the user is searching for shared files
|
|
4032
|
-
curated:
|
|
4406
|
+
curated: z94.coerce.boolean().optional(),
|
|
4033
4407
|
// Indicates if the user is searching for curated notebook files
|
|
4034
|
-
projectId:
|
|
4035
|
-
ids:
|
|
4408
|
+
projectId: z94.string().optional(),
|
|
4409
|
+
ids: z94.array(z94.string()).optional()
|
|
4036
4410
|
// Add support for filtering by IDs
|
|
4037
4411
|
}).optional(),
|
|
4038
|
-
pagination:
|
|
4039
|
-
page:
|
|
4040
|
-
limit:
|
|
4412
|
+
pagination: z94.object({
|
|
4413
|
+
page: z94.coerce.number(),
|
|
4414
|
+
limit: z94.coerce.number()
|
|
4041
4415
|
}).optional(),
|
|
4042
|
-
order:
|
|
4043
|
-
by:
|
|
4044
|
-
direction:
|
|
4416
|
+
order: z94.object({
|
|
4417
|
+
by: z94.enum(["createdAt", "fileName", "fileSize"]),
|
|
4418
|
+
direction: z94.enum(["asc", "desc"])
|
|
4045
4419
|
}).optional(),
|
|
4046
|
-
options:
|
|
4047
|
-
includeShared:
|
|
4420
|
+
options: z94.object({
|
|
4421
|
+
includeShared: z94.coerce.boolean().optional()
|
|
4048
4422
|
}).optional()
|
|
4049
4423
|
});
|
|
4050
4424
|
|
|
4051
4425
|
// ../../b4m-core/packages/services/dist/src/fabFileService/addFavorite.js
|
|
4052
|
-
import { z as
|
|
4053
|
-
var addFavoriteParametersSchema3 =
|
|
4054
|
-
fileId:
|
|
4426
|
+
import { z as z95 } from "zod";
|
|
4427
|
+
var addFavoriteParametersSchema3 = z95.object({
|
|
4428
|
+
fileId: z95.string()
|
|
4055
4429
|
});
|
|
4056
4430
|
|
|
4057
4431
|
// ../../b4m-core/packages/services/dist/src/fabFileService/deleteFavorite.js
|
|
4058
|
-
import { z as
|
|
4059
|
-
var deleteFavoriteParametersSchema4 =
|
|
4060
|
-
fileId:
|
|
4432
|
+
import { z as z96 } from "zod";
|
|
4433
|
+
var deleteFavoriteParametersSchema4 = z96.object({
|
|
4434
|
+
fileId: z96.string()
|
|
4061
4435
|
});
|
|
4062
4436
|
|
|
4063
4437
|
// ../../b4m-core/packages/services/dist/src/fabFileService/toggleTags.js
|
|
4064
|
-
import { z as
|
|
4065
|
-
var fabFileToggleTagsSchema =
|
|
4066
|
-
ids:
|
|
4067
|
-
tags:
|
|
4438
|
+
import { z as z97 } from "zod";
|
|
4439
|
+
var fabFileToggleTagsSchema = z97.object({
|
|
4440
|
+
ids: z97.array(z97.string()),
|
|
4441
|
+
tags: z97.array(z97.string())
|
|
4068
4442
|
});
|
|
4069
4443
|
|
|
4070
4444
|
// ../../b4m-core/packages/services/dist/src/fabFileService/edit.js
|
|
4071
|
-
import { z as
|
|
4445
|
+
import { z as z98 } from "zod";
|
|
4072
4446
|
import { diffLines } from "diff";
|
|
4073
|
-
var editFabFileSchema =
|
|
4074
|
-
id:
|
|
4075
|
-
instruction:
|
|
4076
|
-
selection:
|
|
4077
|
-
start:
|
|
4078
|
-
end:
|
|
4447
|
+
var editFabFileSchema = z98.object({
|
|
4448
|
+
id: z98.string(),
|
|
4449
|
+
instruction: z98.string(),
|
|
4450
|
+
selection: z98.object({
|
|
4451
|
+
start: z98.number(),
|
|
4452
|
+
end: z98.number()
|
|
4079
4453
|
}).optional(),
|
|
4080
|
-
preserveFormatting:
|
|
4081
|
-
applyImmediately:
|
|
4454
|
+
preserveFormatting: z98.boolean().optional().default(true),
|
|
4455
|
+
applyImmediately: z98.boolean().optional().default(false)
|
|
4082
4456
|
});
|
|
4083
4457
|
|
|
4084
4458
|
// ../../b4m-core/packages/services/dist/src/fabFileService/applyEdit.js
|
|
4085
4459
|
import mime2 from "mime-types";
|
|
4086
4460
|
import { v4 as uuidv43 } from "uuid";
|
|
4087
|
-
import { z as
|
|
4088
|
-
var applyEditSchema =
|
|
4089
|
-
id:
|
|
4090
|
-
modifiedContent:
|
|
4091
|
-
createBackup:
|
|
4461
|
+
import { z as z99 } from "zod";
|
|
4462
|
+
var applyEditSchema = z99.object({
|
|
4463
|
+
id: z99.string(),
|
|
4464
|
+
modifiedContent: z99.string(),
|
|
4465
|
+
createBackup: z99.boolean().optional().default(true)
|
|
4092
4466
|
});
|
|
4093
4467
|
|
|
4094
4468
|
// ../../b4m-core/packages/services/dist/src/friendshipService/respondToFriendRequest.js
|
|
4095
|
-
import { z as
|
|
4096
|
-
var respondToFriendRequestSchema =
|
|
4097
|
-
id:
|
|
4469
|
+
import { z as z100 } from "zod";
|
|
4470
|
+
var respondToFriendRequestSchema = z100.object({
|
|
4471
|
+
id: z100.string(),
|
|
4098
4472
|
/** The user ID of the recipient of the friend request */
|
|
4099
|
-
userId:
|
|
4100
|
-
accept:
|
|
4473
|
+
userId: z100.string(),
|
|
4474
|
+
accept: z100.boolean()
|
|
4101
4475
|
});
|
|
4102
4476
|
|
|
4103
4477
|
// ../../b4m-core/packages/services/dist/src/friendshipService/unfriend.js
|
|
4104
|
-
import { z as
|
|
4105
|
-
var unfriendSchema =
|
|
4106
|
-
friendshipId:
|
|
4478
|
+
import { z as z101 } from "zod";
|
|
4479
|
+
var unfriendSchema = z101.object({
|
|
4480
|
+
friendshipId: z101.string(),
|
|
4107
4481
|
/** The user ID of the user who wants to unfriend the other user */
|
|
4108
|
-
userId:
|
|
4482
|
+
userId: z101.string()
|
|
4109
4483
|
});
|
|
4110
4484
|
|
|
4111
4485
|
// ../../b4m-core/packages/services/dist/src/friendshipService/list.js
|
|
4112
|
-
import { z as
|
|
4113
|
-
var listFriendsSchema =
|
|
4114
|
-
userId:
|
|
4486
|
+
import { z as z102 } from "zod";
|
|
4487
|
+
var listFriendsSchema = z102.object({
|
|
4488
|
+
userId: z102.string()
|
|
4115
4489
|
});
|
|
4116
|
-
var listPendingFriendRequestsSchema =
|
|
4117
|
-
userId:
|
|
4490
|
+
var listPendingFriendRequestsSchema = z102.object({
|
|
4491
|
+
userId: z102.string()
|
|
4118
4492
|
});
|
|
4119
4493
|
|
|
4120
4494
|
// ../../b4m-core/packages/services/dist/src/adminService/loginAs.js
|
|
4121
|
-
import { z as
|
|
4122
|
-
var loginAsSchema =
|
|
4123
|
-
targetUserId:
|
|
4495
|
+
import { z as z103 } from "zod";
|
|
4496
|
+
var loginAsSchema = z103.object({
|
|
4497
|
+
targetUserId: z103.string()
|
|
4124
4498
|
});
|
|
4125
4499
|
|
|
4126
4500
|
// ../../b4m-core/packages/services/dist/src/cacheService/get.js
|
|
4127
|
-
import { z as
|
|
4128
|
-
var getParamsSchema =
|
|
4129
|
-
key:
|
|
4501
|
+
import { z as z104 } from "zod";
|
|
4502
|
+
var getParamsSchema = z104.object({
|
|
4503
|
+
key: z104.string()
|
|
4130
4504
|
});
|
|
4131
4505
|
|
|
4132
4506
|
// ../../b4m-core/packages/services/dist/src/cacheService/set.js
|
|
4133
|
-
import { z as
|
|
4134
|
-
var setParamsSchema =
|
|
4135
|
-
key:
|
|
4136
|
-
value:
|
|
4507
|
+
import { z as z105 } from "zod";
|
|
4508
|
+
var setParamsSchema = z105.object({
|
|
4509
|
+
key: z105.string(),
|
|
4510
|
+
value: z105.any(),
|
|
4137
4511
|
/**
|
|
4138
4512
|
* Time to live in milliseconds
|
|
4139
4513
|
*/
|
|
4140
|
-
ttl:
|
|
4141
|
-
recache:
|
|
4514
|
+
ttl: z105.number(),
|
|
4515
|
+
recache: z105.boolean().optional()
|
|
4142
4516
|
});
|
|
4143
4517
|
|
|
4144
4518
|
// ../../b4m-core/packages/services/dist/src/cacheService/ttl.js
|
|
4145
|
-
import { z as
|
|
4146
|
-
var ttlParamsSchema =
|
|
4147
|
-
key:
|
|
4519
|
+
import { z as z106 } from "zod";
|
|
4520
|
+
var ttlParamsSchema = z106.object({
|
|
4521
|
+
key: z106.string()
|
|
4148
4522
|
});
|
|
4149
4523
|
|
|
4150
4524
|
// ../../b4m-core/packages/services/dist/src/cacheService/weeklyReports.js
|
|
4151
|
-
import { z as
|
|
4525
|
+
import { z as z107 } from "zod";
|
|
4152
4526
|
import dayjs3 from "dayjs";
|
|
4153
|
-
var weeklyReportSchema =
|
|
4154
|
-
startDate:
|
|
4155
|
-
endDate:
|
|
4156
|
-
report:
|
|
4157
|
-
aiInsights:
|
|
4527
|
+
var weeklyReportSchema = z107.object({
|
|
4528
|
+
startDate: z107.string(),
|
|
4529
|
+
endDate: z107.string(),
|
|
4530
|
+
report: z107.string(),
|
|
4531
|
+
aiInsights: z107.string().nullable()
|
|
4158
4532
|
});
|
|
4159
4533
|
|
|
4160
4534
|
// ../../b4m-core/packages/services/dist/src/embeddingCacheService/generateCacheKey.js
|
|
4161
4535
|
import crypto2 from "crypto";
|
|
4162
4536
|
|
|
4163
4537
|
// ../../b4m-core/packages/services/dist/src/researchAgentService/create.js
|
|
4164
|
-
import { z as z107 } from "zod";
|
|
4165
|
-
var researchAgentCreateSchema = z107.object({
|
|
4166
|
-
name: z107.string().min(1),
|
|
4167
|
-
description: z107.string().min(1)
|
|
4168
|
-
});
|
|
4169
|
-
|
|
4170
|
-
// ../../b4m-core/packages/services/dist/src/researchAgentService/update.js
|
|
4171
4538
|
import { z as z108 } from "zod";
|
|
4172
|
-
var
|
|
4173
|
-
id: z108.string(),
|
|
4539
|
+
var researchAgentCreateSchema = z108.object({
|
|
4174
4540
|
name: z108.string().min(1),
|
|
4175
4541
|
description: z108.string().min(1)
|
|
4176
4542
|
});
|
|
4177
4543
|
|
|
4178
|
-
// ../../b4m-core/packages/services/dist/src/researchAgentService/
|
|
4544
|
+
// ../../b4m-core/packages/services/dist/src/researchAgentService/update.js
|
|
4179
4545
|
import { z as z109 } from "zod";
|
|
4180
|
-
var
|
|
4181
|
-
id: z109.string()
|
|
4546
|
+
var researchAgentUpdateSchema = z109.object({
|
|
4547
|
+
id: z109.string(),
|
|
4548
|
+
name: z109.string().min(1),
|
|
4549
|
+
description: z109.string().min(1)
|
|
4182
4550
|
});
|
|
4183
4551
|
|
|
4184
|
-
// ../../b4m-core/packages/services/dist/src/researchAgentService/
|
|
4552
|
+
// ../../b4m-core/packages/services/dist/src/researchAgentService/remove.js
|
|
4185
4553
|
import { z as z110 } from "zod";
|
|
4186
|
-
var
|
|
4554
|
+
var researchAgentRemoveSchema = z110.object({
|
|
4187
4555
|
id: z110.string()
|
|
4188
4556
|
});
|
|
4189
4557
|
|
|
4190
|
-
// ../../b4m-core/packages/services/dist/src/researchAgentService/
|
|
4558
|
+
// ../../b4m-core/packages/services/dist/src/researchAgentService/get.js
|
|
4191
4559
|
import { z as z111 } from "zod";
|
|
4192
|
-
var
|
|
4560
|
+
var researchAgentGetSchema = z111.object({
|
|
4561
|
+
id: z111.string()
|
|
4562
|
+
});
|
|
4563
|
+
|
|
4564
|
+
// ../../b4m-core/packages/services/dist/src/researchAgentService/listFiles.js
|
|
4565
|
+
import { z as z112 } from "zod";
|
|
4566
|
+
var researchAgentListFilesSchema = z112.object({
|
|
4193
4567
|
/**
|
|
4194
4568
|
* The ID of the research agent
|
|
4195
4569
|
*/
|
|
4196
|
-
id:
|
|
4570
|
+
id: z112.string()
|
|
4197
4571
|
});
|
|
4198
4572
|
|
|
4199
4573
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/process.js
|
|
4200
|
-
import { z as
|
|
4574
|
+
import { z as z113 } from "zod";
|
|
4201
4575
|
|
|
4202
4576
|
// ../../b4m-core/packages/services/dist/src/lib/turndown.js
|
|
4203
4577
|
import turndown from "turndown";
|
|
@@ -4588,316 +4962,316 @@ var deepResearchTool = {
|
|
|
4588
4962
|
};
|
|
4589
4963
|
|
|
4590
4964
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/process.js
|
|
4591
|
-
var ResearchTaskProcessSchema =
|
|
4592
|
-
id:
|
|
4965
|
+
var ResearchTaskProcessSchema = z113.object({
|
|
4966
|
+
id: z113.string()
|
|
4593
4967
|
});
|
|
4594
4968
|
|
|
4595
4969
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/create.js
|
|
4596
|
-
import { z as
|
|
4597
|
-
var researchTaskCreateSchema =
|
|
4598
|
-
researchAgentId:
|
|
4599
|
-
title:
|
|
4600
|
-
description:
|
|
4601
|
-
prompt:
|
|
4602
|
-
type:
|
|
4603
|
-
executionType:
|
|
4604
|
-
fileTagId:
|
|
4605
|
-
autoGeneratedTag:
|
|
4606
|
-
name:
|
|
4607
|
-
icon:
|
|
4608
|
-
color:
|
|
4970
|
+
import { z as z114 } from "zod";
|
|
4971
|
+
var researchTaskCreateSchema = z114.object({
|
|
4972
|
+
researchAgentId: z114.string(),
|
|
4973
|
+
title: z114.string().max(100),
|
|
4974
|
+
description: z114.string().max(500),
|
|
4975
|
+
prompt: z114.string().max(500).optional(),
|
|
4976
|
+
type: z114.nativeEnum(ResearchTaskType),
|
|
4977
|
+
executionType: z114.nativeEnum(ResearchTaskExecutionType).default(ResearchTaskExecutionType.ON_DEMAND),
|
|
4978
|
+
fileTagId: z114.string().optional(),
|
|
4979
|
+
autoGeneratedTag: z114.object({
|
|
4980
|
+
name: z114.string(),
|
|
4981
|
+
icon: z114.string(),
|
|
4982
|
+
color: z114.string()
|
|
4609
4983
|
}).optional()
|
|
4610
4984
|
});
|
|
4611
4985
|
var researchTaskScrapeCreateSchema = researchTaskCreateSchema.extend({
|
|
4612
|
-
urls:
|
|
4613
|
-
canDiscoverLinks:
|
|
4986
|
+
urls: z114.array(z114.string().url()).min(1),
|
|
4987
|
+
canDiscoverLinks: z114.boolean()
|
|
4614
4988
|
});
|
|
4615
4989
|
var researchTaskPeriodicCreateSchema = researchTaskCreateSchema.extend({
|
|
4616
|
-
executionPeriodicStartAt:
|
|
4617
|
-
executionPeriodicEndAt:
|
|
4618
|
-
executionPeriodicFrequency:
|
|
4990
|
+
executionPeriodicStartAt: z114.coerce.date(),
|
|
4991
|
+
executionPeriodicEndAt: z114.coerce.date(),
|
|
4992
|
+
executionPeriodicFrequency: z114.nativeEnum(ResearchTaskPeriodicFrequencyType)
|
|
4619
4993
|
});
|
|
4620
4994
|
var researchTaskScheduledCreateSchema = researchTaskCreateSchema.extend({
|
|
4621
|
-
executionScheduledAt:
|
|
4995
|
+
executionScheduledAt: z114.coerce.date()
|
|
4622
4996
|
});
|
|
4623
4997
|
var researchTaskDeepResearchCreateSchema = researchTaskCreateSchema.extend({
|
|
4624
|
-
maxDepth:
|
|
4998
|
+
maxDepth: z114.number().min(1).max(10).optional()
|
|
4625
4999
|
});
|
|
4626
5000
|
|
|
4627
5001
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/search.js
|
|
4628
|
-
import { z as
|
|
4629
|
-
var searchResearchTasksSchema =
|
|
4630
|
-
search:
|
|
5002
|
+
import { z as z115 } from "zod";
|
|
5003
|
+
var searchResearchTasksSchema = z115.object({
|
|
5004
|
+
search: z115.string().optional(),
|
|
4631
5005
|
// ADD FILTERS SCHEMA HERE
|
|
4632
5006
|
// filters: z
|
|
4633
5007
|
// .object({
|
|
4634
5008
|
// userId: z.string().optional(),
|
|
4635
5009
|
// })
|
|
4636
5010
|
// .optional(),
|
|
4637
|
-
pagination:
|
|
4638
|
-
page:
|
|
4639
|
-
limit:
|
|
5011
|
+
pagination: z115.object({
|
|
5012
|
+
page: z115.coerce.number().optional(),
|
|
5013
|
+
limit: z115.coerce.number().optional()
|
|
4640
5014
|
}).optional(),
|
|
4641
|
-
orderBy:
|
|
4642
|
-
by:
|
|
4643
|
-
direction:
|
|
5015
|
+
orderBy: z115.object({
|
|
5016
|
+
by: z115.enum(["createdAt", "updatedAt"]).optional(),
|
|
5017
|
+
direction: z115.enum(["asc", "desc"]).optional()
|
|
4644
5018
|
}).optional()
|
|
4645
5019
|
});
|
|
4646
5020
|
|
|
4647
5021
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/get.js
|
|
4648
|
-
import { z as
|
|
4649
|
-
var getResearchTaskSchema =
|
|
4650
|
-
id:
|
|
5022
|
+
import { z as z116 } from "zod";
|
|
5023
|
+
var getResearchTaskSchema = z116.object({
|
|
5024
|
+
id: z116.string().min(1)
|
|
4651
5025
|
});
|
|
4652
5026
|
|
|
4653
5027
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/update.js
|
|
4654
|
-
import { z as
|
|
4655
|
-
var updateResearchTaskSchema =
|
|
4656
|
-
id:
|
|
4657
|
-
title:
|
|
4658
|
-
description:
|
|
4659
|
-
type:
|
|
5028
|
+
import { z as z117 } from "zod";
|
|
5029
|
+
var updateResearchTaskSchema = z117.object({
|
|
5030
|
+
id: z117.string(),
|
|
5031
|
+
title: z117.string(),
|
|
5032
|
+
description: z117.string(),
|
|
5033
|
+
type: z117.nativeEnum(ResearchTaskType)
|
|
4660
5034
|
});
|
|
4661
5035
|
var researchTaskScrapeUpdateSchema = updateResearchTaskSchema.extend({
|
|
4662
|
-
urls:
|
|
4663
|
-
canDiscoverLinks:
|
|
5036
|
+
urls: z117.array(z117.string().url()).min(1),
|
|
5037
|
+
canDiscoverLinks: z117.boolean()
|
|
4664
5038
|
});
|
|
4665
5039
|
|
|
4666
5040
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/listByAgentId.js
|
|
4667
|
-
import { z as
|
|
4668
|
-
var listByAgentIdSchema =
|
|
4669
|
-
researchAgentId:
|
|
5041
|
+
import { z as z118 } from "zod";
|
|
5042
|
+
var listByAgentIdSchema = z118.object({
|
|
5043
|
+
researchAgentId: z118.string()
|
|
4670
5044
|
});
|
|
4671
5045
|
|
|
4672
5046
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/remove.js
|
|
4673
|
-
import { z as
|
|
4674
|
-
var researchTaskRemoveSchema =
|
|
4675
|
-
id:
|
|
5047
|
+
import { z as z119 } from "zod";
|
|
5048
|
+
var researchTaskRemoveSchema = z119.object({
|
|
5049
|
+
id: z119.string().min(1)
|
|
4676
5050
|
});
|
|
4677
5051
|
|
|
4678
5052
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/retry.js
|
|
4679
|
-
import { z as
|
|
4680
|
-
var researchTaskRetrySchema =
|
|
4681
|
-
id:
|
|
4682
|
-
userId:
|
|
5053
|
+
import { z as z120 } from "zod";
|
|
5054
|
+
var researchTaskRetrySchema = z120.object({
|
|
5055
|
+
id: z120.string(),
|
|
5056
|
+
userId: z120.string()
|
|
4683
5057
|
});
|
|
4684
5058
|
|
|
4685
5059
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/processDiscoveredLinks.js
|
|
4686
5060
|
import axios4 from "axios";
|
|
4687
|
-
import { z as
|
|
5061
|
+
import { z as z121 } from "zod";
|
|
4688
5062
|
import plimit from "p-limit";
|
|
4689
5063
|
import pLimit2 from "p-limit";
|
|
4690
|
-
var researchTaskProcessDiscoveredLinksSchema =
|
|
4691
|
-
id:
|
|
5064
|
+
var researchTaskProcessDiscoveredLinksSchema = z121.object({
|
|
5065
|
+
id: z121.string()
|
|
4692
5066
|
});
|
|
4693
5067
|
|
|
4694
5068
|
// ../../b4m-core/packages/services/dist/src/researchTaskService/downloadRelevantLinks.js
|
|
4695
|
-
import { z as
|
|
5069
|
+
import { z as z122 } from "zod";
|
|
4696
5070
|
import plimit2 from "p-limit";
|
|
4697
5071
|
import axios5 from "axios";
|
|
4698
5072
|
import { fileTypeFromBuffer } from "file-type";
|
|
4699
|
-
var researchTaskDownloadRelevantLinksSchema =
|
|
4700
|
-
id:
|
|
5073
|
+
var researchTaskDownloadRelevantLinksSchema = z122.object({
|
|
5074
|
+
id: z122.string()
|
|
4701
5075
|
});
|
|
4702
5076
|
|
|
4703
5077
|
// ../../b4m-core/packages/services/dist/src/researchData/remove.js
|
|
4704
|
-
import { z as
|
|
4705
|
-
var researchDataRemoveSchema =
|
|
4706
|
-
id:
|
|
4707
|
-
researchAgentId:
|
|
5078
|
+
import { z as z123 } from "zod";
|
|
5079
|
+
var researchDataRemoveSchema = z123.object({
|
|
5080
|
+
id: z123.string(),
|
|
5081
|
+
researchAgentId: z123.string()
|
|
4708
5082
|
});
|
|
4709
5083
|
|
|
4710
5084
|
// ../../b4m-core/packages/services/dist/src/taskSchedulerService/create.js
|
|
4711
|
-
import { z as
|
|
4712
|
-
var researchTaskPayload =
|
|
4713
|
-
id:
|
|
4714
|
-
userId:
|
|
5085
|
+
import { z as z124 } from "zod";
|
|
5086
|
+
var researchTaskPayload = z124.object({
|
|
5087
|
+
id: z124.string(),
|
|
5088
|
+
userId: z124.string()
|
|
4715
5089
|
});
|
|
4716
|
-
var customTaskPayload =
|
|
4717
|
-
test:
|
|
5090
|
+
var customTaskPayload = z124.object({
|
|
5091
|
+
test: z124.string()
|
|
4718
5092
|
});
|
|
4719
|
-
var taskSchedulerCreate =
|
|
4720
|
-
|
|
4721
|
-
handler:
|
|
5093
|
+
var taskSchedulerCreate = z124.discriminatedUnion("handler", [
|
|
5094
|
+
z124.object({
|
|
5095
|
+
handler: z124.literal(TaskScheduleHandler.RESEARCH_TASK_PROCESS),
|
|
4722
5096
|
payload: researchTaskPayload,
|
|
4723
|
-
processDate:
|
|
5097
|
+
processDate: z124.date()
|
|
4724
5098
|
}),
|
|
4725
|
-
|
|
4726
|
-
handler:
|
|
5099
|
+
z124.object({
|
|
5100
|
+
handler: z124.literal(TaskScheduleHandler.CUSTOM_TASK_PROCESS),
|
|
4727
5101
|
payload: customTaskPayload,
|
|
4728
|
-
processDate:
|
|
5102
|
+
processDate: z124.date()
|
|
4729
5103
|
})
|
|
4730
5104
|
]);
|
|
4731
5105
|
|
|
4732
5106
|
// ../../b4m-core/packages/services/dist/src/tagService/createFileTag.js
|
|
4733
|
-
import { z as z124 } from "zod";
|
|
4734
|
-
var tagCreateFileTagSchema = z124.object({
|
|
4735
|
-
name: z124.string(),
|
|
4736
|
-
icon: z124.string().optional(),
|
|
4737
|
-
color: z124.string().optional(),
|
|
4738
|
-
description: z124.string().optional()
|
|
4739
|
-
});
|
|
4740
|
-
|
|
4741
|
-
// ../../b4m-core/packages/services/dist/src/tagService/create.js
|
|
4742
5107
|
import { z as z125 } from "zod";
|
|
4743
|
-
var
|
|
5108
|
+
var tagCreateFileTagSchema = z125.object({
|
|
4744
5109
|
name: z125.string(),
|
|
4745
5110
|
icon: z125.string().optional(),
|
|
4746
|
-
description: z125.string().optional(),
|
|
4747
5111
|
color: z125.string().optional(),
|
|
4748
|
-
|
|
5112
|
+
description: z125.string().optional()
|
|
4749
5113
|
});
|
|
4750
5114
|
|
|
4751
|
-
// ../../b4m-core/packages/services/dist/src/tagService/
|
|
5115
|
+
// ../../b4m-core/packages/services/dist/src/tagService/create.js
|
|
4752
5116
|
import { z as z126 } from "zod";
|
|
4753
|
-
var
|
|
4754
|
-
|
|
4755
|
-
name: z126.string().optional(),
|
|
5117
|
+
var tagCreateSchema = z126.object({
|
|
5118
|
+
name: z126.string(),
|
|
4756
5119
|
icon: z126.string().optional(),
|
|
4757
5120
|
description: z126.string().optional(),
|
|
4758
|
-
color: z126.string().optional()
|
|
5121
|
+
color: z126.string().optional(),
|
|
5122
|
+
type: z126.nativeEnum(TagType)
|
|
4759
5123
|
});
|
|
4760
5124
|
|
|
4761
|
-
// ../../b4m-core/packages/services/dist/src/tagService/
|
|
5125
|
+
// ../../b4m-core/packages/services/dist/src/tagService/update.js
|
|
4762
5126
|
import { z as z127 } from "zod";
|
|
4763
|
-
var
|
|
4764
|
-
id: z127.string()
|
|
5127
|
+
var tagUpdateSchema = z127.object({
|
|
5128
|
+
id: z127.string(),
|
|
5129
|
+
name: z127.string().optional(),
|
|
5130
|
+
icon: z127.string().optional(),
|
|
5131
|
+
description: z127.string().optional(),
|
|
5132
|
+
color: z127.string().optional()
|
|
4765
5133
|
});
|
|
4766
5134
|
|
|
4767
|
-
// ../../b4m-core/packages/services/dist/src/
|
|
5135
|
+
// ../../b4m-core/packages/services/dist/src/tagService/remove.js
|
|
4768
5136
|
import { z as z128 } from "zod";
|
|
4769
|
-
var
|
|
4770
|
-
id: z128.string()
|
|
5137
|
+
var tagRemoveSchema = z128.object({
|
|
5138
|
+
id: z128.string()
|
|
5139
|
+
});
|
|
5140
|
+
|
|
5141
|
+
// ../../b4m-core/packages/services/dist/src/artifactService/create.js
|
|
5142
|
+
import { z as z129 } from "zod";
|
|
5143
|
+
var createArtifactSchema = z129.object({
|
|
5144
|
+
id: z129.string().optional(),
|
|
4771
5145
|
// Allow custom ID for AI-generated artifacts
|
|
4772
|
-
type:
|
|
4773
|
-
title:
|
|
4774
|
-
description:
|
|
4775
|
-
content:
|
|
4776
|
-
projectId:
|
|
4777
|
-
organizationId:
|
|
4778
|
-
visibility:
|
|
4779
|
-
tags:
|
|
4780
|
-
versionTag:
|
|
4781
|
-
sourceQuestId:
|
|
4782
|
-
sessionId:
|
|
4783
|
-
parentArtifactId:
|
|
4784
|
-
permissions:
|
|
4785
|
-
canRead:
|
|
4786
|
-
canWrite:
|
|
4787
|
-
canDelete:
|
|
4788
|
-
isPublic:
|
|
4789
|
-
inheritFromProject:
|
|
5146
|
+
type: z129.enum(["mermaid", "recharts", "python", "react", "html", "svg", "code", "quest", "file", "questmaster"]),
|
|
5147
|
+
title: z129.string().min(1).max(255),
|
|
5148
|
+
description: z129.string().max(1e3).optional(),
|
|
5149
|
+
content: z129.string().min(1),
|
|
5150
|
+
projectId: z129.string().optional(),
|
|
5151
|
+
organizationId: z129.string().optional(),
|
|
5152
|
+
visibility: z129.enum(["private", "project", "organization", "public"]).default("private"),
|
|
5153
|
+
tags: z129.array(z129.string().max(50)).max(20).default([]),
|
|
5154
|
+
versionTag: z129.string().max(100).optional(),
|
|
5155
|
+
sourceQuestId: z129.string().optional(),
|
|
5156
|
+
sessionId: z129.string().optional(),
|
|
5157
|
+
parentArtifactId: z129.string().optional(),
|
|
5158
|
+
permissions: z129.object({
|
|
5159
|
+
canRead: z129.array(z129.string()).default([]),
|
|
5160
|
+
canWrite: z129.array(z129.string()).default([]),
|
|
5161
|
+
canDelete: z129.array(z129.string()).default([]),
|
|
5162
|
+
isPublic: z129.boolean().default(false),
|
|
5163
|
+
inheritFromProject: z129.boolean().default(true)
|
|
4790
5164
|
}).optional(),
|
|
4791
|
-
metadata:
|
|
5165
|
+
metadata: z129.record(z129.unknown()).default({})
|
|
4792
5166
|
});
|
|
4793
5167
|
|
|
4794
5168
|
// ../../b4m-core/packages/services/dist/src/artifactService/get.js
|
|
4795
|
-
import { z as
|
|
4796
|
-
var getArtifactSchema =
|
|
4797
|
-
id:
|
|
4798
|
-
includeContent:
|
|
4799
|
-
includeVersions:
|
|
4800
|
-
version:
|
|
5169
|
+
import { z as z130 } from "zod";
|
|
5170
|
+
var getArtifactSchema = z130.object({
|
|
5171
|
+
id: z130.string(),
|
|
5172
|
+
includeContent: z130.boolean().default(false),
|
|
5173
|
+
includeVersions: z130.boolean().default(false),
|
|
5174
|
+
version: z130.number().optional()
|
|
4801
5175
|
});
|
|
4802
5176
|
|
|
4803
5177
|
// ../../b4m-core/packages/services/dist/src/artifactService/list.js
|
|
4804
|
-
import { z as
|
|
4805
|
-
var listArtifactsSchema =
|
|
4806
|
-
type:
|
|
4807
|
-
status:
|
|
4808
|
-
visibility:
|
|
4809
|
-
projectId:
|
|
4810
|
-
sessionId:
|
|
4811
|
-
tags:
|
|
4812
|
-
search:
|
|
4813
|
-
limit:
|
|
4814
|
-
offset:
|
|
4815
|
-
sortBy:
|
|
4816
|
-
sortOrder:
|
|
4817
|
-
includeDeleted:
|
|
5178
|
+
import { z as z131 } from "zod";
|
|
5179
|
+
var listArtifactsSchema = z131.object({
|
|
5180
|
+
type: z131.string().optional(),
|
|
5181
|
+
status: z131.enum(["draft", "review", "published", "archived"]).optional(),
|
|
5182
|
+
visibility: z131.enum(["private", "project", "organization", "public"]).optional(),
|
|
5183
|
+
projectId: z131.string().optional(),
|
|
5184
|
+
sessionId: z131.string().optional(),
|
|
5185
|
+
tags: z131.array(z131.string()).optional(),
|
|
5186
|
+
search: z131.string().optional(),
|
|
5187
|
+
limit: z131.number().min(1).max(100).default(20),
|
|
5188
|
+
offset: z131.number().min(0).default(0),
|
|
5189
|
+
sortBy: z131.enum(["createdAt", "updatedAt", "title", "type"]).default("updatedAt"),
|
|
5190
|
+
sortOrder: z131.enum(["asc", "desc"]).default("desc"),
|
|
5191
|
+
includeDeleted: z131.boolean().default(false)
|
|
4818
5192
|
});
|
|
4819
5193
|
|
|
4820
5194
|
// ../../b4m-core/packages/services/dist/src/artifactService/update.js
|
|
4821
|
-
import { z as
|
|
4822
|
-
var updateArtifactSchema =
|
|
4823
|
-
id:
|
|
4824
|
-
title:
|
|
4825
|
-
description:
|
|
4826
|
-
content:
|
|
4827
|
-
visibility:
|
|
4828
|
-
status:
|
|
4829
|
-
tags:
|
|
4830
|
-
versionTag:
|
|
4831
|
-
permissions:
|
|
4832
|
-
canRead:
|
|
4833
|
-
canWrite:
|
|
4834
|
-
canDelete:
|
|
4835
|
-
isPublic:
|
|
4836
|
-
inheritFromProject:
|
|
5195
|
+
import { z as z132 } from "zod";
|
|
5196
|
+
var updateArtifactSchema = z132.object({
|
|
5197
|
+
id: z132.string(),
|
|
5198
|
+
title: z132.string().min(1).max(255).optional(),
|
|
5199
|
+
description: z132.string().max(1e3).optional(),
|
|
5200
|
+
content: z132.string().optional(),
|
|
5201
|
+
visibility: z132.enum(["private", "project", "organization", "public"]).optional(),
|
|
5202
|
+
status: z132.enum(["draft", "review", "published", "archived"]).optional(),
|
|
5203
|
+
tags: z132.array(z132.string().max(50)).max(20).optional(),
|
|
5204
|
+
versionTag: z132.string().max(100).optional(),
|
|
5205
|
+
permissions: z132.object({
|
|
5206
|
+
canRead: z132.array(z132.string()).optional(),
|
|
5207
|
+
canWrite: z132.array(z132.string()).optional(),
|
|
5208
|
+
canDelete: z132.array(z132.string()).optional(),
|
|
5209
|
+
isPublic: z132.boolean().optional(),
|
|
5210
|
+
inheritFromProject: z132.boolean().optional()
|
|
4837
5211
|
}).optional(),
|
|
4838
|
-
metadata:
|
|
4839
|
-
changes:
|
|
4840
|
-
changeDescription:
|
|
4841
|
-
createNewVersion:
|
|
4842
|
-
versionMessage:
|
|
5212
|
+
metadata: z132.record(z132.unknown()).optional(),
|
|
5213
|
+
changes: z132.array(z132.string()).optional(),
|
|
5214
|
+
changeDescription: z132.string().max(1e3).optional(),
|
|
5215
|
+
createNewVersion: z132.boolean().optional(),
|
|
5216
|
+
versionMessage: z132.string().max(500).optional()
|
|
4843
5217
|
});
|
|
4844
5218
|
|
|
4845
5219
|
// ../../b4m-core/packages/services/dist/src/artifactService/delete.js
|
|
4846
|
-
import { z as
|
|
4847
|
-
var deleteArtifactSchema =
|
|
4848
|
-
id:
|
|
4849
|
-
hardDelete:
|
|
5220
|
+
import { z as z133 } from "zod";
|
|
5221
|
+
var deleteArtifactSchema = z133.object({
|
|
5222
|
+
id: z133.string(),
|
|
5223
|
+
hardDelete: z133.boolean().default(false)
|
|
4850
5224
|
// For future implementation
|
|
4851
5225
|
});
|
|
4852
5226
|
|
|
4853
5227
|
// ../../b4m-core/packages/services/dist/src/questMasterService/create.js
|
|
4854
|
-
import { z as
|
|
4855
|
-
var questSchema =
|
|
4856
|
-
id:
|
|
4857
|
-
title:
|
|
4858
|
-
description:
|
|
4859
|
-
status:
|
|
4860
|
-
order:
|
|
4861
|
-
dependencies:
|
|
4862
|
-
estimatedTime:
|
|
4863
|
-
});
|
|
4864
|
-
var questResourceSchema =
|
|
4865
|
-
title:
|
|
4866
|
-
url:
|
|
4867
|
-
type:
|
|
4868
|
-
});
|
|
4869
|
-
var createQuestMasterSchema =
|
|
4870
|
-
title:
|
|
4871
|
-
description:
|
|
4872
|
-
goal:
|
|
4873
|
-
complexity:
|
|
4874
|
-
estimatedTotalTime:
|
|
4875
|
-
prerequisites:
|
|
4876
|
-
quests:
|
|
4877
|
-
resources:
|
|
4878
|
-
projectId:
|
|
4879
|
-
organizationId:
|
|
4880
|
-
visibility:
|
|
4881
|
-
tags:
|
|
4882
|
-
permissions:
|
|
4883
|
-
canRead:
|
|
4884
|
-
canWrite:
|
|
4885
|
-
canDelete:
|
|
4886
|
-
isPublic:
|
|
4887
|
-
inheritFromProject:
|
|
5228
|
+
import { z as z134 } from "zod";
|
|
5229
|
+
var questSchema = z134.object({
|
|
5230
|
+
id: z134.string(),
|
|
5231
|
+
title: z134.string().min(1).max(255),
|
|
5232
|
+
description: z134.string().max(1e3),
|
|
5233
|
+
status: z134.enum(["not_started", "in_progress", "completed", "blocked"]).default("not_started"),
|
|
5234
|
+
order: z134.number().min(0),
|
|
5235
|
+
dependencies: z134.array(z134.string()).default([]),
|
|
5236
|
+
estimatedTime: z134.string().optional()
|
|
5237
|
+
});
|
|
5238
|
+
var questResourceSchema = z134.object({
|
|
5239
|
+
title: z134.string().min(1).max(255),
|
|
5240
|
+
url: z134.string().url(),
|
|
5241
|
+
type: z134.enum(["documentation", "tutorial", "reference", "example"])
|
|
5242
|
+
});
|
|
5243
|
+
var createQuestMasterSchema = z134.object({
|
|
5244
|
+
title: z134.string().min(1).max(255),
|
|
5245
|
+
description: z134.string().max(1e3).optional(),
|
|
5246
|
+
goal: z134.string().min(1).max(1e3),
|
|
5247
|
+
complexity: z134.enum(["beginner", "intermediate", "advanced", "expert"]),
|
|
5248
|
+
estimatedTotalTime: z134.string().optional(),
|
|
5249
|
+
prerequisites: z134.array(z134.string().max(200)).default([]),
|
|
5250
|
+
quests: z134.array(questSchema).min(1),
|
|
5251
|
+
resources: z134.array(questResourceSchema).default([]),
|
|
5252
|
+
projectId: z134.string().optional(),
|
|
5253
|
+
organizationId: z134.string().optional(),
|
|
5254
|
+
visibility: z134.enum(["private", "project", "organization", "public"]).default("private"),
|
|
5255
|
+
tags: z134.array(z134.string().max(50)).max(20).default([]),
|
|
5256
|
+
permissions: z134.object({
|
|
5257
|
+
canRead: z134.array(z134.string()).default([]),
|
|
5258
|
+
canWrite: z134.array(z134.string()).default([]),
|
|
5259
|
+
canDelete: z134.array(z134.string()).default([]),
|
|
5260
|
+
isPublic: z134.boolean().default(false),
|
|
5261
|
+
inheritFromProject: z134.boolean().default(true)
|
|
4888
5262
|
}).optional(),
|
|
4889
|
-
sourceQuestId:
|
|
4890
|
-
sessionId:
|
|
4891
|
-
metadata:
|
|
5263
|
+
sourceQuestId: z134.string().optional(),
|
|
5264
|
+
sessionId: z134.string().optional(),
|
|
5265
|
+
metadata: z134.record(z134.unknown()).default({})
|
|
4892
5266
|
});
|
|
4893
5267
|
|
|
4894
5268
|
// ../../b4m-core/packages/services/dist/src/questMasterService/updateQuestStatus.js
|
|
4895
|
-
import { z as
|
|
4896
|
-
var updateQuestStatusSchema =
|
|
4897
|
-
artifactId:
|
|
4898
|
-
questId:
|
|
4899
|
-
status:
|
|
4900
|
-
completionNote:
|
|
5269
|
+
import { z as z135 } from "zod";
|
|
5270
|
+
var updateQuestStatusSchema = z135.object({
|
|
5271
|
+
artifactId: z135.string(),
|
|
5272
|
+
questId: z135.string(),
|
|
5273
|
+
status: z135.enum(["not_started", "in_progress", "completed", "blocked"]),
|
|
5274
|
+
completionNote: z135.string().max(500).optional()
|
|
4901
5275
|
});
|
|
4902
5276
|
|
|
4903
5277
|
// ../../b4m-core/packages/services/dist/src/dataLakeService/opensearchClient.js
|
|
@@ -4917,63 +5291,63 @@ import { v4 as uuidv44 } from "uuid";
|
|
|
4917
5291
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
4918
5292
|
|
|
4919
5293
|
// ../../b4m-core/packages/services/dist/src/emailIngestionService/types.js
|
|
4920
|
-
import { z as
|
|
4921
|
-
var processIngestedEmailOptionsSchema =
|
|
4922
|
-
platformDomain:
|
|
4923
|
-
isNewsletter:
|
|
5294
|
+
import { z as z136 } from "zod";
|
|
5295
|
+
var processIngestedEmailOptionsSchema = z136.object({
|
|
5296
|
+
platformDomain: z136.string().optional(),
|
|
5297
|
+
isNewsletter: z136.boolean().optional()
|
|
4924
5298
|
}).optional();
|
|
4925
|
-
var emailAttachmentSchema =
|
|
4926
|
-
filename:
|
|
4927
|
-
contentType:
|
|
4928
|
-
contentDisposition:
|
|
4929
|
-
size:
|
|
4930
|
-
content:
|
|
4931
|
-
related:
|
|
4932
|
-
});
|
|
4933
|
-
var parsedEmailObjectSchema =
|
|
4934
|
-
messageId:
|
|
4935
|
-
inReplyTo:
|
|
4936
|
-
references:
|
|
4937
|
-
from:
|
|
5299
|
+
var emailAttachmentSchema = z136.object({
|
|
5300
|
+
filename: z136.string().optional(),
|
|
5301
|
+
contentType: z136.string().optional(),
|
|
5302
|
+
contentDisposition: z136.string().optional(),
|
|
5303
|
+
size: z136.number().min(0),
|
|
5304
|
+
content: z136.instanceof(Buffer),
|
|
5305
|
+
related: z136.boolean().optional()
|
|
5306
|
+
});
|
|
5307
|
+
var parsedEmailObjectSchema = z136.object({
|
|
5308
|
+
messageId: z136.string().optional(),
|
|
5309
|
+
inReplyTo: z136.string().optional(),
|
|
5310
|
+
references: z136.union([z136.string(), z136.array(z136.string())]).optional(),
|
|
5311
|
+
from: z136.any().optional(),
|
|
4938
5312
|
// Complex email address object
|
|
4939
|
-
to:
|
|
4940
|
-
cc:
|
|
4941
|
-
bcc:
|
|
4942
|
-
subject:
|
|
4943
|
-
date:
|
|
4944
|
-
text:
|
|
4945
|
-
html:
|
|
4946
|
-
attachments:
|
|
4947
|
-
});
|
|
4948
|
-
var processIngestedEmailSchema =
|
|
5313
|
+
to: z136.any().optional(),
|
|
5314
|
+
cc: z136.any().optional(),
|
|
5315
|
+
bcc: z136.any().optional(),
|
|
5316
|
+
subject: z136.string().optional(),
|
|
5317
|
+
date: z136.date().optional(),
|
|
5318
|
+
text: z136.string().optional(),
|
|
5319
|
+
html: z136.string().optional(),
|
|
5320
|
+
attachments: z136.array(emailAttachmentSchema).optional()
|
|
5321
|
+
});
|
|
5322
|
+
var processIngestedEmailSchema = z136.object({
|
|
4949
5323
|
parsedEmail: parsedEmailObjectSchema,
|
|
4950
|
-
rawEmailS3Key:
|
|
5324
|
+
rawEmailS3Key: z136.string().min(1, "rawEmailS3Key cannot be empty"),
|
|
4951
5325
|
options: processIngestedEmailOptionsSchema
|
|
4952
5326
|
});
|
|
4953
5327
|
|
|
4954
5328
|
// ../../b4m-core/packages/services/dist/src/emailAnalysisService/types.js
|
|
4955
|
-
import { z as
|
|
4956
|
-
var llmAnalysisResponseSchema =
|
|
4957
|
-
summary:
|
|
4958
|
-
entities:
|
|
4959
|
-
companies:
|
|
4960
|
-
people:
|
|
4961
|
-
products:
|
|
4962
|
-
technologies:
|
|
5329
|
+
import { z as z137 } from "zod";
|
|
5330
|
+
var llmAnalysisResponseSchema = z137.object({
|
|
5331
|
+
summary: z137.string().min(1, "Summary cannot be empty"),
|
|
5332
|
+
entities: z137.object({
|
|
5333
|
+
companies: z137.array(z137.string()).default([]),
|
|
5334
|
+
people: z137.array(z137.string()).default([]),
|
|
5335
|
+
products: z137.array(z137.string()).default([]),
|
|
5336
|
+
technologies: z137.array(z137.string()).default([])
|
|
4963
5337
|
}),
|
|
4964
|
-
sentiment:
|
|
4965
|
-
actionItems:
|
|
4966
|
-
description:
|
|
4967
|
-
deadline:
|
|
5338
|
+
sentiment: z137.enum(["positive", "neutral", "negative", "urgent"]),
|
|
5339
|
+
actionItems: z137.array(z137.object({
|
|
5340
|
+
description: z137.string(),
|
|
5341
|
+
deadline: z137.string().optional()
|
|
4968
5342
|
// ISO date string from LLM
|
|
4969
5343
|
})).default([]),
|
|
4970
|
-
privacyRecommendation:
|
|
4971
|
-
embargoDetected:
|
|
4972
|
-
suggestedTags:
|
|
5344
|
+
privacyRecommendation: z137.enum(["public", "team", "private"]),
|
|
5345
|
+
embargoDetected: z137.boolean().default(false),
|
|
5346
|
+
suggestedTags: z137.array(z137.string()).default([])
|
|
4973
5347
|
});
|
|
4974
5348
|
|
|
4975
5349
|
// ../../b4m-core/packages/services/dist/src/llm/ChatCompletion.js
|
|
4976
|
-
import { z as
|
|
5350
|
+
import { z as z139 } from "zod";
|
|
4977
5351
|
|
|
4978
5352
|
// ../../b4m-core/packages/services/dist/src/llm/ChatCompletionInvoke.js
|
|
4979
5353
|
import { fromZodError } from "zod-validation-error";
|
|
@@ -5087,8 +5461,8 @@ async function processAndStoreImages(images, context) {
|
|
|
5087
5461
|
const buffer = await downloadImage(image);
|
|
5088
5462
|
const fileType = await fileTypeFromBuffer2(buffer);
|
|
5089
5463
|
const filename = `${uuidv45()}.${fileType?.ext}`;
|
|
5090
|
-
const
|
|
5091
|
-
return
|
|
5464
|
+
const path16 = await context.imageGenerateStorage.upload(buffer, filename, {});
|
|
5465
|
+
return path16;
|
|
5092
5466
|
}));
|
|
5093
5467
|
}
|
|
5094
5468
|
async function updateQuestAndReturnMarkdown(storedImageUrls, context) {
|
|
@@ -6061,17 +6435,17 @@ var rechartsTool = {
|
|
|
6061
6435
|
};
|
|
6062
6436
|
|
|
6063
6437
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/editFile/index.js
|
|
6064
|
-
import { z as
|
|
6438
|
+
import { z as z138 } from "zod";
|
|
6065
6439
|
import { diffLines as diffLines2 } from "diff";
|
|
6066
|
-
var editFileSchema =
|
|
6067
|
-
fileId:
|
|
6068
|
-
instruction:
|
|
6069
|
-
selection:
|
|
6070
|
-
start:
|
|
6071
|
-
end:
|
|
6440
|
+
var editFileSchema = z138.object({
|
|
6441
|
+
fileId: z138.string().describe("The ID of the file to edit"),
|
|
6442
|
+
instruction: z138.string().describe("Natural language instruction describing the changes to make"),
|
|
6443
|
+
selection: z138.object({
|
|
6444
|
+
start: z138.number().describe("Starting character position of the selection"),
|
|
6445
|
+
end: z138.number().describe("Ending character position of the selection")
|
|
6072
6446
|
}).optional().describe("Optional selection range to edit within the file"),
|
|
6073
|
-
preserveFormatting:
|
|
6074
|
-
returnDiff:
|
|
6447
|
+
preserveFormatting: z138.boolean().optional().default(true).describe("Whether to preserve the original formatting style"),
|
|
6448
|
+
returnDiff: z138.boolean().optional().default(true).describe("Whether to return a diff of the changes")
|
|
6075
6449
|
});
|
|
6076
6450
|
function generateSimpleDiff(original, modified) {
|
|
6077
6451
|
const differences = diffLines2(original, modified);
|
|
@@ -6300,8 +6674,8 @@ async function processAndStoreImage(imageUrl, context) {
|
|
|
6300
6674
|
const buffer = await downloadImage2(imageUrl);
|
|
6301
6675
|
const fileType = await fileTypeFromBuffer3(buffer);
|
|
6302
6676
|
const filename = `${uuidv46()}.${fileType?.ext}`;
|
|
6303
|
-
const
|
|
6304
|
-
return
|
|
6677
|
+
const path16 = await context.imageGenerateStorage.upload(buffer, filename, {});
|
|
6678
|
+
return path16;
|
|
6305
6679
|
}
|
|
6306
6680
|
async function updateQuestAndReturnMarkdown2(storedImagePath, context) {
|
|
6307
6681
|
await context.onFinish?.("edit_image", storedImagePath);
|
|
@@ -7830,8 +8204,8 @@ var getHeliocentricCoords = (planet, T) => {
|
|
|
7830
8204
|
const sinNode = Math.sin(longNode);
|
|
7831
8205
|
const x = r * (cosNode * cosOmega - sinNode * sinOmega * cosI);
|
|
7832
8206
|
const y = r * (sinNode * cosOmega + cosNode * sinOmega * cosI);
|
|
7833
|
-
const
|
|
7834
|
-
return { x, y, z:
|
|
8207
|
+
const z145 = r * sinOmega * sinI;
|
|
8208
|
+
return { x, y, z: z145, r };
|
|
7835
8209
|
};
|
|
7836
8210
|
var getGeocentricEcliptic = (planet, earth) => {
|
|
7837
8211
|
const dx = planet.x - earth.x;
|
|
@@ -8138,15 +8512,15 @@ var planetVisibilityTool = {
|
|
|
8138
8512
|
};
|
|
8139
8513
|
|
|
8140
8514
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/fileRead/index.js
|
|
8141
|
-
import { promises as
|
|
8515
|
+
import { promises as fs8 } from "fs";
|
|
8142
8516
|
import { existsSync as existsSync4, statSync as statSync4 } from "fs";
|
|
8143
|
-
import
|
|
8517
|
+
import path7 from "path";
|
|
8144
8518
|
var MAX_FILE_SIZE2 = 10 * 1024 * 1024;
|
|
8145
8519
|
async function readFileContent(params) {
|
|
8146
8520
|
const { path: filePath, encoding = "utf-8", maxLines } = params;
|
|
8147
|
-
const normalizedPath =
|
|
8148
|
-
const resolvedPath =
|
|
8149
|
-
const cwd =
|
|
8521
|
+
const normalizedPath = path7.normalize(filePath);
|
|
8522
|
+
const resolvedPath = path7.resolve(process.cwd(), normalizedPath);
|
|
8523
|
+
const cwd = path7.resolve(process.cwd());
|
|
8150
8524
|
if (!resolvedPath.startsWith(cwd)) {
|
|
8151
8525
|
throw new Error(`Access denied: Cannot read files outside of current working directory`);
|
|
8152
8526
|
}
|
|
@@ -8164,7 +8538,7 @@ async function readFileContent(params) {
|
|
|
8164
8538
|
if (isBinary && encoding === "utf-8") {
|
|
8165
8539
|
throw new Error(`File appears to be binary. Use encoding 'base64' to read binary files, or specify a different encoding.`);
|
|
8166
8540
|
}
|
|
8167
|
-
const content = await
|
|
8541
|
+
const content = await fs8.readFile(resolvedPath, encoding);
|
|
8168
8542
|
if (maxLines && typeof content === "string") {
|
|
8169
8543
|
const lines = content.split("\n");
|
|
8170
8544
|
if (lines.length > maxLines) {
|
|
@@ -8179,7 +8553,7 @@ ${content}`;
|
|
|
8179
8553
|
}
|
|
8180
8554
|
async function checkIfBinary(filePath) {
|
|
8181
8555
|
const buffer = Buffer.alloc(8192);
|
|
8182
|
-
const fd = await
|
|
8556
|
+
const fd = await fs8.open(filePath, "r");
|
|
8183
8557
|
try {
|
|
8184
8558
|
const { bytesRead } = await fd.read(buffer, 0, 8192, 0);
|
|
8185
8559
|
const chunk = buffer.slice(0, bytesRead);
|
|
@@ -8196,7 +8570,7 @@ var fileReadTool = {
|
|
|
8196
8570
|
context.logger.info("\u{1F4C4} FileRead: Reading file", { path: params.path });
|
|
8197
8571
|
try {
|
|
8198
8572
|
const content = await readFileContent(params);
|
|
8199
|
-
const stats = statSync4(
|
|
8573
|
+
const stats = statSync4(path7.resolve(process.cwd(), path7.normalize(params.path)));
|
|
8200
8574
|
context.logger.info("\u2705 FileRead: Success", {
|
|
8201
8575
|
path: params.path,
|
|
8202
8576
|
size: stats.size,
|
|
@@ -8235,25 +8609,25 @@ var fileReadTool = {
|
|
|
8235
8609
|
};
|
|
8236
8610
|
|
|
8237
8611
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/createFile/index.js
|
|
8238
|
-
import { promises as
|
|
8612
|
+
import { promises as fs9 } from "fs";
|
|
8239
8613
|
import { existsSync as existsSync5 } from "fs";
|
|
8240
|
-
import
|
|
8614
|
+
import path8 from "path";
|
|
8241
8615
|
async function createFile(params) {
|
|
8242
8616
|
const { path: filePath, content, createDirectories = true } = params;
|
|
8243
|
-
const normalizedPath =
|
|
8244
|
-
const resolvedPath =
|
|
8245
|
-
const cwd =
|
|
8617
|
+
const normalizedPath = path8.normalize(filePath);
|
|
8618
|
+
const resolvedPath = path8.resolve(process.cwd(), normalizedPath);
|
|
8619
|
+
const cwd = path8.resolve(process.cwd());
|
|
8246
8620
|
if (!resolvedPath.startsWith(cwd)) {
|
|
8247
8621
|
throw new Error(`Access denied: Cannot create files outside of current working directory`);
|
|
8248
8622
|
}
|
|
8249
8623
|
const fileExists = existsSync5(resolvedPath);
|
|
8250
8624
|
const action = fileExists ? "overwritten" : "created";
|
|
8251
8625
|
if (createDirectories) {
|
|
8252
|
-
const dir =
|
|
8253
|
-
await
|
|
8626
|
+
const dir = path8.dirname(resolvedPath);
|
|
8627
|
+
await fs9.mkdir(dir, { recursive: true });
|
|
8254
8628
|
}
|
|
8255
|
-
await
|
|
8256
|
-
const stats = await
|
|
8629
|
+
await fs9.writeFile(resolvedPath, content, "utf-8");
|
|
8630
|
+
const stats = await fs9.stat(resolvedPath);
|
|
8257
8631
|
const lines = content.split("\n").length;
|
|
8258
8632
|
return `File ${action} successfully: ${filePath}
|
|
8259
8633
|
Size: ${stats.size} bytes
|
|
@@ -8264,7 +8638,7 @@ var createFileTool = {
|
|
|
8264
8638
|
implementation: (context) => ({
|
|
8265
8639
|
toolFn: async (value) => {
|
|
8266
8640
|
const params = value;
|
|
8267
|
-
const fileExists = existsSync5(
|
|
8641
|
+
const fileExists = existsSync5(path8.resolve(process.cwd(), path8.normalize(params.path)));
|
|
8268
8642
|
context.logger.info(`\u{1F4DD} CreateFile: ${fileExists ? "Overwriting" : "Creating"} file`, {
|
|
8269
8643
|
path: params.path,
|
|
8270
8644
|
size: params.content.length
|
|
@@ -8306,7 +8680,7 @@ var createFileTool = {
|
|
|
8306
8680
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/globFiles/index.js
|
|
8307
8681
|
import { readdir } from "fs/promises";
|
|
8308
8682
|
import { statSync as statSync5 } from "fs";
|
|
8309
|
-
import
|
|
8683
|
+
import path9 from "path";
|
|
8310
8684
|
function matchGlob(filePath, pattern) {
|
|
8311
8685
|
let regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (_, options) => `(${options.split(",").join("|")})`).replace(/\[([^\]]+)\]/g, "[$1]");
|
|
8312
8686
|
regexPattern = regexPattern.replace(/\{\{GLOBSTAR\}\}\//g, "(.*/)?").replace(/\/\{\{GLOBSTAR\}\}/g, "(/.*)?").replace(/\{\{GLOBSTAR\}\}/g, ".*");
|
|
@@ -8324,8 +8698,8 @@ async function walkDir(dir, pattern, includeHidden, maxResults, basePath = "") {
|
|
|
8324
8698
|
if (!includeHidden && entry.name.startsWith(".")) {
|
|
8325
8699
|
continue;
|
|
8326
8700
|
}
|
|
8327
|
-
const relativePath = basePath ?
|
|
8328
|
-
const fullPath =
|
|
8701
|
+
const relativePath = basePath ? path9.join(basePath, entry.name) : entry.name;
|
|
8702
|
+
const fullPath = path9.join(dir, entry.name);
|
|
8329
8703
|
if (matchGlob(relativePath, pattern)) {
|
|
8330
8704
|
matches.push(relativePath);
|
|
8331
8705
|
}
|
|
@@ -8341,7 +8715,7 @@ async function walkDir(dir, pattern, includeHidden, maxResults, basePath = "") {
|
|
|
8341
8715
|
async function listFiles(params) {
|
|
8342
8716
|
const { pattern, cwd: relativeCwd, includeHidden = false, maxResults = 1e3 } = params;
|
|
8343
8717
|
const baseCwd = process.cwd();
|
|
8344
|
-
const targetCwd = relativeCwd ?
|
|
8718
|
+
const targetCwd = relativeCwd ? path9.resolve(baseCwd, path9.normalize(relativeCwd)) : baseCwd;
|
|
8345
8719
|
if (!targetCwd.startsWith(baseCwd)) {
|
|
8346
8720
|
throw new Error(`Access denied: Cannot list files outside of current working directory`);
|
|
8347
8721
|
}
|
|
@@ -8352,7 +8726,7 @@ async function listFiles(params) {
|
|
|
8352
8726
|
const filesInfo = [];
|
|
8353
8727
|
for (const match of matches) {
|
|
8354
8728
|
try {
|
|
8355
|
-
const fullPath =
|
|
8729
|
+
const fullPath = path9.join(targetCwd, match);
|
|
8356
8730
|
const stats = statSync5(fullPath);
|
|
8357
8731
|
filesInfo.push({
|
|
8358
8732
|
path: match,
|
|
@@ -8435,7 +8809,7 @@ var globFilesTool = {
|
|
|
8435
8809
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/grepSearch/index.js
|
|
8436
8810
|
import { readdir as readdir2 } from "fs/promises";
|
|
8437
8811
|
import { readFileSync as readFileSync3, statSync as statSync6 } from "fs";
|
|
8438
|
-
import
|
|
8812
|
+
import path10 from "path";
|
|
8439
8813
|
var MAX_FILE_SIZE3 = 10 * 1024 * 1024;
|
|
8440
8814
|
function matchGlob2(filePath, pattern) {
|
|
8441
8815
|
const regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/\{\{GLOBSTAR\}\}/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (_, options) => `(${options.split(",").join("|")})`).replace(/\[([^\]]+)\]/g, "[$1]");
|
|
@@ -8453,8 +8827,8 @@ async function walkDir2(dir, pattern, maxResults, basePath = "") {
|
|
|
8453
8827
|
if (entry.name.startsWith(".")) {
|
|
8454
8828
|
continue;
|
|
8455
8829
|
}
|
|
8456
|
-
const relativePath = basePath ?
|
|
8457
|
-
const fullPath =
|
|
8830
|
+
const relativePath = basePath ? path10.join(basePath, entry.name) : entry.name;
|
|
8831
|
+
const fullPath = path10.join(dir, entry.name);
|
|
8458
8832
|
if (matchGlob2(relativePath, pattern)) {
|
|
8459
8833
|
matches.push(relativePath);
|
|
8460
8834
|
}
|
|
@@ -8470,7 +8844,7 @@ async function walkDir2(dir, pattern, maxResults, basePath = "") {
|
|
|
8470
8844
|
async function searchFiles2(params) {
|
|
8471
8845
|
const { pattern, filePattern = "**/*", cwd: relativeCwd, caseSensitive = false, maxResults = 100, contextLines = 0 } = params;
|
|
8472
8846
|
const baseCwd = process.cwd();
|
|
8473
|
-
const targetCwd = relativeCwd ?
|
|
8847
|
+
const targetCwd = relativeCwd ? path10.resolve(baseCwd, path10.normalize(relativeCwd)) : baseCwd;
|
|
8474
8848
|
if (!targetCwd.startsWith(baseCwd)) {
|
|
8475
8849
|
throw new Error(`Access denied: Cannot search files outside of current working directory`);
|
|
8476
8850
|
}
|
|
@@ -8484,7 +8858,7 @@ async function searchFiles2(params) {
|
|
|
8484
8858
|
const filesToSearch = await walkDir2(targetCwd, filePattern, 1e4);
|
|
8485
8859
|
const filteredFiles = [];
|
|
8486
8860
|
for (const match of filesToSearch) {
|
|
8487
|
-
const fullPath =
|
|
8861
|
+
const fullPath = path10.join(targetCwd, match);
|
|
8488
8862
|
try {
|
|
8489
8863
|
const stats = statSync6(fullPath);
|
|
8490
8864
|
if (stats.isDirectory() || stats.size > MAX_FILE_SIZE3) {
|
|
@@ -8508,7 +8882,7 @@ async function searchFiles2(params) {
|
|
|
8508
8882
|
break;
|
|
8509
8883
|
}
|
|
8510
8884
|
filesSearched++;
|
|
8511
|
-
const fullPath =
|
|
8885
|
+
const fullPath = path10.join(targetCwd, file);
|
|
8512
8886
|
try {
|
|
8513
8887
|
const content = readFileSync3(fullPath, "utf-8");
|
|
8514
8888
|
const lines = content.split("\n");
|
|
@@ -8643,14 +9017,14 @@ var grepSearchTool = {
|
|
|
8643
9017
|
};
|
|
8644
9018
|
|
|
8645
9019
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/deleteFile/index.js
|
|
8646
|
-
import { promises as
|
|
9020
|
+
import { promises as fs10 } from "fs";
|
|
8647
9021
|
import { existsSync as existsSync6, statSync as statSync7 } from "fs";
|
|
8648
|
-
import
|
|
9022
|
+
import path11 from "path";
|
|
8649
9023
|
async function deleteFile(params) {
|
|
8650
9024
|
const { path: filePath, recursive = false } = params;
|
|
8651
|
-
const normalizedPath =
|
|
8652
|
-
const resolvedPath =
|
|
8653
|
-
const cwd =
|
|
9025
|
+
const normalizedPath = path11.normalize(filePath);
|
|
9026
|
+
const resolvedPath = path11.resolve(process.cwd(), normalizedPath);
|
|
9027
|
+
const cwd = path11.resolve(process.cwd());
|
|
8654
9028
|
if (!resolvedPath.startsWith(cwd)) {
|
|
8655
9029
|
throw new Error(`Access denied: Cannot delete files outside of current working directory`);
|
|
8656
9030
|
}
|
|
@@ -8664,10 +9038,10 @@ async function deleteFile(params) {
|
|
|
8664
9038
|
throw new Error(`Path is a directory: ${filePath}. Use recursive=true to delete directories and their contents.`);
|
|
8665
9039
|
}
|
|
8666
9040
|
if (isDirectory) {
|
|
8667
|
-
await
|
|
9041
|
+
await fs10.rm(resolvedPath, { recursive: true, force: true });
|
|
8668
9042
|
return `Directory deleted successfully: ${filePath}`;
|
|
8669
9043
|
} else {
|
|
8670
|
-
await
|
|
9044
|
+
await fs10.unlink(resolvedPath);
|
|
8671
9045
|
return `File deleted successfully: ${filePath}
|
|
8672
9046
|
Size: ${size} bytes`;
|
|
8673
9047
|
}
|
|
@@ -8677,7 +9051,7 @@ var deleteFileTool = {
|
|
|
8677
9051
|
implementation: (context) => ({
|
|
8678
9052
|
toolFn: async (value) => {
|
|
8679
9053
|
const params = value;
|
|
8680
|
-
const resolvedPath =
|
|
9054
|
+
const resolvedPath = path11.resolve(process.cwd(), path11.normalize(params.path));
|
|
8681
9055
|
const isDirectory = existsSync6(resolvedPath) && statSync7(resolvedPath).isDirectory();
|
|
8682
9056
|
context.logger.info(`\u{1F5D1}\uFE0F DeleteFile: Deleting ${isDirectory ? "directory" : "file"}`, {
|
|
8683
9057
|
path: params.path,
|
|
@@ -8715,7 +9089,7 @@ var deleteFileTool = {
|
|
|
8715
9089
|
|
|
8716
9090
|
// ../../b4m-core/packages/services/dist/src/llm/tools/implementation/bashExecute/index.js
|
|
8717
9091
|
import { spawn } from "child_process";
|
|
8718
|
-
import
|
|
9092
|
+
import path12 from "path";
|
|
8719
9093
|
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
8720
9094
|
var MAX_OUTPUT_SIZE = 100 * 1024;
|
|
8721
9095
|
var DANGEROUS_PATTERNS = [
|
|
@@ -8899,7 +9273,7 @@ async function executeBashCommand(params) {
|
|
|
8899
9273
|
};
|
|
8900
9274
|
}
|
|
8901
9275
|
const baseCwd = process.cwd();
|
|
8902
|
-
const targetCwd = relativeCwd ?
|
|
9276
|
+
const targetCwd = relativeCwd ? path12.resolve(baseCwd, relativeCwd) : baseCwd;
|
|
8903
9277
|
const effectiveTimeout = Math.min(timeout, 5 * 60 * 1e3);
|
|
8904
9278
|
return new Promise((resolve3) => {
|
|
8905
9279
|
let stdout = "";
|
|
@@ -9233,42 +9607,42 @@ var DISABLE_SERVER_THROTTLING = process.env.DISABLE_SERVER_THROTTLING === "true"
|
|
|
9233
9607
|
var questSaveMutex = new Mutex();
|
|
9234
9608
|
|
|
9235
9609
|
// ../../b4m-core/packages/services/dist/src/llm/ChatCompletion.js
|
|
9236
|
-
var QuestStartBodySchema =
|
|
9237
|
-
userId:
|
|
9238
|
-
sessionId:
|
|
9239
|
-
questId:
|
|
9240
|
-
message:
|
|
9241
|
-
messageFileIds:
|
|
9242
|
-
historyCount:
|
|
9243
|
-
fabFileIds:
|
|
9610
|
+
var QuestStartBodySchema = z139.object({
|
|
9611
|
+
userId: z139.string(),
|
|
9612
|
+
sessionId: z139.string(),
|
|
9613
|
+
questId: z139.string(),
|
|
9614
|
+
message: z139.string(),
|
|
9615
|
+
messageFileIds: z139.array(z139.string()),
|
|
9616
|
+
historyCount: z139.number(),
|
|
9617
|
+
fabFileIds: z139.array(z139.string()),
|
|
9244
9618
|
params: ChatCompletionCreateInputSchema,
|
|
9245
9619
|
dashboardParams: DashboardParamsSchema.optional(),
|
|
9246
|
-
enableQuestMaster:
|
|
9247
|
-
enableMementos:
|
|
9248
|
-
enableArtifacts:
|
|
9249
|
-
enableAgents:
|
|
9620
|
+
enableQuestMaster: z139.boolean().optional(),
|
|
9621
|
+
enableMementos: z139.boolean().optional(),
|
|
9622
|
+
enableArtifacts: z139.boolean().optional(),
|
|
9623
|
+
enableAgents: z139.boolean().optional(),
|
|
9250
9624
|
promptMeta: PromptMetaZodSchema,
|
|
9251
|
-
tools:
|
|
9252
|
-
mcpServers:
|
|
9253
|
-
projectId:
|
|
9254
|
-
organizationId:
|
|
9625
|
+
tools: z139.array(z139.union([b4mLLMTools, z139.string()])).optional(),
|
|
9626
|
+
mcpServers: z139.array(z139.string()).optional(),
|
|
9627
|
+
projectId: z139.string().optional(),
|
|
9628
|
+
organizationId: z139.string().nullable().optional(),
|
|
9255
9629
|
questMaster: QuestMasterParamsSchema.optional(),
|
|
9256
|
-
toolPromptId:
|
|
9630
|
+
toolPromptId: z139.string().optional(),
|
|
9257
9631
|
researchMode: ResearchModeParamsSchema.optional(),
|
|
9258
|
-
fallbackModel:
|
|
9259
|
-
embeddingModel:
|
|
9260
|
-
queryComplexity:
|
|
9632
|
+
fallbackModel: z139.string().optional(),
|
|
9633
|
+
embeddingModel: z139.string().optional(),
|
|
9634
|
+
queryComplexity: z139.string(),
|
|
9261
9635
|
imageConfig: GenerateImageToolCallSchema.optional(),
|
|
9262
|
-
deepResearchConfig:
|
|
9263
|
-
maxDepth:
|
|
9264
|
-
duration:
|
|
9636
|
+
deepResearchConfig: z139.object({
|
|
9637
|
+
maxDepth: z139.number().optional(),
|
|
9638
|
+
duration: z139.number().optional(),
|
|
9265
9639
|
// Note: searchers are passed via ToolContext and not through this API schema
|
|
9266
|
-
searchers:
|
|
9640
|
+
searchers: z139.array(z139.any()).optional()
|
|
9267
9641
|
}).optional(),
|
|
9268
|
-
extraContextMessages:
|
|
9269
|
-
role:
|
|
9270
|
-
content:
|
|
9271
|
-
fabFileIds:
|
|
9642
|
+
extraContextMessages: z139.array(z139.object({
|
|
9643
|
+
role: z139.enum(["user", "assistant", "system", "function", "tool"]),
|
|
9644
|
+
content: z139.union([z139.string(), z139.array(z139.any())]),
|
|
9645
|
+
fabFileIds: z139.array(z139.string()).optional()
|
|
9272
9646
|
})).optional()
|
|
9273
9647
|
});
|
|
9274
9648
|
|
|
@@ -9276,30 +9650,9 @@ var QuestStartBodySchema = z138.object({
|
|
|
9276
9650
|
import axios8 from "axios";
|
|
9277
9651
|
import { fileTypeFromBuffer as fileTypeFromBuffer4 } from "file-type";
|
|
9278
9652
|
import { v4 as uuidv47 } from "uuid";
|
|
9279
|
-
import { z as
|
|
9653
|
+
import { z as z140 } from "zod";
|
|
9280
9654
|
import { fromZodError as fromZodError2 } from "zod-validation-error";
|
|
9281
9655
|
var ImageGenerationBodySchema = OpenAIImageGenerationInput.extend({
|
|
9282
|
-
sessionId: z139.string(),
|
|
9283
|
-
questId: z139.string(),
|
|
9284
|
-
userId: z139.string(),
|
|
9285
|
-
prompt: z139.string(),
|
|
9286
|
-
safety_tolerance: z139.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
|
|
9287
|
-
prompt_upsampling: z139.boolean().optional().default(false),
|
|
9288
|
-
seed: z139.number().nullable().optional(),
|
|
9289
|
-
output_format: z139.enum(["jpeg", "png"]).nullable().optional().default("png"),
|
|
9290
|
-
width: z139.number().optional(),
|
|
9291
|
-
height: z139.number().optional(),
|
|
9292
|
-
aspect_ratio: z139.string().optional(),
|
|
9293
|
-
fabFileIds: z139.array(z139.string()).optional()
|
|
9294
|
-
});
|
|
9295
|
-
|
|
9296
|
-
// ../../b4m-core/packages/services/dist/src/llm/ImageEdit.js
|
|
9297
|
-
import axios9 from "axios";
|
|
9298
|
-
import { fileTypeFromBuffer as fileTypeFromBuffer5 } from "file-type";
|
|
9299
|
-
import { v4 as uuidv48 } from "uuid";
|
|
9300
|
-
import { z as z140 } from "zod";
|
|
9301
|
-
import { fromZodError as fromZodError3 } from "zod-validation-error";
|
|
9302
|
-
var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
|
|
9303
9656
|
sessionId: z140.string(),
|
|
9304
9657
|
questId: z140.string(),
|
|
9305
9658
|
userId: z140.string(),
|
|
@@ -9307,35 +9660,56 @@ var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
|
|
|
9307
9660
|
safety_tolerance: z140.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
|
|
9308
9661
|
prompt_upsampling: z140.boolean().optional().default(false),
|
|
9309
9662
|
seed: z140.number().nullable().optional(),
|
|
9310
|
-
output_format: z140.enum(["jpeg", "png"]).optional().default("png"),
|
|
9663
|
+
output_format: z140.enum(["jpeg", "png"]).nullable().optional().default("png"),
|
|
9311
9664
|
width: z140.number().optional(),
|
|
9312
9665
|
height: z140.number().optional(),
|
|
9313
9666
|
aspect_ratio: z140.string().optional(),
|
|
9314
|
-
|
|
9315
|
-
fabFileIds: z140.array(z140.string()).optional(),
|
|
9316
|
-
image: z140.string()
|
|
9667
|
+
fabFileIds: z140.array(z140.string()).optional()
|
|
9317
9668
|
});
|
|
9318
9669
|
|
|
9319
|
-
// ../../b4m-core/packages/services/dist/src/llm/
|
|
9670
|
+
// ../../b4m-core/packages/services/dist/src/llm/ImageEdit.js
|
|
9671
|
+
import axios9 from "axios";
|
|
9672
|
+
import { fileTypeFromBuffer as fileTypeFromBuffer5 } from "file-type";
|
|
9673
|
+
import { v4 as uuidv48 } from "uuid";
|
|
9320
9674
|
import { z as z141 } from "zod";
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9675
|
+
import { fromZodError as fromZodError3 } from "zod-validation-error";
|
|
9676
|
+
var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
|
|
9677
|
+
sessionId: z141.string(),
|
|
9678
|
+
questId: z141.string(),
|
|
9679
|
+
userId: z141.string(),
|
|
9680
|
+
prompt: z141.string(),
|
|
9681
|
+
safety_tolerance: z141.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
|
|
9682
|
+
prompt_upsampling: z141.boolean().optional().default(false),
|
|
9683
|
+
seed: z141.number().nullable().optional(),
|
|
9684
|
+
output_format: z141.enum(["jpeg", "png"]).optional().default("png"),
|
|
9685
|
+
width: z141.number().optional(),
|
|
9686
|
+
height: z141.number().optional(),
|
|
9687
|
+
aspect_ratio: z141.string().optional(),
|
|
9688
|
+
size: z141.string().optional(),
|
|
9689
|
+
fabFileIds: z141.array(z141.string()).optional(),
|
|
9690
|
+
image: z141.string()
|
|
9691
|
+
});
|
|
9692
|
+
|
|
9693
|
+
// ../../b4m-core/packages/services/dist/src/llm/refineText.js
|
|
9694
|
+
import { z as z142 } from "zod";
|
|
9695
|
+
var refineTextLLMSchema = z142.object({
|
|
9696
|
+
text: z142.string(),
|
|
9697
|
+
context: z142.string().optional()
|
|
9324
9698
|
// tone: z.enum(['formal', 'informal', 'neutral']).optional(),
|
|
9325
9699
|
// style: z.enum(['technical', 'creative', 'academic', 'business', 'narrative']).optional(),
|
|
9326
9700
|
});
|
|
9327
9701
|
|
|
9328
9702
|
// ../../b4m-core/packages/services/dist/src/llm/MementoEvaluationService.js
|
|
9329
|
-
import { z as
|
|
9330
|
-
var SingleMementoEvalSchema =
|
|
9331
|
-
importance:
|
|
9703
|
+
import { z as z143 } from "zod";
|
|
9704
|
+
var SingleMementoEvalSchema = z143.object({
|
|
9705
|
+
importance: z143.number().min(1).max(10),
|
|
9332
9706
|
// 1-10 scale for personal info importance
|
|
9333
|
-
summary:
|
|
9334
|
-
tags:
|
|
9707
|
+
summary: z143.string(),
|
|
9708
|
+
tags: z143.array(z143.string()).optional()
|
|
9335
9709
|
});
|
|
9336
|
-
var MementoEvalResponseSchema =
|
|
9337
|
-
isPersonal:
|
|
9338
|
-
mementos:
|
|
9710
|
+
var MementoEvalResponseSchema = z143.object({
|
|
9711
|
+
isPersonal: z143.boolean(),
|
|
9712
|
+
mementos: z143.array(SingleMementoEvalSchema).optional()
|
|
9339
9713
|
// Array of distinct personal information
|
|
9340
9714
|
});
|
|
9341
9715
|
|
|
@@ -9392,7 +9766,7 @@ async function generateFileDeletePreview(args) {
|
|
|
9392
9766
|
if (!existsSync7(args.path)) {
|
|
9393
9767
|
return `[File does not exist: ${args.path}]`;
|
|
9394
9768
|
}
|
|
9395
|
-
const stats = await import("fs/promises").then((
|
|
9769
|
+
const stats = await import("fs/promises").then((fs13) => fs13.stat(args.path));
|
|
9396
9770
|
return `[File will be deleted]
|
|
9397
9771
|
|
|
9398
9772
|
Path: ${args.path}
|
|
@@ -9404,9 +9778,9 @@ Last modified: ${stats.mtime.toLocaleString()}`;
|
|
|
9404
9778
|
}
|
|
9405
9779
|
|
|
9406
9780
|
// src/utils/Logger.ts
|
|
9407
|
-
import
|
|
9408
|
-
import
|
|
9409
|
-
import
|
|
9781
|
+
import fs11 from "fs/promises";
|
|
9782
|
+
import path13 from "path";
|
|
9783
|
+
import os2 from "os";
|
|
9410
9784
|
var Logger2 = class _Logger {
|
|
9411
9785
|
constructor() {
|
|
9412
9786
|
this.logFilePath = null;
|
|
@@ -9428,9 +9802,9 @@ var Logger2 = class _Logger {
|
|
|
9428
9802
|
*/
|
|
9429
9803
|
async initialize(sessionId) {
|
|
9430
9804
|
this.sessionId = sessionId;
|
|
9431
|
-
const debugDir =
|
|
9432
|
-
await
|
|
9433
|
-
this.logFilePath =
|
|
9805
|
+
const debugDir = path13.join(os2.homedir(), ".bike4mind", "debug");
|
|
9806
|
+
await fs11.mkdir(debugDir, { recursive: true });
|
|
9807
|
+
this.logFilePath = path13.join(debugDir, `${sessionId}.txt`);
|
|
9434
9808
|
await this.writeToFile("INFO", "=== CLI SESSION START ===");
|
|
9435
9809
|
}
|
|
9436
9810
|
/**
|
|
@@ -9494,7 +9868,7 @@ var Logger2 = class _Logger {
|
|
|
9494
9868
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").substring(0, 19);
|
|
9495
9869
|
const logEntry = `[${timestamp}] [${level}] ${message}
|
|
9496
9870
|
`;
|
|
9497
|
-
await
|
|
9871
|
+
await fs11.appendFile(this.logFilePath, logEntry, "utf-8");
|
|
9498
9872
|
} catch (error) {
|
|
9499
9873
|
console.error("File logging failed:", error);
|
|
9500
9874
|
}
|
|
@@ -9640,15 +10014,15 @@ var Logger2 = class _Logger {
|
|
|
9640
10014
|
async cleanupOldLogs() {
|
|
9641
10015
|
if (!this.fileLoggingEnabled) return;
|
|
9642
10016
|
try {
|
|
9643
|
-
const debugDir =
|
|
9644
|
-
const files = await
|
|
10017
|
+
const debugDir = path13.join(os2.homedir(), ".bike4mind", "debug");
|
|
10018
|
+
const files = await fs11.readdir(debugDir);
|
|
9645
10019
|
const now = Date.now();
|
|
9646
10020
|
const thirtyDaysAgo = now - 30 * 24 * 60 * 60 * 1e3;
|
|
9647
10021
|
for (const file of files) {
|
|
9648
|
-
const filePath =
|
|
9649
|
-
const stats = await
|
|
10022
|
+
const filePath = path13.join(debugDir, file);
|
|
10023
|
+
const stats = await fs11.stat(filePath);
|
|
9650
10024
|
if (stats.mtime.getTime() < thirtyDaysAgo) {
|
|
9651
|
-
await
|
|
10025
|
+
await fs11.unlink(filePath);
|
|
9652
10026
|
}
|
|
9653
10027
|
}
|
|
9654
10028
|
} catch (error) {
|
|
@@ -9657,6 +10031,7 @@ var Logger2 = class _Logger {
|
|
|
9657
10031
|
}
|
|
9658
10032
|
};
|
|
9659
10033
|
var logger = Logger2.getInstance();
|
|
10034
|
+
logger.setVerbose(process.env.B4M_VERBOSE === "1");
|
|
9660
10035
|
|
|
9661
10036
|
// src/llm/ServerToolExecutor.ts
|
|
9662
10037
|
var ServerToolExecutor = class {
|
|
@@ -9741,21 +10116,21 @@ var NoOpStorage = class extends BaseStorage {
|
|
|
9741
10116
|
async upload(input, destination, options) {
|
|
9742
10117
|
return `/tmp/${destination}`;
|
|
9743
10118
|
}
|
|
9744
|
-
async download(
|
|
10119
|
+
async download(path16) {
|
|
9745
10120
|
throw new Error("Download not supported in CLI");
|
|
9746
10121
|
}
|
|
9747
|
-
async delete(
|
|
10122
|
+
async delete(path16) {
|
|
9748
10123
|
}
|
|
9749
|
-
async getSignedUrl(
|
|
9750
|
-
return `/tmp/${
|
|
10124
|
+
async getSignedUrl(path16) {
|
|
10125
|
+
return `/tmp/${path16}`;
|
|
9751
10126
|
}
|
|
9752
|
-
getPublicUrl(
|
|
9753
|
-
return `/tmp/${
|
|
10127
|
+
getPublicUrl(path16) {
|
|
10128
|
+
return `/tmp/${path16}`;
|
|
9754
10129
|
}
|
|
9755
|
-
async getPreview(
|
|
9756
|
-
return `/tmp/${
|
|
10130
|
+
async getPreview(path16) {
|
|
10131
|
+
return `/tmp/${path16}`;
|
|
9757
10132
|
}
|
|
9758
|
-
async getMetadata(
|
|
10133
|
+
async getMetadata(path16) {
|
|
9759
10134
|
return { size: 0, contentType: "application/octet-stream" };
|
|
9760
10135
|
}
|
|
9761
10136
|
};
|
|
@@ -9926,8 +10301,8 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
|
|
|
9926
10301
|
}
|
|
9927
10302
|
|
|
9928
10303
|
// src/config/toolSafety.ts
|
|
9929
|
-
import { z as
|
|
9930
|
-
var ToolCategorySchema =
|
|
10304
|
+
import { z as z144 } from "zod";
|
|
10305
|
+
var ToolCategorySchema = z144.enum([
|
|
9931
10306
|
"auto_approve",
|
|
9932
10307
|
// Safe tools that run automatically without permission
|
|
9933
10308
|
"prompt_always",
|
|
@@ -9935,9 +10310,9 @@ var ToolCategorySchema = z143.enum([
|
|
|
9935
10310
|
"prompt_default"
|
|
9936
10311
|
// Tools that prompt by default but can be trusted
|
|
9937
10312
|
]);
|
|
9938
|
-
var ToolSafetyConfigSchema =
|
|
9939
|
-
categories:
|
|
9940
|
-
trustedTools:
|
|
10313
|
+
var ToolSafetyConfigSchema = z144.object({
|
|
10314
|
+
categories: z144.record(z144.string(), ToolCategorySchema),
|
|
10315
|
+
trustedTools: z144.array(z144.string())
|
|
9941
10316
|
});
|
|
9942
10317
|
var DEFAULT_TOOL_CATEGORIES = {
|
|
9943
10318
|
// ===== AUTO APPROVE (Safe tools) =====
|
|
@@ -10117,8 +10492,8 @@ function getEnvironmentName(configApiConfig) {
|
|
|
10117
10492
|
}
|
|
10118
10493
|
|
|
10119
10494
|
// src/utils/contextLoader.ts
|
|
10120
|
-
import * as
|
|
10121
|
-
import * as
|
|
10495
|
+
import * as fs12 from "fs";
|
|
10496
|
+
import * as path14 from "path";
|
|
10122
10497
|
import { homedir as homedir4 } from "os";
|
|
10123
10498
|
var CONTEXT_FILE_SIZE_LIMIT = 100 * 1024;
|
|
10124
10499
|
var PROJECT_CONTEXT_FILES = [
|
|
@@ -10139,9 +10514,9 @@ function formatFileSize2(bytes) {
|
|
|
10139
10514
|
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
10140
10515
|
}
|
|
10141
10516
|
function tryReadContextFile(dir, filename, source) {
|
|
10142
|
-
const filePath =
|
|
10517
|
+
const filePath = path14.join(dir, filename);
|
|
10143
10518
|
try {
|
|
10144
|
-
const stats =
|
|
10519
|
+
const stats = fs12.lstatSync(filePath);
|
|
10145
10520
|
if (stats.isDirectory()) {
|
|
10146
10521
|
return null;
|
|
10147
10522
|
}
|
|
@@ -10155,7 +10530,7 @@ function tryReadContextFile(dir, filename, source) {
|
|
|
10155
10530
|
error: `${source === "global" ? "Global" : "Project"} ${filename} exceeds 100KB limit (${formatFileSize2(stats.size)})`
|
|
10156
10531
|
};
|
|
10157
10532
|
}
|
|
10158
|
-
const content =
|
|
10533
|
+
const content = fs12.readFileSync(filePath, "utf-8");
|
|
10159
10534
|
return {
|
|
10160
10535
|
filename,
|
|
10161
10536
|
content,
|
|
@@ -10207,7 +10582,7 @@ ${project.content}`;
|
|
|
10207
10582
|
}
|
|
10208
10583
|
async function loadContextFiles(projectDir) {
|
|
10209
10584
|
const errors = [];
|
|
10210
|
-
const globalDir =
|
|
10585
|
+
const globalDir = path14.join(homedir4(), ".bike4mind");
|
|
10211
10586
|
const projectDirectory = projectDir || process.cwd();
|
|
10212
10587
|
const [globalResult, projectResult] = await Promise.all([
|
|
10213
10588
|
Promise.resolve(findContextFile(globalDir, GLOBAL_CONTEXT_FILES, "global")),
|
|
@@ -10228,10 +10603,22 @@ async function loadContextFiles(projectDir) {
|
|
|
10228
10603
|
};
|
|
10229
10604
|
}
|
|
10230
10605
|
|
|
10606
|
+
// src/utils/argumentSubstitution.ts
|
|
10607
|
+
function substituteArguments(template, args) {
|
|
10608
|
+
let result = template;
|
|
10609
|
+
for (let i = args.length; i >= 1; i--) {
|
|
10610
|
+
const pattern = new RegExp(`\\$${i}`, "g");
|
|
10611
|
+
result = result.replace(pattern, args[i - 1] || "");
|
|
10612
|
+
}
|
|
10613
|
+
const allArgsString = args.join(" ");
|
|
10614
|
+
result = result.replace(/\$ARGUMENTS/g, allArgsString);
|
|
10615
|
+
return result;
|
|
10616
|
+
}
|
|
10617
|
+
|
|
10231
10618
|
// ../../b4m-core/packages/mcp/dist/src/client.js
|
|
10232
10619
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
10233
10620
|
import { Client as Client2 } from "@modelcontextprotocol/sdk/client/index.js";
|
|
10234
|
-
import
|
|
10621
|
+
import path15 from "path";
|
|
10235
10622
|
import { existsSync as existsSync8, readdirSync as readdirSync3 } from "fs";
|
|
10236
10623
|
var MCPClient = class {
|
|
10237
10624
|
// Note: This class handles MCP server communication with repository filtering
|
|
@@ -10272,16 +10659,16 @@ var MCPClient = class {
|
|
|
10272
10659
|
const root = process.env.INIT_CWD || process.cwd();
|
|
10273
10660
|
const candidatePaths = [
|
|
10274
10661
|
// When running from SST Lambda with node_modules structure (copyFiles)
|
|
10275
|
-
|
|
10662
|
+
path15.join(root, `node_modules/@bike4mind/mcp/dist/src/${this.serverName}/index.js`),
|
|
10276
10663
|
// When running from SST Lambda deployed environment (/var/task)
|
|
10277
|
-
|
|
10664
|
+
path15.join(root, `b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
|
|
10278
10665
|
// When running from SST Lambda (.sst/artifacts/mcpHandler-dev), navigate to monorepo root (3 levels up)
|
|
10279
|
-
|
|
10666
|
+
path15.join(root, `../../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
|
|
10280
10667
|
// When running from packages/client (Next.js app), navigate to monorepo root (2 levels up)
|
|
10281
|
-
|
|
10668
|
+
path15.join(root, `../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
|
|
10282
10669
|
// Original paths (backward compatibility)
|
|
10283
|
-
|
|
10284
|
-
|
|
10670
|
+
path15.join(root, `/b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
|
|
10671
|
+
path15.join(root, "core", "mcp", "servers", this.serverName, "dist", "index.js")
|
|
10285
10672
|
];
|
|
10286
10673
|
const serverScriptPath = candidatePaths.find((p) => existsSync8(p));
|
|
10287
10674
|
if (!serverScriptPath) {
|
|
@@ -11085,7 +11472,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
|
|
|
11085
11472
|
// package.json
|
|
11086
11473
|
var package_default = {
|
|
11087
11474
|
name: "@bike4mind/cli",
|
|
11088
|
-
version: "0.2.10-
|
|
11475
|
+
version: "0.2.10-slack-message-validated-length.17267+7a83442ea",
|
|
11089
11476
|
type: "module",
|
|
11090
11477
|
description: "Interactive CLI tool for Bike4Mind with ReAct agents",
|
|
11091
11478
|
license: "UNLICENSED",
|
|
@@ -11155,6 +11542,7 @@ var package_default = {
|
|
|
11155
11542
|
"eventsource-parser": "^3.0.6",
|
|
11156
11543
|
"file-type": "^18.7.0",
|
|
11157
11544
|
"fuse.js": "^7.1.0",
|
|
11545
|
+
"gray-matter": "^4.0.3",
|
|
11158
11546
|
ink: "^6.5.1",
|
|
11159
11547
|
"ink-select-input": "^6.2.0",
|
|
11160
11548
|
"ink-spinner": "^5.0.0",
|
|
@@ -11188,10 +11576,10 @@ var package_default = {
|
|
|
11188
11576
|
},
|
|
11189
11577
|
devDependencies: {
|
|
11190
11578
|
"@bike4mind/agents": "0.1.0",
|
|
11191
|
-
"@bike4mind/common": "2.39.1-
|
|
11192
|
-
"@bike4mind/mcp": "1.20.4-
|
|
11193
|
-
"@bike4mind/services": "2.34.2-
|
|
11194
|
-
"@bike4mind/utils": "2.1.4-
|
|
11579
|
+
"@bike4mind/common": "2.39.1-slack-message-validated-length.17267+7a83442ea",
|
|
11580
|
+
"@bike4mind/mcp": "1.20.4-slack-message-validated-length.17267+7a83442ea",
|
|
11581
|
+
"@bike4mind/services": "2.34.2-slack-message-validated-length.17267+7a83442ea",
|
|
11582
|
+
"@bike4mind/utils": "2.1.4-slack-message-validated-length.17267+7a83442ea",
|
|
11195
11583
|
"@types/better-sqlite3": "^7.6.13",
|
|
11196
11584
|
"@types/diff": "^5.0.9",
|
|
11197
11585
|
"@types/jsonwebtoken": "^9.0.4",
|
|
@@ -11204,7 +11592,7 @@ var package_default = {
|
|
|
11204
11592
|
typescript: "^5.9.3",
|
|
11205
11593
|
vitest: "^3.2.4"
|
|
11206
11594
|
},
|
|
11207
|
-
gitHead: "
|
|
11595
|
+
gitHead: "7a83442ea65541dea492eb9b43a6dc77c11683fe"
|
|
11208
11596
|
};
|
|
11209
11597
|
|
|
11210
11598
|
// src/config/constants.ts
|
|
@@ -11226,11 +11614,12 @@ var usageCache = null;
|
|
|
11226
11614
|
function CliApp() {
|
|
11227
11615
|
const { exit } = useApp();
|
|
11228
11616
|
const imageRenderer = new ImageRenderer();
|
|
11229
|
-
const [state, setState] =
|
|
11617
|
+
const [state, setState] = useState8({
|
|
11230
11618
|
session: null,
|
|
11231
11619
|
sessionStore: new SessionStore(),
|
|
11232
11620
|
configStore: new ConfigStore(),
|
|
11233
11621
|
commandHistoryStore: new CommandHistoryStore(),
|
|
11622
|
+
customCommandStore: new CustomCommandStore(),
|
|
11234
11623
|
imageStore: null,
|
|
11235
11624
|
// Lazy-loaded on first use
|
|
11236
11625
|
imageRenderer,
|
|
@@ -11243,10 +11632,10 @@ function CliApp() {
|
|
|
11243
11632
|
rewindSelector: null,
|
|
11244
11633
|
sessionSelector: null
|
|
11245
11634
|
});
|
|
11246
|
-
const [isInitialized, setIsInitialized] =
|
|
11247
|
-
const [initError, setInitError] =
|
|
11248
|
-
const [commandHistory, setCommandHistory] =
|
|
11249
|
-
const imageStoreInitPromise =
|
|
11635
|
+
const [isInitialized, setIsInitialized] = useState8(false);
|
|
11636
|
+
const [initError, setInitError] = useState8(null);
|
|
11637
|
+
const [commandHistory, setCommandHistory] = useState8([]);
|
|
11638
|
+
const imageStoreInitPromise = useRef2(null);
|
|
11250
11639
|
const setStoreSession = useCliStore((state2) => state2.setSession);
|
|
11251
11640
|
const setPermissionPrompt = useCliStore((state2) => state2.setPermissionPrompt);
|
|
11252
11641
|
const setShowConfigEditor = useCliStore((state2) => state2.setShowConfigEditor);
|
|
@@ -11310,6 +11699,15 @@ function CliApp() {
|
|
|
11310
11699
|
const config = await state.configStore.load();
|
|
11311
11700
|
const history = await state.commandHistoryStore.load();
|
|
11312
11701
|
setCommandHistory(history);
|
|
11702
|
+
try {
|
|
11703
|
+
await state.customCommandStore.loadCommands();
|
|
11704
|
+
const customCommandCount = state.customCommandStore.getCommandCount();
|
|
11705
|
+
if (customCommandCount > 0) {
|
|
11706
|
+
console.log(`\u{1F4DD} Loaded ${customCommandCount} custom command${customCommandCount !== 1 ? "s" : ""}`);
|
|
11707
|
+
}
|
|
11708
|
+
} catch (error) {
|
|
11709
|
+
console.warn("Failed to load custom commands:", error instanceof Error ? error.message : String(error));
|
|
11710
|
+
}
|
|
11313
11711
|
const authTokens = await state.configStore.getAuthTokens();
|
|
11314
11712
|
let isAuthenticated = false;
|
|
11315
11713
|
if (!authTokens) {
|
|
@@ -11368,13 +11766,11 @@ function CliApp() {
|
|
|
11368
11766
|
if (models.length === 0) {
|
|
11369
11767
|
throw new Error("No models available from server.");
|
|
11370
11768
|
}
|
|
11371
|
-
|
|
11769
|
+
logger.debug(`\u{1F4CB} Available models: ${models.map((m) => m.id).join(", ")}`);
|
|
11372
11770
|
const modelInfo = models.find((m) => m.id === config.defaultModel) || models[0];
|
|
11373
11771
|
if (modelInfo.id !== config.defaultModel) {
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
} else {
|
|
11377
|
-
console.log(`\u{1F916} Using model: ${modelInfo.id}`);
|
|
11772
|
+
logger.warn(`\u26A0\uFE0F Requested model '${config.defaultModel}' not available`);
|
|
11773
|
+
logger.warn(`\u{1F916} Using fallback model: ${modelInfo.id}`);
|
|
11378
11774
|
}
|
|
11379
11775
|
llm.currentModel = modelInfo.id;
|
|
11380
11776
|
const newSession = {
|
|
@@ -11393,9 +11789,6 @@ function CliApp() {
|
|
|
11393
11789
|
};
|
|
11394
11790
|
await logger.initialize(newSession.id);
|
|
11395
11791
|
logger.setVerbose(process.env.B4M_VERBOSE === "1");
|
|
11396
|
-
logger.info(`API: ${apiBaseURL}`);
|
|
11397
|
-
logger.info(`Environment: ${envName}`);
|
|
11398
|
-
logger.info(`Model: ${modelInfo.id}`);
|
|
11399
11792
|
logger.debug("=== Session Configuration Complete ===");
|
|
11400
11793
|
logger.cleanupOldLogs().catch(() => {
|
|
11401
11794
|
});
|
|
@@ -11444,7 +11837,7 @@ function CliApp() {
|
|
|
11444
11837
|
state.configStore,
|
|
11445
11838
|
apiClient
|
|
11446
11839
|
);
|
|
11447
|
-
console.log(`\u{1F6E0}\uFE0F
|
|
11840
|
+
console.log(`\u{1F6E0}\uFE0F Loaded ${b4mTools.length} B4M tool(s)`);
|
|
11448
11841
|
const mcpManager = new McpManager(config);
|
|
11449
11842
|
await mcpManager.initialize();
|
|
11450
11843
|
const mcpTools = mcpManager.getTools();
|
|
@@ -11455,7 +11848,6 @@ function CliApp() {
|
|
|
11455
11848
|
});
|
|
11456
11849
|
}
|
|
11457
11850
|
const allTools = [...b4mTools, ...mcpTools];
|
|
11458
|
-
console.log(`\u2705 Total: ${allTools.length} tool(s) available`);
|
|
11459
11851
|
const projectDir = state.configStore.getProjectConfigDir();
|
|
11460
11852
|
const contextResult = await loadContextFiles(projectDir);
|
|
11461
11853
|
if (contextResult.globalContext) {
|
|
@@ -11531,6 +11923,7 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11531
11923
|
}));
|
|
11532
11924
|
setStoreSession(newSession);
|
|
11533
11925
|
setIsInitialized(true);
|
|
11926
|
+
console.log("\n");
|
|
11534
11927
|
} catch (error) {
|
|
11535
11928
|
console.error("Initialization error:", error);
|
|
11536
11929
|
setInitError(error instanceof Error ? error.message : "Unknown error");
|
|
@@ -11547,17 +11940,18 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11547
11940
|
useEffect3(() => {
|
|
11548
11941
|
init();
|
|
11549
11942
|
}, [init]);
|
|
11550
|
-
const
|
|
11551
|
-
if (!state.agent || !state.session)
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11943
|
+
const handleCustomCommandMessage = async (fullTemplate, displayMessage) => {
|
|
11944
|
+
if (!state.agent || !state.session) {
|
|
11945
|
+
console.error("\u274C Agent or session not initialized");
|
|
11946
|
+
return;
|
|
11947
|
+
}
|
|
11555
11948
|
const authTokens = await state.configStore.getAuthTokens();
|
|
11556
11949
|
if (!authTokens || new Date(authTokens.expiresAt) <= /* @__PURE__ */ new Date()) {
|
|
11557
11950
|
console.log("\n\u274C Authentication required to use AI features.");
|
|
11558
11951
|
console.log("\u{1F4A1} Run /login to authenticate with your B4M account.\n");
|
|
11559
11952
|
return;
|
|
11560
11953
|
}
|
|
11954
|
+
useCliStore.getState().setIsThinking(true);
|
|
11561
11955
|
const currentSteps = [];
|
|
11562
11956
|
const stepHandler = (step) => {
|
|
11563
11957
|
currentSteps.push(step);
|
|
@@ -11582,12 +11976,11 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11582
11976
|
};
|
|
11583
11977
|
state.agent.on("action", stepHandler);
|
|
11584
11978
|
try {
|
|
11585
|
-
let messageContent =
|
|
11586
|
-
|
|
11587
|
-
if (state.messageBuilder && state.messageBuilder.hasImages(
|
|
11588
|
-
const { message: multimodalMessage } = await state.messageBuilder.buildMessage(
|
|
11979
|
+
let messageContent = fullTemplate;
|
|
11980
|
+
const userMessageContent = displayMessage;
|
|
11981
|
+
if (state.messageBuilder && state.messageBuilder.hasImages(fullTemplate)) {
|
|
11982
|
+
const { message: multimodalMessage } = await state.messageBuilder.buildMessage(fullTemplate);
|
|
11589
11983
|
messageContent = multimodalMessage.content;
|
|
11590
|
-
userMessageContent = message;
|
|
11591
11984
|
}
|
|
11592
11985
|
const userMessage = {
|
|
11593
11986
|
role: "user",
|
|
@@ -11624,7 +12017,155 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11624
12017
|
const successfulToolCalls = result.steps.filter((s) => s.type === "observation").length;
|
|
11625
12018
|
const currentSession = useCliStore.getState().session;
|
|
11626
12019
|
if (!currentSession) return;
|
|
11627
|
-
const
|
|
12020
|
+
const updatedMessages = [...currentSession.messages];
|
|
12021
|
+
updatedMessages[updatedMessages.length - 1] = {
|
|
12022
|
+
role: "assistant",
|
|
12023
|
+
content: result.finalAnswer,
|
|
12024
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12025
|
+
metadata: {
|
|
12026
|
+
steps: result.steps,
|
|
12027
|
+
tokenUsage: {
|
|
12028
|
+
prompt: 0,
|
|
12029
|
+
completion: 0,
|
|
12030
|
+
total: result.completionInfo.totalTokens
|
|
12031
|
+
},
|
|
12032
|
+
model: state.session.model,
|
|
12033
|
+
permissionDenied
|
|
12034
|
+
}
|
|
12035
|
+
};
|
|
12036
|
+
const finalSession = {
|
|
12037
|
+
...currentSession,
|
|
12038
|
+
messages: updatedMessages,
|
|
12039
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12040
|
+
metadata: {
|
|
12041
|
+
...currentSession.metadata,
|
|
12042
|
+
totalTokens: currentSession.metadata.totalTokens + result.completionInfo.totalTokens,
|
|
12043
|
+
toolCallCount: currentSession.metadata.toolCallCount + successfulToolCalls
|
|
12044
|
+
}
|
|
12045
|
+
};
|
|
12046
|
+
setState((prev) => ({ ...prev, session: finalSession }));
|
|
12047
|
+
setStoreSession(finalSession);
|
|
12048
|
+
await state.sessionStore.save(finalSession);
|
|
12049
|
+
usageCache = null;
|
|
12050
|
+
useCliStore.getState().setIsThinking(false);
|
|
12051
|
+
} catch (error) {
|
|
12052
|
+
useCliStore.getState().setIsThinking(false);
|
|
12053
|
+
if (error?.message?.includes("Permission denied")) {
|
|
12054
|
+
console.log("\n\u26A0\uFE0F Action blocked by permission settings");
|
|
12055
|
+
const currentSession2 = useCliStore.getState().session;
|
|
12056
|
+
if (!currentSession2) return;
|
|
12057
|
+
const sessionWithDenied = { ...currentSession2 };
|
|
12058
|
+
const messages2 = [...sessionWithDenied.messages];
|
|
12059
|
+
const lastMessage2 = messages2[messages2.length - 1];
|
|
12060
|
+
if (lastMessage2 && lastMessage2.role === "assistant") {
|
|
12061
|
+
messages2[messages2.length - 1] = {
|
|
12062
|
+
...lastMessage2,
|
|
12063
|
+
content: error.message,
|
|
12064
|
+
metadata: {
|
|
12065
|
+
...lastMessage2.metadata,
|
|
12066
|
+
permissionDenied: true
|
|
12067
|
+
}
|
|
12068
|
+
};
|
|
12069
|
+
}
|
|
12070
|
+
sessionWithDenied.messages = messages2;
|
|
12071
|
+
setState((prev) => ({ ...prev, session: sessionWithDenied }));
|
|
12072
|
+
setStoreSession(sessionWithDenied);
|
|
12073
|
+
await state.sessionStore.save(sessionWithDenied);
|
|
12074
|
+
return;
|
|
12075
|
+
}
|
|
12076
|
+
console.error("Error executing command:", error);
|
|
12077
|
+
console.error(error.stack);
|
|
12078
|
+
const currentSession = useCliStore.getState().session;
|
|
12079
|
+
if (!currentSession) return;
|
|
12080
|
+
const sessionWithError = { ...currentSession };
|
|
12081
|
+
const messages = [...sessionWithError.messages];
|
|
12082
|
+
const lastMessage = messages[messages.length - 1];
|
|
12083
|
+
if (lastMessage && lastMessage.role === "assistant") {
|
|
12084
|
+
messages[messages.length - 1] = {
|
|
12085
|
+
...lastMessage,
|
|
12086
|
+
content: `\u274C Error: ${error.message || "Unknown error occurred"}`
|
|
12087
|
+
};
|
|
12088
|
+
}
|
|
12089
|
+
sessionWithError.messages = messages;
|
|
12090
|
+
setState((prev) => ({ ...prev, session: sessionWithError }));
|
|
12091
|
+
setStoreSession(sessionWithError);
|
|
12092
|
+
} finally {
|
|
12093
|
+
state.agent.off("action", stepHandler);
|
|
12094
|
+
}
|
|
12095
|
+
};
|
|
12096
|
+
const handleMessage = async (message) => {
|
|
12097
|
+
if (!state.agent || !state.session) {
|
|
12098
|
+
console.error("\u274C Agent or session not initialized");
|
|
12099
|
+
return;
|
|
12100
|
+
}
|
|
12101
|
+
await state.commandHistoryStore.add(message);
|
|
12102
|
+
const updatedHistory = await state.commandHistoryStore.list();
|
|
12103
|
+
setCommandHistory(updatedHistory);
|
|
12104
|
+
const authTokens = await state.configStore.getAuthTokens();
|
|
12105
|
+
if (!authTokens || new Date(authTokens.expiresAt) <= /* @__PURE__ */ new Date()) {
|
|
12106
|
+
console.log("\n\u274C Authentication required to use AI features.");
|
|
12107
|
+
console.log("\u{1F4A1} Run /login to authenticate with your B4M account.\n");
|
|
12108
|
+
return;
|
|
12109
|
+
}
|
|
12110
|
+
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
|
+
try {
|
|
12128
|
+
let messageContent = message;
|
|
12129
|
+
let userMessageContent = message;
|
|
12130
|
+
if (state.messageBuilder && state.messageBuilder.hasImages(message)) {
|
|
12131
|
+
const { message: multimodalMessage } = await state.messageBuilder.buildMessage(message);
|
|
12132
|
+
messageContent = multimodalMessage.content;
|
|
12133
|
+
userMessageContent = message;
|
|
12134
|
+
}
|
|
12135
|
+
const userMessage = {
|
|
12136
|
+
role: "user",
|
|
12137
|
+
content: userMessageContent,
|
|
12138
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
12139
|
+
};
|
|
12140
|
+
const pendingAssistantMessage = {
|
|
12141
|
+
role: "assistant",
|
|
12142
|
+
content: "...",
|
|
12143
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12144
|
+
metadata: {
|
|
12145
|
+
steps: []
|
|
12146
|
+
}
|
|
12147
|
+
};
|
|
12148
|
+
const sessionWithUserMessage = {
|
|
12149
|
+
...state.session,
|
|
12150
|
+
messages: [...state.session.messages, userMessage],
|
|
12151
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12152
|
+
};
|
|
12153
|
+
setState((prev) => ({ ...prev, session: sessionWithUserMessage }));
|
|
12154
|
+
setStoreSession(sessionWithUserMessage);
|
|
12155
|
+
useCliStore.getState().addPendingMessage(pendingAssistantMessage);
|
|
12156
|
+
const recentMessages = state.session.messages.slice(-20);
|
|
12157
|
+
const previousMessages = recentMessages.filter((msg) => msg.role === "user" || msg.role === "assistant").map((msg) => ({
|
|
12158
|
+
role: msg.role,
|
|
12159
|
+
content: msg.content
|
|
12160
|
+
}));
|
|
12161
|
+
const result = await state.agent.run(messageContent, {
|
|
12162
|
+
previousMessages: previousMessages.length > 0 ? previousMessages : void 0
|
|
12163
|
+
});
|
|
12164
|
+
const permissionDenied = result.finalAnswer.startsWith("Permission denied for tool");
|
|
12165
|
+
if (permissionDenied) {
|
|
12166
|
+
console.log("\n\u26A0\uFE0F Action denied by user\n");
|
|
12167
|
+
}
|
|
12168
|
+
const successfulToolCalls = result.steps.filter((s) => s.type === "observation").length;
|
|
11628
12169
|
const finalAssistantMessage = {
|
|
11629
12170
|
role: "assistant",
|
|
11630
12171
|
content: result.finalAnswer,
|
|
@@ -11640,21 +12181,22 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11640
12181
|
permissionDenied
|
|
11641
12182
|
}
|
|
11642
12183
|
};
|
|
11643
|
-
|
|
12184
|
+
useCliStore.getState().completePendingMessage(0, finalAssistantMessage);
|
|
12185
|
+
const currentSession = useCliStore.getState().session;
|
|
12186
|
+
if (!currentSession) return;
|
|
11644
12187
|
const updatedSession = {
|
|
11645
12188
|
...currentSession,
|
|
11646
|
-
messages: finalMessages,
|
|
11647
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11648
12189
|
metadata: {
|
|
11649
|
-
...
|
|
11650
|
-
totalTokens:
|
|
11651
|
-
toolCallCount:
|
|
12190
|
+
...currentSession.metadata,
|
|
12191
|
+
totalTokens: currentSession.metadata.totalTokens + result.completionInfo.totalTokens,
|
|
12192
|
+
toolCallCount: currentSession.metadata.toolCallCount + successfulToolCalls
|
|
11652
12193
|
}
|
|
11653
12194
|
};
|
|
11654
12195
|
setState((prev) => ({ ...prev, session: updatedSession }));
|
|
11655
12196
|
setStoreSession(updatedSession);
|
|
11656
12197
|
await state.sessionStore.save(updatedSession);
|
|
11657
12198
|
} catch (error) {
|
|
12199
|
+
useCliStore.getState().clearPendingMessages();
|
|
11658
12200
|
if (error instanceof Error) {
|
|
11659
12201
|
if (error.message.includes("Authentication failed") || error.message.includes("Authentication expired")) {
|
|
11660
12202
|
console.log("\n\u274C Authentication failed");
|
|
@@ -11667,6 +12209,46 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11667
12209
|
state.agent.off("action", stepHandler);
|
|
11668
12210
|
}
|
|
11669
12211
|
};
|
|
12212
|
+
const handleBashCommand = useCallback(
|
|
12213
|
+
(command) => {
|
|
12214
|
+
if (!state.session) return;
|
|
12215
|
+
let output;
|
|
12216
|
+
let isError = false;
|
|
12217
|
+
try {
|
|
12218
|
+
output = execSync(command, {
|
|
12219
|
+
encoding: "utf-8",
|
|
12220
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
12221
|
+
cwd: process.cwd(),
|
|
12222
|
+
maxBuffer: 10 * 1024 * 1024
|
|
12223
|
+
// 10MB buffer
|
|
12224
|
+
});
|
|
12225
|
+
} catch (error) {
|
|
12226
|
+
const execError = error;
|
|
12227
|
+
output = execError.stderr || execError.message || "Command failed";
|
|
12228
|
+
isError = true;
|
|
12229
|
+
}
|
|
12230
|
+
const userMessage = {
|
|
12231
|
+
role: "user",
|
|
12232
|
+
content: `$ ${command}`,
|
|
12233
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
12234
|
+
};
|
|
12235
|
+
const assistantMessage = {
|
|
12236
|
+
role: "assistant",
|
|
12237
|
+
content: isError ? `\u274C Error:
|
|
12238
|
+
${output}` : output.trim() || "(no output)",
|
|
12239
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
12240
|
+
};
|
|
12241
|
+
const updatedSession = {
|
|
12242
|
+
...state.session,
|
|
12243
|
+
messages: [...state.session.messages, userMessage, assistantMessage],
|
|
12244
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12245
|
+
};
|
|
12246
|
+
setState((prev) => ({ ...prev, session: updatedSession }));
|
|
12247
|
+
setStoreSession(updatedSession);
|
|
12248
|
+
state.sessionStore.save(updatedSession);
|
|
12249
|
+
},
|
|
12250
|
+
[state.session, state.sessionStore]
|
|
12251
|
+
);
|
|
11670
12252
|
const handleImageDetected = async (imageData) => {
|
|
11671
12253
|
try {
|
|
11672
12254
|
let imageStore = state.imageStore;
|
|
@@ -11721,8 +12303,48 @@ Remember: Use context from previous messages to understand follow-up questions.$
|
|
|
11721
12303
|
};
|
|
11722
12304
|
};
|
|
11723
12305
|
const handleCommand = async (command, args) => {
|
|
12306
|
+
const customCommand = state.customCommandStore.getCommand(command);
|
|
12307
|
+
if (customCommand) {
|
|
12308
|
+
try {
|
|
12309
|
+
const sourceIcon = customCommand.source === "global" ? "\u{1F3E0}" : "\u{1F4C1}";
|
|
12310
|
+
console.log(`${sourceIcon} Executing custom command: /${command}`);
|
|
12311
|
+
let substitutedBody = substituteArguments(customCommand.body, args);
|
|
12312
|
+
const processed = await processFileReferences(substitutedBody);
|
|
12313
|
+
substitutedBody = processed.content;
|
|
12314
|
+
if (processed.errors.length > 0) {
|
|
12315
|
+
processed.errors.forEach((error) => console.warn(`Warning: ${error}`));
|
|
12316
|
+
}
|
|
12317
|
+
if (process.env.B4M_VERBOSE === "1") {
|
|
12318
|
+
console.log("\u{1F4DD} Expanded command:\n", substitutedBody);
|
|
12319
|
+
}
|
|
12320
|
+
const displayMessage = `/${command}${args.length > 0 ? " " + args.join(" ") : ""}`;
|
|
12321
|
+
if (customCommand.model && state.agent) {
|
|
12322
|
+
console.log(`\u{1F504} Using model override: ${customCommand.model}`);
|
|
12323
|
+
const originalModel = state.session?.model;
|
|
12324
|
+
if (state.session) {
|
|
12325
|
+
state.session.model = customCommand.model;
|
|
12326
|
+
}
|
|
12327
|
+
await handleCustomCommandMessage(substitutedBody, displayMessage);
|
|
12328
|
+
if (state.session && originalModel) {
|
|
12329
|
+
state.session.model = originalModel;
|
|
12330
|
+
}
|
|
12331
|
+
} else {
|
|
12332
|
+
console.log("\u{1F916} Sending to agent...\n");
|
|
12333
|
+
await handleCustomCommandMessage(substitutedBody, displayMessage);
|
|
12334
|
+
}
|
|
12335
|
+
return;
|
|
12336
|
+
} catch (error) {
|
|
12337
|
+
console.error(
|
|
12338
|
+
`\u274C Failed to execute custom command /${command}:`,
|
|
12339
|
+
error instanceof Error ? error.message : String(error)
|
|
12340
|
+
);
|
|
12341
|
+
return;
|
|
12342
|
+
}
|
|
12343
|
+
}
|
|
11724
12344
|
switch (command) {
|
|
11725
|
-
case "help":
|
|
12345
|
+
case "help": {
|
|
12346
|
+
const customCommands = state.customCommandStore.getAllCommands();
|
|
12347
|
+
const hasCustomCommands = customCommands.length > 0;
|
|
11726
12348
|
console.log(`
|
|
11727
12349
|
Available commands:
|
|
11728
12350
|
/help - Show this help message
|
|
@@ -11749,8 +12371,19 @@ Tool Permissions:
|
|
|
11749
12371
|
|
|
11750
12372
|
Project Configuration:
|
|
11751
12373
|
/project-config - Show merged project configuration
|
|
12374
|
+
|
|
12375
|
+
Custom Commands:
|
|
12376
|
+
/commands - List all custom commands
|
|
12377
|
+
/commands:new <name> - Create a new custom command
|
|
12378
|
+
/commands:reload - Reload custom commands from disk${hasCustomCommands ? "\n\n\u{1F4DD} Custom Commands Available:" : ""}${hasCustomCommands ? customCommands.map((cmd) => {
|
|
12379
|
+
const source = cmd.source === "global" ? "\u{1F3E0}" : "\u{1F4C1}";
|
|
12380
|
+
const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
|
|
12381
|
+
return `
|
|
12382
|
+
${source} /${cmd.name}${argHint} - ${cmd.description}`;
|
|
12383
|
+
}).join("") : ""}
|
|
11752
12384
|
`);
|
|
11753
12385
|
break;
|
|
12386
|
+
}
|
|
11754
12387
|
case "exit":
|
|
11755
12388
|
case "quit":
|
|
11756
12389
|
logger.debug("[EXIT /exit command - cleaning up and exiting...");
|
|
@@ -11791,6 +12424,7 @@ Project Configuration:
|
|
|
11791
12424
|
setState((prev) => ({ ...prev, session: loadedSession }));
|
|
11792
12425
|
setStoreSession(loadedSession);
|
|
11793
12426
|
useCliStore.getState().clearAgentSteps();
|
|
12427
|
+
useCliStore.getState().clearPendingMessages();
|
|
11794
12428
|
usageCache = null;
|
|
11795
12429
|
console.log(`
|
|
11796
12430
|
\u2705 Session resumed: "${loadedSession.name}"`);
|
|
@@ -12026,6 +12660,7 @@ Project Configuration:
|
|
|
12026
12660
|
setState((prev) => ({ ...prev, session: newSession }));
|
|
12027
12661
|
setStoreSession(newSession);
|
|
12028
12662
|
useCliStore.getState().clearAgentSteps();
|
|
12663
|
+
useCliStore.getState().clearPendingMessages();
|
|
12029
12664
|
usageCache = null;
|
|
12030
12665
|
console.log("New session started.");
|
|
12031
12666
|
console.log(`
|
|
@@ -12078,6 +12713,7 @@ Project Configuration:
|
|
|
12078
12713
|
prefillInput: prefillContent
|
|
12079
12714
|
}));
|
|
12080
12715
|
setStoreSession(rewindedSession);
|
|
12716
|
+
useCliStore.getState().clearPendingMessages();
|
|
12081
12717
|
await state.sessionStore.save(rewindedSession);
|
|
12082
12718
|
console.log("\u2705 Conversation rewound successfully");
|
|
12083
12719
|
console.log(`\u{1F4CA} Current state: ${rewindedMessages.length} messages, ${newMetadata.totalTokens} tokens`);
|
|
@@ -12235,6 +12871,71 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12235
12871
|
console.log("");
|
|
12236
12872
|
break;
|
|
12237
12873
|
}
|
|
12874
|
+
case "commands": {
|
|
12875
|
+
const customCommands = state.customCommandStore.getAllCommands();
|
|
12876
|
+
const globalCommands = state.customCommandStore.getCommandsBySource("global");
|
|
12877
|
+
const projectCommands = state.customCommandStore.getCommandsBySource("project");
|
|
12878
|
+
console.log("\n\u{1F4DD} Custom Commands:\n");
|
|
12879
|
+
if (customCommands.length === 0) {
|
|
12880
|
+
console.log("No custom commands found.");
|
|
12881
|
+
console.log("\nTo create a custom command:");
|
|
12882
|
+
console.log(" /commands:new <name> - Create a new command");
|
|
12883
|
+
console.log("\nCustom commands can be stored in:");
|
|
12884
|
+
console.log(" \u{1F3E0} Global: ~/.bike4mind/commands/ (available in all projects)");
|
|
12885
|
+
console.log(" \u{1F4C1} Project: .bike4mind/commands/ (team-shared, committed to git)");
|
|
12886
|
+
} else {
|
|
12887
|
+
if (globalCommands.length > 0) {
|
|
12888
|
+
console.log("\u{1F3E0} Global Commands (~/.bike4mind/commands/):");
|
|
12889
|
+
globalCommands.forEach((cmd) => {
|
|
12890
|
+
const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
|
|
12891
|
+
console.log(` /${cmd.name}${argHint} - ${cmd.description}`);
|
|
12892
|
+
});
|
|
12893
|
+
console.log("");
|
|
12894
|
+
}
|
|
12895
|
+
if (projectCommands.length > 0) {
|
|
12896
|
+
console.log("\u{1F4C1} Project Commands (.bike4mind/commands/):");
|
|
12897
|
+
projectCommands.forEach((cmd) => {
|
|
12898
|
+
const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
|
|
12899
|
+
console.log(` /${cmd.name}${argHint} - ${cmd.description}`);
|
|
12900
|
+
});
|
|
12901
|
+
console.log("");
|
|
12902
|
+
}
|
|
12903
|
+
console.log(`Total: ${customCommands.length} custom command${customCommands.length !== 1 ? "s" : ""}`);
|
|
12904
|
+
}
|
|
12905
|
+
console.log("");
|
|
12906
|
+
break;
|
|
12907
|
+
}
|
|
12908
|
+
case "commands:new": {
|
|
12909
|
+
const commandName = args[0];
|
|
12910
|
+
if (!commandName) {
|
|
12911
|
+
console.log("\u274C Please provide a command name");
|
|
12912
|
+
console.log("Usage: /commands:new <name>");
|
|
12913
|
+
break;
|
|
12914
|
+
}
|
|
12915
|
+
console.log("\nWhere should this command be stored?");
|
|
12916
|
+
console.log(" 1. \u{1F3E0} Global (~/.bike4mind/commands/) - available in all projects");
|
|
12917
|
+
console.log(" 2. \u{1F4C1} Project (.bike4mind/commands/) - team-shared");
|
|
12918
|
+
console.log("\nDefaulting to global. Creating command file...");
|
|
12919
|
+
try {
|
|
12920
|
+
const filePath = await state.customCommandStore.createCommandFile(commandName, true);
|
|
12921
|
+
console.log(`\u2705 Created command file: ${filePath}`);
|
|
12922
|
+
console.log("\nEdit this file to customize your command.");
|
|
12923
|
+
console.log("Then run: /commands:reload to load it");
|
|
12924
|
+
} catch (error) {
|
|
12925
|
+
console.error("\u274C Failed to create command file:", error instanceof Error ? error.message : String(error));
|
|
12926
|
+
}
|
|
12927
|
+
break;
|
|
12928
|
+
}
|
|
12929
|
+
case "commands:reload": {
|
|
12930
|
+
try {
|
|
12931
|
+
await state.customCommandStore.reloadCommands();
|
|
12932
|
+
const count = state.customCommandStore.getCommandCount();
|
|
12933
|
+
console.log(`\u2705 Reloaded ${count} custom command${count !== 1 ? "s" : ""}`);
|
|
12934
|
+
} catch (error) {
|
|
12935
|
+
console.error("\u274C Failed to reload commands:", error instanceof Error ? error.message : String(error));
|
|
12936
|
+
}
|
|
12937
|
+
break;
|
|
12938
|
+
}
|
|
12238
12939
|
default:
|
|
12239
12940
|
console.log(`Unknown command: /${command}`);
|
|
12240
12941
|
console.log("Type /help for available commands");
|
|
@@ -12242,15 +12943,36 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12242
12943
|
};
|
|
12243
12944
|
const handleSaveConfig = async (updatedConfig) => {
|
|
12244
12945
|
await state.configStore.save(updatedConfig);
|
|
12245
|
-
|
|
12946
|
+
const modelChanged = state.config?.defaultModel !== updatedConfig.defaultModel;
|
|
12947
|
+
setState((prev) => {
|
|
12948
|
+
if (modelChanged && prev.session) {
|
|
12949
|
+
const updatedSession = {
|
|
12950
|
+
...prev.session,
|
|
12951
|
+
model: updatedConfig.defaultModel,
|
|
12952
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12953
|
+
};
|
|
12954
|
+
setStoreSession(updatedSession);
|
|
12955
|
+
if (prev.agent) {
|
|
12956
|
+
prev.agent.context.model = updatedConfig.defaultModel;
|
|
12957
|
+
}
|
|
12958
|
+
return { ...prev, config: updatedConfig, session: updatedSession };
|
|
12959
|
+
}
|
|
12960
|
+
return { ...prev, config: updatedConfig };
|
|
12961
|
+
});
|
|
12962
|
+
if (modelChanged && state.agent) {
|
|
12963
|
+
const llm = state.agent.context.llm;
|
|
12964
|
+
if (llm) {
|
|
12965
|
+
llm.currentModel = updatedConfig.defaultModel;
|
|
12966
|
+
}
|
|
12967
|
+
}
|
|
12246
12968
|
};
|
|
12247
12969
|
if (initError) {
|
|
12248
|
-
return /* @__PURE__ */
|
|
12970
|
+
return /* @__PURE__ */ React17.createElement(Box16, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React17.createElement(Text16, { color: "red", bold: true }, "\u274C Initialization Error"), /* @__PURE__ */ React17.createElement(Text16, null, initError), /* @__PURE__ */ React17.createElement(Text16, { dimColor: true }, "\n", "Tip: Run /config to set up your API keys"));
|
|
12249
12971
|
}
|
|
12250
12972
|
if (state.trustLocationSelector) {
|
|
12251
12973
|
const projectDir = state.configStore.getProjectConfigDir();
|
|
12252
12974
|
const inProject = projectDir !== null;
|
|
12253
|
-
return /* @__PURE__ */
|
|
12975
|
+
return /* @__PURE__ */ React17.createElement(
|
|
12254
12976
|
TrustLocationSelector,
|
|
12255
12977
|
{
|
|
12256
12978
|
inProject,
|
|
@@ -12268,7 +12990,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12268
12990
|
);
|
|
12269
12991
|
}
|
|
12270
12992
|
if (state.rewindSelector && state.session) {
|
|
12271
|
-
return /* @__PURE__ */
|
|
12993
|
+
return /* @__PURE__ */ React17.createElement(
|
|
12272
12994
|
RewindSelector,
|
|
12273
12995
|
{
|
|
12274
12996
|
messages: state.session.messages,
|
|
@@ -12286,7 +13008,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12286
13008
|
);
|
|
12287
13009
|
}
|
|
12288
13010
|
if (state.sessionSelector) {
|
|
12289
|
-
return /* @__PURE__ */
|
|
13011
|
+
return /* @__PURE__ */ React17.createElement(
|
|
12290
13012
|
SessionSelector,
|
|
12291
13013
|
{
|
|
12292
13014
|
sessions: state.sessionSelector.sessions,
|
|
@@ -12306,7 +13028,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12306
13028
|
}
|
|
12307
13029
|
if (state.showLoginFlow) {
|
|
12308
13030
|
const loginApiUrl = getApiUrl(state.config?.apiConfig);
|
|
12309
|
-
return /* @__PURE__ */
|
|
13031
|
+
return /* @__PURE__ */ React17.createElement(
|
|
12310
13032
|
LoginFlow,
|
|
12311
13033
|
{
|
|
12312
13034
|
apiUrl: loginApiUrl,
|
|
@@ -12329,15 +13051,18 @@ No usage data available for the last ${USAGE_DAYS} days.`);
|
|
|
12329
13051
|
);
|
|
12330
13052
|
}
|
|
12331
13053
|
if (!isInitialized) {
|
|
12332
|
-
return /* @__PURE__ */
|
|
13054
|
+
return /* @__PURE__ */ React17.createElement(Box16, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React17.createElement(Text16, null, "\u{1F680} Initializing..."));
|
|
12333
13055
|
}
|
|
12334
|
-
|
|
13056
|
+
const allCommands = mergeCommands(state.customCommandStore.getAllCommands());
|
|
13057
|
+
return /* @__PURE__ */ React17.createElement(
|
|
12335
13058
|
App,
|
|
12336
13059
|
{
|
|
12337
13060
|
onMessage: handleMessage,
|
|
12338
13061
|
onCommand: handleCommand,
|
|
13062
|
+
onBashCommand: handleBashCommand,
|
|
12339
13063
|
onImageDetected: handleImageDetected,
|
|
12340
13064
|
commandHistory,
|
|
13065
|
+
commands: allCommands,
|
|
12341
13066
|
config: state.config,
|
|
12342
13067
|
availableModels: state.availableModels,
|
|
12343
13068
|
onSaveConfig: handleSaveConfig,
|
|
@@ -12364,12 +13089,12 @@ var BANNER = `
|
|
|
12364
13089
|
\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D
|
|
12365
13090
|
`;
|
|
12366
13091
|
console.log("\x1B[36m\x1B[1m%s\x1B[0m", BANNER);
|
|
12367
|
-
console.log(`\x1B[2m v${package_default.version} - AI-Powered CLI\x1B[0m
|
|
12368
|
-
|
|
13092
|
+
console.log(`\x1B[2m v${package_default.version} - AI-Powered CLI\x1B[0m`);
|
|
13093
|
+
console.log(" /help for more information\n");
|
|
12369
13094
|
var isDevMode = import.meta.url.includes("/src/") || process.env.NODE_ENV === "development";
|
|
12370
13095
|
if (isDevMode) {
|
|
12371
|
-
|
|
13096
|
+
logger.debug("\u{1F527} Running in development mode (using TypeScript source)\n");
|
|
12372
13097
|
}
|
|
12373
|
-
render(/* @__PURE__ */
|
|
13098
|
+
render(/* @__PURE__ */ React17.createElement(CliApp, null), {
|
|
12374
13099
|
exitOnCtrlC: false
|
|
12375
13100
|
});
|