@opencode-ai/plugin
Advanced tools
| import type { PermissionApi } from "@opencode-ai/client/effect/api"; | ||
| import type { Agent } from "@opencode-ai/schema/agent"; | ||
| import type { Permission } from "@opencode-ai/schema/permission"; | ||
| import type { Session } from "@opencode-ai/schema/session"; | ||
| import type { Hooks } from "./registration.js"; | ||
| export interface PermissionEvaluation { | ||
| readonly sessionID: Session.ID; | ||
| readonly agent?: Agent.ID; | ||
| readonly action: string; | ||
| readonly resources: ReadonlyArray<string>; | ||
| readonly metadata?: Record<string, unknown>; | ||
| readonly source?: Permission.Source; | ||
| effect: Permission.Effect; | ||
| message?: string; | ||
| } | ||
| export interface PermissionHooks { | ||
| readonly evaluate: PermissionEvaluation; | ||
| } | ||
| export type PermissionDomain = Pick<PermissionApi<unknown>, "list" | "get" | "reply"> & { | ||
| readonly hook: Hooks<PermissionHooks>; | ||
| }; |
| import type { PermissionApi } from "@opencode-ai/client/promise/api"; | ||
| import type { Agent } from "@opencode-ai/schema/agent"; | ||
| import type { Permission } from "@opencode-ai/schema/permission"; | ||
| import type { Session } from "@opencode-ai/schema/session"; | ||
| import type { Hooks } from "./registration.js"; | ||
| export interface PermissionEvaluation { | ||
| readonly sessionID: Session.ID; | ||
| readonly agent?: Agent.ID; | ||
| readonly action: string; | ||
| readonly resources: ReadonlyArray<string>; | ||
| readonly metadata?: Record<string, unknown>; | ||
| readonly source?: Permission.Source; | ||
| effect: Permission.Effect; | ||
| message?: string; | ||
| } | ||
| export interface PermissionHooks { | ||
| readonly evaluate: PermissionEvaluation; | ||
| } | ||
| export type PermissionDomain = Pick<PermissionApi, "list" | "get" | "reply"> & { | ||
| readonly hook: Hooks<PermissionHooks>; | ||
| }; |
@@ -1,2 +0,2 @@ | ||
| import type { PluginApi } from "@opencode-ai/client/effect/api"; | ||
| import type { GenerateApi, PluginApi } from "@opencode-ai/client/effect/api"; | ||
| import type { Effect, Scope } from "effect"; | ||
@@ -12,2 +12,3 @@ import type { PluginOptions } from "../options.js"; | ||
| import type { MCPDomain } from "./mcp.js"; | ||
| import type { PermissionDomain } from "./permission.js"; | ||
| import type { ReferenceDomain } from "./reference.js"; | ||
@@ -31,2 +32,4 @@ import type { SessionDomain } from "./session.js"; | ||
| readonly mcp: MCPDomain; | ||
| readonly generate: GenerateApi<unknown>; | ||
| readonly permission: PermissionDomain; | ||
| readonly plugin: PluginApi<unknown>; | ||
@@ -33,0 +36,0 @@ readonly reference: ReferenceDomain; |
@@ -45,4 +45,4 @@ import type { SessionApi } from "@opencode-ai/client/effect/api"; | ||
| } | ||
| export type SessionDomain = Pick<SessionApi<unknown>, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "rename" | "wait"> & { | ||
| export type SessionDomain = Pick<SessionApi<unknown>, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "rename" | "wait" | "context"> & { | ||
| readonly hook: ModelHooks<SessionHooks>; | ||
| }; |
@@ -60,2 +60,3 @@ import { Tool } from "@opencode-ai/schema/tool"; | ||
| const CommandEndpoints = ClientApi.groups["server.command"].endpoints; | ||
| const GenerateEndpoints = ClientApi.groups["server.generate"].endpoints; | ||
| const IntegrationEndpoints = ClientApi.groups["server.integration"].endpoints; | ||
@@ -65,2 +66,3 @@ const McpEndpoints = ClientApi.groups["server.mcp"].endpoints; | ||
| const PluginEndpoints = ClientApi.groups["server.plugin"].endpoints; | ||
| const PermissionEndpoints = ClientApi.groups["server.permission"].endpoints; | ||
| const ProviderEndpoints = ClientApi.groups["server.provider"].endpoints; | ||
@@ -128,2 +130,5 @@ const ReferenceEndpoints = ClientApi.groups["server.reference"].endpoints; | ||
| }, | ||
| generate: { | ||
| text: adaptApiMethod(GenerateEndpoints["generate.text"], host.generate.text), | ||
| }, | ||
| integration: { | ||
@@ -191,2 +196,8 @@ list: adaptApiMethod(IntegrationEndpoints["integration.list"], host.integration.list), | ||
| }, | ||
| permission: { | ||
| hook: (name, callback) => register(host.permission.hook(name, (event) => Effect.promise(() => Promise.resolve(callback(event))))), | ||
| list: adaptApiMethod(PermissionEndpoints["session.permission.list"], host.permission.list), | ||
| get: adaptApiMethod(PermissionEndpoints["session.permission.get"], host.permission.get), | ||
| reply: adaptApiMethod(PermissionEndpoints["session.permission.reply"], host.permission.reply), | ||
| }, | ||
| plugin: { | ||
@@ -268,2 +279,3 @@ list: adaptApiMethod(PluginEndpoints["plugin.list"], host.plugin.list), | ||
| wait: adaptApiMethod(SessionEndpoints["session.wait"], host.session.wait), | ||
| context: adaptApiMethod(SessionEndpoints["session.context"], host.session.context), | ||
| }, | ||
@@ -270,0 +282,0 @@ shell: { |
@@ -1,2 +0,2 @@ | ||
| import type { PluginApi } from "@opencode-ai/client/promise/api"; | ||
| import type { GenerateApi, PluginApi } from "@opencode-ai/client/promise/api"; | ||
| import type { PluginOptions } from "../options.js"; | ||
@@ -11,2 +11,3 @@ import type { App } from "../app.js"; | ||
| import type { MCPDomain } from "./mcp.js"; | ||
| import type { PermissionDomain } from "./permission.js"; | ||
| import type { ReferenceDomain } from "./reference.js"; | ||
@@ -30,2 +31,4 @@ import type { SessionDomain } from "./session.js"; | ||
| readonly mcp: MCPDomain; | ||
| readonly generate: GenerateApi; | ||
| readonly permission: PermissionDomain; | ||
| readonly plugin: PluginApi; | ||
@@ -32,0 +35,0 @@ readonly reference: ReferenceDomain; |
@@ -45,4 +45,4 @@ import type { SessionApi } from "@opencode-ai/client/promise/api"; | ||
| } | ||
| export type SessionDomain = Pick<SessionApi, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "rename" | "wait"> & { | ||
| export type SessionDomain = Pick<SessionApi, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "rename" | "wait" | "context"> & { | ||
| readonly hook: ModelHooks<SessionHooks>; | ||
| }; |
+7
-7
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@opencode-ai/plugin", | ||
| "version": "0.0.0-dev-18211", | ||
| "version": "0.0.0-dev-18212", | ||
| "type": "module", | ||
@@ -35,6 +35,6 @@ "license": "MIT", | ||
| "@ai-sdk/provider": "3.0.8", | ||
| "@opencode-ai/ai": "0.0.0-dev-18211", | ||
| "@opencode-ai/client": "0.0.0-dev-18211", | ||
| "@opencode-ai/protocol": "0.0.0-dev-18211", | ||
| "@opencode-ai/schema": "0.0.0-dev-18211", | ||
| "@opencode-ai/ai": "0.0.0-dev-18212", | ||
| "@opencode-ai/client": "0.0.0-dev-18212", | ||
| "@opencode-ai/protocol": "0.0.0-dev-18212", | ||
| "@opencode-ai/schema": "0.0.0-dev-18212", | ||
| "@standard-schema/spec": "1.1.0", | ||
@@ -45,3 +45,3 @@ "effect": "4.0.0-rc.111", | ||
| "peerDependencies": { | ||
| "@opencode-ai/theme": "0.0.0-dev-18211", | ||
| "@opencode-ai/theme": "0.0.0-dev-18212", | ||
| "@opentui/core": ">=0.5.8", | ||
@@ -66,3 +66,3 @@ "@opentui/solid": ">=0.5.8", | ||
| "devDependencies": { | ||
| "@opencode-ai/theme": "0.0.0-dev-18211", | ||
| "@opencode-ai/theme": "0.0.0-dev-18212", | ||
| "@opentui/core": "0.5.8", | ||
@@ -69,0 +69,0 @@ "@opentui/solid": "0.5.8", |
80921
3.81%95
4.4%1801
3.45%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed