@opencode-ai/ai 0.0.0-next-16781 → 0.0.0-next-16783
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/tool.d.ts +2 -2
- package/dist/tool.js +3 -3
- package/package.json +3 -3
package/dist/tool.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface ToolExecuteContext {
|
|
|
14
14
|
}
|
|
15
15
|
export type ToolExecute<Parameters extends ToolSchema<any>, Success extends ToolSchema<any>> = (params: Schema.Schema.Type<Parameters>, context?: ToolExecuteContext) => Effect.Effect<Schema.Schema.Type<Success>, ToolFailure>;
|
|
16
16
|
export interface ToolModelOutputInput<Parameters, Output> {
|
|
17
|
-
readonly
|
|
17
|
+
readonly id: ToolCallPart["id"];
|
|
18
18
|
readonly parameters: Parameters;
|
|
19
19
|
readonly output: Output;
|
|
20
20
|
}
|
|
@@ -43,7 +43,7 @@ export interface Definition<Parameters extends ToolSchema<any>, Success extends
|
|
|
43
43
|
/** @internal */
|
|
44
44
|
readonly _encode: (value: Schema.Schema.Type<Success>) => Effect.Effect<unknown, Schema.SchemaError>;
|
|
45
45
|
/** @internal */
|
|
46
|
-
readonly _project: (parameters: Schema.Schema.Type<Parameters>,
|
|
46
|
+
readonly _project: (parameters: Schema.Schema.Type<Parameters>, id: ToolCallPart["id"], output: unknown) => ToolOutputType;
|
|
47
47
|
/** @internal */
|
|
48
48
|
readonly _legacyResult: boolean;
|
|
49
49
|
/** @internal */
|
package/dist/tool.js
CHANGED
|
@@ -12,7 +12,7 @@ export function make(config) {
|
|
|
12
12
|
toStructuredOutput: config.toStructuredOutput,
|
|
13
13
|
_decode: Effect.succeed,
|
|
14
14
|
_encode: Effect.succeed,
|
|
15
|
-
_project: (parameters,
|
|
15
|
+
_project: (parameters, id, output) => project(config.toModelOutput, config.toStructuredOutput, parameters, id, output),
|
|
16
16
|
_legacyResult: config.toModelOutput === undefined && config.toStructuredOutput === undefined,
|
|
17
17
|
_definition: new ToolDefinition({
|
|
18
18
|
name: "",
|
|
@@ -31,7 +31,7 @@ export function make(config) {
|
|
|
31
31
|
toStructuredOutput: config.toStructuredOutput,
|
|
32
32
|
_decode: Schema.decodeUnknownEffect(config.parameters),
|
|
33
33
|
_encode: Schema.encodeEffect(config.success),
|
|
34
|
-
_project: (parameters,
|
|
34
|
+
_project: (parameters, id, output) => project(config.toModelOutput, config.toStructuredOutput, parameters, id, output),
|
|
35
35
|
_legacyResult: false,
|
|
36
36
|
_definition: new ToolDefinition({
|
|
37
37
|
name: "",
|
|
@@ -61,7 +61,7 @@ const toJsonSchema = (schema) => {
|
|
|
61
61
|
return document.schema;
|
|
62
62
|
return { ...document.schema, $defs: document.definitions };
|
|
63
63
|
};
|
|
64
|
-
const project = (toModelOutput, toStructuredOutput, parameters,
|
|
64
|
+
const project = (toModelOutput, toStructuredOutput, parameters, id, output) => ToolOutput.make(toStructuredOutput?.(output) ?? output, toModelOutput?.({ id, parameters, output }) ??
|
|
65
65
|
(typeof output === "string" ? [{ type: "text", text: output }] : []));
|
|
66
66
|
export { ToolFailure };
|
|
67
67
|
export * as Tool from "./tool";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-16783",
|
|
4
4
|
"name": "@opencode-ai/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
32
32
|
"@effect/platform-node": "4.0.0-beta.101",
|
|
33
|
-
"@opencode-ai/http-recorder": "0.0.0-next-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-next-16783",
|
|
34
34
|
"@tsconfig/bun": "1.0.9",
|
|
35
35
|
"@types/bun": "1.3.13",
|
|
36
36
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@smithy/eventstream-codec": "4.2.14",
|
|
41
41
|
"@smithy/util-utf8": "4.2.2",
|
|
42
|
-
"@opencode-ai/schema": "0.0.0-next-
|
|
42
|
+
"@opencode-ai/schema": "0.0.0-next-16783",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-beta.101",
|
|
45
45
|
"google-auth-library": "10.5.0"
|