veryfront 0.1.632 → 0.1.633
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/esm/deno.d.ts +1 -0
- package/esm/deno.js +2 -1
- package/esm/src/agent/ag-ui/browser-encoder.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/browser-encoder.js +0 -2
- package/esm/src/cache/backends/api.d.ts.map +1 -1
- package/esm/src/cache/backends/api.js +8 -10
- package/esm/src/cache/backends/batch-results.d.ts +21 -0
- package/esm/src/cache/backends/batch-results.d.ts.map +1 -0
- package/esm/src/cache/backends/batch-results.js +26 -0
- package/esm/src/cache/backends/memory.d.ts.map +1 -1
- package/esm/src/cache/backends/memory.js +7 -10
- package/esm/src/cache/backends/redis.d.ts.map +1 -1
- package/esm/src/cache/backends/redis.js +6 -11
- package/esm/src/chat/ag-ui.d.ts +0 -257
- package/esm/src/chat/ag-ui.d.ts.map +1 -1
- package/esm/src/chat/ag-ui.js +1 -21
- package/esm/src/chat/compat.d.ts +776 -0
- package/esm/src/chat/compat.d.ts.map +1 -0
- package/esm/src/chat/compat.js +113 -0
- package/esm/src/chat/conversation.d.ts +0 -151
- package/esm/src/chat/conversation.d.ts.map +1 -1
- package/esm/src/chat/conversation.js +1 -26
- package/esm/src/chat/message-prep.d.ts +0 -10
- package/esm/src/chat/message-prep.d.ts.map +1 -1
- package/esm/src/chat/message-prep.js +0 -10
- package/esm/src/chat/types.d.ts +0 -339
- package/esm/src/chat/types.d.ts.map +1 -1
- package/esm/src/chat/types.js +1 -29
- package/esm/src/platform/adapters/runtime/deno/adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/deno/adapter.js +3 -14
- package/esm/src/platform/compat/http/deno-server.d.ts.map +1 -1
- package/esm/src/platform/compat/http/deno-server.js +3 -14
- package/esm/src/platform/compat/http/native-response.d.ts +29 -0
- package/esm/src/platform/compat/http/native-response.d.ts.map +1 -0
- package/esm/src/platform/compat/http/native-response.js +43 -0
- package/esm/src/server/handlers/dev/dashboard/api.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/dashboard/api.js +1 -10
- package/esm/src/server/handlers/dev/http-helpers.d.ts +17 -0
- package/esm/src/server/handlers/dev/http-helpers.d.ts.map +1 -0
- package/esm/src/server/handlers/dev/http-helpers.js +20 -0
- package/esm/src/server/handlers/dev/projects/api.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/projects/api.js +1 -7
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -1
package/esm/src/chat/types.d.ts
CHANGED
|
@@ -165,11 +165,6 @@ export type ChatToolMessage = {
|
|
|
165
165
|
};
|
|
166
166
|
/** Message shape for provider model. */
|
|
167
167
|
export type ProviderModelMessage = ChatSystemMessage | ChatUserMessage | ChatAssistantMessage | ChatToolMessage;
|
|
168
|
-
/**
|
|
169
|
-
* @deprecated Use ProviderModelMessage for provider-facing model payloads.
|
|
170
|
-
*/
|
|
171
|
-
/** Message shape for chat model. */
|
|
172
|
-
export type ChatModelMessage = ProviderModelMessage;
|
|
173
168
|
/** Public API contract for durable root run descriptor. */
|
|
174
169
|
export interface DurableRootRunDescriptor {
|
|
175
170
|
runId: string;
|
|
@@ -215,15 +210,6 @@ export declare const getChatRequestContextSchema: () => import("../internal-agen
|
|
|
215
210
|
branchId: import("../internal-agents/schema.js").Schema<string | null>;
|
|
216
211
|
environmentContext: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
217
212
|
}>>;
|
|
218
|
-
/** Schema for chat request context.
|
|
219
|
-
* @deprecated Use getChatRequestContextSchema()
|
|
220
|
-
*/
|
|
221
|
-
export declare const chatRequestContextSchema: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
222
|
-
conversationId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
223
|
-
projectId: import("../internal-agents/schema.js").Schema<string | null>;
|
|
224
|
-
branchId: import("../internal-agents/schema.js").Schema<string | null>;
|
|
225
|
-
environmentContext: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
226
|
-
}>>;
|
|
227
213
|
/** Context for chat request. */
|
|
228
214
|
export type ChatRequestContext = InferSchema<ReturnType<typeof getChatRequestContextSchema>>;
|
|
229
215
|
/** Zod schema for get message metadata. */
|
|
@@ -264,58 +250,10 @@ export declare const getMessageMetadataSchema: () => import("../internal-agents/
|
|
|
264
250
|
cachedInputTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
265
251
|
}> | undefined>;
|
|
266
252
|
}>>;
|
|
267
|
-
/** Schema for message metadata.
|
|
268
|
-
* @deprecated Use getMessageMetadataSchema()
|
|
269
|
-
*/
|
|
270
|
-
export declare const messageMetadataSchema: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
271
|
-
createdAt: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
272
|
-
isStopped: import("../internal-agents/schema.js").Schema<boolean | undefined>;
|
|
273
|
-
isCompleted: import("../internal-agents/schema.js").Schema<boolean | undefined>;
|
|
274
|
-
completedAt: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
275
|
-
agentId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
276
|
-
agentName: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
277
|
-
conversationId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
278
|
-
modelId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
279
|
-
runId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
280
|
-
streamingMessageId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
281
|
-
childRunAudit: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
282
|
-
status: import("../internal-agents/schema.js").Schema<string>;
|
|
283
|
-
description: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
284
|
-
steps: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
285
|
-
durationMs: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
286
|
-
toolCalls: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
287
|
-
toolName: import("../internal-agents/schema.js").Schema<string>;
|
|
288
|
-
toolCallId: import("../internal-agents/schema.js").Schema<string>;
|
|
289
|
-
input: import("../internal-agents/schema.js").Schema<unknown>;
|
|
290
|
-
}>[] | undefined>;
|
|
291
|
-
toolResults: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
292
|
-
toolName: import("../internal-agents/schema.js").Schema<string>;
|
|
293
|
-
toolCallId: import("../internal-agents/schema.js").Schema<string>;
|
|
294
|
-
input: import("../internal-agents/schema.js").Schema<unknown>;
|
|
295
|
-
output: import("../internal-agents/schema.js").Schema<unknown>;
|
|
296
|
-
}>[] | undefined>;
|
|
297
|
-
terminalErrorCode: import("../internal-agents/schema.js").Schema<string | null | undefined>;
|
|
298
|
-
terminalErrorMessage: import("../internal-agents/schema.js").Schema<string | null | undefined>;
|
|
299
|
-
}> | undefined>;
|
|
300
|
-
usage: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
301
|
-
inputTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
302
|
-
outputTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
303
|
-
reasoningTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
304
|
-
cachedInputTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
305
|
-
}> | undefined>;
|
|
306
|
-
}>>;
|
|
307
253
|
/** Zod schema for get chat UI message role. */
|
|
308
254
|
export declare const getChatUiMessageRoleSchema: () => import("../internal-agents/schema.js").Schema<string>;
|
|
309
|
-
/** Schema for chat ui message role.
|
|
310
|
-
* @deprecated Use getChatUiMessageRoleSchema()
|
|
311
|
-
*/
|
|
312
|
-
export declare const chatUiMessageRoleSchema: import("../internal-agents/schema.js").Schema<string>;
|
|
313
255
|
/** Zod schema for get chat tool part state. */
|
|
314
256
|
export declare const getChatToolPartStateSchema: () => import("../internal-agents/schema.js").Schema<string>;
|
|
315
|
-
/** Schema for chat tool part state.
|
|
316
|
-
* @deprecated Use getChatToolPartStateSchema()
|
|
317
|
-
*/
|
|
318
|
-
export declare const chatToolPartStateSchema: import("../internal-agents/schema.js").Schema<string>;
|
|
319
257
|
/** Zod schema for get chat UI message part. */
|
|
320
258
|
export declare const getChatUiMessagePartSchema: () => import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
321
259
|
type: import("../internal-agents/schema.js").Schema<"text">;
|
|
@@ -379,71 +317,6 @@ export declare const getChatUiMessagePartSchema: () => import("../internal-agent
|
|
|
379
317
|
type: import("../internal-agents/schema.js").Schema<`data-${string}`>;
|
|
380
318
|
data: import("../internal-agents/schema.js").Schema<unknown>;
|
|
381
319
|
}>>;
|
|
382
|
-
/** Schema for chat ui message part.
|
|
383
|
-
* @deprecated Use getChatUiMessagePartSchema()
|
|
384
|
-
*/
|
|
385
|
-
export declare const chatUiMessagePartSchema: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
386
|
-
type: import("../internal-agents/schema.js").Schema<"text">;
|
|
387
|
-
text: import("../internal-agents/schema.js").Schema<string>;
|
|
388
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
389
|
-
type: import("../internal-agents/schema.js").Schema<"reasoning">;
|
|
390
|
-
text: import("../internal-agents/schema.js").Schema<string>;
|
|
391
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
392
|
-
type: import("../internal-agents/schema.js").Schema<"step-start">;
|
|
393
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
394
|
-
type: import("../internal-agents/schema.js").Schema<"source-url">;
|
|
395
|
-
sourceId: import("../internal-agents/schema.js").Schema<string>;
|
|
396
|
-
url: import("../internal-agents/schema.js").Schema<string>;
|
|
397
|
-
title: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
398
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
399
|
-
type: import("../internal-agents/schema.js").Schema<"source-document">;
|
|
400
|
-
sourceId: import("../internal-agents/schema.js").Schema<string>;
|
|
401
|
-
title: import("../internal-agents/schema.js").Schema<string>;
|
|
402
|
-
mediaType: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
403
|
-
filename: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
404
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
405
|
-
type: import("../internal-agents/schema.js").Schema<"file">;
|
|
406
|
-
mediaType: import("../internal-agents/schema.js").Schema<string>;
|
|
407
|
-
url: import("../internal-agents/schema.js").Schema<string>;
|
|
408
|
-
filename: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
409
|
-
uploadId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
410
|
-
uploadPath: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
411
|
-
}> | ({
|
|
412
|
-
toolCallId: string;
|
|
413
|
-
state: string;
|
|
414
|
-
} & {
|
|
415
|
-
input?: unknown;
|
|
416
|
-
title?: string | undefined;
|
|
417
|
-
providerExecuted?: boolean | undefined;
|
|
418
|
-
callProviderMetadata?: Record<string, unknown> | undefined;
|
|
419
|
-
output?: unknown;
|
|
420
|
-
errorText?: string | undefined;
|
|
421
|
-
approval?: import("../extensions/schema/schema-validator.js").InferShape<{
|
|
422
|
-
id: import("../internal-agents/schema.js").Schema<string>;
|
|
423
|
-
}> | undefined;
|
|
424
|
-
} & {
|
|
425
|
-
type: "dynamic-tool";
|
|
426
|
-
toolName: string;
|
|
427
|
-
}) | ({
|
|
428
|
-
toolCallId: string;
|
|
429
|
-
state: string;
|
|
430
|
-
} & {
|
|
431
|
-
input?: unknown;
|
|
432
|
-
title?: string | undefined;
|
|
433
|
-
providerExecuted?: boolean | undefined;
|
|
434
|
-
callProviderMetadata?: Record<string, unknown> | undefined;
|
|
435
|
-
output?: unknown;
|
|
436
|
-
errorText?: string | undefined;
|
|
437
|
-
approval?: import("../extensions/schema/schema-validator.js").InferShape<{
|
|
438
|
-
id: import("../internal-agents/schema.js").Schema<string>;
|
|
439
|
-
}> | undefined;
|
|
440
|
-
} & {
|
|
441
|
-
type: `tool-${string}` | "tool_call";
|
|
442
|
-
toolName: string | undefined;
|
|
443
|
-
}) | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
444
|
-
type: import("../internal-agents/schema.js").Schema<`data-${string}`>;
|
|
445
|
-
data: import("../internal-agents/schema.js").Schema<unknown>;
|
|
446
|
-
}>>;
|
|
447
320
|
/** Zod schema for get chat UI message. */
|
|
448
321
|
export declare const getChatUiMessageSchema: () => import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
449
322
|
id: import("../internal-agents/schema.js").Schema<string>;
|
|
@@ -548,112 +421,6 @@ export declare const getChatUiMessageSchema: () => import("../internal-agents/sc
|
|
|
548
421
|
}> | undefined>;
|
|
549
422
|
}> | undefined>;
|
|
550
423
|
}>>;
|
|
551
|
-
/** Schema for chat ui message.
|
|
552
|
-
* @deprecated Use getChatUiMessageSchema()
|
|
553
|
-
*/
|
|
554
|
-
export declare const chatUiMessageSchema: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
555
|
-
id: import("../internal-agents/schema.js").Schema<string>;
|
|
556
|
-
role: import("../internal-agents/schema.js").Schema<string>;
|
|
557
|
-
parts: import("../internal-agents/schema.js").Schema<(import("../extensions/schema/schema-validator.js").InferShape<{
|
|
558
|
-
type: import("../internal-agents/schema.js").Schema<"text">;
|
|
559
|
-
text: import("../internal-agents/schema.js").Schema<string>;
|
|
560
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
561
|
-
type: import("../internal-agents/schema.js").Schema<"reasoning">;
|
|
562
|
-
text: import("../internal-agents/schema.js").Schema<string>;
|
|
563
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
564
|
-
type: import("../internal-agents/schema.js").Schema<"step-start">;
|
|
565
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
566
|
-
type: import("../internal-agents/schema.js").Schema<"source-url">;
|
|
567
|
-
sourceId: import("../internal-agents/schema.js").Schema<string>;
|
|
568
|
-
url: import("../internal-agents/schema.js").Schema<string>;
|
|
569
|
-
title: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
570
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
571
|
-
type: import("../internal-agents/schema.js").Schema<"source-document">;
|
|
572
|
-
sourceId: import("../internal-agents/schema.js").Schema<string>;
|
|
573
|
-
title: import("../internal-agents/schema.js").Schema<string>;
|
|
574
|
-
mediaType: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
575
|
-
filename: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
576
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
577
|
-
type: import("../internal-agents/schema.js").Schema<"file">;
|
|
578
|
-
mediaType: import("../internal-agents/schema.js").Schema<string>;
|
|
579
|
-
url: import("../internal-agents/schema.js").Schema<string>;
|
|
580
|
-
filename: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
581
|
-
uploadId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
582
|
-
uploadPath: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
583
|
-
}> | ({
|
|
584
|
-
toolCallId: string;
|
|
585
|
-
state: string;
|
|
586
|
-
} & {
|
|
587
|
-
input?: unknown;
|
|
588
|
-
title?: string | undefined;
|
|
589
|
-
providerExecuted?: boolean | undefined;
|
|
590
|
-
callProviderMetadata?: Record<string, unknown> | undefined;
|
|
591
|
-
output?: unknown;
|
|
592
|
-
errorText?: string | undefined;
|
|
593
|
-
approval?: import("../extensions/schema/schema-validator.js").InferShape<{
|
|
594
|
-
id: import("../internal-agents/schema.js").Schema<string>;
|
|
595
|
-
}> | undefined;
|
|
596
|
-
} & {
|
|
597
|
-
type: "dynamic-tool";
|
|
598
|
-
toolName: string;
|
|
599
|
-
}) | ({
|
|
600
|
-
toolCallId: string;
|
|
601
|
-
state: string;
|
|
602
|
-
} & {
|
|
603
|
-
input?: unknown;
|
|
604
|
-
title?: string | undefined;
|
|
605
|
-
providerExecuted?: boolean | undefined;
|
|
606
|
-
callProviderMetadata?: Record<string, unknown> | undefined;
|
|
607
|
-
output?: unknown;
|
|
608
|
-
errorText?: string | undefined;
|
|
609
|
-
approval?: import("../extensions/schema/schema-validator.js").InferShape<{
|
|
610
|
-
id: import("../internal-agents/schema.js").Schema<string>;
|
|
611
|
-
}> | undefined;
|
|
612
|
-
} & {
|
|
613
|
-
type: `tool-${string}` | "tool_call";
|
|
614
|
-
toolName: string | undefined;
|
|
615
|
-
}) | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
616
|
-
type: import("../internal-agents/schema.js").Schema<`data-${string}`>;
|
|
617
|
-
data: import("../internal-agents/schema.js").Schema<unknown>;
|
|
618
|
-
}>)[]>;
|
|
619
|
-
metadata: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
620
|
-
createdAt: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
621
|
-
isStopped: import("../internal-agents/schema.js").Schema<boolean | undefined>;
|
|
622
|
-
isCompleted: import("../internal-agents/schema.js").Schema<boolean | undefined>;
|
|
623
|
-
completedAt: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
624
|
-
agentId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
625
|
-
agentName: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
626
|
-
conversationId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
627
|
-
modelId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
628
|
-
runId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
629
|
-
streamingMessageId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
630
|
-
childRunAudit: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
631
|
-
status: import("../internal-agents/schema.js").Schema<string>;
|
|
632
|
-
description: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
633
|
-
steps: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
634
|
-
durationMs: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
635
|
-
toolCalls: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
636
|
-
toolName: import("../internal-agents/schema.js").Schema<string>;
|
|
637
|
-
toolCallId: import("../internal-agents/schema.js").Schema<string>;
|
|
638
|
-
input: import("../internal-agents/schema.js").Schema<unknown>;
|
|
639
|
-
}>[] | undefined>;
|
|
640
|
-
toolResults: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
641
|
-
toolName: import("../internal-agents/schema.js").Schema<string>;
|
|
642
|
-
toolCallId: import("../internal-agents/schema.js").Schema<string>;
|
|
643
|
-
input: import("../internal-agents/schema.js").Schema<unknown>;
|
|
644
|
-
output: import("../internal-agents/schema.js").Schema<unknown>;
|
|
645
|
-
}>[] | undefined>;
|
|
646
|
-
terminalErrorCode: import("../internal-agents/schema.js").Schema<string | null | undefined>;
|
|
647
|
-
terminalErrorMessage: import("../internal-agents/schema.js").Schema<string | null | undefined>;
|
|
648
|
-
}> | undefined>;
|
|
649
|
-
usage: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
650
|
-
inputTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
651
|
-
outputTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
652
|
-
reasoningTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
653
|
-
cachedInputTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
654
|
-
}> | undefined>;
|
|
655
|
-
}> | undefined>;
|
|
656
|
-
}>>;
|
|
657
424
|
/** Zod schema for get chat UI messages. */
|
|
658
425
|
export declare const getChatUiMessagesSchema: () => import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
659
426
|
id: import("../internal-agents/schema.js").Schema<string>;
|
|
@@ -758,112 +525,6 @@ export declare const getChatUiMessagesSchema: () => import("../internal-agents/s
|
|
|
758
525
|
}> | undefined>;
|
|
759
526
|
}> | undefined>;
|
|
760
527
|
}>[]>;
|
|
761
|
-
/** Schema for chat ui messages.
|
|
762
|
-
* @deprecated Use getChatUiMessagesSchema()
|
|
763
|
-
*/
|
|
764
|
-
export declare const chatUiMessagesSchema: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
765
|
-
id: import("../internal-agents/schema.js").Schema<string>;
|
|
766
|
-
role: import("../internal-agents/schema.js").Schema<string>;
|
|
767
|
-
parts: import("../internal-agents/schema.js").Schema<(import("../extensions/schema/schema-validator.js").InferShape<{
|
|
768
|
-
type: import("../internal-agents/schema.js").Schema<"text">;
|
|
769
|
-
text: import("../internal-agents/schema.js").Schema<string>;
|
|
770
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
771
|
-
type: import("../internal-agents/schema.js").Schema<"reasoning">;
|
|
772
|
-
text: import("../internal-agents/schema.js").Schema<string>;
|
|
773
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
774
|
-
type: import("../internal-agents/schema.js").Schema<"step-start">;
|
|
775
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
776
|
-
type: import("../internal-agents/schema.js").Schema<"source-url">;
|
|
777
|
-
sourceId: import("../internal-agents/schema.js").Schema<string>;
|
|
778
|
-
url: import("../internal-agents/schema.js").Schema<string>;
|
|
779
|
-
title: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
780
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
781
|
-
type: import("../internal-agents/schema.js").Schema<"source-document">;
|
|
782
|
-
sourceId: import("../internal-agents/schema.js").Schema<string>;
|
|
783
|
-
title: import("../internal-agents/schema.js").Schema<string>;
|
|
784
|
-
mediaType: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
785
|
-
filename: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
786
|
-
}> | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
787
|
-
type: import("../internal-agents/schema.js").Schema<"file">;
|
|
788
|
-
mediaType: import("../internal-agents/schema.js").Schema<string>;
|
|
789
|
-
url: import("../internal-agents/schema.js").Schema<string>;
|
|
790
|
-
filename: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
791
|
-
uploadId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
792
|
-
uploadPath: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
793
|
-
}> | ({
|
|
794
|
-
toolCallId: string;
|
|
795
|
-
state: string;
|
|
796
|
-
} & {
|
|
797
|
-
input?: unknown;
|
|
798
|
-
title?: string | undefined;
|
|
799
|
-
providerExecuted?: boolean | undefined;
|
|
800
|
-
callProviderMetadata?: Record<string, unknown> | undefined;
|
|
801
|
-
output?: unknown;
|
|
802
|
-
errorText?: string | undefined;
|
|
803
|
-
approval?: import("../extensions/schema/schema-validator.js").InferShape<{
|
|
804
|
-
id: import("../internal-agents/schema.js").Schema<string>;
|
|
805
|
-
}> | undefined;
|
|
806
|
-
} & {
|
|
807
|
-
type: "dynamic-tool";
|
|
808
|
-
toolName: string;
|
|
809
|
-
}) | ({
|
|
810
|
-
toolCallId: string;
|
|
811
|
-
state: string;
|
|
812
|
-
} & {
|
|
813
|
-
input?: unknown;
|
|
814
|
-
title?: string | undefined;
|
|
815
|
-
providerExecuted?: boolean | undefined;
|
|
816
|
-
callProviderMetadata?: Record<string, unknown> | undefined;
|
|
817
|
-
output?: unknown;
|
|
818
|
-
errorText?: string | undefined;
|
|
819
|
-
approval?: import("../extensions/schema/schema-validator.js").InferShape<{
|
|
820
|
-
id: import("../internal-agents/schema.js").Schema<string>;
|
|
821
|
-
}> | undefined;
|
|
822
|
-
} & {
|
|
823
|
-
type: `tool-${string}` | "tool_call";
|
|
824
|
-
toolName: string | undefined;
|
|
825
|
-
}) | import("../extensions/schema/schema-validator.js").InferShape<{
|
|
826
|
-
type: import("../internal-agents/schema.js").Schema<`data-${string}`>;
|
|
827
|
-
data: import("../internal-agents/schema.js").Schema<unknown>;
|
|
828
|
-
}>)[]>;
|
|
829
|
-
metadata: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
830
|
-
createdAt: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
831
|
-
isStopped: import("../internal-agents/schema.js").Schema<boolean | undefined>;
|
|
832
|
-
isCompleted: import("../internal-agents/schema.js").Schema<boolean | undefined>;
|
|
833
|
-
completedAt: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
834
|
-
agentId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
835
|
-
agentName: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
836
|
-
conversationId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
837
|
-
modelId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
838
|
-
runId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
839
|
-
streamingMessageId: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
840
|
-
childRunAudit: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
841
|
-
status: import("../internal-agents/schema.js").Schema<string>;
|
|
842
|
-
description: import("../internal-agents/schema.js").Schema<string | undefined>;
|
|
843
|
-
steps: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
844
|
-
durationMs: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
845
|
-
toolCalls: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
846
|
-
toolName: import("../internal-agents/schema.js").Schema<string>;
|
|
847
|
-
toolCallId: import("../internal-agents/schema.js").Schema<string>;
|
|
848
|
-
input: import("../internal-agents/schema.js").Schema<unknown>;
|
|
849
|
-
}>[] | undefined>;
|
|
850
|
-
toolResults: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
851
|
-
toolName: import("../internal-agents/schema.js").Schema<string>;
|
|
852
|
-
toolCallId: import("../internal-agents/schema.js").Schema<string>;
|
|
853
|
-
input: import("../internal-agents/schema.js").Schema<unknown>;
|
|
854
|
-
output: import("../internal-agents/schema.js").Schema<unknown>;
|
|
855
|
-
}>[] | undefined>;
|
|
856
|
-
terminalErrorCode: import("../internal-agents/schema.js").Schema<string | null | undefined>;
|
|
857
|
-
terminalErrorMessage: import("../internal-agents/schema.js").Schema<string | null | undefined>;
|
|
858
|
-
}> | undefined>;
|
|
859
|
-
usage: import("../internal-agents/schema.js").Schema<import("../extensions/schema/schema-validator.js").InferShape<{
|
|
860
|
-
inputTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
861
|
-
outputTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
862
|
-
reasoningTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
863
|
-
cachedInputTokens: import("../internal-agents/schema.js").Schema<number | undefined>;
|
|
864
|
-
}> | undefined>;
|
|
865
|
-
}> | undefined>;
|
|
866
|
-
}>[]>;
|
|
867
528
|
/** Check whether a file is an image. */
|
|
868
529
|
export declare function isImageFile(type: string | undefined): boolean;
|
|
869
530
|
/** Check whether a file is a supported image upload. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/src/chat/types.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,+BAA+B,CAAC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;AACxD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,WAM5C;AAED,kDAAkD;AAClD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,WAEnF;AAED,+CAA+C;AAC/C,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,UAW9B;AASD,mCAAmC;AACnC,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAmB7E;AAED,YAAY,EACV,mBAAmB,EACnB,mBAAmB,IAAI,eAAe,EACtC,wBAAwB,EACxB,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,uBAAuB,GACxB,CAAC"}
|
package/esm/src/chat/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineSchema
|
|
1
|
+
import { defineSchema } from "../schemas/index.js";
|
|
2
2
|
const NATIVE_TEXT_ATTACHMENT_EXTENSIONS = [
|
|
3
3
|
".txt",
|
|
4
4
|
".md",
|
|
@@ -57,10 +57,6 @@ export const getChatRequestContextSchema = defineSchema((v) => v.object({
|
|
|
57
57
|
branchId: v.string().nullable(),
|
|
58
58
|
environmentContext: v.string().optional(),
|
|
59
59
|
}).strict());
|
|
60
|
-
/** Schema for chat request context.
|
|
61
|
-
* @deprecated Use getChatRequestContextSchema()
|
|
62
|
-
*/
|
|
63
|
-
export const chatRequestContextSchema = lazySchema(getChatRequestContextSchema);
|
|
64
60
|
// Helper that returns a nonEmptyString schema for reuse within defineSchema callbacks.
|
|
65
61
|
const nonEmptyString = (v) => v.string().min(1);
|
|
66
62
|
const getChildRunAuditStatusSchema = defineSchema((v) => v.enum(["completed", "failed", "cancelled", "stopped"]));
|
|
@@ -106,16 +102,8 @@ export const getMessageMetadataSchema = defineSchema((v) => v.object({
|
|
|
106
102
|
childRunAudit: getChildRunAuditSchema().optional(),
|
|
107
103
|
usage: getMessageMetadataUsageSchema().optional(),
|
|
108
104
|
}).strict());
|
|
109
|
-
/** Schema for message metadata.
|
|
110
|
-
* @deprecated Use getMessageMetadataSchema()
|
|
111
|
-
*/
|
|
112
|
-
export const messageMetadataSchema = lazySchema(getMessageMetadataSchema);
|
|
113
105
|
/** Zod schema for get chat UI message role. */
|
|
114
106
|
export const getChatUiMessageRoleSchema = defineSchema((v) => v.enum(["system", "user", "assistant", "tool"]));
|
|
115
|
-
/** Schema for chat ui message role.
|
|
116
|
-
* @deprecated Use getChatUiMessageRoleSchema()
|
|
117
|
-
*/
|
|
118
|
-
export const chatUiMessageRoleSchema = lazySchema(getChatUiMessageRoleSchema);
|
|
119
107
|
/** Zod schema for get chat tool part state. */
|
|
120
108
|
export const getChatToolPartStateSchema = defineSchema((v) => v.enum([
|
|
121
109
|
"pending",
|
|
@@ -129,10 +117,6 @@ export const getChatToolPartStateSchema = defineSchema((v) => v.enum([
|
|
|
129
117
|
"error",
|
|
130
118
|
"completed",
|
|
131
119
|
]));
|
|
132
|
-
/** Schema for chat tool part state.
|
|
133
|
-
* @deprecated Use getChatToolPartStateSchema()
|
|
134
|
-
*/
|
|
135
|
-
export const chatToolPartStateSchema = lazySchema(getChatToolPartStateSchema);
|
|
136
120
|
const getToolApprovalSchema = defineSchema((v) => v.object({
|
|
137
121
|
id: nonEmptyString(v),
|
|
138
122
|
}).strict());
|
|
@@ -205,10 +189,6 @@ export const getChatUiMessagePartSchema = defineSchema((v) => v.union([
|
|
|
205
189
|
getChatNamedToolUiPartSchema(),
|
|
206
190
|
getChatDataUiPartSchema(),
|
|
207
191
|
]));
|
|
208
|
-
/** Schema for chat ui message part.
|
|
209
|
-
* @deprecated Use getChatUiMessagePartSchema()
|
|
210
|
-
*/
|
|
211
|
-
export const chatUiMessagePartSchema = lazySchema(getChatUiMessagePartSchema);
|
|
212
192
|
/** Zod schema for get chat UI message. */
|
|
213
193
|
export const getChatUiMessageSchema = defineSchema((v) => v.object({
|
|
214
194
|
id: nonEmptyString(v),
|
|
@@ -216,16 +196,8 @@ export const getChatUiMessageSchema = defineSchema((v) => v.object({
|
|
|
216
196
|
parts: v.array(getChatUiMessagePartSchema()),
|
|
217
197
|
metadata: getMessageMetadataSchema().optional(),
|
|
218
198
|
}).strip());
|
|
219
|
-
/** Schema for chat ui message.
|
|
220
|
-
* @deprecated Use getChatUiMessageSchema()
|
|
221
|
-
*/
|
|
222
|
-
export const chatUiMessageSchema = lazySchema(getChatUiMessageSchema);
|
|
223
199
|
/** Zod schema for get chat UI messages. */
|
|
224
200
|
export const getChatUiMessagesSchema = defineSchema((v) => v.array(getChatUiMessageSchema()));
|
|
225
|
-
/** Schema for chat ui messages.
|
|
226
|
-
* @deprecated Use getChatUiMessagesSchema()
|
|
227
|
-
*/
|
|
228
|
-
export const chatUiMessagesSchema = lazySchema(getChatUiMessagesSchema);
|
|
229
201
|
function hasExtension(filename, extensions) {
|
|
230
202
|
const normalizedFilename = filename?.toLowerCase() ?? "";
|
|
231
203
|
return extensions.some((extension) => normalizedFilename.endsWith(extension));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/runtime/deno/adapter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAElB,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,MAAM,EACN,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,gBAAgB,EACjB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/runtime/deno/adapter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAElB,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,MAAM,EACN,aAAa,EACb,YAAY,E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B,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB;CAYrD;AAED,cAAM,gBAAiB,YAAW,YAAY;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE;IAejE,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAanC;AAwBD,qBAAa,WAAY,YAAW,cAAc;IAChD,QAAQ,CAAC,EAAE,EAAG,MAAM,CAAU;IAC9B,QAAQ,CAAC,IAAI,UAAU;IACvB,QAAQ,CAAC,EAAE,wBAA+B;IAC1C,QAAQ,CAAC,GAAG,yBAAgC;IAC5C,QAAQ,CAAC,MAAM,oBAA2B;IAC1C,QAAQ,CAAC,KAAK,mBAA0B;IAExC,QAAQ,CAAC,YAAY;;;;;;;;;;MAUnB;IAEF,OAAO,CAAC,YAAY,CAA2B;IAE/C,KAAK,CACH,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,EAC3D,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,MAAM,CAAC;IA4DZ,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC;AAED,eAAO,MAAM,WAAW,aAAoB,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { serverLogger } from "../../../../utils/index.js";
|
|
|
5
5
|
import { env as getEnvObject, getEnv, getEnvOverlayStorage, setEnv, } from "../../../compat/process.js";
|
|
6
6
|
import { createFileWatcher, createWatcherIterator, enqueueWatchEvent, } from "../shared/watcher-queue.js";
|
|
7
7
|
import { stopManagedServer } from "../shared/server-lifecycle.js";
|
|
8
|
+
import { getNativeResponse, toNativeResponse } from "../../../compat/http/native-response.js";
|
|
8
9
|
const logger = serverLogger.component("deno");
|
|
9
10
|
/** Default server port. Defined locally to keep adapters module isolated. */
|
|
10
11
|
const DEFAULT_PORT = 3000;
|
|
@@ -320,8 +321,7 @@ export class DenoAdapter {
|
|
|
320
321
|
// Access native Response via `self` to bypass dnt shim transform.
|
|
321
322
|
// In npm packages, dnt replaces Response with undici's polyfill,
|
|
322
323
|
// but Deno.serve requires native Response instances.
|
|
323
|
-
const NativeResponse =
|
|
324
|
-
.Response;
|
|
324
|
+
const NativeResponse = getNativeResponse();
|
|
325
325
|
const server = nativeDeno.serve({
|
|
326
326
|
port,
|
|
327
327
|
hostname,
|
|
@@ -329,18 +329,7 @@ export class DenoAdapter {
|
|
|
329
329
|
handler: async (request) => {
|
|
330
330
|
try {
|
|
331
331
|
const response = await wrappedHandler(request);
|
|
332
|
-
|
|
333
|
-
if (response instanceof NativeResponse)
|
|
334
|
-
return response;
|
|
335
|
-
// Re-wrap polyfilled Response as native Response.
|
|
336
|
-
// dnt replaces Response with undici's polyfill which fails
|
|
337
|
-
// Deno.serve's native instanceof check.
|
|
338
|
-
const r = response;
|
|
339
|
-
return new NativeResponse(r.body, {
|
|
340
|
-
status: r.status,
|
|
341
|
-
statusText: r.statusText,
|
|
342
|
-
headers: r.headers,
|
|
343
|
-
});
|
|
332
|
+
return toNativeResponse(response, NativeResponse);
|
|
344
333
|
}
|
|
345
334
|
catch (error) {
|
|
346
335
|
serverLogger.error("Request handler error:", error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deno-server.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/http/deno-server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"deno-server.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/http/deno-server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAIpE,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,eAAe,CAAC,CAAkB;IAEpC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgCxE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAIvB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LOCALHOST } from "../constants.js";
|
|
2
|
+
import { getNativeResponse, toNativeResponse } from "./native-response.js";
|
|
2
3
|
export class DenoHttpServer {
|
|
3
4
|
abortController;
|
|
4
5
|
async serve(handler, options = {}) {
|
|
@@ -11,22 +12,10 @@ export class DenoHttpServer {
|
|
|
11
12
|
// Access native Response via `self` to bypass dnt shim transform.
|
|
12
13
|
// In npm packages, dnt replaces Response with undici's polyfill,
|
|
13
14
|
// but Deno.serve requires native Response instances.
|
|
14
|
-
const NativeResponse =
|
|
15
|
-
.Response;
|
|
15
|
+
const NativeResponse = getNativeResponse();
|
|
16
16
|
const wrappedHandler = async (req) => {
|
|
17
17
|
const response = await handler(req);
|
|
18
|
-
|
|
19
|
-
if (response instanceof NativeResponse)
|
|
20
|
-
return response;
|
|
21
|
-
// Re-wrap polyfilled Response as native Response.
|
|
22
|
-
// At runtime, `response` may be an undici Response (from dnt shim) that
|
|
23
|
-
// fails Deno's native instanceof check. Cast to access its properties.
|
|
24
|
-
const r = response;
|
|
25
|
-
return new NativeResponse(r.body, {
|
|
26
|
-
status: r.status,
|
|
27
|
-
statusText: r.statusText,
|
|
28
|
-
headers: r.headers,
|
|
29
|
-
});
|
|
18
|
+
return toNativeResponse(response, NativeResponse);
|
|
30
19
|
};
|
|
31
20
|
const httpServer = nativeDeno.serve({ port, hostname, signal: serveSignal }, wrappedHandler);
|
|
32
21
|
// Block until the server stops (e.g. via signal abort).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for bridging polyfilled `Response` objects to native ones
|
|
3
|
+
* required by `Deno.serve`.
|
|
4
|
+
*
|
|
5
|
+
* In npm packages, dnt replaces the global `Response` with undici's polyfill,
|
|
6
|
+
* but `Deno.serve` requires native `Response` instances. These helpers access
|
|
7
|
+
* the native constructor via `self` (which dnt does not shim) and re-wrap
|
|
8
|
+
* polyfilled responses as needed.
|
|
9
|
+
*
|
|
10
|
+
* IMPORTANT: this module must remain importable without `--allow-env`. It must
|
|
11
|
+
* NOT read environment variables or import a logger at module load time.
|
|
12
|
+
*
|
|
13
|
+
* @module platform/compat/http/native-response
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The native `Response` constructor, accessed via `self` to bypass the dnt
|
|
17
|
+
* shim transform (dnt rewrites bare `Response` to undici's polyfill).
|
|
18
|
+
*/
|
|
19
|
+
export declare function getNativeResponse(): typeof Response;
|
|
20
|
+
/**
|
|
21
|
+
* Re-wrap a (possibly polyfilled) `Response` as a native `Response` so it can be
|
|
22
|
+
* returned from `Deno.serve`.
|
|
23
|
+
*
|
|
24
|
+
* If `response` is already a native instance (compiled binary or WebSocket
|
|
25
|
+
* upgrade), it is returned as-is. Otherwise its body/status/headers are copied
|
|
26
|
+
* into a fresh native `Response`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function toNativeResponse(response: Response, NativeResponse: typeof Response): Response;
|
|
29
|
+
//# sourceMappingURL=native-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-response.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/http/native-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,QAAQ,CAEnD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,OAAO,QAAQ,GAC9B,QAAQ,CAYV"}
|