@opencode/ai 0.0.0-dev-513 → 0.0.0-dev-520
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/llm.d.ts +0 -1
- package/dist/llm.js +0 -1
- package/dist/protocols/anthropic-messages.js +22 -80
- package/dist/protocols/cohere-chat.js +0 -3
- package/dist/protocols/shared.d.ts +0 -3
- package/dist/protocols/utils/bedrock-media.d.ts +0 -3
- package/dist/schema/messages.d.ts +0 -19
- package/dist/schema/messages.js +0 -8
- package/dist/tool-history.js +0 -1
- package/package.json +3 -3
package/dist/llm.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ interface TextRequestFields<Model extends LanguageModel> {
|
|
|
25
25
|
readonly cache?: CachePolicy;
|
|
26
26
|
/** Stable cache affinity for protocols that support provider-managed prompt caching. */
|
|
27
27
|
readonly promptCacheKey?: string;
|
|
28
|
-
readonly metadata?: Record<string, unknown>;
|
|
29
28
|
/** Emit a `raw` event with each provider frame before the events parsed from it. */
|
|
30
29
|
readonly includeRaw?: boolean;
|
|
31
30
|
}
|
package/dist/llm.js
CHANGED
|
@@ -485,68 +485,15 @@ const lowerServerToolResult = Effect.fnUntraced(function* (part, providerMetadat
|
|
|
485
485
|
content: payload,
|
|
486
486
|
};
|
|
487
487
|
});
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
if (typeof metadata.file_id === "string")
|
|
499
|
-
return metadata.file_id;
|
|
500
|
-
if (typeof metadata.fileId === "string")
|
|
501
|
-
return metadata.fileId;
|
|
502
|
-
return undefined;
|
|
503
|
-
};
|
|
504
|
-
const transformationsFromMetadata = (metadata) => {
|
|
505
|
-
if (!metadata)
|
|
506
|
-
return undefined;
|
|
507
|
-
const anthropic = ProviderShared.isRecord(metadata.anthropic) ? metadata.anthropic : undefined;
|
|
508
|
-
const raw = anthropic?.transformations ?? metadata.transformations;
|
|
509
|
-
if (ProviderShared.isRecord(raw)) {
|
|
510
|
-
const value = raw.oversized_image;
|
|
511
|
-
if (value === "downsize" || value === "error")
|
|
512
|
-
return { oversized_image: value };
|
|
513
|
-
}
|
|
514
|
-
if (anthropic && (anthropic.oversized_image === "downsize" || anthropic.oversized_image === "error"))
|
|
515
|
-
return { oversized_image: anthropic.oversized_image };
|
|
516
|
-
return undefined;
|
|
517
|
-
};
|
|
518
|
-
const documentTitleFromPart = (part) => {
|
|
519
|
-
if (part.metadata !== undefined) {
|
|
520
|
-
const anthropic = part.metadata.anthropic;
|
|
521
|
-
if (ProviderShared.isRecord(anthropic) && typeof anthropic.title === "string")
|
|
522
|
-
return anthropic.title;
|
|
523
|
-
if (typeof part.metadata.title === "string")
|
|
524
|
-
return part.metadata.title;
|
|
525
|
-
}
|
|
526
|
-
if (part.filename && part.filename.length > 0)
|
|
527
|
-
return part.filename;
|
|
528
|
-
return undefined;
|
|
529
|
-
};
|
|
530
|
-
const documentContextFromMetadata = (metadata) => {
|
|
531
|
-
if (!metadata)
|
|
532
|
-
return undefined;
|
|
533
|
-
const anthropic = ProviderShared.isRecord(metadata.anthropic) ? metadata.anthropic : undefined;
|
|
534
|
-
if (anthropic && typeof anthropic.context === "string")
|
|
535
|
-
return anthropic.context;
|
|
536
|
-
if (typeof metadata.context === "string")
|
|
537
|
-
return metadata.context;
|
|
538
|
-
return undefined;
|
|
539
|
-
};
|
|
540
|
-
const citationsFromMetadata = (metadata) => {
|
|
541
|
-
if (!metadata)
|
|
542
|
-
return undefined;
|
|
543
|
-
const raw = ProviderShared.isRecord(metadata.anthropic)
|
|
544
|
-
? (metadata.anthropic.citations ?? metadata.citations)
|
|
545
|
-
: metadata.citations;
|
|
546
|
-
if (ProviderShared.isRecord(raw) && typeof raw.enabled === "boolean")
|
|
547
|
-
return { enabled: raw.enabled };
|
|
548
|
-
return undefined;
|
|
549
|
-
};
|
|
488
|
+
// Per-part Anthropic block fields, read from `providerMetadata[providerMetadataKey]` with Anthropic's wire names.
|
|
489
|
+
const MediaOptions = Schema.Struct({
|
|
490
|
+
file_id: Schema.optional(Schema.String),
|
|
491
|
+
title: Schema.optional(Schema.String),
|
|
492
|
+
context: Schema.optional(Schema.String),
|
|
493
|
+
citations: Schema.optional(Schema.Struct({ enabled: Schema.Boolean })),
|
|
494
|
+
transformations: Schema.optional(AnthropicImageTransformations),
|
|
495
|
+
});
|
|
496
|
+
const decodeMediaOptions = ProviderShared.validateWith(Schema.decodeUnknownEffect(MediaOptions));
|
|
550
497
|
const isHttpUrl = (value) => /^https?:\/\//i.test(value.trim());
|
|
551
498
|
const lowerMedia = Effect.fnUntraced(function* (part, request, breakpoints) {
|
|
552
499
|
const mime = part.media.mediaType.toLowerCase();
|
|
@@ -564,34 +511,29 @@ const lowerMedia = Effect.fnUntraced(function* (part, request, breakpoints) {
|
|
|
564
511
|
...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
|
|
565
512
|
};
|
|
566
513
|
}
|
|
567
|
-
const
|
|
568
|
-
const image = (source) => {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
...(transformations === undefined ? {} : { transformations }),
|
|
575
|
-
};
|
|
576
|
-
};
|
|
514
|
+
const options = yield* decodeMediaOptions(part.providerMetadata?.[request.model.route.providerMetadataKey ?? request.model.provider] ?? {});
|
|
515
|
+
const image = (source) => ({
|
|
516
|
+
type: "image",
|
|
517
|
+
source,
|
|
518
|
+
...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
|
|
519
|
+
...(options.transformations === undefined ? {} : { transformations: options.transformations }),
|
|
520
|
+
});
|
|
577
521
|
const document = (source) => {
|
|
578
|
-
const title =
|
|
579
|
-
const context = documentContextFromMetadata(part.metadata);
|
|
580
|
-
const citations = citationsFromMetadata(part.metadata);
|
|
522
|
+
const title = options.title ?? (part.filename ? part.filename : undefined);
|
|
581
523
|
return {
|
|
582
524
|
type: "document",
|
|
583
525
|
source,
|
|
584
526
|
...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }),
|
|
585
527
|
...(title === undefined ? {} : { title }),
|
|
586
|
-
...(context === undefined ? {} : { context }),
|
|
587
|
-
...(citations === undefined ? {} : { citations }),
|
|
528
|
+
...(options.context === undefined ? {} : { context: options.context }),
|
|
529
|
+
...(options.citations === undefined ? {} : { citations: options.citations }),
|
|
588
530
|
};
|
|
589
531
|
};
|
|
590
532
|
// SDK file sources: FileImageSource:2350 / FileDocumentSource:2344 {type:"file", file_id}
|
|
591
|
-
if (
|
|
533
|
+
if (options.file_id) {
|
|
592
534
|
if (mime.startsWith("image/"))
|
|
593
|
-
return image({ type: "file", file_id:
|
|
594
|
-
return document({ type: "file", file_id:
|
|
535
|
+
return image({ type: "file", file_id: options.file_id });
|
|
536
|
+
return document({ type: "file", file_id: options.file_id });
|
|
595
537
|
}
|
|
596
538
|
const rawString = ProviderShared.mediaUrl(part.media)?.trim();
|
|
597
539
|
// SDK URL sources: URLImageSource:3817 / URLPDFSource:3823 {type:"url", url}
|
|
@@ -304,9 +304,6 @@ export const protocol = Protocol.make({
|
|
|
304
304
|
initial: () => ({ lifecycle: Lifecycle.initial(), tools: ToolStream.empty(), finished: false }),
|
|
305
305
|
step,
|
|
306
306
|
terminal: (event) => event.type === "message-end",
|
|
307
|
-
onHalt: (state) => state.finished
|
|
308
|
-
? Effect.succeed([])
|
|
309
|
-
: Effect.fail(ProviderShared.eventError(ADAPTER, "Cohere stream ended without message-end")),
|
|
310
307
|
},
|
|
311
308
|
});
|
|
312
309
|
export const route = Route.make({
|
|
@@ -113,9 +113,6 @@ export declare const systemUpdateText: (route: string, message: Message) => Effe
|
|
|
113
113
|
readonly type: "text";
|
|
114
114
|
readonly text: string;
|
|
115
115
|
readonly cache?: import("../schema/options.js").CacheHint | undefined;
|
|
116
|
-
readonly metadata?: {
|
|
117
|
-
readonly [x: string]: unknown;
|
|
118
|
-
} | undefined;
|
|
119
116
|
readonly providerMetadata?: {
|
|
120
117
|
readonly [x: string]: {
|
|
121
118
|
readonly [x: string]: unknown;
|
|
@@ -27,9 +27,6 @@ export declare const lower: (part: {
|
|
|
27
27
|
readonly media: import("../../media.js").Asset;
|
|
28
28
|
readonly filename?: string | undefined;
|
|
29
29
|
readonly cache?: import("../../schema/options.js").CacheHint | undefined;
|
|
30
|
-
readonly metadata?: {
|
|
31
|
-
readonly [x: string]: unknown;
|
|
32
|
-
} | undefined;
|
|
33
30
|
readonly providerMetadata?: {
|
|
34
31
|
readonly [x: string]: {
|
|
35
32
|
readonly [x: string]: unknown;
|
|
@@ -25,7 +25,6 @@ export declare const TextPart: Schema.Struct<{
|
|
|
25
25
|
readonly type: Schema.Literal<"text">;
|
|
26
26
|
readonly text: Schema.String;
|
|
27
27
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
28
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
29
28
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
30
29
|
}>;
|
|
31
30
|
export type TextPart = Schema.Schema.Type<typeof TextPart>;
|
|
@@ -64,7 +63,6 @@ export declare const MediaPart: Schema.Struct<{
|
|
|
64
63
|
}>, never, never>;
|
|
65
64
|
readonly filename: Schema.optional<Schema.String>;
|
|
66
65
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
67
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
68
66
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
69
67
|
}>;
|
|
70
68
|
export type MediaPart = Schema.Schema.Type<typeof MediaPart>;
|
|
@@ -162,7 +160,6 @@ export declare const ToolCallPart: Schema.Struct<{
|
|
|
162
160
|
readonly input: Schema.Unknown;
|
|
163
161
|
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
164
162
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
165
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
166
163
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
167
164
|
}> & {
|
|
168
165
|
make: (input: Omit<ToolCallPart, "type">) => ToolCallPart;
|
|
@@ -219,7 +216,6 @@ export declare const ToolResultPart: Schema.Struct<{
|
|
|
219
216
|
};
|
|
220
217
|
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
221
218
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
222
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
223
219
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
224
220
|
}> & {
|
|
225
221
|
make: (input: Omit<ToolResultPart, "type" | "result"> & {
|
|
@@ -233,7 +229,6 @@ export declare const ReasoningPart: Schema.Struct<{
|
|
|
233
229
|
readonly text: Schema.String;
|
|
234
230
|
readonly encrypted: Schema.optional<Schema.String>;
|
|
235
231
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
236
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
237
232
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
238
233
|
}>;
|
|
239
234
|
export type ReasoningPart = Schema.Schema.Type<typeof ReasoningPart>;
|
|
@@ -287,7 +282,6 @@ export declare const ContentPart: Schema.toTaggedUnion<"type", readonly [Schema.
|
|
|
287
282
|
readonly type: Schema.Literal<"text">;
|
|
288
283
|
readonly text: Schema.String;
|
|
289
284
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
290
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
291
285
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
292
286
|
}>, Schema.Struct<{
|
|
293
287
|
readonly type: Schema.Literal<"media">;
|
|
@@ -324,7 +318,6 @@ export declare const ContentPart: Schema.toTaggedUnion<"type", readonly [Schema.
|
|
|
324
318
|
}>, never, never>;
|
|
325
319
|
readonly filename: Schema.optional<Schema.String>;
|
|
326
320
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
327
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
328
321
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
329
322
|
}>, Schema.Struct<{
|
|
330
323
|
readonly type: Schema.Literal<"tool-call">;
|
|
@@ -334,7 +327,6 @@ export declare const ContentPart: Schema.toTaggedUnion<"type", readonly [Schema.
|
|
|
334
327
|
readonly input: Schema.Unknown;
|
|
335
328
|
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
336
329
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
337
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
338
330
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
339
331
|
}> & {
|
|
340
332
|
make: (input: Omit<ToolCallPart, "type">) => ToolCallPart;
|
|
@@ -389,7 +381,6 @@ export declare const ContentPart: Schema.toTaggedUnion<"type", readonly [Schema.
|
|
|
389
381
|
};
|
|
390
382
|
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
391
383
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
392
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
393
384
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
394
385
|
}> & {
|
|
395
386
|
make: (input: Omit<ToolResultPart, "type" | "result"> & {
|
|
@@ -401,7 +392,6 @@ export declare const ContentPart: Schema.toTaggedUnion<"type", readonly [Schema.
|
|
|
401
392
|
readonly text: Schema.String;
|
|
402
393
|
readonly encrypted: Schema.optional<Schema.String>;
|
|
403
394
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
404
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
405
395
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
406
396
|
}>, Schema.refine<{
|
|
407
397
|
readonly type: "compaction";
|
|
@@ -431,7 +421,6 @@ declare const Message_base: Schema.Class<Message, Schema.Struct<{
|
|
|
431
421
|
readonly type: Schema.Literal<"text">;
|
|
432
422
|
readonly text: Schema.String;
|
|
433
423
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
434
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
435
424
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
436
425
|
}>, Schema.Struct<{
|
|
437
426
|
readonly type: Schema.Literal<"media">;
|
|
@@ -468,7 +457,6 @@ declare const Message_base: Schema.Class<Message, Schema.Struct<{
|
|
|
468
457
|
}>, never, never>;
|
|
469
458
|
readonly filename: Schema.optional<Schema.String>;
|
|
470
459
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
471
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
472
460
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
473
461
|
}>, Schema.Struct<{
|
|
474
462
|
readonly type: Schema.Literal<"tool-call">;
|
|
@@ -478,7 +466,6 @@ declare const Message_base: Schema.Class<Message, Schema.Struct<{
|
|
|
478
466
|
readonly input: Schema.Unknown;
|
|
479
467
|
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
480
468
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
481
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
482
469
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
483
470
|
}> & {
|
|
484
471
|
make: (input: Omit<ToolCallPart, "type">) => ToolCallPart;
|
|
@@ -533,7 +520,6 @@ declare const Message_base: Schema.Class<Message, Schema.Struct<{
|
|
|
533
520
|
};
|
|
534
521
|
readonly providerExecuted: Schema.optional<Schema.Boolean>;
|
|
535
522
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
536
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
537
523
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
538
524
|
}> & {
|
|
539
525
|
make: (input: Omit<ToolResultPart, "type" | "result"> & {
|
|
@@ -545,7 +531,6 @@ declare const Message_base: Schema.Class<Message, Schema.Struct<{
|
|
|
545
531
|
readonly text: Schema.String;
|
|
546
532
|
readonly encrypted: Schema.optional<Schema.String>;
|
|
547
533
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
548
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
549
534
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
550
535
|
}>, Schema.refine<{
|
|
551
536
|
readonly type: "compaction";
|
|
@@ -567,7 +552,6 @@ declare const Message_base: Schema.Class<Message, Schema.Struct<{
|
|
|
567
552
|
readonly effort: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
|
|
568
553
|
readonly previous: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
|
|
569
554
|
}>]>>;
|
|
570
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
571
555
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
572
556
|
readonly native: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
573
557
|
}>, {}>;
|
|
@@ -627,7 +611,6 @@ declare const toolDefinitionFields: {
|
|
|
627
611
|
readonly grammar: Schema.String;
|
|
628
612
|
}>]>>;
|
|
629
613
|
cache: Schema.optional<typeof CacheHint>;
|
|
630
|
-
metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
631
614
|
native: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
632
615
|
};
|
|
633
616
|
export type ToolDefinitionInput = Schema.Struct.Type<typeof toolDefinitionFields>;
|
|
@@ -646,7 +629,6 @@ declare const ToolDefinition_base: Schema.Class<ToolDefinition, Schema.Struct<{
|
|
|
646
629
|
readonly grammar: Schema.String;
|
|
647
630
|
}>]>>;
|
|
648
631
|
readonly cache: Schema.optional<typeof CacheHint>;
|
|
649
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
650
632
|
readonly native: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
651
633
|
readonly type: Schema.Literal<"tool">;
|
|
652
634
|
}>, {}>;
|
|
@@ -712,7 +694,6 @@ export interface LLMRequest<Model extends LanguageModel = LanguageModel> {
|
|
|
712
694
|
readonly cache?: CachePolicy;
|
|
713
695
|
/** Stable cache affinity for protocols that support provider-managed prompt caching. */
|
|
714
696
|
readonly promptCacheKey?: string;
|
|
715
|
-
readonly metadata?: Record<string, unknown>;
|
|
716
697
|
/** Emit a `raw` event with each provider frame before the events parsed from it. */
|
|
717
698
|
readonly includeRaw?: boolean;
|
|
718
699
|
}
|
package/dist/schema/messages.js
CHANGED
|
@@ -25,7 +25,6 @@ export const TextPart = Schema.Struct({
|
|
|
25
25
|
type: Schema.Literal("text"),
|
|
26
26
|
text: Schema.String,
|
|
27
27
|
cache: Schema.optional(CacheHint),
|
|
28
|
-
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
29
28
|
providerMetadata: Schema.optional(ProviderMetadata),
|
|
30
29
|
}).annotate({ identifier: "LLM.Content.Text" });
|
|
31
30
|
export const MediaPart = Schema.Struct({
|
|
@@ -33,7 +32,6 @@ export const MediaPart = Schema.Struct({
|
|
|
33
32
|
media: Media.AssetSchema,
|
|
34
33
|
filename: Schema.optional(Schema.String),
|
|
35
34
|
cache: Schema.optional(CacheHint),
|
|
36
|
-
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
37
35
|
providerMetadata: Schema.optional(ProviderMetadata),
|
|
38
36
|
}).annotate({ identifier: "LLM.Content.Media" });
|
|
39
37
|
const toolResultValueSchema = Schema.Union([
|
|
@@ -104,7 +102,6 @@ export const ToolCallPart = withStatics(Schema.Struct({
|
|
|
104
102
|
input: Schema.Unknown,
|
|
105
103
|
providerExecuted: Schema.optional(Schema.Boolean),
|
|
106
104
|
cache: Schema.optional(CacheHint),
|
|
107
|
-
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
108
105
|
providerMetadata: Schema.optional(ProviderMetadata),
|
|
109
106
|
}).annotate({ identifier: "LLM.Content.ToolCall" }), {
|
|
110
107
|
make: (input) => ({ type: "tool-call", ...input }),
|
|
@@ -117,7 +114,6 @@ export const ToolResultPart = withStatics(Schema.Struct({
|
|
|
117
114
|
result: ToolResultValue,
|
|
118
115
|
providerExecuted: Schema.optional(Schema.Boolean),
|
|
119
116
|
cache: Schema.optional(CacheHint),
|
|
120
|
-
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
121
117
|
providerMetadata: Schema.optional(ProviderMetadata),
|
|
122
118
|
}).annotate({ identifier: "LLM.Content.ToolResult" }), {
|
|
123
119
|
make: (input) => ({
|
|
@@ -128,7 +124,6 @@ export const ToolResultPart = withStatics(Schema.Struct({
|
|
|
128
124
|
result: ToolResultValue.make(input.result, input.resultType),
|
|
129
125
|
providerExecuted: input.providerExecuted,
|
|
130
126
|
cache: input.cache,
|
|
131
|
-
metadata: input.metadata,
|
|
132
127
|
providerMetadata: input.providerMetadata,
|
|
133
128
|
}),
|
|
134
129
|
});
|
|
@@ -137,7 +132,6 @@ export const ReasoningPart = Schema.Struct({
|
|
|
137
132
|
text: Schema.String,
|
|
138
133
|
encrypted: Schema.optional(Schema.String),
|
|
139
134
|
cache: Schema.optional(CacheHint),
|
|
140
|
-
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
141
135
|
providerMetadata: Schema.optional(ProviderMetadata),
|
|
142
136
|
}).annotate({ identifier: "LLM.Content.Reasoning" });
|
|
143
137
|
const compactionPartSchema = Schema.Struct({
|
|
@@ -172,7 +166,6 @@ export class Message extends Schema.Class("LLM.Message")({
|
|
|
172
166
|
id: Schema.optional(Schema.String),
|
|
173
167
|
role: MessageRole,
|
|
174
168
|
content: Schema.Array(ContentPart),
|
|
175
|
-
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
176
169
|
providerMetadata: Schema.optional(ProviderMetadata),
|
|
177
170
|
native: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
178
171
|
}) {
|
|
@@ -218,7 +211,6 @@ const toolDefinitionFields = {
|
|
|
218
211
|
outputSchema: Schema.optional(JsonSchema),
|
|
219
212
|
freeform: Schema.optional(Freeform),
|
|
220
213
|
cache: Schema.optional(CacheHint),
|
|
221
|
-
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
222
214
|
native: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
223
215
|
};
|
|
224
216
|
export class ToolDefinition extends Schema.Class("LLM.ToolDefinition")({
|
package/dist/tool-history.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-520",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -520,7 +520,7 @@
|
|
|
520
520
|
"devDependencies": {
|
|
521
521
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
522
522
|
"@effect/platform-node": "4.1.0",
|
|
523
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
523
|
+
"@opencode/http-recorder": "0.0.0-dev-520",
|
|
524
524
|
"@tsconfig/bun": "1.0.9",
|
|
525
525
|
"@types/bun": "1.4.3",
|
|
526
526
|
"@typescript/native": "npm:typescript@7.1.0-beta",
|
|
@@ -530,7 +530,7 @@
|
|
|
530
530
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
531
531
|
"@smithy/eventstream-codec": "4.2.14",
|
|
532
532
|
"@smithy/util-utf8": "4.2.2",
|
|
533
|
-
"@opencode/schema": "0.0.0-dev-
|
|
533
|
+
"@opencode/schema": "0.0.0-dev-520",
|
|
534
534
|
"aws4fetch": "1.0.20",
|
|
535
535
|
"effect": "4.1.0",
|
|
536
536
|
"google-auth-library": "10.5.0"
|