librechat-data-provider 0.8.508 → 0.8.521

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 (42) hide show
  1. package/dist/{data-service-DN-HeTC-.js → data-service-DOIF4BkW.js} +1211 -92
  2. package/dist/data-service-DOIF4BkW.js.map +1 -0
  3. package/dist/{data-service-DgNwjhBS.mjs → data-service-pwrlWjJs.mjs} +1062 -93
  4. package/dist/data-service-pwrlWjJs.mjs.map +1 -0
  5. package/dist/index.js +472 -57
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +440 -58
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/react-query/index.js +1 -1
  10. package/dist/react-query/index.js.map +1 -1
  11. package/dist/react-query/index.mjs +1 -1
  12. package/dist/react-query/index.mjs.map +1 -1
  13. package/dist/types/actions.d.ts +1 -1
  14. package/dist/types/api-endpoints.d.ts +11 -2
  15. package/dist/types/bedrock.d.ts +57 -0
  16. package/dist/types/config.d.ts +4230 -183
  17. package/dist/types/data-service.d.ts +28 -14
  18. package/dist/types/feedback.d.ts +9 -1
  19. package/dist/types/file-config.d.ts +41 -5
  20. package/dist/types/generate.d.ts +8 -0
  21. package/dist/types/keys.d.ts +7 -2
  22. package/dist/types/mcp.d.ts +45 -24
  23. package/dist/types/messages.d.ts +8 -0
  24. package/dist/types/models.d.ts +120 -0
  25. package/dist/types/parameterSettings.d.ts +2 -2
  26. package/dist/types/parsers.d.ts +3 -1
  27. package/dist/types/react-query/react-query-service.d.ts +2 -7
  28. package/dist/types/request.d.ts +3 -1
  29. package/dist/types/schemas.d.ts +211 -11
  30. package/dist/types/types/agents.d.ts +211 -1
  31. package/dist/types/types/assistants.d.ts +77 -5
  32. package/dist/types/types/files.d.ts +18 -7
  33. package/dist/types/types/mcpServers.d.ts +25 -0
  34. package/dist/types/types/mutations.d.ts +1 -0
  35. package/dist/types/types/queries.d.ts +17 -3
  36. package/dist/types/types/runs.d.ts +114 -25
  37. package/dist/types/types/skills.d.ts +25 -6
  38. package/dist/types/types.d.ts +117 -2
  39. package/dist/types/upload.d.ts +2 -0
  40. package/package.json +4 -4
  41. package/dist/data-service-DN-HeTC-.js.map +0 -1
  42. package/dist/data-service-DgNwjhBS.mjs.map +0 -1
@@ -169,6 +169,9 @@ const feedbackSchema = z.object({
169
169
  rating: feedbackRatingSchema,
170
170
  tag: feedbackTagKeySchema,
171
171
  text: z.string().max(1024).optional()
172
+ }).refine(({ rating, tag }) => FEEDBACK_TAGS.some((feedbackTag) => feedbackTag.key === tag && feedbackTag.direction === rating), {
173
+ message: "Feedback tag does not match rating",
174
+ path: ["tag"]
172
175
  });
