mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
25715d4521
* feat(nitro): embed observability dashboard in-process at /_workflow Serve the @workflow/web observability UI inside the Nitro process at a configurable route (default /_workflow) instead of spawning a separate web server and 302-redirecting to it. Enabled in dev, omitted from production builds by default (so prod bundles carry no @workflow/web import). Never mounted on Vercel deploys (use the hosted dashboard). - @workflow/web: add a framework-neutral `@workflow/web/handler` (createWorkflowWebHandler) that serves SSR + static client assets + RPC as one Web Request->Response handler under a runtime basename (asset manifest URLs + publicPath are reprefixed so the dashboard is self-contained under its mount). Add `@workflow/web/registry` for embedded-dashboard discovery; make the RPC/stream client basename-aware. - @workflow/nitro: mount the handler in-process (Nitro v2 h3 + v3 native paths), gated by a new `dashboard` option (default = dev). - @workflow/cli: `workflow web` / `inspect --web` defer to a running embedded dashboard instead of starting a redundant server; pass `--standalone` to force the standalone UI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * refactor(nitro): normalize dashboard path once, use isNitroV2() helper Address review feedback on the embedded dashboard: - Normalize the dashboard mount path in one place before it feeds both the Nitro route registration (`[path, path + '/**']`) and the handler `basename`. Force a single leading slash, strip trailing slashes, and reject the root mount, so a custom `path` can't make the route and the handler's internal `normalizeBasename` disagree. - Replace the handler-level `!nitro.routing` v2 checks with the existing `isNitroV2()` helper for consistent v2/v3 detection. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Peter Wielander <mittgfu@gmail.com>
23 lines
768 B
TypeScript
23 lines
768 B
TypeScript
/**
|
|
* Options for {@link createWorkflowWebHandler}.
|
|
*/
|
|
export interface CreateWorkflowWebHandlerOptions {
|
|
/**
|
|
* Mount path the dashboard is served under (e.g. `"/_workflow"`). Routing and
|
|
* asset URLs are reprefixed to this base. Defaults to `"/"` (root).
|
|
*/
|
|
basename?: string;
|
|
}
|
|
|
|
/**
|
|
* Create a framework-agnostic Web `Request` -> `Response` handler that serves
|
|
* the Workflow observability UI (static client assets + React Router SSR)
|
|
* in-process, suitable for mounting inside another server under `basename`.
|
|
*
|
|
* Requires `@workflow/web` to have been built (`build/` must exist); throws
|
|
* otherwise.
|
|
*/
|
|
export function createWorkflowWebHandler(
|
|
options?: CreateWorkflowWebHandlerOptions
|
|
): Promise<(request: Request) => Promise<Response>>;
|