librechat-data-provider 0.8.521 → 0.8.523

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 (64) hide show
  1. package/dist/{data-service-pwrlWjJs.mjs → data-service-Bx6IFaSa.mjs} +1770 -51
  2. package/dist/data-service-Bx6IFaSa.mjs.map +1 -0
  3. package/dist/{data-service-DOIF4BkW.js → data-service-CTX0tVO5.js} +2509 -112
  4. package/dist/data-service-CTX0tVO5.js.map +1 -0
  5. package/dist/index.js +1503 -54
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +1314 -55
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/react-query/index.js +2 -1
  10. package/dist/react-query/index.js.map +1 -1
  11. package/dist/react-query/index.mjs +2 -1
  12. package/dist/react-query/index.mjs.map +1 -1
  13. package/dist/types/accessPermissions.d.ts +58 -1
  14. package/dist/types/actions.d.ts +2 -2
  15. package/dist/types/agentToolOptions.d.ts +11 -0
  16. package/dist/types/api-endpoints.d.ts +24 -0
  17. package/dist/types/bedrock.d.ts +238 -10
  18. package/dist/types/cadence.d.ts +33 -0
  19. package/dist/types/code/approval.d.ts +26 -0
  20. package/dist/types/code/worker.d.ts +10 -0
  21. package/dist/types/code/workspace.d.ts +28 -0
  22. package/dist/types/codeEnvRef.d.ts +26 -0
  23. package/dist/types/config.d.ts +13180 -3021
  24. package/dist/types/data-service.d.ts +48 -2
  25. package/dist/types/errors.d.ts +2 -0
  26. package/dist/types/file-config.d.ts +138 -9
  27. package/dist/types/filters.d.ts +1422 -0
  28. package/dist/types/generate.d.ts +103 -1
  29. package/dist/types/index.d.ts +17 -0
  30. package/dist/types/keys.d.ts +33 -2
  31. package/dist/types/langchain.d.ts +4 -0
  32. package/dist/types/limits.d.ts +13 -0
  33. package/dist/types/mcp.d.ts +555 -460
  34. package/dist/types/messages.d.ts +24 -0
  35. package/dist/types/models.d.ts +1112 -319
  36. package/dist/types/parameterSettings.d.ts +13 -1
  37. package/dist/types/parsers.d.ts +10 -0
  38. package/dist/types/permissions.d.ts +42 -1
  39. package/dist/types/providers.d.ts +37 -0
  40. package/dist/types/request.d.ts +2 -2
  41. package/dist/types/resolve-llm-delivery-path.d.ts +68 -0
  42. package/dist/types/roles.d.ts +34 -0
  43. package/dist/types/runSteps.d.ts +59 -0
  44. package/dist/types/schemas.d.ts +1724 -248
  45. package/dist/types/stateful-code.d.ts +7 -0
  46. package/dist/types/svg.d.ts +34 -0
  47. package/dist/types/types/agents.d.ts +116 -7
  48. package/dist/types/types/assistants.d.ts +121 -6
  49. package/dist/types/types/files.d.ts +46 -2
  50. package/dist/types/types/index.d.ts +2 -0
  51. package/dist/types/types/insights.d.ts +71 -0
  52. package/dist/types/types/mutations.d.ts +1 -0
  53. package/dist/types/types/queries.d.ts +37 -2
  54. package/dist/types/types/queuedTurns.d.ts +870 -0
  55. package/dist/types/types/runs.d.ts +119 -9
  56. package/dist/types/types/schedules.d.ts +339 -0
  57. package/dist/types/types/skills.d.ts +9 -0
  58. package/dist/types/types/subagents.d.ts +159 -0
  59. package/dist/types/types/traces.d.ts +85 -0
  60. package/dist/types/types/web.d.ts +12 -2
  61. package/dist/types/types.d.ts +101 -1
  62. package/package.json +5 -3
  63. package/dist/data-service-DOIF4BkW.js.map +0 -1
  64. package/dist/data-service-pwrlWjJs.mjs.map +0 -1
