@@ -1,11 +1,7 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import type { Plugin } from "@opencode/plugin";
|
||||
import type { Context } from "@opencode/plugin/effect/plugin";
|
||||
import { Effect } from "effect";
|
||||
import quota from "../src/quota-plugin.js";
|
||||
import multiWork from "../src/multi-work.js";
|
||||
import { QuotaRpc } from "../src/quota-rpc.js";
|
||||
import { AgentsRpc } from "../src/agents-rpc.js";
|
||||
|
||||
test("Quota loads independently and retains its RPC ID and nullable status", async () => {
|
||||
let controller: ReadableStreamDefaultController<unknown>;
|
||||
@@ -65,20 +61,3 @@ test("Quota loads independently and retains its RPC ID and nullable status", asy
|
||||
if (cleanup) await cleanup();
|
||||
expect(disposed).toBe(true);
|
||||
});
|
||||
|
||||
test("Multi-work rejects missing Agents before any Herdr operations or registrations", async () => {
|
||||
const context = {
|
||||
rpc: (definition: typeof AgentsRpc) => {
|
||||
expect(definition.id).toBe("stanp-opencode.agents");
|
||||
return { permissions: () => Effect.fail(new Error("RPC not registered")) };
|
||||
},
|
||||
};
|
||||
// SAFETY: Missing Agents fails at the first RPC call; no other host service is accessed.
|
||||
const activate = multiWork.effect as (
|
||||
context: Pick<Context, "options">,
|
||||
) => ReturnType<typeof multiWork.effect>;
|
||||
const result = await Effect.runPromiseExit(
|
||||
Effect.scoped(activate({ ...context, options: {} })),
|
||||
);
|
||||
expect(String(result)).toContain("Multi-work requires Agents loaded before it");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user