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
Original file line number Diff line number Diff line change
Expand Up @@ -2240,15 +2240,15 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
// session.command returns 204 without an inbox id; the stream drops before session.inbox.enqueued provides it.
const { runtime, thread } = yield* resumed([
out("command.list", "<any>"),
reply("command.list", { location: { directory: WORK }, data: [{ name: "hello" }] }),
reply("command.list", { location: { directory: WORK }, data: [{ name: "git/hello" }] }),
out("message.list", { sessionID: SESSION, order: "desc", limit: "1" }),
reply("message.list", {
data: [
{ id: "msg_idle_before", time: { created: 1 }, type: "idle", outcome: "succeeded" },
],
cursor: {},
}),
out("session.command", { sessionID: SESSION, name: "hello", text: "WORLD" }),
out("session.command", { sessionID: SESSION, name: "git/hello", text: "WORLD" }),
reply("session.command", null),
{ type: "runtime_exit", status: "success" } as const,
out("event.subscribe"),
Expand Down Expand Up @@ -2285,7 +2285,7 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
);
yield* runtime.startTurn({
...turnInput(thread),
message: { ...turnInput(thread).message, text: "/hello WORLD" },
message: { ...turnInput(thread).message, text: "/git/hello WORLD" },
});
const collected = yield* Fiber.join(events);
const texts = collected.flatMap((event) =>
Expand Down
6 changes: 3 additions & 3 deletions packages/provider-opencode/src/server/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ describe("OpenCodeAdapterV2", () => {
return { stream: nativeEvents.stream };
},
},
command: { list: async () => ({ data: [{ name: "review" }] }) },
command: { list: async () => ({ data: [{ name: "git/review" }] }) },
session: {
create: async () => ({ data: { id: sessionId, time: { created: 1, updated: 1 } } }),
command: async (input: {
Expand All @@ -1382,9 +1382,9 @@ describe("OpenCodeAdapterV2", () => {
},
},
});
const start = yield* harness.startTurn("/review staged changes").pipe(Effect.forkScoped);
const start = yield* harness.startTurn("/git/review staged changes").pipe(Effect.forkScoped);
const call = yield* Queue.take(calls);
assert.equal(call.command, "review");
assert.equal(call.command, "git/review");
assert.equal(call.arguments, "staged changes");
assert.equal(call.model, "anthropic/claude-sonnet");
yield* Effect.promise(() =>
Expand Down
2 changes: 1 addition & 1 deletion packages/provider-opencode/src/server/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2977,7 +2977,7 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function
.map((part) => part.text)
.join("\n")
.trim();
const match = text?.match(/^\/([^\s/]+)(?:\s+([\s\S]*))?$/);
const match = text?.match(/^\/(\S+)(?:\s+([\s\S]*))?$/);
const command = match
? (yield* OpenCodeRuntime.loadOpenCodeCommands(client).pipe(
Effect.timeout("10 seconds"),
Expand Down
2 changes: 1 addition & 1 deletion packages/provider-opencode/src/server/v2/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ const agentFor = (input: ProviderAdapter.ProviderAdapterV2TurnInput) =>
input.runtimePolicy.interactionMode === "plan" ? "plan" : "build";

const commandOf = (text: string) => {
const match = /^\/([^\s/]+)(?:\s+([\s\S]*))?$/.exec(text.trim());
const match = /^\/(\S+)(?:\s+([\s\S]*))?$/.exec(text.trim());
return match === null ? undefined : { name: match[1]!, text: match[2] ?? "" };
};

Expand Down
Loading