Polyman Documentation - v3.1.0
    Preparing search index...

    Reads and writes ~/.polyman/ai.json.

    Index
    dir: string

    The .polyman folder.

    path: string

    The ai.json file.

    env: ProcessEnv
    • Writes the settings. It creates the folder with mode 0700 when it is missing, writes a temp file with mode 0600, then renames it, so a crash never leaves a half-written file.

      Parameters

      Returns void

    • The mode of the .polyman folder when it already exists and group or others have any permission on it (mode & 0o077), so the caller can warn. Returns undefined when the folder is missing or private, and always on Windows, where modes mean nothing. It never changes the mode.

      Returns number | undefined

    • Removes a saved key. Returns false when there was none.

      Parameters

      • providerId: string

      Returns boolean

    • Sets the default provider and model.

      Parameters

      • provider: string
      • model: string

      Returns void

    • The base URL keys of this provider may go to: the preset one, or the one saved for custom.

      Parameters

      • providerId: string

      Returns string | undefined

    • The key to send with a request to url. It throws when url is not under the base URL of the provider, so a key never goes to another server. Returns undefined when the provider has no key.

      Parameters

      • providerId: string
      • url: string

      Returns string | undefined