@bike4mind/cli 0.2.10-feat-explore-subagent-implementation.17263 → 0.2.10-feat-explore-subagent-implementation.17267

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1631 -1023
  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) {
@@ -495,11 +496,61 @@ var COMMANDS = [
495
496
  name: "rewind",
496
497
  description: "Rewind conversation to a previous point",
497
498
  aliases: ["undo"]
499
+ },
500
+ {
501
+ name: "project-config",
502
+ description: "Show merged project configuration"
503
+ },
504
+ {
505
+ name: "commands",
506
+ description: "List all custom commands"
507
+ },
508
+ {
509
+ name: "commands:new",
510
+ description: "Create a new custom command",
511
+ args: "<name>"
512
+ },
513
+ {
514
+ name: "commands:reload",
515
+ description: "Reload custom commands from disk"
498
516
  }
499
517
  ];
518
+ function getAllCommandNames() {
519
+ const names = [];
520
+ for (const cmd of COMMANDS) {
521
+ names.push(cmd.name);
522
+ if (cmd.aliases) {
523
+ names.push(...cmd.aliases);
524
+ }
525
+ }
526
+ return names;
527
+ }
528
+ function isBuiltInCommand(name) {
529
+ return getAllCommandNames().includes(name);
530
+ }
531
+ function customCommandToDefinition(customCommand) {
532
+ return {
533
+ name: customCommand.name,
534
+ description: customCommand.description,
535
+ args: customCommand.argumentHint,
536
+ source: customCommand.source
537
+ };
538
+ }
539
+ function mergeCommands(customCommands) {
540
+ const builtInCommands = COMMANDS.map((cmd) => ({ ...cmd, source: "built-in" }));
541
+ const customDefinitions = customCommands.filter((cmd) => !isBuiltInCommand(cmd.name)).map(customCommandToDefinition);
542
+ const conflicts = customCommands.filter((cmd) => isBuiltInCommand(cmd.name));
543
+ if (conflicts.length > 0) {
544
+ console.warn(
545
+ "Warning: The following custom commands have names that conflict with built-in commands and will be ignored:",
546
+ conflicts.map((cmd) => cmd.name).join(", ")
547
+ );
548
+ }
549
+ return [...builtInCommands, ...customDefinitions];
550
+ }
500
551
 
501
552
  // src/utils/fuzzySearch.ts
