This commit is contained in:
+38
-6
@@ -14,7 +14,18 @@ import type { ToolEditor } from "@opencode/plugin/effect/tool";
|
||||
import type { SkillEditor } from "@opencode/plugin/effect/skill";
|
||||
import type { SessionHooks } from "@opencode/plugin/effect/session";
|
||||
import { z } from "zod";
|
||||
import plugin from "../src/index.js";
|
||||
import agentsPlugin from "../src/agents.js";
|
||||
import multiWorkPlugin from "../src/multi-work.js";
|
||||
import { fromPromise } from "@opencode/plugin/promise/adapter";
|
||||
import { AgentsRpc } from "../src/agents-rpc.js";
|
||||
|
||||
const plugin = {
|
||||
effect: (context: Context) =>
|
||||
Effect.gen(function* () {
|
||||
yield* fromPromise(agentsPlugin).effect(context);
|
||||
yield* multiWorkPlugin.effect(context);
|
||||
}),
|
||||
};
|
||||
import { command } from "../src/herdr.js";
|
||||
|
||||
// This is a composite plugin host fixture, not OpenCode's native executor/job runtime.
|
||||
@@ -127,6 +138,7 @@ function host(fixture: Awaited<ReturnType<typeof scenario>>, directory: string)
|
||||
PubSub.unbounded<Schema.Schema.Type<typeof Agent.Event.Updated>>(),
|
||||
);
|
||||
const registration = Effect.succeed({ dispose: Effect.void });
|
||||
let permissions: (() => Effect.Effect<Agent.Info["permissions"]>) | undefined;
|
||||
const editAgents: AgentEditor = {
|
||||
get: (id) => agents.get(id),
|
||||
list: () => [...agents.values()],
|
||||
@@ -234,7 +246,20 @@ function host(fixture: Awaited<ReturnType<typeof scenario>>, directory: string)
|
||||
generate: {},
|
||||
provider: {},
|
||||
permission: {},
|
||||
plugin: {},
|
||||
plugin: {
|
||||
list: () =>
|
||||
Effect.succeed({
|
||||
location,
|
||||
data: [
|
||||
{
|
||||
id: "stanp-opencode.multi-work",
|
||||
source: { type: "builtin" },
|
||||
state: { status: "active" },
|
||||
features: { server: true },
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
reference: {},
|
||||
skill: {
|
||||
transform: (callback: (editor: SkillEditor) => void) =>
|
||||
@@ -270,10 +295,17 @@ function host(fixture: Awaited<ReturnType<typeof scenario>>, directory: string)
|
||||
resolve: () => Effect.succeed(undefined),
|
||||
},
|
||||
},
|
||||
rpc: {
|
||||
register: () =>
|
||||
Effect.succeed({ dispose: Effect.void, events: { emit: () => Effect.void } }),
|
||||
},
|
||||
rpc: Object.assign(() => ({ permissions: () => permissions!() }), {
|
||||
register: (
|
||||
definition: typeof AgentsRpc,
|
||||
handlers: { permissions: () => Effect.Effect<Agent.Info["permissions"]> },
|
||||
) =>
|
||||
Effect.sync(() => {
|
||||
expect(definition.id).toBe(AgentsRpc.id);
|
||||
permissions = handlers.permissions;
|
||||
return { dispose: Effect.void, events: { emit: () => Effect.void } };
|
||||
}),
|
||||
}),
|
||||
mcp: {
|
||||
transform: (callback: (editor: { get: () => undefined }) => void) =>
|
||||
Effect.sync(() => callback({ get: () => undefined })).pipe(
|
||||
|
||||
Reference in New Issue
Block a user