Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

⬆️ chore(desktop): upgrade auv to 0.0.38 (#21493)

Nekoa4f0b06901c1
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index 24860305bbc..fc8350485ad 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -51,8 +51,8 @@
"update-server": "sh scripts/update-test/run-test.sh"
},
"dependencies": {
- "@auv-js/cli": "0.0.33",
- "@auv-js/sdk": "0.0.33",
+ "@auv-js/cli": "0.0.38",
+ "@auv-js/sdk": "0.0.38",
"@lobehub/fluent-emoji": "^5.0.0",
"@lydell/node-pty": "1.2.0-beta.15",
"electron-log": "^5.4.4",
diff --git a/apps/desktop/pnpm-lock.yaml b/apps/desktop/pnpm-lock.yaml
index 7e2e5ec1c57..398b5f2ba3e 100644
--- a/apps/desktop/pnpm-lock.yaml
+++ b/apps/desktop/pnpm-lock.yaml
@@ -16,11 +16,11 @@ importers:
.:
dependencies:
'@auv-js/cli':
- specifier: 0.0.33
- version: 0.0.33
+ specifier: 0.0.38
+ version: 0.0.38
'@auv-js/sdk':
- specifier: 0.0.33
- version: 0.0.33
+ specifier: 0.0.38
+ version: 0.0.38
'@lobehub/fluent-emoji':
specifier: ^5.0.0
@@ -961,53 +961,53 @@ packages:
zod:
optional: true
- '@auv-js/[email protected]':
- resolution: {integrity: sha512-arcCp/DlfKZb2ZPuHxM3GUs5Ehi2ZgW152CGhKKjXdopzWkGus0esFS8L+vbpTqzq0B1P9kNGxVSTFepFJ9dhw==}
+ '@auv-js/[email protected]':
+ resolution: {integrity: sha512-5TWH9YTxtN18MnyUtWw0bpYCMycAbSkZMJGIC+LlRIdHNFdD4b6JydU0Ptb/HfZWt221gOH+4BBptBrWaVdQ0w==}
- '@auv-js/[email protected]':
- resolution: {integrity: sha512-Djp1dglnU6a3Hgi07zv0dTT7OBbONFJ/lxb65vIJ0vUWBziQSFlKqAOWUo3zwkaSTy5N/Wy5uOHBPhSZwO6gtg==}
+ '@auv-js/[email protected]':
+ resolution: {integrity: sha512-2jOUDX5Z9Ya3B0yOJYpYDTB/0uMS2PZrSellXxoUPYnVq2zNcDSKnT14XK+HP5puUt2K+1vBKfeawNUFw1xUrA==}
engines: {node: '>=20.19.0'}
cpu: [arm64]
os: [darwin]
- '@auv-js/[email protected]':
- resolution: {integrity: sha512-oyBJdXg8thX+jX5vAo085PzibCgVazRIbYjckgL6NAlFej5rj1Xkh7Q+Z3iqag4c3tAonLcGS2nlfL6arkNY8g==}
+ '@auv-js/[email protected]':
+ resolution: {integrity: sha512-zfSYeQMJkCh2MvRuCFXFZd2C6JLBYp0VOCyLZnBqvQbkh0Y8LZfb0LUCEykLgNOUyZ9v3eO5YWT6vceOEXwj4A==}
engines: {node: '>=20.19.0'}
cpu: [x64]
os: [darwin]
- '@auv-js/[email protected]':
- resolution: {integrity: sha512-LFlsLTUozhvAnJhdimEt16RbJYYWZxqpnrsr9YQS/u7l5dUetJgvDignNp2Ey61a620U1LfwinCsCyBqmfbPQA==}
+ '@auv-js/[email protected]':
+ resolution: {integrity: sha512-EAKqJpT2vh0RW186vpjZeStkgz89dSfZlVok7f6XlXEDzJRMO2D7Op2YsXh2qnjQe4VsntvQJ8x1WeT5i0z7dg==}
engines: {node: '>=20.19.0'}
cpu: [arm64]
os: [linux]
libc: [glibc]
- '@auv-js/[email protected]':
- resolution: {integrity: sha512-Tjkgd2UUbiL36fuKoKi1VQDD/66KIzMIIn4RAbm36ThbjpLcy3mQ39zI4+5UqQp7HZ/hBv21R8UUGwviaYH9eA==}
+ '@auv-js/[email protected]':
+ resolution: {integrity: sha512-gDjiTdWhraVDRYtCRCjpQGT1S6pUoc3x3Ex4cu+DzhlqqBEdzZCG3R3kp2OfPHj5c7wYZ5jTVYlse8fgKnJiEg==}
engines: {node: '>=20.19.0'}
cpu: [x64]
os: [linux]
libc: [glibc]
- '@auv-js/[email protected]':
- resolution: {integrity: sha512-3qekgM/FGSeU0yFbTakhY5EJBGFE3N26isJUN+fUJO1oT1HWy//JDWCB7Yn38FcBp+eH+wM8zJIQpLuS1Se0BA==}
+ '@auv-js/[email protected]':
+ resolution: {integrity: sha512-ASacCa5ID4q+PcWEte2pwhGExX8N4+/z0u5oHba88EOJv7gcTkxvqE+bcGtB++q2PshOUjWXSw8bVjXirquvvA==}
engines: {node: '>=20.19.0'}
cpu: [arm64]
os: [win32]
- '@auv-js/[email protected]':
- resolution: {integrity: sha512-kz62T+9OxdH0w/y8WqiLGayGM0L2mXdR3hCr5nrhwB9pzp28jT5fhtfTznwu0GC5nfT2MFL93tmkhckVxmfPUg==}
+ '@auv-js/[email protected]':
+ resolution: {integrity: sha512-11XZT8y0Lqel9koA0saOqdRw9PX7zOkqwM5iOl1Z8yMmpnMiV0XOvTUskUjPeKlseipUfKfk0kBVXMBbTGlbrg==}
engines: {node: '>=20.19.0'}
cpu: [x64]
os: [win32]
- '@auv-js/[email protected]':
- resolution: {integrity: sha512-mAMGRwrrC+UUTEK5hdBrYhPsamuR+6sRF8eEO9GJABXmvYfsSE6BifY8WrlfepSrEi6JUcTNEVEucxcaC3+KkQ==}
+ '@auv-js/[email protected]':
+ resolution: {integrity: sha512-Onm/Wy0eYdikZOvjyuajn5QaqGuOdGeKe4YXf3XlMc6GO7AY9izsIdlYFnM/qGEfYKtfvMXvSJUjkoPlTVZkKQ==}
hasBin: true
- '@auv-js/[email protected]':
- resolution: {integrity: sha512-9Oadm9bNLPEOcHNC9NoXPL1I5njz5eKfLGN7KhcbA2yenPjigSoT0WIvO3TuEvVubRqHykZLZQdGD11AM2xJUA==}
+ '@auv-js/[email protected]':
+ resolution: {integrity: sha512-yK6nuWUwVTnUp2UHB+VXU8FF8f8G/64JbihCxNUr8QTJvdrxGkD4GPGkxlpGJpNWVEIILNQrFCAc+EasCHg6EA==}
resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==}
@@ -8417,40 +8417,40 @@ snapshots:
optionalDependencies:
zod: 4.6.5
- '@auv-js/[email protected]': {}
+ '@auv-js/[email protected]': {}
- '@auv-js/[email protected]':
+ '@auv-js/[email protected]':
optional: true
- '@auv-js/[email protected]':
+ '@auv-js/[email protected]':
optional: true
- '@auv-js/[email protected]':
+ '@auv-js/[email protected]':
optional: true
- '@auv-js/[email protected]':
+ '@auv-js/[email protected]':
optional: true
- '@auv-js/[email protected]':
+ '@auv-js/[email protected]':
optional: true
- '@auv-js/[email protected]':
+ '@auv-js/[email protected]':
optional: true
- '@auv-js/[email protected]':
+ '@auv-js/[email protected]':
dependencies:
std-env: 4.2.0
optionalDependencies:
- '@auv-js/cli-darwin-arm64': 0.0.33
- '@auv-js/cli-darwin-x64': 0.0.33
- '@auv-js/cli-linux-arm64-gnu': 0.0.33
- '@auv-js/cli-linux-x64-gnu': 0.0.33
- '@auv-js/cli-win32-arm64-msvc': 0.0.33
- '@auv-js/cli-win32-x64-msvc': 0.0.33
+ '@auv-js/cli-darwin-arm64': 0.0.38
+ '@auv-js/cli-darwin-x64': 0.0.38
+ '@auv-js/cli-linux-arm64-gnu': 0.0.38
+ '@auv-js/cli-linux-x64-gnu': 0.0.38
+ '@auv-js/cli-win32-arm64-msvc': 0.0.38
+ '@auv-js/cli-win32-x64-msvc': 0.0.38
- '@auv-js/[email protected]':
+ '@auv-js/[email protected]':
dependencies:
- '@auv-js/api-client': 0.0.33
+ '@auv-js/api-client': 0.0.38
'@bufbuild/protobuf': 2.13.0
'@grpc/grpc-js': 1.14.4
'@moeru/std': 0.1.0-beta.20
diff --git a/apps/desktop/pnpm-workspace.yaml b/apps/desktop/pnpm-workspace.yaml
index cf34ba5decf..85356e7a50a 100644
--- a/apps/desktop/pnpm-workspace.yaml
+++ b/apps/desktop/pnpm-workspace.yaml
@@ -65,14 +65,14 @@ overrides:
vitest: 5.0.3
'zod@^4': 4.6.5
minimumReleaseAgeExclude:
- - '@auv-js/[email protected]'
- - '@auv-js/[email protected]'
- - '@auv-js/[email protected]'
- - '@auv-js/[email protected]'
- - '@auv-js/[email protected]'
- - '@auv-js/[email protected]'
- - '@auv-js/[email protected]'
- - '@auv-js/[email protected]'
- - '@auv-js/[email protected]'
+ - '@auv-js/[email protected]'
+ - '@auv-js/[email protected]'
+ - '@auv-js/[email protected]'
+ - '@auv-js/[email protected]'
+ - '@auv-js/[email protected]'
+ - '@auv-js/[email protected]'
+ - '@auv-js/[email protected]'
+ - '@auv-js/[email protected]'
+ - '@auv-js/[email protected]'
- '@lobehub/*'
diff --git a/apps/desktop/src/main/services/__tests__/auvSrv.test.ts b/apps/desktop/src/main/services/__tests__/auvSrv.test.ts
index 9a26376fdab..d7a3b99c3f9 100644
--- a/apps/desktop/src/main/services/__tests__/auvSrv.test.ts
+++ b/apps/desktop/src/main/services/__tests__/auvSrv.test.ts
@@ -28,10 +28,12 @@ function createHarness() {
const daemon = {
connect: vi.fn().mockResolvedValue(connection),
connectionOptions: {
- endpoint: 'unix:///tmp/lobehub-auv.sock',
+ credential: 'launcher-token',
+ endpoint: '/private/auv/session.sock',
local: true,
transport: 'unix',
},
+ endpoints: ['unix:///private/auv/session.sock'],
stop: vi.fn().mockResolvedValue({ code: 0, signal: null }),
} as unknown as AuvDaemon;
const client = {
@@ -48,7 +50,6 @@ function createHarness() {
const app = {
appStoragePath: '/tmp/lobehub-storage',
} as unknown as App;
- const ipcCleanup = vi.fn().mockResolvedValue(undefined);
const resolveBinaryPath = vi.fn().mockResolvedValue('/opt/lobehub/bin/auv');
const runCli = vi.fn().mockResolvedValue({
stderr: '',
@@ -59,17 +60,13 @@ function createHarness() {
}),
});
const service = new AuvService(app, {
- createIpcListener: vi.fn().mockResolvedValue({
- cleanup: ipcCleanup,
- listener: 'unix:///private/auv/session.sock',
- }),
hostname: () => 'Nekos-MBP.lan',
loadSdk: vi.fn().mockResolvedValue(sdk),
resolveBinaryPath,
runCli,
});
- return { app, client, connection, daemon, ipcCleanup, resolveBinaryPath, runCli, sdk, service };
+ return { app, client, connection, daemon, resolveBinaryPath, runCli, sdk, service };
}
describe('AuvService', () => {
@@ -85,7 +82,6 @@ describe('AuvService', () => {
expect(resolveBinaryPath).toHaveBeenCalledOnce();
expect(sdk.startAuv).toHaveBeenCalledWith({
binaryPath: '/opt/lobehub/bin/auv',
- listeners: ['unix:///private/auv/session.sock'],
noRegister: true,
storeRoot: '/tmp/lobehub-storage/auv/store',
});
@@ -109,7 +105,7 @@ describe('AuvService', () => {
});
it('rejects and stops a child that does not expose a local IPC transport', async () => {
- const { daemon, ipcCleanup, service } = createHarness();
+ const { daemon, service } = createHarness();
Object.assign(daemon.connectionOptions, {
endpoint: 'http://127.0.0.1:19847',
local: true,
@@ -120,7 +116,6 @@ describe('AuvService', () => {
expect(daemon.connect).not.toHaveBeenCalled();
expect(daemon.stop).toHaveBeenCalledOnce();
- expect(ipcCleanup).toHaveBeenCalledOnce();
expect(service.getSnapshot()).toEqual({
devices: [],
error: 'AUV refused non-private transport: http',
@@ -129,15 +124,24 @@ describe('AuvService', () => {
});
});
+ it('rejects and stops a child that did not issue a launcher token', async () => {
+ const { daemon, service } = createHarness();
+ Object.assign(daemon.connectionOptions, { credential: undefined });
+
+ await expect(service.connect()).rejects.toThrow('AUV daemon did not issue a launcher token');
+
+ expect(daemon.connect).not.toHaveBeenCalled();
+ expect(daemon.stop).toHaveBeenCalledOnce();
+ });
+
it('closes partially-opened resources and records a failed connection', async () => {
- const { client, connection, daemon, ipcCleanup, service } = createHarness();
+ const { client, connection, daemon, service } = createHarness();
vi.mocked(client.health.check).mockRejectedValueOnce(new Error('daemon is unavailable'));
await expect(service.connect()).rejects.toThrow('daemon is unavailable');
expect(connection.close).toHaveBeenCalledOnce();
expect(daemon.stop).toHaveBeenCalledOnce();
- expect(ipcCleanup).toHaveBeenCalledOnce();
expect(service.getSnapshot()).toEqual({
devices: [],
error: 'daemon is unavailable',
@@ -147,14 +151,13 @@ describe('AuvService', () => {
});
it('closes the SDK connection and embedded daemon on disconnect', async () => {
- const { connection, daemon, ipcCleanup, service } = createHarness();
+ const { connection, daemon, service } = createHarness();
await service.connect();
const snapshot = await service.disconnect();
expect(connection.close).toHaveBeenCalledOnce();
expect(daemon.stop).toHaveBeenCalledOnce();
- expect(ipcCleanup).toHaveBeenCalledOnce();
expect(snapshot).toEqual({ devices: [], runnerClasses: [], status: 'disconnected' });
});
@@ -183,6 +186,7 @@ describe('AuvService', () => {
expect(runCli).toHaveBeenCalledWith({
argv: ['invoke', 'display.capture', '--json'],
binaryPath: '/opt/lobehub/bin/auv',
+ credential: 'launcher-token',
endpoint: 'unix:///private/auv/session.sock',
storeRoot: '/tmp/lobehub-storage/auv/runs',
});
diff --git a/apps/desktop/src/main/services/auvSrv.ts b/apps/desktop/src/main/services/auvSrv.ts
index a6f89316723..966075c738b 100644
--- a/apps/desktop/src/main/services/auvSrv.ts
+++ b/apps/desktop/src/main/services/auvSrv.ts
@@ -1,6 +1,5 @@
import { execFile } from 'node:child_process';
-import { randomUUID } from 'node:crypto';
-import { access, chmod, mkdtemp, rmdir } from 'node:fs/promises';
+import { access } from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import { promisify } from 'node:util';
@@ -56,6 +55,8 @@ export type { AuvRunCommandParams, AuvRunCommandResult };
export interface AuvCliExecutionOptions {
argv: string[];
binaryPath: string;
+ /** Launcher token of the app-owned daemon; written to the CLI's stdin, never argv or env. */
+ credential: string;
endpoint: string;
storeRoot: string;
}
@@ -69,33 +70,12 @@ export interface AuvConnectionSnapshot {
}
export interface AuvRuntimeDependencies {
- createIpcListener: () => Promise<PrivateIpcListener>;
hostname: () => string;
loadSdk: () => Promise<AuvSdkRuntime>;
resolveBinaryPath: () => Promise<string>;
runCli: (options: AuvCliExecutionOptions) => Promise<{ stderr: string; stdout: string }>;
}
-export interface PrivateIpcListener {
- cleanup?: () => Promise<void>;
- listener: string;
-}
-
-const createPrivateIpcListener = async (): Promise<PrivateIpcListener> => {
- if (process.platform === 'win32') {
- return { listener: `npipe://./pipe/lobehub-auv-${randomUUID()}` };
- }
-
- // Darwin's sockaddr_un.sun_path is only 104 bytes. A short mkdtemp path also
- // gives each app-owned child an unguessable, owner-only directory.
- const ipcDirectory = await mkdtemp('/tmp/lobehub-auv-');
- await chmod(ipcDirectory, 0o700);
- return {
- cleanup: () => rmdir(ipcDirectory),
- listener: `unix://${path.join(ipcDirectory, 'auv.sock')}`,
- };
-};
-
const resolveAuvBinaryPath = async (): Promise<string> => {
const executable = process.platform === 'win32' ? 'auv.exe' : 'auv';
const packagedBinary = process.resourcesPath
@@ -120,22 +100,29 @@ const execFileAsync = promisify(execFile);
const runAuvCli = async ({
argv,
binaryPath,
+ credential,
endpoint,
storeRoot,
}: AuvCliExecutionOptions): Promise<{ stderr: string; stdout: string }> => {
- const { stderr, stdout } = await execFileAsync(binaryPath, [...argv, '--store-root', storeRoot], {
- encoding: 'utf8',
- env: { ...process.env, AUV_ENDPOINT: endpoint },
- maxBuffer: 4 * 1024 * 1024,
- timeout: 120_000,
- windowsHide: true,
- });
+ // `--credential-stdin` is a root flag, so it must precede the subcommand.
+ const pending = execFileAsync(
+ binaryPath,
+ ['--credential-stdin', ...argv, '--store-root', storeRoot],
+ {
+ encoding: 'utf8',
+ env: { ...process.env, AUV_ENDPOINT: endpoint },
+ maxBuffer: 4 * 1024 * 1024,
+ timeout: 120_000,
+ windowsHide: true,
+ },
+ );
+ pending.child.stdin?.end(`${credential}\n`);
+ const { stderr, stdout } = await pending;
return { stderr, stdout };
};
const defaultDependencies: AuvRuntimeDependencies = {
- createIpcListener: createPrivateIpcListener,
hostname: os.hostname,
loadSdk: () => import('@auv-js/sdk/node'),
resolveBinaryPath: resolveAuvBinaryPath,
@@ -157,8 +144,6 @@ export default class AuvService extends ServiceModule {
private connection: AuvConnection | null = null;
private daemon: AuvDaemon | null = null;
private binaryPath: string | null = null;
- private ipcCleanup: (() => Promise<void>) | null = null;
- private ipcEndpoint: string | null = null;
private snapshot: AuvConnectionSnapshot = {
devices: [],
runnerClasses: [],
@@ -200,13 +185,10 @@ export default class AuvService extends ServiceModule {
const connection = this.connection;
const daemon = this.daemon;
- const ipcCleanup = this.ipcCleanup;
this.client = null;
this.connection = null;
this.daemon = null;
this.binaryPath = null;
- this.ipcCleanup = null;
- this.ipcEndpoint = null;
const errors: unknown[] = [];
try {
@@ -221,12 +203,6 @@ export default class AuvService extends ServiceModule {
errors.push(error);
}
- try {
- await ipcCleanup?.();
- } catch (error) {
- errors.push(error);
- }
-
this.snapshot = { devices: [], runnerClasses: [], status: 'disconnected' };
if (errors.length > 0) throw errors[0];
return this.getSnapshot();
@@ -254,13 +230,16 @@ export default class AuvService extends ServiceModule {
const argv = normalizeAuvArgv(params);
await this.getClient();
const binaryPath = this.binaryPath;
- const endpoint = this.ipcEndpoint;
- if (!binaryPath || !endpoint) throw new Error('AUV is not connected');
+ const credential = this.daemon?.connectionOptions.credential;
+ // The CLI needs the listener URI; `connectionOptions.endpoint` drops the `unix://` scheme.
+ const endpoint = this.daemon?.endpoints[0];
+ if (!binaryPath || !credential || !endpoint) throw new Error('AUV is not connected');
return runAuvCommand(params, argv, (cliArgv) =>
this.dependencies.runCli({
argv: cliArgv,
binaryPath,
+ credential,
endpoint,
storeRoot: path.join(this.app.appStoragePath, 'auv', 'runs'),
}),
@@ -274,25 +253,26 @@ export default class AuvService extends ServiceModule {
private async open(): Promise<AuvConnectionSnapshot> {
let connection: AuvConnection | null = null;
let daemon: AuvDaemon | null = null;
- let privateIpc: PrivateIpcListener | null = null;
try {
const sdk = await this.dependencies.loadSdk();
const binaryPath =
process.env.AUV_BINARY_PATH || (await this.dependencies.resolveBinaryPath());
const auvRoot = path.join(this.app.appStoragePath, 'auv');
- privateIpc = await this.dependencies.createIpcListener();
+ // Without `local.listen` the SDK binds an owner-only Unix socket or named
+ // pipe, and the default `launcher-token` auth admits only callers holding
+ // this launch's token: this process and the CLI children it hands it to.
daemon = await sdk.startAuv({
binaryPath,
- listeners: [privateIpc.listener],
noRegister: true,
storeRoot: path.join(auvRoot, 'store'),
});
- const { local, transport } = daemon.connectionOptions;
+ const { credential, local, transport } = daemon.connectionOptions;
if (!local || (transport !== 'unix' && transport !== 'npipe')) {
throw new Error(`AUV refused non-private transport: ${transport}`);
}
+ if (!credential) throw new Error('AUV daemon did not issue a launcher token');
connection = await daemon.connect();
const client = sdk.createAuv(connection);
@@ -301,8 +281,6 @@ export default class AuvService extends ServiceModule {
this.connection = connection;
this.daemon = daemon;
this.binaryPath = binaryPath;
- this.ipcCleanup = privateIpc.cleanup ?? null;
- this.ipcEndpoint = privateIpc.listener;
this.client = client;
this.snapshot = { devices: [], runnerClasses: [], status: 'connected', transport };
@@ -314,12 +292,9 @@ export default class AuvService extends ServiceModule {
} catch (error) {
await connection?.close().catch(() => undefined);
await daemon?.stop().catch(() => undefined);
- await privateIpc?.cleanup?.().catch(() => undefined);
this.connection = null;
this.daemon = null;
this.binaryPath = null;
- this.ipcCleanup = null;
- this.ipcEndpoint = null;
this.client = null;
this.snapshot = {
devices: [],