@@ -0,0 +1,7 @@
1
+ export declare const STATEFUL_CODE_ENVIRONMENTS: readonly ["user", "agent-user", "conversation"];
2
+ export type StatefulCodeEnvironment = (typeof STATEFUL_CODE_ENVIRONMENTS)[number];
3
+ /** Resolve a deployment allowlist in stable UI order. An omitted value preserves
4
+ * the backward-compatible behavior where every environment is available. */
5
+ export declare function resolveAllowedStatefulCodeEnvironments(configured?: readonly StatefulCodeEnvironment[] | null): StatefulCodeEnvironment[];
6
+ /** Keep an allowed preference, otherwise select the first deployment-allowed scope. */
7
+ export declare function resolveStatefulCodeEnvironment(preferred: StatefulCodeEnvironment | null | undefined, configured?: readonly StatefulCodeEnvironment[] | null): StatefulCodeEnvironment | undefined;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * DOMPurify policy for user-provided SVG icons, shared by the browser uploader and
3
+ * the server trust boundary so a preview and the persisted icon cannot disagree.
4
+ * `use` is re-added for self-contained `<defs>` references (targets restricted by
5
+ * `restrictSvgReferences`); every SMIL element is forbidden so a stored icon
6
+ * cannot animate forever wherever it renders.
7
+ */
8
+ export declare const SVG_SANITIZE_CONFIG: {
9
+ USE_PROFILES: {
10
+ svg: boolean;
11
+ svgFilters: boolean;
12
+ };
13
+ ADD_TAGS: string[];
14
+ ADD_ATTR: string[];
15
+ FORBID_TAGS: string[];
16
+ FORBID_ATTR: string[];
17
+ };
18
+ /** Element surface shared by the browser DOM and the server's jsdom. */
19
+ export interface SvgAttributeHost {
20
+ attributes: ArrayLike<{
21
+ name: string;
22
+ }>;
23
+ getAttribute(name: string): string | null;
24
+ removeAttribute(name: string): void;
25
+ }
26
+ /** DOMPurify hook that drops every attribute referencing outside the document. */
27
+ export declare function restrictSvgReferences(node: SvgAttributeHost): void;
28
+ /**
29
+ * Makes HTML-mode sanitizer output valid as a standalone `image/svg+xml`
30
+ * document: restores camelCase element names the HTML parser lowercased and
31
+ * declares the SVG namespace on the root, without which an XML parser puts the
32
+ * root in no namespace and the icon renders blank.
33
+ */
34
+ export declare function finalizeSvgMarkup(markup: string): string;
@@ -1,6 +1,6 @@
1
1
  import type { TTokenUsageEvent, TContextUsageEvent, TPendingSteer } from './runs';
2
- import type { FunctionToolCall, SummaryContentPart } from './assistants';
3
2
  import type { TAttachment, TPlugin } from 'src/schemas';
3
+ import type { SummaryContentPart } from './assistants';
4
4
  import { StepTypes, ContentTypes, ToolCallTypes } from './runs';
