librechat-data-provider 0.8.522 → 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.
- package/dist/{data-service-CaB7saTP.mjs → data-service-Bx6IFaSa.mjs} +638 -27
- package/dist/data-service-Bx6IFaSa.mjs.map +1 -0
- package/dist/{data-service-D5kHzBt-.js → data-service-CTX0tVO5.js} +871 -26
- package/dist/data-service-CTX0tVO5.js.map +1 -0
- package/dist/index.js +557 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +491 -20
- package/dist/index.mjs.map +1 -1
- package/dist/react-query/index.js +1 -1
- package/dist/react-query/index.mjs +1 -1
- package/dist/types/accessPermissions.d.ts +54 -1
- package/dist/types/api-endpoints.d.ts +6 -0
- package/dist/types/bedrock.d.ts +80 -20
- package/dist/types/code/approval.d.ts +26 -0
- package/dist/types/code/worker.d.ts +10 -0
- package/dist/types/code/workspace.d.ts +28 -0
- package/dist/types/codeEnvRef.d.ts +5 -0
- package/dist/types/config.d.ts +6062 -3828
- package/dist/types/data-service.d.ts +8 -0
- package/dist/types/errors.d.ts +2 -0
- package/dist/types/file-config.d.ts +137 -9
- package/dist/types/filters.d.ts +176 -176
- package/dist/types/generate.d.ts +28 -4
- package/dist/types/index.d.ts +7 -0
- package/dist/types/keys.d.ts +11 -1
- package/dist/types/mcp.d.ts +336 -330
- package/dist/types/messages.d.ts +19 -0
- package/dist/types/models.d.ts +367 -238
- package/dist/types/parameterSettings.d.ts +8 -0
- package/dist/types/providers.d.ts +1 -0
- package/dist/types/resolve-llm-delivery-path.d.ts +68 -0
- package/dist/types/schemas.d.ts +628 -317
- package/dist/types/svg.d.ts +34 -0
- package/dist/types/types/agents.d.ts +24 -0
- package/dist/types/types/assistants.d.ts +27 -3
- package/dist/types/types/files.d.ts +34 -0
- package/dist/types/types/insights.d.ts +9 -0
- package/dist/types/types/queries.d.ts +8 -1
- package/dist/types/types/queuedTurns.d.ts +16 -16
- package/dist/types/types/runs.d.ts +24 -5
- package/dist/types/types/schedules.d.ts +44 -11
- package/dist/types/types/traces.d.ts +85 -0
- package/dist/types/types.d.ts +41 -1
- package/package.json +2 -2
- package/dist/data-service-CaB7saTP.mjs.map +0 -1
- package/dist/data-service-D5kHzBt-.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOMPurify policy for user-provided SVG icons, shared by the browser uploader and
|
|
3
|
+
* the server trust boundary so a preview and the persisted icon cannot disagree.
|
|
4
|
+
* `use` is re-added for self-contained `<defs>` references (targets restricted by
|
|
5
|
+
* `restrictSvgReferences`); every SMIL element is forbidden so a stored icon
|
|
6
|
+
* cannot animate forever wherever it renders.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SVG_SANITIZE_CONFIG: {
|
|
9
|
+
USE_PROFILES: {
|
|
10
|
+
svg: boolean;
|
|
11
|
+
svgFilters: boolean;
|
|
12
|
+
};
|
|
13
|
+
ADD_TAGS: string[];
|
|
14
|
+
ADD_ATTR: string[];
|
|
15
|
+
FORBID_TAGS: string[];
|
|
16
|
+
FORBID_ATTR: string[];
|
|
17
|
+
};
|
|
18
|
+
/** Element surface shared by the browser DOM and the server's jsdom. */
|
|
19
|
+
export interface SvgAttributeHost {
|
|
20
|
+
attributes: ArrayLike<{
|
|
21
|
+
name: string;
|
|
22
|
+
}>;
|
|
23
|
+
getAttribute(name: string): string | null;
|
|
24
|
+
removeAttribute(name: string): void;
|
|
25
|
+
}
|
|
26
|
+
/** DOMPurify hook that drops every attribute referencing outside the document. */
|
|
27
|
+
export declare function restrictSvgReferences(node: SvgAttributeHost): void;
|
|
28
|
+
/**
|
|
29
|
+
* Makes HTML-mode sanitizer output valid as a standalone `image/svg+xml`
|
|
30
|
+
* document: restores camelCase element names the HTML parser lowercased and
|
|
31
|
+
* declares the SVG namespace on the root, without which an XML parser puts the
|
|
32
|
+
* root in no namespace and the icon renders blank.
|
|
33
|
+
*/
|
|
34
|
+
export declare function finalizeSvgMarkup(markup: string): string;
|
|
@@ -75,11 +75,15 @@ export declare namespace Agents {
|
|
|
75
75
|
taskId: string;
|
|
76
76
|
toolName: string;
|
|
77
77
|
status: 'completed' | 'error';
|
|
78
|
+
/** Additive rolling-deploy-compatible cancellation discriminator. */
|
|
79
|
+
cancelled?: true;
|
|
78
80
|
settledAt: Date;
|
|
79
81
|
resultClaim?: {
|
|
80
82
|
kind: 'manual' | 'wakeup';
|
|
81
83
|
claimId: string;
|
|
82
84
|
claimedAt: Date;
|
|
85
|
+
/** Response generation that owns a manual delivery claim. */
|
|
86
|
+
generationId?: string;
|
|
83
87
|
};
|
|
84
88
|
};
|
|
85
89
|
/** The tool call was rejected before execution because its input failed schema validation. */
|
|
@@ -383,6 +387,8 @@ export declare namespace Agents {
|
|
|
383
387
|
tool_call_id: string;
|
|
384
388
|
/** Optional human-readable description shown alongside the prompt */
|
|
385
389
|
description?: string;
|
|
390
|
+
/** Server-authored provenance. Absent for user, MCP, action, and older tool calls. */
|
|
391
|
+
source?: 'librechat_code';
|
|
386
392
|
}
|
|
387
393
|
/**
|
|
388
394
|
* Per-call review configuration: which decisions the user is allowed to make.
|
|
@@ -485,6 +491,8 @@ export declare namespace Agents {
|
|
|
485
491
|
* so the id check can't.
|
|
486
492
|
*/
|
|
487
493
|
requestFingerprint?: string;
|
|
494
|
+
/** Current-version fingerprint; server-only and omitted from client projections. */
|
|
495
|
+
requestFingerprintV2?: string;
|
|
488
496
|
/**
|
|
489
497
|
* Graph-determining request fields (endpoint, agent_id, model, spec, promptPrefix,
|
|
490
498
|
* ephemeralAgent) captured at pause. The resume route REPLAYS these onto the request
|
|
@@ -492,6 +500,22 @@ export declare namespace Agents {
|
|
|
492
500
|
* no longer reconstruct the ephemeral config — still rebuilds the same agent/graph.
|
|
493
501
|
*/
|
|
494
502
|
resumeContext?: Record<string, unknown>;
|
|
503
|
+
/**
|
|
504
|
+
* Opaque, server-only identity of the stateful code targets selected when a
|
|
505
|
+
* tool approval paused. Resume rejects a changed target before provider or
|
|
506
|
+
* tool execution so an approval cannot migrate to another VM or workspace.
|
|
507
|
+
*/
|
|
508
|
+
codeExecutionBinding?: CodeExecutionApprovalBinding;
|
|
509
|
+
}
|
|
510
|
+
interface CodeExecutionApprovalTargetBinding {
|
|
511
|
+
/** Agent identity when available; anonymous ephemeral agents use null. */
|
|
512
|
+
agentId: string | null;
|
|
513
|
+
/** SHA-256 of the resolved route, worker and runtime-session identity. */
|
|
514
|
+
targetHash: string;
|
|
515
|
+
}
|
|
516
|
+
interface CodeExecutionApprovalBinding {
|
|
517
|
+
version: 1;
|
|
518
|
+
targets: CodeExecutionApprovalTargetBinding[];
|
|
495
519
|
}
|
|
496
520
|
/**
|
|
497
521
|
* Scope of a tool-approval decision — drives the "remember this" persistence
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
3
|
import type { AssistantsEndpoint, AgentProvider, MemoryScope, SkillsScope } from 'src/schemas';
|
|
3
4
|
import type { StatefulCodeEnvironment } from '../stateful-code';
|
|
5
|
+
import type { ContentTypes, SubagentIdentity } from './runs';
|
|
4
6
|
import type { Agents, GraphEdge } from './agents';
|
|
5
|
-
import type { ContentTypes } from './runs';
|
|
6
7
|
import type { TFile } from './files';
|
|
7
8
|
import { ArtifactModes } from 'src/artifacts';
|
|
8
9
|
export { STATEFUL_CODE_ENVIRONMENTS, resolveStatefulCodeEnvironment, resolveAllowedStatefulCodeEnvironments, } from '../stateful-code';
|
|
@@ -267,11 +268,20 @@ export type AgentSubagentsConfig = {
|
|
|
267
268
|
enabled?: boolean;
|
|
268
269
|
/** When true (default), the agent may spawn itself in an isolated context. */
|
|
269
270
|
allowSelf?: boolean;
|
|
271
|
+
/** Share current-turn files with authorized descendants. Off unless explicitly enabled. */
|
|
272
|
+
shareFiles?: boolean;
|
|
270
273
|
/** Specific agents that may be spawned as subagents. */
|
|
271
274
|
agent_ids?: string[];
|
|
272
275
|
/** Explicit saved-agent teams that may be spawned as bounded child graphs. */
|
|
273
276
|
graphs?: AgentSubagentGraph[];
|
|
274
277
|
};
|
|
278
|
+
export type AgentGitIdentity = {
|
|
279
|
+
/** Commit author and committer display name. */
|
|
280
|
+
name: string;
|
|
281
|
+
/** Commit author and committer email address. */
|
|
282
|
+
email: string;
|
|
283
|
+
};
|
|
284
|
+
export declare const agentGitIdentitySchema: z.ZodType<AgentGitIdentity | undefined>;
|
|
275
285
|
export type Agent = {
|
|
276
286
|
_id?: string;
|
|
277
287
|
id: string;
|
|
@@ -304,6 +314,10 @@ export type Agent = {
|
|
|
304
314
|
stateful_code_environment?: StatefulCodeEnvironment;
|
|
305
315
|
/** Operator-configured managed or attached stateful execution environment. */
|
|
306
316
|
code_environment_id?: string | null;
|
|
317
|
+
/** Default attached workspace for new chats; empty means no agent default. */
|
|
318
|
+
code_workspace_id?: string;
|
|
319
|
+
/** Non-secret Git authorship injected into this agent's sandboxed commands. */
|
|
320
|
+
git_identity?: AgentGitIdentity | null;
|
|
307
321
|
artifacts?: ArtifactModes;
|
|
308
322
|
recursion_limit?: number;
|
|
309
323
|
isPublic?: boolean;
|
|
@@ -344,6 +358,7 @@ export type Agent = {
|
|
|
344
358
|
};
|
|
345
359
|
export type TAgentsMap = Record<string, Agent | undefined>;
|
|
346
360
|
export type AgentCreateParams = {
|
|
361
|
+
git_identity?: AgentGitIdentity;
|
|
347
362
|
name?: string | null;
|
|
348
363
|
description?: string | null;
|
|
349
364
|
avatar?: AgentAvatar | null;
|
|
@@ -353,7 +368,7 @@ export type AgentCreateParams = {
|
|
|
353
368
|
provider: AgentProvider;
|
|
354
369
|
model: string | null;
|
|
355
370
|
model_parameters: AgentModelParameters;
|
|
356
|
-
} & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'stateful_code_sessions' | 'stateful_code_environment' | 'code_environment_id' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options' | 'skills' | 'skills_enabled' | 'skill_authoring_enabled' | 'skills_scope' | 'subagents' | 'memory_scope'>;
|
|
371
|
+
} & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'stateful_code_sessions' | 'stateful_code_environment' | 'code_environment_id' | 'code_workspace_id' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options' | 'skills' | 'skills_enabled' | 'skill_authoring_enabled' | 'skills_scope' | 'subagents' | 'memory_scope'>;
|
|
357
372
|
export type AgentUpdateParams = {
|
|
358
373
|
name?: string | null;
|
|
359
374
|
description?: string | null;
|
|
@@ -365,7 +380,7 @@ export type AgentUpdateParams = {
|
|
|
365
380
|
provider?: AgentProvider;
|
|
366
381
|
model?: string | null;
|
|
367
382
|
model_parameters?: AgentModelParameters;
|
|
368
|
-
} & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'stateful_code_sessions' | 'stateful_code_environment' | 'code_environment_id' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options' | 'skills' | 'skills_enabled' | 'skill_authoring_enabled' | 'skills_scope' | 'subagents' | 'memory_scope'>;
|
|
383
|
+
} & Pick<Agent, 'agent_ids' | 'edges' | 'end_after_tools' | 'hide_sequential_outputs' | 'stateful_code_sessions' | 'stateful_code_environment' | 'code_environment_id' | 'git_identity' | 'code_workspace_id' | 'artifacts' | 'recursion_limit' | 'category' | 'support_contact' | 'tool_options' | 'skills' | 'skills_enabled' | 'skill_authoring_enabled' | 'skills_scope' | 'subagents' | 'memory_scope'>;
|
|
369
384
|
export type AgentListParams = {
|
|
370
385
|
limit?: number;
|
|
371
386
|
requiredPermission: number;
|
|
@@ -513,6 +528,8 @@ export declare enum RunStatus {
|
|
|
513
528
|
EXPIRED = "expired"
|
|
514
529
|
}
|
|
515
530
|
export type PartMetadata = {
|
|
531
|
+
/** Host-resolved execution identity for a saved subagent invocation. */
|
|
532
|
+
subagentIdentity?: SubagentIdentity;
|
|
516
533
|
progress?: number;
|
|
517
534
|
asset_pointer?: string;
|
|
518
535
|
status?: string;
|
|
@@ -575,6 +592,13 @@ export type SummaryContentPart = {
|
|
|
575
592
|
}>;
|
|
576
593
|
tokenCount?: number;
|
|
577
594
|
summarizing?: boolean;
|
|
595
|
+
/** A summarize round that ended in error. Partial deltas already streamed
|
|
596
|
+
* into this slot are kept, so the renderer needs this to avoid presenting
|
|
597
|
+
* truncated text under the "Conversation summarized" label. */
|
|
598
|
+
failed?: boolean;
|
|
599
|
+
/** Set when the user compacted the context manually rather than the
|
|
600
|
+
* automatic detour firing on context pressure. */
|
|
601
|
+
initiatedBy?: 'user';
|
|
578
602
|
summaryVersion?: number;
|
|
579
603
|
model?: string;
|
|
580
604
|
provider?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TDefaultLLMDeliveryPathConfig } from '../file-config';
|
|
1
2
|
import type { CodeEnvRef, CodeEnvRefMap } from '../codeEnvRef';
|
|
2
3
|
import { EToolResources } from './assistants';
|
|
3
4
|
export declare enum FileSources {
|
|
@@ -26,6 +27,7 @@ export declare enum FileContext {
|
|
|
26
27
|
image_generation = "image_generation",
|
|
27
28
|
assistants_output = "assistants_output",
|
|
28
29
|
message_attachment = "message_attachment",
|
|
30
|
+
run_artifact = "run_artifact",
|
|
29
31
|
skill_file = "skill_file",
|
|
30
32
|
filename = "filename",
|
|
31
33
|
updatedAt = "updatedAt",
|
|
@@ -44,6 +46,8 @@ export type EndpointFileConfig = {
|
|
|
44
46
|
fileSizeLimit?: number;
|
|
45
47
|
totalSizeLimit?: number;
|
|
46
48
|
supportedMimeTypes?: RegexLike[];
|
|
49
|
+
defaultLLMDeliveryPath?: TDefaultLLMDeliveryPathConfig;
|
|
50
|
+
legacyFileUploadUX?: boolean;
|
|
47
51
|
};
|
|
48
52
|
export type FileConfig = {
|
|
49
53
|
endpoints: {
|
|
@@ -53,6 +57,10 @@ export type FileConfig = {
|
|
|
53
57
|
fileSizeLimit?: number;
|
|
54
58
|
};
|
|
55
59
|
fileTokenLimit?: number;
|
|
60
|
+
/** Maximum aggregate model-bound attachment bytes admitted into one agent turn. */
|
|
61
|
+
fileContextSizeLimit?: number;
|
|
62
|
+
/** Maximum aggregate extracted-text characters admitted into one agent turn. */
|
|
63
|
+
fileContextCharLimit?: number;
|
|
56
64
|
serverFileSizeLimit?: number;
|
|
57
65
|
avatarSizeLimit?: number;
|
|
58
66
|
clientImageResize?: {
|
|
@@ -73,6 +81,8 @@ export type FileConfig = {
|
|
|
73
81
|
supportedMimeTypes?: RegexLike[];
|
|
74
82
|
};
|
|
75
83
|
checkType?: (fileType: string, supportedTypes: RegexLike[]) => boolean;
|
|
84
|
+
defaultLLMDeliveryPath?: TDefaultLLMDeliveryPathConfig;
|
|
85
|
+
legacyFileUploadUX?: boolean;
|
|
76
86
|
};
|
|
77
87
|
export type FileConfigInput = {
|
|
78
88
|
endpoints?: {
|
|
@@ -83,6 +93,8 @@ export type FileConfigInput = {
|
|
|
83
93
|
};
|
|
84
94
|
serverFileSizeLimit?: number;
|
|
85
95
|
avatarSizeLimit?: number;
|
|
96
|
+
fileContextSizeLimit?: number;
|
|
97
|
+
fileContextCharLimit?: number;
|
|
86
98
|
clientImageResize?: {
|
|
87
99
|
enabled?: boolean;
|
|
88
100
|
maxWidth?: number;
|
|
@@ -99,6 +111,20 @@ export type FileConfigInput = {
|
|
|
99
111
|
supportedMimeTypes?: string[];
|
|
100
112
|
};
|
|
101
113
|
checkType?: (fileType: string, supportedTypes: RegexLike[]) => boolean;
|
|
114
|
+
defaultLLMDeliveryPath?: TDefaultLLMDeliveryPathConfig;
|
|
115
|
+
legacyFileUploadUX?: boolean;
|
|
116
|
+
};
|
|
117
|
+
/** The immutable origin of a file explicitly published from an agent execution. */
|
|
118
|
+
export type RunFileProvenance = {
|
|
119
|
+
runId: string;
|
|
120
|
+
executionId: string;
|
|
121
|
+
agentId: string;
|
|
122
|
+
parentExecutionId?: string;
|
|
123
|
+
parentAgentId?: string;
|
|
124
|
+
recipientAgentIds?: string[];
|
|
125
|
+
sourceFileId: string;
|
|
126
|
+
publishedAt: string;
|
|
127
|
+
inputFileIds: string[];
|
|
102
128
|
};
|
|
103
129
|
export type TFile = {
|
|
104
130
|
_id?: string;
|
|
@@ -150,6 +176,7 @@ export type TFile = {
|
|
|
150
176
|
*/
|
|
151
177
|
previewError?: string;
|
|
152
178
|
metadata?: {
|
|
179
|
+
runFile?: RunFileProvenance;
|
|
153
180
|
fileIdentifier?: string;
|
|
154
181
|
/**
|
|
155
182
|
* Structured form of `fileIdentifier`. Persisted alongside the
|
|
@@ -160,7 +187,14 @@ export type TFile = {
|
|
|
160
187
|
codeEnvRefs?: CodeEnvRefMap;
|
|
161
188
|
/** Dispatch-order stamp for the current source artifact generation. */
|
|
162
189
|
sourceDispatchedAt?: number;
|
|
190
|
+
/** Vector namespaces this file has been embedded into. */
|
|
191
|
+
embeddedEntities?: string[];
|
|
192
|
+
/** The user named this destination, so absent ones were declined. */
|
|
193
|
+
destinationChosen?: boolean;
|
|
194
|
+
/** The type the delivery route was resolved against, when conversion changed it. */
|
|
195
|
+
routingMimeType?: string;
|
|
163
196
|
};
|
|
197
|
+
llmDeliveryPath?: 'provider' | 'text' | 'none';
|
|
164
198
|
createdAt?: string | Date;
|
|
165
199
|
updatedAt?: string | Date;
|
|
166
200
|
};
|
|
@@ -2,15 +2,21 @@ export type InsightsRange = '24h' | '7d' | '30d' | 'custom';
|
|
|
2
2
|
export declare const INSIGHTS_MAX_RANGE_DAYS = 30;
|
|
3
3
|
export declare const INSIGHTS_SEARCH_MIN_LENGTH = 3;
|
|
4
4
|
export declare const INSIGHTS_SEARCH_MAX_LENGTH = 200;
|
|
5
|
+
export declare const INSIGHTS_AGENT_ID_MAX_LENGTH = 256;
|
|
5
6
|
export type TInsightsParams = {
|
|
6
7
|
range?: InsightsRange;
|
|
7
8
|
fromTimestamp?: string;
|
|
8
9
|
toTimestamp?: string;
|
|
9
10
|
timeZone?: string;
|
|
10
11
|
search?: string;
|
|
12
|
+
agentIds?: string[];
|
|
11
13
|
page?: number;
|
|
12
14
|
pageSize?: number;
|
|
13
15
|
};
|
|
16
|
+
export type TInsightsAgent = {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
};
|
|
14
20
|
export type TInsightsDailyPoint = {
|
|
15
21
|
date: string;
|
|
16
22
|
conversations: number;
|
|
@@ -31,6 +37,8 @@ export type TInsightsChurnedUser = TInsightsUser & {
|
|
|
31
37
|
};
|
|
32
38
|
export type TInsightsConversation = {
|
|
33
39
|
conversationId: string;
|
|
40
|
+
agentId: string;
|
|
41
|
+
agentName: string;
|
|
34
42
|
date: string;
|
|
35
43
|
userId: string;
|
|
36
44
|
name: string;
|
|
@@ -46,6 +54,7 @@ export type TInsightsSummary = {
|
|
|
46
54
|
totalTokens: number;
|
|
47
55
|
};
|
|
48
56
|
export type TInsightsResponse = {
|
|
57
|
+
agents: TInsightsAgent[];
|
|
49
58
|
summary: TInsightsSummary;
|
|
50
59
|
daily: TInsightsDailyPoint[];
|
|
51
60
|
topUsers: TInsightsUser[];
|
|
@@ -22,7 +22,7 @@ export type ConversationListParams = {
|
|
|
22
22
|
search?: string;
|
|
23
23
|
projectId?: string;
|
|
24
24
|
};
|
|
25
|
-
export type MinimalConversation = Pick<s.TConversation, 'conversationId' | 'endpoint' | 'title' | 'createdAt' | 'updatedAt' | 'archivedAt' | 'user' | 'chatProjectId' | 'pinned'>;
|
|
25
|
+
export type MinimalConversation = Pick<s.TConversation, 'conversationId' | 'endpoint' | 'title' | 'createdAt' | 'updatedAt' | 'archivedAt' | 'isArchived' | 'user' | 'chatProjectId' | 'pinned'>;
|
|
26
26
|
export type ConversationListResponse = {
|
|
27
27
|
conversations: MinimalConversation[];
|
|
28
28
|
nextCursor: string | null;
|
|
@@ -103,6 +103,10 @@ export type MCPServer = {
|
|
|
103
103
|
name: string;
|
|
104
104
|
icon: string;
|
|
105
105
|
authenticated: boolean;
|
|
106
|
+
/** Passive discovery found that stored OAuth authorization must be renewed. */
|
|
107
|
+
authorizationState?: 'reauth_required';
|
|
108
|
+
/** Shared credential/catalog generation observed by passive discovery. */
|
|
109
|
+
authorizationGeneration?: string;
|
|
106
110
|
authConfig: s.TPluginAuthConfig[];
|
|
107
111
|
tools: MCPTool[];
|
|
108
112
|
};
|
|
@@ -194,6 +198,8 @@ export interface MCPServerStatus {
|
|
|
194
198
|
configurationState?: 'configured' | 'needs_configuration';
|
|
195
199
|
connectionState: 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
196
200
|
authorizationState?: 'not_required' | 'authorizing' | 'authorized' | 'needs_authorization' | 'error';
|
|
201
|
+
/** Shared credential/catalog generation observed by the status endpoint. */
|
|
202
|
+
authorizationGeneration?: string;
|
|
197
203
|
}
|
|
198
204
|
export interface MCPConnectionStatusResponse {
|
|
199
205
|
success: boolean;
|
|
@@ -209,6 +215,7 @@ export interface MCPServerConnectionStatusResponse {
|
|
|
209
215
|
configurationState?: MCPServerStatus['configurationState'];
|
|
210
216
|
connectionStatus: 'disconnected' | 'connecting' | 'connected' | 'error';
|
|
211
217
|
authorizationState?: MCPServerStatus['authorizationState'];
|
|
218
|
+
authorizationGeneration?: string;
|
|
212
219
|
}
|
|
213
220
|
export interface MCPAuthValuesResponse {
|
|
214
221
|
success: boolean;
|
|
@@ -62,9 +62,9 @@ export declare const enqueueAgentQueuedTurnSchema: z.ZodObject<{
|
|
|
62
62
|
priority: z.ZodOptional<z.ZodBoolean>;
|
|
63
63
|
expectedPredecessorCreatedAt: z.ZodOptional<z.ZodNumber>;
|
|
64
64
|
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
text: string;
|
|
65
66
|
conversationId: string;
|
|
66
67
|
parentMessageId: string;
|
|
67
|
-
text: string;
|
|
68
68
|
clientRequestId: string;
|
|
69
69
|
manualSkills?: string[] | undefined;
|
|
70
70
|
quotes?: string[] | undefined;
|
|
@@ -80,9 +80,9 @@ export declare const enqueueAgentQueuedTurnSchema: z.ZodObject<{
|
|
|
80
80
|
}[] | undefined;
|
|
81
81
|
priority?: boolean | undefined;
|
|
82
82
|
}, {
|
|
83
|
+
text: string;
|
|
83
84
|
conversationId: string;
|
|
84
85
|
parentMessageId: string;
|
|
85
|
-
text: string;
|
|
86
86
|
clientRequestId: string;
|
|
87
87
|
manualSkills?: string[] | undefined;
|
|
88
88
|
quotes?: string[] | undefined;
|
|
@@ -177,11 +177,11 @@ export declare const agentQueuedTurnReceiptSchema: z.ZodObject<{
|
|
|
177
177
|
updatedAt: z.ZodString;
|
|
178
178
|
}, "strip", z.ZodTypeAny, {
|
|
179
179
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
180
|
+
text: string;
|
|
180
181
|
conversationId: string;
|
|
181
182
|
parentMessageId: string;
|
|
182
183
|
createdAt: string;
|
|
183
184
|
updatedAt: string;
|
|
184
|
-
text: string;
|
|
185
185
|
clientRequestId: string;
|
|
186
186
|
queuedTurnId: string;
|
|
187
187
|
revision: number;
|
|
@@ -207,11 +207,11 @@ export declare const agentQueuedTurnReceiptSchema: z.ZodObject<{
|
|
|
207
207
|
} | undefined;
|
|
208
208
|
}, {
|
|
209
209
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
210
|
+
text: string;
|
|
210
211
|
conversationId: string;
|
|
211
212
|
parentMessageId: string;
|
|
212
213
|
createdAt: string;
|
|
213
214
|
updatedAt: string;
|
|
214
|
-
text: string;
|
|
215
215
|
clientRequestId: string;
|
|
216
216
|
queuedTurnId: string;
|
|
217
217
|
revision: number;
|
|
@@ -314,11 +314,11 @@ export declare const enqueueAgentQueuedTurnResponseSchema: z.ZodObject<{
|
|
|
314
314
|
updatedAt: z.ZodString;
|
|
315
315
|
}, "strip", z.ZodTypeAny, {
|
|
316
316
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
317
|
+
text: string;
|
|
317
318
|
conversationId: string;
|
|
318
319
|
parentMessageId: string;
|
|
319
320
|
createdAt: string;
|
|
320
321
|
updatedAt: string;
|
|
321
|
-
text: string;
|
|
322
322
|
clientRequestId: string;
|
|
323
323
|
queuedTurnId: string;
|
|
324
324
|
revision: number;
|
|
@@ -344,11 +344,11 @@ export declare const enqueueAgentQueuedTurnResponseSchema: z.ZodObject<{
|
|
|
344
344
|
} | undefined;
|
|
345
345
|
}, {
|
|
346
346
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
347
|
+
text: string;
|
|
347
348
|
conversationId: string;
|
|
348
349
|
parentMessageId: string;
|
|
349
350
|
createdAt: string;
|
|
350
351
|
updatedAt: string;
|
|
351
|
-
text: string;
|
|
352
352
|
clientRequestId: string;
|
|
353
353
|
queuedTurnId: string;
|
|
354
354
|
revision: number;
|
|
@@ -392,11 +392,11 @@ export declare const enqueueAgentQueuedTurnResponseSchema: z.ZodObject<{
|
|
|
392
392
|
}, "strip", z.ZodTypeAny, {
|
|
393
393
|
receipt: {
|
|
394
394
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
395
|
+
text: string;
|
|
395
396
|
conversationId: string;
|
|
396
397
|
parentMessageId: string;
|
|
397
398
|
createdAt: string;
|
|
398
399
|
updatedAt: string;
|
|
399
|
-
text: string;
|
|
400
400
|
clientRequestId: string;
|
|
401
401
|
queuedTurnId: string;
|
|
402
402
|
revision: number;
|
|
@@ -430,11 +430,11 @@ export declare const enqueueAgentQueuedTurnResponseSchema: z.ZodObject<{
|
|
|
430
430
|
}, {
|
|
431
431
|
receipt: {
|
|
432
432
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
433
|
+
text: string;
|
|
433
434
|
conversationId: string;
|
|
434
435
|
parentMessageId: string;
|
|
435
436
|
createdAt: string;
|
|
436
437
|
updatedAt: string;
|
|
437
|
-
text: string;
|
|
438
438
|
clientRequestId: string;
|
|
439
439
|
queuedTurnId: string;
|
|
440
440
|
revision: number;
|
|
@@ -527,11 +527,11 @@ export declare const listAgentQueuedTurnsResponseSchema: z.ZodObject<{
|
|
|
527
527
|
updatedAt: z.ZodString;
|
|
528
528
|
}, "strip", z.ZodTypeAny, {
|
|
529
529
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
530
|
+
text: string;
|
|
530
531
|
conversationId: string;
|
|
531
532
|
parentMessageId: string;
|
|
532
533
|
createdAt: string;
|
|
533
534
|
updatedAt: string;
|
|
534
|
-
text: string;
|
|
535
535
|
clientRequestId: string;
|
|
536
536
|
queuedTurnId: string;
|
|
537
537
|
revision: number;
|
|
@@ -557,11 +557,11 @@ export declare const listAgentQueuedTurnsResponseSchema: z.ZodObject<{
|
|
|
557
557
|
} | undefined;
|
|
558
558
|
}, {
|
|
559
559
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
560
|
+
text: string;
|
|
560
561
|
conversationId: string;
|
|
561
562
|
parentMessageId: string;
|
|
562
563
|
createdAt: string;
|
|
563
564
|
updatedAt: string;
|
|
564
|
-
text: string;
|
|
565
565
|
clientRequestId: string;
|
|
566
566
|
queuedTurnId: string;
|
|
567
567
|
revision: number;
|
|
@@ -613,11 +613,11 @@ export declare const listAgentQueuedTurnsResponseSchema: z.ZodObject<{
|
|
|
613
613
|
};
|
|
614
614
|
queuedTurns: {
|
|
615
615
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
616
|
+
text: string;
|
|
616
617
|
conversationId: string;
|
|
617
618
|
parentMessageId: string;
|
|
618
619
|
createdAt: string;
|
|
619
620
|
updatedAt: string;
|
|
620
|
-
text: string;
|
|
621
621
|
clientRequestId: string;
|
|
622
622
|
queuedTurnId: string;
|
|
623
623
|
revision: number;
|
|
@@ -652,11 +652,11 @@ export declare const listAgentQueuedTurnsResponseSchema: z.ZodObject<{
|
|
|
652
652
|
};
|
|
653
653
|
queuedTurns: {
|
|
654
654
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
655
|
+
text: string;
|
|
655
656
|
conversationId: string;
|
|
656
657
|
parentMessageId: string;
|
|
657
658
|
createdAt: string;
|
|
658
659
|
updatedAt: string;
|
|
659
|
-
text: string;
|
|
660
660
|
clientRequestId: string;
|
|
661
661
|
queuedTurnId: string;
|
|
662
662
|
revision: number;
|
|
@@ -743,11 +743,11 @@ export declare const cancelAgentQueuedTurnResponseSchema: z.ZodObject<{
|
|
|
743
743
|
updatedAt: z.ZodString;
|
|
744
744
|
}, "strip", z.ZodTypeAny, {
|
|
745
745
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
746
|
+
text: string;
|
|
746
747
|
conversationId: string;
|
|
747
748
|
parentMessageId: string;
|
|
748
749
|
createdAt: string;
|
|
749
750
|
updatedAt: string;
|
|
750
|
-
text: string;
|
|
751
751
|
clientRequestId: string;
|
|
752
752
|
queuedTurnId: string;
|
|
753
753
|
revision: number;
|
|
@@ -773,11 +773,11 @@ export declare const cancelAgentQueuedTurnResponseSchema: z.ZodObject<{
|
|
|
773
773
|
} | undefined;
|
|
774
774
|
}, {
|
|
775
775
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
776
|
+
text: string;
|
|
776
777
|
conversationId: string;
|
|
777
778
|
parentMessageId: string;
|
|
778
779
|
createdAt: string;
|
|
779
780
|
updatedAt: string;
|
|
780
|
-
text: string;
|
|
781
781
|
clientRequestId: string;
|
|
782
782
|
queuedTurnId: string;
|
|
783
783
|
revision: number;
|
|
@@ -805,11 +805,11 @@ export declare const cancelAgentQueuedTurnResponseSchema: z.ZodObject<{
|
|
|
805
805
|
}, "strip", z.ZodTypeAny, {
|
|
806
806
|
receipt: {
|
|
807
807
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
808
|
+
text: string;
|
|
808
809
|
conversationId: string;
|
|
809
810
|
parentMessageId: string;
|
|
810
811
|
createdAt: string;
|
|
811
812
|
updatedAt: string;
|
|
812
|
-
text: string;
|
|
813
813
|
clientRequestId: string;
|
|
814
814
|
queuedTurnId: string;
|
|
815
815
|
revision: number;
|
|
@@ -837,11 +837,11 @@ export declare const cancelAgentQueuedTurnResponseSchema: z.ZodObject<{
|
|
|
837
837
|
}, {
|
|
838
838
|
receipt: {
|
|
839
839
|
status: "cancelled" | "queued" | "claimed" | "admitted" | "dead";
|
|
840
|
+
text: string;
|
|
840
841
|
conversationId: string;
|
|
841
842
|
parentMessageId: string;
|
|
842
843
|
createdAt: string;
|
|
843
844
|
updatedAt: string;
|
|
844
|
-
text: string;
|
|
845
845
|
clientRequestId: string;
|
|
846
846
|
queuedTurnId: string;
|
|
847
847
|
revision: number;
|
|
@@ -234,6 +234,10 @@ export type TTokenBudgetBreakdown = {
|
|
|
234
234
|
toolTokenCounts?: Record<string, number>;
|
|
235
235
|
/** Names of counted tools that are deferred (`defer_loading`) and discovered */
|
|
236
236
|
deferredToolNames?: string[];
|
|
237
|
+
/** Calibrated retained tool traffic: tool results plus assistant turns made only of tool calls, inline provider tool results and reasoning. A subset of messageTokens, not an additional budget category. */
|
|
238
|
+
toolMessageTokens?: number;
|
|
239
|
+
/** Per-tool result-message share; excludes assistant invocation overhead. */
|
|
240
|
+
toolMessageTokenCounts?: Record<string, number>;
|
|
237
241
|
};
|
|
238
242
|
/** Per-model-call context snapshot, dispatched after pruning and before the LLM call. */
|
|
239
243
|
export type TContextUsageEvent = {
|
|
@@ -249,12 +253,21 @@ export type TContextUsageEvent = {
|
|
|
249
253
|
/** Tokens still free after instructions + pruned messages */
|
|
250
254
|
remainingContextTokens?: number;
|
|
251
255
|
calibrationRatio?: number;
|
|
256
|
+
/** Model and provider of the reconciling primary call, retained across reloads. */
|
|
257
|
+
model?: string;
|
|
258
|
+
provider?: string;
|
|
259
|
+
/** Cache portions of that call's prompt, in normalized display units. */
|
|
260
|
+
cacheRead?: number;
|
|
261
|
+
cacheWrite?: number;
|
|
252
262
|
/** Output tokens of the response's final model call (the call this pre-invoke
|
|
253
|
-
* snapshot precedes).
|
|
254
|
-
*
|
|
263
|
+
* snapshot precedes). Saved in message metadata and used by the client so a
|
|
264
|
+
* reloaded multi-call turn adds the same post-snapshot delta the
|
|
255
265
|
* live finalizer did — not the full response `tokenCount`, which the snapshot
|
|
256
266
|
* already includes for earlier steps. */
|
|
257
267
|
completedOutputTokens?: number;
|
|
268
|
+
/** Completed output in a resumable job. Separate from the saved-message field
|
|
269
|
+
* so older clients do not add it alongside their trailing-text estimate. */
|
|
270
|
+
resumedOutputTokens?: number;
|
|
258
271
|
};
|
|
259
272
|
/**
|
|
260
273
|
* Per-response usage rollup persisted on `responseMessage.metadata.usage`, in
|
|
@@ -310,14 +323,19 @@ export declare const promptTokensFromUsage: (event: TTokenUsageEvent) => number;
|
|
|
310
323
|
/**
|
|
311
324
|
* Reconciles a pre-invoke context snapshot's CALIBRATED estimate to a call's
|
|
312
325
|
* ACTUAL prompt tokens. The SDK's calibration multiplier scales only
|
|
313
|
-
* `messageTokens` (instructions/summary are raw tiktoken counts)
|
|
326
|
+
* `messageTokens` (instructions/summary are raw tiktoken counts) and can
|
|
314
327
|
* over-shoot badly when a provider injects server-side content the SDK never
|
|
315
328
|
* counted (e.g. Anthropic web search) — pinning the gauge several× too high and
|
|
316
329
|
* persisting it. Trust the provider's own prompt count: keep the raw
|
|
317
|
-
* instruction/summary rows, set `messageTokens` to the remainder,
|
|
318
|
-
*
|
|
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.
|
|
319
333
|
*/
|
|
320
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;
|
|
321
339
|
/** Lifecycle phase carried on subagent-progress envelopes (mirrors SDK SubagentUpdatePhase). */
|
|
322
340
|
export type SubagentUpdatePhase = 'start' | 'run_step' | 'run_step_delta' | 'run_step_completed' | 'run_step_closed' | 'message_delta' | 'reasoning_delta' | 'stop' | 'error';
|
|
323
341
|
/** Structured root-to-leaf identity for one nested subagent execution. */
|
|
@@ -331,6 +349,7 @@ export interface SubagentAncestryEntry {
|
|
|
331
349
|
readonly parentAgentId?: string;
|
|
332
350
|
readonly parentToolCallId?: string;
|
|
333
351
|
}
|
|
352
|
+
export type SubagentIdentity = Pick<SubagentAncestryEntry, 'subagentKind' | 'subagentAgentId'>;
|
|
334
353
|
/** Single streamed subagent update forwarded by the SDK's SubagentExecutor. */
|
|
335
354
|
export interface SubagentUpdateEvent {
|
|
336
355
|
runId: string;
|