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
@@ -33,11 +33,14 @@ export declare enum StepEvents {
33
33
  ON_REASONING_DELTA = "on_reasoning_delta",
34
34
  ON_RUN_STEP_DELTA = "on_run_step_delta",
35
35
  ON_RUN_STEP_COMPLETED = "on_run_step_completed",
36
+ /** Terminal signal for a run step: closed with a status and timestamps. */
37
+ ON_RUN_STEP_CLOSED = "on_run_step_closed",
36
38
  ON_SUMMARIZE_START = "on_summarize_start",
37
39
  ON_SUMMARIZE_DELTA = "on_summarize_delta",
38
40
  ON_SUMMARIZE_COMPLETE = "on_summarize_complete",
39
41
  ON_SUBAGENT_UPDATE = "on_subagent_update",
40
- ON_SANDBOX_STARTING = "on_sandbox_starting"
42
+ ON_SANDBOX_STARTING = "on_sandbox_starting",
43
+ ON_PTC_TOOL_CALL = "on_ptc_tool_call"
41
44
  }
42
45
  /** Payload for {@link StepEvents.ON_SANDBOX_STARTING} — the stateful code
43
46
  * sandbox is cold-booting for the given code tool call. */
@@ -45,6 +48,30 @@ export type SandboxStartingEvent = {
45
48
  tool_call_id: string;
46
49
  runId?: string;
47
50
  };
51
+ /** Lifecycle of one tool call made from inside a programmatic (PTC) program. */
52
+ export type PtcToolCallStatus = 'running' | 'success' | 'error';
53
+ /**
54
+ * Payload for {@link StepEvents.ON_PTC_TOOL_CALL} — one tool invocation the
55
+ * sandbox made on behalf of a programmatic tool-calling program. Emitted twice
56
+ * per inner call (`running`, then `success` / `error`) so the PTC card can
57
+ * render a live trace of what the code is doing under the code itself.
58
+ */
59
+ export type PtcToolCallEvent = {
60
+ /** The PTC run step's tool call id — the card this line belongs under. */
61
+ tool_call_id: string;
62
+ /** Stable per-program id; the settle event reuses the start event's value. */
63
+ call_id: string;
64
+ /** Inner tool id, e.g. `search_code_mcp_github`. */
65
+ name: string;
66
+ status: PtcToolCallStatus;
67
+ /** `key=value` preview of the call's input. Start event only. */
68
+ args?: string;
69
+ /** Truncated failure message. `error` status only. */
70
+ error?: string;
71
+ /** Wall-clock time the inner call took. Settle events only. */
72
+ durationMs?: number;
73
+ runId?: string;
74
+ };
48
75
  /** Token-tracking event names streamed to the client (separate from StepEvents dispatch). */
