librechat-data-provider 0.8.509 → 0.8.522
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.
- package/dist/{data-service-BsdHkdKS.mjs → data-service-CaB7saTP.mjs} +2175 -113
- package/dist/data-service-CaB7saTP.mjs.map +1 -0
- package/dist/{data-service-XTxx76uB.js → data-service-D5kHzBt-.js} +2806 -150
- package/dist/data-service-D5kHzBt-.js.map +1 -0
- package/dist/index.js +1403 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1248 -93
- package/dist/index.mjs.map +1 -1
- package/dist/react-query/index.js +2 -1
- package/dist/react-query/index.js.map +1 -1
- package/dist/react-query/index.mjs +2 -1
- package/dist/react-query/index.mjs.map +1 -1
- package/dist/types/accessPermissions.d.ts +4 -0
- package/dist/types/actions.d.ts +3 -3
- package/dist/types/agentToolOptions.d.ts +11 -0
- package/dist/types/api-endpoints.d.ts +28 -2
- package/dist/types/bedrock.d.ts +220 -0
- package/dist/types/cadence.d.ts +33 -0
- package/dist/types/codeEnvRef.d.ts +21 -0
- package/dist/types/config.d.ts +13457 -1573
- package/dist/types/data-service.d.ts +65 -14
- package/dist/types/feedback.d.ts +9 -1
- package/dist/types/file-config.d.ts +42 -5
- package/dist/types/filters.d.ts +1422 -0
- package/dist/types/generate.d.ts +85 -1
- package/dist/types/index.d.ts +10 -0
- package/dist/types/keys.d.ts +29 -4
- package/dist/types/langchain.d.ts +4 -0
- package/dist/types/limits.d.ts +13 -0
- package/dist/types/mcp.d.ts +338 -228
- package/dist/types/messages.d.ts +13 -0
- package/dist/types/models.d.ts +840 -68
- package/dist/types/parameterSettings.d.ts +7 -3
- package/dist/types/parsers.d.ts +13 -1
- package/dist/types/permissions.d.ts +42 -1
- package/dist/types/providers.d.ts +36 -0
- package/dist/types/react-query/react-query-service.d.ts +2 -7
- package/dist/types/request.d.ts +4 -2
- package/dist/types/roles.d.ts +34 -0
- package/dist/types/runSteps.d.ts +59 -0
- package/dist/types/schemas.d.ts +1358 -34
- package/dist/types/stateful-code.d.ts +7 -0
- package/dist/types/types/agents.d.ts +303 -8
- package/dist/types/types/assistants.d.ts +170 -7
- package/dist/types/types/files.d.ts +29 -8
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/insights.d.ts +62 -0
- package/dist/types/types/mcpServers.d.ts +25 -0
- package/dist/types/types/mutations.d.ts +2 -0
- package/dist/types/types/queries.d.ts +47 -5
- package/dist/types/types/queuedTurns.d.ts +870 -0
- package/dist/types/types/runs.d.ts +206 -26
- package/dist/types/types/schedules.d.ts +306 -0
- package/dist/types/types/skills.d.ts +34 -6
- package/dist/types/types/subagents.d.ts +159 -0
- package/dist/types/types/web.d.ts +12 -2
- package/dist/types/types.d.ts +175 -2
- package/dist/types/upload.d.ts +2 -0
- package/package.json +7 -5
- package/dist/data-service-BsdHkdKS.mjs.map +0 -1
- package/dist/data-service-XTxx76uB.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TFile } from './files';
|
|
1
2
|
export declare enum ContentTypes {
|
|
2
3
|
TEXT = "text",
|
|
3
4
|
THINK = "think",
|
|
@@ -9,6 +10,8 @@ export declare enum ContentTypes {
|
|
|
9
10
|
INPUT_AUDIO = "input_audio",
|
|
10
11
|
AGENT_UPDATE = "agent_update",
|
|
11
12
|
SUMMARY = "summary",
|
|
13
|
+
ACTIVITY_LABEL = "activity_label",
|
|
14
|
+
STEER = "steer",
|
|
12
15
|
ERROR = "error"
|
|
13
16
|
}
|
|
14
17
|
export declare enum StepTypes {
|
|
@@ -30,16 +33,191 @@ export declare enum StepEvents {
|
|
|
30
33
|
ON_REASONING_DELTA = "on_reasoning_delta",
|
|
31
34
|
ON_RUN_STEP_DELTA = "on_run_step_delta",
|
|
32
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",
|
|
33
38
|
ON_SUMMARIZE_START = "on_summarize_start",
|
|
34
39
|
ON_SUMMARIZE_DELTA = "on_summarize_delta",
|
|
35
40
|
ON_SUMMARIZE_COMPLETE = "on_summarize_complete",
|
|
36
|
-
ON_SUBAGENT_UPDATE = "on_subagent_update"
|
|
41
|
+
ON_SUBAGENT_UPDATE = "on_subagent_update",
|
|
42
|
+
ON_SANDBOX_STARTING = "on_sandbox_starting",
|
|
43
|
+
ON_PTC_TOOL_CALL = "on_ptc_tool_call"
|
|
37
44
|
}
|
|
45
|
+
/** Payload for {@link StepEvents.ON_SANDBOX_STARTING} — the stateful code
|
|
46
|
+
* sandbox is cold-booting for the given code tool call. */
|
|
47
|
+
export type SandboxStartingEvent = {
|
|
48
|
+
tool_call_id: string;
|
|
49
|
+
runId?: string;
|
|
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
|
+
};
|
|
38
75
|
/** Token-tracking event names streamed to the client (separate from StepEvents dispatch). */
|
|
39
76
|
export declare enum UsageEvents {
|
|
40
77
|
ON_CONTEXT_USAGE = "on_context_usage",
|
|
41
78
|
ON_TOKEN_USAGE = "on_token_usage"
|
|
42
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Human-in-the-loop event names. Streamed to live clients when a run pauses for
|
|
82
|
+
* tool approval (or an ask-user question). Reconnecting clients instead read the
|
|
83
|
+
* same record from `resumeState.pendingAction` on the sync event / status route.
|
|
84
|
+
*/
|
|
85
|
+
export declare enum ApprovalEvents {
|
|
86
|
+
ON_PENDING_ACTION = "on_pending_action"
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Steering event names. `on_steer_applied` streams to live clients when a
|
|
90
|
+
* queued steer message is injected at a tool-batch boundary; reconnecting
|
|
91
|
+
* clients recover injected steers from `aggregatedContent` and still-queued
|
|
92
|
+
* ones from `resumeState.pendingSteers`. Steers that never reach a boundary
|
|
93
|
+
* ride the final/abort events as `pendingSteers`.
|
|
94
|
+
*/
|
|
95
|
+
export declare enum SteerEvents {
|
|
96
|
+
ON_STEER_APPLIED = "on_steer_applied",
|
|
97
|
+
/** Durable capability correction for queued steers after HITL handover. */
|
|
98
|
+
ON_STEER_UPDATED = "on_steer_updated"
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Activity-label event names. `on_activity_label` streams to live clients
|
|
102
|
+
* when a tool-batch or parent-phase label part is claimed and again when the
|
|
103
|
+
* fast-model label resolves; reconnecting clients recover applied labels
|
|
104
|
+
* from `aggregatedContent` like any other content part.
|
|
105
|
+
*/
|
|
106
|
+
export declare enum ActivityLabelEvents {
|
|
107
|
+
ON_ACTIVITY_LABEL = "on_activity_label"
|
|
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
|
+
};
|
|
144
|
+
/** Payload of the `on_activity_label` SSE event. */
|
|
145
|
+
export type TActivityLabelEvent = {
|
|
146
|
+
/** Absolute content index the label part occupies. */
|
|
147
|
+
index: number;
|
|
148
|
+
part: {
|
|
149
|
+
type: ContentTypes.ACTIVITY_LABEL;
|
|
150
|
+
[ContentTypes.ACTIVITY_LABEL]: string;
|
|
151
|
+
/** Missing means a per-batch activity label. */
|
|
152
|
+
activity_label_type?: 'phase';
|
|
153
|
+
tool_call_ids?: string[];
|
|
154
|
+
activity_start_index?: number;
|
|
155
|
+
activity_end_index?: number;
|
|
156
|
+
activity_count?: number;
|
|
157
|
+
agent_ids?: string[];
|
|
158
|
+
counts?: {
|
|
159
|
+
searches: number;
|
|
160
|
+
reads: number;
|
|
161
|
+
writes: number;
|
|
162
|
+
commands: number;
|
|
163
|
+
other: number;
|
|
164
|
+
};
|
|
165
|
+
status?: 'ok' | 'partial' | 'failed';
|
|
166
|
+
agentId?: string;
|
|
167
|
+
pending?: boolean;
|
|
168
|
+
};
|
|
169
|
+
responseMessageId?: string;
|
|
170
|
+
conversationId?: string;
|
|
171
|
+
};
|
|
172
|
+
/** A steer message queued server-side but not yet injected into the run. */
|
|
173
|
+
export type TPendingSteer = {
|
|
174
|
+
steerId: string;
|
|
175
|
+
/** Correlates a server steer with its optimistic chip when terminal delivery
|
|
176
|
+
* races ahead of the POST response. */
|
|
177
|
+
clientSteerId?: string;
|
|
178
|
+
text: string;
|
|
179
|
+
createdAt?: number;
|
|
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[];
|
|
184
|
+
/** The steer asked to interrupt generation at the next safe boundary —
|
|
185
|
+
* kept on parked/replayed chips so the "interrupting" label survives. */
|
|
186
|
+
preempt?: boolean;
|
|
187
|
+
/** Monotonic server revision for last-writer-wins interrupt labels. */
|
|
188
|
+
preemptRevision?: number;
|
|
189
|
+
};
|
|
190
|
+
/** Payload of the `on_steer_applied` SSE event. */
|
|
191
|
+
export type TSteerAppliedEvent = {
|
|
192
|
+
steerId: string;
|
|
193
|
+
/** Correlates the applied event with the optimistic chip before the POST settles. */
|
|
194
|
+
clientSteerId?: string;
|
|
195
|
+
/** Absolute content index the steer part was injected at. */
|
|
196
|
+
index: number;
|
|
197
|
+
part: {
|
|
198
|
+
type: ContentTypes.STEER;
|
|
199
|
+
[ContentTypes.STEER]: string;
|
|
200
|
+
steerId?: string;
|
|
201
|
+
clientSteerId?: string;
|
|
202
|
+
createdAt?: number;
|
|
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[];
|
|
207
|
+
};
|
|
208
|
+
responseMessageId?: string;
|
|
209
|
+
conversationId?: string;
|
|
210
|
+
};
|
|
211
|
+
/** A queued steer's interrupt label changed without moving its FIFO slot. */
|
|
212
|
+
export type TSteerUpdatedEvent = {
|
|
213
|
+
conversationId: string;
|
|
214
|
+
steers: Array<{
|
|
215
|
+
steerId: string;
|
|
216
|
+
clientSteerId?: string;
|
|
217
|
+
preempt: boolean;
|
|
218
|
+
preemptRevision: number;
|
|
219
|
+
}>;
|
|
220
|
+
};
|
|
43
221
|
/** Mirrors TokenBudgetBreakdown from @librechat/agents (data-provider cannot import it). */
|
|
44
222
|
export type TTokenBudgetBreakdown = {
|
|
45
223
|
maxContextTokens: number;
|
|
@@ -78,28 +256,6 @@ export type TContextUsageEvent = {
|
|
|
78
256
|
* already includes for earlier steps. */
|
|
79
257
|
completedOutputTokens?: number;
|
|
80
258
|
};
|
|
81
|
-
/**
|
|
82
|
-
* Request payload for a server-side context-usage projection: "what context
|
|
83
|
-
* would the next call send for this branch under this config", computed by the
|
|
84
|
-
* agents SDK without invoking the model. Powers the gauge in states the live
|
|
85
|
-
* snapshot can't cover (page load of a snapshot-less branch, window/model
|
|
86
|
-
* switch). `messageId` is the viewed branch's tail; the server walks its parent
|
|
87
|
-
* chain.
|
|
88
|
-
*/
|
|
89
|
-
export type TContextProjectionRequest = {
|
|
90
|
-
conversationId: string;
|
|
91
|
-
messageId: string;
|
|
92
|
-
endpoint: string;
|
|
93
|
-
model?: string;
|
|
94
|
-
agentId?: string;
|
|
95
|
-
spec?: string;
|
|
96
|
-
maxContextTokens?: number;
|
|
97
|
-
/** Provider-calibrated ratio from a prior snapshot, applied as a static seed. */
|
|
98
|
-
calibrationRatio?: number;
|
|
99
|
-
/** Client-only cache-bust: a branch content revision so a message edit
|
|
100
|
-
* (which keeps the same tail id) refetches. The server ignores it. */
|
|
101
|
-
revision?: number;
|
|
102
|
-
};
|
|
103
259
|
/**
|
|
104
260
|
* Per-response usage rollup persisted on `responseMessage.metadata.usage`, in
|
|
105
261
|
* display units (input excludes cache; output includes repaired completion).
|
|
@@ -128,8 +284,10 @@ export type TTokenUsageEvent = {
|
|
|
128
284
|
provider?: string;
|
|
129
285
|
/** Non-primary buckets fold into session cost/totals but not the live
|
|
130
286
|
* context gauge: hidden sequential-agent calls (`sequential`), summary
|
|
131
|
-
* passes (`summarization`),
|
|
132
|
-
|
|
287
|
+
* passes (`summarization`), isolated subagent runs (`subagent`), and
|
|
288
|
+
* fast-model activity headers (`activity-label`, `activity-phase`), and
|
|
289
|
+
* live reasoning titles (`reasoning-label`) */
|
|
290
|
+
usage_type?: 'summarization' | 'subagent' | 'sequential' | 'activity-label' | 'activity-phase' | 'reasoning-label';
|
|
133
291
|
runId?: string;
|
|
134
292
|
/** Per-run emission sequence; keeps identical payloads from distinct model calls unique */
|
|
135
293
|
seq?: number;
|
|
@@ -161,20 +319,42 @@ export declare const promptTokensFromUsage: (event: TTokenUsageEvent) => number;
|
|
|
161
319
|
*/
|
|
162
320
|
export declare const reconcileContextUsage: (snapshot: TContextUsageEvent, promptTokens: number) => TContextUsageEvent;
|
|
163
321
|
/** Lifecycle phase carried on subagent-progress envelopes (mirrors SDK SubagentUpdatePhase). */
|
|
164
|
-
export type SubagentUpdatePhase = 'start' | 'run_step' | 'run_step_delta' | 'run_step_completed' | 'message_delta' | 'reasoning_delta' | 'stop' | 'error';
|
|
322
|
+
export type SubagentUpdatePhase = 'start' | 'run_step' | 'run_step_delta' | 'run_step_completed' | 'run_step_closed' | 'message_delta' | 'reasoning_delta' | 'stop' | 'error';
|
|
323
|
+
/** Structured root-to-leaf identity for one nested subagent execution. */
|
|
324
|
+
export interface SubagentAncestryEntry {
|
|
325
|
+
readonly subagentRunId: string;
|
|
326
|
+
readonly subagentType: string;
|
|
327
|
+
readonly subagentKind: 'agent' | 'graph';
|
|
328
|
+
/** Execution subject ID; synthetic for graph subagents. */
|
|
329
|
+
readonly subagentAgentId: string;
|
|
330
|
+
readonly parentRunId: string;
|
|
331
|
+
readonly parentAgentId?: string;
|
|
332
|
+
readonly parentToolCallId?: string;
|
|
333
|
+
}
|
|
165
334
|
/** Single streamed subagent update forwarded by the SDK's SubagentExecutor. */
|
|
166
335
|
export interface SubagentUpdateEvent {
|
|
167
336
|
runId: string;
|
|
337
|
+
parentRunId?: string;
|
|
168
338
|
subagentRunId: string;
|
|
339
|
+
/** Host-assigned identity preserved when one detached update overlaps delivery streams. */
|
|
340
|
+
activityEventId?: string;
|
|
341
|
+
/** Host-assigned monotonic sequence within one detached child run. */
|
|
342
|
+
activitySequence?: number;
|
|
169
343
|
/** Parent-side `tool_call_id` for the `subagent` tool invocation that
|
|
170
344
|
* triggered this run. Surfaces from the SDK (`3.1.67-dev.2`+) so hosts
|
|
171
345
|
* can correlate child progress to the parent tool call deterministically. */
|
|
172
346
|
parentToolCallId?: string;
|
|
173
347
|
subagentType: string;
|
|
348
|
+
subagentKind?: 'agent' | 'graph';
|
|
349
|
+
/** Execution subject ID; synthetic for graph subagents. */
|
|
174
350
|
subagentAgentId: string;
|
|
351
|
+
memberAgentId?: string;
|
|
352
|
+
depth?: number;
|
|
353
|
+
ancestry?: readonly SubagentAncestryEntry[];
|
|
175
354
|
parentAgentId?: string;
|
|
176
355
|
phase: SubagentUpdatePhase;
|
|
177
356
|
data?: unknown;
|
|
178
357
|
label?: string;
|
|
179
358
|
timestamp: string;
|
|
180
359
|
}
|
|
360
|
+
export {};
|
|
@@ -0,0 +1,306 @@
|
|
|
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 = '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
|
+
agent_id: string;
|
|
126
|
+
clientRequestId: string;
|
|
127
|
+
prompt: string;
|
|
128
|
+
enabled: boolean;
|
|
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
|
+
agent_id: string;
|
|
145
|
+
clientRequestId: string;
|
|
146
|
+
prompt: 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
|
+
chatProjectId?: string | null | undefined;
|
|
158
|
+
file_ids?: string[] | undefined;
|
|
159
|
+
enabled?: boolean | 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
|
+
chatProjectId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
167
|
+
file_ids: z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>>>;
|
|
168
|
+
agent_id: z.ZodOptional<z.ZodString>;
|
|
169
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
170
|
+
enabled: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
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
|
+
chatProjectId?: string | null | undefined;
|
|
210
|
+
file_ids?: string[] | undefined;
|
|
211
|
+
agent_id?: string | undefined;
|
|
212
|
+
prompt?: string | undefined;
|
|
213
|
+
enabled?: boolean | 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
|
+
chatProjectId?: string | null | undefined;
|
|
229
|
+
file_ids?: string[] | undefined;
|
|
230
|
+
agent_id?: string | undefined;
|
|
231
|
+
prompt?: string | undefined;
|
|
232
|
+
enabled?: boolean | 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
|
+
firedAt: string;
|
|
252
|
+
};
|
|
253
|
+
export type TSchedule = {
|
|
254
|
+
id: string;
|
|
255
|
+
user: string;
|
|
256
|
+
name: string;
|
|
257
|
+
prompt: string;
|
|
258
|
+
agent_id: string;
|
|
259
|
+
cadence: TScheduleCadence;
|
|
260
|
+
timezone: string;
|
|
261
|
+
target: ScheduleTarget;
|
|
262
|
+
file_ids?: string[];
|
|
263
|
+
chatProjectId?: string | null;
|
|
264
|
+
enabled: boolean;
|
|
265
|
+
disabledReason?: ScheduleDisabledReason;
|
|
266
|
+
nextRunAt?: string;
|
|
267
|
+
lastRun?: TScheduleLastRun;
|
|
268
|
+
runCount: number;
|
|
269
|
+
failureCount: number;
|
|
270
|
+
configRevision?: number;
|
|
271
|
+
createdAt: string;
|
|
272
|
+
updatedAt: string;
|
|
273
|
+
};
|
|
274
|
+
export type TScheduleRun = {
|
|
275
|
+
scheduleId: string;
|
|
276
|
+
scheduledFor: string;
|
|
277
|
+
firedAt?: string;
|
|
278
|
+
conversationId?: string;
|
|
279
|
+
status: ScheduleRunStatus;
|
|
280
|
+
error?: string;
|
|
281
|
+
droppedFileIds?: string[];
|
|
282
|
+
durationMs?: number;
|
|
283
|
+
};
|
|
284
|
+
/** Server-resolved policy the dialog must mirror. Sourced from the same
|
|
285
|
+
* per-principal `interface.schedules` resolution the write handlers and the fire
|
|
286
|
+
* path enforce, so the form can never offer a choice the server would refuse. */
|
|
287
|
+
export type TScheduleLimits = {
|
|
288
|
+
maxPerUser: number;
|
|
289
|
+
/** Served with the list so the dialog can refuse a cadence the floor would reject
|
|
290
|
+
* rather than surfacing it as a 400 after submit. */
|
|
291
|
+
minIntervalMinutes: number;
|
|
292
|
+
/** Every schedule must be filed under a chat project. */
|
|
293
|
+
requireProject: boolean;
|
|
294
|
+
/** Operator-pinned destination project; when set it is the ONLY destination and
|
|
295
|
+
* the client must not offer a picker. */
|
|
296
|
+
projectId?: string;
|
|
297
|
+
};
|
|
298
|
+
export type TSchedulesResponse = {
|
|
299
|
+
schedules: TSchedule[];
|
|
300
|
+
limits: TScheduleLimits;
|
|
301
|
+
};
|
|
302
|
+
export type TScheduleRunNowResponse = {
|
|
303
|
+
scheduleId: string;
|
|
304
|
+
conversationId: string;
|
|
305
|
+
status: 'started';
|
|
306
|
+
};
|
|
@@ -33,11 +33,20 @@ export type SkillSource = 'inline' | 'deployment' | 'github' | 'notion';
|
|
|
33
33
|
* everything else (including root-level files) is `other`.
|
|
34
34
|
*/
|
|
35
35
|
export type SkillFileCategory = 'script' | 'reference' | 'asset' | 'other';
|
|
36
|
+
/** Nested object inside a structured frontmatter key. */
|
|
37
|
+
export type SkillFrontmatterObject = {
|
|
38
|
+
[key: string]: SkillFrontmatterValue | undefined;
|
|
39
|
+
};
|
|
36
40
|
/**
|
|
37
|
-
* Allowed value types inside a skill's YAML frontmatter.
|
|
38
|
-
*
|
|
41
|
+
* Allowed value types inside a skill's YAML frontmatter. Scalars cover the
|
|
42
|
+
* documented keys; nested arrays and objects describe the structured ones
|
|
43
|
+
* (`hooks`, `metadata`, `references`), which real `SKILL.md` files write as a
|
|
44
|
+
* list, a list of objects, or a map.
|
|
45
|
+
*
|
|
46
|
+
* Still no `unknown` or `any`: the payload is JSON-safe by construction, and
|
|
47
|
+
* the server bounds depth, string length and array size when validating it.
|
|
39
48
|
*/
|
|
40
|
-
export type SkillFrontmatterValue = string | number | boolean |
|
|
49
|
+
export type SkillFrontmatterValue = string | number | boolean | null | SkillFrontmatterValue[] | SkillFrontmatterObject;
|
|
41
50
|
/**
|
|
42
51
|
* Structured YAML frontmatter for a skill. All keys are optional on the wire
|
|
43
52
|
* because not every skill document carries a complete frontmatter block —
|
|
@@ -95,8 +104,8 @@ export type TSkillWarning = {
|
|
|
95
104
|
* - `description` is the "when to use this skill" sentence. Highest-leverage
|
|
96
105
|
* field for trigger accuracy; a short/vague one causes undertriggering.
|
|
97
106
|
* - `frontmatter` is the structured YAML bag minus `name`/`description`
|
|
98
|
-
* (those live as top-level columns).
|
|
99
|
-
*
|
|
107
|
+
* (those live as top-level columns). Known keys receive value validation;
|
|
108
|
+
* unknown keys are retained and reported as non-blocking warnings.
|
|
100
109
|
* - `source`/`sourceMetadata` identify whether the row is user-authored,
|
|
101
110
|
* deployment-provided, or mirrored from an external source such as GitHub.
|
|
102
111
|
*/
|
|
@@ -200,11 +209,26 @@ export type TGitHubSkillSyncCredentialSummary = {
|
|
|
200
209
|
updatedAt?: string;
|
|
201
210
|
createdAt?: string;
|
|
202
211
|
};
|
|
212
|
+
/** One upstream skill a sync run dropped, with the reason it was dropped. */
|
|
213
|
+
export type TGitHubSkillSyncSkippedSkill = {
|
|
214
|
+
path: string;
|
|
215
|
+
name?: string;
|
|
216
|
+
errorCode: string;
|
|
217
|
+
errorMessage: string;
|
|
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
|
+
};
|
|
203
226
|
export type TGitHubSkillSyncSourceStatus = {
|
|
204
227
|
provider: 'github';
|
|
205
228
|
sourceId: string;
|
|
206
229
|
tenantId?: string;
|
|
207
|
-
|
|
230
|
+
/** `partial`: some skills published, others were skipped (see `skippedSkills`). */
|
|
231
|
+
status: 'idle' | 'running' | 'succeeded' | 'partial' | 'failed' | 'skipped';
|
|
208
232
|
credentialKey?: string;
|
|
209
233
|
credentialPresent: boolean;
|
|
210
234
|
owner?: string;
|
|
@@ -221,6 +245,10 @@ export type TGitHubSkillSyncSourceStatus = {
|
|
|
221
245
|
syncedFileCount: number;
|
|
222
246
|
deletedSkillCount: number;
|
|
223
247
|
deletedFileCount: number;
|
|
248
|
+
skippedSkillCount: number;
|
|
249
|
+
skippedSkills?: TGitHubSkillSyncSkippedSkill[];
|
|
250
|
+
skippedFileCount: number;
|
|
251
|
+
skippedFiles?: TGitHubSkillSyncSkippedFile[];
|
|
224
252
|
updatedAt?: string;
|
|
225
253
|
createdAt?: string;
|
|
226
254
|
};
|