librechat-data-provider 0.8.522 → 0.8.524

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 (57) hide show
  1. package/dist/{data-service-CaB7saTP.mjs → data-service-B-WUVvTH.mjs} +1044 -173
  2. package/dist/data-service-B-WUVvTH.mjs.map +1 -0
  3. package/dist/{data-service-D5kHzBt-.js → data-service-CUG1qdeC.js} +1426 -207
  4. package/dist/data-service-CUG1qdeC.js.map +1 -0
  5. package/dist/index.js +886 -74
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +780 -70
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/react-query/index.js +1 -1
  10. package/dist/react-query/index.mjs +1 -1
  11. package/dist/types/accessPermissions.d.ts +54 -1
  12. package/dist/types/actions.d.ts +1 -1
  13. package/dist/types/agentToolOptions.d.ts +1 -1
  14. package/dist/types/api-endpoints.d.ts +7 -0
  15. package/dist/types/backgroundResults.d.ts +13 -0
  16. package/dist/types/balance.d.ts +4 -0
  17. package/dist/types/bedrock.d.ts +132 -65
  18. package/dist/types/code/approval.d.ts +26 -0
  19. package/dist/types/code/worker.d.ts +10 -0
  20. package/dist/types/code/workspace.d.ts +50 -0
  21. package/dist/types/codeEnvRef.d.ts +5 -0
  22. package/dist/types/config.d.ts +5859 -2469
  23. package/dist/types/data-service.d.ts +22 -12
  24. package/dist/types/errors.d.ts +2 -0
  25. package/dist/types/file-config.d.ts +179 -12
  26. package/dist/types/filters.d.ts +97 -97
  27. package/dist/types/footer.d.ts +20 -0
  28. package/dist/types/generate.d.ts +48 -24
  29. package/dist/types/index.d.ts +11 -0
  30. package/dist/types/keys.d.ts +13 -2
  31. package/dist/types/limits.d.ts +8 -0
  32. package/dist/types/mcp.d.ts +683 -30
  33. package/dist/types/messages.d.ts +25 -1
  34. package/dist/types/models.d.ts +312 -183
  35. package/dist/types/parameterSettings.d.ts +10 -1
  36. package/dist/types/parsers.d.ts +25 -1
  37. package/dist/types/providers.d.ts +1 -0
  38. package/dist/types/resolve-llm-delivery-path.d.ts +161 -0
  39. package/dist/types/schemas.d.ts +771 -457
  40. package/dist/types/svg.d.ts +34 -0
  41. package/dist/types/types/agents.d.ts +257 -2
  42. package/dist/types/types/assistants.d.ts +2 -617
  43. package/dist/types/types/content.d.ts +286 -0
  44. package/dist/types/types/files.d.ts +48 -1
  45. package/dist/types/types/insights.d.ts +9 -0
  46. package/dist/types/types/mutations.d.ts +3 -2
  47. package/dist/types/types/queries.d.ts +8 -1
  48. package/dist/types/types/queuedTurns.d.ts +140 -106
  49. package/dist/types/types/runs.d.ts +33 -5
  50. package/dist/types/types/schedules.d.ts +40 -7
  51. package/dist/types/types/skills.d.ts +43 -0
  52. package/dist/types/types/tools.d.ts +132 -0
  53. package/dist/types/types/traces.d.ts +134 -0
  54. package/dist/types/types.d.ts +72 -2
  55. package/package.json +2 -2
  56. package/dist/data-service-CaB7saTP.mjs.map +0 -1
  57. package/dist/data-service-D5kHzBt-.js.map +0 -1
@@ -234,6 +234,10 @@ export type TTokenBudgetBreakdown = {
234
234
  toolTokenCounts?: Record<string, number>;
235
235
  /** Names of counted tools that are deferred (`defer_loading`) and discovered */
236
236
  deferredToolNames?: string[];
237
+ /** Calibrated retained tool traffic: tool results plus assistant turns made only of tool calls, inline provider tool results and reasoning. A subset of messageTokens, not an additional budget category. */
238
+ toolMessageTokens?: number;
239
+ /** Per-tool result-message share; excludes assistant invocation overhead. */
240
+ toolMessageTokenCounts?: Record<string, number>;
237
241
  };
238
242
  /** Per-model-call context snapshot, dispatched after pruning and before the LLM call. */
