@bike4mind/cli 0.2.10-cli-fix-model-change.17240 → 0.2.10-feat-custom-slash-commands.17240

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1615 -1045
  2. package/package.json +7 -6
package/dist/index.js CHANGED
@@ -210,7 +210,8 @@ function CommandAutocomplete({ commands, selectedIndex }) {
210
210
  return /* @__PURE__ */ React3.createElement(Box2, { flexDirection: "column", marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React3.createElement(Box2, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, commands.length === 1 ? "1 command" : `${commands.length} commands`, " \u2022 Use \u2191\u2193 to navigate, Enter to select")), commands.map((cmd, index) => {
211
211
  const args = cmd.args ? ` ${cmd.args}` : "";
212
212
  const isSelected = index === selectedIndex;
213
- return /* @__PURE__ */ React3.createElement(Box2, { key: cmd.name, marginLeft: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: isSelected ? "cyan" : void 0, bold: isSelected }, isSelected ? "\u25B8 " : " ", "/", cmd.name, args, " - ", cmd.description));
213
+ const sourceIcon = cmd.source === "global" ? "\u{1F3E0} " : cmd.source === "project" ? "\u{1F4C1} " : cmd.source === "built-in" ? "\u{1F527} " : "";
214
+ return /* @__PURE__ */ React3.createElement(Box2, { key: cmd.name, marginLeft: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: isSelected ? "cyan" : void 0, bold: isSelected }, isSelected ? "\u25B8 " : " ", sourceIcon, "/", cmd.name, args, " - ", cmd.description));
214
215
  }));
215
216
  }
216
217
 
@@ -311,7 +312,7 @@ function searchFiles(query) {
311
312
  searchPool = files;
312
313
  }
313
314
  }