502
- var fuse = new Fuse2(COMMANDS, {
553
+ var fuseOptions = {
503
554
  keys: [
504
555
  { name: "name", weight: 0.7 },
505
556
  // Prioritize command name
@@ -510,11 +561,12 @@ var fuse = new Fuse2(COMMANDS, {
510
561
  // 0 = perfect match, 1 = match anything
511
562
  includeScore: true,
512
563
  minMatchCharLength: 1
513
- });
514
- function searchCommands(query) {
564
+ };
565
+ function searchCommands(query, commands = COMMANDS) {
515
566
  if (!query || query.trim() === "") {
516
- return COMMANDS;
567
+ return commands;
517
568
  }
569
+ const fuse = new Fuse2(commands, fuseOptions);
518
570
  const results = fuse.search(query);
519
571
  return results.map((result) => result.item);
520
572
  }
@@ -737,6 +789,7 @@ function InputPrompt({
737
789
  onImageDetected,
738
790
  disabled = false,
739
791
  history = [],
792
+ commands = [],
740
793
  prefillInput,
741
794
  onPrefillConsumed,
742
795
  onBashModeChange
@@ -762,8 +815,8 @@ function InputPrompt({
762
815
  const commandQuery = shouldShowCommandAutocomplete ? value.slice(1) : "";
763
816
  const filteredCommands = useMemo(() => {
764
817
  if (!shouldShowCommandAutocomplete) return [];
765
- return searchCommands(commandQuery);
766
- }, [shouldShowCommandAutocomplete, commandQuery]);
818
+ return searchCommands(commandQuery, commands);
819
+ }, [shouldShowCommandAutocomplete, commandQuery, commands]);
767
820
  const filteredFiles = useMemo(() => {
768
821
  if (!fileAutocomplete?.active) return [];
769
822
  return searchFiles(fileAutocomplete.query);
@@ -1414,6 +1467,7 @@ function App({
1414
1467
  onPermissionResponse,
1415
1468
  onImageDetected,
1416
1469
  commandHistory = [],
1470
+ commands = [],
1417
1471
  config,
1418
1472
  availableModels = [],
1419
1473
  onSaveConfig,
@@ -1486,6 +1540,7 @@ ${errorBlock}`;
1486
1540
  onImageDetected,
1487
1541
  disabled: isThinking,
1488
1542
  history: commandHistory,
1543
+ commands,
1489
1544
  prefillInput,
1490
1545
  onPrefillConsumed,
1491
1546
  onBashModeChange: setIsBashMode
@@ -2708,6 +2763,261 @@ var CommandHistoryStore = class {
2708
2763
  }
2709
2764
  };
2710
2765
 
2766
+ // src/storage/CustomCommandStore.ts
2767
+ import fs6 from "fs/promises";
2768
+ import path6 from "path";
2769
+ import os from "os";
2770
+
2771
+ // src/utils/commandParser.ts
2772
+ import matter from "gray-matter";
2773
+ import { z as z2 } from "zod";
2774
+ var FrontmatterSchema = z2.object({
2775
+ description: z2.string().optional(),
2776
+ "argument-hint": z2.string().optional(),
2777
+ model: z2.string().optional(),
2778
+ // Future fields (ignored for now):
2779
+ "allowed-tools": z2.any().optional(),
2780
+ context: z2.any().optional(),
2781
+ agent: z2.any().optional(),
2782
+ "disable-model-invocation": z2.any().optional(),
2783
+ hooks: z2.any().optional()
2784
+ });
2785
+ function extractDescriptionFromBody(body) {
2786
+ const lines = body.trim().split("\n");
2787
+ for (const line of lines) {
2788
+ const trimmed = line.trim();
2789
+ if (trimmed && !trimmed.startsWith("#")) {
2790
+ return trimmed.length > 100 ? trimmed.substring(0, 97) + "..." : trimmed;
2791
+ }
2792
+ }
2793
+ return "Custom command";
2794
+ }
2795
+ function parseCommandFile(fileContent, filePath, commandName, source) {
2796
+ try {
2797
+ const { data: frontmatter, content: body } = matter(fileContent);
2798
+ const validationResult = FrontmatterSchema.safeParse(frontmatter);
2799
+ if (!validationResult.success) {
2800
+ console.warn(
2801
+ `Warning: Invalid frontmatter in ${filePath}:`,
2802
+ validationResult.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join(", ")
2803
+ );
2804
+ }
2805
+ const validFrontmatter = validationResult.success ? validationResult.data : {};
2806
+ const description = validFrontmatter.description || extractDescriptionFromBody(body) || "Custom command";
2807
+ return {
2808
+ name: commandName,
2809
+ description,
2810
+ argumentHint: validFrontmatter["argument-hint"],
2811
+ model: validFrontmatter.model,
2812
+ body: body.trim(),
2813
+ source,
2814
+ filePath
2815
+ };
2816
+ } catch (error) {
2817
+ throw new Error(
2818
+ `Failed to parse command file ${filePath}: ${error instanceof Error ? error.message : String(error)}`
2819
+ );
2820
+ }
2821
+ }
2822
+ function isValidCommandName(name) {
2823
+ if (!name || name.trim().length === 0) {
2824
+ return false;
2825
+ }
2826
+ const validPattern = /^[a-z0-9-_:]+$/i;
2827
+ return validPattern.test(name);
2828
+ }
2829
+ function extractCommandName(filename) {
2830
+ if (!filename.endsWith(".md")) {
2831
+ return null;
2832
+ }
2833
+ const name = filename.slice(0, -3);
2834
+ if (!isValidCommandName(name)) {
2835
+ return null;
2836
+ }
2837
+ return name;
2838
+ }
2839
+
2840
+ // src/storage/CustomCommandStore.ts
2841
+ var CustomCommandStore = class {
2842
+ constructor(projectRoot) {
2843
+ this.commands = /* @__PURE__ */ new Map();
2844
+ this.globalCommandsDir = path6.join(os.homedir(), ".bike4mind", "commands");
2845
+ this.projectCommandsDir = path6.join(projectRoot || process.cwd(), ".bike4mind", "commands");
2846
+ }
2847
+ /**
2848
+ * Loads all custom commands from both global and project directories
2849
+ * Project commands override global commands with the same name
2850
+ */
2851
+ async loadCommands() {
2852
+ this.commands.clear();
2853
+ await this.loadCommandsFromDirectory(this.globalCommandsDir, "global");
2854
+ await this.loadCommandsFromDirectory(this.projectCommandsDir, "project");
2855
+ }
2856
+ /**
2857
+ * Recursively scans a directory for .md files and loads them as commands
2858
+ *
2859
+ * @param directory - Directory to scan
2860
+ * @param source - Source identifier ('global' or 'project')
2861
+ */
2862
+ async loadCommandsFromDirectory(directory, source) {
2863
+ try {
2864
+ const stats = await fs6.stat(directory);
2865
+ if (!stats.isDirectory()) {
2866
+ return;
2867
+ }
2868
+ const commandFiles = await this.findCommandFiles(directory);
2869
+ for (const filePath of commandFiles) {
2870
+ try {
2871
+ await this.loadCommandFile(filePath, source);
2872
+ } catch (error) {
2873
+ console.warn(
2874
+ `Failed to load command from ${filePath}:`,
2875
+ error instanceof Error ? error.message : String(error)
2876
+ );
2877
+ }
2878
+ }
2879
+ } catch (error) {
2880
+ if (error.code !== "ENOENT") {
2881
+ console.warn(
2882
+ `Error accessing ${source} commands directory ${directory}:`,
2883
+ error instanceof Error ? error.message : String(error)
2884
+ );
2885
+ }
2886
+ }
2887
+ }
2888
+ /**
2889
+ * Recursively finds all .md files in a directory
2890
+ *
2891
+ * @param directory - Directory to search
2892
+ * @returns Array of full file paths to .md files
2893
+ */
2894
+ async findCommandFiles(directory) {
2895
+ const files = [];
2896
+ try {
2897
+ const entries = await fs6.readdir(directory, { withFileTypes: true });
2898
+ for (const entry of entries) {
2899
+ const fullPath = path6.join(directory, entry.name);
2900
+ if (entry.isDirectory()) {
2901
+ const subFiles = await this.findCommandFiles(fullPath);
2902
+ files.push(...subFiles);
2903
+ } else if (entry.isFile() && entry.name.endsWith(".md")) {
2904
+ files.push(fullPath);
2905
+ }
2906
+ }
2907
+ } catch (error) {
2908
+ console.warn(`Error reading directory ${directory}:`, error instanceof Error ? error.message : String(error));
2909
+ }
2910
+ return files;
2911
+ }
2912
+ /**
2913
+ * Loads a single command file
2914
+ *
2915
+ * @param filePath - Full path to the command file
2916
+ * @param source - Source identifier ('global' or 'project')
2917
+ */
2918
+ async loadCommandFile(filePath, source) {
2919
+ const filename = path6.basename(filePath);
2920
+ const commandName = extractCommandName(filename);
2921
+ if (!commandName) {
2922
+ console.warn(`Invalid command filename: ${filename} (must end with .md and have valid name)`);
2923
+ return;
2924
+ }
2925
+ const fileContent = await fs6.readFile(filePath, "utf-8");
2926
+ const command = parseCommandFile(fileContent, filePath, commandName, source);
2927
+ const existing = this.commands.get(commandName);
2928
+ if (existing && existing.source === "project" && source === "global") {
2929
+ return;
2930
+ }
2931
+ this.commands.set(commandName, command);
2932
+ }
2933
+ /**
2934
+ * Gets a command by name
2935
+ *
2936
+ * @param name - Command name
2937
+ * @returns CustomCommand if found, undefined otherwise
2938
+ */
2939
+ getCommand(name) {
2940
+ return this.commands.get(name);
2941
+ }
2942
+ /**
2943
+ * Gets all loaded commands
2944
+ *
2945
+ * @returns Array of all custom commands
2946
+ */
2947
+ getAllCommands() {
2948
+ return Array.from(this.commands.values());
2949
+ }
2950
+ /**
2951
+ * Gets commands filtered by source
2952
+ *
2953
+ * @param source - Filter by 'global' or 'project'
2954
+ * @returns Array of commands from the specified source
2955
+ */
2956
+ getCommandsBySource(source) {
2957
+ return this.getAllCommands().filter((cmd) => cmd.source === source);
2958
+ }
2959
+ /**
2960
+ * Checks if a command name exists
2961
+ *
2962
+ * @param name - Command name to check
2963
+ * @returns true if command exists
2964
+ */
2965
+ hasCommand(name) {
2966
+ return this.commands.has(name);
2967
+ }
2968
+ /**
2969
+ * Gets the number of loaded commands
2970
+ *
2971
+ * @returns Number of custom commands
2972
+ */
2973
+ getCommandCount() {
2974
+ return this.commands.size;
2975
+ }
2976
+ /**
2977
+ * Reloads all commands from directories
2978
+ * Useful for the /commands:reload command
2979
+ */
2980
+ async reloadCommands() {
2981
+ await this.loadCommands();
2982
+ }
2983
+ /**
2984
+ * Creates a new command file from a template
2985
+ *
2986
+ * @param name - Command name
2987
+ * @param isGlobal - If true, creates in global directory, otherwise project directory
2988
+ * @returns Path to the created file
2989
+ */
2990
+ async createCommandFile(name, isGlobal = false) {
2991
+ const targetDir = isGlobal ? this.globalCommandsDir : this.projectCommandsDir;
2992
+ const filePath = path6.join(targetDir, `${name}.md`);
2993
+ try {
2994
+ await fs6.access(filePath);
2995
+ throw new Error(`Command file already exists: ${filePath}`);
2996
+ } catch (error) {
2997
+ if (error.code !== "ENOENT") {
2998
+ throw error;
2999
+ }
3000
+ }
3001
+ await fs6.mkdir(targetDir, { recursive: true });
3002
+ const template = `---
3003
+ description: ${name} command
3004
+ argument-hint: [args]
3005
+ ---
3006
+
3007
+ # ${name}
3008
+
3009
+ Replace this with your command template.
3010
+
3011
+ You can use:
3012
+ - $ARGUMENTS for all arguments
3013
+ - $1, $2, etc. for positional arguments
3014
+ - @filename for file references
3015
+ `;
3016
+ await fs6.writeFile(filePath, template, "utf-8");
3017
+ return filePath;
3018
+ }
3019
+ };
3020
+
2711
3021
  // ../../b4m-core/packages/agents/src/ReActAgent.ts
2712
3022
  import { EventEmitter } from "events";
2713
3023
  var ReActAgent = class extends EventEmitter {
@@ -3021,38 +3331,38 @@ Remember: You are an autonomous AGENT. Act independently and solve problems proa
3021
3331
  // ../../b4m-core/packages/services/dist/src/referService/generateCodes.js
3022
3332
  import { randomBytes } from "crypto";
3023
3333
  import range from "lodash/range.js";
3024
- import { z as z2 } from "zod";
3025
- var generateReferralCodesSchema = z2.object({
3026
- count: z2.number().optional(),
3027
- unlimitedUse: z2.boolean().optional(),
3028
- expiresAt: z2.date().optional()
3334
+ import { z as z3 } from "zod";
3335
+ var generateReferralCodesSchema = z3.object({
3336
+ count: z3.number().optional(),
3337
+ unlimitedUse: z3.boolean().optional(),
3338
+ expiresAt: z3.date().optional()
3029
3339
  });
3030
3340
 
3031
3341
  // ../../b4m-core/packages/services/dist/src/referService/delete.js
3032
- import { z as z3 } from "zod";
3033
- var deleteInviteCodesSchema = z3.object({
3034
- ids: z3.array(z3.string())
3342
+ import { z as z4 } from "zod";
3343
+ var deleteInviteCodesSchema = z4.object({
3344
+ ids: z4.array(z4.string())
3035
3345
  });
3036
3346
 
3037
3347
  // ../../b4m-core/packages/services/dist/src/userService/login.js
3038
- import { z as z4 } from "zod";
3348
+ import { z as z5 } from "zod";
3039
3349
  import bcrypt from "bcryptjs";
3040
- var loginUserSchema = z4.object({
3041
- usernameOrEmail: z4.string(),
3042
- password: z4.string(),
3043
- metadata: z4.object({
3044
- loginTime: z4.date(),
3045
- userAgent: z4.string(),
3046
- browser: z4.string(),
3047
- operatingSystem: z4.string(),
3048
- deviceType: z4.string(),
3049
- screenResolution: z4.string(),
3050
- viewportSize: z4.string(),
3051
- colorDepth: z4.number(),
3052
- pixelDepth: z4.number(),
3053
- devicePixelRatio: z4.number(),
3054
- ip: z4.string().optional().default(""),
3055
- location: z4.string().optional()
3350
+ var loginUserSchema = z5.object({
3351
+ usernameOrEmail: z5.string(),
3352
+ password: z5.string(),
3353
+ metadata: z5.object({
3354
+ loginTime: z5.date(),
3355
+ userAgent: z5.string(),
3356
+ browser: z5.string(),
3357
+ operatingSystem: z5.string(),
3358
+ deviceType: z5.string(),
3359
+ screenResolution: z5.string(),
3360
+ viewportSize: z5.string(),
3361
+ colorDepth: z5.number(),
3362
+ pixelDepth: z5.number(),
3363
+ devicePixelRatio: z5.number(),
3364
+ ip: z5.string().optional().default(""),
3365
+ location: z5.string().optional()
3056
3366
  }).optional()
3057
3367
  });
3058
3368
 
@@ -3062,78 +3372,78 @@ import escapeRegExp from "lodash/escapeRegExp.js";
3062
3372
 
3063
3373
  // ../../b4m-core/packages/services/dist/src/userService/forgotPassword.js
3064
3374
  import { randomUUID } from "crypto";
3065
- import { z as z5 } from "zod";
3066
- var forgotPasswordUserSchema = z5.object({
3067
- email: z5.string().email()
3375
+ import { z as z6 } from "zod";
3376
+ var forgotPasswordUserSchema = z6.object({
3377
+ email: z6.string().email()
3068
3378
  });
3069
3379
 
3070
3380
  // ../../b4m-core/packages/services/dist/src/userService/update.js
3071
3381
  import bcrypt3 from "bcryptjs";
3072
- import { z as z6 } from "zod";
3073
- var updateUserSchema = z6.object({
3074
- name: z6.string().optional(),
3075
- username: z6.string().optional(),
3382
+ import { z as z7 } from "zod";
3383
+ var updateUserSchema = z7.object({
3384
+ name: z7.string().optional(),
3385
+ username: z7.string().optional(),
3076
3386
  // email field removed - users must use the secure email change verification flow
3077
3387
  // See requestEmailChange and verifyEmailChange in userService
3078
- password: z6.string().nullable().optional(),
3079
- team: z6.string().nullable().optional(),
3080
- role: z6.string().nullable().optional(),
3081
- phone: z6.string().nullable().optional(),
3082
- preferredLanguage: z6.string().nullable().optional(),
3083
- preferredContact: z6.string().nullable().optional(),
3084
- preferredVoice: z6.string().nullable().optional(),
3085
- tshirtSize: z6.string().nullable().optional(),
3086
- geoLocation: z6.string().nullable().optional(),
3087
- lastNotebookId: z6.string().nullable().optional(),
3088
- tags: z6.array(z6.string()).nullable().optional(),
3089
- lastCreditsPurchasedAt: z6.date().nullable().optional(),
3090
- systemFiles: z6.array(z6.object({
3091
- fileId: z6.string(),
3092
- enabled: z6.boolean()
3388
+ password: z7.string().nullable().optional(),
3389
+ team: z7.string().nullable().optional(),
3390
+ role: z7.string().nullable().optional(),
3391
+ phone: z7.string().nullable().optional(),
3392
+ preferredLanguage: z7.string().nullable().optional(),
3393
+ preferredContact: z7.string().nullable().optional(),
3394
+ preferredVoice: z7.string().nullable().optional(),
3395
+ tshirtSize: z7.string().nullable().optional(),
3396
+ geoLocation: z7.string().nullable().optional(),
3397
+ lastNotebookId: z7.string().nullable().optional(),
3398
+ tags: z7.array(z7.string()).nullable().optional(),
3399
+ lastCreditsPurchasedAt: z7.date().nullable().optional(),
3400
+ systemFiles: z7.array(z7.object({
3401
+ fileId: z7.string(),
3402
+ enabled: z7.boolean()
3093
3403
  })).nullable().optional(),
3094
- securityQuestions: z6.array(z6.object({ question: z6.string(), answer: z6.string() })).nullable().optional(),
3095
- photoUrl: z6.string().nullable().optional(),
3096
- showCreditsUsed: z6.boolean().optional()
3404
+ securityQuestions: z7.array(z7.object({ question: z7.string(), answer: z7.string() })).nullable().optional(),
3405
+ photoUrl: z7.string().nullable().optional(),
3406
+ showCreditsUsed: z7.boolean().optional()
3097
3407
  });
3098
3408
 
3099
3409
  // ../../b4m-core/packages/services/dist/src/userService/adminUpdate.js
3100
- import { z as z8 } from "zod";
3410
+ import { z as z9 } from "zod";
3101
3411
 
3102
3412
  // ../../b4m-core/packages/services/dist/src/friendshipService/sendFriendRequest.js
3103
- import { z as z7 } from "zod";
3104
- var sendFriendRequestSchema = z7.object({
3105
- requesterId: z7.string(),
3106
- recipientId: z7.string(),
3107
- message: z7.string().optional()
3413
+ import { z as z8 } from "zod";
3414
+ var sendFriendRequestSchema = z8.object({
3415
+ requesterId: z8.string(),
3416
+ recipientId: z8.string(),
3417
+ message: z8.string().optional()
3108
3418
  });
3109
3419
 
3110
3420
  // ../../b4m-core/packages/services/dist/src/userService/adminUpdate.js
3111
3421
  var adminUpdateUserSchema = updateUserSchema.extend({
3112
- id: z8.string(),
3422
+ id: z9.string(),
3113
3423
  // Admins can directly update email addresses without verification
3114
- email: z8.string().email().optional(),
3115
- role: z8.string().optional().nullable(),
3116
- isAdmin: z8.boolean().optional(),
3117
- organizationId: z8.string().optional().nullable(),
3118
- storageLimit: z8.number().optional(),
3119
- currentCredits: z8.number().optional(),
3120
- isBanned: z8.boolean().optional(),
3121
- isModerated: z8.boolean().optional(),
3122
- subscribedUntil: z8.string().optional().nullable(),
3123
- systemFiles: z8.array(z8.object({ fileId: z8.string(), enabled: z8.boolean() })).optional(),
3124
- level: z8.enum(["DemoUser", "PaidUser", "VIPUser", "ManagerUser", "AdminUser"]).optional(),
3125
- lastNotebookId: z8.string().optional().nullable(),
3126
- userNotes: z8.array(z8.object({ timestamp: z8.string(), note: z8.string(), userName: z8.string() })).optional(),
3127
- numReferralsAvailable: z8.number().optional()
3424
+ email: z9.string().email().optional(),
3425
+ role: z9.string().optional().nullable(),
3426
+ isAdmin: z9.boolean().optional(),
3427
+ organizationId: z9.string().optional().nullable(),
3428
+ storageLimit: z9.number().optional(),
3429
+ currentCredits: z9.number().optional(),
3430
+ isBanned: z9.boolean().optional(),
3431
+ isModerated: z9.boolean().optional(),
3432
+ subscribedUntil: z9.string().optional().nullable(),
3433
+ systemFiles: z9.array(z9.object({ fileId: z9.string(), enabled: z9.boolean() })).optional(),
3434
+ level: z9.enum(["DemoUser", "PaidUser", "VIPUser", "ManagerUser", "AdminUser"]).optional(),
3435
+ lastNotebookId: z9.string().optional().nullable(),
3436
+ userNotes: z9.array(z9.object({ timestamp: z9.string(), note: z9.string(), userName: z9.string() })).optional(),
3437
+ numReferralsAvailable: z9.number().optional()
3128
3438
  });
3129
3439
 
3130
3440
  // ../../b4m-core/packages/services/dist/src/userService/register.js
3131
- import { z as z10 } from "zod";
3441
+ import { z as z11 } from "zod";
3132
3442
  import bcrypt4 from "bcryptjs";
3133
3443
 
3134
3444
  // ../../b4m-core/packages/services/dist/src/creditService/addCredits.js
3135
- import { z as z9 } from "zod";
3136
- var AddCreditsSchema = z9.discriminatedUnion("type", [
3445
+ import { z as z10 } from "zod";
3446
+ var AddCreditsSchema = z10.discriminatedUnion("type", [
3137
3447
  PurchaseTransaction.omit({ createdAt: true, updatedAt: true }),
3138
3448
  SubscriptionCreditTransaction.omit({ createdAt: true, updatedAt: true }),
3139
3449
  GenericCreditAddTransaction.omit({ createdAt: true, updatedAt: true }),
@@ -3141,57 +3451,57 @@ var AddCreditsSchema = z9.discriminatedUnion("type", [
3141
3451
  ]);
3142
3452
 
3143
3453
  // ../../b4m-core/packages/services/dist/src/userService/register.js
3144
- var registerUserSchema = z10.object({
3145
- username: z10.string(),
3146
- email: z10.string(),
3147
- name: z10.string(),
3148
- inviteCode: z10.string(),
3149
- password: z10.string(),
3150
- metadata: z10.object({
3151
- loginTime: z10.date(),
3152
- userAgent: z10.string(),
3153
- browser: z10.string(),
3154
- operatingSystem: z10.string(),
3155
- deviceType: z10.string(),
3156
- screenResolution: z10.string(),
3157
- viewportSize: z10.string(),
3158
- colorDepth: z10.number(),
3159
- pixelDepth: z10.number(),
3160
- devicePixelRatio: z10.number(),
3161
- ip: z10.string().optional().default(""),
3162
- location: z10.string().optional()
3454
+ var registerUserSchema = z11.object({
3455
+ username: z11.string(),
3456
+ email: z11.string(),
3457
+ name: z11.string(),
3458
+ inviteCode: z11.string(),
3459
+ password: z11.string(),
3460
+ metadata: z11.object({
3461
+ loginTime: z11.date(),
3462
+ userAgent: z11.string(),
3463
+ browser: z11.string(),
3464
+ operatingSystem: z11.string(),
3465
+ deviceType: z11.string(),
3466
+ screenResolution: z11.string(),
3467
+ viewportSize: z11.string(),
3468
+ colorDepth: z11.number(),
3469
+ pixelDepth: z11.number(),
3470
+ devicePixelRatio: z11.number(),
3471
+ ip: z11.string().optional().default(""),
3472
+ location: z11.string().optional()
3163
3473
  }).optional()
3164
3474
  });
3165
3475
 
3166
3476
  // ../../b4m-core/packages/services/dist/src/userService/adminDelete.js
3167
- import { z as z11 } from "zod";
3168
- var adminDeleteUserSchema = z11.object({
3169
- id: z11.string()
3477
+ import { z as z12 } from "zod";
3478
+ var adminDeleteUserSchema = z12.object({
3479
+ id: z12.string()
3170
3480
  });
3171
3481
 
3172
3482
  // ../../b4m-core/packages/services/dist/src/userService/searchUserCollection.js
3173
- import { z as z12 } from "zod";
3174
- var searchUserCollectionSchema = z12.object({
3175
- userId: z12.string(),
3176
- page: z12.coerce.number().optional().default(1),
3177
- limit: z12.coerce.number().optional().default(10),
3178
- search: z12.string().optional().default(""),
3179
- type: z12.nativeEnum(CollectionType).optional()
3483
+ import { z as z13 } from "zod";
3484
+ var searchUserCollectionSchema = z13.object({
3485
+ userId: z13.string(),
3486
+ page: z13.coerce.number().optional().default(1),
3487
+ limit: z13.coerce.number().optional().default(10),
3488
+ search: z13.string().optional().default(""),
3489
+ type: z13.nativeEnum(CollectionType).optional()
3180
3490
  });
3181
3491
 
3182
3492
  // ../../b4m-core/packages/services/dist/src/userService/recalculateUserStorage.js
3183
- import { z as z13 } from "zod";
3184
- var recalculateUserStorageSchema = z13.object({
3493
+ import { z as z14 } from "zod";
3494
+ var recalculateUserStorageSchema = z14.object({
3185
3495
  /**
3186
3496
  * The user to recalculate the storage for
3187
3497
  */
3188
- userId: z13.string()
3498
+ userId: z14.string()
3189
3499
  });
3190
3500
 
3191
3501
  // ../../b4m-core/packages/services/dist/src/userService/listRecentActivities.js
3192
- import { z as z14 } from "zod";
3193
- var listRecentActivitiesSchema = z14.object({
3194
- coverage: z14.enum(["all", "important"]).default("important")
3502
+ import { z as z15 } from "zod";
3503
+ var listRecentActivitiesSchema = z15.object({
3504
+ coverage: z15.enum(["all", "important"]).default("important")
3195
3505
  });
3196
3506
  var IMPORTANT_COUNTER_NAMES = [
3197
3507
  SessionEvents.CREATE_SESSION,
@@ -3205,82 +3515,82 @@ var IMPORTANT_COUNTER_NAMES = [
3205
3515
 
3206
3516
  // ../../b4m-core/packages/services/dist/src/userService/sendEmailVerification.js
3207
3517
  import { randomUUID as randomUUID2 } from "crypto";
3208
- import { z as z15 } from "zod";
3209
- var sendEmailVerificationSchema = z15.object({
3210
- userId: z15.string()
3518
+ import { z as z16 } from "zod";
3519
+ var sendEmailVerificationSchema = z16.object({
3520
+ userId: z16.string()
3211
3521
  });
3212
3522
 
3213
3523
  // ../../b4m-core/packages/services/dist/src/userService/verifyEmailToken.js
3214
- import { z as z16 } from "zod";
3524
+ import { z as z17 } from "zod";
3215
3525
 
3216
3526
  // ../../b4m-core/packages/services/dist/src/utils/crypto.js
3217
3527
  import crypto from "crypto";
3218
3528
 
3219
3529
  // ../../b4m-core/packages/services/dist/src/userService/verifyEmailToken.js
3220
- var verifyEmailTokenSchema = z16.object({
3221
- token: z16.string()
3530
+ var verifyEmailTokenSchema = z17.object({
3531
+ token: z17.string()
3222
3532
  });
3223
3533
 
3224
3534
  // ../../b4m-core/packages/services/dist/src/userService/resendEmailVerification.js
3225
3535
  import { randomUUID as randomUUID3 } from "crypto";
3226
- import { z as z17 } from "zod";
3227
- var resendEmailVerificationSchema = z17.object({
3228
- userId: z17.string()
3536
+ import { z as z18 } from "zod";
3537
+ var resendEmailVerificationSchema = z18.object({
3538
+ userId: z18.string()
3229
3539
  });
3230
3540
 
3231
3541
  // ../../b4m-core/packages/services/dist/src/userService/requestEmailChange.js
3232
3542
  import { randomUUID as randomUUID4 } from "crypto";
3233
- import { z as z18 } from "zod";
3234
- var requestEmailChangeSchema = z18.object({
3235
- userId: z18.string(),
3236
- newEmail: z18.string().email(),
3237
- password: z18.string()
3543
+ import { z as z19 } from "zod";
3544
+ var requestEmailChangeSchema = z19.object({
3545
+ userId: z19.string(),
3546
+ newEmail: z19.string().email(),
3547
+ password: z19.string()
3238
3548
  });
3239
3549
 
3240
3550
  // ../../b4m-core/packages/services/dist/src/userService/verifyEmailChange.js
3241
- import { z as z19 } from "zod";
3242
- var verifyEmailChangeSchema = z19.object({
3243
- token: z19.string()
3551
+ import { z as z20 } from "zod";
3552
+ var verifyEmailChangeSchema = z20.object({
3553
+ token: z20.string()
3244
3554
  });
3245
3555
 
3246
3556
  // ../../b4m-core/packages/services/dist/src/userService/cancelEmailChange.js
3247
- import { z as z20 } from "zod";
3248
- var cancelEmailChangeSchema = z20.object({
3249
- userId: z20.string()
3557
+ import { z as z21 } from "zod";
3558
+ var cancelEmailChangeSchema = z21.object({
3559
+ userId: z21.string()
3250
3560
  });
3251
3561
 
3252
3562
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/create.js
3253
3563
  import { randomBytes as randomBytes2 } from "crypto";
3254
3564
  import bcrypt5 from "bcryptjs";
3255
- import { z as z21 } from "zod";
3256
- var createUserApiKeySchema = z21.object({
3257
- name: z21.string().min(1).max(100),
3258
- scopes: z21.array(z21.nativeEnum(ApiKeyScope)).min(1),
3259
- expiresAt: z21.date().optional(),
3260
- rateLimit: z21.object({
3261
- requestsPerMinute: z21.number().min(1).max(1e3).default(60),
3262
- requestsPerDay: z21.number().min(1).max(1e4).default(1e3)
3565
+ import { z as z22 } from "zod";
3566
+ var createUserApiKeySchema = z22.object({
3567
+ name: z22.string().min(1).max(100),
3568
+ scopes: z22.array(z22.nativeEnum(ApiKeyScope)).min(1),
3569
+ expiresAt: z22.date().optional(),
3570
+ rateLimit: z22.object({
3571
+ requestsPerMinute: z22.number().min(1).max(1e3).default(60),
3572
+ requestsPerDay: z22.number().min(1).max(1e4).default(1e3)
3263
3573
  }).optional(),
3264
- metadata: z21.object({
3265
- clientIP: z21.string().optional(),
3266
- userAgent: z21.string().optional(),
3267
- createdFrom: z21.enum(["dashboard", "cli", "api"])
3574
+ metadata: z22.object({
3575
+ clientIP: z22.string().optional(),
3576
+ userAgent: z22.string().optional(),
3577
+ createdFrom: z22.enum(["dashboard", "cli", "api"])
3268
3578
  })
3269
3579
  });
3270
3580
 
3271
3581
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/revoke.js
3272
- import { z as z22 } from "zod";
3273
- var revokeUserApiKeySchema = z22.object({
3274
- keyId: z22.string(),
3275
- reason: z22.string().optional()
3582
+ import { z as z23 } from "zod";
3583
+ var revokeUserApiKeySchema = z23.object({
3584
+ keyId: z23.string(),
3585
+ reason: z23.string().optional()
3276
3586
  });
3277
3587
 
3278
3588
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/rotate.js
3279
3589
  import { randomBytes as randomBytes3 } from "crypto";
3280
3590
  import bcrypt6 from "bcryptjs";
3281
- import { z as z23 } from "zod";
3282
- var rotateUserApiKeySchema = z23.object({
3283
- keyId: z23.string()
3591
+ import { z as z24 } from "zod";
3592
+ var rotateUserApiKeySchema = z24.object({
3593
+ keyId: z24.string()
3284
3594
  });
3285
3595
 
3286
3596
  // ../../b4m-core/packages/services/dist/src/userApiKeyService/validate.js
@@ -3427,29 +3737,29 @@ var EVENT_GROUPS = [
3427
3737
  ];
3428
3738
 
3429
3739
  // ../../b4m-core/packages/services/dist/src/countersService/generateReport.js
3430
- import { z as z25 } from "zod";
3740
+ import { z as z26 } from "zod";
3431
3741
 
3432
3742
  // ../../b4m-core/packages/services/dist/src/countersService/getAllCounterFrom24Hours.js
3433
- import { z as z24 } from "zod";
3743
+ import { z as z25 } from "zod";
3434
3744
  import dayjs2 from "dayjs";
3435
- var getCounterTotalsForLast24HoursSchema = z24.object({
3436
- date: z24.string(),
3437
- endDate: z24.string().optional()
3745
+ var getCounterTotalsForLast24HoursSchema = z25.object({
3746
+ date: z25.string(),
3747
+ endDate: z25.string().optional()
3438
3748
  });
3439
3749
 
3440
3750
  // ../../b4m-core/packages/services/dist/src/countersService/generateReport.js
3441
- var generateDailyReportSchema = z25.object({
3442
- date: z25.string(),
3443
- startDate: z25.string().optional(),
3444
- endDate: z25.string().optional()
3751
+ var generateDailyReportSchema = z26.object({
3752
+ date: z26.string(),
3753
+ startDate: z26.string().optional(),
3754
+ endDate: z26.string().optional()
3445
3755
  });
3446
3756
 
3447
3757
  // ../../b4m-core/packages/services/dist/src/countersService/incrementUserCounter.js
3448
- import { z as z26 } from "zod";
3449
- var incrementUserCounterSchema = z26.object({
3450
- action: z26.string(),
3451
- increment: z26.coerce.number().default(1).optional(),
3452
- metadata: z26.record(z26.unknown()).optional()
3758
+ import { z as z27 } from "zod";
3759
+ var incrementUserCounterSchema = z27.object({
3760
+ action: z27.string(),
3761
+ increment: z27.coerce.number().default(1).optional(),
3762
+ metadata: z27.record(z27.unknown()).optional()
3453
3763
  });
3454
3764
 
3455
3765
  // ../../b4m-core/packages/services/dist/src/countersService/sendSlackReport.js
@@ -3465,47 +3775,47 @@ import { GoogleGenerativeAI } from "@google/generative-ai";
3465
3775
  import OpenAI2 from "openai";
3466
3776
 
3467
3777
  // ../../b4m-core/packages/services/dist/src/importHistoryService/index.js
3468
- import fs6, { unlinkSync } from "fs";
3778
+ import fs7, { unlinkSync } from "fs";
3469
3779
  import yauzl from "yauzl";
3470
3780
  import axios3 from "axios";
3471
3781
 
3472
3782
  // ../../b4m-core/packages/services/dist/src/importHistoryService/importOpenaiHistory.js
3473
- import { z as z27 } from "zod";
3783
+ import { z as z28 } from "zod";
3474
3784
  import last from "lodash/last.js";
3475
- var epochDate = () => z27.preprocess((val) => new Date(Number(val) * 1e3), z27.date());
3476
- var openaiConversationSchema = z27.object({
3477
- id: z27.string(),
3478
- title: z27.string(),
3785
+ var epochDate = () => z28.preprocess((val) => new Date(Number(val) * 1e3), z28.date());
3786
+ var openaiConversationSchema = z28.object({
3787
+ id: z28.string(),
3788
+ title: z28.string(),
3479
3789
  create_time: epochDate(),
3480
3790
  update_time: epochDate().nullable(),
3481
- mapping: z27.record(
3482
- z27.string(),
3483
- z27.object({
3484
- id: z27.string(),
3485
- parent: z27.string().nullable(),
3486
- children: z27.array(z27.string()),
3487
- message: z27.object({
3488
- id: z27.string(),
3791
+ mapping: z28.record(
3792
+ z28.string(),
3793
+ z28.object({
3794
+ id: z28.string(),
3795
+ parent: z28.string().nullable(),
3796
+ children: z28.array(z28.string()),
3797
+ message: z28.object({
3798
+ id: z28.string(),
3489
3799
  create_time: epochDate(),
3490
3800
  update_time: epochDate().nullable(),
3491
- author: z27.object({
3492
- role: z27.string(),
3493
- name: z27.string().nullable(),
3494
- metadata: z27.any()
3801
+ author: z28.object({
3802
+ role: z28.string(),
3803
+ name: z28.string().nullable(),
3804
+ metadata: z28.any()
3495
3805
  // Accept any metadata structure
3496
3806
  }).passthrough(),
3497
3807
  // Allow extra fields in author
3498
- content: z27.object({
3499
- content_type: z27.string(),
3500
- parts: z27.array(z27.any()).optional()
3808
+ content: z28.object({
3809
+ content_type: z28.string(),
3810
+ parts: z28.array(z28.any()).optional()
3501
3811
  // Accept any type in parts array (strings, objects, etc.)
3502
3812
  }).passthrough(),
3503
3813
  // Allow extra fields in content
3504
- status: z27.string(),
3505
- end_turn: z27.boolean().nullable(),
3506
- metadata: z27.any(),
3814
+ status: z28.string(),
3815
+ end_turn: z28.boolean().nullable(),
3816
+ metadata: z28.any(),
3507
3817
  // Accept any metadata structure since it varies widely
3508
- recipient: z27.string()
3818
+ recipient: z28.string()
3509
3819
  }).passthrough().nullable()
3510
3820
  }).passthrough()
3511
3821
  // Allow extra fields in mapping node
@@ -3513,38 +3823,38 @@ var openaiConversationSchema = z27.object({
3513
3823
  }).passthrough();
3514
3824
 
3515
3825
  // ../../b4m-core/packages/services/dist/src/importHistoryService/importClaudeHistory.js
3516
- import { z as z28 } from "zod";
3517
- var claudeChatMessageSchema = z28.object({
3518
- uuid: z28.string().uuid(),
3519
- text: z28.string(),
3520
- content: z28.array(
3521
- z28.object({
3522
- type: z28.string(),
3826
+ import { z as z29 } from "zod";
3827
+ var claudeChatMessageSchema = z29.object({
3828
+ uuid: z29.string().uuid(),
3829
+ text: z29.string(),
3830
+ content: z29.array(
3831
+ z29.object({
3832
+ type: z29.string(),
3523
3833
  // Accept any type: "text", "image", "tool_result", etc.
3524
- text: z28.string().optional()
3834
+ text: z29.string().optional()
3525
3835
  // Make text optional since tool_result may not have it
3526
3836
  }).passthrough()
3527
3837
  // Allow all other fields
3528
3838
  ),
3529
- sender: z28.enum(["human", "assistant"]),
3530
- created_at: z28.coerce.date(),
3531
- updated_at: z28.coerce.date(),
3532
- attachments: z28.array(z28.any()),
3839
+ sender: z29.enum(["human", "assistant"]),
3840
+ created_at: z29.coerce.date(),
3841
+ updated_at: z29.coerce.date(),
3842
+ attachments: z29.array(z29.any()),
3533
3843
  // Accept any attachment structure
3534
- files: z28.array(z28.any())
3844
+ files: z29.array(z29.any())
3535
3845
  // Accept any file structure
3536
3846
  }).passthrough();
3537
- var claudeConversationSchema = z28.object({
3538
- uuid: z28.string().uuid(),
3539
- name: z28.string(),
3540
- summary: z28.string().optional(),
3847
+ var claudeConversationSchema = z29.object({
3848
+ uuid: z29.string().uuid(),
3849
+ name: z29.string(),
3850
+ summary: z29.string().optional(),
3541
3851
  // Summary field is optional
3542
- created_at: z28.coerce.date(),
3543
- updated_at: z28.coerce.date(),
3544
- account: z28.object({
3545
- uuid: z28.string().uuid()
3852
+ created_at: z29.coerce.date(),
3853
+ updated_at: z29.coerce.date(),
3854
+ account: z29.object({
3855
+ uuid: z29.string().uuid()
3546
3856
  }),
3547
- chat_messages: z28.array(claudeChatMessageSchema)
3857
+ chat_messages: z29.array(claudeChatMessageSchema)
3548
3858
  }).passthrough();
3549
3859
 
3550
3860
  // ../../b4m-core/packages/services/dist/src/importHistoryService/index.js
@@ -3555,357 +3865,357 @@ var ImportSource;
3555
3865
  })(ImportSource || (ImportSource = {}));
3556
3866
 
3557
3867
  // ../../b4m-core/packages/services/dist/src/sessionService/create.js
3558
- import { z as z29 } from "zod";
3559
- var createSessionParametersSchema = z29.object({
3560
- name: z29.string(),
3561
- knowledgeIds: z29.array(z29.string()).optional(),
3562
- artifactIds: z29.array(z29.string()).optional(),
3563
- agentIds: z29.array(z29.string()).optional(),
3564
- tags: z29.array(z29.object({ name: z29.string(), strength: z29.number() })).optional(),
3565
- summary: z29.string().optional(),
3566
- summaryAt: z29.date().optional(),
3567
- clonedSourceId: z29.string().optional().nullable(),
3568
- forkedSourceId: z29.string().optional().nullable(),
3569
- projectId: z29.string().optional(),
3570
- lastUsedModel: z29.string().optional().nullable()
3868
+ import { z as z30 } from "zod";
3869
+ var createSessionParametersSchema = z30.object({
3870
+ name: z30.string(),
3871
+ knowledgeIds: z30.array(z30.string()).optional(),
3872
+ artifactIds: z30.array(z30.string()).optional(),
3873
+ agentIds: z30.array(z30.string()).optional(),
3874
+ tags: z30.array(z30.object({ name: z30.string(), strength: z30.number() })).optional(),
3875
+ summary: z30.string().optional(),
3876
+ summaryAt: z30.date().optional(),
3877
+ clonedSourceId: z30.string().optional().nullable(),
3878
+ forkedSourceId: z30.string().optional().nullable(),
3879
+ projectId: z30.string().optional(),
3880
+ lastUsedModel: z30.string().optional().nullable()
3571
3881
  });
3572
3882
 
3573
3883
  // ../../b4m-core/packages/services/dist/src/sessionService/delete.js
3574
- import { z as z30 } from "zod";
3575
- var deleteSessionSchema = z30.object({
3576
- id: z30.string()
3884
+ import { z as z31 } from "zod";
3885
+ var deleteSessionSchema = z31.object({
3886
+ id: z31.string()
3577
3887
  });
3578
3888
 
3579
3889
  // ../../b4m-core/packages/services/dist/src/sessionService/sumarize.js
3580
- import { z as z31 } from "zod";
3581
- var sumarizeSessionSchema = z31.object({
3582
- id: z31.string()
3890
+ import { z as z32 } from "zod";
3891
+ var sumarizeSessionSchema = z32.object({
3892
+ id: z32.string()
3583
3893
  });
3584
3894
 
3585
3895
  // ../../b4m-core/packages/services/dist/src/projectService/create.js
3586
- import { z as z32 } from "zod";
3587
- var createProjectSchema = z32.object({
3588
- name: z32.string().min(1),
3589
- description: z32.string().min(1),
3590
- sessionIds: z32.array(z32.string()).optional(),
3591
- fileIds: z32.array(z32.string()).optional()
3896
+ import { z as z33 } from "zod";
3897
+ var createProjectSchema = z33.object({
3898
+ name: z33.string().min(1),
3899
+ description: z33.string().min(1),
3900
+ sessionIds: z33.array(z33.string()).optional(),
3901
+ fileIds: z33.array(z33.string()).optional()
3592
3902
  });
3593
3903
 
3594
3904
  // ../../b4m-core/packages/services/dist/src/projectService/search.js
3595
- import { z as z33 } from "zod";
3596
- var searchProjectsSchema = z33.object({
3597
- search: z33.string().optional(),
3598
- filters: z33.object({
3599
- favorite: z33.coerce.boolean().optional(),
3600
- scope: z33.record(z33.any()).optional()
3905
+ import { z as z34 } from "zod";
3906
+ var searchProjectsSchema = z34.object({
3907
+ search: z34.string().optional(),
3908
+ filters: z34.object({
3909
+ favorite: z34.coerce.boolean().optional(),
3910
+ scope: z34.record(z34.any()).optional()
3601
3911
  }).optional(),
3602
- pagination: z33.object({
3603
- page: z33.coerce.number().optional(),
3604
- limit: z33.coerce.number().optional()
3912
+ pagination: z34.object({
3913
+ page: z34.coerce.number().optional(),
3914
+ limit: z34.coerce.number().optional()
3605
3915
  }).optional(),
3606
- orderBy: z33.object({
3607
- by: z33.enum(["createdAt", "updatedAt"]).optional(),
3608
- direction: z33.enum(["asc", "desc"]).optional()
3916
+ orderBy: z34.object({
3917
+ by: z34.enum(["createdAt", "updatedAt"]).optional(),
3918
+ direction: z34.enum(["asc", "desc"]).optional()
3609
3919
  }).optional()
3610
3920
  });
3611
3921
 
3612
3922
  // ../../b4m-core/packages/services/dist/src/projectService/addSessions.js
3613
- import { z as z44 } from "zod";
3923
+ import { z as z45 } from "zod";
3614
3924
  import uniq2 from "lodash/uniq.js";
3615
3925
 
3616
3926
  // ../../b4m-core/packages/services/dist/src/sharingService/accept.js
3617
- import { z as z34 } from "zod";
3618
- var acceptInviteSchema = z34.object({
3619
- id: z34.string()
3927
+ import { z as z35 } from "zod";
3928
+ var acceptInviteSchema = z35.object({
3929
+ id: z35.string()
3620
3930
  });
3621
3931
 
3622
3932
  // ../../b4m-core/packages/services/dist/src/sharingService/cancel.js
3623
- import { z as z35 } from "zod";
3624
- var cancelInviteSchema = z35.object({
3625
- id: z35.string(),
3626
- type: z35.nativeEnum(InviteType),
3627
- email: z35.string().email().optional()
3933
+ import { z as z36 } from "zod";
3934
+ var cancelInviteSchema = z36.object({
3935
+ id: z36.string(),
3936
+ type: z36.nativeEnum(InviteType),
3937
+ email: z36.string().email().optional()
3628
3938
  });
3629
3939
 
3630
3940
  // ../../b4m-core/packages/services/dist/src/sharingService/cancelOwnDocument.js
3631
- import { z as z36 } from "zod";
3632
- var cancelOwnDocumentInvitesSchema = z36.object({
3633
- documentId: z36.string(),
3634
- type: z36.nativeEnum(InviteType)
3941
+ import { z as z37 } from "zod";
3942
+ var cancelOwnDocumentInvitesSchema = z37.object({
3943
+ documentId: z37.string(),
3944
+ type: z37.nativeEnum(InviteType)
3635
3945
  });
3636
3946
 
3637
3947
  // ../../b4m-core/packages/services/dist/src/sharingService/create.js
3638
- import { z as z37 } from "zod";
3948
+ import { z as z38 } from "zod";
3639
3949
  var defaultExpiration = () => new Date((/* @__PURE__ */ new Date()).getFullYear() + 100, (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate());
3640
3950
  var DEFAULT_AVAILABLE = 1;
3641
- var createInviteSchema = z37.object({
3642
- id: z37.string(),
3643
- type: z37.nativeEnum(InviteType),
3644
- permissions: z37.array(z37.nativeEnum(Permission)),
3645
- recipients: z37.string().array().optional(),
3646
- description: z37.string().optional(),
3647
- expiresAt: z37.date().optional().default(defaultExpiration()),
3648
- available: z37.number().optional().default(DEFAULT_AVAILABLE)
3951
+ var createInviteSchema = z38.object({
3952
+ id: z38.string(),
3953
+ type: z38.nativeEnum(InviteType),
3954
+ permissions: z38.array(z38.nativeEnum(Permission)),
3955
+ recipients: z38.string().array().optional(),
3956
+ description: z38.string().optional(),
3957
+ expiresAt: z38.date().optional().default(defaultExpiration()),
3958
+ available: z38.number().optional().default(DEFAULT_AVAILABLE)
3649
3959
  });
3650
3960
 
3651
3961
  // ../../b4m-core/packages/services/dist/src/sharingService/get.js
3652
- import { z as z38 } from "zod";
3653
- var getInviteSchema = z38.object({
3654
- id: z38.string(),
3655
- withUsername: z38.boolean().optional()
3962
+ import { z as z39 } from "zod";
3963
+ var getInviteSchema = z39.object({
3964
+ id: z39.string(),
3965
+ withUsername: z39.boolean().optional()
3656
3966
  });
3657
3967
 
3658
3968
  // ../../b4m-core/packages/services/dist/src/sharingService/listByDocumentIdAndType.js
3659
- import { z as z39 } from "zod";
3660
- var listInviteByDocumentIdAndTypeSchema = z39.object({
3661
- documentId: z39.string(),
3662
- type: z39.nativeEnum(InviteType)
3969
+ import { z as z40 } from "zod";
3970
+ var listInviteByDocumentIdAndTypeSchema = z40.object({
3971
+ documentId: z40.string(),
3972
+ type: z40.nativeEnum(InviteType)
3663
3973
  });
3664
3974
 
3665
3975
  // ../../b4m-core/packages/services/dist/src/sharingService/listOwnPending.js
3666
- import { z as z40 } from "zod";
3667
- var listOwnPendingInvitesSchema = z40.object({
3668
- limit: z40.number().min(1).max(100).default(20),
3669
- page: z40.number().min(1).default(1)
3976
+ import { z as z41 } from "zod";
3977
+ var listOwnPendingInvitesSchema = z41.object({
3978
+ limit: z41.number().min(1).max(100).default(20),
3979
+ page: z41.number().min(1).default(1)
3670
3980
  });
3671
3981
 
3672
3982
  // ../../b4m-core/packages/services/dist/src/sharingService/refuse.js
3673
- import { z as z41 } from "zod";
3674
- var refuseInviteSchema = z41.object({
3675
- id: z41.string()
3983
+ import { z as z42 } from "zod";
3984
+ var refuseInviteSchema = z42.object({
3985
+ id: z42.string()
3676
3986
  });
3677
3987
 
3678
3988
  // ../../b4m-core/packages/services/dist/src/sharingService/revoke.js
3679
- import { z as z42 } from "zod";
3680
- var revokeSharingSchema = z42.object({
3681
- id: z42.string(),
3682
- type: z42.enum(["files", "sessions", "projects"]),
3683
- userId: z42.string(),
3684
- projectId: z42.string().optional()
3989
+ import { z as z43 } from "zod";
3990
+ var revokeSharingSchema = z43.object({
3991
+ id: z43.string(),
3992
+ type: z43.enum(["files", "sessions", "projects"]),
3993
+ userId: z43.string(),
3994
+ projectId: z43.string().optional()
3685
3995
  });
3686
3996
 
3687
3997
  // ../../b4m-core/packages/services/dist/src/projectService/addFiles.js
3688
- import { z as z43 } from "zod";
3998
+ import { z as z44 } from "zod";
3689
3999
  import uniq from "lodash/uniq.js";
3690
- var addFilesProjectSchema = z43.object({
3691
- projectId: z43.string().nonempty(),
3692
- fileIds: z43.array(z43.string().nonempty())
4000
+ var addFilesProjectSchema = z44.object({
4001
+ projectId: z44.string().nonempty(),
4002
+ fileIds: z44.array(z44.string().nonempty())
3693
4003
  });
3694
4004
 
3695
4005
  // ../../b4m-core/packages/services/dist/src/projectService/addSessions.js
3696
- var addSessionsProjectSchema = z44.object({
3697
- projectId: z44.string().nonempty(),
3698
- sessionIds: z44.array(z44.string().nonempty())
4006
+ var addSessionsProjectSchema = z45.object({
4007
+ projectId: z45.string().nonempty(),
4008
+ sessionIds: z45.array(z45.string().nonempty())
3699
4009
  });
3700
4010
 
3701
4011
  // ../../b4m-core/packages/services/dist/src/projectService/get.js
3702
- import { z as z45 } from "zod";
3703
- var getProjectSchema = z45.object({
3704
- id: z45.string()
3705
- });
3706
-
3707
- // ../../b4m-core/packages/services/dist/src/projectService/update.js
3708
4012
  import { z as z46 } from "zod";
3709
- var updateProjectSchema = z46.object({
3710
- id: z46.string(),
3711
- name: z46.string().optional(),
3712
- description: z46.string().optional()
4013
+ var getProjectSchema = z46.object({
4014
+ id: z46.string()
3713
4015
  });
3714
4016
 
3715
- // ../../b4m-core/packages/services/dist/src/projectService/delete.js
4017
+ // ../../b4m-core/packages/services/dist/src/projectService/update.js
3716
4018
  import { z as z47 } from "zod";
3717
- var deleteProjectSchema = z47.object({
3718
- id: z47.string()
4019
+ var updateProjectSchema = z47.object({
4020
+ id: z47.string(),
4021
+ name: z47.string().optional(),
4022
+ description: z47.string().optional()
3719
4023
  });
3720
4024
 
3721
- // ../../b4m-core/packages/services/dist/src/projectService/removeFiles.js
4025
+ // ../../b4m-core/packages/services/dist/src/projectService/delete.js
3722
4026
  import { z as z48 } from "zod";
3723
- var removeProjectFilesSchema = z48.object({
3724
- projectId: z48.string(),
3725
- fileIds: z48.array(z48.string())
4027
+ var deleteProjectSchema = z48.object({
4028
+ id: z48.string()
3726
4029
  });
3727
4030
 
3728
- // ../../b4m-core/packages/services/dist/src/projectService/removeSessions.js
4031
+ // ../../b4m-core/packages/services/dist/src/projectService/removeFiles.js
3729
4032
  import { z as z49 } from "zod";
3730
- var removeProjectSessionsSchema = z49.object({
4033
+ var removeProjectFilesSchema = z49.object({
3731
4034
  projectId: z49.string(),
3732
- sessionIds: z49.array(z49.string())
4035
+ fileIds: z49.array(z49.string())
3733
4036
  });
3734
4037
 
3735
- // ../../b4m-core/packages/services/dist/src/projectService/listSessions.js
4038
+ // ../../b4m-core/packages/services/dist/src/projectService/removeSessions.js
3736
4039
  import { z as z50 } from "zod";
3737
- var listProjectSessionsSchema = z50.object({
3738
- projectId: z50.string()
4040
+ var removeProjectSessionsSchema = z50.object({
4041
+ projectId: z50.string(),
4042
+ sessionIds: z50.array(z50.string())
3739
4043
  });
3740
4044
 
3741
- // ../../b4m-core/packages/services/dist/src/projectService/listFiles.js
4045
+ // ../../b4m-core/packages/services/dist/src/projectService/listSessions.js
3742
4046
  import { z as z51 } from "zod";
3743
- var listProjectFilesSchema = z51.object({
4047
+ var listProjectSessionsSchema = z51.object({
3744
4048
  projectId: z51.string()
3745
4049
  });
3746
4050
 
3747
- // ../../b4m-core/packages/services/dist/src/projectService/listInvites.js
4051
+ // ../../b4m-core/packages/services/dist/src/projectService/listFiles.js
3748
4052
  import { z as z52 } from "zod";
3749
- var listProjectInvitesParamsSchema = z52.object({
3750
- id: z52.string(),
3751
- statuses: z52.string().optional().default(""),
3752
- limit: z52.coerce.number().optional().default(10),
3753
- page: z52.coerce.number().optional().default(1)
4053
+ var listProjectFilesSchema = z52.object({
4054
+ projectId: z52.string()
3754
4055
  });
3755
4056
 
3756
- // ../../b4m-core/packages/services/dist/src/projectService/addSystemPrompts.js
4057
+ // ../../b4m-core/packages/services/dist/src/projectService/listInvites.js
3757
4058
  import { z as z53 } from "zod";
3758
- var addSystemPromptsSchema = z53.object({
3759
- projectId: z53.string(),
3760
- fileIds: z53.array(z53.string())
4059
+ var listProjectInvitesParamsSchema = z53.object({
4060
+ id: z53.string(),
4061
+ statuses: z53.string().optional().default(""),
4062
+ limit: z53.coerce.number().optional().default(10),
4063
+ page: z53.coerce.number().optional().default(1)
3761
4064
  });
3762
4065
 
3763
- // ../../b4m-core/packages/services/dist/src/projectService/toggleSystemPrompt.js
4066
+ // ../../b4m-core/packages/services/dist/src/projectService/addSystemPrompts.js
3764
4067
  import { z as z54 } from "zod";
3765
- var toggleSystemPromptSchema = z54.object({
4068
+ var addSystemPromptsSchema = z54.object({
3766
4069
  projectId: z54.string(),
3767
- fileId: z54.string()
4070
+ fileIds: z54.array(z54.string())
3768
4071
  });
3769
4072
 
3770
- // ../../b4m-core/packages/services/dist/src/projectService/removeSystemPrompt.js
4073
+ // ../../b4m-core/packages/services/dist/src/projectService/toggleSystemPrompt.js
3771
4074
  import { z as z55 } from "zod";
3772
- var removeSystemPromptSchema = z55.object({
4075
+ var toggleSystemPromptSchema = z55.object({
3773
4076
  projectId: z55.string(),
3774
4077
  fileId: z55.string()
3775
4078
  });
3776
4079
 
3777
- // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
3778
- import { z as z58 } from "zod";
3779
-
3780
- // ../../b4m-core/packages/services/dist/src/favoriteService/create.js
4080
+ // ../../b4m-core/packages/services/dist/src/projectService/removeSystemPrompt.js
3781
4081
  import { z as z56 } from "zod";
3782
- var createFavoriteParametersSchema = z56.object({
3783
- documentId: z56.string(),
3784
- documentType: z56.nativeEnum(FavoriteDocumentType)
4082
+ var removeSystemPromptSchema = z56.object({
4083
+ projectId: z56.string(),
4084
+ fileId: z56.string()
3785
4085
  });
3786
4086
 
3787
- // ../../b4m-core/packages/services/dist/src/favoriteService/delete.js
4087
+ // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
4088
+ import { z as z59 } from "zod";
4089
+
4090
+ // ../../b4m-core/packages/services/dist/src/favoriteService/create.js
3788
4091
  import { z as z57 } from "zod";
3789
- var deleteFavoriteParametersSchema = z57.object({
4092
+ var createFavoriteParametersSchema = z57.object({
3790
4093
  documentId: z57.string(),
3791
4094
  documentType: z57.nativeEnum(FavoriteDocumentType)
3792
4095
  });
3793
4096
 
3794
- // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
3795
- var addFavoriteParametersSchema = z58.object({
3796
- projectId: z58.string()
4097
+ // ../../b4m-core/packages/services/dist/src/favoriteService/delete.js
4098
+ import { z as z58 } from "zod";
4099
+ var deleteFavoriteParametersSchema = z58.object({
4100
+ documentId: z58.string(),
4101
+ documentType: z58.nativeEnum(FavoriteDocumentType)
3797
4102
  });
3798
4103
 
3799
- // ../../b4m-core/packages/services/dist/src/projectService/deleteFavorite.js
3800
- import { z as z59 } from "zod";
3801
- var deleteFavoriteParametersSchema2 = z59.object({
4104
+ // ../../b4m-core/packages/services/dist/src/projectService/addFavorite.js
4105
+ var addFavoriteParametersSchema = z59.object({
3802
4106
  projectId: z59.string()
3803
4107
  });
3804
4108
 
3805
- // ../../b4m-core/packages/services/dist/src/projectService/removeNonExistentFiles.js
4109
+ // ../../b4m-core/packages/services/dist/src/projectService/deleteFavorite.js
3806
4110
  import { z as z60 } from "zod";
3807
- var removeNonExistentFilesSchema = z60.object({
4111
+ var deleteFavoriteParametersSchema2 = z60.object({
3808
4112
  projectId: z60.string()
3809
4113
  });
3810
4114
 
3811
- // ../../b4m-core/packages/services/dist/src/projectService/leaveProject.js
4115
+ // ../../b4m-core/packages/services/dist/src/projectService/removeNonExistentFiles.js
3812
4116
  import { z as z61 } from "zod";
3813
- var leaveProjectParamsSchema = z61.object({
3814
- id: z61.string(),
3815
- userIdToRemove: z61.string().optional()
3816
- // Optional: if provided, this is a removal by owner
4117
+ var removeNonExistentFilesSchema = z61.object({
4118
+ projectId: z61.string()
3817
4119
  });
3818
4120
 
3819
- // ../../b4m-core/packages/services/dist/src/sessionService/update.js
3820
- import uniq3 from "lodash/uniq.js";
3821
- import isEqual from "lodash/isEqual.js";
4121
+ // ../../b4m-core/packages/services/dist/src/projectService/leaveProject.js
3822
4122
  import { z as z62 } from "zod";
3823
- var updateSessionParamtersSchema = z62.object({
4123
+ var leaveProjectParamsSchema = z62.object({
3824
4124
  id: z62.string(),
3825
- name: z62.string().optional(),
3826
- knowledgeIds: z62.array(z62.string()).optional(),
3827
- artifactIds: z62.array(z62.string()).optional(),
3828
- tags: z62.array(z62.object({ name: z62.string(), strength: z62.number() })).optional(),
3829
- lastUsedModel: z62.string().optional()
4125
+ userIdToRemove: z62.string().optional()
4126
+ // Optional: if provided, this is a removal by owner
3830
4127
  });
3831
4128
 
3832
- // ../../b4m-core/packages/services/dist/src/sessionService/clone.js
4129
+ // ../../b4m-core/packages/services/dist/src/sessionService/update.js
4130
+ import uniq3 from "lodash/uniq.js";
4131
+ import isEqual from "lodash/isEqual.js";
3833
4132
  import { z as z63 } from "zod";
3834
- var cloneSessionSchema = z63.object({
3835
- id: z63.string()
4133
+ var updateSessionParamtersSchema = z63.object({
4134
+ id: z63.string(),
4135
+ name: z63.string().optional(),
4136
+ knowledgeIds: z63.array(z63.string()).optional(),
4137
+ artifactIds: z63.array(z63.string()).optional(),
4138
+ tags: z63.array(z63.object({ name: z63.string(), strength: z63.number() })).optional(),
4139
+ lastUsedModel: z63.string().optional()
3836
4140
  });
3837
4141
 
3838
- // ../../b4m-core/packages/services/dist/src/sessionService/fork.js
4142
+ // ../../b4m-core/packages/services/dist/src/sessionService/clone.js
3839
4143
  import { z as z64 } from "zod";
3840
- var forkSessionSchema = z64.object({
3841
- sessionId: z64.string(),
3842
- messageId: z64.string()
4144
+ var cloneSessionSchema = z64.object({
4145
+ id: z64.string()
3843
4146
  });
3844
4147
 
3845
- // ../../b4m-core/packages/services/dist/src/sessionService/snip.js
4148
+ // ../../b4m-core/packages/services/dist/src/sessionService/fork.js
3846
4149
  import { z as z65 } from "zod";
3847
- var snipSessionSchema = z65.object({
4150
+ var forkSessionSchema = z65.object({
3848
4151
  sessionId: z65.string(),
3849
4152
  messageId: z65.string()
3850
4153
  });
3851
4154
 
3852
- // ../../b4m-core/packages/services/dist/src/sessionService/get.js
4155
+ // ../../b4m-core/packages/services/dist/src/sessionService/snip.js
3853
4156
  import { z as z66 } from "zod";
3854
- var getSessionSchema = z66.object({
3855
- id: z66.string()
4157
+ var snipSessionSchema = z66.object({
4158
+ sessionId: z66.string(),
4159
+ messageId: z66.string()
3856
4160
  });
3857
4161
 
3858
- // ../../b4m-core/packages/services/dist/src/sessionService/deleteMessage.js
4162
+ // ../../b4m-core/packages/services/dist/src/sessionService/get.js
3859
4163
  import { z as z67 } from "zod";
3860
- var deleteSessionMessageSchema = z67.object({
3861
- sessionId: z67.string(),
3862
- messageId: z67.string()
4164
+ var getSessionSchema = z67.object({
4165
+ id: z67.string()
3863
4166
  });
3864
4167
 
3865
- // ../../b4m-core/packages/services/dist/src/sessionService/addFavorite.js
4168
+ // ../../b4m-core/packages/services/dist/src/sessionService/deleteMessage.js
3866
4169
  import { z as z68 } from "zod";
3867
- var addFavoriteParametersSchema2 = z68.object({
3868
- sessionId: z68.string()
4170
+ var deleteSessionMessageSchema = z68.object({
4171
+ sessionId: z68.string(),
4172
+ messageId: z68.string()
3869
4173
  });
3870
4174
 
3871
- // ../../b4m-core/packages/services/dist/src/sessionService/deleteFavorite.js
4175
+ // ../../b4m-core/packages/services/dist/src/sessionService/addFavorite.js
3872
4176
  import { z as z69 } from "zod";
3873
- var deleteFavoriteParametersSchema3 = z69.object({
4177
+ var addFavoriteParametersSchema2 = z69.object({
3874
4178
  sessionId: z69.string()
3875
4179
  });
3876
4180
 
3877
- // ../../b4m-core/packages/services/dist/src/sessionService/autoName.js
4181
+ // ../../b4m-core/packages/services/dist/src/sessionService/deleteFavorite.js
3878
4182
  import { z as z70 } from "zod";
3879
- var autoNameParameterSchema = z70.object({
3880
- sessionId: z70.string(),
4183
+ var deleteFavoriteParametersSchema3 = z70.object({
4184
+ sessionId: z70.string()
4185
+ });
4186
+
4187
+ // ../../b4m-core/packages/services/dist/src/sessionService/autoName.js
4188
+ import { z as z71 } from "zod";
4189
+ var autoNameParameterSchema = z71.object({
4190
+ sessionId: z71.string(),
3881
4191
  /** The maximum number of words to include in the title */
3882
- maxWords: z70.number().optional()
4192
+ maxWords: z71.number().optional()
3883
4193
  });
3884
4194
 
3885
4195
  // ../../b4m-core/packages/services/dist/src/organizationService/search.js
3886
- import { z as z71 } from "zod";
3887
- var searchSchema2 = z71.object({
4196
+ import { z as z72 } from "zod";
4197
+ var searchSchema2 = z72.object({
3888
4198
  /**
3889
4199
  * Text search query (searches in name and description)
3890
4200
  */
3891
- query: z71.string().optional(),
4201
+ query: z72.string().optional(),
3892
4202
  /**
3893
4203
  * Filter by personal organizations
3894
4204
  */
3895
- filters: z71.object({
3896
- personal: z71.union([z71.enum(["true", "false"]).transform((val) => val === "true"), z71.boolean()]).optional(),
3897
- userId: z71.string().optional()
4205
+ filters: z72.object({
4206
+ personal: z72.union([z72.enum(["true", "false"]).transform((val) => val === "true"), z72.boolean()]).optional(),
4207
+ userId: z72.string().optional()
3898
4208
  }).default({}),
3899
- pagination: z71.object({
3900
- page: z71.coerce.number().int().positive().default(1),
3901
- limit: z71.coerce.number().int().positive().max(100).default(10)
4209
+ pagination: z72.object({
4210
+ page: z72.coerce.number().int().positive().default(1),
4211
+ limit: z72.coerce.number().int().positive().max(100).default(10)
3902
4212
  }).default({
3903
4213
  page: 1,
3904
4214
  limit: 10
3905
4215
  }),
3906
- orderBy: z71.object({
3907
- field: z71.enum(["name", "createdAt", "updatedAt"]).default("name"),
3908
- direction: z71.enum(["asc", "desc"]).default("asc")
4216
+ orderBy: z72.object({
4217
+ field: z72.enum(["name", "createdAt", "updatedAt"]).default("name"),
4218
+ direction: z72.enum(["asc", "desc"]).default("asc")
3909
4219
  }).default({
3910
4220
  field: "name",
3911
4221
  direction: "asc"
@@ -3913,355 +4223,355 @@ var searchSchema2 = z71.object({
3913
4223
  });
3914
4224
 
3915
4225
  // ../../b4m-core/packages/services/dist/src/organizationService/get.js
3916
- import { z as z72 } from "zod";
3917
- var getSchema = z72.object({
4226
+ import { z as z73 } from "zod";
4227
+ var getSchema = z73.object({
3918
4228
  /**
3919
4229
  * Organization ID
3920
4230
  */
3921
- id: z72.string().min(1)
4231
+ id: z73.string().min(1)
3922
4232
  });
3923
4233
 
3924
4234
  // ../../b4m-core/packages/services/dist/src/organizationService/addMember.js
3925
- import { z as z73 } from "zod";
3926
- var addMemberSchema = z73.object({
3927
- userId: z73.string().optional(),
3928
- email: z73.string().optional(),
3929
- organizationId: z73.string(),
3930
- force: z73.boolean().optional()
4235
+ import { z as z74 } from "zod";
4236
+ var addMemberSchema = z74.object({
4237
+ userId: z74.string().optional(),
4238
+ email: z74.string().optional(),
4239
+ organizationId: z74.string(),
4240
+ force: z74.boolean().optional()
3931
4241
  // If true, add the user to the organization even if it's at full capacity
3932
4242
  });
3933
4243
 
3934
4244
  // ../../b4m-core/packages/services/dist/src/organizationService/getUsers.js
3935
- import { z as z74 } from "zod";
3936
- var getUsersSchema = z74.object({
3937
- id: z74.string()
4245
+ import { z as z75 } from "zod";
4246
+ var getUsersSchema = z75.object({
4247
+ id: z75.string()
3938
4248
  });
3939
4249
 
3940
4250
  // ../../b4m-core/packages/services/dist/src/organizationService/create.js
3941
- import { z as z75 } from "zod";
3942
- var createSchema = z75.object({
3943
- name: z75.string(),
3944
- personal: z75.boolean().default(false),
3945
- seats: z75.number().default(1),
3946
- stripeCustomerId: z75.string().nullable(),
3947
- billingOwnerId: z75.string().optional(),
4251
+ import { z as z76 } from "zod";
4252
+ var createSchema = z76.object({
4253
+ name: z76.string(),
4254
+ personal: z76.boolean().default(false),
4255
+ seats: z76.number().default(1),
4256
+ stripeCustomerId: z76.string().nullable(),
4257
+ billingOwnerId: z76.string().optional(),
3948
4258
  // Optional billing owner (defaults to user if not provided)
3949
- managerId: z75.string().optional()
4259
+ managerId: z76.string().optional()
3950
4260
  // Optional team manager
3951
4261
  });
3952
4262
 
3953
4263
  // ../../b4m-core/packages/services/dist/src/organizationService/update.js
3954
- import { z as z76 } from "zod";
3955
- var updateSchema = z76.object({
3956
- id: z76.string(),
3957
- name: z76.string().optional(),
3958
- description: z76.string().optional(),
3959
- billingContact: z76.string().optional(),
3960
- currentCredits: z76.coerce.number().optional()
4264
+ import { z as z77 } from "zod";
4265
+ var updateSchema = z77.object({
4266
+ id: z77.string(),
4267
+ name: z77.string().optional(),
4268
+ description: z77.string().optional(),
4269
+ billingContact: z77.string().optional(),
4270
+ currentCredits: z77.coerce.number().optional()
3961
4271
  });
3962
4272
 
3963
4273
  // ../../b4m-core/packages/services/dist/src/organizationService/delete.js
3964
- import { z as z77 } from "zod";
3965
- var deleteSchema = z77.object({
4274
+ import { z as z78 } from "zod";
4275
+ var deleteSchema = z78.object({
3966
4276
  /**
3967
4277
  * Organization ID
3968
4278
  */
3969
- id: z77.string().min(1)
4279
+ id: z78.string().min(1)
3970
4280
  });
3971
4281
 
3972
4282
  // ../../b4m-core/packages/services/dist/src/organizationService/listPendingUsers.js
3973
- import { z as z78 } from "zod";
3974
- var listPendingUsersSchema = z78.object({
3975
- organizationId: z78.string()
4283
+ import { z as z79 } from "zod";
4284
+ var listPendingUsersSchema = z79.object({
4285
+ organizationId: z79.string()
3976
4286
  });
3977
4287
 
3978
4288
  // ../../b4m-core/packages/services/dist/src/organizationService/revokeAccess.js
3979
- import { z as z79 } from "zod";
3980
- var revokeAccessSchema = z79.object({
3981
- id: z79.string(),
3982
- userId: z79.string()
4289
+ import { z as z80 } from "zod";
4290
+ var revokeAccessSchema = z80.object({
4291
+ id: z80.string(),
4292
+ userId: z80.string()
3983
4293
  });
3984
4294
 
3985
4295
  // ../../b4m-core/packages/services/dist/src/organizationService/leave.js
3986
- import { z as z80 } from "zod";
3987
- var organizationLeaveSchema = z80.object({
3988
- id: z80.string()
4296
+ import { z as z81 } from "zod";
4297
+ var organizationLeaveSchema = z81.object({
4298
+ id: z81.string()
3989
4299
  });
3990
4300
 
3991
4301
  // ../../b4m-core/packages/services/dist/src/apiKeyService/create.js
3992
- import { z as z81 } from "zod";
3993
- var createApiKeySchema = z81.object({
3994
- apiKey: z81.string().min(6),
3995
- description: z81.string().optional().default(""),
3996
- isActive: z81.boolean().optional().default(true),
3997
- type: z81.nativeEnum(ApiKeyType),
3998
- expireDays: z81.number().min(1).max(365).default(90)
4302
+ import { z as z82 } from "zod";
4303
+ var createApiKeySchema = z82.object({
4304
+ apiKey: z82.string().min(6),
4305
+ description: z82.string().optional().default(""),
4306
+ isActive: z82.boolean().optional().default(true),
4307
+ type: z82.nativeEnum(ApiKeyType),
4308
+ expireDays: z82.number().min(1).max(365).default(90)
3999
4309
  // Default 90-day expiration
4000
4310
  });
4001
4311
 
4002
4312
  // ../../b4m-core/packages/services/dist/src/apiKeyService/set.js
4003
- import { z as z82 } from "zod";
4004
- var setApiKeySchema = z82.object({
4005
- id: z82.string(),
4006
- type: z82.nativeEnum(ApiKeyType)
4313
+ import { z as z83 } from "zod";
4314
+ var setApiKeySchema = z83.object({
4315
+ id: z83.string(),
4316
+ type: z83.nativeEnum(ApiKeyType)
4007
4317
  });
4008
4318
 
4009
4319
  // ../../b4m-core/packages/services/dist/src/apiKeyService/delete.js
4010
- import { z as z83 } from "zod";
4011
- var deleteApiKeySchema = z83.object({
4012
- id: z83.string()
4320
+ import { z as z84 } from "zod";
4321
+ var deleteApiKeySchema = z84.object({
4322
+ id: z84.string()
4013
4323
  });
4014
4324
 
4015
4325
  // ../../b4m-core/packages/services/dist/src/fabFileService/get.js
4016
- import { z as z84 } from "zod";
4017
- var getFabFileSchema = z84.object({
4018
- id: z84.string()
4326
+ import { z as z85 } from "zod";
4327
+ var getFabFileSchema = z85.object({
4328
+ id: z85.string()
4019
4329
  });
4020
4330
 
4021
4331
  // ../../b4m-core/packages/services/dist/src/fabFileService/list.js
4022
- import { z as z85 } from "zod";
4023
- var listFabFilesSchema = z85.object({
4024
- ids: z85.array(z85.string()).optional()
4332
+ import { z as z86 } from "zod";
4333
+ var listFabFilesSchema = z86.object({
4334
+ ids: z86.array(z86.string()).optional()
4025
4335
  });
4026
4336
 
4027
4337
  // ../../b4m-core/packages/services/dist/src/fabFileService/update.js
4028
4338
  import mime from "mime-types";
4029
4339
  import { v4 as uuidv42 } from "uuid";
4030
- import { z as z86 } from "zod";
4031
- var updateFabFileSchema = z86.object({
4032
- id: z86.string(),
4033
- fileName: z86.string(),
4034
- mimeType: z86.string(),
4035
- fileContent: z86.string().optional(),
4036
- type: z86.nativeEnum(KnowledgeType),
4037
- system: z86.boolean().optional(),
4038
- systemPriority: z86.number().min(0).max(999).optional(),
4039
- sessionId: z86.string().optional(),
4040
- notes: z86.string().optional(),
4041
- primaryTag: z86.string().optional(),
4042
- tags: z86.array(z86.object({
4043
- name: z86.string(),
4044
- strength: z86.number()
4340
+ import { z as z87 } from "zod";
4341
+ var updateFabFileSchema = z87.object({
4342
+ id: z87.string(),
4343
+ fileName: z87.string(),
4344
+ mimeType: z87.string(),
4345
+ fileContent: z87.string().optional(),
4346
+ type: z87.nativeEnum(KnowledgeType),
4347
+ system: z87.boolean().optional(),
4348
+ systemPriority: z87.number().min(0).max(999).optional(),
4349
+ sessionId: z87.string().optional(),
4350
+ notes: z87.string().optional(),
4351
+ primaryTag: z87.string().optional(),
4352
+ tags: z87.array(z87.object({
4353
+ name: z87.string(),
4354
+ strength: z87.number()
4045
4355
  })).optional(),
4046
- error: z86.string().nullable().optional()
4356
+ error: z87.string().nullable().optional()
4047
4357
  });
4048
4358
 
4049
4359
  // ../../b4m-core/packages/services/dist/src/fabFileService/delete.js
4050
- import { z as z87 } from "zod";
4051
- var deleteFabFileSchema = z87.object({
4052
- id: z87.string()
4360
+ import { z as z88 } from "zod";
4361
+ var deleteFabFileSchema = z88.object({
4362
+ id: z88.string()
4053
4363
  });
4054
4364
 
4055
4365
  // ../../b4m-core/packages/services/dist/src/fabFileService/chunk.js
4056
- import { z as z88 } from "zod";
4057
- var chunkFileSchema = z88.object({
4058
- fabFileId: z88.string(),
4059
- embeddingModel: z88.string()
4366
+ import { z as z89 } from "zod";
4367
+ var chunkFileSchema = z89.object({
4368
+ fabFileId: z89.string(),
4369
+ embeddingModel: z89.string()
4060
4370
  });
4061
4371
 
4062
4372
  // ../../b4m-core/packages/services/dist/src/fabFileService/vectorize.js
4063
- import { z as z89 } from "zod";
4064
- var vectorizeFabFileChunkSchema = z89.object({
4065
- fabFileId: z89.string(),
4066
- chunkId: z89.string()
4373
+ import { z as z90 } from "zod";
4374
+ var vectorizeFabFileChunkSchema = z90.object({
4375
+ fabFileId: z90.string(),
4376
+ chunkId: z90.string()
4067
4377
  });
4068
4378
 
4069
4379
  // ../../b4m-core/packages/services/dist/src/fabFileService/listBySession.js
4070
- import { z as z90 } from "zod";
4071
- var listFabFilesBySessionSchema = z90.object({
4072
- sessionId: z90.string()
4380
+ import { z as z91 } from "zod";
4381
+ var listFabFilesBySessionSchema = z91.object({
4382
+ sessionId: z91.string()
4073
4383
  });
4074
4384
 
4075
4385
  // ../../b4m-core/packages/services/dist/src/fabFileService/listByQuest.js
4076
- import { z as z91 } from "zod";
4077
- var listFabFilesByQuestSchema = z91.object({
4078
- questId: z91.string()
4386
+ import { z as z92 } from "zod";
4387
+ var listFabFilesByQuestSchema = z92.object({
4388
+ questId: z92.string()
4079
4389
  });
4080
4390
 
4081
4391
  // ../../b4m-core/packages/services/dist/src/fabFileService/createByUrl.js
4082
- import { z as z92 } from "zod";
4083
- var createFabFileByUrlSchema = z92.object({
4084
- 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,})).+/)
4392
+ import { z as z93 } from "zod";
4393
+ var createFabFileByUrlSchema = z93.object({
4394
+ url: z93.string().regex(/^(?!https?:\/\/(drive|docs)\.google\.com\/(?:file\/d\/|open\?id=|uc\?id=|document\/d\/|spreadsheets\/d\/|presentation\/d\/|forms\/d\/|drive\/folders\/)([a-zA-Z0-9_-]{10,})).+/)
4085
4395
  });
4086
4396
 
4087
4397
  // ../../b4m-core/packages/services/dist/src/fabFileService/search.js
4088
- import { z as z93 } from "zod";
4089
- var searchFabFilesSchema = z93.object({
4090
- search: z93.string().optional(),
4091
- filters: z93.object({
4092
- tags: z93.array(z93.string()).optional(),
4093
- type: z93.enum(["text", "pdf", "url", "image", "excel", "word", "json", "csv", "markdown", "code"]).optional(),
4094
- shared: z93.coerce.boolean().optional(),
4398
+ import { z as z94 } from "zod";
4399
+ var searchFabFilesSchema = z94.object({
4400
+ search: z94.string().optional(),
4401
+ filters: z94.object({
4402
+ tags: z94.array(z94.string()).optional(),
4403
+ type: z94.enum(["text", "pdf", "url", "image", "excel", "word", "json", "csv", "markdown", "code"]).optional(),
4404
+ shared: z94.coerce.boolean().optional(),
4095
4405
  // Indicates if the user is searching for shared files
4096
- curated: z93.coerce.boolean().optional(),
4406
+ curated: z94.coerce.boolean().optional(),
4097
4407
  // Indicates if the user is searching for curated notebook files
4098
- projectId: z93.string().optional(),
4099
- ids: z93.array(z93.string()).optional()
4408
+ projectId: z94.string().optional(),
4409
+ ids: z94.array(z94.string()).optional()
4100
4410
  // Add support for filtering by IDs
4101
4411
  }).optional(),
4102
- pagination: z93.object({
4103
- page: z93.coerce.number(),
4104
- limit: z93.coerce.number()
4412
+ pagination: z94.object({
4413
+ page: z94.coerce.number(),
4414
+ limit: z94.coerce.number()
4105
4415
  }).optional(),
4106
- order: z93.object({
4107
- by: z93.enum(["createdAt", "fileName", "fileSize"]),
4108
- direction: z93.enum(["asc", "desc"])
4416
+ order: z94.object({
4417
+ by: z94.enum(["createdAt", "fileName", "fileSize"]),
4418
+ direction: z94.enum(["asc", "desc"])
4109
4419
  }).optional(),
4110
- options: z93.object({
4111
- includeShared: z93.coerce.boolean().optional()
4420
+ options: z94.object({
4421
+ includeShared: z94.coerce.boolean().optional()
4112
4422
  }).optional()
4113
4423
  });
4114
4424
 
4115
4425
  // ../../b4m-core/packages/services/dist/src/fabFileService/addFavorite.js
4116
- import { z as z94 } from "zod";
4117
- var addFavoriteParametersSchema3 = z94.object({
4118
- fileId: z94.string()
4426
+ import { z as z95 } from "zod";
4427
+ var addFavoriteParametersSchema3 = z95.object({
4428
+ fileId: z95.string()
4119
4429
  });
4120
4430
 
4121
4431
  // ../../b4m-core/packages/services/dist/src/fabFileService/deleteFavorite.js
4122
- import { z as z95 } from "zod";
4123
- var deleteFavoriteParametersSchema4 = z95.object({
4124
- fileId: z95.string()
4432
+ import { z as z96 } from "zod";
4433
+ var deleteFavoriteParametersSchema4 = z96.object({
4434
+ fileId: z96.string()
4125
4435
  });
4126
4436
 
4127
4437
  // ../../b4m-core/packages/services/dist/src/fabFileService/toggleTags.js
4128
- import { z as z96 } from "zod";
4129
- var fabFileToggleTagsSchema = z96.object({
4130
- ids: z96.array(z96.string()),
4131
- tags: z96.array(z96.string())
4438
+ import { z as z97 } from "zod";
4439
+ var fabFileToggleTagsSchema = z97.object({
4440
+ ids: z97.array(z97.string()),
4441
+ tags: z97.array(z97.string())
4132
4442
  });
4133
4443
 
4134
4444
  // ../../b4m-core/packages/services/dist/src/fabFileService/edit.js
4135
- import { z as z97 } from "zod";
4445
+ import { z as z98 } from "zod";
4136
4446
  import { diffLines } from "diff";
4137
- var editFabFileSchema = z97.object({
4138
- id: z97.string(),
4139
- instruction: z97.string(),
4140
- selection: z97.object({
4141
- start: z97.number(),
4142
- end: z97.number()
4447
+ var editFabFileSchema = z98.object({
4448
+ id: z98.string(),
4449
+ instruction: z98.string(),
4450
+ selection: z98.object({
4451
+ start: z98.number(),
4452
+ end: z98.number()
4143
4453
  }).optional(),
4144
- preserveFormatting: z97.boolean().optional().default(true),
4145
- applyImmediately: z97.boolean().optional().default(false)
4454
+ preserveFormatting: z98.boolean().optional().default(true),
4455
+ applyImmediately: z98.boolean().optional().default(false)
4146
4456
  });
4147
4457
 
4148
4458
  // ../../b4m-core/packages/services/dist/src/fabFileService/applyEdit.js
4149
4459
  import mime2 from "mime-types";
4150
4460
  import { v4 as uuidv43 } from "uuid";
4151
- import { z as z98 } from "zod";
4152
- var applyEditSchema = z98.object({
4153
- id: z98.string(),
4154
- modifiedContent: z98.string(),
4155
- createBackup: z98.boolean().optional().default(true)
4461
+ import { z as z99 } from "zod";
4462
+ var applyEditSchema = z99.object({
4463
+ id: z99.string(),
4464
+ modifiedContent: z99.string(),
4465
+ createBackup: z99.boolean().optional().default(true)
4156
4466
  });
4157
4467
 
4158
4468
  // ../../b4m-core/packages/services/dist/src/friendshipService/respondToFriendRequest.js
4159
- import { z as z99 } from "zod";
4160
- var respondToFriendRequestSchema = z99.object({
4161
- id: z99.string(),
4469
+ import { z as z100 } from "zod";
4470
+ var respondToFriendRequestSchema = z100.object({
4471
+ id: z100.string(),
4162
4472
  /** The user ID of the recipient of the friend request */
4163
- userId: z99.string(),
4164
- accept: z99.boolean()
4473
+ userId: z100.string(),
4474
+ accept: z100.boolean()
4165
4475
  });
4166
4476
 
4167
4477
  // ../../b4m-core/packages/services/dist/src/friendshipService/unfriend.js
4168
- import { z as z100 } from "zod";
4169
- var unfriendSchema = z100.object({
4170
- friendshipId: z100.string(),
4478
+ import { z as z101 } from "zod";
4479
+ var unfriendSchema = z101.object({
4480
+ friendshipId: z101.string(),
4171
4481
  /** The user ID of the user who wants to unfriend the other user */
4172
- userId: z100.string()
4482
+ userId: z101.string()
4173
4483
  });
4174
4484
 
4175
4485
  // ../../b4m-core/packages/services/dist/src/friendshipService/list.js
4176
- import { z as z101 } from "zod";
4177
- var listFriendsSchema = z101.object({
4178
- userId: z101.string()
4486
+ import { z as z102 } from "zod";
4487
+ var listFriendsSchema = z102.object({
4488
+ userId: z102.string()
4179
4489
  });
4180
- var listPendingFriendRequestsSchema = z101.object({
4181
- userId: z101.string()
4490
+ var listPendingFriendRequestsSchema = z102.object({
4491
+ userId: z102.string()
4182
4492
  });
4183
4493
 
4184
4494
  // ../../b4m-core/packages/services/dist/src/adminService/loginAs.js
4185
- import { z as z102 } from "zod";
4186
- var loginAsSchema = z102.object({
4187
- targetUserId: z102.string()
4495
+ import { z as z103 } from "zod";
4496
+ var loginAsSchema = z103.object({
4497
+ targetUserId: z103.string()
4188
4498
  });
4189
4499
 
4190
4500
  // ../../b4m-core/packages/services/dist/src/cacheService/get.js
4191
- import { z as z103 } from "zod";
4192
- var getParamsSchema = z103.object({
4193
- key: z103.string()
4501
+ import { z as z104 } from "zod";
4502
+ var getParamsSchema = z104.object({
4503
+ key: z104.string()
4194
4504
  });
4195
4505
 
4196
4506
  // ../../b4m-core/packages/services/dist/src/cacheService/set.js
4197
- import { z as z104 } from "zod";
4198
- var setParamsSchema = z104.object({
4199
- key: z104.string(),
4200
- value: z104.any(),
4507
+ import { z as z105 } from "zod";
4508
+ var setParamsSchema = z105.object({
4509
+ key: z105.string(),
4510
+ value: z105.any(),
4201
4511
  /**
4202
4512
  * Time to live in milliseconds
4203
4513
  */
4204
- ttl: z104.number(),
4205
- recache: z104.boolean().optional()
4514
+ ttl: z105.number(),
4515
+ recache: z105.boolean().optional()
4206
4516
  });
4207
4517
 
4208
4518
  // ../../b4m-core/packages/services/dist/src/cacheService/ttl.js
4209
- import { z as z105 } from "zod";
4210
- var ttlParamsSchema = z105.object({
4211
- key: z105.string()
4519
+ import { z as z106 } from "zod";
4520
+ var ttlParamsSchema = z106.object({
4521
+ key: z106.string()
4212
4522
  });
4213
4523
 
4214
4524
  // ../../b4m-core/packages/services/dist/src/cacheService/weeklyReports.js
4215
- import { z as z106 } from "zod";
4525
+ import { z as z107 } from "zod";
4216
4526
  import dayjs3 from "dayjs";
4217
- var weeklyReportSchema = z106.object({
4218
- startDate: z106.string(),
4219
- endDate: z106.string(),
4220
- report: z106.string(),
4221
- aiInsights: z106.string().nullable()
4527
+ var weeklyReportSchema = z107.object({
4528
+ startDate: z107.string(),
4529
+ endDate: z107.string(),
4530
+ report: z107.string(),
4531
+ aiInsights: z107.string().nullable()
4222
4532
  });
4223
4533
 
4224
4534
  // ../../b4m-core/packages/services/dist/src/embeddingCacheService/generateCacheKey.js
4225
4535
  import crypto2 from "crypto";
4226
4536
 
4227
4537
  // ../../b4m-core/packages/services/dist/src/researchAgentService/create.js
4228
- import { z as z107 } from "zod";
4229
- var researchAgentCreateSchema = z107.object({
4230
- name: z107.string().min(1),
4231
- description: z107.string().min(1)
4232
- });
4233
-
4234
- // ../../b4m-core/packages/services/dist/src/researchAgentService/update.js
4235
4538
  import { z as z108 } from "zod";
4236
- var researchAgentUpdateSchema = z108.object({
4237
- id: z108.string(),
4539
+ var researchAgentCreateSchema = z108.object({
4238
4540
  name: z108.string().min(1),
4239
4541
  description: z108.string().min(1)
4240
4542
  });
4241
4543
 
4242
- // ../../b4m-core/packages/services/dist/src/researchAgentService/remove.js
4544
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/update.js
4243
4545
  import { z as z109 } from "zod";
4244
- var researchAgentRemoveSchema = z109.object({
4245
- id: z109.string()
4546
+ var researchAgentUpdateSchema = z109.object({
4547
+ id: z109.string(),
4548
+ name: z109.string().min(1),
4549
+ description: z109.string().min(1)
4246
4550
  });
4247
4551
 
4248
- // ../../b4m-core/packages/services/dist/src/researchAgentService/get.js
4552
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/remove.js
4249
4553
  import { z as z110 } from "zod";
4250
- var researchAgentGetSchema = z110.object({
4554
+ var researchAgentRemoveSchema = z110.object({
4251
4555
  id: z110.string()
4252
4556
  });
4253
4557
 
4254
- // ../../b4m-core/packages/services/dist/src/researchAgentService/listFiles.js
4558
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/get.js
4255
4559
  import { z as z111 } from "zod";
4256
- var researchAgentListFilesSchema = z111.object({
4560
+ var researchAgentGetSchema = z111.object({
4561
+ id: z111.string()
4562
+ });
4563
+
4564
+ // ../../b4m-core/packages/services/dist/src/researchAgentService/listFiles.js
4565
+ import { z as z112 } from "zod";
4566
+ var researchAgentListFilesSchema = z112.object({
4257
4567
  /**
4258
4568
  * The ID of the research agent
4259
4569
  */
4260
- id: z111.string()
4570
+ id: z112.string()
4261
4571
  });
4262
4572
 
4263
4573
  // ../../b4m-core/packages/services/dist/src/researchTaskService/process.js
4264
- import { z as z112 } from "zod";
4574
+ import { z as z113 } from "zod";
4265
4575
 
4266
4576
  // ../../b4m-core/packages/services/dist/src/lib/turndown.js
4267
4577
  import turndown from "turndown";
@@ -4652,316 +4962,316 @@ var deepResearchTool = {
4652
4962
  };
4653
4963
 
4654
4964
  // ../../b4m-core/packages/services/dist/src/researchTaskService/process.js
4655
- var ResearchTaskProcessSchema = z112.object({
4656
- id: z112.string()
4965
+ var ResearchTaskProcessSchema = z113.object({
4966
+ id: z113.string()
4657
4967
  });
4658
4968
 
4659
4969
  // ../../b4m-core/packages/services/dist/src/researchTaskService/create.js
4660
- import { z as z113 } from "zod";
4661
- var researchTaskCreateSchema = z113.object({
4662
- researchAgentId: z113.string(),
4663
- title: z113.string().max(100),
4664
- description: z113.string().max(500),
4665
- prompt: z113.string().max(500).optional(),
4666
- type: z113.nativeEnum(ResearchTaskType),
4667
- executionType: z113.nativeEnum(ResearchTaskExecutionType).default(ResearchTaskExecutionType.ON_DEMAND),
4668
- fileTagId: z113.string().optional(),
4669
- autoGeneratedTag: z113.object({
4670
- name: z113.string(),
4671
- icon: z113.string(),
4672
- color: z113.string()
4970
+ import { z as z114 } from "zod";
4971
+ var researchTaskCreateSchema = z114.object({
4972
+ researchAgentId: z114.string(),
4973
+ title: z114.string().max(100),
4974
+ description: z114.string().max(500),
4975
+ prompt: z114.string().max(500).optional(),
4976
+ type: z114.nativeEnum(ResearchTaskType),
4977
+ executionType: z114.nativeEnum(ResearchTaskExecutionType).default(ResearchTaskExecutionType.ON_DEMAND),
4978
+ fileTagId: z114.string().optional(),
4979
+ autoGeneratedTag: z114.object({
4980
+ name: z114.string(),
4981
+ icon: z114.string(),
4982
+ color: z114.string()
4673
4983
  }).optional()
4674
4984
  });
4675
4985
  var researchTaskScrapeCreateSchema = researchTaskCreateSchema.extend({
4676
- urls: z113.array(z113.string().url()).min(1),
4677
- canDiscoverLinks: z113.boolean()
4986
+ urls: z114.array(z114.string().url()).min(1),
4987
+ canDiscoverLinks: z114.boolean()
4678
4988
  });
4679
4989
  var researchTaskPeriodicCreateSchema = researchTaskCreateSchema.extend({
4680
- executionPeriodicStartAt: z113.coerce.date(),
4681
- executionPeriodicEndAt: z113.coerce.date(),
4682
- executionPeriodicFrequency: z113.nativeEnum(ResearchTaskPeriodicFrequencyType)
4990
+ executionPeriodicStartAt: z114.coerce.date(),
4991
+ executionPeriodicEndAt: z114.coerce.date(),
4992
+ executionPeriodicFrequency: z114.nativeEnum(ResearchTaskPeriodicFrequencyType)
4683
4993
  });
4684
4994
  var researchTaskScheduledCreateSchema = researchTaskCreateSchema.extend({
4685
- executionScheduledAt: z113.coerce.date()
4995
+ executionScheduledAt: z114.coerce.date()
4686
4996
  });
4687
4997
  var researchTaskDeepResearchCreateSchema = researchTaskCreateSchema.extend({
4688
- maxDepth: z113.number().min(1).max(10).optional()
4998
+ maxDepth: z114.number().min(1).max(10).optional()
4689
4999
  });
4690
5000
 
4691
5001
  // ../../b4m-core/packages/services/dist/src/researchTaskService/search.js
4692
- import { z as z114 } from "zod";
4693
- var searchResearchTasksSchema = z114.object({
4694
- search: z114.string().optional(),
5002
+ import { z as z115 } from "zod";
5003
+ var searchResearchTasksSchema = z115.object({
5004
+ search: z115.string().optional(),
4695
5005
  // ADD FILTERS SCHEMA HERE
4696
5006
  // filters: z
4697
5007
  // .object({
4698
5008
  // userId: z.string().optional(),
4699
5009
  // })
4700
5010
  // .optional(),
4701
- pagination: z114.object({
4702
- page: z114.coerce.number().optional(),
4703
- limit: z114.coerce.number().optional()
5011
+ pagination: z115.object({
5012
+ page: z115.coerce.number().optional(),
5013
+ limit: z115.coerce.number().optional()
4704
5014
  }).optional(),
4705
- orderBy: z114.object({
4706
- by: z114.enum(["createdAt", "updatedAt"]).optional(),
4707
- direction: z114.enum(["asc", "desc"]).optional()
5015
+ orderBy: z115.object({
5016
+ by: z115.enum(["createdAt", "updatedAt"]).optional(),
5017
+ direction: z115.enum(["asc", "desc"]).optional()
4708
5018
  }).optional()
4709
5019
  });
4710
5020
 
4711
5021
  // ../../b4m-core/packages/services/dist/src/researchTaskService/get.js
4712
- import { z as z115 } from "zod";
4713
- var getResearchTaskSchema = z115.object({
4714
- id: z115.string().min(1)
5022
+ import { z as z116 } from "zod";
5023
+ var getResearchTaskSchema = z116.object({
5024
+ id: z116.string().min(1)
4715
5025
  });
4716
5026
 
4717
5027
  // ../../b4m-core/packages/services/dist/src/researchTaskService/update.js
4718
- import { z as z116 } from "zod";
4719
- var updateResearchTaskSchema = z116.object({
4720
- id: z116.string(),
4721
- title: z116.string(),
4722
- description: z116.string(),
4723
- type: z116.nativeEnum(ResearchTaskType)
5028
+ import { z as z117 } from "zod";
5029
+ var updateResearchTaskSchema = z117.object({
5030
+ id: z117.string(),
5031
+ title: z117.string(),
5032
+ description: z117.string(),
5033
+ type: z117.nativeEnum(ResearchTaskType)
4724
5034
  });
4725
5035
  var researchTaskScrapeUpdateSchema = updateResearchTaskSchema.extend({
4726
- urls: z116.array(z116.string().url()).min(1),
4727
- canDiscoverLinks: z116.boolean()
5036
+ urls: z117.array(z117.string().url()).min(1),
5037
+ canDiscoverLinks: z117.boolean()
4728
5038
  });
4729
5039
 
4730
5040
  // ../../b4m-core/packages/services/dist/src/researchTaskService/listByAgentId.js
4731
- import { z as z117 } from "zod";
4732
- var listByAgentIdSchema = z117.object({
4733
- researchAgentId: z117.string()
5041
+ import { z as z118 } from "zod";
5042
+ var listByAgentIdSchema = z118.object({
5043
+ researchAgentId: z118.string()
4734
5044
  });
4735
5045
 
4736
5046
  // ../../b4m-core/packages/services/dist/src/researchTaskService/remove.js
4737
- import { z as z118 } from "zod";
4738
- var researchTaskRemoveSchema = z118.object({
4739
- id: z118.string().min(1)
5047
+ import { z as z119 } from "zod";
5048
+ var researchTaskRemoveSchema = z119.object({
5049
+ id: z119.string().min(1)
4740
5050
  });
4741
5051
 
4742
5052
  // ../../b4m-core/packages/services/dist/src/researchTaskService/retry.js
4743
- import { z as z119 } from "zod";
4744
- var researchTaskRetrySchema = z119.object({
4745
- id: z119.string(),
4746
- userId: z119.string()
5053
+ import { z as z120 } from "zod";
5054
+ var researchTaskRetrySchema = z120.object({
5055
+ id: z120.string(),
5056
+ userId: z120.string()
4747
5057
  });
4748
5058
 
4749
5059
  // ../../b4m-core/packages/services/dist/src/researchTaskService/processDiscoveredLinks.js
4750
5060
  import axios4 from "axios";
4751
- import { z as z120 } from "zod";
5061
+ import { z as z121 } from "zod";
4752
5062
  import plimit from "p-limit";
4753
5063
  import pLimit2 from "p-limit";
4754
- var researchTaskProcessDiscoveredLinksSchema = z120.object({
4755
- id: z120.string()
5064
+ var researchTaskProcessDiscoveredLinksSchema = z121.object({
5065
+ id: z121.string()
4756
5066
  });
4757
5067
 
4758
5068
  // ../../b4m-core/packages/services/dist/src/researchTaskService/downloadRelevantLinks.js
4759
- import { z as z121 } from "zod";
5069
+ import { z as z122 } from "zod";
4760
5070
  import plimit2 from "p-limit";
4761
5071
  import axios5 from "axios";
4762
5072
  import { fileTypeFromBuffer } from "file-type";
4763
- var researchTaskDownloadRelevantLinksSchema = z121.object({
4764
- id: z121.string()
5073
+ var researchTaskDownloadRelevantLinksSchema = z122.object({
5074
+ id: z122.string()
4765
5075
  });
4766
5076
 
4767
5077
  // ../../b4m-core/packages/services/dist/src/researchData/remove.js
4768
- import { z as z122 } from "zod";
4769
- var researchDataRemoveSchema = z122.object({
4770
- id: z122.string(),
4771
- researchAgentId: z122.string()
5078
+ import { z as z123 } from "zod";
5079
+ var researchDataRemoveSchema = z123.object({
5080
+ id: z123.string(),
5081
+ researchAgentId: z123.string()
4772
5082
  });
4773
5083
 
4774
5084
  // ../../b4m-core/packages/services/dist/src/taskSchedulerService/create.js
4775
- import { z as z123 } from "zod";
4776
- var researchTaskPayload = z123.object({
4777
- id: z123.string(),
4778
- userId: z123.string()
5085
+ import { z as z124 } from "zod";
5086
+ var researchTaskPayload = z124.object({
5087
+ id: z124.string(),
5088
+ userId: z124.string()
4779
5089
  });
4780
- var customTaskPayload = z123.object({
4781
- test: z123.string()
5090
+ var customTaskPayload = z124.object({
5091
+ test: z124.string()
4782
5092
  });
4783
- var taskSchedulerCreate = z123.discriminatedUnion("handler", [
4784
- z123.object({
4785
- handler: z123.literal(TaskScheduleHandler.RESEARCH_TASK_PROCESS),
5093
+ var taskSchedulerCreate = z124.discriminatedUnion("handler", [
5094
+ z124.object({
5095
+ handler: z124.literal(TaskScheduleHandler.RESEARCH_TASK_PROCESS),
4786
5096
  payload: researchTaskPayload,
4787
- processDate: z123.date()
5097
+ processDate: z124.date()
4788
5098
  }),
4789
- z123.object({
4790
- handler: z123.literal(TaskScheduleHandler.CUSTOM_TASK_PROCESS),
5099
+ z124.object({
5100
+ handler: z124.literal(TaskScheduleHandler.CUSTOM_TASK_PROCESS),
4791
5101
  payload: customTaskPayload,
4792
- processDate: z123.date()
5102
+ processDate: z124.date()
4793
5103
  })
4794
5104
  ]);
4795
5105
 
4796
5106
  // ../../b4m-core/packages/services/dist/src/tagService/createFileTag.js
4797
- import { z as z124 } from "zod";
4798
- var tagCreateFileTagSchema = z124.object({
4799
- name: z124.string(),
4800
- icon: z124.string().optional(),
4801
- color: z124.string().optional(),
4802
- description: z124.string().optional()
4803
- });
4804
-
4805
- // ../../b4m-core/packages/services/dist/src/tagService/create.js
4806
5107
  import { z as z125 } from "zod";
4807
- var tagCreateSchema = z125.object({
5108
+ var tagCreateFileTagSchema = z125.object({
4808
5109
  name: z125.string(),
4809
5110
  icon: z125.string().optional(),
4810
- description: z125.string().optional(),
4811
5111
  color: z125.string().optional(),
4812
- type: z125.nativeEnum(TagType)
5112
+ description: z125.string().optional()
4813
5113
  });
4814
5114
 
4815
- // ../../b4m-core/packages/services/dist/src/tagService/update.js
5115
+ // ../../b4m-core/packages/services/dist/src/tagService/create.js
4816
5116
  import { z as z126 } from "zod";
4817
- var tagUpdateSchema = z126.object({
4818
- id: z126.string(),
4819
- name: z126.string().optional(),
5117
+ var tagCreateSchema = z126.object({
5118
+ name: z126.string(),
4820
5119
  icon: z126.string().optional(),
4821
5120
  description: z126.string().optional(),
4822
- color: z126.string().optional()
5121
+ color: z126.string().optional(),
5122
+ type: z126.nativeEnum(TagType)
4823
5123
  });
4824
5124
 
4825
- // ../../b4m-core/packages/services/dist/src/tagService/remove.js
5125
+ // ../../b4m-core/packages/services/dist/src/tagService/update.js
4826
5126
  import { z as z127 } from "zod";
4827
- var tagRemoveSchema = z127.object({
4828
- id: z127.string()
5127
+ var tagUpdateSchema = z127.object({
5128
+ id: z127.string(),
5129
+ name: z127.string().optional(),
5130
+ icon: z127.string().optional(),
5131
+ description: z127.string().optional(),
5132
+ color: z127.string().optional()
4829
5133
  });
4830
5134
 
4831
- // ../../b4m-core/packages/services/dist/src/artifactService/create.js
5135
+ // ../../b4m-core/packages/services/dist/src/tagService/remove.js
4832
5136
  import { z as z128 } from "zod";
4833
- var createArtifactSchema = z128.object({
4834
- id: z128.string().optional(),
5137
+ var tagRemoveSchema = z128.object({
5138
+ id: z128.string()
5139
+ });
5140
+
5141
+ // ../../b4m-core/packages/services/dist/src/artifactService/create.js
5142
+ import { z as z129 } from "zod";
5143
+ var createArtifactSchema = z129.object({
5144
+ id: z129.string().optional(),
4835
5145
  // Allow custom ID for AI-generated artifacts
4836
- type: z128.enum(["mermaid", "recharts", "python", "react", "html", "svg", "code", "quest", "file", "questmaster"]),
4837
- title: z128.string().min(1).max(255),
4838
- description: z128.string().max(1e3).optional(),
4839
- content: z128.string().min(1),
4840
- projectId: z128.string().optional(),
4841
- organizationId: z128.string().optional(),
4842
- visibility: z128.enum(["private", "project", "organization", "public"]).default("private"),
4843
- tags: z128.array(z128.string().max(50)).max(20).default([]),
4844
- versionTag: z128.string().max(100).optional(),
4845
- sourceQuestId: z128.string().optional(),
4846
- sessionId: z128.string().optional(),
4847
- parentArtifactId: z128.string().optional(),
4848
- permissions: z128.object({
4849
- canRead: z128.array(z128.string()).default([]),
4850
- canWrite: z128.array(z128.string()).default([]),
4851
- canDelete: z128.array(z128.string()).default([]),
4852
- isPublic: z128.boolean().default(false),
4853
- inheritFromProject: z128.boolean().default(true)
5146
+ type: z129.enum(["mermaid", "recharts", "python", "react", "html", "svg", "code", "quest", "file", "questmaster"]),
5147
+ title: z129.string().min(1).max(255),
5148
+ description: z129.string().max(1e3).optional(),
5149
+ content: z129.string().min(1),
5150
+ projectId: z129.string().optional(),
5151
+ organizationId: z129.string().optional(),
5152
+ visibility: z129.enum(["private", "project", "organization", "public"]).default("private"),
5153
+ tags: z129.array(z129.string().max(50)).max(20).default([]),
5154
+ versionTag: z129.string().max(100).optional(),
5155
+ sourceQuestId: z129.string().optional(),
5156
+ sessionId: z129.string().optional(),
5157
+ parentArtifactId: z129.string().optional(),
5158
+ permissions: z129.object({
5159
+ canRead: z129.array(z129.string()).default([]),
5160
+ canWrite: z129.array(z129.string()).default([]),
5161
+ canDelete: z129.array(z129.string()).default([]),
5162
+ isPublic: z129.boolean().default(false),
5163
+ inheritFromProject: z129.boolean().default(true)
4854
5164
  }).optional(),
4855
- metadata: z128.record(z128.unknown()).default({})
5165
+ metadata: z129.record(z129.unknown()).default({})
4856
5166
  });
4857
5167
 
4858
5168
  // ../../b4m-core/packages/services/dist/src/artifactService/get.js
4859
- import { z as z129 } from "zod";
4860
- var getArtifactSchema = z129.object({
4861
- id: z129.string(),
4862
- includeContent: z129.boolean().default(false),
4863
- includeVersions: z129.boolean().default(false),
4864
- version: z129.number().optional()
5169
+ import { z as z130 } from "zod";
5170
+ var getArtifactSchema = z130.object({
5171
+ id: z130.string(),
5172
+ includeContent: z130.boolean().default(false),
5173
+ includeVersions: z130.boolean().default(false),
5174
+ version: z130.number().optional()
4865
5175
  });
4866
5176
 
4867
5177
  // ../../b4m-core/packages/services/dist/src/artifactService/list.js
4868
- import { z as z130 } from "zod";
4869
- var listArtifactsSchema = z130.object({
4870
- type: z130.string().optional(),
4871
- status: z130.enum(["draft", "review", "published", "archived"]).optional(),
4872
- visibility: z130.enum(["private", "project", "organization", "public"]).optional(),
4873
- projectId: z130.string().optional(),
4874
- sessionId: z130.string().optional(),
4875
- tags: z130.array(z130.string()).optional(),
4876
- search: z130.string().optional(),
4877
- limit: z130.number().min(1).max(100).default(20),
4878
- offset: z130.number().min(0).default(0),
4879
- sortBy: z130.enum(["createdAt", "updatedAt", "title", "type"]).default("updatedAt"),
4880
- sortOrder: z130.enum(["asc", "desc"]).default("desc"),
4881
- includeDeleted: z130.boolean().default(false)
5178
+ import { z as z131 } from "zod";
5179
+ var listArtifactsSchema = z131.object({
5180
+ type: z131.string().optional(),
5181
+ status: z131.enum(["draft", "review", "published", "archived"]).optional(),
5182
+ visibility: z131.enum(["private", "project", "organization", "public"]).optional(),
5183
+ projectId: z131.string().optional(),
5184
+ sessionId: z131.string().optional(),
5185
+ tags: z131.array(z131.string()).optional(),
5186
+ search: z131.string().optional(),
5187
+ limit: z131.number().min(1).max(100).default(20),
5188
+ offset: z131.number().min(0).default(0),
5189
+ sortBy: z131.enum(["createdAt", "updatedAt", "title", "type"]).default("updatedAt"),
5190
+ sortOrder: z131.enum(["asc", "desc"]).default("desc"),
5191
+ includeDeleted: z131.boolean().default(false)
4882
5192
  });
4883
5193
 
4884
5194
  // ../../b4m-core/packages/services/dist/src/artifactService/update.js
4885
- import { z as z131 } from "zod";
4886
- var updateArtifactSchema = z131.object({
4887
- id: z131.string(),
4888
- title: z131.string().min(1).max(255).optional(),
4889
- description: z131.string().max(1e3).optional(),
4890
- content: z131.string().optional(),
4891
- visibility: z131.enum(["private", "project", "organization", "public"]).optional(),
4892
- status: z131.enum(["draft", "review", "published", "archived"]).optional(),
4893
- tags: z131.array(z131.string().max(50)).max(20).optional(),
4894
- versionTag: z131.string().max(100).optional(),
4895
- permissions: z131.object({
4896
- canRead: z131.array(z131.string()).optional(),
4897
- canWrite: z131.array(z131.string()).optional(),
4898
- canDelete: z131.array(z131.string()).optional(),
4899
- isPublic: z131.boolean().optional(),
4900
- inheritFromProject: z131.boolean().optional()
5195
+ import { z as z132 } from "zod";
5196
+ var updateArtifactSchema = z132.object({
5197
+ id: z132.string(),
5198
+ title: z132.string().min(1).max(255).optional(),
5199
+ description: z132.string().max(1e3).optional(),
5200
+ content: z132.string().optional(),
5201
+ visibility: z132.enum(["private", "project", "organization", "public"]).optional(),
5202
+ status: z132.enum(["draft", "review", "published", "archived"]).optional(),
5203
+ tags: z132.array(z132.string().max(50)).max(20).optional(),
5204
+ versionTag: z132.string().max(100).optional(),
5205
+ permissions: z132.object({
5206
+ canRead: z132.array(z132.string()).optional(),
5207
+ canWrite: z132.array(z132.string()).optional(),
5208
+ canDelete: z132.array(z132.string()).optional(),
5209
+ isPublic: z132.boolean().optional(),
5210
+ inheritFromProject: z132.boolean().optional()
4901
5211
  }).optional(),
4902
- metadata: z131.record(z131.unknown()).optional(),
4903
- changes: z131.array(z131.string()).optional(),
4904
- changeDescription: z131.string().max(1e3).optional(),
4905
- createNewVersion: z131.boolean().optional(),
4906
- versionMessage: z131.string().max(500).optional()
5212
+ metadata: z132.record(z132.unknown()).optional(),
5213
+ changes: z132.array(z132.string()).optional(),
5214
+ changeDescription: z132.string().max(1e3).optional(),
5215
+ createNewVersion: z132.boolean().optional(),
5216
+ versionMessage: z132.string().max(500).optional()
4907
5217
  });
4908
5218
 
4909
5219
  // ../../b4m-core/packages/services/dist/src/artifactService/delete.js
4910
- import { z as z132 } from "zod";
4911
- var deleteArtifactSchema = z132.object({
4912
- id: z132.string(),
4913
- hardDelete: z132.boolean().default(false)
5220
+ import { z as z133 } from "zod";
5221
+ var deleteArtifactSchema = z133.object({
5222
+ id: z133.string(),
5223
+ hardDelete: z133.boolean().default(false)
4914
5224
  // For future implementation
4915
5225
  });
4916
5226
 
4917
5227
  // ../../b4m-core/packages/services/dist/src/questMasterService/create.js
4918
- import { z as z133 } from "zod";
4919
- var questSchema = z133.object({
4920
- id: z133.string(),
4921
- title: z133.string().min(1).max(255),
4922
- description: z133.string().max(1e3),
4923
- status: z133.enum(["not_started", "in_progress", "completed", "blocked"]).default("not_started"),
4924
- order: z133.number().min(0),
4925
- dependencies: z133.array(z133.string()).default([]),
4926
- estimatedTime: z133.string().optional()
4927
- });
4928
- var questResourceSchema = z133.object({
4929
- title: z133.string().min(1).max(255),
4930
- url: z133.string().url(),
4931
- type: z133.enum(["documentation", "tutorial", "reference", "example"])
4932
- });
4933
- var createQuestMasterSchema = z133.object({
4934
- title: z133.string().min(1).max(255),
4935
- description: z133.string().max(1e3).optional(),
4936
- goal: z133.string().min(1).max(1e3),
4937
- complexity: z133.enum(["beginner", "intermediate", "advanced", "expert"]),
4938
- estimatedTotalTime: z133.string().optional(),
4939
- prerequisites: z133.array(z133.string().max(200)).default([]),
4940
- quests: z133.array(questSchema).min(1),
4941
- resources: z133.array(questResourceSchema).default([]),
4942
- projectId: z133.string().optional(),
4943
- organizationId: z133.string().optional(),
4944
- visibility: z133.enum(["private", "project", "organization", "public"]).default("private"),
4945
- tags: z133.array(z133.string().max(50)).max(20).default([]),
4946
- permissions: z133.object({
4947
- canRead: z133.array(z133.string()).default([]),
4948
- canWrite: z133.array(z133.string()).default([]),
4949
- canDelete: z133.array(z133.string()).default([]),
4950
- isPublic: z133.boolean().default(false),
4951
- inheritFromProject: z133.boolean().default(true)
5228
+ import { z as z134 } from "zod";
5229
+ var questSchema = z134.object({
5230
+ id: z134.string(),
5231
+ title: z134.string().min(1).max(255),
5232
+ description: z134.string().max(1e3),
5233
+ status: z134.enum(["not_started", "in_progress", "completed", "blocked"]).default("not_started"),
5234
+ order: z134.number().min(0),
5235
+ dependencies: z134.array(z134.string()).default([]),
5236
+ estimatedTime: z134.string().optional()
5237
+ });
5238
+ var questResourceSchema = z134.object({
5239
+ title: z134.string().min(1).max(255),
5240
+ url: z134.string().url(),
5241
+ type: z134.enum(["documentation", "tutorial", "reference", "example"])
5242
+ });
5243
+ var createQuestMasterSchema = z134.object({
5244
+ title: z134.string().min(1).max(255),
5245
+ description: z134.string().max(1e3).optional(),
5246
+ goal: z134.string().min(1).max(1e3),
5247
+ complexity: z134.enum(["beginner", "intermediate", "advanced", "expert"]),
5248
+ estimatedTotalTime: z134.string().optional(),
5249
+ prerequisites: z134.array(z134.string().max(200)).default([]),
5250
+ quests: z134.array(questSchema).min(1),
5251
+ resources: z134.array(questResourceSchema).default([]),
5252
+ projectId: z134.string().optional(),
5253
+ organizationId: z134.string().optional(),
5254
+ visibility: z134.enum(["private", "project", "organization", "public"]).default("private"),
5255
+ tags: z134.array(z134.string().max(50)).max(20).default([]),
5256
+ permissions: z134.object({
5257
+ canRead: z134.array(z134.string()).default([]),
5258
+ canWrite: z134.array(z134.string()).default([]),
5259
+ canDelete: z134.array(z134.string()).default([]),
5260
+ isPublic: z134.boolean().default(false),
5261
+ inheritFromProject: z134.boolean().default(true)
4952
5262
  }).optional(),
4953
- sourceQuestId: z133.string().optional(),
4954
- sessionId: z133.string().optional(),
4955
- metadata: z133.record(z133.unknown()).default({})
5263
+ sourceQuestId: z134.string().optional(),
5264
+ sessionId: z134.string().optional(),
5265
+ metadata: z134.record(z134.unknown()).default({})
4956
5266
  });
4957
5267
 
4958
5268
  // ../../b4m-core/packages/services/dist/src/questMasterService/updateQuestStatus.js
4959
- import { z as z134 } from "zod";
4960
- var updateQuestStatusSchema = z134.object({
4961
- artifactId: z134.string(),
4962
- questId: z134.string(),
4963
- status: z134.enum(["not_started", "in_progress", "completed", "blocked"]),
4964
- completionNote: z134.string().max(500).optional()
5269
+ import { z as z135 } from "zod";
5270
+ var updateQuestStatusSchema = z135.object({
5271
+ artifactId: z135.string(),
5272
+ questId: z135.string(),
5273
+ status: z135.enum(["not_started", "in_progress", "completed", "blocked"]),
5274
+ completionNote: z135.string().max(500).optional()
4965
5275
  });
4966
5276
 
4967
5277
  // ../../b4m-core/packages/services/dist/src/dataLakeService/opensearchClient.js
@@ -4981,63 +5291,63 @@ import { v4 as uuidv44 } from "uuid";
4981
5291
  import { randomUUID as randomUUID5 } from "crypto";
4982
5292
 
4983
5293
  // ../../b4m-core/packages/services/dist/src/emailIngestionService/types.js
4984
- import { z as z135 } from "zod";
4985
- var processIngestedEmailOptionsSchema = z135.object({
4986
- platformDomain: z135.string().optional(),
4987
- isNewsletter: z135.boolean().optional()
5294
+ import { z as z136 } from "zod";
5295
+ var processIngestedEmailOptionsSchema = z136.object({
5296
+ platformDomain: z136.string().optional(),
5297
+ isNewsletter: z136.boolean().optional()
4988
5298
  }).optional();
4989
- var emailAttachmentSchema = z135.object({
4990
- filename: z135.string().optional(),
4991
- contentType: z135.string().optional(),
4992
- contentDisposition: z135.string().optional(),
4993
- size: z135.number().min(0),
4994
- content: z135.instanceof(Buffer),
4995
- related: z135.boolean().optional()
4996
- });
4997
- var parsedEmailObjectSchema = z135.object({
4998
- messageId: z135.string().optional(),
4999
- inReplyTo: z135.string().optional(),
5000
- references: z135.union([z135.string(), z135.array(z135.string())]).optional(),
5001
- from: z135.any().optional(),
5299
+ var emailAttachmentSchema = z136.object({
5300
+ filename: z136.string().optional(),
5301
+ contentType: z136.string().optional(),
5302
+ contentDisposition: z136.string().optional(),
5303
+ size: z136.number().min(0),
5304
+ content: z136.instanceof(Buffer),
5305
+ related: z136.boolean().optional()
5306
+ });
5307
+ var parsedEmailObjectSchema = z136.object({
5308
+ messageId: z136.string().optional(),
5309
+ inReplyTo: z136.string().optional(),
5310
+ references: z136.union([z136.string(), z136.array(z136.string())]).optional(),
5311
+ from: z136.any().optional(),
5002
5312
  // Complex email address object
5003
- to: z135.any().optional(),
5004
- cc: z135.any().optional(),
5005
- bcc: z135.any().optional(),
5006
- subject: z135.string().optional(),
5007
- date: z135.date().optional(),
5008
- text: z135.string().optional(),
5009
- html: z135.string().optional(),
5010
- attachments: z135.array(emailAttachmentSchema).optional()
5011
- });
5012
- var processIngestedEmailSchema = z135.object({
5313
+ to: z136.any().optional(),
5314
+ cc: z136.any().optional(),
5315
+ bcc: z136.any().optional(),
5316
+ subject: z136.string().optional(),
5317
+ date: z136.date().optional(),
5318
+ text: z136.string().optional(),
5319
+ html: z136.string().optional(),
5320
+ attachments: z136.array(emailAttachmentSchema).optional()
5321
+ });
5322
+ var processIngestedEmailSchema = z136.object({
5013
5323
  parsedEmail: parsedEmailObjectSchema,
5014
- rawEmailS3Key: z135.string().min(1, "rawEmailS3Key cannot be empty"),
5324
+ rawEmailS3Key: z136.string().min(1, "rawEmailS3Key cannot be empty"),
5015
5325
  options: processIngestedEmailOptionsSchema
5016
5326
  });
5017
5327
 
5018
5328
  // ../../b4m-core/packages/services/dist/src/emailAnalysisService/types.js
5019
- import { z as z136 } from "zod";
5020
- var llmAnalysisResponseSchema = z136.object({
5021
- summary: z136.string().min(1, "Summary cannot be empty"),
5022
- entities: z136.object({
5023
- companies: z136.array(z136.string()).default([]),
5024
- people: z136.array(z136.string()).default([]),
5025
- products: z136.array(z136.string()).default([]),
5026
- technologies: z136.array(z136.string()).default([])
5329
+ import { z as z137 } from "zod";
5330
+ var llmAnalysisResponseSchema = z137.object({
5331
+ summary: z137.string().min(1, "Summary cannot be empty"),
5332
+ entities: z137.object({
5333
+ companies: z137.array(z137.string()).default([]),
5334
+ people: z137.array(z137.string()).default([]),
5335
+ products: z137.array(z137.string()).default([]),
5336
+ technologies: z137.array(z137.string()).default([])
5027
5337
  }),
5028
- sentiment: z136.enum(["positive", "neutral", "negative", "urgent"]),
5029
- actionItems: z136.array(z136.object({
5030
- description: z136.string(),
5031
- deadline: z136.string().optional()
5338
+ sentiment: z137.enum(["positive", "neutral", "negative", "urgent"]),
5339
+ actionItems: z137.array(z137.object({
5340
+ description: z137.string(),
5341
+ deadline: z137.string().optional()
5032
5342
  // ISO date string from LLM
5033
5343
  })).default([]),
5034
- privacyRecommendation: z136.enum(["public", "team", "private"]),
5035
- embargoDetected: z136.boolean().default(false),
5036
- suggestedTags: z136.array(z136.string()).default([])
5344
+ privacyRecommendation: z137.enum(["public", "team", "private"]),
5345
+ embargoDetected: z137.boolean().default(false),
5346
+ suggestedTags: z137.array(z137.string()).default([])
5037
5347
  });
5038
5348
 
5039
5349
  // ../../b4m-core/packages/services/dist/src/llm/ChatCompletion.js
5040
- import { z as z138 } from "zod";
5350
+ import { z as z139 } from "zod";
5041
5351
 
5042
5352
  // ../../b4m-core/packages/services/dist/src/llm/ChatCompletionInvoke.js
5043
5353
  import { fromZodError } from "zod-validation-error";
@@ -5151,8 +5461,8 @@ async function processAndStoreImages(images, context) {
5151
5461
  const buffer = await downloadImage(image);
5152
5462
  const fileType = await fileTypeFromBuffer2(buffer);
5153
5463
  const filename = `${uuidv45()}.${fileType?.ext}`;
5154
- const path15 = await context.imageGenerateStorage.upload(buffer, filename, {});
5155
- return path15;
5464
+ const path16 = await context.imageGenerateStorage.upload(buffer, filename, {});
5465
+ return path16;
5156
5466
  }));
5157
5467
  }
5158
5468
  async function updateQuestAndReturnMarkdown(storedImageUrls, context) {
@@ -6125,17 +6435,17 @@ var rechartsTool = {
6125
6435
  };
6126
6436
 
6127
6437
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/editFile/index.js
6128
- import { z as z137 } from "zod";
6438
+ import { z as z138 } from "zod";
6129
6439
  import { diffLines as diffLines2 } from "diff";
6130
- var editFileSchema = z137.object({
6131
- fileId: z137.string().describe("The ID of the file to edit"),
6132
- instruction: z137.string().describe("Natural language instruction describing the changes to make"),
6133
- selection: z137.object({
6134
- start: z137.number().describe("Starting character position of the selection"),
6135
- end: z137.number().describe("Ending character position of the selection")
6440
+ var editFileSchema = z138.object({
6441
+ fileId: z138.string().describe("The ID of the file to edit"),
6442
+ instruction: z138.string().describe("Natural language instruction describing the changes to make"),
6443
+ selection: z138.object({
6444
+ start: z138.number().describe("Starting character position of the selection"),
6445
+ end: z138.number().describe("Ending character position of the selection")
6136
6446
  }).optional().describe("Optional selection range to edit within the file"),
6137
- preserveFormatting: z137.boolean().optional().default(true).describe("Whether to preserve the original formatting style"),
6138
- returnDiff: z137.boolean().optional().default(true).describe("Whether to return a diff of the changes")
6447
+ preserveFormatting: z138.boolean().optional().default(true).describe("Whether to preserve the original formatting style"),
6448
+ returnDiff: z138.boolean().optional().default(true).describe("Whether to return a diff of the changes")
6139
6449
  });
6140
6450
  function generateSimpleDiff(original, modified) {
6141
6451
  const differences = diffLines2(original, modified);
@@ -6364,8 +6674,8 @@ async function processAndStoreImage(imageUrl, context) {
6364
6674
  const buffer = await downloadImage2(imageUrl);
6365
6675
  const fileType = await fileTypeFromBuffer3(buffer);
6366
6676
  const filename = `${uuidv46()}.${fileType?.ext}`;
6367
- const path15 = await context.imageGenerateStorage.upload(buffer, filename, {});
6368
- return path15;
6677
+ const path16 = await context.imageGenerateStorage.upload(buffer, filename, {});
6678
+ return path16;
6369
6679
  }
6370
6680
  async function updateQuestAndReturnMarkdown2(storedImagePath, context) {
6371
6681
  await context.onFinish?.("edit_image", storedImagePath);
@@ -7894,8 +8204,8 @@ var getHeliocentricCoords = (planet, T) => {
7894
8204
  const sinNode = Math.sin(longNode);
7895
8205
  const x = r * (cosNode * cosOmega - sinNode * sinOmega * cosI);
7896
8206
  const y = r * (sinNode * cosOmega + cosNode * sinOmega * cosI);
7897
- const z144 = r * sinOmega * sinI;
7898
- return { x, y, z: z144, r };
8207
+ const z145 = r * sinOmega * sinI;
8208
+ return { x, y, z: z145, r };
7899
8209
  };
7900
8210
  var getGeocentricEcliptic = (planet, earth) => {
7901
8211
  const dx = planet.x - earth.x;
@@ -8202,15 +8512,15 @@ var planetVisibilityTool = {
8202
8512
  };
8203
8513
 
8204
8514
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/fileRead/index.js
8205
- import { promises as fs7 } from "fs";
8515
+ import { promises as fs8 } from "fs";
8206
8516
  import { existsSync as existsSync4, statSync as statSync4 } from "fs";
8207
- import path6 from "path";
8517
+ import path7 from "path";
8208
8518
  var MAX_FILE_SIZE2 = 10 * 1024 * 1024;
8209
8519
  async function readFileContent(params) {
8210
8520
  const { path: filePath, encoding = "utf-8", maxLines } = params;
8211
- const normalizedPath = path6.normalize(filePath);
8212
- const resolvedPath = path6.resolve(process.cwd(), normalizedPath);
8213
- const cwd = path6.resolve(process.cwd());
8521
+ const normalizedPath = path7.normalize(filePath);
8522
+ const resolvedPath = path7.resolve(process.cwd(), normalizedPath);
8523
+ const cwd = path7.resolve(process.cwd());
8214
8524
  if (!resolvedPath.startsWith(cwd)) {
8215
8525
  throw new Error(`Access denied: Cannot read files outside of current working directory`);
8216
8526
  }
@@ -8228,7 +8538,7 @@ async function readFileContent(params) {
8228
8538
  if (isBinary && encoding === "utf-8") {
8229
8539
  throw new Error(`File appears to be binary. Use encoding 'base64' to read binary files, or specify a different encoding.`);
8230
8540
  }
8231
- const content = await fs7.readFile(resolvedPath, encoding);
8541
+ const content = await fs8.readFile(resolvedPath, encoding);
8232
8542
  if (maxLines && typeof content === "string") {
8233
8543
  const lines = content.split("\n");
8234
8544
  if (lines.length > maxLines) {
@@ -8243,7 +8553,7 @@ ${content}`;
8243
8553
  }
8244
8554
  async function checkIfBinary(filePath) {
8245
8555
  const buffer = Buffer.alloc(8192);
8246
- const fd = await fs7.open(filePath, "r");
8556
+ const fd = await fs8.open(filePath, "r");
8247
8557
  try {
8248
8558
  const { bytesRead } = await fd.read(buffer, 0, 8192, 0);
8249
8559
  const chunk = buffer.slice(0, bytesRead);
@@ -8260,7 +8570,7 @@ var fileReadTool = {
8260
8570
  context.logger.info("\u{1F4C4} FileRead: Reading file", { path: params.path });
8261
8571
  try {
8262
8572
  const content = await readFileContent(params);
8263
- const stats = statSync4(path6.resolve(process.cwd(), path6.normalize(params.path)));
8573
+ const stats = statSync4(path7.resolve(process.cwd(), path7.normalize(params.path)));
8264
8574
  context.logger.info("\u2705 FileRead: Success", {
8265
8575
  path: params.path,
8266
8576
  size: stats.size,
@@ -8300,25 +8610,25 @@ var fileReadTool = {
8300
8610
  };
8301
8611
 
8302
8612
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/createFile/index.js
8303
- import { promises as fs8 } from "fs";
8613
+ import { promises as fs9 } from "fs";
8304
8614
  import { existsSync as existsSync5 } from "fs";
8305
- import path7 from "path";
8615
+ import path8 from "path";
8306
8616
  async function createFile(params) {
8307
8617
  const { path: filePath, content, createDirectories = true } = params;
8308
- const normalizedPath = path7.normalize(filePath);
8309
- const resolvedPath = path7.resolve(process.cwd(), normalizedPath);
8310
- const cwd = path7.resolve(process.cwd());
8618
+ const normalizedPath = path8.normalize(filePath);
8619
+ const resolvedPath = path8.resolve(process.cwd(), normalizedPath);
8620
+ const cwd = path8.resolve(process.cwd());
8311
8621
  if (!resolvedPath.startsWith(cwd)) {
8312
8622
  throw new Error(`Access denied: Cannot create files outside of current working directory`);
8313
8623
  }
8314
8624
  const fileExists = existsSync5(resolvedPath);
8315
8625
  const action = fileExists ? "overwritten" : "created";
8316
8626
  if (createDirectories) {
8317
- const dir = path7.dirname(resolvedPath);
8318
- await fs8.mkdir(dir, { recursive: true });
8627
+ const dir = path8.dirname(resolvedPath);
8628
+ await fs9.mkdir(dir, { recursive: true });
8319
8629
  }
8320
- await fs8.writeFile(resolvedPath, content, "utf-8");
8321
- const stats = await fs8.stat(resolvedPath);
8630
+ await fs9.writeFile(resolvedPath, content, "utf-8");
8631
+ const stats = await fs9.stat(resolvedPath);
8322
8632
  const lines = content.split("\n").length;
8323
8633
  return `File ${action} successfully: ${filePath}
8324
8634
  Size: ${stats.size} bytes
@@ -8329,7 +8639,7 @@ var createFileTool = {
8329
8639
  implementation: (context) => ({
8330
8640
  toolFn: async (value) => {
8331
8641
  const params = value;
8332
- const fileExists = existsSync5(path7.resolve(process.cwd(), path7.normalize(params.path)));
8642
+ const fileExists = existsSync5(path8.resolve(process.cwd(), path8.normalize(params.path)));
8333
8643
  context.logger.info(`\u{1F4DD} CreateFile: ${fileExists ? "Overwriting" : "Creating"} file`, {
8334
8644
  path: params.path,
8335
8645
  size: params.content.length
@@ -8371,7 +8681,7 @@ var createFileTool = {
8371
8681
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/globFiles/index.js
8372
8682
  import { readdir } from "fs/promises";
8373
8683
  import { statSync as statSync5 } from "fs";
8374
- import path8 from "path";
8684
+ import path9 from "path";
8375
8685
  function matchGlob(filePath, pattern) {
8376
8686
  let regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (_, options) => `(${options.split(",").join("|")})`).replace(/\[([^\]]+)\]/g, "[$1]");
8377
8687
  regexPattern = regexPattern.replace(/\{\{GLOBSTAR\}\}\//g, "(.*/)?").replace(/\/\{\{GLOBSTAR\}\}/g, "(/.*)?").replace(/\{\{GLOBSTAR\}\}/g, ".*");
@@ -8389,8 +8699,8 @@ async function walkDir(dir, pattern, includeHidden, maxResults, basePath = "") {
8389
8699
  if (!includeHidden && entry.name.startsWith(".")) {
8390
8700
  continue;
8391
8701
  }
8392
- const relativePath = basePath ? path8.join(basePath, entry.name) : entry.name;
8393
- const fullPath = path8.join(dir, entry.name);
8702
+ const relativePath = basePath ? path9.join(basePath, entry.name) : entry.name;
8703
+ const fullPath = path9.join(dir, entry.name);
8394
8704
  if (matchGlob(relativePath, pattern)) {
8395
8705
  matches.push(relativePath);
8396
8706
  }
@@ -8406,7 +8716,7 @@ async function walkDir(dir, pattern, includeHidden, maxResults, basePath = "") {
8406
8716
  async function listFiles(params) {
8407
8717
  const { pattern, cwd: relativeCwd, includeHidden = false, maxResults = 1e3 } = params;
8408
8718
  const baseCwd = process.cwd();
8409
- const targetCwd = relativeCwd ? path8.resolve(baseCwd, path8.normalize(relativeCwd)) : baseCwd;
8719
+ const targetCwd = relativeCwd ? path9.resolve(baseCwd, path9.normalize(relativeCwd)) : baseCwd;
8410
8720
  if (!targetCwd.startsWith(baseCwd)) {
8411
8721
  throw new Error(`Access denied: Cannot list files outside of current working directory`);
8412
8722
  }
@@ -8417,7 +8727,7 @@ async function listFiles(params) {
8417
8727
  const filesInfo = [];
8418
8728
  for (const match of matches) {
8419
8729
  try {
8420
- const fullPath = path8.join(targetCwd, match);
8730
+ const fullPath = path9.join(targetCwd, match);
8421
8731
  const stats = statSync5(fullPath);
8422
8732
  filesInfo.push({
8423
8733
  path: match,
@@ -8500,7 +8810,7 @@ var globFilesTool = {
8500
8810
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/grepSearch/index.js
8501
8811
  import { readdir as readdir2 } from "fs/promises";
8502
8812
  import { readFileSync as readFileSync3, statSync as statSync6 } from "fs";
8503
- import path9 from "path";
8813
+ import path10 from "path";
8504
8814
  var MAX_FILE_SIZE3 = 10 * 1024 * 1024;
8505
8815
  function matchGlob2(filePath, pattern) {
8506
8816
  const regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*/g, "{{GLOBSTAR}}").replace(/\*/g, "[^/]*").replace(/\{\{GLOBSTAR\}\}/g, ".*").replace(/\?/g, ".").replace(/\{([^}]+)\}/g, (_, options) => `(${options.split(",").join("|")})`).replace(/\[([^\]]+)\]/g, "[$1]");
@@ -8518,8 +8828,8 @@ async function walkDir2(dir, pattern, maxResults, basePath = "") {
8518
8828
  if (entry.name.startsWith(".")) {
8519
8829
  continue;
8520
8830
  }
8521
- const relativePath = basePath ? path9.join(basePath, entry.name) : entry.name;
8522
- const fullPath = path9.join(dir, entry.name);
8831
+ const relativePath = basePath ? path10.join(basePath, entry.name) : entry.name;
8832
+ const fullPath = path10.join(dir, entry.name);
8523
8833
  if (matchGlob2(relativePath, pattern)) {
8524
8834
  matches.push(relativePath);
8525
8835
  }
@@ -8535,7 +8845,7 @@ async function walkDir2(dir, pattern, maxResults, basePath = "") {
8535
8845
  async function searchFiles2(params) {
8536
8846
  const { pattern, filePattern = "**/*", cwd: relativeCwd, caseSensitive = false, maxResults = 100, contextLines = 0 } = params;
8537
8847
  const baseCwd = process.cwd();
8538
- const targetCwd = relativeCwd ? path9.resolve(baseCwd, path9.normalize(relativeCwd)) : baseCwd;
8848
+ const targetCwd = relativeCwd ? path10.resolve(baseCwd, path10.normalize(relativeCwd)) : baseCwd;
8539
8849
  if (!targetCwd.startsWith(baseCwd)) {
8540
8850
  throw new Error(`Access denied: Cannot search files outside of current working directory`);
8541
8851
  }
@@ -8549,7 +8859,7 @@ async function searchFiles2(params) {
8549
8859
  const filesToSearch = await walkDir2(targetCwd, filePattern, 1e4);
8550
8860
  const filteredFiles = [];
8551
8861
  for (const match of filesToSearch) {
8552
- const fullPath = path9.join(targetCwd, match);
8862
+ const fullPath = path10.join(targetCwd, match);
8553
8863
  try {
8554
8864
  const stats = statSync6(fullPath);
8555
8865
  if (stats.isDirectory() || stats.size > MAX_FILE_SIZE3) {
@@ -8573,7 +8883,7 @@ async function searchFiles2(params) {
8573
8883
  break;
8574
8884
  }
8575
8885
  filesSearched++;
8576
- const fullPath = path9.join(targetCwd, file);
8886
+ const fullPath = path10.join(targetCwd, file);
8577
8887
  try {
8578
8888
  const content = readFileSync3(fullPath, "utf-8");
8579
8889
  const lines = content.split("\n");
@@ -8708,14 +9018,14 @@ var grepSearchTool = {
8708
9018
  };
8709
9019
 
8710
9020
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/deleteFile/index.js
8711
- import { promises as fs9 } from "fs";
9021
+ import { promises as fs10 } from "fs";
8712
9022
  import { existsSync as existsSync6, statSync as statSync7 } from "fs";
8713
- import path10 from "path";
9023
+ import path11 from "path";
8714
9024
  async function deleteFile(params) {
8715
9025
  const { path: filePath, recursive = false } = params;
8716
- const normalizedPath = path10.normalize(filePath);
8717
- const resolvedPath = path10.resolve(process.cwd(), normalizedPath);
8718
- const cwd = path10.resolve(process.cwd());
9026
+ const normalizedPath = path11.normalize(filePath);
9027
+ const resolvedPath = path11.resolve(process.cwd(), normalizedPath);
9028
+ const cwd = path11.resolve(process.cwd());
8719
9029
  if (!resolvedPath.startsWith(cwd)) {
8720
9030
  throw new Error(`Access denied: Cannot delete files outside of current working directory`);
8721
9031
  }
@@ -8729,10 +9039,10 @@ async function deleteFile(params) {
8729
9039
  throw new Error(`Path is a directory: ${filePath}. Use recursive=true to delete directories and their contents.`);
8730
9040
  }
8731
9041
  if (isDirectory) {
8732
- await fs9.rm(resolvedPath, { recursive: true, force: true });
9042
+ await fs10.rm(resolvedPath, { recursive: true, force: true });
8733
9043
  return `Directory deleted successfully: ${filePath}`;
8734
9044
  } else {
8735
- await fs9.unlink(resolvedPath);
9045
+ await fs10.unlink(resolvedPath);
8736
9046
  return `File deleted successfully: ${filePath}
8737
9047
  Size: ${size} bytes`;
8738
9048
  }
@@ -8742,7 +9052,7 @@ var deleteFileTool = {
8742
9052
  implementation: (context) => ({
8743
9053
  toolFn: async (value) => {
8744
9054
  const params = value;
8745
- const resolvedPath = path10.resolve(process.cwd(), path10.normalize(params.path));
9055
+ const resolvedPath = path11.resolve(process.cwd(), path11.normalize(params.path));
8746
9056
  const isDirectory = existsSync6(resolvedPath) && statSync7(resolvedPath).isDirectory();
8747
9057
  context.logger.info(`\u{1F5D1}\uFE0F DeleteFile: Deleting ${isDirectory ? "directory" : "file"}`, {
8748
9058
  path: params.path,
@@ -8780,7 +9090,7 @@ var deleteFileTool = {
8780
9090
 
8781
9091
  // ../../b4m-core/packages/services/dist/src/llm/tools/implementation/bashExecute/index.js
8782
9092
  import { spawn } from "child_process";
8783
- import path11 from "path";
9093
+ import path12 from "path";
8784
9094
  var DEFAULT_TIMEOUT_MS = 6e4;
8785
9095
  var MAX_OUTPUT_SIZE = 100 * 1024;
8786
9096
  var DANGEROUS_PATTERNS = [
@@ -8964,7 +9274,7 @@ async function executeBashCommand(params) {
8964
9274
  };
8965
9275
  }
8966
9276
  const baseCwd = process.cwd();
8967
- const targetCwd = relativeCwd ? path11.resolve(baseCwd, relativeCwd) : baseCwd;
9277
+ const targetCwd = relativeCwd ? path12.resolve(baseCwd, relativeCwd) : baseCwd;
8968
9278
  const effectiveTimeout = Math.min(timeout, 5 * 60 * 1e3);
8969
9279
  return new Promise((resolve3) => {
8970
9280
  let stdout = "";
@@ -9298,42 +9608,42 @@ var DISABLE_SERVER_THROTTLING = process.env.DISABLE_SERVER_THROTTLING === "true"
9298
9608
  var questSaveMutex = new Mutex();
9299
9609
 
9300
9610
  // ../../b4m-core/packages/services/dist/src/llm/ChatCompletion.js
9301
- var QuestStartBodySchema = z138.object({
9302
- userId: z138.string(),
9303
- sessionId: z138.string(),
9304
- questId: z138.string(),
9305
- message: z138.string(),
9306
- messageFileIds: z138.array(z138.string()),
9307
- historyCount: z138.number(),
9308
- fabFileIds: z138.array(z138.string()),
9611
+ var QuestStartBodySchema = z139.object({
9612
+ userId: z139.string(),
9613
+ sessionId: z139.string(),
9614
+ questId: z139.string(),
9615
+ message: z139.string(),
9616
+ messageFileIds: z139.array(z139.string()),
9617
+ historyCount: z139.number(),
9618
+ fabFileIds: z139.array(z139.string()),
9309
9619
  params: ChatCompletionCreateInputSchema,
9310
9620
  dashboardParams: DashboardParamsSchema.optional(),
9311
- enableQuestMaster: z138.boolean().optional(),
9312
- enableMementos: z138.boolean().optional(),
9313
- enableArtifacts: z138.boolean().optional(),
9314
- enableAgents: z138.boolean().optional(),
9621
+ enableQuestMaster: z139.boolean().optional(),
9622
+ enableMementos: z139.boolean().optional(),
9623
+ enableArtifacts: z139.boolean().optional(),
9624
+ enableAgents: z139.boolean().optional(),
9315
9625
  promptMeta: PromptMetaZodSchema,
9316
- tools: z138.array(z138.union([b4mLLMTools, z138.string()])).optional(),
9317
- mcpServers: z138.array(z138.string()).optional(),
9318
- projectId: z138.string().optional(),
9319
- organizationId: z138.string().nullable().optional(),
9626
+ tools: z139.array(z139.union([b4mLLMTools, z139.string()])).optional(),
9627
+ mcpServers: z139.array(z139.string()).optional(),
9628
+ projectId: z139.string().optional(),
9629
+ organizationId: z139.string().nullable().optional(),
9320
9630
  questMaster: QuestMasterParamsSchema.optional(),
9321
- toolPromptId: z138.string().optional(),
9631
+ toolPromptId: z139.string().optional(),
9322
9632
  researchMode: ResearchModeParamsSchema.optional(),
9323
- fallbackModel: z138.string().optional(),
9324
- embeddingModel: z138.string().optional(),
9325
- queryComplexity: z138.string(),
9633
+ fallbackModel: z139.string().optional(),
9634
+ embeddingModel: z139.string().optional(),
9635
+ queryComplexity: z139.string(),
9326
9636
  imageConfig: GenerateImageToolCallSchema.optional(),
9327
- deepResearchConfig: z138.object({
9328
- maxDepth: z138.number().optional(),
9329
- duration: z138.number().optional(),
9637
+ deepResearchConfig: z139.object({
9638
+ maxDepth: z139.number().optional(),
9639
+ duration: z139.number().optional(),
9330
9640
  // Note: searchers are passed via ToolContext and not through this API schema
9331
- searchers: z138.array(z138.any()).optional()
9641
+ searchers: z139.array(z139.any()).optional()
9332
9642
  }).optional(),
9333
- extraContextMessages: z138.array(z138.object({
9334
- role: z138.enum(["user", "assistant", "system", "function", "tool"]),
9335
- content: z138.union([z138.string(), z138.array(z138.any())]),
9336
- fabFileIds: z138.array(z138.string()).optional()
9643
+ extraContextMessages: z139.array(z139.object({
9644
+ role: z139.enum(["user", "assistant", "system", "function", "tool"]),
9645
+ content: z139.union([z139.string(), z139.array(z139.any())]),
9646
+ fabFileIds: z139.array(z139.string()).optional()
9337
9647
  })).optional()
9338
9648
  });
9339
9649
 
@@ -9341,30 +9651,9 @@ var QuestStartBodySchema = z138.object({
9341
9651
  import axios8 from "axios";
9342
9652
  import { fileTypeFromBuffer as fileTypeFromBuffer4 } from "file-type";
9343
9653
  import { v4 as uuidv47 } from "uuid";
9344
- import { z as z139 } from "zod";
9654
+ import { z as z140 } from "zod";
9345
9655
  import { fromZodError as fromZodError2 } from "zod-validation-error";
9346
9656
  var ImageGenerationBodySchema = OpenAIImageGenerationInput.extend({
9347
- sessionId: z139.string(),
9348
- questId: z139.string(),
9349
- userId: z139.string(),
9350
- prompt: z139.string(),
9351
- safety_tolerance: z139.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
9352
- prompt_upsampling: z139.boolean().optional().default(false),
9353
- seed: z139.number().nullable().optional(),
9354
- output_format: z139.enum(["jpeg", "png"]).nullable().optional().default("png"),
9355
- width: z139.number().optional(),
9356
- height: z139.number().optional(),
9357
- aspect_ratio: z139.string().optional(),
9358
- fabFileIds: z139.array(z139.string()).optional()
9359
- });
9360
-
9361
- // ../../b4m-core/packages/services/dist/src/llm/ImageEdit.js
9362
- import axios9 from "axios";
9363
- import { fileTypeFromBuffer as fileTypeFromBuffer5 } from "file-type";
9364
- import { v4 as uuidv48 } from "uuid";
9365
- import { z as z140 } from "zod";
9366
- import { fromZodError as fromZodError3 } from "zod-validation-error";
9367
- var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
9368
9657
  sessionId: z140.string(),
9369
9658
  questId: z140.string(),
9370
9659
  userId: z140.string(),
@@ -9372,35 +9661,56 @@ var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
9372
9661
  safety_tolerance: z140.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
9373
9662
  prompt_upsampling: z140.boolean().optional().default(false),
9374
9663
  seed: z140.number().nullable().optional(),
9375
- output_format: z140.enum(["jpeg", "png"]).optional().default("png"),
9664
+ output_format: z140.enum(["jpeg", "png"]).nullable().optional().default("png"),
9376
9665
  width: z140.number().optional(),
9377
9666
  height: z140.number().optional(),
9378
9667
  aspect_ratio: z140.string().optional(),
9379
- size: z140.string().optional(),
9380
- fabFileIds: z140.array(z140.string()).optional(),
9381
- image: z140.string()
9668
+ fabFileIds: z140.array(z140.string()).optional()
9382
9669
  });
9383
9670
 
9384
- // ../../b4m-core/packages/services/dist/src/llm/refineText.js
9671
+ // ../../b4m-core/packages/services/dist/src/llm/ImageEdit.js
9672
+ import axios9 from "axios";
9673
+ import { fileTypeFromBuffer as fileTypeFromBuffer5 } from "file-type";
9674
+ import { v4 as uuidv48 } from "uuid";
9385
9675
  import { z as z141 } from "zod";
9386
- var refineTextLLMSchema = z141.object({
9387
- text: z141.string(),
9388
- context: z141.string().optional()
9676
+ import { fromZodError as fromZodError3 } from "zod-validation-error";
9677
+ var ImageEditBodySchema = OpenAIImageGenerationInput.extend({
9678
+ sessionId: z141.string(),
9679
+ questId: z141.string(),
9680
+ userId: z141.string(),
9681
+ prompt: z141.string(),
9682
+ safety_tolerance: z141.number().min(BFL_SAFETY_TOLERANCE.MIN).max(BFL_SAFETY_TOLERANCE.MAX).optional().default(BFL_SAFETY_TOLERANCE.DEFAULT),
9683
+ prompt_upsampling: z141.boolean().optional().default(false),
9684
+ seed: z141.number().nullable().optional(),
9685
+ output_format: z141.enum(["jpeg", "png"]).optional().default("png"),
9686
+ width: z141.number().optional(),
9687
+ height: z141.number().optional(),
9688
+ aspect_ratio: z141.string().optional(),
9689
+ size: z141.string().optional(),
9690
+ fabFileIds: z141.array(z141.string()).optional(),
9691
+ image: z141.string()
9692
+ });
9693
+
9694
+ // ../../b4m-core/packages/services/dist/src/llm/refineText.js
9695
+ import { z as z142 } from "zod";
9696
+ var refineTextLLMSchema = z142.object({
9697
+ text: z142.string(),
9698
+ context: z142.string().optional()
9389
9699
  // tone: z.enum(['formal', 'informal', 'neutral']).optional(),
9390
9700
  // style: z.enum(['technical', 'creative', 'academic', 'business', 'narrative']).optional(),
9391
9701
  });
9392
9702
 
9393
9703
  // ../../b4m-core/packages/services/dist/src/llm/MementoEvaluationService.js
9394
- import { z as z142 } from "zod";
9395
- var SingleMementoEvalSchema = z142.object({
9396
- importance: z142.number().min(1).max(10),
9704
+ import { z as z143 } from "zod";
9705
+ var SingleMementoEvalSchema = z143.object({
9706
+ importance: z143.number().min(1).max(10),
9397
9707
  // 1-10 scale for personal info importance
9398
- summary: z142.string(),
9399
- tags: z142.array(z142.string()).optional()
9708
+ summary: z143.string(),
9709
+ tags: z143.array(z143.string()).optional()
9400
9710
  });
9401
- var MementoEvalResponseSchema = z142.object({
9402
- isPersonal: z142.boolean(),
9403
- mementos: z142.array(SingleMementoEvalSchema).optional()
9711
+ var MementoEvalResponseSchema = z143.object({
9712
+ isPersonal: z143.boolean(),
9713
+ mementos: z143.array(SingleMementoEvalSchema).optional()
9404
9714
  // Array of distinct personal information
9405
9715
  });
9406
9716
 
@@ -9457,7 +9767,7 @@ async function generateFileDeletePreview(args) {
9457
9767
  if (!existsSync7(args.path)) {
9458
9768
  return `[File does not exist: ${args.path}]`;
9459
9769
  }
9460
- const stats = await import("fs/promises").then((fs12) => fs12.stat(args.path));
9770
+ const stats = await import("fs/promises").then((fs13) => fs13.stat(args.path));
9461
9771
  return `[File will be deleted]
9462
9772
 
9463
9773
  Path: ${args.path}
@@ -9469,9 +9779,9 @@ Last modified: ${stats.mtime.toLocaleString()}`;
9469
9779
  }
9470
9780
 
9471
9781
  // src/utils/Logger.ts
9472
- import fs10 from "fs/promises";
9473
- import path12 from "path";
9474
- import os from "os";
9782
+ import fs11 from "fs/promises";
9783
+ import path13 from "path";
9784
+ import os2 from "os";
9475
9785
  var Logger2 = class _Logger {
9476
9786
  constructor() {
9477
9787
  this.logFilePath = null;
@@ -9493,9 +9803,9 @@ var Logger2 = class _Logger {
9493
9803
  */
9494
9804
  async initialize(sessionId) {
9495
9805
  this.sessionId = sessionId;
9496
- const debugDir = path12.join(os.homedir(), ".bike4mind", "debug");
9497
- await fs10.mkdir(debugDir, { recursive: true });
9498
- this.logFilePath = path12.join(debugDir, `${sessionId}.txt`);
9806
+ const debugDir = path13.join(os2.homedir(), ".bike4mind", "debug");
9807
+ await fs11.mkdir(debugDir, { recursive: true });
9808
+ this.logFilePath = path13.join(debugDir, `${sessionId}.txt`);
9499
9809
  await this.writeToFile("INFO", "=== CLI SESSION START ===");
9500
9810
  }
9501
9811
  /**
@@ -9559,7 +9869,7 @@ var Logger2 = class _Logger {
9559
9869
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace("T", " ").substring(0, 19);
9560
9870
  const logEntry = `[${timestamp}] [${level}] ${message}
9561
9871
  `;
9562
- await fs10.appendFile(this.logFilePath, logEntry, "utf-8");
9872
+ await fs11.appendFile(this.logFilePath, logEntry, "utf-8");
9563
9873
  } catch (error) {
9564
9874
  console.error("File logging failed:", error);
9565
9875
  }
@@ -9705,15 +10015,15 @@ var Logger2 = class _Logger {
9705
10015
  async cleanupOldLogs() {
9706
10016
  if (!this.fileLoggingEnabled) return;
9707
10017
  try {
9708
- const debugDir = path12.join(os.homedir(), ".bike4mind", "debug");
9709
- const files = await fs10.readdir(debugDir);
10018
+ const debugDir = path13.join(os2.homedir(), ".bike4mind", "debug");
10019
+ const files = await fs11.readdir(debugDir);
9710
10020
  const now = Date.now();
9711
10021
  const thirtyDaysAgo = now - 30 * 24 * 60 * 60 * 1e3;
9712
10022
  for (const file of files) {
9713
- const filePath = path12.join(debugDir, file);
9714
- const stats = await fs10.stat(filePath);
10023
+ const filePath = path13.join(debugDir, file);
10024
+ const stats = await fs11.stat(filePath);
9715
10025
  if (stats.mtime.getTime() < thirtyDaysAgo) {
9716
- await fs10.unlink(filePath);
10026
+ await fs11.unlink(filePath);
9717
10027
  }
9718
10028
  }
9719
10029
  } catch (error) {
@@ -9807,21 +10117,21 @@ var NoOpStorage = class extends BaseStorage {
9807
10117
  async upload(input, destination, options) {
9808
10118
  return `/tmp/${destination}`;
9809
10119
  }
9810
- async download(path15) {
10120
+ async download(path16) {
9811
10121
  throw new Error("Download not supported in CLI");
9812
10122
  }
9813
- async delete(path15) {
10123
+ async delete(path16) {
9814
10124
  }
9815
- async getSignedUrl(path15) {
9816
- return `/tmp/${path15}`;
10125
+ async getSignedUrl(path16) {
10126
+ return `/tmp/${path16}`;
9817
10127
  }
9818
- getPublicUrl(path15) {
9819
- return `/tmp/${path15}`;
10128
+ getPublicUrl(path16) {
10129
+ return `/tmp/${path16}`;
9820
10130
  }
9821
- async getPreview(path15) {
9822
- return `/tmp/${path15}`;
10131
+ async getPreview(path16) {
10132
+ return `/tmp/${path16}`;
9823
10133
  }
9824
- async getMetadata(path15) {
10134
+ async getMetadata(path16) {
9825
10135
  return { size: 0, contentType: "application/octet-stream" };
9826
10136
  }
9827
10137
  };
@@ -10031,8 +10341,8 @@ function generateCliTools(userId, llm, model, permissionManager, showPermissionP
10031
10341
  }
10032
10342
 
10033
10343
  // src/config/toolSafety.ts
10034
- import { z as z143 } from "zod";
10035
- var ToolCategorySchema = z143.enum([
10344
+ import { z as z144 } from "zod";
10345
+ var ToolCategorySchema = z144.enum([
10036
10346
  "auto_approve",
10037
10347
  // Safe tools that run automatically without permission
10038
10348
  "prompt_always",
@@ -10040,9 +10350,9 @@ var ToolCategorySchema = z143.enum([
10040
10350
  "prompt_default"
10041
10351
  // Tools that prompt by default but can be trusted
10042
10352
  ]);
10043
- var ToolSafetyConfigSchema = z143.object({
10044
- categories: z143.record(z143.string(), ToolCategorySchema),
10045
- trustedTools: z143.array(z143.string())
10353
+ var ToolSafetyConfigSchema = z144.object({
10354
+ categories: z144.record(z144.string(), ToolCategorySchema),
10355
+ trustedTools: z144.array(z144.string())
10046
10356
  });
10047
10357
  var DEFAULT_TOOL_CATEGORIES = {
10048
10358
  // ===== AUTO APPROVE (Safe tools) =====
@@ -10222,8 +10532,8 @@ function getEnvironmentName(configApiConfig) {
10222
10532
  }
10223
10533
 
10224
10534
  // src/utils/contextLoader.ts
10225
- import * as fs11 from "fs";
10226
- import * as path13 from "path";
10535
+ import * as fs12 from "fs";
10536
+ import * as path14 from "path";
10227
10537
  import { homedir as homedir4 } from "os";
10228
10538
  var CONTEXT_FILE_SIZE_LIMIT = 100 * 1024;
10229
10539
  var PROJECT_CONTEXT_FILES = [
@@ -10244,9 +10554,9 @@ function formatFileSize2(bytes) {
10244
10554
  return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
10245
10555
  }
10246
10556
  function tryReadContextFile(dir, filename, source) {
10247
- const filePath = path13.join(dir, filename);
10557
+ const filePath = path14.join(dir, filename);
10248
10558
  try {
10249
- const stats = fs11.lstatSync(filePath);
10559
+ const stats = fs12.lstatSync(filePath);
10250
10560
  if (stats.isDirectory()) {
10251
10561
  return null;
10252
10562
  }
@@ -10260,7 +10570,7 @@ function tryReadContextFile(dir, filename, source) {
10260
10570
  error: `${source === "global" ? "Global" : "Project"} ${filename} exceeds 100KB limit (${formatFileSize2(stats.size)})`
10261
10571
  };
10262
10572
  }
10263
- const content = fs11.readFileSync(filePath, "utf-8");
10573
+ const content = fs12.readFileSync(filePath, "utf-8");
10264
10574
  return {
10265
10575
  filename,
10266
10576
  content,
@@ -10312,7 +10622,7 @@ ${project.content}`;
10312
10622
  }
10313
10623
  async function loadContextFiles(projectDir) {
10314
10624
  const errors = [];
10315
- const globalDir = path13.join(homedir4(), ".bike4mind");
10625
+ const globalDir = path14.join(homedir4(), ".bike4mind");
10316
10626
  const projectDirectory = projectDir || process.cwd();
10317
10627
  const [globalResult, projectResult] = await Promise.all([
10318
10628
  Promise.resolve(findContextFile(globalDir, GLOBAL_CONTEXT_FILES, "global")),
@@ -10333,10 +10643,22 @@ async function loadContextFiles(projectDir) {
10333
10643
  };
10334
10644
  }
10335
10645
 
10646
+ // src/utils/argumentSubstitution.ts
10647
+ function substituteArguments(template, args) {
10648
+ let result = template;
10649
+ for (let i = args.length; i >= 1; i--) {
10650
+ const pattern = new RegExp(`\\$${i}`, "g");
10651
+ result = result.replace(pattern, args[i - 1] || "");
10652
+ }
10653
+ const allArgsString = args.join(" ");
10654
+ result = result.replace(/\$ARGUMENTS/g, allArgsString);
10655
+ return result;
10656
+ }
10657
+
10336
10658
  // ../../b4m-core/packages/mcp/dist/src/client.js
10337
10659
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
10338
10660
  import { Client as Client2 } from "@modelcontextprotocol/sdk/client/index.js";
10339
- import path14 from "path";
10661
+ import path15 from "path";
10340
10662
  import { existsSync as existsSync8, readdirSync as readdirSync3 } from "fs";
10341
10663
  var MCPClient = class {
10342
10664
  // Note: This class handles MCP server communication with repository filtering
@@ -10377,16 +10699,16 @@ var MCPClient = class {
10377
10699
  const root = process.env.INIT_CWD || process.cwd();
10378
10700
  const candidatePaths = [
10379
10701
  // When running from SST Lambda with node_modules structure (copyFiles)
10380
- path14.join(root, `node_modules/@bike4mind/mcp/dist/src/${this.serverName}/index.js`),
10702
+ path15.join(root, `node_modules/@bike4mind/mcp/dist/src/${this.serverName}/index.js`),
10381
10703
  // When running from SST Lambda deployed environment (/var/task)
10382
- path14.join(root, `b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10704
+ path15.join(root, `b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10383
10705
  // When running from SST Lambda (.sst/artifacts/mcpHandler-dev), navigate to monorepo root (3 levels up)
10384
- path14.join(root, `../../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10706
+ path15.join(root, `../../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10385
10707
  // When running from packages/client (Next.js app), navigate to monorepo root (2 levels up)
10386
- path14.join(root, `../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10708
+ path15.join(root, `../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10387
10709
  // Original paths (backward compatibility)
10388
- path14.join(root, `/b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10389
- path14.join(root, "core", "mcp", "servers", this.serverName, "dist", "index.js")
10710
+ path15.join(root, `/b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
10711
+ path15.join(root, "core", "mcp", "servers", this.serverName, "dist", "index.js")
10390
10712
  ];
10391
10713
  const serverScriptPath = candidatePaths.find((p) => existsSync8(p));
10392
10714
  if (!serverScriptPath) {
@@ -11190,7 +11512,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
11190
11512
  // package.json
11191
11513
  var package_default = {
11192
11514
  name: "@bike4mind/cli",
11193
- version: "0.2.10-feat-explore-subagent-implementation.17263+b92e2f586",
11515
+ version: "0.2.10-feat-explore-subagent-implementation.17267+b95ee4da4",
11194
11516
  type: "module",
11195
11517
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
11196
11518
  license: "UNLICENSED",
@@ -11260,6 +11582,7 @@ var package_default = {
11260
11582
  "eventsource-parser": "^3.0.6",
11261
11583
  "file-type": "^18.7.0",
11262
11584
  "fuse.js": "^7.1.0",
11585
+ "gray-matter": "^4.0.3",
11263
11586
  ink: "^6.5.1",
11264
11587
  "ink-select-input": "^6.2.0",
11265
11588
  "ink-spinner": "^5.0.0",
@@ -11293,10 +11616,10 @@ var package_default = {
11293
11616
  },
11294
11617
  devDependencies: {
11295
11618
  "@bike4mind/agents": "0.1.0",
11296
- "@bike4mind/common": "2.39.1-feat-explore-subagent-implementation.17263+b92e2f586",
11297
- "@bike4mind/mcp": "1.20.4-feat-explore-subagent-implementation.17263+b92e2f586",
11298
- "@bike4mind/services": "2.34.2-feat-explore-subagent-implementation.17263+b92e2f586",
11299
- "@bike4mind/utils": "2.1.4-feat-explore-subagent-implementation.17263+b92e2f586",
11619
+ "@bike4mind/common": "2.39.1-feat-explore-subagent-implementation.17267+b95ee4da4",
11620
+ "@bike4mind/mcp": "1.20.4-feat-explore-subagent-implementation.17267+b95ee4da4",
11621
+ "@bike4mind/services": "2.34.2-feat-explore-subagent-implementation.17267+b95ee4da4",
11622
+ "@bike4mind/utils": "2.1.4-feat-explore-subagent-implementation.17267+b95ee4da4",
11300
11623
  "@types/better-sqlite3": "^7.6.13",
11301
11624
  "@types/diff": "^5.0.9",
11302
11625
  "@types/jsonwebtoken": "^9.0.4",
@@ -11309,7 +11632,7 @@ var package_default = {
11309
11632
  typescript: "^5.9.3",
11310
11633
  vitest: "^3.2.4"
11311
11634
  },
11312
- gitHead: "b92e2f586a6e216a1e40919bea0c36aa3c0db84f"
11635
+ gitHead: "b95ee4da40b8b23ebad5933069750f828b85e72e"
11313
11636
  };
11314
11637
 
11315
11638
  // src/config/constants.ts
@@ -11543,8 +11866,8 @@ Provide a structured plan that the main agent can execute.`,
11543
11866
  };
11544
11867
  var REVIEW_CONFIG = {
11545
11868
  type: "review",
11546
- model: "claude-3-5-sonnet-20241022",
11547
- // Use Sonnet for better reasoning
11869
+ model: "claude-sonnet-4-5-20250929",
11870
+ // Use latest Sonnet for better reasoning
11548
11871
  systemPrompt: `You are a code review specialist. Your job is to analyze code quality and identify issues.
11549
11872
 
11550
11873
  Focus on:
@@ -11661,6 +11984,7 @@ function CliApp() {
11661
11984
  sessionStore: new SessionStore(),
11662
11985
  configStore: new ConfigStore(),
11663
11986
  commandHistoryStore: new CommandHistoryStore(),
11987
+ customCommandStore: new CustomCommandStore(),
11664
11988
  imageStore: null,
11665
11989
  // Lazy-loaded on first use
11666
11990
  imageRenderer,
@@ -11740,6 +12064,15 @@ function CliApp() {
11740
12064
  const config = await state.configStore.load();
11741
12065
  const history = await state.commandHistoryStore.load();
11742
12066
  setCommandHistory(history);
12067
+ try {
12068
+ await state.customCommandStore.loadCommands();
12069
+ const customCommandCount = state.customCommandStore.getCommandCount();
12070
+ if (customCommandCount > 0) {
12071
+ console.log(`\u{1F4DD} Loaded ${customCommandCount} custom command${customCommandCount !== 1 ? "s" : ""}`);
12072
+ }
12073
+ } catch (error) {
12074
+ console.warn("Failed to load custom commands:", error instanceof Error ? error.message : String(error));
12075
+ }
11743
12076
  const authTokens = await state.configStore.getAuthTokens();
11744
12077
  let isAuthenticated = false;
11745
12078
  if (!authTokens) {
@@ -12009,8 +12342,164 @@ Remember: Use context from previous messages to understand follow-up questions.$
12009
12342
  useEffect3(() => {
12010
12343
  init();
12011
12344
  }, [init]);
12345
+ const handleCustomCommandMessage = async (fullTemplate, displayMessage) => {
12346
+ if (!state.agent || !state.session) {
12347
+ console.error("\u274C Agent or session not initialized");
12348
+ return;
12349
+ }
12350
+ const authTokens = await state.configStore.getAuthTokens();
12351
+ if (!authTokens || new Date(authTokens.expiresAt) <= /* @__PURE__ */ new Date()) {
12352
+ console.log("\n\u274C Authentication required to use AI features.");
12353
+ console.log("\u{1F4A1} Run /login to authenticate with your B4M account.\n");
12354
+ return;
12355
+ }
12356
+ useCliStore.getState().setIsThinking(true);
12357
+ const currentSteps = [];
12358
+ const stepHandler = (step) => {
12359
+ currentSteps.push(step);
12360
+ const currentSession = useCliStore.getState().session;
12361
+ if (currentSession) {
12362
+ const messages = [...currentSession.messages];
12363
+ const lastMessage = messages[messages.length - 1];
12364
+ if (lastMessage && lastMessage.role === "assistant") {
12365
+ messages[messages.length - 1] = {
12366
+ ...lastMessage,
12367
+ metadata: {
12368
+ ...lastMessage.metadata,
12369
+ steps: [...currentSteps]
12370
+ }
12371
+ };
12372
+ setStoreSession({
12373
+ ...currentSession,
12374
+ messages
12375
+ });
12376
+ }
12377
+ }
12378
+ };
12379
+ state.agent.on("action", stepHandler);
12380
+ try {
12381
+ let messageContent = fullTemplate;
12382
+ const userMessageContent = displayMessage;
12383
+ if (state.messageBuilder && state.messageBuilder.hasImages(fullTemplate)) {
12384
+ const { message: multimodalMessage } = await state.messageBuilder.buildMessage(fullTemplate);
12385
+ messageContent = multimodalMessage.content;
12386
+ }
12387
+ const userMessage = {
12388
+ role: "user",
12389
+ content: userMessageContent,
12390
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
12391
+ };
12392
+ const pendingAssistantMessage = {
12393
+ role: "assistant",
12394
+ content: "...",
12395
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12396
+ metadata: {
12397
+ steps: []
12398
+ }
12399
+ };
12400
+ const sessionWithMessages = {
12401
+ ...state.session,
12402
+ messages: [...state.session.messages, userMessage, pendingAssistantMessage],
12403
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
12404
+ };
12405
+ setState((prev) => ({ ...prev, session: sessionWithMessages }));
12406
+ setStoreSession(sessionWithMessages);
12407
+ const recentMessages = state.session.messages.slice(-20);
12408
+ const previousMessages = recentMessages.filter((msg) => msg.role === "user" || msg.role === "assistant").map((msg) => ({
12409
+ role: msg.role,
12410
+ content: msg.content
12411
+ }));
12412
+ const result = await state.agent.run(messageContent, {
12413
+ previousMessages: previousMessages.length > 0 ? previousMessages : void 0
12414
+ });
12415
+ const permissionDenied = result.finalAnswer.startsWith("Permission denied for tool");
12416
+ if (permissionDenied) {
12417
+ console.log("\n\u26A0\uFE0F Action denied by user\n");
12418
+ }
12419
+ const successfulToolCalls = result.steps.filter((s) => s.type === "observation").length;
12420
+ const currentSession = useCliStore.getState().session;
12421
+ if (!currentSession) return;
12422
+ const updatedMessages = [...currentSession.messages];
12423
+ updatedMessages[updatedMessages.length - 1] = {
12424
+ role: "assistant",
12425
+ content: result.finalAnswer,
12426
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
12427
+ metadata: {
12428
+ steps: result.steps,
12429
+ tokenUsage: {
12430
+ prompt: 0,
12431
+ completion: 0,
12432
+ total: result.completionInfo.totalTokens
12433
+ },
12434
+ model: state.session.model,
12435
+ permissionDenied
12436
+ }
12437
+ };
12438
+ const finalSession = {
12439
+ ...currentSession,
12440
+ messages: updatedMessages,
12441
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
12442
+ metadata: {
12443
+ ...currentSession.metadata,
12444
+ totalTokens: currentSession.metadata.totalTokens + result.completionInfo.totalTokens,
12445
+ toolCallCount: currentSession.metadata.toolCallCount + successfulToolCalls
12446
+ }
12447
+ };
12448
+ setState((prev) => ({ ...prev, session: finalSession }));
12449
+ setStoreSession(finalSession);
12450
+ await state.sessionStore.save(finalSession);
12451
+ usageCache = null;
12452
+ useCliStore.getState().setIsThinking(false);
12453
+ } catch (error) {
12454
+ useCliStore.getState().setIsThinking(false);
12455
+ if (error?.message?.includes("Permission denied")) {
12456
+ console.log("\n\u26A0\uFE0F Action blocked by permission settings");
12457
+ const currentSession2 = useCliStore.getState().session;
12458
+ if (!currentSession2) return;
12459
+ const sessionWithDenied = { ...currentSession2 };
12460
+ const messages2 = [...sessionWithDenied.messages];
12461
+ const lastMessage2 = messages2[messages2.length - 1];
12462
+ if (lastMessage2 && lastMessage2.role === "assistant") {
12463
+ messages2[messages2.length - 1] = {
12464
+ ...lastMessage2,
12465
+ content: error.message,
12466
+ metadata: {
12467
+ ...lastMessage2.metadata,
12468
+ permissionDenied: true
12469
+ }
12470
+ };
12471
+ }
12472
+ sessionWithDenied.messages = messages2;
12473
+ setState((prev) => ({ ...prev, session: sessionWithDenied }));
12474
+ setStoreSession(sessionWithDenied);
12475
+ await state.sessionStore.save(sessionWithDenied);
12476
+ return;
12477
+ }
12478
+ console.error("Error executing command:", error);
12479
+ console.error(error.stack);
12480
+ const currentSession = useCliStore.getState().session;
12481
+ if (!currentSession) return;
12482
+ const sessionWithError = { ...currentSession };
12483
+ const messages = [...sessionWithError.messages];
12484
+ const lastMessage = messages[messages.length - 1];
12485
+ if (lastMessage && lastMessage.role === "assistant") {
12486
+ messages[messages.length - 1] = {
12487
+ ...lastMessage,
12488
+ content: `\u274C Error: ${error.message || "Unknown error occurred"}`
12489
+ };
12490
+ }
12491
+ sessionWithError.messages = messages;
12492
+ setState((prev) => ({ ...prev, session: sessionWithError }));
12493
+ setStoreSession(sessionWithError);
12494
+ } finally {
12495
+ state.agent.off("action", stepHandler);
12496
+ }
12497
+ };
12012
12498
  const handleMessage = async (message) => {
12013
- if (!state.agent || !state.session) return;
12499
+ if (!state.agent || !state.session) {
12500
+ console.error("\u274C Agent or session not initialized");
12501
+ return;
12502
+ }
12014
12503
  await state.commandHistoryStore.add(message);
12015
12504
  const updatedHistory = await state.commandHistoryStore.list();
12016
12505
  setCommandHistory(updatedHistory);
@@ -12020,6 +12509,7 @@ Remember: Use context from previous messages to understand follow-up questions.$
12020
12509
  console.log("\u{1F4A1} Run /login to authenticate with your B4M account.\n");
12021
12510
  return;
12022
12511
  }
12512
+ useCliStore.getState().setIsThinking(true);
12023
12513
  const currentSteps = [];
12024
12514
  const stepHandler = (step) => {
12025
12515
  currentSteps.push(step);
@@ -12215,8 +12705,48 @@ ${output}` : output.trim() || "(no output)",
12215
12705
  };
12216
12706
  };
12217
12707
  const handleCommand = async (command, args) => {
12708
+ const customCommand = state.customCommandStore.getCommand(command);
12709
+ if (customCommand) {
12710
+ try {
12711
+ const sourceIcon = customCommand.source === "global" ? "\u{1F3E0}" : "\u{1F4C1}";
12712
+ console.log(`${sourceIcon} Executing custom command: /${command}`);
12713
+ let substitutedBody = substituteArguments(customCommand.body, args);
12714
+ const processed = await processFileReferences(substitutedBody);
12715
+ substitutedBody = processed.content;
12716
+ if (processed.errors.length > 0) {
12717
+ processed.errors.forEach((error) => console.warn(`Warning: ${error}`));
12718
+ }
12719
+ if (process.env.B4M_VERBOSE === "1") {
12720
+ console.log("\u{1F4DD} Expanded command:\n", substitutedBody);
12721
+ }
12722
+ const displayMessage = `/${command}${args.length > 0 ? " " + args.join(" ") : ""}`;
12723
+ if (customCommand.model && state.agent) {
12724
+ console.log(`\u{1F504} Using model override: ${customCommand.model}`);
12725
+ const originalModel = state.session?.model;
12726
+ if (state.session) {
12727
+ state.session.model = customCommand.model;
12728
+ }
12729
+ await handleCustomCommandMessage(substitutedBody, displayMessage);
12730
+ if (state.session && originalModel) {
12731
+ state.session.model = originalModel;
12732
+ }
12733
+ } else {
12734
+ console.log("\u{1F916} Sending to agent...\n");
12735
+ await handleCustomCommandMessage(substitutedBody, displayMessage);
12736
+ }
12737
+ return;
12738
+ } catch (error) {
12739
+ console.error(
12740
+ `\u274C Failed to execute custom command /${command}:`,
12741
+ error instanceof Error ? error.message : String(error)
12742
+ );
12743
+ return;
12744
+ }
12745
+ }
12218
12746
  switch (command) {
12219
- case "help":
12747
+ case "help": {
12748
+ const customCommands = state.customCommandStore.getAllCommands();
12749
+ const hasCustomCommands = customCommands.length > 0;
12220
12750
  console.log(`
12221
12751
  Available commands:
12222
12752
  /help - Show this help message
@@ -12243,8 +12773,19 @@ Tool Permissions:
12243
12773
 
12244
12774
  Project Configuration:
12245
12775
  /project-config - Show merged project configuration
12776
+
12777
+ Custom Commands:
12778
+ /commands - List all custom commands
12779
+ /commands:new <name> - Create a new custom command
12780
+ /commands:reload - Reload custom commands from disk${hasCustomCommands ? "\n\n\u{1F4DD} Custom Commands Available:" : ""}${hasCustomCommands ? customCommands.map((cmd) => {
12781
+ const source = cmd.source === "global" ? "\u{1F3E0}" : "\u{1F4C1}";
12782
+ const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
12783
+ return `
12784
+ ${source} /${cmd.name}${argHint} - ${cmd.description}`;
12785
+ }).join("") : ""}
12246
12786
  `);
12247
12787
  break;
12788
+ }
12248
12789
  case "exit":
12249
12790
  case "quit":
12250
12791
  logger.debug("[EXIT /exit command - cleaning up and exiting...");
@@ -12732,6 +13273,71 @@ No usage data available for the last ${USAGE_DAYS} days.`);
12732
13273
  console.log("");
12733
13274
  break;
12734
13275
  }
13276
+ case "commands": {
13277
+ const customCommands = state.customCommandStore.getAllCommands();
13278
+ const globalCommands = state.customCommandStore.getCommandsBySource("global");
13279
+ const projectCommands = state.customCommandStore.getCommandsBySource("project");
13280
+ console.log("\n\u{1F4DD} Custom Commands:\n");
13281
+ if (customCommands.length === 0) {
13282
+ console.log("No custom commands found.");
13283
+ console.log("\nTo create a custom command:");
13284
+ console.log(" /commands:new <name> - Create a new command");
13285
+ console.log("\nCustom commands can be stored in:");
13286
+ console.log(" \u{1F3E0} Global: ~/.bike4mind/commands/ (available in all projects)");
13287
+ console.log(" \u{1F4C1} Project: .bike4mind/commands/ (team-shared, committed to git)");
13288
+ } else {
13289
+ if (globalCommands.length > 0) {
13290
+ console.log("\u{1F3E0} Global Commands (~/.bike4mind/commands/):");
13291
+ globalCommands.forEach((cmd) => {
13292
+ const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
13293
+ console.log(` /${cmd.name}${argHint} - ${cmd.description}`);
13294
+ });
13295
+ console.log("");
13296
+ }
13297
+ if (projectCommands.length > 0) {
13298
+ console.log("\u{1F4C1} Project Commands (.bike4mind/commands/):");
13299
+ projectCommands.forEach((cmd) => {
13300
+ const argHint = cmd.argumentHint ? ` ${cmd.argumentHint}` : "";
13301
+ console.log(` /${cmd.name}${argHint} - ${cmd.description}`);
13302
+ });
13303
+ console.log("");
13304
+ }
13305
+ console.log(`Total: ${customCommands.length} custom command${customCommands.length !== 1 ? "s" : ""}`);
13306
+ }
13307
+ console.log("");
13308
+ break;
13309
+ }
13310
+ case "commands:new": {
13311
+ const commandName = args[0];
13312
+ if (!commandName) {
13313
+ console.log("\u274C Please provide a command name");
13314
+ console.log("Usage: /commands:new <name>");
13315
+ break;
13316
+ }
13317
+ console.log("\nWhere should this command be stored?");
13318
+ console.log(" 1. \u{1F3E0} Global (~/.bike4mind/commands/) - available in all projects");
13319
+ console.log(" 2. \u{1F4C1} Project (.bike4mind/commands/) - team-shared");
13320
+ console.log("\nDefaulting to global. Creating command file...");
13321
+ try {
13322
+ const filePath = await state.customCommandStore.createCommandFile(commandName, true);
13323
+ console.log(`\u2705 Created command file: ${filePath}`);
13324
+ console.log("\nEdit this file to customize your command.");
13325
+ console.log("Then run: /commands:reload to load it");
13326
+ } catch (error) {
13327
+ console.error("\u274C Failed to create command file:", error instanceof Error ? error.message : String(error));
13328
+ }
13329
+ break;
13330
+ }
13331
+ case "commands:reload": {
13332
+ try {
13333
+ await state.customCommandStore.reloadCommands();
13334
+ const count = state.customCommandStore.getCommandCount();
13335
+ console.log(`\u2705 Reloaded ${count} custom command${count !== 1 ? "s" : ""}`);
13336
+ } catch (error) {
13337
+ console.error("\u274C Failed to reload commands:", error instanceof Error ? error.message : String(error));
13338
+ }
13339
+ break;
13340
+ }
12735
13341
  default:
12736
13342
  console.log(`Unknown command: /${command}`);
12737
13343
  console.log("Type /help for available commands");
@@ -12849,6 +13455,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
12849
13455
  if (!isInitialized) {
12850
13456
  return /* @__PURE__ */ React17.createElement(Box16, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React17.createElement(Text16, null, "\u{1F680} Initializing..."));
12851
13457
  }
13458
+ const allCommands = mergeCommands(state.customCommandStore.getAllCommands());
12852
13459
  return /* @__PURE__ */ React17.createElement(
12853
13460
  App,
12854
13461
  {
@@ -12857,6 +13464,7 @@ No usage data available for the last ${USAGE_DAYS} days.`);
12857
13464
  onBashCommand: handleBashCommand,
12858
13465
  onImageDetected: handleImageDetected,
12859
13466
  commandHistory,
13467
+ commands: allCommands,
12860
13468
  config: state.config,
12861
13469
  availableModels: state.availableModels,
12862
13470
  onSaveConfig: handleSaveConfig,