/** * The one place the backend's own API address comes from. * * Agents (`CREWLY_API_URL` in their PTY env), the in-process crewly-agent * runtime, skills spawned by the server, and the server's own * server-to-server calls (reconciler wake, auto-claim, dispatch writes) all * need to reach THIS instance. They used to hard-code * `WEB_CONSTANTS.PORTS.BACKEND` (8787), so an instance started with * `crewly start -p 8797` handed its agents the default port and every skill * call went to the wrong server — or to another Crewly on 8787 (#777). * * The server records its resolved listen port at construction * ({@link setLocalApiPort}); everything else asks {@link getLocalApiPort} / * {@link getLocalApiBaseUrl}. Before that (tests, scripts) the accessor * falls back to `WEB_PORT`, then the default. * * `CREWLY_API_URL` in the backend's OWN environment is deliberately NOT * consulted: a backend launched from inside an agent shell inherits that * agent's URL, which points at a different instance. * * @module utils/local-api-url */ /** * Parse a port value, rejecting anything that is not an integer in 1..65535. * * @param value - Candidate port (number or numeric string) * @returns The port, or null when invalid */ export declare function parsePort(value: unknown): number | null; /** * Record the port this server listens on. Called once by the server with its * resolved `webPort` (from `-p` / `WEB_PORT` / default). * * @param port - The listen port * @throws {Error} When the port is not a valid TCP port */ export declare function setLocalApiPort(port: number): void; /** * The port this Crewly instance's API is served on. * * @returns The recorded running port, else a valid `WEB_PORT`, else the default */ export declare function getLocalApiPort(): number; /** * Base URL of this instance's API, e.g. `http://localhost:8797` — the value * agents receive as `CREWLY_API_URL`. Paths are appended by the caller * (`${getLocalApiBaseUrl()}/api/teams`). * * @returns The base URL without a trailing slash */ export declare function getLocalApiBaseUrl(): string; /** * Forget the recorded port (tests only). */ export declare function resetLocalApiPortForTesting(): void; //# sourceMappingURL=local-api-url.utils.d.ts.map