This commit is contained in:
Sanool 2026-01-29 22:16:32 +00:00 committed by GitHub
commit 478d89b44b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View File

@ -36,7 +36,7 @@ export type DiscoveryConfig = {
export type CanvasHostConfig = {
enabled?: boolean;
/** Directory to serve (default: ~/clawd/canvas). */
/** Directory to serve (default: <workspace>/canvas, e.g. ~/clawd/canvas). */
root?: string;
/** HTTP port to listen on (default: 18793). */
port?: number;

View File

@ -1,4 +1,5 @@
import type { Server as HttpServer } from "node:http";
import path from "node:path";
import { WebSocketServer } from "ws";
import { CANVAS_HOST_PATH } from "../canvas-host/a2ui.js";
import { type CanvasHostHandler, createCanvasHostHandler } from "../canvas-host/server.js";
@ -37,6 +38,7 @@ export async function createGatewayRuntimeState(params: {
deps: CliDeps;
canvasRuntime: RuntimeEnv;
canvasHostEnabled: boolean;
defaultWorkspaceDir: string;
allowCanvasHostInTests?: boolean;
logCanvas: { info: (msg: string) => void; warn: (msg: string) => void };
log: { info: (msg: string) => void; warn: (msg: string) => void };
@ -75,7 +77,7 @@ export async function createGatewayRuntimeState(params: {
try {
const handler = await createCanvasHostHandler({
runtime: params.canvasRuntime,
rootDir: params.cfg.canvasHost?.root,
rootDir: params.cfg.canvasHost?.root ?? path.join(params.defaultWorkspaceDir, "canvas"),
basePath: CANVAS_HOST_PATH,
allowInTests: params.allowCanvasHostInTests,
liveReload: params.cfg.canvasHost?.liveReload,

View File

@ -301,6 +301,7 @@ export async function startGatewayServer(
deps,
canvasRuntime,
canvasHostEnabled,
defaultWorkspaceDir,
allowCanvasHostInTests: opts.allowCanvasHostInTests,
logCanvas,
log,