173
176
  function toMinimalFeedback(feedback) {
174
177
  if (!feedback?.rating || !feedback?.tag || !feedback.tag.key) return;
@@ -464,6 +467,7 @@ let ReasoningEffort = /* @__PURE__ */ function(ReasoningEffort) {
464
467
  ReasoningEffort["medium"] = "medium";
465
468
  ReasoningEffort["high"] = "high";
466
469
  ReasoningEffort["xhigh"] = "xhigh";
470
+ ReasoningEffort["max"] = "max";
467
471
  return ReasoningEffort;
468
472
  }({});
469
473
  let ReasoningParameterFormat = /* @__PURE__ */ function(ReasoningParameterFormat) {
@@ -530,6 +534,21 @@ let ThinkingLevel = /* @__PURE__ */ function(ThinkingLevel) {
530
534
  ThinkingLevel["high"] = "high";
531
535
  return ThinkingLevel;
532
536
  }({});
537
+ /** OpenAI Responses API `reasoning.mode` (GPT-5.6+). */
538
+ let ReasoningMode = /* @__PURE__ */ function(ReasoningMode) {
539
+ ReasoningMode["unset"] = "";
540
+ ReasoningMode["standard"] = "standard";
541
+ ReasoningMode["pro"] = "pro";
542
+ return ReasoningMode;
543
+ }({});
544
+ /** OpenAI Responses API `reasoning.context` (GPT-5.6+). */
545
+ let ReasoningContext = /* @__PURE__ */ function(ReasoningContext) {
546
+ ReasoningContext["unset"] = "";
547
+ ReasoningContext["auto"] = "auto";
548
+ ReasoningContext["current_turn"] = "current_turn";
549
+ ReasoningContext["all_turns"] = "all_turns";
550
+ return ReasoningContext;
551
+ }({});
533
552
  const imageDetailNumeric = {
534
553
  ["low"]: 0,
535
554
  ["auto"]: 1,
@@ -549,6 +568,8 @@ const eThinkingDisplaySchema = z.nativeEnum(ThinkingDisplay);
549
568
  const eReasoningSummarySchema = z.nativeEnum(ReasoningSummary);
550
569
  const eVerbositySchema = z.nativeEnum(Verbosity);
551
570
  const eThinkingLevelSchema = z.nativeEnum(ThinkingLevel);
571
+ const eReasoningModeSchema = z.nativeEnum(ReasoningMode);
572
+ const eReasoningContextSchema = z.nativeEnum(ReasoningContext);
552
573
  const defaultAssistantFormValues = {
553
574
  assistant: "",
554
575
  id: "",
@@ -580,6 +601,7 @@ const defaultAgentFormValues = {
580
601
  ["execute_code"]: false,
581
602
  ["file_search"]: false,
582
603
  ["web_search"]: false,
604
+ ["memory"]: false,
583
605
  category: "general",
584
606
  support_contact: {
585
607
  name: "",
@@ -592,7 +614,9 @@ const defaultAgentFormValues = {
592
614
  * (full catalog unless `skills` narrows it). Anything else = inactive. */
593
615
  skills_enabled: void 0,
594
616
  /** `undefined` = feature disabled by default (no subagent tool injected). */
595
- subagents: void 0
617
+ subagents: void 0,
618
+ /** Memory partition: 'agent' isolates memories per (user, agent); default shared pool */
619
+ memory_scope: void 0
596
620
  };
597
621
  const ImageVisionTool = {
598
622
  type: "function",
@@ -712,6 +736,7 @@ const CLAUDE_4_64K_MAX_OUTPUT = 64e3;
712
736
  const CLAUDE_32K_MAX_OUTPUT = 32e3;
713
737
  const DEFAULT_MAX_OUTPUT = 8192;
714
738
  const LEGACY_ANTHROPIC_MAX_OUTPUT = 4096;
739
+ const CLAUDE_SONNET_128K_OUTPUT_PATTERN = /claude-sonnet[-.]?(?:4[-.]?(?:[6-9]|\d{2})|[5-9]|\d{2,})(?=$|[^0-9])/;
715
740
  /**
716
741
  * Claude "Mythos-class" model families — new top-level classes (peers of
717
742
  * `opus`/`sonnet`/`haiku`) that ship with the post-Opus-4.7 modern profile:
@@ -755,6 +780,7 @@ const anthropicSettings = {
755
780
  reset: (modelName) => {
756
781
  if (isMythosClassModel(modelName)) return ANTHROPIC_MAX_OUTPUT;
757
782
  if (/claude-opus[-.]?(?:4[-.]?(?:[6-9]|\d{2,})|[5-9]|\d{2,})/.test(modelName)) return ANTHROPIC_MAX_OUTPUT;
783
+ if (CLAUDE_SONNET_128K_OUTPUT_PATTERN.test(modelName)) return ANTHROPIC_MAX_OUTPUT;
758
784
  if (/claude-(?:sonnet|haiku)[-.]?[4-9]/.test(modelName)) return CLAUDE_4_64K_MAX_OUTPUT;
759
785
  if (/claude-opus[-.]?(?:[5-9]|4[-.]?([5-9]|\d{2,}))/.test(modelName)) return CLAUDE_4_64K_MAX_OUTPUT;
760
786
  if (/claude-opus[-.]?[4-9]/.test(modelName)) return CLAUDE_32K_MAX_OUTPUT;
@@ -769,6 +795,10 @@ const anthropicSettings = {
769
795
  if (value > ANTHROPIC_MAX_OUTPUT) return ANTHROPIC_MAX_OUTPUT;
770
796
  return value;
771
797
  }
798
+ if (CLAUDE_SONNET_128K_OUTPUT_PATTERN.test(modelName)) {
799
+ if (value > ANTHROPIC_MAX_OUTPUT) return ANTHROPIC_MAX_OUTPUT;
800
+ return value;
801
+ }
772
802
  if (/claude-(?:sonnet|haiku)[-.]?[4-9]/.test(modelName) && value > CLAUDE_4_64K_MAX_OUTPUT) return CLAUDE_4_64K_MAX_OUTPUT;
773
803
  if (/claude-opus[-.]?(?:[5-9]|4[-.]?([5-9]|\d{2,}))/.test(modelName)) {
774
804
  if (value > CLAUDE_4_64K_MAX_OUTPUT) return CLAUDE_4_64K_MAX_OUTPUT;
@@ -947,6 +977,16 @@ const tMessageSchema = z.object({
947
977
  */
948
978
  quotes: z.array(z.string()).optional()
949
979
  });
980
+ /**
981
+ * Which memory partition an agent reads/writes.
982
+ * `user` = the shared personal pool (default); `agent` = a partition
983
+ * isolated per (user, agent) so the agent only sees its own memories.
984
+ */
985
+ let MemoryScope = /* @__PURE__ */ function(MemoryScope) {
986
+ MemoryScope["user"] = "user";
987
+ MemoryScope["agent"] = "agent";
988
+ return MemoryScope;
989
+ }({});
950
990
  const coerceNumber = z.union([z.number(), z.string()]).transform((val) => {
951
991
  if (typeof val === "string") return val.trim() === "" ? void 0 : parseFloat(val);
952
992
  return val;
@@ -965,6 +1005,8 @@ const tConversationSchema = z.object({
965
1005
  endpointType: eModelEndpointSchema.nullable().optional(),
966
1006
  isArchived: z.boolean().optional(),
967
1007
  pinned: z.boolean().optional(),
1008
+ /** Server-derived: an active shared link exists for this conversation. Not persisted. */
1009
+ isShared: z.boolean().optional(),
968
1010
  title: z.string().nullable().or(z.literal("New Chat")).default("New Chat"),
969
1011
  user: z.string().optional(),
970
1012
  messages: z.array(z.string()).optional(),
@@ -1002,11 +1044,14 @@ const tConversationSchema = z.object({
1002
1044
  imageDetail: eImageDetailSchema.optional(),
1003
1045
  reasoning_effort: eReasoningEffortSchema.optional().nullable(),
1004
1046
  reasoning_summary: eReasoningSummarySchema.optional().nullable(),
1047
+ reasoning_mode: eReasoningModeSchema.optional().nullable(),
1048
+ reasoning_context: eReasoningContextSchema.optional().nullable(),
1005
1049
  verbosity: eVerbositySchema.optional().nullable(),
1006
1050
  useResponsesApi: z.boolean().optional(),
1007
1051
  effort: eAnthropicEffortSchema.optional().nullable(),
1008
1052
  thinkingDisplay: eThinkingDisplaySchema.optional().nullable(),
1009
1053
  web_search: z.boolean().optional(),
1054
+ url_context: z.boolean().optional(),
1010
1055
  disableStreaming: z.boolean().optional(),
1011
1056
  assistant_id: z.string().optional(),
1012
1057
  agent_id: z.string().optional(),
@@ -1092,11 +1137,17 @@ const tQueryParamsSchema = tConversationSchema.pick({
1092
1137
  /** @endpoints openAI, custom, azureOpenAI */
1093
1138
  reasoning_summary: true,
1094
1139
  /** @endpoints openAI, custom, azureOpenAI */
1140
+ reasoning_mode: true,
1141
+ /** @endpoints openAI, custom, azureOpenAI */
1142
+ reasoning_context: true,
1143
+ /** @endpoints openAI, custom, azureOpenAI */
1095
1144
  verbosity: true,
1096
1145
  /** @endpoints openAI, custom, azureOpenAI */
1097
1146
  useResponsesApi: true,
1098
1147
  /** @endpoints openAI, anthropic, google */
1099
1148
  web_search: true,
1149
+ /** @endpoints google */
1150
+ url_context: true,
1100
1151
  /** @endpoints openAI, custom, azureOpenAI */
1101
1152
  disableStreaming: true,
1102
1153
  /** @endpoints google, anthropic, bedrock */
@@ -1194,6 +1245,7 @@ const googleBaseSchema = tConversationSchema.pick({
1194
1245
  thinkingBudget: true,
1195
1246
  thinkingLevel: true,
1196
1247
  web_search: true,
1248
+ url_context: true,
1197
1249
  fileTokenLimit: true,
1198
1250
  iconURL: true,
1199
1251
  greeting: true,
@@ -1220,7 +1272,8 @@ const googleGenConfigSchema = z.object({
1220
1272
  thinkingBudget: coerceNumber.optional(),
1221
1273
  thinkingLevel: z.string().optional()
1222
1274
  }).optional(),
1223
- web_search: z.boolean().optional()
1275
+ web_search: z.boolean().optional(),
1276
+ url_context: z.boolean().optional()
1224
1277
  }).strip().optional();
1225
1278
  function removeNullishValues(obj, removeEmptyStrings) {
1226
1279
  const newObj = { ...obj };
@@ -1343,6 +1396,8 @@ const openAIBaseSchema = tConversationSchema.pick({
1343
1396
  max_tokens: true,
1344
1397
  reasoning_effort: true,
1345
1398
  reasoning_summary: true,
1399
+ reasoning_mode: true,
1400
+ reasoning_context: true,
1346
1401
  verbosity: true,
1347
1402
  useResponsesApi: true,
1348
1403
  web_search: true,
@@ -1791,12 +1846,17 @@ const tModelSpecSchema = z.object({
1791
1846
  showIconInHeader: z.boolean().optional(),
1792
1847
  showOnLanding: z.boolean().optional(),
1793
1848
  conversation_starters: z.array(z.string()).optional(),
1849
+ showInMenu: z.boolean().optional(),
1794
1850
  iconURL: z.union([z.string(), eModelEndpointSchema]).optional(),
1795
1851
  authType: authTypeSchema.optional(),
1796
1852
  hideBadgeRow: z.boolean().optional(),
1797
1853
  webSearch: z.boolean().optional(),
1798
1854
  fileSearch: z.boolean().optional(),
1799
1855
  executeCode: z.boolean().optional(),
1856
+ memory: z.boolean().optional(),
1857
+ askUserQuestion: z.boolean().optional(),
1858
+ runInBackground: z.union([z.boolean(), z.array(z.string())]).optional(),
1859
+ describeIntent: z.union([z.boolean(), z.array(z.string())]).optional(),
1800
1860
  artifacts: z.union([z.string(), z.boolean()]).optional(),
1801
1861
  mcpServers: z.array(z.string()).optional(),
1802
1862
  skills: z.union([z.boolean(), z.array(z.string())]).optional(),
@@ -1878,6 +1938,7 @@ const fullMimeTypesList = [
1878
1938
  "application/pdf",
1879
1939
  "text/x-php",
1880
1940
  "application/vnd.openxmlformats-officedocument.presentationml.presentation",
1941
+ "application/vnd.openxmlformats-officedocument.presentationml.template",
1881
1942
  "text/x-python",
1882
1943
  "text/x-script.python",
1883
1944
  "text/x-ruby",
@@ -1908,6 +1969,7 @@ const fullMimeTypesList = [
1908
1969
  "application/vnd.oasis.opendocument.graphics",
1909
1970
  "image/svg",
1910
1971
  "image/svg+xml",
1972
+ "message/rfc822",
1911
1973
  "video/mp4",
1912
1974
  "video/avi",
1913
1975
  "video/mov",
@@ -1941,6 +2003,7 @@ const codeInterpreterMimeTypesList = [
1941
2003
  "application/pdf",
1942
2004
  "text/x-php",
1943
2005
  "application/vnd.openxmlformats-officedocument.presentationml.presentation",
2006
+ "application/vnd.openxmlformats-officedocument.presentationml.template",
1944
2007
  "text/x-python",
1945
2008
  "text/x-script.python",
1946
2009
  "text/x-ruby",
@@ -1973,6 +2036,7 @@ const retrievalMimeTypesList = [
1973
2036
  "application/pdf",
1974
2037
  "text/x-php",
1975
2038
  "application/vnd.openxmlformats-officedocument.presentationml.presentation",
2039
+ "application/vnd.openxmlformats-officedocument.presentationml.template",
1976
2040
  "text/x-python",
1977
2041
  "text/x-script.python",
1978
2042
  "text/x-ruby",
@@ -1994,11 +2058,34 @@ const bedrockDocumentFormats = {
1994
2058
  "text/markdown": "md"
1995
2059
  };
1996
2060
  const isBedrockDocumentType = (mimeType) => mimeType != null && mimeType in bedrockDocumentFormats;
2061
+ /** MIME types Bedrock's Converse document path can send to the model (mirrors `bedrockDocumentFormats`). */
2062
+ const bedrockDocumentMimeTypes = Object.keys(bedrockDocumentFormats);
1997
2063
  /** File extensions accepted by Bedrock document uploads (for input accept attributes) */
1998
2064
  const bedrockDocumentExtensions = ".pdf,.csv,.doc,.docx,.xls,.xlsx,.html,.htm,.txt,.md,application/pdf,text/csv,application/csv,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,text/html,text/plain,text/markdown";
2065
+ /** Textual `application/*` MIME types that can be decoded and sent as plain text */
2066
+ const textualApplicationTypes = new Set([
2067
+ "application/json",
2068
+ "application/xml",
2069
+ "application/yaml",
2070
+ "application/sql",
2071
+ "application/typescript",
2072
+ "application/x-sh",
2073
+ "application/csv"
2074
+ ]);
2075
+ /**
2076
+ * MIME types the Anthropic Messages API accepts as a plain-text document source
2077
+ * (`source.type: 'text'`)
2078
+ */
2079
+ const isAnthropicTextDocumentType = (mimeType) => mimeType != null && (mimeType.startsWith("text/") || textualApplicationTypes.has(mimeType));
2080
+ /**
2081
+ * MIME types the Anthropic Messages API document path can send to the model
2082
+ * (mirrors `isBedrockDocumentType`): PDF via base64, textual types via a
2083
+ * plain-text document source. All other types are rejected with a provider 400.
2084
+ */
2085
+ const isAnthropicDocumentType = (mimeType) => mimeType === "application/pdf" || isAnthropicTextDocumentType(mimeType);
1999
2086
  const excelMimeTypes = /^application\/(vnd\.ms-excel|msexcel|x-msexcel|x-ms-excel|x-excel|x-dos_ms_excel|xls|x-xls|vnd\.openxmlformats-officedocument\.spreadsheetml\.sheet)$/;
2000
2087
  const textMimeTypes = /^(text\/(x-c|x-csharp|tab-separated-values|x-c\+\+|x-h|x-java|html|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|css|vtt|javascript|csv|xml|calendar))$/;
2001
- const applicationMimeTypes = /^(application\/(epub\+zip|csv|json|msword|pdf|x-tar|x-sh|x-zip-compressed|typescript|sql|yaml|x-parquet|vnd\.apache\.parquet|vnd\.coffeescript|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation|spreadsheetml\.sheet)|vnd\.oasis\.opendocument\.(text|spreadsheet|presentation|graphics)|xml|zip))$/;
2088
+ const applicationMimeTypes = /^(application\/(epub\+zip|csv|json|msword|pdf|x-tar|x-sh|x-zip-compressed|typescript|sql|yaml|x-parquet|vnd\.apache\.parquet|vnd\.coffeescript|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.(presentation|template)|spreadsheetml\.sheet)|vnd\.oasis\.opendocument\.(text|spreadsheet|presentation|graphics)|xml|zip))$/;
2002
2089
  const imageMimeTypes = /^image\/(jpeg|gif|png|webp|heic|heif)$/;
2003
2090
  const audioMimeTypes = /^audio\/(mp3|mpeg|mpeg3|wav|wave|x-wav|ogg|vorbis|mp4|m4a|x-m4a|flac|x-flac|webm|aac|wma|opus)$/;
2004
2091
  const videoMimeTypes = /^video\/(mp4|avi|mov|wmv|flv|webm|mkv|m4v|3gp|ogv)$/;
@@ -2007,6 +2094,7 @@ const defaultOCRMimeTypes = [
2007
2094
  excelMimeTypes,
2008
2095
  /^application\/pdf$/,
2009
2096
  /^application\/vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation)$/,
2097
+ /^application\/vnd\.openxmlformats-officedocument\.presentationml\.template$/,
2010
2098
  /^application\/vnd\.ms-(word|powerpoint)$/,
2011
2099
  /^application\/epub\+zip$/,
2012
2100
  /^application\/vnd\.oasis\.opendocument\.(text|spreadsheet|presentation|graphics)$/
@@ -2028,7 +2116,8 @@ const supportedMimeTypes = [
2028
2116
  imageMimeTypes,
2029
2117
  videoMimeTypes,
2030
2118
  audioMimeTypes,
2031
- /^image\/(svg|svg\+xml)$/
2119
+ /^image\/(svg|svg\+xml)$/,
2120
+ /^message\/rfc822$/
2032
2121
  ];
2033
2122
  const codeInterpreterMimeTypes = [
2034
2123
  textMimeTypes,
@@ -2083,6 +2172,7 @@ const codeTypeMapping = {
2083
2172
  cljs: "text/plain",
2084
2173
  cljc: "text/plain",
2085
2174
  elm: "text/plain",
2175
+ eml: "message/rfc822",
2086
2176
  erl: "text/plain",
2087
2177
  hrl: "text/plain",
2088
2178
  ex: "text/plain",
@@ -2154,6 +2244,13 @@ const codeTypeMapping = {
2154
2244
  ods: "application/vnd.oasis.opendocument.spreadsheet",
2155
2245
  odp: "application/vnd.oasis.opendocument.presentation",
2156
2246
  odg: "application/vnd.oasis.opendocument.graphics",
2247
+ doc: "application/msword",
2248
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
2249
+ xls: "application/vnd.ms-excel",
2250
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
2251
+ ppt: "application/vnd.ms-powerpoint",
2252
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
2253
+ potx: "application/vnd.openxmlformats-officedocument.presentationml.template",
2157
2254
  ics: "text/calendar",
2158
2255
  ical: "text/calendar",
2159
2256
  ifb: "text/calendar",
@@ -2168,7 +2265,11 @@ const imageTypeMapping = {
2168
2265
  const mimeTypeAliases = {
2169
2266
  "application/x-zip-compressed": "application/zip",
2170
2267
  "text/x-python-script": "text/x-python",
2171
- "text/x-markdown": "text/markdown"
2268
+ "text/x-markdown": "text/markdown",
2269
+ /** freedesktop shared-mime-info (Chrome on Linux) */
2270
+ "application/x-shellscript": "application/x-sh",
2271
+ /** libmagic, i.e. `file --mime-type` */
2272
+ "text/x-shellscript": "application/x-sh"
2172
2273
  };
2173
2274
  /**
2174
2275
  * Infers the MIME type from a file's extension when the browser doesn't recognize it,
@@ -2182,7 +2283,7 @@ function inferMimeType(fileName, currentType) {
2182
2283
  const extension = fileName.split(".").pop()?.toLowerCase() ?? "";
2183
2284
  return codeTypeMapping[extension] || imageTypeMapping[extension] || currentType;
2184
2285
  }
2185
- const retrievalMimeTypes = [/^(text\/(x-c|x-c\+\+|x-h|html|x-java|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|vtt|xml))$/, /^(application\/(json|pdf|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation)))$/];
2286
+ const retrievalMimeTypes = [/^(text\/(x-c|x-c\+\+|x-h|html|x-java|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|vtt|xml))$/, /^(application\/(json|pdf|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.(presentation|template))))$/];
2186
2287
  const megabyte = 1024 * 1024;
2187
2288
  /** Helper function to get megabytes value */
2188
2289
  const mbToBytes = (mb) => mb * megabyte;
@@ -2261,21 +2362,212 @@ const fileConfigSchema = z.object({
2261
2362
  ocr: z.object({ supportedMimeTypes: supportedMimeTypesSchema.optional() }).optional(),
2262
2363
  text: z.object({ supportedMimeTypes: supportedMimeTypesSchema.optional() }).optional()
2263
2364
  });
2264
- /** Helper function to safely convert string patterns to RegExp objects */
2265
- const convertStringsToRegex = (patterns) => patterns.reduce((acc, pattern) => {
2266
- try {
2267
- const regex = new RegExp(pattern);
2268
- acc.push(regex);
2269
- } catch (error) {
2270
- console.error(`Invalid regex pattern "${pattern}" skipped.`, error);
2365
+ /**
2366
+ * Compiler for admin-supplied MIME patterns. Defaults to native `RegExp`, which browser
2367
+ * builds keep so no extra dependency is bundled. The server swaps in a linear-time engine
2368
+ * via `setFileConfigRegexCompiler` so an admin-authored catastrophic-backtracking pattern
2369
+ * cannot ReDoS the shared event loop when tested against an uploaded file's MIME type.
2370
+ */
2371
+ let compileMimeRegex = (pattern) => new RegExp(pattern);
2372
+ /** Override the MIME-pattern compiler; the server injects a linear-time engine at startup. */
2373
+ const setFileConfigRegexCompiler = (compile) => {
2374
+ compileMimeRegex = compile;
2375
+ };
2376
+ /** Returned when every configured pattern fails to compile, so consumers that read an empty
2377
+ * allowlist as "no restriction" fail closed instead of allowing every file. */
2378
+ const rejectAllMimeMatcher = { test: () => false };
2379
+ /** Helper function to safely convert string patterns to matcher objects */
2380
+ const convertStringsToRegex = (patterns) => {
2381
+ const compiled = patterns.reduce((acc, pattern) => {
2382
+ try {
2383
+ acc.push(compileMimeRegex(pattern));
2384
+ } catch (error) {
2385
+ console.error(`Invalid regex pattern "${pattern}" skipped.`, error);
2386
+ }
2387
+ return acc;
2388
+ }, []);
2389
+ if (patterns.length > 0 && compiled.length === 0) {
2390
+ console.error(`All ${patterns.length} MIME type pattern(s) were invalid and skipped; the resulting allowlist rejects every file.`);
2391
+ return [rejectAllMimeMatcher];
2271
2392
  }
2272
- return acc;
2273
- }, []);
2393
+ return compiled;
2394
+ };
2274
2395
  /** Detects whether the given MIME type patterns accept all file types (e.g., `.*` or `.+`). */
2275
2396
  const isPermissiveMimeConfig = (types) => {
2276
2397
  if (!types || types.length === 0) return false;
2277
2398
  return types.some((regex) => regex.test("x-librechat/x-probe"));
2278
2399
  };
2400
+ /** Media categories that collapse to a wildcard `accept` token when any member type is allowed. */
2401
+ const mimeAcceptCategories = [
2402
+ {
2403
+ /** Mirrors `imageMimeTypes` (+ the code-interpreter svg variants) so every accepted type is known. */
2404
+ category: "image",
2405
+ token: "image/*",
2406
+ samples: [
2407
+ "image/jpeg",
2408
+ "image/gif",
2409
+ "image/png",
2410
+ "image/webp",
2411
+ "image/heic",
2412
+ "image/heif",
2413
+ "image/svg",
2414
+ "image/svg+xml"
2415
+ ],
2416
+ extras: [".heif", ".heic"]
2417
+ },
2418
+ {
2419
+ /** Mirrors `audioMimeTypes`. */
2420
+ category: "audio",
2421
+ token: "audio/*",
2422
+ samples: [
2423
+ "audio/mp3",
2424
+ "audio/mpeg",
2425
+ "audio/mpeg3",
2426
+ "audio/wav",
2427
+ "audio/wave",
2428
+ "audio/x-wav",
2429
+ "audio/ogg",
2430
+ "audio/vorbis",
2431
+ "audio/mp4",
2432
+ "audio/m4a",
2433
+ "audio/x-m4a",
2434
+ "audio/flac",
2435
+ "audio/x-flac",
2436
+ "audio/webm",
2437
+ "audio/aac",
2438
+ "audio/wma",
2439
+ "audio/opus"
2440
+ ]
2441
+ },
2442
+ {
2443
+ /** Mirrors `videoMimeTypes`. */
2444
+ category: "video",
2445
+ token: "video/*",
2446
+ samples: [
2447
+ "video/mp4",
2448
+ "video/avi",
2449
+ "video/mov",
2450
+ "video/wmv",
2451
+ "video/flv",
2452
+ "video/webm",
2453
+ "video/mkv",
2454
+ "video/m4v",
2455
+ "video/3gp",
2456
+ "video/ogv"
2457
+ ]
2458
+ }
2459
+ ];
2460
+ /** Document/text MIME types paired with the extension(s) browsers filter on in the file picker. */
2461
+ const documentMimeExtensions = [
2462
+ ["application/pdf", [".pdf"]],
2463
+ ["application/msword", [".doc"]],
2464
+ ["application/vnd.openxmlformats-officedocument.wordprocessingml.document", [".docx"]],
2465
+ ["application/vnd.ms-excel", [".xls"]],
2466
+ ["application/msexcel", [".xls"]],
2467
+ ["application/x-msexcel", [".xls"]],
2468
+ ["application/x-ms-excel", [".xls"]],
2469
+ ["application/x-excel", [".xls"]],
2470
+ ["application/x-dos_ms_excel", [".xls"]],
2471
+ ["application/xls", [".xls"]],
2472
+ ["application/x-xls", [".xls"]],
2473
+ ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", [".xlsx"]],
2474
+ ["application/vnd.ms-powerpoint", [".ppt"]],
2475
+ ["application/vnd.openxmlformats-officedocument.presentationml.presentation", [".pptx"]],
2476
+ ["application/vnd.openxmlformats-officedocument.presentationml.template", [".potx"]],
2477
+ ["application/vnd.oasis.opendocument.text", [".odt"]],
2478
+ ["application/vnd.oasis.opendocument.spreadsheet", [".ods"]],
2479
+ ["application/vnd.oasis.opendocument.presentation", [".odp"]],
2480
+ ["application/vnd.oasis.opendocument.graphics", [".odg"]],
2481
+ ["application/rtf", [".rtf"]],
2482
+ ["application/json", [".json"]],
2483
+ ["application/xml", [".xml"]],
2484
+ ["application/yaml", [".yaml", ".yml"]],
2485
+ ["application/zip", [".zip"]],
2486
+ ["application/x-zip-compressed", [".zip"]],
2487
+ ["application/epub+zip", [".epub"]],
2488
+ ["application/x-parquet", [".parquet"]],
2489
+ ["application/vnd.apache.parquet", [".parquet"]],
2490
+ ["text/csv", [".csv"]],
2491
+ ["application/csv", [".csv"]],
2492
+ ["text/tab-separated-values", [".tsv"]],
2493
+ ["text/plain", [".txt"]],
2494
+ ["text/markdown", [".md"]],
2495
+ ["text/html", [".html", ".htm"]],
2496
+ ["text/calendar", [".ics"]],
2497
+ ["message/rfc822", [".eml"]]
2498
+ ];
2499
+ const documentMimeSet = new Set(documentMimeExtensions.map(([mimeType]) => mimeType));
2500
+ /** Every MIME type LibreChat may accept, used to detect patterns that reach beyond the representable set. */
2501
+ const knownMimeUniverse = Array.from(new Set([
2502
+ ...fullMimeTypesList,
2503
+ ...documentMimeExtensions.map(([mimeType]) => mimeType),
2504
+ ...mimeAcceptCategories.flatMap((category) => category.samples)
2505
+ ]));
2506
+ const categoryOf = (mimeType) => {
2507
+ if (mimeType.startsWith("image/")) return "image";
2508
+ if (mimeType.startsWith("audio/")) return "audio";
2509
+ if (mimeType.startsWith("video/")) return "video";
2510
+ return "document";
2511
+ };
2512
+ /** Media types are covered by their `<cat>/*` wildcard token; document types need an explicit entry. */
2513
+ const isRepresentable = (mimeType) => categoryOf(mimeType) !== "document" || documentMimeSet.has(mimeType);
2514
+ /**
2515
+ * Translates a finite MIME allowlist into a file-input `accept` string, intersected with what the
2516
+ * provider upload path can actually send. Returns `undefined` (keep the provider filter) when a
2517
+ * configured pattern matches a supported, path-handleable type that cannot be represented, so the
2518
+ * picker never hides a file the path would have accepted.
2519
+ */
2520
+ const buildMimeAccept = (types, { categories, documentMimeTypes }) => {
2521
+ const permittedSet = new Set(categories);
2522
+ const documentAllowSet = documentMimeTypes ? new Set(documentMimeTypes) : null;
2523
+ const emittedMedia = /* @__PURE__ */ new Set();
2524
+ const emittedDocuments = /* @__PURE__ */ new Set();
2525
+ if (!types.every((regex) => knownMimeUniverse.some((mimeType) => regex.test(mimeType)))) return;
2526
+ for (const regex of types) for (const mimeType of knownMimeUniverse) {
2527
+ if (!regex.test(mimeType)) continue;
2528
+ const category = categoryOf(mimeType);
2529
+ if (!permittedSet.has(category)) continue;
2530
+ /** The path handles documents but drops this specific type (e.g. Bedrock ignores pptx/ODF). */
2531
+ if (category === "document" && documentAllowSet && !documentAllowSet.has(mimeType)) continue;
2532
+ if (!isRepresentable(mimeType)) return;
2533
+ if (category === "document") emittedDocuments.add(mimeType);
2534
+ else emittedMedia.add(category);
2535
+ }
2536
+ const tokens = [];
2537
+ const seen = /* @__PURE__ */ new Set();
2538
+ const push = (token) => {
2539
+ if (!seen.has(token)) {
2540
+ seen.add(token);
2541
+ tokens.push(token);
2542
+ }
2543
+ };
2544
+ for (const category of mimeAcceptCategories) if (emittedMedia.has(category.category)) {
2545
+ push(category.token);
2546
+ category.extras?.forEach(push);
2547
+ }
2548
+ for (const [mimeType, extensions] of documentMimeExtensions) if (emittedDocuments.has(mimeType)) {
2549
+ extensions.forEach(push);
2550
+ push(mimeType);
2551
+ }
2552
+ return tokens.length > 0 ? tokens.join(",") : void 0;
2553
+ };
2554
+ /**
2555
+ * Resolves the file-input `accept` value for a configured `supportedMimeTypes` allowlist, scoped to
2556
+ * what the current upload path (`capability`) can send to the model.
2557
+ * - `undefined` for the built-in default or a config that can't be represented safely, so callers
2558
+ * keep their provider-specific filter.
2559
+ * - `''` for permissive configs (e.g. `.*`), leaving the picker unrestricted.
2560
+ * - a translated `accept` string for a recognized finite allowlist (images, PDFs, Office docs, etc.).
2561
+ *
2562
+ * The picker `accept` is a UX convenience, not a security boundary: the backend still enforces
2563
+ * `supportedMimeTypes` on upload.
2564
+ */
2565
+ const getConfiguredMimeAccept = (types, capability) => {
2566
+ /** Referential identity with the built-in list signals an unconfigured endpoint (keep provider filter). */
2567
+ if (!types || types.length === 0 || types === supportedMimeTypes) return;
2568
+ if (isPermissiveMimeConfig(types)) return "";
2569
+ return buildMimeAccept(types, capability);
2570
+ };
2279
2571
  /**
2280
2572
  * Gets the appropriate endpoint file configuration with standardized lookup logic.
2281
2573
  *
@@ -2445,8 +2737,16 @@ const messagesArtifacts = (messageId) => `${messagesRoot}/artifact/${messageId}`
2445
2737
  const messagesBranch = () => `${messagesRoot}/branch`;
2446
2738
  const shareRoot = `${BASE_URL}/api/share`;
2447
2739
  const shareMessages = (shareId) => `${shareRoot}/${shareId}`;
2740
+ const forkSharedMessages = (shareId) => `${shareRoot}/${shareId}/fork`;
2741
+ const sharedStartupConfig = (shareId) => `${shareMessages(shareId)}/config`;
2448
2742
  const getSharedLink$1 = (conversationId) => `${shareRoot}/link/${conversationId}`;
2449
- const getSharedLinks = (pageSize, sortBy, sortDirection, search, cursor) => `${shareRoot}?pageSize=${pageSize}&sortBy=${sortBy}&sortDirection=${sortDirection}${search ? `&search=${search}` : ""}${cursor ? `&cursor=${cursor}` : ""}`;
2743
+ const getSharedLinks = (pageSize, sortBy, sortDirection, search, cursor) => `${shareRoot}${buildQuery({
2744
+ pageSize,
2745
+ sortBy,
2746
+ sortDirection,
2747
+ search,
2748
+ cursor
2749
+ })}`;
2450
2750
  const createSharedLink$1 = (conversationId) => `${shareRoot}/${conversationId}`;
2451
2751
  const updateSharedLink$1 = (shareId) => `${shareRoot}/${shareId}`;
2452
2752
  /** Share-scoped file routes: serve snapshotted files via shared-link permission. */
@@ -2486,7 +2786,6 @@ const presets = () => `${BASE_URL}/api/presets`;
2486
2786
  const deletePreset$1 = () => `${BASE_URL}/api/presets/delete`;
2487
2787
  const aiEndpoints = () => `${BASE_URL}/api/endpoints`;
2488
2788
  const tokenConfig = () => `${BASE_URL}/api/endpoints/token-config`;
2489
- const contextProjection = () => `${BASE_URL}/api/endpoints/context-projection`;
2490
2789
  const models = () => `${BASE_URL}/api/models`;
2491
2790
  const tokenizer = () => `${BASE_URL}/api/tokenizer`;
2492
2791
  const login$1 = () => `${BASE_URL}/api/auth/login`;
@@ -2525,6 +2824,7 @@ const mcpAuthValues = (serverName) => {
2525
2824
  const cancelMCPOAuth$1 = (serverName) => {
2526
2825
  return `${BASE_URL}/api/mcp/oauth/cancel/${serverName}`;
2527
2826
  };
2827
+ const mcpOAuthStatus = (flowId) => `${BASE_URL}/api/mcp/oauth/status/${encodeURIComponent(flowId)}`;
2528
2828
  const mcpOAuthBind = (serverName) => `${BASE_URL}/api/mcp/${serverName}/oauth/bind`;
2529
2829
  const actionOAuthBind = (actionId) => `${BASE_URL}/api/actions/${actionId}/oauth/bind`;
2530
2830
  const config = (context) => `${BASE_URL}/api/config${buildQuery({ context })}`;
@@ -2561,6 +2861,8 @@ const mcpServer = (serverName) => `${BASE_URL}/api/mcp/servers/${serverName}`;
2561
2861
  const revertAgentVersion$1 = (agent_id) => `${agents({ path: `${agent_id}/revert` })}`;
2562
2862
  const files = () => `${BASE_URL}/api/files`;
2563
2863
  const filePreview = (fileId) => `${BASE_URL}/api/files/${encodeURIComponent(fileId)}/preview`;
2864
+ /** Owner-scoped usage touch so queued attachments outlive the upload-window TTL. */
2865
+ const fileUsage = () => `${BASE_URL}/api/files/usage`;
2564
2866
  const agentFiles = (agentId) => `${BASE_URL}/api/files/agent/${agentId}`;
2565
2867
  const images = () => `${files()}/images`;
2566
2868
  const avatar = () => `${images()}/avatar`;
@@ -2622,6 +2924,11 @@ const adminSkillsSyncStatus = () => `${adminSkillsSync()}/status`;
2622
2924
  const adminSkillsSyncRun = () => `${adminSkillsSync()}/run`;
2623
2925
  const adminSkillsSyncCredential = (credentialKey) => `${adminSkillsSync()}/credentials/${encodeURIComponent(credentialKey)}`;
2624
2926
  const skillStates = () => `${BASE_URL}/api/user/settings/skills/active`;
2927
+ const adminLangfuseConnection = () => `${BASE_URL}/api/admin/langfuse/connection`;
2928
+ const adminLangfuseConnectionTest = () => `${adminLangfuseConnection()}/test`;
2929
+ const adminLangfuseSessionLink = (conversationId) => `${adminLangfuseConnection()}/session/${encodeURIComponent(conversationId)}`;
2930
+ const toolFavorites = () => `${BASE_URL}/api/user/settings/favorites/tools`;
2931
+ const toolFavorite = (itemType, itemId) => `${toolFavorites()}/${itemType}/${encodeURIComponent(itemId)}`;
2625
2932
  const roles = () => `${BASE_URL}/api/roles`;
2626
2933
  const adminRoles = () => `${BASE_URL}/api/admin/roles`;
2627
2934
  const getRole$1 = (roleName) => `${roles()}/${encodeURIComponent(roleName)}`;
@@ -2646,7 +2953,7 @@ const disableTwoFactor$1 = () => `${BASE_URL}/api/auth/2fa/disable`;
2646
2953
  const regenerateBackupCodes$1 = () => `${BASE_URL}/api/auth/2fa/backup/regenerate`;
2647
2954
  const verifyTwoFactorTemp$1 = () => `${BASE_URL}/api/auth/2fa/verify-temp`;
2648
2955
  const memories = () => `${BASE_URL}/api/memories`;
2649
- const memory = (key) => `${memories()}/${encodeURIComponent(key)}`;
2956
+ const memory = (key, agentId) => `${memories()}/${encodeURIComponent(key)}${agentId ? `?agentId=${encodeURIComponent(agentId)}` : ""}`;
2650
2957
  const memoryPreferences = () => `${memories()}/preferences`;
2651
2958
  const searchPrincipals$1 = (params) => {
2652
2959
  const { q: query, limit, types } = params;
@@ -2929,7 +3236,12 @@ const StdioOptionsSchema = BaseOptionsSchema.extend({
2929
3236
  "pipe",
2930
3237
  "ignore",
2931
3238
  "inherit"
2932
- ]), z.number().int().nonnegative()]).optional()
3239
+ ]), z.number().int().nonnegative()]).optional(),
3240
+ /**
3241
+ * Working directory for the spawned process. Supplied by Agent Plugins
3242
+ * packages, which resolve and contain the path before it reaches this schema.
3243
+ */
3244
+ cwd: z.string().optional()
2933
3245
  });
2934
3246
  const WebSocketOptionsSchema = BaseOptionsSchema.extend({
2935
3247
  type: z.literal("websocket").default("websocket"),
@@ -3065,6 +3377,9 @@ const defaultSocialLogins = [
3065
3377
  "saml"
3066
3378
  ];
3067
3379
  const BASE_ONLY_CONFIG_SECTIONS = [];
3380
+ /** Sections that may be stored in the tenant's base config document but must
3381
+ * not be overridden or tombstoned by role, group, or user config documents. */
3382
+ const BASE_PRINCIPAL_CONFIG_SECTIONS = ["langfuse"];
3068
3383
  const defaultRetrievalModels = [
3069
3384
  "gpt-4o",
3070
3385
  "o1-preview-2024-09-12",
@@ -3148,6 +3463,32 @@ function isPrivateIPv4Literal(value) {
3148
3463
  if (a >= 224) return true;
3149
3464
  return false;
3150
3465
  }
3466
+ /**
3467
+ * Mirrors `hasPrivateEmbeddedIPv4` in `@librechat/api`'s ip helpers: 6to4, NAT64, and Teredo
3468
+ * carry an IPv4 address inside the IPv6 one, and the runtime guard blocks those when the
3469
+ * embedded address is private. Kept in sync so an operator can exempt what the runtime blocks.
3470
+ */
3471
+ function hasPrivateEmbeddedIPv4Literal(value) {
3472
+ const is6to4 = value.startsWith("2002:");
3473
+ const isNat64 = value.startsWith("64:ff9b::");
3474
+ const isTeredo = value.startsWith("2001::");
3475
+ if (!is6to4 && !isNat64 && !isTeredo) return false;
3476
+ const segments = value.split(":").filter((segment) => segment !== "");
3477
+ const pair = is6to4 ? segments.slice(1, 3) : segments.slice(-2);
3478
+ if (pair.length !== 2) return false;
3479
+ const hi = parseInt(pair[0], 16);
3480
+ const lo = parseInt(pair[1], 16);
3481
+ if (isNaN(hi) || isNaN(lo)) return false;
3482
+ /** RFC 4380: Teredo stores the external IPv4 as a bitwise complement. */
3483
+ const high = isTeredo ? ~hi : hi;
3484
+ const low = isTeredo ? ~lo : lo;
3485
+ return isPrivateIPv4Literal([
3486
+ high >> 8 & 255,
3487
+ high & 255,
3488
+ low >> 8 & 255,
3489
+ low & 255
3490
+ ].join("."));
3491
+ }
3151
3492
  function isPrivateIPv6Literal(value) {
3152
3493
  if (!value.includes(":")) return false;
3153
3494
  if (value === "::1" || value === "::") return true;
@@ -3158,7 +3499,7 @@ function isPrivateIPv6Literal(value) {
3158
3499
  }
3159
3500
  const mappedMatch = value.match(/^::ffff:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
3160
3501
  if (mappedMatch) return isPrivateIPv4Literal(mappedMatch[1]);
3161
- return false;
3502
+ return hasPrivateEmbeddedIPv4Literal(value);
3162
3503
  }
3163
3504
  /**
3164
3505
  * Mirrors the allowedAddresses parser in `@librechat/api`'s auth helpers.
@@ -3375,6 +3716,7 @@ let AgentCapabilities = /* @__PURE__ */ function(AgentCapabilities) {
3375
3716
  AgentCapabilities["end_after_tools"] = "end_after_tools";
3376
3717
  AgentCapabilities["deferred_tools"] = "deferred_tools";
3377
3718
  AgentCapabilities["execute_code"] = "execute_code";
3719
+ AgentCapabilities["stateful_code_sessions"] = "stateful_code_sessions";
3378
3720
  AgentCapabilities["file_search"] = "file_search";
3379
3721
  AgentCapabilities["web_search"] = "web_search";
3380
3722
  AgentCapabilities["artifacts"] = "artifacts";
@@ -3382,9 +3724,13 @@ let AgentCapabilities = /* @__PURE__ */ function(AgentCapabilities) {
3382
3724
  AgentCapabilities["actions"] = "actions";
3383
3725
  AgentCapabilities["context"] = "context";
3384
3726
  AgentCapabilities["skills"] = "skills";
3727
+ AgentCapabilities["memory"] = "memory";
3728
+ AgentCapabilities["ask_user_question"] = "ask_user_question";
3385
3729
  AgentCapabilities["tools"] = "tools";
3386
3730
  AgentCapabilities["chain"] = "chain";
3387
3731
  AgentCapabilities["ocr"] = "ocr";
3732
+ AgentCapabilities["run_in_background"] = "run_in_background";
3733
+ AgentCapabilities["tool_intents"] = "tool_intents";
3388
3734
  return AgentCapabilities;
3389
3735
  }({});
3390
3736
  const defaultAssistantsVersion = {
@@ -3392,7 +3738,14 @@ const defaultAssistantsVersion = {
3392
3738
  ["azureAssistants"]: 1
3393
3739
  };
3394
3740
  const baseEndpointSchema = z.object({
3395
- streamRate: z.number().optional(),
3741
+ /**
3742
+ * Milliseconds between visible streamed chunks. Agents SDK-backed
3743
+ * providers (openAI, custom, anthropic, google, bedrock, agents) smooth
3744
+ * adaptively at 25ms by default; set to override the cadence, 0 to
3745
+ * disable smoothing. Legacy Assistants and Ollama paths instead sleep
3746
+ * this long per provider chunk (default 1ms), with no adaptive smoothing.
3747
+ */
3748
+ streamRate: z.number().min(0).optional(),
3396
3749
  baseURL: z.string().optional(),
3397
3750
  /**
3398
3751
  * Custom request headers forwarded to the provider on every request. Values
@@ -3420,6 +3773,37 @@ const baseEndpointSchema = z.object({
3420
3773
  * completes (legacy behavior).
3421
3774
  */
3422
3775
  titleTiming: z.union([z.literal("immediate"), z.literal("final")]).optional(),
3776
+ /**
3777
+ * Agent activity groups: collapse each contiguous block of reasoning and
3778
+ * tool calls under a generated one-line header. Mirrors the title options
3779
+ * above — `activityLabel` enables it (like `titleConvo`), the rest tune
3780
+ * the fast model that writes the label.
3781
+ *
3782
+ * NOTE: fields added here reach `endpoints.all` automatically (that schema
3783
+ * is `baseEndpointSchema.omit({ baseURL })`), but NOT Azure — see the
3784
+ * enumerated `.pick()` in `azureEndpointSchema` below.
3785
+ */
3786
+ activityLabel: z.boolean().optional(),
3787
+ /** Model used to write activity labels. Defaults to `titleModel`, then the agent's model. */
3788
+ activityModel: z.string().optional(),
3789
+ /** Endpoint whose credentials the label model runs on. Defaults to the agent's endpoint. */
3790
+ activityEndpoint: z.string().optional(),
3791
+ /** Overrides the system prompt used to write activity labels. */
3792
+ activityPrompt: z.string().optional(),
3793
+ /** Cost cap: maximum labels generated per run. Default 20. */
3794
+ activityMaxPerRun: z.number().int().positive().optional(),
3795
+ /** Per-entry truncation of tool input/output in the label prompt. Default 600. */
3796
+ activityCharLimit: z.number().int().positive().optional(),
3797
+ /** Generates one parent summary for each run phase containing 2+ activities. */
3798
+ activityPhaseLabel: z.boolean().optional(),
3799
+ /** Model used for phase summaries. Defaults to activityModel, titleModel, then the run model. */
3800
+ activityPhaseModel: z.string().optional(),
3801
+ /** Endpoint whose credentials the phase summary model uses. Defaults to activityEndpoint. */
3802
+ activityPhaseEndpoint: z.string().optional(),
3803
+ /** Overrides the dedicated phase-summary system prompt. */
3804
+ activityPhasePrompt: z.string().optional(),
3805
+ /** Cost cap: maximum phase summaries generated per run. Default 5. */
3806
+ activityPhaseMaxPerRun: z.number().int().positive().optional(),
3423
3807
  /** Maximum characters allowed in a single tool result before truncation. */
3424
3808
  maxToolResultChars: z.number().positive().optional()
3425
3809
  });
@@ -3460,6 +3844,11 @@ const assistantEndpointSchema = baseEndpointSchema.merge(z.object({
3460
3844
  "tools"
3461
3845
  ]),
3462
3846
  apiKey: z.string().optional(),
3847
+ /** Masked preview of the API key, stored at write time so admin
3848
+ * reads can show which key is configured without returning the secret.
3849
+ * Shared by both `endpoints.assistants` and `endpoints.azureAssistants`,
3850
+ * which both use this schema. */
3851
+ apiKeyPreview: z.string().optional(),
3463
3852
  models: z.object({
3464
3853
  default: z.array(modelItemSchema).min(1),
3465
3854
  fetch: z.boolean().optional(),
@@ -3477,6 +3866,8 @@ const defaultAgentCapabilities = [
3477
3866
  "actions",
3478
3867
  "context",
3479
3868
  "skills",
3869
+ "memory",
3870
+ "ask_user_question",
3480
3871
  "tools",
3481
3872
  "chain",
3482
3873
  "ocr"
@@ -3522,17 +3913,136 @@ const remoteApiAuthSchema = z.object({
3522
3913
  oidc: remoteApiOidcSchema.optional()
3523
3914
  });
3524
3915
  const remoteApiSchema = z.object({ auth: remoteApiAuthSchema.optional() });
3916
+ /**
3917
+ * Permission mode applied to a tool call. Mirrors `@librechat/agents`'s
3918
+ * `ToolPolicyMode` 1:1.
3919
+ *
3920
+ * - `default`: ask the user about anything not explicitly allowed (default-on).
3921
+ * - `dontAsk`: deny anything not explicitly allowed (headless / API-key flows).
3922
+ * - `bypass`: auto-approve everything that isn't explicitly denied
3923
+ * (the user-facing "stop asking me" toggle).
3924
+ *
3925
+ * Subagents inherit the parent's mode; this is enforced by the SDK and not
3926
+ * overridable per-subagent.
3927
+ */
3928
+ const toolApprovalModeSchema = z.enum([
3929
+ "default",
3930
+ "dontAsk",
3931
+ "bypass"
3932
+ ]);
3933
+ /**
3934
+ * Per-endpoint tool-approval policy.
3935
+ *
3936
+ * Shape mirrors `@librechat/agents`'s `ToolPolicyConfig` so the host can map it
3937
+ * directly into `createToolPolicyHook(config)`. The SDK does the evaluation
3938
+ * (`deny → bypass → allow → ask → dontAsk → fallthrough(ask)`); this config
3939
+ * just describes the surface.
3940
+ *
3941
+ * Conventions:
3942
+ * - All list entries are matched as globs (`*`). Use `mcp:server:*` to scope
3943
+ * a rule to every tool from a single MCP server.
3944
+ * - `deny` always wins, including under `bypass`.
3945
+ * - `enabled: false` is a LibreChat-only kill switch that disables the entire
3946
+ * HITL machinery for this endpoint (no checkpointer, no hooks, no prompts).
3947
+ * This is admin-level; users toggle prompting via `mode: 'bypass'` instead.
3948
+ */
3949
+ /**
3950
+ * A programmatic tool-approval hook loaded from a module at startup.
3951
+ *
3952
+ * The referenced module's default export must be a builder
3953
+ * `(options?) => ToolApprovalHookFactory` (see `@librechat/api`'s `registerToolApprovalHook`).
3954
+ * Hooks compose with the static `allow`/`deny`/`ask` policy above and can only TIGHTEN it
3955
+ * (the SDK folds decisions `deny → ask → allow`). This is admin-level config — the module is
3956
+ * dynamically imported and executed in-process, so only reference trusted code.
3957
+ */
3958
+ const toolApprovalHookConfigSchema = z.object({
3959
+ /**
3960
+ * Module specifier to import: a bare package name (e.g. `@acme/approval-hooks`) or a path —
3961
+ * absolute, or relative to the app root. Its default export is the hook builder.
3962
+ */
3963
+ module: z.string().min(1),
3964
+ /** Optional regex matched against the tool name; omit to run for every tool. */
3965
+ matcher: z.string().optional(),
3966
+ /** Static options forwarded to the module's builder; the hook's own per-call config. */
3967
+ options: z.record(z.unknown()).optional()
3968
+ });
3969
+ const toolApprovalPolicySchema = z.object({
3970
+ enabled: z.boolean().optional(),
3971
+ mode: toolApprovalModeSchema.optional(),
3972
+ allow: z.array(z.string()).optional(),
3973
+ deny: z.array(z.string()).optional(),
3974
+ ask: z.array(z.string()).optional(),
3975
+ /** Optional reason template surfaced in the prompt; `{tool}` is interpolated. */
3976
+ reason: z.string().optional(),
3977
+ /**
3978
+ * Programmatic policy hooks loaded from modules at startup. They layer on top of the
3979
+ * static lists above for dynamic, context-aware decisions the lists can't express
3980
+ * (per-args, per-agent, per-user). See {@link toolApprovalHookConfigSchema}.
3981
+ *
3982
+ * BASE-CONFIG ONLY: hooks are imported + registered once, process-wide, at server
3983
+ * startup — they are NOT reloaded from per-role/user/tenant admin overrides. Encode
3984
+ * per-user/tenant behavior INSIDE the hook (via its runtime context), not by varying the
3985
+ * module list per override. Honored only when `enabled` is true.
3986
+ */
3987
+ hooks: z.array(toolApprovalHookConfigSchema).optional()
3988
+ }).optional();
3989
+ /**
3990
+ * Durable checkpointer backing human-in-the-loop resume.
3991
+ *
3992
+ * When `toolApproval.enabled` is true, a run that pauses for review suspends its
3993
+ * LangGraph state to a checkpoint; resuming rebuilds that state on a *fresh* `Run`
3994
+ * — possibly on a different replica, or the same worker after a restart. That only
3995
+ * works if the checkpoint outlives the original request, so HITL needs a durable
3996
+ * saver, not the SDK's process-local `MemorySaver` fallback.
3997
+ *
3998
+ * Defaults are zero-config: with `toolApproval.enabled` on and no `checkpointer`
3999
+ * block, LibreChat persists checkpoints to its primary MongoDB, so resume works
4000
+ * across replicas out of the box.
4001
+ *
4002
+ * - `type: 'mongo'` (default) — persist to the app database; survives restarts and
4003
+ * resolves on any replica. A TTL index reclaims runs that are never resolved.
4004
+ * - `type: 'memory'` — process-local only. Paused runs do NOT survive a restart and
4005
+ * can only be resolved on the originating worker. Single-process / dev only.
4006
+ */
4007
+ const checkpointerTypeSchema = z.enum(["mongo", "memory"]);
4008
+ const checkpointerSchema = z.object({
4009
+ type: checkpointerTypeSchema.optional(),
4010
+ /**
4011
+ * Approval window, in seconds: how long a paused run waits for a decision
4012
+ * before it is reclaimed. Drives both the Mongo TTL index on checkpoints and
4013
+ * the pending-action expiry, keeping the two layers in lockstep. Defaults to
4014
+ * 86400 (24h). Raise it for longer review windows.
4015
+ */
4016
+ ttl: z.number().int().positive().optional(),
4017
+ /** Advanced: override the Mongo collection names used for checkpoints. */
4018
+ checkpointCollectionName: z.string().optional(),
4019
+ checkpointWritesCollectionName: z.string().optional()
4020
+ }).optional();
3525
4021
  const agentsEndpointSchema = baseEndpointSchema.omit({ baseURL: true }).merge(z.object({
3526
4022
  recursionLimit: z.number().optional(),
3527
4023
  disableBuilder: z.boolean().optional().default(false),
3528
4024
  maxRecursionLimit: z.number().optional(),
4025
+ /** Max cumulative bytes a single streamed tool call's arguments may reach before the run
4026
+ * aborts. Defaults to 64 KiB in the agents SDK; `0` disables the guard. */
4027
+ maxToolCallArgBytes: z.number().optional(),
4028
+ /** Max streamed chunk events per model generation before the run aborts. Off by default. */
4029
+ maxDeltaEventsPerTurn: z.number().optional(),
4030
+ /** Per-tool overrides of `maxToolCallArgBytes`, keyed by model-facing tool name; `0`
4031
+ * disables the guard for that tool only. Merged over LibreChat's shipped default of
4032
+ * `{ create_file: 131072 }`. */
4033
+ maxToolCallArgBytesByTool: z.record(z.number()).optional(),
3529
4034
  maxCitations: z.number().min(1).max(50).optional().default(30),
3530
4035
  maxCitationsPerFile: z.number().min(1).max(10).optional().default(7),
3531
4036
  minRelevanceScore: z.number().min(0).max(1).optional().default(.45),
3532
4037
  allowedProviders: z.array(z.union([z.string(), eModelEndpointSchema])).optional(),
3533
4038
  capabilities: z.array(z.nativeEnum(AgentCapabilities)).optional().default(defaultAgentCapabilities),
3534
4039
  skills: z.object({ maxCatalogSkills: z.number().int().min(1).max(100).optional() }).optional(),
3535
- remoteApi: remoteApiSchema.optional()
4040
+ remoteApi: remoteApiSchema.optional(),
4041
+ /** Human-in-the-loop tool approval policy. Off by default. */
4042
+ toolApproval: toolApprovalPolicySchema,
4043
+ /** Durable checkpointer backing tool-approval and Ask User resume.
4044
+ * Defaults to the app's MongoDB when either flow needs it. */
4045
+ checkpointer: checkpointerSchema
3536
4046
  })).default({
3537
4047
  disableBuilder: false,
3538
4048
  capabilities: defaultAgentCapabilities,
@@ -3591,6 +4101,9 @@ const paramDefinitionSchema = z.object({
3591
4101
  const endpointSchema = baseEndpointSchema.merge(z.object({
3592
4102
  name: z.string().refine((value) => !eModelEndpointSchema.safeParse(value).success, { message: `Value cannot be one of the default endpoint (EModelEndpoint) values: ${Object.values(EModelEndpoint).join(", ")}` }),
3593
4103
  apiKey: z.string(),
4104
+ /** Masked preview of the API key, stored at write time so admin
4105
+ * reads can show which key is configured without returning the secret. */
4106
+ apiKeyPreview: z.string().optional(),
3594
4107
  baseURL: z.string(),
3595
4108
  models: z.object({
3596
4109
  default: z.array(modelItemSchema).min(1),
@@ -3614,6 +4127,10 @@ const endpointSchema = baseEndpointSchema.merge(z.object({
3614
4127
  defaultParamsEndpoint: z.string().default("custom"),
3615
4128
  reasoningFormat: eReasoningParameterFormatSchema.optional(),
3616
4129
  reasoningKey: eReasoningResponseKeySchema.optional(),
4130
+ /** Replays `reasoning_content` within a run's tool-call turns (e.g. Xiaomi MiMo, Kimi). */
4131
+ includeReasoningContent: z.boolean().optional(),
4132
+ /** Also reconstructs `reasoning_content` from persisted history across turns (implies `includeReasoningContent`). */
4133
+ includeReasoningHistory: z.boolean().optional(),
3617
4134
  paramDefinitions: z.array(paramDefinitionSchema).optional()
3618
4135
  }).strict().optional(),
3619
4136
  directEndpoint: z.boolean().optional(),
@@ -3634,15 +4151,35 @@ const endpointSchema = baseEndpointSchema.merge(z.object({
3634
4151
  const azureEndpointSchema = z.object({
3635
4152
  groups: azureGroupConfigsSchema,
3636
4153
  assistants: z.boolean().optional()
3637
- }).and(endpointSchema.pick({
3638
- streamRate: true,
3639
- titleConvo: true,
3640
- titleMethod: true,
3641
- titleModel: true,
3642
- titlePrompt: true,
3643
- titleTiming: true,
3644
- titlePromptTemplate: true
3645
- }).partial());
4154
+ }).and(
4155
+ /**
4156
+ * Azure carries only the base-endpoint fields enumerated here. This is a
4157
+ * `.pick()`, NOT an omit, so a field added to `baseEndpointSchema` is
4158
+ * silently unavailable on Azure endpoints until it is listed below —
4159
+ * unlike `endpoints.all`, which omits and therefore inherits new fields
4160
+ * automatically. Keep this list in sync when adding endpoint options.
4161
+ */
4162
+ endpointSchema.pick({
4163
+ streamRate: true,
4164
+ titleConvo: true,
4165
+ titleMethod: true,
4166
+ titleModel: true,
4167
+ titlePrompt: true,
4168
+ titleTiming: true,
4169
+ titlePromptTemplate: true,
4170
+ activityLabel: true,
4171
+ activityModel: true,
4172
+ activityEndpoint: true,
4173
+ activityPrompt: true,
4174
+ activityMaxPerRun: true,
4175
+ activityCharLimit: true,
4176
+ activityPhaseLabel: true,
4177
+ activityPhaseModel: true,
4178
+ activityPhaseEndpoint: true,
4179
+ activityPhasePrompt: true,
4180
+ activityPhaseMaxPerRun: true
4181
+ }).partial()
4182
+ );
3646
4183
  /**
3647
4184
  * Vertex AI model configuration - similar to Azure model config
3648
4185
  * Allows specifying deployment name for each model
@@ -3678,15 +4215,20 @@ const anthropicEndpointSchema = baseEndpointSchema.merge(z.object({
3678
4215
  /** Optional: List of available models */
3679
4216
  models: z.array(z.string()).optional()
3680
4217
  }));
4218
+ /** Masked preview of the API key, stored at write time so admin
4219
+ * reads can show which key is configured without returning the secret. */
4220
+ const apiKeyPreviewSchema = z.string().optional();
3681
4221
  const ttsOpenaiSchema = z.object({
3682
4222
  url: z.string().optional(),
3683
4223
  apiKey: z.string(),
4224
+ apiKeyPreview: apiKeyPreviewSchema,
3684
4225
  model: z.string(),
3685
4226
  voices: z.array(z.string())
3686
4227
  });
3687
4228
  const ttsAzureOpenAISchema = z.object({
3688
4229
  instanceName: z.string(),
3689
4230
  apiKey: z.string(),
4231
+ apiKeyPreview: apiKeyPreviewSchema,
3690
4232
  deploymentName: z.string(),
3691
4233
  apiVersion: z.string(),
3692
4234
  model: z.string(),
@@ -3696,6 +4238,7 @@ const ttsElevenLabsSchema = z.object({
3696
4238
  url: z.string().optional(),
3697
4239
  websocketUrl: z.string().optional(),
3698
4240
  apiKey: z.string(),
4241
+ apiKeyPreview: apiKeyPreviewSchema,
3699
4242
  model: z.string(),
3700
4243
  voices: z.array(z.string()),
3701
4244
  voice_settings: z.object({
@@ -3709,10 +4252,12 @@ const ttsElevenLabsSchema = z.object({
3709
4252
  const ttsLocalaiSchema = z.object({
3710
4253
  url: z.string(),
3711
4254
  apiKey: z.string().optional(),
4255
+ apiKeyPreview: apiKeyPreviewSchema,
3712
4256
  voices: z.array(z.string()),
3713
4257
  backend: z.string()
3714
4258
  });
3715
4259
  const ttsSchema = z.object({
4260
+ allowedAddresses: allowedAddressesSchema,
3716
4261
  openai: ttsOpenaiSchema.optional(),
3717
4262
  azureOpenAI: ttsAzureOpenAISchema.optional(),
3718
4263
  elevenlabs: ttsElevenLabsSchema.optional(),
@@ -3721,15 +4266,18 @@ const ttsSchema = z.object({
3721
4266
  const sttOpenaiSchema = z.object({
3722
4267
  url: z.string().optional(),
3723
4268
  apiKey: z.string(),
4269
+ apiKeyPreview: apiKeyPreviewSchema,
3724
4270
  model: z.string()
3725
4271
  });
3726
4272
  const sttAzureOpenAISchema = z.object({
3727
4273
  instanceName: z.string(),
3728
4274
  apiKey: z.string(),
4275
+ apiKeyPreview: apiKeyPreviewSchema,
3729
4276
  deploymentName: z.string(),
3730
4277
  apiVersion: z.string()
3731
4278
  });
3732
4279
  const sttSchema = z.object({
4280
+ allowedAddresses: allowedAddressesSchema,
3733
4281
  openai: sttOpenaiSchema.optional(),
3734
4282
  azureOpenAI: sttAzureOpenAISchema.optional()
3735
4283
  });
@@ -3737,16 +4285,23 @@ const speechTab = z.object({
3737
4285
  conversationMode: z.boolean().optional(),
3738
4286
  advancedMode: z.boolean().optional(),
3739
4287
  speechToText: z.boolean().optional().or(z.object({
3740
- /** Keep in sync with STTProviders enum (defined below cannot reference due to eval order) */
3741
- engineSTT: z.enum(["openai", "azureOpenAI"]).optional(),
4288
+ /** Provider names remain valid for backward compatibility and are normalized for clients. */
4289
+ engineSTT: z.enum([
4290
+ "browser",
4291
+ "external",
4292
+ "openai",
4293
+ "azureOpenAI"
4294
+ ]).optional(),
3742
4295
  languageSTT: z.string().optional(),
3743
4296
  autoTranscribeAudio: z.boolean().optional(),
3744
4297
  decibelValue: z.number().optional(),
3745
4298
  autoSendText: z.number().optional()
3746
4299
  })).optional(),
3747
4300
  textToSpeech: z.boolean().optional().or(z.object({
3748
- /** Keep in sync with TTSProviders enum (defined below cannot reference due to eval order) */
4301
+ /** Provider names remain valid for backward compatibility and are normalized for clients. */
3749
4302
  engineTTS: z.enum([
4303
+ "browser",
4304
+ "external",
3750
4305
  "openai",
3751
4306
  "azureOpenAI",
3752
4307
  "elevenlabs",
@@ -4007,18 +4562,25 @@ let SafeSearchTypes = /* @__PURE__ */ function(SafeSearchTypes) {
4007
4562
  return SafeSearchTypes;
4008
4563
  }({});
4009
4564
  const webSearchSchema = z.object({
4565
+ allowedAddresses: allowedAddressesSchema,
4010
4566
  serperApiKey: z.string().optional().default("${SERPER_API_KEY}"),
4567
+ serperApiKeyPreview: apiKeyPreviewSchema,
4011
4568
  searxngInstanceUrl: z.string().optional().default("${SEARXNG_INSTANCE_URL}"),
4012
4569
  searxngApiKey: z.string().optional().default("${SEARXNG_API_KEY}"),
4570
+ searxngApiKeyPreview: apiKeyPreviewSchema,
4013
4571
  firecrawlApiKey: z.string().optional().default("${FIRECRAWL_API_KEY}"),
4572
+ firecrawlApiKeyPreview: apiKeyPreviewSchema,
4014
4573
  firecrawlApiUrl: z.string().optional().default("${FIRECRAWL_API_URL}"),
4015
4574
  firecrawlVersion: z.string().optional().default("${FIRECRAWL_VERSION}"),
4016
4575
  tavilyApiKey: z.string().optional().default("${TAVILY_API_KEY}"),
4576
+ tavilyApiKeyPreview: apiKeyPreviewSchema,
4017
4577
  tavilySearchUrl: z.string().optional().default("${TAVILY_SEARCH_URL}"),
4018
4578
  tavilyExtractUrl: z.string().optional().default("${TAVILY_EXTRACT_URL}"),
4019
4579
  jinaApiKey: z.string().optional().default("${JINA_API_KEY}"),
4580
+ jinaApiKeyPreview: apiKeyPreviewSchema,
4020
4581
  jinaApiUrl: z.string().optional().default("${JINA_API_URL}"),
4021
4582
  cohereApiKey: z.string().optional().default("${COHERE_API_KEY}"),
4583
+ cohereApiKeyPreview: apiKeyPreviewSchema,
4022
4584
  searchProvider: z.nativeEnum(SearchProviders).optional(),
4023
4585
  scraperProvider: z.nativeEnum(ScraperProviders).optional(),
4024
4586
  rerankerType: z.nativeEnum(RerankerTypes).optional(),
@@ -4094,8 +4656,10 @@ const webSearchSchema = z.object({
4094
4656
  }).optional()
4095
4657
  });
4096
4658
  const ocrSchema = z.object({
4659
+ allowedAddresses: allowedAddressesSchema,
4097
4660
  mistralModel: z.string().optional(),
4098
4661
  apiKey: z.string().optional().default("${OCR_API_KEY}"),
4662
+ apiKeyPreview: apiKeyPreviewSchema,
4099
4663
  baseURL: z.string().optional().default("${OCR_BASEURL}"),
4100
4664
  strategy: z.nativeEnum(OCRStrategy).default("mistral_ocr")
4101
4665
  });
@@ -4153,6 +4717,10 @@ const contextPruningSchema = z.object({
4153
4717
  hardClearRatio: z.number().min(0).max(1).optional(),
4154
4718
  minPrunableToolChars: z.number().min(0).optional()
4155
4719
  });
4720
+ const retainRecentConfigSchema = z.object({
4721
+ turns: z.number().min(0).max(20).optional(),
4722
+ tokens: z.number().positive().optional()
4723
+ });
4156
4724
  const summarizationConfigSchema = z.object({
4157
4725
  enabled: z.boolean().optional(),
4158
4726
  provider: z.string().optional(),
@@ -4168,31 +4736,56 @@ const summarizationConfigSchema = z.object({
4168
4736
  updatePrompt: z.string().optional(),
4169
4737
  reserveRatio: z.number().min(0).max(1).optional(),
4170
4738
  maxSummaryTokens: z.number().positive().optional(),
4171
- contextPruning: contextPruningSchema.optional()
4739
+ contextPruning: contextPruningSchema.optional(),
4740
+ retainRecent: retainRecentConfigSchema.optional()
4172
4741
  });
4173
4742
  const customEndpointsSchema = z.array(endpointSchema.partial()).optional();
4743
+ /**
4744
+ * Validates a messageFilter PII regex at config load. Defaults to native RegExp so browser
4745
+ * builds add no extra engine; the server injects a check backed by the linear-time runtime
4746
+ * engine (RE2) via setMessageFilterRegexValidator, so a pattern the runtime cannot compile
4747
+ * (backreferences, lookaround, control escapes, and so on) is rejected at load rather than
4748
+ * silently dropped at request time.
4749
+ */
4750
+ let messageFilterRegexValidator = (value) => {
4751
+ try {
4752
+ new RegExp(value, "g");
4753
+ return true;
4754
+ } catch {
4755
+ return false;
4756
+ }
4757
+ };
4758
+ const setMessageFilterRegexValidator = (validate) => {
4759
+ messageFilterRegexValidator = validate;
4760
+ };
4174
4761
  const messageFilterPiiCustomPatternSchema = z.object({
4175
4762
  id: z.string().min(1),
4176
4763
  label: z.string().min(1),
4177
- regex: z.string().min(1).refine((value) => {
4178
- try {
4179
- new RegExp(value, "g");
4180
- return true;
4181
- } catch {
4182
- return false;
4183
- }
4184
- }, { message: "Invalid regex" })
4764
+ regex: z.string().min(1).refine((value) => messageFilterRegexValidator(value), { message: "Unsupported regex: not compatible with the RE2 engine (no backreferences, lookaround, or control escapes)" })
4185
4765
  });
4186
4766
  const messageFilterPiiSchema = z.object({
4187
4767
  starterPatterns: z.array(z.string()).optional(),
4188
4768
  customPatterns: z.array(messageFilterPiiCustomPatternSchema).optional()
4189
4769
  });
4190
4770
  const messageFilterSchema = z.object({ pii: messageFilterPiiSchema.optional() });
4771
+ const langfuseConfigSchema = z.object({
4772
+ enabled: z.boolean().optional(),
4773
+ publicKey: z.string().optional(),
4774
+ secretKey: z.string().optional(),
4775
+ /** Stable Langfuse project identity returned when credentials are verified. */
4776
+ projectId: z.string().optional(),
4777
+ /** Masked preview of the secret key, stored at write time so
4778
+ * admin reads can show which secret key is configured without returning the secret. */
4779
+ secretKeyPreview: z.string().optional(),
4780
+ /** Routing key for one of the deployment-configured tenant Langfuse destinations. */
4781
+ destination: z.string().optional()
4782
+ });
4191
4783
  const configSchema = z.object({
4192
4784
  version: z.string(),
4193
4785
  cache: z.boolean().default(true),
4194
4786
  ocr: ocrSchema.optional(),
4195
4787
  webSearch: webSearchSchema.optional(),
4788
+ langfuse: langfuseConfigSchema.optional(),
4196
4789
  memory: memorySchema.optional(),
4197
4790
  summarization: summarizationConfigSchema.optional(),
4198
4791
  skillSync: skillSyncConfigSchema,
@@ -4231,6 +4824,13 @@ const configSchema = z.object({
4231
4824
  messageFilter: messageFilterSchema.optional(),
4232
4825
  endpoints: z.object({
4233
4826
  allowedAddresses: allowedAddressesSchema,
4827
+ /**
4828
+ * Defaults applied to every endpoint. Omit-based, so options added to
4829
+ * `baseEndpointSchema` are inherited here automatically — no list to
4830
+ * maintain (contrast `azureEndpointSchema`, which enumerates via
4831
+ * `.pick()`). Resolution order at read sites is `all` > the named
4832
+ * endpoint > a custom endpoint's own config.
4833
+ */
4234
4834
  all: baseEndpointSchema.omit({ baseURL: true }).optional(),
4235
4835
  ["openAI"]: baseEndpointSchema.optional(),
4236
4836
  ["google"]: baseEndpointSchema.optional(),
@@ -4300,6 +4900,9 @@ const alternateName = {
4300
4900
  ["helicone"]: "Helicone"
4301
4901
  };
4302
4902
  const sharedOpenAIModels = [
4903
+ "gpt-5.6",
4904
+ "gpt-5.6-terra",
4905
+ "gpt-5.6-luna",
4303
4906
  "gpt-5.5",
4304
4907
  "gpt-5.5-pro",
4305
4908
  "chat-latest",
@@ -4324,8 +4927,10 @@ const sharedOpenAIModels = [
4324
4927
  ];
4325
4928
  const sharedAnthropicModels = [
4326
4929
  "claude-fable-5",
4930
+ "claude-opus-5",
4327
4931
  "claude-opus-4-8",
4328
4932
  "claude-opus-4-7",
4933
+ "claude-sonnet-5",
4329
4934
  "claude-sonnet-4-6",
4330
4935
  "claude-opus-4-6",
4331
4936
  "claude-sonnet-4-5",
@@ -4346,18 +4951,25 @@ const sharedAnthropicModels = [
4346
4951
  "claude-3-5-sonnet-20240620",
4347
4952
  "claude-3-5-sonnet-latest"
4348
4953
  ];
4954
+ /**
4955
+ * Claude 4+ models are not invocable on-demand by their bare foundation-model
4956
+ * ID on the Converse path — Bedrock rejects those with "Invocation of model ID
4957
+ * ... with on-demand throughput isn't supported. Retry your request with the ID
4958
+ * or ARN of an inference profile that contains this model." Default to the
4959
+ * `global.` cross-region profile (no regional pricing premium, widest
4960
+ * availability); Opus 4.1 has no global profile, so it uses `us.`.
4961
+ */
4349
4962
  const bedrockModels = [
4350
- "anthropic.claude-fable-5",
4351
- "anthropic.claude-opus-4-8",
4352
- "anthropic.claude-opus-4-7",
4353
- "anthropic.claude-sonnet-4-6",
4354
- "anthropic.claude-opus-4-6-v1",
4355
- "anthropic.claude-sonnet-4-5-20250929-v1:0",
4356
- "anthropic.claude-haiku-4-5-20251001-v1:0",
4357
- "anthropic.claude-opus-4-1-20250805-v1:0",
4358
- "anthropic.claude-3-5-sonnet-20241022-v2:0",
4359
- "anthropic.claude-3-5-sonnet-20240620-v1:0",
4360
- "anthropic.claude-3-5-haiku-20241022-v1:0",
4963
+ "global.anthropic.claude-fable-5",
4964
+ "global.anthropic.claude-opus-5",
4965
+ "global.anthropic.claude-opus-4-8",
4966
+ "global.anthropic.claude-opus-4-7",
4967
+ "global.anthropic.claude-sonnet-5",
4968
+ "global.anthropic.claude-sonnet-4-6",
4969
+ "global.anthropic.claude-opus-4-6-v1",
4970
+ "global.anthropic.claude-sonnet-4-5-20250929-v1:0",
4971
+ "global.anthropic.claude-haiku-4-5-20251001-v1:0",
4972
+ "us.anthropic.claude-opus-4-1-20250805-v1:0",
4361
4973
  "cohere.command-r-v1:0",
4362
4974
  "cohere.command-r-plus-v1:0",
4363
4975
  "meta.llama2-13b-chat-v1",
@@ -4382,7 +4994,10 @@ const defaultModels = {
4382
4994
  ["assistants"]: [...sharedOpenAIModels, "chatgpt-4o-latest"],
4383
4995
  ["agents"]: sharedOpenAIModels,
4384
4996
  ["google"]: [
4997
+ "gemini-3.7-flash",
4998
+ "gemini-3.6-flash",
4385
4999
  "gemini-3.5-flash",
5000
+ "gemini-3.5-flash-lite",
4386
5001
  "gemini-3.1-pro-preview",
4387
5002
  "gemini-3.1-pro-preview-customtools",
4388
5003
  "gemini-3.1-flash-lite-preview",
@@ -4542,6 +5157,14 @@ let CacheKeys = /* @__PURE__ */ function(CacheKeys) {
4542
5157
  */
4543
5158
  CacheKeys["ROLES"] = "ROLES";
4544
5159
  /**
5160
+ * Key for cached group memberships used to resolve ACL user principals.
5161
+ */
5162
+ CacheKeys["USER_PRINCIPALS"] = "USER_PRINCIPALS";
5163
+ /**
5164
+ * Key for per-conversation stateful code sandbox prewarm/warm state.
5165
+ */
5166
+ CacheKeys["SANDBOX_PREWARM"] = "SANDBOX_PREWARM";
5167
+ /**
4545
5168
  * Key for the title generation cache.
4546
5169
  */
4547
5170
  CacheKeys["GEN_TITLE"] = "GEN_TITLE";
@@ -4611,6 +5234,10 @@ let CacheKeys = /* @__PURE__ */ function(CacheKeys) {
4611
5234
  */
4612
5235
  CacheKeys["OPENID_EXCHANGED_TOKENS"] = "OPENID_EXCHANGED_TOKENS";
4613
5236
  /**
5237
+ * Key for cached authenticated user documents.
5238
+ */
5239
+ CacheKeys["AUTH_USER_DOC"] = "AUTH_USER_DOC";
5240
+ /**
4614
5241
  * Key for OpenID session.
4615
5242
  */
4616
5243
  CacheKeys["OPENID_SESSION"] = "OPENID_SESSION";
@@ -4624,6 +5251,7 @@ let CacheKeys = /* @__PURE__ */ function(CacheKeys) {
4624
5251
  CacheKeys["ADMIN_OAUTH_EXCHANGE"] = "ADMIN_OAUTH_EXCHANGE";
4625
5252
  return CacheKeys;
4626
5253
  }({});
5254
+ const AUTH_USER_DOC_BY_ID_PREFIX = "auth-user-doc-byid";
4627
5255
  /**
4628
5256
  * Enum for violation types, used to identify, log, and cache violations.
4629
5257
  */
@@ -4747,6 +5375,14 @@ let ErrorTypes = /* @__PURE__ */ function(ErrorTypes) {
4747
5375
  */
4748
5376
  ErrorTypes["GOOGLE_TOOL_CONFLICT"] = "google_tool_conflict";
4749
5377
  /**
5378
+ * Google provider could not process a linked video (most often longer than the model accepts)
5379
+ */
5380
+ ErrorTypes["GOOGLE_VIDEO_UNPROCESSABLE"] = "google_video_unprocessable";
5381
+ /**
5382
+ * Required CodeAPI resources could not be restored before model invocation.
5383
+ */
5384
+ ErrorTypes["RESOURCE_RECOVERY_REQUIRED"] = "resource_recovery_required";
5385
+ /**
4750
5386
  * Invalid Agent Provider (excluded by Admin)
4751
5387
  */
4752
5388
  ErrorTypes["INVALID_AGENT_PROVIDER"] = "invalid_agent_provider";
@@ -4839,6 +5475,10 @@ let SettingsTabValues = /* @__PURE__ */ function(SettingsTabValues) {
4839
5475
  */
4840
5476
  SettingsTabValues["SPEECH"] = "speech";
4841
5477
  /**
5478
+ * Tab for Langfuse Settings
5479
+ */
5480
+ SettingsTabValues["LANGFUSE"] = "langfuse";
5481
+ /**
4842
5482
  * Tab for Beta Features
4843
5483
  */
4844
5484
  SettingsTabValues["BETA"] = "beta";
@@ -4901,7 +5541,7 @@ let TTSProviders = /* @__PURE__ */ function(TTSProviders) {
4901
5541
  /** Enum for app-wide constants */
4902
5542
  let Constants = /* @__PURE__ */ function(Constants) {
4903
5543
  /**
4904
- * Key for the app's version. The placeholder `v0.8.7-rc1` is
5544
+ * Key for the app's version. The placeholder `v0.8.8-rc1` is
4905
5545
  * swapped in by `@rollup/plugin-replace` during `npm run build:data-provider`
4906
5546
  * using the value of the root `package.json`'s `version` field. Consumers
4907
5547
  * always import this via the built dist bundle (see `main` field in
@@ -4909,9 +5549,9 @@ let Constants = /* @__PURE__ */ function(Constants) {
4909
5549
  * substituted value. Only tests that import the TypeScript source directly
4910
5550
  * would observe the raw placeholder.
4911
5551
  */
4912
- Constants["VERSION"] = "v0.8.7-rc1";
5552
+ Constants["VERSION"] = "v0.8.8-rc1";
4913
5553
  /** Key for the Custom Config's version (librechat.yaml). */
4914
- Constants["CONFIG_VERSION"] = "1.3.13";
5554
+ Constants["CONFIG_VERSION"] = "1.3.14";
4915
5555
  /** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
4916
5556
  Constants["NO_PARENT"] = "00000000-0000-0000-0000-000000000000";
4917
5557
  /** Standard value to use whatever the submission prelim. `responseMessageId` is */
@@ -4963,8 +5603,126 @@ let Constants = /* @__PURE__ */ function(Constants) {
4963
5603
  Constants["BASH_PROGRAMMATIC_TOOL_CALLING"] = "run_tools_with_bash";
4964
5604
  /** Subagent spawn tool name (must match `@librechat/agents` `Constants.SUBAGENT`). */
4965
5605
  Constants["SUBAGENT"] = "subagent";
5606
+ /** Poll tool for retrieving the status/result of a backgrounded tool call. */
5607
+ Constants["CHECK_BACKGROUND_TASK"] = "check_background_task";
4966
5608
  return Constants;
4967
5609
  }({});
5610
+ /**
5611
+ * Normalizes a server name into the character set tool keys are built from.
5612
+ * Tool keys embed this output, so any candidate list matched against a key must
5613
+ * be normalized the same way.
5614
+ */
5615
+ function normalizeServerName(serverName) {
5616
+ if (/^[a-zA-Z0-9_.-]+$/.test(serverName)) return serverName;
5617
+ const normalized = serverName.replace(/[^a-zA-Z0-9_.-]/g, "_").replace(/^_+|_+$/g, "");
5618
+ if (normalized) return normalized;
5619
+ /** All characters were stripped; hash the original so the name stays unique. */
5620
+ let hash = 0;
5621
+ for (let i = 0; i < serverName.length; i++) {
5622
+ hash = (hash << 5) - hash + serverName.charCodeAt(i);
5623
+ hash |= 0;
5624
+ }
5625
+ return `server_${Math.abs(hash)}`;
5626
+ }
5627
+ /**
5628
+ * Splits a combined MCP tool key (`${rawToolName}${mcp_delimiter}${serverName}`)
5629
+ * back into its two parts.
5630
+ *
5631
+ * Both halves can legitimately contain the delimiter, so position alone cannot
5632
+ * identify the boundary. Raw tool names come from the upstream server and are
5633
+ * untrusted (`get_mcp_server_version`, or a gateway-prefixed
5634
+ * `gitlab-get_mcp_server_version`), and `normalizeServerName` preserves
5635
+ * underscores, so a configured server may be named `Google_mcp_Workspace`.
5636
+ *
5637
+ * When `knownServerNames` is supplied the boundary is resolved against it: the
5638
+ * longest configured name the key actually ends with wins. Otherwise this falls
5639
+ * back to the last delimiter, which is correct whenever only the tool half
5640
+ * contains one and matches `.split()` when neither does.
5641
+ *
5642
+ * One case stays undecidable from the key alone: if both `bar` and `foo_mcp_bar`
5643
+ * are configured, `tool_mcp_foo_mcp_bar` is a valid key for either. Longest match
5644
+ * is the deterministic tiebreak; resolving it properly needs the tool/server
5645
+ * mapping carried alongside the key rather than re-derived from the string.
5646
+ */
5647
+ /**
5648
+ * Maps each configured server name's normalized form back to the raw config
5649
+ * name. Model-facing tool keys embed `normalizeServerName(server)`, while the
5650
+ * registry, config maps, tool cache, and plugin-auth rows are keyed by the raw
5651
+ * name — any consumer that parses a server out of a tool key must resolve it
5652
+ * through this map before those lookups. Identity entries are included so
5653
+ * `aliases.get(name) ?? name` works uniformly.
5654
+ *
5655
+ * When two configured names normalize to the same value their tool keys are
5656
+ * inherently ambiguous; the FIRST configured name wins deterministically here,
5657
+ * and `resolveMCPServerContext` warns about the collision so the operator can
5658
+ * rename one server.
5659
+ */
5660
+ function buildServerNameAliases(rawServerNames) {
5661
+ const aliases = /* @__PURE__ */ new Map();
5662
+ /** Identity entries claim their slot FIRST regardless of configuration
5663
+ * order: a server literally named `foo` must never have its keys rerouted
5664
+ * to a `foo!` whose normalized form collides with it. */
5665
+ for (const raw of rawServerNames) if (raw && normalizeServerName(raw) === raw) aliases.set(raw, raw);
5666
+ for (const raw of rawServerNames) {
5667
+ if (!raw) continue;
5668
+ const normalized = normalizeServerName(raw);
5669
+ if (!aliases.has(normalized)) aliases.set(normalized, raw);
5670
+ }
5671
+ return aliases;
5672
+ }
5673
+ /**
5674
+ * Rewrites a tool key's server segment into the normalized form model-facing
5675
+ * keys carry, resolving the boundary against the configured raw names (longest
5676
+ * suffix wins, mirroring {@link splitMCPToolKey}). Returns the key unchanged
5677
+ * when no configured raw name matches — already-normalized keys, placeholder
5678
+ * tokens, and keys for servers that are no longer configured all pass through.
5679
+ * Idempotent: a normalized segment never matches a raw candidate that needs
5680
+ * rewriting.
5681
+ */
5682
+ function normalizeMCPToolKey(toolKey, rawServerNames) {
5683
+ let matched;
5684
+ for (let i = 0; i < rawServerNames.length; i++) {
5685
+ const raw = rawServerNames[i];
5686
+ if (!raw || raw.length <= (matched?.length ?? 0)) continue;
5687
+ if (toolKey.endsWith(`_mcp_${raw}`)) matched = raw;
5688
+ }
5689
+ if (matched == null) return toolKey;
5690
+ const normalized = normalizeServerName(matched);
5691
+ if (normalized === matched) return toolKey;
5692
+ return `${toolKey.slice(0, toolKey.length - matched.length)}${normalized}`;
5693
+ }
5694
+ function splitMCPToolKey(toolKey, knownServerNames) {
5695
+ if (knownServerNames?.length) {
5696
+ let matched;
5697
+ for (let i = 0; i < knownServerNames.length; i++) {
5698
+ const serverName = knownServerNames[i];
5699
+ if (!serverName || serverName.length <= (matched?.length ?? 0)) continue;
5700
+ if (toolKey.endsWith(`_mcp_${serverName}`)) matched = serverName;
5701
+ }
5702
+ if (matched != null) return [toolKey.slice(0, toolKey.length - matched.length - 5), matched];
5703
+ }
5704
+ const idx = toolKey.lastIndexOf("_mcp_");
5705
+ if (idx === -1) return [toolKey, void 0];
5706
+ return [toolKey.slice(0, idx), toolKey.slice(idx + 5)];
5707
+ }
5708
+ /**
5709
+ * Splits a tool-call name for display, where the key may be a synthetic MCP OAuth
5710
+ * call (`oauth${mcp_delimiter}${serverName}`) rather than a real tool key.
5711
+ *
5712
+ * A configured server name is authoritative when one matches, because a real tool key
5713
+ * always ends in its server. Only when none matches does the `oauth` prefix decide,
5714
+ * which keeps a genuine upstream tool named `oauth${mcp_delimiter}...` from being read
5715
+ * as a synthetic call while still resolving OAuth prompts for unconfigured servers.
5716
+ */
5717
+ function splitToolCallName(toolCallName, knownServerNames) {
5718
+ if (knownServerNames?.length) {
5719
+ const [toolName, serverName] = splitMCPToolKey(toolCallName, knownServerNames);
5720
+ if (serverName != null && knownServerNames.includes(serverName)) return [toolName, serverName];
5721
+ }
5722
+ const oauthPrefix = `oauth_mcp_`;
5723
+ if (toolCallName.startsWith(oauthPrefix)) return ["oauth", toolCallName.slice(oauthPrefix.length)];
5724
+ return splitMCPToolKey(toolCallName, knownServerNames);
5725
+ }
4968
5726
  /** Maximum explicit subagent hops allowed from any root agent at runtime. */
4969
5727
  const MAX_SUBAGENT_DEPTH = 5;
4970
5728
  /** Maximum unique explicit subagent targets that may be loaded at runtime. */
@@ -5016,6 +5774,8 @@ let LocalStorageKeys = /* @__PURE__ */ function(LocalStorageKeys) {
5016
5774
  LocalStorageKeys["LAST_ARTIFACTS_TOGGLE_"] = "LAST_ARTIFACTS_TOGGLE_";
5017
5775
  /** Last checked toggle for Skills per conversation ID */
5018
5776
  LocalStorageKeys["LAST_SKILLS_TOGGLE_"] = "LAST_SKILLS_TOGGLE_";
5777
+ /** Last checked toggle for Memory per conversation ID */
5778
+ LocalStorageKeys["LAST_MEMORY_TOGGLE_"] = "LAST_MEMORY_TOGGLE_";
5019
5779
  /** Key for the last selected agent provider */
5020
5780
  LocalStorageKeys["LAST_AGENT_PROVIDER"] = "lastAgentProvider";
5021
5781
  /** Key for the last selected agent model */
@@ -5327,19 +6087,21 @@ function hasPermissions(permissions, requiredPermission) {
5327
6087
  let QueryKeys = /* @__PURE__ */ function(QueryKeys) {
5328
6088
  QueryKeys["messages"] = "messages";
5329
6089
  QueryKeys["sharedMessages"] = "sharedMessages";
6090
+ QueryKeys["sharedStartupConfig"] = "sharedStartupConfig";
5330
6091
  QueryKeys["sharedLinks"] = "sharedLinks";
5331
6092
  QueryKeys["allConversations"] = "allConversations";
5332
6093
  QueryKeys["archivedConversations"] = "archivedConversations";
5333
6094
  QueryKeys["searchConversations"] = "searchConversations";
5334
6095
  QueryKeys["conversation"] = "conversation";
5335
6096
  QueryKeys["searchEnabled"] = "searchEnabled";
6097
+ QueryKeys["langfuseConnection"] = "langfuseConnection";
6098
+ QueryKeys["langfuseSessionLink"] = "langfuseSessionLink";
5336
6099
  QueryKeys["user"] = "user";
5337
6100
  QueryKeys["name"] = "name";
5338
6101
  QueryKeys["models"] = "models";
5339
6102
  QueryKeys["balance"] = "balance";
5340
6103
  QueryKeys["endpoints"] = "endpoints";
5341
6104
  QueryKeys["tokenConfig"] = "tokenConfig";
5342
- QueryKeys["contextProjection"] = "contextProjection";
5343
6105
  QueryKeys["presets"] = "presets";
5344
6106
  QueryKeys["searchResults"] = "searchResults";
5345
6107
  QueryKeys["tokenCount"] = "tokenCount";
@@ -5399,17 +6161,20 @@ let QueryKeys = /* @__PURE__ */ function(QueryKeys) {
5399
6161
  QueryKeys["skillFileContent"] = "skillFileContent";
5400
6162
  QueryKeys["skillTree"] = "skillTree";
5401
6163
  QueryKeys["skillNodeContent"] = "skillNodeContent";
5402
- QueryKeys["skillFavorites"] = "skillFavorites";
6164
+ QueryKeys["toolFavorites"] = "toolFavorites";
5403
6165
  QueryKeys["skillStates"] = "skillStates";
5404
6166
  QueryKeys["favorites"] = "favorites";
5405
6167
  return QueryKeys;
5406
6168
  }({});
5407
6169
  const DynamicQueryKeys = { agentFiles: (agentId) => ["agentFiles", agentId] };
5408
6170
  let MutationKeys = /* @__PURE__ */ function(MutationKeys) {
6171
+ MutationKeys["updateLangfuseConnection"] = "updateLangfuseConnection";
6172
+ MutationKeys["testLangfuseConnection"] = "testLangfuseConnection";
5409
6173
  MutationKeys["createAgentApiKey"] = "createAgentApiKey";
5410
6174
  MutationKeys["deleteAgentApiKey"] = "deleteAgentApiKey";
5411
6175
  MutationKeys["fileUpload"] = "fileUpload";
5412
6176
  MutationKeys["fileDelete"] = "fileDelete";
6177
+ MutationKeys["fileUsage"] = "fileUsage";
5413
6178
  MutationKeys["updatePreset"] = "updatePreset";
5414
6179
  MutationKeys["deletePreset"] = "deletePreset";
5415
6180
  MutationKeys["loginUser"] = "loginUser";
@@ -5498,6 +6263,7 @@ const TOKEN_REFRESH_BUFFER_MS = 120 * 1e3;
5498
6263
  const refreshToken = (retry) => _post(refreshToken$1(retry));
5499
6264
  const SHARE_PAGE_PATH_REGEX = /^\/share\/[^/]+\/?$/;
5500
6265
  const SHARED_MESSAGES_PATH_REGEX = /^\/api\/share\/[^/]+$/;
6266
+ const SHARE_FORK_PATH_REGEX = /^\/api\/share\/[^/]+\/fork$/;
5501
6267
  const normalizePathname = (pathname) => pathname.startsWith("/") ? pathname : `/${pathname}`;
5502
6268
  const stripBasePath = (pathname) => {
5503
6269
  const normalizedPathname = normalizePathname(pathname);
@@ -5517,6 +6283,11 @@ const getRequestPathname = (url) => {
5517
6283
  }
5518
6284
  };
5519
6285
  const isSharedMessagesRequest = (url, method) => method?.toLowerCase() === "get" && SHARED_MESSAGES_PATH_REGEX.test(stripBasePath(getRequestPathname(url)));
6286
+ /** The "continue this chat" fork is a deliberate authenticated action initiated
6287
+ * from a share page, so it must reach auth recovery/redirect like the shared
6288
+ * data request — otherwise a logged-out (or cold-loaded) viewer's 401 is
6289
+ * rejected silently instead of routing them through login. */
6290
+ const isShareForkRequest = (url, method) => method?.toLowerCase() === "post" && SHARE_FORK_PATH_REGEX.test(stripBasePath(getRequestPathname(url)));
5520
6291
  const dispatchTokenUpdatedEvent = (token) => {
5521
6292
  setTokenHeader(token);
5522
6293
  clearAuthRedirectStartedAt();
@@ -5615,16 +6386,42 @@ const shouldRefreshBeforeRequest = (url) => {
5615
6386
  const timeUntilExpiry = expiresAt - Date.now();
5616
6387
  return timeUntilExpiry > 0 && timeUntilExpiry <= TOKEN_REFRESH_BUFFER_MS;
5617
6388
  };
6389
+ const refreshBeforeRequest = async (url) => {
6390
+ const state = getAuthRecoveryState();
6391
+ if (state.refreshPromise && !isAuthRecoveryEndpoint(url)) return state.refreshPromise.catch(() => null);
6392
+ if (!shouldRefreshBeforeRequest(url)) return null;
6393
+ return startAuthRecovery(false).catch(() => null);
6394
+ };
6395
+ const withAuthorization = (options, token) => {
6396
+ const headers = new Headers(options?.headers);
6397
+ if (token) headers.set("Authorization", `Bearer ${token}`);
6398
+ return {
6399
+ ...options,
6400
+ headers
6401
+ };
6402
+ };
6403
+ async function _authenticatedFetch(url, options) {
6404
+ if (typeof window === "undefined") return fetch(url, options);
6405
+ const token = await refreshBeforeRequest(url) ?? getBearerToken();
6406
+ const response = await fetch(url, withAuthorization(options, token));
6407
+ if (response.status !== 401 || isAuthRecoveryEndpoint(url) || isAuthRedirectInProgress() || !getBearerToken()) return response;
6408
+ let refreshedToken;
6409
+ try {
6410
+ refreshedToken = await startAuthRecovery(false);
6411
+ } catch {
6412
+ redirectToLoginOnce();
6413
+ return response;
6414
+ }
6415
+ if (!refreshedToken) {
6416
+ redirectToLoginOnce();
6417
+ return response;
6418
+ }
6419
+ await response.body?.cancel().catch(() => void 0);
6420
+ return fetch(url, withAuthorization(options, refreshedToken));
6421
+ }
5618
6422
  if (typeof window !== "undefined") {
5619
6423
  axios.interceptors.request.use(async (config) => {
5620
- const state = getAuthRecoveryState();
5621
- if (state.refreshPromise && !isAuthRecoveryEndpoint(config.url)) {
5622
- const token = await state.refreshPromise.catch(() => null);
5623
- if (token) setRequestAuthorizationHeader(config, token);
5624
- return config;
5625
- }
5626
- if (!shouldRefreshBeforeRequest(config.url)) return config;
5627
- const token = await startAuthRecovery(false).catch(() => null);
6424
+ const token = await refreshBeforeRequest(config.url);
5628
6425
  if (token) setRequestAuthorizationHeader(config, token);
5629
6426
  return config;
5630
6427
  });
@@ -5638,7 +6435,7 @@ if (typeof window !== "undefined") {
5638
6435
  /** Skip refresh when the Authorization header has been cleared (e.g. during logout),
5639
6436
  * but allow the shared link data request to proceed so private shares can still
5640
6437
  * recover auth/redirect without unrelated share-page queries forcing login. */
5641
- if (!axios.defaults.headers.common["Authorization"] && !(isSharePage() && isSharedMessagesRequest(originalRequest.url, originalRequest.method))) return Promise.reject(error);
6438
+ if (!axios.defaults.headers.common["Authorization"] && !(isSharePage() && (isSharedMessagesRequest(originalRequest.url, originalRequest.method) || isShareForkRequest(originalRequest.url, originalRequest.method)))) return Promise.reject(error);
5642
6439
  if (isAuthRedirectInProgress()) return Promise.reject(error);
5643
6440
  if (error.response.status === 401 && !originalRequest._retry) {
5644
6441
  if (!(getAuthRecoveryState().refreshPromise != null)) console.warn("401 error, refreshing token");
@@ -5651,8 +6448,12 @@ if (typeof window !== "undefined") {
5651
6448
  }
5652
6449
  redirectToLoginOnce();
5653
6450
  return Promise.reject(error);
5654
- } catch (err) {
5655
- return Promise.reject(err);
6451
+ } catch {
6452
+ /** A rejected refresh (stale/invalid session → 401/403) must route to
6453
+ * login just like an empty-token refresh, otherwise the original 401
6454
+ * surfaces to the caller (e.g. the share fork button) with no redirect. */
6455
+ redirectToLoginOnce();
6456
+ return Promise.reject(error);
5656
6457
  }
5657
6458
  }
5658
6459
  return Promise.reject(error);
@@ -5668,15 +6469,142 @@ var request_default = {
5668
6469
  delete: _delete,
5669
6470
  deleteWithOptions: _deleteWithOptions,
5670
6471
  patch: _patch,
6472
+ authenticatedFetch: _authenticatedFetch,
5671
6473
  refreshToken,
5672
6474
  dispatchTokenUpdatedEvent
5673
6475
  };
5674
6476
  //#endregion
6477
+ //#region src/upload.ts
6478
+ const EVENT_STREAM_MEDIA_TYPE = "text/event-stream";
6479
+ const HEARTBEAT_TIMEOUT_MS = 15e3;
6480
+ var FileUploadError = class extends Error {
6481
+ constructor(message, fileId, toolResource, displayToUser = false, code = 0) {
6482
+ super(message);
6483
+ this.name = "CustomAppError";
6484
+ this.code = code;
6485
+ this.file_id = fileId;
6486
+ this.tool_resource = toolResource;
6487
+ this.display_to_user = displayToUser;
6488
+ this.response = { data: { message: displayToUser ? message : "" } };
6489
+ }
6490
+ };
6491
+ var UploadCanceledError = class extends Error {
6492
+ constructor(..._args) {
6493
+ super(..._args);
6494
+ this.code = "ERR_CANCELED";
6495
+ }
6496
+ };
6497
+ const getFileId = (formData) => String(formData.get("file_id") ?? "");
6498
+ const getToolResource = (formData) => formData.get("tool_resource") ?? void 0;
6499
+ const parseEvent = (message) => {
6500
+ let type = "message";
6501
+ const data = [];
6502
+ for (const line of message.split(/\r?\n/)) {
6503
+ if (line.startsWith("event:")) {
6504
+ type = line.slice(6).trim();
6505
+ continue;
6506
+ }
6507
+ if (line.startsWith("data:")) data.push(line.slice(5).trimStart());
6508
+ }
6509
+ return {
6510
+ type,
6511
+ data: data.join("\n")
6512
+ };
6513
+ };
6514
+ const createHttpError = async (response, formData) => {
6515
+ let message = `Server responded with status: ${response.status}`;
6516
+ try {
6517
+ message = (await response.json()).message || message;
6518
+ } catch {}
6519
+ return new FileUploadError(message, getFileId(formData), getToolResource(formData), true, response.status);
6520
+ };
6521
+ const createStreamError = (data, formData) => {
6522
+ let error;
6523
+ try {
6524
+ error = JSON.parse(data);
6525
+ } catch {
6526
+ error = { message: data };
6527
+ }
6528
+ return new FileUploadError(error.message || "File upload failed.", error.temp_file_id || getFileId(formData), error.tool_resource || getToolResource(formData), error.display_to_user ?? false, error.code ?? 0);
6529
+ };
6530
+ const readEventStream = async (stream, formData) => {
6531
+ const reader = stream.getReader();
6532
+ const decoder = new TextDecoder();
6533
+ let buffer = "";
6534
+ let result = null;
6535
+ let streamEnded = false;
6536
+ let timeoutError = null;
6537
+ let heartbeatTimer;
6538
+ const resetHeartbeatTimer = () => {
6539
+ clearTimeout(heartbeatTimer);
6540
+ heartbeatTimer = setTimeout(() => {
6541
+ timeoutError = /* @__PURE__ */ new Error("Upload connection timed out waiting for a heartbeat.");
6542
+ reader.cancel(timeoutError);
6543
+ }, HEARTBEAT_TIMEOUT_MS);
6544
+ };
6545
+ resetHeartbeatTimer();
6546
+ try {
6547
+ while (true) {
6548
+ const { value, done } = await reader.read();
6549
+ if (done) {
6550
+ streamEnded = true;
6551
+ if (timeoutError) throw timeoutError;
6552
+ if (result) return result;
6553
+ throw new Error("Upload connection closed before completion.");
6554
+ }
6555
+ buffer += decoder.decode(value, { stream: true });
6556
+ const messages = buffer.split(/\r?\n\r?\n/);
6557
+ buffer = messages.pop() ?? "";
6558
+ for (const message of messages) {
6559
+ const event = parseEvent(message);
6560
+ if (event.type === "heartbeat") {
6561
+ resetHeartbeatTimer();
6562
+ continue;
6563
+ }
6564
+ if (event.type === "error") throw createStreamError(event.data, formData);
6565
+ if (event.type === "data") {
6566
+ result = JSON.parse(event.data);
6567
+ continue;
6568
+ }
6569
+ if (event.type === "close") {
6570
+ if (result) return result;
6571
+ throw new Error("Upload stream closed without a result.");
6572
+ }
6573
+ }
6574
+ }
6575
+ } catch (error) {
6576
+ if (error instanceof Error && error.name === "AbortError") throw new UploadCanceledError("Upload canceled.");
6577
+ throw error;
6578
+ } finally {
6579
+ clearTimeout(heartbeatTimer);
6580
+ if (!streamEnded) await reader.cancel().catch(() => void 0);
6581
+ reader.releaseLock();
6582
+ }
6583
+ };
6584
+ async function uploadEventStream(url, formData, signal) {
6585
+ try {
6586
+ const response = await request_default.authenticatedFetch(url, {
6587
+ method: "POST",
6588
+ body: formData,
6589
+ headers: { Accept: EVENT_STREAM_MEDIA_TYPE },
6590
+ signal: signal ?? void 0
6591
+ });
6592
+ if (!response.ok) throw await createHttpError(response, formData);
6593
+ if (!(response.headers.get("Content-Type")?.toLowerCase() ?? "").includes(EVENT_STREAM_MEDIA_TYPE)) return await response.json();
6594
+ if (!response.body) throw new Error("No upload response body received.");
6595
+ return await readEventStream(response.body, formData);
6596
+ } catch (error) {
6597
+ if (signal?.aborted || error instanceof Error && error.name === "AbortError") throw new UploadCanceledError("Upload canceled.");
6598
+ throw error;
6599
+ }
6600
+ }
6601
+ //#endregion
5675
6602
  //#region src/data-service.ts
5676
6603
  var data_service_exports = /* @__PURE__ */ __exportAll({
5677
6604
  acceptTerms: () => acceptTerms,
5678
6605
  addPromptToGroup: () => addPromptToGroup,
5679
6606
  addTagToConversation: () => addTagToConversation,
6607
+ addToolFavorite: () => addToolFavorite,
5680
6608
  archiveConversation: () => archiveConversation,
5681
6609
  assignConversationToProject: () => assignConversationToProject,
5682
6610
  bindActionOAuth: () => bindActionOAuth,
@@ -5724,6 +6652,7 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5724
6652
  editArtifact: () => editArtifact,
5725
6653
  enableTwoFactor: () => enableTwoFactor,
5726
6654
  forkConversation: () => forkConversation,
6655
+ forkSharedConversation: () => forkSharedConversation,
5727
6656
  genTitle: () => genTitle,
5728
6657
  getAIEndpoints: () => getAIEndpoints,
5729
6658
  getAccessRoles: () => getAccessRoles,
@@ -5733,6 +6662,7 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5733
6662
  getAgentById: () => getAgentById,
5734
6663
  getAgentCategories: () => getAgentCategories,
5735
6664
  getAgentFiles: () => getAgentFiles,
6665
+ getAgentVersions: () => getAgentVersions,
5736
6666
  getAllEffectivePermissions: () => getAllEffectivePermissions,
5737
6667
  getAllPromptGroups: () => getAllPromptGroups,
5738
6668
  getAssistantById: () => getAssistantById,
@@ -5743,7 +6673,6 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5743
6673
  getBanner: () => getBanner,
5744
6674
  getCategories: () => getCategories,
5745
6675
  getCodeOutputDownload: () => getCodeOutputDownload,
5746
- getContextProjection: () => getContextProjection,
5747
6676
  getConversationById: () => getConversationById,
5748
6677
  getConversationTags: () => getConversationTags,
5749
6678
  getConversations: () => getConversations,
@@ -5759,9 +6688,12 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5759
6688
  getFiles: () => getFiles,
5760
6689
  getGitHubSkillSyncStatus: () => getGitHubSkillSyncStatus,
5761
6690
  getGraphApiToken: () => getGraphApiToken,
6691
+ getLangfuseConnection: () => getLangfuseConnection,
6692
+ getLangfuseSessionLink: () => getLangfuseSessionLink,
5762
6693
  getLoginGoogle: () => getLoginGoogle,
5763
6694
  getMCPAuthValues: () => getMCPAuthValues,
5764
6695
  getMCPConnectionStatus: () => getMCPConnectionStatus,
6696
+ getMCPOAuthStatus: () => getMCPOAuthStatus,
5765
6697
  getMCPServer: () => getMCPServer,
5766
6698
  getMCPServerConnectionStatus: () => getMCPServerConnectionStatus,
5767
6699
  getMCPServers: () => getMCPServers,
@@ -5784,8 +6716,8 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5784
6716
  getSharedFilePreview: () => getSharedFilePreview,
5785
6717
  getSharedLink: () => getSharedLink,
5786
6718
  getSharedMessages: () => getSharedMessages,
6719
+ getSharedStartupConfig: () => getSharedStartupConfig,
5787
6720
  getSkill: () => getSkill,
5788
- getSkillFavorites: () => getSkillFavorites,
5789
6721
  getSkillFileContent: () => getSkillFileContent,
5790
6722
  getSkillNodeContent: () => getSkillNodeContent,
5791
6723
  getSkillStates: () => getSkillStates,
@@ -5793,6 +6725,7 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5793
6725
  getStartupConfig: () => getStartupConfig,
5794
6726
  getTokenConfig: () => getTokenConfig,
5795
6727
  getToolCalls: () => getToolCalls,
6728
+ getToolFavorites: () => getToolFavorites,
5796
6729
  getUser: () => getUser,
5797
6730
  getUserBalance: () => getUserBalance,
5798
6731
  getUserTerms: () => getUserTerms,
@@ -5813,12 +6746,14 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5813
6746
  login: () => login,
5814
6747
  logout: () => logout,
5815
6748
  makePromptProduction: () => makePromptProduction,
6749
+ markFilesUsage: () => markFilesUsage,
5816
6750
  pinConversation: () => pinConversation,
5817
6751
  rebuildConversationTags: () => rebuildConversationTags,
5818
6752
  recordPromptGroupUsage: () => recordPromptGroupUsage,
5819
6753
  regenerateBackupCodes: () => regenerateBackupCodes,
5820
6754
  register: () => register,
5821
6755
  reinitializeMCPServer: () => reinitializeMCPServer,
6756
+ removeToolFavorite: () => removeToolFavorite,
5822
6757
  requestPasswordReset: () => requestPasswordReset,
5823
6758
  resendVerificationEmail: () => resendVerificationEmail,
5824
6759
  resetPassword: () => resetPassword,
@@ -5829,6 +6764,7 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5829
6764
  searchPrincipals: () => searchPrincipals,
5830
6765
  setGitHubSkillSyncCredential: () => setGitHubSkillSyncCredential,
5831
6766
  speechToText: () => speechToText,
6767
+ testLangfuseConnection: () => testLangfuseConnection,
5832
6768
  textToSpeech: () => textToSpeech,
5833
6769
  updateAction: () => updateAction,
5834
6770
  updateAgent: () => updateAgent,
@@ -5839,6 +6775,7 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5839
6775
  updateConversationTag: () => updateConversationTag,
5840
6776
  updateFavorites: () => updateFavorites,
5841
6777
  updateFeedback: () => updateFeedback,
6778
+ updateLangfuseConnection: () => updateLangfuseConnection,
5842
6779
  updateMCPServer: () => updateMCPServer,
5843
6780
  updateMCPServersPermissions: () => updateMCPServersPermissions,
5844
6781
  updateMarketplacePermissions: () => updateMarketplacePermissions,
@@ -5857,7 +6794,6 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5857
6794
  updateResourcePermissions: () => updateResourcePermissions,
5858
6795
  updateSharedLink: () => updateSharedLink,
5859
6796
  updateSkill: () => updateSkill,
5860
- updateSkillFavorites: () => updateSkillFavorites,
5861
6797
  updateSkillNode: () => updateSkillNode,
5862
6798
  updateSkillNodeContent: () => updateSkillNodeContent,
5863
6799
  updateSkillPermissions: () => updateSkillPermissions,
@@ -5876,6 +6812,18 @@ var data_service_exports = /* @__PURE__ */ __exportAll({
5876
6812
  verifyTwoFactor: () => verifyTwoFactor,
5877
6813
  verifyTwoFactorTemp: () => verifyTwoFactorTemp
5878
6814
  });
6815
+ function getLangfuseConnection() {
6816
+ return request_default.get(adminLangfuseConnection());
6817
+ }
6818
+ function updateLangfuseConnection(payload) {
6819
+ return request_default.put(adminLangfuseConnection(), payload);
6820
+ }
6821
+ function testLangfuseConnection(payload) {
6822
+ return request_default.post(adminLangfuseConnectionTest(), payload);
6823
+ }
6824
+ function getLangfuseSessionLink(conversationId) {
6825
+ return request_default.get(adminLangfuseSessionLink(conversationId));
6826
+ }
5879
6827
  function revokeUserKey(name) {
5880
6828
  return request_default.delete(revokeUserKey$1(name));
5881
6829
  }
@@ -5891,16 +6839,15 @@ function getFavorites() {
5891
6839
  function updateFavorites(favorites) {
5892
6840
  return request_default.post(`${apiBaseUrl()}/api/user/settings/favorites`, { favorites });
5893
6841
  }
5894
- /**
5895
- * Skill favorites (star-a-skill). The backend route is phase 2 — see the
5896
- * original UI PR for the client surface. Until then, these resolve with
5897
- * an empty list so the UI hooks compile and the Star button is a no-op.
5898
- */
5899
- function getSkillFavorites() {
5900
- return Promise.resolve([]);
6842
+ /** Tool favorites — starred marketplace items (builtins, tools, MCP servers, skills). */
6843
+ function getToolFavorites() {
6844
+ return request_default.get(toolFavorites());
6845
+ }
6846
+ function addToolFavorite(favorite) {
6847
+ return request_default.put(toolFavorite(favorite.itemType, favorite.itemId));
5901
6848
  }
5902
- function updateSkillFavorites(skillFavorites) {
5903
- return Promise.resolve(skillFavorites);
6849
+ function removeToolFavorite(favorite) {
6850
+ return request_default.delete(toolFavorite(favorite.itemType, favorite.itemId));
5904
6851
  }
5905
6852
  /** Per-user skill active/inactive overrides. */
5906
6853
  function getSkillStates() {
@@ -5912,6 +6859,9 @@ function updateSkillStates(skillStates$1) {
5912
6859
  function getSharedMessages(shareId) {
5913
6860
  return request_default.get(shareMessages(shareId));
5914
6861
  }
6862
+ function getSharedStartupConfig(shareId) {
6863
+ return request_default.get(sharedStartupConfig(shareId));
6864
+ }
5915
6865
  const listSharedLinks = async (params) => {
5916
6866
  const { pageSize, sortBy, sortDirection, search, cursor } = params;
5917
6867
  return request_default.get(getSharedLinks(pageSize, sortBy, sortDirection, search, cursor));
@@ -6024,6 +6974,9 @@ const getMCPAuthValues = (serverName) => {
6024
6974
  function cancelMCPOAuth(serverName) {
6025
6975
  return request_default.post(cancelMCPOAuth$1(serverName), {});
6026
6976
  }
6977
+ function getMCPOAuthStatus(flowId) {
6978
+ return request_default.get(mcpOAuthStatus(flowId));
6979
+ }
6027
6980
  const getStartupConfig = (options) => {
6028
6981
  return request_default.get(config(options?.context));
6029
6982
  };
@@ -6033,9 +6986,6 @@ const getAIEndpoints = () => {
6033
6986
  const getTokenConfig = () => {
6034
6987
  return request_default.get(tokenConfig());
6035
6988
  };
6036
- const getContextProjection = (payload) => {
6037
- return request_default.post(contextProjection(), payload);
6038
- };
6039
6989
  const getModels = async () => {
6040
6990
  return request_default.get(models());
6041
6991
  };
@@ -6135,14 +7085,24 @@ const getAgentFiles = (agentId) => {
6135
7085
  const getFileConfig = () => {
6136
7086
  return request_default.get(`${files()}/config`);
6137
7087
  };
6138
- const uploadImage = (data, signal) => {
7088
+ const uploadImage = (data, signal, sseEnabled = false) => {
6139
7089
  const requestConfig = signal ? { signal } : void 0;
7090
+ if (sseEnabled) return uploadEventStream(images(), data, signal);
6140
7091
  return request_default.postMultiPart(images(), data, requestConfig);
6141
7092
  };
6142
- const uploadFile = (data, signal) => {
7093
+ const uploadFile = (data, signal, sseEnabled = false) => {
6143
7094
  const requestConfig = signal ? { signal } : void 0;
7095
+ if (sseEnabled) return uploadEventStream(files(), data, signal);
6144
7096
  return request_default.postMultiPart(files(), data, requestConfig);
6145
7097
  };
7098
+ /**
7099
+ * Marks uploaded files as used (owner-scoped TTL touch) so the upload-window
7100
+ * TTL cannot reap attachments held in a client-side queue during a long run.
7101
+ * Best-effort: callers fire-and-forget — send-time marking is the backstop.
7102
+ */
7103
+ const markFilesUsage = (body) => {
7104
+ return request_default.post(fileUsage(), body);
7105
+ };
6146
7106
  const updateAction = (data) => {
6147
7107
  const { assistant_id, version, ...body } = data;
6148
7108
  return request_default.post(assistants({
@@ -6170,6 +7130,9 @@ const getAgentById = ({ agent_id }) => {
6170
7130
  const getExpandedAgentById = ({ agent_id }) => {
6171
7131
  return request_default.get(agents({ path: `${agent_id}/expanded` }));
6172
7132
  };
7133
+ const getAgentVersions = ({ agent_id }) => {
7134
+ return request_default.get(agents({ path: `${agent_id}/versions` }));
7135
+ };
6173
7136
  const updateAgent = ({ agent_id, data }) => {
6174
7137
  return request_default.patch(agents({ path: agent_id }), data);
6175
7138
  };
@@ -6304,6 +7267,12 @@ function duplicateConversation(payload) {
6304
7267
  function forkConversation(payload) {
6305
7268
  return request_default.post(forkConversation$1(), payload);
6306
7269
  }
7270
+ function forkSharedConversation(shareId, targetMessageIndex, shareRevision) {
7271
+ return request_default.post(forkSharedMessages(shareId), {
7272
+ targetMessageIndex,
7273
+ shareRevision
7274
+ });
7275
+ }
6307
7276
  function deleteConversation(payload) {
6308
7277
  return request_default.deleteWithOptions(deleteConversation$1(), { data: { arg: payload } });
6309
7278
  }
@@ -6618,11 +7587,11 @@ function verifyTwoFactorTemp(payload) {
6618
7587
  const getMemories = () => {
6619
7588
  return request_default.get(memories());
6620
7589
  };
6621
- const deleteMemory = (key) => {
6622
- return request_default.delete(memory(key));
7590
+ const deleteMemory = (key, agentId) => {
7591
+ return request_default.delete(memory(key, agentId));
6623
7592
  };
6624
- const updateMemory = (key, value, originalKey) => {
6625
- return request_default.patch(memory(originalKey || key), {
7593
+ const updateMemory = (key, value, originalKey, agentId) => {
7594
+ return request_default.patch(memory(originalKey || key, agentId), {
6626
7595
  key,
6627
7596
  value
6628
7597
  });
@@ -6661,6 +7630,6 @@ const getActiveJobs = () => {
6661
7630
  return request_default.get(activeJobs());
6662
7631
  };
6663
7632
  //#endregion
6664
- export { permissionEntrySchema as $, feedbackSchema as $a, extendedModelEndpointSchema as $i, MCP_USER_INPUT_FIELDS as $n, specsConfigSchema as $r, balanceSchema as $t, updateResourcePermissions as A, tPluginAuthConfigSchema as Aa, anthropicSettings as Ai, modularEndpoints as An, fileConfig as Ar, SKILL_SYNC_MAX_INTERVAL_MINUTES as At, MutationKeys as B, RunStatus as Ba, defaultAssistantFormValues as Bi, summarizationTriggerSchema as Bn, mbToBytes as Br, TTSProviders as Bt, resetPassword as C, tBannerSchema as Ca, ThinkingLevel as Ci, initialModelsConfig as Cn, defaultOCRMimeTypes as Cr, MAX_SUBAGENT_RUN_CONFIGS as Ct, updateFeedback as D, tExampleSchema as Da, agentsSettings as Di, messageFilterPiiSchema as Dn, endpointFileConfigSchema as Dr, RetentionMode as Dt, searchPrincipals as E, tConvoUpdateSchema as Ea, agentsSchema as Ei, memorySchema as En, documentParserMimeTypes as Er, RerankerTypes as Et, request_default as F, AnnotationTypes as Fa, compactAgentsBaseSchema as Fi, resolveEndpointType as Fn, imageMimeTypes as Fr, SearchCategories as Ft, PrincipalType as G, defaultOrderQuery as Ga, eReasoningEffortSchema as Gi, validateVisionModel as Gn, retrievalMimeTypesList as Gr, allowedAddressesSchema as Gt, AccessRoleIds as H, Tools as Ha, eAnthropicEffortSchema as Hi, transactionsSchema as Hn, mergeFileConfig as Hr, ViolationTypes as Ht, getTokenHeader as I, AssistantStreamEvents as Ia, compactAgentsSchema as Ii, skillSyncConfigSchema as In, imageTypeMapping as Ir, SearchProviders as It, accessRoleToPermBits as J, isActionTool as Ja, eReasoningSummarySchema as Ji, visionModels as Jn, textMimeTypes as Jr, assistantEndpointSchema as Jt, ResourceType as K, hostImageIdSuffix as Ka, eReasoningParameterFormatSchema as Ki, vertexAISchema as Kn, supportedMimeTypes as Kr, alternateName as Kt, setAcceptLanguageHeader as L, EToolResources as La, compactAssistantSchema as Li, skillSyncGitHubSourceSchema as Ln, inferMimeType as Lr, SettingsTabValues as Lt, updateUserKey as M, tPresetSchema as Ma, authTypeSchema as Mi, paramDefinitionSchema as Mn, fullMimeTypesList as Mr, STTProviders as Mt, updateUserPlugins as N, tQueryParamsSchema as Na, cacheSubsetProviders as Ni, providerEndpointMap as Nn, getEndpointFileConfig as Nr, SafeSearchTypes as Nt, updateMessage as O, tMessageSchema as Oa, anthropicBaseSchema as Oi, messageFilterSchema as On, excelFileTypes as Or, SKILL_SYNC_DEFAULT_DISCOVERY_DEPTH as Ot, userKeyQuery as P, tSharedLinkSchema as Pa, coerceNumber as Pi, rateLimitSchema as Pn, imageExtRegex as Pr, ScraperProviders as Pt, permBitsToAccessLevel as Q, feedbackRatingSchema as Qa, endpointSettings as Qi, MCPServersSchema as Qn, modelSpecSubagentsSchema as Qr, azureGroupSchema as Qt, setTokenHeader as R, FilePurpose as Ra, compactGoogleSchema as Ri, specialVariables as Rn, isBedrockDocumentType as Rr, SettingsViews as Rt, requestPasswordReset as S, removeNullishValues as Sa, ThinkingDisplay as Si, imageGenTools as Sn, convertStringsToRegex as Sr, MAX_SUBAGENT_GRAPH_NODES as St, revokeUserKey as T, tConversationTagSchema as Ta, agentsBaseSchema as Ti, isRemoteOidcUrlAllowed as Tn, defaultTextMimeTypes as Tr, RateLimitPrefix as Tt, PermissionBits as U, actionDelimiter as Ua, eImageDetailSchema as Ui, turnstileOptionsSchema as Un, mimeTypeAliases as Ur, VisionModes as Ut, QueryKeys as V, StepStatus as Va, documentSupportedProviders as Vi, supportsBalanceCheck as Vn, megabyte as Vr, Time as Vt, PrincipalModel as W, actionDomainSeparator as Wa, eModelEndpointSchema as Wi, turnstileSchema as Wn, retrievalMimeTypes as Wr, agentsEndpointSchema as Wt, getResourcePermissionsResponseSchema as X, FEEDBACK_REASON_KEYS as Xa, eThinkingLevelSchema as Xi, MCPOptionsSchema as Xn, REFILL_INTERVAL_UNITS as Xr, azureEndpointSchema as Xt, effectivePermissionsResponseSchema as Y, FEEDBACK_RATINGS as Ya, eThinkingDisplaySchema as Yi, webSearchSchema as Yn, videoMimeTypes as Yr, azureBaseSchema as Yt, hasPermissions as Z, FEEDBACK_TAGS as Za, eVerbositySchema as Zi, MCPServerUserInputSchema as Zn, getRefillEligibilityDate as Zr, azureGroupConfigsSchema as Zt, getResourcePermissions as _, openAIBaseSchema as _a, Providers as _i, fileStrategiesSchema as _n, bedrockDocumentExtensions as _r, ImageDetailCost as _t, data_service_exports as a, googleSettings as aa, generateDynamicSchema as ai, configSchema as an, extractEnvVariable as ao, AuthorizationTypeEnum as ar, AuthKeys as at, register as b, openRouterSchema as ba, ReasoningResponseKey as bi, getEndpointField as bn, codeInterpreterMimeTypesList as br, LocalStorageKeys as bt, getAccessRoles as c, inputTokensIncludesCache as ca, validateSettingDefinitions as ci, defaultAssistantsVersion as cn, normalizeEndpointName as co, FileSources as cr, Capabilities as ct, getAvailablePlugins as d, isDocumentSupportedProvider as da, BedrockProviders as di, defaultRetrievalModels as dn, buildLoginRedirectUrl as dr, DEFAULT_MEMORY_MAX_INPUT_TOKENS as dt, getModelKey as ea, tModelSpecSchema as ei, baseEndpointSchema as en, feedbackTagKeySchema as eo, SSEOptionsSchema as er, principalSchema as et, getConversationById as f, isImageVisionTool as fa, BedrockReasoningConfig as fi, defaultSocialLogins as fn, loginPage as fr, EImageOutputType as ft, getModels as g, isUUID as ga, MYTHOS_CLASS_FAMILIES as gi, fileStorageSchema as gn, audioMimeTypes as gr, ForkOptions as gt, getMCPServerConnectionStatus as h, isParamEndpoint as ha, ImageVisionTool as hi, fileSourceSchema as hn, applicationMimeTypes as hr, FetchTokenConfig as ht, createPreset as i, googleSchema as ia, SettingTypes as ii, cloudfrontConfigSchema as in, envVarRegex as io, AuthTypeEnum as ir, AgentCapabilities as it, updateTokenCount as j, tPluginSchema as ja, assistantSchema as ji, ocrSchema as jn, fileConfigSchema as jr, SKILL_SYNC_MIN_INTERVAL_MINUTES as jt, updateMessageContent as k, tModelSpecPresetSchema as ka, anthropicSchema as ki, modelConfigSchema as kn, excelMimeTypes as kr, SKILL_SYNC_MAX_DISCOVERY_DEPTH as kt, getAgentApiKeys as l, isAgentsEndpoint as la, AnthropicEffort as li, defaultEndpoints as ln, checkOpenAIStorage as lr, CohereConstants as lt, getEffectivePermissions as m, isOpenAILikeProvider as ma, ImageDetail as mi, excludedKeys as mn, sharedFileDownload as mr, ErrorTypes as mt, clearAllConversations as n, googleBaseSchema as na, ComponentTypes as ni, bedrockGuardrailConfigSchema as nn, getTagsForRating as no, StreamableHTTPOptionsSchema as nr, updateResourcePermissionsRequestSchema as nt, deleteAgentApiKey as o, imageDetailNumeric as oa, generateGoogleSchema as oi, contextPruningSchema as on, extractVariableName as oo, TokenExchangeMethodEnum as or, BASE_ONLY_CONFIG_SECTIONS as ot, getCustomConfigSpeech as p, isMythosClassModel as pa, EModelEndpoint as pi, endpointSchema as pn, registerPage as pr, EndpointURLs as pt, accessRoleSchema as q, hostImageNamePrefix as qa, eReasoningResponseKeySchema as qi, vertexModelConfigSchema as qn, supportsFiles as qr, anthropicEndpointSchema as qt, createAgentApiKey as r, googleGenConfigSchema as ra, OptionTypes as ri, bedrockModels as rn, toMinimalFeedback as ro, WebSocketOptionsSchema as rr, updateResourcePermissionsResponseSchema as rt, deletePreset as s, imageDetailValue as sa, generateOpenAISchema as si, defaultAgentCapabilities as sn, isSensitiveEnvVar as so, FileContext as sr, CacheKeys as st, cancelMCPOAuth as t, getSettingsKeys as ta, MAX_SUBAGENTS as ti, bedrockEndpointSchema as tn, getTagByKey as to, StdioOptionsSchema as tr, resourcePermissionsResponseSchema as tt, getAllEffectivePermissions as u, isAssistantsEndpoint as ua, AuthType as ui, defaultModels as un, apiBaseUrl as ur, Constants as ut, getSharedLink as v, openAISchema as va, ReasoningEffort as vi, getConfigDefaults as vn, bedrockDocumentFormats as vr, InfiniteCollections as vt, revokeAllUserKeys as w, tConversationSchema as wa, Verbosity as wi, interfaceSchema as wn, defaultSTTMimeTypes as wr, OCRStrategy as wt, reinitializeMCPServer as x, paramEndpoints as xa, ReasoningSummary as xi, getSchemaDefaults as xn, codeTypeMapping as xr, MAX_SUBAGENT_DEPTH as xt, getSharedMessages as y, openAISettings as ya, ReasoningParameterFormat as yi, getDefaultParamsEndpoint as yn, codeInterpreterMimeTypes as yr, KnownEndpoints as yt, DynamicQueryKeys as z, MessageContentTypes as za, defaultAgentFormValues as zi, summarizationConfigSchema as zn, isPermissiveMimeConfig as zr, SystemCategories as zt };
7633
+ export { permissionEntrySchema as $, tMessageSchema as $a, anthropicSettings as $i, supportsBalanceCheck as $n, imageTypeMapping as $r, azureGroupConfigsSchema as $t, updateResourcePermissions as A, googleSettings as Aa, AuthType as Ai, isRemoteOidcUrlAllowed as An, extractEnvVariable as Ao, applicationMimeTypes as Ar, SKILL_SYNC_DEFAULT_DISCOVERY_DEPTH as At, MutationKeys as B, isParamEndpoint as Ba, ReasoningEffort as Bi, paramDefinitionSchema as Bn, defaultSTTMimeTypes as Br, SettingsViews as Bt, resetPassword as C, endpointSettings as Ca, OptionTypes as Ci, getConfigDefaults as Cn, feedbackRatingSchema as Co, FileSources as Cr, MAX_SUBAGENT_DEPTH as Ct, updateFeedback as D, googleBaseSchema as Da, generateOpenAISchema as Di, imageGenTools as Dn, getTagsForRating as Do, loginPage as Dr, RateLimitPrefix as Dt, searchPrincipals as E, getSettingsKeys as Ea, generateGoogleSchema as Ei, getSchemaDefaults as En, getTagByKey as Eo, buildLoginRedirectUrl as Er, OCRStrategy as Et, request_default as F, isAssistantsEndpoint as Fa, ImageVisionTool as Fi, modelConfigSchema as Fn, codeInterpreterMimeTypes as Fr, SafeSearchTypes as Ft, PrincipalType as G, openRouterSchema as Ga, ThinkingDisplay as Gi, setMessageFilterRegexValidator as Gn, excelMimeTypes as Gr, VisionModes as Gt, AccessRoleIds as H, openAIBaseSchema as Ha, ReasoningParameterFormat as Hi, rateLimitSchema as Hn, documentParserMimeTypes as Hr, TTSProviders as Ht, getTokenHeader as I, isDocumentSupportedProvider as Ia, MYTHOS_CLASS_FAMILIES as Ii, modularEndpoints as In, codeInterpreterMimeTypesList as Ir, ScraperProviders as It, accessRoleToPermBits as J, tBannerSchema as Ja, agentsBaseSchema as Ji, specialVariables as Jn, fullMimeTypesList as Jr, alternateName as Jt, ResourceType as K, paramEndpoints as Ka, ThinkingLevel as Ki, skillSyncConfigSchema as Kn, fileConfig as Kr, agentsEndpointSchema as Kt, setAcceptLanguageHeader as L, isImageVisionTool as La, MemoryScope as Li, normalizeMCPToolKey as Ln, codeTypeMapping as Lr, SearchCategories as Lt, updateUserKey as M, imageDetailValue as Ma, BedrockReasoningConfig as Mi, memorySchema as Mn, isSensitiveEnvVar as Mo, bedrockDocumentExtensions as Mr, SKILL_SYNC_MAX_INTERVAL_MINUTES as Mt, updateUserPlugins as N, inputTokensIncludesCache as Na, EModelEndpoint as Ni, messageFilterPiiSchema as Nn, normalizeEndpointName as No, bedrockDocumentFormats as Nr, SKILL_SYNC_MIN_INTERVAL_MINUTES as Nt, updateMessage as O, googleGenConfigSchema as Oa, validateSettingDefinitions as Oi, initialModelsConfig as On, toMinimalFeedback as Oo, registerPage as Or, RerankerTypes as Ot, userKeyQuery as P, isAgentsEndpoint as Pa, ImageDetail as Pi, messageFilterSchema as Pn, bedrockDocumentMimeTypes as Pr, STTProviders as Pt, permBitsToAccessLevel as Q, tExampleSchema as Qa, anthropicSchema as Qi, summarizationTriggerSchema as Qn, imageMimeTypes as Qr, azureEndpointSchema as Qt, setTokenHeader as R, isMythosClassModel as Ra, Providers as Ri, normalizeServerName as Rn, convertStringsToRegex as Rr, SearchProviders as Rt, requestPasswordReset as S, eVerbositySchema as Sa, ComponentTypes as Si, fileStrategiesSchema as Sn, FEEDBACK_TAGS as So, FileContext as Sr, LocalStorageKeys as St, revokeUserKey as T, getModelKey as Ta, generateDynamicSchema as Ti, getEndpointField as Tn, feedbackTagKeySchema as To, apiBaseUrl as Tr, MAX_SUBAGENT_RUN_CONFIGS as Tt, PermissionBits as U, openAISchema as Ua, ReasoningResponseKey as Ui, resolveEndpointType as Un, endpointFileConfigSchema as Ur, Time as Ut, QueryKeys as V, isUUID as Va, ReasoningMode as Vi, providerEndpointMap as Vn, defaultTextMimeTypes as Vr, SystemCategories as Vt, PrincipalModel as W, openAISettings as Wa, ReasoningSummary as Wi, retainRecentConfigSchema as Wn, excelFileTypes as Wr, ViolationTypes as Wt, getResourcePermissionsResponseSchema as X, tConversationTagSchema as Xa, agentsSettings as Xi, splitToolCallName as Xn, getEndpointFileConfig as Xr, assistantEndpointSchema as Xt, effectivePermissionsResponseSchema as Y, tConversationSchema as Ya, agentsSchema as Yi, splitMCPToolKey as Yn, getConfiguredMimeAccept as Yr, anthropicEndpointSchema as Yt, hasPermissions as Z, tConvoUpdateSchema as Za, anthropicBaseSchema as Zi, summarizationConfigSchema as Zn, imageExtRegex as Zr, azureBaseSchema as Zt, getResourcePermissions as _, eReasoningParameterFormatSchema as _a, getRefillEligibilityDate as _i, defaultSocialLogins as _n, hostImageIdSuffix as _o, StreamableHTTPOptionsSchema as _r, FetchTokenConfig as _t, data_service_exports as a, compactAgentsSchema as aa, mbToBytes as ai, bedrockModels as an, tSharedLinkSchema as ao, turnstileSchema as ar, AgentCapabilities as at, register as b, eThinkingDisplaySchema as ba, tModelSpecSchema as bi, fileSourceSchema as bn, FEEDBACK_RATINGS as bo, AuthorizationTypeEnum as br, InfiniteCollections as bt, getAccessRoles as c, defaultAgentFormValues as ca, mimeTypeAliases as ci, checkpointerTypeSchema as cn, EToolResources as co, vertexModelConfigSchema as cr, BASE_PRINCIPAL_CONFIG_SECTIONS as ct, getAvailablePlugins as d, eAnthropicEffortSchema as da, setFileConfigRegexCompiler as di, contextPruningSchema as dn, RunStatus as do, MCPOptionsSchema as dr, CohereConstants as dt, assistantSchema as ea, inferMimeType as ei, azureGroupSchema as en, tModelSpecPresetSchema as eo, toolApprovalHookConfigSchema as er, principalSchema as et, getConversationById as f, eImageDetailSchema as fa, supportedMimeTypes as fi, defaultAgentCapabilities as fn, StepStatus as fo, MCPServerUserInputSchema as fr, Constants as ft, getModels as g, eReasoningModeSchema as ga, REFILL_INTERVAL_UNITS as gi, defaultRetrievalModels as gn, defaultOrderQuery as go, StdioOptionsSchema as gr, ErrorTypes as gt, getMCPServerConnectionStatus as h, eReasoningEffortSchema as ha, videoMimeTypes as hi, defaultModels as hn, actionDomainSeparator as ho, SSEOptionsSchema as hr, EndpointURLs as ht, createPreset as i, compactAgentsBaseSchema as ia, isPermissiveMimeConfig as ii, bedrockGuardrailConfigSchema as in, tQueryParamsSchema as io, turnstileOptionsSchema as ir, AUTH_USER_DOC_BY_ID_PREFIX as it, updateTokenCount as j, imageDetailNumeric as ja, BedrockProviders as ji, langfuseConfigSchema as jn, extractVariableName as jo, audioMimeTypes as jr, SKILL_SYNC_MAX_DISCOVERY_DEPTH as jt, updateMessageContent as k, googleSchema as ka, AnthropicEffort as ki, interfaceSchema as kn, envVarRegex as ko, sharedFileDownload as kr, RetentionMode as kt, getAgentApiKeys as l, defaultAssistantFormValues as la, retrievalMimeTypes as li, cloudfrontConfigSchema as ln, FilePurpose as lo, visionModels as lr, CacheKeys as lt, getEffectivePermissions as m, eReasoningContextSchema as ma, textMimeTypes as mi, defaultEndpoints as mn, actionDelimiter as mo, MCP_USER_INPUT_FIELDS as mr, EImageOutputType as mt, clearAllConversations as n, cacheSubsetProviders as na, isAnthropicTextDocumentType as ni, baseEndpointSchema as nn, tPluginSchema as no, toolApprovalPolicySchema as nr, updateResourcePermissionsRequestSchema as nt, deleteAgentApiKey as o, compactAssistantSchema as oa, megabyte as oi, buildServerNameAliases as on, AnnotationTypes as oo, validateVisionModel as or, AuthKeys as ot, getCustomConfigSpeech as p, eModelEndpointSchema as pa, supportsFiles as pi, defaultAssistantsVersion as pn, Tools as po, MCPServersSchema as pr, DEFAULT_MEMORY_MAX_INPUT_TOKENS as pt, accessRoleSchema as q, removeNullishValues as qa, Verbosity as qi, skillSyncGitHubSourceSchema as qn, fileConfigSchema as qr, allowedAddressesSchema as qt, createAgentApiKey as r, coerceNumber as ra, isBedrockDocumentType as ri, bedrockEndpointSchema as rn, tPresetSchema as ro, transactionsSchema as rr, updateResourcePermissionsResponseSchema as rt, deletePreset as s, compactGoogleSchema as sa, mergeFileConfig as si, checkpointerSchema as sn, AssistantStreamEvents as so, vertexAISchema as sr, BASE_ONLY_CONFIG_SECTIONS as st, cancelMCPOAuth as t, authTypeSchema as ta, isAnthropicDocumentType as ti, balanceSchema as tn, tPluginAuthConfigSchema as to, toolApprovalModeSchema as tr, resourcePermissionsResponseSchema as tt, getAllEffectivePermissions as u, documentSupportedProviders as ua, retrievalMimeTypesList as ui, configSchema as un, MessageContentTypes as uo, webSearchSchema as ur, Capabilities as ut, getSharedLink as v, eReasoningResponseKeySchema as va, modelSpecSubagentsSchema as vi, endpointSchema as vn, hostImageNamePrefix as vo, WebSocketOptionsSchema as vr, ForkOptions as vt, revokeAllUserKeys as w, extendedModelEndpointSchema as wa, SettingTypes as wi, getDefaultParamsEndpoint as wn, feedbackSchema as wo, checkOpenAIStorage as wr, MAX_SUBAGENT_GRAPH_NODES as wt, reinitializeMCPServer as x, eThinkingLevelSchema as xa, MAX_SUBAGENTS as xi, fileStorageSchema as xn, FEEDBACK_REASON_KEYS as xo, TokenExchangeMethodEnum as xr, KnownEndpoints as xt, getSharedMessages as y, eReasoningSummarySchema as ya, specsConfigSchema as yi, excludedKeys as yn, isActionTool as yo, AuthTypeEnum as yr, ImageDetailCost as yt, DynamicQueryKeys as z, isOpenAILikeProvider as za, ReasoningContext as zi, ocrSchema as zn, defaultOCRMimeTypes as zr, SettingsTabValues as zt };
6665
7634
 
6666
- //# sourceMappingURL=data-service-DgNwjhBS.mjs.map
7635
+ //# sourceMappingURL=data-service-pwrlWjJs.mjs.map