import { Effect, Schema } from "effect"; import { StorageError, type Owner, type PluginCtx, type PluginBlobStore, type StorageFailure } from "@executor-js/sdk/core"; import { OnePasswordAccount, OnePasswordAuth, OnePasswordConfig, RedactedOnePasswordConfig } from "./types"; import { OnePasswordError } from "./errors"; import { type OnePasswordService } from "./service"; export declare const OnePasswordAccountUpsert: Schema.Struct<{ readonly id: Schema.optional; readonly name: Schema.String; readonly auth: Schema.Union; readonly accountName: Schema.String; }>, Schema.Struct<{ readonly kind: Schema.Literal<"service-account">; readonly token: Schema.String; }>]>; readonly vaults: Schema.NonEmptyArray>; }>; export type OnePasswordAccountUpsert = typeof OnePasswordAccountUpsert.Type; export type OnePasswordExtensionFailure = OnePasswordError | StorageFailure; export interface OnePasswordStore { readonly getConfig: () => Effect.Effect; readonly saveConfig: (config: OnePasswordConfig, owner: Owner) => Effect.Effect; readonly deleteConfig: (owner: Owner) => Effect.Effect; } export declare const makeOnePasswordStore: (blobs: PluginBlobStore) => OnePasswordStore; /** One service per auth identity, memoized for the plugin instance's * lifetime. Keying by the resolved auth keeps accounts isolated (a shared * client can never leak one account's credential into another's calls) while * reusing the constructed service — and with it the SDK backend's cached * client — across calls instead of re-authenticating per resolution. * Construction failures are not retained, so a transient backend problem * does not poison the account until restart. */ export declare const makeServiceForAuth: (timeoutMs: number, preferSdk: boolean | undefined) => ((auth: OnePasswordAuth) => Effect.Effect); type ServiceForAccount = (account: OnePasswordAccount) => Effect.Effect; export type RefResolution = { readonly kind: "resolved"; readonly value: string; } | { readonly kind: "not-found"; } | { readonly kind: "outside-vaults"; } | { readonly kind: "ambiguous"; readonly matches: readonly { readonly accountName: string; readonly vaultId: string; readonly vaultName: string; readonly itemId: string; readonly itemTitle: string; }[]; } | { readonly kind: "ambiguous-vault"; readonly vaultName: string; readonly matches: readonly { readonly accountName: string; readonly vaultId: string; }[]; }; export declare const ambiguityMessage: (ref: string, matches: Extract["matches"]) => string; export declare const vaultAmbiguityMessage: (resolution: Extract) => string; /** Resolve a ref against every configured account. Backend failures stay on * the error channel; every addressing outcome is an explicit * `RefResolution`. Services are built per account and only for the accounts * a ref actually needs. */ export declare const resolveConfiguredRef: (config: OnePasswordConfig, serviceFor: (account: OnePasswordAccount) => Effect.Effect, ref: string) => Effect.Effect; export type CachedRefResolver = (config: OnePasswordConfig, ref: string) => Effect.Effect; export declare const makeCachedRefResolver: (serviceFor: ServiceForAccount, ttlMs: number) => CachedRefResolver; declare const makeOnePasswordExtension: (ctx: PluginCtx, serviceForAuth: (auth: OnePasswordAuth) => Effect.Effect) => { /** Add or replace one account. A payload without an id creates a new * account; with an id it replaces the matching account in place. */ configure: (upsert: OnePasswordAccountUpsert) => Effect.Effect<{ readonly accountId: string; }, StorageError | OnePasswordError>; getConfig: () => Effect.Effect; /** Remove one account by id, or the whole configuration when no id is * given. Removing the last account deletes the blob. */ removeConfig: (accountId?: string) => Effect.Effect; status: () => Effect.Effect<{ readonly connected: boolean; readonly accounts: readonly { readonly id: string; readonly name: string; readonly connected: boolean; readonly error?: string | undefined; readonly vaultNames?: readonly string[] | undefined; }[]; readonly error?: string | undefined; }, StorageError | OnePasswordError, never>; listVaults: (auth: OnePasswordAuth) => Effect.Effect<{ readonly id: string; readonly name: string; }[], OnePasswordError, never>; resolve: (uri: string) => Effect.Effect; }; export type OnePasswordExtension = ReturnType; export interface OnePasswordPluginOptions { /** Request timeout in ms (default: 15000) */ readonly timeoutMs?: number; /** Force use of the native SDK instead of the CLI (default: false) */ readonly preferSdk?: boolean; /** How long a successfully resolved secret may be served from memory * before 1Password is asked again (default: 60000). `0` disables reuse * while still collapsing concurrent resolutions of the same ref onto one * backend read. */ readonly secretCacheTtlMs?: number; } export declare const onepasswordPlugin: import("@executor-js/sdk/core").ConfiguredPlugin<"onepassword", { /** Add or replace one account. A payload without an id creates a new * account; with an id it replaces the matching account in place. */ configure: (upsert: OnePasswordAccountUpsert) => Effect.Effect<{ readonly accountId: string; }, StorageError | OnePasswordError>; getConfig: () => Effect.Effect; /** Remove one account by id, or the whole configuration when no id is * given. Removing the last account deletes the blob. */ removeConfig: (accountId?: string) => Effect.Effect; status: () => Effect.Effect<{ readonly connected: boolean; readonly accounts: readonly { readonly id: string; readonly name: string; readonly connected: boolean; readonly error?: string | undefined; readonly vaultNames?: readonly string[] | undefined; }[]; readonly error?: string | undefined; }, StorageError | OnePasswordError, never>; listVaults: (auth: OnePasswordAuth) => Effect.Effect<{ readonly id: string; readonly name: string; }[], OnePasswordError, never>; resolve: (uri: string) => Effect.Effect; }, OnePasswordStore, OnePasswordPluginOptions, undefined, import("effect/Layer").Layer, import("effect/unstable/httpapi/HttpApiGroup").Any>; export {};