mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Improve daemon RPC resiliency and diff handling
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { Command } from 'commander'
|
||||
import { connectToDaemon, getDaemonHost } from '../../utils/client.js'
|
||||
import type {
|
||||
DaemonClientV2,
|
||||
DaemonClient,
|
||||
AgentStreamMessage,
|
||||
AgentStreamSnapshotMessage,
|
||||
AgentStreamEventPayload,
|
||||
@@ -107,7 +107,7 @@ export async function runAttachCommand(
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
let client: DaemonClientV2
|
||||
let client: DaemonClient
|
||||
try {
|
||||
client = await connectToDaemon({ host: options.host as string | undefined })
|
||||
} catch (err) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Command } from 'commander'
|
||||
import { connectToDaemon, getDaemonHost } from '../../utils/client.js'
|
||||
import type { CommandOptions } from '../../output/index.js'
|
||||
import type {
|
||||
DaemonClientV2,
|
||||
DaemonClient,
|
||||
AgentStreamMessage,
|
||||
AgentStreamSnapshotMessage,
|
||||
AgentTimelineItem,
|
||||
@@ -80,7 +80,7 @@ export async function runLogsCommand(
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
let client: DaemonClientV2
|
||||
let client: DaemonClient
|
||||
try {
|
||||
client = await connectToDaemon({ host: options.host as string | undefined })
|
||||
} catch (err) {
|
||||
@@ -172,7 +172,7 @@ export async function runLogsCommand(
|
||||
* Follow mode: stream logs in real-time until interrupted
|
||||
*/
|
||||
async function runFollowMode(
|
||||
client: DaemonClientV2,
|
||||
client: DaemonClient,
|
||||
agentId: string,
|
||||
options: AgentLogsOptions
|
||||
): Promise<void> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DaemonClientV2 } from '@paseo/server'
|
||||
import { DaemonClient } from '@paseo/server'
|
||||
import WebSocket from 'ws'
|
||||
|
||||
export interface ConnectOptions {
|
||||
@@ -35,12 +35,12 @@ function createNodeWebSocketFactory() {
|
||||
* Create and connect a daemon client
|
||||
* Returns the connected client or throws if connection fails
|
||||
*/
|
||||
export async function connectToDaemon(options?: ConnectOptions): Promise<DaemonClientV2> {
|
||||
export async function connectToDaemon(options?: ConnectOptions): Promise<DaemonClient> {
|
||||
const host = getDaemonHost(options)
|
||||
const timeout = options?.timeout ?? DEFAULT_TIMEOUT
|
||||
const url = `ws://${host}/ws`
|
||||
|
||||
const client = new DaemonClientV2({
|
||||
const client = new DaemonClient({
|
||||
url,
|
||||
webSocketFactory: createNodeWebSocketFactory(),
|
||||
reconnect: { enabled: false },
|
||||
@@ -76,7 +76,7 @@ export async function connectToDaemon(options?: ConnectOptions): Promise<DaemonC
|
||||
/**
|
||||
* Try to connect to the daemon, returns null if connection fails
|
||||
*/
|
||||
export async function tryConnectToDaemon(options?: ConnectOptions): Promise<DaemonClientV2 | null> {
|
||||
export async function tryConnectToDaemon(options?: ConnectOptions): Promise<DaemonClient | null> {
|
||||
try {
|
||||
return await connectToDaemon(options)
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user