@bike4mind/cli 0.2.25-cli-file-read-offset.18514 → 0.2.25-cli-file-read-offset.18541

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,15 +1,19 @@
1
1
  #!/usr/bin/env node
2
+ import "./chunk-BPFEGDC7.js";
2
3
  import "./chunk-BDQBOLYG.js";
3
4
  import {
4
5
  getEffectiveApiKey,
5
6
  getOpenWeatherKey,
6
7
  getSerperKey
7
- } from "./chunk-FV2VQXYX.js";
8
+ } from "./chunk-ETQCFCFT.js";
8
9
  import {
9
10
  ConfigStore
10
11
  } from "./chunk-23T2XGSZ.js";
11
- import "./chunk-JHCQOESZ.js";
12
- import "./chunk-GGQZHK5U.js";
12
+ import {
13
+ useCliStore
14
+ } from "./chunk-EIDW3VBS.js";
15
+ import "./chunk-TNLRJZRH.js";
16
+ import "./chunk-QDD3PG2I.js";
13
17
  import {
14
18
  BFLImageService,
15
19
  BaseStorage,
@@ -21,7 +25,7 @@ import {
21
25
  OpenAIBackend,
22
26
  OpenAIImageService,
23
27
  XAIImageService
24
- } from "./chunk-XFN2ICKP.js";
28
+ } from "./chunk-KGERFIL4.js";
25
29
  import {
26
30
  AiEvents,
27
31
  ApiKeyEvents,
@@ -77,27 +81,27 @@ import {
77
81
  XAI_IMAGE_MODELS,
78
82
  b4mLLMTools,
79
83
  getMcpProviderMetadata
80
- } from "./chunk-LOIWIBZT.js";
84
+ } from "./chunk-CRG4F6FD.js";
81
85
  import {
82
86
  Logger
83
87
  } from "./chunk-OCYRD7D6.js";
84
- import "./chunk-BPFEGDC7.js";
85
88
 
86
89
  // src/index.tsx
87
90
  import React19, { useState as useState8, useEffect as useEffect4, useCallback, useRef as useRef3 } from "react";
88
- import { render, Box as Box18, Text as Text18, useApp, useInput as useInput7 } from "ink";
91
+ import { render, Box as Box18, Text as Text18, useApp, useInput as useInput8 } from "ink";
89
92
  import { execSync } from "child_process";
90
93
  import { v4 as uuidv411 } from "uuid";
91
94
 
92
95
  // src/components/App.tsx
93
96
  import React13, { useState as useState4 } from "react";
94
- import { Box as Box12, Text as Text12, Static } from "ink";
97
+ import { Box as Box12, Text as Text12, Static, useInput as useInput5 } from "ink";
95
98
 
96
99
  // src/components/StatusBar.tsx
97
100
  import React from "react";
98
101
  import { Box, Text } from "ink";
99
102
  var StatusBar = React.memo(function StatusBar2({ sessionName, model, tokenUsage }) {
100
- 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)));
103
+ const autoAcceptEdits = useCliStore((state) => state.autoAcceptEdits);
104
+ 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 }, autoAcceptEdits && /* @__PURE__ */ React.createElement(Text, { color: "green", bold: true }, "AUTO ACCEPT: Edits"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, tokenUsage.toLocaleString(), " tokens"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, model)));
101
105
  });
102
106
 
103
107
  // src/components/InputPrompt.tsx
@@ -899,66 +903,6 @@ var ImageInputDetector = class {
899
903
  }
900
904
  };
901
905
 
902
- // src/store/index.ts
903
- import { create } from "zustand";
904
- var useCliStore = create((set) => ({
905
- // Session state
906
- session: null,
907
- setSession: (session) => set({ session }),
908
- addMessage: (message) => set((state) => {
909
- if (!state.session) return state;
910
- return {
911
- session: {
912
- ...state.session,
913
- messages: [...state.session.messages, message],
914
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
915
- }
916
- };
917
- }),
918
- // Pending messages
919
- pendingMessages: [],
920
- addPendingMessage: (message) => set((state) => ({ pendingMessages: [...state.pendingMessages, message] })),
921
- updatePendingMessage: (index, message) => set((state) => {
922
- const updated = [...state.pendingMessages];
923
- updated[index] = message;
924
- return { pendingMessages: updated };
925
- }),
926
- clearPendingMessages: () => set({ pendingMessages: [] }),
927
- completePendingMessage: (index, finalMessage) => set((state) => {
928
- const pending = [...state.pendingMessages];
929
- pending.splice(index, 1);
930
- const session = state.session;
931
- if (!session) return { pendingMessages: pending };
932
- return {
933
- pendingMessages: pending,
934
- session: {
935
- ...session,
936
- messages: [...session.messages, finalMessage],
937
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
938
- }
939
- };
940
- }),
941
- // UI state
942
- isThinking: false,
943
- setIsThinking: (thinking) => set({ isThinking: thinking }),
944
- // Input state (for Ctrl+C clearing)
945
- inputValue: "",
946
- setInputValue: (value) => set({ inputValue: value }),
947
- clearInput: () => set({ inputValue: "" }),
948
- // Permission prompt
949
- permissionPrompt: null,
950
- setPermissionPrompt: (prompt) => set({ permissionPrompt: prompt }),
951
- // Config editor
952
- showConfigEditor: false,
953
- setShowConfigEditor: (show) => set({ showConfigEditor: show }),
954
- // MCP viewer
955
- showMcpViewer: false,
956
- setShowMcpViewer: (show) => set({ showMcpViewer: show }),
957
- // Exit handling
958
- exitRequested: false,
959
- setExitRequested: (requested) => set({ exitRequested: requested })
960
- }));
961
-
962
906
  // src/components/InputPrompt.tsx
