chore(lint): flatten nested blocks to satisfy max-depth in server

This commit is contained in:
Mohamed Boudra
2026-04-24 03:11:42 +07:00
parent 45a6e7545b
commit 4df7e18821
3 changed files with 21 additions and 27 deletions

View File

@@ -2288,24 +2288,24 @@ class OpenCodeAgentSession implements AgentSession {
} else {
let emittedAssistantText = false;
for (const part of parts) {
if (part.type === "text") {
if (part.text) {
emittedAssistantText = true;
yield {
type: "timeline",
provider: "opencode",
item: { type: "assistant_message", text: part.text },
};
}
} else if (part.type === "reasoning") {
if (part.text) {
yield {
type: "timeline",
provider: "opencode",
item: { type: "reasoning", text: part.text },
};
}
} else if (part.type === "tool") {
if (part.type === "text" && part.text) {
emittedAssistantText = true;
yield {
type: "timeline",
provider: "opencode",
item: { type: "assistant_message", text: part.text },
};
continue;
}
if (part.type === "reasoning" && part.text) {
yield {
type: "timeline",
provider: "opencode",
item: { type: "reasoning", text: part.text },
};
continue;
}
if (part.type === "tool") {
const parsedToolPart = OpencodeToolPartToTimelineItemSchema.safeParse(part);
if (parsedToolPart.success && parsedToolPart.data) {
yield {

View File

@@ -1127,10 +1127,7 @@ export class PiDirectAgentSession implements AgentSession {
if (message.role === "assistant") {
for (const content of message.content) {
if (content.type === "text") {
if (!content.text) {
continue;
}
if (content.type === "text" && content.text) {
yield {
type: "timeline",
provider: PI_PROVIDER,
@@ -1139,10 +1136,7 @@ export class PiDirectAgentSession implements AgentSession {
continue;
}
if (content.type === "thinking") {
if (!content.thinking) {
continue;
}
if (content.type === "thinking" && content.thinking) {
yield {
type: "timeline",
provider: PI_PROVIDER,

View File

@@ -118,7 +118,7 @@ describe.skipIf(process.platform === "win32")("createWorktree", () => {
execSync("git add .", { cwd: varRepoDir });
execSync('git -c commit.gpgsign=false commit -m "initial"', { cwd: varRepoDir });
const result = await createLegacyWorktreeForTest({
await createLegacyWorktreeForTest({
branchName: "main",
cwd: varRepoDir,
baseBranch: "main",