@opencode-ai/ai
Advanced tools
@@ -53,7 +53,13 @@ import { Schema } from "effect"; | ||
| readonly type: Schema.tag<"image">; | ||
| readonly source: Schema.Struct<{ | ||
| readonly source: Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.tag<"base64">; | ||
| readonly media_type: Schema.String; | ||
| readonly data: Schema.String; | ||
| }>; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"url">; | ||
| readonly url: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"file">; | ||
| readonly file_id: Schema.String; | ||
| }>]>; | ||
| readonly cache_control: Schema.optional<Schema.Struct<{ | ||
@@ -63,9 +69,22 @@ readonly type: Schema.tag<"ephemeral">; | ||
| }>>; | ||
| readonly transformations: Schema.optional<Schema.Struct<{ | ||
| readonly oversized_image: Schema.optional<Schema.Literals<readonly ["downsize", "error"]>>; | ||
| }>>; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"document">; | ||
| readonly source: Schema.Struct<{ | ||
| readonly source: Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.tag<"base64">; | ||
| readonly media_type: Schema.Literal<"application/pdf">; | ||
| readonly data: Schema.String; | ||
| }>; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"text">; | ||
| readonly media_type: Schema.Literal<"text/plain">; | ||
| readonly data: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"url">; | ||
| readonly url: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"file">; | ||
| readonly file_id: Schema.String; | ||
| }>]>; | ||
| readonly cache_control: Schema.optional<Schema.Struct<{ | ||
@@ -75,2 +94,7 @@ readonly type: Schema.tag<"ephemeral">; | ||
| }>>; | ||
| readonly title: Schema.optional<Schema.String>; | ||
| readonly context: Schema.optional<Schema.String>; | ||
| readonly citations: Schema.optional<Schema.Struct<{ | ||
| readonly enabled: Schema.Boolean; | ||
| }>>; | ||
| }>, Schema.Struct<{ | ||
@@ -88,7 +112,13 @@ readonly type: Schema.tag<"tool_result">; | ||
| readonly type: Schema.tag<"image">; | ||
| readonly source: Schema.Struct<{ | ||
| readonly source: Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.tag<"base64">; | ||
| readonly media_type: Schema.String; | ||
| readonly data: Schema.String; | ||
| }>; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"url">; | ||
| readonly url: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"file">; | ||
| readonly file_id: Schema.String; | ||
| }>]>; | ||
| readonly cache_control: Schema.optional<Schema.Struct<{ | ||
@@ -98,9 +128,22 @@ readonly type: Schema.tag<"ephemeral">; | ||
| }>>; | ||
| readonly transformations: Schema.optional<Schema.Struct<{ | ||
| readonly oversized_image: Schema.optional<Schema.Literals<readonly ["downsize", "error"]>>; | ||
| }>>; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"document">; | ||
| readonly source: Schema.Struct<{ | ||
| readonly source: Schema.Union<readonly [Schema.Struct<{ | ||
| readonly type: Schema.tag<"base64">; | ||
| readonly media_type: Schema.Literal<"application/pdf">; | ||
| readonly data: Schema.String; | ||
| }>; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"text">; | ||
| readonly media_type: Schema.Literal<"text/plain">; | ||
| readonly data: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"url">; | ||
| readonly url: Schema.String; | ||
| }>, Schema.Struct<{ | ||
| readonly type: Schema.tag<"file">; | ||
| readonly file_id: Schema.String; | ||
| }>]>; | ||
| readonly cache_control: Schema.optional<Schema.Struct<{ | ||
@@ -110,2 +153,7 @@ readonly type: Schema.tag<"ephemeral">; | ||
| }>>; | ||
| readonly title: Schema.optional<Schema.String>; | ||
| readonly context: Schema.optional<Schema.String>; | ||
| readonly citations: Schema.optional<Schema.Struct<{ | ||
| readonly enabled: Schema.Boolean; | ||
| }>>; | ||
| }>]>>]>; | ||
@@ -241,2 +289,8 @@ readonly is_error: Schema.optional<Schema.Boolean>; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
@@ -247,2 +301,5 @@ readonly cache_control?: { | ||
| } | undefined; | ||
| readonly transformations?: { | ||
| readonly oversized_image?: "error" | "downsize" | undefined; | ||
| } | undefined; | ||
| } | { | ||
@@ -254,3 +311,15 @@ readonly type: "document"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly media_type: "text/plain"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
| readonly title?: string | undefined; | ||
| readonly context?: string | undefined; | ||
| readonly cache_control?: { | ||
@@ -260,2 +329,5 @@ readonly type: "ephemeral"; | ||
| } | undefined; | ||
| readonly citations?: { | ||
| readonly enabled: boolean; | ||
| } | undefined; | ||
| } | { | ||
@@ -276,2 +348,8 @@ readonly type: "tool_result"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
@@ -282,2 +360,5 @@ readonly cache_control?: { | ||
| } | undefined; | ||
| readonly transformations?: { | ||
| readonly oversized_image?: "error" | "downsize" | undefined; | ||
| } | undefined; | ||
| } | { | ||
@@ -289,3 +370,15 @@ readonly type: "document"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly media_type: "text/plain"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
| readonly title?: string | undefined; | ||
| readonly context?: string | undefined; | ||
| readonly cache_control?: { | ||
@@ -295,2 +388,5 @@ readonly type: "ephemeral"; | ||
| } | undefined; | ||
| readonly citations?: { | ||
| readonly enabled: boolean; | ||
| } | undefined; | ||
| })[]; | ||
@@ -494,2 +590,8 @@ readonly tool_use_id: string; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
@@ -500,2 +602,5 @@ readonly cache_control?: { | ||
| } | undefined; | ||
| readonly transformations?: { | ||
| readonly oversized_image?: "error" | "downsize" | undefined; | ||
| } | undefined; | ||
| } | { | ||
@@ -507,3 +612,15 @@ readonly type: "document"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly media_type: "text/plain"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
| readonly title?: string | undefined; | ||
| readonly context?: string | undefined; | ||
| readonly cache_control?: { | ||
@@ -513,2 +630,5 @@ readonly type: "ephemeral"; | ||
| } | undefined; | ||
| readonly citations?: { | ||
| readonly enabled: boolean; | ||
| } | undefined; | ||
| } | { | ||
@@ -529,2 +649,8 @@ readonly type: "tool_result"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
@@ -535,2 +661,5 @@ readonly cache_control?: { | ||
| } | undefined; | ||
| readonly transformations?: { | ||
| readonly oversized_image?: "error" | "downsize" | undefined; | ||
| } | undefined; | ||
| } | { | ||
@@ -542,3 +671,15 @@ readonly type: "document"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly media_type: "text/plain"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
| readonly title?: string | undefined; | ||
| readonly context?: string | undefined; | ||
| readonly cache_control?: { | ||
@@ -548,2 +689,5 @@ readonly type: "ephemeral"; | ||
| } | undefined; | ||
| readonly citations?: { | ||
| readonly enabled: boolean; | ||
| } | undefined; | ||
| })[]; | ||
@@ -550,0 +694,0 @@ readonly tool_use_id: string; |
@@ -0,1 +1,2 @@ | ||
| import { Buffer } from "node:buffer"; | ||
| import { Effect, Schema } from "effect"; | ||
@@ -43,19 +44,53 @@ import { Tool } from "@opencode-ai/schema/tool"; | ||
| }); | ||
| // SDK: Base64ImageSource:201 {type:"base64", media_type:"image/jpeg"|... , data}, URLImageSource:3817 {type:"url", url}, FileImageSource:2350 {type:"file", file_id} | ||
| // SDK: ImageBlockParam:2356 {source: Base64|URL|File, cache_control, transformations:2381 {oversized_image?}} | ||
| const AnthropicBase64ImageSource = Schema.Struct({ | ||
| type: Schema.tag("base64"), | ||
| media_type: Schema.String, | ||
| data: Schema.String, | ||
| }); | ||
| const AnthropicURLImageSource = Schema.Struct({ type: Schema.tag("url"), url: Schema.String }); | ||
| const AnthropicFileImageSource = Schema.Struct({ type: Schema.tag("file"), file_id: Schema.String }); | ||
| const AnthropicImageSource = Schema.Union([ | ||
| AnthropicBase64ImageSource, | ||
| AnthropicURLImageSource, | ||
| AnthropicFileImageSource, | ||
| ]); | ||
| const AnthropicImageTransformations = Schema.Struct({ | ||
| oversized_image: Schema.optional(Schema.Literals(["downsize", "error"])), | ||
| }); | ||
| const AnthropicImageBlock = Schema.Struct({ | ||
| type: Schema.tag("image"), | ||
| source: Schema.Struct({ | ||
| type: Schema.tag("base64"), | ||
| media_type: Schema.String, | ||
| data: Schema.String, | ||
| }), | ||
| source: AnthropicImageSource, | ||
| cache_control: Schema.optional(AnthropicCacheControl), | ||
| transformations: Schema.optional(AnthropicImageTransformations), | ||
| }); | ||
| // SDK: Base64PDFSource:209 {type:"base64", media_type:"application/pdf", data}, PlainTextSource:2716 {type:"text", media_type:"text/plain", data}, | ||
| // SDK: URLPDFSource:3823 {type:"url", url}, FileDocumentSource:2344 {type:"file", file_id}, ContentBlockSource:2266 {type:"content", content} | ||
| // SDK: DocumentBlockParam:2297 {source: 5-way union, cache_control, citations, context, title} | ||
| const AnthropicBase64PDFSource = Schema.Struct({ | ||
| type: Schema.tag("base64"), | ||
| media_type: Schema.Literal("application/pdf"), | ||
| data: Schema.String, | ||
| }); | ||
| const AnthropicPlainTextSource = Schema.Struct({ | ||
| type: Schema.tag("text"), | ||
| media_type: Schema.Literal("text/plain"), | ||
| data: Schema.String, | ||
| }); | ||
| const AnthropicURLPDFSource = Schema.Struct({ type: Schema.tag("url"), url: Schema.String }); | ||
| const AnthropicFileDocumentSource = Schema.Struct({ type: Schema.tag("file"), file_id: Schema.String }); | ||
| const AnthropicDocumentSource = Schema.Union([ | ||
| AnthropicBase64PDFSource, | ||
| AnthropicPlainTextSource, | ||
| AnthropicURLPDFSource, | ||
| AnthropicFileDocumentSource, | ||
| ]); | ||
| const AnthropicDocumentBlock = Schema.Struct({ | ||
| type: Schema.tag("document"), | ||
| source: Schema.Struct({ | ||
| type: Schema.tag("base64"), | ||
| media_type: Schema.Literal("application/pdf"), | ||
| data: Schema.String, | ||
| }), | ||
| source: AnthropicDocumentSource, | ||
| cache_control: Schema.optional(AnthropicCacheControl), | ||
| title: Schema.optional(Schema.String), | ||
| context: Schema.optional(Schema.String), | ||
| citations: Schema.optional(Schema.Struct({ enabled: Schema.Boolean })), | ||
| }); | ||
@@ -329,3 +364,145 @@ const AnthropicThinkingBlock = Schema.Struct({ | ||
| }); | ||
| const lowerMedia = Effect.fn("AnthropicMessages.lowerMedia")(function* (part) { | ||
| const fileIdFromMetadata = (metadata) => { | ||
| if (!ProviderShared.isRecord(metadata)) | ||
| return undefined; | ||
| const anthropic = metadata.anthropic; | ||
| if (ProviderShared.isRecord(anthropic)) { | ||
| if (typeof anthropic.file_id === "string") | ||
| return anthropic.file_id; | ||
| if (typeof anthropic.fileId === "string") | ||
| return anthropic.fileId; | ||
| } | ||
| if (typeof metadata.file_id === "string") | ||
| return metadata.file_id; | ||
| if (typeof metadata.fileId === "string") | ||
| return metadata.fileId; | ||
| return undefined; | ||
| }; | ||
| const transformationsFromMetadata = (metadata) => { | ||
| if (!ProviderShared.isRecord(metadata)) | ||
| return undefined; | ||
| const anthropic = ProviderShared.isRecord(metadata.anthropic) ? metadata.anthropic : undefined; | ||
| const raw = anthropic?.transformations ?? metadata.transformations; | ||
| if (ProviderShared.isRecord(raw)) { | ||
| const value = raw.oversized_image; | ||
| if (value === "downsize" || value === "error") | ||
| return { oversized_image: value }; | ||
| } | ||
| if (anthropic && (anthropic.oversized_image === "downsize" || anthropic.oversized_image === "error")) | ||
| return { oversized_image: anthropic.oversized_image }; | ||
| return undefined; | ||
| }; | ||
| const documentTitleFromPart = (part) => { | ||
| if (ProviderShared.isRecord(part.metadata)) { | ||
| const anthropic = part.metadata.anthropic; | ||
| if (ProviderShared.isRecord(anthropic) && typeof anthropic.title === "string") | ||
| return anthropic.title; | ||
| if (typeof part.metadata.title === "string") | ||
| return part.metadata.title; | ||
| } | ||
| if (typeof part.filename === "string" && part.filename.length > 0) | ||
| return part.filename; | ||
| return undefined; | ||
| }; | ||
| const documentContextFromMetadata = (metadata) => { | ||
| if (!ProviderShared.isRecord(metadata)) | ||
| return undefined; | ||
| const anthropic = ProviderShared.isRecord(metadata.anthropic) ? metadata.anthropic : undefined; | ||
| if (anthropic && typeof anthropic.context === "string") | ||
| return anthropic.context; | ||
| if (typeof metadata.context === "string") | ||
| return metadata.context; | ||
| return undefined; | ||
| }; | ||
| const citationsFromMetadata = (metadata) => { | ||
| if (!ProviderShared.isRecord(metadata)) | ||
| return undefined; | ||
| const raw = ProviderShared.isRecord(metadata.anthropic) | ||
| ? (metadata.anthropic.citations ?? metadata.citations) | ||
| : metadata.citations; | ||
| if (ProviderShared.isRecord(raw) && typeof raw.enabled === "boolean") | ||
| return { enabled: raw.enabled }; | ||
| return undefined; | ||
| }; | ||
| const isHttpUrl = (value) => /^https?:\/\//i.test(value.trim()); | ||
| const lowerMedia = Effect.fn("AnthropicMessages.lowerMedia")(function* (part, breakpoints) { | ||
| const mime = part.mediaType.toLowerCase(); | ||
| const cacheControlValue = breakpoints ? cacheControl(breakpoints, part.cache) : undefined; | ||
| const fileId = fileIdFromMetadata(part.metadata); | ||
| // SDK file sources: FileImageSource:2350 / FileDocumentSource:2344 {type:"file", file_id} | ||
| if (fileId) { | ||
| if (mime.startsWith("image/")) | ||
| return { | ||
| type: "image", | ||
| source: { type: "file", file_id: fileId }, | ||
| ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }), | ||
| ...(transformationsFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { transformations: transformationsFromMetadata(part.metadata) }), | ||
| }; | ||
| return { | ||
| type: "document", | ||
| source: { type: "file", file_id: fileId }, | ||
| ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }), | ||
| ...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }), | ||
| ...(documentContextFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { context: documentContextFromMetadata(part.metadata) }), | ||
| ...(citationsFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { citations: citationsFromMetadata(part.metadata) }), | ||
| }; | ||
| } | ||
| const rawString = typeof part.data === "string" ? part.data.trim() : undefined; | ||
| // SDK URL sources: URLImageSource:3817 / URLPDFSource:3823 {type:"url", url} | ||
| if (rawString && isHttpUrl(rawString) && !rawString.startsWith("data:")) { | ||
| if (mime.startsWith("image/")) | ||
| return { | ||
| type: "image", | ||
| source: { type: "url", url: rawString }, | ||
| ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }), | ||
| ...(transformationsFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { transformations: transformationsFromMetadata(part.metadata) }), | ||
| }; | ||
| if (mime === "application/pdf") | ||
| return { | ||
| type: "document", | ||
| source: { type: "url", url: rawString }, | ||
| ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }), | ||
| ...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }), | ||
| ...(documentContextFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { context: documentContextFromMetadata(part.metadata) }), | ||
| ...(citationsFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { citations: citationsFromMetadata(part.metadata) }), | ||
| }; | ||
| } | ||
| // SDK PlainTextSource:2716 {type:"text", media_type:"text/plain", data} | ||
| if (mime === "text/plain") { | ||
| const textData = typeof part.data !== "string" | ||
| ? Buffer.from(part.data).toString("utf8") | ||
| : part.data.startsWith("data:") | ||
| ? (() => { | ||
| const comma = part.data.indexOf(","); | ||
| const payload = comma >= 0 ? part.data.slice(comma + 1) : part.data; | ||
| return part.data.includes(";base64") | ||
| ? Buffer.from(payload, "base64").toString("utf8") | ||
| : decodeURIComponent(payload); | ||
| })() | ||
| : part.data; | ||
| return { | ||
| type: "document", | ||
| source: { type: "text", media_type: "text/plain", data: textData }, | ||
| ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }), | ||
| ...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }), | ||
| ...(documentContextFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { context: documentContextFromMetadata(part.metadata) }), | ||
| ...(citationsFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { citations: citationsFromMetadata(part.metadata) }), | ||
| }; | ||
| } | ||
| const media = ProviderShared.normalizeMedia(part); | ||
@@ -340,2 +517,10 @@ if (media.mime === "application/pdf") | ||
| }, | ||
| ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }), | ||
| ...(documentTitleFromPart(part) === undefined ? {} : { title: documentTitleFromPart(part) }), | ||
| ...(documentContextFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { context: documentContextFromMetadata(part.metadata) }), | ||
| ...(citationsFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { citations: citationsFromMetadata(part.metadata) }), | ||
| }; | ||
@@ -351,2 +536,6 @@ if (!media.mime.startsWith("image/")) | ||
| }, | ||
| ...(cacheControlValue === undefined ? {} : { cache_control: cacheControlValue }), | ||
| ...(transformationsFromMetadata(part.metadata) === undefined | ||
| ? {} | ||
| : { transformations: transformationsFromMetadata(part.metadata) }), | ||
| }; | ||
@@ -447,3 +636,3 @@ }); | ||
| if (part.type === "media") { | ||
| content.push(yield* lowerMedia(part)); | ||
| content.push(yield* lowerMedia(part, breakpoints)); | ||
| continue; | ||
@@ -450,0 +639,0 @@ } |
@@ -32,2 +32,3 @@ import { Effect, Schema } from "effect"; | ||
| } | undefined; | ||
| readonly cache?: import("../../schema/options.js").CacheHint | undefined; | ||
| readonly filename?: string | undefined; | ||
@@ -34,0 +35,0 @@ }) => Effect.Effect<{ |
@@ -44,2 +44,8 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
@@ -50,2 +56,5 @@ readonly cache_control?: { | ||
| } | undefined; | ||
| readonly transformations?: { | ||
| readonly oversized_image?: "error" | "downsize" | undefined; | ||
| } | undefined; | ||
| } | { | ||
@@ -57,3 +66,15 @@ readonly type: "document"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly media_type: "text/plain"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
| readonly title?: string | undefined; | ||
| readonly context?: string | undefined; | ||
| readonly cache_control?: { | ||
@@ -63,2 +84,5 @@ readonly type: "ephemeral"; | ||
| } | undefined; | ||
| readonly citations?: { | ||
| readonly enabled: boolean; | ||
| } | undefined; | ||
| } | { | ||
@@ -79,2 +103,8 @@ readonly type: "tool_result"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
@@ -85,2 +115,5 @@ readonly cache_control?: { | ||
| } | undefined; | ||
| readonly transformations?: { | ||
| readonly oversized_image?: "error" | "downsize" | undefined; | ||
| } | undefined; | ||
| } | { | ||
@@ -92,3 +125,15 @@ readonly type: "document"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly media_type: "text/plain"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
| readonly title?: string | undefined; | ||
| readonly context?: string | undefined; | ||
| readonly cache_control?: { | ||
@@ -98,2 +143,5 @@ readonly type: "ephemeral"; | ||
| } | undefined; | ||
| readonly citations?: { | ||
| readonly enabled: boolean; | ||
| } | undefined; | ||
| })[]; | ||
@@ -100,0 +148,0 @@ readonly tool_use_id: string; |
@@ -28,2 +28,8 @@ import type { RouteDefaultsInput } from "../route/client.js"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
@@ -34,2 +40,5 @@ readonly cache_control?: { | ||
| } | undefined; | ||
| readonly transformations?: { | ||
| readonly oversized_image?: "error" | "downsize" | undefined; | ||
| } | undefined; | ||
| } | { | ||
@@ -41,3 +50,15 @@ readonly type: "document"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly media_type: "text/plain"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
| readonly title?: string | undefined; | ||
| readonly context?: string | undefined; | ||
| readonly cache_control?: { | ||
@@ -47,2 +68,5 @@ readonly type: "ephemeral"; | ||
| } | undefined; | ||
| readonly citations?: { | ||
| readonly enabled: boolean; | ||
| } | undefined; | ||
| } | { | ||
@@ -63,2 +87,8 @@ readonly type: "tool_result"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
@@ -69,2 +99,5 @@ readonly cache_control?: { | ||
| } | undefined; | ||
| readonly transformations?: { | ||
| readonly oversized_image?: "error" | "downsize" | undefined; | ||
| } | undefined; | ||
| } | { | ||
@@ -76,3 +109,15 @@ readonly type: "document"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly media_type: "text/plain"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
| readonly title?: string | undefined; | ||
| readonly context?: string | undefined; | ||
| readonly cache_control?: { | ||
@@ -82,2 +127,5 @@ readonly type: "ephemeral"; | ||
| } | undefined; | ||
| readonly citations?: { | ||
| readonly enabled: boolean; | ||
| } | undefined; | ||
| })[]; | ||
@@ -84,0 +132,0 @@ readonly tool_use_id: string; |
@@ -61,2 +61,8 @@ import type { ProviderPackage } from "../provider-package.js"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
@@ -67,2 +73,5 @@ readonly cache_control?: { | ||
| } | undefined; | ||
| readonly transformations?: { | ||
| readonly oversized_image?: "error" | "downsize" | undefined; | ||
| } | undefined; | ||
| } | { | ||
@@ -74,3 +83,15 @@ readonly type: "document"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly media_type: "text/plain"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
| readonly title?: string | undefined; | ||
| readonly context?: string | undefined; | ||
| readonly cache_control?: { | ||
@@ -80,2 +101,5 @@ readonly type: "ephemeral"; | ||
| } | undefined; | ||
| readonly citations?: { | ||
| readonly enabled: boolean; | ||
| } | undefined; | ||
| } | { | ||
@@ -96,2 +120,8 @@ readonly type: "tool_result"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
@@ -102,2 +132,5 @@ readonly cache_control?: { | ||
| } | undefined; | ||
| readonly transformations?: { | ||
| readonly oversized_image?: "error" | "downsize" | undefined; | ||
| } | undefined; | ||
| } | { | ||
@@ -109,3 +142,15 @@ readonly type: "document"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly media_type: "text/plain"; | ||
| readonly data: string; | ||
| } | { | ||
| readonly type: "url"; | ||
| readonly url: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly file_id: string; | ||
| }; | ||
| readonly title?: string | undefined; | ||
| readonly context?: string | undefined; | ||
| readonly cache_control?: { | ||
@@ -115,2 +160,5 @@ readonly type: "ephemeral"; | ||
| } | undefined; | ||
| readonly citations?: { | ||
| readonly enabled: boolean; | ||
| } | undefined; | ||
| })[]; | ||
@@ -117,0 +165,0 @@ readonly tool_use_id: string; |
@@ -37,2 +37,3 @@ import { Schema } from "effect"; | ||
| readonly filename: Schema.optional<Schema.String>; | ||
| readonly cache: Schema.optional<typeof CacheHint>; | ||
| readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>; | ||
@@ -179,2 +180,3 @@ }>; | ||
| readonly filename: Schema.optional<Schema.String>; | ||
| readonly cache: Schema.optional<typeof CacheHint>; | ||
| readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>; | ||
@@ -252,2 +254,3 @@ }>, Schema.Struct<{ | ||
| readonly filename: Schema.optional<Schema.String>; | ||
| readonly cache: Schema.optional<typeof CacheHint>; | ||
| readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>; | ||
@@ -254,0 +257,0 @@ }>, Schema.Struct<{ |
@@ -36,2 +36,3 @@ import { Schema } from "effect"; | ||
| filename: Schema.optional(Schema.String), | ||
| cache: Schema.optional(CacheHint), | ||
| metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)), | ||
@@ -38,0 +39,0 @@ }).annotate({ identifier: "LLM.Content.Media" }); |
+3
-3
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "version": "0.0.0-dev-18051", | ||
| "version": "0.0.0-dev-18052", | ||
| "name": "@opencode-ai/ai", | ||
@@ -33,3 +33,3 @@ "type": "module", | ||
| "@effect/platform-node": "4.0.0-rc.111", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18051", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18052", | ||
| "@tsconfig/bun": "1.0.9", | ||
@@ -43,3 +43,3 @@ "@types/bun": "1.3.13", | ||
| "@smithy/util-utf8": "4.2.2", | ||
| "@opencode-ai/schema": "0.0.0-dev-18051", | ||
| "@opencode-ai/schema": "0.0.0-dev-18052", | ||
| "aws4fetch": "1.0.20", | ||
@@ -46,0 +46,0 @@ "effect": "4.0.0-rc.111", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1226132
1.81%28122
1.74%+ Added
- Removed