veryfront 0.1.220 → 0.1.222

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 (44) hide show
  1. package/esm/deno.d.ts +0 -3
  2. package/esm/deno.js +1 -4
  3. package/esm/src/agent/ag-ui-detached-start.d.ts.map +1 -1
  4. package/esm/src/agent/ag-ui-detached-start.js +2 -77
  5. package/esm/src/agent/ag-ui-handler.d.ts +1 -66
  6. package/esm/src/agent/ag-ui-handler.d.ts.map +1 -1
  7. package/esm/src/agent/ag-ui-handler.js +8 -136
  8. package/esm/src/agent/ag-ui-host-support.d.ts +76 -0
  9. package/esm/src/agent/ag-ui-host-support.d.ts.map +1 -0
  10. package/esm/src/agent/ag-ui-host-support.js +182 -0
  11. package/esm/src/agent/index.d.ts +2 -1
  12. package/esm/src/agent/index.d.ts.map +1 -1
  13. package/esm/src/agent/index.js +2 -1
  14. package/esm/src/agent/runtime-ag-ui-contract.d.ts +2 -0
  15. package/esm/src/agent/runtime-ag-ui-contract.d.ts.map +1 -1
  16. package/esm/src/agent/runtime-ag-ui-contract.js +26 -0
  17. package/esm/src/platform/compat/media-types.d.ts.map +1 -1
  18. package/esm/src/platform/compat/media-types.js +6 -6
  19. package/esm/src/react/components/chat/theme.d.ts +1 -1
  20. package/esm/src/react/components/chat/theme.d.ts.map +1 -1
  21. package/esm/src/react/components/chat/theme.js +1 -1
  22. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  23. package/esm/src/server/handlers/dev/framework-candidates.generated.js +1 -0
  24. package/esm/src/utils/clsx.d.ts +14 -0
  25. package/esm/src/utils/clsx.d.ts.map +1 -0
  26. package/esm/src/utils/clsx.js +32 -0
  27. package/esm/src/utils/mime-types.d.ts +42 -0
  28. package/esm/src/utils/mime-types.d.ts.map +1 -0
  29. package/esm/src/utils/mime-types.js +148 -0
  30. package/esm/src/utils/version-constant.d.ts +1 -1
  31. package/esm/src/utils/version-constant.js +1 -1
  32. package/package.json +1 -3
  33. package/src/deno.js +1 -4
  34. package/src/src/agent/ag-ui-detached-start.ts +7 -93
  35. package/src/src/agent/ag-ui-handler.ts +23 -176
  36. package/src/src/agent/ag-ui-host-support.ts +238 -0
  37. package/src/src/agent/index.ts +10 -0
  38. package/src/src/agent/runtime-ag-ui-contract.ts +37 -0
  39. package/src/src/platform/compat/media-types.ts +10 -6
  40. package/src/src/react/components/chat/theme.ts +1 -1
  41. package/src/src/server/handlers/dev/framework-candidates.generated.ts +1 -0
  42. package/src/src/utils/clsx.ts +40 -0
  43. package/src/src/utils/mime-types.ts +155 -0
  44. package/src/src/utils/version-constant.ts +1 -1
