screen-relay 0.0.0 → 0.1.1

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.
Files changed (91) hide show
  1. package/LICENSE +201 -0
  2. package/Makefile +165 -0
  3. package/README.md +112 -1
  4. package/THIRD-PARTY-NOTICES.md +75 -0
  5. package/dist/cli/client.d.ts +28 -0
  6. package/dist/cli/commands.d.ts +52 -0
  7. package/dist/cli/config.d.ts +32 -0
  8. package/dist/cli/format.d.ts +15 -0
  9. package/dist/cli/help.d.ts +5 -0
  10. package/dist/cli/host/common.d.ts +23 -0
  11. package/dist/cli/host/doctor.d.ts +2 -0
  12. package/dist/cli/host/packages.d.ts +13 -0
  13. package/dist/cli/host/session_commands.d.ts +8 -0
  14. package/dist/cli/host/setup.d.ts +22 -0
  15. package/dist/cli/host/state.d.ts +23 -0
  16. package/dist/cli/host/supervisor.d.ts +94 -0
  17. package/dist/cli/host/watcher.d.ts +4 -0
  18. package/dist/cli/host/windows.d.ts +82 -0
  19. package/dist/cli/main.d.ts +3 -0
  20. package/dist/cli/mode.d.ts +14 -0
  21. package/dist/cli/output.d.ts +24 -0
  22. package/dist/cli/parser.d.ts +6 -0
  23. package/dist/cli/relay.mjs +12631 -0
  24. package/dist/cli/skills.d.ts +21 -0
  25. package/dist/cli/theme.d.ts +14 -0
  26. package/dist/protocol/errors.d.ts +155 -0
  27. package/dist/protocol/index.d.ts +119 -0
  28. package/dist/protocol/index.js +418 -0
  29. package/dist/sdk/index.d.ts +78 -0
  30. package/dist/sdk/index.js +834 -0
  31. package/dist/sdk/transport.d.ts +20 -0
  32. package/dist/viewer/index.html +96 -0
  33. package/dist/viewer/viewer.js +1079 -0
  34. package/package.json +47 -7
  35. package/packages.tsv +38 -0
  36. package/skills/core/SKILL.md +171 -0
  37. package/skills/core/references/cli.md +119 -0
  38. package/skills/core/references/config.md +48 -0
  39. package/skills/core/references/macos.md +50 -0
  40. package/skills/core/references/sdk.md +69 -0
  41. package/skills/core/references/troubleshooting.md +33 -0
  42. package/skills/core/references/wayland.md +47 -0
  43. package/skills/screen-relay/SKILL.md +24 -0
  44. package/skills/vercel-sandbox/SKILL.md +68 -0
  45. package/src/engine/backends/linux/keycodes.hpp +35 -0
  46. package/src/engine/backends/linux/wayland/capture.cpp +298 -0
  47. package/src/engine/backends/linux/wayland/input.cpp +559 -0
  48. package/src/engine/backends/linux/wayland/keymap.cpp +118 -0
  49. package/src/engine/backends/linux/wayland/keymap.hpp +54 -0
  50. package/src/engine/backends/linux/wayland/protocols/virtual-keyboard-unstable-v1.xml +112 -0
  51. package/src/engine/backends/linux/wayland/protocols/wlr-screencopy-unstable-v1.xml +234 -0
  52. package/src/engine/backends/linux/wayland/protocols/wlr-virtual-pointer-unstable-v1.xml +152 -0
  53. package/src/engine/backends/linux/wayland/wayland.cpp +166 -0
  54. package/src/engine/backends/linux/wayland/wayland.hpp +60 -0
  55. package/src/engine/backends/linux/x11/capture.cpp +206 -0
  56. package/src/engine/backends/linux/x11/input.cpp +266 -0
  57. package/src/engine/backends/macos/capture.mm +367 -0
  58. package/src/engine/backends/macos/display.hpp +20 -0
  59. package/src/engine/backends/macos/display.mm +84 -0
  60. package/src/engine/backends/macos/input.mm +287 -0
  61. package/src/engine/backends/macos/keys.hpp +34 -0
  62. package/src/engine/backends/windows/capture.cpp +393 -0
  63. package/src/engine/backends/windows/input.cpp +274 -0
  64. package/src/engine/backends/windows/output.cpp +65 -0
  65. package/src/engine/backends/windows/output.hpp +26 -0
  66. package/src/engine/core/capture-bucket.hpp +40 -0
  67. package/src/engine/core/capture-source.hpp +59 -0
  68. package/src/engine/core/capture.cpp +565 -0
  69. package/src/engine/core/capture.hpp +58 -0
  70. package/src/engine/core/color.cpp +176 -0
  71. package/src/engine/core/color.hpp +16 -0
  72. package/src/engine/core/cpu-budget.hpp +196 -0
  73. package/src/engine/core/flow.hpp +317 -0
  74. package/src/engine/core/input.cpp +98 -0
  75. package/src/engine/core/input.hpp +115 -0
  76. package/src/engine/core/wait.cpp +125 -0
  77. package/src/engine/core/wait.hpp +41 -0
  78. package/src/engine/server/backend.cpp +65 -0
  79. package/src/engine/server/backend.hpp +18 -0
  80. package/src/engine/server/config.cpp +257 -0
  81. package/src/engine/server/config.hpp +24 -0
  82. package/src/engine/server/main.cpp +82 -0
  83. package/src/engine/server/metrics.cpp +47 -0
  84. package/src/engine/server/metrics.hpp +10 -0
  85. package/src/engine/server/screenshot.cpp +108 -0
  86. package/src/engine/server/screenshot.hpp +31 -0
  87. package/src/engine/server/server.cpp +535 -0
  88. package/src/engine/server/server.hpp +89 -0
  89. package/src/engine/server/wire.cpp +70 -0
  90. package/src/engine/server/wire.hpp +29 -0
  91. package/index.js +0 -2
