feat: add scoped history and artifacts
Generic Container CI/CD / test-build-publish (push) Failing after 8m25s
Agent CI/CD / build-test-publish-and-deploy (push) Failing after 8m25s

This commit is contained in:
2026-10-22 18:40:20 +08:00
parent bc4e9834e5
commit 7d47a2df86
48 changed files with 2632 additions and 78 deletions
+17 -2
View File
@@ -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 () => {} },