@@ -0,0 +1,182 @@
1
+ import { z } from "zod";
2
+ import { formatAgUiEvent } from "../internal-agents/ag-ui-sse.js";
3
+ const AGENT_ID_PATTERN = /^[a-zA-Z0-9_-]+$/;
4
+ const MAX_TOOL_PARAMETERS_BYTES = 16_384;
5
+ const MAX_CONTEXT_ITEM_BYTES = 16_384;
6
+ const MAX_CONTEXT_TOTAL_BYTES = 65_536;
7
+ const MAX_FORWARDED_PROPS_BYTES = 65_536;
8
+ const MAX_TEXT_PART_LENGTH = 10_000;
9
+ const MAX_MESSAGES_PER_REQUEST = 100;
10
+ const encoder = new TextEncoder();
11
+ const decoder = new TextDecoder();
12
+ function isWithinJsonSizeLimit(value, maxBytes) {
13
+ try {
14
+ return encoder.encode(JSON.stringify(value)).byteLength <= maxBytes;
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }
20
+ function isRecord(value) {
21
+ return typeof value === "object" && value !== null && !Array.isArray(value);
22
+ }
23
+ const AgUiRunIdSchema = z.string().min(1).max(128).regex(AGENT_ID_PATTERN);
24
+ export const AgUiInjectedToolSchema = z.object({
25
+ name: z.string().min(1).max(128),
26
+ description: z.string().max(1024).optional(),
27
+ parameters: z.record(z.string(), z.unknown()).optional().refine((value) => value === undefined || isWithinJsonSizeLimit(value, MAX_TOOL_PARAMETERS_BYTES), { message: "Tool parameters must be less than 16 KB" }),
28
+ });
29
+ export const AgUiContextItemSchema = z.discriminatedUnion("type", [
30
+ z.object({
31
+ type: z.literal("text"),
32
+ title: z.string().max(256).optional(),
33
+ text: z.string().max(MAX_CONTEXT_ITEM_BYTES),
34
+ }),
35
+ z.object({
36
+ type: z.literal("json"),
37
+ title: z.string().max(256).optional(),
38
+ data: z.record(z.string(), z.unknown()).refine((value) => isWithinJsonSizeLimit(value, MAX_CONTEXT_ITEM_BYTES), { message: "JSON context item must be less than 16 KB" }),
39
+ }),
40
+ z.object({
41
+ type: z.literal("resource"),
42
+ title: z.string().max(256).optional(),
43
+ uri: z.string().max(2048),
44
+ mimeType: z.string().max(256).optional(),
45
+ text: z.string().max(MAX_CONTEXT_ITEM_BYTES).optional(),
46
+ }),
47
+ ]);
48
+ const AgUiMessagePartSchema = z.object({ type: z.string().min(1) }).passthrough();
49
+ const AgUiMessageSchema = z.object({
50
+ id: z.string().min(1),
51
+ role: z.enum(["user", "assistant", "system", "tool"]),
52
+ parts: z.array(AgUiMessagePartSchema).default([]),
53
+ metadata: z.record(z.string(), z.unknown()).optional(),
54
+ createdAt: z.string().optional(),
55
+ });
56
+ export const AgUiRequestSchema = z.object({
57
+ threadId: z.string().uuid().optional(),
58
+ runId: AgUiRunIdSchema.optional(),
59
+ messages: z.array(AgUiMessageSchema).min(1).max(MAX_MESSAGES_PER_REQUEST),
60
+ tools: z.array(AgUiInjectedToolSchema).max(50).default([]),
61
+ context: z.array(AgUiContextItemSchema).max(10).default([]).refine((value) => isWithinJsonSizeLimit(value, MAX_CONTEXT_TOTAL_BYTES), { message: "context must be less than 64 KB total" }),
62
+ forwardedProps: z.record(z.string(), z.unknown()).optional().refine((value) => value === undefined || isWithinJsonSizeLimit(value, MAX_FORWARDED_PROPS_BYTES), { message: "forwardedProps must be less than 64 KB" }),
63
+ model: z.string().optional(),
64
+ maxOutputTokens: z.number().int().positive().optional(),
65
+ });
66
+ function normalizeToolArgs(part) {
67
+ if (isRecord(part.args))
68
+ return part.args;
69
+ if (isRecord(part.input))
70
+ return part.input;
71
+ return {};
72
+ }
73
+ function normalizeMessagePart(part) {
74
+ if (part.type === "text" && typeof part.text === "string" &&
75
+ part.text.length <= MAX_TEXT_PART_LENGTH) {
76
+ return { type: "text", text: part.text };
77
+ }
78
+ if (part.type === "tool_call" && typeof part.id === "string" && typeof part.name === "string") {
79
+ return {
80
+ type: "tool-call",
81
+ toolCallId: part.id,
82
+ toolName: part.name,
83
+ args: normalizeToolArgs(part),
84
+ };
85
+ }
86
+ if (part.type === "tool-call" &&
87
+ typeof part.toolCallId === "string" &&
88
+ typeof part.toolName === "string") {
89
+ return {
90
+ type: "tool-call",
91
+ toolCallId: part.toolCallId,
92
+ toolName: part.toolName,
93
+ args: normalizeToolArgs(part),
94
+ };
95
+ }
96
+ if (typeof part.type === "string" &&
97
+ part.type.startsWith("tool-") &&
98
+ part.type !== "tool-result" &&
99
+ typeof part.toolCallId === "string" &&
100
+ typeof part.toolName === "string") {
101
+ return {
102
+ type: part.type,
103
+ toolCallId: part.toolCallId,
104
+ toolName: part.toolName,
105
+ args: normalizeToolArgs(part),
106
+ };
107
+ }
108
+ if (part.type === "tool_result" && typeof part.tool_call_id === "string") {
109
+ return {
110
+ type: "tool-result",
111
+ toolCallId: part.tool_call_id,
112
+ toolName: typeof part.tool_name === "string" ? part.tool_name : "unknown",
113
+ result: "output" in part ? part.output : undefined,
114
+ };
115
+ }
116
+ if (part.type === "tool-result" && typeof part.toolCallId === "string") {
117
+ return {
118
+ type: "tool-result",
119
+ toolCallId: part.toolCallId,
120
+ toolName: typeof part.toolName === "string" ? part.toolName : "unknown",
121
+ result: "result" in part ? part.result : undefined,
122
+ };
123
+ }
124
+ return null;
125
+ }
126
+ export async function parseAgUiRequest(request) {
127
+ return AgUiRequestSchema.parse(await request.json());
128
+ }
129
+ export async function parseAgUiRequestOrError(request) {
130
+ try {
131
+ return await parseAgUiRequest(request);
132
+ }
133
+ catch (error) {
134
+ if (error instanceof z.ZodError) {
135
+ return Response.json({
136
+ error: "Invalid AG-UI request",
137
+ details: error.issues.map((issue) => ({
138
+ path: issue.path,
139
+ message: issue.message,
140
+ })),
141
+ }, { status: 400 });
142
+ }
143
+ if (error instanceof SyntaxError || error instanceof TypeError) {
144
+ return Response.json({
145
+ error: "Invalid AG-UI request",
146
+ details: [{ path: [], message: "Malformed JSON request body" }],
147
+ }, { status: 400 });
148
+ }
149
+ throw error;
150
+ }
151
+ }
152
+ export function normalizeAgUiMessages(messages) {
153
+ return messages.map((message) => ({
154
+ id: message.id,
155
+ role: message.role,
156
+ parts: message.parts
157
+ .map((part) => normalizeMessagePart(part))
158
+ .filter((part) => part !== null),
159
+ ...(message.createdAt ? { timestamp: Date.parse(message.createdAt) || undefined } : {}),
160
+ ...(message.metadata ? { metadata: message.metadata } : {}),
161
+ }));
162
+ }
163
+ export function createAgUiRunErrorEvent(message, code) {
164
+ return {
165
+ event: "RunError",
166
+ payload: {
167
+ message,
168
+ ...(code ? { code } : {}),
169
+ },
170
+ };
171
+ }
172
+ export function createAgUiSseErrorResponse(event, status) {
173
+ return new Response(decoder.decode(formatAgUiEvent(event.event, event.payload)), {
174
+ status,
175
+ headers: {
176
+ "Content-Type": "text/event-stream; charset=utf-8",
177
+ "Cache-Control": "no-cache, no-transform",
178
+ "Connection": "keep-alive",
179
+ "X-Accel-Buffering": "no",
180
+ },
181
+ });
182
+ }
@@ -84,12 +84,13 @@ export { getTextFromParts, getToolArguments, hasArgs, hasInput } from "./types.j
84
84
  export { BufferMemory, ConversationMemory, createMemory, createRedisMemory, type Memory, type MemoryPersistence, type MemoryStats, type RedisClient, RedisMemory, type RedisMemoryConfig, SummaryMemory, } from "./memory/index.js";
85
85
  export { agentAsTool, createWorkflow, getAgent, getAgentsAsTools, getAllAgentIds, registerAgent, type WorkflowConfig, type WorkflowResult, type WorkflowStep, } from "./composition/index.js";
86
86
  export { agent } from "./factory.js";
87
- export { type AgUiRuntimeContextItem, AgUiRuntimeContextItemSchema, type AgUiRuntimeInjectedTool, AgUiRuntimeInjectedToolSchema, type AgUiRuntimeMessage, AgUiRuntimeMessageSchema, type AgUiRuntimeRequest, AgUiRuntimeRequestSchema, } from "./runtime-ag-ui-contract.js";
87
+ export { type AgUiRuntimeContextItem, AgUiRuntimeContextItemSchema, type AgUiRuntimeInjectedTool, AgUiRuntimeInjectedToolSchema, type AgUiRuntimeMessage, AgUiRuntimeMessageSchema, type AgUiRuntimeRequest, AgUiRuntimeRequestSchema, parseAgUiRuntimeRequest, parseAgUiRuntimeRequestOrError, } from "./runtime-ag-ui-contract.js";
88
88
  export { type AgUiBrowserEncodedEvent, type AgUiBrowserEncoderState, type AgUiBrowserRunFinishedMetadata, type AgUiRuntimeStreamEvent, createAgUiBrowserEncoderState, finalizeAgUiBrowserEvents, mapRuntimeStreamEventToAgUiBrowserEvents, } from "./ag-ui-browser-encoder.js";
89
89
  export { mergeToolCallInput, mergeToolInputDelta, parseDataStreamSseEvents, parseToolInputObject, streamDataStreamEvents, stripLeadingEmptyObjectPlaceholder, } from "./data-stream.js";
90
90
  export { expandAllowedRemoteToolNames, getProviderNativeToolNames, type ProviderNativeToolInventoryOptions, } from "./provider-native-tool-inventory.js";
91
91
  export { type AgUiDetachedStartAccepted, AgUiDetachedStartAcceptedSchema, type AgUiDetachedStartHandlerOptions, type AgUiDetachedStartRequest, AgUiDetachedStartRequestSchema, createAgUiDetachedStartHandler, } from "./ag-ui-detached-start.js";
92
92
  export { type AgUiCancelHandlerOptions, type AgUiResumeHandlerOptions, type AgUiResumeSignal, AgUiResumeSignalSchema, createAgUiCancelHandler, createAgUiResumeHandler, } from "./ag-ui-run-control.js";
93
+ export { type AgUiSseEvent, createAgUiRunErrorEvent, createAgUiSseErrorResponse, normalizeAgUiMessages, parseAgUiRequest, parseAgUiRequestOrError, } from "./ag-ui-host-support.js";
93
94
  export { type AgUiContextItem, type AgUiHandlerConfigWithAgent, type AgUiHandlerOptions, type AgUiInjectedTool, type AgUiRequest, AgUiRequestSchema, createAgUiHandler, } from "./ag-ui-handler.js";
94
95
  export { type HumanInputField, type HumanInputFieldInput, HumanInputFieldSchema, type HumanInputOption, HumanInputOptionSchema, type HumanInputPendingRequest, HumanInputPendingRequestSchema, type HumanInputRequest, type HumanInputRequestInput, HumanInputRequestSchema, type HumanInputResult, HumanInputResultSchema, HumanInputResumeError, InvalidHumanInputResultError, waitForHumanInput, type WaitForHumanInputOptions, } from "./human-input.js";
95
96
  export { type ChatHandlerBeforeStream, type ChatHandlerBeforeStreamContext, type ChatHandlerBeforeStreamResult, type ChatHandlerConfigWithAgent, type ChatHandlerMessageInput, type ChatHandlerOptions, createChatHandler, } from "./chat-handler.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,OAAO,yBAAyB,CAAC;AAGjC,YAAY,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,OAAO,IAAI,YAAY,EACvB,WAAW,EACX,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEnF,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,K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AkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,OAAO,yBAAyB,CAAC;AAGjC,YAAY,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,OAAO,IAAI,YAAY,EACvB,WAAW,EACX,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,sBAAsB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,EACnC,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
@@ -83,12 +83,13 @@ export { getTextFromParts, getToolArguments, hasArgs, hasInput } from "./types.j
83
83
  export { BufferMemory, ConversationMemory, createMemory, createRedisMemory, RedisMemory, SummaryMemory, } from "./memory/index.js";
84
84
  export { agentAsTool, createWorkflow, getAgent, getAgentsAsTools, getAllAgentIds, registerAgent, } from "./composition/index.js";
85
85
  export { agent } from "./factory.js";
86
- export { AgUiRuntimeContextItemSchema, AgUiRuntimeInjectedToolSchema, AgUiRuntimeMessageSchema, AgUiRuntimeRequestSchema, } from "./runtime-ag-ui-contract.js";
86
+ export { AgUiRuntimeContextItemSchema, AgUiRuntimeInjectedToolSchema, AgUiRuntimeMessageSchema, AgUiRuntimeRequestSchema, parseAgUiRuntimeRequest, parseAgUiRuntimeRequestOrError, } from "./runtime-ag-ui-contract.js";
87
87
  export { createAgUiBrowserEncoderState, finalizeAgUiBrowserEvents, mapRuntimeStreamEventToAgUiBrowserEvents, } from "./ag-ui-browser-encoder.js";
88
88
  export { mergeToolCallInput, mergeToolInputDelta, parseDataStreamSseEvents, parseToolInputObject, streamDataStreamEvents, stripLeadingEmptyObjectPlaceholder, } from "./data-stream.js";
89
89
  export { expandAllowedRemoteToolNames, getProviderNativeToolNames, } from "./provider-native-tool-inventory.js";
90
90
  export { AgUiDetachedStartAcceptedSchema, AgUiDetachedStartRequestSchema, createAgUiDetachedStartHandler, } from "./ag-ui-detached-start.js";
91
91
  export { AgUiResumeSignalSchema, createAgUiCancelHandler, createAgUiResumeHandler, } from "./ag-ui-run-control.js";
92
+ export { createAgUiRunErrorEvent, createAgUiSseErrorResponse, normalizeAgUiMessages, parseAgUiRequest, parseAgUiRequestOrError, } from "./ag-ui-host-support.js";
92
93
  export { AgUiRequestSchema, createAgUiHandler, } from "./ag-ui-handler.js";
93
94
  export { HumanInputFieldSchema, HumanInputOptionSchema, HumanInputPendingRequestSchema, HumanInputRequestSchema, HumanInputResultSchema, HumanInputResumeError, InvalidHumanInputResultError, waitForHumanInput, } from "./human-input.js";
94
95
  export { createChatHandler, } from "./chat-handler.js";
@@ -204,4 +204,6 @@ export type AgUiRuntimeInjectedTool = z.infer<typeof AgUiRuntimeInjectedToolSche
204
204
  export type AgUiRuntimeContextItem = z.infer<typeof AgUiRuntimeContextItemSchema>;
205
205
  export type AgUiRuntimeMessage = z.infer<typeof AgUiRuntimeMessageSchema>;
206
206
  export type AgUiRuntimeRequest = z.infer<typeof AgUiRuntimeRequestSchema>;
207
+ export declare function parseAgUiRuntimeRequest(request: Request): Promise<AgUiRuntimeRequest>;
208
+ export declare function parseAgUiRuntimeRequestOrError(request: Request): Promise<AgUiRuntimeRequest | Response>;
207
209
  //# sourceMappingURL=runtime-ag-ui-contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-ag-ui-contract.d.ts","sourceRoot":"","sources":["../../../src/src/agent/runtime-ag-ui-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,sBAAsB,aAAqD,CAAC;AAEzF,eAAO,MAAM,6BAA6B;;;;iBAcxC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;2BAqBvC,CAAC;AAQH,eAAO,MAAM,iCAAiC;;;kBAGnC,CAAC;AAEZ,eAAO,MAAM,yBAAyB;;;;;;;kBAI3B,CAAC;AAEZ,eAAO,MAAM,8BAA8B;;;;;;;kBAKhC,CAAC;AAEZ,eAAO,MAAM,4BAA4B;;;;;;;kBAK9B,CAAC;AAEZ,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;kBAMnC,CAAC;AAEZ,eAAO,MAAM,4BAA4B;;;;;;;;;kBAO9B,CAAC;AAEZ,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAKnC,CAAC;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;;;;;;;;;;6BAMnC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAenC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE3F;AAED,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,kBAAkB,GAAG,QAAQ,CAAC,CA6BxC"}
@@ -107,3 +107,29 @@ export const AgUiRuntimeRequestSchema = z.object({
107
107
  context: z.array(AgUiRuntimeContextSchema).max(10).default([]).refine((value) => isWithinJsonSizeLimit(value, MAX_CONTEXT_TOTAL_BYTES), { message: "context must be less than 64 KB total" }),
108
108
  forwardedProps: z.record(z.string(), z.unknown()).optional().refine((value) => value === undefined || isWithinJsonSizeLimit(value, MAX_FORWARDED_PROPS_BYTES), { message: "forwardedProps must be less than 64 KB" }),
109
109
  });
110
+ export async function parseAgUiRuntimeRequest(request) {
111
+ return AgUiRuntimeRequestSchema.parse(await request.json());
112
+ }
113
+ export async function parseAgUiRuntimeRequestOrError(request) {
114
+ try {
115
+ return await parseAgUiRuntimeRequest(request);
116
+ }
117
+ catch (error) {
118
+ if (error instanceof z.ZodError) {
119
+ return Response.json({
120
+ error: "Invalid AG-UI runtime request",
121
+ details: error.issues.map((issue) => ({
122
+ path: issue.path,
123
+ message: issue.message,
124
+ })),
125
+ }, { status: 400 });
126
+ }
127
+ if (error instanceof SyntaxError || error instanceof TypeError) {
128
+ return Response.json({
129
+ error: "Invalid AG-UI runtime request",
130
+ details: [{ path: [], message: "Malformed JSON request body" }],
131
+ }, { status: 400 });
132
+ }
133
+ throw error;
134
+ }
135
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"media-types.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/compat/media-types.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ5D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE1D;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAExD"}
1
+ {"version":3,"file":"media-types.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/compat/media-types.ts"],"names":[],"mappings":"AAMA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ5D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE1D;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAExD"}
@@ -1,19 +1,19 @@
1
- import mime from "mime-types";
1
+ import { charset as mimeCharset, extension as mimeExtension, lookup as mimeLookup, } from "../../utils/mime-types.js";
2
2
  export function contentType(path) {
3
- const type = mime.lookup(path);
3
+ const type = mimeLookup(path);
4
4
  if (!type)
5
5
  return undefined;
6
- const cs = mime.charset(type);
6
+ const cs = mimeCharset(type);
7
7
  if (!cs)
8
8
  return type;
9
9
  return `${type}; charset=${cs}`;
10
10
  }
