@frebreco/canvas 0.3.0-next.5 → 0.3.0-next.7
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/package.json +1 -1
- package/src/cli.ts +1 -0
- package/src/server/server.ts +3 -0
- package/src/shared/protocol.ts +4 -0
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -54,6 +54,7 @@ const { server, room } = await serve({
|
|
|
54
54
|
port: Number(values.port),
|
|
55
55
|
hostname: tlsHost ? "0.0.0.0" : "127.0.0.1",
|
|
56
56
|
...(tlsHost && { tls: { cert: values.cert, key: values.key } }),
|
|
57
|
+
...(manifest.version && { version: manifest.version }),
|
|
57
58
|
});
|
|
58
59
|
|
|
59
60
|
const serverUrl = tlsHost ? `wss://${tlsHost}:${server.port}` : `ws://127.0.0.1:${server.port}`;
|
package/src/server/server.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface ServeOptions {
|
|
|
21
21
|
readonly port: number;
|
|
22
22
|
readonly hostname: string;
|
|
23
23
|
readonly tls?: { readonly cert: string; readonly key: string };
|
|
24
|
+
/** The published version this runs as; none for a checkout. */
|
|
25
|
+
readonly version?: string;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
export async function serve(options: ServeOptions) {
|
|
@@ -156,6 +158,7 @@ export async function serve(options: ServeOptions) {
|
|
|
156
158
|
ws.send(
|
|
157
159
|
JSON.stringify({
|
|
158
160
|
t: "welcome",
|
|
161
|
+
version: options.version ?? null,
|
|
159
162
|
room: secrets,
|
|
160
163
|
cwd: options.dir,
|
|
161
164
|
agents: agentDefinitions.map(({ kind, label }) => ({ kind, label })),
|
package/src/shared/protocol.ts
CHANGED
|
@@ -211,6 +211,8 @@ export type ClientToServer =
|
|
|
211
211
|
export type ServerToClient =
|
|
212
212
|
| {
|
|
213
213
|
readonly t: "welcome";
|
|
214
|
+
/** The version `canvas serve` runs as; null for a checkout. */
|
|
215
|
+
readonly version: string | null;
|
|
214
216
|
readonly room: RoomSecrets;
|
|
215
217
|
readonly cwd: string;
|
|
216
218
|
readonly agents: ReadonlyArray<AgentInfo>;
|
|
@@ -258,6 +260,8 @@ export interface RoomState {
|
|
|
258
260
|
readonly access: GuestAccess;
|
|
259
261
|
readonly cwd: string;
|
|
260
262
|
readonly agents: ReadonlyArray<AgentInfo>;
|
|
263
|
+
/** `canvas serve`'s version, null for a checkout; absent from hosts older than it. */
|
|
264
|
+
readonly version?: string | null;
|
|
261
265
|
}
|
|
262
266
|
|
|
263
267
|
/** Requests a guest sends the host; the host answers `{ok}` or `{ok:false, error}`. */
|