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
6 changes: 6 additions & 0 deletions .changeset/red-sloths-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"shellular": patch
---

- fix(opencode): support both wrapped and direct session-list responses.
- chore: update opencode SDK and fff dependencies to latest versions.
4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
],
"dependencies": {
"@agentclientprotocol/sdk": "^1.2.1",
"@ff-labs/fff-node": "^0.6.4",
"@ff-labs/fff-node": "^0.10.5",
"@inquirer/prompts": "^8.4.2",
"@opencode-ai/sdk": "1.14.41",
"@opencode-ai/sdk": "1.18.18",
"@shellular/protocol": "workspace:*",
"@xterm/addon-serialize": "^0.14.0",
"@xterm/headless": "^6.0.0",
Expand Down
3 changes: 0 additions & 3 deletions cli/src/agents/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -974,9 +974,6 @@ export class AgentsManager {
window?: MessageWindow,
) {
const startedAt = Date.now();
logger.log(
`AI attach requested: agent=${agentId} session=${sessionId} workspace=${cwd}`,
);
const agent = await this.connectSessionAgent(clientId, agentId, sessionId);
this.attachSessionClient(agentId, sessionId, clientId);
this.rememberSessionClient(agentId, sessionId, clientId);
Expand Down
13 changes: 9 additions & 4 deletions cli/src/agents/opencode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@ const OpenCodeSessionSchema = z.object({
id: z.string(),
worktree: z.string(),
})
.nullable()
.optional(),
});

const OpenCodeSessionListSchema = z.object({
data: z.array(OpenCodeSessionSchema),
});
// The SDK normally returns its field-style response wrapper, while some beta
// OpenCode/SDK combinations return the response body directly.
const OpenCodeSessionListSchema = z.union([
z.object({ data: z.array(OpenCodeSessionSchema) }),
z.array(OpenCodeSessionSchema),
]);

/**
* OpenCode ACP client with custom session listing using opencode sdk.
Expand Down Expand Up @@ -122,8 +126,9 @@ export class OpenCode extends ACP {
...(params.cwd ? { directory: params.cwd } : { roots: true }),
});
const parsed = OpenCodeSessionListSchema.parse(response);
const openCodeSessions = Array.isArray(parsed) ? parsed : parsed.data;

const sessions = parsed.data.map((session): acp.SessionInfo => {
const sessions = openCodeSessions.map((session): acp.SessionInfo => {
const sessionInfo = {
sessionId: session.id,
cwd: session.directory,
Expand Down
Loading
Loading