import { spawnSync } from "node:child_process"; import { Vault } from "@theholocron/cli"; //#region src/auth.d.ts declare class AuthError extends Error { name: string; } interface VerifyInput { /** Override the spawn function in tests. */ spawn?: typeof spawnSync; /** Path to the op binary. Defaults to "op". */ binary?: string; } declare function verifyOpInstalled(input?: VerifyInput): void; //#endregion //#region src/shell.d.ts interface OpResult { ok: boolean; stdout: string; stderr: string; } interface OpShellOptions { /** Override the spawn function in tests. */ spawn?: typeof spawnSync; /** Path to the op binary. Defaults to "op". */ binary?: string; /** 1Password account UUID. When set, passed as `--account` on every call. */ account?: string; } interface RunOptions { /** Skip `--account` injection for commands that operate above the account level (e.g., `account list`). */ skipAccount?: boolean; } declare class OpShell { private readonly spawnImpl; readonly binary: string; readonly account?: string; constructor(opts?: OpShellOptions); /** Run `op `, returning a uniform result. */ run(args: string[], opts?: RunOptions): OpResult; /** Run + throw if non-zero. Mirrors REST clients' `request` ergonomic. */ runOrThrow(args: string[], context: string, opts?: RunOptions): string; } //#endregion //#region src/capabilities/vault.d.ts interface OpVaultOptions { /** 1P vault name items live in. Required — list/write default here. */ vault: string; } declare class OpVault implements Vault { private readonly shell; readonly key: "vault"; readonly providerName = "1password"; private readonly vaultName; constructor(shell: OpShell, opts: OpVaultOptions); read(reference: string): Promise; write(reference: string, value: string): Promise; list(): Promise; environments(): Promise; readEnvironment(environmentId: string): Promise>; } //#endregion //#region src/verify-token.d.ts interface VerifyTokenSuccess { ok: true; subject: string; } interface VerifyTokenFailure { ok: false; message: string; } type VerifyTokenResult = VerifyTokenSuccess | VerifyTokenFailure; interface VerifyTokenOptions { spawn?: typeof spawnSync; binary?: string; } declare function verifyToken(_token: string, opts?: VerifyTokenOptions): Promise; //#endregion //#region src/index.d.ts interface OpPluginOptions extends VerifyInput { /** 1P vault name items live in. Required. */ vault: string; /** Optional 1P account UUID; passed as `--account` on every op call. */ account?: string; } interface PluginContext { options: OpPluginOptions; shell: OpShell; } declare function createContext(options: OpPluginOptions): PluginContext; declare function vault(ctx: PluginContext): Vault; declare function createPlugin(options: OpPluginOptions): { name: string; capabilities: { vault: () => Vault; }; }; /** * One-line hint printed by `holocron auth set 1password` — 1P doesn't * store a token in the holocron keyring; the `op` CLI manages its own * auth. Directs the operator to the two paths that actually work. */ declare const AUTH_HINT: string; //#endregion export { AUTH_HINT, AuthError, OpPluginOptions, OpShell, OpVault, PluginContext, VerifyInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createContext, createPlugin, vault, verifyOpInstalled, verifyToken };