@lace-cloud/host
v0.6.5
Published
Vscode-free host library for talking to a `lace engine` process from Node.js. Provides the gRPC-JS transport, server lifecycle, handshake parser, RPC error classifier, and the Subscribe stream handler.
Readme
@lace-cloud/host
Vscode-free host library for talking to a lace engine process from
Node.js. Provides the gRPC-JS transport, server lifecycle, handshake
parser, RPC error classifier, and the Subscribe stream handler.
Consumed by the VS Code extension shell, @lace-cloud/chat-core (for
the proactivity watcher's Subscribe subscription), and any future
host adapter (portal BFF, JetBrains plugin host).
Install
npm install @lace-cloud/hostUsage
import {
ServerManager,
LaceTransport,
SubscribeHandler,
classifyRpcError,
RpcError,
requireClient,
} from '@lace-cloud/host';
// Spawn lace engine + manage its lifecycle.
const server = new ServerManager({
log: (msg) => console.log(msg),
getBinaryPath: () => '/usr/local/bin/lace',
getAutoRestart: () => true,
});
server.on('state', (state) => console.log(`engine: ${state}`));
await server.start();
// LaceTransport is constructed by ServerManager once the handshake
// completes. Read it via server.transport.
const transport = requireClient(server.transport, 'sessionOpen');
const view = await transport.sessionOpen({ path: '/some/.lace' });
// Subscribe stream handler — bridges gRPC stream events to a
// callback shape (StateUpdated / GenerateProgress / Success / Error).
const sub = new SubscribeHandler(transport, {
onStateUpdated: (state) => { /* … */ },
});
sub.start();Vscode-free contract
This package never imports vscode. The VS Code-coupled host
primitives (panel classes, webview-html builder, RPC-error toast) live
in vs-code-extension/src/vscode/.
License
Proprietary — see LICENSE.
