{"version":3,"file":"plugin.cjs","names":["spawn","promisify","exec","plugin"],"sources":["../../../utils/src/exec-helpers.ts","../src/plugin.ts"],"sourcesContent":["import { spawn, exec, type SpawnOptions } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nexport class ExecError extends Error {\n  constructor(\n    readonly exitCode: number,\n    readonly signal: NodeJS.Signals | null,\n    readonly data: string = 'command gave no output',\n  ) {\n    super(data);\n  }\n}\n\nexport function spawnAsyncHelper(\n  command: string,\n  args: Array<string>,\n  spawnOptions?: SpawnOptions,\n) {\n  const childProcess = spawn(command, args, spawnOptions || {});\n\n  const deferred = new Promise<string>((resolve, reject) => {\n    let stdoutData: string = '';\n    let stderrData: string = '';\n    childProcess.stdout?.on('data', (data) => {\n      stdoutData += data.toString();\n    });\n    childProcess.stderr?.on('data', (data) => {\n      stderrData += data.toString();\n    });\n    childProcess.stdout?.on('error', (err) => {\n      reject(err);\n    });\n    childProcess.stderr?.on('error', (err) => {\n      reject(err);\n    });\n    childProcess.on('error', (err) => {\n      reject(err);\n    });\n    childProcess.on('exit', (exitCode, signal) => {\n      if (!exitCode) {\n        resolve(stdoutData);\n      } else {\n        reject(\n          new ExecError(exitCode, signal, stderrData),\n        );\n      }\n    });\n  });\n\n  return { childProcess, execResult: deferred };\n}\n\nexport async function spawnAsync(\n  command: string,\n  args: Array<string>,\n  opts?: SpawnOptions & { input?: string },\n) {\n  const { input, ...spawnOpts } = opts ?? {};\n  const { childProcess, execResult } = spawnAsyncHelper(command, args, spawnOpts);\n  if (input !== undefined && childProcess.stdin) {\n    // A child that exits before reading its input (bad args, wrong cwd, ...) closes the pipe\n    // mid-write. Without a listener that EPIPE is an unhandled error event rather than a\n    // rejection, so it takes down the process. The exit code and stderr are the real signal\n    // here, and `execResult` already carries both.\n    childProcess.stdin.on('error', () => { /* swallowed on purpose - see above */ });\n    childProcess.stdin.write(input);\n    childProcess.stdin.end();\n  }\n  return execResult;\n}\n\nexport const asyncExec = promisify(exec);\n","import { type Resolver, plugin } from 'varlock/plugin-lib';\nimport { ExecError, spawnAsync } from '@env-spec/utils/exec-helpers';\n\nconst { ValidationError, SchemaError, ResolutionError } = plugin.ERRORS;\n\nconst PROTON_PASS_ICON = 'simple-icons:proton';\n\nplugin.name = 'proton-pass';\nconst { debug } = plugin;\ndebug('init - version =', plugin.version);\nplugin.icon = PROTON_PASS_ICON;\n\nplugin.standardVars = {\n  initDecorator: '@initProtonPass',\n  params: {\n    personalAccessToken: { key: 'PROTON_PASS_PERSONAL_ACCESS_TOKEN', dataType: 'protonPassPersonalAccessToken' },\n    password: { key: 'PROTON_PASS_PASSWORD', dataType: 'protonPassPassword' },\n    totp: { key: 'PROTON_PASS_TOTP', dataType: 'protonPassTotp' },\n    extraPassword: { key: 'PROTON_PASS_EXTRA_PASSWORD', dataType: 'protonPassExtraPassword' },\n  },\n};\n\nconst PASS_CLI_NOT_FOUND_TIP = [\n  'The `pass-cli` command was not found on your system.',\n  'Install it using Proton Pass CLI:',\n  '  curl -fsSL https://proton.me/download/pass-cli/install.sh | bash',\n].join('\\n');\n\nconst NOT_LOGGED_IN_TIP = [\n  'You are not authenticated with Proton Pass CLI.',\n  'Either:',\n  '  1) Run `pass-cli login` manually in your terminal, or',\n  '  2) Configure the plugin credentials via `@initProtonPass(...)`.',\n].join('\\n');\n\nconst LOGIN_HELP_TIP = [\n  'Proton Pass CLI login credentials are expected to be provided via:',\n  '  PROTON_PASS_PASSWORD',\n  '  PROTON_PASS_TOTP (if 2FA/TOTP is enabled)',\n  '  PROTON_PASS_EXTRA_PASSWORD (if your account requires an extra password)',\n  '',\n  'Or use a personal access token (recommended for CI):',\n  '  PROTON_PASS_PERSONAL_ACCESS_TOKEN',\n  'Create one with `pass-cli pat create --name <name> --expiration <1d|1w|1m|3m|6m|1y>`',\n  'and grant it access with `pass-cli pat access grant ...`.',\n].join('\\n');\n\nfunction getSecretFieldNameFromRef(secretRef: string): string | undefined {\n  // secretRef is expected to be pass://<vault>/<item>/<field>\n  if (!secretRef.startsWith('pass://')) return undefined;\n  const remainder = secretRef.substring('pass://'.length);\n  const parts = remainder.split('/');\n  if (parts.length < 3) return undefined;\n  return parts[parts.length - 1] || undefined;\n}\n\nfunction extractJsonFieldValue(\n  json: unknown,\n  fieldName: string,\n): string | undefined {\n  const visited = new Set<unknown>();\n\n  function walk(node: unknown): unknown {\n    if (node === null || node === undefined) return undefined;\n    if (typeof node !== 'object') return undefined;\n    if (visited.has(node)) return undefined;\n    visited.add(node);\n\n    const obj = node as Record<string, unknown>;\n    if (Object.prototype.hasOwnProperty.call(obj, fieldName)) {\n      return obj[fieldName];\n    }\n\n    // Try common nested structures\n    for (const key of ['fields', 'field', 'data', 'item', 'secret']) {\n      if (obj[key] !== undefined) {\n        const res = walk(obj[key]);\n        if (res !== undefined) return res;\n      }\n    }\n\n    // Fallback: try scanning one level deep for a match\n    for (const val of Object.values(obj)) {\n      const res = walk(val);\n      if (res !== undefined) return res;\n    }\n\n    return undefined;\n  }\n\n  const match = walk(json);\n  if (match === null || match === undefined) return undefined;\n  if (typeof match === 'string') return match;\n  if (typeof match === 'number' || typeof match === 'boolean') return String(match);\n  return undefined;\n}\n\nclass ProtonPassPluginInstance {\n  private static readonly BATCH_READ_TIMEOUT_MS = 50;\n\n  private username?: string;\n  private password?: string;\n  private totp?: string;\n  private extraPassword?: string;\n  private personalAccessToken?: string;\n\n  // Cache decrypted values for the current resolution session.\n  private cache = new Map<string, string>();\n\n  // Batch pending secret reads to reduce repeated interactive prompts.\n  private readBatch: Record<string, { deferredPromises: Array<{\n    resolve: (v: string) => void;\n    reject: (e: unknown) => void;\n  }> }> | undefined;\n\n  // Login batching / deduping for parallel resolutions.\n  private loginInFlight: Promise<void> | undefined;\n\n  constructor(readonly id: string) {}\n\n  configure(opts: {\n    username?: string;\n    password?: string;\n    totp?: string;\n    extraPassword?: string;\n    personalAccessToken?: string;\n  }) {\n    if (opts.username && typeof opts.username === 'string') this.username = opts.username;\n    if (opts.password && typeof opts.password === 'string') this.password = opts.password;\n    if (opts.totp && typeof opts.totp === 'string') this.totp = opts.totp;\n    if (opts.extraPassword && typeof opts.extraPassword === 'string') this.extraPassword = opts.extraPassword;\n    if (opts.personalAccessToken && typeof opts.personalAccessToken === 'string') {\n      this.personalAccessToken = opts.personalAccessToken;\n    }\n\n    debug('proton-pass instance', this.id, 'configured');\n  }\n\n  private get loginEnv(): Record<string, string> | undefined {\n    const env: Record<string, string> = {};\n    // A personal access token is a self-contained credential and does not need a username.\n    if (this.personalAccessToken) env.PROTON_PASS_PERSONAL_ACCESS_TOKEN = this.personalAccessToken;\n    if (this.password) env.PROTON_PASS_PASSWORD = this.password;\n    if (this.totp) env.PROTON_PASS_TOTP = this.totp;\n    if (this.extraPassword) env.PROTON_PASS_EXTRA_PASSWORD = this.extraPassword;\n\n    return Object.keys(env).length ? env : undefined;\n  }\n\n  private async ensureCliLoggedIn(): Promise<void> {\n    if (this.loginInFlight) {\n      await this.loginInFlight;\n      return;\n    }\n\n    this.loginInFlight = (async () => {\n      // Prefer a personal access token when configured — it is non-interactive,\n      // needs no username/password, and is the recommended path for CI.\n      // PATs have a fixed expiration (set at creation); when one expires the user\n      // mints a new token via `pass-cli pat renew` and updates their config — there\n      // is nothing for us to refresh or persist here.\n      if (this.personalAccessToken) {\n        debug('logging into proton pass via personal access token');\n        try {\n          await spawnAsync(\n            'pass-cli',\n            ['login'],\n            { env: { ...(process.env as Record<string, string>), ...this.loginEnv } },\n          );\n        } catch (loginErr) {\n          const loginMsg = loginErr instanceof ExecError ? (loginErr.data || loginErr.message) : String(loginErr);\n          throw new ResolutionError(`Proton Pass CLI login (personal access token) failed: ${loginMsg}`, {\n            tip: [\n              NOT_LOGGED_IN_TIP,\n              'The token may be invalid or expired — check with `pass-cli pat list` and renew if needed.',\n            ].join('\\n'),\n          });\n        }\n        return;\n      }\n\n      // Attempt login\n      if (!this.username) {\n        throw new ResolutionError('Proton Pass CLI not authenticated and no username configured', {\n          tip: [\n            NOT_LOGGED_IN_TIP,\n            'Initialize the plugin with a username: @initProtonPass(username=..., ...)',\n          ].join('\\n'),\n        });\n      }\n\n      if (!this.password) {\n        throw new ResolutionError('Proton Pass CLI not authenticated and no password configured', {\n          tip: [\n            NOT_LOGGED_IN_TIP,\n            LOGIN_HELP_TIP,\n            'Provide `password` via `@initProtonPass(password=...)` or set `PROTON_PASS_PASSWORD`.',\n          ].join('\\n'),\n        });\n      }\n\n      debug('logging into proton pass via `pass-cli login --interactive`');\n      try {\n        await spawnAsync(\n          'pass-cli',\n          ['login', '--interactive', this.username],\n          this.loginEnv ? { env: { ...(process.env as Record<string, string>), ...this.loginEnv } } : undefined,\n        );\n      } catch (loginErr) {\n        const loginMsg = loginErr instanceof ExecError ? (loginErr.data || loginErr.message) : String(loginErr);\n        throw new ResolutionError(`Proton Pass CLI login failed: ${loginMsg}`, {\n          tip: [\n            NOT_LOGGED_IN_TIP,\n            LOGIN_HELP_TIP,\n          ].join('\\n'),\n        });\n      }\n    })();\n\n    try {\n      await this.loginInFlight;\n    } finally {\n      this.loginInFlight = undefined;\n    }\n  }\n\n  private isAuthError(err: unknown): boolean {\n    if (!(err instanceof ExecError)) return false;\n    const errMsg = err.data || err.message;\n    const lower = errMsg.toLowerCase();\n    return [\n      'not logged',\n      'not authenticated',\n      'unauthorized',\n      'login required',\n      'authentication',\n      'session',\n    ].some((t) => lower.includes(t));\n  }\n\n  private async spawnWithAuthRetry(\n    args: Array<string>,\n    opts?: { env?: Record<string, string> },\n  ): Promise<string> {\n    try {\n      return await spawnAsync('pass-cli', args, opts);\n    } catch (err) {\n      if (err instanceof ExecError && (err as any).code === 'ENOENT') {\n        throw new ResolutionError('`pass-cli` command not found', {\n          tip: PASS_CLI_NOT_FOUND_TIP,\n        });\n      }\n\n      if (!this.isAuthError(err)) throw err;\n\n      debug('pass-cli command requires auth, attempting login and retry', args.join(' '));\n      await this.ensureCliLoggedIn();\n\n      return spawnAsync('pass-cli', args, opts);\n    }\n  }\n\n  private async getSecretDirect(secretRef: string): Promise<string> {\n    const cached = this.cache.get(secretRef);\n    if (cached !== undefined) return cached;\n\n    const fieldName = getSecretFieldNameFromRef(secretRef);\n    if (!fieldName) {\n      throw new ResolutionError(`Invalid secret reference (missing field): ${secretRef}`);\n    }\n\n    debug('fetching proton pass secret via item view', secretRef);\n    const result = await this.spawnWithAuthRetry(\n      ['item', 'view', '--output', 'json', secretRef],\n    );\n    const cliStdout = result.trim();\n\n    // Parse JSON output as best-effort.\n    try {\n      const parsed = JSON.parse(cliStdout);\n      const extracted = extractJsonFieldValue(parsed, fieldName);\n      if (extracted === undefined) {\n        // If `pass-cli` printed just the field value, fall back to stringification.\n        if (typeof parsed === 'string') return parsed;\n        throw new ResolutionError(\n          `Proton Pass field \"${fieldName}\" not found in CLI output`,\n          { tip: 'Try running the equivalent command manually to inspect the output shape.' },\n        );\n      }\n      this.cache.set(secretRef, extracted);\n      return extracted;\n    } catch (e) {\n      // Not JSON? Fall back to returning stdout.\n      const plain = cliStdout.trim();\n      if (!plain) {\n        throw new ResolutionError(`Proton Pass secret \"${secretRef}\" resolved to empty output`);\n      }\n      this.cache.set(secretRef, plain);\n      return plain;\n    }\n  }\n\n  private async executeReadBatch(\n    batchToExecute: NonNullable<ProtonPassPluginInstance['readBatch']>,\n  ): Promise<void> {\n    const batchSecretRefs = Object.keys(batchToExecute);\n    debug('executing proton pass batch read', batchSecretRefs);\n    try {\n      const envMap: Record<string, string> = {};\n      let i = 1;\n      for (const secretRef of batchSecretRefs) {\n        envMap[`VARLOCK_PROTON_PASS_INJECT_${i++}`] = secretRef;\n      }\n\n      const result = await this.spawnWithAuthRetry(\n        ['run', '--no-masking', '--', 'env', '-0'],\n        {\n          env: {\n            ...(process.env as Record<string, string>),\n            ...(this.loginEnv || {}),\n            ...envMap,\n          },\n        },\n      );\n\n      const unresolvedRefs = new Set(batchSecretRefs);\n      const lines = result.split('\\0');\n      for (const line of lines) {\n        const eqPos = line.indexOf('=');\n        if (eqPos <= 0) continue;\n        const key = line.substring(0, eqPos);\n        const secretRef = envMap[key];\n        if (!secretRef) continue;\n\n        const val = line.substring(eqPos + 1);\n        unresolvedRefs.delete(secretRef);\n        this.cache.set(secretRef, val);\n        batchToExecute[secretRef].deferredPromises.forEach((p) => p.resolve(val));\n      }\n\n      // Any unresolved refs are retried individually to preserve useful per-secret errors.\n      if (unresolvedRefs.size) {\n        debug('batch did not resolve all refs, retrying direct reads', [...unresolvedRefs]);\n        await Promise.all([...unresolvedRefs].map(async (secretRef) => {\n          try {\n            const val = await this.getSecretDirect(secretRef);\n            batchToExecute[secretRef].deferredPromises.forEach((p) => p.resolve(val));\n          } catch (err) {\n            batchToExecute[secretRef].deferredPromises.forEach((p) => p.reject(err));\n          }\n        }));\n      }\n    } catch (err) {\n      // Retry each ref individually on batch failure so allowMissing + per-ref errors still work.\n      debug('proton pass batch read failed, retrying per-ref', err instanceof Error ? err.message : String(err));\n      await Promise.all(batchSecretRefs.map(async (secretRef) => {\n        try {\n          const val = await this.getSecretDirect(secretRef);\n          batchToExecute[secretRef].deferredPromises.forEach((p) => p.resolve(val));\n        } catch (refErr) {\n          batchToExecute[secretRef].deferredPromises.forEach((p) => p.reject(refErr));\n        }\n      }));\n    }\n  }\n\n  async getSecret(secretRef: string): Promise<string> {\n    const cached = this.cache.get(secretRef);\n    if (cached !== undefined) return cached;\n\n    let shouldExecuteBatch = false;\n    if (!this.readBatch) {\n      this.readBatch = {};\n      shouldExecuteBatch = true;\n    }\n    this.readBatch[secretRef] ||= { deferredPromises: [] };\n\n    const deferred = {} as {\n      promise: Promise<string>;\n      resolve: (value: string) => void;\n      reject: (error: unknown) => void;\n    };\n    deferred.promise = new Promise<string>((resolve, reject) => {\n      deferred.resolve = resolve;\n      deferred.reject = reject;\n    });\n    this.readBatch[secretRef].deferredPromises.push({\n      resolve: deferred.resolve,\n      reject: deferred.reject,\n    });\n\n    if (shouldExecuteBatch) {\n      setTimeout(async () => {\n        if (!this.readBatch) return;\n        const batchToExecute = this.readBatch;\n        this.readBatch = undefined;\n        await this.executeReadBatch(batchToExecute);\n      }, ProtonPassPluginInstance.BATCH_READ_TIMEOUT_MS);\n    }\n\n    return deferred.promise;\n  }\n}\n\nconst pluginInstances: Record<string, ProtonPassPluginInstance> = {};\n\nplugin.registerDataType({\n  name: 'protonPassSecretRef',\n  sensitive: false,\n  typeDescription: 'Proton Pass secret reference in the format `pass://vault/item/field`',\n  icon: PROTON_PASS_ICON,\n  docs: [\n    {\n      description: 'Secret reference syntax for Proton Pass CLI',\n      url: 'https://protonpass.github.io/pass-cli/commands/contents/secret-references/',\n    },\n  ],\n  async validate(val) {\n    if (typeof val !== 'string') throw new ValidationError('Secret reference must be a string');\n    if (!val.startsWith('pass://')) throw new ValidationError('Secret reference must start with `pass://`');\n\n    const remainder = val.substring('pass://'.length);\n    const parts = remainder.split('/');\n    if (parts.length !== 3 || parts.some((p) => !p.trim())) {\n      throw new ValidationError('Secret reference must be in format `pass://<vault>/<item>/<field>` (exactly 3 components)');\n    }\n  },\n});\n\nplugin.registerDataType({\n  name: 'protonPassPassword',\n  sensitive: true,\n  internal: true,\n  typeDescription: 'Proton Pass account password used by `pass-cli login --interactive`',\n  icon: PROTON_PASS_ICON,\n  docs: [\n    {\n      description: 'Proton Pass CLI login',\n      url: 'https://protonpass.github.io/pass-cli/commands/login/',\n    },\n  ],\n  async validate(val): Promise<true> {\n    if (!val || typeof val !== 'string') throw new ValidationError('Password must be a non-empty string');\n    return true;\n  },\n});\n\nplugin.registerDataType({\n  name: 'protonPassTotp',\n  sensitive: true,\n  internal: true,\n  typeDescription: 'Proton Pass TOTP code used by `pass-cli login --interactive` (if 2FA is enabled)',\n  icon: PROTON_PASS_ICON,\n  async validate(val): Promise<true> {\n    if (!val || typeof val !== 'string') throw new ValidationError('TOTP must be a non-empty string');\n    if (!/^[0-9]{6,8}$/.test(val.trim())) throw new ValidationError('TOTP should be 6-8 digits');\n    return true;\n  },\n});\n\nplugin.registerDataType({\n  name: 'protonPassExtraPassword',\n  sensitive: true,\n  internal: true,\n  typeDescription: 'Proton Pass extra password used by `pass-cli login --interactive` (if required by your account)',\n  icon: PROTON_PASS_ICON,\n  async validate(val): Promise<true> {\n    if (!val || typeof val !== 'string') throw new ValidationError('Extra password must be a non-empty string');\n    return true;\n  },\n});\n\nplugin.registerDataType({\n  name: 'protonPassPersonalAccessToken',\n  sensitive: true,\n  internal: true,\n  typeDescription: 'Proton Pass personal access token used by `pass-cli login` (non-interactive, recommended for CI)',\n  icon: PROTON_PASS_ICON,\n  docs: [\n    {\n      description: 'Proton Pass CLI personal access token login',\n      url: 'https://protonpass.github.io/pass-cli/commands/login/#personal-access-token-login',\n    },\n  ],\n  async validate(val): Promise<true> {\n    if (!val || typeof val !== 'string') throw new ValidationError('Personal access token must be a non-empty string');\n    // Tokens are issued in the shape `pst_xxxx...xxxx::TOKENKEY`.\n    if (!val.includes('::')) {\n      throw new ValidationError('Personal access token looks malformed - expected `pst_...::TOKENKEY`');\n    }\n    return true;\n  },\n});\n\nplugin.registerRootDecorator({\n  name: 'initProtonPass',\n  description: 'Initialize a Proton Pass plugin instance for protonPass() resolver',\n  isFunction: true,\n  async process(argsVal) {\n    const objArgs = argsVal.objArgs;\n    // Allow `@initProtonPass()` with no key-value args (same pattern as `@initPass()`):\n    // default instance id is `_default` and credentials are optional if `pass-cli` is already logged in.\n\n    if (objArgs?.id && !objArgs.id.isStatic) {\n      throw new SchemaError('Expected id to be a static value');\n    }\n    const id = String(objArgs?.id?.staticValue || '_default');\n\n    if (pluginInstances[id]) {\n      throw new SchemaError(`Instance with id \"${id}\" already initialized`);\n    }\n\n    pluginInstances[id] = new ProtonPassPluginInstance(id);\n\n    // These are resolver children - they may be computed from env flags.\n    return {\n      id,\n      usernameResolver: objArgs?.username,\n      passwordResolver: objArgs?.password,\n      totpResolver: objArgs?.totp,\n      extraPasswordResolver: objArgs?.extraPassword,\n      personalAccessTokenResolver: objArgs?.personalAccessToken,\n    };\n  },\n  async execute({\n    id, usernameResolver, passwordResolver, totpResolver, extraPasswordResolver, personalAccessTokenResolver,\n  }) {\n    const username = await usernameResolver?.resolve();\n    const password = await passwordResolver?.resolve();\n    const totp = await totpResolver?.resolve();\n    const extraPassword = await extraPasswordResolver?.resolve();\n    const personalAccessToken = await personalAccessTokenResolver?.resolve();\n\n    pluginInstances[id].configure({\n      username: typeof username === 'string' ? username : undefined,\n      password: typeof password === 'string' ? password : undefined,\n      totp: typeof totp === 'string' ? totp : undefined,\n      extraPassword: typeof extraPassword === 'string' ? extraPassword : undefined,\n      personalAccessToken: typeof personalAccessToken === 'string' ? personalAccessToken : undefined,\n    });\n  },\n});\n\nplugin.registerResolverFunction({\n  name: 'protonPass',\n  label: 'Fetch secret from Proton Pass',\n  icon: PROTON_PASS_ICON,\n  argsSchema: {\n    type: 'mixed',\n    arrayMinLength: 1,\n    arrayMaxLength: 2,\n  },\n  process() {\n    let instanceId = '_default';\n    let secretRefResolver: Resolver | undefined;\n    const allowMissingResolver = this.objArgs?.allowMissing;\n\n    if (!this.arrArgs) throw new SchemaError('Expected args');\n    const argCount = this.arrArgs.length;\n\n    if (argCount === 1) {\n      secretRefResolver = this.arrArgs[0];\n    } else if (argCount === 2) {\n      if (!this.arrArgs[0].isStatic) {\n        throw new SchemaError('Expected instance id (first argument) to be a static value');\n      }\n      instanceId = String(this.arrArgs[0].staticValue);\n      secretRefResolver = this.arrArgs[1];\n    } else {\n      throw new SchemaError('Expected 1 or 2 arguments');\n    }\n\n    if (!Object.values(pluginInstances).length) {\n      throw new SchemaError('No Proton Pass plugin instances found', {\n        tip: 'Initialize at least one Proton Pass plugin instance using the @initProtonPass root decorator',\n      });\n    }\n\n    const selectedInstance = pluginInstances[instanceId];\n    if (!selectedInstance) {\n      if (instanceId === '_default') {\n        throw new SchemaError('Proton Pass plugin instance (without id) not found', {\n          tip: [\n            'Either remove the `id` param from your @initProtonPass call',\n            'or use `protonPass(id, secretRef)` to select an instance by id',\n            `Available ids: ${Object.keys(pluginInstances).join(', ')}`,\n          ].join('\\n'),\n        });\n      } else {\n        throw new SchemaError(`Proton Pass plugin instance id \"${instanceId}\" not found`, {\n          tip: `Valid ids are: ${Object.keys(pluginInstances).join(', ')}`,\n        });\n      }\n    }\n\n    return { instanceId, secretRefResolver, allowMissingResolver };\n  },\n  async resolve({ instanceId, secretRefResolver, allowMissingResolver }) {\n    const selectedInstance = pluginInstances[instanceId];\n\n    if (!secretRefResolver) {\n      throw new SchemaError('Expected a Proton Pass secret reference argument');\n    }\n    const secretRef = await secretRefResolver.resolve();\n    if (typeof secretRef !== 'string') {\n      throw new SchemaError('Expected secretRef to resolve to a string');\n    }\n\n    let allowMissing = false;\n    if (allowMissingResolver) {\n      const resolved = await allowMissingResolver.resolve();\n      allowMissing = resolved === true || resolved === 'true';\n    }\n\n    try {\n      return await selectedInstance.getSecret(secretRef);\n    } catch (err) {\n      if (allowMissing) {\n        if (err instanceof ExecError) {\n          const msg = err.data || err.message;\n          if (msg.toLowerCase().includes('not found') || msg.toLowerCase().includes('field not found')) return '';\n        }\n        if (err instanceof ResolutionError && err.message.toLowerCase().includes('not found')) return '';\n      }\n\n      if (err instanceof ExecError && (err as any).code === 'ENOENT') {\n        throw new ResolutionError('`pass-cli` command not found', { tip: PASS_CLI_NOT_FOUND_TIP });\n      }\n\n      if (err instanceof ExecError) {\n        const errMsg = err.data || err.message;\n        const lower = errMsg.toLowerCase();\n        if (lower.includes('not logged') || lower.includes('not authenticated') || lower.includes('unauthorized') || lower.includes('login')) {\n          throw new ResolutionError('Proton Pass CLI not authenticated', { tip: NOT_LOGGED_IN_TIP });\n        }\n\n        if (lower.includes('not found')) {\n          throw new ResolutionError('Proton Pass secret not found', {\n            tip: [\n              'Verify your `pass://vault/item/field` reference is correct:',\n              '  - pass-cli vault list',\n              '  - pass-cli item list --share-id <vault-share-id>',\n              '  - pass-cli item view --share-id <share-id> --item-id <item-id>',\n            ].join('\\n'),\n          });\n        }\n\n        throw new ResolutionError(`Failed to fetch Proton Pass secret: ${errMsg}`);\n      }\n\n      if (err instanceof ResolutionError) throw err;\n      throw new ResolutionError(`Failed to fetch Proton Pass secret: ${err instanceof Error ? err.message : String(err)}`);\n    }\n  },\n});\n\n// Anonymous, non-sensitive usage signals. Strictly sanitized before send.\nplugin.registerTelemetryAttributes(() => {\n  const instances = Object.values(pluginInstances);\n  return {\n    // standard attributes\n    instance_count: instances.length,\n  };\n});\n"],"mappings":";;;;AAGA,IAAa,YAAb,cAA+B,MAAM;CAExB;CACA;CACA;CAHX,YACE,UACA,QACA,OAAwB,0BACxB;EACA,MAAM,IAAI;EAJD,KAAA,WAAA;EACA,KAAA,SAAA;EACA,KAAA,OAAA;CAGX;AACF;AAEA,SAAgB,iBACd,SACA,MACA,cACA;CACA,MAAM,gBAAA,GAAeA,mBAAAA,MAAAA,CAAM,SAAS,MAAM,gBAAgB,CAAC,CAAC;CA+B5D,OAAO;EAAE;EAAc,YAAY,IA7Bd,SAAiB,SAAS,WAAW;GACxD,IAAI,aAAqB;GACzB,IAAI,aAAqB;GACzB,aAAa,QAAQ,GAAG,SAAS,SAAS;IACxC,cAAc,KAAK,SAAS;GAC9B,CAAC;GACD,aAAa,QAAQ,GAAG,SAAS,SAAS;IACxC,cAAc,KAAK,SAAS;GAC9B,CAAC;GACD,aAAa,QAAQ,GAAG,UAAU,QAAQ;IACxC,OAAO,GAAG;GACZ,CAAC;GACD,aAAa,QAAQ,GAAG,UAAU,QAAQ;IACxC,OAAO,GAAG;GACZ,CAAC;GACD,aAAa,GAAG,UAAU,QAAQ;IAChC,OAAO,GAAG;GACZ,CAAC;GACD,aAAa,GAAG,SAAS,UAAU,WAAW;IAC5C,IAAI,CAAC,UACH,QAAQ,UAAU;SAElB,OACE,IAAI,UAAU,UAAU,QAAQ,UAAU,CAC5C;GAEJ,CAAC;EACH,CAE0C;CAAE;AAC9C;AAEA,eAAsB,WACpB,SACA,MACA,MACA;CACA,MAAM,EAAE,OAAO,GAAG,cAAc,QAAQ,CAAC;CACzC,MAAM,EAAE,cAAc,eAAe,iBAAiB,SA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