Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"url": "https://github.com/vtemian/micode/issues"
},
"dependencies": {
"@opencode-ai/plugin": "1.2.27",
"@opencode-ai/plugin": "1.14.19",
"bun-pty": "^0.4.5",
"jsonc-parser": "^3.3.1",
"valibot": "^1.2.0",
Expand Down
4 changes: 2 additions & 2 deletions src/tools/octto/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// src/tools/octto/types.ts

import type { ToolContext } from "@opencode-ai/plugin/tool";
import type { ToolContext, ToolResult } from "@opencode-ai/plugin/tool";
import type { createOpencodeClient } from "@opencode-ai/sdk";

// Avoids exposing zod types in declaration files.
Expand All @@ -11,7 +11,7 @@ import type { createOpencodeClient } from "@opencode-ai/sdk";
export interface OcttoTool {
description: string;
args: unknown;
execute: (args: never, context: ToolContext) => Promise<string>;
execute: (args: never, context: ToolContext) => Promise<ToolResult>;
}

export type OcttoTools = Record<string, OcttoTool>;
Expand Down
10 changes: 5 additions & 5 deletions tests/tools/pty/kill.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("pty_kill tool", () => {
});

it("should throw error for unknown session", async () => {
await expect(pty_kill.execute({ id: "pty_nonexistent" }, {} as any)).rejects.toThrow("not found");
await expect(pty_kill.execute({ id: "pty_nonexistent" }, {})).rejects.toThrow("not found");
});

it("should kill a running session", async () => {
Expand All @@ -50,11 +50,11 @@ describe("pty_kill tool", () => {
const id = idMatch?.[1];
expect(id).toBeDefined();

const result = await pty_kill.execute({ id: id! }, {} as any);
const result = await pty_kill.execute({ id: id! }, {});

expect(result).toContain("<pty_killed>");
expect(result).toContain("Killed:");
expect(result).toContain(id!);
expect(result).toContain(id);
expect(result).toContain("Sleeper");
expect(result).toContain("</pty_killed>");
});
Expand All @@ -68,7 +68,7 @@ describe("pty_kill tool", () => {
const idMatch = spawnResult.match(/ID: (pty_[a-f0-9]+)/);
const id = idMatch?.[1];

await pty_kill.execute({ id: id!, cleanup: true }, {} as any);
await pty_kill.execute({ id: id!, cleanup: true }, {});

const sessions = manager.list();
expect(sessions).toHaveLength(0);
Expand All @@ -83,7 +83,7 @@ describe("pty_kill tool", () => {
const idMatch = spawnResult.match(/ID: (pty_[a-f0-9]+)/);
const id = idMatch?.[1];

await pty_kill.execute({ id: id!, cleanup: false }, {} as any);
await pty_kill.execute({ id: id!, cleanup: false }, {});

const sessions = manager.list();
expect(sessions).toHaveLength(1);
Expand Down
6 changes: 3 additions & 3 deletions tests/tools/pty/list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("pty_list tool", () => {
});

it("should return empty message when no sessions", async () => {
const result = await pty_list.execute({}, {} as any);
const result = await pty_list.execute({}, {});

expect(result).toContain("<pty_list>");
expect(result).toContain("No active PTY sessions");
Expand All @@ -45,7 +45,7 @@ describe("pty_list tool", () => {
messageID: "msg",
} as any);

const result = await pty_list.execute({}, {} as any);
const result = await pty_list.execute({}, {});

expect(result).toContain("<pty_list>");
expect(result).toContain("First");
Expand All @@ -60,7 +60,7 @@ describe("pty_list tool", () => {
messageID: "msg",
} as any);

const result = await pty_list.execute({}, {} as any);
const result = await pty_list.execute({}, {});

expect(result).toContain("Command: sleep 10");
expect(result).toContain("Status: running");
Expand Down
10 changes: 5 additions & 5 deletions tests/tools/pty/read.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("pty_read tool", () => {
});

it("should throw error for unknown session", async () => {
await expect(pty_read.execute({ id: "pty_nonexistent" }, {} as any)).rejects.toThrow("not found");
await expect(pty_read.execute({ id: "pty_nonexistent" }, {})).rejects.toThrow("not found");
});

it("should read output from a session", async () => {
Expand All @@ -55,11 +55,11 @@ describe("pty_read tool", () => {
// Wait a bit for output
await new Promise((resolve) => setTimeout(resolve, 100));

const result = await pty_read.execute({ id: id! }, {} as any);
const result = await pty_read.execute({ id: id! }, {});

expect(result).toContain("<pty_output");
expect(result).toContain("</pty_output>");
expect(result).toContain(id!);
expect(result).toContain(id);
});

it("should handle pattern filtering", async () => {
Expand All @@ -73,7 +73,7 @@ describe("pty_read tool", () => {

await new Promise((resolve) => setTimeout(resolve, 100));

const result = await pty_read.execute({ id: id!, pattern: "error" }, {} as any);
const result = await pty_read.execute({ id: id!, pattern: "error" }, {});

expect(result).toContain("pattern=");
// Verify filtering actually works - should contain the matched line
Expand All @@ -89,6 +89,6 @@ describe("pty_read tool", () => {
const idMatch = spawnResult.match(/ID: (pty_[a-f0-9]+)/);
const id = idMatch?.[1];

await expect(pty_read.execute({ id: id!, pattern: "[invalid" }, {} as any)).rejects.toThrow("Invalid regex");
await expect(pty_read.execute({ id: id!, pattern: "[invalid" }, {})).rejects.toThrow("Invalid regex");
});
});
8 changes: 4 additions & 4 deletions tests/tools/pty/write.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("pty_write tool", () => {
});

it("should throw error for unknown session", async () => {
await expect(pty_write.execute({ id: "pty_nonexistent", data: "test" }, {} as any)).rejects.toThrow("not found");
await expect(pty_write.execute({ id: "pty_nonexistent", data: "test" }, {})).rejects.toThrow("not found");
});

it("should write to a running session", async () => {
Expand All @@ -47,10 +47,10 @@ describe("pty_write tool", () => {
const id = idMatch?.[1];
expect(id).toBeDefined();

const result = await pty_write.execute({ id: id!, data: "hello\\n" }, {} as any);
const result = await pty_write.execute({ id: id!, data: "hello\\n" }, {});

expect(result).toContain("Sent");
expect(result).toContain(id!);
expect(result).toContain(id);
});

it("should parse escape sequences", async () => {
Expand All @@ -63,7 +63,7 @@ describe("pty_write tool", () => {
const id = idMatch?.[1];

// Send Ctrl+C
const result = await pty_write.execute({ id: id!, data: "\\x03" }, {} as any);
const result = await pty_write.execute({ id: id!, data: "\\x03" }, {});

expect(result).toContain("Sent");
});
Expand Down