import { CommandArgument, CommandResult } from '../../utils/types.js'; import { SessionAwareCLICommand } from './sessionAwareCommand.js'; /** * Command to run a server-side script on the authenticated instance, like the * Scripts - Background page (SDK v4.14.0+ `now-sdk exec`). * * The script runs with the authenticated user's full permissions (the instance * requires the admin role), so the tool is annotated destructive and * non-idempotent. To keep every run deliberate and traceable: * - `scope` is required, so the CLI never falls back to the nearest * `now.config.json` above the cwd (its default when `--scope` is absent); * - `reason` is required and recorded with the run; * - the script is passed inline, or as a `.js` `file` that must resolve (after * symlinks) inside the Fluent project directory — never an arbitrary local * path, which would upload any readable file to the instance — and never on * stdin. A file is copied to a private temp file that the CLI reads, so the * result identifies the exact source supplied even if execution is uncertain; * - recording for rollback stays on (the CLI default) and cannot be disabled; * - output is always the JSON envelope, and `select` is applied by the tool to a * successful run only, so a failed run keeps the full failure envelope (and * any unconfirmed outcome carries a no-retry history warning). * * The CLI's `--timeout` only stops the client from waiting: the script keeps * running on the instance, so a timed-out or cancelled run is reported as * possibly still running and must never be retried automatically. A script * that ran and threw is flagged the same way: it may already have changed records. */ export declare class ExecScriptCommand extends SessionAwareCLICommand { name: string; description: string; annotations: { destructiveHint: boolean; idempotentHint: boolean; openWorldHint: boolean; }; timeoutMs: number; protected readonly requiresProject = false; arguments: CommandArgument[]; /** * Validate what the schema cannot express: exactly one of script or file, the * file extension, the script's length and first character, a non-empty reason, * and the timeout bound. The schema has already checked `scope` and `select` * against their domains, the script for control characters other than line * formatting, and `reason` and `file` for any control character (a newline in * `reason` would end the `// now-sdk exec:` comment the CLI writes it into). */ protected validateArgs(args: Record): void; /** The inline script: non-empty, bounded, not parseable as a CLI option. */ private validateScriptText; /** * Resolve `file` inside the Fluent project and read it once. The project * directory and the file are both resolved through symlinks before the * containment check, so neither a `..` path nor a link can reach outside it. * @throws Error naming the exact problem (no project, outside it, not a file, too large, empty) */ private readScriptFile; /** The runner budget: the static default, extended past a caller-raised CLI wait. */ protected resolveTimeoutMs(args: Record): number; execute(args: Record, signal?: AbortSignal): Promise; /** Write the script to an owner-only file in a fresh private directory. */ private writePrivateCopy; private runExec; } //# sourceMappingURL=execScriptCommand.d.ts.map