963
907
  function looksLikeFilePath(input) {
964
908
  const trimmed = input.trim();
@@ -1032,7 +976,7 @@ function InputPrompt({
1032
976
  setFileSelectedIndex(0);
1033
977
  }, [filteredFiles]);
1034
978
  useInput2(
1035
- (_input, key) => {
979
+ (input, key) => {
1036
980
  if (fileAutocomplete?.active && filteredFiles.length > 0) {
1037
981
  if (key.upArrow) {
1038
982
  setFileSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredFiles.length - 1);
@@ -1817,6 +1761,12 @@ function App({
1817
1761
  const setShowMcpViewer = useCliStore((state) => state.setShowMcpViewer);
1818
1762
  const exitRequested = useCliStore((state) => state.exitRequested);
1819
1763
  const setIsThinking = useCliStore((state) => state.setIsThinking);
1764
+ const toggleAutoAcceptEdits = useCliStore((state) => state.toggleAutoAcceptEdits);
1765
+ useInput5((_input, key) => {
1766
+ if (key.tab && key.shift) {
1767
+ toggleAutoAcceptEdits();
1768
+ }
1769
+ });
1820
1770
  const [isBashMode, setIsBashMode] = useState4(false);
1821
1771
  const handleSubmit = React13.useCallback(
1822
1772
  async (input) => {
@@ -1957,12 +1907,12 @@ function TrustLocationSelector({ inProject, onSelect, onCancel }) {
1957
1907
 
1958
1908
  // src/components/RewindSelector.tsx
1959
1909
  import React16, { useState as useState5 } from "react";
1960
- import { Box as Box15, Text as Text15, useInput as useInput5 } from "ink";
1910
+ import { Box as Box15, Text as Text15, useInput as useInput6 } from "ink";
1961
1911
  import SelectInput3 from "ink-select-input";
1962
1912
  function RewindSelector({ messages, onSelect, onCancel }) {
1963
1913
  const [step, setStep] = useState5("selection");
1964
1914
  const [selectedMessageIndex, setSelectedMessageIndex] = useState5(null);
1965
- useInput5((input, key) => {
1915
+ useInput6((input, key) => {
1966
1916
  if (key.escape) {
1967
1917
  if (step === "confirmation") {
1968
1918
  setStep("selection");
@@ -2026,12 +1976,12 @@ function RewindSelector({ messages, onSelect, onCancel }) {
2026
1976
 
2027
1977
  // src/components/SessionSelector.tsx
2028
1978
  import React17, { useState as useState6 } from "react";
2029
- import { Box as Box16, Text as Text16, useInput as useInput6 } from "ink";
1979
+ import { Box as Box16, Text as Text16, useInput as useInput7 } from "ink";
2030
1980
  import SelectInput4 from "ink-select-input";
2031
1981
  function SessionSelector({ sessions, currentSession, onSelect, onCancel }) {
2032
1982
  const [step, setStep] = useState6("selection");
2033
1983
  const [selectedSession, setSelectedSession] = useState6(null);
2034
- useInput6((input, key) => {
1984
+ useInput7((_input, key) => {
2035
1985
  if (key.escape) {
2036
1986
  if (step === "confirmation") {
2037
1987
  setStep("selection");
@@ -2042,12 +1992,29 @@ function SessionSelector({ sessions, currentSession, onSelect, onCancel }) {
2042
1992
  }
2043
1993
  });
2044
1994
  const hasUnsavedWork = currentSession && currentSession.messages.length > 0;
1995
+ const formatTimeAgo = (timestamp) => {
1996
+ const now = /* @__PURE__ */ new Date();
1997
+ const then = new Date(timestamp);
1998
+ const diffMs = now.getTime() - then.getTime();
1999
+ const diffMins = Math.floor(diffMs / 6e4);
2000
+ const diffHours = Math.floor(diffMs / 36e5);
2001
+ const diffDays = Math.floor(diffMs / 864e5);
2002
+ if (diffMins < 60) {
2003
+ return `${diffMins}m`;
2004
+ } else if (diffHours < 24) {
2005
+ return `${diffHours}h`;
2006
+ } else {
2007
+ return `${diffDays}d`;
2008
+ }
2009
+ };
2045
2010
  const items = sessions.map((session, index) => {
2046
- const messageCount = session.messages.length;
2047
- const lastUpdated = new Date(session.updatedAt).toLocaleString();
2011
+ const userMessages = session.messages.filter((msg) => msg.role === "user");
2012
+ const lastUserMessage = userMessages[userMessages.length - 1];
2013
+ const preview = lastUserMessage ? lastUserMessage.content.slice(0, 50).replace(/\n/g, " ") + (lastUserMessage.content.length > 50 ? "..." : "") : "No messages";
2014
+ const timeAgo = formatTimeAgo(session.updatedAt);
2048
2015
  return {
2049
- label: `[${index + 1}] ${session.name} (${messageCount} msg, ${session.model})
2050
- Last updated: ${lastUpdated}`,
2016
+ key: session.id,
2017
+ label: `[${index + 1}] ${preview} (${timeAgo})`,
2051
2018
  value: session
2052
2019
  };
2053
2020
  });
@@ -2287,6 +2254,9 @@ var SessionStore = class {
2287
2254
  * Save a session to disk
2288
2255
  */
2289
2256
  async save(session) {
2257
+ if (session.messages.length === 0) {
2258
+ throw new Error("Cannot save session with no messages");
2259
+ }
2290
2260
  await this.init();
2291
2261
  const filePath = path3.join(this.basePath, `${session.id}.json`);
2292
2262
  try {
@@ -2329,13 +2299,14 @@ var SessionStore = class {
2329
2299
  }
2330
2300
  /**
2331
2301
  * List all saved sessions
2302
+ * @param limit - Optional limit on number of sessions to return (returns most recent)
2332
2303
  */
2333
- async list() {
2304
+ async list(limit) {
2334
2305
  await this.init();
2335
2306
  try {
2336
2307
  const files = await fs3.readdir(this.basePath);
2337
2308
  const jsonFiles = files.filter((f) => f.endsWith(".json"));
2338
- const sessions = await Promise.all(
2309
+ const sessionsWithFiles = await Promise.all(
2339
2310
  jsonFiles.map(async (file) => {
2340
2311
  const filePath = path3.join(this.basePath, file);
2341
2312
  const data = await fs3.readFile(filePath, "utf-8");
@@ -2346,10 +2317,23 @@ var SessionStore = class {
2346
2317
  }
2347
2318
  return msg;
2348
2319
  });
2349
- return session;
2320
+ return { session, filePath };
2350
2321
  })
2351
2322
  );
2352
- return sessions.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
2323
+ const validSessions = [];
2324
+ for (const { session, filePath } of sessionsWithFiles) {
2325
+ if (session.messages.length === 0) {
2326
+ try {
2327
+ await fs3.unlink(filePath);
2328
+ } catch (error) {
2329
+ console.error(`Failed to delete empty session ${session.id}:`, error);
2330
+ }
2331
+ } else {
2332
+ validSessions.push(session);
2333
+ }
2334
+ }
2335
+ const sorted = validSessions.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime());
2336
+ return limit ? sorted.slice(0, limit) : sorted;
2353
2337
  } catch (error) {
2354
2338
  console.error("Failed to list sessions:", error);
2355
2339
  return [];
@@ -3132,6 +3116,127 @@ You can use:
3132
3116
 
3133
3117
  // ../../b4m-core/packages/agents/src/ReActAgent.ts
3134
3118
  import { EventEmitter } from "events";
3119
+
3120
+ // ../../b4m-core/packages/agents/src/toolParallelizer.ts
3121
+ var DEFAULT_WRITE_TOOLS = /* @__PURE__ */ new Set([
3122
+ "edit_file",
3123
+ "edit_local_file",
3124
+ "create_file",
3125
+ "delete_file",
3126
+ "shell_execute",
3127
+ "bash_execute",
3128
+ "git_commit",
3129
+ "git_push"
3130
+ ]);
3131
+ function defaultIsReadOnlyTool(toolName) {
3132
+ return !DEFAULT_WRITE_TOOLS.has(toolName);
3133
+ }
3134
+ function getToolId(tool) {
3135
+ return `${tool.name}_${JSON.stringify(tool.arguments)}`;
3136
+ }
3137
+ function categorizeTools(toolsUsed, isReadOnly = defaultIsReadOnlyTool) {
3138
+ const parallelBatch = [];
3139
+ const sequentialBatch = [];
3140
+ const originalOrder = [];
3141
+ for (const tool of toolsUsed) {
3142
+ originalOrder.push(getToolId(tool));
3143
+ if (isReadOnly(tool.name)) {
3144
+ parallelBatch.push(tool);
3145
+ } else {
3146
+ sequentialBatch.push(tool);
3147
+ }
3148
+ }
3149
+ return {
3150
+ parallelBatch,
3151
+ sequentialBatch,
3152
+ originalOrder
3153
+ };
3154
+ }
3155
+ async function executeToolsInParallel(plan, executor, signal) {
3156
+ const results = /* @__PURE__ */ new Map();
3157
+ if (signal?.aborted) {
3158
+ throw new Error("Tool execution aborted");
3159
+ }
3160
+ if (plan.parallelBatch.length > 0) {
3161
+ const parallelPromises = plan.parallelBatch.map(async (tool) => {
3162
+ const toolId = getToolId(tool);
3163
+ if (signal?.aborted) {
3164
+ return {
3165
+ toolId,
3166
+ result: {
3167
+ toolName: tool.name,
3168
+ error: new Error("Tool execution aborted"),
3169
+ status: "rejected"
3170
+ }
3171
+ };
3172
+ }
3173
+ try {
3174
+ const result = await executor(tool);
3175
+ return {
3176
+ toolId,
3177
+ result: {
3178
+ toolName: tool.name,
3179
+ result,
3180
+ status: "fulfilled"
3181
+ }
3182
+ };
3183
+ } catch (error) {
3184
+ return {
3185
+ toolId,
3186
+ result: {
3187
+ toolName: tool.name,
3188
+ error: error instanceof Error ? error : new Error(String(error)),
3189
+ status: "rejected"
3190
+ }
3191
+ };
3192
+ }
3193
+ });
3194
+ const settledResults = await Promise.allSettled(parallelPromises);
3195
+ for (const settled of settledResults) {
3196
+ if (settled.status === "fulfilled") {
3197
+ results.set(settled.value.toolId, settled.value.result);
3198
+ }
3199
+ }
3200
+ }
3201
+ if (signal?.aborted) {
3202
+ throw new Error("Tool execution aborted");
3203
+ }
3204
+ for (const tool of plan.sequentialBatch) {
3205
+ const toolId = getToolId(tool);
3206
+ if (signal?.aborted) {
3207
+ results.set(toolId, {
3208
+ toolName: tool.name,
3209
+ error: new Error("Tool execution aborted"),
3210
+ status: "rejected"
3211
+ });
3212
+ throw new Error("Tool execution aborted");
3213
+ }
3214
+ try {
3215
+ const result = await executor(tool);
3216
+ results.set(toolId, {
3217
+ toolName: tool.name,
3218
+ result,
3219
+ status: "fulfilled"
3220
+ });
3221
+ } catch (error) {
3222
+ results.set(toolId, {
3223
+ toolName: tool.name,
3224
+ error: error instanceof Error ? error : new Error(String(error)),
3225
+ status: "rejected"
3226
+ });
3227
+ }
3228
+ }
3229
+ return results;
3230
+ }
3231
+ function shouldUseParallelExecution(toolsUsed, isReadOnly = defaultIsReadOnlyTool) {
3232
+ if (toolsUsed.length < 2) {
3233
+ return false;
3234
+ }
3235
+ const readOnlyCount = toolsUsed.filter((tool) => isReadOnly(tool.name)).length;
3236
+ return readOnlyCount >= 2;
3237
+ }
3238
+
3239
+ // ../../b4m-core/packages/agents/src/ReActAgent.ts
3135
3240
  var ReActAgent = class extends EventEmitter {
3136
3241
  constructor(context) {
3137
3242
  super();
@@ -3259,77 +3364,51 @@ ${options.context}` : this.getSystemPrompt()
3259
3364
  if (completionInfo.toolsUsed && completionInfo.toolsUsed.length > 0) {
3260
3365
  hadToolCalls = true;
3261
3366
  const thinkingBlocks = completionInfo.thinking || [];
3367
+ const unprocessedTools = [];
3262
3368
  for (const toolUse of completionInfo.toolsUsed) {
3263
- const toolCallId = `${toolUse.name}_${JSON.stringify(toolUse.arguments)}`;
3264
- if (processedToolIds.has(toolCallId)) {
3265
- continue;
3369
+ const toolCallIdStr = getToolId(toolUse);
3370
+ if (!processedToolIds.has(toolCallIdStr)) {
3371
+ processedToolIds.add(toolCallIdStr);
3372
+ unprocessedTools.push(toolUse);
3266
3373
  }
3267
- processedToolIds.add(toolCallId);
3268
- this.toolCallCount++;
3269
- const actionStep = {
3270
- type: "action",
3271
- content: `Using tool: ${toolUse.name}`,
3272
- metadata: {
3273
- toolName: toolUse.name,
3274
- toolInput: toolUse.arguments,
3275
- timestamp: Date.now()
3276
- }
3277
- };
3278
- this.steps.push(actionStep);
3279
- this.emit("action", actionStep);
3280
- const queuedObs = this.observationQueue.find((obs) => obs.toolName === toolUse.name);
3281
- let observation;
3282
- if (queuedObs) {
3283
- observation = queuedObs.result;
3284
- const index = this.observationQueue.indexOf(queuedObs);
3285
- this.observationQueue.splice(index, 1);
3286
- } else {
3287
- const tool = this.context.tools.find((t) => t.toolSchema.name === toolUse.name);
3288
- if (!tool) {
3289
- throw new Error(`Tool ${toolUse.name} not found in agent context`);
3290
- }
3291
- const params = typeof toolUse.arguments === "string" ? JSON.parse(toolUse.arguments) : toolUse.arguments;
3292
- observation = await tool.toolFn(params);
3293
- const toolCallId2 = `${toolUse.name}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
3294
- const assistantContent = [
3295
- // Include thinking blocks first (required by Anthropic when thinking is enabled)
3296
- ...thinkingBlocks,
3297
- // Then the tool use
3298
- {
3299
- type: "tool_use",
3300
- id: toolCallId2,
3301
- name: toolUse.name,
3302
- input: params
3303
- }
3304
- ];
3305
- this.context.logger.debug(
3306
- `[assistantContent] ${assistantContent.length} blocks (${thinkingBlocks.length} thinking, 1 tool_use)`
3307
- );
3308
- messages.push({
3309
- role: "assistant",
3310
- content: assistantContent
3311
- });
3312
- messages.push({
3313
- role: "user",
3314
- content: [
3315
- {
3316
- type: "tool_result",
3317
- tool_use_id: toolCallId2,
3318
- content: typeof observation === "string" ? observation : JSON.stringify(observation)
3319
- }
3320
- ]
3321
- });
3374
+ }
3375
+ if (unprocessedTools.length === 0) {
3376
+ } else if (options.parallelExecution && shouldUseParallelExecution(unprocessedTools, options.isReadOnlyTool ?? defaultIsReadOnlyTool)) {
3377
+ this.context.logger.debug(
3378
+ `[ReActAgent] Parallel execution enabled for ${unprocessedTools.length} tools`
3379
+ );
3380
+ for (const toolUse of unprocessedTools) {
3381
+ this.emitActionStep(toolUse);
3322
3382
  }
3323
- const observationStep = {
3324
- type: "observation",
3325
- content: typeof observation === "string" ? observation : JSON.stringify(observation),
3326
- metadata: {
3327
- toolName: toolUse.name,
3328
- timestamp: Date.now()
3383
+ const plan = categorizeTools(unprocessedTools, options.isReadOnlyTool ?? defaultIsReadOnlyTool);
3384
+ const results = await executeToolsInParallel(
3385
+ plan,
3386
+ (toolUse) => this.executeToolWithQueueFallback(toolUse),
3387
+ options.signal
3388
+ );
3389
+ for (const toolUse of unprocessedTools) {
3390
+ const toolIdStr = getToolId(toolUse);
3391
+ const result2 = results.get(toolIdStr);
3392
+ const observation = result2?.status === "fulfilled" ? result2.result ?? "" : `Error: ${result2?.error?.message ?? "Unknown error"}`;
3393
+ this.appendToolMessages(messages, toolUse, observation, thinkingBlocks);
3394
+ this.emitObservationStep(toolUse.name, observation);
3395
+ }
3396
+ } else {
3397
+ for (const toolUse of unprocessedTools) {
3398
+ this.emitActionStep(toolUse);
3399
+ const queuedObs = this.observationQueue.find((obs) => obs.toolId === getToolId(toolUse));
3400
+ let observation;
3401
+ if (queuedObs) {
3402
+ const result2 = queuedObs.result;
3403
+ const index = this.observationQueue.indexOf(queuedObs);
3404
+ this.observationQueue.splice(index, 1);
3405
+ observation = typeof result2 === "string" ? result2 : JSON.stringify(result2);
3406
+ } else {
3407
+ observation = await this.executeToolWithQueueFallback(toolUse);
3408
+ this.appendToolMessages(messages, toolUse, observation, thinkingBlocks);
3329
3409
  }
3330
- };
3331
- this.steps.push(observationStep);
3332
- this.emit("observation", observationStep);
3410
+ this.emitObservationStep(toolUse.name, observation);
3411
+ }
3333
3412
  }
3334
3413
  }
3335
3414
  }
@@ -3466,7 +3545,159 @@ Remember: You are an autonomous AGENT. Act independently and solve problems proa
3466
3545
  getToolCallCount() {
3467
3546
  return this.toolCallCount;
3468
3547
  }
3548
+ /**
3549
+ * Create and emit an action step for a tool use
3550
+ */
3551
+ emitActionStep(toolUse) {
3552
+ this.toolCallCount++;
3553
+ const actionStep = {
3554
+ type: "action",
3555
+ content: `Using tool: ${toolUse.name}`,
3556
+ metadata: {
3557
+ toolName: toolUse.name,
3558
+ toolInput: toolUse.arguments,
3559
+ timestamp: Date.now()
3560
+ }
3561
+ };
3562
+ this.steps.push(actionStep);
3563
+ this.emit("action", actionStep);
3564
+ }
3565
+ /**
3566
+ * Create and emit an observation step
3567
+ */
3568
+ emitObservationStep(toolName, observation) {
3569
+ const observationStep = {
3570
+ type: "observation",
3571
+ content: observation,
3572
+ metadata: {
3573
+ toolName,
3574
+ timestamp: Date.now()
3575
+ }
3576
+ };
3577
+ this.steps.push(observationStep);
3578
+ this.emit("observation", observationStep);
3579
+ }
3580
+ /**
3581
+ * Parse tool arguments, handling both string and object forms
3582
+ */
3583
+ parseToolArguments(args) {
3584
+ return typeof args === "string" ? JSON.parse(args) : args;
3585
+ }
3586
+ /**
3587
+ * Execute a tool and return the result as a string.
3588
+ * Checks observation queue first for backward compatibility.
3589
+ */
3590
+ async executeToolWithQueueFallback(toolUse) {
3591
+ const queuedObs = this.observationQueue.find((obs) => obs.toolId === getToolId(toolUse));
3592
+ if (queuedObs) {
3593
+ const result2 = queuedObs.result;
3594
+ const index = this.observationQueue.indexOf(queuedObs);
3595
+ this.observationQueue.splice(index, 1);
3596
+ return typeof result2 === "string" ? result2 : JSON.stringify(result2);
3597
+ }
3598
+ const tool = this.context.tools.find((t) => t.toolSchema.name === toolUse.name);
3599
+ if (!tool) {
3600
+ throw new Error(`Tool ${toolUse.name} not found in agent context`);
3601
+ }
3602
+ const params = this.parseToolArguments(toolUse.arguments);
3603
+ const result = await tool.toolFn(params);
3604
+ return typeof result === "string" ? result : JSON.stringify(result);
3605
+ }
3606
+ /**
3607
+ * Build and append tool call/result messages for the conversation history
3608
+ */
3609
+ appendToolMessages(messages, toolUse, observation, thinkingBlocks) {
3610
+ const params = this.parseToolArguments(toolUse.arguments);
3611
+ const msgToolCallId = `${toolUse.name}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
3612
+ const assistantContent = [
3613
+ ...thinkingBlocks,
3614
+ {
3615
+ type: "tool_use",
3616
+ id: msgToolCallId,
3617
+ name: toolUse.name,
3618
+ input: params
3619
+ }
3620
+ ];
3621
+ messages.push({
3622
+ role: "assistant",
3623
+ content: assistantContent
3624
+ });
3625
+ messages.push({
3626
+ role: "user",
3627
+ content: [
3628
+ {
3629
+ type: "tool_result",
3630
+ tool_use_id: msgToolCallId,
3631
+ content: observation
3632
+ }
3633
+ ]
3634
+ });
3635
+ }
3636
+ };
3637
+
3638
+ // src/config/toolSafety.ts
3639
+ import { z as z2 } from "zod";
3640
+ var ToolCategorySchema = z2.enum([
3641
+ "auto_approve",
3642
+ // Safe tools that run automatically without permission
3643
+ "prompt_always",
3644
+ // Dangerous tools that ALWAYS require permission (cannot be trusted)
3645
+ "prompt_default"
3646
+ // Tools that prompt by default but can be trusted
3647
+ ]);
3648
+ var ToolSafetyConfigSchema = z2.object({
3649
+ categories: z2.record(z2.string(), ToolCategorySchema),
3650
+ trustedTools: z2.array(z2.string())
3651
+ });
3652
+ var DEFAULT_TOOL_CATEGORIES = {
3653
+ // ===== AUTO APPROVE (Safe tools) =====
3654
+ // These tools have no side effects and are always safe to execute
3655
+ math_evaluate: "auto_approve",
3656
+ current_datetime: "auto_approve",
3657
+ dice_roll: "auto_approve",
3658
+ prompt_enhancement: "auto_approve",
3659
+ weather_info: "prompt_default",
3660
+ // ===== PROMPT ALWAYS (Dangerous tools) =====
3661
+ // These tools can modify files, execute code, or have other dangerous side effects
3662
+ // They ALWAYS require permission and cannot be trusted automatically
3663
+ edit_file: "prompt_always",
3664
+ edit_local_file: "prompt_always",
3665
+ create_file: "prompt_always",
3666
+ delete_file: "prompt_always",
3667
+ shell_execute: "prompt_always",
3668
+ bash_execute: "prompt_always",
3669
+ git_commit: "prompt_always",
3670
+ git_push: "prompt_always",
3671
+ // ===== PROMPT DEFAULT (Repository read tools) =====
3672
+ // These tools read from the repository but don't modify anything
3673
+ // Users can trust them if they want to avoid prompts
3674
+ web_search: "prompt_default",
3675
+ deep_research: "prompt_default",
3676
+ file_read: "prompt_default",
3677
+ grep_search: "prompt_default",
3678
+ glob_files: "prompt_default",
3679
+ get_file_tree: "prompt_default",
3680
+ git_status: "prompt_default",
3681
+ git_diff: "prompt_default",
3682
+ git_log: "prompt_default",
3683
+ git_branch: "prompt_default"
3469
3684
  };
3685
+ function getToolCategory(toolName, customCategories) {
3686
+ if (customCategories && toolName in customCategories) {
3687
+ return customCategories[toolName];
3688
+ }
3689
+ if (toolName in DEFAULT_TOOL_CATEGORIES) {
3690
+ return DEFAULT_TOOL_CATEGORIES[toolName];
3691
+ }
3692
+ return "prompt_default";
3693
+ }
3694
+ function canTrustTool(toolName, customCategories) {
3695
+ const category = getToolCategory(toolName, customCategories);
3696
+ return category !== "prompt_always";
3697
+ }
3698
+ function isReadOnlyTool(toolName, customCategories) {
3699
+ return getToolCategory(toolName, customCategories) !== "prompt_always";
3700
+ }
3470
3701
 
3471
3702
  // src/core/prompts.ts
3472
3703
  var TOOL_GREP_SEARCH = "grep_search";
@@ -3576,38 +3807,38 @@ Remember: Use context from previous messages to understand follow-up questions.$
3576
3807
  // ../../b4m-core/packages/services/dist/src/referService/generateCodes.js
3577
3808
  import { randomBytes } from "crypto";
3578
3809
  import range from "lodash/range.js";
3579
- import { z as z2 } from "zod";
3580
- var generateReferralCodesSchema = z2.object({
3581
- count: z2.number().optional(),
3582
- unlimitedUse: z2.boolean().optional(),
3583
- expiresAt: z2.date().optional()
3810
+ import { z as z3 } from "zod";
3811
+ var generateReferralCodesSchema = z3.object({
3812
+ count: z3.number().optional(),
3813
+ unlimitedUse: z3.boolean().optional(),
3814
+ expiresAt: z3.date().optional()
3584
3815
  });
3585
3816
 
3586
3817
  // ../../b4m-core/packages/services/dist/src/referService/delete.js
3587
- import { z as z3 } from "zod";
3588
- var deleteInviteCodesSchema = z3.object({
3589
- ids: z3.array(z3.string())
3818
+ import { z as z4 } from "zod";
3819
+ var deleteInviteCodesSchema = z4.object({
3820
+ ids: z4.array(z4.string())
3590
3821
  });
3591
3822
 
3592
3823
  // ../../b4m-core/packages/services/dist/src/userService/login.js
3593
- import { z as z4 } from "zod";
3824
+ import { z as z5 } from "zod";
3594
3825
  import bcrypt from "bcryptjs";
3595
- var loginUserSchema = z4.object({
3596
- usernameOrEmail: z4.string(),
3597
- password: z4.string(),
3598
- metadata: z4.object({
3599
- loginTime: z4.date(),
3600
- userAgent: z4.string(),
3601
- browser: z4.string(),
3602
- operatingSystem: z4.string(),
3603
- deviceType: z4.string(),
3604
- screenResolution: z4.string(),
3605
- viewportSize: z4.string(),
3606
- colorDepth: z4.number(),
3607
- pixelDepth: z4.number(),
3608
- devicePixelRatio: z4.number(),
3609
- ip: z4.string().optional().default(""),
3610
- location: z4.string().optional()
3826
+ var loginUserSchema = z5.object({
3827
+ usernameOrEmail: z5.string(),
3828
+ password: z5.string(),
3829
+ metadata: z5.object({
3830
+ loginTime: z5.date(),
3831
+ userAgent: z5.string(),
3832
+ browser: z5.string(),
3833
+ operatingSystem: z5.string(),
3834
+ deviceType: z5.string(),
3835
+ screenResolution: z5.string(),
3836
+ viewportSize: z5.string(),
3837
+ colorDepth: z5.number(),
3838
+ pixelDepth: z5.number(),
3839
+ devicePixelRatio: z5.number(),
3840
+ ip: z5.string().optional().default(""),
3841
+ location: z5.string().optional()
3611
3842
  }).optional()
3612
3843
  });
3613
3844
 
@@ -3617,78 +3848,78 @@ import escapeRegExp from "lodash/escapeRegExp.js";
3617
3848
 
3618
3849
  // ../../b4m-core/packages/services/dist/src/userService/forgotPassword.js
3619
3850
  import { randomUUID } from "crypto";
3620
- import { z as z5 } from "zod";
3621
- var forgotPasswordUserSchema = z5.object({
3622
- email: z5.string().email()
3851
+ import { z as z6 } from "zod";
3852
+ var forgotPasswordUserSchema = z6.object({
3853
+ email: z6.string().email()
3623
3854
  });
3624
3855
 
3625
3856
  // ../../b4m-core/packages/services/dist/src/userService/update.js
3626
3857
  import bcrypt3 from "bcryptjs";
3627
- import { z as z6 } from "zod";
3628
- var updateUserSchema = z6.object({
3629
- name: z6.string().optional(),
3630
- username: z6.string().optional(),
3858
+ import { z as z7 } from "zod";
3859
+ var updateUserSchema = z7.object({
3860
+ name: z7.string().optional(),
3861
+ username: z7.string().optional(),
3631
3862
  // email field removed - users must use the secure email change verification flow
3632
3863
  // See requestEmailChange and verifyEmailChange in userService
3633
- password: z6.string().nullable().optional(),
3634
- team: z6.string().nullable().optional(),
3635
- role: z6.string().nullable().optional(),
3636
- phone: z6.string().nullable().optional(),
3637
- preferredLanguage: z6.string().nullable().optional(),
3638
- preferredContact: z6.string().nullable().optional(),
3639
- preferredVoice: z6.string().nullable().optional(),
3640
- tshirtSize: z6.string().nullable().optional(),
3641
- geoLocation: z6.string().nullable().optional(),
3642
- lastNotebookId: z6.string().nullable().optional(),
3643
- tags: z6.array(z6.string()).nullable().optional(),
3644
- lastCreditsPurchasedAt: z6.date().nullable().optional(),
3645
- systemFiles: z6.array(z6.object({
3646
- fileId: z6.string(),
3647
- enabled: z6.boolean()
3864
+ password: z7.string().nullable().optional(),
3865
+ team: z7.string().nullable().optional(),
3866
+ role: z7.string().nullable().optional(),
3867
+ phone: z7.string().nullable().optional(),
3868
+ preferredLanguage: z7.string().nullable().optional(),
3869
+ preferredContact: z7.string().nullable().optional(),
3870
+ preferredVoice: z7.string().nullable().optional(),
3871
+ tshirtSize: z7.string().nullable().optional(),
3872
+ geoLocation: z7.string().nullable().optional(),
3873
+ lastNotebookId: z7.string().nullable().optional(),
3874
+ tags: z7.array(z7.string()).nullable().optional(),
3875
+ lastCreditsPurchasedAt: z7.date().nullable().optional(),
3876
+ systemFiles: z7.array(z7.object({
3877
+ fileId: z7.string(),
3878
+ enabled: z7.boolean()
3648
3879
  })).nullable().optional(),
3649
- securityQuestions: z6.array(z6.object({ question: z6.string(), answer: z6.string() })).nullable().optional(),
3650
- photoUrl: z6.string().nullable().optional(),
3651
- showCreditsUsed: z6.boolean().optional()
3880
+ securityQuestions: z7.array(z7.object({ question: z7.string(), answer: z7.string() })).nullable().optional(),
3881
+ photoUrl: z7.string().nullable().optional(),
3882
+ showCreditsUsed: z7.boolean().optional()
3652
3883
  });
3653
3884
 
3654
3885
  // ../../b4m-core/packages/services/dist/src/userService/adminUpdate.js
3655
- import { z as z8 } from "zod";
3886
+ import { z as z9 } from "zod";
3656
3887
 
3657
3888
  // ../../b4m-core/packages/services/dist/src/friendshipService/sendFriendRequest.js
3658
- import { z as z7 } from "zod";
3659
- var sendFriendRequestSchema = z7.object({
3660
- requesterId: z7.string(),
3661
- recipientId: z7.string(),
3662
- message: z7.string().optional()
3889
+ import { z as z8 } from "zod";
3890
+ var sendFriendRequestSchema = z8.object({
3891
+ requesterId: z8.string(),
3892
+ recipientId: z8.string(),
3893
+ message: z8.string().optional()
3663
3894
  });
3664
3895
 
3665
3896
  // ../../b4m-core/packages/services/dist/src/userService/adminUpdate.js
3666
3897
  var adminUpdateUserSchema = updateUserSchema.extend({
3667
- id: z8.string(),
3898
+ id: z9.string(),
3668
3899
  // Admins can directly update email addresses without verification
3669
- email: z8.string().email().optional(),
3670
- role: z8.string().optional().nullable(),
3671
- isAdmin: z8.boolean().optional(),
3672
- organizationId: z8.string().optional().nullable(),
3673
- storageLimit: z8.number().optional(),
3674
- currentCredits: z8.number().optional(),
3675
- isBanned: z8.boolean().optional(),
3676
- isModerated: z8.boolean().optional(),
3677
- subscribedUntil: z8.string().optional().nullable(),
3678
- systemFiles: z8.array(z8.object({ fileId: z8.string(), enabled: z8.boolean() })).optional(),
3679
- level: z8.enum(["DemoUser", "PaidUser", "VIPUser", "ManagerUser", "AdminUser"]).optional(),
3680
- lastNotebookId: z8.string().optional().nullable(),
3681
- userNotes: z8.array(z8.object({ timestamp: z8.string(), note: z8.string(), userName: z8.string() })).optional(),
3682
- numReferralsAvailable: z8.number().optional()
3900
+ email: z9.string().email().optional(),
3901
+ role: z9.string().optional().nullable(),
3902
+ isAdmin: z9.boolean().optional(),
3903
+ organizationId: z9.string().optional().nullable(),
3904
+ storageLimit: z9.number().optional(),
3905
+ currentCredits: z9.number().optional(),
3906
+ isBanned: z9.boolean().optional(),
3907
+ isModerated: z9.boolean().optional(),
3908
+ subscribedUntil: z9.string().optional().nullable(),
3909
+ systemFiles: z9.array(z9.object({ fileId: z9.string(), enabled: z9.boolean() })).optional(),
3910
+ level: z9.enum(["DemoUser", "PaidUser", "VIPUser", "ManagerUser", "AdminUser"]).optional(),
3911
+ lastNotebookId: z9.string().optional().nullable(),
3912
+ userNotes: z9.array(z9.object({ timestamp: z9.string(), note: z9.string(), userName: z9.string() })).optional(),
3913
+ numReferralsAvailable: z9.number().optional()
3683
3914
  });
3684
3915
 
3685
3916
  // ../../b4m-core/packages/services/dist/src/userService/register.js
3686
- import { z as z10 } from "zod";
3917
+ import { z as z11 } from "zod";
3687
3918
  import bcrypt4 from "bcryptjs";
3688
3919
 
3689
3920
  // ../../b4m-core/packages/services/dist/src/creditService/addCredits.js
3690
- import { z as z9 } from "zod";
3691
- var AddCreditsSchema = z9.discriminatedUnion("type", [
3921
+ import { z as z10 } from "zod";
3922
+ var AddCreditsSchema = z10.discriminatedUnion("type", [
3692
3923
  PurchaseTransaction.omit({ createdAt: true, updatedAt: true }),
3693
3924
  SubscriptionCreditTransaction.omit({ createdAt: true, updatedAt: true }),
3694
3925
  GenericCreditAddTransaction.omit({ createdAt: true, updatedAt: true }),
@@ -3696,57 +3927,57 @@ var AddCreditsSchema = z9.discriminatedUnion("type", [
3696
3927
  ]);
3697
3928
 
3698
3929
  // ../../b4m-core/packages/services/dist/src/userService/register.js
3699
- var registerUserSchema = z10.object({
3700
- username: z10.string(),
3701
- email: z10.string(),
3702
- name: z10.string(),
3703
- inviteCode: z10.string(),
3704
- password: z10.string(),
3705
- metadata: z10.object({
3706
- loginTime: z10.date(),
3707
- userAgent: z10.string(),
3708
- browser: z10.string(),
3709
- operatingSystem: z10.string(),
3710
- deviceType: z10.string(),
3711
- screenResolution: z10.string(),
3712
- viewportSize: z10.string(),
3713
- colorDepth: z10.number(),
3714
- pixelDepth: z10.number(),
3715
- devicePixelRatio: z10.number(),
3716
- ip: z10.string().optional().default(""),
3717
- location: z10.string().optional()
3930
+ var registerUserSchema = z11.object({
3931
+ username: z11.string(),
3932
+ email: z11.string(),
3933
+ name: z11.string(),
3934
+ inviteCode: z11.string(),
3935
+ password: z11.string(),
3936
+ metadata: z11.object({
3937
+ loginTime: z11.date(),
3938
+ userAgent: z11.string(),
3939
+ browser: z11.string(),
3940
+ operatingSystem: z11.string(),
3941
+ deviceType: z11.string(),
3942
+ screenResolution: z11.string(),
3943
+ viewportSize: z11.string(),
3944
+ colorDepth: z11.number(),
3945
+ pixelDepth: z11.number(),
3946
+ devicePixelRatio: z11.number(),
3947
+ ip: z11.string().optional().default(""),
3948
+ location: z11.string().optional()
3718
3949
  }).optional()
3719
3950
  });
3720
3951
 
3721
3952
  // ../../b4m-core/packages/services/dist/src/userService/adminDelete.js
3722
- import { z as z11 } from "zod";
3723
- var adminDeleteUserSchema = z11.object({
3724
- id: z11.string()
3953
+ import { z as z12 } from "zod";
3954
+ var adminDeleteUserSchema = z12.object({
3955
+ id: z12.string()
3725
3956
  });
3726
3957
 
3727
3958
  // ../../b4m-core/packages/services/dist/src/userService/searchUserCollection.js
3728
- import { z as z12 } from "zod";
3729
- var searchUserCollectionSchema = z12.object({
3730
- userId: z12.string(),
3731
- page: z12.coerce.number().optional().default(1),
3732
- limit: z12.coerce.number().optional().default(10),
3733
- search: z12.string().optional().default(""),
3734
- type: z12.nativeEnum(CollectionType).optional()
3959
+ import { z as z13 } from "zod";
3960
+ var searchUserCollectionSchema = z13.object({
3961
+ userId: z13.string(),
3962
+ page: z13.coerce.number().optional().default(1),
3963
+ limit: z13.coerce.number().optional().default(10),
3964
+ search: z13.string().optional().default(""),
3965
+ type: z13.nativeEnum(CollectionType).optional()
3735
3966
  });
3736
3967
 
3737
3968
  // ../../b4m-core/packages/services/dist/src/userService/recalculateUserStorage.js
3738
- import { z as z13 } from "zod";
3739
- var recalculateUserStorageSchema = z13.object({
3969
+ import { z as z14 } from "zod";
3970
+ var recalculateUserStorageSchema = z14.object({
3740
3971
  /**
3741
3972
  * The user to recalculate the storage for
3742
3973
  */
3743
- userId: z13.string()
3974
+ userId: z14.string()
3744
3975
  });
3745
3976
 
3746
3977
  // ../../b4m-core/packages/services/dist/src/userService/listRecentActivities.js
3747
- import { z as z14 } from "zod";
3748
- var listRecentActivitiesSchema = z14.object({
3749
- coverage: z14.enum(["all", "important"]).default("important")
3978
+ import { z as z15 } from "zod";
3979
+ var listRecentActivitiesSchema = z15.object({
3980
+ coverage: z15.enum(["all", "important"]).default("important")
3750
3981
  });
3751
3982
  var IMPORTANT_COUNTER_NAMES = [
3752
3983
  SessionEvents.CREATE_SESSION,
@@ -3760,82 +3991,82 @@ var IMPORTANT_COUNTER_NAMES = [
3760
3991
 
3761
3992
  // ../../b4m-core/packages/services/dist/src/userService/sendEmailVerification.js
3762
3993
  import { randomUUID as randomUUID2 } from "crypto";
3763
- import { z as z15 } from "zod";
3764
- var sendEmailVerificationSchema = z15.object({
3765
- userId: z15.string()
3994
+ import { z as z16 } from "zod";
3995
+ var sendEmailVerificationSchema = z16.object({
3996
+ userId: z16.string()
3766
3997
  });
3767
3998
 
3768
3999
  // ../../b4m-core/packages/services/dist/src/userService/verifyEmailToken.js
3769
- import { z as z16 } from "zod";
4000
+ import { z as z17 } from "zod";
3770
4001
 
3771
4002
  // ../../b4m-core/packages/services/dist/src/utils/crypto.js
3772
4003
  import crypto from "crypto";
3773
4004
 
3774
4005
  // ../../b4m-core/packages/services/dist/src/userService/verifyEmailToken.js
3775
- var verifyEmailTokenSchema = z16.object({
3776
- token: z16.string()
4006
+ var verifyEmailTokenSchema = z17.object({
4007
+ token: z17.string()
3777
4008
  });
3778
4009
 
3779
4010
  // ../../b4m-core/packages/services/dist/src/userService/resendEmailVerification.js
3780
4011
  import { randomUUID as randomUUID3 } from "crypto";
3781
- import { z as z17 } from "zod";
3782
- var resendEmailVerificationSchema = z17.object({
3783
- userId: z17.string()
4012
+ import { z as z18 } from "zod";
4013
+ var resendEmailVerificationSchema = z18.object({
4014
+ userId: z18.string()
3784
4015
  });
3785
4016
 
3786
4017
  // ../../b4m-core/packages/services/dist/src/userService/requestEmailChange.js
3787
4018
  import { randomUUID as randomUUID4 } from "crypto";
3788
- import { z as z18 } from "zod";
3789
- var requestEmailChangeSchema = z18.object({
3790
- userId: z18.string(),
3791
- newEmail: z18.string().email(),
3792
- password: z18.string()
4019
+ import { z as z19 } from "zod";
4020
+ var requestEmailChangeSchema = z19.object({
4021
+ userId: z19.string(),
4022
+ newEmail: z19.string().email(),
4023
+ password: z19.string()
3793
4024
  });
3794
4025
 
3795
4026
  // ../../b4m-core/packages/services/dist/src/userService/verifyEmailChange.js
3796
- import { z as z19 } from "zod";
3797
- var verifyEmailChangeSchema = z19.object({
3798
- token: z19.string()
4027
+ import { z as z20 } from "zod";
4028
+ var verifyEmailChangeSchema = z20.object({
4029
+ token: z20.string()
3799
4030
  });
3800
4031
 
3801
4032
  // ../../b4m-core/packages/services/dist/src/userService/cancelEmailChange.js
3802
- import { z as z20 } from "zod";
3803
- var cancelEmailChangeSchema = z20.object({
3804
- userId: z20.string()
4033
+ import { z as z21 } from "zod";
4034
+ var cancelEmailChangeSchema = z21.object({
4035
+ userId: z21.string()
3805
4036
  });
3806
4037
 
3807
4038
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/create.js
3808
4039
  import { randomBytes as randomBytes2 } from "crypto";
3809
4040
  import bcrypt5 from "bcryptjs";
3810
- import { z as z21 } from "zod";
3811
- var createUserApiKeySchema = z21.object({
3812
- name: z21.string().min(1).max(100),
3813
- scopes: z21.array(z21.nativeEnum(ApiKeyScope)).min(1),
3814
- expiresAt: z21.date().optional(),
3815
- rateLimit: z21.object({
3816
- requestsPerMinute: z21.number().min(1).max(1e3).default(60),
3817
- requestsPerDay: z21.number().min(1).max(1e4).default(1e3)
4041
+ import { z as z22 } from "zod";
4042
+ var createUserApiKeySchema = z22.object({
4043
+ name: z22.string().min(1).max(100),
4044
+ scopes: z22.array(z22.nativeEnum(ApiKeyScope)).min(1),
4045
+ expiresAt: z22.date().optional(),
4046
+ rateLimit: z22.object({
4047
+ requestsPerMinute: z22.number().min(1).max(1e3).default(60),
4048
+ requestsPerDay: z22.number().min(1).max(1e4).default(1e3)
3818
4049
  }).optional(),
3819
- metadata: z21.object({
3820
- clientIP: z21.string().optional(),
3821
- userAgent: z21.string().optional(),
3822
- createdFrom: z21.enum(["dashboard", "cli", "api"])
4050
+ metadata: z22.object({
4051
+ clientIP: z22.string().optional(),
4052
+ userAgent: z22.string().optional(),
4053
+ createdFrom: z22.enum(["dashboard", "cli", "api"])
3823
4054
  })
3824
4055
  });
3825
4056
 
3826
4057
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/revoke.js
3827
- import { z as z22 } from "zod";
3828
- var revokeUserApiKeySchema = z22.object({
3829
- keyId: z22.string(),
3830
- reason: z22.string().optional()
4058
+ import { z as z23 } from "zod";
4059
+ var revokeUserApiKeySchema = z23.object({
4060
+ keyId: z23.string(),
4061
+ reason: z23.string().optional()
3831
4062
  });
3832
4063
 
3833
4064
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/rotate.js
3834
4065
  import { randomBytes as randomBytes3 } from "crypto";
3835
4066
  import bcrypt6 from "bcryptjs";
3836
- import { z as z23 } from "zod";
3837
- var rotateUserApiKeySchema = z23.object({
3838
- keyId: z23.string()
4067
+ import { z as z24 } from "zod";
4068
+ var rotateUserApiKeySchema = z24.object({
4069
+ keyId: z24.string()
3839
4070
  });
3840
4071
 
3841
4072
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/validate.js
@@ -3982,29 +4213,29 @@ var EVENT_GROUPS = [
3982
4213
  ];
3983
4214
 
3984
4215
  // ../../b4m-core/packages/services/dist/src/countersService/generateReport.js
3985
- import { z as z25 } from "zod";
4216
+ import { z as z26 } from "zod";
3986
4217
 
3987
4218
  // ../../b4m-core/packages/services/dist/src/countersService/getAllCounterFrom24Hours.js
3988
- import { z as z24 } from "zod";
4219
+ import { z as z25 } from "zod";
3989
4220
  import dayjs2 from "dayjs";
3990
- var getCounterTotalsForLast24HoursSchema = z24.object({
3991
- date: z24.string(),
3992
- endDate: z24.string().optional()
4221
+ var getCounterTotalsForLast24HoursSchema = z25.object({
4222
+ date: z25.string(),
4223
+ endDate: z25.string().optional()
3993
4224
  });
3994
4225
 
3995
4226
  // ../../b4m-core/packages/services/dist/src/countersService/generateReport.js
3996
- var generateDailyReportSchema = z25.object({
3997
- date: z25.string(),
3998
- startDate: z25.string().optional(),
3999
- endDate: z25.string().optional()
4227
+ var generateDailyReportSchema = z26.object({
4228
+ date: z26.string(),
4229
+ startDate: z26.string().optional(),
4230
+ endDate: z26.string().optional()
4000
4231
  });
4001
4232
 
4002
4233
  // ../../b4m-core/packages/services/dist/src/countersService/incrementUserCounter.js
4003
- import { z as z26 } from "zod";
4004
- var incrementUserCounterSchema = z26.object({
4005
- action: z26.string(),
4006
- increment: z26.coerce.number().default(1).optional(),
4007
- metadata: z26.record(z26.unknown()).optional()
4234
+ import { z as z27 } from "zod";
4235
+ var incrementUserCounterSchema = z27.object({
4236
+ action: z27.string(),
4237
+ increment: z27.coerce.number().default(1).optional(),
4238
+ metadata: z27.record(z27.unknown()).optional()
4008
4239
  });
4009
4240
 
4010
4241
  // ../../b4m-core/packages/services/dist/src/countersService/sendSlackReport.js
@@ -4025,42 +4256,42 @@ import yauzl from "yauzl";
4025
4256
  import axios3 from "axios";
4026
4257
 
4027
4258
  // ../../b4m-core/packages/services/dist/src/importHistoryService/importOpenaiHistory.js
4028
- import { z as z27 } from "zod";
4259
+ import { z as z28 } from "zod";
4029
4260
  import last from "lodash/last.js";
4030
- var epochDate = () => z27.preprocess((val) => new Date(Number(val) * 1e3), z27.date());
4031
- var openaiConversationSchema = z27.object({
4032
- id: z27.string(),
4033
- title: z27.string(),
4261
+ var epochDate = () => z28.preprocess((val) => new Date(Number(val) * 1e3), z28.date());
4262
+ var openaiConversationSchema = z28.object({
4263
+ id: z28.string(),
4264
+ title: z28.string(),
4034
4265
  create_time: epochDate(),
4035
4266
  update_time: epochDate().nullable(),
4036
- mapping: z27.record(
4037
- z27.string(),
4038
- z27.object({
4039
- id: z27.string(),
4040
- parent: z27.string().nullable(),
4041
- children: z27.array(z27.string()),
4042
- message: z27.object({
4043
- id: z27.string(),
4267
+ mapping: z28.record(
4268
+ z28.string(),
4269
+ z28.object({
4270
+ id: z28.string(),
4271
+ parent: z28.string().nullable(),
4272
+ children: z28.array(z28.string()),
4273
+ message: z28.object({
4274
+ id: z28.string(),
4044
4275
  create_time: epochDate(),
4045
4276
  update_time: epochDate().nullable(),
4046
- author: z27.object({
4047
- role: z27.string(),
4048
- name: z27.string().nullable(),
4049
- metadata: z27.any()
4277
+ author: z28.object({
4278
+ role: z28.string(),
4279
+ name: z28.string().nullable(),
4280
+ metadata: z28.any()
4050
4281
  // Accept any metadata structure
4051
4282
  }).passthrough(),
4052
4283
  // Allow extra fields in author
4053
- content: z27.object({
4054
- content_type: z27.string(),
4055
- parts: z27.array(z27.any()).optional()
4284
+ content: z28.object({
4285
+ content_type: z28.string(),
4286
+ parts: z28.array(z28.any()).optional()
4056
4287
  // Accept any type in parts array (strings, objects, etc.)
4057
4288
  }).passthrough(),
4058
4289
  // Allow extra fields in content
4059
- status: z27.string(),
4060
- end_turn: z27.boolean().nullable(),
4061
- metadata: z27.any(),
4290
+ status: z28.string(),
4291
+ end_turn: z28.boolean().nullable(),
4292
+ metadata: z28.any(),
4062
4293
  // Accept any metadata structure since it varies widely
4063
- recipient: z27.string()
4294
+ recipient: z28.string()
4064
4295
  }).passthrough().nullable()
4065
4296
  }).passthrough()
4066
4297
  // Allow extra fields in mapping node
@@ -4068,38 +4299,38 @@ var openaiConversationSchema = z27.object({
4068
4299
  }).passthrough();
4069
4300
 
4070
4301
  // ../../b4m-core/packages/services/dist/src/importHistoryService/importClaudeHistory.js
4071
- import { z as z28 } from "zod";
4072
- var claudeChatMessageSchema = z28.object({
4073
- uuid: z28.string().uuid(),
4074
- text: z28.string(),
4075
- content: z28.array(
4076
- z28.object({
4077
- type: z28.string(),
4302
+ import { z as z29 } from "zod";
4303
+ var claudeChatMessageSchema = z29.object({
4304
+ uuid: z29.string().uuid(),
4305
+ text: z29.string(),
4306
+ content: z29.array(
4307
+ z29.object({
4308
+ type: z29.string(),
4078
4309
  // Accept any type: "text", "image", "tool_result", etc.
4079
- text: z28.string().optional()
4310
+ text: z29.string().optional()
4080
4311
  // Make text optional since tool_result may not have it
4081
4312
  }).passthrough()
4082
4313
  // Allow all other fields
4083
4314
  ),
4084
- sender: z28.enum(["human", "assistant"]),
4085
- created_at: z28.coerce.date(),
4086
- updated_at: z28.coerce.date(),
4087
- attachments: z28.array(z28.any()),
4315
+ sender: z29.enum(["human", "assistant"]),
4316
+ created_at: z29.coerce.date(),
4317
+ updated_at: z29.coerce.date(),
4318
+ attachments: z29.array(z29.any()),
4088
4319
  // Accept any attachment structure
4089
- files: z28.array(z28.any())
4320
+ files: z29.array(z29.any())
4090
4321
  // Accept any file structure
4091
4322
  }).passthrough();
4092
- var claudeConversationSchema = z28.object({
4093
- uuid: z28.string().uuid(),
4094
- name: z28.string(),
4095
- summary: z28.string().optional(),
4323
+ var claudeConversationSchema = z29.object({
4324
+ uuid: z29.string().uuid(),
4325
+ name: z29.string(),
4326
+ summary: z29.string().optional(),
4096
4327
  // Summary field is optional
4097
- created_at: z28.coerce.date(),
4098
- updated_at: z28.coerce.date(),
4099
- account: z28.object({
4100
- uuid: z28.string().uuid()
4328
+ created_at: z29.coerce.date(),
4329
+ updated_at: z29.coerce.date(),
4330
+ account: z29.object({
4331
+ uuid: z29.string().uuid()
4101
4332
  }),
4102
- chat_messages: z28.array(claudeChatMessageSchema)
4333
+ chat_messages: z29.array(claudeChatMessageSchema)
4103
4334
  }).passthrough();
4104
4335
 
4105
4336
  // ../../b4m-core/packages/services/dist/src/importHistoryService/index.js
@@ -4110,357 +4341,357 @@ var ImportSource;
4110
4341
  })(ImportSource || (ImportSource = {}));
4111
4342
 
4112
4343
  // ../../b4m-core/packages/services/dist/src/sessionService/create.js
4113
- import { z as z29 } from "zod";
4114
- var createSessionParametersSchema = z29.object({
4115
- name: z29.string(),
4116
- knowledgeIds: z29.array(z29.string()).optional(),
4117
- artifactIds: z29.array(z29.string()).optional(),
4118
- agentIds: z29.array(z29.string()).optional(),
4119
- tags: z29.array(z29.object({ name: z29.string(), strength: z29.number() })).optional(),
4120
- summary: z29.string().optional(),
4121
- summaryAt: z29.date().optional(),
4122
- clonedSourceId: z29.string().optional().nullable(),
4123
- forkedSourceId: z29.string().optional().nullable(),
4124
- projectId: z29.string().optional(),
4125
- lastUsedModel: z29.string().optional().nullable()
4344
+ import { z as z30 } from "zod";
4345
+ var createSessionParametersSchema = z30.object({
4346
+ name: z30.string(),
4347
+ knowledgeIds: z30.array(z30.string()).optional(),
4348
+ artifactIds: z30.array(z30.string()).optional(),
4349
+ agentIds: z30.array(z30.string()).optional(),
4350
+ tags: z30.array(z30.object({ name: z30.string(), strength: z30.number() })).optional(),
4351
+ summary: z30.string().optional(),
4352
+ summaryAt: z30.date().optional(),
4353
+ clonedSourceId: z30.string().optional().nullable(),
4354
+ forkedSourceId: z30.string().optional().nullable(),
4355
+ projectId: z30.string().optional(),
4356
+ lastUsedModel: z30.string().optional().nullable()
4126
4357
  });
4127
4358
 
4128
4359
  // ../../b4m-core/packages/services/dist/src/sessionService/delete.js
4129
- import { z as z30 } from "zod";
4130
- var deleteSessionSchema = z30.object({
4131
- id: z30.string()
4360
+ import { z as z31 } from "zod";
4361
+ var deleteSessionSchema = z31.object({
4362
+ id: z31.string()
4132
4363
  });
4133
4364
 
4134
4365
  // ../../b4m-core/packages/services/dist/src/sessionService/sumarize.js
4135
- import { z as z31 } from "zod";
4136
- var sumarizeSessionSchema = z31.object({
4137
- id: z31.string()
4366
+ import { z as z32 } from "zod";
4367
+ var sumarizeSessionSchema = z32.object({
4368
+ id: z32.string()
4138
4369
  });
4139
4370
 
4140
4371
  // ../../b4m-core/packages/services/dist/src/projectService/create.js
4141
- import { z as z32 } from "zod";
4142
- var createProjectSchema = z32.object({
4143
- name: z32.string().min(1),
4144
- description: z32.string().min(1),
4145
- sessionIds: z32.array(z32.string()).optional(),
4146
- fileIds: z32.array(z32.string()).optional()
4372
+ import { z as z33 } from "zod";
4373
+ var createProjectSchema = z33.object({
4374
+ name: z33.string().min(1),
4375
+ description: z33.string().min(1),
4376
+ sessionIds: z33.array(z33.string()).optional(),
4377
+ fileIds: z33.array(z33.string()).optional()
4147
4378
  });
4148
4379
 
4149
4380
  // ../../b4m-core/packages/services/dist/src/projectService/search.js
4150
- import { z as z33 } from "zod";
4151
- var searchProjectsSchema = z33.object({
4152
- search: z33.string().optional(),
4153
- filters: z33.object({
4154
- favorite: z33.coerce.boolean().optional(),
4155
- scope: z33.record(z33.any()).optional()
4381
+ import { z as z34 } from "zod";
4382
+ var searchProjectsSchema = z34.object({
4383
+ search: z34.string().optional(),
4384
+ filters: z34.object({
4385
+ favorite: z34.coerce.boolean().optional(),
4386
+ scope: z34.record(z34.any()).optional()
4156
4387
  }).optional(),
4157
- pagination: z33.object({
4158
- page: z33.coerce.number().optional(),
4159
- limit: z33.coerce.number().optional()
4388
+ pagination: z34.object({
4389
+ page: z34.coerce.number().optional(),
4390
+ limit: z34.coerce.number().optional()
4160
4391
  }).optional(),
4161
- orderBy: z33.object({
4162
- by: z33.enum(["createdAt", "updatedAt"]).optional(),
4163
- direction: z33.enum(["asc", "desc"]).optional()
4392
+ orderBy: z34.object({
4393
+ by: z34.enum(["createdAt", "updatedAt"]).optional(),
4394
+ direction: z34.enum(["asc", "desc"]).optional()
4164
4395
  }).optional()
4165
4396
  });
4166
4397
 
4167
4398
  // ../../b4m-core/packages/services/dist/src/projectService/addSessions.js
4168
- import { z as z44 } from "zod";
4399
+ import { z as z45 } from "zod";
4169
4400
  import uniq2 from "lodash/uniq.js";
4170
4401
 
4171
4402
  // ../../b4m-core/packages/services/dist/src/sharingService/accept.js
4172
- import { z as z34 } from "zod";
4173
- var acceptInviteSchema = z34.object({
4174
- id: z34.string()
4403
+ import { z as z35 } from "zod";
4404
+ var acceptInviteSchema = z35.object({
4405
+ id: z35.string()
4175
4406
  });
4176
4407
 
4177
4408
  // ../../b4m-core/packages/services/dist/src/sharingService/cancel.js
4178
- import { z as z35 } from "zod";
4179
- var cancelInviteSchema = z35.object({
4180
- id: z35.string(),
4181
- type: z35.nativeEnum(InviteType),
4182
- email: z35.string().email().optional()
4409
+ import { z as z36 } from "zod";
4410
+ var cancelInviteSchema = z36.object({
4411
+ id: z36.string(),
4412
+ type: z36.nativeEnum(InviteType),
4413
+ email: z36.string().email().optional()
4183
4414
  });
4184
4415
 
4185
4416
  // ../../b4m-core/packages/services/dist/src/sharingService/cancelOwnDocument.js
4186
- import { z as z36 } from "zod";
4187
- var cancelOwnDocumentInvitesSchema = z36.object({
4188
- documentId: z36.string(),
4189
- type: z36.nativeEnum(InviteType)
4417
+ import { z as z37 } from "zod";
4418
+ var cancelOwnDocumentInvitesSchema = z37.object({
4419
+ documentId: z37.string(),
4420
+ type: z37.nativeEnum(InviteType)
4190
4421
  });
4191
4422
 
4192
4423
  // ../../b4m-core/packages/services/dist/src/sharingService/create.js
4193
- import { z as z37 } from "zod";
4424
+ import { z as z38 } from "zod";
4194
4425
  var defaultExpiration = () => new Date((/* @__PURE__ */ new Date()).getFullYear() + 100, (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate());
4195
4426
  var DEFAULT_AVAILABLE = 1;
4196
- var createInviteSchema = z37.object({
4197
- id: z37.string(),
4198
- type: z37.nativeEnum(InviteType),
4199
- permissions: z37.array(z37.nativeEnum(Permission)),
4200
- recipients: z37.string().array().optional(),
4201
- description: z37.string().optional(),
4202
- expiresAt: z37.date().optional().default(defaultExpiration()),
4203
- available: z37.number().optional().default(DEFAULT_AVAILABLE)
4427
+ var createInviteSchema = z38.object({
4428
+ id: z38.string(),
4429
+ type: z38.nativeEnum(InviteType),
4430
+ permissions: z38.array(z38.nativeEnum(Permission)),
4431
+ recipients: z38.string().array().optional(),
4432
+ description: z38.string().optional(),
4433
+ expiresAt: z38.date().optional().default(defaultExpiration()),
4434
+ available: z38.number().optional().default(DEFAULT_AVAILABLE)
4204
4435
  });
4205
4436
 
4206
4437
  // ../../b4m-core/packages/services/dist/src/sharingService/get.js
4207
- import { z as z38 } from "zod";
4208
- var getInviteSchema = z38.object({
4209
- id: z38.string(),
4210
- withUsername: z38.boolean().optional()
4438
+ import { z as z39 } from "zod";
4439
+ var getInviteSchema = z39.object({
4440
+ id: z39.string(),
4441
+ withUsername: z39.boolean().optional()
4211
4442
  });
4212
4443
 
4213
4444
  // ../../b4m-core/packages/services/dist/src/sharingService/listByDocumentIdAndType.js
4214
- import { z as z39 } from "zod";
4215
- var listInviteByDocumentIdAndTypeSchema = z39.object({
4216
- documentId: z39.string(),
4217
- type: z39.nativeEnum(InviteType)
4445
+ import { z as z40 } from "zod";
4446
+ var listInviteByDocumentIdAndTypeSchema = z40.object({
4447
+ documentId: z40.string(),
4448
+ type: z40.nativeEnum(InviteType)
4218
4449
  });
4219
4450
 
4220
4451
  // ../../b4m-core/packages/services/dist/src/sharingService/listOwnPending.js
4221
- import { z as z40 } from "zod";
4222
- var listOwnPendingInvitesSchema = z40.object({
4223
- limit: z40.number().min(1).max(100).default(20),
4224
- page: z40.number().min(1).default(1)
4452
+ import { z as z41 } from "zod";
4453
+ var listOwnPendingInvitesSchema = z41.object({
4454
+ limit: z41.number().min(1).max(100).default(20),
4455
+ page: z41.number().min(1).default(1)
4225
4456
  });
4226
4457
 
4227
4458
  // ../../b4m-core/packages/services/dist/src/sharingService/refuse.js
4228
- import { z as z41 } from "zod";
4229
- var refuseInviteSchema = z41.object({
4230
- id: z41.string()
4459
+ import { z as z42 } from "zod";
4460
+ var refuseInviteSchema = z42.object({
4461
+ id: z42.string()
4231
4462
  });
4232
4463
 
4233
4464
  // ../../b4m-core/packages/services/dist/src/sharingService/revoke.js
4234
- import { z as z42 } from "zod";
4235
- var revokeSharingSchema = z42.object({
4236
- id: z42.string(),
4237
- type: z42.enum(["files", "sessions", "projects"]),
4238
- userId: z42.string(),
4239
- projectId: z42.string().optional()
4465
+ import { z as z43 } from "zod";
4466
+ var revokeSharingSchema = z43.object({
4467
+ id: z43.string(),
4468
+ type: z43.enum(["files", "sessions", "projects"]),
4469
+ userId: z43.string(),
4470
+ projectId: z43.string().optional()
4240
4471
  });
4241
4472
 
4242
4473
  // ../../b4m-core/packages/services/dist/src/projectService/addFiles.js
4243
- import { z as z43 } from "zod";
4474
+ import { z as z44 } from "zod";
4244
4475
  import uniq from "lodash/uniq.js";
4245
- var addFilesProjectSchema = z43.object({
4246
- projectId: z43.string().nonempty(),
4247
- fileIds: z43.array(z43.string().nonempty())
4476
+ var addFilesProjectSchema = z44.object({
4477
+ projectId: z44.string().nonempty(),
4478
+ fileIds: z44.array(z44.string().nonempty())
4248
4479
  });
4249
4480
 
4250
4481
  // ../../b4m-core/packages/services/dist/src/projectService/addSessions.js
4251
- var addSessionsProjectSchema = z44.object({
4252
- projectId: z44.string().nonempty(),
4253
- sessionIds: z44.array(z44.string().nonempty())
4482
+ var addSessionsProjectSchema = z45.object({
4483
+ projectId: z45.string().nonempty(),
4484
+ sessionIds: z45.array(z45.string().nonempty())
4254
4485
  });
4255
4486
 
4256
4487
  // ../../b4m-core/packages/services/dist/src/projectService/get.js
4257
- import { z as z45 } from "zod";
4258
- var getProjectSchema = z45.object({
4259
- id: z45.string()
4260
- });
4261
-
4262
- // ../../b4m-core/packages/services/dist/src/projectService/update.js
4263
4488
  import { z as z46 } from "zod";
4264
- var updateProjectSchema = z46.object({
4265
- id: z46.string(),
4266
- name: z46.string().optional(),
4267
- description: z46.string().optional()
4489
+ var getProjectSchema = z46.object({
4490
+ id: z46.string()
4268
4491
  });
4269
4492
 
4270
- // ../../b4m-core/packages/services/dist/src/projectService/delete.js
4493
+ // ../../b4m-core/packages/services/dist/src/projectService/update.js
4271
4494
  import { z as z47 } from "zod";
4272
- var deleteProjectSchema = z47.object({
4273
- id: z47.string()
4495
+ var updateProjectSchema = z47.object({
4496
+ id: z47.string(),
4497
+ name: z47.string().optional(),
4498
+ description: z47.string().optional()
4274
4499
  });
4275
4500
 
4276
- // ../../b4m-core/packages/services/dist/src/projectService/removeFiles.js
4501
+ // ../../b4m-core/packages/services/dist/src/projectService/delete.js
4277
4502
  import { z as z48 } from "zod";
4278
- var removeProjectFilesSchema = z48.object({
4279
- projectId: z48.string(),
4280
- fileIds: z48.array(z48.string())
4503
+ var deleteProjectSchema = z48.object({
4504
+ id: z48.string()
4281
4505
  });
4282
4506
 
4283
- // ../../b4m-core/packages/services/dist/src/projectService/removeSessions.js
4507
+ // ../../b4m-core/packages/services/dist/src/projectService/removeFiles.js
4284
4508
  import { z as z49 } from "zod";
4285
- var removeProjectSessionsSchema = z49.object({
4509
+ var removeProjectFilesSchema = z49.object({
4286
4510
  projectId: z49.string(),
4287
- sessionIds: z49.array(z49.string())
4511
+ fileIds: z49.array(z49.string())
4288
4512
  });
4289
4513
 
4290
- // ../../b4m-core/packages/services/dist/src/projectService/listSessions.js
4514
+ // ../../b4m-core/packages/services/dist/src/projectService/removeSessions.js
4291
4515
  import { z as z50 } from "zod";
4292
- var listProjectSessionsSchema = z50.object({
4293
- projectId: z50.string()
4516
+ var removeProjectSessionsSchema = z50.object({
4517
+ projectId: z50.string(),
4518
+ sessionIds: z50.array(z50.string())
4294
4519
  });
4295
4520
 
4296
- // ../../b4m-core/packages/services/dist/src/projectService/listFiles.js
4521
+ // ../../b4m-core/packages/services/dist/src/projectService/listSessions.js
4297
4522
  import { z as z51 } from "zod";
4298
- var listProjectFilesSchema = z51.object({
4523
+ var listProjectSessionsSchema = z51.object({
4299
4524
  projectId: z51.string()
4300
4525
  });
4301
4526
 
4302
- // ../../b4m-core/packages/services/dist/src/projectService/listInvites.js
4527
+ // ../../b4m-core/packages/services/dist/src/projectService/listFiles.js
4303
4528
  import { z as z52 } from "zod";
4304
- var listProjectInvitesParamsSchema = z52.object({
4305
- id: z52.string(),
4306
- statuses: z52.string().optional().default(""),
4307
- limit: z52.coerce.number().optional().default(10),
4308
- page: z52.coerce.number().optional().default(1)
4529
+ var listProjectFilesSchema = z52.object({
4530
+ projectId: z52.string()
4309
4531
  });
4310
4532
 
4311
- // ../../b4m-core/packages/services/dist/src/projectService/addSystemPrompts.js
4533
+ // ../../b4m-core/packages/services/dist/src/projectService/listInvites.js
4312
4534
  import { z as z53 } from "zod";
4313
- var addSystemPromptsSchema = z53.object({
4314
- projectId: z53.string(),
4315
- fileIds: z53.array(z53.string())
4535
+ var listProjectInvitesParamsSchema = z53.object({
4536
+ id: z53.string(),
4537
+ statuses: z53.string().optional().default(""),
4538
+ limit: z53.coerce.number().optional().default(10),
4539
+ page: z53.coerce.number().optional().default(1)
4316
4540
  });
4317
4541
 
4318
- // ../../b4m-core/packages/services/dist/src/projectService/toggleSystemPrompt.js
4542
+ // ../../b4m-core/packages/services/dist/src/projectService/addSystemPrompts.js
4319
4543
  import { z as z54 } from "zod";
4320
- var toggleSystemPromptSchema = z54.object({
4544
+ var addSystemPromptsSchema = z54.object({
4321
4545
  projectId: z54.string(),
4322
- fileId: z54.string()
4546
+ fileIds: z54.array(z54.string())
4323
4547
  });
4324
4548
 
4325
- // ../../b4m-core/packages/services/dist/src/projectService/removeSystemPrompt.js
4549
+ // ../../b4m-core/packages/services/dist/src/projectService/toggleSystemPrompt.js
4326
4550
  import { z as z55 } from "zod";
4327
- var removeSystemPromptSchema = z55.object({
4551
+ var toggleSystemPromptSchema = z55.object({
4328
4552
  projectId: z55.string(),
4329
4553
  fileId: z55.string()
4330
4554
  });
4331
4555
 
4332
- // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
4333
- import { z as z58 } from "zod";
4334
-
4335
- // ../../b4m-core/packages/services/dist/src/favoriteService/create.js
4556
+ // ../../b4m-core/packages/services/dist/src/projectService/removeSystemPrompt.js
4336
4557
  import { z as z56 } from "zod";
4337
- var createFavoriteParametersSchema = z56.object({
4338
- documentId: z56.string(),
4339
- documentType: z56.nativeEnum(FavoriteDocumentType)
4558
+ var removeSystemPromptSchema = z56.object({
4559
+ projectId: z56.string(),
4560
+ fileId: z56.string()
4340
4561
  });
4341
4562
 
4342
- // ../../b4m-core/packages/services/dist/src/favoriteService/delete.js
4563
+ // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
4564
+ import { z as z59 } from "zod";
4565
+
4566
+ // ../../b4m-core/packages/services/dist/src/favoriteService/create.js
4343
4567
  import { z as z57 } from "zod";
4344
- var deleteFavoriteParametersSchema = z57.object({
4568
+ var createFavoriteParametersSchema = z57.object({
4345
4569
  documentId: z57.string(),
4346
4570
  documentType: z57.nativeEnum(FavoriteDocumentType)
4347
4571
  });
4348
4572
 
4349
- // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
4350
- var addFavoriteParametersSchema = z58.object({
4351
- projectId: z58.string()
4573
+ // ../../b4m-core/packages/services/dist/src/favoriteService/delete.js
4574
+ import { z as z58 } from "zod";
4575
+ var deleteFavoriteParametersSchema = z58.object({
4576
+ documentId: z58.string(),
4577
+ documentType: z58.nativeEnum(FavoriteDocumentType)
4352
4578
  });
4353
4579
 
4354
- // ../../b4m-core/packages/services/dist/src/projectService/deleteFavorite.js
4355
- import { z as z59 } from "zod";
4356
- var deleteFavoriteParametersSchema2 = z59.object({
4580
+ // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
4581
+ var addFavoriteParametersSchema = z59.object({
4357
4582
  projectId: z59.string()
4358
4583
  });
4359
4584
 
4360
- // ../../b4m-core/packages/services/dist/src/projectService/removeNonExistentFiles.js
4585
+ // ../../b4m-core/packages/services/dist/src/projectService/deleteFavorite.js
4361
4586
  import { z as z60 } from "zod";
4362
- var removeNonExistentFilesSchema = z60.object({
4587
+ var deleteFavoriteParametersSchema2 = z60.object({
4363
4588
  projectId: z60.string()
4364
4589
  });
4365
4590
 
4366
- // ../../b4m-core/packages/services/dist/src/projectService/leaveProject.js
4591
+ // ../../b4m-core/packages/services/dist/src/projectService/removeNonExistentFiles.js
4367
4592
  import { z as z61 } from "zod";
4368
- var leaveProjectParamsSchema = z61.object({
4369
- id: z61.string(),
4370
- userIdToRemove: z61.string().optional()
4371
- // Optional: if provided, this is a removal by owner
4593
+ var removeNonExistentFilesSchema = z61.object({
4594
+ projectId: z61.string()
4372
4595
  });
4373
4596
 
4374
- // ../../b4m-core/packages/services/dist/src/sessionService/update.js
4375
- import uniq3 from "lodash/uniq.js";
4376
- import isEqual from "lodash/isEqual.js";
4597
+ // ../../b4m-core/packages/services/dist/src/projectService/leaveProject.js
4377
4598
  import { z as z62 } from "zod";
4378
- var updateSessionParamtersSchema = z62.object({
4599
+ var leaveProjectParamsSchema = z62.object({
4379
4600
  id: z62.string(),
4380
- name: z62.string().optional(),
4381
- knowledgeIds: z62.array(z62.string()).optional(),
4382
- artifactIds: z62.array(z62.string()).optional(),
4383
- tags: z62.array(z62.object({ name: z62.string(), strength: z62.number() })).optional(),
4384
- lastUsedModel: z62.string().optional()
4601
+ userIdToRemove: z62.string().optional()
4602
+ // Optional: if provided, this is a removal by owner
4385
4603
  });
4386
4604
 
4387
- // ../../b4m-core/packages/services/dist/src/sessionService/clone.js
4605
+ // ../../b4m-core/packages/services/dist/src/sessionService/update.js
4606
+ import uniq3 from "lodash/uniq.js";
4607
+ import isEqual from "lodash/isEqual.js";
4388
4608
  import { z as z63 } from "zod";
4389
- var cloneSessionSchema = z63.object({
4390
- id: z63.string()
4609
+ var updateSessionParamtersSchema = z63.object({
4610
+ id: z63.string(),
4611
+ name: z63.string().optional(),
4612
+ knowledgeIds: z63.array(z63.string()).optional(),
4613
+ artifactIds: z63.array(z63.string()).optional(),
4614
+ tags: z63.array(z63.object({ name: z63.string(), strength: z63.number() })).optional(),
4615
+ lastUsedModel: z63.string().optional()
4391
4616
  });
4392
4617
 
4393
- // ../../b4m-core/packages/services/dist/src/sessionService/fork.js
4618
+ // ../../b4m-core/packages/services/dist/src/sessionService/clone.js
4394
4619
  import { z as z64 } from "zod";
4395
- var forkSessionSchema = z64.object({
4396
- sessionId: z64.string(),
4397
- messageId: z64.string()
4620
+ var cloneSessionSchema = z64.object({
4621
+ id: z64.string()
4398
4622
  });
4399
4623
 
4400
- // ../../b4m-core/packages/services/dist/src/sessionService/snip.js
4624
+ // ../../b4m-core/packages/services/dist/src/sessionService/fork.js
4401
4625
  import { z as z65 } from "zod";
4402
- var snipSessionSchema = z65.object({
4626
+ var forkSessionSchema = z65.object({
4403
4627
  sessionId: z65.string(),
4404
4628
  messageId: z65.string()
4405
4629
  });
4406
4630
 
4407
- // ../../b4m-core/packages/services/dist/src/sessionService/get.js
4631
+ // ../../b4m-core/packages/services/dist/src/sessionService/snip.js
4408
4632
  import { z as z66 } from "zod";
4409
- var getSessionSchema = z66.object({
4410
- id: z66.string()
4633
+ var snipSessionSchema = z66.object({
4634
+ sessionId: z66.string(),
4635
+ messageId: z66.string()
4411
4636
  });
4412
4637
 
4413
- // ../../b4m-core/packages/services/dist/src/sessionService/deleteMessage.js
4638
+ // ../../b4m-core/packages/services/dist/src/sessionService/get.js
4414
4639
  import { z as z67 } from "zod";
4415
- var deleteSessionMessageSchema = z67.object({
4416
- sessionId: z67.string(),
4417
- messageId: z67.string()
4640
+ var getSessionSchema = z67.object({
4641
+ id: z67.string()
4418
4642
  });
4419
4643
 
4420
- // ../../b4m-core/packages/services/dist/src/sessionService/addFavorite.js
4644
+ // ../../b4m-core/packages/services/dist/src/sessionService/deleteMessage.js
4421
4645
  import { z as z68 } from "zod";
4422
- var addFavoriteParametersSchema2 = z68.object({
4423
- sessionId: z68.string()
4646
+ var deleteSessionMessageSchema = z68.object({
4647
+ sessionId: z68.string(),
4648
+ messageId: z68.string()
4424
4649
  });
4425
4650
 
4426
- // ../../b4m-core/packages/services/dist/src/sessionService/deleteFavorite.js
4651
+ // ../../b4m-core/packages/services/dist/src/sessionService/addFavorite.js
4427
4652
  import { z as z69 } from "zod";
4428
- var deleteFavoriteParametersSchema3 = z69.object({
4653
+ var addFavoriteParametersSchema2 = z69.object({
4429
4654
  sessionId: z69.string()
4430
4655
  });
4431
4656
 
4432
- // ../../b4m-core/packages/services/dist/src/sessionService/autoName.js
4657
+ // ../../b4m-core/packages/services/dist/src/sessionService/deleteFavorite.js
4433
4658
  import { z as z70 } from "zod";
4434
- var autoNameParameterSchema = z70.object({
4435
- sessionId: z70.string(),
4659
+ var deleteFavoriteParametersSchema3 = z70.object({
4660
+ sessionId: z70.string()
4661
+ });
4662
+
4663
+ // ../../b4m-core/packages/services/dist/src/sessionService/autoName.js
4664
+ import { z as z71 } from "zod";
4665
+ var autoNameParameterSchema = z71.object({
4666
+ sessionId: z71.string(),
4436
4667
  /** The maximum number of words to include in the title */
4437
- maxWords: z70.number().optional()
4668
+ maxWords: z71.number().optional()
4438
4669
  });
4439
4670
 
4440
4671
  // ../../b4m-core/packages/services/dist/src/organizationService/search.js
4441
- import { z as z71 } from "zod";
4442
- var searchSchema2 = z71.object({
4672
+ import { z as z72 } from "zod";
4673
+ var searchSchema2 = z72.object({
4443
4674
  /**
4444
4675
  * Text search query (searches in name and description)
4445
4676
  */
4446
- query: z71.string().optional(),
4677
+ query: z72.string().optional(),
4447
4678
  /**
4448
4679
  * Filter by personal organizations
4449
4680
  */
4450
- filters: z71.object({
4451
- personal: z71.union([z71.enum(["true", "false"]).transform((val) => val === "true"), z71.boolean()]).optional(),
4452
- userId: z71.string().optional()
4681
+ filters: z72.object({
4682
+ personal: z72.union([z72.enum(["true", "false"]).transform((val) => val === "true"), z72.boolean()]).optional(),
4683
+ userId: z72.string().optional()
4453
4684
  }).default({}),
4454
- pagination: z71.object({
4455
- page: z71.coerce.number().int().positive().default(1),
4456
- limit: z71.coerce.number().int().positive().max(100).default(10)
4685
+ pagination: z72.object({
4686
+ page: z72.coerce.number().int().positive().default(1),
4687
+ limit: z72.coerce.number().int().positive().max(100).default(10)
4457
4688
  }).default({
4458
4689
  page: 1,
4459
4690
  limit: 10
4460
4691
  }),
4461
- orderBy: z71.object({
4462
- field: z71.enum(["name", "createdAt", "updatedAt"]).default("name"),
4463
- direction: z71.enum(["asc", "desc"]).default("asc")
4692
+ orderBy: z72.object({
4693
+ field: z72.enum(["name", "createdAt", "updatedAt"]).default("name"),
4694
+ direction: z72.enum(["asc", "desc"]).default("asc")
4464
4695
  }).default({
4465
4696
  field: "name",
4466
4697
  direction: "asc"
@@ -4468,357 +4699,357 @@ var searchSchema2 = z71.object({
4468
4699
  });
4469
4700
 
4470
4701
  // ../../b4m-core/packages/services/dist/src/organizationService/get.js
4471
- import { z as z72 } from "zod";
4472
- var getSchema = z72.object({
4702
+ import { z as z73 } from "zod";
4703
+ var getSchema = z73.object({
4473
4704
  /**
4474
4705
  * Organization ID
4475
4706
  */
4476
- id: z72.string().min(1)
4707
+ id: z73.string().min(1)
4477
4708
  });
4478
4709
 
4479
4710
  // ../../b4m-core/packages/services/dist/src/organizationService/addMember.js
4480
- import { z as z73 } from "zod";
4481
- var addMemberSchema = z73.object({
4482
- userId: z73.string().optional(),
4483
- email: z73.string().optional(),
4484
- organizationId: z73.string(),
4485
- force: z73.boolean().optional()
4711
+ import { z as z74 } from "zod";
4712
+ var addMemberSchema = z74.object({
4713
+ userId: z74.string().optional(),
4714
+ email: z74.string().optional(),
4715
+ organizationId: z74.string(),
4716
+ force: z74.boolean().optional()
4486
4717
  // If true, add the user to the organization even if it's at full capacity
4487
4718
  });
4488
4719
 
4489
4720
  // ../../b4m-core/packages/services/dist/src/organizationService/getUsers.js
4490
- import { z as z74 } from "zod";
4491
- var getUsersSchema = z74.object({
4492
- id: z74.string()
4721
+ import { z as z75 } from "zod";
4722
+ var getUsersSchema = z75.object({
4723
+ id: z75.string()
4493
4724
  });
4494
4725
 
4495
4726
  // ../../b4m-core/packages/services/dist/src/organizationService/create.js
4496
- import { z as z75 } from "zod";
4497
- var createSchema = z75.object({
4498
- name: z75.string(),
4499
- personal: z75.boolean().default(false),
4500
- seats: z75.number().default(1),
4501
- stripeCustomerId: z75.string().nullable(),
4502
- billingOwnerId: z75.string().optional(),
4727
+ import { z as z76 } from "zod";
4728
+ var createSchema = z76.object({
4729
+ name: z76.string(),
4730
+ personal: z76.boolean().default(false),
4731
+ seats: z76.number().default(1),
4732
+ stripeCustomerId: z76.string().nullable(),
4733
+ billingOwnerId: z76.string().optional(),
4503
4734
  // Optional billing owner (defaults to user if not provided)
4504
- managerId: z75.string().optional()
4735
+ managerId: z76.string().optional()
4505
4736
  // Optional team manager
4506
4737
  });
4507
4738
 
4508
4739
  // ../../b4m-core/packages/services/dist/src/organizationService/update.js
4509
- import { z as z76 } from "zod";
4510
- var updateSchema = z76.object({
4511
- id: z76.string(),
4512
- name: z76.string().optional(),
4513
- description: z76.string().optional(),
4514
- billingContact: z76.string().optional(),
4515
- currentCredits: z76.coerce.number().optional(),
4516
- systemPrompt: z76.string().max(1e4).optional()
4740
+ import { z as z77 } from "zod";
4741
+ var updateSchema = z77.object({
4742
+ id: z77.string(),
4743
+ name: z77.string().optional(),
4744
+ description: z77.string().optional(),
4745
+ billingContact: z77.string().optional(),
4746
+ currentCredits: z77.coerce.number().optional(),
4747
+ systemPrompt: z77.string().max(1e4).optional()
4517
4748
  // ~2500 tokens
4518
4749
  });
4519
4750
 
4520
4751
  // ../../b4m-core/packages/services/dist/src/organizationService/delete.js
4521
- import { z as z77 } from "zod";
4522
- var deleteSchema = z77.object({
4752
+ import { z as z78 } from "zod";
4753
+ var deleteSchema = z78.object({
4523
4754
  /**
4524
4755
  * Organization ID
4525
4756
  */
4526
- id: z77.string().min(1)
4757
+ id: z78.string().min(1)
4527
4758
  });
4528
4759
 
4529
4760
  // ../../b4m-core/packages/services/dist/src/organizationService/listPendingUsers.js
4530
- import { z as z78 } from "zod";
4531
- var listPendingUsersSchema = z78.object({
4532
- organizationId: z78.string()
4761
+ import { z as z79 } from "zod";
4762
+ var listPendingUsersSchema = z79.object({
4763
+ organizationId: z79.string()
4533
4764
  });
4534
4765
 
4535
4766
  // ../../b4m-core/packages/services/dist/src/organizationService/revokeAccess.js
4536
- import { z as z79 } from "zod";
4537
- var revokeAccessSchema = z79.object({
4538
- id: z79.string(),
4539
- userId: z79.string()
4767
+ import { z as z80 } from "zod";
4768
+ var revokeAccessSchema = z80.object({
4769
+ id: z80.string(),
4770
+ userId: z80.string()
4540
4771
  });
4541
4772
 
4542
4773
  // ../../b4m-core/packages/services/dist/src/organizationService/leave.js
4543
- import { z as z80 } from "zod";
4544
- var organizationLeaveSchema = z80.object({
4545
- id: z80.string()
4774
+ import { z as z81 } from "zod";
4775
+ var organizationLeaveSchema = z81.object({
4776
+ id: z81.string()
4546
4777
  });
4547
4778
 
4548
4779
  // ../../b4m-core/packages/services/dist/src/apiKeyService/create.js
4549
- import { z as z81 } from "zod";
4550
- var createApiKeySchema = z81.object({
4551
- apiKey: z81.string().min(6),
4552
- description: z81.string().optional().default(""),
4553
- isActive: z81.boolean().optional().default(true),
4554
- type: z81.nativeEnum(ApiKeyType),
4555
- expireDays: z81.number().min(1).max(365).default(90)
4780
+ import { z as z82 } from "zod";
4781
+ var createApiKeySchema = z82.object({
4782
+ apiKey: z82.string().min(6),
4783
+ description: z82.string().optional().default(""),
4784
+ isActive: z82.boolean().optional().default(true),
4785
+ type: z82.nativeEnum(ApiKeyType),
4786
+ expireDays: z82.number().min(1).max(365).default(90)
4556
4787
  // Default 90-day expiration
4557
4788
  });
4558
4789
 
4559
4790
  // ../../b4m-core/packages/services/dist/src/apiKeyService/set.js
4560
- import { z as z82 } from "zod";
4561
- var setApiKeySchema = z82.object({
4562
- id: z82.string(),
4563
- type: z82.nativeEnum(ApiKeyType)
4791
+ import { z as z83 } from "zod";
4792
+ var setApiKeySchema = z83.object({
4793
+ id: z83.string(),
4794
+ type: z83.nativeEnum(ApiKeyType)
4564
4795
  });
4565
4796
 
4566
4797
  // ../../b4m-core/packages/services/dist/src/apiKeyService/delete.js
4567
- import { z as z83 } from "zod";
4568
- var deleteApiKeySchema = z83.object({
4569
- id: z83.string()
4798
+ import { z as z84 } from "zod";
4799
+ var deleteApiKeySchema = z84.object({
4800
+ id: z84.string()
4570
4801
  });
4571
4802
 
4572
4803
  // ../../b4m-core/packages/services/dist/src/fabFileService/get.js
4573
- import { z as z84 } from "zod";
4574
- var getFabFileSchema = z84.object({
4575
- id: z84.string()
4804
+ import { z as z85 } from "zod";
4805
+ var getFabFileSchema = z85.object({
4806
+ id: z85.string()
4576
4807
  });
4577
4808
 
4578
4809
  // ../../b4m-core/packages/services/dist/src/fabFileService/list.js
4579
- import { z as z85 } from "zod";
4580
- var listFabFilesSchema = z85.object({
4581
- ids: z85.array(z85.string()).optional()
4810
+ import { z as z86 } from "zod";
4811
+ var listFabFilesSchema = z86.object({
4812
+ ids: z86.array(z86.string()).optional()
4582
4813
  });
4583
4814
 
4584
4815
  // ../../b4m-core/packages/services/dist/src/fabFileService/update.js
4585
4816
  import mime from "mime-types";
4586
4817
  import { v4 as uuidv42 } from "uuid";
4587
- import { z as z86 } from "zod";
4588
- var updateFabFileSchema = z86.object({
4589
- id: z86.string(),
4590
- fileName: z86.string().optional(),
4591
- mimeType: z86.string().optional(),
4592
- fileContent: z86.string().optional(),
4593
- type: z86.nativeEnum(KnowledgeType).optional(),
4594
- system: z86.boolean().optional(),
4595
- systemPriority: z86.number().min(0).max(999).optional(),
4596
- sessionId: z86.string().optional(),
4597
- notes: z86.string().optional(),
4598
- primaryTag: z86.string().optional(),
4599
- tags: z86.array(z86.object({
4600
- name: z86.string(),
4601
- strength: z86.number()
4818
+ import { z as z87 } from "zod";
4819
+ var updateFabFileSchema = z87.object({
4820
+ id: z87.string(),
4821
+ fileName: z87.string().optional(),
4822
+ mimeType: z87.string().optional(),
4823
+ fileContent: z87.string().optional(),
4824
+ type: z87.nativeEnum(KnowledgeType).optional(),
4825
+ system: z87.boolean().optional(),
4826
+ systemPriority: z87.number().min(0).max(999).optional(),
4827
+ sessionId: z87.string().optional(),
4828
+ notes: z87.string().optional(),
4829
+ primaryTag: z87.string().optional(),
4830
+ tags: z87.array(z87.object({
4831
+ name: z87.string(),
4832
+ strength: z87.number()
4602
4833
  })).optional(),
4603
- error: z86.string().nullable().optional()
4834
+ error: z87.string().nullable().optional()
4604
4835
  });
4605
4836
 
4606
4837
  // ../../b4m-core/packages/services/dist/src/fabFileService/delete.js
4607
- import { z as z87 } from "zod";
4608
- var deleteFabFileSchema = z87.object({
4609
- id: z87.string()
4838
+ import { z as z88 } from "zod";
4839
+ var deleteFabFileSchema = z88.object({
4840
+ id: z88.string()
4610
4841
  });
4611
4842
 
4612
4843
  // ../../b4m-core/packages/services/dist/src/fabFileService/chunk.js
4613
- import { z as z88 } from "zod";
4614
- var chunkFileSchema = z88.object({
4615
- fabFileId: z88.string(),
4616
- embeddingModel: z88.string()
4844
+ import { z as z89 } from "zod";
4845
+ var chunkFileSchema = z89.object({
4846
+ fabFileId: z89.string(),
4847
+ embeddingModel: z89.string()
4617
4848
  });
4618
4849
 
4619
4850
  // ../../b4m-core/packages/services/dist/src/fabFileService/vectorize.js
4620
- import { z as z89 } from "zod";
4621
- var vectorizeFabFileChunkSchema = z89.object({
4622
- fabFileId: z89.string(),
4623
- chunkId: z89.string()
4851
+ import { z as z90 } from "zod";
4852
+ var vectorizeFabFileChunkSchema = z90.object({
4853
+ fabFileId: z90.string(),
4854
+ chunkId: z90.string()
4624
4855
  });
4625
4856
 
4626
4857
  // ../../b4m-core/packages/services/dist/src/fabFileService/listBySession.js
4627
- import { z as z90 } from "zod";
4628
- var listFabFilesBySessionSchema = z90.object({
4629
- sessionId: z90.string()
4858
+ import { z as z91 } from "zod";
4859
+ var listFabFilesBySessionSchema = z91.object({
4860
+ sessionId: z91.string()
4630
4861
  });
4631
4862
 
4632
4863
  // ../../b4m-core/packages/services/dist/src/fabFileService/listByQuest.js
4633
- import { z as z91 } from "zod";
4634
- var listFabFilesByQuestSchema = z91.object({
4635
- questId: z91.string()
4864
+ import { z as z92 } from "zod";
4865
+ var listFabFilesByQuestSchema = z92.object({
4866
+ questId: z92.string()
4636
4867
  });
4637
4868
 
4638
4869
  // ../../b4m-core/packages/services/dist/src/fabFileService/createByUrl.js
4639
- import { z as z92 } from "zod";
4640
- var createFabFileByUrlSchema = z92.object({
4641
- url: z92.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,})).+/)
4870
+ import { z as z93 } from "zod";
4871
+ var createFabFileByUrlSchema = z93.object({
4872
+ 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,})).+/)
4642
4873
  });
4643
4874
 
4644
4875
  // ../../b4m-core/packages/services/dist/src/fabFileService/search.js
4645
- import { z as z93 } from "zod";
4646
- var searchFabFilesSchema = z93.object({
4647
- search: z93.string().optional(),
4648
- filters: z93.object({
4649
- tags: z93.array(z93.string()).optional(),
4650
- type: z93.enum(["text", "pdf", "url", "image", "excel", "word", "json", "csv", "markdown", "code"]).optional(),
4651
- shared: z93.coerce.boolean().optional(),
4876
+ import { z as z94 } from "zod";
4877
+ var searchFabFilesSchema = z94.object({
4878
+ search: z94.string().optional(),
4879
+ filters: z94.object({
4880
+ tags: z94.array(z94.string()).optional(),
4881
+ type: z94.enum(["text", "pdf", "url", "image", "excel", "word", "json", "csv", "markdown", "code"]).optional(),
4882
+ shared: z94.coerce.boolean().optional(),
4652
4883
  // Indicates if the user is searching for shared files
4653
- curated: z93.coerce.boolean().optional(),
4884
+ curated: z94.coerce.boolean().optional(),
4654
4885
  // Indicates if the user is searching for curated notebook files
4655
- projectId: z93.string().optional(),
4656
- ids: z93.array(z93.string()).optional()
4886
+ projectId: z94.string().optional(),
4887
+ ids: z94.array(z94.string()).optional()
4657
4888
  // Add support for filtering by IDs
4658
4889
  }).optional(),
4659
- pagination: z93.object({
4660
- page: z93.coerce.number(),
4661
- limit: z93.coerce.number()
4890
+ pagination: z94.object({
4891
+ page: z94.coerce.number(),
4892
+ limit: z94.coerce.number()
4662
4893
  }).optional(),
4663
- order: z93.object({
4664
- by: z93.enum(["createdAt", "fileName", "fileSize"]),
4665
- direction: z93.enum(["asc", "desc"])
4894
+ order: z94.object({
4895
+ by: z94.enum(["createdAt", "fileName", "fileSize"]),
4896
+ direction: z94.enum(["asc", "desc"])
4666
4897
  }).optional(),
4667
- options: z93.object({
4668
- includeShared: z93.coerce.boolean().optional()
4898
+ options: z94.object({
4899
+ includeShared: z94.coerce.boolean().optional()
4669
4900
  }).optional()
4670
4901
  });
4671
4902
 
4672
4903
  // ../../b4m-core/packages/services/dist/src/fabFileService/addFavorite.js
4673
- import { z as z94 } from "zod";
4674
- var addFavoriteParametersSchema3 = z94.object({
4675
- fileId: z94.string()
4904
+ import { z as z95 } from "zod";
4905
+ var addFavoriteParametersSchema3 = z95.object({
4906
+ fileId: z95.string()
4676
4907
  });
4677
4908
 
4678
4909
  // ../../b4m-core/packages/services/dist/src/fabFileService/deleteFavorite.js
4679
- import { z as z95 } from "zod";
4680
- var deleteFavoriteParametersSchema4 = z95.object({
4681
- fileId: z95.string()
4910
+ import { z as z96 } from "zod";
4911
+ var deleteFavoriteParametersSchema4 = z96.object({
4912
+ fileId: z96.string()
4682
4913
  });
4683
4914
 
4684
4915
  // ../../b4m-core/packages/services/dist/src/fabFileService/toggleTags.js
4685
- import { z as z96 } from "zod";
4686
- var fabFileToggleTagsSchema = z96.object({
4687
- ids: z96.array(z96.string()),
4688
- tags: z96.array(z96.string())
4916
+ import { z as z97 } from "zod";
4917
+ var fabFileToggleTagsSchema = z97.object({
4918
+ ids: z97.array(z97.string()),
4919
+ tags: z97.array(z97.string())
4689
4920
  });
4690
4921
 
4691
4922
  // ../../b4m-core/packages/services/dist/src/fabFileService/edit.js
4692
- import { z as z97 } from "zod";
4923
+ import { z as z98 } from "zod";
4693
4924
  import { diffLines } from "diff";
4694
- var editFabFileSchema = z97.object({
4695
- id: z97.string(),
4696
- instruction: z97.string(),
4697
- selection: z97.object({
4698
- start: z97.number(),
4699
- end: z97.number()
4925
+ var editFabFileSchema = z98.object({
4926
+ id: z98.string(),
4927
+ instruction: z98.string(),
4928
+ selection: z98.object({
4929
+ start: z98.number(),
4930
+ end: z98.number()
4700
4931
  }).optional(),
4701
- preserveFormatting: z97.boolean().optional().default(true),
4702
- applyImmediately: z97.boolean().optional().default(false)
4932
+ preserveFormatting: z98.boolean().optional().default(true),
4933
+ applyImmediately: z98.boolean().optional().default(false)
4703
4934
  });
4704
4935
 
4705
4936
  // ../../b4m-core/packages/services/dist/src/fabFileService/applyEdit.js
4706
4937
  import mime2 from "mime-types";
4707
4938
  import { v4 as uuidv43 } from "uuid";
4708
- import { z as z98 } from "zod";
4709
- var applyEditSchema = z98.object({
4710
- id: z98.string(),
4711
- modifiedContent: z98.string(),
4712
- createBackup: z98.boolean().optional().default(true)
4939
+ import { z as z99 } from "zod";
4940
+ var applyEditSchema = z99.object({
4941
+ id: z99.string(),
4942
+ modifiedContent: z99.string(),
4943
+ createBackup: z99.boolean().optional().default(true)
4713
4944
  });
4714
4945
 
4715
4946
  // ../../b4m-core/packages/services/dist/src/friendshipService/respondToFriendRequest.js
4716
- import { z as z99 } from "zod";
4717
- var respondToFriendRequestSchema = z99.object({
4718
- id: z99.string(),
4947
+ import { z as z100 } from "zod";
4948
+ var respondToFriendRequestSchema = z100.object({
4949
+ id: z100.string(),
4719
4950
  /** The user ID of the recipient of the friend request */
4720
- userId: z99.string(),
4721
- accept: z99.boolean()
4951
+ userId: z100.string(),
4952
+ accept: z100.boolean()
4722
4953
  });
4723
4954
 
4724
4955
  // ../../b4m-core/packages/services/dist/src/friendshipService/unfriend.js
4725
- import { z as z100 } from "zod";
4726
- var unfriendSchema = z100.object({
4727
- friendshipId: z100.string(),
4956
+ import { z as z101 } from "zod";
4957
+ var unfriendSchema = z101.object({
4958
+ friendshipId: z101.string(),
4728
4959
  /** The user ID of the user who wants to unfriend the other user */
4729
- userId: z100.string()
4960
+ userId: z101.string()
4730
4961
  });
4731
4962
 
4732
4963
  // ../../b4m-core/packages/services/dist/src/friendshipService/list.js
4733
- import { z as z101 } from "zod";
4734
- var listFriendsSchema = z101.object({
4735
- userId: z101.string()
4964
+ import { z as z102 } from "zod";
4965
+ var listFriendsSchema = z102.object({
4966
+ userId: z102.string()
4736
4967
  });
4737
- var listPendingFriendRequestsSchema = z101.object({
4738
- userId: z101.string()
4968
+ var listPendingFriendRequestsSchema = z102.object({
4969
+ userId: z102.string()
4739
4970
  });
4740
4971
 
4741
4972
  // ../../b4m-core/packages/services/dist/src/adminService/loginAs.js
4742
- import { z as z102 } from "zod";
4743
- var loginAsSchema = z102.object({
4744
- targetUserId: z102.string()
4973
+ import { z as z103 } from "zod";
4974
+ var loginAsSchema = z103.object({
4975
+ targetUserId: z103.string()
4745
4976
  });
4746
4977
 
4747
4978
  // ../../b4m-core/packages/services/dist/src/cacheService/get.js
4748
- import { z as z103 } from "zod";
4749
- var getParamsSchema = z103.object({
4750
- key: z103.string()
4979
+ import { z as z104 } from "zod";
4980
+ var getParamsSchema = z104.object({
4981
+ key: z104.string()
4751
4982
  });
4752
4983
 
4753
4984
  // ../../b4m-core/packages/services/dist/src/cacheService/set.js
4754
- import { z as z104 } from "zod";
4755
- var setParamsSchema = z104.object({
4756
- key: z104.string(),
4757
- value: z104.any(),
4985
+ import { z as z105 } from "zod";
4986
+ var setParamsSchema = z105.object({
4987
+ key: z105.string(),
4988
+ value: z105.any(),
4758
4989
  /**
4759
4990
  * Time to live in milliseconds
4760
4991
  */
4761
- ttl: z104.number(),
4762
- recache: z104.boolean().optional()
4992
+ ttl: z105.number(),
4993
+ recache: z105.boolean().optional()
4763
4994
  });
4764
4995
 
4765
4996
  // ../../b4m-core/packages/services/dist/src/cacheService/ttl.js
4766
- import { z as z105 } from "zod";
4767
- var ttlParamsSchema = z105.object({
4768
- key: z105.string()
4997
+ import { z as z106 } from "zod";
4998
+ var ttlParamsSchema = z106.object({
4999
+ key: z106.string()
4769
5000
  });
4770
5001
 
4771
5002
  // ../../b4m-core/packages/services/dist/src/cacheService/weeklyReports.js
4772
- import { z as z106 } from "zod";
5003
+ import { z as z107 } from "zod";
4773
5004
  import dayjs3 from "dayjs";
4774
- var weeklyReportSchema = z106.object({
4775
- startDate: z106.string(),
4776
- endDate: z106.string(),
4777
- report: z106.string(),
4778
- aiInsights: z106.string().nullable()
5005
+ var weeklyReportSchema = z107.object({
5006
+ startDate: z107.string(),
5007
+ endDate: z107.string(),
5008
+ report: z107.string(),
5009
+ aiInsights: z107.string().nullable()
4779
5010
  });
4780
5011
 
4781
5012
  // ../../b4m-core/packages/services/dist/src/embeddingCacheService/generateCacheKey.js
4782
5013
  import crypto2 from "crypto";
4783
5014
 
4784
5015
  // ../../b4m-core/packages/services/dist/src/researchAgentService/create.js
4785
- import { z as z107 } from "zod";
4786
- var researchAgentCreateSchema = z107.object({
4787
- name: z107.string().min(1),
4788
- description: z107.string().min(1)
4789
- });
4790
-
4791
- // ../../b4m-core/packages/services/dist/src/researchAgentService/update.js
4792
5016
  import { z as z108 } from "zod";
4793
- var researchAgentUpdateSchema = z108.object({
4794
- id: z108.string(),
5017
+ var researchAgentCreateSchema = z108.object({
4795
5018
  name: z108.string().min(1),
4796
5019
  description: z108.string().min(1)
4797
5020
  });
4798
5021
 
4799
- // ../../b4m-core/packages/services/dist/src/researchAgentService/remove.js
5022
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/update.js
4800
5023
  import { z as z109 } from "zod";
4801
- var researchAgentRemoveSchema = z109.object({
4802
- id: z109.string()
5024
+ var researchAgentUpdateSchema = z109.object({
5025
+ id: z109.string(),
5026
+ name: z109.string().min(1),
5027
+ description: z109.string().min(1)
4803
5028
  });
4804
5029
 
4805
- // ../../b4m-core/packages/services/dist/src/researchAgentService/get.js
5030
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/remove.js
4806
5031
  import { z as z110 } from "zod";
4807
- var researchAgentGetSchema = z110.object({
5032
+ var researchAgentRemoveSchema = z110.object({
4808
5033
  id: z110.string()
4809
5034
  });
4810
5035
 
4811
- // ../../b4m-core/packages/services/dist/src/researchAgentService/listFiles.js
5036
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/get.js
4812
5037
  import { z as z111 } from "zod";
4813
- var researchAgentListFilesSchema = z111.object({
5038
+ var researchAgentGetSchema = z111.object({
5039
+ id: z111.string()
5040
+ });
5041
+
5042
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/listFiles.js
5043
+ import { z as z112 } from "zod";
5044
+ var researchAgentListFilesSchema = z112.object({
4814
5045
  /**
4815
5046
  * The ID of the research agent
4816
5047
  */
4817
- id: z111.string()
5048
+ id: z112.string()
4818
5049
  });
4819
5050
 
4820
5051
  // ../../b4m-core/packages/services/dist/src/researchTaskService/process.js
4821
- import { z as z112 } from "zod";
5052
+ import { z as z113 } from "zod";
4822
5053
 
4823
5054
  // ../../b4m-core/packages/services/dist/src/lib/turndown.js
4824
5055
  import turndown from "turndown";
@@ -5209,316 +5440,316 @@ var deepResearchTool = {
5209
5440
  };
5210
5441
 
5211
5442
  // ../../b4m-core/packages/services/dist/src/researchTaskService/process.js
5212
- var ResearchTaskProcessSchema = z112.object({
5213
- id: z112.string()
5443
+ var ResearchTaskProcessSchema = z113.object({
5444
+ id: z113.string()
5214
5445
  });
5215
5446
 
5216
5447
  // ../../b4m-core/packages/services/dist/src/researchTaskService/create.js
5217
- import { z as z113 } from "zod";
5218
- var researchTaskCreateSchema = z113.object({
5219
- researchAgentId: z113.string(),
5220
- title: z113.string().max(100),
5221
- description: z113.string().max(500),
5222
- prompt: z113.string().max(500).optional(),
5223
- type: z113.nativeEnum(ResearchTaskType),
5224
- executionType: z113.nativeEnum(ResearchTaskExecutionType).default(ResearchTaskExecutionType.ON_DEMAND),
5225
- fileTagId: z113.string().optional(),
5226
- autoGeneratedTag: z113.object({
5227
- name: z113.string(),
5228
- icon: z113.string(),
5229
- color: z113.string()
5448
+ import { z as z114 } from "zod";
5449
+ var researchTaskCreateSchema = z114.object({
5450
+ researchAgentId: z114.string(),
5451
+ title: z114.string().max(100),
5452
+ description: z114.string().max(500),
5453
+ prompt: z114.string().max(500).optional(),
5454
+ type: z114.nativeEnum(ResearchTaskType),
5455
+ executionType: z114.nativeEnum(ResearchTaskExecutionType).default(ResearchTaskExecutionType.ON_DEMAND),
5456
+ fileTagId: z114.string().optional(),
5457
+ autoGeneratedTag: z114.object({
5458
+ name: z114.string(),
5459
+ icon: z114.string(),
5460
+ color: z114.string()
5230
5461
  }).optional()
5231
5462
  });
5232
5463
  var researchTaskScrapeCreateSchema = researchTaskCreateSchema.extend({
5233
- urls: z113.array(z113.string().url()).min(1),
5234
- canDiscoverLinks: z113.boolean()
5464
+ urls: z114.array(z114.string().url()).min(1),
5465
+ canDiscoverLinks: z114.boolean()
5235
5466
  });
5236
5467
  var researchTaskPeriodicCreateSchema = researchTaskCreateSchema.extend({
5237
- executionPeriodicStartAt: z113.coerce.date(),
5238
- executionPeriodicEndAt: z113.coerce.date(),
5239
- executionPeriodicFrequency: z113.nativeEnum(ResearchTaskPeriodicFrequencyType)
5468
+ executionPeriodicStartAt: z114.coerce.date(),
5469
+ executionPeriodicEndAt: z114.coerce.date(),
5470
+ executionPeriodicFrequency: z114.nativeEnum(ResearchTaskPeriodicFrequencyType)
5240
5471
  });
5241
5472
  var researchTaskScheduledCreateSchema = researchTaskCreateSchema.extend({
5242
- executionScheduledAt: z113.coerce.date()
5473
+ executionScheduledAt: z114.coerce.date()
5243
5474
  });
5244
5475
  var researchTaskDeepResearchCreateSchema = researchTaskCreateSchema.extend({
5245
- maxDepth: z113.number().min(1).max(10).optional()
5476
+ maxDepth: z114.number().min(1).max(10).optional()
5246
5477
  });
5247
5478
 
5248
5479
  // ../../b4m-core/packages/services/dist/src/researchTaskService/search.js
5249
- import { z as z114 } from "zod";
5250
- var searchResearchTasksSchema = z114.object({
5251
- search: z114.string().optional(),
5480
+ import { z as z115 } from "zod";
5481
+ var searchResearchTasksSchema = z115.object({
5482
+ search: z115.string().optional(),
5252
5483
  // ADD FILTERS SCHEMA HERE
5253
5484
  // filters: z
5254
5485
  // .object({
5255
5486
  // userId: z.string().optional(),
5256
5487
  // })
5257
5488
  // .optional(),
5258
- pagination: z114.object({
5259
- page: z114.coerce.number().optional(),
5260
- limit: z114.coerce.number().optional()
5489
+ pagination: z115.object({
5490
+ page: z115.coerce.number().optional(),
5491
+ limit: z115.coerce.number().optional()
5261
5492
  }).optional(),
5262
- orderBy: z114.object({
5263
- by: z114.enum(["createdAt", "updatedAt"]).optional(),
5264
- direction: z114.enum(["asc", "desc"]).optional()
5493
+ orderBy: z115.object({
5494
+ by: z115.enum(["createdAt", "updatedAt"]).optional(),
5495
+ direction: z115.enum(["asc", "desc"]).optional()
5265
5496
  }).optional()
5266
5497
  });
5267
5498
 
5268
5499
  // ../../b4m-core/packages/services/dist/src/researchTaskService/get.js
5269
- import { z as z115 } from "zod";
5270
- var getResearchTaskSchema = z115.object({
5271
- id: z115.string().min(1)
5500
+ import { z as z116 } from "zod";
5501
+ var getResearchTaskSchema = z116.object({
5502
+ id: z116.string().min(1)
5272
5503
  });
5273
5504
 
5274
5505
  // ../../b4m-core/packages/services/dist/src/researchTaskService/update.js
5275
- import { z as z116 } from "zod";
5276
- var updateResearchTaskSchema = z116.object({
5277
- id: z116.string(),
5278
- title: z116.string(),
5279
- description: z116.string(),
5280
- type: z116.nativeEnum(ResearchTaskType)
5506
+ import { z as z117 } from "zod";
5507
+ var updateResearchTaskSchema = z117.object({
5508
+ id: z117.string(),
5509
+ title: z117.string(),
5510
+ description: z117.string(),
5511
+ type: z117.nativeEnum(ResearchTaskType)
5281
5512
  });
5282
5513
  var researchTaskScrapeUpdateSchema = updateResearchTaskSchema.extend({
5283
- urls: z116.array(z116.string().url()).min(1),
5284
- canDiscoverLinks: z116.boolean()
5514
+ urls: z117.array(z117.string().url()).min(1),
5515
+ canDiscoverLinks: z117.boolean()
5285
5516
  });
5286
5517
 
5287
5518
  // ../../b4m-core/packages/services/dist/src/researchTaskService/listByAgentId.js
5288
- import { z as z117 } from "zod";
5289
- var listByAgentIdSchema = z117.object({
5290
- researchAgentId: z117.string()
5519
+ import { z as z118 } from "zod";
5520
+ var listByAgentIdSchema = z118.object({
5521
+ researchAgentId: z118.string()
5291
5522
  });
5292
5523
 
5293
5524
  // ../../b4m-core/packages/services/dist/src/researchTaskService/remove.js
5294
- import { z as z118 } from "zod";
5295
- var researchTaskRemoveSchema = z118.object({
5296
- id: z118.string().min(1)
5525
+ import { z as z119 } from "zod";
5526
+ var researchTaskRemoveSchema = z119.object({
5527
+ id: z119.string().min(1)
5297
5528
  });
5298
5529
 
5299
5530
  // ../../b4m-core/packages/services/dist/src/researchTaskService/retry.js
5300
- import { z as z119 } from "zod";
5301
- var researchTaskRetrySchema = z119.object({
5302
- id: z119.string(),
5303
- userId: z119.string()
5531
+ import { z as z120 } from "zod";
5532
+ var researchTaskRetrySchema = z120.object({
5533
+ id: z120.string(),
5534
+ userId: z120.string()
5304
5535
  });
5305
5536
 
5306
5537
  // ../../b4m-core/packages/services/dist/src/researchTaskService/processDiscoveredLinks.js
5307
5538
  import axios4 from "axios";
5308
- import { z as z120 } from "zod";
5539
+ import { z as z121 } from "zod";
5309
5540
  import plimit from "p-limit";
5310
5541
  import pLimit2 from "p-limit";
5311
- var researchTaskProcessDiscoveredLinksSchema = z120.object({
5312
- id: z120.string()
5542
+ var researchTaskProcessDiscoveredLinksSchema = z121.object({
5543
+ id: z121.string()
5313
5544
  });
5314
5545
 
5315
5546
  // ../../b4m-core/packages/services/dist/src/researchTaskService/downloadRelevantLinks.js
5316
- import { z as z121 } from "zod";
5547
+ import { z as z122 } from "zod";
5317
5548
  import plimit2 from "p-limit";
5318
5549
  import axios5 from "axios";
5319
5550
  import { fileTypeFromBuffer } from "file-type";
5320
- var researchTaskDownloadRelevantLinksSchema = z121.object({
5321
- id: z121.string()
5551
+ var researchTaskDownloadRelevantLinksSchema = z122.object({
5552
+ id: z122.string()
5322
5553
  });
5323
5554
 
5324
5555
  // ../../b4m-core/packages/services/dist/src/researchData/remove.js
5325
- import { z as z122 } from "zod";
5326
- var researchDataRemoveSchema = z122.object({
5327
- id: z122.string(),
5328
- researchAgentId: z122.string()
5556
+ import { z as z123 } from "zod";
5557
+ var researchDataRemoveSchema = z123.object({
5558
+ id: z123.string(),
5559
+ researchAgentId: z123.string()
5329
5560
  });
5330
5561
 
5331
5562
  // ../../b4m-core/packages/services/dist/src/taskSchedulerService/create.js
5332
- import { z as z123 } from "zod";
5333
- var researchTaskPayload = z123.object({
5334
- id: z123.string(),
5335
- userId: z123.string()
5563
+ import { z as z124 } from "zod";
5564
+ var researchTaskPayload = z124.object({
5565
+ id: z124.string(),
5566
+ userId: z124.string()
5336
5567
  });
5337
- var customTaskPayload = z123.object({
5338
- test: z123.string()
5568
+ var customTaskPayload = z124.object({
5569
+ test: z124.string()
5339
5570
  });
5340
- var taskSchedulerCreate = z123.discriminatedUnion("handler", [
5341
- z123.object({
5342
- handler: z123.literal(TaskScheduleHandler.RESEARCH_TASK_PROCESS),
5571
+ var taskSchedulerCreate = z124.discriminatedUnion("handler", [
5572
+ z124.object({
5573
+ handler: z124.literal(TaskScheduleHandler.RESEARCH_TASK_PROCESS),
5343
5574
  payload: researchTaskPayload,
5344
- processDate: z123.date()
5575
+ processDate: z124.date()
5345
5576
  }),
5346
- z123.object({
5347
- handler: z123.literal(TaskScheduleHandler.CUSTOM_TASK_PROCESS),
5577
+ z124.object({
5578
+ handler: z124.literal(TaskScheduleHandler.CUSTOM_TASK_PROCESS),
5348
5579
  payload: customTaskPayload,
5349
- processDate: z123.date()
5580
+ processDate: z124.date()
5350
5581
  })
5351
5582
  ]);
5352
5583
 
5353
5584
  // ../../b4m-core/packages/services/dist/src/tagService/createFileTag.js
5354
- import { z as z124 } from "zod";
5355
- var tagCreateFileTagSchema = z124.object({
5356
- name: z124.string(),
5357
- icon: z124.string().optional(),
5358
- color: z124.string().optional(),
5359
- description: z124.string().optional()
5360
- });
5361
-
5362
- // ../../b4m-core/packages/services/dist/src/tagService/create.js
5363
5585
  import { z as z125 } from "zod";
5364
- var tagCreateSchema = z125.object({
5586
+ var tagCreateFileTagSchema = z125.object({
5365
5587
  name: z125.string(),
5366
5588
  icon: z125.string().optional(),
5367
- description: z125.string().optional(),
5368
5589
  color: z125.string().optional(),
5369
- type: z125.nativeEnum(TagType)
5590
+ description: z125.string().optional()
5370
5591
  });
5371
5592
 
5372
- // ../../b4m-core/packages/services/dist/src/tagService/update.js
5593
+ // ../../b4m-core/packages/services/dist/src/tagService/create.js
5373
5594
  import { z as z126 } from "zod";
5374
- var tagUpdateSchema = z126.object({
5375
- id: z126.string(),
5376
- name: z126.string().optional(),
5595
+ var tagCreateSchema = z126.object({
5596
+ name: z126.string(),
5377
5597
  icon: z126.string().optional(),
5378
5598
  description: z126.string().optional(),
5379
- color: z126.string().optional()
5599
+ color: z126.string().optional(),
5600
+ type: z126.nativeEnum(TagType)
5380
5601
  });
5381
5602
 
5382
- // ../../b4m-core/packages/services/dist/src/tagService/remove.js
5603
+ // ../../b4m-core/packages/services/dist/src/tagService/update.js
5383
5604
  import { z as z127 } from "zod";
5384
- var tagRemoveSchema = z127.object({
5385
- id: z127.string()
5605
+ var tagUpdateSchema = z127.object({
5606
+ id: z127.string(),
5607
+ name: z127.string().optional(),
5608
+ icon: z127.string().optional(),
5609
+ description: z127.string().optional(),
5610
+ color: z127.string().optional()
5386
5611
  });
5387
5612
 
5388
- // ../../b4m-core/packages/services/dist/src/artifactService/create.js
5613
+ // ../../b4m-core/packages/services/dist/src/tagService/remove.js
5389
5614
  import { z as z128 } from "zod";
5390
- var createArtifactSchema = z128.object({
5391
- id: z128.string().optional(),
5615
+ var tagRemoveSchema = z128.object({
5616
+ id: z128.string()
5617
+ });
5618
+
5619
+ // ../../b4m-core/packages/services/dist/src/artifactService/create.js
5620
+ import { z as z129 } from "zod";
5621
+ var createArtifactSchema = z129.object({
5622
+ id: z129.string().optional(),
5392
5623
  // Allow custom ID for AI-generated artifacts
5393
- type: z128.enum(["mermaid", "recharts", "python", "react", "html", "svg", "code", "quest", "file", "questmaster"]),
5394
- title: z128.string().min(1).max(255),
5395
- description: z128.string().max(1e3).optional(),
5396
- content: z128.string().min(1),
5397
- projectId: z128.string().optional(),
5398
- organizationId: z128.string().optional(),
5399
- visibility: z128.enum(["private", "project", "organization", "public"]).default("private"),
5400
- tags: z128.array(z128.string().max(50)).max(20).default([]),
5401
- versionTag: z128.string().max(100).optional(),
5402
- sourceQuestId: z128.string().optional(),
5403
- sessionId: z128.string().optional(),
5404
- parentArtifactId: z128.string().optional(),
5405
- permissions: z128.object({
5406
- canRead: z128.array(z128.string()).default([]),
5407
- canWrite: z128.array(z128.string()).default([]),
5408
- canDelete: z128.array(z128.string()).default([]),
5409
- isPublic: z128.boolean().default(false),
5410
- inheritFromProject: z128.boolean().default(true)
5624
+ type: z129.enum(["mermaid", "recharts", "python", "react", "html", "svg", "code", "quest", "file", "questmaster"]),
5625
+ title: z129.string().min(1).max(255),
5626
+ description: z129.string().max(1e3).optional(),
5627
+ content: z129.string().min(1),
5628
+ projectId: z129.string().optional(),
5629
+ organizationId: z129.string().optional(),
5630
+ visibility: z129.enum(["private", "project", "organization", "public"]).default("private"),
5631
+ tags: z129.array(z129.string().max(50)).max(20).default([]),
5632
+ versionTag: z129.string().max(100).optional(),
5633
+ sourceQuestId: z129.string().optional(),
5634
+ sessionId: z129.string().optional(),
5635
+ parentArtifactId: z129.string().optional(),
5636
+ permissions: z129.object({
5637
+ canRead: z129.array(z129.string()).default([]),
5638
+ canWrite: z129.array(z129.string()).default([]),
5639
+ canDelete: z129.array(z129.string()).default([]),
5640
+ isPublic: z129.boolean().default(false),
5641
+ inheritFromProject: z129.boolean().default(true)
5411
5642
  }).optional(),
5412
- metadata: z128.record(z128.unknown()).default({})
5643
+ metadata: z129.record(z129.unknown()).default({})
5413
5644
  });
5414
5645
 
5415
5646
  // ../../b4m-core/packages/services/dist/src/artifactService/get.js
5416
- import { z as z129 } from "zod";
5417
- var getArtifactSchema = z129.object({
5418
- id: z129.string(),
5419
- includeContent: z129.boolean().default(false),
5420
- includeVersions: z129.boolean().default(false),
5421
- version: z129.number().optional()
5647
+ import { z as z130 } from "zod";
5648
+ var getArtifactSchema = z130.object({
5649
+ id: z130.string(),
5650
+ includeContent: z130.boolean().default(false),
5651
+ includeVersions: z130.boolean().default(false),
5652
+ version: z130.number().optional()
5422
5653
  });
5423
5654
 
5424
5655
  // ../../b4m-core/packages/services/dist/src/artifactService/list.js
5425
- import { z as z130 } from "zod";
5426
- var listArtifactsSchema = z130.object({
5427
- type: z130.string().optional(),
5428
- status: z130.enum(["draft", "review", "published", "archived"]).optional(),
5429
- visibility: z130.enum(["private", "project", "organization", "public"]).optional(),
5430
- projectId: z130.string().optional(),
5431
- sessionId: z130.string().optional(),
5432
- tags: z130.array(z130.string()).optional(),
5433
- search: z130.string().optional(),
5434
- limit: z130.number().min(1).max(100).default(20),
5435
- offset: z130.number().min(0).default(0),
5436
- sortBy: z130.enum(["createdAt", "updatedAt", "title", "type"]).default("updatedAt"),
5437
- sortOrder: z130.enum(["asc", "desc"]).default("desc"),
5438
- includeDeleted: z130.boolean().default(false)
5656
+ import { z as z131 } from "zod";
5657
+ var listArtifactsSchema = z131.object({
5658
+ type: z131.string().optional(),
5659
+ status: z131.enum(["draft", "review", "published", "archived"]).optional(),
5660
+ visibility: z131.enum(["private", "project", "organization", "public"]).optional(),
5661
+ projectId: z131.string().optional(),
5662
+ sessionId: z131.string().optional(),
5663
+ tags: z131.array(z131.string()).optional(),
5664
+ search: z131.string().optional(),
5665
+ limit: z131.number().min(1).max(100).default(20),
5666
+ offset: z131.number().min(0).default(0),
5667
+ sortBy: z131.enum(["createdAt", "updatedAt", "title", "type"]).default("updatedAt"),
5668
+ sortOrder: z131.enum(["asc", "desc"]).default("desc"),
5669
+ includeDeleted: z131.boolean().default(false)
5439
5670
  });
5440
5671
 
5441
5672
  // ../../b4m-core/packages/services/dist/src/artifactService/update.js
5442
- import { z as z131 } from "zod";
5443
- var updateArtifactSchema = z131.object({
5444
- id: z131.string(),
5445
- title: z131.string().min(1).max(255).optional(),
5446
- description: z131.string().max(1e3).optional(),
5447
- content: z131.string().optional(),
5448
- visibility: z131.enum(["private", "project", "organization", "public"]).optional(),
5449
- status: z131.enum(["draft", "review", "published", "archived"]).optional(),
5450
- tags: z131.array(z131.string().max(50)).max(20).optional(),
5451
- versionTag: z131.string().max(100).optional(),
5452
- permissions: z131.object({
5453
- canRead: z131.array(z131.string()).optional(),
5454
- canWrite: z131.array(z131.string()).optional(),
5455
- canDelete: z131.array(z131.string()).optional(),
5456
- isPublic: z131.boolean().optional(),
5457
- inheritFromProject: z131.boolean().optional()
5673
+ import { z as z132 } from "zod";
5674
+ var updateArtifactSchema = z132.object({
5675
+ id: z132.string(),
5676
+ title: z132.string().min(1).max(255).optional(),
5677
+ description: z132.string().max(1e3).optional(),
5678
+ content: z132.string().optional(),
5679
+ visibility: z132.enum(["private", "project", "organization", "public"]).optional(),
5680
+ status: z132.enum(["draft", "review", "published", "archived"]).optional(),
5681
+ tags: z132.array(z132.string().max(50)).max(20).optional(),
5682
+ versionTag: z132.string().max(100).optional(),
5683
+ permissions: z132.object({
5684
+ canRead: z132.array(z132.string()).optional(),
5685
+ canWrite: z132.array(z132.string()).optional(),
5686
+ canDelete: z132.array(z132.string()).optional(),
5687
+ isPublic: z132.boolean().optional(),
5688
+ inheritFromProject: z132.boolean().optional()
5458
5689
  }).optional(),
5459
- metadata: z131.record(z131.unknown()).optional(),
5460
- changes: z131.array(z131.string()).optional(),
5461
- changeDescription: z131.string().max(1e3).optional(),
5462
- createNewVersion: z131.boolean().optional(),
5463
- versionMessage: z131.string().max(500).optional()
5690
+ metadata: z132.record(z132.unknown()).optional(),
5691
+ changes: z132.array(z132.string()).optional(),
5692
+ changeDescription: z132.string().max(1e3).optional(),
5693
+ createNewVersion: z132.boolean().optional(),
5694
+ versionMessage: z132.string().max(500).optional()
5464
5695
  });
5465
5696
 
5466
5697
  // ../../b4m-core/packages/services/dist/src/artifactService/delete.js
5467
- import { z as z132 } from "zod";
5468
- var deleteArtifactSchema = z132.object({
5469
- id: z132.string(),
5470
- hardDelete: z132.boolean().default(false)
5698
+ import { z as z133 } from "zod";
5699
+ var deleteArtifactSchema = z133.object({
5700
+ id: z133.string(),
5701
+ hardDelete: z133.boolean().default(false)
5471
5702
  // For future implementation
5472
5703
  });
5473
5704
 
5474
5705
  // ../../b4m-core/packages/services/dist/src/questMasterService/create.js
5475
- import { z as z133 } from "zod";
5476
- var questSchema = z133.object({
5477
- id: z133.string(),
5478
- title: z133.string().min(1).max(255),
5479
- description: z133.string().max(MAX_DESCRIPTION_LENGTH),
5480
- status: z133.enum(["not_started", "in_progress", "completed", "blocked"]).default("not_started"),
5481
- order: z133.number().min(0),
5482
- dependencies: z133.array(z133.string()).default([]),
5483
- estimatedTime: z133.string().optional()
5484
- });
5485
- var questResourceSchema = z133.object({
5486
- title: z133.string().min(1).max(255),
5487
- url: z133.string().url(),
5488
- type: z133.enum(["documentation", "tutorial", "reference", "example"])
5489
- });
5490
- var createQuestMasterSchema = z133.object({
5491
- title: z133.string().min(1).max(255),
5492
- description: z133.string().max(MAX_DESCRIPTION_LENGTH).optional(),
5493
- goal: z133.string().min(1).max(MAX_GOAL_LENGTH),
5494
- complexity: z133.enum(["beginner", "intermediate", "advanced", "expert"]),
5495
- estimatedTotalTime: z133.string().optional(),
5496
- prerequisites: z133.array(z133.string().max(200)).default([]),
5497
- quests: z133.array(questSchema).min(1),
5498
- resources: z133.array(questResourceSchema).default([]),
5499
- projectId: z133.string().optional(),
5500
- organizationId: z133.string().optional(),
5501
- visibility: z133.enum(["private", "project", "organization", "public"]).default("private"),
5502
- tags: z133.array(z133.string().max(MAX_TAG_LENGTH)).max(20).default([]),
5503
- permissions: z133.object({
5504
- canRead: z133.array(z133.string()).default([]),
5505
- canWrite: z133.array(z133.string()).default([]),
5506
- canDelete: z133.array(z133.string()).default([]),
5507
- isPublic: z133.boolean().default(false),
5508
- inheritFromProject: z133.boolean().default(true)
5706
+ import { z as z134 } from "zod";
5707
+ var questSchema = z134.object({
5708
+ id: z134.string(),
5709
+ title: z134.string().min(1).max(255),
5710
+ description: z134.string().max(MAX_DESCRIPTION_LENGTH),
5711
+ status: z134.enum(["not_started", "in_progress", "completed", "blocked"]).default("not_started"),
5712
+ order: z134.number().min(0),
5713
+ dependencies: z134.array(z134.string()).default([]),
5714
+ estimatedTime: z134.string().optional()
5715
+ });
5716
+ var questResourceSchema = z134.object({
5717
+ title: z134.string().min(1).max(255),
5718
+ url: z134.string().url(),
5719
+ type: z134.enum(["documentation", "tutorial", "reference", "example"])
5720
+ });
5721
+ var createQuestMasterSchema = z134.object({
5722
+ title: z134.string().min(1).max(255),
5723
+ description: z134.string().max(MAX_DESCRIPTION_LENGTH).optional(),
5724
+ goal: z134.string().min(1).max(MAX_GOAL_LENGTH),
5725
+ complexity: z134.enum(["beginner", "intermediate", "advanced", "expert"]),
5726
+ estimatedTotalTime: z134.string().optional(),
5727
+ prerequisites: z134.array(z134.string().max(200)).default([]),
5728
+ quests: z134.array(questSchema).min(1),
5729
+ resources: z134.array(questResourceSchema).default([]),
5730
+ projectId: z134.string().optional(),
5731
+ organizationId: z134.string().optional(),
5732
+ visibility: z134.enum(["private", "project", "organization", "public"]).default("private"),
5733
+ tags: z134.array(z134.string().max(MAX_TAG_LENGTH)).max(20).default([]),
5734
+ permissions: z134.object({
5735
+ canRead: z134.array(z134.string()).default([]),
5736
+ canWrite: z134.array(z134.string()).default([]),
5737
+ canDelete: z134.array(z134.string()).default([]),
5738
+ isPublic: z134.boolean().default(false),
5739
+ inheritFromProject: z134.boolean().default(true)
5509
5740
  }).optional(),
5510
- sourceQuestId: z133.string().optional(),
5511
- sessionId: z133.string().optional(),
5512
- metadata: z133.record(z133.unknown()).default({})
5741
+ sourceQuestId: z134.string().optional(),
5742
+ sessionId: z134.string().optional(),
5743
+ metadata: z134.record(z134.unknown()).default({})
5513
5744
  });
5514
5745
 
5515
5746
  // ../../b4m-core/packages/services/dist/src/questMasterService/updateQuestStatus.js
5516
- import { z as z134 } from "zod";
5517
- var updateQuestStatusSchema = z134.object({
5518
- artifactId: z134.string(),
5519
- questId: z134.string(),
5520
- status: z134.enum(["not_started", "in_progress", "completed", "blocked"]),
5521
- completionNote: z134.string().max(500).optional()
5747
+ import { z as z135 } from "zod";
5748
+ var updateQuestStatusSchema = z135.object({
5749
+ artifactId: z135.string(),
5750
+ questId: z135.string(),
5751
+ status: z135.enum(["not_started", "in_progress", "completed", "blocked"]),
5752
+ completionNote: z135.string().max(500).optional()
5522
5753
  });
5523
5754
 
5524
5755
  // ../../b4m-core/packages/services/dist/src/dataLakeService/opensearchClient.js
@@ -5538,59 +5769,59 @@ import { v4 as uuidv44 } from "uuid";
5538
5769
  import { randomUUID as randomUUID5 } from "crypto";
5539
5770
 
5540
5771
  // ../../b4m-core/packages/services/dist/src/emailIngestionService/types.js
5541
- import { z as z135 } from "zod";
5542
- var processIngestedEmailOptionsSchema = z135.object({
5543
- platformDomain: z135.string().optional(),
5544
- isNewsletter: z135.boolean().optional()
5772
+ import { z as z136 } from "zod";
5773
+ var processIngestedEmailOptionsSchema = z136.object({
5774
+ platformDomain: z136.string().optional(),
5775
+ isNewsletter: z136.boolean().optional()
5545
5776
  }).optional();
5546
- var emailAttachmentSchema = z135.object({
5547
- filename: z135.string().optional(),
5548
- contentType: z135.string().optional(),
5549
- contentDisposition: z135.string().optional(),
5550
- size: z135.number().min(0),
5551
- content: z135.instanceof(Buffer),
5552
- related: z135.boolean().optional()
5553
- });
5554
- var parsedEmailObjectSchema = z135.object({
5555
- messageId: z135.string().optional(),
5556
- inReplyTo: z135.string().optional(),
5557
- references: z135.union([z135.string(), z135.array(z135.string())]).optional(),
5558
- from: z135.any().optional(),
5777
+ var emailAttachmentSchema = z136.object({
5778
+ filename: z136.string().optional(),
5779
+ contentType: z136.string().optional(),
5780
+ contentDisposition: z136.string().optional(),
5781
+ size: z136.number().min(0),
5782
+ content: z136.instanceof(Buffer),
5783
+ related: z136.boolean().optional()
5784
+ });
5785
+ var parsedEmailObjectSchema = z136.object({
5786
+ messageId: z136.string().optional(),
5787
+ inReplyTo: z136.string().optional(),
5788
+ references: z136.union([z136.string(), z136.array(z136.string())]).optional(),
5789
+ from: z136.any().optional(),
5559
5790
  // Complex email address object
5560
- to: z135.any().optional(),
5561
- cc: z135.any().optional(),
5562
- bcc: z135.any().optional(),
5563
- subject: z135.string().optional(),
5564
- date: z135.date().optional(),
5565
- text: z135.string().optional(),
5566
- html: z135.string().optional(),
5567
- attachments: z135.array(emailAttachmentSchema).optional()
5568
- });
5569
- var processIngestedEmailSchema = z135.object({
5791
+ to: z136.any().optional(),
5792
+ cc: z136.any().optional(),
5793
+ bcc: z136.any().optional(),
5794
+ subject: z136.string().optional(),
5795
+ date: z136.date().optional(),
5796
+ text: z136.string().optional(),
5797
+ html: z136.string().optional(),
5798
+ attachments: z136.array(emailAttachmentSchema).optional()
5799
+ });
5800
+ var processIngestedEmailSchema = z136.object({
5570
5801
  parsedEmail: parsedEmailObjectSchema,
5571
- rawEmailS3Key: z135.string().min(1, "rawEmailS3Key cannot be empty"),
5802
+ rawEmailS3Key: z136.string().min(1, "rawEmailS3Key cannot be empty"),
5572
5803
  options: processIngestedEmailOptionsSchema
5573
5804
  });
5574
5805
 
5575
5806
  // ../../b4m-core/packages/services/dist/src/emailAnalysisService/types.js
5576
- import { z as z136 } from "zod";
5577
- var llmAnalysisResponseSchema = z136.object({
5578
- summary: z136.string().min(1, "Summary cannot be empty"),
5579
- entities: z136.object({
5580
- companies: z136.array(z136.string()).default([]),
5581
- people: z136.array(z136.string()).default([]),
5582
- products: z136.array(z136.string()).default([]),
5583
- technologies: z136.array(z136.string()).default([])
5807
+ import { z as z137 } from "zod";
5808
+ var llmAnalysisResponseSchema = z137.object({
5809
+ summary: z137.string().min(1, "Summary cannot be empty"),
5810
+ entities: z137.object({
5811
+ companies: z137.array(z137.string()).default([]),
5812
+ people: z137.array(z137.string()).default([]),
5813
+ products: z137.array(z137.string()).default([]),
5814
+ technologies: z137.array(z137.string()).default([])
5584
5815
  }),
5585
- sentiment: z136.enum(["positive", "neutral", "negative", "urgent"]),
5586
- actionItems: z136.array(z136.object({
5587
- description: z136.string(),
5588
- deadline: z136.string().optional()
5816
+ sentiment: z137.enum(["positive", "neutral", "negative", "urgent"]),
5817
+ actionItems: z137.array(z137.object({
5818
+ description: z137.string(),
5819
+ deadline: z137.string().optional()
5589
5820
  // ISO date string from LLM
5590
5821
  })).default([]),
5591
- privacyRecommendation: z136.enum(["public", "team", "private"]),
5592
- embargoDetected: z136.boolean().default(false),
5593
- suggestedTags: z136.array(z136.string()).default([])
5822
+ privacyRecommendation: z137.enum(["public", "team", "private"]),
5823
+ embargoDetected: z137.boolean().default(false),
5824
+ suggestedTags: z137.array(z137.string()).default([])
5594
5825
  });
5595
5826
 
5596
5827
  // ../../b4m-core/packages/services/dist/src/llm/tools/ToolCacheManager.js
@@ -6063,8 +6294,8 @@ var webFetchTool = {
6063
6294
  };
6064
6295
 
6065
6296
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/math/index.js
6066
- import { create as create6, all } from "mathjs";
6067
- var math = create6(all, {
6297
+ import { create as create5, all } from "mathjs";
6298
+ var math = create5(all, {
6068
6299
  number: "BigNumber",
6069
6300
  precision: 14
6070
6301
  });
@@ -6776,17 +7007,17 @@ var rechartsTool = {
6776
7007
  };
6777
7008
 
6778
7009
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/editFile/index.js
6779
- import { z as z137 } from "zod";
7010
+ import { z as z138 } from "zod";
6780
7011
  import { diffLines as diffLines2 } from "diff";
6781
- var editFileSchema = z137.object({
6782
- fileId: z137.string().describe("The ID of the file to edit"),
6783
- instruction: z137.string().describe("Natural language instruction describing the changes to make"),
6784
- selection: z137.object({
6785
- start: z137.number().describe("Starting character position of the selection"),
6786
- end: z137.number().describe("Ending character position of the selection")
7012
+ var editFileSchema = z138.object({
7013
+ fileId: z138.string().describe("The ID of the file to edit"),
7014
+ instruction: z138.string().describe("Natural language instruction describing the changes to make"),
7015
+ selection: z138.object({
7016
+ start: z138.number().describe("Starting character position of the selection"),
7017
+ end: z138.number().describe("Ending character position of the selection")
6787
7018
  }).optional().describe("Optional selection range to edit within the file"),
6788
- preserveFormatting: z137.boolean().optional().default(true).describe("Whether to preserve the original formatting style"),
6789
- returnDiff: z137.boolean().optional().default(true).describe("Whether to return a diff of the changes")
7019
+ preserveFormatting: z138.boolean().optional().default(true).describe("Whether to preserve the original formatting style"),
7020
+ returnDiff: z138.boolean().optional().default(true).describe("Whether to return a diff of the changes")
6790
7021
  });
6791
7022
  function generateSimpleDiff(original, modified) {
6792
7023
  const differences = diffLines2(original, modified);
@@ -9981,8 +10212,343 @@ var editLocalFileTool = {
9981
10212
  })
9982
10213
  };
9983
10214
 
10215
+ // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/recentChanges/index.js
10216
+ import { spawn as spawn2 } from "child_process";
10217
+ var DEFAULT_SINCE = "7 days ago";
10218
+ var DEFAULT_LIMIT = 50;
10219
+ var DEFAULT_INCLUDE_STATS = false;
10220
+ function parseStatusLine(line) {
10221
+ const results = [];
10222
+ if (line.length < 4)
10223
+ return results;
10224
+ const indexStatus = line[0];
10225
+ const workTreeStatus = line[1];
10226
+ const filePath = line.slice(3);
10227
+ const typeMap = {
10228
+ M: "modified",
10229
+ A: "added",
10230
+ D: "deleted",
10231
+ R: "renamed",
10232
+ C: "copied"
10233
+ };
10234
+ if (indexStatus !== " " && indexStatus !== "?") {
10235
+ results.push({
10236
+ path: filePath,
10237
+ status: "staged",
10238
+ type: typeMap[indexStatus] || "modified"
10239
+ });
10240
+ }
10241
+ if (workTreeStatus !== " " && workTreeStatus !== "?") {
10242
+ results.push({
10243
+ path: filePath,
10244
+ status: "unstaged",
10245
+ type: typeMap[workTreeStatus] || "modified"
10246
+ });
10247
+ }
10248
+ if (indexStatus === "?" && workTreeStatus === "?") {
10249
+ results.push({
10250
+ path: filePath,
10251
+ status: "untracked",
10252
+ type: "added"
10253
+ });
10254
+ }
10255
+ return results;
10256
+ }
10257
+ async function getWorkingTreeChanges(filterPath) {
10258
+ const args = ["status", "--porcelain"];
10259
+ if (filterPath) {
10260
+ args.push("--", filterPath);
10261
+ }
10262
+ return new Promise((resolve3) => {
10263
+ const proc = spawn2("git", args, {
10264
+ cwd: process.cwd(),
10265
+ stdio: ["ignore", "pipe", "pipe"]
10266
+ });
10267
+ let stdout = "";
10268
+ proc.stdout.on("data", (data) => {
10269
+ stdout += data.toString();
10270
+ });
10271
+ proc.on("close", (exitCode) => {
10272
+ if (exitCode !== 0) {
10273
+ resolve3([]);
10274
+ return;
10275
+ }
10276
+ const files = stdout.split("\n").filter((line) => line.length > 0).flatMap(parseStatusLine);
10277
+ resolve3(files);
10278
+ });
10279
+ proc.on("error", () => {
10280
+ resolve3([]);
10281
+ });
10282
+ });
10283
+ }
10284
+ async function getRecentChanges(params) {
10285
+ const { since = DEFAULT_SINCE, path: filterPath, limit = DEFAULT_LIMIT, include_stats = DEFAULT_INCLUDE_STATS } = params;
10286
+ const args = ["log", `--since=${since}`, "--name-only", "--pretty=format:"];
10287
+ if (filterPath) {
10288
+ args.push("--", filterPath);
10289
+ }
10290
+ return new Promise((resolve3) => {
10291
+ const proc = spawn2("git", args, {
10292
+ cwd: process.cwd(),
10293
+ stdio: ["ignore", "pipe", "pipe"]
10294
+ });
10295
+ let stdout = "";
10296
+ let stderr = "";
10297
+ proc.stdout.on("data", (data) => {
10298
+ stdout += data.toString();
10299
+ });
10300
+ proc.stderr.on("data", (data) => {
10301
+ stderr += data.toString();
10302
+ });
10303
+ proc.on("close", async (exitCode) => {
10304
+ const workingTree = await getWorkingTreeChanges(filterPath);
10305
+ if (exitCode !== 0) {
10306
+ resolve3({
10307
+ files: [],
10308
+ workingTree,
10309
+ timeRange: since,
10310
+ totalFiles: 0,
10311
+ error: stderr || "Git command failed"
10312
+ });
10313
+ return;
10314
+ }
10315
+ const files = stdout.split("\n").filter((line) => line.trim().length > 0).reduce((acc, filePath) => {
10316
+ const existing = acc.find((f) => f.path === filePath);
10317
+ if (existing) {
10318
+ existing.changes++;
10319
+ } else {
10320
+ acc.push({ path: filePath, changes: 1 });
10321
+ }
10322
+ return acc;
10323
+ }, []);
10324
+ files.sort((a, b) => b.changes - a.changes);
10325
+ const limitedFiles = files.slice(0, limit);
10326
+ if (include_stats && limitedFiles.length > 0) {
10327
+ const filesWithStats = await getFileStats(limitedFiles, since, filterPath);
10328
+ resolve3({
10329
+ files: filesWithStats,
10330
+ workingTree,
10331
+ timeRange: since,
10332
+ totalFiles: files.length
10333
+ });
10334
+ } else {
10335
+ resolve3({
10336
+ files: limitedFiles,
10337
+ workingTree,
10338
+ timeRange: since,
10339
+ totalFiles: files.length
10340
+ });
10341
+ }
10342
+ });
10343
+ proc.on("error", async (error) => {
10344
+ const workingTree = await getWorkingTreeChanges(filterPath);
10345
+ resolve3({
10346
+ files: [],
10347
+ workingTree,
10348
+ timeRange: since,
10349
+ totalFiles: 0,
10350
+ error: `Failed to execute git command: ${error.message}`
10351
+ });
10352
+ });
10353
+ });
10354
+ }
10355
+ async function getFileStats(files, since, filterPath) {
10356
+ const args = ["log", `--since=${since}`, "--numstat", "--pretty=format:"];
10357
+ if (filterPath) {
10358
+ args.push("--", filterPath);
10359
+ }
10360
+ return new Promise((resolve3) => {
10361
+ const proc = spawn2("git", args, {
10362
+ cwd: process.cwd(),
10363
+ stdio: ["ignore", "pipe", "pipe"]
10364
+ });
10365
+ let stdout = "";
10366
+ proc.stdout.on("data", (data) => {
10367
+ stdout += data.toString();
10368
+ });
10369
+ proc.on("close", () => {
10370
+ const stats = /* @__PURE__ */ new Map();
10371
+ stdout.split("\n").forEach((line) => {
10372
+ const match = line.match(/^(\d+)\s+(\d+)\s+(.+)$/);
10373
+ if (match) {
10374
+ const [, additions, deletions, filePath] = match;
10375
+ const existing = stats.get(filePath);
10376
+ if (existing) {
10377
+ existing.additions += parseInt(additions, 10);
10378
+ existing.deletions += parseInt(deletions, 10);
10379
+ } else {
10380
+ stats.set(filePath, {
10381
+ additions: parseInt(additions, 10),
10382
+ deletions: parseInt(deletions, 10)
10383
+ });
10384
+ }
10385
+ }
10386
+ });
10387
+ const result = files.map((file) => {
10388
+ const stat3 = stats.get(file.path);
10389
+ if (stat3) {
10390
+ return { ...file, ...stat3 };
10391
+ }
10392
+ return file;
10393
+ });
10394
+ resolve3(result);
10395
+ });
10396
+ proc.on("error", () => {
10397
+ resolve3(files);
10398
+ });
10399
+ });
10400
+ }
10401
+ function formatResult2(result) {
10402
+ const parts = [];
10403
+ if (result.error) {
10404
+ parts.push(`Error: ${result.error}`);
10405
+ parts.push("");
10406
+ parts.push("Make sure you are running this command in a git repository.");
10407
+ if (result.workingTree.length > 0) {
10408
+ parts.push("");
10409
+ parts.push(formatWorkingTree(result.workingTree));
10410
+ }
10411
+ return parts.join("\n");
10412
+ }
10413
+ if (result.workingTree.length > 0) {
10414
+ parts.push(formatWorkingTree(result.workingTree));
10415
+ parts.push("");
10416
+ }
10417
+ parts.push(`Recently committed files (${result.timeRange}):`);
10418
+ parts.push("");
10419
+ if (result.files.length === 0) {
10420
+ parts.push("No files changed in this time period.");
10421
+ } else {
10422
+ result.files.forEach((file, index) => {
10423
+ const stats = file.additions !== void 0 && file.deletions !== void 0 ? ` (+${file.additions}/-${file.deletions})` : "";
10424
+ parts.push(`${index + 1}. ${file.path} (${file.changes} commits)${stats}`);
10425
+ });
10426
+ if (result.totalFiles > result.files.length) {
10427
+ parts.push("");
10428
+ parts.push(`Showing ${result.files.length} of ${result.totalFiles} changed files.`);
10429
+ parts.push(`Use the 'limit' parameter to see more files.`);
10430
+ }
10431
+ }
10432
+ return parts.join("\n");
10433
+ }
10434
+ function formatWorkingTree(workingTree) {
10435
+ const parts = [];
10436
+ const staged = workingTree.filter((f) => f.status === "staged");
10437
+ const unstaged = workingTree.filter((f) => f.status === "unstaged");
10438
+ const untracked = workingTree.filter((f) => f.status === "untracked");
10439
+ parts.push("Working tree changes:");
10440
+ if (staged.length > 0) {
10441
+ parts.push("");
10442
+ parts.push(` Staged (${staged.length}):`);
10443
+ staged.forEach((f) => parts.push(` ${f.type}: ${f.path}`));
10444
+ }
10445
+ if (unstaged.length > 0) {
10446
+ parts.push("");
10447
+ parts.push(` Unstaged (${unstaged.length}):`);
10448
+ unstaged.forEach((f) => parts.push(` ${f.type}: ${f.path}`));
10449
+ }
10450
+ if (untracked.length > 0) {
10451
+ parts.push("");
10452
+ parts.push(` Untracked (${untracked.length}):`);
10453
+ untracked.forEach((f) => parts.push(` ${f.path}`));
10454
+ }
10455
+ return parts.join("\n");
10456
+ }
10457
+ var recentChangesTool = {
10458
+ name: "recent_changes",
10459
+ implementation: (context) => ({
10460
+ toolFn: async (value) => {
10461
+ const params = value;
10462
+ context.logger.info("RecentChanges: Getting recently changed files", {
10463
+ since: params.since || DEFAULT_SINCE,
10464
+ path: params.path || "all",
10465
+ limit: params.limit || DEFAULT_LIMIT,
10466
+ include_stats: params.include_stats || DEFAULT_INCLUDE_STATS
10467
+ });
10468
+ if (context.onStart) {
10469
+ await context.onStart("recent_changes", {
10470
+ since: params.since,
10471
+ path: params.path
10472
+ });
10473
+ }
10474
+ try {
10475
+ const result = await getRecentChanges(params);
10476
+ const formattedResult = formatResult2(result);
10477
+ context.logger.info("RecentChanges: Retrieved file changes", {
10478
+ totalFiles: result.totalFiles,
10479
+ displayedFiles: result.files.length,
10480
+ error: result.error
10481
+ });
10482
+ if (context.onFinish) {
10483
+ await context.onFinish("recent_changes", {
10484
+ totalFiles: result.totalFiles,
10485
+ displayedFiles: result.files.length
10486
+ });
10487
+ }
10488
+ return formattedResult;
10489
+ } catch (error) {
10490
+ context.logger.error("RecentChanges: Failed to get changes", error);
10491
+ if (context.onFinish) {
10492
+ await context.onFinish("recent_changes", {
10493
+ error: error instanceof Error ? error.message : "Unknown error"
10494
+ });
10495
+ }
10496
+ throw error;
10497
+ }
10498
+ },
10499
+ toolSchema: {
10500
+ name: "recent_changes",
10501
+ description: `Get a list of recently changed files in the git repository, including uncommitted working tree changes (staged, unstaged, and untracked files) plus committed changes sorted by activity. This tool is extremely useful for:
10502
+
10503
+ - **Debugging recent issues**: "Something broke after my last commit" \u2192 See exactly what changed
10504
+ - **Understanding active development**: "What are we working on?" \u2192 See most active files and current work-in-progress
10505
+ - **Code review preparation**: "What changed since last release?" \u2192 Get comprehensive file list
10506
+ - **Feature context**: "What files are part of the new dashboard?" \u2192 Filter by path
10507
+ - **Current work-in-progress**: See staged, unstaged, and untracked files alongside commit history
10508
+
10509
+ The tool combines git status (working tree) with git log (commit history) to give a complete picture of recent activity. Working tree changes are shown first, followed by committed files ranked by number of commits (most active first).
10510
+
10511
+ **Time Range Examples:**
10512
+ - "7 days ago" (default)
10513
+ - "2 hours ago"
10514
+ - "3 weeks ago"
10515
+ - "2025-01-01"
10516
+ - "yesterday"
10517
+
10518
+ **Path Filter Examples:**
10519
+ - "src/components" - Only files in components directory
10520
+ - "apps/client" - Only client app files
10521
+ - "**/*.test.ts" - Only test files (use glob patterns)
10522
+
10523
+ **Performance:** Very fast (< 1 second) since it only queries git metadata, not file contents.`,
10524
+ parameters: {
10525
+ type: "object",
10526
+ properties: {
10527
+ since: {
10528
+ type: "string",
10529
+ description: 'Time range for changes (default: "7 days ago"). Examples: "2 hours ago", "3 weeks ago", "2025-01-01", "yesterday".'
10530
+ },
10531
+ path: {
10532
+ type: "string",
10533
+ description: 'Optional path filter to limit results to specific directory or pattern. Examples: "src/components", "apps/client", "**/*.test.ts".'
10534
+ },
10535
+ limit: {
10536
+ type: "number",
10537
+ description: "Maximum number of files to return (default: 50). Files are sorted by activity (most commits first)."
10538
+ },
10539
+ include_stats: {
10540
+ type: "boolean",
10541
+ description: "Include lines added/removed statistics for each file (default: false). Note: This makes the command slightly slower."
10542
+ }
10543
+ },
10544
+ required: []
10545
+ }
10546
+ }
10547
+ })
10548
+ };
10549
+
9984
10550
  // ../../b4m-core/packages/services/dist/src/llm/tools/index.js
9985
- var tools = {
10551
+ var b4mTools = {
9986
10552
  dice_roll: diceRollTool,
9987
10553
  weather_info: weatherTool,
9988
10554
  image_generation: imageGenerationTool,
@@ -10005,18 +10571,23 @@ var tools = {
10005
10571
  sunrise_sunset: sunriseSunsetTool,
10006
10572
  iss_tracker: issTrackerTool,
10007
10573
  planet_visibility: planetVisibilityTool,
10574
+ // Knowledge base search
10575
+ search_knowledge_base: knowledgeBaseSearchTool
10576
+ };
10577
+ var cliOnlyTools = {
10578
+ // File operation tools
10008
10579
  file_read: fileReadTool,
10009
10580
  create_file: createFileTool,
10010
10581
  edit_local_file: editLocalFileTool,
10011
10582
  glob_files: globFilesTool,
10012
10583
  grep_search: grepSearchTool,
10013
10584
  delete_file: deleteFileTool,
10014
- // Knowledge base search
10015
- search_knowledge_base: knowledgeBaseSearchTool,
10016
10585
  // Shell execution
10017
- bash_execute: bashExecuteTool
10586
+ bash_execute: bashExecuteTool,
10587
+ // Git operations
10588
+ recent_changes: recentChangesTool
10018
10589
  };
10019
- var generateTools = (userId, user, logger2, { db }, storage, imageGenerateStorage, statusUpdate, onStart, onFinish, llm, config, model) => {
10590
+ var generateTools = (userId, user, logger2, { db }, storage, imageGenerateStorage, statusUpdate, onStart, onFinish, llm, config, model, tools = b4mTools) => {
10020
10591
  const context = {
10021
10592
  userId,
10022
10593
  user,
@@ -10037,9 +10608,9 @@ var generateTools = (userId, user, logger2, { db }, storage, imageGenerateStorag
10037
10608
  };
10038
10609
  var ATLASSIAN_RECONNECT_MESSAGE = "\u26A0\uFE0F Your Atlassian connection has expired.\n\nPlease reconnect your Atlassian account in Settings > Connected Apps to continue using Confluence and Jira tools.";
10039
10610
  var generateMcpTools = async (mcpData) => {
10040
- let tools2;
10611
+ let tools;
10041
10612
  try {
10042
- tools2 = await mcpData.getTools();
10613
+ tools = await mcpData.getTools();
10043
10614
  } catch (error) {
10044
10615
  const errorName = error instanceof Error ? error.name : "";
10045
10616
  if (errorName === "AtlassianReconnectRequiredError") {
@@ -10048,12 +10619,12 @@ var generateMcpTools = async (mcpData) => {
10048
10619
  }
10049
10620
  throw error;
10050
10621
  }
10051
- const toolList = Array.isArray(tools2) ? tools2 : tools2?.tools || [];
10052
- if (!Array.isArray(tools2)) {
10053
- console.warn(`MCP server ${mcpData.serverName} returned unexpected tools payload:`, JSON.stringify(tools2));
10622
+ const toolList = Array.isArray(tools) ? tools : tools?.tools || [];
10623
+ if (!Array.isArray(tools)) {
10624
+ console.warn(`MCP server ${mcpData.serverName} returned unexpected tools payload:`, JSON.stringify(tools));
10054
10625
  }
10055
10626
  if (!Array.isArray(toolList)) {
10056
- throw new Error(`Expected getTools() to return an array, but got ${typeof tools2}`);
10627
+ throw new Error(`Expected getTools() to return an array, but got ${typeof tools}`);
10057
10628
  }
10058
10629
  const result = toolList.map((item) => {
10059
10630
  const { name: originalToolName, ...rest } = item;
@@ -10123,47 +10694,47 @@ var generateMcpTools = async (mcpData) => {
10123
10694
  import throttle2 from "lodash/throttle.js";
10124
10695
 
10125
10696
  // ../../b4m-core/packages/services/dist/src/llm/ChatCompletionFeatures.js
10126
- import { z as z138 } from "zod";
10697
+ import { z as z139 } from "zod";
10127
10698
  import uniq4 from "lodash/uniq.js";
10128
- var QuestStartBodySchema = z138.object({
10129
- userId: z138.string(),
10130
- sessionId: z138.string(),
10131
- questId: z138.string(),
10132
- message: z138.string(),
10133
- messageFileIds: z138.array(z138.string()),
10134
- historyCount: z138.number(),
10135
- fabFileIds: z138.array(z138.string()),
10699
+ var QuestStartBodySchema = z139.object({
10700
+ userId: z139.string(),
10701
+ sessionId: z139.string(),
10702
+ questId: z139.string(),
10703
+ message: z139.string(),
10704
+ messageFileIds: z139.array(z139.string()),
10705
+ historyCount: z139.number(),
10706
+ fabFileIds: z139.array(z139.string()),
10136
10707
  params: ChatCompletionCreateInputSchema,
10137
10708
  dashboardParams: DashboardParamsSchema.optional(),
10138
- enableQuestMaster: z138.boolean().optional(),
10139
- enableMementos: z138.boolean().optional(),
10140
- enableArtifacts: z138.boolean().optional(),
10141
- enableAgents: z138.boolean().optional(),
10709
+ enableQuestMaster: z139.boolean().optional(),
10710
+ enableMementos: z139.boolean().optional(),
10711
+ enableArtifacts: z139.boolean().optional(),
10712
+ enableAgents: z139.boolean().optional(),
10142
10713
  promptMeta: PromptMetaZodSchema,
10143
- tools: z138.array(z138.union([b4mLLMTools, z138.string()])).optional(),
10144
- mcpServers: z138.array(z138.string()).optional(),
10145
- projectId: z138.string().optional(),
10146
- organizationId: z138.string().nullable().optional(),
10714
+ tools: z139.array(z139.union([b4mLLMTools, z139.string()])).optional(),
10715
+ mcpServers: z139.array(z139.string()).optional(),
10716
+ projectId: z139.string().optional(),
10717
+ organizationId: z139.string().nullable().optional(),
10147
10718
  questMaster: QuestMasterParamsSchema.optional(),
10148
- toolPromptId: z138.string().optional(),
10719
+ toolPromptId: z139.string().optional(),
10149
10720
  researchMode: ResearchModeParamsSchema.optional(),
10150
- fallbackModel: z138.string().optional(),
10151
- embeddingModel: z138.string().optional(),
10152
- queryComplexity: z138.string(),
10721
+ fallbackModel: z139.string().optional(),
10722
+ embeddingModel: z139.string().optional(),
10723
+ queryComplexity: z139.string(),
10153
10724
  imageConfig: GenerateImageToolCallSchema.optional(),
10154
- deepResearchConfig: z138.object({
10155
- maxDepth: z138.number().optional(),
10156
- duration: z138.number().optional(),
10725
+ deepResearchConfig: z139.object({
10726
+ maxDepth: z139.number().optional(),
10727
+ duration: z139.number().optional(),
10157
10728
  // Note: searchers are passed via ToolContext and not through this API schema
10158
- searchers: z138.array(z138.any()).optional()
10729
+ searchers: z139.array(z139.any()).optional()
10159
10730
  }).optional(),
10160
- extraContextMessages: z138.array(z138.object({
10161
- role: z138.enum(["user", "assistant", "system", "function", "tool"]),
10162
- content: z138.union([z138.string(), z138.array(z138.any())]),
10163
- fabFileIds: z138.array(z138.string()).optional()
10731
+ extraContextMessages: z139.array(z139.object({
10732
+ role: z139.enum(["user", "assistant", "system", "function", "tool"]),
10733
+ content: z139.union([z139.string(), z139.array(z139.any())]),
10734
+ fabFileIds: z139.array(z139.string()).optional()
10164
10735
  })).optional(),
10165
10736
  /** User's timezone (IANA format, e.g., "America/New_York") */
10166
- timezone: z138.string().optional()
10737
+ timezone: z139.string().optional()
10167
10738
  });
10168
10739
 
10169
10740
  // ../../b4m-core/packages/services/dist/src/llm/StatusManager.js
@@ -10183,89 +10754,89 @@ var BUILT_IN_TOOL_SET = new Set(b4mLLMTools.options);
10183
10754
  import axios8 from "axios";
10184
10755
  import { fileTypeFromBuffer as fileTypeFromBuffer4 } from "file-type";
10185
10756
  import { v4 as uuidv47 } from "uuid";
10186
- import { z as z139 } from "zod";
10757
+ import { z as z140 } from "zod";
10187
10758
  import { fromZodError as fromZodError2 } from "zod-validation-error";
10188
10759
  var ImageGenerationBodySchema = OpenAIImageGenerationInput.extend({
10189
- sessionId: z139.string(),
10190
- questId: z139.string(),
10191
- userId: z139.string(),
10192
- prompt: z139.string(),
10193
- organizationId: z139.string().nullable().optional(),
10194
- safety_tolerance: z139.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
10195
- prompt_upsampling: z139.boolean().optional().default(false),
10196
- seed: z139.number().nullable().optional(),
10197
- output_format: z139.enum(["jpeg", "png"]).nullable().optional().default("png"),
10198
- width: z139.number().optional(),
10199
- height: z139.number().optional(),
10200
- aspect_ratio: z139.string().optional(),
10201
- fabFileIds: z139.array(z139.string()).optional()
10760
+ sessionId: z140.string(),
10761
+ questId: z140.string(),
10762
+ userId: z140.string(),
10763
+ prompt: z140.string(),
10764
+ organizationId: z140.string().nullable().optional(),
10765
+ safety_tolerance: z140.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
10766
+ prompt_upsampling: z140.boolean().optional().default(false),
10767
+ seed: z140.number().nullable().optional(),
10768
+ output_format: z140.enum(["jpeg", "png"]).nullable().optional().default("png"),
10769
+ width: z140.number().optional(),
10770
+ height: z140.number().optional(),
10771
+ aspect_ratio: z140.string().optional(),
10772
+ fabFileIds: z140.array(z140.string()).optional()
10202
10773
  });
10203
10774
 
10204
10775
  // ../../b4m-core/packages/services/dist/src/llm/VideoGeneration.js
10205
10776
  import axios9 from "axios";
10206
10777
  import { v4 as uuidv48 } from "uuid";
10207
- import { z as z140 } from "zod";
10778
+ import { z as z141 } from "zod";
10208
10779
  import { fromZodError as fromZodError3 } from "zod-validation-error";
10209
- var VideoGenerationBodySchema = z140.object({
10210
- sessionId: z140.string(),
10211
- questId: z140.string(),
10212
- userId: z140.string(),
10213
- prompt: z140.string(),
10214
- model: z140.nativeEnum(VideoModels).default(VideoModels.SORA_2),
10215
- seconds: z140.union([z140.literal(4), z140.literal(8), z140.literal(12)]).default(4),
10216
- size: z140.enum(["720x1280", "1280x720", "1024x1792", "1792x1024"]).default(VIDEO_SIZE_CONSTRAINTS.SORA.defaultSize),
10217
- organizationId: z140.string().nullable().optional()
10780
+ var VideoGenerationBodySchema = z141.object({
10781
+ sessionId: z141.string(),
10782
+ questId: z141.string(),
10783
+ userId: z141.string(),
10784
+ prompt: z141.string(),
10785
+ model: z141.nativeEnum(VideoModels).default(VideoModels.SORA_2),
10786
+ seconds: z141.union([z141.literal(4), z141.literal(8), z141.literal(12)]).default(4),
10787
+ size: z141.enum(["720x1280", "1280x720", "1024x1792", "1792x1024"]).default(VIDEO_SIZE_CONSTRAINTS.SORA.defaultSize),
10788
+ organizationId: z141.string().nullable().optional()
10218
10789
  });
10219
10790
 
10220
10791
  // ../../b4m-core/packages/services/dist/src/llm/ImageEdit.js
10221
10792
  import axios10 from "axios";
10222
10793
  import { fileTypeFromBuffer as fileTypeFromBuffer5 } from "file-type";
10223
10794
  import { v4 as uuidv49 } from "uuid";
10224
- import { z as z141 } from "zod";
10795
+ import { z as z142 } from "zod";
10225
10796
  import { fromZodError as fromZodError4 } from "zod-validation-error";
10226
10797
  var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
10227
- sessionId: z141.string(),
10228
- questId: z141.string(),
10229
- userId: z141.string(),
10230
- prompt: z141.string(),
10231
- organizationId: z141.string().nullable().optional(),
10232
- safety_tolerance: z141.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
10233
- prompt_upsampling: z141.boolean().optional().default(false),
10234
- seed: z141.number().nullable().optional(),
10235
- output_format: z141.enum(["jpeg", "png"]).optional().default("png"),
10236
- width: z141.number().optional(),
10237
- height: z141.number().optional(),
10238
- aspect_ratio: z141.string().optional(),
10239
- size: z141.string().optional(),
10240
- fabFileIds: z141.array(z141.string()).optional(),
10241
- image: z141.string()
10798
+ sessionId: z142.string(),
10799
+ questId: z142.string(),
10800
+ userId: z142.string(),
10801
+ prompt: z142.string(),
10802
+ organizationId: z142.string().nullable().optional(),
10803
+ safety_tolerance: z142.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
10804
+ prompt_upsampling: z142.boolean().optional().default(false),
10805
+ seed: z142.number().nullable().optional(),
10806
+ output_format: z142.enum(["jpeg", "png"]).optional().default("png"),
10807
+ width: z142.number().optional(),
10808
+ height: z142.number().optional(),
10809
+ aspect_ratio: z142.string().optional(),
10810
+ size: z142.string().optional(),
10811
+ fabFileIds: z142.array(z142.string()).optional(),
10812
+ image: z142.string()
10242
10813
  });
10243
10814
 
10244
10815
  // ../../b4m-core/packages/services/dist/src/llm/refineText.js
10245
- import { z as z142 } from "zod";
10246
- var refineTextLLMSchema = z142.object({
10247
- text: z142.string(),
10248
- context: z142.string().optional()
10816
+ import { z as z143 } from "zod";
10817
+ var refineTextLLMSchema = z143.object({
10818
+ text: z143.string(),
10819
+ context: z143.string().optional()
10249
10820
  // tone: z.enum(['formal', 'informal', 'neutral']).optional(),
10250
10821
  // style: z.enum(['technical', 'creative', 'academic', 'business', 'narrative']).optional(),
10251
10822
  });
10252
10823
 
10253
10824
  // ../../b4m-core/packages/services/dist/src/llm/MementoEvaluationService.js
10254
- import { z as z143 } from "zod";
10255
- var SingleMementoEvalSchema = z143.object({
10256
- importance: z143.number().min(1).max(10),
10825
+ import { z as z144 } from "zod";
10826
+ var SingleMementoEvalSchema = z144.object({
10827
+ importance: z144.number().min(1).max(10),
10257
10828
  // 1-10 scale for personal info importance
10258
- summary: z143.string(),
10259
- tags: z143.array(z143.string()).optional()
10829
+ summary: z144.string(),
10830
+ tags: z144.array(z144.string()).optional()
10260
10831
  });
10261
- var MementoEvalResponseSchema = z143.object({
10262
- isPersonal: z143.boolean(),
10263
- mementos: z143.array(SingleMementoEvalSchema).optional()
10832
+ var MementoEvalResponseSchema = z144.object({
10833
+ isPersonal: z144.boolean(),
10834
+ mementos: z144.array(SingleMementoEvalSchema).optional()
10264
10835
  // Array of distinct personal information
10265
10836
  });
10266
10837
 
10267
10838
  // ../../b4m-core/packages/services/dist/src/llm/SmallLLMService.js
10268
- import { z as z144 } from "zod";
10839
+ import { z as z145 } from "zod";
10269
10840
 
10270
10841
  // ../../b4m-core/packages/services/dist/src/auth/AccessTokenGeneratorService.js
10271
10842
  import jwt2 from "jsonwebtoken";
@@ -10392,7 +10963,8 @@ var LOCAL_TOOLS = [
10392
10963
  "dice_roll",
10393
10964
  "math_evaluate",
10394
10965
  "current_datetime",
10395
- "bash_execute"
10966
+ "bash_execute",
10967
+ "recent_changes"
10396
10968
  ];
10397
10969
  function isServerTool(toolName) {
10398
10970
  return SERVER_TOOLS.includes(toolName);
@@ -10418,11 +10990,11 @@ async function executeTool(toolName, input, apiClient, localToolFn) {
10418
10990
  }
10419
10991
 
10420
10992
  // src/utils/shellRunner.ts
10421
- import { spawn as spawn2 } from "child_process";
10993
+ import { spawn as spawn3 } from "child_process";
10422
10994
  async function runShellCommand(options) {
10423
10995
  const { command, cwd, timeoutMs, env, stdin } = options;
10424
10996
  return new Promise((resolve3) => {
10425
- const child = spawn2("bash", ["-c", command], {
10997
+ const child = spawn3("bash", ["-c", command], {
10426
10998
  cwd,
10427
10999
  env,
10428
11000
  stdio: ["pipe", "pipe", "pipe"]
@@ -10557,7 +11129,7 @@ function buildHookContext(params) {
10557
11129
  }
10558
11130
 
10559
11131
  // src/agents/types.ts
10560
- import { z as z145 } from "zod";
11132
+ import { z as z146 } from "zod";
10561
11133
  var HookBlockedError = class extends Error {
10562
11134
  constructor(toolName, reason) {
10563
11135
  super(`Hook blocked execution of ${toolName}: ${reason || "No reason provided"}`);
@@ -10569,39 +11141,39 @@ var ALWAYS_DENIED_FOR_AGENTS = [
10569
11141
  "agent_delegate"
10570
11142
  // No agent chaining
10571
11143
  ];
10572
- var CommandHookSchema = z145.object({
10573
- type: z145.literal("command"),
10574
- command: z145.string().min(1, "Command is required for command hooks"),
10575
- timeout: z145.number().optional()
10576
- });
10577
- var PromptHookSchema = z145.object({
10578
- type: z145.literal("prompt"),
10579
- prompt: z145.string().min(1, "Prompt is required for prompt hooks"),
10580
- timeout: z145.number().optional()
10581
- });
10582
- var HookDefinitionSchema = z145.discriminatedUnion("type", [CommandHookSchema, PromptHookSchema]);
10583
- var HookMatcherSchema = z145.object({
10584
- matcher: z145.string().optional(),
10585
- hooks: z145.array(HookDefinitionSchema)
10586
- });
10587
- var AgentHooksSchema = z145.object({
10588
- PreToolUse: z145.array(HookMatcherSchema).optional(),
10589
- PostToolUse: z145.array(HookMatcherSchema).optional(),
10590
- PostToolUseFailure: z145.array(HookMatcherSchema).optional(),
10591
- Stop: z145.array(HookMatcherSchema).optional()
11144
+ var CommandHookSchema = z146.object({
11145
+ type: z146.literal("command"),
11146
+ command: z146.string().min(1, "Command is required for command hooks"),
11147
+ timeout: z146.number().optional()
11148
+ });
11149
+ var PromptHookSchema = z146.object({
11150
+ type: z146.literal("prompt"),
11151
+ prompt: z146.string().min(1, "Prompt is required for prompt hooks"),
11152
+ timeout: z146.number().optional()
11153
+ });
11154
+ var HookDefinitionSchema = z146.discriminatedUnion("type", [CommandHookSchema, PromptHookSchema]);
11155
+ var HookMatcherSchema = z146.object({
11156
+ matcher: z146.string().optional(),
11157
+ hooks: z146.array(HookDefinitionSchema)
11158
+ });
11159
+ var AgentHooksSchema = z146.object({
11160
+ PreToolUse: z146.array(HookMatcherSchema).optional(),
11161
+ PostToolUse: z146.array(HookMatcherSchema).optional(),
11162
+ PostToolUseFailure: z146.array(HookMatcherSchema).optional(),
11163
+ Stop: z146.array(HookMatcherSchema).optional()
10592
11164
  }).optional();
10593
- var AgentFrontmatterSchema = z145.object({
10594
- description: z145.string().min(1, "Agent description is required"),
10595
- model: z145.string().optional(),
10596
- "allowed-tools": z145.array(z145.string()).optional(),
10597
- "denied-tools": z145.array(z145.string()).optional(),
10598
- "max-iterations": z145.object({
10599
- quick: z145.number().int().positive().optional(),
10600
- medium: z145.number().int().positive().optional(),
10601
- very_thorough: z145.number().int().positive().optional()
11165
+ var AgentFrontmatterSchema = z146.object({
11166
+ description: z146.string().min(1, "Agent description is required"),
11167
+ model: z146.string().optional(),
11168
+ "allowed-tools": z146.array(z146.string()).optional(),
11169
+ "denied-tools": z146.array(z146.string()).optional(),
11170
+ "max-iterations": z146.object({
11171
+ quick: z146.number().int().positive().optional(),
11172
+ medium: z146.number().int().positive().optional(),
11173
+ very_thorough: z146.number().int().positive().optional()
10602
11174
  }).optional(),
10603
- "default-thoroughness": z145.enum(["quick", "medium", "very_thorough"]).optional(),
10604
- variables: z145.record(z145.string()).optional(),
11175
+ "default-thoroughness": z146.enum(["quick", "medium", "very_thorough"]).optional(),
11176
+ variables: z146.record(z146.string()).optional(),
10605
11177
  hooks: AgentHooksSchema
10606
11178
  });
10607
11179
  var DEFAULT_MAX_ITERATIONS = {
@@ -10662,6 +11234,12 @@ function wrapToolWithPermission(tool, permissionManager, showPermissionPrompt, a
10662
11234
  agentContext.observationQueue.push({ toolName, result: result2 });
10663
11235
  return result2;
10664
11236
  }
11237
+ const { useCliStore: useCliStore2 } = await import("./store-JNTO6SRG.js");
11238
+ if (useCliStore2.getState().autoAcceptEdits) {
11239
+ const result2 = await executeTool(toolName, args, apiClient, originalFn);
11240
+ agentContext.observationQueue.push({ toolName, result: result2 });
11241
+ return result2;
11242
+ }
10665
11243
  let preview;
10666
11244
  if (toolName === "edit_local_file" && args?.path && args?.old_string && typeof args?.new_string === "string") {
10667
11245
  try {
@@ -10845,37 +11423,21 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
10845
11423
  adminSettings: mockAdminSettings
10846
11424
  }
10847
11425
  };
10848
- const toolConfig = {
11426
+ const enabledB4mToolNames = [
10849
11427
  // Local-only tools (no external API keys needed)
10850
- dice_roll: {},
10851
- math_evaluate: {},
10852
- current_datetime: {},
10853
- prompt_enhancement: {},
10854
- // File operation tools (CLI-specific, local execution)
10855
- file_read: {},
10856
- create_file: {},
10857
- edit_local_file: {},
10858
- glob_files: {},
10859
- grep_search: {},
10860
- delete_file: {},
10861
- // Shell execution (always requires permission)
10862
- bash_execute: {},
11428
+ "dice_roll",
11429
+ "math_evaluate",
11430
+ "current_datetime",
11431
+ "prompt_enhancement",
10863
11432
  // Server-side tools (executed via /api/ai/v1/tools Lambda)
10864
- // Routed by ToolRouter to use B4M company API keys
10865
- weather_info: {},
10866
- web_search: {},
10867
- web_fetch: {}
10868
- // Disable web-only tools
10869
- // blog_publish: undefined,
10870
- // blog_edit: undefined,
10871
- // blog_draft: undefined,
10872
- // image_generation: undefined,
10873
- // edit_image: undefined,
10874
- // mermaid_chart: undefined,
10875
- // recharts: undefined,
10876
- // edit_file: undefined,
10877
- // deep_research: undefined,
10878
- };
11433
+ "weather_info",
11434
+ "web_search",
11435
+ "web_fetch"
11436
+ ];
11437
+ const filteredB4mTools = Object.fromEntries(
11438
+ enabledB4mToolNames.filter((name) => name in b4mTools).map((name) => [name, b4mTools[name]])
11439
+ );
11440
+ const tools_to_generate = { ...filteredB4mTools, ...cliOnlyTools };
10879
11441
  const toolsMap = generateTools(
10880
11442
  userId,
10881
11443
  user,
@@ -10888,17 +11450,18 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
10888
11450
  onStart,
10889
11451
  onFinish,
10890
11452
  llm,
10891
- toolConfig,
10892
- model
11453
+ {},
11454
+ model,
11455
+ tools_to_generate
10893
11456
  );
10894
- let tools2 = Object.entries(toolsMap).filter(([key]) => toolConfig[key] !== void 0).map(
11457
+ let tools = Object.entries(toolsMap).map(
10895
11458
  ([_, tool]) => wrapToolWithPermission(tool, permissionManager, showPermissionPrompt, agentContext, configStore, apiClient)
10896
11459
  );
10897
11460
  if (toolFilter) {
10898
11461
  const { allowedTools, deniedTools } = toolFilter;
10899
11462
  const normalizedAllowed = allowedTools?.map(normalizeToolName);
10900
11463
  const normalizedDenied = deniedTools?.map(normalizeToolName);
10901
- tools2 = tools2.filter((tool) => {
11464
+ tools = tools.filter((tool) => {
10902
11465
  const toolName = tool.toolSchema.name;
10903
11466
  if (normalizedDenied && normalizedDenied.includes(toolName)) {
10904
11467
  return false;
@@ -10909,68 +11472,7 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
10909
11472
  return true;
10910
11473
  });
10911
11474
  }
10912
- return { tools: tools2, agentContext };
10913
- }
10914
-
10915
- // src/config/toolSafety.ts
10916
- import { z as z146 } from "zod";
10917
- var ToolCategorySchema = z146.enum([
10918
- "auto_approve",
10919
- // Safe tools that run automatically without permission
10920
- "prompt_always",
10921
- // Dangerous tools that ALWAYS require permission (cannot be trusted)
10922
- "prompt_default"
10923
- // Tools that prompt by default but can be trusted
10924
- ]);
10925
- var ToolSafetyConfigSchema = z146.object({
10926
- categories: z146.record(z146.string(), ToolCategorySchema),
10927
- trustedTools: z146.array(z146.string())
10928
- });
10929
- var DEFAULT_TOOL_CATEGORIES = {
10930
- // ===== AUTO APPROVE (Safe tools) =====
10931
- // These tools have no side effects and are always safe to execute
10932
- math_evaluate: "auto_approve",
10933
- current_datetime: "auto_approve",
10934
- dice_roll: "auto_approve",
10935
- prompt_enhancement: "auto_approve",
10936
- weather_info: "prompt_default",
10937
- // ===== PROMPT ALWAYS (Dangerous tools) =====
10938
- // These tools can modify files, execute code, or have other dangerous side effects
10939
- // They ALWAYS require permission and cannot be trusted automatically
10940
- edit_file: "prompt_always",
10941
- edit_local_file: "prompt_always",
10942
- create_file: "prompt_always",
10943
- delete_file: "prompt_always",
10944
- shell_execute: "prompt_always",
10945
- bash_execute: "prompt_always",
10946
- git_commit: "prompt_always",
10947
- git_push: "prompt_always",
10948
- // ===== PROMPT DEFAULT (Repository read tools) =====
10949
- // These tools read from the repository but don't modify anything
10950
- // Users can trust them if they want to avoid prompts
10951
- web_search: "prompt_default",
10952
- deep_research: "prompt_default",
10953
- file_read: "prompt_default",
10954
- grep_search: "prompt_default",
10955
- glob_files: "prompt_default",
10956
- get_file_tree: "prompt_default",
10957
- git_status: "prompt_default",
10958
- git_diff: "prompt_default",
10959
- git_log: "prompt_default",
10960
- git_branch: "prompt_default"
10961
- };
10962
- function getToolCategory(toolName, customCategories) {
10963
- if (customCategories && toolName in customCategories) {
10964
- return customCategories[toolName];
10965
- }
10966
- if (toolName in DEFAULT_TOOL_CATEGORIES) {
10967
- return DEFAULT_TOOL_CATEGORIES[toolName];
10968
- }
10969
- return "prompt_default";
10970
- }
10971
- function canTrustTool(toolName, customCategories) {
10972
- const category = getToolCategory(toolName, customCategories);
10973
- return category !== "prompt_always";
11475
+ return { tools, agentContext };
10974
11476
  }
10975
11477
 
10976
11478
  // src/utils/PermissionManager.ts
@@ -11348,9 +11850,9 @@ var TokenCounter = class {
11348
11850
  * Count tokens in tool schemas.
11349
11851
  * Tool schemas are sent as part of the API call and consume context.
11350
11852
  */
11351
- countToolSchemaTokens(tools2) {
11352
- if (tools2.length === 0) return 0;
11353
- const schemaText = tools2.map(
11853
+ countToolSchemaTokens(tools) {
11854
+ if (tools.length === 0) return 0;
11855
+ const schemaText = tools.map(
11354
11856
  ({ toolSchema }) => `Tool: ${toolSchema.name}
11355
11857
  Description: ${toolSchema.description}
11356
11858
  Parameters: ${JSON.stringify(toolSchema.parameters)}`
@@ -11652,14 +12154,14 @@ var McpManager = class {
11652
12154
  getTools: async () => client.tools,
11653
12155
  callTool: async (name, args) => client.callTool(name, args)
11654
12156
  };
11655
- const tools2 = await generateMcpTools(mcpData);
12157
+ const tools = await generateMcpTools(mcpData);
11656
12158
  this.servers.set(serverConfig.name, {
11657
12159
  name: serverConfig.name,
11658
12160
  client,
11659
- tools: tools2
12161
+ tools
11660
12162
  });
11661
12163
  this.connectionStates.set(serverConfig.name, "connected");
11662
- logger.debug(`\u2705 Connected to ${serverConfig.name} (${tools2.length} tools)`);
12164
+ logger.debug(`\u2705 Connected to ${serverConfig.name} (${tools.length} tools)`);
11663
12165
  } catch (error) {
11664
12166
  this.connectionStates.set(serverConfig.name, "failed");
11665
12167
  logger.debug(`\u274C Failed to connect to ${serverConfig.name}: ${error}`);
@@ -12544,7 +13046,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
12544
13046
  // package.json
12545
13047
  var package_default = {
12546
13048
  name: "@bike4mind/cli",
12547
- version: "0.2.25-cli-file-read-offset.18514+53b238fc9",
13049
+ version: "0.2.25-cli-file-read-offset.18541+a5717c121",
12548
13050
  type: "module",
12549
13051
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
12550
13052
  license: "UNLICENSED",
@@ -12652,10 +13154,10 @@ var package_default = {
12652
13154
  },
12653
13155
  devDependencies: {
12654
13156
  "@bike4mind/agents": "0.1.0",
12655
- "@bike4mind/common": "2.47.2-cli-file-read-offset.18514+53b238fc9",
12656
- "@bike4mind/mcp": "1.28.1-cli-file-read-offset.18514+53b238fc9",
12657
- "@bike4mind/services": "2.45.2-cli-file-read-offset.18514+53b238fc9",
12658
- "@bike4mind/utils": "2.3.4-cli-file-read-offset.18514+53b238fc9",
13157
+ "@bike4mind/common": "2.47.2-cli-file-read-offset.18541+a5717c121",
13158
+ "@bike4mind/mcp": "1.28.1-cli-file-read-offset.18541+a5717c121",
13159
+ "@bike4mind/services": "2.45.2-cli-file-read-offset.18541+a5717c121",
13160
+ "@bike4mind/utils": "2.3.4-cli-file-read-offset.18541+a5717c121",
12659
13161
  "@types/better-sqlite3": "^7.6.13",
12660
13162
  "@types/diff": "^5.0.9",
12661
13163
  "@types/jsonwebtoken": "^9.0.4",
@@ -12672,7 +13174,7 @@ var package_default = {
12672
13174
  optionalDependencies: {
12673
13175
  "@vscode/ripgrep": "^1.17.0"
12674
13176
  },
12675
- gitHead: "53b238fc928978c41a9cb6e4081b79f3f92db65f"
13177
+ gitHead: "a5717c121a35ad3b958b4f8471fe5a3b94781c42"
12676
13178
  };
12677
13179
 
12678
13180
  // src/config/constants.ts
@@ -12791,7 +13293,9 @@ var SubagentOrchestrator = class {
12791
13293
  let result;
12792
13294
  try {
12793
13295
  result = await agent.run(task, {
12794
- maxIterations
13296
+ maxIterations,
13297
+ parallelExecution: this.deps.enableParallelToolExecution === true,
13298
+ isReadOnlyTool
12795
13299
  });
12796
13300
  } catch (error) {
12797
13301
  if (error instanceof HookBlockedError) {
@@ -13790,7 +14294,7 @@ function CliApp() {
13790
14294
  process.exit(0);
13791
14295
  }, 100);
13792
14296
  }, [state.session, state.sessionStore, state.mcpManager, state.agent, state.imageStore]);
13793
- useInput7((input, key) => {
14297
+ useInput8((input, key) => {
13794
14298
  if (key.escape) {
13795
14299
  if (state.abortController) {
13796
14300
  logger.debug("[ABORT] ESC pressed - aborting current operation...");
@@ -13955,7 +14459,7 @@ function CliApp() {
13955
14459
  currentAgent: null,
13956
14460
  observationQueue: []
13957
14461
  };
13958
- const { tools: b4mTools } = generateCliTools(
14462
+ const { tools: b4mTools2 } = generateCliTools(
13959
14463
  config.userId,
13960
14464
  llm,
13961
14465
  modelInfo.id,
@@ -13965,7 +14469,7 @@ function CliApp() {
13965
14469
  state.configStore,
13966
14470
  apiClient
13967
14471
  );
13968
- console.log(`\u{1F6E0}\uFE0F Loaded ${b4mTools.length} B4M tool(s)`);
14472
+ console.log(`\u{1F6E0}\uFE0F Loaded ${b4mTools2.length} B4M tool(s)`);
13969
14473
  const mcpManager = new McpManager(config);
13970
14474
  await mcpManager.initialize();
13971
14475
  const mcpTools = mcpManager.getTools();
@@ -13991,7 +14495,8 @@ function CliApp() {
13991
14495
  showPermissionPrompt: promptFn,
13992
14496
  configStore: state.configStore,
13993
14497
  apiClient,
13994
- agentStore
14498
+ agentStore,
14499
+ enableParallelToolExecution: config.preferences.enableParallelToolExecution === true
13995
14500
  });
13996
14501
  const agentDelegateTool = createAgentDelegateTool(orchestrator, agentStore, newSession.id);
13997
14502
  const todoStore = createTodoStore();
@@ -14006,7 +14511,7 @@ function CliApp() {
14006
14511
  if (skillTool) {
14007
14512
  cliTools.push(skillTool);
14008
14513
  }
14009
- const allTools = [...b4mTools, ...mcpTools, ...cliTools];
14514
+ const allTools = [...b4mTools2, ...mcpTools, ...cliTools];
14010
14515
  console.log(`\u{1F4C2} Working directory: ${process.cwd()}`);
14011
14516
  console.log(`\u{1F916} Subagent delegation enabled (explore, plan, review)`);
14012
14517
  if (skillTool) {
@@ -14016,7 +14521,7 @@ function CliApp() {
14016
14521
  }
14017
14522
  }
14018
14523
  logger.debug(
14019
- `Total tools available to agent: ${allTools.length} (${b4mTools.length} B4M + ${mcpTools.length} MCP + ${cliTools.length} CLI)`
14524
+ `Total tools available to agent: ${allTools.length} (${b4mTools2.length} B4M + ${mcpTools.length} MCP + ${cliTools.length} CLI)`
14020
14525
  );
14021
14526
  const projectDir = state.configStore.getProjectConfigDir();
14022
14527
  const contextResult = await loadContextFiles(projectDir);
@@ -14191,9 +14696,12 @@ ${contextResult.mergedContent}` : "";
14191
14696
  role: msg.role,
14192
14697
  content: msg.content
14193
14698
  }));
14699
+ const cliConfig = await state.configStore.get();
14194
14700
  const result = await state.agent.run(messageContent, {
14195
14701
  previousMessages: previousMessages.length > 0 ? previousMessages : void 0,
14196
- signal: abortController.signal
14702
+ signal: abortController.signal,
14703
+ parallelExecution: cliConfig.preferences.enableParallelToolExecution === true,
14704
+ isReadOnlyTool
14197
14705
  });
14198
14706
  const permissionDenied = result.finalAnswer.startsWith("Permission denied for tool");
14199
14707
  if (permissionDenied) {
@@ -14394,9 +14902,12 @@ ${contextResult.mergedContent}` : "";
14394
14902
  role: msg.role,
14395
14903
  content: msg.content
14396
14904
  }));
14905
+ const cliConfig = await state.configStore.get();
14397
14906
  const result = await state.agent.run(messageContent, {
14398
14907
  previousMessages: previousMessages.length > 0 ? previousMessages : void 0,
14399
- signal: abortController.signal
14908
+ signal: abortController.signal,
14909
+ parallelExecution: cliConfig.preferences.enableParallelToolExecution === true,
14910
+ isReadOnlyTool
14400
14911
  });
14401
14912
  const permissionDenied = result.finalAnswer.startsWith("Permission denied for tool");
14402
14913
  if (permissionDenied) {
@@ -14695,13 +15206,17 @@ Custom Commands:
14695
15206
  console.log("No active session to save");
14696
15207
  return;
14697
15208
  }
15209
+ if (state.session.messages.length === 0) {
15210
+ console.log("\u274C Cannot save session with no messages");
15211
+ return;
15212
+ }
14698
15213
  const sessionName = args.join(" ") || state.session.name;
14699
15214
  state.session.name = sessionName;
14700
15215
  await state.sessionStore.save(state.session);
14701
15216
  console.log(`\u2705 Session saved as "${sessionName}"`);
14702
15217
  break;
14703
15218
  case "sessions": {
14704
- const sessions = await state.sessionStore.list();
15219
+ const sessions = await state.sessionStore.list(20);
14705
15220
  if (sessions.length === 0) {
14706
15221
  console.log("\n\u{1F4DA} No saved sessions found.");
14707
15222
  console.log("\u{1F4A1} Use /save <name> to save your current session.\n");