mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-10 12:21:02 +00:00
fix: resolve compiled binary crashes from circular dep and Bun CJS splitting bug
Some checks failed
Deploy to apn-relay / porter-deploy (push) Has been cancelled
Some checks failed
Deploy to apn-relay / porter-deploy (push) Has been cancelled
This commit is contained in:
parent
ce209e22a2
commit
2b3d027e3b
3 changed files with 8 additions and 3 deletions
|
|
@ -13,7 +13,8 @@ import { Installation } from "../../installation"
|
|||
import { PushRelay } from "../../server/push-relay"
|
||||
import { Log } from "../../util"
|
||||
import { Global } from "../../global"
|
||||
import * as QRCode from "qrcode"
|
||||
// dynamic import: static `import * as` of CJS package triggers Bun bundler splitting bug
|
||||
import type * as QRCodeType from "qrcode"
|
||||
|
||||
const log = Log.create({ service: "serve" })
|
||||
|
||||
|
|
@ -184,6 +185,7 @@ async function printPairQR(pair: PairPayload) {
|
|||
linkLength: link.length,
|
||||
qr: qrConfig,
|
||||
})
|
||||
const QRCode: typeof QRCodeType = await import("qrcode")
|
||||
const code = await QRCode.toString(link, {
|
||||
...qrConfig,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ import { errors } from "../../error"
|
|||
import { lazy } from "@/util/lazy"
|
||||
import { Effect, Option } from "effect"
|
||||
import { PushRelay } from "../../push-relay"
|
||||
import * as QRCode from "qrcode"
|
||||
// dynamic import: static `import * as` of CJS package triggers Bun bundler splitting bug
|
||||
import type * as QRCodeType from "qrcode"
|
||||
import { Agent } from "@/agent/agent"
|
||||
import { jsonRequest, runRequest } from "./trace"
|
||||
|
||||
|
|
@ -60,6 +61,7 @@ function pushPairLink(input: { relaySecret: string; hosts: string[] }) {
|
|||
}
|
||||
|
||||
async function pushPairQRCode(input: { relaySecret: string; hosts: string[] }) {
|
||||
const QRCode: typeof QRCodeType = await import("qrcode")
|
||||
return QRCode.toDataURL(pushPairLink(input), pushPairQROptions)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,8 @@ export const Event = {
|
|||
"session.error",
|
||||
z.object({
|
||||
sessionID: SessionID.zod.optional(),
|
||||
error: MessageV2.Assistant.shape.error,
|
||||
// z.lazy defers access to break circular dep: session → message-v2 → provider → plugin → session
|
||||
error: z.lazy(() => MessageV2.Assistant.shape.error),
|
||||
}),
|
||||
),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue