mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-07 00:51:34 +00:00
chore: generate
This commit is contained in:
parent
387220f368
commit
28112fbd12
4 changed files with 20 additions and 13 deletions
|
|
@ -11,6 +11,7 @@ export function terminalWebSocketURL(input: {
|
|||
next.searchParams.set("directory", input.directory)
|
||||
next.searchParams.set("cursor", String(input.cursor))
|
||||
next.protocol = next.protocol === "https:" ? "wss:" : "ws:"
|
||||
if (!input.sameOrigin && input.password) next.searchParams.set("auth_token", btoa(`${input.username}:${input.password}`))
|
||||
if (!input.sameOrigin && input.password)
|
||||
next.searchParams.set("auth_token", btoa(`${input.username}:${input.password}`))
|
||||
return next
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,13 +39,16 @@ export function websocket(
|
|||
Effect.catchReason("SocketError", "SocketCloseError", () => Effect.void),
|
||||
Effect.catch(() => Effect.void),
|
||||
)
|
||||
const closeAccepted = Effect.all(
|
||||
[closeSocket(inbound, writeInbound), closeSocket(outbound, writeOutbound)],
|
||||
{ concurrency: "unbounded", discard: true },
|
||||
)
|
||||
const closeAccepted = Effect.all([closeSocket(inbound, writeInbound), closeSocket(outbound, writeOutbound)], {
|
||||
concurrency: "unbounded",
|
||||
discard: true,
|
||||
})
|
||||
const registered = yield* WebSocketTracker.register(
|
||||
Effect.all(
|
||||
[writeInbound(WebSocketTracker.SERVER_CLOSING_EVENT()), writeOutbound(WebSocketTracker.SERVER_CLOSING_EVENT())],
|
||||
[
|
||||
writeInbound(WebSocketTracker.SERVER_CLOSING_EVENT()),
|
||||
writeOutbound(WebSocketTracker.SERVER_CLOSING_EVENT()),
|
||||
],
|
||||
{ concurrency: "unbounded", discard: true },
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,12 @@ export const layer = Layer.sync(Service)(() => {
|
|||
const active = Array.from(sockets)
|
||||
sockets.clear()
|
||||
yield* Effect.all(
|
||||
active.map((close) => close.pipe(Effect.timeout("1 second"), Effect.catch(() => Effect.void))),
|
||||
active.map((close) =>
|
||||
close.pipe(
|
||||
Effect.timeout("1 second"),
|
||||
Effect.catch(() => Effect.void),
|
||||
),
|
||||
),
|
||||
{ concurrency: "unbounded", discard: true },
|
||||
)
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -195,11 +195,7 @@ export async function listen(opts: ListenOptions): Promise<Listener> {
|
|||
url = next
|
||||
|
||||
const mdns =
|
||||
opts.mdns &&
|
||||
inner.port &&
|
||||
opts.hostname !== "127.0.0.1" &&
|
||||
opts.hostname !== "localhost" &&
|
||||
opts.hostname !== "::1"
|
||||
opts.mdns && inner.port && opts.hostname !== "127.0.0.1" && opts.hostname !== "localhost" && opts.hostname !== "::1"
|
||||
if (mdns) {
|
||||
MDNS.publish(inner.port, opts.mdnsDomain)
|
||||
} else if (opts.mdns) {
|
||||
|
|
@ -326,7 +322,9 @@ async function listenHttpApi(opts: ListenOptions, selection: ServerBackend.Selec
|
|||
const requested = close ? forceStop() : Promise.resolve()
|
||||
// The first call starts scope shutdown. A later stop(true) cannot undo
|
||||
// that, but it still runs forceStop() before awaiting the original close.
|
||||
stopPromise ??= requested.then(() => Effect.runPromiseExit(Scope.close(resolved!.scope, Exit.void))).then(() => undefined)
|
||||
stopPromise ??= requested
|
||||
.then(() => Effect.runPromiseExit(Scope.close(resolved!.scope, Exit.void)))
|
||||
.then(() => undefined)
|
||||
return requested.then(() => stopPromise!)
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue