npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opencode-bedrock-sso

v0.1.0

Published

OpenCode plugin that runs aws sso login before Bedrock requests when the AWS session has expired.

Readme

opencode-bedrock-sso

OpenCode plugin that checks AWS credentials before Amazon Bedrock requests and runs aws sso login when the current AWS SSO session has expired.

Why

Without this plugin, the annoying flow is:

  1. Send an OpenCode message.
  2. Wait for Bedrock to fail because the AWS session expired.
  3. Leave OpenCode and run aws sso login.
  4. Restart or resume OpenCode.

This plugin moves the check before the Bedrock request.

Install

Add the plugin to opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "amazon-bedrock": {
      "options": {
        "profile": "bedrock",
        "region": "us-east-1"
      }
    }
  },
  "plugin": [
    ["opencode-bedrock-sso@latest", { "profile": "bedrock", "region": "us-east-1" }]
  ]
}

Restart OpenCode after changing plugin config.

Requirements

  • OpenCode with Amazon Bedrock configured as a provider.
  • AWS CLI v2 available on PATH as aws, unless awsCommand is configured.
  • An AWS SSO profile configured in ~/.aws/config.

Options

type Options = {
  providerID?: string
  profile?: string
  region?: string
  awsCommand?: string
  checkCommand?: string[]
  loginCommand?: string[]
  loginTimeoutMs?: number
  checkTimeoutMs?: number
  minCheckIntervalMs?: number
  loginStdio?: "pipe" | "inherit"
  force?: boolean
}

Defaults:

  • providerID: amazon-bedrock
  • awsCommand: aws
  • region: us-east-1
  • checkCommand: sts get-caller-identity --profile <profile> --output json
  • loginCommand: sso login --profile <profile>
  • loginStdio: pipe
  • checkTimeoutMs: 30000
  • loginTimeoutMs: 600000
  • minCheckIntervalMs: 300000

Profile resolution order:

  1. Plugin option profile
  2. provider.amazon-bedrock.options.profile
  3. AWS_PROFILE

Region resolution order:

  1. Plugin option region
  2. provider.amazon-bedrock.options.region
  3. AWS_REGION
  4. us-east-1

Behavior

For each Bedrock chat request, the plugin runs aws sts get-caller-identity unless the same profile/region already passed a check within minCheckIntervalMs. Concurrent requests for the same profile/region share one in-flight check or login attempt.

When the check fails, it runs aws sso login with piped output so AWS CLI messages do not corrupt the OpenCode TUI. After login, it verifies credentials again before allowing the Bedrock request through.

If your environment does not open the browser automatically and you need to see AWS CLI's device-code URL in the terminal, opt into inherited output:

{
  "plugin": [
    ["opencode-bedrock-sso@latest", { "profile": "bedrock", "loginStdio": "inherit" }]
  ]
}

The plugin shows temporary OpenCode TUI toasts for login state changes:

  • AWS session expired and login is starting. This toast lasts for loginTimeoutMs so the waiting state stays visible.
  • Bedrock request is paused while waiting for AWS SSO login to complete. This toast also lasts for loginTimeoutMs.
  • AWS session refreshed and the Bedrock request is continuing
  • Login/check failed

Healthy preflight checks stay silent.

The plugin intentionally no-ops when these non-SSO credential sources are present:

  • AWS_BEARER_TOKEN_BEDROCK
  • AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  • ECS container credential environment variables
  • Web identity environment variables

Limitations

  • aws sso login runs inside the OpenCode process. By default its output is captured to avoid disturbing the TUI.
  • A profile is required for the default login command. Set plugin option profile, Bedrock provider option profile, or AWS_PROFILE.
  • This is a preflight plugin, not a provider retry plugin. If Bedrock fails for non-auth reasons, OpenCode still surfaces the provider error.

Local Development

Build the plugin locally:

npm install
npm run build

Then load the local build from opencode.json:

{
  "plugin": [
    ["/path/to/opencode-bedrock-sso/dist/index.js", { "profile": "bedrock" }]
  ]
}