@opencode-ai/plugin 0.0.0-next-15259 → 0.0.0-next-15267

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.
@@ -1,6 +1,5 @@
1
1
  export type { PluginOptions } from "../options.js";
2
2
  export * as Plugin from "./plugin.js";
3
- export { Tool } from "./tool.js";
4
3
  export { Agent } from "@opencode-ai/schema/agent";
5
4
  export { Command } from "@opencode-ai/schema/command";
6
5
  export { Connection } from "@opencode-ai/schema/connection";
@@ -1,5 +1,4 @@
1
1
  export * as Plugin from "./plugin.js";
2
- export { Tool } from "./tool.js";
3
2
  export { Agent } from "@opencode-ai/schema/agent";
4
3
  export { Command } from "@opencode-ai/schema/command";
5
4
  export { Connection } from "@opencode-ai/schema/connection";
@@ -1,21 +1,14 @@
1
- export * as Tool from "./tool.js";
2
- import { Tool } from "../effect/tool.js";
1
+ import type { Tool } from "../effect/tool.js";
3
2
  import type { Agent } from "@opencode-ai/schema/agent";
4
3
  import type { Session } from "@opencode-ai/schema/session";
5
4
  import type { SessionMessage } from "@opencode-ai/schema/session-message";
6
- import { type JsonSchema, type Schema } from "effect";
5
+ import type { JsonSchema, Schema } from "effect";
7
6
  import type { Hooks, Transform } from "./registration.js";
8
7
  export type Context = Tool.Context;
9
8
  export type SchemaType<A> = Tool.SchemaType<A>;
10
- export type Definition<Input extends SchemaType<any>, Output extends SchemaType<any>> = Tool.Definition<Input, Output>;
11
- export type AnyTool = Tool.AnyTool;
12
- export declare const Failure: typeof Tool.Failure;
13
- export type Failure = Tool.Failure;
14
- export declare const RegistrationError: typeof Tool.RegistrationError;
15
- export type RegistrationError = Tool.RegistrationError;
16
9
  export type Content = Tool.Content;
17
10
  export type DynamicOutput = Tool.DynamicOutput;
18
- type Config<Input extends SchemaType<any>, Output extends SchemaType<any>, Structured extends SchemaType<any> = Output> = {
11
+ export type Definition<Input extends SchemaType<any>, Output extends SchemaType<any>, Structured extends SchemaType<any> = Output> = {
19
12
  readonly description: string;
20
13
  readonly input: Input;
21
14
  readonly output: Output;
@@ -30,15 +23,13 @@ type Config<Input extends SchemaType<any>, Output extends SchemaType<any>, Struc
30
23
  readonly output: Output["Encoded"];
31
24
  }) => ReadonlyArray<Content>;
32
25
  };
33
- type DynamicConfig = {
26
+ export type DynamicDefinition = {
34
27
  readonly description: string;
35
28
  readonly jsonSchema: JsonSchema.JsonSchema;
36
29
  readonly outputSchema?: JsonSchema.JsonSchema;
37
30
  readonly execute: (input: unknown, context: Context) => Promise<DynamicOutput>;
38
31
  };
39
- export declare function make<Input extends SchemaType<any>, Output extends SchemaType<any>, Structured extends SchemaType<any> = Output>(config: Config<Input, Output, Structured>): Definition<Input, Structured>;
40
- export declare function make(config: DynamicConfig): AnyTool;
41
- export declare const withPermission: <Input extends Tool.SchemaType<any>, Output extends Tool.SchemaType<any>>(tool: Tool.Definition<Input, Output>, permission: string) => Tool.Definition<Input, Output>;
32
+ export type AnyTool = Definition<any, any, any> | DynamicDefinition;
42
33
  export interface ToolExecuteBeforeEvent {
43
34
  readonly tool: string;
44
35
  readonly sessionID: Session.ID;
@@ -63,7 +54,8 @@ export interface RegisterOptions {
63
54
  readonly deferred?: boolean;
64
55
  }
65
56
  export interface ToolDraft {
66
- add(name: string, tool: AnyTool, options?: RegisterOptions): void;
57
+ add<Input extends SchemaType<any>, Output extends SchemaType<any>, Structured extends SchemaType<any> = Output>(name: string, tool: Definition<Input, Output, Structured>, options?: RegisterOptions): void;
58
+ add(name: string, tool: DynamicDefinition, options?: RegisterOptions): void;
67
59
  }
68
60
  export interface ToolHooks {
69
61
  readonly "execute.before": ToolExecuteBeforeEvent;
@@ -1,17 +0,0 @@
1
- export * as Tool from "./tool.js";
2
- import { Tool } from "../effect/tool.js";
3
- import { Effect } from "effect";
4
- export const Failure = Tool.Failure;
5
- export const RegistrationError = Tool.RegistrationError;
6
- export function make(config) {
7
- if ("jsonSchema" in config)
8
- return Tool.make({
9
- ...config,
10
- execute: (input, context) => Effect.promise(() => config.execute(input, context)),
11
- });
12
- return Tool.make({
13
- ...config,
14
- execute: (input, context) => Effect.promise(() => config.execute(input, context)),
15
- });
16
- }
17
- export const withPermission = Tool.withPermission;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/plugin",
4
- "version": "0.0.0-next-15259",
4
+ "version": "0.0.0-next-15267",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -44,9 +44,9 @@
44
44
  ],
45
45
  "dependencies": {
46
46
  "@ai-sdk/provider": "3.0.8",
47
- "@opencode-ai/client": "0.0.0-next-15259",
48
- "@opencode-ai/schema": "0.0.0-next-15259",
49
- "@opencode-ai/sdk": "0.0.0-next-15259",
47
+ "@opencode-ai/client": "0.0.0-next-15267",
48
+ "@opencode-ai/schema": "0.0.0-next-15267",
49
+ "@opencode-ai/sdk": "0.0.0-next-15267",
50
50
  "effect": "4.0.0-beta.83",
51
51
  "zod": "4.1.8"
52
52
  },