librechat-data-provider 0.8.501 → 0.8.503

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 (38) hide show
  1. package/dist/index.es.js +1 -1
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/react-query/index.es.js +1 -1
  6. package/dist/react-query/index.es.js.map +1 -1
  7. package/dist/types/accessPermissions.d.ts +6 -2
  8. package/dist/types/api-endpoints.d.ts +20 -1
  9. package/dist/types/balance.d.ts +3 -0
  10. package/dist/types/balance.spec.d.ts +1 -0
  11. package/dist/types/bedrock.d.ts +9 -1
  12. package/dist/types/cloudfront-config.spec.d.ts +1 -0
  13. package/dist/types/codeEnvRef.d.ts +62 -0
  14. package/dist/types/codeEnvRef.spec.d.ts +1 -0
  15. package/dist/types/config.d.ts +2278 -131
  16. package/dist/types/data-service.d.ts +69 -2
  17. package/dist/types/file-config.d.ts +16 -0
  18. package/dist/types/generate.d.ts +2 -0
  19. package/dist/types/headers-helpers.d.ts +1 -0
  20. package/dist/types/index.d.ts +3 -0
  21. package/dist/types/keys.d.ts +16 -2
  22. package/dist/types/mcp.d.ts +1304 -58
  23. package/dist/types/models.d.ts +50 -8
  24. package/dist/types/parameterSettings.d.ts +6 -0
  25. package/dist/types/parameterSettings.spec.d.ts +1 -0
  26. package/dist/types/parsers.d.ts +2 -1
  27. package/dist/types/permissions.d.ts +50 -1
  28. package/dist/types/roles.d.ts +52 -0
  29. package/dist/types/schemas.d.ts +477 -14
  30. package/dist/types/types/assistants.d.ts +25 -3
  31. package/dist/types/types/files.d.ts +71 -0
  32. package/dist/types/types/mutations.d.ts +46 -0
  33. package/dist/types/types/queries.d.ts +2 -0
  34. package/dist/types/types/runs.d.ts +20 -1
  35. package/dist/types/types/skills.d.ts +275 -0
  36. package/dist/types/types/web.d.ts +14 -1
  37. package/dist/types/types.d.ts +65 -5
  38. package/package.json +2 -2
@@ -24,7 +24,10 @@ export declare enum Tools {
24
24
  retrieval = "retrieval",
25
25
  function = "function",
26
26
  memory = "memory",
27
- ui_resources = "ui_resources"
27
+ ui_resources = "ui_resources",
28
+ skill = "skill",
29
+ read_file = "read_file",
30
+ bash_tool = "bash_tool"
28
31
  }