314
- const fuse2 = new Fuse(searchPool, {
315
+ const fuse = new Fuse(searchPool, {
315
316
  keys: [{ name: "path", weight: 1 }],
316
317
  threshold: 0.4,
317
318
  // Allow some fuzzy matching
@@ -320,7 +321,7 @@ function searchFiles(query) {
320
321
  // Use extended search for better path matching
321
322
  useExtendedSearch: false
322
323
  });
323
- const results = fuse2.search(query);
324
+ const results = fuse.search(query);
324
325
  return results.slice(0, 20).map((result) => result.item);
325
326
  }
326
327
  function isPathWithinCwd(filePath) {
@@ -497,9 +498,42 @@ var COMMANDS = [
497
498
  aliases: ["undo"]
498
499
  }
499
500
  ];
501
+ function getAllCommandNames() {
502
+ const names = [];
503
+ for (const cmd of COMMANDS) {
504
+ names.push(cmd.name);
505
+ if (cmd.aliases) {
506
+ names.push(...cmd.aliases);
507
+ }
508
+ }
509
+ return names;
510
+ }
511
+ function isBuiltInCommand(name) {
512
+ return getAllCommandNames().includes(name);
513
+ }
514
+ function customCommandToDefinition(customCommand) {
515
+ return {
516
+ name: customCommand.name,
517
+ description: customCommand.description,
518
+ args: customCommand.argumentHint,
519
+ source: customCommand.source
520
+ };
521
+ }
522
+ function mergeCommands(customCommands) {
523
+ const builtInCommands = COMMANDS.map((cmd) => ({ ...cmd, source: "built-in" }));
524
+ const customDefinitions = customCommands.filter((cmd) => !isBuiltInCommand(cmd.name)).map(customCommandToDefinition);
525
+ const conflicts = customCommands.filter((cmd) => isBuiltInCommand(cmd.name));
526
+ if (conflicts.length > 0) {
527
+ console.warn(
528
+ "Warning: The following custom commands have names that conflict with built-in commands and will be ignored:",
529
+ conflicts.map((cmd) => cmd.name).join(", ")
530
+ );
531
+ }
532
+ return [...builtInCommands, ...customDefinitions];
533
+ }
500
534
 
501
535
  // src/utils/fuzzySearch.ts
502
- var fuse = new Fuse2(COMMANDS, {
536
+ var fuseOptions = {
503
537
  keys: [
504
538
  { name: "name", weight: 0.7 },
505
539
  // Prioritize command name
@@ -510,11 +544,12 @@ var fuse = new Fuse2(COMMANDS, {
510
544
  // 0 = perfect match, 1 = match anything
511
545
  includeScore: true,
512
546
  minMatchCharLength: 1
513
- });
514
- function searchCommands(query) {
547
+ };
548
+ function searchCommands(query, commands = COMMANDS) {
515
549
  if (!query || query.trim() === "") {
516
- return COMMANDS;
550
+ return commands;
517
551
  }
552
+ const fuse = new Fuse2(commands, fuseOptions);
518
553
  const results = fuse.search(query);
519
554
  return results.map((result) => result.item);
520
555
  }
@@ -737,6 +772,7 @@ function InputPrompt({
737
772
  onImageDetected,
738
773
  disabled = false,
739
774
  history = [],
775
+ commands = [],
740
776
  prefillInput,
741
777
  onPrefillConsumed,
742
778
  onBashModeChange
@@ -745,7 +781,7 @@ function InputPrompt({
745
781
  const [selectedIndex, setSelectedIndex] = useState2(0);
746
782
  const [historyIndex, setHistoryIndex] = useState2(-1);
747
783
  const [tempInput, setTempInput] = useState2("");
748
- const [inputKey, setInputKey] = useState2(0);
784
+ const [inputKey, _setInputKey] = useState2(0);
749
785
  useEffect(() => {
750
786
  if (prefillInput) {
751
787
  setValue(prefillInput);
@@ -762,8 +798,8 @@ function InputPrompt({
762
798
  const commandQuery = shouldShowCommandAutocomplete ? value.slice(1) : "";
763
799
  const filteredCommands = useMemo(() => {
764
800
  if (!shouldShowCommandAutocomplete) return [];
765
- return searchCommands(commandQuery);
766
- }, [shouldShowCommandAutocomplete, commandQuery]);
801
+ return searchCommands(commandQuery, commands);
802
+ }, [shouldShowCommandAutocomplete, commandQuery, commands]);
767
803
  const filteredFiles = useMemo(() => {
768
804
  if (!fileAutocomplete?.active) return [];
769
805
  return searchFiles(fileAutocomplete.query);
@@ -1371,6 +1407,7 @@ function App({
1371
1407
  onPermissionResponse,
1372
1408
  onImageDetected,
1373
1409
  commandHistory = [],
1410
+ commands = [],
1374
1411
  config,
1375
1412
  availableModels = [],
1376
1413
  onSaveConfig,
@@ -1442,6 +1479,7 @@ ${errorBlock}`;
1442
1479
  onImageDetected,
1443
1480
  disabled: isThinking,
1444
1481
  history: commandHistory,
1482
+ commands,
1445
1483
  prefillInput,
1446
1484
  onPrefillConsumed,
1447
1485
  onBashModeChange: setIsBashMode
@@ -2680,6 +2718,261 @@ var CommandHistoryStore = class {
2680
2718
  }
2681
2719
  };
2682
2720
 
2721
+ // src/storage/CustomCommandStore.ts
2722
+ import fs6 from "fs/promises";
2723
+ import path6 from "path";
2724
+ import os from "os";
2725
+
2726
+ // src/utils/commandParser.ts
2727
+ import matter from "gray-matter";
2728
+ import { z as z2 } from "zod";
2729
+ var FrontmatterSchema = z2.object({
2730
+ description: z2.string().optional(),
2731
+ "argument-hint": z2.string().optional(),
2732
+ model: z2.string().optional(),
2733
+ // Future fields (ignored for now):
2734
+ "allowed-tools": z2.any().optional(),
2735
+ context: z2.any().optional(),
2736
+ agent: z2.any().optional(),
2737
+ "disable-model-invocation": z2.any().optional(),
2738
+ hooks: z2.any().optional()
2739
+ });
2740
+ function extractDescriptionFromBody(body) {
2741
+ const lines = body.trim().split("\n");
2742
+ for (const line of lines) {
2743
+ const trimmed = line.trim();
2744
+ if (trimmed && !trimmed.startsWith("#")) {
2745
+ return trimmed.length > 100 ? trimmed.substring(0, 97) + "..." : trimmed;
2746
+ }
2747
+ }
2748
+ return "Custom command";
2749
+ }
2750
+ function parseCommandFile(fileContent, filePath, commandName, source) {
2751
+ try {
2752
+ const { data: frontmatter, content: body } = matter(fileContent);
2753
+ const validationResult = FrontmatterSchema.safeParse(frontmatter);
2754
+ if (!validationResult.success) {
2755
+ console.warn(
2756
+ `Warning: Invalid frontmatter in ${filePath}:`,
2757
+ validationResult.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join(", ")
2758
+ );
2759
+ }
2760
+ const validFrontmatter = validationResult.success ? validationResult.data : {};
2761
+ const description = validFrontmatter.description || extractDescriptionFromBody(body) || "Custom command";
2762
+ return {
2763
+ name: commandName,
2764
+ description,
2765
+ argumentHint: validFrontmatter["argument-hint"],
2766
+ model: validFrontmatter.model,
2767
+ body: body.trim(),
2768
+ source,
2769
+ filePath
2770
+ };
2771
+ } catch (error) {
2772
+ throw new Error(
2773
+ `Failed to parse command file ${filePath}: ${error instanceof Error ? error.message : String(error)}`
2774
+ );
2775
+ }
2776
+ }
2777
+ function isValidCommandName(name) {
2778
+ if (!name || name.trim().length === 0) {
2779
+ return false;
2780
+ }
2781
+ const validPattern = /^[a-z0-9-_:]+$/i;
2782
+ return validPattern.test(name);
2783
+ }
2784
+ function extractCommandName(filename) {
2785
+ if (!filename.endsWith(".md")) {
2786
+ return null;
2787
+ }
2788
+ const name = filename.slice(0, -3);
2789
+ if (!isValidCommandName(name)) {
2790
+ return null;
2791
+ }
2792
+ return name;
2793
+ }
2794
+
2795
+ // src/storage/CustomCommandStore.ts
2796
+ var CustomCommandStore = class {
2797
+ constructor(projectRoot) {
2798
+ this.commands = /* @__PURE__ */ new Map();
2799
+ this.globalCommandsDir = path6.join(os.homedir(), ".bike4mind", "commands");
2800
+ this.projectCommandsDir = path6.join(projectRoot || process.cwd(), ".bike4mind", "commands");
2801
+ }
2802
+ /**
2803
+ * Loads all custom commands from both global and project directories
2804
+ * Project commands override global commands with the same name
2805
+ */
2806
+ async loadCommands() {
2807
+ this.commands.clear();
2808
+ await this.loadCommandsFromDirectory(this.globalCommandsDir, "global");
2809
+ await this.loadCommandsFromDirectory(this.projectCommandsDir, "project");
2810
+ }
2811
+ /**
2812
+ * Recursively scans a directory for .md files and loads them as commands
2813
+ *
2814
+ * @param directory - Directory to scan
2815
+ * @param source - Source identifier ('global' or 'project')
2816
+ */
2817
+ async loadCommandsFromDirectory(directory, source) {
2818
+ try {
2819
+ const stats = await fs6.stat(directory);
2820
+ if (!stats.isDirectory()) {
2821
+ return;
2822
+ }
2823
+ const commandFiles = await this.findCommandFiles(directory);
2824
+ for (const filePath of commandFiles) {
2825
+ try {
2826
+ await this.loadCommandFile(filePath, source);
2827
+ } catch (error) {
2828
+ console.warn(
2829
+ `Failed to load command from ${filePath}:`,
2830
+ error instanceof Error ? error.message : String(error)
2831
+ );
2832
+ }
2833
+ }
2834
+ } catch (error) {
2835
+ if (error.code !== "ENOENT") {
2836
+ console.warn(
2837
+ `Error accessing ${source} commands directory ${directory}:`,
2838
+ error instanceof Error ? error.message : String(error)
2839
+ );
2840
+ }
2841
+ }
2842
+ }
2843
+ /**
2844
+ * Recursively finds all .md files in a directory
2845
+ *
2846
+ * @param directory - Directory to search
2847
+ * @returns Array of full file paths to .md files
2848
+ */
2849
+ async findCommandFiles(directory) {
2850
+ const files = [];
2851
+ try {
2852
+ const entries = await fs6.readdir(directory, { withFileTypes: true });
2853
+ for (const entry of entries) {
2854
+ const fullPath = path6.join(directory, entry.name);
2855
+ if (entry.isDirectory()) {
2856
+ const subFiles = await this.findCommandFiles(fullPath);
2857
+ files.push(...subFiles);
2858
+ } else if (entry.isFile() && entry.name.endsWith(".md")) {
2859
+ files.push(fullPath);
2860
+ }
2861
+ }
2862
+ } catch (error) {
2863
+ console.warn(`Error reading directory ${directory}:`, error instanceof Error ? error.message : String(error));
2864
+ }
2865
+ return files;
2866
+ }
2867
+ /**
2868
+ * Loads a single command file
2869
+ *
2870
+ * @param filePath - Full path to the command file
2871
+ * @param source - Source identifier ('global' or 'project')
2872
+ */
2873
+ async loadCommandFile(filePath, source) {
2874
+ const filename = path6.basename(filePath);
2875
+ const commandName = extractCommandName(filename);
2876
+ if (!commandName) {
2877
+ console.warn(`Invalid command filename: ${filename} (must end with .md and have valid name)`);
2878
+ return;
2879
+ }
2880
+ const fileContent = await fs6.readFile(filePath, "utf-8");
2881
+ const command = parseCommandFile(fileContent, filePath, commandName, source);
2882
+ const existing = this.commands.get(commandName);
2883
+ if (existing && existing.source === "project" && source === "global") {
2884
+ return;
2885
+ }
2886
+ this.commands.set(commandName, command);
2887
+ }
2888
+ /**
2889
+ * Gets a command by name
2890
+ *
2891
+ * @param name - Command name
2892
+ * @returns CustomCommand if found, undefined otherwise
2893
+ */
2894
+ getCommand(name) {
2895
+ return this.commands.get(name);
2896
+ }
2897
+ /**
2898
+ * Gets all loaded commands
2899
+ *
2900
+ * @returns Array of all custom commands
2901
+ */
2902
+ getAllCommands() {
2903
+ return Array.from(this.commands.values());
2904
+ }
2905
+ /**
2906
+ * Gets commands filtered by source
2907
+ *
2908
+ * @param source - Filter by 'global' or 'project'
2909
+ * @returns Array of commands from the specified source
2910
+ */
2911
+ getCommandsBySource(source) {
2912
+ return this.getAllCommands().filter((cmd) => cmd.source === source);
2913
+ }
2914
+ /**
2915
+ * Checks if a command name exists
2916
+ *
2917
+ * @param name - Command name to check
2918
+ * @returns true if command exists
2919
+ */
2920
+ hasCommand(name) {
2921
+ return this.commands.has(name);
2922
+ }
2923
+ /**
2924
+ * Gets the number of loaded commands
2925
+ *
2926
+ * @returns Number of custom commands
2927
+ */
2928
+ getCommandCount() {
2929
+ return this.commands.size;
2930
+ }
2931
+ /**
2932
+ * Reloads all commands from directories
2933
+ * Useful for the /commands:reload command
2934
+ */
2935
+ async reloadCommands() {
2936
+ await this.loadCommands();
2937
+ }
2938
+ /**
2939
+ * Creates a new command file from a template
2940
+ *
2941
+ * @param name - Command name
2942
+ * @param isGlobal - If true, creates in global directory, otherwise project directory
2943
+ * @returns Path to the created file
2944
+ */
2945
+ async createCommandFile(name, isGlobal = false) {
2946
+ const targetDir = isGlobal ? this.globalCommandsDir : this.projectCommandsDir;
2947
+ const filePath = path6.join(targetDir, `${name}.md`);
2948
+ try {
2949
+ await fs6.access(filePath);
2950
+ throw new Error(`Command file already exists: ${filePath}`);
2951
+ } catch (error) {
2952
+ if (error.code !== "ENOENT") {
2953
+ throw error;
2954
+ }
2955
+ }
2956
+ await fs6.mkdir(targetDir, { recursive: true });
2957
+ const template = `---
2958
+ description: ${name} command
2959
+ argument-hint: [args]
2960
+ ---
2961
+
2962
+ # ${name}
2963
+
2964
+ Replace this with your command template.
2965
+
2966
+ You can use:
2967
+ - $ARGUMENTS for all arguments
2968
+ - $1, $2, etc. for positional arguments
2969
+ - @filename for file references
2970
+ `;
2971
+ await fs6.writeFile(filePath, template, "utf-8");
2972
+ return filePath;
2973
+ }
2974
+ };
2975
+
2683
2976
  // ../../b4m-core/packages/agents/src/ReActAgent.ts
2684
2977
  import { EventEmitter } from "events";
2685
2978
  var ReActAgent = class extends EventEmitter {
@@ -2993,38 +3286,38 @@ Remember: You are an autonomous AGENT. Act independently and solve problems proa
2993
3286
  // ../../b4m-core/packages/services/dist/src/referService/generateCodes.js
2994
3287
  import { randomBytes } from "crypto";
2995
3288
  import range from "lodash/range.js";
2996
- import { z as z2 } from "zod";
2997
- var generateReferralCodesSchema = z2.object({
2998
- count: z2.number().optional(),
2999
- unlimitedUse: z2.boolean().optional(),
3000
- expiresAt: z2.date().optional()
3289
+ import { z as z3 } from "zod";
3290
+ var generateReferralCodesSchema = z3.object({
3291
+ count: z3.number().optional(),
3292
+ unlimitedUse: z3.boolean().optional(),
3293
+ expiresAt: z3.date().optional()
3001
3294
  });
3002
3295
 
3003
3296
  // ../../b4m-core/packages/services/dist/src/referService/delete.js
3004
- import { z as z3 } from "zod";
3005
- var deleteInviteCodesSchema = z3.object({
3006
- ids: z3.array(z3.string())
3297
+ import { z as z4 } from "zod";
3298
+ var deleteInviteCodesSchema = z4.object({
3299
+ ids: z4.array(z4.string())
3007
3300
  });
3008
3301
 
3009
3302
  // ../../b4m-core/packages/services/dist/src/userService/login.js
3010
- import { z as z4 } from "zod";
3303
+ import { z as z5 } from "zod";
3011
3304
  import bcrypt from "bcryptjs";
3012
- var loginUserSchema = z4.object({
3013
- usernameOrEmail: z4.string(),
3014
- password: z4.string(),
3015
- metadata: z4.object({
3016
- loginTime: z4.date(),
3017
- userAgent: z4.string(),
3018
- browser: z4.string(),
3019
- operatingSystem: z4.string(),
3020
- deviceType: z4.string(),
3021
- screenResolution: z4.string(),
3022
- viewportSize: z4.string(),
3023
- colorDepth: z4.number(),
3024
- pixelDepth: z4.number(),
3025
- devicePixelRatio: z4.number(),
3026
- ip: z4.string().optional().default(""),
3027
- location: z4.string().optional()
3305
+ var loginUserSchema = z5.object({
3306
+ usernameOrEmail: z5.string(),
3307
+ password: z5.string(),
3308
+ metadata: z5.object({
3309
+ loginTime: z5.date(),
3310
+ userAgent: z5.string(),
3311
+ browser: z5.string(),
3312
+ operatingSystem: z5.string(),
3313
+ deviceType: z5.string(),
3314
+ screenResolution: z5.string(),
3315
+ viewportSize: z5.string(),
3316
+ colorDepth: z5.number(),
3317
+ pixelDepth: z5.number(),
3318
+ devicePixelRatio: z5.number(),
3319
+ ip: z5.string().optional().default(""),
3320
+ location: z5.string().optional()
3028
3321
  }).optional()
3029
3322
  });
3030
3323
 
@@ -3034,78 +3327,78 @@ import escapeRegExp from "lodash/escapeRegExp.js";
3034
3327
 
3035
3328
  // ../../b4m-core/packages/services/dist/src/userService/forgotPassword.js
3036
3329
  import { randomUUID } from "crypto";
3037
- import { z as z5 } from "zod";
3038
- var forgotPasswordUserSchema = z5.object({
3039
- email: z5.string().email()
3330
+ import { z as z6 } from "zod";
3331
+ var forgotPasswordUserSchema = z6.object({
3332
+ email: z6.string().email()
3040
3333
  });
3041
3334
 
3042
3335
  // ../../b4m-core/packages/services/dist/src/userService/update.js
3043
3336
  import bcrypt3 from "bcryptjs";
3044
- import { z as z6 } from "zod";
3045
- var updateUserSchema = z6.object({
3046
- name: z6.string().optional(),
3047
- username: z6.string().optional(),
3337
+ import { z as z7 } from "zod";
3338
+ var updateUserSchema = z7.object({
3339
+ name: z7.string().optional(),
3340
+ username: z7.string().optional(),
3048
3341
  // email field removed - users must use the secure email change verification flow
3049
3342
  // See requestEmailChange and verifyEmailChange in userService
3050
- password: z6.string().nullable().optional(),
3051
- team: z6.string().nullable().optional(),
3052
- role: z6.string().nullable().optional(),
3053
- phone: z6.string().nullable().optional(),
3054
- preferredLanguage: z6.string().nullable().optional(),
3055
- preferredContact: z6.string().nullable().optional(),
3056
- preferredVoice: z6.string().nullable().optional(),
3057
- tshirtSize: z6.string().nullable().optional(),
3058
- geoLocation: z6.string().nullable().optional(),
3059
- lastNotebookId: z6.string().nullable().optional(),
3060
- tags: z6.array(z6.string()).nullable().optional(),
3061
- lastCreditsPurchasedAt: z6.date().nullable().optional(),
3062
- systemFiles: z6.array(z6.object({
3063
- fileId: z6.string(),
3064
- enabled: z6.boolean()
3343
+ password: z7.string().nullable().optional(),
3344
+ team: z7.string().nullable().optional(),
3345
+ role: z7.string().nullable().optional(),
3346
+ phone: z7.string().nullable().optional(),
3347
+ preferredLanguage: z7.string().nullable().optional(),
3348
+ preferredContact: z7.string().nullable().optional(),
3349
+ preferredVoice: z7.string().nullable().optional(),
3350
+ tshirtSize: z7.string().nullable().optional(),
3351
+ geoLocation: z7.string().nullable().optional(),
3352
+ lastNotebookId: z7.string().nullable().optional(),
3353
+ tags: z7.array(z7.string()).nullable().optional(),
3354
+ lastCreditsPurchasedAt: z7.date().nullable().optional(),
3355
+ systemFiles: z7.array(z7.object({
3356
+ fileId: z7.string(),
3357
+ enabled: z7.boolean()
3065
3358
  })).nullable().optional(),
3066
- securityQuestions: z6.array(z6.object({ question: z6.string(), answer: z6.string() })).nullable().optional(),
3067
- photoUrl: z6.string().nullable().optional(),
3068
- showCreditsUsed: z6.boolean().optional()
3359
+ securityQuestions: z7.array(z7.object({ question: z7.string(), answer: z7.string() })).nullable().optional(),
3360
+ photoUrl: z7.string().nullable().optional(),
3361
+ showCreditsUsed: z7.boolean().optional()
3069
3362
  });
3070
3363
 
3071
3364
  // ../../b4m-core/packages/services/dist/src/userService/adminUpdate.js
3072
- import { z as z8 } from "zod";
3365
+ import { z as z9 } from "zod";
3073
3366
 
3074
3367
  // ../../b4m-core/packages/services/dist/src/friendshipService/sendFriendRequest.js
3075
- import { z as z7 } from "zod";
3076
- var sendFriendRequestSchema = z7.object({
3077
- requesterId: z7.string(),
3078
- recipientId: z7.string(),
3079
- message: z7.string().optional()
3368
+ import { z as z8 } from "zod";
3369
+ var sendFriendRequestSchema = z8.object({
3370
+ requesterId: z8.string(),
3371
+ recipientId: z8.string(),
3372
+ message: z8.string().optional()
3080
3373
  });
3081
3374
 
3082
3375
  // ../../b4m-core/packages/services/dist/src/userService/adminUpdate.js
3083
3376
  var adminUpdateUserSchema = updateUserSchema.extend({
3084
- id: z8.string(),
3377
+ id: z9.string(),
3085
3378
  // Admins can directly update email addresses without verification
3086
- email: z8.string().email().optional(),
3087
- role: z8.string().optional().nullable(),
3088
- isAdmin: z8.boolean().optional(),
3089
- organizationId: z8.string().optional().nullable(),
3090
- storageLimit: z8.number().optional(),
3091
- currentCredits: z8.number().optional(),
3092
- isBanned: z8.boolean().optional(),
3093
- isModerated: z8.boolean().optional(),
3094
- subscribedUntil: z8.string().optional().nullable(),
3095
- systemFiles: z8.array(z8.object({ fileId: z8.string(), enabled: z8.boolean() })).optional(),
3096
- level: z8.enum(["DemoUser", "PaidUser", "VIPUser", "ManagerUser", "AdminUser"]).optional(),
3097
- lastNotebookId: z8.string().optional().nullable(),
3098
- userNotes: z8.array(z8.object({ timestamp: z8.string(), note: z8.string(), userName: z8.string() })).optional(),
3099
- numReferralsAvailable: z8.number().optional()
3379
+ email: z9.string().email().optional(),
3380
+ role: z9.string().optional().nullable(),
3381
+ isAdmin: z9.boolean().optional(),
3382
+ organizationId: z9.string().optional().nullable(),
3383
+ storageLimit: z9.number().optional(),
3384
+ currentCredits: z9.number().optional(),
3385
+ isBanned: z9.boolean().optional(),
3386
+ isModerated: z9.boolean().optional(),
3387
+ subscribedUntil: z9.string().optional().nullable(),
3388
+ systemFiles: z9.array(z9.object({ fileId: z9.string(), enabled: z9.boolean() })).optional(),
3389
+ level: z9.enum(["DemoUser", "PaidUser", "VIPUser", "ManagerUser", "AdminUser"]).optional(),
3390
+ lastNotebookId: z9.string().optional().nullable(),
3391
+ userNotes: z9.array(z9.object({ timestamp: z9.string(), note: z9.string(), userName: z9.string() })).optional(),
3392
+ numReferralsAvailable: z9.number().optional()
3100
3393
  });
3101
3394
 
3102
3395
  // ../../b4m-core/packages/services/dist/src/userService/register.js
3103
- import { z as z10 } from "zod";
3396
+ import { z as z11 } from "zod";
3104
3397
  import bcrypt4 from "bcryptjs";
3105
3398
 
3106
3399
  // ../../b4m-core/packages/services/dist/src/creditService/addCredits.js
3107
- import { z as z9 } from "zod";
3108
- var AddCreditsSchema = z9.discriminatedUnion("type", [
3400
+ import { z as z10 } from "zod";
3401
+ var AddCreditsSchema = z10.discriminatedUnion("type", [
3109
3402
  PurchaseTransaction.omit({ createdAt: true, updatedAt: true }),
3110
3403
  SubscriptionCreditTransaction.omit({ createdAt: true, updatedAt: true }),
3111
3404
  GenericCreditAddTransaction.omit({ createdAt: true, updatedAt: true }),
@@ -3113,57 +3406,57 @@ var AddCreditsSchema = z9.discriminatedUnion("type", [
3113
3406
  ]);
3114
3407
 
3115
3408
  // ../../b4m-core/packages/services/dist/src/userService/register.js
3116
- var registerUserSchema = z10.object({
3117
- username: z10.string(),
3118
- email: z10.string(),
3119
- name: z10.string(),
3120
- inviteCode: z10.string(),
3121
- password: z10.string(),
3122
- metadata: z10.object({
3123
- loginTime: z10.date(),
3124
- userAgent: z10.string(),
3125
- browser: z10.string(),
3126
- operatingSystem: z10.string(),
3127
- deviceType: z10.string(),
3128
- screenResolution: z10.string(),
3129
- viewportSize: z10.string(),
3130
- colorDepth: z10.number(),
3131
- pixelDepth: z10.number(),
3132
- devicePixelRatio: z10.number(),
3133
- ip: z10.string().optional().default(""),
3134
- location: z10.string().optional()
3409
+ var registerUserSchema = z11.object({
3410
+ username: z11.string(),
3411
+ email: z11.string(),
3412
+ name: z11.string(),
3413
+ inviteCode: z11.string(),
3414
+ password: z11.string(),
3415
+ metadata: z11.object({
3416
+ loginTime: z11.date(),
3417
+ userAgent: z11.string(),
3418
+ browser: z11.string(),
3419
+ operatingSystem: z11.string(),
3420
+ deviceType: z11.string(),
3421
+ screenResolution: z11.string(),
3422
+ viewportSize: z11.string(),
3423
+ colorDepth: z11.number(),
3424
+ pixelDepth: z11.number(),
3425
+ devicePixelRatio: z11.number(),
3426
+ ip: z11.string().optional().default(""),
3427
+ location: z11.string().optional()
3135
3428
  }).optional()
3136
3429
  });
3137
3430
 
3138
3431
  // ../../b4m-core/packages/services/dist/src/userService/adminDelete.js
3139
- import { z as z11 } from "zod";
3140
- var adminDeleteUserSchema = z11.object({
3141
- id: z11.string()
3432
+ import { z as z12 } from "zod";
3433
+ var adminDeleteUserSchema = z12.object({
3434
+ id: z12.string()
3142
3435
  });
3143
3436
 
3144
3437
  // ../../b4m-core/packages/services/dist/src/userService/searchUserCollection.js
3145
- import { z as z12 } from "zod";
3146
- var searchUserCollectionSchema = z12.object({
3147
- userId: z12.string(),
3148
- page: z12.coerce.number().optional().default(1),
3149
- limit: z12.coerce.number().optional().default(10),
3150
- search: z12.string().optional().default(""),
3151
- type: z12.nativeEnum(CollectionType).optional()
3438
+ import { z as z13 } from "zod";
3439
+ var searchUserCollectionSchema = z13.object({
3440
+ userId: z13.string(),
3441
+ page: z13.coerce.number().optional().default(1),
3442
+ limit: z13.coerce.number().optional().default(10),
3443
+ search: z13.string().optional().default(""),
3444
+ type: z13.nativeEnum(CollectionType).optional()
3152
3445
  });
3153
3446
 
3154
3447
  // ../../b4m-core/packages/services/dist/src/userService/recalculateUserStorage.js
3155
- import { z as z13 } from "zod";
3156
- var recalculateUserStorageSchema = z13.object({
3448
+ import { z as z14 } from "zod";
3449
+ var recalculateUserStorageSchema = z14.object({
3157
3450
  /**
3158
3451
  * The user to recalculate the storage for
3159
3452
  */
3160
- userId: z13.string()
3453
+ userId: z14.string()
3161
3454
  });
3162
3455
 
3163
3456
  // ../../b4m-core/packages/services/dist/src/userService/listRecentActivities.js
3164
- import { z as z14 } from "zod";
3165
- var listRecentActivitiesSchema = z14.object({
3166
- coverage: z14.enum(["all", "important"]).default("important")
3457
+ import { z as z15 } from "zod";
3458
+ var listRecentActivitiesSchema = z15.object({
3459
+ coverage: z15.enum(["all", "important"]).default("important")
3167
3460
  });
3168
3461
  var IMPORTANT_COUNTER_NAMES = [
3169
3462
  SessionEvents.CREATE_SESSION,
@@ -3177,82 +3470,82 @@ var IMPORTANT_COUNTER_NAMES = [
3177
3470
 
3178
3471
  // ../../b4m-core/packages/services/dist/src/userService/sendEmailVerification.js
3179
3472
  import { randomUUID as randomUUID2 } from "crypto";
3180
- import { z as z15 } from "zod";
3181
- var sendEmailVerificationSchema = z15.object({
3182
- userId: z15.string()
3473
+ import { z as z16 } from "zod";
3474
+ var sendEmailVerificationSchema = z16.object({
3475
+ userId: z16.string()
3183
3476
  });
3184
3477
 
3185
3478
  // ../../b4m-core/packages/services/dist/src/userService/verifyEmailToken.js
3186
- import { z as z16 } from "zod";
3479
+ import { z as z17 } from "zod";
3187
3480
 
3188
3481
  // ../../b4m-core/packages/services/dist/src/utils/crypto.js
3189
3482
  import crypto from "crypto";
3190
3483
 
3191
3484
  // ../../b4m-core/packages/services/dist/src/userService/verifyEmailToken.js
3192
- var verifyEmailTokenSchema = z16.object({
3193
- token: z16.string()
3485
+ var verifyEmailTokenSchema = z17.object({
3486
+ token: z17.string()
3194
3487
  });
3195
3488
 
3196
3489
  // ../../b4m-core/packages/services/dist/src/userService/resendEmailVerification.js
3197
3490
  import { randomUUID as randomUUID3 } from "crypto";
3198
- import { z as z17 } from "zod";
3199
- var resendEmailVerificationSchema = z17.object({
3200
- userId: z17.string()
3491
+ import { z as z18 } from "zod";
3492
+ var resendEmailVerificationSchema = z18.object({
3493
+ userId: z18.string()
3201
3494
  });
3202
3495
 
3203
3496
  // ../../b4m-core/packages/services/dist/src/userService/requestEmailChange.js
3204
3497
  import { randomUUID as randomUUID4 } from "crypto";
3205
- import { z as z18 } from "zod";
3206
- var requestEmailChangeSchema = z18.object({
3207
- userId: z18.string(),
3208
- newEmail: z18.string().email(),
3209
- password: z18.string()
3498
+ import { z as z19 } from "zod";
3499
+ var requestEmailChangeSchema = z19.object({
3500
+ userId: z19.string(),
3501
+ newEmail: z19.string().email(),
3502
+ password: z19.string()
3210
3503
  });
3211
3504
 
3212
3505
  // ../../b4m-core/packages/services/dist/src/userService/verifyEmailChange.js
3213
- import { z as z19 } from "zod";
3214
- var verifyEmailChangeSchema = z19.object({
3215
- token: z19.string()
3506
+ import { z as z20 } from "zod";
3507
+ var verifyEmailChangeSchema = z20.object({
3508
+ token: z20.string()
3216
3509
  });
3217
3510
 
3218
3511
  // ../../b4m-core/packages/services/dist/src/userService/cancelEmailChange.js
3219
- import { z as z20 } from "zod";
3220
- var cancelEmailChangeSchema = z20.object({
3221
- userId: z20.string()
3512
+ import { z as z21 } from "zod";
3513
+ var cancelEmailChangeSchema = z21.object({
3514
+ userId: z21.string()
3222
3515
  });
3223
3516
 
3224
3517
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/create.js
3225
3518
  import { randomBytes as randomBytes2 } from "crypto";
3226
3519
  import bcrypt5 from "bcryptjs";
3227
- import { z as z21 } from "zod";
3228
- var createUserApiKeySchema = z21.object({
3229
- name: z21.string().min(1).max(100),
3230
- scopes: z21.array(z21.nativeEnum(ApiKeyScope)).min(1),
3231
- expiresAt: z21.date().optional(),
3232
- rateLimit: z21.object({
3233
- requestsPerMinute: z21.number().min(1).max(1e3).default(60),
3234
- requestsPerDay: z21.number().min(1).max(1e4).default(1e3)
3520
+ import { z as z22 } from "zod";
3521
+ var createUserApiKeySchema = z22.object({
3522
+ name: z22.string().min(1).max(100),
3523
+ scopes: z22.array(z22.nativeEnum(ApiKeyScope)).min(1),
3524
+ expiresAt: z22.date().optional(),
3525
+ rateLimit: z22.object({
3526
+ requestsPerMinute: z22.number().min(1).max(1e3).default(60),
3527
+ requestsPerDay: z22.number().min(1).max(1e4).default(1e3)
3235
3528
  }).optional(),
3236
- metadata: z21.object({
3237
- clientIP: z21.string().optional(),
3238
- userAgent: z21.string().optional(),
3239
- createdFrom: z21.enum(["dashboard", "cli", "api"])
3529
+ metadata: z22.object({
3530
+ clientIP: z22.string().optional(),
3531
+ userAgent: z22.string().optional(),
3532
+ createdFrom: z22.enum(["dashboard", "cli", "api"])
3240
3533
  })
3241
3534
  });
3242
3535
 
3243
3536
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/revoke.js
3244
- import { z as z22 } from "zod";
3245
- var revokeUserApiKeySchema = z22.object({
3246
- keyId: z22.string(),
3247
- reason: z22.string().optional()
3537
+ import { z as z23 } from "zod";
3538
+ var revokeUserApiKeySchema = z23.object({
3539
+ keyId: z23.string(),
3540
+ reason: z23.string().optional()
3248
3541
  });
3249
3542
 
3250
3543
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/rotate.js
3251
3544
  import { randomBytes as randomBytes3 } from "crypto";
3252
3545
  import bcrypt6 from "bcryptjs";
3253
- import { z as z23 } from "zod";
3254
- var rotateUserApiKeySchema = z23.object({
3255
- keyId: z23.string()
3546
+ import { z as z24 } from "zod";
3547
+ var rotateUserApiKeySchema = z24.object({
3548
+ keyId: z24.string()
3256
3549
  });
3257
3550
 
3258
3551
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/validate.js
@@ -3399,29 +3692,29 @@ var EVENT_GROUPS = [
3399
3692
  ];
3400
3693
 
3401
3694
  // ../../b4m-core/packages/services/dist/src/countersService/generateReport.js
3402
- import { z as z25 } from "zod";
3695
+ import { z as z26 } from "zod";
3403
3696
 
3404
3697
  // ../../b4m-core/packages/services/dist/src/countersService/getAllCounterFrom24Hours.js
3405
- import { z as z24 } from "zod";
3698
+ import { z as z25 } from "zod";
3406
3699
  import dayjs2 from "dayjs";
3407
- var getCounterTotalsForLast24HoursSchema = z24.object({
3408
- date: z24.string(),
3409
- endDate: z24.string().optional()
3700
+ var getCounterTotalsForLast24HoursSchema = z25.object({
3701
+ date: z25.string(),
3702
+ endDate: z25.string().optional()
3410
3703
  });
3411
3704
 
3412
3705
  // ../../b4m-core/packages/services/dist/src/countersService/generateReport.js
3413
- var generateDailyReportSchema = z25.object({
3414
- date: z25.string(),
3415
- startDate: z25.string().optional(),
3416
- endDate: z25.string().optional()
3706
+ var generateDailyReportSchema = z26.object({
3707
+ date: z26.string(),
3708
+ startDate: z26.string().optional(),
3709
+ endDate: z26.string().optional()
3417
3710
  });
3418
3711
 
3419
3712
  // ../../b4m-core/packages/services/dist/src/countersService/incrementUserCounter.js
3420
- import { z as z26 } from "zod";
3421
- var incrementUserCounterSchema = z26.object({
3422
- action: z26.string(),
3423
- increment: z26.coerce.number().default(1).optional(),
3424
- metadata: z26.record(z26.unknown()).optional()
3713
+ import { z as z27 } from "zod";
3714
+ var incrementUserCounterSchema = z27.object({
3715
+ action: z27.string(),
3716
+ increment: z27.coerce.number().default(1).optional(),
3717
+ metadata: z27.record(z27.unknown()).optional()
3425
3718
  });
3426
3719
 
3427
3720
  // ../../b4m-core/packages/services/dist/src/countersService/sendSlackReport.js
@@ -3437,47 +3730,47 @@ import { GoogleGenerativeAI } from "@google/generative-ai";
3437
3730
  import OpenAI2 from "openai";
3438
3731
 
3439
3732
  // ../../b4m-core/packages/services/dist/src/importHistoryService/index.js
3440
- import fs6, { unlinkSync } from "fs";
3733
+ import fs7, { unlinkSync } from "fs";
3441
3734
  import yauzl from "yauzl";
3442
3735
  import axios3 from "axios";
3443
3736
 
3444
3737
  // ../../b4m-core/packages/services/dist/src/importHistoryService/importOpenaiHistory.js
3445
- import { z as z27 } from "zod";
3738
+ import { z as z28 } from "zod";
3446
3739
  import last from "lodash/last.js";
3447
- var epochDate = () => z27.preprocess((val) => new Date(Number(val) * 1e3), z27.date());
3448
- var openaiConversationSchema = z27.object({
3449
- id: z27.string(),
3450
- title: z27.string(),
3740
+ var epochDate = () => z28.preprocess((val) => new Date(Number(val) * 1e3), z28.date());
3741
+ var openaiConversationSchema = z28.object({
3742
+ id: z28.string(),
3743
+ title: z28.string(),
3451
3744
  create_time: epochDate(),
3452
3745
  update_time: epochDate().nullable(),
3453
- mapping: z27.record(
3454
- z27.string(),
3455
- z27.object({
3456
- id: z27.string(),
3457
- parent: z27.string().nullable(),
3458
- children: z27.array(z27.string()),
3459
- message: z27.object({
3460
- id: z27.string(),
3746
+ mapping: z28.record(
3747
+ z28.string(),
3748
+ z28.object({
3749
+ id: z28.string(),
3750
+ parent: z28.string().nullable(),
3751
+ children: z28.array(z28.string()),
3752
+ message: z28.object({
3753
+ id: z28.string(),
3461
3754
  create_time: epochDate(),
3462
3755
  update_time: epochDate().nullable(),
3463
- author: z27.object({
3464
- role: z27.string(),
3465
- name: z27.string().nullable(),
3466
- metadata: z27.any()
3756
+ author: z28.object({
3757
+ role: z28.string(),
3758
+ name: z28.string().nullable(),
3759
+ metadata: z28.any()
3467
3760
  // Accept any metadata structure
3468
3761
  }).passthrough(),
3469
3762
  // Allow extra fields in author
3470
- content: z27.object({
3471
- content_type: z27.string(),
3472
- parts: z27.array(z27.any()).optional()
3763
+ content: z28.object({
3764
+ content_type: z28.string(),
3765
+ parts: z28.array(z28.any()).optional()
3473
3766
  // Accept any type in parts array (strings, objects, etc.)
3474
3767
  }).passthrough(),
3475
3768
  // Allow extra fields in content
3476
- status: z27.string(),
3477
- end_turn: z27.boolean().nullable(),
3478
- metadata: z27.any(),
3769
+ status: z28.string(),
3770
+ end_turn: z28.boolean().nullable(),
3771
+ metadata: z28.any(),
3479
3772
  // Accept any metadata structure since it varies widely
3480
- recipient: z27.string()
3773
+ recipient: z28.string()
3481
3774
  }).passthrough().nullable()
3482
3775
  }).passthrough()
3483
3776
  // Allow extra fields in mapping node
@@ -3485,38 +3778,38 @@ var openaiConversationSchema = z27.object({
3485
3778
  }).passthrough();
3486
3779
 
3487
3780
  // ../../b4m-core/packages/services/dist/src/importHistoryService/importClaudeHistory.js
3488
- import { z as z28 } from "zod";
3489
- var claudeChatMessageSchema = z28.object({
3490
- uuid: z28.string().uuid(),
3491
- text: z28.string(),
3492
- content: z28.array(
3493
- z28.object({
3494
- type: z28.string(),
3781
+ import { z as z29 } from "zod";
3782
+ var claudeChatMessageSchema = z29.object({
3783
+ uuid: z29.string().uuid(),
3784
+ text: z29.string(),
3785
+ content: z29.array(
3786
+ z29.object({
3787
+ type: z29.string(),
3495
3788
  // Accept any type: "text", "image", "tool_result", etc.
3496
- text: z28.string().optional()
3789
+ text: z29.string().optional()
3497
3790
  // Make text optional since tool_result may not have it
3498
3791
  }).passthrough()
3499
3792
  // Allow all other fields
3500
3793
  ),
3501
- sender: z28.enum(["human", "assistant"]),
3502
- created_at: z28.coerce.date(),
3503
- updated_at: z28.coerce.date(),
3504
- attachments: z28.array(z28.any()),
3794
+ sender: z29.enum(["human", "assistant"]),
3795
+ created_at: z29.coerce.date(),
3796
+ updated_at: z29.coerce.date(),
3797
+ attachments: z29.array(z29.any()),
3505
3798
  // Accept any attachment structure
3506
- files: z28.array(z28.any())
3799
+ files: z29.array(z29.any())
3507
3800
  // Accept any file structure
3508
3801
  }).passthrough();
3509
- var claudeConversationSchema = z28.object({
3510
- uuid: z28.string().uuid(),
3511
- name: z28.string(),
3512
- summary: z28.string().optional(),
3802
+ var claudeConversationSchema = z29.object({
3803
+ uuid: z29.string().uuid(),
3804
+ name: z29.string(),
3805
+ summary: z29.string().optional(),
3513
3806
  // Summary field is optional
3514
- created_at: z28.coerce.date(),
3515
- updated_at: z28.coerce.date(),
3516
- account: z28.object({
3517
- uuid: z28.string().uuid()
3807
+ created_at: z29.coerce.date(),
3808
+ updated_at: z29.coerce.date(),
3809
+ account: z29.object({
3810
+ uuid: z29.string().uuid()
3518
3811
  }),
3519
- chat_messages: z28.array(claudeChatMessageSchema)
3812
+ chat_messages: z29.array(claudeChatMessageSchema)
3520
3813
  }).passthrough();
3521
3814
 
3522
3815
  // ../../b4m-core/packages/services/dist/src/importHistoryService/index.js
@@ -3527,357 +3820,357 @@ var ImportSource;
3527
3820
  })(ImportSource || (ImportSource = {}));
3528
3821
 
3529
3822
  // ../../b4m-core/packages/services/dist/src/sessionService/create.js
3530
- import { z as z29 } from "zod";
3531
- var createSessionParametersSchema = z29.object({
3532
- name: z29.string(),
3533
- knowledgeIds: z29.array(z29.string()).optional(),
3534
- artifactIds: z29.array(z29.string()).optional(),
3535
- agentIds: z29.array(z29.string()).optional(),
3536
- tags: z29.array(z29.object({ name: z29.string(), strength: z29.number() })).optional(),
3537
- summary: z29.string().optional(),
3538
- summaryAt: z29.date().optional(),
3539
- clonedSourceId: z29.string().optional().nullable(),
3540
- forkedSourceId: z29.string().optional().nullable(),
3541
- projectId: z29.string().optional(),
3542
- lastUsedModel: z29.string().optional().nullable()
3823
+ import { z as z30 } from "zod";
3824
+ var createSessionParametersSchema = z30.object({
3825
+ name: z30.string(),
3826
+ knowledgeIds: z30.array(z30.string()).optional(),
3827
+ artifactIds: z30.array(z30.string()).optional(),
3828
+ agentIds: z30.array(z30.string()).optional(),
3829
+ tags: z30.array(z30.object({ name: z30.string(), strength: z30.number() })).optional(),
3830
+ summary: z30.string().optional(),
3831
+ summaryAt: z30.date().optional(),
3832
+ clonedSourceId: z30.string().optional().nullable(),
3833
+ forkedSourceId: z30.string().optional().nullable(),
3834
+ projectId: z30.string().optional(),
3835
+ lastUsedModel: z30.string().optional().nullable()
3543
3836
  });
3544
3837
 
3545
3838
  // ../../b4m-core/packages/services/dist/src/sessionService/delete.js
3546
- import { z as z30 } from "zod";
3547
- var deleteSessionSchema = z30.object({
3548
- id: z30.string()
3839
+ import { z as z31 } from "zod";
3840
+ var deleteSessionSchema = z31.object({
3841
+ id: z31.string()
3549
3842
  });
3550
3843
 
3551
3844
  // ../../b4m-core/packages/services/dist/src/sessionService/sumarize.js
3552
- import { z as z31 } from "zod";
3553
- var sumarizeSessionSchema = z31.object({
3554
- id: z31.string()
3845
+ import { z as z32 } from "zod";
3846
+ var sumarizeSessionSchema = z32.object({
3847
+ id: z32.string()
3555
3848
  });
3556
3849
 
3557
3850
  // ../../b4m-core/packages/services/dist/src/projectService/create.js
3558
- import { z as z32 } from "zod";
3559
- var createProjectSchema = z32.object({
3560
- name: z32.string().min(1),
3561
- description: z32.string().min(1),
3562
- sessionIds: z32.array(z32.string()).optional(),
3563
- fileIds: z32.array(z32.string()).optional()
3851
+ import { z as z33 } from "zod";
3852
+ var createProjectSchema = z33.object({
3853
+ name: z33.string().min(1),
3854
+ description: z33.string().min(1),
3855
+ sessionIds: z33.array(z33.string()).optional(),
3856
+ fileIds: z33.array(z33.string()).optional()
3564
3857
  });
3565
3858
 
3566
3859
  // ../../b4m-core/packages/services/dist/src/projectService/search.js
3567
- import { z as z33 } from "zod";
3568
- var searchProjectsSchema = z33.object({
3569
- search: z33.string().optional(),
3570
- filters: z33.object({
3571
- favorite: z33.coerce.boolean().optional(),
3572
- scope: z33.record(z33.any()).optional()
3860
+ import { z as z34 } from "zod";
3861
+ var searchProjectsSchema = z34.object({
3862
+ search: z34.string().optional(),
3863
+ filters: z34.object({
3864
+ favorite: z34.coerce.boolean().optional(),
3865
+ scope: z34.record(z34.any()).optional()
3573
3866
  }).optional(),
3574
- pagination: z33.object({
3575
- page: z33.coerce.number().optional(),
3576
- limit: z33.coerce.number().optional()
3867
+ pagination: z34.object({
3868
+ page: z34.coerce.number().optional(),
3869
+ limit: z34.coerce.number().optional()
3577
3870
  }).optional(),
3578
- orderBy: z33.object({
3579
- by: z33.enum(["createdAt", "updatedAt"]).optional(),
3580
- direction: z33.enum(["asc", "desc"]).optional()
3871
+ orderBy: z34.object({
3872
+ by: z34.enum(["createdAt", "updatedAt"]).optional(),
3873
+ direction: z34.enum(["asc", "desc"]).optional()
3581
3874
  }).optional()
3582
3875
  });
3583
3876
 
3584
3877
  // ../../b4m-core/packages/services/dist/src/projectService/addSessions.js
3585
- import { z as z44 } from "zod";
3878
+ import { z as z45 } from "zod";
3586
3879
  import uniq2 from "lodash/uniq.js";
3587
3880
 
3588
3881
  // ../../b4m-core/packages/services/dist/src/sharingService/accept.js
3589
- import { z as z34 } from "zod";
3590
- var acceptInviteSchema = z34.object({
3591
- id: z34.string()
3882
+ import { z as z35 } from "zod";
3883
+ var acceptInviteSchema = z35.object({
3884
+ id: z35.string()
3592
3885
  });
3593
3886
 
3594
3887
  // ../../b4m-core/packages/services/dist/src/sharingService/cancel.js
3595
- import { z as z35 } from "zod";
3596
- var cancelInviteSchema = z35.object({
3597
- id: z35.string(),
3598
- type: z35.nativeEnum(InviteType),
3599
- email: z35.string().email().optional()
3888
+ import { z as z36 } from "zod";
3889
+ var cancelInviteSchema = z36.object({
3890
+ id: z36.string(),
3891
+ type: z36.nativeEnum(InviteType),
3892
+ email: z36.string().email().optional()
3600
3893
  });
3601
3894
 
3602
3895
  // ../../b4m-core/packages/services/dist/src/sharingService/cancelOwnDocument.js
3603
- import { z as z36 } from "zod";
3604
- var cancelOwnDocumentInvitesSchema = z36.object({
3605
- documentId: z36.string(),
3606
- type: z36.nativeEnum(InviteType)
3896
+ import { z as z37 } from "zod";
3897
+ var cancelOwnDocumentInvitesSchema = z37.object({
3898
+ documentId: z37.string(),
3899
+ type: z37.nativeEnum(InviteType)
3607
3900
  });
3608
3901
 
3609
3902
  // ../../b4m-core/packages/services/dist/src/sharingService/create.js
3610
- import { z as z37 } from "zod";
3903
+ import { z as z38 } from "zod";
3611
3904
  var defaultExpiration = () => new Date((/* @__PURE__ */ new Date()).getFullYear() + 100, (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate());
3612
3905
  var DEFAULT_AVAILABLE = 1;
3613
- var createInviteSchema = z37.object({
3614
- id: z37.string(),
3615
- type: z37.nativeEnum(InviteType),
3616
- permissions: z37.array(z37.nativeEnum(Permission)),
3617
- recipients: z37.string().array().optional(),
3618
- description: z37.string().optional(),
3619
- expiresAt: z37.date().optional().default(defaultExpiration()),
3620
- available: z37.number().optional().default(DEFAULT_AVAILABLE)
3906
+ var createInviteSchema = z38.object({
3907
+ id: z38.string(),
3908
+ type: z38.nativeEnum(InviteType),
3909
+ permissions: z38.array(z38.nativeEnum(Permission)),
3910
+ recipients: z38.string().array().optional(),
3911
+ description: z38.string().optional(),
3912
+ expiresAt: z38.date().optional().default(defaultExpiration()),
3913
+ available: z38.number().optional().default(DEFAULT_AVAILABLE)
3621
3914
  });
3622
3915
 
3623
3916
  // ../../b4m-core/packages/services/dist/src/sharingService/get.js
3624
- import { z as z38 } from "zod";
3625
- var getInviteSchema = z38.object({
3626
- id: z38.string(),
3627
- withUsername: z38.boolean().optional()
3917
+ import { z as z39 } from "zod";
3918
+ var getInviteSchema = z39.object({
3919
+ id: z39.string(),
3920
+ withUsername: z39.boolean().optional()
3628
3921
  });
3629
3922
 
3630
3923
  // ../../b4m-core/packages/services/dist/src/sharingService/listByDocumentIdAndType.js
3631
- import { z as z39 } from "zod";
3632
- var listInviteByDocumentIdAndTypeSchema = z39.object({
3633
- documentId: z39.string(),
3634
- type: z39.nativeEnum(InviteType)
3924
+ import { z as z40 } from "zod";
3925
+ var listInviteByDocumentIdAndTypeSchema = z40.object({
3926
+ documentId: z40.string(),
3927
+ type: z40.nativeEnum(InviteType)
3635
3928
  });
3636
3929
 
3637
3930
  // ../../b4m-core/packages/services/dist/src/sharingService/listOwnPending.js
3638
- import { z as z40 } from "zod";
3639
- var listOwnPendingInvitesSchema = z40.object({
3640
- limit: z40.number().min(1).max(100).default(20),
3641
- page: z40.number().min(1).default(1)
3931
+ import { z as z41 } from "zod";
3932
+ var listOwnPendingInvitesSchema = z41.object({
3933
+ limit: z41.number().min(1).max(100).default(20),
3934
+ page: z41.number().min(1).default(1)
3642
3935
  });
3643
3936
 
3644
3937
  // ../../b4m-core/packages/services/dist/src/sharingService/refuse.js
3645
- import { z as z41 } from "zod";
3646
- var refuseInviteSchema = z41.object({
3647
- id: z41.string()
3938
+ import { z as z42 } from "zod";
3939
+ var refuseInviteSchema = z42.object({
3940
+ id: z42.string()
3648
3941
  });
3649
3942
 
3650
3943
  // ../../b4m-core/packages/services/dist/src/sharingService/revoke.js
3651
- import { z as z42 } from "zod";
3652
- var revokeSharingSchema = z42.object({
3653
- id: z42.string(),
3654
- type: z42.enum(["files", "sessions", "projects"]),
3655
- userId: z42.string(),
3656
- projectId: z42.string().optional()
3944
+ import { z as z43 } from "zod";
3945
+ var revokeSharingSchema = z43.object({
3946
+ id: z43.string(),
3947
+ type: z43.enum(["files", "sessions", "projects"]),
3948
+ userId: z43.string(),
3949
+ projectId: z43.string().optional()
3657
3950
  });
3658
3951
 
3659
3952
  // ../../b4m-core/packages/services/dist/src/projectService/addFiles.js
3660
- import { z as z43 } from "zod";
3953
+ import { z as z44 } from "zod";
3661
3954
  import uniq from "lodash/uniq.js";
3662
- var addFilesProjectSchema = z43.object({
3663
- projectId: z43.string().nonempty(),
3664
- fileIds: z43.array(z43.string().nonempty())
3955
+ var addFilesProjectSchema = z44.object({
3956
+ projectId: z44.string().nonempty(),
3957
+ fileIds: z44.array(z44.string().nonempty())
3665
3958
  });
3666
3959
 
3667
3960
  // ../../b4m-core/packages/services/dist/src/projectService/addSessions.js
3668
- var addSessionsProjectSchema = z44.object({
3669
- projectId: z44.string().nonempty(),
3670
- sessionIds: z44.array(z44.string().nonempty())
3961
+ var addSessionsProjectSchema = z45.object({
3962
+ projectId: z45.string().nonempty(),
3963
+ sessionIds: z45.array(z45.string().nonempty())
3671
3964
  });
3672
3965
 
3673
3966
  // ../../b4m-core/packages/services/dist/src/projectService/get.js
3674
- import { z as z45 } from "zod";
3675
- var getProjectSchema = z45.object({
3676
- id: z45.string()
3677
- });
3678
-
3679
- // ../../b4m-core/packages/services/dist/src/projectService/update.js
3680
3967
  import { z as z46 } from "zod";
3681
- var updateProjectSchema = z46.object({
3682
- id: z46.string(),
3683
- name: z46.string().optional(),
3684
- description: z46.string().optional()
3968
+ var getProjectSchema = z46.object({
3969
+ id: z46.string()
3685
3970
  });
3686
3971
 
3687
- // ../../b4m-core/packages/services/dist/src/projectService/delete.js
3972
+ // ../../b4m-core/packages/services/dist/src/projectService/update.js
3688
3973
  import { z as z47 } from "zod";
3689
- var deleteProjectSchema = z47.object({
3690
- id: z47.string()
3974
+ var updateProjectSchema = z47.object({
3975
+ id: z47.string(),
3976
+ name: z47.string().optional(),
3977
+ description: z47.string().optional()
3691
3978
  });
3692
3979
 
3693
- // ../../b4m-core/packages/services/dist/src/projectService/removeFiles.js
3980
+ // ../../b4m-core/packages/services/dist/src/projectService/delete.js
3694
3981
  import { z as z48 } from "zod";
3695
- var removeProjectFilesSchema = z48.object({
3696
- projectId: z48.string(),
3697
- fileIds: z48.array(z48.string())
3982
+ var deleteProjectSchema = z48.object({
3983
+ id: z48.string()
3698
3984
  });
3699
3985
 
3700
- // ../../b4m-core/packages/services/dist/src/projectService/removeSessions.js
3986
+ // ../../b4m-core/packages/services/dist/src/projectService/removeFiles.js
3701
3987
  import { z as z49 } from "zod";
3702
- var removeProjectSessionsSchema = z49.object({
3988
+ var removeProjectFilesSchema = z49.object({
3703
3989
  projectId: z49.string(),
3704
- sessionIds: z49.array(z49.string())
3990
+ fileIds: z49.array(z49.string())
3705
3991
  });
3706
3992
 
3707
- // ../../b4m-core/packages/services/dist/src/projectService/listSessions.js
3993
+ // ../../b4m-core/packages/services/dist/src/projectService/removeSessions.js
3708
3994
  import { z as z50 } from "zod";
3709
- var listProjectSessionsSchema = z50.object({
3710
- projectId: z50.string()
3995
+ var removeProjectSessionsSchema = z50.object({
3996
+ projectId: z50.string(),
3997
+ sessionIds: z50.array(z50.string())
3711
3998
  });
3712
3999
 
3713
- // ../../b4m-core/packages/services/dist/src/projectService/listFiles.js
4000
+ // ../../b4m-core/packages/services/dist/src/projectService/listSessions.js
3714
4001
  import { z as z51 } from "zod";
3715
- var listProjectFilesSchema = z51.object({
4002
+ var listProjectSessionsSchema = z51.object({
3716
4003
  projectId: z51.string()
3717
4004
  });
3718
4005
 
3719
- // ../../b4m-core/packages/services/dist/src/projectService/listInvites.js
4006
+ // ../../b4m-core/packages/services/dist/src/projectService/listFiles.js
3720
4007
  import { z as z52 } from "zod";
3721
- var listProjectInvitesParamsSchema = z52.object({
3722
- id: z52.string(),
3723
- statuses: z52.string().optional().default(""),
3724
- limit: z52.coerce.number().optional().default(10),
3725
- page: z52.coerce.number().optional().default(1)
4008
+ var listProjectFilesSchema = z52.object({
4009
+ projectId: z52.string()
3726
4010
  });
3727
4011
 
3728
- // ../../b4m-core/packages/services/dist/src/projectService/addSystemPrompts.js
4012
+ // ../../b4m-core/packages/services/dist/src/projectService/listInvites.js
3729
4013
  import { z as z53 } from "zod";
3730
- var addSystemPromptsSchema = z53.object({
3731
- projectId: z53.string(),
3732
- fileIds: z53.array(z53.string())
4014
+ var listProjectInvitesParamsSchema = z53.object({
4015
+ id: z53.string(),
4016
+ statuses: z53.string().optional().default(""),
4017
+ limit: z53.coerce.number().optional().default(10),
4018
+ page: z53.coerce.number().optional().default(1)
3733
4019
  });
3734
4020
 
3735
- // ../../b4m-core/packages/services/dist/src/projectService/toggleSystemPrompt.js
4021
+ // ../../b4m-core/packages/services/dist/src/projectService/addSystemPrompts.js
3736
4022
  import { z as z54 } from "zod";
3737
- var toggleSystemPromptSchema = z54.object({
4023
+ var addSystemPromptsSchema = z54.object({
3738
4024
  projectId: z54.string(),
3739
- fileId: z54.string()
4025
+ fileIds: z54.array(z54.string())
3740
4026
  });
3741
4027
 
3742
- // ../../b4m-core/packages/services/dist/src/projectService/removeSystemPrompt.js
4028
+ // ../../b4m-core/packages/services/dist/src/projectService/toggleSystemPrompt.js
3743
4029
  import { z as z55 } from "zod";
3744
- var removeSystemPromptSchema = z55.object({
4030
+ var toggleSystemPromptSchema = z55.object({
3745
4031
  projectId: z55.string(),
3746
4032
  fileId: z55.string()
3747
4033
  });
3748
4034
 
3749
- // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
3750
- import { z as z58 } from "zod";
3751
-
3752
- // ../../b4m-core/packages/services/dist/src/favoriteService/create.js
4035
+ // ../../b4m-core/packages/services/dist/src/projectService/removeSystemPrompt.js
3753
4036
  import { z as z56 } from "zod";
3754
- var createFavoriteParametersSchema = z56.object({
3755
- documentId: z56.string(),
3756
- documentType: z56.nativeEnum(FavoriteDocumentType)
4037
+ var removeSystemPromptSchema = z56.object({
4038
+ projectId: z56.string(),
4039
+ fileId: z56.string()
3757
4040
  });
3758
4041
 
3759
- // ../../b4m-core/packages/services/dist/src/favoriteService/delete.js
4042
+ // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
4043
+ import { z as z59 } from "zod";
4044
+
4045
+ // ../../b4m-core/packages/services/dist/src/favoriteService/create.js
3760
4046
  import { z as z57 } from "zod";
3761
- var deleteFavoriteParametersSchema = z57.object({
4047
+ var createFavoriteParametersSchema = z57.object({
3762
4048
  documentId: z57.string(),
3763
4049
  documentType: z57.nativeEnum(FavoriteDocumentType)
3764
4050
  });
3765
4051
 
3766
- // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
3767
- var addFavoriteParametersSchema = z58.object({
3768
- projectId: z58.string()
4052
+ // ../../b4m-core/packages/services/dist/src/favoriteService/delete.js
4053
+ import { z as z58 } from "zod";
4054
+ var deleteFavoriteParametersSchema = z58.object({
4055
+ documentId: z58.string(),
4056
+ documentType: z58.nativeEnum(FavoriteDocumentType)
3769
4057
  });
3770
4058
 
3771
- // ../../b4m-core/packages/services/dist/src/projectService/deleteFavorite.js
3772
- import { z as z59 } from "zod";
3773
- var deleteFavoriteParametersSchema2 = z59.object({
4059
+ // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
4060
+ var addFavoriteParametersSchema = z59.object({
3774
4061
  projectId: z59.string()
3775
4062
  });
3776
4063
 
3777
- // ../../b4m-core/packages/services/dist/src/projectService/removeNonExistentFiles.js
4064
+ // ../../b4m-core/packages/services/dist/src/projectService/deleteFavorite.js
3778
4065
  import { z as z60 } from "zod";
3779
- var removeNonExistentFilesSchema = z60.object({
4066
+ var deleteFavoriteParametersSchema2 = z60.object({
3780
4067
  projectId: z60.string()
3781
4068
  });
3782
4069
 
3783
- // ../../b4m-core/packages/services/dist/src/projectService/leaveProject.js
4070
+ // ../../b4m-core/packages/services/dist/src/projectService/removeNonExistentFiles.js
3784
4071
  import { z as z61 } from "zod";
3785
- var leaveProjectParamsSchema = z61.object({
3786
- id: z61.string(),
3787
- userIdToRemove: z61.string().optional()
3788
- // Optional: if provided, this is a removal by owner
4072
+ var removeNonExistentFilesSchema = z61.object({
4073
+ projectId: z61.string()
3789
4074
  });
3790
4075
 
3791
- // ../../b4m-core/packages/services/dist/src/sessionService/update.js
3792
- import uniq3 from "lodash/uniq.js";
3793
- import isEqual from "lodash/isEqual.js";
4076
+ // ../../b4m-core/packages/services/dist/src/projectService/leaveProject.js
3794
4077
  import { z as z62 } from "zod";
3795
- var updateSessionParamtersSchema = z62.object({
4078
+ var leaveProjectParamsSchema = z62.object({
3796
4079
  id: z62.string(),
3797
- name: z62.string().optional(),
3798
- knowledgeIds: z62.array(z62.string()).optional(),
3799
- artifactIds: z62.array(z62.string()).optional(),
3800
- tags: z62.array(z62.object({ name: z62.string(), strength: z62.number() })).optional(),
3801
- lastUsedModel: z62.string().optional()
4080
+ userIdToRemove: z62.string().optional()
4081
+ // Optional: if provided, this is a removal by owner
3802
4082
  });
3803
4083
 
3804
- // ../../b4m-core/packages/services/dist/src/sessionService/clone.js
4084
+ // ../../b4m-core/packages/services/dist/src/sessionService/update.js
4085
+ import uniq3 from "lodash/uniq.js";
4086
+ import isEqual from "lodash/isEqual.js";
3805
4087
  import { z as z63 } from "zod";
3806
- var cloneSessionSchema = z63.object({
3807
- id: z63.string()
4088
+ var updateSessionParamtersSchema = z63.object({
4089
+ id: z63.string(),
4090
+ name: z63.string().optional(),
4091
+ knowledgeIds: z63.array(z63.string()).optional(),
4092
+ artifactIds: z63.array(z63.string()).optional(),
4093
+ tags: z63.array(z63.object({ name: z63.string(), strength: z63.number() })).optional(),
4094
+ lastUsedModel: z63.string().optional()
3808
4095
  });
3809
4096
 
3810
- // ../../b4m-core/packages/services/dist/src/sessionService/fork.js
4097
+ // ../../b4m-core/packages/services/dist/src/sessionService/clone.js
3811
4098
  import { z as z64 } from "zod";
3812
- var forkSessionSchema = z64.object({
3813
- sessionId: z64.string(),
3814
- messageId: z64.string()
4099
+ var cloneSessionSchema = z64.object({
4100
+ id: z64.string()
3815
4101
  });
3816
4102
 
3817
- // ../../b4m-core/packages/services/dist/src/sessionService/snip.js
4103
+ // ../../b4m-core/packages/services/dist/src/sessionService/fork.js
3818
4104
  import { z as z65 } from "zod";
3819
- var snipSessionSchema = z65.object({
4105
+ var forkSessionSchema = z65.object({
3820
4106
  sessionId: z65.string(),
3821
4107
  messageId: z65.string()
3822
4108
  });
3823
4109
 
3824
- // ../../b4m-core/packages/services/dist/src/sessionService/get.js
4110
+ // ../../b4m-core/packages/services/dist/src/sessionService/snip.js
3825
4111
  import { z as z66 } from "zod";
3826
- var getSessionSchema = z66.object({
3827
- id: z66.string()
4112
+ var snipSessionSchema = z66.object({
4113
+ sessionId: z66.string(),
4114
+ messageId: z66.string()
3828
4115
  });
3829
4116
 
3830
- // ../../b4m-core/packages/services/dist/src/sessionService/deleteMessage.js
4117
+ // ../../b4m-core/packages/services/dist/src/sessionService/get.js
3831
4118
  import { z as z67 } from "zod";
3832
- var deleteSessionMessageSchema = z67.object({
3833
- sessionId: z67.string(),
3834
- messageId: z67.string()
4119
+ var getSessionSchema = z67.object({
4120
+ id: z67.string()
3835
4121
  });
3836
4122
 
3837
- // ../../b4m-core/packages/services/dist/src/sessionService/addFavorite.js
4123
+ // ../../b4m-core/packages/services/dist/src/sessionService/deleteMessage.js
3838
4124
  import { z as z68 } from "zod";
3839
- var addFavoriteParametersSchema2 = z68.object({
3840
- sessionId: z68.string()
4125
+ var deleteSessionMessageSchema = z68.object({
4126
+ sessionId: z68.string(),
4127
+ messageId: z68.string()
3841
4128
  });
3842
4129
 
3843
- // ../../b4m-core/packages/services/dist/src/sessionService/deleteFavorite.js
4130
+ // ../../b4m-core/packages/services/dist/src/sessionService/addFavorite.js
3844
4131
  import { z as z69 } from "zod";
3845
- var deleteFavoriteParametersSchema3 = z69.object({
4132
+ var addFavoriteParametersSchema2 = z69.object({
3846
4133
  sessionId: z69.string()
3847
4134
  });
3848
4135
 
3849
- // ../../b4m-core/packages/services/dist/src/sessionService/autoName.js
4136
+ // ../../b4m-core/packages/services/dist/src/sessionService/deleteFavorite.js
3850
4137
  import { z as z70 } from "zod";
3851
- var autoNameParameterSchema = z70.object({
3852
- sessionId: z70.string(),
4138
+ var deleteFavoriteParametersSchema3 = z70.object({
4139
+ sessionId: z70.string()
4140
+ });
4141
+
4142
+ // ../../b4m-core/packages/services/dist/src/sessionService/autoName.js
4143
+ import { z as z71 } from "zod";
4144
+ var autoNameParameterSchema = z71.object({
4145
+ sessionId: z71.string(),
3853
4146
  /** The maximum number of words to include in the title */
3854
- maxWords: z70.number().optional()
4147
+ maxWords: z71.number().optional()
3855
4148
  });
3856
4149
 
3857
4150
  // ../../b4m-core/packages/services/dist/src/organizationService/search.js
3858
- import { z as z71 } from "zod";
3859
- var searchSchema2 = z71.object({
4151
+ import { z as z72 } from "zod";
4152
+ var searchSchema2 = z72.object({
3860
4153
  /**
3861
4154
  * Text search query (searches in name and description)
3862
4155
  */
3863
- query: z71.string().optional(),
4156
+ query: z72.string().optional(),
3864
4157
  /**
3865
4158
  * Filter by personal organizations
3866
4159
  */
3867
- filters: z71.object({
3868
- personal: z71.union([z71.enum(["true", "false"]).transform((val) => val === "true"), z71.boolean()]).optional(),
3869
- userId: z71.string().optional()
4160
+ filters: z72.object({
4161
+ personal: z72.union([z72.enum(["true", "false"]).transform((val) => val === "true"), z72.boolean()]).optional(),
4162
+ userId: z72.string().optional()
3870
4163
  }).default({}),
3871
- pagination: z71.object({
3872
- page: z71.coerce.number().int().positive().default(1),
3873
- limit: z71.coerce.number().int().positive().max(100).default(10)
4164
+ pagination: z72.object({
4165
+ page: z72.coerce.number().int().positive().default(1),
4166
+ limit: z72.coerce.number().int().positive().max(100).default(10)
3874
4167
  }).default({
3875
4168
  page: 1,
3876
4169
  limit: 10
3877
4170
  }),
3878
- orderBy: z71.object({
3879
- field: z71.enum(["name", "createdAt", "updatedAt"]).default("name"),
3880
- direction: z71.enum(["asc", "desc"]).default("asc")
4171
+ orderBy: z72.object({
4172
+ field: z72.enum(["name", "createdAt", "updatedAt"]).default("name"),
4173
+ direction: z72.enum(["asc", "desc"]).default("asc")
3881
4174
  }).default({
3882
4175
  field: "name",
3883
4176
  direction: "asc"
@@ -3885,355 +4178,355 @@ var searchSchema2 = z71.object({
3885
4178
  });
3886
4179
 
3887
4180
  // ../../b4m-core/packages/services/dist/src/organizationService/get.js
3888
- import { z as z72 } from "zod";
3889
- var getSchema = z72.object({
4181
+ import { z as z73 } from "zod";
4182
+ var getSchema = z73.object({
3890
4183
  /**
3891
4184
  * Organization ID
3892
4185
  */
3893
- id: z72.string().min(1)
4186
+ id: z73.string().min(1)
3894
4187
  });
3895
4188
 
3896
4189
  // ../../b4m-core/packages/services/dist/src/organizationService/addMember.js
3897
- import { z as z73 } from "zod";
3898
- var addMemberSchema = z73.object({
3899
- userId: z73.string().optional(),
3900
- email: z73.string().optional(),
3901
- organizationId: z73.string(),
3902
- force: z73.boolean().optional()
4190
+ import { z as z74 } from "zod";
4191
+ var addMemberSchema = z74.object({
4192
+ userId: z74.string().optional(),
4193
+ email: z74.string().optional(),
4194
+ organizationId: z74.string(),
4195
+ force: z74.boolean().optional()
3903
4196
  // If true, add the user to the organization even if it's at full capacity
3904
4197
  });
3905
4198
 
3906
4199
  // ../../b4m-core/packages/services/dist/src/organizationService/getUsers.js
3907
- import { z as z74 } from "zod";
3908
- var getUsersSchema = z74.object({
3909
- id: z74.string()
4200
+ import { z as z75 } from "zod";
4201
+ var getUsersSchema = z75.object({
4202
+ id: z75.string()
3910
4203
  });
3911
4204
 
3912
4205
  // ../../b4m-core/packages/services/dist/src/organizationService/create.js
3913
- import { z as z75 } from "zod";
3914
- var createSchema = z75.object({
3915
- name: z75.string(),
3916
- personal: z75.boolean().default(false),
3917
- seats: z75.number().default(1),
3918
- stripeCustomerId: z75.string().nullable(),
3919
- billingOwnerId: z75.string().optional(),
4206
+ import { z as z76 } from "zod";
4207
+ var createSchema = z76.object({
4208
+ name: z76.string(),
4209
+ personal: z76.boolean().default(false),
4210
+ seats: z76.number().default(1),
4211
+ stripeCustomerId: z76.string().nullable(),
4212
+ billingOwnerId: z76.string().optional(),
3920
4213
  // Optional billing owner (defaults to user if not provided)
3921
- managerId: z75.string().optional()
4214
+ managerId: z76.string().optional()
3922
4215
  // Optional team manager
3923
4216
  });
3924
4217
 
3925
4218
  // ../../b4m-core/packages/services/dist/src/organizationService/update.js
3926
- import { z as z76 } from "zod";
3927
- var updateSchema = z76.object({
3928
- id: z76.string(),
3929
- name: z76.string().optional(),
3930
- description: z76.string().optional(),
3931
- billingContact: z76.string().optional(),
3932
- currentCredits: z76.coerce.number().optional()
4219
+ import { z as z77 } from "zod";
4220
+ var updateSchema = z77.object({
4221
+ id: z77.string(),
4222
+ name: z77.string().optional(),
4223
+ description: z77.string().optional(),
4224
+ billingContact: z77.string().optional(),
4225
+ currentCredits: z77.coerce.number().optional()
3933
4226
  });
3934
4227
 
3935
4228
  // ../../b4m-core/packages/services/dist/src/organizationService/delete.js
3936
- import { z as z77 } from "zod";
3937
- var deleteSchema = z77.object({
4229
+ import { z as z78 } from "zod";
4230
+ var deleteSchema = z78.object({
3938
4231
  /**
3939
4232
  * Organization ID
3940
4233
  */
3941
- id: z77.string().min(1)
4234
+ id: z78.string().min(1)
3942
4235
  });
3943
4236
 
3944
4237
  // ../../b4m-core/packages/services/dist/src/organizationService/listPendingUsers.js
3945
- import { z as z78 } from "zod";
3946
- var listPendingUsersSchema = z78.object({
3947
- organizationId: z78.string()
4238
+ import { z as z79 } from "zod";
4239
+ var listPendingUsersSchema = z79.object({
4240
+ organizationId: z79.string()
3948
4241
  });
3949
4242
 
3950
4243
  // ../../b4m-core/packages/services/dist/src/organizationService/revokeAccess.js
3951
- import { z as z79 } from "zod";
3952
- var revokeAccessSchema = z79.object({
3953
- id: z79.string(),
3954
- userId: z79.string()
4244
+ import { z as z80 } from "zod";
4245
+ var revokeAccessSchema = z80.object({
4246
+ id: z80.string(),
4247
+ userId: z80.string()
3955
4248
  });
3956
4249
 
3957
4250
  // ../../b4m-core/packages/services/dist/src/organizationService/leave.js
3958
- import { z as z80 } from "zod";
3959
- var organizationLeaveSchema = z80.object({
3960
- id: z80.string()
4251
+ import { z as z81 } from "zod";
4252
+ var organizationLeaveSchema = z81.object({
4253
+ id: z81.string()
3961
4254
  });
3962
4255
 
3963
4256
  // ../../b4m-core/packages/services/dist/src/apiKeyService/create.js
3964
- import { z as z81 } from "zod";
3965
- var createApiKeySchema = z81.object({
3966
- apiKey: z81.string().min(6),
3967
- description: z81.string().optional().default(""),
3968
- isActive: z81.boolean().optional().default(true),
3969
- type: z81.nativeEnum(ApiKeyType),
3970
- expireDays: z81.number().min(1).max(365).default(90)
4257
+ import { z as z82 } from "zod";
4258
+ var createApiKeySchema = z82.object({
4259
+ apiKey: z82.string().min(6),
4260
+ description: z82.string().optional().default(""),
4261
+ isActive: z82.boolean().optional().default(true),
4262
+ type: z82.nativeEnum(ApiKeyType),
4263
+ expireDays: z82.number().min(1).max(365).default(90)
3971
4264
  // Default 90-day expiration
3972
4265
  });
3973
4266
 
3974
4267
  // ../../b4m-core/packages/services/dist/src/apiKeyService/set.js
3975
- import { z as z82 } from "zod";
3976
- var setApiKeySchema = z82.object({
3977
- id: z82.string(),
3978
- type: z82.nativeEnum(ApiKeyType)
4268
+ import { z as z83 } from "zod";
4269
+ var setApiKeySchema = z83.object({
4270
+ id: z83.string(),
4271
+ type: z83.nativeEnum(ApiKeyType)
3979
4272
  });
3980
4273
 
3981
4274
  // ../../b4m-core/packages/services/dist/src/apiKeyService/delete.js
3982
- import { z as z83 } from "zod";
3983
- var deleteApiKeySchema = z83.object({
3984
- id: z83.string()
4275
+ import { z as z84 } from "zod";
4276
+ var deleteApiKeySchema = z84.object({
4277
+ id: z84.string()
3985
4278
  });
3986
4279
 
3987
4280
  // ../../b4m-core/packages/services/dist/src/fabFileService/get.js
3988
- import { z as z84 } from "zod";
3989
- var getFabFileSchema = z84.object({
3990
- id: z84.string()
4281
+ import { z as z85 } from "zod";
4282
+ var getFabFileSchema = z85.object({
4283
+ id: z85.string()
3991
4284
  });
3992
4285
 
3993
4286
  // ../../b4m-core/packages/services/dist/src/fabFileService/list.js
3994
- import { z as z85 } from "zod";
3995
- var listFabFilesSchema = z85.object({
3996
- ids: z85.array(z85.string()).optional()
4287
+ import { z as z86 } from "zod";
4288
+ var listFabFilesSchema = z86.object({
4289
+ ids: z86.array(z86.string()).optional()
3997
4290
  });
3998
4291
 
3999
4292
  // ../../b4m-core/packages/services/dist/src/fabFileService/update.js
4000
4293
  import mime from "mime-types";
4001
4294
  import { v4 as uuidv42 } from "uuid";
4002
- import { z as z86 } from "zod";
4003
- var updateFabFileSchema = z86.object({
4004
- id: z86.string(),
4005
- fileName: z86.string(),
4006
- mimeType: z86.string(),
4007
- fileContent: z86.string().optional(),
4008
- type: z86.nativeEnum(KnowledgeType),
4009
- system: z86.boolean().optional(),
4010
- systemPriority: z86.number().min(0).max(999).optional(),
4011
- sessionId: z86.string().optional(),
4012
- notes: z86.string().optional(),
4013
- primaryTag: z86.string().optional(),
4014
- tags: z86.array(z86.object({
4015
- name: z86.string(),
4016
- strength: z86.number()
4295
+ import { z as z87 } from "zod";
4296
+ var updateFabFileSchema = z87.object({
4297
+ id: z87.string(),
4298
+ fileName: z87.string(),
4299
+ mimeType: z87.string(),
4300
+ fileContent: z87.string().optional(),
4301
+ type: z87.nativeEnum(KnowledgeType),
4302
+ system: z87.boolean().optional(),
4303
+ systemPriority: z87.number().min(0).max(999).optional(),
4304
+ sessionId: z87.string().optional(),
4305
+ notes: z87.string().optional(),
4306
+ primaryTag: z87.string().optional(),
4307
+ tags: z87.array(z87.object({
4308
+ name: z87.string(),
4309
+ strength: z87.number()
4017
4310
  })).optional(),
4018
- error: z86.string().nullable().optional()
4311
+ error: z87.string().nullable().optional()
4019
4312
  });
4020
4313
 
4021
4314
  // ../../b4m-core/packages/services/dist/src/fabFileService/delete.js
4022
- import { z as z87 } from "zod";
4023
- var deleteFabFileSchema = z87.object({
4024
- id: z87.string()
4315
+ import { z as z88 } from "zod";
4316
+ var deleteFabFileSchema = z88.object({
4317
+ id: z88.string()
4025
4318
  });
4026
4319
 
4027
4320
  // ../../b4m-core/packages/services/dist/src/fabFileService/chunk.js
4028
- import { z as z88 } from "zod";
4029
- var chunkFileSchema = z88.object({
4030
- fabFileId: z88.string(),
4031
- embeddingModel: z88.string()
4321
+ import { z as z89 } from "zod";
4322
+ var chunkFileSchema = z89.object({
4323
+ fabFileId: z89.string(),
4324
+ embeddingModel: z89.string()
4032
4325
  });
4033
4326
 
4034
4327
  // ../../b4m-core/packages/services/dist/src/fabFileService/vectorize.js
4035
- import { z as z89 } from "zod";
4036
- var vectorizeFabFileChunkSchema = z89.object({
4037
- fabFileId: z89.string(),
4038
- chunkId: z89.string()
4328
+ import { z as z90 } from "zod";
4329
+ var vectorizeFabFileChunkSchema = z90.object({
4330
+ fabFileId: z90.string(),
4331
+ chunkId: z90.string()
4039
4332
  });
4040
4333
 
4041
4334
  // ../../b4m-core/packages/services/dist/src/fabFileService/listBySession.js
4042
- import { z as z90 } from "zod";
4043
- var listFabFilesBySessionSchema = z90.object({
4044
- sessionId: z90.string()
4335
+ import { z as z91 } from "zod";
4336
+ var listFabFilesBySessionSchema = z91.object({
4337
+ sessionId: z91.string()
4045
4338
  });
4046
4339
 
4047
4340
  // ../../b4m-core/packages/services/dist/src/fabFileService/listByQuest.js
4048
- import { z as z91 } from "zod";
4049
- var listFabFilesByQuestSchema = z91.object({
4050
- questId: z91.string()
4341
+ import { z as z92 } from "zod";
4342
+ var listFabFilesByQuestSchema = z92.object({
4343
+ questId: z92.string()
4051
4344
  });
4052
4345
 
4053
4346
  // ../../b4m-core/packages/services/dist/src/fabFileService/createByUrl.js
4054
- import { z as z92 } from "zod";
4055
- var createFabFileByUrlSchema = z92.object({
4056
- 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,})).+/)
4347
+ import { z as z93 } from "zod";
4348
+ var createFabFileByUrlSchema = z93.object({
4349
+ 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,})).+/)
4057
4350
  });
4058
4351
 
4059
4352
  // ../../b4m-core/packages/services/dist/src/fabFileService/search.js
4060
- import { z as z93 } from "zod";
4061
- var searchFabFilesSchema = z93.object({
4062
- search: z93.string().optional(),
4063
- filters: z93.object({
4064
- tags: z93.array(z93.string()).optional(),
4065
- type: z93.enum(["text", "pdf", "url", "image", "excel", "word", "json", "csv", "markdown", "code"]).optional(),
4066
- shared: z93.coerce.boolean().optional(),
4353
+ import { z as z94 } from "zod";
4354
+ var searchFabFilesSchema = z94.object({
4355
+ search: z94.string().optional(),
4356
+ filters: z94.object({
4357
+ tags: z94.array(z94.string()).optional(),
4358
+ type: z94.enum(["text", "pdf", "url", "image", "excel", "word", "json", "csv", "markdown", "code"]).optional(),
4359
+ shared: z94.coerce.boolean().optional(),
4067
4360
  // Indicates if the user is searching for shared files
4068
- curated: z93.coerce.boolean().optional(),
4361
+ curated: z94.coerce.boolean().optional(),
4069
4362
  // Indicates if the user is searching for curated notebook files
4070
- projectId: z93.string().optional(),
4071
- ids: z93.array(z93.string()).optional()
4363
+ projectId: z94.string().optional(),
4364
+ ids: z94.array(z94.string()).optional()
4072
4365
  // Add support for filtering by IDs
4073
4366
  }).optional(),
4074
- pagination: z93.object({
4075
- page: z93.coerce.number(),
4076
- limit: z93.coerce.number()
4367
+ pagination: z94.object({
4368
+ page: z94.coerce.number(),
4369
+ limit: z94.coerce.number()
4077
4370
  }).optional(),
4078
- order: z93.object({
4079
- by: z93.enum(["createdAt", "fileName", "fileSize"]),
4080
- direction: z93.enum(["asc", "desc"])
4371
+ order: z94.object({
4372
+ by: z94.enum(["createdAt", "fileName", "fileSize"]),
4373
+ direction: z94.enum(["asc", "desc"])
4081
4374
  }).optional(),
4082
- options: z93.object({
4083
- includeShared: z93.coerce.boolean().optional()
4375
+ options: z94.object({
4376
+ includeShared: z94.coerce.boolean().optional()
4084
4377
  }).optional()
4085
4378
  });
4086
4379
 
4087
4380
  // ../../b4m-core/packages/services/dist/src/fabFileService/addFavorite.js
4088
- import { z as z94 } from "zod";
4089
- var addFavoriteParametersSchema3 = z94.object({
4090
- fileId: z94.string()
4381
+ import { z as z95 } from "zod";
4382
+ var addFavoriteParametersSchema3 = z95.object({
4383
+ fileId: z95.string()
4091
4384
  });
4092
4385
 
4093
4386
  // ../../b4m-core/packages/services/dist/src/fabFileService/deleteFavorite.js
4094
- import { z as z95 } from "zod";
4095
- var deleteFavoriteParametersSchema4 = z95.object({
4096
- fileId: z95.string()
4387
+ import { z as z96 } from "zod";
4388
+ var deleteFavoriteParametersSchema4 = z96.object({
4389
+ fileId: z96.string()
4097
4390
  });
4098
4391
 
4099
4392
  // ../../b4m-core/packages/services/dist/src/fabFileService/toggleTags.js
4100
- import { z as z96 } from "zod";
4101
- var fabFileToggleTagsSchema = z96.object({
4102
- ids: z96.array(z96.string()),
4103
- tags: z96.array(z96.string())
4393
+ import { z as z97 } from "zod";
4394
+ var fabFileToggleTagsSchema = z97.object({
4395
+ ids: z97.array(z97.string()),
4396
+ tags: z97.array(z97.string())
4104
4397
  });
4105
4398
 
4106
4399
  // ../../b4m-core/packages/services/dist/src/fabFileService/edit.js
4107
- import { z as z97 } from "zod";
4400
+ import { z as z98 } from "zod";
4108
4401
  import { diffLines } from "diff";
4109
- var editFabFileSchema = z97.object({
4110
- id: z97.string(),
4111
- instruction: z97.string(),
4112
- selection: z97.object({
4113
- start: z97.number(),
4114
- end: z97.number()
4402
+ var editFabFileSchema = z98.object({
4403
+ id: z98.string(),
4404
+ instruction: z98.string(),
4405
+ selection: z98.object({
4406
+ start: z98.number(),
4407
+ end: z98.number()
4115
4408
  }).optional(),
4116
- preserveFormatting: z97.boolean().optional().default(true),
4117
- applyImmediately: z97.boolean().optional().default(false)
4409
+ preserveFormatting: z98.boolean().optional().default(true),
4410
+ applyImmediately: z98.boolean().optional().default(false)
4118
4411
  });
4119
4412
 
4120
4413
  // ../../b4m-core/packages/services/dist/src/fabFileService/applyEdit.js
4121
4414
  import mime2 from "mime-types";
4122
4415
  import { v4 as uuidv43 } from "uuid";
4123
- import { z as z98 } from "zod";
4124
- var applyEditSchema = z98.object({
4125
- id: z98.string(),
4126
- modifiedContent: z98.string(),
4127
- createBackup: z98.boolean().optional().default(true)
4416
+ import { z as z99 } from "zod";
4417
+ var applyEditSchema = z99.object({
4418
+ id: z99.string(),
4419
+ modifiedContent: z99.string(),
4420
+ createBackup: z99.boolean().optional().default(true)
4128
4421
  });
4129
4422
 
4130
4423
  // ../../b4m-core/packages/services/dist/src/friendshipService/respondToFriendRequest.js
4131
- import { z as z99 } from "zod";
4132
- var respondToFriendRequestSchema = z99.object({
4133
- id: z99.string(),
4424
+ import { z as z100 } from "zod";
4425
+ var respondToFriendRequestSchema = z100.object({
4426
+ id: z100.string(),
4134
4427
  /** The user ID of the recipient of the friend request */
4135
- userId: z99.string(),
4136
- accept: z99.boolean()
4428
+ userId: z100.string(),
4429
+ accept: z100.boolean()
4137
4430
  });
4138
4431
 
4139
4432
  // ../../b4m-core/packages/services/dist/src/friendshipService/unfriend.js
4140
- import { z as z100 } from "zod";
4141
- var unfriendSchema = z100.object({
4142
- friendshipId: z100.string(),
4433
+ import { z as z101 } from "zod";
4434
+ var unfriendSchema = z101.object({
4435
+ friendshipId: z101.string(),
4143
4436
  /** The user ID of the user who wants to unfriend the other user */
4144
- userId: z100.string()
4437
+ userId: z101.string()
4145
4438
  });
4146
4439
 
4147
4440
  // ../../b4m-core/packages/services/dist/src/friendshipService/list.js
4148
- import { z as z101 } from "zod";
4149
- var listFriendsSchema = z101.object({
4150
- userId: z101.string()
4441
+ import { z as z102 } from "zod";
4442
+ var listFriendsSchema = z102.object({
4443
+ userId: z102.string()
4151
4444
  });
4152
- var listPendingFriendRequestsSchema = z101.object({
4153
- userId: z101.string()
4445
+ var listPendingFriendRequestsSchema = z102.object({
4446
+ userId: z102.string()
4154
4447
  });
4155
4448
 
4156
4449
  // ../../b4m-core/packages/services/dist/src/adminService/loginAs.js
4157
- import { z as z102 } from "zod";
4158
- var loginAsSchema = z102.object({
4159
- targetUserId: z102.string()
4450
+ import { z as z103 } from "zod";
4451
+ var loginAsSchema = z103.object({
4452
+ targetUserId: z103.string()
4160
4453
  });
4161
4454
 
4162
4455
  // ../../b4m-core/packages/services/dist/src/cacheService/get.js
4163
- import { z as z103 } from "zod";
4164
- var getParamsSchema = z103.object({
4165
- key: z103.string()
4456
+ import { z as z104 } from "zod";
4457
+ var getParamsSchema = z104.object({
4458
+ key: z104.string()
4166
4459
  });
4167
4460
 
4168
4461
  // ../../b4m-core/packages/services/dist/src/cacheService/set.js
4169
- import { z as z104 } from "zod";
4170
- var setParamsSchema = z104.object({
4171
- key: z104.string(),
4172
- value: z104.any(),
4462
+ import { z as z105 } from "zod";
4463
+ var setParamsSchema = z105.object({
4464
+ key: z105.string(),
4465
+ value: z105.any(),
4173
4466
  /**
4174
4467
  * Time to live in milliseconds
4175
4468
  */
4176
- ttl: z104.number(),
4177
- recache: z104.boolean().optional()
4469
+ ttl: z105.number(),
4470
+ recache: z105.boolean().optional()
4178
4471
  });
4179
4472
 
4180
4473
  // ../../b4m-core/packages/services/dist/src/cacheService/ttl.js
4181
- import { z as z105 } from "zod";
4182
- var ttlParamsSchema = z105.object({
4183
- key: z105.string()
4474
+ import { z as z106 } from "zod";
4475
+ var ttlParamsSchema = z106.object({
4476
+ key: z106.string()
4184
4477
  });
4185
4478
 
4186
4479
  // ../../b4m-core/packages/services/dist/src/cacheService/weeklyReports.js
4187
- import { z as z106 } from "zod";
4480
+ import { z as z107 } from "zod";
4188
4481
  import dayjs3 from "dayjs";
4189
- var weeklyReportSchema = z106.object({
4190
- startDate: z106.string(),
4191
- endDate: z106.string(),
4192
- report: z106.string(),
4193
- aiInsights: z106.string().nullable()
4482
+ var weeklyReportSchema = z107.object({
4483
+ startDate: z107.string(),
4484
+ endDate: z107.string(),
4485
+ report: z107.string(),
4486
+ aiInsights: z107.string().nullable()
4194
4487
  });
4195
4488
 
4196
4489
  // ../../b4m-core/packages/services/dist/src/embeddingCacheService/generateCacheKey.js
4197
4490
  import crypto2 from "crypto";
4198
4491
 
4199
4492
  // ../../b4m-core/packages/services/dist/src/researchAgentService/create.js
4200
- import { z as z107 } from "zod";
4201
- var researchAgentCreateSchema = z107.object({
4202
- name: z107.string().min(1),
4203
- description: z107.string().min(1)
4204
- });
4205
-
4206
- // ../../b4m-core/packages/services/dist/src/researchAgentService/update.js
4207
4493
  import { z as z108 } from "zod";
4208
- var researchAgentUpdateSchema = z108.object({
4209
- id: z108.string(),
4494
+ var researchAgentCreateSchema = z108.object({
4210
4495
  name: z108.string().min(1),
4211
4496
  description: z108.string().min(1)
4212
4497
  });
4213
4498
 
4214
- // ../../b4m-core/packages/services/dist/src/researchAgentService/remove.js
4499
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/update.js
4215
4500
  import { z as z109 } from "zod";
4216
- var researchAgentRemoveSchema = z109.object({
4217
- id: z109.string()
4501
+ var researchAgentUpdateSchema = z109.object({
4502
+ id: z109.string(),
4503
+ name: z109.string().min(1),
4504
+ description: z109.string().min(1)
4218
4505
  });
4219
4506
 
4220
- // ../../b4m-core/packages/services/dist/src/researchAgentService/get.js
4507
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/remove.js
4221
4508
  import { z as z110 } from "zod";
4222
- var researchAgentGetSchema = z110.object({
4509
+ var researchAgentRemoveSchema = z110.object({
4223
4510
  id: z110.string()
4224
4511
  });
4225
4512
 
4226
- // ../../b4m-core/packages/services/dist/src/researchAgentService/listFiles.js
4513
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/get.js
4227
4514
  import { z as z111 } from "zod";
4228
- var researchAgentListFilesSchema = z111.object({
4515
+ var researchAgentGetSchema = z111.object({
4516
+ id: z111.string()
4517
+ });
4518
+
4519
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/listFiles.js
4520
+ import { z as z112 } from "zod";
4521
+ var researchAgentListFilesSchema = z112.object({
4229
4522
  /**
4230
4523
  * The ID of the research agent
4231
4524
  */
4232
- id: z111.string()
4525
+ id: z112.string()
4233
4526
  });
4234
4527
 
4235
4528
  // ../../b4m-core/packages/services/dist/src/researchTaskService/process.js
4236
- import { z as z112 } from "zod";
4529
+ import { z as z113 } from "zod";
4237
4530
 
4238
4531
  // ../../b4m-core/packages/services/dist/src/lib/turndown.js
4239
4532
  import turndown from "turndown";
@@ -4624,316 +4917,316 @@ var deepResearchTool = {
4624
4917
  };
4625
4918
 
4626
4919
  // ../../b4m-core/packages/services/dist/src/researchTaskService/process.js
4627
- var ResearchTaskProcessSchema = z112.object({
4628
- id: z112.string()
4920
+ var ResearchTaskProcessSchema = z113.object({
4921
+ id: z113.string()
4629
4922
  });
4630
4923
 
4631
4924
  // ../../b4m-core/packages/services/dist/src/researchTaskService/create.js
4632
- import { z as z113 } from "zod";
4633
- var researchTaskCreateSchema = z113.object({
4634
- researchAgentId: z113.string(),
4635
- title: z113.string().max(100),
4636
- description: z113.string().max(500),
4637
- prompt: z113.string().max(500).optional(),
4638
- type: z113.nativeEnum(ResearchTaskType),
4639
- executionType: z113.nativeEnum(ResearchTaskExecutionType).default(ResearchTaskExecutionType.ON_DEMAND),
4640
- fileTagId: z113.string().optional(),
4641
- autoGeneratedTag: z113.object({
4642
- name: z113.string(),
4643
- icon: z113.string(),
4644
- color: z113.string()
4925
+ import { z as z114 } from "zod";
4926
+ var researchTaskCreateSchema = z114.object({
4927
+ researchAgentId: z114.string(),
4928
+ title: z114.string().max(100),
4929
+ description: z114.string().max(500),
4930
+ prompt: z114.string().max(500).optional(),
4931
+ type: z114.nativeEnum(ResearchTaskType),
4932
+ executionType: z114.nativeEnum(ResearchTaskExecutionType).default(ResearchTaskExecutionType.ON_DEMAND),
4933
+ fileTagId: z114.string().optional(),
4934
+ autoGeneratedTag: z114.object({
4935
+ name: z114.string(),
4936
+ icon: z114.string(),
4937
+ color: z114.string()
4645
4938
  }).optional()
4646
4939
  });
4647
4940
  var researchTaskScrapeCreateSchema = researchTaskCreateSchema.extend({
4648
- urls: z113.array(z113.string().url()).min(1),
4649
- canDiscoverLinks: z113.boolean()
4941
+ urls: z114.array(z114.string().url()).min(1),
4942
+ canDiscoverLinks: z114.boolean()
4650
4943
  });
4651
4944
  var researchTaskPeriodicCreateSchema = researchTaskCreateSchema.extend({
4652
- executionPeriodicStartAt: z113.coerce.date(),
4653
- executionPeriodicEndAt: z113.coerce.date(),
4654
- executionPeriodicFrequency: z113.nativeEnum(ResearchTaskPeriodicFrequencyType)
4945
+ executionPeriodicStartAt: z114.coerce.date(),
4946
+ executionPeriodicEndAt: z114.coerce.date(),
4947
+ executionPeriodicFrequency: z114.nativeEnum(ResearchTaskPeriodicFrequencyType)
4655
4948
  });
4656
4949
  var researchTaskScheduledCreateSchema = researchTaskCreateSchema.extend({
4657
- executionScheduledAt: z113.coerce.date()
4950
+ executionScheduledAt: z114.coerce.date()
4658
4951
  });
4659
4952
  var researchTaskDeepResearchCreateSchema = researchTaskCreateSchema.extend({
4660
- maxDepth: z113.number().min(1).max(10).optional()
4953
+ maxDepth: z114.number().min(1).max(10).optional()
4661
4954
  });
4662
4955
 
4663
4956
  // ../../b4m-core/packages/services/dist/src/researchTaskService/search.js
4664
- import { z as z114 } from "zod";
4665
- var searchResearchTasksSchema = z114.object({
4666
- search: z114.string().optional(),
4957
+ import { z as z115 } from "zod";
4958
+ var searchResearchTasksSchema = z115.object({
4959
+ search: z115.string().optional(),
4667
4960
  // ADD FILTERS SCHEMA HERE
4668
4961
  // filters: z
4669
4962
  // .object({
4670
4963
  // userId: z.string().optional(),
4671
4964
  // })
4672
4965
  // .optional(),
4673
- pagination: z114.object({
4674
- page: z114.coerce.number().optional(),
4675
- limit: z114.coerce.number().optional()
4966
+ pagination: z115.object({
4967
+ page: z115.coerce.number().optional(),
4968
+ limit: z115.coerce.number().optional()
4676
4969
  }).optional(),
4677
- orderBy: z114.object({
4678
- by: z114.enum(["createdAt", "updatedAt"]).optional(),
4679
- direction: z114.enum(["asc", "desc"]).optional()
4970
+ orderBy: z115.object({
4971
+ by: z115.enum(["createdAt", "updatedAt"]).optional(),
4972
+ direction: z115.enum(["asc", "desc"]).optional()
4680
4973
  }).optional()
4681
4974
  });
4682
4975
 
4683
4976
  // ../../b4m-core/packages/services/dist/src/researchTaskService/get.js
4684
- import { z as z115 } from "zod";
4685
- var getResearchTaskSchema = z115.object({
4686
- id: z115.string().min(1)
4977
+ import { z as z116 } from "zod";
4978
+ var getResearchTaskSchema = z116.object({
4979
+ id: z116.string().min(1)
4687
4980
  });
4688
4981
 
4689
4982
  // ../../b4m-core/packages/services/dist/src/researchTaskService/update.js
4690
- import { z as z116 } from "zod";
4691
- var updateResearchTaskSchema = z116.object({
4692
- id: z116.string(),
4693
- title: z116.string(),
4694
- description: z116.string(),
4695
- type: z116.nativeEnum(ResearchTaskType)
4983
+ import { z as z117 } from "zod";
4984
+ var updateResearchTaskSchema = z117.object({
4985
+ id: z117.string(),
4986
+ title: z117.string(),
4987
+ description: z117.string(),
4988
+ type: z117.nativeEnum(ResearchTaskType)
4696
4989
  });
4697
4990
  var researchTaskScrapeUpdateSchema = updateResearchTaskSchema.extend({
4698
- urls: z116.array(z116.string().url()).min(1),
4699
- canDiscoverLinks: z116.boolean()
4991
+ urls: z117.array(z117.string().url()).min(1),
4992
+ canDiscoverLinks: z117.boolean()
4700
4993
  });
4701
4994
 
4702
4995
  // ../../b4m-core/packages/services/dist/src/researchTaskService/listByAgentId.js
4703
- import { z as z117 } from "zod";
4704
- var listByAgentIdSchema = z117.object({
4705
- researchAgentId: z117.string()
4996
+ import { z as z118 } from "zod";
4997
+ var listByAgentIdSchema = z118.object({
4998
+ researchAgentId: z118.string()
4706
4999
  });
4707
5000
 
4708
5001
  // ../../b4m-core/packages/services/dist/src/researchTaskService/remove.js
4709
- import { z as z118 } from "zod";
4710
- var researchTaskRemoveSchema = z118.object({
4711
- id: z118.string().min(1)
5002
+ import { z as z119 } from "zod";
5003
+ var researchTaskRemoveSchema = z119.object({
5004
+ id: z119.string().min(1)
4712
5005
  });
4713
5006
 
4714
5007
  // ../../b4m-core/packages/services/dist/src/researchTaskService/retry.js
4715
- import { z as z119 } from "zod";
4716
- var researchTaskRetrySchema = z119.object({
4717
- id: z119.string(),
4718
- userId: z119.string()
5008
+ import { z as z120 } from "zod";
5009
+ var researchTaskRetrySchema = z120.object({
5010
+ id: z120.string(),
5011
+ userId: z120.string()
4719
5012
  });
4720
5013
 
4721
5014
  // ../../b4m-core/packages/services/dist/src/researchTaskService/processDiscoveredLinks.js
4722
5015
  import axios4 from "axios";
4723
- import { z as z120 } from "zod";
5016
+ import { z as z121 } from "zod";
4724
5017
  import plimit from "p-limit";
4725
5018
  import pLimit2 from "p-limit";
4726
- var researchTaskProcessDiscoveredLinksSchema = z120.object({
4727
- id: z120.string()
5019
+ var researchTaskProcessDiscoveredLinksSchema = z121.object({
5020
+ id: z121.string()
4728
5021
  });
4729
5022
 
4730
5023
  // ../../b4m-core/packages/services/dist/src/researchTaskService/downloadRelevantLinks.js
4731
- import { z as z121 } from "zod";
5024
+ import { z as z122 } from "zod";
4732
5025
  import plimit2 from "p-limit";
4733
5026
  import axios5 from "axios";
4734
5027
  import { fileTypeFromBuffer } from "file-type";
4735
- var researchTaskDownloadRelevantLinksSchema = z121.object({
4736
- id: z121.string()
5028
+ var researchTaskDownloadRelevantLinksSchema = z122.object({
5029
+ id: z122.string()
4737
5030
  });
4738
5031
 
4739
5032
  // ../../b4m-core/packages/services/dist/src/researchData/remove.js
4740
- import { z as z122 } from "zod";
4741
- var researchDataRemoveSchema = z122.object({
4742
- id: z122.string(),
4743
- researchAgentId: z122.string()
5033
+ import { z as z123 } from "zod";
5034
+ var researchDataRemoveSchema = z123.object({
5035
+ id: z123.string(),
5036
+ researchAgentId: z123.string()
4744
5037
  });
4745
5038
 
4746
5039
  // ../../b4m-core/packages/services/dist/src/taskSchedulerService/create.js
4747
- import { z as z123 } from "zod";
4748
- var researchTaskPayload = z123.object({
4749
- id: z123.string(),
4750
- userId: z123.string()
5040
+ import { z as z124 } from "zod";
5041
+ var researchTaskPayload = z124.object({
5042
+ id: z124.string(),
5043
+ userId: z124.string()
4751
5044
  });
4752
- var customTaskPayload = z123.object({
4753
- test: z123.string()
5045
+ var customTaskPayload = z124.object({
5046
+ test: z124.string()
4754
5047
  });
4755
- var taskSchedulerCreate = z123.discriminatedUnion("handler", [
4756
- z123.object({
4757
- handler: z123.literal(TaskScheduleHandler.RESEARCH_TASK_PROCESS),
5048
+ var taskSchedulerCreate = z124.discriminatedUnion("handler", [
5049
+ z124.object({
5050
+ handler: z124.literal(TaskScheduleHandler.RESEARCH_TASK_PROCESS),
4758
5051
  payload: researchTaskPayload,
4759
- processDate: z123.date()
5052
+ processDate: z124.date()
4760
5053
  }),
4761
- z123.object({
4762
- handler: z123.literal(TaskScheduleHandler.CUSTOM_TASK_PROCESS),
5054
+ z124.object({
5055
+ handler: z124.literal(TaskScheduleHandler.CUSTOM_TASK_PROCESS),
4763
5056
  payload: customTaskPayload,
4764
- processDate: z123.date()
5057
+ processDate: z124.date()
4765
5058
  })
4766
5059
  ]);
4767
5060
 
4768
- // ../../b4m-core/packages/services/dist/src/tagService/createFileTag.js
4769
- import { z as z124 } from "zod";
4770
- var tagCreateFileTagSchema = z124.object({
4771
- name: z124.string(),
4772
- icon: z124.string().optional(),
4773
- color: z124.string().optional(),
4774
- description: z124.string().optional()
4775
- });
4776
-
4777
- // ../../b4m-core/packages/services/dist/src/tagService/create.js
5061
+ // ../../b4m-core/packages/services/dist/src/tagService/createFileTag.js
4778
5062
  import { z as z125 } from "zod";
4779
- var tagCreateSchema = z125.object({
5063
+ var tagCreateFileTagSchema = z125.object({
4780
5064
  name: z125.string(),
4781
5065
  icon: z125.string().optional(),
4782
- description: z125.string().optional(),
4783
5066
  color: z125.string().optional(),
4784
- type: z125.nativeEnum(TagType)
5067
+ description: z125.string().optional()
4785
5068
  });
4786
5069
 
4787
- // ../../b4m-core/packages/services/dist/src/tagService/update.js
5070
+ // ../../b4m-core/packages/services/dist/src/tagService/create.js
4788
5071
  import { z as z126 } from "zod";
4789
- var tagUpdateSchema = z126.object({
4790
- id: z126.string(),
4791
- name: z126.string().optional(),
5072
+ var tagCreateSchema = z126.object({
5073
+ name: z126.string(),
4792
5074
  icon: z126.string().optional(),
4793
5075
  description: z126.string().optional(),
4794
- color: z126.string().optional()
5076
+ color: z126.string().optional(),
5077
+ type: z126.nativeEnum(TagType)
4795
5078
  });
4796
5079
 
4797
- // ../../b4m-core/packages/services/dist/src/tagService/remove.js
5080
+ // ../../b4m-core/packages/services/dist/src/tagService/update.js
4798
5081
  import { z as z127 } from "zod";
4799
- var tagRemoveSchema = z127.object({
4800
- id: z127.string()
5082
+ var tagUpdateSchema = z127.object({
5083
+ id: z127.string(),
5084
+ name: z127.string().optional(),
5085
+ icon: z127.string().optional(),
5086
+ description: z127.string().optional(),
5087
+ color: z127.string().optional()
4801
5088
  });
4802
5089
 
4803
- // ../../b4m-core/packages/services/dist/src/artifactService/create.js
5090
+ // ../../b4m-core/packages/services/dist/src/tagService/remove.js
4804
5091
  import { z as z128 } from "zod";
4805
- var createArtifactSchema = z128.object({
4806
- id: z128.string().optional(),
5092
+ var tagRemoveSchema = z128.object({
5093
+ id: z128.string()
5094
+ });
5095
+
5096
+ // ../../b4m-core/packages/services/dist/src/artifactService/create.js
5097
+ import { z as z129 } from "zod";
5098
+ var createArtifactSchema = z129.object({
5099
+ id: z129.string().optional(),
4807
5100
  // Allow custom ID for AI-generated artifacts
4808
- type: z128.enum(["mermaid", "recharts", "python", "react", "html", "svg", "code", "quest", "file", "questmaster"]),
4809
- title: z128.string().min(1).max(255),
4810
- description: z128.string().max(1e3).optional(),
4811
- content: z128.string().min(1),
4812
- projectId: z128.string().optional(),
4813
- organizationId: z128.string().optional(),
4814
- visibility: z128.enum(["private", "project", "organization", "public"]).default("private"),
4815
- tags: z128.array(z128.string().max(50)).max(20).default([]),
4816
- versionTag: z128.string().max(100).optional(),
4817
- sourceQuestId: z128.string().optional(),
4818
- sessionId: z128.string().optional(),
4819
- parentArtifactId: z128.string().optional(),
4820
- permissions: z128.object({
4821
- canRead: z128.array(z128.string()).default([]),
4822
- canWrite: z128.array(z128.string()).default([]),
4823
- canDelete: z128.array(z128.string()).default([]),
4824
- isPublic: z128.boolean().default(false),
4825
- inheritFromProject: z128.boolean().default(true)
5101
+ type: z129.enum(["mermaid", "recharts", "python", "react", "html", "svg", "code", "quest", "file", "questmaster"]),
5102
+ title: z129.string().min(1).max(255),
5103
+ description: z129.string().max(1e3).optional(),
5104
+ content: z129.string().min(1),
5105
+ projectId: z129.string().optional(),
5106
+ organizationId: z129.string().optional(),
5107
+ visibility: z129.enum(["private", "project", "organization", "public"]).default("private"),
5108
+ tags: z129.array(z129.string().max(50)).max(20).default([]),
5109
+ versionTag: z129.string().max(100).optional(),
5110
+ sourceQuestId: z129.string().optional(),
5111
+ sessionId: z129.string().optional(),
5112
+ parentArtifactId: z129.string().optional(),
5113
+ permissions: z129.object({
5114
+ canRead: z129.array(z129.string()).default([]),
5115
+ canWrite: z129.array(z129.string()).default([]),
5116
+ canDelete: z129.array(z129.string()).default([]),
5117
+ isPublic: z129.boolean().default(false),
5118
+ inheritFromProject: z129.boolean().default(true)
4826
5119
  }).optional(),
4827
- metadata: z128.record(z128.unknown()).default({})
5120
+ metadata: z129.record(z129.unknown()).default({})
4828
5121
  });
4829
5122
 
4830
5123
  // ../../b4m-core/packages/services/dist/src/artifactService/get.js
4831
- import { z as z129 } from "zod";
4832
- var getArtifactSchema = z129.object({
4833
- id: z129.string(),
4834
- includeContent: z129.boolean().default(false),
4835
- includeVersions: z129.boolean().default(false),
4836
- version: z129.number().optional()
5124
+ import { z as z130 } from "zod";
5125
+ var getArtifactSchema = z130.object({
5126
+ id: z130.string(),
5127
+ includeContent: z130.boolean().default(false),
5128
+ includeVersions: z130.boolean().default(false),
5129
+ version: z130.number().optional()
4837
5130
  });
4838
5131
 
4839
5132
  // ../../b4m-core/packages/services/dist/src/artifactService/list.js
4840
- import { z as z130 } from "zod";
4841
- var listArtifactsSchema = z130.object({
4842
- type: z130.string().optional(),
4843
- status: z130.enum(["draft", "review", "published", "archived"]).optional(),
4844
- visibility: z130.enum(["private", "project", "organization", "public"]).optional(),
4845
- projectId: z130.string().optional(),
4846
- sessionId: z130.string().optional(),
4847
- tags: z130.array(z130.string()).optional(),
4848
- search: z130.string().optional(),
4849
- limit: z130.number().min(1).max(100).default(20),
4850
- offset: z130.number().min(0).default(0),
4851
- sortBy: z130.enum(["createdAt", "updatedAt", "title", "type"]).default("updatedAt"),
4852
- sortOrder: z130.enum(["asc", "desc"]).default("desc"),
4853
- includeDeleted: z130.boolean().default(false)
5133
+ import { z as z131 } from "zod";
5134
+ var listArtifactsSchema = z131.object({
5135
+ type: z131.string().optional(),
5136
+ status: z131.enum(["draft", "review", "published", "archived"]).optional(),
5137
+ visibility: z131.enum(["private", "project", "organization", "public"]).optional(),
5138
+ projectId: z131.string().optional(),
5139
+ sessionId: z131.string().optional(),
5140
+ tags: z131.array(z131.string()).optional(),
5141
+ search: z131.string().optional(),
5142
+ limit: z131.number().min(1).max(100).default(20),
5143
+ offset: z131.number().min(0).default(0),
5144
+ sortBy: z131.enum(["createdAt", "updatedAt", "title", "type"]).default("updatedAt"),
5145
+ sortOrder: z131.enum(["asc", "desc"]).default("desc"),
5146
+ includeDeleted: z131.boolean().default(false)
4854
5147
  });
4855
5148
 
4856
5149
  // ../../b4m-core/packages/services/dist/src/artifactService/update.js
4857
- import { z as z131 } from "zod";
4858
- var updateArtifactSchema = z131.object({
4859
- id: z131.string(),
4860
- title: z131.string().min(1).max(255).optional(),
4861
- description: z131.string().max(1e3).optional(),
4862
- content: z131.string().optional(),
4863
- visibility: z131.enum(["private", "project", "organization", "public"]).optional(),
4864
- status: z131.enum(["draft", "review", "published", "archived"]).optional(),
4865
- tags: z131.array(z131.string().max(50)).max(20).optional(),
4866
- versionTag: z131.string().max(100).optional(),
4867
- permissions: z131.object({
4868
- canRead: z131.array(z131.string()).optional(),
4869
- canWrite: z131.array(z131.string()).optional(),
4870
- canDelete: z131.array(z131.string()).optional(),
4871
- isPublic: z131.boolean().optional(),
4872
- inheritFromProject: z131.boolean().optional()
5150
+ import { z as z132 } from "zod";
5151
+ var updateArtifactSchema = z132.object({
5152
+ id: z132.string(),
5153
+ title: z132.string().min(1).max(255).optional(),
5154
+ description: z132.string().max(1e3).optional(),
5155
+ content: z132.string().optional(),
5156
+ visibility: z132.enum(["private", "project", "organization", "public"]).optional(),
5157
+ status: z132.enum(["draft", "review", "published", "archived"]).optional(),
5158
+ tags: z132.array(z132.string().max(50)).max(20).optional(),
5159
+ versionTag: z132.string().max(100).optional(),
5160
+ permissions: z132.object({
5161
+ canRead: z132.array(z132.string()).optional(),
5162
+ canWrite: z132.array(z132.string()).optional(),
5163
+ canDelete: z132.array(z132.string()).optional(),
5164
+ isPublic: z132.boolean().optional(),
5165
+ inheritFromProject: z132.boolean().optional()
4873
5166
  }).optional(),
4874
- metadata: z131.record(z131.unknown()).optional(),
4875
- changes: z131.array(z131.string()).optional(),
4876
- changeDescription: z131.string().max(1e3).optional(),
4877
- createNewVersion: z131.boolean().optional(),
4878
- versionMessage: z131.string().max(500).optional()
5167
+ metadata: z132.record(z132.unknown()).optional(),
5168
+ changes: z132.array(z132.string()).optional(),
5169
+ changeDescription: z132.string().max(1e3).optional(),
5170
+ createNewVersion: z132.boolean().optional(),
5171
+ versionMessage: z132.string().max(500).optional()
4879
5172
  });
4880
5173
 
4881
5174
  // ../../b4m-core/packages/services/dist/src/artifactService/delete.js
4882
- import { z as z132 } from "zod";
4883
- var deleteArtifactSchema = z132.object({
4884
- id: z132.string(),
4885
- hardDelete: z132.boolean().default(false)
5175
+ import { z as z133 } from "zod";
5176
+ var deleteArtifactSchema = z133.object({
5177
+ id: z133.string(),
5178
+ hardDelete: z133.boolean().default(false)
4886
5179
  // For future implementation
4887
5180
  });
4888
5181
 
4889
5182
  // ../../b4m-core/packages/services/dist/src/questMasterService/create.js
4890
- import { z as z133 } from "zod";
4891
- var questSchema = z133.object({
4892
- id: z133.string(),
4893
- title: z133.string().min(1).max(255),
4894
- description: z133.string().max(1e3),
4895
- status: z133.enum(["not_started", "in_progress", "completed", "blocked"]).default("not_started"),
4896
- order: z133.number().min(0),
4897
- dependencies: z133.array(z133.string()).default([]),
4898
- estimatedTime: z133.string().optional()
4899
- });
4900
- var questResourceSchema = z133.object({
4901
- title: z133.string().min(1).max(255),
4902
- url: z133.string().url(),
4903
- type: z133.enum(["documentation", "tutorial", "reference", "example"])
4904
- });
4905
- var createQuestMasterSchema = z133.object({
4906
- title: z133.string().min(1).max(255),
4907
- description: z133.string().max(1e3).optional(),
4908
- goal: z133.string().min(1).max(1e3),
4909
- complexity: z133.enum(["beginner", "intermediate", "advanced", "expert"]),
4910
- estimatedTotalTime: z133.string().optional(),
4911
- prerequisites: z133.array(z133.string().max(200)).default([]),
4912
- quests: z133.array(questSchema).min(1),
4913
- resources: z133.array(questResourceSchema).default([]),
4914
- projectId: z133.string().optional(),
4915
- organizationId: z133.string().optional(),
4916
- visibility: z133.enum(["private", "project", "organization", "public"]).default("private"),
4917
- tags: z133.array(z133.string().max(50)).max(20).default([]),
4918
- permissions: z133.object({
4919
- canRead: z133.array(z133.string()).default([]),
4920
- canWrite: z133.array(z133.string()).default([]),
4921
- canDelete: z133.array(z133.string()).default([]),
4922
- isPublic: z133.boolean().default(false),
4923
- inheritFromProject: z133.boolean().default(true)
5183
+ import { z as z134 } from "zod";
5184
+ var questSchema = z134.object({
5185
+ id: z134.string(),
5186
+ title: z134.string().min(1).max(255),
5187
+ description: z134.string().max(1e3),
5188
+ status: z134.enum(["not_started", "in_progress", "completed", "blocked"]).default("not_started"),
5189
+ order: z134.number().min(0),
5190
+ dependencies: z134.array(z134.string()).default([]),
5191
+ estimatedTime: z134.string().optional()
5192
+ });
5193
+ var questResourceSchema = z134.object({
5194
+ title: z134.string().min(1).max(255),
5195
+ url: z134.string().url(),
5196
+ type: z134.enum(["documentation", "tutorial", "reference", "example"])
5197
+ });
5198
+ var createQuestMasterSchema = z134.object({
5199
+ title: z134.string().min(1).max(255),
5200
+ description: z134.string().max(1e3).optional(),
5201
+ goal: z134.string().min(1).max(1e3),
5202
+ complexity: z134.enum(["beginner", "intermediate", "advanced", "expert"]),
5203
+ estimatedTotalTime: z134.string().optional(),
5204
+ prerequisites: z134.array(z134.string().max(200)).default([]),
5205
+ quests: z134.array(questSchema).min(1),
5206
+ resources: z134.array(questResourceSchema).default([]),
5207
+ projectId: z134.string().optional(),
5208
+ organizationId: z134.string().optional(),
5209
+ visibility: z134.enum(["private", "project", "organization", "public"]).default("private"),
5210
+ tags: z134.array(z134.string().max(50)).max(20).default([]),
5211
+ permissions: z134.object({
5212
+ canRead: z134.array(z134.string()).default([]),
5213
+ canWrite: z134.array(z134.string()).default([]),
5214
+ canDelete: z134.array(z134.string()).default([]),
5215
+ isPublic: z134.boolean().default(false),
5216
+ inheritFromProject: z134.boolean().default(true)
4924
5217
  }).optional(),
4925
- sourceQuestId: z133.string().optional(),
4926
- sessionId: z133.string().optional(),
4927
- metadata: z133.record(z133.unknown()).default({})
5218
+ sourceQuestId: z134.string().optional(),
5219
+ sessionId: z134.string().optional(),
5220
+ metadata: z134.record(z134.unknown()).default({})
4928
5221
  });
4929
5222
 
4930
5223
  // ../../b4m-core/packages/services/dist/src/questMasterService/updateQuestStatus.js
4931
- import { z as z134 } from "zod";
4932
- var updateQuestStatusSchema = z134.object({
4933
- artifactId: z134.string(),
4934
- questId: z134.string(),
4935
- status: z134.enum(["not_started", "in_progress", "completed", "blocked"]),
4936
- completionNote: z134.string().max(500).optional()
5224
+ import { z as z135 } from "zod";
5225
+ var updateQuestStatusSchema = z135.object({
5226
+ artifactId: z135.string(),
5227
+ questId: z135.string(),
5228
+ status: z135.enum(["not_started", "in_progress", "completed", "blocked"]),
5229
+ completionNote: z135.string().max(500).optional()
4937
5230
  });
4938
5231
 
4939
5232
  // ../../b4m-core/packages/services/dist/src/dataLakeService/opensearchClient.js
@@ -4953,63 +5246,63 @@ import { v4 as uuidv44 } from "uuid";
4953
5246
  import { randomUUID as randomUUID5 } from "crypto";
4954
5247
 
4955
5248
  // ../../b4m-core/packages/services/dist/src/emailIngestionService/types.js
4956
- import { z as z135 } from "zod";
4957
- var processIngestedEmailOptionsSchema = z135.object({
4958
- platformDomain: z135.string().optional(),
4959
- isNewsletter: z135.boolean().optional()
5249
+ import { z as z136 } from "zod";
5250
+ var processIngestedEmailOptionsSchema = z136.object({
5251
+ platformDomain: z136.string().optional(),
5252
+ isNewsletter: z136.boolean().optional()
4960
5253
  }).optional();
4961
- var emailAttachmentSchema = z135.object({
4962
- filename: z135.string().optional(),
4963
- contentType: z135.string().optional(),
4964
- contentDisposition: z135.string().optional(),
4965
- size: z135.number().min(0),
4966
- content: z135.instanceof(Buffer),
4967
- related: z135.boolean().optional()
4968
- });
4969
- var parsedEmailObjectSchema = z135.object({
4970
- messageId: z135.string().optional(),
4971
- inReplyTo: z135.string().optional(),
4972
- references: z135.union([z135.string(), z135.array(z135.string())]).optional(),
4973
- from: z135.any().optional(),
5254
+ var emailAttachmentSchema = z136.object({
5255
+ filename: z136.string().optional(),
5256
+ contentType: z136.string().optional(),
5257
+ contentDisposition: z136.string().optional(),
5258
+ size: z136.number().min(0),
5259
+ content: z136.instanceof(Buffer),
5260
+ related: z136.boolean().optional()
5261
+ });
5262
+ var parsedEmailObjectSchema = z136.object({
5263
+ messageId: z136.string().optional(),
5264
+ inReplyTo: z136.string().optional(),
5265
+ references: z136.union([z136.string(), z136.array(z136.string())]).optional(),
5266
+ from: z136.any().optional(),
4974
5267
  // Complex email address object
4975
- to: z135.any().optional(),
4976
- cc: z135.any().optional(),
4977
- bcc: z135.any().optional(),
4978
- subject: z135.string().optional(),
4979
- date: z135.date().optional(),
4980
- text: z135.string().optional(),
4981
- html: z135.string().optional(),
4982
- attachments: z135.array(emailAttachmentSchema).optional()
4983
- });
4984
- var processIngestedEmailSchema = z135.object({
5268
+ to: z136.any().optional(),
5269
+ cc: z136.any().optional(),
5270
+ bcc: z136.any().optional(),
5271
+ subject: z136.string().optional(),
5272
+ date: z136.date().optional(),
5273
+ text: z136.string().optional(),
5274
+ html: z136.string().optional(),
5275
+ attachments: z136.array(emailAttachmentSchema).optional()
5276
+ });
5277
+ var processIngestedEmailSchema = z136.object({
4985
5278
  parsedEmail: parsedEmailObjectSchema,
4986
- rawEmailS3Key: z135.string().min(1, "rawEmailS3Key cannot be empty"),
5279
+ rawEmailS3Key: z136.string().min(1, "rawEmailS3Key cannot be empty"),
4987
5280
  options: processIngestedEmailOptionsSchema
4988
5281
  });
4989
5282
 
4990
5283
  // ../../b4m-core/packages/services/dist/src/emailAnalysisService/types.js
4991
- import { z as z136 } from "zod";
4992
- var llmAnalysisResponseSchema = z136.object({
4993
- summary: z136.string().min(1, "Summary cannot be empty"),
4994
- entities: z136.object({
4995
- companies: z136.array(z136.string()).default([]),
4996
- people: z136.array(z136.string()).default([]),
4997
- products: z136.array(z136.string()).default([]),
4998
- technologies: z136.array(z136.string()).default([])
5284
+ import { z as z137 } from "zod";
5285
+ var llmAnalysisResponseSchema = z137.object({
5286
+ summary: z137.string().min(1, "Summary cannot be empty"),
5287
+ entities: z137.object({
5288
+ companies: z137.array(z137.string()).default([]),
5289
+ people: z137.array(z137.string()).default([]),
5290
+ products: z137.array(z137.string()).default([]),
5291
+ technologies: z137.array(z137.string()).default([])
4999
5292
  }),
5000
- sentiment: z136.enum(["positive", "neutral", "negative", "urgent"]),
5001
- actionItems: z136.array(z136.object({
5002
- description: z136.string(),
5003
- deadline: z136.string().optional()
5293
+ sentiment: z137.enum(["positive", "neutral", "negative", "urgent"]),
5294
+ actionItems: z137.array(z137.object({
5295
+ description: z137.string(),
5296
+ deadline: z137.string().optional()
5004
5297
  // ISO date string from LLM
5005
5298
  })).default([]),
5006
- privacyRecommendation: z136.enum(["public", "team", "private"]),
5007
- embargoDetected: z136.boolean().default(false),
5008
- suggestedTags: z136.array(z136.string()).default([])
5299
+ privacyRecommendation: z137.enum(["public", "team", "private"]),
5300
+ embargoDetected: z137.boolean().default(false),
5301
+ suggestedTags: z137.array(z137.string()).default([])
5009
5302
  });
5010
5303
 
5011
5304
  // ../../b4m-core/packages/services/dist/src/llm/ChatCompletion.js
5012
- import { z as z138 } from "zod";
5305
+ import { z as z139 } from "zod";
5013
5306
 
5014
5307
  // ../../b4m-core/packages/services/dist/src/llm/ChatCompletionInvoke.js
5015
5308
  import { fromZodError } from "zod-validation-error";
@@ -5123,8 +5416,8 @@ async function processAndStoreImages(images, context) {
5123
5416
  const buffer = await downloadImage(image);
5124
5417
  const fileType = await fileTypeFromBuffer2(buffer);
5125
5418
  const filename = `${uuidv45()}.${fileType?.ext}`;
5126
- const path15 = await context.imageGenerateStorage.upload(buffer, filename, {});
5127
- return path15;
5419
+ const path16 = await context.imageGenerateStorage.upload(buffer, filename, {});
5420
+ return path16;
5128
5421
  }));
5129
5422
  }
5130
5423
  async function updateQuestAndReturnMarkdown(storedImageUrls, context) {
@@ -6097,17 +6390,17 @@ var rechartsTool = {
6097
6390
  };
6098
6391
 
6099
6392
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/editFile/index.js
6100
- import { z as z137 } from "zod";
6393
+ import { z as z138 } from "zod";
6101
6394
  import { diffLines as diffLines2 } from "diff";
6102
- var editFileSchema = z137.object({
6103
- fileId: z137.string().describe("The ID of the file to edit"),
6104
- instruction: z137.string().describe("Natural language instruction describing the changes to make"),
6105
- selection: z137.object({
6106
- start: z137.number().describe("Starting character position of the selection"),
6107
- end: z137.number().describe("Ending character position of the selection")
6395
+ var editFileSchema = z138.object({
6396
+ fileId: z138.string().describe("The ID of the file to edit"),
6397
+ instruction: z138.string().describe("Natural language instruction describing the changes to make"),
6398
+ selection: z138.object({
6399
+ start: z138.number().describe("Starting character position of the selection"),
6400
+ end: z138.number().describe("Ending character position of the selection")
6108
6401
  }).optional().describe("Optional selection range to edit within the file"),
6109
- preserveFormatting: z137.boolean().optional().default(true).describe("Whether to preserve the original formatting style"),
6110
- returnDiff: z137.boolean().optional().default(true).describe("Whether to return a diff of the changes")
6402
+ preserveFormatting: z138.boolean().optional().default(true).describe("Whether to preserve the original formatting style"),
6403
+ returnDiff: z138.boolean().optional().default(true).describe("Whether to return a diff of the changes")
6111
6404
  });
6112
6405
  function generateSimpleDiff(original, modified) {
6113
6406
  const differences = diffLines2(original, modified);
@@ -6336,8 +6629,8 @@ async function processAndStoreImage(imageUrl, context) {
6336
6629
  const buffer = await downloadImage2(imageUrl);
6337
6630
  const fileType = await fileTypeFromBuffer3(buffer);
6338
6631
  const filename = `${uuidv46()}.${fileType?.ext}`;
6339
- const path15 = await context.imageGenerateStorage.upload(buffer, filename, {});
6340
- return path15;
6632
+ const path16 = await context.imageGenerateStorage.upload(buffer, filename, {});
6633
+ return path16;
6341
6634
  }
6342
6635
  async function updateQuestAndReturnMarkdown2(storedImagePath, context) {
6343
6636
  await context.onFinish?.("edit_image", storedImagePath);
@@ -7866,8 +8159,8 @@ var getHeliocentricCoords = (planet, T) => {
7866
8159
  const sinNode = Math.sin(longNode);
7867
8160
  const x = r * (cosNode * cosOmega - sinNode * sinOmega * cosI);
7868
8161
  const y = r * (sinNode * cosOmega + cosNode * sinOmega * cosI);
7869
- const z144 = r * sinOmega * sinI;
7870
- return { x, y, z: z144, r };
8162
+ const z145 = r * sinOmega * sinI;
8163
+ return { x, y, z: z145, r };
7871
8164
  };
7872
8165
  var getGeocentricEcliptic = (planet, earth) => {
7873
8166
  const dx = planet.x - earth.x;
@@ -8174,15 +8467,15 @@ var planetVisibilityTool = {
8174
8467
  };
8175
8468
 
8176
8469
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/fileRead/index.js
8177
- import { promises as fs7 } from "fs";
8470
+ import { promises as fs8 } from "fs";
8178
8471
  import { existsSync as existsSync4, statSync as statSync4 } from "fs";
8179
- import path6 from "path";
8472
+ import path7 from "path";
8180
8473
  var MAX_FILE_SIZE2 = 10 * 1024 * 1024;
8181
8474
  async function readFileContent(params) {
8182
8475
  const { path: filePath, encoding = "utf-8", maxLines } = params;
8183
- const normalizedPath = path6.normalize(filePath);
8184
- const resolvedPath = path6.resolve(process.cwd(), normalizedPath);
8185
- const cwd = path6.resolve(process.cwd());
8476
+ const normalizedPath = path7.normalize(filePath);
8477
+ const resolvedPath = path7.resolve(process.cwd(), normalizedPath);
8478
+ const cwd = path7.resolve(process.cwd());
8186
8479
  if (!resolvedPath.startsWith(cwd)) {
8187
8480
  throw new Error(`Access denied: Cannot read files outside of current working directory`);
8188
8481
  }
@@ -8200,7 +8493,7 @@ async function readFileContent(params) {
8200
8493
  if (isBinary && encoding === "utf-8") {
8201
8494
  throw new Error(`File appears to be binary. Use encoding 'base64' to read binary files, or specify a different encoding.`);
8202
8495
  }
8203
- const content = await fs7.readFile(resolvedPath, encoding);
8496
+ const content = await fs8.readFile(resolvedPath, encoding);
8204
8497
  if (maxLines && typeof content === "string") {
8205
8498
  const lines = content.split("\n");
8206
8499
  if (lines.length > maxLines) {
@@ -8215,7 +8508,7 @@ ${content}`;
8215
8508
  }
8216
8509
  async function checkIfBinary(filePath) {
8217
8510
  const buffer = Buffer.alloc(8192);
8218
- const fd = await fs7.open(filePath, "r");
8511
+ const fd = await fs8.open(filePath, "r");
8219
8512
  try {
8220
8513
  const { bytesRead } = await fd.read(buffer, 0, 8192, 0);
8221
8514
  const chunk = buffer.slice(0, bytesRead);
@@ -8232,7 +8525,7 @@ var fileReadTool = {
8232
8525
  context.logger.info("\u{1F4C4} FileRead: Reading file", { path: params.path });
8233
8526
  try {
8234
8527
  const content = await readFileContent(params);
8235
- const stats = statSync4(path6.resolve(process.cwd(), path6.normalize(params.path)));
8528
+ const stats = statSync4(path7.resolve(process.cwd(), path7.normalize(params.path)));
8236
8529
  context.logger.info("\u2705 FileRead: Success", {
8237
8530
  path: params.path,
8238
8531
  size: stats.size,
@@ -8271,25 +8564,25 @@ var fileReadTool = {
8271
8564
  };
8272
8565
 
8273
8566
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/createFile/index.js
8274
- import { promises as fs8 } from "fs";
8567
+ import { promises as fs9 } from "fs";
8275
8568
  import { existsSync as existsSync5 } from "fs";
8276
- import path7 from "path";
8569
+ import path8 from "path";
8277
8570
  async function createFile(params) {
8278
8571
  const { path: filePath, content, createDirectories = true } = params;
8279
- const normalizedPath = path7.normalize(filePath);
8280
- const resolvedPath = path7.resolve(process.cwd(), normalizedPath);
8281
- const cwd = path7.resolve(process.cwd());
8572
+ const normalizedPath = path8.normalize(filePath);
8573
+ const resolvedPath = path8.resolve(process.cwd(), normalizedPath);
8574
+ const cwd = path8.resolve(process.cwd());
8282
8575
  if (!resolvedPath.startsWith(cwd)) {
8283
8576
  throw new Error(`Access denied: Cannot create files outside of current working directory`);
8284
8577
  }
8285
8578
  const fileExists = existsSync5(resolvedPath);
8286
8579
  const action = fileExists ? "overwritten" : "created";
8287
8580
  if (createDirectories) {
8288
- const dir = path7.dirname(resolvedPath);
8289
- await fs8.mkdir(dir, { recursive: true });
8581
+ const dir = path8.dirname(resolvedPath);
8582
+ await fs9.mkdir(dir, { recursive: true });
8290
8583
  }
8291
- await fs8.writeFile(resolvedPath, content, "utf-8");
8292
- const stats = await fs8.stat(resolvedPath);
8584
+ await fs9.writeFile(resolvedPath, content, "utf-8");
8585
+ const stats = await fs9.stat(resolvedPath);
8293
8586
  const lines = content.split("\n").length;
8294
8587
  return `File ${action} successfully: ${filePath}
8295
8588
  Size: ${stats.size} bytes
@@ -8300,7 +8593,7 @@ var createFileTool = {
8300
8593
  implementation: (context) => ({
8301
8594
  toolFn: async (value) => {
8302
8595
  const params = value;
8303
- const fileExists = existsSync5(path7.resolve(process.cwd(), path7.normalize(params.path)));
8596
+ const fileExists = existsSync5(path8.resolve(process.cwd(), path8.normalize(params.path)));
8304
8597
  context.logger.info(`\u{1F4DD} CreateFile: ${fileExists ? "Overwriting" : "Creating"} file`, {
8305
8598
  path: params.path,
8306
8599
  size: params.content.length
@@ -8342,7 +8635,7 @@ var createFileTool = {
8342
8635
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/globFiles/index.js
8343
8636
  import { readdir } from "fs/promises";
8344
8637
  import { statSync as statSync5 } from "fs";
8345
- import path8 from "path";
8638
+ import path9 from "path";
8346
8639
  function matchGlob(filePath, pattern) {
8347
8640
  let regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (_, options) => `(${options.split(",").join("|")})`).replace(/\[([^\]]+)\]/g, "[$1]");
8348
8641
  regexPattern = regexPattern.replace(/\{\{GLOBSTAR\}\}\//g, "(.*/)?").replace(/\/\{\{GLOBSTAR\}\}/g, "(/.*)?").replace(/\{\{GLOBSTAR\}\}/g, ".*");
@@ -8360,8 +8653,8 @@ async function walkDir(dir, pattern, includeHidden, maxResults, basePath = "") {
8360
8653
  if (!includeHidden && entry.name.startsWith(".")) {
8361
8654
  continue;
8362
8655
  }
8363
- const relativePath = basePath ? path8.join(basePath, entry.name) : entry.name;
8364
- const fullPath = path8.join(dir, entry.name);
8656
+ const relativePath = basePath ? path9.join(basePath, entry.name) : entry.name;
8657
+ const fullPath = path9.join(dir, entry.name);
8365
8658
  if (matchGlob(relativePath, pattern)) {
8366
8659
  matches.push(relativePath);
8367
8660
  }
@@ -8377,7 +8670,7 @@ async function walkDir(dir, pattern, includeHidden, maxResults, basePath = "") {
8377
8670
  async function listFiles(params) {
8378
8671
  const { pattern, cwd: relativeCwd, includeHidden = false, maxResults = 1e3 } = params;
8379
8672
  const baseCwd = process.cwd();
8380
- const targetCwd = relativeCwd ? path8.resolve(baseCwd, path8.normalize(relativeCwd)) : baseCwd;
8673
+ const targetCwd = relativeCwd ? path9.resolve(baseCwd, path9.normalize(relativeCwd)) : baseCwd;
8381
8674
  if (!targetCwd.startsWith(baseCwd)) {
8382
8675
  throw new Error(`Access denied: Cannot list files outside of current working directory`);
8383
8676
  }
@@ -8388,7 +8681,7 @@ async function listFiles(params) {
8388
8681
  const filesInfo = [];
8389
8682
  for (const match of matches) {
8390
8683
  try {
8391
- const fullPath = path8.join(targetCwd, match);
8684
+ const fullPath = path9.join(targetCwd, match);
8392
8685
  const stats = statSync5(fullPath);
8393
8686
  filesInfo.push({
8394
8687
  path: match,
@@ -8471,7 +8764,7 @@ var globFilesTool = {
8471
8764
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/grepSearch/index.js
8472
8765
  import { readdir as readdir2 } from "fs/promises";
8473
8766
  import { readFileSync as readFileSync3, statSync as statSync6 } from "fs";
8474
- import path9 from "path";
8767
+ import path10 from "path";
8475
8768
  var MAX_FILE_SIZE3 = 10 * 1024 * 1024;
8476
8769
  function matchGlob2(filePath, pattern) {
8477
8770
  const regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/\{\{GLOBSTAR\}\}/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (_, options) => `(${options.split(",").join("|")})`).replace(/\[([^\]]+)\]/g, "[$1]");
@@ -8489,8 +8782,8 @@ async function walkDir2(dir, pattern, maxResults, basePath = "") {
8489
8782
  if (entry.name.startsWith(".")) {
8490
8783
  continue;
8491
8784
  }
8492
- const relativePath = basePath ? path9.join(basePath, entry.name) : entry.name;
8493
- const fullPath = path9.join(dir, entry.name);
8785
+ const relativePath = basePath ? path10.join(basePath, entry.name) : entry.name;
8786
+ const fullPath = path10.join(dir, entry.name);
8494
8787
  if (matchGlob2(relativePath, pattern)) {
8495
8788
  matches.push(relativePath);
8496
8789
  }
@@ -8506,7 +8799,7 @@ async function walkDir2(dir, pattern, maxResults, basePath = "") {
8506
8799
  async function searchFiles2(params) {
8507
8800
  const { pattern, filePattern = "**/*", cwd: relativeCwd, caseSensitive = false, maxResults = 100, contextLines = 0 } = params;
8508
8801
  const baseCwd = process.cwd();
8509
- const targetCwd = relativeCwd ? path9.resolve(baseCwd, path9.normalize(relativeCwd)) : baseCwd;
8802
+ const targetCwd = relativeCwd ? path10.resolve(baseCwd, path10.normalize(relativeCwd)) : baseCwd;
8510
8803
  if (!targetCwd.startsWith(baseCwd)) {
8511
8804
  throw new Error(`Access denied: Cannot search files outside of current working directory`);
8512
8805
  }
@@ -8520,7 +8813,7 @@ async function searchFiles2(params) {
8520
8813
  const filesToSearch = await walkDir2(targetCwd, filePattern, 1e4);
8521
8814
  const filteredFiles = [];
8522
8815
  for (const match of filesToSearch) {
8523
- const fullPath = path9.join(targetCwd, match);
8816
+ const fullPath = path10.join(targetCwd, match);
8524
8817
  try {
8525
8818
  const stats = statSync6(fullPath);
8526
8819
  if (stats.isDirectory() || stats.size > MAX_FILE_SIZE3) {
@@ -8544,7 +8837,7 @@ async function searchFiles2(params) {
8544
8837
  break;
8545
8838
  }
8546
8839
  filesSearched++;
8547
- const fullPath = path9.join(targetCwd, file);
8840
+ const fullPath = path10.join(targetCwd, file);
8548
8841
  try {
8549
8842
  const content = readFileSync3(fullPath, "utf-8");
8550
8843
  const lines = content.split("\n");
@@ -8679,14 +8972,14 @@ var grepSearchTool = {
8679
8972
  };
8680
8973
 
8681
8974
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/deleteFile/index.js
8682
- import { promises as fs9 } from "fs";
8975
+ import { promises as fs10 } from "fs";
8683
8976
  import { existsSync as existsSync6, statSync as statSync7 } from "fs";
8684
- import path10 from "path";
8977
+ import path11 from "path";
8685
8978
  async function deleteFile(params) {
8686
8979
  const { path: filePath, recursive = false } = params;
8687
- const normalizedPath = path10.normalize(filePath);
8688
- const resolvedPath = path10.resolve(process.cwd(), normalizedPath);
8689
- const cwd = path10.resolve(process.cwd());
8980
+ const normalizedPath = path11.normalize(filePath);
8981
+ const resolvedPath = path11.resolve(process.cwd(), normalizedPath);
8982
+ const cwd = path11.resolve(process.cwd());
8690
8983
  if (!resolvedPath.startsWith(cwd)) {
8691
8984
  throw new Error(`Access denied: Cannot delete files outside of current working directory`);
8692
8985
  }
@@ -8700,10 +8993,10 @@ async function deleteFile(params) {
8700
8993
  throw new Error(`Path is a directory: ${filePath}. Use recursive=true to delete directories and their contents.`);
8701
8994
  }
8702
8995
  if (isDirectory) {
8703
- await fs9.rm(resolvedPath, { recursive: true, force: true });
8996
+ await fs10.rm(resolvedPath, { recursive: true, force: true });
8704
8997
  return `Directory deleted successfully: ${filePath}`;
8705
8998
  } else {
8706
- await fs9.unlink(resolvedPath);
8999
+ await fs10.unlink(resolvedPath);
8707
9000
  return `File deleted successfully: ${filePath}
8708
9001
  Size: ${size} bytes`;
8709
9002
  }
@@ -8713,7 +9006,7 @@ var deleteFileTool = {
8713
9006
  implementation: (context) => ({
8714
9007
  toolFn: async (value) => {
8715
9008
  const params = value;
8716
- const resolvedPath = path10.resolve(process.cwd(), path10.normalize(params.path));
9009
+ const resolvedPath = path11.resolve(process.cwd(), path11.normalize(params.path));
8717
9010
  const isDirectory = existsSync6(resolvedPath) && statSync7(resolvedPath).isDirectory();
8718
9011
  context.logger.info(`\u{1F5D1}\uFE0F DeleteFile: Deleting ${isDirectory ? "directory" : "file"}`, {
8719
9012
  path: params.path,
@@ -8751,7 +9044,7 @@ var deleteFileTool = {
8751
9044
 
8752
9045
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/bashExecute/index.js
8753
9046
  import { spawn } from "child_process";
8754
- import path11 from "path";
9047
+ import path12 from "path";
8755
9048
  var DEFAULT_TIMEOUT_MS = 6e4;
8756
9049
  var MAX_OUTPUT_SIZE = 100 * 1024;
8757
9050
  var DANGEROUS_PATTERNS = [
@@ -8935,7 +9228,7 @@ async function executeBashCommand(params) {
8935
9228
  };
8936
9229
  }
8937
9230
  const baseCwd = process.cwd();
8938
- const targetCwd = relativeCwd ? path11.resolve(baseCwd, relativeCwd) : baseCwd;
9231
+ const targetCwd = relativeCwd ? path12.resolve(baseCwd, relativeCwd) : baseCwd;
8939
9232
  const effectiveTimeout = Math.min(timeout, 5 * 60 * 1e3);
8940
9233
  return new Promise((resolve3) => {
8941
9234
  let stdout = "";
@@ -9269,42 +9562,42 @@ var DISABLE_SERVER_THROTTLING = process.env.DISABLE_SERVER_THROTTLING === "true"
9269
9562
  var questSaveMutex = new Mutex();
9270
9563
 
9271
9564
  // ../../b4m-core/packages/services/dist/src/llm/ChatCompletion.js
9272
- var QuestStartBodySchema = z138.object({
9273
- userId: z138.string(),
9274
- sessionId: z138.string(),
9275
- questId: z138.string(),
9276
- message: z138.string(),
9277
- messageFileIds: z138.array(z138.string()),
9278
- historyCount: z138.number(),
9279
- fabFileIds: z138.array(z138.string()),
9565
+ var QuestStartBodySchema = z139.object({
9566
+ userId: z139.string(),
9567
+ sessionId: z139.string(),
9568
+ questId: z139.string(),
9569
+ message: z139.string(),
9570
+ messageFileIds: z139.array(z139.string()),
9571
+ historyCount: z139.number(),
9572
+ fabFileIds: z139.array(z139.string()),
9280
9573
  params: ChatCompletionCreateInputSchema,
9281
9574
  dashboardParams: DashboardParamsSchema.optional(),
9282
- enableQuestMaster: z138.boolean().optional(),
9283
- enableMementos: z138.boolean().optional(),
9284
- enableArtifacts: z138.boolean().optional(),
9285
- enableAgents: z138.boolean().optional(),
9575
+ enableQuestMaster: z139.boolean().optional(),
9576
+ enableMementos: z139.boolean().optional(),
9577
+ enableArtifacts: z139.boolean().optional(),
9578
+ enableAgents: z139.boolean().optional(),
9286
9579
  promptMeta: PromptMetaZodSchema,
9287
- tools: z138.array(z138.union([b4mLLMTools, z138.string()])).optional(),
9288
- mcpServers: z138.array(z138.string()).optional(),
9289
- projectId: z138.string().optional(),
9290
- organizationId: z138.string().nullable().optional(),
9580
+ tools: z139.array(z139.union([b4mLLMTools, z139.string()])).optional(),
9581
+ mcpServers: z139.array(z139.string()).optional(),
9582
+ projectId: z139.string().optional(),
9583
+ organizationId: z139.string().nullable().optional(),
9291
9584
  questMaster: QuestMasterParamsSchema.optional(),
9292
- toolPromptId: z138.string().optional(),
9585
+ toolPromptId: z139.string().optional(),
9293
9586
  researchMode: ResearchModeParamsSchema.optional(),
9294
- fallbackModel: z138.string().optional(),
9295
- embeddingModel: z138.string().optional(),
9296
- queryComplexity: z138.string(),
9587
+ fallbackModel: z139.string().optional(),
9588
+ embeddingModel: z139.string().optional(),
9589
+ queryComplexity: z139.string(),
9297
9590
  imageConfig: GenerateImageToolCallSchema.optional(),
9298
- deepResearchConfig: z138.object({
9299
- maxDepth: z138.number().optional(),
9300
- duration: z138.number().optional(),
9591
+ deepResearchConfig: z139.object({
9592
+ maxDepth: z139.number().optional(),
9593
+ duration: z139.number().optional(),
9301
9594
  // Note: searchers are passed via ToolContext and not through this API schema
9302
- searchers: z138.array(z138.any()).optional()
9595
+ searchers: z139.array(z139.any()).optional()
9303
9596
  }).optional(),
9304
- extraContextMessages: z138.array(z138.object({
9305
- role: z138.enum(["user", "assistant", "system", "function", "tool"]),
9306
- content: z138.union([z138.string(), z138.array(z138.any())]),
9307
- fabFileIds: z138.array(z138.string()).optional()
9597
+ extraContextMessages: z139.array(z139.object({
9598
+ role: z139.enum(["user", "assistant", "system", "function", "tool"]),
9599
+ content: z139.union([z139.string(), z139.array(z139.any())]),
9600
+ fabFileIds: z139.array(z139.string()).optional()
9308
9601
  })).optional()
9309
9602
  });
9310
9603
 
@@ -9312,30 +9605,9 @@ var QuestStartBodySchema = z138.object({
9312
9605
  import axios8 from "axios";
9313
9606
  import { fileTypeFromBuffer as fileTypeFromBuffer4 } from "file-type";
9314
9607
  import { v4 as uuidv47 } from "uuid";
9315
- import { z as z139 } from "zod";
9608
+ import { z as z140 } from "zod";
9316
9609
  import { fromZodError as fromZodError2 } from "zod-validation-error";
9317
9610
  var ImageGenerationBodySchema = OpenAIImageGenerationInput.extend({
9318
- sessionId: z139.string(),
9319
- questId: z139.string(),
9320
- userId: z139.string(),
9321
- prompt: z139.string(),
9322
- safety_tolerance: z139.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
9323
- prompt_upsampling: z139.boolean().optional().default(false),
9324
- seed: z139.number().nullable().optional(),
9325
- output_format: z139.enum(["jpeg", "png"]).nullable().optional().default("png"),
9326
- width: z139.number().optional(),
9327
- height: z139.number().optional(),
9328
- aspect_ratio: z139.string().optional(),
9329
- fabFileIds: z139.array(z139.string()).optional()
9330
- });
9331
-
9332
- // ../../b4m-core/packages/services/dist/src/llm/ImageEdit.js
9333
- import axios9 from "axios";
9334
- import { fileTypeFromBuffer as fileTypeFromBuffer5 } from "file-type";
9335
- import { v4 as uuidv48 } from "uuid";
9336
- import { z as z140 } from "zod";
9337
- import { fromZodError as fromZodError3 } from "zod-validation-error";
9338
- var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
9339
9611
  sessionId: z140.string(),
9340
9612
  questId: z140.string(),
9341
9613
  userId: z140.string(),
@@ -9343,35 +9615,56 @@ var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
9343
9615
  safety_tolerance: z140.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
9344
9616
  prompt_upsampling: z140.boolean().optional().default(false),
9345
9617
  seed: z140.number().nullable().optional(),
9346
- output_format: z140.enum(["jpeg", "png"]).optional().default("png"),
9618
+ output_format: z140.enum(["jpeg", "png"]).nullable().optional().default("png"),
9347
9619
  width: z140.number().optional(),
9348
9620
  height: z140.number().optional(),
9349
9621
  aspect_ratio: z140.string().optional(),
9350
- size: z140.string().optional(),
9351
- fabFileIds: z140.array(z140.string()).optional(),
9352
- image: z140.string()
9622
+ fabFileIds: z140.array(z140.string()).optional()
9353
9623
  });
9354
9624
 
9355
- // ../../b4m-core/packages/services/dist/src/llm/refineText.js
9625
+ // ../../b4m-core/packages/services/dist/src/llm/ImageEdit.js
9626
+ import axios9 from "axios";
9627
+ import { fileTypeFromBuffer as fileTypeFromBuffer5 } from "file-type";
9628
+ import { v4 as uuidv48 } from "uuid";
9356
9629
  import { z as z141 } from "zod";
9357
- var refineTextLLMSchema = z141.object({
9358
- text: z141.string(),
9359
- context: z141.string().optional()
9630
+ import { fromZodError as fromZodError3 } from "zod-validation-error";
9631
+ var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
9632
+ sessionId: z141.string(),
9633
+ questId: z141.string(),
9634
+ userId: z141.string(),
9635
+ prompt: z141.string(),
9636
+ safety_tolerance: z141.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
9637
+ prompt_upsampling: z141.boolean().optional().default(false),
9638
+ seed: z141.number().nullable().optional(),
9639
+ output_format: z141.enum(["jpeg", "png"]).optional().default("png"),
9640
+ width: z141.number().optional(),
9641
+ height: z141.number().optional(),
9642
+ aspect_ratio: z141.string().optional(),
9643
+ size: z141.string().optional(),
9644
+ fabFileIds: z141.array(z141.string()).optional(),
9645
+ image: z141.string()
9646
+ });
9647
+
9648
+ // ../../b4m-core/packages/services/dist/src/llm/refineText.js
9649
+ import { z as z142 } from "zod";
9650
+ var refineTextLLMSchema = z142.object({
9651
+ text: z142.string(),
9652
+ context: z142.string().optional()
9360
9653
  // tone: z.enum(['formal', 'informal', 'neutral']).optional(),
9361
9654
  // style: z.enum(['technical', 'creative', 'academic', 'business', 'narrative']).optional(),
9362
9655
  });
9363
9656
 
9364
9657
  // ../../b4m-core/packages/services/dist/src/llm/MementoEvaluationService.js
9365
- import { z as z142 } from "zod";
9366
- var SingleMementoEvalSchema = z142.object({
9367
- importance: z142.number().min(1).max(10),
9658
+ import { z as z143 } from "zod";
9659
+ var SingleMementoEvalSchema = z143.object({
9660
+ importance: z143.number().min(1).max(10),
9368
9661
  // 1-10 scale for personal info importance
9369
- summary: z142.string(),
9370
- tags: z142.array(z142.string()).optional()
9662
+ summary: z143.string(),
9663
+ tags: z143.array(z143.string()).optional()
9371
9664
  });
9372
- var MementoEvalResponseSchema = z142.object({
9373
- isPersonal: z142.boolean(),
9374
- mementos: z142.array(SingleMementoEvalSchema).optional()
9665
+ var MementoEvalResponseSchema = z143.object({
9666
+ isPersonal: z143.boolean(),
9667
+ mementos: z143.array(SingleMementoEvalSchema).optional()
9375
9668
  // Array of distinct personal information
9376
9669
  });
9377
9670
 
@@ -9428,7 +9721,7 @@ async function generateFileDeletePreview(args) {
9428
9721
  if (!existsSync7(args.path)) {
9429
9722
  return `[File does not exist: ${args.path}]`;
9430
9723
  }
9431
- const stats = await import("fs/promises").then((fs12) => fs12.stat(args.path));
9724
+ const stats = await import("fs/promises").then((fs13) => fs13.stat(args.path));
9432
9725
  return `[File will be deleted]
9433
9726
 
9434
9727
  Path: ${args.path}
@@ -9440,9 +9733,9 @@ Last modified: ${stats.mtime.toLocaleString()}`;
9440
9733
  }
9441
9734
 
9442
9735
  // src/utils/Logger.ts
9443
- import fs10 from "fs/promises";
9444
- import path12 from "path";
9445
- import os from "os";
9736
+ import fs11 from "fs/promises";
9737
+ import path13 from "path";
9738
+ import os2 from "os";
9446
9739
  var Logger2 = class _Logger {
9447
9740
  constructor() {
9448
9741
  this.logFilePath = null;
@@ -9464,9 +9757,9 @@ var Logger2 = class _Logger {
9464
9757
  */
9465
9758
  async initialize(sessionId) {
9466
9759
  this.sessionId = sessionId;
9467
- const debugDir = path12.join(os.homedir(), ".bike4mind", "debug");
9468
- await fs10.mkdir(debugDir, { recursive: true });
9469
- this.logFilePath = path12.join(debugDir, `${sessionId}.txt`);
9760
+ const debugDir = path13.join(os2.homedir(), ".bike4mind", "debug");
9761
+ await fs11.mkdir(debugDir, { recursive: true });
9762
+ this.logFilePath = path13.join(debugDir, `${sessionId}.txt`);
9470
9763
  await this.writeToFile("INFO", "=== CLI SESSION START ===");
9471
9764
  }
9472
9765
  /**
@@ -9530,7 +9823,7 @@ var Logger2 = class _Logger {
9530
9823
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").substring(0, 19);
9531
9824
  const logEntry = `[${timestamp}] [${level}] ${message}
9532
9825
  `;
9533
- await fs10.appendFile(this.logFilePath, logEntry, "utf-8");
9826
+ await fs11.appendFile(this.logFilePath, logEntry, "utf-8");
9534
9827
  } catch (error) {
9535
9828
  console.error("File logging failed:", error);
9536
9829
  }
@@ -9676,15 +9969,15 @@ var Logger2 = class _Logger {
9676
9969
  async cleanupOldLogs() {
9677
9970
  if (!this.fileLoggingEnabled) return;
9678
9971
  try {
9679
- const debugDir = path12.join(os.homedir(), ".bike4mind", "debug");
9680
- const files = await fs10.readdir(debugDir);
9972
+ const debugDir = path13.join(os2.homedir(), ".bike4mind", "debug");
9973
+ const files = await fs11.readdir(debugDir);
9681
9974
  const now = Date.now();
9682
9975
  const thirtyDaysAgo = now - 30 * 24 * 60 * 60 * 1e3;
9683
9976
  for (const file of files) {
9684
- const filePath = path12.join(debugDir, file);
9685
- const stats = await fs10.stat(filePath);
9977
+ const filePath = path13.join(debugDir, file);
9978
+ const stats = await fs11.stat(filePath);
9686
9979
  if (stats.mtime.getTime() < thirtyDaysAgo) {
9687
- await fs10.unlink(filePath);
9980
+ await fs11.unlink(filePath);
9688
9981
  }
9689
9982
  }
9690
9983
  } catch (error) {
@@ -9777,21 +10070,21 @@ var NoOpStorage = class extends BaseStorage {
9777
10070
  async upload(input, destination, options) {
9778
10071
  return `/tmp/${destination}`;
9779
10072
  }
9780
- async download(path15) {
10073
+ async download(path16) {
9781
10074
  throw new Error("Download not supported in CLI");
9782
10075
  }
9783
- async delete(path15) {
10076
+ async delete(path16) {
9784
10077
  }
9785
- async getSignedUrl(path15) {
9786
- return `/tmp/${path15}`;
10078
+ async getSignedUrl(path16) {
10079
+ return `/tmp/${path16}`;
9787
10080
  }
9788
- getPublicUrl(path15) {
9789
- return `/tmp/${path15}`;
10081
+ getPublicUrl(path16) {
10082
+ return `/tmp/${path16}`;
9790
10083
  }
9791
- async getPreview(path15) {
9792
- return `/tmp/${path15}`;
10084
+ async getPreview(path16) {
10085
+ return `/tmp/${path16}`;
9793
10086
  }
9794
- async getMetadata(path15) {
10087
+ async getMetadata(path16) {
9795
10088
  return { size: 0, contentType: "application/octet-stream" };
9796
10089
  }
9797
10090
  };
@@ -9962,8 +10255,8 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
9962
10255
  }
9963
10256
 
9964
10257
  // src/config/toolSafety.ts
9965
- import { z as z143 } from "zod";
9966
- var ToolCategorySchema = z143.enum([
10258
+ import { z as z144 } from "zod";
10259
+ var ToolCategorySchema = z144.enum([
9967
10260
  "auto_approve",
9968
10261
  // Safe tools that run automatically without permission
9969
10262
  "prompt_always",
@@ -9971,9 +10264,9 @@ var ToolCategorySchema = z143.enum([
9971
10264
  "prompt_default"
9972
10265
  // Tools that prompt by default but can be trusted
9973
10266
  ]);
9974
- var ToolSafetyConfigSchema = z143.object({
9975
- categories: z143.record(z143.string(), ToolCategorySchema),
9976
- trustedTools: z143.array(z143.string())
10267
+ var ToolSafetyConfigSchema = z144.object({
10268
+ categories: z144.record(z144.string(), ToolCategorySchema),
10269
+ trustedTools: z144.array(z144.string())
9977
10270
  });
9978
10271
  var DEFAULT_TOOL_CATEGORIES = {
9979
10272
  // ===== AUTO APPROVE (Safe tools) =====
@@ -10153,8 +10446,8 @@ function getEnvironmentName(configApiConfig) {
10153
10446
  }
10154
10447
 
10155
10448
  // src/utils/contextLoader.ts
10156
- import * as fs11 from "fs";
10157
- import * as path13 from "path";
10449
+ import * as fs12 from "fs";
10450
+ import * as path14 from "path";
10158
10451
  import { homedir as homedir4 } from "os";
10159
10452
  var CONTEXT_FILE_SIZE_LIMIT = 100 * 1024;
10160
10453
  var PROJECT_CONTEXT_FILES = [
@@ -10175,9 +10468,9 @@ function formatFileSize2(bytes) {
10175
10468
  return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
10176
10469
  }
10177
10470
  function tryReadContextFile(dir, filename, source) {
10178
- const filePath = path13.join(dir, filename);
10471
+ const filePath = path14.join(dir, filename);
10179
10472
  try {
10180
- const stats = fs11.lstatSync(filePath);
10473
+ const stats = fs12.lstatSync(filePath);
10181
10474
  if (stats.isDirectory()) {
10182
10475
  return null;
10183
10476
  }
@@ -10191,7 +10484,7 @@ function tryReadContextFile(dir, filename, source) {
10191
10484
  error: `${source === "global" ? "Global" : "Project"} ${filename} exceeds 100KB limit (${formatFileSize2(stats.size)})`
10192
10485
  };
10193
10486
  }
10194
- const content = fs11.readFileSync(filePath, "utf-8");
10487
+ const content = fs12.readFileSync(filePath, "utf-8");
10195
10488
  return {
10196
10489
  filename,
10197
10490
  content,
@@ -10243,7 +10536,7 @@ ${project.content}`;
10243
10536
  }
10244
10537
  async function loadContextFiles(projectDir) {
10245
10538
  const errors = [];
10246
- const globalDir = path13.join(homedir4(), ".bike4mind");
10539
+ const globalDir = path14.join(homedir4(), ".bike4mind");
10247
10540
  const projectDirectory = projectDir || process.cwd();
10248
10541
  const [globalResult, projectResult] = await Promise.all([
10249
10542
  Promise.resolve(findContextFile(globalDir, GLOBAL_CONTEXT_FILES, "global")),
@@ -10264,10 +10557,22 @@ async function loadContextFiles(projectDir) {
10264
10557
  };
10265
10558
  }
10266
10559
 
10560
+ // src/utils/argumentSubstitution.ts
10561
+ function substituteArguments(template, args) {
10562
+ let result = template;
10563
+ for (let i = args.length; i >= 1; i--) {
10564
+ const pattern = new RegExp(`\\$${i}`, "g");
10565
+ result = result.replace(pattern, args[i - 1] || "");
10566
+ }
10567
+ const allArgsString = args.join(" ");
10568
+ result = result.replace(/\$ARGUMENTS/g, allArgsString);
10569
+ return result;
10570
+ }
10571
+
10267
10572
  // ../../b4m-core/packages/mcp/dist/src/client.js
10268
10573
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
10269
10574
  import { Client as Client2 } from "@modelcontextprotocol/sdk/client/index.js";
10270
- import path14 from "path";
10575
+ import path15 from "path";
10271
10576
  import { existsSync as existsSync8, readdirSync as readdirSync3 } from "fs";
10272
10577
  var MCPClient = class {
10273
10578
  // Note: This class handles MCP server communication with repository filtering
@@ -10308,16 +10613,16 @@ var MCPClient = class {
10308
10613
  const root = process.env.INIT_CWD || process.cwd();
10309
10614
  const candidatePaths = [
10310
10615
  // When running from SST Lambda with node_modules structure (copyFiles)
10311
- path14.join(root, `node_modules/@bike4mind/mcp/dist/src/${this.serverName}/index.js`),
10616
+ path15.join(root, `node_modules/@bike4mind/mcp/dist/src/${this.serverName}/index.js`),
10312
10617
  // When running from SST Lambda deployed environment (/var/task)
10313
- path14.join(root, `b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10618
+ path15.join(root, `b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10314
10619
  // When running from SST Lambda (.sst/artifacts/mcpHandler-dev), navigate to monorepo root (3 levels up)
10315
- path14.join(root, `../../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10620
+ path15.join(root, `../../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10316
10621
  // When running from packages/client (Next.js app), navigate to monorepo root (2 levels up)
10317
- path14.join(root, `../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10622
+ path15.join(root, `../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10318
10623
  // Original paths (backward compatibility)
10319
- path14.join(root, `/b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10320
- path14.join(root, "core", "mcp", "servers", this.serverName, "dist", "index.js")
10624
+ path15.join(root, `/b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10625
+ path15.join(root, "core", "mcp", "servers", this.serverName, "dist", "index.js")
10321
10626
  ];
10322
10627
  const serverScriptPath = candidatePaths.find((p) => existsSync8(p));
10323
10628
  if (!serverScriptPath) {
@@ -11121,7 +11426,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
11121
11426
  // package.json
11122
11427
  var package_default = {
11123
11428
  name: "@bike4mind/cli",
11124
- version: "0.2.10-cli-fix-model-change.17240+efd37dd24",
11429
+ version: "0.2.10-feat-custom-slash-commands.17240+345239b67",
11125
11430
  type: "module",
11126
11431
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
11127
11432
  license: "UNLICENSED",
@@ -11191,6 +11496,7 @@ var package_default = {
11191
11496
  "eventsource-parser": "^3.0.6",
11192
11497
  "file-type": "^18.7.0",
11193
11498
  "fuse.js": "^7.1.0",
11499
+ "gray-matter": "^4.0.3",
11194
11500
  ink: "^6.5.1",
11195
11501
  "ink-select-input": "^6.2.0",
11196
11502
  "ink-spinner": "^5.0.0",
@@ -11224,10 +11530,10 @@ var package_default = {
11224
11530
  },
11225
11531
  devDependencies: {
11226
11532
  "@bike4mind/agents": "0.1.0",
11227
- "@bike4mind/common": "2.39.1-cli-fix-model-change.17240+efd37dd24",
11228
- "@bike4mind/mcp": "1.20.4-cli-fix-model-change.17240+efd37dd24",
11229
- "@bike4mind/services": "2.34.2-cli-fix-model-change.17240+efd37dd24",
11230
- "@bike4mind/utils": "2.1.4-cli-fix-model-change.17240+efd37dd24",
11533
+ "@bike4mind/common": "2.39.1-feat-custom-slash-commands.17240+345239b67",
11534
+ "@bike4mind/mcp": "1.20.4-feat-custom-slash-commands.17240+345239b67",
11535
+ "@bike4mind/services": "2.34.2-feat-custom-slash-commands.17240+345239b67",
11536
+ "@bike4mind/utils": "2.1.4-feat-custom-slash-commands.17240+345239b67",
11231
11537
  "@types/better-sqlite3": "^7.6.13",
11232
11538
  "@types/diff": "^5.0.9",
11233
11539
  "@types/jsonwebtoken": "^9.0.4",
@@ -11240,7 +11546,7 @@ var package_default = {
11240
11546
  typescript: "^5.9.3",
11241
11547
  vitest: "^3.2.4"
11242
11548
  },
11243
- gitHead: "efd37dd24812e8e34852cf32fa190f2b1c7663d9"
11549
+ gitHead: "345239b6715516fd153a7c1a612761fd9a6a298e"
11244
11550
  };
11245
11551
 
11246
11552
  // src/config/constants.ts
@@ -11267,6 +11573,7 @@ function CliApp() {
11267
11573
  sessionStore: new SessionStore(),
11268
11574
  configStore: new ConfigStore(),
11269
11575
  commandHistoryStore: new CommandHistoryStore(),
11576
+ customCommandStore: new CustomCommandStore(),
11270
11577
  imageStore: null,
11271
11578
  // Lazy-loaded on first use
11272
11579
  imageRenderer,
@@ -11346,6 +11653,15 @@ function CliApp() {
11346
11653
  const config = await state.configStore.load();
11347
11654
  const history = await state.commandHistoryStore.load();
11348
11655
  setCommandHistory(history);
11656
+ try {
11657
+ await state.customCommandStore.loadCommands();
11658
+ const customCommandCount = state.customCommandStore.getCommandCount();
11659
+ if (customCommandCount > 0) {
11660
+ console.log(`\u{1F4DD} Loaded ${customCommandCount} custom command${customCommandCount !== 1 ? "s" : ""}`);
11661
+ }
11662
+ } catch (error) {
11663
+ console.warn("Failed to load custom commands:", error instanceof Error ? error.message : String(error));
11664
+ }
11349
11665
  const authTokens = await state.configStore.getAuthTokens();
11350
11666
  let isAuthenticated = false;
11351
11667
  if (!authTokens) {
@@ -11583,8 +11899,164 @@ Remember: Use context from previous messages to understand follow-up questions.$
11583
11899
  useEffect3(() => {
11584
11900
  init();
11585
11901
  }, [init]);
11902
+ const handleCustomCommandMessage = async (fullTemplate, displayMessage) => {
11903
+ if (!state.agent || !state.session) {
11904
+ console.error("\u274C Agent or session not initialized");
11905
+ return;
11906
+ }
11907
+ const authTokens = await state.configStore.getAuthTokens();
11908
+ if (!authTokens || new Date(authTokens.expiresAt) <= /* @__PURE__ */ new Date()) {
11909
+ console.log("\n\u274C Authentication required to use AI features.");
11910
+ console.log("\u{1F4A1} Run /login to authenticate with your B4M account.\n");
11911
+ return;
11912
+ }
11913
+ useCliStore.getState().setIsThinking(true);
11914
+ const currentSteps = [];
11915
+ const stepHandler = (step) => {
11916
+ currentSteps.push(step);
11917
+ const currentSession = useCliStore.getState().session;
11918
+ if (currentSession) {
11919
+ const messages = [...currentSession.messages];
11920
+ const lastMessage = messages[messages.length - 1];
11921
+ if (lastMessage && lastMessage.role === "assistant") {
11922
+ messages[messages.length - 1] = {
11923
+ ...lastMessage,
11924
+ metadata: {
11925
+ ...lastMessage.metadata,
11926
+ steps: [...currentSteps]
11927
+ }
11928
+ };
11929
+ setStoreSession({
11930
+ ...currentSession,
11931
+ messages
11932
+ });
11933
+ }
11934
+ }
11935
+ };
11936
+ state.agent.on("action", stepHandler);
11937
+ try {
11938
+ let messageContent = fullTemplate;
11939
+ const userMessageContent = displayMessage;
11940
+ if (state.messageBuilder && state.messageBuilder.hasImages(fullTemplate)) {
11941
+ const { message: multimodalMessage } = await state.messageBuilder.buildMessage(fullTemplate);
11942
+ messageContent = multimodalMessage.content;
11943
+ }
11944
+ const userMessage = {
11945
+ role: "user",
11946
+ content: userMessageContent,
11947
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
11948
+ };
11949
+ const pendingAssistantMessage = {
11950
+ role: "assistant",
11951
+ content: "...",
11952
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11953
+ metadata: {
11954
+ steps: []
11955
+ }
11956
+ };
11957
+ const sessionWithMessages = {
11958
+ ...state.session,
11959
+ messages: [...state.session.messages, userMessage, pendingAssistantMessage],
11960
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
11961
+ };
11962
+ setState((prev) => ({ ...prev, session: sessionWithMessages }));
11963
+ setStoreSession(sessionWithMessages);
11964
+ const recentMessages = state.session.messages.slice(-20);
11965
+ const previousMessages = recentMessages.filter((msg) => msg.role === "user" || msg.role === "assistant").map((msg) => ({
11966
+ role: msg.role,
11967
+ content: msg.content
11968
+ }));
11969
+ const result = await state.agent.run(messageContent, {
11970
+ previousMessages: previousMessages.length > 0 ? previousMessages : void 0
11971
+ });
11972
+ const permissionDenied = result.finalAnswer.startsWith("Permission denied for tool");
11973
+ if (permissionDenied) {
11974
+ console.log("\n\u26A0\uFE0F Action denied by user\n");
11975
+ }
11976
+ const successfulToolCalls = result.steps.filter((s) => s.type === "observation").length;
11977
+ const currentSession = useCliStore.getState().session;
11978
+ if (!currentSession) return;
11979
+ const updatedMessages = [...currentSession.messages];
11980
+ updatedMessages[updatedMessages.length - 1] = {
11981
+ role: "assistant",
11982
+ content: result.finalAnswer,
11983
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11984
+ metadata: {
11985
+ steps: result.steps,
11986
+ tokenUsage: {
11987
+ prompt: 0,
11988
+ completion: 0,
11989
+ total: result.completionInfo.totalTokens
11990
+ },
11991
+ model: state.session.model,
11992
+ permissionDenied
11993
+ }
11994
+ };
11995
+ const finalSession = {
11996
+ ...currentSession,
11997
+ messages: updatedMessages,
11998
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
11999
+ metadata: {
12000
+ ...currentSession.metadata,
12001
+ totalTokens: currentSession.metadata.totalTokens + result.completionInfo.totalTokens,
12002
+ toolCallCount: currentSession.metadata.toolCallCount + successfulToolCalls
12003
+ }
12004
+ };
12005
+ setState((prev) => ({ ...prev, session: finalSession }));
12006
+ setStoreSession(finalSession);
12007
+ await state.sessionStore.save(finalSession);
12008
+ usageCache = null;
12009
+ useCliStore.getState().setIsThinking(false);
12010
+ } catch (error) {
12011
+ useCliStore.getState().setIsThinking(false);
12012
+ if (error?.message?.includes("Permission denied")) {
12013
+ console.log("\n\u26A0\uFE0F Action blocked by permission settings");
12014
+ const currentSession2 = useCliStore.getState().session;
12015
+ if (!currentSession2) return;
12016
+ const sessionWithDenied = { ...currentSession2 };
12017
+ const messages2 = [...sessionWithDenied.messages];
12018
+ const lastMessage2 = messages2[messages2.length - 1];
12019
+ if (lastMessage2 && lastMessage2.role === "assistant") {
12020
+ messages2[messages2.length - 1] = {
12021
+ ...lastMessage2,
12022
+ content: error.message,
12023
+ metadata: {
12024
+ ...lastMessage2.metadata,
12025
+ permissionDenied: true
12026
+ }
12027
+ };
12028
+ }
12029
+ sessionWithDenied.messages = messages2;
12030
+ setState((prev) => ({ ...prev, session: sessionWithDenied }));
12031
+ setStoreSession(sessionWithDenied);
12032
+ await state.sessionStore.save(sessionWithDenied);
12033
+ return;
12034
+ }
12035
+ console.error("Error executing command:", error);
12036
+ console.error(error.stack);
12037
+ const currentSession = useCliStore.getState().session;
12038
+ if (!currentSession) return;
12039
+ const sessionWithError = { ...currentSession };
12040
+ const messages = [...sessionWithError.messages];
12041
+ const lastMessage = messages[messages.length - 1];
12042
+ if (lastMessage && lastMessage.role === "assistant") {
12043
+ messages[messages.length - 1] = {
12044
+ ...lastMessage,
12045
+ content: `\u274C Error: ${error.message || "Unknown error occurred"}`
12046
+ };
12047
+ }
12048
+ sessionWithError.messages = messages;
12049
+ setState((prev) => ({ ...prev, session: sessionWithError }));
12050
+ setStoreSession(sessionWithError);
12051
+ } finally {
12052
+ state.agent.off("action", stepHandler);
12053
+ }
12054
+ };
11586
12055
  const handleMessage = async (message) => {
11587
- if (!state.agent || !state.session) return;
12056
+ if (!state.agent || !state.session) {
12057
+ console.error("\u274C Agent or session not initialized");
12058
+ return;
12059
+ }
11588
12060
  await state.commandHistoryStore.add(message);
11589
12061
  const updatedHistory = await state.commandHistoryStore.list();
11590
12062
  setCommandHistory(updatedHistory);
@@ -11594,6 +12066,7 @@ Remember: Use context from previous messages to understand follow-up questions.$
11594
12066
  console.log("\u{1F4A1} Run /login to authenticate with your B4M account.\n");
11595
12067
  return;
11596
12068
  }
12069
+ useCliStore.getState().setIsThinking(true);
11597
12070
  const currentSteps = [];
11598
12071
  const stepHandler = (step) => {
11599
12072
  currentSteps.push(step);
@@ -11797,8 +12270,48 @@ ${output}` : output.trim() || "(no output)",
11797
12270
  };
11798
12271
  };
11799
12272
  const handleCommand = async (command, args) => {
12273
+ const customCommand = state.customCommandStore.getCommand(command);
12274
+ if (customCommand) {
12275
+ try {
12276
+ const sourceIcon = customCommand.source === "global" ? "\u{1F3E0}" : "\u{1F4C1}";
12277
+ console.log(`${sourceIcon} Executing custom command: /${command}`);
12278
+ let substitutedBody = substituteArguments(customCommand.body, args);
12279
+ const processed = await processFileReferences(substitutedBody);
12280
+ substitutedBody = processed.content;
12281
+ if (processed.errors.length > 0) {
12282
+ processed.errors.forEach((error) => console.warn(`Warning: ${error}`));
12283
+ }
12284
+ if (process.env.B4M_VERBOSE === "1") {
12285
+ console.log("\u{1F4DD} Expanded command:\n", substitutedBody);
12286
+ }
12287
+ const displayMessage = `/${command}${args.length > 0 ? " " + args.join(" ") : ""}`;
12288
+ if (customCommand.model && state.agent) {
12289
+ console.log(`\u{1F504} Using model override: ${customCommand.model}`);
12290
+ const originalModel = state.session?.model;
12291
+ if (state.session) {
12292
+ state.session.model = customCommand.model;
12293
+ }
12294
+ await handleCustomCommandMessage(substitutedBody, displayMessage);
12295
+ if (state.session && originalModel) {
12296
+ state.session.model = originalModel;
12297
+ }
12298
+ } else {
12299
+ console.log("\u{1F916} Sending to agent...\n");
12300
+ await handleCustomCommandMessage(substitutedBody, displayMessage);
12301
+ }
12302
+ return;
12303
+ } catch (error) {
12304
+ console.error(
12305
+ `\u274C Failed to execute custom command /${command}:`,
12306
+ error instanceof Error ? error.message : String(error)
12307
+ );
12308
+ return;
12309
+ }
12310
+ }
11800
12311
  switch (command) {
11801
- case "help":
12312
+ case "help": {
12313
+ const customCommands = state.customCommandStore.getAllCommands();
12314
+ const hasCustomCommands = customCommands.length > 0;
11802
12315
  console.log(`
11803
12316
  Available commands:
11804
12317
  /help - Show this help message
@@ -11825,8 +12338,19 @@ Tool Permissions:
11825
12338
 
11826
12339
  Project Configuration:
11827
12340
  /project-config - Show merged project configuration
12341
+
12342
+ Custom Commands:
12343
+ /commands - List all custom commands
12344
+ /commands:new <name> - Create a new custom command
12345
+ /commands:reload - Reload custom commands from disk${hasCustomCommands ? "\n\n\u{1F4DD} Custom Commands Available:" : ""}${hasCustomCommands ? customCommands.map((cmd) => {
12346
+ const source = cmd.source === "global" ? "\u{1F3E0}" : "\u{1F4C1}";
12347
+ const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
12348
+ return `
12349
+ ${source} /${cmd.name}${argHint} - ${cmd.description}`;
12350
+ }).join("") : ""}
11828
12351
  `);
11829
12352
  break;
12353
+ }
11830
12354
  case "exit":
11831
12355
  case "quit":
11832
12356
  logger.debug("[EXIT /exit command - cleaning up and exiting...");
@@ -12311,6 +12835,71 @@ No usage data available for the last ${USAGE_DAYS} days.`);
12311
12835
  console.log("");
12312
12836
  break;
12313
12837
  }
12838
+ case "commands": {
12839
+ const customCommands = state.customCommandStore.getAllCommands();
12840
+ const globalCommands = state.customCommandStore.getCommandsBySource("global");
12841
+ const projectCommands = state.customCommandStore.getCommandsBySource("project");
12842
+ console.log("\n\u{1F4DD} Custom Commands:\n");
12843
+ if (customCommands.length === 0) {
12844
+ console.log("No custom commands found.");
12845
+ console.log("\nTo create a custom command:");
12846
+ console.log(" /commands:new <name> - Create a new command");
12847
+ console.log("\nCustom commands can be stored in:");
12848
+ console.log(" \u{1F3E0} Global: ~/.bike4mind/commands/ (available in all projects)");
12849
+ console.log(" \u{1F4C1} Project: .bike4mind/commands/ (team-shared, committed to git)");
12850
+ } else {
12851
+ if (globalCommands.length > 0) {
12852
+ console.log("\u{1F3E0} Global Commands (~/.bike4mind/commands/):");
12853
+ globalCommands.forEach((cmd) => {
12854
+ const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
12855
+ console.log(` /${cmd.name}${argHint} - ${cmd.description}`);
12856
+ });
12857
+ console.log("");
12858
+ }
12859
+ if (projectCommands.length > 0) {
12860
+ console.log("\u{1F4C1} Project Commands (.bike4mind/commands/):");
12861
+ projectCommands.forEach((cmd) => {
12862
+ const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
12863
+ console.log(` /${cmd.name}${argHint} - ${cmd.description}`);
12864
+ });
12865
+ console.log("");
12866
+ }
12867
+ console.log(`Total: ${customCommands.length} custom command${customCommands.length !== 1 ? "s" : ""}`);
12868
+ }
12869
+ console.log("");
12870
+ break;
12871
+ }
12872
+ case "commands:new": {
12873
+ const commandName = args[0];
12874
+ if (!commandName) {
12875
+ console.log("\u274C Please provide a command name");
12876
+ console.log("Usage: /commands:new <name>");
12877
+ break;
12878
+ }
12879
+ console.log("\nWhere should this command be stored?");
12880
+ console.log(" 1. \u{1F3E0} Global (~/.bike4mind/commands/) - available in all projects");
12881
+ console.log(" 2. \u{1F4C1} Project (.bike4mind/commands/) - team-shared");
12882
+ console.log("\nDefaulting to global. Creating command file...");
12883
+ try {
12884
+ const filePath = await state.customCommandStore.createCommandFile(commandName, true);
12885
+ console.log(`\u2705 Created command file: ${filePath}`);
12886
+ console.log("\nEdit this file to customize your command.");
12887
+ console.log("Then run: /commands:reload to load it");
12888
+ } catch (error) {
12889
+ console.error("\u274C Failed to create command file:", error instanceof Error ? error.message : String(error));
12890
+ }
12891
+ break;
12892
+ }
12893
+ case "commands:reload": {
12894
+ try {
12895
+ await state.customCommandStore.reloadCommands();
12896
+ const count = state.customCommandStore.getCommandCount();
12897
+ console.log(`\u2705 Reloaded ${count} custom command${count !== 1 ? "s" : ""}`);
12898
+ } catch (error) {
12899
+ console.error("\u274C Failed to reload commands:", error instanceof Error ? error.message : String(error));
12900
+ }
12901
+ break;
12902
+ }
12314
12903
  default:
12315
12904
  console.log(`Unknown command: /${command}`);
12316
12905
  console.log("Type /help for available commands");
@@ -12318,28 +12907,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
12318
12907
  };
12319
12908
  const handleSaveConfig = async (updatedConfig) => {
12320
12909
  await state.configStore.save(updatedConfig);
12321
- const modelChanged = state.config?.defaultModel !== updatedConfig.defaultModel;
12322
- setState((prev) => {
12323
- if (modelChanged && prev.session) {
12324
- const updatedSession = {
12325
- ...prev.session,
12326
- model: updatedConfig.defaultModel,
12327
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
12328
- };
12329
- setStoreSession(updatedSession);
12330
- if (prev.agent) {
12331
- prev.agent.context.model = updatedConfig.defaultModel;
12332
- }
12333
- return { ...prev, config: updatedConfig, session: updatedSession };
12334
- }
12335
- return { ...prev, config: updatedConfig };
12336
- });
12337
- if (modelChanged && state.agent) {
12338
- const llm = state.agent.context.llm;
12339
- if (llm) {
12340
- llm.currentModel = updatedConfig.defaultModel;
12341
- }
12342
- }
12910
+ setState((prev) => ({ ...prev, config: updatedConfig }));
12343
12911
  };
12344
12912
  if (initError) {
12345
12913
  return /* @__PURE__ */ React16.createElement(Box15, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React16.createElement(Text15, { color: "red", bold: true }, "\u274C Initialization Error"), /* @__PURE__ */ React16.createElement(Text15, null, initError), /* @__PURE__ */ React16.createElement(Text15, { dimColor: true }, "\n", "Tip: Run /config to set up your API keys"));
@@ -12428,6 +12996,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
12428
12996
  if (!isInitialized) {
12429
12997
  return /* @__PURE__ */ React16.createElement(Box15, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React16.createElement(Text15, null, "\u{1F680} Initializing..."));
12430
12998
  }
12999
+ const allCommands = mergeCommands(state.customCommandStore.getAllCommands());
12431
13000
  return /* @__PURE__ */ React16.createElement(
12432
13001
  App,
12433
13002
  {
@@ -12436,6 +13005,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
12436
13005
  onBashCommand: handleBashCommand,
12437
13006
  onImageDetected: handleImageDetected,
12438
13007
  commandHistory,
13008
+ commands: allCommands,
12439
13009
  config: state.config,
12440
13010
  availableModels: state.availableModels,
12441
13011
  onSaveConfig: handleSaveConfig,