@@ -0,0 +1,32 @@
1
+ export declare const BACKENDS: readonly ['x11', 'wayland', 'macos', 'windows'];
2
+ export declare const COMPOSITORS: readonly ['auto', 'on', 'off'];
3
+ export type ConfigSettings = {
4
+ display: {
5
+ resolution: string;
6
+ compositor: (typeof COMPOSITORS)[number];
7
+ };
8
+ stream: {
9
+ fps: number;
10
+ bitrate: {
11
+ min: number;
12
+ start: number;
13
+ max: number;
14
+ };
15
+ };
16
+ server: {
17
+ port: number;
18
+ bind: string;
19
+ public: string | null;
20
+ tls_cert: string | null;
21
+ tls_key: string | null;
22
+ };
23
+ keyboard: {
24
+ layout: string;
25
+ };
26
+ desktop: string;
27
+ backend?: string;
28
+ };
29
+ export declare function locate(path?: string): [string | null, boolean];
30
+ export declare function backendValue(value: unknown, path: string): (typeof BACKENDS)[number];
31
+ export declare function loadConfig(path?: string): [ConfigSettings, string | null, Set<string>];
32
+ export declare function applyTo(args: Record<string, unknown>, settings: ConfigSettings, present: Set<string>): void;
@@ -0,0 +1,15 @@
1
+ import type { OutputOptions } from './mode.js';
2
+ import type { NextCommand } from '../protocol/errors.js';
3
+ /** Splits a command line on whitespace while keeping single- and double-quoted runs together. */
4
+ export declare function tokens(command: string): string[];
5
+ export declare function nextCommand(command: string): NextCommand;
6
+ export declare function nextFor(command: string): NextCommand[];
7
+ export declare function quote(value: string): string;
8
+ export declare function row(label: string, value: unknown, args?: OutputOptions): string;
9
+ export declare function receipt(label: string, value: unknown, args?: OutputOptions): string;
10
+ export declare function nextStep(benefit: string, command: string, args?: OutputOptions): string;
11
+ export declare function hintStep(instruction: string, hint: string): string;
12
+ export declare function sessionCommand(command: string, name: string): string;
13
+ export declare function count(value: number, noun: string): string;
14
+ export declare function duration(seconds: number): string;
15
+ export declare function size(bytes: number): string;
@@ -0,0 +1,5 @@
1
+ import { type OutputOptions } from './mode.js';
2
+ export declare const version: string;
3
+ export declare function helpDocument(name?: string): Record<string, unknown>;
4
+ /** Formats root or command help in the human layout, or the descriptive agent layout when an agent is detected. */
5
+ export declare function formatHelp(name?: string, args?: OutputOptions): string;
@@ -0,0 +1,23 @@
1
+ import { type ChildProcess, type SpawnOptions } from 'node:child_process';
2
+ export declare const DEFAULT_PORT = 8080;
3
+ export declare const COMPONENTS: string[];
4
+ export declare const LAUNCHER_DIR: string;
5
+ /** Version of this CLI, or 0.0.0 in a bundle built without one. */
6
+ export declare const VERSION: string;
7
+ /** Directory that holds the engine built for this CLI version. */
8
+ export declare function engineDirectory(): string;
9
+ export type HostArgs = Record<string, unknown> & {
10
+ command: string;
11
+ json: boolean;
12
+ name: string;
13
+ backend?: string;
14
+ output?: string;
15
+ signal?: AbortSignal;
16
+ };
17
+ export declare function isLinux(): boolean;
18
+ export declare function requireHost(): void;
19
+ export declare function which(program: string): string | undefined;
20
+ /** Clears Linux capabilities or leaves the command unchanged on macOS and Windows. */
21
+ export declare function clearedCommand(command: string[]): [string, ...string[]];
22
+ export declare function spawnCleared(command: string[], options?: SpawnOptions): ChildProcess;
23
+ export declare function run(command: string[], options?: SpawnOptions): import("node:child_process").SpawnSyncReturns<string>;
@@ -0,0 +1,2 @@
1
+ import type { HostArgs } from './common.js';
2
+ export declare function cmdDoctor(args: HostArgs): Promise<number>;
@@ -0,0 +1,13 @@
1
+ export type Family = 'apt' | 'dnf' | 'pacman' | 'apk';
2
+ /** Rows of packages.tsv, read on first use from beside the installed CLI or from the root of a source checkout. */
3
+ export declare function rows(): string[][];
4
+ /** Family from os-release text: ID first, then each ID_LIKE word. Returns undefined for an unsupported distro. */
5
+ export declare function detectFamily(osRelease: string): Family | undefined;
6
+ /** Distro package names for the logical names, in table order, deduplicated. Throws on an unknown name. */
7
+ export declare function packagesFor(family: Family, names: string[]): string[];
8
+ /** Distro package names for every row in the given groups, in table order, deduplicated. */
9
+ export declare function groupPackages(family: Family, groups: string[], skip?: string[]): string[];
10
+ /** Whether packages.tsv has a row that provides this program or library. */
11
+ export declare function provides(name: string): boolean;
12
+ /** The non-interactive install command to paste, with prefix '' or 'sudo '. */
13
+ export declare function installCommand(family: Family, packages: string[], prefix: string): string;
@@ -0,0 +1,8 @@
1
+ import { COMPONENTS, HostArgs } from './common.js';
2
+ export { COMPONENTS };
3
+ type Args = HostArgs & Record<string, any>;
4
+ export declare function cmdUp(args: Args): Promise<number>;
5
+ export declare function cmdDown(args: Args): Promise<number>;
6
+ export declare function cmdStatus(args: Args): Promise<number>;
7
+ export declare function cmdLogs(args: Args): Promise<number>;
8
+ export declare function cmdRun(args: Args): Promise<number>;
@@ -0,0 +1,22 @@
1
+ import { BACKENDS } from '../config.js';
2
+ import { type HostArgs } from './common.js';
3
+ type Backend = (typeof BACKENDS)[number];
4
+ type Args = HostArgs & Record<string, any>;
5
+ type Request = {
6
+ backends: Backend[];
7
+ display?: string;
8
+ desktop?: string;
9
+ keyboardLayout?: string;
10
+ };
11
+ type Plan = {
12
+ state: 'ready' | 'needs-build' | 'needs-packages';
13
+ backends: Backend[];
14
+ build: boolean;
15
+ groups: string[];
16
+ };
17
+ /** Decides what this machine still needs before it can run the requested backends. The engine is built with every compiled backend, but the desktop packages follow only the requested ones. */
18
+ export declare function planSetup(request: Request): Plan;
19
+ /** Sets the machine up before a session starts and returns the arguments a prompt chose, for a detached child to repeat. */
20
+ export declare function ensureSetup(args: Args): Promise<string[]>;
21
+ export declare function cmdInstall(args: Args): Promise<number>;
22
+ export {};
@@ -0,0 +1,23 @@
1
+ export type ProcessIdentity = {
2
+ pid: number;
3
+ start: string | null;
4
+ };
5
+ export type SessionData = Record<string, any>;
6
+ export declare function stateDir(name: string): string;
7
+ export declare function readSession(name: string): SessionData | null;
8
+ export declare function writeSession(directory: string, data: SessionData): void;
9
+ export declare function tail(path: string, lines?: number): string;
10
+ export declare function startTime(pid: number): string | null;
11
+ export declare function alive(record: unknown): boolean;
12
+ export declare function identity(pid: number): ProcessIdentity;
13
+ /** Creates a lock file that names this process as its owner, whole or not at all. Returns false when the file already exists. */
14
+ export declare function claimLock(file: string): boolean;
15
+ /** Whether the process that claimed a lock file is still running. A missing, empty, or unreadable file has no owner. */
16
+ export declare function lockOwnerAlive(file: string): boolean;
17
+ /** Signals every Linux process carrying this session's SCREEN_RELAY_SESSION marker; on macOS the app watcher stops each app it holds. */
18
+ export declare function sweep(directory: string, signal?: AbortSignal): Promise<void>;
19
+ export declare function reap(directory: string, session: SessionData | null, signal?: AbortSignal): Promise<void>;
20
+ /** Holds the session lock until close: flock on Linux, lockf on macOS, and a lock file on Windows. */
21
+ export declare function lock(name: string, directory: string): Promise<{
22
+ close(): Promise<void>;
23
+ }>;
@@ -0,0 +1,94 @@
1
+ import { type ChildProcess, type SpawnOptions } from 'node:child_process';
2
+ import { BACKENDS } from '../config.js';
3
+ import { Failure } from '../output.js';
4
+ import { HostArgs } from './common.js';
5
+ import { SessionData } from './state.js';
6
+ export declare const BACKEND_PROGRAMS: {
7
+ x11: string[];
8
+ wayland: string[];
9
+ macos: never[];
10
+ windows: never[];
11
+ };
12
+ export declare const HINTS: Record<string, string>;
13
+ export type SessionArgs = HostArgs & {
14
+ name: string;
15
+ port: number;
16
+ display?: string;
17
+ desktop?: string;
18
+ public?: string;
19
+ bind?: string;
20
+ resolution: string;
21
+ fps: number;
22
+ bitrateMin: number;
23
+ bitrateStart: number;
24
+ bitrateMax: number;
25
+ timeout?: number;
26
+ 'tls-cert'?: string;
27
+ 'tls-key'?: string;
28
+ keyboardLayout?: string;
29
+ compositor?: string;
30
+ };
31
+ type EngineTarget = {
32
+ url: string;
33
+ token?: string | null;
34
+ certificate?: string | null;
35
+ connect?: string | null;
36
+ };
37
+ export declare function startXvfb(start: (command: string[], options: SpawnOptions) => ChildProcess, auth: string, resolution?: string, signal?: AbortSignal): Promise<string>;
38
+ export declare function xQuery(env: NodeJS.ProcessEnv, ...command: string[]): string;
39
+ export declare function displaySize(env: NodeJS.ProcessEnv): string | null;
40
+ export declare function connectHost(bind?: string | null): string | null;
41
+ export declare class Session {
42
+ readonly args: SessionArgs;
43
+ readonly dir: string;
44
+ readonly children: Map<string, ChildProcess>;
45
+ readonly logs: number[];
46
+ readonly errors: Map<string, Error>;
47
+ runtimeDir?: string;
48
+ env: NodeJS.ProcessEnv;
49
+ data: SessionData;
50
+ constructor(args: SessionArgs, directory: string);
51
+ save(changes?: Record<string, unknown>): void;
52
+ spawn(name: string, command: string[], options?: SpawnOptions): ChildProcess;
53
+ failure(name: string, code: string, message: string): Failure;
54
+ checkChildren(): void;
55
+ startBus(): Promise<void>;
56
+ startWaylandDisplay(layout: string): Promise<string | null>;
57
+ start(): Promise<Record<string, unknown>>;
58
+ engineReady(pid: number, where: EngineTarget): Promise<boolean>;
59
+ desktopReady(desktop: string): boolean;
60
+ waitReady(pid: number, where: EngineTarget, desktop: string): Promise<void>;
61
+ supervise(shouldStop: () => boolean): Promise<void>;
62
+ cleanup(): Promise<void>;
63
+ }
64
+ export declare function desktopEnv(directory: string): NodeJS.ProcessEnv;
65
+ /** Whether screen-relay's own XFCE desktop runs its compositor: `on` or `off` as set, otherwise on only up to 60 fps, because the compositor repaints at most 60 times a second. */
66
+ export declare function compositing(setting: string | undefined, fps: number): boolean;
67
+ /** Sets the xfwm4 compositor on or off in a session's own config dir. Other saved xfwm4 settings are kept. */
68
+ export declare function writeCompositing(configHome: string | undefined, enabled: boolean): void;
69
+ /** Finds the engine beside the CLI, then the one built for this CLI version, then one on PATH. */
70
+ export declare function findEngine(): string | null;
71
+ /** Whether a backend attaches to a real desktop instead of starting one. */
72
+ export declare function attaches(backend: string | undefined): boolean;
73
+ /** Backends the engine reports it was built with; empty when there is no engine. */
74
+ export declare function compiledBackends(engine?: string | null): string[];
75
+ /** The command that sets this machine up for a backend. */
76
+ export declare function installCommand(backend: string): string;
77
+ /** Resolves the desktop for a session and lists the programs it needs that are not installed. */
78
+ export declare function sessionNeeds(backend: (typeof BACKENDS)[number], args: {
79
+ display?: string;
80
+ desktop?: string;
81
+ keyboardLayout?: string;
82
+ }): {
83
+ desktop: string;
84
+ desktopCommand: string[];
85
+ layout: string;
86
+ missing: string[];
87
+ ownBus: boolean;
88
+ };
89
+ /** The backend the caller asked for, by flag or by the shape of --display; undefined when neither says. */
90
+ export declare function requestedBackend(explicit: string | undefined, display?: string): (typeof BACKENDS)[number] | undefined;
91
+ /** Selects a backend for the platform and checks the engine's compiled backends. */
92
+ export declare function resolveBackend(explicit: string | undefined, display?: string): (typeof BACKENDS)[number];
93
+ export declare function splitCommand(value: string): string[];
94
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function startWatcher(command: string[], env: NodeJS.ProcessEnv, logFd: number, signal: AbortSignal | undefined, restart: boolean): Promise<{
2
+ pid: number;
3
+ exited?: number;
4
+ }>;
@@ -0,0 +1,82 @@
1
+ import { Failure } from '../output.js';
2
+ /** Root of the MSYS2 install that `screen-relay install` sets up on Windows. */
3
+ export declare const MSYS2_ROOT = "C:\\msys64";
4
+ /** The PATH that setup gives the MSYS2 shell, so it searches only the directories setup checks and whatever its login profile adds is not used. */
5
+ export declare const MSYS2_PATH: string;
6
+ /** The MSYS2 paths that setup runs or loads: the shell, the config its login profile reads, and every searched directory with the directories above it that could replace it. */
7
+ export declare const MSYS2_CHECKED: string[];
8
+ /** One access rule as PowerShell reports it: the trustee's security identifier, its account name, and the rights it is granted. */
9
+ export type AclRule = {
10
+ sid: string;
11
+ name: string;
12
+ rights: number;
13
+ };
14
+ /** The owner and allow rules of one path, and whether it is a directory or a file. */
15
+ export type AclObject = {
16
+ path: string;
17
+ kind: 'file' | 'directory';
18
+ owner: string;
19
+ ownerName: string;
20
+ rules: AclRule[];
21
+ };
22
+ /** The allow rules of the MSYS2 paths, and the security identifier of the signed-in account. */
23
+ export type AclProbe = {
24
+ current: string;
25
+ objects: AclObject[];
26
+ };
27
+ /** What setup found at the MSYS2 root: an installation it runs, nothing, or a tree it will not run. */
28
+ export type Msys2Installation = {
29
+ state: 'missing';
30
+ root: string;
31
+ } | {
32
+ state: 'trusted';
33
+ root: string;
34
+ shell: string;
35
+ } | {
36
+ state: 'untrusted';
37
+ root: string;
38
+ reason: string;
39
+ repair?: string[];
40
+ };
41
+ /** The MSYS2 states that stop setup. */
42
+ export type Msys2Problem = Exclude<Msys2Installation, {
43
+ state: 'trusted';
44
+ }>;
45
+ /** The environment that runs relay-engine, with MSYS2's UCRT64 libraries first on PATH on Windows. Other platforms get the environment unchanged. */
46
+ export declare function engineEnvironment(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
47
+ /** The directory to start the engine in on Windows: its own, so Windows does not search the caller's folder for the engine's DLLs. Undefined elsewhere. */
48
+ export declare function engineWorkingDirectory(engine: string): string | undefined;
49
+ /** The MSYS2 installation on this machine, decided once per process. Call forgetMsys2Installation after setup changes the tree. */
50
+ export declare function msys2Installation(): Msys2Installation;
51
+ /** Drops the remembered decision, so the next check reads the installation again. */
52
+ export declare function forgetMsys2Installation(): void;
53
+ /** MSYS2's bash, after checking that setup trusts the installation it comes from. */
54
+ export declare function msys2Shell(): string;
55
+ /** The failure that says setup will not run the MSYS2 tree it found, and what to do about it. The hint carries no backticks, because the CLI prints a backticked command in place of the hint. */
56
+ export declare function msys2Failure(found: Msys2Problem): Failure;
57
+ /** What to do about an MSYS2 tree that setup does not trust: remove the rights it inherits from C:\ when only those are wrong, else delete it. */
58
+ export declare function msys2Fix(found: Extract<Msys2Installation, {
59
+ state: 'untrusted';
60
+ }>): string;
61
+ /** Removes the rights the MSYS2 tree inherits from C:\, which let every user add files to it, and leaves full control to SYSTEM, Administrators and this account and read access to Users. Returns false when there is nothing to repair or icacls fails. */
62
+ export declare function repairMsys2(): boolean;
63
+ /** Whether the signed-in account, SYSTEM, Administrators, or TrustedInstaller owns every MSYS2 path that setup runs or loads, and no other account can write to it. */
64
+ export declare function trustedAcl(probe: AclProbe): {
65
+ trusted: true;
66
+ } | {
67
+ trusted: false;
68
+ reason: string;
69
+ owned: boolean;
70
+ };
71
+ /** The repair for a tree whose owners setup trusts, or undefined when only deleting it helps; any account's SID works, including one from Entra ID. */
72
+ export declare function msys2Repair(owned: boolean, account: string): string[] | undefined;
73
+ /** The icacls command that replaces the MSYS2 root's inherited rules with full control for SYSTEM, Administrators and this account and read access for Users; Windows passes them on to the tree. */
74
+ export declare function repairCommand(account: string): string[];
75
+ /** Absolute path of winget, or null when LOCALAPPDATA is not set. */
76
+ export declare function wingetPath(): string | null;
77
+ /** The Windows session id of this process, or null when PowerShell cannot report it. */
78
+ export declare function windowsSessionId(): number | null;
79
+ /** The creation time of a Windows process as a FILETIME string, or null when it cannot be read. */
80
+ export declare function windowsStartTime(pid: number): string | null;
81
+ /** Ends a process and every process it started. A failure is ignored because the process may already be gone. */
82
+ export declare function killTree(pid: number): void;
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export { commands } from './commands.js';
3
+ export declare function main(argv?: string[]): Promise<number>;
@@ -0,0 +1,14 @@
1
+ export interface OutputOptions {
2
+ json?: boolean;
3
+ 'no-color'?: boolean;
4
+ color?: boolean;
5
+ }
6
+ export declare const agent: boolean;
7
+ export declare function outputMode(args?: OutputOptions, stream?: NodeJS.WriteStream): {
8
+ tty: boolean;
9
+ plain: boolean;
10
+ color: boolean;
11
+ pretty: boolean;
12
+ };
13
+ /** Whether the CLI may prompt: a person at a terminal, not an agent, CI, or a JSON caller. */
14
+ export declare function interactive(args?: OutputOptions): boolean;
@@ -0,0 +1,24 @@
1
+ import { type OutputOptions } from './mode.js';
2
+ import { RelayError, type ErrorOptions } from '../protocol/errors.js';
3
+ export { count, duration, hintStep, nextCommand, nextFor, nextStep, quote, receipt, row, sessionCommand, size } from './format.js';
4
+ export declare class Failure extends RelayError {
5
+ constructor(code: string, message: string, hint?: string, extra?: Record<string, unknown>, options?: ErrorOptions);
6
+ payload(): Record<string, unknown>;
7
+ }
8
+ export declare function emit(args: OutputOptions, data: unknown, text: string, mutation?: {
9
+ identifier?: string;
10
+ }): void;
11
+ export declare function writeText(text: string): void;
12
+ export declare function printWarning(text: string, args?: OutputOptions): void;
13
+ export declare function printNext(args: OutputOptions, benefit: string, command: string): void;
14
+ export declare function formatReady(info: Record<string, any>, args: Record<string, any>, background?: boolean): string;
15
+ export declare function formatStatus(name: string, session: Record<string, any>, args?: OutputOptions): string;
16
+ export declare function formatStopped(name: string, stopped: boolean, args?: OutputOptions): string;
17
+ export declare function formatStarted(command: string, pid: number, display: string, log: string, args?: OutputOptions): string;
18
+ export declare function formatDoctor(checks: Array<{
19
+ status: string;
20
+ name: string;
21
+ detail: string;
22
+ fix: string;
23
+ }>, args?: OutputOptions): string;
24
+ export declare function printFailure(failure: RelayError, jsonMode: boolean, args?: OutputOptions): void;
@@ -0,0 +1,6 @@
1
+ import { type Args } from './commands.js';
2
+ import { Failure } from './output.js';
3
+ export declare function usageFailure(message: string, command?: string, reason?: string): Failure;
4
+ export declare function unknownToken(kind: string, token: string, choices: string[], command?: string): Failure;
5
+ /** Parses argv against the command metadata, returning validated values or a usage failure. */
6
+ export declare function parseCommand(argv: string[], environment?: NodeJS.ProcessEnv): Args;