@lace-cloud/host 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -13
- package/dist/index.cjs +2308 -6767
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +513 -287
- package/dist/index.d.ts +513 -287
- package/dist/index.mjs +2302 -6768
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Vscode-free host library for talking to a `lace engine` process from
|
|
4
4
|
Node.js. Provides the gRPC-JS transport, server lifecycle, handshake
|
|
5
|
-
parser, RPC error classifier, and the
|
|
5
|
+
parser, RPC error classifier, and the engine bridge server that a
|
|
6
|
+
webview (VS Code, JetBrains) talks to over `postMessage`.
|
|
6
7
|
|
|
7
|
-
Consumed by the VS Code extension shell, `@lace-cloud/chat-core` (
|
|
8
|
-
|
|
9
|
-
host adapter (portal BFF, JetBrains plugin host).
|
|
8
|
+
Consumed by the VS Code extension shell, `@lace-cloud/chat-core` (the
|
|
9
|
+
proactivity watcher reads engine facts through `subscribeFacts`), and
|
|
10
|
+
any future host adapter (portal BFF, JetBrains plugin host).
|
|
10
11
|
|
|
11
12
|
## Install
|
|
12
13
|
|
|
@@ -19,8 +20,7 @@ npm install @lace-cloud/host
|
|
|
19
20
|
```ts
|
|
20
21
|
import {
|
|
21
22
|
ServerManager,
|
|
22
|
-
|
|
23
|
-
SubscribeHandler,
|
|
23
|
+
serveEngineBridge,
|
|
24
24
|
classifyRpcError,
|
|
25
25
|
RpcError,
|
|
26
26
|
requireClient,
|
|
@@ -37,15 +37,26 @@ await server.start();
|
|
|
37
37
|
|
|
38
38
|
// LaceTransport is constructed by ServerManager once the handshake
|
|
39
39
|
// completes. Read it via server.transport.
|
|
40
|
-
const transport = requireClient(server.transport, '
|
|
41
|
-
const view = await transport.sessionOpen({ path: '/some/.lace' });
|
|
40
|
+
const transport = requireClient(server.transport, 'serveEngineBridge');
|
|
42
41
|
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
// Serve a webview's MessageBridge over the engine connection: every
|
|
43
|
+
// request is checked against @lace-cloud/proto's ENGINE_METHODS /
|
|
44
|
+
// ENGINE_STREAM_METHODS before it reaches the engine, and forwarded
|
|
45
|
+
// generically by method name — no per-method switch. Every allow-listed
|
|
46
|
+
// Invoke, `--yes` included, forwards as-is: the canvas's
|
|
47
|
+
// `presenter.confirm` is the one decider for a mutating command.
|
|
48
|
+
const dispose = serveEngineBridge(webviewBridge, transport);
|
|
49
|
+
// … later, on webview dispose:
|
|
50
|
+
dispose();
|
|
51
|
+
|
|
52
|
+
// Engine facts for chat — the validator's findings of each session
|
|
53
|
+
// state and generation failures, never the Bundle. Chat-core takes a
|
|
54
|
+
// FactsSource (anything with subscribeFacts) and reads ChatEngineEvent.
|
|
55
|
+
const facts = transport.subscribeFacts(sessionId);
|
|
56
|
+
facts.on('data', (e) => {
|
|
57
|
+
if (e.diagnostics) { /* this state's findings; [] when it has none */ }
|
|
58
|
+
if (e.generate_error) { /* generation failed */ }
|
|
47
59
|
});
|
|
48
|
-
sub.start();
|
|
49
60
|
```
|
|
50
61
|
|
|
51
62
|
## Vscode-free contract
|