5
5
  export declare namespace Agents {
6
6
  type MessageType = 'human' | 'ai' | 'generic' | 'system' | 'function' | 'tool' | 'remove';
@@ -52,16 +52,40 @@ export declare namespace Agents {
52
52
  * A call to a tool.
53
53
  */
54
54
  type ToolCall = {
55
- /** Type ("tool_call") according to Assistants Tool Call Structure */
56
- type: ToolCallTypes.TOOL_CALL;
55
+ /** Type ("tool_call") according to Assistants Tool Call Structure; optional literal
56
+ * form included to mirror langchain's ToolCall, whose `type` is optional. */
57
+ type?: ToolCallTypes.TOOL_CALL | 'tool_call';
57
58
  /** The name of the tool to be called */
58
59
  name: string;
60
+ /** Host-derived MCP server identity retained to disambiguate historical tool keys. */
61
+ mcpServerName?: string;
59
62
  /** The arguments to the tool call */
60
63
  args?: string | Record<string, any>;
61
64
  /** If provided, an identifier associated with the tool call */
62
65
  id?: string;
66
+ /** Host run-step identity; unlike provider ids, this is unique across turns. */
67
+ stepId?: string;
63
68
  /** If provided, the output of the tool call */
64
69
  output?: string;
70
+ /** Host-owned durable receipt for a detached ordinary tool result.
71
+ * It lives beside the original call so reload, manual collection, and
72
+ * automatic continuation all arbitrate the same result identity. */
73
+ backgroundTask?: {
74
+ version: 1;
75
+ taskId: string;
76
+ toolName: string;
77
+ status: 'completed' | 'error';
78
+ /** Additive rolling-deploy-compatible cancellation discriminator. */
79
+ cancelled?: true;
80
+ settledAt: Date;
81
+ resultClaim?: {
82
+ kind: 'manual' | 'wakeup';
83
+ claimId: string;
84
+ claimedAt: Date;
85
+ /** Response generation that owns a manual delivery claim. */
86
+ generationId?: string;
87
+ };
88
+ };
65
89
  /** The tool call was rejected before execution because its input failed schema validation. */
66
90
  inputValidationError?: true;
67
91
  /** Auth URL */
@@ -177,7 +201,35 @@ export declare namespace Agents {
177
201
  groupId?: number;
178
202
  stepDetails: StepDetails;
179
203
  summary?: SummaryContentPart;
180
- usage: null | object;
204
+ /** Optional to mirror the agents SDK, which omits usage until a step reports it. */
205
+ usage?: null | object;
206
+ /** Epoch ms the step was opened. Emitted by `@librechat/agents` >= 3.4.6. */
207
+ created_at?: number;
208
+ status?: RunStepStatus;
209
+ };
210
+ /** Lifecycle status of a run step. `in_progress` until a terminal close. */
211
+ type RunStepStatus = 'in_progress' | 'completed' | 'cancelled' | 'failed';
212
+ /** Terminal status a run step can close with. */
213
+ type RunStepClosedStatus = Exclude<RunStepStatus, 'in_progress'>;
214
+ /**
215
+ * Payload of {@link StepEvents.ON_RUN_STEP_CLOSED}. Emitted once per step
216
+ * when it reaches a terminal state, including steps swept at end-of-run
217
+ * because the caller aborted — which is the only signal that distinguishes
218
+ * a stopped step from one still in flight.
219
+ */
220
+ type RunStepClosedEvent = {
221
+ id: string;
222
+ index: number;
223
+ type: StepTypes;
224
+ status: RunStepClosedStatus;
225
+ /** Epoch ms the step was opened, when the emitter knows it. */
226
+ created_at?: number;
227
+ /** Epoch ms the step reached its terminal state. */
228
+ closed_at: number;
229
+ runId?: string;
230
+ agentId?: string;
231
+ groupId?: number;
232
+ stepIndex?: number;
181
233
  };
182
234
  /** Content part for aggregated message content */
183
235
  interface ContentPart {
@@ -197,6 +249,16 @@ export declare namespace Agents {
197
249
  manualSkills?: string[];
198
250
  alwaysAppliedSkills?: string[];
199
251
  }
252
+ /** Client-safe state for one MCP authorization prompt that remains actionable. */
253
+ interface PendingMCPOAuthPrompt {
254
+ stepId: string;
255
+ runId?: string;
256
+ index: number;
257
+ toolCallId?: string;
258
+ toolName: string;
259
+ authURL: string;
260
+ expiresAt?: number;
261
+ }
200
262
  /** State data sent to reconnecting clients */
201
263
  interface ResumeState {
202
264
  runSteps: RunStep[];
@@ -204,6 +266,8 @@ export declare namespace Agents {
204
266
  aggregatedContent?: MessageContentComplex[];
205
267
  userMessage?: UserMessageMeta;
206
268
  responseMessageId?: string;
269
+ /** True when the live generation replaces an existing assistant branch. */
270
+ isRegenerate?: boolean;
207
271
  conversationId?: string;
208
272
  sender?: string;
209
273
  iconURL?: string;
@@ -220,6 +284,8 @@ export declare namespace Agents {
220
284
  data?: unknown;
221
285
  [key: string]: unknown;
222
286
  }>;
287
+ /** Pending MCP authorization prompts projected from durable stream state. */
288
+ pendingOAuthPrompts?: PendingMCPOAuthPrompt[];
223
289
  /** Cumulative provider-reported usage for the run; backfills usage totals on resume */
224
290
  collectedUsage?: TTokenUsageEvent[];
225
291
  /** Latest context window snapshot; restores the usage gauge on resume */
@@ -263,7 +329,7 @@ export declare namespace Agents {
263
329
  };
264
330
  type ToolCallsDetails = {
265
331
  type: StepTypes.TOOL_CALLS;
266
- tool_calls: AgentToolCall[];
332
+ tool_calls?: AgentToolCall[];
267
333
  };
268
334
  type ToolCallDelta = {
269
335
  type: StepTypes.TOOL_CALLS | string;
@@ -277,7 +343,21 @@ export declare namespace Agents {
277
343
  description?: string;
278
344
  };
279
345
  };
280
- type AgentToolCall = FunctionToolCall | ToolCall;
346
+ /**
347
+ * Mirrors the agents SDK's function tool-call variant: `arguments` may arrive as a
348
+ * parsed object, and `output` is attached by LibreChat aggregation only once available
349
+ * (the legacy assistants `FunctionToolCall` requires both as string/present).
350
+ */
351
+ type AgentFunctionToolCall = {
352
+ id: string;
353
+ type: 'function';
354
+ function: {
355
+ name: string;
356
+ arguments: string | object;
357
+ output?: string | null;
358
+ };
359
+ };
360
+ type AgentToolCall = AgentFunctionToolCall | ToolCall;
281
361
  /**
282
362
  * Human-in-the-loop interrupt categories. The discriminator on
283
363
  * {@link HumanInterruptPayload}.
@@ -307,6 +387,8 @@ export declare namespace Agents {
307
387
  tool_call_id: string;
308
388
  /** Optional human-readable description shown alongside the prompt */
309
389
  description?: string;
390
+ /** Server-authored provenance. Absent for user, MCP, action, and older tool calls. */
391
+ source?: 'librechat_code';
310
392
  }
311
393
  /**
312
394
  * Per-call review configuration: which decisions the user is allowed to make.
@@ -409,6 +491,8 @@ export declare namespace Agents {
409
491
  * so the id check can't.
410
492
  */
411
493
  requestFingerprint?: string;
494
+ /** Current-version fingerprint; server-only and omitted from client projections. */
495
+ requestFingerprintV2?: string;
412
496
  /**
413
497
  * Graph-determining request fields (endpoint, agent_id, model, spec, promptPrefix,
414
498
  * ephemeralAgent) captured at pause. The resume route REPLAYS these onto the request
@@ -416,6 +500,22 @@ export declare namespace Agents {
416
500
  * no longer reconstruct the ephemeral config — still rebuilds the same agent/graph.
417
501
  */
418
502
  resumeContext?: Record<string, unknown>;
503
+ /**
504
+ * Opaque, server-only identity of the stateful code targets selected when a
505
+ * tool approval paused. Resume rejects a changed target before provider or
506
+ * tool execution so an approval cannot migrate to another VM or workspace.
507
+ */
508
+ codeExecutionBinding?: CodeExecutionApprovalBinding;
509
+ }
510
+ interface CodeExecutionApprovalTargetBinding {
511
+ /** Agent identity when available; anonymous ephemeral agents use null. */
512
+ agentId: string | null;
513
+ /** SHA-256 of the resolved route, worker and runtime-session identity. */
514
+ targetHash: string;
515
+ }
516
+ interface CodeExecutionApprovalBinding {
517
+ version: 1;
518
+ targets: CodeExecutionApprovalTargetBinding[];
419
519
  }
420
520
  /**
421
521
  * Scope of a tool-approval decision — drives the "remember this" persistence
@@ -646,8 +746,17 @@ export type GraphEdge = {
646
746
  *
647
747
  * For handoff edges: Description for the input parameter that the handoff tool accepts,
648
748
  * allowing the supervisor to pass specific instructions/context to the transferred agent.
749
+ *
750
+ * The callback receives a minimal structural view of the run's messages (data-provider
751
+ * cannot depend on langchain's BaseMessage): every langchain message satisfies
752
+ * `{ content: unknown }`, and callbacks typed against richer structural message shapes
753
+ * remain assignable. The promise branch mirrors the agents SDK signature exactly —
754
+ * widening it (e.g. to `Promise<string | undefined>`) would break assignability of
755
+ * stored edges into the SDK's `GraphEdge`.
649
756
  */
650
- prompt?: string | ((messages: BaseMessage[], runStartIndex: number) => string | undefined);
757
+ prompt?: string | ((messages: {
758
+ content: unknown;
759
+ }[], runStartIndex: number) => string | Promise<string> | undefined);
651
760
  /**
652
761
  * When true, excludes messages from startIndex when adding prompt.
653
762
  * Automatically set to true when {results} variable is used in prompt.
@@ -1,9 +1,13 @@
1
+ import { z } from 'zod';
1
2
  import type { OpenAPIV3 } from 'openapi-types';
2
- import type { AssistantsEndpoint, AgentProvider, MemoryScope } from 'src/schemas';
3
+ import type { AssistantsEndpoint, AgentProvider, MemoryScope, SkillsScope } from 'src/schemas';
4
+ import type { StatefulCodeEnvironment } from '../stateful-code';
5
+ import type { ContentTypes, SubagentIdentity } from './runs';
3
6
  import type { Agents, GraphEdge } from './agents';
4
- import type { ContentTypes } from './runs';
5
7
  import type { TFile } from './files';
6
8
  import { ArtifactModes } from 'src/artifacts';
9
+ export { STATEFUL_CODE_ENVIRONMENTS, resolveStatefulCodeEnvironment, resolveAllowedStatefulCodeEnvironments, } from '../stateful-code';
10
+ export type { StatefulCodeEnvironment } from '../stateful-code';
7
11
  export type Schema = OpenAPIV3.SchemaObject & {
8
12
  description?: string;
9
13
  };
@@ -238,15 +242,46 @@ export type AgentToolOptions = Record<string, ToolOptions>;
238
242
  /**
239
243
  * Configuration for spawning subagents (isolated-context child agents) from an agent.
240
244
  * When `enabled` is true, the agent gets a subagent-spawn tool that can delegate work
241
- * to either itself (when `allowSelf` is true) and/or the listed `agent_ids`.
245
+ * to itself, listed single-agent targets, and/or explicit saved-agent teams.
242
246
  */
247
+ export type AgentSubagentGraphEdge = Omit<GraphEdge, 'edgeType' | 'condition' | 'prompt' | 'promptKey'> & {
248
+ edgeType: 'direct';
249
+ condition?: never;
250
+ prompt?: string;
251
+ promptKey?: never;
252
+ };
253
+ /** A bounded saved-agent team that can be spawned as one isolated child graph. */
254
+ export type AgentSubagentGraph = {
255
+ /** Stable spawn-tool enum value for the team. */
256
+ type: string;
257
+ name: string;
258
+ description: string;
259
+ /** Member IDs. In create/update payloads, an empty ID refers to the current agent. */
260
+ agent_ids: string[];
261
+ edges: AgentSubagentGraphEdge[];
262
+ /** Entry member ID. In create/update payloads, an empty ID refers to the current agent. */
263
+ entry_agent_id: string;
264
+ /** Result member ID. In create/update payloads, an empty ID refers to the current agent. */
265
+ result_agent_id: string;
266
+ };
243
267
  export type AgentSubagentsConfig = {
244
268
  enabled?: boolean;
245
269
  /** When true (default), the agent may spawn itself in an isolated context. */
246
270
  allowSelf?: boolean;
271
+ /** Share current-turn files with authorized descendants. Off unless explicitly enabled. */
272
+ shareFiles?: boolean;
247
273
  /** Specific agents that may be spawned as subagents. */
248
274
  agent_ids?: string[];
275
+ /** Explicit saved-agent teams that may be spawned as bounded child graphs. */
276
+ graphs?: AgentSubagentGraph[];
277
+ };
278
+ export type AgentGitIdentity = {
279
+ /** Commit author and committer display name. */
280
+ name: string;
281
+ /** Commit author and committer email address. */
282
+ email: string;
249
283
  };
284
+ export declare const agentGitIdentitySchema: z.ZodType<AgentGitIdentity | undefined>;
250
285
  export type Agent = {
251
286
  _id?: string;
252
287
  id: string;
@@ -275,6 +310,14 @@ export type Agent = {
275
310
  hide_sequential_outputs?: boolean;
276
311
  /** Per-agent opt-in for stateful code sessions (requires the app-level capability). */
277
312
  stateful_code_sessions?: boolean;
313
+ /** Stateful workspace sharing scope. Defaults to one workspace per user. */
314
+ stateful_code_environment?: StatefulCodeEnvironment;
315
+ /** Operator-configured managed or attached stateful execution environment. */
316
+ code_environment_id?: string | null;
317
+ /** Default attached workspace for new chats; empty means no agent default. */
318
+ code_workspace_id?: string;
319
+ /** Non-secret Git authorship injected into this agent's sandboxed commands. */
320
+ git_identity?: AgentGitIdentity | null;
278
321
  artifacts?: ArtifactModes;
279
322
  recursion_limit?: number;
280
323
  isPublic?: boolean;
@@ -297,11 +340,17 @@ export type Agent = {
297
340
  owner_contact?: AgentOwnerContact;
298
341
  /** Per-tool configuration options (deferred loading, allowed callers, etc.) */
299
342
  tool_options?: AgentToolOptions;
343
+ /** Attached action registrations, each `${encodedDomain}${actionDelimiter}${action_id}` */
344
+ actions?: string[];
300
345
  /** Optional allowlist of skill ObjectIds. Only applies when `skills_enabled`. */
301
346
  skills?: string[];
302
347
  /** Master toggle for skill use on this agent. `true` = active (full catalog unless
303
348
  * `skills` narrows it). `false`/undefined = inactive (no skills available). */
304
349
  skills_enabled?: boolean;
350
+ /** Enables runtime skill creation without exposing an existing skill catalog. */
351
+ skill_authoring_enabled?: boolean;
352
+ /** Explicit catalog exposure while skills are enabled. Missing preserves legacy semantics. */
353
+ skills_scope?: SkillsScope;
305
354
  /** Subagent spawning configuration — isolated-context child agents. */
306
355
  subagents?: AgentSubagentsConfig;
307
356
  /** Memory partition: `agent` isolates memories per (user, agent); default shared pool */
@@ -309,6 +358,7 @@ export type Agent = {
309
358
  };
310
359
  export type TAgentsMap = Record<string, Agent | undefined>;
311
360
  export type AgentCreateParams = {
361
+ git_identity?: AgentGitIdentity;
312
362
  name?: string | null;
313
363
  description?: string | null;
314
364
  avatar?: AgentAvatar | null;
@@ -318,7 +368,7 @@ export type AgentCreateParams = {
318
368
  provider: AgentProvider;
319
369
  model: string | null;
320
370
  model_parameters: AgentModelParameters;
321
- } & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'stateful_code_sessions' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options' | 'skills' | 'skills_enabled' | 'subagents' | 'memory_scope'>;
371
+ } & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'stateful_code_sessions' | 'stateful_code_environment' | 'code_environment_id' | 'code_workspace_id' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options' | 'skills' | 'skills_enabled' | 'skill_authoring_enabled' | 'skills_scope' | 'subagents' | 'memory_scope'>;
322
372
  export type AgentUpdateParams = {
323
373
  name?: string | null;
324
374
  description?: string | null;
@@ -330,7 +380,7 @@ export type AgentUpdateParams = {
330
380
  provider?: AgentProvider;
331
381
  model?: string | null;
332
382
  model_parameters?: AgentModelParameters;
333
- } & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'stateful_code_sessions' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options' | 'skills' | 'skills_enabled' | 'subagents' | 'memory_scope'>;
383
+ } & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'stateful_code_sessions' | 'stateful_code_environment' | 'code_environment_id' | 'git_identity' | 'code_workspace_id' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options' | 'skills' | 'skills_enabled' | 'skill_authoring_enabled' | 'skills_scope' | 'subagents' | 'memory_scope'>;
334
384
  export type AgentListParams = {
335
385
  limit?: number;
336
386
  requiredPermission: number;
@@ -478,6 +528,8 @@ export declare enum RunStatus {
478
528
  EXPIRED = "expired"
479
529
  }
480
530
  export type PartMetadata = {
531
+ /** Host-resolved execution identity for a saved subagent invocation. */
532
+ subagentIdentity?: SubagentIdentity;
481
533
  progress?: number;
482
534
  asset_pointer?: string;
483
535
  status?: string;
@@ -490,9 +542,46 @@ export type PartMetadata = {
490
542
  agentId?: string;
491
543
  /** Group ID for parallel content - parts with same groupId are displayed in columns */
492
544
  groupId?: number;
545
+ /**
546
+ * Terminal lifecycle status of the run step that produced this part, from
547
+ * `on_run_step_closed`. Distinct from `status`, which is already claimed by
548
+ * activity-label and question-form parts. Absent on parts predating the
549
+ * event or from endpoints that do not emit it, in which case renderers fall
550
+ * back to inferring "stopped" from `progress` and `isSubmitting`.
551
+ */
552
+ runStepStatus?: Agents.RunStepClosedStatus;
553
+ /**
554
+ * Wall-clock milliseconds the run step took, derived from the same
555
+ * `on_run_step_closed` event as {@link runStepStatus} via
556
+ * `getRunStepDurationMs`. Only written when the event carried both
557
+ * timestamps and they agree in order — so its absence means "not
558
+ * derivable", never "instant". The raw value is persisted unfiltered;
559
+ * whether it is worth showing (`isReportableRunStepDuration`) is decided
560
+ * at render time.
561
+ */
562
+ runStepDurationMs?: number;
563
+ /**
564
+ * Stamped by the background harvester when a detached task's final output
565
+ * replaces the dispatch handle in `tool_call.output`. The handle JSON and
566
+ * the live status-marker attachment are both transient, so after the patch
567
+ * (or a reload) this is the only signal that the call ran in the
568
+ * background — renderers use it to keep treating {@link runStepDurationMs}
569
+ * as dispatch time rather than the task's runtime.
570
+ */
571
+ backgrounded?: boolean;
572
+ /**
573
+ * Content index this part occupied while its run streamed. The aggregator
574
+ * writes parts at provider-source indexes, so the streamed array is sparse;
575
+ * persistence compacts it and every part after a hole shifts down. The
576
+ * client's final handler stamps the streamed position onto the compacted
577
+ * parts it adopts, so index-derived render identity survives the swap
578
+ * instead of remounting the settled message. Client-only and absent
579
+ * everywhere else — persisted content never carries it.
580
+ */
581
+ streamedIndex?: number;
493
582
  };
494
583
  /** Metadata for parallel content rendering - subset of PartMetadata */
495
- export type ContentMetadata = Pick<PartMetadata, 'agentId' | 'groupId'>;
584
+ export type ContentMetadata = Pick<PartMetadata, 'agentId' | 'groupId' | 'streamedIndex'>;
496
585
  export type ContentPart = (CodeToolCall | RetrievalToolCall | FileSearchToolCall | FunctionToolCall | Agents.AgentToolCall | ImageFile | Text) & PartMetadata;
497
586
  export type TextData = (Text & PartMetadata) | undefined;
498
587
  export type SummaryContentPart = {
@@ -503,6 +592,13 @@ export type SummaryContentPart = {
503
592
  }>;
504
593
  tokenCount?: number;
505
594
  summarizing?: boolean;
595
+ /** A summarize round that ended in error. Partial deltas already streamed
596
+ * into this slot are kept, so the renderer needs this to avoid presenting
597
+ * truncated text under the "Conversation summarized" label. */
598
+ failed?: boolean;
599
+ /** Set when the user compacted the context manually rather than the
600
+ * automatic detour firing on context pressure. */
601
+ initiatedBy?: 'user';
506
602
  summaryVersion?: number;
507
603
  model?: string;
508
604
  provider?: string;
@@ -528,6 +624,10 @@ export type SteerContentPart = {
528
624
  /** Attachments steered with the message; re-encoded per turn on replay
529
625
  * like any other user-message media (refs only, never encoded data). */
530
626
  files?: Partial<TFile>[];
627
+ /** Quoted excerpts steered with the message, persisted separately from the
628
+ * typed text (mirroring `TMessage.quotes`) so the UI renders them as
629
+ * reference blocks; merged into the model-bound user turn on every replay. */
630
+ quotes?: string[];
531
631
  };
532
632
  export type TMessageContentParts = ({
533
633
  type: ContentTypes.ERROR;
@@ -536,6 +636,21 @@ export type TMessageContentParts = ({
536
636
  } & ContentMetadata) | ({
537
637
  type: ContentTypes.THINK;
538
638
  think?: string | TextData;
639
+ /** Generated orientation for this user-visible reasoning step. */
640
+ reasoning_label?: string;
641
+ /** Stable SDK run-step identity used to correlate live revisions. */
642
+ reasoning_label_step_id?: string;
643
+ /** Durable provider-call count used to enforce the per-run cost cap across resumes. */
644
+ reasoning_label_attempts?: number;
645
+ /** Visible reasoning length included in this step's latest provider call. */
646
+ reasoning_label_submitted_chars?: number;
647
+ /** Monotonic provider-call revision; gaps are allowed after unsuccessful attempts. */
648
+ reasoning_label_revision?: number;
649
+ /** Whether the reasoning step can still produce a newer label. */
650
+ reasoning_label_status?: 'streaming' | 'complete';
651
+ /** The reasoning happened but its text is not available to this view
652
+ * (e.g. detached subagent projections retain only a marker). */
653
+ reasoning_unavailable?: boolean;
539
654
  } & ContentMetadata) | (SteerContentPart & ContentMetadata) | ({
540
655
  type: ContentTypes.TEXT;
541
656
  text?: string | TextData;
@@ -1,4 +1,5 @@
1
- import type { CodeEnvRef } from '../codeEnvRef';
1
+ import type { TDefaultLLMDeliveryPathConfig } from '../file-config';
2
+ import type { CodeEnvRef, CodeEnvRefMap } from '../codeEnvRef';
2
3
  import { EToolResources } from './assistants';
3
4
  export declare enum FileSources {
4
5
  local = "local",
@@ -26,6 +27,7 @@ export declare enum FileContext {
26
27
  image_generation = "image_generation",
27
28
  assistants_output = "assistants_output",
28
29
  message_attachment = "message_attachment",
30
+ run_artifact = "run_artifact",
29
31
  skill_file = "skill_file",
30
32
  filename = "filename",
31
33
  updatedAt = "updatedAt",
@@ -44,6 +46,8 @@ export type EndpointFileConfig = {
44
46
  fileSizeLimit?: number;
45
47
  totalSizeLimit?: number;
46
48
  supportedMimeTypes?: RegexLike[];
49
+ defaultLLMDeliveryPath?: TDefaultLLMDeliveryPathConfig;
50
+ legacyFileUploadUX?: boolean;
47
51
  };
48
52
  export type FileConfig = {
49
53
  endpoints: {
@@ -53,6 +57,10 @@ export type FileConfig = {
53
57
  fileSizeLimit?: number;
54
58
  };
55
59
  fileTokenLimit?: number;
60
+ /** Maximum aggregate model-bound attachment bytes admitted into one agent turn. */
61
+ fileContextSizeLimit?: number;
62
+ /** Maximum aggregate extracted-text characters admitted into one agent turn. */
63
+ fileContextCharLimit?: number;
56
64
  serverFileSizeLimit?: number;
57
65
  avatarSizeLimit?: number;
58
66
  clientImageResize?: {
@@ -60,6 +68,8 @@ export type FileConfig = {
60
68
  maxWidth?: number;
61
69
  maxHeight?: number;
62
70
  quality?: number;
71
+ /** Set when `enabled` came from the admin config, in which case it wins over the user's setting */
72
+ enforced?: boolean;
63
73
  };
64
74
  ocr?: {
65
75
  supportedMimeTypes?: RegexLike[];
@@ -71,6 +81,8 @@ export type FileConfig = {
71
81
  supportedMimeTypes?: RegexLike[];
72
82
  };
73
83
  checkType?: (fileType: string, supportedTypes: RegexLike[]) => boolean;
84
+ defaultLLMDeliveryPath?: TDefaultLLMDeliveryPathConfig;
85
+ legacyFileUploadUX?: boolean;
74
86
  };
75
87
  export type FileConfigInput = {
76
88
  endpoints?: {
@@ -81,6 +93,8 @@ export type FileConfigInput = {
81
93
  };
82
94
  serverFileSizeLimit?: number;
83
95
  avatarSizeLimit?: number;
96
+ fileContextSizeLimit?: number;
97
+ fileContextCharLimit?: number;
84
98
  clientImageResize?: {
85
99
  enabled?: boolean;
86
100
  maxWidth?: number;
@@ -97,6 +111,20 @@ export type FileConfigInput = {
97
111
  supportedMimeTypes?: string[];
98
112
  };
99
113
  checkType?: (fileType: string, supportedTypes: RegexLike[]) => boolean;
114
+ defaultLLMDeliveryPath?: TDefaultLLMDeliveryPathConfig;
115
+ legacyFileUploadUX?: boolean;
116
+ };
117
+ /** The immutable origin of a file explicitly published from an agent execution. */
118
+ export type RunFileProvenance = {
119
+ runId: string;
120
+ executionId: string;
121
+ agentId: string;
122
+ parentExecutionId?: string;
123
+ parentAgentId?: string;
124
+ recipientAgentIds?: string[];
125
+ sourceFileId: string;
126
+ publishedAt: string;
127
+ inputFileIds: string[];
100
128
  };
101
129
  export type TFile = {
102
130
  _id?: string;
@@ -148,6 +176,7 @@ export type TFile = {
148
176
  */
149
177
  previewError?: string;
150
178
  metadata?: {
179
+ runFile?: RunFileProvenance;
151
180
  fileIdentifier?: string;
152
181
  /**
153
182
  * Structured form of `fileIdentifier`. Persisted alongside the
@@ -155,7 +184,17 @@ export type TFile = {
155
184
  * resolve via `resolveCodeEnvRef`.
156
185
  */
157
186
  codeEnvRef?: CodeEnvRef;
187
+ codeEnvRefs?: CodeEnvRefMap;
188
+ /** Dispatch-order stamp for the current source artifact generation. */
189
+ sourceDispatchedAt?: number;
190
+ /** Vector namespaces this file has been embedded into. */
191
+ embeddedEntities?: string[];
192
+ /** The user named this destination, so absent ones were declined. */
193
+ destinationChosen?: boolean;
194
+ /** The type the delivery route was resolved against, when conversion changed it. */
195
+ routingMimeType?: string;
158
196
  };
197
+ llmDeliveryPath?: 'provider' | 'text' | 'none';
159
198
  createdAt?: string | Date;
160
199
  updatedAt?: string | Date;
161
200
  };
@@ -230,7 +269,9 @@ export type TFilesUsageResponse = {
230
269
  };
231
270
  export type DeleteFilesResponse = {
232
271
  message: string;
233
- result: Record<string, unknown>;
272
+ result?: Record<string, unknown>;
273
+ deletedFileIds?: string[];
274
+ failedFileIds?: string[];
234
275
  };
235
276
  export type BatchFile = {
236
277
  file_id: string;
@@ -251,4 +292,7 @@ export type DeleteMutationOptions = {
251
292
  onSuccess?: (data: DeleteFilesResponse, variables: DeleteFilesBody, context?: unknown) => void;
252
293
  onMutate?: (variables: DeleteFilesBody) => void | Promise<unknown>;
253
294
  onError?: (error: unknown, variables: DeleteFilesBody, context?: unknown) => void;
295
+ /** Suppresses the result toasts. Background cleanup runs on a timer the user never asked for,
296
+ * and a storage failure that keeps failing would otherwise announce itself on every retry. */
297
+ silent?: boolean;
254
298
  };
@@ -1,2 +1,4 @@
1
1
  export * from './queries';
2
2
  export * from './mcpServers';
3
+ export * from './subagents';
4
+ export * from './queuedTurns';
@@ -0,0 +1,71 @@
1
+ export type InsightsRange = '24h' | '7d' | '30d' | 'custom';
2
+ export declare const INSIGHTS_MAX_RANGE_DAYS = 30;
3
+ export declare const INSIGHTS_SEARCH_MIN_LENGTH = 3;
4
+ export declare const INSIGHTS_SEARCH_MAX_LENGTH = 200;
5
+ export declare const INSIGHTS_AGENT_ID_MAX_LENGTH = 256;
6
+ export type TInsightsParams = {
7
+ range?: InsightsRange;
8
+ fromTimestamp?: string;
9
+ toTimestamp?: string;
10
+ timeZone?: string;
11
+ search?: string;
12
+ agentIds?: string[];
13
+ page?: number;
14
+ pageSize?: number;
15
+ };
16
+ export type TInsightsAgent = {
17
+ id: string;
18
+ name: string;
19
+ };
20
+ export type TInsightsDailyPoint = {
21
+ date: string;
22
+ conversations: number;
23
+ users: number;
24
+ messages: number;
25
+ totalTokens: number;
26
+ };
27
+ export type TInsightsUser = {
28
+ userId: string;
29
+ name: string;
30
+ email: string;
31
+ conversations: number;
32
+ messages: number;
33
+ };
34
+ export type TInsightsChurnedUser = TInsightsUser & {
35
+ firstSeen: string;
36
+ lastSeen: string;
37
+ };
38
+ export type TInsightsConversation = {
39
+ conversationId: string;
40
+ agentId: string;
41
+ agentName: string;
42
+ date: string;
43
+ userId: string;
44
+ name: string;
45
+ email: string;
46
+ firstMessage: string;
47
+ messages: number;
48
+ totalTokens: number;
49
+ };
50
+ export type TInsightsSummary = {
51
+ totalUsers: number;
52
+ totalConversations: number;
53
+ totalMessages: number;
54
+ totalTokens: number;
55
+ };
56
+ export type TInsightsResponse = {
57
+ agents: TInsightsAgent[];
58
+ summary: TInsightsSummary;
59
+ daily: TInsightsDailyPoint[];
60
+ topUsers: TInsightsUser[];
61
+ churnedUsers: TInsightsChurnedUser[];
62
+ latest: {
63
+ conversations: TInsightsConversation[];
64
+ page: number;
65
+ pageSize: number;
66
+ pages: number;
67
+ };
68
+ };
69
+ export type TInsightsAccessResponse = {
70
+ access: boolean;
71
+ };