11
11
  export function extension(type) {
12
- return mime.extension(type) ?? undefined;
12
+ return mimeExtension(type) || undefined;
13
13
  }
14
14
  export function lookup(path) {
15
- return mime.lookup(path) ?? undefined;
15
+ return mimeLookup(path) || undefined;
16
16
  }
17
17
  export function charset(type) {
18
- return mime.charset(type) ?? undefined;
18
+ return mimeCharset(type) || undefined;
19
19
  }
@@ -6,7 +6,7 @@
6
6
  * UI automatically inherits those tokens. When standalone, sensible defaults are
7
7
  * injected via <style> on the chat root element.
8
8
  */
9
- import { type ClassValue } from "clsx";
9
+ import { type ClassValue } from "../../../utils/clsx.js";
10
10
  export { cva, type VariantProps } from "class-variance-authority";
11
11
  /**
12
12
  * Generates scoped CSS for the chat UI design tokens.
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/chat/theme.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAiFlE;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAWzC;AAMD,MAAM,WAAW,SAAS;IACxB,uBAAuB;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG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C,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAe9B,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,UAO/B,CAAC;AAMF;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,YAAY,EAAE,CAAC,EACf,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,GACrB,CAAC,CAsBH;AAED;;GAEG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD;AAMD,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE/C,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC;AAExC,eAAO,MAAM,eAAe,EAAE,SAc5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,SAgChC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,SAYlC,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * UI automatically inherits those tokens. When standalone, sensible defaults are
7
7
  * injected via <style> on the chat root element.
8
8
  */