239
243
  export type TContextUsageEvent = {
@@ -249,12 +253,30 @@ export type TContextUsageEvent = {
249
253
  /** Tokens still free after instructions + pruned messages */
250
254
  remainingContextTokens?: number;
251
255
  calibrationRatio?: number;
256
+ /** Model and provider of the reconciling primary call, retained across reloads. */
257
+ model?: string;
258
+ provider?: string;
259
+ /** Cache portions of that call's prompt, in normalized display units. */
260
+ cacheRead?: number;
261
+ cacheWrite?: number;
252
262
  /** Output tokens of the response's final model call (the call this pre-invoke
253
- * snapshot precedes). Populated only on the persisted `metadata.contextUsage`
254
- * blob so a reloaded multi-call turn adds the same post-snapshot delta the
263
+ * snapshot precedes). Saved in message metadata and used by the client so a
264
+ * reloaded multi-call turn adds the same post-snapshot delta the
255
265
  * live finalizer did — not the full response `tokenCount`, which the snapshot
256
266
  * already includes for earlier steps. */
257
267
  completedOutputTokens?: number;
268
+ /** Completed output in a resumable job. Separate from the saved-message field
269
+ * so older clients do not add it alongside their trailing-text estimate. */
270
+ resumedOutputTokens?: number;
271
+ /** Tool-result tokens retained AFTER this pre-invoke snapshot, counted with the
272
+ * run's own tokenizer. A run that stops at the tool-call limit keeps the result
273
+ * its final call's tools produced, and no later snapshot describes it: the
274
+ * snapshot precedes the call, and the limit means no further call is made. The
275
+ * client adds this the way it adds `completedOutputTokens`, so the gauge and the
276
+ * tool-call share include the retained result instead of missing it until the
277
+ * next turn's snapshot carries it as kept-message context. Counted, never
278
+ * estimated — the per-tool `toolMessageTokenCounts` stay a subset of the share. */
279
+ retainedToolTokens?: number;
258
280
  };
259
281
  /**
260
282
  * Per-response usage rollup persisted on `responseMessage.metadata.usage`, in
@@ -310,14 +332,19 @@ export declare const promptTokensFromUsage: (event: TTokenUsageEvent) => number;
310
332
  /**
311
333
  * Reconciles a pre-invoke context snapshot's CALIBRATED estimate to a call's
312
334
  * ACTUAL prompt tokens. The SDK's calibration multiplier scales only
313
- * `messageTokens` (instructions/summary are raw tiktoken counts), and it can
335
+ * `messageTokens` (instructions/summary are raw tiktoken counts) and can
314
336
  * over-shoot badly when a provider injects server-side content the SDK never
315
337
  * counted (e.g. Anthropic web search) — pinning the gauge several× too high and
316
338
  * persisting it. Trust the provider's own prompt count: keep the raw
317
- * instruction/summary rows, set `messageTokens` to the remainder, and recompute
318
- * the free space. No-op when `promptTokens` is unusable.
339
+ * instruction/summary rows, set `messageTokens` to the remainder, recompute the
340
+ * free space, and rescale the `toolMessageTokens` share to the new message
341
+ * total. No-op when `promptTokens` is unusable.
319
342
  */
320
343
  export declare const reconcileContextUsage: (snapshot: TContextUsageEvent, promptTokens: number) => TContextUsageEvent;
344
+ /** Provider output, including reasoning omitted from an under-reported output count. */
345
+ export declare const outputTokensFromUsage: (event: TTokenUsageEvent) => number;
346
+ /** Reconcile and retain the primary call details on live, saved, and resumable snapshots. */
347
+ export declare const reconcileContextUsageFromEvent: (snapshot: TContextUsageEvent, event: TTokenUsageEvent) => TContextUsageEvent;
321
348
  /** Lifecycle phase carried on subagent-progress envelopes (mirrors SDK SubagentUpdatePhase). */
322
349
  export type SubagentUpdatePhase = 'start' | 'run_step' | 'run_step_delta' | 'run_step_completed' | 'run_step_closed' | 'message_delta' | 'reasoning_delta' | 'stop' | 'error';
323
350
  /** Structured root-to-leaf identity for one nested subagent execution. */
@@ -331,6 +358,7 @@ export interface SubagentAncestryEntry {
331
358
  readonly parentAgentId?: string;
332
359
  readonly parentToolCallId?: string;
333
360
  }
361
+ export type SubagentIdentity = Pick<SubagentAncestryEntry, 'subagentKind' | 'subagentAgentId'>;
334
362
  /** Single streamed subagent update forwarded by the SDK's SubagentExecutor. */
335
363
  export interface SubagentUpdateEvent {
336
364
  runId: string;
@@ -9,7 +9,7 @@ export type ScheduleFrequency = (typeof scheduleFrequencies)[number];
9
9
  export declare const SCHEDULE_CRON_MAX_LENGTH = 256;
10
10
  export declare const scheduleTargets: readonly ["new"];
11
11
  export type ScheduleTarget = (typeof scheduleTargets)[number];
12
- export type ScheduleDisabledReason = 'too_many_failures' | 'agent_deleted' | 'invalid_schedule' | 'permission_revoked' | 'insufficient_balance' | 'project_deleted' | 'project_required';
12
+ export type ScheduleDisabledReason = 'mcp_reauth_required' | 'mcp_configuration_missing' | 'mcp_permission_denied' | 'too_many_failures' | 'agent_deleted' | 'invalid_schedule' | 'permission_revoked' | 'insufficient_balance' | 'project_deleted' | 'project_required';
13
13
  export type ScheduleRunStatus = 'started' | 'requires_action' | 'success' | 'error' | 'interrupted' | 'skipped_overlap' | 'skipped_balance';
14
14
  export declare const structuredCadenceSchema: z.ZodObject<{
15
15
  frequency: z.ZodEnum<["hourly", "daily", "weekdays", "weekly"]>;
@@ -123,9 +123,9 @@ export declare const createSchedulePayloadSchema: z.ZodObject<{
123
123
  }, "strip", z.ZodTypeAny, {
124
124
  name: string;
125
125
  agent_id: string;
126
- clientRequestId: string;
127
- prompt: string;
128
126
  enabled: boolean;
127
+ prompt: string;
128
+ clientRequestId: string;
129
129
  timezone: string;
130
130
  cadence: {
131
131
  frequency: "hourly" | "daily" | "weekdays" | "weekly";
@@ -142,8 +142,8 @@ export declare const createSchedulePayloadSchema: z.ZodObject<{
142
142
  }, {
143
143
  name: string;
144
144
  agent_id: string;
145
- clientRequestId: string;
146
145
  prompt: string;
146
+ clientRequestId: string;
147
147
  timezone: string;
148
148
  cadence: {
149
149
  frequency: "hourly" | "daily" | "weekdays" | "weekly";
@@ -166,8 +166,8 @@ export declare const updateSchedulePayloadSchema: z.ZodObject<{
166
166
  chatProjectId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
167
167
  file_ids: z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>>;
168
168
  agent_id: z.ZodOptional<z.ZodString>;
169
- prompt: z.ZodOptional<z.ZodString>;
170
169
  enabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
170
+ prompt: z.ZodOptional<z.ZodString>;
171
171
  timezone: z.ZodOptional<z.ZodString>;
172
172
  cadence: z.ZodOptional<z.ZodDiscriminatedUnion<"frequency", [z.ZodObject<{
173
173
  frequency: z.ZodEnum<["hourly", "daily", "weekdays", "weekly"]>;
@@ -209,8 +209,8 @@ export declare const updateSchedulePayloadSchema: z.ZodObject<{
209
209
  chatProjectId?: string | null | undefined;
210
210
  file_ids?: string[] | undefined;
211
211
  agent_id?: string | undefined;
212
- prompt?: string | undefined;
213
212
  enabled?: boolean | undefined;
213
+ prompt?: string | undefined;
214
214
  timezone?: string | undefined;
215
215
  cadence?: {
216
216
  frequency: "hourly" | "daily" | "weekdays" | "weekly";
@@ -228,8 +228,8 @@ export declare const updateSchedulePayloadSchema: z.ZodObject<{
228
228
  chatProjectId?: string | null | undefined;
229
229
  file_ids?: string[] | undefined;
230
230
  agent_id?: string | undefined;
231
- prompt?: string | undefined;
232
231
  enabled?: boolean | undefined;
232
+ prompt?: string | undefined;
233
233
  timezone?: string | undefined;
234
234
  cadence?: {
235
235
  frequency: "hourly" | "daily" | "weekdays" | "weekly";
@@ -248,6 +248,7 @@ export type TScheduleLastRun = {
248
248
  conversationId?: string;
249
249
  status: ScheduleRunStatus;
250
250
  error?: string;
251
+ mcp?: ScheduleMCPOutcome[];
251
252
  firedAt: string;
252
253
  };
253
254
  export type TSchedule = {
@@ -265,6 +266,17 @@ export type TSchedule = {
265
266
  disabledReason?: ScheduleDisabledReason;
266
267
  nextRunAt?: string;
267
268
  lastRun?: TScheduleLastRun;
269
+ /**
270
+ * The occurrences generating right now. Read from their own run rows, not from
271
+ * `lastRun`, which is projected only when a run settles, pauses or skips and is
272
+ * deliberately withheld from a run whose schedule was edited mid-flight. This is
273
+ * the signal a client has that a chat is on its way, and the id to fetch it by.
274
+ * A run parked on an approval is not here: its chat was listed long ago, and the
275
+ * rows can accumulate for as long as approvals wait.
276
+ */
277
+ inFlight?: Array<{
278
+ conversationId: string;
279
+ }>;
268
280
  runCount: number;
269
281
  failureCount: number;
270
282
  configRevision?: number;
@@ -272,6 +284,7 @@ export type TSchedule = {
272
284
  updatedAt: string;
273
285
  };
274
286
  export type TScheduleRun = {
287
+ mcp?: ScheduleMCPOutcome[];
275
288
  scheduleId: string;
276
289
  scheduledFor: string;
277
290
  firedAt?: string;
@@ -304,3 +317,23 @@ export type TScheduleRunNowResponse = {
304
317
  conversationId: string;
305
318
  status: 'started';
306
319
  };
320
+ /** Only structured schedule preflight failures may request immediate suspension. */
321
+ export declare function getScheduleMCPDisabledReason(outcomes?: ScheduleMCPOutcome[]): 'mcp_reauth_required' | 'mcp_configuration_missing' | 'mcp_permission_denied' | undefined;
322
+ export declare const scheduleMCPOutcomeSchema: z.ZodObject<{
323
+ server: z.ZodString;
324
+ /** Agent whose selected tool requires this server. Used to open the correct
325
+ * recovery chat when the requirement belongs to a handoff or subagent. */
326
+ agentId: z.ZodOptional<z.ZodString>;
327
+ status: z.ZodEnum<["ready", "mcp_reauth_required", "mcp_configuration_missing", "mcp_permission_denied", "mcp_unavailable"]>;
328
+ }, "strip", z.ZodTypeAny, {
329
+ status: "ready" | "mcp_reauth_required" | "mcp_configuration_missing" | "mcp_permission_denied" | "mcp_unavailable";
330
+ server: string;
331
+ agentId?: string | undefined;
332
+ }, {
333
+ status: "ready" | "mcp_reauth_required" | "mcp_configuration_missing" | "mcp_permission_denied" | "mcp_unavailable";
334
+ server: string;
335
+ agentId?: string | undefined;
336
+ }>;
337
+ export type ScheduleMCPOutcome = z.infer<typeof scheduleMCPOutcomeSchema>;
338
+ export type ScheduleMCPStatus = ScheduleMCPOutcome['status'];
339
+ export declare function readScheduleMCPOutcomes(error?: string): ScheduleMCPOutcome[];
@@ -315,10 +315,53 @@ export type TSkillListResponse = {
315
315
  has_more: boolean;
316
316
  after: string | null;
317
317
  };
318
+ /**
319
+ * Why one archive entry could not be imported. A stable code rather than a
320
+ * message, so the client localizes the reason and server-side storage and
321
+ * database text never reaches the uploader.
322
+ */
323
+ export type SkillImportFailureReason =
324
+ /** Path is absolute, traverses, or uses characters skills cannot store. */
325
+ 'invalid_path'
326
+ /** Entry alone exceeds the per-file decompression limit. */
327
+ | 'file_too_large'
328
+ /** Archive exhausted the cumulative decompression budget at or before this entry. */
329
+ | 'archive_too_large'
330
+ /** Entry no longer matches what content inspection read. */
331
+ | 'archive_entry_changed'
332
+ /** Storage write or database row failed. */
333
+ | 'persistence_failed';
334
+ /** One archive entry POST `/api/skills/import` could not persist. */
335
+ export type TSkillImportFailedFile = {
336
+ /** Path inside the archive, relative to `SKILL.md`. */
337
+ path: string;
338
+ reason: SkillImportFailureReason;
339
+ /** Limit in MB, when `reason` names a size limit. */
340
+ limitMb?: number;
341
+ };
342
+ /**
343
+ * Response from a failed `POST /api/skills/import` of an archive.
344
+ *
345
+ * `skill_import_incomplete` (422) means at least one bundled file failed and
346
+ * everything the import created was rolled back. `skill_import_rollback_failed`
347
+ * (500) means the same failure occurred but the partially created skill could
348
+ * not be removed, so it may still be listed and needs deleting by hand.
349
+ * `skill_import_cleanup_incomplete` (500) means the Skill row was removed but
350
+ * dependent database or blob cleanup did not finish.
351
+ */
352
+ export type TSkillImportFailedResponse = {
353
+ error: 'skill_import_incomplete' | 'skill_import_rollback_failed' | 'skill_import_cleanup_incomplete';
354
+ message: string;
355
+ failedFiles: TSkillImportFailedFile[];
356
+ /** Present when the Skill row may remain and should be surfaced for deletion. */
357
+ skillId?: string;
358
+ };
318
359
  /** Response from DELETE `/api/skills/:id`. */
319
360
  export type TDeleteSkillResponse = {
320
361
  id: string;
321
362
  deleted: true;
363
+ /** False when the Skill row is gone but a dependent cleanup step needs repair. */
364
+ cleanupComplete?: boolean;
322
365
  };
323
366
  /** Response from GET `/api/skills/:id/files`. */
324
367
  export type TListSkillFilesResponse = {
@@ -0,0 +1,132 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ export type Schema = OpenAPIV3.SchemaObject & {
3
+ description?: string;
4
+ };
5
+ export type Reference = OpenAPIV3.ReferenceObject & {
6
+ description?: string;
7
+ };
8
+ export declare enum Tools {
9
+ execute_code = "execute_code",
10
+ code_interpreter = "code_interpreter",
11
+ file_search = "file_search",
12
+ web_search = "web_search",
13
+ retrieval = "retrieval",
14
+ function = "function",
15
+ memory = "memory",
16
+ ui_resources = "ui_resources",
17
+ skill = "skill",
18
+ read_file = "read_file",
19
+ bash_tool = "bash_tool"
20
+ }
21
+ export declare enum EToolResources {
22
+ code_interpreter = "code_interpreter",
23
+ execute_code = "execute_code",
24
+ file_search = "file_search",
25
+ image_edit = "image_edit",
26
+ context = "context",
27
+ ocr = "ocr"
28
+ }
29
+ export type Tool = {
30
+ [type: string]: Tools;
31
+ };
32
+ export type FunctionTool = {
33
+ type: Tools;
34
+ function?: {
35
+ description: string;
36
+ name: string;
37
+ parameters: Record<string, unknown>;
38
+ strict?: boolean;
39
+ additionalProperties?: boolean;
40
+ };
41
+ };
42
+ /**
43
+ * A set of resources that are used by the assistant's tools. The resources are
44
+ * specific to the type of tool. For example, the `code_interpreter` tool requires
45
+ * a list of file IDs, while the `file_search` tool requires a list of vector store
46
+ * IDs.
47
+ */
48
+ export interface ToolResources {
49
+ code_interpreter?: CodeInterpreterResource;
50
+ file_search?: FileSearchResource;
51
+ }
52
+ export interface CodeInterpreterResource {
53
+ /**
54
+ * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
55
+ * available to the `code_interpreter`` tool. There can be a maximum of 20 files
56
+ * associated with the tool.
57
+ */
58
+ file_ids?: Array<string>;
59
+ }
60
+ export interface FileSearchResource {
61
+ /**
62
+ * The ID of the
63
+ * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
64
+ * attached to this assistant. There can be a maximum of 1 vector store attached to
65
+ * the assistant.
66
+ */
67
+ vector_store_ids?: Array<string>;
68
+ }
69
+ /**
70
+ * Specifies who can invoke a tool.
71
+ * - 'direct': LLM can call directly
72
+ * - 'code_execution': Only callable via programmatic tool calling (PTC)
73
+ */
74
+ export type AllowedCaller = 'direct' | 'code_execution';
75
+ /**
76
+ * Per-tool configuration options stored at the agent level.
77
+ * Keyed by tool_id (e.g., "search_mcp_github").
78
+ */
79
+ export type ToolOptions = {
80
+ /**
81
+ * If true, the tool uses deferred loading (discoverable via tool search).
82
+ * @default false
83
+ */
84
+ defer_loading?: boolean;
85
+ /**
86
+ * Specifies who can invoke this tool.
87
+ * - 'direct': LLM can call directly (default behavior)
88
+ * - 'code_execution': Only callable via PTC sandbox
89
+ * @default ['direct']
90
+ */
91
+ allowed_callers?: AllowedCaller[];
92
+ /**
93
+ * If true (and the `run_in_background` capability is enabled), the tool's
94
+ * schema gains a `run_in_background` boolean so the model can dispatch the
95
+ * call detached and poll its result via `check_background_task`.
96
+ * @default false
97
+ */
98
+ run_in_background?: boolean;
99
+ /**
100
+ * If true (and the `tool_intents` capability is enabled), the tool's schema
101
+ * gains an `intent` string as its FIRST property — one model-authored
102
+ * sentence per call, rendered as the call's live status label. Native host
103
+ * tools default on while the capability is enabled; `false` opts one out.
104
+ * @default false
105
+ */
106
+ describe_intent?: boolean;
107
+ };
108
+ /**
109
+ * Map of tool_id to its configuration options.
110
+ * Used to customize tool behavior per agent.
111
+ */
112
+ export type AgentToolOptions = Record<string, ToolOptions>;
113
+ export declare const actionDelimiter = "_action_";
114
+ export declare const actionDomainSeparator = "---";
115
+ /**
116
+ * Checks whether a tool name is an OpenAPI action tool.
117
+ *
118
+ * Action format: `operationId_action_normalizedDomain`
119
+ * MCP format: `toolName_mcp_serverName`
120
+ *
121
+ * Cross-delimiter collision: an MCP tool like `get_action_mcp_srv` contains
122
+ * `_action_` as a false positive. Guarded by checking whether `_mcp_` appears
123
+ * after `_action_`. In the collision case the `_mcp_` suffix always follows
124
+ * `_action_`; in a valid action tool whose operationId contains `_mcp_`, the
125
+ * `_mcp_` precedes `_action_`.
126
+ *
127
+ * Theoretical limitation: a non-RFC-compliant domain containing literal
128
+ * underscores that form `_mcp_` (e.g. `api_mcp_internal.com`) would produce
129
+ * a false negative. RFC 952/1123 prohibit underscores in hostnames, so this
130
+ * is not expected in practice.
131
+ */
132
+ export declare function isActionTool(toolName: string): boolean;
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Provider-neutral conversation trace contract. The server maps whatever its
3
+ * tracing backend stores into these shapes, so the client never sees a
4
+ * backend's field names, credentials, URL structure or API version.
5
+ */
6
+ export type TTraceRecordKind = 'agent' | 'generation' | 'tool' | 'span' | 'event';
7
+ /**
8
+ * What a record did in the run, in the application's own terms, so a client never reads a tracing
9
+ * backend's span names. Absent on a record the backend did not describe: it is listed by `kind`.
10
+ * `run` is a whole agent run, `agent` the named agent inside it, `plumbing` a wrapper that only
11
+ * frames a model call, `model` a model call of the response, `tools` one round of tool calls, and
12
+ * the label roles are the model calls that wrote the activity labels the chat shows while a
13
+ * response runs.
14
+ */
15
+ export type TTraceRecordRole = 'run' | 'agent' | 'plumbing' | 'model' | 'tools' | 'stepLabel' | 'reasoningLabel' | 'phaseLabel';
16
+ /** `running` marks a record with no end time yet; it has a start but no duration. */
17
+ export type TTraceStatus = 'ok' | 'warning' | 'error' | 'running';
18
+ export type TTraceUsage = {
19
+ input?: number;
20
+ output?: number;
21
+ total?: number;
22
+ reasoning?: number;
23
+ cacheRead?: number;
24
+ cacheWrite?: number;
25
+ };
26
+ export type TTraceRecord = {
27
+ id: string;
28
+ traceId: string;
29
+ /** The response message whose turn produced this record; groups records into turns. */
30
+ messageId: string;
31
+ /** `null` for a root; may name a record that is not loaded (or does not exist). */
32
+ parentId: string | null;
33
+ kind: TTraceRecordKind;
34
+ role?: TTraceRecordRole;
35
+ /** The saved agent a `role: 'agent'` record ran; absent for an agent that was never saved. */
36
+ agentId?: string;
37
+ /** The tools a `role: 'tools'` round called, in order, as the backend recorded the round. */
38
+ tools?: string[];
39
+ name: string;
40
+ model?: string;
41
+ /** ISO-8601 timestamps. */
42
+ startTime: string;
43
+ endTime?: string;
44
+ /** First streamed token of a generation; splits its span into TTFT and decoding. */
45
+ completionStartTime?: string;
46
+ status: TTraceStatus;
47
+ statusMessage?: string;
48
+ usage?: TTraceUsage;
49
+ /** Total cost in USD, when the backend priced the record. */
50
+ cost?: number;
51
+ /** Set on records of the turn's title generation; absent on the response run itself. */
52
+ origin?: 'title';
53
+ };
54
+ export type TTraceErrorCode = 'disabled' | 'not_found' | 'invalid_request' | 'rate_limited' | 'timeout' | 'unauthorized' | 'unsupported' | 'upstream_error';
55
+ export type TTraceErrorResponse = {
56
+ error: string;
57
+ errorCode: TTraceErrorCode;
58
+ };
59
+ export type TTraceAvailability = {
60
+ available: boolean;
61
+ /** Set when the backend cannot decide yet; ask again after this many milliseconds. */
62
+ retryAfterMs?: number;
63
+ };
64
+ export type TTracePageParams = {
65
+ conversationId: string;
66
+ cursor?: string;
67
+ };
68
+ export type TTraceRecordParams = {
69
+ conversationId: string;
70
+ recordId: string;
71
+ /** The turn the list attributed the record to; its traces are what authorize the read. */
72
+ messageId: string;
73
+ /** The `sourceId` of the page that listed the record, so its detail reads the same project. */
74
+ sourceId?: string;
75
+ };
76
+ /**
77
+ * Newest turns first; `nextCursor` loads the next older page. A turn's records
78
+ * may continue on the following page, and their order within a turn is not
79
+ * defined, so a client groups records by turn and orders them by time.
80
+ */
81
+ export type TTracePage = {
82
+ records: TTraceRecord[];
83
+ nextCursor?: string;
84
+ /** Opaque identity of the backend project that served the page. */
85
+ sourceId?: string;
86
+ };
87
+ export type TTraceContent = {
88
+ value: string;
89
+ truncated: boolean;
90
+ };
91
+ export type TTraceMessageRole = 'system' | 'user' | 'assistant' | 'tool';
92
+ export type TTraceToolCall = {
93
+ name: string;
94
+ args?: TTraceContent;
95
+ };
96
+ /** One message of a model call's conversation, each bounded on its own so a long one hides no other. */
97
+ export type TTraceMessage = {
98
+ role: TTraceMessageRole;
99
+ text?: TTraceContent;
100
+ /** The tool a `tool` message answers for. */
101
+ toolName?: string;
102
+ /** The tools an `assistant` message asked for. */
103
+ toolCalls?: TTraceToolCall[];
104
+ /** Parts that are not text (an image, a file), by their type. */
105
+ attachments?: string[];
106
+ };
107
+ /**
108
+ * What a model call was given, as a conversation. A long one keeps its system
109
+ * message and its newest messages, which are what the call answered, and
110
+ * `omitted` counts the older ones left out between them.
111
+ */
112
+ export type TTracePrompt = {
113
+ messages: TTraceMessage[];
114
+ /** Every message the call was given, listed or not. */
115
+ total: number;
116
+ omitted: number;
117
+ /** Names of the tools the model could call. */
118
+ tools?: string[];
119
+ };
120
+ export type TTraceRecordDetail = {
121
+ record: TTraceRecord;
122
+ /** False when the deployment withholds input, output and metadata. */
123
+ contentAvailable: boolean;
124
+ /** Set when the input is a conversation the backend could read as one; `input` stays the raw form. */
125
+ prompt?: TTracePrompt;
126
+ /** Set when the output is a message the backend could read as one; `output` stays the raw form. */
127
+ reply?: TTraceMessage;
128
+ input?: TTraceContent;
129
+ output?: TTraceContent;
130
+ metadata?: TTraceContent;
131
+ };
132
+ export declare const TRACE_CURSOR_MAX_LENGTH = 4096;
133
+ export declare const TRACE_SOURCE_ID_MAX_LENGTH = 128;
134
+ export declare const TRACE_RECORD_ID_MAX_LENGTH = 256;
@@ -1,12 +1,16 @@
1
1
  import type { InfiniteData } from '@tanstack/react-query';
2
2
  import type { TConversationTag, EModelEndpoint, TConversation, TSharedLink, TAttachment, TMessage, TBanner, ReasoningResponseKey, ReasoningParameterFormat } from './schemas';
3
- import type { CodeEnvironmentUserConfigSchema, CodeEnvironmentUserSettings } from './config';
4
- import type { Agent, EToolResources, StatefulCodeEnvironment } from './types/assistants';
3
+ import type { CodeWorkspaceDescriptor, CodeEnvironmentMode, CodeWorkspaceOperation, CodeWorkspaceSelection } from './code/workspace';
4
+ import type { CodeEnvironmentUserConfigSchema, CodeEnvironmentUserSettings, TAgentsEndpoint } from './config';
5
+ import type { StatefulCodeEnvironment } from './stateful-code';
6
+ import type { CodeApprovalMode } from './code/approval';
7
+ import type { EToolResources } from './types/tools';
5
8
  import type { RefillIntervalUnit } from './balance';
6
9
  import type { SettingDefinition } from './generate';
7
10
  import type { TMinimalFeedback } from './feedback';
8
11
  import type { ContentTypes } from './types/runs';
9
12
  import type { ProviderId } from './providers';
13
+ import type { Agent } from './types/agents';
10
14
  export * from './schemas';
11
15
  export * from './types/subagents';
12
16
  export type TMessages = TMessage[];
@@ -51,6 +55,9 @@ export type TEphemeralAgent = {
51
55
  export type TPayload = Partial<TMessage> & Partial<TEndpointOption> & {
52
56
  isContinued: boolean;
53
57
  isRegenerate?: boolean;
58
+ /** Manual context compaction: summarize the branch up to `parentMessageId`
59
+ * and end without a reply. No user message is created. */
60
+ compact?: boolean;
54
61
  conversationId: string | null;
55
62
  messages?: TMessages;
56
63
  isTemporary: boolean;
@@ -65,6 +72,12 @@ export type TPayload = Partial<TMessage> & Partial<TEndpointOption> & {
65
72
  * before the LLM turn runs.
66
73
  */
67
74
  manualSkills?: string[];
75
+ /** Conversation-scoped preference for code tool approval behavior. */
76
+ codeApprovalMode?: CodeApprovalMode;
77
+ /** Immutable conversation choice for attached code execution. */
78
+ codeEnvironmentMode?: CodeEnvironmentMode;
79
+ /** Conversation-selected workspaces, with at most one binding per environment. */
80
+ codeWorkspaces?: CodeWorkspaceSelection[];
68
81
  /** Browser IANA timezone (e.g. `America/New_York`) used to resolve local-time prompt variables server-side. */
69
82
  timezone?: string;
70
83
  /**
@@ -101,6 +114,9 @@ export type TSubmission = {
101
114
  /** Client-only full message context used to restore branch siblings after scoped regenerate. */
102
115
  regenerateMessages?: TMessage[];
103
116
  isRegenerate?: boolean;
117
+ /** Manual context compaction; shaped like a regenerate on the client (no new
118
+ * user bubble) and sent to the server as a summarize-only turn. */
119
+ compact?: boolean;
104
120
  initialResponse?: TMessage;
105
121
  conversation: Partial<TConversation>;
106
122
  endpointOption: TEndpointOption;
@@ -137,6 +153,12 @@ export type TSubmission = {
137
153
  addedConvo?: TConversation;
138
154
  /** Skills the user invoked via the `$` popover for this submission. */
139
155
  manualSkills?: string[];
156
+ /** Conversation-scoped preference for code tool approval behavior. */
157
+ codeApprovalMode?: CodeApprovalMode;
158
+ /** Immutable conversation choice for attached code execution. */
159
+ codeEnvironmentMode?: CodeEnvironmentMode;
160
+ /** Conversation-selected workspaces, with at most one binding per environment. */
161
+ codeWorkspaces?: CodeWorkspaceSelection[];
140
162
  /** Stable per-submission idempotency key (uuid) forwarded to the server to dedup retried start-generation requests. */
141
163
  clientRequestId?: string;
142
164
  /** Client-only carry-through for a receipt-bound queued recovery. */
@@ -327,6 +349,9 @@ export type TPinConversationResponse = TConversation;
327
349
  export type TSharedMessagesResponse = Omit<TSharedLink, 'messages'> & {
328
350
  messages: TMessage[];
329
351
  langfuseSessionUrl?: string;
352
+ /** Whether the link was published with a configured sender label; withholds the
353
+ * model on hover. */
354
+ hasConfiguredSender?: boolean;
330
355
  };
331
356
  export type TCreateShareLinkRequest = Pick<TConversation, 'conversationId'>;
332
357
  export type TUpdateShareLinkRequest = Pick<TSharedLink, 'shareId' | 'targetMessageId'>;
@@ -424,7 +449,42 @@ export type TCodeEnvironmentPairingResponse = {
424
449
  endpoint: string;
425
450
  };
426
451
  };
452
+ export type TCodeEnvironmentStatusResponse = {
453
+ environmentId: string;
454
+ status: 'offline' | 'starting' | 'ready';
455
+ statefulWorkspace?: boolean;
456
+ leaseExpiresInMs?: number;
457
+ sandboxProfile?: string;
458
+ runtimes?: string[];
459
+ operations?: CodeWorkspaceOperation[];
460
+ workspaces?: CodeWorkspaceDescriptor[];
461
+ };
462
+ /** Moves a sealed attached decision onto the environments a conversation's agents now use. */
463
+ export type TCodeEnvironmentMoveRequest = {
464
+ conversationId: string;
465
+ /** The persisted selections being replaced; a mismatch rejects the move as stale. */
466
+ from: CodeWorkspaceSelection[];
467
+ to: CodeWorkspaceSelection[];
468
+ };
469
+ export type TCodeEnvironmentMoveResponse = {
470
+ conversationId: string;
471
+ codeEnvironmentMode: 'attached';
472
+ codeWorkspaces: CodeWorkspaceSelection[];
473
+ };
474
+ /** Sanitized results of server request shaping for each saved toggle state. */
475
+ export type ResponsesApiRoute = {
476
+ default: boolean;
477
+ on: boolean;
478
+ off: boolean;
479
+ withWebSearch?: {
480
+ default: boolean;
481
+ on: boolean;
482
+ off: boolean;
483
+ };
484
+ };
485
+ export type ResponsesApiRouting = Record<string, ResponsesApiRoute>;
427
486
  export type TConfig = {
487
+ responsesApiRouting?: ResponsesApiRouting;
428
488
  order: number;
429
489
  type?: EModelEndpoint;
430
490
  azure?: boolean;
@@ -450,9 +510,17 @@ export type TConfig = {
450
510
  statefulCodeSessions?: {
451
511
  allowedEnvironments: StatefulCodeEnvironment[];
452
512
  environments?: TPublicCodeEnvironment[];
513
+ approvalsEnabled?: boolean;
514
+ /** Approval modes the endpoint policy permits the client to offer. */
515
+ approvalModes?: CodeApprovalMode[];
453
516
  };
454
517
  /** Effective subagents-per-agent cap served from `endpoints.agents.maxSubagents`. */
455
518
  maxSubagents?: number;
519
+ fileSharing?: TAgentsEndpoint['fileSharing'];
520
+ /** Concurrent Code API uploads allowed per route and authenticated principal. */
521
+ codeApiUploadConcurrency?: number;
522
+ /** Milliseconds one operation may spend waiting on Code API rate limits. */
523
+ codeApiMaxRetryWaitMs?: number;
456
524
  customParams?: {
457
525
  defaultParamsEndpoint?: string;
458
526
  reasoningFormat?: ReasoningParameterFormat;
@@ -793,4 +861,6 @@ export type TLangfuseConnectionTestResponse = {
793
861
  };
794
862
  export type TLangfuseSessionLinkResponse = {
795
863
  url: string | null;
864
+ /** Opaque identity of the project `url` opens, so a caller can tell whether it holds what it showed. */
865
+ destinationId?: string;
796
866
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "librechat-data-provider",
3
- "version": "0.8.522",
3
+ "version": "0.8.524",
4
4
  "description": "data services for librechat apps",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -46,7 +46,7 @@
46
46
  "axios": "^1.20.0",
47
47
  "croner": "^10.0.1",
48
48
  "dayjs": "^1.11.13",
49
- "js-yaml": "^4.3.1",
49
+ "js-yaml": "^4.3.2",
50
50
  "re2js": "^2.8.6",
51
51
  "zod": "^3.22.4"
52
52
  },