29
32
  export declare enum EToolResources {
30
33
  code_interpreter = "code_interpreter",
@@ -214,6 +217,18 @@ export type ToolOptions = {
214
217
  * Used to customize tool behavior per agent.
215
218
  */
216
219
  export type AgentToolOptions = Record<string, ToolOptions>;
220
+ /**
221
+ * Configuration for spawning subagents (isolated-context child agents) from an agent.
222
+ * When `enabled` is true, the agent gets a subagent-spawn tool that can delegate work
223
+ * to either itself (when `allowSelf` is true) and/or the listed `agent_ids`.
224
+ */
225
+ export type AgentSubagentsConfig = {
226
+ enabled?: boolean;
227
+ /** When true (default), the agent may spawn itself in an isolated context. */
228
+ allowSelf?: boolean;
229
+ /** Specific agents that may be spawned as subagents. */
230
+ agent_ids?: string[];
231
+ };
217
232
  export type Agent = {
218
233
  _id?: string;
219
234
  id: string;
@@ -248,6 +263,13 @@ export type Agent = {
248
263
  support_contact?: SupportContact;
249
264
  /** Per-tool configuration options (deferred loading, allowed callers, etc.) */
250
265
  tool_options?: AgentToolOptions;
266
+ /** Optional allowlist of skill ObjectIds. Only applies when `skills_enabled`. */
267
+ skills?: string[];
268
+ /** Master toggle for skill use on this agent. `true` = active (full catalog unless
269
+ * `skills` narrows it). `false`/undefined = inactive (no skills available). */
270
+ skills_enabled?: boolean;
271
+ /** Subagent spawning configuration — isolated-context child agents. */
272
+ subagents?: AgentSubagentsConfig;
251
273
  };
252
274
  export type TAgentsMap = Record<string, Agent | undefined>;
253
275
  export type AgentCreateParams = {
@@ -260,7 +282,7 @@ export type AgentCreateParams = {
260
282
  provider: AgentProvider;
261
283
  model: string | null;
262
284
  model_parameters: AgentModelParameters;
263
- } & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options'>;
285
+ } & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options' | 'skills' | 'skills_enabled' | 'subagents'>;
264
286
  export type AgentUpdateParams = {
265
287
  name?: string | null;
266
288
  description?: string | null;
@@ -272,7 +294,7 @@ export type AgentUpdateParams = {
272
294
  provider?: AgentProvider;
273
295
  model?: string | null;
274
296
  model_parameters?: AgentModelParameters;
275
- } & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options'>;
297
+ } & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options' | 'skills' | 'skills_enabled' | 'subagents'>;
276
298
  export type AgentListParams = {
277
299
  limit?: number;
278
300
  requiredPermission: number;
@@ -1,4 +1,5 @@
1
1
  import { EToolResources } from './assistants';
2
+ import type { CodeEnvRef } from '../codeEnvRef';
2
3
  export declare enum FileSources {
3
4
  local = "local",
4
5
  firebase = "firebase",
@@ -6,6 +7,7 @@ export declare enum FileSources {
6
7
  azure_blob = "azure_blob",
7
8
  openai = "openai",
8
9
  s3 = "s3",
10
+ cloudfront = "cloudfront",
9
11
  vectordb = "vectordb",
10
12
  execute_code = "execute_code",
11
13
  mistral_ocr = "mistral_ocr",
@@ -24,6 +26,7 @@ export declare enum FileContext {
24
26
  image_generation = "image_generation",
25
27
  assistants_output = "assistants_output",
26
28
  message_attachment = "message_attachment",
29
+ skill_file = "skill_file",
27
30
  filename = "filename",
28
31
  updatedAt = "updatedAt",
29
32
  source = "source",
@@ -42,6 +45,9 @@ export type FileConfig = {
42
45
  endpoints: {
43
46
  [key: string]: EndpointFileConfig;
44
47
  };
48
+ skills?: {
49
+ fileSizeLimit?: number;
50
+ };
45
51
  fileTokenLimit?: number;
46
52
  serverFileSizeLimit?: number;
47
53
  avatarSizeLimit?: number;
@@ -66,6 +72,9 @@ export type FileConfigInput = {
66
72
  endpoints?: {
67
73
  [key: string]: EndpointFileConfig;
68
74
  };
75
+ skills?: {
76
+ fileSizeLimit?: number;
77
+ };
69
78
  serverFileSizeLimit?: number;
70
79
  avatarSizeLimit?: number;
71
80
  clientImageResize?: {
@@ -89,6 +98,9 @@ export type TFile = {
89
98
  _id?: string;
90
99
  __v?: number;
91
100
  user: string;
101
+ tenantId?: string;
102
+ storageRegion?: string;
103
+ storageKey?: string;
92
104
  conversationId?: string;
93
105
  message?: string;
94
106
  file_id: string;
@@ -107,8 +119,38 @@ export type TFile = {
107
119
  height?: number;
108
120
  expiresAt?: string | Date;
109
121
  preview?: string;
122
+ text?: string;
123
+ /**
124
+ * Format of the `text` field. `'html'` means the backend produced
125
+ * a sanitized full-document HTML preview the client may inject as
126
+ * `index.html` inside the office artifact iframe. `'text'` (or
127
+ * `undefined` for legacy records) is plain text and MUST NOT be
128
+ * injected as HTML — render through the markdown/escaping path.
129
+ * See Codex P1 review on PR #12934.
130
+ */
131
+ textFormat?: 'html' | 'text' | null;
132
+ /**
133
+ * Lifecycle of the inline preview rendered from `text`. `'pending'`
134
+ * while background HTML extraction is in flight (deferred-preview
135
+ * code-execution flow), `'ready'` once `text`/`textFormat` are set,
136
+ * `'failed'` if extraction errored or hit the 60s ceiling. `undefined`
137
+ * for legacy records and for files that never expect a preview —
138
+ * clients MUST treat that as `'ready'`.
139
+ */
140
+ status?: 'pending' | 'ready' | 'failed';
141
+ /**
142
+ * Short machine-readable failure reason when `status === 'failed'`.
143
+ * Suitable for tooltip text but not user-facing prose.
144
+ */
145
+ previewError?: string;
110
146
  metadata?: {
111
147
  fileIdentifier?: string;
148
+ /**
149
+ * Structured form of `fileIdentifier`. Persisted alongside the
150
+ * legacy string during the dual-write transition; readers should
151
+ * resolve via `resolveCodeEnvRef`.
152
+ */
153
+ codeEnvRef?: CodeEnvRef;
112
154
  };
113
155
  createdAt?: string | Date;
114
156
  updatedAt?: string | Date;
@@ -116,9 +158,36 @@ export type TFile = {
116
158
  export type TFileUpload = TFile & {
117
159
  temp_file_id: string;
118
160
  };
161
+ /**
162
+ * Shape returned by `GET /api/files/:file_id/preview`. The deferred-
163
+ * preview code-execution flow polls this until status is terminal:
164
+ * - `pending`: HTML extraction is still running. No `text`.
165
+ * - `ready`: extraction succeeded; `text` + `textFormat` populated
166
+ * iff the file produced inline preview content (binary/oversized
167
+ * files reach `ready` with no text — render download-only).
168
+ * - `failed`: extraction errored or hit the 60s ceiling;
169
+ * `previewError` carries the short reason (`timeout`,
170
+ * `parser-error`, `orphaned`, etc.).
171
+ *
172
+ * Legacy records pre-dating the field are surfaced as `'ready'` server-
173
+ * side so existing attachments keep rendering normally.
174
+ */
175
+ export type TFilePreview = {
176
+ file_id: string;
177
+ status: 'pending' | 'ready' | 'failed';
178
+ text?: string;
179
+ textFormat?: 'html' | 'text' | null;
180
+ previewError?: string;
181
+ };
119
182
  export type AvatarUploadResponse = {
120
183
  url: string;
121
184
  };
185
+ export type FileDownloadURLResponse = {
186
+ url: string;
187
+ filename: string;
188
+ type: string;
189
+ metadata: Partial<TFile>;
190
+ };
122
191
  export type SpeechToTextResponse = {
123
192
  text: string;
124
193
  };
@@ -155,6 +224,8 @@ export type DeleteFilesResponse = {
155
224
  export type BatchFile = {
156
225
  file_id: string;
157
226
  filepath: string;
227
+ storageRegion?: string;
228
+ storageKey?: string;
158
229
  embedded: boolean;
159
230
  source: FileSources;
160
231
  temp_file_id?: string;
@@ -3,6 +3,8 @@ import * as r from '../roles';
3
3
  import * as p from '../permissions';
4
4
  import { Tools, Assistant, AssistantCreateParams, AssistantUpdateParams, FunctionTool, AssistantDocument, Agent, AgentCreateParams, AgentUpdateParams } from './assistants';
5
5
  import { Action, ActionMetadata } from './agents';
6
+ import type { InfiniteData, QueryKey } from '@tanstack/react-query';
7
+ import type { TSkill, TSkillFile, TCreateSkill, TUpdateSkillVariables, TUpdateSkillResponse, TDeleteSkillResponse, TUploadSkillFileVariables, TDeleteSkillFileVariables, TDeleteSkillFileResponse, TSkillListResponse } from './skills';
6
8
  export type MutationOptions<Response, Request, Context = unknown, Error = unknown, Snapshot = void> = {
7
9
  onSuccess?: (data: Response, variables: Request, context?: Context) => void;
8
10
  onMutate?: (variables: Request) => Snapshot | Promise<Snapshot>;
@@ -143,16 +145,59 @@ export type UpdateMemoryPermVars = UpdatePermVars<p.TMemoryPermissions>;
143
145
  export type UpdateAgentPermVars = UpdatePermVars<p.TAgentPermissions>;
144
146
  export type UpdatePeoplePickerPermVars = UpdatePermVars<p.TPeoplePickerPermissions>;
145
147
  export type UpdateMCPServersPermVars = UpdatePermVars<p.TMcpServersPermissions>;
148
+ export type UpdateSkillPermVars = UpdatePermVars<p.TSkillPermissions>;
146
149
  export type UpdatePermResponse = r.TRole;
150
+ /**
151
+ * Cache entries that can appear under the `[QueryKeys.skills, ...]` key prefix.
152
+ * Flat responses come from `useListSkillsQuery`; infinite responses come from
153
+ * `useSkillsInfiniteQuery`. The context carries both shapes for rollback.
154
+ */
155
+ export type TSkillCacheEntry = TSkillListResponse | InfiniteData<TSkillListResponse> | undefined;
156
+ export type TUpdateSkillContext = {
157
+ previousSkill?: TSkill;
158
+ previousListSnapshots?: Array<[QueryKey, TSkillCacheEntry]>;
159
+ userContext?: unknown;
160
+ } | undefined;
161
+ export type ImportSkillOptions = MutationOptions<TSkill, FormData>;
162
+ export type CreateSkillOptions = MutationOptions<TSkill, TCreateSkill>;
163
+ export type UpdateSkillOptions = MutationOptions<TUpdateSkillResponse, TUpdateSkillVariables, TUpdateSkillContext>;
164
+ export type DeleteSkillOptions = MutationOptions<TDeleteSkillResponse, {
165
+ id: string;
166
+ }>;
167
+ export type UploadSkillFileOptions = MutationOptions<TSkillFile, TUploadSkillFileVariables>;
168
+ export type DeleteSkillFileOptions = MutationOptions<TDeleteSkillFileResponse, TDeleteSkillFileVariables>;
147
169
  export type UpdatePromptPermOptions = MutationOptions<UpdatePermResponse, UpdatePromptPermVars, unknown, types.TError | null | undefined>;
148
170
  export type UpdateMemoryPermOptions = MutationOptions<UpdatePermResponse, UpdateMemoryPermVars, unknown, types.TError | null | undefined>;
149
171
  export type UpdateAgentPermOptions = MutationOptions<UpdatePermResponse, UpdateAgentPermVars, unknown, types.TError | null | undefined>;
150
172
  export type UpdatePeoplePickerPermOptions = MutationOptions<UpdatePermResponse, UpdatePeoplePickerPermVars, unknown, types.TError | null | undefined>;
151
173
  export type UpdateMCPServersPermOptions = MutationOptions<UpdatePermResponse, UpdateMCPServersPermVars, unknown, types.TError | null | undefined>;
174
+ export type UpdateSkillPermOptions = MutationOptions<UpdatePermResponse, UpdateSkillPermVars, unknown, types.TError | null | undefined>;
152
175
  export type UpdateRemoteAgentsPermVars = UpdatePermVars<p.TRemoteAgentsPermissions>;
153
176
  export type UpdateRemoteAgentsPermOptions = MutationOptions<UpdatePermResponse, UpdateRemoteAgentsPermVars, unknown, types.TError | null | undefined>;
154
177
  export type UpdateMarketplacePermVars = UpdatePermVars<p.TMarketplacePermissions>;
155
178
  export type UpdateMarketplacePermOptions = MutationOptions<UpdatePermResponse, UpdateMarketplacePermVars, unknown, types.TError | null | undefined>;
179
+ export type CreateSkillNodeBody = {
180
+ skillId: string;
181
+ data: FormData | types.TCreateSkillNodeRequest;
182
+ };
183
+ export type CreateSkillNodeOptions = MutationOptions<types.TSkillNode, CreateSkillNodeBody>;
184
+ export type UpdateSkillNodeVariables = {
185
+ skillId: string;
186
+ nodeId: string;
187
+ data: types.TUpdateSkillNodeRequest;
188
+ };
189
+ export type UpdateSkillNodeOptions = MutationOptions<types.TSkillNode, UpdateSkillNodeVariables>;
190
+ export type DeleteSkillNodeBody = {
191
+ skillId: string;
192
+ nodeId: string;
193
+ };
194
+ export type DeleteSkillNodeOptions = MutationOptions<void, DeleteSkillNodeBody>;
195
+ export type UpdateSkillNodeContentVariables = {
196
+ skillId: string;
197
+ nodeId: string;
198
+ content: string;
199
+ };
200
+ export type UpdateSkillNodeContentOptions = MutationOptions<types.TSkillNode, UpdateSkillNodeContentVariables>;
156
201
  export type UpdateConversationTagOptions = MutationOptions<types.TConversationTag, types.TConversationTagRequest>;
157
202
  export type DeleteConversationTagOptions = MutationOptions<types.TConversationTag, string>;
158
203
  export type AcceptTermsMutationOptions = MutationOptions<types.TAcceptTermsResponse, void, unknown, void>;
@@ -169,6 +214,7 @@ export type ToolParams<T extends ToolId> = ToolParamsMap[T] & {
169
214
  partIndex?: number;
170
215
  blockIndex?: number;
171
216
  conversationId: string;
217
+ isTemporary?: boolean;
172
218
  };
173
219
  export type ToolCallResponse = {
174
220
  result: unknown;
@@ -178,6 +178,8 @@ export type TUserFavorite = {
178
178
  model?: string;
179
179
  endpoint?: string;
180
180
  spec?: string;
181
+ /** Phase 2 — skill favoriting isn't persisted yet, but the shape is reserved. */
182
+ skillId?: string;
181
183
  };
182
184
  export type GraphTokenParams = {
183
185
  scopes: string;
@@ -32,5 +32,24 @@ export declare enum StepEvents {
32
32
  ON_RUN_STEP_COMPLETED = "on_run_step_completed",
33
33
  ON_SUMMARIZE_START = "on_summarize_start",
34
34
  ON_SUMMARIZE_DELTA = "on_summarize_delta",
35
- ON_SUMMARIZE_COMPLETE = "on_summarize_complete"
35
+ ON_SUMMARIZE_COMPLETE = "on_summarize_complete",
36
+ ON_SUBAGENT_UPDATE = "on_subagent_update"
37
+ }
38
+ /** Lifecycle phase carried on subagent-progress envelopes (mirrors SDK SubagentUpdatePhase). */
39
+ export type SubagentUpdatePhase = 'start' | 'run_step' | 'run_step_delta' | 'run_step_completed' | 'message_delta' | 'reasoning_delta' | 'stop' | 'error';
40
+ /** Single streamed subagent update forwarded by the SDK's SubagentExecutor. */
41
+ export interface SubagentUpdateEvent {
42
+ runId: string;
43
+ subagentRunId: string;
44
+ /** Parent-side `tool_call_id` for the `subagent` tool invocation that
45
+ * triggered this run. Surfaces from the SDK (`3.1.67-dev.2`+) so hosts
46
+ * can correlate child progress to the parent tool call deterministically. */
47
+ parentToolCallId?: string;
48
+ subagentType: string;
49
+ subagentAgentId: string;
50
+ parentAgentId?: string;
51
+ phase: SubagentUpdatePhase;
52
+ data?: unknown;
53
+ label?: string;
54
+ timestamp: string;
36
55
  }
@@ -0,0 +1,275 @@
1
+ import type { FileSources } from './files';
2
+ /**
3
+ * Shared skill validation constants — the single source of truth for name,
4
+ * description, title, body, and file-path length limits. Mirrored by
5
+ * `packages/data-schemas/src/methods/skill.ts`; whenever those constants
6
+ * change, the DB-side validators MUST be updated to match.
7
+ *
8
+ * Exported from `librechat-data-provider` so both frontend form validators
9
+ * and backend Mongoose pre-save hooks use the same literals.
10
+ */
11
+ export declare const SKILL_NAME_MAX_LENGTH = 64;
12
+ export declare const SKILL_DESCRIPTION_MAX_LENGTH = 1024;
13
+ export declare const SKILL_DESCRIPTION_SHORT_THRESHOLD = 20;
14
+ export declare const SKILL_DISPLAY_TITLE_MAX_LENGTH = 128;
15
+ export declare const SKILL_BODY_MAX_LENGTH = 100000;
16
+ /**
17
+ * Kebab-case identifier pattern: must start with a lowercase letter or digit,
18
+ * and contain only lowercase letters, digits, and hyphens. Mirrors the
19
+ * backend `SKILL_NAME_PATTERN` in `packages/data-schemas/src/methods/skill.ts`.
20
+ */
21
+ export declare const SKILL_NAME_PATTERN: RegExp;
22
+ /**
23
+ * Source of a skill — where its canonical definition came from.
24
+ * `inline` means the skill was authored directly in LibreChat.
25
+ * `github` / `notion` are reserved for future sync integrations.
26
+ */
27
+ export type SkillSource = 'inline' | 'github' | 'notion';
28
+ /**
29
+ * Category inferred from a skill file's top-level directory prefix.
30
+ * `script` for `scripts/...`, `reference` for `references/...`, `asset` for `assets/...`,
31
+ * everything else (including root-level files) is `other`.
32
+ */
33
+ export type SkillFileCategory = 'script' | 'reference' | 'asset' | 'other';
34
+ /**
35
+ * Allowed value types inside a skill's YAML frontmatter.
36
+ * Kept strict so callers cannot slip arbitrary `unknown` payloads through the API.
37
+ */
38
+ export type SkillFrontmatterValue = string | number | boolean | string[] | null;
39
+ /**
40
+ * Structured YAML frontmatter for a skill. All keys are optional on the wire
41
+ * because not every skill document carries a complete frontmatter block —
42
+ * `name` and `description` live as first-class columns on `TSkill` itself,
43
+ * and frontmatter is an extension bag for additional fields like `when-to-use`,
44
+ * `allowed-tools`, etc.
45
+ */
46
+ export type SkillFrontmatter = {
47
+ name?: string;
48
+ description?: string;
49
+ } & Record<string, SkillFrontmatterValue | undefined>;
50
+ /**
51
+ * Provenance metadata for skills that originated from an external source
52
+ * (e.g. a GitHub commit SHA or a Notion page id).
53
+ *
54
+ * Reserved for phase 2+ external sync — no code path currently populates this
55
+ * in phase 1, but the column exists so a future sync worker can use it
56
+ * without a schema migration.
57
+ */
58
+ export type SkillSourceMetadata = Record<string, string | number | boolean>;
59
+ /**
60
+ * A non-blocking coaching hint surfaced alongside a successful create/update
61
+ * response. Unlike validation errors (which return 400 and block the write),
62
+ * warnings ride on the 2xx response so the UI can show inline feedback
63
+ * without rejecting the user's input. Example: "description is too short,
64
+ * Claude may undertrigger this skill".
65
+ */
66
+ export type TSkillWarning = {
67
+ field: string;
68
+ code: string;
69
+ message: string;
70
+ severity: 'warning';
71
+ };
72
+ /**
73
+ * API shape for a full skill (returned by GET `/api/skills/:id`).
74
+ *
75
+ * Field semantics:
76
+ * - `name` is the machine-readable kebab-case identifier Claude sees in its
77
+ * skill manifest. It's what drives triggering and must be stable across
78
+ * edits. Unique per author+tenant.
79
+ * - `displayTitle` is the human-readable UI label only. NOT sent to Claude,
80
+ * NOT part of the trigger path — purely cosmetic.
81
+ * - `description` is the "when to use this skill" sentence. Highest-leverage
82
+ * field for trigger accuracy; a short/vague one causes undertriggering.
83
+ * - `frontmatter` is the structured YAML bag minus `name`/`description`
84
+ * (those live as top-level columns). Validated strictly against a known
85
+ * key set server-side.
86
+ * - `source`/`sourceMetadata` are reserved for phase 2+ external sync and
87
+ * always `'inline'` / absent in phase 1.
88
+ */
89
+ export type TSkill = {
90
+ _id: string;
91
+ name: string;
92
+ displayTitle?: string;
93
+ description: string;
94
+ body: string;
95
+ frontmatter?: SkillFrontmatter;
96
+ category?: string;
97
+ /**
98
+ * @deprecated Replaced by the persisted `userInvocable` /
99
+ * `disableModelInvocation` pair derived from frontmatter. Retained
100
+ * temporarily so older form code that hasn't migrated still type-checks;
101
+ * the backend no longer reads or writes it.
102
+ */
103
+ invocationMode?: import('../types').InvocationMode;
104
+ /**
105
+ * Mirrors the `disable-model-invocation` frontmatter field. `true` means
106
+ * the model can no longer invoke this skill via the `skill` tool and the
107
+ * skill is excluded from the catalog injected into the system prompt.
108
+ * Manual `$` invocation is unaffected.
109
+ */
110
+ disableModelInvocation?: boolean;
111
+ /**
112
+ * Mirrors the `user-invocable` frontmatter field. `false` hides the skill
113
+ * from the `$` popover and rejects manual invocation. Defaults to `true`.
114
+ */
115
+ userInvocable?: boolean;
116
+ /**
117
+ * Skill-declared tool allowlist (mirrors the `allowed-tools` frontmatter
118
+ * field). When the skill is invoked, these tools are unioned into the
119
+ * agent's effective tool set for the turn. Tolerant of unknown names —
120
+ * the runtime intersects against the loaded tool registry, so skills
121
+ * referencing yet-to-be-implemented tools import without breaking.
122
+ */
123
+ allowedTools?: string[];
124
+ author: string;
125
+ authorName: string;
126
+ version: number;
127
+ source: SkillSource;
128
+ sourceMetadata?: SkillSourceMetadata;
129
+ fileCount: number;
130
+ /**
131
+ * When `true`, the skill auto-primes into every turn — no user `$` picks
132
+ * or model discretion required. Surfaced on the list view so the UI can
133
+ * show a pin badge on rows that apply ambiently.
134
+ */
135
+ alwaysApply?: boolean;
136
+ isPublic?: boolean;
137
+ tenantId?: string;
138
+ createdAt: string;
139
+ updatedAt: string;
140
+ /**
141
+ * Present on POST/PATCH responses when the server emitted non-blocking
142
+ * coaching warnings (e.g. description too short). Never present on GET
143
+ * responses.
144
+ */
145
+ warnings?: TSkillWarning[];
146
+ };
147
+ /**
148
+ * Summary shape used in list endpoints — omits `body` and `frontmatter` to keep
149
+ * list payloads small. Callers that need the full body/frontmatter must fetch
150
+ * the detail via `GET /api/skills/:id`.
151
+ */
152
+ export type TSkillSummary = Omit<TSkill, 'body' | 'frontmatter'>;
153
+ /**
154
+ * Metadata for a single file bundled inside a skill.
155
+ * File content itself is fetched separately via the file download endpoint.
156
+ */
157
+ export type TSkillFile = {
158
+ _id: string;
159
+ skillId: string;
160
+ relativePath: string;
161
+ file_id: string;
162
+ filename: string;
163
+ filepath: string;
164
+ storageKey?: string;
165
+ storageRegion?: string;
166
+ source: FileSources;
167
+ mimeType: string;
168
+ bytes: number;
169
+ category: SkillFileCategory;
170
+ isExecutable: boolean;
171
+ author: string;
172
+ tenantId?: string;
173
+ /** Lazily cached text content (≤ 512 KB). Excluded from list responses. */
174
+ content?: string;
175
+ /** Set on first read. `true` prevents repeated storage reads for non-text files. */
176
+ isBinary?: boolean;
177
+ createdAt: string;
178
+ updatedAt: string;
179
+ };
180
+ /** Request body for POST `/api/skills`. */
181
+ export type TCreateSkill = {
182
+ name: string;
183
+ displayTitle?: string;
184
+ description: string;
185
+ body: string;
186
+ frontmatter?: Partial<SkillFrontmatter>;
187
+ category?: string;
188
+ /** When `true`, the skill auto-primes into every turn (mirrors `always-apply` frontmatter). */
189
+ alwaysApply?: boolean;
190
+ };
191
+ /** Partial payload for PATCH `/api/skills/:id` — all fields optional. */
192
+ export type TUpdateSkillPayload = {
193
+ name?: string;
194
+ displayTitle?: string;
195
+ description?: string;
196
+ body?: string;
197
+ frontmatter?: Partial<SkillFrontmatter>;
198
+ category?: string;
199
+ alwaysApply?: boolean;
200
+ };
201
+ /** Variables passed into the update mutation: id + expectedVersion + partial payload. */
202
+ export type TUpdateSkillVariables = {
203
+ id: string;
204
+ expectedVersion: number;
205
+ payload: TUpdateSkillPayload;
206
+ };
207
+ /** Response from a successful PATCH — includes the bumped version. */
208
+ export type TUpdateSkillResponse = TSkill;
209
+ /** Response from a 409 concurrency conflict — includes the current authoritative state. */
210
+ export type TSkillConflictResponse = {
211
+ error: 'skill_version_conflict';
212
+ current: TSkill;
213
+ };
214
+ /** Query params for GET `/api/skills` (list). */
215
+ export type TSkillListRequest = {
216
+ category?: string;
217
+ search?: string;
218
+ limit?: number;
219
+ cursor?: string;
220
+ };
221
+ /** Paginated list response. `after` is the cursor to pass for the next page. */
222
+ export type TSkillListResponse = {
223
+ skills: TSkillSummary[];
224
+ has_more: boolean;
225
+ after: string | null;
226
+ };
227
+ /** Response from DELETE `/api/skills/:id`. */
228
+ export type TDeleteSkillResponse = {
229
+ id: string;
230
+ deleted: true;
231
+ };
232
+ /** Response from GET `/api/skills/:id/files`. */
233
+ export type TListSkillFilesResponse = {
234
+ files: TSkillFile[];
235
+ };
236
+ /**
237
+ * Upload body for POST `/api/skills/:id/files`.
238
+ * In phase 1 the backend responds with 501; the client contract is still defined here
239
+ * so hooks are stable when the upload pipeline is wired up in phase 2.
240
+ */
241
+ export type TUploadSkillFilePayload = {
242
+ relativePath: string;
243
+ };
244
+ /** Response from DELETE `/api/skills/:id/files/:relativePath`. */
245
+ export type TDeleteSkillFileResponse = {
246
+ skillId: string;
247
+ relativePath: string;
248
+ deleted: true;
249
+ };
250
+ /** Response from GET `/api/skills/:id/files/:relativePath` (JSON mode). */
251
+ export type TSkillFileContentResponse = {
252
+ content?: string;
253
+ mimeType: string;
254
+ isBinary: boolean;
255
+ relativePath: string;
256
+ filename: string;
257
+ bytes: number;
258
+ };
259
+ /** Variables passed into the skill file upload mutation. */
260
+ export type TUploadSkillFileVariables = {
261
+ skillId: string;
262
+ formData: FormData;
263
+ };
264
+ /** Variables passed into the skill file delete mutation. */
265
+ export type TDeleteSkillFileVariables = {
266
+ skillId: string;
267
+ relativePath: string;
268
+ };
269
+ /**
270
+ * Per-user skill active/inactive overrides (GET response and POST body payload).
271
+ * Key = skill ObjectId string, value = explicit active state.
272
+ * Skills absent from the map use the ownership-based default:
273
+ * owned = active, shared = `defaultActiveOnShare` from config.
274
+ */
275
+ export type TSkillStatesResponse = Record<string, boolean>;
@@ -1,4 +1,6 @@
1
1
  import type { Logger as WinstonLogger } from 'winston';
2
+ import type { z } from 'zod';
3
+ import type { webSearchSchema } from '../config';
2
4
  export type SearchRefType = 'search' | 'image' | 'news' | 'video' | 'ref';
3
5
  export declare enum DATE_RANGE {
4
6
  PAST_HOUR = "h",
@@ -7,7 +9,8 @@ export declare enum DATE_RANGE {
7
9
  PAST_MONTH = "m",
8
10
  PAST_YEAR = "y"
9
11
  }
10
- export type SearchProvider = 'serper' | 'searxng';
12
+ export type SearchProvider = 'serper' | 'searxng' | 'tavily';
13
+ export type ScraperProvider = 'firecrawl' | 'serper' | 'tavily';
11
14
  export type RerankerType = 'infinity' | 'jina' | 'cohere' | 'none';
12
15
  export interface Highlight {
13
16
  score: number;
@@ -65,6 +68,9 @@ export interface SearchConfig {
65
68
  serperApiKey?: string;
66
69
  searxngInstanceUrl?: string;
67
70
  searxngApiKey?: string;
71
+ tavilyApiKey?: string;
72
+ tavilySearchUrl?: string;
73
+ tavilySearchOptions?: TavilyConfig['tavilySearchOptions'];
68
74
  }
69
75
  export type References = {
70
76
  links: MediaReference[];
@@ -117,6 +123,13 @@ export interface FirecrawlConfig {
117
123
  };
118
124
  };
119
125
  }
126
+ export interface TavilyConfig {
127
+ tavilyApiKey?: string;
128
+ tavilySearchUrl?: string;
129
+ tavilyExtractUrl?: string;
130
+ tavilySearchOptions?: z.infer<typeof webSearchSchema>['tavilySearchOptions'];
131
+ tavilyScraperOptions?: z.infer<typeof webSearchSchema>['tavilyScraperOptions'];
132
+ }
120
133
  export interface ScraperContentResult {
121
134
  content: string;
122
135
  }