9
- import { clsx } from "clsx";
9
+ import { clsx } from "../../../utils/clsx.js";
10
10
  import { twMerge } from "tailwind-merge";
11
11
  export { cva } from "class-variance-authority";
12
12
  // ---------------------------------------------------------------------------
@@ -1 +1 @@
1
- {"version":3,"file":"framework-candidates.generated.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/framework-candidates.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAmxKjD,CAAC"}
1
+ {"version":3,"file":"framework-candidates.generated.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/dev/framework-candidates.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAoxKjD,CAAC"}
@@ -5309,6 +5309,7 @@ export const FRAMEWORK_CANDIDATES = [
5309
5309
  "veryfront/testing/assert.ts",
5310
5310
  "veryfront/testing/bdd",
5311
5311
  "veryfront/testing/bdd.ts",
5312
+ "veryfront/utils/clsx.ts",
5312
5313
  "veryfront/utils/html-escape.ts",
5313
5314
  "vf-color-mode",
5314
5315
  "vf-head-style{color:red}",
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Inline implementation of the `clsx` class-name joining utility.
3
+ *
4
+ * API-compatible with the MIT-licensed `clsx` npm package — this is a
5
+ * clean-room rewrite against the public API (named `clsx` export, `ClassValue`
6
+ * type, default export alias); no source was copied.
7
+ *
8
+ * Replaces the `clsx` npm dep per spec §8.3 (inline micro-utilities in core).
9
+ */
10
+ export type ClassValue = string | number | boolean | null | undefined | Record<string, unknown> | ClassValue[];
11
+ type Value = ClassValue;
12
+ export declare function clsx(...args: Value[]): string;
13
+ export default clsx;
14
+ //# sourceMappingURL=clsx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clsx.d.ts","sourceRoot":"","sources":["../../../src/src/utils/clsx.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,UAAU,EAAE,CAAC;AAEjB,KAAK,KAAK,GAAG,UAAU,CAAC;AAExB,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,CAgB7C;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Inline implementation of the `clsx` class-name joining utility.
3
+ *
4
+ * API-compatible with the MIT-licensed `clsx` npm package — this is a
5
+ * clean-room rewrite against the public API (named `clsx` export, `ClassValue`
6
+ * type, default export alias); no source was copied.
7
+ *
8
+ * Replaces the `clsx` npm dep per spec §8.3 (inline micro-utilities in core).
9
+ */
10
+ export function clsx(...args) {
11
+ const out = [];
12
+ for (const arg of args) {
13
+ if (!arg)
14
+ continue;
15
+ if (typeof arg === "string" || typeof arg === "number") {
16
+ out.push(String(arg));
17
+ }
18
+ else if (Array.isArray(arg)) {
19
+ const inner = clsx(...arg);
20
+ if (inner)
21
+ out.push(inner);
22
+ }
23
+ else if (typeof arg === "object") {
24
+ for (const [key, value] of Object.entries(arg)) {
25
+ if (value)
26
+ out.push(key);
27
+ }
28
+ }
29
+ }
30
+ return out.join(" ");
31
+ }
32
+ export default clsx;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Inline implementation of the `mime-types` module surface veryfront uses.
3
+ *
4
+ * API-compatible with the MIT-licensed `mime-types` npm package — this is a
5
+ * clean-room rewrite against the public API; no source was copied. MIME
6
+ * values are IANA-assigned identifiers (not copyrightable).
7
+ *
8
+ * Replaces the npm `mime-types` dep per spec §8.3 with a static lookup table.
9
+ * Covers the extensions veryfront serves internally (web assets, fonts, MDX,
10
+ * WASM, source maps) plus the common upload formats users pass to the
11
+ * `veryfront uploads` CLI — CSV, ZIP archives, office docs, audio/video —
12
+ * so `lookupMimeType()` doesn't silently collapse them to
13
+ * `application/octet-stream`. For unknown extensions `lookup()` still
14
+ * returns `false`, matching the original module's sentinel value.
15
+ */
16
+ /**
17
+ * Look up the MIME type for a file path or bare extension. Accepts values
18
+ * with or without a leading dot. Returns `false` when no mapping is known.
19
+ *
20
+ * Uses `Object.hasOwn()` so extensions that collide with inherited props
21
+ * (e.g. `file.toString`, `file.constructor`) return `false` instead of
22
+ * leaking a function / prototype value through the `?? false` fallback.
23
+ */
24
+ export declare function lookup(path: string): string | false;
25
+ /**
26
+ * Return `"UTF-8"` for MIME types whose payload is text (text/*, JS, JSON).
27
+ * Returns `false` otherwise — matching the original module's sentinel.
28
+ */
29
+ export declare function charset(mime: string): string | false;
30
+ /**
31
+ * Reverse of `lookup()`: given a MIME type, return a canonical file extension
32
+ * (without leading dot) or `false` when unknown. Uses `Object.hasOwn()` for
33
+ * the same reason `lookup()` does (avoid prototype-property leaks).
34
+ */
35
+ export declare function extension(mime: string): string | false;
36
+ declare const _default: {
37
+ lookup: typeof lookup;
38
+ charset: typeof charset;
39
+ extension: typeof extension;
40
+ };
41
+ export default _default;
42
+ //# sourceMappingURL=mime-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mime-types.d.ts","sourceRoot":"","sources":["../../../src/src/utils/mime-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAsGH;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAInD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CASpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAEtD;;;;;;AAED,wBAA8C"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Inline implementation of the `mime-types` module surface veryfront uses.
3
+ *
4
+ * API-compatible with the MIT-licensed `mime-types` npm package — this is a
5
+ * clean-room rewrite against the public API; no source was copied. MIME
6
+ * values are IANA-assigned identifiers (not copyrightable).
7
+ *
8
+ * Replaces the npm `mime-types` dep per spec §8.3 with a static lookup table.
9
+ * Covers the extensions veryfront serves internally (web assets, fonts, MDX,
10
+ * WASM, source maps) plus the common upload formats users pass to the
11
+ * `veryfront uploads` CLI — CSV, ZIP archives, office docs, audio/video —
12
+ * so `lookupMimeType()` doesn't silently collapse them to
13
+ * `application/octet-stream`. For unknown extensions `lookup()` still
14
+ * returns `false`, matching the original module's sentinel value.
15
+ */
16
+ /**
17
+ * Canonical extension → MIME mapping. Order matters for reverse lookup via
18
+ * `extension()`: the first extension encountered for a given MIME wins, so
19
+ * list the preferred canonical extension first (e.g. `html` before `htm`,
20
+ * `jpg` before `jpeg`). `json` is listed before `map` so source-map MIMEs
21
+ * still resolve to a reasonable extension via forward lookup, while
22
+ * `extension("application/json")` returns `"json"`.
23
+ */
24
+ const TABLE = {
25
+ // Web markup / styles / scripts
26
+ html: "text/html",
27
+ htm: "text/html",
28
+ xhtml: "application/xhtml+xml",
29
+ css: "text/css",
30
+ js: "application/javascript",
31
+ mjs: "application/javascript",
32
+ cjs: "application/javascript",
33
+ json: "application/json",
34
+ map: "application/json",
35
+ jsonld: "application/ld+json",
36
+ xml: "application/xml",
37
+ rss: "application/rss+xml",
38
+ atom: "application/atom+xml",
39
+ // Images
40
+ svg: "image/svg+xml",
41
+ png: "image/png",
42
+ jpg: "image/jpeg",
43
+ jpeg: "image/jpeg",
44
+ gif: "image/gif",
45
+ webp: "image/webp",
46
+ avif: "image/avif",
47
+ ico: "image/vnd.microsoft.icon",
48
+ bmp: "image/bmp",
49
+ tiff: "image/tiff",
50
+ tif: "image/tiff",
51
+ heic: "image/heic",
52
+ heif: "image/heif",
53
+ // Fonts
54
+ woff: "font/woff",
55
+ woff2: "font/woff2",
56
+ ttf: "font/ttf",
57
+ otf: "font/otf",
58
+ eot: "application/vnd.ms-fontobject",
59
+ // Documents
60
+ pdf: "application/pdf",
61
+ txt: "text/plain",
62
+ md: "text/markdown",
63
+ mdx: "text/markdown",
64
+ csv: "text/csv",
65
+ tsv: "text/tab-separated-values",
66
+ rtf: "application/rtf",
67
+ doc: "application/msword",
68
+ docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
69
+ xls: "application/vnd.ms-excel",
70
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
71
+ ppt: "application/vnd.ms-powerpoint",
72
+ pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
73
+ odt: "application/vnd.oasis.opendocument.text",
74
+ ods: "application/vnd.oasis.opendocument.spreadsheet",
75
+ odp: "application/vnd.oasis.opendocument.presentation",
76
+ // Archives
77
+ zip: "application/zip",
78
+ gz: "application/gzip",
79
+ tgz: "application/gzip",
80
+ tar: "application/x-tar",
81
+ "7z": "application/x-7z-compressed",
82
+ bz2: "application/x-bzip2",
83
+ rar: "application/vnd.rar",
84
+ // Audio
85
+ mp3: "audio/mpeg",
86
+ wav: "audio/wav",
87
+ ogg: "audio/ogg",
88
+ m4a: "audio/mp4",
89
+ aac: "audio/aac",
90
+ flac: "audio/flac",
91
+ opus: "audio/ogg",
92
+ // Video
93
+ mp4: "video/mp4",
94
+ webm: "video/webm",
95
+ mov: "video/quicktime",
96
+ avi: "video/x-msvideo",
97
+ mkv: "video/x-matroska",
98
+ ogv: "video/ogg",
99
+ // Config / data
100
+ yaml: "text/yaml",
101
+ yml: "text/yaml",
102
+ toml: "application/toml",
103
+ // WASM + source maps
104
+ wasm: "application/wasm",
105
+ };
106
+ // Reverse lookup: mime → first-listed extension from TABLE.
107
+ const EXT_BY_MIME = (() => {
108
+ const reverse = {};
109
+ for (const [ext, mime] of Object.entries(TABLE)) {
110
+ if (!(mime in reverse))
111
+ reverse[mime] = ext;
112
+ }
113
+ return reverse;
114
+ })();
115
+ /**
116
+ * Look up the MIME type for a file path or bare extension. Accepts values
117
+ * with or without a leading dot. Returns `false` when no mapping is known.
118
+ *
119
+ * Uses `Object.hasOwn()` so extensions that collide with inherited props
120
+ * (e.g. `file.toString`, `file.constructor`) return `false` instead of
121
+ * leaking a function / prototype value through the `?? false` fallback.
122
+ */
123
+ export function lookup(path) {
124
+ const dot = path.lastIndexOf(".");
125
+ const ext = (dot >= 0 ? path.slice(dot + 1) : path).toLowerCase();
126
+ return Object.hasOwn(TABLE, ext) ? TABLE[ext] : false;
127
+ }
128
+ /**
129
+ * Return `"UTF-8"` for MIME types whose payload is text (text/*, JS, JSON).
130
+ * Returns `false` otherwise — matching the original module's sentinel.
131
+ */
132
+ export function charset(mime) {
133
+ if (mime.startsWith("text/") ||
134
+ mime === "application/javascript" ||
135
+ mime === "application/json") {
136
+ return "UTF-8";
137
+ }
138
+ return false;
139
+ }
140
+ /**
141
+ * Reverse of `lookup()`: given a MIME type, return a canonical file extension
142
+ * (without leading dot) or `false` when unknown. Uses `Object.hasOwn()` for
143
+ * the same reason `lookup()` does (avoid prototype-property leaks).
144
+ */
145
+ export function extension(mime) {
146
+ return Object.hasOwn(EXT_BY_MIME, mime) ? EXT_BY_MIME[mime] : false;
147
+ }
148
+ export default { lookup, charset, extension };
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.220";
1
+ export declare const VERSION = "0.1.222";
2
2
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.220";
3
+ export const VERSION = "0.1.222";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.220",
3
+ "version": "0.1.222",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
@@ -185,13 +185,11 @@
185
185
  "@types/mdast": "4.0.3",
186
186
  "@types/unist": "3.0.2",
187
187
  "class-variance-authority": "0.7.1",
188
- "clsx": "2.1.1",
189
188
  "es-module-lexer": "2.0.0",
190
189
  "esbuild": "0.27.4",
191
190
  "github-slugger": "2.0.0",
192
191
  "gray-matter": "4.0.3",
193
192
  "mdast-util-to-string": "4.0.0",
194
- "mime-types": "3.0.2",
195
193
  "react": "19.2.4",
196
194
  "react-dom": "19.2.4",
197
195
  "rehype-highlight": "7.0.2",