Skip to content

AI-native design editor. Open-source Figma alternative.

Fix ACP transport: Uint8Array conversion, empty deltas, shiki error

Danila Poyarkovf02bd84aec51
diff --git a/src/ai/acp-transport.ts b/src/ai/acp-transport.ts
index e2c5219fb..06b6548e2 100644
--- a/src/ai/acp-transport.ts
+++ b/src/ai/acp-transport.ts
@@ -127,19 +127,21 @@ export class ACPChatTransport implements ChatTransport<UIMessage> {
const stdoutChunks: Uint8Array[] = []
let stdoutResolver: ((chunk: Uint8Array) => void) | null = null
- command.stdout.on('data', (data: Uint8Array) => {
+ command.stdout.on('data', (raw: Uint8Array | number[]) => {
+ const chunk = raw instanceof Uint8Array ? raw : new Uint8Array(raw)
if (stdoutResolver) {
const resolve = stdoutResolver
stdoutResolver = null
- resolve(data)
+ resolve(chunk)
} else {
- stdoutChunks.push(data)
+ stdoutChunks.push(chunk)
}
})
- command.stderr.on('data', (data: Uint8Array) => {
- const text =
- typeof data === 'string' ? data : new TextDecoder().decode(data)
+ command.stderr.on('data', (raw: Uint8Array | number[] | string) => {
+ const text = typeof raw === 'string'
+ ? raw
+ : new TextDecoder().decode(raw instanceof Uint8Array ? raw : new Uint8Array(raw))
console.error(`[ACP ${this.agentDef.id}]`, text)
})
@@ -228,11 +230,11 @@ function mapUpdate(
switch (update.sessionUpdate) {
case 'agent_message_chunk': {
- if (!textStarted) {
- chunks.push({ type: 'text-start', id: textId })
- textStarted = true
- }
- if (update.content.type === 'text') {
+ if (update.content.type === 'text' && update.content.text) {
+ if (!textStarted) {
+ chunks.push({ type: 'text-start', id: textId })
+ textStarted = true
+ }
chunks.push({
type: 'text-delta',
id: textId,
diff --git a/src/components/chat/ChatMessage.vue b/src/components/chat/ChatMessage.vue
index 0d9688019..b387aad08 100644
--- a/src/components/chat/ChatMessage.vue
+++ b/src/components/chat/ChatMessage.vue
@@ -104,7 +104,12 @@ function partKey(part: UIMessagePart, index: number): string {
data-test-id="chat-text-bubble"
class="rounded-xl rounded-tl-md bg-hover px-3 py-2 text-xs leading-relaxed text-surface"
>
- <Markdown :content="part.text" :mermaid="false" class="chat-markdown" />
+ <Markdown
+ :content="part.text"
+ :mermaid="false"
+ :cdn-options="{ shiki: false }"
+ class="chat-markdown"
+ />
</div>
</template>
</template>