49
76
  export declare enum UsageEvents {
50
77
  ON_CONTEXT_USAGE = "on_context_usage",
@@ -79,6 +106,41 @@ export declare enum SteerEvents {
79
106
  export declare enum ActivityLabelEvents {
80
107
  ON_ACTIVITY_LABEL = "on_activity_label"
81
108
  }
109
+ /** Live title updates for an existing reasoning content part. */
110
+ export declare enum ReasoningLabelEvents {
111
+ ON_REASONING_LABEL = "on_reasoning_label",
112
+ /** Internal durable budget reservation; clients intentionally do not render it. */
113
+ ON_REASONING_LABEL_ATTEMPT = "on_reasoning_label_attempt"
114
+ }
115
+ type TReasoningLabelEventBase = {
116
+ /** Completion-local content index of the reasoning part being updated. */
117
+ index: number;
118
+ stepId: string;
119
+ responseMessageId?: string;
120
+ conversationId?: string;
121
+ };
122
+ /** Payload of the `on_reasoning_label` SSE event. */
123
+ export type TReasoningLabelEvent = TReasoningLabelEventBase & ({
124
+ /** Clears a snapshot title when its THINK slot changed during the resume gap. */
125
+ reset: true;
126
+ /** Step identity observed in the snapshot and exclusively eligible for this reset. */
127
+ previousStepId: string;
128
+ /** Latest run-global call-budget high-water, when present on fresh content. */
129
+ attempts?: number;
130
+ } | {
131
+ reset?: false;
132
+ /** Run-unique provider-call revision; may contain gaps after unsuccessful attempts. */
133
+ revision: number;
134
+ label: string;
135
+ status: 'streaming' | 'complete';
136
+ });
137
+ /** Durable run-cumulative call-budget reservation, attributed to one reasoning step. */
138
+ export type TReasoningLabelAttemptEvent = {
139
+ index: number;
140
+ stepId: string;
141
+ attempts: number;
142
+ submittedChars: number;
143
+ };
82
144
  /** Payload of the `on_activity_label` SSE event. */
83
145
  export type TActivityLabelEvent = {
84
146
  /** Absolute content index the label part occupies. */
@@ -116,6 +178,9 @@ export type TPendingSteer = {
116
178
  text: string;
117
179
  createdAt?: number;
118
180
  files?: Partial<TFile>[];
181
+ /** Quoted excerpts steered with the message ("Add to chat" selections);
182
+ * merged into the model-bound text at the injection boundary. */
183
+ quotes?: string[];
119
184
  /** The steer asked to interrupt generation at the next safe boundary —
120
185
  * kept on parked/replayed chips so the "interrupting" label survives. */
121
186
  preempt?: boolean;
@@ -136,6 +201,9 @@ export type TSteerAppliedEvent = {
136
201
  clientSteerId?: string;
137
202
  createdAt?: number;
138
203
  files?: Partial<TFile>[];
204
+ /** Quoted excerpts steered with the message (mirrors `SteerContentPart`,
205
+ * which cannot be imported here without a module cycle). */
206
+ quotes?: string[];
139
207
  };
140
208
  responseMessageId?: string;
141
209
  conversationId?: string;
@@ -166,6 +234,10 @@ export type TTokenBudgetBreakdown = {
166
234
  toolTokenCounts?: Record<string, number>;
167
235
  /** Names of counted tools that are deferred (`defer_loading`) and discovered */
168
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>;
169
241
  };
170
242
  /** Per-model-call context snapshot, dispatched after pruning and before the LLM call. */
171
243
  export type TContextUsageEvent = {
@@ -181,12 +253,21 @@ export type TContextUsageEvent = {
181
253
  /** Tokens still free after instructions + pruned messages */
182
254
  remainingContextTokens?: number;
183
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;
184
262
  /** Output tokens of the response's final model call (the call this pre-invoke
185
- * snapshot precedes). Populated only on the persisted `metadata.contextUsage`
186
- * 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
187
265
  * live finalizer did — not the full response `tokenCount`, which the snapshot
188
266
  * already includes for earlier steps. */
189
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;
190
271
  };
191
272
  /**
192
273
  * Per-response usage rollup persisted on `responseMessage.metadata.usage`, in
@@ -217,8 +298,9 @@ export type TTokenUsageEvent = {
217
298
  /** Non-primary buckets fold into session cost/totals but not the live
218
299
  * context gauge: hidden sequential-agent calls (`sequential`), summary
219
300
  * passes (`summarization`), isolated subagent runs (`subagent`), and
220
- * fast-model activity headers (`activity-label`, `activity-phase`) */
221
- usage_type?: 'summarization' | 'subagent' | 'sequential' | 'activity-label' | 'activity-phase';
301
+ * fast-model activity headers (`activity-label`, `activity-phase`), and
302
+ * live reasoning titles (`reasoning-label`) */
303
+ usage_type?: 'summarization' | 'subagent' | 'sequential' | 'activity-label' | 'activity-phase' | 'reasoning-label';
222
304
  runId?: string;
223
305
  /** Per-run emission sequence; keeps identical payloads from distinct model calls unique */
224
306
  seq?: number;
@@ -241,29 +323,57 @@ export declare const promptTokensFromUsage: (event: TTokenUsageEvent) => number;
241
323
  /**
242
324
  * Reconciles a pre-invoke context snapshot's CALIBRATED estimate to a call's
243
325
  * ACTUAL prompt tokens. The SDK's calibration multiplier scales only
244
- * `messageTokens` (instructions/summary are raw tiktoken counts), and it can
326
+ * `messageTokens` (instructions/summary are raw tiktoken counts) and can
245
327
  * over-shoot badly when a provider injects server-side content the SDK never
246
328
  * counted (e.g. Anthropic web search) — pinning the gauge several× too high and
247
329
  * persisting it. Trust the provider's own prompt count: keep the raw
248
- * instruction/summary rows, set `messageTokens` to the remainder, and recompute
249
- * the free space. No-op when `promptTokens` is unusable.
330
+ * instruction/summary rows, set `messageTokens` to the remainder, recompute the
331
+ * free space, and rescale the `toolMessageTokens` share to the new message
332
+ * total. No-op when `promptTokens` is unusable.
250
333
  */
251
334
  export declare const reconcileContextUsage: (snapshot: TContextUsageEvent, promptTokens: number) => TContextUsageEvent;
335
+ /** Provider output, including reasoning omitted from an under-reported output count. */
336
+ export declare const outputTokensFromUsage: (event: TTokenUsageEvent) => number;
337
+ /** Reconcile and retain the primary call details on live, saved, and resumable snapshots. */
338
+ export declare const reconcileContextUsageFromEvent: (snapshot: TContextUsageEvent, event: TTokenUsageEvent) => TContextUsageEvent;
252
339
  /** Lifecycle phase carried on subagent-progress envelopes (mirrors SDK SubagentUpdatePhase). */
253
- export type SubagentUpdatePhase = 'start' | 'run_step' | 'run_step_delta' | 'run_step_completed' | 'message_delta' | 'reasoning_delta' | 'stop' | 'error';
340
+ export type SubagentUpdatePhase = 'start' | 'run_step' | 'run_step_delta' | 'run_step_completed' | 'run_step_closed' | 'message_delta' | 'reasoning_delta' | 'stop' | 'error';
341
+ /** Structured root-to-leaf identity for one nested subagent execution. */
342
+ export interface SubagentAncestryEntry {
343
+ readonly subagentRunId: string;
344
+ readonly subagentType: string;
345
+ readonly subagentKind: 'agent' | 'graph';
346
+ /** Execution subject ID; synthetic for graph subagents. */
347
+ readonly subagentAgentId: string;
348
+ readonly parentRunId: string;
349
+ readonly parentAgentId?: string;
350
+ readonly parentToolCallId?: string;
351
+ }
352
+ export type SubagentIdentity = Pick<SubagentAncestryEntry, 'subagentKind' | 'subagentAgentId'>;
254
353
  /** Single streamed subagent update forwarded by the SDK's SubagentExecutor. */
255
354
  export interface SubagentUpdateEvent {
256
355
  runId: string;
356
+ parentRunId?: string;
257
357
  subagentRunId: string;
358
+ /** Host-assigned identity preserved when one detached update overlaps delivery streams. */
359
+ activityEventId?: string;
360
+ /** Host-assigned monotonic sequence within one detached child run. */
361
+ activitySequence?: number;
258
362
  /** Parent-side `tool_call_id` for the `subagent` tool invocation that
259
363
  * triggered this run. Surfaces from the SDK (`3.1.67-dev.2`+) so hosts
260
364
  * can correlate child progress to the parent tool call deterministically. */
261
365
  parentToolCallId?: string;
262
366
  subagentType: string;
367
+ subagentKind?: 'agent' | 'graph';
368
+ /** Execution subject ID; synthetic for graph subagents. */
263
369
  subagentAgentId: string;
370
+ memberAgentId?: string;
371
+ depth?: number;
372
+ ancestry?: readonly SubagentAncestryEntry[];
264
373
  parentAgentId?: string;
265
374
  phase: SubagentUpdatePhase;
266
375
  data?: unknown;
267
376
  label?: string;
268
377
  timestamp: string;
269
378
  }
379
+ export {};
@@ -0,0 +1,339 @@
1
+ import { z } from 'zod';
2
+ /** Cadences the dialog builds from structured pickers (hour, minute, weekday). */
3
+ export declare const scheduleStructuredFrequencies: readonly ["hourly", "daily", "weekdays", "weekly"];
4
+ export type ScheduleStructuredFrequency = (typeof scheduleStructuredFrequencies)[number];
5
+ export declare const scheduleFrequencies: readonly ["hourly", "daily", "weekdays", "weekly", "cron"];
6
+ export type ScheduleFrequency = (typeof scheduleFrequencies)[number];
7
+ /** Bounds a stored expression. Generous for five fields, because each one can hold a
8
+ * list: an every-minute-of-the-hour cadence spelled out runs past two hundred chars. */
9
+ export declare const SCHEDULE_CRON_MAX_LENGTH = 256;
10
+ export declare const scheduleTargets: readonly ["new"];
11
+ export type ScheduleTarget = (typeof scheduleTargets)[number];
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
+ export type ScheduleRunStatus = 'started' | 'requires_action' | 'success' | 'error' | 'interrupted' | 'skipped_overlap' | 'skipped_balance';
14
+ export declare const structuredCadenceSchema: z.ZodObject<{
15
+ frequency: z.ZodEnum<["hourly", "daily", "weekdays", "weekly"]>;
16
+ hour: z.ZodNumber;
17
+ minute: z.ZodNumber;
18
+ daysOfWeek: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, number[], number[]>>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
21
+ hour: number;
22
+ minute: number;
23
+ daysOfWeek?: number[] | undefined;
24
+ }, {
25
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
26
+ hour: number;
27
+ minute: number;
28
+ daysOfWeek?: number[] | undefined;
29
+ }>;
30
+ export type TStructuredCadence = z.infer<typeof structuredCadenceSchema>;
31
+ /**
32
+ * A raw cron expression carries its own hour and minute, so it cannot share the
33
+ * structured shape: there is no single `hour` for `0 9,17 * * 1-5`. Syntax is
34
+ * validated server-side by croner, the same parser the engine fires from, rather
35
+ * than by a regex that would accept patterns croner then rejects at fire time.
36
+ */
37
+ export declare const cronCadenceSchema: z.ZodObject<{
38
+ frequency: z.ZodLiteral<"cron">;
39
+ expression: z.ZodString;
40
+ }, "strip", z.ZodTypeAny, {
41
+ frequency: "cron";
42
+ expression: string;
43
+ }, {
44
+ frequency: "cron";
45
+ expression: string;
46
+ }>;
47
+ export type TCronCadence = z.infer<typeof cronCadenceSchema>;
48
+ export declare const scheduleCadenceSchema: z.ZodDiscriminatedUnion<"frequency", [z.ZodObject<{
49
+ frequency: z.ZodEnum<["hourly", "daily", "weekdays", "weekly"]>;
50
+ hour: z.ZodNumber;
51
+ minute: z.ZodNumber;
52
+ daysOfWeek: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, number[], number[]>>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
55
+ hour: number;
56
+ minute: number;
57
+ daysOfWeek?: number[] | undefined;
58
+ }, {
59
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
60
+ hour: number;
61
+ minute: number;
62
+ daysOfWeek?: number[] | undefined;
63
+ }>, z.ZodObject<{
64
+ frequency: z.ZodLiteral<"cron">;
65
+ expression: z.ZodString;
66
+ }, "strip", z.ZodTypeAny, {
67
+ frequency: "cron";
68
+ expression: string;
69
+ }, {
70
+ frequency: "cron";
71
+ expression: string;
72
+ }>]>;
73
+ export type TScheduleCadence = z.infer<typeof scheduleCadenceSchema>;
74
+ export declare const isCronCadence: (cadence: TScheduleCadence) => cadence is TCronCadence;
75
+ export declare const createSchedulePayloadSchema: z.ZodObject<{
76
+ name: z.ZodString;
77
+ prompt: z.ZodString;
78
+ agent_id: z.ZodString;
79
+ cadence: z.ZodDiscriminatedUnion<"frequency", [z.ZodObject<{
80
+ frequency: z.ZodEnum<["hourly", "daily", "weekdays", "weekly"]>;
81
+ hour: z.ZodNumber;
82
+ minute: z.ZodNumber;
83
+ daysOfWeek: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, number[], number[]>>;
84
+ }, "strip", z.ZodTypeAny, {
85
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
86
+ hour: number;
87
+ minute: number;
88
+ daysOfWeek?: number[] | undefined;
89
+ }, {
90
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
91
+ hour: number;
92
+ minute: number;
93
+ daysOfWeek?: number[] | undefined;
94
+ }>, z.ZodObject<{
95
+ frequency: z.ZodLiteral<"cron">;
96
+ expression: z.ZodString;
97
+ }, "strip", z.ZodTypeAny, {
98
+ frequency: "cron";
99
+ expression: string;
100
+ }, {
101
+ frequency: "cron";
102
+ expression: string;
103
+ }>]>;
104
+ timezone: z.ZodString;
105
+ target: z.ZodDefault<z.ZodEnum<["new"]>>;
106
+ file_ids: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>;
107
+ /**
108
+ * Chat project each run's conversation is filed under. `null` clears the scope.
109
+ * Ownership is checked server-side at write time and again at every fire, so a
110
+ * deleted project disables the schedule instead of silently filing runs loose.
111
+ */
112
+ chatProjectId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
113
+ enabled: z.ZodDefault<z.ZodBoolean>;
114
+ /**
115
+ * Client-generated key making creation idempotent across retries. Creation commits
116
+ * the row and arms it in two writes, so a failure between them leaves the client
117
+ * unable to tell whether anything persisted; retrying blind can produce two recurring
118
+ * schedules. A retry carrying the same key resolves to the original row instead.
119
+ * REQUIRED: an optional key preserves the keyless duplicate path for any client
120
+ * that omits it, which is exactly the failure the key exists to close.
121
+ */
122
+ clientRequestId: z.ZodString;
123
+ }, "strip", z.ZodTypeAny, {
124
+ name: string;
125
+ prompt: string;
126
+ enabled: boolean;
127
+ agent_id: string;
128
+ clientRequestId: string;
129
+ timezone: string;
130
+ cadence: {
131
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
132
+ hour: number;
133
+ minute: number;
134
+ daysOfWeek?: number[] | undefined;
135
+ } | {
136
+ frequency: "cron";
137
+ expression: string;
138
+ };
139
+ target: "new";
140
+ chatProjectId?: string | null | undefined;
141
+ file_ids?: string[] | undefined;
142
+ }, {
143
+ name: string;
144
+ prompt: string;
145
+ agent_id: string;
146
+ clientRequestId: string;
147
+ timezone: string;
148
+ cadence: {
149
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
150
+ hour: number;
151
+ minute: number;
152
+ daysOfWeek?: number[] | undefined;
153
+ } | {
154
+ frequency: "cron";
155
+ expression: string;
156
+ };
157
+ enabled?: boolean | undefined;
158
+ chatProjectId?: string | null | undefined;
159
+ file_ids?: string[] | undefined;
160
+ target?: "new" | undefined;
161
+ }>;
162
+ export type TCreateSchedule = z.infer<typeof createSchedulePayloadSchema>;
163
+ /** Idempotency is a property of the CREATE attempt, not of the schedule's config. */
164
+ export declare const updateSchedulePayloadSchema: z.ZodObject<{
165
+ name: z.ZodOptional<z.ZodString>;
166
+ prompt: z.ZodOptional<z.ZodString>;
167
+ enabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
168
+ chatProjectId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
169
+ file_ids: z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>>;
170
+ agent_id: z.ZodOptional<z.ZodString>;
171
+ timezone: z.ZodOptional<z.ZodString>;
172
+ cadence: z.ZodOptional<z.ZodDiscriminatedUnion<"frequency", [z.ZodObject<{
173
+ frequency: z.ZodEnum<["hourly", "daily", "weekdays", "weekly"]>;
174
+ hour: z.ZodNumber;
175
+ minute: z.ZodNumber;
176
+ daysOfWeek: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, number[], number[]>>;
177
+ }, "strip", z.ZodTypeAny, {
178
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
179
+ hour: number;
180
+ minute: number;
181
+ daysOfWeek?: number[] | undefined;
182
+ }, {
183
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
184
+ hour: number;
185
+ minute: number;
186
+ daysOfWeek?: number[] | undefined;
187
+ }>, z.ZodObject<{
188
+ frequency: z.ZodLiteral<"cron">;
189
+ expression: z.ZodString;
190
+ }, "strip", z.ZodTypeAny, {
191
+ frequency: "cron";
192
+ expression: string;
193
+ }, {
194
+ frequency: "cron";
195
+ expression: string;
196
+ }>]>>;
197
+ target: z.ZodOptional<z.ZodDefault<z.ZodEnum<["new"]>>>;
198
+ } & {
199
+ /**
200
+ * The configRevision the client's edit was computed from (captured when the
201
+ * dialog opened). The server fences the update on it, so a concurrent edit
202
+ * from another tab answers 409 instead of being silently overwritten by a
203
+ * payload rebuilt from a stale snapshot (cadence is sent whole, so the
204
+ * server-side fresh-read fence alone cannot detect this).
205
+ */
206
+ expectedConfigRevision: z.ZodOptional<z.ZodNumber>;
207
+ }, "strip", z.ZodTypeAny, {
208
+ name?: string | undefined;
209
+ prompt?: string | undefined;
210
+ enabled?: boolean | undefined;
211
+ chatProjectId?: string | null | undefined;
212
+ file_ids?: string[] | undefined;
213
+ agent_id?: string | undefined;
214
+ timezone?: string | undefined;
215
+ cadence?: {
216
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
217
+ hour: number;
218
+ minute: number;
219
+ daysOfWeek?: number[] | undefined;
220
+ } | {
221
+ frequency: "cron";
222
+ expression: string;
223
+ } | undefined;
224
+ target?: "new" | undefined;
225
+ expectedConfigRevision?: number | undefined;
226
+ }, {
227
+ name?: string | undefined;
228
+ prompt?: string | undefined;
229
+ enabled?: boolean | undefined;
230
+ chatProjectId?: string | null | undefined;
231
+ file_ids?: string[] | undefined;
232
+ agent_id?: string | undefined;
233
+ timezone?: string | undefined;
234
+ cadence?: {
235
+ frequency: "hourly" | "daily" | "weekdays" | "weekly";
236
+ hour: number;
237
+ minute: number;
238
+ daysOfWeek?: number[] | undefined;
239
+ } | {
240
+ frequency: "cron";
241
+ expression: string;
242
+ } | undefined;
243
+ target?: "new" | undefined;
244
+ expectedConfigRevision?: number | undefined;
245
+ }>;
246
+ export type TUpdateSchedule = z.infer<typeof updateSchedulePayloadSchema>;
247
+ export type TScheduleLastRun = {
248
+ conversationId?: string;
249
+ status: ScheduleRunStatus;
250
+ error?: string;
251
+ mcp?: ScheduleMCPOutcome[];
252
+ firedAt: string;
253
+ };
254
+ export type TSchedule = {
255
+ id: string;
256
+ user: string;
257
+ name: string;
258
+ prompt: string;
259
+ agent_id: string;
260
+ cadence: TScheduleCadence;
261
+ timezone: string;
262
+ target: ScheduleTarget;
263
+ file_ids?: string[];
264
+ chatProjectId?: string | null;
265
+ enabled: boolean;
266
+ disabledReason?: ScheduleDisabledReason;
267
+ nextRunAt?: string;
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
+ }>;
280
+ runCount: number;
281
+ failureCount: number;
282
+ configRevision?: number;
283
+ createdAt: string;
284
+ updatedAt: string;
285
+ };
286
+ export type TScheduleRun = {
287
+ mcp?: ScheduleMCPOutcome[];
288
+ scheduleId: string;
289
+ scheduledFor: string;
290
+ firedAt?: string;
291
+ conversationId?: string;
292
+ status: ScheduleRunStatus;
293
+ error?: string;
294
+ droppedFileIds?: string[];
295
+ durationMs?: number;
296
+ };
297
+ /** Server-resolved policy the dialog must mirror. Sourced from the same
298
+ * per-principal `interface.schedules` resolution the write handlers and the fire
299
+ * path enforce, so the form can never offer a choice the server would refuse. */
300
+ export type TScheduleLimits = {
301
+ maxPerUser: number;
302
+ /** Served with the list so the dialog can refuse a cadence the floor would reject
303
+ * rather than surfacing it as a 400 after submit. */
304
+ minIntervalMinutes: number;
305
+ /** Every schedule must be filed under a chat project. */
306
+ requireProject: boolean;
307
+ /** Operator-pinned destination project; when set it is the ONLY destination and
308
+ * the client must not offer a picker. */
309
+ projectId?: string;
310
+ };
311
+ export type TSchedulesResponse = {
312
+ schedules: TSchedule[];
313
+ limits: TScheduleLimits;
314
+ };
315
+ export type TScheduleRunNowResponse = {
316
+ scheduleId: string;
317
+ conversationId: string;
318
+ status: 'started';
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[];
@@ -216,6 +216,13 @@ export type TGitHubSkillSyncSkippedSkill = {
216
216
  errorCode: string;
217
217
  errorMessage: string;
218
218
  };
219
+ /** One upstream file a sync run published a skill without, and why. */
220
+ export type TGitHubSkillSyncSkippedFile = {
221
+ path: string;
222
+ skillPath: string;
223
+ errorCode: string;
224
+ errorMessage: string;
225
+ };
219
226
  export type TGitHubSkillSyncSourceStatus = {
220
227
  provider: 'github';
221
228
  sourceId: string;
@@ -240,6 +247,8 @@ export type TGitHubSkillSyncSourceStatus = {
240
247
  deletedFileCount: number;
241
248
  skippedSkillCount: number;
242
249
  skippedSkills?: TGitHubSkillSyncSkippedSkill[];
250
+ skippedFileCount: number;
251
+ skippedFiles?: TGitHubSkillSyncSkippedFile[];
243
252
  updatedAt?: string;
244
253
  createdAt?: string;
245
254
  };