feat: add scoped history and artifacts
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { afterAll, beforeAll, describe, expect, it } from "bun:test";
|
||||
import plugin from "../../.opencode/plugins/tjwater-tools.js";
|
||||
|
||||
const originalInternalToken = process.env.AGENT_INTERNAL_TOKEN;
|
||||
|
||||
beforeAll(() => {
|
||||
process.env.AGENT_INTERNAL_TOKEN = "test-internal-token";
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
if (originalInternalToken === undefined) delete process.env.AGENT_INTERNAL_TOKEN;
|
||||
else process.env.AGENT_INTERNAL_TOKEN = originalInternalToken;
|
||||
});
|
||||
|
||||
describe("OpenCode 2 business tool registration", () => {
|
||||
it("registers business tools for direct dispatch, forwards the native call ID and validates inputs", async () => {
|
||||
const tools = new Map<string, any>();
|
||||
@@ -9,7 +20,11 @@ describe("OpenCode 2 business tool registration", () => {
|
||||
let readTodos: ((input: { session_id: string }) => Promise<unknown>) | undefined;
|
||||
await plugin.setup({
|
||||
tool: { transform: async (fn: (editor: unknown) => void) => fn({ list: () => Array.from(tools, ([id, tool]) => ({ ...tool, id })), add: (tool: any) => tools.set(tool.name, tool), remove: (name: string) => tools.delete(name), update: () => {} }), list: async () => Array.from(tools, ([id, tool]) => ({ ...tool, id })) },
|
||||
mcp: { transform: async (fn: (editor: unknown) => void) => fn({ list: () => [] }), list: async () => ({ data: [] }) },
|
||||
mcp: {
|
||||
transform: async (fn: (editor: unknown) => void) =>
|
||||
fn({ list: () => [], set: () => {} }),
|
||||
list: async () => ({ data: [] }),
|
||||
},
|
||||
shell: { hook: async () => {} },
|
||||
permission: { hook: async () => {} },
|
||||
session: { hook: async () => {} },
|
||||
|
||||
Reference in New Issue
Block a user