feat(opencode): migrate agent runtime to v2
This commit is contained in:
@@ -7,6 +7,9 @@ import { createSkillManagerTool } from "../../.opencode/tools/skill_manager.js";
|
||||
import { type RuntimeSessionContext } from "../../src/runtime/sessionContext.js";
|
||||
import { SkillStore } from "../../src/skills/store.js";
|
||||
|
||||
const toolContent = async (result: Promise<{ content?: string }>) =>
|
||||
(await result).content ?? "";
|
||||
|
||||
describe("skill_manager tool", () => {
|
||||
let tempDir: string;
|
||||
let skillStore: SkillStore;
|
||||
@@ -61,7 +64,7 @@ describe("skill_manager tool", () => {
|
||||
);
|
||||
|
||||
const writeResult = JSON.parse(
|
||||
await tool.execute(
|
||||
await toolContent(tool.execute(
|
||||
{
|
||||
action: "write_skill",
|
||||
content: skillDocument("# Pressure Review"),
|
||||
@@ -69,7 +72,7 @@ describe("skill_manager tool", () => {
|
||||
skill_path: "workflow/pressure-review",
|
||||
},
|
||||
toolContext,
|
||||
) as string,
|
||||
)),
|
||||
);
|
||||
expect(writeResult.decision).toBe("accepted");
|
||||
await expect(readFile(writeResult.target, "utf8")).resolves.toContain(
|
||||
@@ -77,7 +80,7 @@ describe("skill_manager tool", () => {
|
||||
);
|
||||
|
||||
const updateResult = JSON.parse(
|
||||
await tool.execute(
|
||||
await toolContent(tool.execute(
|
||||
{
|
||||
action: "write_skill",
|
||||
content: skillDocument("# Updated Pressure Review"),
|
||||
@@ -85,7 +88,7 @@ describe("skill_manager tool", () => {
|
||||
skill_path: "workflow/pressure-review",
|
||||
},
|
||||
toolContext,
|
||||
) as string,
|
||||
)),
|
||||
);
|
||||
expect(updateResult.decision).toBe("accepted");
|
||||
await expect(readFile(updateResult.target, "utf8")).resolves.toContain(
|
||||
@@ -93,14 +96,14 @@ describe("skill_manager tool", () => {
|
||||
);
|
||||
|
||||
const removeResult = JSON.parse(
|
||||
await tool.execute(
|
||||
await toolContent(tool.execute(
|
||||
{
|
||||
action: "remove_skill",
|
||||
reason: "workflow is obsolete",
|
||||
skill_path: "workflow/pressure-review",
|
||||
},
|
||||
toolContext,
|
||||
) as string,
|
||||
)),
|
||||
);
|
||||
expect(removeResult.decision).toBe("accepted");
|
||||
await expect(readFile(removeResult.target, "utf8")).rejects.toThrow();
|
||||
@@ -114,7 +117,7 @@ describe("skill_manager tool", () => {
|
||||
);
|
||||
|
||||
const writeResult = JSON.parse(
|
||||
await tool.execute(
|
||||
await toolContent(tool.execute(
|
||||
{
|
||||
action: "write_skill",
|
||||
content: [
|
||||
@@ -129,7 +132,7 @@ describe("skill_manager tool", () => {
|
||||
skill_path: "__root__",
|
||||
},
|
||||
toolContext,
|
||||
) as string,
|
||||
)),
|
||||
);
|
||||
|
||||
expect(writeResult.decision).toBe("accepted");
|
||||
|
||||
Reference in New Issue
Block a user