omp packages

omp-kiro1.2.6

Kiro OAuth, credits usage, model discovery, and streaming runtime for Oh My Pi.

fanbaoyu1024 Published 1 month ago MIT ~241 downloads/mo

Built for omp

The author tagged this package omp-plugin.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

omp-kiro

Kiro (AWS) provider plugin for Oh My Pi (omp), reusing the current kiro.dev runtime and management APIs. Built on the OMP extension interface: pi.registerProvider("kiro", config) with device-code OAuth (/login), profile-scoped model discovery (fetchDynamicModels), and a custom EventStream runtime (streamSimple).

Install

Directly from npm:

omp plugin install omp-kiro

Or through this repository's OMP marketplace:

omp plugin marketplace add fanbaoyu1024/omp-kiro
omp plugin install omp-kiro@fanbaoyu-kiro

OMP loads the entry declared in package.json#omp.extensions (./dist/extension.js). Then log in:

omp /login
# choose: Kiro (AWS Builder ID / IAM Identity Center plugin)

The login prompts for your IAM Identity Center start URL (leave blank for AWS Builder ID), opens the device-code verification URL, and polls until you authorize. Credentials refresh automatically; the resolved profile ARN routes requests to the right Kiro profile.

Kiro CLI and OMP keep separate OAuth credentials. Switching accounts with kiro-cli does not switch the OMP account; run /login, choose Kiro again, and refresh the model catalog in OMP after an account change.

Check the authenticated account's current Kiro credits from OMP's standard usage surfaces (OMP builds with extension usage-provider support):

omp usage --provider kiro

or the /usage panel in the OMP TUI. On OMP builds without extension usage support, the plugin's own command reports the same snapshot:

/kiro-usage

Both report the subscription, precise credits used and remaining, percentage used, and the next reset date. /kiro-usage is kept as the compatibility command and works on every supported OMP version.

Provider identity

The plugin registers the canonical Kiro surfaces:

  • provider id: kiro
  • stream API id: kiro-api
  • display name: Kiro (AWS Builder ID / IAM Identity Center plugin)

When enabled, this plugin replaces or extends OMP's built-in Kiro registration. Do not install another Kiro provider extension alongside it.

How it works

  • OAuth: OIDC device authorization flow (client/register → device_authorization → token polling) against oidc.<region>.amazonaws.com. oauth.getApiKey returns a structured JSON API key ({token, region, profileArn}) that the stream layer parses.
  • Dynamic catalog: only fetchDynamicModels is configured — never models (OMP's registry ignores fetchDynamicModels when models is non-empty). The function returns the Kiro CLI 2.19.2 bootstrap catalog when unauthenticated. Once authenticated, the profile-scoped List-Available-Models response is authoritative: models omitted for the current account are removed rather than restored from an older bootstrap list.
  • Runtime: streamSimple posts to https://runtime.<region>.kiro.dev/generateAssistantResponse and decodes AWS application/vnd.amazon.eventstream frames (CRC-checked prelude/message framing) into OMP assistant events. Kiro's V1 stream reports context percentage and credits but no output-token count, so the plugin estimates output tokens from the emitted UTF-8 content and records TTFT/duration; this enables OMP's standard ⤵/⤴/⏱/⚡ tokens/s row. A transient fleet-only HTTP 400 Invalid tool use format. is retried exactly once with the identical payload and a fresh request ID; all other validation errors fail immediately.
  • Credits usage: each completed Kiro turn records the service's native {usage, unit: "credit"} event as Kiro <turn> credits · Σ <session total> and persists one hidden kiro-credit-metering session entry. On restart, resume, or branch switch, the total is rebuilt from the current branch only; malformed and abandoned-branch entries are ignored. OMP builds exposing ExtensionUIContext.setStatusLine render it inline in the main billing segment (replacing the bare (sub) marker); older OMP builds fall back to a separate hook-status row. The provider config also registers a standard OMP UsageProvider (usage field), so /usage and omp usage --provider kiro show the account-level used/limit/remaining balance and reset timestamp. /kiro-usage remains the compatibility command for hosts without extension usage-provider support.
  • Cache safety: only standard ProviderModelConfig fields are emitted. The region travels on the per-model baseUrl, the profile ARN in the standard x-amzn-kiro-profile-arn header, and the thinking surface in the standard thinking metadata — custom fields would be dropped by OMP's SQLite model cache.

Known limitations

  • OMP resolves the API key for fetchDynamicModels from the stored credential. When it is a plain bearer token (not the structured JSON this plugin's getApiKey produces for streaming), catalog discovery falls back to the default us-east-1 management region. Structured keys — including the one produced by oauth.getApiKey — carry the region and are honored when present.
  • The raw Kiro request-field schema cannot survive OMP's model cache; the wire effort vocabulary is approximated by the standard low→max ladder and the reasoning/output_config field choice is encoded in thinking.mode.
  • If the structured API key carries no profile ARN yet, the first stream resolves one via List-Available-Profiles; afterwards the resolved ARN is cached on the models' headers.

Development

bun install
bun run typecheck
bun run test
bun run build   # dist/ with bun + declaration files

License

MIT