@opencode-ai/ai
Advanced tools
@@ -84,3 +84,23 @@ import { Schema } from "effect"; | ||
| }>]> & { | ||
| is: (value: unknown) => value is ToolResultValue; | ||
| is: <I>(input: I) => input is I & ({ | ||
| readonly type: "json"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "error"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "content"; | ||
| readonly value: readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly uri: string; | ||
| readonly mime: string; | ||
| readonly name?: string | undefined; | ||
| })[]; | ||
| }); | ||
| make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue; | ||
@@ -146,3 +166,23 @@ }; | ||
| }>]> & { | ||
| is: (value: unknown) => value is ToolResultValue; | ||
| is: <I>(input: I) => input is I & ({ | ||
| readonly type: "json"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "error"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "content"; | ||
| readonly value: readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly uri: string; | ||
| readonly mime: string; | ||
| readonly name?: string | undefined; | ||
| })[]; | ||
| }); | ||
| make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue; | ||
@@ -219,3 +259,23 @@ }; | ||
| }>]> & { | ||
| is: (value: unknown) => value is ToolResultValue; | ||
| is: <I>(input: I) => input is I & ({ | ||
| readonly type: "json"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "error"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "content"; | ||
| readonly value: readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly uri: string; | ||
| readonly mime: string; | ||
| readonly name?: string | undefined; | ||
| })[]; | ||
| }); | ||
| make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue; | ||
@@ -293,3 +353,23 @@ }; | ||
| }>]> & { | ||
| is: (value: unknown) => value is ToolResultValue; | ||
| is: <I>(input: I) => input is I & ({ | ||
| readonly type: "json"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "text"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "error"; | ||
| readonly value: unknown; | ||
| } | { | ||
| readonly type: "content"; | ||
| readonly value: readonly ({ | ||
| readonly type: "text"; | ||
| readonly text: string; | ||
| } | { | ||
| readonly type: "file"; | ||
| readonly uri: string; | ||
| readonly mime: string; | ||
| readonly name?: string | undefined; | ||
| })[]; | ||
| }); | ||
| make: (value: unknown, type?: ToolResultValue["type"]) => ToolResultValue; | ||
@@ -296,0 +376,0 @@ }; |
| import { Schema } from "effect"; | ||
| import { Tool } from "@opencode-ai/schema/tool"; | ||
| import { CacheHint, CachePolicy, GenerationOptions, HttpOptions, JsonSchema, LanguageModelSchema, ProviderOptions, } from "./options.js"; | ||
| import { isRecord } from "../utils/record.js"; | ||
| export const MessageRole = Schema.Literals(["system", "user", "assistant", "tool"]); | ||
@@ -39,5 +38,2 @@ export const ProviderMetadata = Schema.Record(Schema.String, Schema.Record(Schema.String, Schema.Unknown)).annotate({ | ||
| }).annotate({ identifier: "LLM.Content.Media" }); | ||
| const isToolResultValue = (value) => isRecord(value) && | ||
| (value.type === "text" || value.type === "json" || value.type === "error" || value.type === "content") && | ||
| "value" in value; | ||
| const toolResultValueSchema = Schema.Union([ | ||
@@ -61,2 +57,3 @@ Schema.Struct({ | ||
| ]).annotate({ identifier: "LLM.ToolResult" }); | ||
| const isToolResultValue = Schema.is(toolResultValueSchema); | ||
| export const ToolResultValue = Object.assign(toolResultValueSchema, { | ||
@@ -63,0 +60,0 @@ is: isToolResultValue, |
+3
-3
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "version": "0.0.0-dev-18726", | ||
| "version": "0.0.0-dev-18727", | ||
| "name": "@opencode-ai/ai", | ||
@@ -33,3 +33,3 @@ "type": "module", | ||
| "@effect/platform-node": "4.0.0-rc.112", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18726", | ||
| "@opencode-ai/http-recorder": "0.0.0-dev-18727", | ||
| "@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-18726", | ||
| "@opencode-ai/schema": "0.0.0-dev-18727", | ||
| "aws4fetch": "1.0.20", | ||
@@ -46,0 +46,0 @@ "effect": "4.0.0-rc.112", |
Sorry, the diff of this file is too big to display
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.
1557010
0.42%35943
0.55%+ Added
- Removed